From owner-freebsd-current@FreeBSD.ORG Mon Nov 12 20:19:34 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 3BD1616A421 for ; Mon, 12 Nov 2007 20:19:34 +0000 (UTC) (envelope-from rpaulo@gmail.com) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.179]) by mx1.freebsd.org (Postfix) with ESMTP id DA1F813C4CE for ; Mon, 12 Nov 2007 20:19:33 +0000 (UTC) (envelope-from rpaulo@gmail.com) Received: by py-out-1112.google.com with SMTP id u77so1547825pyb for ; Mon, 12 Nov 2007 12:19:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=cwtkvAa3KRugUle3sikVwZvRfYEcse0jYQVYlnFFvNU=; b=FCDkrRgsTOA2G1X+n7CMyKRIV8XlB9xc5sOoH0eOoUG6A8gE5atMEIqSIKj02/N1KbPagp2wt39ZWscM82DBS9Vb4RBrdKe8jHf5hJs5JrvvKniTitHjgk+k8J52zzYBMu9CAYycpm4gqgPUrzspvI/PiHBlkaO5TAFTGIGLxZY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=dX5PQ8jR35Eixk/uS6MTZZGeTIKpVPnm9W3f9x9zb8i7ekf++DBZsUjGzs7CT6RaZPbrBnxcNtJ1j9bUPLI5urSgi0eV4tIvqEssT3Z3ZTZo4oMxPTPowtCPbQuw/ByXu7J9jDt9N65MuyLHTtPOJS+6IiB5nhmfalzi4WCP0mY= Received: by 10.35.78.9 with SMTP id f9mr2701326pyl.1194898763111; Mon, 12 Nov 2007 12:19:23 -0800 (PST) Received: by 10.35.76.2 with HTTP; Mon, 12 Nov 2007 12:19:23 -0800 (PST) Message-ID: Date: Mon, 12 Nov 2007 20:19:23 +0000 From: "Rui Paulo" Sender: rpaulo@gmail.com To: "John Baldwin" In-Reply-To: <200711121351.58616.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4A5A9C78-22AC-4480-BDEB-A72F6CF472DB@fnop.net> <473232A8.3080105@samsco.org> <5A4AF64C-D70A-4303-8116-D13718EE8BCC@FreeBSD.org> <200711121351.58616.jhb@freebsd.org> X-Google-Sender-Auth: fb8e40cb068bdcdc 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-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 20:19:34 -0000 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. Regards. -- Rui Paulo