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