]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Change returned status codes for SmiManage() per PI 1.2.1 spec.
authorrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 31 May 2012 04:06:13 +0000 (04:06 +0000)
committerrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 31 May 2012 04:06:13 +0000 (04:06 +0000)
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

EdkCompatibilityPkg/Foundation/Library/Smm/SmmScriptLib/PiSmmDefinition.h
MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
MdeModulePkg/Core/PiSmmCore/Smi.c
MdePkg/Include/Pi/PiSmmCis.h

index 981b61bfeed3c1d1398743f029d829276b3f04e6..350b1374f76b108d2c13cdc60ded6b7d9393547f 100644 (file)
@@ -5,7 +5,7 @@
   runtime s3 boot Script. This header file is to definied PI SMM related definition to locate \r
   SmmSaveState Protocol  \r
 \r
-  Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions\r
@@ -192,10 +192,10 @@ EFI_STATUS
   @param[in,out] CommBuffer      Points to the optional communication buffer.\r
   @param[in,out] CommBufferSize  Points to the size of the optional communication buffer.\r
 \r
-  @retval EFI_SUCCESS                        Interrupt source was processed successfully but not quiesced.\r
+  @retval EFI_WARN_INTERRUPT_SOURCE_PENDING  Interrupt source was processed successfully but not quiesced.\r
   @retval EFI_INTERRUPT_PENDING              One or more SMI sources could not be quiesced.\r
-  @retval EFI_WARN_INTERRUPT_SOURCE_PENDING  Interrupt source was not handled or quiesced.\r
-  @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED Interrupt source was handled and quiesced.\r
+  @retval EFI_NOT_FOUND                      Interrupt source was not handled or quiesced.\r
+  @retval EFI_SUCCESS                        Interrupt source was handled and quiesced.\r
 **/\r
 typedef\r
 EFI_STATUS\r
index a5e4b6e9803f229fdd8dbc56ea1444216b2d3d98..9c7dd83223defd9a1103537103df2f6108b876ce 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   SMM Core Main Entry Point\r
 \r
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials are licensed and made available \r
   under the terms and conditions of the BSD License which accompanies this \r
   distribution.  The full text of the license may be found at        \r
@@ -297,7 +297,7 @@ SmmEntryPoint (
     //\r
     gSmmCorePrivate->BufferSize += OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data);\r
     gSmmCorePrivate->CommunicationBuffer = NULL;\r
