Vishwanatha Subbanna | ac149a9 | 2017-07-11 18:16:50 +0530 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <unistd.h> |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 4 | |
| 5 | #include <functional> |
Vishwanatha Subbanna | ac149a9 | 2017-07-11 18:16:50 +0530 | [diff] [blame] | 6 | #include <tuple> |
| 7 | |
| 8 | namespace phosphor |
| 9 | { |
| 10 | namespace host |
| 11 | { |
| 12 | namespace command |
| 13 | { |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 14 | /** @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 Subbanna | ac149a9 | 2017-07-11 18:16:50 +0530 | [diff] [blame] | 23 | |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 24 | /** @brief IPMI command */ |
| 25 | using IPMIcmd = uint8_t; |
Vishwanatha Subbanna | ac149a9 | 2017-07-11 18:16:50 +0530 | [diff] [blame] | 26 | |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 27 | /** @brief Data associated with command */ |
| 28 | using Data = uint8_t; |
Vishwanatha Subbanna | ac149a9 | 2017-07-11 18:16:50 +0530 | [diff] [blame] | 29 | |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 30 | /** @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 | */ |
| 33 | using IpmiCmdData = std::pair<IPMIcmd, Data>; |
Vishwanatha Subbanna | ac149a9 | 2017-07-11 18:16:50 +0530 | [diff] [blame] | 34 | |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 35 | /** @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 | */ |
| 39 | using CallBack = std::function<void(IpmiCmdData, bool)>; |
Vishwanatha Subbanna | ac149a9 | 2017-07-11 18:16:50 +0530 | [diff] [blame] | 40 | |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 41 | /** @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 | */ |
| 47 | using CommandHandler = std::tuple<IpmiCmdData, CallBack>; |
Vishwanatha Subbanna | ac149a9 | 2017-07-11 18:16:50 +0530 | [diff] [blame] | 48 | |
| 49 | } // namespace command |
| 50 | } // namespace host |
| 51 | } // namespace phosphor |