summaryrefslogtreecommitdiffstats
path: root/src/include/usr
diff options
context:
space:
mode:
authorNick Bofferding <bofferdn@us.ibm.com>2012-08-12 12:10:33 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-08-15 12:41:06 -0500
commit13682024ac1a36b7400c8619e87b88a5b182d132 (patch)
tree4dfc72a426d4e04bcef4deb144ffed0055cdb1fb /src/include/usr
parent564bd490f2c9db01c5553d5b2b6a00cc43f828d0 (diff)
downloadtalos-hostboot-13682024ac1a36b7400c8619e87b88a5b182d132.tar.gz
talos-hostboot-13682024ac1a36b7400c8619e87b88a5b182d132.zip
Miscellaneous support for x86 targeting builds in FSP
- Updated makefiles delivered to FSP to include NFP context mk directives - Updated makefiles delivered to FSP to consolidate subtree directives - Updated abstract pointer type to handle 4 byte x86 pointers - Updated attribute resource provider to use updated abstract pointer Change-Id: Ib924ae40c250d968e9ccbb9cffb1eb38bb747cdd RTC: 39737 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1519 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/targeting/common/pointer.H88
1 files changed, 59 insertions, 29 deletions
diff --git a/src/include/usr/targeting/common/pointer.H b/src/include/usr/targeting/common/pointer.H
index f5d919ab6..e42c59218 100644
--- a/src/include/usr/targeting/common/pointer.H
+++ b/src/include/usr/targeting/common/pointer.H
@@ -1,26 +1,26 @@
-// 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
-
+/* 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_TAG
+ */
#ifndef __TARGETING_COMMON_POINTER_H
#define __TARGETING_COMMON_POINTER_H
@@ -44,11 +44,41 @@ template<typename T>
union AbstractPointer
{
uint64_t raw; ///< Raw value of the container
- struct
+
+ /**
+ * @brief Returns the AbstractPointer as a platform specific pointer
+ *
+ * @return Platform specific pointer whose type matches the underlying
+ * template type
+ */
+ operator T*() const
+ {
+ return reinterpret_cast<T*>(raw);
+ }
+
+ /**
+ * @brief Returns the AbstractPointer as a platform specific pointer
+ * incremented by the specified amount. Note that the pointer
+ * will increment differently, based on the underlying type.
+ *
+ * @return Incremented, platform specific pointer whose type matches the
+ * underlying template type
+ */
+ T* inc(const size_t i_inc) const
{
- uint8_t doNotUse[sizeof(uint64_t)-sizeof(void*)]; ///< Do no use
- T* ptr; ///< Pointer to instance of type T
- };
+ return reinterpret_cast<T*>(raw) + i_inc;
+ }
+
+ /**
+ * @brief Returns the AbstractPointer as a uint64_t, which has the same
+ * value as a platform specific pointer converted to a uint64_t
+ *
+ * @return uint64_t value of the converted platform specific pointer
+ */
+ operator uint64_t() const
+ {
+ return reinterpret_cast<uint64_t>(reinterpret_cast<T*>(raw));
+ }
};
/**
@@ -61,7 +91,7 @@ union AbstractPointer
* @return T* pointer customized to the platform
*/
#define TARG_TO_PLAT_PTR(__PTR__) \
- ((__PTR__).ptr)
+ ((__PTR__))
/**
* @biref Macro which accepts an AbstractPointer<T>, customizes the pointer to
@@ -78,7 +108,7 @@ union AbstractPointer
* number of times
*/
#define TARG_TO_PLAT_PTR_AND_INC(__PTR__,__NUM_INCS__) \
- ((__PTR__).ptr + __NUM_INCS__)
+ ((__PTR__).inc( __NUM_INCS__))
} // End namespace Targeting
OpenPOWER on IntegriCloud