Patrick Georgi (pgeorgi@google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10869
-gerrit
commit 3ae1b8ac9b586a806dbe826cb919077e8a8d54d1 Author: Daisuke Nojiri dnojiri@chromium.org Date: Wed Jul 1 10:49:37 2015 -0700
cbfs: add a parser for boot media params to coreboot table
This change allows a payload to read a cbfs header offset from coreboot table.
[pg: adapted to match new structure layout and to use fmap]
BUG=none BRANCH=tot TEST=dumped cbfs offset through a test-printf in depthcharge
Change-Id: I75a8ee6b93f349b9f2fab1e82826aba675949c0a Signed-off-by: Daisuke Nojiri dnojiri@chromium.org Signed-off-by: Patrick Georgi pgeorgi@chromium.org --- payloads/libpayload/include/coreboot_tables.h | 9 +++++++++ payloads/libpayload/include/sysinfo.h | 1 + payloads/libpayload/libc/coreboot.c | 13 +++++++++++++ 3 files changed, 23 insertions(+)
diff --git a/payloads/libpayload/include/coreboot_tables.h b/payloads/libpayload/include/coreboot_tables.h index 0c516b1..b19d2fb 100644 --- a/payloads/libpayload/include/coreboot_tables.h +++ b/payloads/libpayload/include/coreboot_tables.h @@ -257,6 +257,15 @@ struct cb_spi_flash { uint32_t erase_cmd; };
+#define CB_TAG_BOOT_MEDIA_PARAMS 0x0030 +struct cb_boot_media_params { + uint32_t tag; + uint32_t size; + /* offset from the start of the media */ + uint32_t fmap_offset; + char fmap_name[32]; +}; + #define CB_TAG_SERIALNO 0x002a #define CB_MAX_SERIALNO_LENGTH 32
diff --git a/payloads/libpayload/include/sysinfo.h b/payloads/libpayload/include/sysinfo.h index c407c3d..0c5ea59 100644 --- a/payloads/libpayload/include/sysinfo.h +++ b/payloads/libpayload/include/sysinfo.h @@ -124,6 +124,7 @@ struct sysinfo_t { uint32_t sector_size; uint32_t erase_cmd; } spi_flash; + uint32_t cbfs_header_offset; uint64_t mtc_start; uint32_t mtc_size; }; diff --git a/payloads/libpayload/libc/coreboot.c b/payloads/libpayload/libc/coreboot.c index 8a5d3ae..b8c29d4 100644 --- a/payloads/libpayload/libc/coreboot.c +++ b/payloads/libpayload/libc/coreboot.c @@ -220,6 +220,16 @@ static void cb_parse_spi_flash(void *ptr, struct sysinfo_t *info) info->spi_flash.erase_cmd = flash->erase_cmd; }
+static void cb_parse_boot_media_params(unsigned char *ptr, + struct sysinfo_t *info) +{ + struct cb_boot_media_params *const bmp = + (struct cb_boot_media_params *)ptr; + fmap_region_by_name( + bmp->fmap_offset, bmp->fmap_name, + &info->cbfs_header_offset, NULL); +} + int cb_parse_header(void *addr, int len, struct sysinfo_t *info) { struct cb_header *header; @@ -372,6 +382,9 @@ int cb_parse_header(void *addr, int len, struct sysinfo_t *info) case CB_TAG_MTC: cb_parse_mtc(ptr, info); break; + case CB_TAG_BOOT_MEDIA_PARAMS: + cb_parse_boot_media_params(ptr, info); + break; default: cb_parse_arch_specific(rec, info); break;