ibm-oem: NewFileAvailable: API change

The file length parameter of the NewFileAvailable command is now a
uint64 instead of a uint32, to allow file IO on files larger than 4GB.

Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
Change-Id: I92a672f00665462c88d5f616f8bd2c835f666d7a
diff --git a/oem/ibm/libpldm/file_io.c b/oem/ibm/libpldm/file_io.c
index 4363269..16b56e6 100644
--- a/oem/ibm/libpldm/file_io.c
+++ b/oem/ibm/libpldm/file_io.c
@@ -495,7 +495,7 @@
 
 int decode_new_file_req(const struct pldm_msg *msg, size_t payload_length,
 			uint16_t *file_type, uint32_t *file_handle,
-			uint32_t *length)
+			uint64_t *length)
 {
 	if (msg == NULL || file_type == NULL || file_handle == NULL ||
 	    length == NULL) {
@@ -510,7 +510,7 @@
 	    (struct pldm_new_file_req *)msg->payload;
 	*file_type = le16toh(request->file_type);
 	*file_handle = le32toh(request->file_handle);
-	*length = le32toh(request->length);
+	*length = le64toh(request->length);
 
 	return PLDM_SUCCESS;
 }
@@ -542,7 +542,7 @@
 }
 
 int encode_new_file_req(uint8_t instance_id, uint16_t file_type,
-			uint32_t file_handle, uint32_t length,
+			uint32_t file_handle, uint64_t length,
 			struct pldm_msg *msg)
 {
 	struct pldm_header_info header = {0};
@@ -565,7 +565,7 @@
 	    (struct pldm_new_file_req *)msg->payload;
 	req->file_type = htole16(file_type);
 	req->file_handle = htole32(file_handle);
-	req->length = htole32(length);
+	req->length = htole64(length);
 
 	return PLDM_SUCCESS;
 }
diff --git a/oem/ibm/libpldm/file_io.h b/oem/ibm/libpldm/file_io.h
index 3a92399..15a6818 100644
--- a/oem/ibm/libpldm/file_io.h
+++ b/oem/ibm/libpldm/file_io.h
@@ -63,7 +63,7 @@
 #define PLDM_WRITE_FILE_RESP_BYTES 5
 #define PLDM_RW_FILE_BY_TYPE_MEM_REQ_BYTES 22
 #define PLDM_RW_FILE_BY_TYPE_MEM_RESP_BYTES 5
-#define PLDM_NEW_FILE_REQ_BYTES 10
+#define PLDM_NEW_FILE_REQ_BYTES 14
 #define PLDM_NEW_FILE_RESP_BYTES 1
 #define PLDM_RW_FILE_BY_TYPE_REQ_BYTES 14
 #define PLDM_RW_FILE_BY_TYPE_RESP_BYTES 5
@@ -461,7 +461,7 @@
 struct pldm_new_file_req {
 	uint16_t file_type;   //!< Type of file
 	uint32_t file_handle; //!< Handle to file
-	uint32_t length;      //!< Number of bytes in new file
+	uint64_t length;      //!< Number of bytes in new file
 } __attribute__((packed));
 
 /** @struct pldm_new_file_resp
@@ -483,7 +483,7 @@
  */
 int decode_new_file_req(const struct pldm_msg *msg, size_t payload_length,
 			uint16_t *file_type, uint32_t *file_handle,
-			uint32_t *length);
+			uint64_t *length);
 
 /** @brief Create a PLDM response for NewFileAvailable
  *
@@ -506,7 +506,7 @@
  *  @return pldm_completion_codes
  */
 int encode_new_file_req(uint8_t instance_id, uint16_t file_type,
-			uint32_t file_handle, uint32_t length,
+			uint32_t file_handle, uint64_t length,
 			struct pldm_msg *msg);
 
 /** @brief Decode NewFileAvailable command response data
diff --git a/oem/ibm/test/libpldm_fileio_test.cpp b/oem/ibm/test/libpldm_fileio_test.cpp
index ae59fb2..ac6fde4 100644
--- a/oem/ibm/test/libpldm_fileio_test.cpp
+++ b/oem/ibm/test/libpldm_fileio_test.cpp
@@ -956,7 +956,7 @@
     // Random value for fileHandle and length
     uint16_t fileType = 0xFF;
     uint32_t fileHandle = 0x12345678;
-    uint32_t length = 0x13245768;
+    uint64_t length = 0x13245768;
 
     request->file_type = fileType;
     request->file_handle = fileHandle;
@@ -964,7 +964,7 @@
 
     uint16_t retFileType = 0xFF;
     uint32_t retFileHandle = 0;
-    uint32_t retLength = 0;
+    uint64_t retLength = 0;
 
     // Invoke decode the read file request
     auto rc = decode_new_file_req(requestPtr, payload_length, &retFileType,
@@ -1004,7 +1004,7 @@
 {
     uint16_t fileType = 0;
     uint32_t fileHandle = 0;
-    uint32_t length = 0;
+    uint64_t length = 0;
 
     // Request payload message is missing
     auto rc = decode_new_file_req(NULL, 0, &fileType, &fileHandle, &length);