32 Status =
gDS->GetMemorySpaceDescriptor (BaseAddress, &GcdDescriptor);
33 if (EFI_ERROR (Status) ||
44 return GcdEndAddress >= (BaseAddress + Length);
74 OUT UINT64 *Attributes
79 UINTN RegionAttributes;
84 if ((Length == 0) || (Attributes ==
NULL)) {
87 "%a: BaseAddress 0x%llx Length 0x%llx is zero or Attributes is NULL\n",
92 return EFI_INVALID_PARAMETER;
96 return EFI_UNSUPPORTED;
101 "%a: BaseAddress == 0x%lx, Length == 0x%lx\n",
108 Intersection = MAX_UINTN;
110 for (RegionAddress = (
UINTN)BaseAddress;
111 RegionAddress < (
UINTN)(BaseAddress + Length);
112 RegionAddress += RegionLength)
114 Status = GetMemoryRegion (
122 "%a: RegionAddress == 0x%lx, RegionLength == 0x%lx, RegionAttributes == 0x%lx\n",
124 (UINT64)RegionAddress,
125 (UINT64)RegionLength,
126 (UINT64)RegionAttributes
129 if (EFI_ERROR (Status)) {
130 return EFI_NO_MAPPING;
133 Union |= RegionAttributes;
134 Intersection &= RegionAttributes;
139 "%a: Union == %lx, Intersection == %lx\n",
145 if (Union != Intersection) {
146 return EFI_NO_MAPPING;
149 *Attributes = RegionAttributeToGcdAttribute (Union);
150 *Attributes &= EFI_MEMORY_RP | EFI_MEMORY_RO | EFI_MEMORY_XP;
195 "%a: BaseAddress == 0x%lx, Length == 0x%lx, Attributes == 0x%lx\n",
203 ((Attributes & ~(EFI_MEMORY_RO | EFI_MEMORY_RP | EFI_MEMORY_XP)) != 0))
207 "%a: BaseAddress 0x%llx Length is zero or Attributes (0x%llx) is invalid\n",
212 return EFI_INVALID_PARAMETER;
216 return EFI_UNSUPPORTED;
263 "%a: BaseAddress == 0x%lx, Length == 0x%lx, Attributes == 0x%lx\n",
271 ((Attributes & ~(EFI_MEMORY_RO | EFI_MEMORY_RP | EFI_MEMORY_XP)) != 0))
275 "%a: BaseAddress 0x%llx Length is zero or Attributes (0x%llx) is invalid\n",
280 return EFI_INVALID_PARAMETER;
284 return EFI_UNSUPPORTED;
EFI_STATUS ArmSetMemoryAttributes(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes, IN UINT64 AttributeMask)
#define DEBUG(Expression)
STATIC EFI_STATUS ClearMemoryAttributes(IN EFI_MEMORY_ATTRIBUTE_PROTOCOL *This, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes)
STATIC EFI_STATUS SetMemoryAttributes(IN EFI_MEMORY_ATTRIBUTE_PROTOCOL *This, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes)
STATIC EFI_STATUS GetMemoryAttributes(IN EFI_MEMORY_ATTRIBUTE_PROTOCOL *This, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, OUT UINT64 *Attributes)
STATIC BOOLEAN RegionIsSystemMemory(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length)
@ EfiGcdMemoryTypeSystemMemory
UINT64 EFI_PHYSICAL_ADDRESS
EFI_GCD_MEMORY_TYPE GcdMemoryType
EFI_PHYSICAL_ADDRESS BaseAddress