diff options
author | Dimitry Andric <dim@cvs.openbsd.org> | 2006-11-28 15:24:09 +0000 |
---|---|---|
committer | Dimitry Andric <dim@cvs.openbsd.org> | 2006-11-28 15:24:09 +0000 |
commit | e68a3442845e193a043b69a8c3fa3ae6520ef9fd (patch) | |
tree | 8d9b37f4403c7ea9c9d838ba46ce29e634fa28e9 /sys/arch | |
parent | 7bb3022d99cdfb308fb6eb3adcb6d015184d8497 (diff) |
Only use est and other non-acpi setperf mechanisms, if acpi is not
attached. Also moves their initialization and printing of
information until after the primary cpu has attached to mainbus.
prodded by deraadt
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/i386/i386/machdep.c | 93 | ||||
-rw-r--r-- | sys/arch/i386/i386/mainbus.c | 20 |
2 files changed, 81 insertions, 32 deletions
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 83b9e14589f..d1077f0ab3f 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.367 2006/10/17 21:28:23 tom Exp $ */ +/* $OpenBSD: machdep.c,v 1.368 2006/11/28 15:24:08 dim Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -255,6 +255,7 @@ int kbd_reset; int p4_model; int p3_early; int bus_clock; +void (*setperf_setup)(struct cpu_info *); int setperf_prio = 0; /* for concurrent handlers */ void (*delay_func)(int) = i8254_delay; @@ -334,12 +335,16 @@ int cpu_pae = 0; #endif void winchip_cpu_setup(struct cpu_info *); +void amd_family5_setperf_setup(struct cpu_info *); void amd_family5_setup(struct cpu_info *); +void amd_family6_setperf_setup(struct cpu_info *); void amd_family6_setup(struct cpu_info *); +void cyrix3_setperf_setup(struct cpu_info *); void cyrix3_cpu_setup(struct cpu_info *); void cyrix6x86_cpu_setup(struct cpu_info *); void natsem6x86_cpu_setup(struct cpu_info *); void intel586_cpu_setup(struct cpu_info *); +void intel686_setperf_setup(struct cpu_info *); void intel686_common_cpu_setup(struct cpu_info *); void intel686_cpu_setup(struct cpu_info *); void intel686_p4_cpu_setup(struct cpu_info *); @@ -419,9 +424,8 @@ cpu_startup() startrtclock(); /* - * XXX SMP XXX identifycpu shouldn't need to be called here, but - * mpbios is broken otherwise. Also, curcpu is not quite fully - * initialized this early either, so some extra work is needed. + * We need to call identifycpu here early, so users have at least some + * basic information, if booting hangs later on. */ strlcpy(curcpu()->ci_dev.dv_xname, "cpu0", sizeof(curcpu()->ci_dev.dv_xname)); @@ -1165,6 +1169,22 @@ winchip_cpu_setup(struct cpu_info *ci) #endif } +#if defined(I686_CPU) && !defined(SMALL_KERNEL) +void +cyrix3_setperf_setup(struct cpu_info *ci) +{ + cyrix3_get_bus_clock(ci); + + if (cpu_ecxfeature & CPUIDECX_EST) { + if (rdmsr(MSR_MISC_ENABLE) & (1 << 16)) + est_init(ci->ci_dev.dv_xname, CPUVENDOR_VIA); + else + printf("%s: Enhanced SpeedStep disabled by BIOS\n", + ci->ci_dev.dv_xname); + } +} +#endif + void cyrix3_cpu_setup(struct cpu_info *ci) { @@ -1181,15 +1201,7 @@ cyrix3_cpu_setup(struct cpu_info *ci) pagezero = i686_pagezero; - cyrix3_get_bus_clock(ci); - - if (cpu_ecxfeature & CPUIDECX_EST) { - if (rdmsr(MSR_MISC_ENABLE) & (1 << 16)) - est_init(ci->ci_dev.dv_xname, CPUVENDOR_VIA); - else - printf("%s: Enhanced SpeedStep disabled by BIOS\n", - ci->ci_dev.dv_xname); - } + setperf_setup = cyrix3_setperf_setup; #endif switch (model) { @@ -1369,6 +1381,14 @@ intel586_cpu_setup(struct cpu_info *ci) #endif } +#if !defined(SMALL_KERNEL) && defined(I586_CPU) +void +amd_family5_setperf_setup(struct cpu_info *ci) +{ + k6_powernow_init(); +} +#endif + void amd_family5_setup(struct cpu_info *ci) { @@ -1392,12 +1412,29 @@ amd_family5_setup(struct cpu_info *ci) case 12: case 13: #if !defined(SMALL_KERNEL) && defined(I586_CPU) - k6_powernow_init(); + setperf_setup = amd_family5_setperf_setup; #endif break; } } +#if !defined(SMALL_KERNEL) && defined(I686_CPU) && !defined(MULTIPROCESSOR) +void +amd_family6_setperf_setup(struct cpu_info *ci) +{ + int family = (ci->ci_signature >> 8) & 15; + + switch (family) { + case 6: + k7_powernow_init(); + break; + case 15: + k8_powernow_init(); + break; + } +} +#endif /* !SMALL_KERNEL && I686_CPU && !MULTIPROCESSOR */ + void amd_family6_setup(struct cpu_info *ci) { @@ -1405,9 +1442,6 @@ amd_family6_setup(struct cpu_info *ci) extern void (*pagezero)(void *, size_t); extern void sse2_pagezero(void *, size_t); extern void i686_pagezero(void *, size_t); -#if !defined(MULTIPROCESSOR) - int family = (ci->ci_signature >> 8) & 15; -#endif if (cpu_feature & CPUID_SSE2) pagezero = sse2_pagezero; @@ -1415,24 +1449,15 @@ amd_family6_setup(struct cpu_info *ci) pagezero = i686_pagezero; #if !defined(MULTIPROCESSOR) - switch (family) { - case 6: - k7_powernow_init(); - break; - case 15: - k8_powernow_init(); - break; - } + setperf_setup = amd_family6_setperf_setup; #endif #endif } +#if !defined(SMALL_KERNEL) && defined(I686_CPU) && !defined(MULTIPROCESSOR) void -intel686_common_cpu_setup(struct cpu_info *ci) +intel686_setperf_setup(struct cpu_info *ci) { - -#if !defined(SMALL_KERNEL) && defined(I686_CPU) -#if !defined(MULTIPROCESSOR) int family = (ci->ci_signature >> 8) & 15; int step = ci->ci_signature & 15; @@ -1445,6 +1470,16 @@ intel686_common_cpu_setup(struct cpu_info *ci) } else if ((cpu_feature & (CPUID_ACPI | CPUID_TM)) == (CPUID_ACPI | CPUID_TM)) p4tcc_init(family, step); +} +#endif + +void +intel686_common_cpu_setup(struct cpu_info *ci) +{ + +#if !defined(SMALL_KERNEL) && defined(I686_CPU) +#if !defined(MULTIPROCESSOR) + setperf_setup = intel686_setperf_setup; #endif { extern void (*pagezero)(void *, size_t); diff --git a/sys/arch/i386/i386/mainbus.c b/sys/arch/i386/i386/mainbus.c index f96cb8284cc..a0c1b4ce648 100644 --- a/sys/arch/i386/i386/mainbus.c +++ b/sys/arch/i386/i386/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.28 2006/11/27 18:04:28 gwk Exp $ */ +/* $OpenBSD: mainbus.c,v 1.29 2006/11/28 15:24:08 dim Exp $ */ /* $NetBSD: mainbus.c,v 1.21 1997/06/06 23:14:20 thorpej Exp $ */ /* @@ -142,6 +142,10 @@ void mainbus_attach(struct device *parent, struct device *self, void *aux) { union mainbus_attach_args mba; +#if NACPI > 0 + int acpi_attached = 0; +#endif + extern void (*setperf_setup)(struct cpu_info *); extern int cpu_id, cpu_feature; printf("\n"); @@ -164,10 +168,12 @@ mainbus_attach(struct device *parent, struct device *self, void *aux) mba.mba_aaa.aaa_iot = I386_BUS_SPACE_IO; mba.mba_aaa.aaa_memt = I386_BUS_SPACE_MEM; - if (acpi_probe(self, aux, &mba.mba_aaa)) - config_found(self, &mba.mba_aaa, mainbus_print); + if (acpi_probe(self, aux, &mba.mba_aaa) && + config_found(self, &mba.mba_aaa, mainbus_print) != NULL) + acpi_attached = 1; } #endif + #if NIPMI > 0 { memset(&mba.mba_iaa, 0, sizeof(mba.mba_iaa)); @@ -198,6 +204,14 @@ mainbus_attach(struct device *parent, struct device *self, void *aux) config_found(self, &caa, mainbus_print); } +#if NACPI > 0 + if (!acpi_attached) +#endif + { + if (setperf_setup != NULL) + setperf_setup(&cpu_info_primary); + } + #if NVESABIOS > 0 if (vbeprobe()) { mba.mba_busname = "vesabios"; |