]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
arm64: dmi: Add SMBIOS/DMI support
authorYi Li <yi.li@linaro.org>
Fri, 11 Jul 2014 11:46:50 +0000 (12:46 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Mon, 21 Jul 2014 09:22:21 +0000 (10:22 +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.

Signed-off-by: Yi Li <yi.li@linaro.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Will Deacon <will.deacon@arm.com>
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/setup.c

index ce6e733e0c05cab06cd983303453dcd84ff31600..62a71e829770a83547c79f7982cb1db72d2226ee 100644 (file)
@@ -311,6 +311,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..b0882a8
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * 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/slab.h>
+#include <linux/efi.h>
+
+static inline void __iomem *dmi_remap(u64 phys, u64 size)
+{
+       void __iomem *p = efi_lookup_mapped_addr(phys);
+
+       /*
+        * If the mapping spans multiple pages, do a minimal check to ensure
+        * that the mapping returned by efi_lookup_mapped_addr() covers the
+        * whole requested range (but ignore potential holes)
+        */
+       if ((phys & ~PAGE_MASK) + size > PAGE_SIZE
+           && (p + size - 1) != efi_lookup_mapped_addr(phys + size - 1))
+               return NULL;
+       return p;
+}
+
+/* Reuse existing UEFI mappings for DMI */
+#define dmi_alloc(l)                   kzalloc(l, GFP_KERNEL)
+#define dmi_early_remap(x, l)          dmi_remap(x, l)
+#define dmi_early_unmap(x, l)
+#define dmi_unmap(x)
+
+#endif
index f6f0ccf35ae67110c030d72c6c7648e04168c6e9..35339a0e15922f63cfcb56a849235291a7fea932 100644 (file)
@@ -43,6 +43,7 @@
 #include <linux/of_fdt.h>
 #include <linux/of_platform.h>
 #include <linux/efi.h>
+#include <linux/dmi.h>
 
 #include <asm/fixmap.h>
 #include <asm/cpu.h>
@@ -413,6 +414,7 @@ void __init setup_arch(char **cmdline_p)
 static int __init arm64_device_init(void)
 {
        of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+       dmi_scan_machine();
        return 0;
 }
 arch_initcall_sync(arm64_device_init);