src/occ_405/errl/errl.c
// Function Specification
//
// Name:  commitErrl
//
// Description: Commit an Error Log
//
// End Function Specification
Function Specification
Name:  commitErrl

Commit an Error Log

End Function Specification
Function Specification Name : commitErrl Commit an Error Log End Function Specification
void commitErrl( errlHndl_t *io_err )
{
    ocb_oisr0_t l_oisr0_status;
    static bool L_log_commits_suspended_by_safe_mode = FALSE;
    if (!L_log_commits_suspended_by_safe_mode && io_err != NULL)
    {
        if ((*io_err != NULL ) && ( *io_err != INVALID_ERR_HNDL ))
        {
            l_oisr0_status.value = in32(OCB_OISR0);
            if (l_oisr0_status.fields.check_stop_ppc405)
            {
                TRAC_IMP("commitErrl: System checkstop detected: ppc405, OISR0[0x%08x]",
                         l_oisr0_status.value);
                reset_state_request(RESET_REQUESTED_DUE_TO_ERROR);
                (*io_err)->iv_actions.word = ERRL_ACTIONS_SAFE_MODE_REQUIRED;
                (*io_err)->iv_severity = ERRL_SEV_INFORMATIONAL;
                (*io_err)->iv_numCallouts = 0;
                TRAC_IMP("SAFE mode required, suspending error log commits. FIR capture required.");
                L_log_commits_suspended_by_safe_mode = TRUE;
                G_fir_collection_required = TRUE;
            }
            if((*io_err)->iv_actions.reset_required)
            {
                (*io_err)->iv_severity = ERRL_SEV_UNRECOVERABLE;
                if(!(*io_err)->iv_numCallouts)
                {
                    addCalloutToErrl(*io_err,
                                     ERRL_CALLOUT_TYPE_COMPONENT_ID,
                                     ERRL_COMPONENT_ID_FIRMWARE,
                                     ERRL_CALLOUT_PRIORITY_HIGH);
                }
            }
            if((*io_err)->iv_numCallouts < ERRL_MAX_CALLOUTS)
            {
                memset(&(*io_err)->iv_callouts[(*io_err)->iv_numCallouts], 0,
                        sizeof(ErrlCallout_t));
            }
            (*io_err)->iv_numCallouts = ERRL_MAX_CALLOUTS;
            (*io_err)->iv_userDetails.iv_committed = 1;
            uint32_t    l_cnt = 2;  
            uint32_t    l_sum = 0;
            uint32_t    l_size = (*io_err)->iv_userDetails.iv_entrySize;
            uint8_t *   l_p = (uint8_t *)*io_err;
            for( ; l_cnt < l_size ; l_cnt++ )
            {
                l_sum += *(l_p+l_cnt);
            }
            (*io_err)->iv_checkSum = l_sum;
            dcache_flush( *io_err, MAX_ERRL_ENTRY_SZ );
            reportErrorLog( *io_err, l_size );
        }
        *io_err = (errlHndl_t) NULL;
    }
}
void commitErrl ( errlHndl_t * io_err ) { ocb_oisr0_t l_oisr0_status ; static bool L_log_commits_suspended_by_safe_mode = FALSE ; if ( ! L_log_commits_suspended_by_safe_mode && io_err != NULL ) { if ( ( * io_err != NULL ) && ( * io_err != INVALID_ERR_HNDL ) ) { l_oisr0_status . value = in32 ( OCB_OISR0 ) ; if ( l_oisr0_status . fields . check_stop_ppc405 ) { TRAC_IMP ( " " , l_oisr0_status . value ) ; reset_state_request ( RESET_REQUESTED_DUE_TO_ERROR ) ; ( * io_err ) -> iv_actions . word = ERRL_ACTIONS_SAFE_MODE_REQUIRED ; ( * io_err ) -> iv_severity = ERRL_SEV_INFORMATIONAL ; ( * io_err ) -> iv_numCallouts = 0 ; TRAC_IMP ( " " ) ; L_log_commits_suspended_by_safe_mode = TRUE ; G_fir_collection_required = TRUE ; } if ( ( * io_err ) -> iv_actions . reset_required ) { ( * io_err ) -> iv_severity = ERRL_SEV_UNRECOVERABLE ; if ( ! ( * io_err ) -> iv_numCallouts ) { addCalloutToErrl ( * io_err , ERRL_CALLOUT_TYPE_COMPONENT_ID , ERRL_COMPONENT_ID_FIRMWARE , ERRL_CALLOUT_PRIORITY_HIGH ) ; } } if ( ( * io_err ) -> iv_numCallouts < ERRL_MAX_CALLOUTS ) { memset ( & ( * io_err ) -> iv_callouts [ ( * io_err ) -> iv_numCallouts ] , 0 , sizeof ( ErrlCallout_t ) ) ; } ( * io_err ) -> iv_numCallouts = ERRL_MAX_CALLOUTS ; ( * io_err ) -> iv_userDetails . iv_committed = 1 ; uint32_t l_cnt = 2 ; uint32_t l_sum = 0 ; uint32_t l_size = ( * io_err ) -> iv_userDetails . iv_entrySize ; uint8_t * l_p = ( uint8_t * ) * io_err ; for ( ; l_cnt < l_size ; l_cnt ++ ) { l_sum += * ( l_p + l_cnt ) ; } ( * io_err ) -> iv_checkSum = l_sum ; dcache_flush ( * io_err , MAX_ERRL_ENTRY_SZ ) ; reportErrorLog ( * io_err , l_size ) ; } * io_err = ( errlHndl_t ) NULL ; } }
Function Specification
Name:  commitErrl
Function Specification Name : commitErrl
// check if handle is valid and is NOT empty // Check if there is a system checkstop //Go to the reset state to minimize errors //clear out all other actions and set the safe mode req'd action //set severity to informational //set callouts to 0 // Suspend all error log commits // Motivate FIR data collection // if reset action bit is set force severity to unrecoverable and // make sure there is at least one callout // mark the last callout by zeroing out the next one // number of callouts must be the max value as defined by the TMGT-OCC spec. // save off committed // calculate checksum & save it off // starting point is after checksum field // Flush error log out to SRAM since the FSP will directly read it // report error to FSP