[edk2] [Patch] BaseTools: Fixed incorrect VPD size.

BobCF posted 1 patch 6 years, 11 months ago
Failed in applying to current master (apply log)
BaseTools/Source/Python/AutoGen/AutoGen.py | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
[edk2] [Patch] BaseTools: Fixed incorrect VPD size.
Posted by BobCF 6 years, 11 months ago
The VPD size is incorrect if that VPD is not used in Module.

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

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index ce8bc64ca5..848378f3d4 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1744,18 +1744,16 @@ class PlatformAutoGen(AutoGen):
 
                         # Not found, it should be signature
                         if not FoundFlag :
                             # just pick the a value to determine whether is unicode string type
                             SkuValueMap = {}
+                            SkuObjList = DscPcdEntry.SkuInfoList.items()
                             DefaultSku = DscPcdEntry.SkuInfoList.get('DEFAULT')
                             if DefaultSku:
-                                PcdValue = DefaultSku.DefaultValue
-                                if PcdValue not in SkuValueMap:
-                                    SkuValueMap[PcdValue] = []
-                                    VpdFile.Add(DscPcdEntry, 'DEFAULT',DefaultSku.VpdOffset)
-                                SkuValueMap[PcdValue].append(DefaultSku)
-                            for (SkuName,Sku) in DscPcdEntry.SkuInfoList.items():
+                                defaultindex = SkuObjList.index(('DEFAULT',DefaultSku))
+                                SkuObjList[0],SkuObjList[defaultindex] = SkuObjList[defaultindex],SkuObjList[0]
+                            for (SkuName,Sku) in SkuObjList:
                                 Sku.VpdOffset = Sku.VpdOffset.strip() 
                                 
                                 # Need to iterate DEC pcd information to get the value & datumtype
                                 for eachDec in self.PackageList:
                                     for DecPcd in eachDec.Pcds:
-- 
2.14.3.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] BaseTools: Fixed incorrect VPD size.
Posted by Gao, Liming 6 years, 11 months ago
Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>BobCF
>Sent: Tuesday, January 23, 2018 4:01 PM
>To: edk2-devel@lists.01.org
>Subject: [edk2] [Patch] BaseTools: Fixed incorrect VPD size.
>
>The VPD size is incorrect if that VPD is not used in Module.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Feng Bob C <bob.c.feng@intel.com>
>Reviewed-by: Liming Gao <liming.gao@intel.com>
>---
> BaseTools/Source/Python/AutoGen/AutoGen.py | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
>diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
>b/BaseTools/Source/Python/AutoGen/AutoGen.py
>index ce8bc64ca5..848378f3d4 100644
>--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
>+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
>@@ -1744,18 +1744,16 @@ class PlatformAutoGen(AutoGen):
>
>                         # Not found, it should be signature
>                         if not FoundFlag :
>                             # just pick the a value to determine whether is unicode string
>type
>                             SkuValueMap = {}
>+                            SkuObjList = DscPcdEntry.SkuInfoList.items()
>                             DefaultSku = DscPcdEntry.SkuInfoList.get('DEFAULT')
>                             if DefaultSku:
>-                                PcdValue = DefaultSku.DefaultValue
>-                                if PcdValue not in SkuValueMap:
>-                                    SkuValueMap[PcdValue] = []
>-                                    VpdFile.Add(DscPcdEntry, 'DEFAULT',DefaultSku.VpdOffset)
>-                                SkuValueMap[PcdValue].append(DefaultSku)
>-                            for (SkuName,Sku) in DscPcdEntry.SkuInfoList.items():
>+                                defaultindex = SkuObjList.index(('DEFAULT',DefaultSku))
>+                                SkuObjList[0],SkuObjList[defaultindex] =
>SkuObjList[defaultindex],SkuObjList[0]
>+                            for (SkuName,Sku) in SkuObjList:
>                                 Sku.VpdOffset = Sku.VpdOffset.strip()
>
>                                 # Need to iterate DEC pcd information to get the value &
>datumtype
>                                 for eachDec in self.PackageList:
>                                     for DecPcd in eachDec.Pcds:
>--
>2.14.3.windows.1
>
>_______________________________________________
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel