TianoCore EDK2 master
|
#include "PiSmmCpuCommon.h"
#include <Library/DxeServicesTableLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
Go to the source code of this file.
Macros | |
#define | EFI_MEMORY_PRESENT 0x0100000000000000ULL |
#define | EFI_MEMORY_INITIALIZED 0x0200000000000000ULL |
#define | EFI_MEMORY_TESTED 0x0400000000000000ULL |
#define | PREVIOUS_MEMORY_DESCRIPTOR(MemoryDescriptor, Size) ((EFI_MEMORY_DESCRIPTOR *)((UINT8 *)(MemoryDescriptor) - (Size))) |
Functions | |
STATIC VOID | SortMemoryMap (IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, IN UINTN MemoryMapSize, IN UINTN DescriptorSize) |
BOOLEAN | IsUefiPageNotPresent (IN EFI_MEMORY_DESCRIPTOR *MemoryMap) |
STATIC VOID | MergeMemoryMapForNotPresentEntry (IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, IN OUT UINTN *MemoryMapSize, IN UINTN DescriptorSize) |
VOID | GetGcdMemoryMap (VOID) |
VOID | GetUefiMemoryAttributesTable (VOID) |
VOID | GetUefiMemoryMap (VOID) |
VOID | UpdateUefiMemMapAttributes (VOID) |
EFI_PHYSICAL_ADDRESS | GetSmmProfileData (IN OUT UINT64 *Size) |
BOOLEAN | IsNonMmramLoggingAddress (IN UINT64 Address) |
BOOLEAN | IsSmmCommBufferForbiddenAddress (IN UINT64 Address) |
VOID | CreateExtendedProtectionRange (OUT MM_CPU_MEMORY_REGION **MemoryRegion, OUT UINTN *MemoryRegionCount) |
VOID | CreateNonMmramMemMap (IN UINT8 PhysicalAddressBits, OUT MM_CPU_MEMORY_REGION **MemoryRegion, OUT UINTN *MemoryRegionCount) |
Copyright (c) 2016 - 2024, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file NonMmramMapDxeSmm.c.
#define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL |
Definition at line 17 of file NonMmramMapDxeSmm.c.
#define EFI_MEMORY_PRESENT 0x0100000000000000ULL |
Definition at line 16 of file NonMmramMapDxeSmm.c.
#define EFI_MEMORY_TESTED 0x0400000000000000ULL |
Definition at line 18 of file NonMmramMapDxeSmm.c.
#define PREVIOUS_MEMORY_DESCRIPTOR | ( | MemoryDescriptor, | |
Size | |||
) | ((EFI_MEMORY_DESCRIPTOR *)((UINT8 *)(MemoryDescriptor) - (Size))) |
Definition at line 20 of file NonMmramMapDxeSmm.c.
VOID CreateExtendedProtectionRange | ( | OUT MM_CPU_MEMORY_REGION ** | MemoryRegion, |
OUT UINTN * | MemoryRegionCount | ||
) |
Create extended protection MemoryRegion. Return all MMIO ranges that are reported in GCD service at EndOfDxe.
The caller is responsible for freeing MemoryRegion via FreePool().
[out] | MemoryRegion | Returned Non-Mmram Memory regions. |
[out] | MemoryRegionCount | A pointer to the number of Memory regions. |
Definition at line 609 of file NonMmramMapDxeSmm.c.
VOID CreateNonMmramMemMap | ( | IN UINT8 | PhysicalAddressBits, |
OUT MM_CPU_MEMORY_REGION ** | MemoryRegion, | ||
OUT UINTN * | MemoryRegionCount | ||
) |
Create the Non-Mmram Memory Region. Build MemoryRegion to cover [0, 2^PhysicalAddressBits) by excluding all Smram range. The memory attribute is all-allowed (read/write/executable).
The caller is responsible for freeing MemoryRegion via FreePool().
[in] | PhysicalAddressBits | The bits of physical address to map. |
[out] | MemoryRegion | Returned Non-Mmram Memory regions. |
[out] | MemoryRegionCount | A pointer to the number of Memory regions. |
Definition at line 689 of file NonMmramMapDxeSmm.c.
VOID GetGcdMemoryMap | ( | VOID | ) |
This function caches the GCD memory map information.
Definition at line 170 of file NonMmramMapDxeSmm.c.
EFI_PHYSICAL_ADDRESS GetSmmProfileData | ( | IN OUT UINT64 * | Size | ) |
Get SmmProfileData.
[in,out] | Size | Return Size of SmmProfileData. |
Definition at line 489 of file NonMmramMapDxeSmm.c.
VOID GetUefiMemoryAttributesTable | ( | VOID | ) |
Get UEFI MemoryAttributesTable.
Definition at line 226 of file NonMmramMapDxeSmm.c.
VOID GetUefiMemoryMap | ( | VOID | ) |
This function caches the UEFI memory map information.
Definition at line 246 of file NonMmramMapDxeSmm.c.
BOOLEAN IsNonMmramLoggingAddress | ( | IN UINT64 | Address | ) |
Return if the Address is the NonMmram logging Address.
[in] | Address | the address to be checked |
Definition at line 522 of file NonMmramMapDxeSmm.c.
BOOLEAN IsSmmCommBufferForbiddenAddress | ( | IN UINT64 | Address | ) |
Return if the Address is forbidden as SMM communication buffer.
[in] | Address | the address to be checked |
Definition at line 540 of file NonMmramMapDxeSmm.c.
BOOLEAN IsUefiPageNotPresent | ( | IN EFI_MEMORY_DESCRIPTOR * | MemoryMap | ) |
Return if a UEFI memory page should be marked as not present in SMM page table. If the memory map entries type is EfiLoaderCode/Data, EfiBootServicesCode/Data, EfiConventionalMemory, EfiUnusableMemory, EfiACPIReclaimMemory, return TRUE. Or return FALSE.
[in] | MemoryMap | A pointer to the memory descriptor. |
Definition at line 85 of file NonMmramMapDxeSmm.c.
STATIC VOID MergeMemoryMapForNotPresentEntry | ( | IN OUT EFI_MEMORY_DESCRIPTOR * | MemoryMap, |
IN OUT UINTN * | MemoryMapSize, | ||
IN UINTN | DescriptorSize | ||
) |
Merge continuous memory map entries whose type is EfiLoaderCode/Data, EfiBootServicesCode/Data, EfiConventionalMemory, EfiUnusableMemory, EfiACPIReclaimMemory, because the memory described by these entries will be set as NOT present in SMM page table.
[in,out] | MemoryMap | A pointer to the buffer in which firmware places the current memory map. |
[in,out] | MemoryMapSize | A pointer to the size, in bytes, of the MemoryMap buffer. On input, this is the size of the current memory map. On output, it is the size of new memory map after merge. |
[in] | DescriptorSize | Size, in bytes, of an individual EFI_MEMORY_DESCRIPTOR. |
Definition at line 119 of file NonMmramMapDxeSmm.c.
STATIC VOID SortMemoryMap | ( | IN OUT EFI_MEMORY_DESCRIPTOR * | MemoryMap, |
IN UINTN | MemoryMapSize, | ||
IN UINTN | DescriptorSize | ||
) |
Sort memory map entries based upon PhysicalStart, from low to high.
MemoryMap | A pointer to the buffer in which firmware places the current memory map. |
MemoryMapSize | Size, in bytes, of the MemoryMap buffer. |
DescriptorSize | Size, in bytes, of an individual EFI_MEMORY_DESCRIPTOR. |
Definition at line 42 of file NonMmramMapDxeSmm.c.
VOID UpdateUefiMemMapAttributes | ( | VOID | ) |
This function updates UEFI memory attribute according to UEFI memory map.
Definition at line 318 of file NonMmramMapDxeSmm.c.
UINTN mGcdMemNumberOfDesc = 0 |
Definition at line 28 of file NonMmramMapDxeSmm.c.
EFI_GCD_MEMORY_SPACE_DESCRIPTOR* mGcdMemSpace = NULL |
Definition at line 27 of file NonMmramMapDxeSmm.c.
UINTN mUefiDescriptorSize |
Definition at line 25 of file NonMmramMapDxeSmm.c.
EFI_MEMORY_ATTRIBUTES_TABLE* mUefiMemoryAttributesTable = NULL |
Definition at line 30 of file NonMmramMapDxeSmm.c.
EFI_MEMORY_DESCRIPTOR* mUefiMemoryMap |
Definition at line 23 of file NonMmramMapDxeSmm.c.
UINTN mUefiMemoryMapSize |
Definition at line 24 of file NonMmramMapDxeSmm.c.