]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.c
Per Framework SMM CIS spec, SMM Base Protocol.Communicate() is availabe in runtime...
[mirror_edk2.git] / EdkCompatibilityPkg / Compatibility / SmmBaseOnSmmBase2Thunk / SmmBaseOnSmmBase2Thunk.c
index e7f13d41d8eba8a08ff80d00ca038907a15b70f8..085ad0ca8ea7df3cc1fcff084fbf85aeb9bb6a70 100644 (file)
@@ -8,7 +8,7 @@
   SMM BASE Protocol can be published immediately after SMM Base2 Protocol is installed to\r
   make SMM Base Protocol.InSmm() as early as possible.\r
 \r
-  Copyright (c) 2009 Intel Corporation\r
+  Copyright (c) 2009 - 2010, Intel Corporation\r
   All rights reserved. This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -456,6 +456,27 @@ SmmBaseHelperReadyProtocolNotification (
   gBS->LocateProtocol (&gEfiSmmBaseHelperReadyProtocolGuid, NULL, (VOID **) &mSmmBaseHelperReady);\r
 }\r
 \r
+/**\r
+  Notification function of EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE\r
+\r
+  This is a notification function registered on EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event.\r
+  It convers pointer to new virtual address.\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
+SmmBaseAddressChangeEvent (\r
+  IN EFI_EVENT        Event,\r
+  IN VOID             *Context\r
+  )\r
+{\r
+  if (mSmmCommunication != NULL) {\r
+    EfiConvertPointer (0x0, (VOID **) &mSmmCommunication);\r
+  }\r
+}\r
+\r
 /**\r
   Entry Point for SMM Base Protocol on SMM Base2 Protocol Thunk driver.\r
 \r
@@ -471,7 +492,9 @@ SmmBaseThunkMain (
   IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
 {\r
-  VOID *Registration;\r
+  VOID       *Registration;\r
+  EFI_EVENT  VirtualAddressChangeEvent;\r
+  EFI_STATUS Status;\r
 \r
   mImageHandle = ImageHandle;\r
 \r
@@ -513,6 +536,16 @@ SmmBaseThunkMain (
     &Registration\r
     );\r
 \r
+  Status = gBS->CreateEventEx (\r
+                  EVT_NOTIFY_SIGNAL,\r
+                  TPL_NOTIFY,\r
+                  SmmBaseAddressChangeEvent,\r
+                  NULL,\r
+                  &gEfiEventVirtualAddressChangeGuid,\r
+                  &VirtualAddressChangeEvent\r
+                  );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r