summaryrefslogtreecommitdiff
path: root/src/lib/coreboot_table.c
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2017-12-01 19:01:55 -0800
committerJulius Werner <jwerner@chromium.org>2017-12-07 01:19:27 +0000
commit4ec3d9d69efddf23de13ffa70c56cad478b219e8 (patch)
tree6aa35b04f717b8d1f0d8478923c6eb047c1f33fa /src/lib/coreboot_table.c
parent2e029ac6a67a3d4ceb6e4825217e60f062ab7e65 (diff)
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>
Diffstat (limited to 'src/lib/coreboot_table.c')
-rw-r--r--src/lib/coreboot_table.c13
1 files changed, 9 insertions, 4 deletions
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)