diff options
author | Julius Werner <jwerner@chromium.org> | 2017-12-01 19:01:55 -0800 |
---|---|---|
committer | Julius Werner <jwerner@chromium.org> | 2017-12-07 01:19:27 +0000 |
commit | 4ec3d9d69efddf23de13ffa70c56cad478b219e8 (patch) | |
tree | 6aa35b04f717b8d1f0d8478923c6eb047c1f33fa | |
parent | 2e029ac6a67a3d4ceb6e4825217e60f062ab7e65 (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>
22 files changed, 9 insertions, 43 deletions
diff --git a/src/Kconfig b/src/Kconfig index bc8f059bcd..6896d0e79c 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -236,12 +236,6 @@ config UPDATE_IMAGE If unsure, select 'N' -config RAM_CODE_SUPPORT - bool - help - If enabled, coreboot discovers RAM configuration (value obtained by - reading board straps) and stores it in coreboot table. - config BOOTSPLASH_IMAGE bool "Add a bootsplash image" help @@ -1207,13 +1201,6 @@ config DIMM_SPD_SIZE config SPD_READ_BY_WORD bool -config BOARD_ID_AUTO - bool - default n - help - Mainboards that can read a board ID from the hardware straps - (ie. GPIO) select this configuration option. - config BOOTBLOCK_CUSTOM # To be selected by arch, SoC or mainboard if it does not want use the normal # src/lib/bootblock.c#main() C entry point. 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) diff --git a/src/mainboard/google/chell/Kconfig b/src/mainboard/google/chell/Kconfig index c09ad48331..f958d9166a 100644 --- a/src/mainboard/google/chell/Kconfig +++ b/src/mainboard/google/chell/Kconfig @@ -2,7 +2,6 @@ if BOARD_GOOGLE_CHELL config BOARD_SPECIFIC_OPTIONS # dummy def_bool y - select BOARD_ID_AUTO select BOARD_ROMSIZE_KB_16384 select DRIVERS_I2C_GENERIC select DRIVERS_I2C_NAU8825 diff --git a/src/mainboard/google/eve/Kconfig b/src/mainboard/google/eve/Kconfig index 54b8868166..ea650302b2 100644 --- a/src/mainboard/google/eve/Kconfig +++ b/src/mainboard/google/eve/Kconfig @@ -2,7 +2,6 @@ if BOARD_GOOGLE_EVE config BOARD_SPECIFIC_OPTIONS def_bool y - select BOARD_ID_AUTO select BOARD_ROMSIZE_KB_16384 select DRIVERS_I2C_GENERIC select DRIVERS_I2C_HID diff --git a/src/mainboard/google/fizz/Kconfig b/src/mainboard/google/fizz/Kconfig index ce5c8bdd04..34242604e5 100644 --- a/src/mainboard/google/fizz/Kconfig +++ b/src/mainboard/google/fizz/Kconfig @@ -2,7 +2,6 @@ if BOARD_GOOGLE_FIZZ config BOARD_SPECIFIC_OPTIONS def_bool y - select BOARD_ID_AUTO select BOARD_ROMSIZE_KB_16384 select DRIVERS_I2C_GENERIC select DRIVERS_SPI_ACPI diff --git a/src/mainboard/google/foster/Kconfig b/src/mainboard/google/foster/Kconfig index ee22110bf3..c8076d7613 100644 --- a/src/mainboard/google/foster/Kconfig +++ b/src/mainboard/google/foster/Kconfig @@ -17,7 +17,6 @@ if BOARD_GOOGLE_FOSTER config BOARD_SPECIFIC_OPTIONS # dummy def_bool y - select BOARD_ID_AUTO select BOARD_ROMSIZE_KB_4096 select SPI_FLASH select SOC_NVIDIA_TEGRA210 diff --git a/src/mainboard/google/gale/Kconfig b/src/mainboard/google/gale/Kconfig index 461ed5b76e..d3470ca94f 100644 --- a/src/mainboard/google/gale/Kconfig +++ b/src/mainboard/google/gale/Kconfig @@ -18,7 +18,6 @@ if BOARD_GOOGLE_GALE config BOARD_SPECIFIC_OPTIONS def_bool y select SOC_QC_IPQ40XX - select BOARD_ID_AUTO select BOARD_ROMSIZE_KB_8192 select COMMON_CBFS_SPI_WRAPPER select DRIVERS_I2C_WW_RING diff --git a/src/mainboard/google/glados/Kconfig b/src/mainboard/google/glados/Kconfig index b893a6a966..de78aae0e6 100644 --- a/src/mainboard/google/glados/Kconfig +++ b/src/mainboard/google/glados/Kconfig @@ -2,7 +2,6 @@ if BOARD_GOOGLE_GLADOS config BOARD_SPECIFIC_OPTIONS # dummy def_bool y - select BOARD_ID_AUTO select BOARD_ROMSIZE_KB_16384 select DRIVERS_I2C_GENERIC select DRIVERS_I2C_NAU8825 diff --git a/src/mainboard/google/gru/Kconfig b/src/mainboard/google/gru/Kconfig index 0a17138fb8..bbaec7261c 100644 --- a/src/mainboard/google/gru/Kconfig +++ b/src/mainboard/google/gru/Kconfig @@ -42,7 +42,6 @@ config GRU_BASEBOARD_SCARLET config BOARD_SPECIFIC_OPTIONS def_bool y - select BOARD_ID_AUTO select BOARD_ROMSIZE_KB_8192 select COMMON_CBFS_SPI_WRAPPER select EC_GOOGLE_CHROMEEC @@ -52,7 +51,6 @@ config BOARD_SPECIFIC_OPTIONS select MAINBOARD_FORCE_NATIVE_VGA_INIT select MAINBOARD_HAS_CHROMEOS select MAINBOARD_HAS_NATIVE_VGA_INIT - select RAM_CODE_SUPPORT select RK3399_SPREAD_SPECTRUM_DDR if BOARD_GOOGLE_BOB select RTC select SOC_ROCKCHIP_RK3399 diff --git a/src/mainboard/google/lars/Kconfig b/src/mainboard/google/lars/Kconfig index e274b13e14..cda4b537a8 100644 --- a/src/mainboard/google/lars/Kconfig +++ b/src/mainboard/google/lars/Kconfig @@ -2,7 +2,6 @@ if BOARD_GOOGLE_LARS config BOARD_SPECIFIC_OPTIONS # dummy def_bool y - select BOARD_ID_AUTO select BOARD_ROMSIZE_KB_16384 select DRIVERS_GENERIC_MAX98357A select DRIVERS_I2C_GENERIC diff --git a/src/mainboard/google/nyan_big/Kconfig b/src/mainboard/google/nyan_big/Kconfig index 00761546ba..2ebae84a4d 100644 --- a/src/mainboard/google/nyan_big/Kconfig +++ b/src/mainboard/google/nyan_big/Kconfig @@ -19,7 +19,6 @@ config BOARD_SPECIFIC_OPTIONS # dummy def_bool y select SOC_NVIDIA_TEGRA124 select MAINBOARD_HAS_CHROMEOS - select BOARD_ID_AUTO select COMMON_CBFS_SPI_WRAPPER select EC_GOOGLE_CHROMEEC select EC_GOOGLE_CHROMEEC_SPI diff --git a/src/mainboard/google/nyan_blaze/Kconfig b/src/mainboard/google/nyan_blaze/Kconfig index 7691f73163..912022718f 100644 --- a/src/mainboard/google/nyan_blaze/Kconfig +++ b/src/mainboard/google/nyan_blaze/Kconfig @@ -18,7 +18,6 @@ if BOARD_GOOGLE_NYAN_BLAZE config BOARD_SPECIFIC_OPTIONS # dummy def_bool y select ARCH_ARM - select BOARD_ID_AUTO select COMMON_CBFS_SPI_WRAPPER select EC_GOOGLE_CHROMEEC select EC_GOOGLE_CHROMEEC_SPI diff --git a/src/mainboard/google/oak/Kconfig b/src/mainboard/google/oak/Kconfig index ede32e0f3c..bab142bdd2 100644 --- a/src/mainboard/google/oak/Kconfig +++ b/src/mainboard/google/oak/Kconfig @@ -27,7 +27,6 @@ config OAK_HAS_TPM2 config BOARD_SPECIFIC_OPTIONS def_bool y select SOC_MEDIATEK_MT8173 - select BOARD_ID_AUTO select BOARD_ROMSIZE_KB_4096 select COMMON_CBFS_SPI_WRAPPER select DRIVER_PARADE_PS8640 @@ -37,7 +36,6 @@ config BOARD_SPECIFIC_OPTIONS select MAINBOARD_FORCE_NATIVE_VGA_INIT select HAVE_LINEAR_FRAMEBUFFER select MAINBOARD_HAS_CHROMEOS - select RAM_CODE_SUPPORT select SPI_FLASH config VBOOT diff --git a/src/mainboard/google/poppy/Kconfig b/src/mainboard/google/poppy/Kconfig index 409bfeee6b..3890e0f909 100644 --- a/src/mainboard/google/poppy/Kconfig +++ b/src/mainboard/google/poppy/Kconfig @@ -1,7 +1,6 @@ config BOARD_GOOGLE_BASEBOARD_POPPY def_bool n - select BOARD_ID_AUTO select BOARD_ROMSIZE_KB_16384 select DRIVERS_I2C_GENERIC select DRIVERS_I2C_HID diff --git a/src/mainboard/google/purin/Kconfig b/src/mainboard/google/purin/Kconfig index 6e0572420c..ebe6fe19f6 100644 --- a/src/mainboard/google/purin/Kconfig +++ b/src/mainboard/google/purin/Kconfig @@ -17,7 +17,6 @@ if BOARD_GOOGLE_PURIN config BOARD_SPECIFIC_OPTIONS # dummy def_bool y - select BOARD_ID_AUTO select BOARD_ROMSIZE_KB_2048 select COMMON_CBFS_SPI_WRAPPER select HAVE_HARD_RESET diff --git a/src/mainboard/google/smaug/Kconfig b/src/mainboard/google/smaug/Kconfig index 06c1cba35e..cfd508fa79 100644 --- a/src/mainboard/google/smaug/Kconfig +++ b/src/mainboard/google/smaug/Kconfig @@ -17,7 +17,6 @@ if BOARD_GOOGLE_SMAUG config BOARD_SPECIFIC_OPTIONS # dummy def_bool y - select BOARD_ID_AUTO select BOARD_ROMSIZE_KB_16384 select COMMON_CBFS_SPI_WRAPPER select EC_GOOGLE_CHROMEEC @@ -30,7 +29,6 @@ config BOARD_SPECIFIC_OPTIONS # dummy select SOC_NVIDIA_TEGRA210 select MAINBOARD_DO_DSI_INIT select MAINBOARD_HAS_CHROMEOS - select RAM_CODE_SUPPORT config VBOOT select EC_GOOGLE_CHROMEEC_SWITCHES diff --git a/src/mainboard/google/storm/Kconfig b/src/mainboard/google/storm/Kconfig index 24822ab8dd..cd66a92198 100644 --- a/src/mainboard/google/storm/Kconfig +++ b/src/mainboard/google/storm/Kconfig @@ -18,7 +18,6 @@ if BOARD_GOOGLE_STORM config BOARD_SPECIFIC_OPTIONS def_bool y select SOC_QC_IPQ806X - select BOARD_ID_AUTO select BOARD_ROMSIZE_KB_8192 select COMMON_CBFS_SPI_WRAPPER select DRIVERS_I2C_WW_RING diff --git a/src/mainboard/google/veyron/Kconfig b/src/mainboard/google/veyron/Kconfig index cbb5b9a00f..f051b3d841 100644 --- a/src/mainboard/google/veyron/Kconfig +++ b/src/mainboard/google/veyron/Kconfig @@ -30,11 +30,9 @@ config VEYRON_FORCE_BINARY_RAM_CODE config BOARD_SPECIFIC_OPTIONS # dummy def_bool y - select BOARD_ID_AUTO select COMMON_CBFS_SPI_WRAPPER select EC_GOOGLE_CHROMEEC select EC_GOOGLE_CHROMEEC_SPI - select RAM_CODE_SUPPORT select SOC_ROCKCHIP_RK3288 select MAINBOARD_HAS_CHROMEOS select BOARD_ROMSIZE_KB_4096 diff --git a/src/mainboard/google/veyron_mickey/Kconfig b/src/mainboard/google/veyron_mickey/Kconfig index 2df0688a1f..6b7b4334af 100644 --- a/src/mainboard/google/veyron_mickey/Kconfig +++ b/src/mainboard/google/veyron_mickey/Kconfig @@ -17,12 +17,10 @@ if BOARD_GOOGLE_VEYRON_MICKEY config BOARD_SPECIFIC_OPTIONS # dummy def_bool y - select BOARD_ID_AUTO select BOARD_ROMSIZE_KB_4096 select COMMON_CBFS_SPI_WRAPPER select HAVE_HARD_RESET select MAINBOARD_HAS_CHROMEOS - select RAM_CODE_SUPPORT select SOC_ROCKCHIP_RK3288 select SPI_FLASH select SPI_FLASH_GIGADEVICE diff --git a/src/mainboard/google/veyron_rialto/Kconfig b/src/mainboard/google/veyron_rialto/Kconfig index ec83a990d5..6cea9f05ac 100644 --- a/src/mainboard/google/veyron_rialto/Kconfig +++ b/src/mainboard/google/veyron_rialto/Kconfig @@ -17,12 +17,10 @@ if BOARD_GOOGLE_VEYRON_RIALTO config BOARD_SPECIFIC_OPTIONS # dummy def_bool y - select BOARD_ID_AUTO select BOARD_ROMSIZE_KB_4096 select COMMON_CBFS_SPI_WRAPPER select HAVE_HARD_RESET select MAINBOARD_HAS_CHROMEOS - select RAM_CODE_SUPPORT select SOC_ROCKCHIP_RK3288 select SPI_FLASH select SPI_FLASH_GIGADEVICE diff --git a/src/mainboard/google/zoombini/Kconfig b/src/mainboard/google/zoombini/Kconfig index f95dba192f..efa2d9ca7a 100644 --- a/src/mainboard/google/zoombini/Kconfig +++ b/src/mainboard/google/zoombini/Kconfig @@ -1,7 +1,6 @@ config BOARD_GOOGLE_BASEBOARD_ZOOMBINI def_bool n - select BOARD_ID_AUTO select BOARD_ROMSIZE_KB_16384 select DRIVERS_I2C_GENERIC select EC_GOOGLE_CHROMEEC diff --git a/src/mainboard/intel/kunimitsu/Kconfig b/src/mainboard/intel/kunimitsu/Kconfig index 49991b89c0..613e47f91f 100644 --- a/src/mainboard/intel/kunimitsu/Kconfig +++ b/src/mainboard/intel/kunimitsu/Kconfig @@ -2,7 +2,6 @@ if BOARD_INTEL_KUNIMITSU config BOARD_SPECIFIC_OPTIONS # dummy def_bool y - select BOARD_ID_AUTO select BOARD_ROMSIZE_KB_16384 select DRIVERS_GENERIC_MAX98357A select DRIVERS_I2C_GENERIC |