22 EFI_SMM_SYSTEM_TABLE2_REVISION,
23 sizeof (gSmmCoreSmst.
Hdr)
66BOOLEAN mInLegacyBoot =
FALSE;
72BOOLEAN mDuringS3Resume =
FALSE;
78BOOLEAN mAcpiS3Enable =
FALSE;
102UINTN mFullSmramRangeCount;
161 IN CONST VOID *Context OPTIONAL,
162 IN OUT VOID *CommBuffer OPTIONAL,
176 &gEdkiiSmmLegacyBootProtocolGuid,
181 mInLegacyBoot =
TRUE;
188 for (Index = 0; mSmmCoreSmiHandlers[Index].HandlerType !=
NULL; Index++) {
189 if (
CompareGuid (mSmmCoreSmiHandlers[Index].HandlerType, &gEfiEventExitBootServicesGuid)) {
216 IN CONST VOID *Context OPTIONAL,
217 IN OUT VOID *CommBuffer OPTIONAL,
231 &gEdkiiSmmExitBootServicesProtocolGuid,
241 for (Index = 0; mSmmCoreSmiHandlers[Index].HandlerType !=
NULL; Index++) {
242 if (
CompareGuid (mSmmCoreSmiHandlers[Index].HandlerType, &gEfiEventLegacyBootGuid)) {
273 IN CONST VOID *Context OPTIONAL,
274 IN OUT VOID *CommBuffer OPTIONAL,
278 mDuringS3Resume =
TRUE;
300 IN CONST VOID *Context OPTIONAL,
301 IN OUT VOID *CommBuffer OPTIONAL,
316 &gEdkiiSmmReadyToBootProtocolGuid,
348 IN CONST VOID *Context OPTIONAL,
349 IN OUT VOID *CommBuffer OPTIONAL,
363 for (Index = 0; mSmmCoreSmiHandlers[Index].HandlerType !=
NULL; Index++) {
364 if (mSmmCoreSmiHandlers[Index].UnRegister) {
375 &gEfiSmmReadyToLockProtocolGuid,
389 if (EFI_ERROR (Status)) {
390 DEBUG ((DEBUG_ERROR,
"\nSMM: SmmCpuIo Arch Protocol not present!!\n"));
438 IN CONST VOID *Context OPTIONAL,
439 IN OUT VOID *CommBuffer OPTIONAL,
449 DEBUG ((DEBUG_INFO,
"SmmEndOfDxeHandler\n"));
459 &gEfiSmmEndOfDxeProtocolGuid,
469 &gEfiSmmSxDispatch2ProtocolGuid,
473 if (!EFI_ERROR (Status) && (SxDispatch !=
NULL)) {
478 EntryRegisterContext.Type = SxS3;
479 EntryRegisterContext.Phase = SxEntry;
480 Status = SxDispatch->Register (
483 &EntryRegisterContext,
512 IN CONST VOID *Context OPTIONAL,
513 IN OUT VOID *CommBuffer OPTIONAL,
520 DEBUG ((DEBUG_INFO,
"SmmS3SmmInitDoneHandler\n"));
522 if (!mDuringS3Resume) {
523 DEBUG ((DEBUG_ERROR,
"It is not during S3 resume\n"));
533 &gEdkiiS3SmmInitDoneGuid,
545 &gEdkiiS3SmmInitDoneGuid,
571 IN CONST VOID *Context OPTIONAL,
572 IN OUT VOID *CommBuffer OPTIONAL,
579 DEBUG ((DEBUG_INFO,
"SmmEndOfS3ResumeHandler\n"));
581 if (!mDuringS3Resume) {
582 DEBUG ((DEBUG_ERROR,
"It is not during S3 resume\n"));
592 &gEdkiiEndOfS3ResumeGuid,
604 &gEdkiiEndOfS3ResumeGuid,
609 mDuringS3Resume =
FALSE;
636 BOOLEAN IsOverUnderflow1;
637 BOOLEAN IsOverUnderflow2;
643 if (IsOverUnderflow1 || IsOverUnderflow2) {
651 if ((End1 <= (
UINTN)Buff2) || ((
UINTN)Buff1 >= End2)) {
675 BOOLEAN InLegacyBoot;
677 BOOLEAN IsOverUnderflow;
678 VOID *CommunicationBuffer;
688 gSmmCoreSmst.
NumberOfCpus = SmmEntryContext->NumberOfCpus;
690 gSmmCoreSmst.
CpuSaveState = SmmEntryContext->CpuSaveState;
707 InLegacyBoot = mInLegacyBoot;
720 if (CommunicationBuffer !=
NULL) {
725 (UINT8 *)CommunicationBuffer,
727 (UINT8 *)gSmmCorePrivate,
728 sizeof (*gSmmCorePrivate)
752 CommunicateHeader->
Data,
817 mSmmCoreLoadedImage->
ImageBase = (VOID *)(
UINTN)gSmmCorePrivate->PiSmmCoreImageBase;
818 mSmmCoreLoadedImage->
ImageSize = gSmmCorePrivate->PiSmmCoreImageSize;
826 Status =
gBS->InstallMultipleProtocolInterfaces (
828 &gEfiLoadedImageProtocolGuid,
844 mSmmCoreDriverEntry->Signature = EFI_SMM_DRIVER_ENTRY_SIGNATURE;
849 mSmmCoreDriverEntry->SmmLoadedImage.
ImageBase = (VOID *)(
UINTN)gSmmCorePrivate->PiSmmCoreImageBase;
850 mSmmCoreDriverEntry->SmmLoadedImage.
ImageSize = gSmmCorePrivate->PiSmmCoreImageSize;
854 mSmmCoreDriverEntry->ImageEntryPoint = gSmmCorePrivate->PiSmmCoreEntryPoint;
855 mSmmCoreDriverEntry->ImageBuffer = gSmmCorePrivate->PiSmmCoreImageBase;
861 mSmmCoreDriverEntry->SmmImageHandle =
NULL;
863 &mSmmCoreDriverEntry->SmmImageHandle,
864 &gEfiLoadedImageProtocolGuid,
866 &mSmmCoreDriverEntry->SmmLoadedImage
906 gSmmCorePrivate->
Smst = &gSmmCoreSmst;
922 ASSERT (mFullSmramRanges !=
NULL);
928 for (Index = 0; mSmmCoreSmiHandlers[Index].HandlerType !=
NULL; Index++) {
930 mSmmCoreSmiHandlers[Index].Handler,
931 mSmmCoreSmiHandlers[Index].HandlerType,
932 &mSmmCoreSmiHandlers[Index].DispatchHandle
942 for (Index = 0; mSmmCoreS3SmiHandlers[Index].HandlerType !=
NULL; Index++) {
944 mSmmCoreS3SmiHandlers[Index].Handler,
945 mSmmCoreS3SmiHandlers[Index].HandlerType,
946 &mSmmCoreS3SmiHandlers[Index].DispatchHandle
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
BOOLEAN IsOverlapped(UINT8 *Buff1, UINTN Size1, UINT8 *Buff2, UINTN Size2)
#define EFI_LOADED_IMAGE_PROTOCOL_REVISION
VOID SmmDisplayDiscoveredNotDispatched(VOID)
EFI_STATUS EFIAPI SmmDriverDispatchHandler(IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
EFI_STATUS EFIAPI SmmUninstallProtocolInterface(IN EFI_HANDLE UserHandle, IN EFI_GUID *Protocol, IN VOID *Interface)
EFI_STATUS EFIAPI SmmHandleProtocol(IN EFI_HANDLE UserHandle, IN EFI_GUID *Protocol, OUT VOID **Interface)
EFI_STATUS EFIAPI SmmInstallProtocolInterface(IN OUT EFI_HANDLE *UserHandle, IN EFI_GUID *Protocol, IN EFI_INTERFACE_TYPE InterfaceType, IN VOID *Interface)
EFI_STATUS EFIAPI SmmInstallConfigurationTable(IN CONST EFI_SMM_SYSTEM_TABLE2 *SystemTable, IN CONST EFI_GUID *Guid, IN VOID *Table, IN UINTN TableSize)
EFI_STATUS EFIAPI SmmLocateProtocol(IN EFI_GUID *Protocol, IN VOID *Registration OPTIONAL, OUT VOID **Interface)
EFI_STATUS EFIAPI SmmLocateHandle(IN EFI_LOCATE_SEARCH_TYPE SearchType, IN EFI_GUID *Protocol OPTIONAL, IN VOID *SearchKey OPTIONAL, IN OUT UINTN *BufferSize, OUT EFI_HANDLE *Buffer)
VOID EFIAPI SmmCoreInitializeMemoryAttributesTable(VOID)
EFI_STATUS EFIAPI SmmRegisterProtocolNotify(IN CONST EFI_GUID *Protocol, IN EFI_SMM_NOTIFY_FN Function, OUT VOID **Registration)
EFI_STATUS EFIAPI SmmFreePages(IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN NumberOfPages)
EFI_STATUS EFIAPI SmmAllocatePages(IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN UINTN NumberOfPages, OUT EFI_PHYSICAL_ADDRESS *Memory)
#define OFFSET_OF(TYPE, Field)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG_CODE_BEGIN()
#define DEBUG(Expression)
#define PcdGetBool(TokenName)
#define EFI_NOT_AVAILABLE_YET
VOID SmmEntryPointMemoryManagementHook(VOID)
EFI_STATUS EFIAPI SmmS3SmmInitDoneHandler(IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
VOID EFIAPI SmmEntryPoint(IN CONST EFI_SMM_ENTRY_CONTEXT *SmmEntryContext)
EFI_STATUS EFIAPI SmmS3EntryCallBack(IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
EFI_STATUS EFIAPI SmmEndOfS3ResumeHandler(IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
EFI_STATUS EFIAPI SmmReadyToLockHandler(IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
BOOLEAN InternalIsBufferOverlapped(IN UINT8 *Buff1, IN UINTN Size1, IN UINT8 *Buff2, IN UINTN Size2)
EFI_STATUS EFIAPI SmmEfiNotAvailableYetArg5(UINTN Arg1, UINTN Arg2, UINTN Arg3, UINTN Arg4, UINTN Arg5)
VOID SmmCoreInstallLoadedImage(VOID)
EFI_STATUS EFIAPI SmmMain(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS EFIAPI SmmEndOfDxeHandler(IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
EFI_STATUS EFIAPI SmmExitBootServicesHandler(IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
EFI_STATUS EFIAPI SmmReadyToBootHandler(IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
EFI_STATUS EFIAPI SmmLegacyBootHandler(IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
VOID SmramProfileReadyToLock(VOID)
EFI_STATUS EFIAPI SmiManage(IN CONST EFI_GUID *HandlerType, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
VOID SmramProfileInstallProtocol(VOID)
VOID SmmCoreInitializeSmiHandlerProfile(VOID)
EFI_STATUS EFIAPI SmiHandlerUnRegister(IN EFI_HANDLE DispatchHandle)
EFI_STATUS EFIAPI SmmFreePool(IN VOID *Buffer)
EFI_STATUS EFIAPI SmmAllocatePool(IN EFI_MEMORY_TYPE PoolType, IN UINTN Size, OUT VOID **Buffer)
VOID RegisterSmramProfileHandler(VOID)
VOID SmramProfileInit(VOID)
EFI_STATUS EFIAPI SmiHandlerRegister(IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler, IN CONST EFI_GUID *HandlerType OPTIONAL, OUT EFI_HANDLE *DispatchHandle)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
RETURN_STATUS EFIAPI SafeUintnAdd(IN UINTN Augend, IN UINTN Addend, OUT UINTN *Result)
RETURN_STATUS EFIAPI SafeUintnSub(IN UINTN Minuend, IN UINTN Subtrahend, OUT UINTN *Result)
BOOLEAN EFIAPI SmmIsBufferOutsideSmmValid(IN EFI_PHYSICAL_ADDRESS Buffer, IN UINT64 Length)
#define EFI_SIZE_TO_PAGES(Size)
EFI_SMM_STARTUP_THIS_AP SmmStartupThisAp
UINTN CurrentlyExecutingCpu
EFI_MEMORY_TYPE ImageDataType
The memory type that the data sections were loaded as.
EFI_MEMORY_TYPE ImageCodeType
The memory type that the code sections were loaded as.
UINT64 ImageSize
The size in bytes of the loaded image.
EFI_SYSTEM_TABLE * SystemTable
the image's EFI system table pointer.
VOID * ImageBase
The base address at which the image was loaded.
EFI_SMM_SYSTEM_TABLE2 * Smst
EFI_HANDLE SmmIplImageHandle
VOID * CommunicationBuffer
EFI_SMM_ENTRY_POINT SmmEntryPoint
EFI_SMRAM_DESCRIPTOR * SmramRanges