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 86d6ea98cdbc6158dcafb8438f7e286ef7a78fea Author: Patrick Georgi pgeorgi@chromium.org Date: Tue Jul 14 17:15:24 2015 +0100
libpayload: store boot media information in sysinfo
Write boot media information in sysinfo, if it exists. This allows picking the right CBFS for further files in case there are several.
Change-Id: I75a8ee6b93f349b9f2fab1e82826aba675949c0a Signed-off-by: Patrick Georgi pgeorgi@chromium.org --- payloads/libpayload/include/coreboot_tables.h | 11 +++++++++++ payloads/libpayload/include/sysinfo.h | 4 ++++ payloads/libpayload/libc/coreboot.c | 14 ++++++++++++++ 3 files changed, 29 insertions(+)
diff --git a/payloads/libpayload/include/coreboot_tables.h b/payloads/libpayload/include/coreboot_tables.h index 0c516b1..be3fe48 100644 --- a/payloads/libpayload/include/coreboot_tables.h +++ b/payloads/libpayload/include/coreboot_tables.h @@ -257,6 +257,17 @@ 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; + /* offsets are relative to start of boot media */ + uint32_t fmap_offset; + uint32_t cbfs_offset; + uint32_t cbfs_size; + uint32_t boot_media_size; +}; + #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..54f5e12 100644 --- a/payloads/libpayload/include/sysinfo.h +++ b/payloads/libpayload/include/sysinfo.h @@ -124,6 +124,10 @@ struct sysinfo_t { uint32_t sector_size; uint32_t erase_cmd; } spi_flash; + uint32_t fmap_offset; + uint32_t cbfs_offset; + uint32_t cbfs_size; + uint32_t boot_media_size; uint64_t mtc_start; uint32_t mtc_size; }; diff --git a/payloads/libpayload/libc/coreboot.c b/payloads/libpayload/libc/coreboot.c index 8a5d3ae..3e248e1 100644 --- a/payloads/libpayload/libc/coreboot.c +++ b/payloads/libpayload/libc/coreboot.c @@ -220,6 +220,17 @@ 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; + info->fmap_offset = bmp->fmap_offset; + info->cbfs_offset = bmp->cbfs_offset; + info->cbfs_size = bmp->cbfs_size; + info->boot_media_size = bmp->boot_media_size; +} + int cb_parse_header(void *addr, int len, struct sysinfo_t *info) { struct cb_header *header; @@ -372,6 +383,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;