From b6e96c3e8edb4972591c6003942d7d0d898a0bf2 Mon Sep 17 00:00:00 2001 From: Santosh Puranik Date: Mon, 16 May 2016 12:39:29 +0530 Subject: Update FAPI parent-child relations -- Added EQ/EC/EX relations -- Support PERV==>PERV getParent Change-Id: I9517010ee9f3ee5f3f4b022bf2da92451dfce4ff Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/24728 Tested-by: Jenkins Server Reviewed-by: Sachin Gupta Reviewed-by: Gregory S. Still Reviewed-by: Santosh S. Puranik --- hwpf/include/fapi2_target.H | 53 ++++---- hwpf/include/plat/plat_target.H | 49 +++++-- hwpf/include/plat/plat_target_parms.H | 8 +- hwpf/include/plat/target.H | 236 ++++++++++++++++++++++------------ hwpf/src/plat/target.C | 101 ++++++++++----- 5 files changed, 292 insertions(+), 155 deletions(-) (limited to 'hwpf') diff --git a/hwpf/include/fapi2_target.H b/hwpf/include/fapi2_target.H index e1f630ab..f32b9d4c 100644 --- a/hwpf/include/fapi2_target.H +++ b/hwpf/include/fapi2_target.H @@ -1,3 +1,27 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: hwpf/include/fapi2_target.H $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015,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 fapi2_target.H /// @brief Common definitions for fapi2 targets @@ -312,9 +336,9 @@ namespace fapi2 /// /// @brief Get address overlay to reduce runtime processing - /// @return Overlay as a type V + /// @return Overlay as a type uint32_t /// - inline V getAddressOverlay(void) const + inline uint32_t getAddressOverlay(void) const { return (iv_handle.value & 0xFF000000); } @@ -354,30 +378,7 @@ namespace fapi2 // in the platform target cast constructor. static const TargetType iv_type = K; - union iv_handle { - V value; - struct { -#ifdef _BIG_ENDIAN - V chiplet_num : 8; - V type_target_num : 8; - V present : 1; - V functional : 1; - V _reserved_b1 : 1; - V valid : 1; - V type : 12; -#else - V type : 12; - V valid : 1; - V _reserved_b1 : 1; - V functional : 1; - V present : 1; - V type_target_num : 8; - V chiplet_num : 8; -#endif - } fields; - // Union Constructor - iv_handle(V i_value = 0):value(i_value) {} - } iv_handle; + V iv_handle; }; // EX threads map to CORE threads: diff --git a/hwpf/include/plat/plat_target.H b/hwpf/include/plat/plat_target.H index 0468dd02..75e924ff 100644 --- a/hwpf/include/plat/plat_target.H +++ b/hwpf/include/plat/plat_target.H @@ -1,19 +1,25 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: hwpf/fapi2/include/plat_target.H $ */ +/* $Source: hwpf/include/plat/plat_target.H $ */ /* */ -/* IBM CONFIDENTIAL */ +/* OpenPOWER sbe Project */ /* */ -/* EKB Project */ -/* */ -/* COPYRIGHT 2012,2015 */ +/* Contributors Listed Below - COPYRIGHT 2015,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ -/* The source code for this program is not published or otherwise */ -/* divested of its trade secrets, irrespective of what has been */ -/* deposited with the U.S. Copyright Office. */ +/* 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 */ /** @@ -33,7 +39,30 @@ // namespace fapi2 { - typedef uint32_t plat_target_handle_t; -} + typedef union plat_target_handle { + uint32_t value; + struct { +#ifdef _BIG_ENDIAN + uint32_t chiplet_num : 8; + uint32_t type_target_num : 8; + uint32_t present : 1; + uint32_t functional : 1; + uint32_t _reserved_b1 : 1; + uint32_t valid : 1; + uint32_t type : 12; +#else + uint32_t type : 12; + uint32_t valid : 1; + uint32_t _reserved_b1 : 1; + uint32_t functional : 1; + uint32_t present : 1; + uint32_t type_target_num : 8; + uint32_t chiplet_num : 8; +#endif + } fields; + // Union Constructor + plat_target_handle(uint32_t i_value = 0):value(i_value) {} + } plat_target_handle_t; +}; #endif diff --git a/hwpf/include/plat/plat_target_parms.H b/hwpf/include/plat/plat_target_parms.H index 72a00d48..74825e05 100644 --- a/hwpf/include/plat/plat_target_parms.H +++ b/hwpf/include/plat/plat_target_parms.H @@ -1,11 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: $ */ +/* $Source: hwpf/include/plat/plat_target_parms.H $ */ /* */ -/* OpenPOWER HostBoot Project */ +/* OpenPOWER sbe Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -61,10 +61,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); +// Ex Targets CONST_UINT32_T(EX_TARGET_OFFSET, CORE_TARGET_OFFSET + CORE_TARGET_COUNT); CONST_UINT32_T(EX_CHIPLET_OFFSET, 0x10); CONST_UINT32_T(EX_TARGET_COUNT, 12); +// System Target CONST_UINT32_T(SYSTEM_TARGET_OFFSET, EX_TARGET_OFFSET + EX_TARGET_COUNT); CONST_UINT32_T(SYSTEM_TARGET_COUNT, 1); diff --git a/hwpf/include/plat/target.H b/hwpf/include/plat/target.H index 8c8b673c..02939ebe 100644 --- a/hwpf/include/plat/target.H +++ b/hwpf/include/plat/target.H @@ -1,11 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: $ */ +/* $Source: hwpf/include/plat/target.H $ */ /* */ -/* OpenPOWER HostBoot Project */ +/* OpenPOWER sbe Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -44,6 +44,9 @@ extern "C" } static const uint8_t CORES_PER_QUAD = 4; +static const uint8_t EX_PER_QUAD = 2; +static const uint8_t CORES_PER_EX = 2; + namespace fapi2 { /// @brief Create a Target, with a value @@ -56,10 +59,11 @@ namespace fapi2 template Target::Target(V Value) { + uint32_t l_plat_argument = Value.value; // Already formed target handle? - if(static_cast(Value).fields.valid == 1) + if(Value.fields.valid == 1) { - this->iv_handle.value = Value; + this->iv_handle = Value; return; } @@ -72,39 +76,38 @@ namespace fapi2 } else if(K & TARGET_TYPE_PERV) { - this->iv_handle.fields.chiplet_num = Value + NEST_GROUP1_CHIPLET_OFFSET; + 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_target_num = Value; + this->iv_handle.fields.type_target_num = l_plat_argument; } else if(K & TARGET_TYPE_CORE) { - this->iv_handle.fields.chiplet_num = Value + CORE_CHIPLET_OFFSET; + 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_target_num = Value; + this->iv_handle.fields.type_target_num = l_plat_argument; } else if(K & TARGET_TYPE_EQ) { - this->iv_handle.fields.chiplet_num = Value + EQ_CHIPLET_OFFSET; + 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_target_num = Value; + this->iv_handle.fields.type_target_num = l_plat_argument; } else if(K & 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.chiplet_num = (l_plat_argument / 2) + EX_CHIPLET_OFFSET; + this->iv_handle.fields.type = TARGET_TYPE_EX; + this->iv_handle.fields.type_target_num = l_plat_argument; } else if(K & TARGET_TYPE_MCS) { - this->iv_handle.fields.chiplet_num = Value + MCS_CHIPLET_OFFSET; + this->iv_handle.fields.chiplet_num = l_plat_argument + MCS_CHIPLET_OFFSET; this->iv_handle.fields.type = TARGET_TYPE_MCS | TARGET_TYPE_PERV; - this->iv_handle.fields.type_target_num = Value; + this->iv_handle.fields.type_target_num = l_plat_argument; } else if(K == TARGET_TYPE_ALL) { - this->iv_handle.fields.chiplet_num = Value; + this->iv_handle.fields.chiplet_num = l_plat_argument; this->iv_handle.fields.type = TARGET_TYPE_ALL; } @@ -164,70 +167,88 @@ namespace fapi2 template inline Target Target::getParent(void) const { - static_assert((((K == TARGET_TYPE_EQ) || (K == TARGET_TYPE_CORE)) && - (T == TARGET_TYPE_PERV)) || (T == TARGET_TYPE_PROC_CHIP) - || ((K == TARGET_TYPE_CORE) && (T == TARGET_TYPE_EQ)), - "Input target type must be either EQ/CORE, and parent type " - "must be PERV. Or the parent type must be a PROC_CHIP. Or " - "parent type must be an EQ and input target must be a CORE"); - if(TARGET_TYPE_PERV == T) + static_assert(((K == TARGET_TYPE_EQ) || + (K == TARGET_TYPE_CORE) || + (K == TARGET_TYPE_MCS) || + (K == TARGET_TYPE_PERV) || + (K == TARGET_TYPE_EX)) && + ((T == TARGET_TYPE_EQ) || + (T == TARGET_TYPE_EX) || + (T == TARGET_TYPE_PROC_CHIP) || + (T == TARGET_TYPE_PERV)), + "Invalid parent/child target type passed"); + + static_assert(!((K == TARGET_TYPE_EQ) && + (T != TARGET_TYPE_PERV) && + (T != TARGET_TYPE_PROC_CHIP)), + "Invalid parent for EQ target, must be PERV or " + "PROC_CHIP"); + + static_assert(!((K == TARGET_TYPE_MCS) && + (T != TARGET_TYPE_PERV) && + (T != TARGET_TYPE_PROC_CHIP)), + "Invalid parent for MCS target, must be PERV or " + "PROC_CHIP"); + + static_assert(!((K == TARGET_TYPE_CORE) && + (T != TARGET_TYPE_PERV) && + (T != TARGET_TYPE_PROC_CHIP) && + (T != TARGET_TYPE_EQ) && + (T != TARGET_TYPE_EX)), + "Invalid parent for CORE target, must be PERV or " + "PROC_CHIP or EQ or EX"); + + static_assert(!((K == TARGET_TYPE_PERV) && + (T != TARGET_TYPE_PERV) && + (T != TARGET_TYPE_PROC_CHIP)), + "Invalid parent for PERV target, must be PERV or " + "PROC_CHIP"); + + static_assert(!((K == TARGET_TYPE_EX) && + (T != TARGET_TYPE_PROC_CHIP) && + (T != TARGET_TYPE_EQ)), + "Invalid parent for EX target, must be PERV or " + "PROC_CHIP or EQ"); + + if(TARGET_TYPE_PERV == T) // EQ/EC/MCS/PERV ===> PERV { - return this->iv_handle.value; + return this->iv_handle; } - if(TARGET_TYPE_PROC_CHIP == T) + if(TARGET_TYPE_PROC_CHIP == T) // EQ/EC/EX/MCS/PERV ===> PROC { return G_vec_targets[CHIP_TARGET_OFFSET]; } - if(TARGET_TYPE_EQ == T) + if((TARGET_TYPE_EQ == T) && (TARGET_TYPE_CORE == K)) // EC ===> EQ + { + return G_vec_targets[(getTargetNumber() / CORES_PER_QUAD) + EQ_TARGET_OFFSET]; + } + if((TARGET_TYPE_EQ == T) && (TARGET_TYPE_EX == K)) // EX ===> EQ + { + return G_vec_targets[(getTargetNumber() / EX_PER_QUAD) + EQ_TARGET_OFFSET]; + } + if(TARGET_TYPE_EX == T) // EC ===> EX { - return G_vec_targets[((getChipletNumber() - CORE_CHIPLET_OFFSET) / CORES_PER_QUAD) + EQ_TARGET_OFFSET]; + return G_vec_targets[(getTargetNumber() / CORES_PER_EX) + EX_TARGET_OFFSET]; } } - /// - /// @brief Get this target's children - /// @tparam K The type of the parent + /// @brief Get this target's children - handles EQ/EX/EC conversions + /// @tparam K The type of parent + /// @tparam V The plat target handle type /// @tparam T The type of child /// @param[in] i_state The desired TargetState of the children /// @return std::vector > a vector of present/functional /// children - /// @warning The children of EX's (cores) are expected to be returned - /// in order. That is, core 0 is std::vector[0]. - /// + /// @warning The children are returned in order, ex child[0] is + /// std::vector[0] template - template< TargetType T> - std::vector > + template + std::vector> Target::getChildren(const TargetState i_state) const { -#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 - + static_assert(((K == TARGET_TYPE_EQ) || (K == TARGET_TYPE_EX)) && + ((T == TARGET_TYPE_EX) || (T == TARGET_TYPE_CORE)), + "Invalid parent/child passed to getChildren"); // valid children for EQ // EQ -> CORE // EQ -> EX @@ -242,21 +263,71 @@ namespace fapi2 (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 > l_children; + uint32_t l_childPerChiplet = 0; + uint32_t l_childTargetOffset = 0; + // EQ ==> EX + if((K == TARGET_TYPE_EQ) && (T == TARGET_TYPE_EX)) + { + l_childPerChiplet = EX_PER_QUAD; + l_childTargetOffset = EX_TARGET_OFFSET; + } - std::vector::iterator l_iter; - FAPI_DBG("getChildren: initializing children vector"); - std::vector > l_children; + // EQ ==> EC + if((K == TARGET_TYPE_EQ) && (T == TARGET_TYPE_CORE)) + { + l_childPerChiplet = CORES_PER_QUAD; + l_childTargetOffset = CORE_TARGET_OFFSET; + } + + // EX ==> EC + if((K == TARGET_TYPE_EX) && (T == TARGET_TYPE_CORE)) + { + l_childPerChiplet = CORES_PER_EX; + l_childTargetOffset = CORE_TARGET_OFFSET; + } + for(uint32_t i = 0; i < l_childPerChiplet; ++i) + { + Target *l_temp = reinterpret_cast< Target* >(&G_vec_targets.at((getTargetNumber() * l_childPerChiplet) + l_childTargetOffset + i)); + switch (i_state) + { + case TARGET_STATE_PRESENT: + if ((*l_temp).getPresent()) + { + l_children.push_back((*l_temp)); + } + break; + case TARGET_STATE_FUNCTIONAL: + if ((*l_temp).getFunctional()) + { + l_children.push_back((*l_temp)); + } + break; + default: + assert(false); + } + } + return l_children; + } + + /// + /// @brief Get this target's children - specialization for PROC_CHIP + /// @tparam T The type of child + /// @param[in] i_state The desired TargetState of the children + /// @return std::vector > a vector of present/functional + /// children + /// + template<> + template< TargetType T> + std::vector > + Target::getChildren(const TargetState i_state) const + { + std::vector::iterator l_iter; + std::vector > l_children; - uint32_t c = 0; for (l_iter = G_vec_targets.begin(); l_iter != G_vec_targets.end(); ++l_iter) { @@ -269,21 +340,18 @@ namespace fapi2 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); + assert(false); } } - ++c; } return l_children; @@ -313,20 +381,20 @@ namespace fapi2 { if (i_filter & (mask << (((sizeof(TargetFilter)*8)-1) - l_idx))) { - uint64_t l_targetHandle = G_vec_targets.at(l_idx + NEST_GROUP1_CHIPLET_OFFSET); + plat_target_handle_t l_targetHandle = G_vec_targets.at(l_idx + NEST_GROUP1_CHIPLET_OFFSET); - if(((static_cast(l_targetHandle)).fields.type & TARGET_TYPE_PERV)) // Can be an assertion? + if(l_targetHandle.fields.type & TARGET_TYPE_PERV) // Can be an assertion? { switch (i_state) { case TARGET_STATE_PRESENT: - if(static_cast(l_targetHandle).fields.present) + if(l_targetHandle.fields.present) { l_children.push_back(l_targetHandle); } break; case TARGET_STATE_FUNCTIONAL: - if(static_cast(l_targetHandle).fields.functional) + if(l_targetHandle.fields.functional) { l_children.push_back(l_targetHandle); } diff --git a/hwpf/src/plat/target.C b/hwpf/src/plat/target.C index 15bc397c..74b2bdd1 100644 --- a/hwpf/src/plat/target.C +++ b/hwpf/src/plat/target.C @@ -1,32 +1,33 @@ -/* 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 */ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: hwpf/src/plat/target.C $ */ +/* */ +/* 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 */ #include #include #include +#include uint32_t CHIPLET_PG_ARRAY_ENTRIES = sizeof(CHIPLET_PG_ARRAY) / sizeof(chiplet_pg_entry_t); @@ -337,7 +338,7 @@ fapi_try_exit: l_beginning_offset = CHIP_TARGET_OFFSET; fapi2::Target chip_target((fapi2::plat_target_handle_t)0); - G_vec_targets.at(l_beginning_offset) = revle64((fapi2::plat_target_handle_t)(chip_target.get())); + G_vec_targets.at(l_beginning_offset) = revle32((fapi2::plat_target_handle_t)(chip_target.get())); /* * Nest Targets - group 1 @@ -351,7 +352,7 @@ fapi_try_exit: // via partial good attributes FAPI_TRY(plat_TargetPresent(chip_target, target_name, b_present)); - G_vec_targets.at(l_beginning_offset+i) = revle64((fapi2::plat_target_handle_t)(target_name.get())); + G_vec_targets.at(l_beginning_offset+i) = revle32((fapi2::plat_target_handle_t)(target_name.get())); } /* @@ -367,7 +368,7 @@ fapi_try_exit: // via partial good attributes FAPI_TRY(plat_TargetPresent(chip_target, target_name, b_present)); - G_vec_targets.at(l_beginning_offset+i) = revle64((fapi2::plat_target_handle_t)(target_name.get())); + G_vec_targets.at(l_beginning_offset+i) = revle32((fapi2::plat_target_handle_t)(target_name.get())); } @@ -384,7 +385,7 @@ fapi_try_exit: // via partial good attributes FAPI_TRY(plat_TargetPresent(chip_target, target_name, b_present)); - G_vec_targets.at(i) = revle64((fapi2::plat_target_handle_t)(target_name.get())); + G_vec_targets.at(i) = revle32((fapi2::plat_target_handle_t)(target_name.get())); } /* @@ -399,7 +400,7 @@ fapi_try_exit: // via partial good attributes FAPI_TRY(plat_TargetPresent(chip_target, target_name, b_present)); - G_vec_targets.at(l_beginning_offset+i) = revle64((fapi2::plat_target_handle_t)(target_name.get())); + G_vec_targets.at(l_beginning_offset+i) = revle32((fapi2::plat_target_handle_t)(target_name.get())); } /* @@ -415,7 +416,28 @@ fapi_try_exit: // via partial good attributes FAPI_TRY(plat_TargetPresent(chip_target, target_name, b_present)); - G_vec_targets.at(l_beginning_offset+i) = revle64((fapi2::plat_target_handle_t)(target_name.get())); + G_vec_targets.at(l_beginning_offset+i) = revle32((fapi2::plat_target_handle_t)(target_name.get())); + } + + /* + * EX Targets + */ + + l_beginning_offset = EX_TARGET_OFFSET; + for (uint32_t i = 0; i < EX_TARGET_COUNT; ++i) + { + fapi2::Target target_name((fapi2::plat_target_handle_t)i); + + // Check if at least one of the cores in the EX are good, if they + // are, set the EX present and functional + if((G_vec_targets.at(CORE_TARGET_OFFSET + (CORES_PER_EX * i))).fields.present || + (G_vec_targets.at(CORE_TARGET_OFFSET + (CORES_PER_EX * i) + 1)).fields.present) + { + target_name.setPresent(); + target_name.setFunctional(true); + } + + G_vec_targets.at(l_beginning_offset+i) = revle32((fapi2::plat_target_handle_t)(target_name.get())); } fapi_try_exit: @@ -438,6 +460,7 @@ fapi_try_exit: uint8_t l_eqGards = 0; uint32_t l_ecGards = 0; static const uint32_t l_mask = 0x80000000; + bool l_coreGroupNonFunctional = true; fapi2::Target l_chip = plat_getChipTarget(); // Read the EQ and EC gard attributes from the chip target @@ -449,8 +472,6 @@ fapi_try_exit: // Iterate over the bits in EQ and EC gards, if set, mark the // corresponding target non-functional - // TODO: Need to mark corresponding EX targets non-functional when we - // start supporting EX targets in the global target vector for(uint32_t l_idx = 0; l_idx < EQ_TARGET_COUNT; ++l_idx) { if((l_mask >> l_idx) & (((uint32_t)(l_eqGards)) << 24)) @@ -473,6 +494,21 @@ fapi_try_exit: l_target.setFunctional(false); G_vec_targets.at(l_idx + CORE_TARGET_OFFSET) = l_target.get(); } + else + { + l_coreGroupNonFunctional = false; + } + if(0 == ((l_idx + 1) % CORES_PER_EX)) + { + if(true == l_coreGroupNonFunctional) + { + // All cores of this group are non-functional. Mark the EX + // non-functional too. + G_vec_targets.at((l_idx / CORES_PER_EX) + EX_TARGET_OFFSET).fields.functional = false; + } + // Reset ex non-functional flag for the next group + l_coreGroupNonFunctional = true; + } } fapi_try_exit: return fapi2::current_err; @@ -508,4 +544,5 @@ fapi_try_exit: } return G_vec_targets[l_idx]; } + } // fapi2 -- cgit v1.2.1