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
//\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
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
} RPN_EVENT_CONTEXT;\r
\r
/**\r
} RPN_EVENT_CONTEXT;\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
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
// 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
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
- 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
//\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
//\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
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
} RPN_EVENT_CONTEXT;\r
\r
\r
} RPN_EVENT_CONTEXT;\r
\r
\r
// 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
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
// 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
//\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