summaryrefslogtreecommitdiffstats
path: root/include/ipmid-host/cmd-utils.hpp
blob: e7c6dc2a3b9e91b11b1eb8702b014c6f1ec3f75b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once

#include <unistd.h>

#include <functional>
#include <tuple>

namespace phosphor
{
namespace host
{
namespace command
{
/** @detail After sending SMS_ATN to the Host, Host comes down and
 *          asks why an 'SMS_ATN` was sent.
 *          BMC then sends 'There is a Message to be Read` as response.
 *          Host then comes down asks for Message and the specified
 *          commands and data would go as data conforming to IPMI spec.
 *
 *          Refer: 6.13.2 Send Message Command From System Interface
 *          in IPMI V2.0 spec.
 */

/** @brief IPMI command */
using IPMIcmd = uint8_t;

/** @brief Data associated with command */
using Data = uint8_t;

/** @brief <IPMI command, Data> to be sent as payload when Host asks for
 *          the message that can be associated with the previous SMS_ATN
 */
using IpmiCmdData = std::pair<IPMIcmd, Data>;

/** @detail Implementation specific callback function to be invoked
 *          conveying the status of the executed command. Specific
 *          implementations may then broadcast an agreed signal
 */
using CallBack = std::function<void(IpmiCmdData, bool)>;

/** @detail Tuple encapsulating above 2 to enable using Manager by
 *          different implementations. Users of Manager will supply
 *          <Ipmi command, Data> along with the callback handler.
 *          Manager will invoke the handler onveying the status of
 *          the command.
 */
using CommandHandler = std::tuple<IpmiCmdData, CallBack>;

} // namespace command
} // namespace host
} // namespace phosphor
OpenPOWER on IntegriCloud