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