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>
This commit is contained in:
Patrick Rudolph 2021-02-15 16:35:24 +01:00 committed by Patrick Georgi
parent 2091965973
commit b67f385b69
2 changed files with 30 additions and 1 deletions

View File

@ -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)
{

View File

@ -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);