1 /* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ 2 #ifndef PLATFORM_H 3 #define PLATFORM_H 4 5 #ifdef __cplusplus 6 extern "C" { 7 #endif 8 9 #include <stddef.h> 10 #include <stdint.h> 11 12 #include <libpldm/base.h> 13 #include <libpldm/pdr.h> 14 #include <libpldm/pldm_types.h> 15 16 /* Maximum size for request */ 17 #define PLDM_SET_STATE_EFFECTER_STATES_REQ_BYTES 19 18 #define PLDM_GET_STATE_SENSOR_READINGS_REQ_BYTES 4 19 #define PLDM_GET_NUMERIC_EFFECTER_VALUE_REQ_BYTES 2 20 #define PLDM_GET_STATE_EFFECTER_STATES_REQ_BYTES 2 21 #define PLDM_GET_SENSOR_READING_REQ_BYTES 3 22 #define PLDM_SET_EVENT_RECEIVER_REQ_BYTES 5 23 /* Response lengths are inclusive of completion code */ 24 #define PLDM_SET_STATE_EFFECTER_STATES_RESP_BYTES 1 25 26 #define PLDM_SET_NUMERIC_EFFECTER_VALUE_RESP_BYTES 1 27 #define PLDM_SET_NUMERIC_EFFECTER_VALUE_MIN_REQ_BYTES 4 28 29 #define PLDM_GET_PDR_REQ_BYTES 13 30 31 #define PLDM_SET_EVENT_RECEIVER_RESP_BYTES 1 32 33 /* Platform event supported request */ 34 #define PLDM_EVENT_MESSAGE_BUFFER_SIZE_REQ_BYTES 2 35 #define PLDM_EVENT_MESSAGE_BUFFER_SIZE_RESP_BYTES 3 36 37 #define PLDM_EVENT_MESSAGE_SUPPORTED_REQ_BYTES 1 38 #define PLDM_EVENT_MESSAGE_SUPPORTED_MIN_RESP_BYTES 4 39 40 #define PLDM_POLL_FOR_PLATFORM_EVENT_MESSAGE_REQ_BYTES 8 41 #define PLDM_POLL_FOR_PLATFORM_EVENT_MESSAGE_MIN_RESP_BYTES 4 42 #define PLDM_POLL_FOR_PLATFORM_EVENT_MESSAGE_RESP_BYTES 14 43 #define PLDM_POLL_FOR_PLATFORM_EVENT_MESSAGE_CHECKSUM_BYTES 4 44 45 /* Minimum response length */ 46 #define PLDM_GET_PDR_MIN_RESP_BYTES 12 47 #define PLDM_GET_NUMERIC_EFFECTER_VALUE_MIN_RESP_BYTES 5 48 #define PLDM_GET_STATE_EFFECTER_STATES_MIN_RESP_BYTES 2 49 #define PLDM_GET_SENSOR_READING_MIN_RESP_BYTES 8 50 #define PLDM_GET_STATE_SENSOR_READINGS_MIN_RESP_BYTES 2 51 #define PLDM_GET_PDR_REPOSITORY_INFO_RESP_BYTES 41 52 53 /* Minimum length for PLDM PlatformEventMessage request */ 54 #define PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES 3 55 #define PLDM_PLATFORM_EVENT_MESSAGE_STATE_SENSOR_STATE_REQ_BYTES 6 56 #define PLDM_PLATFORM_EVENT_MESSAGE_RESP_BYTES 2 57 #define PLDM_PLATFORM_EVENT_MESSAGE_FORMAT_VERSION 1 58 #define PLDM_PLATFORM_EVENT_MESSAGE_EVENT_ID 2 59 #define PLDM_PLATFORM_EVENT_MESSAGE_TRANFER_HANDLE 4 60 61 /* Minimum length of sensor event data */ 62 #define PLDM_MSG_POLL_EVENT_LENGTH 7 63 64 /* Minimum length of sensor event data */ 65 #define PLDM_SENSOR_EVENT_DATA_MIN_LENGTH 5 66 #define PLDM_SENSOR_EVENT_SENSOR_OP_STATE_DATA_LENGTH 2 67 #define PLDM_SENSOR_EVENT_STATE_SENSOR_STATE_DATA_LENGTH 3 68 #define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_MIN_DATA_LENGTH 4 69 #define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_MAX_DATA_LENGTH 7 70 #define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_8BIT_DATA_LENGTH 4 71 #define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_16BIT_DATA_LENGTH 5 72 #define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_32BIT_DATA_LENGTH 7 73 74 /* Minimum length of data for pldmPDRRepositoryChgEvent */ 75 #define PLDM_PDR_REPOSITORY_CHG_EVENT_MIN_LENGTH 2 76 #define PLDM_PDR_REPOSITORY_CHANGE_RECORD_MIN_LENGTH 2 77 78 /* Minimum length of numeric sensor PDR */ 79 #define PLDM_PDR_NUMERIC_SENSOR_PDR_FIXED_LENGTH 57 80 #define PLDM_PDR_NUMERIC_SENSOR_PDR_VARIED_SENSOR_DATA_SIZE_MIN_LENGTH 3 81 #define PLDM_PDR_NUMERIC_SENSOR_PDR_VARIED_RANGE_FIELD_MIN_LENGTH 9 82 #define PLDM_PDR_NUMERIC_SENSOR_PDR_MIN_LENGTH \ 83 (PLDM_PDR_NUMERIC_SENSOR_PDR_FIXED_LENGTH + \ 84 PLDM_PDR_NUMERIC_SENSOR_PDR_VARIED_SENSOR_DATA_SIZE_MIN_LENGTH + \ 85 PLDM_PDR_NUMERIC_SENSOR_PDR_VARIED_RANGE_FIELD_MIN_LENGTH) 86 87 /* Minimum length of numeric effecter PDR */ 88 #define PLDM_PDR_NUMERIC_EFFECTER_PDR_FIXED_LENGTH 56 89 #define PLDM_PDR_NUMERIC_EFFECTER_PDR_VARIED_EFFECTER_DATA_SIZE_MIN_LENGTH 2 90 #define PLDM_PDR_NUMERIC_EFFECTER_PDR_VARIED_RANGE_FIELD_MIN_LENGTH 5 91 #define PLDM_PDR_NUMERIC_EFFECTER_PDR_MIN_LENGTH \ 92 (PLDM_PDR_NUMERIC_EFFECTER_PDR_FIXED_LENGTH + \ 93 PLDM_PDR_NUMERIC_EFFECTER_PDR_VARIED_EFFECTER_DATA_SIZE_MIN_LENGTH + \ 94 PLDM_PDR_NUMERIC_EFFECTER_PDR_VARIED_RANGE_FIELD_MIN_LENGTH) 95 96 #define PLDM_INVALID_EFFECTER_ID 0xffff 97 98 /* DSP0248 Table1 PLDM monitoring and control data types */ 99 #define PLDM_STR_UTF_8_MAX_LEN 256 100 #define PLDM_STR_UTF_16_MAX_LEN 256 101 102 /* Wire-format substructure sizes */ 103 #define PLDM_GET_EFFECTER_STATE_FIELD_SIZE 3 104 105 /* State fields count bounds */ 106 #define PLDM_GET_EFFECTER_STATE_FIELD_COUNT_MIN 1 107 #define PLDM_GET_EFFECTER_STATE_FIELD_COUNT_MAX 8 108 109 enum pldm_effecter_data_size { 110 PLDM_EFFECTER_DATA_SIZE_UINT8, 111 PLDM_EFFECTER_DATA_SIZE_SINT8, 112 PLDM_EFFECTER_DATA_SIZE_UINT16, 113 PLDM_EFFECTER_DATA_SIZE_SINT16, 114 PLDM_EFFECTER_DATA_SIZE_UINT32, 115 PLDM_EFFECTER_DATA_SIZE_SINT32 116 }; 117 118 enum pldm_range_field_format { 119 PLDM_RANGE_FIELD_FORMAT_UINT8, 120 PLDM_RANGE_FIELD_FORMAT_SINT8, 121 PLDM_RANGE_FIELD_FORMAT_UINT16, 122 PLDM_RANGE_FIELD_FORMAT_SINT16, 123 PLDM_RANGE_FIELD_FORMAT_UINT32, 124 PLDM_RANGE_FIELD_FORMAT_SINT32, 125 PLDM_RANGE_FIELD_FORMAT_REAL32 126 }; 127 #define PLDM_RANGE_FIELD_FORMAT_MAX PLDM_RANGE_FIELD_FORMAT_REAL32 128 129 enum set_request { PLDM_NO_CHANGE = 0x00, PLDM_REQUEST_SET = 0x01 }; 130 131 enum effecter_state { PLDM_INVALID_VALUE = 0xff }; 132 133 enum pldm_sensor_present_state { 134 PLDM_SENSOR_UNKNOWN = 0x0, 135 PLDM_SENSOR_NORMAL = 0x01, 136 PLDM_SENSOR_WARNING = 0x02, 137 PLDM_SENSOR_CRITICAL = 0x03, 138 PLDM_SENSOR_FATAL = 0x04, 139 PLDM_SENSOR_LOWERWARNING = 0x05, 140 PLDM_SENSOR_LOWERCRITICAL = 0x06, 141 PLDM_SENSOR_LOWERFATAL = 0x07, 142 PLDM_SENSOR_UPPERWARNING = 0x08, 143 PLDM_SENSOR_UPPERCRITICAL = 0x09, 144 PLDM_SENSOR_UPPERFATAL = 0x0a 145 }; 146 147 enum pldm_sensor_event_message_enable { 148 PLDM_NO_EVENT_GENERATION, 149 PLDM_EVENTS_DISABLED, 150 PLDM_EVENTS_ENABLED, 151 PLDM_OP_EVENTS_ONLY_ENABLED, 152 PLDM_STATE_EVENTS_ONLY_ENABLED 153 }; 154 155 enum pldm_effecter_oper_state { 156 EFFECTER_OPER_STATE_ENABLED_UPDATEPENDING, 157 EFFECTER_OPER_STATE_ENABLED_NOUPDATEPENDING, 158 EFFECTER_OPER_STATE_DISABLED, 159 EFFECTER_OPER_STATE_UNAVAILABLE, 160 EFFECTER_OPER_STATE_STATUSUNKNOWN, 161 EFFECTER_OPER_STATE_FAILED, 162 EFFECTER_OPER_STATE_INITIALIZING, 163 EFFECTER_OPER_STATE_SHUTTINGDOWN, 164 EFFECTER_OPER_STATE_INTEST 165 }; 166 167 enum pldm_platform_commands { 168 PLDM_SET_EVENT_RECEIVER = 0x04, 169 PLDM_PLATFORM_EVENT_MESSAGE = 0x0a, 170 PLDM_POLL_FOR_PLATFORM_EVENT_MESSAGE = 0x0b, 171 PLDM_EVENT_MESSAGE_SUPPORTED = 0x0c, 172 PLDM_EVENT_MESSAGE_BUFFER_SIZE = 0x0d, 173 PLDM_GET_SENSOR_READING = 0x11, 174 PLDM_GET_STATE_SENSOR_READINGS = 0x21, 175 PLDM_SET_NUMERIC_EFFECTER_VALUE = 0x31, 176 PLDM_GET_NUMERIC_EFFECTER_VALUE = 0x32, 177 PLDM_SET_STATE_EFFECTER_STATES = 0x39, 178 PLDM_GET_STATE_EFFECTER_STATES = 0x3a, 179 PLDM_GET_PDR_REPOSITORY_INFO = 0x50, 180 PLDM_GET_PDR = 0x51, 181 }; 182 183 /** @brief PLDM PDR types defined in DSP0248_1.2.0 section 28.2 184 */ 185 enum pldm_pdr_types { 186 PLDM_TERMINUS_LOCATOR_PDR = 1, 187 PLDM_NUMERIC_SENSOR_PDR = 2, 188 PLDM_NUMERIC_SENSOR_INITIALIZATION_PDR = 3, 189 PLDM_STATE_SENSOR_PDR = 4, 190 PLDM_STATE_SENSOR_INITIALIZATION_PDR = 5, 191 PLDM_SENSOR_AUXILIARY_NAMES_PDR = 6, 192 PLDM_OEM_UNIT_PDR = 7, 193 PLDM_OEM_STATE_SET_PDR = 8, 194 PLDM_NUMERIC_EFFECTER_PDR = 9, 195 PLDM_NUMERIC_EFFECTER_INITIALIZATION_PDR = 10, 196 PLDM_STATE_EFFECTER_PDR = 11, 197 PLDM_STATE_EFFECTER_INITIALIZATION_PDR = 12, 198 PLDM_EFFECTER_AUXILIARY_NAMES_PDR = 13, 199 PLDM_EFFECTER_OEM_SEMANTIC_PDR = 14, 200 PLDM_PDR_ENTITY_ASSOCIATION = 15, 201 PLDM_ENTITY_AUXILIARY_NAMES_PDR = 16, 202 PLDM_OEM_ENTITY_ID_PDR = 17, 203 PLDM_INTERRUPT_ASSOCIATION_PDR = 18, 204 PLDM_EVENT_LOG_PDR = 19, 205 PLDM_PDR_FRU_RECORD_SET = 20, 206 PLDM_COMPACT_NUMERIC_SENSOR_PDR = 21, 207 PLDM_REDFISH_RESOURCE_PDR = 22, 208 PLDM_REDFISH_ENTITY_ASSOCIATION_PDR = 23, 209 PLDM_REDFISH_ACTION_PDR = 24, 210 PLDM_OEM_DEVICE_PDR = 126, 211 PLDM_OEM_PDR = 127, 212 }; 213 214 /** @brief PLDM effecter initialization schemes 215 */ 216 enum pldm_effecter_init { 217 PLDM_NO_INIT, 218 PLDM_USE_INIT_PDR, 219 PLDM_ENABLE_EFFECTER, 220 PLDM_DISABLE_EFECTER 221 }; 222 223 /** @brief PLDM Platform M&C completion codes 224 */ 225 enum pldm_platform_completion_codes { 226 PLDM_PLATFORM_INVALID_SENSOR_ID = 0x80, 227 PLDM_PLATFORM_REARM_UNAVAILABLE_IN_PRESENT_STATE = 0x81, 228 229 PLDM_PLATFORM_INVALID_EFFECTER_ID = 0x80, 230 PLDM_PLATFORM_INVALID_STATE_VALUE = 0x81, 231 232 PLDM_PLATFORM_INVALID_DATA_TRANSFER_HANDLE = 0x80, 233 PLDM_PLATFORM_INVALID_TRANSFER_OPERATION_FLAG = 0x81, 234 PLDM_PLATFORM_INVALID_RECORD_HANDLE = 0x82, 235 PLDM_PLATFORM_INVALID_RECORD_CHANGE_NUMBER = 0x83, 236 PLDM_PLATFORM_TRANSFER_TIMEOUT = 0x84, 237 238 PLDM_PLATFORM_SET_EFFECTER_UNSUPPORTED_SENSORSTATE = 0x82, 239 240 PLDM_PLATFORM_INVALID_PROTOCOL_TYPE = 0x80, 241 PLDM_PLATFORM_ENABLE_METHOD_NOT_SUPPORTED = 0x81, 242 PLDM_PLATFORM_HEARTBEAT_FREQUENCY_TOO_HIGH = 0x82, 243 }; 244 245 /** @brief PLDM Event types 246 */ 247 enum pldm_event_types { 248 PLDM_SENSOR_EVENT = 0x00, 249 PLDM_EFFECTER_EVENT = 0x01, 250 PLDM_REDFISH_TASK_EXECUTED_EVENT = 0x02, 251 PLDM_REDFISH_MESSAGE_EVENT = 0x03, 252 PLDM_PDR_REPOSITORY_CHG_EVENT = 0x04, 253 PLDM_MESSAGE_POLL_EVENT = 0x05, 254 PLDM_HEARTBEAT_TIMER_ELAPSED_EVENT = 0x06 255 }; 256 257 /** @brief PLDM sensorEventClass states 258 */ 259 enum sensor_event_class_states { 260 PLDM_SENSOR_OP_STATE, 261 PLDM_STATE_SENSOR_STATE, 262 PLDM_NUMERIC_SENSOR_STATE 263 }; 264 265 /** @brief PLDM sensor supported states 266 */ 267 enum pldm_sensor_operational_state { 268 PLDM_SENSOR_ENABLED, 269 PLDM_SENSOR_DISABLED, 270 PLDM_SENSOR_UNAVAILABLE, 271 PLDM_SENSOR_STATUSUNKOWN, 272 PLDM_SENSOR_FAILED, 273 PLDM_SENSOR_INITIALIZING, 274 PLDM_SENSOR_SHUTTINGDOWN, 275 PLDM_SENSOR_INTEST 276 }; 277 278 /** @brief PLDM pldmPDRRepositoryChgEvent class eventData format 279 */ 280 enum pldm_pdr_repository_chg_event_data_format { 281 REFRESH_ENTIRE_REPOSITORY, 282 FORMAT_IS_PDR_TYPES, 283 FORMAT_IS_PDR_HANDLES 284 }; 285 286 /** @brief PLDM pldmPDRRepositoryChgEvent class changeRecord format 287 * eventDataOperation. See CHANGELOG.md for info on the alias members. 288 */ 289 enum pldm_pdr_repository_chg_event_change_record_event_data_operation { 290 PLDM_REFRESH_ALL_RECORDS = 0, 291 PLDM_RECORDS_DELETED = 1, 292 PLDM_RECORDS_ADDED = 2, 293 PLDM_RECORDS_MODIFIED = 3, 294 295 PLDM_PDR_RECORDS_REFRESH_ALL = 0, 296 PLDM_PDR_RECORDS_DELETED = 1, 297 PLDM_PDR_RECORDS_ADDED = 2, 298 PLDM_PDR_RECORDS_MODIFIED = 3 299 }; 300 301 /** @brief PLDM NumericSensorStatePresentReading data type 302 */ 303 enum pldm_sensor_readings_data_type { 304 PLDM_SENSOR_DATA_SIZE_UINT8, 305 PLDM_SENSOR_DATA_SIZE_SINT8, 306 PLDM_SENSOR_DATA_SIZE_UINT16, 307 PLDM_SENSOR_DATA_SIZE_SINT16, 308 PLDM_SENSOR_DATA_SIZE_UINT32, 309 PLDM_SENSOR_DATA_SIZE_SINT32 310 }; 311 #define PLDM_SENSOR_DATA_SIZE_MAX PLDM_SENSOR_DATA_SIZE_SINT32 312 313 /** @brief PLDM PlatformEventMessage response status 314 */ 315 enum pldm_platform_event_status { 316 PLDM_EVENT_NO_LOGGING = 0x00, 317 PLDM_EVENT_LOGGING_DISABLED = 0x01, 318 PLDM_EVENT_LOG_FULL = 0x02, 319 PLDM_EVENT_ACCEPTED_FOR_LOGGING = 0x03, 320 PLDM_EVENT_LOGGED = 0x04, 321 PLDM_EVENT_LOGGING_REJECTED = 0x05 322 }; 323 324 /** @brief PLDM Terminus Locator PDR validity 325 */ 326 enum pldm_terminus_locator_pdr_validity { 327 PLDM_TL_PDR_NOT_VALID, 328 PLDM_TL_PDR_VALID 329 }; 330 331 /** @brief PLDM Terminus Locator type 332 */ 333 enum pldm_terminus_locator_type { 334 PLDM_TERMINUS_LOCATOR_TYPE_UID, 335 PLDM_TERMINUS_LOCATOR_TYPE_MCTP_EID, 336 PLDM_TERMINUS_LOCATOR_TYPE_SMBUS_RELATIVE, 337 PLDM_TERMINUS_LOCATOR_TYPE_SYS_SW 338 }; 339 340 /** @brief PLDM event message global enable for 341 * SetEventReceiver command 342 */ 343 enum pldm_event_message_global_enable { 344 PLDM_EVENT_MESSAGE_GLOBAL_DISABLE, 345 PLDM_EVENT_MESSAGE_GLOBAL_ENABLE_ASYNC, 346 PLDM_EVENT_MESSAGE_GLOBAL_ENABLE_POLLING, 347 PLDM_EVENT_MESSAGE_GLOBAL_ENABLE_ASYNC_KEEP_ALIVE 348 }; 349 350 /** @brief PLDM DSP0248 1.2.1 table 74 sensorUnits enumeration 351 */ 352 enum pldm_sensor_units { 353 PLDM_SENSOR_UNIT_NONE = 0x00, 354 PLDM_SENSOR_UNIT_UNSPECIFIED, 355 PLDM_SENSOR_UNIT_DEGRESS_C, 356 PLDM_SENSOR_UNIT_DEGRESS_F, 357 PLDM_SENSOR_UNIT_KELVINS, 358 PLDM_SENSOR_UNIT_VOLTS, 359 PLDM_SENSOR_UNIT_AMPS, 360 PLDM_SENSOR_UNIT_WATTS, 361 PLDM_SENSOR_UNIT_JOULES, 362 PLDM_SENSOR_UNIT_COULOMBS, 363 PLDM_SENSOR_UNIT_VA, 364 PLDM_SENSOR_UNIT_NITS, 365 PLDM_SENSOR_UNIT_LUMENS, 366 PLDM_SENSOR_UNIT_LUX, 367 PLDM_SENSOR_UNIT_CANDELAS, 368 PLDM_SENSOR_UNIT_KPA, 369 PLDM_SENSOR_UNIT_PSI, 370 PLDM_SENSOR_UNIT_NEWTONS, 371 PLDM_SENSOR_UNIT_CFM, 372 PLDM_SENSOR_UNIT_RPM, 373 PLDM_SENSOR_UNIT_HERTZ, 374 PLDM_SENSOR_UNIT_SECONDS, 375 PLDM_SENSOR_UNIT_MINUTES, 376 PLDM_SENSOR_UNIT_HOURS, 377 PLDM_SENSOR_UNIT_DAYS, 378 PLDM_SENSOR_UNIT_WEEKS, 379 PLDM_SENSOR_UNIT_MILS, 380 PLDM_SENSOR_UNIT_INCHES, 381 PLDM_SENSOR_UNIT_FEET, 382 PLDM_SENSOR_UNIT_CUBIC_INCHES, 383 PLDM_SENSOR_UNIT_CUBIC_FEET, 384 PLDM_SENSOR_UNIT_METERS, 385 PLDM_SENSOR_UNIT_CUBIC_CENTERMETERS, 386 PLDM_SENSOR_UNIT_CUBIC_METERS, 387 PLDM_SENSOR_UNIT_LITERS, 388 PLDM_SENSOR_UNIT_FLUID_OUNCES, 389 PLDM_SENSOR_UNIT_RADIANS, 390 PLDM_SENSOR_UNIT_STERADIANS, 391 PLDM_SENSOR_UNIT_REVOLUTIONS, 392 PLDM_SENSOR_UNIT_CYCLES, 393 PLDM_SENSOR_UNIT_GRAVITIES, 394 PLDM_SENSOR_UNIT_OUNCES, 395 PLDM_SENSOR_UNIT_POUNDS, 396 PLDM_SENSOR_UNIT_FOOT_POUNDS, 397 PLDM_SENSOR_UNIT_OUNCE_INCHES, 398 PLDM_SENSOR_UNIT_GUESS, 399 PLDM_SENSOR_UNIT_GILBERTS, 400 PLDM_SENSOR_UNIT_HENRIES, 401 PLDM_SENSOR_UNIT_FARADS, 402 PLDM_SENSOR_UNIT_OHMS, 403 PLDM_SENSOR_UNIT_SIEMENS, 404 PLDM_SENSOR_UNIT_MOLES, 405 PLDM_SENSOR_UNIT_BECQUERELS, 406 PLDM_SENSOR_UNIT_PPM, 407 PLDM_SENSOR_UNIT_DECIBELS, 408 PLDM_SENSOR_UNIT_DBA, 409 PLDM_SENSOR_UNIT_DBC, 410 PLDM_SENSOR_UNIT_GRAYS, 411 PLDM_SENSOR_UNIT_SIEVERTS, 412 PLDM_SENSOR_UNIT_COLOR_TEMPERATURE_DEGRESS_K, 413 PLDM_SENSOR_UNIT_BITS, 414 PLDM_SENSOR_UNIT_BYTES, 415 PLDM_SENSOR_UNIT_WORDS, 416 PLDM_SENSOR_UNIT_DOUBLE_WORDS, 417 PLDM_SENSOR_UNIT_QUAD_WORDS, 418 PLDM_SENSOR_UNIT_PERCENTAGE, 419 PLDM_SENSOR_UNIT_PASCALS, 420 PLDM_SENSOR_UNIT_COUNTS, 421 PLDM_SENSOR_UNIT_GRAMS, 422 PLDM_SENSOR_UNIT_NEWTON_METERS, 423 PLDM_SENSOR_UNIT_HITS, 424 PLDM_SENSOR_UNIT_MISSES, 425 PLDM_SENSOR_UNIT_RETRIES, 426 PLDM_SENSOR_UNIT_OVERRUNS_OVERFLOWS, 427 PLDM_SENSOR_UNIT_UNDERRUNS, 428 PLDM_SENSOR_UNIT_COLLISIONS, 429 PLDM_SENSOR_UNIT_PACKETS, 430 PLDM_SENSOR_UNIT_MESSAGES, 431 PLDM_SENSOR_UNIT_CHARATERS, 432 PLDM_SENSOR_UNIT_ERRORS, 433 PLDM_SENSOR_UNIT_CORRECTED_ERRORS, 434 PLDM_SENSOR_UNIT_UNCORRECTABLE_ERRORS, 435 PLDM_SENSOR_UNIT_SQUARE_MILS, 436 PLDM_SENSOR_UNIT_SQUARE_INCHES, 437 PLDM_SENSOR_UNIT_SQUARE_FEET, 438 PLDM_SENSOR_UNIT_SQUARE_CENTIMETERS, 439 PLDM_SENSOR_UNIT_SQUARE_METERS, 440 PLDM_SENSOR_UNIT_OEMUNIT = 255 441 }; 442 443 enum pldm_occurrence_rate { 444 PLDM_RATE_UNIT_NONE = 0x0, 445 PLDM_RATE_UNIT_PER_MICRO_SECOND, 446 PLDM_RATE_UNIT_PER_MILLI_SECOND, 447 PLDM_RATE_UNIT_PER_SECOND, 448 PLDM_RATE_UNIT_PER_MINUTE, 449 PLDM_RATE_UNIT_PER_HOUR, 450 PLDM_RATE_UNIT_PER_DAY, 451 PLDM_RATE_UNIT_PER_WEEK, 452 PLDM_RATE_UNIT_PER_MONTH, 453 PLDM_RATE_UNIT_PER_YEAR 454 }; 455 456 /** @brief PLDM repository state */ 457 enum pldm_repository_state { 458 PLDM_AVAILABLE, 459 PLDM_UPDATE_IN_PROGRESS, 460 PLDM_FAILED 461 }; 462 463 /** @brief PLDM repository data transfer handler timeout */ 464 enum pldm_repository_data_transfer_handler_timeout { 465 PLDM_NO_TIMEOUT, 466 PLDM_DEFALUT_MINIMUM_TIMEOUT 467 }; 468 469 /** @brief PLDM event message type */ 470 enum pldm_event_message_type { 471 PLDM_MESSAGE_TYPE_NOT_CONFIGURED = 0x00, 472 PLDM_MESSAGE_TYPE_ASYNCHRONOUS = 0x01, 473 PLDM_MESSAGE_TYPE_SYNCHRONOUS = 0x02, 474 PLDM_MESSAGE_TYPE_ASYNCHRONOUS_WITH_HEARTBEAT = 0x03 475 }; 476 477 /** @struct pldm_pdr_hdr 478 * 479 * Structure representing PLDM common PDR header 480 */ 481 struct pldm_pdr_hdr { 482 uint32_t record_handle; 483 uint8_t version; 484 uint8_t type; 485 uint16_t record_change_num; 486 uint16_t length; 487 } __attribute__((packed)); 488 489 /** @struct pldm_terminus_locator_pdr 490 * 491 * Structure representing PLDM terminus locator PDR 492 */ 493 struct pldm_terminus_locator_pdr { 494 struct pldm_pdr_hdr hdr; 495 uint16_t terminus_handle; 496 uint8_t validity; 497 uint8_t tid; 498 uint16_t container_id; 499 uint8_t terminus_locator_type; 500 uint8_t terminus_locator_value_size; 501 uint8_t terminus_locator_value[1]; 502 } __attribute__((packed)); 503 504 /** @struct pldm_sensor_auxiliary_names_pdr 505 * 506 * Structure representing PLDM Sensor Auxiliary Names PDR 507 */ 508 struct pldm_sensor_auxiliary_names_pdr { 509 struct pldm_pdr_hdr hdr; 510 uint16_t terminus_handle; 511 uint16_t sensor_id; 512 uint8_t sensor_count; 513 uint8_t names[1]; 514 } __attribute__((packed)); 515 516 /** @struct pldm_terminus_locator_type_mctp_eid 517 * 518 * Structure representing terminus locator value for 519 * terminus locator type MCTP_EID 520 */ 521 struct pldm_terminus_locator_type_mctp_eid { 522 uint8_t eid; 523 } __attribute__((packed)); 524 525 /** @struct pldm_pdr_entity_association 526 * 527 * Structure representing PLDM Entity Association PDR 528 */ 529 struct pldm_pdr_entity_association { 530 uint16_t container_id; 531 uint8_t association_type; 532 pldm_entity container; 533 uint8_t num_children; 534 pldm_entity children[1]; 535 } __attribute__((packed)); 536 537 /** @struct pldm_pdr_fru_record_set 538 * 539 * Structure representing PLDM FRU record set PDR 540 */ 541 struct pldm_pdr_fru_record_set { 542 uint16_t terminus_handle; 543 uint16_t fru_rsi; 544 uint16_t entity_type; 545 union { 546 uint16_t entity_instance_num; 547 uint16_t entity_instance; 548 }; 549 uint16_t container_id; 550 } __attribute__((packed)); 551 552 /** @struct pldm_state_sensor_pdr 553 * 554 * Structure representing PLDM state sensor PDR 555 */ 556 struct pldm_state_sensor_pdr { 557 struct pldm_pdr_hdr hdr; 558 uint16_t terminus_handle; 559 uint16_t sensor_id; 560 uint16_t entity_type; 561 uint16_t entity_instance; 562 uint16_t container_id; 563 uint8_t sensor_init; 564 bool8_t sensor_auxiliary_names_pdr; 565 uint8_t composite_sensor_count; 566 uint8_t possible_states[1]; 567 } __attribute__((packed)); 568 569 /** @struct state_sensor_possible_states 570 * 571 * Structure representing state enums for state sensor 572 */ 573 struct state_sensor_possible_states { 574 uint16_t state_set_id; 575 uint8_t possible_states_size; 576 bitfield8_t states[1]; 577 } __attribute__((packed)); 578 579 /** @struct pldm_state_effecter_pdr 580 * 581 * Structure representing PLDM state effecter PDR 582 */ 583 struct pldm_state_effecter_pdr { 584 struct pldm_pdr_hdr hdr; 585 uint16_t terminus_handle; 586 uint16_t effecter_id; 587 uint16_t entity_type; 588 uint16_t entity_instance; 589 uint16_t container_id; 590 uint16_t effecter_semantic_id; 591 uint8_t effecter_init; 592 bool8_t has_description_pdr; 593 uint8_t composite_effecter_count; 594 uint8_t possible_states[1]; 595 } __attribute__((packed)); 596 597 /** @struct pldm_compact_numeric_sensor_pdr 598 * 599 * Structure representing PLDM compact numeric sensor PDR 600 */ 601 struct pldm_compact_numeric_sensor_pdr { 602 struct pldm_pdr_hdr hdr; 603 uint16_t terminus_handle; 604 uint16_t sensor_id; 605 uint16_t entity_type; 606 uint16_t entity_instance; 607 uint16_t container_id; 608 uint8_t sensor_name_length; 609 uint8_t base_unit; 610 int8_t unit_modifier; 611 uint8_t occurrence_rate; 612 bitfield8_t range_field_support; 613 int32_t warning_high; 614 int32_t warning_low; 615 int32_t critical_high; 616 int32_t critical_low; 617 int32_t fatal_high; 618 int32_t fatal_low; 619 uint8_t sensor_name[1]; 620 } __attribute__((packed)); 621 622 /** @brief Encode PLDM state sensor PDR 623 * 624 * @param[in/out] sensor Structure to encode. All members of 625 * sensor, except those mentioned in the @note below, should be initialized by 626 * the caller. 627 * @param[in] allocation_size Size of sensor allocation in bytes 628 * @param[in] possible_states Possible sensor states 629 * @param[in] possible_states_size Size of possible sensor states in bytes 630 * @param[out] actual_size Size of sensor PDR. Set to 0 on error. 631 * @return int pldm_completion_codes 632 * PLDM_SUCCESS/PLDM_ERROR/PLDM_ERROR_INVALID_LENGTH 633 * 634 * @note The sensor parameter will be encoded in place. 635 * @note Caller is responsible for allocation of the sensor parameter. Caller 636 * must allocate enough space for the base structure and the 637 * sensor->possible_states array, otherwise the function will fail. 638 * @note sensor->hdr.length, .type, and .version will be set appropriately. 639 */ 640 int encode_state_sensor_pdr( 641 struct pldm_state_sensor_pdr *sensor, size_t allocation_size, 642 const struct state_sensor_possible_states *possible_states, 643 size_t possible_states_size, size_t *actual_size); 644 645 /** @union union_effecter_data_size 646 * 647 * The bit width and format of reading and threshold values that the effecter 648 * returns. 649 * Refer to: DSP0248_1.2.0: 28.11 Table 87 650 */ 651 typedef union { 652 uint8_t value_u8; 653 int8_t value_s8; 654 uint16_t value_u16; 655 int16_t value_s16; 656 uint32_t value_u32; 657 int32_t value_s32; 658 } union_effecter_data_size; 659 660 /** @union union_range_field_format 661 * 662 * Indicates the format used for the nominalValue, normalMax, and normalMin 663 * fields. 664 * Refer to: DSP0248_1.2.0: 28.11 Table 87 665 */ 666 typedef union { 667 uint8_t value_u8; 668 int8_t value_s8; 669 uint16_t value_u16; 670 int16_t value_s16; 671 uint32_t value_u32; 672 int32_t value_s32; 673 real32_t value_f32; 674 } union_range_field_format; 675 676 /** @struct pldm_numeric_effecter_value_pdr 677 * 678 * Structure representing PLDM numeric effecter value PDR 679 */ 680 struct pldm_numeric_effecter_value_pdr { 681 struct pldm_pdr_hdr hdr; 682 uint16_t terminus_handle; 683 uint16_t effecter_id; 684 uint16_t entity_type; 685 uint16_t entity_instance; 686 uint16_t container_id; 687 uint16_t effecter_semantic_id; 688 uint8_t effecter_init; 689 bool8_t effecter_auxiliary_names; 690 uint8_t base_unit; 691 int8_t unit_modifier; 692 uint8_t rate_unit; 693 uint8_t base_oem_unit_handle; 694 uint8_t aux_unit; 695 int8_t aux_unit_modifier; 696 uint8_t aux_rate_unit; 697 uint8_t aux_oem_unit_handle; 698 bool8_t is_linear; 699 uint8_t effecter_data_size; 700 real32_t resolution; 701 real32_t offset; 702 uint16_t accuracy; 703 uint8_t plus_tolerance; 704 uint8_t minus_tolerance; 705 real32_t state_transition_interval; 706 real32_t transition_interval; 707 union_effecter_data_size max_settable; 708 union_effecter_data_size min_settable; 709 uint8_t range_field_format; 710 bitfield8_t range_field_support; 711 union_range_field_format nominal_value; 712 union_range_field_format normal_max; 713 union_range_field_format normal_min; 714 union_range_field_format rated_max; 715 union_range_field_format rated_min; 716 } __attribute__((packed)); 717 718 /** @union union_sensor_data_size 719 * 720 * The bit width and format of reading and threshold values that the sensor 721 * returns. 722 * Refer to: DSP0248_1.2.0: 28.4 Table 78 723 */ 724 typedef union { 725 uint8_t value_u8; 726 int8_t value_s8; 727 uint16_t value_u16; 728 int16_t value_s16; 729 uint32_t value_u32; 730 int32_t value_s32; 731 } union_sensor_data_size; 732 733 /** @struct pldm_value_pdr_hdr 734 * 735 * Structure representing PLDM PDR header for unpacked value 736 * Refer to: DSP0248_1.2.0: 28.1 Table 75 737 */ 738 struct pldm_value_pdr_hdr { 739 uint32_t record_handle; 740 uint8_t version; 741 uint8_t type; 742 uint16_t record_change_num; 743 uint16_t length; 744 }; 745 746 /** @struct pldm_numeric_sensor_value_pdr 747 * 748 * Structure representing PLDM Numeric Sensor PDR for unpacked value 749 * Refer to: DSP0248_1.2.0: 28.4 Table 78 750 */ 751 struct pldm_numeric_sensor_value_pdr { 752 struct pldm_value_pdr_hdr hdr; 753 uint16_t terminus_handle; 754 uint16_t sensor_id; 755 uint16_t entity_type; 756 union { 757 uint16_t entity_instance_num; 758 uint16_t entity_instance; 759 }; 760 uint16_t container_id; 761 uint8_t sensor_init; 762 bool8_t sensor_auxiliary_names_pdr; 763 uint8_t base_unit; 764 int8_t unit_modifier; 765 uint8_t rate_unit; 766 uint8_t base_oem_unit_handle; 767 uint8_t aux_unit; 768 int8_t aux_unit_modifier; 769 uint8_t aux_rate_unit; 770 uint8_t rel; 771 uint8_t aux_oem_unit_handle; 772 bool8_t is_linear; 773 uint8_t sensor_data_size; 774 real32_t resolution; 775 real32_t offset; 776 uint16_t accuracy; 777 uint8_t plus_tolerance; 778 uint8_t minus_tolerance; 779 union_sensor_data_size hysteresis; 780 bitfield8_t supported_thresholds; 781 bitfield8_t threshold_and_hysteresis_volatility; 782 real32_t state_transition_interval; 783 real32_t update_interval; 784 union_sensor_data_size max_readable; 785 union_sensor_data_size min_readable; 786 uint8_t range_field_format; 787 bitfield8_t range_field_support; 788 union_range_field_format nominal_value; 789 union_range_field_format normal_max; 790 union_range_field_format normal_min; 791 union_range_field_format warning_high; 792 union_range_field_format warning_low; 793 union_range_field_format critical_high; 794 union_range_field_format critical_low; 795 union_range_field_format fatal_high; 796 union_range_field_format fatal_low; 797 }; 798 799 /** @struct state_effecter_possible_states 800 * 801 * Structure representing state enums for state effecter 802 */ 803 struct state_effecter_possible_states { 804 uint16_t state_set_id; 805 uint8_t possible_states_size; 806 bitfield8_t states[1]; 807 } __attribute__((packed)); 808 809 /** @struct pldm_effecter_aux_name_pdr 810 * 811 * Structure representing PLDM aux name numeric effecter value PDR 812 */ 813 struct pldm_effecter_aux_name_pdr { 814 struct pldm_pdr_hdr hdr; 815 uint16_t terminus_handle; 816 uint16_t effecter_id; 817 uint8_t effecter_count; 818 uint8_t effecter_names[1]; 819 } __attribute__((packed)); 820 821 /** @brief Encode PLDM state effecter PDR 822 * 823 * @param[in/out] effecter Structure to encode. All members of 824 * effecter, except those mentioned in 825 * the @note below, should be initialized 826 * by the caller. 827 * @param[in] allocation_size Size of effecter allocation in bytes 828 * @param[in] possible_states Possible effecter states 829 * @param[in] possible_states_size Size of possible effecter states in 830 * bytes 831 * @param[out] actual_size Size of effecter PDR. Set to 0 on 832 * error. 833 * @return int pldm_completion_codes 834 * PLDM_SUCCESS/PLDM_ERROR/PLDM_ERROR_INVALID_LENGTH 835 * 836 * @note The effecter parameter will be encoded in place. 837 * @note Caller is responsible for allocation of the effecter parameter. Caller 838 * must allocate enough space for the base structure and the 839 * effecter->possible_states array, otherwise the function will fail. 840 * @note effecter->hdr.length, .type, and .version will be set appropriately. 841 */ 842 int encode_state_effecter_pdr( 843 struct pldm_state_effecter_pdr *effecter, size_t allocation_size, 844 const struct state_effecter_possible_states *possible_states, 845 size_t possible_states_size, size_t *actual_size); 846 847 /** @struct set_effecter_state_field 848 * 849 * Structure representing a stateField in SetStateEffecterStates command */ 850 851 typedef struct state_field_for_state_effecter_set { 852 uint8_t set_request; //!< Whether to change the state 853 uint8_t effecter_state; //!< Expected state of the effecter 854 } __attribute__((packed)) set_effecter_state_field; 855 856 /** @struct get_sensor_readings_field 857 * 858 * Structure representing a stateField in GetStateSensorReadings command */ 859 860 typedef struct state_field_for_get_state_sensor_readings { 861 uint8_t sensor_op_state; //!< The state of the sensor itself 862 uint8_t present_state; //!< Return a state value 863 uint8_t previous_state; //!< The state that the presentState was entered 864 //! from. This must be different from the 865 //! present state 866 uint8_t event_state; //!< Return a state value from a PLDM State Set 867 //! that is associated with the sensor 868 } __attribute__((packed)) get_sensor_state_field; 869 870 /** @struct get_effecter_state_field 871 * 872 * Structure representing a stateField in GetStateEffecterStates command 873 */ 874 typedef struct state_field_for_get_state_effecter_states { 875 uint8_t effecter_op_state; //!< The state of the effecter itself 876 uint8_t pending_state; //!< The state that is currently being processed 877 uint8_t present_state; //!< Return a state value 878 } get_effecter_state_field; 879 880 /** @struct PLDM_SetStateEffecterStates_Request 881 * 882 * Structure representing PLDM set state effecter states request. 883 */ 884 struct pldm_set_state_effecter_states_req { 885 uint16_t effecter_id; 886 uint8_t comp_effecter_count; 887 set_effecter_state_field field[8]; 888 } __attribute__((packed)); 889 890 /** @struct pldm_get_pdr_repository_info_resp 891 * 892 * Structure representing GetPDRRepositoryInfo response packet 893 */ 894 struct pldm_pdr_repository_info_resp { 895 uint8_t completion_code; 896 uint8_t repository_state; 897 uint8_t update_time[PLDM_TIMESTAMP104_SIZE]; 898 uint8_t oem_update_time[PLDM_TIMESTAMP104_SIZE]; 899 uint32_t record_count; 900 uint32_t repository_size; 901 uint32_t largest_record_size; 902 uint8_t data_transfer_handle_timeout; 903 } __attribute__((packed)); 904 905 /** @struct pldm_get_pdr_resp 906 * 907 * structure representing GetPDR response packet 908 * transfer CRC is not part of the structure and will be 909 * added at the end of last packet in multipart transfer 910 */ 911 struct pldm_get_pdr_resp { 912 uint8_t completion_code; 913 uint32_t next_record_handle; 914 uint32_t next_data_transfer_handle; 915 uint8_t transfer_flag; 916 uint16_t response_count; 917 uint8_t record_data[1]; 918 } __attribute__((packed)); 919 920 /** @struct pldm_get_pdr_req 921 * 922 * structure representing GetPDR request packet 923 */ 924 struct pldm_get_pdr_req { 925 uint32_t record_handle; 926 uint32_t data_transfer_handle; 927 uint8_t transfer_op_flag; 928 uint16_t request_count; 929 uint16_t record_change_number; 930 } __attribute__((packed)); 931 932 /** @struct pldm_set_event_receiver_req 933 * 934 * Structure representing SetEventReceiver command. 935 * This structure applies only for MCTP as a transport type. 936 */ 937 struct pldm_set_event_receiver_req { 938 uint8_t event_message_global_enable; 939 uint8_t transport_protocol_type; 940 uint8_t event_receiver_address_info; 941 uint16_t heartbeat_timer; 942 } __attribute__((packed)); 943 944 /** @struct pldm_event_message_buffer_size_req 945 * 946 * Structure representing EventMessageBufferSizes command request data 947 */ 948 struct pldm_event_message_buffer_size_req { 949 uint16_t event_receiver_max_buffer_size; 950 } __attribute__((packed)); 951 952 /** @struct pldm_event_message_buffer_size_resp 953 * 954 * Structure representing EventMessageBufferSizes command response data 955 */ 956 struct pldm_event_message_buffer_size_resp { 957 uint8_t completion_code; 958 uint16_t terminus_max_buffer_size; 959 } __attribute__((packed)); 960 961 /** @struct pldm_platform_event_message_supported_req 962 * 963 * structure representing PlatformEventMessageSupported command request data 964 */ 965 struct pldm_event_message_supported_req { 966 uint8_t format_version; 967 } __attribute__((packed)); 968 969 /** @struct pldm_event_message_supported_response 970 * 971 * structure representing EventMessageSupported command response data 972 */ 973 struct pldm_event_message_supported_resp { 974 uint8_t completion_code; 975 uint8_t synchrony_configuration; 976 bitfield8_t synchrony_configuration_supported; 977 uint8_t number_event_class_returned; 978 uint8_t event_class[1]; 979 } __attribute__((packed)); 980 981 /** @struct pldm_set_numeric_effecter_value_req 982 * 983 * structure representing SetNumericEffecterValue request packet 984 */ 985 struct pldm_set_numeric_effecter_value_req { 986 uint16_t effecter_id; 987 uint8_t effecter_data_size; 988 uint8_t effecter_value[1]; 989 } __attribute__((packed)); 990 991 /** @struct pldm_get_state_sensor_readings_req 992 * 993 * Structure representing PLDM get state sensor readings request. 994 */ 995 struct pldm_get_state_sensor_readings_req { 996 uint16_t sensor_id; 997 bitfield8_t sensor_rearm; 998 uint8_t reserved; 999 } __attribute__((packed)); 1000 1001 /** @struct pldm_get_state_sensor_readings_resp 1002 * 1003 * Structure representing PLDM get state sensor readings response. 1004 */ 1005 struct pldm_get_state_sensor_readings_resp { 1006 uint8_t completion_code; 1007 uint8_t comp_sensor_count; 1008 get_sensor_state_field field[1]; 1009 } __attribute__((packed)); 1010 1011 /** @struct pldm_get_state_effecter_states_req 1012 * 1013 * structure representing GetStateEffecterStates request packet 1014 */ 1015 struct pldm_get_state_effecter_states_req { 1016 uint16_t effecter_id; 1017 }; 1018 1019 /** @struct pldm_get_state_effecter_states_resp 1020 * 1021 * Structure representing PLDM get state effecter states response. 1022 */ 1023 struct pldm_get_state_effecter_states_resp { 1024 uint8_t completion_code; 1025 uint8_t comp_effecter_count; 1026 get_effecter_state_field field[PLDM_GET_EFFECTER_STATE_FIELD_COUNT_MAX]; 1027 }; 1028 1029 /** @struct pldm_sensor_event 1030 * 1031 * structure representing sensorEventClass 1032 */ 1033 struct pldm_sensor_event_data { 1034 uint16_t sensor_id; 1035 uint8_t sensor_event_class_type; 1036 uint8_t event_class[1]; 1037 } __attribute__((packed)); 1038 1039 /** @struct pldm_state_sensor_state 1040 * 1041 * structure representing sensorEventClass for stateSensorState 1042 */ 1043 struct pldm_sensor_event_state_sensor_state { 1044 uint8_t sensor_offset; 1045 uint8_t event_state; 1046 uint8_t previous_event_state; 1047 } __attribute__((packed)); 1048 1049 /** @struct pldm_sensor_event_numeric_sensor_state 1050 * 1051 * structure representing sensorEventClass for stateSensorState 1052 */ 1053 struct pldm_sensor_event_numeric_sensor_state { 1054 uint8_t event_state; 1055 uint8_t previous_event_state; 1056 uint8_t sensor_data_size; 1057 uint8_t present_reading[1]; 1058 } __attribute__((packed)); 1059 1060 /** @struct pldm_sensor_event_sensor_op_state 1061 * 1062 * structure representing sensorEventClass for SensorOpState 1063 */ 1064 struct pldm_sensor_event_sensor_op_state { 1065 uint8_t present_op_state; 1066 uint8_t previous_op_state; 1067 } __attribute__((packed)); 1068 1069 /** @struct pldm_platform_event_message_req 1070 * 1071 * structure representing PlatformEventMessage command request data 1072 */ 1073 struct pldm_platform_event_message_req { 1074 uint8_t format_version; 1075 uint8_t tid; 1076 uint8_t event_class; 1077 uint8_t event_data[1]; 1078 } __attribute__((packed)); 1079 1080 /** @struct pldm_poll_for_platform_event_message_req 1081 * 1082 * structure representing PollForPlatformEventMessage command request data 1083 */ 1084 struct pldm_poll_for_platform_event_message_req { 1085 uint8_t format_version; 1086 uint8_t transfer_operation_flag; 1087 uint32_t data_transfer_handle; 1088 uint16_t event_id_to_acknowledge; 1089 }; 1090 1091 /** @struct pldm_poll_for_platform_event_message_min_resp 1092 * 1093 * structure representing PollForPlatformEventMessage command response data 1094 */ 1095 struct pldm_poll_for_platform_event_message_min_resp { 1096 uint8_t completion_code; 1097 uint8_t tid; 1098 uint16_t event_id; 1099 }; 1100 1101 /** @struct pldm_platform_event_message_response 1102 * 1103 * structure representing PlatformEventMessage command response data 1104 */ 1105 struct pldm_platform_event_message_resp { 1106 uint8_t completion_code; 1107 uint8_t platform_event_status; 1108 } __attribute__((packed)); 1109 1110 /** @struct pldm_pdr_repository_chg_event_data 1111 * 1112 * structure representing pldmPDRRepositoryChgEvent class eventData 1113 */ 1114 struct pldm_pdr_repository_chg_event_data { 1115 uint8_t event_data_format; 1116 uint8_t number_of_change_records; 1117 uint8_t change_records[1]; 1118 } __attribute__((packed)); 1119 1120 /** @struct pldm_pdr_repository_chg_event_change_record_data 1121 * 1122 * structure representing pldmPDRRepositoryChgEvent class eventData's change 1123 * record data 1124 */ 1125 struct pldm_pdr_repository_change_record_data { 1126 uint8_t event_data_operation; 1127 uint8_t number_of_change_entries; 1128 uint32_t change_entry[1]; 1129 } __attribute__((packed)); 1130 1131 /** @struct pldm_get_numeric_effecter_value_req 1132 * 1133 * structure representing GetNumericEffecterValue request packet 1134 */ 1135 struct pldm_get_numeric_effecter_value_req { 1136 uint16_t effecter_id; 1137 } __attribute__((packed)); 1138 1139 /** @struct pldm_get_numeric_effecter_value_resp 1140 * 1141 * structure representing GetNumericEffecterValue response packet 1142 */ 1143 struct pldm_get_numeric_effecter_value_resp { 1144 uint8_t completion_code; 1145 uint8_t effecter_data_size; 1146 uint8_t effecter_oper_state; 1147 uint8_t pending_and_present_values[1]; 1148 } __attribute__((packed)); 1149 1150 /** @struct pldm_get_sensor_reading_req 1151 * 1152 * Structure representing PLDM get sensor reading request 1153 */ 1154 struct pldm_get_sensor_reading_req { 1155 uint16_t sensor_id; 1156 bool8_t rearm_event_state; 1157 } __attribute__((packed)); 1158 1159 /** @struct pldm_get_sensor_reading_resp 1160 * 1161 * Structure representing PLDM get sensor reading response 1162 */ 1163 struct pldm_get_sensor_reading_resp { 1164 uint8_t completion_code; 1165 uint8_t sensor_data_size; 1166 uint8_t sensor_operational_state; 1167 uint8_t sensor_event_message_enable; 1168 uint8_t present_state; 1169 uint8_t previous_state; 1170 uint8_t event_state; 1171 uint8_t present_reading[1]; 1172 } __attribute__((packed)); 1173 1174 /* Responder */ 1175 1176 /* SetNumericEffecterValue */ 1177 1178 /** @brief Decode SetNumericEffecterValue request data 1179 * 1180 * @param[in] msg - Request message 1181 * @param[in] payload_length - Length of request message payload 1182 * @param[out] effecter_id - used to identify and access the effecter 1183 * @param[out] effecter_data_size - The bit width and format of the setting 1184 * value for the effecter. 1185 * value:{uint8,sint8,uint16,sint16,uint32,sint32} 1186 * @param[out] effecter_value - The setting value of numeric effecter being 1187 * requested. 1188 * @return pldm_completion_codes 1189 */ 1190 int decode_set_numeric_effecter_value_req(const struct pldm_msg *msg, 1191 size_t payload_length, 1192 uint16_t *effecter_id, 1193 uint8_t *effecter_data_size, 1194 uint8_t effecter_value[4]); 1195 1196 /** @brief Create a PLDM response message for SetNumericEffecterValue 1197 * 1198 * @param[in] instance_id - Message's instance id 1199 * @param[in] completion_code - PLDM completion code 1200 * @param[out] msg - Message will be written to this 1201 * @param[in] payload_length - Length of request message payload 1202 * @return pldm_completion_codes 1203 * @note Caller is responsible for memory alloc and dealloc of param 1204 * 'msg.body.payload' 1205 */ 1206 int encode_set_numeric_effecter_value_resp(uint8_t instance_id, 1207 uint8_t completion_code, 1208 struct pldm_msg *msg, 1209 size_t payload_length); 1210 1211 /* SetStateEffecterStates */ 1212 1213 /** @brief Create a PLDM response message for SetStateEffecterStates 1214 * 1215 * @param[in] instance_id - Message's instance id 1216 * @param[in] completion_code - PLDM completion code 1217 * @param[out] msg - Message will be written to this 1218 * @return pldm_completion_codes 1219 * @note Caller is responsible for memory alloc and dealloc of param 1220 * 'msg.body.payload' 1221 */ 1222 1223 int encode_set_state_effecter_states_resp(uint8_t instance_id, 1224 uint8_t completion_code, 1225 struct pldm_msg *msg); 1226 1227 /** @brief Decode SetStateEffecterStates request data 1228 * 1229 * @param[in] msg - Request message 1230 * @param[in] payload_length - Length of request message payload 1231 * @param[out] effecter_id - used to identify and access the effecter 1232 * @param[out] comp_effecter_count - number of individual sets of effecter 1233 * information. Upto eight sets of state effecter info can be accessed 1234 * for a given effecter. 1235 * @param[out] field - each unit is an instance of the stateFileld structure 1236 * that is used to set the requested state for a particular effecter 1237 * within the state effecter. This field holds the starting address of 1238 * the stateField values. The user is responsible to allocate the 1239 * memory prior to calling this command. Since the state field count is 1240 * not known in advance, the user should allocate the maximum size 1241 * always, which is 8 in number. 1242 * @return pldm_completion_codes 1243 */ 1244 1245 int decode_set_state_effecter_states_req(const struct pldm_msg *msg, 1246 size_t payload_length, 1247 uint16_t *effecter_id, 1248 uint8_t *comp_effecter_count, 1249 set_effecter_state_field *field); 1250 1251 /* GetPDR */ 1252 1253 /** @brief Create a PLDM response message for GetPDR 1254 * 1255 * @param[in] instance_id - Message's instance id 1256 * @param[in] completion_code - PLDM completion code 1257 * @param[in] next_record_hndl - The recordHandle for the PDR that is next in 1258 * the PDR Repository 1259 * @param[in] next_data_transfer_hndl - A handle that identifies the next 1260 * portion of the PDR data to be transferred, if any 1261 * @param[in] transfer_flag - Indicates the portion of PDR data being 1262 * transferred 1263 * @param[in] resp_cnt - The number of recordData bytes returned in this 1264 * response 1265 * @param[in] record_data - PDR data bytes of length resp_cnt 1266 * @param[in] transfer_crc - A CRC-8 for the overall PDR. This is present only 1267 * in the last part of a PDR being transferred 1268 * @param[out] msg - Message will be written to this 1269 * @return pldm_completion_codes 1270 * @note Caller is responsible for memory alloc and dealloc of param 1271 * 'msg.payload' 1272 */ 1273 int encode_get_pdr_resp(uint8_t instance_id, uint8_t completion_code, 1274 uint32_t next_record_hndl, 1275 uint32_t next_data_transfer_hndl, uint8_t transfer_flag, 1276 uint16_t resp_cnt, const uint8_t *record_data, 1277 uint8_t transfer_crc, struct pldm_msg *msg); 1278 1279 /** @brief Decode GetPDR request data 1280 * 1281 * @param[in] msg - Request message 1282 * @param[in] payload_length - Length of request message payload 1283 * @param[out] record_hndl - The recordHandle value for the PDR to be retrieved 1284 * @param[out] data_transfer_hndl - Handle used to identify a particular 1285 * multipart PDR data transfer operation 1286 * @param[out] transfer_op_flag - Flag to indicate the first or subsequent 1287 * portion of transfer 1288 * @param[out] request_cnt - The maximum number of record bytes requested 1289 * @param[out] record_chg_num - Used to determine whether the PDR has changed 1290 * while PDR transfer is going on 1291 * @return pldm_completion_codes 1292 */ 1293 1294 int decode_get_pdr_req(const struct pldm_msg *msg, size_t payload_length, 1295 uint32_t *record_hndl, uint32_t *data_transfer_hndl, 1296 uint8_t *transfer_op_flag, uint16_t *request_cnt, 1297 uint16_t *record_chg_num); 1298 1299 /* GetStateSensorReadings */ 1300 1301 /** @brief Decode GetStateSensorReadings request data 1302 * 1303 * @param[in] msg - Request message 1304 * @param[in] payload_length - Length of request message payload 1305 * @param[out] sensor_id - used to identify and access the simple or composite 1306 * sensor 1307 * @param[out] sensor_rearm - Each bit location in this field corresponds to a 1308 * particular sensor within the state sensor, where bit [0] corresponds 1309 * to the first state sensor (sensor offset 0) and bit [7] corresponds 1310 * to the eighth sensor (sensor offset 7), sequentially. 1311 * @param[out] reserved - value: 0x00 1312 * @return pldm_completion_codes 1313 */ 1314 1315 int decode_get_state_sensor_readings_req(const struct pldm_msg *msg, 1316 size_t payload_length, 1317 uint16_t *sensor_id, 1318 bitfield8_t *sensor_rearm, 1319 uint8_t *reserved); 1320 1321 /** @brief Encode GetStateSensorReadings response data 1322 * 1323 * @param[in] instance_id - Message's instance id 1324 * @param[in] completion_code - PLDM completion code 1325 * @param[out] comp_sensor_count - The number of individual sets of sensor 1326 * information that this command accesses 1327 * @param[out] field - Each stateField is an instance of a stateField structure 1328 * that is used to return the present operational state setting and the 1329 * present state and event state for a particular set of sensor 1330 * information contained within the state sensor 1331 * @param[out] msg - Message will be written to this 1332 * @return pldm_completion_codes 1333 */ 1334 1335 int encode_get_state_sensor_readings_resp(uint8_t instance_id, 1336 uint8_t completion_code, 1337 uint8_t comp_sensor_count, 1338 get_sensor_state_field *field, 1339 struct pldm_msg *msg); 1340 1341 /* GetNumericEffecterValue */ 1342 1343 /** @brief Decode GetNumericEffecterValue request data 1344 * 1345 * @param[in] msg - Request message 1346 * @param[in] payload_length - Length of request message payload 1347 * @param[out] effecter_id - used to identify and access the effecter 1348 * @return pldm_completion_codes 1349 */ 1350 int decode_get_numeric_effecter_value_req(const struct pldm_msg *msg, 1351 size_t payload_length, 1352 uint16_t *effecter_id); 1353 1354 /** @brief Create a PLDM response message for GetNumericEffecterValue 1355 * 1356 * @param[in] instance_id - Message's instance id 1357 * @param[in] completion_code - PLDM completion code 1358 * @param[in] effecter_data_size - The bit width and format of the setting 1359 * value for the effecter. 1360 * value:{uint8,sint8,uint16,sint16,uint32,sint32} 1361 * @param[in] effecter_oper_state - The state of the effecter itself 1362 * @param[in] pending_value - The pending numeric value setting of the 1363 * effecter. The effecterDataSize field indicates the number of 1364 * bits used for this field 1365 * @param[in] present_value - The present numeric value setting of the 1366 * effecter. The effecterDataSize indicates the number of bits 1367 * used for this field 1368 * @param[out] msg - Message will be written to this 1369 * @param[in] payload_length - Length of request message payload 1370 * @return pldm_completion_codes 1371 * @note Caller is responsible for memory alloc and dealloc of param 1372 * 'msg.payload' 1373 */ 1374 int encode_get_numeric_effecter_value_resp( 1375 uint8_t instance_id, uint8_t completion_code, 1376 uint8_t effecter_data_size, uint8_t effecter_oper_state, 1377 const uint8_t *pending_value, const uint8_t *present_value, 1378 struct pldm_msg *msg, size_t payload_length); 1379 1380 /* GetSensorReading */ 1381 1382 /** @brief Decode GetSensorReading request data 1383 * 1384 * @param[in] msg - Request message 1385 * @param[in] payload_length - Length of request message payload 1386 * @param[out] sensor_id - A handle that is used to identify and access 1387 * the sensor 1388 * @param[out] rearm_event_state - true = manually re-arm EventState after 1389 * responding to this request, false = no manual re-arm 1390 * @return pldm_completion_codes 1391 */ 1392 1393 int decode_get_sensor_reading_req(const struct pldm_msg *msg, 1394 size_t payload_length, uint16_t *sensor_id, 1395 bool8_t *rearm_event_state); 1396 1397 /** @brief Encode GetSensorReading response data 1398 * 1399 * @param[in] instance_id - Message's instance id 1400 * @param[in] completion_code - PLDM completion code 1401 * @param[out] sensor_data_size - The bit width and format of reading and 1402 * threshold values 1403 * @param[out] sensor_operational_state - The state of the sensor itself 1404 * @param[out] sensor_event_message_enable - value: { noEventGeneration, 1405 * eventsDisabled, eventsEnabled, opEventsOnlyEnabled, 1406 * stateEventsOnlyEnabled } 1407 * @param[out] present_state - The most recently assessed state value monitored 1408 * by the sensor 1409 * @param[out] previous_state - The state that the presentState was entered 1410 * from 1411 * @param[out] event_state - Indicates which threshold crossing assertion 1412 * events have been detected 1413 * @param[out] present_reading - The present value indicated by the sensor 1414 * @param[out] msg - Message will be written to this 1415 * @param[in] payload_length - Length of request message payload 1416 * @return pldm_completion_codes 1417 */ 1418 1419 int encode_get_sensor_reading_resp(uint8_t instance_id, uint8_t completion_code, 1420 uint8_t sensor_data_size, 1421 uint8_t sensor_operational_state, 1422 uint8_t sensor_event_message_enable, 1423 uint8_t present_state, 1424 uint8_t previous_state, uint8_t event_state, 1425 const uint8_t *present_reading, 1426 struct pldm_msg *msg, size_t payload_length); 1427 1428 /* Requester */ 1429 1430 /*GetPDRRepositoryInfo*/ 1431 1432 /** @brief Encode GetPDRRepositoryInfo response data 1433 * 1434 * @param[in] instance_id - Message's instance id 1435 * @param[in] completion_code - PLDM completion code 1436 * @param[in] repository_state - PLDM repository state 1437 * @param[in] update_time - When the standard PDR repository data was 1438 * originally created 1439 * @param[in] oem_update_time - when OEM PDRs in the PDR Repository were 1440 * originally created 1441 * @param[in] record_count - Total number of PDRs in this repository 1442 * @param[in] repository_size - Size of the PDR Repository in bytes 1443 * @param[in] largest_record_size - Size of the largest record in the PDR 1444 * Repository in bytes 1445 * @param[in] data_transfer_handle_timeout - Data transmission timeout 1446 * @param[out] msg - Message will be written to this 1447 * @return pldm_completion_codes 1448 */ 1449 int encode_get_pdr_repository_info_resp( 1450 uint8_t instance_id, uint8_t completion_code, uint8_t repository_state, 1451 const uint8_t *update_time, const uint8_t *oem_update_time, 1452 uint32_t record_count, uint32_t repository_size, 1453 uint32_t largest_record_size, uint8_t data_transfer_handle_timeout, 1454 struct pldm_msg *msg); 1455 1456 /** @brief Decode GetPDRRepositoryInfo response data 1457 * 1458 * @param[in] msg - Response message 1459 * @param[in] payload_length - Length of response message payload 1460 * @param[out] completion_code - PLDM completion code 1461 * @param[out] repository_state - PLDM repository state 1462 * @param[out] update_time - When the standard PDR repository data was 1463 * originally created 1464 * @param[out] oem_update_time - when OEM PDRs in the PDR Repository were 1465 * originally created 1466 * @param[out] record_count - Total number of PDRs in this repository 1467 * @param[out] repository_size - Size of the PDR Repository in bytes 1468 * @param[out] largest_record_size - Size of the largest record in the PDR 1469 * Repository in bytes 1470 * @param[out] data_transfer_handle_timeout - Data transmission timeout 1471 * @return pldm_completion_codes 1472 */ 1473 int decode_get_pdr_repository_info_resp( 1474 const struct pldm_msg *msg, size_t payload_length, 1475 uint8_t *completion_code, uint8_t *repository_state, 1476 uint8_t *update_time, uint8_t *oem_update_time, uint32_t *record_count, 1477 uint32_t *repository_size, uint32_t *largest_record_size, 1478 uint8_t *data_transfer_handle_timeout); 1479 1480 /* GetPDR */ 1481 1482 /** @brief Create a PLDM request message for GetPDR 1483 * 1484 * @param[in] instance_id - Message's instance id 1485 * @param[in] record_hndl - The recordHandle value for the PDR to be retrieved 1486 * @param[in] data_transfer_hndl - Handle used to identify a particular 1487 * multipart PDR data transfer operation 1488 * @param[in] transfer_op_flag - Flag to indicate the first or subsequent 1489 * portion of transfer 1490 * @param[in] request_cnt - The maximum number of record bytes requested 1491 * @param[in] record_chg_num - Used to determine whether the PDR has changed 1492 * while PDR transfer is going on 1493 * @param[out] msg - Message will be written to this 1494 * @param[in] payload_length - Length of request message payload 1495 * @return pldm_completion_codes 1496 * @note Caller is responsible for memory alloc and dealloc of param 1497 * 'msg.payload' 1498 */ 1499 int encode_get_pdr_req(uint8_t instance_id, uint32_t record_hndl, 1500 uint32_t data_transfer_hndl, uint8_t transfer_op_flag, 1501 uint16_t request_cnt, uint16_t record_chg_num, 1502 struct pldm_msg *msg, size_t payload_length); 1503 1504 /** @brief Decode GetPDR response data 1505 * 1506 * Note: 1507 * * If the return value is not PLDM_SUCCESS, it represents a 1508 * transport layer error. 1509 * * If the completion_code value is not PLDM_SUCCESS, it represents a 1510 * protocol layer error and all the out-parameters are invalid. 1511 * 1512 * @param[in] msg - Request message 1513 * @param[in] payload_length - Length of request message payload 1514 * @param[out] completion_code - PLDM completion code 1515 * @param[out] next_record_hndl - The recordHandle for the PDR that is next in 1516 * the PDR Repository 1517 * @param[out] next_data_transfer_hndl - A handle that identifies the next 1518 * portion of the PDR data to be transferred, if any 1519 * @param[out] transfer_flag - Indicates the portion of PDR data being 1520 * transferred 1521 * @param[out] resp_cnt - The number of recordData bytes returned in this 1522 * response 1523 * @param[out] record_data - PDR data bytes of length resp_cnt, or NULL to 1524 * skip the copy and place the actual length in resp_cnt. 1525 * @param[in] record_data_length - Length of record_data 1526 * @param[out] transfer_crc - A CRC-8 for the overall PDR. This is present only 1527 * in the last part of a PDR being transferred 1528 * @return pldm_completion_codes 1529 */ 1530 int decode_get_pdr_resp(const struct pldm_msg *msg, size_t payload_length, 1531 uint8_t *completion_code, uint32_t *next_record_hndl, 1532 uint32_t *next_data_transfer_hndl, 1533 uint8_t *transfer_flag, uint16_t *resp_cnt, 1534 uint8_t *record_data, size_t record_data_length, 1535 uint8_t *transfer_crc); 1536 1537 /* SetStateEffecterStates */ 1538 1539 /** @brief Create a PLDM request message for SetStateEffecterStates 1540 * 1541 * @param[in] instance_id - Message's instance id 1542 * @param[in] effecter_id - used to identify and access the effecter 1543 * @param[in] comp_effecter_count - number of individual sets of effecter 1544 * information. Upto eight sets of state effecter info can be accessed 1545 * for a given effecter. 1546 * @param[in] field - each unit is an instance of the stateField structure 1547 * that is used to set the requested state for a particular effecter 1548 * within the state effecter. This field holds the starting address of 1549 * the stateField values. The user is responsible to allocate the 1550 * memory prior to calling this command. The user has to allocate the 1551 * field parameter as sizeof(set_effecter_state_field) * 1552 * comp_effecter_count 1553 * @param[out] msg - Message will be written to this 1554 * @return pldm_completion_codes 1555 * @note Caller is responsible for memory alloc and dealloc of param 1556 * 'msg.payload' 1557 */ 1558 1559 int encode_set_state_effecter_states_req(uint8_t instance_id, 1560 uint16_t effecter_id, 1561 uint8_t comp_effecter_count, 1562 set_effecter_state_field *field, 1563 struct pldm_msg *msg); 1564 1565 /** @brief Decode SetStateEffecterStates response data 1566 * 1567 * Note: 1568 * * If the return value is not PLDM_SUCCESS, it represents a 1569 * transport layer error. 1570 * * If the completion_code value is not PLDM_SUCCESS, it represents a 1571 * protocol layer error and all the out-parameters are invalid. 1572 * 1573 * @param[in] msg - Request message 1574 * @param[in] payload_length - Length of response message payload 1575 * @param[out] completion_code - PLDM completion code 1576 * @return pldm_completion_codes 1577 */ 1578 int decode_set_state_effecter_states_resp(const struct pldm_msg *msg, 1579 size_t payload_length, 1580 uint8_t *completion_code); 1581 1582 /* SetNumericEffecterValue */ 1583 1584 /** @brief Create a PLDM request message for SetNumericEffecterValue 1585 * 1586 * @param[in] instance_id - Message's instance id 1587 * @param[in] effecter_id - used to identify and access the effecter 1588 * @param[in] effecter_data_size - The bit width and format of the setting 1589 * value for the effecter. 1590 * value:{uint8,sint8,uint16,sint16,uint32,sint32} 1591 * @param[in] effecter_value - The setting value of numeric effecter being 1592 * requested. 1593 * @param[in] payload_length - Length of request message payload 1594 * @param[out] msg - Message will be written to this 1595 * @return pldm_completion_codes 1596 * @note Caller is responsible for memory alloc and dealloc of param 1597 * 'msg.payload' 1598 */ 1599 int encode_set_numeric_effecter_value_req(uint8_t instance_id, 1600 uint16_t effecter_id, 1601 uint8_t effecter_data_size, 1602 const uint8_t *effecter_value, 1603 struct pldm_msg *msg, 1604 size_t payload_length); 1605 1606 /** @brief Decode SetNumericEffecterValue response data 1607 * @param[in] msg - Request message 1608 * @param[in] payload_length - Length of response message payload 1609 * @param[out] completion_code - PLDM completion code 1610 * @return pldm_completion_codes 1611 */ 1612 int decode_set_numeric_effecter_value_resp(const struct pldm_msg *msg, 1613 size_t payload_length, 1614 uint8_t *completion_code); 1615 1616 /** @brief Create a PLDM request message for GetStateSensorReadings 1617 * 1618 * @param[in] instance_id - Message's instance id 1619 * @param[in] sensor_id - used to identify and access the simple or composite 1620 * sensor 1621 * @param[in] sensorRearm - Each bit location in this field corresponds to a 1622 * particular sensor within the state sensor, where bit [0] corresponds 1623 * to the first state sensor (sensor offset 0) and bit [7] corresponds 1624 * to the eighth sensor (sensor offset 7), sequentially 1625 * @param[in] reserved - value: 0x00 1626 * @param[out] msg - Message will be written to this 1627 * @return pldm_completion_codes 1628 * @note Caller is responsible for memory alloc and dealloc of param 1629 * 'msg.payload' 1630 */ 1631 int encode_get_state_sensor_readings_req(uint8_t instance_id, 1632 uint16_t sensor_id, 1633 bitfield8_t sensor_rearm, 1634 uint8_t reserved, 1635 struct pldm_msg *msg); 1636 1637 /** @brief Decode GetStateSensorReadings response data 1638 * 1639 * @param[in] msg - Request message 1640 * @param[in] payload_length - Length of response message payload 1641 * @param[out] completion_code - PLDM completion code 1642 * @param[in,out] comp_sensor_count - The number of individual sets of sensor 1643 * information that this command accesses 1644 * @param[out] field - Each stateField is an instance of a stateField structure 1645 * that is used to return the present operational state setting and the 1646 * present state and event state for a particular set of sensor 1647 * information contained within the state sensor 1648 * @return pldm_completion_codes 1649 */ 1650 1651 int decode_get_state_sensor_readings_resp(const struct pldm_msg *msg, 1652 size_t payload_length, 1653 uint8_t *completion_code, 1654 uint8_t *comp_sensor_count, 1655 get_sensor_state_field *field); 1656 1657 /* GetStateEffecterStates */ 1658 1659 /** @brief Decode GetStateEffecterStates request data 1660 * 1661 * @param[in] msg - Request message 1662 * @param[in] payload_length - Length of request message payload 1663 * @param[out] effecter_id - used to identify and access the effecter 1664 * @return pldm_completion_codes 1665 */ 1666 int decode_get_state_effecter_states_req(const struct pldm_msg *msg, 1667 size_t payload_length, 1668 uint16_t *effecter_id); 1669 1670 /** @brief Create a PLDM request message for GetStateEffecterStates 1671 * 1672 * @param[in] instance_id - Message's instance id 1673 * @param[in] effecter_id - used to identify and access the effecter 1674 * @param[out] msg - Message will be written to this 1675 * @param[in] payload_length - Length of request message payload 1676 * @return pldm_completion_codes 1677 * @note Caller is responsible for memory alloc and dealloc of param 1678 * 'msg.payload' 1679 */ 1680 int encode_get_state_effecter_states_req(uint8_t instance_id, 1681 uint16_t effecter_id, 1682 struct pldm_msg *msg, 1683 size_t payload_length); 1684 1685 /** @brief Decode GetStateEffecterStates response data 1686 * 1687 * @param[in] msg - Request message 1688 * @param[in] payload_length - Length of response message payload 1689 * @param[out] resp - Consists of PLDM completion code, the number 1690 * of individual sets of effecters information that this command 1691 * accesses and an instance of a stateField structure that is 1692 * used to return the present operational state setting and 1693 * the present state and event state for a particular set of effecter 1694 * information contained within the state effecter 1695 * @return pldm_completion_codes 1696 */ 1697 int decode_get_state_effecter_states_resp( 1698 const struct pldm_msg *msg, size_t payload_length, 1699 struct pldm_get_state_effecter_states_resp *resp); 1700 1701 /** @brief Encode GetStateEffecterStates response data 1702 * 1703 * @param[in] instance_id - Message's instance id 1704 * @param[in] resp - Consists of PLDM completion code, the number 1705 * of individual sets of effecters information that this command 1706 * accesses and an instance of a stateField structure that is 1707 * used to return the present operational state setting and 1708 * the present state and event state for a particular set of effecter 1709 * information contained within the state effecter 1710 * @param[out] msg - Message will be written to this 1711 * @param[in] payload_length - Length of response message payload 1712 * @return pldm_completion_codes 1713 */ 1714 int encode_get_state_effecter_states_resp( 1715 uint8_t instance_id, struct pldm_get_state_effecter_states_resp *resp, 1716 struct pldm_msg *msg, size_t payload_length); 1717 1718 /* PlatformEventMessage */ 1719 1720 /** @brief Decode PlatformEventMessage request data 1721 * @param[in] msg - Request message 1722 * @param[in] payload_length - Length of response message payload 1723 * @param[out] format_version - Version of the event format 1724 * @param[out] tid - Terminus ID for the terminus that originated the event 1725 * message 1726 * @param[out] event_class - The class of event being sent 1727 * @param[out] event_data_offset - Offset where the event data should be read 1728 * from pldm msg 1729 * @return pldm_completion_codes 1730 */ 1731 int decode_platform_event_message_req(const struct pldm_msg *msg, 1732 size_t payload_length, 1733 uint8_t *format_version, uint8_t *tid, 1734 uint8_t *event_class, 1735 size_t *event_data_offset); 1736 1737 /** @brief Decode PollForEventMessage request data 1738 * @param[in] msg - Request message 1739 * @param[in] payload_length - Length of response message payload 1740 * @param[out] format_version - Version of the event format 1741 * @param[out] transfer_operation_flag - The transfer operation flag 1742 * @param[out] data_transfer_handle - The data transfer handle 1743 * @param[out] event_id_to_acknowledge - The class of event being sent 1744 * from pldm msg 1745 * @return pldm_completion_codes 1746 */ 1747 int decode_poll_for_platform_event_message_req( 1748 const struct pldm_msg *msg, size_t payload_length, 1749 uint8_t *format_version, uint8_t *transfer_operation_flag, 1750 uint32_t *data_transfer_handle, uint16_t *event_id_to_acknowledge); 1751 1752 /** @brief Encode PlatformEventMessage response data 1753 * @param[in] instance_id - Message's instance id 1754 * @param[in] completion_code - PLDM completion code 1755 * @param[in] platform_event_status - Response status of the event message 1756 * command 1757 * @param[out] msg - Message will be written to this 1758 * @return pldm_completion_codes 1759 * @note Caller is responsible for memory alloc and dealloc of param 1760 * 'msg.payload' 1761 */ 1762 int encode_platform_event_message_resp(uint8_t instance_id, 1763 uint8_t completion_code, 1764 uint8_t platform_event_status, 1765 struct pldm_msg *msg); 1766 1767 /** @brief Encode PollForPlatformEventMessage response data 1768 * @param[in] instance_id - Message's instance id 1769 * @param[in] completion_code - PLDM completion code 1770 * @param[in] tid - Terminus ID 1771 * @param[in] event_id - The event id 1772 * @param[in] next_data_transfer_handle - The next data transfer handle 1773 * @param[in] transfer_flag - The transfer flag 1774 * @param[in] event_class - The event class 1775 * @param[in] event_data_size - The event data size 1776 * @param[in] event_data - The event data 1777 * @param[in] checksum - The checksum 1778 * @param[out] msg - Message will be written to this 1779 * @param[in] payload_length - Length of Response message payload 1780 * @return pldm_completion_codes 1781 * @note Caller is responsible for memory alloc and dealloc of param 1782 * 'msg.payload' 1783 */ 1784 int encode_poll_for_platform_event_message_resp( 1785 uint8_t instance_id, uint8_t completion_code, uint8_t tid, 1786 uint16_t event_id, uint32_t next_data_transfer_handle, 1787 uint8_t transfer_flag, uint8_t event_class, uint32_t event_data_size, 1788 uint8_t *event_data, uint32_t checksum, struct pldm_msg *msg, 1789 size_t payload_length); 1790 1791 /** @brief Encode PlatformEventMessage request data 1792 * @param[in] instance_id - Message's instance id 1793 * @param[in] format_version - Version of the event format 1794 * @param[in] tid - Terminus ID for the terminus that originated the event 1795 * message 1796 * @param[in] event_class - The class of event being sent 1797 * @param[in] event_data - the event data should be read from pldm msg 1798 * @param[in] event_data_length - Length of the event data 1799 * @param[out] msg - Request message 1800 * @return pldm_completion_codes 1801 * @note Caller is responsible for memory alloc and dealloc of param 1802 * 'msg.payload' 1803 */ 1804 int encode_platform_event_message_req( 1805 uint8_t instance_id, uint8_t format_version, uint8_t tid, 1806 uint8_t event_class, const uint8_t *event_data, 1807 size_t event_data_length, struct pldm_msg *msg, size_t payload_length); 1808 1809 /** @brief Encode PollForPlatformEventMessage request data 1810 * @param[in] instance_id - Message's instance id 1811 * @param[in] format_version - Version of the event format 1812 * @param[in] transfer_operation_flag - Transfer operation 1813 * @param[in] data_transfer_handle - The data transfer handle 1814 * @param[in] event_id_to_acknowledge - the event data to acknowleadge 1815 * @param[out] msg - Request message 1816 * @return pldm_completion_codes 1817 * @note Caller is responsible for memory alloc and dealloc of param 1818 * 'msg.payload' 1819 */ 1820 int encode_poll_for_platform_event_message_req(uint8_t instance_id, 1821 uint8_t format_version, 1822 uint8_t transfer_operation_flag, 1823 uint32_t data_transfer_handle, 1824 uint16_t event_id_to_acknowledge, 1825 struct pldm_msg *msg, 1826 size_t payload_length); 1827 1828 /** @brief Decode PollForPlatformEventMessage response data 1829 * @param[in] msg - Request message 1830 * @param[in] payload_length - Length of Response message payload 1831 * @param[out] completion_code - the completion code 1832 * @param[out] tid - the tid 1833 * @param[out] event_id - The event id 1834 * @param[out] next_data_transfer_handle - The next data transfer handle 1835 * @param[out] transfer_flag - The transfer flag 1836 * @param[out] event_class - The event class 1837 * @param[out] event_data_size - The event data size 1838 * @param[out] event_data - The event data. The event_data pointer points into 1839 * msg.payload and therefore has the same lifetime as msg.payload. 1840 * @param[out] event_data_integrity_checksum - The checksum 1841 * command 1842 * @return pldm_completion_codes 1843 * @note Caller is responsible for memory alloc and dealloc of param 1844 * 'msg.payload' 1845 */ 1846 int decode_poll_for_platform_event_message_resp( 1847 const struct pldm_msg *msg, size_t payload_length, 1848 uint8_t *completion_code, uint8_t *tid, uint16_t *event_id, 1849 uint32_t *next_data_transfer_handle, uint8_t *transfer_flag, 1850 uint8_t *event_class, uint32_t *event_data_size, void **event_data, 1851 uint32_t *event_data_integrity_checksum); 1852 1853 /** @brief Decode PlatformEventMessage response data 1854 * @param[in] msg - Request message 1855 * @param[in] payload_length - Length of Response message payload 1856 * @param[out] completion_code - PLDM completion code 1857 * @param[out] platform_event_status - Response status of the event message 1858 * command 1859 * @return pldm_completion_codes 1860 */ 1861 int decode_platform_event_message_resp(const struct pldm_msg *msg, 1862 size_t payload_length, 1863 uint8_t *completion_code, 1864 uint8_t *platform_event_status); 1865 1866 /** @brief Decode EventMessageBufferSize response data 1867 * @param[in] msg - Request message 1868 * @param[in] payload_length - Length of Response message payload 1869 * @param[out] completion_code - PLDM completion code 1870 * @return pldm_completion_codes 1871 */ 1872 int decode_event_message_buffer_size_resp(const struct pldm_msg *msg, 1873 size_t payload_length, 1874 uint8_t *completion_code, 1875 uint16_t *terminus_max_buffer_size); 1876 1877 /** @brief Encode EventMessageBufferSize request data 1878 * @param[in] instance_id - Message's instance id 1879 * @param[in] event_receiver_max_buffer_size - Max buffer size 1880 * @param[out] msg - Request message 1881 * @return pldm_completion_codes 1882 * @note Caller is responsible for memory alloc and dealloc of param 1883 * 'msg.payload' 1884 */ 1885 int encode_event_message_buffer_size_req(uint8_t instance_id, 1886 uint16_t event_receiver_max_buffer_size, 1887 struct pldm_msg *msg); 1888 1889 /** @brief Encode EventMessageSupported request data 1890 * 1891 * @param[in] instance_id - Message's instance id 1892 * @param[in] format_version - Version of the event format 1893 * @param[out] msg - Request message 1894 * 1895 * @return pldm_completion_codes 1896 * @note Caller is responsible for memory alloc and dealloc of param 1897 * 'msg.payload' 1898 */ 1899 int encode_event_message_supported_req(uint8_t instance_id, 1900 uint8_t format_version, 1901 struct pldm_msg *msg); 1902 1903 /** @brief Decode EventMessageSupported response data 1904 * 1905 * @param[in] msg - Request message 1906 * @param[in] payload_length - Length of Response message payload 1907 * @param[out] completion_code - PLDM completion code 1908 * @param[out] synchrony_config - the synchrony configuration 1909 * @param[out] synchrony_config_support - the synchrony configuration support 1910 * @param[out] number_event_class_returned - PLDM completion code 1911 * @param[out] event_class - the event classes 1912 * @param[in] event_class_count - the event class count 1913 * 1914 * @return pldm_completion_codes 1915 */ 1916 int decode_event_message_supported_resp(const struct pldm_msg *msg, 1917 size_t payload_length, 1918 uint8_t *completion_code, 1919 uint8_t *synchrony_config, 1920 bitfield8_t *synchrony_config_support, 1921 uint8_t *number_event_class_returned, 1922 uint8_t *event_class, 1923 uint8_t event_class_count); 1924 1925 /** @brief Decode sensorEventData response data 1926 * 1927 * @param[in] event_data - event data from the response message 1928 * @param[in] event_data_length - length of the event data 1929 * @param[out] sensor_id - sensorID value of the sensor 1930 * @param[out] sensor_event_class_type - Type of sensor event class 1931 * @param[out] event_class_data_offset - Offset where the event class data 1932 * should be read from event data 1933 * @return pldm_completion_codes 1934 * @note Caller is responsible for memory alloc and dealloc of param 1935 * 'event_data' 1936 */ 1937 int decode_sensor_event_data(const uint8_t *event_data, 1938 size_t event_data_length, uint16_t *sensor_id, 1939 uint8_t *sensor_event_class_type, 1940 size_t *event_class_data_offset); 1941 1942 /** @brief Decode sensorOpState response data 1943 * 1944 * @param[in] sensor_data - sensor_data for sensorEventClass = sensorOpState 1945 * @param[in] sensor_data_length - Length of sensor_data 1946 * @param[out] present_op_state - The sensorOperationalState value from the 1947 * state change that triggered the event message 1948 * @param[out] previous_op_state - The sensorOperationalState value for the 1949 * state from which the present state was entered 1950 * @return pldm_completion_codes 1951 * @note Caller is responsible for memory alloc and dealloc of param 1952 * 'sensor_data' 1953 */ 1954 int decode_sensor_op_data(const uint8_t *sensor_data, size_t sensor_data_length, 1955 uint8_t *present_op_state, 1956 uint8_t *previous_op_state); 1957 1958 /** @brief Decode stateSensorState response data 1959 * 1960 * @param[in] sensor_data - sensor_data for sensorEventClass = stateSensorState 1961 * @param[in] sensor_data_length - Length of sensor_data 1962 * @param[out] sensor_offset - Identifies which state sensor within a composite 1963 * state sensor the event is being returned for 1964 * @param[out] event_state - The event state value from the state change that 1965 * triggered the event message 1966 * @param[out] previous_event_state - The event state value for the state from 1967 * which the present event state was entered 1968 * @return pldm_completion_codes 1969 * @note Caller is responsible for memory alloc and dealloc of param 1970 * 'sensor_data' 1971 */ 1972 int decode_state_sensor_data(const uint8_t *sensor_data, 1973 size_t sensor_data_length, uint8_t *sensor_offset, 1974 uint8_t *event_state, 1975 uint8_t *previous_event_state); 1976 1977 /** @brief Decode numericSensorState response data 1978 * 1979 * @param[in] sensor_data - sensor_data for sensorEventClass = 1980 * numericSensorState 1981 * @param[in] sensor_data_length - Length of sensor_data 1982 * @param[out] event_state - The eventState value from the state change that 1983 * triggered the event message 1984 * @param[out] previous_event_state - The eventState value for the state from 1985 * which the present state was entered 1986 * @param[out] sensor_data_size - The bit width and format of reading and 1987 * threshold values that the sensor returns 1988 * @param[out] present_reading - The present value indicated by the sensor 1989 * @return pldm_completion_codes 1990 * @note Caller is responsible for memory alloc and dealloc of param 1991 * 'sensor_data' 1992 */ 1993 int decode_numeric_sensor_data(const uint8_t *sensor_data, 1994 size_t sensor_data_length, uint8_t *event_state, 1995 uint8_t *previous_event_state, 1996 uint8_t *sensor_data_size, 1997 uint32_t *present_reading); 1998 1999 /** @brief Decode Numeric Sensor Pdr data 2000 * 2001 * @param[in] pdr_data - pdr data for numeric sensor 2002 * @param[in] pdr_data_length - Length of pdr data 2003 * @param[out] pdr_value - unpacked numeric sensor PDR struct 2004 */ 2005 int decode_numeric_sensor_pdr_data( 2006 const void *pdr_data, size_t pdr_data_length, 2007 struct pldm_numeric_sensor_value_pdr *pdr_value); 2008 2009 /* GetNumericEffecterValue */ 2010 2011 /** @brief Create a PLDM request message for GetNumericEffecterValue 2012 * 2013 * @param[in] instance_id - Message's instance id 2014 * @param[in] effecter_id - used to identify and access the effecter 2015 * @param[out] msg - Message will be written to this 2016 * @return pldm_completion_codes 2017 * @note Caller is responsible for memory alloc and dealloc of param 2018 * 'msg.payload' 2019 */ 2020 int encode_get_numeric_effecter_value_req(uint8_t instance_id, 2021 uint16_t effecter_id, 2022 struct pldm_msg *msg); 2023 2024 /** @brief Create a PLDM response message for GetNumericEffecterValue 2025 * 2026 * @param[in] msg - Request message 2027 * @param[in] payload_length - Length of request message payload 2028 * @param[out] completion_code - PLDM completion code 2029 * @param[out] effecter_data_size - The bit width and format of the setting 2030 * value for the effecter. 2031 * value:{uint8,sint8,uint16,sint16,uint32,sint32} 2032 * @param[out] effecter_oper_state - The state of the effecter itself 2033 * @param[out] pending_value - The pending numeric value setting of the 2034 * effecter. The effecterDataSize field indicates the number of 2035 * bits used for this field 2036 * @param[out] present_value - The present numeric value setting of the 2037 * effecter. The effecterDataSize indicates the number of bits 2038 * used for this field 2039 * @return pldm_completion_codes 2040 */ 2041 int decode_get_numeric_effecter_value_resp(const struct pldm_msg *msg, 2042 size_t payload_length, 2043 uint8_t *completion_code, 2044 uint8_t *effecter_data_size, 2045 uint8_t *effecter_oper_state, 2046 uint8_t *pending_value, 2047 uint8_t *present_value); 2048 2049 /** @brief Decode pldmPDRRepositoryChgEvent response data 2050 * 2051 * @param[in] event_data - eventData for pldmPDRRepositoryChgEvent 2052 * @param[in] event_data_size - Length of event_data 2053 * @param[out] event_data_format - This field indicates if the changedRecords 2054 * are of PDR Types or PDR Record Handles 2055 * @param[out] number_of_change_records - The number of changeRecords following 2056 * this field 2057 * @param[out] change_record_data_offset - Identifies where changeRecord data 2058 * is located within event_data 2059 * @return pldm_completion_codes 2060 * @note Caller is responsible for memory alloc and dealloc of param 2061 * 'event_data' 2062 */ 2063 int decode_pldm_pdr_repository_chg_event_data( 2064 const uint8_t *event_data, size_t event_data_size, 2065 uint8_t *event_data_format, uint8_t *number_of_change_records, 2066 size_t *change_record_data_offset); 2067 2068 /** @brief Decode pldmMessagePollEvent event data type 2069 * 2070 * @param[in] event_data - event data from the response message 2071 * @param[in] event_data_length - length of the event data 2072 * @param[out] format_version - Version of the event format 2073 * @param[out] event_id - The event id 2074 * @param[out] data_transfer_handle - The data transfer handle 2075 * should be read from event data 2076 * @return pldm_completion_codes 2077 * @note Caller is responsible for memory alloc and dealloc of param 2078 * 'event_data' 2079 */ 2080 int decode_pldm_message_poll_event_data(const uint8_t *event_data, 2081 size_t event_data_length, 2082 uint8_t *format_version, 2083 uint16_t *event_id, 2084 uint32_t *data_transfer_handle); 2085 2086 /** @brief Encode pldmMessagePollEvent event data type 2087 * 2088 * @param[in] format_version - Version of the event format 2089 * @param[in] event_id - The event id 2090 * @param[in] data_transfer_handle - The data transfer handle 2091 * @param[out] event_data - event data to the response message 2092 * @param[in] event_data_length - length of the event data 2093 * @return pldm_completion_codes 2094 * @note The caller is responsible for allocating and deallocating the 2095 * event_data 2096 */ 2097 int encode_pldm_message_poll_event_data(uint8_t format_version, 2098 uint16_t event_id, 2099 uint32_t data_transfer_handle, 2100 uint8_t *event_data, 2101 size_t event_data_length); 2102 2103 /** @brief Encode PLDM PDR Repository Change eventData 2104 * @param[in] event_data_format - Format of this event data (e.g. 2105 * FORMAT_IS_PDR_HANDLES) 2106 * @param[in] number_of_change_records - Number of changeRecords in this 2107 * eventData 2108 * @param[in] event_data_operations - Array of eventDataOperations 2109 * (e.g. RECORDS_ADDED) for each changeRecord in this eventData. This array 2110 * should contain number_of_change_records elements. 2111 * @param[in] numbers_of_change_entries - Array of numbers of changeEntrys 2112 * for each changeRecord in this eventData. This array should contain 2113 * number_of_change_records elements. 2114 * @param[in] change_entries - 2-dimensional array of arrays of changeEntrys, 2115 * one array per changeRecord in this eventData. The toplevel array should 2116 * contain number_of_change_records elements. Each subarray [i] should 2117 * contain numbers_of_change_entries[i] elements. 2118 * @param[in] event_data - The eventData will be encoded into this. This entire 2119 * structure must be max_change_records_size long. It must be large enough 2120 * to accommodate the data to be encoded. The caller is responsible for 2121 * allocating and deallocating it, including the variable-size 2122 * 'event_data.change_records' field. If this parameter is NULL, 2123 * PLDM_SUCCESS will be returned and actual_change_records_size will be set 2124 * to reflect the required size of the structure. 2125 * @param[out] actual_change_records_size - The actual number of meaningful 2126 * encoded bytes in event_data. The caller can over-allocate memory and use 2127 * this output to determine the real size of the structure. 2128 * @param[in] max_change_records_size - The size of event_data in bytes. If the 2129 * encoded message would be larger than this value, an error is returned. 2130 * @return pldm_completion_codes 2131 * @note Caller is responsible for memory alloc and dealloc of param 2132 * 'event_data.change_records' 2133 */ 2134 int encode_pldm_pdr_repository_chg_event_data( 2135 uint8_t event_data_format, uint8_t number_of_change_records, 2136 const uint8_t *event_data_operations, 2137 const uint8_t *numbers_of_change_entries, 2138 const uint32_t *const *change_entries, 2139 struct pldm_pdr_repository_chg_event_data *event_data, 2140 size_t *actual_change_records_size, size_t max_change_records_size); 2141 2142 /** @brief Encode event data for a PLDM Sensor Event 2143 * 2144 * @param[out] event_data The object to store the encoded event in 2145 * @param[in] event_data_size Size of the allocation for event_data 2146 * @param[in] sensor_id Sensor ID 2147 * @param[in] sensor_event_class Sensor event class 2148 * @param[in] sensor_offset Offset 2149 * @param[in] event_state Event state 2150 * @param[in] previous_event_state Previous event state 2151 * @param[out] actual_event_data_size The real size in bytes of the event_data 2152 * @return int pldm_completion_codes PLDM_SUCCESS/PLDM_ERROR_INVALID_LENGTH 2153 * @note If event_data is NULL, then *actual_event_data_size will be set to 2154 * reflect the size of the event data, and PLDM_SUCCESS will be returned. 2155 * @note The caller is responsible for allocating and deallocating the 2156 * event_data 2157 */ 2158 int encode_sensor_event_data(struct pldm_sensor_event_data *event_data, 2159 size_t event_data_size, uint16_t sensor_id, 2160 enum sensor_event_class_states sensor_event_class, 2161 uint8_t sensor_offset, uint8_t event_state, 2162 uint8_t previous_event_state, 2163 size_t *actual_event_data_size); 2164 2165 /** @brief Decode PldmPDRRepositoryChangeRecord response data 2166 * 2167 * @param[in] change_record_data - changeRecordData for 2168 * pldmPDRRepositoryChgEvent 2169 * @param[in] change_record_data_size - Length of change_record_data 2170 * @param[out] event_data_operation - This field indicates the changeEntries 2171 * operation types 2172 * @param[out] number_of_change_entries - The number of changeEntries following 2173 * this field 2174 * @param[out] change_entry_data_offset - Identifies where changeEntries data 2175 * is located within change_record_data 2176 * @return pldm_completion_codes 2177 * @note Caller is responsible for memory alloc and dealloc of param 2178 * 'change_record_data' 2179 */ 2180 int decode_pldm_pdr_repository_change_record_data( 2181 const uint8_t *change_record_data, size_t change_record_data_size, 2182 uint8_t *event_data_operation, uint8_t *number_of_change_entries, 2183 size_t *change_entry_data_offset); 2184 2185 /* GetSensorReading */ 2186 2187 /** @brief Encode GetSensorReading request data 2188 * 2189 * @param[in] instance_id - Message's instance id 2190 * @param[in] sensor_id - A handle that is used to identify and access the 2191 * sensor 2192 * @param[in] rearm_event_state - true = manually re-arm EventState after 2193 * responding to this request, false = no manual re-arm 2194 * @param[out] msg - Message will be written to this 2195 * @return pldm_completion_codes 2196 * @note Caller is responsible for memory alloc and dealloc of param 2197 * 'msg.payload' 2198 */ 2199 int encode_get_sensor_reading_req(uint8_t instance_id, uint16_t sensor_id, 2200 bool8_t rearm_event_state, 2201 struct pldm_msg *msg); 2202 2203 /** @brief Decode GetSensorReading response data 2204 * 2205 * @param[in] msg - Request message 2206 * @param[in] payload_length - Length of response message payload 2207 * @param[out] completion_code - PLDM completion code 2208 * @param[out] sensor_data_size - The bit width and format of reading and 2209 * threshold values 2210 * @param[out] sensor_operational_state - The state of the sensor itself 2211 * @param[out] sensor_event_message_enable - value: { noEventGeneration, 2212 * eventsDisabled, eventsEnabled, opEventsOnlyEnabled, 2213 * stateEventsOnlyEnabled } 2214 * @param[out] present_state - The most recently assessed state value monitored 2215 * by the sensor 2216 * @param[out] previous_state - The state that the presentState was entered 2217 * from 2218 * @param[out] event_state - Indicates which threshold crossing assertion 2219 * events have been detected 2220 * @param[out] present_reading - The present value indicated by the sensor 2221 * @return pldm_completion_codes 2222 */ 2223 2224 int decode_get_sensor_reading_resp( 2225 const struct pldm_msg *msg, size_t payload_length, 2226 uint8_t *completion_code, uint8_t *sensor_data_size, 2227 uint8_t *sensor_operational_state, uint8_t *sensor_event_message_enable, 2228 uint8_t *present_state, uint8_t *previous_state, uint8_t *event_state, 2229 uint8_t *present_reading); 2230 2231 /** @brief Encode the SetEventReceiver request message 2232 * 2233 * @param[in] instance_id - Message's instance id 2234 * @param[in] event_message_global_enable - This value is used to enable or 2235 * disable event message generation from the terminus value: { 2236 * disable, enableAsync, enablePolling, enableAsyncKeepAlive } 2237 * @param[in] transport_protocol_type - This value is provided in the request 2238 * to help the responder verify that the content of the 2239 * eventReceiverAddressInfo field used in this request is correct for 2240 * the messaging protocol supported by the terminus. 2241 * @param[in] event_receiver_address_info - this value is a medium and 2242 * protocol-specific address that the responder should use when 2243 * transmitting event messages using the indicated protocol 2244 * @param[in] heartbeat_timer - Amount of time in seconds after each elapsing 2245 * of which the terminus shall emit a heartbeat event to the receiver 2246 * @param[out] msg - Argument to capture the Message 2247 * @return pldm_completion_codes 2248 */ 2249 int encode_set_event_receiver_req(uint8_t instance_id, 2250 uint8_t event_message_global_enable, 2251 uint8_t transport_protocol_type, 2252 uint8_t event_receiver_address_info, 2253 uint16_t heartbeat_timer, 2254 struct pldm_msg *msg); 2255 2256 /** @brief Decode the SetEventReceiver response message 2257 * 2258 * @param[in] msg - Request message 2259 * @param[in] payload_length - Length of response message payload 2260 * @param[out] completion_code - PLDM completion code 2261 * @return pldm_completion_codes 2262 */ 2263 int decode_set_event_receiver_resp(const struct pldm_msg *msg, 2264 size_t payload_length, 2265 uint8_t *completion_code); 2266 2267 /** @brief Decode the SetEventReceiver request message 2268 * 2269 * @param[in] msg - Request message 2270 * @param[in] payload_length - Length of request message payload 2271 * @param[out] event_message_global_enable - This value is used to enable or 2272 * disable event message generation from the terminus value: { 2273 * disable, enableAsync, enablePolling, enableAsyncKeepAlive } 2274 * @param[out] transport_protocol_type - This value is provided in the request 2275 * to help the responder verify that the content of the 2276 * eventReceiverAddressInfo field used in this request is correct for 2277 * the messaging protocol supported by the terminus. 2278 * @param[out] event_receiver_address_info - This value is a medium and 2279 * protocol-specific address that the responder should use when 2280 * transmitting event messages using the indicated protocol 2281 * @param[out] heartbeat_timer - Amount of time in seconds after each elapsing 2282 * of which the terminus shall emit a heartbeat event to the receiver 2283 * @return pldm_completion_codes 2284 */ 2285 int decode_set_event_receiver_req(const struct pldm_msg *msg, 2286 size_t payload_length, 2287 uint8_t *event_message_global_enable, 2288 uint8_t *transport_protocol_type, 2289 uint8_t *event_receiver_address_info, 2290 uint16_t *heartbeat_timer); 2291 2292 /** @brief Encode the SetEventReceiver response message 2293 * 2294 * @param[in] instance_id - Message's instance id 2295 * @param[in] completion_code - PLDM completion code 2296 * @param[out] msg - Argument to capture the Message 2297 * @return pldm_completion_codes 2298 */ 2299 int encode_set_event_receiver_resp(uint8_t instance_id, uint8_t completion_code, 2300 struct pldm_msg *msg); 2301 2302 /** @brief Decode Numeric effecter Pdr data 2303 * 2304 * @param[in] pdr_data - PDR data of the numeric effecter in DSP0248_1.2.2 2305 * table 87. This must be a pointer to the PDR data in the GetPDR 2306 * message body 2307 * @param[in] pdr_data_length - Length of pdr data 2308 * @param[out] pdr_value - the numeric effecter PDR data struct 2309 */ 2310 int decode_numeric_effecter_pdr_data( 2311 const void *pdr_data, size_t pdr_data_length, 2312 struct pldm_numeric_effecter_value_pdr *pdr_value); 2313 2314 #ifdef __cplusplus 2315 } 2316 #endif 2317 2318 #endif /* PLATFORM_H */ 2319