From patchwork Tue Mar 25 22:40:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Franz X-Patchwork-Id: 27090 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 874AE20539 for ; Tue, 25 Mar 2014 22:41:26 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id eb12sf4518510oac.3 for ; Tue, 25 Mar 2014 15:41:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=B6rKM5phClM0K6Ft2Ijh8nbRcr8ABsKwtysJMblKtMQ=; b=gYJ1to4JHjcQYO3pycknxa/xNvKTTwcbKJhOueWfL0zTa0X7E0LimUY+lPBY9vrB77 6fffG9gC0Ltp0ktSPSjao3N6KXpVvfPfAtOhc1aZS+5rLYEJSgmA2WZ63rvDY1UQCeNp vwPm4fa/BEGCB8i0ZrxtyVL//vfqczB0nvYyBHmHIhBWHpZTSFmmDK+L6zycwZc/N6Vz oxLyHArCdrHRBQGLeRCTtQdwi4+Tcz7hFaB+LTpYr8W401BBXxvjJuYgF3W9OdSSeY3e aQJJ0Zv1aj5Y6zbbTLZ5JaGYUsE3Zt9v3hZrfQcn4fZg0v1wNRfo6sCnfhkDk0DwXaKv 88yg== X-Gm-Message-State: ALoCoQmuZIFwx3d/YBkuflGZyfjBjy4POYAk+lIcWeaOOBT8QeYowEHkLp5a852Sm1NpVY2hfx7F X-Received: by 10.182.52.136 with SMTP id t8mr16356623obo.41.1395787286126; Tue, 25 Mar 2014 15:41:26 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.108.10 with SMTP id i10ls393343qgf.62.gmail; Tue, 25 Mar 2014 15:41:26 -0700 (PDT) X-Received: by 10.52.3.129 with SMTP id c1mr2589vdc.37.1395787285948; Tue, 25 Mar 2014 15:41:25 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id xv15si4078200veb.98.2014.03.25.15.41.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 15:41:25 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id lc6so1411435vcb.21 for ; Tue, 25 Mar 2014 15:41:25 -0700 (PDT) X-Received: by 10.220.96.70 with SMTP id g6mr12344309vcn.19.1395787285864; Tue, 25 Mar 2014 15:41:25 -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.220.78.9 with SMTP id i9csp312vck; Tue, 25 Mar 2014 15:41:24 -0700 (PDT) X-Received: by 10.68.228.138 with SMTP id si10mr82007130pbc.13.1395787284432; Tue, 25 Mar 2014 15:41:24 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id vo7si12441505pab.262.2014.03.25.15.40.54; Tue, 25 Mar 2014 15:40:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755121AbaCYWkq (ORCPT + 26 others); Tue, 25 Mar 2014 18:40:46 -0400 Received: from mail-oa0-f42.google.com ([209.85.219.42]:46229 "EHLO mail-oa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751904AbaCYWko (ORCPT ); Tue, 25 Mar 2014 18:40:44 -0400 Received: by mail-oa0-f42.google.com with SMTP id i4so1468783oah.1 for ; Tue, 25 Mar 2014 15:40:44 -0700 (PDT) X-Received: by 10.60.58.7 with SMTP id m7mr3948367oeq.59.1395787243956; Tue, 25 Mar 2014 15:40:43 -0700 (PDT) Received: from rfranz-v430.caveonetworks.com (64.2.3.195.ptr.us.xo.net. [64.2.3.195]) by mx.google.com with ESMTPSA id wy2sm304245obc.21.2014.03.25.15.40.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Mar 2014 15:40:42 -0700 (PDT) From: Roy Franz To: matt@console-pimps.org Cc: linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, matt.fleming@intel.com, leif.lindholm@linaro.org, hpa@zytor.com, bp@alien8.de, alan@lxorguk.ukuu.org.uk, mjg59@srcf.ucam.org, Roy Franz Subject: [PATCH] Add efi_early_call() macro Date: Tue, 25 Mar 2014 15:40:30 -0700 Message-Id: <1395787231-14298-1-git-send-email-roy.franz@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <20140322110515.GF2815@console-pimps.org> References: <20140322110515.GF2815@console-pimps.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: roy.franz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.176 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 Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add the efi_early_call() macro to invoke functions in the efi_early structure. Using a macro for these invocations allows the arm32/arm64 architectures to define the macro differently so that they can directly invoke the boot services functions that are exposed in the efi_early structure on x86. Prior to the introduction of the efi_early structure the efi_call_physN macros were used on all architectures and allowed for this differentiation. Signed-off-by: Roy Franz --- arch/x86/boot/compressed/eboot.c | 5 +++++ drivers/firmware/efi/efi-stub-helper.c | 26 +++++++++++++------------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index 5e1ba4f..374de94 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c @@ -44,6 +44,11 @@ static void setup_boot_services##bits(struct efi_config *c) \ } BOOT_SERVICES(32); BOOT_SERVICES(64); +/* + * Use macro to invoke efi_early->call so that on ARM this macro can + * implement a direct call.* + */ +#define efi_early_call(...) efi_early->call(efi_early->__VA_ARGS__) static void efi_printk(efi_system_table_t *, char *); static void efi_char16_printk(efi_system_table_t *, efi_char16_t *); diff --git a/drivers/firmware/efi/efi-stub-helper.c b/drivers/firmware/efi/efi-stub-helper.c index a028287..be58a18 100644 --- a/drivers/firmware/efi/efi-stub-helper.c +++ b/drivers/firmware/efi/efi-stub-helper.c @@ -53,22 +53,22 @@ again: * allocation which may be in a new descriptor region. */ *map_size += sizeof(*m); - status = efi_early->call(efi_early->allocate_pool, EFI_LOADER_DATA, + status = efi_early_call(allocate_pool, EFI_LOADER_DATA, *map_size, (void **)&m); if (status != EFI_SUCCESS) goto fail; *desc_size = 0; key = 0; - status = efi_early->call(efi_early->get_memory_map, map_size, m, + status = efi_early_call(get_memory_map, map_size, m, &key, desc_size, &desc_version); if (status == EFI_BUFFER_TOO_SMALL) { - efi_early->call(efi_early->free_pool, m); + efi_early_call(free_pool, m); goto again; } if (status != EFI_SUCCESS) - efi_early->call(efi_early->free_pool, m); + efi_early_call(free_pool, m); if (key_ptr && status == EFI_SUCCESS) *key_ptr = key; @@ -149,7 +149,7 @@ again: if (!max_addr) status = EFI_NOT_FOUND; else { - status = efi_early->call(efi_early->allocate_pages, + status = efi_early_call(allocate_pages, EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA, nr_pages, &max_addr); if (status != EFI_SUCCESS) { @@ -161,7 +161,7 @@ again: *addr = max_addr; } - efi_early->call(efi_early->free_pool, map); + efi_early_call(free_pool, map); fail: return status; } @@ -221,7 +221,7 @@ static efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg, if ((start + size) > end) continue; - status = efi_early->call(efi_early->allocate_pages, + status = efi_early_call(allocate_pages, EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA, nr_pages, &start); if (status == EFI_SUCCESS) { @@ -233,7 +233,7 @@ static efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg, if (i == map_size / desc_size) status = EFI_NOT_FOUND; - efi_early->call(efi_early->free_pool, map); + efi_early_call(free_pool, map); fail: return status; } @@ -247,7 +247,7 @@ static void efi_free(efi_system_table_t *sys_table_arg, unsigned long size, return; nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE; - efi_early->call(efi_early->free_pages, addr, nr_pages); + efi_early_call(free_pages, addr, nr_pages); } @@ -307,7 +307,7 @@ static efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg, if (!nr_files) return EFI_SUCCESS; - status = efi_early->call(efi_early->allocate_pool, EFI_LOADER_DATA, + status = efi_early_call(allocate_pool, EFI_LOADER_DATA, nr_files * sizeof(*files), (void **)&files); if (status != EFI_SUCCESS) { efi_printk(sys_table_arg, "Failed to alloc mem for file handle list\n"); @@ -413,7 +413,7 @@ static efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg, } - efi_early->call(efi_early->free_pool, files); + efi_early_call(free_pool, files); *load_addr = file_addr; *load_size = file_size_total; @@ -427,7 +427,7 @@ close_handles: for (k = j; k < i; k++) efi_file_close(fh, files[k].handle); free_files: - efi_early->call(efi_early->free_pool, files); + efi_early_call(free_pool, files); fail: *load_addr = 0; *load_size = 0; @@ -473,7 +473,7 @@ static efi_status_t efi_relocate_kernel(efi_system_table_t *sys_table_arg, * as possible while respecting the required alignment. */ nr_pages = round_up(alloc_size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE; - status = efi_early->call(efi_early->allocate_pages, + status = efi_early_call(allocate_pages, EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA, nr_pages, &efi_addr); new_addr = efi_addr;