-    gSmmCorePrivate->ReturnStatus = (Status == EFI_WARN_INTERRUPT_SOURCE_QUIESCED) ? EFI_SUCCESS : EFI_NOT_FOUND;\r
+    gSmmCorePrivate->ReturnStatus = (Status == EFI_SUCCESS) ? EFI_SUCCESS : EFI_NOT_FOUND;\r
   } else {\r
     //\r
     // Asynchronous SMI\r
index 84b9f73ecbe1ba588601093646d801ae75e77e36..bda9996dc82da0b1c0d5377409b55fe0403a7d68 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   SMM IPL that produces SMM related runtime protocols and load the SMM Core into SMRAM\r
 \r
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials are licensed and made available \r
   under the terms and conditions of the BSD License which accompanies this \r
   distribution.  The full text of the license may be found at        \r
@@ -504,7 +504,7 @@ SmmCommunicationCommunicate (
   //\r
   gSmmCorePrivate->InSmm = OldInSmm;\r
 \r
-  return (Status == EFI_WARN_INTERRUPT_SOURCE_QUIESCED) ? EFI_SUCCESS : EFI_NOT_FOUND;\r
+  return (Status == EFI_SUCCESS) ? EFI_SUCCESS : EFI_NOT_FOUND;\r
 }\r
 \r
 /**\r
index 62c1cf60732b9b629ad8f7b847b4de8aca74e17f..1868bbf9e195be969ba07a220ea3b3bdd34ad6b0 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   SMI management.\r
 \r
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials are licensed and made available \r
   under the terms and conditions of the BSD License which accompanies this \r
   distribution.  The full text of the license may be found at        \r
@@ -109,10 +109,10 @@ SmmCoreFindSmiEntry (
   @param  CommBuffer     Points to the optional communication buffer.\r
   @param  CommBufferSize Points to the size of the optional communication buffer.\r
 \r
-  @retval EFI_SUCCESS                        Interrupt source was processed successfully but not quiesced.\r
+  @retval EFI_WARN_INTERRUPT_SOURCE_PENDING  Interrupt source was processed successfully but not quiesced.\r
   @retval EFI_INTERRUPT_PENDING              One or more SMI sources could not be quiesced.\r
-  @retval EFI_WARN_INTERRUPT_SOURCE_PENDING  Interrupt source was not handled or quiesced.\r
-  @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED Interrupt source was handled and quiesced.\r
+  @retval EFI_NOT_FOUND                      Interrupt source was not handled or quiesced.\r
+  @retval EFI_SUCCESS                        Interrupt source was handled and quiesced.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -131,42 +131,29 @@ SmiManage (
   BOOLEAN      InterruptQuiesced;\r
   EFI_STATUS   Status;\r
   \r
+  Status = EFI_NOT_FOUND;\r
+  InterruptQuiesced = FALSE;\r
   if (HandlerType == NULL) {\r
     //\r
     // Root SMI handler\r
     //\r
-    Status = EFI_WARN_INTERRUPT_SOURCE_PENDING;\r
 \r
     Head = &mRootSmiHandlerList;\r
-    for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {\r
-      SmiHandler = CR (Link, SMI_HANDLER, Link, SMI_HANDLER_SIGNATURE);\r
-\r
-      Status = SmiHandler->Handler (\r
-                 (EFI_HANDLE) SmiHandler,\r
-                 Context,\r
-                 CommBuffer,\r
-                 CommBufferSize\r
-                 );\r
-      if (Status == EFI_SUCCESS || Status == EFI_INTERRUPT_PENDING) {\r
-        return Status;\r
-      }\r
-    }\r
-    return Status;\r
-  }\r
-\r
-  //\r
-  // Non-root SMI handler\r
-  //\r
-  SmiEntry = SmmCoreFindSmiEntry ((EFI_GUID *) HandlerType, FALSE);\r
-  if (SmiEntry == NULL) {\r
+  } else {\r
     //\r
-    // There is no handler registered for this interrupt source\r
+    // Non-root SMI handler\r
     //\r
-    return EFI_WARN_INTERRUPT_SOURCE_PENDING;\r
+    SmiEntry = SmmCoreFindSmiEntry ((EFI_GUID *) HandlerType, FALSE);\r
+    if (SmiEntry == NULL) {\r
+      //\r
+      // There is no handler registered for this interrupt source\r
+      //\r
+      return Status;\r
+    }\r
+\r
+    Head = &SmiEntry->SmiHandlers;\r
   }\r
 \r
-  InterruptQuiesced = FALSE;\r
-  Head = &SmiEntry->SmiHandlers;\r
   for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {\r
     SmiHandler = CR (Link, SMI_HANDLER, Link, SMI_HANDLER_SIGNATURE);\r
 \r
@@ -180,42 +167,46 @@ SmiManage (
     switch (Status) {\r
     case EFI_INTERRUPT_PENDING:\r
       //\r
-      // If a handler returns EFI_INTERRUPT_PENDING, the interrupt could not be\r
-      // quiesced, then no additional handlers will be processed,\r
-      // and EFI_INTERRUPT_PENDING will be returned\r
+      // If a handler returns EFI_INTERRUPT_PENDING then no additional handlers \r
+      // will be processed and EFI_INTERRUPT_PENDING will be returned.\r
       //\r
       return EFI_INTERRUPT_PENDING;\r
 \r
     case EFI_SUCCESS:\r
       //\r
-      // If handler return EFI_SUCCESS, the interrupt was handled and quiesced,\r
-      // no other handlers should still be called,\r
-      // and EFI_WARN_INTERRUPT_SOURCE_QUIESCED will be returned\r
+      // If a handler returns EFI_SUCCESS then no additional handlers will be processed.\r
+      // then the function will return EFI_SUCCESS.\r
       //\r
-      return EFI_WARN_INTERRUPT_SOURCE_QUIESCED;\r
+      return EFI_SUCCESS;\r
 \r
     case EFI_WARN_INTERRUPT_SOURCE_QUIESCED:\r
       //\r
-      // If at least one of the handlers report EFI_WARN_INTERRUPT_SOURCE_QUIESCED,\r
-      // then this function will return EFI_WARN_INTERRUPT_SOURCE_QUIESCED\r
+      // If at least one of the handlers returns EFI_WARN_INTERRUPT_SOURCE_QUIESCED\r
+      // then the function will return EFI_SUCCESS. \r
       //\r
       InterruptQuiesced = TRUE;\r
       break;\r
 \r
+    case EFI_WARN_INTERRUPT_SOURCE_PENDING:\r
+      //\r
+      // If all the handlers returned EFI_WARN_INTERRUPT_SOURCE_PENDING\r
+      // then EFI_WARN_INTERRUPT_SOURCE_PENDING will be returned.\r
+      //\r
+      break;\r
+\r
     default:\r
+      //\r
+      // Unexpected status code returned.\r
+      //\r
+      ASSERT (FALSE);\r
       break;\r
     }\r
   }\r
 \r
   if (InterruptQuiesced) {\r
-    Status = EFI_WARN_INTERRUPT_SOURCE_QUIESCED;\r
-  } else {\r
-    //\r
-    // If no handler report EFI_WARN_INTERRUPT_SOURCE_QUIESCED, then this\r
-    // function will return EFI_INTERRUPT_PENDING\r
-    //\r
-    Status = EFI_INTERRUPT_PENDING;\r
+    Status = EFI_SUCCESS;\r
   }\r
+\r
   return Status;\r
 }\r
 \r
index 21246d5ba65a2b02c283112c22c28b049fe4c23e..25dd51471bbad4f8b90ac45726536b904c5ef644 100644 (file)
@@ -2,7 +2,7 @@
   Common definitions in the Platform Initialization Specification version 1.2\r
   VOLUME 4 System Management Mode Core Interface version.\r
 \r
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -131,10 +131,10 @@ EFI_STATUS
   @param[in,out] CommBuffer      Points to the optional communication buffer.\r
   @param[in,out] CommBufferSize  Points to the size of the optional communication buffer.\r
 \r
-  @retval EFI_SUCCESS                        Interrupt source was processed successfully but not quiesced.\r
+  @retval EFI_WARN_INTERRUPT_SOURCE_PENDING  Interrupt source was processed successfully but not quiesced.\r
   @retval EFI_INTERRUPT_PENDING              One or more SMI sources could not be quiesced.\r
-  @retval EFI_WARN_INTERRUPT_SOURCE_PENDING  Interrupt source was not handled or quiesced.\r
-  @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED Interrupt source was handled and quiesced.\r
+  @retval EFI_NOT_FOUND                      Interrupt source was not handled or quiesced.\r
+  @retval EFI_SUCCESS                        Interrupt source was handled and quiesced.\r
 **/\r
 typedef\r
 EFI_STATUS\r