]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Library / BaseExtractGuidedSectionLib / BaseExtractGuidedSectionLib.c
index 6a2cde5200c93437fef57101045866014e2634fd..e6f479b829f68b603ecec35f0da21b798a2330cf 100644 (file)
@@ -1,14 +1,8 @@
 /** @file\r
   Provide generic extract guided section functions.\r
 \r
-  Copyright (c) 2007 - 2010, 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
-  http://opensource.org/licenses/bsd-license.php.\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/ExtractGuidedSectionLib.h>\r
 \r
-#define EXTRACT_HANDLER_INFO_SIGNATURE SIGNATURE_32 ('E', 'G', 'S', 'I')\r
+#define EXTRACT_HANDLER_INFO_SIGNATURE  SIGNATURE_32 ('E', 'G', 'S', 'I')\r
 \r
 typedef struct {\r
-  UINT32                                  Signature;\r
-  UINT32                                  NumberOfExtractHandler;\r
-  GUID                                    *ExtractHandlerGuidTable;\r
-  EXTRACT_GUIDED_SECTION_DECODE_HANDLER   *ExtractDecodeHandlerTable;\r
-  EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *ExtractGetInfoHandlerTable;\r
+  UINT32                                     Signature;\r
+  UINT32                                     NumberOfExtractHandler;\r
+  GUID                                       *ExtractHandlerGuidTable;\r
+  EXTRACT_GUIDED_SECTION_DECODE_HANDLER      *ExtractDecodeHandlerTable;\r
+  EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER    *ExtractGetInfoHandlerTable;\r
 } EXTRACT_GUIDED_SECTION_HANDLER_INFO;\r
 \r
 /**\r
-  HandlerInfo table address is set by PcdGuidedExtractHandlerTableAddress, which is used to store \r
-  the registered guid and Handler list. When it is initialized, it will be directly returned. \r
+  HandlerInfo table address is set by PcdGuidedExtractHandlerTableAddress, which is used to store\r
+  the registered guid and Handler list. When it is initialized, it will be directly returned.\r
   Or, HandlerInfo table will be initialized in this function.\r
 \r
   @param[in, out]  InfoPointer   The pointer to the handler information structure.\r
@@ -41,15 +35,19 @@ typedef struct {
 **/\r
 RETURN_STATUS\r
 GetExtractGuidedSectionHandlerInfo (\r
-  IN OUT EXTRACT_GUIDED_SECTION_HANDLER_INFO **InfoPointer\r
+  IN OUT EXTRACT_GUIDED_SECTION_HANDLER_INFO  **InfoPointer\r
   )\r
 {\r
-  EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
-  \r
+  EXTRACT_GUIDED_SECTION_HANDLER_INFO  *HandlerInfo;\r
+\r
   //\r
   // Set the available memory address to handler info.\r
   //\r
-  HandlerInfo = (EXTRACT_GUIDED_SECTION_HANDLER_INFO*)(VOID*)(UINTN) PcdGet64 (PcdGuidedExtractHandlerTableAddress);\r
+  HandlerInfo = (EXTRACT_GUIDED_SECTION_HANDLER_INFO *)(VOID *)(UINTN)PcdGet64 (PcdGuidedExtractHandlerTableAddress);\r
+  if (HandlerInfo == NULL) {\r
+    *InfoPointer = NULL;\r
+    return EFI_OUT_OF_RESOURCES;\r
+  }\r
 \r
   //\r
   // First check whether the handler information structure is initialized.\r
@@ -77,17 +75,17 @@ GetExtractGuidedSectionHandlerInfo (
   //\r
   // Init HandlerInfo structure\r
   //\r
-  HandlerInfo->NumberOfExtractHandler     = 0;\r
-  HandlerInfo->ExtractHandlerGuidTable    = (GUID *) (HandlerInfo + 1);\r
-  HandlerInfo->ExtractDecodeHandlerTable  = (EXTRACT_GUIDED_SECTION_DECODE_HANDLER *) (\r
-                                              (UINT8 *)HandlerInfo->ExtractHandlerGuidTable + \r
-                                              PcdGet32 (PcdMaximumGuidedExtractHandler) * sizeof (GUID)\r
-                                             );\r
-  HandlerInfo->ExtractGetInfoHandlerTable = (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *) (\r
-                                              (UINT8 *)HandlerInfo->ExtractDecodeHandlerTable + \r
-                                              PcdGet32 (PcdMaximumGuidedExtractHandler) * \r
-                                              sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER)\r
-                                             );\r
+  HandlerInfo->NumberOfExtractHandler    = 0;\r
+  HandlerInfo->ExtractHandlerGuidTable   = (GUID *)(HandlerInfo + 1);\r
+  HandlerInfo->ExtractDecodeHandlerTable = (EXTRACT_GUIDED_SECTION_DECODE_HANDLER *)(\r
+                                                                                     (UINT8 *)HandlerInfo->ExtractHandlerGuidTable +\r
+                                                                                     PcdGet32 (PcdMaximumGuidedExtractHandler) * sizeof (GUID)\r
+                                                                                     );\r
+  HandlerInfo->ExtractGetInfoHandlerTable = (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *)(\r
+                                                                                        (UINT8 *)HandlerInfo->ExtractDecodeHandlerTable +\r
+                                                                                        PcdGet32 (PcdMaximumGuidedExtractHandler) *\r
+                                                                                        sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER)\r
+                                                                                        );\r
   *InfoPointer = HandlerInfo;\r
   return RETURN_SUCCESS;\r
 }\r
