The attached patch fixes vsmsetup for the AMD GX2 .
It was broken at least since rev 4611.
This patch is build and boot tested, it now gives a :
VSA2 VR signature verified message.

Signed-off-by: Nils Jacobs <[email protected]>

v2:This updated patch also changes Rambase back to 0x4000
in the Kconfig files of the Rumba, Frontrunner, Btest
and Rev_a boards.
This time Kconfig build tested :OK.

Thanks,Nils
Index: src/cpu/amd/model_gx2/Config.lb
===================================================================
--- src/cpu/amd/model_gx2/Config.lb	(revision 5007)
+++ src/cpu/amd/model_gx2/Config.lb	(working copy)
@@ -4,4 +4,5 @@
 dir /cpu/x86/smm
 driver model_gx2_init.o
 object cpubug.o
+object gdt2.o
 object vsmsetup.o
Index: src/cpu/amd/model_gx2/gdt2.c
===================================================================
--- src/cpu/amd/model_gx2/gdt2.c	(revision 0)
+++ src/cpu/amd/model_gx2/gdt2.c	(revision 0)
@@ -0,0 +1,85 @@
+/*
+ *  Erik Arjan Hendriks <[email protected]>
+ *  Copyright (C) 2000 Scyld.
+ *  Copyright (C) 2000 Scyld Computing Corporation
+ *  Copyright (C) 2001 University of California.  LA-CC Number 01-67.
+ *  Copyright (C) 2005 [email protected]
+ *  Copyright (C) 2007 coresystems GmbH
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+
+/* Declare a temporary global descriptor table - 
+ * necessary because the core part of the bios 
+ * no longer sets up any 16 bit segments 
+ */
+
+__asm__ (
+	/* pointer to original gdt */
+	"	.globl gdtarg\n"
+	"gdtarg:			\n"
+	"	.word	gdt_limit	\n"
+	"	.long	gdt	       	\n"		
+
+	/* compute the table limit */
+	"__mygdt_limit = __mygdt_end - __mygdt - 1	\n"
+	"	.globl __mygdtaddr\n"
+	"__mygdtaddr:			\n"
+	"	.word	__mygdt_limit  	\n"
+	"	.long	__mygdt	       	\n"
+
+	"	.globl __mygdt\n"
+	"__mygdt: 		       	\n"
+	/* selgdt 0, unused */
+	"	.word	0x0000, 0x0000	\n"
+	"	.byte	0x00, 0x00, 0x00, 0x00	\n"
+
+	/* selgdt 8, unused */
+	"	.word	0x0000, 0x0000	       	\n"
+	"	.byte	0x00, 0x00, 0x00, 0x00	\n"
+
+	/* selgdt 0x10, flat code segment */
+	"	.word	0xffff, 0x0000	       	\n"
+	"	.byte	0x00, 0x9b, 0xcf, 0x00	\n"	
+
+	/* selgdt 0x18, flat data segment */
+	"	.word	0xffff, 0x0000	       	\n"
+	"	.byte	0x00, 0x93, 0xcf, 0x00	\n"
+
+	/* selgdt 0x20, unused */
+	"	.word	0x0000, 0x0000	       	\n"
+	"	.byte	0x00, 0x00, 0x00, 0x00	\n"
+
+        /* selgdt 0x28 16-bit 64k code at 0x00000000 */
+	"	.word	0xffff, 0x0000	       	\n"
+	"	.byte	0, 0x9a, 0, 0	       	\n"
+
+	/* selgdt 0x30 16-bit 64k data at 0x00000000 */
+	"	.word	0xffff, 0x0000	       	\n"
+	"	.byte	0, 0x92, 0, 0	       	\n"
+
+	"__mygdt_end:				\n"
+
+	/* Declare a pointer to where our idt is going to be i.e. at mem zero */
+	"	.globl __myidt\n"
+	 "__myidt:		\n"
+	 /* 16-bit limit */
+	 "	.word 1023	\n"
+	 /* 24-bit base */
+	 "	.long 0		\n"
+	 "	.word 0		\n"
+);
Index: src/cpu/amd/model_gx2/Makefile.inc
===================================================================
--- src/cpu/amd/model_gx2/Makefile.inc	(revision 5007)
+++ src/cpu/amd/model_gx2/Makefile.inc	(working copy)
@@ -4,4 +4,5 @@
 subdirs-y += ../../x86/smm
 driver-y += model_gx2_init.o
 obj-y += cpubug.o
+obj-y += gdt2.o
 obj-y += vsmsetup.o
Index: src/cpu/amd/model_gx2/vsmsetup.c
===================================================================
--- src/cpu/amd/model_gx2/vsmsetup.c	(revision 5007)
+++ src/cpu/amd/model_gx2/vsmsetup.c	(working copy)
@@ -33,6 +33,7 @@
 #include <cpu/x86/lapic.h>
 #include <cpu/x86/cache.h>
 #include <arch/io.h>
+#include <cpu/amd/gx2def.h>
 #include <cbfs.h>
 
 u32 VSA_vrRead(u16 classIndex);
@@ -208,7 +209,7 @@
 
 	/* ecx gets smm, edx gets sysm. */
 	printk_err("Call real_mode_switch_call_vsm\n");
-//	real_mode_switch_call_vsm(MSR_GLIU0_SMM, MSR_GLIU0_SYSMEM);
+	real_mode_switch_call_vsm(MSR_GLIU0_SMM, MSR_GLIU0_SYSMEM);
 
 	/* Restart Timer 1. */
 	outb(0x56, 0x43);
Index: src/mainboard/olpc/btest/Kconfig
===================================================================
--- src/mainboard/olpc/btest/Kconfig	(revision 5007)
+++ src/mainboard/olpc/btest/Kconfig	(working copy)
@@ -33,3 +33,8 @@
 	bool
 	default n
 	depends on BOARD_OLPC_BTEST
+
+config RAMBASE
+	hex
+	default 0x4000
+	depends on BOARD_OLPC_BTEST
Index: src/mainboard/olpc/rev_a/Kconfig
===================================================================
--- src/mainboard/olpc/rev_a/Kconfig	(revision 5007)
+++ src/mainboard/olpc/rev_a/Kconfig	(working copy)
@@ -33,3 +33,8 @@
 	bool
 	default n
 	depends on BOARD_OLPC_REV_A
+
+config RAMBASE
+	hex
+	default 0x4000
+	depends on BOARD_OLPC_REV_A
Index: src/mainboard/amd/rumba/Kconfig
===================================================================
--- src/mainboard/amd/rumba/Kconfig	(revision 5007)
+++ src/mainboard/amd/rumba/Kconfig	(working copy)
@@ -53,3 +53,8 @@
 	bool
 	default n
 	depends on BOARD_AMD_RUMBA
+
+config RAMBASE
+	hex
+	default 0x4000
+	depends on BOARD_AMD_RUMBA
Index: src/mainboard/lippert/frontrunner/Kconfig
===================================================================
--- src/mainboard/lippert/frontrunner/Kconfig	(revision 5007)
+++ src/mainboard/lippert/frontrunner/Kconfig	(working copy)
@@ -33,3 +33,8 @@
 	bool
 	default n
 	depends on BOARD_LIPPERT_FRONTRUNNER
+
+config RAMBASE
+	hex
+	default 0x4000
+	depends on BOARD_LIPPERT_FRONTRUNNER
-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to