summaryrefslogtreecommitdiffstats
path: root/src/usr/targeting/runtime
diff options
context:
space:
mode:
authorDan Crowell <dcrowell@us.ibm.com>2017-03-06 16:36:11 -0600
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-04-16 21:32:17 -0400
commit6677ffcbda04c73a7d3ed1e651e3394c8218e503 (patch)
tree2de578165f3517ecd95dd56548a4e5ebdfa4bb8b /src/usr/targeting/runtime
parent6274618ff6a4b0cd8447c1e31940c66b40fa1c42 (diff)
downloadblackbird-hostboot-6677ffcbda04c73a7d3ed1e651e3394c8218e503.tar.gz
blackbird-hostboot-6677ffcbda04c73a7d3ed1e651e3394c8218e503.zip
Propagate attribute overrides up to the HBRT code
Attribute overrides are stored in a separate tank of memory from the regular attribute values. This tank will be added as an additional reserved memory section for HBRT to consume (only if overrides exist). Also fixed a couple bugs encountered while testing: - No longer crashes if an error is created inside the targeting initialization code. - Added reserved bytes to RHB definition. Change-Id: I5b10f7ad8dfcb58c550868bb83c4d843f48e1aae RTC: 169942 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/38547 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Corey V. Swenson <cswenson@us.ibm.com> Reviewed-by: Martin Gloff <mgloff@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/targeting/runtime')
-rw-r--r--src/usr/targeting/runtime/attrPlatOverride_rt.C70
-rw-r--r--src/usr/targeting/runtime/attrrp_rt.C9
-rw-r--r--src/usr/targeting/runtime/test/testtargeting.H43
3 files changed, 93 insertions, 29 deletions
diff --git a/src/usr/targeting/runtime/attrPlatOverride_rt.C b/src/usr/targeting/runtime/attrPlatOverride_rt.C
index 2c28edec8..92a937f03 100644
--- a/src/usr/targeting/runtime/attrPlatOverride_rt.C
+++ b/src/usr/targeting/runtime/attrPlatOverride_rt.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2014,2016 */
+/* Contributors Listed Below - COPYRIGHT 2014,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -89,37 +89,59 @@ int apply_attr_override(uint8_t* i_data,
void applyTempOverrides()
{
- // With FSP, we can not access PNOR, just return
- if(INITSERVICE::spBaseServicesEnabled())
+ TRACFCOMP(g_trac_targeting, ENTER_MRK"applyTempOverrides");
+ errlHndl_t l_err = NULL;
+
+ // Get a pointer to the reserved memory where HB
+ // saved the overrides during boot
+ uint64_t l_overAddr = 0;
+ uint8_t* l_overPtr = nullptr;
+ if( g_hostInterfaces != NULL &&
+ g_hostInterfaces->get_reserved_mem )
{
+ l_overAddr = g_hostInterfaces
+ ->get_reserved_mem("ibm,hbrt-targetoverride-image",0);
+ if( l_overAddr != 0 )
+ {
+ TRACFCOMP(g_trac_targeting, "Overrides found at %.16X", l_overAddr );
+ l_overPtr = reinterpret_cast<uint8_t*>(l_overAddr);
+ }
+ else
+ {
+ // grab the data we stashed at the end of the targeting data
+ l_overAddr = g_hostInterfaces
+ ->get_reserved_mem("ibm,hbrt-target-image",0);
+ if( l_overAddr != 0 )
+ {
+ l_overAddr += (1*MEGABYTE - 64*KILOBYTE);
+ TRACFCOMP(g_trac_targeting, "NULL from get_reserved_mem, using stashed value at %.llX instead", l_overAddr );
+ l_overPtr = reinterpret_cast<uint8_t*>(l_overAddr);
+ }
+ }
+ }
+
+ // Having no overrides is a normal thing
+ if( l_overPtr == nullptr )
+ {
+ TRACFCOMP(g_trac_targeting, "No Overrides found" );
+ TRACFCOMP(g_trac_targeting, EXIT_MRK"applyTempOverrides");
return;
}
- TRACFCOMP(g_trac_targeting, ENTER_MRK"applyTempOverrides");
- errlHndl_t l_err = NULL;
+ // Use a faux PNOR Section that is associated
+ // with the data in mainstore
PNOR::SectionInfo_t l_info;
- // Get temporary attribute overrides from pnor
- l_err = PNOR::getSectionInfo(PNOR::ATTR_TMP, l_info);
+ l_info.vaddr = l_overAddr;
+ l_info.size = 64*KILOBYTE; //@fixme-RTC:171863-use real size
+ l_info.id = PNOR::ATTR_TMP;
+ l_info.name = "HBRT Overrides";
- // Attr override sections are optional so just delete error
+ TRACFCOMP(g_trac_targeting," HBRT: processing overrides from boot");
+ l_err = TARGETING::getAttrOverrides(l_info);
if (l_err)
{
- TRACFCOMP(g_trac_targeting," HBRT: error getting ATTR_TMP pnor "
- "section. Not applying temp attributes.");
- delete l_err;
- l_err = NULL;
- }
- else
- {
- TRACFCOMP(g_trac_targeting," HBRT: processing temporary "
- "overrides");
- l_err = TARGETING::getAttrOverrides(l_info);
- if (l_err)
- {
- TRACFCOMP(g_trac_targeting," HBRT: Failed applyTempOverrides:"
- " getting temporary overrides");
- errlCommit( l_err, TARG_COMP_ID );
- }
+ TRACFCOMP(g_trac_targeting," HBRT: Failed applying overrides");
+ errlCommit( l_err, TARG_COMP_ID );
}
TRACFCOMP(g_trac_targeting, EXIT_MRK"applyTempOverrides");
diff --git a/src/usr/targeting/runtime/attrrp_rt.C b/src/usr/targeting/runtime/attrrp_rt.C
index cf4370f05..4f323e699 100644
--- a/src/usr/targeting/runtime/attrrp_rt.C
+++ b/src/usr/targeting/runtime/attrrp_rt.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2013,2016 */
+/* Contributors Listed Below - COPYRIGHT 2013,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -38,12 +38,15 @@ namespace TARGETING
{
void AttrRP::startup(errlHndl_t& io_taskRetErrl, bool isMpipl)
{
+ TRACFCOMP(g_trac_targeting, "AttrRP::startup");
errlHndl_t l_errl = NULL;
do
{
- TargetingHeader* l_header = reinterpret_cast<TargetingHeader*>(
- g_hostInterfaces->get_reserved_mem("ibm,hbrt-target-image",0));
+ TargetingHeader* l_header =
+ reinterpret_cast<TargetingHeader*>(
+ g_hostInterfaces->
+ get_reserved_mem(HBRT_RSVD_MEM__ATTRIBUTES,0));
if ((NULL == l_header) ||
(l_header->eyeCatcher != PNOR_TARG_EYE_CATCHER))
diff --git a/src/usr/targeting/runtime/test/testtargeting.H b/src/usr/targeting/runtime/test/testtargeting.H
index 68ef93603..99c0fbbb4 100644
--- a/src/usr/targeting/runtime/test/testtargeting.H
+++ b/src/usr/targeting/runtime/test/testtargeting.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2013,2016 */
+/* Contributors Listed Below - COPYRIGHT 2013,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -119,6 +119,35 @@ class TargetingTestSuite : public CxxTest::TestSuite
}
}
+ // Verify HBRT is picking up the overrides from the IPL
+ // Note: must be before testApplyAttrOverrides, because that
+ // test clears out all of the overrides
+ void testIplOverrides()
+ {
+ using namespace TARGETING;
+ TRACFCOMP(g_trac_targeting,"testIplOverrides");
+
+ //See rt_get_targ_override() for setup details about setting
+ // SYSTEM:ATTR_SCRATCH_INT32_1 = -99
+
+ TargetService& l_targetService = targetService();
+ TARGETING::Target* l_pTarget = NULL;
+ (void) l_targetService.getTopLevelTarget(l_pTarget);
+ if (l_pTarget == NULL)
+ {
+ TS_FAIL("Top level target handle is NULL");
+ }
+ else
+ {
+ ATTR_SCRATCH_INT32_1_type l_val =
+ l_pTarget->getAttr<TARGETING::ATTR_SCRATCH_INT32_1>();
+ if( l_val != -99 )
+ {
+ TS_FAIL("testIplOverrides> SCRATCH_INT32_1=%d, expected %d", l_val, -99 );
+ }
+ }
+ }
+
void testApplyAttrOverrides()
{
using namespace TARGETING;
@@ -218,8 +247,18 @@ class TargetingTestSuite : public CxxTest::TestSuite
l_attrNewVal,l_attrOverrideVal);
break;
}
- TRACFCOMP(g_trac_targeting,"testApplyAttrOverrides SUCCESS");
+ // verify that any previous overrides are not still there
+ ATTR_SCRATCH_INT32_1_type l_val =
+ l_pTarget->getAttr<TARGETING::ATTR_SCRATCH_INT32_1>();
+ if( l_val == -99 )
+ {
+ TS_FAIL("testApplyAttrOverrides> SCRATCH_INT32_1=%d, expected %d", -99, 0 );
+ break;
+ }
+
+ TRACFCOMP(g_trac_targeting,"testApplyAttrOverrides SUCCESS");
} while (0);
}
+
};
OpenPOWER on IntegriCloud