blob: 6646f03fe5679bdefae6fb7f9c098b31ce150444 [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
Andrew Geissler59c82d92020-05-16 15:20:26 -05005#include <cstdint>
Patrick Venture0b02be92018-08-31 11:55:55 -07006#include <functional>
Vishwanatha Subbannaac149a92017-07-11 18:16:50 +05307#include <tuple>
8
9namespace phosphor
10{
11namespace host
12{
13namespace command
14{
Patrick Venture0b02be92018-08-31 11:55:55 -070015/** @detail After sending SMS_ATN to the Host, Host comes down and
16 * asks why an 'SMS_ATN` was sent.
17 * BMC then sends 'There is a Message to be Read` as response.
18 * Host then comes down asks for Message and the specified
19 * commands and data would go as data conforming to IPMI spec.
20 *
21 * Refer: 6.13.2 Send Message Command From System Interface
22 * in IPMI V2.0 spec.
23 */
Vishwanatha Subbannaac149a92017-07-11 18:16:50 +053024
Patrick Venture0b02be92018-08-31 11:55:55 -070025/** @brief IPMI command */
26using IPMIcmd = uint8_t;
Vishwanatha Subbannaac149a92017-07-11 18:16:50 +053027
Patrick Venture0b02be92018-08-31 11:55:55 -070028/** @brief Data associated with command */
29using Data = uint8_t;
Vishwanatha Subbannaac149a92017-07-11 18:16:50 +053030
Patrick Venture0b02be92018-08-31 11:55:55 -070031/** @brief <IPMI command, Data> to be sent as payload when Host asks for
32 * the message that can be associated with the previous SMS_ATN
33 */
34using IpmiCmdData = std::pair<IPMIcmd, Data>;
Vishwanatha Subbannaac149a92017-07-11 18:16:50 +053035
Patrick Venture0b02be92018-08-31 11:55:55 -070036/** @detail Implementation specific callback function to be invoked
37 * conveying the status of the executed command. Specific
38 * implementations may then broadcast an agreed signal
39 */
40using CallBack = std::function<void(IpmiCmdData, bool)>;
Vishwanatha Subbannaac149a92017-07-11 18:16:50 +053041
Patrick Venture0b02be92018-08-31 11:55:55 -070042/** @detail Tuple encapsulating above 2 to enable using Manager by
43 * different implementations. Users of Manager will supply
44 * <Ipmi command, Data> along with the callback handler.
45 * Manager will invoke the handler onveying the status of
46 * the command.
47 */
48using CommandHandler = std::tuple<IpmiCmdData, CallBack>;
Vishwanatha Subbannaac149a92017-07-11 18:16:50 +053049
50} // namespace command
51} // namespace host
52} // namespace phosphor