public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] BaseTools: Fix a bug for Size incorrect of Void* Fixatbuild Pcd
@ 2018-03-23  5:57 Yonghong Zhu
  2018-04-09  5:44 ` Gao, Liming
  0 siblings, 1 reply; 2+ messages in thread
From: Yonghong Zhu @ 2018-03-23  5:57 UTC (permalink / raw)
  To: edk2-devel

when driver link library and there have pcd override in DSC component
section, in the library autogen file, the pcd's size is incorrect, the
size value is from DSC [pcd] section, but not from the override pcd
value that in the [component] section.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 4 ++--
 BaseTools/Source/Python/AutoGen/GenC.py    | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 439e360..8682217 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1281,11 +1281,11 @@ class PlatformAutoGen(AutoGen):
     def CollectFixedAtBuildPcds(self):
         for LibAuto in self.LibraryAutoGenList:
             FixedAtBuildPcds = {}  
             ShareFixedAtBuildPcdsSameValue = {} 
             for Module in LibAuto._ReferenceModules:                
-                for Pcd in Module.FixedAtBuildPcds + LibAuto.FixedAtBuildPcds:
+                for Pcd in Module.FixedAtBuildPcds:
                     key = ".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName))  
                     if key not in FixedAtBuildPcds:
                         ShareFixedAtBuildPcdsSameValue[key] = True
                         FixedAtBuildPcds[key] = Pcd.DefaultValue
                     else:
@@ -1298,11 +1298,11 @@ class PlatformAutoGen(AutoGen):
                 else:
                     DscPcd = self.NonDynamicPcdDict[(Pcd.TokenCName,Pcd.TokenSpaceGuidCName)]
                     if DscPcd.Type != "FixedAtBuild":
                         continue
                 if key in ShareFixedAtBuildPcdsSameValue and ShareFixedAtBuildPcdsSameValue[key]:                    
-                    LibAuto.ConstPcd[key] = Pcd.DefaultValue
+                    LibAuto.ConstPcd[key] = FixedAtBuildPcds[key]
 
     def CollectVariables(self, DynamicPcdSet):
 
         VpdRegionSize = 0
         VpdRegionBase = 0
diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py
index fbf892f..0509a9f 100644
--- a/BaseTools/Source/Python/AutoGen/GenC.py
+++ b/BaseTools/Source/Python/AutoGen/GenC.py
@@ -1354,10 +1354,12 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
         AutoGenH.Append('//#define %s  ASSERT(FALSE)  // It is not allowed to set value for a FIXED_AT_BUILD PCD\n' % SetModeName)
         
         ConstFixedPcd = False
         if PcdItemType == TAB_PCDS_FIXED_AT_BUILD and (key in Info.ConstPcd or (Info.IsLibrary and not Info._ReferenceModules)):
             ConstFixedPcd = True
+            if key in Info.ConstPcd:
+                Pcd.DefaultValue = Info.ConstPcd[key]
             if Pcd.DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLEAN']:
                 AutoGenH.Append('#define _PCD_VALUE_%s %s%s\n' %(TokenCName, Type, PcdVariableName))
             else:
                 AutoGenH.Append('#define _PCD_VALUE_%s %s\n' %(TokenCName, Pcd.DefaultValue))
         PcdDataSize = GetPcdSize(Pcd)
-- 
2.6.1.windows.1



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

* Re: [Patch] BaseTools: Fix a bug for Size incorrect of Void* Fixatbuild Pcd
  2018-03-23  5:57 [Patch] BaseTools: Fix a bug for Size incorrect of Void* Fixatbuild Pcd Yonghong Zhu
@ 2018-04-09  5:44 ` Gao, Liming
  0 siblings, 0 replies; 2+ messages in thread
From: Gao, Liming @ 2018-04-09  5:44 UTC (permalink / raw)
  To: Zhu, Yonghong, edk2-devel@lists.01.org

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

