* [PATCH] IntelFrameworkModulePkg FwVolDxe: Support FFS_ATTRIB_DATA_ALIGNMENT_2
@ 2017-09-25 10:14 Star Zeng
2017-09-25 11:08 ` Gao, Liming
0 siblings, 1 reply; 2+ messages in thread
From: Star Zeng @ 2017-09-25 10:14 UTC (permalink / raw)
To: edk2-devel; +Cc: Star Zeng, Liming Gao
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>
Note: This patch is to update IntelFrameworkModulePkg as a supplement
of https://lists.01.org/pipermail/edk2-devel/2017-September/015165.html.
---
.../Universal/FirmwareVolume/FwVolDxe/FwVolRead.c | 37 +++++++++++++-------
.../Universal/FirmwareVolume/FwVolDxe/FwVolWrite.c | 39 ++++++++++++++++++++--
2 files changed, 62 insertions(+), 14 deletions(-)
diff --git a/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVolRead.c b/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVolRead.c
index 0d9021914f33..987c92c16be3 100644
--- a/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVolRead.c
+++ b/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVolRead.c
@@ -1,7 +1,7 @@
/** @file
Implements functions to read firmware file.
- Copyright (c) 2006 - 2016, 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
@@ -17,18 +17,27 @@
#include "FwVolDriver.h"
/**
-Required Alignment Alignment Value in FFS Alignment Value in
-(bytes) Attributes Field Firmware Volume Interfaces
-1 0 0
-16 1 4
-128 2 7
-512 3 9
-1 KB 4 10
-4 KB 5 12
-32 KB 6 15
-64 KB 7 16
+Required Alignment Alignment Value in FFS FFS_ATTRIB_DATA_ALIGNMENT2 Alignment Value in
+(bytes) Attributes Field in FFS Attributes Field Firmware Volume Interfaces
+1 0 0 0
+16 1 0 4
+128 2 0 7
+512 3 0 9
+1 KB 4 0 10
+4 KB 5 0 12
+32 KB 6 0 15
+64 KB 7 0 16
+128 KB 0 1 17
+256 KB 1 1 18
+512 KB 2 1 19
+1 MB 3 1 20
+2 MB 4 1 21
+4 MB 5 1 22
+8 MB 6 1 23
+16 MB 7 1 24
**/
UINT8 mFvAttributes[] = {0, 4, 7, 9, 10, 12, 15, 16};
+UINT8 mFvAttributes2[] = {17, 18, 19, 20, 21, 22, 23, 24};
/**
Convert the FFS File Attributes to FV File Attributes.
@@ -49,7 +58,11 @@ FfsAttributes2FvFileAttributes (
DataAlignment = (UINT8) ((FfsAttributes & FFS_ATTRIB_DATA_ALIGNMENT) >> 3);
ASSERT (DataAlignment < 8);
- FileAttribute = (EFI_FV_FILE_ATTRIBUTES) mFvAttributes[DataAlignment];
+ if ((FfsAttributes & FFS_ATTRIB_DATA_ALIGNMENT_2) != 0) {
+ FileAttribute = (EFI_FV_FILE_ATTRIBUTES) mFvAttributes2[DataAlignment];
+ } else {
+ FileAttribute = (EFI_FV_FILE_ATTRIBUTES) mFvAttributes[DataAlignment];
+ }
if ((FfsAttributes & FFS_ATTRIB_FIXED) == FFS_ATTRIB_FIXED) {
FileAttribute |= EFI_FV_FILE_ATTRIB_FIXED;
diff --git a/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVolWrite.c b/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVolWrite.c
index 99385e0f579b..e95b75326c6e 100644
--- a/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVolWrite.c
+++ b/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVolWrite.c
@@ -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 ;
}
--
2.7.0.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] IntelFrameworkModulePkg FwVolDxe: Support FFS_ATTRIB_DATA_ALIGNMENT_2
2017-09-25 10:14 [PATCH] IntelFrameworkModulePkg FwVolDxe: Support FFS_ATTRIB_DATA_ALIGNMENT_2 Star Zeng
@ 2017-09-25 11:08 ` Gao, Liming
0 siblings, 0 replies; 2+ messages in thread
From: Gao, Liming @ 2017-09-25 11:08 UTC (permalink / raw)
To: Zeng, Star, edk2-devel@lists.01.org
Reviewed-by: Liming Gao <liming.gao@intel.com>
>-----Original Message-----
>From: Zeng, Star
>Sent: Monday, September 25, 2017 6:15 PM
>To: edk2-devel@lists.01.org
>Cc: Zeng, Star <star.zeng@intel.com>; Gao, Liming <liming.gao@intel.com>
>Subject: [PATCH] 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>
>
>Note: This patch is to update IntelFrameworkModulePkg as a supplement
>of https://lists.01.org/pipermail/edk2-devel/2017-September/015165.html.
>---
> .../Universal/FirmwareVolume/FwVolDxe/FwVolRead.c | 37
>+++++++++++++-------
> .../Universal/FirmwareVolume/FwVolDxe/FwVolWrite.c | 39
>++++++++++++++++++++--
> 2 files changed, 62 insertions(+), 14 deletions(-)
>
>diff --git
>a/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVolR
>ead.c
>b/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVol
>Read.c
>index 0d9021914f33..987c92c16be3 100644
>---
>a/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVolR
>ead.c
>+++
>b/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVol
>Read.c
>@@ -1,7 +1,7 @@
> /** @file
> Implements functions to read firmware file.
>
>- Copyright (c) 2006 - 2016, 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
>@@ -17,18 +17,27 @@
> #include "FwVolDriver.h"
>
> /**
>-Required Alignment Alignment Value in FFS Alignment Value in
>-(bytes) Attributes Field Firmware Volume Interfaces
>-1 0 0
>-16 1 4
>-128 2 7
>-512 3 9
>-1 KB 4 10
>-4 KB 5 12
>-32 KB 6 15
>-64 KB 7 16
>+Required Alignment Alignment Value in FFS
>FFS_ATTRIB_DATA_ALIGNMENT2 Alignment Value in
>+(bytes) Attributes Field in FFS Attributes Field Firmware Volume
>Interfaces
>+1 0 0 0
>+16 1 0 4
>+128 2 0 7
>+512 3 0 9
>+1 KB 4 0 10
>+4 KB 5 0 12
>+32 KB 6 0 15
>+64 KB 7 0 16
>+128 KB 0 1 17
>+256 KB 1 1 18
>+512 KB 2 1 19
>+1 MB 3 1 20
>+2 MB 4 1 21
>+4 MB 5 1 22
>+8 MB 6 1 23
>+16 MB 7 1 24
> **/
> UINT8 mFvAttributes[] = {0, 4, 7, 9, 10, 12, 15, 16};
>+UINT8 mFvAttributes2[] = {17, 18, 19, 20, 21, 22, 23, 24};
>
> /**
> Convert the FFS File Attributes to FV File Attributes.
>@@ -49,7 +58,11 @@ FfsAttributes2FvFileAttributes (
> DataAlignment = (UINT8) ((FfsAttributes &
>FFS_ATTRIB_DATA_ALIGNMENT) >> 3);
> ASSERT (DataAlignment < 8);
>
>- FileAttribute = (EFI_FV_FILE_ATTRIBUTES) mFvAttributes[DataAlignment];
>+ if ((FfsAttributes & FFS_ATTRIB_DATA_ALIGNMENT_2) != 0) {
>+ FileAttribute = (EFI_FV_FILE_ATTRIBUTES) mFvAttributes2[DataAlignment];
>+ } else {
>+ FileAttribute = (EFI_FV_FILE_ATTRIBUTES) mFvAttributes[DataAlignment];
>+ }
>
> if ((FfsAttributes & FFS_ATTRIB_FIXED) == FFS_ATTRIB_FIXED) {
> FileAttribute |= EFI_FV_FILE_ATTRIB_FIXED;
>diff --git
>a/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVol
>Write.c
>b/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVol
>Write.c
>index 99385e0f579b..e95b75326c6e 100644
>---
>a/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVol
>Write.c
>+++
>b/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVol
>Write.c
>@@ -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 ;
> }
>--
>2.7.0.windows.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-25 11:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-25 10:14 [PATCH] IntelFrameworkModulePkg FwVolDxe: Support FFS_ATTRIB_DATA_ALIGNMENT_2 Star Zeng
2017-09-25 11:08 ` Gao, Liming
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox