summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Crowell <dcrowell@us.ibm.com>2017-01-19 09:06:32 -0600
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-01-25 11:47:26 -0500
commit2ed8b10f53407e38fdbeff8f839f474437ef06bf (patch)
tree5ab5df6a6316b250a7c6f6f2c469493b90f87373
parent9fe6f884d176a13b432baaa986179ef6fa654f94 (diff)
downloadtalos-hostboot-2ed8b10f53407e38fdbeff8f839f474437ef06bf.tar.gz
talos-hostboot-2ed8b10f53407e38fdbeff8f839f474437ef06bf.zip
Support ring overrides for HCODE image
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>
-rw-r--r--src/include/usr/isteps/pm/pm_common_ext.H12
-rw-r--r--src/include/usr/secureboot/service.H8
-rw-r--r--src/usr/isteps/istep15/host_build_stop_image.C27
-rw-r--r--src/usr/isteps/pm/pm_common.C72
4 files changed, 110 insertions, 9 deletions
diff --git a/src/include/usr/isteps/pm/pm_common_ext.H b/src/include/usr/isteps/pm/pm_common_ext.H
index be7e9e9b0..c503ada82 100644
--- a/src/include/usr/isteps/pm/pm_common_ext.H
+++ b/src/include/usr/isteps/pm/pm_common_ext.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2016 */
+/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -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
diff --git a/src/include/usr/secureboot/service.H b/src/include/usr/secureboot/service.H
index dce836106..1c83d73c1 100644
--- a/src/include/usr/secureboot/service.H
+++ b/src/include/usr/secureboot/service.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2013,2016 */
+/* Contributors Listed Below - COPYRIGHT 2013,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -26,6 +26,7 @@
#define __SECUREBOOT_SERVICE_H
#include <errl/errlentry.H>
+#include <config.h>
typedef uint8_t SHA512_t[64];
/* From sha512.h: */
@@ -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.
diff --git a/src/usr/isteps/istep15/host_build_stop_image.C b/src/usr/isteps/istep15/host_build_stop_image.C
index c09b35817..d1f0a495c 100644
--- a/src/usr/isteps/istep15/host_build_stop_image.C
+++ b/src/usr/isteps/istep15/host_build_stop_image.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2016 */
+/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -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>
@@ -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;
@@ -66,7 +69,6 @@ using namespace fapi2;
namespace ISTEP_15
{
-
/**
* @brief Load HCODE image and return a pointer to it, or NULL
*
@@ -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,
@@ -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,
@@ -568,4 +582,5 @@ void* host_build_stop_image (void *io_pArgs)
// end task, returning any errorlogs to IStepDisp
return l_StepError.getErrorHandle();
}
+
};
diff --git a/src/usr/isteps/pm/pm_common.C b/src/usr/isteps/pm/pm_common.C
index a094f9621..857314128 100644
--- a/src/usr/isteps/pm/pm_common.C
+++ b/src/usr/isteps/pm/pm_common.C
@@ -52,6 +52,7 @@
#include <initservice/initserviceif.H>
#include <runtime/interface.h>
+#include <secureboot/service.H>
// Procedures
#include <p9_pm_pba_bar_config.H>
@@ -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,
@@ -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
OpenPOWER on IntegriCloud