summaryrefslogtreecommitdiff
path: root/src/mainboard
diff options
context:
space:
mode:
authorPatrick Rudolph <patrick.rudolph@9elements.com>2021-02-15 16:35:24 +0100
committerPatrick Georgi <pgeorgi@google.com>2021-02-19 08:37:49 +0000
commitb67f385b69f394cf235693db50c98db760411320 (patch)
tree43339234df989099f477957cd2e35b47492e9435 /src/mainboard
parent2091965973f49e465b0f7f0dc3cafc676f7a1ee1 (diff)
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 <patrick.rudolph@9elements.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/50787 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/mainboard')
-rw-r--r--src/mainboard/prodrive/hermes/eeprom.c19
-rw-r--r--src/mainboard/prodrive/hermes/variants/baseboard/include/eeprom.h12
2 files changed, 30 insertions, 1 deletions
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);