- dev/i2o/iopvar.h is replaced by iopio.h.
- Handle message transport failure when retrieving parameters. - Pad the parameter group buffer for Intel devices. - Display the TID <-> device map upon request. - Complain properly if we don't know about the command that was given.
This commit is contained in:
parent
c47daf63a1
commit
2b5d9695ea
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: iopctl.8,v 1.3 2000/12/11 19:33:55 ad Exp $
|
||||
.\" $NetBSD: iopctl.8,v 1.4 2001/03/20 13:07:51 ad Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
|
@ -46,10 +46,9 @@
|
|||
.Ar command
|
||||
.Op Ar tid
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
can be used to interrogate, issue commands to and otherwise control
|
||||
.Xr iop 4
|
||||
devices.
|
||||
command can be used to interrogate and control I2O devices.
|
||||
.Pp
|
||||
The following options are available:
|
||||
.Bl -tag -width xxxxxxxxxxx
|
||||
|
@ -62,7 +61,7 @@ The following commands are available:
|
|||
.Bl -tag -width indent
|
||||
.It reconfig
|
||||
Reconfigure the IOP: ask all bus ports to rescan their busses, and attach or
|
||||
detach devices from the system as necessary.
|
||||
detach devices to and from the system as necessary.
|
||||
.It showddmid Ar tid
|
||||
Retrieve and display the DDM (device driver module) identity parameter group
|
||||
from the specified target.
|
||||
|
@ -75,6 +74,8 @@ copy of the LCT matches the current device configuration, but is not
|
|||
necessarily the latest available version of the LCT.
|
||||
.It showstatus
|
||||
Display the current status of the IOP.
|
||||
.It showtidmap
|
||||
Display the device to TID map.
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -width /dev/iopn -compact
|
||||
|
@ -90,11 +91,10 @@ control device for IOP unit
|
|||
.Sh AUTHOR
|
||||
The
|
||||
.Nm
|
||||
command was written by Andrew Doran.
|
||||
command was written by Andrew Doran
|
||||
.Aq ad@netbsd.org .
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
command first appeared in
|
||||
.Nx 1.6 .
|
||||
.Sh BUGS
|
||||
I2O configuration dialogs are not yet catered for.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: iopctl.c,v 1.7 2001/02/20 23:56:40 cgd Exp $ */
|
||||
/* $NetBSD: iopctl.c,v 1.8 2001/03/20 13:07:51 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -38,7 +38,7 @@
|
|||
|
||||
#ifndef lint
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: iopctl.c,v 1.7 2001/02/20 23:56:40 cgd Exp $");
|
||||
__RCSID("$NetBSD: iopctl.c,v 1.8 2001/03/20 13:07:51 ad Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -58,7 +58,7 @@ __RCSID("$NetBSD: iopctl.c,v 1.7 2001/02/20 23:56:40 cgd Exp $");
|
|||
#include <getopt.h>
|
||||
|
||||
#include <dev/i2o/i2o.h>
|
||||
#include <dev/i2o/iopvar.h>
|
||||
#include <dev/i2o/iopio.h>
|
||||
|
||||
const char *class2str(int);
|
||||
void getparam(int, int, void *, int);
|
||||
|
@ -72,6 +72,7 @@ void showdevid(char **);
|
|||
void showddmid(char **);
|
||||
void showlct(char **);
|
||||
void showstatus(char **);
|
||||
void showtidmap(char **);
|
||||
|
||||
struct {
|
||||
int class;
|
||||
|
@ -103,6 +104,7 @@ struct {
|
|||
{ "showdevid", 1, showdevid },
|
||||
{ "showlct", 0, showlct },
|
||||
{ "showstatus", 0, showstatus },
|
||||
{ "showtidmap", 0, showtidmap },
|
||||
};
|
||||
|
||||
int fd;
|
||||
|
@ -150,7 +152,7 @@ main(int argc, char **argv)
|
|||
}
|
||||
|
||||
if (i == sizeof(cmdtab) / sizeof(cmdtab[0]))
|
||||
usage();
|
||||
errx(EXIT_FAILURE, "unknown command ``%s''", argv[optind]);
|
||||
|
||||
close(fd);
|
||||
exit(EXIT_SUCCESS);
|
||||
|
@ -199,6 +201,7 @@ getparam(int tid, int group, void *pbuf, int pbufsize)
|
|||
{
|
||||
struct ioppt pt;
|
||||
struct i2o_util_params_op mb;
|
||||
struct i2o_reply *rf;
|
||||
struct {
|
||||
struct i2o_param_op_list_header olh;
|
||||
struct i2o_param_op_all_template oat;
|
||||
|
@ -232,9 +235,12 @@ getparam(int tid, int group, void *pbuf, int pbufsize)
|
|||
if (ioctl(fd, IOPIOCPT, &pt) < 0)
|
||||
err(EXIT_FAILURE, "IOPIOCPT");
|
||||
|
||||
if (((struct i2o_reply *)buf)->reqstatus != 0)
|
||||
rf = (struct i2o_reply *)buf;
|
||||
if (rf->reqstatus != 0)
|
||||
errx(EXIT_FAILURE, "I2O_UTIL_PARAMS_GET failed (%d)",
|
||||
((struct i2o_reply *)buf)->reqstatus);
|
||||
if ((rf->msgflags & I2O_MSGFLAGS_FAIL) != 0)
|
||||
errx(EXIT_FAILURE, "I2O_UTIL_PARAMS_GET failed (FAIL)");
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -392,6 +398,27 @@ reconfig(char **argv)
|
|||
err(EXIT_FAILURE, "IOPIOCRECONFIG");
|
||||
}
|
||||
|
||||
void
|
||||
showtidmap(char **argv)
|
||||
{
|
||||
struct iovec iov;
|
||||
struct iop_tidmap *it;
|
||||
int nent;
|
||||
|
||||
iov.iov_base = buf;
|
||||
iov.iov_len = sizeof(buf);
|
||||
|
||||
if (ioctl(fd, IOPIOCGTIDMAP, &iov) < 0)
|
||||
err(EXIT_FAILURE, "IOPIOCGTIDMAP");
|
||||
|
||||
nent = iov.iov_len / sizeof(*it);
|
||||
it = (struct iop_tidmap *)buf;
|
||||
|
||||
for (; nent--; it++)
|
||||
if ((it->it_flags & IT_CONFIGURED) != 0)
|
||||
printf("%s\ttid %d\n", it->it_dvname, it->it_tid);
|
||||
}
|
||||
|
||||
void
|
||||
i2ostrvis(const char *src, int slen, char *dst, int dlen)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue