Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 1 | #ifndef PLATFORM_H |
| 2 | #define PLATFORM_H |
| 3 | |
| 4 | #ifdef __cplusplus |
| 5 | extern "C" { |
| 6 | #endif |
| 7 | |
| 8 | #include <stddef.h> |
| 9 | #include <stdint.h> |
| 10 | |
| 11 | #include "base.h" |
Deepak Kodihalli | 5544ccd | 2020-03-15 23:36:16 -0500 | [diff] [blame] | 12 | #include "pdr.h" |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 13 | |
| 14 | /* Maximum size for request */ |
| 15 | #define PLDM_SET_STATE_EFFECTER_STATES_REQ_BYTES 19 |
Jolie Ku | 3557bad | 2020-03-02 16:22:57 +0800 | [diff] [blame] | 16 | #define PLDM_GET_STATE_SENSOR_READINGS_REQ_BYTES 4 |
Jolie Ku | 6787f17 | 2020-03-19 11:15:53 +0800 | [diff] [blame] | 17 | #define PLDM_GET_NUMERIC_EFFECTER_VALUE_REQ_BYTES 2 |
Jolie Ku | f798c8f | 2020-04-14 11:18:06 +0800 | [diff] [blame] | 18 | #define PLDM_GET_SENSOR_READING_REQ_BYTES 4 |
Sagar Srinivas | 535bccd | 2021-03-24 12:18:26 -0500 | [diff] [blame] | 19 | #define PLDM_SET_EVENT_RECEIVER_REQ_BYTES 5 |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 20 | /* Response lengths are inclusive of completion code */ |
| 21 | #define PLDM_SET_STATE_EFFECTER_STATES_RESP_BYTES 1 |
| 22 | |
George Liu | 30b859f | 2020-01-07 15:03:22 +0800 | [diff] [blame] | 23 | #define PLDM_SET_NUMERIC_EFFECTER_VALUE_RESP_BYTES 1 |
| 24 | #define PLDM_SET_NUMERIC_EFFECTER_VALUE_MIN_REQ_BYTES 4 |
| 25 | |
Sampa Misra | 7fcfb66 | 2019-05-08 13:13:53 -0500 | [diff] [blame] | 26 | #define PLDM_GET_PDR_REQ_BYTES 13 |
Sagar Srinivas | 535bccd | 2021-03-24 12:18:26 -0500 | [diff] [blame] | 27 | |
| 28 | #define PLDM_SET_EVENT_RECEIVER_RESP_BYTES 1 |
Sampa Misra | 7fcfb66 | 2019-05-08 13:13:53 -0500 | [diff] [blame] | 29 | /* Minimum response length */ |
| 30 | #define PLDM_GET_PDR_MIN_RESP_BYTES 12 |
Jolie Ku | 6787f17 | 2020-03-19 11:15:53 +0800 | [diff] [blame] | 31 | #define PLDM_GET_NUMERIC_EFFECTER_VALUE_MIN_RESP_BYTES 5 |
Jolie Ku | f798c8f | 2020-04-14 11:18:06 +0800 | [diff] [blame] | 32 | #define PLDM_GET_SENSOR_READING_MIN_RESP_BYTES 8 |
George Liu | 80237ef | 2020-07-10 15:16:39 +0800 | [diff] [blame] | 33 | #define PLDM_GET_STATE_SENSOR_READINGS_MIN_RESP_BYTES 2 |
George Liu | 9a3c6eb | 2021-10-27 10:50:28 +0800 | [diff] [blame] | 34 | #define PLDM_GET_PDR_REPOSITORY_INFO_RESP_BYTES 41 |
Sampa Misra | 7fcfb66 | 2019-05-08 13:13:53 -0500 | [diff] [blame] | 35 | |
Zahed Hossain | d4abab1 | 2020-02-06 03:36:43 -0600 | [diff] [blame] | 36 | /* Minimum length for PLDM PlatformEventMessage request */ |
| 37 | #define PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES 3 |
| 38 | #define PLDM_PLATFORM_EVENT_MESSAGE_STATE_SENSOR_STATE_REQ_BYTES 6 |
Tom Joseph | 56e45c5 | 2020-03-16 10:01:45 +0530 | [diff] [blame] | 39 | #define PLDM_PLATFORM_EVENT_MESSAGE_RESP_BYTES 2 |
Tom Joseph | 7f839f9 | 2020-09-21 10:20:44 +0530 | [diff] [blame] | 40 | #define PLDM_PLATFORM_EVENT_MESSAGE_FORMAT_VERSION 1 |
Zahed Hossain | d4abab1 | 2020-02-06 03:36:43 -0600 | [diff] [blame] | 41 | |
Zahed Hossain | 1c86171 | 2020-03-04 08:55:19 -0600 | [diff] [blame] | 42 | /* Minumum length of senson event data */ |
| 43 | #define PLDM_SENSOR_EVENT_DATA_MIN_LENGTH 5 |
| 44 | #define PLDM_SENSOR_EVENT_SENSOR_OP_STATE_DATA_LENGTH 2 |
| 45 | #define PLDM_SENSOR_EVENT_STATE_SENSOR_STATE_DATA_LENGTH 3 |
| 46 | #define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_MIN_DATA_LENGTH 4 |
| 47 | #define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_MAX_DATA_LENGTH 7 |
| 48 | #define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_8BIT_DATA_LENGTH 4 |
| 49 | #define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_16BIT_DATA_LENGTH 5 |
| 50 | #define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_32BIT_DATA_LENGTH 7 |
| 51 | |
Zahed Hossain | 9be087c | 2020-04-02 02:26:41 -0500 | [diff] [blame] | 52 | /* Minimum length of data for pldmPDRRepositoryChgEvent */ |
| 53 | #define PLDM_PDR_REPOSITORY_CHG_EVENT_MIN_LENGTH 2 |
| 54 | #define PLDM_PDR_REPOSITORY_CHANGE_RECORD_MIN_LENGTH 2 |
| 55 | |
Tom Joseph | 250c475 | 2020-04-15 10:32:45 +0530 | [diff] [blame] | 56 | #define PLDM_INVALID_EFFECTER_ID 0xFFFF |
Sampa Misra | 868c879 | 2020-05-26 03:12:13 -0500 | [diff] [blame] | 57 | #define PLDM_TID_RESERVED 0xFF |
Tom Joseph | 250c475 | 2020-04-15 10:32:45 +0530 | [diff] [blame] | 58 | |
George Liu | 30b859f | 2020-01-07 15:03:22 +0800 | [diff] [blame] | 59 | enum pldm_effecter_data_size { |
| 60 | PLDM_EFFECTER_DATA_SIZE_UINT8, |
| 61 | PLDM_EFFECTER_DATA_SIZE_SINT8, |
| 62 | PLDM_EFFECTER_DATA_SIZE_UINT16, |
| 63 | PLDM_EFFECTER_DATA_SIZE_SINT16, |
| 64 | PLDM_EFFECTER_DATA_SIZE_UINT32, |
| 65 | PLDM_EFFECTER_DATA_SIZE_SINT32 |
| 66 | }; |
| 67 | |
George Liu | 456c9a2 | 2020-01-13 11:36:22 +0800 | [diff] [blame] | 68 | enum pldm_range_field_format { |
| 69 | PLDM_RANGE_FIELD_FORMAT_UINT8, |
| 70 | PLDM_RANGE_FIELD_FORMAT_SINT8, |
| 71 | PLDM_RANGE_FIELD_FORMAT_UINT16, |
| 72 | PLDM_RANGE_FIELD_FORMAT_SINT16, |
| 73 | PLDM_RANGE_FIELD_FORMAT_UINT32, |
| 74 | PLDM_RANGE_FIELD_FORMAT_SINT32, |
| 75 | PLDM_RANGE_FIELD_FORMAT_REAL32 |
| 76 | }; |
| 77 | |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 78 | enum set_request { PLDM_NO_CHANGE = 0x00, PLDM_REQUEST_SET = 0x01 }; |
| 79 | |
| 80 | enum effecter_state { PLDM_INVALID_VALUE = 0xFF }; |
| 81 | |
George Liu | 9d15502 | 2020-07-10 15:06:35 +0800 | [diff] [blame] | 82 | enum pldm_sensor_present_state { |
| 83 | PLDM_SENSOR_UNKNOWN = 0x0, |
| 84 | PLDM_SENSOR_NORMAL = 0x01, |
| 85 | PLDM_SENSOR_WARNING = 0x02, |
| 86 | PLDM_SENSOR_CRITICAL = 0x03, |
| 87 | PLDM_SENSOR_FATAL = 0x04, |
| 88 | PLDM_SENSOR_LOWERWARNING = 0x05, |
| 89 | PLDM_SENSOR_LOWERCRITICAL = 0x06, |
| 90 | PLDM_SENSOR_LOWERFATAL = 0x07, |
| 91 | PLDM_SENSOR_UPPERWARNING = 0x08, |
| 92 | PLDM_SENSOR_UPPERCRITICAL = 0x09, |
| 93 | PLDM_SENSOR_UPPERFATAL = 0x0a |
Jolie Ku | 3557bad | 2020-03-02 16:22:57 +0800 | [diff] [blame] | 94 | }; |
| 95 | |
Jolie Ku | f798c8f | 2020-04-14 11:18:06 +0800 | [diff] [blame] | 96 | enum pldm_sensor_event_message_enable { |
| 97 | PLDM_NO_EVENT_GENERATION, |
| 98 | PLDM_EVENTS_DISABLED, |
| 99 | PLDM_EVENTS_ENABLED, |
| 100 | PLDM_OP_EVENTS_ONLY_ENABLED, |
| 101 | PLDM_STATE_EVENTS_ONLY_ENABLED |
| 102 | }; |
| 103 | |
Jolie Ku | 6787f17 | 2020-03-19 11:15:53 +0800 | [diff] [blame] | 104 | enum pldm_effecter_oper_state { |
| 105 | EFFECTER_OPER_STATE_ENABLED_UPDATEPENDING, |
| 106 | EFFECTER_OPER_STATE_ENABLED_NOUPDATEPENDING, |
| 107 | EFFECTER_OPER_STATE_DISABLED, |
| 108 | EFFECTER_OPER_STATE_UNAVAILABLE, |
| 109 | EFFECTER_OPER_STATE_STATUSUNKNOWN, |
| 110 | EFFECTER_OPER_STATE_FAILED, |
| 111 | EFFECTER_OPER_STATE_INITIALIZING, |
| 112 | EFFECTER_OPER_STATE_SHUTTINGDOWN, |
| 113 | EFFECTER_OPER_STATE_INTEST |
| 114 | }; |
| 115 | |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 116 | enum pldm_platform_commands { |
Sagar Srinivas | 535bccd | 2021-03-24 12:18:26 -0500 | [diff] [blame] | 117 | PLDM_SET_EVENT_RECEIVER = 0x04, |
Jolie Ku | f798c8f | 2020-04-14 11:18:06 +0800 | [diff] [blame] | 118 | PLDM_GET_SENSOR_READING = 0x11, |
Jolie Ku | 3557bad | 2020-03-02 16:22:57 +0800 | [diff] [blame] | 119 | PLDM_GET_STATE_SENSOR_READINGS = 0x21, |
George Liu | 30b859f | 2020-01-07 15:03:22 +0800 | [diff] [blame] | 120 | PLDM_SET_NUMERIC_EFFECTER_VALUE = 0x31, |
Jolie Ku | 6787f17 | 2020-03-19 11:15:53 +0800 | [diff] [blame] | 121 | PLDM_GET_NUMERIC_EFFECTER_VALUE = 0x32, |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 122 | PLDM_SET_STATE_EFFECTER_STATES = 0x39, |
George Liu | 9a3c6eb | 2021-10-27 10:50:28 +0800 | [diff] [blame] | 123 | PLDM_GET_PDR_REPOSITORY_INFO = 0x50, |
Sampa Misra | 7fcfb66 | 2019-05-08 13:13:53 -0500 | [diff] [blame] | 124 | PLDM_GET_PDR = 0x51, |
Zahed Hossain | d4abab1 | 2020-02-06 03:36:43 -0600 | [diff] [blame] | 125 | PLDM_PLATFORM_EVENT_MESSAGE = 0x0A |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 126 | }; |
| 127 | |
Deepak Kodihalli | c6e8fb5 | 2019-05-02 08:35:31 -0500 | [diff] [blame] | 128 | /** @brief PLDM PDR types |
| 129 | */ |
| 130 | enum pldm_pdr_types { |
Sridevi Ramesh | a1bfb78 | 2020-07-14 02:51:23 -0500 | [diff] [blame] | 131 | PLDM_TERMINUS_LOCATOR_PDR = 1, |
| 132 | PLDM_NUMERIC_SENSOR_PDR = 2, |
| 133 | PLDM_NUMERIC_SENSOR_INITIALIZATION_PDR = 3, |
Tom Joseph | b426860 | 2020-04-17 17:20:45 +0530 | [diff] [blame] | 134 | PLDM_STATE_SENSOR_PDR = 4, |
Sridevi Ramesh | a1bfb78 | 2020-07-14 02:51:23 -0500 | [diff] [blame] | 135 | PLDM_STATE_SENSOR_INITIALIZATION_PDR = 5, |
| 136 | PLDM_SENSOR_AUXILIARY_NAMES_PDR = 6, |
| 137 | PLDM_OEM_UNIT_PDR = 7, |
| 138 | PLDM_OEM_STATE_SET_PDR = 8, |
George Liu | 456c9a2 | 2020-01-13 11:36:22 +0800 | [diff] [blame] | 139 | PLDM_NUMERIC_EFFECTER_PDR = 9, |
Sridevi Ramesh | a1bfb78 | 2020-07-14 02:51:23 -0500 | [diff] [blame] | 140 | PLDM_NUMERIC_EFFECTER_INITIALIZATION_PDR = 10, |
Deepak Kodihalli | c6e8fb5 | 2019-05-02 08:35:31 -0500 | [diff] [blame] | 141 | PLDM_STATE_EFFECTER_PDR = 11, |
Sridevi Ramesh | a1bfb78 | 2020-07-14 02:51:23 -0500 | [diff] [blame] | 142 | PLDM_STATE_EFFECTER_INITIALIZATION_PDR = 12, |
| 143 | PLDM_EFFECTER_AUXILIARY_NAMES_PDR = 13, |
| 144 | PLDM_EFFECTER_OEM_SEMANTIC_PDR = 14, |
Deepak Kodihalli | 0a738f0 | 2020-03-10 01:56:21 -0500 | [diff] [blame] | 145 | PLDM_PDR_ENTITY_ASSOCIATION = 15, |
Sridevi Ramesh | a1bfb78 | 2020-07-14 02:51:23 -0500 | [diff] [blame] | 146 | PLDM_ENTITY_AUXILIARY_NAMES_PDR = 16, |
| 147 | PLDM_OEM_ENTITY_ID_PDR = 17, |
| 148 | PLDM_INTERRUPT_ASSOCIATION_PDR = 18, |
| 149 | PLDM_EVENT_LOG_PDR = 19, |
Deepak Kodihalli | db91467 | 2020-02-07 02:47:45 -0600 | [diff] [blame] | 150 | PLDM_PDR_FRU_RECORD_SET = 20, |
Sridevi Ramesh | a1bfb78 | 2020-07-14 02:51:23 -0500 | [diff] [blame] | 151 | PLDM_OEM_DEVICE_PDR = 126, |
| 152 | PLDM_OEM_PDR = 127, |
Deepak Kodihalli | c6e8fb5 | 2019-05-02 08:35:31 -0500 | [diff] [blame] | 153 | }; |
| 154 | |
| 155 | /** @brief PLDM effecter initialization schemes |
| 156 | */ |
| 157 | enum pldm_effecter_init { |
| 158 | PLDM_NO_INIT, |
| 159 | PLDM_USE_INIT_PDR, |
| 160 | PLDM_ENABLE_EFFECTER, |
| 161 | PLDM_DISABLE_EFECTER |
| 162 | }; |
| 163 | |
Deepak Kodihalli | 557dfb0 | 2019-05-12 13:11:17 +0530 | [diff] [blame] | 164 | /** @brief PLDM Platform M&C completion codes |
| 165 | */ |
| 166 | enum pldm_platform_completion_codes { |
George Liu | 362c18d | 2020-05-14 09:46:36 +0800 | [diff] [blame] | 167 | PLDM_PLATFORM_INVALID_SENSOR_ID = 0x80, |
| 168 | PLDM_PLATFORM_REARM_UNAVAILABLE_IN_PRESENT_STATE = 0x81, |
| 169 | |
Sampa Misra | a2fa070 | 2019-05-31 01:28:55 -0500 | [diff] [blame] | 170 | PLDM_PLATFORM_INVALID_EFFECTER_ID = 0x80, |
| 171 | PLDM_PLATFORM_INVALID_STATE_VALUE = 0x81, |
Zach Clark | 7672875 | 2020-03-31 10:44:09 -0500 | [diff] [blame] | 172 | |
| 173 | PLDM_PLATFORM_INVALID_DATA_TRANSFER_HANDLE = 0x80, |
| 174 | PLDM_PLATFORM_INVALID_TRANSFER_OPERATION_FLAG = 0x81, |
Deepak Kodihalli | 557dfb0 | 2019-05-12 13:11:17 +0530 | [diff] [blame] | 175 | PLDM_PLATFORM_INVALID_RECORD_HANDLE = 0x82, |
Zach Clark | 7672875 | 2020-03-31 10:44:09 -0500 | [diff] [blame] | 176 | PLDM_PLATFORM_INVALID_RECORD_CHANGE_NUMBER = 0x83, |
| 177 | PLDM_PLATFORM_TRANSFER_TIMEOUT = 0x84, |
| 178 | |
Sampa Misra | a2fa070 | 2019-05-31 01:28:55 -0500 | [diff] [blame] | 179 | PLDM_PLATFORM_SET_EFFECTER_UNSUPPORTED_SENSORSTATE = 0x82, |
Sagar Srinivas | 535bccd | 2021-03-24 12:18:26 -0500 | [diff] [blame] | 180 | |
| 181 | PLDM_PLATFORM_INVALID_PROTOCOL_TYPE = 0x80, |
| 182 | PLDM_PLATFORM_ENABLE_METHOD_NOT_SUPPORTED = 0x81, |
| 183 | PLDM_PLATFORM_HEARTBEAT_FREQUENCY_TOO_HIGH = 0x82, |
Deepak Kodihalli | 557dfb0 | 2019-05-12 13:11:17 +0530 | [diff] [blame] | 184 | }; |
| 185 | |
Zahed Hossain | d4abab1 | 2020-02-06 03:36:43 -0600 | [diff] [blame] | 186 | /** @brief PLDM Event types |
| 187 | */ |
| 188 | enum pldm_event_types { |
| 189 | PLDM_SENSOR_EVENT = 0x00, |
| 190 | PLDM_EFFECTER_EVENT = 0x01, |
| 191 | PLDM_REDFISH_TASK_EXECUTED_EVENT = 0x02, |
| 192 | PLDM_REDFISH_MESSAGE_EVENT = 0x03, |
| 193 | PLDM_PDR_REPOSITORY_CHG_EVENT = 0x04, |
| 194 | PLDM_MESSAGE_POLL_EVENT = 0x05, |
| 195 | PLDM_HEARTBEAT_TIMER_ELAPSED_EVENT = 0x06 |
| 196 | }; |
| 197 | |
| 198 | /** @brief PLDM sensorEventClass states |
| 199 | */ |
| 200 | enum sensor_event_class_states { |
| 201 | PLDM_SENSOR_OP_STATE, |
| 202 | PLDM_STATE_SENSOR_STATE, |
| 203 | PLDM_NUMERIC_SENSOR_STATE |
| 204 | }; |
| 205 | |
| 206 | /** @brief PLDM sensor supported states |
| 207 | */ |
| 208 | enum pldm_sensor_operational_state { |
| 209 | PLDM_SENSOR_ENABLED, |
| 210 | PLDM_SENSOR_DISABLED, |
| 211 | PLDM_SENSOR_UNAVAILABLE, |
| 212 | PLDM_SENSOR_STATUSUNKOWN, |
| 213 | PLDM_SENSOR_FAILED, |
| 214 | PLDM_SENSOR_INITIALIZING, |
| 215 | PLDM_SENSOR_SHUTTINGDOWN, |
| 216 | PLDM_SENSOR_INTEST |
| 217 | }; |
| 218 | |
| 219 | /** @brief PLDM pldmPDRRepositoryChgEvent class eventData format |
| 220 | */ |
| 221 | enum pldm_pdr_repository_chg_event_data_format { |
| 222 | REFRESH_ENTIRE_REPOSITORY, |
| 223 | FORMAT_IS_PDR_TYPES, |
| 224 | FORMAT_IS_PDR_HANDLES |
| 225 | }; |
| 226 | |
Zahed Hossain | 9be087c | 2020-04-02 02:26:41 -0500 | [diff] [blame] | 227 | /** @brief PLDM pldmPDRRepositoryChgEvent class changeRecord format |
| 228 | * eventDataOperation |
| 229 | */ |
| 230 | enum pldm_pdr_repository_chg_event_change_record_event_data_operation { |
| 231 | PLDM_REFRESH_ALL_RECORDS, |
| 232 | PLDM_RECORDS_DELETED, |
| 233 | PLDM_RECORDS_ADDED, |
| 234 | PLDM_RECORDS_MODIFIED |
| 235 | }; |
| 236 | |
Zahed Hossain | 1c86171 | 2020-03-04 08:55:19 -0600 | [diff] [blame] | 237 | /** @brief PLDM NumericSensorStatePresentReading data type |
| 238 | */ |
| 239 | enum pldm_sensor_readings_data_type { |
| 240 | PLDM_SENSOR_DATA_SIZE_UINT8, |
| 241 | PLDM_SENSOR_DATA_SIZE_SINT8, |
| 242 | PLDM_SENSOR_DATA_SIZE_UINT16, |
| 243 | PLDM_SENSOR_DATA_SIZE_SINT16, |
| 244 | PLDM_SENSOR_DATA_SIZE_UINT32, |
| 245 | PLDM_SENSOR_DATA_SIZE_SINT32 |
| 246 | }; |
| 247 | |
Tom Joseph | 56e45c5 | 2020-03-16 10:01:45 +0530 | [diff] [blame] | 248 | /** @brief PLDM PlatformEventMessage response status |
| 249 | */ |
| 250 | enum pldm_platform_event_status { |
| 251 | PLDM_EVENT_NO_LOGGING = 0x00, |
| 252 | PLDM_EVENT_LOGGING_DISABLED = 0x01, |
| 253 | PLDM_EVENT_LOG_FULL = 0x02, |
| 254 | PLDM_EVENT_ACCEPTED_FOR_LOGGING = 0x03, |
| 255 | PLDM_EVENT_LOGGED = 0x04, |
| 256 | PLDM_EVENT_LOGGING_REJECTED = 0x05 |
| 257 | }; |
| 258 | |
Sampa Misra | 12afe11 | 2020-05-25 11:40:44 -0500 | [diff] [blame] | 259 | /** @brief PLDM Terminus Locator PDR validity |
| 260 | */ |
| 261 | enum pldm_terminus_locator_pdr_validity { |
| 262 | PLDM_TL_PDR_NOT_VALID, |
| 263 | PLDM_TL_PDR_VALID |
| 264 | }; |
| 265 | |
| 266 | /** @brief PLDM Terminus Locator type |
| 267 | */ |
| 268 | enum pldm_terminus_locator_type { |
| 269 | PLDM_TERMINUS_LOCATOR_TYPE_UID, |
| 270 | PLDM_TERMINUS_LOCATOR_TYPE_MCTP_EID, |
| 271 | PLDM_TERMINUS_LOCATOR_TYPE_SMBUS_RELATIVE, |
| 272 | PLDM_TERMINUS_LOCATOR_TYPE_SYS_SW |
| 273 | }; |
| 274 | |
Sagar Srinivas | 535bccd | 2021-03-24 12:18:26 -0500 | [diff] [blame] | 275 | /** @brief PLDM event message global enable for |
| 276 | * SetEventReceiver command |
| 277 | */ |
| 278 | enum pldm_event_message_global_enable { |
| 279 | PLDM_EVENT_MESSAGE_GLOBAL_DISABLE, |
| 280 | PLDM_EVENT_MESSAGE_GLOBAL_ENABLE_ASYNC, |
| 281 | PLDM_EVENT_MESSAGE_GLOBAL_ENABLE_POLLING, |
| 282 | PLDM_EVENT_MESSAGE_GLOBAL_ENABLE_ASYNC_KEEP_ALIVE |
| 283 | }; |
| 284 | |
George Liu | 9a3c6eb | 2021-10-27 10:50:28 +0800 | [diff] [blame] | 285 | /** @brief PLDM respository state */ |
| 286 | enum pldm_repository_state { |
| 287 | PLDM_AVAILABLE, |
| 288 | PLDM_UPDATE_IN_PROGRESS, |
| 289 | PLDM_FAILED |
| 290 | }; |
| 291 | |
| 292 | /** @brief PLDM respository data transfer handler timeout */ |
| 293 | enum pldm_repository_data_transfer_handler_timeout { |
| 294 | PLDM_NO_TIMEOUT, |
| 295 | PLDM_DEFALUT_MINIMUM_TIMEOUT |
| 296 | }; |
| 297 | |
Deepak Kodihalli | c6e8fb5 | 2019-05-02 08:35:31 -0500 | [diff] [blame] | 298 | /** @struct pldm_pdr_hdr |
| 299 | * |
| 300 | * Structure representing PLDM common PDR header |
| 301 | */ |
| 302 | struct pldm_pdr_hdr { |
| 303 | uint32_t record_handle; |
| 304 | uint8_t version; |
| 305 | uint8_t type; |
| 306 | uint16_t record_change_num; |
| 307 | uint16_t length; |
| 308 | } __attribute__((packed)); |
| 309 | |
Sampa Misra | 12afe11 | 2020-05-25 11:40:44 -0500 | [diff] [blame] | 310 | /** @struct pldm_terminus_locator_pdr |
| 311 | * |
| 312 | * Structure representing PLDM terminus locator PDR |
| 313 | */ |
| 314 | struct pldm_terminus_locator_pdr { |
| 315 | struct pldm_pdr_hdr hdr; |
| 316 | uint16_t terminus_handle; |
| 317 | uint8_t validity; |
| 318 | uint8_t tid; |
| 319 | uint16_t container_id; |
| 320 | uint8_t terminus_locator_type; |
| 321 | uint8_t terminus_locator_value_size; |
| 322 | uint8_t terminus_locator_value[1]; |
| 323 | } __attribute__((packed)); |
| 324 | |
| 325 | /** @struct pldm_terminus_locator_type_mctp_eid |
| 326 | * |
| 327 | * Structure representing terminus locator value for |
| 328 | * terminus locator type MCTP_EID |
| 329 | */ |
| 330 | struct pldm_terminus_locator_type_mctp_eid { |
| 331 | uint8_t eid; |
| 332 | } __attribute__((packed)); |
| 333 | |
Deepak Kodihalli | 5544ccd | 2020-03-15 23:36:16 -0500 | [diff] [blame] | 334 | /** @struct pldm_pdr_entity_association |
| 335 | * |
| 336 | * Structure representing PLDM Entity Association PDR |
| 337 | */ |
| 338 | struct pldm_pdr_entity_association { |
| 339 | uint16_t container_id; |
| 340 | uint8_t association_type; |
| 341 | pldm_entity container; |
| 342 | uint8_t num_children; |
| 343 | pldm_entity children[1]; |
| 344 | } __attribute__((packed)); |
| 345 | |
Deepak Kodihalli | db91467 | 2020-02-07 02:47:45 -0600 | [diff] [blame] | 346 | /** @struct pldm_pdr_fru_record_set |
| 347 | * |
| 348 | * Structure representing PLDM FRU record set PDR |
| 349 | */ |
| 350 | struct pldm_pdr_fru_record_set { |
| 351 | uint16_t terminus_handle; |
| 352 | uint16_t fru_rsi; |
| 353 | uint16_t entity_type; |
| 354 | uint16_t entity_instance_num; |
| 355 | uint16_t container_id; |
| 356 | } __attribute__((packed)); |
| 357 | |
Tom Joseph | b426860 | 2020-04-17 17:20:45 +0530 | [diff] [blame] | 358 | /** @struct pldm_state_sensor_pdr |
| 359 | * |
| 360 | * Structure representing PLDM state sensor PDR |
| 361 | */ |
| 362 | struct pldm_state_sensor_pdr { |
| 363 | struct pldm_pdr_hdr hdr; |
| 364 | uint16_t terminus_handle; |
| 365 | uint16_t sensor_id; |
| 366 | uint16_t entity_type; |
| 367 | uint16_t entity_instance; |
| 368 | uint16_t container_id; |
| 369 | uint8_t sensor_init; |
| 370 | bool8_t sensor_auxiliary_names_pdr; |
| 371 | uint8_t composite_sensor_count; |
| 372 | uint8_t possible_states[1]; |
| 373 | } __attribute__((packed)); |
| 374 | |
| 375 | /** @struct state_sensor_possible_states |
| 376 | * |
| 377 | * Structure representing state enums for state sensor |
| 378 | */ |
| 379 | struct state_sensor_possible_states { |
| 380 | uint16_t state_set_id; |
| 381 | uint8_t possible_states_size; |
| 382 | bitfield8_t states[1]; |
| 383 | } __attribute__((packed)); |
| 384 | |
Deepak Kodihalli | c6e8fb5 | 2019-05-02 08:35:31 -0500 | [diff] [blame] | 385 | /** @struct pldm_state_effecter_pdr |
| 386 | * |
| 387 | * Structure representing PLDM state effecter PDR |
| 388 | */ |
| 389 | struct pldm_state_effecter_pdr { |
| 390 | struct pldm_pdr_hdr hdr; |
| 391 | uint16_t terminus_handle; |
| 392 | uint16_t effecter_id; |
| 393 | uint16_t entity_type; |
| 394 | uint16_t entity_instance; |
| 395 | uint16_t container_id; |
| 396 | uint16_t effecter_semantic_id; |
| 397 | uint8_t effecter_init; |
| 398 | bool8_t has_description_pdr; |
| 399 | uint8_t composite_effecter_count; |
| 400 | uint8_t possible_states[1]; |
| 401 | } __attribute__((packed)); |
| 402 | |
Zach Clark | b728eee | 2020-06-18 10:01:31 -0500 | [diff] [blame] | 403 | /** @brief Encode PLDM state sensor PDR |
| 404 | * |
| 405 | * @param[in/out] sensor Structure to encode. All members of |
| 406 | * sensor, except those mentioned in the @note below, should be initialized by |
| 407 | * the caller. |
| 408 | * @param[in] allocation_size Size of sensor allocation in bytes |
| 409 | * @param[in] possible_states Possible sensor states |
| 410 | * @param[in] possible_states_size Size of possible sensor states in bytes |
| 411 | * @param[out] actual_size Size of sensor PDR. Set to 0 on error. |
| 412 | * @return int pldm_completion_codes |
| 413 | * PLDM_SUCCESS/PLDM_ERROR/PLDM_ERROR_INVALID_LENGTH |
| 414 | * |
| 415 | * @note The sensor parameter will be encoded in place. |
| 416 | * @note Caller is responsible for allocation of the sensor parameter. Caller |
| 417 | * must allocate enough space for the base structure and the |
| 418 | * sensor->possible_states array, otherwise the function will fail. |
| 419 | * @note sensor->hdr.length, .type, and .version will be set appropriately. |
| 420 | */ |
| 421 | int encode_state_sensor_pdr( |
| 422 | struct pldm_state_sensor_pdr *sensor, size_t allocation_size, |
| 423 | const struct state_sensor_possible_states *possible_states, |
| 424 | size_t possible_states_size, size_t *actual_size); |
| 425 | |
George Liu | 456c9a2 | 2020-01-13 11:36:22 +0800 | [diff] [blame] | 426 | /** @union union_effecter_data_size |
| 427 | * |
| 428 | * The bit width and format of reading and threshold values that the effecter |
| 429 | * returns. |
| 430 | * Refer to: DSP0248_1.2.0: 28.11 Table 87 |
| 431 | */ |
| 432 | typedef union { |
| 433 | uint8_t value_u8; |
| 434 | int8_t value_s8; |
| 435 | uint16_t value_u16; |
| 436 | int16_t value_s16; |
| 437 | uint32_t value_u32; |
| 438 | int32_t value_s32; |
| 439 | } union_effecter_data_size; |
| 440 | |
| 441 | /** @union union_range_field_format |
| 442 | * |
| 443 | * Indicates the format used for the nominalValue, normalMax, and normalMin |
| 444 | * fields. |
| 445 | * Refer to: DSP0248_1.2.0: 28.11 Table 87 |
| 446 | */ |
| 447 | typedef union { |
| 448 | uint8_t value_u8; |
| 449 | int8_t value_s8; |
| 450 | uint16_t value_u16; |
| 451 | int16_t value_s16; |
| 452 | uint32_t value_u32; |
| 453 | int32_t value_s32; |
| 454 | real32_t value_f32; |
| 455 | } union_range_field_format; |
| 456 | |
| 457 | /** @struct pldm_numeric_effecter_value_pdr |
| 458 | * |
| 459 | * Structure representing PLDM numeric effecter value PDR |
| 460 | */ |
| 461 | struct pldm_numeric_effecter_value_pdr { |
| 462 | struct pldm_pdr_hdr hdr; |
| 463 | uint16_t terminus_handle; |
| 464 | uint16_t effecter_id; |
| 465 | uint16_t entity_type; |
| 466 | uint16_t entity_instance; |
| 467 | uint16_t container_id; |
| 468 | uint16_t effecter_semantic_id; |
| 469 | uint8_t effecter_init; |
| 470 | bool8_t effecter_auxiliary_names; |
| 471 | uint8_t base_unit; |
| 472 | int8_t unit_modifier; |
| 473 | uint8_t rate_unit; |
| 474 | uint8_t base_oem_unit_handle; |
| 475 | uint8_t aux_unit; |
| 476 | int8_t aux_unit_modifier; |
| 477 | uint8_t aux_rate_unit; |
| 478 | uint8_t aux_oem_unit_handle; |
| 479 | bool8_t is_linear; |
| 480 | uint8_t effecter_data_size; |
| 481 | real32_t resolution; |
| 482 | real32_t offset; |
| 483 | uint16_t accuracy; |
| 484 | uint8_t plus_tolerance; |
| 485 | uint8_t minus_tolerance; |
| 486 | real32_t state_transition_interval; |
| 487 | real32_t transition_interval; |
| 488 | union_effecter_data_size max_set_table; |
| 489 | union_effecter_data_size min_set_table; |
| 490 | uint8_t range_field_format; |
| 491 | bitfield8_t range_field_support; |
| 492 | union_range_field_format nominal_value; |
| 493 | union_range_field_format normal_max; |
| 494 | union_range_field_format normal_min; |
| 495 | union_range_field_format rated_max; |
| 496 | union_range_field_format rated_min; |
| 497 | } __attribute__((packed)); |
| 498 | |
Deepak Kodihalli | c6e8fb5 | 2019-05-02 08:35:31 -0500 | [diff] [blame] | 499 | /** @struct state_effecter_possible_states |
| 500 | * |
| 501 | * Structure representing state enums for state effecter |
| 502 | */ |
| 503 | struct state_effecter_possible_states { |
| 504 | uint16_t state_set_id; |
| 505 | uint8_t possible_states_size; |
| 506 | bitfield8_t states[1]; |
| 507 | } __attribute__((packed)); |
| 508 | |
Zach Clark | b728eee | 2020-06-18 10:01:31 -0500 | [diff] [blame] | 509 | /** @brief Encode PLDM state effecter PDR |
| 510 | * |
| 511 | * @param[in/out] effecter Structure to encode. All members of |
| 512 | * effecter, except those mentioned in |
| 513 | * the @note below, should be initialized |
| 514 | * by the caller. |
| 515 | * @param[in] allocation_size Size of effecter allocation in bytes |
| 516 | * @param[in] possible_states Possible effecter states |
| 517 | * @param[in] possible_states_size Size of possible effecter states in |
| 518 | * bytes |
| 519 | * @param[out] actual_size Size of effecter PDR. Set to 0 on |
| 520 | * error. |
| 521 | * @return int pldm_completion_codes |
| 522 | * PLDM_SUCCESS/PLDM_ERROR/PLDM_ERROR_INVALID_LENGTH |
| 523 | * |
| 524 | * @note The effecter parameter will be encoded in place. |
| 525 | * @note Caller is responsible for allocation of the effecter parameter. Caller |
| 526 | * must allocate enough space for the base structure and the |
| 527 | * effecter->possible_states array, otherwise the function will fail. |
| 528 | * @note effecter->hdr.length, .type, and .version will be set appropriately. |
| 529 | */ |
| 530 | int encode_state_effecter_pdr( |
| 531 | struct pldm_state_effecter_pdr *effecter, size_t allocation_size, |
| 532 | const struct state_effecter_possible_states *possible_states, |
| 533 | size_t possible_states_size, size_t *actual_size); |
| 534 | |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 535 | /** @struct set_effecter_state_field |
| 536 | * |
| 537 | * Structure representing a stateField in SetStateEffecterStates command */ |
| 538 | |
| 539 | typedef struct state_field_for_state_effecter_set { |
Deepak Kodihalli | 826c9d4 | 2020-05-26 01:58:06 -0500 | [diff] [blame] | 540 | uint8_t set_request; //!< Whether to change the state |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 541 | uint8_t effecter_state; //!< Expected state of the effecter |
| 542 | } __attribute__((packed)) set_effecter_state_field; |
| 543 | |
Jolie Ku | 3557bad | 2020-03-02 16:22:57 +0800 | [diff] [blame] | 544 | /** @struct get_sensor_readings_field |
| 545 | * |
| 546 | * Structure representing a stateField in GetStateSensorReadings command */ |
| 547 | |
| 548 | typedef struct state_field_for_get_state_sensor_readings { |
| 549 | uint8_t sensor_op_state; //!< The state of the sensor itself |
Deepak Kodihalli | 826c9d4 | 2020-05-26 01:58:06 -0500 | [diff] [blame] | 550 | uint8_t present_state; //!< Return a state value |
Jolie Ku | 3557bad | 2020-03-02 16:22:57 +0800 | [diff] [blame] | 551 | uint8_t previous_state; //!< The state that the presentState was entered |
| 552 | //! from. This must be different from the |
| 553 | //! present state |
Deepak Kodihalli | 826c9d4 | 2020-05-26 01:58:06 -0500 | [diff] [blame] | 554 | uint8_t event_state; //!< Return a state value from a PLDM State Set |
Jolie Ku | 3557bad | 2020-03-02 16:22:57 +0800 | [diff] [blame] | 555 | //! that is associated with the sensor |
| 556 | } __attribute__((packed)) get_sensor_state_field; |
| 557 | |
Priyanga | 7257fdf | 2019-06-10 01:59:45 -0500 | [diff] [blame] | 558 | /** @struct PLDM_SetStateEffecterStates_Request |
| 559 | * |
| 560 | * Structure representing PLDM set state effecter states request. |
| 561 | */ |
| 562 | struct pldm_set_state_effecter_states_req { |
| 563 | uint16_t effecter_id; |
| 564 | uint8_t comp_effecter_count; |
| 565 | set_effecter_state_field field[8]; |
| 566 | } __attribute__((packed)); |
| 567 | |
George Liu | 9a3c6eb | 2021-10-27 10:50:28 +0800 | [diff] [blame] | 568 | /** @struct pldm_get_pdr_repository_info_resp |
| 569 | * |
| 570 | * Structure representing GetPDRRepositoryInfo response packet |
| 571 | */ |
| 572 | struct pldm_pdr_repository_info_resp { |
| 573 | uint8_t completion_code; |
| 574 | uint8_t repository_state; |
| 575 | uint8_t update_time[PLDM_TIMESTAMP104_SIZE]; |
| 576 | uint8_t oem_update_time[PLDM_TIMESTAMP104_SIZE]; |
| 577 | uint32_t record_count; |
| 578 | uint32_t repository_size; |
| 579 | uint32_t largest_record_size; |
| 580 | uint8_t data_transfer_handle_timeout; |
| 581 | } __attribute__((packed)); |
| 582 | |
Sampa Misra | 7fcfb66 | 2019-05-08 13:13:53 -0500 | [diff] [blame] | 583 | /** @struct pldm_get_pdr_resp |
| 584 | * |
| 585 | * structure representing GetPDR response packet |
| 586 | * transfer CRC is not part of the structure and will be |
| 587 | * added at the end of last packet in multipart transfer |
| 588 | */ |
| 589 | struct pldm_get_pdr_resp { |
| 590 | uint8_t completion_code; |
| 591 | uint32_t next_record_handle; |
| 592 | uint32_t next_data_transfer_handle; |
| 593 | uint8_t transfer_flag; |
| 594 | uint16_t response_count; |
| 595 | uint8_t record_data[1]; |
| 596 | } __attribute__((packed)); |
| 597 | |
| 598 | /** @struct pldm_get_pdr_req |
| 599 | * |
| 600 | * structure representing GetPDR request packet |
| 601 | */ |
| 602 | struct pldm_get_pdr_req { |
| 603 | uint32_t record_handle; |
| 604 | uint32_t data_transfer_handle; |
| 605 | uint8_t transfer_op_flag; |
| 606 | uint16_t request_count; |
| 607 | uint16_t record_change_number; |
| 608 | } __attribute__((packed)); |
| 609 | |
Sagar Srinivas | 535bccd | 2021-03-24 12:18:26 -0500 | [diff] [blame] | 610 | /** @struct pldm_set_event_receiver_req |
| 611 | * |
| 612 | * Structure representing SetEventReceiver command. |
| 613 | * This structure applies only for MCTP as a transport type. |
| 614 | */ |
| 615 | struct pldm_set_event_receiver_req { |
| 616 | uint8_t event_message_global_enable; |
| 617 | uint8_t transport_protocol_type; |
| 618 | uint8_t event_receiver_address_info; |
| 619 | uint16_t heartbeat_timer; |
| 620 | } __attribute__((packed)); |
| 621 | |
George Liu | 30b859f | 2020-01-07 15:03:22 +0800 | [diff] [blame] | 622 | /** @struct pldm_set_numeric_effecter_value_req |
| 623 | * |
| 624 | * structure representing SetNumericEffecterValue request packet |
| 625 | */ |
| 626 | struct pldm_set_numeric_effecter_value_req { |
| 627 | uint16_t effecter_id; |
| 628 | uint8_t effecter_data_size; |
| 629 | uint8_t effecter_value[1]; |
| 630 | } __attribute__((packed)); |
| 631 | |
Jolie Ku | 3557bad | 2020-03-02 16:22:57 +0800 | [diff] [blame] | 632 | /** @struct pldm_get_state_sensor_readings_req |
| 633 | * |
| 634 | * Structure representing PLDM get state sensor readings request. |
| 635 | */ |
| 636 | struct pldm_get_state_sensor_readings_req { |
| 637 | uint16_t sensor_id; |
| 638 | bitfield8_t sensor_rearm; |
| 639 | uint8_t reserved; |
| 640 | } __attribute__((packed)); |
| 641 | |
| 642 | /** @struct pldm_get_state_sensor_readings_resp |
| 643 | * |
| 644 | * Structure representing PLDM get state sensor readings response. |
| 645 | */ |
| 646 | struct pldm_get_state_sensor_readings_resp { |
| 647 | uint8_t completion_code; |
| 648 | uint8_t comp_sensor_count; |
| 649 | get_sensor_state_field field[1]; |
| 650 | } __attribute__((packed)); |
| 651 | |
Zahed Hossain | d4abab1 | 2020-02-06 03:36:43 -0600 | [diff] [blame] | 652 | /** @struct pldm_sensor_event |
| 653 | * |
| 654 | * structure representing sensorEventClass |
| 655 | */ |
| 656 | struct pldm_sensor_event_data { |
| 657 | uint16_t sensor_id; |
| 658 | uint8_t sensor_event_class_type; |
| 659 | uint8_t event_class[1]; |
| 660 | } __attribute__((packed)); |
| 661 | |
| 662 | /** @struct pldm_state_sensor_state |
| 663 | * |
| 664 | * structure representing sensorEventClass for stateSensorState |
| 665 | */ |
| 666 | struct pldm_sensor_event_state_sensor_state { |
| 667 | uint8_t sensor_offset; |
| 668 | uint8_t event_state; |
| 669 | uint8_t previous_event_state; |
| 670 | } __attribute__((packed)); |
| 671 | |
| 672 | /** @struct pldm_sensor_event_numeric_sensor_state |
| 673 | * |
| 674 | * structure representing sensorEventClass for stateSensorState |
| 675 | */ |
| 676 | struct pldm_sensor_event_numeric_sensor_state { |
| 677 | uint8_t event_state; |
| 678 | uint8_t previous_event_state; |
| 679 | uint8_t sensor_data_size; |
| 680 | uint8_t present_reading[1]; |
| 681 | } __attribute__((packed)); |
| 682 | |
| 683 | /** @struct pldm_sensor_event_sensor_op_state |
| 684 | * |
| 685 | * structure representing sensorEventClass for SensorOpState |
| 686 | */ |
| 687 | struct pldm_sensor_event_sensor_op_state { |
| 688 | uint8_t present_op_state; |
| 689 | uint8_t previous_op_state; |
| 690 | } __attribute__((packed)); |
| 691 | |
| 692 | /** @struct pldm_platform_event_message_req |
| 693 | * |
| 694 | * structure representing PlatformEventMessage command request data |
| 695 | */ |
| 696 | struct pldm_platform_event_message_req { |
| 697 | uint8_t format_version; |
| 698 | uint8_t tid; |
| 699 | uint8_t event_class; |
| 700 | uint8_t event_data[1]; |
| 701 | } __attribute__((packed)); |
| 702 | |
| 703 | /** @struct pldm_platform_event_message_response |
| 704 | * |
| 705 | * structure representing PlatformEventMessage command response data |
| 706 | */ |
| 707 | struct pldm_platform_event_message_resp { |
| 708 | uint8_t completion_code; |
Pavithra Barithaya | 2ea1f07 | 2020-04-03 09:30:23 -0500 | [diff] [blame] | 709 | uint8_t platform_event_status; |
Zahed Hossain | d4abab1 | 2020-02-06 03:36:43 -0600 | [diff] [blame] | 710 | } __attribute__((packed)); |
| 711 | |
| 712 | /** @struct pldm_pdr_repository_chg_event_data |
| 713 | * |
| 714 | * structure representing pldmPDRRepositoryChgEvent class eventData |
| 715 | */ |
| 716 | struct pldm_pdr_repository_chg_event_data { |
| 717 | uint8_t event_data_format; |
| 718 | uint8_t number_of_change_records; |
| 719 | uint8_t change_records[1]; |
| 720 | } __attribute__((packed)); |
| 721 | |
| 722 | /** @struct pldm_pdr_repository_chg_event_change_record_data |
| 723 | * |
| 724 | * structure representing pldmPDRRepositoryChgEvent class eventData's change |
| 725 | * record data |
| 726 | */ |
| 727 | struct pldm_pdr_repository_change_record_data { |
| 728 | uint8_t event_data_operation; |
| 729 | uint8_t number_of_change_entries; |
| 730 | uint32_t change_entry[1]; |
| 731 | } __attribute__((packed)); |
| 732 | |
Jolie Ku | 6787f17 | 2020-03-19 11:15:53 +0800 | [diff] [blame] | 733 | /** @struct pldm_get_numeric_effecter_value_req |
| 734 | * |
| 735 | * structure representing GetNumericEffecterValue request packet |
| 736 | */ |
| 737 | struct pldm_get_numeric_effecter_value_req { |
| 738 | uint16_t effecter_id; |
| 739 | } __attribute__((packed)); |
| 740 | |
| 741 | /** @struct pldm_get_numeric_effecter_value_resp |
| 742 | * |
| 743 | * structure representing GetNumericEffecterValue response packet |
| 744 | */ |
| 745 | struct pldm_get_numeric_effecter_value_resp { |
| 746 | uint8_t completion_code; |
| 747 | uint8_t effecter_data_size; |
| 748 | uint8_t effecter_oper_state; |
| 749 | uint8_t pending_and_present_values[1]; |
| 750 | } __attribute__((packed)); |
| 751 | |
Jolie Ku | f798c8f | 2020-04-14 11:18:06 +0800 | [diff] [blame] | 752 | /** @struct pldm_get_sensor_reading_req |
| 753 | * |
| 754 | * Structure representing PLDM get sensor reading request |
| 755 | */ |
| 756 | struct pldm_get_sensor_reading_req { |
| 757 | uint16_t sensor_id; |
| 758 | bool8_t rearm_event_state; |
| 759 | } __attribute__((packed)); |
| 760 | |
| 761 | /** @struct pldm_get_sensor_reading_resp |
| 762 | * |
| 763 | * Structure representing PLDM get sensor reading response |
| 764 | */ |
| 765 | struct pldm_get_sensor_reading_resp { |
| 766 | uint8_t completion_code; |
| 767 | uint8_t sensor_data_size; |
| 768 | uint8_t sensor_operational_state; |
| 769 | uint8_t sensor_event_message_enable; |
| 770 | uint8_t present_state; |
| 771 | uint8_t previous_state; |
| 772 | uint8_t event_state; |
| 773 | uint8_t present_reading[1]; |
| 774 | } __attribute__((packed)); |
| 775 | |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 776 | /* Responder */ |
| 777 | |
George Liu | 30b859f | 2020-01-07 15:03:22 +0800 | [diff] [blame] | 778 | /* SetNumericEffecterValue */ |
| 779 | |
| 780 | /** @brief Decode SetNumericEffecterValue request data |
| 781 | * |
| 782 | * @param[in] msg - Request message |
| 783 | * @param[in] payload_length - Length of request message payload |
| 784 | * @param[out] effecter_id - used to identify and access the effecter |
| 785 | * @param[out] effecter_data_size - The bit width and format of the setting |
| 786 | * value for the effecter. |
| 787 | * value:{uint8,sint8,uint16,sint16,uint32,sint32} |
| 788 | * @param[out] effecter_value - The setting value of numeric effecter being |
| 789 | * requested. |
| 790 | * @return pldm_completion_codes |
| 791 | */ |
| 792 | int decode_set_numeric_effecter_value_req(const struct pldm_msg *msg, |
| 793 | size_t payload_length, |
| 794 | uint16_t *effecter_id, |
| 795 | uint8_t *effecter_data_size, |
| 796 | uint8_t *effecter_value); |
| 797 | |
| 798 | /** @brief Create a PLDM response message for SetNumericEffecterValue |
| 799 | * |
| 800 | * @param[in] instance_id - Message's instance id |
| 801 | * @param[in] completion_code - PLDM completion code |
| 802 | * @param[out] msg - Message will be written to this |
| 803 | * @param[in] payload_length - Length of request message payload |
| 804 | * @return pldm_completion_codes |
| 805 | * @note Caller is responsible for memory alloc and dealloc of param |
| 806 | * 'msg.body.payload' |
| 807 | */ |
| 808 | int encode_set_numeric_effecter_value_resp(uint8_t instance_id, |
| 809 | uint8_t completion_code, |
| 810 | struct pldm_msg *msg, |
| 811 | size_t payload_length); |
| 812 | |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 813 | /* SetStateEffecterStates */ |
| 814 | |
| 815 | /** @brief Create a PLDM response message for SetStateEffecterStates |
| 816 | * |
| 817 | * @param[in] instance_id - Message's instance id |
| 818 | * @param[in] completion_code - PLDM completion code |
| 819 | * @param[out] msg - Message will be written to this |
| 820 | * @return pldm_completion_codes |
| 821 | * @note Caller is responsible for memory alloc and dealloc of param |
| 822 | * 'msg.body.payload' |
| 823 | */ |
| 824 | |
| 825 | int encode_set_state_effecter_states_resp(uint8_t instance_id, |
| 826 | uint8_t completion_code, |
| 827 | struct pldm_msg *msg); |
| 828 | |
| 829 | /** @brief Decode SetStateEffecterStates request data |
| 830 | * |
Zahed Hossain | 223a73d | 2019-07-04 12:46:18 -0500 | [diff] [blame] | 831 | * @param[in] msg - Request message |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 832 | * @param[in] payload_length - Length of request message payload |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 833 | * @param[out] effecter_id - used to identify and access the effecter |
| 834 | * @param[out] comp_effecter_count - number of individual sets of effecter |
| 835 | * information. Upto eight sets of state effecter info can be accessed |
| 836 | * for a given effecter. |
| 837 | * @param[out] field - each unit is an instance of the stateFileld structure |
| 838 | * that is used to set the requested state for a particular effecter |
| 839 | * within the state effecter. This field holds the starting address of |
| 840 | * the stateField values. The user is responsible to allocate the |
| 841 | * memory prior to calling this command. Since the state field count is |
| 842 | * not known in advance, the user should allocate the maximum size |
| 843 | * always, which is 8 in number. |
| 844 | * @return pldm_completion_codes |
| 845 | */ |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 846 | |
Zahed Hossain | 223a73d | 2019-07-04 12:46:18 -0500 | [diff] [blame] | 847 | int decode_set_state_effecter_states_req(const struct pldm_msg *msg, |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 848 | size_t payload_length, |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 849 | uint16_t *effecter_id, |
| 850 | uint8_t *comp_effecter_count, |
| 851 | set_effecter_state_field *field); |
| 852 | |
Sampa Misra | 7fcfb66 | 2019-05-08 13:13:53 -0500 | [diff] [blame] | 853 | /* GetPDR */ |
| 854 | |
| 855 | /** @brief Create a PLDM response message for GetPDR |
| 856 | * |
| 857 | * @param[in] instance_id - Message's instance id |
| 858 | * @param[in] completion_code - PLDM completion code |
| 859 | * @param[in] next_record_hndl - The recordHandle for the PDR that is next in |
| 860 | * the PDR Repository |
| 861 | * @param[in] next_data_transfer_hndl - A handle that identifies the next |
| 862 | * portion of the PDR data to be transferred, if any |
| 863 | * @param[in] transfer_flag - Indicates the portion of PDR data being |
| 864 | * transferred |
| 865 | * @param[in] resp_cnt - The number of recordData bytes returned in this |
| 866 | * response |
| 867 | * @param[in] record_data - PDR data bytes of length resp_cnt |
| 868 | * @param[in] transfer_crc - A CRC-8 for the overall PDR. This is present only |
| 869 | * in the last part of a PDR being transferred |
| 870 | * @param[out] msg - Message will be written to this |
| 871 | * @return pldm_completion_codes |
| 872 | * @note Caller is responsible for memory alloc and dealloc of param |
| 873 | * 'msg.payload' |
| 874 | */ |
| 875 | int encode_get_pdr_resp(uint8_t instance_id, uint8_t completion_code, |
| 876 | uint32_t next_record_hndl, |
| 877 | uint32_t next_data_transfer_hndl, uint8_t transfer_flag, |
| 878 | uint16_t resp_cnt, const uint8_t *record_data, |
| 879 | uint8_t transfer_crc, struct pldm_msg *msg); |
| 880 | |
| 881 | /** @brief Decode GetPDR request data |
| 882 | * |
| 883 | * @param[in] msg - Request message |
| 884 | * @param[in] payload_length - Length of request message payload |
| 885 | * @param[out] record_hndl - The recordHandle value for the PDR to be retrieved |
| 886 | * @param[out] data_transfer_hndl - Handle used to identify a particular |
| 887 | * multipart PDR data transfer operation |
| 888 | * @param[out] transfer_op_flag - Flag to indicate the first or subsequent |
| 889 | * portion of transfer |
| 890 | * @param[out] request_cnt - The maximum number of record bytes requested |
| 891 | * @param[out] record_chg_num - Used to determine whether the PDR has changed |
| 892 | * while PDR transfer is going on |
| 893 | * @return pldm_completion_codes |
| 894 | */ |
| 895 | |
| 896 | int decode_get_pdr_req(const struct pldm_msg *msg, size_t payload_length, |
| 897 | uint32_t *record_hndl, uint32_t *data_transfer_hndl, |
| 898 | uint8_t *transfer_op_flag, uint16_t *request_cnt, |
| 899 | uint16_t *record_chg_num); |
| 900 | |
Jolie Ku | 3557bad | 2020-03-02 16:22:57 +0800 | [diff] [blame] | 901 | /* GetStateSensorReadings */ |
| 902 | |
| 903 | /** @brief Decode GetStateSensorReadings request data |
| 904 | * |
| 905 | * @param[in] msg - Request message |
| 906 | * @param[in] payload_length - Length of request message payload |
| 907 | * @param[out] sensor_id - used to identify and access the simple or composite |
| 908 | * sensor |
| 909 | * @param[out] sensor_rearm - Each bit location in this field corresponds to a |
| 910 | * particular sensor within the state sensor, where bit [0] corresponds |
| 911 | * to the first state sensor (sensor offset 0) and bit [7] corresponds |
| 912 | * to the eighth sensor (sensor offset 7), sequentially. |
| 913 | * @param[out] reserved - value: 0x00 |
| 914 | * @return pldm_completion_codes |
| 915 | */ |
| 916 | |
| 917 | int decode_get_state_sensor_readings_req(const struct pldm_msg *msg, |
| 918 | size_t payload_length, |
| 919 | uint16_t *sensor_id, |
| 920 | bitfield8_t *sensor_rearm, |
| 921 | uint8_t *reserved); |
| 922 | |
| 923 | /** @brief Encode GetStateSensorReadings response data |
| 924 | * |
| 925 | * @param[in] instance_id - Message's instance id |
| 926 | * @param[in] completion_code - PLDM completion code |
| 927 | * @param[out] comp_sensor_count - The number of individual sets of sensor |
| 928 | * information that this command accesses |
| 929 | * @param[out] field - Each stateField is an instance of a stateField structure |
| 930 | * that is used to return the present operational state setting and the |
| 931 | * present state and event state for a particular set of sensor |
| 932 | * information contained within the state sensor |
| 933 | * @param[out] msg - Message will be written to this |
| 934 | * @return pldm_completion_codes |
| 935 | */ |
| 936 | |
| 937 | int encode_get_state_sensor_readings_resp(uint8_t instance_id, |
| 938 | uint8_t completion_code, |
| 939 | uint8_t comp_sensor_count, |
| 940 | get_sensor_state_field *field, |
| 941 | struct pldm_msg *msg); |
| 942 | |
Jolie Ku | 6787f17 | 2020-03-19 11:15:53 +0800 | [diff] [blame] | 943 | /* GetNumericEffecterValue */ |
| 944 | |
| 945 | /** @brief Decode GetNumericEffecterValue request data |
| 946 | * |
| 947 | * @param[in] msg - Request message |
| 948 | * @param[in] payload_length - Length of request message payload |
| 949 | * @param[out] effecter_id - used to identify and access the effecter |
| 950 | * @return pldm_completion_codes |
| 951 | */ |
| 952 | int decode_get_numeric_effecter_value_req(const struct pldm_msg *msg, |
| 953 | size_t payload_length, |
| 954 | uint16_t *effecter_id); |
| 955 | |
| 956 | /** @brief Create a PLDM response message for GetNumericEffecterValue |
| 957 | * |
| 958 | * @param[in] instance_id - Message's instance id |
| 959 | * @param[in] completion_code - PLDM completion code |
| 960 | * @param[in] effecter_data_size - The bit width and format of the setting |
| 961 | * value for the effecter. |
| 962 | * value:{uint8,sint8,uint16,sint16,uint32,sint32} |
| 963 | * @param[in] effecter_oper_state - The state of the effecter itself |
| 964 | * @param[in] pending_value - The pending numeric value setting of the |
| 965 | * effecter. The effecterDataSize field indicates the number of |
| 966 | * bits used for this field |
| 967 | * @param[in] present_value - The present numeric value setting of the |
| 968 | * effecter. The effecterDataSize indicates the number of bits |
| 969 | * used for this field |
| 970 | * @param[out] msg - Message will be written to this |
| 971 | * @param[in] payload_length - Length of request message payload |
| 972 | * @return pldm_completion_codes |
| 973 | * @note Caller is responsible for memory alloc and dealloc of param |
| 974 | * 'msg.payload' |
| 975 | */ |
| 976 | int encode_get_numeric_effecter_value_resp( |
| 977 | uint8_t instance_id, uint8_t completion_code, uint8_t effecter_data_size, |
| 978 | uint8_t effecter_oper_state, uint8_t *pending_value, uint8_t *present_value, |
| 979 | struct pldm_msg *msg, size_t payload_length); |
| 980 | |
Jolie Ku | f798c8f | 2020-04-14 11:18:06 +0800 | [diff] [blame] | 981 | /* GetSensorReading */ |
| 982 | |
| 983 | /** @brief Decode GetSensorReading request data |
| 984 | * |
| 985 | * @param[in] msg - Request message |
| 986 | * @param[in] payload_length - Length of request message payload |
| 987 | * @param[out] sensor_id - A handle that is used to identify and access |
| 988 | * the sensor |
| 989 | * @param[out] rearm_event_state - true = manually re-arm EventState after |
| 990 | * responding to this request, false = no manual re-arm |
| 991 | * @return pldm_completion_codes |
| 992 | */ |
| 993 | |
| 994 | int decode_get_sensor_reading_req(const struct pldm_msg *msg, |
| 995 | size_t payload_length, uint16_t *sensor_id, |
| 996 | bool8_t *rearm_event_state); |
| 997 | |
| 998 | /** @brief Encode GetSensorReading response data |
| 999 | * |
| 1000 | * @param[in] instance_id - Message's instance id |
| 1001 | * @param[in] completion_code - PLDM completion code |
| 1002 | * @param[out] sensor_data_size - The bit width and format of reading and |
| 1003 | * threshold values |
| 1004 | * @param[out] sensor_operational_state - The state of the sensor itself |
| 1005 | * @param[out] sensor_event_message_enable - value: { noEventGeneration, |
| 1006 | * eventsDisabled, eventsEnabled, opEventsOnlyEnabled, |
| 1007 | * stateEventsOnlyEnabled } |
| 1008 | * @param[out] present_state - The most recently assessed state value monitored |
| 1009 | * by the sensor |
| 1010 | * @param[out] previous_state - The state that the presentState was entered |
| 1011 | * from |
| 1012 | * @param[out] event_state - Indicates which threshold crossing assertion |
| 1013 | * events have been detected |
| 1014 | * @param[out] present_reading - The present value indicated by the sensor |
| 1015 | * @param[out] msg - Message will be written to this |
| 1016 | * @param[in] payload_length - Length of request message payload |
| 1017 | * @return pldm_completion_codes |
| 1018 | */ |
| 1019 | |
| 1020 | int encode_get_sensor_reading_resp( |
| 1021 | uint8_t instance_id, uint8_t completion_code, uint8_t sensor_data_size, |
| 1022 | uint8_t sensor_operational_state, uint8_t sensor_event_message_enable, |
| 1023 | uint8_t present_state, uint8_t previous_state, uint8_t event_state, |
| 1024 | uint8_t *present_reading, struct pldm_msg *msg, size_t payload_length); |
| 1025 | |
Sampa Misra | 7fcfb66 | 2019-05-08 13:13:53 -0500 | [diff] [blame] | 1026 | /* Requester */ |
| 1027 | |
George Liu | 9a3c6eb | 2021-10-27 10:50:28 +0800 | [diff] [blame] | 1028 | /*GetPDRRepositoryInfo*/ |
| 1029 | |
| 1030 | /** @brief Encode GetPDRRepositoryInfo response data |
| 1031 | * |
| 1032 | * @param[in] instance_id - Message's instance id |
| 1033 | * @param[in] completion_code - PLDM completion code |
| 1034 | * @param[in] repository_state - PLDM repository state |
| 1035 | * @param[in] update_time - When the standard PDR repository data was |
| 1036 | * originally created |
| 1037 | * @param[in] oem_update_time - when OEM PDRs in the PDR Repository were |
| 1038 | * originally created |
| 1039 | * @param[in] record_count - Total number of PDRs in this repository |
| 1040 | * @param[in] repository_size - Size of the PDR Repository in bytes |
| 1041 | * @param[in] largest_record_size - Size of the largest record in the PDR |
| 1042 | * Repository in bytes |
| 1043 | * @param[in] data_transfer_handle_timeout - Data transmission timeout |
| 1044 | * @param[out] msg - Message will be written to this |
| 1045 | * @return pldm_completion_codes |
| 1046 | */ |
| 1047 | int encode_get_pdr_repository_info_resp( |
| 1048 | uint8_t instance_id, uint8_t completion_code, uint8_t repository_state, |
| 1049 | const uint8_t *update_time, const uint8_t *oem_update_time, |
| 1050 | uint32_t record_count, uint32_t repository_size, |
| 1051 | uint32_t largest_record_size, uint8_t data_transfer_handle_timeout, |
| 1052 | struct pldm_msg *msg); |
| 1053 | |
George Liu | 820a9a5 | 2019-11-26 14:43:59 +0800 | [diff] [blame] | 1054 | /* GetPDR */ |
| 1055 | |
| 1056 | /** @brief Create a PLDM request message for GetPDR |
| 1057 | * |
| 1058 | * @param[in] instance_id - Message's instance id |
| 1059 | * @param[in] record_hndl - The recordHandle value for the PDR to be retrieved |
| 1060 | * @param[in] data_transfer_hndl - Handle used to identify a particular |
| 1061 | * multipart PDR data transfer operation |
| 1062 | * @param[in] transfer_op_flag - Flag to indicate the first or subsequent |
| 1063 | * portion of transfer |
| 1064 | * @param[in] request_cnt - The maximum number of record bytes requested |
| 1065 | * @param[in] record_chg_num - Used to determine whether the PDR has changed |
| 1066 | * while PDR transfer is going on |
| 1067 | * @param[out] msg - Message will be written to this |
| 1068 | * @param[in] payload_length - Length of request message payload |
| 1069 | * @return pldm_completion_codes |
| 1070 | * @note Caller is responsible for memory alloc and dealloc of param |
| 1071 | * 'msg.payload' |
| 1072 | */ |
| 1073 | int encode_get_pdr_req(uint8_t instance_id, uint32_t record_hndl, |
| 1074 | uint32_t data_transfer_hndl, uint8_t transfer_op_flag, |
| 1075 | uint16_t request_cnt, uint16_t record_chg_num, |
| 1076 | struct pldm_msg *msg, size_t payload_length); |
| 1077 | |
| 1078 | /** @brief Decode GetPDR response data |
| 1079 | * |
George Liu | 684a716 | 2019-12-06 15:10:52 +0800 | [diff] [blame] | 1080 | * Note: |
| 1081 | * * If the return value is not PLDM_SUCCESS, it represents a |
| 1082 | * transport layer error. |
| 1083 | * * If the completion_code value is not PLDM_SUCCESS, it represents a |
| 1084 | * protocol layer error and all the out-parameters are invalid. |
| 1085 | * |
George Liu | 820a9a5 | 2019-11-26 14:43:59 +0800 | [diff] [blame] | 1086 | * @param[in] msg - Request message |
| 1087 | * @param[in] payload_length - Length of request message payload |
| 1088 | * @param[out] completion_code - PLDM completion code |
| 1089 | * @param[out] next_record_hndl - The recordHandle for the PDR that is next in |
| 1090 | * the PDR Repository |
| 1091 | * @param[out] next_data_transfer_hndl - A handle that identifies the next |
| 1092 | * portion of the PDR data to be transferred, if any |
| 1093 | * @param[out] transfer_flag - Indicates the portion of PDR data being |
| 1094 | * transferred |
| 1095 | * @param[out] resp_cnt - The number of recordData bytes returned in this |
| 1096 | * response |
Zach Clark | 3dba2bf | 2020-03-31 10:58:03 -0500 | [diff] [blame] | 1097 | * @param[out] record_data - PDR data bytes of length resp_cnt, or NULL to |
| 1098 | * skip the copy and place the actual length in resp_cnt. |
George Liu | 820a9a5 | 2019-11-26 14:43:59 +0800 | [diff] [blame] | 1099 | * @param[in] record_data_length - Length of record_data |
| 1100 | * @param[out] transfer_crc - A CRC-8 for the overall PDR. This is present only |
| 1101 | * in the last part of a PDR being transferred |
| 1102 | * @return pldm_completion_codes |
| 1103 | */ |
| 1104 | int decode_get_pdr_resp(const struct pldm_msg *msg, size_t payload_length, |
| 1105 | uint8_t *completion_code, uint32_t *next_record_hndl, |
| 1106 | uint32_t *next_data_transfer_hndl, |
| 1107 | uint8_t *transfer_flag, uint16_t *resp_cnt, |
| 1108 | uint8_t *record_data, size_t record_data_length, |
| 1109 | uint8_t *transfer_crc); |
| 1110 | |
Sampa Misra | 7fcfb66 | 2019-05-08 13:13:53 -0500 | [diff] [blame] | 1111 | /* SetStateEffecterStates */ |
| 1112 | |
vkaverap | 98a2c19 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 1113 | /** @brief Create a PLDM request message for SetStateEffecterStates |
| 1114 | * |
| 1115 | * @param[in] instance_id - Message's instance id |
| 1116 | * @param[in] effecter_id - used to identify and access the effecter |
| 1117 | * @param[in] comp_effecter_count - number of individual sets of effecter |
| 1118 | * information. Upto eight sets of state effecter info can be accessed |
| 1119 | * for a given effecter. |
| 1120 | * @param[in] field - each unit is an instance of the stateField structure |
| 1121 | * that is used to set the requested state for a particular effecter |
| 1122 | * within the state effecter. This field holds the starting address of |
| 1123 | * the stateField values. The user is responsible to allocate the |
| 1124 | * memory prior to calling this command. The user has to allocate the |
| 1125 | * field parameter as sizeof(set_effecter_state_field) * |
| 1126 | * comp_effecter_count |
| 1127 | * @param[out] msg - Message will be written to this |
| 1128 | * @return pldm_completion_codes |
| 1129 | * @note Caller is responsible for memory alloc and dealloc of param |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 1130 | * 'msg.payload' |
vkaverap | 98a2c19 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 1131 | */ |
| 1132 | |
| 1133 | int encode_set_state_effecter_states_req(uint8_t instance_id, |
| 1134 | uint16_t effecter_id, |
| 1135 | uint8_t comp_effecter_count, |
| 1136 | set_effecter_state_field *field, |
| 1137 | struct pldm_msg *msg); |
| 1138 | |
| 1139 | /** @brief Decode SetStateEffecterStates response data |
George Liu | 684a716 | 2019-12-06 15:10:52 +0800 | [diff] [blame] | 1140 | * |
| 1141 | * Note: |
| 1142 | * * If the return value is not PLDM_SUCCESS, it represents a |
| 1143 | * transport layer error. |
| 1144 | * * If the completion_code value is not PLDM_SUCCESS, it represents a |
| 1145 | * protocol layer error and all the out-parameters are invalid. |
| 1146 | * |
Zahed Hossain | 223a73d | 2019-07-04 12:46:18 -0500 | [diff] [blame] | 1147 | * @param[in] msg - Request message |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 1148 | * @param[in] payload_length - Length of response message payload |
vkaverap | 98a2c19 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 1149 | * @param[out] completion_code - PLDM completion code |
| 1150 | * @return pldm_completion_codes |
| 1151 | */ |
Zahed Hossain | 223a73d | 2019-07-04 12:46:18 -0500 | [diff] [blame] | 1152 | int decode_set_state_effecter_states_resp(const struct pldm_msg *msg, |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 1153 | size_t payload_length, |
vkaverap | 98a2c19 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 1154 | uint8_t *completion_code); |
George Liu | 30b859f | 2020-01-07 15:03:22 +0800 | [diff] [blame] | 1155 | |
| 1156 | /* SetNumericEffecterValue */ |
| 1157 | |
| 1158 | /** @brief Create a PLDM request message for SetNumericEffecterValue |
| 1159 | * |
| 1160 | * @param[in] instance_id - Message's instance id |
| 1161 | * @param[in] effecter_id - used to identify and access the effecter |
| 1162 | * @param[in] effecter_data_size - The bit width and format of the setting |
| 1163 | * value for the effecter. |
| 1164 | * value:{uint8,sint8,uint16,sint16,uint32,sint32} |
| 1165 | * @param[in] effecter_value - The setting value of numeric effecter being |
| 1166 | * requested. |
| 1167 | * @param[in] payload_length - Length of request message payload |
| 1168 | * @param[out] msg - Message will be written to this |
| 1169 | * @return pldm_completion_codes |
| 1170 | * @note Caller is responsible for memory alloc and dealloc of param |
| 1171 | * 'msg.payload' |
| 1172 | */ |
| 1173 | int encode_set_numeric_effecter_value_req( |
| 1174 | uint8_t instance_id, uint16_t effecter_id, uint8_t effecter_data_size, |
| 1175 | uint8_t *effecter_value, struct pldm_msg *msg, size_t payload_length); |
| 1176 | |
| 1177 | /** @brief Decode SetNumericEffecterValue response data |
| 1178 | * @param[in] msg - Request message |
| 1179 | * @param[in] payload_length - Length of response message payload |
| 1180 | * @param[out] completion_code - PLDM completion code |
| 1181 | * @return pldm_completion_codes |
| 1182 | */ |
| 1183 | int decode_set_numeric_effecter_value_resp(const struct pldm_msg *msg, |
| 1184 | size_t payload_length, |
| 1185 | uint8_t *completion_code); |
| 1186 | |
Jolie Ku | 3557bad | 2020-03-02 16:22:57 +0800 | [diff] [blame] | 1187 | /** @brief Create a PLDM request message for GetStateSensorReadings |
| 1188 | * |
| 1189 | * @param[in] instance_id - Message's instance id |
| 1190 | * @param[in] sensor_id - used to identify and access the simple or composite |
| 1191 | * sensor |
| 1192 | * @param[in] sensorRearm - Each bit location in this field corresponds to a |
| 1193 | * particular sensor within the state sensor, where bit [0] corresponds |
| 1194 | * to the first state sensor (sensor offset 0) and bit [7] corresponds |
| 1195 | * to the eighth sensor (sensor offset 7), sequentially |
| 1196 | * @param[in] reserved - value: 0x00 |
| 1197 | * @param[out] msg - Message will be written to this |
| 1198 | * @return pldm_completion_codes |
| 1199 | * @note Caller is responsible for memory alloc and dealloc of param |
| 1200 | * 'msg.payload' |
| 1201 | */ |
Jolie Ku | 3557bad | 2020-03-02 16:22:57 +0800 | [diff] [blame] | 1202 | int encode_get_state_sensor_readings_req(uint8_t instance_id, |
| 1203 | uint16_t sensor_id, |
| 1204 | bitfield8_t sensor_rearm, |
| 1205 | uint8_t reserved, |
| 1206 | struct pldm_msg *msg); |
| 1207 | |
| 1208 | /** @brief Decode GetStateSensorReadings response data |
| 1209 | * |
| 1210 | * @param[in] msg - Request message |
| 1211 | * @param[in] payload_length - Length of response message payload |
| 1212 | * @param[out] completion_code - PLDM completion code |
| 1213 | * @param[in,out] comp_sensor_count - The number of individual sets of sensor |
| 1214 | * information that this command accesses |
| 1215 | * @param[out] field - Each stateField is an instance of a stateField structure |
| 1216 | * that is used to return the present operational state setting and the |
| 1217 | * present state and event state for a particular set of sensor |
| 1218 | * information contained within the state sensor |
| 1219 | * @return pldm_completion_codes |
| 1220 | */ |
| 1221 | |
| 1222 | int decode_get_state_sensor_readings_resp(const struct pldm_msg *msg, |
| 1223 | size_t payload_length, |
| 1224 | uint8_t *completion_code, |
| 1225 | uint8_t *comp_sensor_count, |
| 1226 | get_sensor_state_field *field); |
| 1227 | |
Zahed Hossain | d4abab1 | 2020-02-06 03:36:43 -0600 | [diff] [blame] | 1228 | /* PlatformEventMessage */ |
| 1229 | |
| 1230 | /** @brief Decode PlatformEventMessage request data |
| 1231 | * @param[in] msg - Request message |
| 1232 | * @param[in] payload_length - Length of response message payload |
| 1233 | * @param[out] format_version - Version of the event format |
| 1234 | * @param[out] tid - Terminus ID for the terminus that originated the event |
| 1235 | * message |
| 1236 | * @param[out] event_class - The class of event being sent |
| 1237 | * @param[out] event_data_offset - Offset where the event data should be read |
| 1238 | * from pldm msg |
| 1239 | * @return pldm_completion_codes |
| 1240 | */ |
| 1241 | int decode_platform_event_message_req(const struct pldm_msg *msg, |
| 1242 | size_t payload_length, |
| 1243 | uint8_t *format_version, uint8_t *tid, |
| 1244 | uint8_t *event_class, |
| 1245 | size_t *event_data_offset); |
| 1246 | |
| 1247 | /** @brief Encode PlatformEventMessage response data |
| 1248 | * @param[in] instance_id - Message's instance id |
| 1249 | * @param[in] completion_code - PLDM completion code |
Pavithra Barithaya | 2ea1f07 | 2020-04-03 09:30:23 -0500 | [diff] [blame] | 1250 | * @param[in] platform_event_status - Response status of the event message |
| 1251 | * command |
Zahed Hossain | d4abab1 | 2020-02-06 03:36:43 -0600 | [diff] [blame] | 1252 | * @param[out] msg - Message will be written to this |
| 1253 | * @return pldm_completion_codes |
| 1254 | * @note Caller is responsible for memory alloc and dealloc of param |
| 1255 | * 'msg.payload' |
| 1256 | */ |
| 1257 | int encode_platform_event_message_resp(uint8_t instance_id, |
Pavithra Barithaya | 2ea1f07 | 2020-04-03 09:30:23 -0500 | [diff] [blame] | 1258 | uint8_t completion_code, |
| 1259 | uint8_t platform_event_status, |
Zahed Hossain | d4abab1 | 2020-02-06 03:36:43 -0600 | [diff] [blame] | 1260 | struct pldm_msg *msg); |
| 1261 | |
Pavithra Barithaya | 35f2b2c | 2020-04-08 01:35:56 -0500 | [diff] [blame] | 1262 | /** @brief Encode PlatformEventMessage request data |
| 1263 | * @param[in] instance_id - Message's instance id |
| 1264 | * @param[in] format_version - Version of the event format |
| 1265 | * @param[in] tid - Terminus ID for the terminus that originated the event |
| 1266 | * message |
| 1267 | * @param[in] event_class - The class of event being sent |
| 1268 | * @param[in] event_data - the event data should be read from pldm msg |
| 1269 | * @param[in] event_data_length - Length of the event data |
| 1270 | * @param[out] msg - Request message |
| 1271 | * @return pldm_completion_codes |
| 1272 | * @note Caller is responsible for memory alloc and dealloc of param |
| 1273 | * 'msg.payload' |
| 1274 | */ |
Christian Geddes | 3bdb3c2 | 2020-05-01 14:55:39 -0500 | [diff] [blame] | 1275 | int encode_platform_event_message_req( |
| 1276 | uint8_t instance_id, uint8_t format_version, uint8_t tid, |
| 1277 | uint8_t event_class, const uint8_t *event_data, size_t event_data_length, |
| 1278 | struct pldm_msg *msg, size_t payload_length); |
Pavithra Barithaya | 35f2b2c | 2020-04-08 01:35:56 -0500 | [diff] [blame] | 1279 | |
| 1280 | /** @brief Decode PlatformEventMessage response data |
| 1281 | * @param[in] msg - Request message |
| 1282 | * @param[in] payload_length - Length of Response message payload |
| 1283 | * @param[out] completion_code - PLDM completion code |
| 1284 | * @param[out] platform_event_status - Response status of the event message |
| 1285 | * command |
| 1286 | * @return pldm_completion_codes |
| 1287 | */ |
| 1288 | int decode_platform_event_message_resp(const struct pldm_msg *msg, |
| 1289 | size_t payload_length, |
| 1290 | uint8_t *completion_code, |
| 1291 | uint8_t *platform_event_status); |
| 1292 | |
Zahed Hossain | 1c86171 | 2020-03-04 08:55:19 -0600 | [diff] [blame] | 1293 | /** @brief Decode sensorEventData response data |
| 1294 | * |
| 1295 | * @param[in] event_data - event data from the response message |
| 1296 | * @param[in] event_data_length - length of the event data |
| 1297 | * @param[out] sensor_id - sensorID value of the sensor |
| 1298 | * @param[out] sensor_event_class_type - Type of sensor event class |
| 1299 | * @param[out] event_class_data_offset - Offset where the event class data |
| 1300 | * should be read from event data |
| 1301 | * @return pldm_completion_codes |
| 1302 | * @note Caller is responsible for memory alloc and dealloc of param |
| 1303 | * 'event_data' |
| 1304 | */ |
| 1305 | int decode_sensor_event_data(const uint8_t *event_data, |
| 1306 | size_t event_data_length, uint16_t *sensor_id, |
| 1307 | uint8_t *sensor_event_class_type, |
| 1308 | size_t *event_class_data_offset); |
| 1309 | |
| 1310 | /** @brief Decode sensorOpState response data |
| 1311 | * |
| 1312 | * @param[in] sensor_data - sensor_data for sensorEventClass = sensorOpState |
| 1313 | * @param[in] sensor_data_length - Length of sensor_data |
| 1314 | * @param[out] present_op_state - The sensorOperationalState value from the |
| 1315 | * state change that triggered the event message |
| 1316 | * @param[out] previous_op_state - The sensorOperationalState value for the |
| 1317 | * state from which the present state was entered |
| 1318 | * @return pldm_completion_codes |
| 1319 | * @note Caller is responsible for memory alloc and dealloc of param |
| 1320 | * 'sensor_data' |
| 1321 | */ |
| 1322 | int decode_sensor_op_data(const uint8_t *sensor_data, size_t sensor_data_length, |
| 1323 | uint8_t *present_op_state, |
| 1324 | uint8_t *previous_op_state); |
| 1325 | |
| 1326 | /** @brief Decode stateSensorState response data |
| 1327 | * |
| 1328 | * @param[in] sensor_data - sensor_data for sensorEventClass = stateSensorState |
| 1329 | * @param[in] sensor_data_length - Length of sensor_data |
| 1330 | * @param[out] sensor_offset - Identifies which state sensor within a composite |
| 1331 | * state sensor the event is being returned for |
| 1332 | * @param[out] event_state - The event state value from the state change that |
| 1333 | * triggered the event message |
| 1334 | * @param[out] previous_event_state - The event state value for the state from |
| 1335 | * which the present event state was entered |
| 1336 | * @return pldm_completion_codes |
| 1337 | * @note Caller is responsible for memory alloc and dealloc of param |
| 1338 | * 'sensor_data' |
| 1339 | */ |
| 1340 | int decode_state_sensor_data(const uint8_t *sensor_data, |
| 1341 | size_t sensor_data_length, uint8_t *sensor_offset, |
| 1342 | uint8_t *event_state, |
| 1343 | uint8_t *previous_event_state); |
| 1344 | |
| 1345 | /** @brief Decode numericSensorState response data |
| 1346 | * |
| 1347 | * @param[in] sensor_data - sensor_data for sensorEventClass = |
| 1348 | * numericSensorState |
| 1349 | * @param[in] sensor_data_length - Length of sensor_data |
| 1350 | * @param[out] event_state - The eventState value from the state change that |
| 1351 | * triggered the event message |
| 1352 | * @param[out] previous_event_state - The eventState value for the state from |
| 1353 | * which the present state was entered |
| 1354 | * @param[out] sensor_data_size - The bit width and format of reading and |
| 1355 | * threshold values that the sensor returns |
| 1356 | * @param[out] present_reading - The present value indicated by the sensor |
| 1357 | * @return pldm_completion_codes |
| 1358 | * @note Caller is responsible for memory alloc and dealloc of param |
| 1359 | * 'sensor_data' |
| 1360 | */ |
| 1361 | int decode_numeric_sensor_data(const uint8_t *sensor_data, |
| 1362 | size_t sensor_data_length, uint8_t *event_state, |
| 1363 | uint8_t *previous_event_state, |
| 1364 | uint8_t *sensor_data_size, |
| 1365 | uint32_t *present_reading); |
| 1366 | |
Jolie Ku | 6787f17 | 2020-03-19 11:15:53 +0800 | [diff] [blame] | 1367 | /* GetNumericEffecterValue */ |
| 1368 | |
| 1369 | /** @brief Create a PLDM request message for GetNumericEffecterValue |
| 1370 | * |
| 1371 | * @param[in] instance_id - Message's instance id |
| 1372 | * @param[in] effecter_id - used to identify and access the effecter |
| 1373 | * @param[out] msg - Message will be written to this |
| 1374 | * @return pldm_completion_codes |
| 1375 | * @note Caller is responsible for memory alloc and dealloc of param |
| 1376 | * 'msg.payload' |
| 1377 | */ |
| 1378 | int encode_get_numeric_effecter_value_req(uint8_t instance_id, |
| 1379 | uint16_t effecter_id, |
| 1380 | struct pldm_msg *msg); |
| 1381 | |
| 1382 | /** @brief Create a PLDM response message for GetNumericEffecterValue |
| 1383 | * |
| 1384 | * @param[in] msg - Request message |
| 1385 | * @param[in] payload_length - Length of request message payload |
| 1386 | * @param[out] completion_code - PLDM completion code |
| 1387 | * @param[out] effecter_data_size - The bit width and format of the setting |
| 1388 | * value for the effecter. |
| 1389 | * value:{uint8,sint8,uint16,sint16,uint32,sint32} |
| 1390 | * @param[out] effecter_oper_state - The state of the effecter itself |
| 1391 | * @param[out] pending_value - The pending numeric value setting of the |
| 1392 | * effecter. The effecterDataSize field indicates the number of |
| 1393 | * bits used for this field |
| 1394 | * @param[out] present_value - The present numeric value setting of the |
| 1395 | * effecter. The effecterDataSize indicates the number of bits |
| 1396 | * used for this field |
| 1397 | * @return pldm_completion_codes |
| 1398 | */ |
| 1399 | int decode_get_numeric_effecter_value_resp( |
| 1400 | const struct pldm_msg *msg, size_t payload_length, uint8_t *completion_code, |
| 1401 | uint8_t *effecter_data_size, uint8_t *effecter_oper_state, |
| 1402 | uint8_t *pending_value, uint8_t *present_value); |
| 1403 | |
Zahed Hossain | 9be087c | 2020-04-02 02:26:41 -0500 | [diff] [blame] | 1404 | /** @brief Decode pldmPDRRepositoryChgEvent response data |
| 1405 | * |
| 1406 | * @param[in] event_data - eventData for pldmPDRRepositoryChgEvent |
| 1407 | * @param[in] event_data_size - Length of event_data |
| 1408 | * @param[out] event_data_format - This field indicates if the changedRecords |
| 1409 | * are of PDR Types or PDR Record Handles |
| 1410 | * @param[out] number_of_change_records - The number of changeRecords following |
| 1411 | * this field |
| 1412 | * @param[out] change_record_data_offset - Identifies where changeRecord data |
| 1413 | * is located within event_data |
| 1414 | * @return pldm_completion_codes |
| 1415 | * @note Caller is responsible for memory alloc and dealloc of param |
| 1416 | * 'event_data' |
| 1417 | */ |
| 1418 | int decode_pldm_pdr_repository_chg_event_data( |
| 1419 | const uint8_t *event_data, size_t event_data_size, |
| 1420 | uint8_t *event_data_format, uint8_t *number_of_change_records, |
| 1421 | size_t *change_record_data_offset); |
| 1422 | |
Zach Clark | 36ad1f5 | 2020-04-13 07:04:15 -0500 | [diff] [blame] | 1423 | /** @brief Encode PLDM PDR Repository Change eventData |
| 1424 | * @param[in] event_data_format - Format of this event data (e.g. |
| 1425 | * FORMAT_IS_PDR_HANDLES) |
| 1426 | * @param[in] number_of_change_records - Number of changeRecords in this |
| 1427 | * eventData |
| 1428 | * @param[in] event_data_operations - Array of eventDataOperations |
| 1429 | * (e.g. RECORDS_ADDED) for each changeRecord in this eventData. This array |
| 1430 | * should contain number_of_change_records elements. |
| 1431 | * @param[in] numbers_of_change_entries - Array of numbers of changeEntrys |
| 1432 | * for each changeRecord in this eventData. This array should contain |
| 1433 | * number_of_change_records elements. |
| 1434 | * @param[in] change_entries - 2-dimensional array of arrays of changeEntrys, |
| 1435 | * one array per changeRecord in this eventData. The toplevel array should |
| 1436 | * contain number_of_change_records elements. Each subarray [i] should |
| 1437 | * contain numbers_of_change_entries[i] elements. |
| 1438 | * @param[in] event_data - The eventData will be encoded into this. This entire |
| 1439 | * structure must be max_change_records_size long. It must be large enough |
| 1440 | * to accomodate the data to be encoded. The caller is responsible for |
| 1441 | * allocating and deallocating it, including the variable-size |
| 1442 | * 'event_data.change_records' field. If this parameter is NULL, |
| 1443 | * PLDM_SUCCESS will be returned and actual_change_records_size will be set |
| 1444 | * to reflect the required size of the structure. |
| 1445 | * @param[out] actual_change_records_size - The actual number of meaningful |
| 1446 | * encoded bytes in event_data. The caller can over-allocate memory and use |
| 1447 | * this output to determine the real size of the structure. |
| 1448 | * @param[in] max_change_records_size - The size of event_data in bytes. If the |
| 1449 | * encoded message would be larger than this value, an error is returned. |
| 1450 | * @return pldm_completion_codes |
| 1451 | * @note Caller is responsible for memory alloc and dealloc of param |
| 1452 | * 'event_data.change_records' |
| 1453 | */ |
| 1454 | int encode_pldm_pdr_repository_chg_event_data( |
| 1455 | uint8_t event_data_format, uint8_t number_of_change_records, |
| 1456 | const uint8_t *event_data_operations, |
| 1457 | const uint8_t *numbers_of_change_entries, |
| 1458 | const uint32_t *const *change_entries, |
| 1459 | struct pldm_pdr_repository_chg_event_data *event_data, |
| 1460 | size_t *actual_change_records_size, size_t max_change_records_size); |
| 1461 | |
Zach Clark | b728eee | 2020-06-18 10:01:31 -0500 | [diff] [blame] | 1462 | /** @brief Encode event data for a PLDM Sensor Event |
| 1463 | * |
| 1464 | * @param[out] event_data The object to store the encoded event in |
| 1465 | * @param[in] event_data_size Size of the allocation for event_data |
| 1466 | * @param[in] sensor_id Sensor ID |
| 1467 | * @param[in] sensor_event_class Sensor event class |
| 1468 | * @param[in] sensor_offset Offset |
| 1469 | * @param[in] event_state Event state |
| 1470 | * @param[in] previous_event_state Previous event state |
| 1471 | * @param[out] actual_event_data_size The real size in bytes of the event_data |
| 1472 | * @return int pldm_completion_codes PLDM_SUCCESS/PLDM_ERROR_INVALID_LENGTH |
| 1473 | * @note If event_data is NULL, then *actual_event_data_size will be set to |
| 1474 | * reflect the size of the event data, and PLDM_SUCCESS will be returned. |
| 1475 | * @note The caller is responsible for allocating and deallocating the |
| 1476 | * event_data |
| 1477 | */ |
| 1478 | int encode_sensor_event_data(struct pldm_sensor_event_data *event_data, |
| 1479 | size_t event_data_size, uint16_t sensor_id, |
| 1480 | enum sensor_event_class_states sensor_event_class, |
| 1481 | uint8_t sensor_offset, uint8_t event_state, |
| 1482 | uint8_t previous_event_state, |
| 1483 | size_t *actual_event_data_size); |
| 1484 | |
Zahed Hossain | 9be087c | 2020-04-02 02:26:41 -0500 | [diff] [blame] | 1485 | /** @brief Decode PldmPDRRepositoryChangeRecord response data |
| 1486 | * |
| 1487 | * @param[in] change_record_data - changeRecordData for |
| 1488 | * pldmPDRRepositoryChgEvent |
| 1489 | * @param[in] change_record_data_size - Length of change_record_data |
| 1490 | * @param[out] event_data_operation - This field indicates the changeEntries |
| 1491 | * operation types |
| 1492 | * @param[out] number_of_change_entries - The number of changeEntries following |
| 1493 | * this field |
| 1494 | * @param[out] change_entry_data_offset - Identifies where changeEntries data |
| 1495 | * is located within change_record_data |
| 1496 | * @return pldm_completion_codes |
| 1497 | * @note Caller is responsible for memory alloc and dealloc of param |
| 1498 | * 'change_record_data' |
| 1499 | */ |
| 1500 | int decode_pldm_pdr_repository_change_record_data( |
| 1501 | const uint8_t *change_record_data, size_t change_record_data_size, |
| 1502 | uint8_t *event_data_operation, uint8_t *number_of_change_entries, |
| 1503 | size_t *change_entry_data_offset); |
| 1504 | |
Jolie Ku | f798c8f | 2020-04-14 11:18:06 +0800 | [diff] [blame] | 1505 | /* GetSensorReading */ |
| 1506 | |
| 1507 | /** @brief Encode GetSensorReading request data |
| 1508 | * |
| 1509 | * @param[in] instance_id - Message's instance id |
| 1510 | * @param[in] sensor_id - A handle that is used to identify and access the |
| 1511 | * sensor |
| 1512 | * @param[in] rearm_event_state - true = manually re-arm EventState after |
| 1513 | * responding to this request, false = no manual re-arm |
| 1514 | * @param[out] msg - Message will be written to this |
| 1515 | * @return pldm_completion_codes |
| 1516 | * @note Caller is responsible for memory alloc and dealloc of param |
| 1517 | * 'msg.payload' |
| 1518 | */ |
| 1519 | int encode_get_sensor_reading_req(uint8_t instance_id, uint16_t sensor_id, |
| 1520 | bool8_t rearm_event_state, |
| 1521 | struct pldm_msg *msg); |
| 1522 | |
| 1523 | /** @brief Decode GetSensorReading response data |
| 1524 | * |
| 1525 | * @param[in] msg - Request message |
| 1526 | * @param[in] payload_length - Length of response message payload |
| 1527 | * @param[out] completion_code - PLDM completion code |
| 1528 | * @param[out] sensor_data_size - The bit width and format of reading and |
| 1529 | * threshold values |
| 1530 | * @param[out] sensor_operational_state - The state of the sensor itself |
| 1531 | * @param[out] sensor_event_message_enable - value: { noEventGeneration, |
| 1532 | * eventsDisabled, eventsEnabled, opEventsOnlyEnabled, |
| 1533 | * stateEventsOnlyEnabled } |
| 1534 | * @param[out] present_state - The most recently assessed state value monitored |
| 1535 | * by the sensor |
| 1536 | * @param[out] previous_state - The state that the presentState was entered |
| 1537 | * from |
| 1538 | * @param[out] event_state - Indicates which threshold crossing assertion |
| 1539 | * events have been detected |
| 1540 | * @param[out] present_reading - The present value indicated by the sensor |
| 1541 | * @return pldm_completion_codes |
| 1542 | */ |
| 1543 | |
| 1544 | int decode_get_sensor_reading_resp( |
| 1545 | const struct pldm_msg *msg, size_t payload_length, uint8_t *completion_code, |
| 1546 | uint8_t *sensor_data_size, uint8_t *sensor_operational_state, |
| 1547 | uint8_t *sensor_event_message_enable, uint8_t *present_state, |
| 1548 | uint8_t *previous_state, uint8_t *event_state, uint8_t *present_reading); |
| 1549 | |
Sagar Srinivas | 535bccd | 2021-03-24 12:18:26 -0500 | [diff] [blame] | 1550 | /** @brief Encode the SetEventReceiver request message |
| 1551 | * |
| 1552 | * @param[in] instance_id - Message's instance id |
| 1553 | * @param[in] event_message_global_enable - This value is used to enable or |
| 1554 | * disable event message generation from the terminus value: { |
| 1555 | * disable, enableAsync, enablePolling, enableAsyncKeepAlive } |
| 1556 | * @param[in] transport_protocol_type - This value is provided in the request |
| 1557 | * to help the responder verify that the content of the |
| 1558 | * eventReceiverAddressInfo field used in this request is correct for |
| 1559 | * the messaging protocol supported by the terminus. |
| 1560 | * @param[in] event_receiver_address_info - this value is a medium and |
| 1561 | * protocol-specific address that the responder should use when |
| 1562 | * transmitting event messages using the indicated protocol |
| 1563 | * @param[in] heartbeat_timer - Amount of time in seconds after each elapsing |
| 1564 | * of which the terminus shall emit a heartbeat event to the receiver |
| 1565 | * @param[out] msg - Argument to capture the Message |
| 1566 | * @return pldm_completion_codes |
| 1567 | */ |
| 1568 | int encode_set_event_receiver_req(uint8_t instance_id, |
| 1569 | uint8_t event_message_global_enable, |
| 1570 | uint8_t transport_protocol_type, |
| 1571 | uint8_t event_receiver_address_info, |
| 1572 | uint16_t heartbeat_timer, |
| 1573 | struct pldm_msg *msg); |
| 1574 | |
| 1575 | /** @brief Decode the SetEventReceiver response message |
| 1576 | * |
| 1577 | * @param[in] msg - Request message |
| 1578 | * @param[in] payload_length - Length of response message payload |
| 1579 | * @param[out] completion_code - PLDM completion code |
| 1580 | * @return pldm_completion_codes |
| 1581 | */ |
| 1582 | int decode_set_event_receiver_resp(const struct pldm_msg *msg, |
| 1583 | size_t payload_length, |
| 1584 | uint8_t *completion_code); |
Sridevi Ramesh | 7418752 | 2021-04-08 09:50:22 -0500 | [diff] [blame] | 1585 | |
| 1586 | /** @brief Decode the SetEventReceiver request message |
| 1587 | * |
| 1588 | * @param[in] msg - Request message |
| 1589 | * @param[in] payload_length - Length of request message payload |
| 1590 | * @param[out] event_message_global_enable - This value is used to enable or |
| 1591 | * disable event message generation from the terminus value: { |
| 1592 | * disable, enableAsync, enablePolling, enableAsyncKeepAlive } |
| 1593 | * @param[out] transport_protocol_type - This value is provided in the request |
| 1594 | * to help the responder verify that the content of the |
| 1595 | * eventReceiverAddressInfo field used in this request is correct for |
| 1596 | * the messaging protocol supported by the terminus. |
| 1597 | * @param[out] event_receiver_address_info - This value is a medium and |
| 1598 | * protocol-specific address that the responder should use when |
| 1599 | * transmitting event messages using the indicated protocol |
| 1600 | * @param[out] heartbeat_timer - Amount of time in seconds after each elapsing |
| 1601 | * of which the terminus shall emit a heartbeat event to the receiver |
| 1602 | * @return pldm_completion_codes |
| 1603 | */ |
| 1604 | int decode_set_event_receiver_req(const struct pldm_msg *msg, |
| 1605 | size_t payload_length, |
| 1606 | uint8_t *event_message_global_enable, |
| 1607 | uint8_t *transport_protocol_type, |
| 1608 | uint8_t *event_receiver_address_info, |
| 1609 | uint16_t *heartbeat_timer); |
| 1610 | |
| 1611 | /** @brief Encode the SetEventReceiver response message |
| 1612 | * |
| 1613 | * @param[in] instance_id - Message's instance id |
| 1614 | * @param[in] completion_code - PLDM completion code |
| 1615 | * @param[out] msg - Argument to capture the Message |
| 1616 | * @return pldm_completion_codes |
| 1617 | */ |
| 1618 | int encode_set_event_receiver_resp(uint8_t instance_id, uint8_t completion_code, |
| 1619 | struct pldm_msg *msg); |
| 1620 | |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 1621 | #ifdef __cplusplus |
| 1622 | } |
| 1623 | #endif |
| 1624 | |
| 1625 | #endif /* PLATFORM_H */ |