Skip to contentSkip to conversation

*** Support SMBIOS/DMI on arm32/64 ***

PATCH New Yi Li 3 participants 8 messages Nov 25, 2013 – Nov 27, 2013

Subsystems (4)
lore
Share & tools
lore

Yi Li

author
#0 lore raw

cover *** Support SMBIOS/DMI on arm32/64 ***

The patches support SMBIOS/DMI on arm system, it tested by dmidecode and lshw tools.

The first patch is wrapping remap/unmap methond for general archs, and has been posted for review to x86 and ia64, waiting the ack. The last two patches depend on booting from UEFI and SMBIOS data reported as Runtime Services Data type.

Ard Biesheuvel (1):
firmware/dmi_scan: generalize for use by other archs

Yi Li (2):
ARM64:DMI: Add smbios/dmi support on arm64
ARM32:DMI: Add smbios/dmi support on arm32

 arch/arm/Kconfig             |   13 +++++++++++++
 arch/arm/include/asm/dmi.h   |   28 ++++++++++++++++++++++++++++
 arch/arm/kernel/setup.c      |    2 ++
 arch/arm64/Kconfig           |   10 ++++++++++
 arch/arm64/include/asm/dmi.h |   28 ++++++++++++++++++++++++++++
 arch/arm64/kernel/setup.c    |    2 ++
 arch/ia64/include/asm/dmi.h  |   10 +++++++---
 arch/x86/include/asm/dmi.h   |    8 ++++++--
 drivers/firmware/dmi_scan.c  |   20 +++++++++++---------
 9 files changed, 107 insertions(+), 14 deletions(-)
 create mode 100644 arch/arm/include/asm/dmi.h
 create mode 100644 arch/arm64/include/asm/dmi.h
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/3 firmware/dmi_scan: generalize for use by other archs

From: Ard Biesheuvel <[email protected]>

This patch makes a couple of changes to the SMBIOS/DMI scanning code so it can be used on other archs (such as ARM and arm64):
(a) wrap the calls to ioremap()/iounmap(), this allows the use of a

    flavor of ioremap() more suitable for random unaligned access;
(b) allow the non-EFI fallback probe into hardcoded physical address
    0xF0000 to be disabled.

---

Based on original patch from Ard, a minor point is fixed in checkpatch.pl.

 arch/ia64/include/asm/dmi.h |   10 +++++++---
 arch/x86/include/asm/dmi.h  |    8 ++++++--
 drivers/firmware/dmi_scan.c |   20 +++++++++++---------
 3 files changed, 24 insertions(+), 14 deletions(-)
arch/ia64/include/asm/dmi.h +7 -3
index 185d3d1..f644b98 100644
@@ -5,8 +5,12 @@
 #include <asm/io.h>
 
 /* Use normal IO mappings for DMI */
-#define dmi_ioremap ioremap
-#define dmi_iounmap(x,l) iounmap(x)
-#define dmi_alloc(l) kzalloc(l, GFP_ATOMIC)
+#define dmi_early_remap		ioremap
+#define dmi_early_unmap(x, l)	iounmap(x)
+#define dmi_remap		ioremap
+#define dmi_unmap		iounmap
+#define dmi_alloc(l)		kzalloc(l, GFP_ATOMIC)
+
+#define DMI_SCAN_MACHINE_NON_EFI_FALLBACK	1
 
 #endif
arch/x86/include/asm/dmi.h +6 -2
index fd8f9e2..bb2b572 100644
@@ -13,7 +13,11 @@ static __always_inline __init void *dmi_alloc(unsigned len)
 }
 
 /* Use early IO mappings for DMI because it's initialized early */
-#define dmi_ioremap early_ioremap
-#define dmi_iounmap early_iounmap
+#define dmi_early_remap		early_ioremap
+#define dmi_early_unmap		early_iounmap
+#define dmi_remap		ioremap
+#define dmi_unmap		iounmap
+
+#define DMI_SCAN_MACHINE_NON_EFI_FALLBACK	1
 
 #endif /* _ASM_X86_DMI_H */
