From owner-svn-src-stable-8@FreeBSD.ORG Sun Jun 3 09:37:48 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1F7711065886; Sun, 3 Jun 2012 09:37:48 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 085608FC12; Sun, 3 Jun 2012 09:37:48 +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 q539blVo048288; Sun, 3 Jun 2012 09:37:47 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q539bl9k048285; Sun, 3 Jun 2012 09:37:47 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201206030937.q539bl9k048285@svn.freebsd.org> From: Martin Matuska Date: Sun, 3 Jun 2012 09:37:47 +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: r236506 - in stable/8: cddl/contrib/opensolaris/cmd/zpool sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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, 03 Jun 2012 09:37:48 -0000 Author: mm Date: Sun Jun 3 09:37:47 2012 New Revision: 236506 URL: http://svn.freebsd.org/changeset/base/236506 Log: MFC r236145, r236146: MFC r236145 [1]: Import illumos changeset 13564:cf89c0c60496 1946 incorrect formatting when listing output of multiple pools with zpool iostat -v MFC r236146 [2]: Import illumos changeset 13605:b5c2b5db80d6 (partial) 763 FMD msg URLs should refer to something visible Replace sun.com URL's with illumos.org References: https://www.illumos.org/issues/1946 [1] https://www.illumos.org/issues/763 [2] Obtained from: illumos (issue #1946 [1], #763 [2]) Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/sys/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sun Jun 3 09:37:27 2012 (r236505) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sun Jun 3 09:37:47 2012 (r236506) @@ -23,6 +23,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Frederik Wessels. All rights reserved. * Copyright (c) 2011 Martin Matuska . All rights reserved. */ @@ -1616,7 +1617,7 @@ show_import(nvlist_t *config) } if (msgid != NULL) - (void) printf(gettext(" see: http://www.sun.com/msg/%s\n"), + (void) printf(gettext(" see: http://illumos.org/msg/%s\n"), msgid); (void) printf(gettext(" config:\n\n")); @@ -2351,7 +2352,8 @@ get_namewidth(zpool_handle_t *zhp, void if (!cb->cb_verbose) cb->cb_namewidth = strlen(zpool_get_name(zhp)); else - cb->cb_namewidth = max_width(zhp, nvroot, 0, 0); + cb->cb_namewidth = max_width(zhp, nvroot, 0, + cb->cb_namewidth); } /* @@ -3683,7 +3685,7 @@ print_dedup_stats(nvlist_t *config) * pool: tank * status: DEGRADED * reason: One or more devices ... - * see: http://www.sun.com/msg/ZFS-xxxx-01 + * see: http://illumos.org/msg/ZFS-xxxx-01 * config: * mirror DEGRADED * c1t0d0 OK @@ -3891,7 +3893,7 @@ status_callback(zpool_handle_t *zhp, voi } if (msgid != NULL) - (void) printf(gettext(" see: http://www.sun.com/msg/%s\n"), + (void) printf(gettext(" see: http://illumos.org/msg/%s\n"), msgid); if (config != NULL) { Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sun Jun 3 09:37:27 2012 (r236505) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sun Jun 3 09:37:47 2012 (r236506) @@ -2050,7 +2050,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_ cmn_err(CE_WARN, "pool '%s' could not be " "loaded as it was last accessed by " "another system (host: %s hostid: 0x%lx). " - "See: http://www.sun.com/msg/ZFS-8000-EY", + "See: http://illumos.org/msg/ZFS-8000-EY", spa_name(spa), hostname, (unsigned long)hostid); return (EBADF); From owner-svn-src-stable-8@FreeBSD.ORG Sun Jun 3 11:31:45 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ABA7D106566B; Sun, 3 Jun 2012 11:31:45 +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 969C78FC1B; Sun, 3 Jun 2012 11:31:45 +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 q53BVjki058409; Sun, 3 Jun 2012 11:31:45 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q53BVjw9058407; Sun, 3 Jun 2012 11:31:45 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201206031131.q53BVjw9058407@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 3 Jun 2012 11:31:45 +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: r236510 - stable/8/lib/libfetch 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, 03 Jun 2012 11:31:45 -0000 Author: jilles Date: Sun Jun 3 11:31:45 2012 New Revision: 236510 URL: http://svn.freebsd.org/changeset/base/236510 Log: MFC r236193: libfetch: Avoid SIGPIPE on network connections. To avoid unexpected process termination from SIGPIPE when writing to a closed network connection, enable SO_NOSIGPIPE on all network connections. The POSIX standard MSG_NOSIGNAL is not used since it requires modifying all send calls to add this flag. This is particularly nasty for SSL connections. Modified: stable/8/lib/libfetch/common.c Directory Properties: stable/8/lib/libfetch/ (props changed) Modified: stable/8/lib/libfetch/common.c ============================================================================== --- stable/8/lib/libfetch/common.c Sun Jun 3 11:29:48 2012 (r236509) +++ stable/8/lib/libfetch/common.c Sun Jun 3 11:31:45 2012 (r236510) @@ -209,11 +209,13 @@ conn_t * fetch_reopen(int sd) { conn_t *conn; + int opt = 1; /* allocate and fill connection structure */ if ((conn = calloc(1, sizeof(*conn))) == NULL) return (NULL); fcntl(sd, F_SETFD, FD_CLOEXEC); + setsockopt(sd, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof opt); conn->sd = sd; ++conn->ref; return (conn); From owner-svn-src-stable-8@FreeBSD.ORG Sun Jun 3 18:05:20 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 556F4106566B; Sun, 3 Jun 2012 18:05:20 +0000 (UTC) (envelope-from rea@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3EF598FC0C; Sun, 3 Jun 2012 18:05:20 +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 q53I5JKH076241; Sun, 3 Jun 2012 18:05:19 GMT (envelope-from rea@svn.freebsd.org) Received: (from rea@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q53I5Jaq076235; Sun, 3 Jun 2012 18:05:19 GMT (envelope-from rea@svn.freebsd.org) Message-Id: <201206031805.q53I5Jaq076235@svn.freebsd.org> From: Eygene Ryabinkin Date: Sun, 3 Jun 2012 18:05:19 +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: r236521 - stable/8/crypto/openssh 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, 03 Jun 2012 18:05:20 -0000 Author: rea (ports committer) Date: Sun Jun 3 18:05:19 2012 New Revision: 236521 URL: http://svn.freebsd.org/changeset/base/236521 Log: OpenSSH: allow VersionAddendum to be used again Prior to this, setting VersionAddendum will be a no-op: one will always have BASE_VERSION + " " + VERSION_HPN for VersionAddendum set in the config and a bare BASE_VERSION + VERSION_HPN when there is no VersionAddendum is set. HPN patch requires both parties to have the "hpn" inside their advertized versions, so we add VERSION_HPN to the VERSION_BASE if HPN is enabled and omitting it if HPN is disabled. VersionAddendum now uses the following logics: * unset (default value): append " " and VERSION_ADDENDUM; * VersionAddendum is set and isn't empty: append " " and VersionAddendum; * VersionAddendum is set and empty: don't append anything. Approved by: des Reviewed by: bz Modified: stable/8/crypto/openssh/ssh.c stable/8/crypto/openssh/sshconnect.c stable/8/crypto/openssh/sshd.c stable/8/crypto/openssh/version.c stable/8/crypto/openssh/version.h Directory Properties: stable/8/crypto/openssh/ (props changed) Modified: stable/8/crypto/openssh/ssh.c ============================================================================== --- stable/8/crypto/openssh/ssh.c Sun Jun 3 18:00:38 2012 (r236520) +++ stable/8/crypto/openssh/ssh.c Sun Jun 3 18:05:19 2012 (r236521) @@ -388,7 +388,8 @@ main(int ac, char **av) /* FALLTHROUGH */ case 'V': fprintf(stderr, "%s, %s\n", - SSH_RELEASE, SSLeay_version(SSLEAY_VERSION)); + ssh_version_get(options.hpn_disabled), + SSLeay_version(SSLEAY_VERSION)); if (opt == 'V') exit(0); break; Modified: stable/8/crypto/openssh/sshconnect.c ============================================================================== --- stable/8/crypto/openssh/sshconnect.c Sun Jun 3 18:00:38 2012 (r236520) +++ stable/8/crypto/openssh/sshconnect.c Sun Jun 3 18:05:19 2012 (r236521) @@ -571,7 +571,7 @@ ssh_exchange_identification(int timeout_ snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s%s", compat20 ? PROTOCOL_MAJOR_2 : PROTOCOL_MAJOR_1, compat20 ? PROTOCOL_MINOR_2 : minor1, - SSH_RELEASE, compat20 ? "\r\n" : "\n"); + ssh_version_get(options.hpn_disabled), compat20 ? "\r\n" : "\n"); if (roaming_atomicio(vwrite, connection_out, buf, strlen(buf)) != strlen(buf)) fatal("write: %.100s", strerror(errno)); Modified: stable/8/crypto/openssh/sshd.c ============================================================================== --- stable/8/crypto/openssh/sshd.c Sun Jun 3 18:00:38 2012 (r236520) +++ stable/8/crypto/openssh/sshd.c Sun Jun 3 18:05:19 2012 (r236521) @@ -431,7 +431,7 @@ sshd_exchange_identification(int sock_in minor = PROTOCOL_MINOR_1; } snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s%s", major, minor, - SSH_RELEASE, newline); + ssh_version_get(options.hpn_disabled), newline); server_version_string = xstrdup(buf); /* Send our protocol version identification. */ @@ -860,7 +860,7 @@ static void usage(void) { fprintf(stderr, "%s, %s\n", - SSH_RELEASE, SSLeay_version(SSLEAY_VERSION)); + ssh_version_get(0), SSLeay_version(SSLEAY_VERSION)); fprintf(stderr, "usage: sshd [-46DdeiqTt] [-b bits] [-C connection_spec] [-c host_cert_file]\n" " [-f config_file] [-g login_grace_time] [-h host_key_file]\n" @@ -1550,7 +1550,7 @@ main(int ac, char **av) exit(1); } - debug("sshd version %.100s", SSH_RELEASE); + debug("sshd version %.100s", ssh_version_get(options.hpn_disabled)); /* Store privilege separation user for later use if required. */ if ((privsep_pw = getpwnam(SSH_PRIVSEP_USER)) == NULL) { Modified: stable/8/crypto/openssh/version.c ============================================================================== --- stable/8/crypto/openssh/version.c Sun Jun 3 18:00:38 2012 (r236520) +++ stable/8/crypto/openssh/version.c Sun Jun 3 18:05:19 2012 (r236521) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2001 Brian Fundakowski Feldman + * Copyright (c) 2012 Eygene Ryabinkin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,30 +36,60 @@ __RCSID("$FreeBSD$"); static char *version = NULL; +/* NULL means "use default value", empty string means "unset" */ +static const char *addendum = NULL; +static unsigned char update_version = 1; +/* + * Constructs the version string if it is empty or needs updating. + * + * HPN patch we're running requires both parties + * to have the "hpn" string inside the advertized version + * (see compat.c::compat_datafellows), so we should + * include it to the generated string if HPN is enabled. + */ const char * -ssh_version_get(void) { +ssh_version_get(int hpn_disabled) +{ + const char *hpn = NULL, *add = NULL; + char *newvers = NULL; + size_t size = 0; + + if (version != NULL && !update_version) + return (version); + + hpn = (hpn_disabled ? NULL : SSH_VERSION_HPN); + add = (addendum == NULL ? SSH_VERSION_ADDENDUM : + (addendum[0] == '\0' ? NULL : addendum)); + + size = strlen(SSH_VERSION_BASE) + (hpn ? strlen(hpn) : 0) + + (add ? strlen(add) + 1 : 0) + 1; + newvers = xmalloc(size); + strcpy(newvers, SSH_VERSION_BASE); + if (hpn) + strcat(newvers, hpn); + if (add) { + strcat(newvers, " "); + strcat(newvers, add); + } + + if (version) + xfree(version); + version = newvers; + update_version = 0; - if (version == NULL) - version = xstrdup(SSH_VERSION); return (version); } void -ssh_version_set_addendum(const char *add) { - char *newvers; - size_t size; - - if (add != NULL) { - size = strlen(SSH_VERSION_BASE) + strlen(SSH_VERSION_HPN) + 1 + - strlen(add) + 1; - newvers = xmalloc(size); - snprintf(newvers, size, "%s %s", SSH_VERSION_BASE, - SSH_VERSION_HPN, add); - } else { - newvers = xstrdup(SSH_VERSION_BASE SSH_VERSION_HPN); - } - if (version != NULL) - xfree(version); - version = newvers; +ssh_version_set_addendum(const char *add) +{ + if (add && addendum && !strcmp(add, addendum)) + return; + + if (addendum) + xfree((void *)addendum); + addendum = (add ? xstrdup(add) : xstrdup("")); + + update_version = 1; } Modified: stable/8/crypto/openssh/version.h ============================================================================== --- stable/8/crypto/openssh/version.h Sun Jun 3 18:00:38 2012 (r236520) +++ stable/8/crypto/openssh/version.h Sun Jun 3 18:05:19 2012 (r236521) @@ -1,14 +1,13 @@ /* $OpenBSD: version.h,v 1.57 2010/03/07 22:01:32 djm Exp $ */ /* $FreeBSD$ */ -#ifndef SSH_VERSION +#ifndef _VERSION_H_ +#define _VERSION_H_ #define SSH_VERSION_BASE "OpenSSH_5.4p1" #define SSH_VERSION_ADDENDUM "FreeBSD-20100308" #define SSH_VERSION_HPN "_hpn13v11" -#define SSH_VERSION SSH_VERSION_BASE SSH_VERSION_HPN " " SSH_VERSION_ADDENDUM -#define SSH_RELEASE (ssh_version_get()) -const char *ssh_version_get(void); +const char *ssh_version_get(int hpn_disabled); void ssh_version_set_addendum(const char *); -#endif /* SSH_VERSION */ +#endif /* _VERSION_H_ */ From owner-svn-src-stable-8@FreeBSD.ORG Mon Jun 4 07:05:14 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CBA61106564A; Mon, 4 Jun 2012 07:05:14 +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 AB5EB8FC1C; Mon, 4 Jun 2012 07:05:14 +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 q5475Enl011265; Mon, 4 Jun 2012 07:05:14 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5475E4s011257; Mon, 4 Jun 2012 07:05:14 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206040705.q5475E4s011257@svn.freebsd.org> From: Alexander Motin Date: Mon, 4 Jun 2012 07:05:14 +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: r236542 - in stable/8/sys: cam dev/ahci dev/ata dev/mvs dev/siis 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, 04 Jun 2012 07:05:14 -0000 Author: mav Date: Mon Jun 4 07:05:13 2012 New Revision: 236542 URL: http://svn.freebsd.org/changeset/base/236542 Log: MFC r235333: Add two functions xpt_batch_start() and xpt_batch_done() to the CAM SIM KPI to allow drivers to handle request completion directly without passing them to the CAM SWI thread removing extra context switch. Modify all ATA/SATA drivers to use them. Modified: stable/8/sys/cam/cam_sim.h stable/8/sys/cam/cam_xpt.c stable/8/sys/cam/cam_xpt_sim.h stable/8/sys/dev/ahci/ahci.c stable/8/sys/dev/ata/ata-all.c stable/8/sys/dev/mvs/mvs.c stable/8/sys/dev/siis/siis.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/cam_sim.h ============================================================================== --- stable/8/sys/cam/cam_sim.h Mon Jun 4 07:03:56 2012 (r236541) +++ stable/8/sys/cam/cam_sim.h Mon Jun 4 07:05:13 2012 (r236542) @@ -106,6 +106,7 @@ struct cam_sim { #define CAM_SIM_MPSAFE 0x02 #define CAM_SIM_ON_DONEQ 0x04 #define CAM_SIM_POLLED 0x08 +#define CAM_SIM_BATCH 0x10 struct callout callout; struct cam_devq *devq; /* Device Queue to use for this SIM */ int refcount; /* References to the SIM. */ Modified: stable/8/sys/cam/cam_xpt.c ============================================================================== --- stable/8/sys/cam/cam_xpt.c Mon Jun 4 07:03:56 2012 (r236541) +++ stable/8/sys/cam/cam_xpt.c Mon Jun 4 07:05:13 2012 (r236542) @@ -4250,7 +4250,8 @@ xpt_done(union ccb *done_ccb) TAILQ_INSERT_TAIL(&sim->sim_doneq, &done_ccb->ccb_h, sim_links.tqe); done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX; - if ((sim->flags & (CAM_SIM_ON_DONEQ | CAM_SIM_POLLED)) == 0) { + if ((sim->flags & (CAM_SIM_ON_DONEQ | CAM_SIM_POLLED | + CAM_SIM_BATCH)) == 0) { mtx_lock(&cam_simq_lock); first = TAILQ_EMPTY(&cam_simq); TAILQ_INSERT_TAIL(&cam_simq, sim, links); @@ -4262,6 +4263,25 @@ xpt_done(union ccb *done_ccb) } } +void +xpt_batch_start(struct cam_sim *sim) +{ + + KASSERT((sim->flags & CAM_SIM_BATCH) == 0, ("Batch flag already set")); + sim->flags |= CAM_SIM_BATCH; +} + +void +xpt_batch_done(struct cam_sim *sim) +{ + + KASSERT((sim->flags & CAM_SIM_BATCH) != 0, ("Batch flag was not set")); + sim->flags &= ~CAM_SIM_BATCH; + if (!TAILQ_EMPTY(&sim->sim_doneq) && + (sim->flags & CAM_SIM_ON_DONEQ) == 0) + camisr_runqueue(&sim->sim_doneq); +} + union ccb * xpt_alloc_ccb() { Modified: stable/8/sys/cam/cam_xpt_sim.h ============================================================================== --- stable/8/sys/cam/cam_xpt_sim.h Mon Jun 4 07:03:56 2012 (r236541) +++ stable/8/sys/cam/cam_xpt_sim.h Mon Jun 4 07:05:13 2012 (r236542) @@ -51,6 +51,8 @@ void xpt_release_devq_rl(struct cam_pat u_int count, int run_queue); int xpt_sim_opened(struct cam_sim *sim); void xpt_done(union ccb *done_ccb); +void xpt_batch_start(struct cam_sim *sim); +void xpt_batch_done(struct cam_sim *sim); #endif #endif /* _CAM_CAM_XPT_SIM_H */ Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Mon Jun 4 07:03:56 2012 (r236541) +++ stable/8/sys/dev/ahci/ahci.c Mon Jun 4 07:05:13 2012 (r236542) @@ -1455,7 +1455,9 @@ ahci_ch_intr_locked(void *data) struct ahci_channel *ch = device_get_softc(dev); mtx_lock(&ch->mtx); + xpt_batch_start(ch->sim); ahci_ch_intr(data); + xpt_batch_done(ch->sim); mtx_unlock(&ch->mtx); } Modified: stable/8/sys/dev/ata/ata-all.c ============================================================================== --- stable/8/sys/dev/ata/ata-all.c Mon Jun 4 07:03:56 2012 (r236541) +++ stable/8/sys/dev/ata/ata-all.c Mon Jun 4 07:05:13 2012 (r236542) @@ -543,9 +543,11 @@ ata_interrupt(void *data) struct ata_channel *ch = (struct ata_channel *)data; mtx_lock(&ch->state_mtx); + xpt_batch_start(ch->sim); #endif ata_interrupt_locked(data); #ifdef ATA_CAM + xpt_batch_done(ch->sim); mtx_unlock(&ch->state_mtx); #endif } Modified: stable/8/sys/dev/mvs/mvs.c ============================================================================== --- stable/8/sys/dev/mvs/mvs.c Mon Jun 4 07:03:56 2012 (r236541) +++ stable/8/sys/dev/mvs/mvs.c Mon Jun 4 07:05:13 2012 (r236542) @@ -653,7 +653,9 @@ mvs_ch_intr_locked(void *data) struct mvs_channel *ch = device_get_softc(dev); mtx_lock(&ch->mtx); + xpt_batch_start(ch->sim); mvs_ch_intr(data); + xpt_batch_done(ch->sim); mtx_unlock(&ch->mtx); } Modified: stable/8/sys/dev/siis/siis.c ============================================================================== --- stable/8/sys/dev/siis/siis.c Mon Jun 4 07:03:56 2012 (r236541) +++ stable/8/sys/dev/siis/siis.c Mon Jun 4 07:05:13 2012 (r236542) @@ -835,7 +835,9 @@ siis_ch_intr_locked(void *data) struct siis_channel *ch = device_get_softc(dev); mtx_lock(&ch->mtx); + xpt_batch_start(ch->sim); siis_ch_intr(data); + xpt_batch_done(ch->sim); mtx_unlock(&ch->mtx); } From owner-svn-src-stable-8@FreeBSD.ORG Mon Jun 4 07:08:58 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AD51E106564A; Mon, 4 Jun 2012 07:08:58 +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 97EC68FC14; Mon, 4 Jun 2012 07:08:58 +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 q5478w73011522; Mon, 4 Jun 2012 07:08:58 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5478wal011520; Mon, 4 Jun 2012 07:08:58 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206040708.q5478wal011520@svn.freebsd.org> From: Alexander Motin Date: Mon, 4 Jun 2012 07:08:58 +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: r236544 - stable/8/sys/dev/ata 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, 04 Jun 2012 07:08:58 -0000 Author: mav Date: Mon Jun 4 07:08:58 2012 New Revision: 236544 URL: http://svn.freebsd.org/changeset/base/236544 Log: MFC r236184: Make legacy ATA to not call device_add_child() with unit number but without driver name. Modified: stable/8/sys/dev/ata/ata-all.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/ata/ata-all.c ============================================================================== --- stable/8/sys/dev/ata/ata-all.c Mon Jun 4 07:07:46 2012 (r236543) +++ stable/8/sys/dev/ata/ata-all.c Mon Jun 4 07:08:58 2012 (r236544) @@ -886,7 +886,7 @@ ata_add_child(device_t parent, struct at { device_t child; - if ((child = device_add_child(parent, NULL, unit))) { + if ((child = device_add_child(parent, (unit < 0) ? NULL : "ad", unit))) { device_set_softc(child, atadev); device_quiet(child); atadev->dev = child; From owner-svn-src-stable-8@FreeBSD.ORG Mon Jun 4 22:21:56 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1DC69106564A; Mon, 4 Jun 2012 22:21:56 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0667A8FC08; Mon, 4 Jun 2012 22:21:56 +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 q54MLtn9071221; Mon, 4 Jun 2012 22:21:55 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q54MLtbS071216; Mon, 4 Jun 2012 22:21:55 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201206042221.q54MLtbS071216@svn.freebsd.org> From: Doug Barton Date: Mon, 4 Jun 2012 22:21:55 +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: r236590 - in stable/8/contrib/bind9: . lib/dns 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, 04 Jun 2012 22:21:56 -0000 Author: dougb Date: Mon Jun 4 22:21:55 2012 New Revision: 236590 URL: http://svn.freebsd.org/changeset/base/236590 Log: Upgrade to 9.6-ESV-R7-P1, the latest from ISC. This version contains a critical bugfix: Processing of DNS resource records where the rdata field is zero length may cause various issues for the servers handling them. Processing of these records may lead to unexpected outcomes. Recursive servers may crash or disclose some portion of memory to the client. Secondary servers may crash on restart after transferring a zone containing these records. Master servers may corrupt zone data if the zone option "auto-dnssec" is set to "maintain". Other unexpected problems that are not listed here may also be encountered. All BIND users are strongly encouraged to upgrade. Modified: stable/8/contrib/bind9/CHANGES stable/8/contrib/bind9/lib/dns/rdata.c stable/8/contrib/bind9/lib/dns/rdataslab.c stable/8/contrib/bind9/version Directory Properties: stable/8/contrib/bind9/ (props changed) Modified: stable/8/contrib/bind9/CHANGES ============================================================================== --- stable/8/contrib/bind9/CHANGES Mon Jun 4 22:19:32 2012 (r236589) +++ stable/8/contrib/bind9/CHANGES Mon Jun 4 22:21:55 2012 (r236590) @@ -1,3 +1,8 @@ + --- 9.6-ESV-R7-P1 released --- + +3331. [security] dns_rdataslab_fromrdataset could produce bad + rdataslabs. [RT #29644] + --- 9.6-ESV-R7 released --- 3318. [tuning] Reduce the amount of work performed while holding a Modified: stable/8/contrib/bind9/lib/dns/rdata.c ============================================================================== --- stable/8/contrib/bind9/lib/dns/rdata.c Mon Jun 4 22:19:32 2012 (r236589) +++ stable/8/contrib/bind9/lib/dns/rdata.c Mon Jun 4 22:21:55 2012 (r236590) @@ -345,8 +345,8 @@ dns_rdata_compare(const dns_rdata_t *rda REQUIRE(rdata1 != NULL); REQUIRE(rdata2 != NULL); - REQUIRE(rdata1->data != NULL); - REQUIRE(rdata2->data != NULL); + REQUIRE(rdata1->length == 0 || rdata1->data != NULL); + REQUIRE(rdata2->length == 0 || rdata2->data != NULL); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata1)); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata2)); Modified: stable/8/contrib/bind9/lib/dns/rdataslab.c ============================================================================== --- stable/8/contrib/bind9/lib/dns/rdataslab.c Mon Jun 4 22:19:32 2012 (r236589) +++ stable/8/contrib/bind9/lib/dns/rdataslab.c Mon Jun 4 22:21:55 2012 (r236590) @@ -126,6 +126,11 @@ isc_result_t dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx, isc_region_t *region, unsigned int reservelen) { + /* + * Use &removed as a sentinal pointer for duplicate + * rdata as rdata.data == NULL is valid. + */ + static unsigned char removed; struct xrdata *x; unsigned char *rawbuf; #if DNS_RDATASET_FIXED @@ -165,6 +170,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ INSIST(result == ISC_R_SUCCESS); dns_rdata_init(&x[i].rdata); dns_rdataset_current(rdataset, &x[i].rdata); + INSIST(x[i].rdata.data != &removed); #if DNS_RDATASET_FIXED x[i].order = i; #endif @@ -197,8 +203,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ */ for (i = 1; i < nalloc; i++) { if (compare_rdata(&x[i-1].rdata, &x[i].rdata) == 0) { - x[i-1].rdata.data = NULL; - x[i-1].rdata.length = 0; + x[i-1].rdata.data = &removed; #if DNS_RDATASET_FIXED /* * Preserve the least order so A, B, A -> A, B @@ -285,7 +290,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ #endif for (i = 0; i < nalloc; i++) { - if (x[i].rdata.data == NULL) + if (x[i].rdata.data == &removed) continue; #if DNS_RDATASET_FIXED offsettable[x[i].order] = rawbuf - offsetbase; Modified: stable/8/contrib/bind9/version ============================================================================== --- stable/8/contrib/bind9/version Mon Jun 4 22:19:32 2012 (r236589) +++ stable/8/contrib/bind9/version Mon Jun 4 22:21:55 2012 (r236590) @@ -7,4 +7,4 @@ MAJORVER=9 MINORVER=6 PATCHVER= RELEASETYPE=-ESV -RELEASEVER=-R7 +RELEASEVER=-R7-P1 From owner-svn-src-stable-8@FreeBSD.ORG Tue Jun 5 11:24:06 2012 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 548EB1065670; Tue, 5 Jun 2012 11:24:06 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3EFA78FC12; Tue, 5 Jun 2012 11:24:06 +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 q55BO6W3016311; Tue, 5 Jun 2012 11:24:06 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q55BO62d016309; Tue, 5 Jun 2012 11:24:06 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201206051124.q55BO62d016309@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 5 Jun 2012 11:24:06 +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: r236607 - stable/8/sys/netinet6 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, 05 Jun 2012 11:24:06 -0000 Author: bz Date: Tue Jun 5 11:24:05 2012 New Revision: 236607 URL: http://svn.freebsd.org/changeset/base/236607 Log: MFC r236327 (by emax): When we return deprecated addresses, we need to reference them. Modified: stable/8/sys/netinet6/in6.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet6/in6.c ============================================================================== --- stable/8/sys/netinet6/in6.c Tue Jun 5 11:23:56 2012 (r236606) +++ stable/8/sys/netinet6/in6.c Tue Jun 5 11:24:05 2012 (r236607) @@ -2151,14 +2151,20 @@ in6_ifawithifp(struct ifnet *ifp, struct IF_ADDR_RUNLOCK(ifp); return (struct in6_ifaddr *)ifa; } - IF_ADDR_RUNLOCK(ifp); /* use the last-resort values, that are, deprecated addresses */ - if (dep[0]) + if (dep[0]) { + ifa_ref((struct ifaddr *)dep[0]); + IF_ADDR_RUNLOCK(ifp); return dep[0]; - if (dep[1]) + } + if (dep[1]) { + ifa_ref((struct ifaddr *)dep[1]); + IF_ADDR_RUNLOCK(ifp); return dep[1]; + } + IF_ADDR_RUNLOCK(ifp); return NULL; } From owner-svn-src-stable-8@FreeBSD.ORG Tue Jun 5 11:27:11 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BECBF106566B; Tue, 5 Jun 2012 11:27:11 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A9CE88FC0C; Tue, 5 Jun 2012 11:27:11 +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 q55BRBiI016561; Tue, 5 Jun 2012 11:27:11 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q55BRBtZ016559; Tue, 5 Jun 2012 11:27:11 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201206051127.q55BRBtZ016559@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 5 Jun 2012 11:27:11 +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: r236609 - stable/8/sys/netinet6 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, 05 Jun 2012 11:27:11 -0000 Author: bz Date: Tue Jun 5 11:27:11 2012 New Revision: 236609 URL: http://svn.freebsd.org/changeset/base/236609 Log: MFC r236501 (by emax): Plug reference leak. Interface addresses are refcounted as packets move through the stack, and there's garbage collection tied to it so that address changes can safely propagate while traffic is flowing. In our setup, we weren't changing or deleting any addresses, but the refcounting logic in ip6_input() was wrong and caused a reference leak on every inbound V6 packet. This eventually caused a 32bit overflow, and the resulting 0 value caused the garbage collection to run on the active address. That then snowballed into the panic. Modified: stable/8/sys/netinet6/ip6_input.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet6/ip6_input.c ============================================================================== --- stable/8/sys/netinet6/ip6_input.c Tue Jun 5 11:26:43 2012 (r236608) +++ stable/8/sys/netinet6/ip6_input.c Tue Jun 5 11:27:11 2012 (r236609) @@ -734,19 +734,23 @@ passin: * as our interface address (e.g. multicast addresses, addresses * within FAITH prefixes and such). */ - if (deliverifp && !ip6_getdstifaddr(m)) { + if (deliverifp) { struct in6_ifaddr *ia6; - ia6 = in6_ifawithifp(deliverifp, &ip6->ip6_dst); - if (ia6) { - if (!ip6_setdstifaddr(m, ia6)) { - /* - * XXX maybe we should drop the packet here, - * as we could not provide enough information - * to the upper layers. - */ - } + if ((ia6 = ip6_getdstifaddr(m)) != NULL) { ifa_free(&ia6->ia_ifa); + } else { + ia6 = in6_ifawithifp(deliverifp, &ip6->ip6_dst); + if (ia6) { + if (!ip6_setdstifaddr(m, ia6)) { + /* + * XXX maybe we should drop the packet here, + * as we could not provide enough information + * to the upper layers. + */ + } + ifa_free(&ia6->ia_ifa); + } } } From owner-svn-src-stable-8@FreeBSD.ORG Tue Jun 5 11:29:00 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E45E81065676; Tue, 5 Jun 2012 11:29:00 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CF9368FC18; Tue, 5 Jun 2012 11:29:00 +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 q55BT0ct016737; Tue, 5 Jun 2012 11:29:00 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q55BT0vT016734; Tue, 5 Jun 2012 11:29:00 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201206051129.q55BT0vT016734@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 5 Jun 2012 11:29:00 +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: r236611 - stable/8/sys/netinet 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, 05 Jun 2012 11:29:01 -0000 Author: bz Date: Tue Jun 5 11:29:00 2012 New Revision: 236611 URL: http://svn.freebsd.org/changeset/base/236611 Log: MFC r236575 (by emax): Plug more refcount leaks and possible NULL deref for interface address list. Modified: stable/8/sys/netinet/tcp_input.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet/tcp_input.c ============================================================================== --- stable/8/sys/netinet/tcp_input.c Tue Jun 5 11:28:57 2012 (r236610) +++ stable/8/sys/netinet/tcp_input.c Tue Jun 5 11:29:00 2012 (r236611) @@ -538,6 +538,8 @@ tcp6_input(struct mbuf **mp, int *offp, (caddr_t)&ip6->ip6_dst - (caddr_t)ip6); return IPPROTO_DONE; } + if (ia6) + ifa_free(&ia6->ia_ifa); tcp_input(m, *offp); return IPPROTO_DONE; @@ -1206,7 +1208,8 @@ relocked: rstreason = BANDLIM_RST_OPENPORT; goto dropwithreset; } - ifa_free(&ia6->ia_ifa); + if (ia6) + ifa_free(&ia6->ia_ifa); } #endif /* From owner-svn-src-stable-8@FreeBSD.ORG Tue Jun 5 19:59:02 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CDEFD106566B; Tue, 5 Jun 2012 19:59:02 +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 B97098FC08; Tue, 5 Jun 2012 19:59:02 +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 q55Jx23M040736; Tue, 5 Jun 2012 19:59:02 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q55Jx2jT040733; Tue, 5 Jun 2012 19:59:02 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206051959.q55Jx2jT040733@svn.freebsd.org> From: Marius Strobl Date: Tue, 5 Jun 2012 19:59:02 +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: r236632 - in stable/8/sys: dev/iwn 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, 05 Jun 2012 19:59:02 -0000 Author: marius Date: Tue Jun 5 19:59:02 2012 New Revision: 236632 URL: http://svn.freebsd.org/changeset/base/236632 Log: MFC: r236486 Add nitems(), a macro for determining the number of elements in a statically-allocated array. Obtained from: OpenBSD (in principle) MFC: r236489 Modified: stable/8/sys/dev/iwn/if_iwn.c stable/8/sys/sys/param.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (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) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c ============================================================================== --- stable/8/sys/dev/iwn/if_iwn.c Tue Jun 5 19:58:58 2012 (r236631) +++ stable/8/sys/dev/iwn/if_iwn.c Tue Jun 5 19:59:02 2012 (r236632) @@ -2010,8 +2010,6 @@ iwn_setregdomain(struct ieee80211com *ic return 0; } -#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0])) - static void iwn_read_eeprom_enhinfo(struct iwn_softc *sc) { Modified: stable/8/sys/sys/param.h ============================================================================== --- stable/8/sys/sys/param.h Tue Jun 5 19:58:58 2012 (r236631) +++ stable/8/sys/sys/param.h Tue Jun 5 19:59:02 2012 (r236632) @@ -271,6 +271,7 @@ #ifndef howmany #define howmany(x, y) (((x)+((y)-1))/(y)) #endif +#define nitems(x) (sizeof((x)) / sizeof((x)[0])) #define rounddown(x, y) (((x)/(y))*(y)) #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */ #define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Jun 5 20:34:57 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0EB22106573F; Tue, 5 Jun 2012 20:34:57 +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 D50578FC16; Tue, 5 Jun 2012 20:34:56 +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 q55KYuqj042682; Tue, 5 Jun 2012 20:34:56 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q55KYu1G042679; Tue, 5 Jun 2012 20:34:56 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206052034.q55KYu1G042679@svn.freebsd.org> From: Marius Strobl Date: Tue, 5 Jun 2012 20:34:56 +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: r236638 - in stable/8/sys/dev: bge sym 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, 05 Jun 2012 20:34:57 -0000 Author: marius Date: Tue Jun 5 20:34:56 2012 New Revision: 236638 URL: http://svn.freebsd.org/changeset/base/236638 Log: MFC: r236488 Take advantage of nitems(). Modified: stable/8/sys/dev/bge/if_bge.c stable/8/sys/dev/sym/sym_hipd.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (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) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Tue Jun 5 20:32:38 2012 (r236637) +++ stable/8/sys/dev/bge/if_bge.c Tue Jun 5 20:34:56 2012 (r236638) @@ -2791,9 +2791,8 @@ bge_mbox_reorder(struct bge_softc *sc) }; devclass_t pci, pcib; device_t bus, dev; - int count, i; + int i; - count = sizeof(mbox_reorder_lists) / sizeof(mbox_reorder_lists[0]); pci = devclass_find("pci"); pcib = devclass_find("pcib"); dev = sc->bge_dev; @@ -2806,7 +2805,7 @@ bge_mbox_reorder(struct bge_softc *sc) device_get_name(bus), device_get_unit(bus)); if (device_get_devclass(dev) != pcib) break; - for (i = 0; i < count; i++) { + for (i = 0; i < nitems(mbox_reorder_lists); i++) { device_printf(sc->bge_dev, "probing dev : %s%d, vendor : 0x%04x " "device : 0x%04x\n", Modified: stable/8/sys/dev/sym/sym_hipd.c ============================================================================== --- stable/8/sys/dev/sym/sym_hipd.c Tue Jun 5 20:32:38 2012 (r236637) +++ stable/8/sys/dev/sym/sym_hipd.c Tue Jun 5 20:34:56 2012 (r236638) @@ -8411,9 +8411,6 @@ static const struct sym_pci_chip sym_pci FE_RAM|FE_IO256|FE_LEDC} }; -#define sym_pci_num_devs \ - (sizeof(sym_pci_dev_table) / sizeof(sym_pci_dev_table[0])) - /* * Look up the chip table. * @@ -8434,7 +8431,7 @@ sym_find_pci_chip(device_t dev) device_id = pci_get_device(dev); revision = pci_get_revid(dev); - for (i = 0; i < sym_pci_num_devs; i++) { + for (i = 0; i < nitems(sym_pci_dev_table); i++) { chip = &sym_pci_dev_table[i]; if (device_id != chip->device_id) continue; From owner-svn-src-stable-8@FreeBSD.ORG Tue Jun 5 20:53:54 2012 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 86657106567E; Tue, 5 Jun 2012 20:53:53 +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 ABB998FC1F; Tue, 5 Jun 2012 20:53:53 +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 q55KrrPr043707; Tue, 5 Jun 2012 20:53:53 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q55KrrWu043704; Tue, 5 Jun 2012 20:53:53 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206052053.q55KrrWu043704@svn.freebsd.org> From: Marius Strobl Date: Tue, 5 Jun 2012 20:53:53 +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: r236643 - stable/8/sys/dev/mmc 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, 05 Jun 2012 20:53:54 -0000 Author: marius Date: Tue Jun 5 20:53:53 2012 New Revision: 236643 URL: http://svn.freebsd.org/changeset/base/236643 Log: MFC: r236491 Add missing prototypes. While at it, sort them alphabetically. Modified: stable/8/sys/dev/mmc/mmc.c stable/8/sys/dev/mmc/mmcsd.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (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) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/mmc/mmc.c ============================================================================== --- stable/8/sys/dev/mmc/mmc.c Tue Jun 5 20:53:46 2012 (r236642) +++ stable/8/sys/dev/mmc/mmc.c Tue Jun 5 20:53:53 2012 (r236643) @@ -112,11 +112,21 @@ static int mmc_debug; SYSCTL_INT(_hw_mmc, OID_AUTO, debug, CTLFLAG_RW, &mmc_debug, 0, "Debug level"); /* bus entry points */ -static int mmc_probe(device_t dev); +static int mmc_acquire_bus(device_t busdev, device_t dev); static int mmc_attach(device_t dev); +static int mmc_child_location_str(device_t dev, device_t child, char *buf, + size_t buflen); static int mmc_detach(device_t dev); -static int mmc_suspend(device_t dev); +static int mmc_probe(device_t dev); +static int mmc_read_ivar(device_t bus, device_t child, int which, + uintptr_t *result); +static int mmc_release_bus(device_t busdev, device_t dev); static int mmc_resume(device_t dev); +static int mmc_suspend(device_t dev); +static int mmc_wait_for_request(device_t brdev, device_t reqdev, + struct mmc_request *req); +static int mmc_write_ivar(device_t bus, device_t child, int which, + uintptr_t value); #define MMC_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define MMC_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) @@ -127,25 +137,69 @@ static int mmc_resume(device_t dev); #define MMC_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED); #define MMC_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED); +static int mmc_all_send_cid(struct mmc_softc *sc, uint32_t *rawcid); +static void mmc_app_decode_scr(uint32_t *raw_scr, struct mmc_scr *scr); +static void mmc_app_decode_sd_status(uint32_t *raw_sd_status, + struct mmc_sd_status *sd_status); +static int mmc_app_sd_status(struct mmc_softc *sc, uint16_t rca, + uint32_t *rawsdstatus); +static int mmc_app_send_scr(struct mmc_softc *sc, uint16_t rca, + uint32_t *rawscr); static int mmc_calculate_clock(struct mmc_softc *sc); -static void mmc_delayed_attach(void *); +static void mmc_decode_cid_mmc(uint32_t *raw_cid, struct mmc_cid *cid); +static void mmc_decode_cid_sd(uint32_t *raw_cid, struct mmc_cid *cid); +static void mmc_decode_csd_mmc(uint32_t *raw_csd, struct mmc_csd *csd); +static void mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *csd); +static void mmc_delayed_attach(void *xsc); +static int mmc_delete_cards(struct mmc_softc *sc); +static void mmc_discover_cards(struct mmc_softc *sc); +static void mmc_format_card_id_string(struct mmc_ivars *ivar); +static void mmc_go_discovery(struct mmc_softc *sc); +static uint32_t mmc_get_bits(uint32_t *bits, int bit_len, int start, + int size); +static int mmc_highest_voltage(uint32_t ocr); +static void mmc_idle_cards(struct mmc_softc *sc); +static void mmc_ms_delay(int ms); +static void mmc_log_card(device_t dev, struct mmc_ivars *ivar, int newcard); static void mmc_power_down(struct mmc_softc *sc); +static void mmc_power_up(struct mmc_softc *sc); +static void mmc_rescan_cards(struct mmc_softc *sc); +static void mmc_scan(struct mmc_softc *sc); +static int mmc_sd_switch(struct mmc_softc *sc, uint8_t mode, uint8_t grp, + uint8_t value, uint8_t *res); +static int mmc_select_card(struct mmc_softc *sc, uint16_t rca); +static uint32_t mmc_select_vdd(struct mmc_softc *sc, uint32_t ocr); +static int mmc_send_app_op_cond(struct mmc_softc *sc, uint32_t ocr, + uint32_t *rocr); +static int mmc_send_csd(struct mmc_softc *sc, uint16_t rca, uint32_t *rawcsd); +static int mmc_send_ext_csd(struct mmc_softc *sc, uint8_t *rawextcsd); +static int mmc_send_if_cond(struct mmc_softc *sc, uint8_t vhs); +static int mmc_send_op_cond(struct mmc_softc *sc, uint32_t ocr, + uint32_t *rocr); +static int mmc_send_relative_addr(struct mmc_softc *sc, uint32_t *resp); +static int mmc_send_status(struct mmc_softc *sc, uint16_t rca, + uint32_t *status); +static int mmc_set_blocklen(struct mmc_softc *sc, uint32_t len); +static int mmc_set_card_bus_width(struct mmc_softc *sc, uint16_t rca, + int width); +static int mmc_set_relative_addr(struct mmc_softc *sc, uint16_t resp); +static int mmc_set_timing(struct mmc_softc *sc, int timing); +static int mmc_switch(struct mmc_softc *sc, uint8_t set, uint8_t index, + uint8_t value); +static int mmc_test_bus_width(struct mmc_softc *sc); +static int mmc_wait_for_app_cmd(struct mmc_softc *sc, uint32_t rca, + struct mmc_command *cmd, int retries); static int mmc_wait_for_cmd(struct mmc_softc *sc, struct mmc_command *cmd, int retries); static int mmc_wait_for_command(struct mmc_softc *sc, uint32_t opcode, uint32_t arg, uint32_t flags, uint32_t *resp, int retries); -static int mmc_select_card(struct mmc_softc *sc, uint16_t rca); -static int mmc_set_card_bus_width(struct mmc_softc *sc, uint16_t rca, int width); -static int mmc_app_send_scr(struct mmc_softc *sc, uint16_t rca, uint32_t *rawscr); -static void mmc_app_decode_scr(uint32_t *raw_scr, struct mmc_scr *scr); -static int mmc_send_ext_csd(struct mmc_softc *sc, uint8_t *rawextcsd); -static void mmc_scan(struct mmc_softc *sc); -static int mmc_delete_cards(struct mmc_softc *sc); -static void mmc_format_card_id_string(struct mmc_ivars *ivar); +static int mmc_wait_for_req(struct mmc_softc *sc, struct mmc_request *req); +static void mmc_wakeup(struct mmc_request *req); static void mmc_ms_delay(int ms) { + DELAY(1000 * ms); /* XXX BAD */ } Modified: stable/8/sys/dev/mmc/mmcsd.c ============================================================================== --- stable/8/sys/dev/mmc/mmcsd.c Tue Jun 5 20:53:46 2012 (r236642) +++ stable/8/sys/dev/mmc/mmcsd.c Tue Jun 5 20:53:53 2012 (r236643) @@ -89,19 +89,21 @@ struct mmcsd_softc { }; /* bus entry points */ -static int mmcsd_probe(device_t dev); static int mmcsd_attach(device_t dev); static int mmcsd_detach(device_t dev); +static int mmcsd_probe(device_t dev); /* disk routines */ -static int mmcsd_open(struct disk *dp); static int mmcsd_close(struct disk *dp); -static void mmcsd_strategy(struct bio *bp); static int mmcsd_dump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t length); +static int mmcsd_open(struct disk *dp); +static void mmcsd_strategy(struct bio *bp); static void mmcsd_task(void *arg); static int mmcsd_bus_bit_width(device_t dev); +static daddr_t mmcsd_delete(struct mmcsd_softc *sc, struct bio *bp); +static daddr_t mmcsd_rw(struct mmcsd_softc *sc, struct bio *bp); #define MMCSD_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define MMCSD_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) @@ -256,12 +258,14 @@ mmcsd_resume(device_t dev) static int mmcsd_open(struct disk *dp) { + return (0); } static int mmcsd_close(struct disk *dp) { + return (0); } @@ -521,6 +525,7 @@ out: static int mmcsd_bus_bit_width(device_t dev) { + if (mmc_get_bus_width(dev) == bus_width_1) return (1); if (mmc_get_bus_width(dev) == bus_width_4) From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 6 04:18:05 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0DA76106566C; Wed, 6 Jun 2012 04:18:05 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED4ED8FC19; Wed, 6 Jun 2012 04:18:04 +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 q564I4iN067959; Wed, 6 Jun 2012 04:18:04 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q564I4IF067957; Wed, 6 Jun 2012 04:18:04 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206060418.q564I4IF067957@svn.freebsd.org> From: Eitan Adler Date: Wed, 6 Jun 2012 04:18:04 +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: r236651 - 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: Wed, 06 Jun 2012 04:18:05 -0000 Author: eadler Date: Wed Jun 6 04:18:04 2012 New Revision: 236651 URL: http://svn.freebsd.org/changeset/base/236651 Log: MFC r236282: Add support for Sun 1040 PCI Quad Serial PR: kern/163450 Approved by: cperciva (implicit) Modified: stable/8/sys/dev/puc/pucdata.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/puc/pucdata.c ============================================================================== --- stable/8/sys/dev/puc/pucdata.c Wed Jun 6 04:17:40 2012 (r236650) +++ stable/8/sys/dev/puc/pucdata.c Wed Jun 6 04:18:04 2012 (r236651) @@ -887,6 +887,12 @@ const struct puc_cfg puc_pci_devices[] = .config_function = puc_config_syba }, + { 0x5372, 0x6873, 0xffff, 0, + "Sun 1040 PCI Quad Serial", + DEFAULT_RCLK, + PUC_PORT_4S, 0x10, 4, 0, + }, + { 0x6666, 0x0001, 0xffff, 0, "Decision Computer Inc, PCCOM 4-port serial", DEFAULT_RCLK, From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 6 04:26:27 2012 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 A23C4106574D; Wed, 6 Jun 2012 04:26:27 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8DB9E8FC1A; Wed, 6 Jun 2012 04:26: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 q564QR05068483; Wed, 6 Jun 2012 04:26:27 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q564QRm7068481; Wed, 6 Jun 2012 04:26:27 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206060426.q564QRm7068481@svn.freebsd.org> From: Eitan Adler Date: Wed, 6 Jun 2012 04:26: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: r236654 - stable/8/sys/cam/scsi 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: Wed, 06 Jun 2012 04:26:27 -0000 Author: eadler Date: Wed Jun 6 04:26:27 2012 New Revision: 236654 URL: http://svn.freebsd.org/changeset/base/236654 Log: MFC r236283: Add support for newer garmin devices PR: kern/163932 Approved by: cperciva (implicit) Modified: stable/8/sys/cam/scsi/scsi_xpt.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_xpt.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_xpt.c Wed Jun 6 04:26:03 2012 (r236653) +++ stable/8/sys/cam/scsi/scsi_xpt.c Wed Jun 6 04:26:27 2012 (r236654) @@ -507,6 +507,10 @@ static struct scsi_quirk_entry scsi_quir CAM_QUIRK_NOLUNS, /*mintags*/0, /*maxtags*/0 }, { + { T_DIRECT, SIP_MEDIA_REMOVABLE, "Garmin", "*", "*" }, + CAM_QUIRK_NORPTLUNS, /*mintags*/2, /*maxtags*/255 + }, + { /* Default tagged queuing parameters for all devices */ { T_ANY, SIP_MEDIA_REMOVABLE|SIP_MEDIA_FIXED, From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 6 04:38:46 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AD521106579F; Wed, 6 Jun 2012 04:38:46 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7EBF78FC14; Wed, 6 Jun 2012 04:38:46 +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 q564ckSi069256; Wed, 6 Jun 2012 04:38:46 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q564ckPM069251; Wed, 6 Jun 2012 04:38:46 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206060438.q564ckPM069251@svn.freebsd.org> From: Eitan Adler Date: Wed, 6 Jun 2012 04:38:46 +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: r236656 - in stable/8/sys/dev: hptiop hptmv isp 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: Wed, 06 Jun 2012 04:38:46 -0000 Author: eadler Date: Wed Jun 6 04:38:45 2012 New Revision: 236656 URL: http://svn.freebsd.org/changeset/base/236656 Log: MFC r236379: Adding missing dependancies for loading hptiop(4), hptmv(4) and isp(4) as modules. PR: kern/166239 Approved by: cperciva (implicit) Modified: stable/8/sys/dev/hptiop/hptiop.c stable/8/sys/dev/hptmv/entry.c stable/8/sys/dev/isp/isp_pci.c stable/8/sys/dev/isp/isp_sbus.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/hptiop/hptiop.c ============================================================================== --- stable/8/sys/dev/hptiop/hptiop.c Wed Jun 6 04:38:25 2012 (r236655) +++ stable/8/sys/dev/hptiop/hptiop.c Wed Jun 6 04:38:45 2012 (r236656) @@ -1268,6 +1268,7 @@ static driver_t hptiop_pci_driver = { }; DRIVER_MODULE(hptiop, pci, hptiop_pci_driver, hptiop_devclass, 0, 0); +MODULE_DEPEND(hptiop, cam, 1, 1, 1); static int hptiop_probe(device_t dev) { Modified: stable/8/sys/dev/hptmv/entry.c ============================================================================== --- stable/8/sys/dev/hptmv/entry.c Wed Jun 6 04:38:25 2012 (r236655) +++ stable/8/sys/dev/hptmv/entry.c Wed Jun 6 04:38:45 2012 (r236656) @@ -108,6 +108,7 @@ static devclass_t hpt_devclass; #define __DRIVER_MODULE(p1, p2, p3, p4, p5, p6) DRIVER_MODULE(p1, p2, p3, p4, p5, p6) __DRIVER_MODULE(PROC_DIR_NAME, pci, hpt_pci_driver, hpt_devclass, 0, 0); +MODULE_DEPEND(PROC_DIR_NAME, cam, 1, 1, 1); #define ccb_ccb_ptr spriv_ptr0 #define ccb_adapter ccb_h.spriv_ptr1 Modified: stable/8/sys/dev/isp/isp_pci.c ============================================================================== --- stable/8/sys/dev/isp/isp_pci.c Wed Jun 6 04:38:25 2012 (r236655) +++ stable/8/sys/dev/isp/isp_pci.c Wed Jun 6 04:38:45 2012 (r236656) @@ -362,6 +362,8 @@ static driver_t isp_pci_driver = { }; static devclass_t isp_devclass; DRIVER_MODULE(isp, pci, isp_pci_driver, isp_devclass, 0, 0); +MODULE_DEPEND(isp, cam, 1, 1, 1); +MODULE_DEPEND(isp, firmware, 1, 1, 1); static int isp_pci_probe(device_t dev) Modified: stable/8/sys/dev/isp/isp_sbus.c ============================================================================== --- stable/8/sys/dev/isp/isp_sbus.c Wed Jun 6 04:38:25 2012 (r236655) +++ stable/8/sys/dev/isp/isp_sbus.c Wed Jun 6 04:38:45 2012 (r236656) @@ -106,6 +106,8 @@ static driver_t isp_sbus_driver = { }; static devclass_t isp_devclass; DRIVER_MODULE(isp, sbus, isp_sbus_driver, isp_devclass, 0, 0); +MODULE_DEPEND(isp, cam, 1, 1, 1); +MODULE_DEPEND(isp, firmware, 1, 1, 1); static int isp_sbus_probe(device_t dev) From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 6 06:35:29 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E0CAF10656DF; Wed, 6 Jun 2012 06:35:29 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CC59C8FC1E; Wed, 6 Jun 2012 06:35:29 +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 q566ZTtJ074666; Wed, 6 Jun 2012 06:35:29 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q566ZT9L074664; Wed, 6 Jun 2012 06:35:29 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206060635.q566ZT9L074664@svn.freebsd.org> From: Eitan Adler Date: Wed, 6 Jun 2012 06:35: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: r236661 - 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: Wed, 06 Jun 2012 06:35:30 -0000 Author: eadler Date: Wed Jun 6 06:35:29 2012 New Revision: 236661 URL: http://svn.freebsd.org/changeset/base/236661 Log: MFC r236285: Add missing flag enable when certain arguments are parsed PR: bin/163053 Approved by: cperciva (implicit) 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 Wed Jun 6 06:35:09 2012 (r236660) +++ stable/8/sbin/camcontrol/camcontrol.c Wed Jun 6 06:35:29 2012 (r236661) @@ -3321,6 +3321,7 @@ ratecontrol(struct cam_device *device, i spi->flags &= ~CTS_SPI_FLAGS_DISC_ENB; else spi->flags |= CTS_SPI_FLAGS_DISC_ENB; + didsettings++; } if (scsi && tag_enable != -1) { if ((cpi.hba_inquiry & PI_TAG_ABLE) == 0) { From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 6 06:39:15 2012 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 7E65C10656AD; Wed, 6 Jun 2012 06:39:15 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 68AF08FC1B; Wed, 6 Jun 2012 06:39:15 +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 q566dFXu074980; Wed, 6 Jun 2012 06:39:15 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q566dFgE074978; Wed, 6 Jun 2012 06:39:15 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206060639.q566dFgE074978@svn.freebsd.org> From: Eitan Adler Date: Wed, 6 Jun 2012 06:39:15 +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: r236664 - stable/8/usr.sbin/lpr/lpr 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: Wed, 06 Jun 2012 06:39:15 -0000 Author: eadler Date: Wed Jun 6 06:39:14 2012 New Revision: 236664 URL: http://svn.freebsd.org/changeset/base/236664 Log: MFC r236289: Relax security permissions on '.seq' file creation - the strict, but odd permissions resulted in a security alert from 110.neggrpperm PR: bin/165533 Approved by: cperciva (implicit) Modified: stable/8/usr.sbin/lpr/lpr/lpr.c Directory Properties: stable/8/usr.sbin/lpr/ (props changed) Modified: stable/8/usr.sbin/lpr/lpr/lpr.c ============================================================================== --- stable/8/usr.sbin/lpr/lpr/lpr.c Wed Jun 6 06:38:56 2012 (r236663) +++ stable/8/usr.sbin/lpr/lpr/lpr.c Wed Jun 6 06:39:14 2012 (r236664) @@ -846,7 +846,7 @@ mktemps(const struct printer *pp) (void) snprintf(buf, sizeof(buf), "%s/.seq", pp->spool_dir); seteuid(euid); - if ((fd = open(buf, O_RDWR|O_CREAT, 0661)) < 0) { + if ((fd = open(buf, O_RDWR|O_CREAT, 0664)) < 0) { printf("%s: cannot create %s\n", progname, buf); exit(1); } From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 6 07:46:15 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B951E106566C; Wed, 6 Jun 2012 07:46:15 +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 9F4548FC1D; Wed, 6 Jun 2012 07:46:15 +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 q567kFDE078154; Wed, 6 Jun 2012 07:46:15 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q567kFJ7078114; Wed, 6 Jun 2012 07:46:15 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206060746.q567kFJ7078114@svn.freebsd.org> From: Marius Strobl Date: Wed, 6 Jun 2012 07:46:15 +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: r236667 - in stable/8/sys: dev/sound/usb dev/usb dev/usb/controller dev/usb/input dev/usb/misc dev/usb/net dev/usb/serial dev/usb/storage dev/usb/template dev/usb/wlan netgraph/bluetoot... 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: Wed, 06 Jun 2012 07:46:15 -0000 Author: marius Date: Wed Jun 6 07:46:14 2012 New Revision: 236667 URL: http://svn.freebsd.org/changeset/base/236667 Log: MFC: r233774 Fix compiler warnings, mostly signed issues, when USB modules are compiled with WARNS=9. Modified: stable/8/sys/dev/sound/usb/uaudio.c stable/8/sys/dev/sound/usb/uaudioreg.h stable/8/sys/dev/usb/controller/at91dci.c stable/8/sys/dev/usb/controller/atmegadci.c stable/8/sys/dev/usb/controller/avr32dci.c stable/8/sys/dev/usb/controller/ehci.c stable/8/sys/dev/usb/controller/musb_otg.c stable/8/sys/dev/usb/controller/ohci.c stable/8/sys/dev/usb/controller/uhci.c stable/8/sys/dev/usb/controller/uss820dci.c stable/8/sys/dev/usb/controller/xhci.c stable/8/sys/dev/usb/input/atp.c stable/8/sys/dev/usb/input/uep.c stable/8/sys/dev/usb/input/uhid.c stable/8/sys/dev/usb/input/ukbd.c stable/8/sys/dev/usb/input/ums.c stable/8/sys/dev/usb/misc/ufm.c stable/8/sys/dev/usb/net/if_aue.c stable/8/sys/dev/usb/net/if_axe.c stable/8/sys/dev/usb/net/if_cdce.c stable/8/sys/dev/usb/net/if_cue.c stable/8/sys/dev/usb/net/if_ipheth.c stable/8/sys/dev/usb/net/if_kue.c stable/8/sys/dev/usb/net/if_rue.c stable/8/sys/dev/usb/net/if_udav.c stable/8/sys/dev/usb/net/uhso.c stable/8/sys/dev/usb/serial/ubsa.c stable/8/sys/dev/usb/serial/uchcom.c stable/8/sys/dev/usb/serial/ucycom.c stable/8/sys/dev/usb/serial/ufoma.c stable/8/sys/dev/usb/serial/ulpt.c stable/8/sys/dev/usb/serial/umodem.c stable/8/sys/dev/usb/serial/uplcom.c stable/8/sys/dev/usb/serial/usb_serial.c stable/8/sys/dev/usb/serial/usb_serial.h stable/8/sys/dev/usb/storage/umass.c stable/8/sys/dev/usb/storage/urio.c stable/8/sys/dev/usb/storage/ustorage_fs.c stable/8/sys/dev/usb/template/usb_template.c stable/8/sys/dev/usb/usb_busdma.c stable/8/sys/dev/usb/usb_compat_linux.c stable/8/sys/dev/usb/usb_dev.c stable/8/sys/dev/usb/usb_device.c stable/8/sys/dev/usb/usb_handle_request.c stable/8/sys/dev/usb/usb_hid.c stable/8/sys/dev/usb/usb_hub.c stable/8/sys/dev/usb/usb_msctest.c stable/8/sys/dev/usb/usb_request.c stable/8/sys/dev/usb/usb_transfer.c stable/8/sys/dev/usb/usbdi.h stable/8/sys/dev/usb/usbhid.h stable/8/sys/dev/usb/wlan/if_rum.c stable/8/sys/dev/usb/wlan/if_run.c stable/8/sys/dev/usb/wlan/if_uath.c stable/8/sys/dev/usb/wlan/if_upgt.c stable/8/sys/dev/usb/wlan/if_ural.c stable/8/sys/dev/usb/wlan/if_urtw.c stable/8/sys/dev/usb/wlan/if_zyd.c stable/8/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (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) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/8/sys/dev/sound/usb/uaudio.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/sound/usb/uaudio.c Wed Jun 6 07:46:14 2012 (r236667) @@ -1272,15 +1272,15 @@ uaudio_chan_record_callback(struct usb_x { struct uaudio_chan *ch = usbd_xfer_softc(xfer); struct usb_page_cache *pc; - uint32_t n; - uint32_t m; - uint32_t blockcount; uint32_t offset0; uint32_t offset1; uint32_t mfl; + int m; + int n; int len; int actlen; int nframes; + int blockcount; usbd_xfer_status(xfer, &actlen, NULL, NULL, &nframes); mfl = usbd_xfer_max_framelen(xfer); @@ -1307,9 +1307,9 @@ uaudio_chan_record_callback(struct usb_x m = (ch->end - ch->cur); - if (m > len) { + if (m > len) m = len; - } + usbd_copy_out(pc, offset1, ch->cur, m); len -= m; @@ -1884,10 +1884,10 @@ uaudio_mixer_add_selector(struct uaudio_ static uint32_t uaudio_mixer_feature_get_bmaControls(const struct usb_audio_feature_unit *d, - uint8_t index) + uint8_t i) { uint32_t temp = 0; - uint32_t offset = (index * d->bControlSize); + uint32_t offset = (i * d->bControlSize); if (d->bControlSize > 0) { temp |= d->bmaControls[offset]; @@ -2636,8 +2636,8 @@ uaudio_mixer_feature_name(const struct u return (uat->feature); } -const static struct uaudio_terminal_node * -uaudio_mixer_get_input(const struct uaudio_terminal_node *iot, uint8_t index) +static const struct uaudio_terminal_node * +uaudio_mixer_get_input(const struct uaudio_terminal_node *iot, uint8_t i) { struct uaudio_terminal_node *root = iot->root; uint8_t n; @@ -2645,17 +2645,16 @@ uaudio_mixer_get_input(const struct uaud n = iot->usr.id_max; do { if (iot->usr.bit_input[n / 8] & (1 << (n % 8))) { - if (!index--) { + if (!i--) return (root + n); - } } } while (n--); return (NULL); } -const static struct uaudio_terminal_node * -uaudio_mixer_get_output(const struct uaudio_terminal_node *iot, uint8_t index) +static const struct uaudio_terminal_node * +uaudio_mixer_get_output(const struct uaudio_terminal_node *iot, uint8_t i) { struct uaudio_terminal_node *root = iot->root; uint8_t n; @@ -2663,9 +2662,8 @@ uaudio_mixer_get_output(const struct uau n = iot->usr.id_max; do { if (iot->usr.bit_output[n / 8] & (1 << (n % 8))) { - if (!index--) { + if (!i--) return (root + n); - } } } while (n--); Modified: stable/8/sys/dev/sound/usb/uaudioreg.h ============================================================================== --- stable/8/sys/dev/sound/usb/uaudioreg.h Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/sound/usb/uaudioreg.h Wed Jun 6 07:46:14 2012 (r236667) @@ -113,9 +113,9 @@ struct usb_audio_streaming_type1_descrip uByte bSamFreqType; #define UA_SAMP_CONTNUOUS 0 uByte tSamFreq[0]; -#define UA_GETSAMP(p, n) (((p)->tSamFreq[((n)*3)+0]) | \ +#define UA_GETSAMP(p, n) ((uint32_t)((((p)->tSamFreq[((n)*3)+0]) | \ ((p)->tSamFreq[((n)*3)+1] << 8) | \ - ((p)->tSamFreq[((n)*3)+2] << 16)) + ((p)->tSamFreq[((n)*3)+2] << 16)))) #define UA_SAMP_LO(p) UA_GETSAMP(p, 0) #define UA_SAMP_HI(p) UA_GETSAMP(p, 1) } __packed; Modified: stable/8/sys/dev/usb/controller/at91dci.c ============================================================================== --- stable/8/sys/dev/usb/controller/at91dci.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/controller/at91dci.c Wed Jun 6 07:46:14 2012 (r236667) @@ -1725,14 +1725,13 @@ static const struct at91dci_config_desc }, }; +#define HSETW(ptr, val) ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) } + static const struct usb_hub_descriptor_min at91dci_hubd = { .bDescLength = sizeof(at91dci_hubd), .bDescriptorType = UDESC_HUB, .bNbrPorts = 1, - .wHubCharacteristics[0] = - (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) & 0xFF, - .wHubCharacteristics[1] = - (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) >> 8, + HSETW(.wHubCharacteristics, (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL)), .bPwrOn2PwrGood = 50, .bHubContrCurrent = 0, .DeviceRemovable = {0}, /* port is removable */ Modified: stable/8/sys/dev/usb/controller/atmegadci.c ============================================================================== --- stable/8/sys/dev/usb/controller/atmegadci.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/controller/atmegadci.c Wed Jun 6 07:46:14 2012 (r236667) @@ -1547,14 +1547,13 @@ static const struct atmegadci_config_des }, }; +#define HSETW(ptr, val) ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) } + static const struct usb_hub_descriptor_min atmegadci_hubd = { .bDescLength = sizeof(atmegadci_hubd), .bDescriptorType = UDESC_HUB, .bNbrPorts = 1, - .wHubCharacteristics[0] = - (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) & 0xFF, - .wHubCharacteristics[1] = - (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) >> 8, + HSETW(.wHubCharacteristics, (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL)), .bPwrOn2PwrGood = 50, .bHubContrCurrent = 0, .DeviceRemovable = {0}, /* port is removable */ Modified: stable/8/sys/dev/usb/controller/avr32dci.c ============================================================================== --- stable/8/sys/dev/usb/controller/avr32dci.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/controller/avr32dci.c Wed Jun 6 07:46:14 2012 (r236667) @@ -1489,14 +1489,13 @@ static const struct avr32dci_config_desc }, }; +#define HSETW(ptr, val) ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) } + static const struct usb_hub_descriptor_min avr32dci_hubd = { .bDescLength = sizeof(avr32dci_hubd), .bDescriptorType = UDESC_HUB, .bNbrPorts = 1, - .wHubCharacteristics[0] = - (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) & 0xFF, - .wHubCharacteristics[1] = - (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) >> 8, + HSETW(.wHubCharacteristics, (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL)), .bPwrOn2PwrGood = 50, .bHubContrCurrent = 0, .DeviceRemovable = {0}, /* port is removable */ Modified: stable/8/sys/dev/usb/controller/ehci.c ============================================================================== --- stable/8/sys/dev/usb/controller/ehci.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/controller/ehci.c Wed Jun 6 07:46:14 2012 (r236667) @@ -3020,13 +3020,8 @@ static const struct ehci_config_desc ehc static const struct usb_hub_descriptor ehci_hubd = { - 0, /* dynamic length */ - UDESC_HUB, - 0, - {0, 0}, - 0, - 0, - {0}, + .bDescLength = 0, /* dynamic length */ + .bDescriptorType = UDESC_HUB, }; static void Modified: stable/8/sys/dev/usb/controller/musb_otg.c ============================================================================== --- stable/8/sys/dev/usb/controller/musb_otg.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/controller/musb_otg.c Wed Jun 6 07:46:14 2012 (r236667) @@ -2192,14 +2192,13 @@ static const struct musbotg_config_desc }, }; +#define HSETW(ptr, val) ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) } + static const struct usb_hub_descriptor_min musbotg_hubd = { .bDescLength = sizeof(musbotg_hubd), .bDescriptorType = UDESC_HUB, .bNbrPorts = 1, - .wHubCharacteristics[0] = - (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) & 0xFF, - .wHubCharacteristics[1] = - (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) >> 16, + HSETW(.wHubCharacteristics, (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL)), .bPwrOn2PwrGood = 50, .bHubContrCurrent = 0, .DeviceRemovable = {0}, /* port is removable */ Modified: stable/8/sys/dev/usb/controller/ohci.c ============================================================================== --- stable/8/sys/dev/usb/controller/ohci.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/controller/ohci.c Wed Jun 6 07:46:14 2012 (r236667) @@ -2080,13 +2080,8 @@ struct ohci_config_desc ohci_confd = static const struct usb_hub_descriptor ohci_hubd = { - 0, /* dynamic length */ - UDESC_HUB, - 0, - {0, 0}, - 0, - 0, - {0}, + .bDescLength = 0, /* dynamic length */ + .bDescriptorType = UDESC_HUB, }; static usb_error_t Modified: stable/8/sys/dev/usb/controller/uhci.c ============================================================================== --- stable/8/sys/dev/usb/controller/uhci.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/controller/uhci.c Wed Jun 6 07:46:14 2012 (r236667) @@ -2351,13 +2351,11 @@ static const struct uhci_config_desc uhc static const struct usb_hub_descriptor_min uhci_hubd_piix = { - sizeof(uhci_hubd_piix), - UDESC_HUB, - 2, - {UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL, 0}, - 50, /* power on to power good */ - 0, - {0x00}, /* both ports are removable */ + .bDescLength = sizeof(uhci_hubd_piix), + .bDescriptorType = UDESC_HUB, + .bNbrPorts = 2, + .wHubCharacteristics = {UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL, 0}, + .bPwrOn2PwrGood = 50, }; /* Modified: stable/8/sys/dev/usb/controller/uss820dci.c ============================================================================== --- stable/8/sys/dev/usb/controller/uss820dci.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/controller/uss820dci.c Wed Jun 6 07:46:14 2012 (r236667) @@ -1788,14 +1788,13 @@ static const struct uss820dci_config_des }, }; +#define HSETW(ptr, val) ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) } + static const struct usb_hub_descriptor_min uss820dci_hubd = { .bDescLength = sizeof(uss820dci_hubd), .bDescriptorType = UDESC_HUB, .bNbrPorts = 1, - .wHubCharacteristics[0] = - (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) & 0xFF, - .wHubCharacteristics[1] = - (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) >> 8, + HSETW(.wHubCharacteristics, (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL)), .bPwrOn2PwrGood = 50, .bHubContrCurrent = 0, .DeviceRemovable = {0}, /* port is removable */ Modified: stable/8/sys/dev/usb/controller/xhci.c ============================================================================== --- stable/8/sys/dev/usb/controller/xhci.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/controller/xhci.c Wed Jun 6 07:46:14 2012 (r236667) @@ -822,7 +822,7 @@ xhci_check_transfer(struct xhci_softc *s offset = td_event - td->td_self; if (offset >= 0 && - offset < sizeof(td->td_trb)) { + offset < (int64_t)sizeof(td->td_trb)) { usb_pc_cpu_invalidate(td->page_cache); @@ -2828,7 +2828,7 @@ struct usb_pipe_methods xhci_device_gene * Simulate a hardware HUB by handling all the necessary requests. *------------------------------------------------------------------------*/ -#define HSETW(ptr, val) ptr[0] = (uint8_t)(val), ptr[1] = (uint8_t)((val) >> 8) +#define HSETW(ptr, val) ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) } static const struct usb_device_descriptor xhci_devd = @@ -2871,8 +2871,7 @@ struct xhci_bos_desc xhci_bosd = { HSETW(.wSpeedsSupported, 0x000C), .bFunctionalitySupport = 8, .bU1DevExitLat = 255, /* dummy - not used */ - .wU2DevExitLat[0] = 0x00, - .wU2DevExitLat[1] = 0x08, + .wU2DevExitLat = { 0x00, 0x08 }, }, .cidd = { .bLength = sizeof(xhci_bosd.cidd), Modified: stable/8/sys/dev/usb/input/atp.c ============================================================================== --- stable/8/sys/dev/usb/input/atp.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/input/atp.c Wed Jun 6 07:46:14 2012 (r236667) @@ -761,7 +761,7 @@ atp_get_pressures(int *p, const int *cur * threshold; this will reduce the contribution from * lower pressure readings. */ - if (p[i] <= atp_sensor_noise_threshold) + if ((u_int)p[i] <= atp_sensor_noise_threshold) p[i] = 0; /* filter away noise */ else p[i] -= atp_sensor_noise_threshold; @@ -887,7 +887,7 @@ atp_match_stroke_component(atp_stroke_co delta_mickeys = pspan->loc - component->loc; - if (abs(delta_mickeys) > atp_max_delta_mickeys) + if ((u_int)abs(delta_mickeys) > atp_max_delta_mickeys) return (FALSE); /* the finger span is too far out; no match */ component->loc = pspan->loc; @@ -1164,9 +1164,10 @@ static void atp_add_new_strokes(struct atp_softc *sc, atp_pspan *pspans_x, u_int n_xpspans, atp_pspan *pspans_y, u_int n_ypspans) { - int i, j; atp_pspan spans[2][ATP_MAX_PSPANS_PER_AXIS]; - u_int nspans[2]; + u_int nspans[2]; + u_int i; + u_int j; /* Copy unmatched pspans into the local arrays. */ for (i = 0, nspans[X] = 0; i < n_xpspans; i++) { @@ -1373,9 +1374,9 @@ atp_terminate_stroke(struct atp_softc *s static __inline boolean_t atp_stroke_has_small_movement(const atp_stroke *stroke) { - return ((abs(stroke->components[X].delta_mickeys) <= + return (((u_int)abs(stroke->components[X].delta_mickeys) <= atp_small_movement_threshold) && - (abs(stroke->components[Y].delta_mickeys) <= + ((u_int)abs(stroke->components[Y].delta_mickeys) <= atp_small_movement_threshold)); } @@ -1388,7 +1389,7 @@ static __inline void atp_update_pending_mickeys(atp_stroke_component *component) { component->pending += component->delta_mickeys; - if (abs(component->pending) <= atp_small_movement_threshold) + if ((u_int)abs(component->pending) <= atp_small_movement_threshold) component->delta_mickeys = 0; else { /* @@ -1690,7 +1691,7 @@ atp_attach(device_t dev) if (usb_fifo_attach(sc->sc_usb_device, sc, &sc->sc_mutex, &atp_fifo_methods, &sc->sc_fifo, - device_get_unit(dev), 0 - 1, uaa->info.bIfaceIndex, + device_get_unit(dev), -1, uaa->info.bIfaceIndex, UID_ROOT, GID_OPERATOR, 0644)) { goto detach; } @@ -1764,13 +1765,13 @@ atp_intr(struct usb_xfer *xfer, usb_erro switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - if (len > sc->sc_params->data_len) { + if (len > (int)sc->sc_params->data_len) { DPRINTFN(ATP_LLEVEL_ERROR, "truncating large packet from %u to %u bytes\n", len, sc->sc_params->data_len); len = sc->sc_params->data_len; } - if (len < sc->sc_params->data_len) + if (len < (int)sc->sc_params->data_len) goto tr_setup; pc = usbd_xfer_get_frame(xfer, 0); @@ -2213,9 +2214,9 @@ static device_method_t atp_methods[] = { }; static driver_t atp_driver = { - ATP_DRIVER_NAME, - atp_methods, - sizeof(struct atp_softc) + .name = ATP_DRIVER_NAME, + .methods = atp_methods, + .size = sizeof(struct atp_softc) }; static devclass_t atp_devclass; Modified: stable/8/sys/dev/usb/input/uep.c ============================================================================== --- stable/8/sys/dev/usb/input/uep.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/input/uep.c Wed Jun 6 07:46:14 2012 (r236667) @@ -202,7 +202,7 @@ uep_intr_callback(struct usb_xfer *xfer, u_char buf[17], *p; int pkt_len; - if (len > sizeof(buf)) { + if (len > (int)sizeof(buf)) { DPRINTF("bad input length %d\n", len); goto tr_setup; } @@ -329,7 +329,7 @@ uep_attach(device_t dev) } error = usb_fifo_attach(uaa->device, sc, &sc->mtx, &uep_fifo_methods, - &sc->fifo, device_get_unit(dev), 0 - 1, uaa->info.bIfaceIndex, + &sc->fifo, device_get_unit(dev), -1, uaa->info.bIfaceIndex, UID_ROOT, GID_OPERATOR, 0644); if (error) { Modified: stable/8/sys/dev/usb/input/uhid.c ============================================================================== --- stable/8/sys/dev/usb/input/uhid.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/input/uhid.c Wed Jun 6 07:46:14 2012 (r236667) @@ -201,10 +201,10 @@ uhid_intr_read_callback(struct usb_xfer * If the ID byte is non zero we allow descriptors * having multiple sizes: */ - if ((actlen >= sc->sc_isize) || + if ((actlen >= (int)sc->sc_isize) || ((actlen > 0) && (sc->sc_iid != 0))) { /* limit report length to the maximum */ - if (actlen > sc->sc_isize) + if (actlen > (int)sc->sc_isize) actlen = sc->sc_isize; usb_fifo_put_data(sc->sc_fifo.fp[USB_FIFO_RX], pc, 0, actlen, 1); @@ -814,7 +814,7 @@ uhid_attach(device_t dev) error = usb_fifo_attach(uaa->device, sc, &sc->sc_mtx, &uhid_fifo_methods, &sc->sc_fifo, - unit, 0 - 1, uaa->info.bIfaceIndex, + unit, -1, uaa->info.bIfaceIndex, UID_ROOT, GID_OPERATOR, 0644); if (error) { goto detach; Modified: stable/8/sys/dev/usb/input/ukbd.c ============================================================================== --- stable/8/sys/dev/usb/input/ukbd.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/input/ukbd.c Wed Jun 6 07:46:14 2012 (r236667) @@ -2119,7 +2119,7 @@ ukbd_key2scan(struct ukbd_softc *sc, int 0x5c, /* Keyboard Intl' 6 (Keypad ,) (For PC-9821 layout) */ }; - if ((code >= 89) && (code < (89 + (sizeof(scan) / sizeof(scan[0]))))) { + if ((code >= 89) && (code < (int)(89 + (sizeof(scan) / sizeof(scan[0]))))) { code = scan[code - 89]; } /* Pause/Break */ Modified: stable/8/sys/dev/usb/input/ums.c ============================================================================== --- stable/8/sys/dev/usb/input/ums.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/input/ums.c Wed Jun 6 07:46:14 2012 (r236667) @@ -201,7 +201,7 @@ ums_intr_callback(struct usb_xfer *xfer, case USB_ST_TRANSFERRED: DPRINTFN(6, "sc=%p actlen=%d\n", sc, len); - if (len > sizeof(sc->sc_temp)) { + if (len > (int)sizeof(sc->sc_temp)) { DPRINTFN(6, "truncating large packet to %zu bytes\n", sizeof(sc->sc_temp)); len = sizeof(sc->sc_temp); @@ -612,7 +612,7 @@ ums_attach(device_t dev) /* Some wheels need the Z axis reversed. */ info->sc_flags |= UMS_FLAG_REVZ; } - if (isize > usbd_xfer_max_framelen(sc->sc_xfer[UMS_INTR_DT])) { + if (isize > (int)usbd_xfer_max_framelen(sc->sc_xfer[UMS_INTR_DT])) { DPRINTF("WARNING: report size, %d bytes, is larger " "than interrupt size, %d bytes!\n", isize, usbd_xfer_max_framelen(sc->sc_xfer[UMS_INTR_DT])); @@ -666,7 +666,7 @@ ums_attach(device_t dev) err = usb_fifo_attach(uaa->device, sc, &sc->sc_mtx, &ums_fifo_methods, &sc->sc_fifo, - device_get_unit(dev), 0 - 1, uaa->info.bIfaceIndex, + device_get_unit(dev), -1, uaa->info.bIfaceIndex, UID_ROOT, GID_OPERATOR, 0644); if (err) { goto detach; Modified: stable/8/sys/dev/usb/misc/ufm.c ============================================================================== --- stable/8/sys/dev/usb/misc/ufm.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/misc/ufm.c Wed Jun 6 07:46:14 2012 (r236667) @@ -156,7 +156,7 @@ ufm_attach(device_t dev) error = usb_fifo_attach(uaa->device, sc, &sc->sc_mtx, &ufm_fifo_methods, &sc->sc_fifo, - device_get_unit(dev), 0 - 1, uaa->info.bIfaceIndex, + device_get_unit(dev), -1, uaa->info.bIfaceIndex, UID_ROOT, GID_OPERATOR, 0644); if (error) { goto detach; Modified: stable/8/sys/dev/usb/net/if_aue.c ============================================================================== --- stable/8/sys/dev/usb/net/if_aue.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/net/if_aue.c Wed Jun 6 07:46:14 2012 (r236667) @@ -740,7 +740,7 @@ aue_intr_callback(struct usb_xfer *xfer, case USB_ST_TRANSFERRED: if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && - actlen >= sizeof(pkt)) { + actlen >= (int)sizeof(pkt)) { pc = usbd_xfer_get_frame(xfer, 0); usbd_copy_out(pc, 0, &pkt, sizeof(pkt)); @@ -793,7 +793,7 @@ aue_bulk_read_callback(struct usb_xfer * } } else { - if (actlen <= sizeof(stat) + ETHER_CRC_LEN) { + if (actlen <= (int)(sizeof(stat) + ETHER_CRC_LEN)) { ifp->if_ierrors++; goto tr_setup; } Modified: stable/8/sys/dev/usb/net/if_axe.c ============================================================================== --- stable/8/sys/dev/usb/net/if_axe.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/net/if_axe.c Wed Jun 6 07:46:14 2012 (r236667) @@ -1036,7 +1036,7 @@ axe_rx_frame(struct usb_ether *ue, struc error = 0; if ((sc->sc_flags & AXE_FLAG_STD_FRAME) != 0) { while (pos < actlen) { - if ((pos + sizeof(hdr)) > actlen) { + if ((int)(pos + sizeof(hdr)) > actlen) { /* too little data */ error = EINVAL; break; @@ -1060,7 +1060,7 @@ axe_rx_frame(struct usb_ether *ue, struc } } else if ((sc->sc_flags & AXE_FLAG_CSUM_FRAME) != 0) { while (pos < actlen) { - if ((pos + sizeof(csum_hdr)) > actlen) { + if ((int)(pos + sizeof(csum_hdr)) > actlen) { /* too little data */ error = EINVAL; break; Modified: stable/8/sys/dev/usb/net/if_cdce.c ============================================================================== --- stable/8/sys/dev/usb/net/if_cdce.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/net/if_cdce.c Wed Jun 6 07:46:14 2012 (r236667) @@ -303,8 +303,8 @@ cdce_ncm_init(struct cdce_softc *sc) int err; ufd = usbd_find_descriptor(sc->sc_ue.ue_udev, NULL, - sc->sc_ifaces_index[1], UDESC_CS_INTERFACE, 0 - 1, - UCDC_NCM_FUNC_DESC_SUBTYPE, 0 - 1); + sc->sc_ifaces_index[1], UDESC_CS_INTERFACE, 0xFF, + UCDC_NCM_FUNC_DESC_SUBTYPE, 0xFF); /* verify length of NCM functional descriptor */ if (ufd != NULL) { @@ -514,7 +514,7 @@ cdce_attach(device_t dev) ud = usbd_find_descriptor (uaa->device, NULL, uaa->info.bIfaceIndex, - UDESC_CS_INTERFACE, 0 - 1, UDESCSUB_CDC_UNION, 0 - 1); + UDESC_CS_INTERFACE, 0xFF, UDESCSUB_CDC_UNION, 0xFF); if ((ud == NULL) || (ud->bLength < sizeof(*ud)) || (sc->sc_flags & CDCE_FLAG_NO_UNION)) { @@ -598,7 +598,7 @@ alloc_transfers: ued = usbd_find_descriptor (uaa->device, NULL, uaa->info.bIfaceIndex, - UDESC_CS_INTERFACE, 0 - 1, UDESCSUB_CDC_ENF, 0 - 1); + UDESC_CS_INTERFACE, 0xFF, UDESCSUB_CDC_ENF, 0xFF); if ((ued == NULL) || (ued->bLength < sizeof(*ued))) { error = USB_ERR_INVAL; @@ -892,7 +892,9 @@ cdce_bulk_read_callback(struct usb_xfer struct cdce_softc *sc = usbd_xfer_softc(xfer); struct mbuf *m; uint8_t x; - int actlen, aframes, len; + int actlen; + int aframes; + int len; usbd_xfer_status(xfer, &actlen, NULL, &aframes, NULL); @@ -911,7 +913,7 @@ cdce_bulk_read_callback(struct usb_xfer if ((sc->sc_flags & CDCE_FLAG_ZAURUS) && len >= 14) len -= 4; - if (len < sizeof(struct ether_header)) { + if (len < (int)sizeof(struct ether_header)) { m_freem(m); continue; } @@ -1096,7 +1098,7 @@ cdce_ncm_fill_tx_frames(struct usb_xfer break; } - if (m->m_pkthdr.len > rem) { + if (m->m_pkthdr.len > (int)rem) { if (n == 0) { /* The frame won't fit in our buffer */ DPRINTFN(1, "Frame too big to be transmitted!\n"); @@ -1278,7 +1280,7 @@ cdce_ncm_bulk_read_callback(struct usb_x DPRINTFN(1, "received %u bytes in %u frames\n", actlen, aframes); - if (actlen < (sizeof(sc->sc_ncm.hdr) + + if (actlen < (int)(sizeof(sc->sc_ncm.hdr) + sizeof(sc->sc_ncm.dpt))) { DPRINTFN(1, "frame too short\n"); goto tr_setup; @@ -1305,7 +1307,7 @@ cdce_ncm_bulk_read_callback(struct usb_x goto tr_stall; } temp = UGETW(sc->sc_ncm.hdr.wDptIndex); - if ((temp + sizeof(sc->sc_ncm.dpt)) > actlen) { + if ((int)(temp + sizeof(sc->sc_ncm.dpt)) > actlen) { DPRINTFN(1, "invalid DPT index: 0x%04x\n", temp); goto tr_stall; } @@ -1354,7 +1356,7 @@ cdce_ncm_bulk_read_callback(struct usb_x temp = UGETW(sc->sc_ncm.dp[x].wFrameLength); if ((offset == 0) || - (temp < sizeof(struct ether_header)) || + (temp < (int)sizeof(struct ether_header)) || (temp > (MCLBYTES - ETHER_ALIGN))) { DPRINTFN(1, "NULL frame detected at %d\n", x); m = NULL; @@ -1366,7 +1368,7 @@ cdce_ncm_bulk_read_callback(struct usb_x m = NULL; /* silently ignore this frame */ continue; - } else if (temp > (MHLEN - ETHER_ALIGN)) { + } else if (temp > (int)(MHLEN - ETHER_ALIGN)) { m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); } else { m = m_gethdr(M_DONTWAIT, MT_DATA); Modified: stable/8/sys/dev/usb/net/if_cue.c ============================================================================== --- stable/8/sys/dev/usb/net/if_cue.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/net/if_cue.c Wed Jun 6 07:46:14 2012 (r236667) @@ -457,7 +457,7 @@ cue_bulk_read_callback(struct usb_xfer * switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - if (actlen <= (2 + sizeof(struct ether_header))) { + if (actlen <= (int)(2 + sizeof(struct ether_header))) { ifp->if_ierrors++; goto tr_setup; } Modified: stable/8/sys/dev/usb/net/if_ipheth.c ============================================================================== --- stable/8/sys/dev/usb/net/if_ipheth.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/net/if_ipheth.c Wed Jun 6 07:46:14 2012 (r236667) @@ -471,7 +471,7 @@ ipheth_bulk_read_callback(struct usb_xfe sc->sc_rx_buf[x] = NULL; len = usbd_xfer_frame_len(xfer, x); - if (len < (sizeof(struct ether_header) + + if (len < (int)(sizeof(struct ether_header) + IPHETH_RX_ADJ)) { m_freem(m); continue; Modified: stable/8/sys/dev/usb/net/if_kue.c ============================================================================== --- stable/8/sys/dev/usb/net/if_kue.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/net/if_kue.c Wed Jun 6 07:46:14 2012 (r236667) @@ -545,7 +545,7 @@ kue_bulk_read_callback(struct usb_xfer * switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - if (actlen <= (2 + sizeof(struct ether_header))) { + if (actlen <= (int)(2 + sizeof(struct ether_header))) { ifp->if_ierrors++; goto tr_setup; } Modified: stable/8/sys/dev/usb/net/if_rue.c ============================================================================== --- stable/8/sys/dev/usb/net/if_rue.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/net/if_rue.c Wed Jun 6 07:46:14 2012 (r236667) @@ -638,7 +638,7 @@ rue_intr_callback(struct usb_xfer *xfer, case USB_ST_TRANSFERRED: if (ifp && (ifp->if_drv_flags & IFF_DRV_RUNNING) && - actlen >= sizeof(pkt)) { + actlen >= (int)sizeof(pkt)) { pc = usbd_xfer_get_frame(xfer, 0); usbd_copy_out(pc, 0, &pkt, sizeof(pkt)); Modified: stable/8/sys/dev/usb/net/if_udav.c ============================================================================== --- stable/8/sys/dev/usb/net/if_udav.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/net/if_udav.c Wed Jun 6 07:46:14 2012 (r236667) @@ -642,7 +642,7 @@ udav_bulk_read_callback(struct usb_xfer switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - if (actlen < sizeof(stat) + ETHER_CRC_LEN) { + if (actlen < (int)(sizeof(stat) + ETHER_CRC_LEN)) { ifp->if_ierrors++; goto tr_setup; } Modified: stable/8/sys/dev/usb/net/uhso.c ============================================================================== --- stable/8/sys/dev/usb/net/uhso.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/net/uhso.c Wed Jun 6 07:46:14 2012 (r236667) @@ -482,9 +482,9 @@ static device_method_t uhso_methods[] = }; static driver_t uhso_driver = { - "uhso", - uhso_methods, - sizeof(struct uhso_softc) + .name = "uhso", + .methods = uhso_methods, + .size = sizeof(struct uhso_softc) }; static devclass_t uhso_devclass; @@ -1366,7 +1366,7 @@ uhso_bs_intr_callback(struct usb_xfer *x UHSO_DPRINTF(0, "UCDC notification too short: %d\n", actlen); goto tr_setup; } - else if (actlen > sizeof(struct usb_cdc_notification)) { + else if (actlen > (int)sizeof(struct usb_cdc_notification)) { UHSO_DPRINTF(0, "UCDC notification too large: %d\n", actlen); actlen = sizeof(struct usb_cdc_notification); } Modified: stable/8/sys/dev/usb/serial/ubsa.c ============================================================================== --- stable/8/sys/dev/usb/serial/ubsa.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/serial/ubsa.c Wed Jun 6 07:46:14 2012 (r236667) @@ -627,7 +627,7 @@ ubsa_intr_callback(struct usb_xfer *xfer switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - if (actlen >= sizeof(buf)) { + if (actlen >= (int)sizeof(buf)) { pc = usbd_xfer_get_frame(xfer, 0); usbd_copy_out(pc, 0, buf, sizeof(buf)); Modified: stable/8/sys/dev/usb/serial/uchcom.c ============================================================================== --- stable/8/sys/dev/usb/serial/uchcom.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/serial/uchcom.c Wed Jun 6 07:46:14 2012 (r236667) @@ -846,9 +846,9 @@ static device_method_t uchcom_methods[] }; static driver_t uchcom_driver = { - "ucom", - uchcom_methods, - sizeof(struct uchcom_softc) + .name = "ucom", + .methods = uchcom_methods, + .size = sizeof(struct uchcom_softc) }; static devclass_t uchcom_devclass; Modified: stable/8/sys/dev/usb/serial/ucycom.c ============================================================================== --- stable/8/sys/dev/usb/serial/ucycom.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/serial/ucycom.c Wed Jun 6 07:46:14 2012 (r236667) @@ -519,7 +519,7 @@ ucycom_intr_read_callback(struct usb_xfe struct usb_page_cache *pc; uint8_t buf[2]; uint32_t offset; - uint32_t len; + int len; int actlen; usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); Modified: stable/8/sys/dev/usb/serial/ufoma.c ============================================================================== --- stable/8/sys/dev/usb/serial/ufoma.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/serial/ufoma.c Wed Jun 6 07:46:14 2012 (r236667) @@ -684,7 +684,7 @@ ufoma_intr_callback(struct usb_xfer *xfe DPRINTF("too short message\n"); goto tr_setup; } - if (actlen > sizeof(pkt)) { + if (actlen > (int)sizeof(pkt)) { DPRINTF("truncating message\n"); actlen = sizeof(pkt); } Modified: stable/8/sys/dev/usb/serial/ulpt.c ============================================================================== --- stable/8/sys/dev/usb/serial/ulpt.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/serial/ulpt.c Wed Jun 6 07:46:14 2012 (r236667) @@ -543,7 +543,7 @@ ulpt_attach(device_t dev) /* search through all the descriptors looking for bidir mode */ id = usbd_get_interface_descriptor(uaa->iface); - alt_index = 0 - 1; + alt_index = 0xFF; while (1) { if (id == NULL) { break; @@ -631,14 +631,14 @@ found: error = usb_fifo_attach(uaa->device, sc, &sc->sc_mtx, &ulpt_fifo_methods, &sc->sc_fifo, - unit, 0 - 1, uaa->info.bIfaceIndex, + unit, -1, uaa->info.bIfaceIndex, UID_ROOT, GID_OPERATOR, 0644); if (error) { goto detach; } error = usb_fifo_attach(uaa->device, sc, &sc->sc_mtx, &unlpt_fifo_methods, &sc->sc_fifo_noreset, - unit, 0 - 1, uaa->info.bIfaceIndex, + unit, -1, uaa->info.bIfaceIndex, UID_ROOT, GID_OPERATOR, 0644); if (error) { goto detach; Modified: stable/8/sys/dev/usb/serial/umodem.c ============================================================================== --- stable/8/sys/dev/usb/serial/umodem.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/serial/umodem.c Wed Jun 6 07:46:14 2012 (r236667) @@ -317,7 +317,7 @@ umodem_attach(device_t dev) cud = usbd_find_descriptor(uaa->device, NULL, uaa->info.bIfaceIndex, UDESC_CS_INTERFACE, - 0 - 1, UDESCSUB_CDC_UNION, 0 - 1); + 0xFF, UDESCSUB_CDC_UNION, 0xFF); if ((cud == NULL) || (cud->bLength < sizeof(*cud))) { DPRINTF("Missing descriptor. " @@ -702,7 +702,7 @@ umodem_intr_callback(struct usb_xfer *xf "%d bytes\n", actlen); goto tr_setup; } - if (actlen > sizeof(pkt)) { + if (actlen > (int)sizeof(pkt)) { DPRINTF("truncating message\n"); actlen = sizeof(pkt); } @@ -842,7 +842,7 @@ static void * umodem_get_desc(struct usb_attach_arg *uaa, uint8_t type, uint8_t subtype) { return (usbd_find_descriptor(uaa->device, NULL, uaa->info.bIfaceIndex, - type, 0 - 1, subtype, 0 - 1)); + type, 0xFF, subtype, 0xFF)); } static usb_error_t Modified: stable/8/sys/dev/usb/serial/uplcom.c ============================================================================== --- stable/8/sys/dev/usb/serial/uplcom.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/serial/uplcom.c Wed Jun 6 07:46:14 2012 (r236667) @@ -606,7 +606,7 @@ uplcom_cfg_set_break(struct ucom_softc * &req, NULL, 0, 1000); } -static const int32_t uplcom_rates[] = { +static const uint32_t uplcom_rates[] = { 75, 150, 300, 600, 1200, 1800, 2400, 3600, 4800, 7200, 9600, 14400, 19200, 28800, 38400, 57600, 115200, /* Modified: stable/8/sys/dev/usb/serial/usb_serial.c ============================================================================== --- stable/8/sys/dev/usb/serial/usb_serial.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/serial/usb_serial.c Wed Jun 6 07:46:14 2012 (r236667) @@ -236,14 +236,14 @@ ucom_unit_free(int unit) */ int ucom_attach(struct ucom_super_softc *ssc, struct ucom_softc *sc, - uint32_t subunits, void *parent, + int subunits, void *parent, const struct ucom_callback *callback, struct mtx *mtx) { - uint32_t subunit; + int subunit; int error = 0; if ((sc == NULL) || - (subunits == 0) || + (subunits <= 0) || (callback == NULL)) { return (EINVAL); } @@ -287,7 +287,7 @@ ucom_attach(struct ucom_super_softc *ssc void ucom_detach(struct ucom_super_softc *ssc, struct ucom_softc *sc) { - uint32_t subunit; + int subunit; if (ssc->sc_subunits == 0) return; /* not initialized */ @@ -1056,11 +1056,6 @@ ucom_param(struct tty *tp, struct termio DPRINTF("sc = %p\n", sc); /* Check requested parameters. */ - if (t->c_ospeed < 0) { - DPRINTF("negative ospeed\n"); - error = EINVAL; - goto done; - } if (t->c_ispeed && (t->c_ispeed != t->c_ospeed)) { DPRINTF("mismatch ispeed and ospeed\n"); error = EINVAL; Modified: stable/8/sys/dev/usb/serial/usb_serial.h ============================================================================== --- stable/8/sys/dev/usb/serial/usb_serial.h Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/serial/usb_serial.h Wed Jun 6 07:46:14 2012 (r236667) @@ -163,7 +163,7 @@ struct ucom_softc { struct tty *sc_tty; struct mtx *sc_mtx; void *sc_parent; - uint32_t sc_subunit; + int sc_subunit; uint16_t sc_portno; uint16_t sc_flag; #define UCOM_FLAG_RTS_IFLOW 0x01 /* use RTS input flow control */ @@ -191,7 +191,7 @@ struct ucom_softc { usbd_do_request_proc(udev,&(com)->sc_super->sc_tq,req,ptr,flags,NULL,timo) int ucom_attach(struct ucom_super_softc *, - struct ucom_softc *, uint32_t, void *, + struct ucom_softc *, int, void *, const struct ucom_callback *callback, struct mtx *); void ucom_detach(struct ucom_super_softc *, struct ucom_softc *); void ucom_set_pnpinfo_usb(struct ucom_super_softc *, device_t); Modified: stable/8/sys/dev/usb/storage/umass.c ============================================================================== --- stable/8/sys/dev/usb/storage/umass.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/storage/umass.c Wed Jun 6 07:46:14 2012 (r236667) @@ -1482,7 +1482,7 @@ umass_t_bbb_status_callback(struct usb_x /* Zero missing parts of the CSW: */ - if (actlen < sizeof(sc->csw)) + if (actlen < (int)sizeof(sc->csw)) memset(&sc->csw, 0, sizeof(sc->csw)); pc = usbd_xfer_get_frame(xfer, 0); @@ -2016,7 +2016,7 @@ umass_t_cbi_status_callback(struct usb_x switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - if (actlen < sizeof(sc->sbl)) { + if (actlen < (int)sizeof(sc->sbl)) { goto tr_setup; } pc = usbd_xfer_get_frame(xfer, 0); Modified: stable/8/sys/dev/usb/storage/urio.c ============================================================================== --- stable/8/sys/dev/usb/storage/urio.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/storage/urio.c Wed Jun 6 07:46:14 2012 (r236667) @@ -246,7 +246,7 @@ urio_attach(device_t dev) error = usb_fifo_attach(uaa->device, sc, &sc->sc_mtx, &urio_fifo_methods, &sc->sc_fifo, - device_get_unit(dev), 0 - 1, uaa->info.bIfaceIndex, + device_get_unit(dev), -1, uaa->info.bIfaceIndex, UID_ROOT, GID_OPERATOR, 0644); if (error) { goto detach; Modified: stable/8/sys/dev/usb/storage/ustorage_fs.c ============================================================================== --- stable/8/sys/dev/usb/storage/ustorage_fs.c Wed Jun 6 06:52:51 2012 (r236666) +++ stable/8/sys/dev/usb/storage/ustorage_fs.c Wed Jun 6 07:46:14 2012 (r236667) @@ -964,7 +964,7 @@ ustorage_fs_verify(struct ustorage_fs_so } /* XXX TODO: verify that data is readable */ done: - return (ustorage_fs_min_len(sc, 0, 0 - 1)); + return (ustorage_fs_min_len(sc, 0, -1U)); } /*------------------------------------------------------------------------* @@ -986,7 +986,7 @@ ustorage_fs_inquiry(struct ustorage_fs_s memset(buf, 0, 36); buf[0] = 0x7f; /* Unsupported, no device - type */ - return (ustorage_fs_min_len(sc, 36, 0 - 1)); + return (ustorage_fs_min_len(sc, 36, -1U)); } memset(buf, 0, 8); /* Non - removable, direct - access device */ @@ -1005,7 +1005,7 @@ ustorage_fs_inquiry(struct ustorage_fs_s #if (USTORAGE_QDATA_MAX < 36) #error "(USTORAGE_QDATA_MAX < 36)" #endif - return (ustorage_fs_min_len(sc, 36, 0 - 1)); + return (ustorage_fs_min_len(sc, 36, -1U)); } /*------------------------------------------------------------------------* @@ -1074,7 +1074,7 @@ ustorage_fs_request_sense(struct ustorag #if (USTORAGE_QDATA_MAX < 18) #error "(USTORAGE_QDATA_MAX < 18)" #endif - return (ustorage_fs_min_len(sc, 18, 0 - 1)); + return (ustorage_fs_min_len(sc, 18, -1U)); } /*------------------------------------------------------------------------* @@ -1105,7 +1105,7 @@ ustorage_fs_read_capacity(struct ustorag #if (USTORAGE_QDATA_MAX < 8) #error "(USTORAGE_QDATA_MAX < 8)" #endif - return (ustorage_fs_min_len(sc, 8, 0 - 1)); + return (ustorage_fs_min_len(sc, 8, -1U)); } /*------------------------------------------------------------------------* @@ -1212,7 +1212,7 @@ ustorage_fs_mode_sense(struct ustorage_f #if (USTORAGE_QDATA_MAX < 24) #error "(USTORAGE_QDATA_MAX < 24)" #endif - return (ustorage_fs_min_len(sc, len, 0 - 1)); + return (ustorage_fs_min_len(sc, len, -1U)); } /*------------------------------------------------------------------------* @@ -1302,7 +1302,7 @@ ustorage_fs_read_format_capacities(struc #if (USTORAGE_QDATA_MAX < 12) #error "(USTORAGE_QDATA_MAX < 12)" #endif - return (ustorage_fs_min_len(sc, 12, 0 - 1)); + return (ustorage_fs_min_len(sc, 12, -1U)); } /*------------------------------------------------------------------------* @@ -1615,7 +1615,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so switch (sc->sc_cmd_data[0]) { case SC_INQUIRY: sc->sc_transfer.cmd_dir = DIR_WRITE; - error = ustorage_fs_min_len(sc, sc->sc_cmd_data[4], 0 - 1); + error = ustorage_fs_min_len(sc, sc->sc_cmd_data[4], -1U); if (error) { break; } @@ -1630,7 +1630,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_MODE_SELECT_6: sc->sc_transfer.cmd_dir = DIR_READ; - error = ustorage_fs_min_len(sc, sc->sc_cmd_data[4], 0 - 1); + error = ustorage_fs_min_len(sc, sc->sc_cmd_data[4], -1U); if (error) { break; } @@ -1646,7 +1646,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_MODE_SELECT_10: sc->sc_transfer.cmd_dir = DIR_READ; error = ustorage_fs_min_len(sc, - get_be16(&sc->sc_cmd_data[7]), 0 - 1); + get_be16(&sc->sc_cmd_data[7]), -1U); if (error) { break; } @@ -1661,7 +1661,7 @@ ustorage_fs_do_cmd(struct ustorage_fs_so case SC_MODE_SENSE_6: sc->sc_transfer.cmd_dir = DIR_WRITE; - error = ustorage_fs_min_len(sc, sc->sc_cmd_data[4], 0 - 1); + error = ustorage_fs_min_len(sc, sc->sc_cmd_data[4], -1U); if (error) { break; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 6 11:40:17 2012 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 4ED0D10656EA; Wed, 6 Jun 2012 11:40:17 +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 1F6858FC20; Wed, 6 Jun 2012 11:40:17 +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 q56BeGWO011199; Wed, 6 Jun 2012 11:40:16 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q56BeGXV011197; Wed, 6 Jun 2012 11:40:16 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206061140.q56BeGXV011197@svn.freebsd.org> From: Alexander Motin Date: Wed, 6 Jun 2012 11:40:16 +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: r236674 - stable/8/sys/cam/scsi 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: Wed, 06 Jun 2012 11:40:17 -0000 Author: mav Date: Wed Jun 6 11:40:16 2012 New Revision: 236674 URL: http://svn.freebsd.org/changeset/base/236674 Log: MFC r208896, r208900 (by mjacob): Do a minor amount of stylifying. Also, get a Fibre Channel WWPN if one exists for a da unit and create a sysctl OID for it. Modified: stable/8/sys/cam/scsi/scsi_da.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_da.c Wed Jun 6 10:56:59 2012 (r236673) +++ stable/8/sys/cam/scsi/scsi_da.c Wed Jun 6 11:40:16 2012 (r236674) @@ -136,6 +136,7 @@ struct da_softc { struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; struct callout sendordered_c; + uint64_t wwpn; }; struct da_quirk_entry { @@ -1312,6 +1313,7 @@ dasysctlinit(void *context, int pending) struct cam_periph *periph; struct da_softc *softc; char tmpstr[80], tmpstr2[80]; + struct ccb_trans_settings cts; periph = (struct cam_periph *)context; /* @@ -1338,14 +1340,38 @@ dasysctlinit(void *context, int pending) } /* - * Now register the sysctl handler, so the user can the value on + * Now register the sysctl handler, so the user can change the value on * the fly. */ - SYSCTL_ADD_PROC(&softc->sysctl_ctx,SYSCTL_CHILDREN(softc->sysctl_tree), + SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "minimum_cmd_size", CTLTYPE_INT | CTLFLAG_RW, &softc->minimum_cmd_size, 0, dacmdsizesysctl, "I", "Minimum CDB size"); + /* + * Add some addressing info. + */ + memset(&cts, 0, sizeof (cts)); + xpt_setup_ccb(&cts.ccb_h, periph->path, /*priority*/1); + cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; + cts.type = CTS_TYPE_CURRENT_SETTINGS; + cam_periph_lock(periph); + xpt_action((union ccb *)&cts); + cam_periph_unlock(periph); + if (cts.ccb_h.status != CAM_REQ_CMP) { + cam_periph_release(periph); + return; + } + if (cts.protocol == PROTO_SCSI && cts.transport == XPORT_FC) { + struct ccb_trans_settings_fc *fc = &cts.xport_specific.fc; + if (fc->valid & CTS_FC_VALID_WWPN) { + softc->wwpn = fc->wwpn; + SYSCTL_ADD_XLONG(&softc->sysctl_ctx, + SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "wwpn", CTLTYPE_QUAD | CTLFLAG_RD, + &softc->wwpn, "World Wide Port Name"); + } + } cam_periph_release(periph); } From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 6 11:46:38 2012 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 562211065678; Wed, 6 Jun 2012 11:46:38 +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 357E88FC25; Wed, 6 Jun 2012 11:46:38 +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 q56Bkces011575; Wed, 6 Jun 2012 11:46:38 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q56BkcD3011570; Wed, 6 Jun 2012 11:46:38 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206061146.q56BkcD3011570@svn.freebsd.org> From: Alexander Motin Date: Wed, 6 Jun 2012 11:46:38 +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: r236675 - in stable/8/sys/cam: . scsi 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: Wed, 06 Jun 2012 11:46:38 -0000 Author: mav Date: Wed Jun 6 11:46:37 2012 New Revision: 236675 URL: http://svn.freebsd.org/changeset/base/236675 Log: MFC r208911 (by mjacob): Implement the usage of Report Luns as part of SCSI probing for SCP3 or better devices. This can be disabled on a per-device basis using quirks as well. This also handles the case where there is actually no connected LUN 0 (which can definitely be the case for storage arrays). Modified: stable/8/sys/cam/cam_debug.h stable/8/sys/cam/cam_xpt.c stable/8/sys/cam/cam_xpt_internal.h stable/8/sys/cam/scsi/scsi_xpt.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/cam_debug.h ============================================================================== --- stable/8/sys/cam/cam_debug.h Wed Jun 6 11:40:16 2012 (r236674) +++ stable/8/sys/cam/cam_debug.h Wed Jun 6 11:46:37 2012 (r236675) @@ -40,7 +40,8 @@ typedef enum { CAM_DEBUG_SUBTRACE = 0x04, /* internal to routine flows */ CAM_DEBUG_CDB = 0x08, /* print out SCSI CDBs only */ CAM_DEBUG_XPT = 0x10, /* print out xpt scheduling */ - CAM_DEBUG_PERIPH = 0x20 /* print out peripheral calls */ + CAM_DEBUG_PERIPH = 0x20, /* print out peripheral calls */ + CAM_DEBUG_PROBE = 0x40 /* print out probe actions */ } cam_debug_flags; #if defined(CAMDEBUG) && defined(_KERNEL) @@ -58,6 +59,7 @@ extern u_int32_t cam_debug_delay; && (cam_dpath != NULL) \ && (xpt_path_comp(cam_dpath, path) >= 0) \ && (xpt_path_comp(cam_dpath, path) < 2)) + #define CAM_DEBUG(path, flag, printfargs) \ if ((cam_dflags & (flag)) \ && (cam_dpath != NULL) \ @@ -68,6 +70,7 @@ extern u_int32_t cam_debug_delay; if (cam_debug_delay != 0) \ DELAY(cam_debug_delay); \ } + #define CAM_DEBUG_PRINT(flag, printfargs) \ if (cam_dflags & (flag)) { \ printf("cam_debug: "); \ @@ -76,11 +79,20 @@ extern u_int32_t cam_debug_delay; DELAY(cam_debug_delay); \ } +#define CAM_DEBUG_PATH_PRINT(flag, path, printfargs) \ + if (cam_dflags & (flag)) { \ + xpt_print(path, "cam_debug: "); \ + printf printfargs; \ + if (cam_debug_delay != 0) \ + DELAY(cam_debug_delay); \ + } + #else /* !CAMDEBUG || !_KERNEL */ #define CAM_DEBUGGED(A, B) 0 #define CAM_DEBUG(A, B, C) #define CAM_DEBUG_PRINT(A, B) +#define CAM_DEBUG_PATH_PRINT(A, B, C) #endif /* CAMDEBUG && _KERNEL */ Modified: stable/8/sys/cam/cam_xpt.c ============================================================================== --- stable/8/sys/cam/cam_xpt.c Wed Jun 6 11:40:16 2012 (r236674) +++ stable/8/sys/cam/cam_xpt.c Wed Jun 6 11:46:37 2012 (r236675) @@ -191,8 +191,18 @@ static struct cdevsw xpt_cdevsw = { /* Storage for debugging datastructures */ #ifdef CAMDEBUG struct cam_path *cam_dpath; -u_int32_t cam_dflags; +#ifdef CAM_DEBUG_FLAGS +u_int32_t cam_dflags = CAM_DEBUG_FLAGS; +#else +u_int32_t cam_dflags = CAM_DEBUG_NONE; +#endif +TUNABLE_INT("kern.cam.dflags", &cam_dflags); +SYSCTL_INT(_kern_cam, OID_AUTO, dflags, CTLFLAG_RW, + &cam_dflags, 0, "Cam Debug Flags"); u_int32_t cam_debug_delay; +TUNABLE_INT("kern.cam.debug_delay", &cam_debug_delay); +SYSCTL_INT(_kern_cam, OID_AUTO, debug_delay, CTLFLAG_RW, + &cam_debug_delay, 0, "Cam Debug Flags"); #endif /* Our boot-time initialization hook */ @@ -4369,6 +4379,7 @@ xpt_alloc_target(struct cam_eb *bus, tar target->target_id = target_id; target->refcount = 1; target->generation = 0; + target->luns = NULL; timevalclear(&target->last_reset); /* * Hold a reference to our parent bus so it @@ -4400,6 +4411,8 @@ xpt_release_target(struct cam_et *target TAILQ_REMOVE(&target->bus->et_entries, target, links); target->bus->generation++; xpt_release_bus(target->bus); + if (target->luns) + free(target->luns, M_CAMXPT); free(target, M_CAMXPT); } } @@ -4662,11 +4675,6 @@ xpt_config(void *arg) #ifdef CAMDEBUG /* Setup debugging flags and path */ -#ifdef CAM_DEBUG_FLAGS - cam_dflags = CAM_DEBUG_FLAGS; -#else /* !CAM_DEBUG_FLAGS */ - cam_dflags = CAM_DEBUG_NONE; -#endif /* CAM_DEBUG_FLAGS */ #ifdef CAM_DEBUG_BUS if (cam_dflags != CAM_DEBUG_NONE) { /* Modified: stable/8/sys/cam/cam_xpt_internal.h ============================================================================== --- stable/8/sys/cam/cam_xpt_internal.h Wed Jun 6 11:40:16 2012 (r236674) +++ stable/8/sys/cam/cam_xpt_internal.h Wed Jun 6 11:46:37 2012 (r236675) @@ -135,6 +135,8 @@ struct cam_et { u_int32_t refcount; u_int generation; struct timeval last_reset; + u_int rpl_size; + struct scsi_report_luns_data *luns; }; /* Modified: stable/8/sys/cam/scsi/scsi_xpt.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_xpt.c Wed Jun 6 11:40:16 2012 (r236674) +++ stable/8/sys/cam/scsi/scsi_xpt.c Wed Jun 6 11:46:37 2012 (r236675) @@ -71,6 +71,7 @@ struct scsi_quirk_entry { #define CAM_QUIRK_NOSERIAL 0x02 #define CAM_QUIRK_HILUNS 0x04 #define CAM_QUIRK_NOHILUNS 0x08 +#define CAM_QUIRK_NORPTLUNS 0x10 u_int mintags; u_int maxtags; }; @@ -84,6 +85,21 @@ SYSCTL_PROC(_kern_cam, OID_AUTO, cam_src "allow search above LUN 7 for SCSI3 and greater devices"); #define CAM_SCSI2_MAXLUN 8 +#define CAM_CAN_GET_SIMPLE_LUN(x, i) \ + ((((x)->luns[i].lundata[0] & RPL_LUNDATA_ATYP_MASK) == \ + RPL_LUNDATA_ATYP_PERIPH) || \ + (((x)->luns[i].lundata[0] & RPL_LUNDATA_ATYP_MASK) == \ + RPL_LUNDATA_ATYP_FLAT)) +#define CAM_GET_SIMPLE_LUN(lp, i, lval) \ + if (((lp)->luns[(i)].lundata[0] & RPL_LUNDATA_ATYP_MASK) == \ + RPL_LUNDATA_ATYP_PERIPH) { \ + (lval) = (lp)->luns[(i)].lundata[1]; \ + } else { \ + (lval) = (lp)->luns[(i)].lundata[0]; \ + (lval) &= RPL_LUNDATA_FLAT_LUN_MASK; \ + (lval) <<= 8; \ + (lval) |= (lp)->luns[(i)].lundata[1]; \ + } /* * If we're not quirked to search <= the first 8 luns * and we are either quirked to search above lun 8, @@ -116,6 +132,7 @@ typedef enum { PROBE_TUR, PROBE_INQUIRY, /* this counts as DV0 for Basic Domain Validation */ PROBE_FULL_INQUIRY, + PROBE_REPORT_LUNS, PROBE_MODE_SENSE, PROBE_SERIAL_NUM_0, PROBE_SERIAL_NUM_1, @@ -130,6 +147,7 @@ static char *probe_action_text[] = { "PROBE_TUR", "PROBE_INQUIRY", "PROBE_FULL_INQUIRY", + "PROBE_REPORT_LUNS", "PROBE_MODE_SENSE", "PROBE_SERIAL_NUM_0", "PROBE_SERIAL_NUM_1", @@ -531,6 +549,10 @@ static void proberequestdefaultnegotiat static int proberequestbackoff(struct cam_periph *periph, struct cam_ed *device); static void probedone(struct cam_periph *periph, union ccb *done_ccb); +static int probe_strange_rpl_data(struct scsi_report_luns_data *rp, + uint32_t maxlun); +static void probe_purge_old(struct cam_path *path, + struct scsi_report_luns_data *new); static void probecleanup(struct cam_periph *periph); static void scsi_find_quirk(struct cam_ed *device); static void scsi_scan_bus(struct cam_periph *periph, union ccb *ccb); @@ -689,6 +711,7 @@ probestart(struct cam_periph *periph, un softc = (probe_softc *)periph->softc; csio = &start_ccb->csio; +again: switch (softc->action) { case PROBE_TUR: @@ -777,6 +800,28 @@ probestart(struct cam_periph *periph, un /*timeout*/60 * 1000); break; } + case PROBE_REPORT_LUNS: + { + void *rp; + + rp = malloc(periph->path->target->rpl_size, + M_CAMXPT, M_NOWAIT | M_ZERO); + if (rp == NULL) { + struct scsi_inquiry_data *inq_buf; + inq_buf = &periph->path->device->inq_data; + xpt_print(periph->path, + "Unable to alloc report luns storage\n"); + if (INQ_DATA_TQ_ENABLED(inq_buf)) + PROBE_SET_ACTION(softc, PROBE_MODE_SENSE); + else + PROBE_SET_ACTION(softc, PROBE_SERIAL_NUM_0); + goto again; + } + scsi_report_luns(csio, 5, probedone, MSG_SIMPLE_Q_TAG, + RPL_REPORT_DEFAULT, rp, periph->path->target->rpl_size, + SSD_FULL_SIZE, 60000); break; + break; + } case PROBE_MODE_SENSE: { void *mode_buf; @@ -1049,9 +1094,7 @@ probedone(struct cam_periph *periph, uni periph_qual = SID_QUAL(inq_buf); - switch(periph_qual) { - case SID_QUAL_LU_CONNECTED: - { + if (periph_qual == SID_QUAL_LU_CONNECTED) { u_int8_t len; /* @@ -1078,10 +1121,23 @@ probedone(struct cam_periph *periph, uni scsi_find_quirk(path->device); scsi_devise_transport(path); - if (INQ_DATA_TQ_ENABLED(inq_buf)) - PROBE_SET_ACTION(softc, PROBE_MODE_SENSE); + + if (path->device->lun_id == 0 && + SID_ANSI_REV(inq_buf) > SCSI_REV_SPC2 && + (SCSI_QUIRK(path->device)->quirks & + CAM_QUIRK_NORPTLUNS) == 0) { + PROBE_SET_ACTION(softc, + PROBE_REPORT_LUNS); + /* + * Start with room for *one* lun. + */ + periph->path->target->rpl_size = 16; + } else if (INQ_DATA_TQ_ENABLED(inq_buf)) + PROBE_SET_ACTION(softc, + PROBE_MODE_SENSE); else - PROBE_SET_ACTION(softc, PROBE_SERIAL_NUM_0); + PROBE_SET_ACTION(softc, + PROBE_SERIAL_NUM_0); if (path->device->flags & CAM_DEV_UNCONFIGURED) { path->device->flags &= ~CAM_DEV_UNCONFIGURED; @@ -1090,9 +1146,21 @@ probedone(struct cam_periph *periph, uni xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; - } - default: - break; + } else if (path->device->lun_id == 0 && + SID_ANSI_REV(inq_buf) > SCSI_REV_SPC2 && + (SCSI_QUIRK(path->device)->quirks & + CAM_QUIRK_NORPTLUNS) == 0) { + if (path->device->flags & + CAM_DEV_UNCONFIGURED) { + path->device->flags &= + ~CAM_DEV_UNCONFIGURED; + xpt_acquire_device(path->device); + } + PROBE_SET_ACTION(softc, PROBE_REPORT_LUNS); + periph->path->target->rpl_size = 16; + xpt_release_ccb(done_ccb); + xpt_schedule(periph, priority); + return; } } else if (cam_periph_error(done_ccb, 0, done_ccb->ccb_h.target_lun > 0 @@ -1122,6 +1190,120 @@ probedone(struct cam_periph *periph, uni xpt_release_ccb(done_ccb); break; } + case PROBE_REPORT_LUNS: + { + struct ccb_scsiio *csio; + struct scsi_report_luns_data *lp; + u_int nlun, maxlun; + + csio = &done_ccb->csio; + + lp = (struct scsi_report_luns_data *)csio->data_ptr; + nlun = scsi_4btoul(lp->length) / 8; + maxlun = (csio->dxfer_len / 8) - 1; + + if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if (cam_periph_error(done_ccb, 0, + done_ccb->ccb_h.target_lun > 0 ? + SF_RETRY_UA|SF_QUIET_IR : SF_RETRY_UA, + &softc->saved_ccb) == ERESTART) { + return; + } + if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { + xpt_release_devq(done_ccb->ccb_h.path, 1, + TRUE); + } + free(lp, M_CAMXPT); + lp = NULL; + } else if (nlun > maxlun) { + /* + * Reallocate and retry to cover all luns + */ + CAM_DEBUG_PATH_PRINT(CAM_DEBUG_PROBE, path, + ("reallocating REPORT_LUNS for %u luns\n", nlun)); + free(lp, M_CAMXPT); + path->target->rpl_size = (nlun << 3) + 8; + xpt_release_ccb(done_ccb); + xpt_schedule(periph, priority); + return; + } else if (nlun == 0) { + /* + * If there don't appear to be any luns, bail. + */ + free(lp, M_CAMXPT); + lp = NULL; + } else if (probe_strange_rpl_data(lp, maxlun)) { + /* + * If we can't understand the lun format + * of any entry, bail. + */ + free(lp, M_CAMXPT); + lp = NULL; + } else { + lun_id_t lun; + int idx; + + CAM_DEBUG_PATH_PRINT(CAM_DEBUG_PROBE, path, + ("%u luns reported\n", nlun)); + + CAM_GET_SIMPLE_LUN(lp, 0, lun); + /* + * If the first lun is not lun 0, then either there + * is no lun 0 in the list, or the list is unsorted. + */ + if (lun != 0) { + for (idx = 0; idx < nlun; idx++) { + CAM_GET_SIMPLE_LUN(lp, idx, lun); + if (lun == 0) { + break; + } + } + if (idx != nlun) { + uint8_t tlun[8]; + memcpy(tlun, + lp->luns[0].lundata, 8); + memcpy(lp->luns[0].lundata, + lp->luns[idx].lundata, 8); + memcpy(lp->luns[idx].lundata, + tlun, 8); + CAM_DEBUG_PATH_PRINT(CAM_DEBUG_PROBE, + path, ("lun 0 in position %u\n", idx)); + } else { + /* + * There is no lun 0 in our list. Destroy + * the validity of the inquiry data so we + * bail here and now. + */ + path->device->flags &= + ~CAM_DEV_INQUIRY_DATA_VALID; + } + } + /* + * If we have an old lun list, We can either + * retest luns that appear to have been dropped, + * or just nuke them. We'll opt for the latter. + * This function will also install the new list + * in the target structure. + */ + probe_purge_old(path, lp); + lp = NULL; + } + if (path->device->flags & CAM_DEV_INQUIRY_DATA_VALID) { + struct scsi_inquiry_data *inq_buf; + inq_buf = &path->device->inq_data; + if (INQ_DATA_TQ_ENABLED(inq_buf)) + PROBE_SET_ACTION(softc, PROBE_MODE_SENSE); + else + PROBE_SET_ACTION(softc, PROBE_SERIAL_NUM_0); + xpt_release_ccb(done_ccb); + xpt_schedule(periph, priority); + return; + } + if (lp) { + free(lp, M_CAMXPT); + } + break; + } case PROBE_MODE_SENSE: { struct ccb_scsiio *csio; @@ -1436,6 +1618,80 @@ probedone(struct cam_periph *periph, uni } } +static int +probe_strange_rpl_data(struct scsi_report_luns_data *rp, uint32_t maxlun) +{ + uint32_t idx; + uint32_t nlun = MIN(maxlun, (scsi_4btoul(rp->length) / 8)); + + for (idx = 0; idx < nlun; idx++) { + if (!CAM_CAN_GET_SIMPLE_LUN(rp, idx)) { + return (-1); + } + } + return (0); +} + +static void +probe_purge_old(struct cam_path *path, struct scsi_report_luns_data *new) +{ + struct cam_path *tp; + struct scsi_report_luns_data *old; + u_int idx1, idx2, nlun_old, nlun_new, this_lun; + u_int8_t *ol, *nl; + + if (path->target == NULL) { + return; + } + if (path->target->luns == NULL) { + path->target->luns = new; + return; + } + old = path->target->luns; + nlun_old = scsi_4btoul(old->length) / 8; + nlun_new = scsi_4btoul(new->length) / 8; + + /* + * We are not going to assume sorted lists. Deal. + */ + for (idx1 = 0; idx1 < nlun_old; idx1++) { + ol = old->luns[idx1].lundata; + for (idx2 = 0; idx2 < nlun_new; idx2++) { + nl = new->luns[idx2].lundata; + if (memcmp(nl, ol, 8) == 0) { + break; + } + } + if (idx2 < nlun_new) { + continue; + } + /* + * An 'old' item not in the 'new' list. + * Nuke it. Except that if it is lun 0, + * that would be what the probe state + * machine is currently working on, + * so we won't do that. + * + * We also cannot nuke it if it is + * not in a lun format we understand. + */ + if (!CAM_CAN_GET_SIMPLE_LUN(old, idx1)) { + continue; + } + CAM_GET_SIMPLE_LUN(old, idx1, this_lun); + if (this_lun == 0) { + continue; + } + if (xpt_create_path(&tp, NULL, xpt_path_path_id(path), + xpt_path_target_id(path), this_lun) == CAM_REQ_CMP) { + xpt_async(AC_LOST_DEVICE, tp, NULL); + xpt_free_path(tp); + } + } + free(old, M_CAMXPT); + path->target->luns = new; +} + static void probecleanup(struct cam_periph *periph) { @@ -1484,6 +1740,7 @@ typedef struct { union ccb *request_ccb; struct ccb_pathinq *cpi; int counter; + int lunindex[0]; } scsi_scan_bus_info; /* @@ -1557,13 +1814,15 @@ scsi_scan_bus(struct cam_periph *periph, } /* Save some state for use while we probe for devices */ - scan_info = (scsi_scan_bus_info *) - malloc(sizeof(scsi_scan_bus_info), M_CAMXPT, M_NOWAIT); + scan_info = (scsi_scan_bus_info *) malloc(sizeof(scsi_scan_bus_info) + + (work_ccb->cpi.max_target * sizeof (u_int)), M_CAMXPT, M_ZERO|M_NOWAIT); if (scan_info == NULL) { request_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; xpt_done(request_ccb); return; } + CAM_DEBUG_PATH_PRINT(CAM_DEBUG_PROBE, request_ccb->ccb_h.path, + ("SCAN start for %p\n", scan_info)); scan_info->request_ccb = request_ccb; scan_info->cpi = &work_ccb->cpi; @@ -1630,26 +1889,76 @@ scsi_scan_bus(struct cam_periph *periph, case XPT_SCAN_LUN: { cam_status status; - struct cam_path *path; + struct cam_path *path, *oldpath; scsi_scan_bus_info *scan_info; + struct cam_et *target; + struct cam_ed *device; + int next_target; path_id_t path_id; target_id_t target_id; lun_id_t lun_id; + oldpath = request_ccb->ccb_h.path; + + status = request_ccb->ccb_h.status & CAM_STATUS_MASK; /* Reuse the same CCB to query if a device was really found */ scan_info = (scsi_scan_bus_info *)request_ccb->ccb_h.ppriv_ptr0; xpt_setup_ccb(&request_ccb->ccb_h, request_ccb->ccb_h.path, request_ccb->ccb_h.pinfo.priority); request_ccb->ccb_h.func_code = XPT_GDEV_TYPE; + path_id = request_ccb->ccb_h.path_id; target_id = request_ccb->ccb_h.target_id; lun_id = request_ccb->ccb_h.target_lun; xpt_action(request_ccb); - if (request_ccb->ccb_h.status != CAM_REQ_CMP) { - struct cam_ed *device; - struct cam_et *target; + target = request_ccb->ccb_h.path->target; + next_target = 1; + + if (target->luns) { + uint32_t first; + u_int nluns = scsi_4btoul(target->luns->length) / 8; + + /* + * Make sure we skip over lun 0 if it's the first member + * of the list as we've actually just finished probing + * it. + */ + CAM_GET_SIMPLE_LUN(target->luns, 0, first); + if (first == 0 && scan_info->lunindex[target_id] == 0) { + scan_info->lunindex[target_id]++; + } + + if (scan_info->lunindex[target_id] < nluns) { + CAM_GET_SIMPLE_LUN(target->luns, + scan_info->lunindex[target_id], lun_id); + next_target = 0; + CAM_DEBUG_PATH_PRINT(CAM_DEBUG_PROBE, + request_ccb->ccb_h.path, + ("next lun to try at index %u is %u\n", + scan_info->lunindex[target_id], lun_id)); + scan_info->lunindex[target_id]++; + } else { + /* + * We're done with scanning all luns. + * + * Nuke the bogus device for lun 0 if lun 0 + * wasn't on the list. + */ + if (first != 0) { + TAILQ_FOREACH(device, + &target->ed_entries, links) { + if (device->lun_id == 0) { + break; + } + } + if (device) { + xpt_release_device(device); + } + } + } + } else if (request_ccb->ccb_h.status != CAM_REQ_CMP) { int phl; /* @@ -1658,7 +1967,6 @@ scsi_scan_bus(struct cam_periph *periph, * target that might have "gone away", go onto * the next lun. */ - target = request_ccb->ccb_h.path->target; /* * We may touch devices that we don't * hold references too, so ensure they @@ -1674,11 +1982,15 @@ scsi_scan_bus(struct cam_periph *periph, device = TAILQ_NEXT(device, links); } if ((lun_id != 0) || (device != NULL)) { - if (lun_id < (CAM_SCSI2_MAXLUN-1) || phl) + if (lun_id < (CAM_SCSI2_MAXLUN-1) || phl) { lun_id++; + next_target = 0; + } } + if (lun_id == request_ccb->ccb_h.target_lun + || lun_id > scan_info->cpi->max_lun) + next_target = 1; } else { - struct cam_ed *device; device = request_ccb->ccb_h.path->device; @@ -1686,23 +1998,26 @@ scsi_scan_bus(struct cam_periph *periph, CAM_QUIRK_NOLUNS) == 0) { /* Try the next lun */ if (lun_id < (CAM_SCSI2_MAXLUN-1) - || CAN_SRCH_HI_DENSE(device)) + || CAN_SRCH_HI_DENSE(device)) { lun_id++; + next_target = 0; + } } + if (lun_id == request_ccb->ccb_h.target_lun + || lun_id > scan_info->cpi->max_lun) + next_target = 1; } /* - * Free the current request path- we're done with it. - */ - xpt_free_path(request_ccb->ccb_h.path); - - /* * Check to see if we scan any further luns. */ - if (lun_id == request_ccb->ccb_h.target_lun - || lun_id > scan_info->cpi->max_lun) { + if (next_target) { int done; + /* + * Free the current request path- we're done with it. + */ + xpt_free_path(oldpath); hop_again: done = 0; if (scan_info->request_ccb->ccb_h.func_code == XPT_SCAN_TGT) { @@ -1727,6 +2042,9 @@ scsi_scan_bus(struct cam_periph *periph, xpt_free_ccb(request_ccb); xpt_free_ccb((union ccb *)scan_info->cpi); request_ccb = scan_info->request_ccb; + CAM_DEBUG_PATH_PRINT(CAM_DEBUG_PROBE, + request_ccb->ccb_h.path, + ("SCAN done for %p\n", scan_info)); free(scan_info, M_CAMXPT); request_ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(request_ccb); @@ -1762,6 +2080,13 @@ scsi_scan_bus(struct cam_periph *periph, } else { status = xpt_create_path(&path, xpt_periph, path_id, target_id, lun_id); + /* + * Free the old request path- we're done with it. We + * do this *after* creating the new path so that + * we don't remove a target that has our lun list + * in the case that lun 0 is not present. + */ + xpt_free_path(oldpath); if (status != CAM_REQ_CMP) { printf("scsi_scan_bus: xpt_create_path failed " "with status %#x, halting LUN scan\n", From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 6 12:36:41 2012 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 743FE106564A; Wed, 6 Jun 2012 12:36:41 +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 544D18FC15; Wed, 6 Jun 2012 12:36:41 +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 q56CafV9014480; Wed, 6 Jun 2012 12:36:41 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q56CafnO014478; Wed, 6 Jun 2012 12:36:41 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206061236.q56CafnO014478@svn.freebsd.org> From: Alexander Motin Date: Wed, 6 Jun 2012 12:36:41 +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: r236678 - stable/8/sys/cam/scsi 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: Wed, 06 Jun 2012 12:36:41 -0000 Author: mav Date: Wed Jun 6 12:36:40 2012 New Revision: 236678 URL: http://svn.freebsd.org/changeset/base/236678 Log: MFC r223084 (by gibbs): sys/cam/scsi/scsi_da.c: - Only attempt the closing synchronize cache on a disk if it is still there. - When a device is lost, report the number of outstanding I/Os as they are drained. - When a device is lost, return any unprocessed bios with ENXIO instead of EIO. - Filter asynchronous events, but always allow cam_periph_async() to see them too. Modified: stable/8/sys/cam/scsi/scsi_da.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_da.c Wed Jun 6 12:16:54 2012 (r236677) +++ stable/8/sys/cam/scsi/scsi_da.c Wed Jun 6 12:36:40 2012 (r236678) @@ -972,7 +972,8 @@ daclose(struct disk *dp) softc = (struct da_softc *)periph->softc; - if ((softc->quirks & DA_Q_NO_SYNC_CACHE) == 0) { + if ((softc->quirks & DA_Q_NO_SYNC_CACHE) == 0 + && (softc->flags & DA_FLAG_PACK_INVALID) == 0) { union ccb *ccb; ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); @@ -1299,12 +1300,12 @@ daasync(void *callback_arg, u_int32_t co softc->flags |= DA_FLAG_RETRY_UA; LIST_FOREACH(ccbh, &softc->pending_ccbs, periph_links.le) ccbh->ccb_state |= DA_CCB_RETRY_UA; - /* FALLTHROUGH*/ + break; } default: - cam_periph_async(periph, code, path, arg); break; } + cam_periph_async(periph, code, path, arg); } static void @@ -1795,7 +1796,7 @@ dadone(struct cam_periph *periph, union if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { int error; int sf; - + if ((csio->ccb_h.ccb_state & DA_CCB_RETRY_UA) != 0) sf = SF_RETRY_UA; else @@ -1810,8 +1811,17 @@ dadone(struct cam_periph *periph, union return; } if (error != 0) { + int queued_error; + + /* + * return all queued I/O with EIO, so that + * the client can retry these I/Os in the + * proper order should it attempt to recover. + */ + queued_error = EIO; - if (error == ENXIO) { + if (error == ENXIO + && (softc->flags & DA_FLAG_PACK_INVALID)== 0) { /* * Catastrophic error. Mark our pack as * invalid. @@ -1823,14 +1833,10 @@ dadone(struct cam_periph *periph, union xpt_print(periph->path, "Invalidating pack\n"); softc->flags |= DA_FLAG_PACK_INVALID; + queued_error = ENXIO; } - - /* - * return all queued I/O with EIO, so that - * the client can retry these I/Os in the - * proper order should it attempt to recover. - */ - bioq_flush(&softc->bio_queue, NULL, EIO); + bioq_flush(&softc->bio_queue, NULL, + queued_error); bp->bio_error = error; bp->bio_resid = bp->bio_bcount; bp->bio_flags |= BIO_ERROR; @@ -1870,6 +1876,11 @@ dadone(struct cam_periph *periph, union if (softc->outstanding_cmds == 0) softc->flags |= DA_FLAG_WENT_IDLE; + if ((softc->flags & DA_FLAG_PACK_INVALID) != 0) { + xpt_print(periph->path, "oustanding %d\n", + softc->outstanding_cmds); + } + biodone(bp); break; } From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 6 16:01:46 2012 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 1D557106566C; Wed, 6 Jun 2012 16:01:46 +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 F1BAF8FC18; Wed, 6 Jun 2012 16:01:45 +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 q56G1j9F023956; Wed, 6 Jun 2012 16:01:45 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q56G1jeN023951; Wed, 6 Jun 2012 16:01:45 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206061601.q56G1jeN023951@svn.freebsd.org> From: John Baldwin Date: Wed, 6 Jun 2012 16:01:45 +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: r236684 - in stable/8: share/man/man9 sys/kern sys/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: Wed, 06 Jun 2012 16:01:46 -0000 Author: jhb Date: Wed Jun 6 16:01:45 2012 New Revision: 236684 URL: http://svn.freebsd.org/changeset/base/236684 Log: MFC 228509,228620,228533: Add a helper API to allow in-kernel code to map portions of shared memory objects created by shm_open(2) into the kernel's address space. This provides a convenient way for creating shared memory buffers between userland and the kernel without requiring custom character devices. Added: stable/8/share/man/man9/shm_map.9 - copied, changed from r228509, head/share/man/man9/shm_map.9 Modified: stable/8/share/man/man9/Makefile stable/8/sys/kern/uipc_shm.c stable/8/sys/sys/mman.h Directory Properties: stable/8/share/man/man9/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (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) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/share/man/man9/Makefile ============================================================================== --- stable/8/share/man/man9/Makefile Wed Jun 6 16:00:31 2012 (r236683) +++ stable/8/share/man/man9/Makefile Wed Jun 6 16:01:45 2012 (r236684) @@ -237,6 +237,7 @@ MAN= accept_filter.9 \ sema.9 \ sf_buf.9 \ sglist.9 \ + shm_map.9 \ signal.9 \ sleep.9 \ sleepqueue.9 \ @@ -1117,6 +1118,7 @@ MLINKS+=sglist.9 sglist_alloc.9 \ sglist.9 sglist_reset.9 \ sglist.9 sglist_slice.9 \ sglist.9 sglist_split.9 +MLINKS+=shm_map.9 shm_unmap.9 MLINKS+=signal.9 cursig.9 \ signal.9 execsigs.9 \ signal.9 issignal.9 \ Copied and modified: stable/8/share/man/man9/shm_map.9 (from r228509, head/share/man/man9/shm_map.9) ============================================================================== --- head/share/man/man9/shm_map.9 Wed Dec 14 22:22:19 2011 (r228509, copy source) +++ stable/8/share/man/man9/shm_map.9 Wed Jun 6 16:01:45 2012 (r236684) @@ -30,9 +30,8 @@ .Dt SHM_MAP 9 .Os .Sh NAME -.Nm shm_map , -.Nm shm_unmap -.Nd map shared memory objects into the kernel's address space +.Nm shm_map , shm_unmap +.Nd "map shared memory objects into the kernel's address space" .Sh SYNOPSIS .In sys/types.h .In sys/mman.h @@ -42,9 +41,9 @@ .Fn shm_unmap "struct file *fp" "void *mem" "size_t size" .Sh DESCRIPTION The -.Nm shm_map +.Fn shm_map and -.Nm shm_unmap +.Fn shm_unmap functions provide an API for mapping shared memory objects into the kernel. Shared memory objects are created by .Xr shm_open 2 . @@ -57,13 +56,13 @@ Shared memory objects can still be grown .Pp To simplify the accounting needed to enforce the above requirement, callers of this API are required to unmap the entire region mapped by -.Nm shm_map +.Fn shm_map when calling -.Nm shm_unmap . +.Fn shm_unmap . Unmapping only a portion of the region is not permitted. .Pp The -.Nm shm_map +.Fn shm_map function locates the shared memory object associated with the open file .Fa fp . It maps the region of that object described by @@ -77,9 +76,9 @@ will be set to the start of the mapping. All pages for the range will be wired into memory upon successful return. .Pp The -.Nm shm_unmap +.Fn shm_unmap function unmaps a region previously mapped by -.Nm shm_map . +.Fn shm_map . The .Fa mem argument should match the value previously returned in @@ -87,22 +86,22 @@ argument should match the value previous and the .Fa size argument should match the value passed to -.Nm shm_map . +.Fn shm_map . .Pp Note that -.Nm shm_map +.Fn shm_map will not hold an extra reference on the open file .Fa fp for the lifetime of the mapping. Instead, the calling code is required to do this if it wishes to use -.Nm shm_unmap +.Fn shm_unmap on the region in the future. .Sh RETURN VALUES The -.Nm shm_map +.Fn shm_map and -.Nm shm_unmap +.Fn shm_unmap functions return zero on success or an error on failure. .Sh EXAMPLES The following function accepts a file descriptor for a shared memory @@ -110,7 +109,7 @@ object. It maps the first sixteen kilobytes of the object into the kernel, performs some work on that address, and then unmaps the address before returning. -.Bd -literal +.Bd -literal -offset indent int shm_example(int fd) { @@ -118,7 +117,7 @@ shm_example(int fd) void *mem; int error; - error = fget(curthread, fd, CAP_MMAP, &fp) + error = fget(curthread, fd, CAP_MMAP, &fp); if (error) return (error); error = shm_map(fp, 16384, 0, &mem); @@ -136,7 +135,7 @@ shm_example(int fd) .Ed .Sh ERRORS The -.Nm shm_map +.Fn shm_map function returns the following errors on failure: .Bl -tag -width Er .It Bq Er EINVAL @@ -158,7 +157,7 @@ The shared memory object could not be ma .El .Pp The -.Nm shm_unmap +.Fn shm_unmap function returns the following errors on failure: .Bl -tag -width Er .It Bq Er EINVAL Modified: stable/8/sys/kern/uipc_shm.c ============================================================================== --- stable/8/sys/kern/uipc_shm.c Wed Jun 6 16:00:31 2012 (r236683) +++ stable/8/sys/kern/uipc_shm.c Wed Jun 6 16:01:45 2012 (r236684) @@ -81,7 +81,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include #include @@ -259,6 +261,14 @@ shm_dotruncate(struct shmfd *shmfd, off_ /* Are we shrinking? If so, trim the end. */ if (length < shmfd->shm_size) { + /* + * Disallow any requests to shrink the size if this + * object is mapped into the kernel. + */ + if (shmfd->shm_kmappings > 0) { + VM_OBJECT_UNLOCK(object); + return (EBUSY); + } delta = ptoa(object->size - nobjsize); /* Toss in memory pages. */ @@ -642,3 +652,105 @@ shm_mmap(struct shmfd *shmfd, vm_size_t *obj = shmfd->shm_object; return (0); } + +/* + * Helper routines to allow the backing object of a shared memory file + * descriptor to be mapped in the kernel. + */ +int +shm_map(struct file *fp, size_t size, off_t offset, void **memp) +{ + struct shmfd *shmfd; + vm_offset_t kva, ofs; + vm_object_t obj; + int rv; + + if (fp->f_type != DTYPE_SHM) + return (EINVAL); + shmfd = fp->f_data; + obj = shmfd->shm_object; + VM_OBJECT_LOCK(obj); + /* + * XXXRW: This validation is probably insufficient, and subject to + * sign errors. It should be fixed. + */ + if (offset >= shmfd->shm_size || + offset + size > round_page(shmfd->shm_size)) { + VM_OBJECT_UNLOCK(obj); + return (EINVAL); + } + + shmfd->shm_kmappings++; + vm_object_reference_locked(obj); + VM_OBJECT_UNLOCK(obj); + + /* Map the object into the kernel_map and wire it. */ + kva = vm_map_min(kernel_map); + ofs = offset & PAGE_MASK; + offset = trunc_page(offset); + size = round_page(size + ofs); + rv = vm_map_find(kernel_map, obj, offset, &kva, size, + VMFS_ALIGNED_SPACE, VM_PROT_READ | VM_PROT_WRITE, + VM_PROT_READ | VM_PROT_WRITE, 0); + if (rv == KERN_SUCCESS) { + rv = vm_map_wire(kernel_map, kva, kva + size, + VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); + if (rv == KERN_SUCCESS) { + *memp = (void *)(kva + ofs); + return (0); + } + vm_map_remove(kernel_map, kva, kva + size); + } else + vm_object_deallocate(obj); + + /* On failure, drop our mapping reference. */ + VM_OBJECT_LOCK(obj); + shmfd->shm_kmappings--; + VM_OBJECT_UNLOCK(obj); + + return (vm_mmap_to_errno(rv)); +} + +/* + * We require the caller to unmap the entire entry. This allows us to + * safely decrement shm_kmappings when a mapping is removed. + */ +int +shm_unmap(struct file *fp, void *mem, size_t size) +{ + struct shmfd *shmfd; + vm_map_entry_t entry; + vm_offset_t kva, ofs; + vm_object_t obj; + vm_pindex_t pindex; + vm_prot_t prot; + boolean_t wired; + vm_map_t map; + int rv; + + if (fp->f_type != DTYPE_SHM) + return (EINVAL); + shmfd = fp->f_data; + kva = (vm_offset_t)mem; + ofs = kva & PAGE_MASK; + kva = trunc_page(kva); + size = round_page(size + ofs); + map = kernel_map; + rv = vm_map_lookup(&map, kva, VM_PROT_READ | VM_PROT_WRITE, &entry, + &obj, &pindex, &prot, &wired); + if (rv != KERN_SUCCESS) + return (EINVAL); + if (entry->start != kva || entry->end != kva + size) { + vm_map_lookup_done(map, entry); + return (EINVAL); + } + vm_map_lookup_done(map, entry); + if (obj != shmfd->shm_object) + return (EINVAL); + vm_map_remove(map, kva, kva + size); + VM_OBJECT_LOCK(obj); + KASSERT(shmfd->shm_kmappings > 0, ("shm_unmap: object not mapped")); + shmfd->shm_kmappings--; + VM_OBJECT_UNLOCK(obj); + return (0); +} Modified: stable/8/sys/sys/mman.h ============================================================================== --- stable/8/sys/sys/mman.h Wed Jun 6 16:00:31 2012 (r236683) +++ stable/8/sys/sys/mman.h Wed Jun 6 16:01:45 2012 (r236684) @@ -181,6 +181,8 @@ typedef __size_t size_t; #ifdef _KERNEL #include +struct file; + struct shmfd { size_t shm_size; vm_object_t shm_object; @@ -188,6 +190,7 @@ struct shmfd { uid_t shm_uid; gid_t shm_gid; mode_t shm_mode; + int shm_kmappings; /* * Values maintained solely to make this a better-behaved file @@ -203,6 +206,8 @@ struct shmfd { int shm_mmap(struct shmfd *shmfd, vm_size_t objsize, vm_ooffset_t foff, vm_object_t *obj); +int shm_map(struct file *fp, size_t size, off_t offset, void **memp); +int shm_unmap(struct file *fp, void *mem, size_t size); #else /* !_KERNEL */ From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 6 16:20:59 2012 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 B71D7106567C; Wed, 6 Jun 2012 16:20:59 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A18208FC0C; Wed, 6 Jun 2012 16:20: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 q56GKxGf024867; Wed, 6 Jun 2012 16:20:59 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q56GKxr7024865; Wed, 6 Jun 2012 16:20:59 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <201206061620.q56GKxr7024865@svn.freebsd.org> From: Maksim Yevmenkin Date: Wed, 6 Jun 2012 16:20: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: r236685 - stable/8/sys/vm 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: Wed, 06 Jun 2012 16:20:59 -0000 Author: emax Date: Wed Jun 6 16:20:59 2012 New Revision: 236685 URL: http://svn.freebsd.org/changeset/base/236685 Log: MFC r235854 Seems applicable here as well. Tweak condition for disabling allocation from per-CPU buckets in low memory situation. I've observed a situation where per-CPU allocations were disabled while there were enough free cached pages. Basically, cnt.v_free_count was sitting stable at a value lower than cnt.v_free_min and that caused massive performance drop. Reviewed by: alc Requested by: Andrew Boyer aboyer at averesystems dot com Modified: stable/8/sys/vm/uma_core.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/vm/uma_core.c ============================================================================== --- stable/8/sys/vm/uma_core.c Wed Jun 6 16:01:45 2012 (r236684) +++ stable/8/sys/vm/uma_core.c Wed Jun 6 16:20:59 2012 (r236685) @@ -267,10 +267,7 @@ SYSCTL_PROC(_vm, OID_AUTO, zone_stats, C static void bucket_enable(void) { - if (cnt.v_free_count < cnt.v_free_min) - bucketdisable = 1; - else - bucketdisable = 0; + bucketdisable = vm_page_count_min(); } /* From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 6 18:04:49 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EA762106566B; Wed, 6 Jun 2012 18:04:49 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D46E78FC21; Wed, 6 Jun 2012 18:04:49 +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 q56I4nZ1030110; Wed, 6 Jun 2012 18:04:49 GMT (envelope-from oleg@svn.freebsd.org) Received: (from oleg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q56I4nif030108; Wed, 6 Jun 2012 18:04:49 GMT (envelope-from oleg@svn.freebsd.org) Message-Id: <201206061804.q56I4nif030108@svn.freebsd.org> From: Oleg Bulyzhin Date: Wed, 6 Jun 2012 18:04:49 +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: r236694 - stable/8/sys/netinet/ipfw 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: Wed, 06 Jun 2012 18:04:50 -0000 Author: oleg Date: Wed Jun 6 18:04:49 2012 New Revision: 236694 URL: http://svn.freebsd.org/changeset/base/236694 Log: MFC: r232272, r232273 - lookup_dyn_rule_locked(): style(9) cleanup - Refresh dynamic tcp rule only if both sides answered keepalive packets. - Remove some useless assignments. Modified: stable/8/sys/netinet/ipfw/ip_fw_dynamic.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet/ipfw/ip_fw_dynamic.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_fw_dynamic.c Wed Jun 6 18:00:38 2012 (r236693) +++ stable/8/sys/netinet/ipfw/ip_fw_dynamic.c Wed Jun 6 18:04:49 2012 (r236694) @@ -390,72 +390,68 @@ ipfw_remove_dyn_children(struct ip_fw *r IPFW_DYN_UNLOCK(); } -/** - * lookup a dynamic rule, locked version +/* + * Lookup a dynamic rule, locked version. */ static ipfw_dyn_rule * lookup_dyn_rule_locked(struct ipfw_flow_id *pkt, int *match_direction, struct tcphdr *tcp) { /* - * stateful ipfw extensions. - * Lookup into dynamic session queue + * Stateful ipfw extensions. + * Lookup into dynamic session queue. */ #define MATCH_REVERSE 0 #define MATCH_FORWARD 1 #define MATCH_NONE 2 #define MATCH_UNKNOWN 3 int i, dir = MATCH_NONE; - ipfw_dyn_rule *prev, *q=NULL; + ipfw_dyn_rule *prev, *q = NULL; IPFW_DYN_LOCK_ASSERT(); if (V_ipfw_dyn_v == NULL) - goto done; /* not found */ - i = hash_packet( pkt ); - for (prev=NULL, q = V_ipfw_dyn_v[i] ; q != NULL ; ) { + goto done; /* not found */ + i = hash_packet(pkt); + for (prev = NULL, q = V_ipfw_dyn_v[i]; q != NULL;) { if (q->dyn_type == O_LIMIT_PARENT && q->count) goto next; - if (TIME_LEQ( q->expire, time_uptime)) { /* expire entry */ + if (TIME_LEQ(q->expire, time_uptime)) { /* expire entry */ UNLINK_DYN_RULE(prev, V_ipfw_dyn_v[i], q); continue; } - if (pkt->proto == q->id.proto && - q->dyn_type != O_LIMIT_PARENT) { - if (IS_IP6_FLOW_ID(pkt)) { - if (IN6_ARE_ADDR_EQUAL(&(pkt->src_ip6), - &(q->id.src_ip6)) && - IN6_ARE_ADDR_EQUAL(&(pkt->dst_ip6), - &(q->id.dst_ip6)) && + if (pkt->proto != q->id.proto || q->dyn_type == O_LIMIT_PARENT) + goto next; + + if (IS_IP6_FLOW_ID(pkt)) { + if (IN6_ARE_ADDR_EQUAL(&pkt->src_ip6, &q->id.src_ip6) && + IN6_ARE_ADDR_EQUAL(&pkt->dst_ip6, &q->id.dst_ip6) && pkt->src_port == q->id.src_port && - pkt->dst_port == q->id.dst_port ) { + pkt->dst_port == q->id.dst_port) { + dir = MATCH_FORWARD; + break; + } + if (IN6_ARE_ADDR_EQUAL(&pkt->src_ip6, &q->id.dst_ip6) && + IN6_ARE_ADDR_EQUAL(&pkt->dst_ip6, &q->id.src_ip6) && + pkt->src_port == q->id.dst_port && + pkt->dst_port == q->id.src_port) { + dir = MATCH_REVERSE; + break; + } + } else { + if (pkt->src_ip == q->id.src_ip && + pkt->dst_ip == q->id.dst_ip && + pkt->src_port == q->id.src_port && + pkt->dst_port == q->id.dst_port) { dir = MATCH_FORWARD; break; - } - if (IN6_ARE_ADDR_EQUAL(&(pkt->src_ip6), - &(q->id.dst_ip6)) && - IN6_ARE_ADDR_EQUAL(&(pkt->dst_ip6), - &(q->id.src_ip6)) && - pkt->src_port == q->id.dst_port && - pkt->dst_port == q->id.src_port ) { - dir = MATCH_REVERSE; - break; - } - } else { - if (pkt->src_ip == q->id.src_ip && - pkt->dst_ip == q->id.dst_ip && - pkt->src_port == q->id.src_port && - pkt->dst_port == q->id.dst_port ) { - dir = MATCH_FORWARD; - break; - } - if (pkt->src_ip == q->id.dst_ip && - pkt->dst_ip == q->id.src_ip && - pkt->src_port == q->id.dst_port && - pkt->dst_port == q->id.src_port ) { - dir = MATCH_REVERSE; - break; - } + } + if (pkt->src_ip == q->id.dst_ip && + pkt->dst_ip == q->id.src_ip && + pkt->src_port == q->id.dst_port && + pkt->dst_port == q->id.src_port) { + dir = MATCH_REVERSE; + break; } } next: @@ -463,45 +459,55 @@ next: q = q->next; } if (q == NULL) - goto done; /* q = NULL, not found */ + goto done; /* q = NULL, not found */ - if ( prev != NULL) { /* found and not in front */ + if (prev != NULL) { /* found and not in front */ prev->next = q->next; q->next = V_ipfw_dyn_v[i]; V_ipfw_dyn_v[i] = q; } if (pkt->proto == IPPROTO_TCP) { /* update state according to flags */ - u_char flags = pkt->_flags & (TH_FIN|TH_SYN|TH_RST); + uint32_t ack; + u_char flags = pkt->_flags & (TH_FIN | TH_SYN | TH_RST); #define BOTH_SYN (TH_SYN | (TH_SYN << 8)) #define BOTH_FIN (TH_FIN | (TH_FIN << 8)) - q->state |= (dir == MATCH_FORWARD ) ? flags : (flags << 8); - switch (q->state) { - case TH_SYN: /* opening */ +#define TCP_FLAGS (TH_FLAGS | (TH_FLAGS << 8)) +#define ACK_FWD 0x10000 /* fwd ack seen */ +#define ACK_REV 0x20000 /* rev ack seen */ + + q->state |= (dir == MATCH_FORWARD) ? flags : (flags << 8); + switch (q->state & TCP_FLAGS) { + case TH_SYN: /* opening */ q->expire = time_uptime + V_dyn_syn_lifetime; break; case BOTH_SYN: /* move to established */ - case BOTH_SYN | TH_FIN : /* one side tries to close */ - case BOTH_SYN | (TH_FIN << 8) : - if (tcp) { + case BOTH_SYN | TH_FIN: /* one side tries to close */ + case BOTH_SYN | (TH_FIN << 8): #define _SEQ_GE(a,b) ((int)(a) - (int)(b) >= 0) - u_int32_t ack = ntohl(tcp->th_ack); - if (dir == MATCH_FORWARD) { - if (q->ack_fwd == 0 || _SEQ_GE(ack, q->ack_fwd)) - q->ack_fwd = ack; - else { /* ignore out-of-sequence */ - break; + if (tcp == NULL) + break; + + ack = ntohl(tcp->th_ack); + if (dir == MATCH_FORWARD) { + if (q->ack_fwd == 0 || + _SEQ_GE(ack, q->ack_fwd)) { + q->ack_fwd = ack; + q->state |= ACK_FWD; } - } else { - if (q->ack_rev == 0 || _SEQ_GE(ack, q->ack_rev)) - q->ack_rev = ack; - else { /* ignore out-of-sequence */ - break; + } else { + if (q->ack_rev == 0 || + _SEQ_GE(ack, q->ack_rev)) { + q->ack_rev = ack; + q->state |= ACK_REV; } - } } - q->expire = time_uptime + V_dyn_ack_lifetime; + if ((q->state & (ACK_FWD | ACK_REV)) == + (ACK_FWD | ACK_REV)) { + q->expire = time_uptime + V_dyn_ack_lifetime; + q->state &= ~(ACK_FWD | ACK_REV); + } break; case BOTH_SYN | BOTH_FIN: /* both sides closed */ @@ -531,9 +537,9 @@ next: q->expire = time_uptime + V_dyn_short_lifetime; } done: - if (match_direction) + if (match_direction != NULL) *match_direction = dir; - return q; + return (q); } ipfw_dyn_rule * @@ -1080,10 +1086,12 @@ ipfw_tick(void * vnetx) if (TIME_LEQ(q->expire, time_uptime)) continue; /* too late, rule expired */ - m = ipfw_send_pkt(NULL, &(q->id), q->ack_rev - 1, - q->ack_fwd, TH_SYN); - mnext = ipfw_send_pkt(NULL, &(q->id), q->ack_fwd - 1, - q->ack_rev, 0); + m = (q->state & ACK_REV) ? NULL : + ipfw_send_pkt(NULL, &(q->id), q->ack_rev - 1, + q->ack_fwd, TH_SYN); + mnext = (q->state & ACK_FWD) ? NULL : + ipfw_send_pkt(NULL, &(q->id), q->ack_fwd - 1, + q->ack_rev, 0); switch (q->id.addr_type) { case 4: @@ -1109,18 +1117,16 @@ ipfw_tick(void * vnetx) break; #endif } - - m = mnext = NULL; } } IPFW_DYN_UNLOCK(); - for (m = mnext = m0; m != NULL; m = mnext) { + for (m = m0; m != NULL; m = mnext) { mnext = m->m_nextpkt; m->m_nextpkt = NULL; ip_output(m, NULL, NULL, 0, NULL, NULL); } #ifdef INET6 - for (m = mnext = m6; m != NULL; m = mnext) { + for (m = m6; m != NULL; m = mnext) { mnext = m->m_nextpkt; m->m_nextpkt = NULL; ip6_output(m, NULL, NULL, 0, NULL, NULL, NULL); From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 6 21:57:03 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D05F81065674; Wed, 6 Jun 2012 21:57: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 BB0348FC14; Wed, 6 Jun 2012 21:57: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 q56Lv3P3040786; Wed, 6 Jun 2012 21:57:03 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q56Lv3a5040780; Wed, 6 Jun 2012 21:57:03 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206062157.q56Lv3a5040780@svn.freebsd.org> From: John Baldwin Date: Wed, 6 Jun 2012 21:57: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: r236699 - in stable/8: sys/kern sys/sys usr.bin/fstat usr.bin/procstat 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: Wed, 06 Jun 2012 21:57:03 -0000 Author: jhb Date: Wed Jun 6 21:57:03 2012 New Revision: 236699 URL: http://svn.freebsd.org/changeset/base/236699 Log: MFC 233760: Export some more useful info about shared memory objects to userland via procstat(1) and fstat(1): - Change shm file descriptors to track the pathname they are associated with and add a shm_path() method to copy the path out to a caller-supplied buffer. - Use shm_path() to export the path of a shared memory object via struct kinfo_file. - Change procstat to always print out the path for a given object if it is valid. - Teach fstat about shared memory objects and to display their path, mode, and size. Modified: stable/8/sys/kern/kern_descrip.c stable/8/sys/kern/uipc_shm.c stable/8/sys/sys/mman.h stable/8/usr.bin/fstat/fstat.c stable/8/usr.bin/procstat/procstat_files.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (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) stable/8/sys/dev/e1000/ (props changed) stable/8/usr.bin/fstat/ (props changed) stable/8/usr.bin/procstat/ (props changed) Modified: stable/8/sys/kern/kern_descrip.c ============================================================================== --- stable/8/sys/kern/kern_descrip.c Wed Jun 6 21:49:31 2012 (r236698) +++ stable/8/sys/kern/kern_descrip.c Wed Jun 6 21:57:03 2012 (r236699) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -2742,6 +2743,7 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE struct kinfo_ofile *kif; struct filedesc *fdp; int error, i, *name; + struct shmfd *shmfd; struct socket *so; struct vnode *vp; struct file *fp; @@ -2779,6 +2781,7 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE vp = NULL; so = NULL; tp = NULL; + shmfd = NULL; kif->kf_fd = i; switch (fp->f_type) { case DTYPE_VNODE: @@ -2814,6 +2817,7 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE case DTYPE_SHM: kif->kf_type = KF_TYPE_SHM; + shmfd = fp->f_data; break; case DTYPE_SEM: @@ -2921,6 +2925,8 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE strlcpy(kif->kf_path, tty_devname(tp), sizeof(kif->kf_path)); } + if (shmfd != NULL) + shm_path(shmfd, kif->kf_path, sizeof(kif->kf_path)); error = SYSCTL_OUT(req, kif, sizeof(*kif)); if (error) break; @@ -2995,6 +3001,7 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER struct kinfo_file *kif; struct filedesc *fdp; int error, i, *name; + struct shmfd *shmfd; struct socket *so; struct vnode *vp; struct file *fp; @@ -3032,6 +3039,7 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER vp = NULL; so = NULL; tp = NULL; + shmfd = NULL; kif->kf_fd = i; switch (fp->f_type) { case DTYPE_VNODE: @@ -3067,6 +3075,7 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER case DTYPE_SHM: kif->kf_type = KF_TYPE_SHM; + shmfd = fp->f_data; break; case DTYPE_SEM: @@ -3174,6 +3183,8 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER strlcpy(kif->kf_path, tty_devname(tp), sizeof(kif->kf_path)); } + if (shmfd != NULL) + shm_path(shmfd, kif->kf_path, sizeof(kif->kf_path)); /* Pack record size down */ kif->kf_structsize = offsetof(struct kinfo_file, kf_path) + strlen(kif->kf_path) + 1; Modified: stable/8/sys/kern/uipc_shm.c ============================================================================== --- stable/8/sys/kern/uipc_shm.c Wed Jun 6 21:49:31 2012 (r236698) +++ stable/8/sys/kern/uipc_shm.c Wed Jun 6 21:57:03 2012 (r236699) @@ -453,6 +453,7 @@ shm_insert(char *path, Fnv32_t fnv, stru map->sm_path = path; map->sm_fnv = fnv; map->sm_shmfd = shm_hold(shmfd); + shmfd->shm_path = path; LIST_INSERT_HEAD(SHM_HASH(fnv), map, sm_link); } @@ -475,6 +476,7 @@ shm_remove(char *path, Fnv32_t fnv, stru FREAD | FWRITE); if (error) return (error); + map->sm_shmfd->shm_path = NULL; LIST_REMOVE(map, sm_link); shm_drop(map->sm_shmfd); free(map->sm_path, M_SHMFD); @@ -754,3 +756,15 @@ shm_unmap(struct file *fp, void *mem, si VM_OBJECT_UNLOCK(obj); return (0); } + +void +shm_path(struct shmfd *shmfd, char *path, size_t size) +{ + + if (shmfd->shm_path == NULL) + return; + sx_slock(&shm_dict_lock); + if (shmfd->shm_path != NULL) + strlcpy(path, shmfd->shm_path, size); + sx_sunlock(&shm_dict_lock); +} Modified: stable/8/sys/sys/mman.h ============================================================================== --- stable/8/sys/sys/mman.h Wed Jun 6 21:49:31 2012 (r236698) +++ stable/8/sys/sys/mman.h Wed Jun 6 21:57:03 2012 (r236699) @@ -178,7 +178,7 @@ typedef __size_t size_t; #define _SIZE_T_DECLARED #endif -#ifdef _KERNEL +#if defined(_KERNEL) || defined(_WANT_FILE) #include struct file; @@ -202,12 +202,16 @@ struct shmfd { struct timespec shm_birthtime; struct label *shm_label; /* MAC label */ + const char *shm_path; }; +#endif +#ifdef _KERNEL int shm_mmap(struct shmfd *shmfd, vm_size_t objsize, vm_ooffset_t foff, vm_object_t *obj); int shm_map(struct file *fp, size_t size, off_t offset, void **memp); int shm_unmap(struct file *fp, void *mem, size_t size); +void shm_path(struct shmfd *shmfd, char *path, size_t size); #else /* !_KERNEL */ Modified: stable/8/usr.bin/fstat/fstat.c ============================================================================== --- stable/8/usr.bin/fstat/fstat.c Wed Jun 6 21:49:31 2012 (r236698) +++ stable/8/usr.bin/fstat/fstat.c Wed Jun 6 21:57:03 2012 (r236699) @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); #define _WANT_FILE #include #include +#include #define _KERNEL #include #include @@ -155,6 +156,7 @@ char *getmnton(struct mount *m); void pipetrans(struct pipe *pi, int i, int flag); void socktrans(struct socket *sock, int i); void ptstrans(struct tty *tp, int i, int flag); +void shmtrans(struct shmfd *shmp, int i, int flag); void getinetproto(int number); int getfname(const char *filename); void usage(void); @@ -418,6 +420,12 @@ dofiles(struct kinfo_proc *kp) ptstrans(file.f_data, i, file.f_flag); } #endif +#ifdef DTYPE_SHM + else if (file.f_type == DTYPE_SHM) { + if (checkfile == 0) + shmtrans(file.f_data, i, file.f_flag); + } +#endif else { dprintf(stderr, "unknown file type %d for file %d of pid %d\n", @@ -939,6 +947,55 @@ bad: printf("* error\n"); } +void +shmtrans(struct shmfd *shmp, int i, int flag) +{ + struct shmfd shm; + char name[MAXPATHLEN]; + char mode[15]; + char rw[3]; + unsigned j; + + PREFIX(i); + + if (!KVM_READ(shmp, &shm, sizeof(struct shmfd))) { + dprintf(stderr, "can't read shm at %p\n", shmp); + goto bad; + } + + if (shm.shm_path != NULL) { + for (j = 0; j < sizeof(name) - 1; j++) { + if (!KVM_READ(shm.shm_path + j, name + j, 1)) + break; + if (name[j] == '\0') + break; + } + name[j] = '\0'; + } else + name[0] = '\0'; + + rw[0] = '\0'; + if (flag & FREAD) + strcat(rw, "r"); + if (flag & FWRITE) + strcat(rw, "w"); + + shm.shm_mode |= S_IFREG; + if (nflg) { + printf(" "); + (void)snprintf(mode, sizeof(mode), "%o", shm.shm_mode); + } else { + printf(" %-15s", name[0] != '\0' ? name : "-"); + strmode(shm.shm_mode, mode); + } + printf(" %10s %6ju", mode, shm.shm_size); + printf(" %2s\n", rw); + + return; +bad: + printf("* error\n"); +} + /* * Read the cdev structure in the kernel in order to work out the * associated dev_t Modified: stable/8/usr.bin/procstat/procstat_files.c ============================================================================== --- stable/8/usr.bin/procstat/procstat_files.c Wed Jun 6 21:49:31 2012 (r236698) +++ stable/8/usr.bin/procstat/procstat_files.c Wed Jun 6 21:57:03 2012 (r236699) @@ -277,13 +277,6 @@ procstat_files(pid_t pid, struct kinfo_p printf("%7c ", '-'); switch (kif->kf_type) { - case KF_TYPE_VNODE: - case KF_TYPE_FIFO: - case KF_TYPE_PTS: - printf("%-3s ", "-"); - printf("%-18s", kif->kf_path); - break; - case KF_TYPE_SOCKET: printf("%-3s ", protocol_to_string(kif->kf_sock_domain, @@ -312,7 +305,8 @@ procstat_files(pid_t pid, struct kinfo_p default: printf("%-3s ", "-"); - printf("%-18s", "-"); + printf("%-18s", kif->kf_path[0] != '\0' ? + kif->kf_path : "-"); } printf("\n"); From owner-svn-src-stable-8@FreeBSD.ORG Thu Jun 7 05:37:47 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 55BA3106564A; Thu, 7 Jun 2012 05:37:47 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 413E28FC14; Thu, 7 Jun 2012 05:37:47 +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 q575blLa062809; Thu, 7 Jun 2012 05:37:47 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q575blKn062807; Thu, 7 Jun 2012 05:37:47 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201206070537.q575blKn062807@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 7 Jun 2012 05:37:47 +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: r236703 - stable/8/sys/dev/bge 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: Thu, 07 Jun 2012 05:37:47 -0000 Author: yongari Date: Thu Jun 7 05:37:46 2012 New Revision: 236703 URL: http://svn.freebsd.org/changeset/base/236703 Log: MFC r236371: Remove unnecessary device_printfs. Modified: stable/8/sys/dev/bge/if_bge.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (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) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Thu Jun 7 05:35:43 2012 (r236702) +++ stable/8/sys/dev/bge/if_bge.c Thu Jun 7 05:37:46 2012 (r236703) @@ -2800,17 +2800,9 @@ bge_mbox_reorder(struct bge_softc *sc) for (;;) { dev = device_get_parent(bus); bus = device_get_parent(dev); - device_printf(sc->bge_dev, "dev : %s%d, bus : %s%d\n", - device_get_name(dev), device_get_unit(dev), - device_get_name(bus), device_get_unit(bus)); if (device_get_devclass(dev) != pcib) break; for (i = 0; i < nitems(mbox_reorder_lists); i++) { - device_printf(sc->bge_dev, - "probing dev : %s%d, vendor : 0x%04x " - "device : 0x%04x\n", - device_get_name(dev), device_get_unit(dev), - pci_get_vendor(dev), pci_get_device(dev)); if (pci_get_vendor(dev) == mbox_reorder_lists[i].vendor && pci_get_device(dev) == From owner-svn-src-stable-8@FreeBSD.ORG Thu Jun 7 14:02:08 2012 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 79A841065670; Thu, 7 Jun 2012 14:02:08 +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 648DB8FC15; Thu, 7 Jun 2012 14:02:08 +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 q57E2810092040; Thu, 7 Jun 2012 14:02:08 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q57E283A092038; Thu, 7 Jun 2012 14:02:08 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206071402.q57E283A092038@svn.freebsd.org> From: John Baldwin Date: Thu, 7 Jun 2012 14:02:08 +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: r236714 - stable/8/usr.bin/fstat 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: Thu, 07 Jun 2012 14:02:08 -0000 Author: jhb Date: Thu Jun 7 14:02:07 2012 New Revision: 236714 URL: http://svn.freebsd.org/changeset/base/236714 Log: Correct the format specifier for shm_size. shm_size is a size_t unlike the uint64_t size field in libprocstat's shmstat structure in 9.x and later. Pointy hat to: jhb Modified: stable/8/usr.bin/fstat/fstat.c Modified: stable/8/usr.bin/fstat/fstat.c ============================================================================== --- stable/8/usr.bin/fstat/fstat.c Thu Jun 7 10:53:42 2012 (r236713) +++ stable/8/usr.bin/fstat/fstat.c Thu Jun 7 14:02:07 2012 (r236714) @@ -988,7 +988,7 @@ shmtrans(struct shmfd *shmp, int i, int printf(" %-15s", name[0] != '\0' ? name : "-"); strmode(shm.shm_mode, mode); } - printf(" %10s %6ju", mode, shm.shm_size); + printf(" %10s %6zu", mode, shm.shm_size); printf(" %2s\n", rw); return; From owner-svn-src-stable-8@FreeBSD.ORG Thu Jun 7 18:54:42 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C0F40106564A; Thu, 7 Jun 2012 18:54:42 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AAD1C8FC0C; Thu, 7 Jun 2012 18:54:42 +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 q57Isgtn005474; Thu, 7 Jun 2012 18:54:42 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q57IsgLg005472; Thu, 7 Jun 2012 18:54:42 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201206071854.q57IsgLg005472@svn.freebsd.org> From: Sean Bruno Date: Thu, 7 Jun 2012 18:54:42 +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: r236720 - stable/8/sys/dev/mfi 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: Thu, 07 Jun 2012 18:54:42 -0000 Author: sbruno Date: Thu Jun 7 18:54:42 2012 New Revision: 236720 URL: http://svn.freebsd.org/changeset/base/236720 Log: MFC r236323 Cosmetic nit. If a configured volume has no label, don't emit an empty string for the name during probe. Simply indicate that it has no label. Modified: stable/8/sys/dev/mfi/mfi_disk.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/mfi/mfi_disk.c ============================================================================== --- stable/8/sys/dev/mfi/mfi_disk.c Thu Jun 7 18:44:06 2012 (r236719) +++ stable/8/sys/dev/mfi/mfi_disk.c Thu Jun 7 18:54:42 2012 (r236720) @@ -130,10 +130,17 @@ mfi_disk_attach(device_t dev) state = "unknown"; break; } - device_printf(dev, "%juMB (%ju sectors) RAID volume '%s' is %s\n", - sectors / (1024 * 1024 / secsize), sectors, - ld_info->ld_config.properties.name, - state); + + if ( strlen(ld_info->ld_config.properties.name) == 0 ) { + device_printf(dev, + "%juMB (%ju sectors) RAID volume (no label) is %s\n", + sectors / (1024 * 1024 / secsize), sectors, state); + } else { + device_printf(dev, + "%juMB (%ju sectors) RAID volume '%s' is %s\n", + sectors / (1024 * 1024 / secsize), sectors, + ld_info->ld_config.properties.name, state); + } sc->ld_disk = disk_alloc(); sc->ld_disk->d_drv1 = sc; From owner-svn-src-stable-8@FreeBSD.ORG Thu Jun 7 19:19:13 2012 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 53FAB1065672; Thu, 7 Jun 2012 19:19:13 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D5718FC14; Thu, 7 Jun 2012 19:19:13 +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 q57JJDOo006723; Thu, 7 Jun 2012 19:19:13 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q57JJDUP006721; Thu, 7 Jun 2012 19:19:13 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201206071919.q57JJDUP006721@svn.freebsd.org> From: Sean Bruno Date: Thu, 7 Jun 2012 19:19:13 +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: r236723 - stable/8/share/man/man4 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: Thu, 07 Jun 2012 19:19:13 -0000 Author: sbruno Date: Thu Jun 7 19:19:12 2012 New Revision: 236723 URL: http://svn.freebsd.org/changeset/base/236723 Log: MFC r236412,236418,236420,236591,236624 Doc updates for bce(4) tuneables Note that for 7/8/9 the strict_rx_mtu variable is named loose_rx_mtu. Modified: stable/8/share/man/man4/bce.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/bce.4 ============================================================================== --- stable/8/share/man/man4/bce.4 Thu Jun 7 19:12:49 2012 (r236722) +++ stable/8/share/man/man4/bce.4 Thu Jun 7 19:19:12 2012 (r236723) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 7, 2009 +.Dd June 4, 2012 .Dt BCE 4 .Os .Sh NAME @@ -200,9 +200,73 @@ variables and .Xr loader 8 tunables: .Bl -tag -width indent +.It Va hw.bce.verbose +Enable/Disable verbose logging and output to the console. +Useful for debugging (default 0). .It Va hw.bce.msi_enable -Whether or not MSI support is enabled in the driver. -The default value is 1. +Enable/Disable MSI support (default 1). +.It Va hw.bce.tso_enable +Enable/Disable TSO support (default 1). +.It Va hw.bce.loose_rx_mtu +Enable/Disable strict RX frame size checking (default 0). +.It Va hw.bce.hdr_split +Enable/Disable frame header/payload splitting (default 1). +.It Va hw.bce.rx_pages +Set the number of memory pages assigned to recieve packets by the driver. +Due to alignment issues, this value can only be of the set +1, 2, 4 or 8 (default 2). +.It Va hw.bce.tx_pages +Set the number of memory pages assigned to transmit packets +by the driver. +Due to alignment issues, this value can only be of the set +1, 2, 4 or 8 (default 2). +.It Va hw.bce.rx_ticks +Time in microsecond ticks to wait before generating a status +block updates due to RX processing activity. +Values from 0-100 are valid. +A value of 0 disables this status block update. +Cannot be set to 0 if hw.bce.rx_quick_cons_trip is also 0 +(default 18). +.It Va hw.bce.rx_ticks_int +Time in microsecond ticks to wait during RX interrupt +processing before generating a status block update. +Values from 0-100 are valid. +Valid values are in the range from 0-100. +A value of 0 disables this status block update (default 18). +.It Va hw.bce.rx_quick_cons_trip +Number of RX Quick BD Chain entries that must be completed +before a status block is generated. +Values from 0-256 are valid. +A value of 0 disables this status block update. +Cannot be set to 0 if hw.bce.rx_ticks is also 0 (default 6). +.It Va hw.bce.rx_quick_cons_trip_int +Number of RX quick BD entries that must be completed before +a status block is generated duing interrupt processing. +Values from 0-256 are valid. +A value of 0 disables this status block update (default 6). +.It Va hw.bce.tx_ticks +Time in microsecond ticks to wait before a status block +update is generated due to TX activitiy. +Values from 0-100 are valid. +A value of 0 disables this status block update. +Cannot be set to 0 if hw.bce.tx_quick_cons_trip is also 0 +(default 80). +.It Va hw.bce.tx_ticks_int +Time in microsecond ticks to wait in interrupt processing +before a status block update is generated due to TX activity +Values from 0-100 are valid. +A value of 0 disables this status block update (default 80). +.It Va hw.bce.tx_cons_trip +How many TX Quick BD Chain entries that must be completed +before a status block is generated. +Values from 0-100 are valid. +A value of 0 disables this status block update. +Cannot be set to 0 if hw.bce.tx_ticks is also 0 (default 20). +.It Va hw.bce.tx_cons_trip_int +How many TX Quick BD Chain entries that must be completed +before a status block is generated during an interrupt. +Values from 0-100 are valid. +A value of 0 disables this status block update (default 20). .El .Sh DIAGNOSTICS .Bl -diag @@ -266,7 +330,7 @@ address space. .It "bce%d: Could not allocate TX descriptor chain DMA tag!" The driver could not allocate a DMA tag for the controller's TX chain. -.It "bce%d: Could not allocate TX descriptor chain DMA memory! +.It "bce%d: Could not allocate TX descriptor chain DMA memory!" The driver could not allocate DMA addressable memory for the controller's TX chain. .It "bce%d: Could not map TX descriptor chain DMA memory!" @@ -346,6 +410,10 @@ with the cable connection, or a driver l A controller hardware failure has occurred. If the problem continues replace the controller. .El +.Sh SUPPORT +For general information and support, +go to the Broadcom NIC Open Source Developer Resource Site: +.Pa http://www.broadcom.com/support/ethernet_nic/open_source.php . .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 8 05:54:37 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 399E91065670; Fri, 8 Jun 2012 05:54:37 +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 240058FC1D; Fri, 8 Jun 2012 05:54:37 +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 q585sasO035757; Fri, 8 Jun 2012 05:54:36 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q585sabU035755; Fri, 8 Jun 2012 05:54:36 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206080554.q585sabU035755@svn.freebsd.org> From: Alexander Motin Date: Fri, 8 Jun 2012 05:54:36 +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: r236735 - stable/8/sys/geom/multipath 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, 08 Jun 2012 05:54:37 -0000 Author: mav Date: Fri Jun 8 05:54:36 2012 New Revision: 236735 URL: http://svn.freebsd.org/changeset/base/236735 Log: MFC r236619: Add missing newlines into XML output. Modified: stable/8/sys/geom/multipath/g_multipath.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/geom/multipath/g_multipath.c ============================================================================== --- stable/8/sys/geom/multipath/g_multipath.c Fri Jun 8 05:53:25 2012 (r236734) +++ stable/8/sys/geom/multipath/g_multipath.c Fri Jun 8 05:54:36 2012 (r236735) @@ -1312,7 +1312,7 @@ g_multipath_dumpconf(struct sbuf *sb, co if (sc == NULL) return; if (cp != NULL) { - sbuf_printf(sb, "%s%s", indent, + sbuf_printf(sb, "%s%s\n", indent, (cp->index & MP_NEW) ? "NEW" : (cp->index & MP_LOST) ? "LOST" : (cp->index & MP_FAIL) ? "FAIL" : @@ -1321,17 +1321,17 @@ g_multipath_dumpconf(struct sbuf *sb, co sc->sc_active_active == 2 ? "READ" : "PASSIVE"); } else { good = g_multipath_good(gp); - sbuf_printf(sb, "%s%s", indent, + sbuf_printf(sb, "%s%s\n", indent, good == 0 ? "BROKEN" : (good != sc->sc_ndisks || sc->sc_ndisks == 1) ? "DEGRADED" : "OPTIMAL"); } if (cp == NULL && pp == NULL) { - sbuf_printf(sb, "%s%s", indent, sc->sc_uuid); - sbuf_printf(sb, "%sActive/%s", indent, + sbuf_printf(sb, "%s%s\n", indent, sc->sc_uuid); + sbuf_printf(sb, "%sActive/%s\n", indent, sc->sc_active_active == 2 ? "Read" : sc->sc_active_active == 1 ? "Active" : "Passive"); - sbuf_printf(sb, "%s%s", indent, + sbuf_printf(sb, "%s%s\n", indent, sc->sc_uuid[0] == 0 ? "MANUAL" : "AUTOMATIC"); } } From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 8 11:40:30 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 93D8010656D0; Fri, 8 Jun 2012 11:40:30 +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 7D9BC8FC0C; Fri, 8 Jun 2012 11:40: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 q58BeUxH056145; Fri, 8 Jun 2012 11:40:30 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q58BeUZw056143; Fri, 8 Jun 2012 11:40:30 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206081140.q58BeUZw056143@svn.freebsd.org> From: Alexander Motin Date: Fri, 8 Jun 2012 11:40:30 +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: r236743 - stable/8/sys/dev/sound/pcm 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, 08 Jun 2012 11:40:30 -0000 Author: mav Date: Fri Jun 8 11:40:30 2012 New Revision: 236743 URL: http://svn.freebsd.org/changeset/base/236743 Log: MFC r214332: Make hw.snd.vpc_0db to be also a loader tunable. Modified: stable/8/sys/dev/sound/pcm/channel.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/sound/pcm/channel.c ============================================================================== --- stable/8/sys/dev/sound/pcm/channel.c Fri Jun 8 10:03:37 2012 (r236742) +++ stable/8/sys/dev/sound/pcm/channel.c Fri Jun 8 11:40:30 2012 (r236743) @@ -124,6 +124,7 @@ SYSCTL_INT(_hw_snd, OID_AUTO, vpc_autore &chn_vpc_autoreset, 0, "automatically reset channels volume to 0db"); static int chn_vol_0db_pcm = SND_VOL_0DB_PCM; +TUNABLE_INT("hw.snd.vpc_0db", &chn_vol_0db_pcm); static void chn_vpc_proc(int reset, int db) From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 8 11:58:28 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D5370106566B; Fri, 8 Jun 2012 11:58:28 +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 BF25E8FC0A; Fri, 8 Jun 2012 11:58:28 +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 q58BwSLP057042; Fri, 8 Jun 2012 11:58:28 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q58BwS6G057040; Fri, 8 Jun 2012 11:58:28 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206081158.q58BwS6G057040@svn.freebsd.org> From: Alexander Motin Date: Fri, 8 Jun 2012 11:58:28 +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: r236745 - stable/8/sys/dev/sound/pcm 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, 08 Jun 2012 11:58:29 -0000 Author: mav Date: Fri Jun 8 11:58:28 2012 New Revision: 236745 URL: http://svn.freebsd.org/changeset/base/236745 Log: MFC r222826: Make automatic hw.snd.default_unit choice a bit more intelligent. Instead of just setting it to the first registered device, reevaluate it for each device registered, trying to choose best candidate, unless one was forced. For now use such preference order: play&rec, play, rec. As side effect, this should workaround the situation when HDMI audio output of the video card, usually not connected to anything, becomes default, that requires manual user intervention to make sound working. If at some point this won't be enough, we can try to fetch some additional priority flags from the device driver. Modified: stable/8/sys/dev/sound/pcm/sound.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/sound/pcm/sound.c ============================================================================== --- stable/8/sys/dev/sound/pcm/sound.c Fri Jun 8 11:53:51 2012 (r236744) +++ stable/8/sys/dev/sound/pcm/sound.c Fri Jun 8 11:58:28 2012 (r236745) @@ -51,7 +51,7 @@ int pcm_veto_load = 1; int snd_unit = -1; TUNABLE_INT("hw.snd.default_unit", &snd_unit); -static int snd_unit_auto = 0; +static int snd_unit_auto = -1; TUNABLE_INT("hw.snd.default_auto", &snd_unit_auto); SYSCTL_INT(_hw_snd, OID_AUTO, default_auto, CTLFLAG_RW, &snd_unit_auto, 0, "assign default unit to a newly attached device"); @@ -443,6 +443,7 @@ sysctl_hw_snd_default_unit(SYSCTL_HANDLE if (!PCM_REGISTERED(d) || CHN_EMPTY(d, channels.pcm)) return EINVAL; snd_unit = unit; + snd_unit_auto = 0; } return (error); } @@ -737,6 +738,32 @@ pcm_killchan(device_t dev) return (pcm_chn_destroy(ch)); } +static int +pcm_best_unit(int old) +{ + struct snddev_info *d; + int i, best, bestprio, prio; + + best = -1; + bestprio = -100; + for (i = 0; pcm_devclass != NULL && + i < devclass_get_maxunit(pcm_devclass); i++) { + d = devclass_get_softc(pcm_devclass, i); + if (!PCM_REGISTERED(d)) + continue; + prio = 0; + if (d->playcount == 0) + prio -= 10; + if (d->reccount == 0) + prio -= 2; + if (prio > bestprio || (prio == bestprio && i == old)) { + best = i; + bestprio = prio; + } + } + return (best); +} + int pcm_setstatus(device_t dev, char *str) { @@ -770,8 +797,12 @@ pcm_setstatus(device_t dev, char *str) PCM_UNLOCK(d); - if (snd_unit < 0 || snd_unit_auto != 0) + if (snd_unit_auto < 0) + snd_unit_auto = (snd_unit < 0) ? 1 : 0; + if (snd_unit < 0 || snd_unit_auto > 1) snd_unit = device_get_unit(dev); + else if (snd_unit_auto == 1) + snd_unit = pcm_best_unit(snd_unit); return (0); } @@ -1113,7 +1144,6 @@ pcm_unregister(device_t dev) struct snddev_info *d; struct pcm_channel *ch; struct thread *td; - int i; td = curthread; d = device_get_softc(dev); @@ -1216,21 +1246,9 @@ pcm_unregister(device_t dev) sndstat_release(td); if (snd_unit == device_get_unit(dev)) { - /* - * Reassign default unit to the next available dev, but - * first, reset snd_unit to something ridiculous. - */ - snd_unit = -1; - for (i = 0; pcm_devclass != NULL && - i < devclass_get_maxunit(pcm_devclass); i++) { - if (device_get_unit(dev) == i) - continue; - d = devclass_get_softc(pcm_devclass, i); - if (PCM_REGISTERED(d)) { - snd_unit = i; - break; - } - } + snd_unit = pcm_best_unit(-1); + if (snd_unit_auto == 0) + snd_unit_auto = 1; } return (0); From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 8 12:23:03 2012 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 0DA94106566C; Fri, 8 Jun 2012 12:23:03 +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 E2BCF8FC19; Fri, 8 Jun 2012 12:23:02 +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 q58CN2ut058271; Fri, 8 Jun 2012 12:23:02 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q58CN2pZ058269; Fri, 8 Jun 2012 12:23:02 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206081223.q58CN2pZ058269@svn.freebsd.org> From: Alexander Motin Date: Fri, 8 Jun 2012 12:23:02 +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: r236747 - stable/8/sys/dev/sound/pci/hda 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, 08 Jun 2012 12:23:03 -0000 Author: mav Date: Fri Jun 8 12:23:02 2012 New Revision: 236747 URL: http://svn.freebsd.org/changeset/base/236747 Log: MFC r223058: Add bunch of Conexant codec IDs. For some of them add quirks to disable excessive signal paths to simplify tracer's life. Modified: stable/8/sys/dev/sound/pci/hda/hdac.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/8/sys/dev/sound/pci/hda/hdac.c Fri Jun 8 12:09:00 2012 (r236746) +++ stable/8/sys/dev/sound/pci/hda/hdac.c Fri Jun 8 12:23:02 2012 (r236747) @@ -754,7 +754,17 @@ static const struct { #define HDA_CODEC_CX20561 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5051) #define HDA_CODEC_CX20582 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5066) #define HDA_CODEC_CX20583 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5067) +#define HDA_CODEC_CX20584 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5068) #define HDA_CODEC_CX20585 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5069) +#define HDA_CODEC_CX20590 HDA_CODEC_CONSTRUCT(CONEXANT, 0x506e) +#define HDA_CODEC_CX20631 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5097) +#define HDA_CODEC_CX20632 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5098) +#define HDA_CODEC_CX20641 HDA_CODEC_CONSTRUCT(CONEXANT, 0x50a1) +#define HDA_CODEC_CX20642 HDA_CODEC_CONSTRUCT(CONEXANT, 0x50a2) +#define HDA_CODEC_CX20651 HDA_CODEC_CONSTRUCT(CONEXANT, 0x50ab) +#define HDA_CODEC_CX20652 HDA_CODEC_CONSTRUCT(CONEXANT, 0x50ac) +#define HDA_CODEC_CX20664 HDA_CODEC_CONSTRUCT(CONEXANT, 0x50b8) +#define HDA_CODEC_CX20665 HDA_CODEC_CONSTRUCT(CONEXANT, 0x50b9) #define HDA_CODEC_CXXXXX HDA_CODEC_CONSTRUCT(CONEXANT, 0xffff) /* VIA */ @@ -939,7 +949,17 @@ static const struct { { HDA_CODEC_CX20561, "Conexant CX20561 (Hermosa)" }, { HDA_CODEC_CX20582, "Conexant CX20582 (Pebble)" }, { HDA_CODEC_CX20583, "Conexant CX20583 (Pebble HSF)" }, + { HDA_CODEC_CX20584, "Conexant CX20584" }, { HDA_CODEC_CX20585, "Conexant CX20585" }, + { HDA_CODEC_CX20590, "Conexant CX20590" }, + { HDA_CODEC_CX20631, "Conexant CX20631" }, + { HDA_CODEC_CX20632, "Conexant CX20632" }, + { HDA_CODEC_CX20641, "Conexant CX20641" }, + { HDA_CODEC_CX20642, "Conexant CX20642" }, + { HDA_CODEC_CX20651, "Conexant CX20651" }, + { HDA_CODEC_CX20652, "Conexant CX20652" }, + { HDA_CODEC_CX20664, "Conexant CX20664" }, + { HDA_CODEC_CX20665, "Conexant CX20665" }, { HDA_CODEC_VT1708_8, "VIA VT1708_8" }, { HDA_CODEC_VT1708_9, "VIA VT1708_9" }, { HDA_CODEC_VT1708_A, "VIA VT1708_A" }, @@ -4921,6 +4941,25 @@ hdac_vendor_patch_parse(struct hdac_devi if (w != NULL) w->connsenable[0] = 0; break; + case HDA_CODEC_CX20582: + case HDA_CODEC_CX20583: + case HDA_CODEC_CX20584: + case HDA_CODEC_CX20585: + case HDA_CODEC_CX20590: + /* + * These codecs have extra connectivity on record side + * too reach for the present parser. + */ + w = hdac_widget_get(devinfo, 20); + if (w != NULL) + w->connsenable[1] = 0; + w = hdac_widget_get(devinfo, 21); + if (w != NULL) + w->connsenable[1] = 0; + w = hdac_widget_get(devinfo, 22); + if (w != NULL) + w->connsenable[0] = 0; + break; case HDA_CODEC_VT1708S_0: case HDA_CODEC_VT1708S_1: case HDA_CODEC_VT1708S_2: From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 8 12:24:48 2012 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 1CE42106564A; Fri, 8 Jun 2012 12:24:48 +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 071C68FC1A; Fri, 8 Jun 2012 12:24:48 +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 q58COlvf058395; Fri, 8 Jun 2012 12:24:47 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q58COlqT058393; Fri, 8 Jun 2012 12:24:47 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206081224.q58COlqT058393@svn.freebsd.org> From: Alexander Motin Date: Fri, 8 Jun 2012 12:24:47 +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: r236748 - stable/8/sys/dev/sound/pci/hda 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, 08 Jun 2012 12:24:48 -0000 Author: mav Date: Fri Jun 8 12:24:47 2012 New Revision: 236748 URL: http://svn.freebsd.org/changeset/base/236748 Log: MFC r224967: Fix headphones pin configuration on Lenovo B450 laptop. Modified: stable/8/sys/dev/sound/pci/hda/hdac.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/8/sys/dev/sound/pci/hda/hdac.c Fri Jun 8 12:23:02 2012 (r236747) +++ stable/8/sys/dev/sound/pci/hda/hdac.c Fri Jun 8 12:24:47 2012 (r236748) @@ -295,6 +295,7 @@ SND_DECLARE_FILE("$FreeBSD$"); #define LENOVO_VENDORID 0x17aa #define LENOVO_3KN100_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x2066) #define LENOVO_3KN200_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x384e) +#define LENOVO_B450_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x3a0d) #define LENOVO_TCA55_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x1015) #define LENOVO_ALL_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0xffff) @@ -2582,6 +2583,13 @@ hdac_widget_pin_getconfig(struct hdac_wi break; } } + } else if (id == HDA_CODEC_CX20561 && + sc->pci_subvendor == LENOVO_B450_SUBVENDOR) { + switch (nid) { + case 22: + patch = "as=1 seq=15"; + break; + } } if (patch != NULL) From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 8 12:31:50 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 695571065670; Fri, 8 Jun 2012 12:31:50 +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 53F3E8FC0A; Fri, 8 Jun 2012 12:31:50 +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 q58CVoFD058910; Fri, 8 Jun 2012 12:31:50 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q58CVoON058908; Fri, 8 Jun 2012 12:31:50 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206081231.q58CVoON058908@svn.freebsd.org> From: Alexander Motin Date: Fri, 8 Jun 2012 12:31:50 +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: r236749 - stable/8/sys/dev/sound/pci/hda 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, 08 Jun 2012 12:31:50 -0000 Author: mav Date: Fri Jun 8 12:31:49 2012 New Revision: 236749 URL: http://svn.freebsd.org/changeset/base/236749 Log: MFC r223118: Hide driver revision behind bootverbose. Modified: stable/8/sys/dev/sound/pci/hda/hdac.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/8/sys/dev/sound/pci/hda/hdac.c Fri Jun 8 12:24:47 2012 (r236748) +++ stable/8/sys/dev/sound/pci/hda/hdac.c Fri Jun 8 12:31:49 2012 (r236749) @@ -4154,7 +4154,10 @@ hdac_attach(device_t dev) uint16_t vendor; uint8_t v; - device_printf(dev, "HDA Driver Revision: %s\n", HDA_DRV_TEST_REV); + HDA_BOOTVERBOSE( + device_printf(dev, "HDA Driver Revision: %s\n", + HDA_DRV_TEST_REV); + ); model = (uint32_t)pci_get_device(dev) << 16; model |= (uint32_t)pci_get_vendor(dev) & 0x0000ffff; From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 8 12:35:44 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6EA61106566B; Fri, 8 Jun 2012 12:35:44 +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 55BBB8FC15; Fri, 8 Jun 2012 12:35:44 +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 q58CZi7c059156; Fri, 8 Jun 2012 12:35:44 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q58CZiiK059149; Fri, 8 Jun 2012 12:35:44 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206081235.q58CZiiK059149@svn.freebsd.org> From: Alexander Motin Date: Fri, 8 Jun 2012 12:35:44 +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: r236750 - in stable/8: share/man/man4 sys/conf sys/dev/sound/pci/hda sys/modules/sound/driver/hda 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, 08 Jun 2012 12:35:44 -0000 Author: mav Date: Fri Jun 8 12:35:43 2012 New Revision: 236750 URL: http://svn.freebsd.org/changeset/base/236750 Log: MFC r230130: Major snd_hda driver rewrite: - Huge old hdac driver was split into three independent pieces: HDA controller driver (hdac), HDA CODEC driver (hdacc) and HDA sudio function driver (hdaa). - Support for multichannel recording was added. Now, as specification defines, driver checks input associations for pins with sequence numbers 14 and 15, and if found (usually) -- works as before, mixing signals together. If it doesn't, it configures input association as multichannel. - Signal tracer was improved to look for cases where several DACs/ADCs in CODEC can work with the same audio signal. If such case found, driver registers additional playback/record stream (channel) for the pcm device. - New controller streams reservation mechanism was implemented. That allows to have more pcm devices then streams supported by the controller (usually 4 in each direction). Now it limits only number of simultaneously transferred audio streams, that is rarely reachable and properly reported if happens. - Codec pins and GPIO signals configuration was exported via set of writable sysctls. Another sysctl dev.hdaa.X.reconfig allows to trigger driver reconfiguration in run-time. - Driver now decodes pins location and connector type names. In some cases it allows to hint user where on the system case connectors, related to the pcm device, are located. Number of channels supported by pcm device, reported now (if it is not 2), should also make search easier. - Added workaround for digital mic on some Asus laptops/netbooks. Sponsored by: iXsystems, Inc. Added: stable/8/sys/dev/sound/pci/hda/hdaa.c - copied unchanged from r230130, head/sys/dev/sound/pci/hda/hdaa.c stable/8/sys/dev/sound/pci/hda/hdaa.h - copied unchanged from r230130, head/sys/dev/sound/pci/hda/hdaa.h stable/8/sys/dev/sound/pci/hda/hdaa_patches.c - copied unchanged from r230130, head/sys/dev/sound/pci/hda/hdaa_patches.c stable/8/sys/dev/sound/pci/hda/hdac_if.m - copied unchanged from r230130, head/sys/dev/sound/pci/hda/hdac_if.m stable/8/sys/dev/sound/pci/hda/hdacc.c - copied unchanged from r230130, head/sys/dev/sound/pci/hda/hdacc.c Modified: stable/8/share/man/man4/snd_hda.4 stable/8/sys/conf/files stable/8/sys/conf/kmod.mk stable/8/sys/dev/sound/pci/hda/hda_reg.h stable/8/sys/dev/sound/pci/hda/hdac.c stable/8/sys/dev/sound/pci/hda/hdac.h stable/8/sys/dev/sound/pci/hda/hdac_private.h stable/8/sys/dev/sound/pci/hda/hdac_reg.h stable/8/sys/modules/sound/driver/hda/Makefile Directory Properties: stable/8/share/man/man4/ (props changed) stable/8/sys/ (props changed) Modified: stable/8/share/man/man4/snd_hda.4 ============================================================================== --- stable/8/share/man/man4/snd_hda.4 Fri Jun 8 12:31:49 2012 (r236749) +++ stable/8/share/man/man4/snd_hda.4 Fri Jun 8 12:35:43 2012 (r236750) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 22, 2010 +.Dd January 11, 2012 .Dt SND_HDA 4 .Os .Sh NAME @@ -53,8 +53,9 @@ support for several logical audio device .Pp The .Nm -driver is a HDA bus controller driver and HDA codecs audio functions bridge -driver that allows the generic audio driver, +driver includes HDA bus controller driver (hdac), HDA codec driver (hdacc) +and HDA codecs audio functions bridge driver (hdaa) that allows +the generic audio driver, .Xr sound 4 , to be used with this hardware. Only audio functions are supported by @@ -77,7 +78,9 @@ For example, one device for main rear 7. for independent headset connectors at front and one device for SPDIF or HDMI audio input/output. The assignment of audio inputs and outputs may be tuned with -.Xr device.hints 5 . +.Xr device.hints 5 +or +.Xr sysctl 8 . The driver's verbose boot messages provide a lot of information about the operation of the driver and present audio setup. .Pp @@ -92,19 +95,26 @@ The following variables are available at file: .Bl -tag -width ".Va hint.hdac.%d.config"-offset indent .It Va hint.hdac.%d.config -Configures a range of possible options. +Configures a range of possible controller options. Possible values are: +.Dq Li 64bit , .Dq Li dmapos , +.Dq Li msi . +An option prefixed with +.Dq Li no , +such as +.Dq Li nomsi , +will do the opposite and takes precedence. +Options can be separated by whitespace and commas. +.It Va hint.hdac.%d.msi +Controls MSI (Message Signaled Interrupts) support. +.It Va hint.hdac.%d.cad%d.nid%d.config +Same as +.Va hint.hdaa.%d.nid%d.config +.It Va hint.hdaa.%d.config +Configures a range of possible audio function options. +Possible values are: .Dq Li eapdinv , -.Dq Li gpio0 , -.Dq Li gpio1 , -.Dq Li gpio2 , -.Dq Li gpio3 , -.Dq Li gpio4 , -.Dq Li gpio5 , -.Dq Li gpio6 , -.Dq Li gpio7 , -.Dq Li gpioflush , .Dq Li ivref , .Dq Li ivref50 , .Dq Li ivref80 , @@ -126,22 +136,47 @@ such as will do the opposite and takes precedence. Options can be separated by whitespace and commas. .Pp +The +.Dq Li eapdinv +option inverts External Amplifier Power Down signal. +The +.Dq Li fixedrate +denies all sampling rates except 48KHz. +The +.Dq Li forcestereo +denies mono playback/recording. +The +.Dq Li senseinv +option inverts jack sensing logic. +The +.Dq Li ivref Ns Ar X +and +.Dq Li ovref Ns Ar X +options control the voltage used to power external microphones. +.It Va hint.hdaa.%d.gpio_config +Overrides audio function GPIO pins configuration set by BIOS. +May be specified as a set of space-separated +.Dq Ar num Ns = Ns Ar value +pairs, where +.Ar num +is GPIO line number, and +.Ar value +is one of: +.Dq Li keep , +.Dq Li set , +.Dq Li clear , +.Dq Li disable +and +.Dq Li input . +.Pp .Dq Li GPIO Ns s are a codec's General Purpose I/O pins which system integrators sometimes use to control external muters, amplifiers and so on. If you have no sound, or sound volume is not adequate, you may have to experiment a bit with the GPIO setup to find the optimal setup for your system. -.Pp -The -.Dq Li ivref Ns Ar X -and -.Dq Li ovref Ns Ar X -options control the voltage used to power external microphones. -.It Va hint.hdac.%d.msi -Controls MSI (Message Signaled Interrupts) support. -.It Va hint.hdac.%d.cad%d.nid%d.config -Overrides codec pin configuration set by BIOS. +.It Va hint.hdaa.%d.nid%d.config +Overrides audio function pin configuration set by BIOS. May be specified as a 32-bit hexadecimal value with a leading .Dq 0x , or as a set of space-separated @@ -165,7 +200,7 @@ The following options are supported: Association number. Associations are used to group individual pins to form a complex multi-pin device. -For example, to group 4 connectors for 7.1 output, or to treat several +For example, to group 4 connectors for 7.1 input/output, or to treat several input connectors as sources for the same input device. Association numbers can be specified as numeric values from 0 to 15. A value of 0 means disabled pin. @@ -180,16 +215,22 @@ A unique, per-association number used to particular association. Sequence numbers can be specified as numeric values from 0 to 15. .Pp -For output assotiations sequence numbers encode speaker pairs positions: -0 - Front, 1 - Center/LFE, 2 - Back, 3 - Front Wide Center, 4 - Side. -Standard combinations are: (0) - Stereo; (0, 2), (0, 4) - Quadro; -(0, 1, 2), (0, 1, 4) - 5.1; (0, 1, 2, 4) - 7.1. -.Pp The sequence number 15 has a special meaning for output associations. Output pins with this number and device type .Dq Ar Headphones will duplicate (with automatic mute if jack detection is supported) the first pin in that association. +.Pp +The sequence numbers 14 and 15 has a special meaning for input associations. +Their presence in association defines it as multiplexed or mixed respectively. +If none of them present and there are more then one pin in association, +the association will provide multichannel input. +.Pp +For multichannel input/output assotiations sequence numbers encode +channel pairs positions: +0 - Front, 1 - Center/LFE, 2 - Back, 3 - Front Wide Center, 4 - Side. +Standard combinations are: (0) - Stereo; (0, 2), (0, 4) - Quadro; +(0, 1, 2), (0, 1, 4) - 5.1; (0, 1, 2, 4) - 7.1. .It Va device Device type. Can be specified as a number from 0 to 15 or as a name: @@ -278,7 +319,11 @@ The following variables are available in addition to those available to all .Xr sound 4 devices: -.Bl -tag -width ".Va dev.hdac.%d.polling" -offset indent +.Bl -tag -width ".Va dev.hdaa.%d.nid%d_original" -offset indent +.It Va dev.hdac.%d.pindump +Setting this to a non-zero value dumps the current pin configuration, main +capabilities and jack sense status of all audio functions on the controller +to console and syslog. .It Va dev.hdac.%d.polling Enables polling mode. In this mode the driver operates by querying the device state on timer @@ -288,11 +333,30 @@ instead of interrupts. Polling is disabled by default. Do not enable it unless you are facing weird interrupt problems or if the device cannot generate interrupts at all. -.It Va dev.hdac.%d.polling_interval -Controller/Jack Sense polling interval (1-1000 ms) -.It Va dev.hdac.%d.pindump -Setting this to a non-zero value dumps the current pin configuration, main -capabilities and jack sense status to console and syslog. +.It Va dev.hdaa.%d.config +Run-time equivalent of the +.Va hint.hdaa.%d.config +tunable. +.It Va dev.hdaa.%d.gpi_state +Current state of GPI lines. +.It Va dev.hdaa.%d.gpio_state +Current state of GPIO lines. +.It Va dev.hdaa.%d.gpio_config +Run-time equivalent of the +.Va hint.hdaa.%d.gpio.config +tunable. +.It Va dev.hdaa.%d.gpo_state +Current state of GPO lines. +.It Va dev.hdaa.%d.nid%d_config +Run-time equivalent of the +.Va hint.hdaa.%d.nid%d.config +tunable. +.It Va dev.hdaa.%d.nid%d_original +Original pin configuration written by BIOS. +.It Va dev.hdaa.%d.reconfig +Setting this to a non-zero value makes driver to destroy existing pcm devices +and process new pins configuration set via +.Va dev.hdaa.%d.nid%d_config. .El .Sh EXAMPLES Taking HP Compaq DX2300 with Realtek ALC888 HDA codec for example. @@ -307,22 +371,23 @@ So high codec uniformity and flexibility different ways, depending on requested pins usage decribed by pins configuration. The driver reports such default pin configuration when verbose messages enabled: .Bd -literal -hdac0: nid 20 0x01014020 as 2 seq 0 Line-out Jack jack 1 loc 1 color Green misc 0 -hdac0: nid 21 0x99130110 as 1 seq 0 Speaker Fixed jack 3 loc 25 color Unknown misc 1 -hdac0: nid 22 0x411111f0 as 15 seq 0 Speaker None jack 1 loc 1 color Black misc 1 -hdac0: nid 23 0x411111f0 as 15 seq 0 Speaker None jack 1 loc 1 color Black misc 1 -hdac0: nid 24 0x01a19830 as 3 seq 0 Mic Jack jack 1 loc 1 color Pink misc 8 -hdac0: nid 25 0x02a1983f as 3 seq 15 Mic Jack jack 1 loc 2 color Pink misc 8 -hdac0: nid 26 0x01813031 as 3 seq 1 Line-in Jack jack 1 loc 1 color Blue misc 0 -hdac0: nid 27 0x0221401f as 1 seq 15 Headphones Jack jack 1 loc 2 color Green misc 0 -hdac0: nid 28 0x411111f0 as 15 seq 0 Speaker None jack 1 loc 1 color Black misc 1 -hdac0: nid 30 0x411111f0 as 15 seq 0 Speaker None jack 1 loc 1 color Black misc 1 -hdac0: nid 31 0x411111f0 as 15 seq 0 Speaker None jack 1 loc 1 color Black misc 1 +hdaa0: nid 0x as seq device conn jack loc color misc +hdaa0: 20 01014020 2 0 Line-out Jack 1/8 Rear Green 0 +hdaa0: 21 99130110 1 0 Speaker Fixed ATAPI Onboard Unknown 1 +hdaa0: 22 411111f0 15 0 Speaker None 1/8 Rear Black 1 DISA +hdaa0: 23 411111f0 15 0 Speaker None 1/8 Rear Black 1 DISA +hdaa0: 24 01a19830 3 0 Mic Jack 1/8 Rear Pink 8 +hdaa0: 25 02a1983f 3 15 Mic Jack 1/8 Front Pink 8 +hdaa0: 26 01813031 3 1 Line-in Jack 1/8 Rear Blue 0 +hdaa0: 27 0221401f 1 15 Headphones Jack 1/8 Front Green 0 +hdaa0: 28 411111f0 15 0 Speaker None 1/8 Rear Black 1 DISA +hdaa0: 30 411111f0 15 0 Speaker None 1/8 Rear Black 1 DISA +hdaa0: 31 411111f0 15 0 Speaker None 1/8 Rear Black 1 DISA .Ed .Pp Here we can see, that the nodes with ID (nid) 25 and 27 are front panel -connectors (Jack, loc 2), nids 20, 24 and 26 are rear panel connectors -(Jack, loc 1) and nid 21 is a built-in speaker (Fixed, loc 25). +connectors (Jack, Front), nids 20, 24 and 26 are rear panel connectors +(Jack, Rear) and nid 21 is a built-in speaker (Fixed, Onboard). Pins with nids 22, 23, 28, 30 and 31 will be disabled by driver due to "None" connectivity. So the pin count and description matches to connectors that we have. @@ -330,15 +395,15 @@ we have. Using association (as) and sequence (seq) fields values pins are grouped into 3 associations: .Bd -literal -hdac0: Association 0 (1) out: -hdac0: Pin nid=21 seq=0 -hdac0: Pin nid=27 seq=15 -hdac0: Association 1 (2) out: -hdac0: Pin nid=20 seq=0 -hdac0: Association 2 (3) in: -hdac0: Pin nid=24 seq=0 -hdac0: Pin nid=26 seq=1 -hdac0: Pin nid=25 seq=15 +hdaa0: Association 0 (1) out: +hdaa0: Pin nid=21 seq=0 +hdaa0: Pin nid=27 seq=15 +hdaa0: Association 1 (2) out: +hdaa0: Pin nid=20 seq=0 +hdaa0: Association 2 (3) in: +hdaa0: Pin nid=24 seq=0 +hdaa0: Pin nid=26 seq=1 +hdaa0: Pin nid=25 seq=15 .Ed .Pp Each @@ -498,148 +563,14 @@ Most of controls use logarithmic scale. .Sh HARDWARE The .Nm -driver supports many Intel HDA compatible audio chipsets including the -following: -.Pp -.Bl -bullet -compact -.It -ATI SB450 -.It -ATI SB600 -.It -Intel 631x/632xESB -.It -Intel 82801F (ICH6) -.It -Intel 82801G (ICH7) -.It -Intel 82801H (ICH8) -.It -Intel 82801I (ICH9) -.It -Intel 82801J (ICH10) -.It -Intel US15W (SCH) -.It -nVidia MCP51 -.It -nVidia MCP55 -.It -nVidia MCP61A -.It -nVidia MCP61B -.It -nVidia MCP63 -.It -nVidia MCP65A -.It -nVidia MCP65B -.It -nVidia MCP67A -.It -nVidia MCP67B -.It -nVidia MCP68 -.It -nVidia MCP69 -.It -nVidia MCP73 -.It -nVidia MCP78 -.It -nVidia MCP79 -.It -nVidia MCP89 -.It -SiS 966 -.It -VIA VT8251/8237A -.El -.Pp -The following and many other codecs have been verified to work: +driver supports controllers having PCI class 4 (multimedia) and +subclass 3 (HDA), compatible with Intel HDA specification. .Pp -.Bl -bullet -compact -.It -Analog Devices AD1981HD -.It -Analog Devices AD1983 -.It -Analog Devices AD1984 -.It -Analog Devices AD1986A -.It -Analog Devices AD1988 -.It -Analog Devices AD1988B -.It -CMedia CMI9880 -.It -Conexant CX20549 (Venice) -.It -Conexant CX20551 (Waikiki) -.It -Conexant CX20561 (Hermosa) -.It -Realtek ALC260 -.It -Realtek ALC262 -.It -Realtek ALC268 -.It -Realtek ALC660 -.It -Realtek ALC861 -.It -Realtek ALC861VD -.It -Realtek ALC880 -.It -Realtek ALC882 -.It -Realtek ALC883 -.It -Realtek ALC885 -.It -Realtek ALC888 -.It -Realtek ALC889 -.It -Sigmatel STAC9205 -.It -Sigmatel STAC9220 -.It -Sigmatel STAC9220D / 9223D -.It -Sigmatel STAC9221 -.It -Sigmatel STAC9221D -.It -Sigmatel STAC9227D -.It -Sigmatel STAC9227X -.It -Sigmatel STAC9228D -.It -Sigmatel STAC9228X -.It -Sigmatel STAC9229D -.It -Sigmatel STAC9229X -.It -Sigmatel STAC9230D -.It -Sigmatel STAC9230X -.It -Sigmatel STAC9271D -.It -Sigmatel STAC9872AK -.It -VIA VT1708 -.It -VIA VT1708B -.It -VIA VT1709 -.El +The +.Nm +driver supports more then two hundred different controllers and CODECs. +There is no sense to list all of them here, as in most cases specific CODEC +configuration and wiring are more important then type of the CODEC itself. .Sh SEE ALSO .Xr sound 4 , .Xr snd_ich 4 , @@ -666,19 +597,17 @@ This manual page was written by and .An Giorgos Keramidas Aq keramida@FreeBSD.org . .Sh BUGS -A few Hardware/OEM vendors tend to screw up BIOS settings, thus -rendering the -.Nm -driver useless. -This usually results in a state where the +Some Hardware/OEM vendors tend to screw up BIOS settings or use custom +unusual CODEC wiring that create problems to the driver. +This may result in missing pcm devices, or a state where the .Nm driver seems to attach and work, but no sound is played. Some cases can be solved by tuning .Pa loader.conf variables. -Before trying to fix problem that way, make sure that there really is a problem -and that the PCM audio device in use really corresponds to the expected -audio connector. +But before trying to fix problem that way, make sure that there really is +a problem and that the PCM audio device in use really corresponds to the +expected audio connector. .Pp Some vendors use non-standardized General Purpose I/O (GPIO) pins of the codec to control external amplifiers. Modified: stable/8/sys/conf/files ============================================================================== --- stable/8/sys/conf/files Fri Jun 8 12:31:49 2012 (r236749) +++ stable/8/sys/conf/files Fri Jun 8 12:35:43 2012 (r236750) @@ -1615,7 +1615,11 @@ dev/sound/pci/t4dwave.c optional snd_t4 dev/sound/pci/via8233.c optional snd_via8233 pci dev/sound/pci/via82c686.c optional snd_via82c686 pci dev/sound/pci/vibes.c optional snd_vibes pci +dev/sound/pci/hda/hdaa.c optional snd_hda pci +dev/sound/pci/hda/hdaa_patches.c optional snd_hda pci dev/sound/pci/hda/hdac.c optional snd_hda pci +dev/sound/pci/hda/hdac_if.m optional snd_hda pci +dev/sound/pci/hda/hdacc.c optional snd_hda pci dev/sound/pcm/ac97.c optional sound dev/sound/pcm/ac97_if.m optional sound dev/sound/pcm/ac97_patch.c optional sound Modified: stable/8/sys/conf/kmod.mk ============================================================================== --- stable/8/sys/conf/kmod.mk Fri Jun 8 12:31:49 2012 (r236749) +++ stable/8/sys/conf/kmod.mk Fri Jun 8 12:35:43 2012 (r236750) @@ -339,6 +339,7 @@ MFILES?= dev/acpica/acpi_if.m dev/acpi_s dev/mii/miibus_if.m dev/mvs/mvs_if.m dev/ofw/ofw_bus_if.m \ dev/pccard/card_if.m dev/pccard/power_if.m dev/pci/pci_if.m \ dev/pci/pcib_if.m dev/ppbus/ppbus_if.m dev/smbus/smbus_if.m \ + dev/sound/pci/hda/hdac_if.m \ dev/sound/pcm/ac97_if.m dev/sound/pcm/channel_if.m \ dev/sound/pcm/feeder_if.m dev/sound/pcm/mixer_if.m \ dev/sound/midi/mpu_if.m dev/sound/midi/mpufoi_if.m \ Modified: stable/8/sys/dev/sound/pci/hda/hda_reg.h ============================================================================== --- stable/8/sys/dev/sound/pci/hda/hda_reg.h Fri Jun 8 12:31:49 2012 (r236749) +++ stable/8/sys/dev/sound/pci/hda/hda_reg.h Fri Jun 8 12:35:43 2012 (r236750) @@ -400,7 +400,7 @@ HDA_CMD_GET_UNSOLICITED_RESPONSE_TAG_SHIFT) #define HDA_CMD_SET_UNSOLICITED_RESPONSE_ENABLE 0x80 -#define HDA_CMD_SET_UNSOLICITED_RESPONSE_TAG_MASK 0x1f +#define HDA_CMD_SET_UNSOLICITED_RESPONSE_TAG_MASK 0x3f #define HDA_CMD_SET_UNSOLICITED_RESPONSE_TAG_SHIFT 0 #define HDA_CMD_SET_UNSOLICITED_RESPONSE_TAG(param) \ @@ -418,14 +418,10 @@ (HDA_CMD_12BIT((cad), (nid), \ HDA_CMD_VERB_SET_PIN_SENSE, (payload))) -#define HDA_CMD_GET_PIN_SENSE_PRESENCE_DETECT_MASK 0x80000000 -#define HDA_CMD_GET_PIN_SENSE_PRESENCE_DETECT_SHIFT 31 +#define HDA_CMD_GET_PIN_SENSE_PRESENCE_DETECT 0x80000000 #define HDA_CMD_GET_PIN_SENSE_IMP_SENSE_MASK 0x7fffffff #define HDA_CMD_GET_PIN_SENSE_IMP_SENSE_SHIFT 0 -#define HDA_CMD_GET_PIN_SENSE_PRESENCE_DETECT(rsp) \ - (((rsp) & HDA_CMD_GET_PIN_SENSE_PRESENCE_DETECT_MASK) >> \ - HDA_CMD_GET_PIN_SENSE_PRESENCE_DETECT_SHIFT) #define HDA_CMD_GET_PIN_SENSE_IMP_SENSE(rsp) \ (((rsp) & HDA_CMD_GET_PIN_SENSE_IMP_SENSE_MASK) >> \ HDA_CMD_GET_PIN_SENSE_IMP_SENSE_SHIFT) Copied: stable/8/sys/dev/sound/pci/hda/hdaa.c (from r230130, head/sys/dev/sound/pci/hda/hdaa.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/dev/sound/pci/hda/hdaa.c Fri Jun 8 12:35:43 2012 (r236750, copy of r230130, head/sys/dev/sound/pci/hda/hdaa.c) @@ -0,0 +1,5901 @@ +/*- + * Copyright (c) 2006 Stephane E. Potvin + * Copyright (c) 2006 Ariff Abdullah + * Copyright (c) 2008-2012 Alexander Motin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Intel High Definition Audio (Audio function) driver for FreeBSD. + */ + +#ifdef HAVE_KERNEL_OPTION_HEADERS +#include "opt_snd.h" +#endif + +#include + +#include +#include + +#include +#include +#include + +#include "mixer_if.h" + +SND_DECLARE_FILE("$FreeBSD$"); + +#define hdaa_lock(devinfo) snd_mtxlock((devinfo)->lock) +#define hdaa_unlock(devinfo) snd_mtxunlock((devinfo)->lock) +#define hdaa_lockassert(devinfo) snd_mtxassert((devinfo)->lock) +#define hdaa_lockowned(devinfo) mtx_owned((devinfo)->lock) + +static const struct { + char *key; + uint32_t value; +} hdaa_quirks_tab[] = { + { "softpcmvol", HDAA_QUIRK_SOFTPCMVOL }, + { "fixedrate", HDAA_QUIRK_FIXEDRATE }, + { "forcestereo", HDAA_QUIRK_FORCESTEREO }, + { "eapdinv", HDAA_QUIRK_EAPDINV }, + { "senseinv", HDAA_QUIRK_SENSEINV }, + { "ivref50", HDAA_QUIRK_IVREF50 }, + { "ivref80", HDAA_QUIRK_IVREF80 }, + { "ivref100", HDAA_QUIRK_IVREF100 }, + { "ovref50", HDAA_QUIRK_OVREF50 }, + { "ovref80", HDAA_QUIRK_OVREF80 }, + { "ovref100", HDAA_QUIRK_OVREF100 }, + { "ivref", HDAA_QUIRK_IVREF }, + { "ovref", HDAA_QUIRK_OVREF }, + { "vref", HDAA_QUIRK_VREF }, +}; +#define HDAA_QUIRKS_TAB_LEN \ + (sizeof(hdaa_quirks_tab) / sizeof(hdaa_quirks_tab[0])) + +#define HDA_BDL_MIN 2 +#define HDA_BDL_MAX 256 +#define HDA_BDL_DEFAULT HDA_BDL_MIN + +#define HDA_BLK_MIN HDA_DMA_ALIGNMENT +#define HDA_BLK_ALIGN (~(HDA_BLK_MIN - 1)) + +#define HDA_BUFSZ_MIN 4096 +#define HDA_BUFSZ_MAX 65536 +#define HDA_BUFSZ_DEFAULT 16384 + +#define HDA_PARSE_MAXDEPTH 10 + +MALLOC_DEFINE(M_HDAA, "hdaa", "HDA Audio"); + +const char *HDA_COLORS[16] = {"Unknown", "Black", "Grey", "Blue", "Green", "Red", + "Orange", "Yellow", "Purple", "Pink", "Res.A", "Res.B", "Res.C", "Res.D", + "White", "Other"}; + +const char *HDA_DEVS[16] = {"Line-out", "Speaker", "Headphones", "CD", + "SPDIF-out", "Digital-out", "Modem-line", "Modem-handset", "Line-in", + "AUX", "Mic", "Telephony", "SPDIF-in", "Digital-in", "Res.E", "Other"}; + +const char *HDA_CONNS[4] = {"Jack", "None", "Fixed", "Both"}; + +const char *HDA_CONNECTORS[16] = { + "Unknown", "1/8", "1/4", "ATAPI", "RCA", "Optical", "Digital", "Analog", + "DIN", "XLR", "RJ-11", "Combo", "0xc", "0xd", "0xe", "Other" }; + +const char *HDA_LOCS[64] = { + "0x00", "Rear", "Front", "Left", "Right", "Top", "Bottom", "Rear-panel", + "Drive-bay", "0x09", "0x0a", "0x0b", "0x0c", "0x0d", "0x0e", "0x0f", + "Internal", "0x11", "0x12", "0x13", "0x14", "0x15", "0x16", "Riser", + "0x18", "Onboard", "0x1a", "0x1b", "0x1c", "0x1d", "0x1e", "0x1f", + "External", "Ext-Rear", "Ext-Front", "Ext-Left", "Ext-Right", "Ext-Top", "Ext-Bottom", "0x07", + "0x28", "0x29", "0x2a", "0x2b", "0x2c", "0x2d", "0x2e", "0x2f", + "Other", "0x31", "0x32", "0x33", "0x34", "0x35", "Other-Bott", "Lid-In", + "Lid-Out", "0x39", "0x3a", "0x3b", "0x3c", "0x3d", "0x3e", "0x3f" }; + +const char *HDA_GPIO_ACTIONS[8] = { + "keep", "set", "clear", "disable", "input", "0x05", "0x06", "0x07"}; + +/* Default */ +static uint32_t hdaa_fmt[] = { + SND_FORMAT(AFMT_S16_LE, 2, 0), + 0 +}; + +static struct pcmchan_caps hdaa_caps = {48000, 48000, hdaa_fmt, 0}; + +static const struct { + uint32_t rate; + int valid; + uint16_t base; + uint16_t mul; + uint16_t div; +} hda_rate_tab[] = { + { 8000, 1, 0x0000, 0x0000, 0x0500 }, /* (48000 * 1) / 6 */ + { 9600, 0, 0x0000, 0x0000, 0x0400 }, /* (48000 * 1) / 5 */ + { 12000, 0, 0x0000, 0x0000, 0x0300 }, /* (48000 * 1) / 4 */ + { 16000, 1, 0x0000, 0x0000, 0x0200 }, /* (48000 * 1) / 3 */ + { 18000, 0, 0x0000, 0x1000, 0x0700 }, /* (48000 * 3) / 8 */ + { 19200, 0, 0x0000, 0x0800, 0x0400 }, /* (48000 * 2) / 5 */ + { 24000, 0, 0x0000, 0x0000, 0x0100 }, /* (48000 * 1) / 2 */ + { 28800, 0, 0x0000, 0x1000, 0x0400 }, /* (48000 * 3) / 5 */ + { 32000, 1, 0x0000, 0x0800, 0x0200 }, /* (48000 * 2) / 3 */ + { 36000, 0, 0x0000, 0x1000, 0x0300 }, /* (48000 * 3) / 4 */ + { 38400, 0, 0x0000, 0x1800, 0x0400 }, /* (48000 * 4) / 5 */ + { 48000, 1, 0x0000, 0x0000, 0x0000 }, /* (48000 * 1) / 1 */ + { 64000, 0, 0x0000, 0x1800, 0x0200 }, /* (48000 * 4) / 3 */ + { 72000, 0, 0x0000, 0x1000, 0x0100 }, /* (48000 * 3) / 2 */ + { 96000, 1, 0x0000, 0x0800, 0x0000 }, /* (48000 * 2) / 1 */ + { 144000, 0, 0x0000, 0x1000, 0x0000 }, /* (48000 * 3) / 1 */ + { 192000, 1, 0x0000, 0x1800, 0x0000 }, /* (48000 * 4) / 1 */ + { 8820, 0, 0x4000, 0x0000, 0x0400 }, /* (44100 * 1) / 5 */ + { 11025, 1, 0x4000, 0x0000, 0x0300 }, /* (44100 * 1) / 4 */ + { 12600, 0, 0x4000, 0x0800, 0x0600 }, /* (44100 * 2) / 7 */ + { 14700, 0, 0x4000, 0x0000, 0x0200 }, /* (44100 * 1) / 3 */ + { 17640, 0, 0x4000, 0x0800, 0x0400 }, /* (44100 * 2) / 5 */ + { 18900, 0, 0x4000, 0x1000, 0x0600 }, /* (44100 * 3) / 7 */ + { 22050, 1, 0x4000, 0x0000, 0x0100 }, /* (44100 * 1) / 2 */ + { 25200, 0, 0x4000, 0x1800, 0x0600 }, /* (44100 * 4) / 7 */ + { 26460, 0, 0x4000, 0x1000, 0x0400 }, /* (44100 * 3) / 5 */ + { 29400, 0, 0x4000, 0x0800, 0x0200 }, /* (44100 * 2) / 3 */ + { 33075, 0, 0x4000, 0x1000, 0x0300 }, /* (44100 * 3) / 4 */ + { 35280, 0, 0x4000, 0x1800, 0x0400 }, /* (44100 * 4) / 5 */ + { 44100, 1, 0x4000, 0x0000, 0x0000 }, /* (44100 * 1) / 1 */ + { 58800, 0, 0x4000, 0x1800, 0x0200 }, /* (44100 * 4) / 3 */ + { 66150, 0, 0x4000, 0x1000, 0x0100 }, /* (44100 * 3) / 2 */ + { 88200, 1, 0x4000, 0x0800, 0x0000 }, /* (44100 * 2) / 1 */ + { 132300, 0, 0x4000, 0x1000, 0x0000 }, /* (44100 * 3) / 1 */ + { 176400, 1, 0x4000, 0x1800, 0x0000 }, /* (44100 * 4) / 1 */ +}; +#define HDA_RATE_TAB_LEN (sizeof(hda_rate_tab) / sizeof(hda_rate_tab[0])) + +/**************************************************************************** + * Function prototypes + ****************************************************************************/ +static int hdaa_pcmchannel_setup(struct hdaa_chan *); + +static void hdaa_widget_connection_select(struct hdaa_widget *, uint8_t); +static void hdaa_audio_ctl_amp_set(struct hdaa_audio_ctl *, + uint32_t, int, int); +static struct hdaa_audio_ctl *hdaa_audio_ctl_amp_get(struct hdaa_devinfo *, + nid_t, int, int, int); +static void hdaa_audio_ctl_amp_set_internal(struct hdaa_devinfo *, + nid_t, int, int, int, int, int, int); + +static void hdaa_dump_pin_config(struct hdaa_widget *w, uint32_t conf); + +static char * +hdaa_audio_ctl_ossmixer_mask2allname(uint32_t mask, char *buf, size_t len) +{ + static char *ossname[] = SOUND_DEVICE_NAMES; + int i, first = 1; + + bzero(buf, len); + for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { + if (mask & (1 << i)) { + if (first == 0) + strlcat(buf, ", ", len); + strlcat(buf, ossname[i], len); + first = 0; + } + } + return (buf); +} + +static struct hdaa_audio_ctl * +hdaa_audio_ctl_each(struct hdaa_devinfo *devinfo, int *index) +{ + if (devinfo == NULL || + index == NULL || devinfo->ctl == NULL || + devinfo->ctlcnt < 1 || + *index < 0 || *index >= devinfo->ctlcnt) + return (NULL); + return (&devinfo->ctl[(*index)++]); +} + +static struct hdaa_audio_ctl * +hdaa_audio_ctl_amp_get(struct hdaa_devinfo *devinfo, nid_t nid, int dir, + int index, int cnt) +{ + struct hdaa_audio_ctl *ctl; + int i, found = 0; + + if (devinfo == NULL || devinfo->ctl == NULL) + return (NULL); + + i = 0; + while ((ctl = hdaa_audio_ctl_each(devinfo, &i)) != NULL) { + if (ctl->enable == 0) + continue; + if (ctl->widget->nid != nid) + continue; + if (dir && ctl->ndir != dir) + continue; + if (index >= 0 && ctl->ndir == HDAA_CTL_IN && + ctl->dir == ctl->ndir && ctl->index != index) + continue; + found++; + if (found == cnt || cnt <= 0) + return (ctl); + } + + return (NULL); +} + +/* + * Jack detection (Speaker/HP redirection) event handler. + */ +static void +hdaa_hp_switch_handler(struct hdaa_devinfo *devinfo, int asid) +{ + struct hdaa_audio_as *as; + struct hdaa_widget *w; + struct hdaa_audio_ctl *ctl; + uint32_t val, res; + int j; + + as = &devinfo->as[asid]; + if (as->hpredir < 0) + return; + + w = hdaa_widget_get(devinfo, as->pins[15]); + if (w == NULL || w->enable == 0 || w->type != + HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) + return; + + res = hda_command(devinfo->dev, + HDA_CMD_GET_PIN_SENSE(0, as->pins[15])); + + HDA_BOOTVERBOSE( + device_printf(devinfo->dev, + "Pin sense: nid=%d sence=0x%08x", + as->pins[15], res); + ); + + res = (res & HDA_CMD_GET_PIN_SENSE_PRESENCE_DETECT) != 0; + if (devinfo->quirks & HDAA_QUIRK_SENSEINV) + res ^= 1; + + HDA_BOOTVERBOSE( + printf(" %sconnected\n", res == 0 ? "dis" : ""); + ); + + /* (Un)Mute headphone pin. */ + ctl = hdaa_audio_ctl_amp_get(devinfo, + as->pins[15], HDAA_CTL_IN, -1, 1); + if (ctl != NULL && ctl->mute) { + /* If pin has muter - use it. */ + val = (res != 0) ? 0 : 1; + if (val != ctl->forcemute) { + ctl->forcemute = val; + hdaa_audio_ctl_amp_set(ctl, + HDAA_AMP_MUTE_DEFAULT, + HDAA_AMP_VOL_DEFAULT, HDAA_AMP_VOL_DEFAULT); + } + } else { + /* If there is no muter - disable pin output. */ + w = hdaa_widget_get(devinfo, as->pins[15]); + if (w != NULL && w->type == + HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) { + if (res != 0) + val = w->wclass.pin.ctrl | + HDA_CMD_SET_PIN_WIDGET_CTRL_OUT_ENABLE; + else + val = w->wclass.pin.ctrl & + ~HDA_CMD_SET_PIN_WIDGET_CTRL_OUT_ENABLE; + if (val != w->wclass.pin.ctrl) { + w->wclass.pin.ctrl = val; + hda_command(devinfo->dev, + HDA_CMD_SET_PIN_WIDGET_CTRL(0, + w->nid, w->wclass.pin.ctrl)); + } + } + } + /* (Un)Mute other pins. */ + for (j = 0; j < 15; j++) { + if (as->pins[j] <= 0) + continue; + ctl = hdaa_audio_ctl_amp_get(devinfo, + as->pins[j], HDAA_CTL_IN, -1, 1); + if (ctl != NULL && ctl->mute) { + /* If pin has muter - use it. */ + val = (res != 0) ? 1 : 0; + if (val == ctl->forcemute) + continue; + ctl->forcemute = val; + hdaa_audio_ctl_amp_set(ctl, + HDAA_AMP_MUTE_DEFAULT, + HDAA_AMP_VOL_DEFAULT, HDAA_AMP_VOL_DEFAULT); + continue; + } + /* If there is no muter - disable pin output. */ + w = hdaa_widget_get(devinfo, as->pins[j]); + if (w != NULL && w->type == + HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) { + if (res != 0) + val = w->wclass.pin.ctrl & + ~HDA_CMD_SET_PIN_WIDGET_CTRL_OUT_ENABLE; + else + val = w->wclass.pin.ctrl | + HDA_CMD_SET_PIN_WIDGET_CTRL_OUT_ENABLE; + if (val != w->wclass.pin.ctrl) { + w->wclass.pin.ctrl = val; + hda_command(devinfo->dev, + HDA_CMD_SET_PIN_WIDGET_CTRL(0, + w->nid, w->wclass.pin.ctrl)); + } + } + } +} + +/* + * Callback for poll based jack detection. + */ +static void +hdaa_jack_poll_callback(void *arg) +{ + struct hdaa_devinfo *devinfo = arg; + int i; + + hdaa_lock(devinfo); + if (devinfo->poll_ival == 0) { + hdaa_unlock(devinfo); + return; + } + for (i = 0; i < devinfo->ascnt; i++) { + if (devinfo->as[i].hpredir < 0) + continue; + hdaa_hp_switch_handler(devinfo, i); + } + callout_reset(&devinfo->poll_jack, devinfo->poll_ival, + hdaa_jack_poll_callback, devinfo); + hdaa_unlock(devinfo); +} + +/* + * Jack detection initializer. + */ +static void +hdaa_hp_switch_init(struct hdaa_devinfo *devinfo) +{ + struct hdaa_audio_as *as = devinfo->as; + struct hdaa_widget *w; + int i, poll = 0; + + for (i = 0; i < devinfo->ascnt; i++) { + if (as[i].hpredir < 0) + continue; + + w = hdaa_widget_get(devinfo, as[i].pins[15]); + if (w == NULL || w->enable == 0 || w->type != + HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) + continue; + if (HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP(w->wclass.pin.cap) == 0 || + (HDA_CONFIG_DEFAULTCONF_MISC(w->wclass.pin.config) & 1) != 0) { + device_printf(devinfo->dev, + "No jack detection support at pin %d\n", + as[i].pins[15]); + continue; + } + if (HDA_PARAM_AUDIO_WIDGET_CAP_UNSOL_CAP(w->param.widget_cap)) { + as[i].unsol = HDAC_UNSOL_ALLOC( + device_get_parent(devinfo->dev), devinfo->dev, + w->nid); + hda_command(devinfo->dev, + HDA_CMD_SET_UNSOLICITED_RESPONSE(0, w->nid, + HDA_CMD_SET_UNSOLICITED_RESPONSE_ENABLE | + as[i].unsol)); + } else + poll = 1; + HDA_BOOTVERBOSE( + device_printf(devinfo->dev, + "Headphones redirection " + "for as=%d nid=%d using %s.\n", + i, w->nid, + (poll != 0) ? "polling" : "unsolicited responses"); + ); + hdaa_hp_switch_handler(devinfo, i); + } + if (poll) { + callout_reset(&devinfo->poll_jack, 1, + hdaa_jack_poll_callback, devinfo); + } +} + +static void +hdaa_hp_switch_deinit(struct hdaa_devinfo *devinfo) +{ + struct hdaa_audio_as *as = devinfo->as; + struct hdaa_widget *w; + int i; + + for (i = 0; i < devinfo->ascnt; i++) { + if (as[i].unsol < 0) + continue; + w = hdaa_widget_get(devinfo, as[i].pins[15]); + if (w == NULL || w->enable == 0 || w->type != + HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) + continue; + hda_command(devinfo->dev, + HDA_CMD_SET_UNSOLICITED_RESPONSE(0, w->nid, 0)); + HDAC_UNSOL_FREE( + device_get_parent(devinfo->dev), devinfo->dev, + as[i].unsol); + as[i].unsol = -1; + } +} + +uint32_t +hdaa_widget_pin_patch(uint32_t config, const char *str) +{ + char buf[256]; + char *key, *value, *rest, *bad; + int ival, i; + + strlcpy(buf, str, sizeof(buf)); + rest = buf; + while ((key = strsep(&rest, "=")) != NULL) { + value = strsep(&rest, " \t"); + if (value == NULL) + break; + ival = strtol(value, &bad, 10); + if (strcmp(key, "seq") == 0) { + config &= ~HDA_CONFIG_DEFAULTCONF_SEQUENCE_MASK; + config |= ((ival << HDA_CONFIG_DEFAULTCONF_SEQUENCE_SHIFT) & + HDA_CONFIG_DEFAULTCONF_SEQUENCE_MASK); + } else if (strcmp(key, "as") == 0) { + config &= ~HDA_CONFIG_DEFAULTCONF_ASSOCIATION_MASK; + config |= ((ival << HDA_CONFIG_DEFAULTCONF_ASSOCIATION_SHIFT) & + HDA_CONFIG_DEFAULTCONF_ASSOCIATION_MASK); + } else if (strcmp(key, "misc") == 0) { + config &= ~HDA_CONFIG_DEFAULTCONF_MISC_MASK; + config |= ((ival << HDA_CONFIG_DEFAULTCONF_MISC_SHIFT) & + HDA_CONFIG_DEFAULTCONF_MISC_MASK); + } else if (strcmp(key, "color") == 0) { + config &= ~HDA_CONFIG_DEFAULTCONF_COLOR_MASK; + if (bad[0] == 0) { + config |= ((ival << HDA_CONFIG_DEFAULTCONF_COLOR_SHIFT) & + HDA_CONFIG_DEFAULTCONF_COLOR_MASK); + }; + for (i = 0; i < 16; i++) { + if (strcasecmp(HDA_COLORS[i], value) == 0) { + config |= (i << HDA_CONFIG_DEFAULTCONF_COLOR_SHIFT); + break; + } + } + } else if (strcmp(key, "ctype") == 0) { + config &= ~HDA_CONFIG_DEFAULTCONF_CONNECTION_TYPE_MASK; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 8 12:56:11 2012 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 34F551065674; Fri, 8 Jun 2012 12:56:11 +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 06FAC8FC23; Fri, 8 Jun 2012 12:56:11 +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 q58CuALO060283; Fri, 8 Jun 2012 12:56:10 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q58CuASe060279; Fri, 8 Jun 2012 12:56:10 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206081256.q58CuASe060279@svn.freebsd.org> From: Alexander Motin Date: Fri, 8 Jun 2012 12:56:10 +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: r236752 - in stable/8/sys: kern 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: Fri, 08 Jun 2012 12:56:11 -0000 Author: mav Date: Fri Jun 8 12:56:10 2012 New Revision: 236752 URL: http://svn.freebsd.org/changeset/base/236752 Log: Partially MFC r227701, r227847 and r227849 (by hselasky): Provide new device_delete_children() KPI without touching all consumers. Modified: stable/8/sys/kern/subr_bus.c stable/8/sys/sys/bus.h Modified: stable/8/sys/kern/subr_bus.c ============================================================================== --- stable/8/sys/kern/subr_bus.c Fri Jun 8 12:36:08 2012 (r236751) +++ stable/8/sys/kern/subr_bus.c Fri Jun 8 12:56:10 2012 (r236752) @@ -1897,7 +1897,7 @@ device_delete_child(device_t dev, device PDEBUG(("%s from %s", DEVICENAME(child), DEVICENAME(dev))); /* remove children first */ - while ( (grandchild = TAILQ_FIRST(&child->children)) ) { + while ((grandchild = TAILQ_FIRST(&child->children)) != NULL) { error = device_delete_child(child, grandchild); if (error) return (error); @@ -1916,6 +1916,39 @@ device_delete_child(device_t dev, device } /** + * @brief Delete all children devices of the given device, if any. + * + * This function deletes all children devices of the given device, if + * any, using the device_delete_child() function for each device it + * finds. If a child device cannot be deleted, this function will + * return an error code. + * + * @param dev the parent device + * + * @retval 0 success + * @retval non-zero a device would not detach + */ +int +device_delete_children(device_t dev) +{ + device_t child; + int error; + + PDEBUG(("Deleting all children of %s", DEVICENAME(dev))); + + error = 0; + + while ((child = TAILQ_FIRST(&dev->children)) != NULL) { + error = device_delete_child(dev, child); + if (error) { + PDEBUG(("Failed deleting %s", DEVICENAME(child))); + break; + } + } + return (error); +} + +/** * @brief Find a device given a unit number * * This is similar to devclass_get_devices() but only searches for Modified: stable/8/sys/sys/bus.h ============================================================================== --- stable/8/sys/sys/bus.h Fri Jun 8 12:36:08 2012 (r236751) +++ stable/8/sys/sys/bus.h Fri Jun 8 12:56:10 2012 (r236752) @@ -407,6 +407,7 @@ device_t device_add_child_ordered(device const char *name, int unit); void device_busy(device_t dev); int device_delete_child(device_t dev, device_t child); +int device_delete_children(device_t dev); int device_attach(device_t dev); int device_detach(device_t dev); void device_disable(device_t dev); From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 8 13:10:18 2012 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 B13081065677; Fri, 8 Jun 2012 13:10:18 +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 9992F8FC17; Fri, 8 Jun 2012 13:10:18 +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 q58DAIcN060999; Fri, 8 Jun 2012 13:10:18 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q58DAIfk060994; Fri, 8 Jun 2012 13:10:18 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206081310.q58DAIfk060994@svn.freebsd.org> From: Alexander Motin Date: Fri, 8 Jun 2012 13:10:18 +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: r236753 - in stable/8: share/man/man4 sys/dev/sound/pci/hda sys/dev/sound/pcm 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, 08 Jun 2012 13:10:18 -0000 Author: mav Date: Fri Jun 8 13:10:18 2012 New Revision: 236753 URL: http://svn.freebsd.org/changeset/base/236753 Log: MFC r230181, r230312, r230326, r230331, r230451, r230465, r230488, r230507, r230511, r230513, r230532, r230537, r230551, r230554, r230571, r230574, r230585, r230641, r230768, r230807, r231024: Sync snd_hda(4) driver with HEAD. This includes major code refactoring, HDMI support, new volume control, automatic recording source selection, runtime reconfigureation, support for more then 4 PCM devices on controller, multichannel recording, additional playback/record streams, higher bandwidths support, more informative device names and many other things. Sponsored by: iXsystems, Inc. Modified: stable/8/share/man/man4/snd_hda.4 stable/8/sys/dev/sound/pci/hda/hda_reg.h stable/8/sys/dev/sound/pci/hda/hdaa.c stable/8/sys/dev/sound/pci/hda/hdaa.h stable/8/sys/dev/sound/pci/hda/hdaa_patches.c stable/8/sys/dev/sound/pci/hda/hdac.c stable/8/sys/dev/sound/pci/hda/hdac.h stable/8/sys/dev/sound/pci/hda/hdac_if.m stable/8/sys/dev/sound/pci/hda/hdac_private.h stable/8/sys/dev/sound/pci/hda/hdacc.c stable/8/sys/dev/sound/pcm/channel.c Directory Properties: stable/8/share/man/man4/ (props changed) stable/8/sys/ (props changed) Modified: stable/8/share/man/man4/snd_hda.4 ============================================================================== --- stable/8/share/man/man4/snd_hda.4 Fri Jun 8 12:56:10 2012 (r236752) +++ stable/8/share/man/man4/snd_hda.4 Fri Jun 8 13:10:18 2012 (r236753) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 11, 2012 +.Dd January 25, 2012 .Dt SND_HDA 4 .Os .Sh NAME @@ -182,6 +182,18 @@ May be specified as a 32-bit hexadecimal or as a set of space-separated .Dq Ar option Ns = Ns Ar value pairs. +.It Va hint.pcm.%d.rec.autosrc +Controls automatic recording source feature: +.Bl -tag -compact +.It 0 +disabled, +.It 1 +once on attach, +.It 2 +enabled. +.El +When enabled, driver will automatically set recording source of the mixer to +connected input using jack presence detection statuses. .El .Pp Pin configuration is the UAA driver's main source of information about codec @@ -357,6 +369,16 @@ Original pin configuration written by BI Setting this to a non-zero value makes driver to destroy existing pcm devices and process new pins configuration set via .Va dev.hdaa.%d.nid%d_config. +.It Va dev.pcm.%d.play.32bit , dev.pcm.%d.rec.32bit +HDA controller uses 32bit representation for all samples of more then 16 bits. +These variables allow to specify how many bits of these 32 should be +used by CODEC. +Depending on codec capabilities, possible values are 20, 24 and 32 bit. +The default value is 24. +.It Va dev.pcm.%d.rec.autosrc +Run-time equivalent of the +.Va hint.pcm.%d.rec.autosrc +tunable. .El .Sh EXAMPLES Taking HP Compaq DX2300 with Realtek ALC888 HDA codec for example. Modified: stable/8/sys/dev/sound/pci/hda/hda_reg.h ============================================================================== --- stable/8/sys/dev/sound/pci/hda/hda_reg.h Fri Jun 8 12:56:10 2012 (r236752) +++ stable/8/sys/dev/sound/pci/hda/hda_reg.h Fri Jun 8 13:10:18 2012 (r236753) @@ -419,6 +419,7 @@ HDA_CMD_VERB_SET_PIN_SENSE, (payload))) #define HDA_CMD_GET_PIN_SENSE_PRESENCE_DETECT 0x80000000 +#define HDA_CMD_GET_PIN_SENSE_ELD_VALID 0x40000000 #define HDA_CMD_GET_PIN_SENSE_IMP_SENSE_MASK 0x7fffffff #define HDA_CMD_GET_PIN_SENSE_IMP_SENSE_SHIFT 0 @@ -675,17 +676,47 @@ HDA_CMD_VERB_SET_CONV_CHAN_COUNT, (payload))) #define HDA_CMD_VERB_GET_HDMI_DIP_SIZE 0xf2e + +#define HDA_CMD_GET_HDMI_DIP_SIZE(cad, nid, arg) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_HDMI_DIP_SIZE, (arg))) + #define HDA_CMD_VERB_GET_HDMI_ELDD 0xf2f +#define HDA_CMD_GET_HDMI_ELDD(cad, nid, off) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_HDMI_ELDD, (off))) + #define HDA_CMD_VERB_GET_HDMI_DIP_INDEX 0xf30 #define HDA_CMD_VERB_SET_HDMI_DIP_INDEX 0x730 +#define HDA_CMD_GET_HDMI_DIP_INDEX(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_HDMI_DIP_INDEX, 0x0)) +#define HDA_CMD_SET_HDMI_DIP_INDEX(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_HDMI_DIP_INDEX, (payload))) + #define HDA_CMD_VERB_GET_HDMI_DIP_DATA 0xf31 #define HDA_CMD_VERB_SET_HDMI_DIP_DATA 0x731 +#define HDA_CMD_GET_HDMI_DIP_DATA(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_HDMI_DIP_DATA, 0x0)) +#define HDA_CMD_SET_HDMI_DIP_DATA(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_HDMI_DIP_DATA, (payload))) + #define HDA_CMD_VERB_GET_HDMI_DIP_XMIT 0xf32 #define HDA_CMD_VERB_SET_HDMI_DIP_XMIT 0x732 +#define HDA_CMD_GET_HDMI_DIP_XMIT(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_HDMI_DIP_XMIT, 0x0)) +#define HDA_CMD_SET_HDMI_DIP_XMIT(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_HDMI_DIP_XMIT, (payload))) + #define HDA_CMD_VERB_GET_HDMI_CP_CTRL 0xf33 #define HDA_CMD_VERB_SET_HDMI_CP_CTRL 0x733 @@ -699,6 +730,23 @@ (HDA_CMD_12BIT((cad), (nid), \ HDA_CMD_VERB_SET_HDMI_CHAN_SLOT, (payload))) +#define HDA_HDMI_CODING_TYPE_REF_STREAM_HEADER 0 +#define HDA_HDMI_CODING_TYPE_LPCM 1 +#define HDA_HDMI_CODING_TYPE_AC3 2 +#define HDA_HDMI_CODING_TYPE_MPEG1 3 +#define HDA_HDMI_CODING_TYPE_MP3 4 +#define HDA_HDMI_CODING_TYPE_MPEG2 5 +#define HDA_HDMI_CODING_TYPE_AACLC 6 +#define HDA_HDMI_CODING_TYPE_DTS 7 +#define HDA_HDMI_CODING_TYPE_ATRAC 8 +#define HDA_HDMI_CODING_TYPE_SACD 9 +#define HDA_HDMI_CODING_TYPE_EAC3 10 +#define HDA_HDMI_CODING_TYPE_DTS_HD 11 +#define HDA_HDMI_CODING_TYPE_MLP 12 +#define HDA_HDMI_CODING_TYPE_DST 13 +#define HDA_HDMI_CODING_TYPE_WMAPRO 14 +#define HDA_HDMI_CODING_TYPE_REF_CTX 15 + /* Function Reset */ #define HDA_CMD_VERB_FUNCTION_RESET 0x7ff Modified: stable/8/sys/dev/sound/pci/hda/hdaa.c ============================================================================== --- stable/8/sys/dev/sound/pci/hda/hdaa.c Fri Jun 8 12:56:10 2012 (r236752) +++ stable/8/sys/dev/sound/pci/hda/hdaa.c Fri Jun 8 13:10:18 2012 (r236753) @@ -74,17 +74,6 @@ static const struct { #define HDAA_QUIRKS_TAB_LEN \ (sizeof(hdaa_quirks_tab) / sizeof(hdaa_quirks_tab[0])) -#define HDA_BDL_MIN 2 -#define HDA_BDL_MAX 256 -#define HDA_BDL_DEFAULT HDA_BDL_MIN - -#define HDA_BLK_MIN HDA_DMA_ALIGNMENT -#define HDA_BLK_ALIGN (~(HDA_BLK_MIN - 1)) - -#define HDA_BUFSZ_MIN 4096 -#define HDA_BUFSZ_MAX 65536 -#define HDA_BUFSZ_DEFAULT 16384 - #define HDA_PARSE_MAXDEPTH 10 MALLOC_DEFINE(M_HDAA, "hdaa", "HDA Audio"); @@ -116,6 +105,12 @@ const char *HDA_LOCS[64] = { const char *HDA_GPIO_ACTIONS[8] = { "keep", "set", "clear", "disable", "input", "0x05", "0x06", "0x07"}; +const char *HDA_HDMI_CODING_TYPES[18] = { + "undefined", "LPCM", "AC-3", "MPEG1", "MP3", "MPEG2", "AAC-LC", "DTS", + "ATRAC", "DSD", "E-AC-3", "DTS-HD", "MLP", "DST", "WMAPro", "HE-AAC", + "HE-AACv2", "MPEG-Surround" +}; + /* Default */ static uint32_t hdaa_fmt[] = { SND_FORMAT(AFMT_S16_LE, 2, 0), @@ -169,6 +164,8 @@ static const struct { }; #define HDA_RATE_TAB_LEN (sizeof(hda_rate_tab) / sizeof(hda_rate_tab[0])) +const static char *ossnames[] = SOUND_DEVICE_NAMES; + /**************************************************************************** * Function prototypes ****************************************************************************/ @@ -187,7 +184,6 @@ static void hdaa_dump_pin_config(struct static char * hdaa_audio_ctl_ossmixer_mask2allname(uint32_t mask, char *buf, size_t len) { - static char *ossname[] = SOUND_DEVICE_NAMES; int i, first = 1; bzero(buf, len); @@ -195,7 +191,7 @@ hdaa_audio_ctl_ossmixer_mask2allname(uin if (mask & (1 << i)) { if (first == 0) strlcat(buf, ", ", len); - strlcat(buf, ossname[i], len); + strlcat(buf, ossnames[i], len); first = 0; } } @@ -243,49 +239,30 @@ hdaa_audio_ctl_amp_get(struct hdaa_devin } /* - * Jack detection (Speaker/HP redirection) event handler. + * Headphones redirection change handler. */ static void -hdaa_hp_switch_handler(struct hdaa_devinfo *devinfo, int asid) +hdaa_hpredir_handler(struct hdaa_widget *w) { - struct hdaa_audio_as *as; - struct hdaa_widget *w; + struct hdaa_devinfo *devinfo = w->devinfo; + struct hdaa_audio_as *as = &devinfo->as[w->bindas]; + struct hdaa_widget *w1; struct hdaa_audio_ctl *ctl; - uint32_t val, res; - int j; - - as = &devinfo->as[asid]; - if (as->hpredir < 0) - return; - - w = hdaa_widget_get(devinfo, as->pins[15]); - if (w == NULL || w->enable == 0 || w->type != - HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) - return; - - res = hda_command(devinfo->dev, - HDA_CMD_GET_PIN_SENSE(0, as->pins[15])); - - HDA_BOOTVERBOSE( - device_printf(devinfo->dev, - "Pin sense: nid=%d sence=0x%08x", - as->pins[15], res); - ); - - res = (res & HDA_CMD_GET_PIN_SENSE_PRESENCE_DETECT) != 0; - if (devinfo->quirks & HDAA_QUIRK_SENSEINV) - res ^= 1; + uint32_t val; + int j, connected = w->wclass.pin.connected; HDA_BOOTVERBOSE( - printf(" %sconnected\n", res == 0 ? "dis" : ""); + device_printf((as->pdevinfo && as->pdevinfo->dev) ? + as->pdevinfo->dev : devinfo->dev, + "Redirect output to: %s\n", + connected ? "headphones": "main"); ); - /* (Un)Mute headphone pin. */ ctl = hdaa_audio_ctl_amp_get(devinfo, - as->pins[15], HDAA_CTL_IN, -1, 1); + w->nid, HDAA_CTL_IN, -1, 1); if (ctl != NULL && ctl->mute) { /* If pin has muter - use it. */ - val = (res != 0) ? 0 : 1; + val = connected ? 0 : 1; if (val != ctl->forcemute) { ctl->forcemute = val; hdaa_audio_ctl_amp_set(ctl, @@ -294,21 +271,17 @@ hdaa_hp_switch_handler(struct hdaa_devin } } else { /* If there is no muter - disable pin output. */ - w = hdaa_widget_get(devinfo, as->pins[15]); - if (w != NULL && w->type == - HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) { - if (res != 0) - val = w->wclass.pin.ctrl | - HDA_CMD_SET_PIN_WIDGET_CTRL_OUT_ENABLE; - else - val = w->wclass.pin.ctrl & - ~HDA_CMD_SET_PIN_WIDGET_CTRL_OUT_ENABLE; - if (val != w->wclass.pin.ctrl) { - w->wclass.pin.ctrl = val; - hda_command(devinfo->dev, - HDA_CMD_SET_PIN_WIDGET_CTRL(0, - w->nid, w->wclass.pin.ctrl)); - } + if (connected) + val = w->wclass.pin.ctrl | + HDA_CMD_SET_PIN_WIDGET_CTRL_OUT_ENABLE; + else + val = w->wclass.pin.ctrl & + ~HDA_CMD_SET_PIN_WIDGET_CTRL_OUT_ENABLE; + if (val != w->wclass.pin.ctrl) { + w->wclass.pin.ctrl = val; + hda_command(devinfo->dev, + HDA_CMD_SET_PIN_WIDGET_CTRL(0, + w->nid, w->wclass.pin.ctrl)); } } /* (Un)Mute other pins. */ @@ -319,7 +292,7 @@ hdaa_hp_switch_handler(struct hdaa_devin as->pins[j], HDAA_CTL_IN, -1, 1); if (ctl != NULL && ctl->mute) { /* If pin has muter - use it. */ - val = (res != 0) ? 1 : 0; + val = connected ? 1 : 0; if (val == ctl->forcemute) continue; ctl->forcemute = val; @@ -329,32 +302,142 @@ hdaa_hp_switch_handler(struct hdaa_devin continue; } /* If there is no muter - disable pin output. */ - w = hdaa_widget_get(devinfo, as->pins[j]); - if (w != NULL && w->type == - HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) { - if (res != 0) - val = w->wclass.pin.ctrl & + w1 = hdaa_widget_get(devinfo, as->pins[j]); + if (w1 != NULL) { + if (connected) + val = w1->wclass.pin.ctrl & ~HDA_CMD_SET_PIN_WIDGET_CTRL_OUT_ENABLE; else - val = w->wclass.pin.ctrl | + val = w1->wclass.pin.ctrl | HDA_CMD_SET_PIN_WIDGET_CTRL_OUT_ENABLE; - if (val != w->wclass.pin.ctrl) { - w->wclass.pin.ctrl = val; + if (val != w1->wclass.pin.ctrl) { + w1->wclass.pin.ctrl = val; hda_command(devinfo->dev, HDA_CMD_SET_PIN_WIDGET_CTRL(0, - w->nid, w->wclass.pin.ctrl)); + w1->nid, w1->wclass.pin.ctrl)); } } } } /* - * Callback for poll based jack detection. + * Recording source change handler. + */ +static void +hdaa_autorecsrc_handler(struct hdaa_audio_as *as, struct hdaa_widget *w) +{ + struct hdaa_pcm_devinfo *pdevinfo = as->pdevinfo; + struct hdaa_devinfo *devinfo; + struct hdaa_widget *w1; + int i, mask, fullmask, prio, bestprio; + char buf[128]; + + if (!as->mixed || pdevinfo == NULL || pdevinfo->mixer == NULL) + return; + /* Don't touch anything if we asked not to. */ + if (pdevinfo->autorecsrc == 0 || + (pdevinfo->autorecsrc == 1 && w != NULL)) + return; + /* Don't touch anything if "mix" or "speaker" selected. */ + if (pdevinfo->recsrc & (SOUND_MASK_IMIX | SOUND_MASK_SPEAKER)) + return; + /* Don't touch anything if several selected. */ + if (ffs(pdevinfo->recsrc) != fls(pdevinfo->recsrc)) + return; + devinfo = pdevinfo->devinfo; + mask = fullmask = 0; + bestprio = 0; + for (i = 0; i < 16; i++) { + if (as->pins[i] <= 0) + continue; + w1 = hdaa_widget_get(devinfo, as->pins[i]); + if (w1 == NULL || w1->enable == 0) + continue; + if (w1->wclass.pin.connected == 0) + continue; + prio = (w1->wclass.pin.connected == 1) ? 2 : 1; + if (prio < bestprio) + continue; + if (prio > bestprio) { + mask = 0; + bestprio = prio; + } + mask |= (1 << w1->ossdev); + fullmask |= (1 << w1->ossdev); + } + if (mask == 0) + return; + /* Prefer newly connected input. */ + if (w != NULL && (mask & (1 << w->ossdev))) + mask = (1 << w->ossdev); + /* Prefer previously selected input */ + if (mask & pdevinfo->recsrc) + mask &= pdevinfo->recsrc; + /* Prefer mic. */ + if (mask & SOUND_MASK_MIC) + mask = SOUND_MASK_MIC; + /* Prefer monitor (2nd mic). */ + if (mask & SOUND_MASK_MONITOR) + mask = SOUND_MASK_MONITOR; + /* Just take first one. */ + mask = (1 << (ffs(mask) - 1)); + HDA_BOOTVERBOSE( + hdaa_audio_ctl_ossmixer_mask2allname(mask, buf, sizeof(buf)); + device_printf(pdevinfo->dev, + "Automatically set rec source to: %s\n", buf); + ); + hdaa_unlock(devinfo); + mix_setrecsrc(pdevinfo->mixer, mask); + hdaa_lock(devinfo); +} + +/* + * Jack presence detection event handler. + */ +static void +hdaa_presence_handler(struct hdaa_widget *w) +{ + struct hdaa_devinfo *devinfo = w->devinfo; + struct hdaa_audio_as *as; + uint32_t res; + int connected; + + if (w->enable == 0 || w->type != + HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) + return; + + if (HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP(w->wclass.pin.cap) == 0 || + (HDA_CONFIG_DEFAULTCONF_MISC(w->wclass.pin.config) & 1) != 0) + return; + + res = hda_command(devinfo->dev, HDA_CMD_GET_PIN_SENSE(0, w->nid)); + connected = (res & HDA_CMD_GET_PIN_SENSE_PRESENCE_DETECT) != 0; + if (devinfo->quirks & HDAA_QUIRK_SENSEINV) + connected = !connected; + if (connected == w->wclass.pin.connected) + return; + w->wclass.pin.connected = connected; + HDA_BOOTVERBOSE( + device_printf(devinfo->dev, + "Pin sense: nid=%d sence=0x%08x (%sconnected)\n", + w->nid, res, !w->wclass.pin.connected ? "dis" : ""); + ); + + as = &devinfo->as[w->bindas]; + if (as->hpredir >= 0 && as->pins[15] == w->nid) + hdaa_hpredir_handler(w); + if (as->dir == HDAA_CTL_IN) + hdaa_autorecsrc_handler(as, w); +} + +/* + * Callback for poll based presence detection. */ static void hdaa_jack_poll_callback(void *arg) { struct hdaa_devinfo *devinfo = arg; + struct hdaa_widget *w; int i; hdaa_lock(devinfo); @@ -365,56 +448,203 @@ hdaa_jack_poll_callback(void *arg) for (i = 0; i < devinfo->ascnt; i++) { if (devinfo->as[i].hpredir < 0) continue; - hdaa_hp_switch_handler(devinfo, i); + w = hdaa_widget_get(devinfo, devinfo->as[i].pins[15]); + if (w == NULL || w->enable == 0 || w->type != + HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) + continue; + hdaa_presence_handler(w); } callout_reset(&devinfo->poll_jack, devinfo->poll_ival, hdaa_jack_poll_callback, devinfo); hdaa_unlock(devinfo); } +static void +hdaa_eld_dump(struct hdaa_widget *w) +{ + struct hdaa_devinfo *devinfo = w->devinfo; + device_t dev = devinfo->dev; + uint8_t *sad; + int len, mnl, i, sadc, fmt; + + if (w->eld == NULL || w->eld_len < 4) + return; + device_printf(dev, + "ELD nid=%d: ELD_Ver=%u Baseline_ELD_Len=%u\n", + w->nid, w->eld[0] >> 3, w->eld[2]); + if ((w->eld[0] >> 3) != 0x02) + return; + len = min(w->eld_len, (u_int)w->eld[2] * 4); + mnl = w->eld[4] & 0x1f; + device_printf(dev, + "ELD nid=%d: CEA_EDID_Ver=%u MNL=%u\n", + w->nid, w->eld[4] >> 5, mnl); + sadc = w->eld[5] >> 4; + device_printf(dev, + "ELD nid=%d: SAD_Count=%u Conn_Type=%u S_AI=%u HDCP=%u\n", + w->nid, sadc, (w->eld[5] >> 2) & 0x3, + (w->eld[5] >> 1) & 0x1, w->eld[5] & 0x1); + device_printf(dev, + "ELD nid=%d: Aud_Synch_Delay=%ums\n", + w->nid, w->eld[6] * 2); + device_printf(dev, + "ELD nid=%d: Channels=0x%b\n", + w->nid, w->eld[7], + "\020\07RLRC\06FLRC\05RC\04RLR\03FC\02LFE\01FLR"); + device_printf(dev, + "ELD nid=%d: Port_ID=0x%02x%02x%02x%02x%02x%02x%02x%02x\n", + w->nid, w->eld[8], w->eld[9], w->eld[10], w->eld[11], + w->eld[12], w->eld[13], w->eld[14], w->eld[15]); + device_printf(dev, + "ELD nid=%d: Manufacturer_Name=0x%02x%02x\n", + w->nid, w->eld[16], w->eld[17]); + device_printf(dev, + "ELD nid=%d: Product_Code=0x%02x%02x\n", + w->nid, w->eld[18], w->eld[19]); + device_printf(dev, + "ELD nid=%d: Monitor_Name_String='%.*s'\n", + w->nid, mnl, &w->eld[20]); + for (i = 0; i < sadc; i++) { + sad = &w->eld[20 + mnl + i * 3]; + fmt = (sad[0] >> 3) & 0x0f; + if (fmt == HDA_HDMI_CODING_TYPE_REF_CTX) { + fmt = (sad[2] >> 3) & 0x1f; + if (fmt < 1 || fmt > 3) + fmt = 0; + else + fmt += 14; + } + device_printf(dev, + "ELD nid=%d: %s %dch freqs=0x%b", + w->nid, HDA_HDMI_CODING_TYPES[fmt], (sad[0] & 0x07) + 1, + sad[1], "\020\007192\006176\00596\00488\00348\00244\00132"); + switch (fmt) { + case HDA_HDMI_CODING_TYPE_LPCM: + printf(" sizes=0x%b", + sad[2] & 0x07, "\020\00324\00220\00116"); + break; + case HDA_HDMI_CODING_TYPE_AC3: + case HDA_HDMI_CODING_TYPE_MPEG1: + case HDA_HDMI_CODING_TYPE_MP3: + case HDA_HDMI_CODING_TYPE_MPEG2: + case HDA_HDMI_CODING_TYPE_AACLC: + case HDA_HDMI_CODING_TYPE_DTS: + case HDA_HDMI_CODING_TYPE_ATRAC: + printf(" max_bitrate=%d", sad[2] * 8000); + break; + case HDA_HDMI_CODING_TYPE_WMAPRO: + printf(" profile=%d", sad[2] & 0x07); + break; + } + printf("\n"); + } +} + +static void +hdaa_eld_handler(struct hdaa_widget *w) +{ + struct hdaa_devinfo *devinfo = w->devinfo; + uint32_t res; + int i; + + if (w->enable == 0 || w->type != + HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) + return; + + if (HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP(w->wclass.pin.cap) == 0 || + (HDA_CONFIG_DEFAULTCONF_MISC(w->wclass.pin.config) & 1) != 0) + return; + + res = hda_command(devinfo->dev, HDA_CMD_GET_PIN_SENSE(0, w->nid)); + if ((w->eld != 0) == ((res & HDA_CMD_GET_PIN_SENSE_ELD_VALID) != 0)) + return; + if (w->eld != NULL) { + w->eld_len = 0; + free(w->eld, M_HDAA); + w->eld = NULL; + } + HDA_BOOTVERBOSE( + device_printf(devinfo->dev, + "Pin sense: nid=%d sence=0x%08x " + "(%sconnected, ELD %svalid)\n", + w->nid, res, + (res & HDA_CMD_GET_PIN_SENSE_PRESENCE_DETECT) ? "" : "dis", + (res & HDA_CMD_GET_PIN_SENSE_ELD_VALID) ? "" : "in"); + ); + if ((res & HDA_CMD_GET_PIN_SENSE_ELD_VALID) == 0) + return; + + res = hda_command(devinfo->dev, + HDA_CMD_GET_HDMI_DIP_SIZE(0, w->nid, 0x08)); + if (res == HDA_INVALID) + return; + w->eld_len = res & 0xff; + if (w->eld_len != 0) + w->eld = malloc(w->eld_len, M_HDAA, M_ZERO | M_NOWAIT); + if (w->eld == NULL) { + w->eld_len = 0; + return; + } + + for (i = 0; i < w->eld_len; i++) { + res = hda_command(devinfo->dev, + HDA_CMD_GET_HDMI_ELDD(0, w->nid, i)); + if (res & 0x80000000) + w->eld[i] = res & 0xff; + } + HDA_BOOTVERBOSE( + hdaa_eld_dump(w); + ); +} + /* - * Jack detection initializer. + * Pin sense initializer. */ static void -hdaa_hp_switch_init(struct hdaa_devinfo *devinfo) +hdaa_sense_init(struct hdaa_devinfo *devinfo) { - struct hdaa_audio_as *as = devinfo->as; - struct hdaa_widget *w; - int i, poll = 0; - - for (i = 0; i < devinfo->ascnt; i++) { - if (as[i].hpredir < 0) - continue; + struct hdaa_audio_as *as; + struct hdaa_widget *w; + int i, poll = 0; - w = hdaa_widget_get(devinfo, as[i].pins[15]); + for (i = devinfo->startnode; i < devinfo->endnode; i++) { + w = hdaa_widget_get(devinfo, i); if (w == NULL || w->enable == 0 || w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) continue; - if (HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP(w->wclass.pin.cap) == 0 || - (HDA_CONFIG_DEFAULTCONF_MISC(w->wclass.pin.config) & 1) != 0) { - device_printf(devinfo->dev, - "No jack detection support at pin %d\n", - as[i].pins[15]); - continue; - } - if (HDA_PARAM_AUDIO_WIDGET_CAP_UNSOL_CAP(w->param.widget_cap)) { - as[i].unsol = HDAC_UNSOL_ALLOC( - device_get_parent(devinfo->dev), devinfo->dev, - w->nid); + if (HDA_PARAM_AUDIO_WIDGET_CAP_UNSOL_CAP(w->param.widget_cap) && + w->unsol < 0) { + w->unsol = HDAC_UNSOL_ALLOC( + device_get_parent(devinfo->dev), devinfo->dev, w->nid); hda_command(devinfo->dev, HDA_CMD_SET_UNSOLICITED_RESPONSE(0, w->nid, - HDA_CMD_SET_UNSOLICITED_RESPONSE_ENABLE | - as[i].unsol)); - } else - poll = 1; - HDA_BOOTVERBOSE( - device_printf(devinfo->dev, - "Headphones redirection " - "for as=%d nid=%d using %s.\n", - i, w->nid, - (poll != 0) ? "polling" : "unsolicited responses"); - ); - hdaa_hp_switch_handler(devinfo, i); + HDA_CMD_SET_UNSOLICITED_RESPONSE_ENABLE | w->unsol)); + } + as = &devinfo->as[w->bindas]; + if (as->hpredir >= 0 && as->pins[15] == w->nid) { + if (HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP(w->wclass.pin.cap) == 0 || + (HDA_CONFIG_DEFAULTCONF_MISC(w->wclass.pin.config) & 1) != 0) { + device_printf(devinfo->dev, + "No presence detection support at nid %d\n", + as[i].pins[15]); + } else { + if (w->unsol < 0) + poll = 1; + HDA_BOOTVERBOSE( + device_printf(devinfo->dev, + "Headphones redirection for " + "association %d nid=%d using %s.\n", + w->bindas, w->nid, + (poll != 0) ? "polling" : + "unsolicited responses"); + ); + }; + } + hdaa_presence_handler(w); + if (!HDA_PARAM_PIN_CAP_DP(w->wclass.pin.cap) && + !HDA_PARAM_PIN_CAP_HDMI(w->wclass.pin.cap)) + continue; + hdaa_eld_handler(w); } if (poll) { callout_reset(&devinfo->poll_jack, 1, @@ -423,25 +653,25 @@ hdaa_hp_switch_init(struct hdaa_devinfo } static void -hdaa_hp_switch_deinit(struct hdaa_devinfo *devinfo) +hdaa_sense_deinit(struct hdaa_devinfo *devinfo) { - struct hdaa_audio_as *as = devinfo->as; - struct hdaa_widget *w; - int i; + struct hdaa_widget *w; + int i; - for (i = 0; i < devinfo->ascnt; i++) { - if (as[i].unsol < 0) - continue; - w = hdaa_widget_get(devinfo, as[i].pins[15]); + callout_stop(&devinfo->poll_jack); + for (i = devinfo->startnode; i < devinfo->endnode; i++) { + w = hdaa_widget_get(devinfo, i); if (w == NULL || w->enable == 0 || w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) continue; + if (w->unsol < 0) + continue; hda_command(devinfo->dev, HDA_CMD_SET_UNSOLICITED_RESPONSE(0, w->nid, 0)); HDAC_UNSOL_FREE( device_get_parent(devinfo->dev), devinfo->dev, - as[i].unsol); - as[i].unsol = -1; + w->unsol); + w->unsol = -1; } } @@ -902,6 +1132,11 @@ hdaa_widget_parse(struct hdaa_widget *w) w->param.supp_pcm_size_rate = w->devinfo->supp_pcm_size_rate; } + if (HDA_PARAM_AUDIO_WIDGET_CAP_STRIPE(w->param.widget_cap)) { + w->wclass.conv.stripecap = hda_command(dev, + HDA_CMD_GET_STRIPE_CONTROL(0, w->nid)) >> 20; + } else + w->wclass.conv.stripecap = 1; } else { w->param.supp_stream_formats = 0; w->param.supp_pcm_size_rate = 0; @@ -938,6 +1173,7 @@ hdaa_widget_parse(struct hdaa_widget *w) hdaa_sysctl_config, "A", "Original pin configuration"); hdaa_lock(w->devinfo); } + w->unsol = -1; } static void @@ -1001,6 +1237,10 @@ hdaa_widget_postprocess(struct hdaa_widg } strlcat(w->name, HDA_CONNS[conn], sizeof(w->name)); strlcat(w->name, ")", sizeof(w->name)); + + if (HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP(w->wclass.pin.cap) == 0 || + (HDA_CONFIG_DEFAULTCONF_MISC(w->wclass.pin.config) & 1) != 0) + w->wclass.pin.connected = 2; } } @@ -1193,31 +1433,58 @@ hdaa_stream_format(struct hdaa_chan *ch) return (fmt); } +static int +hdaa_allowed_stripes(uint16_t fmt) +{ + static const int bits[8] = { 8, 16, 20, 24, 32, 32, 32, 32 }; + int size; + + size = bits[(fmt >> 4) & 0x03]; + size *= (fmt & 0x0f) + 1; + size *= ((fmt >> 11) & 0x07) + 1; + return (0xffffffffU >> (32 - fls(size / 8))); +} + static void hdaa_audio_setup(struct hdaa_chan *ch) { struct hdaa_audio_as *as = &ch->devinfo->as[ch->as]; - struct hdaa_widget *w; - int i, chn, totalchn, c; + struct hdaa_widget *w, *wp; + int i, j, k, chn, cchn, totalchn, totalextchn, c; uint16_t fmt, dfmt; - uint16_t chmap[2][5] = {{ 0x0010, 0x0001, 0x0201, 0x0231, 0x0231 }, /* 5.1 */ - { 0x0010, 0x0001, 0x2001, 0x2031, 0x2431 }};/* 7.1 */ - int map = -1; + /* Mapping channel pairs to codec pins/converters. */ + const static uint16_t convmap[2][5] = + {{ 0x0010, 0x0001, 0x0201, 0x0231, 0x0231 }, /* 5.1 */ + { 0x0010, 0x0001, 0x2001, 0x2031, 0x2431 }};/* 7.1 */ + /* Mapping formats to HDMI channel allocations. */ + const static uint8_t hdmica[2][8] = + {{ 0x02, 0x00, 0x04, 0x08, 0x0a, 0x0e, 0x12, 0x12 }, /* x.0 */ + { 0x01, 0x03, 0x01, 0x03, 0x09, 0x0b, 0x0f, 0x13 }}; /* x.1 */ + /* Mapping formats to HDMI channels order. */ + const static uint32_t hdmich[2][8] = + {{ 0xFFFF0F00, 0xFFFFFF10, 0xFFF2FF10, 0xFF32FF10, + 0xFF324F10, 0xF5324F10, 0x54326F10, 0x54326F10 }, /* x.0 */ + { 0xFFFFF000, 0xFFFF0100, 0xFFFFF210, 0xFFFF2310, + 0xFF32F410, 0xFF324510, 0xF6324510, 0x76325410 }}; /* x.1 */ + int convmapid = -1; + nid_t nid; + uint8_t csum; totalchn = AFMT_CHANNEL(ch->fmt); + totalextchn = AFMT_EXTCHANNEL(ch->fmt); HDA_BOOTHVERBOSE( device_printf(ch->pdevinfo->dev, - "PCMDIR_%s: Stream setup fmt=%08x speed=%d\n", + "PCMDIR_%s: Stream setup fmt=%08x (%d.%d) speed=%d\n", (ch->dir == PCMDIR_PLAY) ? "PLAY" : "REC", - ch->fmt, ch->spd); + ch->fmt, totalchn - totalextchn, totalextchn, ch->spd); ); fmt = hdaa_stream_format(ch); - /* Set channel mapping for known speaker setups. */ + /* Set channels to I/O converters mapping for known speaker setups. */ if ((as->pinset == 0x0007 || as->pinset == 0x0013)) /* Standard 5.1 */ - map = 0; + convmapid = 0; else if (as->pinset == 0x0017) /* Standard 7.1 */ - map = 1; + convmapid = 1; dfmt = HDA_CMD_SET_DIGITAL_CONV_FMT1_DIGEN; if (ch->fmt & AFMT_AC3) @@ -1234,22 +1501,16 @@ hdaa_audio_setup(struct hdaa_chan *ch) if (as->fakeredir && i == (as->pincnt - 1)) { c = (ch->sid << 4); } else { - if (map >= 0) /* Map known speaker setups. */ - chn = (((chmap[map][totalchn / 2] >> i * 4) & - 0xf) - 1) * 2; + /* Map channels to I/O converters, if set. */ + if (convmapid >= 0) + chn = (((convmap[convmapid][totalchn / 2] + >> i * 4) & 0xf) - 1) * 2; if (chn < 0 || chn >= totalchn) { c = 0; } else { c = (ch->sid << 4) | chn; } } - HDA_BOOTHVERBOSE( - device_printf(ch->pdevinfo->dev, - "PCMDIR_%s: Stream setup nid=%d: " - "fmt=0x%04x, dfmt=0x%04x, chan=0x%04x\n", - (ch->dir == PCMDIR_PLAY) ? "PLAY" : "REC", - ch->io[i], fmt, dfmt, c); - ); hda_command(ch->devinfo->dev, HDA_CMD_SET_CONV_FMT(0, ch->io[i], fmt)); if (HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL(w->param.widget_cap)) { @@ -1258,15 +1519,112 @@ hdaa_audio_setup(struct hdaa_chan *ch) } hda_command(ch->devinfo->dev, HDA_CMD_SET_CONV_STREAM_CHAN(0, ch->io[i], c)); -#if 0 - hda_command(ch->devinfo->dev, - HDA_CMD_SET_CONV_CHAN_COUNT(0, ch->io[i], 1)); - hda_command(ch->devinfo->dev, - HDA_CMD_SET_HDMI_CHAN_SLOT(0, ch->io[i], 0x00)); - hda_command(ch->devinfo->dev, - HDA_CMD_SET_HDMI_CHAN_SLOT(0, ch->io[i], 0x11)); -#endif - chn += HDA_PARAM_AUDIO_WIDGET_CAP_CC(w->param.widget_cap) + 1; + if (HDA_PARAM_AUDIO_WIDGET_CAP_STRIPE(w->param.widget_cap)) { + hda_command(ch->devinfo->dev, + HDA_CMD_SET_STRIPE_CONTROL(0, w->nid, ch->stripectl)); + } + cchn = HDA_PARAM_AUDIO_WIDGET_CAP_CC(w->param.widget_cap); + if (cchn > 1 && chn < totalchn) { + cchn = min(cchn, totalchn - chn - 1); + hda_command(ch->devinfo->dev, + HDA_CMD_SET_CONV_CHAN_COUNT(0, ch->io[i], cchn)); + } + HDA_BOOTHVERBOSE( + device_printf(ch->pdevinfo->dev, + "PCMDIR_%s: Stream setup nid=%d: " + "fmt=0x%04x, dfmt=0x%04x, chan=0x%04x, " + "chan_count=0x%02x, stripe=%d\n", + (ch->dir == PCMDIR_PLAY) ? "PLAY" : "REC", + ch->io[i], fmt, dfmt, c, cchn, ch->stripectl); + ); + for (j = 0; j < 16; j++) { + if (as->dacs[ch->asindex][j] != ch->io[i]) + continue; + nid = as->pins[j]; + wp = hdaa_widget_get(ch->devinfo, nid); + if (wp == NULL) + continue; + if (!HDA_PARAM_PIN_CAP_DP(wp->wclass.pin.cap) && + !HDA_PARAM_PIN_CAP_HDMI(wp->wclass.pin.cap)) + continue; + + /* Set channel mapping. */ + for (k = 0; k < 8; k++) { + hda_command(ch->devinfo->dev, + HDA_CMD_SET_HDMI_CHAN_SLOT(0, nid, + (((hdmich[totalextchn == 0 ? 0 : 1][totalchn - 1] + >> (k * 4)) & 0xf) << 4) | k)); + } + + /* + * Enable High Bit Rate (HBR) Encoded Packet Type + * (EPT), if supported and needed (8ch data). + */ + if (HDA_PARAM_PIN_CAP_HDMI(wp->wclass.pin.cap) && + HDA_PARAM_PIN_CAP_HBR(wp->wclass.pin.cap)) { + wp->wclass.pin.ctrl &= + ~HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE_MASK; + if ((ch->fmt & AFMT_AC3) && (cchn == 7)) + wp->wclass.pin.ctrl |= 0x03; + hda_command(ch->devinfo->dev, + HDA_CMD_SET_PIN_WIDGET_CTRL(0, nid, + wp->wclass.pin.ctrl)); + } + + /* Stop audio infoframe transmission. */ + hda_command(ch->devinfo->dev, + HDA_CMD_SET_HDMI_DIP_INDEX(0, nid, 0x00)); + hda_command(ch->devinfo->dev, + HDA_CMD_SET_HDMI_DIP_XMIT(0, nid, 0x00)); + + /* Clear audio infoframe buffer. */ + hda_command(ch->devinfo->dev, + HDA_CMD_SET_HDMI_DIP_INDEX(0, nid, 0x00)); + for (k = 0; k < 32; k++) + hda_command(ch->devinfo->dev, + HDA_CMD_SET_HDMI_DIP_DATA(0, nid, 0x00)); + + /* Write HDMI/DisplayPort audio infoframe. */ + hda_command(ch->devinfo->dev, + HDA_CMD_SET_HDMI_DIP_INDEX(0, nid, 0x00)); + if (w->eld != NULL && w->eld_len >= 6 && + ((w->eld[5] >> 2) & 0x3) == 1) { /* DisplayPort */ + hda_command(ch->devinfo->dev, + HDA_CMD_SET_HDMI_DIP_DATA(0, nid, 0x84)); + hda_command(ch->devinfo->dev, + HDA_CMD_SET_HDMI_DIP_DATA(0, nid, 0x1b)); + hda_command(ch->devinfo->dev, + HDA_CMD_SET_HDMI_DIP_DATA(0, nid, 0x44)); + } else { /* HDMI */ + hda_command(ch->devinfo->dev, + HDA_CMD_SET_HDMI_DIP_DATA(0, nid, 0x84)); + hda_command(ch->devinfo->dev, + HDA_CMD_SET_HDMI_DIP_DATA(0, nid, 0x01)); + hda_command(ch->devinfo->dev, + HDA_CMD_SET_HDMI_DIP_DATA(0, nid, 0x0a)); + csum = 0; + csum -= 0x84 + 0x01 + 0x0a + (totalchn - 1) + + hdmica[totalextchn == 0 ? 0 : 1][totalchn - 1]; + hda_command(ch->devinfo->dev, + HDA_CMD_SET_HDMI_DIP_DATA(0, nid, csum)); + } + hda_command(ch->devinfo->dev, + HDA_CMD_SET_HDMI_DIP_DATA(0, nid, totalchn - 1)); + hda_command(ch->devinfo->dev, + HDA_CMD_SET_HDMI_DIP_DATA(0, nid, 0x00)); + hda_command(ch->devinfo->dev, + HDA_CMD_SET_HDMI_DIP_DATA(0, nid, 0x00)); + hda_command(ch->devinfo->dev, + HDA_CMD_SET_HDMI_DIP_DATA(0, nid, + hdmica[totalextchn == 0 ? 0 : 1][totalchn - 1])); + + /* Start audio infoframe transmission. */ + hda_command(ch->devinfo->dev, + HDA_CMD_SET_HDMI_DIP_INDEX(0, nid, 0x00)); + hda_command(ch->devinfo->dev, + HDA_CMD_SET_HDMI_DIP_XMIT(0, nid, 0xc0)); + } + chn += cchn + 1; } } @@ -1351,6 +1709,8 @@ hdaa_channel_stop(struct hdaa_chan *ch) struct hdaa_widget *w; int i; + if ((ch->flags & HDAA_CHN_RUNNING) == 0) + return; ch->flags &= ~HDAA_CHN_RUNNING; HDAC_STREAM_STOP(device_get_parent(devinfo->dev), devinfo->dev, ch->dir == PCMDIR_PLAY ? 1 : 0, ch->sid); @@ -1374,11 +1734,12 @@ static int hdaa_channel_start(struct hdaa_chan *ch) { struct hdaa_devinfo *devinfo = ch->devinfo; + uint32_t fmt; - ch->ptr = 0; - ch->prevptr = 0; + fmt = hdaa_stream_format(ch); + ch->stripectl = fls(ch->stripecap & hdaa_allowed_stripes(fmt)) - 1; ch->sid = HDAC_STREAM_ALLOC(device_get_parent(devinfo->dev), devinfo->dev, - ch->dir == PCMDIR_PLAY ? 1 : 0, hdaa_stream_format(ch), &ch->dmapos); + ch->dir == PCMDIR_PLAY ? 1 : 0, fmt, ch->stripectl, &ch->dmapos); if (ch->sid <= 0) return (EBUSY); hdaa_audio_setup(ch); @@ -1468,11 +1829,11 @@ hdaa_audio_ctl_ossmixer_init(struct snd_ struct hdaa_pcm_devinfo *pdevinfo = mix_getdevinfo(m); struct hdaa_devinfo *devinfo = pdevinfo->devinfo; struct hdaa_widget *w, *cw; - struct hdaa_audio_ctl *ctl; uint32_t mask, recmask; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 8 13:22:51 2012 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 43641106566B; Fri, 8 Jun 2012 13:22:51 +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 2CC8F8FC12; Fri, 8 Jun 2012 13:22: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 q58DMpmd061705; Fri, 8 Jun 2012 13:22:51 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q58DMolQ061701; Fri, 8 Jun 2012 13:22:50 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206081322.q58DMolQ061701@svn.freebsd.org> From: Alexander Motin Date: Fri, 8 Jun 2012 13:22:50 +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: r236754 - stable/8/sys/dev/sound/pcm 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, 08 Jun 2012 13:22:51 -0000 Author: mav Date: Fri Jun 8 13:22:50 2012 New Revision: 236754 URL: http://svn.freebsd.org/changeset/base/236754 Log: MFC r230845: Make sound(4) more flexible in setting soft buffer and block sizes when hardware imposes strict limitations on hard buffer and block sizes. Previous code set soft buffer to be no smaller then hard buffer. On some cards with fixed 64K physical buffer that caused up to 800ms play latency. New code allows to set soft buffer size down to just two blocks of the hard buffer and to not write more then that size ahead to the hardware buffer. As result of that change I was able to reduce full practically measured record-playback loop delay in those conditions down to only about 115ms with theoretical playback latency of only about 50ms. New code works fine for both vchans and direct cases. In both cases sound(4) tries to follow hw.snd.latency_profile and hw.snd.latency values and application-requested buffer and block sizes as much as limitation of two hardware blocks allows. Modified: stable/8/sys/dev/sound/pcm/buffer.c stable/8/sys/dev/sound/pcm/buffer.h stable/8/sys/dev/sound/pcm/channel.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/sound/pcm/buffer.c ============================================================================== --- stable/8/sys/dev/sound/pcm/buffer.c Fri Jun 8 13:10:18 2012 (r236753) +++ stable/8/sys/dev/sound/pcm/buffer.c Fri Jun 8 13:22:50 2012 (r236754) @@ -301,6 +301,15 @@ sndbuf_fillsilence(struct snd_dbuf *b) b->rl = b->bufsize; } +void +sndbuf_fillsilence_rl(struct snd_dbuf *b, u_int rl) +{ + if (b->bufsize > 0) + memset(sndbuf_getbuf(b), sndbuf_zerodata(b->fmt), b->bufsize); + b->rp = 0; + b->rl = min(b->bufsize, rl); +} + /** * @brief Reset buffer w/o flushing statistics * Modified: stable/8/sys/dev/sound/pcm/buffer.h ============================================================================== --- stable/8/sys/dev/sound/pcm/buffer.h Fri Jun 8 13:10:18 2012 (r236753) +++ stable/8/sys/dev/sound/pcm/buffer.h Fri Jun 8 13:22:50 2012 (r236754) @@ -74,6 +74,7 @@ int sndbuf_remalloc(struct snd_dbuf *b, void sndbuf_reset(struct snd_dbuf *b); void sndbuf_clear(struct snd_dbuf *b, unsigned int length); void sndbuf_fillsilence(struct snd_dbuf *b); +void sndbuf_fillsilence_rl(struct snd_dbuf *b, u_int rl); void sndbuf_softreset(struct snd_dbuf *b); void sndbuf_clearshadow(struct snd_dbuf *b); Modified: stable/8/sys/dev/sound/pcm/channel.c ============================================================================== --- stable/8/sys/dev/sound/pcm/channel.c Fri Jun 8 13:10:18 2012 (r236753) +++ stable/8/sys/dev/sound/pcm/channel.c Fri Jun 8 13:22:50 2012 (r236754) @@ -395,24 +395,28 @@ chn_wrfeed(struct pcm_channel *c) { struct snd_dbuf *b = c->bufhard; struct snd_dbuf *bs = c->bufsoft; - unsigned int amt; + unsigned int amt, want, wasfree; CHN_LOCKASSERT(c); if ((c->flags & CHN_F_MMAP) && !(c->flags & CHN_F_CLOSING)) sndbuf_acquire(bs, NULL, sndbuf_getfree(bs)); - amt = sndbuf_getfree(b); + wasfree = sndbuf_getfree(b); + want = min(sndbuf_getsize(b), + imax(0, sndbuf_xbytes(sndbuf_getsize(bs), bs, b) - + sndbuf_getready(b))); + amt = min(wasfree, want); if (amt > 0) sndbuf_feed(bs, b, c, c->feeder, amt); /* * Possible xruns. There should be no empty space left in buffer. */ - if (sndbuf_getfree(b) > 0) + if (sndbuf_getready(b) < want) c->xruns++; - if (sndbuf_getfree(b) < amt) + if (sndbuf_getfree(b) < wasfree) chn_wakeup(c); } @@ -721,7 +725,8 @@ chn_start(struct pcm_channel *c, int for } if (c->parentchannel == NULL) { if (c->direction == PCMDIR_PLAY) - sndbuf_fillsilence(b); + sndbuf_fillsilence_rl(b, + sndbuf_xbytes(sndbuf_getsize(bs), bs, b)); if (snd_verbose > 3) device_printf(c->dev, "%s(): %s starting! (%s/%s) " @@ -1728,7 +1733,7 @@ chn_resizebuf(struct pcm_channel *c, int int blkcnt, int blksz) { struct snd_dbuf *b, *bs, *pb; - int sblksz, sblkcnt, hblksz, hblkcnt, limit = 1; + int sblksz, sblkcnt, hblksz, hblkcnt, limit = 0, nsblksz, nsblkcnt; int ret; CHN_LOCKASSERT(c); @@ -1748,7 +1753,6 @@ chn_resizebuf(struct pcm_channel *c, int return EINVAL; else { c->latency = latency; - limit = 0; } bs = c->bufsoft; @@ -1783,19 +1787,22 @@ chn_resizebuf(struct pcm_channel *c, int */ sblksz = round_blksz(blksz, sndbuf_getalign(bs)); sblkcnt = round_pow2(blkcnt); - limit = 0; } if (c->parentchannel != NULL) { - pb = CHN_BUF_PARENT(c, NULL); + pb = c->parentchannel->bufsoft; CHN_UNLOCK(c); CHN_LOCK(c->parentchannel); chn_notify(c->parentchannel, CHN_N_BLOCKSIZE); CHN_UNLOCK(c->parentchannel); CHN_LOCK(c); - limit = (limit != 0 && pb != NULL) ? - sndbuf_xbytes(sndbuf_getsize(pb), pb, bs) : 0; - c->timeout = c->parentchannel->timeout; + if (c->direction == PCMDIR_PLAY) { + limit = (pb != NULL) ? + sndbuf_xbytes(sndbuf_getsize(pb), pb, bs) : 0; + } else { + limit = (pb != NULL) ? + sndbuf_xbytes(sndbuf_getblksz(pb), pb, bs) * 2 : 0; + } } else { hblkcnt = 2; if (c->flags & CHN_F_HAS_SIZE) { @@ -1836,21 +1843,22 @@ chn_resizebuf(struct pcm_channel *c, int CHN_LOCK(c); if (!CHN_EMPTY(c, children)) { - sblksz = round_blksz( - sndbuf_xbytes(sndbuf_getsize(b) >> 1, b, bs), + nsblksz = round_blksz( + sndbuf_xbytes(sndbuf_getblksz(b), b, bs), sndbuf_getalign(bs)); - sblkcnt = 2; + nsblkcnt = sndbuf_getblkcnt(b); + if (c->direction == PCMDIR_PLAY) { + do { + nsblkcnt--; + } while (nsblkcnt >= 2 && + nsblksz * nsblkcnt >= sblksz * sblkcnt); + nsblkcnt++; + } + sblksz = nsblksz; + sblkcnt = nsblkcnt; limit = 0; - } else if (limit != 0) - limit = sndbuf_xbytes(sndbuf_getsize(b), b, bs); - - /* - * Interrupt timeout - */ - c->timeout = ((u_int64_t)hz * sndbuf_getsize(b)) / - ((u_int64_t)sndbuf_getspd(b) * sndbuf_getalign(b)); - if (c->timeout < 1) - c->timeout = 1; + } else + limit = sndbuf_xbytes(sndbuf_getblksz(b), b, bs) * 2; } if (limit > CHN_2NDBUFMAXSIZE) @@ -1887,6 +1895,16 @@ chn_resizebuf(struct pcm_channel *c, int } /* + * Interrupt timeout + */ + c->timeout = ((u_int64_t)hz * sndbuf_getsize(bs)) / + ((u_int64_t)sndbuf_getspd(bs) * sndbuf_getalign(bs)); + if (c->parentchannel != NULL) + c->timeout = min(c->timeout, c->parentchannel->timeout); + if (c->timeout < 1) + c->timeout = 1; + + /* * OSSv4 docs: "By default OSS will set the low water level equal * to the fragment size which is optimal in most cases." */ From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 8 13:25:47 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 720A71065673; Fri, 8 Jun 2012 13:25:47 +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 5C6E18FC16; Fri, 8 Jun 2012 13:25:47 +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 q58DPlBZ061892; Fri, 8 Jun 2012 13:25:47 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q58DPlmq061890; Fri, 8 Jun 2012 13:25:47 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206081325.q58DPlmq061890@svn.freebsd.org> From: Alexander Motin Date: Fri, 8 Jun 2012 13:25:47 +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: r236755 - stable/8/sys/dev/sound/pci/hda 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, 08 Jun 2012 13:25:47 -0000 Author: mav Date: Fri Jun 8 13:25:46 2012 New Revision: 236755 URL: http://svn.freebsd.org/changeset/base/236755 Log: MFC r233606: Stop HDA controller polling callout on suspend and reset it on resume. Modified: stable/8/sys/dev/sound/pci/hda/hdac.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/8/sys/dev/sound/pci/hda/hdac.c Fri Jun 8 13:22:50 2012 (r236754) +++ stable/8/sys/dev/sound/pci/hda/hdac.c Fri Jun 8 13:25:46 2012 (r236755) @@ -1558,8 +1558,10 @@ hdac_suspend(device_t dev) HDA_BOOTHVERBOSE( device_printf(dev, "Reset controller...\n"); ); + callout_stop(&sc->poll_callout); hdac_reset(sc, 0); hdac_unlock(sc); + callout_drain(&sc->poll_callout); taskqueue_drain(taskqueue_thread, &sc->unsolq_task); HDA_BOOTHVERBOSE( device_printf(dev, "Suspend done\n"); @@ -1608,6 +1610,7 @@ hdac_resume(device_t dev) HDAC_GCTL_UNSOL); HDAC_WRITE_4(&sc->mem, HDAC_INTCTL, HDAC_INTCTL_CIE | HDAC_INTCTL_GIE); DELAY(1000); + hdac_poll_reinit(sc); hdac_unlock(sc); error = bus_generic_resume(dev); From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 8 13:27:30 2012 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 CB85D1065673; Fri, 8 Jun 2012 13:27:30 +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 B56468FC08; Fri, 8 Jun 2012 13:27: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 q58DRUnY062019; Fri, 8 Jun 2012 13:27:30 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q58DRUFU062017; Fri, 8 Jun 2012 13:27:30 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206081327.q58DRUFU062017@svn.freebsd.org> From: Alexander Motin Date: Fri, 8 Jun 2012 13:27:30 +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: r236756 - stable/8/sys/dev/sound/pci/hda 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, 08 Jun 2012 13:27:30 -0000 Author: mav Date: Fri Jun 8 13:27:30 2012 New Revision: 236756 URL: http://svn.freebsd.org/changeset/base/236756 Log: MFC r233692: Reenable unsolicited responses on CODEC if hdaa_sense_init() called again. This fixes jack connection events handling after suspend/resume. Modified: stable/8/sys/dev/sound/pci/hda/hdaa.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/sound/pci/hda/hdaa.c ============================================================================== --- stable/8/sys/dev/sound/pci/hda/hdaa.c Fri Jun 8 13:25:46 2012 (r236755) +++ stable/8/sys/dev/sound/pci/hda/hdaa.c Fri Jun 8 13:27:30 2012 (r236756) @@ -612,10 +612,11 @@ hdaa_sense_init(struct hdaa_devinfo *dev if (w == NULL || w->enable == 0 || w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) continue; - if (HDA_PARAM_AUDIO_WIDGET_CAP_UNSOL_CAP(w->param.widget_cap) && - w->unsol < 0) { - w->unsol = HDAC_UNSOL_ALLOC( - device_get_parent(devinfo->dev), devinfo->dev, w->nid); + if (HDA_PARAM_AUDIO_WIDGET_CAP_UNSOL_CAP(w->param.widget_cap)) { + if (w->unsol < 0) + w->unsol = HDAC_UNSOL_ALLOC( + device_get_parent(devinfo->dev), + devinfo->dev, w->nid); hda_command(devinfo->dev, HDA_CMD_SET_UNSOLICITED_RESPONSE(0, w->nid, HDA_CMD_SET_UNSOLICITED_RESPONSE_ENABLE | w->unsol)); From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 8 20:32:11 2012 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 B41EE106566C; Fri, 8 Jun 2012 20:32:11 +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 9F2858FC1B; Fri, 8 Jun 2012 20:32:11 +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 q58KWBFF082429; Fri, 8 Jun 2012 20:32:11 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q58KWBKu082427; Fri, 8 Jun 2012 20:32:11 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206082032.q58KWBKu082427@svn.freebsd.org> From: Alexander Motin Date: Fri, 8 Jun 2012 20:32:11 +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: r236766 - stable/8/sys/cam/ata 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, 08 Jun 2012 20:32:11 -0000 Author: mav Date: Fri Jun 8 20:32:11 2012 New Revision: 236766 URL: http://svn.freebsd.org/changeset/base/236766 Log: MFC r235982: Add tunable/sysctl kern.cam.pmp.hide_special, controlling whether special PMP ports such as PMP configuration or SEMB should be exposed or hidden. These ports were always hidden before as useless and sometimes promatic. But with updated ses driver supporting SEMB it is no longer so straight. Keep ports hidden by default to avoid probe request ttimeouts if SEP is not connected to PMP's SEMB via I2C, that is very often situation. Modified: stable/8/sys/cam/ata/ata_pmp.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/ata/ata_pmp.c ============================================================================== --- stable/8/sys/cam/ata/ata_pmp.c Fri Jun 8 20:30:37 2012 (r236765) +++ stable/8/sys/cam/ata/ata_pmp.c Fri Jun 8 20:32:11 2012 (r236766) @@ -126,8 +126,13 @@ static void pmpdone(struct cam_periph * #define PMP_DEFAULT_RETRY 1 #endif +#ifndef PMP_DEFAULT_HIDE_SPECIAL +#define PMP_DEFAULT_HIDE_SPECIAL 1 +#endif + static int pmp_retry_count = PMP_DEFAULT_RETRY; static int pmp_default_timeout = PMP_DEFAULT_TIMEOUT; +static int pmp_hide_special = PMP_DEFAULT_HIDE_SPECIAL; SYSCTL_NODE(_kern_cam, OID_AUTO, pmp, CTLFLAG_RD, 0, "CAM Direct Access Disk driver"); @@ -137,6 +142,9 @@ TUNABLE_INT("kern.cam.pmp.retry_count", SYSCTL_INT(_kern_cam_pmp, OID_AUTO, default_timeout, CTLFLAG_RW, &pmp_default_timeout, 0, "Normal I/O timeout (in seconds)"); TUNABLE_INT("kern.cam.pmp.default_timeout", &pmp_default_timeout); +SYSCTL_INT(_kern_cam_pmp, OID_AUTO, hide_special, CTLFLAG_RW, + &pmp_hide_special, 0, "Hide extra ports"); +TUNABLE_INT("kern.cam.pmp.hide_special", &pmp_hide_special); static struct periph_driver pmpdriver = { @@ -583,23 +591,33 @@ pmpdone(struct cam_periph *periph, union (ataio->res.lba_mid << 16) + (ataio->res.lba_low << 8) + ataio->res.sector_count; - /* This PMP declares 6 ports, while only 5 of them are real. - * Port 5 is enclosure management bridge port, which has implementation - * problems, causing probe faults. Hide it for now. */ - if (softc->pm_pid == 0x37261095 && softc->pm_ports == 6) - softc->pm_ports = 5; - /* This PMP declares 7 ports, while only 5 of them are real. - * Port 5 is some fake "Config Disk" with 640 sectors size, - * port 6 is enclosure management bridge port. - * Both fake ports has implementation problems, causing - * probe faults. Hide them for now. */ - if (softc->pm_pid == 0x47261095 && softc->pm_ports == 7) - softc->pm_ports = 5; - /* These PMPs declare one more port then actually have, - * for configuration purposes. Hide it for now. */ - if (softc->pm_pid == 0x57231095 || softc->pm_pid == 0x57331095 || - softc->pm_pid == 0x57341095 || softc->pm_pid == 0x57441095) - softc->pm_ports--; + if (pmp_hide_special) { + /* + * This PMP declares 6 ports, while only 5 of them + * are real. Port 5 is a SEMB port, probing which + * causes timeouts if external SEP is not connected + * to PMP over I2C. + */ + if (softc->pm_pid == 0x37261095 && softc->pm_ports == 6) + softc->pm_ports = 5; + + /* + * This PMP declares 7 ports, while only 5 of them + * are real. Port 5 is a fake "Config Disk" with + * 640 sectors size. Port 6 is a SEMB port. + */ + if (softc->pm_pid == 0x47261095 && softc->pm_ports == 7) + softc->pm_ports = 5; + + /* + * These PMPs have extra configuration port. + */ + if (softc->pm_pid == 0x57231095 || + softc->pm_pid == 0x57331095 || + softc->pm_pid == 0x57341095 || + softc->pm_pid == 0x57441095) + softc->pm_ports--; + } printf("%s%d: %d fan-out ports\n", periph->periph_name, periph->unit_number, softc->pm_ports); From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 8 20:54:06 2012 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 118AD106566B; Fri, 8 Jun 2012 20:54:06 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB9FE8FC0C; Fri, 8 Jun 2012 20:54: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 q58Ks5BW083689; Fri, 8 Jun 2012 20:54:05 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q58Ks5jR083686; Fri, 8 Jun 2012 20:54:05 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201206082054.q58Ks5jR083686@svn.freebsd.org> From: Gavin Atkinson Date: Fri, 8 Jun 2012 20:54: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: r236767 - stable/8/contrib/ipfilter/man 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, 08 Jun 2012 20:54:06 -0000 Author: gavin Date: Fri Jun 8 20:54:05 2012 New Revision: 236767 URL: http://svn.freebsd.org/changeset/base/236767 Log: Merge r215463 from head: Fix paths for example files. PR: docs/140725 Modified: stable/8/contrib/ipfilter/man/ipnat.8 stable/8/contrib/ipfilter/man/mkfilters.1 Directory Properties: stable/8/contrib/ipfilter/ (props changed) Modified: stable/8/contrib/ipfilter/man/ipnat.8 ============================================================================== --- stable/8/contrib/ipfilter/man/ipnat.8 Fri Jun 8 20:32:11 2012 (r236766) +++ stable/8/contrib/ipfilter/man/ipnat.8 Fri Jun 8 20:54:05 2012 (r236767) @@ -66,6 +66,6 @@ and active rules/table entries. .SH FILES /dev/ipnat .br -/usr/share/examples/ipf Directory with examples. +/usr/share/examples/ipfilter Directory with examples. .SH SEE ALSO ipnat(5), ipf(8), ipfstat(8) Modified: stable/8/contrib/ipfilter/man/mkfilters.1 ============================================================================== --- stable/8/contrib/ipfilter/man/mkfilters.1 Fri Jun 8 20:32:11 2012 (r236766) +++ stable/8/contrib/ipfilter/man/mkfilters.1 Fri Jun 8 20:54:05 2012 (r236767) @@ -6,7 +6,7 @@ mkfilters \- generate a minimal firewall .SH SYNOPSIS .B mkfilters .SH FILES -/usr/share/examples/ipf/mkfilters +/usr/share/examples/ipfilter/mkfilters .SH DESCRIPTION .PP \fBmkfilters\fP is a perl script that generates a minimal filter rule set for From owner-svn-src-stable-8@FreeBSD.ORG Sat Jun 9 01:42:23 2012 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 5858F106564A; Sat, 9 Jun 2012 01:42:23 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 418FF8FC14; Sat, 9 Jun 2012 01:42:23 +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 q591gNFI098725; Sat, 9 Jun 2012 01:42:23 GMT (envelope-from wblock@svn.freebsd.org) Received: (from wblock@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q591gNrv098723; Sat, 9 Jun 2012 01:42:23 GMT (envelope-from wblock@svn.freebsd.org) Message-Id: <201206090142.q591gNrv098723@svn.freebsd.org> From: Warren Block Date: Sat, 9 Jun 2012 01:42:23 +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: r236774 - stable/8/share/man/man4 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, 09 Jun 2012 01:42:23 -0000 Author: wblock (doc committer) Date: Sat Jun 9 01:42:22 2012 New Revision: 236774 URL: http://svn.freebsd.org/changeset/base/236774 Log: MFC r236122,r236595: Wording corrections and simplifications. Approved by: gjb (mentor) Modified: stable/8/share/man/man4/vlan.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/vlan.4 ============================================================================== --- stable/8/share/man/man4/vlan.4 Sat Jun 9 01:41:41 2012 (r236773) +++ stable/8/share/man/man4/vlan.4 Sat Jun 9 01:42:22 2012 (r236774) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 25, 2011 +.Dd June 4, 2012 .Dt VLAN 4 .Os .Sh NAME @@ -33,7 +33,7 @@ .Nd "IEEE 802.1Q VLAN network interface" .Sh SYNOPSIS To compile this driver into the kernel, -place the following lines in your +place the following line in your kernel configuration file: .Bd -ragged -offset indent .Cd "device vlan" @@ -79,16 +79,16 @@ to a properly configured switch port. The VLAN tag should match one of those set up in the switched network. .Pp -Initially .Nm -assumes the same minimum length for tagged and untagged frames. -This mode is selected by the +initially assumes the same minimum length for tagged and untagged frames. +This mode is selected by setting the .Xr sysctl 8 variable .Va net.link.vlan.soft_pad -set to 0 (default). -However, there are network devices that fail to adjust frame length, -should it fall below the allowed minimum due to untagging. +to 0 +.Pq default . +However, there are network devices that fail to adjust frame length +when it falls below the allowed minimum due to untagging. Such devices should be able to interoperate with .Nm after changing the value of @@ -97,7 +97,7 @@ to 1. In the latter mode, .Nm will pad short frames before tagging them -so that their length stays not less than the minimum value +so that their length is not less than the minimum value after untagging by the non-compliant devices. .Sh HARDWARE The @@ -111,7 +111,7 @@ receive and transmit long frames (up to header and FCS). The capabilities may be user-controlled by the respective parameters to .Xr ifconfig 8 , -.Cm vlanhwtag +.Cm vlanhwtag , and .Cm vlanmtu . However, a physical interface is not obliged to react to them: @@ -119,8 +119,8 @@ It may have either capability enabled pe a way to turn it off. The whole issue is very specific to a particular device and its driver. .Pp -By now, the list of physical interfaces able of full VLAN processing -in the hardware is limited to the following devices: +At present, these devices are capable of full VLAN processing +in hardware: .Xr ae 4 , .Xr age 4 , .Xr alc 4 , @@ -146,11 +146,10 @@ in the hardware is limited to the follow and .Xr vge 4 . .Pp -The rest of the Ethernet interfaces can run -VLANs using software emulation in the +Other Ethernet interfaces can run VLANs using software emulation in the .Nm driver. -However, some of them lack the capability +However, some lack the capability of transmitting and receiving long frames. Assigning such an interface as the parent to .Nm @@ -163,9 +162,8 @@ connectivity problems due to massive, in .Xr icmp 4 filtering that breaks the Path MTU Discovery mechanism. .Pp -The following interfaces support long frames for -.Nm -natively: +These interfaces natively support long frames for +.Nm : .Xr axe 4 , .Xr bfe 4 , .Xr cas 4 , @@ -198,7 +196,7 @@ for use and calculates the appropriate frame MTU based on the capabilities of the parent interface. Some other interfaces not listed above may handle long frames, -but they do not advertise this ability of theirs. +but they do not advertise this ability. The MTU setting on .Nm can be corrected manually if used in conjunction with such a parent interface. From owner-svn-src-stable-8@FreeBSD.ORG Sat Jun 9 07:22:51 2012 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 2A31C1065780; Sat, 9 Jun 2012 07:22:51 +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 0A4128FC0C; Sat, 9 Jun 2012 07:22: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 q597MoXj013743; Sat, 9 Jun 2012 07:22:50 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q597MoOc013740; Sat, 9 Jun 2012 07:22:50 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206090722.q597MoOc013740@svn.freebsd.org> From: Alexander Motin Date: Sat, 9 Jun 2012 07:22:50 +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: r236781 - in stable/8/sys/cam: ata scsi 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, 09 Jun 2012 07:22:51 -0000 Author: mav Date: Sat Jun 9 07:22:50 2012 New Revision: 236781 URL: http://svn.freebsd.org/changeset/base/236781 Log: MFC r236228: Plug request and references leak caused by race between invalidated probe periph destruction and new incoming probe request. This at least caused problems with SATA Port Multipliers hot-plug. Modified: stable/8/sys/cam/ata/ata_xpt.c stable/8/sys/cam/scsi/scsi_xpt.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/8/sys/cam/ata/ata_xpt.c Sat Jun 9 07:18:53 2012 (r236780) +++ stable/8/sys/cam/ata/ata_xpt.c Sat Jun 9 07:22:50 2012 (r236781) @@ -1220,9 +1220,9 @@ done: done_ccb->ccb_h.status = found ? CAM_REQ_CMP : CAM_REQ_CMP_ERR; xpt_done(done_ccb); } + cam_periph_invalidate(periph); cam_release_devq(periph->path, RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_XPT + 1, FALSE); - cam_periph_invalidate(periph); cam_periph_release_locked(periph); } @@ -1473,12 +1473,17 @@ ata_scan_lun(struct cam_periph *periph, } if ((old_periph = cam_periph_find(path, "aprobe")) != NULL) { - probe_softc *softc; + if ((old_periph->flags & CAM_PERIPH_INVALID) == 0) { + probe_softc *softc; - softc = (probe_softc *)old_periph->softc; - TAILQ_INSERT_TAIL(&softc->request_ccbs, &request_ccb->ccb_h, - periph_links.tqe); - softc->restart = 1; + softc = (probe_softc *)old_periph->softc; + TAILQ_INSERT_TAIL(&softc->request_ccbs, + &request_ccb->ccb_h, periph_links.tqe); + softc->restart = 1; + } else { + request_ccb->ccb_h.status = CAM_REQ_CMP_ERR; + xpt_done(request_ccb); + } } else { status = cam_periph_alloc(proberegister, NULL, probecleanup, probestart, "aprobe", Modified: stable/8/sys/cam/scsi/scsi_xpt.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_xpt.c Sat Jun 9 07:18:53 2012 (r236780) +++ stable/8/sys/cam/scsi/scsi_xpt.c Sat Jun 9 07:22:50 2012 (r236781) @@ -1609,9 +1609,9 @@ probedone(struct cam_periph *periph, uni done_ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(done_ccb); if (TAILQ_FIRST(&softc->request_ccbs) == NULL) { + cam_periph_invalidate(periph); cam_release_devq(periph->path, RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_XPT + 1, FALSE); - cam_periph_invalidate(periph); cam_periph_release_locked(periph); } else { probeschedule(periph); @@ -2177,11 +2177,16 @@ scsi_scan_lun(struct cam_periph *periph, } if ((old_periph = cam_periph_find(path, "probe")) != NULL) { - probe_softc *softc; + if ((old_periph->flags & CAM_PERIPH_INVALID) == 0) { + probe_softc *softc; - softc = (probe_softc *)old_periph->softc; - TAILQ_INSERT_TAIL(&softc->request_ccbs, &request_ccb->ccb_h, - periph_links.tqe); + softc = (probe_softc *)old_periph->softc; + TAILQ_INSERT_TAIL(&softc->request_ccbs, + &request_ccb->ccb_h, periph_links.tqe); + } else { + request_ccb->ccb_h.status = CAM_REQ_CMP_ERR; + xpt_done(request_ccb); + } } else { status = cam_periph_alloc(proberegister, NULL, probecleanup, probestart, "probe", From owner-svn-src-stable-8@FreeBSD.ORG Sat Jun 9 07:29:08 2012 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 4B740106564A; Sat, 9 Jun 2012 07:29:08 +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 1CD3E8FC15; Sat, 9 Jun 2012 07:29:08 +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 q597T78s014117; Sat, 9 Jun 2012 07:29:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q597T7ME014114; Sat, 9 Jun 2012 07:29:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206090729.q597T7ME014114@svn.freebsd.org> From: Alexander Motin Date: Sat, 9 Jun 2012 07:29:07 +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: r236783 - in stable/8/sys/cam: . ata 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, 09 Jun 2012 07:29:08 -0000 Author: mav Date: Sat Jun 9 07:29:07 2012 New Revision: 236783 URL: http://svn.freebsd.org/changeset/base/236783 Log: MFC r236234: Allow to change number of openings (used tags) for ATA/SATA devices via `camcontrol tags ... -N ...`. There is no need to tune it in usual cases, but some users want to have it for debugging purposes. Modified: stable/8/sys/cam/ata/ata_xpt.c stable/8/sys/cam/cam_xpt.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/8/sys/cam/ata/ata_xpt.c Sat Jun 9 07:28:11 2012 (r236782) +++ stable/8/sys/cam/ata/ata_xpt.c Sat Jun 9 07:29:07 2012 (r236783) @@ -65,6 +65,7 @@ struct ata_quirk_entry { struct scsi_inquiry_pattern inq_pat; u_int8_t quirks; #define CAM_QUIRK_MAXTAGS 0x01 + u_int mintags; u_int maxtags; }; @@ -149,7 +150,7 @@ static struct ata_quirk_entry ata_quirk_ T_ANY, SIP_MEDIA_REMOVABLE|SIP_MEDIA_FIXED, /*vendor*/"*", /*product*/"*", /*revision*/"*" }, - /*quirks*/0, /*maxtags*/0 + /*quirks*/0, /*mintags*/0, /*maxtags*/0 }, }; @@ -952,7 +953,8 @@ noerror: path->device->flags |= CAM_DEV_IDENTIFY_DATA_VALID; } if (ident_buf->satacapabilities & ATA_SUPPORT_NCQ) { - path->device->mintags = path->device->maxtags = + path->device->mintags = 2; + path->device->maxtags = ATA_QUEUE_LEN(ident_buf->queue) + 1; } ata_find_quirk(path->device); @@ -1248,8 +1250,10 @@ ata_find_quirk(struct cam_ed *device) quirk = (struct ata_quirk_entry *)match; device->quirk = quirk; - if (quirk->quirks & CAM_QUIRK_MAXTAGS) - device->mintags = device->maxtags = quirk->maxtags; + if (quirk->quirks & CAM_QUIRK_MAXTAGS) { + device->mintags = quirk->mintags; + device->maxtags = quirk->maxtags; + } } typedef struct { Modified: stable/8/sys/cam/cam_xpt.c ============================================================================== --- stable/8/sys/cam/cam_xpt.c Sat Jun 9 07:28:11 2012 (r236782) +++ stable/8/sys/cam/cam_xpt.c Sat Jun 9 07:29:07 2012 (r236783) @@ -2860,17 +2860,13 @@ xpt_action_default(union ccb *start_ccb) if ((crs->release_flags & RELSIM_ADJUST_OPENINGS) != 0) { - if (INQ_DATA_TQ_ENABLED(&dev->inq_data)) { - /* Don't ever go below one opening */ - if (crs->openings > 0) { - xpt_dev_ccbq_resize(path, - crs->openings); - - if (bootverbose) { - xpt_print(path, - "tagged openings now %d\n", - crs->openings); - } + /* Don't ever go below one opening */ + if (crs->openings > 0) { + xpt_dev_ccbq_resize(path, crs->openings); + if (bootverbose) { + xpt_print(path, + "number of openings is now %d\n", + crs->openings); } } } From owner-svn-src-stable-8@FreeBSD.ORG Sat Jun 9 07:36:19 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 041C6106564A; Sat, 9 Jun 2012 07:36:19 +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 D8AC88FC1A; Sat, 9 Jun 2012 07:36:18 +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 q597aIDi014562; Sat, 9 Jun 2012 07:36:18 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q597aIsv014557; Sat, 9 Jun 2012 07:36:18 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206090736.q597aIsv014557@svn.freebsd.org> From: Alexander Motin Date: Sat, 9 Jun 2012 07:36:18 +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: r236785 - in stable/8/sys/cam: . ata 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, 09 Jun 2012 07:36:19 -0000 Author: mav Date: Sat Jun 9 07:36:18 2012 New Revision: 236785 URL: http://svn.freebsd.org/changeset/base/236785 Log: MFC r236393: Use AC_GETDEV_CHANGED async to notify ada driver about DMA and NCQ status change. Now that allows switching between PIO and DMA modes on the fly. Modified: stable/8/sys/cam/ata/ata_da.c stable/8/sys/cam/ata/ata_xpt.c stable/8/sys/cam/cam_xpt.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/ata/ata_da.c ============================================================================== --- stable/8/sys/cam/ata/ata_da.c Sat Jun 9 07:31:04 2012 (r236784) +++ stable/8/sys/cam/ata/ata_da.c Sat Jun 9 07:36:18 2012 (r236785) @@ -726,6 +726,7 @@ static void adaasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg) { + struct ccb_getdev cgd; struct cam_periph *periph; struct ada_softc *softc; @@ -760,11 +761,35 @@ adaasync(void *callback_arg, u_int32_t c "due to status 0x%x\n", status); break; } + case AC_GETDEV_CHANGED: + { + softc = (struct ada_softc *)periph->softc; + xpt_setup_ccb(&cgd.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + cgd.ccb_h.func_code = XPT_GDEV_TYPE; + xpt_action((union ccb *)&cgd); + + if ((cgd.ident_data.capabilities1 & ATA_SUPPORT_DMA) && + (cgd.inq_flags & SID_DMA)) + softc->flags |= ADA_FLAG_CAN_DMA; + else + softc->flags &= ~ADA_FLAG_CAN_DMA; + if ((cgd.ident_data.satacapabilities & ATA_SUPPORT_NCQ) && + (cgd.inq_flags & SID_DMA) && (cgd.inq_flags & SID_CmdQue)) + softc->flags |= ADA_FLAG_CAN_NCQ; + else + softc->flags &= ~ADA_FLAG_CAN_NCQ; + if ((cgd.ident_data.support_dsm & ATA_SUPPORT_DSM_TRIM) && + (cgd.inq_flags & SID_DMA)) + softc->flags |= ADA_FLAG_CAN_TRIM; + else + softc->flags &= ~ADA_FLAG_CAN_TRIM; + + cam_periph_async(periph, code, path, arg); + break; + } case AC_SENT_BDR: case AC_BUS_RESET: { - struct ccb_getdev cgd; - softc = (struct ada_softc *)periph->softc; cam_periph_async(periph, code, path, arg); if (softc->state != ADA_STATE_NORMAL) @@ -884,7 +909,7 @@ adaregister(struct cam_periph *periph, v bioq_init(&softc->bio_queue); bioq_init(&softc->trim_queue); - if (cgd->ident_data.capabilities1 & ATA_SUPPORT_DMA && + if ((cgd->ident_data.capabilities1 & ATA_SUPPORT_DMA) && (cgd->inq_flags & SID_DMA)) softc->flags |= ADA_FLAG_CAN_DMA; if (cgd->ident_data.support.command2 & ATA_SUPPORT_ADDRESS48) @@ -893,10 +918,11 @@ adaregister(struct cam_periph *periph, v softc->flags |= ADA_FLAG_CAN_FLUSHCACHE; if (cgd->ident_data.support.command1 & ATA_SUPPORT_POWERMGT) softc->flags |= ADA_FLAG_CAN_POWERMGT; - if (cgd->ident_data.satacapabilities & ATA_SUPPORT_NCQ && + if ((cgd->ident_data.satacapabilities & ATA_SUPPORT_NCQ) && (cgd->inq_flags & SID_DMA) && (cgd->inq_flags & SID_CmdQue)) softc->flags |= ADA_FLAG_CAN_NCQ; - if (cgd->ident_data.support_dsm & ATA_SUPPORT_DSM_TRIM) { + if ((cgd->ident_data.support_dsm & ATA_SUPPORT_DSM_TRIM) && + (cgd->inq_flags & SID_DMA)) { softc->flags |= ADA_FLAG_CAN_TRIM; softc->trim_max_ranges = TRIM_MAX_RANGES; if (cgd->ident_data.max_dsm_blocks != 0) { @@ -1048,8 +1074,9 @@ adaregister(struct cam_periph *periph, v * them and the only alternative would be to * not attach the device on failure. */ - xpt_register_async(AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE, - adaasync, periph, periph->path); + xpt_register_async(AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE | + AC_GETDEV_CHANGED, + adaasync, periph, periph->path); /* * Schedule a periodic event to occasionally send an Modified: stable/8/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/8/sys/cam/ata/ata_xpt.c Sat Jun 9 07:31:04 2012 (r236784) +++ stable/8/sys/cam/ata/ata_xpt.c Sat Jun 9 07:36:18 2012 (r236785) @@ -407,6 +407,7 @@ negotiate: path->device->inq_flags &= ~SID_DMA; else path->device->inq_flags |= SID_DMA; + xpt_async(AC_GETDEV_CHANGED, path, NULL); cam_fill_ataio(ataio, 1, probedone, @@ -951,6 +952,7 @@ noerror: } path->device->flags |= CAM_DEV_IDENTIFY_DATA_VALID; + xpt_async(AC_GETDEV_CHANGED, path, NULL); } if (ident_buf->satacapabilities & ATA_SUPPORT_NCQ) { path->device->mintags = 2; Modified: stable/8/sys/cam/cam_xpt.c ============================================================================== --- stable/8/sys/cam/cam_xpt.c Sat Jun 9 07:31:04 2012 (r236784) +++ stable/8/sys/cam/cam_xpt.c Sat Jun 9 07:36:18 2012 (r236785) @@ -4621,6 +4621,7 @@ xpt_start_tags(struct cam_path *path) newopenings = min(device->maxtags, sim->max_tagged_dev_openings); xpt_dev_ccbq_resize(path, newopenings); + xpt_async(AC_GETDEV_CHANGED, path, NULL); xpt_setup_ccb(&crs.ccb_h, path, CAM_PRIORITY_NORMAL); crs.ccb_h.func_code = XPT_REL_SIMQ; crs.release_flags = RELSIM_RELEASE_AFTER_QEMPTY; @@ -4645,6 +4646,7 @@ xpt_stop_tags(struct cam_path *path) xpt_freeze_devq(path, /*count*/1); device->inq_flags &= ~SID_CmdQue; xpt_dev_ccbq_resize(path, sim->max_dev_openings); + xpt_async(AC_GETDEV_CHANGED, path, NULL); xpt_setup_ccb(&crs.ccb_h, path, CAM_PRIORITY_NORMAL); crs.ccb_h.func_code = XPT_REL_SIMQ; crs.release_flags = RELSIM_RELEASE_AFTER_QEMPTY; From owner-svn-src-stable-8@FreeBSD.ORG Sat Jun 9 07:44:51 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C57D71065672; Sat, 9 Jun 2012 07:44:51 +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 AEB488FC15; Sat, 9 Jun 2012 07:44: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 q597ipUX015051; Sat, 9 Jun 2012 07:44:51 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q597ipFp015046; Sat, 9 Jun 2012 07:44:51 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206090744.q597ipFp015046@svn.freebsd.org> From: Alexander Motin Date: Sat, 9 Jun 2012 07:44: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: r236787 - in stable/8: sbin/camcontrol sys/cam sys/cam/ata 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, 09 Jun 2012 07:44:51 -0000 Author: mav Date: Sat Jun 9 07:44:51 2012 New Revision: 236787 URL: http://svn.freebsd.org/changeset/base/236787 Log: MFC r236437: Rewrite enabling NCQ for SATA devices in a way more alike to SCSI TCQ. This allows to control it with `camcontrol negotiate adaX -T (en|dis)able` on the fly, same as for SCSI devices. Sponsored by: iXsystems, Inc. Modified: stable/8/sbin/camcontrol/camcontrol.c stable/8/sys/cam/ata/ata_xpt.c stable/8/sys/cam/cam_ccb.h stable/8/sys/cam/cam_xpt.c Directory Properties: stable/8/sbin/camcontrol/ (props changed) stable/8/sys/ (props changed) Modified: stable/8/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/8/sbin/camcontrol/camcontrol.c Sat Jun 9 07:43:11 2012 (r236786) +++ stable/8/sbin/camcontrol/camcontrol.c Sat Jun 9 07:44:51 2012 (r236787) @@ -957,11 +957,11 @@ camxferrate(struct cam_device *device) if (sas->valid & CTS_SAS_VALID_SPEED) speed = sas->bitrate; } else if (ccb->cts.transport == XPORT_ATA) { - struct ccb_trans_settings_ata *ata = + struct ccb_trans_settings_pata *pata = &ccb->cts.xport_specific.ata; - if (ata->valid & CTS_ATA_VALID_MODE) - speed = ata_mode2speed(ata->mode); + if (pata->valid & CTS_ATA_VALID_MODE) + speed = ata_mode2speed(pata->mode); } else if (ccb->cts.transport == XPORT_SATA) { struct ccb_trans_settings_sata *sata = &ccb->cts.xport_specific.sata; @@ -1004,16 +1004,16 @@ camxferrate(struct cam_device *device) fprintf(stdout, ")"); } } else if (ccb->cts.transport == XPORT_ATA) { - struct ccb_trans_settings_ata *ata = + struct ccb_trans_settings_pata *pata = &ccb->cts.xport_specific.ata; printf(" ("); - if (ata->valid & CTS_ATA_VALID_MODE) - printf("%s, ", ata_mode2string(ata->mode)); - if ((ata->valid & CTS_ATA_VALID_ATAPI) && ata->atapi != 0) - printf("ATAPI %dbytes, ", ata->atapi); - if (ata->valid & CTS_ATA_VALID_BYTECOUNT) - printf("PIO %dbytes", ata->bytecount); + if (pata->valid & CTS_ATA_VALID_MODE) + printf("%s, ", ata_mode2string(pata->mode)); + if ((pata->valid & CTS_ATA_VALID_ATAPI) && pata->atapi != 0) + printf("ATAPI %dbytes, ", pata->atapi); + if (pata->valid & CTS_ATA_VALID_BYTECOUNT) + printf("PIO %dbytes", pata->bytecount); printf(")"); } else if (ccb->cts.transport == XPORT_SATA) { struct ccb_trans_settings_sata *sata = @@ -2818,21 +2818,45 @@ cts_print(struct cam_device *device, str "enabled" : "disabled"); } } + if (cts->transport == XPORT_FC) { + struct ccb_trans_settings_fc *fc = + &cts->xport_specific.fc; + + if (fc->valid & CTS_FC_VALID_WWNN) + fprintf(stdout, "%sWWNN: 0x%llx", pathstr, + (long long) fc->wwnn); + if (fc->valid & CTS_FC_VALID_WWPN) + fprintf(stdout, "%sWWPN: 0x%llx", pathstr, + (long long) fc->wwpn); + if (fc->valid & CTS_FC_VALID_PORT) + fprintf(stdout, "%sPortID: 0x%x", pathstr, fc->port); + if (fc->valid & CTS_FC_VALID_SPEED) + fprintf(stdout, "%stransfer speed: %d.%03dMB/s\n", + pathstr, fc->bitrate / 1000, fc->bitrate % 1000); + } + if (cts->transport == XPORT_SAS) { + struct ccb_trans_settings_sas *sas = + &cts->xport_specific.sas; + + if (sas->valid & CTS_SAS_VALID_SPEED) + fprintf(stdout, "%stransfer speed: %d.%03dMB/s\n", + pathstr, sas->bitrate / 1000, sas->bitrate % 1000); + } if (cts->transport == XPORT_ATA) { - struct ccb_trans_settings_ata *ata = + struct ccb_trans_settings_pata *pata = &cts->xport_specific.ata; - if ((ata->valid & CTS_ATA_VALID_MODE) != 0) { + if ((pata->valid & CTS_ATA_VALID_MODE) != 0) { fprintf(stdout, "%sATA mode: %s\n", pathstr, - ata_mode2string(ata->mode)); + ata_mode2string(pata->mode)); } - if ((ata->valid & CTS_ATA_VALID_ATAPI) != 0) { + if ((pata->valid & CTS_ATA_VALID_ATAPI) != 0) { fprintf(stdout, "%sATAPI packet length: %d\n", pathstr, - ata->atapi); + pata->atapi); } - if ((ata->valid & CTS_ATA_VALID_BYTECOUNT) != 0) { + if ((pata->valid & CTS_ATA_VALID_BYTECOUNT) != 0) { fprintf(stdout, "%sPIO transaction length: %d\n", - pathstr, ata->bytecount); + pathstr, pata->bytecount); } } if (cts->transport == XPORT_SATA) { @@ -2868,12 +2892,22 @@ cts_print(struct cam_device *device, str sata->caps); } } + if (cts->protocol == PROTO_ATA) { + struct ccb_trans_settings_ata *ata= + &cts->proto_specific.ata; + + if (ata->valid & CTS_ATA_VALID_TQ) { + fprintf(stdout, "%stagged queueing: %s\n", pathstr, + (ata->flags & CTS_ATA_FLAGS_TAG_ENB) ? + "enabled" : "disabled"); + } + } if (cts->protocol == PROTO_SCSI) { struct ccb_trans_settings_scsi *scsi= &cts->proto_specific.scsi; if (scsi->valid & CTS_SCSI_VALID_TQ) { - fprintf(stdout, "%stagged queueing is %s\n", pathstr, + fprintf(stdout, "%stagged queueing: %s\n", pathstr, (scsi->flags & CTS_SCSI_FLAGS_TAG_ENB) ? "enabled" : "disabled"); } @@ -3301,16 +3335,19 @@ ratecontrol(struct cam_device *device, i if (change_settings) { int didsettings = 0; struct ccb_trans_settings_spi *spi = NULL; - struct ccb_trans_settings_ata *ata = NULL; + struct ccb_trans_settings_pata *pata = NULL; struct ccb_trans_settings_sata *sata = NULL; + struct ccb_trans_settings_ata *ata = NULL; struct ccb_trans_settings_scsi *scsi = NULL; if (ccb->cts.transport == XPORT_SPI) spi = &ccb->cts.xport_specific.spi; if (ccb->cts.transport == XPORT_ATA) - ata = &ccb->cts.xport_specific.ata; + pata = &ccb->cts.xport_specific.ata; if (ccb->cts.transport == XPORT_SATA) sata = &ccb->cts.xport_specific.sata; + if (ccb->cts.protocol == PROTO_ATA) + ata = &ccb->cts.proto_specific.ata; if (ccb->cts.protocol == PROTO_SCSI) scsi = &ccb->cts.proto_specific.scsi; ccb->cts.xport_specific.valid = 0; @@ -3323,19 +3360,28 @@ ratecontrol(struct cam_device *device, i spi->flags |= CTS_SPI_FLAGS_DISC_ENB; didsettings++; } - if (scsi && tag_enable != -1) { + if (tag_enable != -1) { if ((cpi.hba_inquiry & PI_TAG_ABLE) == 0) { warnx("HBA does not support tagged queueing, " "so you cannot modify tag settings"); retval = 1; goto ratecontrol_bailout; } - scsi->valid |= CTS_SCSI_VALID_TQ; - if (tag_enable == 0) - scsi->flags &= ~CTS_SCSI_FLAGS_TAG_ENB; - else - scsi->flags |= CTS_SCSI_FLAGS_TAG_ENB; - didsettings++; + if (ata) { + ata->valid |= CTS_SCSI_VALID_TQ; + if (tag_enable == 0) + ata->flags &= ~CTS_ATA_FLAGS_TAG_ENB; + else + ata->flags |= CTS_ATA_FLAGS_TAG_ENB; + didsettings++; + } else if (scsi) { + scsi->valid |= CTS_SCSI_VALID_TQ; + if (tag_enable == 0) + scsi->flags &= ~CTS_SCSI_FLAGS_TAG_ENB; + else + scsi->flags |= CTS_SCSI_FLAGS_TAG_ENB; + didsettings++; + } } if (spi && offset != -1) { if ((cpi.hba_inquiry & PI_SDTR_ABLE) == 0) { @@ -3384,6 +3430,12 @@ ratecontrol(struct cam_device *device, i retval = 1; goto ratecontrol_bailout; } + if (!user_settings) { + warnx("You can modify only user rate " + "settings for SATA"); + retval = 1; + goto ratecontrol_bailout; + } sata->revision = ata_speed2revision(syncrate * 100); if (sata->revision < 0) { warnx("Invalid rate %f", syncrate); @@ -3393,16 +3445,22 @@ ratecontrol(struct cam_device *device, i sata->valid |= CTS_SATA_VALID_REVISION; didsettings++; } - if ((ata || sata) && mode != -1) { + if ((pata || sata) && mode != -1) { if ((cpi.hba_inquiry & PI_SDTR_ABLE) == 0) { warnx("HBA is not capable of changing " "transfer rates"); retval = 1; goto ratecontrol_bailout; } - if (ata) { - ata->mode = mode; - ata->valid |= CTS_ATA_VALID_MODE; + if (!user_settings) { + warnx("You can modify only user mode " + "settings for ATA/SATA"); + retval = 1; + goto ratecontrol_bailout; + } + if (pata) { + pata->mode = mode; + pata->valid |= CTS_ATA_VALID_MODE; } else { sata->mode = mode; sata->valid |= CTS_SATA_VALID_MODE; @@ -3449,11 +3507,6 @@ ratecontrol(struct cam_device *device, i if (didsettings == 0) { goto ratecontrol_bailout; } - if (!user_settings && (ata || sata)) { - warnx("You can modify only user settings for ATA/SATA"); - retval = 1; - goto ratecontrol_bailout; - } ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS; if (cam_send_ccb(device, ccb) < 0) { perror("error sending XPT_SET_TRAN_SETTINGS CCB"); @@ -3485,13 +3538,10 @@ ratecontrol(struct cam_device *device, i fprintf(stderr, "Test Unit Ready failed\n"); goto ratecontrol_bailout; } - /* - * If the user wants things quiet, there's no sense in - * getting the transfer settings, if we're not going - * to print them. - */ - if (quiet != 0) - goto ratecontrol_bailout; + } + if ((change_settings || send_tur) && !quiet && + (ccb->cts.transport == XPORT_ATA || + ccb->cts.transport == XPORT_SATA || send_tur)) { fprintf(stdout, "New parameters:\n"); retval = get_print_cts(device, user_settings, 0, NULL); } Modified: stable/8/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/8/sys/cam/ata/ata_xpt.c Sat Jun 9 07:43:11 2012 (r236786) +++ stable/8/sys/cam/ata/ata_xpt.c Sat Jun 9 07:44:51 2012 (r236787) @@ -161,7 +161,7 @@ static cam_status proberegister(struct c void *arg); static void probeschedule(struct cam_periph *probe_periph); static void probestart(struct cam_periph *periph, union ccb *start_ccb); -//static void proberequestdefaultnegotiation(struct cam_periph *periph); +static void proberequestdefaultnegotiation(struct cam_periph *periph); //static int proberequestbackoff(struct cam_periph *periph, // struct cam_ed *device); static void probedone(struct cam_periph *periph, union ccb *done_ccb); @@ -176,6 +176,7 @@ static struct cam_ed * ata_alloc_device(struct cam_eb *bus, struct cam_et *target, lun_id_t lun_id); static void ata_device_transport(struct cam_path *path); +static void ata_get_transfer_settings(struct ccb_trans_settings *cts); static void ata_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_ed *device, int async_update); @@ -632,7 +633,7 @@ negotiate: } xpt_action(start_ccb); } -#if 0 + static void proberequestdefaultnegotiation(struct cam_periph *periph) { @@ -642,14 +643,15 @@ proberequestdefaultnegotiation(struct ca cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_USER_SETTINGS; xpt_action((union ccb *)&cts); - if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) return; - } + cts.xport_specific.valid = 0; cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; xpt_action((union ccb *)&cts); } +#if 0 /* * Backoff Negotiation Code- only pertinent for SPI devices. */ @@ -977,10 +979,10 @@ noerror: cts.xport_specific.sata.tags = path->device->maxtags; cts.xport_specific.sata.valid = CTS_SATA_VALID_TAGS; xpt_action((union ccb *)&cts); - /* Reconfigure queues for tagged queueing. */ - xpt_start_tags(path); } } + if (changed) + proberequestdefaultnegotiation(periph); ata_device_transport(path); PROBE_SET_ACTION(softc, PROBE_SETMODE); xpt_release_ccb(done_ccb); @@ -1647,10 +1649,7 @@ ata_action(union ccb *start_ccb) break; case XPT_GET_TRAN_SETTINGS: { - struct cam_sim *sim; - - sim = start_ccb->ccb_h.path->bus->sim; - (*(sim->sim_action))(sim, start_ccb); + ata_get_transfer_settings(&start_ccb->cts); break; } case XPT_SCSI_IO: @@ -1683,14 +1682,48 @@ ata_action(union ccb *start_ccb) } static void +ata_get_transfer_settings(struct ccb_trans_settings *cts) +{ + struct ccb_trans_settings_ata *ata; + struct ccb_trans_settings_scsi *scsi; + struct cam_ed *device; + struct cam_sim *sim; + + device = cts->ccb_h.path->device; + sim = cts->ccb_h.path->bus->sim; + (*(sim->sim_action))(sim, (union ccb *)cts); + + if (cts->protocol == PROTO_ATA) { + ata = &cts->proto_specific.ata; + if ((ata->valid & CTS_ATA_VALID_TQ) == 0) { + ata->valid |= CTS_ATA_VALID_TQ; + if (cts->type == CTS_TYPE_USER_SETTINGS || + (device->flags & CAM_DEV_TAG_AFTER_COUNT) != 0 || + (device->inq_flags & SID_CmdQue) != 0) + ata->flags |= CTS_ATA_FLAGS_TAG_ENB; + } + } + if (cts->protocol == PROTO_SCSI) { + scsi = &cts->proto_specific.scsi; + if ((scsi->valid & CTS_SCSI_VALID_TQ) == 0) { + scsi->valid |= CTS_SCSI_VALID_TQ; + if (cts->type == CTS_TYPE_USER_SETTINGS || + (device->flags & CAM_DEV_TAG_AFTER_COUNT) != 0 || + (device->inq_flags & SID_CmdQue) != 0) + scsi->flags |= CTS_SCSI_FLAGS_TAG_ENB; + } + } +} + +static void ata_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_ed *device, int async_update) { struct ccb_pathinq cpi; - struct ccb_trans_settings cur_cts; + struct ccb_trans_settings_ata *ata; struct ccb_trans_settings_scsi *scsi; - struct ccb_trans_settings_scsi *cur_scsi; struct cam_sim *sim; + struct ata_params *ident_data; struct scsi_inquiry_data *inq_data; if (device == NULL) { @@ -1750,95 +1783,63 @@ ata_set_transfer_settings(struct ccb_tra } sim = cts->ccb_h.path->bus->sim; - - /* - * Nothing more of interest to do unless - * this is a device connected via the - * SCSI protocol. - */ - if (cts->protocol != PROTO_SCSI) { - if (async_update == FALSE) - (*(sim->sim_action))(sim, (union ccb *)cts); - return; - } - + ident_data = &device->ident_data; inq_data = &device->inq_data; - scsi = &cts->proto_specific.scsi; + if (cts->protocol == PROTO_ATA) + ata = &cts->proto_specific.ata; + else + ata = NULL; + if (cts->protocol == PROTO_SCSI) + scsi = &cts->proto_specific.scsi; + else + scsi = NULL; xpt_setup_ccb(&cpi.ccb_h, cts->ccb_h.path, CAM_PRIORITY_NONE); cpi.ccb_h.func_code = XPT_PATH_INQ; xpt_action((union ccb *)&cpi); - /* SCSI specific sanity checking */ + /* Sanity checking */ if ((cpi.hba_inquiry & PI_TAG_ABLE) == 0 - || (INQ_DATA_TQ_ENABLED(inq_data)) == 0 + || (ata && (ident_data->satacapabilities & ATA_SUPPORT_NCQ) == 0) + || (scsi && (INQ_DATA_TQ_ENABLED(inq_data)) == 0) || (device->queue_flags & SCP_QUEUE_DQUE) != 0 || (device->mintags == 0)) { /* * Can't tag on hardware that doesn't support tags, * doesn't have it enabled, or has broken tag support. */ - scsi->flags &= ~CTS_SCSI_FLAGS_TAG_ENB; - } - - if (async_update == FALSE) { - /* - * Perform sanity checking against what the - * controller and device can do. - */ - xpt_setup_ccb(&cur_cts.ccb_h, cts->ccb_h.path, CAM_PRIORITY_NONE); - cur_cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; - cur_cts.type = cts->type; - xpt_action((union ccb *)&cur_cts); - if ((cur_cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - return; - } - cur_scsi = &cur_cts.proto_specific.scsi; - if ((scsi->valid & CTS_SCSI_VALID_TQ) == 0) { - scsi->flags &= ~CTS_SCSI_FLAGS_TAG_ENB; - scsi->flags |= cur_scsi->flags & CTS_SCSI_FLAGS_TAG_ENB; - } - if ((cur_scsi->valid & CTS_SCSI_VALID_TQ) == 0) + if (ata) + ata->flags &= ~CTS_ATA_FLAGS_TAG_ENB; + if (scsi) scsi->flags &= ~CTS_SCSI_FLAGS_TAG_ENB; } - if (cts->type == CTS_TYPE_CURRENT_SETTINGS - && (scsi->valid & CTS_SCSI_VALID_TQ) != 0) { - int device_tagenb; - - /* - * If we are transitioning from tags to no-tags or - * vice-versa, we need to carefully freeze and restart - * the queue so that we don't overlap tagged and non-tagged - * commands. We also temporarily stop tags if there is - * a change in transfer negotiation settings to allow - * "tag-less" negotiation. - */ - if ((device->flags & CAM_DEV_TAG_AFTER_COUNT) != 0 - || (device->inq_flags & SID_CmdQue) != 0) - device_tagenb = TRUE; - else - device_tagenb = FALSE; + /* Start/stop tags use. */ + if (cts->type == CTS_TYPE_CURRENT_SETTINGS && + ((ata && (ata->valid & CTS_ATA_VALID_TQ) != 0) || + (scsi && (scsi->valid & CTS_SCSI_VALID_TQ) != 0))) { + int nowt, newt = 0; + + nowt = ((device->flags & CAM_DEV_TAG_AFTER_COUNT) != 0 || + (device->inq_flags & SID_CmdQue) != 0); + if (ata) + newt = (ata->flags & CTS_ATA_FLAGS_TAG_ENB) != 0; + if (scsi) + newt = (scsi->flags & CTS_SCSI_FLAGS_TAG_ENB) != 0; - if (((scsi->flags & CTS_SCSI_FLAGS_TAG_ENB) != 0 - && device_tagenb == FALSE) - || ((scsi->flags & CTS_SCSI_FLAGS_TAG_ENB) == 0 - && device_tagenb == TRUE)) { - - if ((scsi->flags & CTS_SCSI_FLAGS_TAG_ENB) != 0) { - /* - * Delay change to use tags until after a - * few commands have gone to this device so - * the controller has time to perform transfer - * negotiations without tagged messages getting - * in the way. - */ - device->tag_delay_count = CAM_TAG_DELAY_COUNT; - device->flags |= CAM_DEV_TAG_AFTER_COUNT; - } else { - xpt_stop_tags(cts->ccb_h.path); - } - } + if (newt && !nowt) { + /* + * Delay change to use tags until after a + * few commands have gone to this device so + * the controller has time to perform transfer + * negotiations without tagged messages getting + * in the way. + */ + device->tag_delay_count = CAM_TAG_DELAY_COUNT; + device->flags |= CAM_DEV_TAG_AFTER_COUNT; + } else if (nowt && !newt) + xpt_stop_tags(cts->ccb_h.path); } + if (async_update == FALSE) (*(sim->sim_action))(sim, (union ccb *)cts); } @@ -1928,11 +1929,11 @@ ata_announce_periph(struct cam_periph *p /* Report connection speed */ speed = cpi.base_transfer_speed; if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_ATA) { - struct ccb_trans_settings_ata *ata = + struct ccb_trans_settings_pata *pata = &cts.xport_specific.ata; - if (ata->valid & CTS_ATA_VALID_MODE) - speed = ata_mode2speed(ata->mode); + if (pata->valid & CTS_ATA_VALID_MODE) + speed = ata_mode2speed(pata->mode); } if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_SATA) { struct ccb_trans_settings_sata *sata = @@ -1951,16 +1952,16 @@ ata_announce_periph(struct cam_periph *p periph->unit_number, speed); /* Report additional information about connection */ if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_ATA) { - struct ccb_trans_settings_ata *ata = + struct ccb_trans_settings_pata *pata = &cts.xport_specific.ata; printf(" ("); - if (ata->valid & CTS_ATA_VALID_MODE) - printf("%s, ", ata_mode2string(ata->mode)); - if ((ata->valid & CTS_ATA_VALID_ATAPI) && ata->atapi != 0) - printf("ATAPI %dbytes, ", ata->atapi); - if (ata->valid & CTS_ATA_VALID_BYTECOUNT) - printf("PIO %dbytes", ata->bytecount); + if (pata->valid & CTS_ATA_VALID_MODE) + printf("%s, ", ata_mode2string(pata->mode)); + if ((pata->valid & CTS_ATA_VALID_ATAPI) && pata->atapi != 0) + printf("ATAPI %dbytes, ", pata->atapi); + if (pata->valid & CTS_ATA_VALID_BYTECOUNT) + printf("PIO %dbytes", pata->bytecount); printf(")"); } if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_SATA) { Modified: stable/8/sys/cam/cam_ccb.h ============================================================================== --- stable/8/sys/cam/cam_ccb.h Sat Jun 9 07:43:11 2012 (r236786) +++ stable/8/sys/cam/cam_ccb.h Sat Jun 9 07:44:51 2012 (r236787) @@ -798,6 +798,14 @@ struct ccb_trans_settings_scsi #define CTS_SCSI_FLAGS_TAG_ENB 0x01 }; +struct ccb_trans_settings_ata +{ + u_int valid; /* Which fields to honor */ +#define CTS_ATA_VALID_TQ 0x01 + u_int flags; +#define CTS_ATA_FLAGS_TAG_ENB 0x01 +}; + struct ccb_trans_settings_spi { u_int valid; /* Which fields to honor */ @@ -832,7 +840,7 @@ struct ccb_trans_settings_sas { u_int32_t bitrate; /* Mbps */ }; -struct ccb_trans_settings_ata { +struct ccb_trans_settings_pata { u_int valid; /* Which fields to honor */ #define CTS_ATA_VALID_MODE 0x01 #define CTS_ATA_VALID_BYTECOUNT 0x02 @@ -878,6 +886,7 @@ struct ccb_trans_settings { u_int transport_version; union { u_int valid; /* Which fields to honor */ + struct ccb_trans_settings_ata ata; struct ccb_trans_settings_scsi scsi; } proto_specific; union { @@ -885,7 +894,7 @@ struct ccb_trans_settings { struct ccb_trans_settings_spi spi; struct ccb_trans_settings_fc fc; struct ccb_trans_settings_sas sas; - struct ccb_trans_settings_ata ata; + struct ccb_trans_settings_pata ata; struct ccb_trans_settings_sata sata; } xport_specific; }; Modified: stable/8/sys/cam/cam_xpt.c ============================================================================== --- stable/8/sys/cam/cam_xpt.c Sat Jun 9 07:43:11 2012 (r236786) +++ stable/8/sys/cam/cam_xpt.c Sat Jun 9 07:44:51 2012 (r236787) @@ -4967,10 +4967,16 @@ camisr_runqueue(void *V_queue) ccb_h->path->bus->sim->devq->send_openings++; runq = TRUE; - if (((dev->flags & CAM_DEV_REL_ON_COMPLETE) != 0 - && (ccb_h->status&CAM_STATUS_MASK) != CAM_REQUEUE_REQ) - || ((dev->flags & CAM_DEV_REL_ON_QUEUE_EMPTY) != 0 + if (((dev->flags & CAM_DEV_REL_ON_QUEUE_EMPTY) != 0 && (dev->ccbq.dev_active == 0))) { + dev->flags &= ~CAM_DEV_REL_ON_QUEUE_EMPTY; + xpt_release_devq(ccb_h->path, /*count*/1, + /*run_queue*/FALSE); + } + + if (((dev->flags & CAM_DEV_REL_ON_COMPLETE) != 0 + && (ccb_h->status&CAM_STATUS_MASK) != CAM_REQUEUE_REQ)) { + dev->flags &= ~CAM_DEV_REL_ON_COMPLETE; xpt_release_devq(ccb_h->path, /*count*/1, /*run_queue*/FALSE); } From owner-svn-src-stable-8@FreeBSD.ORG Sat Jun 9 07:49:10 2012 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 56BF21065670; Sat, 9 Jun 2012 07:49:10 +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 411B48FC21; Sat, 9 Jun 2012 07:49:10 +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 q597nAEe015336; Sat, 9 Jun 2012 07:49:10 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q597nA0q015334; Sat, 9 Jun 2012 07:49:10 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206090749.q597nA0q015334@svn.freebsd.org> From: Alexander Motin Date: Sat, 9 Jun 2012 07:49:10 +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: r236789 - stable/8/sys/cam/ata 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, 09 Jun 2012 07:49:10 -0000 Author: mav Date: Sat Jun 9 07:49:09 2012 New Revision: 236789 URL: http://svn.freebsd.org/changeset/base/236789 Log: MFC r236552: Remove some dead code that I doubt will ever be implemented. Modified: stable/8/sys/cam/ata/ata_xpt.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/8/sys/cam/ata/ata_xpt.c Sat Jun 9 07:48:08 2012 (r236788) +++ stable/8/sys/cam/ata/ata_xpt.c Sat Jun 9 07:49:09 2012 (r236789) @@ -162,8 +162,6 @@ static cam_status proberegister(struct c static void probeschedule(struct cam_periph *probe_periph); static void probestart(struct cam_periph *periph, union ccb *start_ccb); static void proberequestdefaultnegotiation(struct cam_periph *periph); -//static int proberequestbackoff(struct cam_periph *periph, -// struct cam_ed *device); static void probedone(struct cam_periph *periph, union ccb *done_ccb); static void probecleanup(struct cam_periph *periph); static void ata_find_quirk(struct cam_ed *device); @@ -651,112 +649,6 @@ proberequestdefaultnegotiation(struct ca xpt_action((union ccb *)&cts); } -#if 0 -/* - * Backoff Negotiation Code- only pertinent for SPI devices. - */ -static int -proberequestbackoff(struct cam_periph *periph, struct cam_ed *device) -{ - struct ccb_trans_settings cts; - struct ccb_trans_settings_spi *spi; - - memset(&cts, 0, sizeof (cts)); - xpt_setup_ccb(&cts.ccb_h, periph->path, CAM_PRIORITY_NONE); - cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; - cts.type = CTS_TYPE_CURRENT_SETTINGS; - xpt_action((union ccb *)&cts); - if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - if (bootverbose) { - xpt_print(periph->path, - "failed to get current device settings\n"); - } - return (0); - } - if (cts.transport != XPORT_SPI) { - if (bootverbose) { - xpt_print(periph->path, "not SPI transport\n"); - } - return (0); - } - spi = &cts.xport_specific.spi; - - /* - * We cannot renegotiate sync rate if we don't have one. - */ - if ((spi->valid & CTS_SPI_VALID_SYNC_RATE) == 0) { - if (bootverbose) { - xpt_print(periph->path, "no sync rate known\n"); - } - return (0); - } - - /* - * We'll assert that we don't have to touch PPR options- the - * SIM will see what we do with period and offset and adjust - * the PPR options as appropriate. - */ - - /* - * A sync rate with unknown or zero offset is nonsensical. - * A sync period of zero means Async. - */ - if ((spi->valid & CTS_SPI_VALID_SYNC_OFFSET) == 0 - || spi->sync_offset == 0 || spi->sync_period == 0) { - if (bootverbose) { - xpt_print(periph->path, "no sync rate available\n"); - } - return (0); - } - - if (device->flags & CAM_DEV_DV_HIT_BOTTOM) { - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, - ("hit async: giving up on DV\n")); - return (0); - } - - - /* - * Jump sync_period up by one, but stop at 5MHz and fall back to Async. - * We don't try to remember 'last' settings to see if the SIM actually - * gets into the speed we want to set. We check on the SIM telling - * us that a requested speed is bad, but otherwise don't try and - * check the speed due to the asynchronous and handshake nature - * of speed setting. - */ - spi->valid = CTS_SPI_VALID_SYNC_RATE | CTS_SPI_VALID_SYNC_OFFSET; - for (;;) { - spi->sync_period++; - if (spi->sync_period >= 0xf) { - spi->sync_period = 0; - spi->sync_offset = 0; - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, - ("setting to async for DV\n")); - /* - * Once we hit async, we don't want to try - * any more settings. - */ - device->flags |= CAM_DEV_DV_HIT_BOTTOM; - } else if (bootverbose) { - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, - ("DV: period 0x%x\n", spi->sync_period)); - printf("setting period to 0x%x\n", spi->sync_period); - } - cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; - cts.type = CTS_TYPE_CURRENT_SETTINGS; - xpt_action((union ccb *)&cts); - if ((cts.ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { - break; - } - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, - ("DV: failed to set period 0x%x\n", spi->sync_period)); - if (spi->sync_period == 0) { - return (0); - } - } - return (1); -} -#endif static void probedone(struct cam_periph *periph, union ccb *done_ccb) { From owner-svn-src-stable-8@FreeBSD.ORG Sat Jun 9 07:57:53 2012 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 2F52A1065670; Sat, 9 Jun 2012 07:57:53 +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 18F4C8FC1F; Sat, 9 Jun 2012 07:57:53 +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 q597vqfL015839; Sat, 9 Jun 2012 07:57:52 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q597vqec015833; Sat, 9 Jun 2012 07:57:52 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206090757.q597vqec015833@svn.freebsd.org> From: Alexander Motin Date: Sat, 9 Jun 2012 07:57:52 +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: r236791 - in stable/8/sys: cam/ata dev/ahci dev/ata dev/mvs dev/siis 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, 09 Jun 2012 07:57:53 -0000 Author: mav Date: Sat Jun 9 07:57:52 2012 New Revision: 236791 URL: http://svn.freebsd.org/changeset/base/236791 Log: r236666: ATA/SATA controllers have no idea about protocol of the connected device until transport will do some probe actions (at least soft reset). Make ATA/SATA SIMs to not report bogus and confusing PROTO_ATA protocol. Make ATA/SATA transport to fill that gap by reporting protocol to SIM with XPT_SET_TRAN_SETTINGS and patching XPT_GET_TRAN_SETTINGS results if needed. Modified: stable/8/sys/cam/ata/ata_xpt.c stable/8/sys/dev/ahci/ahci.c stable/8/sys/dev/ata/ata-all.c stable/8/sys/dev/mvs/mvs.c stable/8/sys/dev/siis/siis.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/8/sys/cam/ata/ata_xpt.c Sat Jun 9 07:53:57 2012 (r236790) +++ stable/8/sys/cam/ata/ata_xpt.c Sat Jun 9 07:57:52 2012 (r236791) @@ -873,9 +873,9 @@ noerror: xpt_action((union ccb *)&cts); } } + ata_device_transport(path); if (changed) proberequestdefaultnegotiation(periph); - ata_device_transport(path); PROBE_SET_ACTION(softc, PROBE_SETMODE); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); @@ -1054,6 +1054,9 @@ notsata: snprintf(ident_buf->revision, sizeof(ident_buf->revision), "%04x", softc->pm_prv); path->device->flags |= CAM_DEV_IDENTIFY_DATA_VALID; + ata_device_transport(path); + if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) + proberequestdefaultnegotiation(periph); /* Set supported bits. */ bzero(&cts, sizeof(cts)); xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); @@ -1585,6 +1588,12 @@ ata_get_transfer_settings(struct ccb_tra sim = cts->ccb_h.path->bus->sim; (*(sim->sim_action))(sim, (union ccb *)cts); + if (cts->protocol == PROTO_UNKNOWN || + cts->protocol == PROTO_UNSPECIFIED) { + cts->protocol = device->protocol; + cts->protocol_version = device->protocol_version; + } + if (cts->protocol == PROTO_ATA) { ata = &cts->proto_specific.ata; if ((ata->valid & CTS_ATA_VALID_TQ) == 0) { @@ -1605,6 +1614,12 @@ ata_get_transfer_settings(struct ccb_tra scsi->flags |= CTS_SCSI_FLAGS_TAG_ENB; } } + + if (cts->transport == XPORT_UNKNOWN || + cts->transport == XPORT_UNSPECIFIED) { + cts->transport = device->transport; + cts->transport_version = device->transport_version; + } } static void Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Sat Jun 9 07:53:57 2012 (r236790) +++ stable/8/sys/dev/ahci/ahci.c Sat Jun 9 07:57:52 2012 (r236791) @@ -2878,7 +2878,7 @@ ahciaction(struct cam_sim *sim, union cc d = &ch->curr[ccb->ccb_h.target_id]; else d = &ch->user[ccb->ccb_h.target_id]; - cts->protocol = PROTO_ATA; + cts->protocol = PROTO_UNSPECIFIED; cts->protocol_version = PROTO_VERSION_UNSPECIFIED; cts->transport = XPORT_SATA; cts->transport_version = XPORT_VERSION_UNSPECIFIED; @@ -2963,7 +2963,7 @@ ahciaction(struct cam_sim *sim, union cc cpi->unit_number = cam_sim_unit(sim); cpi->transport = XPORT_SATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_ATA; + cpi->protocol = PROTO_UNSPECIFIED; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = MAXPHYS; /* ATI SB600 can't handle 256 sectors with FPDMA (NCQ). */ Modified: stable/8/sys/dev/ata/ata-all.c ============================================================================== --- stable/8/sys/dev/ata/ata-all.c Sat Jun 9 07:53:57 2012 (r236790) +++ stable/8/sys/dev/ata/ata-all.c Sat Jun 9 07:57:52 2012 (r236791) @@ -1786,7 +1786,7 @@ ataaction(struct cam_sim *sim, union ccb d = &ch->curr[ccb->ccb_h.target_id]; else d = &ch->user[ccb->ccb_h.target_id]; - cts->protocol = PROTO_ATA; + cts->protocol = PROTO_UNSPECIFIED; cts->protocol_version = PROTO_VERSION_UNSPECIFIED; if (ch->flags & ATA_SATA) { cts->transport = XPORT_SATA; @@ -1873,7 +1873,7 @@ ataaction(struct cam_sim *sim, union ccb else cpi->transport = XPORT_ATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_ATA; + cpi->protocol = PROTO_UNSPECIFIED; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS; cpi->ccb_h.status = CAM_REQ_CMP; Modified: stable/8/sys/dev/mvs/mvs.c ============================================================================== --- stable/8/sys/dev/mvs/mvs.c Sat Jun 9 07:53:57 2012 (r236790) +++ stable/8/sys/dev/mvs/mvs.c Sat Jun 9 07:57:52 2012 (r236791) @@ -2300,7 +2300,7 @@ mvsaction(struct cam_sim *sim, union ccb d = &ch->curr[ccb->ccb_h.target_id]; else d = &ch->user[ccb->ccb_h.target_id]; - cts->protocol = PROTO_ATA; + cts->protocol = PROTO_UNSPECIFIED; cts->protocol_version = PROTO_VERSION_UNSPECIFIED; cts->transport = XPORT_SATA; cts->transport_version = XPORT_VERSION_UNSPECIFIED; @@ -2383,7 +2383,7 @@ mvsaction(struct cam_sim *sim, union ccb cpi->unit_number = cam_sim_unit(sim); cpi->transport = XPORT_SATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_ATA; + cpi->protocol = PROTO_UNSPECIFIED; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = MAXPHYS; cpi->ccb_h.status = CAM_REQ_CMP; Modified: stable/8/sys/dev/siis/siis.c ============================================================================== --- stable/8/sys/dev/siis/siis.c Sat Jun 9 07:53:57 2012 (r236790) +++ stable/8/sys/dev/siis/siis.c Sat Jun 9 07:57:52 2012 (r236791) @@ -1889,7 +1889,7 @@ siisaction(struct cam_sim *sim, union cc d = &ch->curr[ccb->ccb_h.target_id]; else d = &ch->user[ccb->ccb_h.target_id]; - cts->protocol = PROTO_ATA; + cts->protocol = PROTO_UNSPECIFIED; cts->protocol_version = PROTO_VERSION_UNSPECIFIED; cts->transport = XPORT_SATA; cts->transport_version = XPORT_VERSION_UNSPECIFIED; @@ -1964,7 +1964,7 @@ siisaction(struct cam_sim *sim, union cc cpi->unit_number = cam_sim_unit(sim); cpi->transport = XPORT_SATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_ATA; + cpi->protocol = PROTO_UNSPECIFIED; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->ccb_h.status = CAM_REQ_CMP; cpi->maxio = MAXPHYS; From owner-svn-src-stable-8@FreeBSD.ORG Sat Jun 9 08:07:38 2012 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 A1957106564A; Sat, 9 Jun 2012 08:07:38 +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 8C7278FC08; Sat, 9 Jun 2012 08:07:38 +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 q5987cg3016402; Sat, 9 Jun 2012 08:07:38 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5987cnT016400; Sat, 9 Jun 2012 08:07:38 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206090807.q5987cnT016400@svn.freebsd.org> From: Alexander Motin Date: Sat, 9 Jun 2012 08:07:38 +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: r236794 - stable/8/sys/cam/scsi 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, 09 Jun 2012 08:07:38 -0000 Author: mav Date: Sat Jun 9 08:07:38 2012 New Revision: 236794 URL: http://svn.freebsd.org/changeset/base/236794 Log: MFC r236691: Remove declaration of scsi_interpret_sense(), removed 11 years ago. Modified: stable/8/sys/cam/scsi/scsi_all.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/8/sys/cam/scsi/scsi_all.h Sat Jun 9 08:06:49 2012 (r236793) +++ stable/8/sys/cam/scsi/scsi_all.h Sat Jun 9 08:07:38 2012 (r236794) @@ -1135,12 +1135,6 @@ int scsi_sense_sbuf(struct ccb_scsiio * char * scsi_sense_string(struct ccb_scsiio *csio, char *str, int str_len); void scsi_sense_print(struct ccb_scsiio *csio); -int scsi_interpret_sense(union ccb *ccb, - u_int32_t sense_flags, - u_int32_t *relsim_flags, - u_int32_t *reduction, - u_int32_t *timeout, - scsi_sense_action error_action); #else /* _KERNEL */ int scsi_command_string(struct cam_device *device, struct ccb_scsiio *csio, struct sbuf *sb); @@ -1152,13 +1146,6 @@ char * scsi_sense_string(struct cam_dev char *str, int str_len); void scsi_sense_print(struct cam_device *device, struct ccb_scsiio *csio, FILE *ofile); -int scsi_interpret_sense(struct cam_device *device, - union ccb *ccb, - u_int32_t sense_flags, - u_int32_t *relsim_flags, - u_int32_t *reduction, - u_int32_t *timeout, - scsi_sense_action error_action); #endif /* _KERNEL */ #define SF_RETRY_UA 0x01 From owner-svn-src-stable-8@FreeBSD.ORG Sat Jun 9 08:41:31 2012 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 ACF13106564A; Sat, 9 Jun 2012 08:41:30 +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 9773F8FC14; Sat, 9 Jun 2012 08:41: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 q598fUkg018397; Sat, 9 Jun 2012 08:41:30 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q598fUnj018395; Sat, 9 Jun 2012 08:41:30 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206090841.q598fUnj018395@svn.freebsd.org> From: Alexander Motin Date: Sat, 9 Jun 2012 08:41:30 +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: r236799 - stable/8/sys/cam 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, 09 Jun 2012 08:41:31 -0000 Author: mav Date: Sat Jun 9 08:41:30 2012 New Revision: 236799 URL: http://svn.freebsd.org/changeset/base/236799 Log: MFC r219241 (by mjacob): Don't automatically send a START UNIT to sequential access devices -- this might cause them to load the tape unintentionally. Modified: stable/8/sys/cam/cam_periph.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/cam_periph.c ============================================================================== --- stable/8/sys/cam/cam_periph.c Sat Jun 9 08:25:39 2012 (r236798) +++ stable/8/sys/cam/cam_periph.c Sat Jun 9 08:41:30 2012 (r236799) @@ -1539,6 +1539,15 @@ camperiphscsisenseerror(union ccb *ccb, case SS_START: { int le; + if (SID_TYPE(&cgd.inq_data) == T_SEQUENTIAL) { + xpt_free_ccb(orig_ccb); + ccb->ccb_h.status |= CAM_DEV_QFRZN; + *action_string = "Will not autostart a " + "sequential access device"; + err_action = SS_FAIL; + error = EIO; + break; + } /* * Send a start unit command to the device, and From owner-svn-src-stable-8@FreeBSD.ORG Sat Jun 9 08:51:26 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6B9D3106566B; Sat, 9 Jun 2012 08:51:26 +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 4CB4E8FC1A; Sat, 9 Jun 2012 08:51:26 +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 q598pQV7018873; Sat, 9 Jun 2012 08:51:26 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q598pQxg018870; Sat, 9 Jun 2012 08:51:26 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206090851.q598pQxg018870@svn.freebsd.org> From: Alexander Motin Date: Sat, 9 Jun 2012 08:51:26 +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: r236800 - stable/8/sys/cam 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, 09 Jun 2012 08:51:26 -0000 Author: mav Date: Sat Jun 9 08:51:25 2012 New Revision: 236800 URL: http://svn.freebsd.org/changeset/base/236800 Log: MFC r224806i (by mjacob): Fixes for sure bus reference miscounting and potential device and target reference miscounts. It also adds a helper function to get the current reference counts for components of cam_path for debug aid. One minor style(9) change. Modified: stable/8/sys/cam/cam_xpt.c stable/8/sys/cam/cam_xpt.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/cam_xpt.c ============================================================================== --- stable/8/sys/cam/cam_xpt.c Sat Jun 9 08:41:30 2012 (r236799) +++ stable/8/sys/cam/cam_xpt.c Sat Jun 9 08:51:25 2012 (r236800) @@ -3396,8 +3396,10 @@ xpt_create_path_unlocked(struct cam_path } } status = xpt_compile_path(path, periph, path_id, target_id, lun_id); - if (need_unlock) + if (need_unlock) { CAM_SIM_UNLOCK(bus->sim); + xpt_release_bus(bus); + } if (status != CAM_REQ_CMP) { free(path, M_CAMXPT); path = NULL; @@ -3505,6 +3507,38 @@ xpt_free_path(struct cam_path *path) free(path, M_CAMXPT); } +void +xpt_path_counts(struct cam_path *path, uint32_t *bus_ref, + uint32_t *periph_ref, uint32_t *target_ref, uint32_t *device_ref) +{ + + mtx_lock(&xsoftc.xpt_topo_lock); + if (bus_ref) { + if (path->bus) + *bus_ref = path->bus->refcount; + else + *bus_ref = 0; + } + mtx_unlock(&xsoftc.xpt_topo_lock); + if (periph_ref) { + if (path->periph) + *periph_ref = path->periph->refcount; + else + *periph_ref = 0; + } + if (target_ref) { + if (path->target) + *target_ref = path->target->refcount; + else + *target_ref = 0; + } + if (device_ref) { + if (path->device) + *device_ref = path->device->refcount; + else + *device_ref = 0; + } +} /* * Return -1 for failure, 0 for exact match, 1 for match with wildcards @@ -4350,15 +4384,17 @@ static void xpt_release_bus(struct cam_eb *bus) { + mtx_lock(&xsoftc.xpt_topo_lock); + KASSERT(bus->refcount >= 1, ("bus->refcount >= 1")); if ((--bus->refcount == 0) && (TAILQ_FIRST(&bus->et_entries) == NULL)) { - mtx_lock(&xsoftc.xpt_topo_lock); TAILQ_REMOVE(&xsoftc.xpt_busses, bus, links); xsoftc.bus_generation++; mtx_unlock(&xsoftc.xpt_topo_lock); cam_sim_release(bus->sim); free(bus, M_CAMXPT); - } + } else + mtx_unlock(&xsoftc.xpt_topo_lock); } static struct cam_et * @@ -4381,7 +4417,9 @@ xpt_alloc_target(struct cam_eb *bus, tar * Hold a reference to our parent bus so it * will not go away before we do. */ + mtx_lock(&xsoftc.xpt_topo_lock); bus->refcount++; + mtx_unlock(&xsoftc.xpt_topo_lock); /* Insertion sort into our bus's target list */ cur_target = TAILQ_FIRST(&bus->et_entries); @@ -4402,15 +4440,17 @@ static void xpt_release_target(struct cam_et *target) { - if ((--target->refcount == 0) - && (TAILQ_FIRST(&target->ed_entries) == NULL)) { - TAILQ_REMOVE(&target->bus->et_entries, target, links); - target->bus->generation++; - xpt_release_bus(target->bus); - if (target->luns) - free(target->luns, M_CAMXPT); - free(target, M_CAMXPT); - } + if (target->refcount == 1) { + if (TAILQ_FIRST(&target->ed_entries) == NULL) { + TAILQ_REMOVE(&target->bus->et_entries, target, links); + target->bus->generation++; + xpt_release_bus(target->bus); + if (target->luns) + free(target->luns, M_CAMXPT); + free(target, M_CAMXPT); + } + } else + target->refcount--; } static struct cam_ed * @@ -4507,7 +4547,7 @@ void xpt_release_device(struct cam_ed *device) { - if (--device->refcount == 0) { + if (device->refcount == 1) { struct cam_devq *devq; if (device->alloc_ccb_entry.pinfo.index != CAM_UNQUEUED_INDEX @@ -4515,7 +4555,7 @@ xpt_release_device(struct cam_ed *device panic("Removing device while still queued for ccbs"); if ((device->flags & CAM_DEV_REL_TIMEOUT_PENDING) != 0) - callout_stop(&device->callout); + callout_stop(&device->callout); TAILQ_REMOVE(&device->target->ed_entries, device,links); device->target->generation++; @@ -4527,7 +4567,8 @@ xpt_release_device(struct cam_ed *device cam_ccbq_fini(&device->ccbq); xpt_release_target(device->target); free(device, M_CAMXPT); - } + } else + device->refcount--; } u_int32_t Modified: stable/8/sys/cam/cam_xpt.h ============================================================================== --- stable/8/sys/cam/cam_xpt.h Sat Jun 9 08:41:30 2012 (r236799) +++ stable/8/sys/cam/cam_xpt.h Sat Jun 9 08:51:25 2012 (r236800) @@ -104,6 +104,9 @@ cam_status xpt_create_path_unlocked(str path_id_t path_id, target_id_t target_id, lun_id_t lun_id); void xpt_free_path(struct cam_path *path); +void xpt_path_counts(struct cam_path *path, uint32_t *bus_ref, + uint32_t *periph_ref, uint32_t *target_ref, + uint32_t *device_ref); int xpt_path_comp(struct cam_path *path1, struct cam_path *path2); void xpt_print_path(struct cam_path *path); @@ -136,4 +139,3 @@ void xpt_release_path(struct cam_path #endif /* _KERNEL */ #endif /* _CAM_CAM_XPT_H */ - From owner-svn-src-stable-8@FreeBSD.ORG Sat Jun 9 09:01:25 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 238971065670; Sat, 9 Jun 2012 09:01:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E84DA8FC19; Sat, 9 Jun 2012 09:01:24 +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 q5991OJP019364; Sat, 9 Jun 2012 09:01:24 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5991OA4019361; Sat, 9 Jun 2012 09:01:24 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206090901.q5991OA4019361@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 9 Jun 2012 09:01:24 +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: r236801 - in stable/8/sys: kern 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: Sat, 09 Jun 2012 09:01:25 -0000 Author: kib Date: Sat Jun 9 09:01:24 2012 New Revision: 236801 URL: http://svn.freebsd.org/changeset/base/236801 Log: MFC r236043: Add a vn_bmap_seekhole(9) vnode helper which can be used by any filesystem which supports VOP_BMAP(9) to implement SEEK_HOLE/SEEK_DATA commands for lseek(2). Modified: stable/8/sys/kern/vfs_vnops.c stable/8/sys/sys/vnode.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/kern/vfs_vnops.c ============================================================================== --- stable/8/sys/kern/vfs_vnops.c Sat Jun 9 08:51:25 2012 (r236800) +++ stable/8/sys/kern/vfs_vnops.c Sat Jun 9 09:01:24 2012 (r236801) @@ -1416,3 +1416,56 @@ vn_pages_remove(struct vnode *vp, vm_pin vm_object_page_remove(object, start, end, 0); VM_OBJECT_UNLOCK(object); } + +int +vn_bmap_seekhole(struct vnode *vp, u_long cmd, off_t *off, struct ucred *cred) +{ + struct vattr va; + daddr_t bn, bnp; + uint64_t bsize; + off_t noff; + int error; + + KASSERT(cmd == FIOSEEKHOLE || cmd == FIOSEEKDATA, + ("Wrong command %lu", cmd)); + + if (vn_lock(vp, LK_SHARED) != 0) + return (EBADF); + if (vp->v_type != VREG) { + error = ENOTTY; + goto unlock; + } + error = VOP_GETATTR(vp, &va, cred); + if (error != 0) + goto unlock; + noff = *off; + if (noff >= va.va_size) { + error = ENXIO; + goto unlock; + } + bsize = vp->v_mount->mnt_stat.f_iosize; + for (bn = noff / bsize; noff < va.va_size; bn++, noff += bsize) { + error = VOP_BMAP(vp, bn, NULL, &bnp, NULL, NULL); + if (error == EOPNOTSUPP) { + error = ENOTTY; + goto unlock; + } + if ((bnp == -1 && cmd == FIOSEEKHOLE) || + (bnp != -1 && cmd == FIOSEEKDATA)) { + noff = bn * bsize; + if (noff < *off) + noff = *off; + goto unlock; + } + } + if (noff > va.va_size) + noff = va.va_size; + /* noff == va.va_size. There is an implicit hole at the end of file. */ + if (cmd == FIOSEEKDATA) + error = ENXIO; +unlock: + VOP_UNLOCK(vp, 0); + if (error == 0) + *off = noff; + return (error); +} Modified: stable/8/sys/sys/vnode.h ============================================================================== --- stable/8/sys/sys/vnode.h Sat Jun 9 08:51:25 2012 (r236800) +++ stable/8/sys/sys/vnode.h Sat Jun 9 09:01:24 2012 (r236801) @@ -645,6 +645,8 @@ void vunref(struct vnode *); void vn_printf(struct vnode *vp, const char *fmt, ...) __printflike(2,3); #define vprint(label, vp) vn_printf((vp), "%s\n", (label)) int vrecycle(struct vnode *vp, struct thread *td); +int vn_bmap_seekhole(struct vnode *vp, u_long cmd, off_t *off, + struct ucred *cred); int vn_close(struct vnode *vp, int flags, struct ucred *file_cred, struct thread *td); void vn_finished_write(struct mount *mp); From owner-svn-src-stable-8@FreeBSD.ORG Sat Jun 9 09:05:00 2012 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 9B37C1065670; Sat, 9 Jun 2012 09:05:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B1348FC16; Sat, 9 Jun 2012 09:05:00 +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 q59950kM019568; Sat, 9 Jun 2012 09:05:00 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q599501n019566; Sat, 9 Jun 2012 09:05:00 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206090905.q599501n019566@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 9 Jun 2012 09:05:00 +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: r236802 - stable/8/sys/ufs/ufs 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, 09 Jun 2012 09:05:00 -0000 Author: kib Date: Sat Jun 9 09:04:59 2012 New Revision: 236802 URL: http://svn.freebsd.org/changeset/base/236802 Log: MFC r236044: Implement SEEK_HOLE/SEEK_DATA for UFS. Modified: stable/8/sys/ufs/ufs/ufs_vnops.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- stable/8/sys/ufs/ufs/ufs_vnops.c Sat Jun 9 09:01:24 2012 (r236801) +++ stable/8/sys/ufs/ufs/ufs_vnops.c Sat Jun 9 09:04:59 2012 (r236802) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -95,6 +96,7 @@ static int ufs_chown(struct vnode *, uid static vop_close_t ufs_close; static vop_create_t ufs_create; static vop_getattr_t ufs_getattr; +static vop_ioctl_t ufs_ioctl; static vop_link_t ufs_link; static int ufs_makeinode(int mode, struct vnode *, struct vnode **, struct componentname *); static vop_markatime_t ufs_markatime; @@ -2489,6 +2491,9 @@ ufs_pathconf(ap) *ap->a_retval = 0; #endif break; + case _PC_MIN_HOLE_SIZE: + *ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_iosize; + break; case _PC_ASYNC_IO: /* _PC_ASYNC_IO should have been handled by upper layers. */ KASSERT(0, ("_PC_ASYNC_IO should not get here")); @@ -2715,6 +2720,20 @@ bad: return (error); } +static int +ufs_ioctl(struct vop_ioctl_args *ap) +{ + + switch (ap->a_command) { + case FIOSEEKDATA: + case FIOSEEKHOLE: + return (vn_bmap_seekhole(ap->a_vp, ap->a_command, + (off_t *)ap->a_data, ap->a_cred)); + default: + return (ENOTTY); + } +} + /* Global vfs data structures for ufs. */ struct vop_vector ufs_vnodeops = { .vop_default = &default_vnodeops, @@ -2729,6 +2748,7 @@ struct vop_vector ufs_vnodeops = { .vop_create = ufs_create, .vop_getattr = ufs_getattr, .vop_inactive = ufs_inactive, + .vop_ioctl = ufs_ioctl, .vop_link = ufs_link, .vop_lookup = vfs_cache_lookup, .vop_markatime = ufs_markatime, From owner-svn-src-stable-8@FreeBSD.ORG Sat Jun 9 09:08:34 2012 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 96A731065686; Sat, 9 Jun 2012 09:08:34 +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 816848FC16; Sat, 9 Jun 2012 09:08:34 +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 q5998YHl019757; Sat, 9 Jun 2012 09:08:34 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5998YxB019755; Sat, 9 Jun 2012 09:08:34 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206090908.q5998YxB019755@svn.freebsd.org> From: Alexander Motin Date: Sat, 9 Jun 2012 09:08:34 +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: r236803 - stable/8/sys/cam/scsi 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, 09 Jun 2012 09:08:34 -0000 Author: mav Date: Sat Jun 9 09:08:33 2012 New Revision: 236803 URL: http://svn.freebsd.org/changeset/base/236803 Log: MFC r231745 (by gibbs): Limit the ST3146855LW U320 drive to 55 tags to avoid command timeouts under load. Submitted by: Gelson Borsoi Modified: stable/8/sys/cam/scsi/scsi_xpt.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_xpt.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_xpt.c Sat Jun 9 09:04:59 2012 (r236802) +++ stable/8/sys/cam/scsi/scsi_xpt.c Sat Jun 9 09:08:33 2012 (r236803) @@ -293,6 +293,14 @@ static struct scsi_quirk_entry scsi_quir }, { /* + * Experiences command timeouts under load with a + * tag count higher than 55. + */ + { T_DIRECT, SIP_MEDIA_FIXED, seagate, "ST3146855LW", "*"}, + /*quirks*/0, /*mintags*/2, /*maxtags*/55 + }, + { + /* * Slow when tagged queueing is enabled. Write performance * steadily drops off with more and more concurrent * transactions. Best sequential write performance with From owner-svn-src-stable-8@FreeBSD.ORG Sat Jun 9 09:11:07 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E06B11065674; Sat, 9 Jun 2012 09:11:07 +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 CBC918FC18; Sat, 9 Jun 2012 09:11:07 +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 q599B7IH019932; Sat, 9 Jun 2012 09:11:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q599B7h9019930; Sat, 9 Jun 2012 09:11:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206090911.q599B7h9019930@svn.freebsd.org> From: Alexander Motin Date: Sat, 9 Jun 2012 09:11:07 +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: r236804 - stable/8/sys/cam/scsi 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, 09 Jun 2012 09:11:08 -0000 Author: mav Date: Sat Jun 9 09:11:07 2012 New Revision: 236804 URL: http://svn.freebsd.org/changeset/base/236804 Log: MFC r233746: Be more conservative in using READ CAPACITY(16) command. Previous code checked PROTECT bit in INQUIRY data for all SPC devices, while it is defined only since SPC-3. But there are some SPC-2 USB devices were reported, that have PROTECT bit set, return no error for READ CAPACITY(16) command, but return wrong sector count value in response. Modified: stable/8/sys/cam/scsi/scsi_da.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_da.c Sat Jun 9 09:08:33 2012 (r236803) +++ stable/8/sys/cam/scsi/scsi_da.c Sat Jun 9 09:11:07 2012 (r236804) @@ -1528,9 +1528,7 @@ daregister(struct cam_periph *periph, vo softc->minimum_cmd_size = 16; /* Predict whether device may support READ CAPACITY(16). */ - if (SID_ANSI_REV(&cgd->inq_data) >= SCSI_REV_SPC3 || - (SID_ANSI_REV(&cgd->inq_data) >= SCSI_REV_SPC && - (cgd->inq_data.spc3_flags & SPC3_SID_PROTECT))) { + if (SID_ANSI_REV(&cgd->inq_data) >= SCSI_REV_SPC3) { softc->flags |= DA_FLAG_CAN_RC16; softc->state = DA_STATE_PROBE2; } From owner-svn-src-stable-8@FreeBSD.ORG Sat Jun 9 22:44:50 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4C817106564A; Sat, 9 Jun 2012 22:44:50 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 373AB8FC18; Sat, 9 Jun 2012 22:44:50 +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 q59Mio70058358; Sat, 9 Jun 2012 22:44:50 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q59Min8a058356; Sat, 9 Jun 2012 22:44:49 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201206092244.q59Min8a058356@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 9 Jun 2012 22:44:49 +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: r236827 - stable/8/sys/netinet6 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, 09 Jun 2012 22:44:50 -0000 Author: bz Date: Sat Jun 9 22:44:49 2012 New Revision: 236827 URL: http://svn.freebsd.org/changeset/base/236827 Log: MFC r236615: Plug two interface address refcount leaks in early error return cases in the ioctl path. Reported by: rpaulo Reviewed by: emax Modified: stable/8/sys/netinet6/in6.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet6/in6.c ============================================================================== --- stable/8/sys/netinet6/in6.c Sat Jun 9 22:44:24 2012 (r236826) +++ stable/8/sys/netinet6/in6.c Sat Jun 9 22:44:49 2012 (r236827) @@ -1556,14 +1556,19 @@ in6_lifaddr_ioctl(struct socket *so, u_l hostid = IFA_IN6(ifa); /* prefixlen must be <= 64. */ - if (64 < iflr->prefixlen) + if (64 < iflr->prefixlen) { + if (ifa != NULL) + ifa_free(ifa); return EINVAL; + } prefixlen = iflr->prefixlen; /* hostid part must be zero. */ sin6 = (struct sockaddr_in6 *)&iflr->addr; if (sin6->sin6_addr.s6_addr32[2] != 0 || sin6->sin6_addr.s6_addr32[3] != 0) { + if (ifa != NULL) + ifa_free(ifa); return EINVAL; } } else