From 393a4144ae5ba71810d5063e0c643efe565aaed6 Mon Sep 17 00:00:00 2001 From: Chris Phan Date: Mon, 25 Mar 2013 17:40:14 -0500 Subject: PRD: change scom accesses to use fapiGetScom/fapiPutScom - These fapi scom methods are common between fsp and hostboot - This change will allow scom data traces to turn on via hbfwTrace -d=SCAN:1 or fsp-trace -d scan_ll 1 RTC: 67620 Change-Id: I7a7c346a5e5039b7f72eafe90d6bb3cdc7b7c41d Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/3731 Tested-by: Jenkins Server Reviewed-by: BENJAMIN J. WEISENBECK Reviewed-by: Zane Shelley Reviewed-by: A. Patrick Williams III Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/3855 --- .../framework/register/prdfHomRegisterAccess.C | 80 +++------------------- .../framework/service/prdfPlatServices_common.C | 15 ++-- .../framework/service/prdfPlatServices_common.H | 7 ++ 3 files changed, 26 insertions(+), 76 deletions(-) diff --git a/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.C b/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.C index 55f68d122..cb107b3c6 100755 --- a/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.C +++ b/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.C @@ -32,14 +32,8 @@ #ifdef __HOSTBOOT_MODULE #include - #include - #include - #include - #include #else #include - #include - #include #include #endif @@ -51,6 +45,7 @@ #include #include #include + #undef prdfHomRegisterAccess_C @@ -145,15 +140,12 @@ uint32_t ScomAccessor::Access(TARGETING::TargetHandle_t i_target, uint32_t rc = SUCCESS; errlHndl_t errH = NULL; uint32_t bsize = bs.GetLength(); - uint32_t l_ecmdRc = ECMD_DBUF_SUCCESS; if(i_target != NULL) { #ifdef __HOSTBOOT_MODULE ecmdDataBufferBase buffer(bsize); - uint64_t l_data = 0; - size_t l_size = sizeof(uint64_t); #else @@ -172,36 +164,22 @@ uint32_t ScomAccessor::Access(TARGETING::TargetHandle_t i_target, // FIXME: If register is in a EX chiplet, need to also update // PORE image ???? - #ifdef __HOSTBOOT_MODULE - - l_data = buffer.getDoubleWord(0); - errH = deviceWrite( i_target, - &l_data, - l_size, - DEVICE_SCOM_ADDRESS(registerId)); - - #else - - errH = HWSV::hwsvPutScom(i_target, registerId, buffer); - - #endif + PRD_FAPI_TO_ERRL(errH, + fapiPutScom, + PlatServices::getFapiTarget(i_target), + registerId, + buffer); break; case MopRegisterAccess::READ: bs.Pattern(0x00000000); // clear all bits - #ifdef __HOSTBOOT_MODULE - - errH = deviceRead( i_target, &l_data, l_size, - DEVICE_SCOM_ADDRESS(registerId) ); - l_ecmdRc = buffer.setDoubleWord(0, l_data); - - #else - - errH = HWSV::hwsvGetScom(i_target, registerId, buffer); - - #endif + PRD_FAPI_TO_ERRL(errH, + fapiGetScom, + PlatServices::getFapiTarget(i_target), + registerId, + buffer); for(unsigned int i = 0; i < bsize; ++i) { @@ -264,42 +242,6 @@ uint32_t ScomAccessor::Access(TARGETING::TargetHandle_t i_target, errH = NULL; } } - if (l_ecmdRc != ECMD_DBUF_SUCCESS) - { - PRDF_ERR( "ScomAccessor::Access ecmdDataBuffer " - "operation failed with ecmd_rc = 0x%.8X", l_ecmdRc ); - /*@ - * @errortype - * @subsys EPUB_FIRMWARE_SP - * @reasoncode PRDF_ECMD_DATA_BUFFER_FAIL - * @moduleid PRDF_HOM_SCOM - * @userdata1 ecmdDataBuffer return code - * @userdata2 Chip HUID - * @userdata3 unused - * @userdata4 unused - * @devdesc Low-level data buffer support returned a failure. Probable firmware error. - * @procedure EPUB_PRC_SP_CODE - */ - errlHndl_t ecmd_rc_errl = NULL; - PRDF_CREATE_ERRL(ecmd_rc_errl, - ERRL_SEV_PREDICTIVE, // error on diagnosticERRL_ETYPE_NOT_APPLICABLE - ERRL_ETYPE_NOT_APPLICABLE, - SRCI_MACH_CHECK, // B1xx src - SRCI_NO_ATTR, - PRDF_HOM_SCOM, // module id - FSP_DEFAULT_REFCODE, // refcode - PRDF_ECMD_DATA_BUFFER_FAIL, // Reason code - see prdf_service_codes.H - l_ecmdRc, // user data word 1 - PlatServices::getHuid(i_target), // user data word 2 - 0, // user data word 3 - 0 // user data word 4 - ); - - PRDF_ADD_PROCEDURE_CALLOUT(ecmd_rc_errl, SRCI_PRIORITY_MED, EPUB_PRC_SP_CODE); - PRDF_COMMIT_ERRL(ecmd_rc_errl, ERRL_ACTION_REPORT); - - rc = FAIL; - } PRDF_DEXIT("ScomAccessor::Access(): rc=%d", rc); diff --git a/src/usr/diag/prdf/common/framework/service/prdfPlatServices_common.C b/src/usr/diag/prdf/common/framework/service/prdfPlatServices_common.C index a65a30447..10cd90c2a 100755 --- a/src/usr/diag/prdf/common/framework/service/prdfPlatServices_common.C +++ b/src/usr/diag/prdf/common/framework/service/prdfPlatServices_common.C @@ -74,13 +74,6 @@ fapi::TargetType getFapiType( TARGETING::TargetHandle_t i_target ) return o_type; } -//------------------------------------------------------------------------------ - -fapi::Target getFapiTarget( TARGETING::TargetHandle_t i_target ) -{ - return fapi::Target( getFapiType(i_target), i_target ); -} - //############################################################################## //## System Level Utility Functions //############################################################################## @@ -91,6 +84,14 @@ void getECIDString( TargetHandle_t i_target, const char * o_ecidStr ) PRDF_ERR( "[PlatServices::getECIDString] Function not implemented yet" ); } +//------------------------------------------------------------------------------ + +fapi::Target getFapiTarget( TARGETING::TargetHandle_t i_target ) +{ + return fapi::Target( getFapiType(i_target), i_target ); +} + + //############################################################################## //## Processor specific functions //############################################################################## diff --git a/src/usr/diag/prdf/common/framework/service/prdfPlatServices_common.H b/src/usr/diag/prdf/common/framework/service/prdfPlatServices_common.H index 3738e02e4..97853bdb5 100755 --- a/src/usr/diag/prdf/common/framework/service/prdfPlatServices_common.H +++ b/src/usr/diag/prdf/common/framework/service/prdfPlatServices_common.H @@ -112,6 +112,13 @@ int32_t syncFile( const char * i_fileName ); */ void milliSleep( uint32_t i_seconds, uint32_t i_milliseconds ); +/** + * @brief Convert a Targeting target to FAPI target + * @param i_target Any target + * @return Returns the corresponding FAPI target for a given target + */ +fapi::Target getFapiTarget( TARGETING::TargetHandle_t i_target ); + //############################################################################## //## Processor specific functions //############################################################################## -- cgit v1.2.1