Lines Matching +full:has +full:- +full:transaction +full:- +full:translator
1 /* SPDX-License-Identifier: GPL-2.0 */
14 #include <linux/errno.h> /* for -ENODEV */
31 /*-------------------------------------------------------------------------*/
34 * Host-side wrappers for standard USB descriptors ... these are parsed
38 * - devices have one (usually) or more configs;
39 * - configs have one (often) or more interfaces;
40 * - interfaces have one (usually) or more settings;
41 * - each interface setting has zero or (usually) more endpoints.
42 * - a SuperSpeed endpoint has a companion descriptor
46 * Devices may also have class-specific or vendor-specific descriptors.
52 * struct usb_host_endpoint - host-side endpoint descriptor and queue
63 * @streams: number of USB-3 streams allocated on the endpoint
82 /* host-side wrapper for one interface setting's parsed descriptors */
175 * struct usb_interface - what usb device drivers talk to
186 * function of the driver, after it has been assigned a minor
191 * @ep_devs_created: endpoint child pseudo-devices exist
193 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup
195 * @needs_altsetting0: flag set when a set-interface request for altsetting 0
196 * has been deferred.
197 * @needs_binding: flag set when the driver should be re-probed or unbound
224 * All standards-conformant USB devices that use isochronous endpoints
225 * will use them in non-default settings.
271 return dev_get_drvdata(&intf->dev); in usb_get_intfdata()
276 dev_set_drvdata(&intf->dev, data); in usb_set_intfdata()
315 * struct usb_interface_cache - long-term representation of a device interface
318 * @altsetting: variable-length array of interface structures, one for
326 * providing support for the /sys/kernel/debug/usb/devices pseudo-file.
332 /* variable-length array of alternate settings for this interface,
342 * struct usb_host_config - representation of a device's configuration
361 * for example, a dual-speed device would have separate configurations for
362 * full-speed and high-speed operation. The number of configurations
368 * are supposed to be numbered from 0 to desc.bNumInterfaces-1, but a lot
421 __usb_get_extra_descriptor((ifpoint)->extra, \
422 (ifpoint)->extralen, \
425 /* ----------------------------------------------------------------------- */
446 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */
456 * round-robin allocation */
473 unsigned resuming_ports; /* bit array: resuming root-hub ports */
476 struct mon_bus *mon_bus; /* non-null when associated */
477 int monitored; /* non-zero when monitored */
488 /* ----------------------------------------------------------------------- */
534 * PEL and SEL are USB 3.0 Link PM latencies for device-initiated LPM exit.
535 * MEL is the USB 3.0 Link PM latency for host-initiated LPM exit.
547 * Maximum exit latency for a device-initiated LPM transition to bring
557 * receive the data packet. Basically, SEL should be the worse-case
571 * struct usb_device - kernel's representation of a USB device
577 * @rx_lanes: number of rx lanes in use, USB 3.2 adds dual-lane support
578 * @tx_lanes: number of tx lanes in use, USB 3.2 adds dual-lane support
579 * @tt: Transaction Translator info; used with low/full speed dev, highspeed hub
600 * @authorized: policy has said we can use it;
604 * FIXME -- complete doc
632 * @u1_params: exit latencies for USB3 U1 LPM state, and hub-initiated timeout.
633 * @u2_params: exit latencies for USB3 U2 LPM state, and hub-initiated timeout.
639 * parent->hub_delay + wHubDelay + tTPTransmissionDelay (40ns)
644 * Usbcore drivers should not set usbdev->state directly. Instead use
738 return to_usb_device(intf->dev.parent); in interface_to_usbdev()
747 * usb_hub_for_each_child - iterate over all child devices on the hub
754 port1 <= hdev->maxchild; \
759 #define usb_lock_device(udev) device_lock(&(udev)->dev)
760 #define usb_unlock_device(udev) device_unlock(&(udev)->dev)
761 #define usb_lock_device_interruptible(udev) device_lock_interruptible(&(udev)->dev)
762 #define usb_trylock_device(udev) device_trylock(&(udev)->dev)
797 pm_runtime_mark_last_busy(&udev->dev); in usb_mark_last_busy()
837 if (udev->speed < USB_SPEED_SUPER || !udev->bos || !udev->bos->ss_cap) in usb_device_supports_ltm()
839 return udev->bos->ss_cap->bmAttributes & USB_LTM_SUPPORT; in usb_device_supports_ltm()
844 return udev && udev->bus && udev->bus->no_sg_constraint; in usb_device_no_sg_constraint()
848 /*-------------------------------------------------------------------------*/
863 /* used these for multi-interface device registration */
868 * usb_interface_claimed - returns true iff an interface is claimed
882 return (iface->dev.driver != NULL); in usb_interface_claimed()
911 * usb_make_path - returns stable device path in the usb tree
922 * reconfigured, by re-cabling a tree of USB devices or by moving USB host
925 * neither does rebooting or re-enumerating. These are more useful identifiers
938 actual = snprintf(buf, size, "usb-%s-%s", dev->bus->bus_name, in usb_make_path()
939 dev->devpath); in usb_make_path()
940 return (actual >= (int)size) ? -1 : actual; in usb_make_path()
943 /*-------------------------------------------------------------------------*/
961 * USB_DEVICE - macro used to describe a specific usb device
973 * USB_DEVICE_VER - describe a specific usb device with a version range
990 * USB_DEVICE_INTERFACE_CLASS - describe a usb device with a specific interface class
1006 * USB_DEVICE_INTERFACE_PROTOCOL - describe a usb device with a specific interface protocol
1022 * USB_DEVICE_INTERFACE_NUMBER - describe a usb device with a specific interface number
1038 * USB_DEVICE_INFO - macro used to describe a class of usb devices
1053 * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces
1068 * USB_DEVICE_AND_INTERFACE_INFO - describe a specific usb device with a class of usb interfaces
1079 * vendor specific bDeviceClass values, but standards-compliant interfaces.
1091 * USB_VENDOR_AND_INTERFACE_INFO - describe a specific usb vendor with a class of usb interfaces
1101 * vendor specific bDeviceClass values, but standards-compliant interfaces.
1111 /* ----------------------------------------------------------------------- */
1132 * struct usbdrv_wrap - wrapper for driver-model structure
1133 * @driver: The driver-model core driver structure.
1134 * @for_devices: Non-zero for device drivers, 0 for interface drivers.
1142 * struct usb_driver - identifies USB interface driver to usbcore
1147 * usb_set_intfdata() to associate driver-specific data with the
1150 * return -ENODEV, if genuine IO errors occurred, an appropriate
1153 * because its device has been (or is being) disconnected or the
1163 * Instead, let the resume or reset-resume routine recover from
1166 * @reset_resume: Called when the suspended device has been reset instead
1169 * reset. This routine must not return until the driver has no active
1173 * has been reset
1181 * @drvwrap: Driver-model core structure wrapper.
1190 * occurs. Device-initiated USB 3.0 link PM will still be allowed.
1243 * struct usb_device_driver - identifies USB device driver to usbcore
1249 * to associate driver-specific data with the device. If unwilling
1252 * because it has been (or is being) disconnected or the driver's
1258 * @drvwrap: Driver-model core structure wrapper.
1291 * struct usb_class_driver - identifies a USB driver that wants to use the USB major number
1323 * module_usb_driver() - Helper macro for registering a USB driver
1345 /* ----------------------------------------------------------------------- */
1352 * urb->transfer_flags:
1357 #define URB_ISO_ASAP 0x0002 /* iso-only; use the first unexpired
1359 #define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */
1361 #define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt
1370 #define URB_DMA_MAP_SINGLE 0x00010000 /* Non-scatter-gather mapping */
1371 #define URB_DMA_MAP_PAGE 0x00020000 /* HCD-unsupported S-G */
1372 #define URB_DMA_MAP_SG 0x00040000 /* HCD-supported S-G */
1373 #define URB_MAP_LOCAL 0x00080000 /* HCD-local-memory mapping */
1375 #define URB_SETUP_MAP_LOCAL 0x00200000 /* HCD-local setup packet */
1376 #define URB_DMA_SG_COMBINED 0x00400000 /* S-G entries were combined */
1399 INIT_LIST_HEAD(&anchor->urb_list); in init_usb_anchor()
1400 init_waitqueue_head(&anchor->wait); in init_usb_anchor()
1401 spin_lock_init(&anchor->lock); in init_usb_anchor()
1407 * struct urb - USB Request Block
1424 * @status: This is read in non-iso completion functions to get the
1427 * each frame is in the fields of the iso_frame-desc.
1452 * @actual_length: This is read in non-iso completion functions, and
1471 * request-specific driver context.
1497 * the device driver is DMA-aware. For example, a device driver might
1530 * to poll for transfers. After the URB has been submitted, the interval
1544 * preceding URB, if that slot has not already expired. If the slot has
1552 * transfer was scheduled. Ranges for frame counter values are HC-specific
1570 * unlinked URBs, and status for all non-ISO transfers. It should not
1576 * When the completion callback is invoked for non-isochronous URBs, the
1606 int status; /* (return) non-ISO status */
1634 /* ----------------------------------------------------------------------- */
1637 * usb_fill_control_urb - initializes a control urb
1659 urb->dev = dev; in usb_fill_control_urb()
1660 urb->pipe = pipe; in usb_fill_control_urb()
1661 urb->setup_packet = setup_packet; in usb_fill_control_urb()
1662 urb->transfer_buffer = transfer_buffer; in usb_fill_control_urb()
1663 urb->transfer_buffer_length = buffer_length; in usb_fill_control_urb()
1664 urb->complete = complete_fn; in usb_fill_control_urb()
1665 urb->context = context; in usb_fill_control_urb()
1669 * usb_fill_bulk_urb - macro to help initialize a bulk urb
1689 urb->dev = dev; in usb_fill_bulk_urb()
1690 urb->pipe = pipe; in usb_fill_bulk_urb()
1691 urb->transfer_buffer = transfer_buffer; in usb_fill_bulk_urb()
1692 urb->transfer_buffer_length = buffer_length; in usb_fill_bulk_urb()
1693 urb->complete = complete_fn; in usb_fill_bulk_urb()
1694 urb->context = context; in usb_fill_bulk_urb()
1698 * usb_fill_int_urb - macro to help initialize a interrupt urb
1731 urb->dev = dev; in usb_fill_int_urb()
1732 urb->pipe = pipe; in usb_fill_int_urb()
1733 urb->transfer_buffer = transfer_buffer; in usb_fill_int_urb()
1734 urb->transfer_buffer_length = buffer_length; in usb_fill_int_urb()
1735 urb->complete = complete_fn; in usb_fill_int_urb()
1736 urb->context = context; in usb_fill_int_urb()
1738 if (dev->speed == USB_SPEED_HIGH || dev->speed >= USB_SPEED_SUPER) { in usb_fill_int_urb()
1742 urb->interval = 1 << (interval - 1); in usb_fill_int_urb()
1744 urb->interval = interval; in usb_fill_int_urb()
1747 urb->start_frame = -1; in usb_fill_int_urb()
1778 * usb_urb_dir_in - check if an URB describes an IN transfer
1781 * Return: 1 if @urb describes an IN transfer (device-to-host),
1786 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_IN; in usb_urb_dir_in()
1790 * usb_urb_dir_out - check if an URB describes an OUT transfer
1793 * Return: 1 if @urb describes an OUT transfer (host-to-device),
1798 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT; in usb_urb_dir_out()
1825 /*-------------------------------------------------------------------*
1827 *-------------------------------------------------------------------*/
1892 * struct usb_sg_request - support for scatter/gather I/O
1941 /* ----------------------------------------------------------------------- */
1944 * For various legacy reasons, Linux has a small cookie that's paired with
1949 * - direction: bit 7 (0 = Host-to-Device [Out],
1950 * 1 = Device-to-Host [In] ...
1952 * - device address: bits 8-14 ... bit positions known to uhci-hcd
1953 * - endpoint: bits 15-18 ... bit positions known to uhci-hcd
1954 * - pipe type: bits 30-31 (00 = isochronous, 01 = interrupt,
1982 return (dev->devnum << 8) | (endpoint << 15); in __create_pipe()
2007 eps = usb_pipein(pipe) ? dev->ep_in : dev->ep_out; in usb_pipe_endpoint()
2011 /*-------------------------------------------------------------------------*/
2021 ep = udev->ep_out[epnum]; in usb_maxpacket()
2024 ep = udev->ep_in[epnum]; in usb_maxpacket()
2030 return usb_endpoint_maxp(&ep->desc); in usb_maxpacket()
2033 /* ----------------------------------------------------------------------- */
2040 case -ENOMEM: in usb_translate_errors()
2041 case -ENODEV: in usb_translate_errors()
2042 case -EOPNOTSUPP: in usb_translate_errors()
2045 return -EIO; in usb_translate_errors()