blob: b7447af0904d478fe74bf8b4d1e3977fd39e41b7 [file] [log] [blame]
Sridevi Ramesh70e14182019-08-27 04:04:27 -05001#!/usr/bin/python
2
3r"""
4Contains PLDM-related constants.
5"""
6
Sridevi Ramesh1495bc42020-02-04 03:13:33 -06007PLDM_SUPPORTED_TYPES = ['base', 'platform', 'bios']
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'}
14PLDM_TYPE_OEM = {'VALUE': '3F', 'STRING': 'oem'}
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'}
17VERSION_PLATFORM = {'VALUE': ['f1', 'f0', 'f0', '00'], 'STRING': '1.1.1'}
18VERSION_BIOS = {'VALUE': ['f1', 'f1', 'f1', '00'], 'STRING': '1.0.0'}
19VERSION_FRU = {'VALUE': ['f1', 'f0', 'f0', '00'], 'STRING': '1.0.0'}
Sridevi Ramesh70e14182019-08-27 04:04:27 -050020
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060021# PLDM base related variables.
Sridevi Ramesh70e14182019-08-27 04:04:27 -050022PLDM_BASE_CMD = {
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060023 'GET_TID': '02',
24 'GET_PLDM_VERSION': '03',
25 'GET_PLDM_TYPES': '04',
26 'GET_PLDM_COMMANDS': '05'}
Sridevi Ramesh70e14182019-08-27 04:04:27 -050027
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060028# Response lengths are inclusive of completion code.
29GET_TID_RESP_BYTES = 2
30GET_PLDM_VERSION_RESP_BYTES = 10
31GET_PLDM_TYPES_RESP_BYTES = 9
32GET_PLDM_COMMANDS_RESP_BYTES = 33
Sridevi Ramesh70e14182019-08-27 04:04:27 -050033
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060034# PLDM bios related variables.
Sridevi Ramesh70e14182019-08-27 04:04:27 -050035PLDM_BIOS_CMD = {
36 'GET_BIOS_TABLE': '01',
37 'SET_BIOS_ATTRIBUTE_CURRENT_VALUE': '07',
38 'GET_BIOS_ATTRIBUTE_CURRENT_VALUE_BY_HANDLE': '08',
39 'GET_DATE_TIME': '0c'}
40
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060041PLDM_BIOS_TABLE_TYPES = {
42 'STRING_TABLE': '00',
43 'ATTRIBUTE_TABLE': '01',
44 'ATTRIBUTE_VAL_TABLE': '02'}
45
46TRANSFER_OPERATION_FLAG = {
47 'GETNEXTPART': '00',
48 'GETFIRSTPART': '01'}
49
50TRANSFER_RESP_FLAG = {
51 'PLDM_START': '01',
52 'PLDM_MIDDLE': '02',
53 'PLDM_END': '04',
54 'PLDM_START_AND_END': '05'}
55
56# PLDM platform related variables.
Sridevi Ramesh70e14182019-08-27 04:04:27 -050057PLDM_PLATFORM_CMD = {
58 'SET_STATE_EFFECTER_STATES': '39',
59 'GET_PDR': '51'}
60
61PLDM_PDR_TYPES = {
62 'STATE_EFFECTER_PDR': '11'}
63
64# PLDM OEM related variables.
65PLDM_FILEIO_CMD = {
66 'GET_FILE_TABLE': '1',
67 'READ_FILE': '4',
68 'WRITE_FILE': '5',
69 'READ_FILE_INTO_MEMORY': '6',
70 'WRITE_FILE_FROM_MEMORY': '7'}
71
72PLDM_FILEIO_COMPLETION_CODES = {
73 'INVALID_FILE_HANDLE': '80',
74 'DATA_OUT_OF_RANGE': '81',
75 'INVALID_READ_LENGTH': '82',
76 'INVALID_WRITE_LENGTH': '83',
77 'FILE_TABLE_UNAVAILABLE': '84',
78 'INVALID_FILE_TABLE_TYPE': '85'}
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060079
80# PLDM FRU related variables.
81PLDM_FRU_CMD = {
82 'PLDM_GET_FRU_RECORD_TABLE_METADATA': '01',
83 'PLDM_GET_FRU_RECORD_TABLE': '02'}
84
85# PLDM command format.
86
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060087'''
88e.g. : GetPLDMVersion usage
89
90pldmtool base GetPLDMVersion -t <pldm_type>
91
92pldm supported types
93
94base->0,platform->2,bios->3,fru->4
95
96'''
Rahul Maheshwari4d488572019-12-10 23:53:05 -060097CMD_GETPLDMVERSION = 'base GetPLDMVersion -t %s'
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060098
99'''
100e.g. : PLDM raw command usage
101
102pldmtool raw -d 0x80 0x00 0x03 0x00 0x00 0x00 0x00 0x01 0x00
103
104pldm raw -d 0x<header> 0x<pldm_type> 0x<pldm_cmd_type> 0x<payload_data>
105'''
106
Rahul Maheshwari4d488572019-12-10 23:53:05 -0600107CMD_PLDMTOOL_RAW = 'raw -d 0x80' + '0x%s' + ' ' + '0x%s'
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -0600108
109
110# PLDM command payload data.
111
112PAYLOAD_GetPLDMVersion = \
113 ' 0x00 0x00 0x00 0x00 0x%s 0x%s' # %(TransferOperationFlag, PLDMType)
Rahul Maheshwari4d488572019-12-10 23:53:05 -0600114
115
Sridevi Ramesh1495bc42020-02-04 03:13:33 -0600116'''
117e.g. : SetDateTime usage
118
119pldmtool bios SetDateTime -d <YYYYMMDDHHMMSS>
120
121'''
122CMD_SETDATETIME = 'bios SetDateTime -d %s'