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 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26
27 /*
28 * USBA: Solaris USB Architecture support
29 *
30 * all functions exposed to client drivers have prefix usb_ while all USBA
31 * internal functions or functions exposed to HCD or hubd only have prefix
32 * usba_
33 *
34 * this file contains all USBAI pipe management
35 * usb_pipe_open()
36 * usb_pipe_close()
37 * usb_pipe_set_private()
38 * usb_pipe_get_private()
39 * usb_pipe_abort()
40 * usb_pipe_reset()
41 * usb_pipe_drain_reqs()
42 */
43 #define USBA_FRAMEWORK
506 TASKQ_PREPOPULATE);
507 ASSERT(usba_device->usb_shared_taskq[iface] != NULL);
508 }
509 usba_device->usb_shared_taskq_ref_count[iface]++;
510 }
511
512 ph_data->p_dip = dip;
513 ph_data->p_usba_device = usba_device;
514 ph_data->p_ep = *ep;
515 ph_data->p_ph_impl = ph_impl;
516 if ((ep->bmAttributes & USB_EP_ATTR_MASK) ==
517 USB_EP_ATTR_ISOCH) {
518 ph_data->p_spec_flag |= USBA_PH_FLAG_USE_SOFT_INTR;
519 }
520
521 /* fix up the MaxPacketSize if it is the default endpoint descr */
522 if ((ep == &usba_default_ep_descr) && usba_device) {
523 uint16_t maxpktsize;
524
525 maxpktsize = usba_device->usb_dev_descr->bMaxPacketSize0;
526 if (usba_device->usb_is_wireless) {
527 /*
528 * according to wusb 1.0 spec 4.8.1, the host must
529 * assume a wMaxPacketSize of 512 for the default
530 * control pipe of a wusb device
531 */
532 maxpktsize = 0x200;
533 }
534 USB_DPRINTF_L3(DPRINT_MASK_USBAI, usbai_log_handle,
535 "adjusting max packet size from %d to %d",
536 ph_data->p_ep.wMaxPacketSize, maxpktsize);
537
538 ph_data->p_ep.wMaxPacketSize = maxpktsize;
539 }
540
541 /* now update usba_ph_impl structure */
542 mutex_enter(&ph_impl->usba_ph_mutex);
543 ph_impl->usba_ph_dip = dip;
544 ph_impl->usba_ph_ep = ph_data->p_ep;
545 ph_impl->usba_ph_policy = ph_data->p_policy = *pipe_policy;
546 mutex_exit(&ph_impl->usba_ph_mutex);
547
548 usba_init_list(&ph_data->p_queue, (usb_opaque_t)ph_data, iblock_cookie);
549 usba_init_list(&ph_data->p_cb_queue, (usb_opaque_t)ph_data,
550 iblock_cookie);
551 mutex_exit(&usba_device->usb_mutex);
552 mutex_exit(&ph_data->p_mutex);
553
|
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 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 *
25 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
26 */
27
28
29 /*
30 * USBA: Solaris USB Architecture support
31 *
32 * all functions exposed to client drivers have prefix usb_ while all USBA
33 * internal functions or functions exposed to HCD or hubd only have prefix
34 * usba_
35 *
36 * this file contains all USBAI pipe management
37 * usb_pipe_open()
38 * usb_pipe_close()
39 * usb_pipe_set_private()
40 * usb_pipe_get_private()
41 * usb_pipe_abort()
42 * usb_pipe_reset()
43 * usb_pipe_drain_reqs()
44 */
45 #define USBA_FRAMEWORK
508 TASKQ_PREPOPULATE);
509 ASSERT(usba_device->usb_shared_taskq[iface] != NULL);
510 }
511 usba_device->usb_shared_taskq_ref_count[iface]++;
512 }
513
514 ph_data->p_dip = dip;
515 ph_data->p_usba_device = usba_device;
516 ph_data->p_ep = *ep;
517 ph_data->p_ph_impl = ph_impl;
518 if ((ep->bmAttributes & USB_EP_ATTR_MASK) ==
519 USB_EP_ATTR_ISOCH) {
520 ph_data->p_spec_flag |= USBA_PH_FLAG_USE_SOFT_INTR;
521 }
522
523 /* fix up the MaxPacketSize if it is the default endpoint descr */
524 if ((ep == &usba_default_ep_descr) && usba_device) {
525 uint16_t maxpktsize;
526
527 maxpktsize = usba_device->usb_dev_descr->bMaxPacketSize0;
528 USB_DPRINTF_L3(DPRINT_MASK_USBAI, usbai_log_handle,
529 "adjusting max packet size from %d to %d",
530 ph_data->p_ep.wMaxPacketSize, maxpktsize);
531
532 ph_data->p_ep.wMaxPacketSize = maxpktsize;
533 }
534
535 /* now update usba_ph_impl structure */
536 mutex_enter(&ph_impl->usba_ph_mutex);
537 ph_impl->usba_ph_dip = dip;
538 ph_impl->usba_ph_ep = ph_data->p_ep;
539 ph_impl->usba_ph_policy = ph_data->p_policy = *pipe_policy;
540 mutex_exit(&ph_impl->usba_ph_mutex);
541
542 usba_init_list(&ph_data->p_queue, (usb_opaque_t)ph_data, iblock_cookie);
543 usba_init_list(&ph_data->p_cb_queue, (usb_opaque_t)ph_data,
544 iblock_cookie);
545 mutex_exit(&usba_device->usb_mutex);
546 mutex_exit(&ph_data->p_mutex);
547
|