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

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