public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] BaseTools: Fixed build failure for the case that A pcd is initialized under one SKU but is uninitialized under another SKU.
@ 2018-01-23  1:38 BobCF
  2018-01-25  9:54 ` Gao, Liming
  0 siblings, 1 reply; 2+ messages in thread
From: BobCF @ 2018-01-23  1:38 UTC (permalink / raw)
  To: edk2-devel; +Cc: Bob Feng, Liming Gao

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
 BaseTools/Source/Python/AutoGen/GenPcdDb.py | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
index 22283ef7fe..82360ae57d 100644
--- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py
+++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
@@ -1022,10 +1022,23 @@ def CreateAutoGen(PcdDriverAutoGenData):
     return (PcdDriverAutoGenData[(skuname,skuid)][0],autogenC)
 def NewCreatePcdDatabasePhaseSpecificAutoGen(Platform,Phase):
     def prune_sku(pcd,skuname):
         new_pcd = copy.deepcopy(pcd)
         new_pcd.SkuInfoList = {skuname:pcd.SkuInfoList[skuname]}
+        new_pcd.isinit = 'INIT'
+        if new_pcd.DatumType in ['UINT8','UINT16','UINT32','UINT64']:
+            for skuobj in pcd.SkuInfoList.values():
+                if skuobj.DefaultValue:
+                    defaultvalue = int(skuobj.DefaultValue,16) if skuobj.DefaultValue.upper().startswith("0X") else int(skuobj.DefaultValue,10)
+                    if defaultvalue  != 0:
+                        new_pcd.isinit = "INIT"
+                        break
+                elif skuobj.VariableName:
+                    new_pcd.isinit = "INIT"
+                    break
+            else:
+                new_pcd.isinit = "UNINIT"
         return new_pcd
     DynamicPcds = Platform.DynamicPcdList
     DynamicPcdSet_Sku = {(SkuName,skuobj.SkuId):[] for pcd in DynamicPcds for (SkuName,skuobj) in pcd.SkuInfoList.items() }
     for skuname,skuid in DynamicPcdSet_Sku:
         DynamicPcdSet_Sku[(skuname,skuid)] = [prune_sku(pcd,skuname) for pcd in DynamicPcds]
@@ -1399,12 +1412,11 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
                 if "PCD_TYPE_HII" not in Pcd.TokenTypeList:
                     Pcd.TokenTypeList += ['PCD_TYPE_DATA']
                     if Sku.DefaultValue == 'TRUE':
                         Pcd.InitString = 'INIT'
                     else:
-                        if int(Sku.DefaultValue, 0) != 0:
-                            Pcd.InitString = 'INIT'
+                        Pcd.InitString = Pcd.isinit
                 #
                 # For UNIT64 type PCD's value, ULL should be append to avoid
                 # warning under linux building environment.
                 #
                 if Pcd.DatumType == "UINT64":
-- 
2.14.3.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch] BaseTools: Fixed build failure for the case that A pcd is initialized under one SKU but is uninitialized under another SKU.
  2018-01-23  1:38 [Patch] BaseTools: Fixed build failure for the case that A pcd is initialized under one SKU but is uninitialized under another SKU BobCF
@ 2018-01-25  9:54 ` Gao, Liming
  0 siblings, 0 replies; 2+ messages in thread
From: Gao, Liming @ 2018-01-25  9:54 UTC (permalink / raw)
  To: Feng, Bob C, edk2-devel@lists.01.org

Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: Feng, Bob C
>Sent: Tuesday, January 23, 2018 9:39 AM
>To: edk2-devel@lists.01.org
>Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
>Subject: [Patch] BaseTools: Fixed build failure for the case that A pcd is
>initialized under one SKU but is uninitialized under another SKU.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Bob Feng <bob.c.feng@intel.com>
>Cc: Liming Gao <liming.gao@intel.com>
>---
> BaseTools/Source/Python/AutoGen/GenPcdDb.py | 16 ++++++++++++++--
> 1 file changed, 14 insertions(+), 2 deletions(-)
>
>diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py
>b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
>index 22283ef7fe..82360ae57d 100644
>--- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py
>+++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
>@@ -1022,10 +1022,23 @@ def CreateAutoGen(PcdDriverAutoGenData):
>     return (PcdDriverAutoGenData[(skuname,skuid)][0],autogenC)
> def NewCreatePcdDatabasePhaseSpecificAutoGen(Platform,Phase):
>     def prune_sku(pcd,skuname):
>         new_pcd = copy.deepcopy(pcd)
>         new_pcd.SkuInfoList = {skuname:pcd.SkuInfoList[skuname]}
>+        new_pcd.isinit = 'INIT'
>+        if new_pcd.DatumType in ['UINT8','UINT16','UINT32','UINT64']:
>+            for skuobj in pcd.SkuInfoList.values():
>+                if skuobj.DefaultValue:
>+                    defaultvalue = int(skuobj.DefaultValue,16) if
>skuobj.DefaultValue.upper().startswith("0X") else int(skuobj.DefaultValue,10)
>+                    if defaultvalue  != 0:
>+                        new_pcd.isinit = "INIT"
>+                        break
>+                elif skuobj.VariableName:
>+                    new_pcd.isinit = "INIT"
>+                    break
>+            else:
>+                new_pcd.isinit = "UNINIT"
>         return new_pcd
>     DynamicPcds = Platform.DynamicPcdList
>     DynamicPcdSet_Sku = {(SkuName,skuobj.SkuId):[] for pcd in DynamicPcds
>for (SkuName,skuobj) in pcd.SkuInfoList.items() }
>     for skuname,skuid in DynamicPcdSet_Sku:
>         DynamicPcdSet_Sku[(skuname,skuid)] = [prune_sku(pcd,skuname) for
>pcd in DynamicPcds]
>@@ -1399,12 +1412,11 @@ def CreatePcdDatabasePhaseSpecificAutoGen
>(Platform, DynamicPcdList, Phase):
>                 if "PCD_TYPE_HII" not in Pcd.TokenTypeList:
>                     Pcd.TokenTypeList += ['PCD_TYPE_DATA']
>                     if Sku.DefaultValue == 'TRUE':
>                         Pcd.InitString = 'INIT'
>                     else:
>-                        if int(Sku.DefaultValue, 0) != 0:
>-                            Pcd.InitString = 'INIT'
>+                        Pcd.InitString = Pcd.isinit
>                 #
>                 # For UNIT64 type PCD's value, ULL should be append to avoid
>                 # warning under linux building environment.
>                 #
>                 if Pcd.DatumType == "UINT64":
>--
>2.14.3.windows.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-25  9:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-23  1:38 [Patch] BaseTools: Fixed build failure for the case that A pcd is initialized under one SKU but is uninitialized under another SKU BobCF
2018-01-25  9:54 ` Gao, Liming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox