summaryrefslogtreecommitdiffstats
path: root/src/include/usr
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/include/usr
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/include/usr')
-rw-r--r--src/include/usr/devicefw/driverif.H2
-rw-r--r--src/include/usr/devicefw/userif.H2
-rw-r--r--src/include/usr/diag/mdia/mdia.H2
-rwxr-xr-xsrc/include/usr/diag/prdf/prdf_proto.H2
-rw-r--r--src/include/usr/hwas/deconfigGard.H3
-rw-r--r--src/include/usr/hwas/hwasCommon.H4
-rwxr-xr-xsrc/include/usr/hwpf/plat/fapiPlatAttributeService.H3
-rw-r--r--src/include/usr/targeting/adapters/assertadapter.H60
-rw-r--r--src/include/usr/targeting/adapters/erroradapter.H60
-rw-r--r--src/include/usr/targeting/adapters/traceadapter.H56
-rw-r--r--src/include/usr/targeting/adapters/types.H65
-rw-r--r--src/include/usr/targeting/attrrp.H216
-rw-r--r--src/include/usr/targeting/common/attributes.H (renamed from src/include/usr/targeting/attributes.H)13
-rw-r--r--src/include/usr/targeting/common/commontargeting.H45
-rw-r--r--src/include/usr/targeting/common/entitypath.H (renamed from src/include/usr/targeting/entitypath.H)16
-rw-r--r--src/include/usr/targeting/common/error.H40
-rw-r--r--src/include/usr/targeting/common/iterators/iterators.H39
-rw-r--r--src/include/usr/targeting/common/iterators/rangefilter.H (renamed from src/include/usr/targeting/iterators/rangefilter.H)26
-rw-r--r--src/include/usr/targeting/common/iterators/targetiterator.H (renamed from src/include/usr/targeting/iterators/targetiterator.H)8
-rw-r--r--src/include/usr/targeting/common/pointer.H85
-rw-r--r--src/include/usr/targeting/common/predicates/predicatebase.H (renamed from src/include/usr/targeting/predicates/predicatebase.H)8
-rw-r--r--src/include/usr/targeting/common/predicates/predicatectm.H (renamed from src/include/usr/targeting/predicates/predicatectm.H)19
-rw-r--r--src/include/usr/targeting/common/predicates/predicateisfunctional.H (renamed from src/include/usr/targeting/predicates/predicateisfunctional.H)26
-rw-r--r--src/include/usr/targeting/common/predicates/predicatepostfixexpr.H (renamed from src/include/usr/targeting/predicates/predicatepostfixexpr.H)23
-rw-r--r--src/include/usr/targeting/common/predicates/predicates.H (renamed from src/include/usr/targeting/predicates/predicates.H)17
-rw-r--r--src/include/usr/targeting/common/target.H (renamed from src/include/usr/targeting/target.H)34
-rw-r--r--src/include/usr/targeting/common/targetservice.H (renamed from src/include/usr/targeting/targetservice.H)40
-rw-r--r--src/include/usr/targeting/common/targreasoncodes.H54
-rw-r--r--src/include/usr/targeting/common/trace.H65
-rw-r--r--src/include/usr/targeting/common/util.H (renamed from src/include/usr/targeting/util.H)35
-rw-r--r--src/include/usr/targeting/targreasoncodes.H46
-rw-r--r--src/include/usr/vmmconst.h6
32 files changed, 958 insertions, 162 deletions
diff --git a/src/include/usr/devicefw/driverif.H b/src/include/usr/devicefw/driverif.H
index 74843e4f4..b17515abc 100644
--- a/src/include/usr/devicefw/driverif.H
+++ b/src/include/usr/devicefw/driverif.H
@@ -33,7 +33,7 @@
#include <devicefw/userif.H>
#include <stdarg.h>
#include <builtins.h>
-#include <targeting/targetservice.H>
+#include <targeting/common/targetservice.H>
namespace DeviceFW
{
diff --git a/src/include/usr/devicefw/userif.H b/src/include/usr/devicefw/userif.H
index acd5d5ada..4c7a116dd 100644
--- a/src/include/usr/devicefw/userif.H
+++ b/src/include/usr/devicefw/userif.H
@@ -33,7 +33,7 @@
#include <stdint.h>
#include <errl/errlentry.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/targetservice.H>
namespace DeviceFW
{
diff --git a/src/include/usr/diag/mdia/mdia.H b/src/include/usr/diag/mdia/mdia.H
index 45543d524..59a7132be 100644
--- a/src/include/usr/diag/mdia/mdia.H
+++ b/src/include/usr/diag/mdia/mdia.H
@@ -24,7 +24,7 @@
#define __MDIA_MDIA_H
#include <errl/errlentry.H>
-#include <targeting/target.H>
+#include <targeting/common/target.H>
/**
* @file mdia.H
diff --git a/src/include/usr/diag/prdf/prdf_proto.H b/src/include/usr/diag/prdf/prdf_proto.H
index 535435ed9..6edb2307a 100755
--- a/src/include/usr/diag/prdf/prdf_proto.H
+++ b/src/include/usr/diag/prdf/prdf_proto.H
@@ -38,7 +38,7 @@
#include <stdint.h>
#include <errl/errlentry.H>
-#include <targeting/target.H>
+#include <targeting/common/target.H>
namespace PRDF
{
diff --git a/src/include/usr/hwas/deconfigGard.H b/src/include/usr/hwas/deconfigGard.H
index 4a7b1cd3c..c3208e71e 100644
--- a/src/include/usr/hwas/deconfigGard.H
+++ b/src/include/usr/hwas/deconfigGard.H
@@ -35,8 +35,7 @@
#include <sys/sync.h>
#include <util/singleton.H>
#include <errl/errlentry.H>
-#include <targeting/target.H>
-#include <targeting/entitypath.H>
+#include <targeting/common/attributes.H>
namespace HWAS
{
diff --git a/src/include/usr/hwas/hwasCommon.H b/src/include/usr/hwas/hwasCommon.H
index 100113827..f6d5ce566 100644
--- a/src/include/usr/hwas/hwasCommon.H
+++ b/src/include/usr/hwas/hwasCommon.H
@@ -33,8 +33,8 @@
// 'system' headers
#include <stdint.h>
#include <errl/errlentry.H>
-#include <targeting/target.H>
-#include <targeting/targetservice.H>
+#include <targeting/common/target.H>
+#include <targeting/common/targetservice.H>
// platform specific headers
diff --git a/src/include/usr/hwpf/plat/fapiPlatAttributeService.H b/src/include/usr/hwpf/plat/fapiPlatAttributeService.H
index f94e5dd4f..254dfd36e 100755
--- a/src/include/usr/hwpf/plat/fapiPlatAttributeService.H
+++ b/src/include/usr/hwpf/plat/fapiPlatAttributeService.H
@@ -46,8 +46,7 @@
#include <stdint.h>
#include <fapiAttributeIds.H>
-#include <targeting/target.H>
-#include <targeting/attributes.H>
+#include <targeting/common/attributes.H>
#include <attributeenums.H>
#include <fapiplatattrmacros.H>
#include <hwpf/fapi/fapiReturnCode.H>
diff --git a/src/include/usr/targeting/adapters/assertadapter.H b/src/include/usr/targeting/adapters/assertadapter.H
new file mode 100644
index 000000000..6a61f46c1
--- /dev/null
+++ b/src/include/usr/targeting/adapters/assertadapter.H
@@ -0,0 +1,60 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/targeting/adapters/assertadapter.H $
+//
+// IBM CONFIDENTIAL
+//
+// COPYRIGHT International Business Machines Corp. 2012
+//
+// p1
+//
+// Object Code Only (OCO) source materials
+// Licensed Internal Code Source Materials
+// IBM HostBoot Licensed Internal Code
+//
+// The source code for this program is not published or other-
+// wise divested of its trade secrets, irrespective of what has
+// been deposited with the U.S. Copyright Office.
+//
+// Origin: 30
+//
+// IBM_PROLOG_END
+
+#ifndef __TARGETING_ASSERTADAPTER_H
+#define __TARGETING_ASSERTADAPTER_H
+
+/**
+ * @file targeting/adapters/assertadapter.H
+ * @brief Forward common targeting assert requests to the platform specific
+ * handlers
+ *
+ * There are two different assert types provided:
+ * Standard assert behavior:
+ * assert(foo)
+ *
+ * Standard assert behavior with a custom trace message:
+ * assert(foo, "This is a trace %d", 1234)
+ */
+
+//******************************************************************************
+// Includes
+//******************************************************************************
+
+#include <assert.h>
+
+/**
+ * @brief Forward common targeting assert requests to platform specific handler
+ *
+ * @par Detailed Description:
+ * Forwards assert request to platform specific assert macro which verifies
+ * condition, calls custom trace if provided, and ultimately calls platform
+ * assert
+ *
+ * @param[in] expr,...
+ * Printf-like expression to act as the assert message
+ */
+#define TARG_ASSERT(expr,...) \
+ assert(expr,__VA_ARGS__)
+
+#endif // __TARGETING_ASSERTADAPTER_H
diff --git a/src/include/usr/targeting/adapters/erroradapter.H b/src/include/usr/targeting/adapters/erroradapter.H
new file mode 100644
index 000000000..c9df881b6
--- /dev/null
+++ b/src/include/usr/targeting/adapters/erroradapter.H
@@ -0,0 +1,60 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/targeting/adapters/erroradapter.H $
+//
+// IBM CONFIDENTIAL
+//
+// COPYRIGHT International Business Machines Corp. 2012
+//
+// p1
+//
+// Object Code Only (OCO) source materials
+// Licensed Internal Code Source Materials
+// IBM HostBoot Licensed Internal Code
+//
+// The source code for this program is not published or other-
+// wise divested of its trade secrets, irrespective of what has
+// been deposited with the U.S. Copyright Office.
+//
+// Origin: 30
+//
+// IBM_PROLOG_END
+
+#ifndef __TARGETING_ERRORADAPTER_H
+#define __TARGETING_ERRORADAPTER_H
+
+/**
+ * @file targeting/adapters/erroradapter.H
+ *
+ * @brief Adapts platform neutral error log requests to the platform
+ */
+
+//******************************************************************************
+// Includes
+//******************************************************************************
+
+// Include the platform specific errlentry.H file and pick up the platform
+// specific errlHndlt_t typedef. This is enough for common code to use pass
+// errlHndl_t pointers around and check for NULL
+#include <errl/errlentry.H>
+
+namespace COMMON
+{
+
+namespace ERRORLOG
+{
+ /**
+ * @brief Import the ::ERRORLOG namespace into the ::COMMON:ERRORLOG
+ * namespace. This allows all the common targeting code to use the
+ * same namespacing yet directly invoke platform specific error log
+ * support. Since nothing else is declared in the namespace, there is
+ * no danger of a namespace collision.
+ */
+ using namespace ::ERRORLOG;
+
+} // End namespace COMMON
+
+} // End namespace ERRORLOG
+
+#endif // __TARGETING_ERRORADAPTER_H
diff --git a/src/include/usr/targeting/adapters/traceadapter.H b/src/include/usr/targeting/adapters/traceadapter.H
new file mode 100644
index 000000000..493f8e06c
--- /dev/null
+++ b/src/include/usr/targeting/adapters/traceadapter.H
@@ -0,0 +1,56 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/targeting/adapters/traceadapter.H $
+//
+// IBM CONFIDENTIAL
+//
+// COPYRIGHT International Business Machines Corp. 2012
+//
+// p1
+//
+// Object Code Only (OCO) source materials
+// Licensed Internal Code Source Materials
+// IBM HostBoot Licensed Internal Code
+//
+// The source code for this program is not published or other-
+// wise divested of its trade secrets, irrespective of what has
+// been deposited with the U.S. Copyright Office.
+//
+// Origin: 30
+//
+// IBM_PROLOG_END
+
+#ifndef __TARGETING_TRACEADAPTER_H
+#define __TARGETING_TRACEADAPTER_H
+
+/**
+ * @file targeting/adapters/traceadapter.H
+ *
+ * @brief Platform specific targeting trace macro support
+ */
+
+//******************************************************************************
+// Includes
+//******************************************************************************
+
+// Other Components
+#include <trace/interface.H>
+
+// Give callers access to the trace buffer
+namespace TARGETING
+{
+
+/**
+ * @brief Map common trace type to platform specific trace type
+ */
+typedef trace_desc_t* TARG_TD_t;
+
+/**
+ * @brief Export trace descriptor
+ */
+extern TARG_TD_t g_trac_targeting;
+
+} // End namespace TARGETING
+
+#endif // __TARGETING_TRACEADAPTER_H
diff --git a/src/include/usr/targeting/adapters/types.H b/src/include/usr/targeting/adapters/types.H
new file mode 100644
index 000000000..264a6e55c
--- /dev/null
+++ b/src/include/usr/targeting/adapters/types.H
@@ -0,0 +1,65 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/targeting/adapters/types.H $
+//
+// IBM CONFIDENTIAL
+//
+// COPYRIGHT International Business Machines Corp. 2012
+//
+// p1
+//
+// Object Code Only (OCO) source materials
+// Licensed Internal Code Source Materials
+// IBM HostBoot Licensed Internal Code
+//
+// The source code for this program is not published or other-
+// wise divested of its trade secrets, irrespective of what has
+// been deposited with the U.S. Copyright Office.
+//
+// Origin: 30
+//
+// IBM_PROLOG_END
+
+#ifndef __TARGETING_TYPES_H
+#define __TARGETING_TYPES_H
+
+/**
+ * @file targeting/adapters/types.H
+ *
+ * @brief Platform specific type translation support
+ */
+
+//******************************************************************************
+// Includes
+//******************************************************************************
+
+#include <sys/sync.h>
+#include <util/singleton.H>
+#include <hbotcompid.H>
+#include <vmmconst.h>
+
+/**
+ * @brief Adapt common singleton declaration to specific platform
+ *
+ * @param[in] __T__
+ * Type of singleton, fully namespaced
+ *
+ * @param[in] __NAME__
+ * Symbol name for singleton
+ */
+#define TARG_DECLARE_SINGLETON(__T__,__NAME__) \
+ typedef Singleton<__T__> __NAME__;
+
+/**
+ * @brief Adapt common singleton "getter" to the specific platform
+ *
+ * @param[in] __TYPE__
+ * Typedef for singleton, as created above
+ *
+ * @return Singleton reference for the given singleton
+ */
+#define TARG_GET_SINGLETON(__TYPE__) \
+ __TYPE__::instance()
+
+#endif // __TARGETING_TYPES_H
diff --git a/src/include/usr/targeting/attrrp.H b/src/include/usr/targeting/attrrp.H
new file mode 100644
index 000000000..d5a4775a0
--- /dev/null
+++ b/src/include/usr/targeting/attrrp.H
@@ -0,0 +1,216 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/usr/targeting/attrrp.H $
+//
+// IBM CONFIDENTIAL
+//
+// COPYRIGHT International Business Machines Corp. 2011
+//
+// p1
+//
+// Object Code Only (OCO) source materials
+// Licensed Internal Code Source Materials
+// IBM HostBoot Licensed Internal Code
+//
+// The source code for this program is not published or other-
+// wise divested of its trade secrets, irrespective of what has
+// been deposited with the U.S. Copyright Office.
+//
+// Origin: 30
+//
+// IBM_PROLOG_END
+
+#ifndef __TARGETING_ATTRRP_H
+#define __TARGETING_ATTRRP_H
+
+/**
+ * @file targeting/attrrp.H
+ *
+ * @brief Interface for the attribute resource provider, which manages the
+ * memory associated with targeting attributes and provides any
+ * translation, if necessary
+ */
+//******************************************************************************
+// Includes
+//******************************************************************************
+
+#include <initservice/taskargs.H>
+#include <sys/msg.h>
+#include <targeting/adapters/types.H>
+
+namespace TARGETING
+{
+
+// Forward declaration of attribute section parsed information structure.
+struct AttrRP_Section;
+
+/**
+ * @class AttrRP
+ *
+ * @brief Attribute Resource Provider daemon class.
+ *
+ * @par Detailed Description:
+ * Provides all the functionality to translate between PNOR and
+ * Attribute virtual memory spaces. Parses PNOR header for attribute
+ * sections, allocates virtual memory spaces with the kernel for each
+ * section, and handles virtual memory request messages from the
+ * kernel.
+ */
+class AttrRP
+{
+ public:
+
+ /**
+ * @brief Returns base address of the RO section containing the
+ * targets
+ *
+ * @return Base address of the RO section containing the targets as
+ * a void*
+ */
+ void* getBaseAddress();
+
+ /**
+ * @brief Translates given address, according to the resource
+ * provider's translation algorithm
+ *
+ * @param[in] i_pAddress
+ * Address to translate
+ *
+ * @return void* Returns the translated address. Common attribute
+ * code has a static, compile time check that is used to
+ * determine whether to call this function, however the Hostboot
+ * compiler complains when this is not provided. Therefore
+ * while this method exists, Hostboot will never call it, and if
+ * it does it will always get a no-op translation.
+ */
+ void* translateAddr(
+ void* i_pAddress)
+ {
+ return i_pAddress;
+ }
+
+ /**
+ * @brief Initializes and starts the AttrRP daemon.
+ *
+ * @param[in/out] io_taskRetErrl
+ * Error log handle; on input, a NULL error log handle; on
+ * output, a NULL error log handle on success, or !NULL handle
+ * on failure
+ *
+ * @note If any error occurs during initialization, it will be
+ * reported back through the TaskArgs structure to the init
+ * service.
+ */
+ static void init(errlHndl_t& io_taskRetErrl);
+
+ protected:
+
+ /**
+ * @brief Initialize the attribute resource provider
+ *
+ * @par Detailed Description"
+ * Ensures member variables are initialized to sane values.
+ */
+ AttrRP()
+ : iv_msgQ(NULL), iv_sections(NULL), iv_sectionCount(0)
+ {
+ };
+
+ /**
+ * @brief Destroy the attribute resource provider
+ *
+ * @par Detailed Description:
+ * Frees any memory allocated by the resource provider.
+ *
+ * @note This should never actually be used because the daemon
+ * thread and the vmm blocks are unable to be reclaimed.
+ * Function will assert if called due to leaky behavior.
+ */
+ ~AttrRP();
+
+ private:
+
+ /**
+ * @brief Performs the startup of the daemon instance.
+ *
+ * @par Detailed Description:
+ * init() is a static function that just calls
+ * Singleton<AttrRP>::instance().startup(). See init for
+ * behavior.
+ *
+ * @param[in/out] io_taskRetErrl
+ * Error log handle; on input, a NULL error log handle; on
+ * output, a NULL error log handle on success, or !NULL handle
+ * on failure
+ */
+ void startup(errlHndl_t& io_taskRetErrl);
+
+ /**
+ * @brief Processes daemon messages
+ *
+ * @par Detailed Description:
+ * Performs a while(1) waiting for messages from the
+ * kernel/VMM and handles as appropriately. Reads / writes
+ * data from / to PNOR for the attribute sections.
+ */
+ void msgServiceTask() const;
+
+ /**
+ * @brief Parses the attribute section header in PNOR.
+ *
+ * @par Detailed Description:
+ * Constructs the local attribute section data structures
+ * (iv_sections / iv_sectionCount).
+ *
+ * @return errlHndl_t
+ * Returns an error log handle that is NULL on success or !NULL
+ * on failure
+ */
+ errlHndl_t parseAttrSectHeader();
+
+ /**
+ * @brief Allocates VMM sections for each Attribute section.
+ *
+ * @par Detailed Description:
+ * Calls to the kernel to create VMM blocks for each attribute
+ * and initializes permissions appropriately based on section
+ * type.
+ *
+ * @return errlHndl_t
+ * Returns an error log handle that is NULL on success or !NULL
+ * on failure
+ */
+ errlHndl_t createVmmSections();
+
+ /**
+ * @brief Starts the attribute provider's message processor
+ *
+ * @par Detailed Description:
+ * This function, being static, can be called from task_create
+ * and is used to enter the daemon thread's msgServiceTask
+ * loop to process messages.
+ *
+ * @param[in] i_pInstance
+ * The AttrRP to call msgServiceTask on.
+ */
+ static void startMsgServiceTask(void* i_pInstance);
+
+ // Message Queue for VMM requests
+ msg_q_t iv_msgQ;
+
+ // Parsed structures of the attribute sections.
+ AttrRP_Section* iv_sections;
+
+ // Count of attribute sections.
+ size_t iv_sectionCount;
+};
+
+/**
+ * @brief Give callers access to the singleton
+ */
+TARG_DECLARE_SINGLETON(TARGETING::AttrRP,theAttrRP);
+
+} // End namespace TARGETING
+
+#endif // __TARGETING_ATTRRP_H
diff --git a/src/include/usr/targeting/attributes.H b/src/include/usr/targeting/common/attributes.H
index 3a69af6af..d760fb19f 100644
--- a/src/include/usr/targeting/attributes.H
+++ b/src/include/usr/targeting/common/attributes.H
@@ -21,11 +21,11 @@
//
// IBM_PROLOG_END
-#ifndef TARG_ATTRIBUTES_H
-#define TARG_ATTRIBUTES_H
+#ifndef __TARGETING_COMMON_ATTRIBUTES_H
+#define __TARGETING_COMMON_ATTRIBUTES_H
/**
- * @file attributes.H
+ * @file targeting/common/attributes.H
*
* @brief Enums/type/properties of platform specific attributes
*/
@@ -39,9 +39,14 @@
#include <stdlib.h>
// This component
+#include <builtins.h>
+#include <targeting/adapters/types.H>
#include <attributeenums.H>
+#include <targeting/common/entitypath.H>
#include <attributestructs.H>
#include <attributetraits.H>
#include <attributestrings.H>
+#include <targeting/common/target.H>
+#include <targeting/common/util.H>
-#endif // TARG_ATTRIBUTES_H
+#endif // __TARGETING_COMMON_ATTRIBUTES_H
diff --git a/src/include/usr/targeting/common/commontargeting.H b/src/include/usr/targeting/common/commontargeting.H
new file mode 100644
index 000000000..c1a52a703
--- /dev/null
+++ b/src/include/usr/targeting/common/commontargeting.H
@@ -0,0 +1,45 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/targeting/common/commontargeting.H $
+//
+// IBM CONFIDENTIAL
+//
+// COPYRIGHT International Business Machines Corp. 2012
+//
+// p1
+//
+// Object Code Only (OCO) source materials
+// Licensed Internal Code Source Materials
+// IBM HostBoot Licensed Internal Code
+//
+// The source code for this program is not published or other-
+// wise divested of its trade secrets, irrespective of what has
+// been deposited with the U.S. Copyright Office.
+//
+// Origin: 30
+//
+// IBM_PROLOG_END
+
+#ifndef __TARGETING_COMMON_COMMONTARGETING_H
+#define __TARGETING_COMMON_COMMONTARGETING_H
+
+/**
+ * @file targeting/common/commontargeting.H
+ *
+ * @brief Aggregation of all other major exported common targeting header files
+ */
+
+//******************************************************************************
+// Includes
+//******************************************************************************
+
+#include <targeting/common/targreasoncodes.H>
+#include <targeting/common/attributes.H>
+#include <targeting/common/iterators/iterators.H>
+#include <targeting/common/predicates/predicates.H>
+#include <targeting/common/targetservice.H>
+
+// Please keep up to date
+
+#endif // __TARGETING_COMMON_COMMONTARGETING_H
diff --git a/src/include/usr/targeting/entitypath.H b/src/include/usr/targeting/common/entitypath.H
index 4e24a9410..5d46af493 100644
--- a/src/include/usr/targeting/entitypath.H
+++ b/src/include/usr/targeting/common/entitypath.H
@@ -21,11 +21,11 @@
//
// IBM_PROLOG_END
-#ifndef TARG_ENTITYPATH_H
-#define TARG_ENTITYPATH_H
+#ifndef __TARGETING_COMMON_ENTITYPATH_H
+#define __TARGETING_COMMON_ENTITYPATH_H
/**
- * @file entitypath.H
+ * @file targeting/common/entitypath.H
*
* @brief Interface for the EntityPath class
*
@@ -98,7 +98,7 @@ class EntityPath
*/
struct PathElement
{
- TYPE type; ///< Type of element at this level in the hierarchy
+ TYPE type : 8; ///< Type of element at this level in the hierarchy
uint8_t instance; ///< Instance ID for the element, relative to
///< the parent
@@ -147,6 +147,8 @@ class EntityPath
* routine asserts.
*
* @post Entity path element removed from path
+ *
+ * @return Reference to the same EntityPath, for chaining
*/
EntityPath& removeLast();
@@ -161,6 +163,8 @@ class EntityPath
* Equivalent to p1 = p2; p1.removeLast();
*
* @post Copy of entity path with last element removed returned
+ *
+ * @return Copy of the EntityPath
*/
EntityPath copyRemoveLast() const;
@@ -424,7 +428,7 @@ class EntityPath
/**
* @brief Save the entity path as a c-string
*
- * @return the dynamic buffer pointer of the c-string
+ * @return The dynamic buffer (malloc'd) pointer of the c-string
*
* @note caller must call free() to release the buffer
*/
@@ -444,4 +448,4 @@ class EntityPath
} // End namespace TARGETING
-#endif // TARG_ENTITYPATH_H
+#endif // __TARGETING_COMMON_ENTITYPATH_H
diff --git a/src/include/usr/targeting/common/error.H b/src/include/usr/targeting/common/error.H
new file mode 100644
index 000000000..39153e6a7
--- /dev/null
+++ b/src/include/usr/targeting/common/error.H
@@ -0,0 +1,40 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/targeting/common/error.H $
+//
+// IBM CONFIDENTIAL
+//
+// COPYRIGHT International Business Machines Corp. 2012
+//
+// p1
+//
+// Object Code Only (OCO) source materials
+// Licensed Internal Code Source Materials
+// IBM HostBoot Licensed Internal Code
+//
+// The source code for this program is not published or other-
+// wise divested of its trade secrets, irrespective of what has
+// been deposited with the U.S. Copyright Office.
+//
+// Origin: 30
+//
+// IBM_PROLOG_END
+
+#ifndef __TARGETING_COMMON_ERROR_H
+#define __TARGETING_COMMON_ERROR_H
+
+/**
+ * @file targeting/common/error.H
+ *
+ * @brief Common header to abstract away error handling differences between
+ * platforms
+ */
+
+//******************************************************************************
+// Includes
+//******************************************************************************
+
+#include <targeting/adapters/erroradapter.H>
+
+#endif // __TARGETING_COMMON_ERROR_H
diff --git a/src/include/usr/targeting/common/iterators/iterators.H b/src/include/usr/targeting/common/iterators/iterators.H
new file mode 100644
index 000000000..5339b33dd
--- /dev/null
+++ b/src/include/usr/targeting/common/iterators/iterators.H
@@ -0,0 +1,39 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/targeting/common/iterators/iterators.H $
+//
+// IBM CONFIDENTIAL
+//
+// COPYRIGHT International Business Machines Corp. 2012
+//
+// p1
+//
+// Object Code Only (OCO) source materials
+// Licensed Internal Code Source Materials
+// IBM HostBoot Licensed Internal Code
+//
+// The source code for this program is not published or other-
+// wise divested of its trade secrets, irrespective of what has
+// been deposited with the U.S. Copyright Office.
+//
+// Origin: 30
+//
+// IBM_PROLOG_END
+
+#ifndef __TARGETING_COMMON_ITERATORS_H
+#define __TARGETING_COMMON_ITERATORS_H
+
+/**
+ * @file targeting/common/iterators/iterators.H
+ *
+ * @brief Header file which aggregates all the iterator header files.
+ */
+
+#include <targeting/common/iterators/targetiterator.H>
+#include <targeting/common/iterators/rangefilter.H>
+
+// please keep up to date...
+
+#endif // __TARGETING_COMMON_ITERATORS_H
+
diff --git a/src/include/usr/targeting/iterators/rangefilter.H b/src/include/usr/targeting/common/iterators/rangefilter.H
index 458bf3b9d..b29cfa07d 100644
--- a/src/include/usr/targeting/iterators/rangefilter.H
+++ b/src/include/usr/targeting/common/iterators/rangefilter.H
@@ -21,11 +21,11 @@
//
// IBM_PROLOG_END
-#ifndef TARG_RANGEFILTER_H
-#define TARG_RANGEFILTER_H
+#ifndef __TARGETING_COMMON_RANGEFILTER_H
+#define __TARGETING_COMMON_RANGEFILTER_H
/**
- * @file rangefilter.H
+ * @file targeting/common/iterators/rangefilter.H
*
* @brief Interface describing an object which takes an iterator range and
* allows caller to iterate through the elements which match a supplied
@@ -41,9 +41,9 @@
// Other Host Boot Components
// Targeting Component
-#include <targeting/target.H>
-#include <targeting/predicates/predicatebase.H>
-#include <targeting/iterators/targetiterator.H>
+#include <targeting/common/target.H>
+#include <targeting/common/predicates/predicatebase.H>
+#include <targeting/common/iterators/targetiterator.H>
//******************************************************************************
// Macros
@@ -307,29 +307,29 @@ RangeFilter<IteratorType>& RangeFilter<IteratorType>::operator++()
template <typename T>
bool operator!=(const TargetRangeFilter& i_lhs, const T& i_rhs)
{
- i_lhs.notComparable();
- return false;
+ i_lhs.notComparable();
+ return false;
}
template <typename T>
bool operator==(const TargetRangeFilter& i_lhs, const T& i_rhs)
{
i_lhs.notComparable();
- return false;
+ return false;
}
template <typename T>
bool operator!=(const ConstTargetRangeFilter& i_lhs, const T& i_rhs)
{
- i_lhs.notComparable();
- return false;
+ i_lhs.notComparable();
+ return false;
}
template <typename T>
bool operator==(const ConstTargetRangeFilter& i_lhs, const T& i_rhs)
{
i_lhs.notComparable();
- return false;
+ return false;
}
#undef TARG_CLASS
@@ -337,5 +337,5 @@ bool operator==(const ConstTargetRangeFilter& i_lhs, const T& i_rhs)
} // End namespace TARGETING
-#endif
+#endif // __TARGETING_COMMON_RANGEFILTER
diff --git a/src/include/usr/targeting/iterators/targetiterator.H b/src/include/usr/targeting/common/iterators/targetiterator.H
index 6819de498..5abb21f81 100644
--- a/src/include/usr/targeting/iterators/targetiterator.H
+++ b/src/include/usr/targeting/common/iterators/targetiterator.H
@@ -21,11 +21,11 @@
//
// IBM_PROLOG_END
-#ifndef TARG_TARGETITERATOR_H
-#define TARG_TARGETITERATOR_H
+#ifndef __TARGETING_COMMON_TARGETITERATOR_H
+#define __TARGETING_COMMON_TARGETITERATOR_H
/**
- * @file targetiterator.H
+ * @file targeting/common/iterators/targetiterator.H
*
* @brief Interface describing iterator/const iterator used to iterate through
* target service targets
@@ -275,5 +275,5 @@ _TargetIterator<T>& _TargetIterator<T>::operator++()
} // End namespace TARGETING
-#endif // TARG_TARGETITERATOR_H
+#endif // __TARGETING_COMMON_TARGETITERATOR_H
diff --git a/src/include/usr/targeting/common/pointer.H b/src/include/usr/targeting/common/pointer.H
new file mode 100644
index 000000000..f5d919ab6
--- /dev/null
+++ b/src/include/usr/targeting/common/pointer.H
@@ -0,0 +1,85 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/targeting/common/pointer.H $
+//
+// IBM CONFIDENTIAL
+//
+// COPYRIGHT International Business Machines Corp. 2012
+//
+// p1
+//
+// Object Code Only (OCO) source materials
+// Licensed Internal Code Source Materials
+// IBM HostBoot Licensed Internal Code
+//
+// The source code for this program is not published or other-
+// wise divested of its trade secrets, irrespective of what has
+// been deposited with the U.S. Copyright Office.
+//
+// Origin: 30
+//
+// IBM_PROLOG_END
+
+#ifndef __TARGETING_COMMON_POINTER_H
+#define __TARGETING_COMMON_POINTER_H
+
+/**
+ * @file targeting/common/pointer.H
+ *
+ * @brief Pointer abstraction that allows Hostboot and FSP to use pointers in
+ * a common way, while maintaining binary compatibility
+ */
+
+#include <builtins.h>
+
+namespace TARGETING
+{
+
+/**
+ * @brief Type (union) which implements a common pointer type between Hostboot
+ * and FSP
+ */
+template<typename T>
+union AbstractPointer
+{
+ uint64_t raw; ///< Raw value of the container
+ struct
+ {
+ uint8_t doNotUse[sizeof(uint64_t)-sizeof(void*)]; ///< Do no use
+ T* ptr; ///< Pointer to instance of type T
+ };
+};
+
+/**
+ * @brief Macro which accepts an AbstractPointer<T> and returns a pointer
+ * customized to the platform
+ *
+ * @param[in] __PTR__
+ * AbstractPointer<T> containing the platform neutral pointer
+ *
+ * @return T* pointer customized to the platform
+ */
+#define TARG_TO_PLAT_PTR(__PTR__) \
+ ((__PTR__).ptr)
+
+/**
+ * @biref Macro which accepts an AbstractPointer<T>, customizes the pointer to
+ * the platform, then increments the pointer the specified number of times
+ * and returns it
+ *
+ * @param[in] __PTR__
+ * AbstractPointer<T> containing the platform neutral pointer
+ *
+ * @param[in] __NUM_INCS__
+ * Number of times to increment the platform specific pointer
+ *
+ * @return T* pointer customized to the platform, incremented the specified
+ * number of times
+ */
+#define TARG_TO_PLAT_PTR_AND_INC(__PTR__,__NUM_INCS__) \
+ ((__PTR__).ptr + __NUM_INCS__)
+
+} // End namespace Targeting
+
+#endif // __TARGETING_COMMON_POINTER_H
diff --git a/src/include/usr/targeting/predicates/predicatebase.H b/src/include/usr/targeting/common/predicates/predicatebase.H
index 889aae8b5..1a12b16a6 100644
--- a/src/include/usr/targeting/predicates/predicatebase.H
+++ b/src/include/usr/targeting/common/predicates/predicatebase.H
@@ -21,11 +21,11 @@
//
// IBM_PROLOG_END
-#ifndef TARG_PREDICATEBASE_H
-#define TARG_PREDICATEBASE_H
+#ifndef __TARGETING_COMMON_PREDICATEBASE_H
+#define __TARGETING_COMMON_PREDICATEBASE_H
/**
- * @file predicatebase.H
+ * @file targeting/common/predicates/predicatebase.H
*
* @brief Interface for an abstract targeting predicate which filters a set of
* targets based on the programmed criteria. Concrete predicates must
@@ -130,4 +130,4 @@ class PredicateBase
} // End namespace TARGETING
-#endif // TARG_PREDICATEBASE_H
+#endif // __TARGETING_COMMON_PREDICATEBASE_H
diff --git a/src/include/usr/targeting/predicates/predicatectm.H b/src/include/usr/targeting/common/predicates/predicatectm.H
index 09180f6a1..de1e5f48f 100644
--- a/src/include/usr/targeting/predicates/predicatectm.H
+++ b/src/include/usr/targeting/common/predicates/predicatectm.H
@@ -21,11 +21,11 @@
//
// IBM_PROLOG_END
-#ifndef TARG_PREDICATECTM_H
-#define TARG_PREDICATECTM_H
+#ifndef __TARGETING_COMMON_PREDICATECTM_H
+#define __TARGETING_COMMON_PREDICATECTM_H
/**
- * @file predicatectm.H
+ * @file targeting/common/predicates/predicatectm.H
*
* @brief Interface for a predicate which fiters a target based on its class,
* type, and model.
@@ -40,9 +40,9 @@
// Other Host Boot Components
// Targeting Component
-#include <targeting/target.H>
-#include <attributeenums.H>
-#include <targeting/predicates/predicatebase.H>
+#include <targeting/common/target.H>
+#include <targeting/common/attributes.H>
+#include <targeting/common/predicates/predicatebase.H>
//******************************************************************************
// Macros
@@ -120,6 +120,11 @@ class PredicateCTM : public PredicateBase
* (CLASS_NA, TYPE_NA, MODEL_NA) must be used for any fields that
* do not matter. See PredicateBase class for parameter/return
* description.
+ *
+ * @param[in] i_pTarget
+ * Target handle pointing to the target to compare to
+ *
+ * @return bool indicating whether the target matches or not
*/
virtual bool operator()(
const Target* i_pTarget) const;
@@ -181,4 +186,4 @@ inline void PredicateCTM::setModel(MODEL i_model)
} // End namespace TARGETING
-#endif // TARG_PREDICATECTM_H
+#endif // __TARGETING_COMMON_PREDICATECTM_H
diff --git a/src/include/usr/targeting/predicates/predicateisfunctional.H b/src/include/usr/targeting/common/predicates/predicateisfunctional.H
index 7a3ad741c..b203ebd41 100644
--- a/src/include/usr/targeting/predicates/predicateisfunctional.H
+++ b/src/include/usr/targeting/common/predicates/predicateisfunctional.H
@@ -21,10 +21,10 @@
//
// IBM_PROLOG_END
-#ifndef __PREDICATES_PREDICATEISFUNCTIONAL_H
-#define __PREDICATES_PREDICATEISFUNCTIONAL_H
+#ifndef __TARGETING_COMMON_PREDICATEISFUNCTIONAL_H
+#define __TARGETING_COMMON_PREDICATEISFUNCTIONAL_H
/**
- * @file predicateisfunctional.H
+ * @file targeting/common/predicates/predicateisfunctional.H
*
* PredicateIsFunctional class, used to filter targets for HWP wrapper.
* From the example tutorial page at
@@ -50,15 +50,15 @@
/******************************************************************************/
// Includes
/******************************************************************************/
-#include <stdint.h>
+#include <stdint.h>
// targeting support.
-#include <targeting/attributes.H>
-#include <targeting/entitypath.H>
-#include <targeting/target.H>
-#include <targeting/targetservice.H>
-#include <targeting/iterators/rangefilter.H>
-#include <targeting/predicates/predicatectm.H>
+#include <targeting/common/attributes.H>
+#include <targeting/common/entitypath.H>
+#include <targeting/common/target.H>
+#include <targeting/common/targetservice.H>
+#include <targeting/common/iterators/rangefilter.H>
+#include <targeting/common/predicates/predicatectm.H>
namespace TARGETING
@@ -88,6 +88,10 @@ public:
/**
* @brief returns true if target is marked functional
*
+ * @param[in] i_pTarget
+ * Handle to the target to perform the predicate check on
+ *
+ * @return bool indicating whether target it functional or not
*/
inline bool operator()(
const TARGETING::Target* i_pTarget) const ;
@@ -99,4 +103,4 @@ private:
}; // end namespace
-#endif
+#endif // __TARGETING_COMMON_PREDICATEISFUNCTIONAL_H
diff --git a/src/include/usr/targeting/predicates/predicatepostfixexpr.H b/src/include/usr/targeting/common/predicates/predicatepostfixexpr.H
index 3eb55b6a2..44fabfb62 100644
--- a/src/include/usr/targeting/predicates/predicatepostfixexpr.H
+++ b/src/include/usr/targeting/common/predicates/predicatepostfixexpr.H
@@ -21,11 +21,11 @@
//
// IBM_PROLOG_END
-#ifndef TARG_PREDICATEPOSTFIXEXPR_H
-#define TARG_PREDICATEPOSTFIXEXPR_H
+#ifndef __TARGETING_COMMON_PREDICATEPOSTFIXEXPR_H
+#define __TARGETING_COMMON_PREDICATEPOSTFIXEXPR_H
/**
- * @file predicatepostfixexpr.H
+ * @file targeting/common/predicatepostfixexpr.H
*
* @brief Interface for predicate which allows callers to chain multiple other
* predicates together in complex logical expressions, and then evaluate
@@ -42,7 +42,7 @@
// Other Host Boot Components
// Targeting Component
-#include <targeting/predicates/predicatebase.H>
+#include <targeting/common/predicates/predicatebase.H>
//******************************************************************************
// Macros
@@ -183,6 +183,11 @@ class PredicatePostfixExpr : public PredicateBase
* Evaluation step 2: 0 NOT (evaluated 1 P3 AND)
* Evaluation step 3: 1 (evaluated 0 NOT; final result)
* @endverbatim
+ *
+ * @param[in] i_pTarget
+ * Handle of the target to evaluate the expression against
+ *
+ * @return bool indicating whether the expression is true or no
*/
virtual bool operator()(
const Target* i_pTarget) const;
@@ -207,10 +212,10 @@ class PredicatePostfixExpr : public PredicateBase
*/
struct Operation
{
- LogicalOperator logicalOp; ///< Logical operator to
- ///< apply to result stack
- const PredicateBase* const pPredicate; ///< Predicate to evaluate,
- ///< if logicalOp == EVAL
+ LogicalOperator logicalOp; ///< Logical operator to
+ ///< apply to result stack
+ const PredicateBase* pPredicate; ///< Predicate to evaluate,
+ ///< if logicalOp == EVAL
};
std::vector<Operation> iv_ops; ///< Expression operations to perform
@@ -223,4 +228,4 @@ class PredicatePostfixExpr : public PredicateBase
} // End namespace TARGETING
-#endif // TARG_PREDICATEPOSTFIXEXPR_H
+#endif // __TARGETING_COMMON_PREDICATEPOSTFIXEXPR_H
diff --git a/src/include/usr/targeting/predicates/predicates.H b/src/include/usr/targeting/common/predicates/predicates.H
index 2c615852c..5a7cf04d9 100644
--- a/src/include/usr/targeting/predicates/predicates.H
+++ b/src/include/usr/targeting/common/predicates/predicates.H
@@ -20,21 +20,22 @@
// Origin: 30
//
// IBM_PROLOG_END
-#ifndef TARG_PREDICATES_H
-#define TARG_PREDICATES_H
+
+#ifndef __TARGETING_COMMON_PREDICATES_H
+#define __TARGETING_COMMON_PREDICATES_H
/**
- * @file predicateall.H
+ * @file targeting/common/predicates/predicates.H
*
* @brief Shortcut file to pull in all the predicate include files.
*
*/
-#include <targeting/predicates/predicatebase.H>
-#include <targeting/predicates/predicatectm.H>
-#include <targeting/predicates/predicatepostfixexpr.H>
-#include <targeting/predicates/predicateisfunctional.H>
+#include <targeting/common/predicates/predicatebase.H>
+#include <targeting/common/predicates/predicatectm.H>
+#include <targeting/common/predicates/predicateisfunctional.H>
+#include <targeting/common/predicates/predicatepostfixexpr.H>
// please keep up to date...
-#endif
+#endif // __TARGETING_COMMON_PREDICATES_H
diff --git a/src/include/usr/targeting/target.H b/src/include/usr/targeting/common/target.H
index 84c8459b8..d91483cad 100644
--- a/src/include/usr/targeting/target.H
+++ b/src/include/usr/targeting/common/target.H
@@ -21,11 +21,11 @@
//
// IBM_PROLOG_END
-#ifndef TARG_TARGET_H
-#define TARG_TARGET_H
+#ifndef __TARGETING_COMMON_TARGET_H
+#define __TARGETING_COMMON_TARGET_H
/**
- * @file target.H
+ * @file targeting/common/target.H
*
* @brief Interface for the target class
*
@@ -40,11 +40,14 @@
// STD
#include <stdint.h>
#include <stdlib.h>
-#include <assert.h>
+#include <targeting/adapters/assertadapter.H>
+#include <targeting/adapters/types.H>
+#include <targeting/common/util.H>
+#include <targeting/common/pointer.H>
#include <vector>
// This component
-#include <targeting/attributes.H>
+#include <targeting/common/attributes.H>
namespace TARGETING
{
@@ -232,7 +235,7 @@ class Target
bool l_wrote = trySetAttr<A>(i_attrValue);
//@TODO: Remove assert once release has stabilized
- assert(l_wrote,"TARGETING::Target::setAttr<%d>: trySetAttr "
+ TARG_ASSERT(l_wrote,"TARGETING::Target::setAttr<%d>: trySetAttr "
"returned false",A);
}
@@ -257,7 +260,7 @@ class Target
*
* @param[in] i_attr Attribute to retrieve
* @param[in] i_size Size of the attribute
- * @param[in/out] io_attrData On input, location to store the attribute.
+ * @param[in/out] io_attrData On input, location to store the attribute
* On output, location updated with attribute data
*
* @pre Target service must be initialized
@@ -361,11 +364,12 @@ class Target
uint32_t iv_attrs; ///< Total attributes allowed for this
///< instance
- ATTRIBUTE_ID (*iv_pAttrNames)[]; ///< Pointer to array of valid
- ///< attributes
- void* (*iv_pAttrValues)[]; ///< Pointer to array of void*'s
- ///< (which point to individual
- ///< attributes)
+
+ // Pointer to array of valid attributes
+ TARGETING::AbstractPointer<ATTRIBUTE_ID> iv_pAttrNames;
+
+ // Pointer to array of void* (which point to attributes)
+ TARGETING::AbstractPointer< AbstractPointer<void> > iv_pAttrValues;
private: // Private CTORs/DTORs/Operators
@@ -396,7 +400,7 @@ typename AttributeTraits<A>::Type Target::getAttr() const
bool l_read = tryGetAttr<A>(l_attrValue);
//@TODO Remove assert once release has stablized
- assert(l_read,"TARGETING::Target::getAttr<%d>: tryGetAttr "
+ TARG_ASSERT(l_read,"TARGETING::Target::getAttr<%d>: tryGetAttr "
"returned false",A);
return l_attrValue;
}
@@ -431,11 +435,11 @@ const char* Target::getAttrAsString() const
bool l_read = tryGetAttr<A>(l_attrValue);
//@TODO Remove assert once release has stabilized
- assert(l_read,"TARGETING::Target::getAttrAsString<%d>: tryGetAttr "
+ TARG_ASSERT(l_read,"TARGETING::Target::getAttrAsString<%d>: tryGetAttr "
"returned false",A);
return attrToString<A>(l_attrValue);
}
} // End namespace TARGETING
-#endif // TARG_TARGET_H
+#endif // __TARGETING_COMMON_TARGET_H
diff --git a/src/include/usr/targeting/targetservice.H b/src/include/usr/targeting/common/targetservice.H
index e220eafb7..444dbc472 100644
--- a/src/include/usr/targeting/targetservice.H
+++ b/src/include/usr/targeting/common/targetservice.H
@@ -21,11 +21,11 @@
//
// IBM_PROLOG_END
-#ifndef TARG_TARGETSERVICE_H
-#define TARG_TARGETSERVICE_H
+#ifndef __TARGETING_COMMON_TARGETSERVICE_H
+#define __TARGETING_COMMON_TARGETSERVICE_H
/**
- * @file targetservice.H
+ * @file targeting/common/targetservice.H
*
* @brief Interface for the target service
*
@@ -43,15 +43,11 @@
#include <stdlib.h>
#include <vector>
-// Other components
-#include <util/singleton.H>
-
// This component
-#include <attributeenums.H>
-#include <targeting/target.H>
-#include <targeting/entitypath.H>
-#include <targeting/iterators/targetiterator.H>
-#include <targeting/predicates/predicatebase.H>
+#include <targeting/common/attributes.H>
+#include <targeting/common/iterators/iterators.H>
+#include <targeting/common/predicates/predicates.H>
+#include <targeting/adapters/types.H>
//******************************************************************************
// Interface Definitions
@@ -79,7 +75,9 @@ namespace TARGETING
* cannot be used as input to any target service APIs.
*/
static Target* const MASTER_PROCESSOR_CHIP_TARGET_SENTINEL
- = reinterpret_cast<TARGETING::Target* const>(0xFFFFFFFFFFFFFFFFULL);
+ = (sizeof(void*) == 4) ?
+ reinterpret_cast<TARGETING::Target* const>(0xFFFFFFFF)
+ : reinterpret_cast<TARGETING::Target* const>(0xFFFFFFFFFFFFFFFFULL);
/**
* @brief TargetService class
@@ -164,6 +162,19 @@ class TargetService
void init();
/**
+ * @brief Returns whether target service has initialized or not
+ *
+ * @return bool indicating whether service has initialized or not
+ * @retval true Service has initialized and can be used
+ * @retval false Service has not initializated and should not be used
+ * (other than to run the initialization)
+ */
+ bool isInitialized() const
+ {
+ return iv_initialized;
+ }
+
+ /**
* @brief Map iterator types to common aliases
*/
typedef TargetIterator iterator;
@@ -539,8 +550,9 @@ class TargetService
* intentionally
*/
class TargetService;
-typedef Singleton<TARGETING::TargetService> theTargetService;
+
+TARG_DECLARE_SINGLETON(TARGETING::TargetService,theTargetService);
} // End namespace TARGETING
-#endif // TARG_TARGETSERVICE_H
+#endif // __TARGETING_COMMON_TARGETSERVICE_H
diff --git a/src/include/usr/targeting/common/targreasoncodes.H b/src/include/usr/targeting/common/targreasoncodes.H
new file mode 100644
index 000000000..8214c1f0b
--- /dev/null
+++ b/src/include/usr/targeting/common/targreasoncodes.H
@@ -0,0 +1,54 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// $Source: src/include/usr/targeting/targreasoncodes.H $
+//
+// IBM CONFIDENTIAL
+//
+// COPYRIGHT International Business Machines Corp. 2011
+//
+// p1
+//
+// Object Code Only (OCO) source materials
+// Licensed Internal Code Source Materials
+// IBM HostBoot Licensed Internal Code
+//
+// The source code for this program is not published or other-
+// wise divested of its trade secrets, irrespective of what has
+// been deposited with the U.S. Copyright Office.
+//
+// Origin: 30
+//
+// IBM_PROLOG_END
+#ifndef __TARGETING_COMMON_TARGREASONCODES_H
+#define __TARGETING_COMMON_TARGREASONCODES_H
+
+/**
+ * @file targeting/common/targetreasoncodes.H
+ *
+ * @brief Provides reason codes for various targeting errors
+ */
+
+#include <targeting/adapters/types.H>
+
+namespace TARGETING
+{
+
+enum TargetingModuleId
+{
+ TARG_MOD_TEST = 0x01,
+ TARG_MOD_ATTRRP = 0x02,
+};
+
+enum TargetingReasonCode
+{
+ TARG_RC_TEST_TARGET_FFDC = TARG_COMP_ID | 0x01,
+ TARG_RC_BAD_EYECATCH = TARG_COMP_ID | 0x02,
+ TARG_RC_MM_BLOCK_FAIL = TARG_COMP_ID | 0x03,
+ TARG_RC_MM_PERM_FAIL = TARG_COMP_ID | 0x04,
+ TARG_RC_ATTR_MSG_FAIL = TARG_COMP_ID | 0x05,
+};
+
+}; // End TARGETING namespace
+
+#endif // __TARGETING_COMMON_TARGREASONCODES_H
diff --git a/src/include/usr/targeting/common/trace.H b/src/include/usr/targeting/common/trace.H
new file mode 100644
index 000000000..c298eb9ab
--- /dev/null
+++ b/src/include/usr/targeting/common/trace.H
@@ -0,0 +1,65 @@
+// 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 __TARGETING_COMMON_TRACE_H
+#define __TARGETING_COMMON_TRACE_H
+
+/**
+ * @file targeting/common/trace.H
+ *
+ * @brief Targeting related trace macros. Callers of these macros must
+ * define TARG_NAMESPACE, TARG_CLASS, and TARG_FN as appropriate
+ */
+
+//******************************************************************************
+// Includes
+//******************************************************************************
+
+// Other includes
+#include <targeting/adapters/traceadapter.H>
+
+#define TARG_LOC TARG_NAMESPACE TARG_CLASS TARG_FN ": "
+
+#define TARG_ERR_LOC ERR_MRK " " TARG_LOC
+
+#define TARG_TAG "[TARG]"
+#define TARG_ENTER(args...) \
+ TRACFCOMP(TARGETING::g_trac_targeting,TARG_TAG " " \
+ ENTER_MRK " " TARG_NAMESPACE \
+ 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 // __TARGETING_COMMON_TRACE_H
diff --git a/src/include/usr/targeting/util.H b/src/include/usr/targeting/common/util.H
index 4af5500a5..4851dd87b 100644
--- a/src/include/usr/targeting/util.H
+++ b/src/include/usr/targeting/common/util.H
@@ -20,18 +20,39 @@
// Origin: 30
//
// IBM_PROLOG_END
-#ifndef __TARGETING_UTIL_H
-#define __TARGETING_UTIL_H
+
+#ifndef __TARGETING_COMMON_UTIL_H
+#define __TARGETING_COMMON_UTIL_H
/**
- * Miscellaneous Utility Functions
+ * @file targeting/common/util.H
+ *
+ * @brief Targeting utility functions
*/
namespace TARGETING
{
+
class Target;
/**
+ * @brief Macro which indicates whether to translate addresses or not
+ *
+ * @par Detailed Description:
+ * If PPC platform (FSP or Hostboot), if 8 byte pointers then it's
+ * Hostboot, so don't translate. If 4 byte pointers then it's FSP so
+ * translate. If !PPC (x86 32 or 64 bit), then always translate
+ *
+ * @note List of preprocessor macros defined can be determined by calling:
+ * ppc64-mcp6-gcc -dM -E - < /dev/null
+ */
+#ifdef __PPC__
+#define TARG_ADDR_TRANSLATION_REQUIRED (sizeof(void*)==4)
+#else
+#define TARG_ADDR_TRANSLATION_REQUIRED (1)
+#endif
+
+/**
* @brief Checks to see if we are running in a hardware simulation
* environment, i.e. VPO/VBU (not Simics)
*
@@ -48,10 +69,4 @@ uint32_t get_huid( const Target* i_target );
}
-
-
-
-
-
-
-#endif
+#endif // __TARGETING_COMMON_UTIL_H
diff --git a/src/include/usr/targeting/targreasoncodes.H b/src/include/usr/targeting/targreasoncodes.H
deleted file mode 100644
index 4e6f1108e..000000000
--- a/src/include/usr/targeting/targreasoncodes.H
+++ /dev/null
@@ -1,46 +0,0 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/include/usr/targeting/targreasoncodes.H $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 2011
-//
-// p1
-//
-// Object Code Only (OCO) source materials
-// Licensed Internal Code Source Materials
-// IBM HostBoot Licensed Internal Code
-//
-// The source code for this program is not published or other-
-// wise divested of its trade secrets, irrespective of what has
-// been deposited with the U.S. Copyright Office.
-//
-// Origin: 30
-//
-// IBM_PROLOG_END
-#ifndef __TARGETING_TARGREASONCODES_H
-#define __TARGETING_TARGREASONCODES_H
-
-#include <hbotcompid.H>
-
-namespace TARGETING
-{
- enum TargetingModuleId
- {
- TARG_MOD_TEST = 0x01,
- TARG_MOD_ATTRRP = 0x02,
- };
-
- enum TargetingReasonCode
- {
- TARG_RC_TEST_TARGET_FFDC = TARG_COMP_ID | 0x01,
- TARG_RC_BAD_EYECATCH = TARG_COMP_ID | 0x02,
- TARG_RC_MM_BLOCK_FAIL = TARG_COMP_ID | 0x03,
- TARG_RC_MM_PERM_FAIL = TARG_COMP_ID | 0x04,
- TARG_RC_ATTR_MSG_FAIL = TARG_COMP_ID | 0x05,
- };
-};
-
-#endif
diff --git a/src/include/usr/vmmconst.h b/src/include/usr/vmmconst.h
index 5036b8146..24a0617c8 100644
--- a/src/include/usr/vmmconst.h
+++ b/src/include/usr/vmmconst.h
@@ -57,7 +57,11 @@
/** Attribute Resource Provider */
// Note: Not simplified to make it easier to extract with the PNOR targeting
// image generator script
-#define VMM_VADDR_ATTR_RP (3ul * 1024ul * 1024ul * 1024ul)
+// WARNING: 4 GB range deliberately chosen so that 64-bit Hostboot pointers
+// are similar to 32 bit FSP pointers, except that the upper 32 bits are
+// set to 0x00000001. This allows both FSP and Hostboot to opearate on the same
+// targeting image
+#define VMM_VADDR_ATTR_RP (4ul * 1024ul * 1024ul * 1024ul)
/** Virtual memory block priorities */
enum BlockPriority
OpenPOWER on IntegriCloud