summaryrefslogtreecommitdiffstats
path: root/src/usr/pnor
diff options
context:
space:
mode:
authorMatt Derksen <mderkse1@us.ibm.com>2018-02-26 09:16:08 -0600
committerDaniel M. Crowell <dcrowell@us.ibm.com>2018-03-07 12:54:24 -0500
commit843b9e02e55dbb39a2573e83efac9f412d30469a (patch)
tree41d09dd0c1b9ab39fef706feb0f862025d1af1a4 /src/usr/pnor
parent5ca1d497141ad56ed8510d621b1e522c1c9fe7dd (diff)
downloadtalos-hostboot-843b9e02e55dbb39a2573e83efac9f412d30469a.tar.gz
talos-hostboot-843b9e02e55dbb39a2573e83efac9f412d30469a.zip
Initialize FIRDATA section and ErrlManager just incase BMC resets
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>
Diffstat (limited to 'src/usr/pnor')
-rw-r--r--src/usr/pnor/runtime/rt_pnor.C95
1 files changed, 64 insertions, 31 deletions
diff --git a/src/usr/pnor/runtime/rt_pnor.C b/src/usr/pnor/runtime/rt_pnor.C
index 276691003..47accc8d0 100644
--- a/src/usr/pnor/runtime/rt_pnor.C
+++ b/src/usr/pnor/runtime/rt_pnor.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2014,2017 */
+/* Contributors Listed Below - COPYRIGHT 2014,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -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>
@@ -48,11 +49,6 @@
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
*/
errlHndl_t PNOR::getSectionInfo( PNOR::SectionId i_section,
@@ -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
{
@@ -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"
@@ -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;
}
@@ -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);
}
@@ -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 {
@@ -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;
OpenPOWER on IntegriCloud