ArmPkg/ArmMmuLib ARM: add missing support for non-shareable cached mappings
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 4 Jan 2019 18:04:31 +0000 (19:04 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Sun, 13 Jan 2019 16:32:55 +0000 (17:32 +0100)
Commit 829633e3a82 ("ArmPkg/ArmMmuLib: Add new attribute
WRITE_BACK_NONSHAREABLE") introduced support for non-shareable
cached mappings to the AArch64 version of ArmMmuLib, but the ARM
version was left behind, so fix that.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c

index 889b228..b237321 100644 (file)
@@ -135,6 +135,11 @@ PopulateLevel2PageTable (
     case ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_BACK:\r
       PageAttributes = TT_DESCRIPTOR_PAGE_WRITE_BACK;\r
       break;\r
+    case ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK_NONSHAREABLE:\r
+    case ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_BACK_NONSHAREABLE:\r
+      PageAttributes = TT_DESCRIPTOR_PAGE_WRITE_BACK;\r
+      PageAttributes &= ~TT_DESCRIPTOR_PAGE_S_SHARED;\r
+      break;\r
     case ARM_MEMORY_REGION_ATTRIBUTE_WRITE_THROUGH:\r
     case ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_THROUGH:\r
       PageAttributes = TT_DESCRIPTOR_PAGE_WRITE_THROUGH;\r
@@ -239,6 +244,10 @@ FillTranslationTable (
     case ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK:\r
       Attributes = TT_DESCRIPTOR_SECTION_WRITE_BACK(0);\r
       break;\r
+    case ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK_NONSHAREABLE:\r
+      Attributes = TT_DESCRIPTOR_SECTION_WRITE_BACK(0);\r
+      Attributes &= ~TT_DESCRIPTOR_SECTION_S_SHARED;\r
+      break;\r
     case ARM_MEMORY_REGION_ATTRIBUTE_WRITE_THROUGH:\r
       Attributes = TT_DESCRIPTOR_SECTION_WRITE_THROUGH(0);\r
       break;\r
@@ -251,6 +260,10 @@ FillTranslationTable (
     case ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_BACK:\r
       Attributes = TT_DESCRIPTOR_SECTION_WRITE_BACK(1);\r
       break;\r
+    case ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_BACK_NONSHAREABLE:\r
+      Attributes = TT_DESCRIPTOR_SECTION_WRITE_BACK(1);\r
+      Attributes &= ~TT_DESCRIPTOR_SECTION_S_SHARED;\r
+      break;\r
     case ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_THROUGH:\r
       Attributes = TT_DESCRIPTOR_SECTION_WRITE_THROUGH(1);\r
       break;\r