Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 1 | #ifndef BASE_H |
| 2 | #define BASE_H |
| 3 | |
| 4 | #ifdef __cplusplus |
| 5 | extern "C" { |
| 6 | #endif |
| 7 | |
| 8 | #include <asm/byteorder.h> |
| 9 | #include <stddef.h> |
| 10 | #include <stdint.h> |
| 11 | |
Deepak Kodihalli | 97e0bd5 | 2019-02-21 03:54:22 -0600 | [diff] [blame] | 12 | #include "pldm_types.h" |
| 13 | |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 14 | /** @brief PLDM Types |
| 15 | */ |
| 16 | enum pldm_supported_types { |
| 17 | PLDM_BASE = 0x00, |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 18 | PLDM_PLATFORM = 0x02, |
Sampa Misra | 032bd50 | 2019-03-06 05:03:22 -0600 | [diff] [blame] | 19 | PLDM_BIOS = 0x03, |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 20 | }; |
| 21 | |
| 22 | /** @brief PLDM Commands |
| 23 | */ |
| 24 | enum pldm_supported_commands { |
Sampa Misra | 432e187 | 2019-02-13 03:49:43 -0600 | [diff] [blame] | 25 | PLDM_GET_PLDM_VERSION = 0x3, |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 26 | PLDM_GET_PLDM_TYPES = 0x4, |
| 27 | PLDM_GET_PLDM_COMMANDS = 0x5 |
| 28 | }; |
| 29 | |
| 30 | /** @brief PLDM base codes |
| 31 | */ |
| 32 | enum pldm_completion_codes { |
| 33 | PLDM_SUCCESS = 0x00, |
| 34 | PLDM_ERROR = 0x01, |
| 35 | PLDM_ERROR_INVALID_DATA = 0x02, |
| 36 | PLDM_ERROR_INVALID_LENGTH = 0x03, |
| 37 | PLDM_ERROR_NOT_READY = 0x04, |
| 38 | PLDM_ERROR_UNSUPPORTED_PLDM_CMD = 0x05, |
| 39 | PLDM_ERROR_INVALID_PLDM_TYPE = 0x20 |
| 40 | }; |
| 41 | |
Sampa Misra | 432e187 | 2019-02-13 03:49:43 -0600 | [diff] [blame] | 42 | enum transfer_op_flag { |
| 43 | PLDM_GET_NEXTPART = 0, |
| 44 | PLDM_GET_FIRSTPART = 1, |
| 45 | }; |
| 46 | |
| 47 | enum transfer_resp_flag { |
| 48 | PLDM_START = 0x01, |
| 49 | PLDM_MIDDLE = 0x02, |
| 50 | PLDM_END = 0x04, |
| 51 | PLDM_START_AND_END = 0x05, |
| 52 | }; |
| 53 | |
Tom Joseph | 4125104 | 2019-02-07 16:17:07 +0530 | [diff] [blame] | 54 | /** @enum MessageType |
| 55 | * |
| 56 | * The different message types supported by the PLDM specification. |
| 57 | */ |
| 58 | typedef enum { |
| 59 | PLDM_RESPONSE, //!< PLDM response |
| 60 | PLDM_REQUEST, //!< PLDM request |
| 61 | PLDM_RESERVED, //!< Reserved |
| 62 | PLDM_ASYNC_REQUEST_NOTIFY, //!< Unacknowledged PLDM request messages |
| 63 | } MessageType; |
| 64 | |
| 65 | #define PLDM_INSTANCE_MAX 31 |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 66 | #define PLDM_MAX_TYPES 64 |
| 67 | #define PLDM_MAX_CMDS_PER_TYPE 256 |
| 68 | |
| 69 | /* Message payload lengths */ |
| 70 | #define PLDM_GET_COMMANDS_REQ_BYTES 5 |
Sampa Misra | 432e187 | 2019-02-13 03:49:43 -0600 | [diff] [blame] | 71 | #define PLDM_GET_VERSION_REQ_BYTES 6 |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 72 | |
| 73 | /* Response lengths are inclusive of completion code */ |
| 74 | #define PLDM_GET_TYPES_RESP_BYTES 9 |
| 75 | #define PLDM_GET_COMMANDS_RESP_BYTES 33 |
Sampa Misra | 432e187 | 2019-02-13 03:49:43 -0600 | [diff] [blame] | 76 | /* Response data has only one version and does not contain the checksum */ |
| 77 | #define PLDM_GET_VERSION_RESP_BYTES 10 |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 78 | |
| 79 | /** @struct pldm_msg_hdr |
| 80 | * |
| 81 | * Structure representing PLDM message header fields |
| 82 | */ |
| 83 | struct pldm_msg_hdr { |
| 84 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
| 85 | uint8_t instance_id : 5; //!< Instance ID |
| 86 | uint8_t reserved : 1; //!< Reserved |
| 87 | uint8_t datagram : 1; //!< Datagram bit |
| 88 | uint8_t request : 1; //!< Request bit |
| 89 | #elif defined(__BIG_ENDIAN_BITFIELD) |
| 90 | uint8_t request : 1; //!< Request bit |
| 91 | uint8_t datagram : 1; //!< Datagram bit |
| 92 | uint8_t reserved : 1; //!< Reserved |
| 93 | uint8_t instance_id : 5; //!< Instance ID |
| 94 | #endif |
| 95 | |
| 96 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
| 97 | uint8_t type : 6; //!< PLDM type |
| 98 | uint8_t header_ver : 2; //!< Header version |
| 99 | #elif defined(__BIG_ENDIAN_BITFIELD) |
| 100 | uint8_t header_ver : 2; //!< Header version |
| 101 | uint8_t type : 6; //!< PLDM type |
| 102 | #endif |
| 103 | uint8_t command; //!< PLDM command code |
| 104 | } __attribute__((packed)); |
| 105 | |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 106 | /** @struct pldm_msg |
| 107 | * |
| 108 | * Structure representing PLDM message |
| 109 | */ |
| 110 | struct pldm_msg { |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 111 | struct pldm_msg_hdr hdr; //!< PLDM message header |
| 112 | uint8_t payload[1]; //!< &payload[0] is the beginning of the payload |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 113 | } __attribute__((packed)); |
| 114 | |
Tom Joseph | 4125104 | 2019-02-07 16:17:07 +0530 | [diff] [blame] | 115 | /** @struct pldm_header_info |
| 116 | * |
| 117 | * The information needed to prepare PLDM header and this is passed to the |
| 118 | * pack_pldm_header and unpack_pldm_header API. |
| 119 | */ |
| 120 | struct pldm_header_info { |
| 121 | MessageType msg_type; //!< PLDM message type |
| 122 | uint8_t instance; //!< PLDM instance id |
| 123 | uint8_t pldm_type; //!< PLDM type |
| 124 | uint8_t command; //!< PLDM command code |
| 125 | uint8_t completion_code; //!< PLDM completion code, applies for response |
| 126 | }; |
| 127 | |
Priyanga | 4b790ce | 2019-06-10 01:30:09 -0500 | [diff] [blame] | 128 | /** @struct pldm_get_types_resp |
| 129 | * |
| 130 | * Structure representing PLDM get types response. |
| 131 | */ |
| 132 | struct pldm_get_types_resp { |
| 133 | uint8_t completion_code; //!< completion code |
| 134 | bitfield8_t types[8]; //!< each bit represents whether a given PLDM Type |
| 135 | //!< is supported |
| 136 | } __attribute__((packed)); |
| 137 | |
| 138 | /** @struct pldm_get_commands_req |
| 139 | * |
| 140 | * Structure representing PLDM get commands request. |
| 141 | */ |
| 142 | struct pldm_get_commands_req { |
| 143 | uint8_t type; //!< PLDM Type for which command support information is |
| 144 | //!< being requested |
| 145 | ver32_t version; //!< version for the specified PLDM Type |
| 146 | } __attribute__((packed)); |
| 147 | |
| 148 | /** @struct pldm_get_commands_resp |
| 149 | * |
| 150 | * Structure representing PLDM get commands response. |
| 151 | */ |
| 152 | struct pldm_get_commands_resp { |
| 153 | uint8_t completion_code; //!< completion code |
| 154 | bitfield8_t commands[32]; //!< each bit represents whether a given PLDM |
| 155 | //!< command is supported |
| 156 | } __attribute__((packed)); |
| 157 | |
| 158 | /** @struct pldm_get_version_req |
| 159 | * |
| 160 | * Structure representing PLDM get version request. |
| 161 | */ |
| 162 | struct pldm_get_version_req { |
| 163 | uint32_t |
| 164 | transfer_handle; //!< handle to identify PLDM version data transfer |
| 165 | uint8_t transfer_opflag; //!< PLDM GetVersion operation flag |
| 166 | uint8_t type; //!< PLDM Type for which version information is being |
| 167 | //!< requested |
| 168 | } __attribute__((packed)); |
| 169 | |
| 170 | /** @struct pldm_get_version_resp |
| 171 | * |
| 172 | * Structure representing PLDM get version response. |
| 173 | */ |
| 174 | |
| 175 | struct pldm_get_version_resp { |
| 176 | uint8_t completion_code; //!< completion code |
| 177 | uint32_t next_transfer_handle; //!< next portion of PLDM version data |
| 178 | //!< transfer |
| 179 | uint8_t transfer_flag; //!< PLDM GetVersion transfer flag |
| 180 | uint8_t version_data[1]; //!< PLDM GetVersion version field |
| 181 | } __attribute__((packed)); |
| 182 | |
Tom Joseph | 4125104 | 2019-02-07 16:17:07 +0530 | [diff] [blame] | 183 | /** |
| 184 | * @brief Populate the PLDM message with the PLDM header.The caller of this API |
| 185 | * allocates buffer for the PLDM header when forming the PLDM message. |
| 186 | * The buffer is passed to this API to pack the PLDM header. |
| 187 | * |
| 188 | * @param[in] hdr - Pointer to the PLDM header information |
| 189 | * @param[out] msg - Pointer to PLDM message header |
| 190 | * |
| 191 | * @return 0 on success, otherwise PLDM error codes. |
| 192 | */ |
| 193 | int pack_pldm_header(const struct pldm_header_info *hdr, |
| 194 | struct pldm_msg_hdr *msg); |
| 195 | |
| 196 | /** |
| 197 | * @brief Unpack the PLDM header from the PLDM message. |
| 198 | * |
| 199 | * @param[in] msg - Pointer to the PLDM message header |
| 200 | * @param[out] hdr - Pointer to the PLDM header information |
| 201 | * |
| 202 | * @return 0 on success, otherwise PLDM error codes. |
| 203 | */ |
| 204 | int unpack_pldm_header(const struct pldm_msg_hdr *msg, |
| 205 | struct pldm_header_info *hdr); |
| 206 | |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 207 | /* Requester */ |
| 208 | |
| 209 | /* GetPLDMTypes */ |
| 210 | |
| 211 | /** @brief Create a PLDM request message for GetPLDMTypes |
| 212 | * |
| 213 | * @param[in] instance_id - Message's instance id |
| 214 | * @param[in,out] msg - Message will be written to this |
| 215 | * @return pldm_completion_codes |
| 216 | * @note Caller is responsible for memory alloc and dealloc of param |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 217 | * 'msg.payload' |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 218 | */ |
| 219 | int encode_get_types_req(uint8_t instance_id, struct pldm_msg *msg); |
| 220 | |
| 221 | /** @brief Decode a GetPLDMTypes response message |
| 222 | * |
| 223 | * @param[in] msg - Response message payload |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 224 | * @param[in] payload_length - Length of response message payload |
Deepak Kodihalli | 8c64346 | 2019-02-21 10:43:36 -0600 | [diff] [blame] | 225 | * @param[out] completion_code - Pointer to response msg's PLDM completion code |
Deepak Kodihalli | 97e0bd5 | 2019-02-21 03:54:22 -0600 | [diff] [blame] | 226 | * @param[out] types - pointer to array bitfield8_t[8] containing supported |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 227 | * types (MAX_TYPES/8) = 8), as per DSP0240 |
| 228 | * @return pldm_completion_codes |
| 229 | */ |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 230 | int decode_get_types_resp(const uint8_t *msg, size_t payload_length, |
Deepak Kodihalli | 8c64346 | 2019-02-21 10:43:36 -0600 | [diff] [blame] | 231 | uint8_t *completion_code, bitfield8_t *types); |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 232 | |
| 233 | /* GetPLDMCommands */ |
| 234 | |
| 235 | /** @brief Create a PLDM request message for GetPLDMCommands |
| 236 | * |
| 237 | * @param[in] instance_id - Message's instance id |
| 238 | * @param[in] type - PLDM Type |
| 239 | * @param[in] version - Version for PLDM Type |
| 240 | * @param[in,out] msg - Message will be written to this |
| 241 | * @return pldm_completion_codes |
| 242 | * @note Caller is responsible for memory alloc and dealloc of param |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 243 | * 'msg.payload' |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 244 | */ |
Deepak Kodihalli | 97e0bd5 | 2019-02-21 03:54:22 -0600 | [diff] [blame] | 245 | int encode_get_commands_req(uint8_t instance_id, uint8_t type, ver32_t version, |
| 246 | struct pldm_msg *msg); |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 247 | |
| 248 | /** @brief Decode a GetPLDMCommands response message |
| 249 | * |
| 250 | * @param[in] msg - Response message payload |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 251 | * @param[in] payload_length - Length of reponse message payload |
Deepak Kodihalli | 8c64346 | 2019-02-21 10:43:36 -0600 | [diff] [blame] | 252 | * @param[out] completion_code - Pointer to response msg's PLDM completion code |
Deepak Kodihalli | 97e0bd5 | 2019-02-21 03:54:22 -0600 | [diff] [blame] | 253 | * @param[in] commands - pointer to array bitfield8_t[32] containing supported |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 254 | * commands (PLDM_MAX_CMDS_PER_TYPE/8) = 32), as per DSP0240 |
| 255 | * @return pldm_completion_codes |
| 256 | */ |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 257 | int decode_get_commands_resp(const uint8_t *msg, size_t payload_length, |
Deepak Kodihalli | 8c64346 | 2019-02-21 10:43:36 -0600 | [diff] [blame] | 258 | uint8_t *completion_code, bitfield8_t *commands); |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 259 | |
Sampa Misra | 432e187 | 2019-02-13 03:49:43 -0600 | [diff] [blame] | 260 | /* GetPLDMVersion */ |
| 261 | |
| 262 | /** @brief Create a PLDM request for GetPLDMVersion |
| 263 | * |
| 264 | * @param[in] instance_id - Message's instance id |
| 265 | * @param[in] transfer_handle - Handle to identify PLDM version data transfer. |
| 266 | * This handle is ignored by the responder when the |
| 267 | * transferop_flag is set to getFirstPart. |
| 268 | * @param[in] transfer_opflag - flag to indicate whether it is start of |
| 269 | * transfer |
| 270 | * @param[in] type - PLDM Type for which version is requested |
| 271 | * @param[in,out] msg - Message will be written to this |
| 272 | * @return pldm_completion_codes |
| 273 | * @note Caller is responsible for memory alloc and dealloc of param |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 274 | * 'msg.payload' |
Sampa Misra | 432e187 | 2019-02-13 03:49:43 -0600 | [diff] [blame] | 275 | */ |
| 276 | int encode_get_version_req(uint8_t instance_id, uint32_t transfer_handle, |
| 277 | uint8_t transfer_opflag, uint8_t type, |
| 278 | struct pldm_msg *msg); |
| 279 | |
| 280 | /** @brief Decode a GetPLDMVersion response message |
| 281 | * |
| 282 | * @param[in] msg - Response message payload |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 283 | * @param[in] payload_length - Length of reponse message payload |
Deepak Kodihalli | 8c64346 | 2019-02-21 10:43:36 -0600 | [diff] [blame] | 284 | * @param[out] completion_code - Pointer to response msg's PLDM completion code |
Sampa Misra | 432e187 | 2019-02-13 03:49:43 -0600 | [diff] [blame] | 285 | * @param[out] next_transfer_handle - the next handle for the next part of data |
| 286 | * @param[out] transfer_flag - flag to indicate the part of data |
| 287 | * @return pldm_completion_codes |
| 288 | */ |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 289 | int decode_get_version_resp(const uint8_t *msg, size_t payload_length, |
Deepak Kodihalli | 8c64346 | 2019-02-21 10:43:36 -0600 | [diff] [blame] | 290 | uint8_t *completion_code, |
Sampa Misra | 432e187 | 2019-02-13 03:49:43 -0600 | [diff] [blame] | 291 | uint32_t *next_transfer_handle, |
Deepak Kodihalli | 97e0bd5 | 2019-02-21 03:54:22 -0600 | [diff] [blame] | 292 | uint8_t *transfer_flag, ver32_t *version); |
Sampa Misra | 432e187 | 2019-02-13 03:49:43 -0600 | [diff] [blame] | 293 | |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 294 | /* Responder */ |
| 295 | |
| 296 | /* GetPLDMTypes */ |
| 297 | |
| 298 | /** @brief Create a PLDM response message for GetPLDMTypes |
| 299 | * |
| 300 | * @param[in] instance_id - Message's instance id |
| 301 | * @param[in] completion_code - PLDM completion code |
Deepak Kodihalli | 97e0bd5 | 2019-02-21 03:54:22 -0600 | [diff] [blame] | 302 | * @param[in] types - pointer to array bitfield8_t[8] containing supported |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 303 | * types (MAX_TYPES/8) = 8), as per DSP0240 |
| 304 | * @param[in,out] msg - Message will be written to this |
| 305 | * @return pldm_completion_codes |
| 306 | * @note Caller is responsible for memory alloc and dealloc of param |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 307 | * 'msg.payload' |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 308 | */ |
| 309 | int encode_get_types_resp(uint8_t instance_id, uint8_t completion_code, |
Deepak Kodihalli | 97e0bd5 | 2019-02-21 03:54:22 -0600 | [diff] [blame] | 310 | const bitfield8_t *types, struct pldm_msg *msg); |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 311 | |
| 312 | /* GetPLDMCommands */ |
| 313 | |
| 314 | /** @brief Decode GetPLDMCommands' request data |
| 315 | * |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 316 | * @param[in] msg - Request message |
| 317 | * @param[in] payload_length - Length of request message payload |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 318 | * @param[out] type - PLDM Type |
| 319 | * @param[out] version - Version for PLDM Type |
| 320 | * @return pldm_completion_codes |
| 321 | */ |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 322 | int decode_get_commands_req(const uint8_t *msg, size_t payload_length, |
| 323 | uint8_t *type, ver32_t *version); |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 324 | |
| 325 | /** @brief Create a PLDM response message for GetPLDMCommands |
| 326 | * |
| 327 | * @param[in] instance_id - Message's instance id |
| 328 | * @param[in] completion_code - PLDM completion code |
Deepak Kodihalli | 97e0bd5 | 2019-02-21 03:54:22 -0600 | [diff] [blame] | 329 | * @param[in] commands - pointer to array bitfield8_t[32] containing supported |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 330 | * commands (PLDM_MAX_CMDS_PER_TYPE/8) = 32), as per DSP0240 |
| 331 | * @param[in,out] msg - Message will be written to this |
| 332 | * @return pldm_completion_codes |
| 333 | * @note Caller is responsible for memory alloc and dealloc of param |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 334 | * 'msg.payload' |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 335 | */ |
| 336 | int encode_get_commands_resp(uint8_t instance_id, uint8_t completion_code, |
Deepak Kodihalli | 97e0bd5 | 2019-02-21 03:54:22 -0600 | [diff] [blame] | 337 | const bitfield8_t *commands, struct pldm_msg *msg); |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 338 | |
Sampa Misra | 432e187 | 2019-02-13 03:49:43 -0600 | [diff] [blame] | 339 | /* GetPLDMVersion */ |
| 340 | |
| 341 | /** @brief Create a PLDM response for GetPLDMVersion |
| 342 | * |
| 343 | * @param[in] instance_id - Message's instance id |
| 344 | * @param[in] completion_code - PLDM completion code |
| 345 | * @param[in] next_transfer_handle - Handle to identify next portion of |
| 346 | * data transfer |
| 347 | * @param[in] transfer_flag - Represents the part of transfer |
| 348 | * @param[in] version_data - the version data |
| 349 | * @param[in] version_size - size of version data |
| 350 | * @param[in,out] msg - Message will be written to this |
| 351 | * @return pldm_completion_codes |
| 352 | * @note Caller is responsible for memory alloc and dealloc of param |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 353 | * 'msg.payload' |
Sampa Misra | 432e187 | 2019-02-13 03:49:43 -0600 | [diff] [blame] | 354 | */ |
| 355 | int encode_get_version_resp(uint8_t instance_id, uint8_t completion_code, |
| 356 | uint32_t next_transfer_handle, |
Deepak Kodihalli | 97e0bd5 | 2019-02-21 03:54:22 -0600 | [diff] [blame] | 357 | uint8_t transfer_flag, const ver32_t *version_data, |
Sampa Misra | 432e187 | 2019-02-13 03:49:43 -0600 | [diff] [blame] | 358 | size_t version_size, struct pldm_msg *msg); |
| 359 | |
| 360 | /** @brief Decode a GetPLDMVersion request message |
| 361 | * |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 362 | * @param[in] msg - Request message |
| 363 | * @param[in] payload_length - length of request message payload |
Sampa Misra | 432e187 | 2019-02-13 03:49:43 -0600 | [diff] [blame] | 364 | * @param[out] transfer_handle - the handle of data |
| 365 | * @param[out] transfer_opflag - Transfer Flag |
| 366 | * @param[out] type - PLDM type for which version is requested |
| 367 | * @return pldm_completion_codes |
| 368 | */ |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 369 | int decode_get_version_req(const uint8_t *msg, size_t payload_length, |
Sampa Misra | 432e187 | 2019-02-13 03:49:43 -0600 | [diff] [blame] | 370 | uint32_t *transfer_handle, uint8_t *transfer_opflag, |
| 371 | uint8_t *type); |
| 372 | |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 373 | #ifdef __cplusplus |
| 374 | } |
| 375 | #endif |
| 376 | |
| 377 | #endif /* BASE_H */ |