blob: 6ebfa79f97d92c9dbd317ee8d881c80d22225179 [file] [log] [blame]
gokulsanker138ceba2021-04-05 13:25:25 +05301#ifndef FW_UPDATE_H
2#define FW_UPDATE_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7#include "base.h"
8
9#define PLDM_QUERY_DEVICE_IDENTIFIERS_REQ_BYTES 0
gokulsankereca3e192021-04-05 14:57:41 +053010/** @brief Minimum length of device descriptor, 2 bytes for descriptor type,
11 * 2 bytes for descriptor length and atleast 1 byte of descriptor data
12 */
13#define PLDM_FWUP_DEVICE_DESCRIPTOR_MIN_LEN 5
gokulsanker138ceba2021-04-05 13:25:25 +053014
15/** @brief PLDM Firmware update commands
16 */
17enum pldm_firmware_update_commands { PLDM_QUERY_DEVICE_IDENTIFIERS = 0x01 };
18
gokulsankereca3e192021-04-05 14:57:41 +053019/** @struct pldm_query_device_identifiers_resp
20 *
21 * Structure representing query device identifiers response.
22 */
23struct pldm_query_device_identifiers_resp {
24 uint8_t completion_code;
25 uint32_t device_identifiers_len;
26 uint8_t descriptor_count;
27} __attribute__((packed));
28
gokulsanker138ceba2021-04-05 13:25:25 +053029/** @brief Create a PLDM request message for QueryDeviceIdentifiers
30 *
31 * @param[in] instance_id - Message's instance id
32 * @param[in] payload_length - Length of the request message payload
33 * @param[in,out] msg - Message will be written to this
34 *
35 * @return pldm_completion_codes
36 *
37 * @note Caller is responsible for memory alloc and dealloc of param
38 * 'msg.payload'
39 */
40int encode_query_device_identifiers_req(uint8_t instance_id,
41 size_t payload_length,
42 struct pldm_msg *msg);
gokulsankereca3e192021-04-05 14:57:41 +053043
44/** @brief Decode QueryDeviceIdentifiers response message
45 *
46 * @param[in] msg - Response message
47 * @param[in] payload_length - Length of response message payload
48 * @param[out] completion_code - Pointer to response msg's PLDM completion code
49 * @param[out] device_identifiers_len - Pointer to device identifiers length
50 * @param[out] descriptor_count - Pointer to descriptor count
51 * @param[out] descriptor_data - Pointer to descriptor data
52 *
53 * @return pldm_completion_codes
54 */
55int decode_query_device_identifiers_resp(const struct pldm_msg *msg,
56 size_t payload_length,
57 uint8_t *completion_code,
58 uint32_t *device_identifiers_len,
59 uint8_t *descriptor_count,
60 uint8_t **descriptor_data);
gokulsanker138ceba2021-04-05 13:25:25 +053061#ifdef __cplusplus
62}
63#endif
64
65#endif // End of FW_UPDATE_H