Eric,

        Please check out this patch which fixes the mtrr hang.  Basically it
just disable cache when set_fixed_mtrrs and then enable cache when it is done.

-Andrew

-- 
Andrew Ip
Email:  [EMAIL PROTECTED]
Tel:    (852) 2542 2046
Fax:    (852) 2542 2036
Mobile: (852) 9201 9866

Cwlinux Limited
Unit 202B 2/F Lai Cheong Factory Building,
479-479A Castle Peak Road, Lai Chi Kok,
Kowloon, Hong Kong(SAR),
China.
Tel: (852)2542 2046
Fax: (852)2542 2036

For public pgp key, please obtain it from http://www.keyserver.net/en.
diff -Nur freebios/src/cpu/p6/mtrr.c freebios.mtrr/src/cpu/p6/mtrr.c
--- freebios/src/cpu/p6/mtrr.c  2002-07-02 15:13:09.000000000 +0800
+++ freebios.mtrr/src/cpu/p6/mtrr.c     2002-08-13 15:36:12.000000000 +0800
@@ -205,6 +205,18 @@
        unsigned int i;
        unsigned int fixed_msr = NUM_FIXED_RANGES >> 3;
        unsigned long low, high;
+       unsigned int tmp;
+
+       // it is recommended that we disable and enable cache when we 
+       // do this. 
+       /* Disable cache */
+       /* Write back the cache and flush TLB */
+       asm volatile ("movl  %%cr0, %0\n\t"
+                     "orl  $0x40000000, %0\n\t"
+                     "wbinvd\n\t"
+                     "movl  %0, %%cr0\n\t"
+                     "wbinvd\n\t":"=r" (tmp)::"memory");
+
        low = high = 0; /* Shut up gcc */
        for(i = first; i < last; i++) {
                /* When I switch to a new msr read it in */
@@ -228,6 +240,11 @@
        if (fixed_msr < (NUM_FIXED_RANGES >> 3)) {
                wrmsr(mtrr_msr[fixed_msr], low, high);
        }
+
+       // turn cache back on. 
+       asm volatile ("movl  %%cr0, %0\n\t"
+                     "andl  $0x9fffffff, %0\n\t"
+                     "movl  %0, %%cr0\n\t":"=r" (tmp)::"memory");
 }
 
 static unsigned fixed_mtrr_index(unsigned long addrk)

Attachment: msg00866/pgp00000.pgp
Description: PGP signature

Reply via email to