49 dmi17->MemoryType, dmi17->ConfigSpeed);
62 dimm->
mod_id = dmi17->ManufacturerIdCode;
76 " ddr_frequency: %hu\n"
77 " rank_per_dimm: %hhu\n"
78 " channel_num: %hhu\n"
80 " bank_locator: %hhu\n"
84 " serial: %02hhx%02hhx%02hhx%02hhx\n"
85 " module_part_number(%zu): %s\n",
107 "AGESA TYPE 17 DMI INFO:\n"
114 " ManufacturerIdCode: %llx\n"
115 " Attributes: %hhu\n"
117 " ConfigSpeed: %hu\n"
118 " MemoryType: 0x%x\n"
119 " FormFactor: 0x%x\n"
120 " DeviceLocator: %8s\n"
121 " BankLocator: %10s\n"
122 " SerialNumber(%zu): %9s\n"
123 " PartNumber(%zu): %19s\n",
130 dmi17->ManufacturerIdCode,
136 dmi17->DeviceLocator,
138 strlen((
const char *)dmi17->SerialNumber),
140 strlen((
const char *)dmi17->PartNumber),
149 const DMI_INFO *dmi_table;
150 const TYPE17_DMI_INFO *type17_dmi_info;
154 bool use_cbi_part_number =
false;
156 size_t amd_fsp_dmi_hob_size;
157 const EFI_GUID amd_fsp_dmi_hob_guid = AMD_FSP_DMI_HOB_GUID;
165 "Failed to add memory info to CBMEM, DMI tables will be incomplete\n");
172 (
const uint8_t *)&amd_fsp_dmi_hob_guid, &amd_fsp_dmi_hob_size);
174 if (dmi_table ==
NULL || amd_fsp_dmi_hob_size == 0) {
176 "AMD_FSP_DMI_HOB not found, DMI table 17 will be incomplete\n");
181 if (
CONFIG(EC_GOOGLE_CHROMEEC)) {
184 cbi_part_number,
sizeof(cbi_part_number)) == 0) {
185 use_cbi_part_number =
true;
191 for (
unsigned int channel = 0; channel < MAX_CHANNELS_PER_SOCKET; channel++) {
192 for (
unsigned int dimm = 0; dimm < MAX_DIMMS_PER_CHANNEL; dimm++) {
193 type17_dmi_info = &dmi_table->T17[0][channel][dimm];
196 if (type17_dmi_info->Handle == 0)
203 if (use_cbi_part_number) {
void * memset(void *dstpp, int c, size_t len)
void * cbmem_add(u32 id, u64 size)
#define printk(level,...)
uint16_t ddr4_speed_mhz_to_reported_mts(uint16_t speed_mhz)
Converts DDR4 clock speed in MHz to the standard reported speed in MT/s.
Utilities for decoding DDR4 SPDs.
uint8_t smbios_form_factor_to_spd_mod_type(smbios_memory_type memory_type, smbios_memory_form_factor form_factor)
Convert the SMBIOS form factor to the SPD module type.
uint32_t smbios_memory_size_to_mib(uint16_t memory_size, uint32_t extended_size)
Convert the SMBIOS size values into the total number of MiB.
uint8_t smbios_bus_width_to_spd_width(uint8_t ddr_type, uint16_t total_width, uint16_t data_width)
Convert the SMBIOS bit widths into an SPD encoded width.
static void prepare_dmi_17(void *unused)
Marshalls dimm info from AMD_FSP_DMI_HOB into CBMEM_ID_MEMINFO.
static uint16_t ddr_speed_mhz_to_reported_mts(uint16_t ddr_type, uint16_t speed)
This code was adapted from src/soc/amd/common/block/pi/amd_late_init.c.
static void print_dmi_info(const TYPE17_DMI_INFO *dmi17)
static void print_dimm_info(const struct dimm_info *dimm)
BOOT_STATE_INIT_ENTRY(BS_WRITE_TABLES, BS_ON_ENTRY, prepare_dmi_17, NULL)
static void transfer_memory_info(const TYPE17_DMI_INFO *dmi17, struct dimm_info *dimm)
Populate dimm_info using AGESA TYPE17_DMI_INFO.
int google_chromeec_cbi_get_dram_part_num(char *buf, size_t bufsize)
const void * fsp_find_extension_hob_by_guid(const uint8_t *guid, size_t *size)
smbios_memory_form_factor
size_t hexstrtobin(const char *str, uint8_t *buf, size_t len)
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
uint16_t lpddr4_speed_mhz_to_reported_mts(uint16_t speed_mhz)
Converts LPDDR4 clock speed in MHz to the standard reported speed in MT/s.
Utilities for decoding LPDDR4 info.
#define DIMM_INFO_PART_NUMBER_SIZE
struct dimm_info_st dimm_info
char * strncpy(char *to, const char *from, int count)
size_t strlen(const char *src)
If this table is filled and put in CBMEM, then these info in CBMEM will be used to generate smbios ty...
uint16_t configured_speed_mts
uint8_t module_part_number[DIMM_INFO_PART_NUMBER_SIZE]
uint8_t serial[DIMM_INFO_SERIAL_SIZE]
struct dimm_info dimm[DIMM_INFO_TOTAL]