92 lines
3.3 KiB
Diff
92 lines
3.3 KiB
Diff
|
From 7916d7c3a1e92dfbd8720a6275d7f23025abe612 Mon Sep 17 00:00:00 2001
|
||
|
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
|
||
|
Date: Tue, 26 Mar 2013 11:34:56 +0100
|
||
|
Subject: [PATCH 236/364] * grub-core/kern/efi/mm.c
|
||
|
(grub_efi_finish_boot_services): Try terminating EFI services several
|
||
|
times due to quirks in some implementations.
|
||
|
|
||
|
---
|
||
|
ChangeLog | 6 ++++++
|
||
|
grub-core/kern/efi/mm.c | 46 ++++++++++++++++++++++++++++++----------------
|
||
|
2 files changed, 36 insertions(+), 16 deletions(-)
|
||
|
|
||
|
diff --git a/ChangeLog b/ChangeLog
|
||
|
index 07a69bc..58c2242 100644
|
||
|
--- a/ChangeLog
|
||
|
+++ b/ChangeLog
|
||
|
@@ -1,3 +1,9 @@
|
||
|
+2013-03-26 Vladimir Serbinenko <phcoder@gmail.com>
|
||
|
+
|
||
|
+ * grub-core/kern/efi/mm.c (grub_efi_finish_boot_services):
|
||
|
+ Try terminating EFI services several times due to quirks in some
|
||
|
+ implementations.
|
||
|
+
|
||
|
2013-03-26 Colin Watson <cjwatson@ubuntu.com>
|
||
|
|
||
|
* grub-core/commands/acpihalt.c (skip_ext_op): Add support for
|
||
|
diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
|
||
|
index 351317b..77c9384 100644
|
||
|
--- a/grub-core/kern/efi/mm.c
|
||
|
+++ b/grub-core/kern/efi/mm.c
|
||
|
@@ -160,27 +160,41 @@ grub_efi_finish_boot_services (grub_efi_uintn_t *outbuf_size, void *outbuf,
|
||
|
apple, sizeof (apple)) == 0);
|
||
|
#endif
|
||
|
|
||
|
- if (grub_efi_get_memory_map (&finish_mmap_size, finish_mmap_buf, &finish_key,
|
||
|
- &finish_desc_size, &finish_desc_version) < 0)
|
||
|
- return grub_error (GRUB_ERR_IO, "couldn't retrieve memory map");
|
||
|
+ while (1)
|
||
|
+ {
|
||
|
+ if (grub_efi_get_memory_map (&finish_mmap_size, finish_mmap_buf, &finish_key,
|
||
|
+ &finish_desc_size, &finish_desc_version) < 0)
|
||
|
+ return grub_error (GRUB_ERR_IO, "couldn't retrieve memory map");
|
||
|
|
||
|
- if (outbuf && *outbuf_size < finish_mmap_size)
|
||
|
- return grub_error (GRUB_ERR_IO, "memory map buffer is too small");
|
||
|
+ if (outbuf && *outbuf_size < finish_mmap_size)
|
||
|
+ return grub_error (GRUB_ERR_IO, "memory map buffer is too small");
|
||
|
|
||
|
- finish_mmap_buf = grub_malloc (finish_mmap_size);
|
||
|
- if (!finish_mmap_buf)
|
||
|
- return grub_errno;
|
||
|
+ finish_mmap_buf = grub_malloc (finish_mmap_size);
|
||
|
+ if (!finish_mmap_buf)
|
||
|
+ return grub_errno;
|
||
|
|
||
|
- if (grub_efi_get_memory_map (&finish_mmap_size, finish_mmap_buf, &finish_key,
|
||
|
- &finish_desc_size, &finish_desc_version) <= 0)
|
||
|
- return grub_error (GRUB_ERR_IO, "couldn't retrieve memory map");
|
||
|
+ if (grub_efi_get_memory_map (&finish_mmap_size, finish_mmap_buf, &finish_key,
|
||
|
+ &finish_desc_size, &finish_desc_version) <= 0)
|
||
|
+ {
|
||
|
+ grub_free (finish_mmap_buf);
|
||
|
+ return grub_error (GRUB_ERR_IO, "couldn't retrieve memory map");
|
||
|
+ }
|
||
|
|
||
|
- b = grub_efi_system_table->boot_services;
|
||
|
- status = efi_call_2 (b->exit_boot_services, grub_efi_image_handle,
|
||
|
- finish_key);
|
||
|
- if (status != GRUB_EFI_SUCCESS)
|
||
|
- return grub_error (GRUB_ERR_IO, "couldn't terminate EFI services");
|
||
|
+ b = grub_efi_system_table->boot_services;
|
||
|
+ status = efi_call_2 (b->exit_boot_services, grub_efi_image_handle,
|
||
|
+ finish_key);
|
||
|
+ if (status == GRUB_EFI_SUCCESS)
|
||
|
+ break;
|
||
|
|
||
|
+ if (status != GRUB_EFI_INVALID_PARAMETER)
|
||
|
+ {
|
||
|
+ grub_free (finish_mmap_buf);
|
||
|
+ return grub_error (GRUB_ERR_IO, "couldn't terminate EFI services");
|
||
|
+ }
|
||
|
+
|
||
|
+ grub_free (finish_mmap_buf);
|
||
|
+ grub_printf ("Trying to terminate EFI services again\n");
|
||
|
+ }
|
||
|
grub_efi_is_finished = 1;
|
||
|
if (outbuf_size)
|
||
|
*outbuf_size = finish_mmap_size;
|
||
|
--
|
||
|
1.8.1.4
|
||
|
|