EFI_SMM_BASE2_PROTOCOL *mSmmBase2 = NULL;\r
EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication = NULL;\r
EFI_SMM_BASE_HELPER_READY_PROTOCOL *mSmmBaseHelperReady = NULL;\r
+BOOLEAN mAtRuntime = FALSE;\r
\r
/**\r
Determine if in SMM mode.\r
IN BOOLEAN LegacyIA32Binary\r
)\r
{\r
- if (LegacyIA32Binary) {\r
+ if (mAtRuntime || LegacyIA32Binary) {\r
return EFI_UNSUPPORTED;\r
}\r
\r
IN EFI_HANDLE ImageHandle\r
)\r
{\r
+ if (mAtRuntime) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
mCommunicationData.FunctionData.Function = SmmBaseFunctionUnregister;\r
mCommunicationData.FunctionData.Args.UnRegister.ImageHandle = ImageHandle;\r
\r
OUT VOID **Buffer\r
)\r
{\r
+ if (mAtRuntime) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
mCommunicationData.FunctionData.Function = SmmBaseFunctionAllocatePool;\r
mCommunicationData.FunctionData.Args.AllocatePool.PoolType = PoolType;\r
mCommunicationData.FunctionData.Args.AllocatePool.Size = Size;\r
IN VOID *Buffer\r
)\r
{\r
+ if (mAtRuntime) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
mCommunicationData.FunctionData.Function = SmmBaseFunctionFreePool;\r
mCommunicationData.FunctionData.Args.FreePool.Buffer = Buffer;\r
\r
SmmBaseGetSmstLocation\r
};\r
\r
+/**\r
+ Notification function on Exit Boot Services Event.\r
+\r
+ This function sets a flag indicating it is in Runtime phase.\r
+\r
+ @param Event Event whose notification function is being invoked\r
+ @param Context Pointer to the notification function's context\r
+**/\r
+VOID\r
+EFIAPI\r
+SmmBaseExitBootServicesEventNotify (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+{\r
+ mAtRuntime = TRUE;\r
+}\r
+\r
/**\r
Entry Point for SMM Base Protocol on SMM Base2 Protocol Thunk driver.\r
\r
Status = gBS->LocateProtocol (&gEfiSmmBaseHelperReadyProtocolGuid, NULL, (VOID **) &mSmmBaseHelperReady);\r
ASSERT_EFI_ERROR (Status);\r
\r
+ //\r
+ // Create event notification on Exit Boot Services event.\r
+ //\r
+ Status = gBS->CreateEventEx (\r
+ EVT_NOTIFY_SIGNAL,\r
+ TPL_NOTIFY,\r
+ SmmBaseExitBootServicesEventNotify,\r
+ NULL,\r
+ &gEfiEventExitBootServicesGuid,\r
+ &Event\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
//\r
// Create event on SetVirtualAddressMap() to convert mSmmCommunication from a physical address to a virtual address\r
//\r