oem-ibm: FFDC enhancement changes

Added fine tuned first failure data capture traces in the system
and resource dump related paths.

Signed-off-by: Jayashankar Padath <jayashankar.padath@in.ibm.com>
Change-Id: I484853eb1fa79e166daa87dd374966d94faa36f6
diff --git a/oem/ibm/libpldmresponder/file_io.cpp b/oem/ibm/libpldmresponder/file_io.cpp
index 4fee024..b347960 100644
--- a/oem/ibm/libpldmresponder/file_io.cpp
+++ b/oem/ibm/libpldmresponder/file_io.cpp
@@ -27,12 +27,10 @@
 
 namespace responder
 {
-
 namespace fs = std::filesystem;
 
 namespace dma
 {
-
 /** @struct AspeedXdmaOp
  *
  * Structure representing XDMA operation
@@ -70,7 +68,9 @@
     if (dmaFd < 0)
     {
         rc = -errno;
-        std::cerr << "Failed to open the XDMA device, RC=" << rc << "\n";
+        std::cerr << "transferHostDataToSocket: Failed to open the XDMA device,"
+                     " RC="
+                  << rc << "\n";
         return rc;
     }
 
@@ -82,7 +82,9 @@
     if (MAP_FAILED == vgaMem)
     {
         rc = -errno;
-        std::cerr << "Failed to mmap the XDMA device, RC=" << rc << "\n";
+        std::cerr << "transferHostDataToSocket: Failed to mmap the XDMA device,"
+                     " RC="
+                  << rc << "\n";
         return rc;
     }
 
@@ -97,8 +99,10 @@
     if (rc < 0)
     {
         rc = -errno;
-        std::cerr << "Failed to execute the DMA operation, RC=" << rc
-                  << " ADDRESS=" << address << " LENGTH=" << length << "\n";
+        std::cerr << "transferHostDataToSocket: Failed to execute the DMA "
+                     "operation, RC="
+                  << rc << " ADDRESS=" << address << " LENGTH=" << length
+                  << "\n";
         return rc;
     }
 
@@ -108,7 +112,9 @@
     {
         rc = -errno;
         close(fd);
-        std::cerr << "closing socket" << std::endl;
+        std::cerr << "transferHostDataToSocket: Closing socket as "
+                     "writeToUnixSocket faile with RC="
+                  << rc << std::endl;
         return rc;
     }
     return 0;
@@ -135,7 +141,8 @@
         else
         {
             std::cerr
-                << "Received interrupt during DMA transfer. Skipping Unmap"
+                << "transferDataHost: Received interrupt during DMA transfer."
+                   " Skipping Unmap."
                 << std::endl;
         }
     };
@@ -145,7 +152,8 @@
     if (dmaFd < 0)
     {
         rc = -errno;
-        std::cerr << "Failed to open the XDMA device, RC=" << rc << "\n";
+        std::cerr << "transferDataHost: Failed to open the XDMA device, RC="
+                  << rc << "\n";
         return rc;
     }
 
@@ -157,7 +165,8 @@
     if (MAP_FAILED == vgaMem)
     {
         rc = -errno;
-        std::cerr << "Failed to mmap the XDMA device, RC=" << rc << "\n";
+        std::cerr << "transferDataHost: Failed to mmap the XDMA device, RC="
+                  << rc << "\n";
         return rc;
     }
 
@@ -168,9 +177,9 @@
         rc = lseek(fd, offset, SEEK_SET);
         if (rc == -1)
         {
-            std::cerr << "lseek failed, ERROR=" << errno
-                      << ", UPSTREAM=" << upstream << ", OFFSET=" << offset
-                      << "\n";
+            std::cerr << "transferDataHost upstream: lseek failed, ERROR="
+                      << errno << ", UPSTREAM=" << upstream
+                      << ", OFFSET=" << offset << "\n";
             return rc;
         }
 
@@ -182,16 +191,16 @@
         rc = read(fd, buffer.data(), length);
         if (rc == -1)
         {
-            std::cerr << "file read failed, ERROR=" << errno
-                      << ", UPSTREAM=" << upstream << ", LENGTH=" << length
-                      << ", OFFSET=" << offset << "\n";
+            std::cerr << "transferDataHost upstream: file read failed, ERROR="
+                      << errno << ", UPSTREAM=" << upstream
+                      << ", LENGTH=" << length << ", OFFSET=" << offset << "\n";
             return rc;
         }
         if (rc != static_cast<int>(length))
         {
-            std::cerr << "mismatch between number of characters to read and "
-                      << "the length read, LENGTH=" << length << " COUNT=" << rc
-                      << "\n";
+            std::cerr << "transferDataHost upstream: mismatch between number of"
+                      << "characters to read and the length read, LENGTH="
+                      << length << " COUNT=" << rc << "\n";
             return -1;
         }
         memcpy(static_cast<char*>(vgaMemPtr.get()), buffer.data(),
@@ -207,8 +216,9 @@
     if (rc < 0)
     {
         rc = -errno;
-        std::cerr << "Failed to execute the DMA operation, RC=" << rc
-                  << " UPSTREAM=" << upstream << " ADDRESS=" << address
+        std::cerr << "transferDataHost: Failed to execute the DMA operation,"
+                     " RC="
+                  << rc << " UPSTREAM=" << upstream << " ADDRESS=" << address
                   << " LENGTH=" << length << "\n";
         return rc;
     }
@@ -218,17 +228,18 @@
         rc = lseek(fd, offset, SEEK_SET);
         if (rc == -1)
         {
-            std::cerr << "lseek failed, ERROR=" << errno
-                      << ", UPSTREAM=" << upstream << ", OFFSET=" << offset
-                      << "\n";
+            std::cerr << "transferDataHost downstream: lseek failed, ERROR="
+                      << errno << ", UPSTREAM=" << upstream
+                      << ", OFFSET=" << offset << "\n";
             return rc;
         }
         rc = write(fd, static_cast<const char*>(vgaMemPtr.get()), length);
         if (rc == -1)
         {
-            std::cerr << "file write failed, ERROR=" << errno
-                      << ", UPSTREAM=" << upstream << ", LENGTH=" << length
-                      << ", OFFSET=" << offset << "\n";
+            std::cerr << "transferDataHost downstream: file write failed,"
+                         " ERROR="
+                      << errno << ", UPSTREAM=" << upstream
+                      << ", LENGTH=" << length << ", OFFSET=" << offset << "\n";
             return rc;
         }
     }
@@ -240,7 +251,6 @@
 
 namespace oem_ibm
 {
-
 Response Handler::readFileIntoMemory(const pldm_msg* request,
                                      size_t payloadLength)
 {
diff --git a/oem/ibm/libpldmresponder/file_io_type_dump.cpp b/oem/ibm/libpldmresponder/file_io_type_dump.cpp
index 94821b4..87eaa22 100644
--- a/oem/ibm/libpldmresponder/file_io_type_dump.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_dump.cpp
@@ -73,7 +73,7 @@
 
     catch (const std::exception& e)
     {
-        std::cerr << "Error " << e.what()
+        std::cerr << "findDumpObjPath: Error " << e.what()
                   << "found with GetManagedObjects call in findDumpObjPath "
                   << "with objPath=" << DUMP_MANAGER_PATH
                   << " and intf=" << dumpEntryIntf << "\n";
@@ -142,8 +142,10 @@
     }
     catch (const std::exception& e)
     {
-        std::cerr << "failed to make a d-bus call to DUMP manager, ERROR="
-                  << e.what() << "\n";
+        std::cerr << "newFileAvailable: Error " << e.what()
+                  << "found while notifying new dump to dump manager "
+                  << "with objPath=" << notifyObjPath
+                  << " and intf=" << dumpInterface << "\n";
         return PLDM_ERROR;
     }
 
@@ -168,8 +170,10 @@
     }
     catch (const std::exception& e)
     {
-        std::cerr << "failed to make a d-bus call to DUMP manager, ERROR="
-                  << e.what() << "\n";
+        std::cerr << "getOffloadUri: Error " << e.what()
+                  << "found while fetching the dump offload URI "
+                  << "with objPath=" << path.c_str()
+                  << " and intf=" << socketInterface << "\n";
     }
 
     return socketInterface;
@@ -237,9 +241,11 @@
             }
             catch (const std::exception& e)
             {
-                std::cerr << "failed to make a d-bus call to DUMP "
-                             "manager, ERROR="
-                          << e.what() << "\n";
+                std::cerr << "fileAck: Error " << e.what()
+                          << "found while setting the dump progress status as "
+                          << "Failed with objPath=" << path.c_str()
+                          << " and intf=Common.Progress"
+                          << "\n";
             }
         }
 
@@ -271,7 +277,7 @@
             }
             catch (const std::exception& e)
             {
-                std::cerr << "Failed to make a d-bus call to DUMP "
+                std::cerr << "fileAck: Failed to make a d-bus call to DUMP "
                              "manager to reset source dump id of "
                           << path.c_str() << ", with ERROR=" << e.what()
                           << "\n";
@@ -291,7 +297,7 @@
             catch (const std::exception& e)
             {
                 std::cerr
-                    << "Failed to make a d-bus method to delete the dump entry "
+                    << "fileAck: Failed to make a d-bus method to delete the dump entry "
                     << path.c_str() << ", with ERROR=" << e.what() << "\n";
                 pldm::utils::reportError(
                     "xyz.openbmc_project.bmc.PLDM.fileAck.DumpEntryDeleteFail");
@@ -312,8 +318,9 @@
             catch (const std::exception& e)
             {
                 std::cerr
-                    << "failed to make a d-bus call to DUMP manager, ERROR="
-                    << e.what() << "\n";
+                    << "fileAck: Failed to make a d-bus method to set the dump "
+                    << "offloaded property to true with path=" << path.c_str()
+                    << "and with ERROR=" << e.what() << "\n";
             }
 
             auto socketInterface = getOffloadUri(fileHandle);
diff --git a/oem/ibm/libpldmresponder/utils.cpp b/oem/ibm/libpldmresponder/utils.cpp
index 44c6874..7b0bd09 100644
--- a/oem/ibm/libpldmresponder/utils.cpp
+++ b/oem/ibm/libpldmresponder/utils.cpp
@@ -15,7 +15,6 @@
 {
 namespace utils
 {
-
 int setupUnixSocket(const std::string& socketInterface)
 {
     int sock;
@@ -39,7 +38,8 @@
 
     if (bind(sock, (struct sockaddr*)&addr, sizeof(addr)) == -1)
     {
-        std::cerr << "setupUnixSocket: bind() call failed" << std::endl;
+        std::cerr << "setupUnixSocket: bind() call failed with errno " << errno
+                  << std::endl;
         close(sock);
         return -1;
     }