|
TianoCore EDK2 master
|
#include <Uefi.h>#include <Pi/PiMultiPhase.h>#include <AArch64/AArch64.h>#include <Library/BaseMemoryLib.h>#include <Library/CacheMaintenanceLib.h>#include <Library/MemoryAllocationLib.h>#include <Library/ArmLib.h>#include <Library/ArmMmuLib.h>#include <Library/BaseLib.h>#include <Library/DebugLib.h>#include <Library/HobLib.h>#include "ArmMmuLibInternal.h"Go to the source code of this file.
Macros | |
| #define | MIN_T0SZ 16 |
| #define | BITS_PER_LEVEL 9 |
| #define | MAX_VA_BITS_48 48 |
| #define | MAX_VA_BITS 52 |
Functions | |
| STATIC BOOLEAN | TranslationRegimeIsDual (VOID) |
| STATIC UINT64 | ArmMemoryAttributeToPageAttribute (IN ARM_MEMORY_REGION_ATTRIBUTES Attributes) |
| STATIC VOID | SetOutputAddress (IN UINTN *Entry, IN UINTN Address, IN BOOLEAN Lpa2Enabled) |
| STATIC UINT64 | GetOutputAddress (IN UINT64 Entry, IN BOOLEAN Lpa2Enabled) |
| STATIC UINTN | GetRootTableEntryCount (IN UINTN T0SZ) |
| STATIC INTN | GetRootTableLevel (IN UINTN T0SZ) |
| STATIC VOID | ReplaceTableEntry (IN UINT64 *Entry, IN UINT64 Value, IN UINT64 RegionStart, IN UINT64 BlockMask, IN BOOLEAN IsLiveBlockMapping) |
| STATIC VOID | FreePageTablesRecursive (IN UINT64 *TranslationTable, IN UINTN Level, IN BOOLEAN Lpa2Enabled) |
| STATIC BOOLEAN | IsBlockEntry (IN UINT64 Entry, IN UINTN Level) |
| STATIC BOOLEAN | IsTableEntry (IN UINT64 Entry, IN UINTN Level) |
| STATIC EFI_STATUS | UpdateRegionMappingRecursive (IN UINT64 RegionStart, IN UINT64 RegionEnd, IN UINT64 AttributeSetMask, IN UINT64 AttributeClearMask, IN UINT64 *PageTable, IN INTN Level, IN BOOLEAN IsRootTable, IN BOOLEAN TableIsLive, IN BOOLEAN Lpa2Enabled) |
| STATIC EFI_STATUS | UpdateRegionMapping (IN UINT64 RegionStart, IN UINT64 RegionLength, IN UINT64 AttributeSetMask, IN UINT64 AttributeClearMask, IN UINT64 *RootTable, IN BOOLEAN TableIsLive, IN BOOLEAN Lpa2Enabled) |
| STATIC EFI_STATUS | FillTranslationTable (IN UINT64 *RootTable, IN ARM_MEMORY_REGION_DESCRIPTOR *MemoryRegion, IN BOOLEAN Lpa2Enabled) |
| STATIC UINT64 | GcdAttributeToPageAttribute (IN UINT64 GcdAttributes) |
| EFI_STATUS | ArmSetMemoryAttributes (IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes, IN UINT64 AttributeMask) |
| EFI_STATUS EFIAPI | ArmConfigureMmu (IN ARM_MEMORY_REGION_DESCRIPTOR *MemoryTable, OUT VOID **TranslationTableBase OPTIONAL, OUT UINTN *TranslationTableSize OPTIONAL) |
| BOOLEAN | ArmLpa2Enabled (VOID) |
| RETURN_STATUS EFIAPI | ArmMmuBaseLibConstructor (VOID) |
Variables | |
| STATIC ARM_REPLACE_LIVE_TRANSLATION_ENTRY | mReplaceLiveEntryFunc = ArmReplaceLiveTranslationEntry |
File managing the MMU for ARMv8 architecture
Copyright (c) 2011-2025, ARM Limited. All rights reserved. Copyright (c) 2016, Linaro Limited. All rights reserved. Copyright (c) 2017, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file ArmMmuLibCore.c.
| #define BITS_PER_LEVEL 9 |
Definition at line 96 of file ArmMmuLibCore.c.
| #define MAX_VA_BITS 52 |
Definition at line 98 of file ArmMmuLibCore.c.
| #define MAX_VA_BITS_48 48 |
Definition at line 97 of file ArmMmuLibCore.c.
| #define MIN_T0SZ 16 |
Definition at line 95 of file ArmMmuLibCore.c.
| EFI_STATUS EFIAPI ArmConfigureMmu | ( | IN ARM_MEMORY_REGION_DESCRIPTOR * | MemoryTable, |
| OUT VOID **TranslationTableBase | OPTIONAL, | ||
| OUT UINTN *TranslationTableSize | OPTIONAL | ||
| ) |
Definition at line 631 of file ArmMmuLibCore.c.
| BOOLEAN ArmLpa2Enabled | ( | VOID | ) |
Check whether a 52-bit output address can be described by the translation tables (FEAT_LPA2).
| TRUE | 52-bit output address is enabled (LPA2 enabled). |
| FALSE | 52-bit output address is disabled (LPA2 disabled). |
Definition at line 833 of file ArmMmuLibCore.c.
Definition at line 46 of file ArmMmuLibCore.c.
| RETURN_STATUS EFIAPI ArmMmuBaseLibConstructor | ( | VOID | ) |
Definition at line 848 of file ArmMmuLibCore.c.
| EFI_STATUS ArmSetMemoryAttributes | ( | IN EFI_PHYSICAL_ADDRESS | BaseAddress, |
| IN UINT64 | Length, | ||
| IN UINT64 | Attributes, | ||
| IN UINT64 | AttributeMask | ||
| ) |
Set the requested memory permission attributes on a region of memory.
BaseAddress and Length must be aligned to EFI_PAGE_SIZE.
If Attributes contains a memory type attribute (EFI_MEMORY_UC/WC/WT/WB), the region is mapped according to this memory type, and additional memory permission attributes (EFI_MEMORY_RP/RO/XP) are taken into account as well, discarding any permission attributes that are currently set for the region. AttributeMask is ignored in this case, and must be set to 0x0.
If Attributes contains only a combination of memory permission attributes (EFI_MEMORY_RP/RO/XP), each page in the region will retain its existing memory type, even if it is not uniformly set across the region. In this case, AttributesMask may be set to a mask of permission attributes, and memory permissions omitted from this mask will not be updated for any page in the region. All attributes appearing in Attributes must appear in AttributeMask as well. (Attributes & ~AttributeMask must produce 0x0)
| [in] | BaseAddress | The physical address that is the start address of a memory region. |
| [in] | Length | The size in bytes of the memory region. |
| [in] | Attributes | Mask of memory attributes to set. |
| [in] | AttributeMask | Mask of memory attributes to take into account. |
| EFI_SUCCESS | The attributes were set for the memory region. |
| EFI_INVALID_PARAMETER | BaseAddress or Length is not suitably aligned. Invalid combination of Attributes and AttributeMask. |
| EFI_OUT_OF_RESOURCES | Requested attributes cannot be applied due to lack of system resources. |
Definition at line 579 of file ArmMmuLibCore.c.
| STATIC EFI_STATUS FillTranslationTable | ( | IN UINT64 * | RootTable, |
| IN ARM_MEMORY_REGION_DESCRIPTOR * | MemoryRegion, | ||
| IN BOOLEAN | Lpa2Enabled | ||
| ) |
Definition at line 481 of file ArmMmuLibCore.c.
| STATIC VOID FreePageTablesRecursive | ( | IN UINT64 * | TranslationTable, |
| IN UINTN | Level, | ||
| IN BOOLEAN | Lpa2Enabled | ||
| ) |
Definition at line 199 of file ArmMmuLibCore.c.
Definition at line 500 of file ArmMmuLibCore.c.
Definition at line 119 of file ArmMmuLibCore.c.
Definition at line 133 of file ArmMmuLibCore.c.
Definition at line 229 of file ArmMmuLibCore.c.
Definition at line 243 of file ArmMmuLibCore.c.
| STATIC VOID ReplaceTableEntry | ( | IN UINT64 * | Entry, |
| IN UINT64 | Value, | ||
| IN UINT64 | RegionStart, | ||
| IN UINT64 | BlockMask, | ||
| IN BOOLEAN | IsLiveBlockMapping | ||
| ) |
Definition at line 156 of file ArmMmuLibCore.c.
Definition at line 102 of file ArmMmuLibCore.c.
Whether the current translation regime is either EL1&0 or EL2&0, and therefore supports non-global, ASID-scoped memory mappings.
Definition at line 33 of file ArmMmuLibCore.c.
| STATIC EFI_STATUS UpdateRegionMapping | ( | IN UINT64 | RegionStart, |
| IN UINT64 | RegionLength, | ||
| IN UINT64 | AttributeSetMask, | ||
| IN UINT64 | AttributeClearMask, | ||
| IN UINT64 * | RootTable, | ||
| IN BOOLEAN | TableIsLive, | ||
| IN BOOLEAN | Lpa2Enabled | ||
| ) |
Definition at line 441 of file ArmMmuLibCore.c.
| STATIC EFI_STATUS UpdateRegionMappingRecursive | ( | IN UINT64 | RegionStart, |
| IN UINT64 | RegionEnd, | ||
| IN UINT64 | AttributeSetMask, | ||
| IN UINT64 | AttributeClearMask, | ||
| IN UINT64 * | PageTable, | ||
| IN INTN | Level, | ||
| IN BOOLEAN | IsRootTable, | ||
| IN BOOLEAN | TableIsLive, | ||
| IN BOOLEAN | Lpa2Enabled | ||
| ) |
Definition at line 261 of file ArmMmuLibCore.c.
| STATIC ARM_REPLACE_LIVE_TRANSLATION_ENTRY mReplaceLiveEntryFunc = ArmReplaceLiveTranslationEntry |
Definition at line 25 of file ArmMmuLibCore.c.