14 #define I2C_ADDR_EEPROM 0x57
26 if (*(
uint64_t *)blob == signature) {
30 printk(
BIOS_DEBUG,
"CFG EEPROM: Signature invalid - skipping option write.\n");
53 printk(
BIOS_ERR,
"CFG EEPROM: Board settings have invalid checksum\n");
64 static int checked_valid = 0;
66 if (checked_valid == 0) {
68 checked_valid = success ? 1 : -1;
114 for (
size_t i = 0; i < size; i = i + 2) {
124 writePointer[0] = tmp[0];
126 writePointer[1] = tmp[1];
137 printk(
BIOS_ERR,
"MB: Failed to read from EEPROM at addr. 0x%zx\n", off);
148 printk(
BIOS_SPEW,
"CFG EEPROM: Writing %x at %x\n", data, write_offset);
165 (write_offset >> 8) & 0xff,
167 if (ret ==
sizeof(
buffer))
176 return ret !=
sizeof(
buffer);
188 bool changed =
false;
196 assert(
sizeof(old_layout) ==
sizeof(*new_layout));
201 for (
size_t i = 0; i <
sizeof(old_layout); i++) {
202 if (old[i] !=
new[i]) {
212 printk(
BIOS_DEBUG,
"CFG EEPROM: Board Layout up%s\n", changed ?
"dated" :
" to date");
#define assert(statement)
#define offsetof(TYPE, MEMBER)
#define retry(attempts, condition,...)
#define printk(level,...)
#define CRC(buf, size, crc_func)
uint32_t crc32_byte(uint32_t prev_crc, uint8_t data)
void mdelay(unsigned int msecs)
bool write_board_settings(const struct eeprom_board_layout *new_layout)
void report_eeprom_error(const size_t off)
struct eeprom_bmc_settings * get_bmc_settings(void)
uint8_t get_bmc_hsi(void)
static bool eeprom_write_byte(const uint8_t data, const uint16_t write_offset)
static bool get_board_settings_from_eeprom(struct eeprom_board_settings *board_cfg)
struct eeprom_board_settings * get_board_settings(void)
bool eeprom_read_buffer(void *blob, size_t read_offset, size_t size)
int check_signature(const size_t offset, const uint64_t signature)
static __always_inline void pci_write_config32(const struct device *dev, u16 reg, u32 val)
static __always_inline u32 pci_read_config32(const struct device *dev, u16 reg)
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
#define BIOS_SPEW
BIOS_SPEW - Excessively verbose output.
static const struct mb_cfg board_cfg
u8 buffer[C2P_BUFFER_MAXSIZE]
int do_smbus_process_call(uintptr_t base, u8 device, u8 cmd, u16 data, u16 *buf)
int do_smbus_block_write(uintptr_t base, u8 device, u8 cmd, size_t bytes, const u8 *buf)
unsigned long long uint64_t
#define s(param, src_bits, pmcreg, dst_bits)