Blame SOURCES/0065-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch

5593c8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
5593c8
From: Peter Jones <pjones@redhat.com>
5593c8
Date: Thu, 1 Jun 2017 09:59:56 -0400
5593c8
Subject: [PATCH] Add grub_efi_allocate_pool() and grub_efi_free_pool()
5593c8
 wrappers.
5593c8
5593c8
Signed-off-by: Peter Jones <pjones@redhat.com>
5593c8
---
5593c8
 include/grub/efi/efi.h | 36 ++++++++++++++++++++++++++++++++----
5593c8
 1 file changed, 32 insertions(+), 4 deletions(-)
5593c8
5593c8
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
1c6ba0
index 585fa6662b..03f9a9d011 100644
5593c8
--- a/include/grub/efi/efi.h
5593c8
+++ b/include/grub/efi/efi.h
5593c8
@@ -24,6 +24,10 @@
5593c8
 #include <grub/dl.h>
5593c8
 #include <grub/efi/api.h>
5593c8
 
5593c8
+/* Variables.  */
5593c8
+extern grub_efi_system_table_t *EXPORT_VAR(grub_efi_system_table);
5593c8
+extern grub_efi_handle_t EXPORT_VAR(grub_efi_image_handle);
5593c8
+
5593c8
 /* Functions.  */
5593c8
 void *EXPORT_FUNC(grub_efi_locate_protocol) (grub_efi_guid_t *protocol,
5593c8
 					     void *registration);
5593c8
@@ -60,6 +64,33 @@ EXPORT_FUNC(grub_efi_get_memory_map) (grub_efi_uintn_t *memory_map_size,
5593c8
 				      grub_efi_uintn_t *descriptor_size,
5593c8
 				      grub_efi_uint32_t *descriptor_version);
5593c8
 void grub_efi_memory_fini (void);
5593c8
+
5593c8
+static inline grub_efi_status_t
5593c8
+__attribute__((__unused__))
5593c8
+grub_efi_allocate_pool (grub_efi_memory_type_t pool_type,
5593c8
+			grub_efi_uintn_t buffer_size,
5593c8
+			void **buffer)
5593c8
+{
5593c8
+  grub_efi_boot_services_t *b;
5593c8
+  grub_efi_status_t status;
5593c8
+
5593c8
+  b = grub_efi_system_table->boot_services;
5593c8
+  status = efi_call_3 (b->allocate_pool, pool_type, buffer_size, buffer);
5593c8
+  return status;
5593c8
+}
5593c8
+
5593c8
+static inline grub_efi_status_t
5593c8
+__attribute__((__unused__))
5593c8
+grub_efi_free_pool (void *buffer)
5593c8
+{
5593c8
+  grub_efi_boot_services_t *b;
5593c8
+  grub_efi_status_t status;
5593c8
+
5593c8
+  b = grub_efi_system_table->boot_services;
5593c8
+  status = efi_call_1 (b->free_pool, buffer);
5593c8
+  return status;
5593c8
+}
5593c8
+
5593c8
 grub_efi_loaded_image_t *EXPORT_FUNC(grub_efi_get_loaded_image) (grub_efi_handle_t image_handle);
5593c8
 void EXPORT_FUNC(grub_efi_print_device_path) (grub_efi_device_path_t *dp);
5593c8
 char *EXPORT_FUNC(grub_efi_get_filename) (grub_efi_device_path_t *dp);
5593c8
@@ -115,10 +146,7 @@ void grub_efi_init (void);
5593c8
 void grub_efi_fini (void);
5593c8
 void grub_efi_set_prefix (void);
5593c8
 
5593c8
-/* Variables.  */
5593c8
-extern grub_efi_system_table_t *EXPORT_VAR(grub_efi_system_table);
5593c8
-extern grub_efi_handle_t EXPORT_VAR(grub_efi_image_handle);
5593c8
-
5593c8
+/* More variables.  */
5593c8
 extern int EXPORT_VAR(grub_efi_is_finished);
5593c8
 
5593c8
 struct grub_net_card;