mirror of https://github.com/acidanthera/audk.git
IntelFsp2Pkg: Align #Pragma in UPD header files to rest of EDK2 Pkgs
Changed the GenCfgOpt.py script to insert pragma pack(1) instead of pragma pack (push, 1) in the upd header files generated during fsp build. This is to align with rest of the EDKII pkgs pragma pack usage. Also, this scripts generates UnusedUpdSpace for UPD address gaps. Currently it uses UIN16/UINT32/UINT64 for 2/4/8 bytes instead of UINT8[], thus causing upd space waste to have Natural Alignment. Hence changed the script to use UINT8[] for any unusedUpd fields above 1 byte. Cc: Maurice Ma <maurice.ma@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Satya Yarlagadda <satya.p.yarlagadda@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
This commit is contained in:
parent
0a92ac8802
commit
cd3692b11e
|
@ -875,6 +875,9 @@ EndList
|
||||||
IsArray = False
|
IsArray = False
|
||||||
if Length in [1,2,4,8]:
|
if Length in [1,2,4,8]:
|
||||||
Type = "UINT%d" % (Length * 8)
|
Type = "UINT%d" % (Length * 8)
|
||||||
|
if Name.startswith("UnusedUpdSpace") and Length != 1:
|
||||||
|
IsArray = True
|
||||||
|
Type = "UINT8"
|
||||||
else:
|
else:
|
||||||
IsArray = True
|
IsArray = True
|
||||||
Type = "UINT8"
|
Type = "UINT8"
|
||||||
|
@ -1129,7 +1132,7 @@ EndList
|
||||||
HeaderFd.write("#ifndef __%s__\n" % FileName)
|
HeaderFd.write("#ifndef __%s__\n" % FileName)
|
||||||
HeaderFd.write("#define __%s__\n\n" % FileName)
|
HeaderFd.write("#define __%s__\n\n" % FileName)
|
||||||
HeaderFd.write("#include <%s>\n\n" % HeaderFileName)
|
HeaderFd.write("#include <%s>\n\n" % HeaderFileName)
|
||||||
HeaderFd.write("#pragma pack(push, 1)\n\n")
|
HeaderFd.write("#pragma pack(1)\n\n")
|
||||||
|
|
||||||
Export = False
|
Export = False
|
||||||
for Line in IncLines:
|
for Line in IncLines:
|
||||||
|
@ -1177,7 +1180,7 @@ EndList
|
||||||
for Item in range(len(StructStart)):
|
for Item in range(len(StructStart)):
|
||||||
if Index >= StructStartWithComment[Item] and Index <= StructEnd[Item]:
|
if Index >= StructStartWithComment[Item] and Index <= StructEnd[Item]:
|
||||||
HeaderFd.write (Line)
|
HeaderFd.write (Line)
|
||||||
HeaderFd.write("#pragma pack(pop)\n\n")
|
HeaderFd.write("#pragma pack()\n\n")
|
||||||
HeaderFd.write("#endif\n")
|
HeaderFd.write("#endif\n")
|
||||||
HeaderFd.close()
|
HeaderFd.close()
|
||||||
|
|
||||||
|
@ -1188,7 +1191,7 @@ EndList
|
||||||
HeaderFd.write("#ifndef __%s__\n" % FileName)
|
HeaderFd.write("#ifndef __%s__\n" % FileName)
|
||||||
HeaderFd.write("#define __%s__\n\n" % FileName)
|
HeaderFd.write("#define __%s__\n\n" % FileName)
|
||||||
HeaderFd.write("#include <FspEas.h>\n\n")
|
HeaderFd.write("#include <FspEas.h>\n\n")
|
||||||
HeaderFd.write("#pragma pack(push, 1)\n\n")
|
HeaderFd.write("#pragma pack(1)\n\n")
|
||||||
|
|
||||||
for item in range(len(UpdRegionCheck)):
|
for item in range(len(UpdRegionCheck)):
|
||||||
Index = 0
|
Index = 0
|
||||||
|
@ -1222,7 +1225,7 @@ EndList
|
||||||
for Item in range(len(StructStart)):
|
for Item in range(len(StructStart)):
|
||||||
if Index >= StructStartWithComment[Item] and Index <= StructEnd[Item]:
|
if Index >= StructStartWithComment[Item] and Index <= StructEnd[Item]:
|
||||||
HeaderFd.write (Line)
|
HeaderFd.write (Line)
|
||||||
HeaderFd.write("#pragma pack(pop)\n\n")
|
HeaderFd.write("#pragma pack()\n\n")
|
||||||
HeaderFd.write("#endif\n")
|
HeaderFd.write("#endif\n")
|
||||||
HeaderFd.close()
|
HeaderFd.close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue