4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
28 * Bridge module containing functions with different names than those in the
29 * usba10 module, so the usba10 module can call functions in this (usba) module.
31 * The usba10 module is present to satisfy a runtime loader dependency for
32 * legacy DDK drivers (V0.8). The usba10 module calls functions in this (usba)
33 * module to carry out driver requests.
35 * The intent is that this file disappear once krtld functionality is improved
36 * so that drivers dependent on usba10 can call into usba without these wrapper
39 * Please see the on81-patch gate include/sys/usba10/usba10_usbai.h
40 * header file for descriptions and comments for these functions.
43 #include <sys/usb/usba.h>
44 #include <sys/usb/usba/usbai_private.h>
45 #include <sys/usb/usba/usba10.h>
50 usba10_usb_register_client(
53 usb_client_dev_data_t
**dev_data
,
54 usb_reg_parse_lvl_t parse_level
,
57 return (usb_register_client(
58 dip
, version
, dev_data
, parse_level
, flags
));
63 usba10_usb_unregister_client(
65 usb_client_dev_data_t
*dev_data
)
67 usb_unregister_client(dip
, dev_data
);
72 usba10_usb_free_descr_tree(
74 usb_client_dev_data_t
*dev_data
)
76 usb_free_descr_tree(dip
, dev_data
);
81 usba10_usb_parse_data(
88 return (usb_parse_data(
89 format
, data
, datalen
, structure
, structlen
));
93 usba10_usb_get_ep_data(
95 usb_client_dev_data_t
*dev_datap
,
101 return (usb_get_ep_data(
102 dip
, dev_datap
, interface
, alternate
, type
, direction
));
107 usba10_usb_get_string_descr(
114 return (usb_get_string_descr(dip
, langid
, index
, buf
, buflen
));
119 usba10_usb_get_addr(dev_info_t
*dip
)
121 return (usb_get_addr(dip
));
126 usba10_usb_get_if_number(dev_info_t
*dip
)
128 return (usb_get_if_number(dip
));
133 usba10_usb_owns_device(dev_info_t
*dip
)
135 return (usb_owns_device(dip
));
140 usba10_usb_pipe_get_state(
141 usb_pipe_handle_t pipe_handle
,
142 usb_pipe_state_t
*pipe_state
,
145 return (usb_pipe_get_state(pipe_handle
, pipe_state
, flags
));
150 usba10_usb_ep_num(usb_pipe_handle_t ph
)
152 return (usb_ep_num(ph
));
157 usba10_usb_pipe_open(
160 usb_pipe_policy_t
*pipe_policy
,
162 usb_pipe_handle_t
*pipe_handle
)
164 return (usb_pipe_open(dip
, ep
, pipe_policy
, flags
, pipe_handle
));
169 usba10_usb_pipe_close(
171 usb_pipe_handle_t pipe_handle
,
174 usb_pipe_handle_t ph
,
175 usb_opaque_t arg
, /* cb arg */
177 usb_cb_flags_t flags
),
180 usb_pipe_close(dip
, pipe_handle
, flags
, cb
, cb_arg
);
185 usba10_usb_pipe_drain_reqs(
187 usb_pipe_handle_t pipe_handle
,
191 usb_pipe_handle_t ph
,
192 usb_opaque_t arg
, /* cb arg */
194 usb_cb_flags_t flags
),
197 return (usb_pipe_drain_reqs(
198 dip
, pipe_handle
, time
, flags
, cb
, cb_arg
));
203 usba10_usb_pipe_set_private(
204 usb_pipe_handle_t pipe_handle
,
207 return (usb_pipe_set_private(pipe_handle
, data
));
212 usba10_usb_pipe_get_private(usb_pipe_handle_t pipe_handle
)
214 return (usb_pipe_get_private(pipe_handle
));
219 usba10_usb_pipe_reset(
221 usb_pipe_handle_t pipe_handle
,
222 usb_flags_t usb_flags
,
224 usb_pipe_handle_t ph
,
227 usb_cb_flags_t flags
),
230 usb_pipe_reset(dip
, pipe_handle
, usb_flags
, cb
, cb_arg
);
235 usba10_usb_alloc_ctrl_req(
240 return (usb_alloc_ctrl_req(dip
, len
, flags
));
245 usba10_usb_free_ctrl_req(usb_ctrl_req_t
*reqp
)
247 usb_free_ctrl_req(reqp
);
252 usba10_usb_pipe_ctrl_xfer(
253 usb_pipe_handle_t pipe_handle
,
254 usb_ctrl_req_t
*reqp
,
257 return (usb_pipe_ctrl_xfer(pipe_handle
, reqp
, flags
));
262 usba10_usb_get_status(
264 usb_pipe_handle_t ph
,
265 uint_t type
, /* bmRequestType */
266 uint_t what
, /* 0, interface, endpoint number */
270 return (usb_get_status(dip
, ph
, type
, what
, status
, flags
));
275 usba10_usb_clear_feature(
277 usb_pipe_handle_t ph
,
278 uint_t type
, /* bmRequestType */
280 uint_t what
, /* 0, interface, endpoint number */
283 return (usb_clear_feature(dip
, ph
, type
, feature
, what
, flags
));
288 usba10_usb_pipe_ctrl_xfer_wait(
289 usb_pipe_handle_t pipe_handle
,
290 usb_ctrl_setup_t
*setup
,
292 usb_cr_t
*completion_reason
,
293 usb_cb_flags_t
*cb_flags
,
296 return (usb_pipe_ctrl_xfer_wait(
297 pipe_handle
, setup
, data
, completion_reason
, cb_flags
, flags
));
305 usb_flags_t usb_flags
,
307 usb_pipe_handle_t ph
,
310 usb_cb_flags_t flags
),
313 return (usb_set_cfg(dip
, cfg_index
, usb_flags
, cb
, cb_arg
));
321 usb_flags_t usb_flags
)
323 return (usb_get_cfg(dip
, cfgval
, usb_flags
));
328 usba10_usb_set_alt_if(
332 usb_flags_t usb_flags
,
334 usb_pipe_handle_t ph
,
337 usb_cb_flags_t flags
),
340 return (usb_set_alt_if(
341 dip
, interface
, alt_number
, usb_flags
, cb
, cb_arg
));
346 usba10_usb_get_alt_if(
352 return (usb_get_alt_if(dip
, if_number
, alt_number
, flags
));
357 usba10_usb_alloc_bulk_req(
362 return (usb_alloc_bulk_req(dip
, len
, flags
));
367 usba10_usb_free_bulk_req(usb_bulk_req_t
*reqp
)
369 usb_free_bulk_req(reqp
);
374 usba10_usb_pipe_bulk_xfer(
375 usb_pipe_handle_t pipe_handle
,
376 usb_bulk_req_t
*reqp
,
379 return (usb_pipe_bulk_xfer(pipe_handle
, reqp
, flags
));
384 usba10_usb_pipe_bulk_transfer_size(
388 return (usb_pipe_bulk_transfer_size(dip
, size
));
393 usba10_usb_alloc_intr_req(
398 return (usb_alloc_intr_req(dip
, len
, flags
));
403 usba10_usb_free_intr_req(usb_intr_req_t
*reqp
)
405 usb_free_intr_req(reqp
);
410 usba10_usb_pipe_intr_xfer(
411 usb_pipe_handle_t pipe_handle
,
415 return (usb_pipe_intr_xfer(pipe_handle
, req
, flags
));
420 usba10_usb_pipe_stop_intr_polling(
421 usb_pipe_handle_t pipe_handle
,
424 usb_pipe_stop_intr_polling(pipe_handle
, flags
);
429 usba10_usb_alloc_isoc_req(
431 uint_t isoc_pkts_count
,
435 return (usb_alloc_isoc_req(dip
, isoc_pkts_count
, len
, flags
));
440 usba10_usb_free_isoc_req(usb_isoc_req_t
*usb_isoc_req
)
442 usb_free_isoc_req(usb_isoc_req
);
447 usba10_usb_get_current_frame_number(dev_info_t
*dip
)
449 return (usb_get_current_frame_number(dip
));
454 usba10_usb_get_max_isoc_pkts(dev_info_t
*dip
)
456 return (usb_get_max_isoc_pkts(dip
));
461 usba10_usb_pipe_isoc_xfer(
462 usb_pipe_handle_t pipe_handle
,
463 usb_isoc_req_t
*reqp
,
466 return (usb_pipe_isoc_xfer(pipe_handle
, reqp
, flags
));
471 usba10_usb_pipe_stop_isoc_polling(
472 usb_pipe_handle_t pipe_handle
,
475 usb_pipe_stop_isoc_polling(pipe_handle
, flags
);
480 usba10_usb_req_raise_power(
484 void (*cb
)(void *arg
, int rval
),
488 return (usb_req_raise_power(dip
, comp
, level
, cb
, arg
, flags
));
493 usba10_usb_req_lower_power(
497 void (*cb
)(void *arg
, int rval
),
501 return (usb_req_raise_power(dip
, comp
, level
, cb
, arg
, flags
));
506 usba10_usb_is_pm_enabled(dev_info_t
*dip
)
508 return (usb_is_pm_enabled(dip
));
512 usba10_usb_handle_remote_wakeup(
516 return (usb_handle_remote_wakeup(dip
, cmd
));
521 usba10_usb_create_pm_components(
525 return (usb_create_pm_components(dip
, pwrstates
));
530 usba10_usb_set_device_pwrlvl0(dev_info_t
*dip
)
532 return (usb_set_device_pwrlvl0(dip
));
537 usba10_usb_set_device_pwrlvl1(dev_info_t
*dip
)
539 return (usb_set_device_pwrlvl1(dip
));
544 usba10_usb_set_device_pwrlvl2(dev_info_t
*dip
)
546 return (usb_set_device_pwrlvl2(dip
));
551 usba10_usb_set_device_pwrlvl3(dev_info_t
*dip
)
553 return (usb_set_device_pwrlvl3(dip
));
558 usba10_usb_async_req(
560 void (*func
)(void *),
564 return (usb_async_req(dip
, func
, arg
, flag
));
569 usba10_usb_register_event_cbs(
571 usb_event_t
*usb_evt_data
,
574 return (usb_register_event_cbs(dip
, usb_evt_data
, flags
));
579 usba10_usb_unregister_event_cbs(
581 usb_event_t
*usb_evt_data
)
583 usb_unregister_event_cbs(dip
, usb_evt_data
);
588 usba10_usb_fail_checkpoint(
592 usb_fail_checkpoint(dip
, flags
);
598 usb_log_handle_t handle
,
604 return (usba_vlog(handle
, level
, mask
, fmt
, ap
));
609 usba10_usb_alloc_log_handle(
614 uint_t
*instance_filter
,
618 return (usb_alloc_log_handle(
619 dip
, name
, errlevel
, mask
, instance_filter
, show_label
, flags
));
624 usba10_usb_free_log_handle(usb_log_handle_t handle
)
626 usb_free_log_handle(handle
);
631 usba10_usb_log_descr_tree(
632 usb_client_dev_data_t
*dev_data
,
633 usb_log_handle_t log_handle
,
637 return (usb_log_descr_tree(dev_data
, log_handle
, level
, mask
));
642 usba10_usb_print_descr_tree(
644 usb_client_dev_data_t
*dev_data
)
646 return (usb_print_descr_tree(dip
, dev_data
));
651 usba10_usb_check_same_device(
653 usb_log_handle_t log_handle
,
659 return (usb_check_same_device(
660 dip
, log_handle
, log_level
, log_mask
, check_mask
, device_string
));
665 usba10_usb_str_cr(usb_cr_t cr
)
667 return (usb_str_cr(cr
));
672 usba10_usb_str_cb_flags(
673 usb_cb_flags_t cb_flags
,
677 return (usb_str_cb_flags(cb_flags
, buffer
, length
));
682 usba10_usb_str_pipe_state(usb_pipe_state_t state
)
684 return (usb_str_pipe_state(state
));
689 usba10_usb_str_dev_state(int state
)
691 return (usb_str_dev_state(state
));
696 usba10_usb_str_rval(int rval
)
698 return (usb_str_rval(rval
));
703 usba10_usb_rval2errno(int rval
)
705 return (usb_rval2errno(rval
));
710 usba10_usb_init_serialization(
714 return (usb_init_serialization(s_dip
, flag
));
719 usba10_usb_fini_serialization(usb_serialization_t usb_serp
)
721 usb_fini_serialization(usb_serp
);
726 usba10_usb_serialize_access(
727 usb_serialization_t usb_serp
,
729 uint_t delta_timeout
)
731 return (usb_serialize_access(
732 usb_serp
, how_to_wait
, delta_timeout
));
737 usba10_usb_try_serialize_access(
738 usb_serialization_t usb_serp
,
741 return (usb_try_serialize_access(usb_serp
, flag
));
746 usba10_usb_release_access(usb_serialization_t usb_serp
)
748 usb_release_access(usb_serp
);