From owner-freebsd-current@FreeBSD.ORG Fri Nov 9 11:41:09 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 3B7F016A41B for ; Fri, 9 Nov 2007 11:41:09 +0000 (UTC) (envelope-from rpaulo@gmail.com) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.171]) by mx1.freebsd.org (Postfix) with ESMTP id 9E38613C4BA for ; Fri, 9 Nov 2007 11:41:08 +0000 (UTC) (envelope-from rpaulo@gmail.com) Received: by ug-out-1314.google.com with SMTP id y2so642756uge for ; Fri, 09 Nov 2007 03:41:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:cc:message-id:from:to:in-reply-to:content-type:content-transfer-encoding:mime-version:subject:date:references:x-mailer:sender; bh=1Mwcp5JNIBhySItAUpV18JEahQZJClmIl3x6Jln9+5w=; b=XYo0jFUWeGd8n13Hej/rxyq6LgFtThF8kKBkwSkYqhCS0F5OZygs6TN0JaaM6pkBktusOTect+LBVhKTOc2f24kEAJBbcLiF1hndnJHu+R6MhYI2OWS4k2CwLeD1UJMjcNNjS4D/04nDc/j/g7pb2WCZgbw9IVe0il9oBHCgFnc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:cc:message-id:from:to:in-reply-to:content-type:content-transfer-encoding:mime-version:subject:date:references:x-mailer:sender; b=J7YzjSbkekAYATbmzYClsWnZTGV3pmKaJwRlP7ODnKlH2uJtUs6hiSzkOFiysaccot6M6TVg1FOh59juXVCLMJwwdKmjbhq6hy8zEQK/46ak8Bx3jN44WOgVya8m/Od/N/iTi80eR5C8e11oUEAwDelhgcMPer1IdwB7NF+Byf0= Received: by 10.78.132.2 with SMTP id f2mr2240814hud.1194608460305; Fri, 09 Nov 2007 03:41:00 -0800 (PST) Received: from ?172.17.2.171? ( [193.136.24.128]) by mx.google.com with ESMTPS id g8sm4027472muf.2007.11.09.03.40.51 (version=SSLv3 cipher=OTHER); Fri, 09 Nov 2007 03:40:54 -0800 (PST) Message-Id: <5A4AF64C-D70A-4303-8116-D13718EE8BCC@FreeBSD.org> From: Rui Paulo To: Scott Long In-Reply-To: <473232A8.3080105@samsco.org> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v912) Date: Fri, 9 Nov 2007 11:40:48 +0000 References: <4A5A9C78-22AC-4480-BDEB-A72F6CF472DB@fnop.net> <20071104231422.GA82337@rink.nu> <472F5E62.4080406@samsco.org> <60C64C73-A019-4C01-85E1-80DF4C76B1AF@freebsd.org> <4732171F.3010803@FreeBSD.org> <473232A8.3080105@samsco.org> X-Mailer: Apple Mail (2.912) Sender: Rui Paulo Cc: freebsd-current@FreeBSD.org, Maxim Sobolev , Rink Springer , 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: Fri, 09 Nov 2007 11:41:09 -0000 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); + } + freq = calibrate_clocks(); #ifdef CLK_CALIBRATION_LOOP if (bootverbose) { -- Rui Paulo