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

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

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)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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