The SKU ID is part of the coreboot tables. Historically, it was under
the coreboot tag for sku_id specifically, but modern coreboot versions
have put all the ID values together in one entry CB_TAG_BOARD_CONFIG
along with fw_config. Parse that tag to populate the sku_id and
fw_config fields.

Signed-off-by: Stephen Boyd <swb...@chromium.org>
---
 cmd/cbsysinfo.c           |  2 ++
 include/cb_sysinfo.h      |  4 ++++
 include/coreboot_tables.h | 11 +++++++++++
 lib/coreboot/cb_sysinfo.c | 15 +++++++++++++++
 4 files changed, 32 insertions(+)

diff --git a/cmd/cbsysinfo.c b/cmd/cbsysinfo.c
index ed7b50f6d0fc..d6ab71a3db8d 100644
--- a/cmd/cbsysinfo.c
+++ b/cmd/cbsysinfo.c
@@ -418,6 +418,8 @@ static void show_table(struct sysinfo_t *info, bool verbose)
        print_ptr("MRC cache", info->mrc_cache);
        print_ptr("ACPI GNVS", info->acpi_gnvs);
        print_hex("Board ID", info->board_id);
+       print_hex("SKU ID", info->sku_id);
+       print_addr64("FWCONFIG", info->fw_config);
        print_hex("RAM code", info->ram_code);
        print_ptr("WiFi calib", info->wifi_calibration);
        print_addr64("Ramoops buff", info->ramoops_buffer);
diff --git a/include/cb_sysinfo.h b/include/cb_sysinfo.h
index 69b02db4f281..6561f99fe26d 100644
--- a/include/cb_sysinfo.h
+++ b/include/cb_sysinfo.h
@@ -114,6 +114,8 @@
  * acpi_gnvs: @Pointer to Intel Global NVS struct, see struct acpi_global_nvs
  * @board_id: Board ID indicating the board variant, typically 0xffffffff
  * @ram_code: RAM code indicating the SDRAM type, typically 0xffffffff
+ * @sku_id: SKU ID indicating the board SKU, typically 0xffffffff
+ * @fw_config: FW config indicating the firmware configuration, typically 
0xffffffff
  * @wifi_calibration: WiFi calibration info, NULL if none
  * @ramoops_buffer: Address of kernel Ramoops buffer
  * @ramoops_buffer_size: Sizeof of Ramoops buffer, typically 1MB
@@ -204,6 +206,8 @@ struct sysinfo_t {
        void            *acpi_gnvs;
        u32             board_id;
        u32             ram_code;
+       u32             sku_id;
+       u64             fw_config;
        void            *wifi_calibration;
        u64     ramoops_buffer;
        u32     ramoops_buffer_size;
diff --git a/include/coreboot_tables.h b/include/coreboot_tables.h
index 54aeffb9889d..6e7686e360c5 100644
--- a/include/coreboot_tables.h
+++ b/include/coreboot_tables.h
@@ -438,6 +438,17 @@ struct cb_tsc_info {
 #define CB_TAG_SERIALNO                        0x002a
 #define CB_MAX_SERIALNO_LENGTH         32
 
+#define CB_TAG_BOARD_CONFIG            0x0040
+struct cb_board_config {
+       u32 tag;
+       u32 size;
+
+       u64 fw_config;
+       u32 board_id;
+       u32 ram_code;
+       u32 sku_id;
+};
+
 #define CB_TAG_ACPI_RSDP               0x0043
 
 #define CB_TAG_CMOS_OPTION_TABLE       0x00c8
diff --git a/lib/coreboot/cb_sysinfo.c b/lib/coreboot/cb_sysinfo.c
index 6cbd08ad3982..c0c6a96debec 100644
--- a/lib/coreboot/cb_sysinfo.c
+++ b/lib/coreboot/cb_sysinfo.c
@@ -148,6 +148,16 @@ static void cb_parse_acpi_gnvs(unsigned char *ptr, struct 
sysinfo_t *info)
        info->acpi_gnvs = map_sysmem(cbmem->cbmem_tab, 0);
 }
 
+static void cb_parse_board_config(unsigned char *ptr, struct sysinfo_t *info)
+{
+       struct cb_board_config *const cbbcfg = (struct cb_board_config *)ptr;
+
+       info->board_id = cbbcfg->board_id;
+       info->ram_code = cbbcfg->ram_code;
+       info->sku_id = cbbcfg->sku_id;
+       info->fw_config = cbbcfg->fw_config;
+}
+
 static void cb_parse_board_id(unsigned char *ptr, struct sysinfo_t *info)
 {
        struct cb_board_id *const cbbid = (struct cb_board_id *)ptr;
@@ -302,6 +312,8 @@ static int cb_parse_header(void *addr, int len, struct 
sysinfo_t *info)
         */
        info->board_id = ~0;
        info->ram_code = ~0;
+       info->sku_id = ~0;
+       info->fw_config = ~0ULL;
 
        /* Now, walk the tables */
        ptr += header->header_bytes;
@@ -402,6 +414,9 @@ static int cb_parse_header(void *addr, int len, struct 
sysinfo_t *info)
                case CB_TAG_CBMEM_ENTRY:
                        cb_parse_cbmem_entry(ptr, info);
                        break;
+               case CB_TAG_BOARD_CONFIG:
+                       cb_parse_board_config(ptr, info);
+                       break;
                case CB_TAG_BOARD_ID:
                        cb_parse_board_id(ptr, info);
                        break;
-- 
Sent by a computer, using git, on the internet

Reply via email to