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 #ifndef _IC_DPTVAR_H_
32 #define _IC_DPTVAR_H_ 1
33 #ifdef _KERNEL
34
35 #define CCB_OFF(sc,m) ((u_long)(m) - (u_long)((sc)->sc_ccbs))
36
37 #define CCB_ALLOC 0x01
38 #define CCB_ABORT 0x02
39 #define CCB_INTR 0x04
40 #define CCB_PRIVATE 0x08
41
42 struct dpt_ccb {
43 struct eata_cp ccb_eata_cp;
44 struct eata_sg ccb_sg[DPT_SG_SIZE];
45 volatile int ccb_flg;
46 int ccb_timeout;
47 u_int32_t ccb_ccbpa;
48 bus_dmamap_t ccb_dmamap_xfer;
49 int ccb_hba_status;
50 int ccb_scsi_status;
51 int ccb_id;
52 TAILQ_ENTRY(dpt_ccb) ccb_chain;
53 #ifdef __NetBSD__
54 struct scsipi_sense_data ccb_sense;
55 struct scsipi_xfer *ccb_xs;
56 #endif
57 #ifdef __OpenBSD__
58 struct scsi_sense_data ccb_sense;
59 struct scsi_xfer *ccb_xs;
60 #endif
61 };
62
63 struct dpt_softc {
64 struct device sc_dv;
65 bus_space_handle_t sc_ioh;
66 #ifdef __NetBSD__
67 struct scsipi_adapter sc_adapter;
68 struct scsipi_link sc_link[3];
69 #endif
70 #ifdef __OpenBSD__
71 struct scsi_adapter sc_adapter;
72 struct scsi_link sc_link[3];
73 #endif
74 struct eata_cfg sc_ec;
75 bus_space_tag_t sc_iot;
76 bus_dma_tag_t sc_dmat;
77 bus_dmamap_t sc_dmamap_ccb;
78 void *sc_ih;
79 void *sc_sdh;
80 struct dpt_ccb *sc_ccbs;
81 struct eata_sp *sc_statpack;
82 int sc_spoff;
83 u_int32_t sc_sppa;
84 caddr_t sc_scr;
85 int sc_scrlen;
86 int sc_scroff;
87 u_int32_t sc_scrpa;
88 int sc_hbaid[3];
89 int sc_nccbs;
90 int sc_open;
91 TAILQ_HEAD(, dpt_ccb) sc_free_ccb;
92 #ifdef __NetBSD__
93 TAILQ_HEAD(, scsipi_xfer) sc_queue;
94 #endif
95 #ifdef __OpenBSD__
96 LIST_HEAD(, scsi_xfer) sc_queue;
97 struct scsi_xfer *sc_queuelast;
98 #endif
99 };
100
101 int dpt_intr(void *);
102 int dpt_readcfg(struct dpt_softc *);
103 void dpt_init(struct dpt_softc *, const char *);
104 void dpt_shutdown(void *);
105 void dpt_timeout(void *);
106 void dpt_minphys(struct buf *);
107 #ifdef __NetBSD__
108 int dpt_scsi_cmd(struct scsipi_xfer *);
109 #endif
110 #ifdef __OpenBSD__
111 int dpt_scsi_cmd(struct scsi_xfer *);
112 #endif
113 int dpt_wait(struct dpt_softc *, u_int8_t, u_int8_t, int);
114 int dpt_poll(struct dpt_softc *, struct dpt_ccb *);
115 int dpt_cmd(struct dpt_softc *, struct eata_cp *, u_int32_t, int, int);
116 void dpt_hba_inquire(struct dpt_softc *, struct eata_inquiry_data **);
117 void dpt_reset_ccb(struct dpt_softc *, struct dpt_ccb *);
118 void dpt_free_ccb(struct dpt_softc *, struct dpt_ccb *);
119 void dpt_done_ccb(struct dpt_softc *, struct dpt_ccb *);
120 int dpt_init_ccb(struct dpt_softc *, struct dpt_ccb *);
121 int dpt_create_ccbs(struct dpt_softc *, struct dpt_ccb *, int);
122 struct dpt_ccb *dpt_alloc_ccb(struct dpt_softc *, int);
123 #ifdef DEBUG
124 void dpt_dump_sp(struct eata_sp *);
125 #endif
126
127 #endif
128 #endif