Skip to content

Commit

Permalink
Initialize FIRDATA section and ErrlManager just incase BMC resets
Browse files Browse the repository at this point in the history
PRD needs to read the PNOR to tell OCC where to write in the pnor.
This will cache the PNOR section so PRD will not fail the
read call. If an error is created with pnor inaccessible,
errl manager could get stuck unless it was initialized first.

Change-Id: Ia7212bf99e947a1016423b37aff6f13ddfc7190a
CQ:SW412798
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/54990
Reviewed-by: Martin Gloff <mgloff@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Reviewed-by: Roland Veloz <rveloz@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
CI-Ready: Daniel M. Crowell <dcrowell@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
mderkse1 authored and dcrowell77 committed Mar 7, 2018
1 parent 5ca1d49 commit 843b9e0
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 31 deletions.
13 changes: 13 additions & 0 deletions src/include/runtime/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,19 @@ struct postInitCalls_t
*/
void (*callApplyTempOverrides)();

/**
* @brief Calls RtPnor::init() which loads section(s) into memory
* so PRD can access when PNOR is not accessible
*/
void (*callInitPnor)();


/**
* @brief Sets up ErrlManager so it is ready for errors
*
*/
void (*callInitErrlManager)();

/**
* @brief Clear pending SBE messages
*
Expand Down
7 changes: 7 additions & 0 deletions src/runtime/rt_main.C
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ runtimeInterfaces_t* rt_start(hostInterfaces_t* intf)
postInitCalls_t* rtPost = getPostInitCalls();
rtPost->callApplyTempOverrides();

// load FIRDATA section into memory so PRD can access
// when PNOR is no longer accessible (ie SBE reboot)
rtPost->callInitPnor();

// Make sure errlmanager is ready
rtPost->callInitErrlManager();

// check for possible missed in-flight messages/interrupts
rtPost->callClearPendingSbeMsgs();

Expand Down
25 changes: 25 additions & 0 deletions src/usr/errl/runtime/rt_errlmanager.C
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ uint8_t ErrlManager::iv_hiddenErrLogsEnable =

extern trace_desc_t* g_trac_errl;



//////////////////////////////////////////////////////////////////////////////
// Local functions
//////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -380,3 +382,26 @@ bool rt_processCallout(errlHndl_t &io_errl,
}

} // End namespace


//------------------------------------------------------------------------
void initErrlManager(void)
{
// Note: rtPnor needs to be setup before this is called
// call errlManager ctor so that we're ready and waiting for errors.
ERRORLOG::theErrlManager::instance();
}


struct registerInitErrlManager
{
registerInitErrlManager()
{
// Register interface for Host to call
postInitCalls_t * rt_post = getPostInitCalls();
rt_post->callInitErrlManager = &initErrlManager;
}
};

registerInitErrlManager g_registerInitErrlManager;

95 changes: 64 additions & 31 deletions src/usr/pnor/runtime/rt_pnor.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2014,2017 */
/* Contributors Listed Below - COPYRIGHT 2014,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand All @@ -24,11 +24,12 @@
/* IBM_PROLOG_END_TAG */

#include <stdlib.h>
#include <stdio.h>
#include <targeting/common/targetservice.H>
#include <initservice/taskargs.H>

#include <runtime/rt_targeting.H>
#include <runtime/interface.h>
#include <runtime/interface.h> // g_hostInterfaces, postInitCalls_t

#include <pnor/pnorif.H>
#include <pnor/ecc.H>
Expand All @@ -47,11 +48,6 @@
// Trace definition
extern trace_desc_t* g_trac_pnor;

/**
* @brief set up _start() task entry procedure for PNOR daemon
*/
TASK_ENTRY_MACRO( RtPnor::init );

