Skip to content

Commit

Permalink
PHAL: refactor startHostNormal procedure
Browse files Browse the repository at this point in the history
selectBootSeeprom function not working correctly due to
order of calling this function in startHostNormal procedure path.
This function should be called after phal_init.

This refactor help to  fix the function invoking order in regular
ipl path. Also added PEL log for any Boot initialisation failure

Tested: verified regular and mpipl boot.

Signed-off-by: Jayanth Othayoth <[email protected]>
Change-Id: I9f6688dfdc6a3d69f4480127cf4b052cf0c99131
  • Loading branch information
Jayanth Othayoth committed Nov 2, 2021
1 parent ff27e39 commit ad3ff0f
Showing 1 changed file with 11 additions and 21 deletions.
32 changes: 11 additions & 21 deletions procedures/phal/start_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ extern "C"
#include "attributes_info.H"

#include "extensions/phal/common_utils.hpp"
#include "extensions/phal/create_pel.hpp"
#include "extensions/phal/phal_error.hpp"
#include "util.hpp"

Expand Down Expand Up @@ -178,20 +179,25 @@ void startHost(enum ipl_type iplType = IPL_TYPE_NORMAL)
{
phal_init();
ipl_set_type(iplType);
if (iplType == IPL_TYPE_NORMAL)
{
// Update SEEPROM side only for NORMAL boot
selectBootSeeprom();
}
setClkNETerminationSite();
}
catch (const std::exception& ex)
{
log<level::ERR>("Exception raised during init PHAL",
log<level::ERR>("Exception raised during ipl initialisation",
entry("EXCEPTION=%s", ex.what()));
openpower::pel::createPEL("org.open_power.PHAL.Error.Boot");
openpower::pel::detail::processBootError(false);
throw std::runtime_error("PHAL initialization failed");
throw std::runtime_error("IPL initialization failed");
}

// To clear trace if success
openpower::pel::detail::processBootError(true);

setClkNETerminationSite();

// callback method will be called upon failure which will create the PEL
int rc = ipl_run_major(0);
if (rc > 0)
Expand All @@ -217,23 +223,7 @@ void startHostMpReboot()
*/
void startHostNormal()
{
// Run select seeprom before poweron
try
{
selectBootSeeprom();

// To clear trace as it is success
openpower::pel::detail::processBootError(true);
}
catch (const std::exception& ex)
{
// create PEL in failure
openpower::pel::detail::processBootError(false);
log<level::ERR>("SEEPROM selection failed", entry("ERR=%s", ex.what()));
throw ex;
}

startHost();
startHost(IPL_TYPE_NORMAL);
}

REGISTER_PROCEDURE("startHost", startHostNormal)
Expand Down

0 comments on commit ad3ff0f

Please sign in to comment.