diff options
author | Angel Pons <th3fanbus@gmail.com> | 2020-12-21 19:46:03 +0100 |
---|---|---|
committer | Angel Pons <th3fanbus@gmail.com> | 2021-02-16 09:43:32 +0000 |
commit | 20eb3506ca3d29ef59de81fb0070628582682751 (patch) | |
tree | 205e5f3ffdd91be1663a7b804c06288812c3ea5e /src/mainboard/prodrive/hermes/eeprom.c | |
parent | f5502310e2ad02f4a7c3b98faa3a9a2dadf0525e (diff) |
mb/prodrive/hermes: Improve board config EEPROM handling
* Check and print errors returned from reading from I2C
* Rework offset calculation by using more macros
* Get rid of stage-specific preprocessor code
* Define the EEPROM layout as struct
* Make use of the defined EEPROM layout to calculate offsets
* Read the UPD to disable VT-d from EEPROM
Change-Id: Iad77811318c7dfd3a3a4f8d523cfa0f457f168b6
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/48808
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/mainboard/prodrive/hermes/eeprom.c')
-rw-r--r-- | src/mainboard/prodrive/hermes/eeprom.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mainboard/prodrive/hermes/eeprom.c b/src/mainboard/prodrive/hermes/eeprom.c index bff834036a..8db63f8fe4 100644 --- a/src/mainboard/prodrive/hermes/eeprom.c +++ b/src/mainboard/prodrive/hermes/eeprom.c @@ -11,8 +11,6 @@ #define I2C_ADDR_EEPROM 0x57 -#define EEPROM_OFFSET_BOARD_SETTINGS 0x1f00 - /* * Check Signature in EEPROM (M24C32-FMN6TP) * If signature is there we assume that that the content is valid @@ -39,7 +37,9 @@ int check_signature(const size_t offset, const uint64_t signature) */ static bool get_board_settings_from_eeprom(struct eeprom_board_settings *board_cfg) { - if (read_write_config(board_cfg, EEPROM_OFFSET_BOARD_SETTINGS, 0, sizeof(*board_cfg))) { + const size_t board_settings_offset = offsetof(struct eeprom_layout, BoardSettings); + + if (read_write_config(board_cfg, board_settings_offset, 0, sizeof(*board_cfg))) { printk(BIOS_ERR, "CFG EEPROM: Failed to read board settings\n"); return false; } @@ -101,3 +101,8 @@ bool read_write_config(void *blob, size_t read_offset, size_t write_offset, size return ret; } + +void report_eeprom_error(const size_t off) +{ + printk(BIOS_ERR, "MB: Failed to read from EEPROM at addr. 0x%zx\n", off); +} |