]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Move SecExtractGuidedSectionLib instance from OvmfPkg to MdePkg
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 5 May 2010 02:06:23 +0000 (02:06 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 5 May 2010 02:06:23 +0000 (02:06 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10459 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c [new file with mode: 0644]
MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf [new file with mode: 0644]
MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c
MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf
MdePkg/MdePkg.dec
MdePkg/MdePkg.dsc

diff --git a/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c b/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c
new file mode 100644 (file)
index 0000000..e8f5481
--- /dev/null
@@ -0,0 +1,388 @@
+/** @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
+\r
+**/\r
+\r
+#include <PiPei.h>\r
+\r
+#include <Library/DebugLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/ExtractGuidedSectionLib.h>\r
+\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
+} 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
+  Or, HandlerInfo table will be initialized in this function.\r
+\r
+  @param[in, out]  InfoPointer   Pointer to the handler info structure.\r
+\r
+  @retval  RETURN_SUCCESS            HandlerInfo table can be used to store guid and function tables.\r
+  @retval  RETURN_OUT_OF_RESOURCES   HandlerInfo table address is not writable.\r
+**/\r
+RETURN_STATUS\r
+GetExtractGuidedSectionHandlerInfo (\r
+  IN OUT EXTRACT_GUIDED_SECTION_HANDLER_INFO **InfoPointer\r
+  )\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
+\r
+  //\r
+  // First check whether the handler info structure is initialized.\r
+  //\r
+  if (HandlerInfo->Signature == EXTRACT_HANDLER_INFO_SIGNATURE) {\r
+    //\r
+    // The handler info has been initialized and is returned.\r
+    //\r
+    *InfoPointer = HandlerInfo;\r
+    return RETURN_SUCCESS;\r
+  }\r
+\r
+  //\r
+  // Try to initialize the handler info structure\r
+  //\r
+  HandlerInfo->Signature = EXTRACT_HANDLER_INFO_SIGNATURE;\r
+  if (HandlerInfo->Signature != EXTRACT_HANDLER_INFO_SIGNATURE) {\r
+    //\r
+    // The handler info structure was not writeable because the memory is not ready.\r
+    //\r
+    *InfoPointer = NULL;\r
+    return RETURN_OUT_OF_RESOURCES;\r
+  }\r
+\r
+  //\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
+  *InfoPointer = HandlerInfo;\r
+  return RETURN_SUCCESS;\r
+}\r
+\r
+/**\r
+  Retrieve the list GUIDs that have been registered through ExtractGuidedSectionRegisterHandlers().\r
+\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
+  If ExtractHandlerGuidTable is NULL, then ASSERT().\r
+\r
+  @param[out]  ExtractHandlerGuidTable  A pointer to the array of GUIDs that have been registered through\r
+                                        ExtractGuidedSectionRegisterHandlers().\r
+\r
+  @return the number of the supported extract guided Handler.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+ExtractGuidedSectionGetGuidList (\r
+  OUT  GUID  **ExtractHandlerGuidTable\r
+  )\r
+{\r
+  RETURN_STATUS                       Status;\r
+  EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
+\r
+  ASSERT (ExtractHandlerGuidTable != NULL);\r
+\r
+  //\r
+  // Get all registered handler information\r
+  //\r
+  Status = GetExtractGuidedSectionHandlerInfo (&HandlerInfo);\r
+  if (RETURN_ERROR (Status)) {\r
+    *ExtractHandlerGuidTable = NULL;\r
+    return 0;\r
+  }\r
+\r
+  //\r
+  // Get GuidTable and Table Number\r
+  //\r
+  *ExtractHandlerGuidTable = HandlerInfo->ExtractHandlerGuidTable;\r
+  return HandlerInfo->NumberOfExtractHandler;\r
+}\r
+\r
+/**\r
+  Registers handlers of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER and EXTRACT_GUIDED_SECTION_DECODE_HANDLER\r
+  for a specific GUID section type.\r
+\r
+  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
+  If SectionGuid is NULL, then ASSERT().\r
+  If GetInfoHandler is NULL, then ASSERT().\r
+  If DecodeHandler is NULL, then ASSERT().\r
+\r
+  @param[in]  SectionGuid    A pointer to the GUID associated with the the handlers\r
+                             of the GUIDed section type being registered.\r
+  @param[in]  GetInfoHandler Pointer to a function that examines a GUIDed section and returns the\r
+                             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  Pointer to a function that decodes a GUIDed section into a caller\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
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+ExtractGuidedSectionRegisterHandlers (\r
+  IN CONST  GUID                                     *SectionGuid,\r
+  IN        EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER  GetInfoHandler,\r
+  IN        EXTRACT_GUIDED_SECTION_DECODE_HANDLER    DecodeHandler\r
+  )\r
+{\r
+  UINT32                              Index;\r
+  RETURN_STATUS                       Status;\r
+  EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
+\r
+  //\r
+  // Check input paramter\r
+  //\r
+  ASSERT (SectionGuid != NULL);\r
+  ASSERT (GetInfoHandler != NULL);\r
+  ASSERT (DecodeHandler != NULL);\r
+\r
+  //\r
+  // Get the registered handler information\r
+  //\r
+  Status = GetExtractGuidedSectionHandlerInfo (&HandlerInfo);\r
+  if (RETURN_ERROR (Status)) {\r
+    return Status;\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, 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
+      return RETURN_SUCCESS;\r
+    }\r
+  }\r
+\r
+  //\r
+  // Check the global table is enough to contain new Handler.\r
+  //\r
+  if (HandlerInfo->NumberOfExtractHandler >= PcdGet32 (PcdMaximumGuidedExtractHandler)) {\r
+    return RETURN_OUT_OF_RESOURCES;\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
+\r
+  return RETURN_SUCCESS;\r
+}\r
+\r
+/**\r
+  Retrieves a GUID from a GUIDed section and uses that GUID to select an associated handler of type\r
+  EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers().\r
+  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
+  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
+  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
+  If InputSection is NULL, then ASSERT().\r
+  If OutputBufferSize is NULL, then ASSERT().\r
+  If ScratchBufferSize is NULL, then ASSERT().\r
+  If SectionAttribute is NULL, then ASSERT().\r
+\r
+  @param[in]  InputSection       A pointer to a GUIDed section of an FFS formatted file.\r
+  @param[out] OutputBufferSize   A pointer to the size, in bytes, of an output buffer required if the buffer\r
+                                 specified by InputSection were decoded.\r
+  @param[out] ScratchBufferSize  A pointer to the size, in bytes, required as scratch space if the buffer specified by\r
+                                 InputSection were decoded.\r
+  @param[out] SectionAttribute   A pointer to the attributes of the GUIDed section.  See the Attributes field of\r
+                                 EFI_GUID_DEFINED_SECTION in the PI Specification.\r
+\r
+  @retval  RETURN_SUCCESS      Get the required information successfully.\r
+  @retval  RETURN_UNSUPPORTED  The GUID from the section specified by InputSection does not match any of\r
+                               the GUIDs registered with ExtractGuidedSectionRegisterHandlers().\r
+  @retval  Others              The return status from the handler associated with the GUID retrieved from\r
+                               the section specified by InputSection.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+ExtractGuidedSectionGetInfo (\r
+  IN  CONST VOID    *InputSection,\r
+  OUT       UINT32  *OutputBufferSize,\r
+  OUT       UINT32  *ScratchBufferSize,\r
+  OUT       UINT16  *SectionAttribute   \r
+  )\r
+{\r
+  UINT32                              Index;\r
+  RETURN_STATUS                       Status;\r
+  EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
+  \r
+  //\r
+  // Check input paramter\r
+  //\r
+  ASSERT (InputSection != NULL);\r
+  ASSERT (OutputBufferSize != NULL);\r
+  ASSERT (ScratchBufferSize != NULL);\r
+  ASSERT (SectionAttribute != NULL);\r
+\r
+  //\r
+  // Get all registered handler information.\r
+  //\r
+  Status = GetExtractGuidedSectionHandlerInfo (&HandlerInfo);\r
+  if (RETURN_ERROR (Status)) {\r
+    return Status;\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
+      //\r
+      // Call the match handler to get info for the input section data.\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
+  //\r
+  return RETURN_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+  Retrieves the GUID from a GUIDed section and uses that GUID to select an associated handler of type\r
+  EXTRACT_GUIDED_SECTION_DECODE_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers().\r
+  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
+  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
+  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 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
+  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
+\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
+                             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
+\r
+  @retval  RETURN_SUCCESS           The buffer specified by InputSection was decoded.\r
+  @retval  RETURN_UNSUPPORTED       The section specified by InputSection does not match the GUID this handler supports.\r
+  @retval  RETURN_INVALID_PARAMETER The section specified by InputSection can not be decoded.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+ExtractGuidedSectionDecode (\r
+  IN  CONST VOID    *InputSection,\r
+  OUT       VOID    **OutputBuffer,\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
+  //\r
+  // Check input parameter\r
+  //\r
+  ASSERT (InputSection != NULL);\r
+  ASSERT (OutputBuffer != NULL);\r
+  ASSERT (AuthenticationStatus != NULL);\r
+\r
+  //\r
+  // Get all registered handler information.\r
+  //  \r
+  Status = GetExtractGuidedSectionHandlerInfo (&HandlerInfo);\r
+  if (RETURN_ERROR (Status)) {\r
+    return Status;\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
+      //\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
+    }\r
+  }\r
+\r
+  //\r
+  // Not found, the input guided section is not supported. \r
+  //\r
+  return RETURN_UNSUPPORTED;\r
+}\r
diff --git a/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf b/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf
new file mode 100644 (file)
index 0000000..40fdbde
--- /dev/null
@@ -0,0 +1,45 @@
+## @file\r
+#  Base ExtractGuidedSection Library.\r
+#  This instance can also be used in SEC phase only when the memory is ready in SEC phase.\r
+#  PCD PcdGuidedExtractHandlerTableAddress points to the available memory address \r
+#  to store Guided Extract Handlers.\r
+#  \r
+#  Copyright (c) 2007 - 2010, 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 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
+#  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
+#\r
+##\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = BaseExtractGuidedSectionLib\r
+  FILE_GUID                      = 4e3236e9-d1c8-4c04-a89f-26f1c44b2592\r
+  MODULE_TYPE                    = BASE\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = ExtractGuidedSectionLib\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC (EBC is for build only)\r
+#\r
+\r
+[Sources]\r
+  BaseExtractGuidedSectionLib.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+\r
+[LibraryClasses]\r
+  BaseMemoryLib\r
+  DebugLib\r
+  PcdLib\r
+\r
+[Pcd]\r
+  gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler\r
+  gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress\r
index 6b2797778cb20813fcd25b45a0c0dd43af0d77a2..d5c20c5a96e12117aef5b5a5f8a2340c5c6c7a05 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Provide generic extract guided section functions for PEI phase.\r
 \r
-  Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.<BR>\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
@@ -67,7 +67,7 @@ PeiGetExtractGuidedSectionHandlerInfo (
           HandlerInfo->ExtractGetInfoHandlerTable = (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *) (\r
                                                       (UINT8 *)HandlerInfo->ExtractDecodeHandlerTable + \r
                                                       PcdGet32 (PcdMaximumGuidedExtractHandler) * \r
-                                                      sizeof (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER)\r
+                                                      sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER)\r
                                                      );\r
         }\r
         //\r
@@ -94,6 +94,7 @@ PeiGetExtractGuidedSectionHandlerInfo (
     //\r
     // No enough resource to build guid hob.\r
     //\r
+    *InfoPointer = NULL;\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
   //\r
@@ -109,7 +110,7 @@ PeiGetExtractGuidedSectionHandlerInfo (
   HandlerInfo->ExtractGetInfoHandlerTable = (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *) (\r
                                               (UINT8 *)HandlerInfo->ExtractDecodeHandlerTable + \r
                                               PcdGet32 (PcdMaximumGuidedExtractHandler) * \r
-                                              sizeof (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER)\r
+                                              sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER)\r
                                              );\r
   //\r
   // return the created HandlerInfo.\r
@@ -148,7 +149,8 @@ ExtractGuidedSectionGetGuidList (
   //\r
   Status = PeiGetExtractGuidedSectionHandlerInfo (&HandlerInfo);\r
   if (EFI_ERROR (Status)) {\r
-    return Status;\r
+    *ExtractHandlerGuidTable = NULL;\r
+    return 0;\r
   }\r
 \r
   //\r
@@ -238,7 +240,7 @@ ExtractGuidedSectionRegisterHandlers (
   CopyGuid (HandlerInfo->ExtractHandlerGuidTable + HandlerInfo->NumberOfExtractHandler, SectionGuid);\r
   HandlerInfo->ExtractDecodeHandlerTable [HandlerInfo->NumberOfExtractHandler] = DecodeHandler;\r
   HandlerInfo->ExtractGetInfoHandlerTable [HandlerInfo->NumberOfExtractHandler++] = GetInfoHandler;\r
-  \r
+\r
   return RETURN_SUCCESS;\r
 }\r
 \r
index ff1bf2f7c6e89804fa0595eb76a2cbca963b88b9..639c058948f67c694a89ef806bd78a5c041c95f3 100644 (file)
@@ -21,7 +21,7 @@
   FILE_GUID                      = 41ddf016-2a11-415f-8880-00d938e9541a\r
   MODULE_TYPE                    = PEIM\r
   VERSION_STRING                 = 1.0\r
-  LIBRARY_CLASS                  = ExtractGuidedSectionLib|PEIM PEI_CORE SEC\r
+  LIBRARY_CLASS                  = ExtractGuidedSectionLib|PEIM PEI_CORE\r
 \r
 #\r
 # The following information is for reference only and not required by the build tools.\r
index 2923868c37bb599fc6c2c5c6ba19e42ccc5e0b38..e863cbf4d63cf582f4269a492ad729c895a62630 100644 (file)
   # EFI_SOFTWARE_DXE_CORE | EFI_SW_PC_INIT_END\r
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueDxeDriverEnd|0x3040003|UINT32|0x30001014\r
 \r
+  ## This value is used to set the available memory address to store Guided Extract Handlers.\r
+  #  The required memory space is decided by the value of PcdMaximumGuidedExtractHandler.\r
+  gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x1000000|UINT64|0x30001015\r
+\r
 [PcdsFixedAtBuild.IPF]\r
   ## The base address of IO port space for IA64 arch\r
   gEfiMdePkgTokenSpaceGuid.PcdIoBlockBaseAddressForIpf|0x0ffffc000000|UINT64|0x0000000f\r
index ecbf1ebec13791c29c07ef0b9f43e2d8a771b8cf..e3eee5e82959b5f758c6ffbb14aec13afc59bf34 100644 (file)
   MdePkg/Library/UefiPciLibPciRootBridgeIo/UefiPciLibPciRootBridgeIo.inf\r
   MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/UefiPciSegmentLibPciRootBridgeIo.inf\r
   MdePkg/Library/SmmLibNull/SmmLibNull.inf\r
+  MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf\r
 \r
 [Components.IA32, Components.X64]\r
   MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf\r