]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Close the corresponding GUIDed section extraction protocol notify event in CloseSecti...
authorlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 27 Jul 2012 02:35:24 +0000 (02:35 +0000)
committerlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 27 Jul 2012 02:35:24 +0000 (02:35 +0000)
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13563 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Universal/SectionExtractionDxe/SectionExtraction.c
MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c

index 9300f4dfe07d26a3cc0f35d16721298bb5538077..86bf2be6322096c7b23c87d47c622902e30a9582 100644 (file)
@@ -75,6 +75,11 @@ typedef struct {
   //\r
   UINTN                       EncapsulatedStreamHandle;\r
   EFI_GUID                    *EncapsulationGuid;\r
   //\r
   UINTN                       EncapsulatedStreamHandle;\r
   EFI_GUID                    *EncapsulationGuid;\r
+  //\r
+  // If the section REQUIRES an extraction protocol, register for RPN \r
+  // when the required GUIDed extraction protocol becomes available.\r
+  //\r
+  EFI_EVENT                   Event;\r
 } FRAMEWORK_SECTION_CHILD_NODE;\r
 \r
 #define FRAMEWORK_SECTION_STREAM_SIGNATURE SIGNATURE_32('S','X','S','S')\r
 } FRAMEWORK_SECTION_CHILD_NODE;\r
 \r
 #define FRAMEWORK_SECTION_STREAM_SIGNATURE SIGNATURE_32('S','X','S','S')\r
