summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>2012-07-27 02:35:24 +0000
committerlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>2012-07-27 02:35:24 +0000
commit805c2dd1198760778d6460280f5cc5e93a04d612 (patch)
tree8332525a90ed065afc8190b989f071e063732f8f
parentb90aefa9e46c2c2628bfbf62e43b366678b9af07 (diff)
downloadedk2-platforms-805c2dd1198760778d6460280f5cc5e93a04d612.tar.xz
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
-rw-r--r--IntelFrameworkModulePkg/Universal/SectionExtractionDxe/SectionExtraction.c36
-rw-r--r--MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c28
2 files changed, 42 insertions, 22 deletions
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
//
diff --git a/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c b/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c
index 8d8f9c8641..40304b925c 100644
--- a/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c
+++ b/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c
@@ -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,13 +590,13 @@ CreateGuidedExtractionRpnEvent (
Context->ChildNode = ChildNode;
Context->ParentStream = ParentStream;
- Context->Event = EfiCreateProtocolNotifyEvent (
- Context->ChildNode->EncapsulationGuid,
- TPL_NOTIFY,
- NotifyGuidedExtraction,
- Context,
- &Context->Registration
- );
+ Context->ChildNode->Event = EfiCreateProtocolNotifyEvent (
+ Context->ChildNode->EncapsulationGuid,
+ TPL_NOTIFY,
+ NotifyGuidedExtraction,
+ Context,
+ &Context->Registration
+ );
}
/**
@@ -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
//