Jinu Joy Thomas | 8e92c6c | 2019-08-06 12:22:34 +0530 | [diff] [blame^] | 1 | #ifndef FRU_H |
| 2 | #define FRU_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 | |
| 12 | #include "base.h" |
| 13 | |
| 14 | #define PLDM_GET_FRU_RECORD_TABLE_METADATA_RESP_BYTES 19 |
| 15 | |
| 16 | /** @brief PLDM FRU commands |
| 17 | */ |
| 18 | enum pldm_fru_commands { |
| 19 | PLDM_GET_FRU_RECORD_TABLE_METADATA = 0X01, |
| 20 | }; |
| 21 | |
| 22 | /** @struct pldm_get_fru_record_table_metadata_resp |
| 23 | * |
| 24 | * Structure representing PLDM get FRU table metadata response. |
| 25 | */ |
| 26 | struct pldm_get_fru_record_table_metadata_resp { |
| 27 | uint8_t completion_code; //!< completion code |
| 28 | uint8_t fru_data_major_version; //!< The major version of the FRU Record |
| 29 | uint8_t fru_data_minor_version; //!< The minor version of the FRU Record |
| 30 | uint32_t |
| 31 | fru_table_maximum_size; //!< The size of the largest FRU Record data |
| 32 | uint32_t fru_table_length; //!< The total length of the FRU Record Table |
| 33 | uint16_t total_record_set_identifiers; //!< The total number of FRU |
| 34 | //!< Record Data structures |
| 35 | uint16_t |
| 36 | total_table_records; //!< The total number of records in the table |
| 37 | uint32_t |
| 38 | checksum; //!< The integrity checksum on the FRU Record Table data |
| 39 | } __attribute__((packed)); |
| 40 | |
| 41 | /* Requester */ |
| 42 | |
| 43 | /* GetFRURecordTableMetadata */ |
| 44 | |
| 45 | /** @brief Create a PLDM request message for GetFRURecordTableMetadata |
| 46 | * |
| 47 | * @param[in] instance_id - Message's instance id |
| 48 | * @param[in,out] msg - Message will be written to this |
| 49 | * @return pldm_completion_codes |
| 50 | * @note Caller is responsible for memory alloc and dealloc of param |
| 51 | * 'msg.payload' |
| 52 | */ |
| 53 | int encode_get_fru_record_table_metadata_req(uint8_t instance_id, |
| 54 | struct pldm_msg *msg); |
| 55 | |
| 56 | /** @brief Decode GetFruRecordTable response data |
| 57 | * |
| 58 | * @param[in] msg - Response message |
| 59 | * @param[in] payload_length - Length of response message payload |
| 60 | * @param[out] completion_code - Pointer to response msg's PLDM completion code |
| 61 | * @param[out] fru_data_major_version - Major version of the FRU Record |
| 62 | * @param[out] fru_data_minor_version - Minor version of the FRU Record |
| 63 | * @param[out] fru_table_maximum_size - Size of the largest FRU Record data |
| 64 | * @param[out] fru_table_length - Total length of the FRU Record Table |
| 65 | * @param[out] total_Record_Set_Identifiers - Total number of FRU Record Data |
| 66 | * structures |
| 67 | * @param[out] total_table_records - Total number of records in the table |
| 68 | * @param[out] checksum - integrity checksum on the FRU Record Table data |
| 69 | * @return pldm_completion_codes |
| 70 | */ |
| 71 | int decode_get_fru_record_table_metadata_resp( |
| 72 | const struct pldm_msg *msg, size_t payload_length, uint8_t *completion_code, |
| 73 | uint8_t *fru_data_major_version, uint8_t *fru_data_minor_version, |
| 74 | uint32_t *fru_table_maximum_size, uint32_t *fru_table_length, |
| 75 | uint16_t *total_record_set_identifiers, uint16_t *total_table_records, |
| 76 | uint32_t *checksum); |
| 77 | |
| 78 | /* Responder */ |
| 79 | |
| 80 | /* GetFRURecordTableMetadata */ |
| 81 | |
| 82 | /** @brief Create a PLDM response message for GetFRURecordTableMetadata |
| 83 | * |
| 84 | * @param[in] instance_id - Message's instance id |
| 85 | * @param[in] completion_code - PLDM completion code |
| 86 | * @param[in] fru_data_major_version - Major version of the FRU Record |
| 87 | * @param[in] fru_data_minor_version - Minor version of the FRU Record |
| 88 | * @param[in] fru_table_maximum_size - Size of the largest FRU Record data |
| 89 | * @param[in] fru_table_length - Total length of the FRU Record Table |
| 90 | * @param[in] total_Record_Set_Identifiers - Total number of FRU Record Data |
| 91 | * structures |
| 92 | * @param[in] total_table_records - Total number of records in the table |
| 93 | * @param[in] checksum - integrity checksum on the FRU Record Table data |
| 94 | * @param[in,out] msg - Message will be written to this |
| 95 | * @return pldm_completion_codes |
| 96 | * @note Caller is responsible for memory alloc and dealloc of param |
| 97 | * 'msg.payload' |
| 98 | */ |
| 99 | |
| 100 | int encode_get_fru_record_table_metadata_resp( |
| 101 | uint8_t instance_id, uint8_t completion_code, |
| 102 | uint8_t fru_data_major_version, uint8_t fru_data_minor_version, |
| 103 | uint32_t fru_table_maximum_size, uint32_t fru_table_length, |
| 104 | uint16_t total_record_set_identifiers, uint16_t total_table_records, |
| 105 | uint32_t checksum, struct pldm_msg *msg); |
| 106 | |
| 107 | #ifdef __cplusplus |
| 108 | } |
| 109 | #endif |
| 110 | |
| 111 | #endif |