1 /* 2 * CDDL HEADER START 3 * 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. 7 * 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. 12 * 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] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 27 /* 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. 30 * 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. 34 * 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 37 * functions. 38 * 39 * Please see the on81-patch gate usr/src/uts/common/sys/usba10/usba10_usbai.h 40 * header file for descriptions and comments for these functions. 41 */ 42 43 #include <sys/usb/usba.h> 44 #include <sys/usb/usba/usbai_private.h> 45 #include <sys/usb/usba/usba10.h> 46 47 #ifndef __lock_lint 48 49 int 50 usba10_usb_register_client( 51 dev_info_t *dip, 52 uint_t version, 53 usb_client_dev_data_t **dev_data, 54 usb_reg_parse_lvl_t parse_level, 55 usb_flags_t flags) 56 { 57 return (usb_register_client( 58 dip, version, dev_data, parse_level, flags)); 59 } 60 61 62 void 63 usba10_usb_unregister_client( 64 dev_info_t *dip, 65 usb_client_dev_data_t *dev_data) 66 { 67 usb_unregister_client(dip, dev_data); 68 } 69 70 71 void 72 usba10_usb_free_descr_tree( 73 dev_info_t *dip, 74 usb_client_dev_data_t *dev_data) 75 { 76 usb_free_descr_tree(dip, dev_data); 77 } 78 79 80 size_t 81 usba10_usb_parse_data( 82 char *format, 83 uchar_t *data, 84 size_t datalen, 85 void *structure, 86 size_t structlen) 87 { 88 return (usb_parse_data( 89 format, data, datalen, structure, structlen)); 90 } 91 92 usb_ep_data_t * 93 usba10_usb_get_ep_data( 94 dev_info_t *dip, 95 usb_client_dev_data_t *dev_datap, 96 uint_t interface, 97 uint_t alternate, 98 uint_t type, 99 uint_t direction) 100 { 101 return (usb_get_ep_data( 102 dip, dev_datap, interface, alternate, type, direction)); 103 } 104 105 106 int 107 usba10_usb_get_string_descr( 108 dev_info_t *dip, 109 uint16_t langid, 110 uint8_t index, 111 char *buf, 112 size_t buflen) 113 { 114 return (usb_get_string_descr(dip, langid, index, buf, buflen)); 115 } 116 117 118 int 119 usba10_usb_get_addr(dev_info_t *dip) 120 { 121 return (usb_get_addr(dip)); 122 } 123 124 125 int 126 usba10_usb_get_if_number(dev_info_t *dip) 127 { 128 return (usb_get_if_number(dip)); 129 } 130 131 132 boolean_t 133 usba10_usb_owns_device(dev_info_t *dip) 134 { 135 return (usb_owns_device(dip)); 136 } 137 138 139 int 140 usba10_usb_pipe_get_state( 141 usb_pipe_handle_t pipe_handle, 142 usb_pipe_state_t *pipe_state, 143 usb_flags_t flags) 144 { 145 return (usb_pipe_get_state(pipe_handle, pipe_state, flags)); 146 } 147 148 149 int 150 usba10_usb_ep_num(usb_pipe_handle_t ph) 151 { 152 return (usb_ep_num(ph)); 153 } 154 155 156 int 157 usba10_usb_pipe_open( 158 dev_info_t *dip, 159 usb_ep_descr_t *ep, 160 usb_pipe_policy_t *pipe_policy, 161 usb_flags_t flags, 162 usb_pipe_handle_t *pipe_handle) 163 { 164 return (usb_pipe_open(dip, ep, pipe_policy, flags, pipe_handle)); 165 } 166 167 168 void 169 usba10_usb_pipe_close( 170 dev_info_t *dip, 171 usb_pipe_handle_t pipe_handle, 172 usb_flags_t flags, 173 void (*cb)( 174 usb_pipe_handle_t ph, 175 usb_opaque_t arg, /* cb arg */ 176 int rval, 177 usb_cb_flags_t flags), 178 usb_opaque_t cb_arg) 179 { 180 usb_pipe_close(dip, pipe_handle, flags, cb, cb_arg); 181 } 182 183 184 int 185 usba10_usb_pipe_drain_reqs( 186 dev_info_t *dip, 187 usb_pipe_handle_t pipe_handle, 188 uint_t time, 189 usb_flags_t flags, 190 void (*cb)( 191 usb_pipe_handle_t ph, 192 usb_opaque_t arg, /* cb arg */ 193 int rval, 194 usb_cb_flags_t flags), 195 usb_opaque_t cb_arg) 196 { 197 return (usb_pipe_drain_reqs( 198 dip, pipe_handle, time, flags, cb, cb_arg)); 199 } 200 201 202 int 203 usba10_usb_pipe_set_private( 204 usb_pipe_handle_t pipe_handle, 205 usb_opaque_t data) 206 { 207 return (usb_pipe_set_private(pipe_handle, data)); 208 } 209 210 211 usb_opaque_t 212 usba10_usb_pipe_get_private(usb_pipe_handle_t pipe_handle) 213 { 214 return (usb_pipe_get_private(pipe_handle)); 215 } 216 217 218 void 219 usba10_usb_pipe_reset( 220 dev_info_t *dip, 221 usb_pipe_handle_t pipe_handle, 222 usb_flags_t usb_flags, 223 void (*cb)( 224 usb_pipe_handle_t ph, 225 usb_opaque_t arg, 226 int rval, 227 usb_cb_flags_t flags), 228 usb_opaque_t cb_arg) 229 { 230 usb_pipe_reset(dip, pipe_handle, usb_flags, cb, cb_arg); 231 } 232 233 234 usb_ctrl_req_t * 235 usba10_usb_alloc_ctrl_req( 236 dev_info_t *dip, 237 size_t len, 238 usb_flags_t flags) 239 { 240 return (usb_alloc_ctrl_req(dip, len, flags)); 241 } 242 243 244 void 245 usba10_usb_free_ctrl_req(usb_ctrl_req_t *reqp) 246 { 247 usb_free_ctrl_req(reqp); 248 } 249 250 251 int 252 usba10_usb_pipe_ctrl_xfer( 253 usb_pipe_handle_t pipe_handle, 254 usb_ctrl_req_t *reqp, 255 usb_flags_t flags) 256 { 257 return (usb_pipe_ctrl_xfer(pipe_handle, reqp, flags)); 258 } 259 260 261 int 262 usba10_usb_get_status( 263 dev_info_t *dip, 264 usb_pipe_handle_t ph, 265 uint_t type, /* bmRequestType */ 266 uint_t what, /* 0, interface, endpoint number */ 267 uint16_t *status, 268 usb_flags_t flags) 269 { 270 return (usb_get_status(dip, ph, type, what, status, flags)); 271 } 272 273 274 int 275 usba10_usb_clear_feature( 276 dev_info_t *dip, 277 usb_pipe_handle_t ph, 278 uint_t type, /* bmRequestType */ 279 uint_t feature, 280 uint_t what, /* 0, interface, endpoint number */ 281 usb_flags_t flags) 282 { 283 return (usb_clear_feature(dip, ph, type, feature, what, flags)); 284 } 285 286 287 int 288 usba10_usb_pipe_ctrl_xfer_wait( 289 usb_pipe_handle_t pipe_handle, 290 usb_ctrl_setup_t *setup, 291 mblk_t **data, 292 usb_cr_t *completion_reason, 293 usb_cb_flags_t *cb_flags, 294 usb_flags_t flags) 295 { 296 return (usb_pipe_ctrl_xfer_wait( 297 pipe_handle, setup, data, completion_reason, cb_flags, flags)); 298 } 299 300 301 int 302 usba10_usb_set_cfg( 303 dev_info_t *dip, 304 uint_t cfg_index, 305 usb_flags_t usb_flags, 306 void (*cb)( 307 usb_pipe_handle_t ph, 308 usb_opaque_t arg, 309 int rval, 310 usb_cb_flags_t flags), 311 usb_opaque_t cb_arg) 312 { 313 return (usb_set_cfg(dip, cfg_index, usb_flags, cb, cb_arg)); 314 } 315 316 317 int 318 usba10_usb_get_cfg( 319 dev_info_t *dip, 320 uint_t *cfgval, 321 usb_flags_t usb_flags) 322 { 323 return (usb_get_cfg(dip, cfgval, usb_flags)); 324 } 325 326 327 int 328 usba10_usb_set_alt_if( 329 dev_info_t *dip, 330 uint_t interface, 331 uint_t alt_number, 332 usb_flags_t usb_flags, 333 void (*cb)( 334 usb_pipe_handle_t ph, 335 usb_opaque_t arg, 336 int rval, 337 usb_cb_flags_t flags), 338 usb_opaque_t cb_arg) 339 { 340 return (usb_set_alt_if( 341 dip, interface, alt_number, usb_flags, cb, cb_arg)); 342 } 343 344 345 int 346 usba10_usb_get_alt_if( 347 dev_info_t *dip, 348 uint_t if_number, 349 uint_t *alt_number, 350 usb_flags_t flags) 351 { 352 return (usb_get_alt_if(dip, if_number, alt_number, flags)); 353 } 354 355 356 usb_bulk_req_t * 357 usba10_usb_alloc_bulk_req( 358 dev_info_t *dip, 359 size_t len, 360 usb_flags_t flags) 361 { 362 return (usb_alloc_bulk_req(dip, len, flags)); 363 } 364 365 366 void 367 usba10_usb_free_bulk_req(usb_bulk_req_t *reqp) 368 { 369 usb_free_bulk_req(reqp); 370 } 371 372 373 int 374 usba10_usb_pipe_bulk_xfer( 375 usb_pipe_handle_t pipe_handle, 376 usb_bulk_req_t *reqp, 377 usb_flags_t flags) 378 { 379 return (usb_pipe_bulk_xfer(pipe_handle, reqp, flags)); 380 } 381 382 383 int 384 usba10_usb_pipe_bulk_transfer_size( 385 dev_info_t *dip, 386 size_t *size) 387 { 388 return (usb_pipe_bulk_transfer_size(dip, size)); 389 } 390 391 392 usb_intr_req_t * 393 usba10_usb_alloc_intr_req( 394 dev_info_t *dip, 395 size_t len, 396 usb_flags_t flags) 397 { 398 return (usb_alloc_intr_req(dip, len, flags)); 399 } 400 401 402 void 403 usba10_usb_free_intr_req(usb_intr_req_t *reqp) 404 { 405 usb_free_intr_req(reqp); 406 } 407 408 409 int 410 usba10_usb_pipe_intr_xfer( 411 usb_pipe_handle_t pipe_handle, 412 usb_intr_req_t *req, 413 usb_flags_t flags) 414 { 415 return (usb_pipe_intr_xfer(pipe_handle, req, flags)); 416 } 417 418 419 void 420 usba10_usb_pipe_stop_intr_polling( 421 usb_pipe_handle_t pipe_handle, 422 usb_flags_t flags) 423 { 424 usb_pipe_stop_intr_polling(pipe_handle, flags); 425 } 426 427 428 usb_isoc_req_t * 429 usba10_usb_alloc_isoc_req( 430 dev_info_t *dip, 431 uint_t isoc_pkts_count, 432 size_t len, 433 usb_flags_t flags) 434 { 435 return (usb_alloc_isoc_req(dip, isoc_pkts_count, len, flags)); 436 } 437 438 439 void 440 usba10_usb_free_isoc_req(usb_isoc_req_t *usb_isoc_req) 441 { 442 usb_free_isoc_req(usb_isoc_req); 443 } 444 445 446 usb_frame_number_t 447 usba10_usb_get_current_frame_number(dev_info_t *dip) 448 { 449 return (usb_get_current_frame_number(dip)); 450 } 451 452 453 uint_t 454 usba10_usb_get_max_isoc_pkts(dev_info_t *dip) 455 { 456 return (usb_get_max_isoc_pkts(dip)); 457 } 458 459 460 int 461 usba10_usb_pipe_isoc_xfer( 462 usb_pipe_handle_t pipe_handle, 463 usb_isoc_req_t *reqp, 464 usb_flags_t flags) 465 { 466 return (usb_pipe_isoc_xfer(pipe_handle, reqp, flags)); 467 } 468 469 470 void 471 usba10_usb_pipe_stop_isoc_polling( 472 usb_pipe_handle_t pipe_handle, 473 usb_flags_t flags) 474 { 475 usb_pipe_stop_isoc_polling(pipe_handle, flags); 476 } 477 478 479 int 480 usba10_usb_req_raise_power( 481 dev_info_t *dip, 482 int comp, 483 int level, 484 void (*cb)(void *arg, int rval), 485 void *arg, 486 usb_flags_t flags) 487 { 488 return (usb_req_raise_power(dip, comp, level, cb, arg, flags)); 489 } 490 491 492 int 493 usba10_usb_req_lower_power( 494 dev_info_t *dip, 495 int comp, 496 int level, 497 void (*cb)(void *arg, int rval), 498 void *arg, 499 usb_flags_t flags) 500 { 501 return (usb_req_raise_power(dip, comp, level, cb, arg, flags)); 502 } 503 504 505 int 506 usba10_usb_is_pm_enabled(dev_info_t *dip) 507 { 508 return (usb_is_pm_enabled(dip)); 509 } 510 511 int 512 usba10_usb_handle_remote_wakeup( 513 dev_info_t *dip, 514 int cmd) 515 { 516 return (usb_handle_remote_wakeup(dip, cmd)); 517 } 518 519 520 int 521 usba10_usb_create_pm_components( 522 dev_info_t *dip, 523 uint_t *pwrstates) 524 { 525 return (usb_create_pm_components(dip, pwrstates)); 526 } 527 528 529 int 530 usba10_usb_set_device_pwrlvl0(dev_info_t *dip) 531 { 532 return (usb_set_device_pwrlvl0(dip)); 533 } 534 535 536 int 537 usba10_usb_set_device_pwrlvl1(dev_info_t *dip) 538 { 539 return (usb_set_device_pwrlvl1(dip)); 540 } 541 542 543 int 544 usba10_usb_set_device_pwrlvl2(dev_info_t *dip) 545 { 546 return (usb_set_device_pwrlvl2(dip)); 547 } 548 549 550 int 551 usba10_usb_set_device_pwrlvl3(dev_info_t *dip) 552 { 553 return (usb_set_device_pwrlvl3(dip)); 554 } 555 556 557 int 558 usba10_usb_async_req( 559 dev_info_t *dip, 560 void (*func)(void *), 561 void *arg, 562 usb_flags_t flag) 563 { 564 return (usb_async_req(dip, func, arg, flag)); 565 } 566 567 568 int 569 usba10_usb_register_event_cbs( 570 dev_info_t *dip, 571 usb_event_t *usb_evt_data, 572 usb_flags_t flags) 573 { 574 return (usb_register_event_cbs(dip, usb_evt_data, flags)); 575 } 576 577 578 void 579 usba10_usb_unregister_event_cbs( 580 dev_info_t *dip, 581 usb_event_t *usb_evt_data) 582 { 583 usb_unregister_event_cbs(dip, usb_evt_data); 584 } 585 586 587 void 588 usba10_usb_fail_checkpoint( 589 dev_info_t *dip, 590 usb_flags_t flags) 591 { 592 usb_fail_checkpoint(dip, flags); 593 } 594 595 596 int 597 usba10_usba_vlog( 598 usb_log_handle_t handle, 599 uint_t level, 600 uint_t mask, 601 char *fmt, 602 va_list ap) 603 { 604 return (usba_vlog(handle, level, mask, fmt, ap)); 605 } 606 607 608 usb_log_handle_t 609 usba10_usb_alloc_log_handle( 610 dev_info_t *dip, 611 char *name, 612 uint_t *errlevel, 613 uint_t *mask, 614 uint_t *instance_filter, 615 uint_t show_label, 616 usb_flags_t flags) 617 { 618 return (usb_alloc_log_handle( 619 dip, name, errlevel, mask, instance_filter, show_label, flags)); 620 } 621 622 623 void 624 usba10_usb_free_log_handle(usb_log_handle_t handle) 625 { 626 usb_free_log_handle(handle); 627 } 628 629 630 int 631 usba10_usb_log_descr_tree( 632 usb_client_dev_data_t *dev_data, 633 usb_log_handle_t log_handle, 634 uint_t level, 635 uint_t mask) 636 { 637 return (usb_log_descr_tree(dev_data, log_handle, level, mask)); 638 } 639 640 641 int 642 usba10_usb_print_descr_tree( 643 dev_info_t *dip, 644 usb_client_dev_data_t *dev_data) 645 { 646 return (usb_print_descr_tree(dip, dev_data)); 647 } 648 649 650 int 651 usba10_usb_check_same_device( 652 dev_info_t *dip, 653 usb_log_handle_t log_handle, 654 int log_level, 655 int log_mask, 656 uint_t check_mask, 657 char *device_string) 658 { 659 return (usb_check_same_device( 660 dip, log_handle, log_level, log_mask, check_mask, device_string)); 661 } 662 663 664 const char * 665 usba10_usb_str_cr(usb_cr_t cr) 666 { 667 return (usb_str_cr(cr)); 668 } 669 670 671 char * 672 usba10_usb_str_cb_flags( 673 usb_cb_flags_t cb_flags, 674 char *buffer, 675 size_t length) 676 { 677 return (usb_str_cb_flags(cb_flags, buffer, length)); 678 } 679 680 681 const char * 682 usba10_usb_str_pipe_state(usb_pipe_state_t state) 683 { 684 return (usb_str_pipe_state(state)); 685 } 686 687 688 const char * 689 usba10_usb_str_dev_state(int state) 690 { 691 return (usb_str_dev_state(state)); 692 } 693 694 695 const char * 696 usba10_usb_str_rval(int rval) 697 { 698 return (usb_str_rval(rval)); 699 } 700 701 702 int 703 usba10_usb_rval2errno(int rval) 704 { 705 return (usb_rval2errno(rval)); 706 } 707 708 709 usb_serialization_t 710 usba10_usb_init_serialization( 711 dev_info_t *s_dip, 712 uint_t flag) 713 { 714 return (usb_init_serialization(s_dip, flag)); 715 } 716 717 718 void 719 usba10_usb_fini_serialization(usb_serialization_t usb_serp) 720 { 721 usb_fini_serialization(usb_serp); 722 } 723 724 725 int 726 usba10_usb_serialize_access( 727 usb_serialization_t usb_serp, 728 uint_t how_to_wait, 729 uint_t delta_timeout) 730 { 731 return (usb_serialize_access( 732 usb_serp, how_to_wait, delta_timeout)); 733 } 734 735 736 int 737 usba10_usb_try_serialize_access( 738 usb_serialization_t usb_serp, 739 uint_t flag) 740 { 741 return (usb_try_serialize_access(usb_serp, flag)); 742 } 743 744 745 void 746 usba10_usb_release_access(usb_serialization_t usb_serp) 747 { 748 usb_release_access(usb_serp); 749 } 750 751 #endif 752