1#!/usr/bin/python
2
3r"""
4Contains PLDM-related constants.
5"""
6
7
8PLDM_TYPE_BASE = '00'
9PLDM_TYPE_PLATFORM = '02'
10PLDM_TYPE_BIOS = '03'
11PLDM_TYPE_OEM = '3F'
12
13PLDM_BASE_CMD = {
14    'GET_TID': '2',
15    'GET_PLDM_VERSION': '3',
16    'GET_PLDM_TYPES': '4',
17    'GET_PLDM_COMMANDS': '5'}
18
19PLDM_SUCCESS = '00'
20PLDM_ERROR = '01'
21PLDM_ERROR_INVALID_DATA = '02'
22PLDM_ERROR_INVALID_LENGTH = '03'
23PLDM_ERROR_NOT_READY = '04'
24PLDM_ERROR_UNSUPPORTED_PLDM_CMD = '05'
25PLDM_ERROR_INVALID_PLDM_TYPE = '20'
26
27BIOS_TABLE_UNAVAILABLE = '83',
28INVALID_BIOS_TABLE_DATA_INTEGRITY_CHECK = '84',
29INVALID_BIOS_TABLE_TYPE = '85'
30
31PLDM_BIOS_CMD = {
32    'GET_BIOS_TABLE': '01',
33    'SET_BIOS_ATTRIBUTE_CURRENT_VALUE': '07',
34    'GET_BIOS_ATTRIBUTE_CURRENT_VALUE_BY_HANDLE': '08',
35    'GET_DATE_TIME': '0c'}
36
37PLDM_PLATFORM_CMD = {
38    'SET_STATE_EFFECTER_STATES': '39',
39    'GET_PDR': '51'}
40
41PLDM_PDR_TYPES = {
42    'STATE_EFFECTER_PDR': '11'}
43
44# PLDM OEM related variables.
45PLDM_FILEIO_CMD = {
46    'GET_FILE_TABLE': '1',
47    'READ_FILE': '4',
48    'WRITE_FILE': '5',
49    'READ_FILE_INTO_MEMORY': '6',
50    'WRITE_FILE_FROM_MEMORY': '7'}
51
52PLDM_FILEIO_COMPLETION_CODES = {
53    'INVALID_FILE_HANDLE': '80',
54    'DATA_OUT_OF_RANGE': '81',
55    'INVALID_READ_LENGTH': '82',
56    'INVALID_WRITE_LENGTH': '83',
57    'FILE_TABLE_UNAVAILABLE': '84',
58    'INVALID_FILE_TABLE_TYPE': '85'}
59