FreeBSD kernel usb device Code
|
#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/usbdi_util.h>
#include <dev/usb/usb_process.h>
#include <dev/usb/usb_debug.h>
#include <dev/usb/usb_util.h>
#include <sys/proc.h>
#include <sys/kthread.h>
#include <sys/sched.h>
Go to the source code of this file.
Macros | |
#define | USB_DEBUG_VAR usb_proc_debug |
#define | thread_lock(td) mtx_lock_spin(&sched_lock) |
#define | thread_unlock(td) mtx_unlock_spin(&sched_lock) |
#define | USB_THREAD_CREATE(f, s, p, ...) kthread_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__) |
#define | USB_THREAD_SUSPEND_CHECK() kthread_suspend_check(curproc) |
#define | USB_THREAD_SUSPEND(p) kthread_suspend(p,0) |
#define | USB_THREAD_EXIT(err) kthread_exit(err) |
Functions | |
static void | usb_process (void *arg) |
int | usb_proc_create (struct usb_process *up, struct mtx *p_mtx, const char *pmesg, uint8_t prio) |
void | usb_proc_free (struct usb_process *up) |
void * | usb_proc_msignal (struct usb_process *up, void *_pm0, void *_pm1) |
uint8_t | usb_proc_is_gone (struct usb_process *up) |
void | usb_proc_mwait (struct usb_process *up, void *_pm0, void *_pm1) |
void | usb_proc_drain (struct usb_process *up) |
void | usb_proc_rewakeup (struct usb_process *up) |
int | usb_proc_is_called_from (struct usb_process *up) |
#define thread_lock | ( | td | ) | mtx_lock_spin(&sched_lock) |
Definition at line 66 of file usb_process.c.
#define thread_unlock | ( | td | ) | mtx_unlock_spin(&sched_lock) |
Definition at line 67 of file usb_process.c.
#define USB_DEBUG_VAR usb_proc_debug |
Definition at line 56 of file usb_process.c.
#define USB_THREAD_CREATE | ( | f, | |
s, | |||
p, | |||
... | |||
) | kthread_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__) |
Definition at line 84 of file usb_process.c.
#define USB_THREAD_EXIT | ( | err | ) | kthread_exit(err) |
Definition at line 88 of file usb_process.c.
#define USB_THREAD_SUSPEND | ( | p | ) | kthread_suspend(p,0) |
Definition at line 87 of file usb_process.c.
#define USB_THREAD_SUSPEND_CHECK | ( | ) | kthread_suspend_check(curproc) |
Definition at line 86 of file usb_process.c.
int usb_proc_create | ( | struct usb_process * | up, |
struct mtx * | p_mtx, | ||
const char * | pmesg, | ||
uint8_t | prio | ||
) |
Definition at line 224 of file usb_process.c.
References error, usb_process::up_cv, usb_process::up_drain, usb_process::up_mtx, usb_process::up_prio, usb_process::up_ptr, usb_proc_free(), and USB_THREAD_CREATE.
Referenced by ucom_attach(), uether_ifattach(), and usb_attach_sub().
void usb_proc_drain | ( | struct usb_process * | up | ) |
Definition at line 436 of file usb_process.c.
References DPRINTF, usb_process::up_csleep, usb_process::up_cv, usb_process::up_drain, usb_process::up_dsleep, usb_process::up_gone, usb_process::up_msleep, usb_process::up_mtx, usb_process::up_ptr, USB_MTX_ASSERT, USB_MTX_LOCK, USB_MTX_UNLOCK, and USB_THREAD_SUSPEND.
Referenced by axge_detach(), ucom_detach(), uether_ifdetach(), and usb_proc_free().
void usb_proc_free | ( | struct usb_process * | up | ) |
Definition at line 261 of file usb_process.c.
References usb_process::up_cv, usb_process::up_drain, usb_process::up_mtx, and usb_proc_drain().
Referenced by ucom_detach(), uether_ifdetach(), usb_detach(), and usb_proc_create().
int usb_proc_is_called_from | ( | struct usb_process * | up | ) |
Definition at line 514 of file usb_process.c.
References usb_process::up_curtd.
uint8_t usb_proc_is_gone | ( | struct usb_process * | up | ) |
Definition at line 372 of file usb_process.c.
References usb_process::up_gone, usb_process::up_mtx, and USB_MTX_ASSERT.
Referenced by ucom_cfg_is_gone(), ucom_queue_command(), ue_queue_command(), uether_is_gone(), uether_pause(), and usbd_do_request_proc().
void * usb_proc_msignal | ( | struct usb_process * | up, |
void * | _pm0, | ||
void * | _pm1 | ||
) |
Definition at line 288 of file usb_process.c.
References DPRINTF, usb_proc_msg::pm_num, usb_process::up_cv, usb_process::up_gone, usb_process::up_msg_num, usb_process::up_msleep, usb_process::up_mtx, USB_IN_POLLING_MODE_FUNC, and USB_MTX_ASSERT.
Referenced by ucom_queue_command(), ue_queue_command(), usb_attach_sub(), usb_bus_reset_async_locked(), usb_detach(), usb_needs_explore(), usb_proc_explore_msignal(), usb_resume(), usb_shutdown(), usb_suspend(), usbd_callback_ss_done_defer(), usbd_callback_wrapper(), usbd_pipe_start(), xhci_start_dma_delay(), and xhci_transfer_insert().
void usb_proc_mwait | ( | struct usb_process * | up, |
void * | _pm0, | ||
void * | _pm1 | ||
) |
Definition at line 394 of file usb_process.c.
References usb_process::up_curtd, usb_process::up_drain, usb_process::up_dsleep, usb_process::up_gone, usb_process::up_mtx, and USB_MTX_ASSERT.
Referenced by ucom_queue_command(), ue_queue_command(), uether_ifattach_wait(), uhub_detach(), usb_detach(), usb_free_device(), usb_proc_explore_mwait(), usb_shutdown(), usb_suspend(), and usbd_transfer_unsetup_sub().
void usb_proc_rewakeup | ( | struct usb_process * | up | ) |
Definition at line 490 of file usb_process.c.
References usb_process::up_cv, usb_process::up_gone, usb_process::up_msleep, usb_process::up_mtx, and USB_MTX_ASSERT.
Referenced by usb_bus_explore(), and usb_power_wdog().
|
static |
Definition at line 106 of file usb_process.c.
References DPRINTF, usb_proc_msg::pm_callback, thread_lock, thread_unlock, usb_process::up_curtd, usb_process::up_cv, usb_process::up_drain, usb_process::up_dsleep, usb_process::up_gone, usb_process::up_msleep, usb_process::up_mtx, usb_process::up_prio, usb_process::up_ptr, USB_MTX_LOCK, USB_MTX_UNLOCK, USB_THREAD_EXIT, and USB_THREAD_SUSPEND_CHECK.