Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Nov 2007 09:59:35 +0000
From:      "Rui Paulo" <rpaulo@FreeBSD.org>
To:        "John Baldwin" <jhb@freebsd.org>
Cc:        freebsd-current@freebsd.org, freebsd-i386@freebsd.org, freebsd-hardware@freebsd.org
Subject:   Re: MacBook users: possible fix for the SMP problem
Message-ID:  <e1309ba60711140159x4c1143b1n6d3d791cca80d61b@mail.gmail.com>
In-Reply-To: <200711121611.37781.jhb@freebsd.org>
References:  <4A5A9C78-22AC-4480-BDEB-A72F6CF472DB@fnop.net> <200711121351.58616.jhb@freebsd.org> <e1309ba60711121219i1ca9773ei2fc3796849e1a669@mail.gmail.com> <200711121611.37781.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Nov 12, 2007 9:11 PM, John Baldwin <jhb@freebsd.org> wrote:
> I'm not sure where exactly one would add it, but I don't think the RTC clock
> routine is the right place.  Maybe do it at the start of cpu_startup() in
> machdep.c instead?

That works for me.

See the attached patch.

Regards.
-- 
Rui Paulo

[-- Attachment #2 --]
Index: i386/machdep.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/i386/machdep.c,v
retrieving revision 1.660
diff -u -p -r1.660 machdep.c
--- i386/machdep.c	5 Nov 2007 11:36:11 -0000	1.660
+++ i386/machdep.c	14 Nov 2007 09:57:09 -0000
@@ -174,6 +174,9 @@ SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST,
 extern vm_offset_t ksym_start, ksym_end;
 #endif
 
+/* Intel ICH register */
+#define ICH_PMBASE     0x400
+
 int	_udatasel, _ucodesel;
 u_int	basemem;
 
@@ -219,6 +222,27 @@ static void
 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}.
 	 */

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e1309ba60711140159x4c1143b1n6d3d791cca80d61b>