blob: e7c6dc2a3b9e91b11b1eb8702b014c6f1ec3f75b [file] [log] [blame]
Vishwanatha Subbannaac149a92017-07-11 18:16:50 +05301#pragma once
2
3#include <unistd.h>
Patrick Venture0b02be92018-08-31 11:55:55 -07004
5#include <functional>
Vishwanatha Subbannaac149a92017-07-11 18:16:50 +05306#include <tuple>
7
8namespace phosphor
9{
10namespace host
11{
12namespace command
13{
Patrick Venture0b02be92018-08-31 11:55:55 -070014/** @detail After sending SMS_ATN to the Host, Host comes down and
15 * asks why an 'SMS_ATN` was sent.
16 * BMC then sends 'There is a Message to be Read` as response.
17 * Host then comes down asks for Message and the specified
18 * commands and data would go as data conforming to IPMI spec.
19 *
20 * Refer: 6.13.2 Send Message Command From System Interface
21 * in IPMI V2.0 spec.
22 */
Vishwanatha Subbannaac149a92017-07-11 18:16:50 +053023
Patrick Venture0b02be92018-08-31 11:55:55 -070024/** @brief IPMI command */
25using IPMIcmd = uint8_t;
Vishwanatha Subbannaac149a92017-07-11 18:16:50 +053026
Patrick Venture0b02be92018-08-31 11:55:55 -070027/** @brief Data associated with command */
28using Data = uint8_t;
Vishwanatha Subbannaac149a92017-07-11 18:16:50 +053029
Patrick Venture0b02be92018-08-31 11:55:55 -070030/** @brief <IPMI command, Data> to be sent as payload when Host asks for
31 * the message that can be associated with the previous SMS_ATN
32 */
33using IpmiCmdData = std::pair<IPMIcmd, Data>;
Vishwanatha Subbannaac149a92017-07-11 18:16:50 +053034
Patrick Venture0b02be92018-08-31 11:55:55 -070035/** @detail Implementation specific callback function to be invoked
36 * conveying the status of the executed command. Specific
37 * implementations may then broadcast an agreed signal
38 */
39using CallBack = std::function<void(IpmiCmdData, bool)>;
Vishwanatha Subbannaac149a92017-07-11 18:16:50 +053040
Patrick Venture0b02be92018-08-31 11:55:55 -070041/** @detail Tuple encapsulating above 2 to enable using Manager by
42 * different implementations. Users of Manager will supply
43 * <Ipmi command, Data> along with the callback handler.
44 * Manager will invoke the handler onveying the status of
45 * the command.
46 */
47using CommandHandler = std::tuple<IpmiCmdData, CallBack>;
Vishwanatha Subbannaac149a92017-07-11 18:16:50 +053048
49} // namespace command
50} // namespace host
51} // namespace phosphor