arch/x86/smbios: Update SMBIOS type 16 Extended Maximum Capacity

Update Extended Maximum Capacity field in SMBIOS type 16 so that
maximum dimm size can be over 2TB.

Tested=Execute "dmidecode -t 16" to check maximum capacity is over 2TB.

Signed-off-by: Tim Chu <Tim.Chu@quantatw.com>
Change-Id: I61901c815f9d0daae102e5077a116c0de87240ef
Reviewed-on: https://review.coreboot.org/c/coreboot/+/49828
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
This commit is contained in:
Tim Chu 2021-01-22 01:10:45 -08:00 committed by Patrick Georgi
parent 7435e254d4
commit 1ee8ddc484
2 changed files with 10 additions and 1 deletions

View File

@ -1028,6 +1028,7 @@ static int smbios_write_type16(unsigned long *current, int *handle)
int len; int len;
int i; int i;
uint64_t max_capacity;
struct memory_info *meminfo; struct memory_info *meminfo;
meminfo = cbmem_find(CBMEM_ID_MEMINFO); meminfo = cbmem_find(CBMEM_ID_MEMINFO);
@ -1057,7 +1058,13 @@ static int smbios_write_type16(unsigned long *current, int *handle)
/* no error information handle available */ /* no error information handle available */
t->memory_error_information_handle = 0xFFFE; t->memory_error_information_handle = 0xFFFE;
t->maximum_capacity = meminfo->max_capacity_mib * (MiB / KiB); max_capacity = meminfo->max_capacity_mib;
if (max_capacity * (MiB / KiB) < SMBIOS_USE_EXTENDED_MAX_CAPACITY)
t->maximum_capacity = max_capacity * (MiB / KiB);
else {
t->maximum_capacity = SMBIOS_USE_EXTENDED_MAX_CAPACITY;
t->extended_maximum_capacity = max_capacity * MiB;
}
t->number_of_memory_devices = meminfo->number_of_devices; t->number_of_memory_devices = meminfo->number_of_devices;
len += smbios_string_table_len(t->eos); len += smbios_string_table_len(t->eos);

View File

@ -829,6 +829,8 @@ enum {
SMBIOS_EVENTLOG_STATUS_FULL = 2, /* Bit 1 */ SMBIOS_EVENTLOG_STATUS_FULL = 2, /* Bit 1 */
}; };
#define SMBIOS_USE_EXTENDED_MAX_CAPACITY (1 << 31)
struct smbios_type16 { struct smbios_type16 {
u8 type; u8 type;
u8 length; u8 length;