Patchwork Move VSA image to CBFS

login
register
about
Submitter Patrick Georgi
Date 2009-12-02 14:22:57
Message ID <4B167841.7090504@georgi-clan.de>
Download mbox | patch
Permalink /patch/620/
State Accepted
Commit r4976
Headers show

Comments

Patrick Georgi - 2009-12-02 14:22:57
Hi,

attached patch makes amd/model_lx systems load the VSA image from CBFS. 
There are some prerequisite steps necessary to convert it into a form 
that cbfstool can parse, that are not hooked up yet.
A very similar change should also do for model_gx2, which is currently 
non-functional due to a partial backport from v3.

The VSA postprocessing steps:
objcopy --set-start 0x20 --adjust-vma 0x60000 -I binary -O elf32-i386 -B 
i386 vsa.binary vsa.o
ld -e 0x60020 --section-start .data=0x60000 vsa.o -o vsa.elf

Then, after build, do
cbfstool coreboot.rom add-stage vsa.elf vsa l
to add it to the image.

I didn't test it myself, but got positive feedback on IRC.
Given that these steps aren't automated yet, it's not really meant for 
commit in this form. It can, and should, also be discussed if "stage" is 
the right type for the file - we might want to have a generic file 
header that includes a compression flag. I post it for reference, 
further testing, adaptation to gx2 by interested parties, etc.

Nonetheless, to clear up the status,
Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>


Patrick
Peter Stuge - 2009-12-02 14:34:21
Patrick Georgi wrote:
> Given that these steps aren't automated yet, it's not really meant
> for commit in this form.

Sure it is.


> It can, and should, also be discussed if "stage" is the right type
> for the file

Maybe not. That's next.


> Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>

Acked-by: Peter Stuge <peter@stuge.se>

Patch

Index: src/cpu/amd/model_lx/vsmsetup.c
===================================================================
--- src/cpu/amd/model_lx/vsmsetup.c	(revision 4972)
+++ src/cpu/amd/model_lx/vsmsetup.c	(working copy)
@@ -7,10 +7,8 @@ 
 #include <string.h>
 #include <cpu/amd/lxdef.h>
 #include <cpu/amd/vr.h>
+#include <cbfs.h>
 
-// andrei: use the /lib copy of nrv2b
-#include "../lib/nrv2b.c"
-
 #define VSA2_BUFFER			0x60000
 #define VSA2_ENTRY_POINT	0x60020
 
@@ -272,11 +270,9 @@ 
 {
 	device_t dev;
 	unsigned long busdevfn;
-	unsigned int rom = 0;
 	unsigned char *buf;
 	unsigned int size = SMM_SIZE * 1024;
 	int i;
-	unsigned long ilen, olen;
 
 	printk_err("do_vsmbios\n");
 	/* clear vsm bios data area */
@@ -291,12 +287,10 @@ 
 	 * much better parameterized
 	 */
 
-	// TODO this is a CBFS candidate
-	//VSA is cat onto the end after LB builds
-	rom = ((unsigned long)0) - (CONFIG_ROM_SIZE + 36 * 1024);
-	buf = (unsigned char *)VSA2_BUFFER;
-	olen = unrv2b((uint8_t *) rom, buf, &ilen);
-	printk_debug("buf ilen %d olen%d\n", ilen, olen);
+	if ((unsigned int)cbfs_load_stage("vsa") != VSA2_ENTRY_POINT) {
+		printk_err("do_vsmbios: Failed to load VSA.\n");
+	}
+	buf = VSA2_BUFFER;
 	printk_debug("buf %p *buf %d buf[256k] %d\n",
 		     buf, buf[0], buf[SMM_SIZE * 1024]);
 	printk_debug("buf[0x20] signature is %x:%x:%x:%x\n",