Add encode_get_bios_table() function in PLDM BIOS
Signed-off-by: Sridevi Ramesh <sridevra@in.ibm.com>
Change-Id: Id0acee69d3ba13e6c39a569f37c005f1e94a5603
diff --git a/libpldm/bios.c b/libpldm/bios.c
index 017ae4a..abf7df4 100644
--- a/libpldm/bios.c
+++ b/libpldm/bios.c
@@ -1,8 +1,7 @@
+#include "bios.h"
#include <endian.h>
#include <string.h>
-#include "bios.h"
-
int encode_get_date_time_req(uint8_t instance_id, struct pldm_msg *msg)
{
struct pldm_header_info header = {0};
@@ -127,6 +126,31 @@
return PLDM_SUCCESS;
}
+int encode_get_bios_table_req(uint8_t instance_id, uint32_t transfer_handle,
+ uint8_t transfer_op_flag, uint8_t table_type,
+ struct pldm_msg *msg)
+{
+ struct pldm_header_info header = {0};
+
+ if (msg == NULL) {
+ return PLDM_ERROR_INVALID_DATA;
+ }
+
+ header.msg_type = PLDM_REQUEST;
+ header.instance = instance_id;
+ header.pldm_type = PLDM_BIOS;
+ header.command = PLDM_GET_BIOS_TABLE;
+ pack_pldm_header(&header, &(msg->hdr));
+
+ struct pldm_get_bios_table_req *request =
+ (struct pldm_get_bios_table_req *)msg->payload;
+
+ request->transfer_handle = htole32(transfer_handle);
+ request->transfer_op_flag = transfer_op_flag;
+ request->table_type = table_type;
+ return PLDM_SUCCESS;
+}
+
int decode_get_bios_table_req(const struct pldm_msg *msg, size_t payload_length,
uint32_t *transfer_handle,
uint8_t *transfer_op_flag, uint8_t *table_type)