diff options
author | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-12-07 10:25:56 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-12-07 10:25:56 +0000 |
commit | c4869732ece19962c1262f1157a96d8a6240be6c (patch) | |
tree | 9b28569ccec08791c308770da73156fc51e64e1c /MdeModulePkg/Core | |
parent | 069cb38f00f8232ff8b72c70b0561fc392d21391 (diff) | |
download | edk2-platforms-c4869732ece19962c1262f1157a96d8a6240be6c.tar.xz |
Cache FvImage at buffer with its required alignment.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4372 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core')
-rw-r--r-- | MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c | 1 | ||||
-rw-r--r-- | MdeModulePkg/Core/Dxe/DxeMain.h | 1 | ||||
-rw-r--r-- | MdeModulePkg/Core/Dxe/DxeMain.inf | 1 | ||||
-rw-r--r-- | MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c | 20 |
4 files changed, 19 insertions, 4 deletions
diff --git a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c index 0529d36d79..bb49686875 100644 --- a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c +++ b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c @@ -1084,7 +1084,6 @@ Returns: if (FvFoundInHobFv2 (FvHandle, &NameGuid)) {
continue;
}
-
//
// Found a firmware volume image. Produce a firmware volume block
// protocol for it so it gets dispatched from. This is usually a
diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h index 16b7d8c10c..2490979a70 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.h +++ b/MdeModulePkg/Core/Dxe/DxeMain.h @@ -82,6 +82,7 @@ Revision History #include <Library/CacheMaintenanceLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/PeCoffLib.h>
+#include <Library/MemoryAllocationLib.h>
#include "DebugImageInfo.h"
#include "Library.h"
diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf b/MdeModulePkg/Core/Dxe/DxeMain.inf index 981c12d7f8..ce6d55f654 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.inf +++ b/MdeModulePkg/Core/Dxe/DxeMain.inf @@ -87,6 +87,7 @@ DxeCoreEntryPoint
PeCoffLib
ExtractGuidedSectionLib
+ MemoryAllocationLib
[Guids]
gEfiEventLegacyBootGuid # ALWAYS_CONSUMED
diff --git a/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c b/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c index 1a98e97e9a..67dd803861 100644 --- a/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c +++ b/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c @@ -412,11 +412,14 @@ Returns: UINTN Instance;
UINT8 *CopyBuffer;
UINTN SectionSize;
+ EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
+ UINT32 FvAlignment;
+
-
OldTpl = CoreRaiseTpl (TPL_NOTIFY);
Instance = SectionInstance + 1;
-
+ FvHeader = NULL;
+ FvAlignment = 0;
//
// Locate target stream
//
@@ -469,8 +472,19 @@ Returns: } else {
//
// Callee allocated buffer. Allocate buffer and return size.
+ // For FvImage, the buffer is allocated at its required alignment.
//
- *Buffer = CoreAllocateBootServicesPool (CopySize);
+ if (*SectionType == EFI_SECTION_FIRMWARE_VOLUME_IMAGE) {
+ FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) CopyBuffer;
+ FvAlignment = 1 << ((FvHeader->Attributes & EFI_FVB2_ALIGNMENT) >> 16);
+ //
+ // FvAlignment must be more than 8 bytes required by FvHeader structure.
+ //
+ if (FvAlignment < 8) {
+ FvAlignment = 8;
+ }
+ }
+ *Buffer = AllocateAlignedPool ((UINTN) CopySize, (UINTN) FvAlignment);
if (*Buffer == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto GetSection_Done;
|