summaryrefslogtreecommitdiff
path: root/EdkCompatibilityPkg
diff options
context:
space:
mode:
authorrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>2010-02-25 09:23:44 +0000
committerrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>2010-02-25 09:23:44 +0000
commitbade9bf5b274d379aa8ae579b9b34819102e10d4 (patch)
tree51cd4cacdcd6b1624d1bc71d5db5a382fc483661 /EdkCompatibilityPkg
parentd555d90ff71366e69d91851eb176297391e93704 (diff)
downloadedk2-bade9bf5b274d379aa8ae579b9b34819102e10d4.zip
edk2-bade9bf5b274d379aa8ae579b9b34819102e10d4.tar.gz
edk2-bade9bf5b274d379aa8ae579b9b34819102e10d4.tar.bz2
Fix the bug that SMM Base Protocol.Communicate() does not work.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10067 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkCompatibilityPkg')
-rw-r--r--EdkCompatibilityPkg/Compatibility/Include/Guid/SmmBaseThunkCommunication.h10
-rw-r--r--EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c46
-rw-r--r--EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.c42
3 files changed, 68 insertions, 30 deletions
diff --git a/EdkCompatibilityPkg/Compatibility/Include/Guid/SmmBaseThunkCommunication.h b/EdkCompatibilityPkg/Compatibility/Include/Guid/SmmBaseThunkCommunication.h
index f8507e5..20c37ec 100644
--- a/EdkCompatibilityPkg/Compatibility/Include/Guid/SmmBaseThunkCommunication.h
+++ b/EdkCompatibilityPkg/Compatibility/Include/Guid/SmmBaseThunkCommunication.h
@@ -2,7 +2,7 @@
GUID and data structures for communication between SMM Base on SMM Base2 Thunk driver
and SmmBaseHelper 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
@@ -49,12 +49,19 @@ typedef struct {
VOID *Buffer;
} SMMBASE_FREE_POOL_ARG;
+typedef struct {
+ EFI_HANDLE ImageHandle;
+ VOID *CommunicationBuffer;
+ UINTN *SourceSize;
+} SMMBASE_COMMUNICATE_ARG;
+
typedef union {
SMMBASE_REGISTER_ARG Register;
SMMBASE_UNREGISTER_ARG UnRegister;
SMMBASE_REGISTER_CALLBACK_ARG RegisterCallback;
SMMBASE_ALLOCATE_POOL_ARG AllocatePool;
SMMBASE_FREE_POOL_ARG FreePool;
+ SMMBASE_COMMUNICATE_ARG Communicate;
} SMMBASE_FUNCTION_ARGS;
typedef enum {
@@ -63,6 +70,7 @@ typedef enum {
SMMBASE_REGISTER_CALLBACK,
SMMBASE_ALLOCATE_POOL,
SMMBASE_FREE_POOL,
+ SMMBASE_COMMUNICATE,
} SMMBASE_FUNCTION;
typedef struct {
diff --git a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c b/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c
index 8a6214a..2a4437b 100644
--- a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c
+++ b/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c
@@ -602,6 +602,49 @@ HelperFreePool (
FunctionData->Status = EFI_SUCCESS;
}
+/**
+ Thunk service of EFI_SMM_BASE_PROTOCOL.Communicate().
+
+ @param[in, out] FunctionData Pointer to SMMBASE_FUNCTION_DATA.
+**/
+VOID
+HelperCommunicate (
+ IN OUT SMMBASE_FUNCTION_DATA *FunctionData
+ )
+{
+ LIST_ENTRY *Node;
+ CALLBACK_INFO *CallbackInfo;
+
+ if (FunctionData->Args.Communicate.CommunicationBuffer == NULL) {
+ FunctionData->Status = EFI_INVALID_PARAMETER;
+ return;
+ }
+
+ Node = GetFirstNode (&mCallbackInfoListHead);
+ while (!IsNull (&mCallbackInfoListHead, Node)) {
+ CallbackInfo = (CALLBACK_INFO *)Node;
+
+ if (FunctionData->Args.Communicate.ImageHandle == CallbackInfo->SmmImageHandle) {
+ ///
+ /// Thunk into original Framwork SMI handler
+ ///
+ (CallbackInfo->CallbackAddress) (
+ CallbackInfo->SmmImageHandle,
+ FunctionData->Args.Communicate.CommunicationBuffer,
+ FunctionData->Args.Communicate.SourceSize
+ );
+ ///
+ /// The message was successfully posted.
+ ///
+ FunctionData->Status = EFI_SUCCESS;
+ return;
+ }
+ Node = GetNextNode (&mCallbackInfoListHead, Node);
+ }
+
+ FunctionData->Status = EFI_INVALID_PARAMETER;
+}
+
/**
Communication service SMI Handler entry.
@@ -654,6 +697,9 @@ SmmHandlerEntry (
case SMMBASE_FREE_POOL:
HelperFreePool (FunctionData);
break;
+ case SMMBASE_COMMUNICATE:
+ HelperCommunicate (FunctionData);
+ break;
default:
ASSERT (FALSE);
FunctionData->Status = EFI_UNSUPPORTED;
diff --git a/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.c b/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.c
index 9421670..61e40cc 100644
--- a/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.c
+++ b/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.c
@@ -160,15 +160,10 @@ SmmBaseHelperService (
mCommunicationData.FunctionData.Status = EFI_UNSUPPORTED;
- if (IsInSmm()) {
+ if ((mCommunicationData.FunctionData.Function != SMMBASE_COMMUNICATE) && IsInSmm()) {
///
/// If in SMM mode, directly call services in SMM Base Helper.
///
- if (mSmmBaseHelperReady == NULL) {
- ASSERT (FALSE);
- return;
- }
-
DataSize = (UINTN)(sizeof (SMMBASE_FUNCTION_DATA));
mSmmBaseHelperReady->ServiceEntry (
NULL,
@@ -178,13 +173,8 @@ SmmBaseHelperService (
);
} else {
///
- /// If in non-SMM mode, call services in SMM Base Helper via SMM Communication Protocol.
+ /// Call services in SMM Base Helper via SMM Communication Protocol.
///
- if (mSmmCommunication == NULL) {
- ASSERT (FALSE);
- return;
- }
-
DataSize = (UINTN)(sizeof (mCommunicationData));
mSmmCommunication->Communicate (
mSmmCommunication,
@@ -291,16 +281,17 @@ SmmBaseCommunicate (
IN OUT UINTN *BufferSize
)
{
- if (mSmmCommunication == NULL) {
- ASSERT (FALSE);
- return EFI_UNSUPPORTED;
- }
+ ///
+ /// Note this is a runtime interface
+ ///
+
+ mCommunicationData.FunctionData.Function = SMMBASE_COMMUNICATE;
+ mCommunicationData.FunctionData.Args.Communicate.ImageHandle = ImageHandle;
+ mCommunicationData.FunctionData.Args.Communicate.CommunicationBuffer = CommunicationBuffer;
+ mCommunicationData.FunctionData.Args.Communicate.SourceSize = BufferSize;
- return mSmmCommunication->Communicate (
- mSmmCommunication,
- CommunicationBuffer,
- BufferSize
- );
+ SmmBaseHelperService ();
+ return mCommunicationData.FunctionData.Status;
}
/**
@@ -451,11 +442,6 @@ SmmBaseGetSmstLocation (
OUT EFI_SMM_SYSTEM_TABLE **Smst
)
{
- if (mSmmBaseHelperReady == NULL) {
- ASSERT (FALSE);
- return EFI_UNSUPPORTED;
- }
-
if (!IsInSmm ()) {
return EFI_UNSUPPORTED;
}
@@ -484,9 +470,7 @@ SmmBaseAddressChangeEvent (
IN VOID *Context
)
{
- if (mSmmCommunication != NULL) {
- EfiConvertPointer (0x0, (VOID **) &mSmmCommunication);
- }
+ EfiConvertPointer (0x0, (VOID **) &mSmmCommunication);
}
/**