summaryrefslogtreecommitdiff
path: root/payloads/libpayload
diff options
context:
space:
mode:
Diffstat (limited to 'payloads/libpayload')
-rw-r--r--payloads/libpayload/include/coreboot_tables.h17
-rw-r--r--payloads/libpayload/include/sysinfo.h9
-rw-r--r--payloads/libpayload/libc/coreboot.c32
3 files changed, 28 insertions, 30 deletions
diff --git a/payloads/libpayload/include/coreboot_tables.h b/payloads/libpayload/include/coreboot_tables.h
index bfdd21e692..64db83bbd4 100644
--- a/payloads/libpayload/include/coreboot_tables.h
+++ b/payloads/libpayload/include/coreboot_tables.h
@@ -80,6 +80,7 @@ enum {
CB_TAG_TCPA_LOG = 0x0036,
CB_TAG_FMAP = 0x0037,
CB_TAG_SMMSTOREV2 = 0x0039,
+ CB_TAG_BOARD_CONFIG = 0x0040,
CB_TAG_CMOS_OPTION_TABLE = 0x00c8,
CB_TAG_OPTION = 0x00c9,
CB_TAG_OPTION_ENUM = 0x00ca,
@@ -260,12 +261,6 @@ struct cb_x86_rom_mtrr {
uint32_t index;
};
-struct cb_strapping_id {
- uint32_t tag;
- uint32_t size;
- uint32_t id_code;
-};
-
struct cb_spi_flash {
uint32_t tag;
uint32_t size;
@@ -317,6 +312,16 @@ struct cb_mmc_info {
int32_t early_cmd1_status;
};
+struct cb_board_config {
+ uint32_t tag;
+ uint32_t size;
+
+ struct cbuint64 fw_config;
+ uint32_t board_id;
+ uint32_t ram_code;
+ uint32_t sku_id;
+};
+
#define CB_MAX_SERIALNO_LENGTH 32
struct cb_cmos_option_table {
diff --git a/payloads/libpayload/include/sysinfo.h b/payloads/libpayload/include/sysinfo.h
index a3f61e7ffa..dd739abab4 100644
--- a/payloads/libpayload/include/sysinfo.h
+++ b/payloads/libpayload/include/sysinfo.h
@@ -107,11 +107,18 @@ struct sysinfo_t {
uintptr_t mrc_cache;
uintptr_t acpi_gnvs;
-#define UNDEFINED_STRAPPING_ID (~0)
+#define UNDEFINED_STRAPPING_ID (~0)
+#define UNDEFINED_FW_CONFIG ~((uint64_t)0)
u32 board_id;
u32 ram_code;
u32 sku_id;
+ /*
+ * A payload using this field is responsible for ensuring it checks its
+ * value against UNDEFINED_FW_CONFIG before using it.
+ */
+ u64 fw_config;
+
uintptr_t wifi_calibration;
uint64_t ramoops_buffer;
uint32_t ramoops_buffer_size;
diff --git a/payloads/libpayload/libc/coreboot.c b/payloads/libpayload/libc/coreboot.c
index c48b6cffd8..b7d2a537b5 100644
--- a/payloads/libpayload/libc/coreboot.c
+++ b/payloads/libpayload/libc/coreboot.c
@@ -143,22 +143,13 @@ static void cb_parse_acpi_gnvs(unsigned char *ptr, struct sysinfo_t *info)
info->acpi_gnvs = get_cbmem_addr(ptr);
}
-static void cb_parse_board_id(unsigned char *ptr, struct sysinfo_t *info)
+static void cb_parse_board_config(unsigned char *ptr, struct sysinfo_t *info)
{
- struct cb_strapping_id *const cbbid = (struct cb_strapping_id *)ptr;
- info->board_id = cbbid->id_code;
-}
-
-static void cb_parse_ram_code(unsigned char *ptr, struct sysinfo_t *info)
-{
- struct cb_strapping_id *const ram_code = (struct cb_strapping_id *)ptr;
- info->ram_code = ram_code->id_code;
-}
-
-static void cb_parse_sku_id(unsigned char *ptr, struct sysinfo_t *info)
-{
- struct cb_strapping_id *const sku_id = (struct cb_strapping_id *)ptr;
- info->sku_id = sku_id->id_code;
+ struct cb_board_config *const config = (struct cb_board_config *)ptr;
+ info->fw_config = cb_unpack64(config->fw_config);
+ info->board_id = config->board_id;
+ info->ram_code = config->ram_code;
+ info->sku_id = config->sku_id;
}
#if CONFIG(LP_NVRAM)
@@ -290,6 +281,7 @@ int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
info->board_id = UNDEFINED_STRAPPING_ID;
info->ram_code = UNDEFINED_STRAPPING_ID;
info->sku_id = UNDEFINED_STRAPPING_ID;
+ info->fw_config = UNDEFINED_FW_CONFIG;
/* Now, walk the tables. */
ptr += header->header_bytes;
@@ -381,14 +373,8 @@ int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
case CB_TAG_ACPI_GNVS:
cb_parse_acpi_gnvs(ptr, info);
break;
- case CB_TAG_BOARD_ID:
- cb_parse_board_id(ptr, info);
- break;
- case CB_TAG_RAM_CODE:
- cb_parse_ram_code(ptr, info);
- break;
- case CB_TAG_SKU_ID:
- cb_parse_sku_id(ptr, info);
+ case CB_TAG_BOARD_CONFIG:
+ cb_parse_board_config(ptr, info);
break;
case CB_TAG_WIFI_CALIBRATION:
cb_parse_wifi_calibration(ptr, info);