int ipmi_cmd_warm_reset (ipmi_ctx_t ctx, fiid_obj_t obj_cmd_rs) { fiid_obj_t obj_cmd_rq = NULL; int rv = -1; if (!ctx || ctx->magic != IPMI_CTX_MAGIC) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } if (!fiid_obj_valid (obj_cmd_rs)) { API_SET_ERRNUM (ctx, IPMI_ERR_PARAMETERS); return (-1); } if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rs, tmpl_cmd_warm_reset_rs) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rs); return (-1); } if (!(obj_cmd_rq = fiid_obj_create (tmpl_cmd_warm_reset_rq))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (fill_cmd_warm_reset (obj_cmd_rq) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (api_ipmi_cmd (ctx, IPMI_BMC_IPMB_LUN_BMC, IPMI_NET_FN_APP_RQ, obj_cmd_rq, obj_cmd_rs) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_cmd_rq); return (rv); }
int ipmi_cmd_dcmi_set_power_limit (ipmi_ctx_t ctx, uint8_t exception_actions, uint16_t power_limit_requested, uint32_t correction_time_limit, uint16_t management_application_statistics_sampling_period, fiid_obj_t obj_cmd_rs) { fiid_obj_t obj_cmd_rq = NULL; int rv = -1; if (!ctx || ctx->magic != IPMI_CTX_MAGIC) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } /* remaining parameter checks in fill function */ if (!fiid_obj_valid (obj_cmd_rs)) { API_SET_ERRNUM (ctx, IPMI_ERR_PARAMETERS); return (-1); } if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rs, tmpl_cmd_dcmi_set_power_limit_rs) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rs); return (-1); } if (!(obj_cmd_rq = fiid_obj_create (tmpl_cmd_dcmi_set_power_limit_rq))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (fill_cmd_dcmi_set_power_limit (exception_actions, power_limit_requested, correction_time_limit, management_application_statistics_sampling_period, obj_cmd_rq) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (api_ipmi_cmd (ctx, IPMI_BMC_IPMB_LUN_BMC, IPMI_NET_FN_GROUP_EXTENSION_RQ, obj_cmd_rq, obj_cmd_rs) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_cmd_rq); return (rv); }
int ipmi_cmd_set_serial_modem_configuration (ipmi_ctx_t ctx, uint8_t channel_number, uint8_t parameter_selector, const void *configuration_parameter_data, unsigned int configuration_parameter_data_len, fiid_obj_t obj_cmd_rs) { fiid_obj_t obj_cmd_rq = NULL; int rv = -1; if (!ctx || ctx->magic != IPMI_CTX_MAGIC) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } /* remaining parameter checks in fill function */ if (!fiid_obj_valid (obj_cmd_rs)) { API_SET_ERRNUM (ctx, IPMI_ERR_PARAMETERS); return (-1); } if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rs, tmpl_cmd_set_serial_modem_configuration_rs) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rs); return (-1); } if (!(obj_cmd_rq = fiid_obj_create (tmpl_cmd_set_serial_modem_configuration_rq))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (fill_cmd_set_serial_modem_configuration (channel_number, parameter_selector, configuration_parameter_data, configuration_parameter_data_len, obj_cmd_rq) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (api_ipmi_cmd (ctx, IPMI_BMC_IPMB_LUN_BMC, IPMI_NET_FN_TRANSPORT_RQ, obj_cmd_rq, obj_cmd_rs) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_cmd_rq); return (rv); }
int ipmi_cmd_write_fru_data (ipmi_ctx_t ctx, uint8_t fru_device_id, uint16_t fru_inventory_offset_to_write, const void *data_to_write, unsigned int data_to_write_len, fiid_obj_t obj_cmd_rs) { fiid_obj_t obj_cmd_rq = NULL; int rv = -1; if (!ctx || ctx->magic != IPMI_CTX_MAGIC) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } if (!fiid_obj_valid (obj_cmd_rs)) { API_SET_ERRNUM (ctx, IPMI_ERR_PARAMETERS); return (-1); } if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rs, tmpl_cmd_write_fru_data_rs) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rs); return (-1); } if (!(obj_cmd_rq = fiid_obj_create (tmpl_cmd_write_fru_data_rq))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (fill_cmd_write_fru_data (fru_device_id, fru_inventory_offset_to_write, data_to_write, data_to_write_len, obj_cmd_rq) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (api_ipmi_cmd (ctx, IPMI_BMC_IPMB_LUN_BMC, IPMI_NET_FN_STORAGE_RQ, obj_cmd_rq, obj_cmd_rs) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_cmd_rq); return (rv); }
static int _api_ssif_ipmb_send (ipmi_ctx_t ctx, fiid_obj_t obj_cmd_rq) { struct ipmi_ctx_target target_save; uint8_t buf[IPMI_MAX_PKT_LEN]; fiid_obj_t obj_ipmb_msg_hdr_rq = NULL; fiid_obj_t obj_ipmb_msg_rq = NULL; fiid_obj_t obj_send_cmd_rs = NULL; int len, ret, rv = -1; assert (ctx && ctx->magic == IPMI_CTX_MAGIC && ctx->type == IPMI_DEVICE_SSIF && fiid_obj_valid (obj_cmd_rq) && fiid_obj_packet_valid (obj_cmd_rq) == 1); if (!(obj_ipmb_msg_hdr_rq = fiid_obj_create (tmpl_ipmb_msg_hdr_rq))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (!(obj_ipmb_msg_rq = fiid_obj_create (tmpl_ipmb_msg))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (!(obj_send_cmd_rs = fiid_obj_create (tmpl_cmd_send_message_rs))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (fill_ipmb_msg_hdr (ctx->target.rs_addr, ctx->target.net_fn, ctx->target.lun, IPMI_SLAVE_ADDRESS_BMC, IPMI_BMC_IPMB_LUN_SMS_MSG_LUN, ctx->io.inband.rq_seq, obj_ipmb_msg_hdr_rq) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (assemble_ipmi_ipmb_msg (obj_ipmb_msg_hdr_rq, obj_cmd_rq, obj_ipmb_msg_rq, IPMI_INTERFACE_FLAGS_DEFAULT) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } memset (buf, '\0', IPMI_MAX_PKT_LEN); if ((len = fiid_obj_get_all (obj_ipmb_msg_rq, buf, IPMI_MAX_PKT_LEN)) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_ipmb_msg_rq); goto cleanup; } /* send_message will send to the BMC, so clear out target information */ memcpy (&target_save, &ctx->target, sizeof (target_save)); ctx->target.channel_number_is_set = 0; ctx->target.rs_addr_is_set = 0; ret = ipmi_cmd_send_message (ctx, target_save.channel_number, IPMI_SEND_MESSAGE_AUTHENTICATION_NOT_REQUIRED, IPMI_SEND_MESSAGE_ENCRYPTION_NOT_REQUIRED, IPMI_SEND_MESSAGE_TRACKING_OPERATION_NO_TRACKING, buf, len, obj_send_cmd_rs); /* restore target info */ memcpy (&ctx->target, &target_save, sizeof (target_save)); if (ret < 0) { /* assume these mean can't send message, bad slave address, etc. */ if (ipmi_check_completion_code (obj_send_cmd_rs, IPMI_COMP_CODE_SEND_MESSAGE_LOST_ARBITRATION) == 1 || ipmi_check_completion_code (obj_send_cmd_rs, IPMI_COMP_CODE_SEND_MESSAGE_BUS_ERROR) == 1 || ipmi_check_completion_code (obj_send_cmd_rs, IPMI_COMP_CODE_SEND_MESSAGE_NAK_ON_WRITE) == 1) API_SET_ERRNUM (ctx, IPMI_ERR_MESSAGE_TIMEOUT); else API_BAD_RESPONSE_TO_API_ERRNUM (ctx, obj_send_cmd_rs); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_ipmb_msg_hdr_rq); fiid_obj_destroy (obj_ipmb_msg_rq); fiid_obj_destroy (obj_send_cmd_rs); return (rv); }
int ipmi_cmd_set_serial_modem_configuration_ipmi_messaging_comm_settings (ipmi_ctx_t ctx, uint8_t channel_number, uint8_t dtr_hangup, uint8_t flow_control, uint8_t bit_rate, fiid_obj_t obj_cmd_rs) { fiid_obj_t obj_cmd_rq = NULL; int rv = -1; if (!ctx || ctx->magic != IPMI_CTX_MAGIC) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } /* remaining parameter checks in fill function */ if (!fiid_obj_valid (obj_cmd_rs)) { API_SET_ERRNUM (ctx, IPMI_ERR_PARAMETERS); return (-1); } if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rs, tmpl_cmd_set_serial_modem_configuration_rs) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rs); return (-1); } if (!(obj_cmd_rq = fiid_obj_create (tmpl_cmd_set_serial_modem_configuration_ipmi_messaging_comm_settings_rq))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (fill_cmd_set_serial_modem_configuration_ipmi_messaging_comm_settings (channel_number, dtr_hangup, flow_control, bit_rate, obj_cmd_rq) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (api_ipmi_cmd (ctx, IPMI_BMC_IPMB_LUN_BMC, IPMI_NET_FN_TRANSPORT_RQ, obj_cmd_rq, obj_cmd_rs) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_cmd_rq); return (rv); }
static int _ipmi_cmd_get_system_boot_options_common (ipmi_ctx_t ctx, uint8_t set_selector, uint8_t block_selector, fiid_obj_t obj_cmd_rs, fiid_field_t *tmpl_cmd_rs_expected, uint8_t parameter_selector) { fiid_obj_t obj_cmd_rq = NULL; int rv = -1; assert (tmpl_cmd_rs_expected); if (!ctx || ctx->magic != IPMI_CTX_MAGIC) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } if (!fiid_obj_valid (obj_cmd_rs)) { API_SET_ERRNUM (ctx, IPMI_ERR_PARAMETERS); return (-1); } if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rs, tmpl_cmd_rs_expected) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rs); return (-1); } if (!(obj_cmd_rq = fiid_obj_create (tmpl_cmd_get_system_boot_options_rq))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (fill_cmd_get_system_boot_options (parameter_selector, set_selector, block_selector, obj_cmd_rq) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (api_ipmi_cmd (ctx, IPMI_BMC_IPMB_LUN_BMC, IPMI_NET_FN_CHASSIS_RQ, obj_cmd_rq, obj_cmd_rs) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_cmd_rq); return (rv); }
static int _ssif_cmd_read (ipmi_ctx_t ctx, uint8_t cmd, uint8_t group_extension, fiid_obj_t obj_cmd_rs) { uint8_t *pkt = NULL; unsigned int pkt_len; int hdr_len, cmd_len, read_len; fiid_field_t *tmpl = NULL; int ret, rv = -1; unsigned int intf_flags = IPMI_INTERFACE_FLAGS_DEFAULT; assert (ctx && ctx->magic == IPMI_CTX_MAGIC && fiid_obj_valid (obj_cmd_rs)); if (ctx->flags & IPMI_FLAGS_NO_LEGAL_CHECK) intf_flags |= IPMI_INTERFACE_FLAGS_NO_LEGAL_CHECK; if ((hdr_len = fiid_template_len_bytes (tmpl_hdr_kcs)) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (!(tmpl = fiid_obj_template (obj_cmd_rs))) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rs); goto cleanup; } if ((cmd_len = fiid_template_len_bytes (tmpl)) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } pkt_len = hdr_len + cmd_len; if (!(pkt = malloc (pkt_len))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } memset (pkt, '\0', pkt_len); if ((read_len = ipmi_ssif_read (ctx->io.inband.ssif_ctx, pkt, pkt_len)) < 0) { API_SSIF_ERRNUM_TO_API_ERRNUM (ctx, ipmi_ssif_ctx_errnum (ctx->io.inband.ssif_ctx)); goto cleanup; } if (!read_len) { API_SET_ERRNUM (ctx, IPMI_ERR_SYSTEM_ERROR); goto cleanup; } if (ctx->flags & IPMI_FLAGS_DEBUG_DUMP && read_len) _api_ssif_dump_rs (ctx, pkt, read_len, cmd, ctx->target.net_fn, group_extension, obj_cmd_rs); if ((ret = unassemble_ipmi_kcs_pkt (pkt, read_len, ctx->io.inband.rs.obj_hdr, obj_cmd_rs, intf_flags)) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } /* IPMI didn't return enough data back to you */ if (!ret) { API_SET_ERRNUM (ctx, IPMI_ERR_IPMI_ERROR); goto cleanup; } rv = 0; cleanup: free (pkt); fiid_template_free (tmpl); return (rv); }
int ipmi_cmd_dcmi_set_asset_tag (ipmi_ctx_t ctx, uint8_t offset_to_write, uint8_t number_of_bytes_to_write, const void *data, unsigned int data_len, fiid_obj_t obj_cmd_rs) { fiid_obj_t obj_cmd_rq = NULL; int rv = -1; if (!ctx || ctx->magic != IPMI_CTX_MAGIC) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } /* remaining parameter checks in fill function */ if (!fiid_obj_valid (obj_cmd_rs)) { API_SET_ERRNUM (ctx, IPMI_ERR_PARAMETERS); return (-1); } if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rs, tmpl_cmd_dcmi_set_asset_tag_rs) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rs); return (-1); } if (!(obj_cmd_rq = fiid_obj_create (tmpl_cmd_dcmi_set_asset_tag_rq))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (fill_cmd_dcmi_set_asset_tag (offset_to_write, number_of_bytes_to_write, data, data_len, obj_cmd_rq) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (api_ipmi_cmd (ctx, IPMI_BMC_IPMB_LUN_BMC, IPMI_NET_FN_GROUP_EXTENSION_RQ, obj_cmd_rq, obj_cmd_rs) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_cmd_rq); return (rv); }
int ipmi_cmd_set_system_boot_options_boot_initiator_mailbox (ipmi_ctx_t ctx, uint8_t parameter_valid, uint8_t set_selector, const void *block_data, unsigned int block_data_length, fiid_obj_t obj_cmd_rs) { fiid_obj_t obj_cmd_rq = NULL; int rv = -1; if (!ctx || ctx->magic != IPMI_CTX_MAGIC) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } /* remaining parameter checks in fill function */ if (!fiid_obj_valid (obj_cmd_rs)) { API_SET_ERRNUM (ctx, IPMI_ERR_PARAMETERS); return (-1); } if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rs, tmpl_cmd_set_system_boot_options_rs) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rs); return (-1); } if (!(obj_cmd_rq = fiid_obj_create (tmpl_cmd_set_system_boot_options_boot_initiator_mailbox_rq))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (fill_cmd_set_system_boot_options_boot_initiator_mailbox (parameter_valid, set_selector, block_data, block_data_length, obj_cmd_rq) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (api_ipmi_cmd (ctx, IPMI_BMC_IPMB_LUN_BMC, IPMI_NET_FN_CHASSIS_RQ, obj_cmd_rq, obj_cmd_rs) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_cmd_rq); return (rv); }
int ipmi_cmd_dcmi_set_dcmi_configuration_parameters_discovery_configuration (ipmi_ctx_t ctx, uint8_t set_selector, uint8_t option_12, uint8_t option_60_with_option_43, uint8_t random_back_off, fiid_obj_t obj_cmd_rs) { fiid_obj_t obj_cmd_rq = NULL; int rv = -1; if (!ctx || ctx->magic != IPMI_CTX_MAGIC) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } /* technically, user can input anything for activate, but only 0x01 will do anything */ if (!fiid_obj_valid (obj_cmd_rs)) { API_SET_ERRNUM (ctx, IPMI_ERR_PARAMETERS); return (-1); } if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rs, tmpl_cmd_dcmi_set_dcmi_configuration_parameters_rs) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rs); return (-1); } if (!(obj_cmd_rq = fiid_obj_create (tmpl_cmd_dcmi_set_dcmi_configuration_parameters_discovery_configuration_rq))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (fill_cmd_dcmi_set_dcmi_configuration_parameters_discovery_configuration (set_selector, option_12, option_60_with_option_43, random_back_off, obj_cmd_rq) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (api_ipmi_cmd (ctx, IPMI_BMC_IPMB_LUN_BMC, IPMI_NET_FN_GROUP_EXTENSION_RQ, obj_cmd_rq, obj_cmd_rs) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_cmd_rq); return (rv); }
int ipmi_cmd_dcmi_get_temperature_reading (ipmi_ctx_t ctx, uint8_t sensor_type, uint8_t entity_id, uint8_t entity_instance, uint8_t entity_instance_start, fiid_obj_t obj_cmd_rs) { fiid_obj_t obj_cmd_rq = NULL; int rv = -1; if (!ctx || ctx->magic != IPMI_CTX_MAGIC) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } /* remaining parameter checks in fill function */ if (!fiid_obj_valid (obj_cmd_rs)) { API_SET_ERRNUM (ctx, IPMI_ERR_PARAMETERS); return (-1); } if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rs, tmpl_cmd_dcmi_get_temperature_reading_rs) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rs); return (-1); } if (!(obj_cmd_rq = fiid_obj_create (tmpl_cmd_dcmi_get_temperature_reading_rq))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (fill_cmd_dcmi_get_temperature_reading (sensor_type, entity_id, entity_instance, entity_instance_start, obj_cmd_rq) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (api_ipmi_cmd (ctx, IPMI_BMC_IPMB_LUN_BMC, IPMI_NET_FN_GROUP_EXTENSION_RQ, obj_cmd_rq, obj_cmd_rs) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_cmd_rq); return (rv); }
int ipmi_cmd_dcmi_set_thermal_limit (ipmi_ctx_t ctx, uint8_t entity_id, uint8_t entity_instance, uint8_t temperature_limit, uint8_t exception_actions_log_event_to_sel_only, uint8_t exception_actions_hard_power_off_system_and_log_event, uint16_t exception_time, fiid_obj_t obj_cmd_rs) { fiid_obj_t obj_cmd_rq = NULL; int rv = -1; if (!ctx || ctx->magic != IPMI_CTX_MAGIC) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } /* remaining parameter checks in fill function */ if (!fiid_obj_valid (obj_cmd_rs)) { API_SET_ERRNUM (ctx, IPMI_ERR_PARAMETERS); return (-1); } if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rs, tmpl_cmd_dcmi_set_thermal_limit_rs) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rs); return (-1); } if (!(obj_cmd_rq = fiid_obj_create (tmpl_cmd_dcmi_set_thermal_limit_rq))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (fill_cmd_dcmi_set_thermal_limit (entity_id, entity_instance, temperature_limit, exception_actions_log_event_to_sel_only, exception_actions_hard_power_off_system_and_log_event, exception_time, obj_cmd_rq) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (api_ipmi_cmd (ctx, IPMI_BMC_IPMB_LUN_BMC, IPMI_NET_FN_GROUP_EXTENSION_RQ, obj_cmd_rq, obj_cmd_rs) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_cmd_rq); return (rv); }
int ipmi_cmd_set_user_payload_access (ipmi_ctx_t ctx, uint8_t channel_number, uint8_t user_id, uint8_t operation, uint8_t standard_payload_1, uint8_t standard_payload_2, uint8_t standard_payload_3, uint8_t standard_payload_4, uint8_t standard_payload_5, uint8_t standard_payload_6, uint8_t standard_payload_7, uint8_t oem_payload_0, uint8_t oem_payload_1, uint8_t oem_payload_2, uint8_t oem_payload_3, uint8_t oem_payload_4, uint8_t oem_payload_5, uint8_t oem_payload_6, uint8_t oem_payload_7, fiid_obj_t obj_cmd_rs) { fiid_obj_t obj_cmd_rq = NULL; int rv = -1; if (!ctx || ctx->magic != IPMI_CTX_MAGIC) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } /* remaining parameter checks in fill function */ if (!fiid_obj_valid (obj_cmd_rs)) { API_SET_ERRNUM (ctx, IPMI_ERR_PARAMETERS); return (-1); } if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rs, tmpl_cmd_set_user_payload_access_rs) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rs); return (-1); } if (!(obj_cmd_rq = fiid_obj_create (tmpl_cmd_set_user_payload_access_rq))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (fill_cmd_set_user_payload_access (channel_number, user_id, operation, standard_payload_1, standard_payload_2, standard_payload_3, standard_payload_4, standard_payload_5, standard_payload_6, standard_payload_7, oem_payload_0, oem_payload_1, oem_payload_2, oem_payload_3, oem_payload_4, oem_payload_5, oem_payload_6, oem_payload_7, obj_cmd_rq) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (api_ipmi_cmd (ctx, IPMI_BMC_IPMB_LUN_BMC, IPMI_NET_FN_APP_RQ, obj_cmd_rq, obj_cmd_rs) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_cmd_rq); return (rv); }
int ipmi_cmd_set_front_panel_enables (ipmi_ctx_t ctx, uint8_t disable_power_off_button_for_power_off_only, uint8_t disable_reset_button, uint8_t disable_diagnostic_interrupt_button, uint8_t disable_standby_button_for_entering_standby, fiid_obj_t obj_cmd_rs) { fiid_obj_t obj_cmd_rq = NULL; int rv = -1; if (!ctx || ctx->magic != IPMI_CTX_MAGIC) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } /* remaining parameter checks in fill function */ if (!fiid_obj_valid (obj_cmd_rs)) { API_SET_ERRNUM (ctx, IPMI_ERR_PARAMETERS); return (-1); } if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rs, tmpl_cmd_set_front_panel_enables_rs) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rs); return (-1); } if (!(obj_cmd_rq = fiid_obj_create (tmpl_cmd_set_front_panel_enables_rq))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (fill_cmd_set_front_panel_enables (disable_power_off_button_for_power_off_only, disable_reset_button, disable_diagnostic_interrupt_button, disable_standby_button_for_entering_standby, obj_cmd_rq) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (api_ipmi_cmd (ctx, IPMI_BMC_IPMB_LUN_BMC, IPMI_NET_FN_CHASSIS_RQ, obj_cmd_rq, obj_cmd_rs) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_cmd_rq); return (rv); }
static int _ssif_cmd_write (ipmi_ctx_t ctx, uint8_t cmd, uint8_t group_extension, fiid_obj_t obj_cmd_rq) { uint8_t *pkt = NULL; unsigned int pkt_len; int hdr_len, cmd_len, send_len; int rv = -1; assert (ctx && ctx->magic == IPMI_CTX_MAGIC && fiid_obj_valid (obj_cmd_rq)); if ((hdr_len = fiid_template_len_bytes (tmpl_hdr_kcs)) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if ((cmd_len = fiid_obj_len_bytes (obj_cmd_rq)) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rq); goto cleanup; } pkt_len = hdr_len + cmd_len; if (!(pkt = malloc (pkt_len))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } memset (pkt, '\0', pkt_len); if (fill_hdr_ipmi_kcs (ctx->target.lun, ctx->target.net_fn, ctx->io.inband.rq.obj_hdr) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if ((send_len = assemble_ipmi_kcs_pkt (ctx->io.inband.rq.obj_hdr, obj_cmd_rq, pkt, pkt_len, IPMI_INTERFACE_FLAGS_DEFAULT)) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (ctx->flags & IPMI_FLAGS_DEBUG_DUMP && send_len) _api_ssif_dump_rq (ctx, pkt, send_len, cmd, ctx->target.net_fn, group_extension, obj_cmd_rq); if (ipmi_ssif_write (ctx->io.inband.ssif_ctx, pkt, send_len) < 0) { API_SSIF_ERRNUM_TO_API_ERRNUM (ctx, ipmi_ssif_ctx_errnum (ctx->io.inband.ssif_ctx)); goto cleanup; } rv = 0; cleanup: free (pkt); return (rv); }
int ipmi_cmd_set_system_boot_options_BMC_boot_flag_valid_bit_clearing (ipmi_ctx_t ctx, uint8_t parameter_valid, uint8_t dont_clear_on_power_up, uint8_t dont_clear_on_pushbutton_rest_soft_reset, uint8_t dont_clear_on_watchdog_timeout, uint8_t dont_clear_on_chassis_control, uint8_t dont_clear_on_PEF, fiid_obj_t obj_cmd_rs) { fiid_obj_t obj_cmd_rq = NULL; int rv = -1; if (!ctx || ctx->magic != IPMI_CTX_MAGIC) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } /* remaining parameter checks in fill function */ if (!fiid_obj_valid (obj_cmd_rs)) { API_SET_ERRNUM (ctx, IPMI_ERR_PARAMETERS); return (-1); } if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rs, tmpl_cmd_set_system_boot_options_rs) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rs); return (-1); } if (!(obj_cmd_rq = fiid_obj_create (tmpl_cmd_set_system_boot_options_BMC_boot_flag_valid_bit_clearing_rq))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (fill_cmd_set_system_boot_options_BMC_boot_flag_valid_bit_clearing (parameter_valid, dont_clear_on_power_up, dont_clear_on_pushbutton_rest_soft_reset, dont_clear_on_watchdog_timeout, dont_clear_on_chassis_control, dont_clear_on_PEF, obj_cmd_rq) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (api_ipmi_cmd (ctx, IPMI_BMC_IPMB_LUN_BMC, IPMI_NET_FN_CHASSIS_RQ, obj_cmd_rq, obj_cmd_rs) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_cmd_rq); return (rv); }
int api_ssif_cmd (ipmi_ctx_t ctx, fiid_obj_t obj_cmd_rq, fiid_obj_t obj_cmd_rs) { uint8_t cmd = 0; /* used for debugging */ uint8_t group_extension = 0; /* used for debugging */ uint64_t val; struct timespec request, remain; uint8_t retry = IPMI_SSIF_RETRY_DEFAULT; assert (ctx && ctx->magic == IPMI_CTX_MAGIC && ctx->type == IPMI_DEVICE_SSIF && fiid_obj_valid (obj_cmd_rq) && fiid_obj_packet_valid (obj_cmd_rq) == 1 && fiid_obj_valid (obj_cmd_rs)); if (ctx->flags & IPMI_FLAGS_DEBUG_DUMP) { /* ignore error, continue on */ if (FIID_OBJ_GET (obj_cmd_rq, "cmd", &val) < 0) API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rq); else cmd = val; if (IPMI_NET_FN_GROUP_EXTENSION (ctx->target.net_fn)) { /* ignore error, continue on */ if (FIID_OBJ_GET (obj_cmd_rq, "group_extension_identification", &val) < 0) API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rq); else group_extension = val; } } if (_ssif_cmd_write (ctx, cmd, group_extension, obj_cmd_rq) < 0) return (-1); /****************************************************************************** 12.9 SMBus NACKs and Error Recovery: ==================================== The BMC can NACK the SMBus host controller if it is not ready to accept a new transaction. Typically, this will be exhibited by the BMC NACK'ing its slave address. If the BMC NACKs a single part transaction, software can simply retry it. If a 'middle' or 'end' transaction is NACK'd, software should not retry the particular but should restart the multi-part read or write from the beginning Start transaction for the transfer. *******************************************************************************/ if (_ssif_cmd_read (ctx, cmd, group_extension, obj_cmd_rs) < 0) { while (1) { request.tv_sec = 0; request.tv_nsec = IPMI_SSIF_TIMEOUT_DEFAULT; if (nanosleep (&request, &remain) < 0 ) return (-1); if (_ssif_cmd_read (ctx, cmd, group_extension, obj_cmd_rs) < 0) { if (retry == 0) return (-1); retry--; } else break; } } return (0); }
int ipmi_cmd_set_system_boot_options_boot_info_acknowledge (ipmi_ctx_t ctx, uint8_t parameter_valid, const uint8_t *bios_or_post_handled_boot_info, const uint8_t *os_loader_handled_boot_info, const uint8_t *os_or_service_partition_handled_boot_info, const uint8_t *sms_handled_boot_info, const uint8_t *oem_handled_boot_info, fiid_obj_t obj_cmd_rs) { fiid_obj_t obj_cmd_rq = NULL; int rv = -1; if (!ctx || ctx->magic != IPMI_CTX_MAGIC) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } /* remaining parameter checks in fill function */ if (!fiid_obj_valid (obj_cmd_rs)) { API_SET_ERRNUM (ctx, IPMI_ERR_PARAMETERS); return (-1); } if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rs, tmpl_cmd_set_system_boot_options_rs) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rs); return (-1); } if (!(obj_cmd_rq = fiid_obj_create (tmpl_cmd_set_system_boot_options_boot_info_acknowledge_rq))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (fill_cmd_set_system_boot_options_boot_info_acknowledge (parameter_valid, bios_or_post_handled_boot_info, os_loader_handled_boot_info, os_or_service_partition_handled_boot_info, sms_handled_boot_info, oem_handled_boot_info, obj_cmd_rq) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (api_ipmi_cmd (ctx, IPMI_BMC_IPMB_LUN_BMC, IPMI_NET_FN_CHASSIS_RQ, obj_cmd_rq, obj_cmd_rs) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_cmd_rq); return (rv); }
static int _api_ssif_ipmb_recv (ipmi_ctx_t ctx, fiid_obj_t obj_ipmb_msg_hdr_rs, fiid_obj_t obj_ipmb_msg_trlr, fiid_obj_t obj_cmd_rs) { struct ipmi_ctx_target target_save; uint8_t buf[IPMI_MAX_PKT_LEN]; fiid_obj_t obj_ipmb_msg_rs = NULL; fiid_obj_t obj_get_cmd_rs = NULL; int len, ret, rv = -1; unsigned int intf_flags = IPMI_INTERFACE_FLAGS_DEFAULT; assert (ctx && ctx->magic == IPMI_CTX_MAGIC && ctx->type == IPMI_DEVICE_SSIF && fiid_obj_valid (obj_ipmb_msg_hdr_rs) && fiid_obj_valid (obj_ipmb_msg_trlr) && fiid_obj_valid (obj_cmd_rs)); if (ctx->flags & IPMI_FLAGS_NO_LEGAL_CHECK) intf_flags |= IPMI_INTERFACE_FLAGS_NO_LEGAL_CHECK; if (!(obj_ipmb_msg_rs = fiid_obj_create (tmpl_ipmb_msg))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (!(obj_get_cmd_rs = fiid_obj_create (tmpl_cmd_get_message_rs))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } /* get_message will send to the BMC, so clear out target information */ memcpy (&target_save, &ctx->target, sizeof (target_save)); ctx->target.channel_number_is_set = 0; ctx->target.rs_addr_is_set = 0; ret = ipmi_cmd_get_message (ctx, obj_get_cmd_rs); /* restore target info */ memcpy (&ctx->target, &target_save, sizeof (target_save)); if (ret < 0) { if (ipmi_check_completion_code (obj_get_cmd_rs, IPMI_COMP_CODE_GET_MESSAGE_DATA_NOT_AVAILABLE) == 1) API_SET_ERRNUM (ctx, IPMI_ERR_MESSAGE_TIMEOUT); else API_BAD_RESPONSE_TO_API_ERRNUM (ctx, obj_get_cmd_rs); goto cleanup; } if ((len = fiid_obj_get_data (obj_get_cmd_rs, "message_data", buf, IPMI_MAX_PKT_LEN)) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_get_cmd_rs); goto cleanup; } if (fiid_obj_set_all (obj_ipmb_msg_rs, buf, len) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_ipmb_msg_rs); goto cleanup; } if (unassemble_ipmi_ipmb_msg (obj_ipmb_msg_rs, obj_ipmb_msg_hdr_rs, obj_cmd_rs, obj_ipmb_msg_trlr, intf_flags) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_ipmb_msg_rs); fiid_obj_destroy (obj_get_cmd_rs); return (rv); }
int ipmi_cmd_set_system_boot_options_boot_flags (ipmi_ctx_t ctx, uint8_t parameter_valid, uint8_t bios_boot_type, uint8_t boot_flags_persistent, uint8_t boot_flags_valid, uint8_t lock_out_reset_button, uint8_t screen_blank, uint8_t boot_device, uint8_t lock_keyboard, uint8_t cmos_clear, uint8_t console_redirection, uint8_t lock_out_sleep_button, uint8_t user_password_bypass, uint8_t force_progress_event_traps, uint8_t firmware_bios_verbosity, uint8_t lock_out_via_power_button, uint8_t bios_mux_control_override, uint8_t bios_shared_mode_override, uint8_t device_instance_selector, fiid_obj_t obj_cmd_rs) { fiid_obj_t obj_cmd_rq = NULL; int rv = -1; if (!ctx || ctx->magic != IPMI_CTX_MAGIC) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } /* remaining parameter checks in fill function */ if (!fiid_obj_valid (obj_cmd_rs)) { API_SET_ERRNUM (ctx, IPMI_ERR_PARAMETERS); return (-1); } if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rs, tmpl_cmd_set_system_boot_options_rs) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rs); return (-1); } if (!(obj_cmd_rq = fiid_obj_create (tmpl_cmd_set_system_boot_options_boot_flags_rq))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (fill_cmd_set_system_boot_options_boot_flags (parameter_valid, bios_boot_type, boot_flags_persistent, boot_flags_valid, lock_out_reset_button, screen_blank, boot_device, lock_keyboard, cmos_clear, console_redirection, lock_out_sleep_button, user_password_bypass, force_progress_event_traps, firmware_bios_verbosity, lock_out_via_power_button, bios_mux_control_override, bios_shared_mode_override, device_instance_selector, obj_cmd_rq) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (api_ipmi_cmd (ctx, IPMI_BMC_IPMB_LUN_BMC, IPMI_NET_FN_CHASSIS_RQ, obj_cmd_rq, obj_cmd_rs) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_cmd_rq); return (rv); }
static int _ipmi_cmd_get_serial_modem_configuration_parameters_common (ipmi_ctx_t ctx, uint8_t channel_number, uint8_t get_parameter, uint8_t set_selector, uint8_t block_selector, fiid_obj_t obj_cmd_rs, fiid_field_t *tmpl_cmd_rs_expected, uint8_t parameter_selector) { fiid_obj_t obj_cmd_rq = NULL; int rv = -1; assert (tmpl_cmd_rs_expected); if (!ctx || ctx->magic != IPMI_CTX_MAGIC) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } /* remaining parameter checks in fill function */ if (!fiid_obj_valid (obj_cmd_rs)) { API_SET_ERRNUM (ctx, IPMI_ERR_PARAMETERS); return (-1); } if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rs, tmpl_cmd_rs_expected) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rs); return (-1); } if (!(obj_cmd_rq = fiid_obj_create (tmpl_cmd_get_serial_modem_configuration_rq))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (fill_cmd_get_serial_modem_configuration (channel_number, get_parameter, parameter_selector, set_selector, block_selector, obj_cmd_rq) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (api_ipmi_cmd (ctx, IPMI_BMC_IPMB_LUN_BMC, IPMI_NET_FN_TRANSPORT_RQ, obj_cmd_rq, obj_cmd_rs) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_cmd_rq); return (rv); }
int ipmi_cmd_set_system_boot_options_boot_initiator_info (ipmi_ctx_t ctx, uint8_t parameter_valid, uint8_t boot_source_channel_number, uint32_t session_id, uint32_t boot_info_timestamp, fiid_obj_t obj_cmd_rs) { fiid_obj_t obj_cmd_rq = NULL; int rv = -1; if (!ctx || ctx->magic != IPMI_CTX_MAGIC) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } /* remaining parameter checks in fill function */ if (!fiid_obj_valid (obj_cmd_rs)) { API_SET_ERRNUM (ctx, IPMI_ERR_PARAMETERS); return (-1); } if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rs, tmpl_cmd_set_system_boot_options_rs) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rs); return (-1); } if (!(obj_cmd_rq = fiid_obj_create (tmpl_cmd_set_system_boot_options_boot_initiator_info_rq))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (fill_cmd_set_system_boot_options_boot_initiator_info (parameter_valid, boot_source_channel_number, session_id, boot_info_timestamp, obj_cmd_rq) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (api_ipmi_cmd (ctx, IPMI_BMC_IPMB_LUN_BMC, IPMI_NET_FN_CHASSIS_RQ, obj_cmd_rq, obj_cmd_rs) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_cmd_rq); return (rv); }
int ipmi_cmd_get_sel_entry (ipmi_ctx_t ctx, uint16_t reservation_id, uint16_t record_id, uint8_t offset_into_record, uint8_t bytes_to_read, fiid_obj_t obj_cmd_rs) { fiid_obj_t obj_cmd_rq = NULL; int rv = -1; if (!ctx || ctx->magic != IPMI_CTX_MAGIC) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } if (!fiid_obj_valid (obj_cmd_rs)) { API_SET_ERRNUM (ctx, IPMI_ERR_PARAMETERS); return (-1); } if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rs, tmpl_cmd_get_sel_entry_rs) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rs); return (-1); } if (!(obj_cmd_rq = fiid_obj_create (tmpl_cmd_get_sel_entry_rq))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (fill_cmd_get_sel_entry (reservation_id, record_id, offset_into_record, bytes_to_read, obj_cmd_rq) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (api_ipmi_cmd (ctx, IPMI_BMC_IPMB_LUN_BMC, IPMI_NET_FN_STORAGE_RQ, obj_cmd_rq, obj_cmd_rs) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_cmd_rq); return (rv); }
int ipmi_cmd_set_sol_configuration_parameters_sol_authentication (ipmi_ctx_t ctx, uint8_t channel_number, uint8_t sol_privilege_level, uint8_t force_sol_payload_authentication, uint8_t force_sol_payload_encryption, fiid_obj_t obj_cmd_rs) { fiid_obj_t obj_cmd_rq = NULL; int rv = -1; if (!ctx || ctx->magic != IPMI_CTX_MAGIC) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } /* remaining parameter checks in fill function */ if (!fiid_obj_valid (obj_cmd_rs)) { API_SET_ERRNUM (ctx, IPMI_ERR_PARAMETERS); return (-1); } if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rs, tmpl_cmd_set_sol_configuration_parameters_rs) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rs); return (-1); } if (!(obj_cmd_rq = fiid_obj_create (tmpl_cmd_set_sol_configuration_parameters_sol_authentication_rq))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (fill_cmd_set_sol_configuration_parameters_sol_authentication (channel_number, sol_privilege_level, force_sol_payload_authentication, force_sol_payload_encryption, obj_cmd_rq) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (api_ipmi_cmd (ctx, IPMI_BMC_IPMB_LUN_BMC, IPMI_NET_FN_TRANSPORT_RQ, obj_cmd_rq, obj_cmd_rs) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_cmd_rq); return (rv); }
int ipmi_cmd_set_acpi_power_state (ipmi_ctx_t ctx, uint8_t system_power_state_enumeration, uint8_t set_system_power_state, uint8_t device_power_state_enumeration, uint8_t set_device_power_state, fiid_obj_t obj_cmd_rs) { fiid_obj_t obj_cmd_rq = NULL; int rv = -1; if (!ctx || ctx->magic != IPMI_CTX_MAGIC) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } /* remaining parameter checks in fill function */ if (!fiid_obj_valid (obj_cmd_rs)) { API_SET_ERRNUM (ctx, IPMI_ERR_PARAMETERS); return (-1); } if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rs, tmpl_cmd_set_acpi_power_state_rs) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rs); return (-1); } if (!(obj_cmd_rq = fiid_obj_create (tmpl_cmd_set_acpi_power_state_rq))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (fill_cmd_set_acpi_power_state (system_power_state_enumeration, set_system_power_state, device_power_state_enumeration, set_device_power_state, obj_cmd_rq) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (api_ipmi_cmd (ctx, IPMI_BMC_IPMB_LUN_BMC, IPMI_NET_FN_APP_RQ, obj_cmd_rq, obj_cmd_rs) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_cmd_rq); return (rv); }
int ipmi_cmd_get_command_sub_function_enables (ipmi_ctx_t ctx, uint8_t channel_number, uint8_t net_fn, uint8_t lun, uint8_t command, uint32_t net_fn_data, fiid_obj_t obj_cmd_rs) { fiid_obj_t obj_cmd_rq = NULL; int rv = -1; if (!ctx || ctx->magic != IPMI_CTX_MAGIC) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } /* remaining parameter checks in fill function */ if (!fiid_obj_valid (obj_cmd_rs)) { API_SET_ERRNUM (ctx, IPMI_ERR_PARAMETERS); return (-1); } if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rs, tmpl_cmd_get_command_sub_function_enables_rs) < 0) { API_FIID_OBJECT_ERROR_TO_API_ERRNUM (ctx, obj_cmd_rs); return (-1); } if (!(obj_cmd_rq = fiid_obj_create (tmpl_cmd_get_command_sub_function_enables_rq))) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (fill_cmd_get_command_sub_function_enables (channel_number, net_fn, lun, command, net_fn_data, obj_cmd_rq) < 0) { API_ERRNO_TO_API_ERRNUM (ctx, errno); goto cleanup; } if (api_ipmi_cmd (ctx, IPMI_BMC_IPMB_LUN_BMC, IPMI_NET_FN_APP_RQ, obj_cmd_rq, obj_cmd_rs) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); goto cleanup; } rv = 0; cleanup: fiid_obj_destroy (obj_cmd_rq); return (rv); }