mainboard/google/kahlee: allow oem.bin file to update smbios
Grunt variants need a way to customize the mainboard vendor based on the platform. For future boards, this can probably be done via CBI, but grunt doesn't support that method. BUG=b:79874904 TEST=Build, boot, see updated mainboard vendor Change-Id: I997dc39c7f36f70cf4320ef335831245889eb475 Signed-off-by: Martin Roth <martinroth@chromium.org> Reviewed-on: https://review.coreboot.org/28651 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Raul Rangel <rrangel@google.com>
This commit is contained in:
parent
06c14d0962
commit
4ae44fce56
|
@ -128,4 +128,15 @@ config DRIVER_TPM_I2C_ADDR
|
||||||
hex
|
hex
|
||||||
default 0x50
|
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
|
endif # BOARD_GOOGLE_BASEBOARD_KAHLEE
|
||||||
|
|
|
@ -25,3 +25,10 @@ romstage-y += tpm_tis.c
|
||||||
|
|
||||||
ramstage-y += gpio.c
|
ramstage-y += gpio.c
|
||||||
ramstage-y += tpm_tis.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)
|
||||||
|
|
|
@ -15,7 +15,9 @@
|
||||||
|
|
||||||
#include <ec/google/chromeec/ec.h>
|
#include <ec/google/chromeec/ec.h>
|
||||||
#include <baseboard/variants.h>
|
#include <baseboard/variants.h>
|
||||||
|
#include <cbfs.h>
|
||||||
#include <gpio.h>
|
#include <gpio.h>
|
||||||
|
#include <smbios.h>
|
||||||
#include <variant/gpio.h>
|
#include <variant/gpio.h>
|
||||||
#include <device/pci.h>
|
#include <device/pci.h>
|
||||||
#include <drivers/generic/bayhub/bh720.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_RW_ADR), 0x800000D0);
|
||||||
write32((void *)(sdbar + BH720_MEM_ACCESS_EN), 0x80000000);
|
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;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue