set fixed mtrr can't work

Andrew Ip aip at cwlinux.com
Mon Oct 7 05:20:01 CEST 2002


zhu shi song,

> I'm using cvs freebios, and intel  celeron CPU and 
> winfast 6300 mainboard.  When linuxbios post 0x60 and
> go to execute set fixed mtrr, it halt.  The output is 
> as following:
>   Setting up fixed MTRRs(0-88) type:UC
> 
>   Setting fixed MTRRS(
>   who know the problem?
You need this patch(see attachment).

I know, I know.  The code is...

-Andrew

-- 
Andrew Ip
Email:  aip at cwlinux.com
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.

Tel: (852)2542 2046
Fax: (852)2542 2036

For public pgp key, please obtain it from http://www.keyserver.net/en.
-------------- next part --------------
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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20021007/d2907eac/attachment.sig>


More information about the coreboot mailing list