Exemplo n.º 1
0
int
netfn_chassis_main(struct dummy_rq *req, struct dummy_rs *rsp)
{
	int rc = 0;
	rsp->msg.netfn = req->msg.netfn + 1;
	rsp->msg.cmd = req->msg.cmd;
	rsp->msg.lun = req->msg.lun;
	rsp->ccode = CC_OK;
	rsp->data_len = 0;
	rsp->data = NULL;
	switch (req->msg.cmd) {
	case CHASSIS_CONTROL:
		rc = chassis_control(req, rsp);
		break;
	case CHASSIS_GET_CAPA:
		rc = chassis_get_capa(req, rsp);
		break;
	case CHASSIS_GET_POH_COUNTER:
		rc = chassis_get_poh_counter(req, rsp);
		break;
	case CHASSIS_GET_STATUS:
		rc = chassis_get_status(req, rsp);
		break;
	case CHASSIS_GET_SYSBOOT_OPTS:
		rc = chassis_get_sysboot_opts(req, rsp);
		break;
	case CHASSIS_GET_SYSRES_CAUSE:
		rc = chassis_get_sysres_cause(req, rsp);
		break;
	case CHASSIS_IDENTIFY:
		rc = chassis_identify(req, rsp);
		break;
	case CHASSIS_RESET:
		rc = chassis_reset(req, rsp);
		break;
	case CHASSIS_SET_CAPA:
		rc = chassis_set_capa(req, rsp);
		break;
	case CHASSIS_SET_FP_BUTTONS:
		rc = chassis_set_fp_buttons(req, rsp);
		break;
	case CHASSIS_SET_PWR_CYCLE_INT:
		rc = chassis_set_pwr_cycle_int(req, rsp);
		break;
	case CHASSIS_SET_PWR_RESTORE_POL:
		rc = chassis_set_pwr_restore_pol(req, rsp);
		break;
	case CHASSIS_SET_SYSBOOT_OPTS:
		rc = chassis_set_sysboot_opts(req, rsp);
		break;
	default:
		rsp->ccode = CC_CMD_INV;
		rc = (-1);
	}
	return rc;
}
Exemplo n.º 2
0
// Handle Chassis Commands (IPMI/Section 28)
static void
ipmi_handle_chassis (unsigned char *request, unsigned char req_len,
		     unsigned char *response, unsigned char *res_len)
{
  ipmi_mn_req_t *req = (ipmi_mn_req_t *) request;
  ipmi_res_t *res = (ipmi_res_t *) response;
  unsigned char cmd = req->cmd;

  pthread_mutex_lock(&m_chassis);
  switch (cmd)
  {
    case CMD_CHASSIS_GET_STATUS:
      chassis_get_status (response, res_len);
      break;
    case CMD_CHASSIS_GET_BOOT_OPTIONS:
      chassis_get_boot_options (request, response, res_len);
      break;
    default:
      res->cc = CC_INVALID_CMD;
      break;
  }
  pthread_mutex_unlock(&m_chassis);
}