Export the part number and serial number
This commit exposes the eMMC's part name and serial number over the
appropriate D-Bus interface, so that it can be exposed over Redfish in
bmcweb.
Tested:
$ busctl introspect xyz.openbmc_project.eStoraged \
/xyz/openbmc_project/inventory/storage/mmcblk0
...
xyz.openbmc_project.Inventory.Decorator.Asset interface - - -
.PartNumber property s "ABCDEF" emits-change
.SerialNumber property s "123456abcd" emits-change
...
$ wget -qO- http://localhost:80/redfish/v1/Chassis/DC_SCM/Drives/mmcblk0
{
"@odata.id": "/redfish/v1/Chassis/DC_SCM/Drives/mmcblk0",
"@odata.type": "#Drive.v1_7_0.Drive",
"CapacityBytes": 15634268160,
"Id": "mmcblk0",
"Links": {
"Chassis": {
"@odata.id": "/redfish/v1/Chassis/DC_SCM"
}
},
"Name": "Name",
"PartNumber": "ABCDEF",
"PhysicalLocation": {
"PartLocation": {
"LocationType": "Embedded"
}
},
"SerialNumber": "123456abcd",
"Status": {
"State": "Enabled"
}
}
Signed-off-by: John Wedig <johnwedig@google.com>
Change-Id: I1d17f08b99907620b5f2c73fdaeacc84950ce64e
diff --git a/include/estoraged.hpp b/include/estoraged.hpp
index c7f0706..c938c33 100644
--- a/include/estoraged.hpp
+++ b/include/estoraged.hpp
@@ -41,6 +41,8 @@
* @param[in] luksName - name for the LUKS container
* @param[in] size - size of the drive in bytes
* @param[in] lifeTime - percent of lifetime remaining for a drive
+ * @param[in] partNumber - part number for the storage device
+ * @param[in] serialNumber - serial number for the storage device
* @param[in] cryptInterface - (optional) pointer to CryptsetupInterface
* object
* @param[in] fsInterface - (optional) pointer to FilesystemInterface
@@ -49,6 +51,7 @@
EStoraged(sdbusplus::asio::object_server& server,
const std::string& configPath, const std::string& devPath,
const std::string& luksName, uint64_t size, uint8_t lifeTime,
+ const std::string& partNumber, const std::string& serialNumber,
std::unique_ptr<CryptsetupInterface> cryptInterface =
std::make_unique<Cryptsetup>(),
std::unique_ptr<FilesystemInterface> fsInterface =
@@ -135,6 +138,9 @@
/** @brief D-Bus interface for the location of the drive. */
std::shared_ptr<sdbusplus::asio::dbus_interface> embeddedLocationInterface;
+ /** @brief D-Bus interface for the asset information. */
+ std::shared_ptr<sdbusplus::asio::dbus_interface> assetInterface;
+
/** @brief Association between chassis and drive. */
std::shared_ptr<sdbusplus::asio::dbus_interface> association;