This source file includes following definitions.
- AHD_POWER_STATE_D0
- AHD_POWER_STATE_D1
- AHD_POWER_STATE_D2
- AHD_POWER_STATE_D3
- ahd_power_state
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66 #ifndef _AIC79XX_OPENBSD_H_
67 #define _AIC79XX_OPENBSD_H_
68
69 #include "pci.h"
70
71 #include <sys/param.h>
72 #include <sys/kernel.h>
73 #include <sys/systm.h>
74 #include <sys/device.h>
75 #include <sys/malloc.h>
76 #include <sys/buf.h>
77 #include <sys/proc.h>
78 #include <sys/queue.h>
79
80 #define AIC_PCI_CONFIG 1
81 #include <dev/pci/pcireg.h>
82 #include <dev/pci/pcivar.h>
83
84 #include <machine/bus.h>
85 #include <machine/intr.h>
86
87 #include <scsi/scsi_all.h>
88 #include <scsi/scsi_message.h>
89 #include <scsi/scsi_debug.h>
90 #include <scsi/scsiconf.h>
91
92 #include <uvm/uvm_extern.h>
93
94 #ifdef DEBUG
95 #define bootverbose 1
96 #else
97 #define bootverbose 0
98 #endif
99
100 #define SCSI_IS_SCSIBUS_B(ahd, sc_link) \
101 (0)
102 #define SCSI_CHANNEL(ahd, sc_link) \
103 ('A')
104 #define SCSI_SCSI_ID(ahd, sc_link) \
105 (ahd->our_id)
106 #define BUILD_SCSIID(ahd, sc_link, target_id, our_id) \
107 ((((target_id) << TID_SHIFT) & TID) | (our_id))
108
109 #ifndef offsetof
110 #define offsetof(type, member) ((size_t)(&((type *)0)->member))
111 #endif
112
113
114 typedef struct pci_attach_args * ahd_dev_softc_t;
115
116
117
118
119 #define ahd_dmamap_sync(ahc, dma_tag, dmamap, offset, len, op) \
120 bus_dmamap_sync(dma_tag, dmamap, offset, len, op)
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135 #define AHD_NSEG (roundup(btoc(MAXPHYS) + 1, 16))
136
137
138
139
140
141 struct ahd_platform_data {
142 };
143
144 struct scb_platform_data {
145 };
146
147
148 typedef struct timeout aic_timer_t;
149
150
151
152 #if AHD_REG_PRETTY_PRINT
153 #define AIC_DEBUG_REGISTERS 1
154 #else
155 #define AIC_DEBUG_REGISTERS 0
156 #endif
157 #include <dev/ic/aic79xx.h>
158
159
160 void ahd_timeout(void*);
161 void aic_timer_reset(aic_timer_t *, u_int, ahd_callback_t *, void *);
162 void aic_scb_timer_reset(struct scb *, u_int);
163
164 #define aic_timer_stop timeout_del
165 #define aic_get_timeout(scb) ((scb)->xs->timeout)
166
167 #define ahd_inb(ahd, port) \
168 bus_space_read_1((ahd)->tags[(port) >> 8], \
169 (ahd)->bshs[(port) >> 8], (port) & 0xFF)
170
171 #define ahd_outb(ahd, port, value) \
172 bus_space_write_1((ahd)->tags[(port) >> 8], \
173 (ahd)->bshs[(port) >> 8], (port) & 0xFF, value)
174
175 #define ahd_inw_atomic(ahd, port) \
176 aic_le16toh(bus_space_read_2((ahd)->tags[(port) >> 8], \
177 (ahd)->bshs[(port) >> 8], (port) & 0xFF))
178
179 #define ahd_outw_atomic(ahd, port, value) \
180 bus_space_write_2((ahd)->tags[(port) >> 8], \
181 (ahd)->bshs[(port) >> 8], \
182 (port & 0xFF), aic_htole16(value))
183
184 #define ahd_outsb(ahd, port, valp, count) \
185 bus_space_write_multi_1((ahd)->tags[(port) >> 8], \
186 (ahd)->bshs[(port) >> 8], \
187 (port & 0xFF), valp, count)
188
189 #define ahd_insb(ahd, port, valp, count) \
190 bus_space_read_multi_1((ahd)->tags[(port) >> 8], \
191 (ahd)->bshs[(port) >> 8], \
192 (port & 0xFF), valp, count)
193
194 void ahd_flush_device_writes(struct ahd_softc *);
195
196
197
198 #define ahd_lockinit(ahd)
199 #define ahd_lock(ahd, flags) *(flags) = splbio()
200 #define ahd_unlock(ahd, flags) splx(*(flags))
201
202
203 #define ahd_done_lockinit(ahd)
204 #define ahd_done_lock(ahd, flags)
205 #define ahd_done_unlock(ahd, flags)
206
207
208 #define ahd_list_lockinit(x)
209 #define ahd_list_lock(flags) *(flags) = splbio()
210 #define ahd_list_unlock(flags) splx(*(flags))
211
212
213 #define scsi_4btoul(b) (_4btol(b))
214
215
216 #define aic_set_transaction_status(scb, status) (scb)->xs->error = (status)
217 #define aic_set_scsi_status(scb, status) (scb)->xs->xs_status = (status)
218 #define aic_set_transaction_tag(scb, enabled, type)
219 #define aic_set_residual(scb, residual) (scb)->xs->resid = (residual)
220 #define aic_set_sense_residual(scb, residual) (scb)->xs->resid = (residual)
221
222 #define aic_get_transaction_status(scb) \
223 (((scb)->xs->flags & ITSDONE) ? CAM_REQ_CMP : (scb)->xs->error)
224 #define aic_get_scsi_status(scb) ((scb)->xs->status)
225 #define aic_get_transfer_length(scb) ((scb)->xs->datalen)
226 #define aic_get_transfer_dir(scb) \
227 ((scb)->xs->flags & (SCSI_DATA_IN | SCSI_DATA_OUT))
228 #define aic_get_residual(scb) ((scb)->xs->resid)
229 #define aic_get_sense_bufsize(ahd, scb) (sizeof(struct scsi_sense_data))
230
231 #define aic_perform_autosense(scb) (1)
232
233 #define aic_freeze_simq(ahd)
234 #define aic_release_simq(ahd)
235 #define aic_freeze_scb(scb)
236 #define ahd_platform_freeze_devq(ahd, scb)
237 #define ahd_platform_abort_scbs(ahd, target, channel, lun, tag, role, status)
238
239 void aic_platform_scb_free(struct ahd_softc *, struct scb *);
240
241
242
243 #define aic_get_pci_function(pci) ((pci)->pa_function)
244 #define aic_get_pci_slot(pci) ((pci)->pa_device)
245 #define aic_get_pci_bus(pci) ((pci)->pa_bus)
246
247 int ahd_pci_map_registers(struct ahd_softc *);
248 int ahd_pci_map_int(struct ahd_softc *);
249
250
251 typedef enum
252 {
253 AHD_POWER_STATE_D0,
254 AHD_POWER_STATE_D1,
255 AHD_POWER_STATE_D2,
256 AHD_POWER_STATE_D3
257 } ahd_power_state;
258
259 void ahd_power_state_change(struct ahd_softc *, ahd_power_state);
260
261
262 void ahd_print_path(struct ahd_softc *, struct scb *);
263 void ahd_platform_dump_card_state(struct ahd_softc *ahd);
264
265
266 void ahd_notify_xfer_settings_change(struct ahd_softc *,
267 struct ahd_devinfo *);
268 void ahd_platform_set_tags(struct ahd_softc *, struct ahd_devinfo *,
269 ahd_queue_alg);
270
271
272 int ahd_platform_alloc(struct ahd_softc *, void *);
273 void ahd_platform_free(struct ahd_softc *);
274 int ahd_attach(struct ahd_softc *);
275 int ahd_softc_comp(struct ahd_softc *lahd, struct ahd_softc *rahd);
276 int ahd_detach(struct device *, int);
277
278 #define ahd_platform_init(ahd)
279
280
281 int ahd_platform_intr(void *);
282 void ahd_platform_flushwork(struct ahd_softc *ahd);
283
284 void ahd_done(struct ahd_softc *, struct scb *);
285 void ahd_send_async(struct ahd_softc *, char ,
286 u_int , u_int , ac_code, void *arg);
287 #endif