1 /* 2 * Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved. 3 * Use is subject to license terms. 4 */ 5 6 /* 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 11 * Redistribution of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 14 * Redistribution in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 18 * Neither the name of Sun Microsystems, Inc. or the names of 19 * contributors may be used to endorse or promote products derived 20 * from this software without specific prior written permission. 21 * 22 * This software is provided "AS IS," without a warranty of any kind. 23 * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, 24 * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A 25 * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. 26 * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE 27 * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING 28 * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL 29 * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, 30 * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR 31 * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF 32 * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, 33 * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 34 */ 35 36 #include <ipmitool/ipmi.h> 37 #include <ipmitool/ipmi_intf.h> 38 #include <ipmitool/ipmi_main.h> 39 40 #include <ipmitool/ipmi_sdr.h> 41 #include <ipmitool/ipmi_gendev.h> 42 #include <ipmitool/ipmi_sel.h> 43 #include <ipmitool/ipmi_fru.h> 44 #include <ipmitool/ipmi_sol.h> 45 #include <ipmitool/ipmi_isol.h> 46 #include <ipmitool/ipmi_tsol.h> 47 #include <ipmitool/ipmi_lanp.h> 48 #include <ipmitool/ipmi_chassis.h> 49 #include <ipmitool/ipmi_mc.h> 50 #include <ipmitool/ipmi_sensor.h> 51 #include <ipmitool/ipmi_channel.h> 52 #include <ipmitool/ipmi_session.h> 53 #include <ipmitool/ipmi_event.h> 54 #include <ipmitool/ipmi_user.h> 55 #include <ipmitool/ipmi_raw.h> 56 #include <ipmitool/ipmi_pef.h> 57 #include <ipmitool/ipmi_oem.h> 58 #include <ipmitool/ipmi_sunoem.h> 59 #include <ipmitool/ipmi_fwum.h> 60 #include <ipmitool/ipmi_picmg.h> 61 #include <ipmitool/ipmi_kontronoem.h> 62 #include <ipmitool/ipmi_firewall.h> 63 #include <ipmitool/ipmi_hpmfwupg.h> 64 #include <ipmitool/ipmi_delloem.h> 65 #include <ipmitool/ipmi_ekanalyzer.h> 66 #include <ipmitool/ipmi_ime.h> 67 #include <ipmitool/ipmi_dcmi.h> 68 #include <ipmitool/ipmi_vita.h> 69 70 #ifdef HAVE_CONFIG_H 71 # include <config.h> 72 #endif 73 74 #ifdef HAVE_READLINE 75 extern int ipmi_shell_main(struct ipmi_intf * intf, int argc, char ** argv); 76 #endif 77 extern int ipmi_echo_main(struct ipmi_intf * intf, int argc, char ** argv); 78 extern int ipmi_set_main(struct ipmi_intf * intf, int argc, char ** argv); 79 extern int ipmi_exec_main(struct ipmi_intf * intf, int argc, char ** argv); 80 81 82 int csv_output = 0; 83 int verbose = 0; 84 85 struct ipmi_cmd ipmitool_cmd_list[] = { 86 { ipmi_raw_main, "raw", "Send a RAW IPMI request and print response" }, 87 { ipmi_rawi2c_main, "i2c", "Send an I2C Master Write-Read command and print response" }, 88 { ipmi_rawspd_main, "spd", "Print SPD info from remote I2C device" }, 89 { ipmi_lanp_main, "lan", "Configure LAN Channels" }, 90 { ipmi_chassis_main, "chassis", "Get chassis status and set power state" }, 91 { ipmi_power_main, "power", "Shortcut to chassis power commands" }, 92 { ipmi_event_main, "event", "Send pre-defined events to MC" }, 93 { ipmi_mc_main, "mc", "Management Controller status and global enables" }, 94 { ipmi_mc_main, "bmc", NULL }, /* for backwards compatibility */ 95 { ipmi_sdr_main, "sdr", "Print Sensor Data Repository entries and readings" }, 96 { ipmi_sensor_main, "sensor", "Print detailed sensor information" }, 97 { ipmi_fru_main, "fru", "Print built-in FRU and scan SDR for FRU locators" }, 98 { ipmi_gendev_main, "gendev", "Read/Write Device associated with Generic Device locators sdr" }, 99 { ipmi_sel_main, "sel", "Print System Event Log (SEL)" }, 100 { ipmi_pef_main, "pef", "Configure Platform Event Filtering (PEF)" }, 101 { ipmi_sol_main, "sol", "Configure and connect IPMIv2.0 Serial-over-LAN" }, 102 { ipmi_tsol_main, "tsol", "Configure and connect with Tyan IPMIv1.5 Serial-over-LAN" }, 103 { ipmi_isol_main, "isol", "Configure IPMIv1.5 Serial-over-LAN" }, 104 { ipmi_user_main, "user", "Configure Management Controller users" }, 105 { ipmi_channel_main, "channel", "Configure Management Controller channels" }, 106 { ipmi_session_main, "session", "Print session information" }, 107 { ipmi_dcmi_main, "dcmi", "Data Center Management Interface"}, 108 { ipmi_nm_main, "nm", "Node Manager Interface"}, 109 { ipmi_sunoem_main, "sunoem", "OEM Commands for Sun servers" }, 110 { ipmi_kontronoem_main, "kontronoem", "OEM Commands for Kontron devices"}, 111 { ipmi_picmg_main, "picmg", "Run a PICMG/ATCA extended cmd"}, 112 { ipmi_fwum_main, "fwum", "Update IPMC using Kontron OEM Firmware Update Manager" }, 113 { ipmi_firewall_main,"firewall","Configure Firmware Firewall" }, 114 { ipmi_delloem_main, "delloem", "OEM Commands for Dell systems" }, 115 #ifdef HAVE_READLINE 116 { ipmi_shell_main, "shell", "Launch interactive IPMI shell" }, 117 #endif 118 { ipmi_exec_main, "exec", "Run list of commands from file" }, 119 { ipmi_set_main, "set", "Set runtime variable for shell and exec" }, 120 { ipmi_echo_main, "echo", NULL }, /* for echoing lines to stdout in scripts */ 121 { ipmi_hpmfwupg_main,"hpm", "Update HPM components using PICMG HPM.1 file"}, 122 { ipmi_ekanalyzer_main,"ekanalyzer", "run FRU-Ekeying analyzer using FRU files"}, 123 { ipmi_ime_main, "ime", "Update Intel Manageability Engine Firmware"}, 124 { ipmi_vita_main, "vita", "Run a VITA 46.11 extended cmd"}, 125 { NULL }, 126 }; 127 128 int 129 main(int argc, char ** argv) 130 { 131 int rc; 132 133 rc = ipmi_main(argc, argv, ipmitool_cmd_list, NULL); 134 135 if (rc < 0) 136 exit(EXIT_FAILURE); 137 else 138 exit(EXIT_SUCCESS); 139 } 140