From 805c2dd1198760778d6460280f5cc5e93a04d612 Mon Sep 17 00:00:00 2001 From: lzeng14 Date: Fri, 27 Jul 2012 02:35:24 +0000 Subject: Close the corresponding GUIDed section extraction protocol notify event in CloseSectionStream. Signed-off-by: Star Zeng Reviewed-by: Chao Zhang git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13563 6f19259b-4bc3-4df7-8a09-765794883524 --- .../SectionExtractionDxe/SectionExtraction.c | 36 ++++++++++++++-------- 1 file changed, 23 insertions(+), 13 deletions(-) (limited to 'IntelFrameworkModulePkg') diff --git a/IntelFrameworkModulePkg/Universal/SectionExtractionDxe/SectionExtraction.c b/IntelFrameworkModulePkg/Universal/SectionExtractionDxe/SectionExtraction.c index 9300f4dfe0..86bf2be632 100644 --- a/IntelFrameworkModulePkg/Universal/SectionExtractionDxe/SectionExtraction.c +++ b/IntelFrameworkModulePkg/Universal/SectionExtractionDxe/SectionExtraction.c @@ -75,6 +75,11 @@ typedef struct { // UINTN EncapsulatedStreamHandle; EFI_GUID *EncapsulationGuid; + // + // If the section REQUIRES an extraction protocol, register for RPN + // when the required GUIDed extraction protocol becomes available. + // + EFI_EVENT Event; } FRAMEWORK_SECTION_CHILD_NODE; #define FRAMEWORK_SECTION_STREAM_SIGNATURE SIGNATURE_32('S','X','S','S') @@ -100,7 +105,6 @@ typedef struct { FRAMEWORK_SECTION_CHILD_NODE *ChildNode; FRAMEWORK_SECTION_STREAM_NODE *ParentStream; VOID *Registration; - EFI_EVENT Event; } RPN_EVENT_CONTEXT; /** @@ -602,12 +606,13 @@ NotifyGuidedExtraction ( } // - // If above, the stream did not close successfully, it indicates it's - // alread been closed by someone, so just destroy the event and be done with + // If above, the stream did not close successfully, it indicates it's + // already been closed by someone, so just destroy the event and be done with // it. // gBS->CloseEvent (Event); + Context->ChildNode->Event = NULL; FreePool (Context); } @@ -636,14 +641,14 @@ CreateGuidedExtractionRpnEvent ( Context->ChildNode = ChildNode; Context->ParentStream = ParentStream; - Context->Event = CreateProtocolNotifyEvent ( - Context->ChildNode->EncapsulationGuid, - TPL_NOTIFY, - NotifyGuidedExtraction, - Context, - &Context->Registration, - FALSE - ); + Context->ChildNode->Event = CreateProtocolNotifyEvent ( + Context->ChildNode->EncapsulationGuid, + TPL_NOTIFY, + NotifyGuidedExtraction, + Context, + &Context->Registration, + FALSE + ); } /** @@ -695,7 +700,7 @@ CreateChildNode ( // // Allocate a new node // - *ChildNode = AllocatePool (sizeof (FRAMEWORK_SECTION_CHILD_NODE)); + *ChildNode = AllocateZeroPool (sizeof (FRAMEWORK_SECTION_CHILD_NODE)); Node = *ChildNode; if (Node == NULL) { return EFI_OUT_OF_RESOURCES; @@ -1045,6 +1050,7 @@ FindChildNode ( CurrentChildNode = CHILD_SECTION_NODE_FROM_LINK (GetFirstNode(&SourceStream->Children)); for (;;) { + ASSERT (CurrentChildNode != NULL); if (ChildIsType (SourceStream, CurrentChildNode, SearchType, SectionDefinitionGuid)) { // // The type matches, so check the instance count to see if it's the one we want @@ -1061,7 +1067,6 @@ FindChildNode ( } } - ASSERT (CurrentChildNode != NULL); if (CurrentChildNode->EncapsulatedStreamHandle != NULL_STREAM_HANDLE) { // // If the current node is an encapsulating node, recurse into it... @@ -1339,6 +1344,11 @@ FreeChildNode ( // CloseSectionStream (&mSectionExtraction, ChildNode->EncapsulatedStreamHandle); } + + if (ChildNode->Event != NULL) { + gBS->CloseEvent (ChildNode->Event); + } + // // Last, free the child node itself // -- cgit v1.2.3