Change returned status codes for SmiManage() per PI 1.2.1 spec.

Signed-off-by: Sun Rui <rui.sun@intel.com>
Reviewed-by: Fan Jeff <jeff.fan@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13394 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
rsun3 2012-05-31 04:06:13 +00:00
parent 139259bcc2
commit d5b339a9e7
5 changed files with 50 additions and 59 deletions

View File

@ -5,7 +5,7 @@
runtime s3 boot Script. This header file is to definied PI SMM related definition to locate
SmmSaveState Protocol
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions
@ -192,10 +192,10 @@ EFI_STATUS
@param[in,out] CommBuffer Points to the optional communication buffer.
@param[in,out] CommBufferSize Points to the size of the optional communication buffer.
@retval EFI_SUCCESS Interrupt source was processed successfully but not quiesced.
@retval EFI_WARN_INTERRUPT_SOURCE_PENDING Interrupt source was processed successfully but not quiesced.
@retval EFI_INTERRUPT_PENDING One or more SMI sources could not be quiesced.
@retval EFI_WARN_INTERRUPT_SOURCE_PENDING Interrupt source was not handled or quiesced.
@retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED Interrupt source was handled and quiesced.
@retval EFI_NOT_FOUND Interrupt source was not handled or quiesced.
@retval EFI_SUCCESS Interrupt source was handled and quiesced.
**/
typedef
EFI_STATUS

View File

