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 |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 19 | /* Response lengths are inclusive of completion code */ |
| 20 | #define PLDM_SET_STATE_EFFECTER_STATES_RESP_BYTES 1 |
Jolie Ku | 3557bad | 2020-03-02 16:22:57 +0800 | [diff] [blame] | 21 | #define PLDM_GET_STATE_SENSOR_READINGS_RESP_BYTES 34 |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 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 |
| 27 | /* Minimum response length */ |
| 28 | #define PLDM_GET_PDR_MIN_RESP_BYTES 12 |
Jolie Ku | 6787f17 | 2020-03-19 11:15:53 +0800 | [diff] [blame] | 29 | #define PLDM_GET_NUMERIC_EFFECTER_VALUE_MIN_RESP_BYTES 5 |
Jolie Ku | f798c8f | 2020-04-14 11:18:06 +0800 | [diff] [blame] | 30 | #define PLDM_GET_SENSOR_READING_MIN_RESP_BYTES 8 |
Sampa Misra | 7fcfb66 | 2019-05-08 13:13:53 -0500 | [diff] [blame] | 31 | |
Zahed Hossain | d4abab1 | 2020-02-06 03:36:43 -0600 | [diff] [blame] | 32 | /* Minimum length for PLDM PlatformEventMessage request */ |
| 33 | #define PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES 3 |
| 34 | #define PLDM_PLATFORM_EVENT_MESSAGE_STATE_SENSOR_STATE_REQ_BYTES 6 |
Tom Joseph | 56e45c5 | 2020-03-16 10:01:45 +0530 | [diff] [blame] | 35 | #define PLDM_PLATFORM_EVENT_MESSAGE_RESP_BYTES 2 |
Zahed Hossain | d4abab1 | 2020-02-06 03:36:43 -0600 | [diff] [blame] | 36 | |
Zahed Hossain | 1c86171 | 2020-03-04 08:55:19 -0600 | [diff] [blame] | 37 | /* Minumum length of senson event data */ |
| 38 | #define PLDM_SENSOR_EVENT_DATA_MIN_LENGTH 5 |
| 39 | #define PLDM_SENSOR_EVENT_SENSOR_OP_STATE_DATA_LENGTH 2 |
| 40 | #define PLDM_SENSOR_EVENT_STATE_SENSOR_STATE_DATA_LENGTH 3 |
| 41 | #define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_MIN_DATA_LENGTH 4 |
| 42 | #define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_MAX_DATA_LENGTH 7 |
| 43 | #define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_8BIT_DATA_LENGTH 4 |
| 44 | #define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_16BIT_DATA_LENGTH 5 |
| 45 | #define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_32BIT_DATA_LENGTH 7 |
| 46 | |
Zahed Hossain | 9be087c | 2020-04-02 02:26:41 -0500 | [diff] [blame] | 47 | /* Minimum length of data for pldmPDRRepositoryChgEvent */ |
| 48 | #define PLDM_PDR_REPOSITORY_CHG_EVENT_MIN_LENGTH 2 |
| 49 | #define PLDM_PDR_REPOSITORY_CHANGE_RECORD_MIN_LENGTH 2 |
| 50 | |
George Liu | 30b859f | 2020-01-07 15:03:22 +0800 | [diff] [blame] | 51 | enum pldm_effecter_data_size { |
| 52 | PLDM_EFFECTER_DATA_SIZE_UINT8, |
| 53 | PLDM_EFFECTER_DATA_SIZE_SINT8, |
| 54 | PLDM_EFFECTER_DATA_SIZE_UINT16, |
| 55 | PLDM_EFFECTER_DATA_SIZE_SINT16, |
| 56 | PLDM_EFFECTER_DATA_SIZE_UINT32, |
| 57 | PLDM_EFFECTER_DATA_SIZE_SINT32 |
| 58 | }; |
| 59 | |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 60 | enum set_request { PLDM_NO_CHANGE = 0x00, PLDM_REQUEST_SET = 0x01 }; |
| 61 | |
| 62 | enum effecter_state { PLDM_INVALID_VALUE = 0xFF }; |
| 63 | |
Jolie Ku | 3557bad | 2020-03-02 16:22:57 +0800 | [diff] [blame] | 64 | enum sensor_operational_state { |
| 65 | ENABLED = 0x00, |
| 66 | DISABLED = 0x01, |
| 67 | UNAVAILABLE = 0x02, |
| 68 | STATUSUNKNOWN = 0x03, |
| 69 | FAILED = 0x04, |
| 70 | INITIALIZING = 0x05, |
| 71 | SHUTTINGDOWN = 0x06, |
| 72 | INTEST = 0x07 |
| 73 | }; |
| 74 | |
| 75 | enum present_state { |
| 76 | UNKNOWN = 0x0, |
| 77 | NORMAL = 0x01, |
| 78 | WARNING = 0x02, |
| 79 | CRITICAL = 0x03, |
| 80 | FATAL = 0x04, |
| 81 | LOWERWARNING = 0x05, |
| 82 | LOWERCRITICAL = 0x06, |
| 83 | LOWERFATAL = 0x07, |
| 84 | UPPERWARNING = 0x08, |
| 85 | UPPERCRITICAL = 0x09, |
| 86 | UPPERFATAL = 0x0a |
| 87 | }; |
| 88 | |
Jolie Ku | f798c8f | 2020-04-14 11:18:06 +0800 | [diff] [blame] | 89 | enum pldm_sensor_event_message_enable { |
| 90 | PLDM_NO_EVENT_GENERATION, |
| 91 | PLDM_EVENTS_DISABLED, |
| 92 | PLDM_EVENTS_ENABLED, |
| 93 | PLDM_OP_EVENTS_ONLY_ENABLED, |
| 94 | PLDM_STATE_EVENTS_ONLY_ENABLED |
| 95 | }; |
| 96 | |
Jolie Ku | 6787f17 | 2020-03-19 11:15:53 +0800 | [diff] [blame] | 97 | enum pldm_effecter_oper_state { |
| 98 | EFFECTER_OPER_STATE_ENABLED_UPDATEPENDING, |
| 99 | EFFECTER_OPER_STATE_ENABLED_NOUPDATEPENDING, |
| 100 | EFFECTER_OPER_STATE_DISABLED, |
| 101 | EFFECTER_OPER_STATE_UNAVAILABLE, |
| 102 | EFFECTER_OPER_STATE_STATUSUNKNOWN, |
| 103 | EFFECTER_OPER_STATE_FAILED, |
| 104 | EFFECTER_OPER_STATE_INITIALIZING, |
| 105 | EFFECTER_OPER_STATE_SHUTTINGDOWN, |
| 106 | EFFECTER_OPER_STATE_INTEST |
| 107 | }; |
| 108 | |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 109 | enum pldm_platform_commands { |
Jolie Ku | f798c8f | 2020-04-14 11:18:06 +0800 | [diff] [blame] | 110 | PLDM_GET_SENSOR_READING = 0x11, |
Jolie Ku | 3557bad | 2020-03-02 16:22:57 +0800 | [diff] [blame] | 111 | PLDM_GET_STATE_SENSOR_READINGS = 0x21, |
George Liu | 30b859f | 2020-01-07 15:03:22 +0800 | [diff] [blame] | 112 | PLDM_SET_NUMERIC_EFFECTER_VALUE = 0x31, |
Jolie Ku | 6787f17 | 2020-03-19 11:15:53 +0800 | [diff] [blame] | 113 | PLDM_GET_NUMERIC_EFFECTER_VALUE = 0x32, |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 114 | PLDM_SET_STATE_EFFECTER_STATES = 0x39, |
Sampa Misra | 7fcfb66 | 2019-05-08 13:13:53 -0500 | [diff] [blame] | 115 | PLDM_GET_PDR = 0x51, |
Zahed Hossain | d4abab1 | 2020-02-06 03:36:43 -0600 | [diff] [blame] | 116 | PLDM_PLATFORM_EVENT_MESSAGE = 0x0A |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 117 | }; |
| 118 | |
Deepak Kodihalli | c6e8fb5 | 2019-05-02 08:35:31 -0500 | [diff] [blame] | 119 | /** @brief PLDM PDR types |
| 120 | */ |
| 121 | enum pldm_pdr_types { |
| 122 | PLDM_STATE_EFFECTER_PDR = 11, |
Deepak Kodihalli | 0a738f0 | 2020-03-10 01:56:21 -0500 | [diff] [blame] | 123 | PLDM_PDR_ENTITY_ASSOCIATION = 15, |
Deepak Kodihalli | db91467 | 2020-02-07 02:47:45 -0600 | [diff] [blame] | 124 | PLDM_PDR_FRU_RECORD_SET = 20, |
Deepak Kodihalli | c6e8fb5 | 2019-05-02 08:35:31 -0500 | [diff] [blame] | 125 | }; |
| 126 | |
| 127 | /** @brief PLDM effecter initialization schemes |
| 128 | */ |
| 129 | enum pldm_effecter_init { |
| 130 | PLDM_NO_INIT, |
| 131 | PLDM_USE_INIT_PDR, |
| 132 | PLDM_ENABLE_EFFECTER, |
| 133 | PLDM_DISABLE_EFECTER |
| 134 | }; |
| 135 | |
Deepak Kodihalli | 557dfb0 | 2019-05-12 13:11:17 +0530 | [diff] [blame] | 136 | /** @brief PLDM Platform M&C completion codes |
| 137 | */ |
| 138 | enum pldm_platform_completion_codes { |
Sampa Misra | a2fa070 | 2019-05-31 01:28:55 -0500 | [diff] [blame] | 139 | PLDM_PLATFORM_INVALID_EFFECTER_ID = 0x80, |
| 140 | PLDM_PLATFORM_INVALID_STATE_VALUE = 0x81, |
Zach Clark | 7672875 | 2020-03-31 10:44:09 -0500 | [diff] [blame] | 141 | |
| 142 | PLDM_PLATFORM_INVALID_DATA_TRANSFER_HANDLE = 0x80, |
| 143 | PLDM_PLATFORM_INVALID_TRANSFER_OPERATION_FLAG = 0x81, |
Deepak Kodihalli | 557dfb0 | 2019-05-12 13:11:17 +0530 | [diff] [blame] | 144 | PLDM_PLATFORM_INVALID_RECORD_HANDLE = 0x82, |
Zach Clark | 7672875 | 2020-03-31 10:44:09 -0500 | [diff] [blame] | 145 | PLDM_PLATFORM_INVALID_RECORD_CHANGE_NUMBER = 0x83, |
| 146 | PLDM_PLATFORM_TRANSFER_TIMEOUT = 0x84, |
| 147 | |
Sampa Misra | a2fa070 | 2019-05-31 01:28:55 -0500 | [diff] [blame] | 148 | PLDM_PLATFORM_SET_EFFECTER_UNSUPPORTED_SENSORSTATE = 0x82, |
Deepak Kodihalli | 557dfb0 | 2019-05-12 13:11:17 +0530 | [diff] [blame] | 149 | }; |
| 150 | |
Zahed Hossain | d4abab1 | 2020-02-06 03:36:43 -0600 | [diff] [blame] | 151 | /** @brief PLDM Event types |
| 152 | */ |
| 153 | enum pldm_event_types { |
| 154 | PLDM_SENSOR_EVENT = 0x00, |
| 155 | PLDM_EFFECTER_EVENT = 0x01, |
| 156 | PLDM_REDFISH_TASK_EXECUTED_EVENT = 0x02, |
| 157 | PLDM_REDFISH_MESSAGE_EVENT = 0x03, |
| 158 | PLDM_PDR_REPOSITORY_CHG_EVENT = 0x04, |
| 159 | PLDM_MESSAGE_POLL_EVENT = 0x05, |
| 160 | PLDM_HEARTBEAT_TIMER_ELAPSED_EVENT = 0x06 |
| 161 | }; |
| 162 | |
| 163 | /** @brief PLDM sensorEventClass states |
| 164 | */ |
| 165 | enum sensor_event_class_states { |
| 166 | PLDM_SENSOR_OP_STATE, |
| 167 | PLDM_STATE_SENSOR_STATE, |
| 168 | PLDM_NUMERIC_SENSOR_STATE |
| 169 | }; |
| 170 | |
| 171 | /** @brief PLDM sensor supported states |
| 172 | */ |
| 173 | enum pldm_sensor_operational_state { |
| 174 | PLDM_SENSOR_ENABLED, |
| 175 | PLDM_SENSOR_DISABLED, |
| 176 | PLDM_SENSOR_UNAVAILABLE, |
| 177 | PLDM_SENSOR_STATUSUNKOWN, |
| 178 | PLDM_SENSOR_FAILED, |
| 179 | PLDM_SENSOR_INITIALIZING, |
| 180 | PLDM_SENSOR_SHUTTINGDOWN, |
| 181 | PLDM_SENSOR_INTEST |
| 182 | }; |
| 183 | |
| 184 | /** @brief PLDM pldmPDRRepositoryChgEvent class eventData format |
| 185 | */ |
| 186 | enum pldm_pdr_repository_chg_event_data_format { |
| 187 | REFRESH_ENTIRE_REPOSITORY, |
| 188 | FORMAT_IS_PDR_TYPES, |
| 189 | FORMAT_IS_PDR_HANDLES |
| 190 | }; |
| 191 | |
Zahed Hossain | 9be087c | 2020-04-02 02:26:41 -0500 | [diff] [blame] | 192 | /** @brief PLDM pldmPDRRepositoryChgEvent class changeRecord format |
| 193 | * eventDataOperation |
| 194 | */ |
| 195 | enum pldm_pdr_repository_chg_event_change_record_event_data_operation { |
| 196 | PLDM_REFRESH_ALL_RECORDS, |
| 197 | PLDM_RECORDS_DELETED, |
| 198 | PLDM_RECORDS_ADDED, |
| 199 | PLDM_RECORDS_MODIFIED |
| 200 | }; |
| 201 | |
Zahed Hossain | 1c86171 | 2020-03-04 08:55:19 -0600 | [diff] [blame] | 202 | /** @brief PLDM NumericSensorStatePresentReading data type |
| 203 | */ |
| 204 | enum pldm_sensor_readings_data_type { |
| 205 | PLDM_SENSOR_DATA_SIZE_UINT8, |
| 206 | PLDM_SENSOR_DATA_SIZE_SINT8, |
| 207 | PLDM_SENSOR_DATA_SIZE_UINT16, |
| 208 | PLDM_SENSOR_DATA_SIZE_SINT16, |
| 209 | PLDM_SENSOR_DATA_SIZE_UINT32, |
| 210 | PLDM_SENSOR_DATA_SIZE_SINT32 |
| 211 | }; |
| 212 | |
Tom Joseph | 56e45c5 | 2020-03-16 10:01:45 +0530 | [diff] [blame] | 213 | /** @brief PLDM PlatformEventMessage response status |
| 214 | */ |
| 215 | enum pldm_platform_event_status { |
| 216 | PLDM_EVENT_NO_LOGGING = 0x00, |
| 217 | PLDM_EVENT_LOGGING_DISABLED = 0x01, |
| 218 | PLDM_EVENT_LOG_FULL = 0x02, |
| 219 | PLDM_EVENT_ACCEPTED_FOR_LOGGING = 0x03, |
| 220 | PLDM_EVENT_LOGGED = 0x04, |
| 221 | PLDM_EVENT_LOGGING_REJECTED = 0x05 |
| 222 | }; |
| 223 | |
Deepak Kodihalli | c6e8fb5 | 2019-05-02 08:35:31 -0500 | [diff] [blame] | 224 | /** @struct pldm_pdr_hdr |
| 225 | * |
| 226 | * Structure representing PLDM common PDR header |
| 227 | */ |
| 228 | struct pldm_pdr_hdr { |
| 229 | uint32_t record_handle; |
| 230 | uint8_t version; |
| 231 | uint8_t type; |
| 232 | uint16_t record_change_num; |
| 233 | uint16_t length; |
| 234 | } __attribute__((packed)); |
| 235 | |
Deepak Kodihalli | 5544ccd | 2020-03-15 23:36:16 -0500 | [diff] [blame] | 236 | /** @struct pldm_pdr_entity_association |
| 237 | * |
| 238 | * Structure representing PLDM Entity Association PDR |
| 239 | */ |
| 240 | struct pldm_pdr_entity_association { |
| 241 | uint16_t container_id; |
| 242 | uint8_t association_type; |
| 243 | pldm_entity container; |
| 244 | uint8_t num_children; |
| 245 | pldm_entity children[1]; |
| 246 | } __attribute__((packed)); |
| 247 | |
Deepak Kodihalli | db91467 | 2020-02-07 02:47:45 -0600 | [diff] [blame] | 248 | /** @struct pldm_pdr_fru_record_set |
| 249 | * |
| 250 | * Structure representing PLDM FRU record set PDR |
| 251 | */ |
| 252 | struct pldm_pdr_fru_record_set { |
| 253 | uint16_t terminus_handle; |
| 254 | uint16_t fru_rsi; |
| 255 | uint16_t entity_type; |
| 256 | uint16_t entity_instance_num; |
| 257 | uint16_t container_id; |
| 258 | } __attribute__((packed)); |
| 259 | |
Deepak Kodihalli | c6e8fb5 | 2019-05-02 08:35:31 -0500 | [diff] [blame] | 260 | /** @struct pldm_state_effecter_pdr |
| 261 | * |
| 262 | * Structure representing PLDM state effecter PDR |
| 263 | */ |
| 264 | struct pldm_state_effecter_pdr { |
| 265 | struct pldm_pdr_hdr hdr; |
| 266 | uint16_t terminus_handle; |
| 267 | uint16_t effecter_id; |
| 268 | uint16_t entity_type; |
| 269 | uint16_t entity_instance; |
| 270 | uint16_t container_id; |
| 271 | uint16_t effecter_semantic_id; |
| 272 | uint8_t effecter_init; |
| 273 | bool8_t has_description_pdr; |
| 274 | uint8_t composite_effecter_count; |
| 275 | uint8_t possible_states[1]; |
| 276 | } __attribute__((packed)); |
| 277 | |
| 278 | /** @struct state_effecter_possible_states |
| 279 | * |
| 280 | * Structure representing state enums for state effecter |
| 281 | */ |
| 282 | struct state_effecter_possible_states { |
| 283 | uint16_t state_set_id; |
| 284 | uint8_t possible_states_size; |
| 285 | bitfield8_t states[1]; |
| 286 | } __attribute__((packed)); |
| 287 | |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 288 | /** @struct set_effecter_state_field |
| 289 | * |
| 290 | * Structure representing a stateField in SetStateEffecterStates command */ |
| 291 | |
| 292 | typedef struct state_field_for_state_effecter_set { |
| 293 | uint8_t set_request; //!< Whether to change the state |
| 294 | uint8_t effecter_state; //!< Expected state of the effecter |
| 295 | } __attribute__((packed)) set_effecter_state_field; |
| 296 | |
Jolie Ku | 3557bad | 2020-03-02 16:22:57 +0800 | [diff] [blame] | 297 | /** @struct get_sensor_readings_field |
| 298 | * |
| 299 | * Structure representing a stateField in GetStateSensorReadings command */ |
| 300 | |
| 301 | typedef struct state_field_for_get_state_sensor_readings { |
| 302 | uint8_t sensor_op_state; //!< The state of the sensor itself |
| 303 | uint8_t present_state; //!< Return a state value |
| 304 | uint8_t previous_state; //!< The state that the presentState was entered |
| 305 | //! from. This must be different from the |
| 306 | //! present state |
| 307 | uint8_t event_state; //!< Return a state value from a PLDM State Set |
| 308 | //! that is associated with the sensor |
| 309 | } __attribute__((packed)) get_sensor_state_field; |
| 310 | |
Priyanga | 7257fdf | 2019-06-10 01:59:45 -0500 | [diff] [blame] | 311 | /** @struct PLDM_SetStateEffecterStates_Request |
| 312 | * |
| 313 | * Structure representing PLDM set state effecter states request. |
| 314 | */ |
| 315 | struct pldm_set_state_effecter_states_req { |
| 316 | uint16_t effecter_id; |
| 317 | uint8_t comp_effecter_count; |
| 318 | set_effecter_state_field field[8]; |
| 319 | } __attribute__((packed)); |
| 320 | |
Sampa Misra | 7fcfb66 | 2019-05-08 13:13:53 -0500 | [diff] [blame] | 321 | /** @struct pldm_get_pdr_resp |
| 322 | * |
| 323 | * structure representing GetPDR response packet |
| 324 | * transfer CRC is not part of the structure and will be |
| 325 | * added at the end of last packet in multipart transfer |
| 326 | */ |
| 327 | struct pldm_get_pdr_resp { |
| 328 | uint8_t completion_code; |
| 329 | uint32_t next_record_handle; |
| 330 | uint32_t next_data_transfer_handle; |
| 331 | uint8_t transfer_flag; |
| 332 | uint16_t response_count; |
| 333 | uint8_t record_data[1]; |
| 334 | } __attribute__((packed)); |
| 335 | |
| 336 | /** @struct pldm_get_pdr_req |
| 337 | * |
| 338 | * structure representing GetPDR request packet |
| 339 | */ |
| 340 | struct pldm_get_pdr_req { |
| 341 | uint32_t record_handle; |
| 342 | uint32_t data_transfer_handle; |
| 343 | uint8_t transfer_op_flag; |
| 344 | uint16_t request_count; |
| 345 | uint16_t record_change_number; |
| 346 | } __attribute__((packed)); |
| 347 | |
George Liu | 30b859f | 2020-01-07 15:03:22 +0800 | [diff] [blame] | 348 | /** @struct pldm_set_numeric_effecter_value_req |
| 349 | * |
| 350 | * structure representing SetNumericEffecterValue request packet |
| 351 | */ |
| 352 | struct pldm_set_numeric_effecter_value_req { |
| 353 | uint16_t effecter_id; |
| 354 | uint8_t effecter_data_size; |
| 355 | uint8_t effecter_value[1]; |
| 356 | } __attribute__((packed)); |
| 357 | |
Jolie Ku | 3557bad | 2020-03-02 16:22:57 +0800 | [diff] [blame] | 358 | /** @struct pldm_get_state_sensor_readings_req |
| 359 | * |
| 360 | * Structure representing PLDM get state sensor readings request. |
| 361 | */ |
| 362 | struct pldm_get_state_sensor_readings_req { |
| 363 | uint16_t sensor_id; |
| 364 | bitfield8_t sensor_rearm; |
| 365 | uint8_t reserved; |
| 366 | } __attribute__((packed)); |
| 367 | |
| 368 | /** @struct pldm_get_state_sensor_readings_resp |
| 369 | * |
| 370 | * Structure representing PLDM get state sensor readings response. |
| 371 | */ |
| 372 | struct pldm_get_state_sensor_readings_resp { |
| 373 | uint8_t completion_code; |
| 374 | uint8_t comp_sensor_count; |
| 375 | get_sensor_state_field field[1]; |
| 376 | } __attribute__((packed)); |
| 377 | |
Zahed Hossain | d4abab1 | 2020-02-06 03:36:43 -0600 | [diff] [blame] | 378 | /** @struct pldm_sensor_event |
| 379 | * |
| 380 | * structure representing sensorEventClass |
| 381 | */ |
| 382 | struct pldm_sensor_event_data { |
| 383 | uint16_t sensor_id; |
| 384 | uint8_t sensor_event_class_type; |
| 385 | uint8_t event_class[1]; |
| 386 | } __attribute__((packed)); |
| 387 | |
| 388 | /** @struct pldm_state_sensor_state |
| 389 | * |
| 390 | * structure representing sensorEventClass for stateSensorState |
| 391 | */ |
| 392 | struct pldm_sensor_event_state_sensor_state { |
| 393 | uint8_t sensor_offset; |
| 394 | uint8_t event_state; |
| 395 | uint8_t previous_event_state; |
| 396 | } __attribute__((packed)); |
| 397 | |
| 398 | /** @struct pldm_sensor_event_numeric_sensor_state |
| 399 | * |
| 400 | * structure representing sensorEventClass for stateSensorState |
| 401 | */ |
| 402 | struct pldm_sensor_event_numeric_sensor_state { |
| 403 | uint8_t event_state; |
| 404 | uint8_t previous_event_state; |
| 405 | uint8_t sensor_data_size; |
| 406 | uint8_t present_reading[1]; |
| 407 | } __attribute__((packed)); |
| 408 | |
| 409 | /** @struct pldm_sensor_event_sensor_op_state |
| 410 | * |
| 411 | * structure representing sensorEventClass for SensorOpState |
| 412 | */ |
| 413 | struct pldm_sensor_event_sensor_op_state { |
| 414 | uint8_t present_op_state; |
| 415 | uint8_t previous_op_state; |
| 416 | } __attribute__((packed)); |
| 417 | |
| 418 | /** @struct pldm_platform_event_message_req |
| 419 | * |
| 420 | * structure representing PlatformEventMessage command request data |
| 421 | */ |
| 422 | struct pldm_platform_event_message_req { |
| 423 | uint8_t format_version; |
| 424 | uint8_t tid; |
| 425 | uint8_t event_class; |
| 426 | uint8_t event_data[1]; |
| 427 | } __attribute__((packed)); |
| 428 | |
| 429 | /** @struct pldm_platform_event_message_response |
| 430 | * |
| 431 | * structure representing PlatformEventMessage command response data |
| 432 | */ |
| 433 | struct pldm_platform_event_message_resp { |
| 434 | uint8_t completion_code; |
Pavithra Barithaya | 2ea1f07 | 2020-04-03 09:30:23 -0500 | [diff] [blame] | 435 | uint8_t platform_event_status; |
Zahed Hossain | d4abab1 | 2020-02-06 03:36:43 -0600 | [diff] [blame] | 436 | } __attribute__((packed)); |
| 437 | |
| 438 | /** @struct pldm_pdr_repository_chg_event_data |
| 439 | * |
| 440 | * structure representing pldmPDRRepositoryChgEvent class eventData |
| 441 | */ |
| 442 | struct pldm_pdr_repository_chg_event_data { |
| 443 | uint8_t event_data_format; |
| 444 | uint8_t number_of_change_records; |
| 445 | uint8_t change_records[1]; |
| 446 | } __attribute__((packed)); |
| 447 | |
| 448 | /** @struct pldm_pdr_repository_chg_event_change_record_data |
| 449 | * |
| 450 | * structure representing pldmPDRRepositoryChgEvent class eventData's change |
| 451 | * record data |
| 452 | */ |
| 453 | struct pldm_pdr_repository_change_record_data { |
| 454 | uint8_t event_data_operation; |
| 455 | uint8_t number_of_change_entries; |
| 456 | uint32_t change_entry[1]; |
| 457 | } __attribute__((packed)); |
| 458 | |
Jolie Ku | 6787f17 | 2020-03-19 11:15:53 +0800 | [diff] [blame] | 459 | /** @struct pldm_get_numeric_effecter_value_req |
| 460 | * |
| 461 | * structure representing GetNumericEffecterValue request packet |
| 462 | */ |
| 463 | struct pldm_get_numeric_effecter_value_req { |
| 464 | uint16_t effecter_id; |
| 465 | } __attribute__((packed)); |
| 466 | |
| 467 | /** @struct pldm_get_numeric_effecter_value_resp |
| 468 | * |
| 469 | * structure representing GetNumericEffecterValue response packet |
| 470 | */ |
| 471 | struct pldm_get_numeric_effecter_value_resp { |
| 472 | uint8_t completion_code; |
| 473 | uint8_t effecter_data_size; |
| 474 | uint8_t effecter_oper_state; |
| 475 | uint8_t pending_and_present_values[1]; |
| 476 | } __attribute__((packed)); |
| 477 | |
Jolie Ku | f798c8f | 2020-04-14 11:18:06 +0800 | [diff] [blame] | 478 | /** @struct pldm_get_sensor_reading_req |
| 479 | * |
| 480 | * Structure representing PLDM get sensor reading request |
| 481 | */ |
| 482 | struct pldm_get_sensor_reading_req { |
| 483 | uint16_t sensor_id; |
| 484 | bool8_t rearm_event_state; |
| 485 | } __attribute__((packed)); |
| 486 | |
| 487 | /** @struct pldm_get_sensor_reading_resp |
| 488 | * |
| 489 | * Structure representing PLDM get sensor reading response |
| 490 | */ |
| 491 | struct pldm_get_sensor_reading_resp { |
| 492 | uint8_t completion_code; |
| 493 | uint8_t sensor_data_size; |
| 494 | uint8_t sensor_operational_state; |
| 495 | uint8_t sensor_event_message_enable; |
| 496 | uint8_t present_state; |
| 497 | uint8_t previous_state; |
| 498 | uint8_t event_state; |
| 499 | uint8_t present_reading[1]; |
| 500 | } __attribute__((packed)); |
| 501 | |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 502 | /* Responder */ |
| 503 | |
George Liu | 30b859f | 2020-01-07 15:03:22 +0800 | [diff] [blame] | 504 | /* SetNumericEffecterValue */ |
| 505 | |
| 506 | /** @brief Decode SetNumericEffecterValue request data |
| 507 | * |
| 508 | * @param[in] msg - Request message |
| 509 | * @param[in] payload_length - Length of request message payload |
| 510 | * @param[out] effecter_id - used to identify and access the effecter |
| 511 | * @param[out] effecter_data_size - The bit width and format of the setting |
| 512 | * value for the effecter. |
| 513 | * value:{uint8,sint8,uint16,sint16,uint32,sint32} |
| 514 | * @param[out] effecter_value - The setting value of numeric effecter being |
| 515 | * requested. |
| 516 | * @return pldm_completion_codes |
| 517 | */ |
| 518 | int decode_set_numeric_effecter_value_req(const struct pldm_msg *msg, |
| 519 | size_t payload_length, |
| 520 | uint16_t *effecter_id, |
| 521 | uint8_t *effecter_data_size, |
| 522 | uint8_t *effecter_value); |
| 523 | |
| 524 | /** @brief Create a PLDM response message for SetNumericEffecterValue |
| 525 | * |
| 526 | * @param[in] instance_id - Message's instance id |
| 527 | * @param[in] completion_code - PLDM completion code |
| 528 | * @param[out] msg - Message will be written to this |
| 529 | * @param[in] payload_length - Length of request message payload |
| 530 | * @return pldm_completion_codes |
| 531 | * @note Caller is responsible for memory alloc and dealloc of param |
| 532 | * 'msg.body.payload' |
| 533 | */ |
| 534 | int encode_set_numeric_effecter_value_resp(uint8_t instance_id, |
| 535 | uint8_t completion_code, |
| 536 | struct pldm_msg *msg, |
| 537 | size_t payload_length); |
| 538 | |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 539 | /* SetStateEffecterStates */ |
| 540 | |
| 541 | /** @brief Create a PLDM response message for SetStateEffecterStates |
| 542 | * |
| 543 | * @param[in] instance_id - Message's instance id |
| 544 | * @param[in] completion_code - PLDM completion code |
| 545 | * @param[out] msg - Message will be written to this |
| 546 | * @return pldm_completion_codes |
| 547 | * @note Caller is responsible for memory alloc and dealloc of param |
| 548 | * 'msg.body.payload' |
| 549 | */ |
| 550 | |
| 551 | int encode_set_state_effecter_states_resp(uint8_t instance_id, |
| 552 | uint8_t completion_code, |
| 553 | struct pldm_msg *msg); |
| 554 | |
| 555 | /** @brief Decode SetStateEffecterStates request data |
| 556 | * |
Zahed Hossain | 223a73d | 2019-07-04 12:46:18 -0500 | [diff] [blame] | 557 | * @param[in] msg - Request message |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 558 | * @param[in] payload_length - Length of request message payload |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 559 | * @param[out] effecter_id - used to identify and access the effecter |
| 560 | * @param[out] comp_effecter_count - number of individual sets of effecter |
| 561 | * information. Upto eight sets of state effecter info can be accessed |
| 562 | * for a given effecter. |
| 563 | * @param[out] field - each unit is an instance of the stateFileld structure |
| 564 | * that is used to set the requested state for a particular effecter |
| 565 | * within the state effecter. This field holds the starting address of |
| 566 | * the stateField values. The user is responsible to allocate the |
| 567 | * memory prior to calling this command. Since the state field count is |
| 568 | * not known in advance, the user should allocate the maximum size |
| 569 | * always, which is 8 in number. |
| 570 | * @return pldm_completion_codes |
| 571 | */ |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 572 | |
Zahed Hossain | 223a73d | 2019-07-04 12:46:18 -0500 | [diff] [blame] | 573 | int decode_set_state_effecter_states_req(const struct pldm_msg *msg, |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 574 | size_t payload_length, |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 575 | uint16_t *effecter_id, |
| 576 | uint8_t *comp_effecter_count, |
| 577 | set_effecter_state_field *field); |
| 578 | |
Sampa Misra | 7fcfb66 | 2019-05-08 13:13:53 -0500 | [diff] [blame] | 579 | /* GetPDR */ |
| 580 | |
| 581 | /** @brief Create a PLDM response message for GetPDR |
| 582 | * |
| 583 | * @param[in] instance_id - Message's instance id |
| 584 | * @param[in] completion_code - PLDM completion code |
| 585 | * @param[in] next_record_hndl - The recordHandle for the PDR that is next in |
| 586 | * the PDR Repository |
| 587 | * @param[in] next_data_transfer_hndl - A handle that identifies the next |
| 588 | * portion of the PDR data to be transferred, if any |
| 589 | * @param[in] transfer_flag - Indicates the portion of PDR data being |
| 590 | * transferred |
| 591 | * @param[in] resp_cnt - The number of recordData bytes returned in this |
| 592 | * response |
| 593 | * @param[in] record_data - PDR data bytes of length resp_cnt |
| 594 | * @param[in] transfer_crc - A CRC-8 for the overall PDR. This is present only |
| 595 | * in the last part of a PDR being transferred |
| 596 | * @param[out] msg - Message will be written to this |
| 597 | * @return pldm_completion_codes |
| 598 | * @note Caller is responsible for memory alloc and dealloc of param |
| 599 | * 'msg.payload' |
| 600 | */ |
| 601 | int encode_get_pdr_resp(uint8_t instance_id, uint8_t completion_code, |
| 602 | uint32_t next_record_hndl, |
| 603 | uint32_t next_data_transfer_hndl, uint8_t transfer_flag, |
| 604 | uint16_t resp_cnt, const uint8_t *record_data, |
| 605 | uint8_t transfer_crc, struct pldm_msg *msg); |
| 606 | |
| 607 | /** @brief Decode GetPDR request data |
| 608 | * |
| 609 | * @param[in] msg - Request message |
| 610 | * @param[in] payload_length - Length of request message payload |
| 611 | * @param[out] record_hndl - The recordHandle value for the PDR to be retrieved |
| 612 | * @param[out] data_transfer_hndl - Handle used to identify a particular |
| 613 | * multipart PDR data transfer operation |
| 614 | * @param[out] transfer_op_flag - Flag to indicate the first or subsequent |
| 615 | * portion of transfer |
| 616 | * @param[out] request_cnt - The maximum number of record bytes requested |
| 617 | * @param[out] record_chg_num - Used to determine whether the PDR has changed |
| 618 | * while PDR transfer is going on |
| 619 | * @return pldm_completion_codes |
| 620 | */ |
| 621 | |
| 622 | int decode_get_pdr_req(const struct pldm_msg *msg, size_t payload_length, |
| 623 | uint32_t *record_hndl, uint32_t *data_transfer_hndl, |
| 624 | uint8_t *transfer_op_flag, uint16_t *request_cnt, |
| 625 | uint16_t *record_chg_num); |
| 626 | |
Jolie Ku | 3557bad | 2020-03-02 16:22:57 +0800 | [diff] [blame] | 627 | /* GetStateSensorReadings */ |
| 628 | |
| 629 | /** @brief Decode GetStateSensorReadings request data |
| 630 | * |
| 631 | * @param[in] msg - Request message |
| 632 | * @param[in] payload_length - Length of request message payload |
| 633 | * @param[out] sensor_id - used to identify and access the simple or composite |
| 634 | * sensor |
| 635 | * @param[out] sensor_rearm - Each bit location in this field corresponds to a |
| 636 | * particular sensor within the state sensor, where bit [0] corresponds |
| 637 | * to the first state sensor (sensor offset 0) and bit [7] corresponds |
| 638 | * to the eighth sensor (sensor offset 7), sequentially. |
| 639 | * @param[out] reserved - value: 0x00 |
| 640 | * @return pldm_completion_codes |
| 641 | */ |
| 642 | |
| 643 | int decode_get_state_sensor_readings_req(const struct pldm_msg *msg, |
| 644 | size_t payload_length, |
| 645 | uint16_t *sensor_id, |
| 646 | bitfield8_t *sensor_rearm, |
| 647 | uint8_t *reserved); |
| 648 | |
| 649 | /** @brief Encode GetStateSensorReadings response data |
| 650 | * |
| 651 | * @param[in] instance_id - Message's instance id |
| 652 | * @param[in] completion_code - PLDM completion code |
| 653 | * @param[out] comp_sensor_count - The number of individual sets of sensor |
| 654 | * information that this command accesses |
| 655 | * @param[out] field - Each stateField is an instance of a stateField structure |
| 656 | * that is used to return the present operational state setting and the |
| 657 | * present state and event state for a particular set of sensor |
| 658 | * information contained within the state sensor |
| 659 | * @param[out] msg - Message will be written to this |
| 660 | * @return pldm_completion_codes |
| 661 | */ |
| 662 | |
| 663 | int encode_get_state_sensor_readings_resp(uint8_t instance_id, |
| 664 | uint8_t completion_code, |
| 665 | uint8_t comp_sensor_count, |
| 666 | get_sensor_state_field *field, |
| 667 | struct pldm_msg *msg); |
| 668 | |
Jolie Ku | 6787f17 | 2020-03-19 11:15:53 +0800 | [diff] [blame] | 669 | /* GetNumericEffecterValue */ |
| 670 | |
| 671 | /** @brief Decode GetNumericEffecterValue request data |
| 672 | * |
| 673 | * @param[in] msg - Request message |
| 674 | * @param[in] payload_length - Length of request message payload |
| 675 | * @param[out] effecter_id - used to identify and access the effecter |
| 676 | * @return pldm_completion_codes |
| 677 | */ |
| 678 | int decode_get_numeric_effecter_value_req(const struct pldm_msg *msg, |
| 679 | size_t payload_length, |
| 680 | uint16_t *effecter_id); |
| 681 | |
| 682 | /** @brief Create a PLDM response message for GetNumericEffecterValue |
| 683 | * |
| 684 | * @param[in] instance_id - Message's instance id |
| 685 | * @param[in] completion_code - PLDM completion code |
| 686 | * @param[in] effecter_data_size - The bit width and format of the setting |
| 687 | * value for the effecter. |
| 688 | * value:{uint8,sint8,uint16,sint16,uint32,sint32} |
| 689 | * @param[in] effecter_oper_state - The state of the effecter itself |
| 690 | * @param[in] pending_value - The pending numeric value setting of the |
| 691 | * effecter. The effecterDataSize field indicates the number of |
| 692 | * bits used for this field |
| 693 | * @param[in] present_value - The present numeric value setting of the |
| 694 | * effecter. The effecterDataSize indicates the number of bits |
| 695 | * used for this field |
| 696 | * @param[out] msg - Message will be written to this |
| 697 | * @param[in] payload_length - Length of request message payload |
| 698 | * @return pldm_completion_codes |
| 699 | * @note Caller is responsible for memory alloc and dealloc of param |
| 700 | * 'msg.payload' |
| 701 | */ |
| 702 | int encode_get_numeric_effecter_value_resp( |
| 703 | uint8_t instance_id, uint8_t completion_code, uint8_t effecter_data_size, |
| 704 | uint8_t effecter_oper_state, uint8_t *pending_value, uint8_t *present_value, |
| 705 | struct pldm_msg *msg, size_t payload_length); |
| 706 | |
Jolie Ku | f798c8f | 2020-04-14 11:18:06 +0800 | [diff] [blame] | 707 | /* GetSensorReading */ |
| 708 | |
| 709 | /** @brief Decode GetSensorReading request data |
| 710 | * |
| 711 | * @param[in] msg - Request message |
| 712 | * @param[in] payload_length - Length of request message payload |
| 713 | * @param[out] sensor_id - A handle that is used to identify and access |
| 714 | * the sensor |
| 715 | * @param[out] rearm_event_state - true = manually re-arm EventState after |
| 716 | * responding to this request, false = no manual re-arm |
| 717 | * @return pldm_completion_codes |
| 718 | */ |
| 719 | |
| 720 | int decode_get_sensor_reading_req(const struct pldm_msg *msg, |
| 721 | size_t payload_length, uint16_t *sensor_id, |
| 722 | bool8_t *rearm_event_state); |
| 723 | |
| 724 | /** @brief Encode GetSensorReading response data |
| 725 | * |
| 726 | * @param[in] instance_id - Message's instance id |
| 727 | * @param[in] completion_code - PLDM completion code |
| 728 | * @param[out] sensor_data_size - The bit width and format of reading and |
| 729 | * threshold values |
| 730 | * @param[out] sensor_operational_state - The state of the sensor itself |
| 731 | * @param[out] sensor_event_message_enable - value: { noEventGeneration, |
| 732 | * eventsDisabled, eventsEnabled, opEventsOnlyEnabled, |
| 733 | * stateEventsOnlyEnabled } |
| 734 | * @param[out] present_state - The most recently assessed state value monitored |
| 735 | * by the sensor |
| 736 | * @param[out] previous_state - The state that the presentState was entered |
| 737 | * from |
| 738 | * @param[out] event_state - Indicates which threshold crossing assertion |
| 739 | * events have been detected |
| 740 | * @param[out] present_reading - The present value indicated by the sensor |
| 741 | * @param[out] msg - Message will be written to this |
| 742 | * @param[in] payload_length - Length of request message payload |
| 743 | * @return pldm_completion_codes |
| 744 | */ |
| 745 | |
| 746 | int encode_get_sensor_reading_resp( |
| 747 | uint8_t instance_id, uint8_t completion_code, uint8_t sensor_data_size, |
| 748 | uint8_t sensor_operational_state, uint8_t sensor_event_message_enable, |
| 749 | uint8_t present_state, uint8_t previous_state, uint8_t event_state, |
| 750 | uint8_t *present_reading, struct pldm_msg *msg, size_t payload_length); |
| 751 | |
Sampa Misra | 7fcfb66 | 2019-05-08 13:13:53 -0500 | [diff] [blame] | 752 | /* Requester */ |
| 753 | |
George Liu | 820a9a5 | 2019-11-26 14:43:59 +0800 | [diff] [blame] | 754 | /* GetPDR */ |
| 755 | |
| 756 | /** @brief Create a PLDM request message for GetPDR |
| 757 | * |
| 758 | * @param[in] instance_id - Message's instance id |
| 759 | * @param[in] record_hndl - The recordHandle value for the PDR to be retrieved |
| 760 | * @param[in] data_transfer_hndl - Handle used to identify a particular |
| 761 | * multipart PDR data transfer operation |
| 762 | * @param[in] transfer_op_flag - Flag to indicate the first or subsequent |
| 763 | * portion of transfer |
| 764 | * @param[in] request_cnt - The maximum number of record bytes requested |
| 765 | * @param[in] record_chg_num - Used to determine whether the PDR has changed |
| 766 | * while PDR transfer is going on |
| 767 | * @param[out] msg - Message will be written to this |
| 768 | * @param[in] payload_length - Length of request message payload |
| 769 | * @return pldm_completion_codes |
| 770 | * @note Caller is responsible for memory alloc and dealloc of param |
| 771 | * 'msg.payload' |
| 772 | */ |
| 773 | int encode_get_pdr_req(uint8_t instance_id, uint32_t record_hndl, |
| 774 | uint32_t data_transfer_hndl, uint8_t transfer_op_flag, |
| 775 | uint16_t request_cnt, uint16_t record_chg_num, |
| 776 | struct pldm_msg *msg, size_t payload_length); |
| 777 | |
| 778 | /** @brief Decode GetPDR response data |
| 779 | * |
George Liu | 684a716 | 2019-12-06 15:10:52 +0800 | [diff] [blame] | 780 | * Note: |
| 781 | * * If the return value is not PLDM_SUCCESS, it represents a |
| 782 | * transport layer error. |
| 783 | * * If the completion_code value is not PLDM_SUCCESS, it represents a |
| 784 | * protocol layer error and all the out-parameters are invalid. |
| 785 | * |
George Liu | 820a9a5 | 2019-11-26 14:43:59 +0800 | [diff] [blame] | 786 | * @param[in] msg - Request message |
| 787 | * @param[in] payload_length - Length of request message payload |
| 788 | * @param[out] completion_code - PLDM completion code |
| 789 | * @param[out] next_record_hndl - The recordHandle for the PDR that is next in |
| 790 | * the PDR Repository |
| 791 | * @param[out] next_data_transfer_hndl - A handle that identifies the next |
| 792 | * portion of the PDR data to be transferred, if any |
| 793 | * @param[out] transfer_flag - Indicates the portion of PDR data being |
| 794 | * transferred |
| 795 | * @param[out] resp_cnt - The number of recordData bytes returned in this |
| 796 | * response |
Zach Clark | 3dba2bf | 2020-03-31 10:58:03 -0500 | [diff] [blame] | 797 | * @param[out] record_data - PDR data bytes of length resp_cnt, or NULL to |
| 798 | * skip the copy and place the actual length in resp_cnt. |
George Liu | 820a9a5 | 2019-11-26 14:43:59 +0800 | [diff] [blame] | 799 | * @param[in] record_data_length - Length of record_data |
| 800 | * @param[out] transfer_crc - A CRC-8 for the overall PDR. This is present only |
| 801 | * in the last part of a PDR being transferred |
| 802 | * @return pldm_completion_codes |
| 803 | */ |
| 804 | int decode_get_pdr_resp(const struct pldm_msg *msg, size_t payload_length, |
| 805 | uint8_t *completion_code, uint32_t *next_record_hndl, |
| 806 | uint32_t *next_data_transfer_hndl, |
| 807 | uint8_t *transfer_flag, uint16_t *resp_cnt, |
| 808 | uint8_t *record_data, size_t record_data_length, |
| 809 | uint8_t *transfer_crc); |
| 810 | |
Sampa Misra | 7fcfb66 | 2019-05-08 13:13:53 -0500 | [diff] [blame] | 811 | /* SetStateEffecterStates */ |
| 812 | |
vkaverap | 98a2c19 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 813 | /** @brief Create a PLDM request message for SetStateEffecterStates |
| 814 | * |
| 815 | * @param[in] instance_id - Message's instance id |
| 816 | * @param[in] effecter_id - used to identify and access the effecter |
| 817 | * @param[in] comp_effecter_count - number of individual sets of effecter |
| 818 | * information. Upto eight sets of state effecter info can be accessed |
| 819 | * for a given effecter. |
| 820 | * @param[in] field - each unit is an instance of the stateField structure |
| 821 | * that is used to set the requested state for a particular effecter |
| 822 | * within the state effecter. This field holds the starting address of |
| 823 | * the stateField values. The user is responsible to allocate the |
| 824 | * memory prior to calling this command. The user has to allocate the |
| 825 | * field parameter as sizeof(set_effecter_state_field) * |
| 826 | * comp_effecter_count |
| 827 | * @param[out] msg - Message will be written to this |
| 828 | * @return pldm_completion_codes |
| 829 | * @note Caller is responsible for memory alloc and dealloc of param |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 830 | * 'msg.payload' |
vkaverap | 98a2c19 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 831 | */ |
| 832 | |
| 833 | int encode_set_state_effecter_states_req(uint8_t instance_id, |
| 834 | uint16_t effecter_id, |
| 835 | uint8_t comp_effecter_count, |
| 836 | set_effecter_state_field *field, |
| 837 | struct pldm_msg *msg); |
| 838 | |
| 839 | /** @brief Decode SetStateEffecterStates response data |
George Liu | 684a716 | 2019-12-06 15:10:52 +0800 | [diff] [blame] | 840 | * |
| 841 | * Note: |
| 842 | * * If the return value is not PLDM_SUCCESS, it represents a |
| 843 | * transport layer error. |
| 844 | * * If the completion_code value is not PLDM_SUCCESS, it represents a |
| 845 | * protocol layer error and all the out-parameters are invalid. |
| 846 | * |
Zahed Hossain | 223a73d | 2019-07-04 12:46:18 -0500 | [diff] [blame] | 847 | * @param[in] msg - Request message |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 848 | * @param[in] payload_length - Length of response message payload |
vkaverap | 98a2c19 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 849 | * @param[out] completion_code - PLDM completion code |
| 850 | * @return pldm_completion_codes |
| 851 | */ |
Zahed Hossain | 223a73d | 2019-07-04 12:46:18 -0500 | [diff] [blame] | 852 | int decode_set_state_effecter_states_resp(const struct pldm_msg *msg, |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 853 | size_t payload_length, |
vkaverap | 98a2c19 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 854 | uint8_t *completion_code); |
George Liu | 30b859f | 2020-01-07 15:03:22 +0800 | [diff] [blame] | 855 | |
| 856 | /* SetNumericEffecterValue */ |
| 857 | |
| 858 | /** @brief Create a PLDM request message for SetNumericEffecterValue |
| 859 | * |
| 860 | * @param[in] instance_id - Message's instance id |
| 861 | * @param[in] effecter_id - used to identify and access the effecter |
| 862 | * @param[in] effecter_data_size - The bit width and format of the setting |
| 863 | * value for the effecter. |
| 864 | * value:{uint8,sint8,uint16,sint16,uint32,sint32} |
| 865 | * @param[in] effecter_value - The setting value of numeric effecter being |
| 866 | * requested. |
| 867 | * @param[in] payload_length - Length of request message payload |
| 868 | * @param[out] msg - Message will be written to this |
| 869 | * @return pldm_completion_codes |
| 870 | * @note Caller is responsible for memory alloc and dealloc of param |
| 871 | * 'msg.payload' |
| 872 | */ |
| 873 | int encode_set_numeric_effecter_value_req( |
| 874 | uint8_t instance_id, uint16_t effecter_id, uint8_t effecter_data_size, |
| 875 | uint8_t *effecter_value, struct pldm_msg *msg, size_t payload_length); |
| 876 | |
| 877 | /** @brief Decode SetNumericEffecterValue response data |
| 878 | * @param[in] msg - Request message |
| 879 | * @param[in] payload_length - Length of response message payload |
| 880 | * @param[out] completion_code - PLDM completion code |
| 881 | * @return pldm_completion_codes |
| 882 | */ |
| 883 | int decode_set_numeric_effecter_value_resp(const struct pldm_msg *msg, |
| 884 | size_t payload_length, |
| 885 | uint8_t *completion_code); |
| 886 | |
Jolie Ku | 3557bad | 2020-03-02 16:22:57 +0800 | [diff] [blame] | 887 | /** @brief Create a PLDM request message for GetStateSensorReadings |
| 888 | * |
| 889 | * @param[in] instance_id - Message's instance id |
| 890 | * @param[in] sensor_id - used to identify and access the simple or composite |
| 891 | * sensor |
| 892 | * @param[in] sensorRearm - Each bit location in this field corresponds to a |
| 893 | * particular sensor within the state sensor, where bit [0] corresponds |
| 894 | * to the first state sensor (sensor offset 0) and bit [7] corresponds |
| 895 | * to the eighth sensor (sensor offset 7), sequentially |
| 896 | * @param[in] reserved - value: 0x00 |
| 897 | * @param[out] msg - Message will be written to this |
| 898 | * @return pldm_completion_codes |
| 899 | * @note Caller is responsible for memory alloc and dealloc of param |
| 900 | * 'msg.payload' |
| 901 | */ |
Jolie Ku | 3557bad | 2020-03-02 16:22:57 +0800 | [diff] [blame] | 902 | int encode_get_state_sensor_readings_req(uint8_t instance_id, |
| 903 | uint16_t sensor_id, |
| 904 | bitfield8_t sensor_rearm, |
| 905 | uint8_t reserved, |
| 906 | struct pldm_msg *msg); |
| 907 | |
| 908 | /** @brief Decode GetStateSensorReadings response data |
| 909 | * |
| 910 | * @param[in] msg - Request message |
| 911 | * @param[in] payload_length - Length of response message payload |
| 912 | * @param[out] completion_code - PLDM completion code |
| 913 | * @param[in,out] comp_sensor_count - The number of individual sets of sensor |
| 914 | * information that this command accesses |
| 915 | * @param[out] field - Each stateField is an instance of a stateField structure |
| 916 | * that is used to return the present operational state setting and the |
| 917 | * present state and event state for a particular set of sensor |
| 918 | * information contained within the state sensor |
| 919 | * @return pldm_completion_codes |
| 920 | */ |
| 921 | |
| 922 | int decode_get_state_sensor_readings_resp(const struct pldm_msg *msg, |
| 923 | size_t payload_length, |
| 924 | uint8_t *completion_code, |
| 925 | uint8_t *comp_sensor_count, |
| 926 | get_sensor_state_field *field); |
| 927 | |
Zahed Hossain | d4abab1 | 2020-02-06 03:36:43 -0600 | [diff] [blame] | 928 | /* PlatformEventMessage */ |
| 929 | |
| 930 | /** @brief Decode PlatformEventMessage request data |
| 931 | * @param[in] msg - Request message |
| 932 | * @param[in] payload_length - Length of response message payload |
| 933 | * @param[out] format_version - Version of the event format |
| 934 | * @param[out] tid - Terminus ID for the terminus that originated the event |
| 935 | * message |
| 936 | * @param[out] event_class - The class of event being sent |
| 937 | * @param[out] event_data_offset - Offset where the event data should be read |
| 938 | * from pldm msg |
| 939 | * @return pldm_completion_codes |
| 940 | */ |
| 941 | int decode_platform_event_message_req(const struct pldm_msg *msg, |
| 942 | size_t payload_length, |
| 943 | uint8_t *format_version, uint8_t *tid, |
| 944 | uint8_t *event_class, |
| 945 | size_t *event_data_offset); |
| 946 | |
| 947 | /** @brief Encode PlatformEventMessage response data |
| 948 | * @param[in] instance_id - Message's instance id |
| 949 | * @param[in] completion_code - PLDM completion code |
Pavithra Barithaya | 2ea1f07 | 2020-04-03 09:30:23 -0500 | [diff] [blame] | 950 | * @param[in] platform_event_status - Response status of the event message |
| 951 | * command |
Zahed Hossain | d4abab1 | 2020-02-06 03:36:43 -0600 | [diff] [blame] | 952 | * @param[out] msg - Message will be written to this |
| 953 | * @return pldm_completion_codes |
| 954 | * @note Caller is responsible for memory alloc and dealloc of param |
| 955 | * 'msg.payload' |
| 956 | */ |
| 957 | int encode_platform_event_message_resp(uint8_t instance_id, |
Pavithra Barithaya | 2ea1f07 | 2020-04-03 09:30:23 -0500 | [diff] [blame] | 958 | uint8_t completion_code, |
| 959 | uint8_t platform_event_status, |
Zahed Hossain | d4abab1 | 2020-02-06 03:36:43 -0600 | [diff] [blame] | 960 | struct pldm_msg *msg); |
| 961 | |
Pavithra Barithaya | 35f2b2c | 2020-04-08 01:35:56 -0500 | [diff] [blame] | 962 | /** @brief Encode PlatformEventMessage request data |
| 963 | * @param[in] instance_id - Message's instance id |
| 964 | * @param[in] format_version - Version of the event format |
| 965 | * @param[in] tid - Terminus ID for the terminus that originated the event |
| 966 | * message |
| 967 | * @param[in] event_class - The class of event being sent |
| 968 | * @param[in] event_data - the event data should be read from pldm msg |
| 969 | * @param[in] event_data_length - Length of the event data |
| 970 | * @param[out] msg - Request message |
| 971 | * @return pldm_completion_codes |
| 972 | * @note Caller is responsible for memory alloc and dealloc of param |
| 973 | * 'msg.payload' |
| 974 | */ |
| 975 | int encode_platform_event_message_req(uint8_t instance_id, |
| 976 | uint8_t format_version, uint8_t tid, |
| 977 | uint8_t event_class, |
| 978 | const uint8_t *event_data, |
| 979 | size_t event_data_length, |
| 980 | struct pldm_msg *msg); |
| 981 | |
| 982 | /** @brief Decode PlatformEventMessage response data |
| 983 | * @param[in] msg - Request message |
| 984 | * @param[in] payload_length - Length of Response message payload |
| 985 | * @param[out] completion_code - PLDM completion code |
| 986 | * @param[out] platform_event_status - Response status of the event message |
| 987 | * command |
| 988 | * @return pldm_completion_codes |
| 989 | */ |
| 990 | int decode_platform_event_message_resp(const struct pldm_msg *msg, |
| 991 | size_t payload_length, |
| 992 | uint8_t *completion_code, |
| 993 | uint8_t *platform_event_status); |
| 994 | |
Zahed Hossain | 1c86171 | 2020-03-04 08:55:19 -0600 | [diff] [blame] | 995 | /** @brief Decode sensorEventData response data |
| 996 | * |
| 997 | * @param[in] event_data - event data from the response message |
| 998 | * @param[in] event_data_length - length of the event data |
| 999 | * @param[out] sensor_id - sensorID value of the sensor |
| 1000 | * @param[out] sensor_event_class_type - Type of sensor event class |
| 1001 | * @param[out] event_class_data_offset - Offset where the event class data |
| 1002 | * should be read from event data |
| 1003 | * @return pldm_completion_codes |
| 1004 | * @note Caller is responsible for memory alloc and dealloc of param |
| 1005 | * 'event_data' |
| 1006 | */ |
| 1007 | int decode_sensor_event_data(const uint8_t *event_data, |
| 1008 | size_t event_data_length, uint16_t *sensor_id, |
| 1009 | uint8_t *sensor_event_class_type, |
| 1010 | size_t *event_class_data_offset); |
| 1011 | |
| 1012 | /** @brief Decode sensorOpState response data |
| 1013 | * |
| 1014 | * @param[in] sensor_data - sensor_data for sensorEventClass = sensorOpState |
| 1015 | * @param[in] sensor_data_length - Length of sensor_data |
| 1016 | * @param[out] present_op_state - The sensorOperationalState value from the |
| 1017 | * state change that triggered the event message |
| 1018 | * @param[out] previous_op_state - The sensorOperationalState value for the |
| 1019 | * state from which the present state was entered |
| 1020 | * @return pldm_completion_codes |
| 1021 | * @note Caller is responsible for memory alloc and dealloc of param |
| 1022 | * 'sensor_data' |
| 1023 | */ |
| 1024 | int decode_sensor_op_data(const uint8_t *sensor_data, size_t sensor_data_length, |
| 1025 | uint8_t *present_op_state, |
| 1026 | uint8_t *previous_op_state); |
| 1027 | |
| 1028 | /** @brief Decode stateSensorState response data |
| 1029 | * |
| 1030 | * @param[in] sensor_data - sensor_data for sensorEventClass = stateSensorState |
| 1031 | * @param[in] sensor_data_length - Length of sensor_data |
| 1032 | * @param[out] sensor_offset - Identifies which state sensor within a composite |
| 1033 | * state sensor the event is being returned for |
| 1034 | * @param[out] event_state - The event state value from the state change that |
| 1035 | * triggered the event message |
| 1036 | * @param[out] previous_event_state - The event state value for the state from |
| 1037 | * which the present event state was entered |
| 1038 | * @return pldm_completion_codes |
| 1039 | * @note Caller is responsible for memory alloc and dealloc of param |
| 1040 | * 'sensor_data' |
| 1041 | */ |
| 1042 | int decode_state_sensor_data(const uint8_t *sensor_data, |
| 1043 | size_t sensor_data_length, uint8_t *sensor_offset, |
| 1044 | uint8_t *event_state, |
| 1045 | uint8_t *previous_event_state); |
| 1046 | |
| 1047 | /** @brief Decode numericSensorState response data |
| 1048 | * |
| 1049 | * @param[in] sensor_data - sensor_data for sensorEventClass = |
| 1050 | * numericSensorState |
| 1051 | * @param[in] sensor_data_length - Length of sensor_data |
| 1052 | * @param[out] event_state - The eventState value from the state change that |
| 1053 | * triggered the event message |
| 1054 | * @param[out] previous_event_state - The eventState value for the state from |
| 1055 | * which the present state was entered |
| 1056 | * @param[out] sensor_data_size - The bit width and format of reading and |
| 1057 | * threshold values that the sensor returns |
| 1058 | * @param[out] present_reading - The present value indicated by the sensor |
| 1059 | * @return pldm_completion_codes |
| 1060 | * @note Caller is responsible for memory alloc and dealloc of param |
| 1061 | * 'sensor_data' |
| 1062 | */ |
| 1063 | int decode_numeric_sensor_data(const uint8_t *sensor_data, |
| 1064 | size_t sensor_data_length, uint8_t *event_state, |
| 1065 | uint8_t *previous_event_state, |
| 1066 | uint8_t *sensor_data_size, |
| 1067 | uint32_t *present_reading); |
| 1068 | |
Jolie Ku | 6787f17 | 2020-03-19 11:15:53 +0800 | [diff] [blame] | 1069 | /* GetNumericEffecterValue */ |
| 1070 | |
| 1071 | /** @brief Create a PLDM request message for GetNumericEffecterValue |
| 1072 | * |
| 1073 | * @param[in] instance_id - Message's instance id |
| 1074 | * @param[in] effecter_id - used to identify and access the effecter |
| 1075 | * @param[out] msg - Message will be written to this |
| 1076 | * @return pldm_completion_codes |
| 1077 | * @note Caller is responsible for memory alloc and dealloc of param |
| 1078 | * 'msg.payload' |
| 1079 | */ |
| 1080 | int encode_get_numeric_effecter_value_req(uint8_t instance_id, |
| 1081 | uint16_t effecter_id, |
| 1082 | struct pldm_msg *msg); |
| 1083 | |
| 1084 | /** @brief Create a PLDM response message for GetNumericEffecterValue |
| 1085 | * |
| 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] effecter_data_size - The bit width and format of the setting |
| 1090 | * value for the effecter. |
| 1091 | * value:{uint8,sint8,uint16,sint16,uint32,sint32} |
| 1092 | * @param[out] effecter_oper_state - The state of the effecter itself |
| 1093 | * @param[out] pending_value - The pending numeric value setting of the |
| 1094 | * effecter. The effecterDataSize field indicates the number of |
| 1095 | * bits used for this field |
| 1096 | * @param[out] present_value - The present numeric value setting of the |
| 1097 | * effecter. The effecterDataSize indicates the number of bits |
| 1098 | * used for this field |
| 1099 | * @return pldm_completion_codes |
| 1100 | */ |
| 1101 | int decode_get_numeric_effecter_value_resp( |
| 1102 | const struct pldm_msg *msg, size_t payload_length, uint8_t *completion_code, |
| 1103 | uint8_t *effecter_data_size, uint8_t *effecter_oper_state, |
| 1104 | uint8_t *pending_value, uint8_t *present_value); |
| 1105 | |
Zahed Hossain | 9be087c | 2020-04-02 02:26:41 -0500 | [diff] [blame] | 1106 | /** @brief Decode pldmPDRRepositoryChgEvent response data |
| 1107 | * |
| 1108 | * @param[in] event_data - eventData for pldmPDRRepositoryChgEvent |
| 1109 | * @param[in] event_data_size - Length of event_data |
| 1110 | * @param[out] event_data_format - This field indicates if the changedRecords |
| 1111 | * are of PDR Types or PDR Record Handles |
| 1112 | * @param[out] number_of_change_records - The number of changeRecords following |
| 1113 | * this field |
| 1114 | * @param[out] change_record_data_offset - Identifies where changeRecord data |
| 1115 | * is located within event_data |
| 1116 | * @return pldm_completion_codes |
| 1117 | * @note Caller is responsible for memory alloc and dealloc of param |
| 1118 | * 'event_data' |
| 1119 | */ |
| 1120 | int decode_pldm_pdr_repository_chg_event_data( |
| 1121 | const uint8_t *event_data, size_t event_data_size, |
| 1122 | uint8_t *event_data_format, uint8_t *number_of_change_records, |
| 1123 | size_t *change_record_data_offset); |
| 1124 | |
| 1125 | /** @brief Decode PldmPDRRepositoryChangeRecord response data |
| 1126 | * |
| 1127 | * @param[in] change_record_data - changeRecordData for |
| 1128 | * pldmPDRRepositoryChgEvent |
| 1129 | * @param[in] change_record_data_size - Length of change_record_data |
| 1130 | * @param[out] event_data_operation - This field indicates the changeEntries |
| 1131 | * operation types |
| 1132 | * @param[out] number_of_change_entries - The number of changeEntries following |
| 1133 | * this field |
| 1134 | * @param[out] change_entry_data_offset - Identifies where changeEntries data |
| 1135 | * is located within change_record_data |
| 1136 | * @return pldm_completion_codes |
| 1137 | * @note Caller is responsible for memory alloc and dealloc of param |
| 1138 | * 'change_record_data' |
| 1139 | */ |
| 1140 | int decode_pldm_pdr_repository_change_record_data( |
| 1141 | const uint8_t *change_record_data, size_t change_record_data_size, |
| 1142 | uint8_t *event_data_operation, uint8_t *number_of_change_entries, |
| 1143 | size_t *change_entry_data_offset); |
| 1144 | |
Jolie Ku | f798c8f | 2020-04-14 11:18:06 +0800 | [diff] [blame] | 1145 | /* GetSensorReading */ |
| 1146 | |
| 1147 | /** @brief Encode GetSensorReading request data |
| 1148 | * |
| 1149 | * @param[in] instance_id - Message's instance id |
| 1150 | * @param[in] sensor_id - A handle that is used to identify and access the |
| 1151 | * sensor |
| 1152 | * @param[in] rearm_event_state - true = manually re-arm EventState after |
| 1153 | * responding to this request, false = no manual re-arm |
| 1154 | * @param[out] msg - Message will be written to this |
| 1155 | * @return pldm_completion_codes |
| 1156 | * @note Caller is responsible for memory alloc and dealloc of param |
| 1157 | * 'msg.payload' |
| 1158 | */ |
| 1159 | int encode_get_sensor_reading_req(uint8_t instance_id, uint16_t sensor_id, |
| 1160 | bool8_t rearm_event_state, |
| 1161 | struct pldm_msg *msg); |
| 1162 | |
| 1163 | /** @brief Decode GetSensorReading response data |
| 1164 | * |
| 1165 | * @param[in] msg - Request message |
| 1166 | * @param[in] payload_length - Length of response message payload |
| 1167 | * @param[out] completion_code - PLDM completion code |
| 1168 | * @param[out] sensor_data_size - The bit width and format of reading and |
| 1169 | * threshold values |
| 1170 | * @param[out] sensor_operational_state - The state of the sensor itself |
| 1171 | * @param[out] sensor_event_message_enable - value: { noEventGeneration, |
| 1172 | * eventsDisabled, eventsEnabled, opEventsOnlyEnabled, |
| 1173 | * stateEventsOnlyEnabled } |
| 1174 | * @param[out] present_state - The most recently assessed state value monitored |
| 1175 | * by the sensor |
| 1176 | * @param[out] previous_state - The state that the presentState was entered |
| 1177 | * from |
| 1178 | * @param[out] event_state - Indicates which threshold crossing assertion |
| 1179 | * events have been detected |
| 1180 | * @param[out] present_reading - The present value indicated by the sensor |
| 1181 | * @return pldm_completion_codes |
| 1182 | */ |
| 1183 | |
| 1184 | int decode_get_sensor_reading_resp( |
| 1185 | const struct pldm_msg *msg, size_t payload_length, uint8_t *completion_code, |
| 1186 | uint8_t *sensor_data_size, uint8_t *sensor_operational_state, |
| 1187 | uint8_t *sensor_event_message_enable, uint8_t *present_state, |
| 1188 | uint8_t *previous_state, uint8_t *event_state, uint8_t *present_reading); |
| 1189 | |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 1190 | #ifdef __cplusplus |
| 1191 | } |
| 1192 | #endif |
| 1193 | |
| 1194 | #endif /* PLATFORM_H */ |