blob: b2e9e6e4a5da40ce95baab593aadd74a87426b72 [file] [log] [blame]
Sridevi Ramesh70e14182019-08-27 04:04:27 -05001#!/usr/bin/python
2
3r"""
4Contains PLDM-related constants.
5"""
6
Rahul Maheshwari4d488572019-12-10 23:53:05 -06007
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -06008# PLDM types.
9PLDM_TYPE_BASE = {'VALUE': '00', 'STRING': 'base'}
10PLDM_TYPE_PLATFORM = {'VALUE': '02', 'STRING': 'platform'}
11PLDM_TYPE_BIOS = {'VALUE': '03', 'STRING': 'bios'}
12PLDM_TYPE_FRU = {'VALUE': '04', 'STRING': 'fru'}
13PLDM_TYPE_OEM = {'VALUE': '3F', 'STRING': 'oem'}
Sridevi Ramesh70e14182019-08-27 04:04:27 -050014
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060015VERSION_BASE = {'VALUE': ['f1', 'f0', 'f0', '00'], 'STRING': '1.0.0'}
16VERSION_PLATFORM = {'VALUE': ['f1', 'f0', 'f0', '00'], 'STRING': '1.1.1'}
17VERSION_BIOS = {'VALUE': ['f1', 'f1', 'f1', '00'], 'STRING': '1.0.0'}
18VERSION_FRU = {'VALUE': ['f1', 'f0', 'f0', '00'], 'STRING': '1.0.0'}
Sridevi Ramesh70e14182019-08-27 04:04:27 -050019
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060020# PLDM base related variables.
Sridevi Ramesh70e14182019-08-27 04:04:27 -050021PLDM_BASE_CMD = {
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060022 'GET_TID': '02',
23 'GET_PLDM_VERSION': '03',
24 'GET_PLDM_TYPES': '04',
25 'GET_PLDM_COMMANDS': '05'}
Sridevi Ramesh70e14182019-08-27 04:04:27 -050026
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060027# Response lengths are inclusive of completion code.
28GET_TID_RESP_BYTES = 2
29GET_PLDM_VERSION_RESP_BYTES = 10
30GET_PLDM_TYPES_RESP_BYTES = 9
31GET_PLDM_COMMANDS_RESP_BYTES = 33
Sridevi Ramesh70e14182019-08-27 04:04:27 -050032
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060033# PLDM bios related variables.
Sridevi Ramesh70e14182019-08-27 04:04:27 -050034PLDM_BIOS_CMD = {
35 'GET_BIOS_TABLE': '01',
36 'SET_BIOS_ATTRIBUTE_CURRENT_VALUE': '07',
37 'GET_BIOS_ATTRIBUTE_CURRENT_VALUE_BY_HANDLE': '08',
38 'GET_DATE_TIME': '0c'}
39
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060040PLDM_BIOS_TABLE_TYPES = {
41 'STRING_TABLE': '00',
42 'ATTRIBUTE_TABLE': '01',
43 'ATTRIBUTE_VAL_TABLE': '02'}
44
45TRANSFER_OPERATION_FLAG = {
46 'GETNEXTPART': '00',
47 'GETFIRSTPART': '01'}
48
49TRANSFER_RESP_FLAG = {
50 'PLDM_START': '01',
51 'PLDM_MIDDLE': '02',
52 'PLDM_END': '04',
53 'PLDM_START_AND_END': '05'}
54
55# PLDM platform related variables.
Sridevi Ramesh70e14182019-08-27 04:04:27 -050056PLDM_PLATFORM_CMD = {
57 'SET_STATE_EFFECTER_STATES': '39',
58 'GET_PDR': '51'}
59
60PLDM_PDR_TYPES = {
61 'STATE_EFFECTER_PDR': '11'}
62
63# PLDM OEM related variables.
64PLDM_FILEIO_CMD = {
65 'GET_FILE_TABLE': '1',
66 'READ_FILE': '4',
67 'WRITE_FILE': '5',
68 'READ_FILE_INTO_MEMORY': '6',
69 'WRITE_FILE_FROM_MEMORY': '7'}
70
71PLDM_FILEIO_COMPLETION_CODES = {
72 'INVALID_FILE_HANDLE': '80',
73 'DATA_OUT_OF_RANGE': '81',
74 'INVALID_READ_LENGTH': '82',
75 'INVALID_WRITE_LENGTH': '83',
76 'FILE_TABLE_UNAVAILABLE': '84',
77 'INVALID_FILE_TABLE_TYPE': '85'}
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060078
79# PLDM FRU related variables.
80PLDM_FRU_CMD = {
81 'PLDM_GET_FRU_RECORD_TABLE_METADATA': '01',
82 'PLDM_GET_FRU_RECORD_TABLE': '02'}
83
84# PLDM command format.
85
Rahul Maheshwari4d488572019-12-10 23:53:05 -060086CMD_GETPLDMTYPES = 'base GetPLDMTypes'
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060087
88'''
89e.g. : GetPLDMVersion usage
90
91pldmtool base GetPLDMVersion -t <pldm_type>
92
93pldm supported types
94
95base->0,platform->2,bios->3,fru->4
96
97'''
Rahul Maheshwari4d488572019-12-10 23:53:05 -060098CMD_GETPLDMVERSION = 'base GetPLDMVersion -t %s'
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060099
100'''
101e.g. : PLDM raw command usage
102
103pldmtool raw -d 0x80 0x00 0x03 0x00 0x00 0x00 0x00 0x01 0x00
104
105pldm raw -d 0x<header> 0x<pldm_type> 0x<pldm_cmd_type> 0x<payload_data>
106'''
107
Rahul Maheshwari4d488572019-12-10 23:53:05 -0600108CMD_PLDMTOOL_RAW = 'raw -d 0x80' + '0x%s' + ' ' + '0x%s'
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -0600109
110
111# PLDM command payload data.
112
113PAYLOAD_GetPLDMVersion = \
114 ' 0x00 0x00 0x00 0x00 0x%s 0x%s' # %(TransferOperationFlag, PLDMType)
Rahul Maheshwari4d488572019-12-10 23:53:05 -0600115
116
117PLDM_SUPPORTED_TYPES = ['base', 'platform', 'bios']