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 #ifndef _I2O_IOPVAR_H_
41 #define _I2O_IOPVAR_H_
42
43
44
45
46 struct iop_xfer {
47 bus_dmamap_t ix_map;
48 u_int ix_size;
49 u_int ix_flags;
50 };
51 #define IX_IN 0x0001
52 #define IX_OUT 0x0002
53
54
55
56
57 struct iop_msg {
58 SLIST_ENTRY(iop_msg) im_chain;
59 u_int im_flags;
60 u_int im_tctx;
61 void *im_dvcontext;
62 struct i2o_reply *im_rb;
63 u_int im_reqstatus;
64 struct iop_xfer im_xfer[IOP_MAX_MSG_XFERS];
65 };
66 #define IM_SYSMASK 0x00ff
67 #define IM_REPLIED 0x0001
68 #define IM_ALLOCED 0x0002
69 #define IM_SGLOFFADJ 0x0004
70 #define IM_DISCARD 0x0008
71 #define IM_FAIL 0x0010
72
73 #define IM_USERMASK 0xff00
74 #define IM_WAIT 0x0100
75 #define IM_POLL 0x0200
76 #define IM_NOSTATUS 0x0400
77 #define IM_POLL_INTR 0x0800
78
79 struct iop_initiator {
80 LIST_ENTRY(iop_initiator) ii_list;
81 LIST_ENTRY(iop_initiator) ii_hash;
82
83 void (*ii_intr)(struct device *, struct iop_msg *, void *);
84 int (*ii_reconfig)(struct device *);
85 void (*ii_adjqparam)(struct device *, int);
86
87 struct device *ii_dv;
88 int ii_flags;
89 int ii_ictx;
90 int ii_tid;
91 };
92 #define II_DISCARD 0x0001
93 #define II_CONFIGURED 0x0002
94 #define II_UTILITY 0x0004
95
96 #define IOP_ICTX 0
97 #define IOP_INIT_CODE 0x80
98
99
100
101
102 struct iop_pgop {
103 struct i2o_param_op_list_header olh;
104 struct i2o_param_op_all_template oat;
105 } __attribute__ ((__packed__));
106
107
108
109
110 struct iop_softc {
111 struct device sc_dv;
112 bus_space_handle_t sc_ioh;
113 bus_space_tag_t sc_iot;
114 bus_dma_tag_t sc_dmat;
115 void *sc_ih;
116 struct lock sc_conflock;
117 bus_addr_t sc_memaddr;
118 bus_size_t sc_memsize;
119
120 struct i2o_hrt *sc_hrt;
121 struct iop_tidmap *sc_tidmap;
122 struct i2o_lct *sc_lct;
123 int sc_nlctent;
124 int sc_flags;
125 int sc_maxib;
126 int sc_maxob;
127 int sc_curib;
128 u_int32_t sc_chgind;
129 LIST_HEAD(, iop_initiator) sc_iilist;
130 int sc_nii;
131 int sc_nuii;
132 struct iop_initiator sc_eventii;
133 struct proc *sc_reconf_proc;
134 struct iop_msg *sc_ims;
135 SLIST_HEAD(, iop_msg) sc_im_freelist;
136 caddr_t sc_ptb;
137 bus_dmamap_t sc_scr_dmamap;
138 bus_dma_segment_t sc_scr_seg[1];
139 caddr_t sc_scr;
140
141
142
143
144 bus_dmamap_t sc_rep_dmamap;
145 int sc_rep_size;
146 bus_addr_t sc_rep_phys;
147 caddr_t sc_rep;
148
149 bus_space_tag_t sc_bus_memt;
150 bus_space_tag_t sc_bus_iot;
151
152 struct i2o_status sc_status;
153 };
154 #define IOP_OPEN 0x01
155 #define IOP_HAVESTATUS 0x02
156 #define IOP_ONLINE 0x04
157
158 #define IOPCF_TID 0
159 #define IOPCF_TID_DEFAULT -1
160
161 struct iop_attach_args {
162 int ia_class;
163 int ia_tid;
164 };
165 #define iopcf_tid cf_loc[IOPCF_TID]
166
167 void iop_init(struct iop_softc *, const char *);
168 int iop_intr(void *);
169 int iop_lct_get(struct iop_softc *);
170 int iop_param_op(struct iop_softc *, int, struct iop_initiator *, int,
171 int, void *, size_t);
172 int iop_print_ident(struct iop_softc *, int);
173 int iop_simple_cmd(struct iop_softc *, int, int, int, int, int);
174 void iop_strvis(struct iop_softc *, const char *, int, char *, int);
175
176 void iop_initiator_register(struct iop_softc *, struct iop_initiator *);
177 void iop_initiator_unregister(struct iop_softc *, struct iop_initiator *);
178
179 struct iop_msg *iop_msg_alloc(struct iop_softc *, struct iop_initiator *,
180 int);
181 void iop_msg_free(struct iop_softc *, struct iop_msg *);
182 int iop_msg_map(struct iop_softc *, struct iop_msg *, u_int32_t *, void *,
183 size_t, int);
184 int iop_msg_map_bio(struct iop_softc *, struct iop_msg *, u_int32_t *,
185 void *, int, int);
186 int iop_msg_post(struct iop_softc *, struct iop_msg *, void *, int);
187 void iop_msg_unmap(struct iop_softc *, struct iop_msg *);
188
189 int iop_util_abort(struct iop_softc *, struct iop_initiator *, int, int,
190 int);
191 int iop_util_claim(struct iop_softc *, struct iop_initiator *, int, int);
192 int iop_util_eventreg(struct iop_softc *, struct iop_initiator *, int);
193
194 #endif