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 | */ |
Patrick Williams | fbc6c9d | 2023-05-10 07:50:16 -0500 | [diff] [blame] | 19 | class Host : |
| 20 | public sdbusplus::server::object_t< |
Willy Tu | 523e2d1 | 2023-09-05 11:36:48 -0700 | [diff] [blame] | 21 | sdbusplus::server::xyz::openbmc_project::control::Host, |
| 22 | sdbusplus::server::xyz::openbmc_project::condition::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 | */ |
Patrick Williams | 5d82f47 | 2022-07-22 19:26:53 -0500 | [diff] [blame] | 30 | Host(sdbusplus::bus_t& bus, const char* objPath) : |
| 31 | sdbusplus::server::object_t< |
Willy Tu | 523e2d1 | 2023-09-05 11:36:48 -0700 | [diff] [blame] | 32 | sdbusplus::server::xyz::openbmc_project::control::Host, |
| 33 | sdbusplus::server::xyz::openbmc_project::condition::HostFirmware>( |
Andrew Geissler | c7021b8 | 2021-04-28 15:22:35 -0500 | [diff] [blame] | 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. */ |
Patrick Williams | 5d82f47 | 2022-07-22 19:26:53 -0500 | [diff] [blame] | 53 | sdbusplus::bus_t& 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 |