blob: 7917f45c6e403325a979cae54411d12682a30d24 [file] [log] [blame]
Sridevi Ramesh70e14182019-08-27 04:04:27 -05001#!/usr/bin/python
2
3r"""
4Contains PLDM-related constants.
5"""
6
Sridevi Ramesh92041a32020-04-22 02:29:31 -05007PLDM_SUPPORTED_TYPES = ['base', 'platform', 'bios', 'fru', 'oem-ibm']
Rahul Maheshwari4d488572019-12-10 23:53:05 -06008
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -06009# PLDM types.
10PLDM_TYPE_BASE = {'VALUE': '00', 'STRING': 'base'}
11PLDM_TYPE_PLATFORM = {'VALUE': '02', 'STRING': 'platform'}
12PLDM_TYPE_BIOS = {'VALUE': '03', 'STRING': 'bios'}
13PLDM_TYPE_FRU = {'VALUE': '04', 'STRING': 'fru'}
Sridevi Ramesh92041a32020-04-22 02:29:31 -050014PLDM_TYPE_OEM = {'VALUE': '63', 'STRING': 'oem-ibm'}
Sridevi Ramesh961050b2020-11-12 11:04:30 -060015PLDM_SUPPORTED_TYPES = ['0(base)', '2(platform)', '3(bios)', '4(fru)', '63(oem-ibm)']
Sridevi Ramesh70e14182019-08-27 04:04:27 -050016
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060017VERSION_BASE = {'VALUE': ['f1', 'f0', 'f0', '00'], 'STRING': '1.0.0'}
Sridevi Rameshec753aa2020-02-17 22:55:13 -060018VERSION_PLATFORM = {'VALUE': ['f1', 'f2', 'f0', '00'], 'STRING': '1.2.0'}
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060019VERSION_BIOS = {'VALUE': ['f1', 'f1', 'f1', '00'], 'STRING': '1.0.0'}
20VERSION_FRU = {'VALUE': ['f1', 'f0', 'f0', '00'], 'STRING': '1.0.0'}
Sridevi Ramesh92041a32020-04-22 02:29:31 -050021VERSION_OEM = {'VALUE': ['f1', 'f0', 'f0', '00'], 'STRING': '1.0.0'}
Sridevi Ramesh70e14182019-08-27 04:04:27 -050022
Sridevi Ramesh70e14182019-08-27 04:04:27 -050023
Sridevi Ramesh039bc762020-03-30 09:59:07 -050024PLDM_BASE_CMDS = ['2(GetTID)', '3(GetPLDMVersion)', '4(GetPLDMTypes)', '5(GetPLDMCommands)']
25PLDM_PLATFORM_CMDS = ['57(SetStateEffecterStates)', '81(GetPDR)']
26PLDM_BIOS_CMDS = ['1(GetBIOSTable)', '7(SetBIOSAttributeCurrentValue)',
27 '8(GetBIOSAttributeCurrentValueByHandle)', '12(GetDateTime)',
28 '13(SetDateTime)']
Sridevi Ramesh3ca4f642020-07-14 01:15:30 -050029PLDM_FRU_CMDS = ['1(GetFRURecordTableMetadata)', '2(GetFRURecordTable)', '4(GetFRURecordByOption)']
Sridevi Ramesh92041a32020-04-22 02:29:31 -050030PLDM_OEM_CMDS = ['1(GetFileTable)', '4(ReadFile)', '5(WriteFile)', '6(ReadFileInToMemory)',
31 '7(WriteFileFromMemory)', '8(ReadFileByTypeIntoMemory)',
32 '9(WriteFileByTypeFromMemory)', '10(NewFileAvailable)',
33 '11(ReadFileByType)', '12(WriteFileByType)', '13(FileAck)',
34 '240(GetAlertStatus)']
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060035
36# PLDM command format.
37
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060038'''
39e.g. : GetPLDMVersion usage
40
41pldmtool base GetPLDMVersion -t <pldm_type>
42
43pldm supported types
44
45base->0,platform->2,bios->3,fru->4
46
47'''
Rahul Maheshwari4d488572019-12-10 23:53:05 -060048CMD_GETPLDMVERSION = 'base GetPLDMVersion -t %s'
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060049
50'''
51e.g. : PLDM raw command usage
52
53pldmtool raw -d 0x80 0x00 0x03 0x00 0x00 0x00 0x00 0x01 0x00
54
55pldm raw -d 0x<header> 0x<pldm_type> 0x<pldm_cmd_type> 0x<payload_data>
56'''
57
Rahul Maheshwari4d488572019-12-10 23:53:05 -060058CMD_PLDMTOOL_RAW = 'raw -d 0x80' + '0x%s' + ' ' + '0x%s'
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060059
60
61# PLDM command payload data.
62
63PAYLOAD_GetPLDMVersion = \
64 ' 0x00 0x00 0x00 0x00 0x%s 0x%s' # %(TransferOperationFlag, PLDMType)
Rahul Maheshwari4d488572019-12-10 23:53:05 -060065
66
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060067'''
68e.g. : SetDateTime usage
69
70pldmtool bios SetDateTime -d <YYYYMMDDHHMMSS>
71
72'''
73CMD_SETDATETIME = 'bios SetDateTime -d %s'
Sridevi Rameshfe52e402020-02-05 00:15:24 -060074
75
76CMD_GETPDR = 'platform GetPDR -d %s'
77
78'''
79e.g. : SetStateEffecterStates usage
80
Sridevi Rameshca3223a2020-03-11 03:58:58 -050081pldmtool platform GetPDR -i <effter_handle> -c <count> -d <effecterID, effecterState>
Sridevi Rameshfe52e402020-02-05 00:15:24 -060082
Sridevi Rameshca3223a2020-03-11 03:58:58 -050083pldmtool platform SetStateEffecterStates -i 1 -c 1 -d 1 1
Sridevi Rameshfe52e402020-02-05 00:15:24 -060084'''
85
Sridevi Rameshca3223a2020-03-11 03:58:58 -050086CMD_SETSTATEEFFECTERSTATES = 'platform SetStateEffecterStates -i %s -c %s -d %s'
Sridevi Rameshfe52e402020-02-05 00:15:24 -060087
88# GetPDR parsed response message for record handle.
89# Dictionary value array holds the expected output for record handle 1, 2.
Sridevi Rameshfe52e402020-02-05 00:15:24 -060090#
91# Note :
92# Record handle - 0 is default & has same behaviour as record handle 1
93# Only record handle 0, 1, 2 are supported as of now.
94
Sridevi Ramesh538d18d2020-03-30 11:45:42 -050095RESPONSE_DICT_GETPDR_SETSTATEEFFECTER = {
Sridevi Ramesh961050b2020-11-12 11:04:30 -060096 'PDRHeaderVersion': [1],
97 'PDRType': ['State Effecter PDR'],
98 'recordChangeNumber': [0],
99 'PLDMTerminusHandle': [0, 1, 2],
100 'effecterID': [0, 1, 2, 3, 4],
101 'entityType': ['Virtual Machine Manager', 'System chassis (main enclosure)',
102 'System Firmware', 'Processor Module', '32801(OEM)'],
Sridevi Ramesh297d41b2021-02-02 09:16:55 -0600103 'entityInstanceNumber': [0, 1, 2],
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600104 'containerID': [0, 1],
105 'effecterSemanticID': [0],
106 'effecterInit': ['noInit'],
107 'effecterDescriptionPDR': [False],
Sridevi Ramesh297d41b2021-02-02 09:16:55 -0600108 'compositeEffecterCount': [1]}
Sridevi Rameshfe52e402020-02-05 00:15:24 -0600109
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500110RESPONSE_DICT_GETPDR_FRURECORDSETIDENTIFIER = {
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600111 'PDRHeaderVersion': [1],
112 'PDRType': ['FRU Record Set PDR'],
113 'recordChangeNumber': [0],
114 'dataLength': [10],
115 'PLDMTerminusHandle': [0, 2],
116 'entityType': ['System Board', 'Chassis front panel board (control panel)',
Sridevi Ramesh072d5af2020-06-02 09:20:57 -0500117 'Management Controller', 'OEM', 'Power converter',
Sridevi Ramesh88f21722020-04-16 05:54:02 -0500118 'System (logical)', 'System chassis (main enclosure)',
Sridevi Rameshde91ec22020-05-14 05:02:03 -0500119 'Chassis front panel board (control panel)',
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600120 'Processor Module', 'Memory Module', 'Power Supply',
Sridevi Ramesh420a3e22021-01-13 00:12:18 -0600121 '24576(OEM)', '60(OEM)', 'Processor', '142(OEM)'],
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600122 'containerID': [0, 1, 2, 3]}
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500123
124RESPONSE_DICT_GETPDR_PDRENTITYASSOCIATION = {
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600125 'PDRHeaderVersion': [1],
126 'PDRType': ['Entity Association PDR'],
127 'recordChangeNumber': [0],
128 'containerID': [1, 2, 3],
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500129 'associationtype': ['Physical'],
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600130 'containerentityType': ['System Board', 'System (logical)',
131 'System chassis (main enclosure)']}
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500132
Sridevi Rameshdfc7fcb2020-07-23 03:03:57 -0500133RESPONSE_DICT_GETPDR_STATESENSORPDR = {
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600134 'entityType': ['Communication Channel', 'Connector', 'Processor Module',
135 '32774(OEM)', '57346(OEM)', '57347(OEM)', '32801(OEM)'],
136 'sensorInit': ['noInit'],
Sridevi Ramesh297d41b2021-02-02 09:16:55 -0600137 'sensorAuxiliaryNamesPDR': [False]}
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600138
139RESPONSE_DICT_GETPDR_TERMINUSLOCATORPDR = {
140 'PDRHeaderVersion': [1],
141 'PDRType': ['Terminus Locator PDR'],
142 'recordChangeNumber': [0],
143 'PLDMTerminusHandle': [1],
144 'validity': ['valid'],
145 'TID': [1, 208],
146 'containerID': [0, 1],
147 'terminusLocatorType': ['MCTP_EID'],
148 'terminusLocatorValueSize': [1]}
149
150RESPONSE_DICT_GETPDR_NUMERICEFFECTERPDR = {
151 'PDRHeaderVersion': [1],
152 'PDRType': ['Numeric Effecter PDR'],
153 'recordChangeNumber': [0],
154 'PLDMTerminusHandle': [0, 1],
155 'entityInstanceNumber': [0, 1],
156 'containerID': [0],
157 'effecterSemanticID': [0],
158 'effecterInit': [0],
159 'effecterAuxiliaryNames': [False],
160 'baseUnit': [0, 72],
161 'unitModifier': [0],
162 'rateUnit': [0],
163 'baseOEMUnitHandle': [0],
164 'auxUnit': [0],
165 'auxUnitModifier': [0],
166 'auxrateUnit': [0],
167 'auxOEMUnitHandle': [0],
168 'resolution': [1, 0],
169 'offset': [0],
170 'accuracy': [0],
171 'plusTolerance': [0],
172 'minusTolerance': [0],
173 'stateTransitionInterval': [0],
174 'TransitionInterval': [0],
175 'minSettable': [0],
176 'rangeFieldSupport': [0],
177 'nominalValue': [0],
178 'normalMax': [0],
179 'normalMin': [0],
180 'ratedMax': [0],
181 'ratedMin': [0]}
Sridevi Rameshdfc7fcb2020-07-23 03:03:57 -0500182
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500183PLDM_PDR_TYPES = {
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600184 'PLDM_STATE_EFFECTER_PDR': 'State Effecter PDR',
185 'PLDM_PDR_FRU_RECORD_SET': 'FRU Record Set PDR',
186 'PLDM_PDR_ENTITY_ASSOCIATION': 'Entity Association PDR',
187 'PLDM_STATE_SENSOR_PDR': 'State Sensor PDR',
188 'PLDM_NUMERIC_EFFECTER_PDR': 'Numeric Effecter PDR',
189 'PLDM_TERMINUS_LOCATOR_PDR': 'Terminus Locator PDR',
190 'PLDM_COMPACT_NUMERIC_SENSOR_PDR': '21'}
Sridevi Rameshf60581b2020-04-07 05:11:12 -0500191
192RESPONSE_LIST_GETBIOSTABLE_STRTABLE = [
193 'Allowed', 'Disabled', 'Enabled', 'IPv4DHCP', 'IPv4Static', 'Not Allowed',
Sridevi Ramesh297d41b2021-02-02 09:16:55 -0600194 'Perm', 'Temp', 'pvm_fw_boot_side', 'pvm_inband_code_update', 'pvm_os_boot_side',
195 'pvm_pcie_error_inject', 'pvm_surveillance', 'pvm_system_name', 'vmi_hostname',
196 'vmi_if_count', 'vmi_if0_ipv4_ipaddr', 'vmi_if0_ipv4_method',
197 'vmi_if0_ipv4_prefix_length', 'vmi_if1_ipv4_ipaddr', 'vmi_if1_ipv4_method',
198 'vmi_if1_ipv4_prefix_length']
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600199
200
201RESPONSE_LIST_GETBIOSTABLE_ATTRTABLE = [
Sridevi Ramesh297d41b2021-02-02 09:16:55 -0600202 'pvm_fw_boot_side', 'pvm_inband_code_update', 'pvm_os_boot_side',
203 'pvm_pcie_error_inject', 'pvm_surveillance', 'pvm_system_name', 'vmi_hostname',
204 'vmi_if_count', 'vmi_if0_ipv4_ipaddr', 'vmi_if0_ipv4_method',
205 'vmi_if0_ipv4_prefix_length', 'vmi_if1_ipv4_ipaddr', 'vmi_if1_ipv4_method',
206 'vmi_if1_ipv4_prefix_length']
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600207
208RESPONSE_LIST_GETBIOSTABLE_ATTRVALTABLE = [
209 'BIOSString', 'BIOSInteger', 'BIOSEnumeration']