diff options
author | Vernon Mauery <vernon.mauery@linux.intel.com> | 2019-05-24 13:26:16 -0700 |
---|---|---|
committer | Vernon Mauery <vernon.mauery@linux.intel.com> | 2019-06-05 13:49:43 +0000 |
commit | ea1c401c4bac43d6070bf7d515df08f8bf57c0a2 (patch) | |
tree | 106c47db1d1849e0c5287421ffbe33cbd4d24232 /apphandler.cpp | |
parent | a3dd7661d18aeb47bbad271f40cc23efb5dea8b5 (diff) | |
download | phosphor-host-ipmid-ea1c401c4bac43d6070bf7d515df08f8bf57c0a2.tar.gz phosphor-host-ipmid-ea1c401c4bac43d6070bf7d515df08f8bf57c0a2.zip |
Modify Get Device ID to use Context::bus
Now that a bus pointer is available via the Context for every IPMI
command handler, make use of it for Get Device ID.
Tested-by: run Get Device ID and verify results:
ipmitool raw 6 1
23 00 00 00 02 bf 57 01 00 7b 00 00 00 00 00
Change-Id: I2ae5f59623767c7ae059340758a8d042acfb00e9
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
Diffstat (limited to 'apphandler.cpp')
-rw-r--r-- | apphandler.cpp | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/apphandler.cpp b/apphandler.cpp index ea40060..929e922 100644 --- a/apphandler.cpp +++ b/apphandler.cpp @@ -102,16 +102,14 @@ static constexpr int base_16 = 16; * @return On success returns the Version info from primary s/w object. * */ -std::string getActiveSoftwareVersionInfo() +std::string getActiveSoftwareVersionInfo(ipmi::Context::ptr ctx) { - auto busp = getSdBus(); - std::string revision{}; ipmi::ObjectTree objectTree; try { objectTree = - ipmi::getAllDbusObjects(*busp, softwareRoot, redundancyIntf); + ipmi::getAllDbusObjects(*ctx->bus, softwareRoot, redundancyIntf); } catch (sdbusplus::exception::SdBusError& e) { @@ -125,9 +123,9 @@ std::string getActiveSoftwareVersionInfo() for (auto& softObject : objectTree) { auto service = - ipmi::getService(*busp, redundancyIntf, softObject.first); + ipmi::getService(*ctx->bus, redundancyIntf, softObject.first); auto objValueTree = - ipmi::getManagedObjects(*busp, service, softwareRoot); + ipmi::getManagedObjects(*ctx->bus, service, softwareRoot); auto minPriority = 0xFF; for (const auto& objIter : objValueTree) @@ -569,16 +567,31 @@ int convertVersion(std::string s, Revision& rev) return 0; } -auto ipmiAppGetDeviceId() -> ipmi::RspType<uint8_t, // Device ID - uint8_t, // Device Revision - uint8_t, // Firmware Revision Major - uint8_t, // Firmware Revision minor - uint8_t, // IPMI version - uint8_t, // Additional device support - uint24_t, // MFG ID - uint16_t, // Product ID - uint32_t // AUX info - > +/* @brief: Implement the Get Device ID IPMI command per the IPMI spec + * @param[in] ctx - shared_ptr to an IPMI context struct + * + * @returns IPMI completion code plus response data + * - Device ID (manufacturer defined) + * - Device revision[4 bits]; reserved[3 bits]; SDR support[1 bit] + * - FW revision major[7 bits] (binary encoded); available[1 bit] + * - FW Revision minor (BCD encoded) + * - IPMI version (0x02 for IPMI 2.0) + * - device support (bitfield of supported options) + * - MFG IANA ID (3 bytes) + * - product ID (2 bytes) + * - AUX info (4 bytes) + */ +ipmi::RspType<uint8_t, // Device ID + uint8_t, // Device Revision + uint8_t, // Firmware Revision Major + uint8_t, // Firmware Revision minor + uint8_t, // IPMI version + uint8_t, // Additional device support + uint24_t, // MFG ID + uint16_t, // Product ID + uint32_t // AUX info + > + ipmiAppGetDeviceId(ipmi::Context::ptr ctx) { int r = -1; Revision rev = {0}; @@ -603,7 +616,7 @@ auto ipmiAppGetDeviceId() -> ipmi::RspType<uint8_t, // Device ID { try { - auto version = getActiveSoftwareVersionInfo(); + auto version = getActiveSoftwareVersionInfo(ctx); r = convertVersion(version, rev); } catch (const std::exception& e) |