diff options
| -rw-r--r-- | sbin/scsi/Makefile | 8 | ||||
| -rw-r--r-- | sbin/scsi/scsi.8 | 320 | ||||
| -rw-r--r-- | sbin/scsi/scsi.c | 934 | ||||
| -rw-r--r-- | sbin/scsiformat/Makefile | 9 | ||||
| -rw-r--r-- | sbin/scsiformat/scsiformat.8 | 111 | ||||
| -rw-r--r-- | sbin/scsiformat/scsiformat.sh | 144 | ||||
| -rw-r--r-- | usr.sbin/ncrcontrol/Makefile | 11 | ||||
| -rw-r--r-- | usr.sbin/ncrcontrol/ncrcontrol.8 | 290 | ||||
| -rw-r--r-- | usr.sbin/ncrcontrol/ncrcontrol.c | 1550 |
9 files changed, 0 insertions, 3377 deletions
diff --git a/sbin/scsi/Makefile b/sbin/scsi/Makefile deleted file mode 100644 index f084f7cb66dc..000000000000 --- a/sbin/scsi/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# @(#)Makefile 8.1 (Berkeley) 6/5/93 - -PROG= scsi -MAN8= scsi.8 -LDADD= -lscsi -DPADD= ${LIBSCSI} - -.include <bsd.prog.mk> diff --git a/sbin/scsi/scsi.8 b/sbin/scsi/scsi.8 deleted file mode 100644 index f3b1c5dee85a..000000000000 --- a/sbin/scsi/scsi.8 +++ /dev/null @@ -1,320 +0,0 @@ -.\" -.\" Written By Julian ELischer -.\" Copyright julian Elischer 1993. -.\" Permission is granted to use or redistribute this file in any way as long -.\" as this notice remains. Julian Elischer does not guarantee that this file -.\" is totally correct for any given task and users of this file must -.\" accept responsibility for any damage that occurs from the application -.\" of this file. -.\" -.\" (julian@tfs.com julian@dialix.oz.au) -.\" User SCSI hooks added by Peter Dufault: -.\" -.\" Copyright (c) 1994 HD Associates -.\" (contact: dufault@hda.com) -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions 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. -.\" 3. The name of HD Associates -.\" may not be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL HD ASSOCIATES BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" -.\" $Id: scsi.8,v 1.17 1998/06/03 03:59:00 jkoshy Exp $ -.\" -.Dd October 11, 1993 -.Dt SCSI 8 -.Os BSD 4 -.Sh NAME -.Nm scsi -.Nd program to assist with scsi devices -.Sh SYNOPSIS -.Nm scsi -.Fl f Ar device -.Fl d Ar debug_level -.Nm scsi -.Fl f Ar device -.Fl z Ar seconds -.Op Fl v -.Nm scsi -.Fl f Ar device -.Fl m Ar page -.Op Fl P Ar pc -.Op Fl e -.Nm scsi -.Fl f Ar device -.Fl p -.Op Fl b Ar bus -.Op Fl l Ar lun -.Nm scsi -.Fl f Ar device -.Fl r -.Op Fl b Ar bus -.Op Fl t Ar targ -.Op Fl l Ar lun -.Nm scsi -.Fl f Ar device -.Fl c Ar cmd_fmt -.Op Ar arg0 ... argn -.Op Fl s Ar seconds -.Op Fl v -.Fl o Ar count out_fmt -.Op Ar arg0 ... argn -.Fl i Ar count in_fmt -.Sh DESCRIPTION -The -.Nm scsi -program is used to send commands to a scsi device. It is also -a sample usage of the user level SCSI commands. -.Pp -The -.Fl f -option must be specified, and -.Ar device -must be the name of a functional SCSI device. If the device is a -disk device, it should be the control device, -.Pq for example Pa /dev/rsd0.ctl . -Use the -.Fl p -option with the -.Sq super scsi -device to reprobe a bus where there are currently no valid devices -attached. -.Pp -The -.Fl d -option sets the SCSI kernel debug level. The kernel must have been compiled -with the -.Dv SCSIDEBUG -option. See -.Pa /sys/scsi/scsi_debug.h -to figure out what to set the kernel debug level to. -.Pp -The -.Fl z -option freezes all activity on all SCSI busses for a given number of -seconds. If -.Fl v -is also specified then a BEL character is sent to the standard -output at the start and finish of the bus freeze. -This requires that the kernel be built with the -.Dv SCSI_FREEZE -kernel option. -This kernel code is not committed yet. -.Pp -The -.Fl m -option is used to read a device mode page. The file -.Pa /usr/share/misc/scsi_modes -is read to look at for how to interpret the mode data. The environment -variable -.Ev SCSI_MODES -can specify a different file to use. -.Pp -The -.Fl P -option can be used to specify a page control field. The page control -fields are: -.Pp -.Bl -tag -width xxxx -indent offset -compact -.It 0 -Current Values -.It 1 -Changeable Values -.It 2 -Default Values -.It 3 -Saved Values -.El -.Pp -The -.Fl e -option permits you to edit the fields. It will use the editor specified -by your -.Ev EDITOR -environment variable. To store changes permanently, -edit page control 3 using the -.Fl P -option. -.Pp -The -.Fl p -option can be used against the -.Sq super scsi -device -.Pa /dev/ssc -to probe all devices with a given SCSI lun on a given SCSI bus. -The bus can be selected with the -.Fl b -option and the default is 0. -The lun can be selected with the -.Fl l -option and the default is 0. -.Pp -The -.Fl r -option can be used to reprobe all SCSI devices on all SCSI busses that -were present at boot-time. See -.Xr scsi 4 -for a description of fixed scsi devices. -.Pp -The -.Fl c -option permits you to send user level SCSI commands specified on -the command line to a -device. The command is sent using the -.Dv SCIOCCOMMAND -ioctl, so the -device you are accessing must permit this ioctl. See -.Xr scsi 4 -for full details of which minor devices permit the ioctl, and -.Xr scsi 3 -for the full details on how to build up the commands and data phases -using the format arguments. -.Pp -.Fl v -turns on more verbose information. -.Pp -.Fl s -sets the command timeout in seconds. The default is two seconds. -.Pp -.Fl c Ar cmd_fmt -specifies the command as described in -.Xr scsi 3 "." -The additional arguments provide values for any variables -specified in the command format. Note that the arguments to the -.Fl c -option are hexadecimal numbers, while all normal arguments on the -command-line are subject to the common -.Dq C -number notation. -.Pp -.Fl o -.Ar count -.Ar out_fmt -.Op Ar arg0 ... argn -indicates that this is a data out command (i.e., data will be sent from -the system to the device) with -.Fr count -bytes of data. The data out is built up using the facilities described in -.Xr scsi 3 -using the provided arguments to fill in any integer variables. -.Ar out_fmt -can be specified as a hyphen ("-") to indicate that the -.Ar count -bytes of data should be read from the standard input. -.Pp -.Fl i Ar count Ar in_fmt -indicates that this is a data in command (i.e., data will be read from -the device into the system) with -.Ar count -bytes of data read in. The information is extracted according to -.Ar in_fmt -using the facilities described in -.Xr scsi 3 -and displayed on the standard output. -.Ar in_fmt -can be specified as a hyphen ("-") to indicate that the -.Ar count -bytes of data input should be written to the standard output. -.Sh EXAMPLES -To verify that the device type for the disk -.Pa /dev/rsd0c -is 0 (direct access device): -.Bd -literal -offset indent -root# scsi -f /dev/rsd0c -c "12 0 0 0 40 0" -i 64 "*b3 b5" 0 -.Ed -.Pp -To do an inquiry to -.Pa /dev/rsd2c : -.Bd -literal -offset indent -root# scsi -f /dev/rsd2c -c "12 0 0 0 v 0" 0x40 -i 64 \e - "s8 z8 z16 z4" -.Ed -.Pp -To edit mode page 1 (the Read-Write Error Recovery Page) -on -.Pa /dev/rsd2c , -and store it permanently on the -drive: -.Bd -literal -offset indent -root# scsi -f /dev/rsd2c -m 1 -e -P 3 -.Ed -.Pp -To simply re-probe the first scsi bus: -.Bd -literal -offset indent -root# scsi -f /dev/ssc -p -.Ed -.Pp -.Sh ENVIRONMENT -The -.Ev SU_DEBUG_OUTPUT -variable can be set to a file to send debugging -output to that file. -.Pp -The -.Ev SU_DEBUG_LEVEL -variable can be set to a non-zero integer to increase -the level of debugging. Currently this is a on or off thing; it should -perhaps use the ioctl to set the debug level in the kernel and then set -it back to zero at program exit. -.Pp -The -.Ev SU_DEBUG_TRUNCATE -variable can be set to an integer to limit the -amount of data phase output sent to the debugging file. -.Pp -The -.Ev EDITOR -variable determines the editor to use for the mode editor. -.Sh SEE ALSO -.Xr scsi 3 , -.Xr scsi 4 , -.Xr ssc 4 -.Sh BUGS -.Pp -Some devices respond to an inquiry for all LUNs. This will cause them -to come on line to 8 times during reprobe to different logical units. -.Pp -The -.Fl i -option to do an inquiry went away in -.Fx 2.1 . -The new facilities -provided by -.Fl c -supersede that. -.Pp -Check your permissions carefully. -.Ql scsi -f /dev/rsd0c -c "4 0 0 0 0 0 -permits anyone who can open -.Pa /dev/rsd0c -to format the disk drive. This must be changed to -at least require write access to the drive. -.Sh HISTORY -The -.Nm scsi -command appeared in 386BSD 0.1.2.4 to support the new reprobe -and user SCSI commands. It first appeared in -.Tn FreeBSD -in -.Fx 2.0.5 . diff --git a/sbin/scsi/scsi.c b/sbin/scsi/scsi.c deleted file mode 100644 index 4d507fe766ed..000000000000 --- a/sbin/scsi/scsi.c +++ /dev/null @@ -1,934 +0,0 @@ -/* - * Written By Julian ELischer - * Copyright julian Elischer 1993. - * Permission is granted to use or redistribute this file in any way as long - * as this notice remains. Julian Elischer does not guarantee that this file - * is totally correct for any given task and users of this file must - * accept responsibility for any damage that occurs from the application - * of this file. - * - * (julian@tfs.com julian@dialix.oz.au) - * - * User SCSI hooks added by Peter Dufault: - * - * Copyright (c) 1994 HD Associates - * (contact: dufault@hda.com) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions 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. - * 3. The name of HD Associates - * may not be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HD ASSOCIATES BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -static const char rcsid[] = - "$Id: scsi.c,v 1.18 1998/06/28 20:31:48 bde Exp $"; -#endif /* not lint */ - -#include <ctype.h> -#include <err.h> -#include <errno.h> -#include <scsi.h> -#include <string.h> -#include <stdlib.h> -#include <sys/file.h> -#include <signal.h> -#include <unistd.h> - -int fd; -int debuglevel; -int debugflag; -int commandflag; -int reprobe; -int probe_all; -int verbose = 0; -int bus = -1; /* all busses */ -int targ = -1; /* all targs */ -int lun = 0; /* just lun 0 */ -int freeze = 0; /* Freeze this many seconds */ - -int modeflag; -int editflag; -int modepage = 0; /* Read this mode page */ -int pagectl = 0; /* Mode sense page control */ -int seconds = 2; - -void usage(void) -{ - fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", - "usage: scsi -f device -d debug_level", - " scsi -f device [-v] -z seconds", - " scsi -f device -m page [-P pc] [-e]", - " scsi -f device -p [-b bus] [-l lun]", - " scsi -f device -r [-b bus] [-t targ] [-l lun]", - " scsi -f device [-v] [-s seconds] -c cmd_fmt [arg0 ... argn]", - " -o count out_fmt [arg0 ... argn]", - " -i count in_fmt"); - exit (1); -} - -void procargs(int *argc_p, char ***argv_p) -{ - int argc = *argc_p; - char **argv = *argv_p; - int fflag, - ch; - - fflag = 0; - commandflag = 0; - debugflag = 0; - while ((ch = getopt(argc, argv, "ceprvf:d:b:t:l:z:m:P:s:")) != -1) { - switch (ch) { - case 'p': - probe_all = 1; - break; - case 'r': - reprobe = 1; - break; - case 'c': - commandflag = 1; - break; - case 'v': - verbose = 1; - break; - case 'e': - editflag = 1; - break; - case 'f': - if ((fd = scsi_open(optarg, O_RDWR)) < 0) - err(errno, "unable to open device %s", optarg); - fflag = 1; - break; - case 'd': - debuglevel = strtol(optarg, 0, 0); - debugflag = 1; - break; - case 'b': - bus = strtol(optarg, 0, 0); - break; - case 't': - targ = strtol(optarg, 0, 0); - break; - case 'l': - lun = strtol(optarg, 0, 0); - break; - case 'z': - freeze = strtol(optarg, 0, 0); - break; - case 'P': - pagectl = strtol(optarg, 0, 0); - break; - case 's': - seconds = strtol(optarg, 0, 0); - break; - case 'm': - modeflag = 1; - modepage = strtol(optarg, 0, 0); - break; - case '?': - default: - usage(); - } - } - *argc_p = argc - optind; - *argv_p = argv + optind; - - if (!fflag) usage(); -} - -/* get_hook: Structure for evaluating args in a callback. - */ -struct get_hook -{ - int argc; - char **argv; - int got; -}; - -/* iget: Integer argument callback - */ -int iget(void *hook, char *name) -{ - struct get_hook *h = (struct get_hook *)hook; - int arg; - - if (h->got >= h->argc) - { - fprintf(stderr, "Expecting an integer argument.\n"); - usage(); - } - arg = strtol(h->argv[h->got], 0, 0); - h->got++; - - if (verbose && name && *name) - printf("%s: %d\n", name, arg); - - return arg; -} - -/* cget: char * argument callback - */ -char *cget(void *hook, char *name) -{ - struct get_hook *h = (struct get_hook *)hook; - char *arg; - - if (h->got >= h->argc) - { - fprintf(stderr, "Expecting a character pointer argument.\n"); - usage(); - } - arg = h->argv[h->got]; - h->got++; - - if (verbose && name) - printf("cget: %s: %s", name, arg); - - return arg; -} - -/* arg_put: "put argument" callback - */ -void arg_put(void *hook, int letter, void *arg, int count, char *name) -{ - if (verbose && name && *name) - printf("%s: ", name); - - switch(letter) - { - case 'i': - case 'b': - printf("%d ", (int)arg); - break; - - case 'c': - case 'z': - { - char *p = malloc(count + 1); - if (p == NULL) - errx(1, "malloc failed"); - p[count] = 0; - strncpy(p, (char *)arg, count); - if (letter == 'z') - { - int i; - for (i = count - 1; i >= 0; i--) - if (p[i] == ' ') - p[i] = 0; - else - break; - } - printf("%s ", p); - } - - break; - - default: - printf("Unknown format letter: '%c'\n", letter); - } - if (verbose) - putchar('\n'); -} - -int arg_get (void *hook, char *field_name) -{ - printf("get \"%s\".\n", field_name); - return 0; -} - -/* data_phase: SCSI bus data phase: DATA IN, DATA OUT, or no data transfer. - */ -enum data_phase {none = 0, in, out}; - -/* do_cmd: Send a command to a SCSI device - */ -static void -do_cmd(int fd, char *fmt, int argc, char **argv) -{ - struct get_hook h; - scsireq_t *scsireq = scsireq_new(); - enum data_phase data_phase; - int count, amount; - char *data_fmt, *bp; - - h.argc = argc; - h.argv = argv; - h.got = 0; - - scsireq_reset(scsireq); - - scsireq_build_visit(scsireq, 0, 0, 0, fmt, iget, (void *)&h); - - /* Three choices here: - * 1. We've used up all the args and have no data phase. - * 2. We have input data ("-i") - * 3. We have output data ("-o") - */ - - if (h.got >= h.argc) - { - data_phase = none; - count = scsireq->datalen = 0; - } - else - { - char *flag = cget(&h, 0); - - if (strcmp(flag, "-o") == 0) - { - data_phase = out; - scsireq->flags = SCCMD_WRITE; - } - else if (strcmp(flag, "-i") == 0) - { - data_phase = in; - scsireq->flags = SCCMD_READ; - } - else - { - fprintf(stderr, - "Need either \"-i\" or \"-o\" for data phase; not \"%s\".\n", flag); - usage(); - } - - count = scsireq->datalen = iget(&h, 0); - if (count) - { - data_fmt = cget(&h, 0); - - scsireq->databuf = malloc(count); - if (scsireq->databuf == NULL) - errx(1, "malloc failed"); - - if (data_phase == out) - { - if (strcmp(data_fmt, "-") == 0) /* Read data from stdin */ - { - bp = (char *)scsireq->databuf; - while (count > 0 && (amount = read(0, bp, count)) > 0) - { - count -= amount; - bp += amount; - } - if (amount == -1) - { - err(1, "read"); - } - else if (amount == 0) - { - /* early EOF */ - fprintf(stderr, - "Warning: only read %lu bytes out of %lu.\n", - scsireq->datalen - (u_long)count, - scsireq->datalen); - scsireq->datalen -= (u_long)count; - } - } - else - { - bzero(scsireq->databuf, count); - scsireq_encode_visit(scsireq, data_fmt, iget, (void *)&h); - } - } - } - } - - - scsireq->timeout = seconds * 1000; - - if (scsireq_enter(fd, scsireq) == -1) - { - scsi_debug(stderr, -1, scsireq); - exit(errno); - } - - if (SCSIREQ_ERROR(scsireq)) - scsi_debug(stderr, 0, scsireq); - - if (count && data_phase == in) - { - if (strcmp(data_fmt, "-") == 0) /* stdout */ - { - bp = (char *)scsireq->databuf; - while (count > 0 && (amount = write(1, bp, count)) > 0) - { - count -= amount; - bp += amount; - } - if (amount < 0) - { - err(1, "write"); - } - else if (amount == 0) - fprintf(stderr, - "Warning: wrote only %lu bytes out of %lu.\n", - (u_long)scsireq->datalen - count, - (u_long)scsireq->datalen); - - } - else - { - scsireq_decode_visit(scsireq, data_fmt, arg_put, 0); - putchar('\n'); - } - } -} - -static void -freeze_ioctl(int fd, int op, void *data) -{ - if (ioctl(fd, SCIOCFREEZE, 0) == -1) { - if (errno == ENODEV) - errx(1, - "your kernel must be configured with option SCSI_FREEZE"); - else - err(1, "ioctl [SCIOCFREEZE]"); - } -} - -/* do_freeze: Freeze the bus for a given number of seconds. - */ -static void do_freeze(int seconds) -{ - if (seconds == -1) { - printf("Hit return to thaw: "); - fflush(stdout); - sync(); - - freeze_ioctl(fd, SCIOCFREEZE, 0); - - (void)getchar(); - - freeze_ioctl(fd, SCIOCTHAW, 0); - } - else { - sync(); - freeze_ioctl(fd, SCIOCFREEZETHAW, &seconds); - if (verbose) { - putchar('\007'); - fflush(stdout); - } - - freeze_ioctl(fd, SCIOCWAITTHAW, 0); - if (verbose) { - putchar('\007'); - fflush(stdout); - } - } -} - -void mode_sense(int fd, u_char *data, int len, int pc, int page) -{ - scsireq_t *scsireq; - - bzero(data, len); - - scsireq = scsireq_new(); - - if (scsireq_enter(fd, scsireq_build(scsireq, - len, data, SCCMD_READ, - "1A 0 v:2 {Page Control} v:6 {Page Code} 0 v:i1 {Allocation Length} 0", - pc, page, len)) == -1) /* Mode sense */ - { - scsi_debug(stderr, -1, scsireq); - exit(errno); - } - - if (SCSIREQ_ERROR(scsireq)) - { - scsi_debug(stderr, 0, scsireq); - exit(1); - } - - free(scsireq); -} - -void mode_select(int fd, u_char *data, int len, int perm) -{ - scsireq_t *scsireq; - - scsireq = scsireq_new(); - - if (scsireq_enter(fd, scsireq_build(scsireq, - len, data, SCCMD_WRITE, - "15 0:7 v:1 {SP} 0 0 v:i1 {Allocation Length} 0", perm, len)) == -1) /* Mode select */ - { - scsi_debug(stderr, -1, scsireq); - exit(errno); - } - - if (SCSIREQ_ERROR(scsireq)) - { - scsi_debug(stderr, 0, scsireq); - exit(1); - } - - free(scsireq); -} - - -#define START_ENTRY '{' -#define END_ENTRY '}' - -static void -skipwhite(FILE *f) -{ - int c; - -skip_again: - - while (isspace(c = getc(f))) - ; - - if (c == '#') { - while ((c = getc(f)) != '\n' && c != EOF) - ; - goto skip_again; - } - - ungetc(c, f); -} - -/* mode_lookup: Lookup a format description for a given page. - */ -char *mode_db = "/usr/share/misc/scsi_modes"; -static char *mode_lookup(int page) -{ - char *new_db; - FILE *modes; - int match, next, found, c; - static char fmt[1024]; /* XXX This should be with strealloc */ - int page_desc; - new_db = getenv("SCSI_MODES"); - - if (new_db) - mode_db = new_db; - - modes = fopen(mode_db, "r"); - if (modes == 0) - return 0; - - next = 0; - found = 0; - - while (!found) { - - skipwhite(modes); - - if (fscanf(modes, "%i", &page_desc) != 1) - break; - - if (page_desc == page) - found = 1; - - skipwhite(modes); - if (getc(modes) != START_ENTRY) - errx(1, "expected %c", START_ENTRY); - - match = 1; - while (match != 0) { - c = getc(modes); - if (c == EOF) { - warnx("expected %c", END_ENTRY); - } - - if (c == START_ENTRY) { - match++; - } - if (c == END_ENTRY) { - match--; - if (match == 0) - break; - } - if (found && c != '\n') { - if (next >= sizeof(fmt)) - errx(1, "buffer overflow"); - - fmt[next++] = (u_char)c; - } - } - } - fmt[next] = 0; - - return (found) ? fmt : 0; -} - -/* -------- edit: Mode Select Editor --------- - */ -struct editinfo -{ - int can_edit; - int default_value; -} editinfo[64]; /* XXX Bogus fixed size */ - -static int editind; -volatile int edit_opened; -static FILE *edit_file; -static char edit_name[L_tmpnam]; - -static inline void -edit_rewind(void) -{ - editind = 0; -} - -static void -edit_done(void) -{ - int opened; - - sigset_t all, prev; - sigfillset(&all); - - (void)sigprocmask(SIG_SETMASK, &all, &prev); - - opened = (int)edit_opened; - edit_opened = 0; - - (void)sigprocmask(SIG_SETMASK, &prev, 0); - - if (opened) - { - if (fclose(edit_file)) - warn("%s", edit_name); - if (unlink(edit_name)) - warn("%s", edit_name); - } -} - -static void -edit_init(void) -{ - edit_rewind(); - if (tmpnam(edit_name) == 0) - errx(1, "tmpnam failed"); - if ((edit_file = fopen(edit_name, "w")) == 0) - err(1, "%s", edit_name); - edit_opened = 1; - - atexit(edit_done); -} - -static void -edit_check(void *hook, int letter, void *arg, int count, char *name) -{ - if (letter != 'i' && letter != 'b') - errx(1, "can't edit format %c", letter); - - if (editind >= sizeof(editinfo) / sizeof(editinfo[0])) - errx(1, "edit table overflow"); - - editinfo[editind].can_edit = ((int)arg != 0); - editind++; -} - -static void -edit_defaults(void *hook, int letter, void *arg, int count, char *name) -{ - if (letter != 'i' && letter != 'b') - errx(1, "can't edit format %c", letter); - - editinfo[editind].default_value = ((int)arg); - editind++; -} - -static void -edit_report(void *hook, int letter, void *arg, int count, char *name) -{ - if (editinfo[editind].can_edit) { - if (letter != 'i' && letter != 'b') - errx(1, "can't report format %c", letter); - - fprintf(edit_file, "%s: %d\n", name, (int)arg); - } - - editind++; -} - -static int -edit_get(void *hook, char *name) -{ - int arg = editinfo[editind].default_value; - - if (editinfo[editind].can_edit) { - char line[80]; - if (fgets(line, sizeof(line), edit_file) == 0) - err(1, "fgets"); - - line[strlen(line) - 1] = 0; - - if (strncmp(name, line, strlen(name)) != 0) - errx(1, "expected \"%s\" and read \"%s\"", name, line); - - arg = strtoul(line + strlen(name) + 2, 0, 0); - } - - editind++; - return arg; -} - -static void -edit_edit(void) -{ - char *system_line; - char *editor = getenv("EDITOR"); - if (!editor) - editor = "vi"; - - fclose(edit_file); - - system_line = malloc(strlen(editor) + strlen(edit_name) + 6); - if (system_line == NULL) - errx(1, "malloc failed"); - sprintf(system_line, "%s %s", editor, edit_name); - system(system_line); - free(system_line); - - if ((edit_file = fopen(edit_name, "r")) == 0) - err(1, "%s", edit_name); -} - -static void -mode_edit(int fd, int page, int edit, int argc, char *argv[]) -{ - int i; - u_char data[255]; - u_char *mode_pars; - struct mode_header - { - u_char mdl; /* Mode data length */ - u_char medium_type; - u_char dev_spec_par; - u_char bdl; /* Block descriptor length */ - }; - - struct mode_page_header - { - u_char page_code; - u_char page_length; - }; - - struct mode_header *mh; - struct mode_page_header *mph; - - char *fmt = mode_lookup(page); - if (!fmt && verbose) { - fprintf(stderr, - "No mode data base entry in \"%s\" for page %d; binary %s only.\n", - mode_db, page, (edit ? "edit" : "display")); - } - - if (edit) { - if (!fmt) - errx(1, "can't edit without a format"); - - if (pagectl != 0 && pagectl != 3) - errx(1, -"it only makes sense to edit page 0 (current) or page 3 (saved values)"); - - verbose = 1; - - mode_sense(fd, data, sizeof(data), 1, page); - - mh = (struct mode_header *)data; - mph = (struct mode_page_header *) - (((char *)mh) + sizeof(*mh) + mh->bdl); - - mode_pars = (char *)mph + sizeof(*mph); - - edit_init(); - scsireq_buff_decode_visit(mode_pars, mh->mdl, - fmt, edit_check, 0); - - mode_sense(fd, data, sizeof(data), 0, page); - - edit_rewind(); - scsireq_buff_decode_visit(mode_pars, mh->mdl, - fmt, edit_defaults, 0); - - edit_rewind(); - scsireq_buff_decode_visit(mode_pars, mh->mdl, - fmt, edit_report, 0); - - edit_edit(); - - edit_rewind(); - scsireq_buff_encode_visit(mode_pars, mh->mdl, - fmt, edit_get, 0); - - /* Eliminate block descriptors: - */ - bcopy((char *)mph, ((char *)mh) + sizeof(*mh), - sizeof(*mph) + mph->page_length); - - mh->bdl = mh->dev_spec_par = 0; - mph = (struct mode_page_header *) (((char *)mh) + sizeof(*mh)); - mode_pars = ((char *)mph) + 2; - -#if 0 - /* Turn this on to see what you're sending to the - * device: - */ - edit_rewind(); - scsireq_buff_decode_visit(mode_pars, - mh->mdl, fmt, arg_put, 0); -#endif - - edit_done(); - - /* Make it permanent if pageselect is three. - */ - - mph->page_code &= ~0xC0; /* Clear PS and RESERVED */ - mh->mdl = 0; /* Reserved for mode select */ - - mode_select(fd, (char *)mh, - sizeof(*mh) + mh->bdl + sizeof(*mph) + mph->page_length, - (pagectl == 3)); - - exit(0); - } - - mode_sense(fd, data, sizeof(data), pagectl, page); - - /* Skip over the block descriptors. - */ - mh = (struct mode_header *)data; - mph = (struct mode_page_header *)(((char *)mh) + sizeof(*mh) + mh->bdl); - mode_pars = (char *)mph + sizeof(*mph); - - if (!fmt) { - for (i = 0; i < mh->mdl; i++) { - printf("%02x%c",mode_pars[i], - (((i + 1) % 8) == 0) ? '\n' : ' '); - } - putc('\n', stdout); - } else { - verbose = 1; - scsireq_buff_decode_visit(mode_pars, - mh->mdl, fmt, arg_put, 0); - } -} - -/* do_probe_all: Loop over all SCSI IDs and see if something is - * there. This only does BUS 0 LUN 0. - */ -void do_probe_all(void) -{ - scsireq_t *scsireq; - - char vendor_id[8 + 1], product_id[16 + 1], revision[4 + 1]; - int id; - u_char *inq_buf; - struct scsi_addr addr; - - inq_buf = malloc(96); - if (inq_buf == NULL) - errx(1, "malloc failed"); - scsireq = scsireq_build(scsireq_new(), - 96, inq_buf, SCCMD_READ, - "12 0 0 0 v 0", 96); - - addr.scbus = (bus == -1) ? 0 : bus; - addr.lun = lun; - - if (addr.scbus || addr.lun) - { - printf("For bus %d lun %d:\n", addr.scbus, addr.lun); - } - - for (id = 0; id < 8; id++) - { - addr.target = id; - - printf("%d: ", id); - if (ioctl(fd, SCIOCADDR, &addr) == -1) { - if (errno == ENXIO) - { - errno = 0; - printf("nothing.\n"); - } - else - printf("SCIOCADDR: %s\n", strerror(errno)); - - continue; - } - - if (scsireq_enter(fd, scsireq) == -1) { - printf("scsireq_enter: %s\n", strerror(errno)); - continue; - } - - vendor_id[sizeof(vendor_id) - 1] = 0; - product_id[sizeof(product_id) - 1] = 0; - revision[sizeof(revision) - 1] = 0; - - scsireq_decode(scsireq, "s8 c8 c16 c4", - vendor_id, product_id, revision); - - printf("%s %s %s\n", vendor_id, product_id, revision); - } -} - -void main(int argc, char **argv) -{ - struct scsi_addr scaddr; - - procargs(&argc,&argv); - - /* XXX This has grown to the point that it should be cleaned up. - */ - if (freeze) { - do_freeze(freeze); - } else if (probe_all) { - do_probe_all(); - } else if(reprobe) { - scaddr.scbus = bus; - scaddr.target = targ; - scaddr.lun = lun; - - if (ioctl(fd,SCIOCREPROBE,&scaddr) == -1) - warn("ioctl [SCIOCREPROBE]"); - } else if(debugflag) { - if (ioctl(fd,SCIOCDEBUG,&debuglevel) == -1) - err(1, "ioctl [SCIODEBUG]"); - } else if (commandflag) { - char *fmt; - - if (argc < 1) { - warnx("need the command format string"); - usage(); - } - - - fmt = argv[0]; - - argc -= 1; - argv += 1; - - do_cmd(fd, fmt, argc, argv); - } else if (modeflag) { - mode_edit(fd, modepage, editflag, argc, argv); - } - exit(0); -} diff --git a/sbin/scsiformat/Makefile b/sbin/scsiformat/Makefile deleted file mode 100644 index d121e7396dc7..000000000000 --- a/sbin/scsiformat/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# @(#)Makefile 5.3 (Berkeley) 6/5/93 - -MAN8= scsiformat.8 - -beforeinstall: - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ - ${.CURDIR}/scsiformat.sh ${DESTDIR}${BINDIR}/scsiformat - -.include <bsd.prog.mk> diff --git a/sbin/scsiformat/scsiformat.8 b/sbin/scsiformat/scsiformat.8 deleted file mode 100644 index 8827c382576f..000000000000 --- a/sbin/scsiformat/scsiformat.8 +++ /dev/null @@ -1,111 +0,0 @@ -.\" Copyright (c) 1993 Regents of the University of California. -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions 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. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)scsiformat.8 5.1 (Berkeley) 6/5/93 -.\" $Id: scsiformat.8,v 1.8 1997/03/02 11:21:05 joerg Exp $ -.\" -.Dd June 5, 1993 -.Dt SCSIFORMAT 8 -.Os BSD 4 -.Sh NAME -.Nm scsiformat -.Nd format SCSI disks and show SCSI parameters -.Sh SYNOPSIS -.Nm scsiformat -.Op Fl qyw -.Op Fl p Ar page-control -.Ar device-name -.Sh DESCRIPTION -The -.Nm -utility can be used to format SCSI disks -on systems that support on-line SCSI formatting. -It will also show the various parameters set in the SCSI controller. -The -.Ar device-name -should be either a disk name like -.Ql sd0 , -or the path name of the control device for a disk, as in -.Pa /dev/rsd0.ctl . -Using a regular disk device may not work, for example in case of a -device where the medium format is corrupted. -.Pp -The options are as follows: -.Bl -tag -width indent -.It Fl p -Modify how the SCSI mode sense page query is constructed. -By default, -.Nm -asks for the current settings. -The page-control flag is one of: -.sp -.Bl -tag -width XXX -compact -.It Li c -gets current settings. -.It Li d -gets default settings (those provided by the disk's manufacturer). -.It Li s -gets saved settings (those that persist across power cycles). -.It Li v -shows which parameters are variable. -.El -.It Fl q -Quiet; suppress the mode page output. Only the inquiry string will be -printed, so the operator can ensure he's going to format the intended -drive. -.It Fl y -Yes; do format without asking any question. If this option is not -provided, -.Nm -will ask back before actually starting to format the device. At this -point, hitting the interrupt key (normally Control-C) will abort the -program. -.It Fl w -Do actually format; by default, only the disk parameters will be -displayed. -.El -.Sh DIAGNOSTICS -These should mostly be self-explanatory. -A copy of the SCSI standard (or a more readable derivative) -may be useful, however. -.Sh SEE ALSO -.Xr scsi 8 -.Sh HISTORY -The -.Nm -utility first appeared in -.Bx 4.4 . -This version has been reworked as a wrapper around -.Xr scsi 8 -by -.An Peter Dufault -for -.Fx 2.1 . diff --git a/sbin/scsiformat/scsiformat.sh b/sbin/scsiformat/scsiformat.sh deleted file mode 100644 index 432bd3f06caf..000000000000 --- a/sbin/scsiformat/scsiformat.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 1995 Peter Dufault -# -# All rights reserved. -# -# This program is free software. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions 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. -# -# THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# $Id: scsiformat.sh,v 1.6 1998/03/01 20:15:00 joerg Exp $ -# - -PATH="/sbin:/usr/sbin:/bin:/usr/bin"; export PATH - -READONLY=yes -DOIT=no -QUIET=no -RAW= -PAGE=0 - -usage() -{ - echo "usage: scsiformat [-qyw] [-p page-control] raw-device-name" 1>&2 - exit 2 -} - -while getopts "qwyp:" option -do - case $option in - q) - QUIET=yes - ;; - y) - DOIT=yes - ;; - w) - READONLY=no - ;; - p) - case $OPTARG in - c) - PAGE=0 - ;; - d) - PAGE=2 - ;; - s) - PAGE=3 - ;; - v) - PAGE=1 -echo "*** note: for variable parameters, 1-bit means 'can write here'" - ;; - *) - usage - ;; - esac - ;; - ?) - usage - ;; - esac -done - -shift $(($OPTIND - 1)) - -if [ $# -ne 1 ] ; then - usage -fi - -RAW=$1 - -if [ "x$RAW" = "x" ] ; then - usage -fi - -if expr "$RAW" : 'sd[0-9][0-9]*$' > /dev/null ; then - # generic disk name given, convert to control device name - RAW="/dev/r${RAW}.ctl" -fi - -scsi -f $RAW -v -c "12 0 0 0 v 0" 96 -i 96 "s8 z8 z16 z4" || exit $? - -if [ "$QUIET" = "no" ] ; then - scsi -f $RAW \ --v -c "1A 0 v:2 4:6 0 64 0" $PAGE \ --i 72 "{Mode data length} i1 \ -{Medium type} i1 \ -{Device Specific Parameter} i1 \ -{Block descriptor length} i1 \ -{Density code} i1 \ -{Number of blocks} i3 \ -{Reserved} i1 \ -{Block length} i3 \ -{PS} b1 \ -{Reserved} b1 \ -{Page code} b6 \ -{Page length} i1 \ -{Number of Cylinders} i3 \ -{Number of Heads} i1 \ -{Starting Cylinder-Write Precompensation} i3 \ -{Starting Cylinder-Reduced Write Current} i3 \ -{Drive Step Rate} i2 \ -{Landing Zone Cylinder} i3 \ -{Reserved} b6 \ -{RPL} b2 \ -{Rotational Offset} i1 \ -{Reserved} i1 \ -{Medium Rotation Rate} i2 \ -{Reserved} i1 \ -{Reserved} i1 " || exit $? -fi # !quiet - -if [ "$READONLY" = "no" ] -then - if [ "$DOIT" != "yes" ] - then - echo "This will destroy all data on this drive!" - echo -n "Hit return to continue, or INTR (^C) to abort: " - read dummy - fi - # formatting may take a huge amount of time, set timeout to 4 hours - echo "Formatting... this may take a while." - scsi -s 14400 -f $RAW -c "4 0 0 0 0 0" -fi diff --git a/usr.sbin/ncrcontrol/Makefile b/usr.sbin/ncrcontrol/Makefile deleted file mode 100644 index 487b2b0e95ec..000000000000 --- a/usr.sbin/ncrcontrol/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PROG= ncrcontrol -SRCS= ncrcontrol.c -MAN8= ncrcontrol.8 - -CFLAGS+= -I${.CURDIR}/../../sys -LDADD+= -lkvm -DPADD+= ${LIBKVM} -BINGRP= kmem -BINMODE= 2555 - -.include <bsd.prog.mk> diff --git a/usr.sbin/ncrcontrol/ncrcontrol.8 b/usr.sbin/ncrcontrol/ncrcontrol.8 deleted file mode 100644 index e8a84848ad08..000000000000 --- a/usr.sbin/ncrcontrol/ncrcontrol.8 +++ /dev/null @@ -1,290 +0,0 @@ -.\" Copyright (c) 1994 Wolfgang Stanglmeier. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions 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. -.\" 3. The name of the author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $Id: ncrcontrol.8,v 1.6 1997/02/22 16:08:14 peter Exp $ -.\" -.Dd September 16, 1994 -.Dt NCRCONTROL 8 -.Os FreeBSD -.Sh NAME -.Nm ncrcontrol -.Nd manually configure the ncr810/825 PCI/SCSI device driver -.Sh SYNOPSIS -.\"-------------------------------------------------------- -.\" ncrcontrol [-Mcore] [-Nsystem] [-u unit] [-v] [-v] -i -.\"-------------------------------------------------------- -.Nm ncrcontrol -.Op Fl M Ar core -.Op Fl N Ar system -.Op Fl u Ar unit -.Op Fl v -.Op Fl v -.Fl i -.\"-------------------------------------------------------- -.\" ncrcontrol [-N system] [-u unit] [-p wait] -.\"-------------------------------------------------------- -.Nm ncrcontrol -.Op Fl N Ar system -.Op Fl u Ar unit -.Op Fl p Ar wait -.\"------------------------------------------------------------ -.\" ncrcontrol [-Nsystem] [-u unit] [-t target] -s name=value -.\"------------------------------------------------------------ -.Nm ncrcontrol -.Op Fl N Ar system -.Op Fl u Ar unit -.Op Fl t Ar target -.Fl s -.Ar name=value -.\"------------------------------------------------------------ -.\" ncrcontrol [-Mcore] [-Nsystem] [-u unit] [-t target] -d pattern -.\"------------------------------------------------------------ -.Nm ncrcontrol -.Op Fl M Ar core -.Op Fl N Ar system -.Op Fl u Ar unit -.Op Fl t Ar target -.Fl d -.Ar debug -.\"------------------------------------------------------------ -.\" ncrcontrol [-Nsystem] [-u unit] -w -k torture -.\"------------------------------------------------------------ -.Nm ncrcontrol -.Op Fl N Ar system -.Op Fl u Ar unit -.Fl w -.Fl k -.Ar torture -.\" -.\"===================================================================== -.\" -.Sh DESCRIPTION -The -.Nm -command symbolically displays the contents of the ncr810/ncr825 -pci/scsi driver control structure. -There are a number of output formats, -depending on the options for the information presented. -It may be used to set some values, too. - -.\"-------------------------------------------------------- -.\" ncrcontrol [-Mcore] [-Nsystem] [-u unit] [-v] [-v] -i -.\"-------------------------------------------------------- -The first form of the command displays an overview of the -connected targets. The -.Fl v -requests a verbose output. - -.\"-------------------------------------------------------- -.\" ncrcontrol [-N system] [-u unit] [-p wait] -.\"-------------------------------------------------------- -Using the second form, with a -.Ar wait -interval specified, -.Nm -will continuously display the information regarding data -traffic on the selected scsi bus. - -.\"------------------------------------------------------------ -.\" ncrcontrol [-Nsystem] [-u unit] [-t target] -s name=value -.\"------------------------------------------------------------ -The third form sets a configuration value for one or all -targets of a selected scsi bus. -It normally is not needed, if the device driver options are -correctly set in kernel configuration. - -.\"------------------------------------------------------------ -.\" ncrcontrol [-M core] [-N system] [-u unit] [-t target] -w -d pattern -.\"------------------------------------------------------------ -The forth form presents the content of the drivers control -structure. By the -.Ar pattern -certain parts of the output can be enabled/disabled. -It's only used to debug the driver. - -.\"------------------------------------------------------------ -.\" ncrcontrol [-N system] [-u unit] -w -k torture -.\"------------------------------------------------------------ -With the last form certain driver problems can be forced. -THIS MAY CRASH YOUR SYSTEM. -It's only used to debug the driver. - -.\" -.\"===================================================================== -.\" -.Pp -The options have the following meaning: -.Bl -tag -width flag -.\"------------------------------------------------------------ -.\" -d pattern -.\"------------------------------------------------------------ -.It Fl d -Show the content of the drivers control structure. -The -.Ar pattern -selects the fields, which are displayed. With -.Fl d? -you can get a list of valid flags. - -.\"------------------------------------------------------------ -.\" -i -.\"------------------------------------------------------------ -.It Fl i -Show the configuration state of the connected targets. -With the -.Fl v -option you can request a more verbose information. - -.\"------------------------------------------------------------ -.\" -k torture -.\"------------------------------------------------------------ -.It Fl k -Force certain driver problems to check the error recovery -functions. This option should only be used by the developers. -With -.Fl k? -you can get a list of possible tortures. -This option requires the -.Fl w -option to be set. - -.\"------------------------------------------------------------ -.\" -M core -.\"------------------------------------------------------------ -.It Fl M -Extract values associated with the name list from the specified core -instead of the default -.Pa /dev/kmem . -.\"------------------------------------------------------------ -.\" -N system -.\"------------------------------------------------------------ -.It Fl N -Extract the name list from the specified system instead of the default -.Pa /kernel . - -.\"------------------------------------------------------------ -.\" -p wait -.\"------------------------------------------------------------ -When -.Nm -is invoked with a -.Ar wait -interval argument, it displays a running count of statistics related to -the transfers on the selected scsi bus. - -This display consists of the number of transfers and number of transferred -bytes for the controller and for each connected target. - -(NOT YET COMPLETE) - -.\"------------------------------------------------------------ -.\" -s field=value -.\"------------------------------------------------------------ -.It Fl s -Set a configuration value for one or more targets. -One ore more targets can be selected by the -.Fl t -option. If no target is selected, then the field is set -for all connect targets. - -(NOT YET COMPLETE) - -.\"------------------------------------------------------------ -.\" -t target -.\"------------------------------------------------------------ -.It Fl t -Select the target for the -.Fl s -option. This option may be given more than one time. - -.\"------------------------------------------------------------ -.\" -u unit -.\"------------------------------------------------------------ -.It Fl u -Select the controller unit. -If this option is not given, then controller 0 is assumed. -Most systems have only one controller. - -.\"------------------------------------------------------------ -.\" -v -.\"------------------------------------------------------------ -.It Fl v -Enable verbose output for the -.Fl i -option. - -.\"------------------------------------------------------------ -.\" -w -.\"------------------------------------------------------------ -.It Fl w -Wizard option. -Enable the usage of the -.Fl k -option. - -.\" -.\"===================================================================== -.\" -.Pp -(NOT YET COMPLETE) - -.\" -.\"===================================================================== -.\" -.Sh SEE ALSO -.Xr scsi 4 , -.Xr scsi 8 - -.\" -.\"===================================================================== -.\" -.Sh HISTORY -The -.Nm -command was hacked for -.Bx 386 -and ported to version 1.1 of -.Bx Free -by -.An Wolfgang Stanglmeier Aq wolf@dentaro.GUN.de . -It was ported to -.Bx Net -by -.An Charles M. Hannum Aq mycroft@gnu.ai.mit.edu -and to version 2.0 of -.Bx Free -by -.An Stefan Esser Aq se@zpr.Uni-Koeln.DE . - -.\" -.\"===================================================================== -.\" -.Sh BUGS -The -.Nm -was hacked as a debugging tool for the ncr810 driver. -It should be deleted sometimes. -There should be a general tool to change device driver options -on the fly. -The statistical data should be gathered by the generic scsi driver. diff --git a/usr.sbin/ncrcontrol/ncrcontrol.c b/usr.sbin/ncrcontrol/ncrcontrol.c deleted file mode 100644 index 68b924c4dee9..000000000000 --- a/usr.sbin/ncrcontrol/ncrcontrol.c +++ /dev/null @@ -1,1550 +0,0 @@ -/************************************************************************** -** -** $Id: ncrcontrol.c,v 1.20 1998/03/30 10:09:05 phk Exp $ -** -** Utility for NCR 53C810 device driver. -** -** 386bsd / FreeBSD / NetBSD -** -**------------------------------------------------------------------------- -** -** Written for 386bsd and FreeBSD by -** wolf@dentaro.gun.de Wolfgang Stanglmeier -** se@mi.Uni-Koeln.de Stefan Esser -** -** Ported to NetBSD by -** mycroft@gnu.ai.mit.edu -** -**------------------------------------------------------------------------- -** -** Copyright (c) 1994 Wolfgang Stanglmeier. All rights reserved. -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions -** are met: -** 1. Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** 2. Redistributions 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. -** 3. The name of the author may not be used to endorse or promote products -** derived from this software without specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -** -** -*************************************************************************** -*/ - -#include <sys/file.h> -#include <sys/types.h> -#ifdef __NetBSD__ -#include <sys/device.h> -#endif -#include <err.h> -#include <errno.h> -#include <kvm.h> -#include <limits.h> -#include <nlist.h> -#include <paths.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <pci/ncr.c> - -/* -** used external functions -*/ - -#if defined(__NetBSD__) || (__FreeBSD__ >= 2) -kvm_t *kvm; -#define KVM_NLIST(n) (kvm_nlist(kvm, (n)) >= 0) -#define KVM_READ(o, p, l) (kvm_read(kvm, (o), (void*)(p), (l)) == (l)) -#else -#define KVM_NLIST(n) (kvm_nlist((n)) >= 0) -#define KVM_READ(o, p, l) (kvm_read((void*)(o), (p), (l)) == (l)) -#endif - - -/*=========================================================== -** -** Global variables. -** -**=========================================================== -*/ - -u_long verbose; -u_long wizard; - - - -struct nlist nl[] = { -#define N_NCR_VERSION 0 - { "_ncr_version" }, -#ifdef __NetBSD__ -#define N_NCRCD 1 - { "_ncrcd" }, -#else -#define N_NCRP 1 - { "_ncrp" }, -#define N_NNCR 2 - { "_nncr" }, -#endif - { 0 } -}; - - -const char *vmunix = NULL; -char *kmemf = NULL; - -int kvm_isopen; - -u_long ncr_base; -u_long lcb_base; -u_long ccb_base; - -u_long ncr_unit; -#ifdef __NetBSD__ -struct cfdriver ncrcd; -#else -u_long ncr_units; -#endif - -struct ncb ncr; -struct lcb lcb; -struct ccb ccb; - -u_long target_mask; -u_long global_lun_mask; -u_long lun_mask; -u_long interval; - -static void usage __P((void)); - - -/*=========================================================== -** -** Accessing kernel memory via kvm library. -** -**=========================================================== -*/ - -void read_ccb(u_long base) -{ - ccb_base = base; - if (!KVM_READ ( - base, - &ccb, - sizeof (struct ccb))) - errx(1, "bad kvm read at %x", base); -} - -void read_lcb(u_long base) -{ - lcb_base = base; - if (!KVM_READ ( - base, - &lcb, - sizeof (struct lcb))) - errx(1, "bad kvm read at %x", base); -} - -void read_ncr() -{ - if (!KVM_READ ( - ncr_base, - &ncr, - sizeof (ncr))) - errx(1, "bad kvm read at %x", ncr_base); -} - -void open_kvm(int flags) -{ - int i; - u_long kernel_version; -#if defined(__NetBSD__) || (__FreeBSD__ >= 2) - char errbuf[_POSIX2_LINE_MAX]; -#endif - - if (kvm_isopen) return; - -#if defined(__NetBSD__) || (__FreeBSD__ >= 2) - /* - * Discard setgid privileges if not the running kernel so that bad - * guys can't print interesting stuff from kernel memory. - */ - if (vmunix != NULL || kmemf != NULL) - setgid(getgid()); - else { -#if (__FreeBSD__ >= 2) - vmunix = getbootfile(); -#else - vmunix = _PATH_UNIX; -#endif - } - - kvm = kvm_openfiles(vmunix, kmemf, NULL, flags, errbuf); - if (kvm == NULL) - errx(1, "kvm_openfiles: %s", errbuf); -#else - if (vmunix != NULL) { -#if (__FreeBSD__ >= 2) - vmunix = getbootfile(); -#else - vmunix = _PATH_UNIX; -#endif - } - if (kvm_openfiles(vmunix, kmemf, NULL) == -1) - errx(1, "kvm_openfiles: %s", kvm_geterr()); -#endif - - if (!KVM_NLIST(nl)) - errx(2, "no symbols in \"%s\"", vmunix); - - for (i=0; nl[i].n_name; i++) - if (nl[i].n_type == 0) - errx(1, "no symbol \"%s\" in \"%s\"", - nl[i].n_name, vmunix); - - if (!KVM_READ ( - nl[N_NCR_VERSION].n_value, - &kernel_version, - sizeof (kernel_version))) - errx(1, "bad kvm read"); - - if (kernel_version != ncr_version) - errx(1, "incompatible with kernel. Rebuild!"); - -#ifdef __NetBSD__ - - if (!KVM_READ ( - nl[N_NCRCD].n_value, - &ncrcd, - sizeof (ncrcd))) - errx(1, "bad kvm read"); - - if (ncr_unit >= ncrcd.cd_ndevs) - errx(1, "bad unit number (valid range: 0-%d)", - ncrcd.cd_ndevs-1); - - if (!KVM_READ ( - ncrcd.cd_devs+4*ncr_unit, - &ncr_base, - sizeof (ncr_base))) - errx(1, "bad kvm read"); - - if (!ncr_base) - errx(1, - "control structure not allocated (not found in autoconfig?)"); - -#else /* !__NetBSD__ */ - - if (!KVM_READ ( - nl[N_NNCR].n_value, - &ncr_units, - sizeof (ncr_units))) - errx(1, "bad kvm read"); - - if (ncr_unit >= ncr_units) - errx(1, "bad unit number (valid range: 0-%d)", - ncr_units-1); - - if (!KVM_READ ( - nl[N_NCRP].n_value+4*ncr_unit, - &ncr_base, - sizeof (ncr_base))) { - errx(1, "bad kvm read"); - }; - - if (!ncr_base) - errx(1, - "control structure not allocated (not found in autoconfig?)"); - -#endif /* !__NetBSD__ */ - - read_ncr(); - - if (!ncr.vaddr) - errx(1, "53c810 not mapped (not found in autoconfig?)"); - - kvm_isopen = 1; -} - - - - -void set_target_mask(void) -{ - int t; - if (target_mask) return; - for (t=0; t<MAX_TARGET; t++) - if (ncr.target[t].jump_tcb.l_cmd) target_mask |= (1<<t); -} - -void set_lun_mask(struct tcb * tp) -{ - int l; - lun_mask = global_lun_mask; - if (lun_mask) return; - for (l=0; l<MAX_LUN; l++) - if (tp->lp[l]) lun_mask |= (1<<l); -} - -void printc (u_char*p, int l) -{ - for (;l>0;l--) { - char c=*p++; - printf ("%c", c?c:'_'); - } -} - -/*================================================================ -** -** -** system info -** -** -**================================================================ -*/ - -static double syncmhz(int negoval) -{ - switch (negoval) { - case 0: - return 0.0; - case 10: - return 40.0; - case 11: - return 33.0; - case 12: - return 20.0; - } - return 250.0 / negoval; -} - -void do_info(void) -{ - int t,l,i,d,f,fl; - struct tcb * tip; - open_kvm(O_RDONLY); - - if (verbose>=3) - printf ("ncr unit=%d data@%x register@%x (pci@%x)\n\n", - ncr_unit, ncr_base, ncr.vaddr, ncr.paddr); - - set_target_mask(); - - printf ("T:L Vendor Device Rev Speed Max Wide Tags\n"); - for (t=0; t<MAX_TARGET;t++) { - if (!((target_mask>>t)&1)) continue; - tip = &ncr.target[t]; - - set_lun_mask(tip); - if (!lun_mask) lun_mask=1; - fl=1; - - for (l=0; l<MAX_LUN; l++) { - if (!((lun_mask>>l)&1)) continue; - - printf ("%d:%d ", t, l); - - if (!tip->jump_tcb.l_cmd) break; - - if (fl) { - fl=0; - printc (&tip->inqdata[ 8], 8);printf(" "); - printc (&tip->inqdata[16],16);printf(" "); - printc (&tip->inqdata[32], 4);printf(" "); - - if (tip->period==0xffff) { - printf ("asyn"); - } else if (tip->period) { - printf ("%4.1f", 10000.0 / tip->period); - } else { - printf (" ?"); - } - - printf (" "); - - if (tip->minsync==255) { - printf ("asyn"); - } else if (tip->minsync) { - printf ("%4.1f", syncmhz(tip->minsync)); - } else { - printf (" ?"); - } - } else printf ("%42s", ""); - - if (!tip->lp[l]) { - printf (" no\n"); - continue; - }; - read_lcb ((u_long) tip->lp[l]); - - switch (tip->widedone) { - case 1: - printf (" 8"); - break; - case 2: - printf (" 16"); - break; - case 3: - printf (" 32"); - break; - default: - printf (" ?"); - }; - - if (lcb.usetags) - printf ("%5d", lcb.actlink); - else - printf (" -"); - - printf ("\n"); - - }; - - if (!tip->jump_tcb.l_cmd) { - printf (" --- no target.\n"); - continue; - }; - - if (verbose<1) continue; - - for (i=0; i<8; i++) { - char* (class[10])={ - "disk","tape","printer","processor", - "worm", "cdrom", "scanner", "optical disk", - "media changer", "communication device"}; - d = tip->inqdata[i]; - printf ("[%02x]: ",d); - - switch (i) { - - case 0: - f = d & 0x1f; - if (f<10) printf (class[f]); - else printf ("unknown (%x)", f); - break; - case 1: - f = (d>>7) & 1; - if (f) printf ("removable media"); - else printf ("fixed media"); - break; - - case 2: - f = d & 7; - switch (f) { - case 0: printf ("SCSI-1"); - break; - case 1: printf ("SCSI-1 with CCS"); - break; - case 2: printf ("SCSI-2"); - break; - default: - printf ("unknown ansi version (%d)", - f); - } - break; - - case 3: - if (d&0xc0) printf ("capabilities:"); - if (d&0x80) printf (" AEN"); - if (d&0x40) printf (" TERMINATE-I/O"); - break; - - case 7: - if (d&0xfb) printf ("capabilities:"); - if (d&0x80) printf (" relative"); - if (d&0x40) printf (" wide32"); - if (d&0x20) printf (" wide"); - if (d&0x10) printf (" synch"); - if (d&0x08) printf (" link"); - if (d&0x02) printf (" tags"); - if (d&0x01) printf (" soft-reset"); - }; - printf ("\n"); - }; - printf ("\n"); - }; - printf ("\n"); -} - -/*================================================================ -** -** -** profiling -** -** -**================================================================ -*/ - -void do_profile(void) -{ -#define old backup.profile -#define new ncr.profile - - struct ncb backup; - struct profile diff; - int tra,line,t; - - open_kvm(O_RDONLY); - - set_target_mask(); - - if (interval<1) interval=1; - for (;;) { - /* - ** Header Line 1 - */ - printf (" total "); - - for (t=0; t<MAX_TARGET; t++) { - if (!((target_mask>>t)&1)) continue; - printf (" "); - printc (&ncr.target[t].inqdata[16],8); - }; - - printf (" transf. disconn interru"); - - if (verbose>=1) printf (" ---- ms/transfer ----"); - - printf ("\n"); - - /* - ** Header Line 2 - */ - - printf ("t/s kb/s "); - - for (t=0; t<MAX_TARGET; t++) { - if (!((target_mask>>t)&1)) continue; - printf (" t/s kb/s"); - }; - - printf (" length exp une fly brk"); - - if (verbose>=1) printf (" total pre post disc"); - - printf ("\n"); - - /* - ** Data - */ - - for(line=0;line<20;line++) { - backup = ncr; - read_ncr(); - diff.num_trans = new.num_trans - old.num_trans; - diff.num_bytes = new.num_bytes - old.num_bytes; - diff.num_fly = new.num_fly - old.num_fly ; - diff.num_int = new.num_int - old.num_int ; - diff.ms_setup = new.ms_setup - old.ms_setup; - diff.ms_data = new.ms_data - old.ms_data; - diff.ms_disc = new.ms_disc - old.ms_disc; - diff.ms_post = new.ms_post - old.ms_post; - diff.num_disc = new.num_disc - old.num_disc; - diff.num_break = new.num_break - old.num_break; - - tra = diff.num_trans; - if (!tra) tra=1; - - printf ("%3.0f %4.0f ", - (1.0 * diff.num_trans) / interval, - (1.0 * diff.num_bytes) / (1024*interval)); - - - for (t=0; t<MAX_TARGET; t++) { - if (!((target_mask>>t)&1)) continue; - printf (" %3.0f %4.0f", - ((ncr.target[t].transfers- - backup.target[t].transfers)*1.0) - /interval, - ((ncr.target[t].bytes- - backup.target[t].bytes)*1.0) - /(1024*interval)); - }; - - printf ("%7.0f ", (diff.num_bytes*1.0) / tra); - - printf (" %4.0f", (1.0*(diff.num_disc-diff.num_break)) - /interval); - - printf ("%4.0f", (1.0*diff.num_break)/interval); - - printf ("%4.0f", (1.0*diff.num_fly) / interval); - - printf ("%4.0f", (1.0*diff.num_int) / interval); - - if (verbose >= 1) { - printf ("%7.1f", - (diff.ms_disc+diff.ms_data+diff.ms_setup+diff.ms_post) - * 1.0 / tra); - - printf ("%5.1f%5.1f%6.1f", - 1.0 * diff.ms_setup / tra, - 1.0 * diff.ms_post / tra, - 1.0 * diff.ms_disc / tra); - }; - - printf ("\n"); - fflush (stdout); - sleep (interval); - }; - }; -} - -/*================================================================ -** -** -** Port access -** -** -**================================================================ -*/ - -static int kernelwritefile; -static char* kernelwritefilename = _PATH_KMEM; - -void openkernelwritefile(void) -{ - if (kernelwritefile) return; - - kernelwritefile = open (kernelwritefilename, O_WRONLY); - if (kernelwritefile<3) - err(1, "%s", kernelwritefilename); -} - -void out (u_char reg, u_char val) -{ - u_long addr = ncr.vaddr + reg; - openkernelwritefile(); - if (lseek (kernelwritefile, addr, 0) != addr) - err(1, "%s", kernelwritefilename); - if (write (kernelwritefile, &val, 1) < 0) - err(1, "%s", kernelwritefilename); -} - -u_char in (u_char reg) -{ - u_char res; - if (!KVM_READ ( - (ncr.vaddr + reg), - &res, - 1)) - errx(1, "bad kvm read"); - return (res); -} - -/*================================================================ -** -** -** Setting of driver parameters -** -** -**================================================================ -*/ - -void do_set (char * arg) -{ - struct usrcmd user; - u_long addr; - int i; - - if (!strcmp(arg, "?")) { printf ( -"async: disable synchronous transfers.\n" -"sync=value: set the maximal synchronous transfer rate (MHz).\n" -"fast: set FAST SCSI-2.\n" -"\n" -"wide=value: set the bus width (0=8bit 1=16bit).\n" -"\n" -"tags=value: use this number of tags.\n" -"orderedtag: use ordered tags only.\n" -"simpletag: use simple tags only.\n" -"orderedwrite: use simple tags for read, else ordered tags.\n" -"\n" -"debug=value: set debug mode.\n" -"\n"); - return; - }; - - open_kvm(O_RDWR); - addr = ncr_base + offsetof (struct ncb, user); - - for (i=3; i; i--) { - if (!KVM_READ ( - (addr), - &user, - sizeof (user))) - errx(1, "bad kvm read"); - if (!user.cmd) break; - sleep (1); - } - if (user.cmd) - errx(1, "ncb.user busy"); - - set_target_mask(); - - user.target = target_mask; - user.lun = lun_mask; - user.data = 0; - user.cmd = 0; - - - if (!strcmp(arg, "async")) { - user.data = 255; - user.cmd = UC_SETSYNC; - }; - - if (!strcmp(arg, "fast")) { - user.data = 25; - user.cmd = UC_SETSYNC; - }; - - if (!strncmp(arg, "sync=", 5)) { - double f = strtod (arg+5, NULL); - if (f>=4.0 && f<=10.0) { - user.data = 250.0 / f; - user.cmd = UC_SETSYNC; - }; - }; - - if (!strncmp(arg, "wide=", 5)) { - u_char t = strtoul (arg+5, (char**)0, 0); - if (t<=1) { - user.data = t; - user.cmd = UC_SETWIDE; - }; - }; - - if (!strncmp(arg, "tags=", 5)) { - u_char t = strtoul (arg+5, (char**)0, 0); - if (t<=MAX_TAGS) { - user.data = t; - user.cmd = UC_SETTAGS; - }; - }; - - if (!strncmp(arg, "flags=", 6)) { - u_char t = strtoul (arg+6, (char**)0, 0); - if (t<=0xff) { - user.data = t; - user.cmd = UC_SETFLAG; - }; - }; - - if (!strncmp(arg, "debug=", 6)) { - user.data = strtoul (arg+6, (char**)0, 0); - user.cmd = UC_SETDEBUG; - }; - - if (!strcmp(arg, "orderedtag")) { - user.data = M_ORDERED_TAG; - user.cmd = UC_SETORDER; - }; - - if (!strcmp(arg, "simpletag")) { - user.data = M_SIMPLE_TAG; - user.cmd = UC_SETORDER; - }; - - if (!strcmp(arg, "orderedwrite")) { - user.data = 0; - user.cmd = UC_SETORDER; - }; - - if (user.cmd) { - openkernelwritefile(); - - if (lseek (kernelwritefile, addr, 0) != addr) - err(1, "%s", kernelwritefilename); - if (write (kernelwritefile, &user, sizeof (user)) < 0) - errx(1, "%s", kernelwritefilename); - - return; - }; - - warnx ("do_set \"%s\" not (yet) implemented", arg); -} - -/*================================================================ -** -** -** D O _ K I L L -** -** -**================================================================ -*/ - -void do_kill(char * arg) -{ - open_kvm(O_RDWR); - - if (!strcmp(arg, "?")) { printf ( -"scsireset: force SCSI bus reset.\n" -"scriptabort: send an abort cmd to the script processor.\n" -"scriptstart: start script processind (set SIGP bit).\n" -"evenparity: force even parity.\n" -"oddparity: force odd parity.\n" -"noreselect: disable reselect (force timeouts).\n" -"doreselect: enable reselect.\n" -"\n"); - return; - }; - - if (!wizard) - errx(2, "you are NOT a wizard!"); - - if (!strcmp(arg, "scsireset")) { - out (0x01, 0x08); - out (0x01, 0x00); - return; - }; - if (!strcmp(arg, "scriptabort")) { - out (0x14, 0x80); - out (0x14, 0x20); - return; - }; - if (!strcmp(arg, "scriptstart")) { - out (0x14, 0x20); - return; - }; - if (!strcmp(arg, "evenparity")) { - out (0x01, 0x04); - return; - }; - if (!strcmp(arg, "oddparity")) { - out (0x01, 0x00); - return; - }; - if (!strcmp(arg, "noreselect")) { - out (0x04, in (0x04) & ~RRE); - return; - }; - if (!strcmp(arg, "doreselect")) { - out (0x04, in (0x04) | RRE); - return; - }; - warnx ("do_kill \"%s\" not (yet) implemented", arg); -} - -/*================================================================ -** -** -** Write debug info: utilities: write symbolname. -** -** -**================================================================ -*/ - -static const char * sn (u_long a) -{ - static char buffer[100]; - - const char * s=""; - u_long d,m; - - a -= ncr.p_script; - m = sizeof (struct script); - - if ((d=a-offsetof(struct script, start))<m) m=d, s="<start>"; - if ((d=a-offsetof(struct script, start1))<m) m=d, s="<start1>"; - if ((d=a-offsetof(struct script, startpos))<m) m=d, s="<startpos>"; - if ((d=a-offsetof(struct scripth, tryloop))<m) m=d, s="<tryloop>"; - if ((d=a-offsetof(struct script, trysel))<m) m=d, s="<trysel>"; - if ((d=a-offsetof(struct script, skip))<m) m=d, s="<skip>"; - if ((d=a-offsetof(struct script, skip2))<m) m=d, s="<skip2>"; - if ((d=a-offsetof(struct script, idle))<m) m=d, s="<idle>"; - if ((d=a-offsetof(struct script, select))<m) m=d, s="<select>"; - if ((d=a-offsetof(struct script, prepare))<m) m=d, s="<prepare>"; - if ((d=a-offsetof(struct script, loadpos))<m) m=d, s="<loadpos>"; - if ((d=a-offsetof(struct script, prepare2))<m) m=d, s="<prepare2>"; - if ((d=a-offsetof(struct script, setmsg))<m) m=d, s="<setmsg>"; - if ((d=a-offsetof(struct script, clrack))<m) m=d, s="<clrack>"; - if ((d=a-offsetof(struct script, dispatch))<m) m=d, s="<dispatch>"; - if ((d=a-offsetof(struct script, checkatn))<m) m=d, s="<checkatn>"; - if ((d=a-offsetof(struct script, command))<m) m=d, s="<command>"; - if ((d=a-offsetof(struct script, status))<m) m=d, s="<status>"; - if ((d=a-offsetof(struct script, msg_in))<m) m=d, s="<msg_in>"; - if ((d=a-offsetof(struct script, msg_bad))<m) m=d, s="<msg_bad>"; - if ((d=a-offsetof(struct scripth, msg_parity))<m) m=d, s="<msg_parity>"; - if ((d=a-offsetof(struct scripth, msg_reject))<m) m=d, s="<msg_reject>"; - if ((d=a-offsetof(struct scripth, msg_extended))<m) m=d, s="<msg_extended>"; - if ((d=a-offsetof(struct scripth, msg_sdtr))<m) m=d, s="<msg_sdtr>"; - if ((d=a-offsetof(struct script, complete))<m) m=d, s="<complete>"; - if ((d=a-offsetof(struct script, cleanup))<m) m=d, s="<cleanup>"; - if ((d=a-offsetof(struct script, cleanup0))<m) m=d, s="<cleanup>"; - if ((d=a-offsetof(struct script, signal))<m) m=d, s="<signal>"; - if ((d=a-offsetof(struct script, save_dp))<m) m=d, s="<save_dp>"; - if ((d=a-offsetof(struct script, restore_dp))<m) m=d, s="<restore_dp>"; - if ((d=a-offsetof(struct script, disconnect))<m) m=d, s="<disconnect>"; - if ((d=a-offsetof(struct script, msg_out))<m) m=d, s="<msg_out>"; - if ((d=a-offsetof(struct script, msg_out_done))<m) m=d, s="<msg_out_done>"; - if ((d=a-offsetof(struct scripth, msg_out_abort))<m) m=d, s="<msg_out_abort>"; - if ((d=a-offsetof(struct scripth, getcc))<m) m=d, s="<getcc>"; - if ((d=a-offsetof(struct scripth, getcc1))<m) m=d, s="<getcc1>"; - if ((d=a-offsetof(struct scripth, getcc2))<m) m=d, s="<getcc2>"; - if ((d=a-offsetof(struct script, badgetcc))<m) m=d, s="<badgetcc>"; - if ((d=a-offsetof(struct script, reselect))<m) m=d, s="<reselect>"; - if ((d=a-offsetof(struct script, reselect2))<m) m=d, s="<reselect2>"; - if ((d=a-offsetof(struct script, resel_tmp))<m) m=d, s="<resel_tmp>"; - if ((d=a-offsetof(struct script, resel_lun))<m) m=d, s="<resel_lun>"; - if ((d=a-offsetof(struct script, resel_tag))<m) m=d, s="<resel_tag>"; - if ((d=a-offsetof(struct script, data_in))<m) m=d, s="<data_in>"; - if ((d=a-offsetof(struct script, data_out))<m) m=d, s="<data_out>"; - if ((d=a-offsetof(struct script, no_data))<m) m=d, s="<no_data>"; - if ((d=a-offsetof(struct scripth, aborttag))<m) m=d, s="<aborttag>"; - if ((d=a-offsetof(struct scripth, abort))<m) m=d, s="<abort>"; - - if (!*s) return s; - - sprintf (buffer, "%s:%d%c", s, m/4, 0); - return (buffer); -} - -/*================================================================ -** -** -** Write debug info: utilities: write misc. fields. -** -** -**================================================================ -*/ - -static void printm (u_char * msg, int len) -{ - u_char l; - do { - if (*msg==M_EXTENDED) - l=msg[1]+2; - else if ((*msg & 0xf0)==0x20) - l=2; - else l=1; - len-=l; - - printf (" %x",*msg++); - while (--l>0) printf ("-%x",*msg++); - } while (len>0); -} - -void dump_table (const char * str, struct scr_tblmove * p, int l) -{ - int i; - for (i=0;l>0;i++,p++,l--) if (p->size) { - printf (" %s[%d]: %5d @ 0x%08x\n", - str, i, p->size, p->addr); - }; -} - -void dump_link (const char* name, struct link * link) -{ - printf ("%s: cmd=%08x pa=%08x %s\n", - name, link->l_cmd, link->l_paddr, sn(link->l_paddr)); -} - -/*================================================================ -** -** -** Write debug info: utilities: write time fields. -** -** -**================================================================ -*/ - -void dump_tstamp (const char* name, struct tstamp * p) -#define P(id,fld)\ - if (p->fld) \ - printf ("%s: "id" at %d hz", name,&p->fld); -{ - P ("started ", start); - P ("ended ", end ); - P ("selected ", select); - P ("command ", command); - P ("data ", data); - P ("status ", status); - P ("disconnected", disconnect); - printf ("\n"); -} - - - - -void dump_profile (const char* name, struct profile * p) -{ - printf ("%s: %10d transfers.\n" ,name,p->num_trans); - printf ("%s: %10d bytes transferred.\n",name,p->num_bytes); - printf ("%s: %10d disconnects.\n" ,name,p->num_disc); - printf ("%s: %10d short transfers.\n" ,name,p->num_break); - printf ("%s: %10d interrupts.\n" ,name,p->num_int); - printf ("%s: %10d on the fly ints.\n" ,name,p->num_fly); - printf ("%s: %10d ms setup time.\n" ,name,p->ms_setup); - printf ("%s: %10d ms data transfer.\n" ,name,p->ms_data); - printf ("%s: %10d ms disconnected.\n" ,name,p->ms_disc); - printf ("%s: %10d ms postprocessing.\n",name,p->ms_post); - printf ("\n"); -} - -/*================================================================ -** -** -** Write debug info: utilities: write script registers. -** -** -**================================================================ -*/ - -static void dump_reg(struct ncr_reg * rp) -{ - u_char *reg = (u_char*) rp; -#define l(i) (reg[i]+(reg[i+1]<<8ul)+(reg[i+2]<<16ul)+(reg[i+3]<<24ul)) - int ad; - - char*(phasename[8])={"DATA-OUT","DATA-IN","COMMAND","STATUS", - "ILG-OUT","ILG-IN","MESSAGE-OUT","MESSAGE-IN"}; - for (ad=0x00;ad<0x80;ad++) { - switch (ad % 16) { - - case 0: - printf (" %02x:\t",ad); - break; - case 8: - printf (" : "); - break; - default: - printf (" "); - }; - printf ("%02x", reg[ad]); - if (ad % 16 == 15) printf ("\n"); - }; - printf ("\n"); - printf (" DSP %08x %-20s CMD %08x DSPS %08x %s\n", - l(0x2c),sn(l(0x2c)),l(0x24),l(0x30), sn(l(0x30))); - printf (" TEMP %08x %-20s DSA %08x\n", - l(0x1c),sn(l(0x1c)),l(0x10)); - printf ("\n"); - printf (" Busstatus: "); - if ((reg[0x0b]>>7)&1) printf (" Req"); - if ((reg[0x0b]>>6)&1) printf (" Ack"); - if ((reg[0x0b]>>5)&1) printf (" Bsy"); - if ((reg[0x0b]>>4)&1) printf (" Sel"); - if ((reg[0x0b]>>3)&1) printf (" Atn"); - printf (" %s\n", phasename[reg[0x0b]&7]); - - printf (" Dmastatus: "); - if ((reg[0x0c]>>7)&1) printf (" FifoEmpty"); - if ((reg[0x0c]>>6)&1) printf (" MasterParityError"); - if ((reg[0x0c]>>5)&1) printf (" BusFault"); - if ((reg[0x0c]>>4)&1) printf (" Aborted"); - if ((reg[0x0c]>>3)&1) printf (" SingleStep"); - if ((reg[0x0c]>>2)&1) printf (" Interrupt"); - if ((reg[0x0c]>>0)&1) printf (" IllegalInstruction"); - printf ("\n"); - printf (" Intstatus: "); - if ((reg[0x14]>>7)&1) printf (" Abort"); - if ((reg[0x14]>>6)&1) printf (" SoftwareReset"); - if ((reg[0x14]>>5)&1) printf (" SignalProcess"); - if ((reg[0x14]>>4)&1) printf (" Semaphore"); - if ((reg[0x14]>>3)&1) printf (" Connected"); - if ((reg[0x14]>>2)&1) printf (" IntOnTheFly"); - if ((reg[0x14]>>1)&1) printf (" SCSI-Interrupt"); - if ((reg[0x14]>>0)&1) printf (" DMA-Interrupt"); - printf ("\n"); - printf (" ScsiIstat: "); - if ((reg[0x42]>>7)&1) printf (" PhaseMismatch"); - if ((reg[0x42]>>6)&1) printf (" Complete"); - if ((reg[0x42]>>5)&1) printf (" Selected"); - if ((reg[0x42]>>4)&1) printf (" Reselected"); - if ((reg[0x42]>>3)&1) printf (" GrossError"); - if ((reg[0x42]>>2)&1) printf (" UnexpectedDisconnect"); - if ((reg[0x42]>>1)&1) printf (" ScsiReset"); - if ((reg[0x42]>>0)&1) printf (" ParityError"); - if ((reg[0x43]>>2)&1) printf (" SelectionTimeout"); - if ((reg[0x43]>>1)&1) printf (" TimerExpired"); - if ((reg[0x43]>>0)&1) printf (" HandshakeTimeout"); - printf ("\n"); - printf (" ID=%d DEST-ID=%d RESEL-ID=%d\n", reg[4]&7, reg[6]&7, reg[0xa]&7); - printf ("\n"); -} - -/*================================================================ -** -** -** Write debug info: utilities: write header. -** -** -**================================================================ -*/ - -char * debug_opt; - -void dump_head (struct head * hp) -{ - dump_link (" launch", & hp->launch); - printf (" savep: %08x %s\n", - hp->savep, sn((u_long) hp->savep)); - printf (" cp: %08x %s\n", - hp->cp, sn((u_long)hp->cp)); - if (strchr (debug_opt, 'y')) { - printf ("\n"); - dump_tstamp (" timestamp", &hp->stamp); - }; - - printf (" status: %x %x %x %x %x %x %x %x\n", - hp->status[0], hp->status[1], hp->status[2], hp->status[3], - hp->status[4], hp->status[5], hp->status[6], hp->status[7]); - - printf ("\n"); -} - -/*================================================================ -** -** -** Write debug info: utilities: write ccb. -** -** -**================================================================ -*/ - -void dump_ccb (struct ccb * cp, u_long base) -{ - printf ("----------------------\n"); - printf ("struct ccb @ %08x:\n", base); - printf ("----------------------\n"); - - dump_link (" next", &cp->jump_ccb); - dump_link (" call", &cp->call_tmp); - - dump_head (&cp->phys.header); - - if (strchr (debug_opt, 's')) { - dump_table(" smsg", &cp->phys.smsg, 1); - dump_table("smsg2", &cp->phys.smsg2, 1); - dump_table(" cmd", &cp->phys.cmd, 1); - dump_table(" data", &cp->phys.data[0],MAX_SCATTER); - dump_table("sense", &cp->phys.sense, 1); - }; - - if (strchr (debug_opt, 'a')) { - int i; - for (i=0; i<8; i++) - printf (" patch[%d]: %08x\n", i, cp->patch[i]); - }; - - if (strchr (debug_opt, 'x')) { - printf (" xfer: -- dump not yet implemented.\n"); - }; - - if (strchr (debug_opt, 'm')) { - printf (" smsg:"); - printm (cp->scsi_smsg, cp->phys.smsg.size); - printf ("\n"); - printf (" smsg2:"); - printm (cp->scsi_smsg2, cp->phys.smsg2.size); - printf ("\n"); - }; - - printf (" magic: %x\n", cp->magic); - if (cp->tlimit) - printf (" timeout at: %s", ctime((time_t*)&cp->tlimit)); - printf (" link_ccb: %08x\n", (u_long) cp->link_ccb); - printf (" next_ccb: %08x\n", (u_long) cp->next_ccb); - printf (" tag: %d\n", cp->tag); - printf ("\n"); -} - -/*================================================================ -** -** -** Write debug info: struct lcb -** -** -**================================================================ -*/ - -static void dump_lcb (u_long base) -{ - struct lcb l; - struct ccb c; - u_long cp,cn; - - printf ("----------------------\n"); - printf ("struct lcb @ %08x:\n", base); - printf ("----------------------\n"); - - if (!KVM_READ ( - base, - &l, - sizeof (struct lcb))) - errx(1, "bad kvm read"); - printf (" reqccbs: %d\n", l.reqccbs); - printf (" actccbs: %d\n", l.actccbs); - printf (" reqlink: %d\n", l.reqlink); - printf (" actlink: %d\n", l.actlink); - printf (" usetags: %d\n", l.usetags); - dump_link (" jump_lcb", &l.jump_lcb); - dump_link (" call_tag", &l.call_tag); - dump_link (" jump_ccb", &l.jump_ccb); - printf ("\n"); - cp = (u_long) l.next_ccb; - cn = 0; - while (cp) { - cn++; - printf ("ccb #%d:\n", cn); - if (!KVM_READ ( - cp, - &c, - sizeof (struct ccb))) - errx(1, "bad kvm read"); - dump_ccb (&c, cp); - cp= (u_long) c.next_ccb; - }; -} - -/*================================================================ -** -** -** Write debug info: struct tcb -** -** -**================================================================ -*/ - -static void dump_tip (struct tcb * tip) -{ - int i; - u_long lp; - - printf ("----------------------\n"); - printf ("struct tcb:\n"); - printf ("----------------------\n"); - - printf (" transfers:%10d.\n", tip->transfers); - printf (" bytes:%10d.\n", tip->bytes ); - printf (" user limits: usrsync=%d usrwide=%d usrtags=%d.\n", - tip->usrsync, tip->usrwide, tip->usrtags); - printf (" sync: minsync=%d, maxoffs=%d, period=%d ns, sval=%x.\n", - tip->minsync, tip->maxoffs, tip->period, tip->sval); - printf (" wide: widedone=%d, wval=%x.\n", - tip->widedone, tip->wval); - - printf (" hold_cp: %x\n", tip->hold_cp); - dump_link (" jump_tcb", &tip->jump_tcb); - dump_link (" call_lun", &tip->call_lun); - dump_link (" jump_lcb", &tip->jump_lcb); - if (tip->hold_cp) printf (" hold_cp: @ %x\n", tip->hold_cp); - printf ("\n"); - - if (strchr (debug_opt, 'l')) { - for (i=0;i<MAX_LUN;i++) { - lp= (u_long) tip->lp[i]; - printf ("logic unit #%d:\n", i); - if (lp) dump_lcb (lp); - }; - } -} - -/*================================================================ -** -** -** Write debug info: struct ncb -** -** -**================================================================ -*/ - - -static void dump_ncr (void) -{ - int i; - - printf ("----------------------\n"); - printf ("struct ncb @ %x:\n", ncr_base); - printf ("----------------------\n"); - - dump_link (" jump_tcb", &ncr.jump_tcb); - printf (" register: @ %x (p=%x)\n", ncr.vaddr, ncr.paddr); - - if (wizard && strchr (debug_opt, 'r')) { - struct ncr_reg reg; - - if (!KVM_READ ( - ncr.vaddr, - ®, - sizeof (reg))) - errx(1, "bad kvm read"); - - printf ("\n"); - dump_reg (®); - }; - - printf (" script: @ %x (p=%x)\n", ncr.script, ncr.p_script); - - printf ("hostscsiaddr: %d\n", ncr.myaddr); - printf (" minsync: %d\n", ncr.minsync); - printf (" scntl3: 0x%02x\n", ncr.rv_scntl3); - printf ("\n"); - - /* sc_link not dumped */ - - if (strchr (debug_opt, 'u')) { - printf (" usercmd: cmd=%x data=%x target=%x lun=%x\n", - ncr.user.cmd, - ncr.user.data, - ncr.user.target, - ncr.user.lun); - }; - - printf (" actccbs: %d\n", ncr.actccbs); - - if (strchr (debug_opt, 'q')) { - - u_long startpos; - - if (!KVM_READ ( - ((u_long)ncr.script - +offsetof(struct script, startpos)), - &startpos, - sizeof (startpos))) - errx(1, "bad kvm read"); - - printf (" startpos: %x\n", startpos); - printf (" slot: %d\n", (startpos- - (ncr.p_script+offsetof(struct scripth, tryloop)))/20); - printf (" squeuput: %d\n", ncr.squeueput); - for (i=0; i<MAX_START; i++) - printf ("%12d: %08x %s\n", i, - ncr.squeue[i], sn(ncr.squeue[i])); - - printf ("\n"); - }; - - printf (" ticks: %d ms\n", ncr.ticks * 10); - printf (" heartbeat: %s", ctime ((time_t*)&ncr.heartbeat)); - printf (" lasttime: %s", ctime ((time_t*)&ncr.lasttime)); - printf ("\n"); - - if (wizard && strchr (debug_opt, 'd') && ncr.regtime) { - printf (" regdump: %s", ctime (&ncr.regtime)); - dump_reg (&ncr.regdump); - }; - - if (strchr (debug_opt, 'p')) { - printf ("\n"); - dump_profile (" profile", &ncr.profile); - }; - - if (strchr (debug_opt, 'h')) { - printf ("\n"); - dump_head ( &ncr.header); - }; - - if (strchr (debug_opt, 'c')) { - dump_ccb (ncr.ccb, ncr_base + offsetof (struct ncb, ccb)); - }; - - if (strchr (debug_opt, 'm')) { - printf (" msgout:"); printm (ncr.msgout,0); printf ("\n"); - printf (" msg in:"); printm (ncr.msgin,0); printf ("\n"); - printf ("\n"); - }; - - if (strchr (debug_opt, 't')) { - struct tcb * tip; - for (i=0;i<MAX_TARGET;i++) { - tip = &ncr.target[i]; - if (!tip->jump_tcb.l_cmd) continue; - printf ("target #%d:\n", i); - dump_tip (tip); - } - } -} - -/*================================================================ -** -** -** D O _ D E B U G -** -** -**================================================================ -*/ - - -void do_debug(char * arg) -{ - open_kvm(O_RDONLY); - debug_opt = arg; - if (strchr (debug_opt, '?')) printf ( -"'?': list debug options [sic].\n" -"'a': show patchfields in ccbs (requires c).\n" -"'c': show ccbs.\n" -"'d': show register dump.\n" -"'h': show header information.\n" -"'m': show message buffers.\n" -"'n': show ncr main control block.\n" -"'p': show profiling information.\n" -"'q': show start queue.\n" -"'r': show registers (*DANGEROUS*).\n" -"'s': show scatter/gather info.\n" -"'t': show target control blocks.\n" -"'u': show user cmd field.\n" -"'x': show generic xfer structure.\n" -"'y': show timestamps.\n" -"\n" - ); - - if (strchr (debug_opt, 'n')) dump_ncr (); - - if (!wizard) - errx(2, "you are NOT a wizard!"); - if (strchr (debug_opt, 'r')) { - struct ncr_reg reg; - if (!KVM_READ ( - ncr.vaddr, - ®, - sizeof (reg))) - errx(1, "bad kvm read"); - dump_reg (®); - }; -} - - -/*================================================================ -** -** -** Main function -** -** -**================================================================ -*/ - -int main(argc, argv) - int argc; - char **argv; -{ - int usageflg=0; - char * charp; - int ch; - int i; - - while ((ch = getopt(argc, argv, "M:N:u:f:t:l:p:s:k:d:vwhin:?")) != -1) - switch((char)ch) { - case 'M': - if (kvm_isopen) - errx(1, "-M: kernel file already open"); - kmemf = optarg; - break; - case 'N': - if (kvm_isopen) - errx(1, "-N: symbol table already open"); - vmunix = optarg; - break; -#ifdef OPT_F - case 'f': - errx(1, "-f: option not yet implemented"); -#endif - - case 'u': - i = strtoul (optarg, &charp, 0); - if (!*optarg || *charp || (i<0)) - errx(1, "bad unit number \"%s\"", optarg); - ncr_unit = i; - break; - case 't': - i = strtoul (optarg, &charp, 0); - if (!*optarg || *charp || (i<0) || (i>=MAX_TARGET)) - errx(1, "bad target number \"%s\" (valid range: 0-%d)", - optarg, MAX_TARGET-1); - target_mask |= 1ul << i; - break; - case 'n': - open_kvm(O_RDONLY); - i = strtoul (optarg, &charp, 0); - printf ("addr %d (0x%x) has label %s.\n", - i,i,sn(i)); - break; - case 'l': - i = strtoul (optarg, &charp, 0); - if (!*optarg || *charp || (i<0) || (i>=MAX_LUN)) - errx(1, - "bad logic unit number \"%s\" (valid range: 0-%d)", - optarg, MAX_LUN); - global_lun_mask |= 1ul << i; - break; - case 'p': - i = strtoul (optarg, &charp, 0); - if (!*optarg || *charp || (i<1) || (i>60)) - errx(1, "bad interval \"%s\"", optarg); - interval = i; - do_profile(); - break; - - case 'w': - if(geteuid()==0) - wizard=1; - break; - case 'v': - verbose++; - break; - case 'i': - do_info(); - break; - - case 's': - do_set(optarg); - break; - case 'd': - do_debug(optarg); - break; - case 'k': - do_kill(optarg); - break; - case 'h': - case '?': - usageflg++; - break; - default: - warnx("illegal option \"%c\"", ch); - usageflg++; - } - - argv += optind; - argc -= optind; - - if (argc) - warnx("rest of line starting with \"%s\" ignored", *argv); - - if (verbose&&!kvm_isopen) usageflg++; - if (usageflg) { - usage(); - if (verbose) fprintf (stderr, ident); - exit (1); - } - - if (!kvm_isopen) { - do_info(); - do_profile(); - }; - exit (0); -} - - -static void -usage (void) -{ - fprintf (stderr, "%s\n%s\n%s\n%s\n%s\n", -"usage: ncrcontrol [-M core] [-N system] [-u unit] [-v] [-v] -i", -" ncrcontrol [-N system] [-u unit] [-p wait]", -" ncrcontrol [-N system] [-u unit] [-t target] -s name=value", -" ncrcontrol [-M core] [-N system] [-u unit] [-t target] -d debug", -" ncrcontrol [-N system] [-u unit] -w -k torture"); -} |
