Update this module from DXE_DRIVER to DXE_RUNTIME_DRIVER and convert mSmmControl pointer upon GoVirtual().

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10227 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
hhuan13 2010-03-10 07:15:40 +00:00
parent a1bd217a5d
commit 1fafcca8b4
3 changed files with 47 additions and 3 deletions

View File

@ -84,6 +84,26 @@ SmmControl2Clear (
return mSmmControl->Clear (mSmmControl, Periodic);
}
/**
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[in] Event Event whose notification function is being invoked.
@param[in] Context Pointer to the notification function's context.
**/
VOID
EFIAPI
SetVirtualAddressNotify (
IN EFI_EVENT Event,
IN VOID *Context
)
{
EfiConvertPointer (0x0, (VOID **)&mSmmControl);
}
/**
Entry Point for this thunk driver.
@ -101,6 +121,7 @@ SmmControl2ThunkMain (
)
{
EFI_STATUS Status;
EFI_EVENT Event;
EFI_SMM_CONTROL_REGISTER RegisterInfo;
///
@ -115,6 +136,20 @@ SmmControl2ThunkMain (
ASSERT_EFI_ERROR (Status);
mDataPort = RegisterInfo.SmiDataRegister;
///
/// Create event on SetVirtualAddressMap() to convert mSmmControl from a physical address to a virtual address
///
Status = gBS->CreateEventEx (
EVT_NOTIFY_SIGNAL,
TPL_NOTIFY,
SetVirtualAddressNotify,
NULL,
&gEfiEventVirtualAddressChangeGuid,
&Event
);
ASSERT_EFI_ERROR (Status);
///
/// Publish framework SMM Control Protocol
///

View File

@ -17,12 +17,17 @@
#include <PiDxe.h>
#include <FrameworkSmm.h>
#include <Protocol/SmmControl2.h>
#include <Protocol/SmmControl.h>
#include <Guid/EventGroup.h>
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiRuntimeLib.h>
#include <Library/IoLib.h>
#include <Protocol/SmmControl2.h>
#include <Protocol/SmmControl.h>
/**
Invokes SMI activation from either the preboot or runtime environment.

View File

@ -17,7 +17,7 @@
INF_VERSION = 0x00010005
BASE_NAME = SmmControl2OnSmmControlThunk
FILE_GUID = B55A4515-5895-4ea8-845B-75B7480F6502
MODULE_TYPE = DXE_DRIVER
MODULE_TYPE = DXE_RUNTIME_DRIVER
VERSION_STRING = 1.0
ENTRY_POINT = SmmControl2ThunkMain
@ -39,6 +39,7 @@
[LibraryClasses]
UefiDriverEntryPoint
UefiBootServicesTableLib
UefiRuntimeLib
DebugLib
IoLib
@ -46,6 +47,9 @@
gEfiSmmControlProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiSmmControl2ProtocolGuid # PROTOCOL ALWAYS_PRODUCED
[Guids]
gEfiEventVirtualAddressChangeGuid # GUID ALWAYS_CONSUMED
[Depex]
gEfiSmmControlProtocolGuid