**/\r
EFI_STATUS\r
SearchGcdMemorySpaces (\r
- IN EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap,\r
- IN UINTN NumberOfDescriptors,\r
- IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
- IN UINT64 Length,\r
- OUT UINTN *StartIndex,\r
- OUT UINTN *EndIndex\r
+ IN EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap,\r
+ IN UINTN NumberOfDescriptors,\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length,\r
+ OUT UINTN *StartIndex,\r
+ OUT UINTN *EndIndex\r
)\r
{\r
- UINTN Index;\r
+ UINTN Index;\r
\r
*StartIndex = 0;\r
*EndIndex = 0;\r
for (Index = 0; Index < NumberOfDescriptors; Index++) {\r
if ((BaseAddress >= MemorySpaceMap[Index].BaseAddress) &&\r
- (BaseAddress < (MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length))) {\r
+ (BaseAddress < (MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length)))\r
+ {\r
*StartIndex = Index;\r
}\r
+\r
if (((BaseAddress + Length - 1) >= MemorySpaceMap[Index].BaseAddress) &&\r
- ((BaseAddress + Length - 1) < (MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length))) {\r
+ ((BaseAddress + Length - 1) < (MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length)))\r
+ {\r
*EndIndex = Index;\r
return EFI_SUCCESS;\r
}\r
}\r
+\r
return EFI_NOT_FOUND;\r
}\r
\r
-\r
/**\r
Sets the attributes for a specified range in Gcd Memory Space Map.\r
\r
**/\r
EFI_STATUS\r
SetGcdMemorySpaceAttributes (\r
- IN EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap,\r
- IN UINTN NumberOfDescriptors,\r
- IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
- IN UINT64 Length,\r
- IN UINT64 Attributes\r
+ IN EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap,\r
+ IN UINTN NumberOfDescriptors,\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length,\r
+ IN UINT64 Attributes\r
)\r
{\r
EFI_STATUS Status;\r
EFI_PHYSICAL_ADDRESS RegionStart;\r
UINT64 RegionLength;\r
\r
- DEBUG ((DEBUG_GCD, "SetGcdMemorySpaceAttributes[0x%lX; 0x%lX] = 0x%lX\n",\r
- BaseAddress, BaseAddress + Length, Attributes));\r
+ DEBUG ((\r
+ DEBUG_GCD,\r
+ "SetGcdMemorySpaceAttributes[0x%lX; 0x%lX] = 0x%lX\n",\r
+ BaseAddress,\r
+ BaseAddress + Length,\r
+ Attributes\r
+ ));\r
\r
// We do not support a smaller granularity than 4KB on ARM Architecture\r
if ((Length & EFI_PAGE_MASK) != 0) {\r
- DEBUG ((DEBUG_WARN,\r
- "Warning: We do not support smaller granularity than 4KB on ARM Architecture (passed length: 0x%lX).\n",\r
- Length));\r
+ DEBUG ((\r
+ DEBUG_WARN,\r
+ "Warning: We do not support smaller granularity than 4KB on ARM Architecture (passed length: 0x%lX).\n",\r
+ Length\r
+ ));\r
}\r
\r
//\r
if (MemorySpaceMap[Index].GcdMemoryType == EfiGcdMemoryTypeNonExistent) {\r
continue;\r
}\r
+\r
//\r
// Calculate the start and end address of the overlapping range\r
//\r
} else {\r
RegionStart = MemorySpaceMap[Index].BaseAddress;\r
}\r
+\r
if ((BaseAddress + Length - 1) < (MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length)) {\r
RegionLength = BaseAddress + Length - RegionStart;\r
} else {\r
RegionLength = MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length - RegionStart;\r
}\r
+\r
//\r
// Set memory attributes according to MTRR attribute and the original attribute of descriptor\r
//\r
EFI_STATUS\r
EFIAPI\r
CpuSetMemoryAttributes (\r
- IN EFI_CPU_ARCH_PROTOCOL *This,\r
- IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
- IN UINT64 Length,\r
- IN UINT64 EfiAttributes\r
+ IN EFI_CPU_ARCH_PROTOCOL *This,\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length,\r
+ IN UINT64 EfiAttributes\r
)\r
{\r
EFI_STATUS Status;\r
\r
// Get the region starting from 'BaseAddress' and its 'Attribute'\r
RegionBaseAddress = BaseAddress;\r
- Status = GetMemoryRegion (&RegionBaseAddress, &RegionLength, &RegionArmAttributes);\r
+ Status = GetMemoryRegion (&RegionBaseAddress, &RegionLength, &RegionArmAttributes);\r
\r
// Data & Instruction Caches are flushed when we set new memory attributes.\r
// So, we only set the attributes if the new region is different.\r