Tom Joseph | be5eaa1 | 2017-07-12 19:54:44 +0530 | [diff] [blame] | 1 | #ifndef __HOST_IPMI_DCMI_HANDLER_H__ |
| 2 | #define __HOST_IPMI_DCMI_HANDLER_H__ |
| 3 | |
| 4 | #include <map> |
| 5 | #include <string> |
| 6 | #include <vector> |
| 7 | |
| 8 | // IPMI commands for net functions. |
| 9 | enum ipmi_netfn_sen_cmds |
| 10 | { |
| 11 | // Get capability bits |
| 12 | IPMI_CMD_DCMI_GET_POWER = 0x03, |
Tom Joseph | 6f6dd4d | 2017-07-12 20:07:11 +0530 | [diff] [blame^] | 13 | IPMI_CMD_DCMI_GET_ASSET_TAG = 0x06, |
Tom Joseph | be5eaa1 | 2017-07-12 19:54:44 +0530 | [diff] [blame] | 14 | }; |
| 15 | |
| 16 | namespace dcmi |
| 17 | { |
| 18 | |
| 19 | static constexpr auto propIntf = "org.freedesktop.DBus.Properties"; |
| 20 | static constexpr auto assetTagIntf = |
| 21 | "xyz.openbmc_project.Inventory.Decorator.AssetTag"; |
| 22 | static constexpr auto assetTagProp = "AssetTag"; |
| 23 | |
| 24 | namespace assettag |
| 25 | { |
| 26 | |
| 27 | using ObjectPath = std::string; |
| 28 | using Service = std::string; |
| 29 | using Interfaces = std::vector<std::string>; |
| 30 | using ObjectTree = std::map<ObjectPath, std::map<Service, Interfaces>>; |
| 31 | |
| 32 | } //namespace assettag |
| 33 | |
Tom Joseph | 6f6dd4d | 2017-07-12 20:07:11 +0530 | [diff] [blame^] | 34 | static constexpr auto groupExtId = 0xDC; |
| 35 | |
| 36 | static constexpr auto assetTagMaxOffset = 62; |
| 37 | static constexpr auto assetTagMaxSize = 63; |
| 38 | static constexpr auto maxBytes = 16; |
| 39 | |
| 40 | /** @struct GetAssetTagRequest |
| 41 | * |
| 42 | * DCMI payload for Get Asset Tag command request. |
| 43 | */ |
| 44 | struct GetAssetTagRequest |
| 45 | { |
| 46 | uint8_t groupID; //!< Group extension identification. |
| 47 | uint8_t offset; //!< Offset to read. |
| 48 | uint8_t bytes; //!< Number of bytes to read. |
| 49 | } __attribute__((packed)); |
| 50 | |
| 51 | /** @struct GetAssetTagResponse |
| 52 | * |
| 53 | * DCMI payload for Get Asset Tag command response. |
| 54 | */ |
| 55 | struct GetAssetTagResponse |
| 56 | { |
| 57 | uint8_t groupID; //!< Group extension identification. |
| 58 | uint8_t tagLength; //!< Total asset tag length. |
| 59 | } __attribute__((packed)); |
| 60 | |
Tom Joseph | be5eaa1 | 2017-07-12 19:54:44 +0530 | [diff] [blame] | 61 | /** @brief Read the object tree to fetch the object path that implemented the |
| 62 | * Asset tag interface. |
| 63 | * |
| 64 | * @param[in,out] objectTree - object tree |
| 65 | * |
| 66 | * @return On success return the object tree with the object path that |
| 67 | * implemented the AssetTag interface. |
| 68 | */ |
| 69 | void readAssetTagObjectTree(dcmi::assettag::ObjectTree& objectTree); |
| 70 | |
| 71 | /** @brief Read the asset tag of the server |
| 72 | * |
| 73 | * @return On success return the asset tag. |
| 74 | */ |
| 75 | std::string readAssetTag(); |
| 76 | |
| 77 | } // namespace dcmi |
| 78 | |
| 79 | #endif |