Ejemplo n.º 1
0
void ohoi_get_sel_updatetime(ipmi_mcid_t mc_id, SaHpiTimeT *time)
{
        int rv;

        rv = ipmi_mc_pointer_cb(mc_id, get_sel_update_timestamp, time);
        if (rv)
                dbg("Unable to convert domain id to a pointer");
}
Ejemplo n.º 2
0
void ohoi_get_sel_support_del(ipmi_mcid_t mc_id, char *support_del)
{
	int rv;	

	rv = ipmi_mc_pointer_cb(mc_id, get_sel_support_del, support_del); 
	if (rv<0)
		dbg("Unable to convert domain id to a pointer");
}
Ejemplo n.º 3
0
void ohoi_get_sel_size(ipmi_mcid_t mc_id, int *size)
{
	int rv;	

	*size = -1;
	rv = ipmi_mc_pointer_cb(mc_id, get_sel_size, size);
	if (rv<0)
		dbg("Unable to convert MC id to a pointer");
}
Ejemplo n.º 4
0
/**
 * ohoi_get_sel_count: Get IPMI number of SEL entries
 * @mc_id: management controller id used for OpenIPMI callback
 * @count: number of entries returned
 *
 * This function is called by ipmi.c
 * This function registers a callback with OpenIPMI's
 * ipmi_mc_pointer_cb, get's the MC associated with the ID
 * and calls our function back with the MC and fills in 
 * the number of SEL entries returned to caller.
 * 
 **/
