public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Cheng, Ching JenX" <ching.jenx.cheng@intel.com>
To: devel@edk2.groups.io
Cc: Amy Chan <amy.chan@intel.com>,
	Chasel Chiu <chasel.chiu@intel.com>,
	Nate DeSimone <nathaniel.l.desimone@intel.com>,
	Star Zeng <star.zeng@intel.com>
Subject: [PATCH v2] * IntelFsp2Pkg: Improve FSP Python scripts to support 3.x.
Date: Thu,  1 Aug 2019 18:07:01 +0800	[thread overview]
Message-ID: <20190801100702.11484-1-ching.jenx.cheng@intel.com> (raw)

BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=2041

[PATCH v2] Update commit message for more detail description

When running with Python 3.x and relying on GenCfgOpt.py to
automatically assign UPD offsets,
the script crashed because some float type variable not compatible with
the operations.
Convert those float variable to int to fix these issues.

Cc: Amy Chan <amy.chan@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Ching JenX Cheng <ching.jenx.cheng@intel.com>
---
 IntelFsp2Pkg/Tools/GenCfgOpt.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/IntelFsp2Pkg/Tools/GenCfgOpt.py b/IntelFsp2Pkg/Tools/GenCfgOpt.py
index a42717caae..2fa7582d85 100644
--- a/IntelFsp2Pkg/Tools/GenCfgOpt.py
+++ b/IntelFsp2Pkg/Tools/GenCfgOpt.py
@@ -715,7 +715,7 @@ EndList
                         if (ConfigDict['embed'].find(':END') != -1):
                             Remainder = Offset % (MaxAlign/8)   # MaxAlign is either 32 or 64
                             if Remainder:
-                                Diff = (MaxAlign/8) - Remainder
+                                Diff = int((MaxAlign/8) - Remainder)
                                 Offset = Offset + Diff
                                 ItemOffset = ItemOffset + Diff
                             MaxAlign = 32                       # Reset to default 32 align when struct end
@@ -727,7 +727,7 @@ EndList
                             Remainder = Offset % max(ItemLength/8, 4, SizeAlign)
                             Offset = Offset + ItemLength
                             if Remainder:
-                                Diff = max(ItemLength/8, 4, SizeAlign) - Remainder
+                                Diff = int(max(ItemLength/8, 4, SizeAlign) - Remainder)
                                 ItemOffset = ItemOffset + Diff
                         ConfigDict['offset'] = ItemOffset
 
@@ -1416,7 +1416,7 @@ EndList
                         if BitsRemain:
                             BsfFd.write("        Skip %d bits\n" % BitsRemain)
                             BitsGap -= BitsRemain
-                        BytesRemain = BitsGap / 8
+                        BytesRemain = int(BitsGap / 8)
                         if BytesRemain:
                             BsfFd.write("        Skip %d bytes\n" % BytesRemain)
                     NextOffset = Item['offset'] + Item['length']
-- 
2.21.0.windows.1


             reply	other threads:[~2019-08-01 10:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-01 10:07 Cheng, Ching JenX [this message]
2019-08-02  6:34 ` [PATCH v2] * IntelFsp2Pkg: Improve FSP Python scripts to support 3.x Chiu, Chasel
2019-08-02  6:59 ` Chiu, Chasel

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=20190801100702.11484-1-ching.jenx.cheng@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