linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: roy.franz@linaro.org (Roy Franz)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/7] Add proper definitions for some EFI function pointers.
Date: Fri,  2 Aug 2013 14:29:05 -0700	[thread overview]
Message-ID: <1375478948-22562-5-git-send-email-roy.franz@linaro.org> (raw)
In-Reply-To: <1375478948-22562-1-git-send-email-roy.franz@linaro.org>

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 <roy.franz@linaro.org>
---
 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;
 };
 
-- 
1.7.10.4

  parent reply	other threads:[~2013-08-02 21:29 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-02 21:29 [PATCH 0/7] RFC: EFI stub for ARM Roy Franz
2013-08-02 21:29 ` [PATCH 1/7] EFI stub documentation updates Roy Franz
2013-08-05 14:12   ` Dave Martin
2013-08-05 23:56     ` Roy Franz
2013-08-06 10:30       ` Dave P Martin
2013-08-02 21:29 ` [PATCH 2/7] Move common EFI stub code from x86 arch code to common location Roy Franz
2013-08-06 13:53   ` Matt Fleming
2013-08-02 21:29 ` [PATCH 3/7] Change EFI helper APIs to be more flexible Roy Franz
2013-08-06 13:53   ` Matt Fleming
2013-08-02 21:29 ` Roy Franz [this message]
2013-08-06 13:19   ` [PATCH 4/7] Add proper definitions for some EFI function pointers Matt Fleming
2013-08-02 21:29 ` [PATCH 5/7] Add strstr to compressed string.c for ARM Roy Franz
2013-08-02 21:29 ` [PATCH 6/7] Add EFI stub " Roy Franz
2013-08-05 14:11   ` Dave Martin
2013-08-05 15:33     ` Leif Lindholm
2013-08-06  0:06       ` Roy Franz
2013-08-06 10:40         ` Dave P Martin
2013-08-06 10:31       ` Dave P Martin
2013-08-06  3:35     ` Roy Franz
2013-08-02 21:29 ` [PATCH 7/7] Add config EFI_STUB " Roy Franz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1375478948-22562-5-git-send-email-roy.franz@linaro.org \
    --to=roy.franz@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).