Reviewed-by: Liming Gao <liming....@intel.com> -----Original Message----- From: Zeng, Star Sent: Friday, August 21, 2015 2:19 PM To: edk2-devel@lists.01.org Cc: Gao, Liming Subject: [PATCH 1/2] BaseTools: Follow PI spec to update ExtendedSize in EFI_FFS_FILE_HEADER2
for FFS data above 16 bytes alignment requirement. PI spec requires FFS header to be at 8 bytes alignment to FV header. And, FFS data alignment requires the beginning of the file data must be aligned on a particular boundary, such as 1, 16, 128 bytes or above. If FFS data alignment requires to be above 16 bytes, and FFS header must be at 8 byte alignment, so FFS header size must be multiple of 8. Cc: Liming Gao <liming....@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.z...@intel.com> --- BaseTools/Source/C/Common/FirmwareVolumeBuffer.c | 4 ++-- BaseTools/Source/C/Common/FvLib.c | 4 ++-- BaseTools/Source/C/Include/Common/PiFirmwareFile.h | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c b/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c index 01d4e72..7988d8e 100644 --- a/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c +++ b/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c @@ -1,7 +1,7 @@ /** @file EFI Firmware Volume routines which work on a Fv image in buffers. -Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR> +Copyright (c) 1999 - 2015, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -864,7 +864,7 @@ Returns: return 0; } if (Ffs->Attributes & FFS_ATTRIB_LARGE_FILE) { - return ((EFI_FFS_FILE_HEADER2 *)Ffs)->ExtendedSize; + return (UINT32) ((EFI_FFS_FILE_HEADER2 *)Ffs)->ExtendedSize; } return FvBufExpand3ByteSize(Ffs->Size); } diff --git a/BaseTools/Source/C/Common/FvLib.c b/BaseTools/Source/C/Common/FvLib.c index 1b3c08b..938aa09 100644 --- a/BaseTools/Source/C/Common/FvLib.c +++ b/BaseTools/Source/C/Common/FvLib.c @@ -1,7 +1,7 @@ /** @file These functions assist in parsing and manipulating a Firmware Volume. -Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -784,7 +784,7 @@ Returns: return 0; } if (FfsHeader->Attributes & FFS_ATTRIB_LARGE_FILE) { - return ((EFI_FFS_FILE_HEADER2 *)FfsHeader)->ExtendedSize; + return (UINT32) ((EFI_FFS_FILE_HEADER2 *)FfsHeader)->ExtendedSize; } else { return GetLength(FfsHeader->Size); } diff --git a/BaseTools/Source/C/Include/Common/PiFirmwareFile.h b/BaseTools/Source/C/Include/Common/PiFirmwareFile.h index ec31eab..2984860 100644 --- a/BaseTools/Source/C/Include/Common/PiFirmwareFile.h +++ b/BaseTools/Source/C/Include/Common/PiFirmwareFile.h @@ -2,9 +2,9 @@ The firmware file related definitions in PI. @par Revision Reference: - Version 1.0. + Version 1.4. - Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR> + Copyright (c) 2006 - 2015, Intel Corporation. All rights + reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this @@ -110,7 +110,7 @@ typedef struct { EFI_FFS_FILE_ATTRIBUTES Attributes; UINT8 Size[3]; EFI_FFS_FILE_STATE State; - UINT32 ExtendedSize; + UINT64 ExtendedSize; } EFI_FFS_FILE_HEADER2; #define MAX_FFS_SIZE 0x1000000 -- 1.9.5.msysgit.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel