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