boardid: Minor clean up and standardization
Merge the different coreboot table strapping ID structures into one because they're really just all the same, and I want to add more. Make the signature of the board_id() function return a uint32_t because that's also what goes in the coreboot table. Add a printk to the generic code handling strapping IDs in ramstage so that not every individual mainboard implementation needs its own print. (In turn, remove one such print from fsp1_1 code because it's in the way of my next patch.) Change-Id: Ib9563edf07b623a586a4dc168fe357564c5e68b5 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/22741 Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
ec477346bf
commit
e2f17f782f
|
@ -289,18 +289,12 @@ struct lb_x86_rom_mtrr {
|
|||
};
|
||||
|
||||
#define LB_TAG_BOARD_ID 0x0025
|
||||
struct lb_board_id {
|
||||
uint32_t tag;
|
||||
uint32_t size;
|
||||
/* Board ID as retrieved from the board revision GPIOs. */
|
||||
uint32_t board_id;
|
||||
};
|
||||
|
||||
#define LB_TAG_RAM_CODE 0x0028
|
||||
struct lb_ram_code {
|
||||
|
||||
struct lb_strapping_id {
|
||||
uint32_t tag;
|
||||
uint32_t size;
|
||||
uint32_t ram_code;
|
||||
uint32_t id_code;
|
||||
};
|
||||
|
||||
#define LB_TAG_SPI_FLASH 0x0029
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <arch/cbfs.h>
|
||||
#include <arch/early_variables.h>
|
||||
#include <assert.h>
|
||||
#include <boardid.h>
|
||||
#include <console/console.h>
|
||||
#include <cbmem.h>
|
||||
#include <cpu/intel/microcode.h>
|
||||
|
@ -74,13 +73,6 @@ asmlinkage void *romstage_main(FSP_INFO_HEADER *fih)
|
|||
/* Get power state */
|
||||
params.power_state = fill_power_state();
|
||||
|
||||
/*
|
||||
* Read and print board version. Done after SOC romstage
|
||||
* in case PCH needs to be configured to talk to the EC.
|
||||
*/
|
||||
if (IS_ENABLED(CONFIG_BOARD_ID_AUTO))
|
||||
printk(BIOS_INFO, "MLB: board version %d\n", board_id());
|
||||
|
||||
/* Call into mainboard. */
|
||||
mainboard_romstage_entry(¶ms);
|
||||
soc_after_ram_init(¶ms);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <boardid.h>
|
||||
#include <ec/google/chromeec/ec.h>
|
||||
|
||||
uint8_t board_id(void)
|
||||
uint32_t board_id(void)
|
||||
{
|
||||
MAYBE_STATIC int id = -1;
|
||||
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
uint8_t board_id(void);
|
||||
#define UNDEFINED_STRAPPING_ID (~0)
|
||||
|
||||
uint32_t board_id(void);
|
||||
uint32_t ram_code(void);
|
||||
|
||||
#endif /* __INCLUDE_BOARDID_H__ */
|
||||
|
|
|
@ -247,13 +247,16 @@ static inline void lb_vboot_handoff(struct lb_header *header) {}
|
|||
static void lb_board_id(struct lb_header *header)
|
||||
{
|
||||
#if IS_ENABLED(CONFIG_BOARD_ID_AUTO)
|
||||
struct lb_board_id *bid;
|
||||
struct lb_strapping_id *rec;
|
||||
uint32_t bid = board_id();
|
||||
|
||||
bid = (struct lb_board_id *)lb_new_record(header);
|
||||
rec = (struct lb_strapping_id *)lb_new_record(header);
|
||||
|
||||
bid->tag = LB_TAG_BOARD_ID;
|
||||
bid->size = sizeof(*bid);
|
||||
bid->board_id = board_id();
|
||||
rec->tag = LB_TAG_BOARD_ID;
|
||||
rec->size = sizeof(*rec);
|
||||
rec->id_code = bid;
|
||||
|
||||
printk(BIOS_INFO, "Board ID: %d\n", bid);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -289,13 +292,16 @@ 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_ram_code *code;
|
||||
struct lb_strapping_id *rec;
|
||||
uint32_t code = ram_code();
|
||||
|
||||
code = (struct lb_ram_code *)lb_new_record(header);
|
||||
rec = (struct lb_strapping_id *)lb_new_record(header);
|
||||
|
||||
code->tag = LB_TAG_RAM_CODE;
|
||||
code->size = sizeof(*code);
|
||||
code->ram_code = ram_code();
|
||||
rec->tag = LB_TAG_RAM_CODE;
|
||||
rec->size = sizeof(*rec);
|
||||
rec->id_code = code;
|
||||
|
||||
printk(BIOS_INFO, "RAM code: %d\n", code);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
* ......
|
||||
* 1 1 1 H
|
||||
*/
|
||||
uint8_t board_id(void)
|
||||
uint32_t board_id(void)
|
||||
{
|
||||
void *gpiommioaddr;
|
||||
u8 value = 0;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <console/console.h>
|
||||
#include <gpio.h>
|
||||
|
||||
uint8_t board_id(void)
|
||||
uint32_t board_id(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ static uint8_t get_board_id(void)
|
|||
return bid;
|
||||
}
|
||||
|
||||
uint8_t board_id(void)
|
||||
uint32_t board_id(void)
|
||||
{
|
||||
if (board_id_value < 0)
|
||||
board_id_value = get_board_id();
|
||||
|
|
|
@ -66,7 +66,7 @@ static uint32_t get_index(uint32_t channel, int *cached_id)
|
|||
die("Read impossible value ( > 1023) from 10-bit ADC!");
|
||||
}
|
||||
|
||||
uint8_t board_id(void)
|
||||
uint32_t board_id(void)
|
||||
{
|
||||
return get_index(1, &cached_board_id);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include <console/console.h>
|
||||
#include <gpio.h>
|
||||
|
||||
uint8_t board_id(void)
|
||||
uint32_t board_id(void)
|
||||
{
|
||||
static int id = -1;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <gpio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
uint8_t board_id(void)
|
||||
uint32_t board_id(void)
|
||||
{
|
||||
static int id = -1;
|
||||
gpio_t gpio[] = {[3] = GPIO(X4), [2] = GPIO(X1), /* X4 is MSB */
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <gpio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
uint8_t board_id(void)
|
||||
uint32_t board_id(void)
|
||||
{
|
||||
static int id = -1;
|
||||
gpio_t gpio[] = {[3] = GPIO(X4), [2] = GPIO(X1), /* X4 is MSB */
|
||||
|
|
|
@ -34,7 +34,7 @@ static uint8_t get_board_id(void)
|
|||
return bid;
|
||||
}
|
||||
|
||||
uint8_t board_id(void)
|
||||
uint32_t board_id(void)
|
||||
{
|
||||
if (board_id_value < 0)
|
||||
board_id_value = get_board_id();
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include <boardid.h>
|
||||
|
||||
uint8_t board_id(void)
|
||||
uint32_t board_id(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include "gpio.h"
|
||||
|
||||
uint8_t board_id(void)
|
||||
uint32_t board_id(void)
|
||||
{
|
||||
static int id = -1;
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ static uint8_t get_board_id(void)
|
|||
return bid;
|
||||
}
|
||||
|
||||
uint8_t board_id(void)
|
||||
uint32_t board_id(void)
|
||||
{
|
||||
if (board_id_value < 0)
|
||||
board_id_value = get_board_id();
|
||||
|
|
|
@ -89,7 +89,7 @@ const struct board_hw *board_get_hw(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
uint8_t board_id(void)
|
||||
uint32_t board_id(void)
|
||||
{
|
||||
if (cached_board_id == -1)
|
||||
cached_board_id = retrieve_board_id();
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <gpio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
uint8_t board_id(void)
|
||||
uint32_t board_id(void)
|
||||
{
|
||||
static int id = -1;
|
||||
gpio_t pins[] = {[3] = GPIO(2, A, 7), [2] = GPIO(2, A, 2),
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <gpio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
uint8_t board_id(void)
|
||||
uint32_t board_id(void)
|
||||
{
|
||||
static int id = -1;
|
||||
gpio_t pins[] = {[3] = GPIO(2, A, 7), [2] = GPIO(2, A, 2),
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <gpio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
uint8_t board_id(void)
|
||||
uint32_t board_id(void)
|
||||
{
|
||||
static int id = -1;
|
||||
gpio_t pins[] = {[3] = GPIO(2, A, 7), [2] = GPIO(2, A, 2),
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include <boardid.h>
|
||||
#include <stddef.h>
|
||||
|
||||
uint8_t board_id(void)
|
||||
uint32_t board_id(void)
|
||||
{
|
||||
MAYBE_STATIC int id = -1;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#define BOARD_ID_GLK_RVP2_LP4 0x8 /* RVP2 - LP4 Socket */
|
||||
#define EC_FAB_ID_CMD 0x0D /* Get the board fab ID in the lower 3 bits */
|
||||
|
||||
uint8_t board_id(void)
|
||||
uint32_t board_id(void)
|
||||
{
|
||||
MAYBE_STATIC int id = -1;
|
||||
if (id < 0) {
|
||||
|
|
Loading…
Reference in New Issue