## @file\r
# Patch value into the binary file.\r
#\r
-# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
import Common.EdkLogger as EdkLogger\r
from Common.BuildVersion import gBUILD_VERSION\r
import array\r
+from Common.DataType import *\r
\r
# Version and Copyright\r
__version_number__ = ("0.10" + " " + gBUILD_VERSION)\r
ValueLength = 0\r
if TypeName == 'BOOLEAN':\r
ValueLength = 1\r
- elif TypeName == 'UINT8':\r
+ elif TypeName == TAB_UINT8:\r
ValueLength = 1\r
- elif TypeName == 'UINT16':\r
+ elif TypeName == TAB_UINT16:\r
ValueLength = 2\r
- elif TypeName == 'UINT32':\r
+ elif TypeName == TAB_UINT32:\r
ValueLength = 4\r
- elif TypeName == 'UINT64':\r
+ elif TypeName == TAB_UINT64:\r
ValueLength = 8\r
- elif TypeName == 'VOID*':\r
+ elif TypeName == TAB_VOID:\r
if MaxSize == 0:\r
return OPTION_MISSING, "PcdMaxSize is not specified for VOID* type PCD."\r
ValueLength = int(MaxSize)\r
# Set PCD value into binary data\r
#\r
ByteList[ValueOffset] = ValueNumber\r
- elif TypeName in ['UINT8', 'UINT16', 'UINT32', 'UINT64']:\r
+ elif TypeName in TAB_PCD_CLEAN_NUMERIC_TYPES:\r
#\r
# Get PCD value for UINT* data type\r
#\r
for Index in range(ValueLength):\r
ByteList[ValueOffset + Index] = ValueNumber % 0x100\r
ValueNumber = ValueNumber / 0x100\r
- elif TypeName == 'VOID*':\r
+ elif TypeName == TAB_VOID:\r
ValueString = SavedStr\r
if ValueString.startswith('L"'):\r
#\r
if CommandOptions.PcdOffset is None or CommandOptions.PcdValue is None or CommandOptions.PcdTypeName is None:\r
EdkLogger.error("PatchPcdValue", OPTION_MISSING, ExtraData="PcdOffset or PcdValue of PcdTypeName is not specified.")\r
return 1\r
- if CommandOptions.PcdTypeName.upper() not in ["BOOLEAN", "UINT8", "UINT16", "UINT32", "UINT64", "VOID*"]:\r
+ if CommandOptions.PcdTypeName.upper() not in TAB_PCD_NUMERIC_TYPES_VOID:\r
EdkLogger.error("PatchPcdValue", PARAMETER_INVALID, ExtraData="PCD type %s is not valid." % (CommandOptions.PcdTypeName))\r
return 1\r
- if CommandOptions.PcdTypeName.upper() == "VOID*" and CommandOptions.PcdMaxSize is None:\r
+ if CommandOptions.PcdTypeName.upper() == TAB_VOID and CommandOptions.PcdMaxSize is None:\r
EdkLogger.error("PatchPcdValue", OPTION_MISSING, ExtraData="PcdMaxSize is not specified for VOID* type PCD.")\r
return 1\r
#\r