TianoCore EDK2 master
Loading...
Searching...
No Matches
MmUnblockMemoryLib.c File Reference
#include <Uefi.h>
#include <Guid/MmUnblockRegion.h>
#include <Ppi/MmCommunication.h>
#include <Library/HobLib.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/PeiServicesLib.h>
#include <Base.h>
#include <PiPei.h>

Go to the source code of this file.

Functions

EFI_STATUS MmUnblockMemoryLibIsUnblockableRegion (IN VOID *HobStart, IN EFI_PHYSICAL_ADDRESS UnblockBase, IN EFI_PHYSICAL_ADDRESS UnblockEnd)
 
EFI_STATUS EFIAPI MmUnblockMemoryRequest (IN EFI_PHYSICAL_ADDRESS UnblockAddress, IN UINT64 NumberOfPages)
 

Detailed Description

The instance of MM Unblock Page Library. This library provides an interface to request non-MMRAM pages to be mapped/unblocked from inside MM environment. For MM modules that need to access regions outside of MMRAMs, the agents that set up these regions are responsible for invoking this API in order for these memory areas to be accessed from inside MM.

Copyright (c) Microsoft Corporation. Copyright (c) 2024, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file MmUnblockMemoryLib.c.

Function Documentation

◆ MmUnblockMemoryLibIsUnblockableRegion()

EFI_STATUS MmUnblockMemoryLibIsUnblockableRegion ( IN VOID *  HobStart,
IN EFI_PHYSICAL_ADDRESS  UnblockBase,
IN EFI_PHYSICAL_ADDRESS  UnblockEnd 
)

This function checks if the input buffer range [UnblockBase, UnblockEnd] is unblockable. The input range should be covered by the EfiRuntimeServicesData, EfiACPIMemoryNVS or EfiReservedMemoryType memory allocation HOB.

Parameters
[in]HobStartThe starting HOB pointer to search from.
[in]UnblockAddressBase address of the range to unblock.
[in]UnblockEndEnd address of the range to unblock.
Return values
RETURN_SUCCESSThe range is unblockable.
RETURN_INVALID_PARAMETERThe range to unblock contains invalid memory.

Definition at line 36 of file MmUnblockMemoryLib.c.

◆ MmUnblockMemoryRequest()

EFI_STATUS EFIAPI MmUnblockMemoryRequest ( IN EFI_PHYSICAL_ADDRESS  UnblockAddress,
IN UINT64  NumberOfPages 
)

This API provides a way to unblock certain data pages to be accessible inside MM environment.

Parameters
UnblockAddressThe address of buffer caller requests to unblock, the address has to be page aligned.
NumberOfPagesThe number of pages requested to be unblocked from MM environment.
Return values
RETURN_SUCCESSThe request goes through successfully.
RETURN_NOT_AVAILABLE_YETThe requested functionality is not produced yet.
RETURN_UNSUPPORTEDThe requested functionality is not supported on current platform.
RETURN_SECURITY_VIOLATIONThe requested address failed to pass security check for unblocking.
RETURN_INVALID_PARAMETERInput address either NULL pointer or not page aligned.
RETURN_INVALID_PARAMETERInput range to unblock contains invalid types memory other than EfiRuntimeServicesData, EfiACPIMemoryNVS, and EfiReservedMemory.
RETURN_INVALID_PARAMETERInput range to unblock contains memory that doesn't belong to any memory allocation HOB.
RETURN_ACCESS_DENIEDThe request is rejected due to system has passed certain boot phase.

Definition at line 123 of file MmUnblockMemoryLib.c.