#include #include #include #include #include #include #include #include namespace open_power { namespace host { namespace command { // IPMI command // https://github.com/openbmc/openbmc/issues/2082 for handling // Non-OEM commands that need to send SMS_ATN using OEMCmd = uint8_t; // Map of IPMI OEM command to its equivalent interface command. // This is needed when invoking the callback handler to indicate // the status of the executed command. static const std::map intfCommand = { {IPMI_CMD_OCC_RESET, Base::Host::Command::OCCReset}}; // Called at user request void Host::execute(Base::Host::Command command, std::variant data) { using namespace phosphor::logging; log( "Pushing cmd on to queue", entry("CONTROL_HOST_CMD=%s", convertForMessage(command).c_str())); // If the command is OCCReset, then all we need is just sensor ID // This is the only command that is being used now. if (command == Base::Host::Command::OCCReset) { auto sensorID = std::get(data); auto cmd = std::make_tuple( std::make_pair(IPMI_CMD_OCC_RESET, sensorID), std::bind(&Host::commandStatusHandler, this, std::placeholders::_1, std::placeholders::_2)); return ipmid_send_cmd_to_host(std::move(cmd)); } return; } // Called into by Command Manager void Host::commandStatusHandler(IpmiCmdData cmd, bool status) { // Need to convert to the equivalent one mentioned in spec auto value = status ? Result::Success : Result::Failure; // Fire a signal this->commandComplete(intfCommand.at(std::get<0>(cmd)), value); } } // namespace command } // namespace host } // namespace open_power