Merge from vendor branch FILE:
[dragonfly.git] / sys / dev / disk / stg / tmc18c30var.h
1 /*      $FreeBSD: src/sys/dev/stg/tmc18c30var.h,v 1.1.2.4 2001/12/17 13:30:19 non Exp $ */
2 /*      $DragonFly: src/sys/dev/disk/stg/tmc18c30var.h,v 1.4 2004/02/12 00:00:18 dillon Exp $   */
3 /*      $NecBSD: tmc18c30var.h,v 1.12.18.2 2001/06/13 05:51:23 honda Exp $      */
4 /*      $NetBSD$        */
5
6 /*
7  * [NetBSD for NEC PC-98 series]
8  *  Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001
9  *      NetBSD/pc98 porting staff. All rights reserved.
10  *  Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001
11  *      Naofumi HONDA. All rights reserved.
12  *  Copyright (c) 1996, 1997, 1998
13  *      Kouichi Matsuda. All rights reserved.
14  * 
15  *  Redistribution and use in source and binary forms, with or without
16  *  modification, are permitted provided that the following conditions
17  *  are met:
18  *  1. Redistributions of source code must retain the above copyright
19  *     notice, this list of conditions and the following disclaimer.
20  *  2. Redistributions in binary form must reproduce the above copyright
21  *     notice, this list of conditions and the following disclaimer in the
22  *     documentation and/or other materials provided with the distribution.
23  *  3. The name of the author may not be used to endorse or promote products
24  *     derived from this software without specific prior written permission.
25  * 
26  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
27  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
30  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38
39 #ifndef _TMC18C30VAR_H_
40 #define _TMC18C30VAR_H_
41
42 /*****************************************************************
43  * Host adapter structure
44  *****************************************************************/
45 struct stg_softc {
46         struct scsi_low_softc sc_sclow; /* generic data */
47
48 #ifdef  __NetBSD__
49         bus_space_tag_t sc_iot;
50         bus_space_tag_t sc_memt;
51         bus_space_handle_t sc_ioh;
52
53         void *sc_ih;
54 #endif  /* __NetBSD__ */
55
56 #ifdef  __DragonFly__
57         bus_space_tag_t sc_iot;
58         bus_space_tag_t sc_memt;
59         bus_space_handle_t sc_ioh;
60
61         int port_rid;
62         int irq_rid;
63         int mem_rid;
64         struct resource *port_res;
65         struct resource *irq_res;
66         struct resource *mem_res;
67
68         void *stg_intrhand;
69 #endif  /* __DragonFly__ */
70
71         int sc_tmaxcnt;
72         u_int sc_chip;                  /* chip type */
73         u_int sc_fsz;                   /* fifo size */
74         u_int sc_idbit;                 /* host id bit */
75         u_int sc_wthold;                /* write thread */
76         u_int sc_rthold;                /* read thread */
77         u_int sc_maxwsize;              /* max write size */
78         int sc_dataout_timeout;         /* data out timeout counter */
79         int sc_ubf_timeout;             /* unexpected bus free timeout */
80
81         u_int8_t sc_fcWinit;            /* write flags */
82         u_int8_t sc_fcRinit;            /* read flags */
83
84         u_int8_t sc_icinit;             /* interrupt masks */
85         u_int8_t sc_busc;               /* default bus control register */
86         u_int8_t sc_imsg;               /* identify msg required */
87         u_int8_t sc_busimg;             /* bus control register image */
88 };
89
90 /*****************************************************************
91  * Lun information 
92  *****************************************************************/
93 struct stg_targ_info {
94         struct targ_info sti_ti;                /* generic data */
95
96         u_int8_t sti_reg_synch;         /* synch register per lun */
97 };
98
99 /*****************************************************************
100  * Proto
101  *****************************************************************/
102 int stgprobesubr (bus_space_tag_t, bus_space_handle_t, u_int);
103 void stgattachsubr (struct stg_softc *);
104 int stgprint (void *, const char *);
105 int stgintr (void *);
106
107 #if     defined(i386)
108 #define SOFT_INTR_REQUIRED(slp) (softintr((slp)->sl_irq))
109 #else   /* !i386 */
110 #define SOFT_INTR_REQUIRED(slp)
111 #endif  /* !i386 */
112 #endif  /* !_TMC18C30VAR_H_ */