2 * Copyright (c) 1997 by Simon Shapiro
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions, and the following disclaimer,
10 * without modification, immediately at the beginning of the file.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 /* dpt_ctlinfo.c: Dunp a DPT HBA Information Block */
41 #include <sys/queue.h>
42 #include <sys/ioctl.h>
43 #include <scsi/scsi_all.h>
44 #include <scsi/scsi_message.h>
45 #include <scsi/scsiconf.h>
47 #define DPT_MEASURE_PERFORMANCE
53 main(int argc, char **argv, char **argp)
56 dpt_compat_ha_t compat_softc;
62 if ( (fd = open(argv[1], O_RDWR, S_IRUSR | S_IWUSR)) == -1 ) {
63 (void)fprintf(stderr, "%s ERROR: Failed to open \"%s\" - %s\n",
64 argv[0], argv[1], strerror(errno));
68 pass_thru.eataID[0] = 'E';
69 pass_thru.eataID[1] = 'A';
70 pass_thru.eataID[2] = 'T';
71 pass_thru.eataID[3] = 'A';
72 pass_thru.command = DPT_CTRLINFO;
73 pass_thru.command_buffer = (u_int8_t *)&compat_softc;
75 if ( (result = ioctl(fd, DPT_IOCTL_SEND, &pass_thru)) != 0 ) {
76 (void)fprintf(stderr, "%s ERROR: Failed to send IOCTL "
78 argv[0], DPT_IOCTL_SEND,
83 (void)fprintf(stdout, "%x:", compat_softc.ha_state);
85 for (ndx = 0; ndx < MAX_CHANNELS; ndx++)
86 (void)fprintf(stdout, (ndx == (MAX_CHANNELS - 1)) ? "%d:" :
88 compat_softc.ha_id[ndx]);
90 (void)fprintf(stdout, "%d:", compat_softc.ha_vect);
91 (void)fprintf(stdout, "%x:", compat_softc.ha_base);
92 (void)fprintf(stdout, "%d:", compat_softc.ha_max_jobs);
94 switch (compat_softc.ha_cache) {
96 (void)fprintf(stdout, "No Cache:");
98 case DPT_CACHE_WRITETHROUGH:
99 (void)fprintf(stdout, "WriteThrough:");
101 case DPT_CACHE_WRITEBACK:
102 (void)fprintf(stdout, "WriteBack:");
105 (void)fprintf(stdout, "UnKnown (%d):", compat_softc.ha_cache);
108 (void)fprintf(stdout, "%d:", compat_softc.ha_cachesize);
109 (void)fprintf(stdout, "%d:", compat_softc.ha_nbus);
110 (void)fprintf(stdout, "%d:", compat_softc.ha_ntargets);
111 (void)fprintf(stdout, "%d:", compat_softc.ha_nluns);
112 (void)fprintf(stdout, "%d:", compat_softc.ha_tshift);
113 (void)fprintf(stdout, "%d:", compat_softc.ha_bshift);
115 (void)fprintf(stdout, "%d:", compat_softc.ha_npend);
116 (void)fprintf(stdout, "%d:", compat_softc.ha_active_jobs);
118 (void)fprintf(stdout, "%s\n", compat_softc.ha_fw_version);