+\r
+ SmiHandlerUnRegister (DispatchHandle);\r
+\r
+ return Status;\r
+}\r
+\r
+/**\r
+ Software SMI handler that is called when an Exit Boot Services event is signalled.\r
+ Then the SMM Core also install SMM Exit Boot Services protocol to notify SMM driver\r
+ that system enter exit boot services.\r
+\r
+ @param DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().\r
+ @param Context Points to an optional handler context which was specified when the handler was registered.\r
+ @param CommBuffer A pointer to a collection of data in memory that will\r
+ be conveyed from a non-SMM environment into an SMM environment.\r
+ @param CommBufferSize The size of the CommBuffer.\r
+\r
+ @return Status Code\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SmmExitBootServicesHandler (\r
+ IN EFI_HANDLE DispatchHandle,\r
+ IN CONST VOID *Context, OPTIONAL\r
+ IN OUT VOID *CommBuffer, OPTIONAL\r
+ IN OUT UINTN *CommBufferSize OPTIONAL\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_HANDLE SmmHandle;\r
+\r
+ //\r
+ // Install SMM Exit Boot Services protocol.\r
+ //\r
+ SmmHandle = NULL;\r
+ Status = SmmInstallProtocolInterface (\r
+ &SmmHandle,\r
+ &gEdkiiSmmExitBootServicesProtocolGuid,\r
+ EFI_NATIVE_INTERFACE,\r
+ NULL\r
+ );\r
+\r
+ SmiHandlerUnRegister (DispatchHandle);\r
+\r
+ return Status;\r
+}\r
+\r
+/**\r
+ Software SMI handler that is called when an Ready To Boot event is signalled.\r
+ Then the SMM Core also install SMM Ready To Boot protocol to notify SMM driver\r
+ that system enter ready to boot.\r
+\r
+ @param DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().\r
+ @param Context Points to an optional handler context which was specified when the handler was registered.\r
+ @param CommBuffer A pointer to a collection of data in memory that will\r
+ be conveyed from a non-SMM environment into an SMM environment.\r
+ @param CommBufferSize The size of the CommBuffer.\r
+\r
+ @return Status Code\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SmmReadyToBootHandler (\r
+ IN EFI_HANDLE DispatchHandle,\r
+ IN CONST VOID *Context, OPTIONAL\r
+ IN OUT VOID *CommBuffer, OPTIONAL\r
+ IN OUT UINTN *CommBufferSize OPTIONAL\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_HANDLE SmmHandle;\r
+\r
+ //\r
+ // Install SMM Ready To Boot protocol.\r
+ //\r
+ SmmHandle = NULL;\r
+ Status = SmmInstallProtocolInterface (\r
+ &SmmHandle,\r
+ &gEdkiiSmmReadyToBootProtocolGuid,\r
+ EFI_NATIVE_INTERFACE,\r
+ NULL\r
+ );\r
+\r
+ SmiHandlerUnRegister (DispatchHandle);\r
+\r
+ return Status;\r