From patchwork Sat Oct 4 15:46:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Li X-Patchwork-Id: 38349 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f70.google.com (mail-ee0-f70.google.com [74.125.83.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BC9B7203AD for ; Sat, 4 Oct 2014 15:51:34 +0000 (UTC) Received: by mail-ee0-f70.google.com with SMTP id c13sf1735056eek.5 for ; Sat, 04 Oct 2014 08:51:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id:cc :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=tkMeMbk9Pm2eFSpqAZT2XS5xG7xVBIzdfeTRQf8p/wI=; b=R9SAeRp0yQRbhG/mrPNdLTQbv11881dWQo+/sRMBeRT65I/2GaATeLLX8TbPpcU7Sr mPbZAiDSyqjcHhtU/O/9TAKKFRFzFeqM5Xp1gDzyi30dvvyoUSd7b7C3ISOf//AU7HP8 PhaXNJ+hug2wBDq7zig/OCIb48bNjiq81RGF+rWjtvmW7Uji6WwNVS8dG3lZhUh50OMB YgbtePGgnXo8cB6Et4X0LZEEs5bKs45mGmUjEzlChMvJwKUzGsM3d/BY94PkrMcNTmQU p/fuPxlgFxK0GkGZ6TG1KBrVBCr4OFnqAmjZ++4AELw2ly2yCCoUCoNv+EYz0rqyNmzI NNWw== X-Gm-Message-State: ALoCoQmZOjkNIsWyIVbMBwSh9CLsuDOR+Zw3D+hqAkmgDH8JgzSuftbhJyumKlMj4R3Kjg6W8CQb X-Received: by 10.112.17.3 with SMTP id k3mr2076108lbd.3.1412437893797; Sat, 04 Oct 2014 08:51:33 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.30.70 with SMTP id q6ls450806lah.62.gmail; Sat, 04 Oct 2014 08:51:33 -0700 (PDT) X-Received: by 10.112.75.233 with SMTP id f9mr2966197lbw.102.1412437893492; Sat, 04 Oct 2014 08:51:33 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com [209.85.217.178]) by mx.google.com with ESMTPS id ax8si16085512lbc.79.2014.10.04.08.51.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 04 Oct 2014 08:51:33 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by mail-lb0-f178.google.com with SMTP id w7so2380544lbi.37 for ; Sat, 04 Oct 2014 08:51:33 -0700 (PDT) X-Received: by 10.112.163.103 with SMTP id yh7mr12545731lbb.73.1412437892969; Sat, 04 Oct 2014 08:51:32 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp49374lbb; Sat, 4 Oct 2014 08:51:32 -0700 (PDT) X-Received: by 10.70.37.208 with SMTP id a16mr1544477pdk.147.1412437891183; Sat, 04 Oct 2014 08:51:31 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id w2si7062036pdf.46.2014.10.04.08.51.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Oct 2014 08:51:31 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XaRYV-0001eb-Gh; Sat, 04 Oct 2014 15:47:35 +0000 Received: from mail-vc0-f171.google.com ([209.85.220.171]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XaRYS-0001c3-6n for linux-arm-kernel@lists.infradead.org; Sat, 04 Oct 2014 15:47:32 +0000 Received: by mail-vc0-f171.google.com with SMTP id hy10so1752734vcb.16 for ; Sat, 04 Oct 2014 08:47:09 -0700 (PDT) X-Received: by 10.52.38.134 with SMTP id g6mr1054838vdk.34.1412437629570; Sat, 04 Oct 2014 08:47:09 -0700 (PDT) Received: from localhost.localdomain ([32.161.138.72]) by mx.google.com with ESMTPSA id ti1sm2009117vdb.28.2014.10.04.08.47.03 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 04 Oct 2014 08:47:08 -0700 (PDT) From: Yi Li To: msalter@redhat.com, catalin.marinas@arm.com, will.deacon@arm.com, leif.lindholm@linaro.org, linux-arm-kernel@lists.infradead.org Subject: [PATCHv4] arm64: dmi: Add SMBIOS/DMI support Date: Sat, 4 Oct 2014 23:46:43 +0800 Message-Id: <1412437603-3394-1-git-send-email-yi.li@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141004_084732_325991_4B10A7CA X-CRM114-Status: GOOD ( 15.55 ) X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.171 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.2 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.220.171 listed in wl.mailspike.net] Cc: grant.likely@linaro.org, phoenix.liyi@huawei.com, yi.li@linaro.org, ard.biesheuvel@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: yi.li@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 Signed-off-by: Ard Biesheuvel --- As Ard's suggestion, tested the patch on the kernel with/without EFI support to boot. The bootlog and dmidecode/lshw works fine. I will send the log with another email. arch/arm64/Kconfig | 11 +++++++++++ arch/arm64/include/asm/dmi.h | 31 +++++++++++++++++++++++++++++++ arch/arm64/kernel/efi.c | 14 ++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 arch/arm64/include/asm/dmi.h diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index fd4e81a..c69ab5a 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -368,6 +368,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 index 0000000..69d37d8 --- /dev/null +++ b/arch/arm64/include/asm/dmi.h @@ -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 +#include + +/* + * 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 diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index 03aaa99..f00617f 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -11,6 +11,7 @@ * */ +#include #include #include #include @@ -479,3 +480,16 @@ err_unmap: return -1; } early_initcall(arm64_enter_virtual_mode); + +static int __init arm64_core_init(void) +{ +/* + * 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(); + return 0; +} +core_initcall(arm64_core_init);