summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@chromium.org>2015-07-14 17:15:51 +0100
committerPatrick Georgi <pgeorgi@google.com>2015-07-14 22:36:43 +0200
commitfb5d5b16eef66d37dc20cdf0769c9049bf47d6be (patch)
tree8c60e976e66bcfffdcc0b66da176b5d6fe978d58
parent3ac3c4ebac8700ba99f2fdaf745d3e6aa1056dca (diff)
downloadcoreboot-fb5d5b16eef66d37dc20cdf0769c9049bf47d6be.tar.xz
cbtable: describe boot media
This allows finding the currently used CBFS (in case there are several), and avoids the need to define flash size when building the payload. Change-Id: I4b00159610077761c501507e136407e9ae08c73e Signed-off-by: Aaron Durbin <adurbin@chromium.org> Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-on: http://review.coreboot.org/10867 Tested-by: build bot (Jenkins)
-rw-r--r--src/include/boot/coreboot_tables.h11
-rw-r--r--src/lib/coreboot_table.c34
2 files changed, 45 insertions, 0 deletions
diff --git a/src/include/boot/coreboot_tables.h b/src/include/boot/coreboot_tables.h
index c8d52517f9..3dddde5bbf 100644
--- a/src/include/boot/coreboot_tables.h
+++ b/src/include/boot/coreboot_tables.h
@@ -297,6 +297,17 @@ struct lb_spi_flash {
uint32_t erase_cmd;
};
+#define LB_TAG_BOOT_MEDIA_PARAMS 0x0030
+struct lb_boot_media_params {
+ uint32_t tag;
+ uint32_t size;
+ /* offsets are relative to start of boot media */
+ uint64_t fmap_offset;
+ uint64_t cbfs_offset;
+ uint64_t cbfs_size;
+ uint64_t boot_media_size;
+};
+
#define LB_TAG_SERIALNO 0x002a
#define MAX_SERIALNO_LENGTH 32
diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c
index f7fb2bb54a..6859bf2d91 100644
--- a/src/lib/coreboot_table.c
+++ b/src/lib/coreboot_table.c
@@ -23,10 +23,12 @@
#include <console/uart.h>
#include <ip_checksum.h>
#include <boot/coreboot_tables.h>
+#include <boot_device.h>
#include <string.h>
#include <version.h>
#include <boardid.h>
#include <device/device.h>
+#include <fmap.h>
#include <stdlib.h>
#include <cbfs.h>
#include <cbmem.h>
@@ -228,6 +230,36 @@ static void lb_board_id(struct lb_header *header)
#endif
}
+static void lb_boot_media_params(struct lb_header *header)
+{
+ struct lb_boot_media_params *bmp;
+ struct cbfs_props props;
+ const struct region_device *boot_dev;
+ struct region_device fmrd;
+
+ boot_device_init();
+
+ if (cbfs_boot_region_properties(&props))
+ return;
+
+ boot_dev = boot_device_ro();
+ if (boot_dev == NULL)
+ return;
+
+ bmp = (struct lb_boot_media_params *)lb_new_record(header);
+ bmp->tag = LB_TAG_BOOT_MEDIA_PARAMS;
+ bmp->size = sizeof(*bmp);
+
+ bmp->cbfs_offset = props.offset;
+ bmp->cbfs_size = props.size;
+ bmp->boot_media_size = region_device_sz(boot_dev);
+
+ bmp->fmap_offset = ~(uint64_t)0;
+ if (find_fmap_directory(&fmrd) == 0) {
+ bmp->fmap_offset = region_device_offset(&fmrd);
+ }
+}
+
static void lb_ram_code(struct lb_header *header)
{
#if IS_ENABLED(CONFIG_RAM_CODE_SUPPORT)
@@ -483,6 +515,8 @@ unsigned long write_coreboot_table(
lb_ramoops(head);
#endif
+ lb_boot_media_params(head);
+
/* Remember where my valid memory ranges are */
return lb_table_fini(head);
}