From patchwork Fri Sep 19 23:03:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 37659 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5C6812054D for ; Fri, 19 Sep 2014 23:06:23 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id l4sf2025564lbv.8 for ; Fri, 19 Sep 2014 16:06:21 -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=Wel1d1XrhAQYOPzXSgqa7AUWpAJfo8pFHqJPO9Li3Q0=; b=KLqHJgbMTslC+ozgfEjFA9TTUnLNbphheHCPccHDB5StO4Tt3b88OuexYg2voA9KbG UVwGQcpEmFIsnU9YtlVGDwpRWk+g5JVs7g1NczJsjwVJT2/NKEv7bm7BBQnptckSd5a3 X+eh3kdvmkRJBhw3KFMDwY00b7UrNxrPQsg9Tg3k6fEFN+l4xkHKjA5zlXyilUcpVOTH I+Q8jOAwm+Da2lB59u1jszvN5M2Ps/IABB5AvfLv+3/DtT6TlDztbgOCeCrUr3w9CFci bHb8ppmi6jeEhZFwphIcZlEbK3+yD04p7WM5xZRQGMq+cApf9dgbkjkSaFitGz6Q9nga ho9w== X-Gm-Message-State: ALoCoQn9UbBcZ2p1MIC784WmE5n4j+dIQiq+oAHlYrghPch7ntWRl5Q5hIqgJWyclmOVE2oaVjAg X-Received: by 10.194.100.3 with SMTP id eu3mr3236wjb.6.1411167981890; Fri, 19 Sep 2014 16:06:21 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.4.74 with SMTP id i10ls161125lai.54.gmail; Fri, 19 Sep 2014 16:06:21 -0700 (PDT) X-Received: by 10.152.3.35 with SMTP id 3mr9839764laz.5.1411167981632; Fri, 19 Sep 2014 16:06:21 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com [209.85.215.43]) by mx.google.com with ESMTPS id mt6si4262515lbb.137.2014.09.19.16.06.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 19 Sep 2014 16:06:21 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id gi9so3978080lab.2 for ; Fri, 19 Sep 2014 16:06:21 -0700 (PDT) X-Received: by 10.112.172.38 with SMTP id az6mr9008156lbc.53.1411167981285; Fri, 19 Sep 2014 16:06:21 -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 of9csp1021039lbb; Fri, 19 Sep 2014 16:06:20 -0700 (PDT) X-Received: by 10.70.49.138 with SMTP id u10mr4723200pdn.6.1411167979217; Fri, 19 Sep 2014 16:06:19 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id wx5si4954859pbc.143.2014.09.19.16.06.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Sep 2014 16:06:19 -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 1XV7DC-0006Sk-5O; Fri, 19 Sep 2014 23:03:34 +0000 Received: from mail-pd0-f179.google.com ([209.85.192.179]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XV7D7-0006QH-W2 for linux-arm-kernel@lists.infradead.org; Fri, 19 Sep 2014 23:03:31 +0000 Received: by mail-pd0-f179.google.com with SMTP id ft15so797870pdb.10 for ; Fri, 19 Sep 2014 16:03:08 -0700 (PDT) X-Received: by 10.68.69.70 with SMTP id c6mr4211282pbu.111.1411167788011; Fri, 19 Sep 2014 16:03:08 -0700 (PDT) Received: from ards-macbook-pro.swisscom.com (70-35-38-154.static.wiline.com. [70.35.38.154]) by mx.google.com with ESMTPSA id om6sm2787893pdb.89.2014.09.19.16.03.05 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 19 Sep 2014 16:03:06 -0700 (PDT) From: Ard Biesheuvel To: will.deacon@arm.com, catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3] arm64: dmi: Add SMBIOS/DMI support Date: Fri, 19 Sep 2014 16:03:01 -0700 Message-Id: <1411167781-18571-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-20140919_160330_110470_7F292BB4 X-CRM114-Status: GOOD ( 27.50 ) X-Spam-Score: -1.0 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.192.179 listed in list.dnswl.org] -0.3 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.192.179 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 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.215.43 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. 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 Signed-off-by: Ard Biesheuvel --- It has been a long adventure getting this patch into shape, apologies for that. A FVP Base model boot log is pasted at then end of this patch, which shows the boot log and the output of the tools when dumping the SMBIOS tables. arch/arm64/Kconfig | 11 +++++++++++ arch/arm64/include/asm/dmi.h | 31 +++++++++++++++++++++++++++++++ arch/arm64/kernel/efi.c | 8 ++++++++ 3 files changed, 50 insertions(+) create mode 100644 arch/arm64/include/asm/dmi.h diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index fd4e81a4e1ce..c69ab5a3a321 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 000000000000..69d37d87b159 --- /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 03aaa99e1ea0..b71ab0e5780c 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -11,6 +11,7 @@ * */ +#include #include #include #include @@ -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);