diff options
Diffstat (limited to 'src/usr/hwas')
-rw-r--r-- | src/usr/hwas/hwas.C | 141 | ||||
-rw-r--r-- | src/usr/hwas/makefile | 30 | ||||
-rw-r--r-- | src/usr/hwas/test/hwas1test.H | 138 | ||||
-rw-r--r-- | src/usr/hwas/test/makefile | 38 |
4 files changed, 347 insertions, 0 deletions
diff --git a/src/usr/hwas/hwas.C b/src/usr/hwas/hwas.C new file mode 100644 index 000000000..c7872d033 --- /dev/null +++ b/src/usr/hwas/hwas.C @@ -0,0 +1,141 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/usr/hwas/hwas.C $ +// +// IBM CONFIDENTIAL +// +// COPYRIGHT International Business Machines Corp. 2011 +// +// p1 +// +// Object Code Only (OCO) source materials +// Licensed Internal Code Source Materials +// IBM HostBoot Licensed Internal Code +// +// The source code for this program is not published or other- +// wise divested of its trade secrets, irrespective of what has +// been deposited with the U.S. Copyright Office. +// +// Origin: 30 +// +// IBM_PROLOG_END + +/** + * @file hwas.C + * + * HardWare Availability Service functions. + * See hwas.H for doxygen documentation tags. + * + */ + + +/******************************************************************************/ +// Includes +/******************************************************************************/ +#include <stdint.h> + +#include <kernel/console.H> +#include <trace/interface.H> +#include <initservice/taskargs.H> +#include <errl/errlentry.H> +#include <targeting/target.H> // targeting + +#include <fsi/fsiif.H> +#include <hwas/hwas.H> + + +namespace HWAS +{ + trace_desc_t *g_trac_hwas = NULL; + TRAC_INIT(&g_trac_hwas, "HWAS", 1024 ); // yah. + + using namespace TARGETING; // + + void init_target_states( void *io_pArgs ) + { + TASKARGS_INIT_TASKARGS( io_pArgs ); + + TRACDCOMP( g_trac_hwas, "init_target_states entry" ); + // printkd("init_target_states\n"); + + + TASKARGS_WAIT_AND_ENDTASK(); + } + + void init_fsi( void *io_pArgs ) + { + errlHndl_t l_errl = NULL; + TASKARGS_INIT_TASKARGS( io_pArgs ); + + TRACDCOMP( g_trac_hwas, "init_fsi entry" ); + // printkd("init_fsi\n"); + + l_errl = FSI::initializeHardware( ); + if ( l_errl ) + { + TRACFCOMP( g_trac_hwas, "ERROR: failed to init FSI hardware" ); + POST_ERROR_LOG( l_errl ); + } + + TASKARGS_WAIT_AND_ENDTASK(); + } + + void apply_fsi_info( void *io_pArgs ) + { + TASKARGS_INIT_TASKARGS( io_pArgs ); + + TRACDCOMP( g_trac_hwas, "apply_fsi_info entry" ); + //printkd("apply_fsi_info\n"); + + + TASKARGS_WAIT_AND_ENDTASK(); + } + + void apply_dd_presence( void *io_pArgs ) + { + TASKARGS_INIT_TASKARGS( io_pArgs ); + + TRACDCOMP( g_trac_hwas, "apply_dd_presence entry" ); + //printkd("apply_dd_presence\n"); + + + TASKARGS_WAIT_AND_ENDTASK(); + } + + void apply_pr_keyword_data( void *io_pArgs ) + { + TASKARGS_INIT_TASKARGS( io_pArgs ); + + TRACDCOMP( g_trac_hwas, "apply_pr_keyword_data" ); + //printkd("apply_pr_keyword_data\n"); + + + TASKARGS_WAIT_AND_ENDTASK(); + } + + void apply_partial_bad( void *io_pArgs ) + { + TASKARGS_INIT_TASKARGS( io_pArgs ); + + TRACDCOMP( g_trac_hwas, "apply_partial_bad entry" ); + //printkd("apply_partial_bad\n"); + + + TASKARGS_WAIT_AND_ENDTASK(); + } + + void apply_gard( void *io_pArgs ) + { + TASKARGS_INIT_TASKARGS( io_pArgs ); + + TRACDCOMP( g_trac_hwas, "apply_gard entry" ); + //printkd("apply_gard\n"); + + + TASKARGS_WAIT_AND_ENDTASK(); + } + + +}; // end namespace + diff --git a/src/usr/hwas/makefile b/src/usr/hwas/makefile new file mode 100644 index 000000000..c4a596500 --- /dev/null +++ b/src/usr/hwas/makefile @@ -0,0 +1,30 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/hwas/makefile $ +# +# IBM CONFIDENTIAL +# +# COPYRIGHT International Business Machines Corp. 2011 +# +# p1 +# +# Object Code Only (OCO) source materials +# Licensed Internal Code Source Materials +# IBM HostBoot Licensed Internal Code +# +# The source code for this program is not published or other- +# wise divested of its trade secrets, irrespective of what has +# been deposited with the U.S. Copyright Office. +# +# Origin: 30 +# +# IBM_PROLOG_END +ROOTPATH = ../../.. +MODULE = hwas + +OBJS = hwas.o + +SUBDIRS=test.d + +include ${ROOTPATH}/config.mk diff --git a/src/usr/hwas/test/hwas1test.H b/src/usr/hwas/test/hwas1test.H new file mode 100644 index 000000000..2ee648158 --- /dev/null +++ b/src/usr/hwas/test/hwas1test.H @@ -0,0 +1,138 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/usr/targeting/test/targetingtest.H $ +// +// IBM CONFIDENTIAL +// +// COPYRIGHT International Business Machines Corp. 2011 +// +// p1 +// +// Object Code Only (OCO) source materials +// Licensed Internal Code Source Materials +// IBM HostBoot Licensed Internal Code +// +// The source code for this program is not published or other- +// wise divested of its trade secrets, irrespective of what has +// been deposited with the U.S. Copyright Office. +// +// Origin: 30 +// +// IBM_PROLOG_END +#ifndef __TESTTARGETING_H +#define __TESTTARGETING_H + +/** + * @file testtargeting.H + * + * @brief Unit tests for HWAS (ISTEP 4) + */ + +//****************************************************************************** +// Includes +//****************************************************************************** + +// STD +#include <stdio.h> +#include <sys/time.h> + +// CXXTEST +#include <cxxtest/TestSuite.H> +#include <hwpf/plat/fapiPlatAttributeService.H> +#include <fapiReturnCode.H> +#include <fapiAttributeIds.H> +#include <fapiAttributeService.H> +#include <errl/errlmanager.H> + +// This component +#include <targeting/attributes.H> +#include <targeting/entitypath.H> +#include <targeting/target.H> +#include <targeting/targetservice.H> +#include <targeting/iterators/rangefilter.H> +#include <targeting/predicates/predicatectm.H> +#include <targeting/predicates/predicatepostfixexpr.H> + +class HWAS1test: public CxxTest::TestSuite +{ +public: + + /** + * @brief Walk all the targets and verify that HWAS_STATE is set + * correctly. + * + * @note Results of this test will change as more stuff gets added to + * HWAS - how to fix? + */ + void testHWASdefaultPresence() + { + + nanosleep(1,0); + TS_TRACE(ENTER_MRK "testHWASdefaultPresence" ); + + using namespace TARGETING; + + TargetService& l_targetService = targetService(); + + l_targetService.init(); + + + // get top level + // Post init + // Test: void getTopLevelTarget(Target*& o_targetHandle) const; + + Target* l_pTopLevel = NULL; + (void) l_targetService.getTopLevelTarget(l_pTopLevel); + if (l_pTopLevel == NULL) + { + TS_FAIL("Top level handle was NULL when initialization complete"); + } + + // Post init + // Test: void getAssociated( + // const Target* i_pTarget, + // ASSOCIATION_TYPE i_type, + // RECURSION_LEVEL i_recursionLevel, + // TargetHandleList& o_list) const; + + TargetHandleList l_list; + (void) l_targetService.getAssociated( + l_list, + l_pTopLevel, + TARGETING::TargetService::CHILD, + TARGETING::TargetService::ALL); + + TS_TRACE("Child list size is 0x%x", l_list.size() ); + for (uint64_t i=0; i<l_list.size(); i++ ) + { + // 2011-10-19 all attribute fields should be 0 at this point. + if ( ( l_list[i]->getAttr<ATTR_HWAS_STATE>().poweredOn) + || ( l_list[i]->getAttr<ATTR_HWAS_STATE>().present) + || ( l_list[i]->getAttr<ATTR_HWAS_STATE>().functional) + || ( l_list[i]->getAttr<ATTR_HWAS_STATE>().changedSinceLastIPL) + || ( l_list[i]->getAttr<ATTR_HWAS_STATE>().gardLevel) + ) + { + l_list[i]->getAttr<ATTR_PHYS_PATH>().dump(); + TS_TRACE( " poweredOn = 0x%x", + l_list[i]->getAttr<ATTR_HWAS_STATE>().poweredOn ); + TS_TRACE( " present = 0x%x", + l_list[i]->getAttr<ATTR_HWAS_STATE>().present ); + TS_TRACE( " l_functional = 0x%x", + l_list[i]->getAttr<ATTR_HWAS_STATE>().functional ); + TS_TRACE( " l_changedSinceLastIPL = 0x%x", + l_list[i]->getAttr<ATTR_HWAS_STATE>().changedSinceLastIPL ); + TS_TRACE( " l_gardLevel = 0x%x", + l_list[i]->getAttr<ATTR_HWAS_STATE>().gardLevel ); + + TS_FAIL( "Attribute fields not correct: "); + } + } + + TS_TRACE(EXIT_MRK "testHWASdefaultPresence" ); + } + +}; + +#endif // diff --git a/src/usr/hwas/test/makefile b/src/usr/hwas/test/makefile new file mode 100644 index 000000000..6cc573dbe --- /dev/null +++ b/src/usr/hwas/test/makefile @@ -0,0 +1,38 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/targeting/test/makefile $ +# +# IBM CONFIDENTIAL +# +# COPYRIGHT International Business Machines Corp. 2011 +# +# p1 +# +# Object Code Only (OCO) source materials +# Licensed Internal Code Source Materials +# IBM HostBoot Licensed Internal Code +# +# The source code for this program is not published or other- +# wise divested of its trade secrets, irrespective of what has +# been deposited with the U.S. Copyright Office. +# +# Origin: 30 +# +# IBM_PROLOG_END +ROOTPATH = ../../../.. + +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer + +MODULE = testhwas +TESTS = *.H + +OBJS = attributestrings.o + +include ${ROOTPATH}/config.mk + +vpath %.C ${GENDIR} + |