diff options
author | Sachin Gupta <sgupta2m@in.ibm.com> | 2015-06-30 02:13:08 -0500 |
---|---|---|
committer | Jennifer A. Stofer <stofer@us.ibm.com> | 2015-07-28 15:12:08 -0500 |
commit | 8fd7df0b85039d5dc5f8a23f0d80cbce7d30a600 (patch) | |
tree | 2911df3c710b674d1db421a44ffdc995dd1e01ee /hwpf/plat | |
parent | c2596d555aad0a91b2ddd4ea5d38fdb92649ee4b (diff) | |
download | talos-sbe-8fd7df0b85039d5dc5f8a23f0d80cbce7d30a600.tar.gz talos-sbe-8fd7df0b85039d5dc5f8a23f0d80cbce7d30a600.zip |
Target initialization using vectors
- Add initial getChildren implementation (for review only)
- Updated attribute generation scripts with better error messages
- Move functions to plat_target.H and target.C
- Allow for override of PPE_TYPE
Change-Id: Ib28fdd71413b33d43f0f7dc4711222da92a19237
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/18948
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Tested-by: Jennifer A. Stofer <stofer@us.ibm.com>
Diffstat (limited to 'hwpf/plat')
-rw-r--r-- | hwpf/plat/include/fapi2.H | 1 | ||||
-rw-r--r-- | hwpf/plat/include/fapi2_target.H | 118 | ||||
-rw-r--r-- | hwpf/plat/include/plat_target.H | 4 | ||||
-rw-r--r-- | hwpf/plat/include/plat_target_parms.H | 42 | ||||
-rw-r--r-- | hwpf/plat/include/plat_target_utils.H | 48 | ||||
-rw-r--r-- | hwpf/plat/include/target.H | 190 | ||||
-rw-r--r-- | hwpf/plat/include/target_types.H | 66 | ||||
-rw-r--r-- | hwpf/plat/src/fapi2ppefiles.mk | 8 | ||||
-rw-r--r-- | hwpf/plat/src/target.C | 142 |
9 files changed, 485 insertions, 134 deletions
diff --git a/hwpf/plat/include/fapi2.H b/hwpf/plat/include/fapi2.H index a3dd4fbe..178860fc 100644 --- a/hwpf/plat/include/fapi2.H +++ b/hwpf/plat/include/fapi2.H @@ -32,6 +32,7 @@ #include <error_scope.H> #include <set_sbe_error.H> // Generated file #include <plat_attributes.H> +#include <plat_target_utils.H> #include <hwp_executor.H> diff --git a/hwpf/plat/include/fapi2_target.H b/hwpf/plat/include/fapi2_target.H index 5c753e9e..47b6d55a 100644 --- a/hwpf/plat/include/fapi2_target.H +++ b/hwpf/plat/include/fapi2_target.H @@ -14,6 +14,13 @@ namespace fapi2 { + + + /// + /// @brief Typedef for chiplet number values + /// + typedef uint8_t ChipletNumber_t; + /// /// @brief Class representing a FAPI2 Target /// @tparam K the type (Kind) of target @@ -153,31 +160,6 @@ namespace fapi2 return iv_type; } -#ifdef __PPE__ - - /// Need to optimize PPE Target resoulution in a cheap manner - /// Brian: not sure if the this is the place for this as - /// this is plaform specific. - - /// - /// @brief Get address overlay to reduce runtime processing - /// @return Overlay as a type V - /// - inline V getAddressOverlay(void) const - { - return this->iv_handle.fields.address_overlay; - } - - /// - /// @brief Get address overlay to reduce runtime processing - /// @return Overlay as a type V - /// - inline uint32_t getTargetNumber(void) const - { - return static_cast<uint32_t>(this->iv_handle.fields.type_target_num); - } -#endif - /// /// @brief Get this target's immediate parent /// @tparam T The type of the parent @@ -266,6 +248,90 @@ namespace fapi2 "unable to cast to specialized Target"); } +#ifdef __PPE__ + + /// + /// @brief Get the target present setting + /// @return Bool whether present + /// + inline bool getPresent(void) const + { + return (this->iv_handle.fields.present ? true : false); + } + + /// + /// @brief Get the target functional setting + /// @return Bool whether functional + /// + inline bool getFunctional(void) const + { + return (this->iv_handle.fields.functional ? true : false); + } + + /// + /// @brief Set the target present setting + /// @return Bool whether present + /// + inline void setPresent(void) const + { + this->iv_handle.fields.present = 1; + return; + } + + /// + /// @brief Set the target functional setting + /// @return Bool whether functional + /// + inline void setFunctional(void) const + { + this->iv_handle.fields.functional = 1; + return; + } + + + /// Need to optimize PPE Target resoulution in a cheap manner + /// Brian: not sure if the this is the place for this as + /// this is plaform specific. + + /// + /// @brief Get address overlay to reduce runtime processing + /// @return Overlay as a type V + /// + inline V getAddressOverlay(void) const + { + return this->iv_handle.fields.address_overlay; + } + + /// + /// @brief Get target number + /// @return Overlay as a type V + /// + inline uint32_t getTargetNumber(void) const + { + return static_cast<uint32_t>(this->iv_handle.fields.type_target_num); + } + + /// + /// @brief Get target type directly from the handle + /// @return Overlay as a type V + /// + inline TargetTypes_t getTargetType(void) const + { + return static_cast<TargetTypes_t>(this->iv_handle.fields.type); + } + + /// + /// @brief Get chiplet number from the handle + /// @return ChipletNumber_t Chiplet Number + /// + inline ChipletNumber_t getChipletNumber(void) const + { + return static_cast<ChipletNumber_t>(this->iv_handle.fields.chiplet_num); + } + +#endif + + private: // Don't use enums here as it makes it hard to assign // in the platform target cast constructor. @@ -296,7 +362,7 @@ namespace fapi2 // iv_handle(V i_value = 0):value(i_value) {} } iv_handle; }; - + // EX threads map to CORE threads: // t0 / t2 / t4 / t6 fused = t0 / t1 / t2 / t3 normal (c0) // t1 / t3 / t5 / t7 fused = t0 / t1 / t2 / t3 normal (c1) diff --git a/hwpf/plat/include/plat_target.H b/hwpf/plat/include/plat_target.H index 86c70465..1e6a5b70 100644 --- a/hwpf/plat/include/plat_target.H +++ b/hwpf/plat/include/plat_target.H @@ -30,6 +30,8 @@ #ifndef __FAPI2_PLAT_TARGET__ #define __FAPI2_PLAT_TARGET__ +#include <return_code.H> + // // Define what a platform handle looks like. For Hostboot, // for example, this might be a void*. For the SBE, this @@ -38,6 +40,6 @@ namespace fapi2 { typedef uint64_t plat_target_handle_t; -} +} #endif diff --git a/hwpf/plat/include/plat_target_parms.H b/hwpf/plat/include/plat_target_parms.H index 6056dcf5..bbe4b8ba 100644 --- a/hwpf/plat/include/plat_target_parms.H +++ b/hwpf/plat/include/plat_target_parms.H @@ -32,30 +32,40 @@ #include "fapi_sbe_common.H" -CONST_UINT64_T(CHIPLET_COUNT, 0x38); -CONST_UINT64_T(CHIP_TARGET_COUNT , 1); -CONST_UINT64_T(CHIP_TARGET_OFFSET, 0); +CONST_UINT32_T(CHIP_TARGET_OFFSET, 0); +CONST_UINT32_T(CHIP_TARGET_COUNT , 1); -CONST_UINT64_T(PERV_TARGET_OFFSET, CHIP_TARGET_OFFSET + CHIP_TARGET_COUNT); -CONST_UINT64_T(PERV_CHIPLET_OFFSET, 0x1); -CONST_UINT64_T(PERV_TARGET_COUNT, 15); -CONST_UINT64_T(EQ_TARGET_OFFSET, PERV_TARGET_OFFSET + PERV_TARGET_COUNT); -CONST_UINT64_T( EQ_CHIPLET_OFFSET, 0x10); -CONST_UINT64_T(EQ_TARGET_COUNT, 6); +CONST_UINT32_T(PERV_TARGET_OFFSET, CHIP_TARGET_OFFSET + CHIP_TARGET_COUNT); +CONST_UINT32_T(PERV_CHIPLET_OFFSET, 0x1); +CONST_UINT32_T(PERV_TARGET_COUNT, 15); -CONST_UINT64_T( CORE_TARGET_OFFSET, EQ_TARGET_OFFSET + EQ_TARGET_COUNT); -CONST_UINT64_T( CORE_CHIPLET_OFFSET, 0x20); -CONST_UINT64_T(CORE_TARGET_COUNT, 24); +CONST_UINT32_T(EQ_TARGET_OFFSET, PERV_TARGET_OFFSET + PERV_TARGET_COUNT); +CONST_UINT32_T(EQ_CHIPLET_OFFSET, 0x10); +CONST_UINT32_T(EQ_TARGET_COUNT, 6); -CONST_UINT64_T( EX_TARGET_OFFSET, CORE_TARGET_OFFSET + CORE_TARGET_COUNT); -CONST_UINT64_T( EX_CHIPLET_OFFSET, 0x10); -CONST_UINT64_T(EX_TARGET_COUNT, 12); +CONST_UINT32_T(CORE_TARGET_OFFSET, EQ_TARGET_OFFSET + EQ_TARGET_COUNT); +CONST_UINT32_T(CORE_CHIPLET_OFFSET, 0x20); +CONST_UINT32_T(CORE_TARGET_COUNT, 24); +CONST_UINT32_T(MCS_TARGET_OFFSET, CORE_TARGET_OFFSET + CORE_TARGET_COUNT); +CONST_UINT32_T(MCS_CHIPLET_OFFSET, 0x7); +CONST_UINT32_T(MCS_TARGET_COUNT, 2); -CONST_UINT64_T(TARGET_COUNT, EX_TARGET_OFFSET + EX_TARGET_COUNT); +CONST_UINT32_T(EX_TARGET_OFFSET, MCS_TARGET_OFFSET + MCS_TARGET_COUNT); +CONST_UINT32_T(EX_CHIPLET_OFFSET, 0x10); +CONST_UINT32_T(EX_TARGET_COUNT, 12); +//CONST_UINT32_T(TARGET_COUNT, EX_TARGET_OFFSET + EX_TARGET_COUNT); + +CONST_UINT32_T(TARGET_COUNT, CHIP_TARGET_COUNT + + PERV_TARGET_COUNT + + EQ_TARGET_COUNT + + CORE_TARGET_COUNT + + MCS_TARGET_COUNT + + EX_TARGET_COUNT); + #endif // __FAPI2_PPE_TARGET_PARMS__ diff --git a/hwpf/plat/include/plat_target_utils.H b/hwpf/plat/include/plat_target_utils.H new file mode 100644 index 00000000..e1e360c0 --- /dev/null +++ b/hwpf/plat/include/plat_target_utils.H @@ -0,0 +1,48 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2012,2014 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* 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 */ +/** + * @file plat_target_util.H + * @brief platform utility definitions for fapi2 targets + */ + +#ifndef __FAPI2_PLAT_TARGET_UTIL__ +#define __FAPI2_PLAT_TARGET_UTIL__ + +// +// Platform Utility functions.. +// +namespace fapi2 +{ + + /// @brief Function to initialize the G_targets vector based on partial good + /// attributes + ReturnCode plat_TargetsInit(); + + /// @brief Function to initialize the G_targets vector based on partial good + /// attributes + Target<TARGET_TYPE_PROC_CHIP> plat_getChipTarget(); + +} +#endif diff --git a/hwpf/plat/include/target.H b/hwpf/plat/include/target.H index e2fe550b..cce4e86e 100644 --- a/hwpf/plat/include/target.H +++ b/hwpf/plat/include/target.H @@ -33,11 +33,19 @@ #include <plat_target.H> #include <plat_target_parms.H> #include <fapi2_target.H> +#include <plat_trace.H> #include <utils.H> #include <stdio.h> +#include <stdint.h> +#include <vector> + +extern "C" +{ + extern std::vector<fapi2::plat_target_handle_t> G_vec_targets; +} namespace fapi2 -{ +{ /// @brief Create a Target, with a value /// @param[in] Value the value (i.e., specific element this /// target represents, or pointer) @@ -51,20 +59,20 @@ namespace fapi2 static_assert( ((K == TARGET_TYPE_CORE) & (K == TARGET_TYPE_EQ) ) != true, "TARGET_TYPE_CORE and TARGET_TYPE_EQ cannot be specified at the same time"); - + this->iv_handle.value = 0; if(K & TARGET_TYPE_PROC_CHIP) { - this->iv_handle.fields.chiplet_num = Value; + this->iv_handle.fields.chiplet_num = 0; this->iv_handle.fields.type = TARGET_TYPE_PROC_CHIP; - this->iv_handle.fields.type_target_num = Value; // TODO: check this + this->iv_handle.fields.type_target_num = 0; } if(K & TARGET_TYPE_PERV) { this->iv_handle.fields.chiplet_num = Value; - this->iv_handle.fields.type = TARGET_TYPE_PERV | TARGET_TYPE_PROC_CHIP; - this->iv_handle.fields.type_target_num = Value; // TODO: check this + this->iv_handle.fields.type = TARGET_TYPE_PERV; + this->iv_handle.fields.type_target_num = Value; } if(K & TARGET_TYPE_CORE) @@ -77,89 +85,97 @@ namespace fapi2 } */ this->iv_handle.fields.chiplet_num = Value + CORE_CHIPLET_OFFSET; - this->iv_handle.fields.type = TARGET_TYPE_CORE; - this->iv_handle.fields.type_target_num = Value; + this->iv_handle.fields.type = TARGET_TYPE_CORE | TARGET_TYPE_PERV; + this->iv_handle.fields.type_target_num = Value; } if(K & TARGET_TYPE_EQ) { this->iv_handle.fields.chiplet_num = Value + EQ_CHIPLET_OFFSET; - this->iv_handle.fields.type = TARGET_TYPE_EQ; - this->iv_handle.fields.type_target_num = Value; + this->iv_handle.fields.type = TARGET_TYPE_EQ | TARGET_TYPE_PERV; + this->iv_handle.fields.type_target_num = Value; } - + if(K & TARGET_TYPE_EX) - { - - this->iv_handle.fields.chiplet_num = (Value / 2) + EX_CHIPLET_OFFSET; - this->iv_handle.fields.type = TARGET_TYPE_EX; + { + + this->iv_handle.fields.chiplet_num = (Value / 2) + EX_CHIPLET_OFFSET; + this->iv_handle.fields.type = TARGET_TYPE_EX | TARGET_TYPE_PERV; this->iv_handle.fields.type_target_num = Value; - this->iv_handle.fields.present = 1; } - + + if(K & TARGET_TYPE_MCS) + { + + this->iv_handle.fields.chiplet_num = Value + MCS_CHIPLET_OFFSET; + this->iv_handle.fields.type = TARGET_TYPE_MCS | TARGET_TYPE_PERV; + this->iv_handle.fields.type_target_num = Value; + } + // if(K & TARGET_TYPE_EQ_MC_WRITE) // { -// this->iv_handle.fields.chiplet_num = -// (((MC_ENABLE) | +// this->iv_handle.fields.chiplet_num = +// (((MC_ENABLE) | // ((MC_WRITE << 3) | (Value & 0x07))) & // BITS(57,7)); // this->iv_handle.fields.type = TARGET_TYPE_EQ_MC_WRITE; // } -// +// // if(K & TARGET_TYPE_EQ_MC_READOR) // { -// this->iv_handle.fields.chiplet_num = -// (((MC_ENABLE) | +// this->iv_handle.fields.chiplet_num = +// (((MC_ENABLE) | // ((MC_READ_OR << 3) | (Value & 0x07))) & // BITS(57,7)); // this->iv_handle.fields.type = TARGET_TYPE_EQ_MC_READOR; // } -// +// // if(K & TARGET_TYPE_EQ_MC_READAND) // { -// this->iv_handle.fields.chiplet_num = -// (((MC_ENABLE) | +// this->iv_handle.fields.chiplet_num = +// (((MC_ENABLE) | // ((MC_READ_AND << 3) | (Value & 0x07))) & // BITS(57,7)); -// this->iv_handle.fields.type = TARGET_TYPE_EQ_MC_READAND; +// this->iv_handle.fields.type = TARGET_TYPE_EQ_MC_READAND; // } -// +// // if(K & TARGET_TYPE_CORE_MC_WRITE) // { -// this->iv_handle.fields.chiplet_num = -// (((MC_ENABLE) | +// this->iv_handle.fields.chiplet_num = +// (((MC_ENABLE) | // ((MC_WRITE << 3) | (Value & 0x07))) & // BITS(57,7)); // this->iv_handle.fields.type = TARGET_TYPE_CORE_MC_WRITE; // } -// +// // if(K & TARGET_TYPE_CORE_MC_READOR) // { -// this->iv_handle.fields.chiplet_num = -// (((MC_ENABLE) | +// this->iv_handle.fields.chiplet_num = +// (((MC_ENABLE) | // ((MC_READ_OR << 3) | (Value & 0x07))) & // BITS(57,7)); // this->iv_handle.fields.type = TARGET_TYPE_CORE_MC_READOR; // } -// +// // if(K & TARGET_TYPE_CORE_MC_READAND) // { -// this->iv_handle.fields.chiplet_num = -// (((MC_ENABLE) | +// this->iv_handle.fields.chiplet_num = +// (((MC_ENABLE) | // ((MC_READ_AND << 3) | (Value & 0x07))) & // BITS(57,7)); // this->iv_handle.fields.type = TARGET_TYPE_CORE_MC_READAND; // } - + if(K == TARGET_TYPE_ALL) { this->iv_handle.fields.chiplet_num = Value; this->iv_handle.fields.type = TARGET_TYPE_ALL; - } + } this->iv_handle.fields.present = 1; - this->iv_handle.fields.address_overlay = - this->iv_handle.fields.chiplet_num << 24; - + this->iv_handle.fields.functional = 1; + this->iv_handle.fields.address_overlay = + (this->iv_handle.fields.chiplet_num << 24); + } /// @@ -172,7 +188,7 @@ namespace fapi2 { this->iv_handle.value = i_right->iv_handle.value; return *this; - } + } /// /// @brief Equality Comparison Operator /// @param[in] i_right Reference to Target to compare. @@ -231,10 +247,94 @@ namespace fapi2 inline std::vector<Target<T> > Target<K, V>::getChildren(const TargetState i_state) const { - // To keep the compiler quiet about unused variables - static_cast<void>(i_state); - // For testing - return {Target<T>(), Target<T>()}; +#define INVALID_CHILD(PARENT, CHILD) \ + static_assert(!((K == PARENT) && (T == CHILD)), \ + #CHILD " is not a child of " #PARENT ); + + // invalid children for proc +// INVALID_CHILD(fapi2::TARGET_TYPE_PROC_CHIP, fapi2::TARGET_TYPE_NONE) +// INVALID_CHILD(fapi2::TARGET_TYPE_PROC_CHIP, fapi2::TARGET_TYPE_SYSTEM) +// INVALID_CHILD(fapi2::TARGET_TYPE_PROC_CHIP, fapi2::TARGET_TYPE_DIMM) +// INVALID_CHILD(fapi2::TARGET_TYPE_PROC_CHIP, fapi2::TARGET_TYPE_PROC_CHIP) +// INVALID_CHILD(fapi2::TARGET_TYPE_PROC_CHIP, fapi2::TARGET_TYPE_MEMBUF_CHIP) +// INVALID_CHILD(fapi2::TARGET_TYPE_PROC_CHIP, fapi2::TARGET_TYPE_MBA) +#undef INVALID_CHILD + +#define INVALID_PARENT(PARENT) \ + static_assert(!((K == PARENT)), \ + #PARENT "is not supported on PPE platforms"); + + // invalid parents +// INVALID_PARENT(fapi2::TARGET_TYPE_SYSTEM) +// INVALID_PARENT(fapi2::TARGET_TYPE_MEMBUF_CHIP) +// INVALID_PARENT(fapi2::TARGET_TYPE_L4) +// INVALID_PARENT(fapi2::TARGET_TYPE_DIMM) +// INVALID_PARENT(fapi2::TARGET_TYPE_MCA) +// INVALID_PARENT(fapi2::TARGET_TYPE_MBA) +// INVALID_PARENT(fapi2::TARGET_TYPE_MI) +// INVALID_PARENT(fapi2::TARGET_TYPE_MCBIST) +// INVALID_PARENT(fapi2::TARGET_TYPE_DMI) +#undef INVALID_PARENT + + // valid children for EQ + // EQ -> CORE + // EQ -> EX + static_assert(!((K == fapi2::TARGET_TYPE_EQ) && + (T != fapi2::TARGET_TYPE_CORE) && + (T != fapi2::TARGET_TYPE_EX)), + "improper child of fapi2::TARGET_TYPE_EQ"); + + // valid children for EX + // EX -> CORE + static_assert(!((K == fapi2::TARGET_TYPE_EX) && + (T != fapi2::TARGET_TYPE_CORE)), + "improper child of fapi2::TARGET_TYPE_EX"); + + // Nimbus Memory + // valid children for MCS + // MCS -> MCA +// static_assert(!((K == fapi2::TARGET_TYPE_MCS) && +// (T != fapi2::TARGET_TYPE_MCA)), +// "improper child of fapi2::TARGET_TYPE_MCS"); + + + std::vector<fapi2::plat_target_handle_t>::iterator l_iter; + FAPI_DBG("getChildren: initializing children vector"); + std::vector<Target<T> > l_children; + + + + uint32_t c = 0; + for (l_iter = G_vec_targets.begin(); l_iter != G_vec_targets.end(); ++l_iter) + { + + Target<T> * l_temp = reinterpret_cast< Target<T>* >(l_iter); + if (((*l_temp).getTargetType() & T) == T) + { + switch (i_state) + { + case TARGET_STATE_PRESENT: + if ((*l_temp).getPresent()) + { + l_children.push_back((*l_temp)); +// FAPI_DBG("Pushing getChildren present 0x%08X", (uint32_t)(((*l_temp)).get()>>32)); + } + break; + case TARGET_STATE_FUNCTIONAL: + if ((*l_temp).getFunctional()) + { + l_children.push_back((*l_temp)); +// FAPI_DBG("Pushing getChildren functional 0x%08X", (uint32_t)(((*l_temp)).get()>>32)); + } + break; + default: + FAPI_ERR("Coming error ASSERT for illegal i_state = %u", i_state); + } + } + ++c; + } + + return l_children; } /// diff --git a/hwpf/plat/include/target_types.H b/hwpf/plat/include/target_types.H index 4db4cf26..352e4732 100644 --- a/hwpf/plat/include/target_types.H +++ b/hwpf/plat/include/target_types.H @@ -57,50 +57,34 @@ namespace fapi2 TARGET_TYPE_MCAST = 0x80, ///< Multicast type TARGET_TYPE_ALL = 0xFF, ///< Any/All types - - -// TARGET_TYPE_NONE = 0x00000000, ///< No type -// TARGET_TYPE_SYSTEM = 0x00000001, ///< System type -// TARGET_TYPE_DIMM = 0x00000002, ///< DIMM type -// TARGET_TYPE_PROC_CHIP = 0x00000004, ///< Processor type -// TARGET_TYPE_MEMBUF_CHIP = 0x00000008, ///< Membuf type -// TARGET_TYPE_EX = 0x00000010, ///< Ex type -// TARGET_TYPE_MBA = 0x00000020, ///< MBA type -// TARGET_TYPE_MCS = 0x00000040, ///< MCS type -// TARGET_TYPE_XBUS = 0x00000080, ///< XBUS type -// TARGET_TYPE_ABUS = 0x00000100, ///< ABUS type -// TARGET_TYPE_L4 = 0x00000200, ///< L4 type -// TARGET_TYPE_CORE = 0x00000400, ///< Core type -// TARGET_TYPE_EQ = 0x00000800, ///< EQ type -// TARGET_TYPE_MCA = 0x00001000, ///< MCA type -// TARGET_TYPE_MCBIST = 0x00002000, ///< MCBIST type -// TARGET_TYPE_MIA = 0x00004000, ///< MIA type -// TARGET_TYPE_MIS = 0x00008000, ///< MIS type -// TARGET_TYPE_DMI = 0x00010000, ///< DMI type -// TARGET_TYPE_OBUS = 0x00020000, ///< OBUS type -// TARGET_TYPE_NV = 0x00040000, ///< NV bus type -// TARGET_TYPE_SBE = 0x00080000, ///< SBE type -// TARGET_TYPE_PPE = 0x00100000, ///< PPE type -// TARGET_TYPE_PERV = 0x00200000, ///< Pervasive type -// TARGET_TYPE_PEC = 0x00400000, ///< PEC type -// TARGET_TYPE_PHB = 0x00800000, ///< PHB type -// TARGET_TYPE_EQ_MC_WRITE = 0x01000000, ///< EQ Multicast Type -// TARGET_TYPE_EQ_MC_READAND = 0x02000000, ///< EQ Multicast Read AND Type -// TARGET_TYPE_EQ_MC_READOR = 0x04000000, ///< EQ Multicast Read OR Type -// TARGET_TYPE_CORE_MC_WRITE = 0x08000000, ///< Core Multicast Type -// TARGET_TYPE_CORE_MC_READAND = 0x10000000, ///< Core Multicast Read AND Type -// TARGET_TYPE_CORE_MC_READOR = 0x20000000, ///< Core Multicast Read OR Type -// TARGET_TYPE_CME_CORE0 = 0x40000000, ///< CME Core0 (CME only) -// TARGET_TYPE_CME_CORE1 = 0x80000000, ///< CME Core1 (CME only) -// TARGET_TYPE_ADDRESS = 0xAAAAAAAA, ///< Address Overlay Type -// TARGET_TYPE_ALL = 0xFFFFFFFF, ///< Any/All types + + // The following are actually illegal targets on PPE platforms +// TARGET_TYPE_SYSTEM = 0xFE, ///< System type +// TARGET_TYPE_DIMM = 0xFD, ///< DIMM type +// TARGET_TYPE_MEMBUF_CHIP = 0xFC, ///< Membuf type +// TARGET_TYPE_MBA = 0xFB, ///< MBA type +// TARGET_TYPE_XBUS = 0xFA, ///< XBUS type +// TARGET_TYPE_ABUS = 0xF9, ///< ABUS type +// TARGET_TYPE_L4 = 0xF8, ///< L4 type +// TARGET_TYPE_MCA = 0xF7, ///< MCA type +// TARGET_TYPE_MCBIST = 0xF6, ///< MCBIST type +// TARGET_TYPE_MIA = 0xF5, ///< MIA type +// TARGET_TYPE_MIS = 0xF4, ///< MIS type +// TARGET_TYPE_DMI = 0xF3, ///< DMI type +// TARGET_TYPE_OBUS = 0xF2, ///< OBUS type +// TARGET_TYPE_NV = 0xF1, ///< NV bus type +// TARGET_TYPE_SBE = 0xF0, ///< SBE type +// TARGET_TYPE_PPE = 0xEF, ///< PPE type +// TARGET_TYPE_PEC = 0xEE, ///< PEC type +// TARGET_TYPE_PHB = 0xED, ///< PHB type +// TARGET_TYPE_MI = 0xEC, ///< MI type // Mappings to target types found in the error xml files TARGET_TYPE_EX_CHIPLET = TARGET_TYPE_EX, -// TARGET_TYPE_MBA_CHIPLET = TARGET_TYPE_MBA, -// TARGET_TYPE_MCS_CHIPLET = TARGET_TYPE_MCS, -// TARGET_TYPE_XBUS_ENDPOINT = TARGET_TYPE_XBUS, -// TARGET_TYPE_ABUS_ENDPOINT = TARGET_TYPE_ABUS, +// TARGET_TYPE_MBA_CHIPLET = TARGET_TYPE_MBA, + TARGET_TYPE_MCS_CHIPLET = TARGET_TYPE_MCS, +// TARGET_TYPE_XBUS_ENDPOINT = TARGET_TYPE_XBUS, +// TARGET_TYPE_ABUS_ENDPOINT = TARGET_TYPE_ABUS, }; /// diff --git a/hwpf/plat/src/fapi2ppefiles.mk b/hwpf/plat/src/fapi2ppefiles.mk index 1f913872..f2e72670 100644 --- a/hwpf/plat/src/fapi2ppefiles.mk +++ b/hwpf/plat/src/fapi2ppefiles.mk @@ -18,11 +18,13 @@ ########################################################################## -FAPI2-C-SOURCES += fapi2PlatAttributeService.C -FAPI2-C-SOURCES += plat_utils.C +FAPI2-CPP-SOURCES += fapi2PlatAttributeService.C +FAPI2-CPP-SOURCES += target.C +FAPI2-CPP-SOURCES += plat_utils.C FAPI2-S-SOURCES = -FAPI2LIB_OBJECTS += $(FAPI2-C-SOURCES:.C=.o) $(FAPI2-S-SOURCES:.S=.o) +FAPI2LIB_OBJECTS += $(FAPI2-CPP-SOURCES:.C=.o) +FAPI2LIB_OBJECTS += $(FAPI2-S-SOURCES:.S=.o) diff --git a/hwpf/plat/src/target.C b/hwpf/plat/src/target.C index fc5f4392..4b422f3c 100644 --- a/hwpf/plat/src/target.C +++ b/hwpf/plat/src/target.C @@ -24,12 +24,150 @@ /* IBM_PROLOG_END_TAG */ #include <target.H> +#include <new> +#include <utility> // For move +// Global Vector containing ALL targets. This structure is referenced by +// fapi2::getChildren to produce the resultant returned vector from that +// call. +std::vector<fapi2::plat_target_handle_t> G_vec_targets; namespace fapi2 { - std::vector Target::getChildren(void) const -}; + #ifndef __noRC__ + ReturnCode current_err; + #endif + + /// @brief Function to initialize the G_targets vector based on partial good + /// attributes /// this will move to plat_target.H formally + fapi2::ReturnCode plat_TargetsInit() + { + + // This is workaround. Currently we do not have code to initialise + // global objects. So initializing global objects against using local + // initialized object + std::vector<fapi2::plat_target_handle_t> targets1; + G_vec_targets = std::move(targets1); + std::vector<fapi2::plat_target_handle_t>::iterator tgt_iter; + uint32_t l_beginning_offset; + + FAPI_DBG("Platform target initialization. Target Count = %u", TARGET_COUNT); + // Initialize all entries to NULL + for (uint32_t i = 0; i < TARGET_COUNT; ++i) + { + G_vec_targets.push_back((fapi2::plat_target_handle_t)0x0); + FAPI_DBG("Nulling G_vec_targets[%u] hi value=0x%08X", + i, (uint32_t)(G_vec_targets.at(i)>>32)); + // FAPI_DBG("Nulling G_vec_targets[%u] lo value=0x%08X", + // i, (uint32_t)(G_vec_targets.at(i)&0x00000000ffffffffull)); + } + FAPI_DBG("Vector size: %u", G_vec_targets.size()); + + // Chip Target is the first one + FAPI_DBG("Chip Target info: CHIP_TARGET_OFFSET %u CHIP_TARGET_COUNT %u ", + CHIP_TARGET_OFFSET,CHIP_TARGET_COUNT); + + + l_beginning_offset = CHIP_TARGET_OFFSET; + FAPI_DBG("Chip beginning offset =%u", l_beginning_offset); + for (uint32_t i = 0; i < CHIP_TARGET_COUNT; ++i) + { + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> target_name((fapi2::plat_target_handle_t)i); + G_vec_targets.at(l_beginning_offset+i) = revle64((fapi2::plat_target_handle_t)(target_name.get())); + // FAPI_DBG("Chip Target initialization: %u G_vec_targets[%u] value=0x%08X", + // i, + // (l_beginning_offset+i), + // (uint32_t)(G_vec_targets.at(l_beginning_offset+i)>>32)); + } + + // Chip Level Pervasive Targets + FAPI_DBG("Pervasive Target info: PERV_TARGET_OFFSET %u PERV_TARGET_COUNT %u", + PERV_TARGET_OFFSET, PERV_TARGET_COUNT); + + l_beginning_offset = PERV_TARGET_OFFSET; + FAPI_DBG("Perv beginning offset =%u", l_beginning_offset); + for (uint32_t i = 0; i < PERV_TARGET_COUNT; ++i) + { + fapi2::Target<fapi2::TARGET_TYPE_PERV> target_name((fapi2::plat_target_handle_t)i); + FAPI_DBG("target_name hi word = 0x%08X", (uint32_t)(target_name.get()>>32)); + + G_vec_targets.at(l_beginning_offset+i) = revle64((fapi2::plat_target_handle_t)(target_name.get())); + // FAPI_DBG("Pervasive Target initialization: %u G_vec_targets[%u] value=0x%08X", + // i, + // (l_beginning_offset+i), + // (uint32_t)(G_vec_targets.at(l_beginning_offset+i)>>32)); + } + // Cache (EQ) Targets + FAPI_DBG("EQ Target info: EQ_TARGET_OFFSET %u EQ_TARGET_COUNT %u", + EQ_TARGET_OFFSET, EQ_TARGET_COUNT); + l_beginning_offset = EQ_TARGET_OFFSET; + FAPI_DBG("EQ beginning offset =%u", l_beginning_offset); + for (uint32_t i = 0; i < EQ_TARGET_COUNT; ++i) + { + fapi2::Target<fapi2::TARGET_TYPE_EQ> target_name((fapi2::plat_target_handle_t)i); + FAPI_DBG("target_name hi word = 0x%08X", (uint32_t)(target_name.get()>>32)); + G_vec_targets.at(l_beginning_offset+i) = revle64((fapi2::plat_target_handle_t)(target_name.get())); + // FAPI_DBG("EQ Target initialization: %u G_vec_targets[%u] value=%16llX", + // i, + // (l_beginning_offset+i), + // revle64((uint64_t)G_vec_targets[l_beginning_offset+i])); + } + // Core (EC) Targets + FAPI_DBG("Core Target info: CORE_TARGET_OFFSET %u CORE_TARGET_COUNT %u", + CORE_TARGET_OFFSET, CORE_TARGET_COUNT); + + l_beginning_offset = CORE_TARGET_OFFSET; + FAPI_DBG("Core beginning offset =%u", l_beginning_offset); + for (uint32_t i = 0; i < CORE_TARGET_COUNT; ++i) + { + fapi2::Target<fapi2::TARGET_TYPE_CORE> target_name((fapi2::plat_target_handle_t)i); + FAPI_DBG("target_name hi word = 0x%08X", (uint32_t)(target_name.get()>>32)); + G_vec_targets.at(l_beginning_offset+i) = revle64((fapi2::plat_target_handle_t)(target_name.get())); + // FAPI_DBG("Core Target initialization: %u G_vec_targets[%u] value=0x%08X", + // i, + // (l_beginning_offset+i), + // (uint32_t)(G_vec_targets.at(l_beginning_offset+i)>>32)); + } + + // Memroy Controller Synchronous (MCS) Targets + FAPI_DBG("MCS Target info: MCS_TARGET_OFFSET %u MCS_TARGET_COUNT %u", + MCS_TARGET_OFFSET, MCS_TARGET_COUNT); + + l_beginning_offset = MCS_TARGET_OFFSET; + FAPI_DBG("MCS beginning offset =%u", l_beginning_offset); + for (uint32_t i = 0; i < MCS_TARGET_COUNT; ++i) + { + fapi2::Target<fapi2::TARGET_TYPE_MCS> target_name((fapi2::plat_target_handle_t)i); + FAPI_DBG("target_name hi word = 0x%08X", (uint32_t)(target_name.get()>>32)); + G_vec_targets.at(l_beginning_offset+i) = revle64((fapi2::plat_target_handle_t)(target_name.get())); + // FAPI_DBG("MCS Target initialization: %u G_vec_targets[%u] value=0x%08X", + // i, + // (l_beginning_offset+i), + // (uint32_t)(G_vec_targets.at(l_beginning_offset+i)>>32)); + } + + // Trace all entries + uint32_t c = 0; + for (tgt_iter = G_vec_targets.begin(); tgt_iter != G_vec_targets.end(); ++tgt_iter) + { + FAPI_DBG("Trace hi word G_vec_targets[%u] value=%08X", + c, (uint32_t)((*tgt_iter)>>32)); + ++c; + } + + return fapi2::current_err; + } + + /// @brief Function to initialize the G_targets vector based on partial good + /// attributes + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> plat_getChipTarget() + { + + // Get the chip specific target + return ((fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>)G_vec_targets.at(0)); + } + +}; |