summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorZane Shelley <zshelle@us.ibm.com>2013-08-29 18:16:38 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-09-19 09:03:29 -0500
commit3349e906896390b6b8bc08d8b0682db85776d170 (patch)
tree4ae3559924a9c65fa0765f2ad0c5d3420c89f7a5 /src
parentd61d54327fea0233ef3d250e8e3a99f78302d350 (diff)
downloadblackbird-hostboot-3349e906896390b6b8bc08d8b0682db85776d170.tar.gz
blackbird-hostboot-3349e906896390b6b8bc08d8b0682db85776d170.zip
PRD: simplified [g|s]etCenReadAddr() interfaces
Change-Id: I5972cd10ec85d7b75486e55b2b4cad4bd8f84f0b Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/5982 Tested-by: Jenkins Server Reviewed-by: Christopher T. Phan <cphan@us.ibm.com> Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com> Reviewed-by: Zane Shelley <zshelle@us.ibm.com> Squashed: I3114d6131309ad20088179786d1b94873c634488 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/6231
Diffstat (limited to 'src')
-rwxr-xr-xsrc/usr/diag/prdf/common/plat/pegasus/prdfCenAddress.C69
-rwxr-xr-xsrc/usr/diag/prdf/common/plat/pegasus/prdfCenAddress.H23
-rwxr-xr-xsrc/usr/diag/prdf/common/plat/pegasus/prdfCenMembuf.C16
3 files changed, 54 insertions, 54 deletions
diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfCenAddress.C b/src/usr/diag/prdf/common/plat/pegasus/prdfCenAddress.C
index 9356ea3d7..4e3ac7818 100755
--- a/src/usr/diag/prdf/common/plat/pegasus/prdfCenAddress.C
+++ b/src/usr/diag/prdf/common/plat/pegasus/prdfCenAddress.C
@@ -43,20 +43,15 @@ using namespace PlatServices;
// MBS Address Registers
//------------------------------------------------------------------------------
-CenReadAddrReg READ_NCE_ADDR_0 = "MBA0_MBNCER";
-CenReadAddrReg READ_RCE_ADDR_0 = "MBA0_MBRCER";
-CenReadAddrReg READ_MPE_ADDR_0 = "MBA0_MBMPER";
-CenReadAddrReg READ_UE_ADDR_0 = "MBA0_MBUER";
-
-CenReadAddrReg READ_NCE_ADDR_1 = "MBA1_MBNCER";
-CenReadAddrReg READ_RCE_ADDR_1 = "MBA1_MBRCER";
-CenReadAddrReg READ_MPE_ADDR_1 = "MBA1_MBMPER";
-CenReadAddrReg READ_UE_ADDR_1 = "MBA1_MBUER";
+CenReadAddrReg READ_NCE_ADDR = "MBNCER";
+CenReadAddrReg READ_RCE_ADDR = "MBRCER";
+CenReadAddrReg READ_MPE_ADDR = "MBMPER";
+CenReadAddrReg READ_UE_ADDR = "MBUER";
//------------------------------------------------------------------------------
-int32_t getCenReadAddr( ExtensibleChip * i_membChip, CenReadAddrReg i_addrReg,
- CenAddr & o_addr )
+int32_t getCenReadAddr( ExtensibleChip * i_membChip, uint32_t i_mbaPos,
+ CenReadAddrReg i_addrReg, CenAddr & o_addr )
{
#define PRDF_FUNC "[getCenReadAddr] "
@@ -73,26 +68,32 @@ int32_t getCenReadAddr( ExtensibleChip * i_membChip, CenReadAddrReg i_addrReg,
o_rc = FAIL; break;
}
+ if ( MAX_MBA_PER_MEMBUF <= i_mbaPos )
+ {
+ PRDF_ERR( PRDF_FUNC"Invalid MBA position" );
+ o_rc = FAIL; break;
+ }
+
+ // Build register string
+ char reg_str[64];
+ sprintf( reg_str, "MBA%d_%s", i_mbaPos, i_addrReg );
+
// Read from hardware
- SCAN_COMM_REGISTER_CLASS * reg = i_membChip->getRegister(i_addrReg);
+ SCAN_COMM_REGISTER_CLASS * reg = i_membChip->getRegister(reg_str);
o_rc = reg->Read();
if ( SUCCESS != o_rc )
{
- PRDF_ERR( PRDF_FUNC"Read() failed on %s", i_addrReg );
+ PRDF_ERR( PRDF_FUNC"Read() failed on %s", reg_str );
break;
}
uint64_t addr = reg->GetBitFieldJustified( 0, 64 );
// Get the address type.
uint32_t type = CenAddr::NONE;
- if ( READ_NCE_ADDR_0 == i_addrReg || READ_NCE_ADDR_1 == i_addrReg )
- type = CenAddr::NCE;
- else if ( READ_RCE_ADDR_0 == i_addrReg || READ_RCE_ADDR_1 == i_addrReg )
- type = CenAddr::RCE;
- else if ( READ_MPE_ADDR_0 == i_addrReg || READ_MPE_ADDR_1 == i_addrReg )
- type = CenAddr::MPE;
- else if ( READ_UE_ADDR_0 == i_addrReg || READ_UE_ADDR_1 == i_addrReg )
- type = CenAddr::UE;
+ if ( READ_NCE_ADDR == i_addrReg ) type = CenAddr::NCE;
+ else if ( READ_RCE_ADDR == i_addrReg ) type = CenAddr::RCE;
+ else if ( READ_MPE_ADDR == i_addrReg ) type = CenAddr::MPE;
+ else if ( READ_UE_ADDR == i_addrReg ) type = CenAddr::UE;
else
{
PRDF_ERR( PRDF_FUNC"Unsupported register" );
@@ -105,8 +106,8 @@ int32_t getCenReadAddr( ExtensibleChip * i_membChip, CenReadAddrReg i_addrReg,
if ( SUCCESS != o_rc )
{
- PRDF_ERR( PRDF_FUNC"Failed: HUID=0x%08x addrReg='%s'",
- getHuid(membTrgt), i_addrReg );
+ PRDF_ERR( PRDF_FUNC"Failed: i_membChip=0x%08x i_mbaPos=%d i_addrReg=%s",
+ i_membChip->GetId(), i_mbaPos, i_addrReg );
}
return o_rc;
@@ -116,8 +117,8 @@ int32_t getCenReadAddr( ExtensibleChip * i_membChip, CenReadAddrReg i_addrReg,
//------------------------------------------------------------------------------
-int32_t setCenReadAddr( ExtensibleChip * i_membChip, CenReadAddrReg i_addrReg,
- const CenAddr & i_addr )
+int32_t setCenReadAddr( ExtensibleChip * i_membChip, uint32_t i_mbaPos,
+ CenReadAddrReg i_addrReg, const CenAddr & i_addr )
{
#define PRDF_FUNC "[setCenReadAddr] "
@@ -134,13 +135,23 @@ int32_t setCenReadAddr( ExtensibleChip * i_membChip, CenReadAddrReg i_addrReg,
o_rc = FAIL; break;
}
+ if ( MAX_MBA_PER_MEMBUF <= i_mbaPos )
+ {
+ PRDF_ERR( PRDF_FUNC"Invalid MBA position" );
+ o_rc = FAIL; break;
+ }
+
+ // Build register string
+ char reg_str[64];
+ sprintf( reg_str, "MBA%d_%s", i_mbaPos, i_addrReg );
+
// Write to hardware
- SCAN_COMM_REGISTER_CLASS * reg = i_membChip->getRegister(i_addrReg);
+ SCAN_COMM_REGISTER_CLASS * reg = i_membChip->getRegister(reg_str);
reg->SetBitFieldJustified( 0, 64, i_addr.toReadAddr() );
o_rc = reg->Write();
if ( SUCCESS != o_rc )
{
- PRDF_ERR( PRDF_FUNC"Write() failed on %s", i_addrReg );
+ PRDF_ERR( PRDF_FUNC"Write() failed on %s", reg_str );
break;
}
@@ -148,8 +159,8 @@ int32_t setCenReadAddr( ExtensibleChip * i_membChip, CenReadAddrReg i_addrReg,
if ( SUCCESS != o_rc )
{
- PRDF_ERR( PRDF_FUNC"Failed: HUID=0x%08x addrReg='%s'",
- getHuid(membTrgt), i_addrReg );
+ PRDF_ERR( PRDF_FUNC"Failed: i_membChip=0x%08x i_mbaPos=%d i_addrReg=%s",
+ i_membChip->GetId(), i_mbaPos, i_addrReg );
}
return o_rc;
diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfCenAddress.H b/src/usr/diag/prdf/common/plat/pegasus/prdfCenAddress.H
index e5a27d6e2..d4ae8b0a9 100755
--- a/src/usr/diag/prdf/common/plat/pegasus/prdfCenAddress.H
+++ b/src/usr/diag/prdf/common/plat/pegasus/prdfCenAddress.H
@@ -348,35 +348,32 @@ class CenAddr
typedef const char * const CenReadAddrReg;
-extern CenReadAddrReg READ_NCE_ADDR_0; ///< For the MBA0_MBNCER register
-extern CenReadAddrReg READ_RCE_ADDR_0; ///< For the MBA0_MBRCER register
-extern CenReadAddrReg READ_MPE_ADDR_0; ///< For the MBA0_MBMPER register
-extern CenReadAddrReg READ_UE_ADDR_0; ///< For the MBA0_MBUER register
-
-extern CenReadAddrReg READ_NCE_ADDR_1; ///< For the MBA1_MBNCER register
-extern CenReadAddrReg READ_RCE_ADDR_1; ///< For the MBA1_MBRCER register
-extern CenReadAddrReg READ_MPE_ADDR_1; ///< For the MBA1_MBMPER register
-extern CenReadAddrReg READ_UE_ADDR_1; ///< For the MBA1_MBUER register
+extern CenReadAddrReg READ_NCE_ADDR; ///< For the MBNCER register
+extern CenReadAddrReg READ_RCE_ADDR; ///< For the MBRCER register
+extern CenReadAddrReg READ_MPE_ADDR; ///< For the MBMPER register
+extern CenReadAddrReg READ_UE_ADDR; ///< For the MBUER register
/**
* @brief Reads the specified mainline memory read address from hardware.
* @param i_membChip A Centaur chip.
+ * @param i_mbaPos The target MBA position.
* @param i_addrReg The target address register.
* @param o_addr The returned address from hardware.
* @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
*/
-int32_t getCenReadAddr( ExtensibleChip * i_membChip, CenReadAddrReg i_addrReg,
- CenAddr & o_addr );
+int32_t getCenReadAddr( ExtensibleChip * i_membChip, uint32_t i_mbaPos,
+ CenReadAddrReg i_addrReg, CenAddr & o_addr );
/**
* @brief Writes the specified mainline memory read address to hardware.
* @param i_membChip A Centaur chip.
+ * @param i_mbaPos The target MBA position.
* @param i_addrReg The target address register.
* @param i_addr The address to write to hardware.
* @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
*/
-int32_t setCenReadAddr( ExtensibleChip * i_membChip, CenReadAddrReg i_addrReg,
- const CenAddr & i_addr );
+int32_t setCenReadAddr( ExtensibleChip * i_membChip, uint32_t i_mbaPos,
+ CenReadAddrReg i_addrReg, const CenAddr & i_addr );
//------------------------------------------------------------------------------
// MBA Address Registers
diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfCenMembuf.C b/src/usr/diag/prdf/common/plat/pegasus/prdfCenMembuf.C
index 85ad9f048..1b1373168 100755
--- a/src/usr/diag/prdf/common/plat/pegasus/prdfCenMembuf.C
+++ b/src/usr/diag/prdf/common/plat/pegasus/prdfCenMembuf.C
@@ -424,10 +424,8 @@ int32_t AnalyzeMpe( ExtensibleChip * i_membChip, STEP_CODE_DATA_STRUCT & i_sc,
// Add address to UE table.
if ( isFetchError )
{
- CenReadAddrReg reg = (0 == i_mbaPos) ? READ_MPE_ADDR_0
- : READ_MPE_ADDR_1;
CenAddr addr;
- l_rc = getCenReadAddr( i_membChip, reg, addr );
+ l_rc = getCenReadAddr( i_membChip, i_mbaPos, READ_MPE_ADDR, addr );
if ( SUCCESS != l_rc )
{
PRDF_ERR( PRDF_FUNC"getCenReadAddr() failed" );
@@ -521,10 +519,8 @@ int32_t AnalyzeFetchNce( ExtensibleChip * i_membChip,
l_rc = FAIL; break;
}
- CenReadAddrReg reg = (0 == i_mbaPos) ? READ_NCE_ADDR_0
- : READ_NCE_ADDR_1;
CenAddr addr;
- l_rc = getCenReadAddr( i_membChip, reg, addr );
+ l_rc = getCenReadAddr( i_membChip, i_mbaPos, READ_NCE_ADDR, addr );
if ( SUCCESS != l_rc )
{
PRDF_ERR( PRDF_FUNC"getCenReadAddr() failed" );
@@ -586,10 +582,8 @@ int32_t AnalyzeFetchRce( ExtensibleChip * i_membChip,
l_rc = FAIL; break;
}
- CenReadAddrReg reg = (0 == i_mbaPos) ? READ_RCE_ADDR_0
- : READ_RCE_ADDR_1;
CenAddr addr;
- l_rc = getCenReadAddr( i_membChip, reg, addr );
+ l_rc = getCenReadAddr( i_membChip, i_mbaPos, READ_RCE_ADDR, addr );
if ( SUCCESS != l_rc )
{
PRDF_ERR( PRDF_FUNC"getCenReadAddr() failed" );
@@ -652,10 +646,8 @@ int32_t AnalyzeFetchUe( ExtensibleChip * i_membChip,
l_rc = FAIL; break;
}
- CenReadAddrReg reg = (0 == i_mbaPos) ? READ_UE_ADDR_0
- : READ_UE_ADDR_1;
CenAddr addr;
- l_rc = getCenReadAddr( i_membChip, reg, addr );
+ l_rc = getCenReadAddr( i_membChip, i_mbaPos, READ_UE_ADDR, addr );
if ( SUCCESS != l_rc )
{
PRDF_ERR( PRDF_FUNC"getCenReadAddr() failed" );
OpenPOWER on IntegriCloud