coreboot-kgpe-d16/src/lib
Aaron Durbin 159f2ef03a ramstage: cache relocated ramstage in RAM
Accessing the flash part where the ramstage resides can be slow
when loading it. In order to save time in the S3 resume path a copy
of the relocated ramstage is saved just below the location the ramstage
was loaded. Then on S3 resume the cached version of the relocated
ramstage is copied back to the loaded address.

This is achieved by saving the ramstage entry point in the
romstage_handoff structure as reserving double the amount of memory
required for ramstage. This approach saves the engineering time to make
the ramstage reentrant.

The fast path in this change will only be taken when the chipset's
romstage code properly initializes the s3_resume field in the
romstage_handoff structure. If that is never set up properly then the
fast path will never be taken.

e820 entries from Linux:
BIOS-e820: [mem 0x000000007bf21000-0x000000007bfbafff] reserved
BIOS-e820: [mem 0x000000007bfbb000-0x000000007bffffff] type 16

The type 16 is the cbmem table and the reserved section contains the two
copies of the ramstage; one has been executed already and one is
the cached relocated program.

With this change the S3 resume path on the basking ridge CRB shows
to be ~200ms to hand off to the kernel:

13 entries total:

   1:95,965
   2:97,191 (1,225)
   3:131,755 (34,564)
   4:132,890 (1,135)
   8:135,165 (2,274)
   9:135,840 (675)
  10:135,973 (132)
  30:136,016 (43)
  40:136,581 (564)
  50:138,280 (1,699)
  60:138,381 (100)
  70:204,538 (66,157)
  98:204,615 (77)

Change-Id: I9c7a6d173afc758eef560e09d2aef5f90a25187a
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/2800
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
2013-03-21 22:54:23 +01:00
..
cbfs.c ramstage: cache relocated ramstage in RAM 2013-03-21 22:54:23 +01:00
cbfs_core.c libcbfs: Fix legacy CBFS API, typos 2013-02-22 09:23:04 +01:00
cbmem.c cbmem: add CBMEM_ID_ROMSTAGE_INFO id 2013-03-21 18:02:34 +01:00
cbmem_console.c Add infrastructure for global data in the CAR phase of boot 2012-03-29 23:19:13 +02:00
clog2.c printk_foo -> printk(BIOS_FOO, ...) 2010-03-22 11:42:32 +00:00
compute_ip_checksum.c Since some people disapprove of white space cleanups mixed in regular commits 2010-04-27 06:56:47 +00:00
debug.c Myles suspected this hangs certain machines, so back it out. 2010-04-15 12:43:07 +00:00
delay.c - Major cleanup of the bootpath 2003-07-19 04:28:22 +00:00
edid.c link/graphics: Add support for EDID 2013-03-20 05:35:50 +01:00
fallback_boot.c Make set_boot_successful depend on PC80_SYSTEM 2012-11-30 21:33:35 +01:00
gcc.c Unify assembler function handling 2012-12-06 23:13:17 +01:00
gcov-glue.c Implement GCC code coverage analysis 2013-01-12 19:09:55 +01:00
gcov-io.c Implement GCC code coverage analysis 2013-01-12 19:09:55 +01:00
gcov-io.h Implement GCC code coverage analysis 2013-01-12 19:09:55 +01:00
gcov-iov.h Implement GCC code coverage analysis 2013-01-12 19:09:55 +01:00
generic_dump_spd.c Since some people disapprove of white space cleanups mixed in regular commits 2010-04-27 06:56:47 +00:00
generic_sdram.c Remove duplicate line from pci_ids.h. 2010-10-07 23:02:06 +00:00
hardwaremain.c ramstage: Add cbmem_get_table_location() 2013-03-21 22:51:05 +01:00
jpeg.c Since some people disapprove of white space cleanups mixed in regular commits 2010-04-27 06:56:47 +00:00
jpeg.h Random cosmetic fixes (trivial). 2010-02-22 16:41:49 +00:00
libgcov.c Update gcov patch in documentation 2013-01-19 01:00:50 +01:00
lzma.c lib: Prevent unaligned memory access and fix endianess in LZMA decode library. 2013-02-01 06:15:49 +01:00
lzmadecode.c Since some people disapprove of white space cleanups mixed in regular commits 2010-04-27 06:56:47 +00:00
lzmadecode.h Since some people disapprove of white space cleanups mixed in regular commits 2010-04-27 06:56:47 +00:00
Makefile.inc coreboot: introduce CONFIG_RELOCATABLE_RAMSTAGE 2013-03-21 22:28:28 +01:00
malloc.c SMM: Add support for malloc in SMM if using TSEG 2012-07-24 23:44:19 +02:00
memchr.c Add an implementation for the memchr library function 2012-03-09 20:00:53 +01:00
memcmp.c - Initial checkin of the freebios2 tree 2003-04-22 19:02:15 +00:00
memcpy.c fix compiler warnings (trivial) 2009-01-20 21:40:16 +00:00
memmove.c tidy 2004-03-13 03:40:29 +00:00
memset.c fix compiler warnings (trivial) 2009-01-20 21:40:16 +00:00
ne2k.c Fix of fix copy and paste errors in ne2k.c (r6512 by stepan) 2011-04-22 22:26:04 +00:00
nrv2b.c Since some people disapprove of white space cleanups mixed in regular commits 2010-04-27 06:56:47 +00:00
ns8390.h Add support for the console over Ethernet (through PCI NE2000). 2010-07-16 20:02:09 +00:00
ramtest.c Replace ramtest pattern to assist in DIMM configuration 2012-03-25 20:17:51 +02:00
rmodule.c rmodule: add ability to calculate module placement 2013-03-21 17:53:20 +01:00
rmodule.ld rmodule: add ramstage support 2013-03-19 20:31:41 +01:00
selfboot.c coreboot: introduce CONFIG_RELOCATABLE_RAMSTAGE 2013-03-21 22:28:28 +01:00
stack.c fix an error message in checkstack() 2013-02-12 05:05:39 +01:00
timestamp.c src/lib/timestamp.c: Fix spelling of tim*e*stamp 2013-01-22 12:15:08 +01:00
trace.c GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00
uart8250.c Remove whitespace. 2012-02-17 19:04:31 +01:00
uart8250mem.c Don't loop infinitely long on serial comm failures 2012-05-08 04:34:26 +02:00
usbdebug.c USBDEBUG: retry harder for slow devices 2012-07-30 20:54:24 +02:00
version.c This patch fixes build.h dependencies in coreboot again. 2010-03-29 13:04:13 +00:00
xmodem.c GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00