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