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 <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/22695
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Julius Werner
2017-12-01 19:01:55 -08:00
parent 2e029ac6a6
commit 4ec3d9d69e
22 changed files with 9 additions and 43 deletions

View File

@ -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)