Annotation of sys/arch/mvme68k/dev/sshvar.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: sshvar.h,v 1.5 2004/07/30 22:29:45 miod Exp $ */
! 2:
! 3: /*
! 4: * Copyright (c) 1995 Theo de Raadt
! 5: * Copyright (c) 1990 The Regents of the University of California.
! 6: * All rights reserved.
! 7: *
! 8: * This code is derived from software contributed to Berkeley by
! 9: * Van Jacobson of Lawrence Berkeley Laboratory.
! 10: *
! 11: * Redistribution and use in source and binary forms, with or without
! 12: * modification, are permitted provided that the following conditions
! 13: * are met:
! 14: * 1. Redistributions of source code must retain the above copyright
! 15: * notice, this list of conditions and the following disclaimer.
! 16: * 2. Redistributions in binary form must reproduce the above copyright
! 17: * notice, this list of conditions and the following disclaimer in the
! 18: * documentation and/or other materials provided with the distribution.
! 19: * 3. Neither the name of the University nor the names of its contributors
! 20: * may be used to endorse or promote products derived from this software
! 21: * without specific prior written permission.
! 22: *
! 23: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
! 24: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 25: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 26: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
! 27: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 28: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 29: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 30: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 31: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 32: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 33: * SUCH DAMAGE.
! 34: *
! 35: * @(#)sshvar.h 7.1 (Berkeley) 5/8/90
! 36: */
! 37: #ifndef _SSHVAR_H_
! 38: #define _SSHVAR_H_
! 39:
! 40: /*
! 41: * The largest single request will be MAXPHYS bytes which will require
! 42: * at most MAXPHYS/NBPG+1 chain elements to describe, i.e. if none of
! 43: * the buffer pages are physically contiguous (MAXPHYS/NBPG) and the
! 44: * buffer is not page aligned (+1).
! 45: */
! 46: #define DMAMAXIO (MAXPHYS/NBPG+1)
! 47:
! 48: /*
! 49: * Data Structure for SCRIPTS program
! 50: */
! 51: struct ssh_ds {
! 52: /*00*/ long scsi_addr; /* SCSI ID & sync */
! 53: /*04*/ long idlen; /* Identify message */
! 54: /*08*/ char *idbuf;
! 55: /*0c*/ long cmdlen; /* SCSI command */
! 56: /*10*/ char *cmdbuf;
! 57: /*14*/ long stslen; /* Status */
! 58: /*18*/ char *stsbuf;
! 59: /*1c*/ long msglen; /* Message */
! 60: /*20*/ char *msgbuf;
! 61: /*24*/ long msginlen; /* Message in */
! 62: /*28*/ char *msginbuf;
! 63: /*2c*/ long extmsglen; /* Extended message in */
! 64: /*30*/ char *extmsgbuf;
! 65: /*34*/ long synmsglen; /* Sync transfer request */
! 66: /*38*/ char *synmsgbuf;
! 67: struct {
! 68: /*3c*/ long datalen;
! 69: /*40*/ char *databuf;
! 70: } chain[DMAMAXIO];
! 71: };
! 72:
! 73: /*
! 74: * ACB. Holds additional information for each SCSI command Comments: We
! 75: * need a separate scsi command block because we may need to overwrite it
! 76: * with a request sense command. Basicly, we refrain from fiddling with
! 77: * the scsi_xfer struct (except do the expected updating of return values).
! 78: * We'll generally update: xs->{flags,resid,error,sense,status} and
! 79: * occasionally xs->retries.
! 80: */
! 81: struct ssh_acb {
! 82: /*00*/ TAILQ_ENTRY(ssh_acb) chain;
! 83: /*08*/ struct scsi_xfer *xs; /* SCSI xfer ctrl block from above */
! 84: /*0c*/ int flags; /* Status */
! 85: #define ACB_FREE 0x00
! 86: #define ACB_ACTIVE 0x01
! 87: #define ACB_DONE 0x04
! 88: #define ACB_CHKSENSE 0x08
! 89: /*10*/ struct scsi_generic cmd; /* SCSI command block */
! 90: /*1c*/ struct ssh_ds ds;
! 91: /*a0*/ void *iob_buf;
! 92: /*a4*/ u_long iob_curbuf;
! 93: /*a8*/ u_long iob_len, iob_curlen;
! 94: /*b0*/ u_char msgout[6];
! 95: /*b6*/ u_char msg[6];
! 96: /*bc*/ u_char stat[1];
! 97: /*bd*/ u_char status;
! 98: /*be*/ u_char dummy[2];
! 99: /*c0*/ int clen;
! 100: /*c4*/ char *daddr; /* Saved data pointer */
! 101: /*c8*/ int dleft; /* Residue */
! 102: };
! 103:
! 104: /*
! 105: * Some info about each (possible) target on the SCSI bus. This should
! 106: * probably have been a "per target+lunit" structure, but we'll leave it at
! 107: * this for now. Is there a way to reliably hook it up to sc->fordriver??
! 108: */
! 109: struct ssh_tinfo {
! 110: int cmds; /* #commands processed */
! 111: int dconns; /* #disconnects */
! 112: int touts; /* #timeouts */
! 113: int perrs; /* #parity errors */
! 114: int senses; /* #request sense commands sent */
! 115: ushort lubusy; /* What local units/subr. are busy? */
! 116: u_char flags;
! 117: u_char period; /* Period suggestion */
! 118: u_char offset; /* Offset suggestion */
! 119: } tinfo_t;
! 120:
! 121: struct ssh_softc {
! 122: struct device sc_dev;
! 123: struct intrhand sc_ih;
! 124:
! 125: u_char sc_istat;
! 126: u_char sc_dstat;
! 127: u_char sc_sstat0;
! 128: u_char sc_sstat1;
! 129: u_long sc_intcode;
! 130: struct scsi_link sc_link; /* proto for sub devices */
! 131: u_long sc_scriptspa; /* physical address of scripts */
! 132: ssh_regmap_p sc_sshp; /* the SSH */
! 133: u_long sc_active; /* number of active I/O's */
! 134:
! 135: /* Lists of command blocks */
! 136: TAILQ_HEAD(acb_list, ssh_acb) free_list,
! 137: ready_list,
! 138: nexus_list;
! 139:
! 140: struct ssh_acb *sc_nexus; /* current command */
! 141: #define SSH_NACB 8
! 142: struct ssh_acb *sc_acb; /* the real command blocks */
! 143: struct ssh_tinfo sc_tinfo[8];
! 144:
! 145: u_short sc_clock_freq;
! 146: u_char sc_dcntl;
! 147: u_char sc_ctest7;
! 148: u_short sc_tcp[4];
! 149: u_char sc_flags;
! 150: u_char sc_sien;
! 151: u_char sc_dien;
! 152: u_char sc_minsync;
! 153: /* one for each target */
! 154: struct syncpar {
! 155: u_char state;
! 156: u_char sxfer;
! 157: u_char sbcl;
! 158: } sc_sync[8];
! 159: };
! 160:
! 161: /* sc_flags */
! 162: #define SSH_INTSOFF 0x80 /* Interrupts turned off */
! 163: #define SSH_INTDEFER 0x40 /* Level 6 interrupt has been deferred */
! 164: #define SSH_ALIVE 0x01 /* controller initialized */
! 165: #define SSH_SELECTED 0x04 /* bus is in selected state. Needed for
! 166: correct abort procedure. */
! 167:
! 168: /* sync states */
! 169: #define SYNC_START 0 /* no sync handshake started */
! 170: #define SYNC_SENT 1 /* we sent sync request, no answer yet */
! 171: #define SYNC_DONE 2 /* target accepted our (or inferior) settings,
! 172: or it rejected the request and we stay async */
! 173:
! 174: #define MSG_CMD_COMPLETE 0x00
! 175: #define MSG_EXT_MESSAGE 0x01
! 176: #define MSG_SAVE_DATA_PTR 0x02
! 177: #define MSG_RESTORE_PTR 0x03
! 178: #define MSG_DISCONNECT 0x04
! 179: #define MSG_INIT_DETECT_ERROR 0x05
! 180: #define MSG_ABORT 0x06
! 181: #define MSG_REJECT 0x07
! 182: #define MSG_NOOP 0x08
! 183: #define MSG_PARITY_ERROR 0x09
! 184: #define MSG_BUS_DEVICE_RESET 0x0C
! 185: #define MSG_IDENTIFY 0x80
! 186: #define MSG_IDENTIFY_DR 0xc0 /* (disconnect/reconnect allowed) */
! 187: #define MSG_SYNC_REQ 0x01
! 188:
! 189: #define STS_CHECKCOND 0x02 /* Check Condition (ie., read sense) */
! 190: #define STS_CONDMET 0x04 /* Condition Met (ie., search worked) */
! 191: #define STS_BUSY 0x08
! 192: #define STS_INTERMED 0x10 /* Intermediate status sent */
! 193: #define STS_EXT 0x80 /* Extended status valid */
! 194:
! 195: void ssh_minphys(struct buf *bp);
! 196: int ssh_scsicmd(struct scsi_xfer *);
! 197:
! 198: #endif /* _SSHVAR_H */
CVSweb