summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/build/tools/genIStep.pl9
-rw-r--r--src/include/usr/devicefw/driverif.H2
-rw-r--r--src/include/usr/devicefw/userif.H2
-rw-r--r--src/include/usr/diag/mdia/mdia.H2
-rwxr-xr-xsrc/include/usr/diag/prdf/prdf_proto.H2
-rw-r--r--src/include/usr/hwas/deconfigGard.H3
-rw-r--r--src/include/usr/hwas/hwasCommon.H4
-rwxr-xr-xsrc/include/usr/hwpf/plat/fapiPlatAttributeService.H3
-rw-r--r--src/include/usr/targeting/adapters/assertadapter.H60
-rw-r--r--src/include/usr/targeting/adapters/erroradapter.H60
-rw-r--r--src/include/usr/targeting/adapters/traceadapter.H56
-rw-r--r--src/include/usr/targeting/adapters/types.H65
-rw-r--r--src/include/usr/targeting/attrrp.H216
-rw-r--r--src/include/usr/targeting/common/attributes.H (renamed from src/include/usr/targeting/attributes.H)13
-rw-r--r--src/include/usr/targeting/common/commontargeting.H45
-rw-r--r--src/include/usr/targeting/common/entitypath.H (renamed from src/include/usr/targeting/entitypath.H)16
-rw-r--r--src/include/usr/targeting/common/error.H40
-rw-r--r--src/include/usr/targeting/common/iterators/iterators.H39
-rw-r--r--src/include/usr/targeting/common/iterators/rangefilter.H (renamed from src/include/usr/targeting/iterators/rangefilter.H)26
-rw-r--r--src/include/usr/targeting/common/iterators/targetiterator.H (renamed from src/include/usr/targeting/iterators/targetiterator.H)8
-rw-r--r--src/include/usr/targeting/common/pointer.H85
-rw-r--r--src/include/usr/targeting/common/predicates/predicatebase.H (renamed from src/include/usr/targeting/predicates/predicatebase.H)8
-rw-r--r--src/include/usr/targeting/common/predicates/predicatectm.H (renamed from src/include/usr/targeting/predicates/predicatectm.H)19
-rw-r--r--src/include/usr/targeting/common/predicates/predicateisfunctional.H (renamed from src/include/usr/targeting/predicates/predicateisfunctional.H)26
-rw-r--r--src/include/usr/targeting/common/predicates/predicatepostfixexpr.H (renamed from src/include/usr/targeting/predicates/predicatepostfixexpr.H)23
-rw-r--r--src/include/usr/targeting/common/predicates/predicates.H (renamed from src/include/usr/targeting/predicates/predicates.H)17
-rw-r--r--src/include/usr/targeting/common/target.H (renamed from src/include/usr/targeting/target.H)34
-rw-r--r--src/include/usr/targeting/common/targetservice.H (renamed from src/include/usr/targeting/targetservice.H)40
-rw-r--r--src/include/usr/targeting/common/targreasoncodes.H54
-rw-r--r--src/include/usr/targeting/common/trace.H (renamed from src/usr/targeting/trace.H)26
-rw-r--r--src/include/usr/targeting/common/util.H (renamed from src/include/usr/targeting/util.H)35
-rw-r--r--src/include/usr/targeting/targreasoncodes.H46
-rw-r--r--src/include/usr/vmmconst.h6
-rw-r--r--src/usr/diag/mdia/mdiafwd.H3
-rwxr-xr-xsrc/usr/diag/mdia/mdiamonitor.C2
-rw-r--r--src/usr/diag/mdia/test/mdiatest.H2
-rw-r--r--src/usr/diag/mdia/test/mdiatestmba.H2
-rw-r--r--src/usr/diag/mdia/test/mdiatestmonitor.H2
-rw-r--r--src/usr/diag/mdia/test/mdiatesttrace.H2
-rw-r--r--src/usr/diag/mdia/test/mdiatestworkitem.H2
-rwxr-xr-xsrc/usr/diag/prdf/iipconst.h2
-rwxr-xr-xsrc/usr/diag/prdf/prdf_main.C2
-rw-r--r--src/usr/diag/prdf/test/prdfTest.H22
-rw-r--r--src/usr/errl/errludtarget.C3
-rw-r--r--src/usr/fsi/fsidd.C4
-rw-r--r--src/usr/fsi/fsipres.C2
-rw-r--r--src/usr/fsi/test/fsiddtest.H2
-rw-r--r--src/usr/fsi/test/fsiprestest.H6
-rw-r--r--src/usr/hwas/deconfigGard.C2
-rw-r--r--src/usr/hwas/hwas.C5
-rw-r--r--src/usr/hwas/test/hwas1test.H8
-rw-r--r--src/usr/hwas/test/hwasGardTest.H2
-rw-r--r--src/usr/hwas/testHWP.C3
-rw-r--r--src/usr/hwpf/hwp/activate_powerbus/activate_powerbus.C9
-rw-r--r--src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.C9
-rw-r--r--src/usr/hwpf/hwp/core_activate/core_activate.C9
-rw-r--r--src/usr/hwpf/hwp/dmi_training/dmi_training.C10
-rw-r--r--src/usr/hwpf/hwp/dram_initialization/dram_initialization.C9
-rw-r--r--src/usr/hwpf/hwp/dram_training/dram_training.C11
-rw-r--r--src/usr/hwpf/hwp/edi_ei_initialization/edi_ei_initialization.C9
-rw-r--r--src/usr/hwpf/hwp/establish_system_smp/establish_system_smp.C9
-rwxr-xr-xsrc/usr/hwpf/hwp/fapiTestHwpAttr.C4
-rw-r--r--src/usr/hwpf/hwp/load_payload/load_payload.C9
-rw-r--r--src/usr/hwpf/hwp/mc_init/mc_init.C7
-rw-r--r--src/usr/hwpf/hwp/sbe_centaur_init/sbe_centaur_init.C14
-rw-r--r--src/usr/hwpf/hwp/start_clocks_on_nest_chiplets/start_clocks_on_nest_chiplets.C9
-rw-r--r--src/usr/hwpf/hwp/start_payload/start_payload.C9
-rw-r--r--src/usr/hwpf/plat/fapiPlatAttributeService.C2
-rw-r--r--src/usr/hwpf/plat/fapiPlatHwAccess.C5
-rw-r--r--src/usr/hwpf/plat/fapiPlatSystemConfig.C4
-rw-r--r--src/usr/hwpf/plat/fapiPlatTarget.C2
-rw-r--r--src/usr/hwpf/test/hwpftest.H4
-rwxr-xr-xsrc/usr/i2c/eepromdd.C2
-rwxr-xr-xsrc/usr/i2c/i2c.C2
-rwxr-xr-xsrc/usr/i2c/test/eepromddtest.H4
-rwxr-xr-xsrc/usr/i2c/test/i2ctest.H4
-rw-r--r--src/usr/initservice/istepdispatcher/istepdispatcher.C8
-rw-r--r--src/usr/initservice/istepdispatcher/splesscommon.H6
-rw-r--r--src/usr/initservice/istepdispatcher/sptask.C2
-rw-r--r--src/usr/intr/intrrp.C4
-rw-r--r--src/usr/intr/test/intrtest.H4
-rw-r--r--src/usr/mbox/mboxdd.C2
-rw-r--r--src/usr/mbox/test/mboxsptest.H2
-rwxr-xr-xsrc/usr/mvpd/mvpd.C2
-rwxr-xr-xsrc/usr/mvpd/test/mvpdtest.H2
-rw-r--r--src/usr/pnor/pnordd.C2
-rw-r--r--src/usr/pnor/pnorrp.C2
-rw-r--r--src/usr/pnor/test/pnorddtest.H2
-rw-r--r--src/usr/pore/test/poretest.H7
-rw-r--r--src/usr/scom/test/scomtest.H2
-rwxr-xr-xsrc/usr/spd/dimmPres.C2
-rwxr-xr-xsrc/usr/spd/spd.C2
-rwxr-xr-xsrc/usr/spd/test/dimmPrestest.H2
-rwxr-xr-xsrc/usr/spd/test/spdtest.H2
-rw-r--r--src/usr/targeting/attrrp.C76
-rw-r--r--src/usr/targeting/attrrp.H125
-rw-r--r--src/usr/targeting/common/common.mk59
-rw-r--r--src/usr/targeting/common/entitypath.C (renamed from src/usr/targeting/entitypath.C)42
-rw-r--r--src/usr/targeting/common/iterators/rangefilter.C (renamed from src/usr/targeting/iterators/rangefilter.C)4
-rw-r--r--src/usr/targeting/common/iterators/targetiterator.C (renamed from src/usr/targeting/iterators/targetiterator.C)6
-rw-r--r--src/usr/targeting/common/predicates/predicatebase.C (renamed from src/usr/targeting/predicates/predicatebase.C)4
-rw-r--r--src/usr/targeting/common/predicates/predicatectm.C (renamed from src/usr/targeting/predicates/predicatectm.C)7
-rw-r--r--src/usr/targeting/common/predicates/predicateisfunctional.C (renamed from src/usr/targeting/predicates/predicateisfunctional.C)12
-rw-r--r--src/usr/targeting/common/predicates/predicatepostfixexpr.C (renamed from src/usr/targeting/predicates/predicatepostfixexpr.C)26
-rw-r--r--src/usr/targeting/common/target.C (renamed from src/usr/targeting/target.C)54
-rw-r--r--src/usr/targeting/common/targetservice.C (renamed from src/usr/targeting/targetservice.C)179
-rw-r--r--src/usr/targeting/common/test/common.mk36
-rw-r--r--src/usr/targeting/common/test/testcommontargeting.H (renamed from src/usr/targeting/test/targetingtest.H)573
-rw-r--r--src/usr/targeting/common/test/unittest.H29
-rw-r--r--src/usr/targeting/common/util.C (renamed from src/usr/targeting/util.C)18
-rw-r--r--src/usr/targeting/common/xmltohb/attribute_types.xml (renamed from src/usr/targeting/xmltohb/attribute_types.xml)17
-rw-r--r--src/usr/targeting/common/xmltohb/common.mk76
-rwxr-xr-xsrc/usr/targeting/common/xmltohb/mergexml.sh (renamed from src/usr/targeting/xmltohb/mergexml.sh)0
-rw-r--r--src/usr/targeting/common/xmltohb/simics_MURANO.mrw.xml (renamed from src/usr/targeting/xmltohb/simics_MURANO.mrw.xml)0
-rw-r--r--src/usr/targeting/common/xmltohb/simics_MURANO.system.xml (renamed from src/usr/targeting/xmltohb/simics_MURANO.system.xml)0
-rw-r--r--src/usr/targeting/common/xmltohb/simics_VENICE.mrw.xml (renamed from src/usr/targeting/xmltohb/simics_VENICE.mrw.xml)0
-rw-r--r--src/usr/targeting/common/xmltohb/simics_VENICE.system.xml (renamed from src/usr/targeting/xmltohb/simics_VENICE.system.xml)0
-rw-r--r--src/usr/targeting/common/xmltohb/target_types.xml (renamed from src/usr/targeting/xmltohb/target_types.xml)0
-rw-r--r--src/usr/targeting/common/xmltohb/vbu.mrw.xml (renamed from src/usr/targeting/xmltohb/vbu.mrw.xml)0
-rw-r--r--src/usr/targeting/common/xmltohb/vbu.system.xml (renamed from src/usr/targeting/xmltohb/vbu.system.xml)0
-rwxr-xr-xsrc/usr/targeting/common/xmltohb/xmltohb.pl (renamed from src/usr/targeting/xmltohb/xmltohb.pl)130
-rw-r--r--src/usr/targeting/makefile52
-rw-r--r--src/usr/targeting/targetservicestart.C105
-rw-r--r--src/usr/targeting/test/makefile60
-rw-r--r--src/usr/targeting/test/testtargeting.H245
-rw-r--r--src/usr/targeting/test/unittestadapter.H45
-rw-r--r--src/usr/targeting/xmltohb/makefile106
-rw-r--r--src/usr/testcore/kernel/vmmbasetest.H2
-rw-r--r--src/usr/xscom/xscom.C2
129 files changed, 2297 insertions, 1172 deletions
diff --git a/src/build/tools/genIStep.pl b/src/build/tools/genIStep.pl
index fe5c97b05..2b5e9c4aa 100755
--- a/src/build/tools/genIStep.pl
+++ b/src/build/tools/genIStep.pl
@@ -320,14 +320,7 @@ my $templateCFileHdr =
#include <initservice/isteps_trace.H>
// targeting support
-#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>
-#include <targeting/predicates/predicateisfunctional.H>
+#include <targeting/common/commontargeting.H>
// fapi support
#include <fapi.H>
diff --git a/src/include/usr/devicefw/driverif.H b/src/include/usr/devicefw/driverif.H
index 74843e4f4..b17515abc 100644
--- a/src/include/usr/devicefw/driverif.H
+++ b/src/include/usr/devicefw/driverif.H
@@ -33,7 +33,7 @@
#include <devicefw/userif.H>
#include <stdarg.h>
#include <builtins.h>
-#include <targeting/targetservice.H>
+#include <targeting/common/targetservice.H>
namespace DeviceFW
{
diff --git a/src/include/usr/devicefw/userif.H b/src/include/usr/devicefw/userif.H
index acd5d5ada..4c7a116dd 100644
--- a/src/include/usr/devicefw/userif.H
+++ b/src/include/usr/devicefw/userif.H
@@ -33,7 +33,7 @@
#include <stdint.h>
#include <errl/errlentry.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/targetservice.H>
namespace DeviceFW
{
diff --git a/src/include/usr/diag/mdia/mdia.H b/src/include/usr/diag/mdia/mdia.H
index 45543d524..59a7132be 100644
--- a/src/include/usr/diag/mdia/mdia.H
+++ b/src/include/usr/diag/mdia/mdia.H
@@ -24,7 +24,7 @@
#define __MDIA_MDIA_H
#include <errl/errlentry.H>
-#include <targeting/target.H>
+#include <targeting/common/target.H>
/**
* @file mdia.H
diff --git a/src/include/usr/diag/prdf/prdf_proto.H b/src/include/usr/diag/prdf/prdf_proto.H
index 535435ed9..6edb2307a 100755
--- a/src/include/usr/diag/prdf/prdf_proto.H
+++ b/src/include/usr/diag/prdf/prdf_proto.H
@@ -38,7 +38,7 @@
#include <stdint.h>
#include <errl/errlentry.H>
-#include <targeting/target.H>
+#include <targeting/common/target.H>
namespace PRDF
{
diff --git a/src/include/usr/hwas/deconfigGard.H b/src/include/usr/hwas/deconfigGard.H
index 4a7b1cd3c..c3208e71e 100644
--- a/src/include/usr/hwas/deconfigGard.H
+++ b/src/include/usr/hwas/deconfigGard.H
@@ -35,8 +35,7 @@
#include <sys/sync.h>
#include <util/singleton.H>
#include <errl/errlentry.H>
-#include <targeting/target.H>
-#include <targeting/entitypath.H>
+#include <targeting/common/attributes.H>
namespace HWAS
{
diff --git a/src/include/usr/hwas/hwasCommon.H b/src/include/usr/hwas/hwasCommon.H
index 100113827..f6d5ce566 100644
--- a/src/include/usr/hwas/hwasCommon.H
+++ b/src/include/usr/hwas/hwasCommon.H
@@ -33,8 +33,8 @@
// 'system' headers
#include <stdint.h>
#include <errl/errlentry.H>
-#include <targeting/target.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/target.H>
+#include <targeting/common/targetservice.H>
// platform specific headers
diff --git a/src/include/usr/hwpf/plat/fapiPlatAttributeService.H b/src/include/usr/hwpf/plat/fapiPlatAttributeService.H
index f94e5dd4f..254dfd36e 100755
--- a/src/include/usr/hwpf/plat/fapiPlatAttributeService.H
+++ b/src/include/usr/hwpf/plat/fapiPlatAttributeService.H
@@ -46,8 +46,7 @@
#include <stdint.h>
#include <fapiAttributeIds.H>
-#include <targeting/target.H>
-#include <targeting/attributes.H>
+#include <targeting/common/attributes.H>
#include <attributeenums.H>
#include <fapiplatattrmacros.H>
#include <hwpf/fapi/fapiReturnCode.H>
diff --git a/src/include/usr/targeting/adapters/assertadapter.H b/src/include/usr/targeting/adapters/assertadapter.H
new file mode 100644
index 000000000..6a61f46c1
--- /dev/null
+++ b/src/include/usr/targeting/adapters/assertadapter.H
@@ -0,0 +1,60 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/targeting/adapters/assertadapter.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
+
+#ifndef __TARGETING_ASSERTADAPTER_H
+#define __TARGETING_ASSERTADAPTER_H
+
+/**
+ * @file targeting/adapters/assertadapter.H
+ * @brief Forward common targeting assert requests to the platform specific
+ * handlers
+ *
+ * There are two different assert types provided:
+ * Standard assert behavior:
+ * assert(foo)
+ *
+ * Standard assert behavior with a custom trace message:
+ * assert(foo, "This is a trace %d", 1234)
+ */
+
+//******************************************************************************
+// Includes
+//******************************************************************************
+
+#include <assert.h>
+
+/**
+ * @brief Forward common targeting assert requests to platform specific handler
+ *
+ * @par Detailed Description:
+ * Forwards assert request to platform specific assert macro which verifies
+ * condition, calls custom trace if provided, and ultimately calls platform
+ * assert
+ *
+ * @param[in] expr,...
+ * Printf-like expression to act as the assert message
+ */
+#define TARG_ASSERT(expr,...) \
+ assert(expr,__VA_ARGS__)
+
+#endif // __TARGETING_ASSERTADAPTER_H
diff --git a/src/include/usr/targeting/adapters/erroradapter.H b/src/include/usr/targeting/adapters/erroradapter.H
new file mode 100644
index 000000000..c9df881b6
--- /dev/null
+++ b/src/include/usr/targeting/adapters/erroradapter.H
@@ -0,0 +1,60 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/targeting/adapters/erroradapter.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
+
+#ifndef __TARGETING_ERRORADAPTER_H
+#define __TARGETING_ERRORADAPTER_H
+
+/**
+ * @file targeting/adapters/erroradapter.H
+ *
+ * @brief Adapts platform neutral error log requests to the platform
+ */
+
+//******************************************************************************
+// Includes
+//******************************************************************************
+
+// Include the platform specific errlentry.H file and pick up the platform
+// specific errlHndlt_t typedef. This is enough for common code to use pass
+// errlHndl_t pointers around and check for NULL
+#include <errl/errlentry.H>
+
+namespace COMMON
+{
+
+namespace ERRORLOG
+{
+ /**
+ * @brief Import the ::ERRORLOG namespace into the ::COMMON:ERRORLOG
+ * namespace. This allows all the common targeting code to use the
+ * same namespacing yet directly invoke platform specific error log
+ * support. Since nothing else is declared in the namespace, there is
+ * no danger of a namespace collision.
+ */
+ using namespace ::ERRORLOG;
+
+} // End namespace COMMON
+
+} // End namespace ERRORLOG
+
+#endif // __TARGETING_ERRORADAPTER_H
diff --git a/src/include/usr/targeting/adapters/traceadapter.H b/src/include/usr/targeting/adapters/traceadapter.H
new file mode 100644
index 000000000..493f8e06c
--- /dev/null
+++ b/src/include/usr/targeting/adapters/traceadapter.H
@@ -0,0 +1,56 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/targeting/adapters/traceadapter.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
+
+#ifndef __TARGETING_TRACEADAPTER_H
+#define __TARGETING_TRACEADAPTER_H
+
+/**
+ * @file targeting/adapters/traceadapter.H
+ *
+ * @brief Platform specific targeting trace macro support
+ */
+
+//******************************************************************************
+// Includes
+//******************************************************************************
+
+// Other Components
+#include <trace/interface.H>
+
+// Give callers access to the trace buffer
+namespace TARGETING
+{
+
+/**
+ * @brief Map common trace type to platform specific trace type
+ */
+typedef trace_desc_t* TARG_TD_t;
+
+/**
+ * @brief Export trace descriptor
+ */
+extern TARG_TD_t g_trac_targeting;
+
+} // End namespace TARGETING
+
+#endif // __TARGETING_TRACEADAPTER_H
diff --git a/src/include/usr/targeting/adapters/types.H b/src/include/usr/targeting/adapters/types.H
new file mode 100644
index 000000000..264a6e55c
--- /dev/null
+++ b/src/include/usr/targeting/adapters/types.H
@@ -0,0 +1,65 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/targeting/adapters/types.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
+
+#ifndef __TARGETING_TYPES_H
+#define __TARGETING_TYPES_H
+
+/**
+ * @file targeting/adapters/types.H
+ *
+ * @brief Platform specific type translation support
+ */
+
+//******************************************************************************
+// Includes
+//******************************************************************************
+
+#include <sys/sync.h>
+#include <util/singleton.H>
+#include <hbotcompid.H>
+#include <vmmconst.h>
+
+/**
+ * @brief Adapt common singleton declaration to specific platform
+ *
+ * @param[in] __T__
+ * Type of singleton, fully namespaced
+ *
+ * @param[in] __NAME__
+ * Symbol name for singleton
+ */
+#define TARG_DECLARE_SINGLETON(__T__,__NAME__) \
+ typedef Singleton<__T__> __NAME__;
+
+/**
+ * @brief Adapt common singleton "getter" to the specific platform
+ *
+ * @param[in] __TYPE__
+ * Typedef for singleton, as created above
+ *
+ * @return Singleton reference for the given singleton
+ */
+#define TARG_GET_SINGLETON(__TYPE__) \
+ __TYPE__::instance()
+
+#endif // __TARGETING_TYPES_H
diff --git a/src/include/usr/targeting/attrrp.H b/src/include/usr/targeting/attrrp.H
new file mode 100644
index 000000000..d5a4775a0
--- /dev/null
+++ b/src/include/usr/targeting/attrrp.H
@@ -0,0 +1,216 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/usr/targeting/attrrp.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 __TARGETING_ATTRRP_H
+#define __TARGETING_ATTRRP_H
+
+/**
+ * @file targeting/attrrp.H
+ *
+ * @brief Interface for the attribute resource provider, which manages the
+ * memory associated with targeting attributes and provides any
+ * translation, if necessary
+ */
+//******************************************************************************
+// Includes
+//******************************************************************************
+
+#include <initservice/taskargs.H>
+#include <sys/msg.h>
+#include <targeting/adapters/types.H>
+
+namespace TARGETING
+{
+
+// Forward declaration of attribute section parsed information structure.
+struct AttrRP_Section;
+
+/**
+ * @class AttrRP
+ *
+ * @brief Attribute Resource Provider daemon class.
+ *
+ * @par Detailed Description:
+ * Provides all the functionality to translate between PNOR and
+ * Attribute virtual memory spaces. Parses PNOR header for attribute
+ * sections, allocates virtual memory spaces with the kernel for each
+ * section, and handles virtual memory request messages from the
+ * kernel.
+ */
+class AttrRP
+{
+ public:
+
+ /**
+ * @brief Returns base address of the RO section containing the
+ * targets
+ *
+ * @return Base address of the RO section containing the targets as
+ * a void*
+ */
+ void* getBaseAddress();
+
+ /**
+ * @brief Translates given address, according to the resource
+ * provider's translation algorithm
+ *
+ * @param[in] i_pAddress
+ * Address to translate
+ *
+ * @return void* Returns the translated address. Common attribute
+ * code has a static, compile time check that is used to
+ * determine whether to call this function, however the Hostboot
+ * compiler complains when this is not provided. Therefore
+ * while this method exists, Hostboot will never call it, and if
+ * it does it will always get a no-op translation.
+ */
+ void* translateAddr(
+ void* i_pAddress)
+ {
+ return i_pAddress;
+ }
+
+ /**
+ * @brief Initializes and starts the AttrRP daemon.
+ *
+ * @param[in/out] io_taskRetErrl
+ * Error log handle; on input, a NULL error log handle; on
+ * output, a NULL error log handle on success, or !NULL handle
+ * on failure
+ *
+ * @note If any error occurs during initialization, it will be
+ * reported back through the TaskArgs structure to the init
+ * service.
+ */
+ static void init(errlHndl_t& io_taskRetErrl);
+
+ protected:
+
+ /**
+ * @brief Initialize the attribute resource provider
+ *
+ * @par Detailed Description"
+ * Ensures member variables are initialized to sane values.
+ */
+ AttrRP()
+ : iv_msgQ(NULL), iv_sections(NULL), iv_sectionCount(0)
+ {
+ };
+
+ /**
+ * @brief Destroy the attribute resource provider
+ *
+ * @par Detailed Description:
+ * Frees any memory allocated by the resource provider.
+ *
+ * @note This should never actually be used because the daemon
+ * thread and the vmm blocks are unable to be reclaimed.
+ * Function will assert if called due to leaky behavior.
+ */
+ ~AttrRP();
+
+ private:
+
+ /**
+ * @brief Performs the startup of the daemon instance.
+ *
+ * @par Detailed Description:
+ * init() is a static function that just calls
+ * Singleton<AttrRP>::instance().startup(). See init for
+ * behavior.
+ *
+ * @param[in/out] io_taskRetErrl
+ * Error log handle; on input, a NULL error log handle; on
+ * output, a NULL error log handle on success, or !NULL handle
+ * on failure
+ */
+ void startup(errlHndl_t& io_taskRetErrl);
+
+ /**
+ * @brief Processes daemon messages
+ *
+ * @par Detailed Description:
+ * Performs a while(1) waiting for messages from the
+ * kernel/VMM and handles as appropriately. Reads / writes
+ * data from / to PNOR for the attribute sections.
+ */
+ void msgServiceTask() const;
+
+ /**
+ * @brief Parses the attribute section header in PNOR.
+ *
+ * @par Detailed Description:
+ * Constructs the local attribute section data structures
+ * (iv_sections / iv_sectionCount).
+ *
+ * @return errlHndl_t
+ * Returns an error log handle that is NULL on success or !NULL
+ * on failure
+ */
+ errlHndl_t parseAttrSectHeader();
+
+ /**
+ * @brief Allocates VMM sections for each Attribute section.
+ *
+ * @par Detailed Description:
+ * Calls to the kernel to create VMM blocks for each attribute
+ * and initializes permissions appropriately based on section
+ * type.
+ *
+ * @return errlHndl_t
+ * Returns an error log handle that is NULL on success or !NULL
+ * on failure
+ */
+ errlHndl_t createVmmSections();
+
+ /**
+ * @brief Starts the attribute provider's message processor
+ *
+ * @par Detailed Description:
+ * This function, being static, can be called from task_create
+ * and is used to enter the daemon thread's msgServiceTask
+ * loop to process messages.
+ *
+ * @param[in] i_pInstance
+ * The AttrRP to call msgServiceTask on.
+ */
+ static void startMsgServiceTask(void* i_pInstance);
+
+ // Message Queue for VMM requests
+ msg_q_t iv_msgQ;
+
+ // Parsed structures of the attribute sections.
+ AttrRP_Section* iv_sections;
+
+ // Count of attribute sections.
+ size_t iv_sectionCount;
+};
+
+/**
+ * @brief Give callers access to the singleton
+ */
+TARG_DECLARE_SINGLETON(TARGETING::AttrRP,theAttrRP);
+
+} // End namespace TARGETING
+
+#endif // __TARGETING_ATTRRP_H
diff --git a/src/include/usr/targeting/attributes.H b/src/include/usr/targeting/common/attributes.H
index 3a69af6af..d760fb19f 100644
--- a/src/include/usr/targeting/attributes.H
+++ b/src/include/usr/targeting/common/attributes.H
@@ -21,11 +21,11 @@
//
// IBM_PROLOG_END
-#ifndef TARG_ATTRIBUTES_H
-#define TARG_ATTRIBUTES_H
+#ifndef __TARGETING_COMMON_ATTRIBUTES_H
+#define __TARGETING_COMMON_ATTRIBUTES_H
/**
- * @file attributes.H
+ * @file targeting/common/attributes.H
*
* @brief Enums/type/properties of platform specific attributes
*/
@@ -39,9 +39,14 @@
#include <stdlib.h>
// This component
+#include <builtins.h>
+#include <targeting/adapters/types.H>
#include <attributeenums.H>
+#include <targeting/common/entitypath.H>
#include <attributestructs.H>
#include <attributetraits.H>
#include <attributestrings.H>
+#include <targeting/common/target.H>
+#include <targeting/common/util.H>
-#endif // TARG_ATTRIBUTES_H
+#endif // __TARGETING_COMMON_ATTRIBUTES_H
diff --git a/src/include/usr/targeting/common/commontargeting.H b/src/include/usr/targeting/common/commontargeting.H
new file mode 100644
index 000000000..c1a52a703
--- /dev/null
+++ b/src/include/usr/targeting/common/commontargeting.H
@@ -0,0 +1,45 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/targeting/common/commontargeting.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
+
+#ifndef __TARGETING_COMMON_COMMONTARGETING_H
+#define __TARGETING_COMMON_COMMONTARGETING_H
+
+/**
+ * @file targeting/common/commontargeting.H
+ *
+ * @brief Aggregation of all other major exported common targeting header files
+ */
+
+//******************************************************************************
+// Includes
+//******************************************************************************
+
+#include <targeting/common/targreasoncodes.H>
+#include <targeting/common/attributes.H>
+#include <targeting/common/iterators/iterators.H>
+#include <targeting/common/predicates/predicates.H>
+#include <targeting/common/targetservice.H>
+
+// Please keep up to date
+
+#endif // __TARGETING_COMMON_COMMONTARGETING_H
diff --git a/src/include/usr/targeting/entitypath.H b/src/include/usr/targeting/common/entitypath.H
index 4e24a9410..5d46af493 100644
--- a/src/include/usr/targeting/entitypath.H
+++ b/src/include/usr/targeting/common/entitypath.H
@@ -21,11 +21,11 @@
//
// IBM_PROLOG_END
-#ifndef TARG_ENTITYPATH_H
-#define TARG_ENTITYPATH_H
+#ifndef __TARGETING_COMMON_ENTITYPATH_H
+#define __TARGETING_COMMON_ENTITYPATH_H
/**
- * @file entitypath.H
+ * @file targeting/common/entitypath.H
*
* @brief Interface for the EntityPath class
*
@@ -98,7 +98,7 @@ class EntityPath
*/
struct PathElement
{
- TYPE type; ///< Type of element at this level in the hierarchy
+ TYPE type : 8; ///< Type of element at this level in the hierarchy
uint8_t instance; ///< Instance ID for the element, relative to
///< the parent
@@ -147,6 +147,8 @@ class EntityPath
* routine asserts.
*
* @post Entity path element removed from path
+ *
+ * @return Reference to the same EntityPath, for chaining
*/
EntityPath& removeLast();
@@ -161,6 +163,8 @@ class EntityPath
* Equivalent to p1 = p2; p1.removeLast();
*
* @post Copy of entity path with last element removed returned
+ *
+ * @return Copy of the EntityPath
*/
EntityPath copyRemoveLast() const;
@@ -424,7 +428,7 @@ class EntityPath
/**
* @brief Save the entity path as a c-string
*
- * @return the dynamic buffer pointer of the c-string
+ * @return The dynamic buffer (malloc'd) pointer of the c-string
*
* @note caller must call free() to release the buffer
*/
@@ -444,4 +448,4 @@ class EntityPath
} // End namespace TARGETING
-#endif // TARG_ENTITYPATH_H
+#endif // __TARGETING_COMMON_ENTITYPATH_H
diff --git a/src/include/usr/targeting/common/error.H b/src/include/usr/targeting/common/error.H
new file mode 100644
index 000000000..39153e6a7
--- /dev/null
+++ b/src/include/usr/targeting/common/error.H
@@ -0,0 +1,40 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/targeting/common/error.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
+
+#ifndef __TARGETING_COMMON_ERROR_H
+#define __TARGETING_COMMON_ERROR_H
+
+/**
+ * @file targeting/common/error.H
+ *
+ * @brief Common header to abstract away error handling differences between
+ * platforms
+ */
+
+//******************************************************************************
+// Includes
+//******************************************************************************
+
+#include <targeting/adapters/erroradapter.H>
+
+#endif // __TARGETING_COMMON_ERROR_H
diff --git a/src/include/usr/targeting/common/iterators/iterators.H b/src/include/usr/targeting/common/iterators/iterators.H
new file mode 100644
index 000000000..5339b33dd
--- /dev/null
+++ b/src/include/usr/targeting/common/iterators/iterators.H
@@ -0,0 +1,39 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/targeting/common/iterators/iterators.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
+
+#ifndef __TARGETING_COMMON_ITERATORS_H
+#define __TARGETING_COMMON_ITERATORS_H
+
+/**
+ * @file targeting/common/iterators/iterators.H
+ *
+ * @brief Header file which aggregates all the iterator header files.
+ */
+
+#include <targeting/common/iterators/targetiterator.H>
+#include <targeting/common/iterators/rangefilter.H>
+
+// please keep up to date...
+
+#endif // __TARGETING_COMMON_ITERATORS_H
+
diff --git a/src/include/usr/targeting/iterators/rangefilter.H b/src/include/usr/targeting/common/iterators/rangefilter.H
index 458bf3b9d..b29cfa07d 100644
--- a/src/include/usr/targeting/iterators/rangefilter.H
+++ b/src/include/usr/targeting/common/iterators/rangefilter.H
@@ -21,11 +21,11 @@
//
// IBM_PROLOG_END
-#ifndef TARG_RANGEFILTER_H
-#define TARG_RANGEFILTER_H
+#ifndef __TARGETING_COMMON_RANGEFILTER_H
+#define __TARGETING_COMMON_RANGEFILTER_H
/**
- * @file rangefilter.H
+ * @file targeting/common/iterators/rangefilter.H
*
* @brief Interface describing an object which takes an iterator range and
* allows caller to iterate through the elements which match a supplied
@@ -41,9 +41,9 @@
// Other Host Boot Components
// Targeting Component
-#include <targeting/target.H>
-#include <targeting/predicates/predicatebase.H>
-#include <targeting/iterators/targetiterator.H>
+#include <targeting/common/target.H>
+#include <targeting/common/predicates/predicatebase.H>
+#include <targeting/common/iterators/targetiterator.H>
//******************************************************************************
// Macros
@@ -307,29 +307,29 @@ RangeFilter<IteratorType>& RangeFilter<IteratorType>::operator++()
template <typename T>
bool operator!=(const TargetRangeFilter& i_lhs, const T& i_rhs)
{
- i_lhs.notComparable();
- return false;
+ i_lhs.notComparable();
+ return false;
}
template <typename T>
bool operator==(const TargetRangeFilter& i_lhs, const T& i_rhs)
{
i_lhs.notComparable();
- return false;
+ return false;
}
template <typename T>
bool operator!=(const ConstTargetRangeFilter& i_lhs, const T& i_rhs)
{
- i_lhs.notComparable();
- return false;
+ i_lhs.notComparable();
+ return false;
}
template <typename T>
bool operator==(const ConstTargetRangeFilter& i_lhs, const T& i_rhs)
{
i_lhs.notComparable();
- return false;
+ return false;
}
#undef TARG_CLASS
@@ -337,5 +337,5 @@ bool operator==(const ConstTargetRangeFilter& i_lhs, const T& i_rhs)
} // End namespace TARGETING
-#endif
+#endif // __TARGETING_COMMON_RANGEFILTER
diff --git a/src/include/usr/targeting/iterators/targetiterator.H b/src/include/usr/targeting/common/iterators/targetiterator.H
index 6819de498..5abb21f81 100644
--- a/src/include/usr/targeting/iterators/targetiterator.H
+++ b/src/include/usr/targeting/common/iterators/targetiterator.H
@@ -21,11 +21,11 @@
//
// IBM_PROLOG_END
-#ifndef TARG_TARGETITERATOR_H
-#define TARG_TARGETITERATOR_H
+#ifndef __TARGETING_COMMON_TARGETITERATOR_H
+#define __TARGETING_COMMON_TARGETITERATOR_H
/**
- * @file targetiterator.H
+ * @file targeting/common/iterators/targetiterator.H
*
* @brief Interface describing iterator/const iterator used to iterate through
* target service targets
@@ -275,5 +275,5 @@ _TargetIterator<T>& _TargetIterator<T>::operator++()
} // End namespace TARGETING
-#endif // TARG_TARGETITERATOR_H
+#endif // __TARGETING_COMMON_TARGETITERATOR_H
diff --git a/src/include/usr/targeting/common/pointer.H b/src/include/usr/targeting/common/pointer.H
new file mode 100644
index 000000000..f5d919ab6
--- /dev/null
+++ b/src/include/usr/targeting/common/pointer.H
@@ -0,0 +1,85 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/targeting/common/pointer.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
+
+#ifndef __TARGETING_COMMON_POINTER_H
+#define __TARGETING_COMMON_POINTER_H
+
+/**
+ * @file targeting/common/pointer.H
+ *
+ * @brief Pointer abstraction that allows Hostboot and FSP to use pointers in
+ * a common way, while maintaining binary compatibility
+ */
+
+#include <builtins.h>
+
+namespace TARGETING
+{
+
+/**
+ * @brief Type (union) which implements a common pointer type between Hostboot
+ * and FSP
+ */
+template<typename T>
+union AbstractPointer
+{
+ uint64_t raw; ///< Raw value of the container
+ struct
+ {
+ uint8_t doNotUse[sizeof(uint64_t)-sizeof(void*)]; ///< Do no use
+ T* ptr; ///< Pointer to instance of type T
+ };
+};
+
+/**
+ * @brief Macro which accepts an AbstractPointer<T> and returns a pointer
+ * customized to the platform
+ *
+ * @param[in] __PTR__
+ * AbstractPointer<T> containing the platform neutral pointer
+ *
+ * @return T* pointer customized to the platform
+ */
+#define TARG_TO_PLAT_PTR(__PTR__) \
+ ((__PTR__).ptr)
+
+/**
+ * @biref Macro which accepts an AbstractPointer<T>, customizes the pointer to
+ * the platform, then increments the pointer the specified number of times
+ * and returns it
+ *
+ * @param[in] __PTR__
+ * AbstractPointer<T> containing the platform neutral pointer
+ *
+ * @param[in] __NUM_INCS__
+ * Number of times to increment the platform specific pointer
+ *
+ * @return T* pointer customized to the platform, incremented the specified
+ * number of times
+ */
+#define TARG_TO_PLAT_PTR_AND_INC(__PTR__,__NUM_INCS__) \
+ ((__PTR__).ptr + __NUM_INCS__)
+
+} // End namespace Targeting
+
+#endif // __TARGETING_COMMON_POINTER_H
diff --git a/src/include/usr/targeting/predicates/predicatebase.H b/src/include/usr/targeting/common/predicates/predicatebase.H
index 889aae8b5..1a12b16a6 100644
--- a/src/include/usr/targeting/predicates/predicatebase.H
+++ b/src/include/usr/targeting/common/predicates/predicatebase.H
@@ -21,11 +21,11 @@
//
// IBM_PROLOG_END
-#ifndef TARG_PREDICATEBASE_H
-#define TARG_PREDICATEBASE_H
+#ifndef __TARGETING_COMMON_PREDICATEBASE_H
+#define __TARGETING_COMMON_PREDICATEBASE_H
/**
- * @file predicatebase.H
+ * @file targeting/common/predicates/predicatebase.H
*
* @brief Interface for an abstract targeting predicate which filters a set of
* targets based on the programmed criteria. Concrete predicates must
@@ -130,4 +130,4 @@ class PredicateBase
} // End namespace TARGETING
-#endif // TARG_PREDICATEBASE_H
+#endif // __TARGETING_COMMON_PREDICATEBASE_H
diff --git a/src/include/usr/targeting/predicates/predicatectm.H b/src/include/usr/targeting/common/predicates/predicatectm.H
index 09180f6a1..de1e5f48f 100644
--- a/src/include/usr/targeting/predicates/predicatectm.H
+++ b/src/include/usr/targeting/common/predicates/predicatectm.H
@@ -21,11 +21,11 @@
//
// IBM_PROLOG_END
-#ifndef TARG_PREDICATECTM_H
-#define TARG_PREDICATECTM_H
+#ifndef __TARGETING_COMMON_PREDICATECTM_H
+#define __TARGETING_COMMON_PREDICATECTM_H
/**
- * @file predicatectm.H
+ * @file targeting/common/predicates/predicatectm.H
*
* @brief Interface for a predicate which fiters a target based on its class,
* type, and model.
@@ -40,9 +40,9 @@
// Other Host Boot Components
// Targeting Component
-#include <targeting/target.H>
-#include <attributeenums.H>
-#include <targeting/predicates/predicatebase.H>
+#include <targeting/common/target.H>
+#include <targeting/common/attributes.H>
+#include <targeting/common/predicates/predicatebase.H>
//******************************************************************************
// Macros
@@ -120,6 +120,11 @@ class PredicateCTM : public PredicateBase
* (CLASS_NA, TYPE_NA, MODEL_NA) must be used for any fields that
* do not matter. See PredicateBase class for parameter/return
* description.
+ *
+ * @param[in] i_pTarget
+ * Target handle pointing to the target to compare to
+ *
+ * @return bool indicating whether the target matches or not
*/
virtual bool operator()(
const Target* i_pTarget) const;
@@ -181,4 +186,4 @@ inline void PredicateCTM::setModel(MODEL i_model)
} // End namespace TARGETING
-#endif // TARG_PREDICATECTM_H
+#endif // __TARGETING_COMMON_PREDICATECTM_H
diff --git a/src/include/usr/targeting/predicates/predicateisfunctional.H b/src/include/usr/targeting/common/predicates/predicateisfunctional.H
index 7a3ad741c..b203ebd41 100644
--- a/src/include/usr/targeting/predicates/predicateisfunctional.H
+++ b/src/include/usr/targeting/common/predicates/predicateisfunctional.H
@@ -21,10 +21,10 @@
//
// IBM_PROLOG_END
-#ifndef __PREDICATES_PREDICATEISFUNCTIONAL_H
-#define __PREDICATES_PREDICATEISFUNCTIONAL_H
+#ifndef __TARGETING_COMMON_PREDICATEISFUNCTIONAL_H
+#define __TARGETING_COMMON_PREDICATEISFUNCTIONAL_H
/**
- * @file predicateisfunctional.H
+ * @file targeting/common/predicates/predicateisfunctional.H
*
* PredicateIsFunctional class, used to filter targets for HWP wrapper.
* From the example tutorial page at
@@ -50,15 +50,15 @@
/******************************************************************************/
// Includes
/******************************************************************************/
-#include <stdint.h>
+#include <stdint.h>
// targeting support.
-#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/common/attributes.H>
+#include <targeting/common/entitypath.H>
+#include <targeting/common/target.H>
+#include <targeting/common/targetservice.H>
+#include <targeting/common/iterators/rangefilter.H>
+#include <targeting/common/predicates/predicatectm.H>
namespace TARGETING
@@ -88,6 +88,10 @@ public:
/**
* @brief returns true if target is marked functional
*
+ * @param[in] i_pTarget
+ * Handle to the target to perform the predicate check on
+ *
+ * @return bool indicating whether target it functional or not
*/
inline bool operator()(
const TARGETING::Target* i_pTarget) const ;
@@ -99,4 +103,4 @@ private:
}; // end namespace
-#endif
+#endif // __TARGETING_COMMON_PREDICATEISFUNCTIONAL_H
diff --git a/src/include/usr/targeting/predicates/predicatepostfixexpr.H b/src/include/usr/targeting/common/predicates/predicatepostfixexpr.H
index 3eb55b6a2..44fabfb62 100644
--- a/src/include/usr/targeting/predicates/predicatepostfixexpr.H
+++ b/src/include/usr/targeting/common/predicates/predicatepostfixexpr.H
@@ -21,11 +21,11 @@
//
// IBM_PROLOG_END
-#ifndef TARG_PREDICATEPOSTFIXEXPR_H
-#define TARG_PREDICATEPOSTFIXEXPR_H
+#ifndef __TARGETING_COMMON_PREDICATEPOSTFIXEXPR_H
+#define __TARGETING_COMMON_PREDICATEPOSTFIXEXPR_H
/**
- * @file predicatepostfixexpr.H
+ * @file targeting/common/predicatepostfixexpr.H
*
* @brief Interface for predicate which allows callers to chain multiple other
* predicates together in complex logical expressions, and then evaluate
@@ -42,7 +42,7 @@
// Other Host Boot Components
// Targeting Component
-#include <targeting/predicates/predicatebase.H>
+#include <targeting/common/predicates/predicatebase.H>
//******************************************************************************
// Macros
@@ -183,6 +183,11 @@ class PredicatePostfixExpr : public PredicateBase
* Evaluation step 2: 0 NOT (evaluated 1 P3 AND)
* Evaluation step 3: 1 (evaluated 0 NOT; final result)
* @endverbatim
+ *
+ * @param[in] i_pTarget
+ * Handle of the target to evaluate the expression against
+ *
+ * @return bool indicating whether the expression is true or no
*/
virtual bool operator()(
const Target* i_pTarget) const;
@@ -207,10 +212,10 @@ class PredicatePostfixExpr : public PredicateBase
*/
struct Operation
{
- LogicalOperator logicalOp; ///< Logical operator to
- ///< apply to result stack
- const PredicateBase* const pPredicate; ///< Predicate to evaluate,
- ///< if logicalOp == EVAL
+ LogicalOperator logicalOp; ///< Logical operator to
+ ///< apply to result stack
+ const PredicateBase* pPredicate; ///< Predicate to evaluate,
+ ///< if logicalOp == EVAL
};
std::vector<Operation> iv_ops; ///< Expression operations to perform
@@ -223,4 +228,4 @@ class PredicatePostfixExpr : public PredicateBase
} // End namespace TARGETING
-#endif // TARG_PREDICATEPOSTFIXEXPR_H
+#endif // __TARGETING_COMMON_PREDICATEPOSTFIXEXPR_H
diff --git a/src/include/usr/targeting/predicates/predicates.H b/src/include/usr/targeting/common/predicates/predicates.H
index 2c615852c..5a7cf04d9 100644
--- a/src/include/usr/targeting/predicates/predicates.H
+++ b/src/include/usr/targeting/common/predicates/predicates.H
@@ -20,21 +20,22 @@
// Origin: 30
//
// IBM_PROLOG_END
-#ifndef TARG_PREDICATES_H
-#define TARG_PREDICATES_H
+
+#ifndef __TARGETING_COMMON_PREDICATES_H
+#define __TARGETING_COMMON_PREDICATES_H
/**
- * @file predicateall.H
+ * @file targeting/common/predicates/predicates.H
*
* @brief Shortcut file to pull in all the predicate include files.
*
*/
-#include <targeting/predicates/predicatebase.H>
-#include <targeting/predicates/predicatectm.H>
-#include <targeting/predicates/predicatepostfixexpr.H>
-#include <targeting/predicates/predicateisfunctional.H>
+#include <targeting/common/predicates/predicatebase.H>
+#include <targeting/common/predicates/predicatectm.H>
+#include <targeting/common/predicates/predicateisfunctional.H>
+#include <targeting/common/predicates/predicatepostfixexpr.H>
// please keep up to date...
-#endif
+#endif // __TARGETING_COMMON_PREDICATES_H
diff --git a/src/include/usr/targeting/target.H b/src/include/usr/targeting/common/target.H
index 84c8459b8..d91483cad 100644
--- a/src/include/usr/targeting/target.H
+++ b/src/include/usr/targeting/common/target.H
@@ -21,11 +21,11 @@
//
// IBM_PROLOG_END
-#ifndef TARG_TARGET_H
-#define TARG_TARGET_H
+#ifndef __TARGETING_COMMON_TARGET_H
+#define __TARGETING_COMMON_TARGET_H
/**
- * @file target.H
+ * @file targeting/common/target.H
*
* @brief Interface for the target class
*
@@ -40,11 +40,14 @@
// STD
#include <stdint.h>
#include <stdlib.h>
-#include <assert.h>
+#include <targeting/adapters/assertadapter.H>
+#include <targeting/adapters/types.H>
+#include <targeting/common/util.H>
+#include <targeting/common/pointer.H>
#include <vector>
// This component
-#include <targeting/attributes.H>
+#include <targeting/common/attributes.H>
namespace TARGETING
{
@@ -232,7 +235,7 @@ class Target
bool l_wrote = trySetAttr<A>(i_attrValue);
//@TODO: Remove assert once release has stabilized
- assert(l_wrote,"TARGETING::Target::setAttr<%d>: trySetAttr "
+ TARG_ASSERT(l_wrote,"TARGETING::Target::setAttr<%d>: trySetAttr "
"returned false",A);
}
@@ -257,7 +260,7 @@ class Target
*
* @param[in] i_attr Attribute to retrieve
* @param[in] i_size Size of the attribute
- * @param[in/out] io_attrData On input, location to store the attribute.
+ * @param[in/out] io_attrData On input, location to store the attribute
* On output, location updated with attribute data
*
* @pre Target service must be initialized
@@ -361,11 +364,12 @@ class Target
uint32_t iv_attrs; ///< Total attributes allowed for this
///< instance
- ATTRIBUTE_ID (*iv_pAttrNames)[]; ///< Pointer to array of valid
- ///< attributes
- void* (*iv_pAttrValues)[]; ///< Pointer to array of void*'s
- ///< (which point to individual
- ///< attributes)
+
+ // Pointer to array of valid attributes
+ TARGETING::AbstractPointer<ATTRIBUTE_ID> iv_pAttrNames;
+
+ // Pointer to array of void* (which point to attributes)
+ TARGETING::AbstractPointer< AbstractPointer<void> > iv_pAttrValues;
private: // Private CTORs/DTORs/Operators
@@ -396,7 +400,7 @@ typename AttributeTraits<A>::Type Target::getAttr() const
bool l_read = tryGetAttr<A>(l_attrValue);
//@TODO Remove assert once release has stablized
- assert(l_read,"TARGETING::Target::getAttr<%d>: tryGetAttr "
+ TARG_ASSERT(l_read,"TARGETING::Target::getAttr<%d>: tryGetAttr "
"returned false",A);
return l_attrValue;
}
@@ -431,11 +435,11 @@ const char* Target::getAttrAsString() const
bool l_read = tryGetAttr<A>(l_attrValue);
//@TODO Remove assert once release has stabilized
- assert(l_read,"TARGETING::Target::getAttrAsString<%d>: tryGetAttr "
+ TARG_ASSERT(l_read,"TARGETING::Target::getAttrAsString<%d>: tryGetAttr "
"returned false",A);
return attrToString<A>(l_attrValue);
}
} // End namespace TARGETING
-#endif // TARG_TARGET_H
+#endif // __TARGETING_COMMON_TARGET_H
diff --git a/src/include/usr/targeting/targetservice.H b/src/include/usr/targeting/common/targetservice.H
index e220eafb7..444dbc472 100644
--- a/src/include/usr/targeting/targetservice.H
+++ b/src/include/usr/targeting/common/targetservice.H
@@ -21,11 +21,11 @@
//
// IBM_PROLOG_END
-#ifndef TARG_TARGETSERVICE_H
-#define TARG_TARGETSERVICE_H
+#ifndef __TARGETING_COMMON_TARGETSERVICE_H
+#define __TARGETING_COMMON_TARGETSERVICE_H
/**
- * @file targetservice.H
+ * @file targeting/common/targetservice.H
*
* @brief Interface for the target service
*
@@ -43,15 +43,11 @@
#include <stdlib.h>
#include <vector>
-// Other components
-#include <util/singleton.H>
-
// This component
-#include <attributeenums.H>
-#include <targeting/target.H>
-#include <targeting/entitypath.H>
-#include <targeting/iterators/targetiterator.H>
-#include <targeting/predicates/predicatebase.H>
+#include <targeting/common/attributes.H>
+#include <targeting/common/iterators/iterators.H>
+#include <targeting/common/predicates/predicates.H>
+#include <targeting/adapters/types.H>
//******************************************************************************
// Interface Definitions
@@ -79,7 +75,9 @@ namespace TARGETING
* cannot be used as input to any target service APIs.
*/
static Target* const MASTER_PROCESSOR_CHIP_TARGET_SENTINEL
- = reinterpret_cast<TARGETING::Target* const>(0xFFFFFFFFFFFFFFFFULL);
+ = (sizeof(void*) == 4) ?
+ reinterpret_cast<TARGETING::Target* const>(0xFFFFFFFF)
+ : reinterpret_cast<TARGETING::Target* const>(0xFFFFFFFFFFFFFFFFULL);
/**
* @brief TargetService class
@@ -164,6 +162,19 @@ class TargetService
void init();
/**
+ * @brief Returns whether target service has initialized or not
+ *
+ * @return bool indicating whether service has initialized or not
+ * @retval true Service has initialized and can be used
+ * @retval false Service has not initializated and should not be used
+ * (other than to run the initialization)
+ */
+ bool isInitialized() const
+ {
+ return iv_initialized;
+ }
+
+ /**
* @brief Map iterator types to common aliases
*/
typedef TargetIterator iterator;
@@ -539,8 +550,9 @@ class TargetService
* intentionally
*/
class TargetService;
-typedef Singleton<TARGETING::TargetService> theTargetService;
+
+TARG_DECLARE_SINGLETON(TARGETING::TargetService,theTargetService);
} // End namespace TARGETING
-#endif // TARG_TARGETSERVICE_H
+#endif // __TARGETING_COMMON_TARGETSERVICE_H
diff --git a/src/include/usr/targeting/common/targreasoncodes.H b/src/include/usr/targeting/common/targreasoncodes.H
new file mode 100644
index 000000000..8214c1f0b
--- /dev/null
+++ b/src/include/usr/targeting/common/targreasoncodes.H
@@ -0,0 +1,54 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/targeting/targreasoncodes.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 __TARGETING_COMMON_TARGREASONCODES_H
+#define __TARGETING_COMMON_TARGREASONCODES_H
+
+/**
+ * @file targeting/common/targetreasoncodes.H
+ *
+ * @brief Provides reason codes for various targeting errors
+ */
+
+#include <targeting/adapters/types.H>
+
+namespace TARGETING
+{
+
+enum TargetingModuleId
+{
+ TARG_MOD_TEST = 0x01,
+ TARG_MOD_ATTRRP = 0x02,
+};
+
+enum TargetingReasonCode
+{
+ TARG_RC_TEST_TARGET_FFDC = TARG_COMP_ID | 0x01,
+ TARG_RC_BAD_EYECATCH = TARG_COMP_ID | 0x02,
+ TARG_RC_MM_BLOCK_FAIL = TARG_COMP_ID | 0x03,
+ TARG_RC_MM_PERM_FAIL = TARG_COMP_ID | 0x04,
+ TARG_RC_ATTR_MSG_FAIL = TARG_COMP_ID | 0x05,
+};
+
+}; // End TARGETING namespace
+
+#endif // __TARGETING_COMMON_TARGREASONCODES_H
diff --git a/src/usr/targeting/trace.H b/src/include/usr/targeting/common/trace.H
index 15eebeff1..c298eb9ab 100644
--- a/src/usr/targeting/trace.H
+++ b/src/include/usr/targeting/common/trace.H
@@ -21,11 +21,11 @@
//
// IBM_PROLOG_END
-#ifndef TARG_TRACE_H
-#define TARG_TRACE_H
+#ifndef __TARGETING_COMMON_TRACE_H
+#define __TARGETING_COMMON_TRACE_H
/**
- * @file trace.H
+ * @file targeting/common/trace.H
*
* @brief Targeting related trace macros. Callers of these macros must
* define TARG_NAMESPACE, TARG_CLASS, and TARG_FN as appropriate
@@ -35,24 +35,22 @@
// Includes
//******************************************************************************
-// Other Components
-#include <trace/interface.H>
-
-// Give callers access to the trace buffer
-namespace TARGETING
-{
- extern trace_desc_t* g_trac_targeting;
-}
+// Other includes
+#include <targeting/adapters/traceadapter.H>
#define TARG_LOC TARG_NAMESPACE TARG_CLASS TARG_FN ": "
+#define TARG_ERR_LOC ERR_MRK " " TARG_LOC
+
#define TARG_TAG "[TARG]"
#define TARG_ENTER(args...) \
- TRACFCOMP(TARGETING::g_trac_targeting,TARG_TAG " " ENTER_MRK " " TARG_NAMESPACE \
+ TRACFCOMP(TARGETING::g_trac_targeting,TARG_TAG " " \
+ ENTER_MRK " " TARG_NAMESPACE \
TARG_CLASS TARG_FN " " args)
#define TARG_EXIT(args...) \
- TRACFCOMP(TARGETING::g_trac_targeting,TARG_TAG " " EXIT_MRK " " TARG_NAMESPACE \
+ TRACFCOMP(TARGETING::g_trac_targeting,TARG_TAG " " \
+ EXIT_MRK " " TARG_NAMESPACE \
TARG_CLASS TARG_FN " " args)
#define TARG_ERR(args...) \
@@ -64,4 +62,4 @@ namespace TARGETING
#define TARG_BIN(args...) \
TRACFBIN(TARGETING::g_trac_targeting,TARG_TAG " " args)
-#endif // TARG_TRACE_H
+#endif // __TARGETING_COMMON_TRACE_H
diff --git a/src/include/usr/targeting/util.H b/src/include/usr/targeting/common/util.H
index 4af5500a5..4851dd87b 100644
--- a/src/include/usr/targeting/util.H
+++ b/src/include/usr/targeting/common/util.H
@@ -20,18 +20,39 @@
// Origin: 30
//
// IBM_PROLOG_END
-#ifndef __TARGETING_UTIL_H
-#define __TARGETING_UTIL_H
+
+#ifndef __TARGETING_COMMON_UTIL_H
+#define __TARGETING_COMMON_UTIL_H
/**
- * Miscellaneous Utility Functions
+ * @file targeting/common/util.H
+ *
+ * @brief Targeting utility functions
*/
namespace TARGETING
{
+
class Target;
/**
+ * @brief Macro which indicates whether to translate addresses or not
+ *
+ * @par Detailed Description:
+ * If PPC platform (FSP or Hostboot), if 8 byte pointers then it's
+ * Hostboot, so don't translate. If 4 byte pointers then it's FSP so
+ * translate. If !PPC (x86 32 or 64 bit), then always translate
+ *
+ * @note List of preprocessor macros defined can be determined by calling:
+ * ppc64-mcp6-gcc -dM -E - < /dev/null
+ */
+#ifdef __PPC__
+#define TARG_ADDR_TRANSLATION_REQUIRED (sizeof(void*)==4)
+#else
+#define TARG_ADDR_TRANSLATION_REQUIRED (1)
+#endif
+
+/**
* @brief Checks to see if we are running in a hardware simulation
* environment, i.e. VPO/VBU (not Simics)
*
@@ -48,10 +69,4 @@ uint32_t get_huid( const Target* i_target );
}
-
-
-
-
-
-
-#endif
+#endif // __TARGETING_COMMON_UTIL_H
diff --git a/src/include/usr/targeting/targreasoncodes.H b/src/include/usr/targeting/targreasoncodes.H
deleted file mode 100644
index 4e6f1108e..000000000
--- a/src/include/usr/targeting/targreasoncodes.H
+++ /dev/null
@@ -1,46 +0,0 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/include/usr/targeting/targreasoncodes.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 __TARGETING_TARGREASONCODES_H
-#define __TARGETING_TARGREASONCODES_H
-
-#include <hbotcompid.H>
-
-namespace TARGETING
-{
- enum TargetingModuleId
- {
- TARG_MOD_TEST = 0x01,
- TARG_MOD_ATTRRP = 0x02,
- };
-
- enum TargetingReasonCode
- {
- TARG_RC_TEST_TARGET_FFDC = TARG_COMP_ID | 0x01,
- TARG_RC_BAD_EYECATCH = TARG_COMP_ID | 0x02,
- TARG_RC_MM_BLOCK_FAIL = TARG_COMP_ID | 0x03,
- TARG_RC_MM_PERM_FAIL = TARG_COMP_ID | 0x04,
- TARG_RC_ATTR_MSG_FAIL = TARG_COMP_ID | 0x05,
- };
-};
-
-#endif
diff --git a/src/include/usr/vmmconst.h b/src/include/usr/vmmconst.h
index 5036b8146..24a0617c8 100644
--- a/src/include/usr/vmmconst.h
+++ b/src/include/usr/vmmconst.h
@@ -57,7 +57,11 @@
/** Attribute Resource Provider */
// Note: Not simplified to make it easier to extract with the PNOR targeting
// image generator script
-#define VMM_VADDR_ATTR_RP (3ul * 1024ul * 1024ul * 1024ul)
+// WARNING: 4 GB range deliberately chosen so that 64-bit Hostboot pointers
+// are similar to 32 bit FSP pointers, except that the upper 32 bits are
+// set to 0x00000001. This allows both FSP and Hostboot to opearate on the same
+// targeting image
+#define VMM_VADDR_ATTR_RP (4ul * 1024ul * 1024ul * 1024ul)
/** Virtual memory block priorities */
enum BlockPriority
diff --git a/src/usr/diag/mdia/mdiafwd.H b/src/usr/diag/mdia/mdiafwd.H
index ad4126bb9..5185a966b 100644
--- a/src/usr/diag/mdia/mdiafwd.H
+++ b/src/usr/diag/mdia/mdiafwd.H
@@ -29,9 +29,10 @@
*/
#include <mdia/mdia.H>
-#include <targeting/target.H>
+#include <targeting/common/attributes.H>
#include <vector>
#include <map>
+
/**
* @brief forwards
*/
diff --git a/src/usr/diag/mdia/mdiamonitor.C b/src/usr/diag/mdia/mdiamonitor.C
index 17ed1a942..9cbef403d 100755
--- a/src/usr/diag/mdia/mdiamonitor.C
+++ b/src/usr/diag/mdia/mdiamonitor.C
@@ -21,7 +21,7 @@
//
// IBM_PROLOG_END
#include <sys/time.h>
-#include <targeting/util.H>
+#include <targeting/common/util.H>
#include <vector>
#include "mdiamonitor.H"
#include "mdiasm.H"
diff --git a/src/usr/diag/mdia/test/mdiatest.H b/src/usr/diag/mdia/test/mdiatest.H
index 8fa3f5d37..b32401d99 100644
--- a/src/usr/diag/mdia/test/mdiatest.H
+++ b/src/usr/diag/mdia/test/mdiatest.H
@@ -30,7 +30,7 @@
#include <builtins.h>
#include <cxxtest/TestSuite.H>
-#include <targeting/target.H>
+#include <targeting/common/target.H>
#include "../mdiafwd.H"
class MdiaTest : public CxxTest::TestSuite
diff --git a/src/usr/diag/mdia/test/mdiatestmba.H b/src/usr/diag/mdia/test/mdiatestmba.H
index c8b5a80ff..c16414257 100644
--- a/src/usr/diag/mdia/test/mdiatestmba.H
+++ b/src/usr/diag/mdia/test/mdiatestmba.H
@@ -30,7 +30,7 @@
#include <builtins.h>
#include <cxxtest/TestSuite.H>
-#include <targeting/target.H>
+#include <targeting/common/target.H>
#include "../mdiafwd.H"
#include "../mdiaglobals.H"
diff --git a/src/usr/diag/mdia/test/mdiatestmonitor.H b/src/usr/diag/mdia/test/mdiatestmonitor.H
index db491f22b..504accf92 100644
--- a/src/usr/diag/mdia/test/mdiatestmonitor.H
+++ b/src/usr/diag/mdia/test/mdiatestmonitor.H
@@ -27,7 +27,7 @@
#include <sys/task.h>
#include <sys/time.h>
#include <stdint.h>
-#include <targeting/util.H>
+#include <targeting/common/util.H>
#include "../mdiafwd.H"
#include "../mdiamonitor.H"
#include "../mdiasm.H"
diff --git a/src/usr/diag/mdia/test/mdiatesttrace.H b/src/usr/diag/mdia/test/mdiatesttrace.H
index 7fc6530b7..cea2e1c8a 100644
--- a/src/usr/diag/mdia/test/mdiatesttrace.H
+++ b/src/usr/diag/mdia/test/mdiatesttrace.H
@@ -30,7 +30,7 @@
#include <builtins.h>
#include <cxxtest/TestSuite.H>
-#include <targeting/target.H>
+#include <targeting/common/attributes.H>
#include "../mdiatrace.H"
class MdiaTraceTest : public CxxTest::TestSuite
diff --git a/src/usr/diag/mdia/test/mdiatestworkitem.H b/src/usr/diag/mdia/test/mdiatestworkitem.H
index 2fb9a209e..fba00e2fb 100644
--- a/src/usr/diag/mdia/test/mdiatestworkitem.H
+++ b/src/usr/diag/mdia/test/mdiatestworkitem.H
@@ -30,7 +30,7 @@
#include <builtins.h>
#include <cxxtest/TestSuite.H>
-#include <targeting/target.H>
+#include <targeting/common/attributes.H>
#include "../mdiaworkitem.H"
#include "../mdiasm.H"
diff --git a/src/usr/diag/prdf/iipconst.h b/src/usr/diag/prdf/iipconst.h
index 455af2769..54f8ccd82 100755
--- a/src/usr/diag/prdf/iipconst.h
+++ b/src/usr/diag/prdf/iipconst.h
@@ -37,7 +37,7 @@
#include <prdf_types.h>
#endif
-#include <target.H>
+#include <targeting/common/target.H>
/*--------------------------------------------------------------------*/
/* User Types */
diff --git a/src/usr/diag/prdf/prdf_main.C b/src/usr/diag/prdf/prdf_main.C
index f1a18483f..abe221dea 100755
--- a/src/usr/diag/prdf/prdf_main.C
+++ b/src/usr/diag/prdf/prdf_main.C
@@ -32,7 +32,7 @@
#include <prdf_proto.H>
#include <iipglobl.h>
#include <iipconst.h>
-#include <targetservice.H>
+#include <targeting/common/targetservice.H>
#undef iipMain_C
diff --git a/src/usr/diag/prdf/test/prdfTest.H b/src/usr/diag/prdf/test/prdfTest.H
index 8d8166ff2..9ae5b5a46 100644
--- a/src/usr/diag/prdf/test/prdfTest.H
+++ b/src/usr/diag/prdf/test/prdfTest.H
@@ -43,9 +43,9 @@ class prdfTest: public CxxTest::TestSuite
void testTrace(void)
{
- TS_TRACE(ENTER_MRK "testTrace()");
+ TS_TRACE(ENTER_MRK __FUNCTION__);
- PRDF_ENTER( "testTrace()" );
+ PRDF_ENTER( "%s", __FUNCTION__ );
const char * l_testStr = "running testTrace";
uint64_t l_testHex = 0xDEADBEEF;
@@ -58,21 +58,21 @@ class prdfTest: public CxxTest::TestSuite
PRDF_ERR( "testTrace() Please ignore this error trace 0x%08X", l_testHex );
+ PRDF_EXIT( "%s", __FUNCTION__ );
+
PRDF_DENTER( "testTrace()" );
PRDF_DINF( "testTrace() running testTrace" );
PRDF_DEXIT( "testTrace()" );
- PRDF_EXIT( "testTrace()" );
-
- TS_TRACE(EXIT_MRK "testTrace()");
+ TS_TRACE(EXIT_MRK __FUNCTION__);
}
void testPrdInitialize(void)
{
using namespace PRDF;
- TS_TRACE(ENTER_MRK "testPrdInitialize()");
+ TS_TRACE(ENTER_MRK __FUNCTION__);
PRDF_ENTER( "testPrdInitialize()" );
errlHndl_t l_pErr = NULL;
@@ -91,13 +91,13 @@ class prdfTest: public CxxTest::TestSuite
}
PRDF_EXIT( "testPrdInitialize()" );
- TS_TRACE(EXIT_MRK "testPrdInitialize()");
+ TS_TRACE(EXIT_MRK __FUNCTION__);
}
void testPrdMain(void)
{
using namespace PRDF;
- TS_TRACE(ENTER_MRK "testPrdMain()");
+ TS_TRACE(ENTER_MRK __FUNCTION__);
PRDF_ENTER( "testPrdMain()" );
errlHndl_t l_pErr = NULL;
@@ -116,19 +116,19 @@ class prdfTest: public CxxTest::TestSuite
}
PRDF_EXIT( "testPrdMain()" );
- TS_TRACE(EXIT_MRK "testPrdMain()");
+ TS_TRACE(EXIT_MRK __FUNCTION__);
}
void testPrdIplCleanup(void)
{
using namespace PRDF;
- TS_TRACE(ENTER_MRK "testPrdIplCleanup()");
+ TS_TRACE(ENTER_MRK __FUNCTION__);
PRDF_ENTER( "testPrdIplCleanup()" );
PrdIplCleanup();
PRDF_EXIT( "testPrdIplCleanup()" );
- TS_TRACE(EXIT_MRK "testPrdIplCleanup()");
+ TS_TRACE(EXIT_MRK __FUNCTION__);
}
};
diff --git a/src/usr/errl/errludtarget.C b/src/usr/errl/errludtarget.C
index a04285cf8..86d221b47 100644
--- a/src/usr/errl/errludtarget.C
+++ b/src/usr/errl/errludtarget.C
@@ -26,7 +26,8 @@
* @brief Implementation of ErrlUserDetailsTarget
*/
#include <errl/errludtarget.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/target.H>
+#include <targeting/common/targetservice.H>
namespace ERRORLOG
{
diff --git a/src/usr/fsi/fsidd.C b/src/usr/fsi/fsidd.C
index 694ccacca..e870411c5 100644
--- a/src/usr/fsi/fsidd.C
+++ b/src/usr/fsi/fsidd.C
@@ -35,14 +35,12 @@
#include <devicefw/driverif.H>
#include <trace/interface.H>
#include <errl/errlentry.H>
-#include <targeting/targetservice.H>
#include <errl/errlmanager.H>
#include <initservice/taskargs.H>
-#include <targeting/predicates/predicatectm.H>
#include <sys/time.h>
#include <string.h>
#include <algorithm>
-#include <targeting/util.H>
+#include <targeting/common/commontargeting.H>
// FSI : General driver traces
trace_desc_t* g_trac_fsi = NULL;
diff --git a/src/usr/fsi/fsipres.C b/src/usr/fsi/fsipres.C
index c5440cc4e..9954204c0 100644
--- a/src/usr/fsi/fsipres.C
+++ b/src/usr/fsi/fsipres.C
@@ -21,7 +21,7 @@
//
// IBM_PROLOG_END
#include <devicefw/driverif.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/attributes.H>
#include <fsi/fsi_reasoncodes.H>
#include "fsidd.H"
diff --git a/src/usr/fsi/test/fsiddtest.H b/src/usr/fsi/test/fsiddtest.H
index 12b6edb68..e98a896a4 100644
--- a/src/usr/fsi/test/fsiddtest.H
+++ b/src/usr/fsi/test/fsiddtest.H
@@ -37,7 +37,7 @@
#include <fsi/fsiif.H>
#include <fsi/fsi_reasoncodes.H>
#include <sys/time.h>
-#include <targeting/util.H>
+#include <targeting/common/attributes.H>
extern trace_desc_t* g_trac_fsi;
diff --git a/src/usr/fsi/test/fsiprestest.H b/src/usr/fsi/test/fsiprestest.H
index 7b08a21d0..f2787466f 100644
--- a/src/usr/fsi/test/fsiprestest.H
+++ b/src/usr/fsi/test/fsiprestest.H
@@ -30,12 +30,8 @@
#include <trace/interface.H>
#include <cxxtest/TestSuite.H>
-#include <targeting/targetservice.H>
#include <devicefw/userif.H>
-#include <targeting/predicates/predicatectm.H>
-#include <targeting/predicates/predicatepostfixexpr.H>
-#include <targeting/iterators/rangefilter.H>
-#include <targeting/util.H>
+#include <targeting/common/commontargeting.H>
using namespace TARGETING;
using namespace DeviceFW;
diff --git a/src/usr/hwas/deconfigGard.C b/src/usr/hwas/deconfigGard.C
index 84695f034..7e3c936ed 100644
--- a/src/usr/hwas/deconfigGard.C
+++ b/src/usr/hwas/deconfigGard.C
@@ -27,7 +27,7 @@
*/
#include <string.h>
-#include <targeting/targetservice.H>
+#include <targeting/common/targetservice.H>
#include <errl/errlmanager.H>
#include <errl/errludtarget.H>
#include <hwas/deconfigGard.H>
diff --git a/src/usr/hwas/hwas.C b/src/usr/hwas/hwas.C
index b53f8da45..ac7ac32c4 100644
--- a/src/usr/hwas/hwas.C
+++ b/src/usr/hwas/hwas.C
@@ -36,10 +36,7 @@
#include <stdint.h>
#include <assert.h>
-#include <targeting/targetservice.H>
-#include <targeting/iterators/rangefilter.H>
-#include <targeting/predicates/predicates.H>
-#include <targeting/util.H>
+#include <targeting/common/commontargeting.H>
#include <hwas/hwas.H>
#include <hwas/hwasCommon.H>
diff --git a/src/usr/hwas/test/hwas1test.H b/src/usr/hwas/test/hwas1test.H
index 97a1051b7..894db8a1a 100644
--- a/src/usr/hwas/test/hwas1test.H
+++ b/src/usr/hwas/test/hwas1test.H
@@ -46,13 +46,7 @@
#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>
+#include <targeting/common/commontargeting.H>
class HWAS1test: public CxxTest::TestSuite
{
diff --git a/src/usr/hwas/test/hwasGardTest.H b/src/usr/hwas/test/hwasGardTest.H
index 4a73dc7ec..ad143ff19 100644
--- a/src/usr/hwas/test/hwasGardTest.H
+++ b/src/usr/hwas/test/hwasGardTest.H
@@ -36,7 +36,7 @@
// CXXTEST
#include <cxxtest/TestSuite.H>
#include <errl/errlmanager.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/targetservice.H>
#include <hwas/deconfigGard.H>
#include <hwas/hwas_reasoncodes.H>
diff --git a/src/usr/hwas/testHWP.C b/src/usr/hwas/testHWP.C
index a95a92a9b..d852295f5 100644
--- a/src/usr/hwas/testHWP.C
+++ b/src/usr/hwas/testHWP.C
@@ -54,10 +54,9 @@
#include <fapiTarget.H>
#include <fapiPlatHwpInvoker.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/targetservice.H>
using namespace fapi;
-using namespace TARGETING;
/******************************************************************************/
// Globals/Constants
diff --git a/src/usr/hwpf/hwp/activate_powerbus/activate_powerbus.C b/src/usr/hwpf/hwp/activate_powerbus/activate_powerbus.C
index b955a0f59..9a87e0bbd 100644
--- a/src/usr/hwpf/hwp/activate_powerbus/activate_powerbus.C
+++ b/src/usr/hwpf/hwp/activate_powerbus/activate_powerbus.C
@@ -45,14 +45,7 @@
#include <initservice/isteps_trace.H>
// targeting support
-#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>
-#include <targeting/predicates/predicateisfunctional.H>
+#include <targeting/common/commontargeting.H>
// fapi support
#include <fapi.H>
diff --git a/src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.C b/src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.C
index 5cddd5adc..3ed8bfa38 100644
--- a/src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.C
+++ b/src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.C
@@ -45,14 +45,7 @@
#include <initservice/isteps_trace.H>
// targeting support
-#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>
-#include <targeting/predicates/predicateisfunctional.H>
+#include <targeting/common/commontargeting.H>
// fapi support
#include <fapi.H>
diff --git a/src/usr/hwpf/hwp/core_activate/core_activate.C b/src/usr/hwpf/hwp/core_activate/core_activate.C
index ca455cf1b..879821424 100644
--- a/src/usr/hwpf/hwp/core_activate/core_activate.C
+++ b/src/usr/hwpf/hwp/core_activate/core_activate.C
@@ -45,14 +45,7 @@
#include <initservice/isteps_trace.H>
// targeting support
-#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>
-#include <targeting/predicates/predicateisfunctional.H>
+#include <targeting/common/commontargeting.H>
// fapi support
#include <fapi.H>
diff --git a/src/usr/hwpf/hwp/dmi_training/dmi_training.C b/src/usr/hwpf/hwp/dmi_training/dmi_training.C
index 766232947..1ab3e494c 100644
--- a/src/usr/hwpf/hwp/dmi_training/dmi_training.C
+++ b/src/usr/hwpf/hwp/dmi_training/dmi_training.C
@@ -48,15 +48,7 @@
#include <initservice/isteps_trace.H>
// targeting support.
-#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>
-#include <targeting/predicates/predicateisfunctional.H>
-
+#include <targeting/common/commontargeting.H>
// fapi support
#include <fapi.H>
diff --git a/src/usr/hwpf/hwp/dram_initialization/dram_initialization.C b/src/usr/hwpf/hwp/dram_initialization/dram_initialization.C
index b2b252b62..cf293ccd4 100644
--- a/src/usr/hwpf/hwp/dram_initialization/dram_initialization.C
+++ b/src/usr/hwpf/hwp/dram_initialization/dram_initialization.C
@@ -45,14 +45,7 @@
#include <initservice/isteps_trace.H>
// targeting support
-#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>
-#include <targeting/predicates/predicateisfunctional.H>
+#include <targeting/common/commontargeting.H>
// fapi support
#include <fapi.H>
diff --git a/src/usr/hwpf/hwp/dram_training/dram_training.C b/src/usr/hwpf/hwp/dram_training/dram_training.C
index d49d10ada..80bff34aa 100644
--- a/src/usr/hwpf/hwp/dram_training/dram_training.C
+++ b/src/usr/hwpf/hwp/dram_training/dram_training.C
@@ -45,20 +45,13 @@
#include <initservice/isteps_trace.H>
// targeting support
-#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>
-#include <targeting/predicates/predicateisfunctional.H>
+#include <targeting/common/commontargeting.H>
+#include <targeting/common/util.H>
// fapi support
#include <fapi.H>
#include <fapiPlatHwpInvoker.H>
-#include <targeting/util.H>
const uint8_t UNLIMITED_RUN = 0xFF;
const uint8_t VPO_NUM_OF_MBAS_TO_RUN = 1;
const uint8_t VPO_NUM_OF_MEMBUF_TO_RUN = 1;
diff --git a/src/usr/hwpf/hwp/edi_ei_initialization/edi_ei_initialization.C b/src/usr/hwpf/hwp/edi_ei_initialization/edi_ei_initialization.C
index 4e8ca3dee..ca7c6b246 100644
--- a/src/usr/hwpf/hwp/edi_ei_initialization/edi_ei_initialization.C
+++ b/src/usr/hwpf/hwp/edi_ei_initialization/edi_ei_initialization.C
@@ -45,14 +45,7 @@
#include <initservice/isteps_trace.H>
// targeting support
-#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>
-#include <targeting/predicates/predicateisfunctional.H>
+#include <targeting/common/commontargeting.H>
// fapi support
#include <fapi.H>
diff --git a/src/usr/hwpf/hwp/establish_system_smp/establish_system_smp.C b/src/usr/hwpf/hwp/establish_system_smp/establish_system_smp.C
index a517ce5a4..0f9015739 100644
--- a/src/usr/hwpf/hwp/establish_system_smp/establish_system_smp.C
+++ b/src/usr/hwpf/hwp/establish_system_smp/establish_system_smp.C
@@ -45,14 +45,7 @@
#include <initservice/isteps_trace.H>
// targeting support
-#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>
-#include <targeting/predicates/predicateisfunctional.H>
+#include <targeting/common/commontargeting.H>
// fapi support
#include <fapi.H>
diff --git a/src/usr/hwpf/hwp/fapiTestHwpAttr.C b/src/usr/hwpf/hwp/fapiTestHwpAttr.C
index 731c82720..0d22b984b 100755
--- a/src/usr/hwpf/hwp/fapiTestHwpAttr.C
+++ b/src/usr/hwpf/hwp/fapiTestHwpAttr.C
@@ -45,9 +45,7 @@
*/
#include <fapiTestHwpAttr.H>
-#include <targeting/targetservice.H>
-#include <targeting/predicates/predicatectm.H>
-#include <targeting/iterators/rangefilter.H>
+#include <targeting/common/commontargeting.H>
extern "C"
{
diff --git a/src/usr/hwpf/hwp/load_payload/load_payload.C b/src/usr/hwpf/hwp/load_payload/load_payload.C
index ee2531d1c..403f962eb 100644
--- a/src/usr/hwpf/hwp/load_payload/load_payload.C
+++ b/src/usr/hwpf/hwp/load_payload/load_payload.C
@@ -45,14 +45,7 @@
#include <initservice/isteps_trace.H>
// targeting support
-#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>
-#include <targeting/predicates/predicateisfunctional.H>
+#include <targeting/common/commontargeting.H>
// fapi support
#include <fapi.H>
diff --git a/src/usr/hwpf/hwp/mc_init/mc_init.C b/src/usr/hwpf/hwp/mc_init/mc_init.C
index abfcf6200..10ba1fca3 100644
--- a/src/usr/hwpf/hwp/mc_init/mc_init.C
+++ b/src/usr/hwpf/hwp/mc_init/mc_init.C
@@ -45,12 +45,7 @@
#include <initservice/isteps_trace.H>
// targeting support
-#include <targeting/attributes.H>
-#include <targeting/entitypath.H>
-#include <targeting/target.H>
-#include <targeting/targetservice.H>
-#include <targeting/iterators/rangefilter.H>
-#include <targeting/predicates/predicates.H>
+#include <targeting/common/commontargeting.H>
// fapi support
#include <fapi.H>
diff --git a/src/usr/hwpf/hwp/sbe_centaur_init/sbe_centaur_init.C b/src/usr/hwpf/hwp/sbe_centaur_init/sbe_centaur_init.C
index 8e6611d8e..333609205 100644
--- a/src/usr/hwpf/hwp/sbe_centaur_init/sbe_centaur_init.C
+++ b/src/usr/hwpf/hwp/sbe_centaur_init/sbe_centaur_init.C
@@ -41,13 +41,8 @@
#include <initservice/taskargs.H>
#include <errl/errlentry.H>
#include <initservice/isteps_trace.H>
-#include <targeting/targetservice.H>
-#include <targeting/iterators/rangefilter.H>
-#include <targeting/predicates/predicatectm.H>
-#include <targeting/predicates/predicatepostfixexpr.H>
-#include <targeting/predicates/predicateisfunctional.H>
+#include <targeting/common/commontargeting.H>
#include <fapi.H>
-#include <targeting/target.H>
#include <fapiPoreVeArg.H>
#include <fapiTarget.H>
#include <fapi.H>
@@ -55,10 +50,9 @@
#include <list>
#include "sbe_centaur_init.H"
-//@todo - These two include files are to workaround
-//1. Avoid running test case in VBU
-//2. To call isSlavePresent(). Need to be removed when PD works.
-#include <targeting/util.H>
+//@todo - The following workarounds need to be readdressed
+//1. Avoid running test case in VBU below
+//2. To call isSlavePresent(). Need to remove following header when PD works.
#include <fsi/fsiif.H>
// Extern function declaration
diff --git a/src/usr/hwpf/hwp/start_clocks_on_nest_chiplets/start_clocks_on_nest_chiplets.C b/src/usr/hwpf/hwp/start_clocks_on_nest_chiplets/start_clocks_on_nest_chiplets.C
index dec4dd82b..ee378ac89 100644
--- a/src/usr/hwpf/hwp/start_clocks_on_nest_chiplets/start_clocks_on_nest_chiplets.C
+++ b/src/usr/hwpf/hwp/start_clocks_on_nest_chiplets/start_clocks_on_nest_chiplets.C
@@ -45,14 +45,7 @@
#include <initservice/isteps_trace.H>
// targeting support
-#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>
-#include <targeting/predicates/predicateisfunctional.H>
+#include <targeting/common/commontargeting.H>
// fapi support
#include <fapi.H>
diff --git a/src/usr/hwpf/hwp/start_payload/start_payload.C b/src/usr/hwpf/hwp/start_payload/start_payload.C
index 85061f667..ecc2ba3e9 100644
--- a/src/usr/hwpf/hwp/start_payload/start_payload.C
+++ b/src/usr/hwpf/hwp/start_payload/start_payload.C
@@ -45,14 +45,7 @@
#include <initservice/isteps_trace.H>
// targeting support
-#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>
-#include <targeting/predicates/predicateisfunctional.H>
+#include <targeting/common/commontargeting.H>
// fapi support
#include <fapi.H>
diff --git a/src/usr/hwpf/plat/fapiPlatAttributeService.C b/src/usr/hwpf/plat/fapiPlatAttributeService.C
index b7a0e1904..72c4a5b3e 100644
--- a/src/usr/hwpf/plat/fapiPlatAttributeService.C
+++ b/src/usr/hwpf/plat/fapiPlatAttributeService.C
@@ -33,7 +33,7 @@
//******************************************************************************
#include <hwpf/fapi/fapiTarget.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/targetservice.H>
#include <errl/errlentry.H>
#include <hwpf/plat/fapiPlatAttributeService.H>
#include <hwpf/plat/fapiPlatReasonCodes.H>
diff --git a/src/usr/hwpf/plat/fapiPlatHwAccess.C b/src/usr/hwpf/plat/fapiPlatHwAccess.C
index c2a3d143b..1464ff906 100644
--- a/src/usr/hwpf/plat/fapiPlatHwAccess.C
+++ b/src/usr/hwpf/plat/fapiPlatHwAccess.C
@@ -53,12 +53,11 @@
#include <fapiPlatTrace.H>
#include <fapiPlatHwAccess.H>
#include <errl/errlentry.H>
-#include <targeting/targetservice.H>
#include <devicefw/userif.H>
#include <ecmdDataBufferBase.H>
#include <fapiPlatReasonCodes.H>
-#include <targeting/predicates/predicatectm.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/predicates/predicates.H>
+#include <targeting/common/targetservice.H>
extern "C"
{
diff --git a/src/usr/hwpf/plat/fapiPlatSystemConfig.C b/src/usr/hwpf/plat/fapiPlatSystemConfig.C
index 4e86de714..f96ab4a8d 100644
--- a/src/usr/hwpf/plat/fapiPlatSystemConfig.C
+++ b/src/usr/hwpf/plat/fapiPlatSystemConfig.C
@@ -32,8 +32,8 @@
#include <fapiSystemConfig.H>
#include <fapiPlatReasonCodes.H>
#include <errl/errlentry.H>
-#include <targeting/targetservice.H>
-#include <targeting/predicates/predicatectm.H>
+#include <targeting/common/targetservice.H>
+#include <targeting/common/predicates/predicates.H>
extern "C"
{
diff --git a/src/usr/hwpf/plat/fapiPlatTarget.C b/src/usr/hwpf/plat/fapiPlatTarget.C
index bd84316ab..50a5d873b 100644
--- a/src/usr/hwpf/plat/fapiPlatTarget.C
+++ b/src/usr/hwpf/plat/fapiPlatTarget.C
@@ -38,7 +38,7 @@
#include <fapiTarget.H>
#include <fapiPlatTrace.H>
-#include <targeting/target.H>
+#include <targeting/common/attributes.H>
#include <string.h>
namespace fapi
diff --git a/src/usr/hwpf/test/hwpftest.H b/src/usr/hwpf/test/hwpftest.H
index e482f4caa..ee308701c 100644
--- a/src/usr/hwpf/test/hwpftest.H
+++ b/src/usr/hwpf/test/hwpftest.H
@@ -34,11 +34,9 @@
#include <fapiPlatHwpInvoker.H>
#include <errl/errlentry.H>
#include <errl/errlmanager.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/commontargeting.H>
#include <fapiHwpExecInitFile.H>
#include <spd/spdenums.H>
-#include <targeting/predicates/predicatectm.H>
-#include <targeting/iterators/rangefilter.H>
using namespace fapi;
using namespace TARGETING;
diff --git a/src/usr/i2c/eepromdd.C b/src/usr/i2c/eepromdd.C
index f472a72f2..1102cb26b 100755
--- a/src/usr/i2c/eepromdd.C
+++ b/src/usr/i2c/eepromdd.C
@@ -38,7 +38,7 @@
#include <trace/interface.H>
#include <errl/errlentry.H>
#include <errl/errlmanager.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/targetservice.H>
#include <devicefw/driverif.H>
#include <i2c/eepromddreasoncodes.H>
diff --git a/src/usr/i2c/i2c.C b/src/usr/i2c/i2c.C
index a503e97cf..0c6c40f9d 100755
--- a/src/usr/i2c/i2c.C
+++ b/src/usr/i2c/i2c.C
@@ -36,7 +36,7 @@
#include <trace/interface.H>
#include <errl/errlentry.H>
#include <errl/errlmanager.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/targetservice.H>
#include <devicefw/driverif.H>
#include <i2c/i2creasoncodes.H>
diff --git a/src/usr/i2c/test/eepromddtest.H b/src/usr/i2c/test/eepromddtest.H
index d71cdc88a..0e8ceae73 100755
--- a/src/usr/i2c/test/eepromddtest.H
+++ b/src/usr/i2c/test/eepromddtest.H
@@ -35,9 +35,7 @@
#include <errl/errlentry.H>
#include <devicefw/driverif.H>
#include <i2c/eepromddreasoncodes.H>
-#include <targeting/predicates/predicatectm.H>
-#include <targeting/predicates/predicatepostfixexpr.H>
-#include <targeting/util.H>
+#include <targeting/common/commontargeting.H>
#include "i2ctest.H"
extern trace_desc_t* g_trac_eeprom;
diff --git a/src/usr/i2c/test/i2ctest.H b/src/usr/i2c/test/i2ctest.H
index e9ab1212a..e1933ac62 100755
--- a/src/usr/i2c/test/i2ctest.H
+++ b/src/usr/i2c/test/i2ctest.H
@@ -35,8 +35,8 @@
#include <errl/errlentry.H>
#include <devicefw/driverif.H>
#include <i2c/i2creasoncodes.H>
-#include <targeting/predicates/predicatectm.H>
-#include <targeting/util.H>
+#include <targeting/common/predicates/predicates.H>
+#include <targeting/common/attributes.H>
extern trace_desc_t* g_trac_i2c;
diff --git a/src/usr/initservice/istepdispatcher/istepdispatcher.C b/src/usr/initservice/istepdispatcher/istepdispatcher.C
index 3f5cd5594..1738343a4 100644
--- a/src/usr/initservice/istepdispatcher/istepdispatcher.C
+++ b/src/usr/initservice/istepdispatcher/istepdispatcher.C
@@ -58,10 +58,8 @@
#include <initservice/taskargs.H> // TASK_ENTRY_MACRO
-#include <targeting/attributes.H> // ISTEP_MODE attribute
-#include <targeting/entitypath.H>
-#include <targeting/target.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/attributes.H> // ISTEP_MODE attribute
+#include <targeting/common/targetservice.H>
#include <mbox/mbox_queues.H> // HB_ISTEP_MSGQ
#include <mbox/mboxif.H> // register mailbox
@@ -71,7 +69,7 @@
#include "splesscommon.H"
#include <isteps/istepmasterlist.H>
-#include <targeting/util.H>
+#include <targeting/common/attributes.H>
// ----- namespace ISTEPS_TRACE ---------------------------------------
namespace ISTEPS_TRACE
diff --git a/src/usr/initservice/istepdispatcher/splesscommon.H b/src/usr/initservice/istepdispatcher/splesscommon.H
index ecf863f5f..6d5d84953 100644
--- a/src/usr/initservice/istepdispatcher/splesscommon.H
+++ b/src/usr/initservice/istepdispatcher/splesscommon.H
@@ -50,10 +50,8 @@
#include <sys/mmio.h> // mmio_scratch_read()
-#include <targeting/attributes.H> // ISTEP_MODE attribute
-#include <targeting/entitypath.H>
-#include <targeting/target.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/attributes.H> // ISTEP_MODE attribute
+#include <targeting/common/targetservice.H>
// external reference
diff --git a/src/usr/initservice/istepdispatcher/sptask.C b/src/usr/initservice/istepdispatcher/sptask.C
index c8a56221c..946aad7df 100644
--- a/src/usr/initservice/istepdispatcher/sptask.C
+++ b/src/usr/initservice/istepdispatcher/sptask.C
@@ -51,7 +51,7 @@
#include <initservice/initsvcudistep.H> // InitSvcUserDetailsIstep
#include <initservice/taskargs.H> // TASK_ENTRY_MACRO
-#include <targeting/util.H> //
+#include <targeting/common/util.H> //
#include "istepdispatcher.H"
#include "splesscommon.H"
diff --git a/src/usr/intr/intrrp.C b/src/usr/intr/intrrp.C
index 224826fc1..5e6771e5b 100644
--- a/src/usr/intr/intrrp.C
+++ b/src/usr/intr/intrrp.C
@@ -35,9 +35,9 @@
#include <sys/misc.h>
#include <kernel/console.H>
#include <sys/task.h>
-#include <targeting/targetservice.H>
+#include <targeting/common/targetservice.H>
#include <vmmconst.h>
-#include <targeting/util.H>
+#include <targeting/common/attributes.H>
using namespace INTR;
diff --git a/src/usr/intr/test/intrtest.H b/src/usr/intr/test/intrtest.H
index 48d2496f8..ae9ce135f 100644
--- a/src/usr/intr/test/intrtest.H
+++ b/src/usr/intr/test/intrtest.H
@@ -28,8 +28,8 @@
#include <errl/errlentry.H>
#include <errl/errlmanager.H>
#include <kernel/console.H>
-#include <targeting/targetservice.H>
-#include <targeting/util.H>
+#include <targeting/common/targetservice.H>
+#include <targeting/common/attributes.H>
#include <sys/time.h>
#include <sys/mmio.h>
diff --git a/src/usr/mbox/mboxdd.C b/src/usr/mbox/mboxdd.C
index 1aff9405c..adf4e2512 100644
--- a/src/usr/mbox/mboxdd.C
+++ b/src/usr/mbox/mboxdd.C
@@ -26,7 +26,7 @@
#include <devicefw/driverif.H>
#include <trace/interface.H>
#include <errl/errlentry.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/targetservice.H>
using namespace MBOX;
diff --git a/src/usr/mbox/test/mboxsptest.H b/src/usr/mbox/test/mboxsptest.H
index 7a40d1f3b..e001e19e7 100644
--- a/src/usr/mbox/test/mboxsptest.H
+++ b/src/usr/mbox/test/mboxsptest.H
@@ -35,7 +35,7 @@
#include <errl/hberrltypes.H>
#include <limits.h>
#include <mbox/mboxif.H>
-#include <targeting/util.H>
+#include <targeting/common/util.H>
extern trace_desc_t* g_trac_mbox;
diff --git a/src/usr/mvpd/mvpd.C b/src/usr/mvpd/mvpd.C
index ca32d6800..99fa2bd9c 100755
--- a/src/usr/mvpd/mvpd.C
+++ b/src/usr/mvpd/mvpd.C
@@ -35,7 +35,7 @@
#include <trace/interface.H>
#include <errl/errlentry.H>
#include <errl/errlmanager.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/targetservice.H>
#include <devicefw/driverif.H>
#include <vfs/vfs.H>
#include <mvpd/mvpdreasoncodes.H>
diff --git a/src/usr/mvpd/test/mvpdtest.H b/src/usr/mvpd/test/mvpdtest.H
index 6386dabff..adca80fd2 100755
--- a/src/usr/mvpd/test/mvpdtest.H
+++ b/src/usr/mvpd/test/mvpdtest.H
@@ -34,7 +34,7 @@
#include <errl/errlmanager.H>
#include <errl/errlentry.H>
#include <devicefw/driverif.H>
-#include <targeting/predicates/predicatectm.H>
+#include <targeting/common/predicates/predicatectm.H>
#include <mvpd/mvpdenums.H>
#include <mvpd/mvpdreasoncodes.H>
diff --git a/src/usr/pnor/pnordd.C b/src/usr/pnor/pnordd.C
index 5b409e32c..36a014412 100644
--- a/src/usr/pnor/pnordd.C
+++ b/src/usr/pnor/pnordd.C
@@ -36,7 +36,7 @@
#include <devicefw/driverif.H>
#include <trace/interface.H>
#include <errl/errlentry.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/targetservice.H>
#include <errl/errlmanager.H>
#include "pnordd.H"
#include <pnor/pnorif.H>
diff --git a/src/usr/pnor/pnorrp.C b/src/usr/pnor/pnorrp.C
index 566358567..b28eeaeb4 100644
--- a/src/usr/pnor/pnorrp.C
+++ b/src/usr/pnor/pnorrp.C
@@ -26,7 +26,7 @@
#include <sys/msg.h>
#include <trace/interface.H>
#include <errl/errlmanager.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/targetservice.H>
#include <devicefw/userif.H>
#include <limits.h>
#include <string.h>
diff --git a/src/usr/pnor/test/pnorddtest.H b/src/usr/pnor/test/pnorddtest.H
index 74e357cdf..9f5201f55 100644
--- a/src/usr/pnor/test/pnorddtest.H
+++ b/src/usr/pnor/test/pnorddtest.H
@@ -38,7 +38,7 @@
#include <sys/time.h>
#include "../pnordd.H"
#include <list>
-#include <targeting/util.H>
+#include <targeting/common/attributes.H>
#define BASE_SCRATCH_SPACE (3*1024*1024+1024*512) //3.5MB offset in fake PNOR
diff --git a/src/usr/pore/test/poretest.H b/src/usr/pore/test/poretest.H
index a8d6e7487..fd0af5e96 100644
--- a/src/usr/pore/test/poretest.H
+++ b/src/usr/pore/test/poretest.H
@@ -31,20 +31,15 @@
#include <list>
#include <cxxtest/TestSuite.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/commontargeting.H>
#include <fapiPoreVeArg.H>
#include <fapiTarget.H>
#include <fapi.H>
#include <vfs/vfs.H>
-#include <targeting/predicates/predicatectm.H>
-#include <targeting/iterators/rangefilter.H>
-#include <targeting/predicates/predicatepostfixexpr.H>
-#include <targeting/predicates/predicateisfunctional.H>
//@todo - These two include files are to workaround
//1. Avoid running test case in VBU
//2. To call isSlavePresent(). Need to be removed when PD works.
-#include <targeting/util.H>
#include <fsi/fsiif.H>
#define CENTAUR_SBE_PNOR_MRR 0 // Memory Relocation Register for Centaur
diff --git a/src/usr/scom/test/scomtest.H b/src/usr/scom/test/scomtest.H
index 198a962ab..066dcaca6 100644
--- a/src/usr/scom/test/scomtest.H
+++ b/src/usr/scom/test/scomtest.H
@@ -34,7 +34,7 @@
#include <errl/errlentry.H>
#include <devicefw/userif.H>
#include <fsi/fsiif.H>
-#include <targeting/util.H>
+#include <targeting/common/util.H>
extern trace_desc_t* g_trac_scom;
diff --git a/src/usr/spd/dimmPres.C b/src/usr/spd/dimmPres.C
index 0fc131676..e1b349c93 100755
--- a/src/usr/spd/dimmPres.C
+++ b/src/usr/spd/dimmPres.C
@@ -33,7 +33,7 @@
#include <trace/interface.H>
#include <errl/errlentry.H>
#include <errl/errlmanager.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/targetservice.H>
#include <devicefw/driverif.H>
#include <spd/spdreasoncodes.H>
#include <spd/spdenums.H>
diff --git a/src/usr/spd/spd.C b/src/usr/spd/spd.C
index 3a4147025..0d1dfc289 100755
--- a/src/usr/spd/spd.C
+++ b/src/usr/spd/spd.C
@@ -33,7 +33,7 @@
#include <trace/interface.H>
#include <errl/errlentry.H>
#include <errl/errlmanager.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/targetservice.H>
#include <devicefw/driverif.H>
#include <vfs/vfs.H>
#include <spd/spdreasoncodes.H>
diff --git a/src/usr/spd/test/dimmPrestest.H b/src/usr/spd/test/dimmPrestest.H
index 624e30786..cd33f13dd 100755
--- a/src/usr/spd/test/dimmPrestest.H
+++ b/src/usr/spd/test/dimmPrestest.H
@@ -34,7 +34,7 @@
#include <errl/errlmanager.H>
#include <errl/errlentry.H>
#include <devicefw/driverif.H>
-#include <targeting/predicates/predicatectm.H>
+#include <targeting/common/predicates/predicates.H>
#include <spd/spdreasoncodes.H>
#include <spd/spdenums.H>
diff --git a/src/usr/spd/test/spdtest.H b/src/usr/spd/test/spdtest.H
index b8105592e..e948fe589 100755
--- a/src/usr/spd/test/spdtest.H
+++ b/src/usr/spd/test/spdtest.H
@@ -34,7 +34,7 @@
#include <errl/errlmanager.H>
#include <errl/errlentry.H>
#include <devicefw/driverif.H>
-#include <targeting/predicates/predicatectm.H>
+#include <targeting/common/predicates/predicates.H>
#include <spd/spdreasoncodes.H>
#include <spd/spdenums.H>
diff --git a/src/usr/targeting/attrrp.C b/src/usr/targeting/attrrp.C
index 324911778..c250ec4d5 100644
--- a/src/usr/targeting/attrrp.C
+++ b/src/usr/targeting/attrrp.C
@@ -20,6 +20,16 @@
// Origin: 30
//
// IBM_PROLOG_END
+
+/**
+ * @file targeting/attrrp.C
+ *
+ * @brief Attribute resource provider implementation which establishes and
+ * initializes virtual memory ranges for attributes as needed, and works
+ * with other resource providers (such as the PNOR resource provider) to
+ * retrieve attribute data which it connot directly provide.
+ */
+
#include <util/singleton.H>
#include <pnortargeting.H>
#include <pnor/pnorif.H>
@@ -28,10 +38,10 @@
#include <string.h>
#include <algorithm>
#include <vmmconst.h>
-
-#include <targeting/targreasoncodes.H>
-#include "attrrp.H"
-#include "trace.H"
+#include <targeting/adapters/assertadapter.H>
+#include <targeting/common/targreasoncodes.H>
+#include <targeting/attrrp.H>
+#include <targeting/common/trace.H>
#include <initservice/initserviceif.H>
using namespace INITSERVICE;
@@ -44,27 +54,35 @@ namespace TARGETING
*/
struct AttrRP_Section
{
- /** Section type. */
- SECTION_TYPE type;
- /** Desired address in Attribute virtual address space. */
- uint64_t vmmAddress;
- /** Location in PNOR virtual address space. */
- uint64_t pnorAddress;
- /** Section size. */
- uint64_t size;
+ // Section type
+ SECTION_TYPE type;
+
+ // Desired address in Attribute virtual address space
+ uint64_t vmmAddress;
+
+ // Location in PNOR virtual address space
+ uint64_t pnorAddress;
+
+ // Section size
+ uint64_t size;
};
- void AttrRP::init( errlHndl_t &io_taskRetErrl )
+ void AttrRP::init(errlHndl_t &io_taskRetErrl)
{
// Call startup on singleton instance.
- Singleton<AttrRP>::instance().startup( io_taskRetErrl );
+ Singleton<AttrRP>::instance().startup(io_taskRetErrl);
+ }
+
+ void* AttrRP::getBaseAddress()
+ {
+ return reinterpret_cast<void*>(VMM_VADDR_ATTR_RP);
}
- void AttrRP::startMsgServiceTask(void* i_instance)
+ void AttrRP::startMsgServiceTask(void* i_pInstance)
{
// Call msgServiceTask loop on instance.
- assert(i_instance);
- static_cast<AttrRP*>(i_instance)->msgServiceTask();
+ TARG_ASSERT(i_pInstance);
+ static_cast<AttrRP*>(i_pInstance)->msgServiceTask();
}
AttrRP::~AttrRP()
@@ -75,10 +93,10 @@ namespace TARGETING
}
msg_q_destroy(iv_msgQ);
- assert(false);
+ TARG_ASSERT(false);
}
- void AttrRP::startup( errlHndl_t &io_taskRetErrl )
+ void AttrRP::startup(errlHndl_t& io_taskRetErrl)
{
errlHndl_t l_errl = NULL;
@@ -86,11 +104,17 @@ namespace TARGETING
{
// Parse PNOR headers.
l_errl = this->parseAttrSectHeader();
- if (l_errl) break;
+ if (l_errl)
+ {
+ break;
+ }
// Create corresponding VMM blocks for each section.
l_errl = this->createVmmSections();
- if (l_errl) break;
+ if (l_errl)
+ {
+ break;
+ }
// Spawn daemon thread.
task_create(&AttrRP::startMsgServiceTask, this);
@@ -104,7 +128,7 @@ namespace TARGETING
}
// return any errlogs to _start()
- io_taskRetErrl = l_errl;
+ io_taskRetErrl = l_errl;
}
void AttrRP::msgServiceTask() const
@@ -314,8 +338,14 @@ namespace TARGETING
for (size_t i = 0; i < iv_sectionCount; i++, l_section++)
{
iv_sections[i].type = l_section->sectionType;
+
+ // Conversion cast for templated abstract pointer object only
+ // works when casting to pointer of the templated type. Since
+ // cache is of a different type, we first cast to extract the
+ // real pointer, then recast it into the cache
iv_sections[i].vmmAddress =
- reinterpret_cast<uint64_t>(l_header->vmmBaseAddress) +
+ reinterpret_cast<uint64_t>(
+ TARG_TO_PLAT_PTR(l_header->vmmBaseAddress)) +
l_header->vmmSectionOffset*i;
iv_sections[i].pnorAddress = l_pnorSectionInfo.vaddr +
l_section->sectionOffset;
diff --git a/src/usr/targeting/attrrp.H b/src/usr/targeting/attrrp.H
deleted file mode 100644
index 3fc2f6a02..000000000
--- a/src/usr/targeting/attrrp.H
+++ /dev/null
@@ -1,125 +0,0 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/usr/targeting/attrrp.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 __TARGETING_ATTRRP_H
-#define __TARGETING_ATTRRP_H
-
-#include <initservice/taskargs.H>
-#include <sys/msg.h>
-
-namespace TARGETING
-{
-
- // Forward declaration of attribute section parsed information structure.
- struct AttrRP_Section;
-
- /** @class AttrRP
- * @brief Attribute Resource Provider daemon class.
- *
- * Provides all the functionality to translate between PNOR and Attribute
- * virtual memory spaces. Parses PNOR header for attribute sections,
- * allocates virtual memory spaces with the kernel for each section, and
- * handles virtual memory request messages from the kernel.
- */
- class AttrRP
- {
- public:
- /** @brief Initializes and starts the AttrRP daemon.
- * @param[in,out] - ref to an errHndl_t
- *
- * @note If any error occurs during initialization, it will be
- * reported back through the TaskArgs structure to the init
- * service.
- */
- static void init( errlHndl_t &io_taskRetErrl );
-
- protected:
- /** @brief Default constructor.
- * Ensures member variables are initialized to sane values.
- */
- AttrRP() :
- iv_msgQ(NULL), iv_sections(NULL), iv_sectionCount(0)
- { };
-
- /** @brief Default destructor.
- * Frees any memory allocated by the daemon.
- *
- * @note This should never actually be used because the daemon
- * thread and the vmm blocks are unable to be reclaimed.
- * Function will assert if called due to leaky behavior.
- */
- ~AttrRP();
-
- private:
- /** @brief Performs the startup of the daemon instance.
- *
- * init() is a static function that just calls
- * Singleton<AttrRP>::instance().startup(). See init for behavior.
- */
- void startup( errlHndl_t &io_taskRetErrl );
-
- /** @brief Daemon thread processing function.
- *
- * Performs a while(1) waiting for messages from the kernel/VMM
- * and handles as appropriately. Reads / writes data from / to
- * PNOR for the attribute sections.
- */
- void msgServiceTask() const;
-
- /** @brief Parses the attribute section header in PNOR.
- *
- * Constructs the local attribute section data structures
- * (iv_sections / iv_sectionCount).
- *
- * @return errlHndl_t - Error log if error occurs.
- */
- errlHndl_t parseAttrSectHeader();
-
- /** @brief Allocates VMM sections for each Attribute section.
- *
- * Calls to the kernel to create vmm blocks for each attribute
- * and initializes permissions appropriately based on section
- * type.
- *
- * @return errlHndl_t - Error log if error occurs.
- */
- errlHndl_t createVmmSections();
-
- /** @brief Redirect to msgServiceTask on the AttrRP instance.
- *
- * This function, being static, can be called from task_create
- * and is used to enter the daemon thread's msgServiceTask loop.
- *
- * @param[in] i_instance - The AttrRP to call msgServiceTask on.
- */
- static void startMsgServiceTask(void* i_instance);
-
- /** Message Queue for VMM requests. */
- msg_q_t iv_msgQ;
- /** Parsed structures of the attribute sections. */
- AttrRP_Section* iv_sections;
- /** Count of attribute sections. */
- size_t iv_sectionCount;
- };
-};
-
-#endif
diff --git a/src/usr/targeting/common/common.mk b/src/usr/targeting/common/common.mk
new file mode 100644
index 000000000..1d7bf231f
--- /dev/null
+++ b/src/usr/targeting/common/common.mk
@@ -0,0 +1,59 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/targeting/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
+
+################################################################################
+#
+# @file targeting/common/common.mk
+#
+# @brief Common targeting makefile to be included in
+# targeting/makefile
+#
+################################################################################
+
+COMMON_TARGETING_SUBDIRS = predicates iterators
+
+PREDICATES_OBJS = \
+ predicatebase.o \
+ predicatepostfixexpr.o \
+ predicatectm.o \
+ predicateisfunctional.o
+
+ITERATORS_OBJS = \
+ targetiterator.o \
+ rangefilter.o
+
+TARGET_OBJS = \
+ target.o \
+ targetservice.o \
+ entitypath.o
+
+OTHER_OBJS = \
+ util.o
+
+# Common
+COMMON_TARGETING_OBJS = \
+ ${TARGET_OBJS} \
+ ${PREDICATES_OBJS} \
+ ${ITERATORS_OBJS} \
+ ${OTHER_OBJS}
+
diff --git a/src/usr/targeting/entitypath.C b/src/usr/targeting/common/entitypath.C
index 26d5da4a1..af1c30ff8 100644
--- a/src/usr/targeting/entitypath.C
+++ b/src/usr/targeting/common/entitypath.C
@@ -22,9 +22,10 @@
// IBM_PROLOG_END
/**
- * @file entitypath.C
+ * @file targeting/common/entitypath.C
*
- * @brief Implementation of the EntityPath class
+ * @brief Implementation of the EntityPath class which provides a hierarchical
+ * path structure for identification of targets
*/
//******************************************************************************
@@ -35,12 +36,14 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <trace/interface.H>
// This component
-#include <targeting/target.H>
-#include <targeting/targetservice.H>
-#include "trace.H"
+#include <attributeenums.H>
+#include <targeting/adapters/types.H>
+#include <targeting/common/trace.H>
+#include <targeting/adapters/assertadapter.H>
+#include <targeting/common/targetservice.H>
+#include <targeting/common/entitypath.H>
namespace TARGETING
{
@@ -49,7 +52,7 @@ namespace TARGETING
#define TARG_CLASS "EntityPath::"
#define TARG_LOC TARG_NAMESPACE TARG_CLASS TARG_FN ": "
-extern trace_desc_t* g_trac_targeting;
+extern TARG_TD_t g_trac_targeting;
//******************************************************************************
// EntityPath::EntityPath (Path Type Constructor)
@@ -99,8 +102,8 @@ EntityPath& EntityPath::removeLast()
{
#define TARG_FN "removeLast()"
- assert(size() >= 1, TARG_LOC "EntityPath empty (size = %d); cannot remove "
- "any path elements", size());
+ TARG_ASSERT(size() >= 1, TARG_LOC "EntityPath empty (size = %d); cannot "
+ "remove any path elements", size());
iv_pathElement[size() - 1].type = TYPE_NA;
iv_pathElement[size() - 1].instance = 0;
@@ -135,7 +138,7 @@ EntityPath& EntityPath::addLast(
{
#define TARG_FN "addLast(...)"
- assert(size() < MAX_PATH_ELEMENTS, TARG_LOC "Entity path cannot "
+ TARG_ASSERT(size() < MAX_PATH_ELEMENTS, TARG_LOC "Entity path cannot "
"store any more path elements with size %d", size());
iv_pathElement[size()].type = i_type;
@@ -171,7 +174,7 @@ Target* EntityPath::operator->(void)
{
#define TARG_FN "operator->()"
- return theTargetService::instance().toTarget(*this);
+ return TARG_GET_SINGLETON(TARGETING::theTargetService).toTarget(*this);
#undef TARG_FN
}
@@ -204,9 +207,9 @@ bool EntityPath::equals(
{
#define TARG_FN "equals(...)"
- assert(i_size <= MAX_PATH_ELEMENTS, TARG_LOC "Caller specified invalid "
- "entity path size of %d which is greater than MAX_PATH_ELEMENTS of "
- "%d",i_size,MAX_PATH_ELEMENTS);
+ TARG_ASSERT(i_size <= MAX_PATH_ELEMENTS, TARG_LOC "Caller specified "
+ "invalid entity path size of %d which is greater than "
+ "MAX_PATH_ELEMENTS of %d",i_size,MAX_PATH_ELEMENTS);
return ( (i_rhs.iv_type == iv_type)
&& (i_size <= i_rhs.size())
@@ -227,8 +230,8 @@ const EntityPath::PathElement& EntityPath::operator[](
{
#define TARG_FN "operator[](...)"
- assert(i_index < size(), TARG_LOC "Caller specified invalid entity path "
- "subscript of %d when size is only %d",i_index,size());
+ TARG_ASSERT(i_index < size(), TARG_LOC "Caller specified invalid entity "
+ "path subscript of %d when size is only %d",i_index,size());
return iv_pathElement[i_index];
@@ -382,6 +385,12 @@ const char* EntityPath::pathElementTypeAsString(
return "XBUS";
case TYPE_ABUS:
return "ABUS";
+ case TYPE_APSS:
+ return "APSS";
+ case TYPE_DPSS:
+ return "DPSS";
+ case TYPE_OCC:
+ return "OCC";
// case TYPE_FSI_LINK:
// return "FSI-link";
// case TYPE_CFAM:
@@ -426,6 +435,7 @@ void EntityPath::dump() const
#define TARG_FN "dump()"
char l_pBuf[200];
+ memset(l_pBuf,'\0',200);
char* l_pCursor = l_pBuf;
l_pCursor+=sprintf(l_pCursor,"%s:",pathTypeAsString());
for(uint32_t i=0; i<size(); ++i)
diff --git a/src/usr/targeting/iterators/rangefilter.C b/src/usr/targeting/common/iterators/rangefilter.C
index c82a183be..7e3ddf333 100644
--- a/src/usr/targeting/iterators/rangefilter.C
+++ b/src/usr/targeting/common/iterators/rangefilter.C
@@ -22,7 +22,7 @@
// IBM_PROLOG_END
/**
- * @file rangefilter.C
+ * @file common/targeting/iterators/rangefilter.C
*
* @brief Implementation of an object which takes an iterator range and
* allows caller to iterate through the elements which match a supplied
@@ -38,7 +38,7 @@
// Other Host Boot Components
// Targeting Component
-#include <targeting/iterators/rangefilter.H>
+#include <targeting/common/iterators/iterators.H>
//******************************************************************************
// Macros
diff --git a/src/usr/targeting/iterators/targetiterator.C b/src/usr/targeting/common/iterators/targetiterator.C
index 47c7abfd6..76b687641 100644
--- a/src/usr/targeting/iterators/targetiterator.C
+++ b/src/usr/targeting/common/iterators/targetiterator.C
@@ -22,7 +22,7 @@
// IBM_PROLOG_END
/**
- * @file targetiterator.C
+ * @file targeting/common/iterators/targetiterator.C
*
* @brief Implementation of iterator/const iterator used to iterate through
* target service targets
@@ -37,8 +37,8 @@
// Other Host Boot Components
// Targeting Component
-#include <targeting/iterators/targetiterator.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/iterators/iterators.H>
+#include <targeting/common/targetservice.H>
//******************************************************************************
// Macros
diff --git a/src/usr/targeting/predicates/predicatebase.C b/src/usr/targeting/common/predicates/predicatebase.C
index e57367cd0..911ccb7f7 100644
--- a/src/usr/targeting/predicates/predicatebase.C
+++ b/src/usr/targeting/common/predicates/predicatebase.C
@@ -22,7 +22,7 @@
// IBM_PROLOG_END
/**
- * @file predicatebase.C
+ * @file targeting/common/predicates/predicatebase.C
*
* @brief Implementation for an abstract targeting predicate which filters a
* set of targets based on the programmed criteria. Only required to
@@ -39,7 +39,7 @@
// Other Host Boot Components
// Targeting Component
-#include <targeting/predicates/predicatebase.H>
+#include <targeting/common/predicates/predicates.H>
//******************************************************************************
// Macros
diff --git a/src/usr/targeting/predicates/predicatectm.C b/src/usr/targeting/common/predicates/predicatectm.C
index 20bf469d5..018c80c2c 100644
--- a/src/usr/targeting/predicates/predicatectm.C
+++ b/src/usr/targeting/common/predicates/predicatectm.C
@@ -22,7 +22,7 @@
// IBM_PROLOG_END
/**
- * @file predicatectm.C
+ * @file targeting/common/predicates/predicatectm.C
*
* @brief Implementation for a predicate which fiters a target based on its
* class, type, and model.
@@ -37,9 +37,8 @@
// Other Host Boot Components
// Targeting Component
-#include <targeting/target.H>
-#include <attributeenums.H>
-#include <targeting/predicates/predicatectm.H>
+#include <targeting/common/attributes.H>
+#include <targeting/common/predicates/predicates.H>
//******************************************************************************
// Macros
diff --git a/src/usr/targeting/predicates/predicateisfunctional.C b/src/usr/targeting/common/predicates/predicateisfunctional.C
index 4406c0db4..406ef4ca8 100644
--- a/src/usr/targeting/predicates/predicateisfunctional.C
+++ b/src/usr/targeting/common/predicates/predicateisfunctional.C
@@ -21,21 +21,15 @@
//
// IBM_PROLOG_END
/**
- * @file predicateisfunctional.C
+ * @file targeting/common/predicates/predicateisfunctional.C
*
- * Implement predicate defined in
+ * @brief Implement predicate defined in
* src/usr/include/targeting/predicate/predicateisfunctional.H
*
*/
// targeting support.
-#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/predicateisfunctional.H>
+#include <targeting/common/commontargeting.H>
namespace TARGETING
{
diff --git a/src/usr/targeting/predicates/predicatepostfixexpr.C b/src/usr/targeting/common/predicates/predicatepostfixexpr.C
index 067f7f453..babebfb1f 100644
--- a/src/usr/targeting/predicates/predicatepostfixexpr.C
+++ b/src/usr/targeting/common/predicates/predicatepostfixexpr.C
@@ -22,7 +22,7 @@
// IBM_PROLOG_END
/**
- * @file predicatepostfixexpr.C
+ * @file targeting/common/predicates/predicatepostfixexpr.C
*
* @brief Implementation for predicate which allows callers to chain multiple
* other predicates together in complex logical expressions, and then
@@ -36,11 +36,11 @@
// STD
// Other Host Boot Components
-#include <assert.h>
+#include <targeting/adapters/assertadapter.H>
// Targeting Component
-#include <targeting/predicates/predicatepostfixexpr.H>
-#include "../trace.H"
+#include <targeting/common/predicates/predicates.H>
+#include <targeting/common/trace.H>
//******************************************************************************
// Macros
@@ -85,7 +85,7 @@ PredicatePostfixExpr& PredicatePostfixExpr::push(
{
#define TARG_FN "push(...)"
- assert(i_pPredicate != NULL,
+ TARG_ASSERT(i_pPredicate != NULL,
TARG_LOC "Caller supplied a NULL predicate");
Operation l_op = {EVAL,i_pPredicate};
iv_ops.push_back(l_op);
@@ -148,7 +148,7 @@ bool PredicatePostfixExpr::operator()(
{
#define TARG_FN "operator()(...)"
- assert(i_pTarget != NULL,
+ TARG_ASSERT(i_pTarget != NULL,
TARG_LOC "Caller supplied a NULL target");
std::vector<bool> l_stack;
@@ -162,29 +162,29 @@ bool PredicatePostfixExpr::operator()(
l_stack.push_back((*iv_ops[i].pPredicate)(i_pTarget));
break;
case AND:
- assert(l_stack.size() >= 2,
+ TARG_ASSERT(l_stack.size() >= 2,
TARG_LOC "Stack for AND must be >=2 but is %d",
l_stack.size());
l_result = l_stack.back();
l_stack.pop_back();
- l_stack.back() &= l_result;
+ l_stack.back() = (l_stack.back() & l_result);
break;
case OR:
- assert(l_stack.size() >= 2,
+ TARG_ASSERT(l_stack.size() >= 2,
TARG_LOC "Stack for OR must be >= 2 but is %d",
l_stack.size());
l_result = l_stack.back();
l_stack.pop_back();
- l_stack.back() |= l_result;
+ l_stack.back() = (l_stack.back() | l_result);
break;
case NOT:
- assert(l_stack.size() >= 1,
+ TARG_ASSERT(l_stack.size() >= 1,
TARG_LOC "Stack for NOT must be >= 1 but is %d",
l_stack.size());
l_stack.back() = !l_stack.back();
break;
default:
- assert(0,
+ TARG_ASSERT(0,
TARG_LOC "Attempted to evaluate unsupported "
"logical operation %d",
iv_ops[i].logicalOp);
@@ -200,7 +200,7 @@ bool PredicatePostfixExpr::operator()(
}
else
{
- assert(l_stack.size() == 1,
+ TARG_ASSERT(l_stack.size() == 1,
TARG_LOC "Postfix expression created incorrectly. Stack "
"size should be 1 but is %d",
l_stack.size());
diff --git a/src/usr/targeting/target.C b/src/usr/targeting/common/target.C
index 10fbab4b8..9da4de170 100644
--- a/src/usr/targeting/target.C
+++ b/src/usr/targeting/common/target.C
@@ -22,9 +22,10 @@
// IBM_PROLOG_END
/**
- * @file target.C
+ * @file targeting/common/target.C
*
- * @brief Implementation of the Target class
+ * @brief Implementation of the Target class which provide APIs to read and
+ * write attributes from various attribute sections
*/
//******************************************************************************
@@ -37,8 +38,10 @@
#include <string.h>
// This component
-#include <targeting/target.H>
-#include "trace.H"
+#include <targeting/common/attributes.H>
+#include <targeting/attrrp.H>
+#include <targeting/common/util.H>
+#include <targeting/common/trace.H>
namespace TARGETING
{
@@ -112,11 +115,48 @@ void Target::_getAttrPtr(
#define TARG_FN "_getAttrPtr()"
void* l_pAttr = NULL;
+
+ // Transform platform neutral pointers into platform specific pointers, and
+ // optimize processing by not having to do the conversion in the loop below
+ // (it's guaranteed that attribute metadata will be in the same contiguous
+ // VMM region)
+ ATTRIBUTE_ID* pAttrId = TARG_TO_PLAT_PTR(iv_pAttrNames);
+ AbstractPointer<void>* ppAttrAddr = TARG_TO_PLAT_PTR(iv_pAttrValues);
+
+ // Only translate addresses on platforms where addresses are 4 bytes wide
+ // (FSP). The compiler should perform dead code elimination of this path on
+ // platforms with 8 byte wide addresses (Hostboot), since the "if" check can
+ // be statically computed at compile time.
+ if(TARG_ADDR_TRANSLATION_REQUIRED)
+ {
+ pAttrId = static_cast<ATTRIBUTE_ID*>(
+ TARG_GET_SINGLETON(TARGETING::theAttrRP).translateAddr(pAttrId));
+ ppAttrAddr = static_cast<AbstractPointer<void>*>(
+ TARG_GET_SINGLETON(TARGETING::theAttrRP).translateAddr(ppAttrAddr));
+ }
+
+ // Iterate through all the target's attribute IDs
for (uint32_t i = 0; i < iv_attrs; ++i)
{
- if ((*iv_pAttrNames)[i] == i_attr)
+ // Point to the ith attribute ID. If it matches the requested attribute
+ // ID,
+ // look up the attribute's address
+ if (*(pAttrId+i) == i_attr)
{
- l_pAttr = (*iv_pAttrValues)[i];
+ // Locate the corresponding attribute address
+ l_pAttr = TARG_TO_PLAT_PTR(*(ppAttrAddr+i));
+
+ // Only translate addresses on platforms where addresses are 4 bytes
+ // wide (FSP). The compiler should perform dead code elimination of
+ // this path on platforms with 8 byte wide addresses (Hostboot),
+ // since the "if" check can be statically computed at compile time.
+ if(TARG_ADDR_TRANSLATION_REQUIRED)
+ {
+ l_pAttr =
+ TARG_GET_SINGLETON(TARGETING::theAttrRP).translateAddr(
+ l_pAttr);
+ }
+
break;
}
}
@@ -138,7 +178,7 @@ mutex_t* Target::_getHbMutexAttr(
(void)_getAttrPtr(i_attribute,l_pAttr);
//@TODO Remove assert once release has stablized
- assert(l_pAttr,"TARGETING::Target::_getHbMutexAttr<%d>: _getAttrPtr "
+ TARG_ASSERT(l_pAttr,"TARGETING::Target::_getHbMutexAttr<%d>: _getAttrPtr "
"returned NULL",i_attribute);
return static_cast<mutex_t*>(l_pAttr);
diff --git a/src/usr/targeting/targetservice.C b/src/usr/targeting/common/targetservice.C
index 63c76012b..f208d9e24 100644
--- a/src/usr/targeting/targetservice.C
+++ b/src/usr/targeting/common/targetservice.C
@@ -22,9 +22,11 @@
// IBM_PROLOG_END
/**
- * @file targetservice.C
+ * @file targeting/common/targetservice.C
*
- * @brief Implementation of the TargetService class
+ * @brief Implementation of the TargetService which manages the pool of
+ * available targets, provides iteration support, and otherwise makes
+ * target available and usable.
*/
//******************************************************************************
@@ -36,18 +38,13 @@
#include <stdlib.h>
#include <string.h>
-// Other components
-#include <sys/task.h>
-#include <trace/interface.H>
-#include <initservice/taskargs.H>
-#include <vmmconst.h>
-
// This component
-#include <targeting/targetservice.H>
-#include "trace.H"
-#include <targeting/predicates/predicatebase.H>
+#include <targeting/common/targetservice.H>
+#include <targeting/common/predicates/predicates.H>
#include <pnortargeting.H>
-#include "attrrp.H"
+#include <targeting/attrrp.H>
+#include <targeting/common/trace.H>
+#include <targeting/adapters/types.H>
//******************************************************************************
// targetService
@@ -56,48 +53,9 @@
namespace TARGETING
{
-
#define TARG_NAMESPACE "TARGETING::"
-#define TARG_LOC TARG_NAMESPACE TARG_CLASS TARG_FN ": "
-
-//******************************************************************************
-// _start
-//******************************************************************************
-
-#define TARG_CLASS ""
-
-
-/**
- * @brief Entry point for initialization service to initialize the targeting
- * code
- *
- * @note: Link register is configured to automatically invoke task_end() when
- * this routine returns
- */
-extern "C"
-void _start(void* io_pArgs)
-{
- errlHndl_t io_taskRetErrl = NULL;
-
- #define TARG_FN "_start(...)"
-
- TARG_ENTER();
-
- AttrRP::init( io_taskRetErrl );
-
- if ( io_taskRetErrl == NULL )
- {
- TargetService& l_targetService = targetService();
- (void)l_targetService.init();
- }
-
- task_end2( io_taskRetErrl );
-
- TARG_EXIT();
-
- #undef TARG_FN
-}
+#define TARG_CLASS "targetService"
//******************************************************************************
// targetService
@@ -107,7 +65,7 @@ TARGETING::TargetService& targetService()
{
#define TARG_FN "targetService()"
- return TARGETING::theTargetService::instance();
+ return TARG_GET_SINGLETON(TARGETING::theTargetService);
#undef TARG_FN
}
@@ -116,7 +74,7 @@ TARGETING::TargetService& targetService()
// Component trace buffer
//******************************************************************************
-trace_desc_t* g_trac_targeting = NULL;
+TARG_TD_t g_trac_targeting = {0};
TRAC_INIT(&g_trac_targeting, "TARG", 4096);
#undef TARG_CLASS
@@ -171,11 +129,16 @@ void TargetService::init()
iv_associationMappings.push_back(a5);
iv_associationMappings.push_back(a6);
- // Get+save pointer to beginning of targeting's swappable config in
- // PNOR.
+ // Cache location of RO section containing all the attribute metadata
TargetingHeader* l_pHdr = reinterpret_cast<TargetingHeader*>(
- VMM_VADDR_ATTR_RP);
- assert(l_pHdr->eyeCatcher == PNOR_TARG_EYE_CATCHER);
+ TARG_GET_SINGLETON(TARGETING::theAttrRP).getBaseAddress());
+
+ TARG_ASSERT((l_pHdr != NULL), TARG_ERR_LOC
+ "FATAL: Targeting header is NULL!")
+ TARG_ASSERT((l_pHdr->eyeCatcher == PNOR_TARG_EYE_CATCHER), TARG_ERR_LOC
+ "FATAL: Targeting eyecatcher not found; "
+ "expected 0x%08X but got 0x%08X",
+ PNOR_TARG_EYE_CATCHER,l_pHdr->eyeCatcher);
iv_pPnor = reinterpret_cast<uint32_t*>(
(reinterpret_cast<char*>(l_pHdr) + l_pHdr->headerSize));
@@ -197,9 +160,12 @@ TargetService::iterator TargetService::begin()
{
#define TARG_FN "begin()"
- assert(iv_initialized);
+ TARG_ASSERT(iv_initialized, TARG_ERR_LOC
+ "USAGE: TargetService not initialized");
Target* l_pFirstTarget = (iv_maxTargets == 0) ? NULL : &(*iv_targets)[0];
+ TARG_ASSERT(l_pFirstTarget != NULL, TARG_ERR_LOC
+ "FATAL: Could not find any targets");
return iterator(l_pFirstTarget);
@@ -215,10 +181,13 @@ _TargetIterator<const Target*> TargetService::begin() const
{
#define TARG_FN "begin() const"
- assert(iv_initialized);
+ TARG_ASSERT(iv_initialized, TARG_ERR_LOC
+ "USAGE: TargetService not initialized");
const Target* l_pFirstTarget =
(iv_maxTargets == 0) ? NULL : &(*iv_targets)[0];
+ TARG_ASSERT(l_pFirstTarget != NULL, TARG_ERR_LOC
+ "FATAL: Could not find any targets");
return const_iterator(l_pFirstTarget);
@@ -233,7 +202,8 @@ TargetService::iterator TargetService::end()
{
#define TARG_FN "end()"
- assert(iv_initialized);
+ TARG_ASSERT(iv_initialized, TARG_ERR_LOC
+ "USAGE: TargetService not initialized");
return iterator(NULL);
@@ -248,7 +218,8 @@ TargetService::const_iterator TargetService::end() const
{
#define TARG_FN "end() const"
- assert(iv_initialized);
+ TARG_ASSERT(iv_initialized, TARG_ERR_LOC
+ "USAGE: TargetService not initialized");
return const_iterator(NULL);
@@ -264,7 +235,8 @@ void TargetService::getTopLevelTarget(
{
#define TARG_FN "getTopLevelTarget(...)"
- assert(iv_initialized, TARG_LOC "TargetService not initialized");
+ TARG_ASSERT(iv_initialized, TARG_ERR_LOC
+ "USAGE: TargetService not initialized");
EntityPath l_topLevelPhysicalPath(EntityPath::PATH_PHYSICAL);
l_topLevelPhysicalPath.addLast(TYPE_SYS, 0);
@@ -285,7 +257,8 @@ void TargetService::exists(
bool l_found = false;
- assert(iv_initialized, TARG_LOC "TargetService not initialized");
+ TARG_ASSERT(iv_initialized, TARG_ERR_LOC
+ "USAGE: TargetService not initialized");
for (uint32_t i = 0; i < iv_maxTargets; ++i)
{
@@ -313,7 +286,8 @@ Target* TargetService::toTarget(
// though!)
Target* l_pTarget = NULL;
- assert(iv_initialized, TARG_LOC "TargetService not initialized");
+ TARG_ASSERT(iv_initialized, TARG_ERR_LOC
+ "USAGE: TargetService not initialized");
for (uint32_t i = 0; i < iv_maxTargets; ++i)
{
@@ -340,7 +314,8 @@ void TargetService::masterProcChipTargetHandle(
Target* l_pTarget = NULL;
- assert(iv_initialized, TARG_LOC "TargetService not initialized");
+ TARG_ASSERT(iv_initialized, TARG_ERR_LOC
+ "USAGE: TargetService not initialized");
//@TODO Need to query the actual hardware and cross check it with
// PNOR to determine the master chip
@@ -369,7 +344,8 @@ bool TargetService::tryGetPath(
bool l_exist = false;
- assert(iv_initialized, TARG_LOC "TargetService not initialized");
+ TARG_ASSERT(iv_initialized, TARG_ERR_LOC
+ "USAGE: TargetService not initialized");
switch (i_attr)
{
@@ -384,8 +360,9 @@ bool TargetService::tryGetPath(
l_exist = i_pTarget->tryGetAttr<ATTR_POWER_PATH> (o_entityPath);
break;
default:
- assert(0, TARG_LOC "i_attr = 0x%08X does not map to an "
- "entity path",i_attr);
+ TARG_ASSERT(0, TARG_ERR_LOC
+ "i_attr = 0x%08X does not map to an entity path",
+ i_attr);
break;
}
@@ -409,13 +386,14 @@ void TargetService::getAssociated(
do {
- assert(iv_initialized, TARG_LOC "TargetService not initialized");
+ TARG_ASSERT(iv_initialized, TARG_ERR_LOC
+ "USAGE: TargetService not initialized");
- assert( (i_pTarget != NULL)
- && (i_pTarget != MASTER_PROCESSOR_CHIP_TARGET_SENTINEL),
- TARG_LOC "Caller tried to get association using a NULL target "
- "handle or the master processor chip target handle sentinel. "
- "i_pTarget = %p",i_pTarget);
+ TARG_ASSERT( (i_pTarget != NULL)
+ && (i_pTarget != MASTER_PROCESSOR_CHIP_TARGET_SENTINEL),
+ TARG_ERR_LOC "Caller tried to get association using a NULL "
+ "target handle or the master processor chip target handle "
+ "sentinel. i_pTarget = %p",i_pTarget);
// Start with no elements
o_list.clear();
@@ -445,7 +423,7 @@ void TargetService::getAssociated(
}
else
{
- assert(0, TARG_LOC
+ TARG_ASSERT(0, TARG_LOC
"iv_associationMappings[i].associationDir "
"= 0x%X not supported",
iv_associationMappings[i].associationDir);
@@ -468,7 +446,8 @@ void TargetService::dump() const
{
#define TARG_FN "dump(...)"
- assert(iv_initialized, TARG_LOC "TargetService not initialized");
+ TARG_ASSERT(iv_initialized, TARG_ERR_LOC
+ "USAGE: TargetService not initialized");
TARG_INF("Targets (size=%d):",
sizeof(Target)*iv_maxTargets);
@@ -530,7 +509,7 @@ void TargetService::dump() const
if ( (*iv_targets)[i].tryGetAttr<ATTR_XSCOM_BASE_ADDRESS>(
l_xscomBaseAddr) )
{
- TARG_INF("XSCOM Base Address = 0x%X",l_xscomBaseAddr);
+ TARG_INF("XSCOM Base Address = 0x%016llX",l_xscomBaseAddr);
}
XscomChipInfo l_xscomChipInfo = {0};
@@ -561,11 +540,30 @@ void TargetService::_configureTargetPool()
// iv_pPnor--> points to uint32_t* --> points to --> uint32_t, targets[]
// (uint32_t*)+1 --> points to ------------> targets[]
-
+ const AbstractPointer<uint32_t>* ppNumTargets
+ = static_cast<const AbstractPointer<uint32_t>*>(iv_pPnor);
iv_targets =
- reinterpret_cast< Target(*)[] > (
- *(static_cast<uint32_t**>(
- const_cast<void*>(iv_pPnor))) + 1);
+ reinterpret_cast< Target(*)[] > (
+ (TARG_TO_PLAT_PTR_AND_INC(*ppNumTargets,1)));
+ TARG_ASSERT(iv_targets, TARG_ERR_LOC
+ "FATAL: Could not determine location of targets");
+ TARG_INF("iv_targets = %p", iv_targets);
+
+ // Only translate addresses on platforms where addresses are 4 bytes wide
+ // (FSP). The compiler should perform dead code elimination of this path on
+ // platforms with 8 byte wide addresses (Hostboot), since the "if" check
+ // can be statically computed at compile time.
+ if(TARG_ADDR_TRANSLATION_REQUIRED)
+ {
+ iv_targets = static_cast<Target(*)[]>(
+ TARG_GET_SINGLETON(TARGETING::theAttrRP).translateAddr(
+ iv_targets));
+ TARG_ASSERT(iv_targets, TARG_ERR_LOC
+ "FATAL: Could not determine location of targets after "
+ "address translation");
+ TARG_INF("iv_targets after translation = %p", iv_targets);
+ }
+
TARG_EXIT();
#undef TARG_FN
@@ -581,7 +579,22 @@ uint32_t TargetService::_maxTargets()
// Target count found by following the pointer pointed to by the iv_pPnor
// pointer.
- iv_maxTargets = *(*(static_cast<const uint32_t * const *>(iv_pPnor)));
+ const AbstractPointer<uint32_t>* pNumTargetsPtr
+ = static_cast<const AbstractPointer<uint32_t>*>(iv_pPnor);
+ uint32_t* pNumTargets = TARG_TO_PLAT_PTR(*pNumTargetsPtr);
+
+ // Only translate addresses on platforms where addresses are 4 bytes wide
+ // (FSP). The compiler should perform dead code elimination of this path on
+ // platforms with 8 byte wide addresses (Hostboot), since the "if" check
+ // can be statically computed at compile time.
+ if(TARG_ADDR_TRANSLATION_REQUIRED)
+ {
+ pNumTargets = static_cast<uint32_t*>(
+ TARG_GET_SINGLETON(TARGETING::theAttrRP).translateAddr(
+ pNumTargets));
+ }
+
+ iv_maxTargets = *pNumTargets;
TARG_INF("Max targets = %d",iv_maxTargets);
diff --git a/src/usr/targeting/common/test/common.mk b/src/usr/targeting/common/test/common.mk
new file mode 100644
index 000000000..36e9fed76
--- /dev/null
+++ b/src/usr/targeting/common/test/common.mk
@@ -0,0 +1,36 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/targeting/common/test/common.mk $
+#
+# 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 targeting/common/test/common.mk
+#
+# @brief Common test makefile to be included in targeting/test/makefile
+#
+################################################################################
+
+HWPF_INC_DIRS += fapi plat hwp
+
+COMMON_TESTCASES = testcommontargeting.H
+
+OBJS = ${COMMON_OBJS}
diff --git a/src/usr/targeting/test/targetingtest.H b/src/usr/targeting/common/test/testcommontargeting.H
index aaba63027..e16671633 100644
--- a/src/usr/targeting/test/targetingtest.H
+++ b/src/usr/targeting/common/test/testcommontargeting.H
@@ -20,13 +20,14 @@
// Origin: 30
//
// IBM_PROLOG_END
-#ifndef __TESTTARGETING_H
-#define __TESTTARGETING_H
+
+#ifndef __TARGETING_COMMON_TESTCOMMONTARGETING_H
+#define __TARGETING_COMMON_TESTCOMMONTARGETING_H
/**
- * @file testtargeting.H
+ * @file targeting/common/test/testtargeting.H
*
- * @brief All unit tests for the targeting infrastructure
+ * @brief All common unit tests for the targeting infrastructure
*/
//******************************************************************************
@@ -38,65 +39,25 @@
#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>
-#include <sys/sync.h>
-#include <sys/task.h>
-#include <sys/time.h>
+#include <targeting/common/error.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>
-#include <targeting/targreasoncodes.H>
-#include <errl/errludtarget.H>
-#include "trace.H"
-
-trace_desc_t* g_trac_targeting = NULL;
-TRAC_INIT(&g_trac_targeting, "TARG", 4096);
+#include <targeting/common/commontargeting.H>
+#include <targeting/common/trace.H>
+#include "unittest.H"
+//trace_desc_t* g_trac_targeting = NULL;
+//TRAC_INIT(&g_trac_targeting, "TARG", 4096);
namespace TARGETING {
extern void dumpAllAttributes(trace_desc_t*);
};
-/**
- * @brief Struct to hold pointers to a mutex / protected value
- */
-struct MutexTestData_t
-{
- mutex_t* pMutex; // Pointer to mutex
- barrier_t* pBarrier; // Pointer to barrier
- volatile uint32_t* pVar; // Pointer to value protected by mutex
-};
-
-/**
- * @brief Function which attempts to write a protected variable
- *
- * @param[in] i_pData Pointer to mutex pointer/value pointer structure
- *
- * @return N/A
- */
-void funcTestMutex(void* i_pData)
-{
- MutexTestData_t* l_pData = static_cast<MutexTestData_t*>(i_pData);
- barrier_wait(l_pData->pBarrier);
- mutex_lock(l_pData->pMutex);
- *(l_pData->pVar) = 1;
- mutex_unlock(l_pData->pMutex);
- barrier_wait(l_pData->pBarrier);
- task_end();
-}
-
-class TargetingTestSuite: public CxxTest::TestSuite
+class CommonTargetingTestSuite: public CxxTest::TestSuite
{
public:
@@ -105,8 +66,11 @@ class TargetingTestSuite: public CxxTest::TestSuite
*/
void testTargetServiceClass()
{
- return; //@fixme - found a Data Storage Exception that needs to be fixed (Task 4485)
- TS_TRACE(ENTER_MRK "testTargetServiceClass" );
+ //@fixme - found a Data Storage Exception that needs to be fixed (Task
+ // RTC 35625)
+ return;
+
+ TARG_TS_TRACE(ENTER_MRK "testTargetServiceClass" );
using namespace TARGETING;
@@ -120,18 +84,18 @@ class TargetingTestSuite: public CxxTest::TestSuite
Target* l_pMasterProcChipTargetHandle = NULL;
(void) l_targetService.masterProcChipTargetHandle(
- l_pMasterProcChipTargetHandle);
+ l_pMasterProcChipTargetHandle);
if ( l_pMasterProcChipTargetHandle
== MASTER_PROCESSOR_CHIP_TARGET_SENTINEL)
{
- TS_FAIL("Post init; master proc chip target handle should not "
+ TARG_TS_FAIL("Post init; master proc chip target handle should not "
"be the sentinel value");
}
if (l_pMasterProcChipTargetHandle == NULL)
{
- TS_FAIL("Post init; master proc chip target handle should not "
+ TARG_TS_FAIL("Post init; master proc chip target handle should not "
"be the NULL value");
}
@@ -143,7 +107,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
|| l_switches.useInbandScom != 0
|| l_switches.reserved != 0)
{
- TS_FAIL("SCOM Switches stuct was not correct (%d, %d, %d, %d)",
+ TARG_TS_FAIL("SCOM Switches stuct was not correct (%d, %d, %d, %d)",
l_switches.useFsiScom, l_switches.useXscom,
l_switches.useInbandScom ,
l_switches.reserved);
@@ -152,14 +116,14 @@ class TargetingTestSuite: public CxxTest::TestSuite
if ( l_pMasterProcChipTargetHandle->getAttr<ATTR_CLASS> ()
!= CLASS_CHIP)
{
- TS_FAIL("Post init; master proc chip target handle was not of "
+ TARG_TS_FAIL("Post init; master proc chip target handle was not of "
"chip class");
}
if ( l_pMasterProcChipTargetHandle->getAttr<ATTR_TYPE> ()
!= TYPE_PROC)
{
- TS_FAIL("Post init; master proc chip target handle was not of "
+ TARG_TS_FAIL("Post init; master proc chip target handle was not of "
"proc type");
}
@@ -170,13 +134,13 @@ class TargetingTestSuite: public CxxTest::TestSuite
(void) l_targetService.getTopLevelTarget(l_pTopLevel);
if (l_pTopLevel == NULL)
{
- TS_FAIL("Top level handle was NULL when initialization "
+ TARG_TS_FAIL("Top level handle was NULL when initialization "
"complete");
}
if (l_pTopLevel->getAttr<ATTR_CLASS> () != CLASS_SYS)
{
- TS_FAIL("Post init; top level target class != CLASS_SYS");
+ TARG_TS_FAIL("Post init; top level target class != CLASS_SYS");
}
// Post init
@@ -189,7 +153,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
if (l_exists != true)
{
- TS_FAIL("Expected top level target to exist");
+ TARG_TS_FAIL("Expected top level target to exist");
}
// Post init
@@ -202,7 +166,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
if (l_pInverseTarget != l_pTopLevel)
{
- TS_FAIL("Expected to get the original target");
+ TARG_TS_FAIL("Expected to get the original target");
}
// Post init
@@ -220,7 +184,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
TARGETING::TargetService::IMMEDIATE);
if (!l_list.size())
{
- TS_FAIL("Should have found some child elements" );
+ TARG_TS_FAIL("Should have found some child elements" );
}
// Verify child of given target has a parent that is the original
@@ -235,12 +199,12 @@ class TargetingTestSuite: public CxxTest::TestSuite
if (l_parentList.size() != 1)
{
- TS_FAIL("Should have found a parent element" );
+ TARG_TS_FAIL("Should have found a parent element" );
}
if (l_parentList[0] != l_pTopLevel)
{
- TS_FAIL("Parent handle should have matched original target "
+ TARG_TS_FAIL("Parent handle should have matched original target "
"handle" );
}
@@ -252,7 +216,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
if (!l_list.size())
{
- TS_FAIL("Should have found some child elements" );
+ TARG_TS_FAIL("Should have found some child elements" );
}
(void) l_targetService.getAssociated(
@@ -263,12 +227,12 @@ class TargetingTestSuite: public CxxTest::TestSuite
if (!l_list.size())
{
- TS_FAIL("Should have found more child elements" );
+ TARG_TS_FAIL("Should have found more child elements" );
}
l_targetService.dump();
- TS_TRACE(EXIT_MRK "testTargetServiceClass" );
+ TARG_TS_TRACE(EXIT_MRK "testTargetServiceClass" );
}
/**
@@ -276,77 +240,77 @@ class TargetingTestSuite: public CxxTest::TestSuite
*/
void testEntityPathClass(void)
{
- TS_TRACE(ENTER_MRK "testEntityPathClass" );
+ TARG_TS_TRACE(ENTER_MRK "testEntityPathClass" );
using namespace TARGETING;
EntityPath l_defaultPath;
if(l_defaultPath.size() != 0)
{
- TS_FAIL("Default entity path's size was not 0");
+ TARG_TS_FAIL("Default entity path's size was not 0");
}
if(l_defaultPath.type() != EntityPath::PATH_NA)
{
- TS_FAIL("Default entity path's type was not PATH_NA");
+ TARG_TS_FAIL("Default entity path's type was not PATH_NA");
}
EntityPath l_nonDefaultPath(EntityPath::PATH_PHYSICAL);
if(l_nonDefaultPath.size() != 0)
{
- TS_FAIL("Non-default entity path's size was not 0");
+ TARG_TS_FAIL("Non-default entity path's size was not 0");
}
if(l_nonDefaultPath.type() != EntityPath::PATH_PHYSICAL)
{
- TS_FAIL("Non-default entity path's type was not "
+ TARG_TS_FAIL("Non-default entity path's type was not "
"EntityPath::PATH_PHYSICAL");
}
l_defaultPath.setType(EntityPath::PATH_AFFINITY);
if(l_defaultPath.type() != EntityPath::PATH_AFFINITY)
{
- TS_FAIL("Default entity path's type was not "
+ TARG_TS_FAIL("Default entity path's type was not "
"EntityPath::PATH_AFFINITY after setting");
}
l_defaultPath.setType(EntityPath::PATH_PHYSICAL);
if(!(l_defaultPath == l_nonDefaultPath))
{
- TS_FAIL("Default entity path should have been equal to "
+ TARG_TS_FAIL("Default entity path should have been equal to "
"the non-default entity path");
}
if(!l_defaultPath.equals(l_nonDefaultPath,0))
{
- TS_FAIL("Default entity path should have been equal to "
+ TARG_TS_FAIL("Default entity path should have been equal to "
"the non-default entity path (equals API)");
}
l_defaultPath.addLast(TYPE_PROC,0);
if(l_defaultPath == l_nonDefaultPath)
{
- TS_FAIL("Default entity path should NOT have been equal to "
+ TARG_TS_FAIL("Default entity path should NOT have been equal to "
"the non-default entity path");
}
if(l_defaultPath.equals(l_nonDefaultPath,1))
{
- TS_FAIL("Default entity path should NOT have been equal to "
+ TARG_TS_FAIL("Default entity path should NOT have been equal to "
"the non-default entity path (equals API, comparing 1 "
"element)");
}
if(l_defaultPath.size() != 1)
{
- TS_FAIL("Default entity path should have had one path element"
+ TARG_TS_FAIL("Default entity path should have had one path element"
"after adding PROC0");
}
l_nonDefaultPath.addLast(TYPE_PROC,0);
if(! (l_defaultPath == l_nonDefaultPath) )
{
- TS_FAIL("Default entity path should have been equal to "
+ TARG_TS_FAIL("Default entity path should have been equal to "
"the non-default entity path since they now"
"both have the same 1 path element");
}
@@ -354,7 +318,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
l_defaultPath.addLast(TYPE_MBA,1).addLast(TYPE_MBS,2);
if(l_defaultPath.size() != 3)
{
- TS_FAIL("Default entity path should have had two path elements"
+ TARG_TS_FAIL("Default entity path should have had two path elements"
"after adding MBA1 and MBS2");
}
@@ -365,14 +329,14 @@ class TargetingTestSuite: public CxxTest::TestSuite
|| (l_defaultPath[2].type != TYPE_MBS)
|| (l_defaultPath[2].instance != 2))
{
- TS_FAIL("Default entity path should have had correct 3 path "
+ TARG_TS_FAIL("Default entity path should have had correct 3 path "
"elements");
}
l_defaultPath.removeLast();
if(l_defaultPath.size() != 2)
{
- TS_FAIL("Default entity path should have had two path elements"
+ TARG_TS_FAIL("Default entity path should have had two path elements"
"after removing MBS2");
}
@@ -381,7 +345,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
|| (l_defaultPath[1].type != TYPE_MBA)
|| (l_defaultPath[1].instance != 1))
{
- TS_FAIL("Default entity path should have had correct 2 path "
+ TARG_TS_FAIL("Default entity path should have had correct 2 path "
"elements");
}
@@ -391,14 +355,14 @@ class TargetingTestSuite: public CxxTest::TestSuite
// Non-default now has proc/mba/mbs
if(l_defaultPath == l_nonDefaultPath)
{
- TS_FAIL("Default entity path should NOT have been equal to "
+ TARG_TS_FAIL("Default entity path should NOT have been equal to "
"the non-default entity path since they now"
"have different number of path elements");
}
if( !l_defaultPath.equals(l_nonDefaultPath,2) )
{
- TS_FAIL("Default entity path should have been equal to "
+ TARG_TS_FAIL("Default entity path should have been equal to "
"the non-default entity path since they have the same"
"first two path elements");
}
@@ -406,7 +370,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
l_defaultPath.removeLast().removeLast();
if(l_defaultPath.size() != 0)
{
- TS_FAIL("Default entity path should have had no path element"
+ TARG_TS_FAIL("Default entity path should have had no path element"
"after removing MBA1 and PROC0");
}
@@ -420,7 +384,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
Target* l_pTarget = l_realPath.operator->();
if(l_pTarget == NULL)
{
- TS_FAIL("Real entity path should have mapped to an existing "
+ TARG_TS_FAIL("Real entity path should have mapped to an existing "
"target");
}
@@ -430,7 +394,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
if( (l_changedPath.size() != 0)
|| (l_path.size() != 1))
{
- TS_FAIL("Const entity path should not have been altered in "
+ TARG_TS_FAIL("Const entity path should not have been altered in "
"const add test");
}
@@ -438,11 +402,11 @@ class TargetingTestSuite: public CxxTest::TestSuite
if( (l_changedPath.size() != 2)
|| (l_path.size() != 1))
{
- TS_FAIL("Const entity path should not have been altered "
+ TARG_TS_FAIL("Const entity path should not have been altered "
"in const add test");
}
- TS_TRACE(EXIT_MRK "testEntityPathClass" );
+ TARG_TS_TRACE(EXIT_MRK "testEntityPathClass" );
}
/**
@@ -450,7 +414,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
*/
void testTargetClass(void)
{
- TS_TRACE(ENTER_MRK "testTargetClass" );
+ TARG_TS_TRACE(ENTER_MRK "testTargetClass" );
using namespace TARGETING;
TargetService& l_targetService = targetService();
@@ -464,24 +428,24 @@ class TargetingTestSuite: public CxxTest::TestSuite
Target* l_pTarget = l_realPath.operator->();
if(l_pTarget == NULL)
{
- TS_FAIL("Failed to convert entity path to initial target");
+ TARG_TS_FAIL("Failed to convert entity path to initial target");
}
CLASS l_class = l_pTarget->getAttr<ATTR_CLASS>();
if(l_class != CLASS_CHIP)
{
- TS_FAIL("Failed to get the class attribute");
+ TARG_TS_FAIL("Failed to get the class attribute");
}
l_class = CLASS_NA;
if( !l_pTarget->tryGetAttr<ATTR_CLASS>(l_class) )
{
- TS_FAIL("Failed to get the class attribute");
+ TARG_TS_FAIL("Failed to get the class attribute");
}
if(l_class != CLASS_CHIP)
{
- TS_FAIL("Failed to try/get the class attribute");
+ TARG_TS_FAIL("Failed to try/get the class attribute");
}
attrToString<ATTR_CLASS>(l_class);
@@ -489,25 +453,25 @@ class TargetingTestSuite: public CxxTest::TestSuite
uint8_t l_scom = 0;
if( l_pTarget->tryGetAttr<ATTR_DUMMY_RO>(l_scom) )
{
- TS_FAIL("ATTR_DUMMY_RO attribute should not have been available "
+ TARG_TS_FAIL("ATTR_DUMMY_RO attribute should not have been available "
"to read");
}
if(l_scom != 0)
{
- TS_FAIL("Failed ! try/get should not have set the SCOM attribute");
+ TARG_TS_FAIL("Failed ! try/get should not have set the SCOM attribute");
}
l_scom = 5;
if( l_pTarget->trySetAttr<ATTR_DUMMY_WO>(l_scom) )
{
- TS_FAIL("ATTR_DUMMY_WO attribute should not have been available "
+ TARG_TS_FAIL("ATTR_DUMMY_WO attribute should not have been available "
"to write");
}
if(l_scom != 5)
{
- TS_FAIL("SCOM attribute should not have been altered in the "
+ TARG_TS_FAIL("SCOM attribute should not have been altered in the "
"failed write");
}
@@ -516,12 +480,12 @@ class TargetingTestSuite: public CxxTest::TestSuite
l_wo[0][1][2] = 6;
if( !l_pTarget->trySetAttr<ATTR_DUMMY_RW>(l_wo) )
{
- TS_FAIL("ATTR_DUMMY_RW should have been available for write");
+ TARG_TS_FAIL("ATTR_DUMMY_RW should have been available for write");
}
if(l_wo[0][1][2] != 6)
{
- TS_FAIL("ATTR_DUMMY_RW local attribute should not have been "
+ TARG_TS_FAIL("ATTR_DUMMY_RW local attribute should not have been "
"altered in the successful write");
}
@@ -529,7 +493,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
l_pTarget->tryGetAttr<ATTR_DUMMY_RW>(l_read);
if(memcmp(l_read,l_wo,sizeof(l_read)))
{
- TS_FAIL("Failed to read back the correct ATTR_DUMMY_RW");
+ TARG_TS_FAIL("Failed to read back the correct ATTR_DUMMY_RW");
}
DUMMY_RW_ATTR l_setWo;
@@ -538,7 +502,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
l_pTarget->setAttr<ATTR_DUMMY_RW>(l_setWo);
if(l_setWo[0][2][4] != 9)
{
- TS_FAIL("ATTR_DUMMY_RW local attribute should not have been "
+ TARG_TS_FAIL("ATTR_DUMMY_RW local attribute should not have been "
"altered in the successful setAttr");
}
@@ -546,18 +510,18 @@ class TargetingTestSuite: public CxxTest::TestSuite
l_pTarget->tryGetAttr<ATTR_DUMMY_RW>(l_setWoVerify);
if(memcmp(l_setWoVerify,l_setWo,sizeof(l_setWoVerify)))
{
- TS_FAIL("ATTR_DUMMY_RW read should have matched prior write");
+ TARG_TS_FAIL("ATTR_DUMMY_RW read should have matched prior write");
}
memset(l_setWo,0x05,sizeof(l_setWo));
l_pTarget->setAttr<ATTR_DUMMY_RW>(l_setWo);
- TS_TRACE(EXIT_MRK "testTargetClass" );
+ TARG_TS_TRACE(EXIT_MRK "testTargetClass" );
}
void testPredicateCtm()
{
- TS_TRACE(ENTER_MRK "testPredicateCtm" );
+ TARG_TS_TRACE(ENTER_MRK "testPredicateCtm" );
using namespace TARGETING;
TargetService& l_targetService = targetService();
@@ -567,70 +531,70 @@ class TargetingTestSuite: public CxxTest::TestSuite
(void) l_targetService.getTopLevelTarget(l_pTopLevel);
if (l_pTopLevel == NULL)
{
- TS_FAIL("Top level handle was NULL when initialization "
+ TARG_TS_FAIL("Top level handle was NULL when initialization "
"complete");
}
PredicateCTM l_allWild;
if( ! l_allWild(l_pTopLevel) )
{
- TS_FAIL("CTM all wildcards filter should have matched system "
+ TARG_TS_FAIL("CTM all wildcards filter should have matched system "
"target");
}
PredicateCTM l_typeModelWild(CLASS_SYS);
if( ! l_typeModelWild(l_pTopLevel) )
{
- TS_FAIL("CTM class sys, remaining wildcards filter should have "
+ TARG_TS_FAIL("CTM class sys, remaining wildcards filter should have "
"matched system ");
}
PredicateCTM l_modelWild(CLASS_SYS,TYPE_SYS);
if( ! l_modelWild(l_pTopLevel) )
{
- TS_FAIL("CTM class sys, type sys, remaining wildcards filter "
+ TARG_TS_FAIL("CTM class sys, type sys, remaining wildcards filter "
"should have matched system ");
}
PredicateCTM l_noWild(CLASS_SYS,TYPE_SYS,MODEL_POWER8);
if( ! l_noWild(l_pTopLevel) )
{
- TS_FAIL("CTM class sys, type sys, model power8 should have "
+ TARG_TS_FAIL("CTM class sys, type sys, model power8 should have "
"matched system ");
}
PredicateCTM l_classWild(CLASS_NA,TYPE_SYS,MODEL_POWER8);
if( ! l_classWild(l_pTopLevel) )
{
- TS_FAIL("CTM class wild, type sys, model power8 should have "
+ TARG_TS_FAIL("CTM class wild, type sys, model power8 should have "
"matched system ");
}
PredicateCTM l_typeWild(CLASS_SYS,TYPE_NA,MODEL_POWER8);
if( ! l_typeWild(l_pTopLevel) )
{
- TS_FAIL("CTM class sys, wild, model power8 should have "
+ TARG_TS_FAIL("CTM class sys, wild, model power8 should have "
"matched system ");
}
PredicateCTM l_classModelWild(CLASS_NA,TYPE_SYS,MODEL_NA);
if( ! l_classModelWild(l_pTopLevel) )
{
- TS_FAIL("CTM wild, type sys, wild should have "
+ TARG_TS_FAIL("CTM wild, type sys, wild should have "
"matched system ");
}
PredicateCTM l_classTypeWild(CLASS_NA,TYPE_NA,MODEL_NA);
if( ! l_classTypeWild(l_pTopLevel) )
{
- TS_FAIL("CTM wild, wild, model should have "
+ TARG_TS_FAIL("CTM wild, wild, model should have "
"matched system ");
}
PredicateCTM l_chipClass(CLASS_CHIP,TYPE_NA,MODEL_NA);
if( l_chipClass(l_pTopLevel) )
{
- TS_FAIL("CTM of class chip, wild, wild should not have matched "
+ TARG_TS_FAIL("CTM of class chip, wild, wild should not have matched "
"matched system ");
}
@@ -647,13 +611,13 @@ class TargetingTestSuite: public CxxTest::TestSuite
delete l_pBase;
l_pBase = NULL;
- TS_TRACE(EXIT_MRK "testPredicateCtm" );
+ TARG_TS_TRACE(EXIT_MRK "testPredicateCtm" );
}
void testPredicatePostfixExpr()
{
- TS_TRACE(ENTER_MRK "testPredicatePostfixExpr" );
+ TARG_TS_TRACE(ENTER_MRK "testPredicatePostfixExpr" );
using namespace TARGETING;
TargetService& l_targetService = targetService();
@@ -663,14 +627,14 @@ class TargetingTestSuite: public CxxTest::TestSuite
(void) l_targetService.getTopLevelTarget(l_pTopLevel);
if (l_pTopLevel == NULL)
{
- TS_FAIL("Top level handle was NULL when initialization "
+ TARG_TS_FAIL("Top level handle was NULL when initialization "
"complete");
}
PredicatePostfixExpr l_alwaysTrueExpr;
if(!l_alwaysTrueExpr(l_pTopLevel) )
{
- TS_FAIL("Always true filter should have matched system");
+ TARG_TS_FAIL("Always true filter should have matched system");
}
#if 0
@@ -683,7 +647,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
l_alwaysTrueExpr.Not();
if(l_alwaysTrueExpr(l_pTopLevel) )
{
- TS_FAIL("Negated always true filter should not have matched "
+ TARG_TS_FAIL("Negated always true filter should not have matched "
"system");
}
#endif
@@ -738,7 +702,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
if(!l_expr(l_pTopLevel) )
{
- TS_FAIL("CTM of class sys && type sys && model power8 should "
+ TARG_TS_FAIL("CTM of class sys && type sys && model power8 should "
"have matched system");
}
@@ -746,7 +710,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
if(l_expr(l_pTopLevel) )
{
- TS_FAIL("CTM of class sys && type sys && model power8 should "
+ TARG_TS_FAIL("CTM of class sys && type sys && model power8 should "
"npt have matched system after negation");
}
@@ -755,7 +719,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
if(!l_expr(l_pTopLevel) )
{
- TS_FAIL("CTM of class sys && type sys && model power8 should "
+ TARG_TS_FAIL("CTM of class sys && type sys && model power8 should "
"have matched system after negation then || sys class");
}
@@ -773,12 +737,12 @@ class TargetingTestSuite: public CxxTest::TestSuite
PredicatePostfixExpr l_cpCtor(l_rhs);
#endif
- TS_TRACE(EXIT_MRK "testPredicatePostfixExpr" );
+ TARG_TS_TRACE(EXIT_MRK "testPredicatePostfixExpr" );
}
void testTargetIterator()
{
- TS_TRACE(ENTER_MRK "testTargetIterator");
+ TARG_TS_TRACE(ENTER_MRK "testTargetIterator");
using namespace TARGETING;
TargetService& l_targetService = targetService();
@@ -787,14 +751,14 @@ class TargetingTestSuite: public CxxTest::TestSuite
TargetIterator l_pIt;
if( l_pIt != l_targetService.end() )
{
- TS_FAIL("Default TargetIterator should point to past the end "
+ TARG_TS_FAIL("Default TargetIterator should point to past the end "
"of container");
}
++l_pIt;
if( l_pIt != l_targetService.end() )
{
- TS_FAIL("Default TargetIterator preincremented should point to "
+ TARG_TS_FAIL("Default TargetIterator preincremented should point to "
"past the end of container");
}
@@ -804,7 +768,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
if(*l_pIt != NULL)
{
- TS_FAIL("Default TargetIterator dereference should return NULL");
+ TARG_TS_FAIL("Default TargetIterator dereference should return NULL");
}
// Get top level (system) target to verify at least 1 target
@@ -812,32 +776,32 @@ class TargetingTestSuite: public CxxTest::TestSuite
(void) l_targetService.getTopLevelTarget(l_pTopLevel);
if (l_pTopLevel == NULL)
{
- TS_FAIL("Top level handle was NULL when initialization "
+ TARG_TS_FAIL("Top level handle was NULL when initialization "
"complete");
}
l_pIt = l_targetService.begin();
if((*l_pIt) == NULL)
{
- TS_FAIL("TargetService begin() should return !NULL");
+ TARG_TS_FAIL("TargetService begin() should return !NULL");
}
CLASS l_class = CLASS_NA;
if( !l_pIt->tryGetAttr<ATTR_CLASS>(l_class) )
{
- TS_FAIL("Failed to get expected class attribute");
+ TARG_TS_FAIL("Failed to get expected class attribute");
}
TargetIterator l_rhs = l_targetService.begin();
if( ! (l_pIt == l_rhs) )
{
- TS_FAIL("Iterators should be equal, but aren't");
+ TARG_TS_FAIL("Iterators should be equal, but aren't");
}
l_rhs = l_targetService.begin();
if( l_pIt != l_rhs )
{
- TS_FAIL("Iterators should be equal, but aren't");
+ TARG_TS_FAIL("Iterators should be equal, but aren't");
}
TargetIterator l_rhs2 = l_targetService.begin();
@@ -845,30 +809,30 @@ class TargetingTestSuite: public CxxTest::TestSuite
++l_pIt;
if( l_pIt != l_rhs2 )
{
- TS_FAIL("Iterators should be equal, but aren't");
+ TARG_TS_FAIL("Iterators should be equal, but aren't");
}
l_rhs2++;
l_pIt++;
if( l_pIt != l_rhs2 )
{
- TS_FAIL("Iterators should be equal, but aren't");
+ TARG_TS_FAIL("Iterators should be equal, but aren't");
}
TargetIterator l_pItClone(l_rhs2);
if( l_pIt != l_pItClone)
{
- TS_FAIL("Iterators should be equal, but aren't");
+ TARG_TS_FAIL("Iterators should be equal, but aren't");
}
if(l_pIt != l_pItClone++)
{
- TS_FAIL("Iterators should be equal, but aren't");
+ TARG_TS_FAIL("Iterators should be equal, but aren't");
}
if( (++l_pIt) != l_pItClone)
{
- TS_FAIL("Iterators should be equal, but aren't");
+ TARG_TS_FAIL("Iterators should be equal, but aren't");
}
const TargetService& l_constTargetService = targetService();
@@ -876,22 +840,22 @@ class TargetingTestSuite: public CxxTest::TestSuite
ConstTargetIterator l_pConstIt;
if( l_pConstIt != l_constTargetService.end() )
{
- TS_FAIL("Default ConstTargetIterator should point to past the "
+ TARG_TS_FAIL("Default ConstTargetIterator should point to past the "
"end of container");
}
l_pConstIt = l_constTargetService.begin();
if( (*l_pConstIt) == NULL)
{
- TS_FAIL("Iterator does not point to valid Target as expected");
+ TARG_TS_FAIL("Iterator does not point to valid Target as expected");
}
- TS_TRACE(EXIT_MRK "testTargetIterator" );
+ TARG_TS_TRACE(EXIT_MRK "testTargetIterator" );
}
void testRangeFilter(void)
{
- TS_TRACE(ENTER_MRK "testRangeFilters" );
+ TARG_TS_TRACE(ENTER_MRK "testRangeFilters" );
using namespace TARGETING;
@@ -916,14 +880,14 @@ class TargetingTestSuite: public CxxTest::TestSuite
|| (l_pBegin == l_pNext)
)
{
- TS_FAIL("Target* pointed to by Begin/next NULL -or- begin =="
+ TARG_TS_FAIL("Target* pointed to by Begin/next NULL -or- begin =="
"next");
}
l_f1.reset();
if( *l_f1 != l_pBegin )
{
- TS_FAIL("Target* after reset should be equal to original");
+ TARG_TS_FAIL("Target* after reset should be equal to original");
}
l_f1.reset();
@@ -932,7 +896,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
l_f1.setPredicate(&l_ctm);
if( *l_f1 == l_pBegin )
{
- TS_FAIL("Target* after reset and change of predicate should be"
+ TARG_TS_FAIL("Target* after reset and change of predicate should be"
"different than the original");
}
@@ -946,7 +910,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
{
if(l_f3->getAttr<ATTR_TYPE>() != TYPE_PROC)
{
- TS_FAIL("Should only have returned type proc");
+ TARG_TS_FAIL("Should only have returned type proc");
break;
}
}
@@ -957,7 +921,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
if(l_pIt == targetService().end())
{
- TS_FAIL("Not enough elements for test");
+ TARG_TS_FAIL("Not enough elements for test");
}
TargetRangeFilter l_partial(
@@ -973,15 +937,15 @@ class TargetingTestSuite: public CxxTest::TestSuite
if(i != 2)
{
- TS_FAIL("Should have gotten 2 elements %d",i);
+ TARG_TS_FAIL("Should have gotten 2 elements %d",i);
}
- TS_TRACE(EXIT_MRK "testRangeFilter" );
+ TARG_TS_TRACE(EXIT_MRK "testRangeFilter" );
}
void testComplexFilter(void)
{
- TS_TRACE(ENTER_MRK "testComplexFilter" );
+ TARG_TS_TRACE(ENTER_MRK "testComplexFilter" );
using namespace TARGETING;
@@ -995,7 +959,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
{
}
- TS_TRACE(INF_MRK "Found %d total targets", l_count);
+ TARG_TS_TRACE(INF_MRK "Found %d total targets", l_count);
PredicateCTM l_procs(CLASS_CHIP);
PredicateCTM l_enclosures(CLASS_ENC);
@@ -1012,7 +976,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
l_path.dump();
}
- TS_TRACE(INF_MRK "Found %d targets that are chips or enclosures ",
+ TARG_TS_TRACE(INF_MRK "Found %d targets that are chips or enclosures ",
l_count);
l_query.Not();
@@ -1023,7 +987,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
{
}
- TS_TRACE(INF_MRK "Found %d targets that are not chips or "
+ TARG_TS_TRACE(INF_MRK "Found %d targets that are not chips or "
"enclosures",l_count);
Target* l_pMasterProcChipTargetHandle = NULL;
@@ -1031,7 +995,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
l_pMasterProcChipTargetHandle);
if(l_pMasterProcChipTargetHandle == NULL)
{
- TS_FAIL("Master processor chip target not found");
+ TARG_TS_FAIL("Master processor chip target not found");
}
PredicateCTM l_ex(CLASS_UNIT,TYPE_EX);
@@ -1054,17 +1018,17 @@ class TargetingTestSuite: public CxxTest::TestSuite
l_path.dump();
}
- TS_TRACE(INF_MRK "Found %d targets that are ex/mba units off "
+ TARG_TS_TRACE(INF_MRK "Found %d targets that are ex/mba units off "
"master processor",l_count);
- TS_TRACE(EXIT_MRK "testComplexFilter" );
+ TARG_TS_TRACE(EXIT_MRK "testComplexFilter" );
}
void testFapiToHbMacros ()
{
- TS_TRACE(ENTER_MRK "testFapiToHbMacros" );
+ TARG_TS_TRACE(ENTER_MRK "testFapiToHbMacros" );
- TS_TRACE(INF_MRK "Now using direct access macros");
+ TARG_TS_TRACE(INF_MRK "Now using direct access macros");
using namespace TARGETING;
using namespace fapi;
@@ -1075,7 +1039,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
(void) l_targetService.getTopLevelTarget(l_pTarget);
if (l_pTarget == NULL)
{
- TS_FAIL("Top level handle was NULL when initialization "
+ TARG_TS_FAIL("Top level handle was NULL when initialization "
"complete");
}
@@ -1084,7 +1048,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
l_pTarget->tryGetAttr<TARGETING::ATTR_DUMMY_RW>(l_dummyRw);
if(l_dummyRw[0][1][2] != 5)
{
- TS_FAIL("l_dummyRw value is %d, not 5 as expected in direct "
+ TARG_TS_FAIL("l_dummyRw value is %d, not 5 as expected in direct "
"attribute access",l_dummyRw[0][1][2]);
}
@@ -1092,49 +1056,49 @@ class TargetingTestSuite: public CxxTest::TestSuite
l_pTarget->getAttr<TARGETING::ATTR_CLASS>();
if(l_class != TARGETING::CLASS_SYS)
{
- TS_FAIL("l_class value is %d, not %d as expected in direct "
+ TARG_TS_FAIL("l_class value is %d, not %d as expected in direct "
"attribute access",l_class,TARGETING::CLASS_SYS);
}
TARGETING::TYPE l_type = l_pTarget->getAttr<TARGETING::ATTR_TYPE>();
if(l_type != TARGETING::TYPE_SYS)
{
- TS_FAIL("l_type value is %d, not %d as expected in direct "
+ TARG_TS_FAIL("l_type value is %d, not %d as expected in direct "
"attribute access",l_type,TARGETING::TYPE_SYS);
}
uint64_t l_xscom =
l_pTarget->getAttr<TARGETING::ATTR_XSCOM_BASE_ADDRESS>();
- if(l_xscom != 0x300000000000)
+ if(l_xscom != 0x300000000000ULL)
{
- TS_FAIL("l_xscom value is %x, not %x as expected in direct "
- "attribute access",l_xscom,0x300000000000);
+ TARG_TS_FAIL("l_xscom value is 0x%016llX, not 0x%016llX as expected in direct "
+ "attribute access",l_xscom,0x300000000000ULL);
}
- TS_TRACE(INF_MRK "Now using FAPI get macros");
+ TARG_TS_TRACE(INF_MRK "Now using FAPI get macros");
memset(l_dummyRw,0x00,sizeof(l_dummyRw));
fapi::ReturnCode l_rc = FAPI_ATTR_GET(
ATTR_DUMMY_SCRATCH_PLAT_INIT_UINT8, NULL, l_dummyRw);
if(l_rc != 0)
{
- TS_FAIL("Failed to get dummy RW attribute on system target");
+ TARG_TS_FAIL("Failed to get dummy RW attribute on system target");
}
if(l_dummyRw[0][2][4] != 5)
{
- TS_FAIL("l_dummyRw value is %d, not 5 as expected",
+ TARG_TS_FAIL("l_dummyRw value is %d, not 5 as expected",
l_dummyRw[0][2][4]);
}
- TS_TRACE(INF_MRK "Now using FAPI set macros");
+ TARG_TS_TRACE(INF_MRK "Now using FAPI set macros");
l_dummyRw[0][2][3] = 6;
l_rc = FAPI_ATTR_SET(ATTR_DUMMY_SCRATCH_PLAT_INIT_UINT8, NULL,
l_dummyRw);
if(l_rc != 0)
{
- TS_FAIL("Failed to write dummy RW attribute on system target");
+ TARG_TS_FAIL("Failed to write dummy RW attribute on system target");
}
memset(l_dummyRw,0x00,sizeof(l_dummyRw));
@@ -1142,16 +1106,16 @@ class TargetingTestSuite: public CxxTest::TestSuite
l_dummyRw);
if(l_rc != 0)
{
- TS_FAIL("Failed to get dummy RW attribute on system target");
+ TARG_TS_FAIL("Failed to get dummy RW attribute on system target");
}
if(l_dummyRw[0][2][3] != 6)
{
- TS_FAIL("l_dummyRw value is %d, not 6 as expected due to a "
+ TARG_TS_FAIL("l_dummyRw value is %d, not 6 as expected due to a "
"prior write",l_dummyRw[0][2][3]);
}
- TS_TRACE(INF_MRK "Now using targets without the attribute");
+ TARG_TS_TRACE(INF_MRK "Now using targets without the attribute");
memset(l_dummyRw,0x00,sizeof(l_dummyRw));
EntityPath l_realPath(EntityPath::PATH_PHYSICAL);
@@ -1159,7 +1123,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
l_pTarget = l_realPath.operator->();
if (l_pTarget == NULL)
{
- TS_FAIL("Node 0 target handle should not be NULL");
+ TARG_TS_FAIL("Node 0 target handle should not be NULL");
}
fapi::Target* l_pFapiTarget = new fapi::Target(
@@ -1168,12 +1132,12 @@ class TargetingTestSuite: public CxxTest::TestSuite
l_pFapiTarget , l_dummyRw);
if(l_rc == 0)
{
- TS_FAIL("Should have failed getting the attribute on "
+ TARG_TS_FAIL("Should have failed getting the attribute on "
"non-supporting target");
}
else if(l_rc != FAPI_RC_PLAT_ERR_SEE_DATA)
{
- TS_FAIL("Should have been a platform handled error");
+ TARG_TS_FAIL("Should have been a platform handled error");
}
// The error log will get deleted when the ReturnCode is destructed. The
@@ -1183,12 +1147,12 @@ class TargetingTestSuite: public CxxTest::TestSuite
delete l_pFapiTarget;
l_pFapiTarget = NULL;
- TS_TRACE(EXIT_MRK "testFapiToHbMacros" );
+ TARG_TS_TRACE(EXIT_MRK "testFapiToHbMacros" );
}
void testFapiAttributes ()
{
- TS_TRACE(ENTER_MRK "testFapiAttributes" );
+ TARG_TS_TRACE(ENTER_MRK "testFapiAttributes" );
using namespace TARGETING;
using namespace fapi;
@@ -1212,7 +1176,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
{
if(l_mba_filter->getAttr<ATTR_TYPE>() != TYPE_MBA)
{
- TS_FAIL("Should only have returned type MBA!");
+ TARG_TS_FAIL("Should only have returned type MBA!");
break;
}
else
@@ -1225,7 +1189,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
l_rc = FAPI_ATTR_GET(ATTR_MSS_EFF_PRIMARY_RANK, l_pFapiTarget,l_uint8_mss_eff_primary_rank);
if (l_rc)
{
- TS_FAIL("hwpTestAttributes: ATTR_MSS_EFF_PRIMARY_RANK. Error from GET");
+ TARG_TS_FAIL("hwpTestAttributes: ATTR_MSS_EFF_PRIMARY_RANK. Error from GET");
break;
}
@@ -1233,28 +1197,28 @@ class TargetingTestSuite: public CxxTest::TestSuite
l_rc = FAPI_ATTR_SET(ATTR_MSS_EFF_PRIMARY_RANK, l_pFapiTarget, l_uint8_mss_eff_primary_rank);
if (l_rc)
{
- TS_FAIL("hwpTestAttributes: ATTR_MSS_EFF_PRIMARY_RANK. Error from SET");
+ TARG_TS_FAIL("hwpTestAttributes: ATTR_MSS_EFF_PRIMARY_RANK. Error from SET");
break;
}
delete l_pFapiTarget;
l_pFapiTarget = NULL;
- TS_TRACE("hwpTestAttributes: Test of ATTR_MSS_EFF_PRIMARY_RANK Passed!");
+ TARG_TS_TRACE("hwpTestAttributes: Test of ATTR_MSS_EFF_PRIMARY_RANK Passed!");
}
}
#endif
- TS_TRACE(EXIT_MRK "testFapiAttributes" );
+ TARG_TS_TRACE(EXIT_MRK "testFapiAttributes" );
if(l_rc)
{
- errlHndl_t l_pErrLog = static_cast<ERRORLOG::ErrlEntry*>(l_rc.releasePlatData());
- ERRORLOG::errlCommit(l_pErrLog,TARG_COMP_ID);
+ errlHndl_t l_pErrLog = static_cast<errlHndl_t>(l_rc.releasePlatData());
+ COMMON::ERRORLOG::errlCommit(l_pErrLog,TARG_COMP_ID);
}
}
void testPodNumericalTypes()
{
- TS_TRACE(ENTER_MRK "testPodNumericalTypes" );
+ TARG_TS_TRACE(ENTER_MRK "testPodNumericalTypes" );
using namespace TARGETING;
using namespace fapi;
@@ -1265,7 +1229,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
(void) l_targetService.getTopLevelTarget(l_pTarget);
if (l_pTarget == NULL)
{
- TS_FAIL("Top level handle was NULL when initialization "
+ TARG_TS_FAIL("Top level handle was NULL when initialization "
"complete");
}
@@ -1273,68 +1237,70 @@ class TargetingTestSuite: public CxxTest::TestSuite
memset(&l_pod,0x00,sizeof(l_pod));
if(!l_pTarget->tryGetAttr<TARGETING::ATTR_NUMERIC_POD_TYPE_TEST>(l_pod))
{
- TS_FAIL("Numeric POD type not found");
+ TARG_TS_FAIL("Numeric POD type not found");
}
if( (l_pod.fsiPath.type() != EntityPath::PATH_PHYSICAL)
|| (l_pod.fsiPath[0].type != TYPE_SYS)
|| (l_pod.fsiPath[0].instance != 0)
|| (l_pod.fsiPath.size() != 1 ) )
{
- TS_FAIL("Expected physical:sys-0, got a different result");
+ TARG_TS_FAIL("Expected physical:sys-0, got a different result");
}
if(l_pod.className != CLASS_CHIP)
{
- TS_FAIL("Expected CLASS value of 0x%08X, got 0x%08X",
+ TARG_TS_FAIL("Expected CLASS value of 0x%08X, got 0x%08X",
CLASS_CHIP,l_pod.className);
}
if(l_pod.uint8 != 0xAB)
{
- TS_FAIL("Expected uint8_t value of 0xAB, got 0x%02X",
+ TARG_TS_FAIL("Expected uint8_t value of 0xAB, got 0x%02X",
l_pod.uint8);
}
if (l_pod.uint16 != 0xABCD)
{
- TS_FAIL("Expected uint16_t value of 0xABCD, got 0x%04X",
+ TARG_TS_FAIL("Expected uint16_t value of 0xABCD, got 0x%04X",
l_pod.uint16);
}
if (l_pod.uint32 != 0xABCDEF01)
{
- TS_FAIL("Expected uint32_t value of 0xABCDEF01, got 0x%08X",
+ TARG_TS_FAIL("Expected uint32_t value of 0xABCDEF01, got 0x%08X",
l_pod.uint32);
}
if (l_pod.uint64 != 0xABCDEF0123456789ULL)
{
- TS_FAIL("Expected uint64_t value of 0xABCDEF0123456789, got 0x%016lX",
+ TARG_TS_FAIL("Expected uint64_t value of 0xABCDEF0123456789, got "
+ "0x%016llX",
l_pod.uint64);
}
if(l_pod.int8 != -124)
{
- TS_FAIL("Expected int8_t value of -124, got %d",
+ TARG_TS_FAIL("Expected int8_t value of -124, got %d",
l_pod.int8);
}
if (l_pod.int16 != -32764)
{
- TS_FAIL("Expected int16_t value of -32764, got %d",
+ TARG_TS_FAIL("Expected int16_t value of -32764, got %d",
l_pod.int16);
}
if (l_pod.int32 != -2147483644)
{
- TS_FAIL("Expected int32_t value of -2147483644, got %d",
+ TARG_TS_FAIL("Expected int32_t value of -2147483644, got %d",
l_pod.int32);
}
if (l_pod.int64 != -9223372036854775804LL)
{
- TS_FAIL("Expected int64_t value of -9223372036854775804, got %ld",
+ TARG_TS_FAIL("Expected int64_t value of -9223372036854775804, got "
+ "%lld",
l_pod.int64);
}
- TS_TRACE(EXIT_MRK "testPodNumericalTypes" );
+ TARG_TS_TRACE(EXIT_MRK "testPodNumericalTypes" );
}
void testCentaurs()
{
- TS_TRACE(ENTER_MRK "testCentaurs" );
+ TARG_TS_TRACE(ENTER_MRK "testCentaurs" );
using namespace TARGETING;
@@ -1367,156 +1333,15 @@ class TargetingTestSuite: public CxxTest::TestSuite
{
if(l_count <= 0)
{
- TS_FAIL("Did not find any Centaur chips connected to processors");
+ TARG_TS_FAIL("Did not find any Centaur chips connected to processors");
}
else
{
- TS_TRACE("Found %d Centaur chips connected to processors",l_count);
- }
- }
-
- TS_TRACE(EXIT_MRK "testCentaurs" );
- }
-
- void testHbMutexAttr()
- {
- TS_TRACE(ENTER_MRK "testHbMutexAttr" );
-
- using namespace TARGETING;
- using namespace fapi;
-
- do {
-
- // Get a reference to the target service
- TargetService& l_targetService = targetService();
-
- // Get the system target containing the test mutex
- TARGETING::Target* l_pTarget = NULL;
- (void) l_targetService.getTopLevelTarget(l_pTarget);
- if (l_pTarget == NULL)
- {
- TS_FAIL("Top level target handle is NULL");
- break;
- }
-
- // Get the mutex attribute (actually a mutex_t* which points to
- // a mutex)
- HB_MUTEX_TEST_LOCK_ATTR l_pLock
- = l_pTarget->getHbMutexAttr<TARGETING::ATTR_HB_MUTEX_TEST_LOCK>();
-
- // Test: Verify the value pointed to by the mutex_t* is zero
- if ( (*reinterpret_cast<uint64_t*>(l_pLock)) != 0)
- {
- TS_FAIL("Mutex attribute must be initialized to zero, but got %ld",
- *reinterpret_cast<uint64_t*>(l_pLock));
- break;
- }
-
- // Try to get the attribute, and ensure it's the same
- HB_MUTEX_TEST_LOCK_ATTR l_pLockTry = NULL;
- if(l_pTarget->tryGetHbMutexAttr<TARGETING::ATTR_HB_MUTEX_TEST_LOCK>
- (l_pLockTry))
- {
- if(l_pLockTry != l_pLock)
- {
- TS_FAIL("Mutex attributes should match, but dont. "
- "l_pLockTry = %ld, l_pLock = %ld",l_pLockTry,
- l_pLock);
- break;
+ TARG_TS_TRACE("Found %d Centaur chips connected to processors",l_count);
}
}
- else
- {
- TS_FAIL("Mutex attribute tryGet failed, even though it exists");
- break;
- }
-
- // Create a structue holding pointers to the mutex and a protected value
- volatile uint32_t l_var = 0;
- (void)mutex_lock(l_pLock);
- barrier_t l_barrier;
- (void)barrier_init(&l_barrier, 2);
- MutexTestData_t l_mutexTestData = { l_pLock, &l_barrier, &l_var };
-
- // Spawn off a function which tries to write the protected value to
- // something unexpected. If the mutex is working, the for loop will
- // always poll the expected value.
- task_create(funcTestMutex, static_cast<void*>(&l_mutexTestData));
-
- // Guarantee the child process runs and blocks on the mutex prior to
- // modifying the protected value. isync to ensure the processor doesn't
- // speculatively perform the comparison prior to the sleep completing
- barrier_wait(&l_barrier);
- nanosleep(0,TEN_CTX_SWITCHES_NS); isync();
-
- if(l_var != 0)
- {
- TS_FAIL("Protected value must be 0, was %d instead",l_var);
- break;
- }
-
- // Now unlock the mutex, allowing the other thread to overwrite the
- // protected value; which should happen within 100,000 reads of the
- // var. This will confirm the other thread was actively trying to
- // write the controlled value
- (void)mutex_unlock(l_pLock);
-
- // Guarantee the child process acquires the mutex and modifies the
- // protected value.
- barrier_wait(&l_barrier);
-
- if(l_var != 1)
- {
- TS_FAIL("Protected value must now be 1, was %d instead",l_var);
- break;
- }
-
- barrier_destroy(&l_barrier);
-
- } while(0);
-
- TS_TRACE(EXIT_MRK "testHbMutexAttr");
- }
-
- void testErrlTargetFFDC()
- {
- TS_TRACE(ENTER_MRK "testErrlTargetFFDC" );
-
- using namespace ERRORLOG;
- using namespace TARGETING;
- using namespace fapi;
- // Get a reference to the target service
- TargetService& l_service = targetService();
-
- // Get the master proc target
- TARGETING::Target* l_pTarget1 = NULL;
- TARGETING::Target* l_pTarget2 = MASTER_PROCESSOR_CHIP_TARGET_SENTINEL;
- l_service.masterProcChipTargetHandle( l_pTarget1);
-
- // Create an errorlog to test FFDC capture of targets
- /*@
- * @errortype
- * @severity ERRORLOG_SEV_INFORMATIONAL
- * @moduleid TARG_MOD_TEST
- * @reasoncode TARG_RC_TEST_TARGET_FFDC
- * @userdata1 Test data 1
- * @userdata2 Test data 2
- * @devdesc User Details unit test - create target user detail data
- */
- errlHndl_t l_err;
- l_err = new ErrlEntry(ERRL_SEV_INFORMATIONAL,
- TARG_MOD_TEST,
- TARG_RC_TEST_TARGET_FFDC,
- 0x0011223344556677,
- 0x8899aabbccddeeff);
-
- ErrlUserDetailsTarget(l_pTarget1).addToLog(l_err);
- ErrlUserDetailsTarget(l_pTarget2).addToLog(l_err);
-
- errlCommit(l_err, CXXTEST_COMP_ID);
-
- TS_TRACE(EXIT_MRK "testErrlTargetFFDC");
+ TARG_TS_TRACE(EXIT_MRK "testCentaurs" );
}
/**
@@ -1524,7 +1349,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
*/
void testStringAttributes(void)
{
- TS_TRACE(ENTER_MRK "testStringAttributes" );
+ TARG_TS_TRACE(ENTER_MRK "testStringAttributes" );
using namespace TARGETING;
@@ -1537,7 +1362,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
(void) l_targetService.getTopLevelTarget(l_pTopLevel);
if (l_pTopLevel == NULL)
{
- TS_FAIL("ERROR: Can not find top level target; bypassing "
+ TARG_TS_FAIL("ERROR: Can not find top level target; bypassing "
"remaining string attribute tests");
break;
}
@@ -1548,7 +1373,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
ATTR_TEST_NULL_STRING_type l_nullString = {0};
if(sizeof(l_nullString) != ATTR_TEST_NULL_STRING_max_chars+1)
{
- TS_FAIL("ERROR: l_nullString size (%d) "
+ TARG_TS_FAIL("ERROR: l_nullString size (%d) "
"does not match stated size (%d)",
sizeof(l_nullString),
ATTR_TEST_NULL_STRING_max_chars+1);
@@ -1557,13 +1382,13 @@ class TargetingTestSuite: public CxxTest::TestSuite
// TC1.2: String size must be non-zero
if(sizeof(l_nullString) == 0)
{
- TS_FAIL("ERROR: l_nullString size is zero");
+ TARG_TS_FAIL("ERROR: l_nullString size is zero");
}
// TC1.3: Must be able to read the string
if(!l_pTopLevel->tryGetAttr<ATTR_TEST_NULL_STRING>(l_nullString))
{
- TS_FAIL("ERROR: Can not read l_nullString attribute");
+ TARG_TS_FAIL("ERROR: Can not read l_nullString attribute");
}
// TC1.4: All bytes of the string must match the reference version
@@ -1571,7 +1396,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
l_nullString,
sizeof(l_nullStringReference)))
{
- TS_FAIL("ERROR: l_nullString bytes do not match the reference"
+ TARG_TS_FAIL("ERROR: l_nullString bytes do not match the reference"
"version");
TARG_BIN("Expected (l_nullStringReference)",
l_nullStringReference,sizeof(l_nullStringReference));
@@ -1582,7 +1407,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
// TC1.5: String must equal the empty string by string comparison
if(strcmp(l_nullString,"") != 0)
{
- TS_FAIL("ERROR: l_nullString does not strcmp to the empty string");
+ TARG_TS_FAIL("ERROR: l_nullString does not strcmp to the empty string");
TARG_BIN("Actual (l_nullString)",
l_nullString,sizeof(l_nullString));
}
@@ -1594,7 +1419,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
ATTR_TEST_MIN_STRING_type l_minString = {0};
if(sizeof(l_minString) != ATTR_TEST_MIN_STRING_max_chars+1)
{
- TS_FAIL("ERROR: l_minString size (%d) "
+ TARG_TS_FAIL("ERROR: l_minString size (%d) "
"does not match stated size (%d)",
sizeof(l_minString),
ATTR_TEST_MIN_STRING_max_chars+1);
@@ -1603,13 +1428,13 @@ class TargetingTestSuite: public CxxTest::TestSuite
// TC2.2: String size must be non-zero
if(sizeof(l_minString) == 0)
{
- TS_FAIL("ERROR: l_minString size is zero");
+ TARG_TS_FAIL("ERROR: l_minString size is zero");
}
// TC2.3: Must be able to read the string
if(!l_pTopLevel->tryGetAttr<ATTR_TEST_MIN_STRING>(l_minString))
{
- TS_FAIL("ERROR: Can not read l_minString attribute");
+ TARG_TS_FAIL("ERROR: Can not read l_minString attribute");
}
// TC2.4: All bytes in string must match the reference string
@@ -1617,7 +1442,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
l_minString,
sizeof(l_minStringReference)))
{
- TS_FAIL("ERROR l_minString bytes do not match the reference "
+ TARG_TS_FAIL("ERROR l_minString bytes do not match the reference "
"version");
TARG_BIN("Expected (l_minStringReference)",
l_minStringReference,sizeof(l_minStringReference));
@@ -1628,7 +1453,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
// TC2.5: String must equal "Z" by comparison
if(strcmp(l_minString,l_minStringReference) != 0)
{
- TS_FAIL("ERROR l_minString does not strcmp to the reference "
+ TARG_TS_FAIL("ERROR l_minString does not strcmp to the reference "
"string");
TARG_BIN("Actual (l_minString)",
l_minString,sizeof(l_minString));
@@ -1643,7 +1468,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
ATTR_TEST_MAX_STRING_type l_maxString = {0};
if(sizeof(l_maxString) != ATTR_TEST_MAX_STRING_max_chars+1)
{
- TS_FAIL("ERROR: l_maxString size (%d) "
+ TARG_TS_FAIL("ERROR: l_maxString size (%d) "
"does not match stated size (%d)",
sizeof(l_maxString),
ATTR_TEST_MAX_STRING_max_chars+1);
@@ -1652,13 +1477,13 @@ class TargetingTestSuite: public CxxTest::TestSuite
// TC3.2: String storage size must be non-zero
if(sizeof(l_maxString) == 0)
{
- TS_FAIL("ERROR: l_maxString storage size is zero");
+ TARG_TS_FAIL("ERROR: l_maxString storage size is zero");
}
// TC3.3: Must be able to read the string
if(!l_pTopLevel->tryGetAttr<ATTR_TEST_MAX_STRING>(l_maxString))
{
- TS_FAIL("ERROR: Could not read l_maxString");
+ TARG_TS_FAIL("ERROR: Could not read l_maxString");
}
// TC3.4: All bytes in string must match the reference
@@ -1666,7 +1491,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
l_maxString,
sizeof(l_maxStringReference)))
{
- TS_FAIL("ERROR: l_maxString bytes do not match the reference "
+ TARG_TS_FAIL("ERROR: l_maxString bytes do not match the reference "
"version");
TARG_BIN("Expected (l_maxStringReference)",
l_maxStringReference,sizeof(l_maxStringReference));
@@ -1677,7 +1502,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
// TC3.5: String must equal "abc" by comparison
if(strcmp(l_maxString,l_maxStringReference) != 0)
{
- TS_FAIL("ERROR: l_maxString does not strcmp to the reference "
+ TARG_TS_FAIL("ERROR: l_maxString does not strcmp to the reference "
"string");
TARG_BIN("Actual (l_maxString)",
l_maxString,sizeof(l_maxString));
@@ -1689,7 +1514,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
ATTR_TEST_NO_DEFAULT_STRING_type l_noDefaultString = {0};
if(sizeof(l_noDefaultString) != ATTR_TEST_NO_DEFAULT_STRING_max_chars+1)
{
- TS_FAIL("ERROR: l_noDefaultString size (%d) "
+ TARG_TS_FAIL("ERROR: l_noDefaultString size (%d) "
"does not match stated size (%d)",
sizeof(l_noDefaultString),
ATTR_TEST_NO_DEFAULT_STRING_max_chars+1);
@@ -1698,14 +1523,14 @@ class TargetingTestSuite: public CxxTest::TestSuite
// TC4.2: String storage size must be non-zero
if(sizeof(l_noDefaultString) == 0)
{
- TS_FAIL("ERROR: l_noDefaultString storage size is zero");
+ TARG_TS_FAIL("ERROR: l_noDefaultString storage size is zero");
}
// TC4.3: Must be able to read the string
if(!l_pTopLevel->tryGetAttr<ATTR_TEST_NO_DEFAULT_STRING>(
l_noDefaultString))
{
- TS_FAIL("ERROR: Could not read l_noDefaultString");
+ TARG_TS_FAIL("ERROR: Could not read l_noDefaultString");
}
// TC4.4: All bytes in string must match the reference
@@ -1713,7 +1538,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
l_noDefaultString,
sizeof(l_noDefaultStringReference)))
{
- TS_FAIL("ERROR: l_noDefaultString bytes do not match the "
+ TARG_TS_FAIL("ERROR: l_noDefaultString bytes do not match the "
"reference");
TARG_BIN("Expected (l_noDefaultStringReference)",
l_noDefaultStringReference,
@@ -1725,7 +1550,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
// TC4.5: String must equal empty string by comparison
if(strcmp(l_noDefaultString,l_noDefaultStringReference) != 0)
{
- TS_FAIL("ERROR: l_noDefaultString does not strcmp to the reference "
+ TARG_TS_FAIL("ERROR: l_noDefaultString does not strcmp to the reference "
"string");
TARG_BIN("Actual (l_noDefaultString)",
l_noDefaultString,sizeof(l_noDefaultString));
@@ -1737,18 +1562,18 @@ class TargetingTestSuite: public CxxTest::TestSuite
strcpy(l_writeString,"aabbcc");
if(!l_pTopLevel->trySetAttr<ATTR_TEST_NO_DEFAULT_STRING>(l_writeString))
{
- TS_FAIL("ERROR: Could not write l_writeString");
+ TARG_TS_FAIL("ERROR: Could not write l_writeString");
}
ATTR_TEST_NO_DEFAULT_STRING_type l_readString = {0};
if(!l_pTopLevel->tryGetAttr<ATTR_TEST_NO_DEFAULT_STRING>(l_readString))
{
- TS_FAIL("ERROR: Could not read l_readString");
+ TARG_TS_FAIL("ERROR: Could not read l_readString");
}
if(strcmp(l_writeString,l_readString) != 0)
{
- TS_FAIL("ERROR: String does not match what was written");
+ TARG_TS_FAIL("ERROR: String does not match what was written");
TARG_BIN("Expected (l_writeString)",
l_writeString,
sizeof(l_writeString));
@@ -1759,7 +1584,7 @@ class TargetingTestSuite: public CxxTest::TestSuite
} while(0);
- TS_TRACE(EXIT_MRK "testStringAttributes" );
+ TARG_TS_TRACE(EXIT_MRK "testStringAttributes" );
}
@@ -1770,4 +1595,4 @@ class TargetingTestSuite: public CxxTest::TestSuite
}
};
-#endif // End __TESTTARGETING_H
+#endif // __TARGETING_COMMON_TESTCOMMONTARGETING_H
diff --git a/src/usr/targeting/common/test/unittest.H b/src/usr/targeting/common/test/unittest.H
new file mode 100644
index 000000000..1d81b2fbe
--- /dev/null
+++ b/src/usr/targeting/common/test/unittest.H
@@ -0,0 +1,29 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/usr/targeting/common/test/unittest.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
+
+#ifndef __TARGETING_COMMON_UNITTEST_H
+#define __TARGETING_COMMON_UNITTEST_H
+
+#include "unittestadapter.H"
+
+#endif // __TARGETING_COMMON_UNITTEST_H
diff --git a/src/usr/targeting/util.C b/src/usr/targeting/common/util.C
index a3ad99fe4..ce85567aa 100644
--- a/src/usr/targeting/util.C
+++ b/src/usr/targeting/common/util.C
@@ -20,18 +20,20 @@
// Origin: 30
//
// IBM_PROLOG_END
-//******************************************************************************
-// Includes
-//******************************************************************************
-#include <targeting/attributes.H>
-#include <targeting/entitypath.H>
-#include <targeting/targetservice.H>
-
/**
- * Miscellaneous Utility Functions
+ * @file targeting/common/util.C
+ *
+ * @brief Provides miscellaneous utility functions to targeting, including
+ * a check for whether system is in simulation or not.
*/
+//******************************************************************************
+// Includes
+//******************************************************************************
+#include <targeting/common/attributes.H>
+#include <targeting/common/targetservice.H>
+
namespace TARGETING
{
diff --git a/src/usr/targeting/xmltohb/attribute_types.xml b/src/usr/targeting/common/xmltohb/attribute_types.xml
index 5db40c399..1c1ed6e25 100644
--- a/src/usr/targeting/xmltohb/attribute_types.xml
+++ b/src/usr/targeting/common/xmltohb/attribute_types.xml
@@ -147,9 +147,21 @@
<name>PCI</name>
</enumerator>
<enumerator>
+ <name>TP</name>
+ </enumerator>
+ <enumerator>
<name>DMI</name>
</enumerator>
<enumerator>
+ <name>DPSS</name>
+ </enumerator>
+ <enumerator>
+ <name>APSS</name>
+ </enumerator>
+ <enumerator>
+ <name>OCC</name>
+ </enumerator>
+ <enumerator>
<name>LAST_IN_RANGE</name>
</enumerator>
<default>NA</default>
@@ -2975,6 +2987,7 @@
<simpleType>
<enumeration>
<id>PROC_EPS_TABLE_TYPE</id>
+ <default>EPS_TYPE_LE</default>
</enumeration>
</simpleType>
<persistency>non-volatile</persistency>
@@ -3011,6 +3024,7 @@
<simpleType>
<enumeration>
<id>PROC_FABRIC_PUMP_MODE</id>
+ <default>MODE1</default>
</enumeration>
</simpleType>
<persistency>non-volatile</persistency>
@@ -3045,6 +3059,7 @@
<simpleType>
<enumeration>
<id>PROC_X_BUS_WIDTH</id>
+ <default>W8BYTE</default>
</enumeration>
</simpleType>
<persistency>non-volatile</persistency>
@@ -3256,6 +3271,7 @@
</hwpfToHbAttrMap>
</attribute>
+<!-- @TOOD: Attribute is writable until MRW generates HUIDs for FSP -->
<attribute>
<id>HUID</id>
<description>
@@ -3272,6 +3288,7 @@
</simpleType>
<persistency>non-volatile</persistency>
<readable/>
+ <writeable/>
</attribute>
<attribute>
diff --git a/src/usr/targeting/common/xmltohb/common.mk b/src/usr/targeting/common/xmltohb/common.mk
new file mode 100644
index 000000000..b852173be
--- /dev/null
+++ b/src/usr/targeting/common/xmltohb/common.mk
@@ -0,0 +1,76 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/targeting/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
+
+################################################################################
+#
+# @file targeting/common/xmltohb/common.mk
+#
+# @brief Common attribute compiler makefile to be included in
+# targeting/xmltohb/makefile
+#
+################################################################################
+
+XMLTOHB_HEADER_TARGETS = \
+ attributeenums.H \
+ attributestrings.H \
+ attributetraits.H \
+ attributestructs.H \
+ pnortargeting.H \
+ fapiplatattrmacros.H
+
+XMLTOHB_SOURCE_TARGETS = \
+ attributestrings.C \
+ attributedump.C
+
+XMLTOHB_SYSTEM_BINARIES = \
+ vbu_targeting.bin \
+ simics_VENICE_targeting.bin \
+ simics_MURANO_targeting.bin
+
+XMLTOHB_TARGETS = \
+ ${XMLTOHB_HEADER_TARGETS} \
+ ${XMLTOHB_SOURCE_TARGETS}
+
+XMLTOHB_GENERIC_SOURCES = \
+ attribute_types.xml \
+ target_types.xml
+
+FAPI_ATTR_SOURCES = \
+ memory_attributes.xml \
+ L2_L3_attributes.xml \
+ scratch_attributes.xml \
+ system_attributes.xml \
+ chip_attributes.xml \
+ dimm_spd_attributes.xml \
+ dimm_attributes.xml \
+ unit_attributes.xml \
+ freq_attributes.xml \
+ proc_mvpd_attributes.xml
+
+XMLTOHB_GENERIC_XML = generic.xml
+XMLTOHB_FAPI_XML = fapiattrs.xml
+XMLTOHB_MERGE_SCRIPT = mergexml.sh
+XMLTOHB_COMPILER_SCRIPT = xmltohb.pl
+VMM_CONSTS_FILE = vmmconst.h
+
+GENERATED_CODE = ${XMLTOHB_TARGETS}
diff --git a/src/usr/targeting/xmltohb/mergexml.sh b/src/usr/targeting/common/xmltohb/mergexml.sh
index 2d73d0d6b..2d73d0d6b 100755
--- a/src/usr/targeting/xmltohb/mergexml.sh
+++ b/src/usr/targeting/common/xmltohb/mergexml.sh
diff --git a/src/usr/targeting/xmltohb/simics_MURANO.mrw.xml b/src/usr/targeting/common/xmltohb/simics_MURANO.mrw.xml
index adeb2bce9..adeb2bce9 100644
--- a/src/usr/targeting/xmltohb/simics_MURANO.mrw.xml
+++ b/src/usr/targeting/common/xmltohb/simics_MURANO.mrw.xml
diff --git a/src/usr/targeting/xmltohb/simics_MURANO.system.xml b/src/usr/targeting/common/xmltohb/simics_MURANO.system.xml
index 6094b4b7c..6094b4b7c 100644
--- a/src/usr/targeting/xmltohb/simics_MURANO.system.xml
+++ b/src/usr/targeting/common/xmltohb/simics_MURANO.system.xml
diff --git a/src/usr/targeting/xmltohb/simics_VENICE.mrw.xml b/src/usr/targeting/common/xmltohb/simics_VENICE.mrw.xml
index adeb2bce9..adeb2bce9 100644
--- a/src/usr/targeting/xmltohb/simics_VENICE.mrw.xml
+++ b/src/usr/targeting/common/xmltohb/simics_VENICE.mrw.xml
diff --git a/src/usr/targeting/xmltohb/simics_VENICE.system.xml b/src/usr/targeting/common/xmltohb/simics_VENICE.system.xml
index b820f97aa..b820f97aa 100644
--- a/src/usr/targeting/xmltohb/simics_VENICE.system.xml
+++ b/src/usr/targeting/common/xmltohb/simics_VENICE.system.xml
diff --git a/src/usr/targeting/xmltohb/target_types.xml b/src/usr/targeting/common/xmltohb/target_types.xml
index a22d8ef1c..a22d8ef1c 100644
--- a/src/usr/targeting/xmltohb/target_types.xml
+++ b/src/usr/targeting/common/xmltohb/target_types.xml
diff --git a/src/usr/targeting/xmltohb/vbu.mrw.xml b/src/usr/targeting/common/xmltohb/vbu.mrw.xml
index 1b83b150a..1b83b150a 100644
--- a/src/usr/targeting/xmltohb/vbu.mrw.xml
+++ b/src/usr/targeting/common/xmltohb/vbu.mrw.xml
diff --git a/src/usr/targeting/xmltohb/vbu.system.xml b/src/usr/targeting/common/xmltohb/vbu.system.xml
index 9d72f3df4..9d72f3df4 100644
--- a/src/usr/targeting/xmltohb/vbu.system.xml
+++ b/src/usr/targeting/common/xmltohb/vbu.system.xml
diff --git a/src/usr/targeting/xmltohb/xmltohb.pl b/src/usr/targeting/common/xmltohb/xmltohb.pl
index b69d1fe0d..842027137 100755
--- a/src/usr/targeting/xmltohb/xmltohb.pl
+++ b/src/usr/targeting/common/xmltohb/xmltohb.pl
@@ -110,20 +110,23 @@ my $xml = new XML::Simple (KeyAttr=>[]);
# Until full machine parseable workbook parsing splits out all the input files,
# use the intermediate representation containing the full host boot model.
# Aborts application if file name not found.
-my $attributes = $xml->XMLin($cfgHbXmlFile, forcearray => ['enumerationType','attribute','hwpfToHbAttrMap']);
-my $fapiAttributes = $xml->XMLin($cfgFapiAttributesXmlFile, forcearray => ['attribute']);
+my $attributes = $xml->XMLin($cfgHbXmlFile,
+ forcearray => ['enumerationType','attribute','hwpfToHbAttrMap']);
+my $fapiAttributes = $xml->XMLin($cfgFapiAttributesXmlFile,
+ forcearray => ['attribute']);
# Perform some sanity validation of the model (so we don't have to later)
validateAttributes($attributes);
validateTargetInstances($attributes);
validateTargetTypes($attributes);
+validateTargetTypesExtension($attributes);
# Open the output files and write them
if( !($cfgSrcOutputDir =~ "none") )
{
open(TRAIT_FILE,">$cfgSrcOutputDir"."attributetraits.H")
or fatal ("Trait file: \"$cfgSrcOutputDir"
- . "attributetraits.H\" could not be opened.");
+ . "attributetraits.H\" could not be opened.");
my $traitFile = *TRAIT_FILE;
writeTraitFileHeader($traitFile);
writeTraitFileTraits($attributes,$traitFile);
@@ -132,7 +135,7 @@ if( !($cfgSrcOutputDir =~ "none") )
open(ATTR_FILE,">$cfgSrcOutputDir"."attributeenums.H")
or fatal ("Attribute enum file: \"$cfgSrcOutputDir"
- . "attributeenums.H\" could not be opened.");
+ . "attributeenums.H\" could not be opened.");
my $enumFile = *ATTR_FILE;
writeEnumFileHeader($enumFile);
writeEnumFileAttrIdEnum($attributes,$enumFile);
@@ -142,7 +145,7 @@ if( !($cfgSrcOutputDir =~ "none") )
open(STRING_HEADER_FILE,">$cfgSrcOutputDir"."attributestrings.H")
or fatal ("Attribute string header file: \"$cfgSrcOutputDir"
- . "attributestrings.H\" could not be opened.");
+ . "attributestrings.H\" could not be opened.");
my $stringHeaderFile = *STRING_HEADER_FILE;
writeStringHeaderFileHeader($stringHeaderFile);
writeStringHeaderFileStrings($attributes,$stringHeaderFile);
@@ -151,7 +154,7 @@ if( !($cfgSrcOutputDir =~ "none") )
open(STRING_IMPLEMENTATION_FILE,">$cfgSrcOutputDir"."attributestrings.C")
or fatal ("Attribute string source file: \"$cfgSrcOutputDir"
- . "attributestrings.C\" could not be opened.");
+ . "attributestrings.C\" could not be opened.");
my $stringImplementationFile = *STRING_IMPLEMENTATION_FILE;
writeStringImplementationFileHeader($stringImplementationFile);
writeStringImplementationFileStrings($attributes,$stringImplementationFile);
@@ -160,7 +163,7 @@ if( !($cfgSrcOutputDir =~ "none") )
open(STRUCTS_HEADER_FILE,">$cfgSrcOutputDir"."attributestructs.H")
or fatal ("Attribute struct file: \"$cfgSrcOutputDir"
- . "attributestructs.H\" could not be opened.");
+ . "attributestructs.H\" could not be opened.");
my $structFile = *STRUCTS_HEADER_FILE;
writeStructFileHeader($structFile);
writeStructFileStructs($attributes,$structFile);
@@ -169,17 +172,18 @@ if( !($cfgSrcOutputDir =~ "none") )
open(PNOR_HEADER_DEF_FILE,">$cfgSrcOutputDir"."pnortargeting.H")
or fatal ("Targeting header definition header file: \"$cfgSrcOutputDir"
- . "pnortargeting.H\" could not be opened.");
+ . "pnortargeting.H\" could not be opened.");
my $pnorHeaderDefFile = *PNOR_HEADER_DEF_FILE;
writeHeaderFormatHeaderFile($pnorHeaderDefFile);
close $pnorHeaderDefFile;
open(FAPI_PLAT_ATTR_MACROS_FILE,">$cfgSrcOutputDir"."fapiplatattrmacros.H")
or fatal ("FAPI platform attribute macro header file: \"$cfgSrcOutputDir"
- . "fapiplatattrmacros.H\" could not be opened.");
+ . "fapiplatattrmacros.H\" could not be opened.");
my $fapiPlatAttrMacrosHeaderFile = *FAPI_PLAT_ATTR_MACROS_FILE;
writeFapiPlatAttrMacrosHeaderFileHeader ($fapiPlatAttrMacrosHeaderFile);
- writeFapiPlatAttrMacrosHeaderFileContent($attributes,$fapiAttributes,$fapiPlatAttrMacrosHeaderFile);
+ writeFapiPlatAttrMacrosHeaderFileContent($attributes,$fapiAttributes,
+ $fapiPlatAttrMacrosHeaderFile);
writeFapiPlatAttrMacrosHeaderFileFooter ($fapiPlatAttrMacrosHeaderFile);
close $fapiPlatAttrMacrosHeaderFile;
@@ -197,7 +201,7 @@ if( !($cfgImgOutputDir =~ "none") )
{
open(PNOR_TARGETING_FILE,">$cfgImgOutputDir".$cfgImgOutputFile)
or fatal ("Targeting image file: \"$cfgImgOutputDir"
- . "$cfgImgOutputFile\" could not be opened.");
+ . "$cfgImgOutputFile\" could not be opened.");
my $pnorFile = *PNOR_TARGETING_FILE;
writeTargetingImage($pnorFile,$cfgVmmConstsFile,$attributes);
close $pnorFile;
@@ -283,6 +287,7 @@ sub validateAttributes {
$elements{"id"} = { required => 1, isscalar => 1};
$elements{"description"} = { required => 1, isscalar => 1};
$elements{"persistency"} = { required => 1, isscalar => 1};
+ $elements{"fspOnly"} = { required => 0, isscalar => 0};
$elements{"readable"} = { required => 0, isscalar => 0};
$elements{"simpleType"} = { required => 0, isscalar => 0};
$elements{"complexType"} = { required => 0, isscalar => 0};
@@ -317,6 +322,24 @@ sub validateFieldElement {
}
################################################################################
+# Validates target type extension elements for correctness
+################################################################################
+
+sub validateTargetTypesExtension {
+ my($attributes) = @_;
+
+ my %elements = ( );
+ $elements{"id"} = { required => 1, isscalar => 1};
+ $elements{"attribute"} = { required => 1, isscalar => 1};
+
+ foreach my $targetTypeExtension (@{$attributes->{targetTypeExtension}})
+ {
+ validateSubElements("targetTypeExtension",1,
+ $targetTypeExtension,\%elements);
+ }
+}
+
+################################################################################
# Validates target type elements for correctness
################################################################################
@@ -327,6 +350,7 @@ sub validateTargetTypes {
$elements{"id"} = { required => 1, isscalar => 1};
$elements{"parent"} = { required => 0, isscalar => 1};
$elements{"attribute"} = { required => 0, isscalar => 0};
+ $elements{"fspOnly"} = { required => 0, isscalar => 0};
foreach my $targetType (@{$attributes->{targetType}})
{
@@ -427,15 +451,21 @@ sub writeFapiPlatAttrMacrosHeaderFileContent {
{
if ($hwpfToHbAttrMap->{macro} ne "DIRECT")
{
- fatal("FAPI non-platInit attr '$hwpfToHbAttrMap->{id}' is '$hwpfToHbAttrMap->{macro}', it must be DIRECT");
+ fatal("FAPI non-platInit attr " .
+ "'$hwpfToHbAttrMap->{id}' is " .
+ "'$hwpfToHbAttrMap->{macro}', " .
+ "it must be DIRECT");
}
- if ($attribute->{persistency} ne "volatile-zeroed")
- {
- fatal("FAPI non-platInit attr '$hwpfToHbAttrMap->{id}' is '$attribute->{persistency}', it must be volatile-zeroed");
- }
+ if ($attribute->{persistency} ne "volatile-zeroed")
+ {
+ fatal("FAPI non-platInit attr " .
+ "'$hwpfToHbAttrMap->{id}' is " .
+ "'$attribute->{persistency}', " .
+ "it must be volatile-zeroed");
+ }
- }
+ }
# All FAPI attributes are readable
$fapiReadable = 1;
@@ -544,6 +574,8 @@ sub writeHeaderFormatHeaderFile {
// STD
#include <builtins.h>
#include <stdint.h>
+#include <targeting/adapters/types.H>
+#include <targeting/common/pointer.H>
// Targeting component
@@ -573,7 +605,7 @@ namespace TARGETING
struct TargetingSection
{
// Type of targeting section
- const SECTION_TYPE sectionType;
+ const SECTION_TYPE sectionType : 8;
// Offset of the section within the PNOR targeting image from byte zero
// of the targeting header
@@ -608,7 +640,7 @@ namespace TARGETING
// Virtual memory base address where the attribute resource provider
// must load the 0th (PNOR RO) section
- void* const vmmBaseAddress;
+ AbstractPointer<void> vmmBaseAddress;
// Size of each TargetingSection record
const uint32_t sizeOfSection;
@@ -659,7 +691,7 @@ sub writeStringImplementationFileHeader {
#include <stdlib.h>
// Targeting component
-#include <targeting/attributes.H>
+#include <targeting/common/attributes.H>
namespace TARGETING {
@@ -696,7 +728,8 @@ sub writeStringImplementationFileStrings {
print $outFile "{\n";
print $outFile " switch(i_attrValue)\n";
print $outFile " {\n";
- my $enumerationType = getEnumerationType($attributes,$enumeration->{id});
+ my $enumerationType = getEnumerationType($attributes,
+ $enumeration->{id});
foreach my $enumerator (@{$enumerationType->{enumerator}})
{
@@ -783,7 +816,9 @@ print $outFile <<VERBATIM;
#include <stdlib.h>
// Targeting component
-#include <targeting/entitypath.H>
+#include <builtins.h>
+#include <targeting/common/attributes.H>
+#include <targeting/common/entitypath.H>
//******************************************************************************
// Complex Types
@@ -1022,6 +1057,8 @@ VERBATIM
my $attrId;
my $hexVal;
+ # Format below intentionally > 80 chars for clarity
+
format ATTRENUMFORMAT =
ATTR_@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< = @<<<<<<<<<<
$attrId, $hexVal .","
@@ -1050,6 +1087,8 @@ sub writeEnumFileAttrEnums {
my $enumName = "";
my $enumHex = "";
+ # Format below intentionally > 80 chars for clarity
+
format ENUMFORMAT =
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< = @<<<<<<<<<<
$enumName, $enumHex .","
@@ -1120,6 +1159,7 @@ print $outFile <<VERBATIM;
// STD
#include <stdint.h>
#include <stdlib.h>
+#include <targeting/common/entitypath.H>
namespace TARGETING
{
@@ -1315,14 +1355,15 @@ VERBATIM
#####
sub writeDumpFile {
my($attributes,$outFile) = @_;
-
+
#First setup the includes and function definition
- print $outFile "#include <targeting/targetservice.H>\n";
+ print $outFile "#include <targeting/common/targetservice.H>\n";
+ print $outFile "#include <targeting/common/trace.H>\n";
print $outFile "#include <stdio.h>\n";
print $outFile "\n";
print $outFile "namespace TARGETING\n";
print $outFile "{\n";
- print $outFile " void dumpAllAttributes( trace_desc_t* i_trac )\n";
+ print $outFile " void dumpAllAttributes( TARG_TD_t i_trac )\n";
print $outFile " {\n";
print $outFile " using namespace TARGETING;\n";
print $outFile "\n";
@@ -1542,6 +1583,16 @@ sub enumSpace {
$maxEnumVal++;
}
my $space = ceil(log($maxEnumVal+1) / (8 * log(2)));
+
+ # NOTE: enable the code below to force the code generator to generated
+ # 4-byte enums instead of optimized enums. Note there are a few
+ # enumerations (primarily in PNOR header, etc.) that do not change size.
+ # That is intentional in order to make this the single point of control over
+ # binary compatibility. Note that both FSP and Hostboot should always have
+ # this policy in sync. Also note that when Hostboot and FSP use optimized
+ # enums, they must also be compiled with -fshort-enums
+ # $space = 4;
+
return $space;
}
@@ -1802,8 +1853,10 @@ sub getAttributeDefault {
# occur if the default element is omitted), then just
# grab the supplied value, otherwise use the default for
# the type
- if( (exists $attribute->{simpleType}->{$type}->{default})
- && (ref ($attribute->{simpleType}->{$type}->{default})
+ if( (exists $attribute->{simpleType}->{$type}->
+ {default})
+ && (ref ($attribute->{simpleType}->{$type}->
+ {default})
ne "HASH") )
{
$default =
@@ -2131,15 +2184,18 @@ sub packComplexType {
# If native "EntityPath" type, process accordingly
if($field->{type} eq "EntityPath")
{
- $binaryData .= packEntityPath($attributes,$default->{value});
+ $binaryData .= packEntityPath($attributes,
+ $default->{value});
}
# If not a defined simple type, process as an enumeration
elsif(!exists $simpleTypeProperties->{$field->{type}})
{
my $enumerationType = getEnumerationType(
$attributes,$field->{type});
- my $enumeratorValue = enumNameToValue($enumerationType,$default->{value});
- $binaryData .= packEnumeration($enumerationType,$enumeratorValue);
+ my $enumeratorValue = enumNameToValue($enumerationType,
+ $default->{value});
+ $binaryData .= packEnumeration($enumerationType,
+ $enumeratorValue);
}
# Pack easy types using 'pack', otherwise invoke appropriate
# (possibly workaround) callback function
@@ -2281,7 +2337,8 @@ sub packSingleSimpleTypeAttribute {
}
# Apply special policy enforcement, if any
- $simpleTypeProperties->{$typeName}{specialPolicies}->($$attributeRef,$value);
+ $simpleTypeProperties->{$typeName}{specialPolicies}->($$attributeRef,
+ $value);
if(ref ($simpleTypeProperties->{$typeName}{packfmt}) eq "CODE")
{
@@ -2347,15 +2404,15 @@ sub packAttribute {
}
# else use the last value
- packSingleSimpleTypeAttribute(\$binaryData, \$attributes,
- \$attribute, $typeName, $val);
+ packSingleSimpleTypeAttribute(\$binaryData,
+ \$attributes, \$attribute, $typeName, $val);
}
}
else
{
# Not an array attribute
- packSingleSimpleTypeAttribute(\$binaryData, \$attributes,
- \$attribute,$typeName, $value);
+ packSingleSimpleTypeAttribute(\$binaryData,
+ \$attributes, \$attribute,$typeName, $value);
}
last;
@@ -2372,7 +2429,8 @@ sub packAttribute {
{
if(ref ($value) eq "HASH" )
{
- $binaryData = packComplexType($attributes,$attribute->{complexType},$value);
+ $binaryData = packComplexType($attributes,$attribute->{complexType},
+ $value);
}
else
{
diff --git a/src/usr/targeting/makefile b/src/usr/targeting/makefile
index 438955284..661d3fbed 100644
--- a/src/usr/targeting/makefile
+++ b/src/usr/targeting/makefile
@@ -20,36 +20,48 @@
# Origin: 30
#
# IBM_PROLOG_END
+
+################################################################################
+#
+# @file src/usr/targeting/makefile
+#
+# @brief Makefile for building Hostboot's targeting implementation
+#
+################################################################################
+
ROOTPATH = ../../..
MODULE = targeting
-VPATH = \
- predicates: \
- iterators:
+COMMON_TARGETING_REL_PATH = common
+COMMON_TARGETING_MAKEFILE = ${COMMON_TARGETING_REL_PATH}/common.mk
-PREDICATES_OBJS = \
- predicatebase.o \
- predicatepostfixexpr.o \
- predicatectm.o \
- predicateisfunctional.o
-
-ITERATORS_OBJS = \
- targetiterator.o \
- rangefilter.o
+include ${COMMON_TARGETING_MAKEFILE}
-TARGET_OBJS = \
- target.o \
- targetservice.o \
- entitypath.o
+VPATH = \
+ adapters \
+ ${COMMON_TARGETING_REL_PATH} \
+ ${addprefix ${COMMON_TARGETING_REL_PATH}/, ${COMMON_TARGETING_SUBDIRS}}
ATTR_RP_OBJS = \
attrrp.o
-OTHER_OBJS = \
- util.o
+ENTRY_POINT_OBJS = \
+ targetservicestart.o
+
+DEBUG_OBJS = \
+ attributestrings.o \
+ attributedump.o
-OBJS = ${TARGET_OBJS} ${PREDICATES_OBJS} ${ITERATORS_OBJS} ${ATTR_RP_OBJS} ${OTHER_OBJS}
-OBJS += attributestrings.o attributedump.o
+HOSTBOOT_SPECIFIC_OBJS = ${ENTRY_POINT_OBJS} ${ATTR_RP_OBJS} ${DEBUG_OBJS}
+
+#debug :
+# @echo COMMON_TARGETING_REL_PATH = ${COMMON_TARGETING_REL_PATH}
+# @echo COMMON_TARGETING_MAKEFILE = ${COMMON_TARGETING_MAKEFILE}
+# @echo COMMON_TARGETING_SUBDIRS = ${COMMON_TARGETING_SUBDIRS}
+# @echo VPATH = ${VPATH}
+# @echo COMMON_TARGETING_OBJS = ${COMMON_TARGETING_OBJS}
+
+OBJS = ${COMMON_TARGETING_OBJS} ${HOSTBOOT_SPECIFIC_OBJS}
SUBDIRS = test.d xmltohb.d
diff --git a/src/usr/targeting/targetservicestart.C b/src/usr/targeting/targetservicestart.C
new file mode 100644
index 000000000..d010f0e1e
--- /dev/null
+++ b/src/usr/targeting/targetservicestart.C
@@ -0,0 +1,105 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/usr/targeting/targetservicestart.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 targeting/targetservicestart.C
+ *
+ * @brief Hostboot entry point for target service
+ */
+
+//******************************************************************************
+// Includes
+//******************************************************************************
+
+// STD
+#include <stdio.h>
+#include <stdlib.h>
+
+// Other components
+#include <sys/task.h>
+#include <targeting/common/trace.H>
+#include <targeting/adapters/assertadapter.H>
+#include <initservice/taskargs.H>
+
+// This component
+#include <targeting/common/targetservice.H>
+#include <targeting/attrrp.H>
+
+//******************************************************************************
+// targetService
+//******************************************************************************
+
+namespace TARGETING
+{
+
+#define TARG_NAMESPACE "TARGETING::"
+
+#define TARG_LOC TARG_NAMESPACE TARG_CLASS TARG_FN ": "
+
+//******************************************************************************
+// _start
+//******************************************************************************
+
+#define TARG_CLASS ""
+
+/**
+ * @brief Entry point for initialization service to initialize the targeting
+ * code
+ *
+ * @param[in] io_pError
+ * Error log handle; returns NULL on success, !NULL otherwise
+ *
+ * @note: Link register is configured to automatically invoke task_end() when
+ * this routine returns
+ */
+static void initTargeting(errlHndl_t& io_pError)
+{
+ #define TARG_FN "initTargeting(errlHndl_t& io_pError)"
+
+ TARG_ENTER();
+
+ AttrRP::init(io_pError);
+
+ if (io_pError == NULL)
+ {
+ TargetService& l_targetService = targetService();
+ (void)l_targetService.init();
+ }
+
+ TARG_EXIT();
+
+ #undef TARG_FN
+}
+
+/**
+ * @brief Create _start entry point using task entry macro and vector to
+ * initTargeting function
+ */
+TASK_ENTRY_MACRO(initTargeting);
+
+#undef TARG_CLASS
+
+#undef TARG_NAMESPACE
+
+} // End namespace TARGETING
+
diff --git a/src/usr/targeting/test/makefile b/src/usr/targeting/test/makefile
index 4e51e8849..dc33093bc 100644
--- a/src/usr/targeting/test/makefile
+++ b/src/usr/targeting/test/makefile
@@ -20,22 +20,64 @@
# Origin: 30
#
# IBM_PROLOG_END
+
+################################################################################
+#
+# @file src/usr/targeting/test/makefile
+#
+# @brief Makefile for building Hostboot's targeting test dir
+#
+################################################################################
+
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
+# Determine relative paths to common targeting makefile
+
+COMMON_TARGETING_REL_PATH = ../common
+COMMON_MAKEFILE = ${COMMON_TARGETING_REL_PATH}/test/common.mk
+
+# Suck in the common targeting makefile, verbatim
+
+include ${COMMON_MAKEFILE}
+
+# Defines from the common makefile included above:
+# - COMMON_TESTCASES (name of common testcase .H's)
+# - HWPF_INC_DIRS (subdirs of HWPF to look for includes)
-# Allow testcase to access component trace macros
-EXTRAINCDIR += ../
+# Point "make" to find sources and includes in the common and platform
+# specific trees
+
+VPATH += ${COMMON_TARGETING_REL_PATH}/test
+
+HWPF_REL_PATH = ${ROOTPATH}/src/include/usr/hwpf
+
+EXTRAINCDIR += \
+ $(addprefix ${HWPF_REL_PATH}/, ${HWPF_INC_DIRS}) \
+ ${ROOTPATH}/src/include/usr/ecmddatabuffer \
+ ../
+
+# Generate the test suite
MODULE = testtargeting
-TESTS = *.H
-OBJS = attributestrings.o
+COMMON_TESTCASE_REL_PATHS = \
+ $(addprefix ${COMMON_TARGETING_REL_PATH}/test/,${COMMON_TESTCASES})
+
+TESTS = testtargeting.H ${COMMON_TESTCASE_REL_PATHS}
+
+OBJS = attributestrings.o
+
+#debug :
+# @echo EXTRAINCDIR = ${EXTRAINCDIR}
+# @echo COMMON_TARGETING_REL_PATH = ${COMMON_TARGETING_REL_PATH}
+# @echo COMMON_MAKEFILE = ${COMMON_MAKEFILE}
+# @echo VPATH = ${VPATH}
+# @echo INCLUDES = ${INCLUDES}
+# @echo COMMON_TESTCASE_REL_PATHS = ${COMMON_TESTCASE_REL_PATHS}
+# @echo COMMON_TESTCASES = ${COMMON_TESTCASES}
+# @echo HWPF_INC_DIRS = ${HWPF_INC_DIRS}
+# @echo TESTS = ${TESTS}
include ${ROOTPATH}/config.mk
vpath %.C ${GENDIR}
-
diff --git a/src/usr/targeting/test/testtargeting.H b/src/usr/targeting/test/testtargeting.H
new file mode 100644
index 000000000..a3c6232ea
--- /dev/null
+++ b/src/usr/targeting/test/testtargeting.H
@@ -0,0 +1,245 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/usr/targeting/test/testtargeting.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
+
+#ifndef __TARGETING_TESTTARGETING_H
+#define __TARGETING_TESTTARGETING_H
+
+/**
+ * @file targeting/test/testtargeting.H
+ *
+ * @brief All unit tests which test targeting in a platform specific way
+ */
+
+//******************************************************************************
+// 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>
+#include <sys/sync.h>
+#include <sys/task.h>
+#include <sys/time.h>
+
+// This component
+#include <targeting/common/attributes.H>
+#include <targeting/common/entitypath.H>
+#include <targeting/common/target.H>
+#include <targeting/common/targetservice.H>
+#include <targeting/common/iterators/rangefilter.H>
+#include <targeting/common/predicates/predicatectm.H>
+#include <targeting/common/predicates/predicatepostfixexpr.H>
+#include <targeting/common/targreasoncodes.H>
+#include <errl/errludtarget.H>
+#include <targeting/common/trace.H>
+#include <kernel/console.H>
+
+/**
+ * @brief Struct to hold pointers to a mutex / protected value
+ */
+struct MutexTestData_t
+{
+ mutex_t* pMutex; // Pointer to mutex
+ barrier_t* pBarrier; // Pointer to barrier
+ volatile uint32_t* pVar; // Pointer to value protected by mutex
+};
+
+/**
+ * @brief Function which attempts to write a protected variable
+ *
+ * @param[in] i_pData Pointer to mutex pointer/value pointer structure
+ *
+ * @return N/A
+ */
+void funcTestMutex(void* i_pData)
+{
+ MutexTestData_t* l_pData = static_cast<MutexTestData_t*>(i_pData);
+ barrier_wait(l_pData->pBarrier);
+ mutex_lock(l_pData->pMutex);
+ *(l_pData->pVar) = 1;
+ mutex_unlock(l_pData->pMutex);
+ barrier_wait(l_pData->pBarrier);
+ task_end();
+}
+
+class TargetingTestSuite : public CxxTest::TestSuite
+{
+ public:
+
+ /**
+ * @brief Test Hostboot specific mutex attribute support
+ */
+ void testHbMutexAttr()
+ {
+ TS_TRACE(ENTER_MRK "testHbMutexAttr" );
+
+ using namespace TARGETING;
+ using namespace fapi;
+
+ do {
+
+ // Get a reference to the target service
+ TargetService& l_targetService = targetService();
+
+ // Get the system target containing the test mutex
+ TARGETING::Target* l_pTarget = NULL;
+ (void) l_targetService.getTopLevelTarget(l_pTarget);
+ if (l_pTarget == NULL)
+ {
+ TS_FAIL("Top level target handle is NULL");
+ break;
+ }
+
+ // Get the mutex attribute (actually a mutex_t* which points to
+ // a mutex)
+ HB_MUTEX_TEST_LOCK_ATTR l_pLock
+ = l_pTarget->getHbMutexAttr<TARGETING::ATTR_HB_MUTEX_TEST_LOCK>();
+
+ // Test: Verify the value pointed to by the mutex_t* is zero
+ if ( (*reinterpret_cast<uint64_t*>(l_pLock)) != 0)
+ {
+ TS_FAIL("Mutex attribute must be initialized to zero, but got %ld",
+ *reinterpret_cast<uint64_t*>(l_pLock));
+ break;
+ }
+
+ // Try to get the attribute, and ensure it's the same
+ HB_MUTEX_TEST_LOCK_ATTR l_pLockTry = NULL;
+ if(l_pTarget->tryGetHbMutexAttr<TARGETING::ATTR_HB_MUTEX_TEST_LOCK>
+ (l_pLockTry))
+ {
+ if(l_pLockTry != l_pLock)
+ {
+ TS_FAIL("Mutex attributes should match, but dont. "
+ "l_pLockTry = %ld, l_pLock = %ld",l_pLockTry,
+ l_pLock);
+ break;
+ }
+ }
+ else
+ {
+ TS_FAIL("Mutex attribute tryGet failed, even though it exists");
+ break;
+ }
+
+ // Create a structue holding pointers to the mutex and a protected value
+ volatile uint32_t l_var = 0;
+ (void)mutex_lock(l_pLock);
+ barrier_t l_barrier;
+ (void)barrier_init(&l_barrier, 2);
+ MutexTestData_t l_mutexTestData = { l_pLock, &l_barrier, &l_var };
+
+ // Spawn off a function which tries to write the protected value to
+ // something unexpected. If the mutex is working, the for loop will
+ // always poll the expected value.
+ task_create(funcTestMutex, static_cast<void*>(&l_mutexTestData));
+
+ // Guarantee the child process runs and blocks on the mutex prior to
+ // modifying the protected value. isync to ensure the processor doesn't
+ // speculatively perform the comparison prior to the sleep completing
+ barrier_wait(&l_barrier);
+ nanosleep(0,TEN_CTX_SWITCHES_NS); isync();
+
+ if(l_var != 0)
+ {
+ TS_FAIL("Protected value must be 0, was %d instead",l_var);
+ break;
+ }
+
+ // Now unlock the mutex, allowing the other thread to overwrite the
+ // protected value; which should happen within 100,000 reads of the
+ // var. This will confirm the other thread was actively trying to
+ // write the controlled value
+ (void)mutex_unlock(l_pLock);
+
+ // Guarantee the child process acquires the mutex and modifies the
+ // protected value.
+ barrier_wait(&l_barrier);
+
+ if(l_var != 1)
+ {
+ TS_FAIL("Protected value must now be 1, was %d instead",l_var);
+ break;
+ }
+
+ barrier_destroy(&l_barrier);
+
+ } while(0);
+
+ TS_TRACE(EXIT_MRK "testHbMutexAttr");
+ }
+
+ /**
+ * @brief Test Hostboot specific error target FFDC support
+ */
+ void testErrlTargetFFDC()
+ {
+ TS_TRACE(ENTER_MRK "testErrlTargetFFDC" );
+
+ using namespace ERRORLOG;
+ using namespace TARGETING;
+ using namespace fapi;
+
+ // Get a reference to the target service
+ TargetService& l_service = targetService();
+
+ // Get the master proc target
+ TARGETING::Target* l_pTarget1 = NULL;
+ TARGETING::Target* l_pTarget2 = MASTER_PROCESSOR_CHIP_TARGET_SENTINEL;
+ l_service.masterProcChipTargetHandle( l_pTarget1);
+
+ // Create an errorlog to test FFDC capture of targets
+ /*@
+ * @errortype
+ * @severity ERRORLOG_SEV_INFORMATIONAL
+ * @moduleid TARG_MOD_TEST
+ * @reasoncode TARG_RC_TEST_TARGET_FFDC
+ * @userdata1 Test data 1
+ * @userdata2 Test data 2
+ * @devdesc User Details unit test - create target user detail data
+ */
+ errlHndl_t l_err;
+ l_err = new ErrlEntry(ERRL_SEV_INFORMATIONAL,
+ TARG_MOD_TEST,
+ TARG_RC_TEST_TARGET_FFDC,
+ 0x0011223344556677,
+ 0x8899aabbccddeeff);
+
+ ErrlUserDetailsTarget(l_pTarget1).addToLog(l_err);
+ ErrlUserDetailsTarget(l_pTarget2).addToLog(l_err);
+
+ errlCommit(l_err, TARG_COMP_ID);
+
+ TS_TRACE(EXIT_MRK "testErrlTargetFFDC");
+ }
+};
+
+#endif // End __TARGETING_TESTTARGETING_H
diff --git a/src/usr/targeting/test/unittestadapter.H b/src/usr/targeting/test/unittestadapter.H
new file mode 100644
index 000000000..781b837e5
--- /dev/null
+++ b/src/usr/targeting/test/unittestadapter.H
@@ -0,0 +1,45 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/usr/targeting/test/unittestadapter.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
+
+#ifndef _TARGETING_UNITTESTADAPTER_H
+#define _TARGETING_UNITTESTADAPTER_H
+
+/**
+ * @file targeting/test/unittestadapter.H
+ *
+ * @brief Header file which pulls in platform specific CXX testcase headers
+ */
+
+//******************************************************************************
+// Includes
+//******************************************************************************
+
+#include <cxxtest/TestSuite.H>
+
+// Just forward common API call to platform specific call
+#define TARG_TS_TRACE TS_TRACE
+
+// Just forward common API call to platform specific call
+#define TARG_TS_FAIL TS_FAIL
+
+#endif // _TARGETING_UNITTESTADAPTER_H
diff --git a/src/usr/targeting/xmltohb/makefile b/src/usr/targeting/xmltohb/makefile
index 502798273..229e64b7d 100644
--- a/src/usr/targeting/xmltohb/makefile
+++ b/src/usr/targeting/xmltohb/makefile
@@ -21,54 +21,60 @@
#
# IBM_PROLOG_END
+################################################################################
+#
+# @file targeting/xmltohb/makefile
+#
+# @brief Makefile for building Hostboot's xmltohb dir
+#
+################################################################################
+
ROOTPATH = ../../../..
-XMLTOHB_HEADER_TARGETS = \
- attributeenums.H \
- attributestrings.H \
- attributetraits.H \
- attributestructs.H \
- pnortargeting.H \
- fapiplatattrmacros.H
+# Point to the common targeting makefile for xmltohb
+COMMON_XMLTOHB_DIR = xmltohb
+COMMON_TARGETING_PATH_PREFIX = ../common
+COMMON_TARGETING_REL_PATH = \
+ ${COMMON_TARGETING_PATH_PREFIX}/${COMMON_XMLTOHB_DIR}
+COMMON_TARGETING_MAKEFILE = \
+ ${COMMON_TARGETING_REL_PATH}/common.mk
-XMLTOHB_SOURCE_TARGETS = \
- attributedump.C \
- attributestrings.C
+# Include the common targeting makefile for xmltohb verbatim
+include ${COMMON_TARGETING_MAKEFILE}
-XMLTOHB_SYSTEM_BINARIES = \
- vbu_targeting.bin \
- simics_VENICE_targeting.bin \
- simics_MURANO_targeting.bin \
- TULETA_targeting.bin
+XMLTOHB_SYSTEM_BINARIES += TULETA_targeting.bin
-XMLTOHB_TARGETS = \
- ${XMLTOHB_HEADER_TARGETS} \
- ${XMLTOHB_SOURCE_TARGETS}
+VPATH = ${COMMON_TARGETING_REL_PATH}
-XMLTOHB_GENERIC_SOURCES = attribute_types.xml target_types.xml
+FAPI_ATTR_SOURCE_DIR = ${ROOTPATH}/src/usr/hwpf/hwp
XMLTOHB_FAPIATTR_SOURCES = \
- ${ROOTPATH}/src/usr/hwpf/hwp/memory_attributes.xml \
- ${ROOTPATH}/src/usr/hwpf/hwp/L2_L3_attributes.xml \
- ${ROOTPATH}/src/usr/hwpf/hwp/scratch_attributes.xml \
- ${ROOTPATH}/src/usr/hwpf/hwp/system_attributes.xml \
- ${ROOTPATH}/src/usr/hwpf/hwp/chip_attributes.xml \
- ${ROOTPATH}/src/usr/hwpf/hwp/dimm_spd_attributes.xml \
- ${ROOTPATH}/src/usr/hwpf/hwp/dimm_attributes.xml \
- ${ROOTPATH}/src/usr/hwpf/hwp/unit_attributes.xml \
- ${ROOTPATH}/src/usr/hwpf/hwp/freq_attributes.xml \
- ${ROOTPATH}/src/usr/hwpf/hwp/proc_mvpd_attributes.xml
+ ${addprefix ${FAPI_ATTR_SOURCE_DIR}/, ${FAPI_ATTR_SOURCES}}
VMM_CONSTS_FILE = \
${ROOTPATH}/src/include/usr/vmmconst.h
-GENFILES = ${XMLTOHB_TARGETS}
-
+GENFILES = ${XMLTOHB_TARGETS}
+
+#debug :
+# @echo COMMON_TARGETING_PATH_PREFIX = ${COMMON_TARGETING_PATH_PREFIX}
+# @echo COMMON_TARGETING_REL_PATH = ${COMMON_TARGETING_REL_PATH}
+# @echo COMMON_TARGETING_MAKEFILE = ${COMMON_TARGETING_MAKEFILE}
+# @echo XMLTOHB_HEADER_TARGETS = ${XMLTOHB_HEADER_TARGETS}
+# @echo XMLTOHB_SOURCE_TARGETS = ${XMLTOHB_SOURCE_TARGETS}
+# @echo XMLTOHB_SYSTEM_BINARIES = ${XMLTOHB_SYSTEM_BINARIES}
+# @echo XMLTOHB_TARGETS = ${XMLTOHB_TARGETS}
+# @echo XMLTOHB_GENERIC_SOURCES = ${XMLTOHB_GENERIC_SOURCES}
+# @echo FAPI_ATTR_SOURCES = ${FAPI_ATTR_SOURCES}
+# @echo FAPI_ATTR_SOURCE_DIR = ${FAPI_ATTR_SOURCE_DIR}
+# @echo XMLTOHB_FAPIATTR_SOURCES = ${XMLTOHB_FAPIATTR_SOURCES}
+# @echo VPATH = ${VPATH}
+
EXTRA_PARTS = $(addprefix $(IMGDIR)/, $(XMLTOHB_SYSTEM_BINARIES))
EXTRA_CLEAN = $(addprefix $(GENDIR)/, ${XMLTOHB_SYSTEM_BINARIES}) \
- $(addprefix $(GENDIR)/, ${XMLTOHB_SYSTEM_BINARIES:.bin=.xml}) \
- ${GENDIR}/generic.xml ${GENDIR}/fapiattrs.xml
+ $(addprefix $(GENDIR)/, ${XMLTOHB_SYSTEM_BINARIES:.bin=.xml}) \
+ ${GENDIR}/${XMLTOHB_GENERIC_XML} ${GENDIR}/${XMLTOHB_FAPI_XML}
include ${ROOTPATH}/config.mk
@@ -79,31 +85,35 @@ ${EXTRA_PARTS}: ${IMGDIR}/% : ${GENDIR}/%
cp -f $^ $@
# generic XML is created from the generic sources only
-${GENDIR}/generic.xml: ${XMLTOHB_GENERIC_SOURCES}
- ./mergexml.sh $^ > $@
+${GENDIR}/${XMLTOHB_GENERIC_XML}: \
+ ${XMLTOHB_MERGE_SCRIPT} ${XMLTOHB_GENERIC_SOURCES}
+ $< $^ > $@
# merge all FAPI attribute files into one
-${GENDIR}/fapiattrs.xml: ${XMLTOHB_FAPIATTR_SOURCES}
- ./mergexml.sh $^ > $@
+${GENDIR}/${XMLTOHB_FAPI_XML}: ${XMLTOHB_MERGE_SCRIPT} \
+ ${XMLTOHB_FAPIATTR_SOURCES}
+ $< $^ > $@
# create the header files, only needs generic xml
$(call GENTARGET,$(XMLTOHB_TARGETS)) : \
- xmltohb.pl ${GENDIR}/generic.xml ${GENDIR}/fapiattrs.xml
- ./$< $(addprefix --hb-xml-file=,${GENDIR}/generic.xml) \
- $(addprefix --fapi-attributes-xml-file=,${GENDIR}/fapiattrs.xml) \
- --src-output-dir=$(dir $@) --img-output-dir=none \
- --img-output-file=none
+ ${XMLTOHB_COMPILER_SCRIPT} ${GENDIR}/${XMLTOHB_GENERIC_XML} \
+ ${GENDIR}/${XMLTOHB_FAPI_XML}
+ $< $(addprefix --hb-xml-file=,${GENDIR}/${XMLTOHB_GENERIC_XML}) \
+ $(addprefix --fapi-attributes-xml-file=,${GENDIR}/${XMLTOHB_FAPI_XML}) \
+ --src-output-dir=$(dir $@) --img-output-dir=none \
+ --img-output-file=none
# system-specific XML needs the generic plus the xxx.system.xml file + the
# MRW file
${GENDIR}/%.hb.xml: %.system.xml ${XMLTOHB_GENERIC_SOURCES} %.mrw.xml
- ./mergexml.sh $^ > $@
+ ${COMMON_TARGETING_REL_PATH}/${XMLTOHB_MERGE_SCRIPT} $^ > $@
# create the binary files
-${GENDIR}/%_targeting.bin: xmltohb.pl ${GENDIR}/%.hb.xml ${GENDIR}/fapiattrs.xml ${VMM_CONSTS_FILE}
- ./$< $(addprefix --hb-xml-file=,${GENDIR}/$*.hb.xml) \
- $(addprefix --fapi-attributes-xml-file=,${GENDIR}/fapiattrs.xml) \
- --src-output-dir=none --img-output-dir=$(dir $@) \
- --img-output-file=$(notdir $@) \
+${GENDIR}/%_targeting.bin: ${XMLTOHB_COMPILER_SCRIPT} ${GENDIR}/%.hb.xml \
+ ${GENDIR}/${XMLTOHB_FAPI_XML} ${VMM_CONSTS_FILE}
+ $< $(addprefix --hb-xml-file=,${GENDIR}/$*.hb.xml) \
+ $(addprefix --fapi-attributes-xml-file=,${GENDIR}/${XMLTOHB_FAPI_XML}) \
+ --src-output-dir=none --img-output-dir=$(dir $@) \
+ --img-output-file=$(notdir $@) \
--vmm-consts-file=$(VMM_CONSTS_FILE)
diff --git a/src/usr/testcore/kernel/vmmbasetest.H b/src/usr/testcore/kernel/vmmbasetest.H
index 5c64eea40..153b6c461 100644
--- a/src/usr/testcore/kernel/vmmbasetest.H
+++ b/src/usr/testcore/kernel/vmmbasetest.H
@@ -33,7 +33,7 @@
#include <arch/ppc.H>
#include <sys/mm.h>
#include <usr/vmmconst.h>
-#include <targeting/util.H>
+#include <targeting/common/util.H>
class VmmBaseTest : public CxxTest::TestSuite
{
diff --git a/src/usr/xscom/xscom.C b/src/usr/xscom/xscom.C
index 9ee6222f2..8e27e53d6 100644
--- a/src/usr/xscom/xscom.C
+++ b/src/usr/xscom/xscom.C
@@ -38,7 +38,7 @@
#include <trace/interface.H>
#include <errl/errlentry.H>
#include <errl/errlmanager.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/targetservice.H>
#include <xscom/xscomreasoncodes.H>
#include "xscom.H"
#include <assert.h>
OpenPOWER on IntegriCloud