coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
eeprom.h File Reference
#include <assert.h>
#include <soc/ramstage.h>
#include <types.h>
Include dependency graph for eeprom.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  eeprom_dimm_layout
 
struct  eeprom_dimm_layout::__packed
 
struct  eeprom_board_layout
 
struct  eeprom_board_settings
 
struct  eeprom_bmc_settings
 
struct  eeprom_layout
 

Macros

#define HERMES_SERIAL_NUMBER_LENGTH   32
 
#define READ_EEPROM(section_type, section_name, dest, opt_name)
 
#define READ_EEPROM_FSP_M(dest, opt_name)   READ_EEPROM(FSPM_UPD, RawFSPMUPD, dest, opt_name)
 
#define READ_EEPROM_FSP_S(dest, opt_name)   READ_EEPROM(FSPS_UPD, RawFSPSUPD, dest, opt_name)
 

Functions

 _Static_assert (sizeof(union eeprom_dimm_layout)==0x80, "union eeprom_dimm_layout has invalid size!")
 
 _Static_assert (sizeof(struct eeprom_board_layout)==(617+sizeof(uint32_t)), "struct eeprom_board_layout has invalid size!")
 
 _Static_assert (sizeof(struct eeprom_board_settings)==(11+sizeof(uint32_t)), "struct eeprom_board_settings has invalid size!")
 
 _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 eeprom_read_buffer (void *blob, size_t read_offset, size_t size)
 
int check_signature (const size_t offset, const uint64_t signature)
 
struct eeprom_board_settingsget_board_settings (void)
 
struct eeprom_bmc_settingsget_bmc_settings (void)
 
uint8_t get_bmc_hsi (void)
 
void report_eeprom_error (const size_t off)
 
bool write_board_settings (const struct eeprom_board_layout *new_layout)
 

Macro Definition Documentation

◆ HERMES_SERIAL_NUMBER_LENGTH

#define HERMES_SERIAL_NUMBER_LENGTH   32

Definition at line 70 of file eeprom.h.

◆ READ_EEPROM

#define READ_EEPROM (   section_type,
  section_name,
  dest,
  opt_name 
)
Value:
do { \
typeof(dest->opt_name) __tmp; \
size_t __off = offsetof(struct eeprom_layout, section_name); \
bool ret = eeprom_read_buffer(&__tmp, \
__off + offsetof(section_type, opt_name), \
sizeof(__tmp)); \
if (ret) { \
report_eeprom_error(__off + offsetof(section_type, opt_name)); \
} else { \
dest->opt_name = __tmp; \
} \
} while (0)
#define offsetof(TYPE, MEMBER)
Definition: helpers.h:84
bool eeprom_read_buffer(void *blob, size_t read_offset, size_t size)
Definition: eeprom.c:103

Definition at line 111 of file eeprom.h.

◆ READ_EEPROM_FSP_M

#define READ_EEPROM_FSP_M (   dest,
  opt_name 
)    READ_EEPROM(FSPM_UPD, RawFSPMUPD, dest, opt_name)

Definition at line 125 of file eeprom.h.

◆ READ_EEPROM_FSP_S

#define READ_EEPROM_FSP_S (   dest,
  opt_name 
)    READ_EEPROM(FSPS_UPD, RawFSPSUPD, dest, opt_name)

Definition at line 126 of file eeprom.h.

Function Documentation

◆ _Static_assert() [1/6]

_Static_assert ( sizeof(FSPM_UPD)<=  0x600,
"FSPM_UPD too big"   
)

◆ _Static_assert() [2/6]

_Static_assert ( sizeof(FSPS_UPD)<=  0xc00,
"FSPS_UPD too big"   
)

◆ _Static_assert() [3/6]

_Static_assert ( sizeof(struct eeprom_board_layout = =(617+sizeof(uint32_t)),
"struct eeprom_board_layout has invalid size!"   
)

◆ _Static_assert() [4/6]

_Static_assert ( sizeof(struct eeprom_board_settings = =(11+sizeof(uint32_t)),
"struct eeprom_board_settings has invalid size!"   
)

◆ _Static_assert() [5/6]

_Static_assert ( sizeof(struct eeprom_layout = =0x2000,
"EEPROM layout size mismatch"   
)

◆ _Static_assert() [6/6]

_Static_assert ( sizeof(union eeprom_dimm_layout = =0x80,
"union eeprom_dimm_layout has invalid size!"   
)

◆ check_signature()

int check_signature ( const size_t  offset,
const uint64_t  signature 
)

Definition at line 20 of file eeprom.c.

References ARRAY_SIZE, BIOS_DEBUG, eeprom_read_buffer(), offset, and printk.

Referenced by mainboard_early(), mainboard_memory_init_params(), and mainboard_silicon_init_params().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ eeprom_read_buffer()

bool eeprom_read_buffer ( void blob,
size_t  read_offset,
size_t  size 
)

◆ get_bmc_hsi()

uint8_t get_bmc_hsi ( void  )

Definition at line 91 of file eeprom.c.

References BIOS_DEBUG, get_bmc_settings(), eeprom_bmc_settings::hsi, printk, and s.

Referenced by mainboard_azalia_program_runtime_verbs(), and smbios_mainboard_version().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_bmc_settings()

struct eeprom_bmc_settings* get_bmc_settings ( void  )

Definition at line 73 of file eeprom.c.

References BIOS_ERR, eeprom_read_buffer(), NULL, offsetof, and printk.

Referenced by get_bmc_hsi(), and mainboard_vbt_filename().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_board_settings()

struct eeprom_board_settings* get_board_settings ( void  )

Definition at line 59 of file eeprom.c.

References board_cfg, get_board_settings_from_eeprom(), and NULL.

Referenced by mainboard_early(), mainboard_final(), mainboard_init(), and mainboard_r0x_configure_alc888().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ report_eeprom_error()

void report_eeprom_error ( const size_t  off)

Definition at line 135 of file eeprom.c.

References BIOS_ERR, and printk.

◆ write_board_settings()

bool write_board_settings ( const struct eeprom_board_layout new_layout)

Definition at line 183 of file eeprom.c.

References assert, BIOS_DEBUG, BIOS_ERR, eeprom_read_buffer(), eeprom_write_byte(), offsetof, and printk.

Referenced by update_board_layout().

Here is the call graph for this function:
Here is the caller graph for this function: