Sridevi Ramesh | 70e1418 | 2019-08-27 04:04:27 -0500 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | |
| 3 | r""" |
| 4 | Contains PLDM-related constants. |
| 5 | """ |
| 6 | |
Sridevi Ramesh | c4e1cba | 2019-12-03 00:12:27 -0600 | [diff] [blame] | 7 | # PLDM types. |
| 8 | PLDM_TYPE_BASE = {'VALUE': '00', 'STRING': 'base'} |
| 9 | PLDM_TYPE_PLATFORM = {'VALUE': '02', 'STRING': 'platform'} |
| 10 | PLDM_TYPE_BIOS = {'VALUE': '03', 'STRING': 'bios'} |
| 11 | PLDM_TYPE_FRU = {'VALUE': '04', 'STRING': 'fru'} |
| 12 | PLDM_TYPE_OEM = {'VALUE': '3F', 'STRING': 'oem'} |
Sridevi Ramesh | 70e1418 | 2019-08-27 04:04:27 -0500 | [diff] [blame] | 13 | |
Sridevi Ramesh | c4e1cba | 2019-12-03 00:12:27 -0600 | [diff] [blame] | 14 | VERSION_BASE = {'VALUE': ['f1', 'f0', 'f0', '00'], 'STRING': '1.0.0'} |
| 15 | VERSION_PLATFORM = {'VALUE': ['f1', 'f0', 'f0', '00'], 'STRING': '1.1.1'} |
| 16 | VERSION_BIOS = {'VALUE': ['f1', 'f1', 'f1', '00'], 'STRING': '1.0.0'} |
| 17 | VERSION_FRU = {'VALUE': ['f1', 'f0', 'f0', '00'], 'STRING': '1.0.0'} |
Sridevi Ramesh | 70e1418 | 2019-08-27 04:04:27 -0500 | [diff] [blame] | 18 | |
Sridevi Ramesh | c4e1cba | 2019-12-03 00:12:27 -0600 | [diff] [blame] | 19 | # PLDM base related variables. |
Sridevi Ramesh | 70e1418 | 2019-08-27 04:04:27 -0500 | [diff] [blame] | 20 | PLDM_BASE_CMD = { |
Sridevi Ramesh | c4e1cba | 2019-12-03 00:12:27 -0600 | [diff] [blame] | 21 | 'GET_TID': '02', |
| 22 | 'GET_PLDM_VERSION': '03', |
| 23 | 'GET_PLDM_TYPES': '04', |
| 24 | 'GET_PLDM_COMMANDS': '05'} |
Sridevi Ramesh | 70e1418 | 2019-08-27 04:04:27 -0500 | [diff] [blame] | 25 | |
Sridevi Ramesh | c4e1cba | 2019-12-03 00:12:27 -0600 | [diff] [blame] | 26 | # Response lengths are inclusive of completion code. |
| 27 | GET_TID_RESP_BYTES = 2 |
| 28 | GET_PLDM_VERSION_RESP_BYTES = 10 |
| 29 | GET_PLDM_TYPES_RESP_BYTES = 9 |
| 30 | GET_PLDM_COMMANDS_RESP_BYTES = 33 |
Sridevi Ramesh | 70e1418 | 2019-08-27 04:04:27 -0500 | [diff] [blame] | 31 | |
Sridevi Ramesh | c4e1cba | 2019-12-03 00:12:27 -0600 | [diff] [blame] | 32 | # PLDM bios related variables. |
Sridevi Ramesh | 70e1418 | 2019-08-27 04:04:27 -0500 | [diff] [blame] | 33 | PLDM_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 Ramesh | c4e1cba | 2019-12-03 00:12:27 -0600 | [diff] [blame] | 39 | PLDM_BIOS_TABLE_TYPES = { |
| 40 | 'STRING_TABLE': '00', |
| 41 | 'ATTRIBUTE_TABLE': '01', |
| 42 | 'ATTRIBUTE_VAL_TABLE': '02'} |
| 43 | |
| 44 | TRANSFER_OPERATION_FLAG = { |
| 45 | 'GETNEXTPART': '00', |
| 46 | 'GETFIRSTPART': '01'} |
| 47 | |
| 48 | TRANSFER_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 Ramesh | 70e1418 | 2019-08-27 04:04:27 -0500 | [diff] [blame] | 55 | PLDM_PLATFORM_CMD = { |
| 56 | 'SET_STATE_EFFECTER_STATES': '39', |
| 57 | 'GET_PDR': '51'} |
| 58 | |
| 59 | PLDM_PDR_TYPES = { |
| 60 | 'STATE_EFFECTER_PDR': '11'} |
| 61 | |
| 62 | # PLDM OEM related variables. |
| 63 | PLDM_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 | |
| 70 | PLDM_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 Ramesh | c4e1cba | 2019-12-03 00:12:27 -0600 | [diff] [blame] | 77 | |
| 78 | # PLDM FRU related variables. |
| 79 | PLDM_FRU_CMD = { |
| 80 | 'PLDM_GET_FRU_RECORD_TABLE_METADATA': '01', |
| 81 | 'PLDM_GET_FRU_RECORD_TABLE': '02'} |
| 82 | |
| 83 | # PLDM command format. |
| 84 | |
| 85 | CMD_GETPLDMTYPES = 'pldmtool base GetPLDMTypes' |
| 86 | |
| 87 | ''' |
| 88 | e.g. : GetPLDMVersion usage |
| 89 | |
| 90 | pldmtool base GetPLDMVersion -t <pldm_type> |
| 91 | |
| 92 | pldm supported types |
| 93 | |
| 94 | base->0,platform->2,bios->3,fru->4 |
| 95 | |
| 96 | ''' |
| 97 | CMD_GETPLDMVERSION = 'pldmtool base GetPLDMVersion -t %s' |
| 98 | |
| 99 | ''' |
| 100 | e.g. : PLDM raw command usage |
| 101 | |
| 102 | pldmtool raw -d 0x80 0x00 0x03 0x00 0x00 0x00 0x00 0x01 0x00 |
| 103 | |
| 104 | pldm raw -d 0x<header> 0x<pldm_type> 0x<pldm_cmd_type> 0x<payload_data> |
| 105 | ''' |
| 106 | |
| 107 | CMD_PLDMTOOL_RAW = 'pldmtool raw -d 0x80' + '0x%s' + ' ' + '0x%s' |
| 108 | |
| 109 | |
| 110 | # PLDM command payload data. |
| 111 | |
| 112 | PAYLOAD_GetPLDMVersion = \ |
| 113 | ' 0x00 0x00 0x00 0x00 0x%s 0x%s' # %(TransferOperationFlag, PLDMType) |