Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

efi: dmi: List SMBIOS3 table before SMBIOS table

The SMBIOS3 table should appear before the SMBIOS table in
/sys/firmware/efi/systab. This allows user-space utilities which
support both to pick the SMBIOS3 table with a single pass on systems
where both are implemented. The SMBIOS3 entry point is more capable
than the SMBIOS entry point so it should be preferred.

This follows the same logic as the ACPI20 table being listed before
the ACPI table.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>

authored by

Jean Delvare and committed by
Matt Fleming
b119fe08 f2f6b587

+7 -2
+7 -2
drivers/firmware/efi/efi.c
··· 86 86 str += sprintf(str, "ACPI20=0x%lx\n", efi.acpi20); 87 87 if (efi.acpi != EFI_INVALID_TABLE_ADDR) 88 88 str += sprintf(str, "ACPI=0x%lx\n", efi.acpi); 89 - if (efi.smbios != EFI_INVALID_TABLE_ADDR) 90 - str += sprintf(str, "SMBIOS=0x%lx\n", efi.smbios); 89 + /* 90 + * If both SMBIOS and SMBIOS3 entry points are implemented, the 91 + * SMBIOS3 entry point shall be preferred, so we list it first to 92 + * let applications stop parsing after the first match. 93 + */ 91 94 if (efi.smbios3 != EFI_INVALID_TABLE_ADDR) 92 95 str += sprintf(str, "SMBIOS3=0x%lx\n", efi.smbios3); 96 + if (efi.smbios != EFI_INVALID_TABLE_ADDR) 97 + str += sprintf(str, "SMBIOS=0x%lx\n", efi.smbios); 93 98 if (efi.hcdp != EFI_INVALID_TABLE_ADDR) 94 99 str += sprintf(str, "HCDP=0x%lx\n", efi.hcdp); 95 100 if (efi.boot_info != EFI_INVALID_TABLE_ADDR)