summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hwpf/include/plat/plat_target_utils.H6
-rw-r--r--hwpf/src/plat/target.C56
-rw-r--r--sbe/sbefw/sbecmdcntlinst.C29
-rw-r--r--sbe/sbefw/sbecmdmemaccess.C27
-rw-r--r--sbe/sbefw/sbecmdregaccess.C30
5 files changed, 119 insertions, 29 deletions
diff --git a/hwpf/include/plat/plat_target_utils.H b/hwpf/include/plat/plat_target_utils.H
index 6c84eaf5..33dc7740 100644
--- a/hwpf/include/plat/plat_target_utils.H
+++ b/hwpf/include/plat/plat_target_utils.H
@@ -59,13 +59,15 @@ namespace fapi2
Target<TARGET_TYPE_PROC_CHIP> plat_getChipTarget();
/// @brief Function to return a platform target handle, given the chiplet
- // number
+ // number and the fapi2 Target type
+ // @tparam K The fapi2 TargetType
// @param i_chipletNumber The chiplet number of the target
// @return Platform handle
// @note The caller can use the platform handle to construct a Target of
// it's choice. Ex:
// fapi2::Target<fapi2::TARGET_TYPE_CORE>
- // l_core(plat_getTargetHandleByChipletNumber(0x20);
+ // l_core(plat_getTargetHandleByChipletNumber<fapi2::TARGET_TYPE_CORE>(0x20);
+ template <TargetType K>
plat_target_handle_t plat_getTargetHandleByChipletNumber(
const uint8_t i_chipletNumber);
}
diff --git a/hwpf/src/plat/target.C b/hwpf/src/plat/target.C
index b1a7a7a6..61d8d00b 100644
--- a/hwpf/src/plat/target.C
+++ b/hwpf/src/plat/target.C
@@ -267,7 +267,8 @@ fapi_try_exit:
{
fapi2::Target<fapi2::TARGET_TYPE_MCS> target_name((fapi2::plat_target_handle_t)i);
- fapi2::Target<fapi2::TARGET_TYPE_PERV> l_nestTarget((plat_getTargetHandleByChipletNumber(N3_CHIPLET - (MCS_PER_MCBIST * (i / MCS_PER_MCBIST)))));
+ fapi2::Target<fapi2::TARGET_TYPE_PERV>
+ l_nestTarget((plat_getTargetHandleByChipletNumber<TARGET_TYPE_PERV>(N3_CHIPLET - (MCS_PER_MCBIST * (i / MCS_PER_MCBIST)))));
uint32_t l_attrPg = 0;
@@ -368,35 +369,46 @@ fapi_try_exit:
return fapi2::current_err;
}
- /// @brief Function to return a platform target handle, given the chiplet
- // number
- // @param i_chipletNumber The chiplet number of the target
- // @return Platform target handle
- // @note The caller can use the platform target handle to construct a
- // Target of it's choice. Ex:
- // fapi2::Target<fapi2::TARGET_TYPE_CORE>
- // l_core(plat_getTargetHandleByChipletNumber(0x20);
+ // Get the plat target handle by chiplet number - For PERV and EQ targets
+ template<TargetType K>
plat_target_handle_t plat_getTargetHandleByChipletNumber(
const uint8_t i_chipletNumber)
{
+ static_assert((K == TARGET_TYPE_EQ) || (K == TARGET_TYPE_PERV),
+ "Invalid target type");
assert(((i_chipletNumber > 0) &&
- (i_chipletNumber < (EQ_CHIPLET_OFFSET + EQ_TARGET_COUNT))) ||
- ((i_chipletNumber >= CORE_CHIPLET_OFFSET) &&
+ (i_chipletNumber < (EQ_CHIPLET_OFFSET + EQ_TARGET_COUNT))))
+
+ uint32_t l_idx = (i_chipletNumber - NEST_GROUP1_CHIPLET_OFFSET) +
+ NEST_GROUP1_TARGET_OFFSET;
+ return G_vec_targets[l_idx];
+ }
+
+ // Get the plat target handle by chiplet number - For CORE targets
+ template<>
+ plat_target_handle_t plat_getTargetHandleByChipletNumber<TARGET_TYPE_CORE>(
+ const uint8_t i_chipletNumber)
+ {
+ assert(((i_chipletNumber >= CORE_CHIPLET_OFFSET) &&
(i_chipletNumber < (CORE_CHIPLET_OFFSET + CORE_TARGET_COUNT))));
- uint32_t l_idx = 0;
+ uint32_t l_idx = (i_chipletNumber - CORE_CHIPLET_OFFSET) +
+ CORE_TARGET_OFFSET;
- if(i_chipletNumber < (EQ_CHIPLET_OFFSET + EQ_TARGET_COUNT))
- {
- l_idx = (i_chipletNumber - NEST_GROUP1_CHIPLET_OFFSET) +
- NEST_GROUP1_TARGET_OFFSET;
- }
- else
- {
- l_idx = (i_chipletNumber - CORE_CHIPLET_OFFSET) +
- CORE_TARGET_OFFSET;
- }
return G_vec_targets[l_idx];
}
+ // Get the plat target handle by chiplet number - For EX targets
+ template<>
+ plat_target_handle_t plat_getTargetHandleByChipletNumber<TARGET_TYPE_EX>(
+ const uint8_t i_chipletNumber)
+ {
+ assert(((i_chipletNumber >= CORE_CHIPLET_OFFSET) &&
+ (i_chipletNumber < (CORE_CHIPLET_OFFSET + CORE_TARGET_COUNT))));
+
+ uint32_t l_idx = ((i_chipletNumber - CORE_CHIPLET_OFFSET) / 2) +
+ EX_TARGET_OFFSET;
+
+ return G_vec_targets[l_idx];
+ }
} // fapi2
diff --git a/sbe/sbefw/sbecmdcntlinst.C b/sbe/sbefw/sbecmdcntlinst.C
index 824d3e08..a6be068c 100644
--- a/sbe/sbefw/sbecmdcntlinst.C
+++ b/sbe/sbefw/sbecmdcntlinst.C
@@ -1,3 +1,27 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: sbe/sbefw/sbecmdcntlinst.C $ */
+/* */
+/* 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 */
/*
* @file: ppe/sbe/sbefw/sbecmdcntlinst.C
*
@@ -108,8 +132,9 @@ uint32_t sbeCntlInst(uint8_t *i_pArg)
uint64_t l_state;
do
{
- fapi2::Target<fapi2::TARGET_TYPE_CORE> l_coreTgt(
- plat_getTargetHandleByChipletNumber(l_core));
+ fapi2::Target<fapi2::TARGET_TYPE_CORE>
+ l_coreTgt(plat_getTargetHandleByChipletNumber
+ <fapi2::TARGET_TYPE_CORE>(l_core));
if(!l_coreTgt.isFunctional())
{
continue;
diff --git a/sbe/sbefw/sbecmdmemaccess.C b/sbe/sbefw/sbecmdmemaccess.C
index 790e4c94..b697a3ea 100644
--- a/sbe/sbefw/sbecmdmemaccess.C
+++ b/sbe/sbefw/sbecmdmemaccess.C
@@ -1,3 +1,27 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: sbe/sbefw/sbecmdmemaccess.C $ */
+/* */
+/* 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: ppe/sbe/sbefw/sbecmdmemaccess.C
*
@@ -279,7 +303,8 @@ uint32_t processPbaRequest(const sbeMemAccessReqMsgHdr_t &i_hdr,
//Derive the EX target from the input Core Chiplet Id
//Core0/1 -> EX0, Core2/3 -> EX1, Core4/5 -> EX2, Core6/7 -> EX3
//..so on
- l_ex = plat_getTargetHandleByChipletNumber((i_hdr.coreChipletId)/2);
+ l_ex = plat_getTargetHandleByChipletNumber<fapi2::TARGET_TYPE_EX>
+ (i_hdr.coreChipletId);
}
// By default, ex_chipletId printed below won't be used unless accompanied
// by LCO_mode.
diff --git a/sbe/sbefw/sbecmdregaccess.C b/sbe/sbefw/sbecmdregaccess.C
index 1b0fbe39..bb83cab2 100644
--- a/sbe/sbefw/sbecmdregaccess.C
+++ b/sbe/sbefw/sbecmdregaccess.C
@@ -1,3 +1,27 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: sbe/sbefw/sbecmdregaccess.C $ */
+/* */
+/* 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 */
/*
* @file: ppe/sbe/sbefw/sbecmdregaccess.C
*
@@ -75,7 +99,8 @@ uint32_t sbeGetReg(uint8_t *i_pArg)
break;
}
uint8_t core = regReqMsg.coreChiplet;
- RamCore ramCore( plat_getTargetHandleByChipletNumber(core),
+ RamCore ramCore( plat_getTargetHandleByChipletNumber
+ <fapi2::TARGET_TYPE_CORE>(core),
regReqMsg.threadNr );
fapiRc = ramCore.ram_setup();
@@ -186,7 +211,8 @@ uint32_t sbePutReg(uint8_t *i_pArg)
break;
}
uint8_t core = regReqMsg.coreChiplet;
- RamCore ramCore( plat_getTargetHandleByChipletNumber(core),
+ RamCore ramCore( plat_getTargetHandleByChipletNumber
+ <fapi2::TARGET_TYPE_CORE>(core),
regReqMsg.threadNr );
fapiRc = ramCore.ram_setup();
OpenPOWER on IntegriCloud