From owner-p4-projects@FreeBSD.ORG Thu Mar 19 10:11:44 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1D3D11065678; Thu, 19 Mar 2009 10:11:44 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C537E1065677 for ; Thu, 19 Mar 2009 10:11:43 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id B17BD8FC17 for ; Thu, 19 Mar 2009 10:11:43 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n2JABhTT033118 for ; Thu, 19 Mar 2009 10:11:43 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n2JABhTg033116 for perforce@freebsd.org; Thu, 19 Mar 2009 10:11:43 GMT (envelope-from hselasky@FreeBSD.org) Date: Thu, 19 Mar 2009 10:11:43 GMT Message-Id: <200903191011.n2JABhTg033116@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 159430 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Mar 2009 10:11:45 -0000 http://perforce.freebsd.org/chv.cgi?CH=159430 Change 159430 by hselasky@hselasky_laptop001 on 2009/03/19 10:11:01 USB CORE: usb_core.h + usb_defs.h: - Move tunable defines into "usb_core.h". - Leave hardcoded defines in "usb_defs.h". - Allow overriding all tunable defines. - Add more customisable typedefs. Other files: - Remove dependancy towards "usb_defs.h". - Correct maximum device number. Affected files ... .. //depot/projects/usb/src/sys/dev/usb/controller/at91dci.c#3 edit .. //depot/projects/usb/src/sys/dev/usb/controller/at91dci_atmelarm.c#2 edit .. //depot/projects/usb/src/sys/dev/usb/controller/atmegadci.c#7 edit .. //depot/projects/usb/src/sys/dev/usb/controller/atmegadci_atmelarm.c#4 edit .. //depot/projects/usb/src/sys/dev/usb/controller/ehci.c#5 edit .. //depot/projects/usb/src/sys/dev/usb/controller/ehci.h#3 edit .. //depot/projects/usb/src/sys/dev/usb/controller/ehci_ixp4xx.c#3 edit .. //depot/projects/usb/src/sys/dev/usb/controller/ehci_mbus.c#2 edit .. //depot/projects/usb/src/sys/dev/usb/controller/ehci_pci.c#3 edit .. //depot/projects/usb/src/sys/dev/usb/controller/musb_otg.c#3 edit .. //depot/projects/usb/src/sys/dev/usb/controller/musb_otg_atmelarm.c#4 edit .. //depot/projects/usb/src/sys/dev/usb/controller/ohci.c#2 edit .. //depot/projects/usb/src/sys/dev/usb/controller/ohci.h#2 edit .. //depot/projects/usb/src/sys/dev/usb/controller/ohci_atmelarm.c#2 edit .. //depot/projects/usb/src/sys/dev/usb/controller/ohci_pci.c#3 edit .. //depot/projects/usb/src/sys/dev/usb/controller/uhci.c#2 edit .. //depot/projects/usb/src/sys/dev/usb/controller/uhci.h#2 edit .. //depot/projects/usb/src/sys/dev/usb/controller/uhci_pci.c#3 edit .. //depot/projects/usb/src/sys/dev/usb/controller/usb_controller.c#5 edit .. //depot/projects/usb/src/sys/dev/usb/controller/uss820dci.c#3 edit .. //depot/projects/usb/src/sys/dev/usb/controller/uss820dci_atmelarm.c#2 edit .. //depot/projects/usb/src/sys/dev/usb/net/if_cdce.c#4 edit .. //depot/projects/usb/src/sys/dev/usb/serial/u3g.c#5 edit .. //depot/projects/usb/src/sys/dev/usb/serial/ubser.c#4 edit .. //depot/projects/usb/src/sys/dev/usb/serial/ugensa.c#3 edit .. //depot/projects/usb/src/sys/dev/usb/serial/umct.c#3 edit .. //depot/projects/usb/src/sys/dev/usb/serial/umodem.c#6 edit .. //depot/projects/usb/src/sys/dev/usb/storage/ustorage_fs.c#4 edit .. //depot/projects/usb/src/sys/dev/usb/template/usb_template.c#2 edit .. //depot/projects/usb/src/sys/dev/usb/usb_busdma.c#3 edit .. //depot/projects/usb/src/sys/dev/usb/usb_compat_linux.c#30 edit .. //depot/projects/usb/src/sys/dev/usb/usb_core.h#6 edit .. //depot/projects/usb/src/sys/dev/usb/usb_debug.c#2 edit .. //depot/projects/usb/src/sys/dev/usb/usb_defs.h#2 edit .. //depot/projects/usb/src/sys/dev/usb/usb_dev.c#11 edit .. //depot/projects/usb/src/sys/dev/usb/usb_device.c#8 edit .. //depot/projects/usb/src/sys/dev/usb/usb_dynamic.c#2 edit .. //depot/projects/usb/src/sys/dev/usb/usb_generic.c#6 edit .. //depot/projects/usb/src/sys/dev/usb/usb_handle_request.c#2 edit .. //depot/projects/usb/src/sys/dev/usb/usb_hid.c#26 edit .. //depot/projects/usb/src/sys/dev/usb/usb_hub.c#5 edit .. //depot/projects/usb/src/sys/dev/usb/usb_hub.h#3 edit .. //depot/projects/usb/src/sys/dev/usb/usb_msctest.c#2 edit .. //depot/projects/usb/src/sys/dev/usb/usb_request.c#3 edit .. //depot/projects/usb/src/sys/dev/usb/usb_sw_transfer.c#2 edit .. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#130 edit .. //depot/projects/usb/src/sys/dev/usb/usb_util.c#3 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/controller/at91dci.c#3 (text+ko) ==== @@ -47,7 +47,6 @@ #include #include #include -#include #define USB_DEBUG_VAR at91dcidebug ==== //depot/projects/usb/src/sys/dev/usb/controller/at91dci_atmelarm.c#2 (text+ko) ==== @@ -28,7 +28,6 @@ #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb/controller/atmegadci.c#7 (text+ko) ==== @@ -40,7 +40,6 @@ #include #include #include -#include #define USB_DEBUG_VAR atmegadci_debug ==== //depot/projects/usb/src/sys/dev/usb/controller/atmegadci_atmelarm.c#4 (text+ko) ==== @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb/controller/ehci.c#5 (text+ko) ==== @@ -49,7 +49,6 @@ #include #include #include -#include #define USB_DEBUG_VAR ehcidebug @@ -3168,7 +3167,7 @@ USETW(sc->sc_hub_desc.stat.wStatus, 0); break; case C(UR_SET_ADDRESS, UT_WRITE_DEVICE): - if (value >= USB_MAX_DEVICES) { + if (value >= EHCI_MAX_DEVICES) { std->err = USB_ERR_IOERROR; goto done; } ==== //depot/projects/usb/src/sys/dev/usb/controller/ehci.h#3 (text+ko) ==== @@ -38,7 +38,7 @@ #ifndef _EHCI_H_ #define _EHCI_H_ -#define EHCI_MAX_DEVICES USB_MAX_DEVICES +#define EHCI_MAX_DEVICES MIN(USB_MAX_DEVICES, 128) /* PCI config registers */ #define PCI_CBMEM 0x10 /* configuration base MEM */ ==== //depot/projects/usb/src/sys/dev/usb/controller/ehci_ixp4xx.c#3 (text+ko) ==== @@ -32,7 +32,6 @@ #include "opt_bus.h" #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb/controller/ehci_mbus.c#2 (text+ko) ==== @@ -39,7 +39,6 @@ #include "opt_bus.h" #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb/controller/ehci_pci.c#3 (text+ko) ==== @@ -53,7 +53,6 @@ */ #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb/controller/musb_otg.c#3 (text+ko) ==== @@ -39,7 +39,6 @@ #include #include #include -#include #define USB_DEBUG_VAR musbotgdebug ==== //depot/projects/usb/src/sys/dev/usb/controller/musb_otg_atmelarm.c#4 (text+ko) ==== @@ -25,7 +25,6 @@ */ #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb/controller/ohci.c#2 (text+ko) ==== @@ -38,7 +38,6 @@ #include #include #include -#include #define USB_DEBUG_VAR ohcidebug @@ -2256,7 +2255,7 @@ USETW(sc->sc_hub_desc.stat.wStatus, 0); break; case C(UR_SET_ADDRESS, UT_WRITE_DEVICE): - if (value >= USB_MAX_DEVICES) { + if (value >= OHCI_MAX_DEVICES) { std->err = USB_ERR_IOERROR; goto done; } ==== //depot/projects/usb/src/sys/dev/usb/controller/ohci.h#2 (text+ko) ==== @@ -39,7 +39,7 @@ #ifndef _OHCI_H_ #define _OHCI_H_ -#define OHCI_MAX_DEVICES USB_MAX_DEVICES +#define OHCI_MAX_DEVICES MIN(USB_MAX_DEVICES, 128) /* PCI config registers */ #define PCI_CBMEM 0x10 /* configuration base memory */ ==== //depot/projects/usb/src/sys/dev/usb/controller/ohci_atmelarm.c#2 (text+ko) ==== @@ -26,7 +26,6 @@ __FBSDID("$FreeBSD: src/sys/dev/usb/controller/ohci_atmelarm.c,v 1.1 2009/02/23 18:31:00 thompsa Exp $"); #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb/controller/ohci_pci.c#3 (text+ko) ==== @@ -52,7 +52,6 @@ #include #include #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb/controller/uhci.c#2 (text+ko) ==== @@ -41,7 +41,6 @@ #include #include #include -#include #define USB_DEBUG_VAR uhcidebug @@ -2626,7 +2625,7 @@ USETW(sc->sc_hub_desc.stat.wStatus, 0); break; case C(UR_SET_ADDRESS, UT_WRITE_DEVICE): - if (value >= USB_MAX_DEVICES) { + if (value >= UHCI_MAX_DEVICES) { std->err = USB_ERR_IOERROR; goto done; } ==== //depot/projects/usb/src/sys/dev/usb/controller/uhci.h#2 (text+ko) ==== @@ -39,7 +39,7 @@ #ifndef _UHCI_H_ #define _UHCI_H_ -#define UHCI_MAX_DEVICES USB_MAX_DEVICES +#define UHCI_MAX_DEVICES MIN(USB_MAX_DEVICES, 128) /* PCI config registers */ #define PCI_USBREV 0x60 /* USB protocol revision */ ==== //depot/projects/usb/src/sys/dev/usb/controller/uhci_pci.c#3 (text+ko) ==== @@ -49,7 +49,6 @@ */ #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb/controller/usb_controller.c#5 (text+ko) ==== @@ -25,7 +25,6 @@ */ #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb/controller/uss820dci.c#3 (text+ko) ==== @@ -36,7 +36,6 @@ #include #include #include -#include #define USB_DEBUG_VAR uss820dcidebug ==== //depot/projects/usb/src/sys/dev/usb/controller/uss820dci_atmelarm.c#2 (text+ko) ==== @@ -28,7 +28,6 @@ */ #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb/net/if_cdce.c#4 (text+ko) ==== @@ -48,7 +48,6 @@ #include #include #include -#include #define USB_DEBUG_VAR cdce_debug ==== //depot/projects/usb/src/sys/dev/usb/serial/u3g.c#5 (text+ko) ==== @@ -34,7 +34,6 @@ #include #include #include -#include #define USB_DEBUG_VAR u3g_debug ==== //depot/projects/usb/src/sys/dev/usb/serial/ubser.c#4 (text+ko) ==== @@ -80,7 +80,6 @@ #include #include #include -#include #define USB_DEBUG_VAR ubser_debug ==== //depot/projects/usb/src/sys/dev/usb/serial/ugensa.c#3 (text+ko) ==== @@ -47,7 +47,6 @@ #include #include #include -#include #define USB_DEBUG_VAR usb2_debug ==== //depot/projects/usb/src/sys/dev/usb/serial/umct.c#3 (text+ko) ==== @@ -49,7 +49,6 @@ #include #include #include -#include #define USB_DEBUG_VAR usb2_debug ==== //depot/projects/usb/src/sys/dev/usb/serial/umodem.c#6 (text+ko) ==== @@ -86,7 +86,6 @@ #include #include #include -#include #define USB_DEBUG_VAR umodem_debug ==== //depot/projects/usb/src/sys/dev/usb/storage/ustorage_fs.c#4 (text+ko) ==== @@ -39,7 +39,6 @@ #include #include #include -#include #define USB_DEBUG_VAR ustorage_fs_debug ==== //depot/projects/usb/src/sys/dev/usb/template/usb_template.c#2 (text+ko) ==== @@ -32,7 +32,6 @@ #include #include #include -#include #include #define USB_DEBUG_VAR usb2_debug ==== //depot/projects/usb/src/sys/dev/usb/usb_busdma.c#3 (text+ko) ==== @@ -27,7 +27,6 @@ #include #include #include -#include #define USB_DEBUG_VAR usb2_debug ==== //depot/projects/usb/src/sys/dev/usb/usb_compat_linux.c#30 (text+ko) ==== @@ -25,7 +25,6 @@ * SUCH DAMAGE. */ -#include #include #include #include ==== //depot/projects/usb/src/sys/dev/usb/usb_core.h#6 (text+ko) ==== @@ -32,6 +32,8 @@ #ifndef _USB2_CORE_H_ #define _USB2_CORE_H_ +#define USB_STACK_VERSION 2000 /* 2.0 */ + /* Allow defines in "opt_usb.h" to override configuration */ #include "opt_usb.h" @@ -140,28 +142,53 @@ #include #include -#include +#include #include #include "usb_if.h" -#define USB_STACK_VERSION 2000 /* 2.0 */ - +#ifndef USB_HOST_ALIGN #define USB_HOST_ALIGN 8 /* bytes, must be power of two */ +#endif -#define USB_ISOC_TIME_MAX 128 /* ms */ +#ifndef USB_FS_ISOC_UFRAME_MAX #define USB_FS_ISOC_UFRAME_MAX 4 /* exclusive unit */ +#endif #if (USB_FS_ISOC_UFRAME_MAX > 6) #error "USB_FS_ISOC_UFRAME_MAX cannot be set higher than 6" #endif +#ifndef USB_BUS_MAX +#define USB_BUS_MAX 256 /* units */ +#endif + +#ifndef USB_MAX_DEVICES +#define USB_MAX_DEVICES 128 /* units */ +#endif + +#if (USB_MAX_DEVICES < USB_MIN_DEVICES) +#error "Minimum number of devices is greater than maximum number of devices." +#endif + +#ifndef USB_IFACE_MAX +#define USB_IFACE_MAX 32 /* units */ +#endif + +#ifndef USB_FIFO_MAX +#define USB_FIFO_MAX 128 /* units */ +#endif + +#if (USB_FIFO_MAX & 1) +#error "Number of FIFOs must be odd." +#endif + #define USB_MAX_FS_ISOC_FRAMES_PER_XFER (120) /* units */ #define USB_MAX_HS_ISOC_FRAMES_PER_XFER (8*120) /* units */ -#define USB_MAX_IPACKET 8 /* maximum size of the initial USB - * data packet */ -#define USB_HUB_MAX_DEPTH 5 +#ifndef USB_HUB_MAX_DEPTH +#define USB_HUB_MAX_DEPTH 5 +#endif /* USB transfer states */ @@ -219,9 +246,39 @@ /* typedefs */ -typedef uint8_t usb2_error_t; +typedef void (usb2_callback_t)(struct usb2_xfer *); + +#ifndef USB_HAVE_USB_ERROR_T +typedef uint8_t usb2_error_t; /* see "USB_ERR_XXX" */ +#endif + +#ifndef USB_HAVE_TIMEOUT_T +typedef uint32_t usb2_timeout_t; /* milliseconds */ +#endif + +#ifndef USB_HAVE_LENGTH_T +typedef uint32_t usb2_length_t; /* bytes */ +#endif + +#ifndef USB_HAVE_FRAMES_T +typedef uint32_t usb2_frames_t; /* units */ +#endif + +#ifndef USB_HAVE_INTERVAL_T +typedef uint32_t usb2_interval_t; /* milliseconds */ +#endif + +#ifndef USB_HAVE_SIZE_T +typedef uint32_t usb2_size_t; /* bytes */ +#endif + +#ifndef USB_HAVE_REFS_T +typedef uint32_t usb2_refs_t; /* units */ +#endif -typedef void (usb2_callback_t)(struct usb2_xfer *); +#ifndef USB_HAVE_TICKS_T +typedef uint32_t usb2_ticks_t; /* system defined */ +#endif /* structures */ ==== //depot/projects/usb/src/sys/dev/usb/usb_debug.c#2 (text+ko) ==== @@ -25,7 +25,6 @@ */ #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb/usb_defs.h#2 (text+ko) ==== @@ -27,22 +27,16 @@ #ifndef _USB2_DEFS_H_ #define _USB2_DEFS_H_ -/* Definition of some USB constants */ +/* Definition of some hardcoded USB constants. */ + +#define USB_MAX_IPACKET 8 /* initial USB packet size */ -#define USB_BUS_MAX 256 /* units */ -#define USB_DEV_MAX 128 /* units */ -#define USB_IFACE_MAX 32 /* units */ #define USB_EP_MAX (2*16) /* hardcoded */ -#define USB_FIFO_MAX (4 * USB_EP_MAX) #define USB_ROOT_HUB_ADDR 1 /* index */ #define USB_MIN_DEVICES 2 /* unused + root HUB */ -#define USB_MAX_DEVICES USB_DEV_MAX /* including virtual root HUB and - * address zero */ -#define USB_MAX_ENDPOINTS USB_EP_MAX /* 2 directions on 16 endpoints */ - #define USB_UNCONFIG_INDEX 0xFF /* internal use only */ #define USB_IFACE_INDEX_ANY 0xFF /* internal use only */ @@ -57,20 +51,10 @@ #define USB_FS_BYTES_PER_HS_UFRAME 188 /* bytes */ #define USB_HS_MICRO_FRAMES_MAX 8 /* units */ +#define USB_ISOC_TIME_MAX 128 /* ms */ + /* sanity checks */ -#if (USB_FIFO_MAX < USB_EP_MAX) -#error "There cannot be less FIFOs than USB endpoints." -#endif -#if (USB_FIFO_MAX & 1) -#error "Number of FIFOs must be odd." -#endif -#if (USB_EP_MAX < (2*16)) -#error "Number of hardware USB endpoints cannot be less than 32." -#endif -#if (USB_MAX_DEVICES < USB_MIN_DEVICES) -#error "Minimum number of devices is greater than maximum number of devices." -#endif #if (USB_ROOT_HUB_ADDR >= USB_MIN_DEVICES) #error "The root hub address must be less than USB_MIN_DEVICES." #endif ==== //depot/projects/usb/src/sys/dev/usb/usb_dev.c#11 (text+ko) ==== @@ -29,7 +29,6 @@ #include #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb/usb_device.c#8 (text+ko) ==== @@ -24,7 +24,6 @@ * SUCH DAMAGE. */ -#include #include #include #include ==== //depot/projects/usb/src/sys/dev/usb/usb_dynamic.c#2 (text+ko) ==== @@ -24,7 +24,6 @@ * SUCH DAMAGE. */ -#include #include #include #include ==== //depot/projects/usb/src/sys/dev/usb/usb_generic.c#6 (text+ko) ==== @@ -24,7 +24,6 @@ * SUCH DAMAGE. */ -#include #include #include #include ==== //depot/projects/usb/src/sys/dev/usb/usb_handle_request.c#2 (text+ko) ==== @@ -24,7 +24,6 @@ * SUCH DAMAGE. */ -#include #include #include #include ==== //depot/projects/usb/src/sys/dev/usb/usb_hid.c#26 (text+ko) ==== @@ -43,7 +43,6 @@ #include #include #include -#include #include #define USB_DEBUG_VAR usb2_debug ==== //depot/projects/usb/src/sys/dev/usb/usb_hub.c#5 (text+ko) ==== @@ -30,7 +30,6 @@ * USB spec: http://www.usb.org/developers/docs/usbspec.zip */ -#include #include #include #include ==== //depot/projects/usb/src/sys/dev/usb/usb_hub.h#3 (text+ko) ==== ==== //depot/projects/usb/src/sys/dev/usb/usb_msctest.c#2 (text+ko) ==== @@ -32,7 +32,6 @@ * mass storage quirks for not supported SCSI commands! */ -#include #include #include #include ==== //depot/projects/usb/src/sys/dev/usb/usb_request.c#3 (text+ko) ==== @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include #include #include #include ==== //depot/projects/usb/src/sys/dev/usb/usb_sw_transfer.c#2 (text+ko) ==== @@ -27,7 +27,6 @@ #include #include #include -#include #define USB_DEBUG_VAR usb2_debug ==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#130 (text+ko) ==== @@ -27,7 +27,6 @@ #include #include #include -#include #define USB_DEBUG_VAR usb2_debug ==== //depot/projects/usb/src/sys/dev/usb/usb_util.c#3 (text+ko) ==== @@ -24,7 +24,6 @@ * SUCH DAMAGE. */ -#include #include #include #include