smbios: add support for dynamic generation of Type 19 table

This commit implements SMBIOS Type 19 (Memory Array Mapped Address)
generation with a hybrid approach supporting both:

1. Explicit definition via Device Tree 'smbios' node:
   Child node under '/smbios/smbios/memory-array-mapped-address' will be
   used to populate as individual Type 19 structure directly.
   - Properties follow SMBIOS field names with lowercase letters and
     hyphen-separated words (e.g., 'starting-address', 'ending-address',
     'partition-width', etc.).
   - This method supports precise platform-defined overrides and system
     descriptions.

2. Fallback to automatic DT-based discovery:
   If child node under '/smbios/smbios/memory-array-mapped-address' does
   not exist, the implementation will:
   - Scan all top-level 'memory@' nodes to populate Type 19 structure with
     inferred size and location data.
   - Scan nodes named or marked as 'memory-controller' and parse
     associated 'dimm@' subnodes (if present) to extract DIMM sizes and
     map them accordingly.

This dual-mode support enables flexible firmware SMBIOS reporting while
aligning with spec-compliant naming and runtime-detected memory topology.

Type 19 support is under GENERATE_SMBIOS_TABLE_VERBOSE to avoid
increasing rom size for those platforms which only require basic SMBIOS
support.

Signed-off-by: Raymond Mao <raymondmaoca@gmail.com>
Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
This commit is contained in:
Raymond Mao
2026-02-13 17:52:50 -05:00
committed by Tom Rini
parent 23674dee60
commit 41b7a09d24
5 changed files with 183 additions and 0 deletions

View File

@@ -680,6 +680,17 @@ static void smbios_print_type17(struct smbios_type17 *table)
printf("\tRCD Revision Number: 0x%04x\n", table->rcd_rev_num);
}
static void smbios_print_type19(struct smbios_type19 *table)
{
printf("Memory Array Mapped Address:\n");
printf("\tStarting Address: 0x%08x\n", table->start_addr);
printf("\tEnding Address: 0x%08x\n", table->end_addr);
printf("\tMemory Array Handle: 0x%04x\n", table->mem_array_hdl);
printf("\tPartition Width: 0x%04x\n", table->partition_wid);
printf("\tExtended Starting Address: 0x%016llx\n", table->ext_start_addr);
printf("\tExtended Ending Address: 0x%016llx\n", table->ext_end_addr);
}
static void smbios_print_type127(struct smbios_type127 *table)
{
printf("End Of Table\n");
@@ -768,6 +779,9 @@ static int do_smbios(struct cmd_tbl *cmdtp, int flag, int argc,
case SMBIOS_MEMORY_DEVICE:
smbios_print_type17((struct smbios_type17 *)pos);
break;
case SMBIOS_MEMORY_ARRAY_MAPPED_ADDRESS:
smbios_print_type19((struct smbios_type19 *)pos);
break;
case SMBIOS_END_OF_TABLE:
smbios_print_type127((struct smbios_type127 *)pos);
break;