From fb03ca1a3e6e9b68c282926715e98cf6dd6c24b5 Mon Sep 17 00:00:00 2001 From: rsun3 Date: Wed, 10 Feb 2010 08:30:51 +0000 Subject: [PATCH] Per Framework SMM CIS spec, SMM Base Protocol.Communicate() is availabe in runtime. In SmmBaseOnSmmBase2Thunk driver, implementation of Communicate() uses SMM Communication Protocol. The thunk driver caches a pointer to SMM Communication Protocol. This pointer needs to be converted on Virtual Address Change Event. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9966 6f19259b-4bc3-4df7-8a09-765794883524 --- .../SmmBaseOnSmmBase2Thunk.c | 37 ++++++++++++++++++- .../SmmBaseOnSmmBase2Thunk.h | 4 +- .../SmmBaseOnSmmBase2Thunk.inf | 6 ++- EdkCompatibilityPkg/EdkCompatibilityPkg.dsc | 2 + 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.c b/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.c index e7f13d41d8..085ad0ca8e 100644 --- a/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.c +++ b/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.c @@ -8,7 +8,7 @@ SMM BASE Protocol can be published immediately after SMM Base2 Protocol is installed to make SMM Base Protocol.InSmm() as early as possible. - Copyright (c) 2009 Intel Corporation + Copyright (c) 2009 - 2010, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -456,6 +456,27 @@ SmmBaseHelperReadyProtocolNotification ( gBS->LocateProtocol (&gEfiSmmBaseHelperReadyProtocolGuid, NULL, (VOID **) &mSmmBaseHelperReady); } +/** + Notification function of EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE + + This is a notification function registered on EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event. + It convers pointer to new virtual address. + + @param Event Event whose notification function is being invoked + @param Context Pointer to the notification function's context +**/ +VOID +EFIAPI +SmmBaseAddressChangeEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + if (mSmmCommunication != NULL) { + EfiConvertPointer (0x0, (VOID **) &mSmmCommunication); + } +} + /** Entry Point for SMM Base Protocol on SMM Base2 Protocol Thunk driver. @@ -471,7 +492,9 @@ SmmBaseThunkMain ( IN EFI_SYSTEM_TABLE *SystemTable ) { - VOID *Registration; + VOID *Registration; + EFI_EVENT VirtualAddressChangeEvent; + EFI_STATUS Status; mImageHandle = ImageHandle; @@ -513,6 +536,16 @@ SmmBaseThunkMain ( &Registration ); + Status = gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + SmmBaseAddressChangeEvent, + NULL, + &gEfiEventVirtualAddressChangeGuid, + &VirtualAddressChangeEvent + ); + ASSERT_EFI_ERROR (Status); + return EFI_SUCCESS; } diff --git a/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.h b/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.h index 6fc3f192c5..ffe65086f3 100644 --- a/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.h +++ b/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.h @@ -1,7 +1,7 @@ /** @file Include file for SMM Base Protocol on SMM Base2 Protocol Thunk driver. - Copyright (c) 2009, Intel Corporation + Copyright (c) 2009 - 2010, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -21,7 +21,9 @@ #include #include #include +#include #include +#include #include #include #include diff --git a/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.inf b/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.inf index cea74e8186..87bf344093 100644 --- a/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.inf +++ b/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.inf @@ -1,7 +1,7 @@ ## @file # Component description file for SMM Base Protocol on SMM Base2 Protocol Thunk driver. # -# Copyright (c) 2009, Intel Corporation +# Copyright (c) 2009 - 2010, Intel Corporation # # All rights reserved. This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -41,6 +41,10 @@ UefiBootServicesTableLib DebugLib UefiLib + UefiRuntimeLib + +[Guids] + gEfiEventVirtualAddressChangeGuid # GUID ALWAYS_CONSUMED [Protocols] gEfiSmmBase2ProtocolGuid # PROTOCOL SOMETIMES_CONSUMED diff --git a/EdkCompatibilityPkg/EdkCompatibilityPkg.dsc b/EdkCompatibilityPkg/EdkCompatibilityPkg.dsc index 40e38fc0f0..de025807e7 100644 --- a/EdkCompatibilityPkg/EdkCompatibilityPkg.dsc +++ b/EdkCompatibilityPkg/EdkCompatibilityPkg.dsc @@ -57,6 +57,8 @@ define GCC_MACRO = -DEFI_SPECIFICATION_VERSION=0x00020000 -DPI_S IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf PalLib|MdePkg/Library/BasePalLibNull/BasePalLibNull.inf UefiLib|MdePkg/Library/UefiLib/UefiLib.inf + UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf + UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf -- 2.39.2