summaryrefslogtreecommitdiffstats
path: root/src/usr/targeting
diff options
context:
space:
mode:
authorNick Bofferding <bofferdn@us.ibm.com>2012-04-17 22:30:59 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-04-24 15:48:42 -0500
commit4157b5631a1bbfcc7f9f95480b54e9ade7abce7d (patch)
tree423f4f13a4a0e2d6e76898992a37b4d2db302b3b /src/usr/targeting
parent5631ede5d2e63fa8585505eb29c6d86f420c9344 (diff)
downloadtalos-hostboot-4157b5631a1bbfcc7f9f95480b54e9ade7abce7d.tar.gz
talos-hostboot-4157b5631a1bbfcc7f9f95480b54e9ade7abce7d.zip
Support targeting code commonality
- Moved common targeting code to own subtrees - Updated many components with header file changes - Implemented abstract pointer class - Implemented Hostboot specific support for targeting commonality - Changed attribute VMM base address to 4 GB (From 3 GB) - Removed tabs, fixed > 80 character lines Change-Id: Ie5a6956670bfa4f262f7691b4f0ce5a20ed289fe RTC: 35569 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/909 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/targeting')
-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/trace.H67
-rw-r--r--src/usr/targeting/xmltohb/makefile106
34 files changed, 1304 insertions, 849 deletions
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/trace.H b/src/usr/targeting/trace.H
deleted file mode 100644
index 15eebeff1..000000000
--- a/src/usr/targeting/trace.H
+++ /dev/null
@@ -1,67 +0,0 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/usr/targeting/trace.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 TARG_TRACE_H
-#define TARG_TRACE_H
-
-/**
- * @file trace.H
- *
- * @brief Targeting related trace macros. Callers of these macros must
- * define TARG_NAMESPACE, TARG_CLASS, and TARG_FN as appropriate
- */
-
-//******************************************************************************
-// Includes
-//******************************************************************************
-
-// Other Components
-#include <trace/interface.H>
-
-// Give callers access to the trace buffer
-namespace TARGETING
-{
- extern trace_desc_t* g_trac_targeting;
-}
-
-#define TARG_LOC TARG_NAMESPACE TARG_CLASS TARG_FN ": "
-
-#define TARG_TAG "[TARG]"
-#define TARG_ENTER(args...) \
- 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 \
- TARG_CLASS TARG_FN " " args)
-
-#define TARG_ERR(args...) \
- TRACFCOMP(TARGETING::g_trac_targeting,TARG_TAG " " ERR_MRK " " args)
-
-#define TARG_INF(args...) \
- TRACFCOMP(TARGETING::g_trac_targeting,TARG_TAG " " INFO_MRK " " args)
-
-#define TARG_BIN(args...) \
- TRACFBIN(TARGETING::g_trac_targeting,TARG_TAG " " args)
-
-#endif // TARG_TRACE_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)
OpenPOWER on IntegriCloud