summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrpaulo <rpaulo@FreeBSD.org>2007-12-12 20:24:06 +0000
committerrpaulo <rpaulo@FreeBSD.org>2007-12-12 20:24:06 +0000
commit59ef90c02df1fbdd88915fef02d7b0fcc73ecf41 (patch)
treeeb005d916961173ecc3365e9a4e1890ae59f6a31
parent95a448c7cbf19f26d0ed071ced5ce83aeeb2c4b2 (diff)
downloadFreeBSD-src-59ef90c02df1fbdd88915fef02d7b0fcc73ecf41.zip
FreeBSD-src-59ef90c02df1fbdd88915fef02d7b0fcc73ecf41.tar.gz
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. MFC after: 1 week Reviewed by: njl (mentor), jhb Approved by: njl (mentor), jhb
-rw-r--r--sys/amd64/amd64/machdep.c25
-rw-r--r--sys/i386/i386/machdep.c25
2 files changed, 50 insertions, 0 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 1928518..24226f7 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -155,6 +155,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;
@@ -192,6 +196,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}.
*/
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index eeedf39..c8834c7 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -173,6 +173,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;
u_int basemem;
@@ -1122,6 +1126,27 @@ SYSCTL_INT(_machdep, OID_AUTO, cpu_idle_hlt, CTLFLAG_RW,
static void
cpu_idle_default(void)
{
+ 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);
+ }
+
/*
* we must absolutely guarentee that hlt is the
* absolute next instruction after sti or we
OpenPOWER on IntegriCloud