@@ -97,7 +95,7 @@ GetExtractGuidedSectionHandlerInfo (
 \r
   Sets ExtractHandlerGuidTable so it points at a callee allocated array of registered GUIDs.\r
   The total number of GUIDs in the array are returned. Since the array of GUIDs is callee allocated\r
-  and caller must treat this array of GUIDs as read-only data. \r
+  and caller must treat this array of GUIDs as read-only data.\r
   If ExtractHandlerGuidTable is NULL, then ASSERT().\r
 \r
   @param[out]  ExtractHandlerGuidTable  A pointer to the array of GUIDs that have been registered through\r
@@ -112,8 +110,8 @@ ExtractGuidedSectionGetGuidList (
   OUT  GUID  **ExtractHandlerGuidTable\r
   )\r
 {\r
-  RETURN_STATUS                       Status;\r
-  EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
+  RETURN_STATUS                        Status;\r
+  EXTRACT_GUIDED_SECTION_HANDLER_INFO  *HandlerInfo;\r
 \r
   ASSERT (ExtractHandlerGuidTable != NULL);\r
 \r
@@ -129,6 +127,7 @@ ExtractGuidedSectionGetGuidList (
   //\r
   // Get GuidTable and Table Number\r
   //\r
+  ASSERT (HandlerInfo != NULL);\r
   *ExtractHandlerGuidTable = HandlerInfo->ExtractHandlerGuidTable;\r
   return HandlerInfo->NumberOfExtractHandler;\r
 }\r
@@ -140,7 +139,7 @@ ExtractGuidedSectionGetGuidList (
   Registers the handlers specified by GetInfoHandler and DecodeHandler with the GUID specified by SectionGuid.\r
   If the GUID value specified by SectionGuid has already been registered, then return RETURN_ALREADY_STARTED.\r
   If there are not enough resources available to register the handlers  then RETURN_OUT_OF_RESOURCES is returned.\r
-  \r
+\r
   If SectionGuid is NULL, then ASSERT().\r
   If GetInfoHandler is NULL, then ASSERT().\r
   If DecodeHandler is NULL, then ASSERT().\r
@@ -151,7 +150,7 @@ ExtractGuidedSectionGetGuidList (
                              size of the decoded buffer and the size of an optional scratch buffer\r
                              required to actually decode the data in a GUIDed section.\r
   @param[in]  DecodeHandler  The pointer to a function that decodes a GUIDed section into a caller\r
-                             allocated output buffer. \r
+                             allocated output buffer.\r
 \r
   @retval  RETURN_SUCCESS           The handlers were registered.\r
   @retval  RETURN_OUT_OF_RESOURCES  There are not enough resources available to register the handlers.\r
@@ -165,12 +164,12 @@ ExtractGuidedSectionRegisterHandlers (
   IN        EXTRACT_GUIDED_SECTION_DECODE_HANDLER    DecodeHandler\r
   )\r
 {\r
-  UINT32                              Index;\r
-  RETURN_STATUS                       Status;\r
-  EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
+  UINT32                               Index;\r
+  RETURN_STATUS                        Status;\r
+  EXTRACT_GUIDED_SECTION_HANDLER_INFO  *HandlerInfo;\r
 \r
   //\r
-  // Check input paramter\r
+  // Check input parameter\r
   //\r
   ASSERT (SectionGuid != NULL);\r
   ASSERT (GetInfoHandler != NULL);\r
@@ -187,13 +186,14 @@ ExtractGuidedSectionRegisterHandlers (
   //\r
   // Search the match registered GetInfo handler for the input guided section.\r
   //\r
-  for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {\r
+  ASSERT (HandlerInfo != NULL);\r
+  for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index++) {\r
     if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionGuid)) {\r
       //\r
       // If the guided handler has been registered before, only update its handler.\r
       //\r
-      HandlerInfo->ExtractDecodeHandlerTable [Index] = DecodeHandler;\r
-      HandlerInfo->ExtractGetInfoHandlerTable [Index] = GetInfoHandler;\r
+      HandlerInfo->ExtractDecodeHandlerTable[Index]  = DecodeHandler;\r
+      HandlerInfo->ExtractGetInfoHandlerTable[Index] = GetInfoHandler;\r
       return RETURN_SUCCESS;\r
     }\r
   }\r
@@ -204,13 +204,13 @@ ExtractGuidedSectionRegisterHandlers (
   if (HandlerInfo->NumberOfExtractHandler >= PcdGet32 (PcdMaximumGuidedExtractHandler)) {\r
     return RETURN_OUT_OF_RESOURCES;\r
   }\r
-  \r
+\r
   //\r
   // Register new Handler and guid value.\r
   //\r
   CopyGuid (HandlerInfo->ExtractHandlerGuidTable + HandlerInfo->NumberOfExtractHandler, SectionGuid);\r
-  HandlerInfo->ExtractDecodeHandlerTable [HandlerInfo->NumberOfExtractHandler] = DecodeHandler;\r
-  HandlerInfo->ExtractGetInfoHandlerTable [HandlerInfo->NumberOfExtractHandler++] = GetInfoHandler;\r
+  HandlerInfo->ExtractDecodeHandlerTable[HandlerInfo->NumberOfExtractHandler]    = DecodeHandler;\r
+  HandlerInfo->ExtractGetInfoHandlerTable[HandlerInfo->NumberOfExtractHandler++] = GetInfoHandler;\r
 \r
   return RETURN_SUCCESS;\r
 }\r
@@ -221,14 +221,14 @@ ExtractGuidedSectionRegisterHandlers (
   The selected handler is used to retrieve and return the size of the decoded buffer and the size of an\r
   optional scratch buffer required to actually decode the data in a GUIDed section.\r
 \r
-  Examines a GUIDed section specified by InputSection.  \r
+  Examines a GUIDed section specified by InputSection.\r
   If GUID for InputSection does not match any of the GUIDs registered through ExtractGuidedSectionRegisterHandlers(),\r
-  then RETURN_UNSUPPORTED is returned.  \r
-  If the GUID of InputSection does match the GUID that this handler supports, then the the associated handler \r
+  then RETURN_UNSUPPORTED is returned.\r
+  If the GUID of InputSection does match the GUID that this handler supports, then the the associated handler\r
   of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers()\r
   is used to retrieve the OututBufferSize, ScratchSize, and Attributes values. The return status from the handler of\r
   type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER is returned.\r
-  \r
+\r
   If InputSection is NULL, then ASSERT().\r
   If OutputBufferSize is NULL, then ASSERT().\r
   If ScratchBufferSize is NULL, then ASSERT().\r
@@ -255,15 +255,16 @@ ExtractGuidedSectionGetInfo (
   IN  CONST VOID    *InputSection,\r
   OUT       UINT32  *OutputBufferSize,\r
   OUT       UINT32  *ScratchBufferSize,\r
-  OUT       UINT16  *SectionAttribute   \r
+  OUT       UINT16  *SectionAttribute\r
   )\r
 {\r
-  UINT32                              Index;\r
-  RETURN_STATUS                       Status;\r
-  EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
-  \r
+  UINT32                               Index;\r
+  RETURN_STATUS                        Status;\r
+  EXTRACT_GUIDED_SECTION_HANDLER_INFO  *HandlerInfo;\r
+  EFI_GUID                             *SectionDefinitionGuid;\r
+\r
   //\r
-  // Check input paramter\r
+  // Check input parameter\r
   //\r
   ASSERT (InputSection != NULL);\r
   ASSERT (OutputBufferSize != NULL);\r
@@ -278,25 +279,32 @@ ExtractGuidedSectionGetInfo (
     return Status;\r
   }\r
 \r
+  if (IS_SECTION2 (InputSection)) {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid);\r
+  } else {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *)InputSection)->SectionDefinitionGuid);\r
+  }\r
+\r
   //\r
   // Search the match registered GetInfo handler for the input guided section.\r
   //\r
-  for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {\r
-    if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
+  ASSERT (HandlerInfo != NULL);\r
+  for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index++) {\r
+    if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {\r
       //\r
       // Call the match handler to get information for the input section data.\r
       //\r
-      return HandlerInfo->ExtractGetInfoHandlerTable [Index] (\r
-                InputSection,\r
-                OutputBufferSize,\r
-                ScratchBufferSize,\r
-                SectionAttribute\r
-              );\r
+      return HandlerInfo->ExtractGetInfoHandlerTable[Index](\r
+                                                            InputSection,\r
+                                                            OutputBufferSize,\r
+                                                            ScratchBufferSize,\r
+                                                            SectionAttribute\r
+                                                            );\r
     }\r
   }\r
 \r
   //\r
-  // Not found, the input guided section is not supported. \r
+  // Not found, the input guided section is not supported.\r
   //\r
   return RETURN_UNSUPPORTED;\r
 }\r
@@ -307,26 +315,26 @@ ExtractGuidedSectionGetInfo (
   The selected handler is used to decode the data in a GUIDed section and return the result in a caller\r
   allocated output buffer.\r
 \r
-  Decodes the GUIDed section specified by InputSection.  \r
+  Decodes the GUIDed section specified by InputSection.\r
   If GUID for InputSection does not match any of the GUIDs registered through ExtractGuidedSectionRegisterHandlers(),\r
-  then RETURN_UNSUPPORTED is returned.  \r
+  then RETURN_UNSUPPORTED is returned.\r
   If the GUID of InputSection does match the GUID that this handler supports, then the the associated handler\r
   of type EXTRACT_GUIDED_SECTION_DECODE_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers()\r
   is used to decode InputSection into the buffer specified by OutputBuffer and the authentication status of this\r
   decode operation is returned in AuthenticationStatus.  If the decoded buffer is identical to the data in InputSection,\r
   then OutputBuffer is set to point at the data in InputSection.  Otherwise, the decoded data will be placed in a caller\r
   allocated buffer specified by OutputBuffer.    This function is responsible for computing the  EFI_AUTH_STATUS_PLATFORM_OVERRIDE\r
-  bit of in AuthenticationStatus.  The return status from the handler of type EXTRACT_GUIDED_SECTION_DECODE_HANDLER is returned. \r
-   \r
+  bit of in AuthenticationStatus.  The return status from the handler of type EXTRACT_GUIDED_SECTION_DECODE_HANDLER is returned.\r
+\r
   If InputSection is NULL, then ASSERT().\r
   If OutputBuffer is NULL, then ASSERT().\r
   If ScratchBuffer is NULL and this decode operation requires a scratch buffer, then ASSERT().\r
-  If AuthenticationStatus is NULL, then ASSERT().  \r
+  If AuthenticationStatus is NULL, then ASSERT().\r
 \r
   @param[in]  InputSection   A pointer to a GUIDed section of an FFS formatted file.\r
-  @param[out] OutputBuffer   A pointer to a buffer that contains the result of a decode operation. \r
-  @param[in]  ScratchBuffer  A caller allocated buffer that may be required by this function as a scratch buffer to perform the decode operation. \r
-  @param[out] AuthenticationStatus \r
+  @param[out] OutputBuffer   A pointer to a buffer that contains the result of a decode operation.\r
+  @param[in]  ScratchBuffer  A caller allocated buffer that may be required by this function as a scratch buffer to perform the decode operation.\r
+  @param[out] AuthenticationStatus\r
                              A pointer to the authentication status of the decoded output buffer. See the definition\r
                              of authentication status in the EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI section of the PI\r
                              Specification.\r
@@ -341,14 +349,15 @@ EFIAPI
 ExtractGuidedSectionDecode (\r
   IN  CONST VOID    *InputSection,\r
   OUT       VOID    **OutputBuffer,\r
-  IN        VOID    *ScratchBuffer,        OPTIONAL\r
-  OUT       UINT32  *AuthenticationStatus  \r
+  IN        VOID    *ScratchBuffer         OPTIONAL,\r
+  OUT       UINT32  *AuthenticationStatus\r
   )\r
 {\r
-  UINT32                              Index;\r
-  RETURN_STATUS                       Status;\r
-  EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
-  \r
+  UINT32                               Index;\r
+  RETURN_STATUS                        Status;\r
+  EXTRACT_GUIDED_SECTION_HANDLER_INFO  *HandlerInfo;\r
+  EFI_GUID                             *SectionDefinitionGuid;\r
+\r
   //\r
   // Check input parameter\r
   //\r
@@ -358,53 +367,60 @@ ExtractGuidedSectionDecode (
 \r
   //\r
   // Get all registered handler information.\r
-  //  \r
+  //\r
   Status = GetExtractGuidedSectionHandlerInfo (&HandlerInfo);\r
   if (RETURN_ERROR (Status)) {\r
     return Status;\r
   }\r
 \r
+  if (IS_SECTION2 (InputSection)) {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid);\r
+  } else {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *)InputSection)->SectionDefinitionGuid);\r
+  }\r
+\r
   //\r
   // Search the match registered Extract handler for the input guided section.\r
   //\r
