Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 09 Nov 2007 16:43:23 -0800
From:      Maxim Sobolev <sobomax@FreeBSD.org>
To:        Rui Paulo <rpaulo@FreeBSD.org>
Cc:        freebsd-current@FreeBSD.org, Rink Springer <rink@FreeBSD.org>, freebsd-i386@FreeBSD.org, freebsd-hardware@FreeBSD.org
Subject:   Re: MacBook users: possible fix for the SMP problem
Message-ID:  <4734FEAB.2070400@FreeBSD.org>
In-Reply-To: <5A4AF64C-D70A-4303-8116-D13718EE8BCC@FreeBSD.org>
References:  <4A5A9C78-22AC-4480-BDEB-A72F6CF472DB@fnop.net>	 <20071104231422.GA82337@rink.nu>	 <e1309ba60711041555n72def9fn71de42fcf40bfaa1@mail.gmail.com>	 <472F5E62.4080406@samsco.org>	 <60C64C73-A019-4C01-85E1-80DF4C76B1AF@freebsd.org>	 <EABAF87E-087E-4E7D-AACA-0DDF8050D485@FreeBSD.org>	 <4732171F.3010803@FreeBSD.org> <e1309ba60711071313t2dabfd96y5503a095fe30ed71@mail.gmail.com> <473232A8.3080105@samsco.org> <5A4AF64C-D70A-4303-8116-D13718EE8BCC@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
I don't have the original 1st gen MacBook to test this on anymore, but 
it looks good. Please make sure it gets both into 6.3 and 7.0 releases.

Thanks!

-Maxim

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 <sobomax@freebsd.org> 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
> 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4734FEAB.2070400>