Skip to content

Commit 668ebd1

Browse files
Yi Lictmarinas
authored andcommitted
arm64: dmi: Add SMBIOS/DMI support
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>
1 parent 9f1ae75 commit 668ebd1

3 files changed

Lines changed: 50 additions & 0 deletions

File tree

‎arch/arm64/Kconfig‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,17 @@ config EFI
369369
allow the kernel to be booted as an EFI application. This
370370
is only useful on systems that have UEFI firmware.
371371

372+
config DMI
373+
bool "Enable support for SMBIOS (DMI) tables"
374+
depends on EFI
375+
default y
376+
help
377+
This enables SMBIOS/DMI feature for systems.
378+
379+
This option is only useful on systems that have UEFI firmware.
380+
However, even with this option, the resultant kernel should
381+
continue to boot on existing non-UEFI platforms.
382+
372383
endmenu
373384

374385
menu "Userspace binary formats"

‎arch/arm64/include/asm/dmi.h‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* arch/arm64/include/asm/dmi.h
3+
*
4+
* Copyright (C) 2013 Linaro Limited.
5+
* Written by: Yi Li (yi.li@linaro.org)
6+
*
7+
* based on arch/ia64/include/asm/dmi.h
8+
*
9+
* This file is subject to the terms and conditions of the GNU General Public
10+
* License. See the file "COPYING" in the main directory of this archive
11+
* for more details.
12+
*/
13+
14+
#ifndef __ASM_DMI_H
15+
#define __ASM_DMI_H
16+
17+
#include <linux/io.h>
18+
#include <linux/slab.h>
19+
20+
/*
21+
* According to section 2.3.6 of the UEFI spec, the firmware should not
22+
* request a virtual mapping for configuration tables such as SMBIOS.
23+
* This means we have to map them before use.
24+
*/
25+
#define dmi_early_remap(x, l) ioremap_cache(x, l)
26+
#define dmi_early_unmap(x, l) iounmap(x)
27+
#define dmi_remap(x, l) ioremap_cache(x, l)
28+
#define dmi_unmap(x) iounmap(x)
29+
#define dmi_alloc(l) kzalloc(l, GFP_KERNEL)
30+
31+
#endif

‎arch/arm64/kernel/efi.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*
1212
*/
1313

14+
#include <linux/dmi.h>
1415
#include <linux/efi.h>
1516
#include <linux/export.h>
1617
#include <linux/memblock.h>
@@ -435,6 +436,13 @@ static int __init arm64_enter_virtual_mode(void)
435436
}
436437
set_bit(EFI_SYSTEM_TABLES, &efi.flags);
437438

439+
/*
440+
* DMI depends on EFI on arm64, and dmi_scan_machine() needs to be
441+
* called early because dmi_id_init(), which is an arch_initcall itself,
442+
* depends on dmi_scan_machine() having been called already.
443+
*/
444+
dmi_scan_machine();
445+
438446
local_irq_save(flags);
439447
cpu_switch_mm(idmap_pg_dir, &init_mm);
440448

0 commit comments

Comments
 (0)