-  for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {\r
-    if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
+  ASSERT (HandlerInfo != NULL);\r
+  for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index++) {\r
+    if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {\r
       //\r
       // Call the match handler to extract raw data for the input guided section.\r
       //\r
-      return HandlerInfo->ExtractDecodeHandlerTable [Index] (\r
-                InputSection,\r
-                OutputBuffer,\r
-                ScratchBuffer,\r
-                AuthenticationStatus\r
-              );\r
+      return HandlerInfo->ExtractDecodeHandlerTable[Index](\r
+                                                           InputSection,\r
+                                                           OutputBuffer,\r
+                                                           ScratchBuffer,\r
+                                                           AuthenticationStatus\r
+                                                           );\r
     }\r
   }\r
 \r
   //\r
-  // Not found, the input guided section is not supported. \r
+  // Not found, the input guided section is not supported.\r
   //\r
   return RETURN_UNSUPPORTED;\r
 }\r
 \r
 /**\r
-  Retrieves handlers of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER and \r
+  Retrieves handlers of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER and\r
   EXTRACT_GUIDED_SECTION_DECODE_HANDLER for a specific GUID section type.\r
-  \r
-  Retrieves the handlers associated with SectionGuid and returns them in \r
+\r
+  Retrieves the handlers associated with SectionGuid and returns them in\r
   GetInfoHandler and DecodeHandler.\r
 \r
-  If the GUID value specified by SectionGuid has not been registered, then \r
+  If the GUID value specified by SectionGuid has not been registered, then\r
   return RETURN_NOT_FOUND.\r
-  \r
+\r
   If SectionGuid is NULL, then ASSERT().\r
 \r
-  @param[in]  SectionGuid    A pointer to the GUID associated with the handlersof the GUIDed \r
+  @param[in]  SectionGuid    A pointer to the GUID associated with the handlersof the GUIDed\r
                              section type being retrieved.\r
-  @param[out] GetInfoHandler Pointer to a function that examines a GUIDed section and returns \r
-                             the size of the decoded buffer and the size of an optional scratch \r
-                             buffer required to actually decode the data in a GUIDed section.  \r
-                             This is an optional parameter that may be NULL. If it is NULL, then \r
+  @param[out] GetInfoHandler Pointer to a function that examines a GUIDed section and returns\r
+                             the size of the decoded buffer and the size of an optional scratch\r
+                             buffer required to actually decode the data in a GUIDed section.\r
+                             This is an optional parameter that may be NULL. If it is NULL, then\r
                              the previously registered handler is not returned.\r
   @param[out] DecodeHandler  Pointer to a function that decodes a GUIDed section into a caller\r
                              allocated output buffer. This is an optional parameter that may be NULL.\r
@@ -418,16 +434,16 @@ RETURN_STATUS
 EFIAPI\r
 ExtractGuidedSectionGetHandlers (\r
   IN CONST   GUID                                     *SectionGuid,\r
-  OUT        EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER  *GetInfoHandler,  OPTIONAL\r
+  OUT        EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER  *GetInfoHandler   OPTIONAL,\r
   OUT        EXTRACT_GUIDED_SECTION_DECODE_HANDLER    *DecodeHandler    OPTIONAL\r
   )\r
 {\r
-  UINT32                              Index;\r
-  RETURN_STATUS                       Status;\r
-  EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
+  UINT32                               Index;\r
+  RETURN_STATUS                        Status;\r
+  EXTRACT_GUIDED_SECTION_HANDLER_INFO  *HandlerInfo;\r
 \r
   //\r
-  // Check input paramter\r
+  // Check input parameter\r
   //\r
   ASSERT (SectionGuid != NULL);\r
 \r
@@ -443,20 +459,22 @@ ExtractGuidedSectionGetHandlers (
   // Search the match registered GetInfo handler for the input guided section.\r
   //\r
   ASSERT (HandlerInfo != NULL);\r
-  for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {\r
+  for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index++) {\r
     if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionGuid)) {\r
-\r
       //\r
       // If the guided handler has been registered before, then return the registered handlers.\r
       //\r
       if (GetInfoHandler != NULL) {\r
         *GetInfoHandler = HandlerInfo->ExtractGetInfoHandlerTable[Index];\r
       }\r
+\r
       if (DecodeHandler != NULL) {\r
         *DecodeHandler = HandlerInfo->ExtractDecodeHandlerTable[Index];\r
       }\r
+\r
       return RETURN_SUCCESS;\r
     }\r
   }\r
+\r
   return RETURN_NOT_FOUND;\r
 }\r