Merge from vendor branch LESS:
[dragonfly.git] / sys / dev / disk / nsp / nspvar.h
1 /*      $FreeBSD: src/sys/dev/nsp/nspvar.h,v 1.1.2.4 2001/12/17 13:30:19 non Exp $      */
2 /*      $DragonFly: src/sys/dev/disk/nsp/nspvar.h,v 1.4 2004/02/12 00:00:16 dillon Exp $        */
3 /*      $NecBSD: nspvar.h,v 1.7.14.5 2001/06/29 06:27:54 honda Exp $    */
4 /*      $NetBSD$        */
5
6 /*
7  * [NetBSD for NEC PC-98 series]
8  *  Copyright (c) 1998, 1999, 2000, 2001
9  *      NetBSD/pc98 porting staff. All rights reserved.
10  *
11  *  Copyright (c) 1998, 1999, 2000, 2001
12  *      Naofumi HONDA. All rights reserved.
13  * 
14  *  Redistribution and use in source and binary forms, with or without
15  *  modification, are permitted provided that the following conditions
16  *  are met:
17  *  1. Redistributions of source code must retain the above copyright
18  *     notice, this list of conditions and the following disclaimer.
19  *  2. Redistributions in binary form must reproduce the above copyright
20  *     notice, this list of conditions and the following disclaimer in the
21  *     documentation and/or other materials provided with the distribution.
22  *  3. The name of the author may not be used to endorse or promote products
23  *     derived from this software without specific prior written permission.
24  * 
25  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
26  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
27  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
29  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
33  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35  * POSSIBILITY OF SUCH DAMAGE.
36  */
37
38 #ifndef _NSPVAR_H_
39 #define _NSPVAR_H_
40
41 /*****************************************************************
42  * Host adapter structure
43  *****************************************************************/
44 struct nsp_softc {
45         struct scsi_low_softc sc_sclow;         /* generic data */
46
47 #ifdef  __NetBSD__
48         bus_space_tag_t sc_iot;
49         bus_space_handle_t sc_ioh;
50         bus_space_tag_t sc_memt;
51         bus_space_handle_t sc_memh;
52
53         void *sc_ih;
54 #endif  /* __NetBSD__ */
55
56 #ifdef __DragonFly__
57         bus_space_tag_t sc_iot;
58         bus_space_handle_t sc_ioh;
59         bus_space_tag_t sc_memt;
60         bus_space_handle_t sc_memh;
61
62         int port_rid;
63         int irq_rid;
64         int mem_rid;
65         struct resource *port_res;
66         struct resource *irq_res;
67         struct resource *mem_res;
68
69         void *nsp_intrhand;
70 #endif  /* __DragonFly__ */
71
72         int sc_tmaxcnt;                         /* timeout count */
73         int sc_seltout;                         /* selection timeout counter */
74         int sc_timer;                           /* timer start */
75
76         int sc_suspendio;                       /* SMIT: data suspendio bytes */
77         u_int8_t sc_xfermr;                     /* SMIT: fifo control reg */
78         int sc_dataout_timeout;                 /* data out timeout counter */
79
80         u_int sc_idbit;                         /* host id bit pattern */
81         u_int sc_cnt;                           /* fifo R/W count (host) */
82
83         u_int8_t sc_iclkdiv;                    /* scsi chip clock divisor */
84         u_int8_t sc_clkdiv;                     /* asic chip clock divisor */
85         u_int8_t sc_icr;                        /* interrupt control reg */
86
87         u_int8_t sc_busc;                       /* busc registers */
88         u_int8_t sc_parr;                       /* parity control register */
89 };
90
91 /*****************************************************************
92  * Lun information 
93  *****************************************************************/
94 struct nsp_targ_info {
95         struct targ_info nti_ti;                /* generic lun info */
96
97         u_int8_t nti_reg_syncr;                 /* sync registers per devices */
98         u_int8_t nti_reg_ackwidth;              /* ackwidth per devices */
99 };
100
101 /*****************************************************************
102  * Proto
103  *****************************************************************/
104 int nspprobesubr (bus_space_tag_t, bus_space_handle_t, u_int);
105 void nspattachsubr (struct nsp_softc *);
106 int nspprint (void *, const char *);
107 int nspintr (void *);
108
109 #if     defined(i386)
110 #define SOFT_INTR_REQUIRED(slp) (softintr((slp)->sl_irq))
111 #else   /* !i386 */
112 #define SOFT_INTR_REQUIRED(slp)
113 #endif  /* !i386 */
114 #endif  /* !_NSPVAR_H_ */