From 4ec3d9d69efddf23de13ffa70c56cad478b219e8 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Fri, 1 Dec 2017 19:01:55 -0800 Subject: boardid: Switch from Kconfig to weak functions This patch switches the board_id and ram_code helper framework to use weak functions rather than Kconfigs to determine whether the board supplies these IDs. This cuts down on the amount of boilerplate Kconfigs many boards have to set and also gives them more flexibility, such as being able to determine at runtime whether a given ID is present. Change-Id: I97d6d1103ebb2a2a7cf1ecfc45709c7e8c1a5cb0 Signed-off-by: Julius Werner Reviewed-on: https://review.coreboot.org/22695 Reviewed-by: Aaron Durbin Tested-by: build bot (Jenkins) --- src/lib/coreboot_table.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/lib') diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c index 571d1ba520..18c70c9764 100644 --- a/src/lib/coreboot_table.c +++ b/src/lib/coreboot_table.c @@ -244,12 +244,17 @@ static inline void lb_vboot_handoff(struct lb_header *header) {} #endif /* CONFIG_VBOOT */ #endif /* CONFIG_CHROMEOS */ +__attribute__((weak)) uint32_t board_id(void) { return UNDEFINED_STRAPPING_ID; } +__attribute__((weak)) uint32_t ram_code(void) { return UNDEFINED_STRAPPING_ID; } + static void lb_board_id(struct lb_header *header) { -#if IS_ENABLED(CONFIG_BOARD_ID_AUTO) 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; @@ -257,7 +262,6 @@ static void lb_board_id(struct lb_header *header) rec->id_code = bid; printk(BIOS_INFO, "Board ID: %d\n", bid); -#endif } static void lb_boot_media_params(struct lb_header *header) @@ -291,10 +295,12 @@ static void lb_boot_media_params(struct lb_header *header) static void lb_ram_code(struct lb_header *header) { -#if IS_ENABLED(CONFIG_RAM_CODE_SUPPORT) 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; @@ -302,7 +308,6 @@ static void lb_ram_code(struct lb_header *header) rec->id_code = code; printk(BIOS_INFO, "RAM code: %d\n", code); -#endif } static void add_cbmem_pointers(struct lb_header *header) -- cgit v1.2.3