blob: 9f4044003de2f94382ac4c0ab73253f5a955c826 [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 Ramesh70e14182019-08-27 04:04:27 -050015
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060016VERSION_BASE = {'VALUE': ['f1', 'f0', 'f0', '00'], 'STRING': '1.0.0'}
Sridevi Rameshec753aa2020-02-17 22:55:13 -060017VERSION_PLATFORM = {'VALUE': ['f1', 'f2', 'f0', '00'], 'STRING': '1.2.0'}
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060018VERSION_BIOS = {'VALUE': ['f1', 'f1', 'f1', '00'], 'STRING': '1.0.0'}
19VERSION_FRU = {'VALUE': ['f1', 'f0', 'f0', '00'], 'STRING': '1.0.0'}
Sridevi Ramesh92041a32020-04-22 02:29:31 -050020VERSION_OEM = {'VALUE': ['f1', 'f0', 'f0', '00'], 'STRING': '1.0.0'}
Sridevi Ramesh70e14182019-08-27 04:04:27 -050021
Sridevi Ramesh70e14182019-08-27 04:04:27 -050022
Sridevi Ramesh039bc762020-03-30 09:59:07 -050023PLDM_BASE_CMDS = ['2(GetTID)', '3(GetPLDMVersion)', '4(GetPLDMTypes)', '5(GetPLDMCommands)']
24PLDM_PLATFORM_CMDS = ['57(SetStateEffecterStates)', '81(GetPDR)']
25PLDM_BIOS_CMDS = ['1(GetBIOSTable)', '7(SetBIOSAttributeCurrentValue)',
26 '8(GetBIOSAttributeCurrentValueByHandle)', '12(GetDateTime)',
27 '13(SetDateTime)']
Sridevi Ramesh3ca4f642020-07-14 01:15:30 -050028PLDM_FRU_CMDS = ['1(GetFRURecordTableMetadata)', '2(GetFRURecordTable)', '4(GetFRURecordByOption)']
Sridevi Ramesh92041a32020-04-22 02:29:31 -050029PLDM_OEM_CMDS = ['1(GetFileTable)', '4(ReadFile)', '5(WriteFile)', '6(ReadFileInToMemory)',
30 '7(WriteFileFromMemory)', '8(ReadFileByTypeIntoMemory)',
31 '9(WriteFileByTypeFromMemory)', '10(NewFileAvailable)',
32 '11(ReadFileByType)', '12(WriteFileByType)', '13(FileAck)',
33 '240(GetAlertStatus)']
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060034
35# PLDM command format.
36
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060037'''
38e.g. : GetPLDMVersion usage
39
40pldmtool base GetPLDMVersion -t <pldm_type>
41
42pldm supported types
43
44base->0,platform->2,bios->3,fru->4
45
46'''
Rahul Maheshwari4d488572019-12-10 23:53:05 -060047CMD_GETPLDMVERSION = 'base GetPLDMVersion -t %s'
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060048
49'''
50e.g. : PLDM raw command usage
51
52pldmtool raw -d 0x80 0x00 0x03 0x00 0x00 0x00 0x00 0x01 0x00
53
54pldm raw -d 0x<header> 0x<pldm_type> 0x<pldm_cmd_type> 0x<payload_data>
55'''
56
Rahul Maheshwari4d488572019-12-10 23:53:05 -060057CMD_PLDMTOOL_RAW = 'raw -d 0x80' + '0x%s' + ' ' + '0x%s'
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060058
59
60# PLDM command payload data.
61
62PAYLOAD_GetPLDMVersion = \
63 ' 0x00 0x00 0x00 0x00 0x%s 0x%s' # %(TransferOperationFlag, PLDMType)
Rahul Maheshwari4d488572019-12-10 23:53:05 -060064
65
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060066'''
67e.g. : SetDateTime usage
68
69pldmtool bios SetDateTime -d <YYYYMMDDHHMMSS>
70
71'''
72CMD_SETDATETIME = 'bios SetDateTime -d %s'
Sridevi Rameshfe52e402020-02-05 00:15:24 -060073
74
75CMD_GETPDR = 'platform GetPDR -d %s'
76
77'''
78e.g. : SetStateEffecterStates usage
79
Sridevi Rameshca3223a2020-03-11 03:58:58 -050080pldmtool platform GetPDR -i <effter_handle> -c <count> -d <effecterID, effecterState>
Sridevi Rameshfe52e402020-02-05 00:15:24 -060081
Sridevi Rameshca3223a2020-03-11 03:58:58 -050082pldmtool platform SetStateEffecterStates -i 1 -c 1 -d 1 1
Sridevi Rameshfe52e402020-02-05 00:15:24 -060083'''
84
Sridevi Rameshca3223a2020-03-11 03:58:58 -050085CMD_SETSTATEEFFECTERSTATES = 'platform SetStateEffecterStates -i %s -c %s -d %s'
Sridevi Rameshfe52e402020-02-05 00:15:24 -060086
87# GetPDR parsed response message for record handle.
88# Dictionary value array holds the expected output for record handle 1, 2.
Sridevi Rameshfe52e402020-02-05 00:15:24 -060089#
90# Note :
91# Record handle - 0 is default & has same behaviour as record handle 1
92# Only record handle 0, 1, 2 are supported as of now.
93
Sridevi Ramesh538d18d2020-03-30 11:45:42 -050094RESPONSE_DICT_GETPDR_SETSTATEEFFECTER = {
Sridevi Rameshfe52e402020-02-05 00:15:24 -060095 'responsecount': ['29', '30'],
Sridevi Rameshfe52e402020-02-05 00:15:24 -060096 'pdrheaderversion': ['1'],
Sridevi Rameshdfc7fcb2020-07-23 03:03:57 -050097 'pdrtype': ['State Effecter PDR(11)'],
Sridevi Rameshfe52e402020-02-05 00:15:24 -060098 'recordchangenumber': ['0'],
99 'datalength': ['19', '20'],
100 'pldmterminushandle': ['0'],
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500101 'effecterid': ['1', '2', '3'],
102 'entitytype': ['33', '45', '31'],
Sridevi Rameshfe52e402020-02-05 00:15:24 -0600103 'entityinstancenumber': ['0'],
104 'containerid': ['0'],
105 'effectersemanticid': ['0'],
106 'effecterinit': ['0'],
107 'effecterdescriptionpdr': ['false'],
108 'compositeeffectercount': ['1'],
Sridevi Rameshdfc7fcb2020-07-23 03:03:57 -0500109 'statesetid': ['Boot Progress(196)',
110 'System Power State(260)', 'Software Termination Status(129)'],
Sridevi Rameshfe52e402020-02-05 00:15:24 -0600111 'possiblestatessize': ['1', '2'],
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500112 'possiblestates': ['6', '0', '64']}
Sridevi Rameshfe52e402020-02-05 00:15:24 -0600113
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500114RESPONSE_DICT_GETPDR_FRURECORDSETIDENTIFIER = {
115 'responsecount': ['20'],
116 'pdrheaderversion': ['1'],
Sridevi Rameshdfc7fcb2020-07-23 03:03:57 -0500117 'pdrtype': ['FRU Record Set PDR(20)'],
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500118 'recordchangenumber': ['0'],
119 'datalength': ['10'],
Sridevi Rameshde91ec22020-05-14 05:02:03 -0500120 'pldmterminushandle': ['0', '2'],
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500121 'entitytype': ['System Board', 'Chassis front panel board (control panel)',
Sridevi Ramesh072d5af2020-06-02 09:20:57 -0500122 'Management Controller', 'OEM', 'Power converter',
Sridevi Ramesh88f21722020-04-16 05:54:02 -0500123 'System (logical)', 'System chassis (main enclosure)',
Sridevi Rameshde91ec22020-05-14 05:02:03 -0500124 'Chassis front panel board (control panel)',
Sridevi Rameshdfc7fcb2020-07-23 03:03:57 -0500125 'Processor Module', 'Memory Module', 'Power Supply'],
Sridevi Ramesh88f21722020-04-16 05:54:02 -0500126 'containerid': ['0', '1', '2', '3']}
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500127
128RESPONSE_DICT_GETPDR_PDRENTITYASSOCIATION = {
129 'pdrheaderversion': ['1'],
Sridevi Rameshdfc7fcb2020-07-23 03:03:57 -0500130 'pdrtype': ['Entity Association PDR(15)'],
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500131 'recordchangenumber': ['0'],
Sridevi Ramesh88f21722020-04-16 05:54:02 -0500132 'containerid': ['1', '2', '3'],
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500133 'associationtype': ['Physical'],
Sridevi Ramesh88f21722020-04-16 05:54:02 -0500134 'containerentitytype': ['System Board', 'System (logical)',
135 'System chassis (main enclosure)']
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500136}
137
Sridevi Rameshdfc7fcb2020-07-23 03:03:57 -0500138RESPONSE_DICT_GETPDR_STATESENSORPDR = {
Sridevi Rameshef361472020-09-23 06:13:06 -0500139 'entitytype': ['Communication Channel', 'Connector', 'Processor Module'],
Sridevi Rameshdfc7fcb2020-07-23 03:03:57 -0500140 'sensorinit': ['noInit'],
141 'sensorauxiliarynamespdr': ['false'],
Sridevi Rameshef361472020-09-23 06:13:06 -0500142 'statesetid': ['Availability(2)', 'Configuration State(15)',
143 'Operational Running Status(11)']
Sridevi Rameshdfc7fcb2020-07-23 03:03:57 -0500144}
145
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500146PLDM_PDR_TYPES = {
Sridevi Rameshdfc7fcb2020-07-23 03:03:57 -0500147 'PLDM_STATE_EFFECTER_PDR': 'State Effecter PDR(11)',
148 'PLDM_PDR_FRU_RECORD_SET': 'FRU Record Set PDR(20)',
149 'PLDM_PDR_ENTITY_ASSOCIATION': 'Entity Association PDR(15)',
150 'PLDM_STATE_SENSOR_PDR': 'State Sensor PDR(4)',
151 'PLDM_NUMERIC_EFFECTER_PDR': 'Numeric Effecter PDR(9)',
152 'PLDM_TERMINUS_LOCATOR_PDR': 'Terminus Locator PDR(1)'}
Sridevi Rameshf60581b2020-04-07 05:11:12 -0500153
154RESPONSE_LIST_GETBIOSTABLE_STRTABLE = [
155 'Allowed', 'Disabled', 'Enabled', 'IPv4DHCP', 'IPv4Static', 'Not Allowed',
156 'Perm', 'Temp', 'pvm-fw-boot-side', 'pvm-inband-code-update', 'pvm-os-boot-side',
157 'pvm-pcie-error-inject', 'pvm-surveillance', 'pvm-system-name', 'vmi-hostname',
158 'vmi-if-count', 'vmi-if0-ipv4-ipaddr', 'vmi-if0-ipv4-method',
159 'vmi-if0-ipv4-prefix-length', 'vmi-if1-ipv4-ipaddr', 'vmi-if1-ipv4-method',
160 'vmi-if1-ipv4-prefix-length', 'vmi-ipv4-gateway']