From b181d3bb878f986598751ddb1875577b7ba65a39 Mon Sep 17 00:00:00 2001 From: Ramesh Iyyar Date: Thu, 17 Oct 2019 13:39:10 -0500 Subject: [PATCH] Enabled pHAL infrastructure to boot the host IPL (libipl) used for executing hardware procedures to initilize the power processor based host. Tested by: 1. ./configure 2. ./configure --enable-phal --enable-openfsi Change-Id: I57ff64595a757041ee60ccb420092975b064462d Signed-off-by: Ramesh Iyyar --- README.md | 5 ++++ configure.ac | 22 +++++++++++++++++ proc_control.cpp | 6 +++++ procedures/phal/start_host.cpp | 43 ++++++++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 procedures/phal/start_host.cpp diff --git a/README.md b/README.md index 48b29e29..19143a89 100644 --- a/README.md +++ b/README.md @@ -8,5 +8,10 @@ To build this package, do the following steps: 2. ./configure ${CONFIGURE_FLAGS} 3. make +To build with phal feature: + 1. ./bootstrap.sh + 2. ./configure ${CONFIGURE_FLAGS} --enable-phal --enable-openfsi + 3. make + To clean the repository run `./bootstrap.sh clean`. ``` diff --git a/configure.ac b/configure.ac index 7ee59d69..3b5f3c87 100644 --- a/configure.ac +++ b/configure.ac @@ -46,6 +46,28 @@ AS_IF([test "$enable_p9" == "yes"], [CHIPS+=" p9"]) AC_ARG_ENABLE([openfsi], AS_HELP_STRING([--enable-openfsi], [Support Openfsi])) AS_IF([test "$enable_openfsi" == "yes"], [CHIPS+=" openfsi"]) +AC_ARG_ENABLE([phal], AS_HELP_STRING([--enable-phal], [Use host processor initialisation procedures from PHAL])]) + +AS_IF([ test "$enable_phal" == "yes" && test "$enable_p9" == "yes"], + [ AC_MSG_ERROR([Internal POWER9 and PHAL-provided procedures conflict, please configure only one])] + ) + +AS_IF([test "$enable_phal" == "yes"], + [ + AX_ABSOLUTE_HEADER([libipl.h]) + if test x"$gl_cv_absolute_libipl_h" == "x" ; then + AC_MSG_ERROR([Cannot find libipl.h path]) + fi + + AC_CHECK_LIB([ipl], [ipl_init]) + if test x"$ac_cv_lib_ipl_ipl_init" != "xyes" ; then + AC_MSG_ERROR([IPL library not found]) + fi + + CHIPS+=" phal" + ] + ) + AS_IF([test "x$CHIPS" == "x"], [CHIPS="p9 openfsi"]) AC_CONFIG_FILES([Makefile.generated], diff --git a/proc_control.cpp b/proc_control.cpp index 0035b4f2..1afdacef 100644 --- a/proc_control.cpp +++ b/proc_control.cpp @@ -104,6 +104,12 @@ int main(int argc, char** argv) commit(); return -1; } + // TODO ibm-openbmc#1470 + catch (common_error::InternalFailure& e) + { + commit(); + return -1; + } return 0; } diff --git a/procedures/phal/start_host.cpp b/procedures/phal/start_host.cpp new file mode 100644 index 00000000..c828309b --- /dev/null +++ b/procedures/phal/start_host.cpp @@ -0,0 +1,43 @@ +extern "C" { +#include +} + +#include "xyz/openbmc_project/Common/error.hpp" + +#include +#include +#include +namespace openpower +{ +namespace phal +{ + +using namespace phosphor::logging; +using namespace sdbusplus::xyz::openbmc_project::Common::Error; + +/** + * @brief Starts the self boot engine on POWER processor position 0 + * to kick off a boot. + * @return void + */ +void startHost() +{ + if (ipl_init() != 0) + { + log("ipl_init failed"); + // TODO ibm-openbmc#1470 + elog(); + } + + if (ipl_run_major(0) > 0) + { + log("step 0 failed to start the host"); + // TODO ibm-openbmc#1470 + elog(); + } +} + +REGISTER_PROCEDURE("startHost", startHost); + +} // namespace phal +} // namespace openpower