예제 #1
0
ipmi_ret_t ipmi_storage_add_sel(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
                              ipmi_request_t request, ipmi_response_t response,
                              ipmi_data_len_t data_len, ipmi_context_t context)
{

    ipmi_ret_t rc = IPMI_CC_OK;
    ipmi_add_sel_request_t *p = (ipmi_add_sel_request_t*) request;
    uint16_t recordid;

    recordid = ((uint16_t)p->eventdata[1] << 8) | p->eventdata[2];

    printf("IPMI Handling ADD-SEL for record 0x%04x\n", recordid);

    *data_len = sizeof(g_sel_reserve);

    // Pack the actual response
    memcpy(response, &p->eventdata[1], 2);

    // TODO This code should grab the completed partial esel located in
    // the /tmp/esel0100 file and commit it to the error log handler.
    send_esel(recordid);

    return rc;
}
예제 #2
0
파일: ipmisel.C 프로젝트: AmesianX/hostboot
/*
 * @brief process esel msg
 */
void process_esel(msg_t *i_msg)
{
    errlHndl_t l_err = NULL;
    IPMI::completion_code l_cc = IPMI::CC_UNKBAD;
    const uint32_t l_eid = i_msg->data[0];
    eselInitData * l_data =
            (eselInitData*)(i_msg->extra_data);
    IPMI_TRAC(ENTER_MRK "process_esel");

    uint32_t l_send_count = MAX_SEND_COUNT;
    while (l_send_count > 0)
    {
        // try to send the eles to the bmc
        send_esel(l_data, l_err, l_cc);

        // if no error but last completion code was:
        if ((l_err == NULL) &&
            ((l_cc == IPMI::CC_BADRESV) ||  // lost reservation
             (l_cc == IPMI::CC_TIMEOUT)))   // timeout
        {
            // update our count and pause
            l_send_count--;
            if (l_send_count)
            {
                IPMI_TRAC("process_esel: sleeping; retry_count %d",
                    l_send_count);
                // sleep 3 times - 2ms, 32ms, 512ms. if we can't get this
                //  through by then, the system must really be busy...
                nanosleep(0,
                    SLEEP_BASE << (4 * (MAX_SEND_COUNT - l_send_count - 1)));
                continue;
            }
        }

        // else it did get sent down OR it didn't because of a bad error
        break;

    } // while

    if(l_err)
    {
#ifdef __HOSTBOOT_RUNTIME
        // HBRT can't commit an error, since this could already be in the
        // errlCommit path since HBRT is single threaded
        IPMI_TRAC(ERR_MRK "DELETING l_err 0x%.8X", l_err->eid());
        delete l_err;
        l_err = NULL;
#else
        l_err->collectTrace(IPMI_COMP_NAME);
        errlCommit(l_err, IPMI_COMP_ID);
#endif
    }
    else if((l_cc == IPMI::CC_OK) &&        // no error
            (l_eid != 0))                   // and it's an errorlog
    {
        // eSEL successfully sent to the BMC - have errlmanager do the ack
        IPMI_TRAC(INFO_MRK "Doing ack for eid 0x%.8X", l_eid);
        ERRORLOG::ErrlManager::errlAckErrorlog(l_eid);
    }

    delete l_data;

    IPMI_TRAC(EXIT_MRK "process_esel");
    return;
} // process_esel