* [PATCH v2] * IntelFsp2Pkg: Improve FSP Python scripts to support 3.x.
@ 2019-08-01 10:07 Cheng, Ching JenX
2019-08-02 6:34 ` Chiu, Chasel
2019-08-02 6:59 ` Chiu, Chasel
0 siblings, 2 replies; 3+ messages in thread
From: Cheng, Ching JenX @ 2019-08-01 10:07 UTC (permalink / raw)
To: devel; +Cc: Amy Chan, Chasel Chiu, Nate DeSimone, Star Zeng
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] * IntelFsp2Pkg: Improve FSP Python scripts to support 3.x.
2019-08-01 10:07 [PATCH v2] * IntelFsp2Pkg: Improve FSP Python scripts to support 3.x Cheng, Ching JenX
@ 2019-08-02 6:34 ` Chiu, Chasel
2019-08-02 6:59 ` Chiu, Chasel
1 sibling, 0 replies; 3+ messages in thread
From: Chiu, Chasel @ 2019-08-02 6:34 UTC (permalink / raw)
To: Cheng, Ching JenX, devel@edk2.groups.io
Cc: Chan, Amy, Desimone, Nathaniel L, Zeng, Star
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
> -----Original Message-----
> From: Cheng, Ching JenX
> Sent: Thursday, August 1, 2019 6:07 PM
> To: devel@edk2.groups.io
> Cc: Chan, Amy <amy.chan@intel.com>; Chiu, Chasel <chasel.chiu@intel.com>;
> Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Zeng, Star
> <star.zeng@intel.com>
> Subject: [PATCH v2] * IntelFsp2Pkg: Improve FSP Python scripts to support 3.x.
>
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] * IntelFsp2Pkg: Improve FSP Python scripts to support 3.x.
2019-08-01 10:07 [PATCH v2] * IntelFsp2Pkg: Improve FSP Python scripts to support 3.x Cheng, Ching JenX
2019-08-02 6:34 ` Chiu, Chasel
@ 2019-08-02 6:59 ` Chiu, Chasel
1 sibling, 0 replies; 3+ messages in thread
From: Chiu, Chasel @ 2019-08-02 6:59 UTC (permalink / raw)
To: Cheng, Ching JenX, devel@edk2.groups.io
Cc: Chan, Amy, Desimone, Nathaniel L, Zeng, Star
Patch submitted: 5e4ebd9ea5d72c1a2824d23a5dc92c7b50694719
Thanks!
Chasel
> -----Original Message-----
> From: Cheng, Ching JenX
> Sent: Thursday, August 1, 2019 6:07 PM
> To: devel@edk2.groups.io
> Cc: Chan, Amy <amy.chan@intel.com>; Chiu, Chasel <chasel.chiu@intel.com>;
> Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Zeng, Star
> <star.zeng@intel.com>
> Subject: [PATCH v2] * IntelFsp2Pkg: Improve FSP Python scripts to support 3.x.
>
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-08-02 6:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-01 10:07 [PATCH v2] * IntelFsp2Pkg: Improve FSP Python scripts to support 3.x Cheng, Ching JenX
2019-08-02 6:34 ` Chiu, Chasel
2019-08-02 6:59 ` Chiu, Chasel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox