All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 14/23] efi_loader: pass GUIDs as const efi_guid_t *
Date: Sun, 27 Aug 2017 00:53:23 +0200	[thread overview]
Message-ID: <20170826225328.7550-5-xypron.glpk@gmx.de> (raw)
In-Reply-To: <20170826225328.7550-1-xypron.glpk@gmx.de>

We need to call some boottime services internally.
Our GUIDs are stored as const efi_guid_t *.

The boottime services never change GUIDs.
So we can define the parameters as const efi_guid_t *.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 include/efi_api.h             | 44 +++++++++++++++++++++----------------------
 include/efi_loader.h          |  4 ++--
 lib/efi_loader/efi_boottime.c | 37 ++++++++++++++++++------------------
 3 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/include/efi_api.h b/include/efi_api.h
index ec1b321e8e..8efc8dfab8 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -74,25 +74,25 @@ struct efi_boot_services {
 	efi_status_t (EFIAPI *close_event)(struct efi_event *event);
 	efi_status_t (EFIAPI *check_event)(struct efi_event *event);
 #define EFI_NATIVE_INTERFACE	0x00000000
-	efi_status_t (EFIAPI *install_protocol_interface)(
-			void **handle, efi_guid_t *protocol,
+	efi_status_t (EFIAPI * install_protocol_interface)(
+			void **handle, const efi_guid_t *protocol,
 			int protocol_interface_type, void *protocol_interface);
-	efi_status_t (EFIAPI *reinstall_protocol_interface)(
-			void *handle, efi_guid_t *protocol,
+	efi_status_t (EFIAPI * reinstall_protocol_interface)(
+			void *handle, const efi_guid_t *protocol,
 			void *old_interface, void *new_interface);
-	efi_status_t (EFIAPI *uninstall_protocol_interface)(void *handle,
-			efi_guid_t *protocol, void *protocol_interface);
-	efi_status_t (EFIAPI *handle_protocol)(efi_handle_t, efi_guid_t *,
-					       void **);
+	efi_status_t (EFIAPI * uninstall_protocol_interface)(void *handle,
+			const efi_guid_t *protocol, void *protocol_interface);
+	efi_status_t (EFIAPI * handle_protocol)(efi_handle_t,
+						const efi_guid_t *, void **);
 	void *reserved;
-	efi_status_t (EFIAPI *register_protocol_notify)(
-			efi_guid_t *protocol, struct efi_event *event,
+	efi_status_t (EFIAPI * register_protocol_notify)(
+			const efi_guid_t *protocol, struct efi_event *event,
 			void **registration);
-	efi_status_t (EFIAPI *locate_handle)(
+	efi_status_t (EFIAPI * locate_handle)(
 			enum efi_locate_search_type search_type,
-			efi_guid_t *protocol, void *search_key,
+			const efi_guid_t *protocol, void *search_key,
 			unsigned long *buffer_size, efi_handle_t *buffer);
-	efi_status_t (EFIAPI *locate_device_path)(efi_guid_t *protocol,
+	efi_status_t (EFIAPI * locate_device_path)(const efi_guid_t *protocol,
 			struct efi_device_path **device_path,
 			efi_handle_t *device);
 	efi_status_t (EFIAPI *install_configuration_table)(
@@ -128,25 +128,25 @@ struct efi_boot_services {
 #define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
 #define EFI_OPEN_PROTOCOL_BY_DRIVER           0x00000010
 #define EFI_OPEN_PROTOCOL_EXCLUSIVE           0x00000020
-	efi_status_t (EFIAPI *open_protocol)(efi_handle_t handle,
-			efi_guid_t *protocol, void **interface,
+	efi_status_t (EFIAPI * open_protocol)(efi_handle_t handle,
+			const efi_guid_t *protocol, void **interface,
 			efi_handle_t agent_handle,
 			efi_handle_t controller_handle, u32 attributes);
-	efi_status_t (EFIAPI *close_protocol)(void *handle,
-			efi_guid_t *protocol, void *agent_handle,
+	efi_status_t (EFIAPI * close_protocol)(void *handle,
+			const efi_guid_t *protocol, void *agent_handle,
 			void *controller_handle);
-	efi_status_t(EFIAPI *open_protocol_information)(efi_handle_t handle,
-			efi_guid_t *protocol,
+	efi_status_t(EFIAPI * open_protocol_information)(efi_handle_t handle,
+			const efi_guid_t *protocol,
 			struct efi_open_protocol_info_entry **entry_buffer,
 			unsigned long *entry_count);
 	efi_status_t (EFIAPI *protocols_per_handle)(efi_handle_t handle,
 			efi_guid_t ***protocol_buffer,
 			unsigned long *protocols_buffer_count);
-	efi_status_t (EFIAPI *locate_handle_buffer) (
+	efi_status_t (EFIAPI * locate_handle_buffer) (
 			enum efi_locate_search_type search_type,
-			efi_guid_t *protocol, void *search_key,
+			const efi_guid_t *protocol, void *search_key,
 			unsigned long *no_handles, efi_handle_t **buffer);
-	efi_status_t (EFIAPI *locate_protocol)(efi_guid_t *protocol,
+	efi_status_t (EFIAPI * locate_protocol)(const efi_guid_t *protocol,
 			void *registration, void **protocol_interface);
 	efi_status_t (EFIAPI *install_multiple_protocol_interfaces)(
 			void **handle, ...);
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 2a98bf66b8..9c68246c7c 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -182,12 +182,12 @@ efi_status_t efi_set_timer(struct efi_event *event, enum efi_timer_delay type,
 /* Call this to signal an event */
 void efi_signal_event(struct efi_event *event);
 /* Call this with EFI_CALL to close a protocol */
-efi_status_t EFIAPI efi_close_protocol(void *handle, efi_guid_t *protocol,
+efi_status_t EFIAPI efi_close_protocol(void *handle, const efi_guid_t *protocol,
 				       void *agent_handle,
 				       void *controller_handle);
 /* Call this with EFI_CALL to open a protocol */
 efi_status_t EFIAPI efi_open_protocol(
-			void *handle, efi_guid_t *protocol,
+			void *handle, const efi_guid_t *protocol,
 			void **protocol_interface, void *agent_handle,
 			void *controller_handle, uint32_t attributes);
 
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index ad8733d3e5..5a73ea5cd0 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -470,7 +470,8 @@ static efi_status_t EFIAPI efi_check_event(struct efi_event *event)
 	return EFI_EXIT(EFI_INVALID_PARAMETER);
 }
 
-static efi_status_t efi_search_protocol(void *handle, efi_guid_t *protocol_guid,
+static efi_status_t efi_search_protocol(void *handle,
+					const efi_guid_t *protocol_guid,
 					struct efi_handler **handler)
 {
 	struct efi_object *efiobj;
@@ -496,7 +497,7 @@ static efi_status_t efi_search_protocol(void *handle, efi_guid_t *protocol_guid,
 }
 
 static efi_status_t EFIAPI efi_install_protocol_interface(void **handle,
-			efi_guid_t *protocol, int protocol_interface_type,
+			const efi_guid_t *protocol, int protocol_interface_type,
 			void *protocol_interface)
 {
 	int i;
@@ -551,7 +552,7 @@ out:
 }
 
 static efi_status_t EFIAPI efi_reinstall_protocol_interface(void *handle,
-			efi_guid_t *protocol, void *old_interface,
+			const efi_guid_t *protocol, void *old_interface,
 			void *new_interface)
 {
 	EFI_ENTRY("%p, %p, %p, %p", handle, protocol, old_interface,
@@ -560,7 +561,7 @@ static efi_status_t EFIAPI efi_reinstall_protocol_interface(void *handle,
 }
 
 static efi_status_t EFIAPI efi_uninstall_protocol_interface(void *handle,
-			efi_guid_t *protocol, void *protocol_interface)
+			const efi_guid_t *protocol, void *protocol_interface)
 {
 	struct efi_handler *handler;
 	efi_status_t r;
@@ -589,16 +590,16 @@ out:
 	return EFI_EXIT(r);
 }
 
-static efi_status_t EFIAPI efi_register_protocol_notify(efi_guid_t *protocol,
-							struct efi_event *event,
-							void **registration)
+static efi_status_t EFIAPI efi_register_protocol_notify(
+			const efi_guid_t *protocol, struct efi_event *event,
+			void **registration)
 {
 	EFI_ENTRY("%p, %p, %p", protocol, event, registration);
 	return EFI_EXIT(EFI_OUT_OF_RESOURCES);
 }
 
 static int efi_search(enum efi_locate_search_type search_type,
-		      efi_guid_t *protocol, void *search_key,
+		      const efi_guid_t *protocol, void *search_key,
 		      struct efi_object *efiobj)
 {
 	int i;
@@ -623,7 +624,7 @@ static int efi_search(enum efi_locate_search_type search_type,
 
 static efi_status_t efi_locate_handle(
 			enum efi_locate_search_type search_type,
-			efi_guid_t *protocol, void *search_key,
+			const efi_guid_t *protocol, void *search_key,
 			unsigned long *buffer_size, efi_handle_t *buffer)
 {
 	struct efi_object *efiobj;
@@ -680,7 +681,7 @@ static efi_status_t efi_locate_handle(
 
 static efi_status_t EFIAPI efi_locate_handle_ext(
 			enum efi_locate_search_type search_type,
-			efi_guid_t *protocol, void *search_key,
+			const efi_guid_t *protocol, void *search_key,
 			unsigned long *buffer_size, efi_handle_t *buffer)
 {
 	EFI_ENTRY("%d, %p, %p, %p, %p", search_type, protocol, search_key,
@@ -690,7 +691,7 @@ static efi_status_t EFIAPI efi_locate_handle_ext(
 			buffer_size, buffer));
 }
 
-static efi_status_t EFIAPI efi_locate_device_path(efi_guid_t *protocol,
+static efi_status_t EFIAPI efi_locate_device_path(const efi_guid_t *protocol,
 			struct efi_device_path **device_path,
 			efi_handle_t *device)
 {
@@ -939,7 +940,7 @@ static efi_status_t EFIAPI efi_disconnect_controller(void *controller_handle,
 	return EFI_EXIT(EFI_INVALID_PARAMETER);
 }
 
-efi_status_t EFIAPI efi_close_protocol(void *handle, efi_guid_t *protocol,
+efi_status_t EFIAPI efi_close_protocol(void *handle, const efi_guid_t *protocol,
 				       void *agent_handle,
 				       void *controller_handle)
 {
@@ -980,7 +981,7 @@ out:
 }
 
 static efi_status_t EFIAPI efi_open_protocol_information(efi_handle_t handle,
-			efi_guid_t *protocol,
+			const efi_guid_t *protocol,
 			struct efi_open_protocol_info_entry **entry_buffer,
 			unsigned long *entry_count)
 {
@@ -1097,7 +1098,7 @@ static efi_status_t EFIAPI efi_protocols_per_handle(void *handle,
 
 static efi_status_t EFIAPI efi_locate_handle_buffer(
 			enum efi_locate_search_type search_type,
-			efi_guid_t *protocol, void *search_key,
+			const efi_guid_t *protocol, void *search_key,
 			unsigned long *no_handles, efi_handle_t **buffer)
 {
 	efi_status_t r;
@@ -1128,7 +1129,7 @@ out:
 	return EFI_EXIT(r);
 }
 
-static efi_status_t EFIAPI efi_locate_protocol(efi_guid_t *protocol,
+static efi_status_t EFIAPI efi_locate_protocol(const efi_guid_t *protocol,
 					       void *registration,
 					       void **protocol_interface)
 {
@@ -1167,7 +1168,7 @@ static efi_status_t EFIAPI efi_install_multiple_protocol_interfaces(
 	EFI_ENTRY("%p", handle);
 
 	va_list argptr;
-	efi_guid_t *protocol;
+	const efi_guid_t *protocol;
 	void *protocol_interface;
 	efi_status_t r = EFI_SUCCESS;
 	int i = 0;
@@ -1326,7 +1327,7 @@ static efi_status_t efi_protocol_open(
 }
 
 efi_status_t EFIAPI efi_open_protocol(
-			void *handle, efi_guid_t *protocol,
+			void *handle, const efi_guid_t *protocol,
 			void **protocol_interface, void *agent_handle,
 			void *controller_handle, uint32_t attributes)
 {
@@ -1372,7 +1373,7 @@ out:
 }
 
 static efi_status_t EFIAPI efi_handle_protocol(void *handle,
-					       efi_guid_t *protocol,
+					       const efi_guid_t *protocol,
 					       void **protocol_interface)
 {
 	return efi_open_protocol(handle, protocol, protocol_interface, NULL,
-- 
2.14.1

  parent reply	other threads:[~2017-08-26 22:53 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-26 22:51 [U-Boot] [PATCH 00/23] efi_loader implement missing functions Heinrich Schuchardt
2017-08-26 22:51 ` [U-Boot] [PATCH 01/23] efi_loader: allow return value in EFI_CALL Heinrich Schuchardt
2017-08-31 12:51   ` Simon Glass
2017-08-31 13:58     ` Alexander Graf
2017-09-04  6:51       ` Simon Glass
2017-08-26 22:51 ` [U-Boot] [PATCH 02/23] efi_loader: notify when ExitBootServices is invoked Heinrich Schuchardt
2017-08-31 12:51   ` Simon Glass
2017-08-26 22:51 ` [U-Boot] [PATCH 03/23] efi_loader: support 16 protocols per efi_object Heinrich Schuchardt
2017-08-31 12:51   ` Simon Glass
2017-08-31 14:01   ` Alexander Graf
2017-09-01  1:45     ` Heinrich Schuchardt
2017-09-01  8:15       ` Alexander Graf
2017-09-02 18:14     ` Rob Clark
2017-09-02 22:26       ` Alexander Graf
2017-08-26 22:51 ` [U-Boot] [PATCH 04/23] efi_loader: rework efi_locate_handle Heinrich Schuchardt
2017-08-31 12:51   ` Simon Glass
2017-08-26 22:51 ` [U-Boot] [PATCH 05/23] efi_loader: rework efi_search_obj Heinrich Schuchardt
2017-08-31 12:51   ` Simon Glass
2017-08-26 22:51 ` [U-Boot] [PATCH 06/23] efi_loader: new function efi_search_protocol Heinrich Schuchardt
2017-08-31 12:51   ` Simon Glass
2017-08-26 22:51 ` [U-Boot] [PATCH 07/23] efi_loader: simplify efi_install_protocol_interface Heinrich Schuchardt
2017-08-31 12:51   ` Simon Glass
2017-08-26 22:51 ` [U-Boot] [PATCH 08/23] efi_loader: allow creating new handles Heinrich Schuchardt
2017-08-31 12:51   ` Simon Glass
2017-09-07 19:20     ` Rob Clark
2017-08-26 22:51 ` [U-Boot] [PATCH 09/23] efi_loader: simplify efi_uninstall_protocol_interface Heinrich Schuchardt
2017-08-31 12:51   ` Simon Glass
2017-08-26 22:53 ` [U-Boot] [PATCH 10/23] efi_loader: open_info in OpenProtocol Heinrich Schuchardt
2017-08-26 22:53   ` [U-Boot] [PATCH 11/23] efi_loader: open_info in CloseProtocol Heinrich Schuchardt
2017-08-31 12:51     ` Simon Glass
2017-08-26 22:53   ` [U-Boot] [PATCH 12/23] efi_loader: implement OpenProtocolInformation Heinrich Schuchardt
2017-08-31 12:51     ` Simon Glass
2017-08-31 17:39       ` Heinrich Schuchardt
2017-08-26 22:53   ` [U-Boot] [PATCH 13/23] efi_loader: non-static efi_open_protocol, efi_close_protocol Heinrich Schuchardt
2017-08-31 12:51     ` Simon Glass
2017-08-26 22:53   ` Heinrich Schuchardt [this message]
2017-08-31 12:51     ` [U-Boot] [PATCH 14/23] efi_loader: pass GUIDs as const efi_guid_t * Simon Glass
2017-08-26 22:53   ` [U-Boot] [PATCH 15/23] efi_loader: implement ConnectController Heinrich Schuchardt
2017-08-31 12:52     ` Simon Glass
2017-09-15  6:48       ` Heinrich Schuchardt
2017-09-20 13:49         ` Simon Glass
2017-09-15  7:45       ` [U-Boot] [PATCH 1/1] efi_loader: provide comment for protocol GUIDs Heinrich Schuchardt
2017-09-25  2:11         ` Simon Glass
2017-08-26 22:53   ` [U-Boot] [PATCH 16/23] efi_loader: implement DisconnectController Heinrich Schuchardt
2017-08-31 12:52     ` Simon Glass
2017-09-15  6:35       ` Heinrich Schuchardt
2017-09-20 13:49         ` Simon Glass
2017-09-20 14:23           ` Rob Clark
2017-09-21  4:58             ` Simon Glass
2017-08-26 22:53   ` [U-Boot] [PATCH 17/23] efi_loader: efi_net: hwaddr_size = 6 Heinrich Schuchardt
2017-08-31 12:52     ` Simon Glass
2017-08-26 22:53   ` [U-Boot] [PATCH 18/23] efi_net: return EFI_UNSUPPORTED where appropriate Heinrich Schuchardt
2017-08-31 12:52     ` Simon Glass
2017-08-26 22:53   ` [U-Boot] [PATCH 19/23] efi_loader: correct bits of receive_filters bit mask Heinrich Schuchardt
2017-08-31 12:52     ` Simon Glass
2017-08-31 12:51   ` [U-Boot] [PATCH 10/23] efi_loader: open_info in OpenProtocol Simon Glass
2017-08-26 22:54 ` [U-Boot] [PATCH 20/23] efi_loader: use events for efi_net_receive Heinrich Schuchardt
2017-08-26 22:54   ` [U-Boot] [PATCH 21/23] efi_loader: fix efi_net_get_status Heinrich Schuchardt
2017-08-31 12:52     ` Simon Glass
2017-08-26 22:54   ` [U-Boot] [PATCH 22/23] efi_loader: set parent handle in efi_load_image Heinrich Schuchardt
2017-08-31 12:52     ` Simon Glass
2017-08-26 22:54   ` [U-Boot] [PATCH 23/23] efi_loader: implement SetWatchdogTimer Heinrich Schuchardt
2017-08-31 12:52     ` Simon Glass
2017-08-31 12:52   ` [U-Boot] [PATCH 20/23] efi_loader: use events for efi_net_receive Simon Glass
2017-08-27 20:10 ` [U-Boot] [PATCH 00/23] efi_loader implement missing functions Simon Glass
2017-08-29 10:52   ` Heinrich Schuchardt
2017-08-29 11:45     ` Alexander Graf
2017-08-29 12:17       ` Rob Clark
2017-08-29 12:26         ` Alexander Graf
2017-08-29 12:57           ` Leif Lindholm
2017-08-29 14:16             ` Rob Clark
2017-08-29 17:11               ` Heinrich Schuchardt
2017-08-29 20:16               ` Simon Glass
2017-08-29 20:38                 ` Alexander Graf
2017-08-29 22:03                   ` Heinrich Schuchardt
2017-08-30  7:59                     ` Leif Lindholm
2017-08-31 14:45                       ` Leif Lindholm
2017-09-01 12:54                         ` Rob Clark
2017-09-01 13:05                         ` Rob Clark
2017-08-30  9:36                     ` Simon Glass
2017-09-01 14:45                 ` Tom Rini
2017-09-05  8:55                   ` Simon Glass
2017-09-05 23:48                     ` Rob Clark
2017-09-06  4:18                       ` Heinrich Schuchardt
2017-09-06 10:54                         ` Rob Clark
2017-08-29 15:59             ` Heinrich Schuchardt
2017-08-29 16:06               ` Leif Lindholm
2017-08-29 16:13                 ` Alexander Graf
2017-08-29 12:22     ` Simon Glass

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=20170826225328.7550-5-xypron.glpk@gmx.de \
    --to=xypron.glpk@gmx.de \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.