From owner-freebsd-current@FreeBSD.ORG Mon Nov 12 18:53:19 2007 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 441D916A468 for ; Mon, 12 Nov 2007 18:53:19 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from speedfactory.net (mail6.speedfactory.net [66.23.216.219]) by mx1.freebsd.org (Postfix) with ESMTP id 4586B13C491 for ; Mon, 12 Nov 2007 18:53:18 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (unverified [66.23.211.162]) by speedfactory.net (SurgeMail 3.8p) with ESMTP id 218938194-1834499 for multiple; Mon, 12 Nov 2007 13:53:08 -0500 Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.8/8.13.8) with ESMTP id lACIqII8042270; Mon, 12 Nov 2007 13:52:19 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-hardware@freebsd.org Date: Mon, 12 Nov 2007 13:51:57 -0500 User-Agent: KMail/1.9.6 References: <4A5A9C78-22AC-4480-BDEB-A72F6CF472DB@fnop.net> <473232A8.3080105@samsco.org> <5A4AF64C-D70A-4303-8116-D13718EE8BCC@FreeBSD.org> In-Reply-To: <5A4AF64C-D70A-4303-8116-D13718EE8BCC@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200711121351.58616.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Mon, 12 Nov 2007 13:52:20 -0500 (EST) X-Virus-Scanned: ClamAV 0.91.2/4756/Mon Nov 12 10:28:55 2007 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: Rink Springer , Rui Paulo , freebsd-current@freebsd.org, freebsd-i386@freebsd.org Subject: Re: MacBook users: possible fix for the SMP problem X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Nov 2007 18:53:19 -0000 On Friday 09 November 2007 06:40:48 am Rui Paulo wrote: > On 7 Nov 2007, at 21:48, Scott Long wrote: > > > Rui Paulo wrote: > >> On Nov 7, 2007 7:50 PM, Maxim Sobolev wrote: > >>> I don't really like the fact that it has to be turned on manually. > >>> Is it > >>> possible to make this automatic based on BIOS Id or something like > >>> this? > >> Yes, I can turn this on for MacBooks. > > > > Yeah, at least have it on by default for the systems that we know have > > the problem. I still think that it needs wider application, but as > > long > > as the immediate and identifiable issue is addressed, I'm happy. > > > Ok, if there are no objections, I plan to request approval from my > mentor and from re@ for the following patch: > > Index: clock.c > =================================================================== > RCS file: /home/ncvs/src/sys/i386/isa/clock.c,v > retrieving revision 1.240 > diff -u -p -r1.240 clock.c > --- clock.c 26 Oct 2007 03:23:54 -0000 1.240 > +++ clock.c 9 Nov 2007 11:34:56 -0000 > @@ -130,6 +130,9 @@ static u_char rtc_statusb = RTCSB_24HR; > #define ACQUIRED 2 > #define ACQUIRE_PENDING 3 > > +/* Intel ICH register */ > +#define ICH_PMBASE 0x400 > + > static u_char timer2_state; > > static unsigned i8254_get_timecount(struct timecounter *tc); > @@ -616,11 +619,31 @@ i8254_init(void) > void > startrtclock() > { > + char *ichenv, *sysenv; > u_int delta, freq; > > writertc(RTC_STATUSA, rtc_statusa); > writertc(RTC_STATUSB, RTCSB_24HR); > > + /* > + * 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); > + } > + This is missing a freeenv(sysenv) in the case that ichenv is NULL and sysenv != "MacBook". Perhaps move the freeenv()'s out of the if statement. -- John Baldwin