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