oem-ibm: fixup error codes as per spec

Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
Change-Id: If460b3d8ad5863de5437aa727bf30ec4c7715717
diff --git a/oem/ibm/libpldm/file_io.c b/oem/ibm/libpldm/file_io.c
index 69aed29..02adc80 100644
--- a/oem/ibm/libpldm/file_io.c
+++ b/oem/ibm/libpldm/file_io.c
@@ -195,7 +195,7 @@
 	}
 
 	if (length == 0) {
-		return PLDM_INVALID_READ_LENGTH;
+		return PLDM_ERROR_INVALID_LENGTH;
 	}
 
 	if ((rc = pack_pldm_header(&header, &(msg->hdr))) > PLDM_SUCCESS) {
@@ -317,7 +317,7 @@
 	}
 
 	if (length == 0) {
-		return PLDM_INVALID_WRITE_LENGTH;
+		return PLDM_ERROR_INVALID_LENGTH;
 	}
 
 	struct pldm_write_file_req *request =
diff --git a/oem/ibm/libpldm/file_io.h b/oem/ibm/libpldm/file_io.h
index aebe315..fbde227 100644
--- a/oem/ibm/libpldm/file_io.h
+++ b/oem/ibm/libpldm/file_io.h
@@ -29,13 +29,11 @@
 /** @brief PLDM Command specific codes
  */
 enum pldm_fileio_completion_codes {
-	PLDM_INVALID_FILE_HANDLE = 0x80,
-	PLDM_DATA_OUT_OF_RANGE = 0x81,
-	PLDM_INVALID_READ_LENGTH = 0x82,
-	PLDM_INVALID_WRITE_LENGTH = 0x83,
-	PLDM_FILE_TABLE_UNAVAILABLE = 0x84,
+	PLDM_FILE_TABLE_UNAVAILABLE = 0x83,
 	PLDM_INVALID_FILE_TABLE_TYPE = 0x85,
-	PLDM_INVALID_FILE_TYPE = 0x86,
+	PLDM_INVALID_FILE_HANDLE = 0x86,
+	PLDM_DATA_OUT_OF_RANGE = 0x87,
+	PLDM_INVALID_FILE_TYPE = 0x89,
 };
 
 /** @brief PLDM File I/O table types
diff --git a/oem/ibm/libpldmresponder/file_io.cpp b/oem/ibm/libpldmresponder/file_io.cpp
index ff7f0ee..12e9fed 100644
--- a/oem/ibm/libpldmresponder/file_io.cpp
+++ b/oem/ibm/libpldmresponder/file_io.cpp
@@ -238,7 +238,7 @@
                   << length << "\n";
         encode_rw_file_memory_resp(request->hdr.instance_id,
                                    PLDM_READ_FILE_INTO_MEMORY,
-                                   PLDM_INVALID_READ_LENGTH, 0, responsePtr);
+                                   PLDM_ERROR_INVALID_LENGTH, 0, responsePtr);
         return response;
     }
 
@@ -277,7 +277,7 @@
                   << length << "\n";
         encode_rw_file_memory_resp(request->hdr.instance_id,
                                    PLDM_WRITE_FILE_FROM_MEMORY,
-                                   PLDM_INVALID_WRITE_LENGTH, 0, responsePtr);
+                                   PLDM_ERROR_INVALID_LENGTH, 0, responsePtr);
         return response;
     }
 
@@ -570,7 +570,7 @@
         std::cerr << "Length is not a multiple of DMA minSize, LENGTH="
                   << length << "\n";
         encode_rw_file_by_type_memory_resp(request->hdr.instance_id, cmd,
-                                           PLDM_INVALID_WRITE_LENGTH, 0,
+                                           PLDM_ERROR_INVALID_LENGTH, 0,
                                            responsePtr);
         return response;
     }
diff --git a/oem/ibm/test/libpldm_fileio_test.cpp b/oem/ibm/test/libpldm_fileio_test.cpp
index 81facea..275f295 100644
--- a/oem/ibm/test/libpldm_fileio_test.cpp
+++ b/oem/ibm/test/libpldm_fileio_test.cpp
@@ -670,7 +670,7 @@
     // ReadFile check invalid file length
     auto rc = encode_read_file_req(0, fileHandle, offset, length, requestPtr);
 
-    ASSERT_EQ(rc, PLDM_INVALID_READ_LENGTH);
+    ASSERT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
 
     // Bad encode request for write file
     std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_WRITE_FILE_REQ_BYTES>
@@ -680,7 +680,7 @@
     // WriteFile check for invalid file length
     rc = encode_write_file_req(0, fileHandle, offset, length, requestWr);
 
-    ASSERT_EQ(rc, PLDM_INVALID_WRITE_LENGTH);
+    ASSERT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
 }
 
 TEST(ReadWriteFile, testBadEncodeResponse)
diff --git a/oem/ibm/test/libpldmresponder_fileio_test.cpp b/oem/ibm/test/libpldmresponder_fileio_test.cpp
index c19d769..d50e5fc 100644
--- a/oem/ibm/test/libpldmresponder_fileio_test.cpp
+++ b/oem/ibm/test/libpldmresponder_fileio_test.cpp
@@ -316,7 +316,7 @@
     oem_ibm::Handler handler;
     auto response = handler.readFileIntoMemory(request, requestPayloadLength);
     auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
-    ASSERT_EQ(responsePtr->payload[0], PLDM_INVALID_READ_LENGTH);
+    ASSERT_EQ(responsePtr->payload[0], PLDM_ERROR_INVALID_LENGTH);
     // Clear the file table contents.
     table.clear();
 }
@@ -350,7 +350,7 @@
     oem_ibm::Handler handler;
     auto response = handler.readFileIntoMemory(request, requestPayloadLength);
     auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
-    ASSERT_EQ(responsePtr->payload[0], PLDM_INVALID_READ_LENGTH);
+    ASSERT_EQ(responsePtr->payload[0], PLDM_ERROR_INVALID_LENGTH);
     // Clear the file table contents.
     table.clear();
 }
@@ -383,7 +383,7 @@
     // The length field is not a multiple of DMA minsize
     response = handler.writeFileFromMemory(request, requestPayloadLength);
     responsePtr = reinterpret_cast<pldm_msg*>(response.data());
-    ASSERT_EQ(responsePtr->payload[0], PLDM_INVALID_WRITE_LENGTH);
+    ASSERT_EQ(responsePtr->payload[0], PLDM_ERROR_INVALID_LENGTH);
 }
 
 TEST_F(TestFileTable, WriteFileInvalidFileHandle)
@@ -778,7 +778,7 @@
 
     resp = reinterpret_cast<struct pldm_read_write_file_by_type_memory_resp*>(
         responsePtr->payload);
-    ASSERT_EQ(PLDM_INVALID_WRITE_LENGTH, resp->completion_code);
+    ASSERT_EQ(PLDM_ERROR_INVALID_LENGTH, resp->completion_code);
 }
 
 TEST(getHandlerByType, allPaths)
@@ -845,7 +845,7 @@
     responsePtr = reinterpret_cast<pldm_msg*>(response.data());
     resp = reinterpret_cast<struct pldm_read_write_file_by_type_memory_resp*>(
         responsePtr->payload);
-    ASSERT_EQ(PLDM_INVALID_WRITE_LENGTH, resp->completion_code);
+    ASSERT_EQ(PLDM_ERROR_INVALID_LENGTH, resp->completion_code);
 
     request->length = 16;
     response = handler.readFileByTypeIntoMemory(