|
8 | 8 |
|
9 | 9 | #include "CpuDxe.h"
|
10 | 10 |
|
11 |
| -/** |
12 |
| - Check whether the provided memory range is covered by a single entry of type |
13 |
| - EfiGcdSystemMemory in the GCD memory map. |
14 |
| -
|
15 |
| - @param BaseAddress The physical address that is the start address of |
16 |
| - a memory region. |
17 |
| - @param Length The size in bytes of the memory region. |
18 |
| -
|
19 |
| - @return Whether the region is system memory or not. |
20 |
| -**/ |
21 |
| -STATIC |
22 |
| -BOOLEAN |
23 |
| -RegionIsSystemMemory ( |
24 |
| - IN EFI_PHYSICAL_ADDRESS BaseAddress, |
25 |
| - IN UINT64 Length |
26 |
| - ) |
27 |
| -{ |
28 |
| - EFI_GCD_MEMORY_SPACE_DESCRIPTOR GcdDescriptor; |
29 |
| - EFI_PHYSICAL_ADDRESS GcdEndAddress; |
30 |
| - EFI_STATUS Status; |
31 |
| - |
32 |
| - Status = gDS->GetMemorySpaceDescriptor (BaseAddress, &GcdDescriptor); |
33 |
| - if (EFI_ERROR (Status) || |
34 |
| - (GcdDescriptor.GcdMemoryType != EfiGcdMemoryTypeSystemMemory)) |
35 |
| - { |
36 |
| - return FALSE; |
37 |
| - } |
38 |
| - |
39 |
| - GcdEndAddress = GcdDescriptor.BaseAddress + GcdDescriptor.Length; |
40 |
| - |
41 |
| - // |
42 |
| - // Return TRUE if the GCD descriptor covers the range entirely |
43 |
| - // |
44 |
| - return GcdEndAddress >= (BaseAddress + Length); |
45 |
| -} |
| 11 | +// MU_CHANGE START: Don't check for GCD system memory when using EFI Attributes Protocol |
| 12 | +// /** |
| 13 | +// Check whether the provided memory range is covered by a single entry of type |
| 14 | +// EfiGcdSystemMemory in the GCD memory map. |
| 15 | + |
| 16 | +// @param BaseAddress The physical address that is the start address of |
| 17 | +// a memory region. |
| 18 | +// @param Length The size in bytes of the memory region. |
| 19 | + |
| 20 | +// @return Whether the region is system memory or not. |
| 21 | +// **/ |
| 22 | +// STATIC |
| 23 | +// BOOLEAN |
| 24 | +// RegionIsSystemMemory ( |
| 25 | +// IN EFI_PHYSICAL_ADDRESS BaseAddress, |
| 26 | +// IN UINT64 Length |
| 27 | +// ) |
| 28 | +// { |
| 29 | +// EFI_GCD_MEMORY_SPACE_DESCRIPTOR GcdDescriptor; |
| 30 | +// EFI_PHYSICAL_ADDRESS GcdEndAddress; |
| 31 | +// EFI_STATUS Status; |
| 32 | + |
| 33 | +// Status = gDS->GetMemorySpaceDescriptor (BaseAddress, &GcdDescriptor); |
| 34 | +// if (EFI_ERROR (Status) || |
| 35 | +// (GcdDescriptor.GcdMemoryType != EfiGcdMemoryTypeSystemMemory)) |
| 36 | +// { |
| 37 | +// return FALSE; |
| 38 | +// } |
| 39 | + |
| 40 | +// GcdEndAddress = GcdDescriptor.BaseAddress + GcdDescriptor.Length; |
| 41 | + |
| 42 | +// // |
| 43 | +// // Return TRUE if the GCD descriptor covers the range entirely |
| 44 | +// // |
| 45 | +// return GcdEndAddress >= (BaseAddress + Length); |
| 46 | +// } |
| 47 | +// MU_CHANGE END |
46 | 48 |
|
47 | 49 | /**
|
48 | 50 | This function retrieves the attributes of the memory region specified by
|
@@ -85,9 +87,11 @@ GetMemoryAttributes (
|
85 | 87 | return EFI_INVALID_PARAMETER;
|
86 | 88 | }
|
87 | 89 |
|
88 |
| - if (!RegionIsSystemMemory (BaseAddress, Length)) { |
89 |
| - return EFI_UNSUPPORTED; |
90 |
| - } |
| 90 | + // MU_CHANGE START: Don't check for GCD system memory when using EFI Attributes Protocol |
| 91 | + // if (!RegionIsSystemMemory (BaseAddress, Length)) { |
| 92 | + // return EFI_UNSUPPORTED; |
| 93 | + // } |
| 94 | + // MU_CHANGE END |
91 | 95 |
|
92 | 96 | DEBUG ((
|
93 | 97 | DEBUG_VERBOSE,
|
@@ -198,9 +202,11 @@ SetMemoryAttributes (
|
198 | 202 | return EFI_INVALID_PARAMETER;
|
199 | 203 | }
|
200 | 204 |
|
201 |
| - if (!RegionIsSystemMemory (BaseAddress, Length)) { |
202 |
| - return EFI_UNSUPPORTED; |
203 |
| - } |
| 205 | + // MU_CHANGE START: Don't check for GCD system memory when using EFI Attributes Protocol |
| 206 | + // if (!RegionIsSystemMemory (BaseAddress, Length)) { |
| 207 | + // return EFI_UNSUPPORTED; |
| 208 | + // } |
| 209 | + // MU_CHANGE END |
204 | 210 |
|
205 | 211 | return ArmSetMemoryAttributes (BaseAddress, Length, Attributes, Attributes);
|
206 | 212 | }
|
@@ -259,9 +265,11 @@ ClearMemoryAttributes (
|
259 | 265 | return EFI_INVALID_PARAMETER;
|
260 | 266 | }
|
261 | 267 |
|
262 |
| - if (!RegionIsSystemMemory (BaseAddress, Length)) { |
263 |
| - return EFI_UNSUPPORTED; |
264 |
| - } |
| 268 | + // MU_CHANGE START: Don't check for GCD system memory when using EFI Attributes Protocol |
| 269 | + // if (!RegionIsSystemMemory (BaseAddress, Length)) { |
| 270 | + // return EFI_UNSUPPORTED; |
| 271 | + // } |
| 272 | + // MU_CHANGE END |
265 | 273 |
|
266 | 274 | return ArmSetMemoryAttributes (BaseAddress, Length, 0, Attributes);
|
267 | 275 | }
|
|
0 commit comments