UINTN RegionLength;\r
UINTN RegionArmAttributes;\r
\r
+ if (mIsFlushingGCD) {\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
if ((BaseAddress & (SIZE_4KB - 1)) != 0) {\r
// Minimum granularity is SIZE_4KB (4KB on ARM)\r
DEBUG ((EFI_D_PAGE, "CpuSetMemoryAttributes(%lx, %lx, %lx): Minimum ganularity is SIZE_4KB\n", BaseAddress, Length, EfiAttributes));\r
if (EFI_ERROR (Status) || (RegionArmAttributes != ArmAttributes) ||\r
((BaseAddress + Length) > (RegionBaseAddress + RegionLength)))\r
{\r
- return SetMemoryAttributes (BaseAddress, Length, EfiAttributes, 0);\r
+ return ArmSetMemoryAttributes (BaseAddress, Length, EfiAttributes);\r
} else {\r
return EFI_SUCCESS;\r
}\r
}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-CpuConvertPagesToUncachedVirtualAddress (\r
- IN VIRTUAL_UNCACHED_PAGES_PROTOCOL *This,\r
- IN EFI_PHYSICAL_ADDRESS Address,\r
- IN UINTN Length,\r
- IN EFI_PHYSICAL_ADDRESS VirtualMask,\r
- OUT UINT64 *Attributes OPTIONAL\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_GCD_MEMORY_SPACE_DESCRIPTOR GcdDescriptor;\r
-\r
- if (Attributes != NULL) {\r
- Status = gDS->GetMemorySpaceDescriptor (Address, &GcdDescriptor);\r
- if (!EFI_ERROR (Status)) {\r
- *Attributes = GcdDescriptor.Attributes;\r
- }\r
- }\r
-\r
- //\r
- // Make this address range page fault if accessed. If it is a DMA buffer than this would\r
- // be the PCI address. Code should always use the CPU address, and we will or in VirtualMask\r
- // to that address.\r
- //\r
- Status = SetMemoryAttributes (Address, Length, EFI_MEMORY_RO, 0);\r
- if (!EFI_ERROR (Status)) {\r
- Status = SetMemoryAttributes (Address | VirtualMask, Length, EFI_MEMORY_UC, VirtualMask);\r
- }\r
-\r
- DEBUG ((DEBUG_INFO | DEBUG_LOAD, "CpuConvertPagesToUncachedVirtualAddress()\n Unmapped 0x%08lx Mapped 0x%08lx 0x%x bytes\n", Address, Address | VirtualMask, Length));\r
-\r
- return Status;\r
-}\r
-\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-CpuReconvertPages (\r
- IN VIRTUAL_UNCACHED_PAGES_PROTOCOL *This,\r
- IN EFI_PHYSICAL_ADDRESS Address,\r
- IN UINTN Length,\r
- IN EFI_PHYSICAL_ADDRESS VirtualMask,\r
- IN UINT64 Attributes\r
- )\r
-{\r
- EFI_STATUS Status;\r
-\r
- DEBUG ((DEBUG_INFO | DEBUG_LOAD, "CpuReconvertPages(%lx, %x, %lx, %lx)\n", Address, Length, VirtualMask, Attributes));\r
-\r
- //\r
- // Unmap the aliased Address\r
- //\r
- Status = SetMemoryAttributes (Address | VirtualMask, Length, EFI_MEMORY_RO, 0);\r
- if (!EFI_ERROR (Status)) {\r
- //\r
- // Restore atttributes\r
- //\r
- Status = SetMemoryAttributes (Address, Length, Attributes, 0);\r
- }\r
-\r
- return Status;\r
-}\r
-\r
-\r
-VIRTUAL_UNCACHED_PAGES_PROTOCOL gVirtualUncachedPages = {\r
- CpuConvertPagesToUncachedVirtualAddress,\r
- CpuReconvertPages\r
-};\r