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

@@ -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
///
return mSmmCommunication->Communicate (
mSmmCommunication,
CommunicationBuffer,
BufferSize
);
mCommunicationData.FunctionData.Function = SMMBASE_COMMUNICATE;
mCommunicationData.FunctionData.Args.Communicate.ImageHandle = ImageHandle;
mCommunicationData.FunctionData.Args.Communicate.CommunicationBuffer = CommunicationBuffer;
mCommunicationData.FunctionData.Args.Communicate.SourceSize = 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);
}
/**