src/occ_405/proc/proc_pstate.c
// Function Specification
//
// Name:  populate_opal_tbl_to_mem
//
// Description: use the upload copy engine to copy OPAL
//              OPAL table's static/dynamic entries to main memory.
//
// End Function Specification
Function Specification
Name:  populate_opal_tbl_to_mem

use the upload copy engine to copy OPAL
OPAL table's static/dynamic entries to main memory.

End Function Specification
Function Specification Name : populate_opal_tbl_to_mem use the upload copy engine to copy OPAL OPAL table ' s static / dynamic entries to main memory . End Function Specification
void populate_opal_tbl_to_mem(opalDataType opal_data_type)
{
    int l_ssxrc = SSX_OK;
    uint32_t l_reasonCode = 0;
    uint32_t l_extReasonCode = 0;
    if(opal_data_type == OPAL_STATIC)
    {
        l_ssxrc = bce_request_create(&G_opal_static_bce_req,                
                                     &G_pba_bcue_queue,                     
                                     OPAL_STATIC_ADDRESS_HOMER,             
                                     (uint32_t) &G_opal_static_table,       
                                     (size_t) sizeof(G_opal_static_table),  
                                     SSX_SECONDS(2),                        
                                     NULL,                                  
                                     NULL,                                  
                                     ASYNC_REQUEST_BLOCKING);
    }
    else if(opal_data_type == OPAL_DYNAMIC)
    {
        l_ssxrc = bce_request_create(&G_opal_dynamic_bce_req,               
                                     &G_pba_bcue_queue,                     
                                     OPAL_DYNAMIC_ADDRESS_HOMER,            
                                     (uint32_t) &G_opal_dynamic_table,      
                                     (size_t) sizeof(G_opal_dynamic_table), 
                                     SSX_WAIT_FOREVER,                      
              (AsyncRequestCallback) opal_table_bce_callback,               
                                     NULL,                                  
                                     ASYNC_CALLBACK_IMMEDIATE);
    }
    else
    {
        TRAC_ERR("populate_opal_tbl_to_mem: Invalid OPAL Table data type");
        return;
    }
    do
    {
        if(l_ssxrc != SSX_OK)
        {
            TRAC_ERR("populate_opal_tbl_to_mem: PBA request create failure rc=[%08X]",
                     -l_ssxrc);
            l_reasonCode = OPAL_TABLE_UPDATE_ERROR;
            l_extReasonCode = ERC_BCE_REQUEST_CREATE_FAILURE;
            break;
        }
        if(opal_data_type == OPAL_STATIC)
        {
            l_ssxrc = bce_request_schedule(&G_opal_static_bce_req);
        }
        else
        {
            l_ssxrc = bce_request_schedule(&G_opal_dynamic_bce_req);
        }
        if(l_ssxrc != SSX_OK)
        {
            TRAC_ERR("populate_opal_tbl_to_mem: PBA request schedule failure rc=[%08X]",
                     -l_ssxrc);
            l_reasonCode = OPAL_TABLE_UPDATE_ERROR;
            l_extReasonCode = ERC_BCE_REQUEST_SCHEDULE_FAILURE;
            break;
        }
    } while(0);
    if ( l_ssxrc != SSX_OK )
    {
        if( (opal_data_type == OPAL_DYNAMIC) &&
            (G_opal_table_update_state == OPAL_TABLE_UPDATE_DYNAMIC_COPY) )
        {
            G_opal_table_update_state = OPAL_TABLE_UPDATE_IDLE;
        }
        if(G_sysConfigData.system_type.kvm)
        {
            errlHndl_t l_errl = createErrl(PROC_POP_OPAL_TBL_TO_MEM_MOD,  
                                           l_reasonCode,                  
                                           l_extReasonCode,               
                                           ERRL_SEV_UNRECOVERABLE,        
                                           NULL,                          
                                           0,                             
                                           -l_ssxrc,                      
                                           0);                            
            addCalloutToErrl(l_errl,
                             ERRL_CALLOUT_TYPE_COMPONENT_ID,
                             ERRL_COMPONENT_ID_FIRMWARE,
                             ERRL_CALLOUT_PRIORITY_HIGH);
            addCalloutToErrl(l_errl,
                             ERRL_CALLOUT_TYPE_HUID,
                             G_sysConfigData.proc_huid,
                             ERRL_CALLOUT_PRIORITY_MED);
            commitErrl(&l_errl);
        }
    }
    else if(opal_data_type == OPAL_DYNAMIC)
    {
        G_opal_dynamic_bce_req_scheduled = true;
    }
}
void populate_opal_tbl_to_mem ( opalDataType opal_data_type ) { int l_ssxrc = SSX_OK ; uint32_t l_reasonCode = 0 ; uint32_t l_extReasonCode = 0 ; if ( opal_data_type == OPAL_STATIC ) { l_ssxrc = bce_request_create ( & G_opal_static_bce_req , & G_pba_bcue_queue , OPAL_STATIC_ADDRESS_HOMER , ( uint32_t ) & G_opal_static_table , ( size_t ) sizeof ( G_opal_static_table ) , SSX_SECONDS ( 2 ) , NULL , NULL , ASYNC_REQUEST_BLOCKING ) ; } else if ( opal_data_type == OPAL_DYNAMIC ) { l_ssxrc = bce_request_create ( & G_opal_dynamic_bce_req , & G_pba_bcue_queue , OPAL_DYNAMIC_ADDRESS_HOMER , ( uint32_t ) & G_opal_dynamic_table , ( size_t ) sizeof ( G_opal_dynamic_table ) , SSX_WAIT_FOREVER , ( AsyncRequestCallback ) opal_table_bce_callback , NULL , ASYNC_CALLBACK_IMMEDIATE ) ; } else { TRAC_ERR ( " " ) ; return ; } do { if ( l_ssxrc != SSX_OK ) { TRAC_ERR ( " " , - l_ssxrc ) ; l_reasonCode = OPAL_TABLE_UPDATE_ERROR ; l_extReasonCode = ERC_BCE_REQUEST_CREATE_FAILURE ; break ; } if ( opal_data_type == OPAL_STATIC ) { l_ssxrc = bce_request_schedule ( & G_opal_static_bce_req ) ; } else { l_ssxrc = bce_request_schedule ( & G_opal_dynamic_bce_req ) ; } if ( l_ssxrc != SSX_OK ) { TRAC_ERR ( " " , - l_ssxrc ) ; l_reasonCode = OPAL_TABLE_UPDATE_ERROR ; l_extReasonCode = ERC_BCE_REQUEST_SCHEDULE_FAILURE ; break ; } } while ( 0 ) ; if ( l_ssxrc != SSX_OK ) { if ( ( opal_data_type == OPAL_DYNAMIC ) && ( G_opal_table_update_state == OPAL_TABLE_UPDATE_DYNAMIC_COPY ) ) { G_opal_table_update_state = OPAL_TABLE_UPDATE_IDLE ; } if ( G_sysConfigData . system_type . kvm ) { errlHndl_t l_errl = createErrl ( PROC_POP_OPAL_TBL_TO_MEM_MOD , l_reasonCode , l_extReasonCode , ERRL_SEV_UNRECOVERABLE , NULL , 0 , - l_ssxrc , 0 ) ; addCalloutToErrl ( l_errl , ERRL_CALLOUT_TYPE_COMPONENT_ID , ERRL_COMPONENT_ID_FIRMWARE , ERRL_CALLOUT_PRIORITY_HIGH ) ; addCalloutToErrl ( l_errl , ERRL_CALLOUT_TYPE_HUID , G_sysConfigData . proc_huid , ERRL_CALLOUT_PRIORITY_MED ) ; commitErrl ( & l_errl ) ; } } else if ( opal_data_type == OPAL_DYNAMIC ) { G_opal_dynamic_bce_req_scheduled = true ; } }
Function Specification
Name:  populate_opal_tbl_to_mem
Function Specification Name : populate_opal_tbl_to_mem
// Set up copy request for type of data being updated.  NOTE:  only DYNAMIC uses the callback // static is only updated when going active and should be blocking to make sure // this complets before reporting back that the state change finished // block copy object // sram to mainstore copy engine // mainstore address // sram starting address // size of copy // timeout // no call back // call back arguments // dynamic data can be updated while active and should NOT be blocking // block copy object // sram to mainstore copy engine // mainstore address // sram starting address // size of copy // no timeout // call back // call back arguments /*
             * @errortype
             * @moduleid    PROC_POP_OPAL_TBL_TO_MEM_MOD
             * @reasoncode  OPAL_TABLE_UPDATE_ERROR
             * @userdata1   RC for PBA block-copy engine
             * @userdata4   ERC_BCE_REQUEST_CREATE_FAILURE
             * @devdesc     Failed to create BCUE request
             */ // Do actual copying /*
             * @errortype
             * @moduleid    PROC_POP_OPAL_TBL_TO_MEM_MOD
             * @reasoncode  OPAL_TABLE_UPDATE_ERROR
             * @userdata1   RC for PBA block-copy engine
             * @userdata4   ERC_BCE_REQUEST_SCHEDULE_FAILURE
             * @devdesc     Failed to copy OPAL data by using BCUE
             */ // set back to idle since callback won't happen // data in main mem only matters for OPAL so only log error if OPAL //modId //reasoncode //Extended reason code //Severity //Trace Buf //Trace Size //userdata1 //userdata2 // Callout firmware // Callout processor