From e1a7a26f5e8bcc95d94ae9aec8df5b5226a77f56 Mon Sep 17 00:00:00 2001 From: Tim Wawrzynczak Date: Fri, 9 Oct 2020 17:07:45 -0600 Subject: lib/libpayload: Replace strapping_ids with new board configuration entry There are currently 3 different strapping ID entries in the coreboot table, which adds overhead. The new fw_config field is also desired in the coreboot table, which is another kind of strapping id. Therefore, this patch deprecates the 3 current strapping ID entries (board ID, RAM code, and SKU ID), and adds a new entry ("board_config") which provides board ID, RAM code, SKU ID, as well as FW_CONFIG together. Signed-off-by: Tim Wawrzynczak Change-Id: I1ecec847ee77b72233587c1ad7f124e2027470bf Reviewed-on: https://review.coreboot.org/c/coreboot/+/46605 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner Reviewed-by: Furquan Shaikh --- src/lib/coreboot_table.c | 79 ++++++++++++++---------------------------------- 1 file changed, 23 insertions(+), 56 deletions(-) (limited to 'src/lib') diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c index 857f5a52c3..69ded3c700 100644 --- a/src/lib/coreboot_table.c +++ b/src/lib/coreboot_table.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -213,23 +214,7 @@ static void lb_vbnv(struct lb_header *header) __weak uint32_t board_id(void) { return UNDEFINED_STRAPPING_ID; } __weak uint32_t ram_code(void) { return UNDEFINED_STRAPPING_ID; } __weak uint32_t sku_id(void) { return UNDEFINED_STRAPPING_ID; } - -static void lb_board_id(struct lb_header *header) -{ - struct lb_strapping_id *rec; - uint32_t bid = board_id(); - - if (bid == UNDEFINED_STRAPPING_ID) - return; - - rec = (struct lb_strapping_id *)lb_new_record(header); - - rec->tag = LB_TAG_BOARD_ID; - rec->size = sizeof(*rec); - rec->id_code = bid; - - printk(BIOS_INFO, "Board ID: %d\n", bid); -} +__weak uint64_t fw_config_get(void) { return UNDEFINED_FW_CONFIG; } static void lb_boot_media_params(struct lb_header *header) { @@ -257,40 +242,6 @@ static void lb_boot_media_params(struct lb_header *header) bmp->fmap_offset = get_fmap_flash_offset(); } -static void lb_ram_code(struct lb_header *header) -{ - struct lb_strapping_id *rec; - uint32_t code = ram_code(); - - if (code == UNDEFINED_STRAPPING_ID) - return; - - rec = (struct lb_strapping_id *)lb_new_record(header); - - rec->tag = LB_TAG_RAM_CODE; - rec->size = sizeof(*rec); - rec->id_code = code; - - printk(BIOS_INFO, "RAM code: %d\n", code); -} - -static void lb_sku_id(struct lb_header *header) -{ - struct lb_strapping_id *rec; - uint32_t sid = sku_id(); - - if (sid == UNDEFINED_STRAPPING_ID) - return; - - rec = (struct lb_strapping_id *)lb_new_record(header); - - rec->tag = LB_TAG_SKU_ID; - rec->size = sizeof(*rec); - rec->id_code = sid; - - printk(BIOS_INFO, "SKU ID: %d\n", sid); -} - static void lb_mmc_info(struct lb_header *header) { struct lb_mmc_info *rec; @@ -370,6 +321,24 @@ static struct lb_mainboard *lb_mainboard(struct lb_header *header) return mainboard; } +static struct lb_board_config *lb_board_config(struct lb_header *header) +{ + struct lb_record *rec; + struct lb_board_config *config; + rec = lb_new_record(header); + config = (struct lb_board_config *)rec; + + config->tag = LB_TAG_BOARD_CONFIG; + config->size = sizeof(*config); + + config->board_id = board_id(); + config->ram_code = ram_code(); + config->sku_id = sku_id(); + config->fw_config = pack_lb64(fw_config_get()); + + return config; +} + #if CONFIG(USE_OPTION_TABLE) static struct cmos_checksum *lb_cmos_checksum(struct lb_header *header) { @@ -536,11 +505,6 @@ static uintptr_t write_coreboot_table(uintptr_t rom_table_end) lb_vbnv(head); #endif - /* Add strapping IDs if available */ - lb_board_id(head); - lb_ram_code(head); - lb_sku_id(head); - /* Pass mmc early init status */ lb_mmc_info(head); @@ -563,6 +527,9 @@ static uintptr_t write_coreboot_table(uintptr_t rom_table_end) lb_boot_media_params(head); + /* Board configuration information (including straps) */ + lb_board_config(head); + /* Add architecture records. */ lb_arch_add_records(head); -- cgit v1.2.3