@@ -100,7 +105,6 @@ typedef struct {
   FRAMEWORK_SECTION_CHILD_NODE     *ChildNode;\r
   FRAMEWORK_SECTION_STREAM_NODE    *ParentStream;\r
   VOID                             *Registration;\r
   FRAMEWORK_SECTION_CHILD_NODE     *ChildNode;\r
   FRAMEWORK_SECTION_STREAM_NODE    *ParentStream;\r
   VOID                             *Registration;\r
-  EFI_EVENT                        Event;\r
 } RPN_EVENT_CONTEXT;\r
 \r
 /**\r
 } RPN_EVENT_CONTEXT;\r
 \r
 /**\r
@@ -602,12 +606,13 @@ NotifyGuidedExtraction (
   }\r
 \r
   //\r
   }\r
 \r
   //\r
-  //  If above, the stream  did not close successfully, it indicates it's\r
-  //  alread been closed by someone, so just destroy the event and be done with\r
+  //  If above, the stream did not close successfully, it indicates it's\r
+  //  already been closed by someone, so just destroy the event and be done with\r
   //  it.\r
   //\r
   \r
   gBS->CloseEvent (Event);\r
   //  it.\r
   //\r
   \r
   gBS->CloseEvent (Event);\r
+  Context->ChildNode->Event = NULL;\r
   FreePool (Context);\r
 }  \r
 \r
   FreePool (Context);\r
 }  \r
 \r
@@ -636,14 +641,14 @@ CreateGuidedExtractionRpnEvent (
   Context->ChildNode = ChildNode;\r
   Context->ParentStream = ParentStream;\r
  \r
   Context->ChildNode = ChildNode;\r
   Context->ParentStream = ParentStream;\r
  \r
-  Context->Event = CreateProtocolNotifyEvent (\r
-                    Context->ChildNode->EncapsulationGuid,\r
-                    TPL_NOTIFY,\r
-                    NotifyGuidedExtraction,\r
-                    Context,\r
-                    &Context->Registration,\r
-                    FALSE\r
-                    );\r
+  Context->ChildNode->Event = CreateProtocolNotifyEvent (\r
+                                Context->ChildNode->EncapsulationGuid,\r
+                                TPL_NOTIFY,\r
+                                NotifyGuidedExtraction,\r
+                                Context,\r
+                                &Context->Registration,\r
+                                FALSE\r
+                                );\r
 }\r
 \r
 /**\r
 }\r
 \r
 /**\r
@@ -695,7 +700,7 @@ CreateChildNode (
   //\r
   // Allocate a new node\r
   //\r
   //\r
   // Allocate a new node\r
   //\r
-  *ChildNode = AllocatePool (sizeof (FRAMEWORK_SECTION_CHILD_NODE));\r
+  *ChildNode = AllocateZeroPool (sizeof (FRAMEWORK_SECTION_CHILD_NODE));\r
   Node = *ChildNode;\r
   if (Node == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   Node = *ChildNode;\r
   if (Node == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
@@ -1045,6 +1050,7 @@ FindChildNode (
   CurrentChildNode = CHILD_SECTION_NODE_FROM_LINK (GetFirstNode(&SourceStream->Children));\r
 \r
   for (;;) {\r
   CurrentChildNode = CHILD_SECTION_NODE_FROM_LINK (GetFirstNode(&SourceStream->Children));\r
 \r
   for (;;) {\r
+    ASSERT (CurrentChildNode != NULL);\r
     if (ChildIsType (SourceStream, CurrentChildNode, SearchType, SectionDefinitionGuid)) {\r
       //\r
       // The type matches, so check the instance count to see if it's the one we want\r
     if (ChildIsType (SourceStream, CurrentChildNode, SearchType, SectionDefinitionGuid)) {\r
       //\r
       // The type matches, so check the instance count to see if it's the one we want\r
@@ -1061,7 +1067,6 @@ FindChildNode (
       }\r
     }\r
     \r
       }\r
     }\r
     \r
-    ASSERT (CurrentChildNode != NULL);\r
     if (CurrentChildNode->EncapsulatedStreamHandle != NULL_STREAM_HANDLE) {\r
       //\r
       // If the current node is an encapsulating node, recurse into it...\r
     if (CurrentChildNode->EncapsulatedStreamHandle != NULL_STREAM_HANDLE) {\r
       //\r
       // If the current node is an encapsulating node, recurse into it...\r
@@ -1339,6 +1344,11 @@ FreeChildNode (
     //\r
     CloseSectionStream (&mSectionExtraction, ChildNode->EncapsulatedStreamHandle);\r
   }\r
     //\r
     CloseSectionStream (&mSectionExtraction, ChildNode->EncapsulatedStreamHandle);\r
   }\r
+\r
+  if (ChildNode->Event != NULL) {\r
+    gBS->CloseEvent (ChildNode->Event);\r
+  }\r
+\r
   //\r
   // Last, free the child node itself\r
   //\r
   //\r
   // Last, free the child node itself\r
   //\r
index 8d8f9c8641d00b3f38a87013708dd84d13b2365e..40304b925c992929388492e8d56e0dab536e0c09 100644 (file)
@@ -66,6 +66,11 @@ typedef struct {
   //\r
   UINTN                       EncapsulatedStreamHandle;\r
   EFI_GUID                    *EncapsulationGuid;\r
   //\r
   UINTN                       EncapsulatedStreamHandle;\r
   EFI_GUID                    *EncapsulationGuid;\r
+  //\r
+  // If the section REQUIRES an extraction protocol, register for RPN \r
+  // when the required GUIDed extraction protocol becomes available.\r
+  //\r
+  EFI_EVENT                   Event;\r
 } CORE_SECTION_CHILD_NODE;\r
 \r
 #define CORE_SECTION_STREAM_SIGNATURE SIGNATURE_32('S','X','S','S')\r
 } CORE_SECTION_CHILD_NODE;\r
 \r
 #define CORE_SECTION_STREAM_SIGNATURE SIGNATURE_32('S','X','S','S')\r
@@ -91,7 +96,6 @@ typedef struct {
   CORE_SECTION_CHILD_NODE     *ChildNode;\r
   CORE_SECTION_STREAM_NODE    *ParentStream;\r
   VOID                        *Registration;\r
   CORE_SECTION_CHILD_NODE     *ChildNode;\r
   CORE_SECTION_STREAM_NODE    *ParentStream;\r
   VOID                        *Registration;\r
-  EFI_EVENT                   Event;\r
 } RPN_EVENT_CONTEXT;\r
 \r
 \r
 } RPN_EVENT_CONTEXT;\r
 \r
 \r
@@ -558,6 +562,7 @@ NotifyGuidedExtraction (
   //  Close the event when done.\r
   //\r
   gBS->CloseEvent (Event);\r
   //  Close the event when done.\r
   //\r
   gBS->CloseEvent (Event);\r
+  Context->ChildNode->Event = NULL;\r
   FreePool (Context);\r
 }  \r
 \r
   FreePool (Context);\r
 }  \r
 \r
@@ -585,13 +590,13 @@ CreateGuidedExtractionRpnEvent (
   Context->ChildNode = ChildNode;\r
   Context->ParentStream = ParentStream;\r
  \r
   Context->ChildNode = ChildNode;\r
   Context->ParentStream = ParentStream;\r
  \r
-  Context->Event = EfiCreateProtocolNotifyEvent (\r
-                    Context->ChildNode->EncapsulationGuid,\r
-                    TPL_NOTIFY,\r
-                    NotifyGuidedExtraction,\r
-                    Context,\r
-                    &Context->Registration\r
-                    );\r
+  Context->ChildNode->Event = EfiCreateProtocolNotifyEvent (\r
+                                Context->ChildNode->EncapsulationGuid,\r
+                                TPL_NOTIFY,\r
+                                NotifyGuidedExtraction,\r
+                                Context,\r
+                                &Context->Registration\r
+                                );\r
 }\r
 \r
 /**\r
 }\r
 \r
 /**\r
@@ -646,7 +651,7 @@ CreateChildNode (
   //\r
   // Allocate a new node\r
   //\r
   //\r
   // Allocate a new node\r
   //\r
-  *ChildNode = AllocatePool (sizeof (CORE_SECTION_CHILD_NODE));\r
+  *ChildNode = AllocateZeroPool (sizeof (CORE_SECTION_CHILD_NODE));\r
   Node = *ChildNode;\r
   if (Node == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   Node = *ChildNode;\r
   if (Node == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
@@ -1289,6 +1294,11 @@ FreeChildNode (
     //\r
     CloseSectionStream (ChildNode->EncapsulatedStreamHandle);\r
   }\r
     //\r
     CloseSectionStream (ChildNode->EncapsulatedStreamHandle);\r
   }\r
+\r
+  if (ChildNode->Event != NULL) {\r
+    gBS->CloseEvent (ChildNode->Event);\r
+  }\r
+\r
   //\r
   // Last, free the child node itself\r
   //\r
   //\r
   // Last, free the child node itself\r
   //\r