From owner-svn-src-stable-8@FreeBSD.ORG Sun Aug 21 20:59:51 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 939EE106564A; Sun, 21 Aug 2011 20:59:51 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 81EA58FC0C; Sun, 21 Aug 2011 20:59:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7LKxpeG019491; Sun, 21 Aug 2011 20:59:51 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7LKxpmt019489; Sun, 21 Aug 2011 20:59:51 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201108212059.p7LKxpmt019489@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 21 Aug 2011 20:59:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225067 - stable/8/usr.bin/tail X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 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: Sun, 21 Aug 2011 20:59:51 -0000 Author: jilles Date: Sun Aug 21 20:59:51 2011 New Revision: 225067 URL: http://svn.freebsd.org/changeset/base/225067 Log: MFC r224865: tail: Fix crash if -F'ed file's filesystem disappears. If tail notices that a file it is following no longer exists (because stat() fails), it will output any final lines and then close the file. If the read operation also causes an error, such as when the filesystem is forcefully unmounted, it closes the file as well, leading to fclose(NULL) and a segmentation fault. PR: bin/159750 Modified: stable/8/usr.bin/tail/forward.c Directory Properties: stable/8/usr.bin/tail/ (props changed) Modified: stable/8/usr.bin/tail/forward.c ============================================================================== --- stable/8/usr.bin/tail/forward.c Sun Aug 21 18:50:30 2011 (r225066) +++ stable/8/usr.bin/tail/forward.c Sun Aug 21 20:59:51 2011 (r225067) @@ -365,8 +365,10 @@ follow(file_info_t *files, enum STYLE st if (errno != ENOENT) ierr(file->file_name); show(file); - fclose(file->fp); - file->fp = NULL; + if (file->fp != NULL) { + fclose(file->fp); + file->fp = NULL; + } ev_change++; continue; } From owner-svn-src-stable-8@FreeBSD.ORG Mon Aug 22 18:41:40 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29DC51065686; Mon, 22 Aug 2011 18:41:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 19CDE8FC29; Mon, 22 Aug 2011 18:41:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7MIfdMX063664; Mon, 22 Aug 2011 18:41:39 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7MIfddS063662; Mon, 22 Aug 2011 18:41:39 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201108221841.p7MIfddS063662@svn.freebsd.org> From: John Baldwin Date: Mon, 22 Aug 2011 18:41:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225080 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 22 Aug 2011 18:41:40 -0000 Author: jhb Date: Mon Aug 22 18:41:39 2011 New Revision: 225080 URL: http://svn.freebsd.org/changeset/base/225080 Log: MFC 224986: One of the general principles of the sysctl(3) API is that a user can query the needed size for a sysctl result by passing in a NULL old pointer and a valid oldsize. The kern.proc.args sysctl handler broke this assumption by not calling SYSCTL_OUT() if the old pointer was NULL. Modified: stable/8/sys/kern/kern_proc.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/kern_proc.c ============================================================================== --- stable/8/sys/kern/kern_proc.c Mon Aug 22 18:36:58 2011 (r225079) +++ stable/8/sys/kern/kern_proc.c Mon Aug 22 18:41:39 2011 (r225080) @@ -1383,7 +1383,7 @@ sysctl_kern_proc_args(SYSCTL_HANDLER_ARG pa = p->p_args; pargs_hold(pa); PROC_UNLOCK(p); - if (req->oldptr != NULL && pa != NULL) + if (pa != NULL) error = SYSCTL_OUT(req, pa->ar_args, pa->ar_length); pargs_drop(pa); if (error != 0 || req->newptr == NULL) From owner-svn-src-stable-8@FreeBSD.ORG Mon Aug 22 18:46:03 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3FEFB1065674; Mon, 22 Aug 2011 18:46:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2FD2A8FC28; Mon, 22 Aug 2011 18:46:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7MIk3dh063903; Mon, 22 Aug 2011 18:46:03 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7MIk371063901; Mon, 22 Aug 2011 18:46:03 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201108221846.p7MIk371063901@svn.freebsd.org> From: John Baldwin Date: Mon, 22 Aug 2011 18:46:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225082 - stable/8/sys/dev/puc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 22 Aug 2011 18:46:03 -0000 Author: jhb Date: Mon Aug 22 18:46:02 2011 New Revision: 225082 URL: http://svn.freebsd.org/changeset/base/225082 Log: MFC 224898: Add device id for the Moxa CP-112UL dual-port serial adapters. Modified: stable/8/sys/dev/puc/pucdata.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/puc/pucdata.c ============================================================================== --- stable/8/sys/dev/puc/pucdata.c Mon Aug 22 18:41:55 2011 (r225081) +++ stable/8/sys/dev/puc/pucdata.c Mon Aug 22 18:46:02 2011 (r225082) @@ -524,6 +524,12 @@ const struct puc_cfg puc_pci_devices[] = PUC_PORT_4S, 0x18, 0, 8, }, + { 0x1393, 0x1120, 0xffff, 0, + "Moxa Technologies, CP-112UL", + DEFAULT_RCLK * 8, + PUC_PORT_2S, 0x18, 0, 8, + }, + { 0x1393, 0x1141, 0xffff, 0, "Moxa Technologies, Industio CP-114", DEFAULT_RCLK * 8, From owner-svn-src-stable-8@FreeBSD.ORG Mon Aug 22 18:58:00 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0589B106566B; Mon, 22 Aug 2011 18:58:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E93788FC0A; Mon, 22 Aug 2011 18:57:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7MIvxow064338; Mon, 22 Aug 2011 18:57:59 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7MIvxPK064336; Mon, 22 Aug 2011 18:57:59 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201108221857.p7MIvxPK064336@svn.freebsd.org> From: John Baldwin Date: Mon, 22 Aug 2011 18:57:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225084 - stable/8/usr.sbin/mfiutil X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 22 Aug 2011 18:58:00 -0000 Author: jhb Date: Mon Aug 22 18:57:59 2011 New Revision: 225084 URL: http://svn.freebsd.org/changeset/base/225084 Log: MFC 224495: Properly initialize an error variable to avoid returning uninitialized data when 'show drives' succeeds, often resulting in a failing exit code even though the command worked fine. Modified: stable/8/usr.sbin/mfiutil/mfi_show.c Directory Properties: stable/8/usr.sbin/mfiutil/ (props changed) Modified: stable/8/usr.sbin/mfiutil/mfi_show.c ============================================================================== --- stable/8/usr.sbin/mfiutil/mfi_show.c Mon Aug 22 18:46:23 2011 (r225083) +++ stable/8/usr.sbin/mfiutil/mfi_show.c Mon Aug 22 18:57:59 2011 (r225084) @@ -533,6 +533,7 @@ show_drives(int ac, char **av) MFI_DNAME_ES)); printf("\n"); } + error = 0; error: free(list); close(fd); From owner-svn-src-stable-8@FreeBSD.ORG Tue Aug 23 07:00:51 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A9C0106564A; Tue, 23 Aug 2011 07:00:51 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 87E8F8FC1F; Tue, 23 Aug 2011 07:00:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7N70pf2089257; Tue, 23 Aug 2011 07:00:51 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7N70pNa089252; Tue, 23 Aug 2011 07:00:51 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201108230700.p7N70pNa089252@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 23 Aug 2011 07:00:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225100 - in stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 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, 23 Aug 2011 07:00:51 -0000 Author: pjd Date: Tue Aug 23 07:00:51 2011 New Revision: 225100 URL: http://svn.freebsd.org/changeset/base/225100 Log: MFC r224791: Eliminate the zfsdev_state_lock entirely and replace it with the spa_namespace_lock. This fixes LOR between the spa_namespace_lock and spa_config lock. LOR can cause deadlock on vdevs removal/insertion. Reported by: gibbs, delphij Tested by: delphij Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Tue Aug 23 00:25:15 2011 (r225099) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Tue Aug 23 07:00:51 2011 (r225100) @@ -337,7 +337,6 @@ extern void *zfsdev_get_soft_state(minor extern minor_t zfsdev_minor_alloc(void); extern void *zfsdev_state; -extern kmutex_t zfsdev_state_lock; #endif /* _KERNEL */ Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Aug 23 00:25:15 2011 (r225099) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Aug 23 07:00:51 2011 (r225100) @@ -410,7 +410,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi struct g_provider *pp; struct g_consumer *cp; size_t bufsize; - int error, lock; + int error; /* * We must have a pathname, and it must be absolute. @@ -422,12 +422,6 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi vd->vdev_tsd = NULL; - if (mutex_owned(&spa_namespace_lock)) { - mutex_exit(&spa_namespace_lock); - lock = 1; - } else { - lock = 0; - } DROP_GIANT(); g_topology_lock(); error = 0; @@ -459,11 +453,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi !ISP2(cp->provider->sectorsize)) { ZFS_LOG(1, "Provider %s has unsupported sectorsize.", vd->vdev_path); - - g_topology_lock(); vdev_geom_detach(cp, 0); - g_topology_unlock(); - error = EINVAL; cp = NULL; } else if (cp->acw == 0 && (spa_mode(vd->vdev_spa) & FWRITE) != 0) { @@ -486,8 +476,6 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi } g_topology_unlock(); PICKUP_GIANT(); - if (lock) - mutex_enter(&spa_namespace_lock); if (cp == NULL) { vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED; return (error); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Aug 23 00:25:15 2011 (r225099) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Aug 23 07:00:51 2011 (r225100) @@ -4815,7 +4815,7 @@ zfsdev_minor_alloc(void) static minor_t last_minor; minor_t m; - ASSERT(MUTEX_HELD(&zfsdev_state_lock)); + ASSERT(MUTEX_HELD(&spa_namespace_lock)); for (m = last_minor + 1; m != last_minor; m++) { if (m > ZFSDEV_MAX_MINOR) @@ -4835,7 +4835,7 @@ zfs_ctldev_init(struct cdev *devp) minor_t minor; zfs_soft_state_t *zs; - ASSERT(MUTEX_HELD(&zfsdev_state_lock)); + ASSERT(MUTEX_HELD(&spa_namespace_lock)); minor = zfsdev_minor_alloc(); if (minor == 0) @@ -4856,7 +4856,7 @@ zfs_ctldev_init(struct cdev *devp) static void zfs_ctldev_destroy(zfs_onexit_t *zo, minor_t minor) { - ASSERT(MUTEX_HELD(&zfsdev_state_lock)); + ASSERT(MUTEX_HELD(&spa_namespace_lock)); zfs_onexit_destroy(zo); ddi_soft_state_free(zfsdev_state, minor); @@ -4886,9 +4886,9 @@ zfsdev_open(struct cdev *devp, int flag, /* This is the control device. Allocate a new minor if requested. */ if (flag & FEXCL) { - mutex_enter(&zfsdev_state_lock); + mutex_enter(&spa_namespace_lock); error = zfs_ctldev_init(devp); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); } return (error); @@ -4903,14 +4903,14 @@ zfsdev_close(void *data) if (minor == 0) return; - mutex_enter(&zfsdev_state_lock); + mutex_enter(&spa_namespace_lock); zo = zfsdev_get_soft_state(minor, ZSST_CTLDEV); if (zo == NULL) { - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return; } zfs_ctldev_destroy(zo, minor); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); } static int Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Tue Aug 23 00:25:15 2011 (r225099) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Tue Aug 23 07:00:51 2011 (r225100) @@ -94,12 +94,11 @@ static char *zvol_tag = "zvol_tag"; #define ZVOL_DUMPSIZE "dumpsize" /* - * This lock protects the zfsdev_state structure from being modified - * while it's being used, e.g. an open that comes in before a create - * finishes. It also protects temporary opens of the dataset so that, + * The spa_namespace_lock protects the zfsdev_state structure from being + * modified while it's being used, e.g. an open that comes in before a + * create finishes. It also protects temporary opens of the dataset so that, * e.g., an open doesn't get a spurious EBUSY. */ -kmutex_t zfsdev_state_lock; static uint32_t zvol_minors; typedef struct zvol_extent { @@ -246,7 +245,7 @@ zvol_minor_lookup(const char *name) struct g_geom *gp; zvol_state_t *zv = NULL; - ASSERT(MUTEX_HELD(&zfsdev_state_lock)); + ASSERT(MUTEX_HELD(&spa_namespace_lock)); g_topology_lock(); LIST_FOREACH(gp, &zfs_zvol_class.geom, geom) { @@ -462,11 +461,11 @@ zvol_name2minor(const char *name, minor_ { zvol_state_t *zv; - mutex_enter(&zfsdev_state_lock); + mutex_enter(&spa_namespace_lock); zv = zvol_minor_lookup(name); if (minor && zv) *minor = zv->zv_minor; - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (zv ? 0 : -1); } #endif /* sun */ @@ -485,10 +484,10 @@ zvol_create_minor(const char *name) ZFS_LOG(1, "Creating ZVOL %s...", name); - mutex_enter(&zfsdev_state_lock); + mutex_enter(&spa_namespace_lock); if (zvol_minor_lookup(name) != NULL) { - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (EEXIST); } @@ -496,20 +495,20 @@ zvol_create_minor(const char *name) error = dmu_objset_own(name, DMU_OST_ZVOL, B_TRUE, FTAG, &os); if (error) { - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (error); } #ifdef sun if ((minor = zfsdev_minor_alloc()) == 0) { dmu_objset_disown(os, FTAG); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (ENXIO); } if (ddi_soft_state_zalloc(zfsdev_state, minor) != DDI_SUCCESS) { dmu_objset_disown(os, FTAG); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (EAGAIN); } (void) ddi_prop_update_string(minor, zfs_dip, ZVOL_PROP_NAME, @@ -521,7 +520,7 @@ zvol_create_minor(const char *name) minor, DDI_PSEUDO, 0) == DDI_FAILURE) { ddi_soft_state_free(zfsdev_state, minor); dmu_objset_disown(os, FTAG); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (EAGAIN); } @@ -532,7 +531,7 @@ zvol_create_minor(const char *name) ddi_remove_minor_node(zfs_dip, chrbuf); ddi_soft_state_free(zfsdev_state, minor); dmu_objset_disown(os, FTAG); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (EAGAIN); } @@ -572,7 +571,7 @@ zvol_create_minor(const char *name) zvol_minors++; - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); zvol_geom_run(zv); @@ -594,7 +593,7 @@ zvol_remove_zv(zvol_state_t *zv) minor_t minor = zv->zv_minor; #endif - ASSERT(MUTEX_HELD(&zfsdev_state_lock)); + ASSERT(MUTEX_HELD(&spa_namespace_lock)); if (zv->zv_total_opens != 0) return (EBUSY); @@ -620,15 +619,15 @@ zvol_remove_minor(const char *name) zvol_state_t *zv; int rc; - mutex_enter(&zfsdev_state_lock); + mutex_enter(&spa_namespace_lock); if ((zv = zvol_minor_lookup(name)) == NULL) { - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (ENXIO); } g_topology_lock(); rc = zvol_remove_zv(zv); g_topology_unlock(); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (rc); } @@ -730,7 +729,7 @@ zvol_update_volsize(objset_t *os, uint64 dmu_tx_t *tx; int error; - ASSERT(MUTEX_HELD(&zfsdev_state_lock)); + ASSERT(MUTEX_HELD(&spa_namespace_lock)); tx = dmu_tx_create(os); dmu_tx_hold_zap(tx, ZVOL_ZAP_OBJ, TRUE, NULL); @@ -761,7 +760,7 @@ zvol_remove_minors(const char *name) namelen = strlen(name); DROP_GIANT(); - mutex_enter(&zfsdev_state_lock); + mutex_enter(&spa_namespace_lock); g_topology_lock(); LIST_FOREACH_SAFE(gp, &zfs_zvol_class.geom, geom, gptmp) { @@ -779,7 +778,7 @@ zvol_remove_minors(const char *name) } g_topology_unlock(); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); PICKUP_GIANT(); } @@ -793,10 +792,10 @@ zvol_set_volsize(const char *name, major uint64_t old_volsize = 0ULL; uint64_t readonly; - mutex_enter(&zfsdev_state_lock); + mutex_enter(&spa_namespace_lock); zv = zvol_minor_lookup(name); if ((error = dmu_objset_hold(name, FTAG, &os)) != 0) { - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (error); } @@ -863,7 +862,7 @@ zvol_set_volsize(const char *name, major out: dmu_objset_rele(os, FTAG); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (error); } @@ -875,18 +874,18 @@ zvol_open(struct g_provider *pp, int fla zvol_state_t *zv; int err = 0; - mutex_enter(&zfsdev_state_lock); + mutex_enter(&spa_namespace_lock); zv = pp->private; if (zv == NULL) { - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (ENXIO); } if (zv->zv_total_opens == 0) err = zvol_first_open(zv); if (err) { - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (err); } if ((flag & FWRITE) && (zv->zv_flags & ZVOL_RDONLY)) { @@ -908,13 +907,13 @@ zvol_open(struct g_provider *pp, int fla #endif zv->zv_total_opens += count; - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (err); out: if (zv->zv_total_opens == 0) zvol_last_close(zv); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (err); } @@ -925,11 +924,11 @@ zvol_close(struct g_provider *pp, int fl zvol_state_t *zv; int error = 0; - mutex_enter(&zfsdev_state_lock); + mutex_enter(&spa_namespace_lock); zv = pp->private; if (zv == NULL) { - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (ENXIO); } @@ -952,7 +951,7 @@ zvol_close(struct g_provider *pp, int fl if (zv->zv_total_opens == 0) zvol_last_close(zv); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (error); } @@ -1571,12 +1570,12 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t int error = 0; rl_t *rl; - mutex_enter(&zfsdev_state_lock); + mutex_enter(&spa_namespace_lock); zv = zfsdev_get_soft_state(getminor(dev), ZSST_ZVOL); if (zv == NULL) { - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (ENXIO); } ASSERT(zv->zv_total_opens > 0); @@ -1590,7 +1589,7 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t dki.dki_ctype = DKC_UNKNOWN; dki.dki_unit = getminor(dev); dki.dki_maxtransfer = 1 << (SPA_MAXBLOCKSHIFT - zv->zv_min_bs); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); if (ddi_copyout(&dki, (void *)arg, sizeof (dki), flag)) error = EFAULT; return (error); @@ -1600,7 +1599,7 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t dkm.dki_lbsize = 1U << zv->zv_min_bs; dkm.dki_capacity = zv->zv_volsize >> zv->zv_min_bs; dkm.dki_media_type = DK_UNKNOWN; - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); if (ddi_copyout(&dkm, (void *)arg, sizeof (dkm), flag)) error = EFAULT; return (error); @@ -1610,14 +1609,14 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t uint64_t vs = zv->zv_volsize; uint8_t bs = zv->zv_min_bs; - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); error = zvol_getefi((void *)arg, flag, vs, bs); return (error); } case DKIOCFLUSHWRITECACHE: dkc = (struct dk_callback *)arg; - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); zil_commit(zv->zv_zilog, ZVOL_OBJ); if ((flag & FKIOCTL) && dkc != NULL && dkc->dkc_callback) { (*dkc->dkc_callback)(dkc->dkc_cookie, error); @@ -1643,10 +1642,10 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t } if (wce) { zv->zv_flags |= ZVOL_WCE; - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); } else { zv->zv_flags &= ~ZVOL_WCE; - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); zil_commit(zv->zv_zilog, ZVOL_OBJ); } return (0); @@ -1682,7 +1681,7 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t break; } - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); return (error); } #endif /* sun */ @@ -1698,14 +1697,12 @@ zvol_init(void) { VERIFY(ddi_soft_state_init(&zfsdev_state, sizeof (zfs_soft_state_t), 1) == 0); - mutex_init(&zfsdev_state_lock, NULL, MUTEX_DEFAULT, NULL); ZFS_LOG(1, "ZVOL Initialized."); } void zvol_fini(void) { - mutex_destroy(&zfsdev_state_lock); ddi_soft_state_fini(&zfsdev_state); ZFS_LOG(1, "ZVOL Deinitialized."); } @@ -1720,7 +1717,7 @@ zvol_dump_init(zvol_state_t *zv, boolean nvlist_t *nv = NULL; uint64_t version = spa_version(dmu_objset_spa(zv->zv_objset)); - ASSERT(MUTEX_HELD(&zfsdev_state_lock)); + ASSERT(MUTEX_HELD(&spa_namespace_lock)); error = dmu_free_long_range(zv->zv_objset, ZVOL_OBJ, 0, DMU_OBJECT_END); /* wait for dmu_free_long_range to actually free the blocks */ @@ -2230,7 +2227,7 @@ zvol_rename_minor(struct g_geom *gp, con struct g_provider *pp; zvol_state_t *zv; - ASSERT(MUTEX_HELD(&zfsdev_state_lock)); + ASSERT(MUTEX_HELD(&spa_namespace_lock)); g_topology_assert(); pp = LIST_FIRST(&gp->provider); @@ -2264,7 +2261,7 @@ zvol_rename_minors(const char *oldname, newnamelen = strlen(newname); DROP_GIANT(); - mutex_enter(&zfsdev_state_lock); + mutex_enter(&spa_namespace_lock); g_topology_lock(); LIST_FOREACH(gp, &zfs_zvol_class.geom, geom) { @@ -2287,6 +2284,6 @@ zvol_rename_minors(const char *oldname, } g_topology_unlock(); - mutex_exit(&zfsdev_state_lock); + mutex_exit(&spa_namespace_lock); PICKUP_GIANT(); } From owner-svn-src-stable-8@FreeBSD.ORG Tue Aug 23 07:35:21 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A323106566C; Tue, 23 Aug 2011 07:35:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 776BA8FC1E; Tue, 23 Aug 2011 07:35:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7N7ZLqD090411; Tue, 23 Aug 2011 07:35:21 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7N7ZLW7090406; Tue, 23 Aug 2011 07:35:21 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201108230735.p7N7ZLW7090406@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 23 Aug 2011 07:35:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225102 - stable/8/lib/libusb X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 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, 23 Aug 2011 07:35:21 -0000 Author: hselasky Date: Tue Aug 23 07:35:21 2011 New Revision: 225102 URL: http://svn.freebsd.org/changeset/base/225102 Log: MFC r224903, r224917, r225035, r225090, r225091: - Add missing API function to the LibUSB v1.0 API. - Update LibUSB v1.0 manual page. PR: docs/159898 Modified: stable/8/lib/libusb/Makefile stable/8/lib/libusb/libusb.3 stable/8/lib/libusb/libusb.h stable/8/lib/libusb/libusb10.c Directory Properties: stable/8/lib/libusb/ (props changed) stable/8/lib/libusb/usb.h (props changed) Modified: stable/8/lib/libusb/Makefile ============================================================================== --- stable/8/lib/libusb/Makefile Tue Aug 23 07:17:37 2011 (r225101) +++ stable/8/lib/libusb/Makefile Tue Aug 23 07:35:21 2011 (r225102) @@ -43,6 +43,7 @@ MLINKS += libusb.3 libusb_get_device_lis MLINKS += libusb.3 libusb_free_device_list.3 MLINKS += libusb.3 libusb_get_bus_number.3 MLINKS += libusb.3 libusb_get_device_address.3 +MLINKS += libusb.3 libusb_get_device_speed.3 MLINKS += libusb.3 libusb_get_max_packet_size.3 MLINKS += libusb.3 libusb_ref_device.3 MLINKS += libusb.3 libusb_unref_device.3 Modified: stable/8/lib/libusb/libusb.3 ============================================================================== --- stable/8/lib/libusb/libusb.3 Tue Aug 23 07:17:37 2011 (r225101) +++ stable/8/lib/libusb/libusb.3 Tue Aug 23 07:35:21 2011 (r225102) @@ -26,247 +26,211 @@ .\" .\" $FreeBSD$ .\" -.Dd November 18, 2010 +.Dd August 16, 2011 .Dt LIBUSB 3 .Os .Sh NAME .Nm libusb -. .Nd "USB access library" -. -. .Sh LIBRARY -. -. -USB access library (libusb -lusb) -. -. +USB access library +.Pq libusb, -lusb .Sh SYNOPSIS -. -. .In libusb.h -. -. .Sh DESCRIPTION The .Nm library contains interfaces for directly managing a usb device. The current implementation supports v1.0 of the libusb API. -. -. .Sh LIBRARY INITIALISATION / DEINITIALISATION -. .Pp -. .Ft int .Fn libusb_init libusb_context **ctx -This function initialises libusb. Must be called at the beginning -of the program. This function returns 0 on success or LIBUSB_ERROR on +This function initialises libusb. +It must be called at the beginning +of the program, before other libusb routines are used. +This function returns 0 on success or LIBUSB_ERROR on failure. -. .Pp -. .Ft void .Fn libusb_exit "libusb_context *ctx" -Deinitialise libusb. Must be called at the end of the application. -. +Deinitialise libusb. +Must be called at the end of the application. +Other libusb routines may not be called after this function. .Pp -. .Ft const char * .Fn libusb_strerror "int code" -Get ASCII representation of the error given by the +Get the ASCII representation of the error given by the .Fa code argument. -. -. .Pp -. .Ft void .Fn libusb_set_debug "libusb_context *ctx" "int level" -Set debug to the -.Fa level -level. -. +Set the debug level to +.Fa level . .Pp -. .Ft ssize_t .Fn libusb_get_device_list "libusb_context *ctx" "libusb_device ***list" -Fill into -.Fa list -the list of usb device available. All the device created by this -function must be unref and free when you are done with them. This -function returns the number of devices in list or a LIBUSB_ERROR code. -. +Populate +.Fa list +with the list of usb devices available, adding a reference to each +device in the list. +All the list entries created by this +function must have their reference counter +decremented when you are done with them, +and the list itself must be freed. +This +function returns the number of devices in the list or a LIBUSB_ERROR code. .Pp -. .Ft void .Fn libusb_free_device_list "libusb_device **list" "int unref_devices" -Free the list of devices discovered by libusb_get_device_list. If +Free the list of devices discovered by libusb_get_device_list. +If .Fa unref_device -is set to 1 all devices are unref one time. -. +is set to 1 all devices in the list have their reference +counter decremented once. .Pp -. .Ft uint8_t .Fn libusb_get_bus_number "libusb_device *dev" Returns the number of the bus contained by the device .Fa dev. -. .Pp -. .Ft uint8_t .Fn libusb_get_device_address "libusb_device *dev" -Return the device_address contained by the device +Returns the device_address contained by the device .Fa dev. -. .Pp -. +.Ft enum libusb_speed +.Fn libusb_get_device_speed "libusb_device *dev" +Returns the wire speed at which the device is connected. +See the LIBUSB_SPEED_XXX enums for more information. +LIBUSB_SPEED_UNKNOWN is returned in case of unknown wire speed. +.Pp .Ft int .Fn libusb_get_max_packet_size "libusb_device *dev" "unsigned char endpoint" -Return the wMaxPacketSize value on success, LIBUSB_ERROR_NOT_FOUND if the +Returns the wMaxPacketSize value on success, LIBUSB_ERROR_NOT_FOUND if the endpoint does not exist and LIBUSB_ERROR_OTHERS on other failure. -. .Pp -. .Ft libusb_device * .Fn libusb_ref_device "libusb_device *dev" Increment the reference counter of the device .Fa dev. -. .Pp -. .Ft void .Fn libusb_unref_device "libusb_device *dev" Decrement the reference counter of the device .Fa dev. -. .Pp -. .Ft int .Fn libusb_open "libusb_device *dev" "libusb_device_handle **devh" -Open a device and obtain a device_handle. Return 0 on success, -LIBUSB_ERROR_NO_MEM on memory allocation problem, LIBUSB_ERROR_ACCESS -on permission problem, LIBUSB_ERROR_NO_DEVICE if the device has been -disconnected and a LIBUSB_ERROR code on error. -. +Open a device and obtain a device_handle. +Returns 0 on success, +LIBUSB_ERROR_NO_MEM on memory allocation problems, LIBUSB_ERROR_ACCESS +on permissions problems, LIBUSB_ERROR_NO_DEVICE if the device has been +disconnected and a LIBUSB_ERROR code on other errors. .Pp -. .Ft libusb_device_handle * .Fn libusb_open_device_with_vid_pid "libusb_context *ctx" "uint16_t vid" "uint16_t pid" -Convenience function to open a device with is -.Fa vid -and +A convenience function to open a device by vendor and product IDs +.Fa vid +and .Fa pid. -Return NULL on error. -. +Returns NULL on error. .Pp -. .Ft void .Fn libusb_close "libusb_device_handle *devh" Close a device handle. -. .Pp -. .Ft libusb_device * -.Fn libusb_get_device(libusb_device_handle *devh) -Get the device contained by devh. Return NULL on error. -. +.Fn libusb_get_device "libusb_device_handle *devh" +Get the device contained by devh. +Returns NULL on error. .Pp -. .Ft int .Fn libusb_get_configuration "libusb_device_handle *devh" "int *config" -Return the bConfiguration value of the current configuration. return 0 -on success, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected +Returns the bConfiguration value of the current configuration. +Returns 0 +on success, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on error. -. .Pp -. .Ft int .Fn libusb_set_configuration "libusb_device_handle *devh" "int config" -Set the active configuration +Set the active configuration to .Fa config for the device contained by .Fa devh. -This function return 0 on success, LIBUSB_ERROR_NOT_FOUND if the requested -configuration does not exist, LIBUSB_ERROR_BUSY if the interfaces are currently -claimed, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a +This function returns 0 on success, LIBUSB_ERROR_NOT_FOUND if the requested +configuration does not exist, LIBUSB_ERROR_BUSY if the interfaces are currently +claimed, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on failure. -. .Pp -. .Ft int .Fn libusb_claim_interface "libusb_device_handle *devh" "int interface_number" Claim an interface in a given libusb_handle .Fa devh. -This is a non-blocking function. It return 0 success, LIBUSB_ERROR_NOT_FOUND -if the requested interface does not exist, LIBUSB_ERROR_BUSY if a program or -driver has claimed the interface, LIBUSB_ERROR_NO_DEVICE if the device has +This is a non-blocking function. +It returns 0 on success, LIBUSB_ERROR_NOT_FOUND +if the requested interface does not exist, LIBUSB_ERROR_BUSY if a program or +driver has claimed the interface, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on failure. -. .Pp -. .Ft int .Fn libusb_release_interface "libusb_device_handle *devh" "int interface_number" -This function release an interface. All the claimed interface must be released -before closing a device. Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if the -interface was not claimed, LIBUSB_ERROR_NO_DEVICE if the device has been +This function releases an interface. +All the claimed interfaces on a device must be released +before closing the device. +Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if the +interface was not claimed, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and LIBUSB_ERROR on failure. -. .Pp -. .Ft int .Fn libusb_set_interface_alt_setting "libusb_device_handle *dev" "int interface_number" "int alternate_setting" -Activate an alternate setting for an interface. Returns 0 on success, -LIBUSB_ERROR_NOT_FOUND if the interface was not claimed or the requested -setting does not exist, LIBUSB_ERROR_NO_DEVICE if the device has been -disconnected and LIBUSB_ERROR code on failure. -. +Activate an alternate setting for an interface. +Returns 0 on success, +LIBUSB_ERROR_NOT_FOUND if the interface was not claimed or the requested +setting does not exist, LIBUSB_ERROR_NO_DEVICE if the device has been +disconnected and a LIBUSB_ERROR code on failure. .Pp -. .Ft int .Fn libusb_clear_halt "libusb_device_handle *devh" "unsigned char endpoint" -Clear an halt/stall for a endpoint. Returns 0 on success, LIBUSB_ERROR_NOT_FOUND -if the endpoint does not exist, LIBUSB_ERROR_NO_DEVICE if the device has been +Clear an halt/stall for a endpoint. +Returns 0 on success, LIBUSB_ERROR_NOT_FOUND +if the endpoint does not exist, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on failure. -. .Pp -. .Ft int .Fn libusb_reset_device "libusb_device_handle *devh" -Perform an USB port reset for an usb device. Returns 0 on success, +Perform an USB port reset for an usb device. +Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if re-enumeration is required or if the device has been disconnected and a LIBUSB_ERROR code on failure. -. .Pp -. .Ft int .Fn libusb_check_connected "libusb_device_handle *devh" -Test if USB device is still connected. Returns 0 on success, -LIBUSB_ERROR_NO_DEVICE if has been disconnected and a LIBUSB_ERROR +Test if the USB device is still connected. +Returns 0 on success, +LIBUSB_ERROR_NO_DEVICE if it has been disconnected and a LIBUSB_ERROR code on failure. -. .Pp -. .Ft int .Fn libusb_kernel_driver_active "libusb_device_handle *devh" "int interface" -Determine if a driver is active on a interface. Returns 0 if no kernel driver -is active, returns 1 if a kernel driver is active, returns LIBUSB_ERROR_NO_DEVICE -if the device has been disconnected and return a LIBUSB_ERROR code on failure. -. +Determine if a driver is active on a interface. +Returns 0 if no kernel driver +is active, 1 if a kernel driver is active, LIBUSB_ERROR_NO_DEVICE +if the device has been disconnected and a LIBUSB_ERROR code on failure. .Pp -. .Ft int .Fn libusb_get_driver "libusb_device_handle *devh" "int interface" "char *name" "int namelen" or .Ft int .Fn libusb_get_driver_np "libusb_device_handle *devh" "int interface" "char *name" "int namelen" -Gets the name of the driver attached to the given +Copy the name of the driver attached to the given .Fa device and .Fa interface -into the buffer given by +into the buffer .Fa name -and +of length .Fa namelen . Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if no kernel driver is attached to the given interface and LIBUSB_ERROR_INVALID_PARAM if the interface does @@ -275,239 +239,230 @@ This function is non-portable. The buffer pointed to by .Fa name is only zero terminated on success. -. .Pp -. .Ft int .Fn libusb_detach_kernel_driver "libusb_device_handle *devh" "int interface" or .Ft int .Fn libusb_detach_kernel_driver_np "libusb_device_handle *devh" "int interface" Detach a kernel driver from an interface. -This is needed to claim an interface required by a kernel driver. +This is needed to claim an interface already claimed by a kernel driver. Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if no kernel driver was active, -LIBUSB_ERROR_INVALID_PARAM if the interface does not exist, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on failure. This function is non-portable. -. +LIBUSB_ERROR_INVALID_PARAM if the interface does not exist, +LIBUSB_ERROR_NO_DEVICE if the device has been disconnected +and a LIBUSB_ERROR code on failure. +This function is non-portable. .Pp -. .Ft int .Fn libusb_attach_kernel_driver "libusb_device_handle *devh" "int interface" -Re-attach an interface kernel driver previously detached. Returns 0 on success, -LIBUSB_ERROR_INVALID_PARAM if the interface does not exist, LIBUSB_ERROR_NO_DEVICE -if the device has been disconnect, LIBUSB_ERROR_BUSY if the driver cannot be -attached because the interface is claimed by a program or driver and a +Re-attach an interface kernel driver that was previously detached. +Returns 0 on success, +LIBUSB_ERROR_INVALID_PARAM if the interface does not exist, +LIBUSB_ERROR_NO_DEVICE +if the device has been disconnected, LIBUSB_ERROR_BUSY if the driver cannot be +attached because the interface is claimed by a program or driver and a LIBUSB_ERROR code on failure. -. .Pp -. .Sh USB DESCRIPTORS -. .Pp -. .Ft int .Fn libusb_get_device_descriptor "libusb_device *dev" "libusb_device_descriptor *desc" Get the USB device descriptor for the device .Fa dev. -This is a non-blocking function. Returns 0 on success and a LIBUSB_ERROR code on +This is a non-blocking function. +Returns 0 on success and a LIBUSB_ERROR code on failure. -. .Pp -.Ft int +.Ft int .Fn libsub_get_active_config_descriptor "libusb_device *dev" "struct libusb_config_descriptor **config" -Get the USB configuration descriptor for the active configuration. Returns 0 on -success, returns LIBUSB_ERROR_NOT_FOUND if the device is in unconfigured state -and return another LIBUSB_ERROR code on error. -. +Get the USB configuration descriptor for the active configuration. +Returns 0 on +success, LIBUSB_ERROR_NOT_FOUND if the device is in +an unconfigured state +and a LIBUSB_ERROR code on error. .Pp -.Ft int +.Ft int .Fn libusb_get_config_descriptor "libusb_device *dev" "uint8_t config_index" "libusb_config_descriptor **config" -Get USB configuration descriptor based on its index +Get a USB configuration descriptor based on its index .Fa idx. -Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if the configuration does not exist -and returns another LIBUSB_ERROR code on error. -. +Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if the configuration does not exist +and a LIBUSB_ERROR code on error. .Pp .Ft int .Fn libusb_get_config_descriptor_by_value "libusb_device *dev" "uint8 bConfigurationValue" "libusb_config_descriptor **config" -Get a USB configuration descriptor with a specific bConfigurationValue. This is -a non-blocking function which does not send request through the device. Returns 0 -on success, LIBUSB_ERROR_NOT_FOUND if the configuration does not exist and another +Get a USB configuration descriptor with a specific bConfigurationValue. +This is +a non-blocking function which does not send a request through the device. +Returns 0 +on success, LIBUSB_ERROR_NOT_FOUND if the configuration +does not exist and a LIBUSB_ERROR code on failure. -. .Pp .Ft void .Fn libusb_free_config_descriptor "libusb_config_descriptor *config" Free a configuration descriptor. -. .Pp .Ft int .Fn libusb_get_string_descriptor_ascii "libusb_device_handle *devh" "uint8_t desc_idx" "unsigned char *data" "int length" -Retrieve a string descriptor in C style ascii. Returns a number of byte on success -and a LIBUSB_ERROR code on failure. -. +Retrieve a string descriptor in C style ASCII. +Returns the positive number of bytes in the resulting ASCII string +on success and a LIBUSB_ERROR code on failure. .Pp -. .Sh USB ASYNCHRONOUS I/O -. .Pp .Ft struct libusb_transfer * .Fn libusb_alloc_transfer "int iso_packets" -Allocate a transfer with -.Fa iso_packets -numbers of isochronous packet descriptors. Returns NULL on error. -. +Allocate a transfer with the number of isochronous packet descriptors +specified by +.Fa iso_packets . +Returns NULL on error. .Pp .Ft void .Fn libusb_free_transfer "struct libusb_transfer *tr" Free a transfer. -. .Pp .Ft int .Fn libusb_submit_transfer "struct libusb_transfer *tr" -This function will submit a transfer and returns immediately. Returns 0 on -success, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and +This function will submit a transfer and returns immediately. +Returns 0 on success, LIBUSB_ERROR_NO_DEVICE if +the device has been disconnected and a LIBUSB_ERROR code on other failure. -. .Pp .Ft int .Fn libusb_cancel_transfer "struct libusb_transfer *tr" -This function asynchronously cancel a transfer. Returns 0 on success and -LIBUSB_ERROR code on failure. -. +This function asynchronously cancels a transfer. +Returns 0 on success and a LIBUSB_ERROR code on failure. .Pp .Sh USB SYNCHRONOUS I/O -. .Pp .Ft int .Fn libusb_control_transfer "libusb_device_handle *devh" "uint8_t bmRequestType" "uint8_t bRequest" "uint16_t wValue" "uint16_t wIndex" "unsigned char *data" "uint16_t wLength" "unsigned int timeout" -Perform a USB control transfer. Returns the actual number of bytes -transferred on success in the range from and including zero until and +Perform a USB control transfer. +Returns the actual number of bytes +transferred on success, in the range from and including zero up to and including .Fa wLength . -On error a libusb error code is returned, for example -LIBUSB_ERROR_TIMEOUT if the transfer timeout, LIBUSB_ERROR_PIPE if the +On error a LIBUSB_ERROR code is returned, for example +LIBUSB_ERROR_TIMEOUT if the transfer timed out, LIBUSB_ERROR_PIPE if the control request was not supported, LIBUSB_ERROR_NO_DEVICE if the -device has been disconnected or another LIBUSB_ERROR code on other failures. -The libusb error codes are always negative. -. +device has been disconnected and another LIBUSB_ERROR code on other failures. +The LIBUSB_ERROR codes are all negative. .Pp .Ft int .Fn libusb_bulk_transfer "struct libusb_device_handle *devh" "unsigned char endpoint" "unsigned char *data" "int length" "int *transferred" "unsigned int timeout" Perform an USB bulk transfer. A timeout value of zero means no timeout. The timeout value is given in milliseconds. -Returns 0 on success, LIBUSB_ERROR_TIMEOUT -if the transfer timeout, LIBUSB_ERROR_PIPE if the control request was not -supported, LIBUSB_ERROR_OVERFLOW if the device offered more data, -LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and -LIBUSB_ERROR code on other failure. -. +Returns 0 on success, LIBUSB_ERROR_TIMEOUT +if the transfer timed out, LIBUSB_ERROR_PIPE if the control request was not +supported, LIBUSB_ERROR_OVERFLOW if the device offered more data, +LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and +a LIBUSB_ERROR code on other failure. .Pp .Ft int .Fn libusb_interrupt_transfer "struct libusb_device_handle *devh" "unsigned char endpoint" "unsigned char *data" "int length" "int *transferred" "unsigned int timeout" Perform an USB Interrupt transfer. A timeout value of zero means no timeout. The timeout value is given in milliseconds. -Returns 0 on success, LIBUSB_ERROR_TIMEOUT -if the transfer timeout, LIBUSB_ERROR_PIPE if the control request was not -supported, LIBUSB_ERROR_OVERFLOW if the device offered more data, -LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and -LIBUSB_ERROR code on other failure. -. +Returns 0 on success, LIBUSB_ERROR_TIMEOUT +if the transfer timed out, LIBUSB_ERROR_PIPE if the control request was not +supported, LIBUSB_ERROR_OVERFLOW if the device offered more data, +LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and +a LIBUSB_ERROR code on other failure. .Pp .Sh USB EVENTS -. .Pp .Ft int .Fn libusb_try_lock_events "libusb_context *ctx" -Try to acquire the event handling lock. Returns 0 if the lock was obtained and 1 -if not. -. +Try to acquire the event handling lock. +Returns 0 if the lock was obtained and 1 if not. .Pp .Ft void .Fn libusb_lock_events "libusb_context *ctx" -Acquire the event handling lock. This function is blocking. -. +Acquire the event handling lock. +This function is blocking. .Pp .Ft void .Fn libusb_unlock_events "libusb_context *ctx" -Release the event handling lock. This will wake up any thread blocked -on libusb_wait_for_event(). -. +Release the event handling lock. +This will wake up any thread blocked +on +.B libusb_wait_for_event() . .Pp .Ft int .Fn libusb_event_handling_ok "libusb_context *ctx" -Determine if it still OK for this thread to be doing event handling. Returns 1 -if event handling can start or continue. Returns 0 if this thread must give up +Determine if it still OK for this thread to be doing event handling. +Returns 1 +if event handling can start or continue. +Returns 0 if this thread must give up the events lock. -. .Pp .Ft int .Fn libusb_event_handler_active "libusb_context *ctx" -Determine if an active thread is handling events. Returns 1 if yes and 0 if there +Determine if an active thread is handling events. +Returns 1 if there is a thread handling events and 0 if there are no threads currently handling events. -. .Pp .Ft void .Fn libusb_lock_event_waiters "libusb_context *ctx" -Acquire the event_waiters lock. This lock is designed to be obtained under the +Acquire the event_waiters lock. +This lock is designed to be obtained in the situation where you want to be aware when events are completed, but some other thread is event handling so calling libusb_handle_events() is not allowed. -. .Pp .Ft void .Fn libusb_unlock_event_waiters "libusb_context *ctx" Release the event_waiters lock. -. .Pp -.Ft int +.Ft int .Fn libusb_wait_for_event "libusb_context *ctx" "struct timeval *tv" -Wait for another thread to signal completion of an event. Must be called -with the event waiters lock held, see libusb_lock_event_waiters(). This will +Wait for another thread to signal completion of an event. +Must be called +with the event waiters lock held, see libusb_lock_event_waiters(). +This will block until the timeout expires or a transfer completes or a thread releases -the event handling lock through libusb_unlock_events(). Returns 0 after a -transfer completes or another thread stops event handling, returns 1 if the +the event handling lock through libusb_unlock_events(). +Returns 0 after a +transfer completes or another thread stops event handling, and 1 if the timeout expired. -. .Pp .Ft int .Fn libusb_handle_events_timeout "libusb_context *ctx" "struct timeval *tv" -Handle any pending events by checking if timeouts have expired and by -checking the set of file descriptors for activity. Returns 0 on success, or a +Handle any pending events by checking if timeouts have expired and by +checking the set of file descriptors for activity. +Returns 0 on success, or a LIBUSB_ERROR code on failure. -. .Pp .Ft int .Fn libusb_handle_events "libusb_context *ctx" -Handle any pending events in blocking mode with a sensible timeout. Returns 0 -on success, returns a LIBUSB_ERROR code on failure. -. +Handle any pending events in blocking mode with a sensible timeout. +Returns 0 +on success and a LIBUSB_ERROR code on failure. .Pp .Ft int .Fn libusb_handle_events_locked "libusb_context *ctx" "struct timeval *tv" Handle any pending events by polling file desciptors, without checking if -another threads are already doing so. Must be called with the event lock held. -. +another thread is already doing so. +Must be called with the event lock held. .Pp .Ft int .Fn libusb_get_next_timeout "libusb_context *ctx" "struct timeval *tv" -Determine the next internal timeout that libusb needs to handle. Returns 0 -if there are no pending timeouts, 1 if a timeout was returned, or LIBUSB_ERROR +Determine the next internal timeout that libusb needs to handle. +Returns 0 +if there are no pending timeouts, 1 if a timeout was returned, or a LIBUSB_ERROR code on failure. -. .Pp .Ft void .Fn libusb_set_pollfd_notifiers "libusb_context *ctx" "libusb_pollfd_added_cb added_cb" "libusb_pollfd_removed_cb remove_cb" "void *user_data" Register notification functions for file descriptor additions/removals. These functions will be invoked for every new or removed file descriptor that libusb uses as an event source. -. .Pp .Ft const struct libusb_pollfd ** .Fn libusb_get_pollfds "libusb_context *ctx" -Retrive a list of file descriptors that should be polled by your main loop as -libusb event sources. Returns a NULL-terminated list on success or NULL on failure. -. +Retrive a list of file descriptors that should be polled by your main loop as +libusb event sources. +Returns a NULL-terminated list on success or NULL on failure. .Sh LIBUSB VERSION 0.1 COMPATIBILITY .Pp The library is also compliant with LibUSB version 0.1.12. @@ -544,16 +499,13 @@ The library is also compliant with LibUS .Fn usb_check_connected .Fn usb_get_driver_np .Fn usb_detach_kernel_driver_np -. .Sh SEE ALSO .Xr libusb20 3 , .Xr usb 4 , .Xr usbconfig 8 .Pp .Pa http://libusb.sourceforge.net/ -. .Sh HISTORY -. .Nm support first appeared in .Fx 8.0 . Modified: stable/8/lib/libusb/libusb.h ============================================================================== --- stable/8/lib/libusb/libusb.h Tue Aug 23 07:17:37 2011 (r225101) +++ stable/8/lib/libusb/libusb.h Tue Aug 23 07:35:21 2011 (r225102) @@ -151,6 +151,14 @@ enum libusb_error { LIBUSB_ERROR_OTHER = -99, }; +enum libusb_speed { + LIBUSB_SPEED_UNKNOWN = 0, + LIBUSB_SPEED_LOW = 1, + LIBUSB_SPEED_FULL = 2, + LIBUSB_SPEED_HIGH = 3, + LIBUSB_SPEED_SUPER = 4, +}; + enum libusb_transfer_status { LIBUSB_TRANSFER_COMPLETED, LIBUSB_TRANSFER_ERROR, @@ -304,6 +312,7 @@ ssize_t libusb_get_device_list(libusb_co void libusb_free_device_list(libusb_device ** list, int unref_devices); uint8_t libusb_get_bus_number(libusb_device * dev); uint8_t libusb_get_device_address(libusb_device * dev); +enum libusb_speed libusb_get_device_speed(libusb_device * dev); int libusb_clear_halt(libusb_device_handle *devh, uint8_t endpoint); int libusb_get_max_packet_size(libusb_device * dev, uint8_t endpoint); libusb_device *libusb_ref_device(libusb_device * dev); Modified: stable/8/lib/libusb/libusb10.c ============================================================================== --- stable/8/lib/libusb/libusb10.c Tue Aug 23 07:17:37 2011 (r225101) +++ stable/8/lib/libusb/libusb10.c Tue Aug 23 07:35:21 2011 (r225102) @@ -272,6 +272,27 @@ libusb_get_device_address(libusb_device return (libusb20_dev_get_address(dev->os_priv)); } +enum libusb_speed +libusb_get_device_speed(libusb_device *dev) +{ + if (dev == NULL) + return (LIBUSB_SPEED_UNKNOWN); /* should not happen */ + + switch (libusb20_dev_get_speed(dev->os_priv)) { + case LIBUSB20_SPEED_LOW: + return (LIBUSB_SPEED_LOW); + case LIBUSB20_SPEED_FULL: + return (LIBUSB_SPEED_FULL); + case LIBUSB20_SPEED_HIGH: + return (LIBUSB_SPEED_HIGH); + case LIBUSB20_SPEED_SUPER: + return (LIBUSB_SPEED_SUPER); + default: + break; + } + return (LIBUSB_SPEED_UNKNOWN); +} + int libusb_get_max_packet_size(libusb_device *dev, uint8_t endpoint) { From owner-svn-src-stable-8@FreeBSD.ORG Tue Aug 23 07:42:05 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B206106564A; Tue, 23 Aug 2011 07:42:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 39F6F8FC13; Tue, 23 Aug 2011 07:42:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7N7g5Cw090647; Tue, 23 Aug 2011 07:42:05 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7N7g5JR090645; Tue, 23 Aug 2011 07:42:05 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201108230742.p7N7g5JR090645@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 23 Aug 2011 07:42:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225103 - stable/8/sys/dev/usb X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 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, 23 Aug 2011 07:42:05 -0000 Author: hselasky Date: Tue Aug 23 07:42:04 2011 New Revision: 225103 URL: http://svn.freebsd.org/changeset/base/225103 Log: MFC r225038: Fix for recursive locking in usb_close() after r224777 (9-current) and r224960 (8-stable). Modified: stable/8/sys/dev/usb/usb_dev.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/usb/usb_dev.c ============================================================================== --- stable/8/sys/dev/usb/usb_dev.c Tue Aug 23 07:35:21 2011 (r225102) +++ stable/8/sys/dev/usb/usb_dev.c Tue Aug 23 07:42:04 2011 (r225103) @@ -911,10 +911,23 @@ usb_close(void *arg) DPRINTFN(2, "cpd=%p\n", cpd); - err = usb_ref_device(cpd, &refs, 1); - if (err) { - free(cpd, M_USBDEV); - return; + err = usb_ref_device(cpd, &refs, 0); + if (err) + goto done; + + /* + * If this function is not called directly from the root HUB + * thread, there is usually a need to lock the enumeration + * lock. Check this. + */ + if (!usbd_enum_is_locked(cpd->udev)) { + + DPRINTFN(2, "Locking enumeration\n"); + + /* reference device */ + err = usb_usb_ref_device(cpd, &refs); + if (err) + goto done; } if (cpd->fflags & FREAD) { usb_fifo_close(refs.rxfifo, cpd->fflags); @@ -922,10 +935,9 @@ usb_close(void *arg) if (cpd->fflags & FWRITE) { usb_fifo_close(refs.txfifo, cpd->fflags); } - usb_unref_device(cpd, &refs); +done: free(cpd, M_USBDEV); - return; } static void From owner-svn-src-stable-8@FreeBSD.ORG Tue Aug 23 09:42:30 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 176E41065673; Tue, 23 Aug 2011 09:42:30 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 065B58FC16; Tue, 23 Aug 2011 09:42:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7N9gTwU094290; Tue, 23 Aug 2011 09:42:29 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7N9gTCG094288; Tue, 23 Aug 2011 09:42:29 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201108230942.p7N9gTCG094288@svn.freebsd.org> From: Attilio Rao Date: Tue, 23 Aug 2011 09:42:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225105 - stable/8/sys/dev/coretemp X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 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, 23 Aug 2011 09:42:30 -0000 Author: attilio Date: Tue Aug 23 09:42:29 2011 New Revision: 225105 URL: http://svn.freebsd.org/changeset/base/225105 Log: MFC r225009: Bump coretemp tollerable limit to 110 degrees. Sponsored by: Sandvine Incorporated Modified: stable/8/sys/dev/coretemp/coretemp.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/coretemp/coretemp.c ============================================================================== --- stable/8/sys/dev/coretemp/coretemp.c Tue Aug 23 08:47:27 2011 (r225104) +++ stable/8/sys/dev/coretemp/coretemp.c Tue Aug 23 09:42:29 2011 (r225105) @@ -225,12 +225,12 @@ coretemp_attach(device_t dev) * these numbers are, with the publicly available * documents from Intel. * - * For now, we consider [70, 100]C range, as + * For now, we consider [70, 110]C range, as * described in #322683, as "reasonable" and accept * these values whenever the MSR is available for * read, regardless the CPU model. */ - if (tjtarget >= 70 && tjtarget <= 100) + if (tjtarget >= 70 && tjtarget <= 110) sc->sc_tjmax = tjtarget; else device_printf(dev, "Tj(target) value %d " From owner-svn-src-stable-8@FreeBSD.ORG Tue Aug 23 14:00:01 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AAA5D106566C; Tue, 23 Aug 2011 14:00:01 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 795AE8FC08; Tue, 23 Aug 2011 14:00:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7NE01KQ005624; Tue, 23 Aug 2011 14:00:01 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7NE01Cx005621; Tue, 23 Aug 2011 14:00:01 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201108231400.p7NE01Cx005621@svn.freebsd.org> From: Marius Strobl Date: Tue, 23 Aug 2011 14:00:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225114 - stable/8/sys/dev/mii X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 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, 23 Aug 2011 14:00:01 -0000 Author: marius Date: Tue Aug 23 14:00:01 2011 New Revision: 225114 URL: http://svn.freebsd.org/changeset/base/225114 Log: MFC: r223688 Add detection for the Marvel 88E1149R and treat it just like the 88E1149. Modified: stable/8/sys/dev/mii/e1000phy.c stable/8/sys/dev/mii/miidevs Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/mii/e1000phy.c ============================================================================== --- stable/8/sys/dev/mii/e1000phy.c Tue Aug 23 13:44:56 2011 (r225113) +++ stable/8/sys/dev/mii/e1000phy.c Tue Aug 23 14:00:01 2011 (r225114) @@ -107,6 +107,7 @@ static const struct mii_phydesc e1000phy MII_PHY_DESC(MARVELL, E1116), MII_PHY_DESC(MARVELL, E1116R), MII_PHY_DESC(MARVELL, E1118), + MII_PHY_DESC(MARVELL, E1149R), MII_PHY_DESC(MARVELL, E3016), MII_PHY_DESC(MARVELL, PHYG65G), MII_PHY_DESC(xxMARVELL, E1000), @@ -161,6 +162,7 @@ e1000phy_attach(device_t dev) sc->mii_flags |= MIIF_HAVEFIBER; break; case MII_MODEL_MARVELL_E1149: + case MII_MODEL_MARVELL_E1149R: /* * Some 88E1149 PHY's page select is initialized to * point to other bank instead of copper/fiber bank @@ -224,6 +226,7 @@ e1000phy_reset(struct mii_softc *sc) case MII_MODEL_MARVELL_E1116: case MII_MODEL_MARVELL_E1118: case MII_MODEL_MARVELL_E1149: + case MII_MODEL_MARVELL_E1149R: case MII_MODEL_MARVELL_PHYG65G: /* Disable energy detect mode. */ reg &= ~E1000_SCR_EN_DETECT_MASK; @@ -256,7 +259,8 @@ e1000phy_reset(struct mii_softc *sc) PHY_WRITE(sc, E1000_SCR, reg); if (esc->mii_model == MII_MODEL_MARVELL_E1116 || - esc->mii_model == MII_MODEL_MARVELL_E1149) { + esc->mii_model == MII_MODEL_MARVELL_E1149 || + esc->mii_model == MII_MODEL_MARVELL_E1149R) { PHY_WRITE(sc, E1000_EADR, 2); reg = PHY_READ(sc, E1000_SCR); reg |= E1000_SCR_RGMII_POWER_UP; Modified: stable/8/sys/dev/mii/miidevs ============================================================================== --- stable/8/sys/dev/mii/miidevs Tue Aug 23 13:44:56 2011 (r225113) +++ stable/8/sys/dev/mii/miidevs Tue Aug 23 14:00:01 2011 (r225114) @@ -257,6 +257,7 @@ model MARVELL E1111 0x000c Marvell 88E1 model MARVELL E1116 0x0021 Marvell 88E1116 Gigabit PHY model MARVELL E1116R 0x0024 Marvell 88E1116R Gigabit PHY model MARVELL E1118 0x0022 Marvell 88E1118 Gigabit PHY +model MARVELL E1149R 0x0025 Marvell 88E1149R Quad Gigabit PHY model MARVELL E3016 0x0026 Marvell 88E3016 10/100 Fast Ethernet PHY model MARVELL PHYG65G 0x0027 Marvell PHYG65G Gigabit PHY model xxMARVELL E1000 0x0005 Marvell 88E1000 Gigabit PHY From owner-svn-src-stable-8@FreeBSD.ORG Tue Aug 23 14:32:54 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B8201065676; Tue, 23 Aug 2011 14:32:54 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 515818FC18; Tue, 23 Aug 2011 14:32:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7NEWsNG007454; Tue, 23 Aug 2011 14:32:54 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7NEWsEq007451; Tue, 23 Aug 2011 14:32:54 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201108231432.p7NEWsEq007451@svn.freebsd.org> From: Marius Strobl Date: Tue, 23 Aug 2011 14:32:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225116 - stable/8/sys/dev/mii X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 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, 23 Aug 2011 14:32:54 -0000 Author: marius Date: Tue Aug 23 14:32:53 2011 New Revision: 225116 URL: http://svn.freebsd.org/changeset/base/225116 Log: MFC: r225014 r221812 (MFC'ed to stable/8 in r222159) reveals that at least some Broadcom PHYs default to being not only isolated but also powered down after a reset and while they just work fine [sic] when both is the case they don't if they are only deisolate but still powered down. So in order to put PHYs in an overall normal operation mode for the common case, ensure in mii_phy_reset() that they are not powered down after a reset. Unfortunately, this only helps in case of BCM5421, while BCM5709S apparently only work when they remain isolated and powered down after a reset. So don't call mii_phy_reset() in brgphy_reset() and implement the reset locally leaving the problematic bits alone. Effectively this bypasses r221812 for brgphy(4). Thanks to Justin Hibbits for doing a binary search in order to identify the problematic commit. PR: 157405, 158156 Reviewed by: yongari (mii_phy_reset() part) Modified: stable/8/sys/dev/mii/brgphy.c stable/8/sys/dev/mii/mii_physubr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/mii/brgphy.c ============================================================================== --- stable/8/sys/dev/mii/brgphy.c Tue Aug 23 14:01:04 2011 (r225115) +++ stable/8/sys/dev/mii/brgphy.c Tue Aug 23 14:32:53 2011 (r225116) @@ -913,10 +913,22 @@ brgphy_reset(struct mii_softc *sc) struct bge_softc *bge_sc = NULL; struct bce_softc *bce_sc = NULL; struct ifnet *ifp; - int val; + int i, val; - /* Perform a standard PHY reset. */ - mii_phy_reset(sc); + /* + * Perform a reset. Note that at least some Broadcom PHYs default to + * being powered down as well as isolated after a reset but don't work + * if one or both of these bits are cleared. However, they just work + * fine if both bits remain set, so we don't use mii_phy_reset() here. + */ + PHY_WRITE(sc, BRGPHY_MII_BMCR, BRGPHY_BMCR_RESET); + + /* Wait 100ms for it to complete. */ + for (i = 0; i < 100; i++) { + if ((PHY_READ(sc, BRGPHY_MII_BMCR) & BRGPHY_BMCR_RESET) == 0) + break; + DELAY(1000); + } /* Handle any PHY specific procedures following the reset. */ switch (bsc->mii_oui) { Modified: stable/8/sys/dev/mii/mii_physubr.c ============================================================================== --- stable/8/sys/dev/mii/mii_physubr.c Tue Aug 23 14:01:04 2011 (r225115) +++ stable/8/sys/dev/mii/mii_physubr.c Tue Aug 23 14:32:53 2011 (r225116) @@ -276,8 +276,8 @@ mii_phy_reset(struct mii_softc *sc) DELAY(1000); } - /* NB: a PHY may default to isolation. */ - reg &= ~BMCR_ISO; + /* NB: a PHY may default to being powered down and/or isolated. */ + reg &= ~(BMCR_PDOWN | BMCR_ISO); if ((sc->mii_flags & MIIF_NOISOLATE) == 0 && ((ife == NULL && sc->mii_inst != 0) || (ife != NULL && IFM_INST(ife->ifm_media) != sc->mii_inst))) From owner-svn-src-stable-8@FreeBSD.ORG Tue Aug 23 14:37:39 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 904DF106566B; Tue, 23 Aug 2011 14:37:39 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7FFC58FC16; Tue, 23 Aug 2011 14:37:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7NEbdbr007759; Tue, 23 Aug 2011 14:37:39 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7NEbdFA007757; Tue, 23 Aug 2011 14:37:39 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201108231437.p7NEbdFA007757@svn.freebsd.org> From: Marius Strobl Date: Tue, 23 Aug 2011 14:37:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225118 - stable/8/sys/dev/gem X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 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, 23 Aug 2011 14:37:39 -0000 Author: marius Date: Tue Aug 23 14:37:39 2011 New Revision: 225118 URL: http://svn.freebsd.org/changeset/base/225118 Log: MFC: r225015 Revert r224157 (MFC'ed to stable/8 in r224401), re-enabling r222135 (MFC'ed to stable/8 in r222371). The underlying problem keeping the latter from working as expected was fixed in r225014 (MFC'ed to stable/8 in r225116). Modified: stable/8/sys/dev/gem/if_gem.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/gem/if_gem.c ============================================================================== --- stable/8/sys/dev/gem/if_gem.c Tue Aug 23 14:32:59 2011 (r225117) +++ stable/8/sys/dev/gem/if_gem.c Tue Aug 23 14:37:39 2011 (r225118) @@ -947,10 +947,8 @@ gem_init_locked(struct gem_softc *sc) GEM_LOCK_ASSERT(sc, MA_OWNED); -#ifdef notyet if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) return; -#endif #ifdef GEM_DEBUG CTR2(KTR_GEM, "%s: %s: calling stop", device_get_name(sc->sc_dev), From owner-svn-src-stable-8@FreeBSD.ORG Fri Aug 26 04:58:33 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2BE2106564A; Fri, 26 Aug 2011 04:58:33 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B1D108FC08; Fri, 26 Aug 2011 04:58:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7Q4wXi6034543; Fri, 26 Aug 2011 04:58:33 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7Q4wXpY034541; Fri, 26 Aug 2011 04:58:33 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201108260458.p7Q4wXpY034541@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 26 Aug 2011 04:58:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225185 - stable/8/sbin/geom/class/part X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 26 Aug 2011 04:58:33 -0000 Author: ae Date: Fri Aug 26 04:58:33 2011 New Revision: 225185 URL: http://svn.freebsd.org/changeset/base/225185 Log: MFC r225003: Add new section "BOOTSTRAPPING" to the gpart(8), that describes bootstrap code images used to boot from MBR, GPT, BSD and VTOC8 schemes. MFC r225023: o Fix mdoc formatting for the '.Fx' macro. [1] o Add information about APM scheme and fix typos. [2] Submitted by: gjb [1], nwhitehorn [2] Modified: stable/8/sbin/geom/class/part/gpart.8 Directory Properties: stable/8/sbin/geom/class/part/ (props changed) Modified: stable/8/sbin/geom/class/part/gpart.8 ============================================================================== --- stable/8/sbin/geom/class/part/gpart.8 Thu Aug 25 21:20:11 2011 (r225184) +++ stable/8/sbin/geom/class/part/gpart.8 Fri Aug 26 04:58:33 2011 (r225185) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 6, 2011 +.Dd August 19, 2011 .Dt GPART 8 .Os .Sh NAME @@ -255,29 +255,21 @@ and .Fl i Ar index ) . Not all partitioning schemes have embedded bootstrap code, so the .Fl b Ar bootcode -option is scheme-specific in nature. -For the GPT scheme, embedded bootstrap code is supported. -The bootstrap code is embedded in the protective MBR rather than the GPT. +option is scheme-specific in nature (see the section entitled +.Sx BOOTSTRAPPING +below). The .Fl b Ar bootcode option specifies a file that contains the bootstrap code. The contents and size of the file are determined by the partitioning scheme. -For the MBR scheme, it is a 512 byte file of which the first 446 bytes -are installed as bootstrap code. The .Fl p Ar partcode option specifies a file that contains the bootstrap code intended to be written to a partition. -For the VTOC8 scheme, it is a 8192 byte file of which the last 7680 bytes -are installed as bootstrap code. The partition is specified by the .Fl i Ar index option. -For the VTOC8 scheme, if the -.Fl i Ar index -option is omitted, the bootstrap code is written to all sufficiently large -partitions. The size of the file must be smaller than the size of the partition. .Pp Additional options include: @@ -711,6 +703,101 @@ The scheme-specific attributes for PC98: .It Ar active .It Ar bootable .El +.Sh BOOTSTRAPPING +.Fx +supports several partitioning schemes and each scheme uses different +bootstrap code. +The bootstrap code is located in the specific disk area for each partitioning +scheme and also it might have different size. +.Pp +The bootstrap code could be separated into two types. +The first one is embedded in the partitioning scheme's metadata, the second +type is located on the specific partition. +The embedding bootstrap code should be done only with the +.Cm gpart bootcode +command with +.Fl b Ar bootcode +option. +The GEOM PART class has knowlege on how to embed bootstrap code into specific +partitioning scheme metadata without damage. +.Pp +The Master Boot Record (MBR) uses 512-bytes bootstrap code image, embedded into +partition table's metadata area. +There are two variants of this bootstrap code: +.Pa /boot/mbr +and +.Pa /boot/boot0 . +The first one searches partition with +.Cm active +attribute (see the +.Sx ATTRIBUTES +section) in the partition table. +Then it runs next bootstrap stage. +The +.Pa /boot/boot0 +image contains a boot manager with some additional interactive functions. +.Pp +The BSD disklabel is usually created on top of the MBR partition (slice) +with type +.Cm freebsd +(see the +.Sx "PARTITION TYPES" +section). +It uses 8 KB size bootstrap code image +.Pa /boot/boot , +embedded into partition table's metadata area. +.Pp +Both types of bootstrap code are used to boot from the GUID Partition Table. +First of all, a protective MBR is embedded into first disk sector from the +.Pa /boot/pmbr +image. +It searches the +.Cm freebsd-boot +partition (see the +.Sx "PARTITION TYPES" +section) in the GPT and runs next bootstrap stage from it. +The +.Cm freebsd-boot +partition should be smaller than 545 KB. +There are two variants of bootstrap code to write to this partition: +.Pa /boot/gptboot +and +.Pa /boot/gptzfsboot . +The first one is used to boot from UFS. +It searches in the GPT partition with type +.Cm freebsd-ufs , +and it runs the third bootstrap stage ( +.Pa /boot/loader ) +if it is found. +The +.Pa /boot/gptzfsboot +is used to boot from ZFS. +It searches partition with type +.Cm freebsd-zfs +and starts +.Pa /boot/zfsloader +from it. +.Pp +The VTOC8 scheme does not support embedding bootstrap code. +Instead, the 8 KBytes bootstrap code image +.Pa /boot/boot1 +should be written with +.Cm gpart bootcode +command with +.Fl p Ar bootcode +option to all sufficiently large VTOC8 partitions. +To do this the +.Fl i Ar index +option could be ommited. +.Pp +The APM scheme also does not support embedding bootstrap code. +Instead, the 800 KBytes bootstrap code image +.Pa /boot/boot1.hfs +should be written with +.Cm gpart bootcode +command to a partition of type +.Cm freebsd-boot , +which should also be 800 KB in size. .Sh OPERATIONAL FLAGS Actions other than the .Cm commit @@ -889,6 +976,7 @@ and .Sh SEE ALSO .Xr dd 1 , .Xr geom 4 , +.Xr boot0cfg 8 , .Xr geom 8 .Sh HISTORY The From owner-svn-src-stable-8@FreeBSD.ORG Fri Aug 26 07:38:40 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F21F2106566B; Fri, 26 Aug 2011 07:38:40 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E12508FC18; Fri, 26 Aug 2011 07:38:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7Q7ceDG040469; Fri, 26 Aug 2011 07:38:40 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7Q7cetT040467; Fri, 26 Aug 2011 07:38:40 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201108260738.p7Q7cetT040467@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 26 Aug 2011 07:38:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225186 - stable/8/sys/dev/usb X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 26 Aug 2011 07:38:41 -0000 Author: hselasky Date: Fri Aug 26 07:38:40 2011 New Revision: 225186 URL: http://svn.freebsd.org/changeset/base/225186 Log: MFC r225000: USB clear stall fix for VM's. Modified: stable/8/sys/dev/usb/usb_request.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/usb/usb_request.c ============================================================================== --- stable/8/sys/dev/usb/usb_request.c Fri Aug 26 04:58:33 2011 (r225185) +++ stable/8/sys/dev/usb/usb_request.c Fri Aug 26 07:38:40 2011 (r225186) @@ -67,6 +67,11 @@ #include #include +static int usb_no_cs_fail; + +SYSCTL_INT(_hw_usb, OID_AUTO, no_cs_fail, CTLFLAG_RW, + &usb_no_cs_fail, 0, "USB clear stall failures are ignored, if set"); + #ifdef USB_DEBUG static int usb_pr_poll_delay = USB_PORT_RESET_DELAY; static int usb_pr_recovery_delay = USB_PORT_RESET_RECOVERY; @@ -238,7 +243,7 @@ usb_do_clear_stall_callback(struct usb_x switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - +tr_transferred: /* reset error counter */ udev->clear_stall_errors = 0; @@ -297,6 +302,13 @@ tr_setup: break; DPRINTF("Clear stall failed.\n"); + + /* + * Some VMs like VirtualBox always return failure on + * clear-stall which we sometimes should just ignore. + */ + if (usb_no_cs_fail) + goto tr_transferred; if (udev->clear_stall_errors == USB_CS_RESET_LIMIT) goto tr_setup; From owner-svn-src-stable-8@FreeBSD.ORG Fri Aug 26 10:39:33 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 990FD106566C; Fri, 26 Aug 2011 10:39:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 886868FC1E; Fri, 26 Aug 2011 10:39:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7QAdXg5050817; Fri, 26 Aug 2011 10:39:33 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7QAdXe5050815; Fri, 26 Aug 2011 10:39:33 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108261039.p7QAdXe5050815@svn.freebsd.org> From: Alexander Motin Date: Fri, 26 Aug 2011 10:39:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225188 - stable/8/sbin/camcontrol X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 26 Aug 2011 10:39:33 -0000 Author: mav Date: Fri Aug 26 10:39:33 2011 New Revision: 225188 URL: http://svn.freebsd.org/changeset/base/225188 Log: MFC r225018: Fix WWN printing in `camcontrol identify` output. Modified: stable/8/sbin/camcontrol/camcontrol.c Directory Properties: stable/8/sbin/camcontrol/ (props changed) Modified: stable/8/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/8/sbin/camcontrol/camcontrol.c Fri Aug 26 08:46:59 2011 (r225187) +++ stable/8/sbin/camcontrol/camcontrol.c Fri Aug 26 10:39:33 2011 (r225188) @@ -1082,7 +1082,7 @@ atacapprint(struct ata_params *parm) printf("firmware revision %.8s\n", parm->revision); printf("serial number %.20s\n", parm->serial); if (parm->enabled.extension & ATA_SUPPORT_64BITWWN) { - printf("WWN %02x%02x%02x%02x\n", + printf("WWN %04x%04x%04x%04x\n", parm->wwn[0], parm->wwn[1], parm->wwn[2], parm->wwn[3]); } if (parm->enabled.extension & ATA_SUPPORT_MEDIASN) { From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 27 14:03:27 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C14DB1065670; Sat, 27 Aug 2011 14:03:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF66A8FC19; Sat, 27 Aug 2011 14:03:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7RE3RLc006313; Sat, 27 Aug 2011 14:03:27 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7RE3RjU006308; Sat, 27 Aug 2011 14:03:27 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201108271403.p7RE3RjU006308@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 27 Aug 2011 14:03:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225213 - in stable/8: share/man/man4 sys/dev/usb sys/dev/usb/net sys/dev/usb/serial X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 27 Aug 2011 14:03:28 -0000 Author: hselasky Date: Sat Aug 27 14:03:27 2011 New Revision: 225213 URL: http://svn.freebsd.org/changeset/base/225213 Log: MFC r225037 and r225041: Add new USB IDs. PR: usb/159919, usb/159836 Modified: stable/8/share/man/man4/uhso.4 stable/8/sys/dev/usb/net/uhso.c stable/8/sys/dev/usb/serial/u3g.c stable/8/sys/dev/usb/usbdevs Directory Properties: stable/8/share/man/man4/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/share/man/man4/uhso.4 ============================================================================== --- stable/8/share/man/man4/uhso.4 Sat Aug 27 13:05:38 2011 (r225212) +++ stable/8/share/man/man4/uhso.4 Sat Aug 27 14:03:27 2011 (r225213) @@ -79,6 +79,8 @@ The following devices have been verified .It Option GlobeSurfer iCON 7.2 (new firmware) .It +Option GlobeTrotter Max 7.2 (new firmware) +.It Option iCON 225 .It Option iCON 452 Modified: stable/8/sys/dev/usb/net/uhso.c ============================================================================== --- stable/8/sys/dev/usb/net/uhso.c Sat Aug 27 13:05:38 2011 (r225212) +++ stable/8/sys/dev/usb/net/uhso.c Sat Aug 27 14:03:27 2011 (r225213) @@ -249,6 +249,8 @@ static struct unrhdr *uhso_ifnet_unit = static const STRUCT_USB_HOST_ID uhso_devs[] = { #define UHSO_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } + /* Option GlobeTrotter MAX 7.2 with upgraded firmware */ + UHSO_DEV(OPTION, GTMAX72, UHSO_STATIC_IFACE), /* Option GlobeSurfer iCON 7.2 */ UHSO_DEV(OPTION, GSICON72, UHSO_STATIC_IFACE), /* Option iCON 225 */ Modified: stable/8/sys/dev/usb/serial/u3g.c ============================================================================== --- stable/8/sys/dev/usb/serial/u3g.c Sat Aug 27 13:05:38 2011 (r225212) +++ stable/8/sys/dev/usb/serial/u3g.c Sat Aug 27 14:03:27 2011 (r225213) @@ -280,6 +280,8 @@ static const STRUCT_USB_HOST_ID u3g_devs U3G_DEV(HUAWEI, E143D, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E143E, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E143F, U3GINIT_HUAWEI), + U3G_DEV(HUAWEI, E173, 0), + U3G_DEV(HUAWEI, E173_INIT, U3GINIT_HUAWEISCSI), U3G_DEV(HUAWEI, E180V, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E220, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E220BIS, U3GINIT_HUAWEI), Modified: stable/8/sys/dev/usb/usbdevs ============================================================================== --- stable/8/sys/dev/usb/usbdevs Sat Aug 27 13:05:38 2011 (r225212) +++ stable/8/sys/dev/usb/usbdevs Sat Aug 27 14:03:27 2011 (r225213) @@ -1872,6 +1872,8 @@ product HUAWEI E1752 0x1446 3G modem product HUAWEI K3765 0x1465 3G modem product HUAWEI E1820 0x14ac E1820 HSPA+ USB Slider product HUAWEI K3765_INIT 0x1520 K3765 Initial +product HUAWEI E173 0x1c05 3G modem +product HUAWEI E173_INIT 0x1c0b 3G modem initial /* HUAWEI 3com products */ product HUAWEI3COM WUB320G 0x0009 Aolynk WUB320g @@ -2445,6 +2447,7 @@ product OPTION GT3GQUAD 0x6300 GlobeTro product OPTION GT3GPLUS 0x6600 GlobeTrotter 3G+ datacard product OPTION GTICON322 0xd033 GlobeTrotter Icon322 storage product OPTION GTMAX36 0x6701 GlobeTrotter Max 3.6 Modem +product OPTION GTMAX72 0x6711 GlobeTrotter Max 7.2 HSDPA product OPTION GTHSDPA 0x6971 GlobeTrotter HSDPA product OPTION GTMAXHSUPA 0x7001 GlobeTrotter HSUPA product OPTION GTMAXHSUPAE 0x6901 GlobeTrotter HSUPA PCIe