summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Common/VariableAttributes.py
diff options
context:
space:
mode:
authorBob Feng <bob.c.feng@intel.com>2015-04-10 06:59:47 +0000
committerbobfeng <bobfeng@Edk2>2015-04-10 06:59:47 +0000
commit82a6a9605c35f814bd6187979980258ed1b75abd (patch)
tree05d5b1bf15a51c30754bcf288da9fd7421c0f0be /BaseTools/Source/Python/Common/VariableAttributes.py
parentb7668ccee92a7f5d0aaadfc94787e200b2cc1240 (diff)
downloadedk2-82a6a9605c35f814bd6187979980258ed1b75abd.tar.gz
edk2-82a6a9605c35f814bd6187979980258ed1b75abd.tar.bz2
edk2-82a6a9605c35f814bd6187979980258ed1b75abd.zip
BaseTools/Build: Add SDL support
1.BaseTool add ATTRIBUTE (+/-RT, RO) support in PCD declaration in DSC file 2.BaseTool collect valid PCD value in DEC file and generate data base for runtime sanity check 3.BaseTool support SetPcd error. 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@17158 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/Common/VariableAttributes.py')
-rw-r--r--BaseTools/Source/Python/Common/VariableAttributes.py57
1 files changed, 57 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/Common/VariableAttributes.py b/BaseTools/Source/Python/Common/VariableAttributes.py
new file mode 100644
index 0000000000..a2e22ca040
--- /dev/null
+++ b/BaseTools/Source/Python/Common/VariableAttributes.py
@@ -0,0 +1,57 @@
+# # @file
+#
+# This file is used to handle the variable attributes and property information
+#
+#
+# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+
+class VariableAttributes(object):
+ EFI_VARIABLE_NON_VOLATILE = 0x00000001
+ EFI_VARIABLE_BOOTSERVICE_ACCESS = 0x00000002
+ EFI_VARIABLE_RUNTIME_ACCESS = 0x00000004
+ VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY = 0x00000001
+ VarAttributesMap = {
+ "NV":EFI_VARIABLE_NON_VOLATILE,
+ "BS":EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ "RT":EFI_VARIABLE_RUNTIME_ACCESS,
+ "RO":VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY
+ }
+
+ def __init__(self):
+ pass
+
+ @staticmethod
+ def GetVarAttributes(var_attr_str):
+ VarAttr = 0x00000000
+ VarProp = 0x00000000
+
+ attr_list = var_attr_str.split(",")
+ for attr in attr_list:
+ attr = attr.strip()
+ if attr == 'RO':
+ VarProp = VariableAttributes.VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY
+ else:
+ VarAttr = VarAttr | VariableAttributes.VarAttributesMap.get(attr, 0x00000000)
+ return VarAttr, VarProp
+ @staticmethod
+ def ValidateVarAttributes(var_attr_str):
+ if not var_attr_str:
+ return True, ""
+ attr_list = var_attr_str.split(",")
+ attr_temp = []
+ for attr in attr_list:
+ attr = attr.strip()
+ attr_temp.append(attr)
+ if attr not in VariableAttributes.VarAttributesMap:
+ return False, "The variable attribute %s is not support to be specified in dsc file. Supported variable attribute are ['BS','NV','RT','RO'] "
+ if 'RT' in attr_temp and 'BS' not in attr_temp:
+ return False, "the RT attribute need the BS attribute to be present"
+ return True, ""