Ramesh Iyyar | b181d3b | 2019-10-17 13:39:10 -0500 | [diff] [blame] | 1 | extern "C" { |
| 2 | #include <libipl.h> |
| 3 | } |
| 4 | |
| 5 | #include "xyz/openbmc_project/Common/error.hpp" |
| 6 | |
| 7 | #include <phosphor-logging/elog-errors.hpp> |
| 8 | #include <phosphor-logging/log.hpp> |
| 9 | #include <registration.hpp> |
| 10 | namespace openpower |
| 11 | { |
| 12 | namespace phal |
| 13 | { |
| 14 | |
| 15 | using namespace phosphor::logging; |
| 16 | using namespace sdbusplus::xyz::openbmc_project::Common::Error; |
| 17 | |
| 18 | /** |
| 19 | * @brief Starts the self boot engine on POWER processor position 0 |
| 20 | * to kick off a boot. |
| 21 | * @return void |
| 22 | */ |
| 23 | void startHost() |
| 24 | { |
| 25 | if (ipl_init() != 0) |
| 26 | { |
| 27 | log<level::ERR>("ipl_init failed"); |
| 28 | // TODO ibm-openbmc#1470 |
| 29 | elog<InternalFailure>(); |
| 30 | } |
| 31 | |
| 32 | if (ipl_run_major(0) > 0) |
| 33 | { |
| 34 | log<level::ERR>("step 0 failed to start the host"); |
| 35 | // TODO ibm-openbmc#1470 |
| 36 | elog<InternalFailure>(); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | REGISTER_PROCEDURE("startHost", startHost); |
| 41 | |
| 42 | } // namespace phal |
| 43 | } // namespace openpower |