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) 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
\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
ArmAttributes |= TT_AF;\r
\r
// Determine protection attributes\r
- if (EfiAttributes & EFI_MEMORY_WP) {\r
+ if (EfiAttributes & EFI_MEMORY_RO) {\r
ArmAttributes |= TT_AP_RO_RO;\r
}\r
\r