From patchwork Thu Jul 31 12:47:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 34632 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f69.google.com (mail-pa0-f69.google.com [209.85.220.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5747420792 for ; Thu, 31 Jul 2014 12:49:14 +0000 (UTC) Received: by mail-pa0-f69.google.com with SMTP id kx10sf17348220pab.8 for ; Thu, 31 Jul 2014 05:49:13 -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=zJa1tSC5CMiswzDvE939LAOaC5CBaCiNX1/+VI3nAyU=; b=l/F+5uKGGhDT4weo2HfIieQTJbyKGnafBf7vv0HQOIJQyiDb3YcdYXhyAhP/0W+VZj JH3EM4VUgCjc2+fqsm03Or04umlDM8glk8MsZtssxFRtjvEy6xhm7HI+Unhg5J6zXFEp h3sN9I/sdRrnUr/NVkz7z/XgKg+uH47k+teJAOYboQp8/PVxylz218IUboP1E5Q5FTFE +iMDUEQ4mofDMxoOZK4AYPMNZ1Cicp6WY1tCq9w2h4o6Hx+SaR8BdZD2pVKge+NhIFMq snjYrSkKmJc/QntvFsZWEPgL0ORBYhiiKkUSTOKVrXb2pRdKeF8CRFV82S8JivCubl0W favQ== X-Gm-Message-State: ALoCoQlr8xsegxolJotejNwwSorqaa2NV4+Tk6v9TSsC+R2Ab+BtAjIpN1OSPqRq9hRDRh7rfEJx X-Received: by 10.66.222.9 with SMTP id qi9mr1517232pac.28.1406810953680; Thu, 31 Jul 2014 05:49:13 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.91.80 with SMTP id y74ls905527qgd.0.gmail; Thu, 31 Jul 2014 05:49:13 -0700 (PDT) X-Received: by 10.52.164.11 with SMTP id ym11mr8884962vdb.74.1406810953532; Thu, 31 Jul 2014 05:49:13 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id ju5si4236511veb.53.2014.07.31.05.49.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 31 Jul 2014 05:49:13 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id la4so4116320vcb.9 for ; Thu, 31 Jul 2014 05:49:13 -0700 (PDT) X-Received: by 10.220.50.8 with SMTP id x8mr12468347vcf.18.1406810953398; Thu, 31 Jul 2014 05:49:13 -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.221.37.5 with SMTP id tc5csp15467vcb; Thu, 31 Jul 2014 05:49:12 -0700 (PDT) X-Received: by 10.67.29.140 with SMTP id jw12mr3945319pad.129.1406810951297; Thu, 31 Jul 2014 05:49:11 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id ok8si5809700pbb.181.2014.07.31.05.49.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Jul 2014 05:49:11 -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 1XCplv-0003un-2q; Thu, 31 Jul 2014 12:47:51 +0000 Received: from mail-wi0-f177.google.com ([209.85.212.177]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XCpls-0003ps-VH for linux-arm-kernel@lists.infradead.org; Thu, 31 Jul 2014 12:47:49 +0000 Received: by mail-wi0-f177.google.com with SMTP id ho1so4014193wib.4 for ; Thu, 31 Jul 2014 05:47:25 -0700 (PDT) X-Received: by 10.194.78.243 with SMTP id e19mr16092674wjx.119.1406810844493; Thu, 31 Jul 2014 05:47:24 -0700 (PDT) Received: from ards-macbook-pro.local (adsl21mo82.tel.net.ba. [95.156.169.82]) by mx.google.com with ESMTPSA id f6sm13180372wja.25.2014.07.31.05.47.22 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 31 Jul 2014 05:47:23 -0700 (PDT) From: Ard Biesheuvel To: leif.lindholm@linaro.org, will.deacon@arm.com, mark.rutland@arm.com, phoenix.liyi@huawei.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH] arm64: dmi: Add SMBIOS/DMI support Date: Thu, 31 Jul 2014 14:47:10 +0200 Message-Id: <1406810830-6099-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140731_054749_163115_22F0B539 X-CRM114-Status: GOOD ( 16.35 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.177 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.212.177 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: Yi Li , Ard Biesheuvel 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: ard.biesheuvel@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.220.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 From: Yi Li 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 --- It turns out that efi_lookup_mapped_addr() is not appropriate after all for remapping the address of the SMBIOS tables. The reason is that the UEFI spec forbids virtual mappings being requested for configuration tables (which is not currently honored by Tianocore/EDK2) arch/arm64/Kconfig | 11 +++++++++++ arch/arm64/include/asm/dmi.h | 33 +++++++++++++++++++++++++++++++++ arch/arm64/kernel/setup.c | 2 ++ 3 files changed, 46 insertions(+) create mode 100644 arch/arm64/include/asm/dmi.h diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 839f48c26ef0..0b2350470ac9 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -308,6 +308,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 000000000000..0a07357bb776 --- /dev/null +++ b/arch/arm64/include/asm/dmi.h @@ -0,0 +1,33 @@ +/* + * 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 must not request + * a virtual mapping for configuration tables such as SMBIOS. This means we have + * to map them before use. As SMBIOS tables are typed as EfiRuntimeServicesData, + * they should always reside in DRAM, so we can use ioremap_cache() here, which + * will give us the existing linear mapping if the address is covered by it. + */ +#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/setup.c b/arch/arm64/kernel/setup.c index 46d1125571f6..4075e46282b1 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -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);