xref: /openbmc/libpldm/include/libpldm/bios.h (revision 691668fe)
1 /* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */
2 #ifndef BIOS_H
3 #define BIOS_H
4 
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8 
9 #include <stddef.h>
10 #include <stdint.h>
11 
12 /* Response lengths are inclusive of completion code */
13 #define PLDM_GET_DATE_TIME_RESP_BYTES 8
14 
15 #define PLDM_GET_BIOS_TABLE_REQ_BYTES			     6
16 #define PLDM_GET_BIOS_TABLE_MIN_RESP_BYTES		     6
17 #define PLDM_SET_BIOS_TABLE_MIN_REQ_BYTES		     6
18 #define PLDM_SET_BIOS_TABLE_RESP_BYTES			     5
19 #define PLDM_SET_BIOS_ATTR_CURR_VAL_MIN_REQ_BYTES	     5
20 #define PLDM_SET_BIOS_ATTR_CURR_VAL_RESP_BYTES		     5
21 #define PLDM_GET_BIOS_ATTR_CURR_VAL_BY_HANDLE_REQ_BYTES	     7
22 #define PLDM_GET_BIOS_ATTR_CURR_VAL_BY_HANDLE_MIN_RESP_BYTES 6
23 
24 enum pldm_bios_completion_codes {
25 	PLDM_BIOS_TABLE_UNAVAILABLE = 0x83,
26 	PLDM_INVALID_BIOS_TABLE_DATA_INTEGRITY_CHECK = 0x84,
27 	PLDM_INVALID_BIOS_TABLE_TYPE = 0x85,
28 	PLDM_INVALID_BIOS_ATTR_HANDLE = 0x88,
29 };
30 enum pldm_bios_commands {
31 	PLDM_GET_BIOS_TABLE = 0x01,
32 	PLDM_SET_BIOS_TABLE = 0x02,
33 	PLDM_SET_BIOS_ATTRIBUTE_CURRENT_VALUE = 0x07,
34 	PLDM_GET_BIOS_ATTRIBUTE_CURRENT_VALUE_BY_HANDLE = 0x08,
35 	PLDM_GET_DATE_TIME = 0x0c,
36 	PLDM_SET_DATE_TIME = 0x0d,
37 };
38 
39 enum pldm_bios_table_types {
40 	PLDM_BIOS_STRING_TABLE,
41 	PLDM_BIOS_ATTR_TABLE,
42 	PLDM_BIOS_ATTR_VAL_TABLE,
43 };
44 
45 struct pldm_msg;
46 struct variable_field;
47 
48 struct pldm_bios_string_table_entry {
49 	uint16_t string_handle;
50 	uint16_t string_length;
51 	char name[1];
52 } __attribute__((packed));
53 
54 struct pldm_bios_attr_table_entry {
55 	uint16_t attr_handle;
56 	uint8_t attr_type;
57 	uint16_t string_handle;
58 	uint8_t metadata[1];
59 } __attribute__((packed));
60 
61 struct pldm_bios_enum_attr {
62 	uint8_t num_possible_values;
63 	uint16_t indices[1];
64 } __attribute__((packed));
65 
66 struct pldm_bios_attr_val_table_entry {
67 	uint16_t attr_handle;
68 	uint8_t attr_type;
69 	uint8_t value[1];
70 } __attribute__((packed));
71 
72 enum pldm_bios_attribute_type {
73 	PLDM_BIOS_ENUMERATION = 0x0,
74 	PLDM_BIOS_STRING = 0x1,
75 	PLDM_BIOS_PASSWORD = 0x2,
76 	PLDM_BIOS_INTEGER = 0x3,
77 	PLDM_BIOS_ENUMERATION_READ_ONLY = 0x80,
78 	PLDM_BIOS_STRING_READ_ONLY = 0x81,
79 	PLDM_BIOS_PASSWORD_READ_ONLY = 0x82,
80 	PLDM_BIOS_INTEGER_READ_ONLY = 0x83,
81 };
82 
83 /** @struct pldm_get_bios_table_req
84  *
85  *  structure representing GetBIOSTable request packet
86  */
87 struct pldm_get_bios_table_req {
88 	uint32_t transfer_handle;
89 	uint8_t transfer_op_flag;
90 	uint8_t table_type;
91 } __attribute__((packed));
92 
93 /** @struct pldm_get_bios_table_resp
94  *
95  *  structure representing GetBIOSTable response packet
96  */
97 struct pldm_get_bios_table_resp {
98 	uint8_t completion_code;
99 	uint32_t next_transfer_handle;
100 	uint8_t transfer_flag;
101 	uint8_t table_data[1];
102 } __attribute__((packed));
103 
104 /** @struct pldm_get_date_time_resp
105  *
106  *  Structure representing PLDM get date time response
107  */
108 struct pldm_get_date_time_resp {
109 	uint8_t completion_code; //!< completion code
110 	uint8_t seconds;	 //!< Seconds in BCD format
111 	uint8_t minutes;	 //!< Minutes in BCD format
112 	uint8_t hours;		 //!< Hours in BCD format
113 	uint8_t day;		 //!< Day of the month in BCD format
114 	uint8_t month;		 //!< Month in BCD format
115 	uint16_t year;		 //!< Year in BCD format
116 } __attribute__((packed));
117 
118 /** @struct pldm_set_date_time_req
119  *
120  *  structure representing SetDateTime request packet
121  *
122  */
123 struct pldm_set_date_time_req {
124 	uint8_t seconds; //!< Seconds in BCD format
125 	uint8_t minutes; //!< Minutes in BCD format
126 	uint8_t hours;	 //!< Hours in BCD format
127 	uint8_t day;	 //!< Day of the month in BCD format
128 	uint8_t month;	 //!< Month in BCD format
129 	uint16_t year;	 //!< Year in BCD format
130 } __attribute__((packed));
131 
132 /** @struct pldm_only_cc_resp
133  *
134  *  Structure representing PLDM responses only have completion code
135  */
136 struct pldm_only_cc_resp {
137 	uint8_t completion_code;
138 } __attribute__((packed));
139 
140 /** @struct pldm_get_bios_attribute_current_value_by_handle_req
141  *
142  *  structure representing GetBIOSAttributeCurrentValueByHandle request packet
143  */
144 struct pldm_get_bios_attribute_current_value_by_handle_req {
145 	uint32_t transfer_handle;
146 	uint8_t transfer_op_flag;
147 	uint16_t attribute_handle;
148 } __attribute__((packed));
149 
150 /** @struct pldm_get_bios_attribute_current_value_by_handle_resp
151  *
152  *  structure representing GetBIOSAttributeCurrentValueByHandle response
153  */
154 struct pldm_get_bios_attribute_current_value_by_handle_resp {
155 	uint8_t completion_code;
156 	uint32_t next_transfer_handle;
157 	uint8_t transfer_flag;
158 	uint8_t attribute_data[1];
159 } __attribute__((packed));
160 
161 /** @struct pldm_set_bios_attribute_current_value_req
162  *
163  *  structure representing SetBiosAttributeCurrentValue request packet
164  *
165  */
166 struct pldm_set_bios_attribute_current_value_req {
167 	uint32_t transfer_handle;
168 	uint8_t transfer_flag;
169 	uint8_t attribute_data[1];
170 } __attribute__((packed));
171 
172 /** @struct pldm_set_bios_attribute_current_value_resp
173  *
174  *  structure representing SetBiosCurrentValue response packet
175  *
176  */
177 struct pldm_set_bios_attribute_current_value_resp {
178 	uint8_t completion_code;
179 	uint32_t next_transfer_handle;
180 } __attribute__((packed));
181 
182 /** @struct pldm_set_bios_table_req
183  *
184  *  structure representing SetBIOSTable request packet
185  *
186  */
187 struct pldm_set_bios_table_req {
188 	uint32_t transfer_handle;
189 	uint8_t transfer_flag;
190 	uint8_t table_type;
191 	uint8_t table_data[1];
192 } __attribute__((packed));
193 
194 /** @struct pldm_set_bios_table_resp
195  *
196  *  structure representing SetBIOSTable response packet
197  *
198  */
199 struct pldm_set_bios_table_resp {
200 	uint8_t completion_code;
201 	uint32_t next_transfer_handle;
202 } __attribute__((packed));
203 
204 /* Requester */
205 
206 /* GetDateTime */
207 
208 /** @brief Create a PLDM request message for GetDateTime
209  *
210  *  @param[in] instance_id - Message's instance id
211  *  @param[out] msg - Message will be written to this
212  *  @return pldm_completion_codes
213  *  @note  Caller is responsible for memory alloc and dealloc of param
214  *         'msg.body.payload'
215  */
216 
217 int encode_get_date_time_req(uint8_t instance_id, struct pldm_msg *msg);
218 
219 /** @brief Decode a GetDateTime response message
220  *
221  *  Note:
222  *  * If the return value is not PLDM_SUCCESS, it represents a
223  * transport layer error.
224  *  * If the completion_code value is not PLDM_SUCCESS, it represents a
225  * protocol layer error and all the out-parameters are invalid.
226  *
227  *  @param[in] msg - Response message
228  *  @param[in] payload_length - Length of response message payload
229  *  @param[out] completion_code - Pointer to response msg's PLDM completion code
230  *  @param[out] seconds - Seconds in BCD format
231  *  @param[out] minutes - minutes in BCD format
232  *  @param[out] hours - hours in BCD format
233  *  @param[out] day - day of month in BCD format
234  *  @param[out] month - number of month in BCD format
235  *  @param[out] year - year in BCD format
236  *  @return pldm_completion_codes
237  */
238 int decode_get_date_time_resp(const struct pldm_msg *msg, size_t payload_length,
239 			      uint8_t *completion_code, uint8_t *seconds,
240 			      uint8_t *minutes, uint8_t *hours, uint8_t *day,
241 			      uint8_t *month, uint16_t *year);
242 
243 /* SetBiosAttributeCurrentValue */
244 
245 /** @brief Create a PLDM request message for SetBiosAttributeCurrentValue
246  *
247  *  @param[in] instance_id - Message's instance id
248  *  @param[in] transfer_handle - Handle to identify a BIOS table transfer
249  *  @param[in] transfer_flag - Flag to indicate what part of the transfer
250  * this request represents
251  *  @param[in] attribute_data - Contains current value of attribute
252  *  @param[in] attribute_length - Length of attribute
253  *  @param[out] msg - Message will be written to this
254  *  @param[in] payload_length - Length of message payload
255  *  @return pldm_completion_codes
256  *  @note  Caller is responsible for memory alloc and dealloc of params
257  *         'msg.payload'
258  */
259 int encode_set_bios_attribute_current_value_req(
260 	uint8_t instance_id, uint32_t transfer_handle, uint8_t transfer_flag,
261 	const uint8_t *attribute_data, size_t attribute_length,
262 	struct pldm_msg *msg, size_t payload_length);
263 
264 /** @brief Decode a SetBiosAttributeCurrentValue response message
265  *
266  *  Note:
267  *  * If the return value is not PLDM_SUCCESS, it represents a
268  * transport layer error.
269  *  * If the completion_code value is not PLDM_SUCCESS, it represents a
270  * protocol layer error and all the out-parameters are invalid.
271  *
272  *  @param[in] msg - Response message
273  *  @param[in] payload_length - Length of response message payload
274  *  @param[out] completion_code - Pointer to response msg's PLDM completion code
275  *  @param[out] next_transfer_handle - Pointer to a handle that identify the
276  *              next portion of the transfer
277  *  @return pldm_completion_codes
278  */
279 int decode_set_bios_attribute_current_value_resp(
280 	const struct pldm_msg *msg, size_t payload_length,
281 	uint8_t *completion_code, uint32_t *next_transfer_handle);
282 
283 /* SetBIOSTable */
284 
285 /** @brief Create a PLDM request message for SetBIOSTable
286  *
287  *  @param[in] instance_id - Message's instance id
288  *  @param[in] transfer_handle - Handle to identify a BIOS table transfer
289  *  @param[in] transfer_flag - Flag to indicate what part of the transfer
290  * 			   this request represents
291  *  @param[in] table_type - Indicates what table is being transferred
292  *             {BIOSStringTable=0x0, BIOSAttributeTable=0x1,
293  *              BIOSAttributeValueTable=0x2}
294  *  @param[in] table_data - Contains data specific to the table type
295  *  @param[in] table_length - Length of table data
296  *  @param[out] msg - Message will be written to this
297  *  @param[in] payload_length - Length of message payload
298  *  @return pldm_completion_codes
299  *  @note  Caller is responsible for memory alloc and dealloc of params
300  *         'msg.payload'
301  */
302 int encode_set_bios_table_req(uint8_t instance_id, uint32_t transfer_handle,
303 			      uint8_t transfer_flag, uint8_t table_type,
304 			      const uint8_t *table_data, size_t table_length,
305 			      struct pldm_msg *msg, size_t payload_length);
306 
307 /** @brief Decode a SetBIOSTable response message
308  *
309  *  Note:
310  *  * If the return value is not PLDM_SUCCESS, it represents a
311  * transport layer error.
312  *  * If the completion_code value is not PLDM_SUCCESS, it represents a
313  * protocol layer error and all the out-parameters are invalid.
314  *
315  *  @param[in] msg - Response message
316  *  @param[in] payload_length - Length of response message payload
317  *  @param[out] completion_code - Pointer to response msg's PLDM completion code
318  *  @param[out] next_transfer_handle - Pointer to a handle that identify the
319  *              next portion of the transfer
320  *  @return pldm_completion_codes
321  */
322 int decode_set_bios_table_resp(const struct pldm_msg *msg,
323 			       size_t payload_length, uint8_t *completion_code,
324 			       uint32_t *next_transfer_handle);
325 
326 /* Responder */
327 
328 /* GetDateTime */
329 
330 /** @brief Create a PLDM response message for GetDateTime
331  *
332  *  @param[in] instance_id - Message's instance id
333  *  @param[in] completion_code - PLDM completion code
334  *  @param[in] seconds - seconds in BCD format
335  *  @param[in] minutes - minutes in BCD format
336  *  @param[in] hours - hours in BCD format
337  *  @param[in] day - day of the month in BCD format
338  *  @param[in] month - number of month in BCD format
339  *  @param[in] year - year in BCD format
340  *  @param[out] msg - Message will be written to this
341  *  @return pldm_completion_codes
342  *  @note  Caller is responsible for memory alloc and dealloc of param
343  *         'msg.body.payload'
344  */
345 
346 int encode_get_date_time_resp(uint8_t instance_id, uint8_t completion_code,
347 			      uint8_t seconds, uint8_t minutes, uint8_t hours,
348 			      uint8_t day, uint8_t month, uint16_t year,
349 			      struct pldm_msg *msg);
350 
351 /* GetBIOSTable */
352 
353 /** @brief Create a PLDM response message for GetBIOSTable
354  *
355  *  @param[in] instance_id - Message's instance id
356  *  @param[in] completion_code - PLDM completion code
357  *  @param[in] next_transfer_handle - handle to identify the next portion of the
358  * transfer
359  *  @param[in] transfer_flag - To indicate what part of the transfer this
360  * response represents
361  *  @param[in] table_data - BIOS Table type specific data
362  *  @param[in] payload_length - Length of payload message
363  *  @param[out] msg - Message will be written to this
364  *  @return pldm_completion_codes
365  */
366 int encode_get_bios_table_resp(uint8_t instance_id, uint8_t completion_code,
367 			       uint32_t next_transfer_handle,
368 			       uint8_t transfer_flag, uint8_t *table_data,
369 			       size_t payload_length, struct pldm_msg *msg);
370 
371 /** @brief Encode  GetBIOSTable request packet
372  *
373  *  @param[in] instance_id - Message's instance id
374  *  @param[in] transfer_handle - Handle to identify a BIOS table transfer
375  *  @param[in] transfer_op_flag - Flag to indicate the start of a multipart
376  *                                 transfer
377  *  @param[in] table_type - BIOS table type
378  *  @param[out] msg - Message will be written to this
379  *  @return pldm_completion_codes
380  */
381 int encode_get_bios_table_req(uint8_t instance_id, uint32_t transfer_handle,
382 			      uint8_t transfer_op_flag, uint8_t table_type,
383 			      struct pldm_msg *msg);
384 
385 /** @brief Decode GetBIOSTable request packet
386  *
387  *  @param[in] msg - Request message
388  *  @param[in] payload_length - Length of request message payload
389  *  @param[out] transfer_handle - Handle to identify a BIOS table transfer
390  *  @param[out] transfer_op_flag - Flag to indicate the start of a multipart
391  * transfer
392  *  @param[out] table_type - BIOS table type
393  *  @return pldm_completion_codes
394  */
395 int decode_get_bios_table_req(const struct pldm_msg *msg, size_t payload_length,
396 			      uint32_t *transfer_handle,
397 			      uint8_t *transfer_op_flag, uint8_t *table_type);
398 
399 /** @brief Decode GetBIOSTable response packet
400  *
401  *  @param[in] msg - Response message
402  *  @param[in] payload_length - Length of response message payload
403  *  @param[in] completion_code - PLDM completion code
404  *  @param[in] next_transfer_handle - handle to identify the next portion of the
405  *                                    transfer
406  *  @param[in] transfer_flag - To indicate what part of the transfer this
407  *                             response represents
408  *  @param[out] bios_table_offset - Offset where bios table data should be read
409  *                                  in pldm msg
410  *  @return pldm_completion_codes
411  */
412 int decode_get_bios_table_resp(const struct pldm_msg *msg,
413 			       size_t payload_length, uint8_t *completion_code,
414 			       uint32_t *next_transfer_handle,
415 			       uint8_t *transfer_flag,
416 			       size_t *bios_table_offset);
417 
418 /* GetBIOSAttributeCurrentValueByHandle */
419 
420 /** @brief Decode GetBIOSAttributeCurrentValueByHandle request packet
421  *
422  *  @param[in] instance_id - Message's instance id
423  *  @param[in] transfer_handle - Handle to identify a BIOS attribute transfer
424  *  @param[in] transfer_op_flag - Flag to indicate the start of a multipart
425  *                                 transfer
426  *  @param[in] attribute_handle - Handle to identify the BIOS attribute
427  *  @param[out] msg - Message will be written to this
428  *  @return pldm_completion_codes
429  */
430 int encode_get_bios_attribute_current_value_by_handle_req(
431 	uint8_t instance_id, uint32_t transfer_handle, uint8_t transfer_op_flag,
432 	uint16_t attribute_handle, struct pldm_msg *msg);
433 
434 /** @brief Decode GetBIOSAttributeCurrentValueByHandle response packet
435  *
436  *  @param[in] msg - Response message
437  *  @param[in] payload_length - Length of response message payload
438  *  @param[out] completion_code - PLDM completion code
439  *  @param[out] next_transfer_handle - handle to identify the next portion of
440  * the transfer
441  *  @param[out] transfer_flag - To indicate what part of the transfer this
442  *                             response represents
443  *  @param[out] attribute_data - contains current value of attribute
444  *  @return pldm_completion_codes
445  */
446 int decode_get_bios_attribute_current_value_by_handle_resp(
447 	const struct pldm_msg *msg, size_t payload_length,
448 	uint8_t *completion_code, uint32_t *next_transfer_handle,
449 	uint8_t *transfer_flag, struct variable_field *attribute_data);
450 
451 /** @brief Decode GetBIOSAttributeCurrentValueByHandle request packet
452  *
453  *  @param[in] msg - Request message
454  *  @param[in] payload_length - Length of request message payload
455  *  @param[out] transfer_handle - Handle to identify a BIOS table transfer
456  *  @param[out] transfer_op_flag - Flag to indicate the start of a multipart
457  * transfer
458  *  @param[out] attribute_handle - Handle to identify the BIOS attribute
459  *  @return pldm_completion_codes
460  */
461 int decode_get_bios_attribute_current_value_by_handle_req(
462 	const struct pldm_msg *msg, size_t payload_length,
463 	uint32_t *transfer_handle, uint8_t *transfer_op_flag,
464 	uint16_t *attribute_handle);
465 
466 /** @brief Create a PLDM response message for
467  * GetBIOSAttributeCurrentValueByHandle
468  *
469  *  @param[in] instance_id - Message's instance id
470  *  @param[in] completion_code - PLDM completion code
471  *  @param[in] next_transfer_handle - handle to identify the next portion of the
472  * transfer
473  *  @param[in] transfer_flag - To indicate what part of the transfer this
474  * response represents
475  *  @param[in] attribute_data - contains current value of attribute
476  *  @param[in] attribute_length - Length of attribute
477  *  @param[out] msg - Message will be written to this
478  *  @return pldm_completion_codes
479  */
480 int encode_get_bios_current_value_by_handle_resp(uint8_t instance_id,
481 						 uint8_t completion_code,
482 						 uint32_t next_transfer_handle,
483 						 uint8_t transfer_flag,
484 						 const uint8_t *attribute_data,
485 						 size_t attribute_length,
486 						 struct pldm_msg *msg);
487 
488 /* SetBiosAttributeCurrentValue */
489 
490 /** @brief Decode SetBIOSAttributeCurrentValue request packet
491  *
492  *  @param[in] msg - Request message
493  *  @param[in] payload_length - Length of request message payload
494  *  @param[out] transfer_handle - Handle to identify a BIOS table transfer
495  *  @param[out] transfer_flag - Flag to indicate what part of the transfer
496  *                              this request represents
497  *  @param[out] attribute - Struct variable_field, contains a pointer to the
498  *                          attribute field in the buffer of \p msg, \p msg must
499  *                          be valid when \p attribute is used.
500  *  @return pldm_completion_codes
501  */
502 int decode_set_bios_attribute_current_value_req(
503 	const struct pldm_msg *msg, size_t payload_length,
504 	uint32_t *transfer_handle, uint8_t *transfer_flag,
505 	struct variable_field *attribute);
506 
507 /** @brief Create a PLDM response message for SetBiosAttributeCurrentValue
508  *
509  *  @param[in] instance_id - Message's instance id
510  *  @param[in] completion_code - PLDM completion code
511  *  @param[in] next_transfer_handle - handle to identify the next portion of the
512  *  @param[out] msg - Message will be written to this
513  */
514 int encode_set_bios_attribute_current_value_resp(uint8_t instance_id,
515 						 uint8_t completion_code,
516 						 uint32_t next_transfer_handle,
517 						 struct pldm_msg *msg);
518 
519 /** @brief Create a PLDM request message for SetDateTime
520  *
521  *  @param[in] instance_id - Message's instance id
522  *  @param[in] seconds - Seconds in decimal format. Value range 0~59
523  *  @param[in] minutes - minutes in decimal format. Value range 0~59
524  *  @param[in] hours - hours in decimal format. Value range 0~23
525  *  @param[in] day - day of month in decimal format. Value range 1~31
526  *  @param[in] month - number of month in decimal format. Value range 1~12
527  *  @param[in] year - year in decimal format. Value range 1970~
528  *  @param[out] msg - Message will be written to this
529  *  @param[in] payload_length - Length of request message payload
530  *  @return pldm_completion_codes
531  *  @note  Caller is responsible for memory alloc and dealloc of param
532  *         'msg.body.payload'
533  */
534 int encode_set_date_time_req(uint8_t instance_id, uint8_t seconds,
535 			     uint8_t minutes, uint8_t hours, uint8_t day,
536 			     uint8_t month, uint16_t year, struct pldm_msg *msg,
537 			     size_t payload_length);
538 
539 /** @brief Decode a SetDateTime request message
540  *
541  *  @param[in] msg - Response message
542  *  @param[in] payload_length - Length of request message payload
543  *  @param[out] seconds - seconds in BCD format
544  *  @param[out] minutes - minutes in BCD format
545  *  @param[out] hours - hours in BCD format
546  *  @param[out] day - day of the month in BCD format
547  *  @param[out] month - number of month in BCD format
548  *  @param[out] year - year in BCD format
549  *  @return pldm_completion_codes
550  */
551 int decode_set_date_time_req(const struct pldm_msg *msg, size_t payload_length,
552 			     uint8_t *seconds, uint8_t *minutes, uint8_t *hours,
553 			     uint8_t *day, uint8_t *month, uint16_t *year);
554 
555 /** @brief Create a PLDM response message for SetDateTime
556  *
557  *  @param[in] instance_id - Message's instance id
558  *  @param[in] completion_code - PLDM completion code
559  *  @param[out] msg - Message will be written to this
560  *  @param[in] payload_length - Length of response message payload
561  *  @return pldm_completion_codes
562  *  @note  Caller is responsible for memory alloc and dealloc of param
563  *         'msg.body.payload'
564  */
565 int encode_set_date_time_resp(uint8_t instance_id, uint8_t completion_code,
566 			      struct pldm_msg *msg, size_t payload_length);
567 
568 /** @brief Decode a SetDateTime response message
569  *
570  *  Note:
571  *  * If the return value is not PLDM_SUCCESS, it represents a
572  * transport layer error.
573  *  * If the completion_code value is not PLDM_SUCCESS, it represents a
574  * protocol layer error and all the out-parameters are invalid.
575  *
576  *  @param[in] msg - Response message
577  *  @param[in] payload_length - Length of response message payload
578  *  @param[out] completion_code - Pointer to response msg's PLDM completion code
579  *  @return pldm_completion_codes
580  */
581 int decode_set_date_time_resp(const struct pldm_msg *msg, size_t payload_length,
582 			      uint8_t *completion_code);
583 
584 /* SetBIOSTable */
585 
586 /** @brief Create a PLDM response message for SetBIOSTable
587  *
588  *  @param[in] instance_id - Message's instance id
589  *  @param[in] completion_code - PLDM completion code
590  *  @param[in] next_transfer_handle - handle to identify the next portion of the
591  *             transfer
592  *  @param[out] msg - Message will be written to this
593  */
594 int encode_set_bios_table_resp(uint8_t instance_id, uint8_t completion_code,
595 			       uint32_t next_transfer_handle,
596 			       struct pldm_msg *msg);
597 
598 /** @brief Decode SetBIOSTable request packet
599  *
600  *  @param[in] msg - Request message
601  *  @param[in] payload_length - Length of request message payload
602  *  @param[out] transfer_handle - Handle to identify a BIOS table transfer
603  *  @param[out] transfer_flag - Flag to indicate what part of the transfer
604  *                              this request represents
605  *  @param[out] table_type - Indicates what table is being transferred
606  *             {BIOSStringTable=0x0, BIOSAttributeTable=0x1,
607  *              BIOSAttributeValueTable=0x2}
608  *  @param[out] table - Struct variable_field, contains data specific to the
609  * 				table type and the length of table data.
610  *  @return pldm_completion_codes
611  */
612 int decode_set_bios_table_req(const struct pldm_msg *msg, size_t payload_length,
613 			      uint32_t *transfer_handle, uint8_t *transfer_flag,
614 			      uint8_t *table_type,
615 			      struct variable_field *table);
616 
617 #ifdef __cplusplus
618 }
619 #endif
620 
621 #endif /* BIOS_H */
622