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 struct callout_handle timeout_ch;
60 #endif /* __FreeBSD__ */
61
62 #if defined(__NetBSD__)
63 #define BSHW_NBPG NBPG
64 #endif
65 #if defined(__FreeBSD__)
66 #define BSHW_NBPG PAGE_SIZE
67 #endif
68
69 /***************************************************
70 * include
71 ***************************************************/
72 /* (I) common include */
73 #include <sys/param.h>
74 #include <sys/systm.h>
75 #include <sys/kernel.h>
76 #include <sys/disklabel.h>
77 #include <sys/buf.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/conf.h>
108 #include <sys/device.h>
109 #include <vm/vm_extern.h>
110 #include <vm/vm_kern.h>
111 #include <vm/pmap.h>
112
113 #include <machine/clock.h>
114 #include <machine/cpu.h>
115 #include <machine/md_var.h>
116 #include <machine/vmparam.h>
117 #include <machine/ipl.h>
118 #include <machine/dvcfg.h>
119
120 #include <cam/scsi/scsi_all.h>
121 #if 0
122 #include <cam/scsi/scsiconf.h>
123 #endif
124 #include <cam/scsi/scsi_da.h>
125
126 #include <pc98/pc98/pc98.h>
127 #include <i386/isa/isa_device.h>
128 #include <i386/isa/icu.h>
129 #endif /* __FreeBSD__ */
130
131 /***************************************************
132 * BUS IO MAPPINGS & BS specific inclusion
133 ***************************************************/
134 #ifdef __NetBSD__
135 #define BUS_IO_DELAY ((void) bus_space_read_1(bsc->sc_iot, bsc->sc_delaybah, 0))
136 #define BUS_IO_WEIGHT (bus_space_write_1(bsc->sc_iot, bsc->sc_delaybah, 0, 0))
137 #define BUS_IOR(offs) (bus_space_read_1(bsc->sc_iot, bsc->sc_ioh, (offs)))
138 #define BUS_IOW(offs, val) (bus_space_write_1(bsc->sc_iot, bsc->sc_ioh, (offs), (val)))
139
140 #include <dev/ic/wd33c93reg.h>
141 #include <dev/isa/ccbque.h>
142
143 #include <i386/Cbus/dev/scsi_dvcfg.h>
144 #include <i386/Cbus/dev/bs/bsvar.h>
145 #include <i386/Cbus/dev/bs/bshw.h>
146 #include <i386/Cbus/dev/bs/bsfunc.h>
147 #endif /* __NetBSD__ */
148
149 #ifdef __FreeBSD__
150 #define BUS_IO_DELAY ((void) inb(0x5f))
151 #define BUS_IO_WEIGHT (outb(0x5f, 0))
152 #define BUS_IOR(offs) (BUS_IO_DELAY, inb(bsc->sc_iobase + (offs)))
153 #define BUS_IOW(offs, val) (BUS_IO_DELAY, outb(bsc->sc_iobase + (offs), (val)))
154
155 #include <i386/isa/ic/wd33c93.h>
156 #include <i386/isa/ccbque.h>
157
158 #include <i386/isa/scsi_dvcfg.h>
159 #include <i386/isa/bs/bsvar.h>
160 #include <i386/isa/bs/bshw.h>
161 #include <i386/isa/bs/bsfunc.h>
162 #endif /* __FreeBSD__ */
163
164 /***************************************************
165 * XS return type
166 ***************************************************/
167 #ifdef __NetBSD__
168 #define XSBS_INT32T int
169 #endif /* __NetBSD__ */
170 #ifdef __FreeBSD__
171 #define XSBS_INT32T int32_t
172 #endif /* __FreeBSD__ */
173
174 /***************************************************
175 * xs flags's abstraction (all currently used)
176 ***************************************************/
177 #define XSBS_ITSDONE ITSDONE
178 #ifdef __NetBSD__
179 #define XSBS_SCSI_NOSLEEP SCSI_NOSLEEP
180 #define XSBS_SCSI_POLL SCSI_POLL
181 #endif /* __NetBSD__ */
182 #ifdef __FreeBSD__
183 #define XSBS_SCSI_POLL SCSI_NOMASK
184 #endif /* __FreeBSD__ */
185
186 /***************************************************
187 * declare
188 ***************************************************/
189 /* (I) common declare */
190 void bs_alloc_buf __P((struct targ_info *));
191 #ifdef __NetBSD__
192 XSBS_INT32T bs_target_open __P((struct scsi_link *, struct cfdata *));
193 XSBS_INT32T bs_scsi_cmd __P((struct scsi_xfer *));
194 #endif
195 #ifdef __FreeBSD__
196 void bs_scsi_cmd(struct cam_sim *sim, union ccb *ccb);
197 #endif
198 extern int delaycount;
199
200 /* (II) os depend declare */
201 #ifdef __NetBSD__
202 int bsintr __P((void *));
203 int bsprint __P((void *, const char *));
204 #endif /* __NetBSD__ */
205
206 #ifdef __FreeBSD__
207 static BS_INLINE void memcopy __P((void *from, void *to, register size_t len));
208 u_int32_t bs_adapter_info __P((int));
209 #define delay(y) DELAY(y)
210 extern int dma_init_flag;
211 #ifdef SMP
212 #error XXX see comments in i386/isa/bs/bsif.h for details
213 /*
214 * ipending is 'opaque' in SMP, and can't be accessed this way.
215 * Since its my belief that this is PC98 code, and that PC98 and SMP
216 * are mutually exclusive, the above compile-time error is the "fix".
217 * Please inform smp@freebsd.org if this is NOT the case.
218 */
219 #else
220 #define softintr(y) ipending |= (1 << y)
221 #endif /* SMP */
222
223 static BS_INLINE void
224 memcopy(from, to, len)
225 void *from, *to;
226 register size_t len;
227 {
228
229 len >>= 2;
230 __asm __volatile("cld\n\trep\n\tmovsl" : :
231 "S" (from), "D" (to), "c" (len) :
232 "%esi", "%edi", "%ecx");
233 }
234 #endif /* __FreeBSD__ */
Cache object: dcfa3375fdf3b392d891146d70aea98e
|