From patchwork Fri Aug 2 21:29:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Franz X-Patchwork-Id: 2838190 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E587E9F495 for ; Fri, 2 Aug 2013 21:32:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E9CFC20438 for ; Fri, 2 Aug 2013 21:32:17 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 819CA20435 for ; Fri, 2 Aug 2013 21:32:16 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V5MwC-00071m-VY; Fri, 02 Aug 2013 21:31:05 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V5Mvi-0007Fy-1S; Fri, 02 Aug 2013 21:30:34 +0000 Received: from mail-pa0-f48.google.com ([209.85.220.48]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V5Mus-000789-Py for linux-arm-kernel@lists.infradead.org; Fri, 02 Aug 2013 21:29:53 +0000 Received: by mail-pa0-f48.google.com with SMTP id kp13so1098979pab.7 for ; Fri, 02 Aug 2013 14:29:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=AhYucwMJkIbyjLbfw2AJKCC6AwXFx+NilztHBogDMv8=; b=VteEQf2t7NXZC61/SxDKYGki778Wpm5lvHQIJIkeOAe/ShgC5mBFWES0zQQtLazADH JDDpzMpagMFPFcOCSUkp7X4KEQyIpt2+XnZgIz07QH9jJGexGpMnrceIGl/Z+Wm1u/Hw CP7fH85/pKLLRxjUqOzUDhvPDfbx0orx1p8czAU4D0ft+uxLRwIKxFBhnwPCHQNlFOUs LxZR35GmV6+Yf7C98NZF5cXEJ1LuOnkF1H3fPzH9DbjTcdX5XMCrEyc73VV8Am8+iP8x v5z+XoeF/4Ty3to9uzaydIvU/wg2rN3RZxuxqYkSaHHzx2oc60AXGXjK7wr/YNhA22fO Fimw== X-Received: by 10.66.175.133 with SMTP id ca5mr12762183pac.40.1375478961336; Fri, 02 Aug 2013 14:29:21 -0700 (PDT) Received: from rfranz-i7.local (c-24-10-48-230.hsd1.ca.comcast.net. [24.10.48.230]) by mx.google.com with ESMTPSA id aj3sm12570219pad.8.2013.08.02.14.29.19 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 02 Aug 2013 14:29:20 -0700 (PDT) From: Roy Franz To: linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, matt.fleming@intel.com, linux@arm.linux.org.uk Subject: [PATCH 4/7] Add proper definitions for some EFI function pointers. Date: Fri, 2 Aug 2013 14:29:05 -0700 Message-Id: <1375478948-22562-5-git-send-email-roy.franz@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1375478948-22562-1-git-send-email-roy.franz@linaro.org> References: <1375478948-22562-1-git-send-email-roy.franz@linaro.org> X-Gm-Message-State: ALoCoQkCAmydk4QvhmvJZzuB9bjAJB48/iaBYJXX7kH7e5bQ6aUVhOgV0IqcBqHxNCsuym63BfUE X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130802_172942_976752_D7DCBEE2 X-CRM114-Status: GOOD ( 10.74 ) X-Spam-Score: -2.6 (--) Cc: Roy Franz , leif.lindholm@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The x86/AMD64 EFI stubs must us a call wrapper to convert between the Linux and EFI ABIs, so void pointers are sufficient. For ARM, the ABIs are compatible, so we can directly invoke the function pointers. The functions that are used by the ARM stub are updated to match the EFI definitions. Signed-off-by: Roy Franz --- include/linux/efi.h | 61 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 17 deletions(-) diff --git a/include/linux/efi.h b/include/linux/efi.h index 51f5641..779ec8c 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -39,6 +39,8 @@ typedef unsigned long efi_status_t; typedef u8 efi_bool_t; typedef u16 efi_char16_t; /* UNICODE character */ +typedef u64 efi_physical_addr_t; +typedef void *efi_handle_t; typedef struct { @@ -96,6 +98,26 @@ typedef struct { #define EFI_MEMORY_DESCRIPTOR_VERSION 1 #define EFI_PAGE_SHIFT 12 +#define EFI_PAGE_SIZE (1UL << EFI_PAGE_SHIFT) + +typedef enum { + EfiReservedMemoryType, + EfiLoaderCode, + EfiLoaderData, + EfiBootServicesCode, + EfiBootServicesData, + EfiRuntimeServicesCode, + EfiRuntimeServicesData, + EfiConventionalMemory, + EfiUnusableMemory, + EfiACPIReclaimMemory, + EfiACPIMemoryNVS, + EfiMemoryMappedIO, + EfiMemoryMappedIOPortSpace, + EfiPalCode, + EfiMaxMemoryType +} EFI_MEMORY_TYPE; + typedef struct { u32 type; @@ -157,11 +179,12 @@ typedef struct { efi_table_hdr_t hdr; void *raise_tpl; void *restore_tpl; - void *allocate_pages; - void *free_pages; - void *get_memory_map; - void *allocate_pool; - void *free_pool; + int (*allocate_pages)(int, int, unsigned long, efi_physical_addr_t *); + int (*free_pages)(efi_physical_addr_t, unsigned long); + int (*get_memory_map)(unsigned long *, void *, unsigned long *, + unsigned long *, u32 *); + int (*allocate_pool)(int, unsigned long, void **); + int (*free_pool)(void *); void *create_event; void *set_timer; void *wait_for_event; @@ -171,7 +194,7 @@ typedef struct { void *install_protocol_interface; void *reinstall_protocol_interface; void *uninstall_protocol_interface; - void *handle_protocol; + int (*handle_protocol)(efi_handle_t, efi_guid_t *, void **); void *__reserved; void *register_protocol_notify; void *locate_handle; @@ -181,7 +204,7 @@ typedef struct { void *start_image; void *exit; void *unload_image; - void *exit_boot_services; + int (*exit_boot_services)(efi_handle_t, unsigned long); void *get_next_monotonic_count; void *stall; void *set_watchdog_timer; @@ -488,10 +511,6 @@ typedef struct { unsigned long unload; } efi_loaded_image_t; -typedef struct { - u64 revision; - void *open_volume; -} efi_file_io_interface_t; typedef struct { u64 size; @@ -504,20 +523,28 @@ typedef struct { efi_char16_t filename[1]; } efi_file_info_t; -typedef struct { +typedef struct _efi_file_handle { u64 revision; - void *open; - void *close; + int (*open)(struct _efi_file_handle *, struct _efi_file_handle **, + efi_char16_t *, u64, u64); + int (*close)(struct _efi_file_handle *); void *delete; - void *read; + int (*read)(struct _efi_file_handle *, unsigned long *, void *); void *write; void *get_position; void *set_position; - void *get_info; + int (*get_info)(struct _efi_file_handle *, efi_guid_t *, + unsigned long *, void *); void *set_info; void *flush; } efi_file_handle_t; +typedef struct _efi_file_io_interface { + u64 revision; + int (*open_volume)(struct _efi_file_io_interface *, + efi_file_handle_t **); +} efi_file_io_interface_t; + #define EFI_FILE_MODE_READ 0x0000000000000001 #define EFI_FILE_MODE_WRITE 0x0000000000000002 #define EFI_FILE_MODE_CREATE 0x8000000000000000 @@ -787,7 +814,7 @@ struct efivar_entry { struct efi_simple_text_output_protocol { void *reset; - void *output_string; + int (*output_string)(void *, void *); void *test_string; };