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 <twawrzynczak@chromium.org> Change-Id: I1ecec847ee77b72233587c1ad7f124e2027470bf Reviewed-on: https://review.coreboot.org/c/coreboot/+/46605 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
@ -12,6 +12,7 @@
|
||||
#include <boardid.h>
|
||||
#include <device/device.h>
|
||||
#include <fmap.h>
|
||||
#include <fw_config.h>
|
||||
#include <stdlib.h>
|
||||
#include <cbfs.h>
|
||||
#include <cbmem.h>
|
||||
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user