From bade9bf5b274d379aa8ae579b9b34819102e10d4 Mon Sep 17 00:00:00 2001 From: rsun3 Date: Thu, 25 Feb 2010 09:23:44 +0000 Subject: 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 --- .../Compatibility/SmmBaseHelper/SmmBaseHelper.c | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'EdkCompatibilityPkg/Compatibility/SmmBaseHelper') diff --git a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c b/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c index 8a6214afd3..2a4437b134 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; -- cgit v1.2.3