]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/PL111LcdArmVExpressLib: use write-combine mapping for VRAM
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 6 Apr 2017 12:16:35 +0000 (13:16 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 6 Apr 2017 20:31:48 +0000 (21:31 +0100)
Replace the uncached memory mapping of the framebuffer with a write-
combining one. This improves performance, and avoids issues with
unaligned accesses and DC ZVA instructions performed by the accelerated
memcpy/memset routines.

Instead of manipulating the memory attributes directly, use the
SetMemorySpaceAttributes() DXE services, which validates the attributes
against the capabilities of the region before making the actual change.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jeremy Linton <jeremy.linton@arm.com>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c
ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpressLib.inf

index a8125e81daacab114ef5f7c3a18f66f640e4d82e..3f3ceb3d2fa82f614e0c6dac8455c117745cf3a6 100644 (file)
 #include <Library/IoLib.h>\r
 #include <Library/PcdLib.h>\r
 #include <Library/DebugLib.h>\r
+#include <Library/DxeServicesTableLib.h>\r
 #include <Library/LcdPlatformLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 \r
-#include <Protocol/Cpu.h>\r
 #include <Protocol/EdidDiscovered.h>\r
 #include <Protocol/EdidActive.h>\r
 \r
@@ -165,7 +165,6 @@ LcdPlatformGetVram (
   )\r
 {\r
   EFI_STATUS              Status;\r
-  EFI_CPU_ARCH_PROTOCOL  *Cpu;\r
 \r
   Status = EFI_SUCCESS;\r
 \r
@@ -187,12 +186,9 @@ LcdPlatformGetVram (
       return Status;\r
     }\r
 \r
-    // Ensure the Cpu architectural protocol is already installed\r
-    Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **)&Cpu);\r
-    ASSERT_EFI_ERROR(Status);\r
-\r
-    // Mark the VRAM as un-cachable. The VRAM is inside the DRAM, which is cachable.\r
-    Status = Cpu->SetMemoryAttributes(Cpu, *VramBaseAddress, *VramSize, EFI_MEMORY_UC);\r
+    // Mark the VRAM as write-combining. The VRAM is inside the DRAM, which is cacheable.\r
+    Status = gDS->SetMemorySpaceAttributes (*VramBaseAddress, *VramSize,\r
+                    EFI_MEMORY_WC);\r
     ASSERT_EFI_ERROR(Status);\r
     if (EFI_ERROR(Status)) {\r
       gBS->FreePages (*VramBaseAddress, EFI_SIZE_TO_PAGES(*VramSize));\r
index d1978e7110d5f78a2a463545b2cee7ae68518308..658558ab15230d07f1c04d29a8e2bf8d14f1d6a2 100644 (file)
@@ -31,8 +31,9 @@
   ArmPlatformPkg/ArmPlatformPkg.dec\r
 \r
 [LibraryClasses]\r
-  BaseLib\r
   ArmPlatformSysConfigLib\r
+  BaseLib\r
+  DxeServicesTableLib\r
 \r
 [Protocols]\r
   gEfiEdidDiscoveredProtocolGuid                # Produced\r