Skip to contentSkip to conversation

efi: dmi: List SMBIOS3 table before SMBIOS table

PATCH Superseded Jean Delvare 2 participants 3 messages Apr 28, 2015 – Apr 30, 2015 2 messages not in the archive EFI

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

Cc Ard Biesheuvel <[email protected]>
Cc Leif Lindholm <[email protected]>
Cc Matt Fleming <[email protected]>
---
 drivers/firmware/efi/efi.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/firmware/efi/efi.c +2 -2
@@ -85,10 +85,10 @@ static ssize_t systab_show(struct kobjec
 		str += sprintf(str, "ACPI20=0x%lx\n", efi.acpi20);
 	if (efi.acpi != EFI_INVALID_TABLE_ADDR)
 		str += sprintf(str, "ACPI=0x%lx\n", efi.acpi);
-	if (efi.smbios != EFI_INVALID_TABLE_ADDR)
-		str += sprintf(str, "SMBIOS=0x%lx\n", efi.smbios);
 	if (efi.smbios3 != EFI_INVALID_TABLE_ADDR)
 		str += sprintf(str, "SMBIOS3=0x%lx\n", efi.smbios3);
+	if (efi.smbios != EFI_INVALID_TABLE_ADDR)
+		str += sprintf(str, "SMBIOS=0x%lx\n", efi.smbios);
 	if (efi.hcdp != EFI_INVALID_TABLE_ADDR)
 		str += sprintf(str, "HCDP=0x%lx\n", efi.hcdp);
 	if (efi.boot_info != EFI_INVALID_TABLE_ADDR)
Signature · 2 lines
Jean Delvare
SUSE L3 Support
#2 lore raw
In reply to a message not in the archive
Quoted 8 lines · Jean Delvare

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.

Now we need to ask the reverse question: Do any userspace utils use the last SMBIOS table entry as the preferred one? I suspect not because SMBIOS3 is so new but we need to highlight the risk of breaking functionality since this file forms an ABI.

Anyone aware of such a tool?

Also Jean, this patch could do with a new comment describing the importance of the table entry order so we don't break it in the future.

Quoted 32 lines
Cc Ard Biesheuvel <[email protected]>
Cc Leif Lindholm <[email protected]>
Cc Matt Fleming <[email protected]>
---
 drivers/firmware/efi/efi.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/firmware/efi/efi.c +2 -2
@@ -85,10 +85,10 @@ static ssize_t systab_show(struct kobjec
 		str += sprintf(str, "ACPI20=0x%lx\n", efi.acpi20);
 	if (efi.acpi != EFI_INVALID_TABLE_ADDR)
 		str += sprintf(str, "ACPI=0x%lx\n", efi.acpi);
-	if (efi.smbios != EFI_INVALID_TABLE_ADDR)
-		str += sprintf(str, "SMBIOS=0x%lx\n", efi.smbios);
 	if (efi.smbios3 != EFI_INVALID_TABLE_ADDR)
 		str += sprintf(str, "SMBIOS3=0x%lx\n", efi.smbios3);
+	if (efi.smbios != EFI_INVALID_TABLE_ADDR)
+		str += sprintf(str, "SMBIOS=0x%lx\n", efi.smbios);
 	if (efi.hcdp != EFI_INVALID_TABLE_ADDR)
 		str += sprintf(str, "HCDP=0x%lx\n", efi.hcdp);
 	if (efi.boot_info != EFI_INVALID_TABLE_ADDR)
Signature · 7 lines
-- 
Jean Delvare
SUSE L3 Support
--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
#4 lore raw
In reply to a message not in the archive

Hi Matt,

Quoted 7 lines · Matt Fleming
Quoted 6 lines · Jean Delvare

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.

Quoted 7 lines
Quoted 2 lines

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

Now we need to ask the reverse question: Do any userspace utils use the last SMBIOS table entry as the preferred one? I suspect not because SMBIOS3 is so new but we need to highlight the risk of breaking functionality since this file forms an ABI.

I'd be surprised. Either you stop parsing after the first match, or you parse the whole file and pick what you prefer. Parsing the whole file and then arbitrarily choosing the last match wouldn't make much sense.

Quoted 1 line

Anyone aware of such a tool?

I am not, but then again the only tool I am familiar with which parses this file is dmidecode. Developers more familiar with EFI-based systems will know better.

Quoted 2 lines

Also Jean, this patch could do with a new comment describing the importance of the table entry order so we don't break it in the future.

Good idea, thanks for the suggestion. Version 2 of the patch is coming.

Quoted 24 lines
Quoted 24 lines
Cc Ard Biesheuvel <[email protected]>
Cc Leif Lindholm <[email protected]>
Cc Matt Fleming <[email protected]>
---
 drivers/firmware/efi/efi.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/firmware/efi/efi.c +2 -2
@@ -85,10 +85,10 @@ static ssize_t systab_show(struct kobjec
 		str += sprintf(str, "ACPI20=0x%lx\n", efi.acpi20);
 	if (efi.acpi != EFI_INVALID_TABLE_ADDR)
 		str += sprintf(str, "ACPI=0x%lx\n", efi.acpi);
-	if (efi.smbios != EFI_INVALID_TABLE_ADDR)
-		str += sprintf(str, "SMBIOS=0x%lx\n", efi.smbios);
 	if (efi.smbios3 != EFI_INVALID_TABLE_ADDR)
 		str += sprintf(str, "SMBIOS3=0x%lx\n", efi.smbios3);
+	if (efi.smbios != EFI_INVALID_TABLE_ADDR)
+		str += sprintf(str, "SMBIOS=0x%lx\n", efi.smbios);
 	if (efi.hcdp != EFI_INVALID_TABLE_ADDR)
 		str += sprintf(str, "HCDP=0x%lx\n", efi.hcdp);
 	if (efi.boot_info != EFI_INVALID_TABLE_ADDR)
Signature · 2 lines
Jean Delvare
SUSE L3 Support