blob: ab51392fd909254008af1733ffc0cb0191fbc726 [file] [log] [blame]
Sridevi Ramesh70e14182019-08-27 04:04:27 -05001#!/usr/bin/python
2
3r"""
4Contains PLDM-related constants.
5"""
6
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -06007# PLDM types.
8PLDM_TYPE_BASE = {'VALUE': '00', 'STRING': 'base'}
9PLDM_TYPE_PLATFORM = {'VALUE': '02', 'STRING': 'platform'}
10PLDM_TYPE_BIOS = {'VALUE': '03', 'STRING': 'bios'}
11PLDM_TYPE_FRU = {'VALUE': '04', 'STRING': 'fru'}
12PLDM_TYPE_OEM = {'VALUE': '3F', 'STRING': 'oem'}
Sridevi Ramesh70e14182019-08-27 04:04:27 -050013
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060014VERSION_BASE = {'VALUE': ['f1', 'f0', 'f0', '00'], 'STRING': '1.0.0'}
15VERSION_PLATFORM = {'VALUE': ['f1', 'f0', 'f0', '00'], 'STRING': '1.1.1'}
16VERSION_BIOS = {'VALUE': ['f1', 'f1', 'f1', '00'], 'STRING': '1.0.0'}
17VERSION_FRU = {'VALUE': ['f1', 'f0', 'f0', '00'], 'STRING': '1.0.0'}
Sridevi Ramesh70e14182019-08-27 04:04:27 -050018
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060019# PLDM base related variables.
Sridevi Ramesh70e14182019-08-27 04:04:27 -050020PLDM_BASE_CMD = {
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060021 'GET_TID': '02',
22 'GET_PLDM_VERSION': '03',
23 'GET_PLDM_TYPES': '04',
24 'GET_PLDM_COMMANDS': '05'}
Sridevi Ramesh70e14182019-08-27 04:04:27 -050025
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060026# Response lengths are inclusive of completion code.
27GET_TID_RESP_BYTES = 2
28GET_PLDM_VERSION_RESP_BYTES = 10
29GET_PLDM_TYPES_RESP_BYTES = 9
30GET_PLDM_COMMANDS_RESP_BYTES = 33
Sridevi Ramesh70e14182019-08-27 04:04:27 -050031
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060032# PLDM bios related variables.
Sridevi Ramesh70e14182019-08-27 04:04:27 -050033PLDM_BIOS_CMD = {
34 'GET_BIOS_TABLE': '01',
35 'SET_BIOS_ATTRIBUTE_CURRENT_VALUE': '07',
36 'GET_BIOS_ATTRIBUTE_CURRENT_VALUE_BY_HANDLE': '08',
37 'GET_DATE_TIME': '0c'}
38
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060039PLDM_BIOS_TABLE_TYPES = {
40 'STRING_TABLE': '00',
41 'ATTRIBUTE_TABLE': '01',
42 'ATTRIBUTE_VAL_TABLE': '02'}
43
44TRANSFER_OPERATION_FLAG = {
45 'GETNEXTPART': '00',
46 'GETFIRSTPART': '01'}
47
48TRANSFER_RESP_FLAG = {
49 'PLDM_START': '01',
50 'PLDM_MIDDLE': '02',
51 'PLDM_END': '04',
52 'PLDM_START_AND_END': '05'}
53
54# PLDM platform related variables.
Sridevi Ramesh70e14182019-08-27 04:04:27 -050055PLDM_PLATFORM_CMD = {
56 'SET_STATE_EFFECTER_STATES': '39',
57 'GET_PDR': '51'}
58
59PLDM_PDR_TYPES = {
60 'STATE_EFFECTER_PDR': '11'}
61
62# PLDM OEM related variables.
63PLDM_FILEIO_CMD = {
64 'GET_FILE_TABLE': '1',
65 'READ_FILE': '4',
66 'WRITE_FILE': '5',
67 'READ_FILE_INTO_MEMORY': '6',
68 'WRITE_FILE_FROM_MEMORY': '7'}
69
70PLDM_FILEIO_COMPLETION_CODES = {
71 'INVALID_FILE_HANDLE': '80',
72 'DATA_OUT_OF_RANGE': '81',
73 'INVALID_READ_LENGTH': '82',
74 'INVALID_WRITE_LENGTH': '83',
75 'FILE_TABLE_UNAVAILABLE': '84',
76 'INVALID_FILE_TABLE_TYPE': '85'}
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060077
78# PLDM FRU related variables.
79PLDM_FRU_CMD = {
80 'PLDM_GET_FRU_RECORD_TABLE_METADATA': '01',
81 'PLDM_GET_FRU_RECORD_TABLE': '02'}
82
83# PLDM command format.
84
85CMD_GETPLDMTYPES = 'pldmtool base GetPLDMTypes'
86
87'''
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'''
97CMD_GETPLDMVERSION = 'pldmtool base GetPLDMVersion -t %s'
98
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
107CMD_PLDMTOOL_RAW = 'pldmtool raw -d 0x80' + '0x%s' + ' ' + '0x%s'
108
109
110# PLDM command payload data.
111
112PAYLOAD_GetPLDMVersion = \
113 ' 0x00 0x00 0x00 0x00 0x%s 0x%s' # %(TransferOperationFlag, PLDMType)