summaryrefslogtreecommitdiffstats
path: root/sys/boot/usb
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2013-02-05 14:44:25 +0000
committerhselasky <hselasky@FreeBSD.org>2013-02-05 14:44:25 +0000
commit2e6231f8ebe6ac7a9374e9c72531a220a8aa2d9d (patch)
tree6f7e7bb33464657571c7932da58bed2b52ea622a /sys/boot/usb
parent72c8e2de5282a2d1848447691f49c30e83e28950 (diff)
downloadFreeBSD-src-2e6231f8ebe6ac7a9374e9c72531a220a8aa2d9d.zip
FreeBSD-src-2e6231f8ebe6ac7a9374e9c72531a220a8aa2d9d.tar.gz
Add defines to more easily allow a single threaded version of the FreeBSD
USB stack. This is useful for non-kernel purposes, like the loader.
Diffstat (limited to 'sys/boot/usb')
-rw-r--r--sys/boot/usb/bsd_global.h2
-rw-r--r--sys/boot/usb/bsd_kernel.c46
-rw-r--r--sys/boot/usb/bsd_kernel.h4
3 files changed, 8 insertions, 44 deletions
diff --git a/sys/boot/usb/bsd_global.h b/sys/boot/usb/bsd_global.h
index 9fe1c8c..80cbd63 100644
--- a/sys/boot/usb/bsd_global.h
+++ b/sys/boot/usb/bsd_global.h
@@ -60,4 +60,6 @@
#include <dev/usb/quirk/usb_quirk.h>
#include <dev/usb/template/usb_template.h>
+extern struct usb_process usb_process[USB_PROC_MAX];
+
#endif /* _BSD_GLOBAL_H_ */
diff --git a/sys/boot/usb/bsd_kernel.c b/sys/boot/usb/bsd_kernel.c
index 5f24c2d..d3daa63 100644
--- a/sys/boot/usb/bsd_kernel.c
+++ b/sys/boot/usb/bsd_kernel.c
@@ -26,7 +26,8 @@
#include <bsd_global.h>
-static struct usb_process usb_process[USB_PROC_MAX];
+struct usb_process usb_process[USB_PROC_MAX];
+
static device_t usb_pci_root;
/*------------------------------------------------------------------------*
@@ -977,41 +978,6 @@ repeat:
return (worked);
}
-int
-usb_proc_create(struct usb_process *up, struct mtx *p_mtx,
- const char *pmesg, uint8_t prio)
-{
-#define USB_PROC_OFFSET(a,b) \
- ((int)(((long)&((struct usb_bus *)0)->a) - \
- ((long)&((struct usb_bus *)0)->b)))
-
- /* figure out which process we are creating */
- switch ((int)((long)up - (long)p_mtx)) {
- case USB_PROC_OFFSET(giant_callback_proc, bus_mtx):
- up->up_ptr = (void *)(usb_process + 2);
- break;
- case USB_PROC_OFFSET(non_giant_callback_proc, bus_mtx):
- up->up_ptr = (void *)(usb_process + 2);
- break;
- case USB_PROC_OFFSET(explore_proc, bus_mtx):
- up->up_ptr = (void *)(usb_process + 0);
- break;
- case USB_PROC_OFFSET(control_xfer_proc, bus_mtx):
- up->up_ptr = (void *)(usb_process + 1);
- break;
- default:
- up->up_ptr = (void *)(usb_process + 1);
- break;
- }
- return (0); /* success */
-}
-
-void
-usb_proc_free(struct usb_process *up)
-{
- /* NOP */
-}
-
void *
usb_proc_msignal(struct usb_process *up, void *_pm0, void *_pm1)
{
@@ -1021,10 +987,6 @@ usb_proc_msignal(struct usb_process *up, void *_pm0, void *_pm1)
usb_size_t d;
uint8_t t;
- /* find the correct parent */
- while (up->up_ptr != NULL)
- up = (struct usb_process *)up->up_ptr;
-
t = 0;
if (pm0->pm_qentry.tqe_prev) {
@@ -1104,10 +1066,6 @@ usb_proc_mwait(struct usb_process *up, void *_pm0, void *_pm1)
struct usb_proc_msg *pm0 = _pm0;
struct usb_proc_msg *pm1 = _pm1;
- /* find the correct parent */
- while (up->up_ptr != NULL)
- up = (struct usb_process *)up->up_ptr;
-
/* Just remove the messages from the queue. */
if (pm0->pm_qentry.tqe_prev) {
TAILQ_REMOVE(&up->up_qhead, pm0, pm_qentry);
diff --git a/sys/boot/usb/bsd_kernel.h b/sys/boot/usb/bsd_kernel.h
index 4c94721..e9d9602 100644
--- a/sys/boot/usb/bsd_kernel.h
+++ b/sys/boot/usb/bsd_kernel.h
@@ -40,6 +40,10 @@
#define M_USB 0
#define M_USBDEV 0
#define USB_PROC_MAX 3
+#define USB_BUS_GIANT_PROC(bus) (usb_process + 2)
+#define USB_BUS_NON_GIANT_PROC(bus) (usb_process + 2)
+#define USB_BUS_EXPLORE_PROC(bus) (usb_process + 0)
+#define USB_BUS_CONTROL_XFER_PROC(bus) (usb_process + 1)
#define SYSCTL_DECL(...)
#define SYSCTL_NODE(name,...) struct { } name __used
#define SYSCTL_INT(...)
OpenPOWER on IntegriCloud