]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Drivers/CpuDxe/Arm/Mmu.c
ArmPkg/CpuDxe: translate invalid memory types in EfiAttributeToArmAttribute
[mirror_edk2.git] / ArmPkg / Drivers / CpuDxe / Arm / Mmu.c
index 14fc22d7a59fb1637aeca74305a9a28aa518a803..b6ba975b353ab66540457d9b1a49d00db8f44319 100644 (file)
@@ -3,6 +3,7 @@
 Copyright (c) 2009, Hewlett-Packard Company. All rights reserved.<BR>\r
 Portions copyright (c) 2010, Apple Inc. All rights reserved.<BR>\r
 Portions copyright (c) 2013, ARM Ltd. All rights reserved.<BR>\r
+Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
@@ -62,7 +63,7 @@ SectionToGcdAttributes (
   // determine protection attributes\r
   switch(SectionAttributes & TT_DESCRIPTOR_SECTION_AP_MASK) {\r
     case TT_DESCRIPTOR_SECTION_AP_NO_NO: // no read, no write\r
-      //*GcdAttributes |= EFI_MEMORY_WP | EFI_MEMORY_RP;\r
+      //*GcdAttributes |= EFI_MEMORY_RO | EFI_MEMORY_RP;\r
       break;\r
 \r
     case TT_DESCRIPTOR_SECTION_AP_RW_NO:\r
@@ -73,7 +74,7 @@ SectionToGcdAttributes (
     // read only cases map to write-protect\r
     case TT_DESCRIPTOR_SECTION_AP_RO_NO:\r
     case TT_DESCRIPTOR_SECTION_AP_RO_RO:\r
-      *GcdAttributes |= EFI_MEMORY_WP;\r
+      *GcdAttributes |= EFI_MEMORY_RO;\r
       break;\r
 \r
     default:\r
@@ -126,7 +127,7 @@ PageToGcdAttributes (
   // determine protection attributes\r
   switch(PageAttributes & TT_DESCRIPTOR_PAGE_AP_MASK) {\r
     case TT_DESCRIPTOR_PAGE_AP_NO_NO: // no read, no write\r
-      //*GcdAttributes |= EFI_MEMORY_WP | EFI_MEMORY_RP;\r
+      //*GcdAttributes |= EFI_MEMORY_RO | EFI_MEMORY_RP;\r
       break;\r
 \r
     case TT_DESCRIPTOR_PAGE_AP_RW_NO:\r
@@ -137,7 +138,7 @@ PageToGcdAttributes (
     // read only cases map to write-protect\r
     case TT_DESCRIPTOR_PAGE_AP_RO_NO:\r
     case TT_DESCRIPTOR_PAGE_AP_RO_RO:\r
-      *GcdAttributes |= EFI_MEMORY_WP;\r
+      *GcdAttributes |= EFI_MEMORY_RO;\r
       break;\r
 \r
     default:\r
@@ -730,20 +731,14 @@ EfiAttributeToArmAttribute (
       ArmAttributes = TT_DESCRIPTOR_SECTION_CACHE_POLICY_WRITE_BACK_ALLOC; // TEX [2:0] = 001, C=1, B=1\r
       break;\r
 \r
-    case EFI_MEMORY_WP:\r
-    case EFI_MEMORY_XP:\r
-    case EFI_MEMORY_RP:\r
     case EFI_MEMORY_UCE:\r
     default:\r
-      // Cannot be implemented UEFI definition unclear for ARM\r
-      // Cause a page fault if these ranges are accessed.\r
       ArmAttributes = TT_DESCRIPTOR_SECTION_TYPE_FAULT;\r
-      DEBUG ((EFI_D_PAGE, "SetMemoryAttributes(): Unsupported attribute %x will page fault on access\n", EfiAttributes));\r
       break;\r
   }\r
 \r
   // Determine protection attributes\r
-  if (EfiAttributes & EFI_MEMORY_WP) {\r
+  if (EfiAttributes & EFI_MEMORY_RO) {\r
     ArmAttributes |= TT_DESCRIPTOR_SECTION_AP_RO_RO;\r
   } else {\r
     ArmAttributes |= TT_DESCRIPTOR_SECTION_AP_RW_RW;\r