diff options
author | Oleksiy Yakovlev <oleksiyy@ami.com> | 2020-07-02 16:50:39 -0400 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2020-07-15 14:58:25 +0000 |
commit | e77966b341b993291ab2d95718b88a6a0d703d0c (patch) | |
tree | 7998a721d35d10af56ae32d2c5aa3ddcafc96f9e /UefiCpuPkg/CpuDxe | |
parent | c2e38a520e1e2eed0425fbb906718c69c8a8edb5 (diff) | |
download | edk2-e77966b341b993291ab2d95718b88a6a0d703d0c.tar.gz edk2-e77966b341b993291ab2d95718b88a6a0d703d0c.tar.bz2 edk2-e77966b341b993291ab2d95718b88a6a0d703d0c.zip |
UefiCpuPkg: Add New Memory Attributes
Add usage of EFI_MEMORY_SP and EFI_MEMORY_CPU_CRYPTO
attributes introduced in UEFI 2.8.
(UEFI 2.8, mantis 1919 and 1872).
Use attributes bitmasks, defined in MdePkg.
Signed-off-by: Oleksiy Yakovlev <oleksiyy@ami.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20200702205039.52400-5-oleksiyy@ami.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'UefiCpuPkg/CpuDxe')
-rw-r--r-- | UefiCpuPkg/CpuDxe/CpuDxe.c | 11 | ||||
-rw-r--r-- | UefiCpuPkg/CpuDxe/CpuDxe.h | 13 | ||||
-rw-r--r-- | UefiCpuPkg/CpuDxe/CpuPageTable.c | 6 |
3 files changed, 7 insertions, 23 deletions
diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c index a571fc3b17..52cc26eaaf 100644 --- a/UefiCpuPkg/CpuDxe/CpuDxe.c +++ b/UefiCpuPkg/CpuDxe/CpuDxe.c @@ -10,9 +10,6 @@ #include "CpuMp.h"
#include "CpuPageTable.h"
-#define CACHE_ATTRIBUTE_MASK (EFI_MEMORY_UC | EFI_MEMORY_WC | EFI_MEMORY_WT | EFI_MEMORY_WB | EFI_MEMORY_UCE | EFI_MEMORY_WP)
-#define MEMORY_ATTRIBUTE_MASK (EFI_MEMORY_RP | EFI_MEMORY_XP | EFI_MEMORY_RO)
-
//
// Global Variables
//
@@ -417,8 +414,8 @@ CpuSetMemoryAttributes ( return EFI_SUCCESS;
}
- CacheAttributes = Attributes & CACHE_ATTRIBUTE_MASK;
- MemoryAttributes = Attributes & MEMORY_ATTRIBUTE_MASK;
+ CacheAttributes = Attributes & EFI_CACHE_ATTRIBUTE_MASK;
+ MemoryAttributes = Attributes & EFI_MEMORY_ATTRIBUTE_MASK;
if (Attributes != (CacheAttributes | MemoryAttributes)) {
return EFI_INVALID_PARAMETER;
@@ -677,7 +674,7 @@ SetGcdMemorySpaceAttributes ( gDS->SetMemorySpaceAttributes (
RegionStart,
RegionLength,
- (MemorySpaceMap[Index].Attributes & ~EFI_MEMORY_CACHETYPE_MASK) | (MemorySpaceMap[Index].Capabilities & Attributes)
+ (MemorySpaceMap[Index].Attributes & ~EFI_CACHE_ATTRIBUTE_MASK) | (MemorySpaceMap[Index].Capabilities & Attributes)
);
}
@@ -754,7 +751,7 @@ RefreshMemoryAttributesFromMtrr ( gDS->SetMemorySpaceAttributes (
MemorySpaceMap[Index].BaseAddress,
MemorySpaceMap[Index].Length,
- (MemorySpaceMap[Index].Attributes & ~EFI_MEMORY_CACHETYPE_MASK) |
+ (MemorySpaceMap[Index].Attributes & ~EFI_CACHE_ATTRIBUTE_MASK) |
(MemorySpaceMap[Index].Capabilities & DefaultAttributes)
);
}
diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.h b/UefiCpuPkg/CpuDxe/CpuDxe.h index b30a89675e..9771ec8336 100644 --- a/UefiCpuPkg/CpuDxe/CpuDxe.h +++ b/UefiCpuPkg/CpuDxe/CpuDxe.h @@ -39,19 +39,6 @@ #include <Guid/IdleLoopEvent.h>
#include <Guid/VectorHandoffTable.h>
-#define EFI_MEMORY_CACHETYPE_MASK (EFI_MEMORY_UC | \
- EFI_MEMORY_WC | \
- EFI_MEMORY_WT | \
- EFI_MEMORY_WB | \
- EFI_MEMORY_UCE | \
- EFI_MEMORY_WP \
- )
-
-#define EFI_MEMORY_PAGETYPE_MASK (EFI_MEMORY_RP | \
- EFI_MEMORY_XP | \
- EFI_MEMORY_RO \
- )
-
#define HEAP_GUARD_NONSTOP_MODE \
((PcdGet8 (PcdHeapGuardPropertyMask) & (BIT6|BIT4|BIT1|BIT0)) > BIT6)
diff --git a/UefiCpuPkg/CpuDxe/CpuPageTable.c b/UefiCpuPkg/CpuDxe/CpuPageTable.c index 0a02cb3f6b..06ee1b8231 100644 --- a/UefiCpuPkg/CpuDxe/CpuPageTable.c +++ b/UefiCpuPkg/CpuDxe/CpuPageTable.c @@ -717,7 +717,7 @@ ConvertMemoryPageAttributes ( return RETURN_INVALID_PARAMETER;
}
- if ((Attributes & ~(EFI_MEMORY_RP | EFI_MEMORY_RO | EFI_MEMORY_XP)) != 0) {
+ if ((Attributes & ~EFI_MEMORY_ATTRIBUTE_MASK) != 0) {
DEBUG ((DEBUG_ERROR, "Attributes(0x%lx) has unsupported bit\n", Attributes));
return EFI_UNSUPPORTED;
}
@@ -1018,9 +1018,9 @@ RefreshGcdMemoryAttributesFromPaging ( Length = MIN (PageLength, MemorySpaceLength);
if (Attributes != (MemorySpaceMap[Index].Attributes &
- EFI_MEMORY_PAGETYPE_MASK)) {
+ EFI_MEMORY_ATTRIBUTE_MASK)) {
NewAttributes = (MemorySpaceMap[Index].Attributes &
- ~EFI_MEMORY_PAGETYPE_MASK) | Attributes;
+ ~EFI_MEMORY_ATTRIBUTE_MASK) | Attributes;
Status = gDS->SetMemorySpaceAttributes (
BaseAddress,
Length,
|