Merge patch series "SMBIOS improvements"

Raymond Mao <raymond.mao@linaro.org> says:

Motivations for changes:
Current SMBIOS library and command-line tool is not fully matching with
the requirements:
1. Missing support for other mandatory types (#7, #9, #16, #17, #19).
2. Only a few platforms support SMBIOS node from the device tree.
3. Values of some fields are hardcoded in the library other than fetching
   from the device hardware.
4. Embedded data with dynamic length is not supported (E.g. Contained
   Object Handles in Type #2 and Contained Elements in Type #3)

Changes:
1. Refactor the SMBIOS library and command-line tool to better align with
   the SMBIOS spec.
2. Create an arch-specific driver for all aarch64-based platforms to fetch
   SMBIOS private data from the device hardware (processor and cache).
3. Create a sysinfo driver to poppulate platform SMBIOS private data.
4. Add generic SMBIOS DTS file for arm64 platforms for those common strings
   and values which cannot be retrieved from the system registers.
   Vendors can create their own SMBIOS node using this as an example.
   For those boards without SMBIOS nodes, this DTS file can be included to
   have a generic SMBIOS information of the system.
5. Add support for Type #7 (Cache Information) and link its handles to
   Type #4.
6. To minimize size-growth for those platforms which have not sufficient
   ROM spaces or the platforms which don't need detailed SMBIOS
   information, new added fields are only being built when kconfig
   GENERATE_SMBIOS_TABLE_VERBOSE is selected.

Once this patch is acceptted, subsequent patch sets will add other missing
types (#9, #16, #17, #19).

Tests:
To test this with QEMU arm64, please follow the guide on dt_qemu.rst to
get a merged DT to run with.
```
qemu-system-aarch64 -machine virt -machine dumpdtb=qemu.dtb
cat  <(dtc -I dtb qemu.dtb) <(dtc -I dtb ./dts/dt.dtb | grep -v /dts-v1/) \
  | dtc - -o merged.dtb
qemu-system-aarch64 -machine virt -nographic -bios u-boot.bin \
  -dtb merged.dtb
```

Link: https://lore.kernel.org/r/20241206225438.13866-1-raymond.mao@linaro.org
This commit is contained in:
Tom Rini
2025-01-14 14:29:49 -06:00
19 changed files with 1861 additions and 167 deletions

View File

@@ -19,6 +19,9 @@ static int dm_test_sysinfo(struct unit_test_state *uts)
bool called_detect = false;
char str[64];
int i;
void *data = NULL;
size_t data_size = 0;
u32 gdata[] = {0xabcdabcd, 0xdeadbeef};
ut_assertok(sysinfo_get(&sysinfo));
ut_assert(sysinfo);
@@ -57,6 +60,9 @@ static int dm_test_sysinfo(struct unit_test_state *uts)
str));
ut_assertok(strcmp(str, "Yuggoth"));
ut_assertok(sysinfo_get_data(sysinfo, DATA_TEST, &data, &data_size));
ut_assertok(memcmp(gdata, data, data_size));
return 0;
}
DM_TEST(dm_test_sysinfo, UTF_SCAN_PDATA | UTF_SCAN_FDT);

View File

@@ -32,10 +32,26 @@ def test_cmd_smbios_sandbox(u_boot_console):
"""Run the smbios command on the sandbox"""
output = u_boot_console.run_command('smbios')
assert 'DMI type 0,' in output
assert 'String 1: U-Boot' in output
assert 'Vendor: U-Boot' in output
assert 'DMI type 1,' in output
assert 'Manufacturer: sandbox' in output
assert 'DMI type 2,' in output
assert 'DMI type 3,' in output
assert 'DMI type 4,' in output
assert 'DMI type 127,' in output
@pytest.mark.buildconfigspec('cmd_smbios')
@pytest.mark.buildconfigspec('sysinfo_smbios')
@pytest.mark.buildconfigspec('generate_smbios_table_verbose')
def test_cmd_smbios_sysinfo_verbose(u_boot_console):
"""Run the smbios command"""
output = u_boot_console.run_command('smbios')
assert 'DMI type 0,' in output
assert 'Vendor: U-Boot' in output
assert 'DMI type 1,' in output
assert 'Manufacturer: linux' in output
assert 'DMI type 2,' in output
assert 'DMI type 3,' in output
assert 'DMI type 7,' in output
assert 'DMI type 4,' in output
assert 'DMI type 127,' in output