Update the PFR CPLD Version format

1. Removing the support of Main CPLD GPIO Lines as it was unused.
   The new format is  <RoTRev.RoTSVN>-<RoT HASH>
2. Updating the URI for cpld_active. The updated URI is -
   /redfish/v1/UpdateService/FirmwareInventory/rot_fw_active

Tested: Flashed the changes on the BMC.

Journal logs from BMC -
journalctl | grep pfr-manager
root@bmc-maca4bf018ceb52:~# journalctl | grep pfr-manager
Aug 10 12:08:23 bmc-maca4bf018ceb52 pfr-manager[535]: VERSION INFO - rot_fw_active - 3.0-0bbd19caa386faaa5802f21bc90ca557090413a788f9d098d5b346f08055c205
Aug 10 12:08:23 bmc-maca4bf018ceb52 pfr-manager[535]: VERSION INFO - bmc_recovery - 0.31-0-g1b1e1c
Aug 10 12:08:23 bmc-maca4bf018ceb52 pfr-manager[535]: VERSION INFO - rot_fw_recovery - 3.0
Aug 10 12:08:23 bmc-maca4bf018ceb52 pfr-manager[535]: Intel PFR service started successfully

Redfish Logs with the updated URi -

{
    "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/rot_fw_active",
    "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory",
    "Description": "Other image",
    "Id": "rot_fw_active",
    "Name": "Software Inventory",
    "Status": {
        "Health": "OK",
        "HealthRollup": "OK",
        "State": "Enabled"
    },
    "Updateable": false,
    "Version": "3.0-0bbd19caa386faaa5802f21bc90ca557090413a788f9d098d5b346f08055c205"
}

Change-Id: Iffde0324700b38ce01cd7fc3081c32000fbfc33a
Signed-off-by: Ankita Prasad <ankita.prasad@intel.com>
diff --git a/libpfr/src/pfr.cpp b/libpfr/src/pfr.cpp
index 0997d76..0a07f20 100644
--- a/libpfr/src/pfr.cpp
+++ b/libpfr/src/pfr.cpp
@@ -75,12 +75,6 @@
 static constexpr const uint32_t buildNumOffsetInPFM = 0x40C;
 static constexpr const uint32_t buildHashOffsetInPFM = 0x40D;
 
-static const std::array<std::string, 8> mainCPLDGpioLines = {
-    "MAIN_PLD_MAJOR_REV_BIT3", "MAIN_PLD_MAJOR_REV_BIT2",
-    "MAIN_PLD_MAJOR_REV_BIT1", "MAIN_PLD_MAJOR_REV_BIT0",
-    "MAIN_PLD_MINOR_REV_BIT3", "MAIN_PLD_MINOR_REV_BIT2",
-    "MAIN_PLD_MINOR_REV_BIT1", "MAIN_PLD_MINOR_REV_BIT0"};
-
 bool exceptionFlag = true;
 extern bool bmcBootCompleteChkPointDone;
 extern bool unProvChkPointStatus;
@@ -324,30 +318,8 @@
 
 std::string readCPLDVersion()
 {
-    // CPLD SGPIO lines
-    gpiod::line mainCPLDLine;
-    // read main pld version
-    uint8_t mainCPLDVer = 0;
-    // main CPLD
-    for (const auto& gLine : mainCPLDGpioLines)
-    {
-        uint8_t value = 0;
-        if (getGPIOInput(gLine, mainCPLDLine, &value))
-        {
-            mainCPLDVer <<= 1;
-            mainCPLDVer = mainCPLDVer | value;
-        }
-        else
-        {
-            phosphor::logging::log<phosphor::logging::level::ERR>(
-                "Failed to read GPIO line: ",
-                phosphor::logging::entry("MSG=%s", gLine.c_str()));
-            mainCPLDVer = 0;
-            break;
-        }
-    }
-
     std::string svnRoTHash = "";
+    std::string version = "unknown";
 
     // check if reg 0x00 read 0xde
     uint8_t cpldRoTValue = 0;
@@ -365,12 +337,12 @@
 
     if (cpldRoTValue == pfrRoTValue)
     {
-        // read SVN and RoT version
-        std::string svnRoTver = readVersionFromCPLD(cpldROTVersion, cpldROTSvn);
+        // read RoT Rev and RoT SVN
+        std::string rotRevSVN = readVersionFromCPLD(cpldROTVersion, cpldROTSvn);
 
         // read CPLD hash
         std::string cpldHash = readCPLDHash();
-        svnRoTHash = "-" + svnRoTver + "-" + cpldHash;
+        version = rotRevSVN + "-" + cpldHash;
     }
     else
     {
@@ -378,15 +350,11 @@
             "PFR-CPLD not present.");
     }
 
-    // CPLD version format:
+    // ROT FW Version format:
     // When PFR CPLD is present
-    // <MainPLDMajorMinor>-<SVN.RoT>-<CPLD-Hash>
-    // Example: 2-1.1-<Hash string>
+    // <RoTRev.RoTSVN>-<RoT HASH>
+    // Example: 3.0-<Hash string>
 
-    // When Non-PFR CPLD is present -> <MainPLDMajorMinor>
-    // Example: 2
-
-    std::string version = std::to_string(mainCPLDVer) + svnRoTHash;
     return version;
 }
 
diff --git a/service/src/mainapp.cpp b/service/src/mainapp.cpp
index ee21db1..fc3f75a 100644
--- a/service/src/mainapp.cpp
+++ b/service/src/mainapp.cpp
@@ -49,7 +49,7 @@
                         versionPurposeBMC),
         std::make_tuple("bios_recovery", ImageType::biosRecovery,
                         versionPurposeHost),
-        std::make_tuple("cpld_recovery", ImageType::cpldRecovery,
+        std::make_tuple("rot_fw_recovery", ImageType::cpldRecovery,
                         versionPurposeOther),
         std::make_tuple("afm_active", ImageType::afmActive,
                         versionPurposeOther),
@@ -570,19 +570,19 @@
 static void updateCPLDversion(std::shared_ptr<sdbusplus::asio::connection> conn)
 {
     std::string cpldVersion = pfr::readCPLDVersion();
-    lg2::info("VERSION INFO - cpld_active - {VER}", "VER", cpldVersion);
+    lg2::info("VERSION INFO - rot_fw_active - {VER}", "VER", cpldVersion);
     conn->async_method_call(
         [](const boost::system::error_code ec) {
         if (ec)
         {
             phosphor::logging::log<phosphor::logging::level::ERR>(
-                "Unable to update cpld_active version",
+                "Unable to update rot_fw_active version",
                 phosphor::logging::entry("MSG=%s", ec.message().c_str()));
             return;
         }
         },
         "xyz.openbmc_project.Settings",
-        "/xyz/openbmc_project/software/cpld_active",
+        "/xyz/openbmc_project/software/rot_fw_active",
         "org.freedesktop.DBus.Properties", "Set",
         "xyz.openbmc_project.Software.Version", "Version",
         std::variant<std::string>(cpldVersion));
@@ -665,7 +665,7 @@
 
             // Update the D-Bus properties.
             updateDbusPropertiesCache();
-            // Update CPLD Version to cpld_active object in settings.
+            // Update CPLD Version to rot_fw_active object in settings.
             updateCPLDversion(conn);
         }
         retrCount--;
@@ -686,7 +686,7 @@
 
     pfr::checkPFRandAddObjects(server, conn);
 
-    // Update CPLD Version to cpld_active object in settings.
+    // Update CPLD Version to rot_fw_active object in settings.
     pfr::updateCPLDversion(conn);
 
     server.add_manager("/xyz/openbmc_project/pfr");