void ohoi_get_sel_count(ipmi_mcid_t mc_id, int *count)
{
	int rv;	

	*count = -1;
	rv = ipmi_mc_pointer_cb(mc_id, get_sel_count, count);
	if (rv<0)
		dbg("Unable to convert MC id to a pointer");
}
Ejemplo n.º 5
0
void ohoi_get_sel_last_entry(ipmi_mcid_t mc_id, ipmi_event_t **event)
{
		int rv;

		rv = ipmi_mc_pointer_cb(mc_id, get_sel_last_entry, event);

		if (rv)
				dbg("Unable to convert mcid to pointer");
}
Ejemplo n.º 6
0
void ohoi_get_sel_overflow(ipmi_mcid_t mc_id, char *overflow)
{
	int rv;	

	rv = ipmi_mc_pointer_cb(mc_id, get_sel_overflow, overflow); 
	if (rv<0)
		dbg("Unable to convert domain id to a pointer");
	
}
Ejemplo n.º 7
0
void ohoi_get_sel_by_recid(ipmi_mcid_t mc_id, SaHpiEventLogEntryIdT entry_id, ipmi_event_t **event)
{
		int rv;
        struct ohoi_get_event_by_recid_cb_data data;
        
		data.record_id  = entry_id;
        data.event      = NULL;

		rv = ipmi_mc_pointer_cb(mc_id, get_sel_by_recid, &data);
		if(rv) {
				dbg("failed to convert mc_id to pointer");
				*event = NULL;
				return;
        }

        *event = data.event;
}
Ejemplo n.º 8
0
SaErrorT ohoi_set_reset_state(void *hnd, SaHpiResourceIdT id, 
		              SaHpiResetActionT act)
{
	struct oh_handler_state *handler = (struct oh_handler_state *)hnd;
	struct ohoi_handler *ipmi_handler = (struct ohoi_handler *)handler->data;
	struct ohoi_reset_info info;	
        struct ohoi_resource_info *ohoi_res_info;
        
	int rv;
        
	info.done = 0;
	info.err = 0;
	if ((act == SAHPI_COLD_RESET) || (act == SAHPI_WARM_RESET)) {
	      	dbg("ResetAction requested: %d", act);
	      	info.state = &act;
	} else {
	      	dbg("Currently we only support cold and warm reset");
		return SA_ERR_HPI_INVALID_CMD;
	}

        ohoi_res_info = oh_get_resource_data(handler->rptcache, id);
        if (ohoi_res_info->type == OHOI_RESOURCE_ENTITY) {
                rv = ipmi_control_pointer_cb(ohoi_res_info->reset_ctrl, 
                                     set_resource_reset_state, &info);
	} else {
		rv = ipmi_mc_pointer_cb(ohoi_res_info->u.mc_id, 
			set_mc_reset_state, &info);
	}

        if (rv) {
                dbg("Not support reset in the entity or mc");
                return SA_ERR_HPI_CAPABILITY;
        }

	/* wait until reset_done is called to exit this function */
	rv = ohoi_loop(&info.done, ipmi_handler);
	if ((rv == SA_OK) && (info.err == 0)) {
		return SA_OK;
	} else if (info.err) {
		return info.err;
	} else {
		return rv;
	}
}
Ejemplo n.º 9
0
int
ipmi_event_delete(ipmi_event_t   *event,
		  ipmi_domain_cb done_handler,
		  void           *cb_data)
{
    int              rv;
    del_event_info_t info;
    ipmi_mcid_t      mcid = ipmi_event_get_mcid(event);

    info.event = event;
    info.done_handler = done_handler;
    info.cb_data = cb_data;
    info.rv = 0;
    rv = ipmi_mc_pointer_cb(mcid, del_event_handler, &info);
    if (!rv)
	rv = info.rv;

    return rv;
}
Ejemplo n.º 10
0
void ohoi_get_sel_next_recid(ipmi_mcid_t mc_id, 
                             ipmi_event_t *event,
                             unsigned int *record_id)
{
        int rv;
        ipmi_event_t *te;

        te = event;

        rv = ipmi_mc_pointer_cb(mc_id, get_sel_next_entry, &te);
        if (rv) {
		dbg("unable to convert mcid to pointer");
                *record_id = SAHPI_NO_MORE_ENTRIES;
                return;
        }

        if (te)
                *record_id = ipmi_event_get_record_id(te);
        else
                *record_id = SAHPI_NO_MORE_ENTRIES;
}
Ejemplo n.º 11
0
void ohoi_get_sel_time(ipmi_mcid_t mc_id, SaHpiTimeT *time, void *cb_data)
{
		struct ohoi_handler *ipmi_handler = cb_data;
		
		struct get_sel_time_cb_data data;
		int rv;	

		memset(&data, 0, sizeof(data));
		
		rv = ipmi_mc_pointer_cb(mc_id, get_sel_time, &data); 
		if (rv) {
				dbg("Unable to convert domain id to a pointer");
				return;
		}

        rv = ohoi_loop(&data.flag, ipmi_handler);
        if (rv)
                dbg("Unable to get sel time: Timeout!");
        
        *time = (SaHpiTimeT)data.time*1000000000;
}
Ejemplo n.º 12
0
static void
solparm_info(ipmi_solparm_t *solparm, void *cb_data)
{
    ipmi_cmd_info_t *cmd_info = cb_data;
    int             rv;
    char            solparm_name[IPMI_SOLPARM_NAME_LEN];

    ipmi_solparm_get_name(solparm, solparm_name, sizeof(solparm_name));

    ipmi_cmdlang_out(cmd_info, "SOLPARM", NULL);
    ipmi_cmdlang_down(cmd_info);
    ipmi_cmdlang_out(cmd_info, "Name", solparm_name);
    rv = ipmi_mc_pointer_cb(ipmi_solparm_get_mc_id(solparm), get_mc_name,
			    cmd_info);
    if (rv) {
	ipmi_cmdlang_out_int(cmd_info, "Error getting MC", rv);
    }
    ipmi_cmdlang_out_int(cmd_info, "Channel",
			 ipmi_solparm_get_channel(solparm));
    ipmi_cmdlang_up(cmd_info);
}
Ejemplo n.º 13
0
SaErrorT ohoi_clear_sel(ipmi_mcid_t mc_id, void *cb_data)
{
        char support_del = 0;
        int rv;

	struct ohoi_handler *ipmi_handler = cb_data;
        
        ohoi_get_sel_support_del(mc_id, &support_del);
        if (!support_del) {
                dbg("MC SEL doesn't support del");
                return SA_ERR_HPI_INVALID_CMD;
        }

        rv = ipmi_mc_pointer_cb(mc_id, clear_sel, ipmi_handler);
        if (rv) {
                dbg("Unable to convert mcid to pointer: %d", rv);
		return SA_ERR_HPI_INVALID_CMD;
        }
        
        return SA_OK;
}
Ejemplo n.º 14
0
void ohoi_set_sel_time(ipmi_mcid_t mc_id, const struct timeval *time, void *cb_data)
{
		struct ohoi_handler *ipmi_handler = cb_data;
		
		struct set_sel_time_cb_data data;
		int rv;
	
        data.flag = 0;
        data.time = *time;
		
		rv = ipmi_mc_pointer_cb(mc_id, set_sel_time, &data); 
        if (rv) {
				dbg("Unable to convert MC id to a pointer");
                return;
        }
                
        rv = ohoi_loop(&data.flag, ipmi_handler);
        if (rv) 
                dbg("Unable to set SEL time: Timeout!");
        
	return;
}
Ejemplo n.º 15
0
static void
rescan_pet(void *cb_data, os_hnd_timer_id_t *id)
{
    pet_timer_t    *timer_info = cb_data;
    ipmi_pet_t     *pet;
    int            rv;
    struct timeval timeout;

    ipmi_lock(timer_info->lock);
    if (timer_info->cancelled) {
	ipmi_unlock(timer_info->lock);
	timer_info->os_hnd->free_timer(timer_info->os_hnd, id);
	ipmi_destroy_lock(timer_info->lock);
	ipmi_mem_free(timer_info);
	return;
    }
    pet = timer_info->pet;
    pet->timer_info->running = 0;
    pet_get(pet);

    timer_info->err = 0;
    rv = ipmi_mc_pointer_cb(pet->mc, rescan_pet_mc, timer_info);
    if (!rv)
	rv = timer_info->err;

    if (rv) {
	os_handler_t *os_hnd = timer_info->os_hnd;
	/* Got an error, just restart the timer */
	timeout.tv_sec = PET_TIMEOUT_SEC;
	timeout.tv_usec = 0;
	os_hnd->start_timer(os_hnd, pet->timer, &timeout, rescan_pet,
			    pet->timer_info);
	pet->timer_info->running = 1;
    }

    ipmi_unlock(timer_info->lock);
}