summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Workspace/DscBuildData.py
diff options
context:
space:
mode:
authorCarsey, Jaben <jaben.carsey@intel.com>2018-04-12 07:08:08 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-04-18 22:15:36 +0800
commit25598f8bdbd63dd96194fd3f43dd53dd814cd1c0 (patch)
treeb21acd2cafb9bbde506daa9d1a1d7ea6addcddaf /BaseTools/Source/Python/Workspace/DscBuildData.py
parent9eb87141eca12b1f15afa4b769af04d1395891c6 (diff)
downloadedk2-25598f8bdbd63dd96194fd3f43dd53dd814cd1c0.tar.gz
edk2-25598f8bdbd63dd96194fd3f43dd53dd814cd1c0.tar.bz2
edk2-25598f8bdbd63dd96194fd3f43dd53dd814cd1c0.zip
BaseTools: merge towards minimum PCD MAX <something> methods
we have 5 different max val or max byte for PCDs. refactor and remove 2 methods. we need 3, as one computes for VOID* PCDs. Cc: Bob Feng <bob.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/Workspace/DscBuildData.py')
-rw-r--r--BaseTools/Source/Python/Workspace/DscBuildData.py30
1 files changed, 12 insertions, 18 deletions
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 1ca8109b48..d6b8b761d6 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1542,25 +1542,19 @@ class DscBuildData(PlatformBuildClassObject):
@staticmethod
def GetPcdMaxSize(Pcd):
+ if Pcd.DatumType in TAB_PCD_NUMERIC_TYPES:
+ return MAX_SIZE_TYPE[Pcd.DatumType]
+
MaxSize = int(Pcd.MaxDatumSize,10) if Pcd.MaxDatumSize else 0
- if Pcd.DatumType not in ['BOOLEAN','UINT8','UINT16','UINT32','UINT64']:
- if Pcd.PcdValueFromComm:
- if Pcd.PcdValueFromComm.startswith("{") and Pcd.PcdValueFromComm.endswith("}"):
- MaxSize = max([len(Pcd.PcdValueFromComm.split(",")),MaxSize])
- elif Pcd.PcdValueFromComm.startswith("\"") or Pcd.PcdValueFromComm.startswith("\'"):
- MaxSize = max([len(Pcd.PcdValueFromComm)-2+1,MaxSize])
- elif Pcd.PcdValueFromComm.startswith("L\""):
- MaxSize = max([2*(len(Pcd.PcdValueFromComm)-3+1),MaxSize])
- else:
- MaxSize = max([len(Pcd.PcdValueFromComm),MaxSize])
- elif Pcd.DatumType not in ['BOOLEAN','UINT8']:
- MaxSize = 1
- elif Pcd.DatumType == 'UINT16':
- MaxSize = 2
- elif Pcd.DatumType == 'UINT32':
- MaxSize = 4
- elif Pcd.DatumType == 'UINT64':
- MaxSize = 8
+ if Pcd.PcdValueFromComm:
+ if Pcd.PcdValueFromComm.startswith("{") and Pcd.PcdValueFromComm.endswith("}"):
+ return max([len(Pcd.PcdValueFromComm.split(",")),MaxSize])
+ elif Pcd.PcdValueFromComm.startswith("\"") or Pcd.PcdValueFromComm.startswith("\'"):
+ return max([len(Pcd.PcdValueFromComm)-2+1,MaxSize])
+ elif Pcd.PcdValueFromComm.startswith("L\""):
+ return max([2*(len(Pcd.PcdValueFromComm)-3+1),MaxSize])
+ else:
+ return max([len(Pcd.PcdValueFromComm),MaxSize])
return MaxSize
def GenerateSizeFunction(self,Pcd):