summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mainboard/google/kahlee/Kconfig11
-rw-r--r--src/mainboard/google/kahlee/variants/baseboard/Makefile.inc7
-rw-r--r--src/mainboard/google/kahlee/variants/baseboard/mainboard.c49
3 files changed, 67 insertions, 0 deletions
diff --git a/src/mainboard/google/kahlee/Kconfig b/src/mainboard/google/kahlee/Kconfig
index 91809066c6..ce6227cef8 100644
--- a/src/mainboard/google/kahlee/Kconfig
+++ b/src/mainboard/google/kahlee/Kconfig
@@ -128,4 +128,15 @@ config DRIVER_TPM_I2C_ADDR
hex
default 0x50
+config USE_OEM_BIN
+ bool "Add an oem.bin file"
+ help
+ Add an oem.bin file to identify the manufacturer in SMBIOS, overriding the
+ CONFIG_MAINBOARD_SMBIOS_MANUFACTURER value.
+
+config OEM_BIN_FILE
+ string "OEM ID table"
+ depends on USE_OEM_BIN
+ default ""
+
endif # BOARD_GOOGLE_BASEBOARD_KAHLEE
diff --git a/src/mainboard/google/kahlee/variants/baseboard/Makefile.inc b/src/mainboard/google/kahlee/variants/baseboard/Makefile.inc
index 1f6d8ce792..6ffbf5373b 100644
--- a/src/mainboard/google/kahlee/variants/baseboard/Makefile.inc
+++ b/src/mainboard/google/kahlee/variants/baseboard/Makefile.inc
@@ -25,3 +25,10 @@ romstage-y += tpm_tis.c
ramstage-y += gpio.c
ramstage-y += tpm_tis.c
+
+# Add OEM ID table
+ifeq ($(CONFIG_USE_OEM_BIN),y)
+cbfs-files-y += oem.bin
+oem.bin-file := $(call strip_quotes,$(CONFIG_OEM_BIN_FILE))
+oem.bin-type := raw
+endif #($(CONFIG_USE_OEM_BIN),y)
diff --git a/src/mainboard/google/kahlee/variants/baseboard/mainboard.c b/src/mainboard/google/kahlee/variants/baseboard/mainboard.c
index 3edcd65dc1..ad5fb2bc4f 100644
--- a/src/mainboard/google/kahlee/variants/baseboard/mainboard.c
+++ b/src/mainboard/google/kahlee/variants/baseboard/mainboard.c
@@ -15,7 +15,9 @@
#include <ec/google/chromeec/ec.h>
#include <baseboard/variants.h>
+#include <cbfs.h>
#include <gpio.h>
+#include <smbios.h>
#include <variant/gpio.h>
#include <device/pci.h>
#include <drivers/generic/bayhub/bh720.h>
@@ -73,3 +75,50 @@ void board_bh720(struct device *dev)
write32((void *)(sdbar + BH720_MEM_RW_ADR), 0x800000D0);
write32((void *)(sdbar + BH720_MEM_ACCESS_EN), 0x80000000);
}
+
+static uint8_t calc_oem_id(void)
+{
+ return variant_board_sku() / 0x10;
+}
+
+/* "oem.bin" in cbfs contains an array of records using the following structure. */
+struct oem_mapping {
+ uint8_t oem_id;
+ char oem_name[10];
+} __packed;
+
+/* Local buffer to read "oem.bin" */
+static char oem_bin_data[200];
+
+const char *smbios_mainboard_manufacturer(void)
+{
+ uint8_t oem_id;
+ const struct oem_mapping *oem_entry = (void *)&oem_bin_data;
+ size_t oem_data_size;
+ unsigned int i, oem_entries_count;
+ static const char *manuf;
+
+ if (!IS_ENABLED(CONFIG_USE_OEM_BIN))
+ return CONFIG_MAINBOARD_SMBIOS_MANUFACTURER;
+
+ if (manuf)
+ return manuf;
+
+ oem_data_size = cbfs_boot_load_file("oem.bin", oem_bin_data,
+ sizeof(oem_bin_data),
+ CBFS_TYPE_RAW);
+ oem_id = calc_oem_id();
+ oem_entries_count = oem_data_size / sizeof(*oem_entry);
+ for (i = 0; i < oem_entries_count; i++) {
+ if (oem_id == oem_entry->oem_id) {
+ manuf = oem_entry->oem_name;
+ break;
+ }
+ oem_entry++;
+ }
+
+ if (manuf == NULL)
+ manuf = CONFIG_MAINBOARD_SMBIOS_MANUFACTURER;
+
+ return manuf;
+}