mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
ressurect isol command
This commit is contained in:
parent
34474dcb2a
commit
d2bee0687a
@ -39,5 +39,5 @@ noinst_HEADERS = log.h bswap.h helper.h ipmi.h ipmi_intf.h \
|
||||
ipmi_sdr.h ipmi_sel.h ipmi_sol.h ipmi_mc.h ipmi_raw.h \
|
||||
ipmi_channel.h ipmi_sensor.h ipmi_event.h ipmi_session.h \
|
||||
ipmi_strings.h ipmi_constants.h ipmi_user.h ipmi_pef.h \
|
||||
ipmi_oem.h
|
||||
ipmi_oem.h ipmi_isol.h
|
||||
|
||||
|
60
ipmitool/include/ipmitool/ipmi_isol.h
Normal file
60
ipmitool/include/ipmitool/ipmi_isol.h
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistribution of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistribution in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Sun Microsystems, Inc. or the names of
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* This software is provided "AS IS," without a warranty of any kind.
|
||||
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
||||
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
||||
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
||||
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
||||
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
||||
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
||||
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
||||
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* You acknowledge that this software is not designed or intended for use
|
||||
* in the design, construction, operation or maintenance of any nuclear
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#ifndef IPMI_ISOL_H
|
||||
#define IPMI_ISOL_H
|
||||
|
||||
#include <ipmitool/ipmi.h>
|
||||
|
||||
#define ACTIVATE_ISOL 0x01
|
||||
#define SET_ISOL_CONFIG 0x03
|
||||
#define GET_ISOL_CONFIG 0x04
|
||||
|
||||
#define ISOL_ENABLE_PARAM 0x01
|
||||
#define ISOL_AUTHENTICATION_PARAM 0x02
|
||||
#define ISOL_ENABLE_FLAG 0x01
|
||||
#define ISOL_PRIVILEGE_LEVEL_USER 0x02
|
||||
#define ISOL_BAUD_RATE_PARAM 0x05
|
||||
#define ISOL_BAUD_RATE_9600 0x06
|
||||
#define ISOL_BAUD_RATE_19200 0x07
|
||||
#define ISOL_BAUD_RATE_38400 0x08
|
||||
#define ISOL_BAUD_RATE_57600 0x09
|
||||
#define ISOL_BAUD_RATE_115200 0x0A
|
||||
#define ISOL_PREFERRED_BAUD_RATE 0x07
|
||||
|
||||
int ipmi_isol_main(struct ipmi_intf *, int, char **);
|
||||
|
||||
#endif /* IPMI_SOL_H */
|
@ -40,7 +40,7 @@ libipmitool_la_SOURCES = helper.c ipmi_sdr.c ipmi_sel.c ipmi_sol.c ipmi_pef.c \
|
||||
ipmi_lanp.c ipmi_fru.c ipmi_chassis.c ipmi_mc.c log.c \
|
||||
dimm_spd.c ipmi_sensor.c ipmi_channel.c ipmi_event.c \
|
||||
ipmi_session.c ipmi_strings.c ipmi_user.c ipmi_raw.c \
|
||||
ipmi_oem.c
|
||||
ipmi_oem.c ipmi_isol.c
|
||||
libipmitool_la_LDFLAGS = -export-dynamic
|
||||
libipmitool_la_LIBADD = -lm
|
||||
libipmitool_la_DEPENDENCIES =
|
||||
|
170
ipmitool/lib/ipmi_isol.c
Normal file
170
ipmitool/lib/ipmi_isol.c
Normal file
@ -0,0 +1,170 @@
|
||||
/*
|
||||
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistribution of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistribution in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Sun Microsystems, Inc. or the names of
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* This software is provided "AS IS," without a warranty of any kind.
|
||||
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
||||
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
||||
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
||||
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
||||
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
||||
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
||||
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
||||
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
||||
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* You acknowledge that this software is not designed or intended for use
|
||||
* in the design, construction, operation or maintenance of any nuclear
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ipmitool/helper.h>
|
||||
#include <ipmitool/ipmi.h>
|
||||
#include <ipmitool/ipmi_intf.h>
|
||||
#include <ipmitool/ipmi_isol.h>
|
||||
|
||||
extern int verbose;
|
||||
|
||||
static int ipmi_isol_setup(struct ipmi_intf * intf, char baudsetting)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char data[6];
|
||||
|
||||
/* TEST FOR AVAILABILITY */
|
||||
|
||||
memset(data, 0, 6);
|
||||
data[0] = 0x00;
|
||||
data[1] = ISOL_ENABLE_PARAM;
|
||||
data[2] = ISOL_ENABLE_FLAG;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_ISOL;
|
||||
req.msg.cmd = SET_ISOL_CONFIG;
|
||||
req.msg.data = data;
|
||||
req.msg.data_len = 3;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp) {
|
||||
printf("Error in Set ISOL Config Command\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rsp->ccode == 0xc1) {
|
||||
printf("Serial Over Lan not supported!\n");
|
||||
return -1;
|
||||
}
|
||||
if (rsp->ccode) {
|
||||
printf("Set Serial Over Lan Config returned %x\n", rsp->ccode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* GET ISOL CONFIG */
|
||||
|
||||
memset(data, 0, 6);
|
||||
data[0] = 0x00;
|
||||
data[1] = ISOL_AUTHENTICATION_PARAM;
|
||||
data[2] = 0x00; /* block */
|
||||
data[3] = 0x00; /* selector */
|
||||
req.msg.cmd = GET_ISOL_CONFIG;
|
||||
req.msg.data_len = 4;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error:%x in Get ISOL Config command\n", rsp?rsp->ccode:0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (verbose > 1)
|
||||
printbuf(rsp->data, rsp->data_len, "ISOL Config");
|
||||
|
||||
/* SET ISOL CONFIG - AUTHENTICATION */
|
||||
|
||||
memset(data, 0, 6);
|
||||
data[0] = 0x00;
|
||||
data[1] = ISOL_AUTHENTICATION_PARAM;
|
||||
data[2] = ISOL_PRIVILEGE_LEVEL_USER | (rsp->data[1] & 0x80);
|
||||
req.msg.cmd = SET_ISOL_CONFIG;
|
||||
req.msg.data_len = 3;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error:%x in Set ISOL Config (Authentication) command\n", rsp?rsp->ccode:0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* SET ISOL CONFIG - BAUD RATE */
|
||||
|
||||
memset(data, 0, 6);
|
||||
data[0] = 0x00;
|
||||
data[1] = ISOL_BAUD_RATE_PARAM;
|
||||
data[2] = baudsetting;
|
||||
req.msg.cmd = SET_ISOL_CONFIG;
|
||||
req.msg.data_len = 3;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error:%x in Set ISOL Config (Baud Rate) command\n", rsp?rsp->ccode:0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ipmi_isol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
if (!argc || !strncmp(argv[0], "setup", 5)) {
|
||||
if (argv[1]) {
|
||||
if (!strncmp(argv[1], "9600", 4)) {
|
||||
ipmi_isol_setup(intf, ISOL_BAUD_RATE_9600);
|
||||
return 0;
|
||||
}
|
||||
else if (!strncmp(argv[1], "19200", 5)) {
|
||||
ipmi_isol_setup(intf, ISOL_BAUD_RATE_19200);
|
||||
return 0;
|
||||
}
|
||||
else if (!strncmp(argv[1], "38400", 5)) {
|
||||
ipmi_isol_setup(intf, ISOL_BAUD_RATE_38400);
|
||||
return 0;
|
||||
}
|
||||
else if (!strncmp(argv[1], "57600", 5)) {
|
||||
ipmi_isol_setup(intf, ISOL_BAUD_RATE_57600);
|
||||
return 0;
|
||||
}
|
||||
else if (!strncmp(argv[1], "115200", 6)) {
|
||||
ipmi_isol_setup(intf, ISOL_BAUD_RATE_115200);
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
printf("ISOL - Unsupported baud rate: %s\n", argv[1]);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
ipmi_isol_setup(intf, ISOL_PREFERRED_BAUD_RATE);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
printf("ISOL Commands: setup <baud>\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -53,6 +53,7 @@
|
||||
#include <ipmitool/ipmi_sel.h>
|
||||
#include <ipmitool/ipmi_fru.h>
|
||||
#include <ipmitool/ipmi_sol.h>
|
||||
#include <ipmitool/ipmi_isol.h>
|
||||
#include <ipmitool/ipmi_lanp.h>
|
||||
#include <ipmitool/ipmi_chassis.h>
|
||||
#include <ipmitool/ipmi_mc.h>
|
||||
@ -105,6 +106,7 @@ struct ipmi_cmd {
|
||||
{ ipmi_sel_main, "sel", "Print System Event Log (SEL)" },
|
||||
{ ipmi_pef_main, "pef", "Configure Platform Event Filtering (PEF)" },
|
||||
{ ipmi_sol_main, "sol", "Configure IPMIv2.0 Serial-over-LAN" },
|
||||
{ ipmi_isol_main, "isol", "Configure IPMIv1.5 Serial-over-LAN" },
|
||||
{ ipmi_user_main, "user", "Configure Management Controller users" },
|
||||
{ ipmi_channel_main, "channel", "Configure Management Controller channels" },
|
||||
{ ipmi_session_main, "session", "Print session information" },
|
||||
|
Loading…
x
Reference in New Issue
Block a user