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
This commit is contained in:
rsun3
2010-02-25 09:23:44 +00:00
parent d555d90ff7
commit bade9bf5b2
3 changed files with 68 additions and 30 deletions

View File

@@ -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;