summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/hwpf/hw_access.H25
-rw-r--r--src/hwpf/plat_hw_access.C26
-rw-r--r--src/hwpf/plat_hw_access.H14
3 files changed, 49 insertions, 16 deletions
diff --git a/src/hwpf/hw_access.H b/src/hwpf/hw_access.H
index 9c5da3aa..de0ac924 100644
--- a/src/hwpf/hw_access.H
+++ b/src/hwpf/hw_access.H
@@ -6,6 +6,7 @@
/* OpenPOWER sbe Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2012,2017 */
+/* [+] International Business Machines Corp. */
/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
@@ -151,6 +152,7 @@ namespace fapi2
const buffer<uint64_t> i_data,
const ChipOpModifyMode i_modifyMode)
{
+ static_assert(does_plat_allow<K, V>::value, "modifyScom not suppported");
fapi2::buffer<uint64_t> l_modifyDataBuffer;
fapi2::ReturnCode l_rc;
@@ -197,23 +199,11 @@ __fapi2exit__:
template< TargetType K, typename V >
inline ReturnCode putScomUnderMask( const Target<K, V>& i_target,
const uint64_t i_address,
- buffer<uint64_t> i_data,
- buffer<uint64_t> i_mask)
+ const buffer<uint64_t> i_data,
+ const buffer<uint64_t> i_mask)
{
- // TODO: via RTC: 160143: Fix the plat implementation
- static_assert(does_plat_allow<K, V>::value, "putScomUnderMask not suppported");
- fapi2::buffer<uint64_t> l_modifyDataBuffer = i_data;
-
- l_modifyDataBuffer &= i_mask;
-
- fapi2::ReturnCode l_rc;
- PLAT_PUTSCOM(l_rc,
- i_target,
- (uint32_t)(i_address & BITS(40,24)),
- l_modifyDataBuffer());
-
- return l_rc;
-
+ return fapi2::putscom_under_mask(&i_target, i_address, i_data(),
+ i_mask());
}
@@ -229,6 +219,7 @@ __fapi2exit__:
const uint32_t i_address,
buffer<uint32_t>& o_data)
{
+ static_assert(does_plat_allow<K, V>::value, "getCfamRegister not suppported");
PLAT_GETCFAM(i_target.get(),
(uint32_t)(i_address & BITS(40,24)),
&(o_data()));
@@ -248,6 +239,7 @@ __fapi2exit__:
const uint32_t i_address,
buffer<uint32_t>& i_data)
{
+ static_assert(does_plat_allow<K, V>::value, "putCfamRegister not suppported");
PLAT_PUTCFAM(i_target.get(),
(uint32_t)(i_address & BITS(40,24)),
&(i_data()));
@@ -269,6 +261,7 @@ __fapi2exit__:
const buffer<uint32_t>& i_data,
const ChipOpModifyMode i_modifyMode)
{
+ static_assert(does_plat_allow<K, V>::value, "modifyCfamRegister not suppported");
PLAT_MODCFAM(i_target.get(),
(uint32_t)(i_address & BITS(40,24)),
&(i_data()),
diff --git a/src/hwpf/plat_hw_access.C b/src/hwpf/plat_hw_access.C
index bdf6ae3b..99f92a39 100644
--- a/src/hwpf/plat_hw_access.C
+++ b/src/hwpf/plat_hw_access.C
@@ -315,6 +315,32 @@ fapi_try_exit:
return fapi2::current_err;
}
+
+fapi2::ReturnCode putscom_under_mask(const void *i_target,
+ uint32_t i_addr,
+ uint64_t i_data,
+ uint64_t i_mask)
+{
+ uint64_t l_read = 0;
+ fapi2::ReturnCode l_rc = FAPI2_RC_SUCCESS;
+
+ do
+ {
+ l_rc = getscom_abs_wrap(i_target, i_addr, &l_read);
+
+ if(l_rc)
+ {
+ break;
+ }
+
+ l_read = (l_read & ~i_mask) | (i_data & i_mask);
+
+ l_rc = putscom_abs_wrap(i_target, i_addr, l_read);
+ } while (false);
+
+ 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)
{
diff --git a/src/hwpf/plat_hw_access.H b/src/hwpf/plat_hw_access.H
index 16bbf0ce..7af79bd3 100644
--- a/src/hwpf/plat_hw_access.H
+++ b/src/hwpf/plat_hw_access.H
@@ -6,6 +6,7 @@
/* OpenPOWER sbe Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2015,2017 */
+/* [+] International Business Machines Corp. */
/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
@@ -147,6 +148,19 @@ namespace fapi2
const uint32_t i_addr, uint64_t i_data);
///
+ /// @brief Plat implementation of putScomUnderMask
+ ///
+ /// @param [in] i_target Pointer to fapi2::Target as a void*
+ /// @param [in] i_addr The SCOM address
+ /// @param [in] i_data The data to write (after applying the mask)
+ /// @param [in] i_mask The data mask
+ ///
+ /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ fapi2::ReturnCode putscom_under_mask(const void *i_target,
+ uint32_t i_addr,
+ uint64_t i_data,
+ uint64_t i_mask);
+ ///
/// @brief Platform wrapper to retry scom for parity/timeout errors
///
/// @param [in] i_addr The SCOM address
OpenPOWER on IntegriCloud