1#!/usr/bin/python 2 3r""" 4Contains PLDM-related constants. 5""" 6 7 8# 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'} 14 15VERSION_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'} 19 20# PLDM base related variables. 21PLDM_BASE_CMD = { 22 'GET_TID': '02', 23 'GET_PLDM_VERSION': '03', 24 'GET_PLDM_TYPES': '04', 25 'GET_PLDM_COMMANDS': '05'} 26 27# 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 32 33# PLDM bios related variables. 34PLDM_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 40PLDM_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. 56PLDM_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'} 78 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 86CMD_GETPLDMTYPES = 'base GetPLDMTypes' 87 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''' 98CMD_GETPLDMVERSION = 'base GetPLDMVersion -t %s' 99 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 108CMD_PLDMTOOL_RAW = 'raw -d 0x80' + '0x%s' + ' ' + '0x%s' 109 110 111# PLDM command payload data. 112 113PAYLOAD_GetPLDMVersion = \ 114 ' 0x00 0x00 0x00 0x00 0x%s 0x%s' # %(TransferOperationFlag, PLDMType) 115 116 117PLDM_SUPPORTED_TYPES = ['base', 'platform', 'bios'] 118