diff options
author | jhb <jhb@FreeBSD.org> | 2016-11-08 06:13:22 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2016-11-08 06:13:22 +0000 |
commit | d0ef2d28ec977696c1bed1b44f5cd45c782a40d6 (patch) | |
tree | 0458d6e97f571a880ff0c645e7cf312968846eda /sys | |
parent | 3b5cc25eb30f8708b04139fd3ff550590382c6ad (diff) | |
download | FreeBSD-src-d0ef2d28ec977696c1bed1b44f5cd45c782a40d6.zip FreeBSD-src-d0ef2d28ec977696c1bed1b44f5cd45c782a40d6.tar.gz |
MFC 305836: Remove 'cpu' and 'cpu_class' on amd64.
The 'cpu' and 'cpu_class' variables were always set to the same value
on amd64 and are legacy holdovers from i386. Remove them entirely on
amd64.
Requested by: kib (MFC)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/amd64/machdep.c | 1 | ||||
-rw-r--r-- | sys/amd64/include/cputypes.h | 46 | ||||
-rw-r--r-- | sys/compat/linprocfs/linprocfs.c | 31 | ||||
-rw-r--r-- | sys/i386/include/cputypes.h | 5 | ||||
-rw-r--r-- | sys/i386/include/md_var.h | 1 | ||||
-rw-r--r-- | sys/x86/include/cputypes.h | 5 | ||||
-rw-r--r-- | sys/x86/include/x86_var.h | 1 | ||||
-rw-r--r-- | sys/x86/x86/identcpu.c | 43 |
8 files changed, 23 insertions, 110 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 8aa21bb..5664b3d 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -273,7 +273,6 @@ cpu_startup(dummy) */ startrtclock(); printcpuinfo(); - panicifcpuunsupported(); #ifdef PERFMON perfmon_init(); #endif diff --git a/sys/amd64/include/cputypes.h b/sys/amd64/include/cputypes.h index 5a70462..31c8e41 100644 --- a/sys/amd64/include/cputypes.h +++ b/sys/amd64/include/cputypes.h @@ -1,48 +1,6 @@ /*- - * Copyright (c) 1993 Christopher G. Demetriou - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ + * This file is in the public domain. */ - -#ifndef _MACHINE_CPUTYPES_H_ -#define _MACHINE_CPUTYPES_H_ +/* $FreeBSD$ */ #include <x86/cputypes.h> - -/* - * Classes of processor. - */ -#define CPUCLASS_X86 0 /* X86 */ -#define CPUCLASS_K8 1 /* K8 AMD64 class */ - -/* - * Kinds of processor. - */ -#define CPU_X86 0 /* Intel */ -#define CPU_CLAWHAMMER 1 /* AMD Clawhammer */ -#define CPU_SLEDGEHAMMER 2 /* AMD Sledgehammer */ - -#endif /* !_MACHINE_CPUTYPES_H_ */ diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index a0dce47..f1bae96 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -218,7 +218,7 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) char model[128]; uint64_t freq; size_t size; - int class, fqmhz, fqkhz; + int fqmhz, fqkhz; int i; /* @@ -235,33 +235,6 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) "3dnowext", "3dnow" }; - switch (cpu_class) { -#ifdef __i386__ - case CPUCLASS_286: - class = 2; - break; - case CPUCLASS_386: - class = 3; - break; - case CPUCLASS_486: - class = 4; - break; - case CPUCLASS_586: - class = 5; - break; - case CPUCLASS_686: - class = 6; - break; - default: - class = 0; - break; -#else /* __amd64__ */ - default: - class = 15; - break; -#endif - } - hw_model[0] = CTL_HW; hw_model[1] = HW_MODEL; model[0] = '\0'; @@ -286,7 +259,7 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) #ifdef __i386__ switch (cpu_vendor_id) { case CPU_VENDOR_AMD: - if (class < 6) + if (cpu_class < CPUCLASS_686) flags[16] = "fcmov"; break; case CPU_VENDOR_CYRIX: diff --git a/sys/i386/include/cputypes.h b/sys/i386/include/cputypes.h index fb0fa47..02af4f1 100644 --- a/sys/i386/include/cputypes.h +++ b/sys/i386/include/cputypes.h @@ -63,4 +63,9 @@ #define CPU_P4 16 /* Intel Pentium 4 */ #define CPU_GEODE1100 17 /* NS Geode SC1100 */ +#ifndef LOCORE +extern int cpu; +extern int cpu_class; +#endif + #endif /* !_MACHINE_CPUTYPES_H_ */ diff --git a/sys/i386/include/md_var.h b/sys/i386/include/md_var.h index c4c9ca9..337f541 100644 --- a/sys/i386/include/md_var.h +++ b/sys/i386/include/md_var.h @@ -65,6 +65,7 @@ void i686_pagezero(void *addr); void sse2_pagezero(void *addr); void init_AMD_Elan_sc520(void); vm_paddr_t kvtop(void *addr); +void panicifcpuunsupported(void); void ppro_reenable_apic(void); void setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int selec); union savefpu *get_pcb_user_save_td(struct thread *td); diff --git a/sys/x86/include/cputypes.h b/sys/x86/include/cputypes.h index ca6ce83..4b8bd10 100644 --- a/sys/x86/include/cputypes.h +++ b/sys/x86/include/cputypes.h @@ -46,9 +46,4 @@ #define CPU_VENDOR_RISE 0xdead2bad /* Rise */ #define CPU_VENDOR_CENTAUR CPU_VENDOR_IDT -#ifndef LOCORE -extern int cpu; -extern int cpu_class; -#endif - #endif /* !_X86_CPUTYPES_H_ */ diff --git a/sys/x86/include/x86_var.h b/sys/x86/include/x86_var.h index 07e9d80..d04ab9b 100644 --- a/sys/x86/include/x86_var.h +++ b/sys/x86/include/x86_var.h @@ -107,7 +107,6 @@ bool fix_cpuid(void); void fillw(int /*u_short*/ pat, void *base, size_t cnt); int is_physical_memory(vm_paddr_t addr); int isa_nmi(int cd); -void panicifcpuunsupported(void); void pagecopy(void *from, void *to); void printcpuinfo(void); int user_dbreg_trap(void); diff --git a/sys/x86/x86/identcpu.c b/sys/x86/x86/identcpu.c index 10d02f3..11627ce 100644 --- a/sys/x86/x86/identcpu.c +++ b/sys/x86/x86/identcpu.c @@ -87,8 +87,10 @@ static void print_svm_info(void); static void print_via_padlock_info(void); static void print_vmx_info(void); +#ifdef __i386__ int cpu; /* Are we 386, 386sx, 486, etc? */ int cpu_class; +#endif u_int cpu_feature; /* Feature flags */ u_int cpu_feature2; /* Feature flags */ u_int amd_feature; /* AMD feature flags */ @@ -184,13 +186,11 @@ static const char *cpu_brandtable[MAX_BRAND_INDEX + 1] = { NULL, "Intel Pentium 4" }; -#endif static struct { char *cpu_name; int cpu_class; } cpus[] = { -#ifdef __i386__ { "Intel 80286", CPUCLASS_286 }, /* CPU_286 */ { "i386SX", CPUCLASS_386 }, /* CPU_386SX */ { "i386DX", CPUCLASS_386 }, /* CPU_386 */ @@ -208,11 +208,8 @@ static struct { { "Pentium II", CPUCLASS_686 }, /* CPU_PII */ { "Pentium III", CPUCLASS_686 }, /* CPU_PIII */ { "Pentium 4", CPUCLASS_686 }, /* CPU_P4 */ -#else - { "Clawhammer", CPUCLASS_K8 }, /* CPU_CLAWHAMMER */ - { "Sledgehammer", CPUCLASS_K8 }, /* CPU_SLEDGEHAMMER */ -#endif }; +#endif static struct { char *vendor; @@ -242,9 +239,13 @@ printcpuinfo(void) u_int regs[4], i; char *brand; - cpu_class = cpus[cpu].cpu_class; printf("CPU: "); +#ifdef __i386__ + cpu_class = cpus[cpu].cpu_class; strncpy(cpu_model, cpus[cpu].cpu_name, sizeof (cpu_model)); +#else + strncpy(cpu_model, "Hammer", sizeof (cpu_model)); +#endif /* Check for extended CPUID information and a processor name. */ if (cpu_exthigh >= 0x80000004) { @@ -697,8 +698,8 @@ printcpuinfo(void) (intmax_t)(tsc_freq + 4999) / 1000000, (u_int)((tsc_freq + 4999) / 10000) % 100); } - switch(cpu_class) { #ifdef __i386__ + switch(cpu_class) { case CPUCLASS_286: printf("286"); break; @@ -720,14 +721,12 @@ printcpuinfo(void) printf("686"); break; #endif -#else - case CPUCLASS_K8: - printf("K8"); - break; -#endif default: printf("Unknown"); /* will panic below... */ } +#else + printf("K8"); +#endif printf("-class CPU)\n"); if (*cpu_vendor) printf(" Origin=\"%s\"", cpu_vendor); @@ -1051,28 +1050,22 @@ printcpuinfo(void) print_hypervisor_info(); } +#ifdef __i386__ void panicifcpuunsupported(void) { -#ifdef __i386__ #if !defined(lint) #if !defined(I486_CPU) && !defined(I586_CPU) && !defined(I686_CPU) #error This kernel is not configured for one of the supported CPUs #endif #else /* lint */ #endif /* lint */ -#else /* __amd64__ */ -#ifndef HAMMER -#error "You need to specify a cpu type" -#endif -#endif /* * Now that we have told the user what they have, * let them know if that machine type isn't configured. */ switch (cpu_class) { -#ifdef __i386__ case CPUCLASS_286: /* a 286 should not make it this far, anyway */ case CPUCLASS_386: #if !defined(I486_CPU) @@ -1084,19 +1077,12 @@ panicifcpuunsupported(void) #if !defined(I686_CPU) case CPUCLASS_686: #endif -#else /* __amd64__ */ - case CPUCLASS_X86: -#ifndef HAMMER - case CPUCLASS_K8: -#endif -#endif panic("CPU class not configured"); default: break; } } -#ifdef __i386__ static volatile u_int trap_by_rdmsr; /* @@ -1580,9 +1566,6 @@ identify_cpu(void) return; } } -#else - /* XXX */ - cpu = CPU_CLAWHAMMER; #endif } |