TianoCore EDK2 master
|
#include <Uefi.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/CacheMaintenanceLib.h>
#include <Library/CpuMmuLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Protocol/DebugSupport.h>
#include <Register/LoongArch64/Csr.h>
#include "TlbInvalid.h"
#include "TlbExceptionHandle.h"
#include "Page.h"
Go to the source code of this file.
Functions | |
STATIC BOOLEAN | MmuIsInit (VOID) |
STATIC BOOLEAN | MmuIsEnabled (VOID) |
STATIC BOOLEAN | IsValidPte (IN UINTN Entry) |
STATIC BOOLEAN | IsValidHugePage (IN UINTN Entry) |
STATIC UINTN | SetValidPte (IN UINTN Entry) |
STATIC UINTN | ParseMaxPageTableLevel (IN UINT64 PageWalkCfg) |
STATIC UINTN | ParsePageTableBitWidth (IN UINT64 PageWalkCfg) |
STATIC BOOLEAN | IsBlockEntry (IN UINTN Entry, IN UINTN Level, IN UINT64 PageWalkCfg) |
STATIC BOOLEAN | IsTableEntry (IN UINTN Entry, IN UINTN Level, IN UINT64 PageWalkCfg) |
STATIC VOID | ReplaceTableEntry (IN UINTN *Entry, IN UINTN Value, IN UINTN RegionStart, IN BOOLEAN IsLiveBlockMapping) |
STATIC UINTN | GetPpnfromPte (IN UINTN Entry) |
STATIC UINTN | SetPpnToPte (UINTN Entry, UINTN Address) |
STATIC VOID | FreePageTablesRecursive (IN UINTN *TranslationTable, IN UINT64 PageWalkCfg, IN UINTN Level) |
STATIC EFI_STATUS | UpdateRegionMappingRecursive (IN UINTN RegionStart, IN UINTN RegionEnd, IN UINTN AttributeSetMask, IN UINTN AttributeClearMask, IN UINTN *PageTable, IN UINTN Level, IN UINT64 PageWalkCfg, IN BOOLEAN TableIsLive) |
EFI_STATUS | UpdateRegionMapping (IN UINTN RegionStart, IN UINTN RegionLength, IN UINT64 PageWalkCfg, IN UINTN AttributeSetMask, IN UINTN AttributeClearMask, IN UINTN *RootTable, IN BOOLEAN TableIsLive) |
UINT64 EFIAPI | EfiAttributeConverse (IN UINT64 EfiAttributes) |
EFI_STATUS | TlbRefillHandlerConfigure (VOID) |
EFI_STATUS EFIAPI | MemoryRegionMap (IN OUT UINTN *PageTable OPTIONAL, IN UINT64 PageWalkCfg, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes, IN UINT64 AttributeMask) |
CPU Memory Map Unit Handler Library common functions.
Copyright (c) 2011-2020, ARM Limited. All rights reserved. Copyright (c) 2016, Linaro Limited. All rights reserved. Copyright (c) 2017, Intel Corporation. All rights reserved.
Copyright (c) 2023, Ventana Micro Systems Inc. All Rights Reserved.
Copyright (c) 2024 Loongson Technology Corporation Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file CpuMmu.c.
UINT64 EFIAPI EfiAttributeConverse | ( | IN UINT64 | EfiAttributes | ) |
EFI_STATUS EFIAPI MemoryRegionMap | ( | IN OUT UINTN *PageTable | OPTIONAL, |
IN UINT64 | PageWalkCfg, | ||
IN EFI_PHYSICAL_ADDRESS | BaseAddress, | ||
IN UINT64 | Length, | ||
IN UINT64 | Attributes, | ||
IN UINT64 | AttributeMask | ||
) |
Maps the memory region in the page table to the specified attributes.
[in,out] | PageTable | The pointer to the page table to update, or pointer to NULL if a new page table is to be created. |
[in] | PageWalkCfg | The page walk controller configure. |
[in] | BaseAddress | The base address of the memory region to set the Attributes. |
[in] | Length | The length of the memory region to set the Attributes. |
[in] | Attributes | The bitmask of attributes to set, which refer to UEFI SPEC 7.2.3(EFI_BOOT_SERVICES.GetMemoryMap()). |
[in] | AttributeMask | Mask of memory attributes to take into account. |
EFI_SUCCESS | The Attributes was set successfully or Length is 0. |
EFI_INVALID_PARAMETER | PageTable is NULL, PageWalkCfg is invalid. |
EFI_UNSUPPORTED | *PageTable is NULL. |
STATIC BOOLEAN MmuIsEnabled | ( | VOID | ) |
STATIC BOOLEAN MmuIsInit | ( | VOID | ) |
EFI_STATUS TlbRefillHandlerConfigure | ( | VOID | ) |
TLB refill handler configure.
VOID. |
EFI_SUCCESS | TLB refill handler configure successfully. EFI_UNSUPPORTED Size not aligned. |
TLB Re-entry address at the end of exception vector, a vector is up to 512 bytes, so the starting address is: total exception vector size + total interrupt vector size + base. The total size of TLB handler and exception vector size and interrupt vector size should not be lager than 64KB.
EFI_STATUS UpdateRegionMapping | ( | IN UINTN | RegionStart, |
IN UINTN | RegionLength, | ||
IN UINT64 | PageWalkCfg, | ||
IN UINTN | AttributeSetMask, | ||
IN UINTN | AttributeClearMask, | ||
IN UINTN * | RootTable, | ||
IN BOOLEAN | TableIsLive | ||
) |
Update region mapping at root table.
RegionStart | The start address of the region. |
RegionLength | The length of the region. |
PageWalkCfg | Page table configure value. |
AttributeSetMask | The attribute mask to be set. |
AttributeClearMask | The attribute mask to be clear. |
RootTable | The pointer of root table. |
TableIsLive | TRUE if this is live update, FALSE otherwise. |
EFI_INVALID_PARAMETER | The RegionStart or RegionLength was not valid. |
EFI_OUT_OF_RESOURCES | Not enough resource. |
EFI_SUCCESS | The operation succesfully. |
STATIC EFI_STATUS UpdateRegionMappingRecursive | ( | IN UINTN | RegionStart, |
IN UINTN | RegionEnd, | ||
IN UINTN | AttributeSetMask, | ||
IN UINTN | AttributeClearMask, | ||
IN UINTN * | PageTable, | ||
IN UINTN | Level, | ||
IN UINT64 | PageWalkCfg, | ||
IN BOOLEAN | TableIsLive | ||
) |
Update region mapping recursively.
RegionStart | The start address of the region. |
RegionEnd | The end address of the region. |
AttributeSetMask | The attribute mask to be set. |
AttributeClearMask | The attribute mask to be clear. |
PageTable | The pointer of current page table. |
Level | The current level. |
PageWalkCfg | Page table configure value. |
TableIsLive | TRUE if this is live update, FALSE otherwise. |
EFI_OUT_OF_RESOURCES | Not enough resource. |
EFI_SUCCESS | The operation succesfully. |