diff options
Diffstat (limited to 'src/usr/hwpf')
-rw-r--r-- | src/usr/hwpf/fapi/fapiHwAccess.C | 276 | ||||
-rw-r--r-- | src/usr/hwpf/fapi/makefile | 1 | ||||
-rw-r--r-- | src/usr/hwpf/plat/fapiPlatHwAccess.C | 79 | ||||
-rw-r--r-- | src/usr/hwpf/plat/fapiPlatUtil.C | 27 |
4 files changed, 344 insertions, 39 deletions
diff --git a/src/usr/hwpf/fapi/fapiHwAccess.C b/src/usr/hwpf/fapi/fapiHwAccess.C new file mode 100644 index 000000000..7a2c088ab --- /dev/null +++ b/src/usr/hwpf/fapi/fapiHwAccess.C @@ -0,0 +1,276 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/usr/hwpf/fapi/fapiHwAccess.C $ +// +// IBM CONFIDENTIAL +// +// COPYRIGHT International Business Machines Corp. 2011 +// +// p1 +// +// Object Code Only (OCO) source materials +// Licensed Internal Code Source Materials +// IBM HostBoot Licensed Internal Code +// +// The source code for this program is not published or other- +// wise divested of its trade secrets, irrespective of what has +// been deposited with the U.S. Copyright Office. +// +// Origin: 30 +// +// IBM_PROLOG_END +/** + * @file fapiHwAccess.C + * + * @brief Implements the fapiHwAccess.H functions at a high level, + * allowing for scand common tracing to occur before and after + * the call to the platform-specific worker. + * + * Note that platform code must provide the implementation. + */ + +#include <fapi.H> +#include <fapiPlatHwAccess.H> +#include <errl/errlentry.H> +#include <targeting/targetservice.H> +#include <devicefw/userif.H> + +extern "C" +{ + +//****************************************************************************** +// GetScom function +//****************************************************************************** +fapi::ReturnCode GetScom(const fapi::Target& i_target, + const uint64_t i_address, + ecmdDataBufferBase & o_data) +{ + fapi::ReturnCode l_rc; + char l_string[fapi::MAX_ECMD_STRING_LEN] = {0}; + bool l_traceit = fapi::platIsScanTraceEnabled(); + + + if( l_traceit ) + { + // get the string representation of the target + i_target.toString(l_string); + + + FAPI_SCAN( "TRACE : GETSCOM : START : %s : %.16llX", + l_string, + i_address ); + } + + // call the platform implemenation + l_rc = platGetScom( i_target, i_address, o_data ); + + + if( l_traceit ) + { + FAPI_SCAN( "TRACE : GETSCOM : END : %s : %.16llX %.16llX", + l_string, + i_address, + o_data.getDoubleWord( 0 ) ); + } + + return l_rc; +} + + +//****************************************************************************** +// PutScom function +//****************************************************************************** +fapi::ReturnCode PutScom(const fapi::Target& i_target, + const uint64_t i_address, + ecmdDataBufferBase & i_data) +{ + fapi::ReturnCode l_rc; + char l_string[fapi::MAX_ECMD_STRING_LEN] = {0}; + bool l_traceit = fapi::platIsScanTraceEnabled(); + + if( l_traceit ) + { + // get the string representation of the target + i_target.toString(l_string); + + FAPI_SCAN( "TRACE : PUTSCOM : START : %s : %.16llX %.16llX", + l_string, + i_address, + i_data.getDoubleWord( 0 ) ); + } + + // call the platform implemenation + l_rc = platPutScom( i_target, i_address, i_data ); + + + if( l_traceit ) + { + FAPI_SCAN( "TRACE : PUTSCOM : END : %s : %.16llX", + l_string, + i_address ); + } + + return l_rc; +} + +//@todo - Implement these functions later +#if 0 +//****************************************************************************** +// PutScomUnderMask function +//****************************************************************************** +fapi::ReturnCode PutScomUnderMask(const fapi::Target& i_target, + const uint64_t i_address, + ecmdDataBufferBase & i_data, + ecmdDataBufferBase & i_mask) +{ + fapi::ReturnCode l_rc; + char l_string[fapi::MAX_ECMD_STRING_LEN] = {0}; + bool l_traceit = fapi::platIsScanTraceEnabled(); + + if( l_traceit ) + { + // get the string representation of the target + i_target.toString(l_string); + + FAPI_SCAN( "TRACE : PUTSCOMMASK : START : %s : %.16llX %.16llX %.16llX", + l_string, + i_address, + i_data.getDoubleWord(0), + i_mask.getDoubleWord(0)); + } + + // call the platform implementation + l_rc = platPutScomUnderMask( i_target, i_address, i_data, i_mask ); + + if( l_traceit ) + { + FAPI_SCAN( "TRACE : PUTSCOMMASK : END : %s : %.16llX", + l_string, + i_address ); + } + return l_rc; +} + +//****************************************************************************** +// GetCfamRegister function +//****************************************************************************** +fapi::ReturnCode GetCfamRegister(const fapi::Target& i_target, + const uint32_t i_address, + ecmdDataBufferBase & o_data) +{ + fapi::ReturnCode l_rc; + char l_string[fapi::MAX_ECMD_STRING_LEN] = {0}; + + if( l_traceit ) + { + // get the string representation of the target + i_target.toString(l_string); + + FAPI_SCAN( "TRACE : GETCFAMREG : START : %s : %.16llX", + l_string, + i_address ); + } + + // call the platform implementation + l_rc = platGetCfamRegister( i_target, i_address, o_data ); + + + if( l_traceit ) + { + FAPI_SCAN( "TRACE : GETCFAMREG : END : %s : %.16llX %.16llX", + l_string, + i_address, + o_data.getDoubleWord(0) ); + } + + return l_rc; +} + +//****************************************************************************** +// PutCfamRegister function +//****************************************************************************** +fapi::ReturnCode PutCfamRegister(const fapi::Target& i_target, + const uint32_t i_address, + ecmdDataBufferBase & i_data) +{ + fapi::ReturnCode l_rc; + char l_string[fapi::MAX_ECMD_STRING_LEN] = {0}; + bool l_traceit = fapi::platIsScanTraceEnabled(); + + if( l_traceit ) + { + // get the string representation of the target + i_target.toString(l_string); + + FAPI_SCAN( "TRACE : PUTCFAMREG : START : %s : %.16llX %.16llX", + l_string, + i_address, + i_data.getDoubleWord(0) ); + } + + // call the platform implementation + l_rc = platPutCfamRegister( i_target, i_address, i_data ); + + + if( l_traceit ) + { + FAPI_SCAN( "TRACE : PUTCFAMREG : END : %s : %.16llX", + l_string, + i_address ); + } + return l_rc; +} + +//****************************************************************************** +// ModifyCfamRegister function +//****************************************************************************** +fapi::ReturnCode ModifyCfamRegister(const fapi::Target& i_target, + const uint32_t i_address, + ecmdDataBufferBase & i_data, + const fapi::ChipOpModifyMode i_modifyMode) +{ + fapi::ReturnCode l_rc; + char l_string[fapi::MAX_ECMD_STRING_LEN] = {0}; + bool l_traceit = fapi::platIsScanTraceEnabled(); + + if( l_traceit ) + { + // get the string representation of the target + i_target.toString(l_string); + + // get string representation of the modify mode + const char * l_apsModes = { "?", "OR", "AND", "XOR" }; + char * l_pMode = l_apsModes[0]; + int l_mode = static_cast<int>(i_modifyMode); + + if(( l_mode > 0 ) && ( l_mode < 4 )) + { + l_pMode = l_apsModes[l_mode]; + } + + FAPI_SCAN( "TRACE : MODCFAMREG : START : %s : %.16llX %.16llX %s", + l_string, + i_address, + i_data.getDoubleWord(0), + l_pMode ); + } + + // call the platform implementation + l_rc = platModifyCfamRegister( i_target, i_address, i_data, i_modifyMode ); + + + if( l_traceit ) + { + FAPI_SCAN( "TRACE : MODCFAMREG : END : %s : %llX %s", + l_string, + i_address, + l_pMode ); + } + + return l_rc; +} + +#endif + +} // extern "C" diff --git a/src/usr/hwpf/fapi/makefile b/src/usr/hwpf/fapi/makefile index 8049aaf46..a2ea9275f 100644 --- a/src/usr/hwpf/fapi/makefile +++ b/src/usr/hwpf/fapi/makefile @@ -31,6 +31,7 @@ EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp OBJS = fapiReturnCode.o \ fapiReturnCodeDataRef.o \ fapiTarget.o \ + fapiHwAccess.o \ fapiErrorInfo.o \ fapiErrorInfoMem.o \ fapiErrorInfoMemInit.o \ diff --git a/src/usr/hwpf/plat/fapiPlatHwAccess.C b/src/usr/hwpf/plat/fapiPlatHwAccess.C index b7789a06c..16adeece7 100644 --- a/src/usr/hwpf/plat/fapiPlatHwAccess.C +++ b/src/usr/hwpf/plat/fapiPlatHwAccess.C @@ -30,6 +30,7 @@ #include <fapiHwAccess.H> #include <fapiPlatTrace.H> +#include <fapiPlatHwAccess.H> #include <errl/errlentry.H> #include <targeting/targetservice.H> #include <devicefw/userif.H> @@ -38,15 +39,15 @@ extern "C" { //****************************************************************************** -// GetScom function +// platGetScom function, the platform implementation //****************************************************************************** -fapi::ReturnCode GetScom(const fapi::Target& i_target, - const uint64_t i_address, - ecmdDataBufferBase & o_data) +fapi::ReturnCode platGetScom(const fapi::Target& i_target, + const uint64_t i_address, + ecmdDataBufferBase & o_data) { - FAPI_DBG(ENTER_MRK "GetScom"); + FAPI_DBG(ENTER_MRK "platGetScom"); - fapi::ReturnCode l_rc; + fapi::ReturnCode l_rc; errlHndl_t l_err = NULL; // Extract the component pointer @@ -71,18 +72,18 @@ fapi::ReturnCode GetScom(const fapi::Target& i_target, o_data.setDoubleWord(0, l_data); } - FAPI_DBG(EXIT_MRK "GetScom"); + FAPI_DBG(EXIT_MRK "platGetScom"); return l_rc; } //****************************************************************************** -// PutScom function +// platPutScom function //****************************************************************************** -fapi::ReturnCode PutScom(const fapi::Target& i_target, - const uint64_t i_address, - ecmdDataBufferBase & i_data) +fapi::ReturnCode platPutScom(const fapi::Target& i_target, + const uint64_t i_address, + ecmdDataBufferBase & i_data) { - FAPI_DBG(ENTER_MRK "PutScom"); + FAPI_DBG(ENTER_MRK "platPutScom"); fapi::ReturnCode l_rc; errlHndl_t l_err = NULL; @@ -104,60 +105,60 @@ fapi::ReturnCode PutScom(const fapi::Target& i_target, l_rc.setPlatData(reinterpret_cast<void *> (l_err)); } - FAPI_DBG(EXIT_MRK "PutScom"); + FAPI_DBG(EXIT_MRK "platPutScom"); return l_rc; } //@todo - Implement these functions later #if 0 //****************************************************************************** -// PutScomUnderMask function +// platPutScomUnderMask function //****************************************************************************** -fapi::ReturnCode PutScomUnderMask(const fapi::Target& i_target, - const uint64_t i_address, - ecmdDataBufferBase & i_data, - ecmdDataBufferBase & i_mask) +fapi::ReturnCode platPutScomUnderMask(const fapi::Target& i_target, + const uint64_t i_address, + ecmdDataBufferBase & i_data, + ecmdDataBufferBase & i_mask) { - FAPI_DBG(ENTER_MRK "PutScomUnderMask"); + FAPI_DBG(ENTER_MRK "platPutScomUnderMask"); - FAPI_DBG(EXIT_MRK "PutScomUnderMask"); + FAPI_DBG(EXIT_MRK "platPutScomUnderMask"); } //****************************************************************************** -// GetCfamRegister function +// platGetCfamRegister function //****************************************************************************** -fapi::ReturnCode GetCfamRegister(const fapi::Target& i_target, - const uint32_t i_address, - ecmdDataBufferBase & o_data) +fapi::ReturnCode platGetCfamRegister(const fapi::Target& i_target, + const uint32_t i_address, + ecmdDataBufferBase & o_data) { - FAPI_DBG(ENTER_MRK "GetCfamRegister"); + FAPI_DBG(ENTER_MRK "platGetCfamRegister"); - FAPI_DBG(EXIT_MRK "GetCfamRegister"); + FAPI_DBG(EXIT_MRK "platGetCfamRegister"); } //****************************************************************************** -// PutCfamRegister function +// platPutCfamRegister function //****************************************************************************** -fapi::ReturnCode PutCfamRegister(const fapi::Target& i_target, - const uint32_t i_address, - ecmdDataBufferBase & i_data) +fapi::ReturnCode platPutCfamRegister(const fapi::Target& i_target, + const uint32_t i_address, + ecmdDataBufferBase & i_data) { - FAPI_DBG(ENTER_MRK "PutCfamRegister"); + FAPI_DBG(ENTER_MRK "platPutCfamRegister"); - FAPI_DBG(EXIT_MRK "PutCfamRegister"); + FAPI_DBG(EXIT_MRK "platPutCfamRegister"); } //****************************************************************************** -// ModifyCfamRegister function +// platModifyCfamRegister function //****************************************************************************** -fapi::ReturnCode ModifyCfamRegister(const fapi::Target& i_target, - const uint32_t i_address, - ecmdDataBufferBase & i_data, - const fapi::ChipOpModifyMode i_modifyMode) +fapi::ReturnCode platModifyCfamRegister(const fapi::Target& i_target, + const uint32_t i_address, + ecmdDataBufferBase & i_data, + const fapi::ChipOpModifyMode i_modifyMode) { - FAPI_DBG(ENTER_MRK "ModifyCfamRegister"); + FAPI_DBG(ENTER_MRK "platModifyCfamRegister"); - FAPI_DBG(EXIT_MRK "ModifyCfamRegister"); + FAPI_DBG(EXIT_MRK "platModifyCfamRegister"); } #endif diff --git a/src/usr/hwpf/plat/fapiPlatUtil.C b/src/usr/hwpf/plat/fapiPlatUtil.C index b0f3d79c3..782481c83 100644 --- a/src/usr/hwpf/plat/fapiPlatUtil.C +++ b/src/usr/hwpf/plat/fapiPlatUtil.C @@ -43,6 +43,7 @@ trace_desc_t* g_fapiInfTd; trace_desc_t* g_fapiImpTd; trace_desc_t* g_fapiErrTd; trace_desc_t* g_fapiDbgTd; +trace_desc_t* g_fapiScanTd; //****************************************************************************** // Global TracInit objects. Construction will initialize the trace buffer @@ -51,6 +52,7 @@ TRAC_INIT(&g_fapiInfTd, FAPI_INF_TRACE_NAME, 4096); TRAC_INIT(&g_fapiImpTd, FAPI_IMP_TRACE_NAME, 4096); TRAC_INIT(&g_fapiErrTd, FAPI_ERR_TRACE_NAME, 4096); TRAC_INIT(&g_fapiDbgTd, FAPI_DBG_TRACE_NAME, 4096); +TRAC_INIT(&g_fapiScanTd, FAPI_SCAN_TRACE_NAME, 4096); namespace fapi { @@ -110,4 +112,29 @@ void fapiLogError(ReturnCode & io_rc) + + +//**************************************************************************** +// platform-level implementation + +bool platIsScanTraceEnabled() +{ + // TODO: Get the answer from g_fapiScanTd conditional trace buffer. Camvan + // has not pushed the code yet. + return 1; +} + +//**************************************************************************** +// platform-level implementation + +void platSetScanTrace( bool i_enable ) +{ + // TODO: enable or disable scan trace via the SCAN trace buffer. Camvan + // has not pushed the code yet. + return; } + + + + +} // namespace fapi |