arch/x86: Introduce DUMP_SMBIOS_TYPE17 config

DDR5 spd is not supported read by coreboot. But FSP can read it,
so print the memory information from smbios type17 dimm information.

TEST=check the coreboot log.
memory Channel-0-DIMM-0 type is DDR5
memory part number is MTC8C1084S1SC56BG1
memory max speed is 5600 MT/s
memory speed is 5200 MT/s
memory size is 16384 MiB

Signed-off-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Change-Id: I2b5ca1f4a59598531a6cba500672c2717f2a7b00
Reviewed-on: https://review.coreboot.org/c/coreboot/+/75756
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Eric Lai 2023-06-12 14:27:54 +08:00 committed by Felix Held
parent b26f0f924a
commit c1ef4f3356
2 changed files with 66 additions and 0 deletions

View File

@ -359,4 +359,8 @@ config ECFW_PTR_SIZE
help help
Size of reserved space for EC firmware pointer Size of reserved space for EC firmware pointer
config DUMP_SMBIOS_TYPE17
bool "Dump part of SMBIOS type17 dimm information."
depends on GENERATE_SMBIOS_TABLES
endif endif

View File

@ -219,6 +219,65 @@ static void smbios_fill_dimm_serial_number(const struct dimm_info *dimm,
t->serial_number = smbios_add_string(t->eos, serial); t->serial_number = smbios_add_string(t->eos, serial);
} }
static const char *memory_device_type(u8 code)
{
/* SMBIOS spec 3.6 7.18.2 */
static const char * const type[] = {
"Other",
"Unknown",
"DRAM",
"EDRAM",
"VRAM",
"SRAM",
"RAM",
"ROM",
"Flash",
"EEPROM",
"FEPROM",
"EPROM",
"CDRAM",
"3DRAM",
"SDRAM",
"SGRAM",
"RDRAM",
"DDR",
"DDR2",
"DDR2 FB-DIMM",
"Reserved",
"Reserved",
"Reserved",
"DDR3",
"FBD2",
"DDR4", /* 0x1A */
"LPDDR",
"LPDDR2",
"LPDDR3",
"LPDDR4",
"Logical non-volatile device",
"HBM",
"HBM2",
"DDR5",
"LPDDR5",
"HBM3", /* 0x24 */
};
if (code >= MEMORY_TYPE_OTHER && code <= MEMORY_TYPE_HBM3)
return type[code - 1];
return "Unsupproted";
}
static void dump_smbios_type17(struct dimm_info *dimm)
{
printk(BIOS_INFO, "memory at Channel-%d-DIMM-%d", dimm->channel_num, dimm->dimm_num);
printk(BIOS_INFO, " type is %s\n", memory_device_type(dimm->ddr_type));
printk(BIOS_INFO, "memory part number is %s\n", dimm->module_part_number);
if (dimm->max_speed_mts != 0)
printk(BIOS_INFO, "memory max speed is %d MT/s\n", dimm->max_speed_mts);
printk(BIOS_INFO, "memory speed is %d MT/s\n",
dimm->configured_speed_mts ? : dimm->ddr_frequency);
printk(BIOS_INFO, "memory size is %d MiB\n", dimm->dimm_size);
}
static int create_smbios_type17_for_dimm(struct dimm_info *dimm, static int create_smbios_type17_for_dimm(struct dimm_info *dimm,
unsigned long *current, int *handle, unsigned long *current, int *handle,
int type16_handle) int type16_handle)
@ -273,6 +332,9 @@ static int create_smbios_type17_for_dimm(struct dimm_info *dimm,
t->phys_memory_array_handle = type16_handle; t->phys_memory_array_handle = type16_handle;
*handle += 1; *handle += 1;
if (CONFIG(DUMP_SMBIOS_TYPE17))
dump_smbios_type17(dimm);
return smbios_full_table_len(&t->header, t->eos); return smbios_full_table_len(&t->header, t->eos);
} }