Skip to content

Commit

Permalink
Generate error when pnor is not accessed via ipmi
Browse files Browse the repository at this point in the history
Conflicts:
    src/include/usr/isteps/istep_reasoncodes.H
    src/usr/isteps/istep06/host_set_ipl_parms.C

Change-Id: Ia44001c45dbe5a0f4f51202136d2649bb365d73f
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/69585
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/70465
  • Loading branch information
cvswen authored and dcrowell77 committed Jan 16, 2019
1 parent fbb9bf7 commit d2c0cb9
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/include/usr/isteps/istep_reasoncodes.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2015,2018 */
/* Contributors Listed Below - COPYRIGHT 2015,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -118,6 +118,7 @@ namespace ISTEP
RC_FAILED_TO_BOOT_SBE = ISTEP_COMP_ID | 0x38,
RC_REDISCOVERED_TARGETS = ISTEP_COMP_ID | 0x39,
RC_P9N_LESS_THAN_DD22_NOT_SUPPORTED = ISTEP_COMP_ID | 0x3A,
RC_PNOR_IPMI_NOT_ENABLED = ISTEP_COMP_ID | 0x3B,
};

};
Expand Down
17 changes: 16 additions & 1 deletion src/include/usr/pnor/pnorif.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2011,2018 */
/* Contributors Listed Below - COPYRIGHT 2011,2019 */
/* [+] Google Inc. */
/* [+] International Business Machines Corp. */
/* */
Expand Down Expand Up @@ -60,6 +60,14 @@ struct PnorInfo_t
uint32_t flashSize; //< Size of PNOR in bytes
};

/** PNOR access mode */
enum hiomapMode
{
PNOR_IPMI,
PNOR_MBOX,
PNOR_UNKNOWN
};

/**
* @brief Returns information about a given side of pnor
*
Expand Down Expand Up @@ -184,6 +192,13 @@ errlHndl_t validateAltMaster( void );
*/
void getPnorInfo( PnorInfo_t& o_pnorInfo );

/**
* @brief Get HIOMAP PNOR access mode
*
* @return hiomapMode Pnor access mode (ipmi/mbox)
*/
hiomapMode getPnorAccessMode( void );


/**
* @brief Check if PNOR section appears to be secure and sets the
Expand Down
63 changes: 62 additions & 1 deletion src/usr/isteps/istep06/host_set_ipl_parms.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2015,2018 */
/* Contributors Listed Below - COPYRIGHT 2015,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -38,6 +38,10 @@

using namespace TARGETING;

#if (defined(CONFIG_PNORDD_IS_BMCMBOX) || defined(CONFIG_PNORDD_IS_IPMI))
#include <pnor/pnorif.H>
#endif

namespace ISTEP_06
{

Expand Down Expand Up @@ -190,6 +194,63 @@ void* host_set_ipl_parms( void *io_pArgs )
}


#if (defined(CONFIG_PNORDD_IS_BMCMBOX) || defined(CONFIG_PNORDD_IS_IPMI))
// Add a check to indicate the BMC does not support HIOMAP pnor-ipmi access
// and the BMC firmware should be updated
PNOR::hiomapMode l_mode = PNOR::getPnorAccessMode();
if( l_mode != PNOR::PNOR_IPMI )
{
#ifdef CONFIG_CONSOLE
CONSOLE::displayf(ISTEP_COMP_NAME,
"HIOMAP PNOR-IPMI not enabled, BMC firmware needs to be updated.");
#endif

TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"HIOMAP PNOR-IPMI not enabled, BMC firmware needs to be updated.");

#ifdef CONFIG_PNORDD_IS_BMCMBOX
bool l_IS_BMCMBOX = true;
#else
bool l_IS_BMCMBOX = false;
#endif

#ifdef CONFIG_PNORDD_IS_IPMI
bool l_IS_IPMI = true;
#else
bool l_IS_IPMI = false;
#endif

/*@
* @errortype
* @moduleid ISTEP::MOD_SET_IPL_PARMS
* @reasoncode ISTEP::RC_PNOR_IPMI_NOT_ENABLED
* @userdata1 HIOMAP Mode
* @userdata2[0-31] CONFIG_PNORDD_IS_BMCMBOX
* @userdata2[32:63] CONFIG_PNORDD_IS_IPMI
* @devdesc PNOR-IPMI not enabled, BMC firmware needs to be updated
* @custdesc PNOR-IPMI not enabled, BMC firmware needs to be updated
*/
l_err = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_PREDICTIVE,
ISTEP::MOD_SET_IPL_PARMS,
ISTEP::RC_PNOR_IPMI_NOT_ENABLED,
l_mode,
TWO_UINT32_TO_UINT64(
l_IS_BMCMBOX,
l_IS_IPMI));

