summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commonlib/include/commonlib/coreboot_tables.h24
-rw-r--r--src/include/fw_config.h6
-rw-r--r--src/lib/coreboot_table.c79
3 files changed, 42 insertions, 67 deletions
diff --git a/src/commonlib/include/commonlib/coreboot_tables.h b/src/commonlib/include/commonlib/coreboot_tables.h
index 44060025b3..3e74e6b59c 100644
--- a/src/commonlib/include/commonlib/coreboot_tables.h
+++ b/src/commonlib/include/commonlib/coreboot_tables.h
@@ -62,15 +62,15 @@ enum {
LB_TAG_DMA = 0x0022,
LB_TAG_RAM_OOPS = 0x0023,
LB_TAG_ACPI_GNVS = 0x0024,
- LB_TAG_BOARD_ID = 0x0025,
+ LB_TAG_BOARD_ID = 0x0025, /* deprecated */
LB_TAG_VERSION_TIMESTAMP = 0x0026,
LB_TAG_WIFI_CALIBRATION = 0x0027,
- LB_TAG_RAM_CODE = 0x0028,
+ LB_TAG_RAM_CODE = 0x0028, /* deprecated */
LB_TAG_SPI_FLASH = 0x0029,
LB_TAG_SERIALNO = 0x002a,
LB_TAG_MTC = 0x002b,
LB_TAG_VPD = 0x002c,
- LB_TAG_SKU_ID = 0x002d,
+ LB_TAG_SKU_ID = 0x002d, /* deprecated */
LB_TAG_BOOT_MEDIA_PARAMS = 0x0030,
LB_TAG_CBMEM_ENTRY = 0x0031,
LB_TAG_TSC_INFO = 0x0032,
@@ -81,6 +81,8 @@ enum {
LB_TAG_FMAP = 0x0037,
LB_TAG_PLATFORM_BLOB_VERSION = 0x0038,
LB_TAG_SMMSTOREV2 = 0x0039,
+ LB_TAG_BOARD_CONFIG = 0x0040,
+ /* The following options are CMOS-related */
LB_TAG_CMOS_OPTION_TABLE = 0x00c8,
LB_TAG_OPTION = 0x00c9,
LB_TAG_OPTION_ENUM = 0x00ca,
@@ -347,12 +349,6 @@ struct lb_x86_rom_mtrr {
uint32_t index;
};
-struct lb_strapping_id {
- uint32_t tag;
- uint32_t size;
- uint32_t id_code;
-};
-
struct lb_spi_flash {
uint32_t tag;
uint32_t size;
@@ -416,6 +412,16 @@ struct lb_macs {
struct mac_address mac_addrs[0];
};
+struct lb_board_config {
+ uint32_t tag;
+ uint32_t size;
+
+ struct lb_uint64 fw_config;
+ uint32_t board_id;
+ uint32_t ram_code;
+ uint32_t sku_id;
+};
+
#define MAX_SERIALNO_LENGTH 32
/* The following structures are for the CMOS definitions table */
diff --git a/src/include/fw_config.h b/src/include/fw_config.h
index c9ef75f929..3c8772598e 100644
--- a/src/include/fw_config.h
+++ b/src/include/fw_config.h
@@ -8,6 +8,8 @@
#include <stdbool.h>
#include <stdint.h>
+#define UNDEFINED_FW_CONFIG ~((uint64_t)0)
+
/**
* struct fw_config - Firmware configuration field and option.
* @field_name: Name of the field that this option belongs to.
@@ -30,8 +32,6 @@ struct fw_config {
.value = FW_CONFIG_FIELD_##__field##_OPTION_##__option##_VALUE \
})
-#if CONFIG(FW_CONFIG)
-
/**
* fw_config_get() - Provide firmware configuration value.
*
@@ -39,6 +39,8 @@ struct fw_config {
*/
uint64_t fw_config_get(void);
+#if CONFIG(FW_CONFIG)
+
/**
* fw_config_probe() - Check if field and option matches.
* @match: Structure containing field and option to probe.
diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c
index 857f5a52c3..69ded3c700 100644
--- a/src/lib/coreboot_table.c
+++ b/src/lib/coreboot_table.c
@@ -12,6 +12,7 @@
#include <boardid.h>
#include <device/device.h>
#include <fmap.h>
+#include <fw_config.h>
#include <stdlib.h>
#include <cbfs.h>
#include <cbmem.h>
@@ -213,23 +214,7 @@ static void lb_vbnv(struct lb_header *header)
__weak uint32_t board_id(void) { return UNDEFINED_STRAPPING_ID; }
__weak uint32_t ram_code(void) { return UNDEFINED_STRAPPING_ID; }
__weak uint32_t sku_id(void) { return UNDEFINED_STRAPPING_ID; }
-
-static void lb_board_id(struct lb_header *header)
-{
- 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;
- rec->size = sizeof(*rec);
- rec->id_code = bid;
-
- printk(BIOS_INFO, "Board ID: %d\n", bid);
-}
+__weak uint64_t fw_config_get(void) { return UNDEFINED_FW_CONFIG; }
static void lb_boot_media_params(struct lb_header *header)
{
@@ -257,40 +242,6 @@ static void lb_boot_media_params(struct lb_header *header)
bmp->fmap_offset = get_fmap_flash_offset();
}
-static void lb_ram_code(struct lb_header *header)
-{
- 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;
- rec->size = sizeof(*rec);
- rec->id_code = code;
-
- printk(BIOS_INFO, "RAM code: %d\n", code);
-}
-
-static void lb_sku_id(struct lb_header *header)
-{
- struct lb_strapping_id *rec;
- uint32_t sid = sku_id();
-
- if (sid == UNDEFINED_STRAPPING_ID)
- return;
-
- rec = (struct lb_strapping_id *)lb_new_record(header);
-
- rec->tag = LB_TAG_SKU_ID;
- rec->size = sizeof(*rec);
- rec->id_code = sid;
-
- printk(BIOS_INFO, "SKU ID: %d\n", sid);
-}
-
static void lb_mmc_info(struct lb_header *header)
{
struct lb_mmc_info *rec;
@@ -370,6 +321,24 @@ static struct lb_mainboard *lb_mainboard(struct lb_header *header)
return mainboard;
}
+static struct lb_board_config *lb_board_config(struct lb_header *header)
+{
+ struct lb_record *rec;
+ struct lb_board_config *config;
+ rec = lb_new_record(header);
+ config = (struct lb_board_config *)rec;
+
+ config->tag = LB_TAG_BOARD_CONFIG;
+ config->size = sizeof(*config);
+
+ config->board_id = board_id();
+ config->ram_code = ram_code();
+ config->sku_id = sku_id();
+ config->fw_config = pack_lb64(fw_config_get());
+
+ return config;
+}
+
#if CONFIG(USE_OPTION_TABLE)
static struct cmos_checksum *lb_cmos_checksum(struct lb_header *header)
{
@@ -536,11 +505,6 @@ static uintptr_t write_coreboot_table(uintptr_t rom_table_end)
lb_vbnv(head);
#endif
- /* Add strapping IDs if available */
- lb_board_id(head);
- lb_ram_code(head);
- lb_sku_id(head);
-
/* Pass mmc early init status */
lb_mmc_info(head);
@@ -563,6 +527,9 @@ static uintptr_t write_coreboot_table(uintptr_t rom_table_end)
lb_boot_media_params(head);
+ /* Board configuration information (including straps) */
+ lb_board_config(head);
+
/* Add architecture records. */
lb_arch_add_records(head);