summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThi Tran <thi@us.ibm.com>2012-03-06 10:53:13 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-03-12 14:59:35 -0500
commit2caae71c74b5f93da06ddf52cfdb5e2c670c73fb (patch)
tree0c0044d0a133fa46c2a4387106c6be7e78d3c9f7 /src
parenta3b4a0ff044b60b2af8082fd5256b1926e8b35b5 (diff)
downloadtalos-hostboot-2caae71c74b5f93da06ddf52cfdb5e2c670c73fb.tar.gz
talos-hostboot-2caae71c74b5f93da06ddf52cfdb5e2c670c73fb.zip
CFAM access of non-chip type target
Updated from review comments Updated from review comments of set #2 Change-Id: Ia56b239954a1e3287440056b9ccd78634cc0f3a7 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/723 Tested-by: Jenkins Server Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: MIKE J. JONES <mjjones@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/include/usr/hwpf/plat/fapiPlatReasonCodes.H3
-rw-r--r--src/usr/hwpf/fapi/fapiHwAccess.C32
-rw-r--r--src/usr/hwpf/plat/fapiPlatHwAccess.C119
3 files changed, 132 insertions, 22 deletions
diff --git a/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H b/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H
index 62550e3d4..9afc348fc 100644
--- a/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H
+++ b/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H
@@ -43,6 +43,8 @@ namespace fapi
MOD_VERIFY_CFAM_ACCESS_TARGET = 0x07,
MOD_ATTR_BASE_ADDR_GET = 0x08,
MOD_ATTR_DQ_MAP_GET = 0x09,
+ MOD_GET_CFAM_CHIP_TARGET = 0x0A,
+
};
// Note that for HWP generated errors (MOD_HWP_RC_TO_ERRL), the
@@ -61,6 +63,7 @@ namespace fapi
RC_ECMD_OPERATION_FAILURE = HWPF_COMP_ID | 0x14,
RC_CFAM_ACCESS_ON_PROC_ERR = HWPF_COMP_ID | 0x15,
RC_ATTR_BASE_BAD_PARAM = HWPF_COMP_ID | 0x16,
+ RC_INVALID_NUM_PARENT_CHIP = HWPF_COMP_ID | 0x17,
};
};
diff --git a/src/usr/hwpf/fapi/fapiHwAccess.C b/src/usr/hwpf/fapi/fapiHwAccess.C
index 9bb2ed630..adeec19dc 100644
--- a/src/usr/hwpf/fapi/fapiHwAccess.C
+++ b/src/usr/hwpf/fapi/fapiHwAccess.C
@@ -61,6 +61,11 @@ fapi::ReturnCode fapiGetScom(const fapi::Target& i_target,
// call the platform implementation
l_rc = platGetScom( i_target, i_address, o_data );
+ if (l_rc)
+ {
+ FAPI_ERR("fapiGetScom failed - Target %s, Addr %.16llX", i_target.toEcmdString(), i_address);
+ }
+
if( l_traceit )
{
FAPI_SCAN( "TRACE : GETSCOM : %s : %.16llX %.16llX",
@@ -83,9 +88,14 @@ fapi::ReturnCode fapiPutScom(const fapi::Target& i_target,
fapi::ReturnCode l_rc;
bool l_traceit = platIsScanTraceEnabled();
- // call the platform implemenation
+ // call the platform implementation
l_rc = platPutScom( i_target, i_address, i_data );
+ if (l_rc)
+ {
+ FAPI_ERR("fapiPutScom failed - Target %s, Addr %.16llX", i_target.toEcmdString(), i_address);
+ }
+
if( l_traceit )
{
FAPI_SCAN( "TRACE : PUTSCOM : %s : %.16llX %.16llX",
@@ -111,6 +121,11 @@ fapi::ReturnCode fapiPutScomUnderMask(const fapi::Target& i_target,
// call the platform implementation
l_rc = platPutScomUnderMask( i_target, i_address, i_data, i_mask );
+ if (l_rc)
+ {
+ FAPI_ERR("fapiPutScomUnderMask failed - Target %s, Addr %.16llX", i_target.toEcmdString(), i_address);
+ }
+
if( l_traceit )
{
FAPI_SCAN( "TRACE : PUTSCOMMASK : %s : %.16llX %.16llX %.16llX",
@@ -136,6 +151,11 @@ fapi::ReturnCode fapiGetCfamRegister(const fapi::Target& i_target,
// call the platform implementation
l_rc = platGetCfamRegister( i_target, i_address, o_data );
+ if (l_rc)
+ {
+ FAPI_ERR("fapiGetCfamRegister failed - Target %s, Addr %.8X", i_target.toEcmdString(), i_address);
+ }
+
if( l_traceit )
{
FAPI_SCAN( "TRACE : GETCFAMREG : %s : %.8X %.8X",
@@ -160,6 +180,11 @@ fapi::ReturnCode fapiPutCfamRegister(const fapi::Target& i_target,
// call the platform implementation
l_rc = platPutCfamRegister( i_target, i_address, i_data );
+ if (l_rc)
+ {
+ FAPI_ERR("platPutCfamRegister failed - Target %s, Addr %.8X", i_target.toEcmdString(), i_address);
+ }
+
if( l_traceit )
{
FAPI_SCAN( "TRACE : PUTCFAMREG : %s : %.8X %.8X",
@@ -185,6 +210,11 @@ fapi::ReturnCode fapiModifyCfamRegister(const fapi::Target& i_target,
// call the platform implementation
l_rc = platModifyCfamRegister( i_target, i_address, i_data, i_modifyMode );
+ if (l_rc)
+ {
+ FAPI_ERR("platModifyCfamRegister failed - Target %s, Addr %.8X", i_target.toEcmdString(), i_address);
+ }
+
if( l_traceit )
{
// get string representation of the modify mode
diff --git a/src/usr/hwpf/plat/fapiPlatHwAccess.C b/src/usr/hwpf/plat/fapiPlatHwAccess.C
index 18d7ad4a4..c2a3d143b 100644
--- a/src/usr/hwpf/plat/fapiPlatHwAccess.C
+++ b/src/usr/hwpf/plat/fapiPlatHwAccess.C
@@ -57,6 +57,8 @@
#include <devicefw/userif.H>
#include <ecmdDataBufferBase.H>
#include <fapiPlatReasonCodes.H>
+#include <targeting/predicates/predicatectm.H>
+#include <targeting/targetservice.H>
extern "C"
{
@@ -89,7 +91,6 @@ fapi::ReturnCode platGetScom(const fapi::Target& i_target,
if (l_err)
{
// Add the error log pointer as data to the ReturnCode
- FAPI_ERR("platGetScom: deviceRead() returns error");
l_rc.setPlatError(reinterpret_cast<void *> (l_err));
}
else
@@ -138,7 +139,6 @@ fapi::ReturnCode platPutScom(const fapi::Target& i_target,
if (l_err)
{
// Add the error log pointer as data to the ReturnCode
- FAPI_ERR("platPutScom: deviceWrite() returns error");
l_rc.setPlatError(reinterpret_cast<void *> (l_err));
}
@@ -174,7 +174,6 @@ fapi::ReturnCode platPutScomUnderMask(const fapi::Target& i_target,
if (l_err)
{
// Add the error log pointer as data to the ReturnCode
- FAPI_ERR("platPutScomUnderMask: deviceRead() returns error");
l_rc.setPlatError(reinterpret_cast<void *> (l_err));
break;
}
@@ -199,7 +198,6 @@ fapi::ReturnCode platPutScomUnderMask(const fapi::Target& i_target,
if (l_err)
{
// Add the error log pointer as data to the ReturnCode
- FAPI_ERR("platPutScomUnderMask: deviceWrite() returns error");
l_rc.setPlatError(reinterpret_cast<void *> (l_err));
break;
}
@@ -250,6 +248,63 @@ static errlHndl_t verifyCfamAccessTarget(const fapi::Target& i_target)
return l_err;
}
+/****************************************************************************
+ * @brief Get chip target for cfam access
+ * HW procedures may pass in non-chip targets (such as MBA or
+ * MBS as a target), so we need to find the parent chip in order
+ * to pass it to the device driver.
+ *
+ * @param[in] i_target The target as passed in by the procedure.
+ *
+ * @return errlHndl_t if can't find parent, NULL otherwise.
+ ****************************************************************************/
+static errlHndl_t getCfamChipTarget(const TARGETING::Target* i_target,
+ TARGETING::Target*& o_chipTarget)
+{
+ errlHndl_t l_err = NULL;
+
+ // Default to input target
+ o_chipTarget = const_cast<TARGETING::Target*>(i_target);
+
+ // Check to see if this is a chiplet
+ if (i_target->getAttr<TARGETING::ATTR_CLASS>() == TARGETING::CLASS_UNIT)
+ {
+ // Look for its chip parent
+ TARGETING::PredicateCTM l_chipClass(TARGETING::CLASS_CHIP);
+ TARGETING::TargetHandleList l_list;
+ TARGETING::TargetService& l_targetService = TARGETING::targetService();
+ (void) l_targetService.getAssociated(
+ l_list,
+ i_target,
+ TARGETING::TargetService::PARENT,
+ TARGETING::TargetService::ALL,
+ &l_chipClass);
+
+ if ( l_list.size() == 1 )
+ {
+ o_chipTarget = l_list[0];
+ }
+ else
+ {
+ // Something is wrong here, can't have more than one parent chip
+ FAPI_ERR("getCfamChipTarget: Invalid number of parent chip for this target chiplet - # parent chips %d", l_list.size());
+ /*@
+ * @errortype
+ * @moduleid MOD_GET_CFAM_CHIP_TARGET
+ * @reasoncode RC_INVALID_NUM_PARENT_CHIP
+ * @userdata1 Number of parent chip found
+ * @devdesc Invalid num of parent chip found for input CFAM target chiplet
+ */
+ l_err = new ERRORLOG::ErrlEntry(
+ ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ fapi::MOD_GET_CFAM_CHIP_TARGET,
+ fapi::RC_INVALID_NUM_PARENT_CHIP,
+ l_list.size());
+ }
+ }
+ return l_err;
+}
+
//******************************************************************************
// platGetCfamRegister function
//******************************************************************************
@@ -269,15 +324,24 @@ fapi::ReturnCode platGetCfamRegister(const fapi::Target& i_target,
if (l_err)
{
// Add the error log pointer as data to the ReturnCode
- FAPI_ERR("platGetCfamRegister: verifyCfamAccessTarget() returns error");
- l_rc.setPlatError(reinterpret_cast<void *> (l_err));
- break;
+ l_rc.setPlatError(reinterpret_cast<void *> (l_err));
+ break;
}
// Extract the component pointer
TARGETING::Target* l_target =
reinterpret_cast<TARGETING::Target*>(i_target.get());
+ // Get the chip target if l_target is not a chip
+ TARGETING::Target* l_myChipTarget = NULL;
+ l_err = getCfamChipTarget(l_target, l_myChipTarget);
+ if (l_err)
+ {
+ // Add the error log pointer as data to the ReturnCode
+ l_rc.setPlatError(reinterpret_cast<void *> (l_err));
+ break;
+ }
+
// Perform CFAM read via FSI
// Address needs to be multiply by 4 because register addresses are word
// offsets but the FSI addresses are byte offsets.
@@ -285,14 +349,13 @@ fapi::ReturnCode platGetCfamRegister(const fapi::Target& i_target,
uint64_t l_addr = ((i_address & 0x003F) << 2) | (i_address & 0xFF00);
uint32_t l_data = 0;
size_t l_size = sizeof(uint32_t);
- l_err = deviceRead(l_target,
+ l_err = deviceRead(l_myChipTarget,
&l_data,
l_size,
DEVICE_FSI_ADDRESS(l_addr));
if (l_err)
{
// Add the error log pointer as data to the ReturnCode
- FAPI_ERR("platGetCfamRegister: deviceRead() returns error");
l_rc.setPlatError(reinterpret_cast<void *> (l_err));
break;
}
@@ -334,15 +397,24 @@ fapi::ReturnCode platPutCfamRegister(const fapi::Target& i_target,
if (l_err)
{
// Add the error log pointer as data to the ReturnCode
- FAPI_ERR("platPutCfamRegister: verifyCfamAccessTarget() returns error");
- l_rc.setPlatError(reinterpret_cast<void *> (l_err));
- break;
+ l_rc.setPlatError(reinterpret_cast<void *> (l_err));
+ break;
}
// Extract the component pointer
TARGETING::Target* l_target =
reinterpret_cast<TARGETING::Target*>(i_target.get());
+ TARGETING::Target* l_myChipTarget = NULL;
+ // Get the chip target if l_target is not a chip
+ l_err = getCfamChipTarget(l_target, l_myChipTarget);
+ if (l_err)
+ {
+ // Add the error log pointer as data to the ReturnCode
+ l_rc.setPlatError(reinterpret_cast<void *> (l_err));
+ break;
+ }
+
// Perform CFAM write via FSI
// Address needs to be multiply by 4 because register addresses are word
// offsets but the FSI addresses are byte offsets
@@ -350,14 +422,13 @@ fapi::ReturnCode platPutCfamRegister(const fapi::Target& i_target,
uint64_t l_addr = ((i_address & 0x003F) << 2) | (i_address & 0xFF00);
uint32_t l_data = i_data.getWord(0);
size_t l_size = sizeof(uint32_t);
- l_err = deviceWrite(l_target,
+ l_err = deviceWrite(l_myChipTarget,
&l_data,
l_size,
DEVICE_FSI_ADDRESS(l_addr));
if (l_err)
{
// Add the error log pointer as data to the ReturnCode
- FAPI_ERR("platPutCfamRegister: deviceWrite() returns error");
l_rc.setPlatError(reinterpret_cast<void *> (l_err));
break;
}
@@ -368,7 +439,6 @@ fapi::ReturnCode platPutCfamRegister(const fapi::Target& i_target,
return l_rc;
}
-
/****************************************************************************
* @brief Modifying input 32-bit data with the specified mode
*
@@ -425,15 +495,24 @@ fapi::ReturnCode platModifyCfamRegister(const fapi::Target& i_target,
if (l_err)
{
// Add the error log pointer as data to the ReturnCode
- FAPI_ERR("platModifyCfamRegister: verifyCfamAccessTarget() returns error");
- l_rc.setPlatError(reinterpret_cast<void *> (l_err));
- break;
+ l_rc.setPlatError(reinterpret_cast<void *> (l_err));
+ break;
}
// Extract the component pointer
TARGETING::Target* l_target =
reinterpret_cast<TARGETING::Target*>(i_target.get());
+ // Get the chip target if l_target is not a chip
+ TARGETING::Target* l_myChipTarget = NULL;
+ l_err = getCfamChipTarget(l_target, l_myChipTarget);
+ if (l_err)
+ {
+ // Add the error log pointer as data to the ReturnCode
+ l_rc.setPlatError(reinterpret_cast<void *> (l_err));
+ break;
+ }
+
// Read current value
// Address needs to be multiply by 4 because register addresses are word
// offsets but the FSI addresses are byte offsets.
@@ -441,14 +520,13 @@ fapi::ReturnCode platModifyCfamRegister(const fapi::Target& i_target,
uint64_t l_addr = ((i_address & 0x003F) << 2) | (i_address & 0xFF00);
uint32_t l_data = 0;
size_t l_size = sizeof(uint32_t);
- l_err = deviceRead(l_target,
+ l_err = deviceRead(l_myChipTarget,
&l_data,
l_size,
DEVICE_FSI_ADDRESS(l_addr));
if (l_err)
{
// Add the error log pointer as data to the ReturnCode
- FAPI_ERR("platModifyCfamRegister: deviceRead() returns error");
l_rc.setPlatError(reinterpret_cast<void *> (l_err));
break;
}
@@ -464,7 +542,6 @@ fapi::ReturnCode platModifyCfamRegister(const fapi::Target& i_target,
if (l_err)
{
// Add the error log pointer as data to the ReturnCode
- FAPI_ERR("platModifyCfamRegister: deviceWrite() returns error");
l_rc.setPlatError(reinterpret_cast<void *> (l_err));
break;
}
OpenPOWER on IntegriCloud