From patchwork Wed Aug 7 03:45:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Franz X-Patchwork-Id: 2839765 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 63557BF535 for ; Wed, 7 Aug 2013 04:05:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CF0CD201B7 for ; Wed, 7 Aug 2013 04:05:45 +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 7597820122 for ; Wed, 7 Aug 2013 04:05:44 +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 1V6ujl-0004C0-He; Wed, 07 Aug 2013 03:48:39 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V6uim-0001TN-LW; Wed, 07 Aug 2013 03:47:36 +0000 Received: from mail-ye0-f169.google.com ([209.85.213.169]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V6uhD-0001E5-FV for linux-arm-kernel@lists.infradead.org; Wed, 07 Aug 2013 03:46:06 +0000 Received: by mail-ye0-f169.google.com with SMTP id r13so402411yen.0 for ; Tue, 06 Aug 2013 20:45:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Z9V8WERUQR1IqiVYhG0SGX5ScAI+SlaheFXV3aORgyQ=; b=Bn4V7wxniRVdyPZDlN9vjMT9OiezTci0O+8riLMAA1JEIGyzPFFn9krkkahzuxh8Eg wNbbBrXe//5yo7u/vAwwodV8ao/gftpHNhZ1sMQZCRUC4pe3GXAm9cxX0DbHJ9dcNcDx njt0+QVnXQQE2acjyit/dH9lFzq0oYD8gfNZWsqQw5JmNdHGPtUE9Angewip7yti9Lc7 WtS3KYyhZ+RDCZjrBxnstMutKYfJ3iot9rm+nZD8o86zEgQQj8fPvS7gbeqbADmP0ERH Pj3BFoZt30oM2ht0emOimnLooIj7pRrjiR7lUXa0xB6EMr2ZmrGAFVV0EYX9AeC6L/5Z pmXw== X-Gm-Message-State: ALoCoQm+UBSF56X4WKTY/wGJKNfGUrP6O/BM3yBl0vKe0bKyRHtPfiHXKSEWe+dTncLuoaP8SQ01 X-Received: by 10.236.147.139 with SMTP id t11mr710017yhj.135.1375847138111; Tue, 06 Aug 2013 20:45:38 -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 s65sm6814380yhs.14.2013.08.06.20.45.36 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 Aug 2013 20:45:37 -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 12/17] Add proper definitions for some EFI function pointers. Date: Tue, 6 Aug 2013 20:45:08 -0700 Message-Id: <1375847113-24884-13-git-send-email-roy.franz@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1375847113-24884-1-git-send-email-roy.franz@linaro.org> References: <1375847113-24884-1-git-send-email-roy.franz@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130806_234559_629400_0210A5E8 X-CRM114-Status: GOOD ( 10.11 ) X-Spam-Score: -2.6 (--) Cc: Roy Franz , dave.martin@arm.com, 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=-4.2 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 | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/include/linux/efi.h b/include/linux/efi.h index 51f5641..96bb866 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,7 @@ typedef struct { #define EFI_MEMORY_DESCRIPTOR_VERSION 1 #define EFI_PAGE_SHIFT 12 +#define EFI_PAGE_SIZE (1UL << EFI_PAGE_SHIFT) typedef struct { u32 type; @@ -157,11 +160,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 +175,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 +185,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 +492,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 +504,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 +795,7 @@ struct efivar_entry { struct efi_simple_text_output_protocol { void *reset; - void *output_string; + int (*output_string)(void *, void *); void *test_string; };