--- src/sys/amd64/amd64/machdep.c 2007-11-15 23:00:57.000000000 +0100 +++ src/sys/amd64/amd64/machdep.c 2007-11-20 09:44:24.000000000 +0100 @@ -155,6 +155,9 @@ extern vm_offset_t ksym_start, ksym_end; #endif +/* Intel ICH register */ +#define ICH_PMBASE 0x400 + int _udatasel, _ucodesel, _ucode32sel; int cold = 1; @@ -192,6 +195,27 @@ cpu_startup(dummy) void *dummy; { + char *ichenv, *sysenv; + + /* + * On some systems, namely 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. + */ + ichenv = getenv("hw.ich.disable_legacy_usb"); + sysenv = getenv("smbios.system.product"); + if ((ichenv != NULL) || (sysenv != NULL && + strncmp(sysenv, "MacBook", 7) == 0)) { + if (bootverbose) + printf("Disabling LEGACY_USB_EN bit on Intel ICH.\n"); + outl(ICH_PMBASE + 0x30, inl(ICH_PMBASE + 0x30) & ~0x8); + } + if (ichenv) + freeenv(ichenv); + if (sysenv) + freeenv(sysenv); + /* * Good {morning,afternoon,evening,night}. */