Skip to content

Commit

Permalink
Fix putScomUnderMask
Browse files Browse the repository at this point in the history
Change-Id: I06452679730b236a4e00f4df89265c3f8fcf5a52
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/41487
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Benjamin Gass <bgass@us.ibm.com>
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
  • Loading branch information
Santosh Puranik authored and sgupta2m committed Jun 9, 2017
1 parent 158f067 commit 5b99b40
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 16 deletions.
25 changes: 9 additions & 16 deletions src/hwpf/hw_access.H
Original file line number Diff line number Diff line change
Expand Up @@ -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"); */
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}


Expand All @@ -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()));
Expand All @@ -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()));
Expand All @@ -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()),
Expand Down
26 changes: 26 additions & 0 deletions src/hwpf/plat_hw_access.C
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
14 changes: 14 additions & 0 deletions src/hwpf/plat_hw_access.H
Original file line number Diff line number Diff line change
Expand Up @@ -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"); */
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5b99b40

Please sign in to comment.