Annotation of sys/dev/ic/adw.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: adw.h,v 1.9 2002/03/14 01:26:53 millert Exp $ */
! 2: /* $NetBSD: adw.h,v 1.9 2000/05/26 15:13:43 dante Exp $ */
! 3:
! 4: /*
! 5: * Generic driver definitions and exported functions for the Advanced
! 6: * Systems Inc. SCSI controllers
! 7: *
! 8: * Copyright (c) 1998, 1999, 2000 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_WIDE_H_
! 43: #define _ADVANSYS_WIDE_H_
! 44:
! 45: /******************************************************************************/
! 46:
! 47: typedef int (* ADW_ISR_CALLBACK) (ADW_SOFTC *, ADW_SCSI_REQ_Q *);
! 48: typedef void (* ADW_ASYNC_CALLBACK) (ADW_SOFTC *, u_int8_t);
! 49:
! 50:
! 51: /*
! 52: * per request scatter-gather element limit
! 53: * We could have up to 256 SG lists.
! 54: */
! 55: #define ADW_MAX_SG_LIST 255
! 56:
! 57: /*
! 58: * Scatter-Gather Definitions per request.
! 59: */
! 60:
! 61: #define NO_OF_SG_PER_BLOCK 15
! 62:
! 63: /* Number of SG blocks needed. */
! 64: #define ADW_NUM_SG_BLOCK \
! 65: ((ADW_MAX_SG_LIST + (NO_OF_SG_PER_BLOCK - 1))/NO_OF_SG_PER_BLOCK)
! 66:
! 67:
! 68: struct adw_ccb {
! 69: ADW_SCSI_REQ_Q scsiq;
! 70: ADW_SG_BLOCK sg_block[ADW_NUM_SG_BLOCK];
! 71:
! 72: struct scsi_sense_data scsi_sense;
! 73:
! 74: TAILQ_ENTRY(adw_ccb) chain;
! 75: struct adw_ccb *nexthash;
! 76: u_int32_t hashkey;
! 77:
! 78: struct scsi_xfer *xs; /* the scsi_xfer for this cmd */
! 79: int flags; /* see below */
! 80:
! 81: int timeout;
! 82:
! 83: /*
! 84: * This DMA map maps the buffer involved in the transfer.
! 85: */
! 86: bus_dmamap_t dmamap_xfer;
! 87: };
! 88:
! 89: typedef struct adw_ccb ADW_CCB;
! 90:
! 91: /* flags for ADW_CCB */
! 92: #define CCB_ALLOC 0x01
! 93: #define CCB_ABORTING 0x02
! 94: #define CCB_ABORTED 0x04
! 95:
! 96:
! 97: #define ADW_MAX_CCB 63 /* Max. number commands per device (63) */
! 98:
! 99: struct adw_control {
! 100: ADW_CCB ccbs[ADW_MAX_CCB]; /* all our control blocks */
! 101: ADW_CARRIER *carriers; /* all our carriers */
! 102: };
! 103:
! 104: /*
! 105: * Offset of a CCB from the beginning of the control DMA mapping.
! 106: */
! 107: #define ADW_CCB_OFF(c) (offsetof(struct adw_control, ccbs[0]) + \
! 108: (((u_long)(c)) - ((u_long)&sc->sc_control->ccbs[0])))
! 109:
! 110: /******************************************************************************/
! 111:
! 112: int adw_init(ADW_SOFTC *sc);
! 113: void adw_attach(ADW_SOFTC *sc);
! 114: int adw_intr(void *arg);
! 115: ADW_CCB *adw_ccb_phys_kv(ADW_SOFTC *, u_int32_t);
! 116:
! 117: /******************************************************************************/
! 118:
! 119: #endif /* _ADVANSYS_ADW_H_ */
CVSweb