Implement GetBIOSAttributeCurrentValueByHandle encode/decode API
Implemented the functions to encode/decode the request of
GetBIOSAttributeCurrentValueByHandle as required for the responder.
Corresponding unit test functions have also been added to check the
good decode requests and bad decode request.
Change-Id: I711bd13a37cfd3a825c58b37029d3c35903c7fc3
Signed-off-by: Zahed Hossain <zahzahed@in.ibm.com>
diff --git a/libpldm/bios.h b/libpldm/bios.h
index d8886c3..c018d07 100644
--- a/libpldm/bios.h
+++ b/libpldm/bios.h
@@ -16,6 +16,7 @@
#define PLDM_GET_BIOS_TABLE_REQ_BYTES 6
#define PLDM_GET_BIOS_TABLE_MIN_RESP_BYTES 6
+#define PLDM_GET_BIOS_ATTR_CURR_VAL_BY_HANDLE_REQ_BYTES 7
enum pldm_bios_completion_codes {
PLDM_BIOS_TABLE_UNAVAILABLE = 0x83,
@@ -24,7 +25,8 @@
};
enum pldm_bios_commands {
PLDM_GET_BIOS_TABLE = 0x01,
- PLDM_GET_DATE_TIME = 0x0c
+ PLDM_GET_BIOS_ATTRIBUTE_CURRENT_VALUE_BY_HANDLE = 0x08,
+ PLDM_GET_DATE_TIME = 0x0c,
};
enum pldm_bios_table_types {
@@ -103,6 +105,27 @@
uint16_t year; //!< Year in BCD format
} __attribute__((packed));
+/** @struct pldm_get_bios_attribute_current_value_by_handle_req
+ *
+ * structure representing GetBIOSAttributeCurrentValueByHandle request packet
+ */
+struct pldm_get_bios_attribute_current_value_by_handle_req {
+ uint32_t transfer_handle;
+ uint8_t transfer_op_flag;
+ uint16_t attribute_handle;
+} __attribute__((packed));
+
+/** @struct pldm_get_bios_attribute_current_value_by_handle_resp
+ *
+ * structure representing GetBIOSAttributeCurrentValueByHandle response
+ */
+struct pldm_get_bios_attribute_current_value_by_handle_resp {
+ uint8_t completion_code;
+ uint32_t next_transfer_handle;
+ uint8_t transfer_flag;
+ uint8_t attribute_data[1];
+} __attribute__((packed));
+
/* Requester */
/* GetDateTime */
@@ -195,6 +218,42 @@
uint32_t *transfer_handle,
uint8_t *transfer_op_flag, uint8_t *table_type);
+/* GetBIOSAttributeCurrentValueByHandle */
+
+/** @brief Decode GetBIOSAttributeCurrentValueByHandle request packet
+ *
+ * @param[in] msg - Request message
+ * @param[in] payload_length - Length of request message payload
+ * @param[out] transfer_handle - Handle to identify a BIOS table transfer
+ * @param[out] transfer_op_flag - Flag to indicate the start of a multipart
+ * transfer
+ * @param[out] attribute_handle - Handle to identify the BIOS attribute
+ * @return pldm_completion_codes
+ */
+int decode_get_bios_attribute_current_value_by_handle_req(
+ const struct pldm_msg *msg, size_t payload_length,
+ uint32_t *transfer_handle, uint8_t *transfer_op_flag,
+ uint16_t *attribute_handle);
+
+/** @brief Create a PLDM response message for
+ * GetBIOSAttributeCurrentValueByHandle
+ *
+ * @param[in] instance_id - Message's instance id
+ * @param[in] completion_code - PLDM completion code
+ * @param[in] next_transfer_handle - handle to identify the next portion of the
+ * transfer
+ * @param[in] transfer_flag - To indicate what part of the transfer this
+ * response represents
+ * @param[in] attribute_data - contains current value of attribute
+ * @param[in] attribute_length - Length of attribute
+ * @param[out] msg - Message will be written to this
+ * @return pldm_completion_codes
+ */
+int encode_get_bios_current_value_by_handle_resp(
+ uint8_t instance_id, uint8_t completion_code, uint32_t next_transfer_handle,
+ uint8_t transfer_flag, const uint8_t *attribute_data,
+ size_t attribute_length, struct pldm_msg *msg);
+
#ifdef __cplusplus
}
#endif