gokulsanker | 138ceba | 2021-04-05 13:25:25 +0530 | [diff] [blame] | 1 | #ifndef FW_UPDATE_H
|
| 2 | #define FW_UPDATE_H
|
| 3 |
|
| 4 | #ifdef __cplusplus
|
| 5 | extern "C" {
|
| 6 | #endif
|
| 7 | #include "base.h"
|
| 8 |
|
| 9 | #define PLDM_QUERY_DEVICE_IDENTIFIERS_REQ_BYTES 0
|
gokulsanker | eca3e19 | 2021-04-05 14:57:41 +0530 | [diff] [blame^] | 10 | /** @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
|
gokulsanker | 138ceba | 2021-04-05 13:25:25 +0530 | [diff] [blame] | 14 |
|
| 15 | /** @brief PLDM Firmware update commands
|
| 16 | */
|
| 17 | enum pldm_firmware_update_commands { PLDM_QUERY_DEVICE_IDENTIFIERS = 0x01 };
|
| 18 |
|
gokulsanker | eca3e19 | 2021-04-05 14:57:41 +0530 | [diff] [blame^] | 19 | /** @struct pldm_query_device_identifiers_resp
|
| 20 | *
|
| 21 | * Structure representing query device identifiers response.
|
| 22 | */
|
| 23 | struct 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 |
|
gokulsanker | 138ceba | 2021-04-05 13:25:25 +0530 | [diff] [blame] | 29 | /** @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 | */
|
| 40 | int encode_query_device_identifiers_req(uint8_t instance_id,
|
| 41 | size_t payload_length,
|
| 42 | struct pldm_msg *msg);
|
gokulsanker | eca3e19 | 2021-04-05 14:57:41 +0530 | [diff] [blame^] | 43 |
|
| 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 | */
|
| 55 | int 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);
|
gokulsanker | 138ceba | 2021-04-05 13:25:25 +0530 | [diff] [blame] | 61 | #ifdef __cplusplus
|
| 62 | }
|
| 63 | #endif
|
| 64 |
|
| 65 | #endif // End of FW_UPDATE_H
|