From owner-freebsd-hardware@FreeBSD.ORG Mon Nov 12 21:20:55 2007 Return-Path: Delivered-To: freebsd-hardware@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 232A716A46B; Mon, 12 Nov 2007 21:20:55 +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 85FD313C4E5; Mon, 12 Nov 2007 21:20:53 +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 218966963-1834499 for multiple; Mon, 12 Nov 2007 16:21:14 -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 lACLKQj9043273; Mon, 12 Nov 2007 16:20:26 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: "Rui Paulo" Date: Mon, 12 Nov 2007 16:11:36 -0500 User-Agent: KMail/1.9.6 References: <4A5A9C78-22AC-4480-BDEB-A72F6CF472DB@fnop.net> <200711121351.58616.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200711121611.37781.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 16:20:26 -0500 (EST) X-Virus-Scanned: ClamAV 0.91.2/4757/Mon Nov 12 12:20:27 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: freebsd-current@freebsd.org, freebsd-i386@freebsd.org, freebsd-hardware@freebsd.org Subject: Re: MacBook users: possible fix for the SMP problem X-BeenThere: freebsd-hardware@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General discussion of FreeBSD hardware List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Nov 2007 21:20:55 -0000 On Monday 12 November 2007 03:19:23 pm Rui Paulo wrote: > On Nov 12, 2007 6:51 PM, John Baldwin wrote: > > > > 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. > > Yeah, Nate already pointed that out. Could you check your inbox, > please? Nate asked you if this was the proper place to add this code. 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? -- John Baldwin