IntelFrameworkModulePkg FwVolDxe: Support FFS_ATTRIB_DATA_ALIGNMENT_2

Follow PI 1.6 spec to support FFS_ATTRIB_DATA_ALIGNMENT_2 for
FFS alignment extended to support maximum 16MB.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Star Zeng
2017-09-25 18:08:56 +08:00
parent e411f8ca38
commit 67a6cf6dca
2 changed files with 62 additions and 14 deletions

View File

@ -1,7 +1,7 @@
/** @file
Implements write firmware file.
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions
@ -202,9 +202,11 @@ FvFileAttrib2FfsFileAttrib (
{
UINT8 FvFileAlignment;
UINT8 FfsFileAlignment;
UINT8 FfsFileAlignment2;
FvFileAlignment = (UINT8) (FvFileAttrib & EFI_FV_FILE_ATTRIB_ALIGNMENT);
FfsFileAlignment = 0;
FfsFileAlignment2 = 0;
switch (FvFileAlignment) {
case 0:
@ -289,9 +291,42 @@ FvFileAttrib2FfsFileAttrib (
case 16:
FfsFileAlignment = 7;
break;
case 17:
FfsFileAlignment = 0;
FfsFileAlignment2 = 1;
break;
case 18:
FfsFileAlignment = 1;
FfsFileAlignment2 = 1;
break;
case 19:
FfsFileAlignment = 2;
FfsFileAlignment2 = 1;
break;
case 20:
FfsFileAlignment = 3;
FfsFileAlignment2 = 1;
break;
case 21:
FfsFileAlignment = 4;
FfsFileAlignment2 = 1;
break;
case 22:
FfsFileAlignment = 5;
FfsFileAlignment2 = 1;
break;
case 23:
FfsFileAlignment = 6;
FfsFileAlignment2 = 1;
break;
case 24:
FfsFileAlignment = 7;
FfsFileAlignment2 = 1;
break;
}
*FfsFileAttrib = (UINT8) (FfsFileAlignment << 3);
*FfsFileAttrib = (UINT8) ((FfsFileAlignment << 3) | (FfsFileAlignment2 << 1));
return ;
}