blob: c5407d6b7e6148092c34145bfdb8b3a476821ed3 [file] [log] [blame]
George Keishinge7e91712021-09-03 11:28:44 -05001#!/usr/bin/env python3
Sridevi Ramesh70e14182019-08-27 04:04:27 -05002
3r"""
4Contains PLDM-related constants.
5"""
6
George Keishinge635ddc2022-12-08 07:38:02 -06007PLDM_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.
George Keishinge635ddc2022-12-08 07:38:02 -060010PLDM_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'}
14PLDM_TYPE_OEM = {'VALUE': '63', 'STRING': 'oem-ibm'}
15PLDM_SUPPORTED_TYPES = ['0(base)', '2(platform)', '3(bios)', '4(fru)', '63(oem-ibm)']
Sridevi Ramesh70e14182019-08-27 04:04:27 -050016
George Keishinge635ddc2022-12-08 07:38:02 -060017VERSION_BASE = {'VALUE': ['f1', 'f0', 'f0', '00'], 'STRING': '1.0.0'}
18VERSION_PLATFORM = {'VALUE': ['f1', 'f2', 'f0', '00'], 'STRING': '1.2.0'}
19VERSION_BIOS = {'VALUE': ['f1', 'f1', 'f1', '00'], 'STRING': '1.0.0'}
20VERSION_FRU = {'VALUE': ['f1', 'f0', 'f0', '00'], 'STRING': '1.0.0'}
21VERSION_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
George Keishinge635ddc2022-12-08 07:38:02 -060024PLDM_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)']
29PLDM_FRU_CMDS = ['1(GetFRURecordTableMetadata)', '2(GetFRURecordTable)', '4(GetFRURecordByOption)']
30PLDM_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
George Keishinge635ddc2022-12-08 07:38:02 -060038'''
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060039e.g. : GetPLDMVersion usage
40
41pldmtool base GetPLDMVersion -t <pldm_type>
42
43pldm supported types
44
45base->0,platform->2,bios->3,fru->4
46
George Keishinge635ddc2022-12-08 07:38:02 -060047'''
48CMD_GETPLDMVERSION = 'base GetPLDMVersion -t %s'
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060049
George Keishinge635ddc2022-12-08 07:38:02 -060050'''
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060051e.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>
George Keishinge635ddc2022-12-08 07:38:02 -060056'''
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060057
George Keishinge635ddc2022-12-08 07:38:02 -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
George Keishinge635ddc2022-12-08 07:38:02 -060063PAYLOAD_GetPLDMVersion = \
64 ' 0x00 0x00 0x00 0x00 0x%s 0x%s' # %(TransferOperationFlag, PLDMType)
Rahul Maheshwari4d488572019-12-10 23:53:05 -060065
66
George Keishinge635ddc2022-12-08 07:38:02 -060067'''
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060068e.g. : SetDateTime usage
69
70pldmtool bios SetDateTime -d <YYYYMMDDHHMMSS>
71
George Keishinge635ddc2022-12-08 07:38:02 -060072'''
73CMD_SETDATETIME = 'bios SetDateTime -d %s'
Sridevi Rameshfe52e402020-02-05 00:15:24 -060074
75
George Keishinge635ddc2022-12-08 07:38:02 -060076CMD_GETPDR = 'platform GetPDR -d %s'
Sridevi Rameshfe52e402020-02-05 00:15:24 -060077
George Keishinge635ddc2022-12-08 07:38:02 -060078'''
Sridevi Rameshfe52e402020-02-05 00:15:24 -060079e.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
George Keishinge635ddc2022-12-08 07:38:02 -060084'''
Sridevi Rameshfe52e402020-02-05 00:15:24 -060085
George Keishinge635ddc2022-12-08 07:38:02 -060086CMD_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 = {
George Keishinge635ddc2022-12-08 07:38:02 -060096 'PDRHeaderVersion': [1],
97 'PDRType': ['State Effecter PDR'],
98 'recordChangeNumber': [0],
99 'effecterID': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
100 'entityType': ['Virtual Machine Manager', 'System chassis (main enclosure)',
101 'System Firmware', 'Processor Module', '32801(OEM)',
102 'Management Controller', '24577(OEM)'],
103 'entityInstanceNumber': [0, 1, 2, 3, 4],
104 'containerID': [0, 1],
105 'effecterSemanticID': [0],
106 'effecterInit': ['noInit'],
107 'effecterDescriptionPDR': [False],
108 'compositeEffecterCount': [1]}
Sridevi Rameshfe52e402020-02-05 00:15:24 -0600109
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500110RESPONSE_DICT_GETPDR_FRURECORDSETIDENTIFIER = {
George Keishinge635ddc2022-12-08 07:38:02 -0600111 'PDRHeaderVersion': [1],
112 'PDRType': ['FRU Record Set PDR'],
113 'recordChangeNumber': [0],
114 'dataLength': [10],
115 'entityType': ['System Board', 'Chassis front panel board (control panel)',
116 'Management Controller', 'OEM', 'Power converter',
117 'System (logical)', 'System chassis (main enclosure)',
118 'Chassis front panel board (control panel)',
119 'Processor Module', 'Memory Module', 'Power Supply',
120 '24576(OEM)', '60(OEM)', 'Processor', '142(OEM)'],
121 'containerID': [0, 1, 2, 3]}
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500122
123RESPONSE_DICT_GETPDR_PDRENTITYASSOCIATION = {
George Keishinge635ddc2022-12-08 07:38:02 -0600124 'PDRHeaderVersion': [1],
125 'PDRType': ['Entity Association PDR'],
126 'recordChangeNumber': [0],
127 'containerID': [1, 2, 3],
128 'associationtype': ['Physical'],
129 'containerentityType': ['System Board', 'System (logical)',
130 'System chassis (main enclosure)']}
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500131
Sridevi Rameshdfc7fcb2020-07-23 03:03:57 -0500132RESPONSE_DICT_GETPDR_STATESENSORPDR = {
George Keishinge635ddc2022-12-08 07:38:02 -0600133 'entityType': ['Communication Channel', 'Connector', 'Processor Module',
134 '32774(OEM)', '57346(OEM)', '57347(OEM)', '32801(OEM)',
135 '91(OEM)', '5(OEM)', '24577(OEM)'],
136 'sensorInit': ['noInit'],
137 'sensorAuxiliaryNamesPDR': [False]}
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600138
139RESPONSE_DICT_GETPDR_TERMINUSLOCATORPDR = {
George Keishinge635ddc2022-12-08 07:38:02 -0600140 'PDRHeaderVersion': [1],
141 'PDRType': ['Terminus Locator PDR'],
142 'recordChangeNumber': [0],
143 'validity': ['valid'],
144 'TID': [0, 1, 208],
145 'containerID': [0, 1],
146 'terminusLocatorType': ['MCTP_EID'],
147 'terminusLocatorValueSize': [1]}
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600148
149RESPONSE_DICT_GETPDR_NUMERICEFFECTERPDR = {
George Keishinge635ddc2022-12-08 07:38:02 -0600150 'PDRHeaderVersion': [1],
151 'PDRType': ['Numeric Effecter PDR'],
152 'recordChangeNumber': [0],
153 'entityInstanceNumber': [0, 1],
154 'containerID': [0],
155 'effecterSemanticID': [0],
156 'effecterInit': [0],
157 'effecterAuxiliaryNames': [False],
158 'baseUnit': [0, 72, 21],
159 'unitModifier': [0],
160 'baseOEMUnitHandle': [0],
161 'auxUnit': [0],
162 'auxUnitModifier': [0],
163 'auxrateUnit': [0],
164 'auxOEMUnitHandle': [0],
165 'resolution': [1, 0],
166 'offset': [0],
167 'accuracy': [0],
168 'plusTolerance': [0],
169 'minusTolerance': [0],
170 'stateTransitionInterval': [0],
171 'TransitionInterval': [0],
172 'minSettable': [0],
173 'rangeFieldSupport': [0],
174 'nominalValue': [0],
175 'normalMax': [0],
176 'normalMin': [0],
177 'ratedMax': [0],
178 'ratedMin': [0]}
Sridevi Rameshdfc7fcb2020-07-23 03:03:57 -0500179
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500180PLDM_PDR_TYPES = {
George Keishinge635ddc2022-12-08 07:38:02 -0600181 'PLDM_STATE_EFFECTER_PDR': 'State Effecter PDR',
182 'PLDM_PDR_FRU_RECORD_SET': 'FRU Record Set PDR',
183 'PLDM_PDR_ENTITY_ASSOCIATION': 'Entity Association PDR',
184 'PLDM_STATE_SENSOR_PDR': 'State Sensor PDR',
185 'PLDM_NUMERIC_EFFECTER_PDR': 'Numeric Effecter PDR',
186 'PLDM_TERMINUS_LOCATOR_PDR': 'Terminus Locator PDR',
187 'PLDM_COMPACT_NUMERIC_SENSOR_PDR': '21'}
Sridevi Rameshf60581b2020-04-07 05:11:12 -0500188
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600189RESPONSE_LIST_GETBIOSTABLE_ATTRVALTABLE = [
George Keishinge635ddc2022-12-08 07:38:02 -0600190 'BIOSString', 'BIOSInteger', 'BIOSEnumeration']