FreeBSD/Linux Kernel Cross Reference
sys/dev/ic/adw.h
1 /* $NetBSD: adw.h,v 1.15 2019/12/15 16:48:27 tsutsui Exp $ */
2
3 /*
4 * Generic driver definitions and exported functions for the Advanced
5 * Systems Inc. SCSI controllers
6 *
7 * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
8 * All rights reserved.
9 *
10 * Author: Baldassare Dante Profeta <dante@mclink.it>
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34 #ifndef _ADVANSYS_WIDE_H_
35 #define _ADVANSYS_WIDE_H_
36
37 /******************************************************************************/
38
39 typedef int (* ADW_ISR_CALLBACK) (ADW_SOFTC *, ADW_SCSI_REQ_Q *);
40 typedef void (* ADW_ASYNC_CALLBACK) (ADW_SOFTC *, u_int8_t);
41
42
43 /*
44 * per request scatter-gather element limit
45 * We could have up to 256 SG lists.
46 */
47 #define ADW_MAX_SG_LIST 255
48
49 /*
50 * Scatter-Gather Definitions per request.
51 */
52
53 #define NO_OF_SG_PER_BLOCK 15
54
55 /* Number of SG blocks needed. */
56 #define ADW_NUM_SG_BLOCK \
57 ((ADW_MAX_SG_LIST + (NO_OF_SG_PER_BLOCK - 1))/NO_OF_SG_PER_BLOCK)
58
59
60 struct adw_ccb {
61 ADW_SCSI_REQ_Q scsiq;
62 ADW_SG_BLOCK sg_block[ADW_NUM_SG_BLOCK];
63
64 struct scsi_sense_data scsi_sense;
65
66 TAILQ_ENTRY(adw_ccb) chain;
67 struct adw_ccb *nexthash;
68 u_int32_t hashkey;
69
70 struct scsipi_xfer *xs; /* the scsipi_xfer for this cmd */
71 int flags; /* see below */
72
73 int timeout;
74 /*
75 * This DMA map maps the buffer involved in the transfer.
76 */
77 bus_dmamap_t dmamap_xfer;
78 };
79
80 typedef struct adw_ccb ADW_CCB;
81
82 /* flags for ADW_CCB */
83 #define CCB_ALLOC 0x01
84 #define CCB_ABORTING 0x02
85 #define CCB_ABORTED 0x04
86
87
88 #define ADW_MAX_CCB 63 /* Max. number commands per device (63) */
89
90 struct adw_control {
91 ADW_CCB ccbs[ADW_MAX_CCB]; /* all our control blocks */
92 ADW_CARRIER *carriers; /* all our carriers */
93 };
94
95 /*
96 * Offset of a CCB from the beginning of the control DMA mapping.
97 */
98 #define ADW_CCB_OFF(c) (offsetof(struct adw_control, ccbs[0]) + \
99 (((u_long)(c)) - ((u_long)&sc->sc_control->ccbs[0])))
100
101 /******************************************************************************/
102
103 int adw_init(ADW_SOFTC *);
104 void adw_attach(ADW_SOFTC *);
105 int adw_intr(void *);
106 ADW_CCB *adw_ccb_phys_kv(ADW_SOFTC *, u_int32_t);
107
108 /******************************************************************************/
109
110 #endif /* _ADVANSYS_ADW_H_ */
Cache object: 18cad83cf558b2dd1160341309ec528e
|