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

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