| Andrew Geissler | dd2c6fd | 2017-03-16 15:53:20 -0500 | [diff] [blame] | 1 | #pragma once | 
|  | 2 |  | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 3 | #include <host-cmd-manager.hpp> | 
| Andrew Geissler | dd2c6fd | 2017-03-16 15:53:20 -0500 | [diff] [blame] | 4 | #include <sdbusplus/bus.hpp> | 
| Andrew Geissler | c7021b8 | 2021-04-28 15:22:35 -0500 | [diff] [blame] | 5 | #include <xyz/openbmc_project/Condition/HostFirmware/server.hpp> | 
| Andrew Geissler | dd2c6fd | 2017-03-16 15:53:20 -0500 | [diff] [blame] | 6 | #include <xyz/openbmc_project/Control/Host/server.hpp> | 
| Andrew Geissler | dd2c6fd | 2017-03-16 15:53:20 -0500 | [diff] [blame] | 7 | namespace phosphor | 
|  | 8 | { | 
|  | 9 | namespace host | 
|  | 10 | { | 
| Vishwanatha Subbanna | 3eb117a | 2017-07-12 16:13:49 +0530 | [diff] [blame] | 11 | namespace command | 
|  | 12 | { | 
| Andrew Geissler | 1286637 | 2017-03-21 22:58:28 -0500 | [diff] [blame] | 13 |  | 
| Andrew Geissler | dd2c6fd | 2017-03-16 15:53:20 -0500 | [diff] [blame] | 14 | /** @class Host | 
| Andrew Geissler | c7021b8 | 2021-04-28 15:22:35 -0500 | [diff] [blame] | 15 | *  @brief OpenBMC control and condition host interface implementation. | 
| Andrew Geissler | dd2c6fd | 2017-03-16 15:53:20 -0500 | [diff] [blame] | 16 | *  @details A concrete implementation for xyz.openbmc_project.Control.Host | 
| Andrew Geissler | c7021b8 | 2021-04-28 15:22:35 -0500 | [diff] [blame] | 17 | *  and xyz.openbmc_project.Condition.HostFirmware DBus API's. | 
| Andrew Geissler | dd2c6fd | 2017-03-16 15:53:20 -0500 | [diff] [blame] | 18 | */ | 
| Andrew Geissler | c7021b8 | 2021-04-28 15:22:35 -0500 | [diff] [blame] | 19 | class Host | 
|  | 20 | : public sdbusplus::server::object::object< | 
|  | 21 | sdbusplus::xyz::openbmc_project::Control::server::Host, | 
|  | 22 | sdbusplus::xyz::openbmc_project::Condition::server::HostFirmware> | 
| Andrew Geissler | dd2c6fd | 2017-03-16 15:53:20 -0500 | [diff] [blame] | 23 | { | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 24 | public: | 
| Andrew Geissler | c7021b8 | 2021-04-28 15:22:35 -0500 | [diff] [blame] | 25 | /** @brief Constructs Host Control and Condition Interfaces | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 26 | * | 
|  | 27 | *  @param[in] bus     - The Dbus bus object | 
|  | 28 | *  @param[in] objPath - The Dbus object path | 
|  | 29 | */ | 
|  | 30 | Host(sdbusplus::bus::bus& bus, const char* objPath) : | 
|  | 31 | sdbusplus::server::object::object< | 
| Andrew Geissler | c7021b8 | 2021-04-28 15:22:35 -0500 | [diff] [blame] | 32 | sdbusplus::xyz::openbmc_project::Control::server::Host, | 
|  | 33 | sdbusplus::xyz::openbmc_project::Condition::server::HostFirmware>( | 
|  | 34 | bus, objPath), | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 35 | bus(bus) | 
|  | 36 | { | 
|  | 37 | // Nothing to do | 
|  | 38 | } | 
| Andrew Geissler | 62817fa9 | 2017-03-20 14:20:49 -0500 | [diff] [blame] | 39 |  | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 40 | /** @brief Send input command to host | 
|  | 41 | *         Note that the command will be queued in a FIFO if | 
|  | 42 | *         other commands to the host have yet to be run | 
|  | 43 | * | 
|  | 44 | *  @param[in] command - Input command to execute | 
|  | 45 | */ | 
|  | 46 | void execute(Command command) override; | 
| Andrew Geissler | 1b9d4e5 | 2017-03-21 15:04:05 -0500 | [diff] [blame] | 47 |  | 
| Andrew Geissler | c7021b8 | 2021-04-28 15:22:35 -0500 | [diff] [blame] | 48 | /** @brief Override reads to CurrentFirmwareCondition */ | 
|  | 49 | FirmwareCondition currentFirmwareCondition() const override; | 
|  | 50 |  | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 51 | private: | 
|  | 52 | /** @brief sdbusplus DBus bus connection. */ | 
|  | 53 | sdbusplus::bus::bus& bus; | 
| Andrew Geissler | 1286637 | 2017-03-21 22:58:28 -0500 | [diff] [blame] | 54 |  | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 55 | /** @brief  Callback function to be invoked by command manager | 
|  | 56 | * | 
|  | 57 | *  @detail Conveys the status of the last Host bound command. | 
|  | 58 | *          Depending on the status,  a CommandComplete or | 
|  | 59 | *          CommandFailure signal would be sent | 
|  | 60 | * | 
|  | 61 | *  @param[in] cmd    - IPMI command and data sent to Host | 
|  | 62 | *  @param[in] status - Success or Failure | 
|  | 63 | */ | 
|  | 64 | void commandStatusHandler(IpmiCmdData cmd, bool status); | 
| Andrew Geissler | dd2c6fd | 2017-03-16 15:53:20 -0500 | [diff] [blame] | 65 | }; | 
|  | 66 |  | 
| Vishwanatha Subbanna | 3eb117a | 2017-07-12 16:13:49 +0530 | [diff] [blame] | 67 | } // namespace command | 
| Andrew Geissler | dd2c6fd | 2017-03-16 15:53:20 -0500 | [diff] [blame] | 68 | } // namespace host | 
|  | 69 | } // namespace phosphor |