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 --- .../SmmBaseOnSmmBase2Thunk.c | 42 +++++++--------------- 1 file changed, 13 insertions(+), 29 deletions(-) (limited to 'EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk') diff --git a/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.c b/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.c index 942167067d..61e40cc228 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); } /** -- cgit v1.2.3