>-----Original Message-----
>From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>Yonghong Zhu
>Sent: Friday, March 23, 2018 1:58 PM
>To: edk2-devel@lists.01.org
>Subject: [edk2] [Patch] BaseTools: Fix a bug for Size incorrect of Void*
>Fixatbuild Pcd
>
>when driver link library and there have pcd override in DSC component
>section, in the library autogen file, the pcd's size is incorrect, the
>size value is from DSC [pcd] section, but not from the override pcd
>value that in the [component] section.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
>---
> BaseTools/Source/Python/AutoGen/AutoGen.py | 4 ++--
> BaseTools/Source/Python/AutoGen/GenC.py    | 2 ++
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
>diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
>b/BaseTools/Source/Python/AutoGen/AutoGen.py
>index 439e360..8682217 100644
>--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
>+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
>@@ -1281,11 +1281,11 @@ class PlatformAutoGen(AutoGen):
>     def CollectFixedAtBuildPcds(self):
>         for LibAuto in self.LibraryAutoGenList:
>             FixedAtBuildPcds = {}
>             ShareFixedAtBuildPcdsSameValue = {}
>             for Module in LibAuto._ReferenceModules:
>-                for Pcd in Module.FixedAtBuildPcds + LibAuto.FixedAtBuildPcds:
>+                for Pcd in Module.FixedAtBuildPcds:
>                     key = ".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName))
>                     if key not in FixedAtBuildPcds:
>                         ShareFixedAtBuildPcdsSameValue[key] = True
>                         FixedAtBuildPcds[key] = Pcd.DefaultValue
>                     else:
>@@ -1298,11 +1298,11 @@ class PlatformAutoGen(AutoGen):
>                 else:
>                     DscPcd =
>self.NonDynamicPcdDict[(Pcd.TokenCName,Pcd.TokenSpaceGuidCName)]
>                     if DscPcd.Type != "FixedAtBuild":
>                         continue
>                 if key in ShareFixedAtBuildPcdsSameValue and
>ShareFixedAtBuildPcdsSameValue[key]:
>-                    LibAuto.ConstPcd[key] = Pcd.DefaultValue
>+                    LibAuto.ConstPcd[key] = FixedAtBuildPcds[key]
>
>     def CollectVariables(self, DynamicPcdSet):
>
>         VpdRegionSize = 0
>         VpdRegionBase = 0
>diff --git a/BaseTools/Source/Python/AutoGen/GenC.py
>b/BaseTools/Source/Python/AutoGen/GenC.py
>index fbf892f..0509a9f 100644
>--- a/BaseTools/Source/Python/AutoGen/GenC.py
>+++ b/BaseTools/Source/Python/AutoGen/GenC.py
>@@ -1354,10 +1354,12 @@ def CreateLibraryPcdCode(Info, AutoGenC,
>AutoGenH, Pcd):
>         AutoGenH.Append('//#define %s  ASSERT(FALSE)  // It is not allowed to
>set value for a FIXED_AT_BUILD PCD\n' % SetModeName)
>
>         ConstFixedPcd = False
>         if PcdItemType == TAB_PCDS_FIXED_AT_BUILD and (key in Info.ConstPcd
>or (Info.IsLibrary and not Info._ReferenceModules)):
>             ConstFixedPcd = True
>+            if key in Info.ConstPcd:
>+                Pcd.DefaultValue = Info.ConstPcd[key]
>             if Pcd.DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64',
>'BOOLEAN']:
>                 AutoGenH.Append('#define
>_PCD_VALUE_%s %s%s\n' %(TokenCName, Type, PcdVariableName))
>             else:
>                 AutoGenH.Append('#define _PCD_VALUE_%s %s\n' %(TokenCName,
>Pcd.DefaultValue))
>         PcdDataSize = GetPcdSize(Pcd)
>--
>2.6.1.windows.1
>
>_______________________________________________
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel


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

end of thread, other threads:[~2018-04-09  5:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-23  5:57 [Patch] BaseTools: Fix a bug for Size incorrect of Void* Fixatbuild Pcd Yonghong Zhu
2018-04-09  5:44 ` Gao, Liming

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