From: Mike Travis on

Currently, the e820_reserve_resources() function does not add entries
obtained via the "add_efi_memmap" kernel cmdline option. This causes
/sys/firmware/memmap/... to be incomplete (stops after 128 entries).
Utilities that examine these entries then do not get the complete
picture of system memory.

This patch causes the above function to use the e820 memmap instead
of the e820_saved memmap if "add_efi_memmap" cmdline option is
specified.

Signed-off-by: Mike Travis <travis(a)sgi.com>
Signed-off-by: Jack Steiner <steiner(a)sgi.com>
---
arch/x86/include/asm/e820.h | 1 +
arch/x86/kernel/e820.c | 8 ++++++--
2 files changed, 7 insertions(+), 2 deletions(-)

--- linux.orig/arch/x86/include/asm/e820.h
+++ linux/arch/x86/include/asm/e820.h
@@ -89,6 +89,7 @@ extern int e820_search_gap(unsigned long
unsigned long start_addr, unsigned long long end_addr);
struct setup_data;
extern void parse_e820_ext(struct setup_data *data, unsigned long pa_data);
+extern int add_efi_memmap;

#if defined(CONFIG_X86_64) || \
(defined(CONFIG_X86_32) && defined(CONFIG_HIBERNATION))
--- linux.orig/arch/x86/kernel/e820.c
+++ linux/arch/x86/kernel/e820.c
@@ -1074,6 +1074,7 @@ void __init e820_reserve_resources(void)
int i;
struct resource *res;
u64 end;
+ struct e820map *e_map = &e820_saved;

res = alloc_bootmem(sizeof(struct resource) * e820.nr_map);
e820_res = res;
@@ -1101,8 +1102,11 @@ void __init e820_reserve_resources(void)
res++;
}

- for (i = 0; i < e820_saved.nr_map; i++) {
- struct e820entry *entry = &e820_saved.map[i];
+ if (add_efi_memmap)
+ e_map = &e820;
+
+ for (i = 0; i < e_map->nr_map; i++) {
+ struct e820entry *entry = &e_map->map[i];
firmware_map_add_early(entry->addr,
entry->addr + entry->size - 1,
e820_type_to_string(entry->type));
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/