summaryrefslogtreecommitdiffstats
path: root/src/hwpf/include/plat
diff options
context:
space:
mode:
Diffstat (limited to 'src/hwpf/include/plat')
-rw-r--r--src/hwpf/include/plat/plat_target.H60
-rw-r--r--src/hwpf/include/plat/plat_target_utils.H2
-rw-r--r--src/hwpf/include/plat/plat_utils.H65
-rw-r--r--src/hwpf/include/plat/target.H41
4 files changed, 144 insertions, 24 deletions
diff --git a/src/hwpf/include/plat/plat_target.H b/src/hwpf/include/plat/plat_target.H
index 7f7ac99f..bf7bcad3 100644
--- a/src/hwpf/include/plat/plat_target.H
+++ b/src/hwpf/include/plat/plat_target.H
@@ -102,16 +102,74 @@ namespace fapi2
TargetType getFapiTargetType() const;
///
+ /// @brief Get the scom address overlay for this target
+ ///
+ /// @return Address overlay
+ ///
+ uint32_t getAddressOverlay() const
+ {
+ return (value & 0xFF000000);
+ }
+
+ ///
+ /// @brief Get the plat target type
+ ///
+ /// @return The plat target type as a fapi2::TargetType
+ ///
+ TargetType getTargetType() const
+ {
+ return static_cast<TargetType>(fields.type);
+ }
+
+ ///
/// @brief Get the instance number for this target
///
/// @return The instance number for this target
///
- inline uint32_t getTargetInstance() const
+ uint32_t getTargetInstance() const
{
return fields.type_target_num;
}
///
+ /// @brief Returns whether this target is functional
+ ///
+ /// @return true if Target is functional
+ ///
+ bool getFunctional() const
+ {
+ return fields.functional;
+ }
+
+ ///
+ /// @brief Set functional state of the Target
+ ///
+ /// @param [in] i_state Functional state to set
+ ///
+ void setFunctional(const bool &i_state)
+ {
+ fields.functional = i_state;
+ }
+
+ ///
+ /// @brief Returns whether this target is present
+ ///
+ /// @return true if Target is present
+ ///
+ bool getPresent() const
+ {
+ return fields.present;
+ }
+
+ ///
+ /// @brief Set Target as present
+ ///
+ void setPresent()
+ {
+ fields.present = true;
+ }
+
+ ///
/// @brief Get this target's children
///
/// @param [in] i_parentType fapi2 type of the parent
diff --git a/src/hwpf/include/plat/plat_target_utils.H b/src/hwpf/include/plat/plat_target_utils.H
index b97da650..523dfca4 100644
--- a/src/hwpf/include/plat/plat_target_utils.H
+++ b/src/hwpf/include/plat/plat_target_utils.H
@@ -30,6 +30,8 @@
#ifndef __FAPI2_PLAT_TARGET_UTIL__
#define __FAPI2_PLAT_TARGET_UTIL__
+#include <proc_sbe_fixed.H>
+
#pragma pack(8) //Start of packing to 8byte boundary
typedef struct {
fapi2attr::SystemAttributes_t G_system_attrs;
diff --git a/src/hwpf/include/plat/plat_utils.H b/src/hwpf/include/plat/plat_utils.H
new file mode 100644
index 00000000..eadee6aa
--- /dev/null
+++ b/src/hwpf/include/plat/plat_utils.H
@@ -0,0 +1,65 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/hwpf/include/plat/plat_utils.H $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2016 */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+#ifndef _PLAT_UTILS_H_
+#define _PLAT_UTILS_H_
+
+#ifdef __ASSEMBLER__
+
+#ifndef ULL
+#define ULL(x) x
+#endif
+
+#else
+
+#ifndef ULL
+#define ULL(x) x##ull
+
+#endif
+
+#endif // __ASSEMBLER
+
+/// Create a multi-bit mask of \a n bits starting at bit \a b
+#ifndef BITS
+ #define BITS(b, n) ((ULL(0xffffffffffffffff) << (64 - (n))) >> (b))
+#endif
+
+/// Create a single bit mask at bit \a b
+#ifndef BIT
+ #define BIT(b) BITS((b), 1)
+#endif
+
+#ifdef _BIG_ENDIAN
+
+#define revle16(x) x
+#define revle32(x) x
+#define revle64(x) x
+
+#else
+
+uint16_t revle16(uint16_t i_x);
+uint32_t revle32(uint32_t i_x);
+uint64_t revle64(uint64_t i_x);
+
+#endif
+#endif //_PLAT_UTILS_H_
diff --git a/src/hwpf/include/plat/target.H b/src/hwpf/include/plat/target.H
index bfcfe185..09c27d0b 100644
--- a/src/hwpf/include/plat/target.H
+++ b/src/hwpf/include/plat/target.H
@@ -38,6 +38,7 @@
#include <utils.H>
#include <stdint.h>
#include <vector>
+#include <plat_target_utils.H>
extern "C"
{
@@ -233,15 +234,15 @@ namespace fapi2
}
if((TARGET_TYPE_EQ == T) && (TARGET_TYPE_CORE == K)) // EC ===> EQ
{
- return static_cast<V>(G_vec_targets[(getTargetNumber() / CORES_PER_QUAD) + EQ_TARGET_OFFSET]);
+ return static_cast<V>(G_vec_targets[(static_cast<plat_target_handle_t>(get()).getTargetInstance() / CORES_PER_QUAD) + EQ_TARGET_OFFSET]);
}
if((TARGET_TYPE_EQ == T) && (TARGET_TYPE_EX == K)) // EX ===> EQ
{
- return static_cast<V>(G_vec_targets[(getTargetNumber() / EX_PER_QUAD) + EQ_TARGET_OFFSET]);
+ return static_cast<V>(G_vec_targets[(static_cast<plat_target_handle_t>(get()).getTargetInstance() / EX_PER_QUAD) + EQ_TARGET_OFFSET]);
}
if(TARGET_TYPE_EX == T) // EC ===> EX
{
- return static_cast<V>(G_vec_targets[(getTargetNumber() / CORES_PER_EX) + EX_TARGET_OFFSET]);
+ return static_cast<V>(G_vec_targets[(static_cast<plat_target_handle_t>(get()).getTargetInstance() / CORES_PER_EX) + EX_TARGET_OFFSET]);
}
}
@@ -310,33 +311,27 @@ namespace fapi2
}
///
- /// @brief Get the target at the other end of a bus - dimm included
- /// @tparam T The type of the parent
- /// @param[in] i_state The desired TargetState of the children
- /// @return Target<T, V> a target representing the thing on the other end
- /// @note Can be easily changed to a vector if needed
+ /// @brief Is the target functional?
+ /// @return true if target is functional, false if non-functional
///
template<TargetType K, typename V>
- template<TargetType T>
- inline Target<T, V>
- Target<K, V>::getOtherEnd(const TargetState i_state) const
+ inline bool
+ Target<K, V>::isFunctional(void) const
{
-// static_assert( false, "getOtherEnd() is not supported on PPE platforms");
+ return static_cast<plat_target_handle_t>(get()).getFunctional();
}
///
- /// @brief Is the target functional?
- /// @return true if target is functional, false if non-functional
+ /// @brief Returns the chiplet number for this Target
+ /// @return The chiplet number
///
-
template<TargetType K, typename V>
- inline bool
- Target<K, V>::isFunctional(void) const
+ inline uint8_t
+ Target<K, V>::getChipletNumber(void) const
{
- return getFunctional();
+ return static_cast<plat_target_handle_t>(iv_handle).fields.chiplet_num;
}
-
///
/// @brief Return the string interpretation of this target
/// @tparam T The type of the target
@@ -359,7 +354,7 @@ namespace fapi2
const uint32_t i_addr)
{
ScomAddr l_addr = i_addr;
- if(0 != i_target.getAddressOverlay())
+ if(0 != static_cast<plat_target_handle_t>(i_target.get()).getAddressOverlay())
{
l_addr.iv_chiplet = i_target.getChipletNumber();
}
@@ -376,13 +371,13 @@ namespace fapi2
{
l_addr.iv_chiplet = i_target.getChipletNumber();
l_addr.iv_ring = (l_addr.iv_ring - (l_addr.iv_ring % 2)) +
- (i_target.getTargetNumber() % 2);
+ (static_cast<plat_target_handle_t>(i_target.get()).getTargetInstance() % 2);
}
else if ((CORE_CHIPLET_OFFSET <= l_addr.iv_chiplet) &&
((CORE_CHIPLET_OFFSET + CORE_TARGET_COUNT) > l_addr.iv_chiplet))
{
l_addr.iv_chiplet = CORE_CHIPLET_OFFSET + (l_addr.iv_chiplet % 2) +
- (i_target.getTargetNumber() * 2);
+ (static_cast<plat_target_handle_t>(i_target.get()).getTargetInstance() * 2);
}
else
{
@@ -396,7 +391,7 @@ namespace fapi2
{
ScomAddr l_addr = i_addr;
l_addr.iv_chiplet = i_target.getChipletNumber();
- l_addr.iv_satId = (2 * (i_target.getTargetNumber() % 2));
+ l_addr.iv_satId = (2 * (static_cast<plat_target_handle_t>(i_target.get()).getTargetInstance() % 2));
return l_addr;
}
OpenPOWER on IntegriCloud