Hi,

The unrv2b uncompression algorithm appears to behave very badly in the
absence of a proper cache.  Instrumentation indicates somehting like ~180
i-stream cacheline requests for _every_ d-stream cacheline request
during decompression.  The following patch copies the unrv2b function to
DRAM before performing the actual decompression, reducing the run-time
from 12.5s to 50ms in my environment.  The patch is somewhat rough, and
assumes that (1) the unrv2b function is less than 1k in size, and (2)
that placing a copy of the function just after the decompress
destination is unproblematic.  It works well for me, though.

Signed-off-by: Arne Georg Gleditsch <[EMAIL PROTECTED]>

-- 
                                                                Arne.
diff --git a/src/cpu/amd/car/copy_and_run.c b/src/cpu/amd/car/copy_and_run.c
index 80fc840..0b416a8 100644
--- a/src/cpu/amd/car/copy_and_run.c
+++ b/src/cpu/amd/car/copy_and_run.c
@@ -22,6 +22,7 @@ static void copy_and_run(void)
 {
 	uint8_t *src, *dst; 
         unsigned long ilen, olen;
+	unsigned long (*unrv2b_rel)(uint8_t *, uint8_t *, unsigned long *);
 
 
 #if !CONFIG_COMPRESS 
@@ -43,12 +44,18 @@ static void copy_and_run(void)
                 : "=a" (src) , "=b" (dst)
         );
 
+	olen = *((uint32_t *)src);
+	unrv2b_rel = (void *)((((uint32_t)dst + olen + 63) & ~63) | ((uint32_t)&unrv2b & 63));
+	print_debug_cp_run("unrv2b     src=", (uint32_t)&unrv2b);
+	print_debug_cp_run("unrv2b_rel dst=", (uint32_t)unrv2b_rel);
+	memcpy(unrv2b_rel, unrv2b, 1024);
+
 	print_debug_cp_run("src=",(uint32_t)src); 
 	print_debug_cp_run("dst=",(uint32_t)dst);
 
 //	dump_mem(src, src+0x100);
 
-	olen = unrv2b(src, dst, &ilen);
+	olen = unrv2b_rel(src, dst, &ilen);
 	print_debug_cp_run("coreboot_ram.nrv2b length = ", ilen);
 
 #endif
diff --git a/src/mainboard/tyan/s2912_fam10/cache_as_ram_auto.c b/src/mainboard/tyan/s2912_fam10/cache_as_ram_auto.c
index ae619e5..4217f55 100644
--- a/src/mainboard/tyan/s2912_fam10/cache_as_ram_auto.c
+++ b/src/mainboard/tyan/s2912_fam10/cache_as_ram_auto.c
@@ -376,7 +376,6 @@ void real_main(unsigned long bist, unsigned long cpu_init_detectedx)
 	raminit_amdmct(sysinfo);
 	post_code(0x41);
 
-	printk_debug("\n*** Yes, the copy/decompress is taking a while, FIXME!\n");
 	post_cache_as_ram();	// BSP switch stack to ram, copy then execute LB.
 	post_code(0x43);	// Should never see this post code.
 }
--
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to