From b67f385b69f394cf235693db50c98db760411320 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Mon, 15 Feb 2021 16:35:24 +0100 Subject: mb/prodrive/eeprom: Add BMC settings Add settings describing the BMC. Will be used by the following patch to read the board revision. Change-Id: If464138fc1bdf02a45a21f638b179048d68d974d Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/50787 Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- src/mainboard/prodrive/hermes/eeprom.c | 19 +++++++++++++++++++ .../hermes/variants/baseboard/include/eeprom.h | 12 +++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/mainboard/prodrive/hermes/eeprom.c b/src/mainboard/prodrive/hermes/eeprom.c index 58099d3aa8..9bdec4a79b 100644 --- a/src/mainboard/prodrive/hermes/eeprom.c +++ b/src/mainboard/prodrive/hermes/eeprom.c @@ -70,6 +70,25 @@ struct eeprom_board_settings *get_board_settings(void) return checked_valid > 0 ? &board_cfg : NULL; } +struct eeprom_bmc_settings *get_bmc_settings(void) +{ + const size_t bmc_settings_offset = offsetof(struct eeprom_layout, BMCSettings); + static struct eeprom_bmc_settings bmc_cfg = {0}; + + /* 0: uninitialized, 1: settings are valid */ + static int valid = 0; + + if (valid == 0) { + if (read_write_config(&bmc_cfg, bmc_settings_offset, 0, sizeof(bmc_cfg))) { + printk(BIOS_ERR, "CFG EEPROM: Failed to read BMC settings\n"); + return NULL; + } + valid = 1; + } + return &bmc_cfg; +} + + /* Read data from offset and write it to offset in UPD */ bool read_write_config(void *blob, size_t read_offset, size_t write_offset, size_t size) { diff --git a/src/mainboard/prodrive/hermes/variants/baseboard/include/eeprom.h b/src/mainboard/prodrive/hermes/variants/baseboard/include/eeprom.h index 56539751f3..9b14d9c39f 100644 --- a/src/mainboard/prodrive/hermes/variants/baseboard/include/eeprom.h +++ b/src/mainboard/prodrive/hermes/variants/baseboard/include/eeprom.h @@ -48,6 +48,11 @@ __packed struct eeprom_board_settings { }; }; +__packed struct eeprom_bmc_settings { + uint8_t pcie_mux; + uint8_t hsi; +}; + /* The EEPROM on address 0x57 has the following vendor defined layout: */ __packed struct eeprom_layout { union { @@ -64,9 +69,13 @@ __packed struct eeprom_layout { }; uint8_t BootOrder[0x900]; union { - uint8_t RawBoardSetting[0x100]; + uint8_t RawBoardSetting[0xF8]; struct eeprom_board_settings BoardSettings; }; + union { + uint8_t RawBMCSetting[0x8]; + struct eeprom_bmc_settings BMCSettings; + }; }; _Static_assert(sizeof(FSPM_UPD) <= 0x600, "FSPM_UPD too big"); @@ -76,6 +85,7 @@ _Static_assert(sizeof(struct eeprom_layout) == 0x2000, "EEPROM layout size misma bool read_write_config(void *blob, size_t read_offset, size_t write_offset, size_t size); int check_signature(const size_t offset, const uint64_t signature); struct eeprom_board_settings *get_board_settings(void); +struct eeprom_bmc_settings *get_bmc_settings(void); void report_eeprom_error(const size_t off); bool write_board_settings(const struct eeprom_board_layout *new_layout); -- cgit v1.2.3