--- ipmi-oem-dell.c.orig 2012-05-18 09:19:48.962028000 -0600 +++ ipmi-oem-dell.c 2012-05-18 10:29:16.225538000 -0600 @@ -374,6 +374,7 @@ #define IPMI_OEM_DELL_PORT_MAP_SLOT_MAPPING_1_2_OR_1_4 1 #define IPMI_OEM_DELL_PORT_MAP_SLOT_MAPPING_1_8 2 +#define IPMI_OEM_DELL_CMC_FIRMWARE_VERSION 0xDF /* Will call ipmi_cmd_get_system_info_parameters only once, b/c field * requested is defined by OEM to be < 16 bytes in length @@ -1824,6 +1825,7 @@ ipmi_oem_dell_get_system_info (ipmi_oem_ "Option: idrac-info\n" "Option: idrac-ipv4-url\n" "Option: idrac-gui-webserver-control\n" + "Option: cmc-firmware-version\n" "Option: cmc-ipv4-url\n" "Option: cmc-ipv6-info\n" "Option: cmc-ipv6-url\n" @@ -1857,6 +1859,7 @@ ipmi_oem_dell_get_system_info (ipmi_oem_ && strcasecmp (state_data->prog_data->args->oem_options[0], "idrac-info") && strcasecmp (state_data->prog_data->args->oem_options[0], "idrac-ipv4-url") && strcasecmp (state_data->prog_data->args->oem_options[0], "idrac-gui-webserver-control") + && strcasecmp (state_data->prog_data->args->oem_options[0], "cmc-firmware-version") && strcasecmp (state_data->prog_data->args->oem_options[0], "cmc-ipv4-url") && strcasecmp (state_data->prog_data->args->oem_options[0], "cmc-ipv6-info") && strcasecmp (state_data->prog_data->args->oem_options[0], "cmc-ipv6-url") @@ -2197,7 +2200,12 @@ ipmi_oem_dell_get_system_info (ipmi_oem_ "%s\n", idrac_web_gui_server_control_str); } - else if (!strcasecmp (state_data->prog_data->args->oem_options[0], "cmc-ipv4-url")) + else if (!strcasecmp (state_data->prog_data->args->oem_options[0], "cmc-firmware-version")) + { + if (ipmi_oem_dell_get_cmc_firmware_version(state_data) < 0) + goto cleanup; + } + else if (!strcasecmp (state_data->prog_data->args->oem_options[0], "cmc-ipv4-url")) { if (_get_dell_system_info_long_string (state_data, IPMI_SYSTEM_INFO_PARAMETER_OEM_DELL_CMC_IPV4_URL, @@ -7088,3 +7096,86 @@ ipmi_oem_dell_set_port_map (ipmi_oem_sta cleanup: return (rv); } + +int +ipmi_oem_dell_get_cmc_firmware_version (ipmi_oem_state_data_t *state_data) +{ + uint8_t bytes_rq[IPMI_OEM_MAX_BYTES]; + uint8_t bytes_rs[IPMI_OEM_MAX_BYTES]; + uint8_t bytes_read[4]; + int rs_len; + int rv = -1; + + assert (state_data); + assert (!state_data->prog_data->args->oem_options_count); + + /* Dell Poweredge OEM + * + * From Dell Provided Docs + * + * Get Active LOM Status + * + * 0x30 - OEM network function + * 0xC1 - OEM cmd + * 0x?? - reserved + * 0x?? - reserved + * + * Get NIC Selection Response + * + * 0xC1 - OEM cmd + * 0x?? - Completion Code + * 0x?? - + * - 0x00 = No Lom Active (i.e. dedicated) + * - 0x01 = LOM 1 + * - 0x02 = LOM 2 + * - 0x03 = LOM 3 + * - 0x04 = LOM 4 + * - 0xff = unknown + * 0x?? - reserved + * 0x?? - reserved + */ + + bytes_rq[0] = IPMI_CMD_GET_SYSTEM_INFO_PARAMETERS; + bytes_rq[1] = 0x00; + bytes_rq[2] = IPMI_OEM_DELL_CMC_FIRMWARE_VERSION; + bytes_rq[3] = 0x01; + bytes_rq[4] = 0x00; + + if ((rs_len = ipmi_cmd_raw (state_data->ipmi_ctx, + 0, /* lun */ + IPMI_NET_FN_APP_RQ, /* network function */ + bytes_rq, /* data */ + 5, /* num bytes */ + bytes_rs, + IPMI_OEM_MAX_BYTES)) < 0) + { + pstdout_fprintf (state_data->pstate, + stderr, + "ipmi_cmd_raw: %s\n", + ipmi_ctx_errormsg (state_data->ipmi_ctx)); + goto cleanup; + } + + if(rs_len != 20) { + pstdout_fprintf (state_data->pstate, + stderr, + "dell:get-system-info 'cmc-firmware-version' option not supported on this system\n"); + goto cleanup; + } + + if (ipmi_oem_check_response_and_completion_code (state_data, + bytes_rs, + rs_len, + 20, + IPMI_OEM_DELL_CMC_FIRMWARE_VERSION, + IPMI_NET_FN_APP_RQ, + NULL) < 0) + goto cleanup; + + memcpy(bytes_read, &bytes_rs[8], 4); + pstdout_printf (state_data->pstate, "%s\n", bytes_read); + + rv = 0; + cleanup: + return (rv); +}