aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2014-01-17 20:21:20 -0500
committerKevin O'Connor <kevin@koconnor.net>2014-01-22 17:30:30 -0500
commit406df19d9962a66e64bd0cce5b1041ae7bc5bfd1 (patch)
treed58928152b09d2d74685acd8e0b3ac510f960ab7
parent25107a326164edbd6547c16de562cdd455f86f02 (diff)
downloadseabios-406df19d9962a66e64bd0cce5b1041ae7bc5bfd1.zip
seabios-406df19d9962a66e64bd0cce5b1041ae7bc5bfd1.tar.gz
seabios-406df19d9962a66e64bd0cce5b1041ae7bc5bfd1.tar.bz2
coreboot: Support alternative locations for CBFS.
The Google builds of SeaBIOS place the CBFS data in a non-standard location. Add a config parameter to support non-standard locations. This is based on a patch from Stefan Reinauer <reinauer@chromium.org> in the Chromium seabios repo (commit 60534ec785). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--src/Kconfig12
-rw-r--r--src/fw/coreboot.c10
2 files changed, 16 insertions, 6 deletions
diff --git a/src/Kconfig b/src/Kconfig
index a42ab2d..071a16e 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -96,7 +96,17 @@ endchoice
default y
help
Support CBFS files compressed using the lzma decompression
- algorighm.
+ algorithm.
+ config CBFS_LOCATION
+ depends on COREBOOT_FLASH
+ hex "CBFS memory end location"
+ default 0
+ help
+ Memory address of where the CBFS data ends. This should
+ be zero for normal builds. It may be a non-zero value if
+ the CBFS filesystem is at a non-standard location (eg,
+ 0xffe00000 if CBFS ends 2Meg below the end of flash).
+
config FLASH_FLOPPY
depends on COREBOOT_FLASH
bool "Floppy images in CBFS"
diff --git a/src/fw/coreboot.c b/src/fw/coreboot.c
index 01a6fcd..88ac5d9 100644
--- a/src/fw/coreboot.c
+++ b/src/fw/coreboot.c
@@ -297,7 +297,6 @@ ulzma(u8 *dst, u32 maxlen, const u8 *src, u32 srclen)
****************************************************************/
#define CBFS_HEADER_MAGIC 0x4F524243
-#define CBFS_HEADPTR_ADDR 0xFFFFFFFc
#define CBFS_VERSION1 0x31313131
struct cbfs_header {
@@ -369,7 +368,7 @@ coreboot_cbfs_init(void)
if (!CONFIG_COREBOOT_FLASH)
return;
- struct cbfs_header *hdr = *(void **)CBFS_HEADPTR_ADDR;
+ struct cbfs_header *hdr = *(void **)(CONFIG_CBFS_LOCATION - 4);
if (hdr->magic != cpu_to_be32(CBFS_HEADER_MAGIC)) {
dprintf(1, "Unable to find CBFS (ptr=%p; got %x not %x)\n"
, hdr, hdr->magic, cpu_to_be32(CBFS_HEADER_MAGIC));
@@ -377,10 +376,11 @@ coreboot_cbfs_init(void)
}
dprintf(1, "Found CBFS header at %p\n", hdr);
- struct cbfs_file *fhdr = (void *)(0 - be32_to_cpu(hdr->romsize)
- + be32_to_cpu(hdr->offset));
+ u32 romsize = be32_to_cpu(hdr->romsize);
+ u32 romstart = CONFIG_CBFS_LOCATION - romsize;
+ struct cbfs_file *fhdr = (void*)romstart + be32_to_cpu(hdr->offset);
for (;;) {
- if (fhdr < (struct cbfs_file *)(0xFFFFFFFF - be32_to_cpu(hdr->romsize)))
+ if ((u32)fhdr - romstart > romsize)
break;
u64 magic = fhdr->magic;
if (magic != CBFS_FILE_MAGIC)