Пример #1
0
// Initialize the memory task data
void memory_init()
{
    if(G_mem_monitoring_allowed)
    {
        // Check if memory task is running (default task is for NIMBUS)
        const task_id_t mem_task = TASK_ID_DIMM_SM;
        if(!rtl_task_is_runnable(mem_task))
        {
            if (MEM_TYPE_NIMBUS ==  G_sysConfigData.mem_type)
            {
                // Init DIMM state manager IPC request
                memory_nimbus_init();
            }
            else
            {
                // TODO CUMULUS NOT SUPPORTED YET IN PHASE1
#if 0
                TRAC_INFO("memory_init: calling centaur_init()");
                centaur_init(); //no rc, handles errors internally
#endif
                TRAC_ERR("memory_init: invalid memory type 0x%02X", G_sysConfigData.mem_type);
                /*
                 * @errortype
                 * @moduleid    DIMM_MID_MEMORY_INIT
                 * @reasoncode  MEMORY_INIT_FAILED
                 * @userdata1   memory type
                 * @userdata2   0
                 * @devdesc     Invalid memory type detected
                 */
                errlHndl_t err = createErrl(DIMM_MID_MEMORY_INIT,
                                            MEMORY_INIT_FAILED,
                                            OCC_NO_EXTENDED_RC,
                                            ERRL_SEV_PREDICTIVE,
                                            NULL,
                                            DEFAULT_TRACE_SIZE,
                                            G_sysConfigData.mem_type,
                                            0);
                REQUEST_RESET(err);
            }

            // check if the init resulted in a reset
            if(isSafeStateRequested())
            {
                TRAC_ERR("memory_init: OCC is being reset, memory init failed (type=0x%02X)",
                         G_sysConfigData.mem_type);
            }
            else
            {
                // Initialization was successful.  Set task flags to allow memory
                // tasks to run and also prevent from doing initialization again.
                G_task_table[mem_task].flags = MEMORY_DATA_RTL_FLAGS;
                //G_task_table[TASK_ID_CENTAUR_CONTROL].flags = MEMORY_CONTROL_RTL_FLAGS;
            }
        }
    }

} // end memory_init()
Пример #2
0
// Function Specification
//
// Name:  cmdh_mnfg_mem_slew
//
// Description: This function handles the manufacturing command to start
// or stop memory autoslewing.
//
// End Function Specification
uint8_t cmdh_mnfg_mem_slew(const cmdh_fsp_cmd_t * i_cmd_ptr,
                                 cmdh_fsp_rsp_t * o_rsp_ptr)
{
    uint8_t                l_rc = ERRL_RC_SUCCESS;
    mnfg_mem_slew_cmd_t    *l_cmd_ptr = (mnfg_mem_slew_cmd_t*) i_cmd_ptr;
    mnfg_mem_slew_rsp_t    *l_rsp_ptr = (mnfg_mem_slew_rsp_t*) o_rsp_ptr;

    do
    {

        // Do some basic input verification
        if (l_cmd_ptr->action > MNFG_INTF_SLEW_STOP)
        {
            // Invalid values were passed by the user!
            TRAC_ERR("cmdh_mnfg_mem_slew: Invalid value was detected! action[0x%02x]",
                     l_cmd_ptr->action);
            l_rc = ERRL_RC_INVALID_DATA;
            break;
        }

        // Are we stopping the auto-slew function?
        if (l_cmd_ptr->action == MNFG_INTF_SLEW_STOP)
        {
            // Send a signal to RTL to stop auto-slewing
            g_amec->mnfg_parms.mem_autoslew = FALSE;

            // Collect the slew count
            if(g_amec->mnfg_parms.mem_slew_counter > 0x0000FFFF)
            {
                l_rsp_ptr->slew_count = 0xFFFF;
            }
            else
            {
                l_rsp_ptr->slew_count = g_amec->mnfg_parms.mem_slew_counter;
            }

            // Zero out the slew count;
            g_amec->mnfg_parms.mem_slew_counter = 0;

            TRAC_INFO("cmdh_mnfg_mem_slew: Auto-slewing has been stopped. Count[%u]",
                      l_rsp_ptr->slew_count);

            // We are done
            break;
        }

        // If we made it here, that means we are starting up a slew run
        TRAC_INFO("cmdh_mnfg_mem_slew: We are about to start auto-slewing function");

        // If the OCC is active (we can only run auto-slew in active state) the memory control
        // task must be running and there is no support (or need) to force activation of
        // memory monitoring and control

        if(!IS_OCC_STATE_ACTIVE())
        {
            TRAC_ERR("cmdh_mnfg_mem_slew: OCC must be active to start mem slewing");
            l_rc = ERRL_RC_INVALID_STATE;
            break;
        }
        if(!rtl_task_is_runnable(TASK_ID_MEMORY_CONTROL))
        {
            TRAC_ERR("cmdh_mnfg_mem_slew: memory control task not running");
            l_rc = ERRL_RC_INTERNAL_FAIL;
            break;
        }

        // Zero out the slew count
        g_amec->mnfg_parms.mem_slew_counter = 0;

        // Send a signal to RTL to start memory auto-slewing
        g_amec->mnfg_parms.mem_autoslew = TRUE;

        // We are auto-slewing now, populate the response packet
        l_rsp_ptr->slew_count = 0;

        TRAC_INFO("cmdh_mnfg_mem_slew: memory slewing started.");

    }while(0);

    // Populate the response data packet
    G_rsp_status = l_rc;
    l_rsp_ptr->data_length[0] = 0;
    l_rsp_ptr->data_length[1] = MNFG_INTF_MEM_SLEW_RSP_SIZE;

    return l_rc;
}