From 74eb0dbfb80468860be178962e5302c301a21580 Mon Sep 17 00:00:00 2001 From: Andres Lugo-Reyes Date: Fri, 19 May 2017 11:06:22 -0500 Subject: Prevent WOF related error logs when WOF disabled Change-Id: I6ec583aa8b214d72f1fc2570a429cf160d2eb09b CQ: SW389424 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/40756 Tested-by: FSP CI Jenkins Reviewed-by: Christopher J. Cain Reviewed-by: Martha Broyles --- src/occ_405/wof/wof.c | 154 +++++++++++++++++++++++++++----------------------- 1 file changed, 84 insertions(+), 70 deletions(-) (limited to 'src/occ_405/wof') diff --git a/src/occ_405/wof/wof.c b/src/occ_405/wof/wof.c index b579fc1..1f4ae23 100644 --- a/src/occ_405/wof/wof.c +++ b/src/occ_405/wof/wof.c @@ -1303,92 +1303,106 @@ void set_clear_wof_disabled( uint8_t i_action, uint32_t prev_wof_disabled = g_wof->wof_disabled; - if( i_action == SET ) + do { - // Set the bit - g_wof->wof_disabled |= i_bit_mask; - // If error has already been logged, trace and skip - if( L_errorLogged ) + if( i_action == SET ) { - CMDH_TRAC_ERR("Another WOF error was encountered!" - " wof_disabled=0x%08x", - g_wof->wof_disabled); + // Set the bit + g_wof->wof_disabled |= i_bit_mask; + // If error has already been logged, trace and skip + if( L_errorLogged ) + { + CMDH_TRAC_ERR("Another WOF error was encountered!" + " wof_disabled=0x%08x", + g_wof->wof_disabled); + } + else + { + CMDH_TRAC_ERR("WOF encountered an error. wof_disabled =" + " 0x%08x", g_wof->wof_disabled ); + // If wof is disabled in driver, skip generating all error logs + if( g_wof->wof_disabled & WOF_RC_DRIVER_WOF_DISABLED ) + { + static bool trace = true; + if(trace) + { + CMDH_TRAC_INFO("WOF is disabled in the driver."); + trace = false; + } + break; + } + // Make sure the reason requires an error log + if( g_wof->wof_disabled & ERRL_RETURN_CODES ) + { + // Create error log + /** @errortype + * @moduleid SET_CLEAR_WOF_DISABLED + * @reasoncode WOF_DISABLED_RC + * @userdata1 current wof_disabled + * @userdata2 Bit requested to be set + * @userdata4 OCC_NO_EXTENDED_RC + * @devdesc WOF has been disabled due to an error + */ + l_errl = createErrl( + SET_CLEAR_WOF_DISABLED, + WOF_DISABLED_RC, + OCC_NO_EXTENDED_RC, + ERRL_SEV_UNRECOVERABLE, + NULL, + DEFAULT_TRACE_SIZE, + g_wof->wof_disabled, + i_bit_mask ); + + // commit the error log + commitErrl( &l_errl ); + L_errorLogged = true; + } + // if the previous wof_disabled was all zeros, + // send IPC command to PGPE to disable wof + if( !prev_wof_disabled ) + { + // Disable WOF + disable_wof(); + } + } } - else + else if ( i_action == CLEAR ) { - CMDH_TRAC_ERR("WOF encountered an error. wof_disabled =" - " 0x%08x", g_wof->wof_disabled ); - // Make sure the reason requires an error log - if( g_wof->wof_disabled & ERRL_RETURN_CODES ) + // Clear the bit + g_wof->wof_disabled &= ~i_bit_mask; + // If clearing the bit put wof_disabled at all 0's AND + // wof_disabled was not already all 0's, wof is being + // re-enabled. Log informational error. + if( prev_wof_disabled && !g_wof->wof_disabled ) { - // Create error log - /** @errortype + /** @ + * @errortype * @moduleid SET_CLEAR_WOF_DISABLED - * @reasoncode WOF_DISABLED_RC - * @userdata1 current wof_disabled - * @userdata2 Bit requested to be set + * @reasoncode WOF_RE_ENABLED + * @userdata1 Last Bit cleared + * @userdata2 0 * @userdata4 OCC_NO_EXTENDED_RC - * @devdesc WOF has been disabled due to an error + * @devdesc WOF is being re-enabled */ l_errl = createErrl( - SET_CLEAR_WOF_DISABLED, - WOF_DISABLED_RC, - OCC_NO_EXTENDED_RC, - ERRL_SEV_UNRECOVERABLE, - NULL, - DEFAULT_TRACE_SIZE, - g_wof->wof_disabled, - i_bit_mask ); + SET_CLEAR_WOF_DISABLED, + WOF_RE_ENABLED, + OCC_NO_EXTENDED_RC, + ERRL_SEV_INFORMATIONAL, + NULL, + DEFAULT_TRACE_SIZE, + i_bit_mask, + 0 ); // commit the error log commitErrl( &l_errl ); - L_errorLogged = true; - } - // if the previous wof_disabled was all zeros, - // send IPC command to PGPE to disable wof - if( !prev_wof_disabled ) - { - // Disable WOF - disable_wof(); } } - } - else if ( i_action == CLEAR ) - { - // Clear the bit - g_wof->wof_disabled &= ~i_bit_mask; - // If clearing the bit put wof_disabled at all 0's AND - // wof_disabled was not already all 0's, wof is being - // re-enabled. Log informational error. - if( prev_wof_disabled && !g_wof->wof_disabled ) + else { - /** @ - * @errortype - * @moduleid SET_CLEAR_WOF_DISABLED - * @reasoncode WOF_RE_ENABLED - * @userdata1 Last Bit cleared - * @userdata2 0 - * @userdata4 OCC_NO_EXTENDED_RC - * @devdesc WOF is being re-enabled - */ - l_errl = createErrl( - SET_CLEAR_WOF_DISABLED, - WOF_RE_ENABLED, - OCC_NO_EXTENDED_RC, - ERRL_SEV_INFORMATIONAL, - NULL, - DEFAULT_TRACE_SIZE, - i_bit_mask, - 0 ); - - // commit the error log - commitErrl( &l_errl ); + CMDH_TRAC_ERR("Invalid action given. Ignoring for now..."); } - } - else - { - CMDH_TRAC_ERR("Invalid action given. Ignoring for now..."); - } + }while( 0 ); } /** -- cgit v1.2.1