From patchwork Tue Jul 30 16:47:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 18671 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f69.google.com (mail-yh0-f69.google.com [209.85.213.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6E7D5248E6 for ; Tue, 30 Jul 2013 16:42:40 +0000 (UTC) Received: by mail-yh0-f69.google.com with SMTP id i72sf5991433yha.4 for ; Tue, 30 Jul 2013 09:42:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=GNuYyc9eJsoB+JCsn3/8Pfy6ryasj12VY8D7MqngYFk=; b=AtyG6y6lXXV5bIYlRtpDInIw0AgsNUOSvQOPK38qt9WSbS0cO5OcfOGzmadHh5/JV3 SaixflbCOYq0DN9Z7PeN93l9FM5idgJEo2lpCDN6nC1VMzqgpN9YrG2gZxU703K2TM/b taWtDd8efUdrfDeo4tlAkE19yN6PQ/+TdJre2zV+Z0q0mPtTAzs9YdmDCH2iHVj8C++W Sl6jX3bOzBINkC2VP9cBRp4vVr8KKwQD+O+HC+tAbsB0X1PyVlmYEEedj3wKCPXW8KFx Q0b1lxrluqwqjDnG1Hsw2ganqfitcEnMdxfgNJdGxpCJIv5+EsmUNfjXiZBjom/vUM8S 3erg== X-Received: by 10.236.109.199 with SMTP id s47mr10550292yhg.2.1375202560243; Tue, 30 Jul 2013 09:42:40 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.94.212 with SMTP id de20ls291879qeb.44.gmail; Tue, 30 Jul 2013 09:42:40 -0700 (PDT) X-Received: by 10.220.43.19 with SMTP id u19mr10354620vce.3.1375202560107; Tue, 30 Jul 2013 09:42:40 -0700 (PDT) Received: from mail-vb0-f48.google.com (mail-vb0-f48.google.com [209.85.212.48]) by mx.google.com with ESMTPS id e1si6937291vcl.31.2013.07.30.09.42.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 30 Jul 2013 09:42:40 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.48 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.48; Received: by mail-vb0-f48.google.com with SMTP id w16so611069vbf.35 for ; Tue, 30 Jul 2013 09:42:40 -0700 (PDT) X-Received: by 10.221.47.193 with SMTP id ut1mr10178531vcb.8.1375202559965; Tue, 30 Jul 2013 09:42:39 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.11.8 with SMTP id pc8csp185609vcb; Tue, 30 Jul 2013 09:42:39 -0700 (PDT) X-Received: by 10.194.9.70 with SMTP id x6mr35733740wja.19.1375202558961; Tue, 30 Jul 2013 09:42:38 -0700 (PDT) Received: from mail-wg0-f47.google.com (mail-wg0-f47.google.com [74.125.82.47]) by mx.google.com with ESMTPS id ly4si30508283wjb.1.2013.07.30.09.42.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 30 Jul 2013 09:42:38 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.47 is neither permitted nor denied by best guess record for domain of leif.lindholm@linaro.org) client-ip=74.125.82.47; Received: by mail-wg0-f47.google.com with SMTP id j13so6312978wgh.14 for ; Tue, 30 Jul 2013 09:42:38 -0700 (PDT) X-Received: by 10.180.210.231 with SMTP id mx7mr1629790wic.5.1375202558523; Tue, 30 Jul 2013 09:42:38 -0700 (PDT) Received: from mohikan.mushroom.smurfnet.nu (cpc4-cmbg17-2-0-cust71.5-4.cable.virginmedia.com. [86.14.224.72]) by mx.google.com with ESMTPSA id z2sm29652655wiv.11.2013.07.30.09.42.37 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 30 Jul 2013 09:42:37 -0700 (PDT) From: Leif Lindholm To: linux-efi@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, matt.fleming@intel.com, hpa@zytor.com, tglx@linutronix.de, patches@linaro.org, Leif Lindholm Subject: [PATCH 2/4] efi: x86: use common code for (U)EFI configuration scanning Date: Tue, 30 Jul 2013 17:47:36 +0100 Message-Id: <1375202858-28470-3-git-send-email-leif.lindholm@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1375202858-28470-1-git-send-email-leif.lindholm@linaro.org> References: <1375202858-28470-1-git-send-email-leif.lindholm@linaro.org> X-Gm-Message-State: ALoCoQlRy6+OXVYXQVET0PgxQARKpPV5FZgiz5/yc9IwdQZm4PCU3w3CA4sG3LonSpsPQRDEeByD X-Original-Sender: leif.lindholm@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.48 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch makes x86 use the new common code for EFI configuration table scanning. It also removes the local definition of the global "efi" data structure. Signed-off-by: Leif Lindholm --- arch/x86/platform/efi/efi.c | 96 ++++--------------------------------------- 1 file changed, 8 insertions(+), 88 deletions(-) diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 90f6ed1..ed2be58 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c @@ -60,19 +60,6 @@ static efi_char16_t efi_dummy_name[6] = { 'D', 'U', 'M', 'M', 'Y', 0 }; -struct efi __read_mostly efi = { - .mps = EFI_INVALID_TABLE_ADDR, - .acpi = EFI_INVALID_TABLE_ADDR, - .acpi20 = EFI_INVALID_TABLE_ADDR, - .smbios = EFI_INVALID_TABLE_ADDR, - .sal_systab = EFI_INVALID_TABLE_ADDR, - .boot_info = EFI_INVALID_TABLE_ADDR, - .hcdp = EFI_INVALID_TABLE_ADDR, - .uga = EFI_INVALID_TABLE_ADDR, - .uv_systab = EFI_INVALID_TABLE_ADDR, -}; -EXPORT_SYMBOL(efi); - struct efi_memory_map memmap; static struct efi efi_phys __initdata; @@ -80,6 +67,13 @@ static efi_system_table_t efi_systab __initdata; unsigned long x86_efi_facility; +static __initdata efi_config_table_type_t arch_tables[] = { +#ifdef CONFIG_X86_UV + {UV_SYSTEM_TABLE_GUID, "UVsystab", &efi.uv_systab}, +#endif + {NULL_GUID, NULL, 0}, +}; + /* * Returns 1 if 'facility' is enabled, 0 otherwise. */ @@ -578,80 +572,6 @@ static int __init efi_systab_init(void *phys) return 0; } -static int __init efi_config_init(u64 tables, int nr_tables) -{ - void *config_tables, *tablep; - int i, sz; - - if (efi_enabled(EFI_64BIT)) - sz = sizeof(efi_config_table_64_t); - else - sz = sizeof(efi_config_table_32_t); - - /* - * Let's see what config tables the firmware passed to us. - */ - config_tables = early_ioremap(tables, nr_tables * sz); - if (config_tables == NULL) { - pr_err("Could not map Configuration table!\n"); - return -ENOMEM; - } - - tablep = config_tables; - pr_info(""); - for (i = 0; i < efi.systab->nr_tables; i++) { - efi_guid_t guid; - unsigned long table; - - if (efi_enabled(EFI_64BIT)) { - u64 table64; - guid = ((efi_config_table_64_t *)tablep)->guid; - table64 = ((efi_config_table_64_t *)tablep)->table; - table = table64; -#ifdef CONFIG_X86_32 - if (table64 >> 32) { - pr_cont("\n"); - pr_err("Table located above 4GB, disabling EFI.\n"); - early_iounmap(config_tables, - efi.systab->nr_tables * sz); - return -EINVAL; - } -#endif - } else { - guid = ((efi_config_table_32_t *)tablep)->guid; - table = ((efi_config_table_32_t *)tablep)->table; - } - if (!efi_guidcmp(guid, MPS_TABLE_GUID)) { - efi.mps = table; - pr_cont(" MPS=0x%lx ", table); - } else if (!efi_guidcmp(guid, ACPI_20_TABLE_GUID)) { - efi.acpi20 = table; - pr_cont(" ACPI 2.0=0x%lx ", table); - } else if (!efi_guidcmp(guid, ACPI_TABLE_GUID)) { - efi.acpi = table; - pr_cont(" ACPI=0x%lx ", table); - } else if (!efi_guidcmp(guid, SMBIOS_TABLE_GUID)) { - efi.smbios = table; - pr_cont(" SMBIOS=0x%lx ", table); -#ifdef CONFIG_X86_UV - } else if (!efi_guidcmp(guid, UV_SYSTEM_TABLE_GUID)) { - efi.uv_systab = table; - pr_cont(" UVsystab=0x%lx ", table); -#endif - } else if (!efi_guidcmp(guid, HCDP_TABLE_GUID)) { - efi.hcdp = table; - pr_cont(" HCDP=0x%lx ", table); - } else if (!efi_guidcmp(guid, UGA_IO_PROTOCOL_GUID)) { - efi.uga = table; - pr_cont(" UGA=0x%lx ", table); - } - tablep += sz; - } - pr_cont("\n"); - early_iounmap(config_tables, efi.systab->nr_tables * sz); - return 0; -} - static int __init efi_runtime_init(void) { efi_runtime_services_t *runtime; @@ -745,7 +665,7 @@ void __init efi_init(void) efi.systab->hdr.revision >> 16, efi.systab->hdr.revision & 0xffff, vendor); - if (efi_config_init(efi.systab->tables, efi.systab->nr_tables)) + if (efi_config_init(arch_tables)) return; set_bit(EFI_CONFIG_TABLES, &x86_efi_facility);