diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/include/usr/fapi2/plat_hwp_invoker.H | 28 | ||||
-rwxr-xr-x | src/usr/fapi2/test/rcTest.C | 17 |
2 files changed, 43 insertions, 2 deletions
diff --git a/src/include/usr/fapi2/plat_hwp_invoker.H b/src/include/usr/fapi2/plat_hwp_invoker.H index a0b335a1e..c19812620 100644 --- a/src/include/usr/fapi2/plat_hwp_invoker.H +++ b/src/include/usr/fapi2/plat_hwp_invoker.H @@ -61,7 +61,7 @@ void hwpLock( bool i_lock ); * parameters. This macro simply calls the FAPI HWP executor macro and converts * the returned fapi::Return code to a HostBoot error log * - * ERRHNDL - errlHndl_t + * ERRHNDL - local errlHndl_t * FUNC - HWP function name * _args_... - Any additional arguments that the HWP requires */ @@ -80,6 +80,32 @@ void hwpLock( bool i_lock ); } /** + * @brief HWP Invoker macro that returns the fapi RC + * + * This macro is called by HostBoot PLAT code to invoke a HW Procedure (HWP). + * The caller must create any necessary fapi::Targets and pass them as + * parameters. This macro simply calls the FAPI HWP executor macro and converts + * the returned fapi::Return code to a HostBoot error log + * + * ERRHNDL - local errlHndl_t + * _RC - local fapi2::ReturnCode + * FUNC - HWP function name + * _args_... - Any additional arguments that the HWP requires + */ + +#define FAPI_INVOKE_HWP_RC(ERRHNDL, _RC, FUNC, _args_...) \ + {\ + fapi2::hwpLock(true); \ + FAPI_EXEC_HWP(_RC, FUNC, ##_args_); \ + ERRHNDL = fapi2::rcToErrl(_RC);\ + if( ERRHNDL ) {\ + ERRHNDL->collectTrace(FAPI_IMP_TRACE_NAME,256);\ + ERRHNDL->collectTrace(FAPI_TRACE_NAME,384);\ + }\ + fapi2::hwpLock(false); \ + } + +/** * @brief Pseudo-HWP Invoker macro * * This macro is called by HostBoot PLAT code to invoke a HW Procedure (HWP) diff --git a/src/usr/fapi2/test/rcTest.C b/src/usr/fapi2/test/rcTest.C index 353eebbdf..4893aef95 100755 --- a/src/usr/fapi2/test/rcTest.C +++ b/src/usr/fapi2/test/rcTest.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2017 */ +/* Contributors Listed Below - COPYRIGHT 2011,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -1750,6 +1750,21 @@ uint32_t rcTestReturnCodeAttrErrls() TS_FAIL("No error from p9_registerFfdc_fail !!"); numFails++; } + + numTests++; + fapi2::ReturnCode l_rc; + FAPI_INVOKE_HWP_RC(l_errl, l_rc, p9_registerFfdc_fail, fapi2_procTarget); + if( (l_errl != NULL) && (l_rc == (fapi2::ReturnCode)fapi2::RC_TEST_ERROR_A) ) + { + FAPI_INF("p9_registerFfdc_fail returned correct RC"); + delete l_errl; + l_errl = NULL; + } + else + { + TS_FAIL("Wrong RC from p9_registerFfdc_fail !!"); + numFails++; + } } while (0); FAPI_INF("rcTestReturnCodeAttrErrls Test Complete. %d/%d fails", |