l_err->addProcedureCallout(HWAS::EPUB_PRC_SP_CODE,
HWAS::SRCI_PRIORITY_HIGH);

l_err->collectTrace(PNOR_COMP_NAME);
l_err->collectTrace("ISTEPS_TRACE",256);

// Create IStep error log and cross ref error that occurred
l_stepError.addErrorDetails( l_err );
errlCommit( l_err, ISTEP_COMP_ID );
}
#endif

TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "host_set_ipl_parms exit" );

return l_stepError.getErrorHandle();
Expand Down
23 changes: 20 additions & 3 deletions src/usr/pnor/pnor_hiomapdd.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2011,2018 */
/* Contributors Listed Below - COPYRIGHT 2011,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -182,6 +182,14 @@ void getPnorInfo( PnorInfo_t& o_pnorInfo )
Singleton<PnorHiomapDD>::instance().getNorSize();
}

/**
* @brief Get HIOMAP PNOR access mode
*/
PNOR::hiomapMode getPnorAccessMode(void)
{
return Singleton<PnorHiomapDD>::instance().getAccessMode();
}

// Register access functions to DD framework
DEVICE_REGISTER_ROUTE(DeviceFW::READ,
DeviceFW::PNOR,
Expand Down Expand Up @@ -219,18 +227,26 @@ uint32_t PnorHiomapDD::getNorWorkarounds(void)
return iv_pnor->getNorWorkarounds();
}

static PnorIf* probeHiomapTransport(TARGETING::Target* i_target)
PNOR::hiomapMode PnorHiomapDD::getAccessMode(void)
{
return iv_mode;
}

static PnorIf* probeHiomapTransport(TARGETING::Target* i_target,
PNOR::hiomapMode& io_mode)
{
PnorIf* pnor;

do {
if ((pnor = PnorIpmiDD::probe(i_target)))
{
io_mode = PNOR::PNOR_IPMI;
break;
}

if ((pnor = PnorMboxDD::probe(i_target)))
{
io_mode = PNOR::PNOR_MBOX;
break;
}
} while (0);
Expand All @@ -251,8 +267,9 @@ static PnorIf* probeHiomapTransport(TARGETING::Target* i_target)
}

PnorHiomapDD::PnorHiomapDD(TARGETING::Target* i_target)
:iv_mode(PNOR::PNOR_UNKNOWN)
{
iv_pnor = probeHiomapTransport(i_target);
iv_pnor = probeHiomapTransport(i_target, iv_mode);
}

PnorHiomapDD::~PnorHiomapDD()
Expand Down
5 changes: 4 additions & 1 deletion src/usr/pnor/pnor_hiomapdd.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2018 */
/* Contributors Listed Below - COPYRIGHT 2018,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -49,6 +49,8 @@ class PnorHiomapDD : public PnorIf
PnorHiomapDD(TARGETING::Target* i_target = NULL);
~PnorHiomapDD();

PNOR::hiomapMode getAccessMode(void);

virtual errlHndl_t readFlash(void* o_buffer,
size_t& io_buflen,
uint64_t i_address);
Expand All @@ -63,6 +65,7 @@ class PnorHiomapDD : public PnorIf

private:
PnorIf* iv_pnor;
PNOR::hiomapMode iv_mode;
};

#endif

0 comments on commit d2c0cb9

Please sign in to comment.