From eb1cace292ff0c66ca11eff4703c9fa16219c2a1 Mon Sep 17 00:00:00 2001 From: Star Zeng Date: Wed, 27 Aug 2014 08:31:44 +0000 Subject: MdeModulePkg DxeCore: Don't cache memory mapped IO FV. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previous DxeCore FwVol code will cache whole FvMain FV from flash that may be uncached if platform reports FvMain FVB, it will impact DXE performance. The code already has file level cache, so don’t need to cache memory mapped IO FV. It can also reduce memory consumption of caching memory mapped IO FVs. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng Reviewed-by: Liming Gao git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15916 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Core/Dxe/SectionExtraction/CoreSectionExtraction.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c') diff --git a/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c b/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c index 981744c4d3..3c4f3f58db 100644 --- a/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c +++ b/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c @@ -440,7 +440,7 @@ OpenSectionStream ( return OpenSectionStreamEx ( SectionStreamLength, SectionStream, - TRUE, + FALSE, 0, SectionStreamHandle ); @@ -1344,7 +1344,7 @@ FreeChildNode ( // If it's an encapsulating section, we close the resulting section stream. // CloseSectionStream will free all memory associated with the stream. // - CloseSectionStream (ChildNode->EncapsulatedStreamHandle); + CloseSectionStream (ChildNode->EncapsulatedStreamHandle, TRUE); } if (ChildNode->Event != NULL) { @@ -1362,6 +1362,8 @@ FreeChildNode ( SEP member function. Deletes an existing section stream @param StreamHandleToClose Indicates the stream to close + @param FreeStreamBuffer TRUE - Need to free stream buffer; + FALSE - No need to free stream buffer. @retval EFI_SUCCESS The section stream is closed sucessfully. @retval EFI_OUT_OF_RESOURCES Memory allocation failed. @@ -1372,7 +1374,8 @@ FreeChildNode ( EFI_STATUS EFIAPI CloseSectionStream ( - IN UINTN StreamHandleToClose + IN UINTN StreamHandleToClose, + IN BOOLEAN FreeStreamBuffer ) { CORE_SECTION_STREAM_NODE *StreamNode; @@ -1397,7 +1400,9 @@ CloseSectionStream ( ChildNode = CHILD_SECTION_NODE_FROM_LINK (Link); FreeChildNode (ChildNode); } - CoreFreePool (StreamNode->StreamBuffer); + if (FreeStreamBuffer) { + CoreFreePool (StreamNode->StreamBuffer); + } CoreFreePool (StreamNode); Status = EFI_SUCCESS; } else { -- cgit v1.2.3