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 struct twe_softc;
30
31 struct twe_ccb {
32 struct twe_softc *ccb_sc;
33 struct twe_cmd *ccb_cmd;
34 struct scsi_xfer *ccb_xs;
35 paddr_t ccb_cmdpa;
36 TAILQ_ENTRY(twe_ccb) ccb_link;
37 enum {
38 TWE_CCB_FREE, TWE_CCB_READY, TWE_CCB_QUEUED, TWE_CCB_PREQUEUED,
39 TWE_CCB_DONE
40 } ccb_state;
41 int ccb_length;
42 void *ccb_data;
43 void *ccb_realdata;
44 bus_dmamap_t ccb_dmamap;
45 bus_dma_segment_t ccb_2bseg[TWE_MAXOFFSETS];
46 int ccb_2nseg;
47 };
48
49 typedef TAILQ_HEAD(twe_queue_head, twe_ccb) twe_queue_head;
50
51 struct twe_softc {
52 struct device sc_dev;
53 void *sc_ih;
54 struct scsi_link sc_link;
55 struct lock sc_lock;
56 struct proc *sc_thread;
57 int sc_thread_on;
58
59 bus_space_tag_t iot;
60 bus_space_handle_t ioh;
61 bus_dma_tag_t dmat;
62
63 void *sc_cmds;
64 bus_dmamap_t sc_cmdmap;
65 bus_dma_segment_t sc_cmdseg[1];
66 struct twe_ccb sc_ccbs[TWE_MAXCMDS];
67 twe_queue_head sc_free_ccb;
68 twe_queue_head sc_ccbq;
69 twe_queue_head sc_ccb2q;
70 twe_queue_head sc_done_ccb;
71
72 struct timeout sc_enqueue_tmo;
73
74 struct {
75 int hd_present;
76 int hd_devtype;
77 int hd_lock;
78 int hd_size;
79 } sc_hdr[TWE_MAX_UNITS];
80 };
81
82
83 #define TWE_LOCK(sc) splbio()
84 #define TWE_UNLOCK(sc, lock) splx(lock)
85 typedef int twe_lock_t;
86
87 void tweminphys(struct buf *bp);
88 int twe_attach(struct twe_softc *);
89 int twe_intr(void *);