[coreboot] [PATCH] Fix v3 VIA C7 CAR disable

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Wed Nov 5 05:55:11 CET 2008


The VIA C7 CAR disable code in v3 had a nasty bug which caused the
processor to reset. Fix this bug and actually disable CAR.
With this patch v3 has better C7 CAR code than v2 (which skips two key
MTRRs).

Thanks to Corey Osgood for testing countless debug patches.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>

Attached for Gmail users.

Index: corebootv3-via_car/arch/x86/via/stage1.c
===================================================================
--- corebootv3-via_car/arch/x86/via/stage1.c	(Revision 980)
+++ corebootv3-via_car/arch/x86/via/stage1.c	(Arbeitskopie)
@@ -56,22 +56,20 @@
 	__asm__ __volatile__(
 	"	movl	%[newesp], %%esp	\n"
 
-#if ENABLE_BROKEN_CAR_DISABLING
 	/* We don't need cache as ram for now on */
 	/* disable cache */
 	"	movl    %%cr0, %%eax		\n"
 	"	orl    $(0x1<<30),%%eax		\n"
 	"	movl    %%eax, %%cr0		\n"
 
-	/* The MTRR setup below causes the machine to reset. Must investigate. */
 	/* disable fixed mtrr from now on, it will be enabled by coreboot_ram again*/
-	"	movl    %[_SYSCFG_MSR], %%ecx	\n"
-	"	rdmsr				\n"
-	"	andl    %[_SYSCFG_MSR_newval], %%eax\n"
-//	"	andl    $(~(SYSCFG_MSR_MtrrFixDramModEn | SYSCFG_MSR_MtrrFixDramEn)), %%eax\n"
 	/* clear sth */
+	"	xorl    %%eax, %%eax		\n"
+	"	xorl    %%edx, %%edx		\n"
+	"	movl    $0x201, %%ecx		\n"
 	"	wrmsr				\n"
-#warning Must clear MTRR 0x200 and 0x201
+	"	movl    $0x200, %%ecx		\n"
+	"	wrmsr				\n"
 
 	/* Set the default memory type and disable fixed and enable variable MTRRs */
 	"	movl    %[_MTRRdefType_MSR], %%ecx	\n"
@@ -84,16 +82,11 @@
 	"	movl    %%cr0, %%eax		\n"
 	"	andl    $0x9fffffff,%%eax	\n"
 	"	movl    %%eax, %%cr0		\n"
-#endif
 
 	"	wbinvd				\n"
 
 	"	call stage1_phase3		\n"
 	:: [newesp] "i" (newlocation),
-	 [_SYSCFG_MSR] "i" (SYSCFG_MSR),
-	 [_SYSCFG_MSR_newval] "i" (~(SYSCFG_MSR_MtrrFixDramModEn | SYSCFG_MSR_MtrrFixDramEn)),
-	 [_SYSCFG_MSR_MtrrFixDramModEn] "i" (SYSCFG_MSR_MtrrFixDramModEn),
-	 [_SYSCFG_MSR_MtrrFixDramEn] "i" (SYSCFG_MSR_MtrrFixDramEn),
 	 [_MTRRdefType_MSR] "i" (MTRRdefType_MSR)
 	: "memory");
 }


-- 
http://www.hailfinger.org/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: linuxbios3_car_via_disable_car_fix.diff
Type: text/x-patch
Size: 1712 bytes
Desc: not available
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20081105/b8f33fec/attachment.diff>


More information about the coreboot mailing list