public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Satya Yarlagadda <satya.p.yarlagadda@intel.com>
To: edk2-devel@lists.01.org
Cc: Maurice Ma <maurice.ma@intel.com>,
	Jiewen Yao <jiewen.yao@intel.com>,
	Giri P Mudusuru <giri.p.mudusuru@intel.com>
Subject: [PATCH] IntelFsp2Pkg: Align #Pragma in UPD header files to rest of EDK2 Pkgs
Date: Sat, 17 Sep 2016 08:54:49 +0530	[thread overview]
Message-ID: <20160917032449.5696-1-satya.p.yarlagadda@intel.com> (raw)

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>
---
 IntelFsp2Pkg/Tools/GenCfgOpt.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/IntelFsp2Pkg/Tools/GenCfgOpt.py b/IntelFsp2Pkg/Tools/GenCfgOpt.py
index e8cec95..654cdfc 100644
--- a/IntelFsp2Pkg/Tools/GenCfgOpt.py
+++ b/IntelFsp2Pkg/Tools/GenCfgOpt.py
@@ -875,6 +875,9 @@ EndList
         IsArray = False
         if Length in [1,2,4,8]:
             Type = "UINT%d" % (Length * 8)
+            if Name.startswith("UnusedUpdSpace") and Length != 1:
+                IsArray = True
+                Type = "UINT8"
         else:
             IsArray = True
             Type = "UINT8"
@@ -1129,7 +1132,7 @@ EndList
             HeaderFd.write("#ifndef __%s__\n"   % FileName)
             HeaderFd.write("#define __%s__\n\n" % FileName)
             HeaderFd.write("#include <%s>\n\n" % HeaderFileName)
-            HeaderFd.write("#pragma pack(push, 1)\n\n")
+            HeaderFd.write("#pragma pack(1)\n\n")
 
             Export = False
             for Line in IncLines:
@@ -1177,7 +1180,7 @@ EndList
                 for Item in range(len(StructStart)):
                     if Index >= StructStartWithComment[Item] and Index <= StructEnd[Item]:
                         HeaderFd.write (Line)
-            HeaderFd.write("#pragma pack(pop)\n\n")
+            HeaderFd.write("#pragma pack()\n\n")
             HeaderFd.write("#endif\n")
             HeaderFd.close()
 
@@ -1188,7 +1191,7 @@ EndList
         HeaderFd.write("#ifndef __%s__\n"   % FileName)
         HeaderFd.write("#define __%s__\n\n" % FileName)
         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)):
             Index = 0
@@ -1222,7 +1225,7 @@ EndList
                 for Item in range(len(StructStart)):
                     if Index >= StructStartWithComment[Item] and Index <= StructEnd[Item]:
                         HeaderFd.write (Line)
-        HeaderFd.write("#pragma pack(pop)\n\n")
+        HeaderFd.write("#pragma pack()\n\n")
         HeaderFd.write("#endif\n")
         HeaderFd.close()
 
-- 
2.10.0.windows.1



             reply	other threads:[~2016-09-17  3:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-17  3:24 Satya Yarlagadda [this message]
2016-09-17 15:36 ` [PATCH] IntelFsp2Pkg: Align #Pragma in UPD header files to rest of EDK2 Pkgs Mudusuru, Giri P
2016-09-18  1:11 ` Yao, Jiewen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160917032449.5696-1-satya.p.yarlagadda@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox