arm64: dmi: Add SMBIOS/DMI support
authorYi Li <yi.li@linaro.org>
Mon, 22 Sep 2014 10:11:18 +0000 (11:11 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Mon, 22 Sep 2014 10:11:18 +0000 (11:11 +0100)
SMBIOS is important for server hardware vendors. It implements a spec for
providing descriptive information about the platform. Things like serial
numbers, physical layout of the ports, build configuration data, and the like.

This has been tested by dmidecode and lshw tools.

This patch adds the call to dmi_scan_machine() to arm64_enter_virtual_mode(),
as that is the point where the EFI Configuration Tables are registered as
being available. It needs to be in an early_initcall anyway as dmi_id_init(),
which is an arch_initcall itself, depends on dmi_scan_machine() having been
called already.

Signed-off-by: Yi Li <yi.li@linaro.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/Kconfig
arch/arm64/include/asm/dmi.h [new file with mode: 0644]
arch/arm64/kernel/efi.c

index f0d3a2d85a5b33873a558352b8c42714bff3f152..6e72fa301a38b6dee3e21a84c92720b7f2493d44 100644 (file)
@@ -369,6 +369,17 @@ config EFI
          allow the kernel to be booted as an EFI application. This
          is only useful on systems that have UEFI firmware.
 
+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"
diff --git a/arch/arm64/include/asm/dmi.h b/arch/arm64/include/asm/dmi.h
new file mode 100644 (file)
index 0000000..69d37d8
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * arch/arm64/include/asm/dmi.h
+ *
+ * Copyright (C) 2013 Linaro Limited.
+ * Written by: Yi Li (yi.li@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
+
+#include <linux/io.h>
+#include <linux/slab.h>
+
+/*
+ * According to section 2.3.6 of the UEFI spec, the firmware should not
+ * request a virtual mapping for configuration tables such as SMBIOS.
+ * This means we have to map them before use.
+ */
+#define dmi_early_remap(x, l)          ioremap_cache(x, l)
+#define dmi_early_unmap(x, l)          iounmap(x)
+#define dmi_remap(x, l)                        ioremap_cache(x, l)
+#define dmi_unmap(x)                   iounmap(x)
+#define dmi_alloc(l)                   kzalloc(l, GFP_KERNEL)
+
+#endif
index 03aaa99e1ea00a3d4caf79d27cea669d857a9090..b71ab0e5780c46f0a5c73430244c7c7b3efdacd0 100644 (file)
@@ -11,6 +11,7 @@
  *
  */
 
+#include <linux/dmi.h>
 #include <linux/efi.h>
 #include <linux/export.h>
 #include <linux/memblock.h>
@@ -435,6 +436,13 @@ static int __init arm64_enter_virtual_mode(void)
        }
        set_bit(EFI_SYSTEM_TABLES, &efi.flags);
 
+       /*
+        * DMI depends on EFI on arm64, and dmi_scan_machine() needs to be
+        * called early because dmi_id_init(), which is an arch_initcall itself,
+        * depends on dmi_scan_machine() having been called already.
+        */
+       dmi_scan_machine();
+
        local_irq_save(flags);
        cpu_switch_mm(idmap_pg_dir, &init_mm);