BaseTools/Build: Add all support skuid to the Pcd DB system skuid table
authorBob Feng <bob.c.feng@intel.com>
Fri, 10 Apr 2015 07:06:13 +0000 (07:06 +0000)
committerbobfeng <bobfeng@Edk2>
Fri, 10 Apr 2015 07:06:13 +0000 (07:06 +0000)
Update PcdDataBase System SkuIdTable. The system SkuId Table should have all the platform supported skuid.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Bob Feng" <bob.c.feng@intel.com>
Reviewed-by: "Chen, Hesheng" <hesheng.chen@intel.com>
Reviewed-by: "Liu, Yingke D" <yingke.d.liu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17159 6f19259b-4bc3-4df7-8a09-765794883524

BaseTools/Source/Python/AutoGen/GenPcdDb.py
BaseTools/Source/Python/Common/Misc.py
BaseTools/Source/Python/Workspace/WorkspaceDatabase.py

index 4ccd2d6..20f4a23 100644 (file)
@@ -1046,7 +1046,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, Phase):
     }\r
     \r
    \r
-    SkuObj = SkuClass(Platform.Platform.SkuName,Platform.Platform.SkuIds)\r
+    SkuObj = SkuClass(Platform.Platform.AvilableSkuIds, Platform.Platform.SkuIds)\r
     Dict['SYSTEM_SKU_ID_VALUE'] = Platform.Platform.SkuIds[SkuObj.SystemSkuId]\r
 \r
     Dict['PCD_INFO_FLAG'] = Platform.Platform.PcdInfoFlag\r
@@ -1592,6 +1592,9 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, Phase):
     if NumberOfSkuEnabledPcd != 0: \r
         Dict['SKU_HEAD_SIZE'] = str(NumberOfSkuEnabledPcd) + 'U'\r
     \r
+    for AvailableSkuNumber in SkuObj.SkuIdNumberSet:\r
+        if AvailableSkuNumber not in Dict['SKUID_VALUE']:\r
+            Dict['SKUID_VALUE'].append(AvailableSkuNumber)\r
     Dict['SKUID_VALUE'][0] = len(Dict['SKUID_VALUE']) - 1\r
     \r
     AutoGenH.Append(gPcdDatabaseAutoGenH.Replace(Dict))\r
index 79073e2..fc1680b 100644 (file)
@@ -1955,17 +1955,26 @@ class SkuClass():
         \r
         self.AvailableSkuIds = sdict()\r
         self.SkuIdSet = []\r
-        \r
+        self.SkuIdNumberSet = []\r
         if SkuIdentifier == '' or SkuIdentifier is None:\r
             self.SkuIdSet = ['DEFAULT']\r
+            self.SkuIdNumberSet = ['0U']\r
         elif SkuIdentifier == 'ALL':\r
             self.SkuIdSet = SkuIds.keys()\r
+            self.SkuIdNumberSet = [num.strip() + 'U' for num in SkuIds.values()]\r
         else:\r
             r = SkuIdentifier.split('|') \r
             self.SkuIdSet=[r[k].strip() for k in range(len(r))]      \r
+            k = None\r
+            try: \r
+                self.SkuIdNumberSet = [SkuIds[k].strip() + 'U' for k in self.SkuIdSet]   \r
+            except Exception:\r
+                EdkLogger.error("build", PARAMETER_INVALID,\r
+                            ExtraData = "SKU-ID [%s] is not supported by the platform. [Valid SKU-ID: %s]"\r
+                                      % (k, " ".join(SkuIds.keys())))\r
         if len(self.SkuIdSet) == 2 and 'DEFAULT' in self.SkuIdSet and SkuIdentifier != 'ALL':\r
             self.SkuIdSet.remove('DEFAULT')\r
-                \r
+            self.SkuIdNumberSet.remove('0U')\r
         for each in self.SkuIdSet:\r
             if each in SkuIds:\r
                 self.AvailableSkuIds[each] = SkuIds[each]\r
@@ -1992,11 +2001,12 @@ class SkuClass():
             return self.SkuIdSet[0]\r
         else:\r
             return 'DEFAULT'\r
-            \r
+    def __GetAvailableSkuIdNumber(self):\r
+        return self.SkuIdNumberSet\r
     SystemSkuId = property(__GetSystemSkuID)\r
     AvailableSkuIdSet = property(__GetAvailableSkuIds)\r
     SkuUsageType = property(__SkuUsageType)\r
-\r
+    AvailableSkuIdNumSet = property(__GetAvailableSkuIdNumber)\r
 ##\r
 #\r
 # This acts like the main() function for the script, unless it is 'import'ed into another\r
index 9f79f74..14cd22d 100644 (file)
@@ -132,6 +132,7 @@ class DscBuildData(PlatformBuildClassObject):
         self._BuildTargets      = None\r
         self._SkuName           = None\r
         self._SkuIdentifier     = None\r
+        self._AvilableSkuIds = None\r
         self._PcdInfoFlag       = None\r
         self._VarCheckFlag = None\r
         self._FlashDefinition   = None\r
@@ -232,6 +233,7 @@ class DscBuildData(PlatformBuildClassObject):
                 if self._SkuName == None:\r
                     self._SkuName = Record[2]\r
                 self._SkuIdentifier = Record[2]\r
+                self._AvilableSkuIds = Record[2]\r
             elif Name == TAB_DSC_DEFINES_PCD_INFO_GENERATION:\r
                 self._PcdInfoFlag = Record[2]\r
             elif Name == TAB_DSC_DEFINES_PCD_VAR_CHECK_GENERATION:\r
@@ -362,7 +364,10 @@ class DscBuildData(PlatformBuildClassObject):
             return True\r
         else:\r
             return False\r
-            \r
+    def _GetAviableSkuIds(self):\r
+        if self._AvilableSkuIds:\r
+            return self._AvilableSkuIds\r
+        return self.SkuIdentifier\r
     def _GetSkuIdentifier(self):\r
         if self._SkuName:\r
             return self._SkuName\r
@@ -1177,6 +1182,7 @@ class DscBuildData(PlatformBuildClassObject):
     BuildTargets        = property(_GetBuildTarget)\r
     SkuName             = property(_GetSkuName, _SetSkuName)\r
     SkuIdentifier       = property(_GetSkuIdentifier)\r
+    AvilableSkuIds = property(_GetAviableSkuIds)\r
     PcdInfoFlag         = property(_GetPcdInfoFlag)\r
     VarCheckFlag = property(_GetVarCheckFlag)\r
     FlashDefinition     = property(_GetFdfFile)\r