|
 |
d41074 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
 |
a85e8e |
From: Vladimir Serbinenko <phcoder@gmail.com>
|
|
 |
a85e8e |
Date: Fri, 28 Feb 2014 10:07:11 +0100
|
|
 |
d41074 |
Subject: [PATCH] * grub-core/kern/i386/pc/mmap.c: Fallback to EISA memory map
|
|
 |
d41074 |
if E820 failed to return any regions.
|
|
 |
a85e8e |
|
|
 |
a85e8e |
---
|
|
 |
a85e8e |
grub-core/kern/i386/pc/mmap.c | 40 +++++++++++++++++++++-------------------
|
|
 |
d41074 |
ChangeLog | 5 +++++
|
|
 |
a85e8e |
2 files changed, 26 insertions(+), 19 deletions(-)
|
|
 |
a85e8e |
|
|
 |
a85e8e |
diff --git a/grub-core/kern/i386/pc/mmap.c b/grub-core/kern/i386/pc/mmap.c
|
|
 |
d41074 |
index 8009e833c1a..f1375f3e12d 100644
|
|
 |
a85e8e |
--- a/grub-core/kern/i386/pc/mmap.c
|
|
 |
a85e8e |
+++ b/grub-core/kern/i386/pc/mmap.c
|
|
 |
a85e8e |
@@ -141,33 +141,35 @@ grub_get_mmap_entry (struct grub_machine_mmap_entry *entry,
|
|
 |
a85e8e |
grub_err_t
|
|
 |
a85e8e |
grub_machine_mmap_iterate (grub_memory_hook_t hook, void *hook_data)
|
|
 |
a85e8e |
{
|
|
 |
a85e8e |
- grub_uint32_t cont;
|
|
 |
a85e8e |
+ grub_uint32_t cont = 0;
|
|
 |
a85e8e |
struct grub_machine_mmap_entry *entry
|
|
 |
a85e8e |
= (struct grub_machine_mmap_entry *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR;
|
|
 |
a85e8e |
+ int e820_works = 0;
|
|
 |
a85e8e |
|
|
 |
a85e8e |
- grub_memset (entry, 0, sizeof (entry));
|
|
 |
a85e8e |
+ while (1)
|
|
 |
a85e8e |
+ {
|
|
 |
a85e8e |
+ grub_memset (entry, 0, sizeof (entry));
|
|
 |
a85e8e |
|
|
 |
a85e8e |
- /* Check if grub_get_mmap_entry works. */
|
|
 |
a85e8e |
- cont = grub_get_mmap_entry (entry, 0);
|
|
 |
a85e8e |
+ cont = grub_get_mmap_entry (entry, cont);
|
|
 |
a85e8e |
|
|
 |
a85e8e |
- if (entry->size)
|
|
 |
a85e8e |
- do
|
|
 |
a85e8e |
- {
|
|
 |
a85e8e |
- if (hook (entry->addr, entry->len,
|
|
 |
a85e8e |
- /* GRUB mmaps have been defined to match with the E820 definition.
|
|
 |
a85e8e |
- Therefore, we can just pass type through. */
|
|
 |
a85e8e |
- entry->type, hook_data))
|
|
 |
a85e8e |
- break;
|
|
 |
a85e8e |
+ if (!entry->size)
|
|
 |
a85e8e |
+ break;
|
|
 |
a85e8e |
|
|
 |
a85e8e |
- if (! cont)
|
|
 |
a85e8e |
- break;
|
|
 |
a85e8e |
+ if (entry->len)
|
|
 |
a85e8e |
+ e820_works = 1;
|
|
 |
a85e8e |
+ if (entry->len
|
|
 |
a85e8e |
+ && hook (entry->addr, entry->len,
|
|
 |
a85e8e |
+ /* GRUB mmaps have been defined to match with
|
|
 |
a85e8e |
+ the E820 definition.
|
|
 |
a85e8e |
+ Therefore, we can just pass type through. */
|
|
 |
a85e8e |
+ entry->type, hook_data))
|
|
 |
a85e8e |
+ break;
|
|
 |
a85e8e |
|
|
 |
a85e8e |
- grub_memset (entry, 0, sizeof (entry));
|
|
 |
a85e8e |
+ if (! cont)
|
|
 |
a85e8e |
+ break;
|
|
 |
a85e8e |
+ }
|
|
 |
a85e8e |
|
|
 |
a85e8e |
- cont = grub_get_mmap_entry (entry, cont);
|
|
 |
a85e8e |
- }
|
|
 |
a85e8e |
- while (entry->size);
|
|
 |
a85e8e |
- else
|
|
 |
a85e8e |
+ if (!e820_works)
|
|
 |
a85e8e |
{
|
|
 |
a85e8e |
grub_uint32_t eisa_mmap = grub_get_eisa_mmap ();
|
|
 |
a85e8e |
|
|
 |
d41074 |
diff --git a/ChangeLog b/ChangeLog
|
|
 |
d41074 |
index 6ed6cf4ec2b..97cf57e253d 100644
|
|
 |
d41074 |
--- a/ChangeLog
|
|
 |
d41074 |
+++ b/ChangeLog
|
|
 |
d41074 |
@@ -1,3 +1,8 @@
|
|
 |
d41074 |
+2014-02-28 Vladimir Serbinenko <phcoder@gmail.com>
|
|
 |
d41074 |
+
|
|
 |
d41074 |
+ * grub-core/kern/i386/pc/mmap.c: Fallback to EISA memory map
|
|
 |
d41074 |
+ if E820 failed to return any regions.
|
|
 |
d41074 |
+
|
|
 |
d41074 |
2014-02-28 Vladimir Serbinenko <phcoder@gmail.com>
|
|
 |
d41074 |
|
|
 |
d41074 |
* grub-core/mmap/i386/uppermem.c (lower_hook) [COREBOOT]: Ignore low
|