2 .\" This file and its contents are supplied under the terms of the
3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
4 .\" You may only use this file in accordance with the terms of version
7 .\" A full copy of the text of the CDDL should have accompanied this
8 .\" source. A copy of the CDDL is also available via the Internet at
9 .\" http://www.illumos.org/license/CDDL.
12 .\" Copyright 2016 Joyent, Inc.
20 .Nd USBA host controller driver operations vector
22 .In sys/usb/usba/hcdi.h
25 illumos USB HCD private
27 This is a private data structure that is not part of the stable DDI.
28 It may be removed or changed at any time.
32 structure is usbed HCD drivers to register operations vectors and
33 callbacks from the USBA HCD interface.
36 for more information on USB HCD device drivers.
38 The structure is allocated through a call to the
39 .Xr usba_alloc_hcdi_ops 9F
40 function and is used with a call to
41 .Xr usba_hcdi_register 9F .
42 When the driver is done with the operations vector, either because
43 registering has failed or it is unregistering, it should call
44 .Xr usba_free_hcdi_ops 9F
45 to free the associated memory.
49 structure has the following members:
50 .Bd -literal -offset indent
51 int usba_hcdi_ops_version;
52 dev_info_t *usba_hcdi_dip;
54 int (*usba_hcdi_pm_support)(dev_info_t *);
55 int (*usba_hcdi_pipe_open)(usba_pipe_handle_data_t *, usb_flags_t);
56 int (*usba_hcdi_pipe_close)(usba_pipe_handle_data_t *, usb_flags_t);
57 int (*usba_hcdi_pipe_reset)(usba_pipe_handle_data_t *, usb_flags_t);
58 void (*usba_hcdi_pipe_reset_data_toggle)(usba_pipe_handle_data_t *);
60 int (*usba_hcdi_pipe_ctrl_xfer)(usba_pipe_handle_data_t *,
61 usb_ctrl_req_t *, usb_flags_t);
63 int (*usba_hcdi_bulk_transfer_size)(usba_device_t *, size_t *);
64 int (*usba_hcdi_pipe_bulk_xfer)(usba_pipe_handle_data_t *,
65 usb_bulk_req_t *, usb_flags_t);
67 int (*usba_hcdi_pipe_intr_xfer)(usba_pipe_handle_data_t *,
68 usb_intr_req_t *, usb_flags_t);
69 int (*usba_hcdi_pipe_stop_intr_polling)(usba_pipe_handle_data_t *,
72 int (*usba_hcdi_pipe_isoc_xfer)(usba_pipe_handle_data_t *,
73 usb_isoc_req_t *, usb_flags_t);
74 int (*usba_hcdi_pipe_stop_isoc_polling)(usba_pipe_handle_data_t *,
76 int (*usba_hcdi_get_current_frame_number)(usba_device_t *,
77 usb_frame_number_t *);
78 int (*usba_hcdi_get_max_isoc_pkts)(usba_device_t *, uint_t *);
80 int (*usba_hcdi_console_input_init)(usba_pipe_handle_data_t *,
81 uchar_t **, usb_console_info_impl_t *);
82 int (*usba_hcdi_console_input_fini)(usb_console_info_impl_t *);
83 int (*usba_hcdi_console_input_enter)(usb_console_info_impl_t *);
84 int (*usba_hcdi_console_read)(usb_console_info_impl_t *, uint_t);
85 int (*usba_hcdi_console_input_exit)(usb_console_info_impl_t *);
87 int (*usba_hcdi_console_output_init)(usba_pipe_handle_data_t *,
88 usb_console_info_impl_t *);
89 int (*usba_hcdi_console_output_fini)(usb_console_info_impl_t *);
90 int (*usba_hcdi_console_output_enter)(usb_console_info_impl_t *);
91 int (*usba_hcdi_console_write)(usb_console_info_impl_t *, uchar_t *,
93 int (*usba_hcdi_console_output_exit)(usb_console_info_impl_t *);
95 int (*usba_hcdi_device_init)(usba_device_t *, usb_port_t, void **);
96 void (*usba_hcdi_device_fini)(usba_device_t *, void *);
97 int (*usba_hcdi_device_address)(usba_device_t *);
99 int (*usba_hcdi_hub_update)(usba_device_t *, uint8_t, uint8_t);
103 .Sy usba_hcdi_ops_version
104 member is used to indicate the revision of the operations vector.
105 HCD drivers should generally set this to
106 .Dv HCDI_OPS_VERSION .
110 member should be set to the
112 structure of the HCD driver that was received in
116 .Sy usba_hcdi_pm_support
120 or to a function which only returns
124 .Sy usba_hcdi_pipe_open
125 member should be set to a function which takes care of the all of the
126 controller-specific actions of opening up an endpoint on a device and
127 associating it with the pipe.
129 .Xr usba_hcdi_pipe_open 9E
130 for more information.
133 .Sy usba_hcdi_pipe_close
134 member should be set to a function which takes care of releasing all of
135 the controller-specific resources and actions taken when the pipe was
137 This function also has the responsibility to clean up any outstanding polling on
140 .Xr usba_hcdi_pipe_close 9E
141 for more information.
144 .Sy usba_hcdi_pipe_reset
145 member should be set to a function that takes care of resetting a pipe.
146 A pipe reset not only performs controller-specific functionality, but it
147 also cleans up any outstanding requests and terminates polling.
149 .Xr usba_hcdi_pipe_reset 9E
150 for more information.
153 .Sy usba_hcdi_pipe_reset_data_toggle
154 member should be set to a function that takes care of the USB data
155 toggle, if the controller exposes this functionality to the host.
158 .Sy usba_hcdi_pipe_ctrl_xfer
159 member should be set to a function that handles control transfers for any
160 device, including the root hub.
162 .Xr usba_hcdi_pipe_ctrl_xfer 9E
163 for more information.
166 .Sy usba_hcdi_bulk_transfer_size
167 member should be a set to a function which can return the maximum amount
168 of data that can be performed in a given USB transfer for a bulk
172 .Sy usba_hcdi_pipe_bulk_xfer
173 member should be set set to a function which performs a bulk transfer.
175 .Xr usba_hcdi_pipe_bulk_xfer 9E
176 for more information.
179 .Sy usba_hcdi_pipe_intr_xfer
180 member should be set to a function which performs interrupt transfers.
181 These may be both periodic and one-shot transfers.
182 In addition, this may need to handle requests for the root hub.
184 .Xr usba_hcdi_pipe_intr_xfer 9E
185 for more information.
188 .Sy usba_hcdi_pipe_stop_intr_polling
189 member should be set to a function which is used to terminate interrupt
190 polling and return the original interrupt request.
192 .Xr usba_hcdi_pipe_stop_intr_polling 9E
193 for more information.
196 .Sy usba_hcdi_pipe_isoc_xfer
197 member should be set to a function which performs isochronous transfers.
198 These may be both periodic and one-shot transfers.
200 .Xr usba_hcdi_pipe_isoc_xfer 9E
201 for more information.
204 .Sy usba_hcdi_pipe_stop_isoc_polling
205 member should be set to a function which is used to terminate isochronous
206 polling and return the original isochronous request.
208 .Xr usba_hcdi_pipe_stop_isoc_polling 9E
209 for more information.
212 .Sy usba_hcdi_get_current_frame_number
213 member should be set to a function which returns the current virtual
215 While this entry point is required, at this time, nothing uses this
216 functionality in illumos, so having a dummy function which just returns
221 .Sy usba_hcdi_max_isoc_pkts
222 member should be set to a function that returns the maximum number of
223 isochronous fragments that can be queued in a given transfer.
226 .Sy usba_hcdi_console_input_init ,
227 .Sy usba_hcdi_console_input_fini ,
228 .Sy usba_hcdi_console_input_enter ,
229 .Sy usba_hcdi_console_read ,
231 .Sy usba_hcdi_console_input_exit
232 members are used to facilitate a USB device acting as the system console
233 and reading input from it.
234 Support for this is optional in an HCD driver.
235 HCD drivers which do not support this functionality should have functions which
240 .Sy usba_hcdi_console_output_init ,
241 .Sy usba_hcdi_console_output_fini ,
242 .Sy usba_hcdi_console_output_enter ,
243 .Sy usba_hcdi_console_writ ,
245 .Sy usba_hcdi_console_output_exit
246 members are used to facilitate a USB device acting as the system console
247 and outputting data to it.
248 Support for this is optional in an HCD driver.
249 HCD drivers which do not support this functionality should have functions which
254 .Sy usba_hcdi_device_init
257 entry point that will be called every time a new device is initialized
258 and detected by the system.
259 If an HCD does not need this functionality, the member should be set to
262 .Xr usba_hcdi_device_init 9E
263 for more information.
266 .Sy usba_hcdi_device_fini
269 entry point that will be called every time a device is removed from the
270 system, whether through it being unplugged or a
273 If an HCD does not need this functionality, the member should be set to
276 .Xr usba_hcdi_device_fini 9E
277 for more information.
280 .Sy usba_hcdi_device_address
283 entry point that will be called every time a USB device needs to be
285 If an HCD driver does not need this functionality, the member should be set to
288 .Xr usba_hcdi_device_address 9E
289 for more information.
292 .Sy usba_hcdi_hub_update
295 entry point that will be called every time a device descriptor is read
296 that turns out to be a hub.
297 This gives HCD drivers a chance to perform any needed controller-specific
298 functionality before the device is used.
299 If an HCD driver does not need this functionality, the member should be set to
302 .Xr usba_hcdi_hub_update 9E
303 for more information.
308 .Xr usba_hcdi_device_address 9E ,
309 .Xr usba_hcdi_device_fini 9E ,
310 .Xr usba_hcdi_device_init 9E ,
311 .Xr usba_hcdi_hub_update 9E ,
312 .Xr usba_hcdi_pipe_bulk_xfer 9E ,
313 .Xr usba_hcdi_pipe_close 9E ,
314 .Xr usba_hcdi_pipe_ctrl_xfer 9E ,
315 .Xr usba_hcdi_pipe_intr_xfer 9E ,
316 .Xr usba_hcdi_pipe_isoc_xfer 9E ,
317 .Xr usba_hcdi_pipe_open 9E ,
318 .Xr usba_hcdi_pipe_reset 9E ,
319 .Xr usba_hcdi_pipe_stop_intr_polling 9E ,
320 .Xr usba_hcdi_pipe_stop_isoc_polling 9E ,
321 .Xr usba_alloc_hcdi_ops 9F ,
322 .Xr usba_free_hcdi_ops 9F ,
323 .Xr usba_hcdi_register 9F