Add version support for AFM

This change adds AFM version support under FirmwareInventory.

Tested: D-Bus version objects are created and also it's shown
        up under FirmwareInventory.

root@intel-obmc:/tmp# busctl tree xyz.openbmc_project.PFR.Manager
└─/xyz
  └─/xyz/openbmc_project
    ├─/xyz/openbmc_project/pfr
    └─/xyz/openbmc_project/software
      ├─/xyz/openbmc_project/software/afm_active
      ├─/xyz/openbmc_project/software/afm_recovery
      ├─/xyz/openbmc_project/software/bios_recovery
      ├─/xyz/openbmc_project/software/bmc_recovery
      └─/xyz/openbmc_project/software/cpld_recovery

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

Signed-off-by: Vikram Bodireddy <vikram.bodireddy@linux.intel.com>
Change-Id: I4233803354d686a736a2614e9f205b294d39f8d6
diff --git a/libpfr/inc/pfr.hpp b/libpfr/inc/pfr.hpp
index c0d3c11..e327b69 100644
--- a/libpfr/inc/pfr.hpp
+++ b/libpfr/inc/pfr.hpp
@@ -27,7 +27,9 @@
     biosActive,
     biosRecovery,
     bmcActive,
-    bmcRecovery
+    bmcRecovery,
+    afmActive,
+    afmRecovery
 };
 
 enum class ActionType
diff --git a/libpfr/src/pfr.cpp b/libpfr/src/pfr.cpp
index 64476f4..856a39c 100644
--- a/libpfr/src/pfr.cpp
+++ b/libpfr/src/pfr.cpp
@@ -53,6 +53,10 @@
 static constexpr uint8_t pchRecoveryMinorVersion = 0x1C;
 static constexpr uint8_t CPLDHashRegStart = 0x20;
 static constexpr uint8_t pfrRoTValue = 0xDE;
+static constexpr uint8_t afmActiveMajorVersion = 0x75;
+static constexpr uint8_t afmActiveMinorVersion = 0x76;
+static constexpr uint8_t afmRecoveryMajorVersion = 0x78;
+static constexpr uint8_t afmRecoveryMinorVersion = 0x79;
 
 static constexpr uint8_t ufmLockedMask = (0x1 << 0x04);
 static constexpr uint8_t ufmProvisionedMask = (0x1 << 0x05);
@@ -366,6 +370,16 @@
         {
             return readBMCVersionFromSPI(imgType);
         }
+        case (ImageType::afmActive):
+        {
+            return readVersionFromCPLD(afmActiveMajorVersion,
+                                       afmActiveMinorVersion);
+        }
+        case (ImageType::afmRecovery):
+        {
+            return readVersionFromCPLD(afmRecoveryMajorVersion,
+                                       afmRecoveryMinorVersion);
+        }
         default:
             // Invalid image Type.
             return "";