/**
* @brief Return the size and address of a given section of PNOR data
*/
Expand Down Expand Up @@ -116,26 +112,29 @@ uint64_t RtPnor::iv_masterProcId = RUNTIME::HBRT_HYP_ID_UNKNOWN;
*/
void RtPnor::init(errlHndl_t &io_taskRetErrl)
{
TRACFCOMP(g_trac_pnor, "RtPnor::init> " );
do {
io_taskRetErrl = Singleton<RtPnor>::instance().getMasterProcId();
if (io_taskRetErrl)
{
break;
}
io_taskRetErrl = Singleton<RtPnor>::instance().readTOC();
TRACFCOMP(g_trac_pnor, ENTER_MRK"RtPnor::init()");

PNOR::SectionInfo_t l_sectionInfo;

// Now find FIRDATA section for PRD
// PRD can't tell OCC where to put FIRDATA if it can't read PNOR
// unless we cache that info here first
// Note: Singleton<RtPnor>::instance() will force RtPnor constructor first
io_taskRetErrl = Singleton<RtPnor>::instance().getSectionInfo(
PNOR::FIRDATA, l_sectionInfo);
if (io_taskRetErrl)
{
break;
TRACFCOMP(g_trac_pnor, "Rtnor: failed to read FIRDATA section" );
}
}while (0);
TRACFCOMP(g_trac_pnor, "<RtPnor::init" );

TRACFCOMP(g_trac_pnor, EXIT_MRK"RtPnor::init()");
}

/**************************************************************/
errlHndl_t RtPnor::getSectionInfo(PNOR::SectionId i_section,
PNOR::SectionInfo_t& o_info)
{
TRACFCOMP(g_trac_pnor, ENTER_MRK"RtPnor::getSectionInfo");
TRACFCOMP(g_trac_pnor, ENTER_MRK"RtPnor::getSectionInfo %d", i_section);
errlHndl_t l_err = nullptr;
do
{
Expand Down Expand Up @@ -193,6 +192,7 @@ errlHndl_t RtPnor::getSectionInfo(PNOR::SectionId i_section,

//size of the section
uint64_t l_sizeBytes = iv_TOC[i_section].size;

if (l_sizeBytes == 0)
{
TRACFCOMP(g_trac_pnor,"RtPnor::getSectionInfo: Section %d"
Expand Down Expand Up @@ -263,7 +263,7 @@ errlHndl_t RtPnor::getSectionInfo(PNOR::SectionId i_section,
o_info.secure = iv_TOC[i_section].secure;
} while (0);

TRACFCOMP(g_trac_pnor, EXIT_MRK"RtPnor::getSectionInfo");
TRACFCOMP(g_trac_pnor, EXIT_MRK"RtPnor::getSectionInfo %d", i_section);
return l_err;
}

Expand Down Expand Up @@ -365,18 +365,18 @@ errlHndl_t RtPnor::flush( PNOR::SectionId i_section)
RtPnor::RtPnor()
{
do {
errlHndl_t l_err = getMasterProcId();
if (l_err)
{
errlCommit(l_err, PNOR_COMP_ID);
break;
}
l_err = readTOC();
if (l_err)
{
errlCommit(l_err, PNOR_COMP_ID);
errlHndl_t l_err = getMasterProcId();
if (l_err)
{
errlCommit(l_err, PNOR_COMP_ID);
break;
}
}
l_err = readTOC();
if (l_err)
{
errlCommit(l_err, PNOR_COMP_ID);
break;
}
} while (0);
}

Expand Down Expand Up @@ -689,6 +689,7 @@ errlHndl_t RtPnor::writeToDevice( uint64_t i_procId,
errlHndl_t RtPnor::readTOC ()
{
TRACFCOMP(g_trac_pnor, ENTER_MRK"RtPnor::readTOC" );

errlHndl_t l_err = nullptr;
uint8_t* l_toc0Buffer = new uint8_t[PNOR::TOC_SIZE];
do {
Expand Down Expand Up @@ -890,4 +891,36 @@ errlHndl_t RtPnor::getMasterProcId()
return l_err;
}

void initPnor()
{
TRACFCOMP(g_trac_pnor, ENTER_MRK"initPnor");
errlHndl_t l_errl = nullptr;

// call static init() function to save PNOR section into memory
RtPnor::init(l_errl);
if (l_errl)
{
TRACFCOMP(g_trac_pnor,ERR_MRK"initPnor: "
"Failed RtPnor::init() with EID %.8X:%.4X",
ERRL_GETEID_SAFE(l_errl),
ERRL_GETRC_SAFE(l_errl) );
errlCommit (l_errl, PNOR_COMP_ID);
}


TRACFCOMP(g_trac_pnor, EXIT_MRK"initPnor");
}

//------------------------------------------------------------------------

struct registerinitPnor
{
registerinitPnor()
{
// Register interface for Host to call
postInitCalls_t * rt_post = getPostInitCalls();
rt_post->callInitPnor = &initPnor;
}
};

registerinitPnor g_registerInitPnor;

0 comments on commit 843b9e0

Please sign in to comment.