Annotation of sys/arch/mvme68k/dev/vsvar.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: vsvar.h,v 1.6 2004/07/30 22:29:45 miod Exp $ */
! 2: /*
! 3: * Copyright (c) 1999 Steve Murphree, Jr.
! 4: * Copyright (c) 1990 The Regents of the University of California.
! 5: * All rights reserved.
! 6: *
! 7: * This code is derived from software contributed to Berkeley by
! 8: * Van Jacobson of Lawrence Berkeley Laboratory.
! 9: *
! 10: * Redistribution and use in source and binary forms, with or without
! 11: * modification, are permitted provided that the following conditions
! 12: * are met:
! 13: * 1. Redistributions of source code must retain the above copyright
! 14: * notice, this list of conditions and the following disclaimer.
! 15: * 2. Redistributions in binary form must reproduce the above copyright
! 16: * notice, this list of conditions and the following disclaimer in the
! 17: * documentation and/or other materials provided with the distribution.
! 18: * 3. Neither the name of the University nor the names of its contributors
! 19: * may be used to endorse or promote products derived from this software
! 20: * without specific prior written permission.
! 21: *
! 22: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
! 23: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 24: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 25: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
! 26: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 27: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 28: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 29: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 30: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 31: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 32: * SUCH DAMAGE.
! 33: */
! 34: #ifndef _VSVAR_H_
! 35: #define _VSVAR_H_
! 36:
! 37: /*
! 38: * The largest single request will be MAXPHYS bytes which will require
! 39: * at most MAXPHYS/NBPG+1 chain elements to describe, i.e. if none of
! 40: * the buffer pages are physically contiguous (MAXPHYS/NBPG) and the
! 41: * buffer is not page aligned (+1).
! 42: */
! 43: #define DMAMAXIO (MAXPHYS/NBPG+1)
! 44: #define LO(x) (u_short)((unsigned long)x & 0x0000FFFF)
! 45: #define HI(x) (u_short)((unsigned long)x >> 16)
! 46: #define OFF(x) (u_short)((long)kvtop((vaddr_t)x) - (long)kvtop((vaddr_t)sc->sc_vsreg))
! 47:
! 48: struct vs_tinfo {
! 49: int cmds; /* #commands processed */
! 50: int dconns; /* #disconnects */
! 51: int touts; /* #timeouts */
! 52: int perrs; /* #parity errors */
! 53: int senses; /* #request sense commands sent */
! 54: ushort lubusy; /* What local units/subr. are busy? */
! 55: u_char flags;
! 56: u_char period; /* Period suggestion */
! 57: u_char offset; /* Offset suggestion */
! 58: int avail; /* Is there a device there */
! 59: } tinfo_t;
! 60:
! 61: struct vs_softc {
! 62: struct device sc_dev;
! 63: struct intrhand sc_ih_e, sc_ih_n;
! 64: char sc_intrname_e[16 + 4];
! 65: u_short sc_ipl;
! 66: u_short sc_evec;
! 67: u_short sc_nvec;
! 68: struct scsi_link sc_link; /* proto for sub devices */
! 69: u_long sc_chnl; /* channel 0 or 1 for dual bus cards */
! 70: u_long sc_qhp; /* Command queue head pointer */
! 71: struct vsreg *sc_vsreg;
! 72: #define SIOP_NACB 8
! 73: struct vs_tinfo sc_tinfo[8];
! 74: u_char sc_flags;
! 75: u_char sc_sien;
! 76: u_char sc_dien;
! 77: u_char sc_minsync;
! 78: struct map *hus_map;
! 79: /* one for each target */
! 80: struct syncpar {
! 81: u_char state;
! 82: u_char sxfer;
! 83: u_char sbcl;
! 84: } sc_sync[8];
! 85: };
! 86:
! 87: /* sync states */
! 88: #define SYNC_START 0 /* no sync handshake started */
! 89: #define SYNC_SENT 1 /* we sent sync request, no answer yet */
! 90: #define SYNC_DONE 2 /* target accepted our (or inferior) settings,
! 91: or it rejected the request and we stay async */
! 92:
! 93: #define IOPB_SCSI 0x20
! 94: #define IOPB_RESET 0x22
! 95: #define IOPB_INIT 0x41
! 96: #define IOPB_WQINIT 0x42
! 97: #define IOPB_DEV_RESET 0x4D
! 98:
! 99: #define OPT_INTEN 0x0001
! 100: #define OPT_INTDIS 0x0000
! 101: #define OPT_SG 0x0002
! 102: #define OPT_SST 0x0004
! 103: #define OPT_SIT 0x0040
! 104: #define OPT_READ 0x0000
! 105: #define OPT_WRITE 0x0100
! 106:
! 107: #define AM_S32 0x01
! 108: #define AM_S16 0x05
! 109: #define AM_16 0x0100
! 110: #define AM_32 0x0200
! 111: #define AM_SHORT 0x0300
! 112: #define AM_NORMAL 0x0000
! 113: #define AM_BLOCK 0x0400
! 114: #define AM_D64BLOCK 0x0C00
! 115:
! 116: #define WQO_AE 0x0001 /* abort enable bit */
! 117: #define WQO_FOE 0x0004 /* freeze on error */
! 118: #define WQO_PE 0x0008 /* parity enable bit */
! 119: #define WQO_ARE 0x0010 /* autosense recovery enable bit */
! 120: #define WQO_RFWQ 0x0020 /* report frozen work queue bit */
! 121: #define WQO_INIT 0x8000 /* work queue init bit */
! 122:
! 123: void vs_minphys(struct buf *bp);
! 124: int vs_scsicmd(struct scsi_xfer *);
! 125:
! 126: #endif /* _M328VAR_H */
CVSweb