blob: 482e2b87ae9a9f5d416210d7468109555d89f125 [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'}
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 Ramesh70e14182019-08-27 04:04:27 -050020
Sridevi Ramesh70e14182019-08-27 04:04:27 -050021
Sridevi Ramesh039bc762020-03-30 09:59:07 -050022PLDM_BASE_CMDS = ['2(GetTID)', '3(GetPLDMVersion)', '4(GetPLDMTypes)', '5(GetPLDMCommands)']
23PLDM_PLATFORM_CMDS = ['57(SetStateEffecterStates)', '81(GetPDR)']
24PLDM_BIOS_CMDS = ['1(GetBIOSTable)', '7(SetBIOSAttributeCurrentValue)',
25 '8(GetBIOSAttributeCurrentValueByHandle)', '12(GetDateTime)',
26 '13(SetDateTime)']
27PLDM_FRU_CMDS = ['1(GetFRURecordTableMetadata)', '2(GetFRURecordTable)']
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060028
29# PLDM command format.
30
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060031'''
32e.g. : GetPLDMVersion usage
33
34pldmtool base GetPLDMVersion -t <pldm_type>
35
36pldm supported types
37
38base->0,platform->2,bios->3,fru->4
39
40'''
Rahul Maheshwari4d488572019-12-10 23:53:05 -060041CMD_GETPLDMVERSION = 'base GetPLDMVersion -t %s'
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060042
43'''
44e.g. : PLDM raw command usage
45
46pldmtool raw -d 0x80 0x00 0x03 0x00 0x00 0x00 0x00 0x01 0x00
47
48pldm raw -d 0x<header> 0x<pldm_type> 0x<pldm_cmd_type> 0x<payload_data>
49'''
50
Rahul Maheshwari4d488572019-12-10 23:53:05 -060051CMD_PLDMTOOL_RAW = 'raw -d 0x80' + '0x%s' + ' ' + '0x%s'
Sridevi Rameshc4e1cba2019-12-03 00:12:27 -060052
53
54# PLDM command payload data.
55
56PAYLOAD_GetPLDMVersion = \
57 ' 0x00 0x00 0x00 0x00 0x%s 0x%s' # %(TransferOperationFlag, PLDMType)
Rahul Maheshwari4d488572019-12-10 23:53:05 -060058
59
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060060'''
61e.g. : SetDateTime usage
62
63pldmtool bios SetDateTime -d <YYYYMMDDHHMMSS>
64
65'''
66CMD_SETDATETIME = 'bios SetDateTime -d %s'
Sridevi Rameshfe52e402020-02-05 00:15:24 -060067
68
69CMD_GETPDR = 'platform GetPDR -d %s'
70
71'''
72e.g. : SetStateEffecterStates usage
73
Sridevi Rameshca3223a2020-03-11 03:58:58 -050074pldmtool platform GetPDR -i <effter_handle> -c <count> -d <effecterID, effecterState>
Sridevi Rameshfe52e402020-02-05 00:15:24 -060075
Sridevi Rameshca3223a2020-03-11 03:58:58 -050076pldmtool platform SetStateEffecterStates -i 1 -c 1 -d 1 1
Sridevi Rameshfe52e402020-02-05 00:15:24 -060077'''
78
Sridevi Rameshca3223a2020-03-11 03:58:58 -050079CMD_SETSTATEEFFECTERSTATES = 'platform SetStateEffecterStates -i %s -c %s -d %s'
Sridevi Rameshfe52e402020-02-05 00:15:24 -060080
81# GetPDR parsed response message for record handle.
82# Dictionary value array holds the expected output for record handle 1, 2.
83# e.g. : 'nextrecordhandle': ['0', '2']
84#
85# Note :
86# Record handle - 0 is default & has same behaviour as record handle 1
87# Only record handle 0, 1, 2 are supported as of now.
88
89RESPONSE_DICT_GETPDR = {
Sridevi Ramesh0126ea02020-03-30 07:54:29 -050090 'nextrecordhandle': ['0', '2', '3'],
Sridevi Rameshfe52e402020-02-05 00:15:24 -060091 'responsecount': ['29', '30'],
92 'recordhandle': ['1', '2'],
93 'pdrheaderversion': ['1'],
94 'pdrtype': ['11'],
95 'recordchangenumber': ['0'],
96 'datalength': ['19', '20'],
97 'pldmterminushandle': ['0'],
98 'effecterid': ['1', '2'],
99 'entitytype': ['33', '45'],
100 'entityinstancenumber': ['0'],
101 'containerid': ['0'],
102 'effectersemanticid': ['0'],
103 'effecterinit': ['0'],
104 'effecterdescriptionpdr': ['false'],
105 'compositeeffectercount': ['1'],
106 'statesetid': ['196', '260'],
107 'possiblestatessize': ['1', '2'],
108 'possiblestates': ['6', '0']}
109
Sridevi Rameshfe52e402020-02-05 00:15:24 -0600110RESPONSE_DICT_GETBIOSTABLE_STRTABLE = {
111 'biosstringhandle': ['BIOSString'],
112 '0': ['Allowed'],
113 '1': ['Disabled'],
114 '2': ['Enabled'],
115 '3': ['Not Allowed'],
116 '4': ['Perm'],
117 '5': ['Temp'],
118 '6': ['pvm-fw-boot-side'],
119 '7': ['pvm-inband-code-update'],
120 '8': ['pvm-os-boot-side'],
121 '9': ['pvm-pcie-error-inject'],
122 '10': ['pvm-surveillance'],
123 '11': ['pvm-system-name'],
124 '12': ['vmi-if-count']}