FreeBSD/Linux Kernel Cross Reference
sys/i386/isa/bs/bsif.h
1 /* $NecBSD: bsif.h,v 1.5 1997/10/23 20:52:34 honda Exp $ */
2 /* $FreeBSD: releng/5.2/sys/i386/isa/bs/bsif.h 121999 2003-11-03 22:37:28Z jhb $ */
3 /*
4 * Copyright (c) HONDA Naofumi, KATO Takenori, 1996. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer as
12 * the first lines of this file unmodified.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 /***************************************************
32 * misc device header in bs_softc
33 ***************************************************/
34 #ifdef __NetBSD__
35 #define OS_DEPEND_DEVICE_HEADER \
36 struct device sc_dev; \
37 void *sc_ih;
38
39 #define OS_DEPEND_SCSI_HEADER \
40 struct scsi_link sc_link;
41
42 #define OS_DEPEND_MISC_HEADER \
43 pisa_device_handle_t sc_dh; \
44 bus_space_tag_t sc_iot; \
45 bus_space_tag_t sc_memt; \
46 bus_space_handle_t sc_ioh; \
47 bus_space_handle_t sc_delaybah; \
48 bus_space_handle_t sc_memh; \
49 bus_dma_tag_t sc_dmat;
50
51 #endif /* __NetBSD__ */
52 #ifdef __FreeBSD__
53 #define OS_DEPEND_DEVICE_HEADER \
54 int unit;
55
56 #define OS_DEPEND_SCSI_HEADER \
57 struct scsi_link sc_link;
58
59 #define OS_DEPEND_MISC_HEADER \
60 struct callout_handle timeout_ch;
61 #endif /* __FreeBSD__ */
62
63 #if defined(__NetBSD__)
64 #define BSHW_NBPG NBPG
65 #endif
66 #if defined(__FreeBSD__)
67 #define BSHW_NBPG PAGE_SIZE
68 #endif
69
70 /***************************************************
71 * include
72 ***************************************************/
73 /* (I) common include */
74 #include <sys/param.h>
75 #include <sys/systm.h>
76 #include <sys/kernel.h>
77 #include <sys/bio.h>
78 #include <sys/queue.h>
79 #include <sys/malloc.h>
80 #include <sys/errno.h>
81
82 #include <vm/vm.h>
83
84 /* (II) os depend include */
85 #ifdef __NetBSD__
86 #include <sys/device.h>
87
88 #include <dev/isa/isareg.h>
89 #include <dev/isa/isavar.h>
90 #include <dev/isa/pisaif.h>
91 #include <dev/isa/isadmavar.h>
92 #include <dev/isa/isadmareg.h>
93
94 #include <dev/cons.h>
95
96 #include <machine/cpufunc.h>
97 #include <machine/bus.h>
98 #include <machine/intr.h>
99 #include <machine/dvcfg.h>
100
101 #include <scsi/scsi_all.h>
102 #include <scsi/scsiconf.h>
103 #include <scsi/scsi_disk.h>
104 #endif /* __NetBSD__ */
105
106 #ifdef __FreeBSD__
107 #include <sys/bus.h>
108 #include <sys/conf.h>
109 #include <sys/interrupt.h>
110 #include <sys/proc.h>
111 #include <vm/vm_extern.h>
112 #include <vm/vm_kern.h>
113 #include <vm/pmap.h>
114
115 #include <machine/clock.h>
116 #include <machine/cpu.h>
117 #include <machine/md_var.h>
118 #include <machine/vmparam.h>
119 #include <machine/dvcfg.h>
120
121 #include <cam/scsi/scsi_all.h>
122 #include <cam/scsi/scsi_da.h>
123
124 #include <pc98/pc98/pc98.h>
125 #include <i386/isa/isa_device.h>
126 #include <i386/isa/icu.h>
127 #endif /* __FreeBSD__ */
128
129 /***************************************************
130 * BUS IO MAPPINGS & BS specific inclusion
131 ***************************************************/
132 #ifdef __NetBSD__
133 #define BUS_IO_DELAY ((void) bus_space_read_1(bsc->sc_iot, bsc->sc_delaybah, 0))
134 #define BUS_IO_WEIGHT (bus_space_write_1(bsc->sc_iot, bsc->sc_delaybah, 0, 0))
135 #define BUS_IOR(offs) (bus_space_read_1(bsc->sc_iot, bsc->sc_ioh, (offs)))
136 #define BUS_IOW(offs, val) (bus_space_write_1(bsc->sc_iot, bsc->sc_ioh, (offs), (val)))
137
138 #include <dev/ic/wd33c93reg.h>
139 #include <dev/isa/ccbque.h>
140
141 #include <i386/Cbus/dev/scsi_dvcfg.h>
142 #include <i386/Cbus/dev/bs/bsvar.h>
143 #include <i386/Cbus/dev/bs/bshw.h>
144 #include <i386/Cbus/dev/bs/bsfunc.h>
145 #endif /* __NetBSD__ */
146
147 #ifdef __FreeBSD__
148 #define BUS_IO_DELAY ((void) inb(0x5f))
149 #define BUS_IO_WEIGHT (outb(0x5f, 0))
150 #define BUS_IOR(offs) (BUS_IO_DELAY, inb(bsc->sc_iobase + (offs)))
151 #define BUS_IOW(offs, val) (BUS_IO_DELAY, outb(bsc->sc_iobase + (offs), (val)))
152
153 #include <dev/ic/wd33c93reg.h>
154 #include <i386/isa/ccbque.h>
155
156 #include <cam/scsi/scsi_dvcfg.h>
157 #include <i386/isa/bs/bsvar.h>
158 #include <i386/isa/bs/bshw.h>
159 #include <i386/isa/bs/bsfunc.h>
160 #endif /* __FreeBSD__ */
161
162 /***************************************************
163 * XS return type
164 ***************************************************/
165 #ifdef __NetBSD__
166 #define XSBS_INT32T int
167 #endif /* __NetBSD__ */
168 #ifdef __FreeBSD__
169 #define XSBS_INT32T int32_t
170 #endif /* __FreeBSD__ */
171
172 /***************************************************
173 * xs flags's abstraction (all currently used)
174 ***************************************************/
175 #define XSBS_ITSDONE ITSDONE
176 #ifdef __NetBSD__
177 #define XSBS_SCSI_NOSLEEP SCSI_NOSLEEP
178 #define XSBS_SCSI_POLL SCSI_POLL
179 #endif /* __NetBSD__ */
180 #ifdef __FreeBSD__
181 #define XSBS_SCSI_POLL SCSI_NOMASK
182 #endif /* __FreeBSD__ */
183
184 /***************************************************
185 * declare
186 ***************************************************/
187 /* (I) common declare */
188 void bs_alloc_buf(struct targ_info *);
189 #ifdef __NetBSD__
190 XSBS_INT32T bs_target_open(struct scsi_link *, struct cfdata *);
191 XSBS_INT32T bs_scsi_cmd(struct scsi_xfer *);
192 #endif
193 #ifdef __FreeBSD__
194 void bs_scsi_cmd(struct cam_sim *sim, union ccb *ccb);
195 #endif
196 extern int delaycount;
197
198 /* (II) os depend declare */
199 #ifdef __NetBSD__
200 int bsintr(void *);
201 int bsprint(void *, const char *);
202 #endif /* __NetBSD__ */
203
204 #ifdef __FreeBSD__
205 static BS_INLINE void memcopy(void *from, void *to, register size_t len);
206 u_int32_t bs_adapter_info(int);
207 #define delay(y) DELAY(y)
208 extern int dma_init_flag;
209
210 #define softintr(y)
211
212 static BS_INLINE void
213 memcopy(from, to, len)
214 void *from, *to;
215 register size_t len;
216 {
217 len >>= 2;
218 __asm __volatile(" \n\
219 cld \n\
220 rep \n\
221 movsl" :
222 "=D" (to), "=c" (len), "=S" (from) :
223 "" (to), "1" (len), "2" (from) :
224 "memory", "cc");
225 }
226 #endif /* __FreeBSD__ */
Cache object: b99dffbbc78c947d2076f09bdcace214
|