drivers/firmware/dmi_scan.c +11 -9
index fa0affb..2c7c793 100644
@@ -108,7 +108,7 @@ static int __init dmi_walk_early(void (*decode)(const struct dmi_header *,
 {
 	u8 *buf;
 
-	buf = dmi_ioremap(dmi_base, dmi_len);
+	buf = dmi_early_remap(dmi_base, dmi_len);
 	if (buf == NULL)
 		return -1;
 
@@ -116,7 +116,7 @@ static int __init dmi_walk_early(void (*decode)(const struct dmi_header *,
 
 	add_device_randomness(buf, dmi_len);
 
-	dmi_iounmap(buf, dmi_len);
+	dmi_early_unmap(buf, dmi_len);
 	return 0;
 }
 
@@ -483,18 +483,19 @@ void __init dmi_scan_machine(void)
 		 * needed during early boot.  This also means we can
 		 * iounmap the space when we're done with it.
 		 */
-		p = dmi_ioremap(efi.smbios, 32);
+		p = dmi_early_remap(efi.smbios, 32);
 		if (p == NULL)
 			goto error;
 		memcpy_fromio(buf, p, 32);
-		dmi_iounmap(p, 32);
+		dmi_early_unmap(p, 32);
 
 		if (!dmi_present(buf)) {
 			dmi_available = 1;
 			goto out;
 		}
 	} else {
-		p = dmi_ioremap(0xF0000, 0x10000);
+#ifdef DMI_SCAN_MACHINE_NON_EFI_FALLBACK
+		p = dmi_early_remap(0xF0000, 0x10000);
 		if (p == NULL)
 			goto error;
 
@@ -510,12 +511,13 @@ void __init dmi_scan_machine(void)
 			memcpy_fromio(buf + 16, q, 16);
 			if (!dmi_present(buf)) {
 				dmi_available = 1;
-				dmi_iounmap(p, 0x10000);
+				dmi_early_unmap(p, 0x10000);
 				goto out;
 			}
 			memcpy(buf, buf + 16, 16);
 		}
-		dmi_iounmap(p, 0x10000);
+		dmi_early_unmap(p, 0x10000);
+#endif
 	}
  error:
 	pr_info("DMI not present or invalid.\n");
@@ -787,13 +789,13 @@ int dmi_walk(void (*decode)(const struct dmi_header *, void *),
 	if (!dmi_available)
 		return -1;
 
-	buf = ioremap(dmi_base, dmi_len);
+	buf = dmi_remap(dmi_base, dmi_len);
 	if (buf == NULL)
 		return -1;
 
 	dmi_table(buf, dmi_len, dmi_num, decode, private_data);
 
-	iounmap(buf);
+	dmi_unmap(buf);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(dmi_walk);
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH 2/3 ARM64:DMI: Add smbios/dmi support on arm64

In reply to Yi Li

Add smbios/dmi support on arm64 system, it depends on EFI boot.

---

efi_lookup_mapped_addr() isn't able to translate the address range which is reported as reserved type from UEFI. Following the UEFI spec 2.4, it descripts the SMBIOS data should be runtime service type. So it depends on a UEFI patch to convert reserved type to runtime service type for SMBIOS and a linux dmi driver patch that has been posted for review to x86 and ia64.

 arch/arm64/Kconfig           |   10 ++++++++++
 arch/arm64/include/asm/dmi.h |   28 ++++++++++++++++++++++++++++
 arch/arm64/kernel/setup.c    |    2 ++
 3 files changed, 40 insertions(+)
 create mode 100644 arch/arm64/include/asm/dmi.h
arch/arm64/Kconfig +10 -0
index d5aaddf..84204b0 100644
@@ -292,6 +292,16 @@ config EFI_STUB
 	  by EFI firmware without the use of a bootloader.
 	  See Documentation/efi-stub.txt for more information.
 
+config DMI
+	bool "Enable support for SMBIOS (DMI) tables"
+	depends on EFI
+	default y
+	help
+	  This enables SMBIOS/DMI feature for systems.
+
+	  This option is only useful on systems that have UEFI firmware.
+	  However, even with this option, the resultant kernel should
+	  continue to boot on existing non-UEFI platforms.
 endmenu
 
 menu "Userspace binary formats"
arch/arm64/include/asm/dmi.h new file +28 -0
new file mode 100644
index 0000000..f6e6004
@@ -0,0 +1,28 @@
+/*
+ * arch/arm64/include/asm/dmi.h
+ *
+ * Copyright (C) 2013 Linaro Limited.
+ * Written by: Yi Li (yi.li at linaro.org)
+ *
+ * based on arch/ia64/include/asm/dmi.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+
+#ifndef _ASM_DMI_H
+#define _ASM_DMI_H 1
+
+#include <linux/slab.h>
+#include <asm/io.h>
+
+/* Use normal IO mappings for DMI */
+#define dmi_early_remap(x, l)	efi_lookup_mapped_addr(x)
+#define dmi_early_unmap(x, l)
+#define dmi_remap(x, l)			efi_lookup_mapped_addr(x)
+#define dmi_unmap(x)
+#define dmi_alloc(l)			kzalloc(l, GFP_ATOMIC)
+
+#endif
arch/arm64/kernel/setup.c +2 -0
index 1aeaaf5..1480843 100644
@@ -45,6 +45,7 @@
 #ifdef CONFIG_ACPI
 #include <linux/acpi.h>
 #endif
+#include <linux/dmi.h>
 
 #include <asm/fixmap.h>
 #include <asm/cputype.h>
@@ -312,6 +313,7 @@ static int __init arm64_device_init(void)
 {
 	of_clk_init(NULL);
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+	dmi_scan_machine();
 	return 0;
 }
 arch_initcall(arm64_device_init);
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 2/3 ARM64:DMI: Add smbios/dmi support on arm64

Quoted 29 lines · Yi Li

Add smbios/dmi support on arm64 system, it depends on EFI boot.

---

efi_lookup_mapped_addr() isn't able to translate the address range which is reported as reserved type from UEFI. Following the UEFI spec 2.4, it descripts the SMBIOS data should be runtime service type. So it depends on a UEFI patch to convert reserved type to runtime service type for SMBIOS and a linux dmi driver patch that has been posted for review to x86 and ia64.

 arch/arm64/Kconfig           |   10 ++++++++++
 arch/arm64/include/asm/dmi.h |   28 ++++++++++++++++++++++++++++
 arch/arm64/kernel/setup.c    |    2 ++
 3 files changed, 40 insertions(+)
 create mode 100644 arch/arm64/include/asm/dmi.h
arch/arm64/Kconfig +2 -0
index d5aaddf..84204b0 100644
@@ -292,6 +292,16 @@ config EFI_STUB
          by EFI firmware without the use of a bootloader.
          See Documentation/efi-stub.txt for more information.
 
+config DMI
+       bool "Enable support for SMBIOS (DMI) tables"

arch/arm64/Kconfig config EFI_STUB · line 306

Quoted 10 lines
arch/arm64/Kconfig +8 -0
+       depends on EFI
+       default y
+       help
+         This enables SMBIOS/DMI feature for systems.
+
+         This option is only useful on systems that have UEFI firmware.
+         However, even with this option, the resultant kernel should
+         continue to boot on existing non-UEFI platforms.
 endmenu
 

The dependencies will need some tweaking here:

arch/arm64/Kconfig:263:error: recursive dependency detected! arch/arm64/Kconfig:263: symbol DMI depends on EFI arch/arm64/Kconfig:242: symbol EFI is selected by GOOGLE_SMI drivers/firmware/google/Kconfig:13: symbol GOOGLE_SMI depends on DMI

The best fix imo is changing the GOOGLE_SMI Kconfig symbol to depend on EFI rather than select it.
The ARM version of this patch is undoubtedly affected by the same thing.

Regards,
Ard.

Quoted 58 lines
arch/arm64/Kconfig +0 -0
 menu "Userspace binary formats"
arch/arm64/include/asm/dmi.h new file +28 -0
new file mode 100644
index 0000000..f6e6004
@@ -0,0 +1,28 @@
+/*
+ * arch/arm64/include/asm/dmi.h
+ *
+ * Copyright (C) 2013 Linaro Limited.
+ * Written by: Yi Li (yi.li at linaro.org)
+ *
+ * based on arch/ia64/include/asm/dmi.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+
+#ifndef _ASM_DMI_H
+#define _ASM_DMI_H 1
+
+#include <linux/slab.h>
+#include <asm/io.h>
+
+/* Use normal IO mappings for DMI */
+#define dmi_early_remap(x, l)  efi_lookup_mapped_addr(x)
+#define dmi_early_unmap(x, l)
+#define dmi_remap(x, l)                        efi_lookup_mapped_addr(x)
+#define dmi_unmap(x)
+#define dmi_alloc(l)                   kzalloc(l, GFP_ATOMIC)
+
+#endif
arch/arm64/kernel/setup.c +2 -1
index 1aeaaf5..1480843 100644
@@ -45,6 +45,7 @@
 #ifdef CONFIG_ACPI
 #include <linux/acpi.h>
 #endif
+#include <linux/dmi.h>
 
 #include <asm/fixmap.h>
 #include <asm/cputype.h>
@@ -312,6 +313,7 @@ static int __init arm64_device_init(void)
 {
        of_clk_init(NULL);
        of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+       dmi_scan_machine();
        return 0;
 }
 arch_initcall(arm64_device_init);
--

1.7.9.5

#4 lore raw

PATCH 2/3 ARM64:DMI: Add smbios/dmi support on arm64

In reply to Yi Li
Quoted 79 lines · Yi Li

Add smbios/dmi support on arm64 system, it depends on EFI boot.

---

efi_lookup_mapped_addr() isn't able to translate the address range which is reported as reserved type from UEFI. Following the UEFI spec 2.4, it descripts the SMBIOS data should be runtime service type. So it depends on a UEFI patch to convert reserved type to runtime service type for SMBIOS and a linux dmi driver patch that has been posted for review to x86 and ia64.

 arch/arm64/Kconfig           |   10 ++++++++++
 arch/arm64/include/asm/dmi.h |   28 ++++++++++++++++++++++++++++
 arch/arm64/kernel/setup.c    |    2 ++
 3 files changed, 40 insertions(+)
 create mode 100644 arch/arm64/include/asm/dmi.h
arch/arm64/Kconfig +10 -0
index d5aaddf..84204b0 100644
@@ -292,6 +292,16 @@ config EFI_STUB
 	  by EFI firmware without the use of a bootloader.
 	  See Documentation/efi-stub.txt for more information.
 
+config DMI
+	bool "Enable support for SMBIOS (DMI) tables"
+	depends on EFI
+	default y
+	help
+	  This enables SMBIOS/DMI feature for systems.
+
+	  This option is only useful on systems that have UEFI firmware.
+	  However, even with this option, the resultant kernel should
+	  continue to boot on existing non-UEFI platforms.
 endmenu
 
 menu "Userspace binary formats"
arch/arm64/include/asm/dmi.h new file +28 -0
new file mode 100644
index 0000000..f6e6004
@@ -0,0 +1,28 @@
+/*
+ * arch/arm64/include/asm/dmi.h
+ *
+ * Copyright (C) 2013 Linaro Limited.
+ * Written by: Yi Li (yi.li at linaro.org)
+ *
+ * based on arch/ia64/include/asm/dmi.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+
+#ifndef _ASM_DMI_H
+#define _ASM_DMI_H 1
+
+#include <linux/slab.h>
+#include <asm/io.h>
+
+/* Use normal IO mappings for DMI */
+#define dmi_early_remap(x, l)	efi_lookup_mapped_addr(x)
+#define dmi_early_unmap(x, l)
+#define dmi_remap(x, l)			efi_lookup_mapped_addr(x)
+#define dmi_unmap(x)
+#define dmi_alloc(l)			kzalloc(l, GFP_ATOMIC)
+
+#endif
arch/arm64/kernel/setup.c +0 -0
index 1aeaaf5..1480843 100644

arch/arm64/kernel/setup.c line 51

Quoted 7 lines
arch/arm64/kernel/setup.c +1 -0
@@ -45,6 +45,7 @@
 #ifdef CONFIG_ACPI
 #include <linux/acpi.h>
 #endif
+#include <linux/dmi.h>
 
 #include <asm/fixmap.h>
 #include <asm/cputype.h>

Nitpick: You dropped a blank line in this hunk. I suspect that was unintentional, but it looks sloppy.

Otherwise:

Quoted 11 lines
arch/arm64/kernel/setup.c +1 -0
@@ -312,6 +313,7 @@ static int __init arm64_device_init(void)
 {
 	of_clk_init(NULL);
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+	dmi_scan_machine();
 	return 0;
 }
 arch_initcall(arm64_device_init);
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 2/3 ARM64:DMI: Add smbios/dmi support on arm64

Quoted 85 lines · Grant Likely
Quoted 84 lines · Yi Li

Add smbios/dmi support on arm64 system, it depends on EFI boot.

---

efi_lookup_mapped_addr() isn't able to translate the address range which is reported as reserved type from UEFI. Following the UEFI spec 2.4, it descripts the SMBIOS data should be runtime service type. So it depends on a UEFI patch to convert reserved type to runtime service type for SMBIOS and a linux dmi driver patch that has been posted for review to x86 and ia64.

 arch/arm64/Kconfig           |   10 ++++++++++
 arch/arm64/include/asm/dmi.h |   28 ++++++++++++++++++++++++++++
 arch/arm64/kernel/setup.c    |    2 ++
 3 files changed, 40 insertions(+)
 create mode 100644 arch/arm64/include/asm/dmi.h
arch/arm64/Kconfig +10 -0
index d5aaddf..84204b0 100644
@@ -292,6 +292,16 @@ config EFI_STUB
        by EFI firmware without the use of a bootloader.
        See Documentation/efi-stub.txt for more information.
 
+config DMI
+     bool "Enable support for SMBIOS (DMI) tables"
+     depends on EFI
+     default y
+     help
+       This enables SMBIOS/DMI feature for systems.
+
+       This option is only useful on systems that have UEFI firmware.
+       However, even with this option, the resultant kernel should
+       continue to boot on existing non-UEFI platforms.
 endmenu
 
 menu "Userspace binary formats"
arch/arm64/include/asm/dmi.h new file +28 -0
new file mode 100644
index 0000000..f6e6004
@@ -0,0 +1,28 @@
+/*
+ * arch/arm64/include/asm/dmi.h
+ *
+ * Copyright (C) 2013 Linaro Limited.
+ * Written by: Yi Li (yi.li at linaro.org)
+ *
+ * based on arch/ia64/include/asm/dmi.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+
+#ifndef _ASM_DMI_H
+#define _ASM_DMI_H 1
+
+#include <linux/slab.h>
+#include <asm/io.h>
+
+/* Use normal IO mappings for DMI */
+#define dmi_early_remap(x, l)        efi_lookup_mapped_addr(x)
+#define dmi_early_unmap(x, l)
+#define dmi_remap(x, l)                      efi_lookup_mapped_addr(x)
+#define dmi_unmap(x)
+#define dmi_alloc(l)                 kzalloc(l, GFP_ATOMIC)
+
+#endif
arch/arm64/kernel/setup.c +1 -0
index 1aeaaf5..1480843 100644
@@ -45,6 +45,7 @@
 #ifdef CONFIG_ACPI
 #include <linux/acpi.h>
 #endif
+#include <linux/dmi.h>
 
Quoted 5 lines

arch/arm64/kernel/setup.c line 51

Quoted 2 lines
arch/arm64/kernel/setup.c +0 -0
 #include <asm/fixmap.h>
 #include <asm/cputype.h>

Nitpick: You dropped a blank line in this hunk. I suspect that was unintentional, but it looks sloppy.

Oops, nevermind. You haven't made a mistake here. My mailer did something silly and it looked like there was a '-' tag on the blank line.

Sorry for the noise.

g.

Quoted 17 lines

Otherwise:

Quoted 11 lines
arch/arm64/kernel/setup.c +1 -1
@@ -312,6 +313,7 @@ static int __init arm64_device_init(void)
 {
      of_clk_init(NULL);
      of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+     dmi_scan_machine();
      return 0;
 }
 arch_initcall(arm64_device_init);
--

1.7.9.5

author
#6 lore raw

PATCH 3/3 ARM32:DMI: Add smbios/dmi support on arm32

In reply to Yi Li

Add smbios/dmi support on arm32 system, it depends on EFI boot.

---

efi_lookup_mapped_addr() isn't able to translate the address range which is reported as reserved type from UEFI. Following the UEFI spec 2.4, it descripts the SMBIOS data should be runtime service type. So it depends on a UEFI patch to convert reserved type to runtime service type for SMBIOS and a linux dmi driver patch that has been posted for review to x86 and ia64.

 arch/arm/Kconfig           |   13 +++++++++++++
 arch/arm/include/asm/dmi.h |   28 ++++++++++++++++++++++++++++
 arch/arm/kernel/setup.c    |    2 ++
 3 files changed, 43 insertions(+)
 create mode 100644 arch/arm/include/asm/dmi.h
arch/arm/Kconfig +13 -0
index 11367a4..623c8c5 100644
@@ -1910,6 +1910,17 @@ config EFI_STUB
 	  executed directly by EFI firmware.
 	  See Documentation/efi-stub.txt for more information.
 
+config DMI
+	bool "Enable support for SMBIOS (DMI) tables"
+	depends on EFI
+	default y
+	help
+	  This enables SMBIOS/DMI feature for systems.
+
+	  This option is only useful on systems that have UEFI firmware.
+	  However, even with this option, the resultant kernel should
+	  continue to boot on existing non-UEFI platforms.
+
 config SECCOMP
 	bool
 	prompt "Enable seccomp to safely compute untrusted bytecode"
@@ -2348,6 +2359,8 @@ source "net/Kconfig"
 
 source "drivers/Kconfig"
 
+source "drivers/firmware/Kconfig"
+
 source "fs/Kconfig"
 
 source "arch/arm/Kconfig.debug"
arch/arm/include/asm/dmi.h new file +28 -0
new file mode 100644
index 0000000..428f32e
@@ -0,0 +1,28 @@
+/*
+ * arch/arm/include/asm/dmi.h
+ *
+ * Copyright (C) 2013 Linaro Limited.
+ * Written by: Yi Li (yi.li at linaro.org)
+ *
+ * based on arch/ia64/include/asm/dmi.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+
+#ifndef _ASM_DMI_H
+#define _ASM_DMI_H 1
+
+#include <linux/slab.h>
+#include <asm/io.h>
+
+/* Use normal IO mappings for DMI */
+#define dmi_early_remap(x, l)	efi_lookup_mapped_addr(x)
+#define dmi_early_unmap(x, l)
+#define dmi_remap(x, l)			efi_lookup_mapped_addr(x)
+#define dmi_unmap(x)
+#define dmi_alloc(l)			kzalloc(l, GFP_ATOMIC)
+
+#endif
arch/arm/kernel/setup.c +2 -0
index 0bde4e3..c9999ce 100644
@@ -34,6 +34,7 @@
 #ifdef CONFIG_ACPI
 #include <linux/acpi.h>
 #endif
+#include <linux/dmi.h>
 
 #include <asm/unified.h>
 #include <asm/cp15.h>
@@ -771,6 +772,7 @@ static int __init customize_machine(void)
 		of_platform_populate(NULL, of_default_bus_match_table,
 					NULL, NULL);
 #endif
+	dmi_scan_machine();
 	return 0;
 }
 arch_initcall(customize_machine);
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH 3/3 ARM32:DMI: Add smbios/dmi support on arm32

Quoted 5 lines · Yi Li

Add smbios/dmi support on arm32 system, it depends on EFI boot.

---

Quoted 102 lines

efi_lookup_mapped_addr() isn't able to translate the address range which is reported as reserved type from UEFI. Following the UEFI spec 2.4, it descripts the SMBIOS data should be runtime service type. So it depends on a UEFI patch to convert reserved type to runtime service type for SMBIOS and a linux dmi driver patch that has been posted for review to x86 and ia64.

 arch/arm/Kconfig           |   13 +++++++++++++
 arch/arm/include/asm/dmi.h |   28 ++++++++++++++++++++++++++++
 arch/arm/kernel/setup.c    |    2 ++
 3 files changed, 43 insertions(+)
 create mode 100644 arch/arm/include/asm/dmi.h
arch/arm/Kconfig +13 -0
index 11367a4..623c8c5 100644
@@ -1910,6 +1910,17 @@ config EFI_STUB
 	  executed directly by EFI firmware.
 	  See Documentation/efi-stub.txt for more information.
 
+config DMI
+	bool "Enable support for SMBIOS (DMI) tables"
+	depends on EFI
+	default y
+	help
+	  This enables SMBIOS/DMI feature for systems.
+
+	  This option is only useful on systems that have UEFI firmware.
+	  However, even with this option, the resultant kernel should
+	  continue to boot on existing non-UEFI platforms.
+
 config SECCOMP
 	bool
 	prompt "Enable seccomp to safely compute untrusted bytecode"
@@ -2348,6 +2359,8 @@ source "net/Kconfig"
 
 source "drivers/Kconfig"
 
+source "drivers/firmware/Kconfig"
+
 source "fs/Kconfig"
 
 source "arch/arm/Kconfig.debug"
arch/arm/include/asm/dmi.h new file +28 -0
new file mode 100644
index 0000000..428f32e
@@ -0,0 +1,28 @@
+/*
+ * arch/arm/include/asm/dmi.h
+ *
+ * Copyright (C) 2013 Linaro Limited.
+ * Written by: Yi Li (yi.li at linaro.org)
+ *
+ * based on arch/ia64/include/asm/dmi.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+
+#ifndef _ASM_DMI_H
+#define _ASM_DMI_H 1
+
+#include <linux/slab.h>
+#include <asm/io.h>
+
+/* Use normal IO mappings for DMI */
+#define dmi_early_remap(x, l)	efi_lookup_mapped_addr(x)
+#define dmi_early_unmap(x, l)
+#define dmi_remap(x, l)			efi_lookup_mapped_addr(x)
+#define dmi_unmap(x)
+#define dmi_alloc(l)			kzalloc(l, GFP_ATOMIC)
+
+#endif
arch/arm/kernel/setup.c +2 -0
index 0bde4e3..c9999ce 100644
@@ -34,6 +34,7 @@
 #ifdef CONFIG_ACPI
 #include <linux/acpi.h>
 #endif
+#include <linux/dmi.h>
 
 #include <asm/unified.h>
 #include <asm/cp15.h>
@@ -771,6 +772,7 @@ static int __init customize_machine(void)
 		of_platform_populate(NULL, of_default_bus_match_table,
 					NULL, NULL);
 #endif
+	dmi_scan_machine();
 	return 0;
 }
 arch_initcall(customize_machine);
Signature · 1 line
1.7.9.5