summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.mk6
-rwxr-xr-xsrc/build/citest/autocitest1
-rw-r--r--src/include/usr/hwas/deconfigGard.H12
-rw-r--r--src/include/usr/hwas/hwas.H136
-rw-r--r--src/include/usr/hwas/hwasCommon.H75
-rw-r--r--src/include/usr/hwas/plat/hostbootIstep.H80
-rw-r--r--src/include/usr/hwas/plat/hwasPlatTrace.H50
-rw-r--r--src/include/usr/isteps/istep04list.H144
-rw-r--r--src/include/usr/isteps/istep06list.H98
-rw-r--r--src/include/usr/isteps/istepmasterlist.H6
-rw-r--r--src/usr/hwas/deconfigGard.C28
-rw-r--r--src/usr/hwas/hwas.C405
-rw-r--r--src/usr/hwas/makefile17
-rw-r--r--src/usr/hwas/plat/hostbootIstep.C74
-rw-r--r--src/usr/hwas/plat/hwasPlat.C214
-rw-r--r--src/usr/hwas/testHWP.C8
-rw-r--r--src/usr/hwpf/hwp/chip_attributes.xml12
-rw-r--r--src/usr/targeting/xmltohb/attribute_types.xml17
-rw-r--r--src/usr/targeting/xmltohb/target_types.xml3
19 files changed, 878 insertions, 508 deletions
diff --git a/config.mk b/config.mk
index 109980f68..878618f84 100644
--- a/config.mk
+++ b/config.mk
@@ -168,13 +168,13 @@ ${OBJDIR}/%.o ${OBJDIR}/%.list : %.C
mkdir -p ${OBJDIR}
${CXX} -c $(call FLAGS_FILTER, ${CXXFLAGS}, $<) $< \
-o $@ ${INCFLAGS} -iquote .
- ${OBJDUMP} -dCS $@ > $(basename $@).list
+ ${OBJDUMP} -rdlCS $@ > $(basename $@).list
# Compiling *.cc files
${OBJDIR}/%.o ${OBJDIR}/%.list : %.cc
mkdir -p ${OBJDIR}
${CXX} -c ${CXXFLAGS} $< -o $@ ${INCFLAGS} -iquote .
- ${OBJDUMP} -dCS $@ > $(basename $@).list
+ ${OBJDUMP} -rdlCS $@ > $(basename $@).list
${OBJDIR}/%.o ${OBJDIR}/%.list : %.c
mkdir -p ${OBJDIR}
@@ -187,7 +187,7 @@ else
${CXX} -c $(call FLAGS_FILTER, ${CXXFLAGS}, $<) $< \
-o $@ ${INCFLAGS} -iquote .
endif
- ${OBJDUMP} -dCS $@ > $(basename $@).list
+ ${OBJDUMP} -rdlCS $@ > $(basename $@).list
${OBJDIR}/%.o : %.S
mkdir -p ${OBJDIR}
diff --git a/src/build/citest/autocitest b/src/build/citest/autocitest
index 5e8829057..9d952bbc3 100755
--- a/src/build/citest/autocitest
+++ b/src/build/citest/autocitest
@@ -335,6 +335,7 @@ while [ $(($modsstarted)) -lt 1 -o $(($modsstarted)) -ne $(($modscompleted)) ];
if [ "$loopcount" -gt 60 ]; then
echo "ERROR: timed out after 5 minutes"
+ autosim $NOWIN --simcmd "hb-Ps"
timeout=$(($modsstarted - $modscompleted))
break
fi
diff --git a/src/include/usr/hwas/deconfigGard.H b/src/include/usr/hwas/deconfigGard.H
index c3254f50a..4a7b1cd3c 100644
--- a/src/include/usr/hwas/deconfigGard.H
+++ b/src/include/usr/hwas/deconfigGard.H
@@ -42,6 +42,18 @@ namespace HWAS
{
/**
+ * @brief collectGard Common HWAS function to collect the GARD info
+ *
+ * It will call into hwas platform-specific functions.
+ *
+ * @param none
+ *
+ * @return errlHndl_t valid errlHndl_t handle if there was an error
+ * NULL if no errors;
+ */
+errlHndl_t collectGard();
+
+/**
* @brief Returns a reference to the DeconfigGard singleton.
*/
class DeconfigGard;
diff --git a/src/include/usr/hwas/hwas.H b/src/include/usr/hwas/hwas.H
index e8e0a6a16..8d5c7fbb6 100644
--- a/src/include/usr/hwas/hwas.H
+++ b/src/include/usr/hwas/hwas.H
@@ -38,114 +38,42 @@
/******************************************************************************/
// Includes
/******************************************************************************/
-#include <stdint.h>
+#include <stdint.h>
+#include <errl/errlentry.H>
-
-namespace HWAS
+namespace HWAS
{
- /*
- * @brief init_target_states
- *
- * Currently the state of every target is held in one bitmapped attribute
- * 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.
- * return none
- *
- */
- void init_target_states( void *io_pArgs );
-
- /**
- * @brief init_fsi
- *
- * Call into the fsi component to "walk the bus" and collect information
- * on the hardware configuration.
- *
- * param[in,out] io_pArgs - (normally) a pointer to a TaskArgs struct,
- * or NULL.
- * return none
- */
- void init_fsi( void *io_pArgs );
-
- /**
- * @brief apply_fsi_info
- *
- * Call into the FSI Component, read the hardware information, and apply
- * it to the target states.
- *
- * param[in,out] io_pArgs - (normally) a pointer to a TaskArgs struct,
- * or NULL.
- * return none
- */
- void apply_fsi_info( void *io_pArgs );
-
- /**
- * @brief apply_dd_presence
- *
- * Iterate over all targets and apply presence detect information to the
- * target states.
- * TBD
- *
- * param[in,out] io_pArgs - (normally) a pointer to a TaskArgs struct,
- * or NULL.
- * return none
- */
- void apply_dd_presence( void *io_pArgs );
-
- /**
- * @brief apply_pr_keyword_data
- *
- * TBD
- *
- * param[in,out] io_pArgs - (normally) a pointer to a TaskArgs struct,
- * or NULL.
- * return none
- *
- */
- void apply_pr_keyword_data( void *io_pArgs );
- /**
- * @brief apply_partial bad
- *
- * Collect Partial Bad information and apply it to the target states.
- * TBD
- *
- * param[in,out] io_pArgs - (normally) a pointer to a TaskArgs struct,
- * or NULL.
- * return none
- */
- void apply_partial_bad( void *io_pArgs );
-
- /**
- * @brief apply_gard
- *
- * Collect GARD information and apply it to the target states.
- * TBD
- *
- * param[in,out] io_pArgs - (normally) a pointer to a TaskArgs struct,
- * or NULL.
- * return none
- */
- void apply_gard( void *io_pArgs );
-
- /**
- * @brief testHWP
- *
- * test Hardware procedure. Althought this is called a test, we want it
- * to run even in non-test builds. Thus it is added here at the end of
- * HWAS inititialization.
- */
- void testHWP( void * io_pArgs );
+/**
+ * @brief initHardware Common HWAS function to setup the hardware
+ *
+ * It will call into the hwas platform-specific platInitHardware()
+ * function to init the FSI hardware.
+ *
+ * @param none
+ *
+ * @return errlHndl_t valid errlHndl_t handle if there was an error
+ * NULL if no errors;
+ */
+errlHndl_t initHardware();
+/**
+ * @brief discoverTagets Common HWAS function to build targeting
+ *
+ * This routine will walk through all the targets and initialize HWAS STATE
+ * to a known default value (powered off, etc.)
+ *
+ * Then call into the hwas platform-specific platPresenceDetect() function
+ * to read the hardware information, and apply it to the target states,
+ * and call into the hwas platform-specifiction platReadIDEC() function
+ * to get and set the ChipID and EC values.
+ *
+ * @param none
+ *
+ * @return errlHndl_t valid errlHndl_t handle if there was an error
+ * NULL if no errors;
+ */
+errlHndl_t discoverTargets();
}; // end namespace
diff --git a/src/include/usr/hwas/hwasCommon.H b/src/include/usr/hwas/hwasCommon.H
new file mode 100644
index 000000000..100113827
--- /dev/null
+++ b/src/include/usr/hwas/hwasCommon.H
@@ -0,0 +1,75 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/hwas/hwasCommon.H $
+//
+// IBM CONFIDENTIAL
+//
+// COPYRIGHT International Business Machines Corp. 2012
+//
+// 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 hwasCommon.H
+ *
+ * @brief Notes the HWAS common functions and the HWAS platform-specific
+ * interfaces that need to be defined and implemented.
+ */
+
+#ifndef HWASCOMMON_H_
+#define HWASCOMMON_H_
+
+// 'system' headers
+#include <stdint.h>
+#include <errl/errlentry.H>
+#include <targeting/target.H>
+#include <targeting/targetservice.H>
+
+// platform specific headers
+
+// following file needs to do
+// #define HWAS_DBG(_fmt_, _args_...)
+// #define HWAS_ERR(_fmt_, _args_...)
+#include <hwasPlatTrace.H>
+
+namespace HWAS
+{
+
+/**
+ * @brief platform specific code to determine if the targets in the
+ * input list are present or not. If the target is NOT present,
+ * target should be erased from the list
+ *
+ * @param[in] io_targets TargetHandleList of targets to check for presence
+ *
+ * @return errlHndl_t valid errlHndl_t handle if there was an error
+ * NULL if no errors;
+ */
+errlHndl_t platPresenceDetect(TARGETING::TargetHandleList &io_targets);
+
+/**
+ * @brief platform specific code to determine the ID/EC of the targets
+ * in the input list. The platform specific code is responsible for setting
+ * the ATTR_EC and ATTR_CHIP_ID in each target.
+ *
+ * @param[in] i_targets TargetHandleList of targets to check for chip ID/EC
+ *
+ * @return errlHndl_t valid errlHndl_t handle if there was an error
+ * NULL if no errors;
+ */
+errlHndl_t platReadIDEC(const TARGETING::TargetHandleList &i_targets);
+
+} // namespace HWAS
+
+#endif // HWASCOMMON_H_
diff --git a/src/include/usr/hwas/plat/hostbootIstep.H b/src/include/usr/hwas/plat/hostbootIstep.H
new file mode 100644
index 000000000..39c490f8a
--- /dev/null
+++ b/src/include/usr/hwas/plat/hostbootIstep.H
@@ -0,0 +1,80 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/hwas/plat/hostbootIstep.H $
+//
+// IBM CONFIDENTIAL
+//
+// COPYRIGHT International Business Machines Corp. 2012
+//
+// 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 hostbootIstep.H
+ *
+ * @brief Defines hostboot functions that get called by the istep dispatcher
+ * and call into the HWAS common interface
+ */
+
+#ifndef HOSTBOOTISTEP_H_
+#define HOSTBOOTISTEP_H_
+
+namespace HWAS
+{
+
+// hostboot only functions that are called by the istep dispatcher
+// and then call the HWAS common functions
+
+/**
+ * @brief host_init_fsi Setup the FSI links to slave chips
+ *
+ * Call into the hwas platform-specific initHardware() function
+ * to init the FSI hardware.
+ *
+ * param[in,out] io_pArgs - (normally) a pointer to a TaskArgs struct,
+ * or NULL.
+ * return none
+ */
+void host_init_fsi( void *io_pArgs );
+
+/**
+ * @brief host_discover_targets Builds targeting
+ *
+ * This routine will walk through all the targets and initialize HWAS STATE
+ * to a known default value.
+ *
+ * Currently everything is initialized to powered off, etc.
+ *
+ * Call into the hwas platform-specific presenceDetect() function to
+ * read the hardware information, and apply it to the target states.
+ *
+ * param[in,out] io_pArgs - (normally) a pointer to a TaskArgs struct,
+ * or NULL.
+ * return none
+ */
+void host_discover_targets( void *io_pArgs );
+
+/**
+ * @brief host_gard Do Gard
+ *
+ * Collect GARD information and apply it to the target states.
+ *
+ * param[in,out] io_pArgs - (normally) a pointer to a TaskArgs struct,
+ * or NULL.
+ * return none
+ */
+void host_gard( void *io_pArgs );
+
+} // namespace HWAS
+#endif // HOSTBOOTISTEP_H_
diff --git a/src/include/usr/hwas/plat/hwasPlatTrace.H b/src/include/usr/hwas/plat/hwasPlatTrace.H
new file mode 100644
index 000000000..0dc3d36b2
--- /dev/null
+++ b/src/include/usr/hwas/plat/hwasPlatTrace.H
@@ -0,0 +1,50 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/hwas/plat/hwasPlatTrace.H $
+//
+// IBM CONFIDENTIAL
+//
+// COPYRIGHT International Business Machines Corp. 2012
+//
+// 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 hwasPlatTrace.H
+ *
+ * @brief Defines platform interfaces and whatnot needed for trace in the
+ * HWAS common and platform specific functions
+ */
+
+#ifndef HWASPLATTRACE_H_
+#define HWASPLATTRACE_H_
+
+#include <trace/interface.H>
+#include <errl/errlentry.H>
+
+//******************************************************************************
+// Trace descriptors that are defined in a C file
+//******************************************************************************
+extern trace_desc_t *g_trac_dbg_hwas; // debug - fast
+extern trace_desc_t *g_trac_imp_hwas; // important - slow
+
+// Debug traces (go into fast trace buffer that can wrap often)
+#define HWAS_DBG(_fmt_, _args_...) \
+ TRACDCOMP(g_trac_dbg_hwas, TRACE_FILENAME _fmt_, ##_args_)
+
+// Error traces (go into slow trace buffer that should not wrap often)
+#define HWAS_ERR(_fmt_, _args_...) \
+ TRACFCOMP(g_trac_imp_hwas, TRACE_FILENAME _fmt_, ##_args_)
+
+#endif // HWASPLATTRACE_H_
diff --git a/src/include/usr/isteps/istep04list.H b/src/include/usr/isteps/istep04list.H
deleted file mode 100644
index 24c043f92..000000000
--- a/src/include/usr/isteps/istep04list.H
+++ /dev/null
@@ -1,144 +0,0 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/include/usr/isteps/istep4list.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 __ISTEPS_ISTEP4LIST_H
-#define __ISTEPS_ISTEP4LIST_H
-
-/**
- * @file istep4list.H
- *
- * list of functions called by HWAS (ISTEP 4) - "named isteps"
- *
- * Please see the note in initsvcstructs.H for description of
- * the ISTEPNAME macro.
- *
- */
-
-#include <initservice/initsvcstructs.H>
-#include <initservice/initsvcreasoncodes.H>
-
-#include <hwas/hwas.H>
-
-namespace INITSERVICE
-{
-
-/**
- * @note IStep definition for for Hardware Availability Service (HWAS)
- *
- * 1. Initialize Target States
- * 1.POWERED_ON=true
- * 2.PRESENT=false
- * 3.FUNCTIONAL=false
- * 4.CHANGED_SINCE_LAST_IPL
- * 5.GARD Level (4 bits)
- * 6.Others?
- * 2. Call FSI module to "walk the bus" and collect presence information.
- * 3. Call FSI module interface to collect presence information
- * 4. Apply presence data: DD framework (Call loaded device drivers)
- * 5. Apply PR keyword data
- * 6. Apply Partial Bad data (call Partial Bad module)
- * 7. Apply GARD data (call GARD module)
- *
- */
-const TaskInfo g_istep04[] = {
-
- {
- ISTEPNAME(4,0,"init_target_states"), // substep name
- HWAS::init_target_states, // pointer to fn
- {
- START_FN, // task type
- EXT_IMAGE, // Extended Module
- }
- },
- {
- ISTEPNAME(4,1,"init_fsi"), // substep name
- HWAS::init_fsi, // pointer to fn
- {
- START_FN, // task type
- EXT_IMAGE, // Extended Module
- }
- },
- {
- ISTEPNAME(4,2,"apply_fsi_info"), // substep name
- HWAS::apply_fsi_info, // pointer to fn
- {
- START_FN, // task type
- EXT_IMAGE, // Extended Module
- }
- },
- {
- ISTEPNAME(4,3,"apply_dd_presence"), // substep name
- HWAS::apply_dd_presence, // pointer to fn
- {
- START_FN, // task type
- EXT_IMAGE, // Extended Module
- }
- },
- {
- ISTEPNAME(4,4,"apply_pr_keyword_data"), // substep name
- HWAS::apply_pr_keyword_data, // pointer to fn
- {
- START_FN, // task type
- EXT_IMAGE, // Extended Module
- }
- },
- {
- ISTEPNAME(4,5,"apply_partial_bad"), // substep name
- HWAS::apply_partial_bad, // pointer to fn
- {
- START_FN, // task type
- EXT_IMAGE, // Extended Module
- }
- },
- {
- ISTEPNAME(4, 6, "apply_gard"), // substep name
- HWAS::apply_gard, // pointer to fn
- {
- START_FN, // task type
- EXT_IMAGE, // Extended Module
- }
- },
-#if 0
- // NOT USED ANYMORE
- {
- ISTEP#NOTUSED#NAME(4,7,"testHWP"), // substep name
- HWAS::testHWP, // pointer to fn
- {
- START_FN, // task type
- EXT_IMAGE, // Extended Module
- }
- }
-#endif
-
- // END OF LIST!
-};
-
-// make a struct from the above with the number of items included
-const ExtTaskInfo g_istep04TaskList = {
- &(g_istep04[0]),
- ( sizeof(g_istep04)/sizeof(TaskInfo) ),
- NULL
-};
-
-}; // end namespace
-
-#endif
diff --git a/src/include/usr/isteps/istep06list.H b/src/include/usr/isteps/istep06list.H
new file mode 100644
index 000000000..72a394ea4
--- /dev/null
+++ b/src/include/usr/isteps/istep06list.H
@@ -0,0 +1,98 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/isteps/istep6list.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 __ISTEPS_ISTEP6LIST_H
+#define __ISTEPS_ISTEP6LIST_H
+
+/**
+ * @file istep6list.H
+ *
+ * list of functions called by HWAS (ISTEP 6) - "named isteps"
+ *
+ * Please see the note in initsvcstructs.H for description of
+ * the ISTEPNAME macro.
+ *
+ */
+
+#include <initservice/initsvcstructs.H>
+#include <initservice/initsvcreasoncodes.H>
+
+#include <hwas/hwas.H>
+#include <hwas/plat/hostbootIstep.H>
+
+
+namespace INITSERVICE
+{
+
+/**
+ * @note IStep definition for Hostboot - Slave SBE
+ *
+ * 1. host_setup : Setup host environment
+ * 2. host_istep_enable : Hostboot istep ready
+ * 3. host_init_fsi : Setup the FSI links to slave chips
+ * 4. host_set_ipl_parms : Build ipl parameters
+ * 5. host_discover_targets : Builds targeting
+ * 6. host_gard : Do Gard
+ * 7. host_cancontinue_clear : Clear deconfigured states
+ * 8. proc_check_slave_sbe_seeprom_complete : Check Slave SBE Complete
+ *
+ */
+const TaskInfo g_istep06[] = {
+
+ {
+ ISTEPNAME(6,3,"host_init_fsi"), // substep name
+ HWAS::host_init_fsi, // pointer to fn
+ {
+ START_FN, // task type
+ EXT_IMAGE, // Extended Module
+ }
+ },
+ {
+ ISTEPNAME(6,5,"host_discover_targets"), // substep name
+ HWAS::host_discover_targets, // pointer to fn
+ {
+ START_FN, // task type
+ EXT_IMAGE, // Extended Module
+ }
+ },
+ {
+ ISTEPNAME(6, 6, "host_gard"), // substep name
+ HWAS::host_gard, // pointer to fn
+ {
+ START_FN, // task type
+ EXT_IMAGE, // Extended Module
+ }
+ },
+
+ // END OF LIST!
+};
+
+// make a struct from the above with the number of items included
+const ExtTaskInfo g_istep06TaskList = {
+ &(g_istep06[0]),
+ ( sizeof(g_istep06)/sizeof(TaskInfo) ),
+ NULL
+};
+
+}; // end namespace
+
+#endif
diff --git a/src/include/usr/isteps/istepmasterlist.H b/src/include/usr/isteps/istepmasterlist.H
index 685c77209..2ce020c08 100644
--- a/src/include/usr/isteps/istepmasterlist.H
+++ b/src/include/usr/isteps/istepmasterlist.H
@@ -56,7 +56,7 @@
#include <initservice/initsvcstructs.H>
// ----- istep include files -----
-#include "istep04list.H"
+#include "istep06list.H"
#include "istep10list.H"
#include "istep11list.H"
@@ -73,9 +73,9 @@ const ExtTaskInfo g_isteps[] = {
{ NULL, 0, NULL }, // dummy IStep 1
{ NULL, 0, NULL }, // dummy IStep 2
{ NULL, 0, NULL }, // dummy IStep 3
- INITSERVICE::g_istep04TaskList, // HWAS IStep 4
+ { NULL, 0, NULL }, // dummy IStep 4
{ NULL, 0, NULL }, // dummy IStep 5
- { NULL, 0, NULL }, // dummy IStep 6
+ INITSERVICE::g_istep06TaskList, // HWAS IStep 6
{ NULL, 0, NULL }, // dummy IStep 7
{ NULL, 0, NULL }, // dummy IStep 8
{ NULL, 0, NULL }, // dummy IStep 9
diff --git a/src/usr/hwas/deconfigGard.C b/src/usr/hwas/deconfigGard.C
index 082b0e930..84695f034 100644
--- a/src/usr/hwas/deconfigGard.C
+++ b/src/usr/hwas/deconfigGard.C
@@ -55,6 +55,34 @@ trace_desc_t* g_trac_deconf = NULL;
namespace HWAS
{
+errlHndl_t collectGard()
+{
+ TRAC_INF("collectGard entry" );
+
+ errlHndl_t errl = theDeconfigGard().clearGardRecordsForReplacedTargets();
+
+ if (errl)
+ {
+ TRAC_ERR("ERROR: collectGard failed to clear GARD Records for "
+ "replaced Targets");
+ }
+ else
+ {
+ errl = theDeconfigGard().deconfigureTargetsFromGardRecordsForIpl();
+
+ if (errl)
+ {
+ TRAC_ERR("ERROR: collectGard failed to deconfigure Targets "
+ "from GARD Records for IPL");
+ }
+ else
+ {
+ TRAC_INF("collectGard completed successfully");
+ }
+ }
+ return errl;
+}
+
//******************************************************************************
DeconfigGard & theDeconfigGard()
{
diff --git a/src/usr/hwas/hwas.C b/src/usr/hwas/hwas.C
index 172ec6315..c451b536f 100644
--- a/src/usr/hwas/hwas.C
+++ b/src/usr/hwas/hwas.C
@@ -34,294 +34,211 @@
// Includes
/******************************************************************************/
#include <stdint.h>
+#include <assert.h>
-#include <kernel/console.H>
-#include <trace/interface.H>
-#include <initservice/taskargs.H>
-#include <errl/errlentry.H>
#include <targeting/targetservice.H>
#include <targeting/iterators/rangefilter.H>
#include <targeting/predicates/predicates.H>
-#include <fsi/fsiif.H>
+#include <targeting/util.H>
#include <hwas/hwas.H>
-#include <hwas/deconfigGard.H>
-#include <targeting/util.H>
+#include <hwas/hwasCommon.H>
namespace HWAS
{
-trace_desc_t *g_trac_hwas = NULL;
-TRAC_INIT(&g_trac_hwas, "HWAS", 2048 );
using namespace TARGETING;
+//@todo - This should come from the target/attribute code somewhere
+uint64_t target_to_uint64(const Target* i_target)
+{
+ uint64_t id = 0;
+ if (i_target == NULL)
+ {
+ id = 0x0;
+ }
+ else if (i_target == MASTER_PROCESSOR_CHIP_TARGET_SENTINEL)
+ {
+ id = 0xFFFFFFFFFFFFFFFF;
+ }
+ else
+ {
+ // physical path, 3 nibbles per type/instance pair
+ // TIITIITII... etc.
+ EntityPath epath;
+ i_target->tryGetAttr<ATTR_PHYS_PATH>(epath);
+ for (uint32_t x = 0; x < epath.size(); x++)
+ {
+ id = id << 12;
+ id |= (uint64_t)((epath[x].type << 8) & 0xF00);
+ id |= (uint64_t)(epath[x].instance & 0x0FF);
+ }
+ }
+ return id;
+}
+
+
/**
- * @brief simple helper fn to clear hwas state
+ * @brief simple helper function to get and set hwas to clear state
*
- * @param[in] - i_rhwasState - ref to HwasState attribute struct
+ * @param[in] i_target pointer to target that we're looking at
*
- * @return - none
+ * @return none
*/
-void clearHwasState( TARGETING::HwasState &i_rhwasState )
+void clearHwasState(Target * i_target)
{
- i_rhwasState.poweredOn = false;
- i_rhwasState.present = false;
- i_rhwasState.functional = false;
- i_rhwasState.changedSinceLastIPL = false;
- i_rhwasState.gardLevel = 0;
-
+ HwasState hwasState = i_target->getAttr<ATTR_HWAS_STATE>();
+ hwasState.poweredOn = false;
+ hwasState.present = false;
+ hwasState.functional = false;
+ hwasState.changedSinceLastIPL = false;
+ hwasState.gardLevel = 0;
+ i_target->setAttr<ATTR_HWAS_STATE>(hwasState);
}
-
/**
- * @brief simple helper fn to set hwas state to poweredOn, present, functional
+ * @brief simple helper fn to get and set hwas state to poweredOn,
+ * present, functional
*
- * @param[in] - i_rhwasState - ref to HwasState attribute struct
+ * @param[in] i_target pointer to target that we're looking at
*
- * @return - none
+ * @return none
*
*/
-void enableHwasState( TARGETING::HwasState &i_rhwasState )
+void enableHwasState(Target *i_target)
{
- i_rhwasState.poweredOn = true;
- i_rhwasState.present = true;
- i_rhwasState.functional = true;
- i_rhwasState.changedSinceLastIPL = false;
- i_rhwasState.gardLevel = 0;
-
+ HwasState hwasState = i_target->getAttr<ATTR_HWAS_STATE>();
+ hwasState.poweredOn = true;
+ hwasState.present = true;
+ hwasState.functional = true;
+ i_target->setAttr<ATTR_HWAS_STATE>( hwasState );
}
-void init_target_states( void *io_pArgs )
+errlHndl_t discoverTargets()
{
- errlHndl_t l_errl = NULL;
- TARGETING::HwasState l_hwasState;
-
- TRACDCOMP( g_trac_hwas, "init_target_states entry: set default HWAS state:" );
+ HWAS_DBG("discoverTargets entry");
+ errlHndl_t errl = NULL;
// loop through all the targets and set HWAS_STATE to a known default
- TARGETING::TargetIterator l_TargetItr = TARGETING::targetService().begin();
- for( ;
- l_TargetItr != TARGETING::targetService().end();
- ++l_TargetItr
- )
+ for (TargetIterator target = targetService().begin();
+ target != targetService().end();
+ ++target)
{
- l_hwasState = l_TargetItr->getAttr<ATTR_HWAS_STATE>();
- clearHwasState(l_hwasState);
- l_TargetItr->setAttr<ATTR_HWAS_STATE>( l_hwasState );
+ clearHwasState(*target);
}
- /**
- * @todo Enable cpu 0 and centaur 0 for now.
- */
- // $$$$$ TEMPORARY $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- // get the master processor, this should be CPU 0
- TARGETING::Target* l_pMasterProcChipTargetHandle = NULL;
- (void)TARGETING::targetService().masterProcChipTargetHandle(
- l_pMasterProcChipTargetHandle);
- if (l_pMasterProcChipTargetHandle == NULL)
- {
- TRACFCOMP( g_trac_hwas, "FAILED to get master processor target");
- }
- else
- {
- // set master chip to poweredOn, present, functional
-
- l_hwasState = l_pMasterProcChipTargetHandle->getAttr<ATTR_HWAS_STATE>();
- enableHwasState( l_hwasState );
- l_pMasterProcChipTargetHandle->setAttr<ATTR_HWAS_STATE>( l_hwasState );
-
- // get the mcs "chiplets" associated with this cpu
- TARGETING::PredicateCTM l_mcsChipFilter(CLASS_UNIT, TYPE_MCS);
- TARGETING::TargetHandleList l_mcsTargetList;
- TARGETING::targetService().getAssociated(
- l_mcsTargetList,
- l_pMasterProcChipTargetHandle,
- TARGETING::TargetService::CHILD,
- TARGETING::TargetService::IMMEDIATE,
- &l_mcsChipFilter );
- // debug...
- TRACDCOMP( g_trac_hwas,
- "%d MCSs for master processor",
- l_mcsTargetList.size() );
-
- for ( uint8_t i=0; i < l_mcsTargetList.size(); i++ )
- {
- // set each MCS to poweredON, present, functional
- l_hwasState = l_mcsTargetList[i]->getAttr<ATTR_HWAS_STATE>();
- enableHwasState( l_hwasState );
- l_mcsTargetList[i]->setAttr<ATTR_HWAS_STATE>( l_hwasState );
-
+ // ASSUMPTIONS: Physical hierarchy is:
+ // CLASS_SYS (exactly 1)
+ // \->children: CLASS_ENC
+ // \->children: CLASS_* where ALL require hardware query
+ // \->children: CLASS_* where NONE require hardware query
- // If ATTR_CHIP_UNIT==0 or 1, find the centaur underneath it
- // and set it to good as well.
- if ( ( l_mcsTargetList[i]->getAttr<ATTR_CHIP_UNIT>() == 0 )
- || ( l_mcsTargetList[i]->getAttr<ATTR_CHIP_UNIT>() == 1 )
- )
- {
- TARGETING::PredicateCTM l_membufChips(CLASS_CHIP, TYPE_MEMBUF);
- TARGETING::TargetHandleList l_memTargetList;
- TARGETING::targetService().getAssociated(l_memTargetList,
- l_mcsTargetList[i],
- TARGETING::TargetService::CHILD_BY_AFFINITY,
- TARGETING::TargetService::ALL,
- &l_membufChips);
- // debug...
- TRACDCOMP( g_trac_hwas,
- "%d MEMBUFSs associated with MCS %d",
- l_memTargetList.size(),
- l_mcsTargetList[i]->getAttr<ATTR_CHIP_UNIT>() );
-
- for ( uint8_t ii=0; ii < l_memTargetList.size(); ii++ )
- {
- // set the Centaur(s) connected to MCS0&1 to poweredOn,
- // present, functional
- l_hwasState = l_memTargetList[ii]->getAttr<ATTR_HWAS_STATE>();
- enableHwasState( l_hwasState );
- l_memTargetList[ii]->setAttr<ATTR_HWAS_STATE>( l_hwasState );
-
-
- // enable MBA's for each centaur
- TARGETING::PredicateCTM l_mbaFilter(CLASS_UNIT, TYPE_MBA);
- TARGETING::TargetHandleList l_mbaTargetList;
- TARGETING::targetService().getAssociated(l_mbaTargetList,
- l_memTargetList[ii],
- TARGETING::TargetService::CHILD_BY_AFFINITY,
- TARGETING::TargetService::ALL, &l_mbaFilter);
- TRACDCOMP( g_trac_hwas,
- "%d MBA's with MEMBUF %d",
- l_mbaTargetList.size(),
- ii );
-
- for ( uint8_t ij=0; ij < l_mbaTargetList.size(); ij++ )
- {
- l_hwasState = l_mbaTargetList[ij]->getAttr<ATTR_HWAS_STATE>();
- enableHwasState( l_hwasState );
- l_mbaTargetList[ij]->setAttr<ATTR_HWAS_STATE>( l_hwasState );
- }
-
-
- // look for the dimms on each centaur
- TARGETING::PredicateCTM l_dimms(CLASS_LOGICAL_CARD, TYPE_DIMM);
- TARGETING::TargetHandleList l_dimmTargetList;
- TARGETING::targetService().getAssociated(l_dimmTargetList,
- l_memTargetList[ii],
- TARGETING::TargetService::CHILD_BY_AFFINITY,
- TARGETING::TargetService::ALL, &l_dimms);
- // debug...
- TRACDCOMP( g_trac_hwas,
- " %d DIMMs associated with MEM %d",
- l_dimmTargetList.size(), ii);
-
- // Return fapi::Targets to the caller
- for (uint32_t iii = 0; iii < l_dimmTargetList.size(); iii++)
- {
- // set the dimm(s) connected to MCS0 to poweredOn,
- // present, functional
- l_hwasState = l_dimmTargetList[iii]->getAttr<ATTR_HWAS_STATE>();
- l_hwasState.poweredOn = true;
- l_hwasState.present = true;
- l_hwasState.functional = true;
- l_hwasState.changedSinceLastIPL = false;
- l_hwasState.gardLevel = 0;
- l_dimmTargetList[iii]->setAttr<ATTR_HWAS_STATE>( l_hwasState );
- } // end for iii dimTargets
- } // end for ii memTargets
- } // end if only 0 and 1
- } // end for i mcsTargets
- } // end else
- // $$$$$ TEMPORARY $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
-
- TRACFCOMP( g_trac_hwas, "$$ init_target_states DEBUG: return %p", l_errl );
- task_end2( l_errl );
-}
+ // find CLASS_SYS (the top level target)
+ Target* pSys;
+ targetService().getTopLevelTarget(pSys);
-
-void init_fsi( void *io_pArgs )
-{
- errlHndl_t l_errl = NULL;
-
- TRACDCOMP( g_trac_hwas, "init_fsi entry" );
-
- l_errl = FSI::initializeHardware( );
- if ( l_errl )
+ do
{
- TRACFCOMP( g_trac_hwas, "ERROR: failed to init FSI hardware" );
- }
-
- task_end2( l_errl );
-}
-
-
-void apply_fsi_info( void *io_pArgs )
-{
- errlHndl_t l_errl = NULL;
-
- TRACDCOMP( g_trac_hwas, "apply_fsi_info entry" );
-
-
- task_end2( l_errl );
-}
-
-void apply_dd_presence( void *io_pArgs )
-{
- errlHndl_t l_errl = NULL;
-
- TRACDCOMP( g_trac_hwas, "apply_dd_presence entry" );
-
-
- task_end2( l_errl );
-}
-
-void apply_pr_keyword_data( void *io_pArgs )
-{
- errlHndl_t l_errl = NULL;
-
- TRACDCOMP( g_trac_hwas, "apply_pr_keyword_data" );
-
-
- task_end2( l_errl );
-}
-
-void apply_partial_bad( void *io_pArgs )
-{
- errlHndl_t l_errl = NULL;
-
- TRACDCOMP( g_trac_hwas, "apply_partial_bad entry" );
-
+ if (pSys == NULL)
+ {
+ // shouldn't happen, but if it does, then we're done - nothing present.
+ HWAS_ERR("pSys NULL - nothing present");
+ break; // break out of the do/while so that we can return
+ }
- task_end2( l_errl );
-}
+ // mark this as present
+ enableHwasState(pSys);
+ HWAS_DBG("pSys %x (%p) %x/%x - marked present",
+ target_to_uint64(pSys), pSys,
+ pSys->getAttr<ATTR_CLASS>(), pSys->getAttr<ATTR_TYPE>());
+
+ // find CLASS_ENC
+ PredicateCTM predEnc(CLASS_ENC);
+ TargetHandleList pEncList;
+ targetService().getAssociated( pEncList, pSys,
+ TargetService::CHILD, TargetService::ALL, &predEnc );
+
+ for (TargetHandleList::iterator pEnc_it = pEncList.begin();
+ pEnc_it != pEncList.end();
+ pEnc_it++)
+ {
+ TargetHandle_t pEnc = *pEnc_it;
+
+ // mark it as present
+ enableHwasState(pEnc);
+ HWAS_DBG("pEnc %x (%p) %x/%x - marked present",
+ target_to_uint64(pEnc), pEnc,
+ pEnc->getAttr<ATTR_CLASS>(), pEnc->getAttr<ATTR_TYPE>());
+
+ // now find the physical children
+ TargetHandleList pChildList;
+ targetService().getAssociated(pChildList, pEnc,
+ TargetService::CHILD, TargetService::IMMEDIATE);
+
+ // pass this list of children to the hwas common api
+ // pChildList will be modified to only have present targets
+ HWAS_DBG("pChildList size before %d", pChildList.size());
+ errl = platPresenceDetect(pChildList);
+ HWAS_DBG("pChildList size after %d", pChildList.size());
+
+ if (errl != NULL)
+ {
+ break; // get out of the pEnc loop
+ }
-void apply_gard( void *io_pArgs )
-{
- errlHndl_t l_errl = NULL;
+ // read Chip ID/EC data from these physical chips, since they
+ // are present
+ errl = platReadIDEC(pChildList);
- TRACDCOMP( g_trac_hwas, "apply_gard entry" );
+ if (errl != NULL)
+ {
+ break; // get out of the pEnc loop
+ }
- l_errl = theDeconfigGard().clearGardRecordsForReplacedTargets();
+ // no errors - keep going
- if (l_errl)
- {
- TRACFCOMP(g_trac_hwas, "ERROR: apply_gard failed to clear GARD Records for replaced Targets");
- }
- else
+ // at this point, pChildList only has present targets
+ // for each, mark them and their descendants as present
+ for (TargetHandleList::iterator pChild_it = pChildList.begin();
+ pChild_it != pChildList.end();
+ pChild_it++)
+ {
+ TargetHandle_t pChild = *pChild_it;
+
+ // set HWAS state to show it's present
+ enableHwasState(pChild);
+ HWAS_DBG("pChild %x (%p) %x/%x - detected present",
+ target_to_uint64(pChild), pChild,
+ pChild->getAttr<ATTR_CLASS>(),
+ pChild->getAttr<ATTR_TYPE>());
+
+ // now need to mark all of this target's
+ // physical descendants as present
+ TargetHandleList pDescList;
+ targetService().getAssociated( pDescList, pChild,
+ TargetService::CHILD, TargetService::ALL);
+ for (TargetHandleList::iterator pDesc_it = pDescList.begin();
+ pDesc_it != pDescList.end();
+ pDesc_it++)
+ {
+ TargetHandle_t pDesc = *pDesc_it;
+ enableHwasState(pDesc);
+ HWAS_DBG("pDsnds %x (%p) %x/%x - marked present",
+ target_to_uint64(pDesc), pDesc,
+ pDesc->getAttr<ATTR_CLASS>(),
+ pDesc->getAttr<ATTR_TYPE>());
+ }
+ } // for pChild_it
+ } // for pEnc_it
+ } while (0);
+
+ if (errl != NULL)
{
- l_errl = theDeconfigGard().deconfigureTargetsFromGardRecordsForIpl();
-
- if (l_errl)
- {
- TRACFCOMP(g_trac_hwas, "ERROR: apply_gard failed to deconfigure Targets from GARD Records for IPL");
- }
- else
- {
- TRACFCOMP(g_trac_hwas, "apply_gard completed successfully");
- }
+ HWAS_ERR("returning errl %p", errl);
}
-
- task_end2( l_errl );
-}
-
+ return errl;
+} // discoverTargets
}; // end namespace
diff --git a/src/usr/hwas/makefile b/src/usr/hwas/makefile
index fa5cb6118..1c7223a9e 100644
--- a/src/usr/hwas/makefile
+++ b/src/usr/hwas/makefile
@@ -20,17 +20,22 @@
# Origin: 30
#
# IBM_PROLOG_END
+
ROOTPATH = ../../..
-EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer
-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/hwas
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwas/plat
+
+VPATH += ${ROOTPATH}/src/usr/hwas/plat
MODULE = hwas
-OBJS = hwas.o deconfigGard.o testHWP.o
+# files in this directory
+OBJS = hwas.o deconfigGard.o
+
+# files in hwas/plat
+OBJS += hwasPlat.o hostbootIstep.o
-SUBDIRS=test.d
+SUBDIRS = test.d
include ${ROOTPATH}/config.mk
diff --git a/src/usr/hwas/plat/hostbootIstep.C b/src/usr/hwas/plat/hostbootIstep.C
new file mode 100644
index 000000000..ad478d131
--- /dev/null
+++ b/src/usr/hwas/plat/hostbootIstep.C
@@ -0,0 +1,74 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/usr/hwas/plat/hostbootIstep.C $
+//
+// IBM CONFIDENTIAL
+//
+// COPYRIGHT International Business Machines Corp. 2012
+//
+// 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 hostbootIstep.C
+ *
+ * @brief hostboot istep-called functions
+ */
+
+#include <hwas/hwas.H>
+#include <hwas/hwasCommon.H>
+
+#include <hwas/plat/hostbootIstep.H>
+#include <hwas/deconfigGard.H>
+
+#include <fsi/fsiif.H>
+#include <initservice/taskargs.H>
+
+namespace HWAS
+{
+
+// functions called from the istep dispatcher -- hostboot only
+
+//******************************************************************************
+// host_init_fsi function
+//******************************************************************************
+void host_init_fsi( void *io_pArgs )
+{
+ errlHndl_t errl = FSI::initializeHardware( );
+
+ task_end2(errl);
+}
+
+//******************************************************************************
+// host_discover_targets function
+//******************************************************************************
+void host_discover_targets( void *io_pArgs )
+{
+ errlHndl_t errl = discoverTargets();
+
+ task_end2(errl);
+}
+
+
+//******************************************************************************
+// host_gard function
+//******************************************************************************
+void host_gard( void *io_pArgs )
+{
+ errlHndl_t errl = collectGard();
+
+ task_end2(errl);
+}
+
+} // namespace HWAS
diff --git a/src/usr/hwas/plat/hwasPlat.C b/src/usr/hwas/plat/hwasPlat.C
new file mode 100644
index 000000000..8538a8fac
--- /dev/null
+++ b/src/usr/hwas/plat/hwasPlat.C
@@ -0,0 +1,214 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/usr/hwas/plat/hwasPlat.C $
+//
+// IBM CONFIDENTIAL
+//
+// COPYRIGHT International Business Machines Corp. 2012
+//
+// 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 hwasPlat.C
+ *
+ * @brief Platform specifics
+ */
+
+#include <hwas/hwas.H>
+#include <hwas/hwasCommon.H>
+
+#include <devicefw/driverif.H>
+
+// trace setup; used by HWAS_DBG and HWAS_ERR macros
+trace_desc_t *g_trac_dbg_hwas = NULL; // debug - fast
+trace_desc_t *g_trac_imp_hwas = NULL; // important - slow
+
+TRAC_INIT(&g_trac_dbg_hwas, "HWAS", 2048 );
+TRAC_INIT(&g_trac_imp_hwas, "HWAS_I", 2048 );
+
+namespace HWAS
+{
+
+using namespace TARGETING;
+
+uint64_t target_to_uint64(const Target* i_target);
+
+//******************************************************************************
+// platReadIDEC function
+//******************************************************************************
+errlHndl_t platReadIDEC(const TargetHandleList &i_targets)
+{
+ errlHndl_t errl = NULL;
+
+ // we have to handle the master processor chip special, so figure
+ // out what it is first
+ Target* pMasterProc = NULL;
+ targetService().masterProcChipTargetHandle(pMasterProc);
+
+ // we got a list of targets - read the ID/EC for eacn
+ // and update the appropriate ATTR_ fields.
+ for (TargetHandleList::const_iterator pTarget_it = i_targets.begin();
+ pTarget_it != i_targets.end();
+ pTarget_it++)
+ {
+ TargetHandle_t pTarget = *pTarget_it;
+
+ if (pTarget == pMasterProc)
+ {
+ // we have to handle this special and first. issue is that we can't
+ // do a deviceRead of an FSI address on 'ourselves'. so, if the
+ // target is the master proccessor, which is where we are running,
+ // then we need to do the deviceRead of the SCOM address.
+ uint64_t id_ec;
+ size_t op_size = sizeof(id_ec);
+ errl = DeviceFW::deviceRead(pTarget, &id_ec,
+ op_size, DEVICE_SCOM_ADDRESS(0x000F000Full));
+
+ if (errl == NULL)
+ { // no error, so we got a valid ID/EC value back
+ // EC - nibbles 0,2
+ // 01234567
+ uint8_t ec = (((id_ec & 0xF000000000000000ull) >> 56) |
+ ((id_ec & 0x00F0000000000000ull) >> 52));
+ pTarget->setAttr<ATTR_EC>(ec);
+
+ // ID - nibbles 1,5,3,4
+ // 01234567
+ uint32_t id = (((id_ec & 0x0F00000000000000ull) >> 44) |
+ ((id_ec & 0x00000F0000000000ull) >> 32) |
+ ((id_ec & 0x000F000000000000ull) >> 44) |
+ ((id_ec & 0x0000F00000000000ull) >> 44));
+ pTarget->setAttr<ATTR_CHIP_ID>(id);
+ HWAS_DBG( "pTarget %x (%p) id %x ec %x",
+ target_to_uint64(pTarget), pTarget, id, ec);
+ }
+ else
+ { // errl was set - this is an error condition.
+ HWAS_ERR( "pTarget %x (%p) %x/%x - failed ID/EC read",
+ target_to_uint64(pTarget), pTarget,
+ pTarget->getAttr<ATTR_CLASS>(),
+ pTarget->getAttr<ATTR_TYPE>());
+
+ // break out so that we can return an error
+ break;
+ }
+ } else if (pTarget->getAttr<ATTR_CLASS>() == CLASS_CHIP)
+ { // CLASS_CHIP only
+ uint32_t id_ec;
+ size_t op_size = sizeof(id_ec);
+ errl = DeviceFW::deviceRead(pTarget, &id_ec,
+ op_size, DEVICE_FSI_ADDRESS(0x1028));
+
+ if (errl == NULL)
+ { // no error, so we got a valid ID/EC value back
+ // EC - nibbles 0,2
+ // 01234567
+ uint8_t ec = (((id_ec & 0xF0000000) >> 24) |
+ ((id_ec & 0x00F00000) >> 20));
+ pTarget->setAttr<ATTR_EC>(ec);
+
+ // ID - nibbles 1,5,3,4
+ // 01234567
+ uint32_t id = (((id_ec & 0x0F000000) >> 12) |
+ ((id_ec & 0x00000F00) >> 0) |
+ ((id_ec & 0x000F0000) >> 12) |
+ ((id_ec & 0x0000F000) >> 12));
+ pTarget->setAttr<ATTR_CHIP_ID>(id);
+ HWAS_DBG( "pTarget %x (%p) id %x ec %x",
+ target_to_uint64(pTarget), pTarget, id, ec);
+ }
+ else
+ { // errl was set - this is an error condition.
+ HWAS_ERR( "pTarget %x (%p) %x/%x - failed ID/EC read",
+ target_to_uint64(pTarget), pTarget,
+ pTarget->getAttr<ATTR_CLASS>(),
+ pTarget->getAttr<ATTR_TYPE>());
+
+ // break out so that we can return an error
+ break;
+ }
+ }
+ else
+ { // skipping - no ID/EC on this target
+ HWAS_DBG( "pTarget %x (%p) %x/%x - skipping",
+ target_to_uint64(pTarget), pTarget,
+ pTarget->getAttr<ATTR_CLASS>(),
+ pTarget->getAttr<ATTR_TYPE>());
+ }
+ } // for pTarget_it
+
+ return errl;
+} // platReadIDEC
+
+//******************************************************************************
+// platPresenceDetect function
+//******************************************************************************
+errlHndl_t platPresenceDetect(TargetHandleList &io_targets)
+{
+ errlHndl_t errl = NULL;
+
+ // we got a list of targets - determine if they are present
+ // if not, delete them from the list
+ for (TargetHandleList::iterator pTarget_it = io_targets.begin();
+ pTarget_it != io_targets.end();
+ ) // increment will be done in the loop below
+ {
+ TargetHandle_t pTarget = *pTarget_it;
+
+ // call deviceRead() to see if they are present
+ bool present = false;
+ size_t presentSize = sizeof(present);
+ errl = deviceRead(pTarget, &present, presentSize,
+ DEVICE_PRESENT_ADDRESS());
+
+ if (errl == NULL)
+ { // no error, so we got a valid present value back
+ if (present == true)
+ {
+ HWAS_DBG( "io_targets %x (%p) %x/%x - detected present",
+ target_to_uint64(pTarget), pTarget,
+ pTarget->getAttr<ATTR_CLASS>(),
+ pTarget->getAttr<ATTR_TYPE>());
+
+ // advance to next entry in the list
+ pTarget_it++;
+ }
+ else
+ { // chip no present -- remove from list
+ HWAS_DBG( "io_targets %x (%p) %x/%x - no presence",
+ target_to_uint64(pTarget), pTarget,
+ pTarget->getAttr<ATTR_CLASS>(),
+ pTarget->getAttr<ATTR_TYPE>());
+
+ // erase this target, and 'increment' to next
+ pTarget_it = io_targets.erase(pTarget_it);
+ }
+ }
+ else
+ { // errl was set - this is an error condition.
+ HWAS_ERR( "io_targets %x (%p) %x/%x - failed presence detect",
+ target_to_uint64(pTarget), pTarget,
+ pTarget->getAttr<ATTR_CLASS>(),
+ pTarget->getAttr<ATTR_TYPE>());
+
+ // break out so that we can return an error
+ break;
+ }
+ } // for pTarget_it
+
+ return errl;
+} // platPresenceDetect
+
+} // namespace HWAS
diff --git a/src/usr/hwas/testHWP.C b/src/usr/hwas/testHWP.C
index 9de820c13..a95a92a9b 100644
--- a/src/usr/hwas/testHWP.C
+++ b/src/usr/hwas/testHWP.C
@@ -59,13 +59,13 @@
using namespace fapi;
using namespace TARGETING;
-namespace HWAS
-{
-
/******************************************************************************/
// Globals/Constants
/******************************************************************************/
-extern trace_desc_t *g_trac_hwas;
+extern trace_desc_t *g_trac_imp_hwas;
+
+namespace HWAS
+{
void testHWP( void * io_pArgs )
{
diff --git a/src/usr/hwpf/hwp/chip_attributes.xml b/src/usr/hwpf/hwp/chip_attributes.xml
index 6745da328..4a952be69 100644
--- a/src/usr/hwpf/hwp/chip_attributes.xml
+++ b/src/usr/hwpf/hwp/chip_attributes.xml
@@ -28,6 +28,18 @@
<attributes>
<!-- ********************************************************************* -->
<attribute>
+ <id>ATTR_CHIP_ID</id>
+ <targetType>TARGET_TYPE_PROC_CHIP,TARGET_TYPE_MEMBUF_CHIP</targetType>
+ <description>
+ ID of a chip target
+ Read from the chip by the platform
+ </description>
+ <valueType>uint32</valueType>
+ <platInit/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
<id>ATTR_EC</id>
<targetType>TARGET_TYPE_PROC_CHIP,TARGET_TYPE_MEMBUF_CHIP</targetType>
<description>
diff --git a/src/usr/targeting/xmltohb/attribute_types.xml b/src/usr/targeting/xmltohb/attribute_types.xml
index 7d125b392..cf12dc9bd 100644
--- a/src/usr/targeting/xmltohb/attribute_types.xml
+++ b/src/usr/targeting/xmltohb/attribute_types.xml
@@ -2640,6 +2640,23 @@
</attribute>
<attribute>
+ <id>CHIP_ID</id>
+ <description>attribute indicating the chip's ID</description>
+ <simpleType>
+ <uint32_t>
+ <default>0</default>
+ </uint32_t>
+ </simpleType>
+ <persistency>volatile-zeroed</persistency>
+ <readable/>
+ <writeable/>
+ <hwpfToHbAttrMap>
+ <id>ATTR_CHIP_ID</id>
+ <macro>DIRECT</macro>
+ </hwpfToHbAttrMap>
+</attribute>
+
+<attribute>
<id>FSI_GP_REG_SCOM_ACCESS</id>
<description>attribute indicating if the chip's FSI GP regs have scom access</description>
<simpleType><uint8_t></uint8_t></simpleType>
diff --git a/src/usr/targeting/xmltohb/target_types.xml b/src/usr/targeting/xmltohb/target_types.xml
index 46bd00ffd..c4aee6ddb 100644
--- a/src/usr/targeting/xmltohb/target_types.xml
+++ b/src/usr/targeting/xmltohb/target_types.xml
@@ -130,6 +130,9 @@
<attribute>
<id>EC</id>
</attribute>
+ <attribute>
+ <id>CHIP_ID</id>
+ </attribute>
</targetType>
<targetType>
OpenPOWER on IntegriCloud