|
|
f731ee |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
f731ee |
From: Robert Elliott <elliott@hpe.com>
|
|
|
f731ee |
Date: Thu, 3 Dec 2015 11:38:36 -0600
|
|
|
f731ee |
Subject: [PATCH] Translate UEFI persistent memory type
|
|
|
f731ee |
MIME-Version: 1.0
|
|
|
f731ee |
Content-Type: text/plain; charset=UTF-8
|
|
|
f731ee |
Content-Transfer-Encoding: 8bit
|
|
|
f731ee |
|
|
|
f731ee |
Define
|
|
|
f731ee |
* GRUB_EFI_PERSISTENT_MEMORY (UEFI memory map type 14) per UEFI 2.5
|
|
|
f731ee |
* GRUB_MEMORY_PERSISTENT (E820 type 7) per ACPI 3.0
|
|
|
f731ee |
* GRUB_MEMORY_PERSISTENT_LEGACY (E820 unofficial type 12) per ACPI 3.0
|
|
|
f731ee |
|
|
|
f731ee |
and translate GRUB_EFI_PERSISTENT_MEMORY to GRUB_MEMORY_PERSISTENT in
|
|
|
f731ee |
grub_efi_mmap_iterate().
|
|
|
f731ee |
|
|
|
f731ee |
Includes
|
|
|
f731ee |
* adding the E820 names to lsmmap
|
|
|
f731ee |
* handling the E820 types in make_efi_memtype()
|
|
|
f731ee |
|
|
|
f731ee |
Suggested-by: Vladimir 'φ-coder/phcoder' Serbinenko <phcoder@gmail.com>
|
|
|
f731ee |
Suggested-by: Andrei Borzenkov <arvidjaar@gmail.com>
|
|
|
f731ee |
(cherry picked from commit 76ce1de740f202985ffd7b2e980cf34c75a2dac3)
|
|
|
f731ee |
|
|
|
f731ee |
Resolves: rhbz#1288608
|
|
|
f731ee |
---
|
|
|
f731ee |
grub-core/commands/lsmmap.c | 2 ++
|
|
|
f731ee |
grub-core/mmap/efi/mmap.c | 12 ++++++++++++
|
|
|
f731ee |
include/grub/efi/api.h | 1 +
|
|
|
f731ee |
include/grub/memory.h | 2 ++
|
|
|
f731ee |
4 files changed, 17 insertions(+)
|
|
|
f731ee |
|
|
|
f731ee |
diff --git a/grub-core/commands/lsmmap.c b/grub-core/commands/lsmmap.c
|
|
|
f731ee |
index 4b504fd28f8..816ee47d1ed 100644
|
|
|
f731ee |
--- a/grub-core/commands/lsmmap.c
|
|
|
f731ee |
+++ b/grub-core/commands/lsmmap.c
|
|
|
f731ee |
@@ -37,6 +37,8 @@ static const char *names[] =
|
|
|
f731ee |
is required to save accross hibernations. */
|
|
|
f731ee |
[GRUB_MEMORY_NVS] = N_("ACPI non-volatile storage RAM"),
|
|
|
f731ee |
[GRUB_MEMORY_BADRAM] = N_("faulty RAM (BadRAM)"),
|
|
|
f731ee |
+ [GRUB_MEMORY_PERSISTENT] = N_("persistent RAM"),
|
|
|
f731ee |
+ [GRUB_MEMORY_PERSISTENT_LEGACY] = N_("persistent RAM (legacy)"),
|
|
|
f731ee |
[GRUB_MEMORY_COREBOOT_TABLES] = N_("RAM holding coreboot tables"),
|
|
|
f731ee |
[GRUB_MEMORY_CODE] = N_("RAM holding firmware code")
|
|
|
f731ee |
};
|
|
|
f731ee |
diff --git a/grub-core/mmap/efi/mmap.c b/grub-core/mmap/efi/mmap.c
|
|
|
f731ee |
index 900a4d6598c..bd495a18481 100644
|
|
|
f731ee |
--- a/grub-core/mmap/efi/mmap.c
|
|
|
f731ee |
+++ b/grub-core/mmap/efi/mmap.c
|
|
|
f731ee |
@@ -118,6 +118,11 @@ grub_efi_mmap_iterate (grub_memory_hook_t hook, void *hook_data,
|
|
|
f731ee |
GRUB_MEMORY_NVS, hook_data);
|
|
|
f731ee |
break;
|
|
|
f731ee |
|
|
|
f731ee |
+ case GRUB_EFI_PERSISTENT_MEMORY:
|
|
|
f731ee |
+ hook (desc->physical_start, desc->num_pages * 4096,
|
|
|
f731ee |
+ GRUB_MEMORY_PERSISTENT, hook_data);
|
|
|
f731ee |
+ break;
|
|
|
f731ee |
+
|
|
|
f731ee |
default:
|
|
|
f731ee |
grub_printf ("Unknown memory type %d, considering reserved\n",
|
|
|
f731ee |
desc->type);
|
|
|
f731ee |
@@ -147,6 +152,13 @@ make_efi_memtype (int type)
|
|
|
f731ee |
/* No way to remove a chunk of memory from EFI mmap.
|
|
|
f731ee |
So mark it as unusable. */
|
|
|
f731ee |
case GRUB_MEMORY_HOLE:
|
|
|
f731ee |
+ /*
|
|
|
f731ee |
+ * AllocatePages() does not support GRUB_EFI_PERSISTENT_MEMORY,
|
|
|
f731ee |
+ * so no translation for GRUB_MEMORY_PERSISTENT or
|
|
|
f731ee |
+ * GRUB_MEMORY_PERSISTENT_LEGACY.
|
|
|
f731ee |
+ */
|
|
|
f731ee |
+ case GRUB_MEMORY_PERSISTENT:
|
|
|
f731ee |
+ case GRUB_MEMORY_PERSISTENT_LEGACY:
|
|
|
f731ee |
case GRUB_MEMORY_RESERVED:
|
|
|
f731ee |
return GRUB_EFI_UNUSABLE_MEMORY;
|
|
|
f731ee |
|
|
|
f731ee |
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
|
|
|
f731ee |
index 029ee92f5d0..551d93e50a3 100644
|
|
|
f731ee |
--- a/include/grub/efi/api.h
|
|
|
f731ee |
+++ b/include/grub/efi/api.h
|
|
|
f731ee |
@@ -431,6 +431,7 @@ enum grub_efi_memory_type
|
|
|
f731ee |
GRUB_EFI_MEMORY_MAPPED_IO,
|
|
|
f731ee |
GRUB_EFI_MEMORY_MAPPED_IO_PORT_SPACE,
|
|
|
f731ee |
GRUB_EFI_PAL_CODE,
|
|
|
f731ee |
+ GRUB_EFI_PERSISTENT_MEMORY,
|
|
|
f731ee |
GRUB_EFI_MAX_MEMORY_TYPE
|
|
|
f731ee |
};
|
|
|
f731ee |
typedef enum grub_efi_memory_type grub_efi_memory_type_t;
|
|
|
f731ee |
diff --git a/include/grub/memory.h b/include/grub/memory.h
|
|
|
f731ee |
index 083cfb6802e..6da114a1bdc 100644
|
|
|
f731ee |
--- a/include/grub/memory.h
|
|
|
f731ee |
+++ b/include/grub/memory.h
|
|
|
f731ee |
@@ -30,6 +30,8 @@ typedef enum grub_memory_type
|
|
|
f731ee |
GRUB_MEMORY_ACPI = 3,
|
|
|
f731ee |
GRUB_MEMORY_NVS = 4,
|
|
|
f731ee |
GRUB_MEMORY_BADRAM = 5,
|
|
|
f731ee |
+ GRUB_MEMORY_PERSISTENT = 7,
|
|
|
f731ee |
+ GRUB_MEMORY_PERSISTENT_LEGACY = 12,
|
|
|
f731ee |
GRUB_MEMORY_COREBOOT_TABLES = 16,
|
|
|
f731ee |
GRUB_MEMORY_CODE = 20,
|
|
|
f731ee |
/* This one is special: it's used internally but is never reported
|