summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Geissler <andrewg@us.ibm.com>2016-04-15 08:32:47 -0500
committerStephen Cprek <smcprek@us.ibm.com>2016-04-21 13:51:55 -0500
commit44130d64dd56990139256d831eba991fac48c51f (patch)
tree215bbe27ada53568d781699a8626ddfcfdffc927 /src
parente490fd8148cb97cdefc802414254afd8aa9c068c (diff)
downloadtalos-hostboot-44130d64dd56990139256d831eba991fac48c51f.tar.gz
talos-hostboot-44130d64dd56990139256d831eba991fac48c51f.zip
Bug fix for CFAM mbox address offset calculations
Change-Id: Ie0e19de6be7676fd27ad628da8b83ecd9c93d98c CQ:SW349480 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/23280 Tested-by: Jenkins Server Tested-by: FSP CI Jenkins Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: Corey V. Swenson <cswenson@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/usr/fapi2/plat_hw_access.C15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/usr/fapi2/plat_hw_access.C b/src/usr/fapi2/plat_hw_access.C
index f7fae4b6c..367aea566 100644
--- a/src/usr/fapi2/plat_hw_access.C
+++ b/src/usr/fapi2/plat_hw_access.C
@@ -46,6 +46,12 @@
namespace fapi2
{
+// Bits 7-15 are address portion
+const uint32_t CFAM_ADDRESS_MASK = 0x1FF;
+
+// Bits 0-6 are engine offset
+const uint32_t CFAM_ENGINE_OFFSET = 0xFE00;
+
//------------------------------------------------------------------------------
// HW Communication Functions to be implemented at the platform layer.
//------------------------------------------------------------------------------
@@ -347,7 +353,8 @@ ReturnCode platGetCfamRegister(const Target<TARGET_TYPE_ALL>& i_target,
// Address needs to be multiply by 4 because register addresses are
// word offsets but the FSI addresses are byte offsets.
// However, we need to preserve the engine's offset in the top byte
- uint64_t l_addr = ((i_address & 0x003F) << 2) | (i_address & 0xFF00);
+ uint64_t l_addr = ((i_address & CFAM_ADDRESS_MASK) << 2) |
+ (i_address & CFAM_ENGINE_OFFSET);
size_t l_size = sizeof(uint32_t);
l_err = deviceRead(l_myChipTarget,
&o_data(),
@@ -424,7 +431,8 @@ ReturnCode platPutCfamRegister(const Target<TARGET_TYPE_ALL>& i_target,
// Address needs to be multiply by 4 because register addresses are word
// offsets but the FSI addresses are byte offsets
// However, we need to preserve the engine's offset in the top byte
- uint64_t l_addr = ((i_address & 0x003F) << 2) | (i_address & 0xFF00);
+ uint64_t l_addr = ((i_address & CFAM_ADDRESS_MASK) << 2) |
+ (i_address & CFAM_ENGINE_OFFSET);
size_t l_size = sizeof(uint32_t);
uint32_t l_data = static_cast<uint32_t>(i_data);
l_err = deviceWrite(l_myChipTarget,
@@ -556,7 +564,8 @@ ReturnCode platModifyCfamRegister(const Target<TARGET_TYPE_ALL>& i_target,
// Address needs to be multiply by 4 because register addresses are word
// offsets but the FSI addresses are byte offsets.
// However, we need to preserve the engine's offset of 0x0C00 and 0x1000
- uint64_t l_addr = ((i_address & 0x003F) << 2) | (i_address & 0xFF00);
+ uint64_t l_addr = ((i_address & CFAM_ADDRESS_MASK) << 2) |
+ (i_address & CFAM_ENGINE_OFFSET);
buffer<uint32_t> l_data = 0;
size_t l_size = sizeof(uint32_t);
l_err = deviceRead(l_myChipTarget,
OpenPOWER on IntegriCloud