FreeBSD kernel usb device Code
|
#include "opt_ddb.h"
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/types.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/module.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/condvar.h>
#include <sys/sysctl.h>
#include <sys/sx.h>
#include <sys/unistd.h>
#include <sys/callout.h>
#include <sys/malloc.h>
#include <sys/priv.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usb_core.h>
#include <dev/usb/usb_debug.h>
#include <dev/usb/usb_process.h>
#include <dev/usb/usb_busdma.h>
#include <dev/usb/usb_dynamic.h>
#include <dev/usb/usb_device.h>
#include <dev/usb/usb_dev.h>
#include <dev/usb/usb_hub.h>
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
#include <dev/usb/usb_pf.h>
#include "usb_if.h"
Go to the source code of this file.
Macros | |
#define | USB_DEBUG_VAR usb_ctrl_debug |
Functions | |
static void | usb_attach_sub (device_t, struct usb_bus *) |
SYSCTL_INT (_hw_usb, OID_AUTO, no_suspend_wait, CTLFLAG_RWTUN, &usb_no_suspend_wait, 0, "No USB device waiting at system suspend.") | |
SYSCTL_INT (_hw_usb, OID_AUTO, no_shutdown_wait, CTLFLAG_RWTUN, &usb_no_shutdown_wait, 0, "No USB device waiting at system shutdown.") | |
DRIVER_MODULE (usbus, ohci, usb_driver, usb_devclass, 0, 0) | |
DRIVER_MODULE (usbus, uhci, usb_driver, usb_devclass, 0, 0) | |
DRIVER_MODULE (usbus, ehci, usb_driver, usb_devclass, 0, 0) | |
DRIVER_MODULE (usbus, xhci, usb_driver, usb_devclass, 0, 0) | |
DRIVER_MODULE (usbus, musbotg, usb_driver, usb_devclass, 0, 0) | |
DRIVER_MODULE (usbus, uss820dci, usb_driver, usb_devclass, 0, 0) | |
DRIVER_MODULE (usbus, octusb, usb_driver, usb_devclass, 0, 0) | |
DRIVER_MODULE (usbus, dwcotg, usb_driver, usb_devclass, 0, 0) | |
DRIVER_MODULE (usbus, saf1761otg, usb_driver, usb_devclass, 0, 0) | |
static int | usb_probe (device_t dev) |
static int | usb_attach (device_t dev) |
static int | usb_detach (device_t dev) |
static int | usb_suspend (device_t dev) |
static int | usb_resume (device_t dev) |
void | usb_bus_reset_async_locked (struct usb_bus *bus) |
static int | usb_shutdown (device_t dev) |
static void | usb_bus_explore (struct usb_proc_msg *pm) |
static void | usb_bus_detach (struct usb_proc_msg *pm) |
static void | usb_bus_suspend (struct usb_proc_msg *pm) |
static void | usb_bus_resume (struct usb_proc_msg *pm) |
static void | usb_bus_reset (struct usb_proc_msg *pm) |
static void | usb_bus_shutdown (struct usb_proc_msg *pm) |
static void | usb_power_wdog (void *arg) |
static void | usb_bus_attach (struct usb_proc_msg *pm) |
SYSUNINIT (usb_bus_unload, SI_SUB_KLD, SI_ORDER_ANY, usb_bus_unload, NULL) | |
uint8_t | usb_bus_mem_alloc_all (struct usb_bus *bus, bus_dma_tag_t dmat, usb_bus_mem_cb_t *cb) |
void | usb_bus_mem_free_all (struct usb_bus *bus, usb_bus_mem_cb_t *cb) |
void | usb_proc_explore_mwait (struct usb_device *udev, void *pm1, void *pm2) |
void * | usb_proc_explore_msignal (struct usb_device *udev, void *pm1, void *pm2) |
void | usb_proc_explore_lock (struct usb_device *udev) |
void | usb_proc_explore_unlock (struct usb_device *udev) |
Variables | |
static device_probe_t | usb_probe |
static device_attach_t | usb_attach |
static device_detach_t | usb_detach |
static device_suspend_t | usb_suspend |
static device_resume_t | usb_resume |
static device_shutdown_t | usb_shutdown |
static int | usb_no_suspend_wait = 0 |
static int | usb_no_shutdown_wait = 0 |
static devclass_t | usb_devclass |
static device_method_t | usb_methods [] |
static driver_t | usb_driver |
#define USB_DEBUG_VAR usb_ctrl_debug |
Definition at line 56 of file usb_controller.c.
DRIVER_MODULE | ( | usbus | , |
dwcotg | , | ||
usb_driver | , | ||
usb_devclass | , | ||
0 | , | ||
0 | |||
) |
DRIVER_MODULE | ( | usbus | , |
ehci | , | ||
usb_driver | , | ||
usb_devclass | , | ||
0 | , | ||
0 | |||
) |
DRIVER_MODULE | ( | usbus | , |
musbotg | , | ||
usb_driver | , | ||
usb_devclass | , | ||
0 | , | ||
0 | |||
) |
DRIVER_MODULE | ( | usbus | , |
octusb | , | ||
usb_driver | , | ||
usb_devclass | , | ||
0 | , | ||
0 | |||
) |
DRIVER_MODULE | ( | usbus | , |
ohci | , | ||
usb_driver | , | ||
usb_devclass | , | ||
0 | , | ||
0 | |||
) |
DRIVER_MODULE | ( | usbus | , |
saf1761otg | , | ||
usb_driver | , | ||
usb_devclass | , | ||
0 | , | ||
0 | |||
) |
DRIVER_MODULE | ( | usbus | , |
uhci | , | ||
usb_driver | , | ||
usb_devclass | , | ||
0 | , | ||
0 | |||
) |
DRIVER_MODULE | ( | usbus | , |
uss820dci | , | ||
usb_driver | , | ||
usb_devclass | , | ||
0 | , | ||
0 | |||
) |
DRIVER_MODULE | ( | usbus | , |
xhci | , | ||
usb_driver | , | ||
usb_devclass | , | ||
0 | , | ||
0 | |||
) |
SYSCTL_INT | ( | _hw_usb | , |
OID_AUTO | , | ||
no_shutdown_wait | , | ||
CTLFLAG_RWTUN | , | ||
& | usb_no_shutdown_wait, | ||
0 | , | ||
"No USB device waiting at system shutdown." | |||
) |
SYSCTL_INT | ( | _hw_usb | , |
OID_AUTO | , | ||
no_suspend_wait | , | ||
CTLFLAG_RWTUN | , | ||
& | usb_no_suspend_wait, | ||
0 | , | ||
"No USB device waiting at system suspend." | |||
) |
SYSUNINIT | ( | usb_bus_unload | , |
SI_SUB_KLD | , | ||
SI_ORDER_ANY | , | ||
usb_bus_unload | , | ||
NULL | |||
) |
|
static |
Definition at line 171 of file usb_controller.c.
References bus, dev, DPRINTF, and usb_attach_sub().
|
static |
Definition at line 804 of file usb_controller.c.
References usb_bus::attach_msg, usb_bus_msg::bus, usb_bus::bus_mtx, usb_bus::detach_msg, dev, usb_bus::explore_msg, usb_bus_msg::hdr, usb_proc_msg::pm_callback, usb_bus::reset_msg, usb_bus::resume_msg, usb_bus::shutdown_msg, usb_bus::suspend_msg, usb_bus_attach(), usb_bus_detach(), usb_bus_explore(), USB_BUS_LOCK, usb_bus_reset(), usb_bus_resume(), usb_bus_shutdown(), usb_bus_suspend(), USB_BUS_UNLOCK, usb_devclass_ptr, usb_needs_explore(), USB_PRI_HIGH, USB_PRI_HIGHEST, USB_PRI_MED, usb_proc_create(), usb_proc_msignal(), and usbpf_attach().
Referenced by usb_attach().
|
static |
Definition at line 701 of file usb_controller.c.
References usb_bus::bdev, usb_bus_msg::bus, usb_device::bus, bus, child, dev, usb_bus::devices, DPRINTF, usb_device::hub, usb_bus::hw_power_state, usb_bus::methods, usb_bus_methods::set_hw_power, usb_device::speed, usb_alloc_device(), USB_BUS_LOCK, USB_BUS_UNLOCK, USB_ERR_NO_ROOT_HUB, USB_ERR_NOMEM, USB_HW_POWER_BULK, USB_HW_POWER_CONTROL, USB_HW_POWER_INTERRUPT, USB_HW_POWER_ISOC, USB_HW_POWER_NON_ROOT_HUB, USB_IFACE_INDEX_ANY, USB_MODE_HOST, usb_power_wdog(), usb_probe_and_attach(), USB_REV_1_0, USB_REV_1_1, USB_REV_2_0, USB_REV_2_5, USB_REV_3_0, USB_ROOT_HUB_ADDR, USB_SPEED_FULL, USB_SPEED_HIGH, USB_SPEED_SUPER, USB_SPEED_VARIABLE, usbd_errstr(), and usb_bus::usbrev.
Referenced by usb_attach_sub().
|
static |
Definition at line 427 of file usb_controller.c.
References usb_bus::bdev, usb_bus_msg::bus, usb_device::bus, bus, dev, usb_bus::devices, USB_BUS_LOCK, USB_BUS_UNLOCK, usb_free_device(), and USB_ROOT_HUB_ADDR.
Referenced by usb_attach_sub().
|
static |
Definition at line 366 of file usb_controller.c.
References usb_bus_msg::bus, usb_device::bus, bus, usb_bus::devices, usb_bus::do_probe, usb_bus::driver_added_refcount, usb_hub::explore, usb_device::hub, usb_bus::no_explore, uhub_explore_handle_re_enumerate(), USB_BUS_LOCK, usb_bus_powerd(), USB_BUS_UNLOCK, usb_proc_rewakeup(), and USB_ROOT_HUB_ADDR.
Referenced by usb_attach_sub().
uint8_t usb_bus_mem_alloc_all | ( | struct usb_bus * | bus, |
bus_dma_tag_t | dmat, | ||
usb_bus_mem_cb_t * | cb | ||
) |
Definition at line 946 of file usb_controller.c.
References usb_bus::alloc_failed, usb_bus_msg::bus, usb_bus::bus_mtx, usb_bus::bus_spin_lock, usb_bus::devices, usb_bus::devices_max, usb_bus::dma_bits, usb_bus::intr_q, usb_bus::parent, usb_bus::power_wdog, USB_BUS_DMA_TAG_MAX, usb_bus_mem_free_all(), usb_callout_init_mtx, usb_dma_tag_setup(), USB_MAX_DEVICES, and USB_MIN_DEVICES.
Referenced by awusbdrd_attach(), dwc_otg_init(), ehci_msm_attach(), ehci_pci_attach(), fsl_ehci_attach(), generic_ehci_attach(), generic_ohci_attach(), imx_ehci_attach(), mv_ehci_attach(), ohci_pci_attach(), uhci_pci_attach(), and xhci_init().
void usb_bus_mem_free_all | ( | struct usb_bus * | bus, |
usb_bus_mem_cb_t * | cb | ||
) |
Definition at line 1000 of file usb_controller.c.
References usb_bus_msg::bus, usb_bus::bus_mtx, usb_bus::bus_spin_lock, and usb_dma_tag_unsetup().
Referenced by awusbdrd_detach(), dwc_otg_detach(), ehci_msm_detach(), ehci_pci_detach(), generic_ehci_detach(), generic_ohci_detach(), imx_ehci_detach(), mv_ehci_detach(), ohci_pci_detach(), uhci_pci_detach(), usb_bus_mem_alloc_all(), and xhci_uninit().
|
static |
Definition at line 581 of file usb_controller.c.
References usb_bus::bdev, usb_bus_msg::bus, bus, DPRINTF, usb_bus::no_explore, usb_bus_resume(), and usb_bus_suspend().
Referenced by usb_attach_sub().
void usb_bus_reset_async_locked | ( | struct usb_bus * | bus | ) |
Definition at line 309 of file usb_controller.c.
References bus, DPRINTF, USB_BUS_LOCK_ASSERT, and usb_proc_msignal().
Referenced by xhci_do_command().
|
static |
Definition at line 518 of file usb_controller.c.
References usb_bus::bdev, usb_bus_msg::bus, usb_device::bus, bus, usb_bus::devices, DPRINTF, usb_bus::hw_power_state, usb_bus::methods, usb_bus::no_explore, usb_bus_methods::set_hw_power, usb_bus_methods::set_hw_power_sleep, USB_BUS_LOCK, USB_BUS_UNLOCK, USB_HW_POWER_BULK, USB_HW_POWER_CONTROL, USB_HW_POWER_INTERRUPT, USB_HW_POWER_ISOC, USB_HW_POWER_NON_ROOT_HUB, USB_HW_POWER_RESUME, USB_IFACE_INDEX_ANY, usb_probe_and_attach(), USB_ROOT_HUB_ADDR, usbd_enum_lock(), usbd_enum_unlock(), and usbd_set_config_index().
Referenced by usb_attach_sub(), and usb_bus_reset().
|
static |
Definition at line 603 of file usb_controller.c.
References usb_bus::bdev, usb_bus_msg::bus, usb_device::bus, bus, usb_bus::devices, usb_bus::hw_power_state, usb_bus::methods, usb_bus::no_explore, usb_bus_methods::set_hw_power, usb_bus_methods::set_hw_power_sleep, USB_BUS_LOCK, USB_BUS_UNLOCK, USB_HW_POWER_SHUTDOWN, USB_ROOT_HUB_ADDR, USB_UNCONFIG_INDEX, usbd_enum_lock(), usbd_enum_unlock(), and usbd_set_config_index().
Referenced by usb_attach_sub().
|
static |
Definition at line 461 of file usb_controller.c.
References usb_bus::bdev, usb_bus_msg::bus, usb_device::bus, bus, usb_bus::devices, DPRINTF, usb_bus::hw_power_state, usb_bus::methods, usb_bus::no_explore, usb_bus_methods::set_hw_power, usb_bus_methods::set_hw_power_sleep, USB_BUS_LOCK, USB_BUS_UNLOCK, USB_HW_POWER_SUSPEND, USB_ROOT_HUB_ADDR, USB_UNCONFIG_INDEX, usbd_enum_lock(), usbd_enum_unlock(), and usbd_set_config_index().
Referenced by usb_attach_sub(), and usb_bus_reset().
|
static |
Definition at line 197 of file usb_controller.c.
References bus, dev, DPRINTF, USB_BUS_LOCK, USB_BUS_UNLOCK, usb_callout_drain, usb_proc_free(), usb_proc_msignal(), usb_proc_mwait(), and usbpf_detach().
|
static |
Definition at line 669 of file usb_controller.c.
References bus, USB_BUS_LOCK, USB_BUS_LOCK_ASSERT, usb_bus_power_update(), USB_BUS_UNLOCK, usb_callout_reset, usb_power_wdog(), and usb_proc_rewakeup().
Referenced by usb_bus_attach(), and usb_power_wdog().
|
static |
Definition at line 149 of file usb_controller.c.
References DPRINTF.
void usb_proc_explore_lock | ( | struct usb_device * | udev | ) |
Definition at line 1027 of file usb_controller.c.
References usb_device::bus, and USB_BUS_LOCK.
Referenced by ugold_detach(), ugold_readout_msg(), and ugold_timeout().
void * usb_proc_explore_msignal | ( | struct usb_device * | udev, |
void * | pm1, | ||
void * | pm2 | ||
) |
Definition at line 1021 of file usb_controller.c.
References usb_device::bus, and usb_proc_msignal().
Referenced by ugold_timeout().
void usb_proc_explore_mwait | ( | struct usb_device * | udev, |
void * | pm1, | ||
void * | pm2 | ||
) |
Definition at line 1015 of file usb_controller.c.
References usb_device::bus, and usb_proc_mwait().
Referenced by ugold_detach().
void usb_proc_explore_unlock | ( | struct usb_device * | udev | ) |
Definition at line 1033 of file usb_controller.c.
References usb_device::bus, and USB_BUS_UNLOCK.
Referenced by ugold_detach(), ugold_readout_msg(), and ugold_timeout().
|
static |
Definition at line 286 of file usb_controller.c.
References bus, dev, DPRINTF, USB_BUS_LOCK, USB_BUS_UNLOCK, and usb_proc_msignal().
|
static |
Definition at line 331 of file usb_controller.c.
References bus, dev, DPRINTF, USB_BUS_LOCK, USB_BUS_UNLOCK, usb_no_shutdown_wait, usb_proc_msignal(), and usb_proc_mwait().
|
static |
Definition at line 258 of file usb_controller.c.
References bus, dev, DPRINTF, USB_BUS_LOCK, USB_BUS_UNLOCK, usb_no_suspend_wait, usb_proc_msignal(), and usb_proc_mwait().
|
static |
Definition at line 76 of file usb_controller.c.
|
static |
Definition at line 77 of file usb_controller.c.
|
static |
Definition at line 109 of file usb_controller.c.
|
static |
Definition at line 122 of file usb_controller.c.
|
static |
Definition at line 111 of file usb_controller.c.
|
static |
Definition at line 105 of file usb_controller.c.
Referenced by usb_shutdown().
|
static |
Definition at line 101 of file usb_controller.c.
Referenced by usb_suspend().
|
static |
Definition at line 75 of file usb_controller.c.
|
static |
Definition at line 79 of file usb_controller.c.
|
static |
Definition at line 80 of file usb_controller.c.
|
static |
Definition at line 78 of file usb_controller.c.