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