Add FirmwareVersion For PowerSupply

This commit is to add firmware version information according to the
Redfish PowerSupply schema.
If the `xyz.openbmc_project.Software.Version` interface does not
exist, the firmware version information property is not displayed.

ref: http://redfish.dmtf.org/schemas/v1/PowerSupply.v1_5_0.json

Tested: Validator passes
curl -k -H "X-Auth-Token: $token" -X GET
https://${bmc}/redfish/v1/Chassis/chassis/PowerSubsystem/
PowerSupplies/powersupply0
{
"@odata.id": "/redfish/v1/Chassis/chassis/PowerSubsystem/
              PowerSupplies/powersupply0",
"@odata.type": "#PowerSupply.v1_5_0.PowerSupply",
"FirmwareVersion": "383239323732",
"Id": "powersupply0",
"Manufacturer": "",
"Model": "51E9",
"Name": "powersupply0",
"PartNumber": "03KP466",
"SerialNumber": "YL10KY26E073",
"SparePartNumber": "03FP378",
"Status": {
"Health": "OK"
}
}

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I3ced467faf49d08c46a8b9bb2aa722f35353c811
diff --git a/Redfish.md b/Redfish.md
index d74d3e9..dbbbfd1 100644
--- a/Redfish.md
+++ b/Redfish.md
@@ -379,6 +379,7 @@
 
 ##### PowerSupply
 
+- FirmwareVersion
 - Manufacturer
 - Model
 - PartNumber
diff --git a/redfish-core/lib/power_supply.hpp b/redfish-core/lib/power_supply.hpp
index aa88e09..4fc0ce9 100644
--- a/redfish-core/lib/power_supply.hpp
+++ b/redfish-core/lib/power_supply.hpp
@@ -310,6 +310,29 @@
         });
 }
 
+inline void getPowerSupplyFirmwareVersion(
+    const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+    const std::string& service, const std::string& path)
+{
+    sdbusplus::asio::getProperty<std::string>(
+        *crow::connections::systemBus, service, path,
+        "xyz.openbmc_project.Software.Version", "Version",
+        [asyncResp](const boost::system::error_code& ec,
+                    const std::string& value) {
+        if (ec)
+        {
+            if (ec.value() != EBADR)
+            {
+                BMCWEB_LOG_ERROR << "DBUS response error for FirmwareVersion "
+                                 << ec.value();
+                messages::internalError(asyncResp->res);
+            }
+            return;
+        }
+        asyncResp->res.jsonValue["FirmwareVersion"] = value;
+        });
+}
+
 inline void
     doPowerSupplyGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
                      const std::string& chassisId,
@@ -359,6 +382,8 @@
                                  powerSupplyPath);
             getPowerSupplyAsset(asyncResp, object.begin()->first,
                                 powerSupplyPath);
+            getPowerSupplyFirmwareVersion(asyncResp, object.begin()->first,
+                                          powerSupplyPath);
             });
     });
 }