From owner-freebsd-i386@FreeBSD.ORG Wed Nov 7 15:30:36 2007 Return-Path: Delivered-To: freebsd-i386@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71BF916A469 for ; Wed, 7 Nov 2007 15:30:36 +0000 (UTC) (envelope-from rpaulo@gmail.com) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.186]) by mx1.freebsd.org (Postfix) with ESMTP id F0E7F13C4C3 for ; Wed, 7 Nov 2007 15:30:35 +0000 (UTC) (envelope-from rpaulo@gmail.com) Received: by nf-out-0910.google.com with SMTP id b2so1768035nfb for ; Wed, 07 Nov 2007 07:30:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:from:to:in-reply-to:content-type:content-transfer-encoding:mime-version:subject:date:references:x-mailer:sender; bh=9vxS6o4N9rJvksxVxpa0oytQmiFaAmzQp7xxp+EghN8=; b=gxqvvkdzMRQOOtd8egnRELdKs6NhU/2xW6gtRrScbxwRlva3lr22SN4AGU7bfRx7Ezq7wn3RkSMKPATHkFKLglmtdDvwpiqpOau7rK4rZFXsy/USycJoUMW2LFyjN4jr8lUZCWVFAYO4nbef6gHtmsQNyYdmZzoGY4yyPnxK4dc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:from:to:in-reply-to:content-type:content-transfer-encoding:mime-version:subject:date:references:x-mailer:sender; b=gTO62O/KzA697fIitVerY/kAOrEs+QCBfsHMj/svqhTegoYJzJSJbYIgn9eyya+z4aLgLXD5WmoZJxdFVZjsRu+qUW7n0Zuo8MQfgV+A/US0M1P4D0PfzaBnumtJgAE4raqBe09gTjSoAw1ryYqKyDwCxT8vV8uK+Hna8d+h/qs= Received: by 10.86.95.20 with SMTP id s20mr5318157fgb.1194449424077; Wed, 07 Nov 2007 07:30:24 -0800 (PST) Received: from ?172.17.0.111? ( [193.136.24.128]) by mx.google.com with ESMTPS id d4sm836544fga.2007.11.07.07.30.10 (version=SSLv3 cipher=OTHER); Wed, 07 Nov 2007 07:30:11 -0800 (PST) Message-Id: From: Rui Paulo To: Scott Long , Rink Springer , freebsd-hardware@freebsd.org, freebsd-current@freebsd.org, freebsd-i386@FreeBSD.org In-Reply-To: <60C64C73-A019-4C01-85E1-80DF4C76B1AF@freebsd.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: Wed, 7 Nov 2007 15:30:08 +0000 References: <4A5A9C78-22AC-4480-BDEB-A72F6CF472DB@fnop.net> <20071104231422.GA82337@rink.nu> <472F5E62.4080406@samsco.org> <60C64C73-A019-4C01-85E1-80DF4C76B1AF@freebsd.org> X-Mailer: Apple Mail (2.912) Sender: Rui Paulo Cc: Subject: Re: MacBook users: possible fix for the SMP problem X-BeenThere: freebsd-i386@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: I386-specific issues for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Nov 2007 15:30:36 -0000 I'm requesting review for the following patch: Index: sys/i386/isa/clock.c =================================================================== RCS file: /home/ncvs/src/sys/i386/isa/clock.c,v retrieving revision 1.240 diff -u -p -r1.240 clock.c --- sys/i386/isa/clock.c 26 Oct 2007 03:23:54 -0000 1.240 +++ sys/i386/isa/clock.c 7 Nov 2007 15:27:21 -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,26 @@ i8254_init(void) void startrtclock() { + char *ichenv; 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"); + if (ichenv != NULL) { + if (bootverbose) + printf("Disabling LEGACY_USB_EN bit on Intel ICH.\n"); + outl(ICH_PMBASE + 0x30, inl(ICH_PMBASE + 0x30) & ~0x8); + freeenv(ichsmi); + } + freq = calibrate_clocks(); #ifdef CLK_CALIBRATION_LOOP if (bootverbose) { If you have a MacBook, you now need to set hw.ich.disable_legacy_usb on the boot loader prompt or in loader.conf. I decided to go this route because it seems safer. Imagine the case where there's a port at the same IO address that has nothing to do with the ICH7. If we tried to issue the outl() on every system, something bad could happen. Comments? Regards. -- Rui Paulo