]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c
Code scrub for the Debug library, PostCode library, Print library, and ExtractGuidedS...
[mirror_edk2.git] / MdePkg / Library / PeiExtractGuidedSectionLib / PeiExtractGuidedSectionLib.c
index aa6c2fa33e10e9a8b121b9c751c8d052c18b1ed5..2b09c46cc9d9151986d194f461f82fd8cf8ceea3 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
-  Provide generic extract guided section functions.\r
+  Provide generic extract guided section functions for PEI phase.\r
 \r
-  Copyright (c) 2007, Intel Corporation<BR>\r
+  Copyright (c) 2007 - 2008, Intel Corporation<BR>\r
   All rights reserved. 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
@@ -97,6 +97,9 @@ PeiGetExtractGuidedSectionHandlerInfo (
     //\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
+  //\r
+  // Init HandlerInfo structure\r
+  //\r
   HandlerInfo->Signature = PEI_EXTRACT_HANDLER_INFO_SIGNATURE;\r
   HandlerInfo->NumberOfExtractHandler     = 0;\r
   HandlerInfo->ExtractHandlerGuidTable    = (GUID *) (HandlerInfo + 1);\r
@@ -109,7 +112,9 @@ PeiGetExtractGuidedSectionHandlerInfo (
                                               PcdGet32 (PcdMaximumGuidedExtractHandler) * \r
                                               sizeof (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER)\r
                                              );\r
-  \r
+  //\r
+  // return the created HandlerInfo.\r
+  //\r
   *InfoPointer = HandlerInfo;\r
   return EFI_SUCCESS;\r
 }\r
@@ -118,14 +123,14 @@ PeiGetExtractGuidedSectionHandlerInfo (
   Get the supported exract guided section Handler guid list.\r
   If ExtractHandlerGuidTable = NULL, then ASSERT.\r
 \r
-  @param[in, out]  ExtractHandlerGuidTable   The extract Handler guid pointer list.
+  @param[out]  ExtractHandlerGuidTable   The extract Handler guid pointer list.
 \r
-  @retval  return the number of the supported extract guided Handler.
+  @return the number of the supported extract guided Handler.
 **/\r
 UINTN\r
 EFIAPI\r
 ExtractGuidedSectionGetGuidList (\r
-  IN OUT  GUID  **ExtractHandlerGuidTable\r
+  OUT  GUID  **ExtractHandlerGuidTable\r
   )\r
 {\r
   EFI_STATUS Status;\r
@@ -133,11 +138,17 @@ ExtractGuidedSectionGetGuidList (
 \r
   ASSERT (ExtractHandlerGuidTable != NULL);\r
 \r
+  //\r
+  // Get all registered handler information\r
+  //\r
   Status = PeiGetExtractGuidedSectionHandlerInfo (&HandlerInfo);\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
 \r
+  //\r
+  // Get GuidTable and Table Number\r
+  //\r
   *ExtractHandlerGuidTable = HandlerInfo->ExtractHandlerGuidTable;\r
   return HandlerInfo->NumberOfExtractHandler;\r
 }\r
@@ -232,8 +243,8 @@ ExtractGuidedSectionRegisterHandlers (
   @param[out] SectionAttribute      The attribute of the input guided section.\r
 
   @retval  RETURN_SUCCESS           Get the required information successfully.\r
-  @retval  RETURN_INVALID_PARAMETER The input data can't be parsed correctly. \r
-                                    The GUID in InputSection does not match any registered guid list.\r
+  @retval  RETURN_UNSUPPORTED       Guided section data is not supported.\r
+  @retval  RETURN_INVALID_PARAMETER The input data is not the valid guided section.\r
 \r
 **/\r
 RETURN_STATUS\r
@@ -261,7 +272,7 @@ ExtractGuidedSectionGetInfo (
   ASSERT (SectionAttribute != NULL);\r
 \r
   //\r
-  // Get the registered handler information.\r
+  // Get all registered handler information.\r
   //\r
   Status = PeiGetExtractGuidedSectionHandlerInfo (&HandlerInfo);\r
   if (EFI_ERROR (Status)) {\r
@@ -281,7 +292,7 @@ ExtractGuidedSectionGetInfo (
   // Not found, the input guided section is not supported. \r
   //\r
   if (Index == HandlerInfo->NumberOfExtractHandler) {\r
-    return RETURN_INVALID_PARAMETER;\r
+    return RETURN_UNSUPPORTED;\r
   }\r
 \r
   //\r
@@ -316,8 +327,8 @@ ExtractGuidedSectionGetInfo (
                             authentication status of the output buffer. 
 
   @retval  RETURN_SUCCESS           Get the output data, size and AuthenticationStatus successfully.\r
-  @retval  RETURN_INVALID_PARAMETER The input data can't be parsed correctly. \r
-                                    The GUID in InputSection does not match any registered guid list.\r
+  @retval  RETURN_UNSUPPORTED       Guided section data is not supported to be decoded.\r
+  @retval  RETURN_INVALID_PARAMETER The input data is not the valid guided section.
 
 **/\r
 RETURN_STATUS\r
@@ -333,20 +344,25 @@ ExtractGuidedSectionDecode (
   EFI_STATUS Status;\r
   PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
   \r
+  //\r
+  // Check input parameter\r
+  //\r
   if (InputSection == NULL) {\r
     return RETURN_INVALID_PARAMETER;\r
-  }\r
-  \r
+  }  \r
   ASSERT (OutputBuffer != NULL);\r
   ASSERT (AuthenticationStatus != NULL);\r
-  \r
+\r
+  //\r
+  // Get all registered handler information.\r
+  //  \r
   Status = PeiGetExtractGuidedSectionHandlerInfo (&HandlerInfo);\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
 \r
   //\r
-  // Search the match registered GetInfo handler for the input guided section.\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
@@ -358,11 +374,11 @@ ExtractGuidedSectionDecode (
   // Not found, the input guided section is not supported. \r
   //\r
   if (Index == HandlerInfo->NumberOfExtractHandler) {\r
-    return RETURN_INVALID_PARAMETER;\r
+    return RETURN_UNSUPPORTED;\r
   }\r
 \r
   //\r
-  // Call the match handler to getinfo for the input section data.\r
+  // Call the match handler to extract raw data for the input guided section.\r
   //\r
   return HandlerInfo->ExtractDecodeHandlerTable [Index] (\r
             InputSection,\r