From owner-svn-src-stable-8@FreeBSD.ORG Tue Aug 20 07:40:41 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id E81C7676; Tue, 20 Aug 2013 07:40:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D42312971; Tue, 20 Aug 2013 07:40:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7K7efnr089699; Tue, 20 Aug 2013 07:40:41 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7K7efRr089695; Tue, 20 Aug 2013 07:40:41 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201308200740.r7K7efRr089695@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 20 Aug 2013 07:40:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r254556 - stable/8/sys/dev/usb X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Aug 2013 07:40:42 -0000 Author: hselasky Date: Tue Aug 20 07:40:40 2013 New Revision: 254556 URL: http://svnweb.freebsd.org/changeset/base/254556 Log: MFC r254243: - Try to fix build of 32-bit compatibility USB support for FreeBSD and Linux targets without breaking the existing IOCTL API. - Remove some not-needed header file inclusions. - Wrap a long line. Reported by: Damjan Jovanovic Modified: stable/8/sys/dev/usb/usb_compat_linux.c stable/8/sys/dev/usb/usb_hub.c stable/8/sys/dev/usb/usb_ioctl.h stable/8/sys/dev/usb/usb_request.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/usb/ (props changed) Modified: stable/8/sys/dev/usb/usb_compat_linux.c ============================================================================== --- stable/8/sys/dev/usb/usb_compat_linux.c Tue Aug 20 07:28:24 2013 (r254555) +++ stable/8/sys/dev/usb/usb_compat_linux.c Tue Aug 20 07:40:40 2013 (r254556) @@ -45,7 +45,6 @@ #include #include -#include #include #include Modified: stable/8/sys/dev/usb/usb_hub.c ============================================================================== --- stable/8/sys/dev/usb/usb_hub.c Tue Aug 20 07:28:24 2013 (r254555) +++ stable/8/sys/dev/usb/usb_hub.c Tue Aug 20 07:40:40 2013 (r254556) @@ -50,7 +50,6 @@ #include #include -#include #include #include Modified: stable/8/sys/dev/usb/usb_ioctl.h ============================================================================== --- stable/8/sys/dev/usb/usb_ioctl.h Tue Aug 20 07:28:24 2013 (r254555) +++ stable/8/sys/dev/usb/usb_ioctl.h Tue Aug 20 07:40:40 2013 (r254556) @@ -30,6 +30,7 @@ #define _USB_IOCTL_H_ #include +#include /* Building "kdump" depends on these includes */ @@ -41,6 +42,16 @@ #define USB_GENERIC_NAME "ugen" #define USB_TEMPLATE_SYSCTL "hw.usb.template" /* integer type */ +/* + * Align IOCTL structures to hide differences when running 32-bit + * programs under 64-bit kernels: + */ +#ifdef COMPAT_32BIT +#define USB_IOCTL_STRUCT_ALIGN(n) __aligned(n) +#else +#define USB_IOCTL_STRUCT_ALIGN(n) +#endif + /* Definition of valid template sysctl values */ enum { @@ -62,7 +73,7 @@ struct usb_read_dir { #endif uint32_t urd_startentry; uint32_t urd_maxlen; -}; +} USB_IOCTL_STRUCT_ALIGN(8); struct usb_ctl_request { #ifdef COMPAT_32BIT @@ -74,12 +85,12 @@ struct usb_ctl_request { uint16_t ucr_actlen; /* actual length transferred */ uint8_t ucr_addr; /* zero - currently not used */ struct usb_device_request ucr_request; -}; +} USB_IOCTL_STRUCT_ALIGN(8); struct usb_alt_interface { uint8_t uai_interface_index; uint8_t uai_alt_index; -}; +} USB_IOCTL_STRUCT_ALIGN(1); struct usb_gen_descriptor { #ifdef COMPAT_32BIT @@ -98,7 +109,7 @@ struct usb_gen_descriptor { uint8_t ugd_endpt_index; uint8_t ugd_report_type; uint8_t reserved[8]; -}; +} USB_IOCTL_STRUCT_ALIGN(8); struct usb_device_info { uint16_t udi_productNo; @@ -127,24 +138,33 @@ struct usb_device_info { char udi_vendor[128]; char udi_serial[64]; char udi_release[8]; -}; +} USB_IOCTL_STRUCT_ALIGN(2); + +#define USB_DEVICE_PORT_PATH_MAX 32 + +struct usb_device_port_path { + uint8_t udp_bus; /* which bus we are on */ + uint8_t udp_index; /* which device index */ + uint8_t udp_port_level; /* how many levels: 0, 1, 2 ... */ + uint8_t udp_port_no[USB_DEVICE_PORT_PATH_MAX]; +} USB_IOCTL_STRUCT_ALIGN(1); struct usb_device_stats { uint32_t uds_requests_ok[4]; /* Indexed by transfer type UE_XXX */ uint32_t uds_requests_fail[4]; /* Indexed by transfer type UE_XXX */ -}; +} USB_IOCTL_STRUCT_ALIGN(4); struct usb_fs_start { uint8_t ep_index; -}; +} USB_IOCTL_STRUCT_ALIGN(1); struct usb_fs_stop { uint8_t ep_index; -}; +} USB_IOCTL_STRUCT_ALIGN(1); struct usb_fs_complete { uint8_t ep_index; -}; +} USB_IOCTL_STRUCT_ALIGN(1); /* This structure is used for all endpoint types */ struct usb_fs_endpoint { @@ -177,7 +197,7 @@ struct usb_fs_endpoint { /* timeout value for no timeout */ #define USB_FS_TIMEOUT_NONE 0 int status; /* see USB_ERR_XXX */ -}; +} USB_IOCTL_STRUCT_ALIGN(8); struct usb_fs_init { /* userland pointer to endpoints structure */ @@ -188,11 +208,11 @@ struct usb_fs_init { #endif /* maximum number of endpoints */ uint8_t ep_index_max; -}; +} USB_IOCTL_STRUCT_ALIGN(8); struct usb_fs_uninit { uint8_t dummy; /* zero */ -}; +} USB_IOCTL_STRUCT_ALIGN(1); struct usb_fs_open { #define USB_FS_MAX_BUFSIZE (1 << 18) @@ -204,15 +224,20 @@ struct usb_fs_open { uint8_t dev_index; /* currently unused */ uint8_t ep_index; uint8_t ep_no; /* bEndpointNumber */ -}; +} USB_IOCTL_STRUCT_ALIGN(4); + +struct usb_fs_open_stream { + struct usb_fs_open fs_open; + uint16_t stream_id; /* stream ID */ +} USB_IOCTL_STRUCT_ALIGN(4); struct usb_fs_close { uint8_t ep_index; -}; +} USB_IOCTL_STRUCT_ALIGN(1); struct usb_fs_clear_stall_sync { uint8_t ep_index; -}; +} USB_IOCTL_STRUCT_ALIGN(1); struct usb_gen_quirk { uint16_t index; /* Quirk Index */ @@ -222,11 +247,11 @@ struct usb_gen_quirk { uint16_t bcdDeviceHigh; /* High Device Revision */ uint16_t reserved[2]; /* - * String version of quirk including terminating zero. See UQ_XXX in - * "usb_quirk.h". + * String version of quirk including terminating zero. See + * UQ_XXX in "usb_quirk.h". */ char quirkname[64 - 14]; -}; +} USB_IOCTL_STRUCT_ALIGN(2); /* USB controller */ #define USB_REQUEST _IOWR('U', 1, struct usb_ctl_request) Modified: stable/8/sys/dev/usb/usb_request.c ============================================================================== --- stable/8/sys/dev/usb/usb_request.c Tue Aug 20 07:28:24 2013 (r254555) +++ stable/8/sys/dev/usb/usb_request.c Tue Aug 20 07:40:40 2013 (r254556) @@ -48,7 +48,6 @@ #include #include #include -#include #include #define USB_DEBUG_VAR usb_debug