TianoCore EDK2 master
|
#include <PiDxe.h>
#include <Protocol/SmmBase2.h>
#include <Protocol/SmmCommunication.h>
#include <Protocol/MmCommunication2.h>
#include <Protocol/SmmAccess2.h>
#include <Protocol/SmmConfiguration.h>
#include <Protocol/SmmControl2.h>
#include <Protocol/DxeSmmReadyToLock.h>
#include <Protocol/Cpu.h>
#include <Guid/EventGroup.h>
#include <Guid/EventLegacyBios.h>
#include <Guid/LoadModuleAtFixedAddress.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/PeCoffLib.h>
#include <Library/CacheMaintenanceLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/DxeServicesTableLib.h>
#include <Library/DxeServicesLib.h>
#include <Library/UefiLib.h>
#include <Library/UefiRuntimeLib.h>
#include <Library/PcdLib.h>
#include <Library/ReportStatusCodeLib.h>
#include "PiSmmCorePrivateData.h"
#include <Library/SafeIntLib.h>
Go to the source code of this file.
Data Structures | |
struct | SMM_IPL_EVENT_NOTIFICATION |
Macros | |
#define | SMRAM_CAPABILITIES (EFI_MEMORY_WB | EFI_MEMORY_UC) |
SMM IPL that produces SMM related runtime protocols and load the SMM Core into SMRAM
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file PiSmmIpl.c.
#define SMRAM_CAPABILITIES (EFI_MEMORY_WB | EFI_MEMORY_UC) |
Definition at line 40 of file PiSmmIpl.c.
EFI_STATUS ExecuteSmmCoreFromSmram | ( | IN OUT EFI_SMRAM_DESCRIPTOR * | SmramRange, |
IN OUT EFI_SMRAM_DESCRIPTOR * | SmramRangeSmmCore, | ||
IN VOID * | Context | ||
) |
Load the SMM Core image into SMRAM and executes the SMM Core from SMRAM.
[in,out] | SmramRange | Descriptor for the range of SMRAM to reload the currently executing image, the rang of SMRAM to hold SMM Core will be excluded. |
[in,out] | SmramRangeSmmCore | Descriptor for the range of SMRAM to hold SMM Core. |
[in] | Context | Context to pass into SMM Core |
Definition at line 1018 of file PiSmmIpl.c.
EFI_SMRAM_DESCRIPTOR * GetFullSmramRanges | ( | OUT UINTN * | FullSmramRangeCount | ) |
Get full SMRAM ranges.
It will get SMRAM ranges from SmmAccess protocol and SMRAM reserved ranges from SmmConfiguration protocol, split the entries if there is overlap between them. It will also reserve one entry for SMM core.
[out] | FullSmramRangeCount | Output pointer to full SMRAM range count. |
Definition at line 1417 of file PiSmmIpl.c.
EFI_STATUS GetPeCoffImageFixLoadingAssignedAddress | ( | IN OUT PE_COFF_LOADER_IMAGE_CONTEXT * | ImageContext | ) |
Get the fixed loading address from image header assigned by build tool. This function only be called when Loading module at Fixed address feature enabled.
ImageContext | Pointer to the image context structure that describes the PE/COFF image that needs to be examined by this function. |
EFI_SUCCESS | An fixed loading address is assigned to this image by build tools . |
EFI_NOT_FOUND | The image has no assigned fixed loading address. |
Definition at line 916 of file PiSmmIpl.c.
VOID GetSmramCacheRange | ( | IN EFI_SMRAM_DESCRIPTOR * | SmramRange, |
OUT EFI_PHYSICAL_ADDRESS * | SmramCacheBase, | ||
OUT UINT64 * | SmramCacheSize | ||
) |
Find the maximum SMRAM cache range that covers the range specified by SmramRange.
This function searches and joins all adjacent ranges of SmramRange into a range to be cached.
SmramRange | The SMRAM range to search from. |
SmramCacheBase | The returned cache range base. |
SmramCacheSize | The returned cache range size. |
Definition at line 391 of file PiSmmIpl.c.
EFI_STATUS EFIAPI SmmBase2GetSmstLocation | ( | IN CONST EFI_SMM_BASE2_PROTOCOL * | This, |
OUT EFI_SMM_SYSTEM_TABLE2 ** | Smst | ||
) |
Retrieves the location of the System Management System Table (SMST).
This | The EFI_SMM_BASE2_PROTOCOL instance. |
Smst | On return, points to a pointer to the System Management Service Table (SMST). |
EFI_INVALID_PARAMETER | Smst or This was invalid. |
EFI_SUCCESS | The memory was returned to the system. |
EFI_UNSUPPORTED | Not in SMM. |
Definition at line 462 of file PiSmmIpl.c.
EFI_STATUS EFIAPI SmmBase2InSmram | ( | IN CONST EFI_SMM_BASE2_PROTOCOL * | This, |
OUT BOOLEAN * | InSmram | ||
) |
Indicate whether the driver is currently executing in the SMM Initialization phase.
This | The EFI_SMM_BASE2_PROTOCOL instance. |
InSmram | Pointer to a Boolean which, on return, indicates that the driver is currently executing inside of SMRAM (TRUE) or outside of SMRAM (FALSE). |
EFI_INVALID_PARAMETER | InSmram was NULL. |
EFI_SUCCESS | The call returned successfully. |
Definition at line 435 of file PiSmmIpl.c.
EFI_STATUS EFIAPI SmmCommunicationCommunicate | ( | IN CONST EFI_SMM_COMMUNICATION_PROTOCOL * | This, |
IN OUT VOID * | CommBuffer, | ||
IN OUT UINTN *CommSize | OPTIONAL | ||
) |
Communicates with a registered handler.
This function provides a service to send and receive messages from a registered UEFI service. This function is part of the SMM Communication Protocol that may be called in physical mode prior to SetVirtualAddressMap() and in virtual mode after SetVirtualAddressMap().
[in] | This | The EFI_SMM_COMMUNICATION_PROTOCOL instance. |
[in,out] | CommBuffer | A pointer to the buffer to convey into SMRAM. |
[in,out] | CommSize | The size of the data buffer being passed in. On exit, the size of data being returned. Zero if the handler does not wish to reply with any data. This parameter is optional and may be NULL. |
EFI_SUCCESS | The message was successfully posted. |
EFI_INVALID_PARAMETER | The CommBuffer was NULL. |
EFI_BAD_BUFFER_SIZE | The buffer is too large for the MM implementation. If this error is returned, the MessageLength field in the CommBuffer header or the integer pointed by CommSize, are updated to reflect the maximum payload size the implementation can accommodate. |
EFI_ACCESS_DENIED | The CommunicateBuffer parameter or CommSize parameter, if not omitted, are in address range that cannot be accessed by the MM environment. |
Definition at line 508 of file PiSmmIpl.c.
EFI_STATUS EFIAPI SmmCommunicationMmCommunicate2 | ( | IN CONST EFI_MM_COMMUNICATION2_PROTOCOL * | This, |
IN OUT VOID * | CommBufferPhysical, | ||
IN OUT VOID * | CommBufferVirtual, | ||
IN OUT UINTN *CommSize | OPTIONAL | ||
) |
Communicates with a registered handler.
This function provides a service to send and receive messages from a registered UEFI service.
[in] | This | The EFI_MM_COMMUNICATION_PROTOCOL instance. |
[in] | CommBufferPhysical | Physical address of the MM communication buffer |
[in] | CommBufferVirtual | Virtual address of the MM communication buffer |
[in] | CommSize | The size of the data buffer being passed in. On exit, the size of data being returned. Zero if the handler does not wish to reply with any data. This parameter is optional and may be NULL. |
EFI_SUCCESS | The message was successfully posted. |
EFI_INVALID_PARAMETER | The CommBuffer was NULL. |
EFI_BAD_BUFFER_SIZE | The buffer is too large for the MM implementation. If this error is returned, the MessageLength field in the CommBuffer header or the integer pointed by CommSize, are updated to reflect the maximum payload size the implementation can accommodate. |
EFI_ACCESS_DENIED | The CommunicateBuffer parameter or CommSize parameter, if not omitted, are in address range that cannot be accessed by the MM environment. |
Definition at line 640 of file PiSmmIpl.c.
Event notification that is fired when DxeDispatch Event Group is signaled.
Event | The Event that is being processed, not used. |
Context | Event Context, not used. |
Definition at line 710 of file PiSmmIpl.c.
Event notification that is fired when EndOfDxe Event Group is signaled.
Event | The Event that is being processed, not used. |
Context | Event Context, not used. |
Definition at line 693 of file PiSmmIpl.c.
EFI_STATUS EFIAPI SmmIplEntry | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
The Entry Point for SMM IPL
Load SMM Core into SMRAM, register SMM Core entry point for SMIs, install SMM Base 2 Protocol and SMM Communication Protocol, and register for the critical events required to coordinate between DXE and SMM environments.
ImageHandle | The firmware allocated handle for the EFI image. |
SystemTable | A pointer to the EFI System Table. |
EFI_SUCCESS | The entry point is executed successfully. |
Other | Some error occurred when executing this entry point. |
Definition at line 1642 of file PiSmmIpl.c.
Event notification that is fired when a GUIDed Event Group is signaled.
Event | The Event that is being processed, not used. |
Context | Event Context, not used. |
Event notification that is fired when GUIDed Event Group is signaled.
Event | The Event that is being processed, not used. |
Context | Event Context, not used. |
Definition at line 663 of file PiSmmIpl.c.
Event notification that is fired every time a DxeSmmReadyToLock protocol is added or if gEfiEventReadyToBootGuid is signalled.
Event | The Event that is being processed, not used. |
Context | Event Context, not used. |
Event notification that is fired every time a DxeSmmReadyToLock protocol is added or if gEfiEventReadyToBootGuid is signaled.
Event | The Event that is being processed, not used. |
Context | Event Context, not used. |
Definition at line 812 of file PiSmmIpl.c.
Notification function of EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE.
This is a notification function registered on EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event. It convers pointer to new virtual address.
Event | Event whose notification function is being invoked. |
Context | Pointer to the notification function's context. |
Definition at line 898 of file PiSmmIpl.c.
Event notification that is fired every time a gEfiSmmConfigurationProtocol installs.
Event | The Event that is being processed, not used. |
Context | Event Context, not used. |
Definition at line 768 of file PiSmmIpl.c.
BOOLEAN SmmIsSmramOverlap | ( | IN EFI_SMRAM_DESCRIPTOR * | RangeToCompare, |
IN EFI_SMM_RESERVED_SMRAM_REGION * | ReservedRangeToCompare | ||
) |
Returns if SMRAM range and SMRAM reserved range are overlapped.
[in] | RangeToCompare | Pointer to EFI_SMRAM_DESCRIPTOR to compare. |
[in] | ReservedRangeToCompare | Pointer to EFI_SMM_RESERVED_SMRAM_REGION to compare. |
TRUE | There is overlap. |
TRUE | Math error. |
FALSE | There is no overlap. |
Definition at line 1362 of file PiSmmIpl.c.
VOID SmmSplitSmramEntry | ( | IN OUT EFI_SMRAM_DESCRIPTOR * | RangeToCompare, |
IN OUT EFI_SMM_RESERVED_SMRAM_REGION * | ReservedRangeToCompare, | ||
OUT EFI_SMRAM_DESCRIPTOR * | Ranges, | ||
IN OUT UINTN * | RangeCount, | ||
OUT EFI_SMM_RESERVED_SMRAM_REGION * | ReservedRanges, | ||
IN OUT UINTN * | ReservedRangeCount, | ||
OUT EFI_SMRAM_DESCRIPTOR * | FinalRanges, | ||
IN OUT UINTN * | FinalRangeCount | ||
) |
SMM split SMRAM entry.
[in,out] | RangeToCompare | Pointer to EFI_SMRAM_DESCRIPTOR to compare. |
[in,out] | ReservedRangeToCompare | Pointer to EFI_SMM_RESERVED_SMRAM_REGION to compare. |
[out] | Ranges | Output pointer to hold split EFI_SMRAM_DESCRIPTOR entry. |
[in,out] | RangeCount | Pointer to range count. |
[out] | ReservedRanges | Output pointer to hold split EFI_SMM_RESERVED_SMRAM_REGION entry. |
[in,out] | ReservedRangeCount | Pointer to reserved range count. |
[out] | FinalRanges | Output pointer to hold split final EFI_SMRAM_DESCRIPTOR entry that no need to be split anymore. |
[in,out] | FinalRangeCount | Pointer to final range count. |
Definition at line 1188 of file PiSmmIpl.c.
SMM_CORE_PRIVATE_DATA* gSmmCorePrivate = &mSmmCorePrivateData |
Definition at line 299 of file PiSmmIpl.c.
EFI_SMM_COMMUNICATE_HEADER mCommunicateHeader |
Definition at line 312 of file PiSmmIpl.c.
EFI_SMRAM_DESCRIPTOR* mCurrentSmramRange |
Definition at line 306 of file PiSmmIpl.c.
BOOLEAN mEndOfDxe = FALSE |
Definition at line 308 of file PiSmmIpl.c.
EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE* mLMFAConfigurationTable = NULL |
Definition at line 313 of file PiSmmIpl.c.
EFI_MM_COMMUNICATION2_PROTOCOL mMmCommunication2 |
Definition at line 274 of file PiSmmIpl.c.
EFI_SMM_ACCESS2_PROTOCOL* mSmmAccess |
Definition at line 305 of file PiSmmIpl.c.
EFI_SMM_BASE2_PROTOCOL mSmmBase2 |
Definition at line 259 of file PiSmmIpl.c.
EFI_SMM_COMMUNICATION_PROTOCOL mSmmCommunication |
Definition at line 267 of file PiSmmIpl.c.
EFI_SMM_CONTROL2_PROTOCOL* mSmmControl2 |
Definition at line 304 of file PiSmmIpl.c.
SMM_CORE_PRIVATE_DATA mSmmCorePrivateData |
Definition at line 282 of file PiSmmIpl.c.
SMM_IPL_EVENT_NOTIFICATION mSmmIplEvents[] |
Definition at line 318 of file PiSmmIpl.c.
EFI_HANDLE mSmmIplHandle = NULL |
Definition at line 254 of file PiSmmIpl.c.
BOOLEAN mSmmLocked = FALSE |
Definition at line 307 of file PiSmmIpl.c.
EFI_PHYSICAL_ADDRESS mSmramCacheBase |
Definition at line 309 of file PiSmmIpl.c.
UINT64 mSmramCacheSize |
Definition at line 310 of file PiSmmIpl.c.