@ -1,7 +1,7 @@
/** @file
SMM Core Main Entry Point
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
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
@ -297,7 +297,7 @@ SmmEntryPoint (
//
gSmmCorePrivate->BufferSize += OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data);
gSmmCorePrivate->CommunicationBuffer = NULL;
gSmmCorePrivate->ReturnStatus = (Status == EFI_WARN_INTERRUPT_SOURCE_QUIESCED) ? EFI_SUCCESS : EFI_NOT_FOUND;
gSmmCorePrivate->ReturnStatus = (Status == EFI_SUCCESS) ? EFI_SUCCESS : EFI_NOT_FOUND;
} else {
//
// Asynchronous SMI

View File

@ -1,7 +1,7 @@
/** @file
SMM IPL that produces SMM related runtime protocols and load the SMM Core into SMRAM
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
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
@ -504,7 +504,7 @@ SmmCommunicationCommunicate (
//
gSmmCorePrivate->InSmm = OldInSmm;
return (Status == EFI_WARN_INTERRUPT_SOURCE_QUIESCED) ? EFI_SUCCESS : EFI_NOT_FOUND;
return (Status == EFI_SUCCESS) ? EFI_SUCCESS : EFI_NOT_FOUND;
}
/**

View File

@ -1,7 +1,7 @@
/** @file
SMI management.
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
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
@ -109,10 +109,10 @@ SmmCoreFindSmiEntry (
@param CommBuffer Points to the optional communication buffer.
@param CommBufferSize Points to the size of the optional communication buffer.
@retval EFI_SUCCESS Interrupt source was processed successfully but not quiesced.
@retval EFI_WARN_INTERRUPT_SOURCE_PENDING Interrupt source was processed successfully but not quiesced.
@retval EFI_INTERRUPT_PENDING One or more SMI sources could not be quiesced.
@retval EFI_WARN_INTERRUPT_SOURCE_PENDING Interrupt source was not handled or quiesced.
@retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED Interrupt source was handled and quiesced.
@retval EFI_NOT_FOUND Interrupt source was not handled or quiesced.
@retval EFI_SUCCESS Interrupt source was handled and quiesced.
**/
EFI_STATUS
@ -131,42 +131,29 @@ SmiManage (
BOOLEAN InterruptQuiesced;
EFI_STATUS Status;
Status = EFI_NOT_FOUND;
InterruptQuiesced = FALSE;
if (HandlerType == NULL) {
//
// Root SMI handler
//
Status = EFI_WARN_INTERRUPT_SOURCE_PENDING;
Head = &mRootSmiHandlerList;
for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {
SmiHandler = CR (Link, SMI_HANDLER, Link, SMI_HANDLER_SIGNATURE);
Status = SmiHandler->Handler (
(EFI_HANDLE) SmiHandler,
Context,
CommBuffer,
CommBufferSize
);
if (Status == EFI_SUCCESS || Status == EFI_INTERRUPT_PENDING) {
return Status;
}
} else {
//
// Non-root SMI handler
//
SmiEntry = SmmCoreFindSmiEntry ((EFI_GUID *) HandlerType, FALSE);
if (SmiEntry == NULL) {
//
// There is no handler registered for this interrupt source
//
return Status;
}
return Status;
Head = &SmiEntry->SmiHandlers;
}
//
// Non-root SMI handler
//
SmiEntry = SmmCoreFindSmiEntry ((EFI_GUID *) HandlerType, FALSE);
if (SmiEntry == NULL) {
//
// There is no handler registered for this interrupt source
//
return EFI_WARN_INTERRUPT_SOURCE_PENDING;
}
InterruptQuiesced = FALSE;
Head = &SmiEntry->SmiHandlers;
for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {
SmiHandler = CR (Link, SMI_HANDLER, Link, SMI_HANDLER_SIGNATURE);
@ -180,42 +167,46 @@ SmiManage (
switch (Status) {
case EFI_INTERRUPT_PENDING:
//
// If a handler returns EFI_INTERRUPT_PENDING, the interrupt could not be
// quiesced, then no additional handlers will be processed,
// and EFI_INTERRUPT_PENDING will be returned
// If a handler returns EFI_INTERRUPT_PENDING then no additional handlers
// will be processed and EFI_INTERRUPT_PENDING will be returned.
//
return EFI_INTERRUPT_PENDING;
case EFI_SUCCESS:
//
// If handler return EFI_SUCCESS, the interrupt was handled and quiesced,
// no other handlers should still be called,
// and EFI_WARN_INTERRUPT_SOURCE_QUIESCED will be returned
// If a handler returns EFI_SUCCESS then no additional handlers will be processed.
// then the function will return EFI_SUCCESS.
//
return EFI_WARN_INTERRUPT_SOURCE_QUIESCED;
return EFI_SUCCESS;
case EFI_WARN_INTERRUPT_SOURCE_QUIESCED:
//
// If at least one of the handlers report EFI_WARN_INTERRUPT_SOURCE_QUIESCED,
// then this function will return EFI_WARN_INTERRUPT_SOURCE_QUIESCED
// If at least one of the handlers returns EFI_WARN_INTERRUPT_SOURCE_QUIESCED
// then the function will return EFI_SUCCESS.
//
InterruptQuiesced = TRUE;
break;
case EFI_WARN_INTERRUPT_SOURCE_PENDING:
//
// If all the handlers returned EFI_WARN_INTERRUPT_SOURCE_PENDING
// then EFI_WARN_INTERRUPT_SOURCE_PENDING will be returned.
//
break;
default:
//
// Unexpected status code returned.
//
ASSERT (FALSE);
break;
}
}
if (InterruptQuiesced) {
Status = EFI_WARN_INTERRUPT_SOURCE_QUIESCED;
} else {
//
// If no handler report EFI_WARN_INTERRUPT_SOURCE_QUIESCED, then this
// function will return EFI_INTERRUPT_PENDING
//
Status = EFI_INTERRUPT_PENDING;
Status = EFI_SUCCESS;
}
return Status;
}

View File

@ -2,7 +2,7 @@
Common definitions in the Platform Initialization Specification version 1.2
VOLUME 4 System Management Mode Core Interface version.
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
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
@ -131,10 +131,10 @@ EFI_STATUS
@param[in,out] CommBuffer Points to the optional communication buffer.
@param[in,out] CommBufferSize Points to the size of the optional communication buffer.
@retval EFI_SUCCESS Interrupt source was processed successfully but not quiesced.
@retval EFI_WARN_INTERRUPT_SOURCE_PENDING Interrupt source was processed successfully but not quiesced.
@retval EFI_INTERRUPT_PENDING One or more SMI sources could not be quiesced.
@retval EFI_WARN_INTERRUPT_SOURCE_PENDING Interrupt source was not handled or quiesced.
@retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED Interrupt source was handled and quiesced.
@retval EFI_NOT_FOUND Interrupt source was not handled or quiesced.
@retval EFI_SUCCESS Interrupt source was handled and quiesced.
**/
typedef
EFI_STATUS