diff options
author | Santosh Puranik <santosh.puranik@in.ibm.com> | 2016-07-28 13:24:10 -0500 |
---|---|---|
committer | Sachin Gupta <sgupta2m@in.ibm.com> | 2016-08-01 23:35:22 -0400 |
commit | 3c4c747abb8c92c71182968cdf002314de0d5769 (patch) | |
tree | e97ee53d5532bcaf6c7223c3adb7fa1b04369ddd /hwpf | |
parent | c6510c428168eeb379377613868dfa884a653314 (diff) | |
download | talos-sbe-3c4c747abb8c92c71182968cdf002314de0d5769.tar.gz talos-sbe-3c4c747abb8c92c71182968cdf002314de0d5769.zip |
Support getting FAPI Target type and instance
-- Use mirrored target_types.H
Change-Id: If6c30b2122980470f8a7a5acffcc59df9304e979
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/27592
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Gregory S. Still <stillgs@us.ibm.com>
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Diffstat (limited to 'hwpf')
-rw-r--r-- | hwpf/include/error_info.H | 2 | ||||
-rw-r--r-- | hwpf/include/error_info_defs.H | 6 | ||||
-rw-r--r-- | hwpf/include/fapi2_target.H | 4 | ||||
-rw-r--r-- | hwpf/include/plat/plat_target.H | 24 | ||||
-rw-r--r-- | hwpf/include/plat/plat_target_filter.H | 90 | ||||
-rw-r--r-- | hwpf/include/plat/target.H | 71 | ||||
-rw-r--r-- | hwpf/include/target_types.H | 255 | ||||
-rw-r--r-- | hwpf/src/plat/target.C | 37 |
8 files changed, 216 insertions, 273 deletions
diff --git a/hwpf/include/error_info.H b/hwpf/include/error_info.H index 433eab75..539f4587 100644 --- a/hwpf/include/error_info.H +++ b/hwpf/include/error_info.H @@ -57,7 +57,7 @@ template<fapi2::TargetType T> inline uint64_t convertType( const fapi2::Target<T>& i_value) { // get the SBE platform target handle - return static_cast<uint64_t>(i_value.get().value); + return static_cast<uint64_t>((static_cast<uint64_t>((i_value.get().getFapiTargetType())) << 32) | i_value.get().getTargetInstance()); }; #endif diff --git a/hwpf/include/error_info_defs.H b/hwpf/include/error_info_defs.H index 141dd6e6..38b25a1c 100644 --- a/hwpf/include/error_info_defs.H +++ b/hwpf/include/error_info_defs.H @@ -262,11 +262,9 @@ inline fapi2::ffdc_t getFfdcData( sbeFfdc_t& i_sbeFfdc ) if(i_sbeFfdc.size == EI_FFDC_SIZE_TARGET ) { fapi2::TargetType type = TARGET_TYPE_EX; - uint8_t instance = 0; - // 1 convert from SBE targetPointer to TYPE/INSTANCE - // convertSbePlatPtr( i_sbeFfdcPtr->data, type, instance ); + uint64_t targetData = i_sbeFfdc.data; // call hostboot to get the fapi2 target - temp.ptr() = static_cast<void*>(getTarget(type, instance)); + temp.ptr() = static_cast<void*>(getTarget((targetData >> 32), static_cast<uint8_t>(targetData & 0xFFFFFFFF))); } else { diff --git a/hwpf/include/fapi2_target.H b/hwpf/include/fapi2_target.H index f32b9d4c..dd08ac24 100644 --- a/hwpf/include/fapi2_target.H +++ b/hwpf/include/fapi2_target.H @@ -356,9 +356,9 @@ namespace fapi2 /// @brief Get target type directly from the handle /// @return Overlay as a type V /// - inline TargetTypes_t getTargetType(void) const + inline TargetType getTargetType(void) const { - return static_cast<TargetTypes_t>(iv_handle.fields.type); + return static_cast<TargetType>(iv_handle.fields.type); } /// diff --git a/hwpf/include/plat/plat_target.H b/hwpf/include/plat/plat_target.H index 75e924ff..95a2282b 100644 --- a/hwpf/include/plat/plat_target.H +++ b/hwpf/include/plat/plat_target.H @@ -31,6 +31,8 @@ #define __FAPI2_PLAT_TARGET__ #include <stdint.h> +#include <target_types.H> +#include <assert.h> // // Define what a platform handle looks like. For Hostboot, @@ -39,6 +41,20 @@ // namespace fapi2 { + typedef enum plat_target_type + { + PPE_TARGET_TYPE_NONE = 0x00, + PPE_TARGET_TYPE_PROC_CHIP = 0x01, + PPE_TARGET_TYPE_MCS = 0x02, + PPE_TARGET_TYPE_CORE = 0x04, + PPE_TARGET_TYPE_EQ = 0x08, + PPE_TARGET_TYPE_EX = 0x10, + PPE_TARGET_TYPE_PERV = 0x20, + PPE_TARGET_TYPE_MCBIST = 0x40, + PPE_TARGET_TYPE_SYSTEM = 0x80, + PPE_TARGET_TYPE_ALL = 0xFFF, + } plat_target_type_t; + typedef union plat_target_handle { uint32_t value; struct { @@ -62,6 +78,14 @@ namespace fapi2 } fields; // Union Constructor plat_target_handle(uint32_t i_value = 0):value(i_value) {} + + + TargetType getFapiTargetType() const; + + inline uint32_t getTargetInstance() const + { + return fields.type_target_num; + } } plat_target_handle_t; }; diff --git a/hwpf/include/plat/plat_target_filter.H b/hwpf/include/plat/plat_target_filter.H new file mode 100644 index 00000000..1dc5a40e --- /dev/null +++ b/hwpf/include/plat/plat_target_filter.H @@ -0,0 +1,90 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: hwpf/include/plat/plat_target_filter.H $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* [+] 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 */ +#ifndef __FAPI2_PLAT_TARGET_FILTER__ +#define __FAPI2_PLAT_TARGET_FILTER__ + +#include <stdint.h> + +// +// Define TargetFilter enum values for the platform +// +namespace fapi2 +{ +namespace PlatTargetFilter +{ +// These values must contain only 1 bit 'on' so that they can be ORed +// together as composite filters + +constexpr uint64_t PLAT_TARGET_FILTER_TP = 0x8000000000000000; // Pervasive 1 +constexpr uint64_t PLAT_TARGET_FILTER_NEST_NORTH = 0x4000000000000000; // Pervasive 2 +constexpr uint64_t PLAT_TARGET_FILTER_NEST_EAST = 0x2000000000000000; // Pervasive 3 +constexpr uint64_t PLAT_TARGET_FILTER_NEST_SOUTH = 0x1000000000000000; // Pervasive 4 +constexpr uint64_t PLAT_TARGET_FILTER_NEST_WEST = 0x0800000000000000; // Pervasive 5 +constexpr uint64_t PLAT_TARGET_FILTER_XBUS = 0x0400000000000000; // Pervasive 6 +constexpr uint64_t PLAT_TARGET_FILTER_MC_WEST = 0x0200000000000000; // Pervasive 7 +constexpr uint64_t PLAT_TARGET_FILTER_MC_EAST = 0x0100000000000000; // Pervasive 8 +constexpr uint64_t PLAT_TARGET_FILTER_OBUS0 = 0x0080000000000000; // Pervasive 9 +constexpr uint64_t PLAT_TARGET_FILTER_OBUS1 = 0x0040000000000000; // Pervasive 10 +constexpr uint64_t PLAT_TARGET_FILTER_OBUS2 = 0x0020000000000000; // Pervasive 11 +constexpr uint64_t PLAT_TARGET_FILTER_OBUS3 = 0x0010000000000000; // Pervasive 12 +constexpr uint64_t PLAT_TARGET_FILTER_PCI0 = 0x0008000000000000; // Pervasive 13 +constexpr uint64_t PLAT_TARGET_FILTER_PCI1 = 0x0004000000000000; // Pervasive 14 +constexpr uint64_t PLAT_TARGET_FILTER_PCI2 = 0x0002000000000000; // Pervasive 15 +constexpr uint64_t PLAT_TARGET_FILTER_CACHE0 = 0x0001000000000000; // Pervasive 16 +constexpr uint64_t PLAT_TARGET_FILTER_CACHE1 = 0x0000800000000000; // Pervasive 17 +constexpr uint64_t PLAT_TARGET_FILTER_CACHE2 = 0x0000400000000000; // Pervasive 18 +constexpr uint64_t PLAT_TARGET_FILTER_CACHE3 = 0x0000200000000000; // Pervasive 19 +constexpr uint64_t PLAT_TARGET_FILTER_CACHE4 = 0x0000100000000000; // Pervasive 20 +constexpr uint64_t PLAT_TARGET_FILTER_CACHE5 = 0x0000080000000000; // Pervasive 21 +constexpr uint64_t PLAT_TARGET_FILTER_CORE0 = 0x0000040000000000; // Pervasive 32 +constexpr uint64_t PLAT_TARGET_FILTER_CORE1 = 0x0000020000000000; // Pervasive 33 +constexpr uint64_t PLAT_TARGET_FILTER_CORE2 = 0x0000010000000000; // Pervasive 34 +constexpr uint64_t PLAT_TARGET_FILTER_CORE3 = 0x0000008000000000; // Pervasive 35 +constexpr uint64_t PLAT_TARGET_FILTER_CORE4 = 0x0000004000000000; // Pervasive 36 +constexpr uint64_t PLAT_TARGET_FILTER_CORE5 = 0x0000002000000000; // Pervasive 37 +constexpr uint64_t PLAT_TARGET_FILTER_CORE6 = 0x0000001000000000; // Pervasive 38 +constexpr uint64_t PLAT_TARGET_FILTER_CORE7 = 0x0000000800000000; // Pervasive 39 +constexpr uint64_t PLAT_TARGET_FILTER_CORE8 = 0x0000000400000000; // Pervasive 40 +constexpr uint64_t PLAT_TARGET_FILTER_CORE9 = 0x0000000200000000; // Pervasive 41 +constexpr uint64_t PLAT_TARGET_FILTER_CORE10 = 0x0000000100000000; // Pervasive 42 +constexpr uint64_t PLAT_TARGET_FILTER_CORE11 = 0x0000000080000000; // Pervasive 43 +constexpr uint64_t PLAT_TARGET_FILTER_CORE12 = 0x0000000040000000; // Pervasive 44 +constexpr uint64_t PLAT_TARGET_FILTER_CORE13 = 0x0000000020000000; // Pervasive 45 +constexpr uint64_t PLAT_TARGET_FILTER_CORE14 = 0x0000000010000000; // Pervasive 46 +constexpr uint64_t PLAT_TARGET_FILTER_CORE15 = 0x0000000008000000; // Pervasive 47 +constexpr uint64_t PLAT_TARGET_FILTER_CORE16 = 0x0000000004000000; // Pervasive 48 +constexpr uint64_t PLAT_TARGET_FILTER_CORE17 = 0x0000000002000000; // Pervasive 49 +constexpr uint64_t PLAT_TARGET_FILTER_CORE18 = 0x0000000001000000; // Pervasive 50 +constexpr uint64_t PLAT_TARGET_FILTER_CORE19 = 0x0000000000800000; // Pervasive 51 +constexpr uint64_t PLAT_TARGET_FILTER_CORE20 = 0x0000000000400000; // Pervasive 52 +constexpr uint64_t PLAT_TARGET_FILTER_CORE21 = 0x0000000000200000; // Pervasive 53 +constexpr uint64_t PLAT_TARGET_FILTER_CORE22 = 0x0000000000100000; // Pervasive 54 +constexpr uint64_t PLAT_TARGET_FILTER_CORE23 = 0x0000000000080000; // Pervasive 55 + +} // namespace PlatTargetFilter + +} // namespace fapi2 + +#endif diff --git a/hwpf/include/plat/target.H b/hwpf/include/plat/target.H index 0b7e9d89..f61e40dd 100644 --- a/hwpf/include/plat/target.H +++ b/hwpf/include/plat/target.H @@ -81,6 +81,55 @@ struct ScomAddr namespace fapi2 { + + template<TargetType T> + constexpr plat_target_type_t fapiTargetTypeToPlatTargetType() + { + return PPE_TARGET_TYPE_NONE; + } + + template<> + constexpr plat_target_type_t fapiTargetTypeToPlatTargetType<TARGET_TYPE_PROC_CHIP>() + { + return PPE_TARGET_TYPE_PROC_CHIP; + } + + template<> + constexpr plat_target_type_t fapiTargetTypeToPlatTargetType<TARGET_TYPE_EQ>() + { + return PPE_TARGET_TYPE_EQ; + } + + template<> + constexpr plat_target_type_t fapiTargetTypeToPlatTargetType<TARGET_TYPE_CORE>() + { + return PPE_TARGET_TYPE_CORE; + } + + template<> + constexpr plat_target_type_t fapiTargetTypeToPlatTargetType<TARGET_TYPE_EX>() + { + return PPE_TARGET_TYPE_EX; + } + + template<> + constexpr plat_target_type_t fapiTargetTypeToPlatTargetType<TARGET_TYPE_MCS>() + { + return PPE_TARGET_TYPE_MCS; + } + + template<> + constexpr plat_target_type_t fapiTargetTypeToPlatTargetType<TARGET_TYPE_MCBIST>() + { + return PPE_TARGET_TYPE_MCBIST; + } + + template<> + constexpr plat_target_type_t fapiTargetTypeToPlatTargetType<TARGET_TYPE_PERV>() + { + return PPE_TARGET_TYPE_PERV; + } + /// @brief Create a Target, with a value /// @param[in] Value the value (i.e., specific element this /// target represents, or pointer) @@ -103,50 +152,50 @@ namespace fapi2 if(K & TARGET_TYPE_PROC_CHIP) { this->iv_handle.fields.chiplet_num = 0; - this->iv_handle.fields.type = TARGET_TYPE_PROC_CHIP; + this->iv_handle.fields.type = PPE_TARGET_TYPE_PROC_CHIP; this->iv_handle.fields.type_target_num = 0; } else if(K & TARGET_TYPE_PERV) { this->iv_handle.fields.chiplet_num = l_plat_argument + NEST_GROUP1_CHIPLET_OFFSET; - this->iv_handle.fields.type = TARGET_TYPE_PERV; + this->iv_handle.fields.type = PPE_TARGET_TYPE_PERV; this->iv_handle.fields.type_target_num = l_plat_argument; } else if(K & TARGET_TYPE_CORE) { this->iv_handle.fields.chiplet_num = l_plat_argument + CORE_CHIPLET_OFFSET; - this->iv_handle.fields.type = TARGET_TYPE_CORE | TARGET_TYPE_PERV; + this->iv_handle.fields.type = PPE_TARGET_TYPE_CORE | PPE_TARGET_TYPE_PERV; this->iv_handle.fields.type_target_num = l_plat_argument; } else if(K & TARGET_TYPE_EQ) { this->iv_handle.fields.chiplet_num = l_plat_argument + EQ_CHIPLET_OFFSET; - this->iv_handle.fields.type = TARGET_TYPE_EQ | TARGET_TYPE_PERV; + this->iv_handle.fields.type = PPE_TARGET_TYPE_EQ | PPE_TARGET_TYPE_PERV; this->iv_handle.fields.type_target_num = l_plat_argument; } else if(K & TARGET_TYPE_EX) { this->iv_handle.fields.chiplet_num = (l_plat_argument / 2) + EX_CHIPLET_OFFSET; - this->iv_handle.fields.type = TARGET_TYPE_EX; + this->iv_handle.fields.type = PPE_TARGET_TYPE_EX; this->iv_handle.fields.type_target_num = l_plat_argument; } else if(K & TARGET_TYPE_MCBIST) { this->iv_handle.fields.chiplet_num = l_plat_argument + MCBIST_CHIPLET_OFFSET; - this->iv_handle.fields.type = TARGET_TYPE_MCBIST | TARGET_TYPE_PERV; + this->iv_handle.fields.type = PPE_TARGET_TYPE_MCBIST | PPE_TARGET_TYPE_PERV; this->iv_handle.fields.type_target_num = l_plat_argument; } else if(K & TARGET_TYPE_MCS) { this->iv_handle.fields.chiplet_num = N3_CHIPLET - (MCS_PER_MCBIST * (l_plat_argument / MCS_PER_MCBIST)); - this->iv_handle.fields.type = TARGET_TYPE_MCS; + this->iv_handle.fields.type = PPE_TARGET_TYPE_MCS; this->iv_handle.fields.type_target_num = l_plat_argument; } else if(K == TARGET_TYPE_ALL) { this->iv_handle.fields.chiplet_num = l_plat_argument; - this->iv_handle.fields.type = TARGET_TYPE_ALL; + this->iv_handle.fields.type = PPE_TARGET_TYPE_ALL; } this->iv_handle.fields.valid = 1; @@ -365,12 +414,12 @@ namespace fapi2 { std::vector<fapi2::plat_target_handle_t>::iterator l_iter; std::vector<Target<T> > l_children; + constexpr plat_target_type_t P = fapiTargetTypeToPlatTargetType<T>(); 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) + if (((*l_temp).getTargetType() & P) == P) { switch (i_state) { @@ -421,7 +470,7 @@ namespace fapi2 { plat_target_handle_t l_targetHandle = G_vec_targets.at(l_idx + NEST_GROUP1_CHIPLET_OFFSET); - if(l_targetHandle.fields.type & TARGET_TYPE_PERV) // Can be an assertion? + if(l_targetHandle.fields.type & PPE_TARGET_TYPE_PERV) // Can be an assertion? { switch (i_state) { diff --git a/hwpf/include/target_types.H b/hwpf/include/target_types.H deleted file mode 100644 index f2519eef..00000000 --- a/hwpf/include/target_types.H +++ /dev/null @@ -1,255 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: hwpf/include/target_types.H $ */ -/* */ -/* OpenPOWER sbe Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2016 */ -/* [+] 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 target_types.H - * @brief definitions for fapi2 target types - */ - -#ifndef __FAPI2_TARGET_TYPES__ -#define __FAPI2_TARGET_TYPES__ - -#ifndef __ASSEMBLER__ - -/// FAPI namespace -namespace fapi2 -{ - - /// - /// @enum fapi::TargetType - /// @brief Types, kinds, of targets - /// @note TYPE_NONE is used to represent empty/NULL targets in lists - /// or tables. TYPE_ALL is used to pass targets to methods which - /// can act generally on any type of target - /// - /// Target Kind - enum TargetType - { - TARGET_TYPE_NONE = 0x00, ///< No type - TARGET_TYPE_PROC_CHIP = 0x01, ///< Processor type - TARGET_TYPE_EX = 0x02, ///< Ex type - TARGET_TYPE_CORE = 0x04, ///< Core type - TARGET_TYPE_EQ = 0x08, ///< EQ type - TARGET_TYPE_MCS = 0x10, ///< MCS type - TARGET_TYPE_PERV = 0x20, ///< Pervasive type - TARGET_TYPE_MCAST = 0x40, ///< Multicast type - TARGET_TYPE_MI = 0x80, ///< MI type - TARGET_TYPE_MCBIST = 0x100, ///< MCBIST type - TARGET_TYPE_SYSTEM = 0x400, ///< System type - TARGET_TYPE_ALL = 0xFFF, ///< 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, - }; - - /// - /// @brief Typedef used when passing multiple TargetType values - /// - typedef uint16_t TargetTypes_t; - - /// - /// @brief Enumeration of chiplet filters - /// - enum TargetFilter - { - TARGET_FILTER_TP = 0x8000000000000000, // Pervasive 1 - TARGET_FILTER_NEST_NORTH = 0x4000000000000000, // Pervasive 2 - TARGET_FILTER_NEST_SOUTH = 0x2000000000000000, // Pervasive 3 - TARGET_FILTER_NEST_EAST = 0x1000000000000000, // Pervasive 4 - TARGET_FILTER_NEST_WEST = 0x0800000000000000, // Pervasive 5 - TARGET_FILTER_XBUS = 0x0400000000000000, // Pervasive 6 - TARGET_FILTER_MC_WEST = 0x0200000000000000, // Pervasive 7 - TARGET_FILTER_MC_EAST = 0x0100000000000000, // Pervasive 8 - TARGET_FILTER_OBUS0 = 0x0080000000000000, // Pervasive 9 - TARGET_FILTER_OBUS1 = 0x0040000000000000, // Pervasive 10 - TARGET_FILTER_OBUS2 = 0x0020000000000000, // Pervasive 11 - TARGET_FILTER_OBUS3 = 0x0010000000000000, // Pervasive 12 - TARGET_FILTER_PCI0 = 0x0008000000000000, // Pervasive 13 - TARGET_FILTER_PCI1 = 0x0004000000000000, // Pervasive 14 - TARGET_FILTER_PCI2 = 0x0002000000000000, // Pervasive 15 - TARGET_FILTER_CACHE0 = 0x0001000000000000, // Pervasive 16 - TARGET_FILTER_CACHE1 = 0x0000800000000000, // Pervasive 17 - TARGET_FILTER_CACHE2 = 0x0000400000000000, // Pervasive 18 - TARGET_FILTER_CACHE3 = 0x0000200000000000, // Pervasive 19 - TARGET_FILTER_CACHE4 = 0x0000100000000000, // Pervasive 20 - TARGET_FILTER_CACHE5 = 0x0000080000000000, // Pervasive 21 - TARGET_FILTER_CORE0 = 0x0000040000000000, // Pervasive 32 - TARGET_FILTER_CORE1 = 0x0000020000000000, // Pervasive 33 - TARGET_FILTER_CORE2 = 0x0000010000000000, // Pervasive 34 - TARGET_FILTER_CORE3 = 0x0000008000000000, // Pervasive 35 - TARGET_FILTER_CORE4 = 0x0000004000000000, // Pervasive 36 - TARGET_FILTER_CORE5 = 0x0000002000000000, // Pervasive 37 - TARGET_FILTER_CORE6 = 0x0000001000000000, // Pervasive 38 - TARGET_FILTER_CORE7 = 0x0000000800000000, // Pervasive 39 - TARGET_FILTER_CORE8 = 0x0000000400000000, // Pervasive 40 - TARGET_FILTER_CORE9 = 0x0000000200000000, // Pervasive 41 - TARGET_FILTER_CORE10 = 0x0000000100000000, // Pervasive 42 - TARGET_FILTER_CORE11 = 0x0000000080000000, // Pervasive 43 - TARGET_FILTER_CORE12 = 0x0000000040000000, // Pervasive 44 - TARGET_FILTER_CORE13 = 0x0000000020000000, // Pervasive 45 - TARGET_FILTER_CORE14 = 0x0000000010000000, // Pervasive 46 - TARGET_FILTER_CORE15 = 0x0000000008000000, // Pervasive 47 - TARGET_FILTER_CORE16 = 0x0000000004000000, // Pervasive 48 - TARGET_FILTER_CORE17 = 0x0000000002000000, // Pervasive 49 - TARGET_FILTER_CORE18 = 0x0000000001000000, // Pervasive 50 - TARGET_FILTER_CORE19 = 0x0000000000800000, // Pervasive 51 - TARGET_FILTER_CORE20 = 0x0000000000400000, // Pervasive 52 - TARGET_FILTER_CORE21 = 0x0000000000200000, // Pervasive 53 - TARGET_FILTER_CORE22 = 0x0000000000100000, // Pervasive 54 - TARGET_FILTER_CORE23 = 0x0000000000080000, // Pervasive 55 - - // Composite filters follow - - // Pervasive 32-55 (all cores) - TARGET_FILTER_ALL_CORES = (TARGET_FILTER_CORE0 | - TARGET_FILTER_CORE1 | TARGET_FILTER_CORE2 | - TARGET_FILTER_CORE3 | TARGET_FILTER_CORE4 | - TARGET_FILTER_CORE5 | TARGET_FILTER_CORE6 | - TARGET_FILTER_CORE7 | TARGET_FILTER_CORE8 | - TARGET_FILTER_CORE9 | TARGET_FILTER_CORE10 | - TARGET_FILTER_CORE11 | TARGET_FILTER_CORE12 | - TARGET_FILTER_CORE13 | TARGET_FILTER_CORE14 | - TARGET_FILTER_CORE15 | TARGET_FILTER_CORE16 | - TARGET_FILTER_CORE17 | TARGET_FILTER_CORE18 | - TARGET_FILTER_CORE19 | TARGET_FILTER_CORE20 | - TARGET_FILTER_CORE21 | TARGET_FILTER_CORE22 | - TARGET_FILTER_CORE23), - - // Pervasive 16-21 (all caches) - TARGET_FILTER_ALL_CACHES = (TARGET_FILTER_CACHE0 | - TARGET_FILTER_CACHE1 | TARGET_FILTER_CACHE2 | - TARGET_FILTER_CACHE3 | TARGET_FILTER_CACHE4 | - TARGET_FILTER_CACHE5), - - // Pervasive 2-5 (eg N0-N3) < req'd - TARGET_FILTER_ALL_NEST = (TARGET_FILTER_NEST_NORTH | - TARGET_FILTER_NEST_SOUTH | TARGET_FILTER_NEST_EAST | - TARGET_FILTER_NEST_WEST), - - // Pervasive 2-4 (eg N0-N2) < req'd - TARGET_FILTER_NEST_SLAVES = - (TARGET_FILTER_NEST_NORTH | TARGET_FILTER_NEST_SOUTH | - TARGET_FILTER_NEST_EAST), - - // Pervasive 5 (eg N32) < req'd - TARGET_FILTER_NEST_MASTER = TARGET_FILTER_NEST_WEST, - - // Pervasive 7-8 (eg MC0-MC1) - TARGET_FILTER_ALL_MC = - (TARGET_FILTER_MC_WEST | TARGET_FILTER_MC_EAST), - - // Pervasive 9-12 (OB0-OB3) - TARGET_FILTER_ALL_OBUS = - (TARGET_FILTER_OBUS0 | TARGET_FILTER_OBUS1 | TARGET_FILTER_OBUS2 | - TARGET_FILTER_OBUS3), - - // Pervasive 13-15 (PCI0-PCI2) - TARGET_FILTER_ALL_PCI = - (TARGET_FILTER_PCI0 | TARGET_FILTER_PCI1 | TARGET_FILTER_PCI2), - - // Sync mode filter = All NEST + All MCS - TARGET_FILTER_SYNC_MODE_NEST = - (TARGET_FILTER_ALL_NEST | TARGET_FILTER_ALL_MC), - - // All IO Targets except NEST - TARGET_FILTER_ALL_IO_EXCEPT_NEST = - (TARGET_FILTER_XBUS | TARGET_FILTER_ALL_PCI | TARGET_FILTER_ALL_OBUS), - - // All sync mode IO except NEST - TARGET_FILTER_SYNC_MODE_ALL_IO_EXCEPT_NEST = - (TARGET_FILTER_ALL_MC | TARGET_FILTER_XBUS | TARGET_FILTER_ALL_PCI | - TARGET_FILTER_ALL_OBUS), - - // All sync mode NEST slaves - TARGET_FILTER_SYNC_MODE_NEST_SLAVES = - (TARGET_FILTER_ALL_MC | TARGET_FILTER_NEST_SLAVES), - - // All sync mode IO - TARGET_FILTER_SYNC_MODE_ALL_IO = - (TARGET_FILTER_ALL_MC | TARGET_FILTER_ALL_NEST | - TARGET_FILTER_ALL_OBUS | TARGET_FILTER_ALL_PCI | - TARGET_FILTER_XBUS), - - // All IO - TARGET_FILTER_ALL_IO = (TARGET_FILTER_ALL_NEST | - TARGET_FILTER_ALL_OBUS | TARGET_FILTER_ALL_PCI | - TARGET_FILTER_XBUS), - - // All sync mode except TP - TARGET_FILTER_SYNC_MODE_ALL_EXCEPT_TP = - (TARGET_FILTER_ALL_MC | TARGET_FILTER_ALL_NEST | - TARGET_FILTER_ALL_OBUS | TARGET_FILTER_ALL_PCI | - TARGET_FILTER_XBUS | TARGET_FILTER_ALL_CORES | - TARGET_FILTER_ALL_CACHES), - }; - - /// @cond - constexpr TargetType operator|(TargetType x, TargetType y) - { - return static_cast<TargetType>(static_cast<int>(x) | - static_cast<int>(y)); - } - - template<uint64_t V> - class bitCount { - public: - // Don't use enums, too hard to compare - static const uint8_t count = bitCount<(V >> 1)>::count + (V & 1); - }; - - template<> - class bitCount<0> { - public: - static const uint8_t count = 0; - }; - /// @endcond -}; - -#endif // __ASSEMBLER__ -#endif // __FAPI2_TARGET_TYPES__ diff --git a/hwpf/src/plat/target.C b/hwpf/src/plat/target.C index 395de8bd..953c354e 100644 --- a/hwpf/src/plat/target.C +++ b/hwpf/src/plat/target.C @@ -46,6 +46,43 @@ fapi2attr::EXAttributes_t* G_ex_attributes_ptr; namespace fapi2 { + TargetType plat_target_handle_t::getFapiTargetType() const + { + TargetType l_targetType = TARGET_TYPE_NONE; + switch(fields.type) + { + case PPE_TARGET_TYPE_PROC_CHIP: + l_targetType = TARGET_TYPE_PROC_CHIP; + break; + case PPE_TARGET_TYPE_MCS: + l_targetType = TARGET_TYPE_MCS; + break; + case PPE_TARGET_TYPE_CORE | PPE_TARGET_TYPE_PERV: + l_targetType = TARGET_TYPE_CORE; + break; + case PPE_TARGET_TYPE_EQ | PPE_TARGET_TYPE_PERV: + l_targetType = TARGET_TYPE_EQ; + break; + case PPE_TARGET_TYPE_EX: + l_targetType = TARGET_TYPE_EX; + break; + case PPE_TARGET_TYPE_PERV: + l_targetType = TARGET_TYPE_PERV; + break; + case PPE_TARGET_TYPE_SYSTEM: + l_targetType = TARGET_TYPE_SYSTEM; + break; + case PPE_TARGET_TYPE_MCBIST | PPE_TARGET_TYPE_PERV: + l_targetType = TARGET_TYPE_MCBIST; + break; + case PPE_TARGET_TYPE_NONE: + case PPE_TARGET_TYPE_ALL: + default: + assert(false); + break; + } + return l_targetType; + } #ifndef __noRC__ ReturnCode current_err; |