Skip to content

Commit

Permalink
Support ring overrides for HCODE image
Browse files Browse the repository at this point in the history
Allows data from the RINGOVD partition of PNOR to be applied
to the HCODE/STOP image that is generated during boot and
at runtime.

Change-Id: I66665bb89af020fc1a249d89f42d541a06383309
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/35128
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Reviewed-by: Corey V. Swenson <cswenson@us.ibm.com>
Reviewed-by: Martin Gloff <mgloff@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
dcrowell77 committed Jan 25, 2017
1 parent 9fe6f88 commit 2ed8b10
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 9 deletions.
12 changes: 11 additions & 1 deletion src/include/usr/isteps/pm/pm_common_ext.H
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016 */
/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -78,6 +78,16 @@ namespace HBPM
*/
errlHndl_t resetPMAll();

/**
* @brief Fetch the ring overrides (if they exist)
*
* @param[inout] io_overrideImg NULL if image not in PNOR or is blank,
* else pointer to override data
*
* @return errlHndl_t Error log if resetPMAll failed
*/
errlHndl_t getRingOvd(void*& io_overrideImg);

} //namespace HBPM ends

#endif
8 changes: 7 additions & 1 deletion src/include/usr/secureboot/service.H
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2013,2016 */
/* Contributors Listed Below - COPYRIGHT 2013,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand All @@ -26,6 +26,7 @@
#define __SECUREBOOT_SERVICE_H

#include <errl/errlentry.H>
#include <config.h>

typedef uint8_t SHA512_t[64];
/* From sha512.h: */
Expand Down Expand Up @@ -74,7 +75,12 @@ namespace SECUREBOOT

/** @brief Determines if Secureboot is enabled.
*/
#if defined(CONFIG_SECUREBOOT) && !defined(__HOSTBOOT_RUNTIME)
bool enabled();
#else
inline bool enabled() { return false; };
#endif
//@fixme-RTC:163094-Remove RUNTIME check once the code is there

/** @brief Returns the state of the secure jumper as reported by the master
* processor.
Expand Down
27 changes: 21 additions & 6 deletions src/usr/isteps/istep15/host_build_stop_image.C
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016 */
/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand All @@ -30,6 +30,7 @@
#include <sys/mm.h>
#include <usr/vmmconst.h>
#include <arch/pirformat.H>
#include <isteps/pm/pm_common_ext.H>

//Error handling and tracing
#include <errl/errlentry.H>
Expand All @@ -54,6 +55,8 @@
#include <p9_stop_api.H>
#include <p9_xip_image.h>
#include <p9_infrastruct_help.H>
#include <p9_hcode_image_defines.H>
#include <p9_xip_section_append.H>

using namespace ERRORLOG;
using namespace ISTEP;
Expand All @@ -66,7 +69,6 @@ using namespace fapi2;
namespace ISTEP_15
{


/**
* @brief Load HCODE image and return a pointer to it, or NULL
*
Expand Down Expand Up @@ -449,13 +451,25 @@ void* host_build_stop_image (void *io_pArgs)
//Default constructor sets the appropriate settings
ImageType_t img_type;

// Check if we have a valid ring override section and
// include it in if so
void* l_ringOverrides = NULL;
l_errl = HBPM::getRingOvd(l_ringOverrides);
if(l_errl)
{
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
ERR_MRK"host_build_stop_image(): "
"Error in call to getRingOvd!");
break;
}

//Call p9_hcode_image_build.C HWP
FAPI_INVOKE_HWP( l_errl,
p9_hcode_image_build,
l_fapiCpuTarget,
reinterpret_cast<void*>(l_pHcodeImage),
l_pImageOut, //homer image buffer
NULL, //default is no ring overrides
l_ringOverrides,
PHASE_IPL,
img_type,
l_temp_buffer0,
Expand All @@ -475,9 +489,9 @@ void* host_build_stop_image (void *io_pArgs)
break;
}

l_errl = applyHcodeGenCpuRegs( l_procChip,
l_pImageOut,
l_sizeImageOut );
l_errl = applyHcodeGenCpuRegs( l_procChip,
l_pImageOut,
l_sizeImageOut );
if ( l_errl )
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
Expand Down Expand Up @@ -568,4 +582,5 @@ void* host_build_stop_image (void *io_pArgs)
// end task, returning any errorlogs to IStepDisp
return l_StepError.getErrorHandle();
}

};
72 changes: 71 additions & 1 deletion src/usr/isteps/pm/pm_common.C
Expand Up @@ -52,6 +52,7 @@
#include <initservice/initserviceif.H>

#include <runtime/interface.h>
#include <secureboot/service.H>

// Procedures
#include <p9_pm_pba_bar_config.H>
Expand Down Expand Up @@ -338,12 +339,23 @@ namespace HBPM

ImageType_t l_imgType;

// Check if we have a valid ring override section and
// include it in if so
void* l_ringOverrides = NULL;
l_errl = HBPM::getRingOvd(l_ringOverrides);
if(l_errl)
{
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
ERR_MRK"loadHcode(): Error in call to getRingOvd!");
break;
}

FAPI_INVOKE_HWP( l_errl,
p9_hcode_image_build,
l_fapiTarg,
l_pImageIn, //reference image
i_pImageOut, //homer image buffer
nullptr, //default is no ring overrides
l_ringOverrides,
(PM_LOAD == i_mode)
? PHASE_IPL : PHASE_REBUILD,
l_imgType,
Expand Down Expand Up @@ -949,5 +961,63 @@ namespace HBPM
return l_errl;
} // resetPMAll


/**
* @brief Fetch the ring overrides (if they exist)
*/
errlHndl_t getRingOvd(void*& io_overrideImg)
{
errlHndl_t l_err = nullptr;

do {
io_overrideImg = nullptr;

// No overrides in secure mode
if( SECUREBOOT::enabled() )
{
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
INFO_MRK"getRingOvd(): No overrides in secure mode");
break;
}

PNOR::SectionInfo_t l_pnorRingOvd;
l_err = PNOR::getSectionInfo(PNOR::RINGOVD, l_pnorRingOvd);
if(l_err)
{
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
ERR_MRK"getRingOvd():Error trying to read RINGOVD "
"from PNOR!");
break;
}
if(l_pnorRingOvd.size == 0)
{
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
INFO_MRK"getRingOvd(): No RINGOVD section in PNOR");
break;
}

TRACDBIN( ISTEPS_TRACE::g_trac_isteps_trace,
"getRingOvd():100 bytes of RINGOVD section",
(void *)l_pnorRingOvd.vaddr,100);

// If first 8 bytes are just FF's then we know there's no override
if((*(static_cast<uint64_t *>((void *)l_pnorRingOvd.vaddr))) ==
0xFFFFFFFFFFFFFFFF)
{
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
INFO_MRK"getRingOvd():No overrides in RINGOVD section "
"found");
break;
}

TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
INFO_MRK"getRingOvd():Found valid ring overrides");
io_overrideImg = reinterpret_cast<void*>(l_pnorRingOvd.vaddr);

}while(0);

return l_err;
}

} // end HBPM namespace

0 comments on commit 2ed8b10

Please sign in to comment.