Christian Walter | b646e28 | 2020-01-09 15:42:42 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 | |
| 3 | #include <soc/ramstage.h> |
| 4 | |
| 5 | #define HOSTC 0x40 |
| 6 | #define SMBUS_IO_BASE 0xefa0 |
| 7 | #define HOSTC_I2C_EN (1 << 2) |
| 8 | #define I2C_ADDR_EEPROM 0x57 |
| 9 | |
| 10 | #if ENV_ROMSTAGE |
| 11 | #define FSP_UPD_SIGNATURE FSPM_UPD_SIGNATURE |
| 12 | #define EEPROM_OFFSET_FSP_SIGNATURE 0 |
| 13 | #define EEPROM_OFFSET_FSP_CONFIG 0 |
| 14 | |
| 15 | #define GET_VALUE(x) {.offset = sizeof(FSP_UPD_HEADER) + sizeof(FSPM_ARCH_UPD) \ |
| 16 | + offsetof(FSP_M_CONFIG, x), .size = member_size(FSP_M_CONFIG, x)} |
| 17 | #else |
| 18 | |
| 19 | #define FSP_UPD_SIGNATURE FSPS_UPD_SIGNATURE |
| 20 | #define EEPROM_OFFSET_FSP_SIGNATURE 0x0600 |
| 21 | #define EEPROM_OFFSET_FSP_CONFIG (EEPROM_OFFSET_FSP_SIGNATURE + sizeof(FSP_UPD_HEADER)) |
| 22 | #define GET_VALUE(x) {.offset = offsetof(FSP_S_CONFIG, x), \ |
| 23 | .size = member_size(FSP_S_CONFIG, x)} |
Angel Pons | 329ebb3 | 2020-11-24 15:03:38 +0100 | [diff] [blame^] | 24 | #endif /* ENV_ROMSTAGE */ |
Christian Walter | b646e28 | 2020-01-09 15:42:42 +0100 | [diff] [blame] | 25 | |
| 26 | typedef struct { |
| 27 | size_t offset; |
| 28 | size_t size; |
| 29 | } fsp_params; |
| 30 | |
| 31 | bool read_write_config(u8 addr, void *blob, size_t read_offset, size_t write_offset, |
| 32 | size_t size); |
| 33 | int check_signature(u8 addr); |