]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update ExtractGuidedSectionLib instance to cover the same handler is registered multi...
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 19 Oct 2007 09:11:42 +0000 (09:11 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 19 Oct 2007 09:11:42 +0000 (09:11 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4183 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c
MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c

index 164691389b3194c9272ecad4390af0d1a19465b3..acffa264fe3ec1a3913885db274db8d9a80b5142 100644 (file)
@@ -114,12 +114,32 @@ ExtractGuidedSectionRegisterHandlers (
   IN        EXTRACT_GUIDED_SECTION_DECODE_HANDLER    DecodeHandler\r
   )\r
 {\r
+  UINT32 Index;\r
   //\r
   // Check input paramter.\r
   //\r
   if (SectionGuid == NULL) {\r
     return RETURN_INVALID_PARAMETER;\r
   }\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
+      break;\r
+    }\r
+  }\r
+\r
+  //\r
+  // If the guided handler has been registered before, only update its handler.\r
+  //\r
+  if (Index < mNumberOfExtractHandler) {\r
+    mExtractDecodeHandlerTable [Index] = DecodeHandler;\r
+    mExtractGetInfoHandlerTable [Index] = GetInfoHandler;\r
+    return RETURN_SUCCESS;\r
+  }\r
+  \r
   //\r
   // Check the global table is enough to contain new Handler.\r
   //\r
index bbe6b508727eca6cfb938edd77f0f2565cd499cd..ce42a5dcd21cfcffe155cdf8624a6587e1630128 100644 (file)
@@ -151,6 +151,7 @@ ExtractGuidedSectionRegisterHandlers (
   )\r
 {\r
   EFI_STATUS Status;\r
+  UINT32     Index;\r
   PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
 \r
   //\r
@@ -167,6 +168,25 @@ ExtractGuidedSectionRegisterHandlers (
   if (EFI_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
+      break;\r
+    }\r
+  }\r
+\r
+  //\r
+  // If the guided handler has been registered before, only update its handler.\r
+  //\r
+  if (Index < HandlerInfo->NumberOfExtractHandler) {\r
+    HandlerInfo->ExtractDecodeHandlerTable [Index] = DecodeHandler;\r
+    HandlerInfo->ExtractGetInfoHandlerTable [Index] = GetInfoHandler;\r
+    return RETURN_SUCCESS;\r
+  }\r
+\r
   //\r
   // Check the global table is enough to contain new Handler.\r
   //\r