blob: dd63f1c4b52039108399b63f0afcc232a8077abb [file] [log] [blame]
Deepak Kodihalli1b24f972019-02-01 04:09:13 -06001#ifndef BASE_H
2#define BASE_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <asm/byteorder.h>
9#include <stddef.h>
10#include <stdint.h>
11
Deepak Kodihalli97e0bd52019-02-21 03:54:22 -060012#include "pldm_types.h"
13
Deepak Kodihalli1b24f972019-02-01 04:09:13 -060014/** @brief PLDM Types
15 */
16enum pldm_supported_types {
17 PLDM_BASE = 0x00,
Sampa Misra0db1dfa2019-03-19 00:15:31 -050018 PLDM_PLATFORM = 0x02,
Sampa Misra032bd502019-03-06 05:03:22 -060019 PLDM_BIOS = 0x03,
Jinu Joy Thomas8e92c6c2019-08-06 12:22:34 +053020 PLDM_FRU = 0x04,
Jinu Joy Thomasf666db12019-05-29 05:22:31 -050021 PLDM_OEM = 0x3F,
Deepak Kodihalli1b24f972019-02-01 04:09:13 -060022};
23
24/** @brief PLDM Commands
25 */
26enum pldm_supported_commands {
John Wang5c4f80d2019-07-29 11:12:18 +080027 PLDM_GET_TID = 0x2,
Sampa Misra432e1872019-02-13 03:49:43 -060028 PLDM_GET_PLDM_VERSION = 0x3,
Deepak Kodihalli1b24f972019-02-01 04:09:13 -060029 PLDM_GET_PLDM_TYPES = 0x4,
30 PLDM_GET_PLDM_COMMANDS = 0x5
31};
32
33/** @brief PLDM base codes
34 */
35enum pldm_completion_codes {
36 PLDM_SUCCESS = 0x00,
37 PLDM_ERROR = 0x01,
38 PLDM_ERROR_INVALID_DATA = 0x02,
39 PLDM_ERROR_INVALID_LENGTH = 0x03,
40 PLDM_ERROR_NOT_READY = 0x04,
41 PLDM_ERROR_UNSUPPORTED_PLDM_CMD = 0x05,
42 PLDM_ERROR_INVALID_PLDM_TYPE = 0x20
43};
44
Sampa Misra432e1872019-02-13 03:49:43 -060045enum transfer_op_flag {
46 PLDM_GET_NEXTPART = 0,
47 PLDM_GET_FIRSTPART = 1,
48};
49
50enum transfer_resp_flag {
51 PLDM_START = 0x01,
52 PLDM_MIDDLE = 0x02,
53 PLDM_END = 0x04,
54 PLDM_START_AND_END = 0x05,
55};
56
Tom Joseph41251042019-02-07 16:17:07 +053057/** @enum MessageType
58 *
59 * The different message types supported by the PLDM specification.
60 */
61typedef enum {
62 PLDM_RESPONSE, //!< PLDM response
63 PLDM_REQUEST, //!< PLDM request
64 PLDM_RESERVED, //!< Reserved
65 PLDM_ASYNC_REQUEST_NOTIFY, //!< Unacknowledged PLDM request messages
66} MessageType;
67
68#define PLDM_INSTANCE_MAX 31
Deepak Kodihalli1b24f972019-02-01 04:09:13 -060069#define PLDM_MAX_TYPES 64
70#define PLDM_MAX_CMDS_PER_TYPE 256
71
72/* Message payload lengths */
73#define PLDM_GET_COMMANDS_REQ_BYTES 5
Sampa Misra432e1872019-02-13 03:49:43 -060074#define PLDM_GET_VERSION_REQ_BYTES 6
Deepak Kodihalli1b24f972019-02-01 04:09:13 -060075
76/* Response lengths are inclusive of completion code */
77#define PLDM_GET_TYPES_RESP_BYTES 9
John Wang5c4f80d2019-07-29 11:12:18 +080078#define PLDM_GET_TID_RESP_BYTES 2
Deepak Kodihalli1b24f972019-02-01 04:09:13 -060079#define PLDM_GET_COMMANDS_RESP_BYTES 33
Sampa Misra432e1872019-02-13 03:49:43 -060080/* Response data has only one version and does not contain the checksum */
81#define PLDM_GET_VERSION_RESP_BYTES 10
Deepak Kodihalli1b24f972019-02-01 04:09:13 -060082
Christian Geddes6c146f12020-05-01 14:48:23 -050083#define PLDM_VERSION_0 0
84#define PLDM_CURRENT_VERSION PLDM_VERSION_0
85
Deepak Kodihalli1b24f972019-02-01 04:09:13 -060086/** @struct pldm_msg_hdr
87 *
88 * Structure representing PLDM message header fields
89 */
90struct pldm_msg_hdr {
91#if defined(__LITTLE_ENDIAN_BITFIELD)
92 uint8_t instance_id : 5; //!< Instance ID
Deepak Kodihalli826c9d42020-05-26 01:58:06 -050093 uint8_t reserved : 1; //!< Reserved
94 uint8_t datagram : 1; //!< Datagram bit
95 uint8_t request : 1; //!< Request bit
Deepak Kodihalli1b24f972019-02-01 04:09:13 -060096#elif defined(__BIG_ENDIAN_BITFIELD)
Deepak Kodihalli826c9d42020-05-26 01:58:06 -050097 uint8_t request : 1; //!< Request bit
98 uint8_t datagram : 1; //!< Datagram bit
99 uint8_t reserved : 1; //!< Reserved
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600100 uint8_t instance_id : 5; //!< Instance ID
101#endif
102
103#if defined(__LITTLE_ENDIAN_BITFIELD)
Deepak Kodihalli826c9d42020-05-26 01:58:06 -0500104 uint8_t type : 6; //!< PLDM type
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600105 uint8_t header_ver : 2; //!< Header version
106#elif defined(__BIG_ENDIAN_BITFIELD)
Deepak Kodihalli826c9d42020-05-26 01:58:06 -0500107 uint8_t header_ver : 2; //!< Header version
108 uint8_t type : 6; //!< PLDM type
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600109#endif
110 uint8_t command; //!< PLDM command code
111} __attribute__((packed));
112
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600113/** @struct pldm_msg
114 *
115 * Structure representing PLDM message
116 */
117struct pldm_msg {
vkaverapa6575b82019-04-03 05:33:52 -0500118 struct pldm_msg_hdr hdr; //!< PLDM message header
119 uint8_t payload[1]; //!< &payload[0] is the beginning of the payload
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600120} __attribute__((packed));
121
Tom Joseph41251042019-02-07 16:17:07 +0530122/** @struct pldm_header_info
123 *
124 * The information needed to prepare PLDM header and this is passed to the
125 * pack_pldm_header and unpack_pldm_header API.
126 */
127struct pldm_header_info {
Deepak Kodihalli826c9d42020-05-26 01:58:06 -0500128 MessageType msg_type; //!< PLDM message type
129 uint8_t instance; //!< PLDM instance id
130 uint8_t pldm_type; //!< PLDM type
Tom Joseph41251042019-02-07 16:17:07 +0530131 uint8_t command; //!< PLDM command code
132 uint8_t completion_code; //!< PLDM completion code, applies for response
133};
134
Priyanga4b790ce2019-06-10 01:30:09 -0500135/** @struct pldm_get_types_resp
136 *
137 * Structure representing PLDM get types response.
138 */
139struct pldm_get_types_resp {
140 uint8_t completion_code; //!< completion code
141 bitfield8_t types[8]; //!< each bit represents whether a given PLDM Type
142 //!< is supported
143} __attribute__((packed));
144
145/** @struct pldm_get_commands_req
146 *
147 * Structure representing PLDM get commands request.
148 */
149struct pldm_get_commands_req {
Deepak Kodihalli826c9d42020-05-26 01:58:06 -0500150 uint8_t type; //!< PLDM Type for which command support information is
Priyanga4b790ce2019-06-10 01:30:09 -0500151 //!< being requested
152 ver32_t version; //!< version for the specified PLDM Type
153} __attribute__((packed));
154
155/** @struct pldm_get_commands_resp
156 *
157 * Structure representing PLDM get commands response.
158 */
159struct pldm_get_commands_resp {
160 uint8_t completion_code; //!< completion code
161 bitfield8_t commands[32]; //!< each bit represents whether a given PLDM
162 //!< command is supported
163} __attribute__((packed));
164
165/** @struct pldm_get_version_req
166 *
167 * Structure representing PLDM get version request.
168 */
169struct pldm_get_version_req {
170 uint32_t
171 transfer_handle; //!< handle to identify PLDM version data transfer
172 uint8_t transfer_opflag; //!< PLDM GetVersion operation flag
173 uint8_t type; //!< PLDM Type for which version information is being
174 //!< requested
175} __attribute__((packed));
176
177/** @struct pldm_get_version_resp
178 *
179 * Structure representing PLDM get version response.
180 */
181
182struct pldm_get_version_resp {
183 uint8_t completion_code; //!< completion code
184 uint32_t next_transfer_handle; //!< next portion of PLDM version data
185 //!< transfer
Deepak Kodihalli826c9d42020-05-26 01:58:06 -0500186 uint8_t transfer_flag; //!< PLDM GetVersion transfer flag
Priyanga4b790ce2019-06-10 01:30:09 -0500187 uint8_t version_data[1]; //!< PLDM GetVersion version field
188} __attribute__((packed));
189
John Wang5c4f80d2019-07-29 11:12:18 +0800190/** @struct pldm_get_tid_resp
191 *
192 * Structure representing PLDM get tid response.
193 */
194
195struct pldm_get_tid_resp {
196 uint8_t completion_code; //!< completion code
197 uint8_t tid; //!< PLDM GetTID TID field
198} __attribute__((packed));
199
Tom Joseph41251042019-02-07 16:17:07 +0530200/**
201 * @brief Populate the PLDM message with the PLDM header.The caller of this API
202 * allocates buffer for the PLDM header when forming the PLDM message.
203 * The buffer is passed to this API to pack the PLDM header.
204 *
205 * @param[in] hdr - Pointer to the PLDM header information
206 * @param[out] msg - Pointer to PLDM message header
207 *
208 * @return 0 on success, otherwise PLDM error codes.
Christian Geddes6c146f12020-05-01 14:48:23 -0500209 * @note Caller is responsible for alloc and dealloc of msg
210 * and hdr params
Tom Joseph41251042019-02-07 16:17:07 +0530211 */
212int pack_pldm_header(const struct pldm_header_info *hdr,
213 struct pldm_msg_hdr *msg);
214
215/**
216 * @brief Unpack the PLDM header from the PLDM message.
217 *
218 * @param[in] msg - Pointer to the PLDM message header
219 * @param[out] hdr - Pointer to the PLDM header information
220 *
221 * @return 0 on success, otherwise PLDM error codes.
Christian Geddes6c146f12020-05-01 14:48:23 -0500222 * @note Caller is responsible for alloc and dealloc of msg
223 * and hdr params
Tom Joseph41251042019-02-07 16:17:07 +0530224 */
225int unpack_pldm_header(const struct pldm_msg_hdr *msg,
226 struct pldm_header_info *hdr);
227
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600228/* Requester */
229
230/* GetPLDMTypes */
231
232/** @brief Create a PLDM request message for GetPLDMTypes
233 *
234 * @param[in] instance_id - Message's instance id
235 * @param[in,out] msg - Message will be written to this
236 * @return pldm_completion_codes
237 * @note Caller is responsible for memory alloc and dealloc of param
vkaverapa6575b82019-04-03 05:33:52 -0500238 * 'msg.payload'
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600239 */
240int encode_get_types_req(uint8_t instance_id, struct pldm_msg *msg);
241
242/** @brief Decode a GetPLDMTypes response message
243 *
George Liu684a7162019-12-06 15:10:52 +0800244 * Note:
245 * * If the return value is not PLDM_SUCCESS, it represents a
246 * transport layer error.
247 * * If the completion_code value is not PLDM_SUCCESS, it represents a
248 * protocol layer error and all the out-parameters are invalid.
249 *
Zahed Hossain223a73d2019-07-04 12:46:18 -0500250 * @param[in] msg - Response message
vkaverapa6575b82019-04-03 05:33:52 -0500251 * @param[in] payload_length - Length of response message payload
Deepak Kodihalli8c643462019-02-21 10:43:36 -0600252 * @param[out] completion_code - Pointer to response msg's PLDM completion code
Deepak Kodihalli97e0bd52019-02-21 03:54:22 -0600253 * @param[out] types - pointer to array bitfield8_t[8] containing supported
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600254 * types (MAX_TYPES/8) = 8), as per DSP0240
255 * @return pldm_completion_codes
256 */
Zahed Hossain223a73d2019-07-04 12:46:18 -0500257int decode_get_types_resp(const struct pldm_msg *msg, size_t payload_length,
Deepak Kodihalli8c643462019-02-21 10:43:36 -0600258 uint8_t *completion_code, bitfield8_t *types);
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600259
260/* GetPLDMCommands */
261
262/** @brief Create a PLDM request message for GetPLDMCommands
263 *
264 * @param[in] instance_id - Message's instance id
265 * @param[in] type - PLDM Type
266 * @param[in] version - Version for PLDM Type
267 * @param[in,out] msg - Message will be written to this
268 * @return pldm_completion_codes
269 * @note Caller is responsible for memory alloc and dealloc of param
vkaverapa6575b82019-04-03 05:33:52 -0500270 * 'msg.payload'
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600271 */
Deepak Kodihalli97e0bd52019-02-21 03:54:22 -0600272int encode_get_commands_req(uint8_t instance_id, uint8_t type, ver32_t version,
273 struct pldm_msg *msg);
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600274
275/** @brief Decode a GetPLDMCommands response message
276 *
George Liu684a7162019-12-06 15:10:52 +0800277 * Note:
278 * * If the return value is not PLDM_SUCCESS, it represents a
279 * transport layer error.
280 * * If the completion_code value is not PLDM_SUCCESS, it represents a
281 * protocol layer error and all the out-parameters are invalid.
282 *
Zahed Hossain223a73d2019-07-04 12:46:18 -0500283 * @param[in] msg - Response message
vkaverapa6575b82019-04-03 05:33:52 -0500284 * @param[in] payload_length - Length of reponse message payload
Deepak Kodihalli8c643462019-02-21 10:43:36 -0600285 * @param[out] completion_code - Pointer to response msg's PLDM completion code
Deepak Kodihalli97e0bd52019-02-21 03:54:22 -0600286 * @param[in] commands - pointer to array bitfield8_t[32] containing supported
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600287 * commands (PLDM_MAX_CMDS_PER_TYPE/8) = 32), as per DSP0240
288 * @return pldm_completion_codes
289 */
Zahed Hossain223a73d2019-07-04 12:46:18 -0500290int decode_get_commands_resp(const struct pldm_msg *msg, size_t payload_length,
Deepak Kodihalli8c643462019-02-21 10:43:36 -0600291 uint8_t *completion_code, bitfield8_t *commands);
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600292
Sampa Misra432e1872019-02-13 03:49:43 -0600293/* GetPLDMVersion */
294
295/** @brief Create a PLDM request for GetPLDMVersion
296 *
297 * @param[in] instance_id - Message's instance id
298 * @param[in] transfer_handle - Handle to identify PLDM version data transfer.
299 * This handle is ignored by the responder when the
300 * transferop_flag is set to getFirstPart.
301 * @param[in] transfer_opflag - flag to indicate whether it is start of
302 * transfer
303 * @param[in] type - PLDM Type for which version is requested
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
vkaverapa6575b82019-04-03 05:33:52 -0500307 * 'msg.payload'
Sampa Misra432e1872019-02-13 03:49:43 -0600308 */
309int encode_get_version_req(uint8_t instance_id, uint32_t transfer_handle,
310 uint8_t transfer_opflag, uint8_t type,
311 struct pldm_msg *msg);
312
313/** @brief Decode a GetPLDMVersion response message
314 *
George Liu684a7162019-12-06 15:10:52 +0800315 * Note:
316 * * If the return value is not PLDM_SUCCESS, it represents a
317 * transport layer error.
318 * * If the completion_code value is not PLDM_SUCCESS, it represents a
319 * protocol layer error and all the out-parameters are invalid.
320 *
Zahed Hossain223a73d2019-07-04 12:46:18 -0500321 * @param[in] msg - Response message
vkaverapa6575b82019-04-03 05:33:52 -0500322 * @param[in] payload_length - Length of reponse message payload
Deepak Kodihalli8c643462019-02-21 10:43:36 -0600323 * @param[out] completion_code - Pointer to response msg's PLDM completion code
Sampa Misra432e1872019-02-13 03:49:43 -0600324 * @param[out] next_transfer_handle - the next handle for the next part of data
325 * @param[out] transfer_flag - flag to indicate the part of data
326 * @return pldm_completion_codes
327 */
Zahed Hossain223a73d2019-07-04 12:46:18 -0500328int decode_get_version_resp(const struct pldm_msg *msg, size_t payload_length,
Deepak Kodihalli8c643462019-02-21 10:43:36 -0600329 uint8_t *completion_code,
Sampa Misra432e1872019-02-13 03:49:43 -0600330 uint32_t *next_transfer_handle,
Deepak Kodihalli97e0bd52019-02-21 03:54:22 -0600331 uint8_t *transfer_flag, ver32_t *version);
Sampa Misra432e1872019-02-13 03:49:43 -0600332
John Wang5c4f80d2019-07-29 11:12:18 +0800333/* GetTID */
334
335/** @brief Decode a GetTID response message
336 *
George Liu684a7162019-12-06 15:10:52 +0800337 * Note:
338 * * If the return value is not PLDM_SUCCESS, it represents a
339 * transport layer error.
340 * * If the completion_code value is not PLDM_SUCCESS, it represents a
341 * protocol layer error and all the out-parameters are invalid.
342 *
John Wang5c4f80d2019-07-29 11:12:18 +0800343 * @param[in] msg - Response message
344 * @param[in] payload_length - Length of response message payload
345 * @param[out] completion_code - Pointer to response msg's PLDM completion code
346 * @param[out] tid - Pointer to the terminus id
347 * @return pldm_completion_codes
348 */
349int decode_get_tid_resp(const struct pldm_msg *msg, size_t payload_length,
350 uint8_t *completion_code, uint8_t *tid);
351
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600352/* Responder */
353
354/* GetPLDMTypes */
355
356/** @brief Create a PLDM response message for GetPLDMTypes
357 *
358 * @param[in] instance_id - Message's instance id
359 * @param[in] completion_code - PLDM completion code
Deepak Kodihalli97e0bd52019-02-21 03:54:22 -0600360 * @param[in] types - pointer to array bitfield8_t[8] containing supported
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600361 * types (MAX_TYPES/8) = 8), as per DSP0240
362 * @param[in,out] msg - Message will be written to this
363 * @return pldm_completion_codes
364 * @note Caller is responsible for memory alloc and dealloc of param
vkaverapa6575b82019-04-03 05:33:52 -0500365 * 'msg.payload'
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600366 */
367int encode_get_types_resp(uint8_t instance_id, uint8_t completion_code,
Deepak Kodihalli97e0bd52019-02-21 03:54:22 -0600368 const bitfield8_t *types, struct pldm_msg *msg);
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600369
370/* GetPLDMCommands */
371
372/** @brief Decode GetPLDMCommands' request data
373 *
vkaverapa6575b82019-04-03 05:33:52 -0500374 * @param[in] msg - Request message
375 * @param[in] payload_length - Length of request message payload
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600376 * @param[out] type - PLDM Type
377 * @param[out] version - Version for PLDM Type
378 * @return pldm_completion_codes
379 */
Zahed Hossain223a73d2019-07-04 12:46:18 -0500380int decode_get_commands_req(const struct pldm_msg *msg, size_t payload_length,
vkaverapa6575b82019-04-03 05:33:52 -0500381 uint8_t *type, ver32_t *version);
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600382
383/** @brief Create a PLDM response message for GetPLDMCommands
384 *
385 * @param[in] instance_id - Message's instance id
386 * @param[in] completion_code - PLDM completion code
Deepak Kodihalli97e0bd52019-02-21 03:54:22 -0600387 * @param[in] commands - pointer to array bitfield8_t[32] containing supported
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600388 * commands (PLDM_MAX_CMDS_PER_TYPE/8) = 32), as per DSP0240
389 * @param[in,out] msg - Message will be written to this
390 * @return pldm_completion_codes
391 * @note Caller is responsible for memory alloc and dealloc of param
vkaverapa6575b82019-04-03 05:33:52 -0500392 * 'msg.payload'
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600393 */
394int encode_get_commands_resp(uint8_t instance_id, uint8_t completion_code,
Deepak Kodihalli97e0bd52019-02-21 03:54:22 -0600395 const bitfield8_t *commands, struct pldm_msg *msg);
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600396
Sampa Misra432e1872019-02-13 03:49:43 -0600397/* GetPLDMVersion */
398
399/** @brief Create a PLDM response for GetPLDMVersion
400 *
401 * @param[in] instance_id - Message's instance id
402 * @param[in] completion_code - PLDM completion code
403 * @param[in] next_transfer_handle - Handle to identify next portion of
404 * data transfer
405 * @param[in] transfer_flag - Represents the part of transfer
406 * @param[in] version_data - the version data
407 * @param[in] version_size - size of version data
408 * @param[in,out] msg - Message will be written to this
409 * @return pldm_completion_codes
410 * @note Caller is responsible for memory alloc and dealloc of param
vkaverapa6575b82019-04-03 05:33:52 -0500411 * 'msg.payload'
Sampa Misra432e1872019-02-13 03:49:43 -0600412 */
413int encode_get_version_resp(uint8_t instance_id, uint8_t completion_code,
414 uint32_t next_transfer_handle,
Deepak Kodihalli97e0bd52019-02-21 03:54:22 -0600415 uint8_t transfer_flag, const ver32_t *version_data,
Sampa Misra432e1872019-02-13 03:49:43 -0600416 size_t version_size, struct pldm_msg *msg);
417
418/** @brief Decode a GetPLDMVersion request message
419 *
vkaverapa6575b82019-04-03 05:33:52 -0500420 * @param[in] msg - Request message
421 * @param[in] payload_length - length of request message payload
Sampa Misra432e1872019-02-13 03:49:43 -0600422 * @param[out] transfer_handle - the handle of data
423 * @param[out] transfer_opflag - Transfer Flag
424 * @param[out] type - PLDM type for which version is requested
425 * @return pldm_completion_codes
426 */
Zahed Hossain223a73d2019-07-04 12:46:18 -0500427int decode_get_version_req(const struct pldm_msg *msg, size_t payload_length,
Sampa Misra432e1872019-02-13 03:49:43 -0600428 uint32_t *transfer_handle, uint8_t *transfer_opflag,
429 uint8_t *type);
430
Sridevi Rameshbc6ff262019-12-12 04:58:35 -0600431/* Requester */
432
John Wang5c4f80d2019-07-29 11:12:18 +0800433/* GetTID */
434
Sridevi Rameshbc6ff262019-12-12 04:58:35 -0600435/** @brief Create a PLDM request message for GetTID
436 *
437 * @param[in] instance_id - Message's instance id
438 * @param[in,out] msg - Message will be written to this
439 * @return pldm_completion_codes
440 * @note Caller is responsible for memory alloc and dealloc of param
441 * 'msg.payload'
442 */
443int encode_get_tid_req(uint8_t instance_id, struct pldm_msg *msg);
444
John Wang5c4f80d2019-07-29 11:12:18 +0800445/** @brief Create a PLDM response message for GetTID
446 *
447 * @param[in] instance_id - Message's instance id
448 * @param[in] completion_code - PLDM completion code
449 * @param[in] tid - Terminus ID
450 * @param[in,out] msg - Message will be written to this
451 * @return pldm_completion_codes
452 * @note Caller is responsible for memory alloc and dealloc of param
453 * 'msg.payload'
454 */
455int encode_get_tid_resp(uint8_t instance_id, uint8_t completion_code,
456 uint8_t tid, struct pldm_msg *msg);
457
John Wang7f02d702019-12-03 13:38:14 +0800458/** @brief Create a PLDM response message containing only cc
459 *
460 * @param[in] instance_id - Message's instance id
461 * @param[in] type - PLDM Type
462 * @param[in] command - PLDM Command
463 * @param[in] cc - PLDM Completion Code
464 * @param[out] msg - Message will be written to this
465 * @return pldm_completion_codes
466 */
467int encode_cc_only_resp(uint8_t instance_id, uint8_t type, uint8_t command,
468 uint8_t cc, struct pldm_msg *msg);
469
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600470#ifdef __cplusplus
471}
472#endif
473
474#endif /* BASE_H */