blob: c828309bce5704657bbcee981e37131110d350fc [file] [log] [blame]
Ramesh Iyyarb181d3b2019-10-17 13:39:10 -05001extern "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>
10namespace openpower
11{
12namespace phal
13{
14
15using namespace phosphor::logging;
16using 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 */
23void 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
40REGISTER_PROCEDURE("startHost", startHost);
41
42} // namespace phal
43} // namespace openpower