From 664897ffe7ac048a96d9eb821f1df24359d4784f Mon Sep 17 00:00:00 2001 From: Bill Schwartz Date: Wed, 19 Aug 2015 18:33:05 -0500 Subject: Propagate ATTR_TMP overrides into HBRT Load ATTR_TMP overrides at host boot runtime RTC: 129055 Change-Id: Id01889b6a1498af05732cee7c797d3e18af10f8d Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/19951 Reviewed-by: A. Patrick Williams III Tested-by: Jenkins Server --- src/include/runtime/interface.h | 16 ++++++++++++ src/include/usr/runtime/rt_targeting.H | 6 +++++ src/runtime/rt_main.C | 19 +++++++++++++- src/usr/diag/attn/runtime/attn_rt.C | 11 +++++++++ src/usr/targeting/attrPlatOverride.C | 7 +++++- src/usr/targeting/runtime/attrPlatOverride_rt.C | 33 +++++++++++++++++++++++++ 6 files changed, 90 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/include/runtime/interface.h b/src/include/runtime/interface.h index 055f751a5..e88a64241 100644 --- a/src/include/runtime/interface.h +++ b/src/include/runtime/interface.h @@ -497,9 +497,25 @@ typedef struct runtimeInterfaces } runtimeInterfaces_t; +// For internal use. These routines are to be called after all other set up +// is complete. +// This approach is taken due to complication with linking to rt_main, the +// order of static global initializers, constructors, and vfs_module_init. + #ifdef __HOSTBOOT_RUNTIME +struct postInitCalls_t +{ + /** + * @brief Apply ATTR_TMP overrides + * + */ + void (*callApplyTempOverrides)(); + +}; + extern hostInterfaces_t* g_hostInterfaces; runtimeInterfaces_t* getRuntimeInterfaces(); +postInitCalls_t* getPostInitCalls(); #endif #endif //__HOSTBOOT_RUNTIME_INTERFACE_VERSION_ONLY diff --git a/src/include/usr/runtime/rt_targeting.H b/src/include/usr/runtime/rt_targeting.H index 6b7ee4075..7559b6170 100644 --- a/src/include/usr/runtime/rt_targeting.H +++ b/src/include/usr/runtime/rt_targeting.H @@ -67,6 +67,12 @@ namespace RT_TARG */ errlHndl_t getHbTarget(rtChipId_t i_rt_chip_id, TARGETING::Target *& o_target); + + /** + * @brief Apply ATTR_TMP overrides to be available for run time + */ + void applyTempOverrides( ); + }; #endif diff --git a/src/runtime/rt_main.C b/src/runtime/rt_main.C index f2bfcad6c..2c3b956e7 100644 --- a/src/runtime/rt_main.C +++ b/src/runtime/rt_main.C @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ +/* Contributors Listed Below - COPYRIGHT 2013,2015 */ +/* [+] International Business Machines Corp. */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -105,6 +107,15 @@ runtimeInterfaces_t* rt_start(hostInterfaces_t* intf) // Initialize all modules. vfs_module_init(); + // TODO RTC 134050 This is the ideal place for initialization calls. + // Opal has not initialized pnor or ipmi, so initialization + // was moved to attn enable as a short term measure. +#if 0 + // apply temp overrides + postInitCalls_t* rtPost = getPostInitCalls(); + rtPost->callApplyTempOverrides(); +#endif + // Return our interface pointer structure. return rtInterfaces; } @@ -128,3 +139,9 @@ runtimeInterfaces_t* getRuntimeInterfaces() { return &Singleton::instance(); } + +postInitCalls_t* getPostInitCalls() +{ + return &Singleton::instance(); +} + diff --git a/src/usr/diag/attn/runtime/attn_rt.C b/src/usr/diag/attn/runtime/attn_rt.C index 60a242df0..404ee42a9 100644 --- a/src/usr/diag/attn/runtime/attn_rt.C +++ b/src/usr/diag/attn/runtime/attn_rt.C @@ -47,6 +47,17 @@ namespace ATTN_RT */ int enableAttns(void) { + // TODO RTC 134050 Post init setups are temporarily here because + // Opal has not set up pnor or ipmi before calling rt_main. + static bool onlyCallApplyTempOverridesOnce = false; + if (!onlyCallApplyTempOverridesOnce) + { + ATTN_SLOW("ATTN_RT::enableAttns - call initialzation routines"); + postInitCalls_t* rtPost = getPostInitCalls(); + rtPost->callApplyTempOverrides(); + onlyCallApplyTempOverridesOnce = true; + } + ATTN_SLOW(ENTER_MRK"ATTN_RT::enableAttns"); int rc = 0; diff --git a/src/usr/targeting/attrPlatOverride.C b/src/usr/targeting/attrPlatOverride.C index f9c13d1d2..9368c4af1 100644 --- a/src/usr/targeting/attrPlatOverride.C +++ b/src/usr/targeting/attrPlatOverride.C @@ -199,10 +199,15 @@ errlHndl_t getAttrOverrides(PNOR::SectionInfo_t &i_sectionInfo, // Only apply attribute override if in the correct PNOR section else { + TRACFCOMP(g_trac_targeting,"getAttrOverrides:" + " override into TankLayer 0x%X", + l_pAttrOverSec->iv_layer); + // Get the AttributeTank that corresponds to the TankLayer in // the AttrOverrideSection. Enum starts with TANK_LAYER_NONE // so need to subtract 1 - AttributeTank* l_ptank = l_pOverTanks[l_pAttrOverSec->iv_layer - 1]; + AttributeTank* l_ptank = + l_pOverTanks[l_pAttrOverSec->iv_layer - 1]; // Create serialized chunck with AttrOverrideSection data AttributeTank::AttributeSerializedChunk l_chunk; diff --git a/src/usr/targeting/runtime/attrPlatOverride_rt.C b/src/usr/targeting/runtime/attrPlatOverride_rt.C index be39e65cf..98d063fa0 100644 --- a/src/usr/targeting/runtime/attrPlatOverride_rt.C +++ b/src/usr/targeting/runtime/attrPlatOverride_rt.C @@ -86,6 +86,37 @@ int apply_attr_override(uint8_t* i_data, return rc; } +void applyTempOverrides() +{ + TRACFCOMP(g_trac_targeting, ENTER_MRK"applyTempOverrides"); + errlHndl_t l_err = NULL; + PNOR::SectionInfo_t l_info; + // Get temporary attribute overrides from pnor + l_err = PNOR::getSectionInfo(PNOR::ATTR_TMP, l_info); + + // Attr override sections are optional so just delete error + 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, EXIT_MRK"applyTempOverrides"); +} //------------------------------------------------------------------------ struct registerTargRT @@ -94,6 +125,8 @@ struct registerTargRT { runtimeInterfaces_t * rt_intf = getRuntimeInterfaces(); rt_intf->apply_attr_override = &apply_attr_override; + postInitCalls_t * rt_post = getPostInitCalls(); + rt_post->callApplyTempOverrides = &applyTempOverrides; } }; -- cgit v1.2.1