From f1e8535794f48148fe93f60bcb2276b6b0e5140e Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Mon, 3 May 2021 14:01:56 +0200 Subject: [PATCH] mb/prodrive/hermes: Simplify `read_write_config` signature The `write_offset` parameter is always zero. Remove it. Change-Id: Ib63cb25904ad6c1c7424a9c01d8bf1e84c08453b Signed-off-by: Angel Pons Reviewed-on: https://review.coreboot.org/c/coreboot/+/52884 Reviewed-by: Arthur Heymans Tested-by: build bot (Jenkins) --- src/mainboard/prodrive/hermes/eeprom.c | 12 ++++++------ .../hermes/variants/baseboard/include/eeprom.h | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/mainboard/prodrive/hermes/eeprom.c b/src/mainboard/prodrive/hermes/eeprom.c index a712156bc1..614f069c56 100644 --- a/src/mainboard/prodrive/hermes/eeprom.c +++ b/src/mainboard/prodrive/hermes/eeprom.c @@ -21,7 +21,7 @@ int check_signature(const size_t offset, const uint64_t signature) { u8 blob[8] = {0}; - if (!read_write_config(blob, offset, 0, ARRAY_SIZE(blob))) { + if (!read_write_config(blob, offset, ARRAY_SIZE(blob))) { /* Check signature */ if (*(uint64_t *)blob == signature) { printk(BIOS_DEBUG, "CFG EEPROM: Signature valid.\n"); @@ -41,7 +41,7 @@ static bool get_board_settings_from_eeprom(struct eeprom_board_settings *board_c { const size_t board_settings_offset = offsetof(struct eeprom_layout, BoardSettings); - if (read_write_config(board_cfg, board_settings_offset, 0, sizeof(*board_cfg))) { + if (read_write_config(board_cfg, board_settings_offset, sizeof(*board_cfg))) { printk(BIOS_ERR, "CFG EEPROM: Failed to read board settings\n"); return false; } @@ -79,7 +79,7 @@ struct eeprom_bmc_settings *get_bmc_settings(void) static int valid = 0; if (valid == 0) { - if (read_write_config(&bmc_cfg, bmc_settings_offset, 0, sizeof(bmc_cfg))) { + if (read_write_config(&bmc_cfg, bmc_settings_offset, sizeof(bmc_cfg))) { printk(BIOS_ERR, "CFG EEPROM: Failed to read BMC settings\n"); return NULL; } @@ -100,7 +100,7 @@ uint8_t get_bmc_hsi(void) } /* 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) +bool read_write_config(void *blob, size_t read_offset, size_t size) { int ret = 0; @@ -120,7 +120,7 @@ bool read_write_config(void *blob, size_t read_offset, size_t write_offset, size break; /* Write to UPD */ - uint8_t *writePointer = (uint8_t *)blob + write_offset + i; + uint8_t *writePointer = (uint8_t *)blob + i; writePointer[0] = tmp[0]; if (size - i > 1) writePointer[1] = tmp[1]; @@ -188,7 +188,7 @@ bool write_board_settings(const struct eeprom_board_layout *new_layout) bool changed = false; /* Read old settings */ - if (read_write_config(&old_layout, off, 0, sizeof(old_layout))) { + if (read_write_config(&old_layout, off, sizeof(old_layout))) { printk(BIOS_ERR, "CFG EEPROM: Read operation failed\n"); return true; } diff --git a/src/mainboard/prodrive/hermes/variants/baseboard/include/eeprom.h b/src/mainboard/prodrive/hermes/variants/baseboard/include/eeprom.h index 58ecb0880a..3a282195ab 100644 --- a/src/mainboard/prodrive/hermes/variants/baseboard/include/eeprom.h +++ b/src/mainboard/prodrive/hermes/variants/baseboard/include/eeprom.h @@ -91,7 +91,7 @@ _Static_assert(sizeof(FSPM_UPD) <= 0x600, "FSPM_UPD too big"); _Static_assert(sizeof(FSPS_UPD) <= 0xC00, "FSPS_UPD too big"); _Static_assert(sizeof(struct eeprom_layout) == 0x2000, "EEPROM layout size mismatch"); -bool read_write_config(void *blob, size_t read_offset, size_t write_offset, size_t size); +bool read_write_config(void *blob, size_t read_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); @@ -105,7 +105,6 @@ bool write_board_settings(const struct eeprom_board_layout *new_layout); size_t __off = offsetof(struct eeprom_layout, section_name); \ bool ret = read_write_config(&__tmp, \ __off + offsetof(section_type, opt_name), \ - 0, \ sizeof(__tmp)); \ if (ret) { \ report_eeprom_error(__off + offsetof(section_type, opt_name)); \