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
// 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
// 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
// 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
// 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
}\r
NextRegionLength += TT_DESCRIPTOR_SECTION_SIZE;\r
} else if (TT_DESCRIPTOR_SECTION_TYPE_IS_PAGE_TABLE(FirstLevelTable[i])) {\r
+ // In this case any bits set in the 'NextSectionAttributes' are garbage and were set from\r
+ // bits that are actually part of the pagetable address. We clear it out to zero so that\r
+ // the SyncCacheConfigPage will use the page attributes instead of trying to convert the\r
+ // section attributes into page attributes\r
+ NextSectionAttributes = 0;\r
Status = SyncCacheConfigPage (\r
i,FirstLevelTable[i],\r
NumberOfDescriptors, MemorySpaceMap,\r
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
}\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