On 7 Nov 2007, at 21:48, Scott Long wrote:

Rui Paulo wrote:
On Nov 7, 2007 7:50 PM, Maxim Sobolev <[EMAIL PROTECTED]> 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

_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hardware
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to