1 /* $OpenBSD: adv.h,v 1.5 2002/03/14 01:26:53 millert Exp $ */ 2 /* $NetBSD: adv.h,v 1.3 1998/09/26 16:02:56 dante Exp $ */ 3 4 /* 5 * Generic driver definitions and exported functions for the Advanced 6 * Systems Inc. Narrow SCSI controllers 7 * 8 * Copyright (c) 1998 The NetBSD Foundation, Inc. 9 * All rights reserved. 10 * 11 * Author: Baldassare Dante Profeta <dante@mclink.it> 12 * 13 * Redistribution and use in source and binary forms, with or without 14 * modification, are permitted provided that the following conditions 15 * are met: 16 * 1. Redistributions of source code must retain the above copyright 17 * notice, this list of conditions and the following disclaimer. 18 * 2. Redistributions in binary form must reproduce the above copyright 19 * notice, this list of conditions and the following disclaimer in the 20 * documentation and/or other materials provided with the distribution. 21 * 3. All advertising materials mentioning features or use of this software 22 * must display the following acknowledgement: 23 * This product includes software developed by the NetBSD 24 * Foundation, Inc. and its contributors. 25 * 4. Neither the name of The NetBSD Foundation nor the names of its 26 * contributors may be used to endorse or promote products derived 27 * from this software without specific prior written permission. 28 * 29 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 30 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 31 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 32 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 33 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 34 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 35 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 36 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 37 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 38 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 39 * POSSIBILITY OF SUCH DAMAGE. 40 */ 41 42 #ifndef _ADVANSYS_NARROW_H_ 43 #define _ADVANSYS_NARROW_H_ 44 45 #include <dev/ic/advlib.h> 46 47 /******************************************************************************/ 48 49 struct adv_ccb 50 { 51 ASC_SG_HEAD sghead; 52 ASC_SCSI_Q scsiq; 53 54 struct scsi_sense_data scsi_sense; 55 56 TAILQ_ENTRY(adv_ccb) chain; 57 struct scsi_xfer *xs; /* the scsi_xfer for this cmd */ 58 int flags; /* see below */ 59 60 int timeout; 61 /* 62 * This DMA map maps the buffer involved in the transfer. 63 */ 64 bus_dmamap_t dmamap_xfer; 65 }; 66 67 typedef struct adv_ccb ADV_CCB; 68 69 /* flags for ADV_CCB */ 70 #define CCB_ALLOC 0x01 71 #define CCB_ABORT 0x02 72 #define CCB_WATCHDOG 0x10 73 74 75 #define ADV_MAX_CCB 32 76 77 struct adv_control 78 { 79 ADV_CCB ccbs[ADV_MAX_CCB]; /* all our control blocks */ 80 }; 81 82 /* 83 * Offset of a CCB from the beginning of the control DMA mapping. 84 */ 85 #define ADV_CCB_OFF(c) (offsetof(struct adv_control, ccbs[0]) + \ 86 (((u_long)(c)) - ((u_long)&sc->sc_control->ccbs[0]))) 87 88 /******************************************************************************/ 89 90 int adv_init(ASC_SOFTC *sc); 91 void adv_attach(ASC_SOFTC *sc); 92 int adv_intr(void *arg); 93 94 /******************************************************************************/ 95 96 #endif /* _ADVANSYS_NARROW_H_ */