Lines Matching +full:host +full:- +full:command
4 #include "host-interface.hpp"
8 #include <ipmid-host/cmd-utils.hpp>
9 #include <ipmid-host/cmd.hpp>
12 #include <phosphor-logging/lg2.hpp>
20 namespace host namespace
22 namespace command namespace
28 // IPMI OEM command.
30 // Non-OEM commands that need to send SMS_ATN
33 // Map of IPMI OEM command to its equivalent interface command.
35 // the status of the executed command.
36 static const std::map<OEMCmd, Host::Command> intfCommand = {
37 {CMD_HEARTBEAT, Base::Host::Command::Heartbeat},
38 {CMD_POWER, Base::Host::Command::SoftOff}};
40 // Map of Interface command to its corresponding IPMI OEM command.
41 // This is needed when pushing IPMI commands to command manager's
44 static const std::map<Host::Command, IpmiCmdData> ipmiCommand = {
45 {Base::Host::Command::Heartbeat, std::make_pair(CMD_HEARTBEAT, 0x00)},
46 {Base::Host::Command::SoftOff, std::make_pair(CMD_POWER, SOFT_OFF)}};
49 void Host::execute(Base::Host::Command command) in execute() argument
51 lg2::debug("Pushing cmd on to queue, control host cmd: {CONTROL_HOST_CMD}", in execute()
52 "CONTROL_HOST_CMD", convertForMessage(command)); in execute()
55 ipmiCommand.at(command), in execute()
56 std::bind(&Host::commandStatusHandler, this, std::placeholders::_1, in execute()
62 // Called into by Command Manager
63 void Host::commandStatusHandler(IpmiCmdData cmd, bool status) in commandStatusHandler()
69 this->commandComplete(intfCommand.at(std::get<0>(cmd)), value); in commandStatusHandler()
72 Host::FirmwareCondition Host::currentFirmwareCondition() const in currentFirmwareCondition()
74 // shared object used to wait for host response in currentFirmwareCondition()
76 std::make_shared<std::optional<Host::FirmwareCondition>>(); in currentFirmwareCondition()
78 // callback for command to host in currentFirmwareCondition()
80 auto value = status ? Host::FirmwareCondition::Running in currentFirmwareCondition()
81 : Host::FirmwareCondition::Off; in currentFirmwareCondition()
84 "control host cmd: {CONTROL_HOST_CMD}", in currentFirmwareCondition()
91 auto cmd = phosphor::host::command::CommandHandler( in currentFirmwareCondition()
92 ipmiCommand.at(Base::Host::Command::Heartbeat), in currentFirmwareCondition()
100 *(hostCondition.get()) = Host::FirmwareCondition::Off; in currentFirmwareCondition()
109 while (!hostCondition.get()->has_value()) in currentFirmwareCondition()
111 lg2::debug("currentFirmwareCondition: waiting for host response"); in currentFirmwareCondition()
112 io->run_for(std::chrono::milliseconds(100)); in currentFirmwareCondition()
117 return hostCondition.get()->value(); in currentFirmwareCondition()
120 } // namespace command
121 } // namespace host