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 | |
Andrew Geissler | 59c82d9 | 2020-05-16 15:20:26 -0500 | [diff] [blame] | 5 | #include <cstdint> |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 6 | #include <functional> |
Vishwanatha Subbanna | ac149a9 | 2017-07-11 18:16:50 +0530 | [diff] [blame] | 7 | #include <tuple> |
| 8 | |
| 9 | namespace phosphor |
| 10 | { |
| 11 | namespace host |
| 12 | { |
| 13 | namespace command |
| 14 | { |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 15 | /** @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 Subbanna | ac149a9 | 2017-07-11 18:16:50 +0530 | [diff] [blame] | 24 | |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 25 | /** @brief IPMI command */ |
| 26 | using IPMIcmd = uint8_t; |
Vishwanatha Subbanna | ac149a9 | 2017-07-11 18:16:50 +0530 | [diff] [blame] | 27 | |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 28 | /** @brief Data associated with command */ |
| 29 | using Data = uint8_t; |
Vishwanatha Subbanna | ac149a9 | 2017-07-11 18:16:50 +0530 | [diff] [blame] | 30 | |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 31 | /** @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 | */ |
| 34 | using IpmiCmdData = std::pair<IPMIcmd, Data>; |
Vishwanatha Subbanna | ac149a9 | 2017-07-11 18:16:50 +0530 | [diff] [blame] | 35 | |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 36 | /** @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 | */ |
| 40 | using CallBack = std::function<void(IpmiCmdData, bool)>; |
Vishwanatha Subbanna | ac149a9 | 2017-07-11 18:16:50 +0530 | [diff] [blame] | 41 | |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 42 | /** @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 | */ |
| 48 | using CommandHandler = std::tuple<IpmiCmdData, CallBack>; |
Vishwanatha Subbanna | ac149a9 | 2017-07-11 18:16:50 +0530 | [diff] [blame] | 49 | |
| 50 | } // namespace command |
| 51 | } // namespace host |
| 52 | } // namespace phosphor |