PERFORCE change 28619 for review
Peter Wemm
peter at FreeBSD.org
Tue Apr 8 23:18:07 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=28619
Change 28619 by peter at peter_daintree on 2003/04/08 23:17:48
tidy up cpu identification.. there's still more cruft to go.
Affected files ...
.. //depot/projects/hammer/sys/conf/files.x86_64#16 edit
.. //depot/projects/hammer/sys/conf/options.x86_64#7 edit
.. //depot/projects/hammer/sys/x86_64/conf/GENERIC#5 edit
.. //depot/projects/hammer/sys/x86_64/x86_64/identcpu.c#5 edit
.. //depot/projects/hammer/sys/x86_64/x86_64/initcpu.c#3 edit
.. //depot/projects/hammer/sys/x86_64/x86_64/machdep.c#59 edit
Differences ...
==== //depot/projects/hammer/sys/conf/files.x86_64#16 (text+ko) ====
@@ -37,6 +37,8 @@
x86_64/x86_64/dump_machdep.c standard
x86_64/x86_64/elf_machdep.c standard
x86_64/x86_64/exception.s standard
+x86_64/x86_64/identcpu.c standard
+x86_64/x86_64/initcpu.c standard
x86_64/x86_64/legacy.c standard
x86_64/x86_64/locore.s standard no-obj
x86_64/x86_64/machdep.c standard
==== //depot/projects/hammer/sys/conf/options.x86_64#7 (text+ko) ====
@@ -53,9 +53,7 @@
# -------------------------------
# EOF
# -------------------------------
-CLAWHAMMER opt_cpu.h
-SLEDGEHAMMER opt_cpu.h
-HAMMER opt_cpu.h
+HAMMER opt_cpu.h
PPC_PROBE_CHIPSET opt_ppc.h
PPC_DEBUG opt_ppc.h
PSM_HOOKRESUME opt_psm.h
==== //depot/projects/hammer/sys/x86_64/conf/GENERIC#5 (text+ko) ====
@@ -19,7 +19,7 @@
# $FreeBSD: src/sys/i386/conf/GENERIC,v 1.368 2002/10/13 16:29:15 mike Exp $
machine x86_64
-cpu CLAWHAMMER
+cpu HAMMER
ident GENERIC
maxusers 0
==== //depot/projects/hammer/sys/x86_64/x86_64/identcpu.c#5 (text+ko) ====
@@ -57,8 +57,8 @@
#include <machine/specialreg.h>
#include <machine/md_var.h>
-#include <i386/isa/icu.h>
-#include <i386/isa/intr_machdep.h>
+#include <x86_64/isa/icu.h>
+#include <x86_64/isa/intr_machdep.h>
/* XXX - should be in header file: */
void printcpuinfo(void);
@@ -82,24 +82,9 @@
static char cpu_brand[48];
-static struct cpu_nameclass i386_cpus[] = {
- { "Intel 80286", CPUCLASS_286 }, /* CPU_286 */
- { "i386SX", CPUCLASS_386 }, /* CPU_386SX */
- { "i386DX", CPUCLASS_386 }, /* CPU_386 */
- { "i486SX", CPUCLASS_486 }, /* CPU_486SX */
- { "i486DX", CPUCLASS_486 }, /* CPU_486 */
- { "Pentium", CPUCLASS_586 }, /* CPU_586 */
- { "Cyrix 486", CPUCLASS_486 }, /* CPU_486DLC */
- { "Pentium Pro", CPUCLASS_686 }, /* CPU_686 */
- { "Cyrix 5x86", CPUCLASS_486 }, /* CPU_M1SC */
- { "Cyrix 6x86", CPUCLASS_486 }, /* CPU_M1 */
- { "Blue Lightning", CPUCLASS_486 }, /* CPU_BLUE */
- { "Cyrix 6x86MX", CPUCLASS_686 }, /* CPU_M2 */
- { "NexGen 586", CPUCLASS_386 }, /* CPU_NX586 (XXX) */
- { "Cyrix 486S/DX", CPUCLASS_486 }, /* CPU_CY486DX */
- { "Pentium II", CPUCLASS_686 }, /* CPU_PII */
- { "Pentium III", CPUCLASS_686 }, /* CPU_PIII */
- { "Pentium 4", CPUCLASS_686 }, /* CPU_P4 */
+static struct cpu_nameclass x86_64_cpus[] = {
+ { "Clawhammer", CPUCLASS_K8 }, /* CPU_CLAWHAMMER */
+ { "Sledgehammer", CPUCLASS_K8 }, /* CPU_SLEDGEHAMMER */
};
void
@@ -108,9 +93,9 @@
u_int regs[4], i;
char *brand;
- cpu_class = i386_cpus[cpu].cpu_class;
+ cpu_class = x86_64_cpus[cpu].cpu_class;
printf("CPU: ");
- strncpy(cpu_model, i386_cpus[cpu].cpu_name, sizeof (cpu_model));
+ strncpy(cpu_model, x86_64_cpus[cpu].cpu_name, sizeof (cpu_model));
/* Check for extended CPUID information and a processor name. */
if (cpu_high > 0 &&
@@ -164,11 +149,11 @@
printf("%s (", cpu_model);
switch(cpu_class) {
- case CPUCLASS_686:
+ case CPUCLASS_K8:
printf("%jd.%02d-MHz ",
(intmax_t)(tsc_freq + 4999) / 1000000,
(u_int)((tsc_freq + 4999) / 10000) % 100);
- printf("686");
+ printf("Hammer");
break;
default:
printf("Unknown"); /* will panic below... */
@@ -250,25 +235,24 @@
if (strcmp(cpu_vendor, "AuthenticAMD") == 0)
print_AMD_info();
- else if (strcmp(cpu_vendor, "GenuineTMx86") == 0 ||
- strcmp(cpu_vendor, "TransmetaCPU") == 0)
- print_transmeta_info();
}
void
panicifcpuunsupported(void)
{
+#ifndef HAMMER
+#error "You need to specify a cpu type"
+#endif
/*
* Now that we have told the user what they have,
* let them know if that machine type isn't configured.
*/
switch (cpu_class) {
- case CPUCLASS_286: /* a 286 should not make it this far, anyway */
- case CPUCLASS_386:
- case CPUCLASS_486:
- case CPUCLASS_586:
- case CPUCLASS_686:
+ case CPUCLASS_X86:
+#ifndef HAMMER
+ case CPUCLASS_K8:
+#endif
panic("CPU class not configured");
default:
break;
@@ -287,14 +271,17 @@
do_cpuid(0, regs);
cpu_high = regs[0];
((u_int *)&cpu_vendor)[0] = regs[1];
- ((u_int *)&cpu_vendor)[1] = regs[2];
- ((u_int *)&cpu_vendor)[2] = regs[3];
+ ((u_int *)&cpu_vendor)[1] = regs[3];
+ ((u_int *)&cpu_vendor)[2] = regs[2];
cpu_vendor[12] = '\0';
do_cpuid(1, regs);
cpu_id = regs[0];
cpu_procinfo = regs[1];
cpu_feature = regs[3];
+
+ /* XXX */
+ cpu = CPU_CLAWHAMMER;
}
static void
==== //depot/projects/hammer/sys/x86_64/x86_64/initcpu.c#3 (text+ko) ====
@@ -71,11 +71,6 @@
{
switch (cpu) {
- case CPU_686:
- if (strcmp(cpu_vendor, "GenuineIntel") == 0) {
- } else if (strcmp(cpu_vendor, "AuthenticAMD") == 0) {
- }
- break;
default:
break;
}
==== //depot/projects/hammer/sys/x86_64/x86_64/machdep.c#59 (text+ko) ====
@@ -113,12 +113,10 @@
extern void hammer_time(void);
extern void dblfault_handler(void);
-#if 0
extern void printcpuinfo(void); /* XXX header file */
-extern void finishidentcpu(void);
+extern void identify_cpu(void);
extern void panicifcpuunsupported(void);
extern void initializecpu(void);
-#endif
#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL)
#define EFL_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0)
@@ -164,10 +162,8 @@
* Good {morning,afternoon,evening,night}.
*/
startrtclock();
-#if 0
printcpuinfo();
panicifcpuunsupported();
-#endif
#ifdef PERFMON
perfmon_init();
#endif
@@ -1223,25 +1219,20 @@
Debugger("Boot flags requested debugger");
#endif
-#if 0
- finishidentcpu(); /* Final stage of CPU initialization */
-#endif
- setidt(6, &IDTVEC(ill), SDT_SYSTGT, 0);
- setidt(13, &IDTVEC(prot), SDT_SYSTGT, 0);
-#if 0
+ identify_cpu(); /* Final stage of CPU initialization */
initializecpu(); /* Initialize CPU registers */
-#endif
/* make an initial tss so cpu can get interrupt stack on syscall! */
common_tss.tss.tss_rsp0 = thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE - sizeof(struct pcb);
/* XXX we need to update tss_rsp0 in cpu_switch */
+ /* XXX maybe not yet, everything is still running in supervisor mode */
+
/* doublefault stack space, runs on ist1 */
common_tss.tss.tss_ist1 = (long)&dblfault_stack[sizeof(dblfault_stack)];
gsel_tss = GSEL(GPROC0_SEL, SEL_KPL);
ltr(gsel_tss);
-
getmemsize(kmdp, physfree);
init_param2(physmem);
@@ -1257,7 +1248,6 @@
thread0.td_pcb->pcb_flags = 0; /* XXXKSE */
thread0.td_pcb->pcb_cr3 = IdlePML4;
thread0.td_frame = &proc0_tf;
-
}
void
More information about the p4-projects
mailing list