From patchwork Fri Jul 11 11:46:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 33485 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 858F920672 for ; Fri, 11 Jul 2014 11:49:12 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id ij19sf3284791vcb.10 for ; Fri, 11 Jul 2014 04:49:12 -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=qPjpdYggRreRH+dOS5ei/KQfIhhKSssAJfFg6s/wLsw=; b=ZgeifXWVvKvjL2/x69PJGhmOCNPCR+LDkO0vYWo/UMnmuAnWnOO4BmCaL7mIj2iIM6 qwKSNpQ6M29gg2RHhBsGcTy43X7Y2CbEg2Vwk41b+stRG9IBTAvvU4zhKnbSa0XSPANT qyROcbcogThzfXeHtVUTg9a+SZeP2PzYfDyDLdrZZ+GKD38pbQ7iMIk2FYO8/wfvknxh xj7UWlUPhVkMU7AsbRCzkySpkl65AtLSK6ExSMaS0Nle+w9RiiSronD9iAuIJLziHPWu FynHsYBkovcNnI+qObPZtXfTPqpfvjqh1/K/9Xxh4IWtWDXSDYSXd9FcQ+lC3o7BUHJU BuxQ== X-Gm-Message-State: ALoCoQlHj53WEsOdSx5MYVBSVXlQ1nfzwKPgK3z4wuLo9Ai1+B8xOl2iwYNfvCuz1cfT3pycB1bD X-Received: by 10.236.25.234 with SMTP id z70mr23096093yhz.48.1405079352317; Fri, 11 Jul 2014 04:49:12 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.31.116 with SMTP id e107ls355568qge.67.gmail; Fri, 11 Jul 2014 04:49:12 -0700 (PDT) X-Received: by 10.52.248.209 with SMTP id yo17mr303766vdc.60.1405079352235; Fri, 11 Jul 2014 04:49:12 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id ui10si1344497vec.54.2014.07.11.04.49.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Jul 2014 04:49:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id im17so1735954vcb.25 for ; Fri, 11 Jul 2014 04:49:12 -0700 (PDT) X-Received: by 10.52.244.35 with SMTP id xd3mr131953vdc.71.1405079352107; Fri, 11 Jul 2014 04:49:12 -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 tc5csp28464vcb; Fri, 11 Jul 2014 04:49:11 -0700 (PDT) X-Received: by 10.68.230.194 with SMTP id ta2mr53821758pbc.51.1405079350631; Fri, 11 Jul 2014 04:49:10 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id aj7si2237643pad.74.2014.07.11.04.49.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Jul 2014 04:49:10 -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 1X5ZIV-0006HB-JF; Fri, 11 Jul 2014 11:47:27 +0000 Received: from mail-we0-f169.google.com ([74.125.82.169]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X5ZIR-0006Dl-HV for linux-arm-kernel@lists.infradead.org; Fri, 11 Jul 2014 11:47:24 +0000 Received: by mail-we0-f169.google.com with SMTP id t60so941169wes.0 for ; Fri, 11 Jul 2014 04:46:59 -0700 (PDT) X-Received: by 10.180.14.162 with SMTP id q2mr4492563wic.54.1405079218314; Fri, 11 Jul 2014 04:46:58 -0700 (PDT) Received: from ards-macbook-pro.local (141-138-33-167.dsl.iskon.hr. [141.138.33.167]) by mx.google.com with ESMTPSA id gq4sm6614916wib.8.2014.07.11.04.46.56 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Jul 2014 04:46:57 -0700 (PDT) From: Ard Biesheuvel To: yi.li@linaro.org, will.deacon@arm.com Subject: [PATCH resend v2] arm64: dmi: Add SMBIOS/DMI support Date: Fri, 11 Jul 2014 13:46:50 +0200 Message-Id: <1405079210-30044-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-20140711_044723_733439_9E39C036 X-CRM114-Status: GOOD ( 18.10 ) 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 [74.125.82.169 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [74.125.82.169 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: mark.rutland@arm.com, phoenix.liyi@huawei.com, Ard Biesheuvel , catalin.marinas@arm.com, leif.lindholm@linaro.org, grant.likely@linaro.org, linux-arm-kernel@lists.infradead.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: 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.180 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 --- Changes since previous version: - changed double inclusion guard to arm64 flavour - use kzalloc(GFP_KERNEL) as GFP_ATOMIC is not needed - do a sanity check on the size of the requested mapping arch/arm64/Kconfig | 10 ++++++++++ arch/arm64/include/asm/dmi.h | 41 +++++++++++++++++++++++++++++++++++++++++ arch/arm64/kernel/setup.c | 2 ++ 3 files changed, 53 insertions(+) create mode 100644 arch/arm64/include/asm/dmi.h diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index a474de346be6..560996c4a172 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -307,6 +307,16 @@ 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..b0882a8620e1 --- /dev/null +++ b/arch/arm64/include/asm/dmi.h @@ -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 +#include + +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 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);