TianoCore EDK2 master
|
#include <StandaloneMmIplPei.h>
#include <Guid/MpInformation2.h>
#include <Guid/AcpiS3Context.h>
#include <Guid/MmAcpiS3Enable.h>
#include <Guid/MmCpuSyncConfig.h>
#include <Guid/MmProfileData.h>
#include <Guid/MmUnblockRegion.h>
#include <Register/Intel/Cpuid.h>
#include <Register/Intel/ArchitecturalMsr.h>
Go to the source code of this file.
Data Structures | |
struct | MM_IPL_MEMORY_REGION |
Functions | |
VOID * | MmIplCreateHob (IN VOID *Hob, IN UINT16 HobType, IN UINT16 HobLength) |
VOID | MmIplBuildMemoryResourceHob (IN EFI_HOB_RESOURCE_DESCRIPTOR *Hob, IN EFI_RESOURCE_TYPE ResourceType, IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, IN EFI_PHYSICAL_ADDRESS PhysicalStart, IN UINT64 NumberOfBytes, IN EFI_GUID *Owner) |
VOID | MmIplBuildFvHob (IN UINT8 *Hob, IN OUT UINTN *HobBufferSize, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length) |
VOID | MmIplBuildMmAcpiS3EnableHob (IN UINT8 *Hob, IN OUT UINTN *HobBufferSize) |
VOID | MmIplBuildMmCpuSyncConfigHob (IN UINT8 *Hob, IN OUT UINTN *HobBufferSize) |
VOID | MmIplCopyGuidHob (IN UINT8 *HobBuffer, IN OUT UINTN *HobBufferSize, IN EFI_GUID *Guid, IN BOOLEAN MultiInstances) |
VOID | MmIplBuildMmCoreModuleHob (IN UINT8 *Hob, IN OUT UINTN *HobBufferSize, IN CONST EFI_GUID *ModuleName, IN EFI_PHYSICAL_ADDRESS Base, IN UINT64 Length, IN EFI_PHYSICAL_ADDRESS EntryPoint) |
EFI_HOB_MEMORY_ALLOCATION * | BuildMmProfileDataHobInPeiHobList (VOID) |
VOID | MmIplBuildMmProfileHobs (IN UINT8 *HobBuffer, IN OUT UINTN *HobBufferSize) |
VOID | MmIplBuildResourceHobForUnblockedRegion (IN UINT8 *HobBuffer, IN OUT UINTN *HobBufferSize) |
VOID | CollectUnblockMemoryRegions (IN OUT MM_IPL_MEMORY_REGION *MemoryRegion, IN OUT UINTN *MemoryRegionCount) |
VOID | CollectPlatformMemoryRegions (IN UINT8 *PlatformHobList, IN UINTN PlatformHobSize, IN OUT MM_IPL_MEMORY_REGION *MemoryRegion, IN OUT UINTN *MemoryRegionCount) |
INTN EFIAPI | MemoryRegionBaseAddressCompare (IN CONST VOID *Buffer1, IN CONST VOID *Buffer2) |
BOOLEAN | MmIplIs5LevelPagingNeeded (VOID) |
UINT8 | MmIplCalculateMaximumSupportAddress (VOID) |
VOID | MmIplBuildResourceHobForAllSystemMemory (IN UINT8 *HobBuffer, IN OUT UINTN *HobBufferSize, IN VOID *PlatformHobList, IN UINTN PlatformHobSize, IN EFI_MMRAM_HOB_DESCRIPTOR_BLOCK *Block, IN EFI_HOB_MEMORY_ALLOCATION *MmProfileDataHob) |
UINTN | GetRemainingHobSize (IN UINTN TotalHobSize, IN UINTN UsedSize) |
RETURN_STATUS | CreateMmFoundationHobList (IN UINT8 *FoundationHobList, IN OUT UINTN *FoundationHobSize, IN UINT8 *PlatformHobList, IN UINTN PlatformHobSize, IN EFI_PHYSICAL_ADDRESS MmFvBase, IN UINT64 MmFvSize, IN EFI_GUID *MmCoreFileName, IN EFI_PHYSICAL_ADDRESS MmCoreImageAddress, IN UINT64 MmCoreImageSize, IN EFI_PHYSICAL_ADDRESS MmCoreEntryPoint, IN EFI_HOB_MEMORY_ALLOCATION *MmProfileDataHob, IN EFI_MMRAM_HOB_DESCRIPTOR_BLOCK *Block) |
Copyright (c) 2024, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file MmFoundationHob.c.
EFI_HOB_MEMORY_ALLOCATION * BuildMmProfileDataHobInPeiHobList | ( | VOID | ) |
Build memory allocation HOB in PEI HOB list for MM profile data.
This function is to allocate memory for MM profile data.
Definition at line 319 of file MmFoundationHob.c.
VOID CollectPlatformMemoryRegions | ( | IN UINT8 * | PlatformHobList, |
IN UINTN | PlatformHobSize, | ||
IN OUT MM_IPL_MEMORY_REGION * | MemoryRegion, | ||
IN OUT UINTN * | MemoryRegionCount | ||
) |
Create MMIO memory map according to platform HOB.
[in] | PlatformHobList | Platform HOB list. |
[in] | PlatformHobSize | Platform HOB size. |
[in,out] | MemoryRegion | Memory regions. |
[in,out] | MemoryRegionCount | Count of MMIO regions |
Definition at line 499 of file MmFoundationHob.c.
VOID CollectUnblockMemoryRegions | ( | IN OUT MM_IPL_MEMORY_REGION * | MemoryRegion, |
IN OUT UINTN * | MemoryRegionCount | ||
) |
Collect unblock memory regions.
[in,out] | MemoryRegion | Pointer to unblock memory regions. |
[in,out] | MemoryRegionCount | Count of unblock memory regions. |
Definition at line 459 of file MmFoundationHob.c.
RETURN_STATUS CreateMmFoundationHobList | ( | IN UINT8 * | FoundationHobList, |
IN OUT UINTN * | FoundationHobSize, | ||
IN UINT8 * | PlatformHobList, | ||
IN UINTN | PlatformHobSize, | ||
IN EFI_PHYSICAL_ADDRESS | MmFvBase, | ||
IN UINT64 | MmFvSize, | ||
IN EFI_GUID * | MmCoreFileName, | ||
IN EFI_PHYSICAL_ADDRESS | MmCoreImageAddress, | ||
IN UINT64 | MmCoreImageSize, | ||
IN EFI_PHYSICAL_ADDRESS | MmCoreEntryPoint, | ||
IN EFI_HOB_MEMORY_ALLOCATION * | MmProfileDataHob, | ||
IN EFI_MMRAM_HOB_DESCRIPTOR_BLOCK * | Block | ||
) |
Create the MM foundation specific HOB list which StandaloneMm Core needed.
This function build the MM foundation specific HOB list needed by StandaloneMm Core based on the PEI HOB list.
[in] | FoundationHobList | The foundation HOB list to be used for HOB creation. |
[in,out] | FoundationHobSize | The foundation HOB size. On return, the expected/used size. |
[in] | PlatformHobList | Platform HOB list. |
[in] | PlatformHobSize | Platform HOB size. |
[in] | MmFvBase | Base of firmare volume which included MM core dirver. |
[in] | MmFvSize | Size of firmare volume which included MM core dirver. |
[in] | MmCoreFileName | File name of MM core dirver. |
[in] | MmCoreImageAddress | Image address of MM core dirver. |
[in] | MmCoreImageSize | Image size of MM core dirver. |
[in] | MmCoreEntryPoint | Entry pinter of MM core dirver. |
[in] | MmProfileDataHob | Pointer to Mm profile data HOB. |
[in] | Block | Pointer of MMRAM descriptor block. |
RETURN_BUFFER_TOO_SMALL | The buffer is too small for HOB creation. BufferSize is updated to indicate the expected buffer size. When the input BufferSize is bigger than the expected buffer size, the BufferSize value will be changed the used buffer size. |
RETURN_SUCCESS | HOB List is created/updated successfully or the input Length is 0. |
Definition at line 834 of file MmFoundationHob.c.
Get remaining size for building HOBs.
[in] | TotalHobSize | Total size of foundation HOBs. |
[in] | UsedSize | Required HOBs' size. |
MAX | remaining size for building HOBs |
Definition at line 794 of file MmFoundationHob.c.
Function to compare 2 MM_IPL_MEMORY_REGION pointer based on Base.
[in] | Buffer1 | pointer to MM_IPL_MEMORY_REGION pointer to compare |
[in] | Buffer2 | pointer to second MM_IPL_MEMORY_REGION pointer to compare |
0 | Buffer1 equal to Buffer2 |
<0 | Buffer1 is less than Buffer2 |
>0 | Buffer1 is greater than Buffer2 |
Definition at line 555 of file MmFoundationHob.c.
VOID MmIplBuildFvHob | ( | IN UINT8 * | Hob, |
IN OUT UINTN * | HobBufferSize, | ||
IN EFI_PHYSICAL_ADDRESS | BaseAddress, | ||
IN UINT64 | Length | ||
) |
Builds a Firmware Volume HOB.
This function builds a Firmware Volume HOB. It can only be invoked during PEI phase; If new HOB buffer is NULL, then ASSERT().
[in] | Hob | The pointer of new HOB buffer. |
[in,out] | HobBufferSize | The available size of the HOB buffer when as input. The used size of when as output. |
[in] | BaseAddress | The base address of the Firmware Volume. |
[in] | Length | The size of the Firmware Volume in bytes. |
Definition at line 110 of file MmFoundationHob.c.
VOID MmIplBuildMemoryResourceHob | ( | IN EFI_HOB_RESOURCE_DESCRIPTOR * | Hob, |
IN EFI_RESOURCE_TYPE | ResourceType, | ||
IN EFI_RESOURCE_ATTRIBUTE_TYPE | ResourceAttribute, | ||
IN EFI_PHYSICAL_ADDRESS | PhysicalStart, | ||
IN UINT64 | NumberOfBytes, | ||
IN EFI_GUID * | Owner | ||
) |
Builds a HOB that describes a chunk of system memory.
This function builds a HOB that describes a chunk of system memory. If there is no additional space for HOB creation, then ASSERT().
[in] | Hob | The pointer of new HOB buffer. |
[in] | ResourceType | The type of resource described by this HOB. |
[in] | ResourceAttribute | The resource attributes of the memory described by this HOB. |
[in] | PhysicalStart | The 64 bit physical address of memory described by this HOB. |
[in] | NumberOfBytes | The length of the memory described by this HOB in bytes. |
[in] | Owner | The pointer of GUID. |
Definition at line 71 of file MmFoundationHob.c.
Builds MM ACPI S3 Enable HOB.
This function builds MM ACPI S3 Enable HOB. It can only be invoked during PEI phase; If new HOB buffer is NULL, then ASSERT().
[in] | Hob | The pointer of new HOB buffer. |
[in,out] | HobBufferSize | The available size of the HOB buffer when as input. The used size of when as output. |
Definition at line 146 of file MmFoundationHob.c.
VOID MmIplBuildMmCoreModuleHob | ( | IN UINT8 * | Hob, |
IN OUT UINTN * | HobBufferSize, | ||
IN CONST EFI_GUID * | ModuleName, | ||
IN EFI_PHYSICAL_ADDRESS | Base, | ||
IN UINT64 | Length, | ||
IN EFI_PHYSICAL_ADDRESS | EntryPoint | ||
) |
Builds a HOB for a loaded PE32 module.
This function builds a HOB for a loaded PE32 module. It can only be invoked during PEI phase; If physical address of the Module is not 4K aligned, then ASSERT(). If new HOB buffer is NULL, then ASSERT().
[in] | Hob | The pointer of new HOB buffer. |
[in,out] | HobBufferSize | The available size of the HOB buffer when as input. The used size of when as output. |
[in] | ModuleName | The GUID File Name of the module. |
[in] | Base | The 64 bit physical address of the module. |
[in] | Length | The length of the module in bytes. |
[in] | EntryPoint | The 64 bit physical address of the module entry point. |
Definition at line 274 of file MmFoundationHob.c.
Builds MM cpu sync configuration HOB.
This function builds smm cpu sync configuration HOB. It can only be invoked during PEI phase; If new HOB buffer is NULL, then ASSERT().
[in] | Hob | The pointer of new HOB buffer. |
[in,out] | HobBufferSize | The available size of the HOB buffer when as input. The used size of when as output. |
Definition at line 183 of file MmFoundationHob.c.
Build memory allocation and resource HOB for MM profile data
This function builds HOBs for MM profile data, one is memory allocation HOB, another is resource HOB.
[in] | HobBuffer | The pointer of new HOB buffer. |
[in,out] | HobBufferSize | The total size of the same GUID HOBs when as input. The size will be 0 for output when build HOB fail. |
Definition at line 363 of file MmFoundationHob.c.
VOID MmIplBuildResourceHobForAllSystemMemory | ( | IN UINT8 * | HobBuffer, |
IN OUT UINTN * | HobBufferSize, | ||
IN VOID * | PlatformHobList, | ||
IN UINTN | PlatformHobSize, | ||
IN EFI_MMRAM_HOB_DESCRIPTOR_BLOCK * | Block, | ||
IN EFI_HOB_MEMORY_ALLOCATION * | MmProfileDataHob | ||
) |
Build resource HOB to cover [0, PhysicalAddressBits length] by excluding all Mmram ranges, MM Profile data, Unblock memory ranges and MMIO ranges.
[in] | HobBuffer | The pointer of new HOB buffer. |
[in,out] | HobBufferSize | The available size of the HOB buffer when as input. The used size of when as output. |
[in] | PlatformHobList | Platform HOB list. |
[in] | PlatformHobSize | Platform HOB size. |
[in] | Block | Pointer of MMRAM descriptor block. |
[in] | MmProfileDataHob | Pointer to MM profile data HOB. |
Definition at line 670 of file MmFoundationHob.c.
Build resource Hobs from unblocked memory regions
This function builds resource HOBs for all unblocked memory regions.
[in] | HobBuffer | The pointer of new HOB buffer. |
[in,out] | HobBufferSize | The total size of the same GUID HOBs when as output. |
Definition at line 420 of file MmFoundationHob.c.
UINT8 MmIplCalculateMaximumSupportAddress | ( | VOID | ) |
Calculate the maximum support address.
Definition at line 618 of file MmFoundationHob.c.
VOID MmIplCopyGuidHob | ( | IN UINT8 * | HobBuffer, |
IN OUT UINTN * | HobBufferSize, | ||
IN EFI_GUID * | Guid, | ||
IN BOOLEAN | MultiInstances | ||
) |
Copies a data buffer to a newly-built HOB for GUID HOB
This function builds a customized HOB tagged with a GUID for identification, copies the input data to the HOB data field and returns the start address of the GUID HOB data. If new HOB buffer is NULL or the GUID HOB could not found, then ASSERT().
[in] | HobBuffer | The pointer of HOB buffer. |
[in,out] | HobBufferSize | The available size of the HOB buffer when as input. The used size of when as output. |
[in] | Guid | The GUID of the GUID type HOB. |
[in] | MultiInstances | TRUE indicating copying multiple HOBs with the same Guid. |
Definition at line 224 of file MmFoundationHob.c.
Add a new HOB to the HOB List.
[in] | Hob | The pointer of new HOB buffer. |
[in] | HobType | Type of the new HOB. |
[in] | HobLength | Length of the new HOB to allocate. |
Definition at line 36 of file MmFoundationHob.c.
BOOLEAN MmIplIs5LevelPagingNeeded | ( | VOID | ) |
The routine returns TRUE when CPU supports it (CPUID[7,0].ECX.BIT[16] is set) and the max physical address bits is bigger than 48. Because 4-level paging can support to address physical address up to 2^48 - 1, there is no need to enable 5-level paging with max physical address bits <= 48.
TRUE | 5-level paging enabling is needed. |
FALSE | 5-level paging enabling is not needed. |
Definition at line 579 of file MmFoundationHob.c.