summaryrefslogtreecommitdiffstats
path: root/src/hwpf/include/plat
diff options
context:
space:
mode:
authorShakeeb <shakeebbk@in.ibm.com>2016-08-27 10:50:49 -0500
committerSachin Gupta <sgupta2m@in.ibm.com>2016-08-30 06:01:06 -0400
commitf2d94b5f809410300fe10dc9d0786790018463a0 (patch)
tree467f90297b0eb7c5c6672653d778ed4734c0d5a3 /src/hwpf/include/plat
parent49b557dcae32250e8e06c4de895c0b7ba0e8009e (diff)
downloadtalos-sbe-f2d94b5f809410300fe10dc9d0786790018463a0.tar.gz
talos-sbe-f2d94b5f809410300fe10dc9d0786790018463a0.zip
SBE code restructure: sbe -> src rename
Change-Id: I6e4378d0e71a00ed2b239658d43f180df2a9b748 RTC:159709 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/28875 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: RAJA DAS <rajadas2@in.ibm.com> Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Diffstat (limited to 'src/hwpf/include/plat')
-rw-r--r--src/hwpf/include/plat/hwp_executor.H64
-rw-r--r--src/hwpf/include/plat/multicast.H54
-rw-r--r--src/hwpf/include/plat/plat_attributes.H36
-rw-r--r--src/hwpf/include/plat/plat_error_scope.H70
-rw-r--r--src/hwpf/include/plat/plat_hw_access.H148
-rw-r--r--src/hwpf/include/plat/plat_includes.H39
-rw-r--r--src/hwpf/include/plat/plat_ring_traverse.H116
-rw-r--r--src/hwpf/include/plat/plat_target.H215
-rw-r--r--src/hwpf/include/plat/plat_target_definitions.H111
-rw-r--r--src/hwpf/include/plat/plat_target_filter.H89
-rw-r--r--src/hwpf/include/plat/plat_target_parms.H92
-rw-r--r--src/hwpf/include/plat/plat_target_utils.H86
-rw-r--r--src/hwpf/include/plat/plat_trace.H113
-rw-r--r--src/hwpf/include/plat/target.H434
14 files changed, 1667 insertions, 0 deletions
diff --git a/src/hwpf/include/plat/hwp_executor.H b/src/hwpf/include/plat/hwp_executor.H
new file mode 100644
index 00000000..ae7b5823
--- /dev/null
+++ b/src/hwpf/include/plat/hwp_executor.H
@@ -0,0 +1,64 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/hwpf/include/plat/hwp_executor.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 */
+/**
+ * @file fapi2PlatHwpExecutor.H
+ *
+ * @brief Defines the FAPI HWP Executor Macro.
+ *
+ * The HWP Executor macro is called when a PLAT invoker function or a HWP wants
+ * to execute a HWP. Each platform can modify the macro to do any platform
+ * specific work to execute the HWP (e.g. dlopening a shared library)
+ */
+
+#ifndef FAPI2PLATHWPEXECUTOR_H_
+#define FAPI2PLATHWPEXECUTOR_H_
+
+/**
+ * @brief HWP Executor macro
+ *
+ * By default, this macro just calls the HWP directly. If this cannot be done
+ * then the platform needs to modify
+ */
+
+#include <return_code.H>
+#include <target.H>
+
+
+
+// Macro to execute an arbitrary function with an arbitray number of arguments. The
+// function is in a shared lib that must be dlopened. All that is required is that
+// there is a typedef for the function pointer available that is called <FUNC>_FP_t
+// i.e. if the function is called foo, then the typedef is called foo_FP_t
+#define FAPI_PLAT_EXEC_HWP(RC, FUNC, _args_...) \
+{\
+ RC = FUNC(_args_); \
+}
+
+#define FAPI_PLAT_EXEC_HWP_LAMBDA(FUNC, _args_...) \
+[&]()->fapi2::ReturnCode \
+{\
+ FUNC(_args_); \
+}()
+
+#endif // FAPI2PLATHWPEXECUTOR_H_
diff --git a/src/hwpf/include/plat/multicast.H b/src/hwpf/include/plat/multicast.H
new file mode 100644
index 00000000..46d64be8
--- /dev/null
+++ b/src/hwpf/include/plat/multicast.H
@@ -0,0 +1,54 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/hwpf/include/plat/multicast.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 __FAPI2_MULTICAST__
+#define __FAPI2_MULTICAST__
+
+#include <fapi2_multicast.H>
+
+namespace fapi2
+{
+
+template<MulticastType M, MulticastGroup G, typename V>
+template<MulticastType O, MulticastGroup N>
+inline void Multicast<M, G, V>::updateHandle(V& i_value)
+{
+ // Update handle only if multicast bit is set in handle, else we leave the
+ // handle unchanged. This enables the same procedure to work with both
+ // multicast and unicast targets
+ if(i_value.fields.is_multicast)
+ {
+ // Update the handle to reflect the new multicast type and group
+ i_value.fields.chiplet_num = (0x40) | (O << 3) | N;
+ }
+}
+
+template<MulticastType M, MulticastGroup G, typename V>
+inline bool Multicast<M, G, V>::isMulticast() const
+{
+ return iv_handle.fields.is_multicast;
+}
+
+}
+
+#endif
diff --git a/src/hwpf/include/plat/plat_attributes.H b/src/hwpf/include/plat/plat_attributes.H
new file mode 100644
index 00000000..6aec47e3
--- /dev/null
+++ b/src/hwpf/include/plat/plat_attributes.H
@@ -0,0 +1,36 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/hwpf/include/plat/plat_attributes.H $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,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 */
+/**
+ * @file plat_attributes.H
+ * @brief Platform specific attribute headers
+ */
+
+#ifndef __PLAT_ATTTRIBUTE_H__
+#define __PLAT_ATTTRIBUTE_H__
+
+#include <fapi2AttributeService.H>
+#include <fapi2AttributeIds.H> // Generated file
+//#include <plat_target_pg_attributes.H>
+
+#endif // __PLAT_ATTTRIBUTE_H__
diff --git a/src/hwpf/include/plat/plat_error_scope.H b/src/hwpf/include/plat/plat_error_scope.H
new file mode 100644
index 00000000..505ec6cb
--- /dev/null
+++ b/src/hwpf/include/plat/plat_error_scope.H
@@ -0,0 +1,70 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/hwpf/include/plat/plat_error_scope.H $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,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 */
+/**
+ * @file plat_error_scope.H
+ * @brief platform definitions which create a scope for automatic error handling
+ */
+
+#ifndef __FAPI2_PLAT_ERROR_SCOPE__
+#define __FAPI2_PLAT_ERROR_SCOPE__
+
+/// @cond
+#define PLAT_FAPI_TRY_NO_TRACE( __operation__ ) \
+ if ((fapi2::current_err = (__operation__)) != fapi2::FAPI2_RC_SUCCESS) \
+ { \
+ goto fapi_try_exit; \
+ }
+
+#define PLAT_FAPI_TRY_TRACE( __operation__, ... ) \
+ if ((fapi2::current_err = (__operation__)) != fapi2::FAPI2_RC_SUCCESS) \
+ { \
+ FAPI_ERR(__VA_ARGS__); \
+ goto fapi_try_exit; \
+ }
+
+///
+/// @brief Assert a conditional is true.
+/// If it is not, the FFDC gathering function is called and the
+/// trace is output as a FAPI error trace.
+/// @param[in] __conditional__ the condition to assert
+/// @param[in] __ffdc__ the FFDC gathering function
+/// @param[in] ... varargs, as input to FAPI_ERR
+///
+#define PLAT_FAPI_ASSERT( __conditional__, __ffdc__, ... ) \
+ if (! (__conditional__)) \
+ { \
+ (__ffdc__).execute(); \
+ FAPI_ERR(__VA_ARGS__); \
+ goto fapi_try_exit; \
+ }
+
+
+///
+/// @brief Temporary macro for error label until all are removed.
+/// @todo REMOVE this in time.
+#define FAPI_CLEANUP() \
+fapi_try_exit:
+/// @endcond
+
+#endif
diff --git a/src/hwpf/include/plat/plat_hw_access.H b/src/hwpf/include/plat/plat_hw_access.H
new file mode 100644
index 00000000..89c02f2a
--- /dev/null
+++ b/src/hwpf/include/plat/plat_hw_access.H
@@ -0,0 +1,148 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/hwpf/include/plat/plat_hw_access.H $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2015,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 */
+/**
+ * @file plat_hw_access.H
+ *
+ * @brief Define platform specific calls for hardware accesses.
+ */
+
+#ifndef PLATHWACCESS_H_
+#define PLATHWACCESS_H_
+
+#include <plat_includes.H>
+#include "hw_access_def.H"
+#include <return_code.H>
+
+
+/// PIB Error Mask
+
+#define PLAT_SET_PIB_ERROR_MASK(_m_mask) \
+ { /* Read MSR */ \
+ uint32_t msr_data = mfmsr(); \
+ /* Set SEM field */ \
+ msr_data &= ~(BITS(0,8)); \
+ msr_data |= (uint32_t)(i_mask << 24); \
+ /* Write MSR */ \
+ mtmsr(msr_data); \
+ };
+
+#define PLAT_GET_PIB_ERROR_MASK(_m_mask) \
+ uint8_t _m_mask; \
+ uint32_t _sem = mfmsr(); \
+ _m_mask = (uint8_t)((_sem & MSR_SEM) >> (32-(MSR_SEM_START_BIT + MSR_SEM_LEN)));
+
+// Building block PPE instructions
+#define PPE_MFMSR(_m_data) \
+asm volatile \
+ ( \
+ "mfmsr %[data] \n" \
+ : [data]"=&r"(*_m_data) \
+ : "[data]"(*_m_data) \
+ );
+
+#define PPE_MTMSR(_m_data) \
+asm volatile \
+ ( \
+ "mtmsr %[data] \n" \
+ : [data]"=&r"(*_m_data) \
+ : "[data]"(*_m_data) \
+ );
+
+/// GetScom
+#define PLAT_GETSCOM(_m_rc, _m_base, _m_offset, _m_data) \
+ _m_rc = fapi2::getscom_abs_wrap(getEffectiveAddress(_m_base, _m_offset), _m_data)
+
+/// PutScom
+#define PLAT_PUTSCOM(_m_rc, _m_base, _m_offset, _m_data) \
+ _m_rc = fapi2::putscom_abs_wrap(getEffectiveAddress(_m_base, _m_offset), _m_data)
+
+/// GetCFAM
+#define PLAT_GETCFAM(_m_base, _m_offset, _m_data) \
+ static_assert( K == TARGET_TYPE_NONE, \
+ "getCfamRegister is not supported by PPE platforms")
+
+/// PutCFAM
+#define PLAT_PUTCFAM(_m_base, _m_offset, _m_data) \
+ static_assert( K == TARGET_TYPE_NONE, \
+ "putCfamRegister is not supported by PPE platforms")
+
+/// ModifyCFAM
+#define PLAT_MODCFAM(_m_base, _m_offset, _m_data, _m_mode) \
+ static_assert( K == TARGET_TYPE_NONE, \
+ "modifyCfamRegister is not supported by PPE platforms")
+
+namespace fapi2
+{
+ // This function loads the scan region data for the given ring address and
+ // updates the check word data
+ // @param[in] : ring addtress
+ // @param[in]: ring mode
+ // @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ fapi2::ReturnCode getRing_setup(const uint32_t i_ringAddress,
+ const fapi2::RingMode i_ringMode);
+
+ // This function read the 64 bit data from the hardware
+ // @param[in] i_ringAddress - absolute ring address
+ // @param [out]: 64 bit data
+ // @param [in] i_bitShiftValue - Bit shift value that needs to rotate
+ // @note- If the ring length is divisble by 64, then bitshift will always be
+ // 64, else need to store the ring_length mod 64 and send that value in the
+ // last iteration.
+ // @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ fapi2::ReturnCode getRing_granule_data(const uint32_t i_ringAddress,
+ uint64_t *o_data,
+ const uint32_t i_bitShiftValue);
+
+ // This function verify the check word data is matching or not and will
+ // clean up the scan region data
+ // @param[in] i_ringAddress - absolute ring address
+ // @param[in] i_ringMode - Ring mode value
+ // @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ fapi2::ReturnCode getRing_verifyAndcleanup(const uint32_t i_ringAddress,
+ const fapi2::RingMode i_ringMode);
+
+ ///
+ /// @brief Platform wrapper over PK getscom_abs
+ ///
+ /// @param [in] i_addr The SCOM address
+ /// @param [out] o_data The data read
+ ///
+ /// @return PCB-PIB return code
+ ///
+ uint32_t getscom_abs_wrap(const uint32_t i_addr, uint64_t *o_data);
+
+ ///
+ /// @brief Platform wrapper over PK putscom_abs
+ ///
+ /// @param [in] i_addr The SCOM address
+ /// @param [in] i_data The data read
+ ///
+ /// @return PCB-PIB return code
+ ///
+ uint32_t putscom_abs_wrap(const uint32_t i_addr, uint64_t i_data);
+}
+
+
+#endif // PLATHWACCESS_H_
+
diff --git a/src/hwpf/include/plat/plat_includes.H b/src/hwpf/include/plat/plat_includes.H
new file mode 100644
index 00000000..62f8a9b0
--- /dev/null
+++ b/src/hwpf/include/plat/plat_includes.H
@@ -0,0 +1,39 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/hwpf/include/plat/plat_includes.H $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,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 */
+/**
+ * @file plat_includes.H
+ * @brief Platform specific include to implement FAPI2 APIs
+ */
+
+#ifndef __PLAT_INCLUDES_H__
+#define __PLAT_INCLUDES_H__
+
+#include <plat_hw_access.H>
+
+#include <ppe42_scom.h>
+#include <ppe42_msr.h>
+//#include <pk.h>
+
+
+#endif // __PLAT_INCLUDES_H__
diff --git a/src/hwpf/include/plat/plat_ring_traverse.H b/src/hwpf/include/plat/plat_ring_traverse.H
new file mode 100644
index 00000000..5fc470e2
--- /dev/null
+++ b/src/hwpf/include/plat/plat_ring_traverse.H
@@ -0,0 +1,116 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/hwpf/include/plat/plat_ring_traverse.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_RING_TRAVERSE_H_
+#define _PLAT_RING_TRAVERSE_H_
+
+#include <p9_putRingUtils.H> // for RS4 decompression utilities
+
+using namespace RING_TYPES;
+
+/// @brief This structure represents the layout of the Section-TOR
+/// Section-TOR has the offsets to the different chiplet's
+/// Common Ring section and Instance Ring section
+struct SectionTOR
+{
+ uint32_t TOC_PERV_COMMON_RING; // Offset of Perv Common Ring section
+ uint32_t TOC_PERV_INSTANCE_RING; // Offset of Perv Instance Ring section
+
+ uint32_t TOC_N0_COMMON_RING; // Offset of N0 Common Ring section
+ uint32_t TOC_N0_INSTANCE_RING; // Offset of N0 Instance Ring section
+
+ uint32_t TOC_N1_COMMON_RING; // Offset of N1 Common Ring section
+ uint32_t TOC_N1_INSTANCE_RING; // Offset of N1 Instance Ring section
+
+ uint32_t TOC_N2_COMMON_RING; // Offset of N2 Common Ring section
+ uint32_t TOC_N2_INSTANCE_RING; // Offset of N2 Instance Ring section
+
+ uint32_t TOC_N3_COMMON_RING; // Offset of N3 Common Ring section
+ uint32_t TOC_N3_INSTANCE_RING; // Offset of N3 Instance Ring section
+
+ uint32_t TOC_XB_COMMON_RING; // Offset of XB Common Ring section
+ uint32_t TOC_XB_INSTANCE_RING; // Offset of XB Instance Ring section
+
+ uint32_t TOC_MC_COMMON_RING; // Offset of MC Common Ring section
+ uint32_t TOC_MC_INSTANCE_RING; // Offset of MC Instance Ring section
+
+ uint32_t TOC_OB0_COMMON_RING; // Offset of OB0 Common Ring section
+ uint32_t TOC_OB0_INSTANCE_RING; // Offset of OB0 Instance Ring section
+
+ uint32_t TOC_OB1_COMMON_RING; // Offset of OB1 Common Ring section
+ uint32_t TOC_OB1_INSTANCE_RING; // Offset of OB1 Instance Ring section
+
+ uint32_t TOC_OB2_COMMON_RING; // Offset of OB2 Common Ring section
+ uint32_t TOC_OB2_INSTANCE_RING; // Offset of OB2 Instance Ring section
+
+ uint32_t TOC_OB3_COMMON_RING; // Offset of OB3 Common Ring section
+ uint32_t TOC_OB3_INSTANCE_RING; // Offset of OB3 Instance Ring section
+
+ uint32_t TOC_PCI0_COMMON_RING; // Offset of PCI0 Common Ring section
+ uint32_t TOC_PCI0_INSTANCE_RING; // Offset of PCI0 Instance Ring section
+
+ uint32_t TOC_PCI1_COMMON_RING; // Offset of PCI1 Common Ring section
+ uint32_t TOC_PCI1_INSTANCE_RING; // Offset of PCI1 Instance Ring section
+
+ uint32_t TOC_PCI2_COMMON_RING; // Offset of PCI2 Common Ring section
+ uint32_t TOC_PCI2_INSTANCE_RING; // Offset of PCI2 Instance Ring section
+
+ uint32_t TOC_EQ_COMMON_RING; // Offset of Quad Common Ring section
+ uint32_t TOC_EQ_INSTANCE_RING; // Offset of Quad Instance Ring section
+
+ uint32_t TOC_EC_COMMON_RING; // Offset of Core Common Ring section
+ uint32_t TOC_EC_INSTANCE_RING; // Offset of Core Instance Ring section
+};
+
+
+///
+/// @brief This is a plat pecific (SBE Plat) function that locates the
+/// Ring Container in the image and calls the functin to decompress the
+/// RS4 string and apply it to the hardware.
+/// @param i_target The target of Ring apply.
+/// @param i_ringID The Ring ID that identifies the ring to be applied.
+/// @return FAPI2_RC_SUCCESS on success, else error code.
+///
+fapi2::ReturnCode findRS4InImageAndApply(
+ const fapi2::Target<fapi2::TARGET_TYPE_ALL>& i_target,
+ const RingID i_ringID,
+ const fapi2::RingMode i_ringMode);
+///
+/// @brief This is a plat pecific (SBE Plat) function that locates the
+/// Ring Container in the image and calls the functin to decompress the
+/// RS4 string and apply it to the hardware.
+/// @param i_target The target of Ring apply.
+/// @param i_ringID The Ring ID that identifies the ring to be applied.
+/// @param i_sectionTOR TOR section address
+/// @param i_applyOverride override is enabled or not
+/// @return FAPI2_RC_SUCCESS on success, else error code.
+///
+fapi2::ReturnCode getRS4ImageFromTor(
+ const fapi2::Target<fapi2::TARGET_TYPE_ALL>& i_target,
+ const RingID i_ringID,
+ SectionTOR *i_sectionTOR,
+ bool i_applyOverride,
+ const uint32_t i_sectionOffset,
+ const fapi2::RingMode i_ringMode);
+#endif
diff --git a/src/hwpf/include/plat/plat_target.H b/src/hwpf/include/plat/plat_target.H
new file mode 100644
index 00000000..a4eca5a8
--- /dev/null
+++ b/src/hwpf/include/plat/plat_target.H
@@ -0,0 +1,215 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/hwpf/include/plat/plat_target.H $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2015,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 */
+/**
+ * @file plat_target.H
+ * @brief platform definitions for fapi2 targets
+ */
+
+#ifndef __FAPI2_PLAT_TARGET__
+#define __FAPI2_PLAT_TARGET__
+
+#include <stdint.h>
+#include <target_types.H>
+#include <target_states.H>
+#include <assert.h>
+#include <plat_target_parms.H>
+#include <vector>
+
+static const uint8_t CORES_PER_QUAD = 4;
+static const uint8_t EX_PER_QUAD = 2;
+static const uint8_t CORES_PER_EX = 2;
+static const uint8_t N3_CHIPLET = 5;
+static const uint8_t MCS_PER_MCBIST = 2;
+
+//
+// Define what a platform handle looks like. For Hostboot,
+// for example, this might be a void*. For the SBE, this
+// will be a uint32_t ...
+//
+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 {
+#ifdef _BIG_ENDIAN
+ uint32_t chiplet_num : 8;
+ uint32_t type_target_num : 8;
+ uint32_t present : 1;
+ uint32_t functional : 1;
+ uint32_t is_multicast : 1;
+ uint32_t valid : 1;
+ uint32_t type : 12;
+#else
+ uint32_t type : 12;
+ uint32_t valid : 1;
+ uint32_t is_multicast : 1;
+ uint32_t functional : 1;
+ uint32_t present : 1;
+ uint32_t type_target_num : 8;
+ uint32_t chiplet_num : 8;
+#endif
+ } fields;
+ ///
+ /// @brief Plat target handle constructor
+ ///
+ /// @param i_value Value to instantiate handle with
+ ///
+ plat_target_handle(uint32_t i_value = 0):value(i_value) {}
+
+ ///
+ /// @brief Get the fapi2::TargetType for this target
+ ///
+ /// @par Converts the internal PPE type for this target to fapi2 enum
+ ///
+ /// @return The fapi2::TargetType for this target
+ ///
+ TargetType getFapiTargetType() const;
+
+ ///
+ /// @brief Get the instance number for this target
+ ///
+ /// @return The instance number for this target
+ ///
+ inline uint32_t getTargetInstance() const
+ {
+ return fields.type_target_num;
+ }
+
+ ///
+ /// @brief Get this target's children
+ ///
+ /// @param [in] i_parentType fapi2 type of the parent
+ /// @param [in] i_childType fapi2 type of the child
+ /// @param [in] i_platType Plat type of the parent
+ /// @param [in] i_state Required state of the children
+ /// @param [out] o_children A vector of child target handles
+ ///
+ void getChildren(const TargetType i_parentType,
+ const TargetType i_childType,
+ const plat_target_type_t i_platType,
+ const TargetState i_state,
+ std::vector<plat_target_handle> &o_children) const;
+
+ ///
+ /// @brief Get proc chip target's children - filtered
+ ///
+ /// @param [in] i_filter Target filter
+ /// @param [in] i_state Required state of the children
+ /// @param [out] o_children A vector of child target handles
+ ///
+ void getChildren(const TargetFilter i_filter,
+ const TargetState i_state,
+ std::vector<plat_target_handle>& o_children) const;
+
+ ///
+ /// @brief Gets the plat target handle as a uint32
+ ///
+ /// @return Plat target handle as a uint32_t
+ ///
+ operator uint32_t() const {return value;}
+ } plat_target_handle_t;
+
+ typedef plat_target_handle_t plat_target_argument_t;
+
+ template<TargetType K, bool MULTICAST = false>
+ plat_target_handle_t createPlatTargetHandle(const uint32_t i_plat_argument)
+ {
+ static_assert((MULTICAST != true) || (K == TARGET_TYPE_PROC_CHIP),
+ "Only PROC_CHIP types can be multicast");
+ plat_target_handle_t l_handle = 0;
+
+ if(MULTICAST == true)
+ {
+ // Simply set the is multicast flag
+ l_handle.fields.is_multicast = 1;
+ }
+ else if(K & TARGET_TYPE_PROC_CHIP)
+ {
+ l_handle.fields.chiplet_num = 0;
+ l_handle.fields.type = PPE_TARGET_TYPE_PROC_CHIP;
+ l_handle.fields.type_target_num = 0;
+ }
+ else if(K & TARGET_TYPE_PERV)
+ {
+ l_handle.fields.chiplet_num = i_plat_argument + NEST_GROUP1_CHIPLET_OFFSET;
+ l_handle.fields.type = PPE_TARGET_TYPE_PERV;
+ l_handle.fields.type_target_num = i_plat_argument;
+ }
+ else if(K & TARGET_TYPE_CORE)
+ {
+ l_handle.fields.chiplet_num = i_plat_argument + CORE_CHIPLET_OFFSET;
+ l_handle.fields.type = PPE_TARGET_TYPE_CORE | PPE_TARGET_TYPE_PERV;
+ l_handle.fields.type_target_num = i_plat_argument;
+ }
+ else if(K & TARGET_TYPE_EQ)
+ {
+ l_handle.fields.chiplet_num = i_plat_argument + EQ_CHIPLET_OFFSET;
+ l_handle.fields.type = PPE_TARGET_TYPE_EQ | PPE_TARGET_TYPE_PERV;
+ l_handle.fields.type_target_num = i_plat_argument;
+ }
+ else if(K & TARGET_TYPE_EX)
+ {
+ l_handle.fields.chiplet_num = (i_plat_argument / 2) + EX_CHIPLET_OFFSET;
+ l_handle.fields.type = PPE_TARGET_TYPE_EX;
+ l_handle.fields.type_target_num = i_plat_argument;
+ }
+ else if(K & TARGET_TYPE_MCBIST)
+ {
+ l_handle.fields.chiplet_num = i_plat_argument + MCBIST_CHIPLET_OFFSET;
+ l_handle.fields.type = PPE_TARGET_TYPE_MCBIST | PPE_TARGET_TYPE_PERV;
+ l_handle.fields.type_target_num = i_plat_argument;
+ }
+ else if(K & TARGET_TYPE_MCS)
+ {
+ l_handle.fields.chiplet_num = N3_CHIPLET - (MCS_PER_MCBIST * (i_plat_argument / MCS_PER_MCBIST));
+ l_handle.fields.type = PPE_TARGET_TYPE_MCS;
+ l_handle.fields.type_target_num = i_plat_argument;
+ }
+ else if(K == TARGET_TYPE_ALL)
+ {
+ l_handle.fields.chiplet_num = i_plat_argument;
+ l_handle.fields.type = PPE_TARGET_TYPE_ALL;
+ }
+
+ l_handle.fields.valid = 1;
+ return l_handle;
+ }
+
+};
+
+#endif
diff --git a/src/hwpf/include/plat/plat_target_definitions.H b/src/hwpf/include/plat/plat_target_definitions.H
new file mode 100644
index 00000000..daa9d228
--- /dev/null
+++ b/src/hwpf/include/plat/plat_target_definitions.H
@@ -0,0 +1,111 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/hwpf/include/plat/plat_target_definitions.H $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,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 */
+/**
+ * @file plat_ppe_target.H
+ * @brief Definitions for fapi2 PPE targets
+ */
+
+#ifndef __FAPI2_PPE_TARGET__
+#define __FAPI2_PPE_TARGET__
+
+#define TARGET_CHIP(_name, _index) \
+ fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP > _name((uint64_t)_index);
+
+#define TARGET_CHIP_PERV(_name, _index) \
+ fapi2::Target<fapi2::TARGET_TYPE_PERV> _name((uint64_t)_index);
+
+#define TARGET_EQ(_name, _index) \
+ fapi2::Target<fapi2::TARGET_TYPE_EQ> _name((uint64_t)_index);
+
+#define TARGET_CORE(_name, _index) \
+ fapi2::Target<fapi2::TARGET_TYPE_CORE> _name((uint64_t)_index);
+
+#define TARGET_EX(_name, _index) \
+ fapi2::Target<fapi2::TARGET_TYPE_EX> _name((uint64_t)_index);
+
+namespace fapi2
+{
+
+ TARGET_CHIP (chip_target, 0);
+ TARGET_CHIP_PERV (perv_target, 1);
+ TARGET_CHIP_PERV (n0_target, 2);
+ TARGET_CHIP_PERV (n1_target, 3);
+ TARGET_CHIP_PERV (n2_target, 4);
+ TARGET_CHIP_PERV (n3_target, 5);
+ TARGET_CHIP_PERV (xb_target, 6);
+ TARGET_CHIP_PERV (mc0_target, 7);
+ TARGET_CHIP_PERV (mc1_target, 8);
+ TARGET_CHIP_PERV (ob0_target, 9);
+ TARGET_CHIP_PERV (ob1_target, 10);
+ TARGET_CHIP_PERV (ob2_target, 11);
+ TARGET_CHIP_PERV (ob3_target, 12);
+ TARGET_CHIP_PERV (pci0_target, 13);
+ TARGET_CHIP_PERV (pci1_target, 14);
+ TARGET_CHIP_PERV (pci2_target, 15);
+ TARGET_EQ (eq0_target, 0);
+ TARGET_EQ (eq1_target, 1);
+ TARGET_EQ (eq2_target, 2);
+ TARGET_EQ (eq3_target, 3);
+ TARGET_EQ (eq4_target, 4);
+ TARGET_EQ (eq5_target, 5);
+ TARGET_EX (ex0_target, 0);
+ TARGET_EX (ex1_target, 1);
+ TARGET_EX (ex2_target, 2);
+ TARGET_EX (ex3_target, 3);
+ TARGET_EX (ex4_target, 4);
+ TARGET_EX (ex5_target, 5);
+ TARGET_EX (ex6_target, 6);
+ TARGET_EX (ex7_target, 7);
+ TARGET_EX (ex8_target, 8);
+ TARGET_EX (ex9_target, 9);
+ TARGET_EX (ex10_target, 10);
+ TARGET_EX (ex11_target, 11);
+ TARGET_CORE (core0_target, 0);
+ TARGET_CORE (core1_target, 1);
+ TARGET_CORE (core2_target, 2);
+ TARGET_CORE (core3_target, 3);
+ TARGET_CORE (core4_target, 4);
+ TARGET_CORE (core5_target, 5);
+ TARGET_CORE (core6_target, 6);
+ TARGET_CORE (core7_target, 7);
+ TARGET_CORE (core8_target, 8);
+ TARGET_CORE (core9_target, 9);
+ TARGET_CORE (core10_target,10);
+ TARGET_CORE (core11_target,11);
+ TARGET_CORE (core12_target,12);
+ TARGET_CORE (core13_target,13);
+ TARGET_CORE (core14_target,14);
+ TARGET_CORE (core15_target,15);
+ TARGET_CORE (core16_target,16);
+ TARGET_CORE (core17_target,17);
+ TARGET_CORE (core18_target,18);
+ TARGET_CORE (core19_target,19);
+ TARGET_CORE (core20_target,20);
+ TARGET_CORE (core21_target,21);
+ TARGET_CORE (core22_target,22);
+ TARGET_CORE (core23_target,23);
+
+}; // fapi2 namespace
+
+#endif // __FAPI2_PPE_TARGET__
diff --git a/src/hwpf/include/plat/plat_target_filter.H b/src/hwpf/include/plat/plat_target_filter.H
new file mode 100644
index 00000000..aec258ab
--- /dev/null
+++ b/src/hwpf/include/plat/plat_target_filter.H
@@ -0,0 +1,89 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/hwpf/include/plat/plat_target_filter.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 __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/src/hwpf/include/plat/plat_target_parms.H b/src/hwpf/include/plat/plat_target_parms.H
new file mode 100644
index 00000000..17103a78
--- /dev/null
+++ b/src/hwpf/include/plat/plat_target_parms.H
@@ -0,0 +1,92 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/hwpf/include/plat/plat_target_parms.H $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,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 */
+/**
+ * @file plat_ppe_target.H
+ * @brief Definitions for fapi2 PPE targets
+ */
+
+#ifndef __FAPI2_PPE_TARGET_PARMS__
+#define __FAPI2_PPE_TARGET_PARMS__
+
+#include "fapi_sbe_common.H"
+
+
+CONST_UINT32_T(CHIP_TARGET_OFFSET, 0);
+CONST_UINT32_T(CHIP_TARGET_COUNT , 1);
+
+// Nest targets - Group 1
+CONST_UINT32_T(NEST_GROUP1_TARGET_OFFSET, CHIP_TARGET_OFFSET + CHIP_TARGET_COUNT);
+CONST_UINT32_T(NEST_GROUP1_CHIPLET_OFFSET, 0x1);
+CONST_UINT32_T(NEST_GROUP1_TARGET_COUNT, 6);
+
+// MCBIST targets
+CONST_UINT32_T(MCBIST_TARGET_OFFSET, NEST_GROUP1_TARGET_OFFSET + NEST_GROUP1_TARGET_COUNT);
+CONST_UINT32_T(MCBIST_CHIPLET_OFFSET, 0x7);
+CONST_UINT32_T(MCBIST_TARGET_COUNT, 2);
+
+// Nest targets - Group 2
+CONST_UINT32_T(NEST_GROUP2_TARGET_OFFSET, MCBIST_TARGET_OFFSET + MCBIST_TARGET_COUNT);
+CONST_UINT32_T(NEST_GROUP2_TARGET_COUNT, 7);
+CONST_UINT32_T(NEST_GROUP2_CHIPLET_OFFSET, 0x9);
+
+// Cache Targets
+CONST_UINT32_T(EQ_TARGET_OFFSET, NEST_GROUP2_TARGET_OFFSET + NEST_GROUP2_TARGET_COUNT);
+CONST_UINT32_T(EQ_CHIPLET_OFFSET, 0x10);
+CONST_UINT32_T(EQ_TARGET_COUNT, 6);
+
+// Core Targets
+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);
+
+// MCS Targets
+CONST_UINT32_T(MCS_TARGET_OFFSET, EX_TARGET_OFFSET + EX_TARGET_COUNT);
+CONST_UINT32_T(MCS_TARGET_COUNT, 4);
+
+// System Target
+CONST_UINT32_T(SYSTEM_TARGET_OFFSET, MCS_TARGET_OFFSET + MCS_TARGET_COUNT);
+CONST_UINT32_T(SYSTEM_TARGET_COUNT, 1);
+
+CONST_UINT32_T(MCAST_TARGET_OFFSET, SYSTEM_TARGET_OFFSET + SYSTEM_TARGET_COUNT);
+CONST_UINT32_T(MCAST_CHIPLET_OFFSET, 4);
+CONST_UINT32_T(MCAST_TARGET_COUNT, 3); // PPE only needs multicast groups 4-6
+
+// Total number of pervasive targets (Both NEST groups + EQs + COREs +MCBISTs)
+CONST_UINT32_T(PERV_TARGET_COUNT, NEST_GROUP1_TARGET_COUNT + NEST_GROUP2_TARGET_COUNT +
+ MCBIST_TARGET_COUNT + EQ_TARGET_COUNT + CORE_TARGET_COUNT);
+
+// Total Target Count
+CONST_UINT32_T(TARGET_COUNT, CHIP_TARGET_COUNT +
+ PERV_TARGET_COUNT +
+ EX_TARGET_COUNT +
+ MCS_TARGET_COUNT +
+ SYSTEM_TARGET_COUNT +
+ MCAST_TARGET_COUNT);
+
+#endif // __FAPI2_PPE_TARGET_PARMS__
diff --git a/src/hwpf/include/plat/plat_target_utils.H b/src/hwpf/include/plat/plat_target_utils.H
new file mode 100644
index 00000000..c6ec5f37
--- /dev/null
+++ b/src/hwpf/include/plat/plat_target_utils.H
@@ -0,0 +1,86 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/hwpf/include/plat/plat_target_utils.H $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,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 */
+/**
+ * @file plat_target_util.H
+ * @brief platform utility definitions for fapi2 targets
+ */
+
+#ifndef __FAPI2_PLAT_TARGET_UTIL__
+#define __FAPI2_PLAT_TARGET_UTIL__
+
+#pragma pack(8) //Start of packing to 8byte boundary
+ typedef struct {
+ fapi2attr::SystemAttributes_t G_system_attrs;
+ fapi2attr::ProcChipAttributes_t G_proc_chip_attrs;
+ fapi2attr::PervAttributes_t G_perv_attrs;
+ fapi2attr::CoreAttributes_t G_core_attrs;
+ fapi2attr::EXAttributes_t G_ex_attrs;
+ fapi2attr::EQAttributes_t G_eq_attrs;
+ } G_sbe_attrs_t;
+#pragma pack()//End of packing to 8byte boundary
+
+//
+// Platform Utility functions..
+//
+namespace fapi2
+{
+ /// @brief Function to initialize the G_targets vector based on partial good
+ /// attributes
+ ReturnCode plat_TargetsInit();
+
+ /// @brief Function to apply any gard records set (via
+ // ATTR_EQ_GARD/ATTR_EC_GARD) to mark corresponding targets non functional
+ ReturnCode plat_ApplyGards();
+
+ /// @brief Function to initialize the G_targets vector based on partial good
+ /// attributes
+ Target<TARGET_TYPE_PROC_CHIP> plat_getChipTarget();
+
+ /// @brief Function to return a platform target handle, given the chiplet
+ // 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<fapi2::TARGET_TYPE_CORE>(0x20);
+ template <TargetType K>
+ plat_target_handle_t plat_getTargetHandleByChipletNumber(
+ const uint8_t i_chipletNumber);
+
+ /// @brief Function to return a platform target handle, given the target
+ /// instance number and the fapi2 Target type
+ // @tparam K The fapi2 TargetType
+ // @param i_targetNum The instance number for 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_EX>
+ // l_ex(plat_getTargetHandleByInstance<fapi2::TARGET_TYPE_EX>(0);
+ template <TargetType K>
+ plat_target_handle_t plat_getTargetHandleByInstance(
+ const uint8_t i_targetNum);
+}
+#endif
diff --git a/src/hwpf/include/plat/plat_trace.H b/src/hwpf/include/plat/plat_trace.H
new file mode 100644
index 00000000..e4a2463f
--- /dev/null
+++ b/src/hwpf/include/plat/plat_trace.H
@@ -0,0 +1,113 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/hwpf/include/plat/plat_trace.H $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2011,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 */
+/**
+ * @file plat_trace.H
+ * @brief Defines the FAPI2 trace macros.
+ *
+ * Note that platform code must provide the implementation.
+ *
+ * FAPI has provided a default implementation. Platform code must
+ * provide an alternate implementation if needed.
+ */
+
+#ifndef FAPI2_PLATTRACE_H_
+#define FAPI2_PLATTRACE_H_
+
+#include <stdint.h>
+
+// @todo update these headers with extern "C" in a future commit
+// or not and leave this just as it is.
+extern "C"
+{
+#include "pk.h"
+#include <pk_trace.h>
+#include "trac_interface.h"
+}
+
+// Why not a #define, why is this in the fapi2 namespace?
+// To prevent problems with Cronus and the fapi1 definitions.
+namespace fapi2
+{
+ static const uint32_t MAX_ECMD_STRING_LEN = 64;
+};
+
+// Information traces (go into fast trace buffer that can wrap often)
+#define FAPI_TRACE(_id_, _fmt_, _args_...) \
+ PK_TRACE(_fmt_, ##_args_);
+
+
+/* The following is a desirous trace entry but the second line has a
+ compilation issue that is unresolved
+
+#define FAPI_TRACE(_id_, _fmt_, _args_...) \
+ PK_TRACE("%s: %s:%d ", _id_, __FUNCTION__, __LINE__); \
+ PK_TRACE(_fmt_, ##_args_);
+*/
+// FAPI_TRACE_LEVEL controls what traces are included in the code build
+// 0 == No tracing
+// 1 == ERR traces only
+// 2 == ERR and IMP only
+// 3 == ERR, IMP and INF only. This is the default in Makefile
+// > 4 == All traces (ERR, IMP, INF, DBG, SCAN, MFG)
+#if (FAPI_TRACE_LEVEL >= 3)
+#define FAPI_INF(_fmt_, _args_...) FAPI_TRACE("inf", _fmt_, ##_args_)
+#else
+#define FAPI_INF(_fmt_, _args_...)
+#endif
+
+// Important traces (go into slow trace buffer that should not wrap often)
+#if (FAPI_TRACE_LEVEL >= 2)
+#define FAPI_IMP(_fmt_, _args_...) FAPI_TRACE("imp", _fmt_, ##_args_)
+#else
+#define FAPI_IMP(_fmt_, _args_...)
+#endif
+
+// Error traces (go into slow trace buffer that should not wrap often)
+#if (FAPI_TRACE_LEVEL >= 1)
+#define FAPI_ERR(_fmt_, _args_...) FAPI_TRACE("err", _fmt_, ##_args_)
+#else
+#define FAPI_ERR(_fmt_, _args_...)
+#endif
+
+// Debug traces (go into fast trace buffer that can wrap often)
+#if (FAPI_TRACE_LEVEL >= 4)
+#define FAPI_DBG(_fmt_, _args_...) FAPI_TRACE("dbg", _fmt_, ##_args_)
+#else
+#define FAPI_DBG(_fmt_, _args_...)
+#endif
+
+// Scan traces
+#if (FAPI_TRACE_LEVEL >= 4)
+#define FAPI_SCAN(_fmt_, _args_...) FAPI_TRACE("scan", _fmt_, ##_args_)
+#else
+#define FAPI_SCAN(_fmt_, _args_...)
+#endif
+
+#if (FAPI_TRACE_LEVEL >= 4)
+#define FAPI_MFG(_fmt_, _args_...) FAPI_TRACE("mfg", _fmt_, ##_args_)
+#else
+#define FAPI_MFG(_fmt_, _args_...)
+#endif
+
+#endif // FAPI2_PLATTRACE_H_
diff --git a/src/hwpf/include/plat/target.H b/src/hwpf/include/plat/target.H
new file mode 100644
index 00000000..01250260
--- /dev/null
+++ b/src/hwpf/include/plat/target.H
@@ -0,0 +1,434 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/hwpf/include/plat/target.H $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,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 */
+/**
+ * @file target.H
+ * @brief platform specializations for fapi2 targets
+ */
+
+#ifndef __FAPI2_TARGET__
+#define __FAPI2_TARGET__
+
+#include <plat_target.H>
+#include <plat_target_parms.H>
+#include <fapi2_target.H>
+#include <multicast.H>
+#include <plat_trace.H>
+#include <utils.H>
+#include <stdint.h>
+#include <vector>
+
+extern "C"
+{
+ extern std::vector<fapi2::plat_target_handle_t> G_vec_targets;
+}
+
+struct ScomAddr
+{
+ ScomAddr(uint32_t i_addr) : iv_addr(i_addr)
+ {
+ }
+
+ operator uint32_t()
+ {
+ return iv_addr;
+ }
+
+ union
+ {
+ struct
+ {
+ uint32_t iv_unused : 1;
+ uint32_t iv_multicast : 1;
+ uint32_t iv_chiplet : 6;
+ uint32_t iv_pibMaster : 4;
+ uint32_t iv_port : 4;
+ uint32_t iv_unused2 : 2;
+ uint32_t iv_ring : 4;
+ uint32_t iv_satId : 4;
+ uint32_t iv_satOffset : 6;
+ };
+ uint32_t iv_addr;
+ };
+};
+
+
+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 Assignment Operator.
+ /// @param[in] i_right Reference to Target to assign from.
+ /// @return Reference to 'this' Target
+ ///
+ template<TargetType K, typename V>
+ Target<K, V>& Target<K, V>::operator=(const Target& i_right)
+ {
+ this->iv_handle.value = i_right.iv_handle.value;
+ return *this;
+ }
+ ///
+ /// @brief Equality Comparison Operator
+ /// @param[in] i_right Reference to Target to compare.
+ /// @return bool. True if equal.
+ /// @note Platforms need to define this so that the physical
+ /// targets are determined to be equivilent rather than just the handles
+ ///
+ template<TargetType K, typename V>
+ bool Target<K, V>::operator==(const Target& i_right) const
+ {
+ if (this->iv_handle.value == i_right.iv_handle.value)
+ return true;
+ else
+ return false;
+ }
+
+ ///
+ /// @brief Inquality Comparison Operator
+ /// @param[in] i_right Reference to Target to compare.
+ /// @return bool. True if not equal.
+ /// @note Platforms need to define this so that the physical
+ /// targets are determined to be equivilent rather than just the handles
+ ///
+ template<TargetType K, typename V>
+ bool Target<K, V>::operator!=(const Target& i_right) const
+ {
+ if (this->iv_handle.value != i_right.iv_handle.value)
+ return true;
+ else
+ return false;
+ }
+
+ ///
+ /// @brief Get this target's immediate parent
+ /// @tparam T The type of the parent
+ /// @return Target<T, V> a target representing the parent
+ ///
+ template<TargetType K, typename V>
+ template<TargetType T>
+ inline Target<T, V> Target<K, V>::getParent(void) const
+ {
+ static_assert(((K == TARGET_TYPE_EQ) ||
+ (K == TARGET_TYPE_CORE) ||
+ (K == TARGET_TYPE_MCBIST) ||
+ (K == TARGET_TYPE_PERV) ||
+ (K == TARGET_TYPE_EX) ||
+ (K == TARGET_TYPE_PROC_CHIP) ||
+ (K == (TARGET_TYPE_PROC_CHIP | TARGET_TYPE_EQ)) ||
+ (K == (TARGET_TYPE_PROC_CHIP | TARGET_TYPE_CORE))) &&
+ ((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_MCBIST) &&
+ (T != TARGET_TYPE_PERV) &&
+ (T != TARGET_TYPE_PROC_CHIP)),
+ "Invalid parent for MCBIST 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/MCBIST/PERV ===> PERV
+ {
+ return static_cast<V>(this->iv_handle);
+ }
+ if(TARGET_TYPE_PROC_CHIP == T) // EQ/EC/EX/MCBIST/PERV ===> PROC
+ {
+ return static_cast<V>(G_vec_targets[CHIP_TARGET_OFFSET]);
+ }
+ 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]);
+ }
+ 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]);
+ }
+ if(TARGET_TYPE_EX == T) // EC ===> EX
+ {
+ return static_cast<V>(G_vec_targets[(getTargetNumber() / CORES_PER_EX) + EX_TARGET_OFFSET]);
+ }
+ }
+
+ /// @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<Target<T, V> > a vector of present/functional
+ /// children
+ /// @warning The children are returned in order, ex child[0] is
+ /// std::vector[0]
+ template<TargetType K, typename V>
+ template<TargetType T>
+ std::vector<Target<T, V>>
+ Target<K, V>::getChildren(const TargetState i_state) const
+ {
+ constexpr TargetType L = static_cast<TargetType>(K & ~(TARGET_TYPE_PROC_CHIP));
+ constexpr plat_target_type_t P = fapiTargetTypeToPlatTargetType<T>();
+
+ static_assert(sizeof(Target<T, V>) == sizeof(plat_target_handle_t),
+ "Sizes of plat target and FAPI target must match");
+
+ static_assert(((L == TARGET_TYPE_EQ) || (L == TARGET_TYPE_EX) || (K == TARGET_TYPE_PROC_CHIP)),
+ "Invalid parent passed to getChildren");
+ // valid children for EQ
+ // EQ -> CORE
+ // EQ -> EX
+ static_assert(!((L == 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(!((L == fapi2::TARGET_TYPE_EX) &&
+ (T != fapi2::TARGET_TYPE_CORE)),
+ "improper child of fapi2::TARGET_TYPE_EX");
+
+
+ std::vector<Target<T, V> > l_children;
+ static_cast<plat_target_handle_t>(get()).getChildren(K, T, P, i_state, reinterpret_cast<std::vector<plat_target_handle>&>(l_children));
+ return l_children;
+ }
+
+ // Specialization of getChildren, filtered for the chip target
+ template<TargetType K, typename V>
+ template<TargetType T>
+ std::vector<Target<T, V> >
+ Target<K, V>::getChildren(const TargetFilter i_filter,
+ const TargetState i_state) const
+ {
+ static_assert(sizeof(Target<T, V>) == sizeof(plat_target_handle_t),
+ "Sizes of plat target and FAPI target must match");
+
+ static_assert((K == TARGET_TYPE_PROC_CHIP), "Parent target must be the proc chip");
+ static_assert((T == TARGET_TYPE_EQ) || (T == TARGET_TYPE_CORE)
+ || (T == TARGET_TYPE_PERV) || (T == TARGET_TYPE_MCBIST),
+ "Child target type must be a pervasive chiplet");
+
+ std::vector<Target<T> > l_children;
+
+ (static_cast<plat_target_handle_t>(get())).getChildren(i_filter, i_state, reinterpret_cast<std::vector<plat_target_handle_t>&>(l_children));
+
+ return l_children;
+ }
+
+ ///
+ /// @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
+ ///
+ template<TargetType K, typename V>
+ template<TargetType T>
+ inline Target<T, V>
+ Target<K, V>::getOtherEnd(const TargetState i_state) const
+ {
+// static_assert( false, "getOtherEnd() is not supported on PPE platforms");
+ }
+
+ ///
+ /// @brief Is the target functional?
+ /// @return true if target is functional, false if non-functional
+ ///
+
+ template<TargetType K, typename V>
+ inline bool
+ Target<K, V>::isFunctional(void) const
+ {
+ return getFunctional();
+ }
+
+
+ ///
+ /// @brief Return the string interpretation of this target
+ /// @tparam T The type of the target
+ /// @param[in] i_target Target<T>
+ /// @param[in] i_buffer buffer to write in to
+ /// @param[in] i_bsize size of the buffer
+ /// @return void
+ /// @post The contents of the buffer is replaced with the string
+ /// representation of the target
+ ///
+ template< TargetType T, typename V >
+ inline void toString(const Target<T, V>& i_target, char* i_buffer, size_t i_bsize)
+ {
+ snprintf(i_buffer, i_bsize, "Target 0x%lx/0x%x", i_target.get(), T);
+ }
+
+ template<TargetType T, typename V>
+ __attribute__((always_inline))
+ inline uint32_t getEffectiveAddress(const Target<T, V> &i_target,
+ const uint32_t i_addr)
+ {
+ ScomAddr l_addr = i_addr;
+ if(0 != i_target.getAddressOverlay())
+ {
+ l_addr.iv_chiplet = i_target.getChipletNumber();
+ }
+ return l_addr;
+ }
+
+ inline uint32_t getEffectiveAddress(const Target<TARGET_TYPE_EX> &i_target,
+ const uint32_t i_addr)
+ {
+ ScomAddr l_addr = i_addr;
+
+ if((EQ_CHIPLET_OFFSET <= l_addr.iv_chiplet) &&
+ ((EQ_CHIPLET_OFFSET + EQ_TARGET_COUNT) > l_addr.iv_chiplet))
+ {
+ l_addr.iv_chiplet = i_target.getChipletNumber();
+ l_addr.iv_ring = (l_addr.iv_ring - (l_addr.iv_ring % 2)) +
+ (i_target.getTargetNumber() % 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);
+ }
+ else
+ {
+ assert(false);
+ }
+ return l_addr;
+ }
+
+ inline uint32_t getEffectiveAddress(const Target<TARGET_TYPE_MCS> &i_target,
+ const uint32_t i_addr)
+ {
+ ScomAddr l_addr = i_addr;
+ l_addr.iv_chiplet = i_target.getChipletNumber();
+ l_addr.iv_satId = (2 * (i_target.getTargetNumber() % 2));
+ return l_addr;
+ }
+
+ ///
+ /// @brief Return the string interpretation of this target
+ /// @tparam T The type of the target
+ /// @tparam B The type of the buffer
+ /// @param[in] A pointer to the Target<T, V>
+ /// @param[in] i_buffer buffer to write in to
+ /// @param[in] i_bsize size of the buffer
+ /// @return void
+ /// @post The contents of the buffer is replaced with the string
+ /// representation of the target
+ ///
+ template< TargetType T, typename V >
+ inline void toString(const Target<T, V>* i_target, char* i_buffer, size_t i_bsize)
+ {
+ snprintf(i_buffer, i_bsize, "Target 0x%lx/0x%x", i_target->get(), T);
+ }
+
+ ///
+ /// @brief Get an enumerated target of a specific type
+ /// @tparam T The type of the target
+ /// @param[in] Ordinal representing the ordinal number of
+ /// the desired target
+ /// @return Target<T, V> the target requested
+ ///
+ template<TargetType T, typename V>
+ inline Target<T, V> getTarget(uint64_t Ordinal)
+ {
+ // For testing
+ return Target<T, V>(Ordinal);
+ }
+}
+
+#endif
OpenPOWER on IntegriCloud