From 46ece1ff4f097678ddd3609ccb104a22c0bae469 Mon Sep 17 00:00:00 2001 From: jyao1 Date: Tue, 18 Dec 2012 05:07:35 +0000 Subject: Add PI1.2.1 EndOfDxe support. Signed-off-by: jiewen.yao@intel.com Reviewed-by: michael.d.kinney@intel.com git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14009 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 41 +++++++++++++++++++++++++++++++ MdeModulePkg/Core/PiSmmCore/PiSmmCore.h | 23 +++++++++++++++++ MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf | 2 ++ MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c | 6 +++++ MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf | 1 + 5 files changed, 73 insertions(+) (limited to 'MdeModulePkg/Core') diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c index c1b3563d0..a7220e423 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c @@ -78,6 +78,7 @@ SMM_CORE_SMI_HANDLERS mSmmCoreSmiHandlers[] = { { SmmDriverDispatchHandler, &gEfiEventDxeDispatchGuid, NULL, TRUE }, { SmmReadyToLockHandler, &gEfiDxeSmmReadyToLockProtocolGuid, NULL, TRUE }, { SmmLegacyBootHandler, &gEfiEventLegacyBootGuid, NULL, FALSE }, + { SmmEndOfDxeHandler, &gEfiEndOfDxeEventGroupGuid, NULL, FALSE }, { NULL, NULL, NULL, FALSE } }; @@ -228,6 +229,46 @@ SmmReadyToLockHandler ( return Status; } +/** + Software SMI handler that is called when the EndOfDxe event is signalled. + This function installs the SMM EndOfDxe Protocol so SMM Drivers are informed that + platform code will invoke 3rd part code. + + @param DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister(). + @param Context Points to an optional handler context which was specified when the handler was registered. + @param CommBuffer A pointer to a collection of data in memory that will + be conveyed from a non-SMM environment into an SMM environment. + @param CommBufferSize The size of the CommBuffer. + + @return Status Code + +**/ +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 Status; + EFI_HANDLE SmmHandle; + + DEBUG ((EFI_D_INFO, "SmmEndOfDxeHandler\n")); + // + // Install SMM EndOfDxe protocol + // + SmmHandle = NULL; + Status = SmmInstallProtocolInterface ( + &SmmHandle, + &gEfiSmmEndOfDxeProtocolGuid, + EFI_NATIVE_INTERFACE, + NULL + ); + return EFI_SUCCESS; +} + /** The main entry point to SMM Foundation. diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h index 055363e1a..5392fb231 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -586,6 +587,28 @@ SmmReadyToLockHandler ( IN OUT UINTN *CommBufferSize OPTIONAL ); +/** + This function is the main entry point for an SMM handler dispatch + or communicate-based callback. + + @param DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister(). + @param Context Points to an optional handler context which was specified when the handler was registered. + @param CommBuffer A pointer to a collection of data in memory that will + be conveyed from a non-SMM environment into an SMM environment. + @param CommBufferSize The size of the CommBuffer. + + @return Status Code + +**/ +EFI_STATUS +EFIAPI +SmmEndOfDxeHandler ( + IN EFI_HANDLE DispatchHandle, + IN CONST VOID *Context, OPTIONAL + IN OUT VOID *CommBuffer, OPTIONAL + IN OUT UINTN *CommBufferSize OPTIONAL + ); + /** Place holder function until all the SMM System Table Service are available. diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf index 1c15c7ec0..e2ef13e3c 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf @@ -63,6 +63,7 @@ gEfiSmmReadyToLockProtocolGuid # PROTOCOL ALWAYS_PRODUCED gEfiSmmCpuIo2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiFirmwareVolume2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED + gEfiSmmEndOfDxeProtocolGuid # PROTOCOL ALWAYS_PRODUCED gEfiSecurityArchProtocolGuid # PROTOCOL SOMETIMES_CONSUMED gEfiSecurity2ArchProtocolGuid # PROTOCOL SOMETIMES_CONSUMED gEfiLoadedImageProtocolGuid # PROTOCOL SOMETIMES_PRODUCED @@ -76,3 +77,4 @@ gAprioriGuid # ALWAYS_CONSUMED gEfiEventDxeDispatchGuid # ALWAYS_CONSUMED gEfiEventLegacyBootGuid # ALWAYS_CONSUMED + gEfiEndOfDxeEventGroupGuid # ALWAYS_CONSUMED diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c index bda9996dc..468647042 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c @@ -263,6 +263,12 @@ SMM_IPL_EVENT_NOTIFICATION mSmmIplEvents[] = { // { TRUE, TRUE, &gEfiDxeSmmReadyToLockProtocolGuid, SmmIplReadyToLockEventNotify, &gEfiDxeSmmReadyToLockProtocolGuid, TPL_CALLBACK, NULL }, // + // Declare event notification on EndOfDxe event. When this notification is etablished, + // the associated event is immediately signalled, so the notification function will be executed and the + // SMM End Of Dxe Protocol will be found if it is already in the handle database. + // + { FALSE, TRUE, &gEfiEndOfDxeEventGroupGuid, SmmIplGuidedEventNotify, &gEfiEndOfDxeEventGroupGuid, TPL_CALLBACK, NULL }, + // // Declare event notification on the DXE Dispatch Event Group. This event is signaled by the DXE Core // each time the DXE Core dispatcher has completed its work. When this event is signalled, the SMM Core // if notified, so the SMM Core can dispatch SMM drivers. diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf index 125a02114..6af4f65b4 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf @@ -64,6 +64,7 @@ gEfiEventReadyToBootGuid # ALWAYS_CONSUMED gEfiEventLegacyBootGuid # ALWAYS_CONSUMED gEfiEventVirtualAddressChangeGuid # ALWAYS_CONSUMED + gEfiEndOfDxeEventGroupGuid # ALWAYS_CONSUMED gLoadFixedAddressConfigurationTableGuid # SIMETIMES_CONSUMED [Pcd] -- cgit v1.2.3