Close the corresponding GUIDed section extraction protocol notify event in CloseSectionStream.

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
This commit is contained in:
lzeng14 2012-07-27 02:35:24 +00:00
parent b90aefa9e4
commit 805c2dd119
2 changed files with 42 additions and 22 deletions

View File

@ -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;
/**
@ -603,11 +607,12 @@ 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
// 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,7 +641,7 @@ CreateGuidedExtractionRpnEvent (
Context->ChildNode = ChildNode;
Context->ParentStream = ParentStream;
Context->Event = CreateProtocolNotifyEvent (
Context->ChildNode->Event = CreateProtocolNotifyEvent (
Context->ChildNode->EncapsulationGuid,
TPL_NOTIFY,
NotifyGuidedExtraction,
@ -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
//

View File

@ -66,6 +66,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;
} CORE_SECTION_CHILD_NODE;
#define CORE_SECTION_STREAM_SIGNATURE SIGNATURE_32('S','X','S','S')
@ -91,7 +96,6 @@ typedef struct {
CORE_SECTION_CHILD_NODE *ChildNode;
CORE_SECTION_STREAM_NODE *ParentStream;
VOID *Registration;
EFI_EVENT Event;
} RPN_EVENT_CONTEXT;
@ -558,6 +562,7 @@ NotifyGuidedExtraction (
// Close the event when done.
//
gBS->CloseEvent (Event);
Context->ChildNode->Event = NULL;
FreePool (Context);
}
@ -585,7 +590,7 @@ CreateGuidedExtractionRpnEvent (
Context->ChildNode = ChildNode;
Context->ParentStream = ParentStream;
Context->Event = EfiCreateProtocolNotifyEvent (
Context->ChildNode->Event = EfiCreateProtocolNotifyEvent (
Context->ChildNode->EncapsulationGuid,
TPL_NOTIFY,
NotifyGuidedExtraction,
@ -646,7 +651,7 @@ CreateChildNode (
//
// Allocate a new node
//
*ChildNode = AllocatePool (sizeof (CORE_SECTION_CHILD_NODE));
*ChildNode = AllocateZeroPool (sizeof (CORE_SECTION_CHILD_NODE));
Node = *ChildNode;
if (Node == NULL) {
return EFI_OUT_OF_RESOURCES;
@ -1289,6 +1294,11 @@ FreeChildNode (
//
CloseSectionStream (ChildNode->EncapsulatedStreamHandle);
}
if (ChildNode->Event != NULL) {
gBS->CloseEvent (ChildNode->Event);
}
//
// Last, free the child node itself
//