summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Wenning <wenning@us.ibm.com>2011-11-17 14:01:58 -0600
committerMark W. Wenning <wenning@us.ibm.com>2011-12-01 09:30:19 -0600
commitac378e7e2f4debe9e53dc0a68dbf6aaa225a6660 (patch)
tree7463f7d91bab00a250ebfcfef94856e761ddf68e
parentd809e799a62a43472c10e4567c313d575ea29734 (diff)
downloadtalos-hostboot-ac378e7e2f4debe9e53dc0a68dbf6aaa225a6660.tar.gz
talos-hostboot-ac378e7e2f4debe9e53dc0a68dbf6aaa225a6660.zip
RTC3034 - Initial Presence Setting
- initial commit - cleanup - fix review comments Change-Id: Ie8ad14a798d5e1dfcc3dc46fc1552cf44ededefe Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/508 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com> Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com> Reviewed-by: Mark W. Wenning <wenning@us.ibm.com>
-rw-r--r--src/include/usr/hwas/hwas.H13
-rw-r--r--src/usr/hwas/hwas.C30
-rw-r--r--src/usr/hwas/test/hwas1test.H116
3 files changed, 149 insertions, 10 deletions
diff --git a/src/include/usr/hwas/hwas.H b/src/include/usr/hwas/hwas.H
index 883de2dd0..e8e0a6a16 100644
--- a/src/include/usr/hwas/hwas.H
+++ b/src/include/usr/hwas/hwas.H
@@ -47,10 +47,15 @@ namespace HWAS
* @brief init_target_states
*
* Currently the state of every target is held in one bitmapped attribute
- * called HWAS_STATE. HWAS_STATES is a read-only attribute - defaults are
- * stored in flash, so they are already initialized.
- * See src/user/errl/targeting/xmltohb/hb.xml for the settings.
- * This is left as a placeholder when/if we add more attributes.
+ * called HWAS_STATE.
+ *
+ * This routine will walk through all the targets and initialize HWAS STATE
+ * to a known default value. This is useful if the developer wishes to
+ * clean everything up to an known state - as such it is the very first
+ * istep to run.
+ *
+ * Currently everything is initialized to to powered off, etc. - init_fsi
+ * and apply_fsi_info (the next isteps) will change this almost immediately.
*
* param[in,out] io_pArgs - (normally) a pointer to a TaskArgs struct,
* or NULL.
diff --git a/src/usr/hwas/hwas.C b/src/usr/hwas/hwas.C
index b9e816d92..acbb00504 100644
--- a/src/usr/hwas/hwas.C
+++ b/src/usr/hwas/hwas.C
@@ -47,16 +47,41 @@
namespace HWAS
{
trace_desc_t *g_trac_hwas = NULL;
-TRAC_INIT(&g_trac_hwas, "HWAS", 1024 );
+TRAC_INIT(&g_trac_hwas, "HWAS", 2048 );
using namespace TARGETING;
+
void init_target_states( void *io_pArgs )
{
INITSERVICE::TaskArgs *pTaskArgs =
static_cast<INITSERVICE::TaskArgs *>( io_pArgs );
- TRACDCOMP( g_trac_hwas, "init_target_states entry" );
+ TRACDCOMP( g_trac_hwas, "init_target_states entry: set default HWAS state:" );
+
+ // loop through all the targets and set HWAS_STATE to a known default
+ TARGETING::TargetIterator l_pTarget = TARGETING::targetService().begin();
+ for( ;
+ l_pTarget != TARGETING::targetService().end();
+ ++l_pTarget
+ )
+ {
+ // HWAS_STATE attribute definition in the attribute_types.xml file
+ // gets translated into TARGETING::HwasState .
+ // fetch it from targeting - this is not strictly necessary (right now)
+ // but makes debug easier later.
+ TARGETING::HwasState l_hwasState =
+ l_pTarget->getAttr<ATTR_HWAS_STATE>();
+
+ l_hwasState.poweredOn = false;
+ l_hwasState.present = false;
+ l_hwasState.functional = false;
+ l_hwasState.changedSinceLastIPL = false;
+ l_hwasState.gardLevel = 0;
+
+ // Now write the modified value back to Targeting.
+ l_pTarget->setAttr<ATTR_HWAS_STATE>( l_hwasState );
+ }
// wait here on the barrier, then end the task.
@@ -64,6 +89,7 @@ void init_target_states( void *io_pArgs )
task_end();
}
+
void init_fsi( void *io_pArgs )
{
errlHndl_t l_errl = NULL;
diff --git a/src/usr/hwas/test/hwas1test.H b/src/usr/hwas/test/hwas1test.H
index 5c9c8c709..4cc83e2f1 100644
--- a/src/usr/hwas/test/hwas1test.H
+++ b/src/usr/hwas/test/hwas1test.H
@@ -59,7 +59,7 @@ class HWAS1test: public CxxTest::TestSuite
public:
/**
- * @brief Walk all the targets and verify that HWAS_STATE is set
+ * @brief Walk some ofthe targets and verify that HWAS_STATE is set
* correctly.
*
* @note Results of this test will change as more stuff gets added to
@@ -67,12 +67,11 @@ public:
*/
void testHWASdefaultPresence()
{
- TS_TRACE(ENTER_MRK "testHWASdefaultPresence" );
+ TS_TRACE( "testHWASdefaultPresence entry" );
using namespace TARGETING;
TargetService& l_targetService = targetService();
-
l_targetService.init();
@@ -128,7 +127,116 @@ public:
}
}
- TS_TRACE(EXIT_MRK "testHWASdefaultPresence" );
+ TS_TRACE( "testHWASdefaultPresence exit" );
+ }
+
+ /**
+ * @brief Write to all the attributes and then read them back.
+ */
+ void testHWASReadWrite()
+ {
+ using namespace TARGETING;
+
+ TARGETING::HwasState l_orgHwasState, l_hwasState;
+ TARGETING::TargetIterator l_pTarget;
+
+ TS_TRACE( "testHWASReadWrite entry" );
+
+ // write a pattern to all HWAS attributes and then read them back
+ for( l_pTarget = TARGETING::targetService().begin();
+ l_pTarget != TARGETING::targetService().end();
+ ++l_pTarget
+ )
+ {
+ // save original state
+ l_orgHwasState = l_pTarget->getAttr<ATTR_HWAS_STATE>();
+
+ // modify state
+ l_hwasState = l_pTarget->getAttr<ATTR_HWAS_STATE>();
+ l_hwasState.poweredOn = true;
+ l_hwasState.present = true;
+ l_hwasState.functional = true;
+ l_hwasState.changedSinceLastIPL = true;
+ l_hwasState.gardLevel = 3;
+
+ // Now write the modified value back to Targeting.
+ l_pTarget->setAttr<ATTR_HWAS_STATE>( l_hwasState );
+
+ // fetch and test new values
+ if ( l_pTarget->getAttr<ATTR_HWAS_STATE>().poweredOn != true )
+ {
+ TS_FAIL( "poweredOn = 0x%x, should be true",
+ l_pTarget->getAttr<ATTR_HWAS_STATE>().poweredOn );
+ }
+
+ if ( l_pTarget->getAttr<ATTR_HWAS_STATE>().present != true )
+ {
+ TS_FAIL( " present = 0x%x should be true",
+ l_pTarget->getAttr<ATTR_HWAS_STATE>().present );
+ }
+
+ if ( l_pTarget->getAttr<ATTR_HWAS_STATE>().functional != true )
+ {
+ TS_FAIL( " functional = 0x%x, should be true",
+ l_pTarget->getAttr<ATTR_HWAS_STATE>().functional );
+ }
+
+ if ( l_pTarget->getAttr<ATTR_HWAS_STATE>().changedSinceLastIPL != true )
+ {
+ TS_FAIL( " changedSinceLastIPL = 0x%x, should be true",
+ l_pTarget->getAttr<ATTR_HWAS_STATE>().changedSinceLastIPL );
+ }
+
+ if ( l_pTarget->getAttr<ATTR_HWAS_STATE>().gardLevel != 3 )
+ {
+ TS_FAIL( " gardLevel = 0x%x, should be 3",
+ l_pTarget->getAttr<ATTR_HWAS_STATE>().gardLevel );
+ }
+
+
+ //
+ // Now write the original value back.
+ //
+ l_pTarget->setAttr<ATTR_HWAS_STATE>( l_orgHwasState );
+
+ // check that it got written back correctly
+ if ( l_pTarget->getAttr<ATTR_HWAS_STATE>().poweredOn
+ != l_orgHwasState.poweredOn )
+ {
+ TS_FAIL( "poweredOn = 0x%x, not restored",
+ l_pTarget->getAttr<ATTR_HWAS_STATE>().poweredOn );
+ }
+
+ if ( l_pTarget->getAttr<ATTR_HWAS_STATE>().present
+ != l_orgHwasState.present )
+ {
+ TS_FAIL( " present = 0x%x, not restored",
+ l_pTarget->getAttr<ATTR_HWAS_STATE>().present );
+ }
+
+ if ( l_pTarget->getAttr<ATTR_HWAS_STATE>().functional
+ != l_orgHwasState.functional )
+ {
+ TS_FAIL( " functional = 0x%x, not restored",
+ l_pTarget->getAttr<ATTR_HWAS_STATE>().functional );
+ }
+
+ if ( l_pTarget->getAttr<ATTR_HWAS_STATE>().changedSinceLastIPL
+ != l_orgHwasState.changedSinceLastIPL )
+ {
+ TS_FAIL( " changedSinceLastIPL = 0x%x, not restored",
+ l_pTarget->getAttr<ATTR_HWAS_STATE>().changedSinceLastIPL );
+ }
+
+ if ( l_pTarget->getAttr<ATTR_HWAS_STATE>().gardLevel
+ != l_orgHwasState.gardLevel )
+ {
+ TS_FAIL( " gardLevel = 0x%x, not restored",
+ l_pTarget->getAttr<ATTR_HWAS_STATE>().gardLevel );
+ }
+ }
+
+ TS_TRACE( "testHWASReadWrite exit" );
}
};
OpenPOWER on IntegriCloud