diff options
Diffstat (limited to 'meta/recipes-bsp/grub/files/0001-grub-core-kern-efi-mm.c-grub_efi_finish_boot_service.patch')
-rw-r--r-- | meta/recipes-bsp/grub/files/0001-grub-core-kern-efi-mm.c-grub_efi_finish_boot_service.patch | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/meta/recipes-bsp/grub/files/0001-grub-core-kern-efi-mm.c-grub_efi_finish_boot_service.patch b/meta/recipes-bsp/grub/files/0001-grub-core-kern-efi-mm.c-grub_efi_finish_boot_service.patch new file mode 100644 index 0000000000..abf08e16c9 --- /dev/null +++ b/meta/recipes-bsp/grub/files/0001-grub-core-kern-efi-mm.c-grub_efi_finish_boot_service.patch | |||
@@ -0,0 +1,79 @@ | |||
1 | From b258761d11946b28a847dff0768c3f271e13d60a Mon Sep 17 00:00:00 2001 | ||
2 | From: Awais Belal <awais_belal@mentor.com> | ||
3 | Date: Thu, 8 Dec 2016 18:21:12 +0500 | ||
4 | Subject: [PATCH 1/2] * grub-core/kern/efi/mm.c | ||
5 | (grub_efi_finish_boot_services): Try terminating EFI services several times | ||
6 | due to quirks in some implementations. | ||
7 | |||
8 | Upstream-status: Backport [ http://git.savannah.gnu.org/cgit/grub.git/patch/?id=e75fdee420a7ad95e9a465c9699adc2e2e970440 ] | ||
9 | |||
10 | Signed-off-by: Awais Belal <awais_belal@mentor.com> | ||
11 | --- | ||
12 | grub-core/kern/efi/mm.c | 46 ++++++++++++++++++++++++++++++---------------- | ||
13 | 1 file changed, 30 insertions(+), 16 deletions(-) | ||
14 | |||
15 | diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c | ||
16 | index 461deb0..b00e0bc 100644 | ||
17 | --- a/grub-core/kern/efi/mm.c | ||
18 | +++ b/grub-core/kern/efi/mm.c | ||
19 | @@ -167,27 +167,41 @@ grub_efi_finish_boot_services (grub_efi_uintn_t *outbuf_size, void *outbuf, | ||
20 | apple, sizeof (apple)) == 0); | ||
21 | #endif | ||
22 | |||
23 | - if (grub_efi_get_memory_map (&finish_mmap_size, finish_mmap_buf, &finish_key, | ||
24 | - &finish_desc_size, &finish_desc_version) < 0) | ||
25 | - return grub_error (GRUB_ERR_IO, "couldn't retrieve memory map"); | ||
26 | + while (1) | ||
27 | + { | ||
28 | + if (grub_efi_get_memory_map (&finish_mmap_size, finish_mmap_buf, &finish_key, | ||
29 | + &finish_desc_size, &finish_desc_version) < 0) | ||
30 | + return grub_error (GRUB_ERR_IO, "couldn't retrieve memory map"); | ||
31 | |||
32 | - if (outbuf && *outbuf_size < finish_mmap_size) | ||
33 | - return grub_error (GRUB_ERR_IO, "memory map buffer is too small"); | ||
34 | + if (outbuf && *outbuf_size < finish_mmap_size) | ||
35 | + return grub_error (GRUB_ERR_IO, "memory map buffer is too small"); | ||
36 | |||
37 | - finish_mmap_buf = grub_malloc (finish_mmap_size); | ||
38 | - if (!finish_mmap_buf) | ||
39 | - return grub_errno; | ||
40 | + finish_mmap_buf = grub_malloc (finish_mmap_size); | ||
41 | + if (!finish_mmap_buf) | ||
42 | + return grub_errno; | ||
43 | |||
44 | - if (grub_efi_get_memory_map (&finish_mmap_size, finish_mmap_buf, &finish_key, | ||
45 | - &finish_desc_size, &finish_desc_version) <= 0) | ||
46 | - return grub_error (GRUB_ERR_IO, "couldn't retrieve memory map"); | ||
47 | + if (grub_efi_get_memory_map (&finish_mmap_size, finish_mmap_buf, &finish_key, | ||
48 | + &finish_desc_size, &finish_desc_version) <= 0) | ||
49 | + { | ||
50 | + grub_free (finish_mmap_buf); | ||
51 | + return grub_error (GRUB_ERR_IO, "couldn't retrieve memory map"); | ||
52 | + } | ||
53 | |||
54 | - b = grub_efi_system_table->boot_services; | ||
55 | - status = efi_call_2 (b->exit_boot_services, grub_efi_image_handle, | ||
56 | - finish_key); | ||
57 | - if (status != GRUB_EFI_SUCCESS) | ||
58 | - return grub_error (GRUB_ERR_IO, "couldn't terminate EFI services"); | ||
59 | + b = grub_efi_system_table->boot_services; | ||
60 | + status = efi_call_2 (b->exit_boot_services, grub_efi_image_handle, | ||
61 | + finish_key); | ||
62 | + if (status == GRUB_EFI_SUCCESS) | ||
63 | + break; | ||
64 | |||
65 | + if (status != GRUB_EFI_INVALID_PARAMETER) | ||
66 | + { | ||
67 | + grub_free (finish_mmap_buf); | ||
68 | + return grub_error (GRUB_ERR_IO, "couldn't terminate EFI services"); | ||
69 | + } | ||
70 | + | ||
71 | + grub_free (finish_mmap_buf); | ||
72 | + grub_printf ("Trying to terminate EFI services again\n"); | ||
73 | + } | ||
74 | grub_efi_is_finished = 1; | ||
75 | if (outbuf_size) | ||
76 | *outbuf_size = finish_mmap_size; | ||
77 | -- | ||
78 | 1.9.1 | ||
79 | |||