]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add API to ExtractGuidedSectionLib.h to retrieve the set of registered handlers.
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 4 Nov 2010 05:51:32 +0000 (05:51 +0000)
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 4 Nov 2010 05:51:32 +0000 (05:51 +0000)
API Function name is ExtractGuidedSectionGetHandlers.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11002 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Include/Library/ExtractGuidedSectionLib.h
MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c
MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c
MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c

index 4f2a8edec446add0a0cd9302a849e02132fcadac..539b98d41a2c9b4c2d3d38f17669ca4513c13571 100644 (file)
@@ -10,7 +10,7 @@
   EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI or a EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL \r
   providing a simple method to extend the number of GUIDed sections types a platform supports.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 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
@@ -246,4 +246,39 @@ ExtractGuidedSectionDecode (
   OUT       UINT32  *AuthenticationStatus  \r
   );\r
 \r
+/**\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
+  GetInfoHandler and DecodeHandler.\r
+\r
+  If the GUID value specified by SectionGuid has not been registered, then \r
+  return RETURN_NOT_FOUND.\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
+                             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
+                             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
+                             If it is NULL, then the previously registered handler is not returned.\r
+\r
+  @retval  RETURN_SUCCESS     The handlers were retrieved.\r
+  @retval  RETURN_NOT_FOUND   No handlers have been registered with the specified GUID.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+ExtractGuidedSectionGetHandlers (\r
+  IN CONST   GUID                                     *SectionGuid,\r
+  OUT        EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER  *GetInfoHandler,  OPTIONAL\r
+  OUT        EXTRACT_GUIDED_SECTION_DECODE_HANDLER    *DecodeHandler    OPTIONAL\r
+  );\r
+\r
 #endif\r
index c3978c9b501dff39308c660ce10adda6d2cd9e51..6a2cde5200c93437fef57101045866014e2634fd 100644 (file)
@@ -386,3 +386,77 @@ ExtractGuidedSectionDecode (
   //\r
   return RETURN_UNSUPPORTED;\r
 }\r
+\r
+/**\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
+  GetInfoHandler and DecodeHandler.\r
+\r
+  If the GUID value specified by SectionGuid has not been registered, then \r
+  return RETURN_NOT_FOUND.\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
+                             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
+                             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
+                             If it is NULL, then the previously registered handler is not returned.\r
+\r
+  @retval  RETURN_SUCCESS     The handlers were retrieved.\r
+  @retval  RETURN_NOT_FOUND   No handlers have been registered with the specified GUID.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+ExtractGuidedSectionGetHandlers (\r
+  IN CONST   GUID                                     *SectionGuid,\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
+\r
+  //\r
+  // Check input paramter\r
+  //\r
+  ASSERT (SectionGuid != 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
+  ASSERT (HandlerInfo != NULL);\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
+      if (DecodeHandler != NULL) {\r
+        *DecodeHandler = HandlerInfo->ExtractDecodeHandlerTable[Index];\r
+      }\r
+      return RETURN_SUCCESS;\r
+    }\r
+  }\r
+  return RETURN_NOT_FOUND;\r
+}\r
index 1587e872fa2062dfb339bff7f10a1a0278ddee4b..b8bb83c20e700297f760965342680f8f045e9678 100644 (file)
@@ -363,3 +363,66 @@ ExtractGuidedSectionDecode (
   //\r
   return RETURN_UNSUPPORTED;\r
 }\r
+\r
+/**\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
+  GetInfoHandler and DecodeHandler.\r
+\r
+  If the GUID value specified by SectionGuid has not been registered, then \r
+  return RETURN_NOT_FOUND.\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
+                             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
+                             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
+                             If it is NULL, then the previously registered handler is not returned.\r
+\r
+  @retval  RETURN_SUCCESS     The handlers were retrieved.\r
+  @retval  RETURN_NOT_FOUND   No handlers have been registered with the specified GUID.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+ExtractGuidedSectionGetHandlers (\r
+  IN CONST   GUID                                     *SectionGuid,\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
+\r
+  //\r
+  // Check input parameter.\r
+  //\r
+  ASSERT (SectionGuid != NULL);\r
+\r
+  //\r
+  // Search the match registered GetInfo handler for the input guided section.\r
+  //\r
+  for (Index = 0; Index < mNumberOfExtractHandler; Index ++) {\r
+    if (CompareGuid (&mExtractHandlerGuidTable[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 = mExtractGetInfoHandlerTable[Index];\r
+      }\r
+      if (DecodeHandler != NULL) {\r
+        *DecodeHandler = mExtractDecodeHandlerTable[Index];\r
+      }\r
+      return RETURN_SUCCESS;\r
+    }\r
+  }\r
+  return RETURN_NOT_FOUND;\r
+}\r
index 099d7cc24c688d4d9c916667e992631c640a40f7..fa382ae3c80e449c6f30e111c162335aa8a459c1 100644 (file)
@@ -415,3 +415,77 @@ ExtractGuidedSectionDecode (
   //\r
   return RETURN_UNSUPPORTED;\r
 }\r
+\r
+/**\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
+  GetInfoHandler and DecodeHandler.\r
+\r
+  If the GUID value specified by SectionGuid has not been registered, then \r
+  return RETURN_NOT_FOUND.\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
+                             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
+                             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
+                             If it is NULL, then the previously registered handler is not returned.\r
+\r
+  @retval  RETURN_SUCCESS     The handlers were retrieved.\r
+  @retval  RETURN_NOT_FOUND   No handlers have been registered with the specified GUID.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+ExtractGuidedSectionGetHandlers (\r
+  IN CONST   GUID                                     *SectionGuid,\r
+  OUT        EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER  *GetInfoHandler,  OPTIONAL\r
+  OUT        EXTRACT_GUIDED_SECTION_DECODE_HANDLER    *DecodeHandler    OPTIONAL\r
+  )\r
+{\r
+  EFI_STATUS                               Status;\r
+  UINT32                                   Index;\r
+  PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO  *HandlerInfo;\r
+\r
+  //\r
+  // Check input parameter\r
+  //\r
+  ASSERT (SectionGuid != NULL);\r
+\r
+  //\r
+  // Get the 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
+  //\r
+  ASSERT (HandlerInfo != NULL);\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
+      if (DecodeHandler != NULL) {\r
+        *DecodeHandler = HandlerInfo->ExtractDecodeHandlerTable[Index];\r
+      }\r
+      return RETURN_SUCCESS;\r
+    }\r
+  }\r
+  return RETURN_NOT_FOUND;\r
+}\r