aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/controller/at91dci.c9
-rw-r--r--sys/dev/usb/controller/atmegadci.c9
-rw-r--r--sys/dev/usb/controller/avr32dci.c10
-rw-r--r--sys/dev/usb/controller/dwc_otg.c8
-rw-r--r--sys/dev/usb/controller/ehci.c9
-rw-r--r--sys/dev/usb/controller/musb_otg.c5
-rw-r--r--sys/dev/usb/controller/ohci.c9
-rw-r--r--sys/dev/usb/controller/uhci.c9
-rw-r--r--sys/dev/usb/controller/usb_controller.c19
-rw-r--r--sys/dev/usb/controller/uss820dci.c5
-rw-r--r--sys/dev/usb/controller/xhci.c9
-rw-r--r--sys/dev/usb/storage/ustorage_fs.c4
-rw-r--r--sys/dev/usb/template/usb_template.c4
-rw-r--r--sys/dev/usb/template/usb_template_audio.c8
-rw-r--r--sys/dev/usb/template/usb_template_cdce.c8
-rw-r--r--sys/dev/usb/template/usb_template_kbd.c8
-rw-r--r--sys/dev/usb/template/usb_template_modem.c8
-rw-r--r--sys/dev/usb/template/usb_template_mouse.c8
-rw-r--r--sys/dev/usb/template/usb_template_msc.c8
-rw-r--r--sys/dev/usb/template/usb_template_mtp.c8
-rw-r--r--sys/dev/usb/usb.h6
-rw-r--r--sys/dev/usb/usb_busdma.c4
-rw-r--r--sys/dev/usb/usb_busdma.h2
-rw-r--r--sys/dev/usb/usb_compat_linux.c4
-rw-r--r--sys/dev/usb/usb_core.c4
-rw-r--r--sys/dev/usb/usb_debug.c4
-rw-r--r--sys/dev/usb/usb_dev.c4
-rw-r--r--sys/dev/usb/usb_dev.h2
-rw-r--r--sys/dev/usb/usb_device.c4
-rw-r--r--sys/dev/usb/usb_dynamic.c4
-rw-r--r--sys/dev/usb/usb_endian.h2
-rw-r--r--sys/dev/usb/usb_error.c4
-rw-r--r--sys/dev/usb/usb_freebsd.h1
-rw-r--r--sys/dev/usb/usb_freebsd_loader.h83
-rw-r--r--sys/dev/usb/usb_generic.c4
-rw-r--r--sys/dev/usb/usb_handle_request.c4
-rw-r--r--sys/dev/usb/usb_hid.c9
-rw-r--r--sys/dev/usb/usb_hub.c4
-rw-r--r--sys/dev/usb/usb_ioctl.h2
-rw-r--r--sys/dev/usb/usb_lookup.c4
-rw-r--r--sys/dev/usb/usb_mbuf.c4
-rw-r--r--sys/dev/usb/usb_msctest.c4
-rw-r--r--sys/dev/usb/usb_parse.c5
-rw-r--r--sys/dev/usb/usb_pci.h2
-rw-r--r--sys/dev/usb/usb_pf.c7
-rw-r--r--sys/dev/usb/usb_process.c4
-rw-r--r--sys/dev/usb/usb_process.h2
-rw-r--r--sys/dev/usb/usb_request.c4
-rw-r--r--sys/dev/usb/usb_transfer.c4
-rw-r--r--sys/dev/usb/usb_util.c4
-rw-r--r--sys/dev/usb/usbdi.h2
-rw-r--r--sys/dev/usb/usbhid.h2
52 files changed, 310 insertions, 54 deletions
diff --git a/sys/dev/usb/controller/at91dci.c b/sys/dev/usb/controller/at91dci.c
index 55688d98f6d3..aef287d028da 100644
--- a/sys/dev/usb/controller/at91dci.c
+++ b/sys/dev/usb/controller/at91dci.c
@@ -1,6 +1,4 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
+/* $FreeBSD$ */
/*-
* Copyright (c) 2007-2008 Hans Petter Selasky. All rights reserved.
*
@@ -44,6 +42,9 @@ __FBSDID("$FreeBSD$");
* endpoints, Function-address and more.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -79,6 +80,8 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
+
#include <dev/usb/controller/at91dci.h>
#define AT9100_DCI_BUS2SC(bus) \
diff --git a/sys/dev/usb/controller/atmegadci.c b/sys/dev/usb/controller/atmegadci.c
index 132fd481ddc2..70d34a33528c 100644
--- a/sys/dev/usb/controller/atmegadci.c
+++ b/sys/dev/usb/controller/atmegadci.c
@@ -1,6 +1,4 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
+/* $FreeBSD$ */
/*-
* Copyright (c) 2009 Hans Petter Selasky. All rights reserved.
*
@@ -36,6 +34,9 @@ __FBSDID("$FreeBSD$");
* endpoints, Function-address and more.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -71,6 +72,8 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
+
#include <dev/usb/controller/atmegadci.h>
#define ATMEGA_BUS2SC(bus) \
diff --git a/sys/dev/usb/controller/avr32dci.c b/sys/dev/usb/controller/avr32dci.c
index 14b4f643cd50..08283118977d 100644
--- a/sys/dev/usb/controller/avr32dci.c
+++ b/sys/dev/usb/controller/avr32dci.c
@@ -1,6 +1,4 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
+/* $FreeBSD$ */
/*-
* Copyright (c) 2009 Hans Petter Selasky. All rights reserved.
*
@@ -35,7 +33,9 @@ __FBSDID("$FreeBSD$");
* NOTE: When the chip detects BUS-reset it will also reset the
* endpoints, Function-address and more.
*/
-
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -71,6 +71,8 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
+
#include <dev/usb/controller/avr32dci.h>
#define AVR32_BUS2SC(bus) \
diff --git a/sys/dev/usb/controller/dwc_otg.c b/sys/dev/usb/controller/dwc_otg.c
index 89e312a6f85e..e161ab73cd90 100644
--- a/sys/dev/usb/controller/dwc_otg.c
+++ b/sys/dev/usb/controller/dwc_otg.c
@@ -1,3 +1,4 @@
+/* $FreeBSD$ */
/*-
* Copyright (c) 2012 Hans Petter Selasky. All rights reserved.
* Copyright (c) 2010-2011 Aleksandr Rybalko. All rights reserved.
@@ -41,9 +42,9 @@
* internal reset.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -79,6 +80,7 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
#include <dev/usb/controller/dwc_otg.h>
#include <dev/usb/controller/dwc_otgreg.h>
diff --git a/sys/dev/usb/controller/ehci.c b/sys/dev/usb/controller/ehci.c
index b301ea404229..51b012b25c39 100644
--- a/sys/dev/usb/controller/ehci.c
+++ b/sys/dev/usb/controller/ehci.c
@@ -1,3 +1,4 @@
+/* $FreeBSD$ */
/*-
* Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
* Copyright (c) 2004 The NetBSD Foundation, Inc. All rights reserved.
@@ -43,9 +44,9 @@
* 1) command failures are not recovered correctly
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -81,6 +82,8 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
+
#include <dev/usb/controller/ehci.h>
#include <dev/usb/controller/ehcireg.h>
diff --git a/sys/dev/usb/controller/musb_otg.c b/sys/dev/usb/controller/musb_otg.c
index 627b40ba2ac5..90f69b70bd86 100644
--- a/sys/dev/usb/controller/musb_otg.c
+++ b/sys/dev/usb/controller/musb_otg.c
@@ -36,6 +36,9 @@
* NOTE: The current implementation only supports Device Side Mode!
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -71,6 +74,8 @@
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
+
#include <dev/usb/controller/musb_otg.h>
#define MUSBOTG_INTR_ENDPT 1
diff --git a/sys/dev/usb/controller/ohci.c b/sys/dev/usb/controller/ohci.c
index d4995068ffae..e78c9e9ee765 100644
--- a/sys/dev/usb/controller/ohci.c
+++ b/sys/dev/usb/controller/ohci.c
@@ -1,3 +1,4 @@
+/* $FreeBSD$ */
/*-
* Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
* Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved.
@@ -25,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* USB Open Host Controller driver.
*
@@ -35,6 +33,9 @@ __FBSDID("$FreeBSD$");
* USB spec: http://www.usb.org/developers/docs/usbspec.zip
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -70,6 +71,8 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
+
#include <dev/usb/controller/ohci.h>
#include <dev/usb/controller/ohcireg.h>
diff --git a/sys/dev/usb/controller/uhci.c b/sys/dev/usb/controller/uhci.c
index 78399ccac5a9..fe3cf93eb6ce 100644
--- a/sys/dev/usb/controller/uhci.c
+++ b/sys/dev/usb/controller/uhci.c
@@ -1,3 +1,4 @@
+/* $FreeBSD$ */
/*-
* Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
* Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved.
@@ -25,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* USB Universal Host Controller driver.
* Handles e.g. PIIX3 and PIIX4.
@@ -38,6 +36,9 @@ __FBSDID("$FreeBSD$");
* ftp://download.intel.com/design/intarch/datashts/29056201.pdf
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -73,6 +74,8 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
+
#include <dev/usb/controller/uhci.h>
#include <dev/usb/controller/uhcireg.h>
diff --git a/sys/dev/usb/controller/usb_controller.c b/sys/dev/usb/controller/usb_controller.c
index 5f28640b1024..9e00ef5b3c8c 100644
--- a/sys/dev/usb/controller/usb_controller.c
+++ b/sys/dev/usb/controller/usb_controller.c
@@ -24,6 +24,9 @@
* SUCH DAMAGE.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include "opt_ddb.h"
#include <sys/stdint.h>
@@ -62,6 +65,7 @@
#include <dev/usb/usb_bus.h>
#include <dev/usb/usb_pf.h>
#include "usb_if.h"
+#endif /* USB_GLOBAL_INCLUDE_FILE */
/* function prototypes */
@@ -84,10 +88,12 @@ SYSCTL_INT(_hw_usb_ctrl, OID_AUTO, debug, CTLFLAG_RW, &usb_ctrl_debug, 0,
"Debug level");
#endif
+#if USB_HAVE_ROOT_MOUNT_HOLD
static int usb_no_boot_wait = 0;
TUNABLE_INT("hw.usb.no_boot_wait", &usb_no_boot_wait);
SYSCTL_INT(_hw_usb, OID_AUTO, no_boot_wait, CTLFLAG_RD|CTLFLAG_TUN, &usb_no_boot_wait, 0,
"No USB device enumerate waiting at boot.");
+#endif
static int usb_no_suspend_wait = 0;
TUNABLE_INT("hw.usb.no_suspend_wait", &usb_no_suspend_wait);
@@ -144,6 +150,7 @@ usb_probe(device_t dev)
return (0);
}
+#if USB_HAVE_ROOT_MOUNT_HOLD
static void
usb_root_mount_rel(struct usb_bus *bus)
{
@@ -153,6 +160,7 @@ usb_root_mount_rel(struct usb_bus *bus)
bus->bus_roothold = NULL;
}
}
+#endif
/*------------------------------------------------------------------------*
* usb_attach
@@ -169,11 +177,12 @@ usb_attach(device_t dev)
return (ENXIO);
}
+#if USB_HAVE_ROOT_MOUNT_HOLD
if (usb_no_boot_wait == 0) {
/* delay vfs_mountroot until the bus is explored */
bus->bus_roothold = root_mount_hold(device_get_nameunit(dev));
}
-
+#endif
usb_attach_sub(dev, bus);
return (0); /* return success */
@@ -196,8 +205,10 @@ usb_detach(device_t dev)
/* Stop power watchdog */
usb_callout_drain(&bus->power_wdog);
+#if USB_HAVE_ROOT_MOUNT_HOLD
/* Let the USB explore process detach all devices. */
usb_root_mount_rel(bus);
+#endif
USB_BUS_LOCK(bus);
@@ -363,7 +374,9 @@ usb_bus_explore(struct usb_proc_msg *pm)
(udev->hub->explore) (udev);
USB_BUS_LOCK(bus);
}
+#if USB_HAVE_ROOT_MOUNT_HOLD
usb_root_mount_rel(bus);
+#endif
}
/*------------------------------------------------------------------------*
@@ -630,7 +643,9 @@ usb_bus_attach(struct usb_proc_msg *pm)
default:
device_printf(bus->bdev, "Unsupported USB revision\n");
+#if USB_HAVE_ROOT_MOUNT_HOLD
usb_root_mount_rel(bus);
+#endif
return;
}
@@ -672,7 +687,9 @@ usb_bus_attach(struct usb_proc_msg *pm)
if (err) {
device_printf(bus->bdev, "Root HUB problem, error=%s\n",
usbd_errstr(err));
+#if USB_HAVE_ROOT_MOUNT_HOLD
usb_root_mount_rel(bus);
+#endif
}
/* set softc - we are ready */
diff --git a/sys/dev/usb/controller/uss820dci.c b/sys/dev/usb/controller/uss820dci.c
index bbb9f75fb96d..bb1d847da75b 100644
--- a/sys/dev/usb/controller/uss820dci.c
+++ b/sys/dev/usb/controller/uss820dci.c
@@ -32,6 +32,9 @@
* NOTE: The datasheet does not document everything.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -67,6 +70,8 @@
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
+
#include <dev/usb/controller/uss820dci.h>
#define USS820_DCI_BUS2SC(bus) \
diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c
index 2a06ea2cfb93..dc4cfe93fede 100644
--- a/sys/dev/usb/controller/xhci.c
+++ b/sys/dev/usb/controller/xhci.c
@@ -1,3 +1,4 @@
+/* $FreeBSD$ */
/*-
* Copyright (c) 2010 Hans Petter Selasky. All rights reserved.
*
@@ -38,9 +39,9 @@
* way we avoid too much diveration among USB drivers.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -76,6 +77,8 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
+
#include <dev/usb/controller/xhci.h>
#include <dev/usb/controller/xhcireg.h>
diff --git a/sys/dev/usb/storage/ustorage_fs.c b/sys/dev/usb/storage/ustorage_fs.c
index df89619abb1e..b2cda104b478 100644
--- a/sys/dev/usb/storage/ustorage_fs.c
+++ b/sys/dev/usb/storage/ustorage_fs.c
@@ -36,6 +36,9 @@
* Linux USB gadget stack.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -62,6 +65,7 @@
#define USB_DEBUG_VAR ustorage_fs_debug
#include <dev/usb/usb_debug.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
#ifdef USB_DEBUG
static int ustorage_fs_debug = 0;
diff --git a/sys/dev/usb/template/usb_template.c b/sys/dev/usb/template/usb_template.c
index 9934202403da..36c11d9c5154 100644
--- a/sys/dev/usb/template/usb_template.c
+++ b/sys/dev/usb/template/usb_template.c
@@ -29,6 +29,9 @@
* USB templates.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -67,6 +70,7 @@
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
#include <dev/usb/template/usb_template.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
MODULE_DEPEND(usb_template, usb, 1, 1, 1);
MODULE_VERSION(usb_template, 1);
diff --git a/sys/dev/usb/template/usb_template_audio.c b/sys/dev/usb/template/usb_template_audio.c
index 4af83f839f91..cc60a338c75e 100644
--- a/sys/dev/usb/template/usb_template_audio.c
+++ b/sys/dev/usb/template/usb_template_audio.c
@@ -1,6 +1,4 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
+/* $FreeBSD$ */
/*-
* Copyright (c) 2010 Hans Petter Selasky. All rights reserved.
*
@@ -30,6 +28,9 @@ __FBSDID("$FreeBSD$");
* This file contains the USB template for an USB Audio Device.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -54,6 +55,7 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_cdc.h>
#include <dev/usb/template/usb_template.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
enum {
INDEX_AUDIO_LANG,
diff --git a/sys/dev/usb/template/usb_template_cdce.c b/sys/dev/usb/template/usb_template_cdce.c
index 481a69cb957f..61dea381f753 100644
--- a/sys/dev/usb/template/usb_template_cdce.c
+++ b/sys/dev/usb/template/usb_template_cdce.c
@@ -1,6 +1,4 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
+/* $FreeBSD$ */
/*-
* Copyright (c) 2007 Hans Petter Selasky <hselasky@FreeBSD.org>
* All rights reserved.
@@ -31,6 +29,9 @@ __FBSDID("$FreeBSD$");
* This file contains the USB templates for a CDC USB ethernet device.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -55,6 +56,7 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_cdc.h>
#include <dev/usb/template/usb_template.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
enum {
STRING_LANG_INDEX,
diff --git a/sys/dev/usb/template/usb_template_kbd.c b/sys/dev/usb/template/usb_template_kbd.c
index f5995a4ff9d1..8866edd7fc24 100644
--- a/sys/dev/usb/template/usb_template_kbd.c
+++ b/sys/dev/usb/template/usb_template_kbd.c
@@ -1,6 +1,4 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
+/* $FreeBSD$ */
/*-
* Copyright (c) 2010 Hans Petter Selasky. All rights reserved.
*
@@ -30,6 +28,9 @@ __FBSDID("$FreeBSD$");
* This file contains the USB template for an USB Keyboard Device.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -54,6 +55,7 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_cdc.h>
#include <dev/usb/template/usb_template.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
enum {
INDEX_LANG,
diff --git a/sys/dev/usb/template/usb_template_modem.c b/sys/dev/usb/template/usb_template_modem.c
index 1ca0fea3ec3c..3b7413447f8a 100644
--- a/sys/dev/usb/template/usb_template_modem.c
+++ b/sys/dev/usb/template/usb_template_modem.c
@@ -1,6 +1,4 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
+/* $FreeBSD$ */
/*-
* Copyright (c) 2010 Hans Petter Selasky. All rights reserved.
*
@@ -30,6 +28,9 @@ __FBSDID("$FreeBSD$");
* This file contains the USB template for an USB Modem Device.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -54,6 +55,7 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_cdc.h>
#include <dev/usb/template/usb_template.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
enum {
INDEX_LANG,
diff --git a/sys/dev/usb/template/usb_template_mouse.c b/sys/dev/usb/template/usb_template_mouse.c
index 628c9a5e2390..abe865067fd4 100644
--- a/sys/dev/usb/template/usb_template_mouse.c
+++ b/sys/dev/usb/template/usb_template_mouse.c
@@ -1,6 +1,4 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
+/* $FreeBSD$ */
/*-
* Copyright (c) 2010 Hans Petter Selasky. All rights reserved.
*
@@ -30,6 +28,9 @@ __FBSDID("$FreeBSD$");
* This file contains the USB template for an USB Mouse Device.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -54,6 +55,7 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_cdc.h>
#include <dev/usb/template/usb_template.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
enum {
INDEX_LANG,
diff --git a/sys/dev/usb/template/usb_template_msc.c b/sys/dev/usb/template/usb_template_msc.c
index 5c05ffe8e289..3153433e2eee 100644
--- a/sys/dev/usb/template/usb_template_msc.c
+++ b/sys/dev/usb/template/usb_template_msc.c
@@ -1,6 +1,4 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
+/* $FreeBSD$ */
/*-
* Copyright (c) 2008 Hans Petter Selasky <hselasky@FreeBSD.org>
* All rights reserved.
@@ -31,6 +29,9 @@ __FBSDID("$FreeBSD$");
* This file contains the USB templates for an USB Mass Storage Device.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -54,6 +55,7 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usbdi.h>
#include <dev/usb/template/usb_template.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
enum {
STRING_LANG_INDEX,
diff --git a/sys/dev/usb/template/usb_template_mtp.c b/sys/dev/usb/template/usb_template_mtp.c
index f48fbf422b8e..d4112e6e1665 100644
--- a/sys/dev/usb/template/usb_template_mtp.c
+++ b/sys/dev/usb/template/usb_template_mtp.c
@@ -1,6 +1,4 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
+/* $FreeBSD$ */
/*-
* Copyright (c) 2008 Hans Petter Selasky <hselasky@FreeBSD.org>
* All rights reserved.
@@ -38,6 +36,9 @@ __FBSDID("$FreeBSD$");
* operating system the VID and PID of your device.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -60,6 +61,7 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/template/usb_template.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
#define MTP_BREQUEST 0x08
diff --git a/sys/dev/usb/usb.h b/sys/dev/usb/usb.h
index a47c9d819bf1..438dc3c7b389 100644
--- a/sys/dev/usb/usb.h
+++ b/sys/dev/usb/usb.h
@@ -40,22 +40,28 @@
#define _USB_STANDARD_H_
#if defined(_KERNEL)
+#ifndef USB_GLOBAL_INCLUDE_FILE
#include "opt_usb.h"
+#endif
/* Declare parent SYSCTL USB node. */
#ifdef SYSCTL_DECL
SYSCTL_DECL(_hw_usb);
#endif
+#ifndef USB_GLOBAL_INCLUDE_FILE
#include <sys/malloc.h>
+#endif
MALLOC_DECLARE(M_USB);
MALLOC_DECLARE(M_USBDEV);
MALLOC_DECLARE(M_USBHC);
#endif /* _KERNEL */
+#ifndef USB_GLOBAL_INCLUDE_FILE
#include <dev/usb/usb_endian.h>
#include <dev/usb/usb_freebsd.h>
+#endif
#define USB_STACK_VERSION 2000 /* 2.0 */
diff --git a/sys/dev/usb/usb_busdma.c b/sys/dev/usb/usb_busdma.c
index 47fb4d5db88e..1808ab4a24de 100644
--- a/sys/dev/usb/usb_busdma.c
+++ b/sys/dev/usb/usb_busdma.c
@@ -24,6 +24,9 @@
* SUCH DAMAGE.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -59,6 +62,7 @@
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
#if USB_HAVE_BUSDMA
static void usb_dma_tag_create(struct usb_dma_tag *, usb_size_t, usb_size_t);
diff --git a/sys/dev/usb/usb_busdma.h b/sys/dev/usb/usb_busdma.h
index 6b6e4039ef33..1050af541854 100644
--- a/sys/dev/usb/usb_busdma.h
+++ b/sys/dev/usb/usb_busdma.h
@@ -27,10 +27,12 @@
#ifndef _USB_BUSDMA_H_
#define _USB_BUSDMA_H_
+#ifndef USB_GLOBAL_INCLUDE_FILE
#include <sys/uio.h>
#include <sys/mbuf.h>
#include <machine/bus.h>
+#endif
/* defines */
diff --git a/sys/dev/usb/usb_compat_linux.c b/sys/dev/usb/usb_compat_linux.c
index 22bf1f417b68..637ac18d7daa 100644
--- a/sys/dev/usb/usb_compat_linux.c
+++ b/sys/dev/usb/usb_compat_linux.c
@@ -25,6 +25,9 @@
* SUCH DAMAGE.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -61,6 +64,7 @@
#include <dev/usb/usb_hub.h>
#include <dev/usb/usb_request.h>
#include <dev/usb/usb_debug.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
struct usb_linux_softc {
LIST_ENTRY(usb_linux_softc) sc_attached_list;
diff --git a/sys/dev/usb/usb_core.c b/sys/dev/usb/usb_core.c
index 1bd05c869fcc..0ebbdc02d07b 100644
--- a/sys/dev/usb/usb_core.c
+++ b/sys/dev/usb/usb_core.c
@@ -30,6 +30,9 @@
* http://www.usb.org/developers/devclass_docs/
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -51,6 +54,7 @@
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
MALLOC_DEFINE(M_USB, "USB", "USB");
MALLOC_DEFINE(M_USBDEV, "USBdev", "USB device");
diff --git a/sys/dev/usb/usb_debug.c b/sys/dev/usb/usb_debug.c
index 7ca4daa44e56..338298835b80 100644
--- a/sys/dev/usb/usb_debug.c
+++ b/sys/dev/usb/usb_debug.c
@@ -24,6 +24,9 @@
* SUCH DAMAGE.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -55,6 +58,7 @@
#include <ddb/ddb.h>
#include <ddb/db_sym.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
/*
* Define this unconditionally in case a kernel module is loaded that
diff --git a/sys/dev/usb/usb_dev.c b/sys/dev/usb/usb_dev.c
index a8adbf6caa43..c4264c550a08 100644
--- a/sys/dev/usb/usb_dev.c
+++ b/sys/dev/usb/usb_dev.c
@@ -27,6 +27,9 @@
* usb_dev.c - An abstraction layer for creating devices under /dev/...
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -75,6 +78,7 @@
#include <sys/syscallsubr.h>
#include <machine/stdarg.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
#if USB_HAVE_UGEN
diff --git a/sys/dev/usb/usb_dev.h b/sys/dev/usb/usb_dev.h
index aa9197f5121f..3c757019ab87 100644
--- a/sys/dev/usb/usb_dev.h
+++ b/sys/dev/usb/usb_dev.h
@@ -27,11 +27,13 @@
#ifndef _USB_DEV_H_
#define _USB_DEV_H_
+#ifndef USB_GLOBAL_INCLUDE_FILE
#include <sys/file.h>
#include <sys/selinfo.h>
#include <sys/poll.h>
#include <sys/signalvar.h>
#include <sys/proc.h>
+#endif
struct usb_fifo;
struct usb_mbuf;
diff --git a/sys/dev/usb/usb_device.c b/sys/dev/usb/usb_device.c
index 05c0a4cc0207..8d88bf53dfd1 100644
--- a/sys/dev/usb/usb_device.c
+++ b/sys/dev/usb/usb_device.c
@@ -24,6 +24,9 @@
* SUCH DAMAGE.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -78,6 +81,7 @@
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
/* function prototypes */
diff --git a/sys/dev/usb/usb_dynamic.c b/sys/dev/usb/usb_dynamic.c
index 1358b30cd0ea..f8bb03fe5c66 100644
--- a/sys/dev/usb/usb_dynamic.c
+++ b/sys/dev/usb/usb_dynamic.c
@@ -24,6 +24,9 @@
* SUCH DAMAGE.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -50,6 +53,7 @@
#include <dev/usb/usb_process.h>
#include <dev/usb/usb_device.h>
#include <dev/usb/usb_dynamic.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
/* function prototypes */
static usb_handle_req_t usb_temp_get_desc_w;
diff --git a/sys/dev/usb/usb_endian.h b/sys/dev/usb/usb_endian.h
index 29479f1367ad..0bbcb9bf828c 100644
--- a/sys/dev/usb/usb_endian.h
+++ b/sys/dev/usb/usb_endian.h
@@ -27,8 +27,10 @@
#ifndef _USB_ENDIAN_H_
#define _USB_ENDIAN_H_
+#ifndef USB_GLOBAL_INCLUDE_FILE
#include <sys/stdint.h>
#include <sys/endian.h>
+#endif
/*
* Declare the basic USB record types. USB records have an alignment
diff --git a/sys/dev/usb/usb_error.c b/sys/dev/usb/usb_error.c
index 119c6175ca1e..5987d8107c4d 100644
--- a/sys/dev/usb/usb_error.c
+++ b/sys/dev/usb/usb_error.c
@@ -24,6 +24,9 @@
* SUCH DAMAGE.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -45,6 +48,7 @@
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
static const char* usb_errstr_table[USB_ERR_MAX] = {
[USB_ERR_NORMAL_COMPLETION] = "USB_ERR_NORMAL_COMPLETION",
diff --git a/sys/dev/usb/usb_freebsd.h b/sys/dev/usb/usb_freebsd.h
index 42a54c5b9c99..b599b7423649 100644
--- a/sys/dev/usb/usb_freebsd.h
+++ b/sys/dev/usb/usb_freebsd.h
@@ -42,6 +42,7 @@
#define USB_HAVE_POWERD 1
#define USB_HAVE_MSCTEST 1
#define USB_HAVE_PF 1
+#define USB_HAVE_ROOT_MOUNT_HOLD 1
#define USB_TD_GET_PROC(td) (td)->td_proc
#define USB_PROC_GET_GID(td) (td)->p_pgid
diff --git a/sys/dev/usb/usb_freebsd_loader.h b/sys/dev/usb/usb_freebsd_loader.h
new file mode 100644
index 000000000000..bb3250a770f1
--- /dev/null
+++ b/sys/dev/usb/usb_freebsd_loader.h
@@ -0,0 +1,83 @@
+/* $FreeBSD$ */
+/*-
+ * Copyright (c) 2013 Hans Petter Selasky. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Including this file is mandatory for all USB related c-files in the loader.
+ */
+
+#ifndef _USB_FREEBSD_LOADER_H_
+#define _USB_FREEBSD_LOADER_H_
+
+/* Default USB configuration */
+#define USB_HAVE_UGEN 0
+#define USB_HAVE_DEVCTL 0
+#define USB_HAVE_BUSDMA 1
+#define USB_HAVE_COMPAT_LINUX 0
+#define USB_HAVE_USER_IO 0
+#define USB_HAVE_MBUF 0
+#define USB_HAVE_TT_SUPPORT 1
+#define USB_HAVE_POWERD 1
+#define USB_HAVE_MSCTEST 0
+#define USB_HAVE_PF 0
+#define USB_HAVE_ROOT_MOUNT_HOLD 0
+
+#define USB_TD_GET_PROC(td) (td)->td_proc
+#define USB_PROC_GET_GID(td) (td)->p_pgid
+
+#if (!defined(USB_HOST_ALIGN)) || (USB_HOST_ALIGN <= 0)
+/* Use default value. */
+#undef USB_HOST_ALIGN
+#define USB_HOST_ALIGN 8 /* bytes, must be power of two */
+#endif
+/* Sanity check for USB_HOST_ALIGN: Verify power of two. */
+#if ((-USB_HOST_ALIGN) & USB_HOST_ALIGN) != USB_HOST_ALIGN
+#error "USB_HOST_ALIGN is not power of two."
+#endif
+#define USB_FS_ISOC_UFRAME_MAX 4 /* exclusive unit */
+#define USB_BUS_MAX 256 /* units */
+#define USB_MAX_DEVICES 128 /* units */
+#define USB_IFACE_MAX 32 /* units */
+#define USB_FIFO_MAX 128 /* units */
+#define USB_MAX_EP_STREAMS 8 /* units */
+
+#define USB_MAX_FS_ISOC_FRAMES_PER_XFER (120) /* units */
+#define USB_MAX_HS_ISOC_FRAMES_PER_XFER (8*120) /* units */
+
+#define USB_HUB_MAX_DEPTH 5
+#define USB_EP0_BUFSIZE 1024 /* bytes */
+#define USB_CS_RESET_LIMIT 20 /* failures = 20 * 50 ms = 1sec */
+
+#define USB_MAX_AUTO_QUIRK 4 /* maximum number of dynamic quirks */
+
+typedef uint32_t usb_timeout_t; /* milliseconds */
+typedef uint32_t usb_frlength_t; /* bytes */
+typedef uint32_t usb_frcount_t; /* units */
+typedef uint32_t usb_size_t; /* bytes */
+typedef uint32_t usb_ticks_t; /* system defined */
+typedef uint16_t usb_power_mask_t; /* see "USB_HW_POWER_XXX" */
+typedef uint16_t usb_stream_t; /* stream ID */
+
+#endif /* _USB_FREEBSD_LOADER_H_ */
diff --git a/sys/dev/usb/usb_generic.c b/sys/dev/usb/usb_generic.c
index f8376bf2cc16..13f5bd685e91 100644
--- a/sys/dev/usb/usb_generic.c
+++ b/sys/dev/usb/usb_generic.c
@@ -24,6 +24,9 @@
* SUCH DAMAGE.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -67,6 +70,7 @@
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
#if USB_HAVE_UGEN
diff --git a/sys/dev/usb/usb_handle_request.c b/sys/dev/usb/usb_handle_request.c
index f5b226e81d7d..13fff91efa91 100644
--- a/sys/dev/usb/usb_handle_request.c
+++ b/sys/dev/usb/usb_handle_request.c
@@ -24,6 +24,9 @@
* SUCH DAMAGE.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -61,6 +64,7 @@
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
/* function prototypes */
diff --git a/sys/dev/usb/usb_hid.c b/sys/dev/usb/usb_hid.c
index c201bb4d270b..e6361a6f1195 100644
--- a/sys/dev/usb/usb_hid.c
+++ b/sys/dev/usb/usb_hid.c
@@ -1,8 +1,5 @@
+/* $FreeBSD$ */
/* $NetBSD: hid.c,v 1.17 2001/11/13 06:24:53 lukem Exp $ */
-
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -33,6 +30,9 @@ __FBSDID("$FreeBSD$");
* POSSIBILITY OF SUCH DAMAGE.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_process.h>
#include <dev/usb/usb_device.h>
#include <dev/usb/usb_request.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
static void hid_clear_local(struct hid_item *);
static uint8_t hid_get_byte(struct hid_data *s, const uint16_t wSize);
diff --git a/sys/dev/usb/usb_hub.c b/sys/dev/usb/usb_hub.c
index e3a673d6e5c6..5e372c82e974 100644
--- a/sys/dev/usb/usb_hub.c
+++ b/sys/dev/usb/usb_hub.c
@@ -30,6 +30,9 @@
* USB spec: http://www.usb.org/developers/docs/usbspec.zip
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -69,6 +72,7 @@
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
#define UHUB_INTR_INTERVAL 250 /* ms */
#define UHUB_N_TRANSFER 1
diff --git a/sys/dev/usb/usb_ioctl.h b/sys/dev/usb/usb_ioctl.h
index 62edb992cb11..1d9b2230d059 100644
--- a/sys/dev/usb/usb_ioctl.h
+++ b/sys/dev/usb/usb_ioctl.h
@@ -29,12 +29,14 @@
#ifndef _USB_IOCTL_H_
#define _USB_IOCTL_H_
+#ifndef USB_GLOBAL_INCLUDE_FILE
#include <sys/ioccom.h>
/* Building "kdump" depends on these includes */
#include <dev/usb/usb_endian.h>
#include <dev/usb/usb.h>
+#endif
#define USB_DEVICE_NAME "usbctl"
#define USB_DEVICE_DIR "usb"
diff --git a/sys/dev/usb/usb_lookup.c b/sys/dev/usb/usb_lookup.c
index e03f9b60b24d..769f9b652736 100644
--- a/sys/dev/usb/usb_lookup.c
+++ b/sys/dev/usb/usb_lookup.c
@@ -24,6 +24,9 @@
* SUCH DAMAGE.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -47,6 +50,7 @@
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
/*------------------------------------------------------------------------*
* usbd_lookup_id_by_info
diff --git a/sys/dev/usb/usb_mbuf.c b/sys/dev/usb/usb_mbuf.c
index 65b2a91f9522..ff2f6da2afda 100644
--- a/sys/dev/usb/usb_mbuf.c
+++ b/sys/dev/usb/usb_mbuf.c
@@ -24,6 +24,9 @@
* SUCH DAMAGE.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -47,6 +50,7 @@
#include <dev/usb/usbdi.h>
#include <dev/usb/usb_dev.h>
#include <dev/usb/usb_mbuf.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
/*------------------------------------------------------------------------*
* usb_alloc_mbufs - allocate mbufs to an usbd interface queue
diff --git a/sys/dev/usb/usb_msctest.c b/sys/dev/usb/usb_msctest.c
index c5e8f494eb2a..497e382019de 100644
--- a/sys/dev/usb/usb_msctest.c
+++ b/sys/dev/usb/usb_msctest.c
@@ -32,6 +32,9 @@
* mass storage quirks for not supported SCSI commands!
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -66,6 +69,7 @@
#include <dev/usb/usb_request.h>
#include <dev/usb/usb_util.h>
#include <dev/usb/quirk/usb_quirk.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
enum {
ST_COMMAND,
diff --git a/sys/dev/usb/usb_parse.c b/sys/dev/usb/usb_parse.c
index 66ab5fa74984..d6e54adf668c 100644
--- a/sys/dev/usb/usb_parse.c
+++ b/sys/dev/usb/usb_parse.c
@@ -24,6 +24,9 @@
* SUCH DAMAGE.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -46,7 +49,7 @@
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdi_util.h>
-
+#endif /* USB_GLOBAL_INCLUDE_FILE */
/*------------------------------------------------------------------------*
* usb_desc_foreach
diff --git a/sys/dev/usb/usb_pci.h b/sys/dev/usb/usb_pci.h
index 071dfc321a61..6eebc55175bf 100644
--- a/sys/dev/usb/usb_pci.h
+++ b/sys/dev/usb/usb_pci.h
@@ -31,9 +31,11 @@
* We don't want the following files included everywhere, that's why
* they are in a separate file.
*/
+#ifndef USB_GLOBAL_INCLUDE_FILE
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <sys/rman.h>
+#endif
#endif /* _USB_PCI_H_ */
diff --git a/sys/dev/usb/usb_pf.c b/sys/dev/usb/usb_pf.c
index d9c8dac5725c..98705ebcdcd9 100644
--- a/sys/dev/usb/usb_pf.c
+++ b/sys/dev/usb/usb_pf.c
@@ -1,3 +1,4 @@
+/* $FreeBSD$ */
/*-
* Copyright (c) 1990, 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,8 +33,9 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/bus.h>
@@ -59,6 +61,7 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_bus.h>
#include <dev/usb/usb_pf.h>
#include <dev/usb/usb_transfer.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
static void usbpf_init(void);
static void usbpf_uninit(void);
diff --git a/sys/dev/usb/usb_process.c b/sys/dev/usb/usb_process.c
index c006f5108ff2..34314f458a05 100644
--- a/sys/dev/usb/usb_process.c
+++ b/sys/dev/usb/usb_process.c
@@ -26,6 +26,9 @@
#define USB_DEBUG_VAR usb_proc_debug
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -55,6 +58,7 @@
#include <sys/proc.h>
#include <sys/kthread.h>
#include <sys/sched.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
#if (__FreeBSD_version < 700000)
#define thread_lock(td) mtx_lock_spin(&sched_lock)
diff --git a/sys/dev/usb/usb_process.h b/sys/dev/usb/usb_process.h
index 23cf6607c946..923f64541f4e 100644
--- a/sys/dev/usb/usb_process.h
+++ b/sys/dev/usb/usb_process.h
@@ -27,9 +27,11 @@
#ifndef _USB_PROCESS_H_
#define _USB_PROCESS_H_
+#ifndef USB_GLOBAL_INCLUDE_FILE
#include <sys/interrupt.h>
#include <sys/priority.h>
#include <sys/runq.h>
+#endif
/* defines */
#define USB_PRI_HIGH PI_SWI(SWI_NET)
diff --git a/sys/dev/usb/usb_request.c b/sys/dev/usb/usb_request.c
index ce50d9bc7b03..6a819457a369 100644
--- a/sys/dev/usb/usb_request.c
+++ b/sys/dev/usb/usb_request.c
@@ -26,6 +26,9 @@
* SUCH DAMAGE.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -66,6 +69,7 @@
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
#include <sys/ctype.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
static int usb_no_cs_fail;
diff --git a/sys/dev/usb/usb_transfer.c b/sys/dev/usb/usb_transfer.c
index 6e48a3ef9ced..397b0b7acc9b 100644
--- a/sys/dev/usb/usb_transfer.c
+++ b/sys/dev/usb/usb_transfer.c
@@ -24,6 +24,9 @@
* SUCH DAMAGE.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -61,6 +64,7 @@
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
#include <dev/usb/usb_pf.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
struct usb_std_packet_size {
struct {
diff --git a/sys/dev/usb/usb_util.c b/sys/dev/usb/usb_util.c
index 4fe79c5b33d6..f9fec76b74af 100644
--- a/sys/dev/usb/usb_util.c
+++ b/sys/dev/usb/usb_util.c
@@ -24,6 +24,9 @@
* SUCH DAMAGE.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
@@ -56,6 +59,7 @@
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
+#endif /* USB_GLOBAL_INCLUDE_FILE */
/*------------------------------------------------------------------------*
* device_set_usb_desc
diff --git a/sys/dev/usb/usbdi.h b/sys/dev/usb/usbdi.h
index d753fe18e451..d39a84d95d8e 100644
--- a/sys/dev/usb/usbdi.h
+++ b/sys/dev/usb/usbdi.h
@@ -102,7 +102,9 @@ typedef void (usb_fifo_filter_t)(struct usb_fifo *fifo, struct usb_mbuf *m);
/* USB events */
+#ifndef USB_GLOBAL_INCLUDE_FILE
#include <sys/eventhandler.h>
+#endif
typedef void (*usb_dev_configured_t)(void *, struct usb_device *,
struct usb_attach_arg *);
EVENTHANDLER_DECLARE(usb_dev_configured, usb_dev_configured_t);
diff --git a/sys/dev/usb/usbhid.h b/sys/dev/usb/usbhid.h
index f6c447cadaa1..28dfede252b9 100644
--- a/sys/dev/usb/usbhid.h
+++ b/sys/dev/usb/usbhid.h
@@ -29,7 +29,9 @@
#ifndef _USB_HID_H_
#define _USB_HID_H_
+#ifndef USB_GLOBAL_INCLUDE_FILE
#include <dev/usb/usb_endian.h>
+#endif
#define UR_GET_HID_DESCRIPTOR 0x06
#define UDESC_HID 0x21