blob: f2369a06d4dec7fddcb3528537ecf48ddee2fed6 [file] [log] [blame]
Tom Josephbe5eaa12017-07-12 19:54:44 +05301#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.
9enum ipmi_netfn_sen_cmds
10{
11 // Get capability bits
12 IPMI_CMD_DCMI_GET_POWER = 0x03,
Tom Joseph6f6dd4d2017-07-12 20:07:11 +053013 IPMI_CMD_DCMI_GET_ASSET_TAG = 0x06,
Tom Josephbe5eaa12017-07-12 19:54:44 +053014};
15
16namespace dcmi
17{
18
19static constexpr auto propIntf = "org.freedesktop.DBus.Properties";
20static constexpr auto assetTagIntf =
21 "xyz.openbmc_project.Inventory.Decorator.AssetTag";
22static constexpr auto assetTagProp = "AssetTag";
23
24namespace 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 Joseph6f6dd4d2017-07-12 20:07:11 +053034static constexpr auto groupExtId = 0xDC;
35
36static constexpr auto assetTagMaxOffset = 62;
37static constexpr auto assetTagMaxSize = 63;
38static constexpr auto maxBytes = 16;
39
40/** @struct GetAssetTagRequest
41 *
42 * DCMI payload for Get Asset Tag command request.
43 */
44struct 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 */
55struct GetAssetTagResponse
56{
57 uint8_t groupID; //!< Group extension identification.
58 uint8_t tagLength; //!< Total asset tag length.
59} __attribute__((packed));
60
Tom Josephbe5eaa12017-07-12 19:54:44 +053061/** @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 */
69void 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 */
75std::string readAssetTag();
76
77} // namespace dcmi
78
79#endif