From 6536499f7dfb62bbc8ddc2500e30e88abd38c26d Mon Sep 17 00:00:00 2001 From: Rui Paulo Date: Wed, 19 Dec 2007 21:08:33 +0000 Subject: [PATCH] MFC revision 1.679: Disallow the legacy USB circuit to generate an SMI# via an ICH register (MacBooks only). This allows MacBooks to boot in SMP mode without any trick and solves the timer problems with HZ=1000. Approved by: re (kensmith), njl (mentor) --- sys/amd64/amd64/machdep.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index b0c918bc21fa..24c9d40435d7 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -154,6 +154,10 @@ SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL) extern vm_offset_t ksym_start, ksym_end; #endif +/* Intel ICH registers */ +#define ICH_PMBASE 0x400 +#define ICH_SMI_EN ICH_PMBASE + 0x30 + int _udatasel, _ucodesel, _ucode32sel; int cold = 1; @@ -185,6 +189,27 @@ static void cpu_startup(dummy) void *dummy; { + char *sysenv; + + /* + * On MacBooks, we need to disallow the legacy USB circuit to + * generate an SMI# because this can cause several problems, + * namely: incorrect CPU frequency detection and failure to + * start the APs. + * We do this by disabling a bit in the SMI_EN (SMI Control and + * Enable register) of the Intel ICH LPC Interface Bridge. + */ + sysenv = getenv("smbios.system.product"); + if (sysenv != NULL) { + if (strncmp(sysenv, "MacBook", 7) == 0) { + if (bootverbose) + printf("Disabling LEGACY_USB_EN bit on " + "Intel ICH.\n"); + outl(ICH_SMI_EN, inl(ICH_SMI_EN) & ~0x8); + } + freeenv(sysenv); + } + /* * Good {morning,afternoon,evening,night}. */