blob: 61b0ea146caa96c208fdace640bb03436a4a494d [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
Patrick Williams20f38712022-12-08 06:18:26 -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.
Patrick Williams20f38712022-12-08 06:18:26 -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 = [
16 "0(base)",
17 "2(platform)",
18 "3(bios)",
19 "4(fru)",
20 "63(oem-ibm)",
21]
Sridevi Ramesh70e14182019-08-27 04:04:27 -050022
Patrick Williams20f38712022-12-08 06:18:26 -060023VERSION_BASE = {"VALUE": ["f1", "f0", "f0", "00"], "STRING": "1.0.0"}
24VERSION_PLATFORM = {"VALUE": ["f1", "f2", "f0", "00"], "STRING": "1.2.0"}
25VERSION_BIOS = {"VALUE": ["f1", "f1", "f1", "00"], "STRING": "1.0.0"}
26VERSION_FRU = {"VALUE": ["f1", "f0", "f0", "00"], "STRING": "1.0.0"}
27VERSION_OEM = {"VALUE": ["f1", "f0", "f0", "00"], "STRING": "1.0.0"}
Sridevi Ramesh70e14182019-08-27 04:04:27 -050028
Sridevi Ramesh70e14182019-08-27 04:04:27 -050029
Patrick Williams20f38712022-12-08 06:18:26 -060030PLDM_BASE_CMDS = [
31 "2(GetTID)",
32 "3(GetPLDMVersion)",
33 "4(GetPLDMTypes)",
34 "5(GetPLDMCommands)",
35]
36PLDM_PLATFORM_CMDS = ["57(SetStateEffecterStates)", "81(GetPDR)"]
37PLDM_BIOS_CMDS = [
38 "1(GetBIOSTable)",
39 "7(SetBIOSAttributeCurrentValue)",
40 "8(GetBIOSAttributeCurrentValueByHandle)",
41 "12(GetDateTime)",
42 "13(SetDateTime)",
43]
44PLDM_FRU_CMDS = [
45 "1(GetFRURecordTableMetadata)",
46 "2(GetFRURecordTable)",
47 "4(GetFRURecordByOption)",
48]
49PLDM_OEM_CMDS = [
50 "1(GetFileTable)",
51 "4(ReadFile)",
52 "5(WriteFile)",
53 "6(ReadFileInToMemory)",
54 "7(WriteFileFromMemory)",
55 "8(ReadFileByTypeIntoMemory)",
56 "9(WriteFileByTypeFromMemory)",
57 "10(NewFileAvailable)",
58 "11(ReadFileByType)",
59 "12(WriteFileByType)",
60 "13(FileAck)",
61 "240(GetAlertStatus)",
62]
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060063
64# PLDM command format.
65
Patrick Williams20f38712022-12-08 06:18:26 -060066"""
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060067e.g. : GetPLDMVersion usage
68
69pldmtool base GetPLDMVersion -t <pldm_type>
70
71pldm supported types
72
73base->0,platform->2,bios->3,fru->4
74
Patrick Williams20f38712022-12-08 06:18:26 -060075"""
76CMD_GETPLDMVERSION = "base GetPLDMVersion -t %s"
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060077
Patrick Williams20f38712022-12-08 06:18:26 -060078"""
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060079e.g. : PLDM raw command usage
80
81pldmtool raw -d 0x80 0x00 0x03 0x00 0x00 0x00 0x00 0x01 0x00
82
83pldm raw -d 0x<header> 0x<pldm_type> 0x<pldm_cmd_type> 0x<payload_data>
Patrick Williams20f38712022-12-08 06:18:26 -060084"""
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060085
Patrick Williams20f38712022-12-08 06:18:26 -060086CMD_PLDMTOOL_RAW = "raw -d 0x80" + "0x%s" + " " + "0x%s"
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060087
88
89# PLDM command payload data.
90
Patrick Williams20f38712022-12-08 06:18:26 -060091PAYLOAD_GetPLDMVersion = ( # %(TransferOperationFlag, PLDMType)
92 " 0x00 0x00 0x00 0x00 0x%s 0x%s"
93)
Rahul Maheshwari4d488572019-12-10 23:53:05 -060094
95
Patrick Williams20f38712022-12-08 06:18:26 -060096"""
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060097e.g. : SetDateTime usage
98
99pldmtool bios SetDateTime -d <YYYYMMDDHHMMSS>
100
Patrick Williams20f38712022-12-08 06:18:26 -0600101"""
102CMD_SETDATETIME = "bios SetDateTime -d %s"
Sridevi Rameshfe52e402020-02-05 00:15:24 -0600103
104
Patrick Williams20f38712022-12-08 06:18:26 -0600105CMD_GETPDR = "platform GetPDR -d %s"
Sridevi Rameshfe52e402020-02-05 00:15:24 -0600106
Patrick Williams20f38712022-12-08 06:18:26 -0600107"""
Sridevi Rameshfe52e402020-02-05 00:15:24 -0600108e.g. : SetStateEffecterStates usage
109
Sridevi Rameshca3223a2020-03-11 03:58:58 -0500110pldmtool platform GetPDR -i <effter_handle> -c <count> -d <effecterID, effecterState>
Sridevi Rameshfe52e402020-02-05 00:15:24 -0600111
Sridevi Rameshca3223a2020-03-11 03:58:58 -0500112pldmtool platform SetStateEffecterStates -i 1 -c 1 -d 1 1
Patrick Williams20f38712022-12-08 06:18:26 -0600113"""
Sridevi Rameshfe52e402020-02-05 00:15:24 -0600114
Patrick Williams20f38712022-12-08 06:18:26 -0600115CMD_SETSTATEEFFECTERSTATES = (
116 "platform SetStateEffecterStates -i %s -c %s -d %s"
117)
Sridevi Rameshfe52e402020-02-05 00:15:24 -0600118
119# GetPDR parsed response message for record handle.
120# Dictionary value array holds the expected output for record handle 1, 2.
Sridevi Rameshfe52e402020-02-05 00:15:24 -0600121#
122# Note :
123# Record handle - 0 is default & has same behaviour as record handle 1
124# Only record handle 0, 1, 2 are supported as of now.
125
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500126RESPONSE_DICT_GETPDR_SETSTATEEFFECTER = {
Patrick Williams20f38712022-12-08 06:18:26 -0600127 "PDRHeaderVersion": [1],
128 "PDRType": ["State Effecter PDR"],
129 "recordChangeNumber": [0],
130 "effecterID": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
131 "entityType": [
132 "Virtual Machine Manager",
133 "System chassis (main enclosure)",
134 "System Firmware",
135 "Processor Module",
136 "32801(OEM)",
137 "Management Controller",
138 "24577(OEM)",
139 ],
140 "entityInstanceNumber": [0, 1, 2, 3, 4],
141 "containerID": [0, 1],
142 "effecterSemanticID": [0],
143 "effecterInit": ["noInit"],
144 "effecterDescriptionPDR": [False],
145 "compositeEffecterCount": [1],
146}
Sridevi Rameshfe52e402020-02-05 00:15:24 -0600147
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500148RESPONSE_DICT_GETPDR_FRURECORDSETIDENTIFIER = {
Patrick Williams20f38712022-12-08 06:18:26 -0600149 "PDRHeaderVersion": [1],
150 "PDRType": ["FRU Record Set PDR"],
151 "recordChangeNumber": [0],
152 "dataLength": [10],
153 "entityType": [
154 "System Board",
155 "Chassis front panel board (control panel)",
156 "Management Controller",
157 "OEM",
158 "Power converter",
159 "System (logical)",
160 "System chassis (main enclosure)",
161 "Chassis front panel board (control panel)",
162 "Processor Module",
163 "Memory Module",
164 "Power Supply",
165 "24576(OEM)",
166 "60(OEM)",
167 "Processor",
168 "142(OEM)",
169 ],
170 "containerID": [0, 1, 2, 3],
171}
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500172
173RESPONSE_DICT_GETPDR_PDRENTITYASSOCIATION = {
Patrick Williams20f38712022-12-08 06:18:26 -0600174 "PDRHeaderVersion": [1],
175 "PDRType": ["Entity Association PDR"],
176 "recordChangeNumber": [0],
177 "containerID": [1, 2, 3],
178 "associationtype": ["Physical"],
179 "containerentityType": [
180 "System Board",
181 "System (logical)",
182 "System chassis (main enclosure)",
183 ],
184}
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500185
Sridevi Rameshdfc7fcb2020-07-23 03:03:57 -0500186RESPONSE_DICT_GETPDR_STATESENSORPDR = {
Patrick Williams20f38712022-12-08 06:18:26 -0600187 "entityType": [
188 "Communication Channel",
189 "Connector",
190 "Processor Module",
191 "32774(OEM)",
192 "57346(OEM)",
193 "57347(OEM)",
194 "32801(OEM)",
195 "91(OEM)",
196 "5(OEM)",
197 "24577(OEM)",
198 ],
199 "sensorInit": ["noInit"],
200 "sensorAuxiliaryNamesPDR": [False],
201}
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600202
203RESPONSE_DICT_GETPDR_TERMINUSLOCATORPDR = {
Patrick Williams20f38712022-12-08 06:18:26 -0600204 "PDRHeaderVersion": [1],
205 "PDRType": ["Terminus Locator PDR"],
206 "recordChangeNumber": [0],
207 "validity": ["valid"],
208 "TID": [0, 1, 208],
209 "containerID": [0, 1],
210 "terminusLocatorType": ["MCTP_EID"],
211 "terminusLocatorValueSize": [1],
212}
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600213
214RESPONSE_DICT_GETPDR_NUMERICEFFECTERPDR = {
Patrick Williams20f38712022-12-08 06:18:26 -0600215 "PDRHeaderVersion": [1],
216 "PDRType": ["Numeric Effecter PDR"],
217 "recordChangeNumber": [0],
218 "entityInstanceNumber": [0, 1],
219 "containerID": [0],
220 "effecterSemanticID": [0],
221 "effecterInit": [0],
222 "effecterAuxiliaryNames": [False],
223 "baseUnit": [0, 72, 21],
224 "unitModifier": [0],
225 "baseOEMUnitHandle": [0],
226 "auxUnit": [0],
227 "auxUnitModifier": [0],
228 "auxrateUnit": [0],
229 "auxOEMUnitHandle": [0],
230 "resolution": [1, 0],
231 "offset": [0],
232 "accuracy": [0],
233 "plusTolerance": [0],
234 "minusTolerance": [0],
235 "stateTransitionInterval": [0],
236 "TransitionInterval": [0],
237 "minSettable": [0],
238 "rangeFieldSupport": [0],
239 "nominalValue": [0],
240 "normalMax": [0],
241 "normalMin": [0],
242 "ratedMax": [0],
243 "ratedMin": [0],
244}
Sridevi Rameshdfc7fcb2020-07-23 03:03:57 -0500245
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500246PLDM_PDR_TYPES = {
Patrick Williams20f38712022-12-08 06:18:26 -0600247 "PLDM_STATE_EFFECTER_PDR": "State Effecter PDR",
248 "PLDM_PDR_FRU_RECORD_SET": "FRU Record Set PDR",
249 "PLDM_PDR_ENTITY_ASSOCIATION": "Entity Association PDR",
250 "PLDM_STATE_SENSOR_PDR": "State Sensor PDR",
251 "PLDM_NUMERIC_EFFECTER_PDR": "Numeric Effecter PDR",
252 "PLDM_TERMINUS_LOCATOR_PDR": "Terminus Locator PDR",
253 "PLDM_COMPACT_NUMERIC_SENSOR_PDR": "21",
254}
Sridevi Rameshf60581b2020-04-07 05:11:12 -0500255
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600256RESPONSE_LIST_GETBIOSTABLE_ATTRVALTABLE = [
Patrick Williams20f38712022-12-08 06:18:26 -0600257 "BIOSString",
258 "BIOSInteger",
259 "BIOSEnumeration",
260]