src/occ_405/cmdh/cmdh_thread.c
// Function Specification
//
// Name: Cmd_Hndl_thread_routine
//
// Description: This needs to be moved to separate file after we add cmd handler
//              thread support
//
// End Function Specification
Function Specification
Name: Cmd_Hndl_thread_routine

This needs to be moved to separate file after we add cmd handler
thread support

End Function Specification
Function Specification Name : Cmd_Hndl_thread_routine This needs to be moved to separate file after we add cmd handler thread support End Function Specification
void Cmd_Hndl_thread_routine(void *arg)
{
#define OCC_RESP_READY_ALERT_TIMEOUT_ATTEMPTS 5
    int l_rc = 0;
    errlHndl_t l_errlHndl = NULL;
    CHECKPOINT(CMDH_THREAD_STARTED);
    CMDH_TRAC_INFO("Command Handler Thread Started ... " );
    cmdh_comm_init();
    CHECKPOINT(COMM_INIT_COMPLETED);
    const uint32_t l_data = in32(OCB_OCBSHCS1);
    CMDH_TRAC_INFO("Cmd_Hndl_thread_routine: OCB_OCBSHCS1=0x%08X", l_data);
    G_fsp_msg.rsp->fields.data[3] = (l_data >> 24);
    G_fsp_msg.rsp->fields.data[4] = (l_data >> 16) & 0xFF;
    G_fsp_msg.rsp->fields.data[5] = (l_data >>  8) & 0xFF;
    G_fsp_msg.rsp->fields.data[6] = (l_data      ) & 0xFF;
    G_fsp_msg.rsp->fields.data[7] = 0x11;
    G_fsp_msg.rsp->fields.data_length[1] = 8; 
    dcache_flush_line((void *)CMDH_OCC_RESPONSE_BASE_ADDRESS);
    while(1)
    {
        l_rc = cmdh_thread_wait_for_wakeup(); 
        if(SSX_OK == l_rc)
        {
             that TMGT just sent to OCC
            if( CMDH_WAKEUP_FSP_COMMAND & G_cmdh_thread_wakeup_mask )
            {
                clearCmdhWakeupCondition(CMDH_WAKEUP_FSP_COMMAND);
                l_errlHndl = cmdh_fsp_cmd_hndler();
                if(NULL != l_errlHndl)
                {
                    commitErrl(&l_errlHndl);
                }
            }
        }
    }
}
void Cmd_Hndl_thread_routine ( void * arg ) { #define OCC_RESP_READY_ALERT_TIMEOUT_ATTEMPTS  5 int l_rc = 0 ; errlHndl_t l_errlHndl = NULL ; CHECKPOINT ( CMDH_THREAD_STARTED ) ; CMDH_TRAC_INFO ( " " ) ; cmdh_comm_init ( ) ; CHECKPOINT ( COMM_INIT_COMPLETED ) ; const uint32_t l_data = in32 ( OCB_OCBSHCS1 ) ; CMDH_TRAC_INFO ( " " , l_data ) ; G_fsp_msg . rsp -> fields . data [ 3 ] = ( l_data >> 24 ) ; G_fsp_msg . rsp -> fields . data [ 4 ] = ( l_data >> 16 ) & 0xFF ; G_fsp_msg . rsp -> fields . data [ 5 ] = ( l_data >> 8 ) & 0xFF ; G_fsp_msg . rsp -> fields . data [ 6 ] = ( l_data ) & 0xFF ; G_fsp_msg . rsp -> fields . data [ 7 ] = 0x11 ; G_fsp_msg . rsp -> fields . data_length [ 1 ] = 8 ; dcache_flush_line ( ( void * ) CMDH_OCC_RESPONSE_BASE_ADDRESS ) ; while ( 1 ) { l_rc = cmdh_thread_wait_for_wakeup ( ) ; if ( SSX_OK == l_rc ) { if ( CMDH_WAKEUP_FSP_COMMAND & G_cmdh_thread_wakeup_mask ) { clearCmdhWakeupCondition ( CMDH_WAKEUP_FSP_COMMAND ) ; l_errlHndl = cmdh_fsp_cmd_hndler ( ) ; if ( NULL != l_errlHndl ) { commitErrl ( & l_errlHndl ) ; } } } } }
Function Specification
Name: Cmd_Hndl_thread_routine
Function Specification Name : Cmd_Hndl_thread_routine
// ------------------------------------------------ // Initialize HW for FSP Comm // ------------------------------------------------ // Read/trace push queue register // write data after checkpoint and update checkpoint length // 8 bytes vs 3 // ------------------------------------------------ // Loop forever, handling FSP commands // ------------------------------------------------ // ------------------------------------------------ // Block, Waiting on sem for a doorbell from FSP // ------------------------------------------------ // Blocking Call // ------------------------------------------------ // Handle the command // ------------------------------------------------ // Handle the command that TMGT just sent to OCC // Commit an error if we get one passed back, do it before // we tell the FSP we have a response ready