blob: 7b5297aca44324694fc428432893fec09225ce0a [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)']
28PLDM_FRU_CMDS = ['1(GetFRURecordTableMetadata)', '2(GetFRURecordTable)']
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'],
97 'pdrtype': ['11'],
98 '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 Ramesh538d18d2020-03-30 11:45:42 -0500109 'statesetid': ['196', '260', '129'],
Sridevi Rameshfe52e402020-02-05 00:15:24 -0600110 'possiblestatessize': ['1', '2'],
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500111 'possiblestates': ['6', '0', '64']}
Sridevi Rameshfe52e402020-02-05 00:15:24 -0600112
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500113RESPONSE_DICT_GETPDR_FRURECORDSETIDENTIFIER = {
114 'responsecount': ['20'],
115 'pdrheaderversion': ['1'],
116 'pdrtype': ['20'],
117 'recordchangenumber': ['0'],
118 'datalength': ['10'],
Sridevi Rameshde91ec22020-05-14 05:02:03 -0500119 'pldmterminushandle': ['0', '2'],
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500120 'entitytype': ['System Board', 'Chassis front panel board (control panel)',
Sridevi Ramesh072d5af2020-06-02 09:20:57 -0500121 'Management Controller', 'OEM', 'Power converter',
Sridevi Ramesh88f21722020-04-16 05:54:02 -0500122 'System (logical)', 'System chassis (main enclosure)',
Sridevi Rameshde91ec22020-05-14 05:02:03 -0500123 'Chassis front panel board (control panel)',
124 'Processor Module', 'Memory Module'],
Sridevi Ramesh88f21722020-04-16 05:54:02 -0500125 'containerid': ['0', '1', '2', '3']}
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500126
127RESPONSE_DICT_GETPDR_PDRENTITYASSOCIATION = {
128 'pdrheaderversion': ['1'],
129 'pdrtype': ['15'],
130 'recordchangenumber': ['0'],
Sridevi Ramesh88f21722020-04-16 05:54:02 -0500131 'containerid': ['1', '2', '3'],
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500132 'associationtype': ['Physical'],
Sridevi Ramesh88f21722020-04-16 05:54:02 -0500133 'containerentitytype': ['System Board', 'System (logical)',
134 'System chassis (main enclosure)']
Sridevi Ramesh538d18d2020-03-30 11:45:42 -0500135}
136
137PLDM_PDR_TYPES = {
138 'PLDM_STATE_EFFECTER_PDR': '11',
139 'PLDM_PDR_FRU_RECORD_SET': '20',
Sridevi Ramesh072d5af2020-06-02 09:20:57 -0500140 'PLDM_PDR_ENTITY_ASSOCIATION': '15',
141 'PLDM_STATE_SENSOR_PDR': '4',
142 'PLDM_NUMERIC_EFFECTER_PDR': '9'}
Sridevi Rameshf60581b2020-04-07 05:11:12 -0500143
144RESPONSE_LIST_GETBIOSTABLE_STRTABLE = [
145 'Allowed', 'Disabled', 'Enabled', 'IPv4DHCP', 'IPv4Static', 'Not Allowed',
146 'Perm', 'Temp', 'pvm-fw-boot-side', 'pvm-inband-code-update', 'pvm-os-boot-side',
147 'pvm-pcie-error-inject', 'pvm-surveillance', 'pvm-system-name', 'vmi-hostname',
148 'vmi-if-count', 'vmi-if0-ipv4-ipaddr', 'vmi-if0-ipv4-method',
149 'vmi-if0-ipv4-prefix-length', 'vmi-if1-ipv4-ipaddr', 'vmi-if1-ipv4-method',
150 'vmi-if1-ipv4-prefix-length', 'vmi-ipv4-gateway']