summaryrefslogtreecommitdiffstats
path: root/src/hwpf
diff options
context:
space:
mode:
Diffstat (limited to 'src/hwpf')
-rw-r--r--src/hwpf/include/plat/plat_hw_access.H10
-rw-r--r--src/hwpf/include/plat/target.H59
-rw-r--r--src/hwpf/src/plat/plat_hw_access.C96
3 files changed, 83 insertions, 82 deletions
diff --git a/src/hwpf/include/plat/plat_hw_access.H b/src/hwpf/include/plat/plat_hw_access.H
index c7c73325..cd0078f9 100644
--- a/src/hwpf/include/plat/plat_hw_access.H
+++ b/src/hwpf/include/plat/plat_hw_access.H
@@ -34,6 +34,7 @@
#include <plat_includes.H>
#include "hw_access_def.H"
#include <return_code.H>
+#include <fapi2_target.H>
// PIB errors
enum PCB_ERRORS
@@ -84,11 +85,11 @@ asm volatile \
/// 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)
+ _m_rc = fapi2::getscom_abs_wrap(&(_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)
+ _m_rc = fapi2::putscom_abs_wrap(&(_m_base), _m_offset, _m_data)
/// GetCFAM
#define PLAT_GETCFAM(_m_base, _m_offset, _m_data) \
@@ -135,6 +136,7 @@ namespace fapi2
fapi2::ReturnCode getRing_verifyAndcleanup(const uint32_t i_ringAddress,
const fapi2::RingMode i_ringMode);
+ typedef union plat_target_handle plat_target_handle_t;
///
/// @brief Platform wrapper over PK getscom_abs
///
@@ -143,7 +145,7 @@ namespace fapi2
///
/// @return PCB-PIB return code
///
- uint32_t getscom_abs_wrap(const uint32_t i_addr, uint64_t *o_data);
+ uint32_t getscom_abs_wrap(const void *i_target, const uint32_t i_addr, uint64_t *o_data);
///
/// @brief Platform wrapper over PK putscom_abs
@@ -153,7 +155,7 @@ namespace fapi2
///
/// @return PCB-PIB return code
///
- uint32_t putscom_abs_wrap(const uint32_t i_addr, uint64_t i_data);
+ uint32_t putscom_abs_wrap(const void *i_target, const uint32_t i_addr, uint64_t i_data);
///
/// @brief Platform wrapper to retry scom for parity/timeout errors
diff --git a/src/hwpf/include/plat/target.H b/src/hwpf/include/plat/target.H
index 09c27d0b..c7baef55 100644
--- a/src/hwpf/include/plat/target.H
+++ b/src/hwpf/include/plat/target.H
@@ -178,18 +178,19 @@ namespace fapi2
template<TargetType T>
inline Target<T, V> Target<K, V>::getParent(void) const
{
- static_assert(((K == TARGET_TYPE_EQ) ||
+ 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))) &&
+ (K == (TARGET_TYPE_PROC_CHIP | TARGET_TYPE_CORE)) ||
+ (K == TARGET_TYPE_ALL)) &&
((T == TARGET_TYPE_EQ) ||
(T == TARGET_TYPE_EX) ||
(T == TARGET_TYPE_PROC_CHIP) ||
- (T == TARGET_TYPE_PERV)),
+ (T == TARGET_TYPE_PERV))),
"Invalid parent/child target type passed");
static_assert(!((K == TARGET_TYPE_EQ) &&
@@ -198,6 +199,11 @@ namespace fapi2
"Invalid parent for EQ target, must be PERV or "
"PROC_CHIP");
+ static_assert(!((K == TARGET_TYPE_ALL) &&
+ (T != TARGET_TYPE_PROC_CHIP)),
+ "Invalid parent for ALL target, must be "
+ "PROC_CHIP");
+
static_assert(!((K == TARGET_TYPE_MCBIST) &&
(T != TARGET_TYPE_PERV) &&
(T != TARGET_TYPE_PROC_CHIP)),
@@ -348,53 +354,6 @@ namespace fapi2
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 != static_cast<plat_target_handle_t>(i_target.get()).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)) +
- (static_cast<plat_target_handle_t>(i_target.get()).getTargetInstance() % 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) +
- (static_cast<plat_target_handle_t>(i_target.get()).getTargetInstance() * 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 * (static_cast<plat_target_handle_t>(i_target.get()).getTargetInstance() % 2));
- return l_addr;
- }
-
///
/// @brief Return the string interpretation of this target
/// @tparam T The type of the target
diff --git a/src/hwpf/src/plat/plat_hw_access.C b/src/hwpf/src/plat/plat_hw_access.C
index b460946f..a6eaf91c 100644
--- a/src/hwpf/src/plat/plat_hw_access.C
+++ b/src/hwpf/src/plat/plat_hw_access.C
@@ -41,14 +41,14 @@ uint64_t decodeScanRegionData(const uint32_t i_ringAddress)
uint32_t l_scan_type = 0x00008000 >> (i_ringAddress & 0x0000000F);
// This is special case if encoded type is 0xF
-
+
if ( (i_ringAddress & 0x0000000F) == 0xF)
{
l_scan_type = 0x00008000 | (l_scan_type << 12);
}
uint64_t l_value = l_scan_region;
l_value = (l_value << 32) | l_scan_type;
-
+
return l_value;
}
@@ -73,7 +73,7 @@ ReturnCode getRing_setup(const uint32_t i_ringAddress,
break;
}
- l_rc = setupScanRegionForSetPulse(l_proc, l_scanRegion,
+ l_rc = setupScanRegionForSetPulse(l_proc, l_scanRegion,
i_ringMode,l_chipletId);
if(l_rc != fapi2::FAPI2_RC_SUCCESS)
{
@@ -162,41 +162,81 @@ ReturnCode getRing_verifyAndcleanup(const uint32_t i_ringAddress,
break;
}
}
-
+
}while(0);
return l_rc;
}
- uint32_t getscom_abs_wrap(const uint32_t i_addr, uint64_t *o_data)
+static uint32_t getEffectiveAddress(const plat_target_handle_t &i_target, const uint32_t i_addr)
+{
+ ScomAddr l_addr(i_addr);
+ switch(i_target.getTargetType())
{
- uint32_t l_rc = 0;
- FAPI_INF("getScom: address: 0x%08X", i_addr);
- l_rc = getscom_abs(i_addr, o_data);
- if( PIB_NO_ERROR != l_rc )
- {
- l_rc = p9_pibErrRetry( i_addr, o_data, l_rc, true);
- }
- FAPI_INF("getScom: returned rc: 0x%08X, data HI: 0x%08X, "
- "data LO: 0x%08X", l_rc, (*o_data >> 32),
- static_cast<uint32_t>(*o_data & 0xFFFFFFFF));
- return l_rc;
+ case PPE_TARGET_TYPE_EX:
+ if((EQ_CHIPLET_OFFSET <= l_addr.iv_chiplet) &&
+ ((EQ_CHIPLET_OFFSET + EQ_TARGET_COUNT) > l_addr.iv_chiplet))
+ {
+ l_addr.iv_chiplet = i_target.fields.chiplet_num;
+ l_addr.iv_ring = (l_addr.iv_ring - (l_addr.iv_ring % 2)) +
+ (i_target.getTargetInstance() % 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.getTargetInstance() * 2);
+ }
+ else
+ {
+ assert(false);
+ }
+ break;
+ case PPE_TARGET_TYPE_MCS:
+ l_addr.iv_chiplet = i_target.fields.chiplet_num;
+ l_addr.iv_satId = (2 * (i_target.getTargetInstance() % 2));
+ break;
+ default:
+ if(0 != i_target.getAddressOverlay())
+ {
+ l_addr.iv_chiplet = i_target.fields.chiplet_num;
+ }
+ break;
}
+ return l_addr;
+}
- uint32_t putscom_abs_wrap(const uint32_t i_addr, uint64_t i_data)
+uint32_t getscom_abs_wrap(const void *i_target, const uint32_t i_addr, uint64_t *o_data)
+{
+ uint32_t l_rc = 0;
+ uint32_t l_addr = getEffectiveAddress(*(plat_target_handle_t*)i_target, i_addr);
+ FAPI_INF("getScom: address: 0x%08X", l_addr);
+ l_rc = getscom_abs(l_addr, o_data);
+ if( PIB_NO_ERROR != l_rc )
{
- uint32_t l_rc = 0;
- FAPI_INF("putScom: address: 0x%08X, data HI: 0x%08X, data LO: 0x%08X",
- i_addr, (i_data >> 32),
- static_cast<uint32_t>(i_data & 0xFFFFFFFF));
- l_rc = putscom_abs(i_addr, i_data);
- if( PIB_NO_ERROR != l_rc )
- {
- l_rc = p9_pibErrRetry( i_addr, &i_data, l_rc, false);
- }
- FAPI_INF("putScom: returned rc: 0x%08X", l_rc);
- return l_rc;
+ l_rc = p9_pibErrRetry( l_addr, o_data, l_rc, true);
}
+ FAPI_INF("getScom: returned rc: 0x%08X, data HI: 0x%08X, "
+ "data LO: 0x%08X", l_rc, (*o_data >> 32),
+ static_cast<uint32_t>(*o_data & 0xFFFFFFFF));
+ return l_rc;
+}
+
+uint32_t putscom_abs_wrap(const void *i_target, const uint32_t i_addr, uint64_t i_data)
+{
+ uint32_t l_rc = 0;
+ uint32_t l_addr = getEffectiveAddress(*(plat_target_handle_t*)i_target, i_addr);
+ FAPI_INF("putScom: address: 0x%08X, data HI: 0x%08X, data LO: 0x%08X",
+ l_addr, (i_data >> 32),
+ static_cast<uint32_t>(i_data & 0xFFFFFFFF));
+ l_rc = putscom_abs(l_addr, i_data);
+ if( PIB_NO_ERROR != l_rc )
+ {
+ l_rc = p9_pibErrRetry( l_addr, &i_data, l_rc, false);
+ }
+ FAPI_INF("putScom: returned rc: 0x%08X", l_rc);
+ return l_rc;
+}
uint32_t p9_pibErrRetry( const uint32_t i_addr, uint64_t *io_data,
const uint8_t i_pibErr, const bool i_isRead)
OpenPOWER on IntegriCloud