]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c
ArmPkg: Fix various typos
[mirror_edk2.git] / ArmPkg / Drivers / CpuDxe / AArch64 / Mmu.c
index 15d5a81732334211a8e15ae957b826308187bbf4..3b6c5e733709836fdca206ff8e1ad1134f25d4e5 100644 (file)
@@ -5,13 +5,7 @@ Portions copyright (c) 2010, Apple Inc. All rights reserved.<BR>
 Portions copyright (c) 2011-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
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 \r
 --*/\r
@@ -204,21 +198,23 @@ EfiAttributeToArmAttribute (
 \r
   switch (EfiAttributes & EFI_MEMORY_CACHETYPE_MASK) {\r
   case EFI_MEMORY_UC:\r
-    ArmAttributes = TT_ATTR_INDX_DEVICE_MEMORY;\r
+    if (ArmReadCurrentEL () == AARCH64_EL2) {\r
+      ArmAttributes = TT_ATTR_INDX_DEVICE_MEMORY | TT_XN_MASK;\r
+    } else {\r
+      ArmAttributes = TT_ATTR_INDX_DEVICE_MEMORY | TT_UXN_MASK | TT_PXN_MASK;\r
+    }\r
     break;\r
   case EFI_MEMORY_WC:\r
     ArmAttributes = TT_ATTR_INDX_MEMORY_NON_CACHEABLE;\r
     break;\r
   case EFI_MEMORY_WT:\r
-    ArmAttributes = TT_ATTR_INDX_MEMORY_WRITE_THROUGH;\r
+    ArmAttributes = TT_ATTR_INDX_MEMORY_WRITE_THROUGH | TT_SH_INNER_SHAREABLE;\r
     break;\r
   case EFI_MEMORY_WB:\r
-    ArmAttributes = TT_ATTR_INDX_MEMORY_WRITE_BACK;\r
+    ArmAttributes = TT_ATTR_INDX_MEMORY_WRITE_BACK | TT_SH_INNER_SHAREABLE;\r
     break;\r
   default:\r
-    DEBUG ((EFI_D_ERROR, "EfiAttributeToArmAttribute: 0x%lX attributes is not supported.\n", EfiAttributes));\r
-    ASSERT (0);\r
-    ArmAttributes = TT_ATTR_INDX_DEVICE_MEMORY;\r
+    ArmAttributes = TT_ATTR_INDX_MASK;\r
   }\r
 \r
   // Set the access flag to match the block attributes\r
@@ -285,7 +281,7 @@ GetMemoryRegionRec (
     BlockEntry++;\r
   } else if (EntryType == BlockEntryType) {\r
     // We have found the BlockEntry attached to the address. We save its start address (the start\r
-    // address might be before the 'BaseAdress') and attributes\r
+    // address might be before the 'BaseAddress') and attributes\r
     *BaseAddress      = *BaseAddress & ~(TT_ADDRESS_AT_LEVEL(TableLevel) - 1);\r
     *RegionLength     = 0;\r
     *RegionAttributes = *BlockEntry & TT_ATTRIBUTES_MASK;\r