pfr-manager: Add support to read and update CPLD version

Add support to
1. Read and update mainPLDversion and PLDversion from CPLD SGPIO lines.
2. Read and update SVN, RoT and CPLD hash when PFR CPLD is present.

CPLD version format:
When PFR CPLD is present:
MainPLDMajorMinor.PLDMajorMinor>-<SVN.RoT>-<CPLD-Hash>
 Example: 2.7-1.1-<Hash string>

When Non-PFR CPLD is present: <MainPLDMajorMinor.PLDMajorMinor>
 Example: 2.7

Tested:
1. When PFR-CPLD is present.
Command:
busctl introspect xyz.openbmc_project.PFR.Manager /xyz/openbmc_project/
software/cpld_active
Response:
NAME                                    TYPE      SIGNATURE RESULT/VALUE
org.freedesktop.DBus.Introspectable     interface -         -
.Introspect                             method    -         s
org.freedesktop.DBus.Peer               interface -         -
.GetMachineId                           method    -         s
.Ping                                   method    -         -
org.freedesktop.DBus.Properties         interface -         -
.Get                                    method    ss        v
.GetAll                                 method    s         a{sv}
.Set                                    method    ssv       -
.PropertiesChanged                      signal    sa{sv}as  -
xyz.openbmc_project.Software.Activation interface -         -
.Activation                             property  s
"xyz.openbmc_project.Software.Activat... emits-change
.RequestedActivation                    property  s
"xyz.openbmc_project.Software.Activat... emits-change
xyz.openbmc_project.Software.Version    interface -         -                                        -
.Purpose                                property  s
"xyz.openbmc_project.Software.Version... emits-change
.Version                                property  s
"0.8-1.0-e51876c89bec2ebae8f7ca75dfc339… emits-change writable

Command:
busctl call xyz.openbmc_project.PFR.Manager /xyz/openbmc_project/
software/cpld_active org.freedesktop.DBus.Properties Get ss xyz.
openbmc_project.Software.Version Version

Response: v s "0.8-1.0-e51876c89bec2ebae8f7ca75dfc339099e138d5f4f6b
               895a45671c5489d7ba52"

Command:
GET: https://<BMC_IP>/redfish/v1/UpdateService/FirmwareInventory/
     cpld_active
Response:
{
  "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/
               cpld_active",
  "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory",
  "Description": "Other image",
  "Id": "cpld_active",
  "Name": "Software Inventory",
  "Status": {
    "Health": "OK",
    "HealthRollup": "OK",
    "State": "Enabled"
  },
  "Updateable": true,
  "Version": "0.8-1.0-e51876c89bec2ebae8f7ca75dfc339099e138d5f4f6b
              895a45671c5489d7ba52"
}

2. when non-PFR CPLD is present.

Command:
busctl introspect xyz.openbmc_project.PFR.Manager /xyz/openbmc_project/
software/cpld_active
Response:
NAME                                    TYPE      SIGNATURE RESULT/VALUE
org.freedesktop.DBus.Introspectable     interface -         -
.Introspect                             method    -         s
org.freedesktop.DBus.Peer               interface -         -
.GetMachineId                           method    -         s
.Ping                                   method    -         -
org.freedesktop.DBus.Properties         interface -         -
.Get                                    method    ss        v
.GetAll                                 method    s         a{sv}
.Set                                    method    ssv       -
.PropertiesChanged                      signal    sa{sv}as  -
xyz.openbmc_project.Software.Activation interface -         -
.Activation                             property  s
"xyz.openbmc_project.Software.Activat... emits-change
.RequestedActivation                    property  s
"xyz.openbmc_project.Software.Activat... emits-change
xyz.openbmc_project.Software.Version    interface -         -                                        -
.Purpose                                property  s
"xyz.openbmc_project.Software.Version... emits-change
.Version                                property  s         "2.5"
emits-change writable

Command:
busctl call xyz.openbmc_project.PFR.Manager /xyz/openbmc_project/
software/cpld_active org.freedesktop.DBus.Properties Get ss xyz.
openbmc_project.Software.Version Version

Response: v s "2.5"

Command:
GET: https://<BMC_IP>/redfish/v1/UpdateService/FirmwareInventory/
     cpld_active
Response:
{
  "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/
               cpld_active",
  "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory",
  "Description": "Other image",
  "Id": "cpld_active",
  "Name": "Software Inventory",
  "Status": {
    "Health": "OK",
    "HealthRollup": "OK",
    "State": "Enabled"
  },
  "Updateable": true,
  "Version": "2.5"
}

Signed-off-by: Chalapathi Venkataramashetty <chalapathix.venkataramashetty@intel.com>
Change-Id: Ib674f650b8e02fcbf1ca64c0113a23963cd00536
3 files changed