Patchwork stack location

login
register
about
Submitter Stefan Reinauer
Date 2010-04-12 15:23:34
Message ID <4BC33AF6.3080904@coresystems.de>
Download mbox | patch
Permalink /patch/1228/
State Accepted
Commit r5417
Headers show

Comments

Stefan Reinauer - 2010-04-12 15:23:34
see patch. Not sure if this area is cached, but I think it should be,
none the less.
Kevin O'Connor - 2010-04-13 00:53:02
On Mon, Apr 12, 2010 at 05:23:34PM +0200, Stefan Reinauer wrote:
> see patch. Not sure if this area is cached, but I think it should be,
> none the less.

Thanks!  That brings the early timings on epia-cn to:

00.000: <00>
00.005: <00>
00.382: 0
00.382: 
00.382: coreboot-4.0-r5415M Mon Apr 12 20:37:07 EDT 2010 starting...
00.383: *pre enable_smbus()
00.405: *post enable_smbus()
00.409: *pre ddr_ram_setup()
00.420: *post ddr_ram_setup()
00.423: Stage: loading fallback/coreboot_ram @ 0x4000 (163840 bytes), entry @ 0x4000
00.469: coreboot-4.0-r5415M Mon Apr 12 20:37:07 EDT 2010 rebooting...

The romcc code is a little faster (~16ms), but that's only because I
hacked it to read the coreboot_ram file into cache while waiting for
the smbus power well to stabilize.  (With car it isn't possible to
seed the cache, but that's not a big deal.)

-Kevin

Patch

Index: src/cpu/via/car/cache_as_ram.inc
===================================================================
--- src/cpu/via/car/cache_as_ram.inc	(revision 5410)
+++ src/cpu/via/car/cache_as_ram.inc	(working copy)
@@ -270,14 +270,16 @@ 
 	
 	movl	%ebp, %esi
 
-	/* FIXME: These values might have to change for suspend-to-ram.
-	 * the 0x00400000 was chosen as this is a place in memory that
-	 * should exist in all contemporary configurations (ie. large
-	 * enough RAM), but doesn't collide with anything coreboot does.
-	 * Other than that, it's arbitrary.
+	/* For now: use CONFIG_RAMBASE + 1MB - 64K (counting downwards) as stack. This
+	 * makes sure that we stay completely within the 1M-64K of memory that we
+	 * preserve for suspend/resume.
 	 */
 
-	movl	$0x4000000, %esp
+#ifndef HIGH_MEMORY_SAVE
+#warning Need a central place for HIGH_MEMORY_SAVE
+#define HIGH_MEMORY_SAVE ( (1024 - 64) * 1024 )
+#endif
+	movl $(CONFIG_RAMBASE + HIGH_MEMORY_SAVE), %esp
 	movl	%esp, %ebp
 	pushl %esi
 	call copy_and_run
Index: src/arch/i386/init/crt0_romcc_epilogue.inc
===================================================================
--- src/arch/i386/init/crt0_romcc_epilogue.inc	(revision 5410)
+++ src/arch/i386/init/crt0_romcc_epilogue.inc	(working copy)
@@ -14,8 +14,16 @@ 
 	
 	movl	%ebp, %esi
 
-	/* FIXME: look for a proper place for the stack */
-	movl	$0x4000000, %esp
+	/* For now: use CONFIG_RAMBASE + 1MB - 64K (counting downwards) as stack. This
+	 * makes sure that we stay completely within the 1M-64K of memory that we
+	 * preserve for suspend/resume.
+	 */
+
+#ifndef HIGH_MEMORY_SAVE
+#warning Need a central place for HIGH_MEMORY_SAVE
+#define HIGH_MEMORY_SAVE ( (1024 - 64) * 1024 )
+#endif
+	movl $(CONFIG_RAMBASE + HIGH_MEMORY_SAVE), %esp
 	movl	%esp, %ebp
 	pushl %esi
 	call copy_and_run