From owner-svn-src-stable-8@FreeBSD.ORG Sun Apr 17 21:52:58 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16A591065672; Sun, 17 Apr 2011 21:52:58 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 065AC8FC08; Sun, 17 Apr 2011 21:52:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3HLqvmp050679; Sun, 17 Apr 2011 21:52:57 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3HLqvFA050676; Sun, 17 Apr 2011 21:52:57 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201104172152.p3HLqvFA050676@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 17 Apr 2011 21:52:57 +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: r220757 - stable/8/usr.bin/logger 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, 17 Apr 2011 21:52:58 -0000 Author: edwin Date: Sun Apr 17 21:52:57 2011 New Revision: 220757 URL: http://svn.freebsd.org/changeset/base/220757 Log: MFC of r220448 When specifying the -t option (send tag in front of message), this tag should also be forwarded to the remote logging host, not only when the logging is done locally. PR: bin/154324 Submitted by: Callum Gibson Modified: stable/8/usr.bin/logger/logger.1 stable/8/usr.bin/logger/logger.c Directory Properties: stable/8/usr.bin/logger/ (props changed) Modified: stable/8/usr.bin/logger/logger.1 ============================================================================== --- stable/8/usr.bin/logger/logger.1 Sun Apr 17 21:11:55 2011 (r220756) +++ stable/8/usr.bin/logger/logger.1 Sun Apr 17 21:52:57 2011 (r220757) @@ -106,7 +106,8 @@ facility. The default is ``user.notice.'' .It Fl t Ar tag Mark every line in the log with the specified -.Ar tag . +.Ar tag +rather than the default of current login name. .It Ar message Write the message to log; if not specified, and the .Fl f Modified: stable/8/usr.bin/logger/logger.c ============================================================================== --- stable/8/usr.bin/logger/logger.c Sun Apr 17 21:11:55 2011 (r220756) +++ stable/8/usr.bin/logger/logger.c Sun Apr 17 21:52:57 2011 (r220757) @@ -63,7 +63,8 @@ __FBSDID("$FreeBSD$"); int decode(char *, CODE *); int pencode(char *); -static void logmessage(int, const char *, const char *, const char *); +static void logmessage(int, const char *, const char *, const char *, + const char *); static void usage(void); struct socks { @@ -140,8 +141,11 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; + if (tag == NULL) + tag = getlogin(); /* setup for logging */ - openlog(tag ? tag : getlogin(), logflags, 0); + if (host == NULL) + openlog(tag, logflags, 0); (void) fclose(stdout); /* log input line if appropriate */ @@ -152,11 +156,11 @@ main(int argc, char *argv[]) for (p = buf, endp = buf + sizeof(buf) - 2; *argv;) { len = strlen(*argv); if (p + len > endp && p > buf) { - logmessage(pri, host, svcname, buf); + logmessage(pri, tag, host, svcname, buf); p = buf; } if (len > sizeof(buf) - 1) - logmessage(pri, host, svcname, *argv++); + logmessage(pri, tag, host, svcname, *argv++); else { if (p != buf) *p++ = ' '; @@ -165,10 +169,10 @@ main(int argc, char *argv[]) } } if (p != buf) - logmessage(pri, host, svcname, buf); + logmessage(pri, tag, host, svcname, buf); } else while (fgets(buf, sizeof(buf), stdin) != NULL) - logmessage(pri, host, svcname, buf); + logmessage(pri, tag, host, svcname, buf); exit(0); } @@ -176,7 +180,8 @@ main(int argc, char *argv[]) * Send the message to syslog, either on the local host, or on a remote host */ void -logmessage(int pri, const char *host, const char *svcname, const char *buf) +logmessage(int pri, const char *tag, const char *host, const char *svcname, + const char *buf) { static struct socks *socks; static int nsock = 0; @@ -220,7 +225,7 @@ logmessage(int pri, const char *host, co errx(1, "socket"); } - if ((len = asprintf(&line, "<%d>%s", pri, buf)) == -1) + if ((len = asprintf(&line, "<%d>%s: %s", pri, tag, buf)) == -1) errx(1, "asprintf"); lsent = -1; From owner-svn-src-stable-8@FreeBSD.ORG Mon Apr 18 08:49:25 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 932AD1065670; Mon, 18 Apr 2011 08:49:25 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 81B8B8FC08; Mon, 18 Apr 2011 08:49:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3I8nP1f064527; Mon, 18 Apr 2011 08:49:25 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3I8nPrR064525; Mon, 18 Apr 2011 08:49:25 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201104180849.p3I8nPrR064525@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 18 Apr 2011 08:49:25 +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: r220765 - stable/8/lib/libdevstat 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, 18 Apr 2011 08:49:25 -0000 Author: pluknet Date: Mon Apr 18 08:49:25 2011 New Revision: 220765 URL: http://svn.freebsd.org/changeset/base/220765 Log: MFC r220319: Do not increment num_args if strsep(3) returned an empty field. That fixes devstat_buildmatch(3) crashes with certain strings. Reported by: arundel Modified: stable/8/lib/libdevstat/devstat.c Directory Properties: stable/8/lib/libdevstat/ (props changed) Modified: stable/8/lib/libdevstat/devstat.c ============================================================================== --- stable/8/lib/libdevstat/devstat.c Mon Apr 18 01:02:43 2011 (r220764) +++ stable/8/lib/libdevstat/devstat.c Mon Apr 18 08:49:25 2011 (r220765) @@ -1014,11 +1014,12 @@ devstat_buildmatch(char *match_str, stru * Break the (comma delimited) input string out into separate strings. */ for (tempstr = tstr, num_args = 0; - (*tempstr = strsep(&match_str, ",")) != NULL && (num_args < 5); - num_args++) - if (**tempstr != '\0') + (*tempstr = strsep(&match_str, ",")) != NULL && (num_args < 5);) + if (**tempstr != '\0') { + num_args++; if (++tempstr >= &tstr[5]) break; + } /* The user gave us too many type arguments */ if (num_args > 3) { From owner-svn-src-stable-8@FreeBSD.ORG Mon Apr 18 11:25:13 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E67651065670; Mon, 18 Apr 2011 11:25:13 +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 B91AA8FC19; Mon, 18 Apr 2011 11:25:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3IBPDi5070129; Mon, 18 Apr 2011 11:25:13 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3IBPDus070127; Mon, 18 Apr 2011 11:25:13 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104181125.p3IBPDus070127@svn.freebsd.org> From: Alexander Motin Date: Mon, 18 Apr 2011 11:25: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: r220771 - stable/8/sys/dev/usb/storage 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, 18 Apr 2011 11:25:14 -0000 Author: mav Date: Mon Apr 18 11:25:13 2011 New Revision: 220771 URL: http://svn.freebsd.org/changeset/base/220771 Log: Rework change made at r203146. Instead of reporting all wire errors as SCSI status errors to CAM (that was wrong, as it too often turned retriable wire errors into non-retriable REQUEST SENSE errors), do it only for STALL errors on control pipe of the CBI devices. STALL on control pipe is just a one of the ways to report error for CBI devices. PR: usb/150401, usb/154593. Reviewed by: hselasky Modified: stable/8/sys/dev/usb/storage/umass.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/usb/storage/umass.c ============================================================================== --- stable/8/sys/dev/usb/storage/umass.c Mon Apr 18 10:25:54 2011 (r220770) +++ stable/8/sys/dev/usb/storage/umass.c Mon Apr 18 11:25:13 2011 (r220771) @@ -1850,9 +1850,23 @@ umass_t_cbi_command_callback(struct usb_ break; default: /* Error */ - umass_tr_error(xfer, error); - /* skip reset */ - sc->sc_last_xfer_index = UMASS_T_CBI_COMMAND; + /* + * STALL on the control pipe can be result of the command error. + * Attempt to clear this STALL same as for bulk pipe also + * results in command completion interrupt, but ASC/ASCQ there + * look like not always valid, so don't bother about it. + */ + if ((error == USB_ERR_STALLED) || + (sc->sc_transfer.callback == &umass_cam_cb)) { + sc->sc_transfer.ccb = NULL; + (sc->sc_transfer.callback) + (sc, ccb, sc->sc_transfer.data_len, + STATUS_CMD_UNKNOWN); + } else { + umass_tr_error(xfer, error); + /* skip reset */ + sc->sc_last_xfer_index = UMASS_T_CBI_COMMAND; + } break; } } @@ -2606,17 +2620,9 @@ umass_cam_cb(struct umass_softc *sc, uni /* * The wire protocol failed and will hopefully have * recovered. We return an error to CAM and let CAM - * retry the command if necessary. In case of SCSI IO - * commands we ask the CAM layer to check the - * condition first. This is a quick hack to make - * certain devices work. + * retry the command if necessary. */ - if (ccb->ccb_h.func_code == XPT_SCSI_IO) { - ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR; - ccb->csio.scsi_status = SCSI_STATUS_CHECK_COND; - } else { - ccb->ccb_h.status = CAM_REQ_CMP_ERR; - } + ccb->ccb_h.status = CAM_REQ_CMP_ERR; xpt_done(ccb); break; } From owner-svn-src-stable-8@FreeBSD.ORG Mon Apr 18 12:18:28 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E084106566B; Mon, 18 Apr 2011 12:18:28 +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 E37EC8FC1A; Mon, 18 Apr 2011 12:18:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3ICIREr071454; Mon, 18 Apr 2011 12:18:27 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3ICIRwT071452; Mon, 18 Apr 2011 12:18:27 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201104181218.p3ICIRwT071452@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 18 Apr 2011 12:18: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: r220773 - 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: Mon, 18 Apr 2011 12:18:28 -0000 Author: bz Date: Mon Apr 18 12:18:27 2011 New Revision: 220773 URL: http://svn.freebsd.org/changeset/base/220773 Log: MFC r220743: Fix IPv6 ND. After r219562 we in nd6_ns_input() were erroneously always passing the cached proxydl reference (sockaddr_dl initialized or not) to nd6_na_output(). nd6_na_output() will thus assume a proxy NA. Revert to conditionally passing either &proxydl or NULL if no proxy case desired. Tested by: ipv6gw and ref9-i386 Tested by: Pete French (petefrench ingresso.co.uk on stable) Reported by: Pete French (petefrench ingresso.co.uk on stable) Reported by: bz, simon on Y! cluster Reported by: kib PR: kern/151908 X-Early-MFC: yes Modified: stable/8/sys/netinet6/nd6_nbr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/netinet6/nd6_nbr.c ============================================================================== --- stable/8/sys/netinet6/nd6_nbr.c Mon Apr 18 12:15:43 2011 (r220772) +++ stable/8/sys/netinet6/nd6_nbr.c Mon Apr 18 12:18:27 2011 (r220773) @@ -339,7 +339,7 @@ nd6_ns_input(struct mbuf *m, int off, in nd6_na_output(ifp, &in6_all, &taddr6, ((anycast || proxy || !tlladdr) ? 0 : ND_NA_FLAG_OVERRIDE) | (V_ip6_forwarding ? ND_NA_FLAG_ROUTER : 0), - tlladdr, (struct sockaddr *)&proxydl); + tlladdr, proxy ? (struct sockaddr *)&proxydl : NULL); goto freeit; } @@ -349,7 +349,7 @@ nd6_ns_input(struct mbuf *m, int off, in nd6_na_output(ifp, &saddr6, &taddr6, ((anycast || proxy || !tlladdr) ? 0 : ND_NA_FLAG_OVERRIDE) | (V_ip6_forwarding ? ND_NA_FLAG_ROUTER : 0) | ND_NA_FLAG_SOLICITED, - tlladdr, (struct sockaddr *)&proxydl); + tlladdr, proxy ? (struct sockaddr *)&proxydl : NULL); freeit: if (ifa != NULL) ifa_free(ifa); From owner-svn-src-stable-8@FreeBSD.ORG Mon Apr 18 13:09:34 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21EF4106564A; Mon, 18 Apr 2011 13:09:34 +0000 (UTC) (envelope-from simon@nitro.dk) Received: from emx.nitro.dk (emx.nitro.dk [IPv6:2a01:4f8:120:7384::102]) by mx1.freebsd.org (Postfix) with ESMTP id A9F9F8FC18; Mon, 18 Apr 2011 13:09:33 +0000 (UTC) Received: from mailscan.leto.nitro.dk (mailscan.leto.nitro.dk [127.0.1.4]) by emx.nitro.dk (Postfix) with ESMTP id AA07312E3; Mon, 18 Apr 2011 13:09:32 +0000 (UTC) Received: from emx.nitro.dk ([127.0.1.2]) by mailscan.leto.nitro.dk (mailscan.leto.nitro.dk [127.0.1.4]) (amavisd-new, port 10024) with LMTP id 5EkEcf8sYXQF; Mon, 18 Apr 2011 13:09:29 +0000 (UTC) Received: from [192.168.4.23] (unknown [90.184.171.166]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by emx.nitro.dk (Postfix) with ESMTPSA id 6525712E2; Mon, 18 Apr 2011 13:09:28 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Simon L. B. Nielsen" In-Reply-To: <201104181218.p3ICIRwT071452@svn.freebsd.org> Date: Mon, 18 Apr 2011 15:09:26 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <23EBF5B9-38C5-4EEE-8BA1-10B1A9FA735E@nitro.dk> References: <201104181218.p3ICIRwT071452@svn.freebsd.org> To: "Bjoern A. Zeeb" X-Mailer: Apple Mail (2.1084) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r220773 - 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: Mon, 18 Apr 2011 13:09:34 -0000 On 18 Apr 2011, at 14:18, Bjoern A. Zeeb wrote: > Author: bz > Date: Mon Apr 18 12:18:27 2011 > New Revision: 220773 > URL: http://svn.freebsd.org/changeset/base/220773 >=20 > Log: > MFC r220743: >=20 > Fix IPv6 ND. After r219562 we in nd6_ns_input() were erroneously = always > passing the cached proxydl reference (sockaddr_dl initialized or = not) to > nd6_na_output(). nd6_na_output() will thus assume a proxy NA. = Revert to > conditionally passing either &proxydl or NULL if no proxy case = desired. Thanks for the quick fix! > Tested by: ipv6gw and ref9-i386 FWIW, ipv6gw is also running stable/8 so the patch bz MFC'ed has been = running in production for a day or so. --=20 Simon L. B. Nielsen From owner-svn-src-stable-8@FreeBSD.ORG Mon Apr 18 15:55:02 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E2321065674; Mon, 18 Apr 2011 15:55:02 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 70DDC8FC17; Mon, 18 Apr 2011 15:55:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3IFt238076791; Mon, 18 Apr 2011 15:55:02 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3IFt2AP076790; Mon, 18 Apr 2011 15:55:02 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201104181555.p3IFt2AP076790@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 18 Apr 2011 15:55: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: r220788 - stable/8/sys/compat/x86bios 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, 18 Apr 2011 15:55:02 -0000 Author: jkim Date: Mon Apr 18 15:55:02 2011 New Revision: 220788 URL: http://svn.freebsd.org/changeset/base/220788 Log: MFC: r219430 Remove custom interrupt dispatcher. This is a pointless micro-optimization and it may cause problems if SS and SP are modified by real-mode code. Modified: stable/8/sys/compat/x86bios/x86bios.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/compat/x86bios/x86bios.c ============================================================================== --- stable/8/sys/compat/x86bios/x86bios.c Mon Apr 18 15:30:25 2011 (r220787) +++ stable/8/sys/compat/x86bios/x86bios.c Mon Apr 18 15:55:02 2011 (r220788) @@ -291,25 +291,6 @@ x86bios_emu_outl(struct x86emu *emu, uin outl(port, val); } -static void -x86bios_emu_get_intr(struct x86emu *emu, int intno) -{ - uint16_t *sp; - uint32_t iv; - - emu->x86.R_SP -= 6; - - sp = (uint16_t *)((vm_offset_t)x86bios_seg + emu->x86.R_SP); - sp[0] = htole16(emu->x86.R_IP); - sp[1] = htole16(emu->x86.R_CS); - sp[2] = htole16(emu->x86.R_FLG); - - iv = x86bios_get_intr(intno); - emu->x86.R_IP = iv & 0xffff; - emu->x86.R_CS = (iv >> 16) & 0xffff; - emu->x86.R_FLG &= ~(F_IF | F_TF); -} - void * x86bios_alloc(uint32_t *offset, size_t size) { @@ -567,7 +548,6 @@ x86bios_unmap_mem(void) static void x86bios_init(void *arg __unused) { - int i; mtx_init(&x86bios_lock, "x86bios lock", NULL, MTX_SPIN); @@ -598,9 +578,6 @@ x86bios_init(void *arg __unused) x86bios_emu.emu_outb = x86bios_emu_outb; x86bios_emu.emu_outw = x86bios_emu_outw; x86bios_emu.emu_outl = x86bios_emu_outl; - - for (i = 0; i < 256; i++) - x86bios_emu._x86emu_intrTab[i] = x86bios_emu_get_intr; } static void From owner-svn-src-stable-8@FreeBSD.ORG Mon Apr 18 18:18:07 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D63851065670; Mon, 18 Apr 2011 18:18:07 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C3AFA8FC0C; Mon, 18 Apr 2011 18:18:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3III7Lw080250; Mon, 18 Apr 2011 18:18:07 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3III7D0080245; Mon, 18 Apr 2011 18:18:07 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201104181818.p3III7D0080245@svn.freebsd.org> From: Navdeep Parhar Date: Mon, 18 Apr 2011 18:18: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: r220795 - stable/8/sys/dev/cxgbe 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, 18 Apr 2011 18:18:08 -0000 Author: np Date: Mon Apr 18 18:18:07 2011 New Revision: 220795 URL: http://svn.freebsd.org/changeset/base/220795 Log: MFC r220643: There is no need to request a tx credit flush if such a request is already pending. Modified: stable/8/sys/dev/cxgbe/adapter.h stable/8/sys/dev/cxgbe/t4_main.c stable/8/sys/dev/cxgbe/t4_sge.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/cxgbe/adapter.h ============================================================================== --- stable/8/sys/dev/cxgbe/adapter.h Mon Apr 18 17:43:16 2011 (r220794) +++ stable/8/sys/dev/cxgbe/adapter.h Mon Apr 18 18:18:07 2011 (r220795) @@ -260,7 +260,7 @@ enum { /* eq flags */ EQ_ALLOCATED = (1 << 1), /* firmware resources allocated */ EQ_STARTED = (1 << 2), /* started */ - EQ_STALLED = (1 << 3), /* currently stalled */ + EQ_CRFLUSHED = (1 << 3), /* expecting an update from SGE */ }; /* Modified: stable/8/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/8/sys/dev/cxgbe/t4_main.c Mon Apr 18 17:43:16 2011 (r220794) +++ stable/8/sys/dev/cxgbe/t4_main.c Mon Apr 18 18:18:07 2011 (r220795) @@ -2673,6 +2673,7 @@ cxgbe_txq_start(void *arg, int count) struct sge_txq *txq = arg; TXQ_LOCK(txq); + txq->eq.flags &= ~EQ_CRFLUSHED; txq_start(txq->ifp, txq); TXQ_UNLOCK(txq); } Modified: stable/8/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/8/sys/dev/cxgbe/t4_sge.c Mon Apr 18 17:43:16 2011 (r220794) +++ stable/8/sys/dev/cxgbe/t4_sge.c Mon Apr 18 18:18:07 2011 (r220795) @@ -876,7 +876,7 @@ doorbell: * WR that reduced it to 0 so we don't need another flush (we don't have * any descriptor for a flush WR anyway, duh). */ - if (m && eq->avail > 0) + if (m && eq->avail > 0 && !(eq->flags & EQ_CRFLUSHED)) write_eqflush_wr(eq); txq->m = m; @@ -1882,8 +1882,11 @@ write_txpkt_wr(struct port_info *pi, str wr->op_immdlen = htobe32(V_FW_WR_OP(FW_ETH_TX_PKT_WR) | V_FW_WR_IMMDLEN(ctrl)); ctrl = V_FW_WR_LEN16(howmany(nflits, 2)); - if (eq->avail == ndesc) + if (eq->avail == ndesc && !(eq->flags & EQ_CRFLUSHED)) { ctrl |= F_FW_WR_EQUEQ | F_FW_WR_EQUIQ; + eq->flags |= EQ_CRFLUSHED; + } + wr->equiq_to_len16 = htobe32(ctrl); wr->r3 = 0; @@ -2071,8 +2074,10 @@ write_txpkts_wr(struct sge_txq *txq, str wr->op_immdlen = htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS_WR) | V_FW_WR_IMMDLEN(0)); /* immdlen does not matter in this WR */ ctrl = V_FW_WR_LEN16(howmany(txpkts->nflits, 2)); - if (eq->avail == ndesc) + if (eq->avail == ndesc && !(eq->flags & EQ_CRFLUSHED)) { ctrl |= F_FW_WR_EQUEQ | F_FW_WR_EQUIQ; + eq->flags |= EQ_CRFLUSHED; + } wr->equiq_to_len16 = htobe32(ctrl); wr->plen = htobe16(txpkts->plen); wr->npkt = txpkts->npkt; @@ -2083,7 +2088,7 @@ write_txpkts_wr(struct sge_txq *txq, str txsd = &eq->sdesc[eq->pidx]; txsd->desc_used = ndesc; - KASSERT(eq->avail >= ndesc, ("%s: out ouf descriptors", __func__)); + KASSERT(eq->avail >= ndesc, ("%s: out of descriptors", __func__)); eq->pending += ndesc; eq->avail -= ndesc; @@ -2384,6 +2389,7 @@ write_eqflush_wr(struct sge_eq *eq) txsd->desc_used = 1; txsd->map_used = 0; + eq->flags |= EQ_CRFLUSHED; eq->pending++; eq->avail--; if (++eq->pidx == eq->cap) @@ -2438,6 +2444,10 @@ handle_sge_egr_update(struct adapter *sc struct port_info *pi; txq = (void *)s->eqmap[qid - s->eq_start]; + + KASSERT(txq->eq.flags & EQ_CRFLUSHED, + ("%s: tx queue %p not expecting an update.", __func__, txq)); + pi = txq->ifp->if_softc; taskqueue_enqueue(pi->tq, &txq->resume_tx); txq->egr_update++; From owner-svn-src-stable-8@FreeBSD.ORG Mon Apr 18 18:55:28 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 053B61065673; Mon, 18 Apr 2011 18:55:28 +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 DC7258FC14; Mon, 18 Apr 2011 18:55:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3IItRwk081182; Mon, 18 Apr 2011 18:55:27 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3IItRoL081180; Mon, 18 Apr 2011 18:55:27 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201104181855.p3IItRoL081180@svn.freebsd.org> From: John Baldwin Date: Mon, 18 Apr 2011 18:55: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: r220797 - stable/8/sys/amd64/amd64 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, 18 Apr 2011 18:55:28 -0000 Author: jhb Date: Mon Apr 18 18:55:27 2011 New Revision: 220797 URL: http://svn.freebsd.org/changeset/base/220797 Log: MFC 220430,220431,220452,220460: If a system call does not request a full interrupt return, use a fast path via the sysretq instruction to return from the system call. This resolves most of the performance regression in system call microbenchmarks between 7 and 8 on amd64. While here, trim an instruction (and memory access) from the doreti path and fix a typo in a comment. Modified: stable/8/sys/amd64/amd64/exception.S Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/amd64/amd64/exception.S ============================================================================== --- stable/8/sys/amd64/amd64/exception.S Mon Apr 18 18:22:10 2011 (r220796) +++ stable/8/sys/amd64/amd64/exception.S Mon Apr 18 18:55:27 2011 (r220797) @@ -339,6 +339,9 @@ IDTVEC(prot) * and the new privilige level. We are still running on the old user stack * pointer. We have to juggle a few things around to find our stack etc. * swapgs gives us access to our PCPU space only. + * + * We do not support invoking this from a custom %cs or %ss (e.g. using + * entries from an LDT). */ IDTVEC(fast_syscall) swapgs @@ -379,7 +382,38 @@ IDTVEC(fast_syscall) FAKE_MCOUNT(TF_RIP(%rsp)) movq %rsp,%rdi call syscall - movq PCPU(CURPCB),%rax +1: movq PCPU(CURPCB),%rax + /* Disable interrupts before testing PCB_FULL_IRET. */ + cli + testl $PCB_FULL_IRET,PCB_FLAGS(%rax) + jnz 3f + /* Check for and handle AST's on return to userland. */ + movq PCPU(CURTHREAD),%rax + testl $TDF_ASTPENDING | TDF_NEEDRESCHED,TD_FLAGS(%rax) + je 2f + sti + movq %rsp, %rdi + call ast + jmp 1b +2: /* Restore preserved registers. */ + MEXITCOUNT + movq TF_RDI(%rsp),%rdi /* bonus; preserve arg 1 */ + movq TF_RSI(%rsp),%rsi /* bonus: preserve arg 2 */ + movq TF_RDX(%rsp),%rdx /* return value 2 */ + movq TF_RAX(%rsp),%rax /* return value 1 */ + movq TF_RBX(%rsp),%rbx /* C preserved */ + movq TF_RBP(%rsp),%rbp /* C preserved */ + movq TF_R12(%rsp),%r12 /* C preserved */ + movq TF_R13(%rsp),%r13 /* C preserved */ + movq TF_R14(%rsp),%r14 /* C preserved */ + movq TF_R15(%rsp),%r15 /* C preserved */ + movq TF_RFLAGS(%rsp),%r11 /* original %rflags */ + movq TF_RIP(%rsp),%rcx /* original %rip */ + movq TF_RSP(%rsp),%r9 /* user stack pointer */ + movq %r9,%rsp /* original %rsp */ + swapgs + sysretq +3: /* Requested full context restore, use doreti for that. */ MEXITCOUNT jmp doreti @@ -628,7 +662,7 @@ doreti: doreti_ast: /* * Check for ASTs atomically with returning. Disabling CPU - * interrupts provides sufficient locking eve in the SMP case, + * interrupts provides sufficient locking even in the SMP case, * since we will be informed of any new ASTs by an IPI. */ cli @@ -649,8 +683,7 @@ doreti_ast: */ doreti_exit: MEXITCOUNT - movq PCPU(CURTHREAD),%r8 - movq TD_PCB(%r8),%r8 + movq PCPU(CURPCB),%r8 /* * Do not reload segment registers for kernel. From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 05:09:17 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 674AF106564A; Tue, 19 Apr 2011 05:09:17 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 53CCC8FC14; Tue, 19 Apr 2011 05:09:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3J59HXH095236; Tue, 19 Apr 2011 05:09:17 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3J59HA2095234; Tue, 19 Apr 2011 05:09:17 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201104190509.p3J59HA2095234@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 19 Apr 2011 05:09:17 +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: r220811 - 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: Tue, 19 Apr 2011 05:09:17 -0000 Author: ae Date: Tue Apr 19 05:09:17 2011 New Revision: 220811 URL: http://svn.freebsd.org/changeset/base/220811 Log: MFC r220568: Restore previous behaviour - always match rule when we doing tagging, even when tag is already exists. Reported by: Vadim Goncharov Modified: stable/8/sys/netinet/ipfw/ip_fw2.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_fw2.c Tue Apr 19 01:09:51 2011 (r220810) +++ stable/8/sys/netinet/ipfw/ip_fw2.c Tue Apr 19 05:09:17 2011 (r220811) @@ -1793,10 +1793,13 @@ do { \ if (mtag != NULL) m_tag_delete(m, mtag); match = 0; - } else if (mtag == NULL) { - if ((mtag = m_tag_alloc(MTAG_IPFW, - tag, 0, M_NOWAIT)) != NULL) - m_tag_prepend(m, mtag); + } else { + if (mtag == NULL) { + mtag = m_tag_alloc( MTAG_IPFW, + tag, 0, M_NOWAIT); + if (mtag != NULL) + m_tag_prepend(m, mtag); + } match = 1; } break; From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 07:23:16 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99E25106564A; Tue, 19 Apr 2011 07:23:16 +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 869FB8FC20; Tue, 19 Apr 2011 07:23:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3J7NGL9098082; Tue, 19 Apr 2011 07:23:16 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3J7NG5Y098078; Tue, 19 Apr 2011 07:23:16 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201104190723.p3J7NG5Y098078@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 19 Apr 2011 07:23: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: r220813 - in stable/8/sys: netinet 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, 19 Apr 2011 07:23:16 -0000 Author: bz Date: Tue Apr 19 07:23:16 2011 New Revision: 220813 URL: http://svn.freebsd.org/changeset/base/220813 Log: MFC r219579: Merge the two identical implementations for local port selections from in_pcbbind_setup() and in6_pcbsetport() in a single in_pcb_lport(). Modified: stable/8/sys/netinet/in_pcb.c stable/8/sys/netinet/in_pcb.h stable/8/sys/netinet6/in6_src.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/netinet/in_pcb.c ============================================================================== --- stable/8/sys/netinet/in_pcb.c Tue Apr 19 05:59:37 2011 (r220812) +++ stable/8/sys/netinet/in_pcb.c Tue Apr 19 07:23:16 2011 (r220813) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" #include "opt_ipsec.h" +#include "opt_inet.h" #include "opt_inet6.h" #include @@ -73,6 +74,7 @@ __FBSDID("$FreeBSD$"); #ifdef INET6 #include #include +#include #endif /* INET6 */ @@ -271,6 +273,124 @@ in_pcbbind(struct inpcb *inp, struct soc return (0); } +#if defined(INET) || defined(INET6) +int +in_pcb_lport(struct inpcb *inp, struct in_addr *laddrp, u_short *lportp, + struct ucred *cred, int wild) +{ + struct inpcbinfo *pcbinfo; + struct inpcb *tmpinp; + unsigned short *lastport; + int count, dorandom, error; + u_short aux, first, last, lport; +#ifdef INET + struct in_addr laddr; +#endif + + pcbinfo = inp->inp_pcbinfo; + + /* + * Because no actual state changes occur here, a global write lock on + * the pcbinfo isn't required. + */ + INP_INFO_LOCK_ASSERT(pcbinfo); + INP_LOCK_ASSERT(inp); + + if (inp->inp_flags & INP_HIGHPORT) { + first = V_ipport_hifirstauto; /* sysctl */ + last = V_ipport_hilastauto; + lastport = &pcbinfo->ipi_lasthi; + } else if (inp->inp_flags & INP_LOWPORT) { + error = priv_check_cred(cred, PRIV_NETINET_RESERVEDPORT, 0); + if (error) + return (error); + first = V_ipport_lowfirstauto; /* 1023 */ + last = V_ipport_lowlastauto; /* 600 */ + lastport = &pcbinfo->ipi_lastlow; + } else { + first = V_ipport_firstauto; /* sysctl */ + last = V_ipport_lastauto; + lastport = &pcbinfo->ipi_lastport; + } + /* + * For UDP, use random port allocation as long as the user + * allows it. For TCP (and as of yet unknown) connections, + * use random port allocation only if the user allows it AND + * ipport_tick() allows it. + */ + if (V_ipport_randomized && + (!V_ipport_stoprandom || pcbinfo == &V_udbinfo)) + dorandom = 1; + else + dorandom = 0; + /* + * It makes no sense to do random port allocation if + * we have the only port available. + */ + if (first == last) + dorandom = 0; + /* Make sure to not include UDP packets in the count. */ + if (pcbinfo != &V_udbinfo) + V_ipport_tcpallocs++; + /* + * Instead of having two loops further down counting up or down + * make sure that first is always <= last and go with only one + * code path implementing all logic. + */ + if (first > last) { + aux = first; + first = last; + last = aux; + } + +#ifdef INET + /* Make the compiler happy. */ + laddr.s_addr = 0; + if ((inp->inp_vflag & INP_IPV4) != 0) { + KASSERT(laddrp != NULL, ("%s: laddrp NULL for v4 inp %p", + __func__, inp)); + laddr = *laddrp; + } +#endif + lport = *lportp; + + if (dorandom) + *lastport = first + (arc4random() % (last - first)); + + count = last - first; + + do { + if (count-- < 0) /* completely used? */ + return (EADDRNOTAVAIL); + ++*lastport; + if (*lastport < first || *lastport > last) + *lastport = first; + lport = htons(*lastport); + +#ifdef INET6 + if ((inp->inp_vflag & INP_IPV6) != 0) + tmpinp = in6_pcblookup_local(pcbinfo, + &inp->in6p_laddr, lport, wild, cred); +#endif +#if defined(INET) && defined(INET6) + else +#endif +#ifdef INET + tmpinp = in_pcblookup_local(pcbinfo, laddr, + lport, wild, cred); +#endif + } while (tmpinp != NULL); + +#ifdef INET + if ((inp->inp_vflag & INP_IPV4) != 0) + laddrp->s_addr = laddr.s_addr; +#endif + *lportp = lport; + + return (0); +} +#endif /* INET || INET6 */ + /* * Set up a bind operation on a PCB, performing port allocation * as required, but do not actually modify the PCB. Callers can @@ -285,14 +405,12 @@ in_pcbbind_setup(struct inpcb *inp, stru u_short *lportp, struct ucred *cred) { struct socket *so = inp->inp_socket; - unsigned short *lastport; struct sockaddr_in *sin; struct inpcbinfo *pcbinfo = inp->inp_pcbinfo; struct in_addr laddr; u_short lport = 0; int wild = 0, reuseport = (so->so_options & SO_REUSEPORT); int error; - int dorandom; /* * Because no actual state changes occur here, a global write lock on @@ -417,72 +535,10 @@ in_pcbbind_setup(struct inpcb *inp, stru if (*lportp != 0) lport = *lportp; if (lport == 0) { - u_short first, last, aux; - int count; - - if (inp->inp_flags & INP_HIGHPORT) { - first = V_ipport_hifirstauto; /* sysctl */ - last = V_ipport_hilastauto; - lastport = &pcbinfo->ipi_lasthi; - } else if (inp->inp_flags & INP_LOWPORT) { - error = priv_check_cred(cred, - PRIV_NETINET_RESERVEDPORT, 0); - if (error) - return error; - first = V_ipport_lowfirstauto; /* 1023 */ - last = V_ipport_lowlastauto; /* 600 */ - lastport = &pcbinfo->ipi_lastlow; - } else { - first = V_ipport_firstauto; /* sysctl */ - last = V_ipport_lastauto; - lastport = &pcbinfo->ipi_lastport; - } - /* - * For UDP, use random port allocation as long as the user - * allows it. For TCP (and as of yet unknown) connections, - * use random port allocation only if the user allows it AND - * ipport_tick() allows it. - */ - if (V_ipport_randomized && - (!V_ipport_stoprandom || pcbinfo == &V_udbinfo)) - dorandom = 1; - else - dorandom = 0; - /* - * It makes no sense to do random port allocation if - * we have the only port available. - */ - if (first == last) - dorandom = 0; - /* Make sure to not include UDP packets in the count. */ - if (pcbinfo != &V_udbinfo) - V_ipport_tcpallocs++; - /* - * Instead of having two loops further down counting up or down - * make sure that first is always <= last and go with only one - * code path implementing all logic. - */ - if (first > last) { - aux = first; - first = last; - last = aux; - } - - if (dorandom) - *lastport = first + - (arc4random() % (last - first)); - - count = last - first; + error = in_pcb_lport(inp, &laddr, &lport, cred, wild); + if (error != 0) + return (error); - do { - if (count-- < 0) /* completely used? */ - return (EADDRNOTAVAIL); - ++*lastport; - if (*lastport < first || *lastport > last) - *lastport = first; - lport = htons(*lastport); - } while (in_pcblookup_local(pcbinfo, laddr, - lport, wild, cred)); } *laddrp = laddr.s_addr; *lportp = lport; Modified: stable/8/sys/netinet/in_pcb.h ============================================================================== --- stable/8/sys/netinet/in_pcb.h Tue Apr 19 05:59:37 2011 (r220812) +++ stable/8/sys/netinet/in_pcb.h Tue Apr 19 07:23:16 2011 (r220813) @@ -486,6 +486,8 @@ extern struct callout ipport_tick_callou void in_pcbpurgeif0(struct inpcbinfo *, struct ifnet *); int in_pcballoc(struct socket *, struct inpcbinfo *); int in_pcbbind(struct inpcb *, struct sockaddr *, struct ucred *); +int in_pcb_lport(struct inpcb *, struct in_addr *, u_short *, + struct ucred *, int); int in_pcbbind_setup(struct inpcb *, struct sockaddr *, in_addr_t *, u_short *, struct ucred *); int in_pcbconnect(struct inpcb *, struct sockaddr *, struct ucred *); Modified: stable/8/sys/netinet6/in6_src.c ============================================================================== --- stable/8/sys/netinet6/in6_src.c Tue Apr 19 05:59:37 2011 (r220812) +++ stable/8/sys/netinet6/in6_src.c Tue Apr 19 07:23:16 2011 (r220813) @@ -850,9 +850,11 @@ int in6_pcbsetport(struct in6_addr *laddr, struct inpcb *inp, struct ucred *cred) { struct socket *so = inp->inp_socket; - u_int16_t lport = 0, first, last, *lastport; - int count, error, wild = 0, dorandom; + u_int16_t lport = 0; + int error, wild = 0; +#ifdef INVARIANTS struct inpcbinfo *pcbinfo = inp->inp_pcbinfo; +#endif INP_INFO_WLOCK_ASSERT(pcbinfo); INP_WLOCK_ASSERT(inp); @@ -868,71 +870,9 @@ in6_pcbsetport(struct in6_addr *laddr, s inp->inp_flags |= INP_ANONPORT; - if (inp->inp_flags & INP_HIGHPORT) { - first = V_ipport_hifirstauto; /* sysctl */ - last = V_ipport_hilastauto; - lastport = &pcbinfo->ipi_lasthi; - } else if (inp->inp_flags & INP_LOWPORT) { - error = priv_check_cred(cred, PRIV_NETINET_RESERVEDPORT, 0); - if (error) - return error; - first = V_ipport_lowfirstauto; /* 1023 */ - last = V_ipport_lowlastauto; /* 600 */ - lastport = &pcbinfo->ipi_lastlow; - } else { - first = V_ipport_firstauto; /* sysctl */ - last = V_ipport_lastauto; - lastport = &pcbinfo->ipi_lastport; - } - - /* - * For UDP, use random port allocation as long as the user - * allows it. For TCP (and as of yet unknown) connections, - * use random port allocation only if the user allows it AND - * ipport_tick() allows it. - */ - if (V_ipport_randomized && - (!V_ipport_stoprandom || pcbinfo == &V_udbinfo)) - dorandom = 1; - else - dorandom = 0; - /* - * It makes no sense to do random port allocation if - * we have the only port available. - */ - if (first == last) - dorandom = 0; - /* Make sure to not include UDP packets in the count. */ - if (pcbinfo != &V_udbinfo) - V_ipport_tcpallocs++; - - /* - * Instead of having two loops further down counting up or down - * make sure that first is always <= last and go with only one - * code path implementing all logic. - */ - if (first > last) { - u_int16_t aux; - - aux = first; - first = last; - last = aux; - } - - if (dorandom) - *lastport = first + (arc4random() % (last - first)); - - count = last - first; - - do { - if (count-- < 0) /* completely used? */ - return (EADDRNOTAVAIL); - ++*lastport; - if (*lastport < first || *lastport > last) - *lastport = first; - lport = htons(*lastport); - } while (in6_pcblookup_local(pcbinfo, &inp->in6p_laddr, - lport, wild, cred)); + error = in_pcb_lport(inp, NULL, &lport, cred, wild); + if (error != 0) + return (error); inp->inp_lport = lport; if (in_pcbinshash(inp) != 0) { From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 07:36:53 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 881DB1065670; Tue, 19 Apr 2011 07:36:53 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5CEC28FC08; Tue, 19 Apr 2011 07:36:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3J7arGa098477; Tue, 19 Apr 2011 07:36:53 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3J7arv5098475; Tue, 19 Apr 2011 07:36:53 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201104190736.p3J7arv5098475@svn.freebsd.org> From: Ruslan Ermilov Date: Tue, 19 Apr 2011 07:36: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: r220815 - stable/8/sys/nfsclient 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, 19 Apr 2011 07:36:53 -0000 Author: ru Date: Tue Apr 19 07:36:53 2011 New Revision: 220815 URL: http://svn.freebsd.org/changeset/base/220815 Log: MFC r220595: - Fixed nfs_printf() to use vprintf(). - Fixed vfs.nfs.acdebug sysctl's description. - Fixed panic when compiled with NFS_ACDEBUG. Modified: stable/8/sys/nfsclient/nfs_subs.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/nfsclient/nfs_subs.c ============================================================================== --- stable/8/sys/nfsclient/nfs_subs.c Tue Apr 19 07:30:22 2011 (r220814) +++ stable/8/sys/nfsclient/nfs_subs.c Tue Apr 19 07:36:53 2011 (r220815) @@ -442,7 +442,7 @@ nfs_printf(const char *fmt, ...) mtx_lock(&Giant); va_start(ap, fmt); - printf(fmt, ap); + vprintf(fmt, ap); va_end(ap); mtx_unlock(&Giant); } @@ -656,7 +656,7 @@ out: SYSCTL_DECL(_vfs_nfs); static int nfs_acdebug; SYSCTL_INT(_vfs_nfs, OID_AUTO, acdebug, CTLFLAG_RW, &nfs_acdebug, 0, - "Toggle acdebug (access cache debug) flag"); + "Toggle acdebug (attribute cache debug) flag"); #endif /* @@ -713,6 +713,9 @@ nfs_getattrcache(struct vnode *vp, struc if ((time_second - np->n_attrstamp) >= timeo) { nfsstats.attrcache_misses++; mtx_unlock(&np->n_mtx); +#ifdef NFS_ACDEBUG + mtx_unlock(&Giant); /* nfs_printf() */ +#endif KDTRACE_NFS_ATTRCACHE_GET_MISS(vp); return (ENOENT); } From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 07:44:12 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CEE93106566B; Tue, 19 Apr 2011 07:44:12 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BD0D38FC13; Tue, 19 Apr 2011 07:44:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3J7iCMB098670; Tue, 19 Apr 2011 07:44:12 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3J7iC8d098668; Tue, 19 Apr 2011 07:44:12 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201104190744.p3J7iC8d098668@svn.freebsd.org> From: Ruslan Ermilov Date: Tue, 19 Apr 2011 07:44:12 +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: r220816 - stable/8/sys/dev/ipmi 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, 19 Apr 2011 07:44:12 -0000 Author: ru Date: Tue Apr 19 07:44:12 2011 New Revision: 220816 URL: http://svn.freebsd.org/changeset/base/220816 Log: MFC r220614: Fixed firmware revision decoding: - the major is 7-bit binary encoded - the minor is BCD encoded PR: kern/151586 Modified: stable/8/sys/dev/ipmi/ipmi.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/ipmi/ipmi.c ============================================================================== --- stable/8/sys/dev/ipmi/ipmi.c Tue Apr 19 07:36:53 2011 (r220815) +++ stable/8/sys/dev/ipmi/ipmi.c Tue Apr 19 07:44:12 2011 (r220816) @@ -713,10 +713,10 @@ ipmi_startup(void *arg) return; } - device_printf(dev, "IPMI device rev. %d, firmware rev. %d.%d, " + device_printf(dev, "IPMI device rev. %d, firmware rev. %d.%d%d, " "version %d.%d\n", req->ir_reply[1] & 0x0f, - req->ir_reply[2] & 0x0f, req->ir_reply[4], + req->ir_reply[2] & 0x7f, req->ir_reply[3] >> 4, req->ir_reply[3] & 0x0f, req->ir_reply[4] & 0x0f, req->ir_reply[4] >> 4); ipmi_free_request(req); From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 07:53:05 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 074AE106564A; Tue, 19 Apr 2011 07:53:05 +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 E97788FC08; Tue, 19 Apr 2011 07:53:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3J7r40C099014; Tue, 19 Apr 2011 07:53:04 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3J7r4aE099012; Tue, 19 Apr 2011 07:53:04 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201104190753.p3J7r4aE099012@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 19 Apr 2011 07:53: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: r220819 - 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, 19 Apr 2011 07:53:05 -0000 Author: bz Date: Tue Apr 19 07:53:04 2011 New Revision: 220819 URL: http://svn.freebsd.org/changeset/base/220819 Log: MFC r219779: Properly check for an IPv4 socket after r219579. In some cases as udp6_connect() without an earlier bind(2) to an address, v4-mapped sockets allowed and a non mapped destination address, we can end up here with both v4 and v6 indicated: inp_vflag = (INP_IPV4|INP_IPV6|INP_IPV6PROTO) In that case however laddrp is NULL as the IPv6 path does not pass in a copy currently. Reported by: Pawel Worach (pawel.worach gmail.com) Tested by: Pawel Worach (pawel.worach gmail.com) Modified: stable/8/sys/netinet/in_pcb.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/netinet/in_pcb.c ============================================================================== --- stable/8/sys/netinet/in_pcb.c Tue Apr 19 07:49:58 2011 (r220818) +++ stable/8/sys/netinet/in_pcb.c Tue Apr 19 07:53:04 2011 (r220819) @@ -346,7 +346,7 @@ in_pcb_lport(struct inpcb *inp, struct i #ifdef INET /* Make the compiler happy. */ laddr.s_addr = 0; - if ((inp->inp_vflag & INP_IPV4) != 0) { + if ((inp->inp_vflag & (INP_IPV4|INP_IPV6)) == INP_IPV4) { KASSERT(laddrp != NULL, ("%s: laddrp NULL for v4 inp %p", __func__, inp)); laddr = *laddrp; @@ -382,7 +382,7 @@ in_pcb_lport(struct inpcb *inp, struct i } while (tmpinp != NULL); #ifdef INET - if ((inp->inp_vflag & INP_IPV4) != 0) + if ((inp->inp_vflag & (INP_IPV4|INP_IPV6)) == INP_IPV4) laddrp->s_addr = laddr.s_addr; #endif *lportp = lport; From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 07:54:21 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 984AB106566C; Tue, 19 Apr 2011 07:54:21 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 865148FC08; Tue, 19 Apr 2011 07:54:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3J7sLkp099078; Tue, 19 Apr 2011 07:54:21 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3J7sL5q099076; Tue, 19 Apr 2011 07:54:21 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201104190754.p3J7sL5q099076@svn.freebsd.org> From: Ruslan Ermilov Date: Tue, 19 Apr 2011 07:54:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220820 - stable/8/usr.bin/nfsstat 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, 19 Apr 2011 07:54:21 -0000 Author: ru Date: Tue Apr 19 07:54:21 2011 New Revision: 220820 URL: http://svn.freebsd.org/changeset/base/220820 Log: MFC r220596: Show client's access cache statistics. Modified: stable/8/usr.bin/nfsstat/nfsstat.c Directory Properties: stable/8/usr.bin/nfsstat/ (props changed) Modified: stable/8/usr.bin/nfsstat/nfsstat.c ============================================================================== --- stable/8/usr.bin/nfsstat/nfsstat.c Tue Apr 19 07:53:04 2011 (r220819) +++ stable/8/usr.bin/nfsstat/nfsstat.c Tue Apr 19 07:54:21 2011 (r220820) @@ -325,14 +325,15 @@ intpr(int clientOnly, int serverOnly) nfsstats.write_bios); printf("%9.9s %9.9s %9.9s %9.9s", "BioRLHits", "Misses", "BioD Hits", "Misses"); - printf(" %9.9s %9.9s\n", "DirE Hits", "Misses"); + printf(" %9.9s %9.9s %9.9s %9.9s\n", "DirE Hits", "Misses", "Accs Hits", "Misses"); printf("%9d %9d %9d %9d", nfsstats.biocache_readlinks-nfsstats.readlink_bios, nfsstats.readlink_bios, nfsstats.biocache_readdirs-nfsstats.readdir_bios, nfsstats.readdir_bios); - printf(" %9d %9d\n", - nfsstats.direofcache_hits, nfsstats.direofcache_misses); + printf(" %9d %9d %9d %9d\n", + nfsstats.direofcache_hits, nfsstats.direofcache_misses, + nfsstats.accesscache_hits, nfsstats.accesscache_misses); } if (serverOnly && !nfsrvstatsp) { printf("Server not present!\n"); From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 08:17:21 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E77E1065672; Tue, 19 Apr 2011 08:17:21 +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 E64578FC19; Tue, 19 Apr 2011 08:17:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3J8HKG0099731; Tue, 19 Apr 2011 08:17:20 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3J8HKgS099729; Tue, 19 Apr 2011 08:17:20 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201104190817.p3J8HKgS099729@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 19 Apr 2011 08:17:20 +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: r220823 - 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, 19 Apr 2011 08:17:21 -0000 Author: bz Date: Tue Apr 19 08:17:20 2011 New Revision: 220823 URL: http://svn.freebsd.org/changeset/base/220823 Log: MFC r220462: After r219579 and r219779 unbreak v4-mapped v6 sockets for UDP some more. Similar to what we do for TCP check for v4-mapped addresses and then handle them or the normal v6 address case. For either set inp_vflags before calling into the pcb connect function so that we have an unambiguous view in case we need to set the local address or port. Looked at: tuexen (as part of more) Modified: stable/8/sys/netinet6/udp6_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/netinet6/udp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/udp6_usrreq.c Tue Apr 19 08:01:17 2011 (r220822) +++ stable/8/sys/netinet6/udp6_usrreq.c Tue Apr 19 08:17:20 2011 (r220823) @@ -909,43 +909,41 @@ udp6_connect(struct socket *so, struct s INP_INFO_WLOCK(&V_udbinfo); INP_WLOCK(inp); - if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0 && - IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { + if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { struct sockaddr_in sin; + if ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0) { + error = EINVAL; + goto out; + } if (inp->inp_faddr.s_addr != INADDR_ANY) { error = EISCONN; goto out; } in6_sin6_2_sin(&sin, sin6); + inp->inp_vflag |= INP_IPV4; + inp->inp_vflag &= ~INP_IPV6; error = prison_remote_ip4(td->td_ucred, &sin.sin_addr); if (error != 0) goto out; error = in_pcbconnect(inp, (struct sockaddr *)&sin, td->td_ucred); - if (error == 0) { - inp->inp_vflag |= INP_IPV4; - inp->inp_vflag &= ~INP_IPV6; + if (error == 0) soisconnected(so); - } goto out; } if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) { error = EISCONN; goto out; } + inp->inp_vflag &= ~INP_IPV4; + inp->inp_vflag |= INP_IPV6; error = prison_remote_ip6(td->td_ucred, &sin6->sin6_addr); if (error != 0) goto out; error = in6_pcbconnect(inp, nam, td->td_ucred); - if (error == 0) { - if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) { - /* should be non mapped addr */ - inp->inp_vflag &= ~INP_IPV4; - inp->inp_vflag |= INP_IPV6; - } + if (error == 0) soisconnected(so); - } out: INP_WUNLOCK(inp); INP_INFO_WUNLOCK(&V_udbinfo); From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 08:29:28 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B62E1065670; Tue, 19 Apr 2011 08:29:28 +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 5F3438FC1C; Tue, 19 Apr 2011 08:29:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3J8TS9V000158; Tue, 19 Apr 2011 08:29:28 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3J8TSDG000156; Tue, 19 Apr 2011 08:29:28 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201104190829.p3J8TSDG000156@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 19 Apr 2011 08:29: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: r220825 - 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, 19 Apr 2011 08:29:28 -0000 Author: bz Date: Tue Apr 19 08:29:28 2011 New Revision: 220825 URL: http://svn.freebsd.org/changeset/base/220825 Log: MFC r220463: Remove a check in udp6_send() that prevented v4-mapped v6 addresses from working. We store v4 and v6 addresses as a union but for v4-mapped addresses only store the 32bits w/o the ::ffff: word. That failed the check as for example 127.0.0.1 would be ::7f00:1 rather than ::ffff:7f00:1 and the IN6_IS_ADDR_V4MAPPED() never worked here. Given we can hardly get here with an unbound local address or invalid inp_vflags remove the check. Reported by: tuexen Reviewed by: tuexen Modified: stable/8/sys/netinet6/udp6_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/netinet6/udp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/udp6_usrreq.c Tue Apr 19 08:17:36 2011 (r220824) +++ stable/8/sys/netinet6/udp6_usrreq.c Tue Apr 19 08:29:28 2011 (r220825) @@ -1045,18 +1045,6 @@ udp6_send(struct socket *so, int flags, if (hasv4addr) { struct pr_usrreqs *pru; - if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) && - !IN6_IS_ADDR_V4MAPPED(&inp->in6p_laddr)) { - /* - * When remote addr is IPv4-mapped address, - * local addr should not be an IPv6 address; - * since you cannot determine how to map IPv6 - * source address to IPv4. - */ - error = EINVAL; - goto out; - } - /* * XXXRW: We release UDP-layer locks before calling * udp_send() in order to avoid recursion. However, @@ -1080,7 +1068,6 @@ udp6_send(struct socket *so, int flags, mac_inpcb_create_mbuf(inp, m); #endif error = udp6_output(inp, m, addr, control, td); -out: INP_WUNLOCK(inp); INP_INFO_WUNLOCK(&V_udbinfo); return (error); From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 08:56:26 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A94E61065674; Tue, 19 Apr 2011 08:56:26 +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 974D68FC1B; Tue, 19 Apr 2011 08:56:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3J8uQNT000944; Tue, 19 Apr 2011 08:56:26 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3J8uQWw000942; Tue, 19 Apr 2011 08:56:26 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201104190856.p3J8uQWw000942@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 19 Apr 2011 08:56: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: r220828 - 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, 19 Apr 2011 08:56:26 -0000 Author: bz Date: Tue Apr 19 08:56:26 2011 New Revision: 220828 URL: http://svn.freebsd.org/changeset/base/220828 Log: MFC r220619: The mbuf_frag_size always was and is file local and not queried from base user space tools via kvm. Mark it static. Modified: stable/8/sys/netinet/ip_output.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/netinet/ip_output.c ============================================================================== --- stable/8/sys/netinet/ip_output.c Tue Apr 19 08:56:09 2011 (r220827) +++ stable/8/sys/netinet/ip_output.c Tue Apr 19 08:56:26 2011 (r220828) @@ -93,7 +93,7 @@ __FBSDID("$FreeBSD$"); VNET_DEFINE(u_short, ip_id); #ifdef MBUF_STRESS_TEST -int mbuf_frag_size = 0; +static int mbuf_frag_size = 0; SYSCTL_INT(_net_inet_ip, OID_AUTO, mbuf_frag_size, CTLFLAG_RW, &mbuf_frag_size, 0, "Fragment outgoing mbufs to this size"); #endif From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 16:10:08 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9638F1065676; Tue, 19 Apr 2011 16:10: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 855878FC17; Tue, 19 Apr 2011 16:10:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JGA8IX013133; Tue, 19 Apr 2011 16:10:08 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JGA8t3013131; Tue, 19 Apr 2011 16:10:08 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104191610.p3JGA8t3013131@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Apr 2011 16:10: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: r220838 - 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: Tue, 19 Apr 2011 16:10:08 -0000 Author: mav Date: Tue Apr 19 16:10:08 2011 New Revision: 220838 URL: http://svn.freebsd.org/changeset/base/220838 Log: MFC r214989: When requesting sense data for SIM not doing it automatically (such as ATAPI or USB), request only as much data as requested by consumer. On the way back -- report how much sense data we have actually received. Modified: stable/8/sys/cam/cam_periph.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/cam/cam_periph.c ============================================================================== --- stable/8/sys/cam/cam_periph.c Tue Apr 19 15:06:33 2011 (r220837) +++ stable/8/sys/cam/cam_periph.c Tue Apr 19 16:10:08 2011 (r220838) @@ -1055,6 +1055,7 @@ camperiphsensedone(struct cam_periph *pe saved_ccb->ccb_h.status |= CAM_AUTOSENSE_FAIL; } + saved_ccb->csio.sense_resid = done_ccb->csio.resid; bcopy(saved_ccb, done_ccb, sizeof(union ccb)); xpt_free_ccb(saved_ccb); break; @@ -1211,7 +1212,7 @@ camperiphdone(struct cam_periph *periph, scsi_request_sense(&done_ccb->csio, /*retries*/1, camperiphsensedone, &save_ccb->csio.sense_data, - sizeof(save_ccb->csio.sense_data), + save_ccb->csio.sense_len, CAM_TAG_ACTION_NONE, /*sense_len*/SSD_FULL_SIZE, /*timeout*/5000); @@ -1602,7 +1603,7 @@ camperiphscsisenseerror(union ccb *ccb, scsi_request_sense(&ccb->csio, /*retries*/1, camperiphsensedone, &orig_ccb->csio.sense_data, - sizeof(orig_ccb->csio.sense_data), + orig_ccb->csio.sense_len, CAM_TAG_ACTION_NONE, /*sense_len*/SSD_FULL_SIZE, /*timeout*/5000); From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 16:23:08 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13C861065673; Tue, 19 Apr 2011 16:23: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 0075E8FC12; Tue, 19 Apr 2011 16:23:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JGN7bg013565; Tue, 19 Apr 2011 16:23:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JGN7O3013560; Tue, 19 Apr 2011 16:23:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104191623.p3JGN7O3013560@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Apr 2011 16:23: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: r220841 - in stable/8: share/man/man4 sys/cam/ata sys/conf sys/modules/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: Tue, 19 Apr 2011 16:23:08 -0000 Author: mav Date: Tue Apr 19 16:23:07 2011 New Revision: 220841 URL: http://svn.freebsd.org/changeset/base/220841 Log: MFC r220412, r220414, r220454, r220618, r220814: - Make ada(4) driver to control device write cache, same as ata(4) does. Add kern.cam.ada.write_cache sysctl/tunable to control it alike hw.ata.wc. - Add kern.cam.ada.X.write_cache tunables/sysctls to control write caching on per-device basis. - While adding support for per-device sysctls, merge from graid branch support for ADA_TEST_FAILURE kernel option, which opens few more sysctl, allowing to simulate read and write errors for testing purposes. Modified: stable/8/share/man/man4/ada.4 stable/8/sys/cam/ata/ata_da.c stable/8/sys/conf/options stable/8/sys/modules/cam/Makefile Directory Properties: stable/8/share/man/man4/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/share/man/man4/ada.4 ============================================================================== --- stable/8/share/man/man4/ada.4 Tue Apr 19 16:21:57 2011 (r220840) +++ stable/8/share/man/man4/ada.4 Tue Apr 19 16:23:07 2011 (r220841) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 24, 2010 +.Dd April 8, 2011 .Dt ADA 4 .Os .Sh NAME @@ -101,7 +101,7 @@ variables and .Xr loader 8 tunables: .Bl -tag -width 12 -.It kern.cam.ada.retry_count +.It Va kern.cam.ada.retry_count .Pp This variable determines how many times the .Nm @@ -111,18 +111,27 @@ the .Nm driver dump routine. This value currently defaults to 4. -.It kern.cam.ada.default_timeout +.It Va kern.cam.ada.default_timeout .Pp This variable determines how long the .Nm driver will wait before timing out an outstanding command. The units for this value are seconds, and the default is currently 30 seconds. -.It kern.cam.ada.spindown_shutdown +.It Va kern.cam.ada.spindown_shutdown .Pp This variable determines whether to spin-down disks when shutting down. Set to 1 to enable spin-down, 0 to disable. The default is currently enabled. +.It Va kern.cam.ada.write_cache +.It Va kern.cam.ada. Ns Ar X Ns Va .write_cache +.Pp +These variables determines whether device write cache should be enabled +globally or per-device or disabled. +Set to 1 to enable write cache, 0 to disable, -1 to leave it as-is. +Values modified in runtime take effect only after device reset. +The global default is currently enabled. +The per-device default is to leave it as-is (follow global setting). .El .Sh FILES .Bl -tag -width ".Pa /dev/ada*" -compact Modified: stable/8/sys/cam/ata/ata_da.c ============================================================================== --- stable/8/sys/cam/ata/ata_da.c Tue Apr 19 16:21:57 2011 (r220840) +++ stable/8/sys/cam/ata/ata_da.c Tue Apr 19 16:23:07 2011 (r220841) @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_ada.h" + #include #ifdef _KERNEL @@ -66,6 +68,7 @@ __FBSDID("$FreeBSD$"); #define ATA_MAX_28BIT_LBA 268435455UL typedef enum { + ADA_STATE_WCACHE, ADA_STATE_NORMAL } ada_state; @@ -89,6 +92,7 @@ typedef enum { } ada_quirks; typedef enum { + ADA_CCB_WCACHE = 0x01, ADA_CCB_BUFFER_IO = 0x03, ADA_CCB_WAITING = 0x04, ADA_CCB_DUMP = 0x05, @@ -125,6 +129,13 @@ struct ada_softc { int outstanding_cmds; int trim_max_ranges; int trim_running; + int write_cache; +#ifdef ADA_TEST_FAILURE + int force_read_error; + int force_write_error; + int periodic_read_error; + int periodic_read_count; +#endif struct disk_params params; struct disk *disk; struct task sysctl_task; @@ -186,6 +197,10 @@ static void adashutdown(void *arg, int #define ADA_DEFAULT_SPINDOWN_SHUTDOWN 1 #endif +#ifndef ADA_DEFAULT_WRITE_CACHE +#define ADA_DEFAULT_WRITE_CACHE 1 +#endif + /* * Most platforms map firmware geometry to actual, but some don't. If * not overridden, default to nothing. @@ -198,6 +213,7 @@ static int ada_retry_count = ADA_DEFAULT static int ada_default_timeout = ADA_DEFAULT_TIMEOUT; static int ada_send_ordered = ADA_DEFAULT_SEND_ORDERED; static int ada_spindown_shutdown = ADA_DEFAULT_SPINDOWN_SHUTDOWN; +static int ada_write_cache = ADA_DEFAULT_WRITE_CACHE; SYSCTL_NODE(_kern_cam, OID_AUTO, ada, CTLFLAG_RD, 0, "CAM Direct Access Disk driver"); @@ -213,6 +229,9 @@ TUNABLE_INT("kern.cam.ada.ada_send_order SYSCTL_INT(_kern_cam_ada, OID_AUTO, spindown_shutdown, CTLFLAG_RW, &ada_spindown_shutdown, 0, "Spin down upon shutdown"); TUNABLE_INT("kern.cam.ada.spindown_shutdown", &ada_spindown_shutdown); +SYSCTL_INT(_kern_cam_ada, OID_AUTO, write_cache, CTLFLAG_RW, + &ada_write_cache, 0, "Enable disk write cache"); +TUNABLE_INT("kern.cam.ada.write_cache", &ada_write_cache); /* * ADA_ORDEREDTAG_INTERVAL determines how often, relative @@ -568,6 +587,7 @@ adaasync(void *callback_arg, u_int32_t c struct cam_path *path, void *arg) { struct cam_periph *periph; + struct ada_softc *softc; periph = (struct cam_periph *)callback_arg; switch (code) { @@ -600,6 +620,28 @@ adaasync(void *callback_arg, u_int32_t c "due to status 0x%x\n", status); 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 (ada_write_cache < 0 && softc->write_cache < 0) + break; + if (softc->state != ADA_STATE_NORMAL) + break; + 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.support.command1 & ATA_SUPPORT_WRITECACHE) == 0) + break; + softc->state = ADA_STATE_WCACHE; + cam_periph_acquire(periph); + cam_freeze_devq_arg(periph->path, + RELSIM_RELEASE_RUNLEVEL, CAM_RL_DEV + 1); + xpt_schedule(periph, CAM_PRIORITY_DEV); + } default: cam_periph_async(periph, code, path, arg); break; @@ -614,8 +656,12 @@ adasysctlinit(void *context, int pending char tmpstr[80], tmpstr2[80]; periph = (struct cam_periph *)context; - if (cam_periph_acquire(periph) != CAM_REQ_CMP) + + /* periph was held for us when this task was enqueued */ + if (periph->flags & CAM_PERIPH_INVALID) { + cam_periph_release(periph); return; + } softc = (struct ada_softc *)periph->softc; snprintf(tmpstr, sizeof(tmpstr), "CAM ADA unit %d", periph->unit_number); @@ -632,6 +678,28 @@ adasysctlinit(void *context, int pending return; } + SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "write_cache", CTLFLAG_RW | CTLFLAG_MPSAFE, + &softc->write_cache, 0, "Enable disk write cache."); +#ifdef ADA_TEST_FAILURE + /* + * Add a 'door bell' sysctl which allows one to set it from userland + * and cause something bad to happen. For the moment, we only allow + * whacking the next read or write. + */ + SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "force_read_error", CTLFLAG_RW | CTLFLAG_MPSAFE, + &softc->force_read_error, 0, + "Force a read error for the next N reads."); + SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "force_write_error", CTLFLAG_RW | CTLFLAG_MPSAFE, + &softc->force_write_error, 0, + "Force a write error for the next N writes."); + SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "periodic_read_error", CTLFLAG_RW | CTLFLAG_MPSAFE, + &softc->periodic_read_error, 0, + "Force a read error every N reads (don't set too low)."); +#endif cam_periph_release(periph); } @@ -691,7 +759,6 @@ adaregister(struct cam_periph *periph, v } if (cgd->ident_data.support.command2 & ATA_SUPPORT_CFA) softc->flags |= ADA_FLAG_CAN_CFA; - softc->state = ADA_STATE_NORMAL; periph->softc = softc; @@ -717,7 +784,12 @@ adaregister(struct cam_periph *periph, v /* * Register this media as a disk */ + (void)cam_periph_hold(periph, PRIBIO); mtx_unlock(periph->sim->mtx); + softc->write_cache = -1; + snprintf(announce_buf, sizeof(announce_buf), + "kern.cam.ada.%d.write_cache", periph->unit_number); + TUNABLE_INT_FETCH(announce_buf, &softc->write_cache); adagetparams(periph, cgd); softc->disk = disk_alloc(); softc->disk->d_open = adaopen; @@ -764,6 +836,7 @@ adaregister(struct cam_periph *periph, v disk_create(softc->disk, DISK_VERSION); mtx_lock(periph->sim->mtx); + cam_periph_unhold(periph); dp = &softc->params; snprintf(announce_buf, sizeof(announce_buf), @@ -774,6 +847,14 @@ adaregister(struct cam_periph *periph, v dp->secsize, dp->heads, dp->secs_per_track, dp->cylinders); xpt_announce_periph(periph, announce_buf); + + /* + * Create our sysctl variables, now that we know + * we have successfully attached. + */ + cam_periph_acquire(periph); + taskqueue_enqueue(taskqueue_thread, &softc->sysctl_task); + /* * Add async callbacks for bus reset and * bus device reset calls. I don't bother @@ -782,7 +863,7 @@ adaregister(struct cam_periph *periph, v * them and the only alternative would be to * not attach the device on failure. */ - xpt_register_async(AC_LOST_DEVICE, + xpt_register_async(AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE, adaasync, periph, periph->path); /* @@ -794,6 +875,16 @@ adaregister(struct cam_periph *periph, v (ADA_DEFAULT_TIMEOUT * hz) / ADA_ORDEREDTAG_INTERVAL, adasendorderedtag, softc); + if ((ada_write_cache >= 0 || softc->write_cache >= 0) && + cgd->ident_data.support.command1 & ATA_SUPPORT_WRITECACHE) { + softc->state = ADA_STATE_WCACHE; + cam_periph_acquire(periph); + cam_freeze_devq_arg(periph->path, + RELSIM_RELEASE_RUNLEVEL, CAM_RL_DEV + 1); + xpt_schedule(periph, CAM_PRIORITY_DEV); + } else + softc->state = ADA_STATE_NORMAL; + return(CAM_REQ_CMP); } @@ -896,7 +987,45 @@ adastart(struct cam_periph *periph, unio { uint64_t lba = bp->bio_pblkno; uint16_t count = bp->bio_bcount / softc->params.secsize; +#ifdef ADA_TEST_FAILURE + int fail = 0; + /* + * Support the failure ioctls. If the command is a + * read, and there are pending forced read errors, or + * if a write and pending write errors, then fail this + * operation with EIO. This is useful for testing + * purposes. Also, support having every Nth read fail. + * + * This is a rather blunt tool. + */ + if (bp->bio_cmd == BIO_READ) { + if (softc->force_read_error) { + softc->force_read_error--; + fail = 1; + } + if (softc->periodic_read_error > 0) { + if (++softc->periodic_read_count >= + softc->periodic_read_error) { + softc->periodic_read_count = 0; + fail = 1; + } + } + } else { + if (softc->force_write_error) { + softc->force_write_error--; + fail = 1; + } + } + if (fail) { + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; + biodone(bp); + xpt_release_ccb(start_ccb); + adaschedule(periph); + return; + } +#endif cam_fill_ataio(ataio, ada_retry_count, adadone, @@ -1003,6 +1132,24 @@ out: adaschedule(periph); break; } + case ADA_STATE_WCACHE: + { + cam_fill_ataio(ataio, + 1, + adadone, + CAM_DIR_NONE, + 0, + NULL, + 0, + ada_default_timeout*1000); + + ata_28bit_cmd(ataio, ATA_SETFEATURES, (softc->write_cache > 0 || + (softc->write_cache < 0 && ada_write_cache)) ? + ATA_SF_ENAB_WCACHE : ATA_SF_DIS_WCACHE, 0, 0); + start_ccb->ccb_h.ccb_state = ADA_CCB_WCACHE; + xpt_action(start_ccb); + break; + } } } @@ -1091,6 +1238,36 @@ adadone(struct cam_periph *periph, union biodone(bp); break; } + case ADA_CCB_WCACHE: + { + if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if (adaerror(done_ccb, 0, 0) == ERESTART) { + return; + } else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { + cam_release_devq(done_ccb->ccb_h.path, + /*relsim_flags*/0, + /*reduction*/0, + /*timeout*/0, + /*getcount_only*/0); + } + } + + softc->state = ADA_STATE_NORMAL; + /* + * Since our peripheral may be invalidated by an error + * above or an external event, we must release our CCB + * before releasing the reference on the peripheral. + * The peripheral will only go away once the last reference + * is removed, and we need it around for the CCB release + * operation. + */ + xpt_release_ccb(done_ccb); + cam_release_devq(periph->path, + RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_DEV + 1, FALSE); + adaschedule(periph); + cam_periph_release_locked(periph); + return; + } case ADA_CCB_WAITING: { /* Caller will release the CCB */ Modified: stable/8/sys/conf/options ============================================================================== --- stable/8/sys/conf/options Tue Apr 19 16:21:57 2011 (r220840) +++ stable/8/sys/conf/options Tue Apr 19 16:23:07 2011 (r220841) @@ -302,6 +302,9 @@ SCSI_DELAY opt_scsi.h SCSI_NO_SENSE_STRINGS opt_scsi.h SCSI_NO_OP_STRINGS opt_scsi.h +# Options used only in cam/ata/ata_da.c +ADA_TEST_FAILURE opt_ada.h + # Options used only in cam/scsi/scsi_cd.c CHANGER_MIN_BUSY_SECONDS opt_cd.h CHANGER_MAX_BUSY_SECONDS opt_cd.h Modified: stable/8/sys/modules/cam/Makefile ============================================================================== --- stable/8/sys/modules/cam/Makefile Tue Apr 19 16:21:57 2011 (r220840) +++ stable/8/sys/modules/cam/Makefile Tue Apr 19 16:23:07 2011 (r220841) @@ -8,6 +8,7 @@ KMOD= cam # See sys/conf/options for the flags that go into the different opt_*.h files. SRCS= opt_cam.h +SRCS+= opt_ada.h SRCS+= opt_scsi.h SRCS+= opt_cd.h SRCS+= opt_pt.h From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 16:26:55 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF9921065674; Tue, 19 Apr 2011 16:26:55 +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 DE9A58FC1F; Tue, 19 Apr 2011 16:26:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JGQt7g013721; Tue, 19 Apr 2011 16:26:55 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JGQtT0013719; Tue, 19 Apr 2011 16:26:55 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104191626.p3JGQtT0013719@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Apr 2011 16:26: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: r220842 - 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: Tue, 19 Apr 2011 16:26:56 -0000 Author: mav Date: Tue Apr 19 16:26:55 2011 New Revision: 220842 URL: http://svn.freebsd.org/changeset/base/220842 Log: MFC r220616: Properly log few more ATA commands used by the kernel. Modified: stable/8/sys/cam/ata/ata_all.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/cam/ata/ata_all.c ============================================================================== --- stable/8/sys/cam/ata/ata_all.c Tue Apr 19 16:23:07 2011 (r220841) +++ stable/8/sys/cam/ata/ata_all.c Tue Apr 19 16:26:55 2011 (r220842) @@ -72,6 +72,8 @@ char * ata_op_string(struct ata_cmd *cmd) { + if (cmd->control & 0x04) + return ("SOFT_RESET"); switch (cmd->command) { case 0x00: return ("NOP"); case 0x03: return ("CFA_REQUEST_EXTENDED_ERROR"); @@ -149,6 +151,8 @@ ata_op_string(struct ata_cmd *cmd) case 0x06: return ("SETFEATURES ENABLE PUIS"); case 0x86: return ("SETFEATURES DISABLE PUIS"); case 0x07: return ("SETFEATURES SPIN-UP"); + case 0x10: return ("SETFEATURES ENABLE SATA FEATURE"); + case 0x90: return ("SETFEATURES DISABLE SATA FEATURE"); case 0xaa: return ("SETFEATURES ENABLE RCACHE"); case 0x55: return ("SETFEATURES DISABLE RCACHE"); } From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 16:29:56 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B2F31065670; Tue, 19 Apr 2011 16:29:56 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 788FF8FC13; Tue, 19 Apr 2011 16:29:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JGTunG013835; Tue, 19 Apr 2011 16:29:56 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JGTur4013827; Tue, 19 Apr 2011 16:29:56 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201104191629.p3JGTur4013827@svn.freebsd.org> From: Sergey Kandaurov Date: Tue, 19 Apr 2011 16:29: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: r220843 - in stable/8: lib/libc/gen sbin/reboot share/man/man4 share/man/man5 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, 19 Apr 2011 16:29:56 -0000 Author: pluknet Date: Tue Apr 19 16:29:56 2011 New Revision: 220843 URL: http://svn.freebsd.org/changeset/base/220843 Log: MFC r220617: Remove vestiges of disklabel(5). Modified: stable/8/lib/libc/gen/getdiskbyname.3 stable/8/sbin/reboot/boot_i386.8 stable/8/share/man/man4/cd.4 stable/8/share/man/man4/md.4 stable/8/share/man/man4/vinum.4 stable/8/share/man/man5/disktab.5 Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/sbin/reboot/ (props changed) stable/8/share/man/man4/ (props changed) stable/8/share/man/man5/ (props changed) Modified: stable/8/lib/libc/gen/getdiskbyname.3 ============================================================================== --- stable/8/lib/libc/gen/getdiskbyname.3 Tue Apr 19 16:26:55 2011 (r220842) +++ stable/8/lib/libc/gen/getdiskbyname.3 Tue Apr 19 16:29:56 2011 (r220843) @@ -54,7 +54,6 @@ the .Xr disktab 5 file. .Sh SEE ALSO -.Xr disklabel 5 , .Xr disktab 5 , .Xr disklabel 8 .Sh HISTORY Modified: stable/8/sbin/reboot/boot_i386.8 ============================================================================== --- stable/8/sbin/reboot/boot_i386.8 Tue Apr 19 16:26:55 2011 (r220842) +++ stable/8/sbin/reboot/boot_i386.8 Tue Apr 19 16:29:56 2011 (r220843) @@ -358,9 +358,7 @@ requirement has not been adhered to. .Xr reboot 8 , .Xr shutdown 8 .Sh BUGS -The -.Xr bsdlabel 5 -format used by this version of +The bsdlabel format used by this version of .Bx is quite different from that of other architectures. Modified: stable/8/share/man/man4/cd.4 ============================================================================== --- stable/8/share/man/man4/cd.4 Tue Apr 19 16:26:55 2011 (r220842) +++ stable/8/share/man/man4/cd.4 Tue Apr 19 16:29:56 2011 (r220843) @@ -112,8 +112,8 @@ drive. The disklabel is initialized with information read from the scsi inquiry commands, and should be the same as the information printed at boot. -This structure is defined in -.Xr disklabel 5 . +This structure is defined in the header file +.In sys/disklabel.h . .It Dv CDIOCCAPABILITY .Pq Li "struct ioc_capability" Retrieve information from the drive on what features it supports. @@ -498,7 +498,6 @@ None. .Sh SEE ALSO .Xr cam 4 , .Xr da 4 , -.Xr disklabel 5 , .Xr disklabel 8 , .Xr cd 9 .Sh HISTORY Modified: stable/8/share/man/man4/md.4 ============================================================================== --- stable/8/share/man/man4/md.4 Tue Apr 19 16:26:55 2011 (r220842) +++ stable/8/share/man/man4/md.4 Tue Apr 19 16:29:56 2011 (r220843) @@ -81,7 +81,6 @@ disk found in the man page. Other tools will also create these images, such as NanoBSD. .Sh SEE ALSO -.Xr disklabel 5 , .Xr disklabel 8 , .Xr fdisk 8 , .Xr loader 8 , Modified: stable/8/share/man/man4/vinum.4 ============================================================================== --- stable/8/share/man/man4/vinum.4 Tue Apr 19 16:26:55 2011 (r220842) +++ stable/8/share/man/man4/vinum.4 Tue Apr 19 16:29:56 2011 (r220843) @@ -359,9 +359,6 @@ They are described in the header file Conventional disk special devices have a .Em "disk label" in the second sector of the device. -See -.Xr disklabel 5 -for more details. This disk label describes the layout of the partitions within the device. .Nm @@ -842,7 +839,6 @@ The drive is not accessible. The drive is up and running. .El .Sh SEE ALSO -.Xr disklabel 5 , .Xr loader.conf 5 , .Xr disklabel 8 , .Xr gvinum 8 , Modified: stable/8/share/man/man5/disktab.5 ============================================================================== --- stable/8/share/man/man5/disktab.5 Tue Apr 19 16:26:55 2011 (r220842) +++ stable/8/share/man/man5/disktab.5 Tue Apr 19 16:29:56 2011 (r220843) @@ -134,7 +134,6 @@ file system, swap, etc) .El .Sh SEE ALSO .Xr getdiskbyname 3 , -.\" .Xr bsdlabel 5 , .Xr bsdlabel 8 , .Xr newfs 8 .Sh HISTORY From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 16:33:08 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 696C61065670; Tue, 19 Apr 2011 16:33:08 +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 576578FC1E; Tue, 19 Apr 2011 16:33:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JGX8OI014101; Tue, 19 Apr 2011 16:33:08 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JGX8m0014098; Tue, 19 Apr 2011 16:33:08 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <201104191633.p3JGX8m0014098@svn.freebsd.org> From: Maksim Yevmenkin Date: Tue, 19 Apr 2011 16:33: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: r220845 - stable/8/usr.sbin/bluetooth/l2ping 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, 19 Apr 2011 16:33:08 -0000 Author: emax Date: Tue Apr 19 16:33:08 2011 New Revision: 220845 URL: http://svn.freebsd.org/changeset/base/220845 Log: MFC r220116 Do not use word 'flood' as it not entirely correct. Use better 'no delay' description. While here, replace atoi(3) with strtol(3). Submitted by: arundel Modified: stable/8/usr.sbin/bluetooth/l2ping/l2ping.8 stable/8/usr.sbin/bluetooth/l2ping/l2ping.c Directory Properties: stable/8/usr.sbin/bluetooth/l2ping/ (props changed) Modified: stable/8/usr.sbin/bluetooth/l2ping/l2ping.8 ============================================================================== --- stable/8/usr.sbin/bluetooth/l2ping/l2ping.8 Tue Apr 19 16:30:17 2011 (r220844) +++ stable/8/usr.sbin/bluetooth/l2ping/l2ping.8 Tue Apr 19 16:33:08 2011 (r220845) @@ -25,7 +25,7 @@ .\" $Id: l2ping.8,v 1.3 2003/05/21 01:00:19 max Exp $ .\" $FreeBSD$ .\" -.Dd June 14, 2002 +.Dd March 29, 2011 .Dt L2PING 8 .Os .Sh NAME @@ -36,7 +36,7 @@ .Op Fl fhn .Fl a Ar remote .Op Fl c Ar count -.Op Fl i Ar delay +.Op Fl i Ar wait .Op Fl S Ar source .Op Fl s Ar size .Sh DESCRIPTION @@ -63,8 +63,7 @@ If this option is not specified, .Nm will operate until interrupted. .It Fl f -.Dq Flood -ping, i.e., no delay between packets. +Don't wait between sending each packet. .It Fl h Display usage message and exit. .It Fl i Ar wait @@ -109,7 +108,7 @@ Some implementations may not like large .Xr ng_l2cap 4 , .Xr l2control 8 .Sh AUTHORS -.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com +.An Maksim Yevmenkin Aq emax@FreeBSD.org .Sh BUGS Could collect more statistic. Could check for duplicated, corrupted and lost packets. Modified: stable/8/usr.sbin/bluetooth/l2ping/l2ping.c ============================================================================== --- stable/8/usr.sbin/bluetooth/l2ping/l2ping.c Tue Apr 19 16:30:17 2011 (r220844) +++ stable/8/usr.sbin/bluetooth/l2ping/l2ping.c Tue Apr 19 16:33:08 2011 (r220845) @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -60,11 +61,11 @@ int main(int argc, char *argv[]) { bdaddr_t src, dst; - struct hostent *he = NULL; - uint8_t *echo_data = NULL; + struct hostent *he; + uint8_t *echo_data; struct sockaddr_l2cap sa; int32_t n, s, count, wait, flood, echo_size, numeric; - char *rname = NULL; + char *endp, *rname; /* Set defaults */ memcpy(&src, NG_HCI_BDADDR_ANY, sizeof(src)); @@ -100,8 +101,8 @@ main(int argc, char *argv[]) break; case 'c': - count = atoi(optarg); - if (count <= 0) + count = strtol(optarg, &endp, 10); + if (count <= 0 || *endp != '\0') usage(); break; @@ -110,8 +111,8 @@ main(int argc, char *argv[]) break; case 'i': - wait = atoi(optarg); - if (wait <= 0) + wait = strtol(optarg, &endp, 10); + if (wait <= 0 || *endp != '\0') usage(); break; @@ -129,9 +130,10 @@ main(int argc, char *argv[]) break; case 's': - echo_size = atoi(optarg); - if (echo_size < sizeof(int32_t) || - echo_size > NG_L2CAP_MAX_ECHO_SIZE) + echo_size = strtol(optarg, &endp, 10); + if (echo_size < sizeof(int32_t) || + echo_size > NG_L2CAP_MAX_ECHO_SIZE || + *endp != '\0') usage(); break; @@ -272,12 +274,12 @@ tv2msec(struct timeval const *tvp) static void usage(void) { - fprintf(stderr, "Usage: l2ping -a bd_addr " \ - "[-S bd_addr -c count -i wait -n -s size -h]\n"); + fprintf(stderr, "Usage: l2ping [-fhn] -a remote " \ + "[-c count] [-i wait] [-S source] [-s size]\n"); fprintf(stderr, "Where:\n"); fprintf(stderr, " -a remote Specify remote device to ping\n"); fprintf(stderr, " -c count Number of packets to send\n"); - fprintf(stderr, " -f No delay (sort of flood)\n"); + fprintf(stderr, " -f No delay between packets\n"); fprintf(stderr, " -h Display this message\n"); fprintf(stderr, " -i wait Delay between packets (sec)\n"); fprintf(stderr, " -n Numeric output only\n"); From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 16:39:03 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A855106566C; Tue, 19 Apr 2011 16:39: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 6912F8FC0C; Tue, 19 Apr 2011 16:39:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JGd3LJ014362; Tue, 19 Apr 2011 16:39:03 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JGd3oM014360; Tue, 19 Apr 2011 16:39:03 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104191639.p3JGd3oM014360@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Apr 2011 16:39: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: r220847 - stable/8/sys/dev/ichsmb 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, 19 Apr 2011 16:39:03 -0000 Author: mav Date: Tue Apr 19 16:39:03 2011 New Revision: 220847 URL: http://svn.freebsd.org/changeset/base/220847 Log: MFC r211905 (by jfv): Add support for Intel Cougar Point SMBus controller. Modified: stable/8/sys/dev/ichsmb/ichsmb_pci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ichsmb/ichsmb_pci.c ============================================================================== --- stable/8/sys/dev/ichsmb/ichsmb_pci.c Tue Apr 19 16:36:24 2011 (r220846) +++ stable/8/sys/dev/ichsmb/ichsmb_pci.c Tue Apr 19 16:39:03 2011 (r220847) @@ -81,6 +81,7 @@ __FBSDID("$FreeBSD$"); #define ID_PCH 0x3b308086 #define ID_6300ESB 0x25a48086 #define ID_631xESB 0x269b8086 +#define ID_CPT 0x1c228086 #define PCIS_SERIALBUS_SMBUS_PROGIF 0x00 @@ -174,6 +175,9 @@ ichsmb_pci_probe(device_t dev) case ID_631xESB: device_set_desc(dev, "Intel 631xESB/6321ESB (ESB2) SMBus controller"); break; + case ID_CPT: + device_set_desc(dev, "Intel Cougar Point SMBus controller"); + break; default: return (ENXIO); } From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 16:40:58 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A0001065675; Tue, 19 Apr 2011 16:40: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 677818FC1B; Tue, 19 Apr 2011 16:40:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JGewdu014495; Tue, 19 Apr 2011 16:40:58 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JGewGa014488; Tue, 19 Apr 2011 16:40:58 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104191640.p3JGewGa014488@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Apr 2011 16:40: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: r220848 - in stable/8/sys/dev: ahci ata ata/chipsets ichsmb ichwd 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, 19 Apr 2011 16:40:58 -0000 Author: mav Date: Tue Apr 19 16:40:58 2011 New Revision: 220848 URL: http://svn.freebsd.org/changeset/base/220848 Log: MFC r218140 (jfv): Support for the new DH89xxCC PCH chipset including: - SATA controller - Watchdog timer - SMBus controller Modified: stable/8/sys/dev/ahci/ahci.c stable/8/sys/dev/ata/ata-pci.h stable/8/sys/dev/ata/chipsets/ata-intel.c stable/8/sys/dev/ichsmb/ichsmb_pci.c stable/8/sys/dev/ichwd/ichwd.c stable/8/sys/dev/ichwd/ichwd.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Tue Apr 19 16:39:03 2011 (r220847) +++ stable/8/sys/dev/ahci/ahci.c Tue Apr 19 16:40:58 2011 (r220848) @@ -161,6 +161,7 @@ static struct { {0x1c038086, 0x00, "Intel Cougar Point", 0}, {0x1c048086, 0x00, "Intel Cougar Point", 0}, {0x1c058086, 0x00, "Intel Cougar Point", 0}, + {0x23238086, 0x00, "Intel DH89xxCC", 0}, {0x2361197b, 0x00, "JMicron JMB361", AHCI_Q_NOFORCE}, {0x2363197b, 0x00, "JMicron JMB363", AHCI_Q_NOFORCE}, {0x2365197b, 0x00, "JMicron JMB365", AHCI_Q_NOFORCE}, Modified: stable/8/sys/dev/ata/ata-pci.h ============================================================================== --- stable/8/sys/dev/ata/ata-pci.h Tue Apr 19 16:39:03 2011 (r220847) +++ stable/8/sys/dev/ata/ata-pci.h Tue Apr 19 16:40:58 2011 (r220848) @@ -229,6 +229,7 @@ struct ata_pci_controller { #define ATA_I31244 0x32008086 #define ATA_ISCH 0x811a8086 +#define ATA_DH89XXCC 0x23238086 #define ATA_ITE_ID 0x1283 #define ATA_IT8211F 0x82111283 Modified: stable/8/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-intel.c Tue Apr 19 16:39:03 2011 (r220847) +++ stable/8/sys/dev/ata/chipsets/ata-intel.c Tue Apr 19 16:40:58 2011 (r220848) @@ -178,6 +178,7 @@ ata_intel_probe(device_t dev) { ATA_CPT_S4, 0, INTEL_6CH2, 0, ATA_SA300, "Cougar Point" }, { ATA_I31244, 0, 0, 2, ATA_SA150, "31244" }, { ATA_ISCH, 0, 0, 1, ATA_UDMA5, "SCH" }, + { ATA_DH89XXCC, 0, INTEL_AHCI, 0, ATA_SA300, "DH89xxCC" }, { 0, 0, 0, 0, 0, 0}}; if (pci_get_vendor(dev) != ATA_INTEL_ID) Modified: stable/8/sys/dev/ichsmb/ichsmb_pci.c ============================================================================== --- stable/8/sys/dev/ichsmb/ichsmb_pci.c Tue Apr 19 16:39:03 2011 (r220847) +++ stable/8/sys/dev/ichsmb/ichsmb_pci.c Tue Apr 19 16:40:58 2011 (r220848) @@ -81,6 +81,7 @@ __FBSDID("$FreeBSD$"); #define ID_PCH 0x3b308086 #define ID_6300ESB 0x25a48086 #define ID_631xESB 0x269b8086 +#define ID_DH89XXCC 0x23308086 #define ID_CPT 0x1c228086 #define PCIS_SERIALBUS_SMBUS_PROGIF 0x00 @@ -175,6 +176,9 @@ ichsmb_pci_probe(device_t dev) case ID_631xESB: device_set_desc(dev, "Intel 631xESB/6321ESB (ESB2) SMBus controller"); break; + case ID_DH89XXCC: + device_set_desc(dev, "Intel DH89xxCC SMBus controller"); + break; case ID_CPT: device_set_desc(dev, "Intel Cougar Point SMBus controller"); break; Modified: stable/8/sys/dev/ichwd/ichwd.c ============================================================================== --- stable/8/sys/dev/ichwd/ichwd.c Tue Apr 19 16:39:03 2011 (r220847) +++ stable/8/sys/dev/ichwd/ichwd.c Tue Apr 19 16:40:58 2011 (r220848) @@ -111,6 +111,7 @@ static struct ichwd_device ichwd_devices { DEVICEID_ICH10DO, "Intel ICH10DO watchdog timer", 10 }, { DEVICEID_ICH10R, "Intel ICH10R watchdog timer", 10 }, { DEVICEID_H55, "Intel H55 watchdog timer", 10 }, + { DEVICEID_DH89XXCC_LPC, "Intel DH89xxCC watchdog timer", 10 }, { 0, NULL, 0 }, }; Modified: stable/8/sys/dev/ichwd/ichwd.h ============================================================================== --- stable/8/sys/dev/ichwd/ichwd.h Tue Apr 19 16:39:03 2011 (r220847) +++ stable/8/sys/dev/ichwd/ichwd.h Tue Apr 19 16:40:58 2011 (r220848) @@ -64,6 +64,7 @@ struct ichwd_softc { }; #define VENDORID_INTEL 0x8086 +#define DEVICEID_DH89XXCC_LPC 0x2310 #define DEVICEID_82801AA 0x2410 #define DEVICEID_82801AB 0x2420 #define DEVICEID_82801BA 0x2440 From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 16:42:08 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A4E7106566C; Tue, 19 Apr 2011 16:42: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 EB1C18FC14; Tue, 19 Apr 2011 16:42:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JGg7vV014588; Tue, 19 Apr 2011 16:42:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JGg7El014580; Tue, 19 Apr 2011 16:42:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104191642.p3JGg7El014580@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Apr 2011 16:42: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: r220849 - in stable/8/sys/dev: ahci ata ata/chipsets ichsmb ichwd 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: Tue, 19 Apr 2011 16:42:08 -0000 Author: mav Date: Tue Apr 19 16:42:07 2011 New Revision: 220849 URL: http://svn.freebsd.org/changeset/base/220849 Log: MFC r218149 (by jfv): Support for the new Patsburg PCH chipset: - SMBus Controller - SATA Controller - HD Audio Controller - Watchdog Controller Modified: stable/8/sys/dev/ahci/ahci.c stable/8/sys/dev/ata/ata-pci.h stable/8/sys/dev/ata/chipsets/ata-intel.c stable/8/sys/dev/ichsmb/ichsmb_pci.c stable/8/sys/dev/ichwd/ichwd.c stable/8/sys/dev/ichwd/ichwd.h stable/8/sys/dev/sound/pci/hda/hdac.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Tue Apr 19 16:40:58 2011 (r220848) +++ stable/8/sys/dev/ahci/ahci.c Tue Apr 19 16:42:07 2011 (r220849) @@ -161,7 +161,10 @@ static struct { {0x1c038086, 0x00, "Intel Cougar Point", 0}, {0x1c048086, 0x00, "Intel Cougar Point", 0}, {0x1c058086, 0x00, "Intel Cougar Point", 0}, - {0x23238086, 0x00, "Intel DH89xxCC", 0}, + {0x23238086, 0x00, "Intel DH89xxCC", 0}, + {0x1d028086, 0x00, "Intel Patsburg", 0}, + {0x1d048086, 0x00, "Intel Patsburg", 0}, + {0x1d068086, 0x00, "Intel Patsburg", 0}, {0x2361197b, 0x00, "JMicron JMB361", AHCI_Q_NOFORCE}, {0x2363197b, 0x00, "JMicron JMB363", AHCI_Q_NOFORCE}, {0x2365197b, 0x00, "JMicron JMB365", AHCI_Q_NOFORCE}, Modified: stable/8/sys/dev/ata/ata-pci.h ============================================================================== --- stable/8/sys/dev/ata/ata-pci.h Tue Apr 19 16:40:58 2011 (r220848) +++ stable/8/sys/dev/ata/ata-pci.h Tue Apr 19 16:42:07 2011 (r220849) @@ -227,6 +227,12 @@ struct ata_pci_controller { #define ATA_CPT_S3 0x1c088086 #define ATA_CPT_S4 0x1c098086 +#define ATA_PBG_S1 0x1d008086 +#define ATA_PBG_AH1 0x1d028086 +#define ATA_PBG_R1 0x1d048086 +#define ATA_PBG_R2 0x1d068086 +#define ATA_PBG_S2 0x1d088086 + #define ATA_I31244 0x32008086 #define ATA_ISCH 0x811a8086 #define ATA_DH89XXCC 0x23238086 Modified: stable/8/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-intel.c Tue Apr 19 16:40:58 2011 (r220848) +++ stable/8/sys/dev/ata/chipsets/ata-intel.c Tue Apr 19 16:42:07 2011 (r220849) @@ -176,6 +176,11 @@ ata_intel_probe(device_t dev) { ATA_CPT_R2, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, { ATA_CPT_S3, 0, INTEL_6CH2, 0, ATA_SA300, "Cougar Point" }, { ATA_CPT_S4, 0, INTEL_6CH2, 0, ATA_SA300, "Cougar Point" }, + { ATA_PBG_S1, 0, INTEL_6CH, 0, ATA_SA300, "Patsburg" }, + { ATA_PBG_AH1, 0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" }, + { ATA_PBG_R1, 0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" }, + { ATA_PBG_R2, 0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" }, + { ATA_PBG_S2, 0, INTEL_6CH2, 0, ATA_SA300, "Patsburg" }, { ATA_I31244, 0, 0, 2, ATA_SA150, "31244" }, { ATA_ISCH, 0, 0, 1, ATA_UDMA5, "SCH" }, { ATA_DH89XXCC, 0, INTEL_AHCI, 0, ATA_SA300, "DH89xxCC" }, Modified: stable/8/sys/dev/ichsmb/ichsmb_pci.c ============================================================================== --- stable/8/sys/dev/ichsmb/ichsmb_pci.c Tue Apr 19 16:40:58 2011 (r220848) +++ stable/8/sys/dev/ichsmb/ichsmb_pci.c Tue Apr 19 16:42:07 2011 (r220849) @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); #define ID_6300ESB 0x25a48086 #define ID_631xESB 0x269b8086 #define ID_DH89XXCC 0x23308086 +#define ID_PATSBURG 0x1d228086 #define ID_CPT 0x1c228086 #define PCIS_SERIALBUS_SMBUS_PROGIF 0x00 @@ -179,6 +180,9 @@ ichsmb_pci_probe(device_t dev) case ID_DH89XXCC: device_set_desc(dev, "Intel DH89xxCC SMBus controller"); break; + case ID_PATSBURG: + device_set_desc(dev, "Intel Patsburg SMBus controller"); + break; case ID_CPT: device_set_desc(dev, "Intel Cougar Point SMBus controller"); break; Modified: stable/8/sys/dev/ichwd/ichwd.c ============================================================================== --- stable/8/sys/dev/ichwd/ichwd.c Tue Apr 19 16:40:58 2011 (r220848) +++ stable/8/sys/dev/ichwd/ichwd.c Tue Apr 19 16:42:07 2011 (r220849) @@ -111,7 +111,9 @@ static struct ichwd_device ichwd_devices { DEVICEID_ICH10DO, "Intel ICH10DO watchdog timer", 10 }, { DEVICEID_ICH10R, "Intel ICH10R watchdog timer", 10 }, { DEVICEID_H55, "Intel H55 watchdog timer", 10 }, - { DEVICEID_DH89XXCC_LPC, "Intel DH89xxCC watchdog timer", 10 }, + { DEVICEID_DH89XXCC_LPC, "Intel DH89xxCC watchdog timer", 10 }, + { DEVICEID_PATSBURG_LPC1, "Intel Patsburg watchdog timer", 10 }, + { DEVICEID_PATSBURG_LPC2, "Intel Patsburg watchdog timer", 10 }, { 0, NULL, 0 }, }; Modified: stable/8/sys/dev/ichwd/ichwd.h ============================================================================== --- stable/8/sys/dev/ichwd/ichwd.h Tue Apr 19 16:40:58 2011 (r220848) +++ stable/8/sys/dev/ichwd/ichwd.h Tue Apr 19 16:42:07 2011 (r220849) @@ -64,6 +64,8 @@ struct ichwd_softc { }; #define VENDORID_INTEL 0x8086 +#define DEVICEID_PATSBURG_LPC1 0x1d40 +#define DEVICEID_PATSBURG_LPC2 0x1d41 #define DEVICEID_DH89XXCC_LPC 0x2310 #define DEVICEID_82801AA 0x2410 #define DEVICEID_82801AB 0x2420 Modified: stable/8/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/8/sys/dev/sound/pci/hda/hdac.c Tue Apr 19 16:40:58 2011 (r220848) +++ stable/8/sys/dev/sound/pci/hda/hdac.c Tue Apr 19 16:42:07 2011 (r220849) @@ -140,6 +140,7 @@ SND_DECLARE_FILE("$FreeBSD$"); /* Intel */ #define INTEL_VENDORID 0x8086 +#define HDA_INTEL_PATSBURG HDA_MODEL_CONSTRUCT(INTEL, 0x1d20) #define HDA_INTEL_82801F HDA_MODEL_CONSTRUCT(INTEL, 0x2668) #define HDA_INTEL_63XXESB HDA_MODEL_CONSTRUCT(INTEL, 0x269a) #define HDA_INTEL_82801G HDA_MODEL_CONSTRUCT(INTEL, 0x27d8) @@ -148,6 +149,7 @@ SND_DECLARE_FILE("$FreeBSD$"); #define HDA_INTEL_82801JI HDA_MODEL_CONSTRUCT(INTEL, 0x3a3e) #define HDA_INTEL_82801JD HDA_MODEL_CONSTRUCT(INTEL, 0x3a6e) #define HDA_INTEL_PCH HDA_MODEL_CONSTRUCT(INTEL, 0x3b56) +#define HDA_INTEL_PCH2 HDA_MODEL_CONSTRUCT(INTEL, 0x3b57) #define HDA_INTEL_SCH HDA_MODEL_CONSTRUCT(INTEL, 0x811b) #define HDA_INTEL_ALL HDA_MODEL_CONSTRUCT(INTEL, 0xffff) @@ -490,6 +492,7 @@ static const struct { char *desc; char flags; } hdac_devices[] = { + { HDA_INTEL_PATSBURG,"Intel Patsburg", 0 }, { HDA_INTEL_82801F, "Intel 82801F", 0 }, { HDA_INTEL_63XXESB, "Intel 631x/632xESB", 0 }, { HDA_INTEL_82801G, "Intel 82801G", 0 }, @@ -497,7 +500,8 @@ static const struct { { HDA_INTEL_82801I, "Intel 82801I", 0 }, { HDA_INTEL_82801JI, "Intel 82801JI", 0 }, { HDA_INTEL_82801JD, "Intel 82801JD", 0 }, - { HDA_INTEL_PCH, "Intel PCH", 0 }, + { HDA_INTEL_PCH, "Intel 5 Series/3400 Series", 0 }, + { HDA_INTEL_PCH2, "Intel 5 Series/3400 Series", 0 }, { HDA_INTEL_SCH, "Intel SCH", 0 }, { HDA_NVIDIA_MCP51, "NVidia MCP51", HDAC_NO_MSI }, { HDA_NVIDIA_MCP55, "NVidia MCP55", HDAC_NO_MSI }, From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 16:43:55 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B52C106566C; Tue, 19 Apr 2011 16:43:55 +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 5ED498FC0A; Tue, 19 Apr 2011 16:43:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JGhts3014680; Tue, 19 Apr 2011 16:43:55 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JGhtIY014678; Tue, 19 Apr 2011 16:43:55 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104191643.p3JGhtIY014678@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Apr 2011 16:43: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: r220850 - stable/8/sys/dev/ahci 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, 19 Apr 2011 16:43:55 -0000 Author: mav Date: Tue Apr 19 16:43:55 2011 New Revision: 220850 URL: http://svn.freebsd.org/changeset/base/220850 Log: MFC r218596, r218605: Disable NCQ for multiport Marvell 88SX61XX SATA controllers. Simultaneous active I/O to several disks (copying large file on ZFS) causes timeout after just a few seconds of run. Single port 88SX6111 seems like not affected. Skip reading transferred bytes count for these controllers. It works for 88SX6111, but 88SX6145 always returns zero there. Haven't tested others, but better to be safe. Modified: stable/8/sys/dev/ahci/ahci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Tue Apr 19 16:42:07 2011 (r220849) +++ stable/8/sys/dev/ahci/ahci.c Tue Apr 19 16:43:55 2011 (r220850) @@ -114,6 +114,7 @@ static struct { #define AHCI_Q_SATA2 128 #define AHCI_Q_NOBSYRES 256 #define AHCI_Q_NOAA 512 +#define AHCI_Q_NOCOUNT 1024 } ahci_ids[] = { {0x43801002, 0x00, "ATI IXP600", 0}, {0x43901002, 0x00, "ATI IXP700", 0}, @@ -170,10 +171,14 @@ static struct { {0x2365197b, 0x00, "JMicron JMB365", AHCI_Q_NOFORCE}, {0x2366197b, 0x00, "JMicron JMB366", AHCI_Q_NOFORCE}, {0x2368197b, 0x00, "JMicron JMB368", AHCI_Q_NOFORCE}, - {0x611111ab, 0x00, "Marvell 88SX6111", AHCI_Q_NOFORCE|AHCI_Q_1CH|AHCI_Q_EDGEIS}, - {0x612111ab, 0x00, "Marvell 88SX6121", AHCI_Q_NOFORCE|AHCI_Q_2CH|AHCI_Q_EDGEIS}, - {0x614111ab, 0x00, "Marvell 88SX6141", AHCI_Q_NOFORCE|AHCI_Q_4CH|AHCI_Q_EDGEIS}, - {0x614511ab, 0x00, "Marvell 88SX6145", AHCI_Q_NOFORCE|AHCI_Q_4CH|AHCI_Q_EDGEIS}, + {0x611111ab, 0x00, "Marvell 88SX6111", AHCI_Q_NOFORCE | AHCI_Q_1CH | + AHCI_Q_EDGEIS}, + {0x612111ab, 0x00, "Marvell 88SX6121", AHCI_Q_NOFORCE | AHCI_Q_2CH | + AHCI_Q_EDGEIS | AHCI_Q_NONCQ | AHCI_Q_NOCOUNT}, + {0x614111ab, 0x00, "Marvell 88SX6141", AHCI_Q_NOFORCE | AHCI_Q_4CH | + AHCI_Q_EDGEIS | AHCI_Q_NONCQ | AHCI_Q_NOCOUNT}, + {0x614511ab, 0x00, "Marvell 88SX6145", AHCI_Q_NOFORCE | AHCI_Q_4CH | + AHCI_Q_EDGEIS | AHCI_Q_NONCQ | AHCI_Q_NOCOUNT}, {0x91231b4b, 0x11, "Marvell 88SE912x", AHCI_Q_NOBSYRES}, {0x91231b4b, 0x00, "Marvell 88SE912x", AHCI_Q_EDGEIS|AHCI_Q_SATA2|AHCI_Q_NOBSYRES}, {0x06201103, 0x00, "HighPoint RocketRAID 620", AHCI_Q_NOBSYRES}, @@ -1902,12 +1907,14 @@ ahci_end_transaction(struct ahci_slot *s } else bzero(res, sizeof(*res)); if ((ccb->ataio.cmd.flags & CAM_ATAIO_FPDMA) == 0 && - (ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) { + (ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE && + (ch->quirks & AHCI_Q_NOCOUNT) == 0) { ccb->ataio.resid = ccb->ataio.dxfer_len - le32toh(clp->bytecount); } } else { - if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) { + if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE && + (ch->quirks & AHCI_Q_NOCOUNT) == 0) { ccb->csio.resid = ccb->csio.dxfer_len - le32toh(clp->bytecount); } From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 16:45:57 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2003D106566B; Tue, 19 Apr 2011 16:45:57 +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 0E3FE8FC19; Tue, 19 Apr 2011 16:45:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JGjuFo014792; Tue, 19 Apr 2011 16:45:56 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JGjuRc014790; Tue, 19 Apr 2011 16:45:56 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104191645.p3JGjuRc014790@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Apr 2011 16:45: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: r220851 - stable/8/sys/dev/ahci 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, 19 Apr 2011 16:45:57 -0000 Author: mav Date: Tue Apr 19 16:45:56 2011 New Revision: 220851 URL: http://svn.freebsd.org/changeset/base/220851 Log: MFC r219341: Add some more IDs of HighPoint RocketRAID 64x. Modified: stable/8/sys/dev/ahci/ahci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Tue Apr 19 16:43:55 2011 (r220850) +++ stable/8/sys/dev/ahci/ahci.c Tue Apr 19 16:45:56 2011 (r220851) @@ -186,7 +186,9 @@ static struct { {0x06221103, 0x00, "HighPoint RocketRAID 622", AHCI_Q_NOBSYRES}, {0x06221b4b, 0x00, "HighPoint RocketRAID 622", AHCI_Q_NOBSYRES}, {0x06401103, 0x00, "HighPoint RocketRAID 640", AHCI_Q_NOBSYRES}, + {0x06401b4b, 0x00, "HighPoint RocketRAID 640", AHCI_Q_NOBSYRES}, {0x06441103, 0x00, "HighPoint RocketRAID 644", AHCI_Q_NOBSYRES}, + {0x06441b4b, 0x00, "HighPoint RocketRAID 644", AHCI_Q_NOBSYRES}, {0x044c10de, 0x00, "NVIDIA MCP65", AHCI_Q_NOAA}, {0x044d10de, 0x00, "NVIDIA MCP65", AHCI_Q_NOAA}, {0x044e10de, 0x00, "NVIDIA MCP65", AHCI_Q_NOAA}, From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 16:46:51 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECB441065675; Tue, 19 Apr 2011 16:46: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 DAF5C8FC1B; Tue, 19 Apr 2011 16:46:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JGkpT9014864; Tue, 19 Apr 2011 16:46:51 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JGkpTj014862; Tue, 19 Apr 2011 16:46:51 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104191646.p3JGkpTj014862@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Apr 2011 16:46: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: r220852 - stable/8/sys/dev/ahci 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, 19 Apr 2011 16:46:52 -0000 Author: mav Date: Tue Apr 19 16:46:51 2011 New Revision: 220852 URL: http://svn.freebsd.org/changeset/base/220852 Log: MFC r220413: Add one more ID for Marvell 88SE912x chip found on Asus U3S6 card. Modified: stable/8/sys/dev/ahci/ahci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Tue Apr 19 16:45:56 2011 (r220851) +++ stable/8/sys/dev/ahci/ahci.c Tue Apr 19 16:46:51 2011 (r220852) @@ -179,6 +179,7 @@ static struct { AHCI_Q_EDGEIS | AHCI_Q_NONCQ | AHCI_Q_NOCOUNT}, {0x614511ab, 0x00, "Marvell 88SX6145", AHCI_Q_NOFORCE | AHCI_Q_4CH | AHCI_Q_EDGEIS | AHCI_Q_NONCQ | AHCI_Q_NOCOUNT}, + {0x91201b4b, 0x00, "Marvell 88SE912x", AHCI_Q_EDGEIS|AHCI_Q_NOBSYRES}, {0x91231b4b, 0x11, "Marvell 88SE912x", AHCI_Q_NOBSYRES}, {0x91231b4b, 0x00, "Marvell 88SE912x", AHCI_Q_EDGEIS|AHCI_Q_SATA2|AHCI_Q_NOBSYRES}, {0x06201103, 0x00, "HighPoint RocketRAID 620", AHCI_Q_NOBSYRES}, From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 16:51:17 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A6F8106566B; Tue, 19 Apr 2011 16:51: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 786A98FC14; Tue, 19 Apr 2011 16:51:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JGpHA3015125; Tue, 19 Apr 2011 16:51:17 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JGpHvY015122; Tue, 19 Apr 2011 16:51:17 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104191651.p3JGpHvY015122@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Apr 2011 16:51:17 +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: r220853 - stable/8/sys/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: Tue, 19 Apr 2011 16:51:17 -0000 Author: mav Date: Tue Apr 19 16:51:17 2011 New Revision: 220853 URL: http://svn.freebsd.org/changeset/base/220853 Log: MFC r217877, r217883: Hardware supported by siis(4) allows software control over activity LEDs. Expose that functionality to led(4) OR-ing it with regular LED activity. Modified: stable/8/sys/dev/siis/siis.c stable/8/sys/dev/siis/siis.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/siis/siis.c ============================================================================== --- stable/8/sys/dev/siis/siis.c Tue Apr 19 16:46:51 2011 (r220852) +++ stable/8/sys/dev/siis/siis.c Tue Apr 19 16:51:17 2011 (r220853) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include "siis.h" @@ -65,6 +66,7 @@ static int siis_ch_suspend(device_t dev) static int siis_ch_resume(device_t dev); static void siis_ch_intr_locked(void *data); static void siis_ch_intr(void *data); +static void siis_ch_led(void *priv, int onoff); static void siis_begin_transaction(device_t dev, union ccb *ccb); static void siis_dmasetprd(void *arg, bus_dma_segment_t *segs, int nsegs, int error); static void siis_execute_transaction(struct siis_slot *slot); @@ -516,6 +518,7 @@ siis_ch_attach(device_t dev) goto err3; } mtx_unlock(&ch->mtx); + ch->led = led_create(siis_ch_led, dev, device_get_nameunit(dev)); return (0); err3: @@ -536,6 +539,7 @@ siis_ch_detach(device_t dev) { struct siis_channel *ch = device_get_softc(dev); + led_destroy(ch->led); mtx_lock(&ch->mtx); xpt_async(AC_LOST_DEVICE, ch->path, NULL); xpt_free_path(ch->path); @@ -625,6 +629,21 @@ static driver_t siisch_driver = { }; DRIVER_MODULE(siisch, siis, siisch_driver, siis_devclass, 0, 0); +static void +siis_ch_led(void *priv, int onoff) +{ + device_t dev; + struct siis_channel *ch; + + dev = (device_t)priv; + ch = device_get_softc(dev); + + if (onoff == 0) + ATA_OUTL(ch->r_mem, SIIS_P_CTLCLR, SIIS_P_CTL_LED_ON); + else + ATA_OUTL(ch->r_mem, SIIS_P_CTLSET, SIIS_P_CTL_LED_ON); +} + struct siis_dc_cb_args { bus_addr_t maddr; int error; Modified: stable/8/sys/dev/siis/siis.h ============================================================================== --- stable/8/sys/dev/siis/siis.h Tue Apr 19 16:46:51 2011 (r220852) +++ stable/8/sys/dev/siis/siis.h Tue Apr 19 16:51:17 2011 (r220853) @@ -371,6 +371,7 @@ struct siis_channel { struct ata_dma dma; /* DMA data */ struct cam_sim *sim; struct cam_path *path; + struct cdev *led; /* Activity led led(4) cdev. */ int quirks; int pm_level; /* power management level */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 16:52:36 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67ECF106566B; Tue, 19 Apr 2011 16:52:36 +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 55DCE8FC1B; Tue, 19 Apr 2011 16:52:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JGqaxZ015198; Tue, 19 Apr 2011 16:52:36 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JGqabB015196; Tue, 19 Apr 2011 16:52:36 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104191652.p3JGqabB015196@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Apr 2011 16:52: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: r220854 - 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: Tue, 19 Apr 2011 16:52:36 -0000 Author: mav Date: Tue Apr 19 16:52:36 2011 New Revision: 220854 URL: http://svn.freebsd.org/changeset/base/220854 Log: MFC r220449: Add reference to led(4), supported now. Add some details about supported chips. Modified: stable/8/share/man/man4/siis.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/siis.4 ============================================================================== --- stable/8/share/man/man4/siis.4 Tue Apr 19 16:51:17 2011 (r220853) +++ stable/8/share/man/man4/siis.4 Tue Apr 19 16:52:36 2011 (r220854) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 18, 2009 +.Dd April 8, 2011 .Dt SIIS 4 .Os .Sh NAME @@ -93,6 +93,12 @@ Port Multipliers (including FIS-based sw (31 command per port), Native Command Queuing, SATA interface Power Management, device hot-plug and Message Signaled Interrupts. .Pp +The activity LEDs of the adapters supported by the +.Nm +driver can be controlled via the +.Xr led 4 +API for localization or status reporting purposes. +.Pp Same hardware is also supported by the atasiliconimage driver from .Xr ata 4 subsystem. @@ -101,14 +107,21 @@ given precedence as the more functional .Sh HARDWARE The .Nm -driver supports the following controllers: +driver supports the following controller chips: .Bl -bullet -compact .It -SiI3124 +SiI3124 (PCI-X 133MHz/64bit, 4 ports) .It -SiI3132 +SiI3131 (PCIe 1.0 x1, 1 port) .It -SiI3531 +SiI3132 (PCIe 1.0 x1, 2 ports) +.It +SiI3531 (PCIe 1.0 x1, 1 port) +.El +.Sh FILES +.Bl -tag -width /dev/led/siisch* +.It Pa /dev/led/siisch* +identification LED device nodes .El .Sh SEE ALSO .Xr ada 4 , @@ -116,6 +129,7 @@ SiI3531 .Xr cam 4 , .Xr cd 4 , .Xr da 4 , +.Xr led 4 , .Xr sa 4 .Sh HISTORY The From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 17:01:06 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16A07106564A; Tue, 19 Apr 2011 17:01:06 +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 03F1B8FC0A; Tue, 19 Apr 2011 17:01:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JH15OX015563; Tue, 19 Apr 2011 17:01:05 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JH15sw015560; Tue, 19 Apr 2011 17:01:05 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104191701.p3JH15sw015560@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Apr 2011 17:01: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: r220855 - 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: Tue, 19 Apr 2011 17:01:06 -0000 Author: mav Date: Tue Apr 19 17:01:05 2011 New Revision: 220855 URL: http://svn.freebsd.org/changeset/base/220855 Log: MFC r220563: Implement automatic SCSI sense fetching for ata(4) in ATA_CAM mode. Modified: stable/8/sys/dev/ata/ata-all.c stable/8/sys/dev/ata/ata-all.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ata/ata-all.c ============================================================================== --- stable/8/sys/dev/ata/ata-all.c Tue Apr 19 16:52:36 2011 (r220854) +++ stable/8/sys/dev/ata/ata-all.c Tue Apr 19 17:01:05 2011 (r220855) @@ -1474,6 +1474,72 @@ ata_cam_begin_transaction(device_t dev, } } +static void +ata_cam_request_sense(device_t dev, struct ata_request *request) +{ + struct ata_channel *ch = device_get_softc(dev); + union ccb *ccb = request->ccb; + + ch->requestsense = 1; + + bzero(request, sizeof(&request)); + request->dev = NULL; + request->parent = dev; + request->unit = ccb->ccb_h.target_id; + request->data = (void *)&ccb->csio.sense_data; + request->bytecount = ccb->csio.sense_len; + request->u.atapi.ccb[0] = ATAPI_REQUEST_SENSE; + request->u.atapi.ccb[4] = ccb->csio.sense_len; + request->flags |= ATA_R_ATAPI; + if (ch->curr[ccb->ccb_h.target_id].atapi == 16) + request->flags |= ATA_R_ATAPI16; + if (ch->curr[ccb->ccb_h.target_id].mode >= ATA_DMA) + request->flags |= ATA_R_DMA; + request->flags |= ATA_R_READ; + request->transfersize = min(request->bytecount, + ch->curr[ccb->ccb_h.target_id].bytecount); + request->retries = 0; + request->timeout = (ccb->ccb_h.timeout + 999) / 1000; + callout_init_mtx(&request->callout, &ch->state_mtx, CALLOUT_RETURNUNLOCKED); + request->ccb = ccb; + + ch->running = request; + ch->state = ATA_ACTIVE; + if (ch->hw.begin_transaction(request) == ATA_OP_FINISHED) { + ch->running = NULL; + ch->state = ATA_IDLE; + ata_cam_end_transaction(dev, request); + return; + } +} + +static void +ata_cam_process_sense(device_t dev, struct ata_request *request) +{ + struct ata_channel *ch = device_get_softc(dev); + union ccb *ccb = request->ccb; + int fatalerr = 0; + + ch->requestsense = 0; + + if (request->flags & ATA_R_TIMEOUT) + fatalerr = 1; + if ((request->flags & ATA_R_TIMEOUT) == 0 && + (request->status & ATA_S_ERROR) == 0 && + request->result == 0) { + ccb->ccb_h.status |= CAM_AUTOSNS_VALID; + } else { + ccb->ccb_h.status &= ~CAM_STATUS_MASK; + ccb->ccb_h.status |= CAM_AUTOSENSE_FAIL; + } + + ata_free_request(request); + xpt_done(ccb); + /* Do error recovery if needed. */ + if (fatalerr) + ata_reinit(dev); +} + void ata_cam_end_transaction(device_t dev, struct ata_request *request) { @@ -1481,6 +1547,11 @@ ata_cam_end_transaction(device_t dev, st union ccb *ccb = request->ccb; int fatalerr = 0; + if (ch->requestsense) { + ata_cam_process_sense(dev, request); + return; + } + ccb->ccb_h.status &= ~CAM_STATUS_MASK; if (request->flags & ATA_R_TIMEOUT) { xpt_freeze_simq(ch->sim, 1); @@ -1530,8 +1601,13 @@ ata_cam_end_transaction(device_t dev, st ccb->csio.dxfer_len - request->donecount; } } - ata_free_request(request); - xpt_done(ccb); + if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_SCSI_STATUS_ERROR && + (ccb->ccb_h.flags & CAM_DIS_AUTOSENSE) == 0) + ata_cam_request_sense(dev, request); + else { + ata_free_request(request); + xpt_done(ccb); + } /* Do error recovery if needed. */ if (fatalerr) ata_reinit(dev); Modified: stable/8/sys/dev/ata/ata-all.h ============================================================================== --- stable/8/sys/dev/ata/ata-all.h Tue Apr 19 16:52:36 2011 (r220854) +++ stable/8/sys/dev/ata/ata-all.h Tue Apr 19 17:01:05 2011 (r220855) @@ -585,8 +585,9 @@ struct ata_channel { #ifdef ATA_CAM struct cam_sim *sim; struct cam_path *path; - struct ata_cam_device user[16]; /* User-specified settings */ - struct ata_cam_device curr[16]; /* Current settings */ + struct ata_cam_device user[16]; /* User-specified settings */ + struct ata_cam_device curr[16]; /* Current settings */ + int requestsense; /* CCB waiting for SENSE. */ #endif struct callout poll_callout; /* Periodic status poll. */ }; From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 17:04:58 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E305A106564A; Tue, 19 Apr 2011 17:04: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 CF78E8FC13; Tue, 19 Apr 2011 17:04:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JH4wAf015745; Tue, 19 Apr 2011 17:04:58 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JH4wXw015742; Tue, 19 Apr 2011 17:04:58 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104191704.p3JH4wXw015742@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Apr 2011 17:04: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: r220856 - stable/8/sys/dev/ahci 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, 19 Apr 2011 17:04:59 -0000 Author: mav Date: Tue Apr 19 17:04:58 2011 New Revision: 220856 URL: http://svn.freebsd.org/changeset/base/220856 Log: MFC r220565: Implement automatic SCSI sense fetching for ahci(4). Modified: stable/8/sys/dev/ahci/ahci.c stable/8/sys/dev/ahci/ahci.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Tue Apr 19 17:01:05 2011 (r220855) +++ stable/8/sys/dev/ahci/ahci.c Tue Apr 19 17:04:58 2011 (r220856) @@ -91,8 +91,9 @@ static int ahci_sata_connect(struct ahci static int ahci_sata_phy_reset(device_t dev); static int ahci_wait_ready(device_t dev, int t); -static void ahci_issue_read_log(device_t dev); +static void ahci_issue_recovery(device_t dev); static void ahci_process_read_log(device_t dev, union ccb *ccb); +static void ahci_process_request_sense(device_t dev, union ccb *ccb); static void ahciaction(struct cam_sim *sim, union ccb *ccb); static void ahcipoll(struct cam_sim *sim); @@ -267,6 +268,12 @@ static struct { {0x00000000, 0x00, NULL, 0} }; +#define recovery_type spriv_field0 +#define RECOVERY_NONE 0 +#define RECOVERY_READ_LOG 1 +#define RECOVERY_REQUEST_SENSE 2 +#define recovery_slot spriv_field1 + static int ahci_probe(device_t dev) { @@ -1459,7 +1466,7 @@ ahci_ch_intr(void *data) * We can't reinit port if there are some other * commands active, use resume to complete them. */ - if (ch->rslots != 0) + if (ch->rslots != 0 && !ch->recoverycmd) ATA_OUTL(ch->r_mem, AHCI_P_FBS, AHCI_P_FBS_EN | AHCI_P_FBS_DEC); } /* Process NOTIFY events */ @@ -1931,7 +1938,7 @@ ahci_end_transaction(struct ahci_slot *s if (et != AHCI_ERR_NONE) ch->eslots |= (1 << slot->slot); /* In case of error, freeze device for proper recovery. */ - if ((et != AHCI_ERR_NONE) && (!ch->readlog) && + if ((et != AHCI_ERR_NONE) && (!ch->recoverycmd) && !(ccb->ccb_h.status & CAM_DEV_QFRZN)) { xpt_freeze_devq(ccb->ccb_h.path, 1); ccb->ccb_h.status |= CAM_DEV_QFRZN; @@ -1962,7 +1969,7 @@ ahci_end_transaction(struct ahci_slot *s break; case AHCI_ERR_SATA: ch->fatalerr = 1; - if (!ch->readlog) { + if (!ch->recoverycmd) { xpt_freeze_simq(ch->sim, 1); ccb->ccb_h.status &= ~CAM_STATUS_MASK; ccb->ccb_h.status |= CAM_RELEASE_SIMQ; @@ -1970,7 +1977,7 @@ ahci_end_transaction(struct ahci_slot *s ccb->ccb_h.status |= CAM_UNCOR_PARITY; break; case AHCI_ERR_TIMEOUT: - if (!ch->readlog) { + if (!ch->recoverycmd) { xpt_freeze_simq(ch->sim, 1); ccb->ccb_h.status &= ~CAM_STATUS_MASK; ccb->ccb_h.status |= CAM_RELEASE_SIMQ; @@ -2013,10 +2020,15 @@ ahci_end_transaction(struct ahci_slot *s return; } /* If it was our READ LOG command - process it. */ - if (ch->readlog) { + if (ccb->ccb_h.recovery_type == RECOVERY_READ_LOG) { ahci_process_read_log(dev, ccb); - /* If it was NCQ command error, put result on hold. */ - } else if (et == AHCI_ERR_NCQ) { + /* If it was our REQUEST SENSE command - process it. */ + } else if (ccb->ccb_h.recovery_type == RECOVERY_REQUEST_SENSE) { + ahci_process_request_sense(dev, ccb); + /* If it was NCQ or ATAPI command error, put result on hold. */ + } else if (et == AHCI_ERR_NCQ || + ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_SCSI_STATUS_ERROR && + (ccb->ccb_h.flags & CAM_DIS_AUTOSENSE) == 0)) { ch->hold[slot->slot] = ccb; ch->numhslots++; } else @@ -2040,8 +2052,8 @@ ahci_end_transaction(struct ahci_slot *s ahci_start(dev, 1); } /* if there commands on hold, we can do READ LOG. */ - if (!ch->readlog && ch->numhslots) - ahci_issue_read_log(dev); + if (!ch->recoverycmd && ch->numhslots) + ahci_issue_recovery(dev); } /* If all the rest of commands are in timeout - give them chance. */ } else if ((ch->rslots & ~ch->toslots) == 0 && @@ -2056,14 +2068,15 @@ ahci_end_transaction(struct ahci_slot *s } static void -ahci_issue_read_log(device_t dev) +ahci_issue_recovery(device_t dev) { struct ahci_channel *ch = device_get_softc(dev); union ccb *ccb; struct ccb_ataio *ataio; + struct ccb_scsiio *csio; int i; - ch->readlog = 1; + ch->recoverycmd = 1; /* Find some holden command. */ for (i = 0; i < ch->numslots; i++) { if (ch->hold[i]) @@ -2075,26 +2088,45 @@ ahci_issue_read_log(device_t dev) return; /* XXX */ } ccb->ccb_h = ch->hold[i]->ccb_h; /* Reuse old header. */ - ccb->ccb_h.func_code = XPT_ATA_IO; - ccb->ccb_h.flags = CAM_DIR_IN; - ccb->ccb_h.timeout = 1000; /* 1s should be enough. */ - ataio = &ccb->ataio; - ataio->data_ptr = malloc(512, M_AHCI, M_NOWAIT); - if (ataio->data_ptr == NULL) { - xpt_free_ccb(ccb); - device_printf(dev, "Unable allocate memory for READ LOG command"); - return; /* XXX */ + if (ccb->ccb_h.func_code == XPT_ATA_IO) { + /* READ LOG */ + ccb->ccb_h.recovery_type = RECOVERY_READ_LOG; + ccb->ccb_h.func_code = XPT_ATA_IO; + ccb->ccb_h.flags = CAM_DIR_IN; + ccb->ccb_h.timeout = 1000; /* 1s should be enough. */ + ataio = &ccb->ataio; + ataio->data_ptr = malloc(512, M_AHCI, M_NOWAIT); + if (ataio->data_ptr == NULL) { + xpt_free_ccb(ccb); + device_printf(dev, "Unable allocate memory for READ LOG command"); + return; /* XXX */ + } + ataio->dxfer_len = 512; + bzero(&ataio->cmd, sizeof(ataio->cmd)); + ataio->cmd.flags = CAM_ATAIO_48BIT; + ataio->cmd.command = 0x2F; /* READ LOG EXT */ + ataio->cmd.sector_count = 1; + ataio->cmd.sector_count_exp = 0; + ataio->cmd.lba_low = 0x10; + ataio->cmd.lba_mid = 0; + ataio->cmd.lba_mid_exp = 0; + } else { + /* REQUEST SENSE */ + ccb->ccb_h.recovery_type = RECOVERY_REQUEST_SENSE; + ccb->ccb_h.recovery_slot = i; + ccb->ccb_h.func_code = XPT_SCSI_IO; + ccb->ccb_h.flags = CAM_DIR_IN; + ccb->ccb_h.status = 0; + ccb->ccb_h.timeout = 1000; /* 1s should be enough. */ + csio = &ccb->csio; + csio->data_ptr = (void *)&ch->hold[i]->csio.sense_data; + csio->dxfer_len = ch->hold[i]->csio.sense_len; + csio->cdb_len = 6; + bzero(&csio->cdb_io, sizeof(csio->cdb_io)); + csio->cdb_io.cdb_bytes[0] = 0x03; + csio->cdb_io.cdb_bytes[4] = csio->dxfer_len; } - ataio->dxfer_len = 512; - bzero(&ataio->cmd, sizeof(ataio->cmd)); - ataio->cmd.flags = CAM_ATAIO_48BIT; - ataio->cmd.command = 0x2F; /* READ LOG EXT */ - ataio->cmd.sector_count = 1; - ataio->cmd.sector_count_exp = 0; - ataio->cmd.lba_low = 0x10; - ataio->cmd.lba_mid = 0; - ataio->cmd.lba_mid_exp = 0; - /* Freeze SIM while doing READ LOG EXT. */ + /* Freeze SIM while doing recovery. */ xpt_freeze_simq(ch->sim, 1); ahci_begin_transaction(dev, ccb); } @@ -2107,7 +2139,7 @@ ahci_process_read_log(device_t dev, unio struct ata_res *res; int i; - ch->readlog = 0; + ch->recoverycmd = 0; data = ccb->ataio.data_ptr; if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP && @@ -2115,6 +2147,8 @@ ahci_process_read_log(device_t dev, unio for (i = 0; i < ch->numslots; i++) { if (!ch->hold[i]) continue; + if (ch->hold[i]->ccb_h.func_code != XPT_ATA_IO) + continue; if ((data[0] & 0x1F) == i) { res = &ch->hold[i]->ataio.res; res->status = data[2]; @@ -2145,6 +2179,8 @@ ahci_process_read_log(device_t dev, unio for (i = 0; i < ch->numslots; i++) { if (!ch->hold[i]) continue; + if (ch->hold[i]->ccb_h.func_code != XPT_ATA_IO) + continue; xpt_done(ch->hold[i]); ch->hold[i] = NULL; ch->numhslots--; @@ -2156,6 +2192,28 @@ ahci_process_read_log(device_t dev, unio } static void +ahci_process_request_sense(device_t dev, union ccb *ccb) +{ + struct ahci_channel *ch = device_get_softc(dev); + int i; + + ch->recoverycmd = 0; + + i = ccb->ccb_h.recovery_slot; + if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { + ch->hold[i]->ccb_h.status |= CAM_AUTOSNS_VALID; + } else { + ch->hold[i]->ccb_h.status &= ~CAM_STATUS_MASK; + ch->hold[i]->ccb_h.status |= CAM_AUTOSENSE_FAIL; + } + xpt_done(ch->hold[i]); + ch->hold[i] = NULL; + ch->numhslots--; + xpt_free_ccb(ccb); + xpt_release_simq(ch->sim, TRUE); +} + +static void ahci_start(device_t dev, int fbs) { struct ahci_channel *ch = device_get_softc(dev); @@ -2513,6 +2571,7 @@ ahciaction(struct cam_sim *sim, union cc ccb->ccb_h.status = CAM_SEL_TIMEOUT; break; } + ccb->ccb_h.recovery_type = RECOVERY_NONE; /* Check for command collision. */ if (ahci_check_collision(dev, ccb)) { /* Freeze command. */ Modified: stable/8/sys/dev/ahci/ahci.h ============================================================================== --- stable/8/sys/dev/ahci/ahci.h Tue Apr 19 17:01:05 2011 (r220855) +++ stable/8/sys/dev/ahci/ahci.h Tue Apr 19 17:04:58 2011 (r220856) @@ -408,7 +408,7 @@ struct ahci_channel { int numtslots; /* Number of tagged slots */ int numtslotspd[16];/* Number of tagged slots per dev */ int numhslots; /* Number of holden slots */ - int readlog; /* Our READ LOG active */ + int recoverycmd; /* Our READ LOG active */ int fatalerr; /* Fatal error happend */ int lastslot; /* Last used slot */ int taggedtarget; /* Last tagged target */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 17:06:44 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 184E01065672; Tue, 19 Apr 2011 17:06: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 047738FC0A; Tue, 19 Apr 2011 17:06:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JH6hnd015832; Tue, 19 Apr 2011 17:06:43 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JH6hbr015829; Tue, 19 Apr 2011 17:06:43 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104191706.p3JH6hbr015829@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Apr 2011 17:06:43 +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: r220857 - stable/8/sys/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: Tue, 19 Apr 2011 17:06:44 -0000 Author: mav Date: Tue Apr 19 17:06:43 2011 New Revision: 220857 URL: http://svn.freebsd.org/changeset/base/220857 Log: MFC r220566: Implement automatic SCSI sense fetching for siis(4). Fix device freeze leak on recovery request (READ LOG, REQUEST SENSE) failure. Modified: stable/8/sys/dev/siis/siis.c stable/8/sys/dev/siis/siis.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/siis/siis.c ============================================================================== --- stable/8/sys/dev/siis/siis.c Tue Apr 19 17:04:58 2011 (r220856) +++ stable/8/sys/dev/siis/siis.c Tue Apr 19 17:06:43 2011 (r220857) @@ -84,8 +84,9 @@ static int siis_wait_ready(device_t dev, static int siis_sata_connect(struct siis_channel *ch); -static void siis_issue_read_log(device_t dev); +static void siis_issue_recovery(device_t dev); static void siis_process_read_log(device_t dev, union ccb *ccb); +static void siis_process_request_sense(device_t dev, union ccb *ccb); static void siisaction(struct cam_sim *sim, union ccb *ccb); static void siispoll(struct cam_sim *sim); @@ -110,6 +111,12 @@ static struct { {0, NULL, 0, 0} }; +#define recovery_type spriv_field0 +#define RECOVERY_NONE 0 +#define RECOVERY_READ_LOG 1 +#define RECOVERY_REQUEST_SENSE 2 +#define recovery_slot spriv_field1 + static int siis_probe(device_t dev) { @@ -873,7 +880,7 @@ siis_ch_intr(void *data) // __func__, sstatus, istatus, ch->rslots, estatus, ccs, port, // ATA_INL(ch->r_mem, SIIS_P_SERR)); - if (!ch->readlog && !ch->recovery) { + if (!ch->recoverycmd && !ch->recovery) { xpt_freeze_simq(ch->sim, ch->numrslots); ch->recovery = 1; } @@ -914,7 +921,7 @@ siis_ch_intr(void *data) * We can't reinit port if there are some other * commands active, use resume to complete them. */ - if (ch->rslots != 0) + if (ch->rslots != 0 && !ch->recoverycmd) ATA_OUTL(ch->r_mem, SIIS_P_CTLSET, SIIS_P_CTL_RESUME); } else { if (estatus == SIIS_P_CMDERR_SENDFIS || @@ -1021,7 +1028,7 @@ siis_dmasetprd(void *arg, bus_dma_segmen mtx_assert(&ch->mtx, MA_OWNED); if (error) { device_printf(slot->dev, "DMA load error\n"); - if (!ch->readlog) + if (!ch->recoverycmd) xpt_freeze_simq(ch->sim, 1); siis_end_transaction(slot, SIIS_ERR_INVALID); return; @@ -1101,7 +1108,7 @@ siis_execute_transaction(struct siis_slo /* Setup the FIS for this request */ if (!siis_setup_fis(dev, ctp, ccb, slot->slot)) { device_printf(ch->dev, "Setting up SATA FIS failed\n"); - if (!ch->readlog) + if (!ch->recoverycmd) xpt_freeze_simq(ch->sim, 1); siis_end_transaction(slot, SIIS_ERR_INVALID); return; @@ -1129,7 +1136,7 @@ siis_process_timeout(device_t dev) int i; mtx_assert(&ch->mtx, MA_OWNED); - if (!ch->readlog && !ch->recovery) { + if (!ch->recoverycmd && !ch->recovery) { xpt_freeze_simq(ch->sim, ch->numrslots); ch->recovery = 1; } @@ -1251,7 +1258,7 @@ siis_end_transaction(struct siis_slot *s ccb->ccb_h.status |= CAM_RELEASE_SIMQ; } /* In case of error, freeze device for proper recovery. */ - if (et != SIIS_ERR_NONE && + if (et != SIIS_ERR_NONE && (!ch->recoverycmd) && !(ccb->ccb_h.status & CAM_DEV_QFRZN)) { xpt_freeze_devq(ccb->ccb_h.path, 1); ccb->ccb_h.status |= CAM_DEV_QFRZN; @@ -1310,10 +1317,15 @@ siis_end_transaction(struct siis_slot *s xpt_release_simq(ch->sim, TRUE); } /* If it was our READ LOG command - process it. */ - if (ch->readlog) { + if (ccb->ccb_h.recovery_type == RECOVERY_READ_LOG) { siis_process_read_log(dev, ccb); - /* If it was NCQ command error, put result on hold. */ - } else if (et == SIIS_ERR_NCQ) { + /* If it was our REQUEST SENSE command - process it. */ + } else if (ccb->ccb_h.recovery_type == RECOVERY_REQUEST_SENSE) { + siis_process_request_sense(dev, ccb); + /* If it was NCQ or ATAPI command error, put result on hold. */ + } else if (et == SIIS_ERR_NCQ || + ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_SCSI_STATUS_ERROR && + (ccb->ccb_h.flags & CAM_DIS_AUTOSENSE) == 0)) { ch->hold[slot->slot] = ccb; ch->numhslots++; } else @@ -1334,9 +1346,9 @@ siis_end_transaction(struct siis_slot *s /* if we have slots in error, we can reinit port. */ if (ch->eslots != 0) siis_portinit(dev); - /* if there commands on hold, we can do READ LOG. */ - if (!ch->readlog && ch->numhslots) - siis_issue_read_log(dev); + /* if there commands on hold, we can do recovery. */ + if (!ch->recoverycmd && ch->numhslots) + siis_issue_recovery(dev); } /* If all the reset of commands are in timeout - abort them. */ } else if ((ch->rslots & ~ch->toslots) == 0 && @@ -1345,11 +1357,12 @@ siis_end_transaction(struct siis_slot *s } static void -siis_issue_read_log(device_t dev) +siis_issue_recovery(device_t dev) { struct siis_channel *ch = device_get_softc(dev); union ccb *ccb; struct ccb_ataio *ataio; + struct ccb_scsiio *csio; int i; /* Find some holden command. */ @@ -1359,32 +1372,51 @@ siis_issue_read_log(device_t dev) } if (i == SIIS_MAX_SLOTS) return; - ch->readlog = 1; + ch->recoverycmd = 1; ccb = xpt_alloc_ccb_nowait(); if (ccb == NULL) { device_printf(dev, "Unable allocate READ LOG command"); return; /* XXX */ } ccb->ccb_h = ch->hold[i]->ccb_h; /* Reuse old header. */ - ccb->ccb_h.func_code = XPT_ATA_IO; - ccb->ccb_h.flags = CAM_DIR_IN; - ccb->ccb_h.timeout = 1000; /* 1s should be enough. */ - ataio = &ccb->ataio; - ataio->data_ptr = malloc(512, M_SIIS, M_NOWAIT); - if (ataio->data_ptr == NULL) { - xpt_free_ccb(ccb); - device_printf(dev, "Unable allocate memory for READ LOG command"); - return; /* XXX */ + if (ccb->ccb_h.func_code == XPT_ATA_IO) { + /* READ LOG */ + ccb->ccb_h.recovery_type = RECOVERY_READ_LOG; + ccb->ccb_h.func_code = XPT_ATA_IO; + ccb->ccb_h.flags = CAM_DIR_IN; + ccb->ccb_h.timeout = 1000; /* 1s should be enough. */ + ataio = &ccb->ataio; + ataio->data_ptr = malloc(512, M_SIIS, M_NOWAIT); + if (ataio->data_ptr == NULL) { + xpt_free_ccb(ccb); + device_printf(dev, "Unable allocate memory for READ LOG command"); + return; /* XXX */ + } + ataio->dxfer_len = 512; + bzero(&ataio->cmd, sizeof(ataio->cmd)); + ataio->cmd.flags = CAM_ATAIO_48BIT; + ataio->cmd.command = 0x2F; /* READ LOG EXT */ + ataio->cmd.sector_count = 1; + ataio->cmd.sector_count_exp = 0; + ataio->cmd.lba_low = 0x10; + ataio->cmd.lba_mid = 0; + ataio->cmd.lba_mid_exp = 0; + } else { + /* REQUEST SENSE */ + ccb->ccb_h.recovery_type = RECOVERY_REQUEST_SENSE; + ccb->ccb_h.recovery_slot = i; + ccb->ccb_h.func_code = XPT_SCSI_IO; + ccb->ccb_h.flags = CAM_DIR_IN; + ccb->ccb_h.status = 0; + ccb->ccb_h.timeout = 1000; /* 1s should be enough. */ + csio = &ccb->csio; + csio->data_ptr = (void *)&ch->hold[i]->csio.sense_data; + csio->dxfer_len = ch->hold[i]->csio.sense_len; + csio->cdb_len = 6; + bzero(&csio->cdb_io, sizeof(csio->cdb_io)); + csio->cdb_io.cdb_bytes[0] = 0x03; + csio->cdb_io.cdb_bytes[4] = csio->dxfer_len; } - ataio->dxfer_len = 512; - bzero(&ataio->cmd, sizeof(ataio->cmd)); - ataio->cmd.flags = CAM_ATAIO_48BIT; - ataio->cmd.command = 0x2F; /* READ LOG EXT */ - ataio->cmd.sector_count = 1; - ataio->cmd.sector_count_exp = 0; - ataio->cmd.lba_low = 0x10; - ataio->cmd.lba_mid = 0; - ataio->cmd.lba_mid_exp = 0; siis_begin_transaction(dev, ccb); } @@ -1396,7 +1428,7 @@ siis_process_read_log(device_t dev, unio struct ata_res *res; int i; - ch->readlog = 0; + ch->recoverycmd = 0; data = ccb->ataio.data_ptr; if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP && (data[0] & 0x80) == 0) { @@ -1447,6 +1479,27 @@ siis_process_read_log(device_t dev, unio } static void +siis_process_request_sense(device_t dev, union ccb *ccb) +{ + struct siis_channel *ch = device_get_softc(dev); + int i; + + ch->recoverycmd = 0; + + i = ccb->ccb_h.recovery_slot; + if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { + ch->hold[i]->ccb_h.status |= CAM_AUTOSNS_VALID; + } else { + ch->hold[i]->ccb_h.status &= ~CAM_STATUS_MASK; + ch->hold[i]->ccb_h.status |= CAM_AUTOSENSE_FAIL; + } + xpt_done(ch->hold[i]); + ch->hold[i] = NULL; + ch->numhslots--; + xpt_free_ccb(ccb); +} + +static void siis_portinit(device_t dev) { struct siis_channel *ch = device_get_softc(dev); @@ -1512,7 +1565,7 @@ siis_reset(device_t dev) xpt_freeze_simq(ch->sim, 1); if (bootverbose) device_printf(dev, "SIIS reset...\n"); - if (!ch->readlog && !ch->recovery) + if (!ch->recoverycmd && !ch->recovery) xpt_freeze_simq(ch->sim, ch->numrslots); /* Requeue frozen command. */ if (ch->frozen) { @@ -1732,6 +1785,7 @@ siisaction(struct cam_sim *sim, union cc ccb->ccb_h.status = CAM_SEL_TIMEOUT; break; } + ccb->ccb_h.recovery_type = RECOVERY_NONE; /* Check for command collision. */ if (siis_check_collision(dev, ccb)) { /* Freeze command. */ Modified: stable/8/sys/dev/siis/siis.h ============================================================================== --- stable/8/sys/dev/siis/siis.h Tue Apr 19 17:04:58 2011 (r220856) +++ stable/8/sys/dev/siis/siis.h Tue Apr 19 17:06:43 2011 (r220857) @@ -388,7 +388,7 @@ struct siis_channel { int numrslots; /* Number of running slots */ int numtslots[SIIS_MAX_SLOTS]; /* Number of tagged slots */ int numhslots; /* Number of holden slots */ - int readlog; /* Our READ LOG active */ + int recoverycmd; /* Our READ LOG active */ int fatalerr; /* Fatal error happend */ int recovery; /* Some slots are in error */ union ccb *frozen; /* Frozen command */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 17:08:30 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 481651065670; Tue, 19 Apr 2011 17:08: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 344618FC15; Tue, 19 Apr 2011 17:08:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JH8Um2015917; Tue, 19 Apr 2011 17:08:30 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JH8Ulp015914; Tue, 19 Apr 2011 17:08:30 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104191708.p3JH8Ulp015914@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Apr 2011 17:08: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: r220858 - stable/8/sys/dev/mvs 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, 19 Apr 2011 17:08:30 -0000 Author: mav Date: Tue Apr 19 17:08:29 2011 New Revision: 220858 URL: http://svn.freebsd.org/changeset/base/220858 Log: MFC r220569: Implement automatic SCSI sense fetching for mvs(4). Make few improvements/changes to ATAPI PIO support to pass most of scgcheck (cdrtools) tests. Modified: stable/8/sys/dev/mvs/mvs.c stable/8/sys/dev/mvs/mvs.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/mvs/mvs.c ============================================================================== --- stable/8/sys/dev/mvs/mvs.c Tue Apr 19 17:06:43 2011 (r220857) +++ stable/8/sys/dev/mvs/mvs.c Tue Apr 19 17:08:29 2011 (r220858) @@ -85,14 +85,21 @@ static void mvs_requeue_frozen(device_t static void mvs_execute_transaction(struct mvs_slot *slot); static void mvs_end_transaction(struct mvs_slot *slot, enum mvs_err_type et); -static void mvs_issue_read_log(device_t dev); +static void mvs_issue_recovery(device_t dev); static void mvs_process_read_log(device_t dev, union ccb *ccb); +static void mvs_process_request_sense(device_t dev, union ccb *ccb); static void mvsaction(struct cam_sim *sim, union ccb *ccb); static void mvspoll(struct cam_sim *sim); MALLOC_DEFINE(M_MVS, "MVS driver", "MVS driver data buffers"); +#define recovery_type spriv_field0 +#define RECOVERY_NONE 0 +#define RECOVERY_READ_LOG 1 +#define RECOVERY_REQUEST_SENSE 2 +#define recovery_slot spriv_field1 + static int mvs_ch_probe(device_t dev) { @@ -821,7 +828,8 @@ mvs_legacy_intr(device_t dev) union ccb *ccb = slot->ccb; enum mvs_err_type et = MVS_ERR_NONE; int port; - u_int length; + u_int length, resid, size; + uint8_t buf[2]; uint8_t status, ireason; /* Clear interrupt and get status. */ @@ -894,6 +902,7 @@ mvs_legacy_intr(device_t dev) } else { /* ATAPI PIO */ length = ATA_INB(ch->r_mem,ATA_CYL_LSB) | (ATA_INB(ch->r_mem,ATA_CYL_MSB) << 8); + size = min(ch->transfersize, length); ireason = ATA_INB(ch->r_mem,ATA_IREASON); switch ((ireason & (ATA_I_CMD | ATA_I_IN)) | (status & ATA_S_DRQ)) { @@ -912,7 +921,10 @@ mvs_legacy_intr(device_t dev) } ATA_OUTSW_STRM(ch->r_mem, ATA_DATA, (uint16_t *)(ccb->csio.data_ptr + ch->donecount), - length / 2); + (size + 1) / 2); + for (resid = ch->transfersize + (size & 1); + resid < length; resid += sizeof(int16_t)) + ATA_OUTW(ch->r_mem, ATA_DATA, 0); ch->donecount += length; /* Set next transfer size according to HW capabilities */ ch->transfersize = min(ccb->csio.dxfer_len - ch->donecount, @@ -926,9 +938,19 @@ mvs_legacy_intr(device_t dev) et = MVS_ERR_TFE; goto end_finished; } - ATA_INSW_STRM(ch->r_mem, ATA_DATA, - (uint16_t *)(ccb->csio.data_ptr + ch->donecount), - length / 2); + if (size >= 2) { + ATA_INSW_STRM(ch->r_mem, ATA_DATA, + (uint16_t *)(ccb->csio.data_ptr + ch->donecount), + size / 2); + } + if (size & 1) { + ATA_INSW_STRM(ch->r_mem, ATA_DATA, (void*)buf, 1); + ((uint8_t *)ccb->csio.data_ptr + ch->donecount + + (size & ~1))[0] = buf[0]; + } + for (resid = ch->transfersize + (size & 1); + resid < length; resid += sizeof(int16_t)) + ATA_INW(ch->r_mem, ATA_DATA); ch->donecount += length; /* Set next transfer size according to HW capabilities */ ch->transfersize = min(ccb->csio.dxfer_len - ch->donecount, @@ -1362,8 +1384,7 @@ mvs_legacy_execute_transaction(struct mv ATA_OUTL(ch->r_mem, DMA_C, DMA_C_START | (((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) ? DMA_C_READ : 0)); - } else if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) - ch->fake_busy = 1; + } } /* Start command execution timeout */ callout_reset(&slot->timeout, (int)ccb->ccb_h.timeout * hz / 1000, @@ -1578,6 +1599,10 @@ mvs_end_transaction(struct mvs_slot *slo mvs_tfd_read(dev, ccb); } else bzero(res, sizeof(*res)); + } else { + if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE && + ch->basic_dma == 0) + ccb->csio.resid = ccb->csio.dxfer_len - ch->donecount; } if (ch->numpslots == 0 || ch->basic_dma) { if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) { @@ -1590,7 +1615,7 @@ mvs_end_transaction(struct mvs_slot *slo if (et != MVS_ERR_NONE) ch->eslots |= (1 << slot->slot); /* In case of error, freeze device for proper recovery. */ - if ((et != MVS_ERR_NONE) && (!ch->readlog) && + if ((et != MVS_ERR_NONE) && (!ch->recoverycmd) && !(ccb->ccb_h.status & CAM_DEV_QFRZN)) { xpt_freeze_devq(ccb->ccb_h.path, 1); ccb->ccb_h.status |= CAM_DEV_QFRZN; @@ -1621,7 +1646,7 @@ mvs_end_transaction(struct mvs_slot *slo break; case MVS_ERR_SATA: ch->fatalerr = 1; - if (!ch->readlog) { + if (!ch->recoverycmd) { xpt_freeze_simq(ch->sim, 1); ccb->ccb_h.status &= ~CAM_STATUS_MASK; ccb->ccb_h.status |= CAM_RELEASE_SIMQ; @@ -1629,7 +1654,7 @@ mvs_end_transaction(struct mvs_slot *slo ccb->ccb_h.status |= CAM_UNCOR_PARITY; break; case MVS_ERR_TIMEOUT: - if (!ch->readlog) { + if (!ch->recoverycmd) { xpt_freeze_simq(ch->sim, 1); ccb->ccb_h.status &= ~CAM_STATUS_MASK; ccb->ccb_h.status |= CAM_RELEASE_SIMQ; @@ -1671,10 +1696,15 @@ mvs_end_transaction(struct mvs_slot *slo xpt_release_simq(ch->sim, TRUE); } /* If it was our READ LOG command - process it. */ - if (ch->readlog) { + if (ccb->ccb_h.recovery_type == RECOVERY_READ_LOG) { mvs_process_read_log(dev, ccb); - /* If it was NCQ command error, put result on hold. */ - } else if (et == MVS_ERR_NCQ) { + /* If it was our REQUEST SENSE command - process it. */ + } else if (ccb->ccb_h.recovery_type == RECOVERY_REQUEST_SENSE) { + mvs_process_request_sense(dev, ccb); + /* If it was NCQ or ATAPI command error, put result on hold. */ + } else if (et == MVS_ERR_NCQ || + ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_SCSI_STATUS_ERROR && + (ccb->ccb_h.flags & CAM_DIS_AUTOSENSE) == 0)) { ch->hold[slot->slot] = ccb; ch->holdtag[slot->slot] = slot->tag; ch->numhslots++; @@ -1699,8 +1729,8 @@ mvs_end_transaction(struct mvs_slot *slo ch->eslots = 0; } /* if there commands on hold, we can do READ LOG. */ - if (!ch->readlog && ch->numhslots) - mvs_issue_read_log(dev); + if (!ch->recoverycmd && ch->numhslots) + mvs_issue_recovery(dev); } /* If all the rest of commands are in timeout - give them chance. */ } else if ((ch->rslots & ~ch->toslots) == 0 && @@ -1715,14 +1745,15 @@ mvs_end_transaction(struct mvs_slot *slo } static void -mvs_issue_read_log(device_t dev) +mvs_issue_recovery(device_t dev) { struct mvs_channel *ch = device_get_softc(dev); union ccb *ccb; struct ccb_ataio *ataio; + struct ccb_scsiio *csio; int i; - ch->readlog = 1; + ch->recoverycmd = 1; /* Find some holden command. */ for (i = 0; i < MVS_MAX_SLOTS; i++) { if (ch->hold[i]) @@ -1734,25 +1765,44 @@ mvs_issue_read_log(device_t dev) return; /* XXX */ } ccb->ccb_h = ch->hold[i]->ccb_h; /* Reuse old header. */ - ccb->ccb_h.func_code = XPT_ATA_IO; - ccb->ccb_h.flags = CAM_DIR_IN; - ccb->ccb_h.timeout = 1000; /* 1s should be enough. */ - ataio = &ccb->ataio; - ataio->data_ptr = malloc(512, M_MVS, M_NOWAIT); - if (ataio->data_ptr == NULL) { - xpt_free_ccb(ccb); - device_printf(dev, "Unable allocate memory for READ LOG command"); - return; /* XXX */ + if (ccb->ccb_h.func_code == XPT_ATA_IO) { + /* READ LOG */ + ccb->ccb_h.recovery_type = RECOVERY_READ_LOG; + ccb->ccb_h.func_code = XPT_ATA_IO; + ccb->ccb_h.flags = CAM_DIR_IN; + ccb->ccb_h.timeout = 1000; /* 1s should be enough. */ + ataio = &ccb->ataio; + ataio->data_ptr = malloc(512, M_MVS, M_NOWAIT); + if (ataio->data_ptr == NULL) { + xpt_free_ccb(ccb); + device_printf(dev, "Unable allocate memory for READ LOG command"); + return; /* XXX */ + } + ataio->dxfer_len = 512; + bzero(&ataio->cmd, sizeof(ataio->cmd)); + ataio->cmd.flags = CAM_ATAIO_48BIT; + ataio->cmd.command = 0x2F; /* READ LOG EXT */ + ataio->cmd.sector_count = 1; + ataio->cmd.sector_count_exp = 0; + ataio->cmd.lba_low = 0x10; + ataio->cmd.lba_mid = 0; + ataio->cmd.lba_mid_exp = 0; + } else { + /* REQUEST SENSE */ + ccb->ccb_h.recovery_type = RECOVERY_REQUEST_SENSE; + ccb->ccb_h.recovery_slot = i; + ccb->ccb_h.func_code = XPT_SCSI_IO; + ccb->ccb_h.flags = CAM_DIR_IN; + ccb->ccb_h.status = 0; + ccb->ccb_h.timeout = 1000; /* 1s should be enough. */ + csio = &ccb->csio; + csio->data_ptr = (void *)&ch->hold[i]->csio.sense_data; + csio->dxfer_len = ch->hold[i]->csio.sense_len; + csio->cdb_len = 6; + bzero(&csio->cdb_io, sizeof(csio->cdb_io)); + csio->cdb_io.cdb_bytes[0] = 0x03; + csio->cdb_io.cdb_bytes[4] = csio->dxfer_len; } - ataio->dxfer_len = 512; - bzero(&ataio->cmd, sizeof(ataio->cmd)); - ataio->cmd.flags = CAM_ATAIO_48BIT; - ataio->cmd.command = 0x2F; /* READ LOG EXT */ - ataio->cmd.sector_count = 1; - ataio->cmd.sector_count_exp = 0; - ataio->cmd.lba_low = 0x10; - ataio->cmd.lba_mid = 0; - ataio->cmd.lba_mid_exp = 0; /* Freeze SIM while doing READ LOG EXT. */ xpt_freeze_simq(ch->sim, 1); mvs_begin_transaction(dev, ccb); @@ -1766,7 +1816,7 @@ mvs_process_read_log(device_t dev, union struct ata_res *res; int i; - ch->readlog = 0; + ch->recoverycmd = 0; data = ccb->ataio.data_ptr; if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP && @@ -1819,6 +1869,28 @@ mvs_process_read_log(device_t dev, union xpt_release_simq(ch->sim, TRUE); } +static void +mvs_process_request_sense(device_t dev, union ccb *ccb) +{ + struct mvs_channel *ch = device_get_softc(dev); + int i; + + ch->recoverycmd = 0; + + i = ccb->ccb_h.recovery_slot; + if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { + ch->hold[i]->ccb_h.status |= CAM_AUTOSNS_VALID; + } else { + ch->hold[i]->ccb_h.status &= ~CAM_STATUS_MASK; + ch->hold[i]->ccb_h.status |= CAM_AUTOSENSE_FAIL; + } + xpt_done(ch->hold[i]); + ch->hold[i] = NULL; + ch->numhslots--; + xpt_free_ccb(ccb); + xpt_release_simq(ch->sim, TRUE); +} + static int mvs_wait(device_t dev, u_int s, u_int c, int t) { @@ -2051,6 +2123,7 @@ mvsaction(struct cam_sim *sim, union ccb ccb->ccb_h.status = CAM_SEL_TIMEOUT; break; } + ccb->ccb_h.recovery_type = RECOVERY_NONE; /* Check for command collision. */ if (mvs_check_collision(dev, ccb)) { /* Freeze command. */ Modified: stable/8/sys/dev/mvs/mvs.h ============================================================================== --- stable/8/sys/dev/mvs/mvs.h Tue Apr 19 17:06:43 2011 (r220857) +++ stable/8/sys/dev/mvs/mvs.h Tue Apr 19 17:08:29 2011 (r220858) @@ -557,7 +557,7 @@ struct mvs_channel { int numtslots; /* Number of NCQ slots */ int numtslotspd[16];/* Number of NCQ slots per dev */ int numhslots; /* Number of holden slots */ - int readlog; /* Our READ LOG active */ + int recoverycmd; /* Our READ LOG active */ int fatalerr; /* Fatal error happend */ int lastslot; /* Last used slot */ int taggedtarget; /* Last tagged target */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 17:13:14 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E34C81065674; Tue, 19 Apr 2011 17:13: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 CFF1F8FC19; Tue, 19 Apr 2011 17:13:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JHDEHN016086; Tue, 19 Apr 2011 17:13:14 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JHDEYv016083; Tue, 19 Apr 2011 17:13:14 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104191713.p3JHDEYv016083@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Apr 2011 17:13: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: r220859 - stable/8/sys/dev/ahci 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, 19 Apr 2011 17:13:15 -0000 Author: mav Date: Tue Apr 19 17:13:14 2011 New Revision: 220859 URL: http://svn.freebsd.org/changeset/base/220859 Log: MFC r220576: Refactor hard-reset implementation in ahci(4). Instead of spinning in a tight loop for up to 15 seconds, polling for device readiness while it spins up, return reset completion just after PHY reports "connect well" or 100ms connection timeout. If device was found, use callout for checking device readiness with 100ms period up to full 31 second timeout. This fixes system freeze for 5-10 seconds on drives hot plug-in. Modified: stable/8/sys/dev/ahci/ahci.c stable/8/sys/dev/ahci/ahci.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Tue Apr 19 17:08:29 2011 (r220858) +++ stable/8/sys/dev/ahci/ahci.c Tue Apr 19 17:13:14 2011 (r220859) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -89,7 +90,7 @@ static void ahci_stop_fr(device_t dev); static int ahci_sata_connect(struct ahci_channel *ch); static int ahci_sata_phy_reset(device_t dev); -static int ahci_wait_ready(device_t dev, int t); +static int ahci_wait_ready(device_t dev, int t, int t0); static void ahci_issue_recovery(device_t dev); static void ahci_process_read_log(device_t dev, union ccb *ccb); @@ -883,6 +884,7 @@ ahci_ch_attach(device_t dev) device_get_unit(dev), "pm_level", &ch->pm_level); if (ch->pm_level > 3) callout_init_mtx(&ch->pm_timer, &ch->mtx, 0); + callout_init_mtx(&ch->reset_timer, &ch->mtx, 0); /* Limit speed for my onboard JMicron external port. * It is not eSATA really. */ if (pci_get_devid(ctlr->dev) == 0x2363197b && @@ -999,6 +1001,11 @@ ahci_ch_detach(device_t dev) mtx_lock(&ch->mtx); xpt_async(AC_LOST_DEVICE, ch->path, NULL); + /* Forget about reset. */ + if (ch->resetting) { + ch->resetting = 0; + xpt_release_simq(ch->sim, TRUE); + } xpt_free_path(ch->path); xpt_bus_deregister(cam_sim_path(ch->sim)); cam_sim_free(ch->sim, /*free_devq*/TRUE); @@ -1006,6 +1013,7 @@ ahci_ch_detach(device_t dev) if (ch->pm_level > 3) callout_drain(&ch->pm_timer); + callout_drain(&ch->reset_timer); bus_teardown_intr(dev, ch->r_irq, ch->ih); bus_release_resource(dev, SYS_RES_IRQ, ATA_IRQ_RID, ch->r_irq); @@ -1071,6 +1079,12 @@ ahci_ch_suspend(device_t dev) mtx_lock(&ch->mtx); xpt_freeze_simq(ch->sim, 1); + /* Forget about reset. */ + if (ch->resetting) { + ch->resetting = 0; + callout_stop(&ch->reset_timer); + xpt_release_simq(ch->sim, TRUE); + } while (ch->oslots) msleep(ch, &ch->mtx, PRIBIO, "ahcisusp", hz/100); ahci_ch_deinit(dev); @@ -2314,7 +2328,7 @@ ahci_start_fr(device_t dev) } static int -ahci_wait_ready(device_t dev, int t) +ahci_wait_ready(device_t dev, int t, int t0) { struct ahci_channel *ch = device_get_softc(dev); int timeout = 0; @@ -2322,19 +2336,50 @@ ahci_wait_ready(device_t dev, int t) while ((val = ATA_INL(ch->r_mem, AHCI_P_TFD)) & (ATA_S_BUSY | ATA_S_DRQ)) { - DELAY(1000); - if (timeout++ > t) { - device_printf(dev, "device is not ready (timeout %dms) " - "tfd = %08x\n", t, val); + if (timeout > t) { + if (t != 0) { + device_printf(dev, + "AHCI reset: device not ready after %dms " + "(tfd = %08x)\n", + MAX(t, 0) + t0, val); + } return (EBUSY); } - } + DELAY(1000); + timeout++; + } if (bootverbose) - device_printf(dev, "ready wait time=%dms\n", timeout); + device_printf(dev, "AHCI reset: device ready after %dms\n", + timeout + t0); return (0); } static void +ahci_reset_to(void *arg) +{ + device_t dev = arg; + struct ahci_channel *ch = device_get_softc(dev); + + if (ch->resetting == 0) + return; + ch->resetting--; + if (ahci_wait_ready(dev, ch->resetting == 0 ? -1 : 0, + (310 - ch->resetting) * 100) == 0) { + ch->resetting = 0; + xpt_release_simq(ch->sim, TRUE); + return; + } + if (ch->resetting == 0) { + ahci_stop(dev); + ahci_clo(dev); + ahci_start(dev, 1); + xpt_release_simq(ch->sim, TRUE); + return; + } + callout_schedule(&ch->reset_timer, hz / 10); +} + +static void ahci_reset(device_t dev) { struct ahci_channel *ch = device_get_softc(dev); @@ -2344,6 +2389,12 @@ ahci_reset(device_t dev) xpt_freeze_simq(ch->sim, 1); if (bootverbose) device_printf(dev, "AHCI reset...\n"); + /* Forget about previous reset. */ + if (ch->resetting) { + ch->resetting = 0; + callout_stop(&ch->reset_timer); + xpt_release_simq(ch->sim, TRUE); + } /* Requeue freezed command. */ if (ch->frozen) { union ccb *fccb = ch->frozen; @@ -2384,7 +2435,7 @@ ahci_reset(device_t dev) if (!ahci_sata_phy_reset(dev)) { if (bootverbose) device_printf(dev, - "AHCI reset done: phy reset found no device\n"); + "AHCI reset: device not found\n"); ch->devices = 0; /* Enable wanted port interrupts */ ATA_OUTL(ch->r_mem, AHCI_P_IE, @@ -2392,9 +2443,15 @@ ahci_reset(device_t dev) xpt_release_simq(ch->sim, TRUE); return; } + if (bootverbose) + device_printf(dev, "AHCI reset: device found\n"); /* Wait for clearing busy status. */ - if (ahci_wait_ready(dev, 15000)) - ahci_clo(dev); + if (ahci_wait_ready(dev, dumping ? 31000 : 0, 0)) { + if (dumping) + ahci_clo(dev); + else + ch->resetting = 310; + } ahci_start(dev, 1); ch->devices = 1; /* Enable wanted port interrupts */ @@ -2404,9 +2461,10 @@ ahci_reset(device_t dev) ((ch->pm_level == 0) ? AHCI_P_IX_PRC | AHCI_P_IX_PC : 0) | AHCI_P_IX_DP | AHCI_P_IX_UF | (ctlr->ccc ? 0 : AHCI_P_IX_SDB) | AHCI_P_IX_DS | AHCI_P_IX_PS | (ctlr->ccc ? 0 : AHCI_P_IX_DHR))); - if (bootverbose) - device_printf(dev, "AHCI reset done: device found\n"); - xpt_release_simq(ch->sim, TRUE); + if (ch->resetting) + callout_reset(&ch->reset_timer, hz / 10, ahci_reset_to, dev); + else + xpt_release_simq(ch->sim, TRUE); } static int Modified: stable/8/sys/dev/ahci/ahci.h ============================================================================== --- stable/8/sys/dev/ahci/ahci.h Tue Apr 19 17:08:29 2011 (r220858) +++ stable/8/sys/dev/ahci/ahci.h Tue Apr 19 17:13:14 2011 (r220859) @@ -412,8 +412,10 @@ struct ahci_channel { int fatalerr; /* Fatal error happend */ int lastslot; /* Last used slot */ int taggedtarget; /* Last tagged target */ + int resetting; /* Hard-reset in progress. */ union ccb *frozen; /* Frozen command */ struct callout pm_timer; /* Power management events */ + struct callout reset_timer; /* Hard-reset timeout */ struct ahci_device user[16]; /* User-specified settings */ struct ahci_device curr[16]; /* Current settings */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 17:14:58 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B805106564A; Tue, 19 Apr 2011 17:14: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 28A4B8FC0A; Tue, 19 Apr 2011 17:14:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JHEwYm016167; Tue, 19 Apr 2011 17:14:58 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JHEwio016165; Tue, 19 Apr 2011 17:14:58 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104191714.p3JHEwio016165@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Apr 2011 17:14: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: r220860 - stable/8/sys/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: Tue, 19 Apr 2011 17:14:58 -0000 Author: mav Date: Tue Apr 19 17:14:57 2011 New Revision: 220860 URL: http://svn.freebsd.org/changeset/base/220860 Log: MFC r220591: As soon as siis_reset() doesn't waits for device readiness, but only for controller port readiness (that should set just after PHY ready signal), reduce wait time from 10s to 1s before trying more aggressive reset method. This should improve system responsibility in some failure conditions. Modified: stable/8/sys/dev/siis/siis.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/siis/siis.c ============================================================================== --- stable/8/sys/dev/siis/siis.c Tue Apr 19 17:13:14 2011 (r220859) +++ stable/8/sys/dev/siis/siis.c Tue Apr 19 17:14:57 2011 (r220860) @@ -1631,9 +1631,9 @@ retry: xpt_release_simq(ch->sim, TRUE); return; } - /* Wait for clearing busy status. */ - if (siis_wait_ready(dev, 10000)) { - device_printf(dev, "device ready timeout\n"); + /* Wait for port ready status. */ + if (siis_wait_ready(dev, 1000)) { + device_printf(dev, "port ready timeout\n"); if (!retry) { device_printf(dev, "trying full port reset ...\n"); /* Get port to the reset state. */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 17:41:17 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC1EB106566C; Tue, 19 Apr 2011 17:41: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 D738E8FC15; Tue, 19 Apr 2011 17:41:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JHfH9Z016933; Tue, 19 Apr 2011 17:41:17 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JHfHcS016925; Tue, 19 Apr 2011 17:41:17 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104191741.p3JHfHcS016925@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Apr 2011 17:41:17 +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: r220861 - in stable/8/sys: cam cam/ata dev/ahci dev/mvs dev/siis 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, 19 Apr 2011 17:41:18 -0000 Author: mav Date: Tue Apr 19 17:41:17 2011 New Revision: 220861 URL: http://svn.freebsd.org/changeset/base/220861 Log: MFC r220602: Improve SATA Asynchronous Notification feature support in CAM: - make SATA SIMs announce capabilities to handle SDB with Notification bit; - make PMP driver honor this SIMs capability; - make SATA XPT to negotiate and enable this feature for ATAPI devices. This feature allows supporting SATA ATAPI devices to inform system about some events happened, that may require attention. In my case this allows LG GH22LS50 SATA DVR-RW drive to report tray open/close events. Events reported to CAM in form of AC_SCSI_AEN async. Further they could be used as a hints for checking device status and reporting media change to upper layers, for example, via spoiling mechanism of GEOM. Modified: stable/8/sys/cam/ata/ata_pmp.c stable/8/sys/cam/ata/ata_xpt.c stable/8/sys/cam/cam_ccb.h stable/8/sys/dev/ahci/ahci.c stable/8/sys/dev/mvs/mvs.c stable/8/sys/dev/siis/siis.c stable/8/sys/sys/ata.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/cam/ata/ata_pmp.c ============================================================================== --- stable/8/sys/cam/ata/ata_pmp.c Tue Apr 19 17:14:57 2011 (r220860) +++ stable/8/sys/cam/ata/ata_pmp.c Tue Apr 19 17:41:17 2011 (r220861) @@ -533,7 +533,8 @@ pmpstart(struct cam_periph *periph, unio /*data_ptr*/NULL, /*dxfer_len*/0, pmp_default_timeout * 1000); - ata_pm_write_cmd(ataio, 0x60, 15, 0xf); + ata_pm_write_cmd(ataio, 0x60, 15, 0x07 | + ((softc->caps & CTS_SATA_CAPS_H_AN) ? 0x08 : 0)); break; default: break; @@ -672,7 +673,9 @@ pmpdone(struct cam_periph *periph, union cts.xport_specific.sata.revision = (res & 0x0f0) >> 4; cts.xport_specific.sata.valid = CTS_SATA_VALID_REVISION; cts.xport_specific.sata.caps = softc->caps & - (CTS_SATA_CAPS_H_PMREQ | CTS_SATA_CAPS_H_DMAAA); + (CTS_SATA_CAPS_H_PMREQ | + CTS_SATA_CAPS_H_DMAAA | + CTS_SATA_CAPS_H_AN); cts.xport_specific.sata.valid |= CTS_SATA_VALID_CAPS; xpt_action((union ccb *)&cts); xpt_free_path(dpath); Modified: stable/8/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/8/sys/cam/ata/ata_xpt.c Tue Apr 19 17:14:57 2011 (r220860) +++ stable/8/sys/cam/ata/ata_xpt.c Tue Apr 19 17:41:17 2011 (r220861) @@ -87,6 +87,7 @@ typedef enum { PROBE_SETPM, PROBE_SETAPST, PROBE_SETDMAAA, + PROBE_SETAN, PROBE_SET_MULTI, PROBE_INQUIRY, PROBE_FULL_INQUIRY, @@ -103,6 +104,7 @@ static char *probe_action_text[] = { "PROBE_SETPM", "PROBE_SETAPST", "PROBE_SETDMAAA", + "PROBE_SETAN", "PROBE_SET_MULTI", "PROBE_INQUIRY", "PROBE_FULL_INQUIRY", @@ -436,6 +438,19 @@ negotiate: (softc->caps & CTS_SATA_CAPS_H_DMAAA) ? 0x10 : 0x90, 0, 0x02); break; + case PROBE_SETAN: + cam_fill_ataio(ataio, + 1, + probedone, + CAM_DIR_NONE, + 0, + NULL, + 0, + 30*1000); + ata_28bit_cmd(ataio, ATA_SETFEATURES, + (softc->caps & CTS_SATA_CAPS_H_AN) ? 0x10 : 0x90, + 0, 0x05); + break; case PROBE_SET_MULTI: { u_int sectors, bytecount; @@ -1027,6 +1042,16 @@ noerror: } /* FALLTHROUGH */ case PROBE_SETDMAAA: + if ((ident_buf->satasupport & ATA_SUPPORT_ASYNCNOTIF) && + (!(softc->caps & CTS_SATA_CAPS_H_AN)) != + (!(ident_buf->sataenabled & ATA_SUPPORT_ASYNCNOTIF))) { + PROBE_SET_ACTION(softc, PROBE_SETAN); + xpt_release_ccb(done_ccb); + xpt_schedule(periph, priority); + return; + } + /* FALLTHROUGH */ + case PROBE_SETAN: notsata: if (path->device->protocol == PROTO_ATA) { PROBE_SET_ACTION(softc, PROBE_SET_MULTI); Modified: stable/8/sys/cam/cam_ccb.h ============================================================================== --- stable/8/sys/cam/cam_ccb.h Tue Apr 19 17:14:57 2011 (r220860) +++ stable/8/sys/cam/cam_ccb.h Tue Apr 19 17:41:17 2011 (r220861) @@ -849,6 +849,7 @@ struct ccb_trans_settings_sata { #define CTS_SATA_CAPS_H_PMREQ 0x00000001 #define CTS_SATA_CAPS_H_APST 0x00000002 #define CTS_SATA_CAPS_H_DMAAA 0x00000010 /* Auto-activation */ +#define CTS_SATA_CAPS_H_AN 0x00000020 /* Async. notification */ #define CTS_SATA_CAPS_D 0xffff0000 #define CTS_SATA_CAPS_D_PMREQ 0x00010000 #define CTS_SATA_CAPS_D_APST 0x00020000 Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Tue Apr 19 17:14:57 2011 (r220860) +++ stable/8/sys/dev/ahci/ahci.c Tue Apr 19 17:41:17 2011 (r220861) @@ -908,7 +908,8 @@ ahci_ch_attach(device_t dev) CTS_SATA_CAPS_H_APST | CTS_SATA_CAPS_D_PMREQ | CTS_SATA_CAPS_D_APST; } - ch->user[i].caps |= CTS_SATA_CAPS_H_DMAAA; + ch->user[i].caps |= CTS_SATA_CAPS_H_DMAAA | + CTS_SATA_CAPS_H_AN; } rid = ch->unit; if (!(ch->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, @@ -2715,6 +2716,7 @@ ahciaction(struct cam_sim *sim, union cc if ((ch->caps & AHCI_CAP_SNCQ) && (ch->quirks & AHCI_Q_NOAA) == 0) cts->xport_specific.sata.caps |= CTS_SATA_CAPS_H_DMAAA; + cts->xport_specific.sata.caps |= CTS_SATA_CAPS_H_AN; cts->xport_specific.sata.caps &= ch->user[ccb->ccb_h.target_id].caps; cts->xport_specific.sata.valid |= CTS_SATA_VALID_CAPS; Modified: stable/8/sys/dev/mvs/mvs.c ============================================================================== --- stable/8/sys/dev/mvs/mvs.c Tue Apr 19 17:14:57 2011 (r220860) +++ stable/8/sys/dev/mvs/mvs.c Tue Apr 19 17:41:17 2011 (r220861) @@ -137,6 +137,7 @@ mvs_ch_attach(device_t dev) CTS_SATA_CAPS_H_APST | CTS_SATA_CAPS_D_PMREQ | CTS_SATA_CAPS_D_APST; } + ch->user[i].caps |= CTS_SATA_CAPS_H_AN; } rid = ch->unit; if (!(ch->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, @@ -860,6 +861,8 @@ mvs_legacy_intr(device_t dev) if (mvs_wait(dev, ATA_S_DRQ, ATA_S_BUSY, 1000) < 0) { device_printf(dev, "timeout waiting for read DRQ\n"); et = MVS_ERR_TIMEOUT; + xpt_freeze_simq(ch->sim, 1); + ch->toslots |= (1 << slot->slot); goto end_finished; } ATA_INSW_STRM(ch->r_mem, ATA_DATA, @@ -879,6 +882,8 @@ mvs_legacy_intr(device_t dev) device_printf(dev, "timeout waiting for write DRQ\n"); et = MVS_ERR_TIMEOUT; + xpt_freeze_simq(ch->sim, 1); + ch->toslots |= (1 << slot->slot); goto end_finished; } ATA_OUTSW_STRM(ch->r_mem, ATA_DATA, @@ -1324,6 +1329,8 @@ mvs_legacy_execute_transaction(struct mv if (mvs_wait(dev, ATA_S_DRQ, ATA_S_BUSY, 1000) < 0) { device_printf(dev, "timeout waiting for write DRQ\n"); + xpt_freeze_simq(ch->sim, 1); + ch->toslots |= (1 << slot->slot); mvs_end_transaction(slot, MVS_ERR_TIMEOUT); return; } @@ -1350,6 +1357,8 @@ mvs_legacy_execute_transaction(struct mv /* Wait for ready to write ATAPI command block */ if (mvs_wait(dev, 0, ATA_S_BUSY, 1000) < 0) { device_printf(dev, "timeout waiting for ATAPI !BUSY\n"); + xpt_freeze_simq(ch->sim, 1); + ch->toslots |= (1 << slot->slot); mvs_end_transaction(slot, MVS_ERR_TIMEOUT); return; } @@ -1366,6 +1375,8 @@ mvs_legacy_execute_transaction(struct mv if (timeout <= 0) { device_printf(dev, "timeout waiting for ATAPI command ready\n"); + xpt_freeze_simq(ch->sim, 1); + ch->toslots |= (1 << slot->slot); mvs_end_transaction(slot, MVS_ERR_TIMEOUT); return; } @@ -2204,6 +2215,7 @@ mvsaction(struct cam_sim *sim, union ccb cts->xport_specific.sata.caps = d->caps & CTS_SATA_CAPS_D; // if (ch->pm_level) // cts->xport_specific.sata.caps |= CTS_SATA_CAPS_H_PMREQ; + cts->xport_specific.sata.caps |= CTS_SATA_CAPS_H_AN; cts->xport_specific.sata.caps &= ch->user[ccb->ccb_h.target_id].caps; cts->xport_specific.sata.valid |= CTS_SATA_VALID_CAPS; @@ -2211,6 +2223,9 @@ mvsaction(struct cam_sim *sim, union ccb cts->xport_specific.sata.revision = d->revision; cts->xport_specific.sata.valid |= CTS_SATA_VALID_REVISION; cts->xport_specific.sata.caps = d->caps; + if (cts->type == CTS_TYPE_CURRENT_SETTINGS/* && + (ch->quirks & MVS_Q_GENIIE) == 0*/) + cts->xport_specific.sata.caps &= ~CTS_SATA_CAPS_H_AN; cts->xport_specific.sata.valid |= CTS_SATA_VALID_CAPS; } cts->xport_specific.sata.mode = d->mode; Modified: stable/8/sys/dev/siis/siis.c ============================================================================== --- stable/8/sys/dev/siis/siis.c Tue Apr 19 17:14:57 2011 (r220860) +++ stable/8/sys/dev/siis/siis.c Tue Apr 19 17:41:17 2011 (r220861) @@ -474,6 +474,7 @@ siis_ch_attach(device_t dev) ch->curr[i] = ch->user[i]; if (ch->pm_level) ch->user[i].caps = CTS_SATA_CAPS_H_PMREQ; + ch->user[i].caps |= CTS_SATA_CAPS_H_AN; } mtx_init(&ch->mtx, "SIIS channel lock", NULL, MTX_DEF); rid = ch->unit; @@ -1869,6 +1870,7 @@ siisaction(struct cam_sim *sim, union cc cts->xport_specific.sata.caps = d->caps & CTS_SATA_CAPS_D; if (ch->pm_level) cts->xport_specific.sata.caps |= CTS_SATA_CAPS_H_PMREQ; + cts->xport_specific.sata.caps |= CTS_SATA_CAPS_H_AN; cts->xport_specific.sata.caps &= ch->user[ccb->ccb_h.target_id].caps; cts->xport_specific.sata.valid |= CTS_SATA_VALID_CAPS; @@ -1876,6 +1878,9 @@ siisaction(struct cam_sim *sim, union cc cts->xport_specific.sata.revision = d->revision; cts->xport_specific.sata.valid |= CTS_SATA_VALID_REVISION; cts->xport_specific.sata.caps = d->caps; + if (cts->type == CTS_TYPE_CURRENT_SETTINGS && + (ch->quirks & SIIS_Q_SNTF) == 0) + cts->xport_specific.sata.caps &= ~CTS_SATA_CAPS_H_AN; cts->xport_specific.sata.valid |= CTS_SATA_VALID_CAPS; } cts->xport_specific.sata.mode = d->mode; Modified: stable/8/sys/sys/ata.h ============================================================================== --- stable/8/sys/sys/ata.h Tue Apr 19 17:14:57 2011 (r220860) +++ stable/8/sys/sys/ata.h Tue Apr 19 17:41:17 2011 (r220861) @@ -135,6 +135,7 @@ struct ata_params { #define ATA_SUPPORT_AUTOACTIVATE 0x0004 #define ATA_SUPPORT_IFPWRMNGT 0x0008 #define ATA_SUPPORT_INORDERDATA 0x0010 +#define ATA_SUPPORT_ASYNCNOTIF 0x0020 #define ATA_SUPPORT_SOFTSETPRESERVE 0x0040 /*79*/ u_int16_t sataenabled; #define ATA_ENABLED_DAPST 0x0080 From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 18:18:03 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 489A11065670; Tue, 19 Apr 2011 18:18:03 +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 354D58FC0A; Tue, 19 Apr 2011 18:18:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JII3AW018118; Tue, 19 Apr 2011 18:18:03 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JII3lk018116; Tue, 19 Apr 2011 18:18:03 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <201104191818.p3JII3lk018116@svn.freebsd.org> From: Maksim Yevmenkin Date: Tue, 19 Apr 2011 18:18: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: r220864 - stable/8/sys/netgraph/bluetooth/include 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, 19 Apr 2011 18:18:03 -0000 Author: emax Date: Tue Apr 19 18:18:02 2011 New Revision: 220864 URL: http://svn.freebsd.org/changeset/base/220864 Log: MFC r197083 Get those pesky RFCOMM RPM data bits right. This is likely a noop. Modified: stable/8/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h ============================================================================== --- stable/8/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h Tue Apr 19 18:09:21 2011 (r220863) +++ stable/8/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h Tue Apr 19 18:18:02 2011 (r220864) @@ -85,8 +85,8 @@ /* RPN parameters - data bits */ #define RFCOMM_RPN_DATA_5 0x0 -#define RFCOMM_RPN_DATA_6 0x1 -#define RFCOMM_RPN_DATA_7 0x2 +#define RFCOMM_RPN_DATA_6 0x2 +#define RFCOMM_RPN_DATA_7 0x1 #define RFCOMM_RPN_DATA_8 0x3 /* RPN parameters - stop bit */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 20:38:50 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BF6F106566B; Tue, 19 Apr 2011 20:38: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 7968D8FC19; Tue, 19 Apr 2011 20:38:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JKco8E021387; Tue, 19 Apr 2011 20:38:50 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JKcop5021384; Tue, 19 Apr 2011 20:38:50 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104192038.p3JKcop5021384@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Apr 2011 20:38: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: r220868 - stable/8/sys/dev/ahci 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, 19 Apr 2011 20:38:50 -0000 Author: mav Date: Tue Apr 19 20:38:50 2011 New Revision: 220868 URL: http://svn.freebsd.org/changeset/base/220868 Log: MFC r220657: Some changes around hot-plug and interface power-management: - use ATA_SE_EXCHANGED (SError.DIAG.X) bit to detect hot-plug events when power-management enabled and ATA_SE_PHY_CHANGED (SError.DIAG.N) can't be trusted; - on controllers supporting staggered spin-up (SS) put unused channels into Listen state instead of Off. It should still save some power, but allow plug-in events to be detected; - on controllers supporting cold presence detection (CPD), when power management enabled, use CPD events to detect hot-plug in addition to PHY events. Modified: stable/8/sys/dev/ahci/ahci.c stable/8/sys/dev/ahci/ahci.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Tue Apr 19 19:51:35 2011 (r220867) +++ stable/8/sys/dev/ahci/ahci.c Tue Apr 19 20:38:50 2011 (r220868) @@ -1266,34 +1266,66 @@ ahci_slotsfree(device_t dev) } } -static void +static int ahci_phy_check_events(device_t dev, u_int32_t serr) { struct ahci_channel *ch = device_get_softc(dev); - if ((serr & ATA_SE_PHY_CHANGED) && (ch->pm_level == 0)) { + if (((ch->pm_level == 0) && (serr & ATA_SE_PHY_CHANGED)) || + ((ch->pm_level != 0 || ch->listening) && (serr & ATA_SE_EXCHANGED))) { u_int32_t status = ATA_INL(ch->r_mem, AHCI_P_SSTS); union ccb *ccb; if (bootverbose) { - if (((status & ATA_SS_DET_MASK) == ATA_SS_DET_PHY_ONLINE) && - ((status & ATA_SS_SPD_MASK) != ATA_SS_SPD_NO_SPEED) && - ((status & ATA_SS_IPM_MASK) == ATA_SS_IPM_ACTIVE)) { + if ((status & ATA_SS_DET_MASK) != ATA_SS_DET_NO_DEVICE) device_printf(dev, "CONNECT requested\n"); - } else + else device_printf(dev, "DISCONNECT requested\n"); } ahci_reset(dev); if ((ccb = xpt_alloc_ccb_nowait()) == NULL) - return; + return (0); if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(ch->sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { xpt_free_ccb(ccb); - return; + return (0); } xpt_rescan(ccb); + return (1); } + return (0); +} + +static void +ahci_cpd_check_events(device_t dev) +{ + struct ahci_channel *ch = device_get_softc(dev); + u_int32_t status; + union ccb *ccb; + + if (ch->pm_level == 0) + return; + + status = ATA_INL(ch->r_mem, AHCI_P_CMD); + if ((status & AHCI_P_CMD_CPD) == 0) + return; + + if (bootverbose) { + if (status & AHCI_P_CMD_CPS) { + device_printf(dev, "COLD CONNECT requested\n"); + } else + device_printf(dev, "COLD DISCONNECT requested\n"); + } + ahci_reset(dev); + if ((ccb = xpt_alloc_ccb_nowait()) == NULL) + return; + if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(ch->sim), + CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + xpt_free_ccb(ccb); + return; + } + xpt_rescan(ccb); } static void @@ -1353,7 +1385,7 @@ ahci_ch_intr(void *data) struct ahci_channel *ch = device_get_softc(dev); uint32_t istatus, sstatus, cstatus, serr = 0, sntf = 0, ok, err; enum ahci_err_type et; - int i, ccs, port; + int i, ccs, port, reset = 0; /* Read and clear interrupt statuses. */ istatus = ATA_INL(ch->r_mem, AHCI_P_IS); @@ -1389,9 +1421,12 @@ ahci_ch_intr(void *data) serr = ATA_INL(ch->r_mem, AHCI_P_SERR); if (serr) { ATA_OUTL(ch->r_mem, AHCI_P_SERR, serr); - ahci_phy_check_events(dev, serr); + reset = ahci_phy_check_events(dev, serr); } } + /* Process cold presence detection events */ + if ((istatus & AHCI_P_IX_CPD) && !reset) + ahci_cpd_check_events(dev); /* Process command errors */ if (istatus & (AHCI_P_IX_OF | AHCI_P_IX_IF | AHCI_P_IX_HBD | AHCI_P_IX_HBF | AHCI_P_IX_TFE)) { @@ -2440,7 +2475,8 @@ ahci_reset(device_t dev) ch->devices = 0; /* Enable wanted port interrupts */ ATA_OUTL(ch->r_mem, AHCI_P_IE, - (AHCI_P_IX_CPD | AHCI_P_IX_PRC | AHCI_P_IX_PC)); + (((ch->pm_level != 0) ? AHCI_P_IX_CPD | AHCI_P_IX_MP : 0) | + AHCI_P_IX_PRC | AHCI_P_IX_PC)); xpt_release_simq(ch->sim, TRUE); return; } @@ -2457,9 +2493,10 @@ ahci_reset(device_t dev) ch->devices = 1; /* Enable wanted port interrupts */ ATA_OUTL(ch->r_mem, AHCI_P_IE, - (AHCI_P_IX_CPD | AHCI_P_IX_TFE | AHCI_P_IX_HBF | + (((ch->pm_level != 0) ? AHCI_P_IX_CPD | AHCI_P_IX_MP : 0) | + AHCI_P_IX_TFE | AHCI_P_IX_HBF | AHCI_P_IX_HBD | AHCI_P_IX_IF | AHCI_P_IX_OF | - ((ch->pm_level == 0) ? AHCI_P_IX_PRC | AHCI_P_IX_PC : 0) | + ((ch->pm_level == 0) ? AHCI_P_IX_PRC : 0) | AHCI_P_IX_PC | AHCI_P_IX_DP | AHCI_P_IX_UF | (ctlr->ccc ? 0 : AHCI_P_IX_SDB) | AHCI_P_IX_DS | AHCI_P_IX_PS | (ctlr->ccc ? 0 : AHCI_P_IX_DHR))); if (ch->resetting) @@ -2564,6 +2601,12 @@ ahci_sata_phy_reset(device_t dev) int sata_rev; uint32_t val; + if (ch->listening) { + val = ATA_INL(ch->r_mem, AHCI_P_CMD); + val |= AHCI_P_CMD_SUD; + ATA_OUTL(ch->r_mem, AHCI_P_CMD, val); + ch->listening = 0; + } sata_rev = ch->user[ch->pm_present ? 15 : 0].revision; if (sata_rev == 1) val = ATA_SC_SPD_SPEED_GEN1; @@ -2582,7 +2625,12 @@ ahci_sata_phy_reset(device_t dev) (ATA_SC_IPM_DIS_PARTIAL | ATA_SC_IPM_DIS_SLUMBER))); DELAY(5000); if (!ahci_sata_connect(ch)) { - if (ch->pm_level > 0) + if (ch->caps & AHCI_CAP_SSS) { + val = ATA_INL(ch->r_mem, AHCI_P_CMD); + val &= ~AHCI_P_CMD_SUD; + ATA_OUTL(ch->r_mem, AHCI_P_CMD, val); + ch->listening = 1; + } else if (ch->pm_level > 0) ATA_OUTL(ch->r_mem, AHCI_P_SCTL, ATA_SC_DET_DISABLE); return (0); } Modified: stable/8/sys/dev/ahci/ahci.h ============================================================================== --- stable/8/sys/dev/ahci/ahci.h Tue Apr 19 19:51:35 2011 (r220867) +++ stable/8/sys/dev/ahci/ahci.h Tue Apr 19 20:38:50 2011 (r220868) @@ -118,6 +118,7 @@ #define ATA_SE_LINKSEQ_ERR 0x00800000 #define ATA_SE_TRANSPORT_ERR 0x01000000 #define ATA_SE_UNKNOWN_FIS 0x02000000 +#define ATA_SE_EXCHANGED 0x04000000 #define ATA_SCONTROL 15 #define ATA_SC_DET_MASK 0x0000000f @@ -221,7 +222,7 @@ #define AHCI_P_IX_UF 0x00000010 #define AHCI_P_IX_DP 0x00000020 #define AHCI_P_IX_PC 0x00000040 -#define AHCI_P_IX_DI 0x00000080 +#define AHCI_P_IX_MP 0x00000080 #define AHCI_P_IX_PRC 0x00400000 #define AHCI_P_IX_IPM 0x00800000 @@ -413,6 +414,7 @@ struct ahci_channel { int lastslot; /* Last used slot */ int taggedtarget; /* Last tagged target */ int resetting; /* Hard-reset in progress. */ + int listening; /* SUD bit is cleared. */ union ccb *frozen; /* Frozen command */ struct callout pm_timer; /* Power management events */ struct callout reset_timer; /* Hard-reset timeout */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 20:40:00 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BECD11065670; Tue, 19 Apr 2011 20:40:00 +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 A744F8FC15; Tue, 19 Apr 2011 20:40:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JKe0r3021456; Tue, 19 Apr 2011 20:40:00 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JKe04k021454; Tue, 19 Apr 2011 20:40:00 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104192040.p3JKe04k021454@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Apr 2011 20:40: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: r220869 - stable/8/sys/dev/ahci 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, 19 Apr 2011 20:40:00 -0000 Author: mav Date: Tue Apr 19 20:40:00 2011 New Revision: 220869 URL: http://svn.freebsd.org/changeset/base/220869 Log: MFC r220777: - Tune different wait loops to cut some more milliseconds from reset time. - Do not call ahci_start() before device signature received. It is required by the specification and caused non-fatal reset timeouts on AMD chipsets. Modified: stable/8/sys/dev/ahci/ahci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Tue Apr 19 20:38:50 2011 (r220868) +++ stable/8/sys/dev/ahci/ahci.c Tue Apr 19 20:40:00 2011 (r220869) @@ -1741,11 +1741,11 @@ ahci_execute_transaction(struct ahci_slo if (ccb->ccb_h.func_code == XPT_ATA_IO && (ccb->ataio.cmd.command == ATA_DEVICE_RESET || (ccb->ataio.cmd.flags & CAM_ATAIO_CONTROL))) { - int count, timeout = ccb->ccb_h.timeout; + int count, timeout = ccb->ccb_h.timeout * 100; enum ahci_err_type et = AHCI_ERR_NONE; for (count = 0; count < timeout; count++) { - DELAY(1000); + DELAY(10); if (!(ATA_INL(ch->r_mem, AHCI_P_CI) & (1 << slot->slot))) break; if (ATA_INL(ch->r_mem, AHCI_P_TFD) & ATA_S_ERROR) { @@ -1781,7 +1781,7 @@ ahci_execute_transaction(struct ahci_slo (ccb->ataio.cmd.flags & CAM_ATAIO_CONTROL) && (ccb->ataio.cmd.control & ATA_A_RESET) == 0) { while ((val = fis[2]) & (ATA_S_BUSY | ATA_S_DRQ)) { - DELAY(1000); + DELAY(10); if (count++ >= timeout) { device_printf(dev, "device is not " "ready after soft-reset: " @@ -2299,8 +2299,8 @@ ahci_stop(device_t dev) /* Wait for activity stop. */ timeout = 0; do { - DELAY(1000); - if (timeout++ > 1000) { + DELAY(10); + if (timeout++ > 50000) { device_printf(dev, "stopping AHCI engine failed\n"); break; } @@ -2322,8 +2322,8 @@ ahci_clo(device_t dev) ATA_OUTL(ch->r_mem, AHCI_P_CMD, cmd); timeout = 0; do { - DELAY(1000); - if (timeout++ > 1000) { + DELAY(10); + if (timeout++ > 50000) { device_printf(dev, "executing CLO failed\n"); break; } @@ -2344,8 +2344,8 @@ ahci_stop_fr(device_t dev) /* Wait for FIS reception stop. */ timeout = 0; do { - DELAY(1000); - if (timeout++ > 1000) { + DELAY(10); + if (timeout++ > 50000) { device_printf(dev, "stopping AHCI FR engine failed\n"); break; } @@ -2402,11 +2402,11 @@ ahci_reset_to(void *arg) if (ahci_wait_ready(dev, ch->resetting == 0 ? -1 : 0, (310 - ch->resetting) * 100) == 0) { ch->resetting = 0; + ahci_start(dev, 1); xpt_release_simq(ch->sim, TRUE); return; } if (ch->resetting == 0) { - ahci_stop(dev); ahci_clo(dev); ahci_start(dev, 1); xpt_release_simq(ch->sim, TRUE); @@ -2489,7 +2489,6 @@ ahci_reset(device_t dev) else ch->resetting = 310; } - ahci_start(dev, 1); ch->devices = 1; /* Enable wanted port interrupts */ ATA_OUTL(ch->r_mem, AHCI_P_IE, @@ -2501,8 +2500,10 @@ ahci_reset(device_t dev) AHCI_P_IX_DS | AHCI_P_IX_PS | (ctlr->ccc ? 0 : AHCI_P_IX_DHR))); if (ch->resetting) callout_reset(&ch->reset_timer, hz / 10, ahci_reset_to, dev); - else + else { + ahci_start(dev, 1); xpt_release_simq(ch->sim, TRUE); + } } static int @@ -2563,7 +2564,7 @@ ahci_sata_connect(struct ahci_channel *c int timeout; /* Wait up to 100ms for "connect well" */ - for (timeout = 0; timeout < 100 ; timeout++) { + for (timeout = 0; timeout < 1000 ; timeout++) { status = ATA_INL(ch->r_mem, AHCI_P_SSTS); if (((status & ATA_SS_DET_MASK) == ATA_SS_DET_PHY_ONLINE) && ((status & ATA_SS_SPD_MASK) != ATA_SS_SPD_NO_SPEED) && @@ -2576,9 +2577,9 @@ ahci_sata_connect(struct ahci_channel *c } return (0); } - DELAY(1000); + DELAY(100); } - if (timeout >= 100) { + if (timeout >= 1000) { if (bootverbose) { device_printf(ch->dev, "SATA connect timeout status=%08x\n", status); @@ -2586,8 +2587,8 @@ ahci_sata_connect(struct ahci_channel *c return (0); } if (bootverbose) { - device_printf(ch->dev, "SATA connect time=%dms status=%08x\n", - timeout, status); + device_printf(ch->dev, "SATA connect time=%dus status=%08x\n", + timeout * 100, status); } /* Clear SATA error register */ ATA_OUTL(ch->r_mem, AHCI_P_SERR, 0xffffffff); @@ -2619,11 +2620,10 @@ ahci_sata_phy_reset(device_t dev) ATA_OUTL(ch->r_mem, AHCI_P_SCTL, ATA_SC_DET_RESET | val | ATA_SC_IPM_DIS_PARTIAL | ATA_SC_IPM_DIS_SLUMBER); - DELAY(5000); + DELAY(1000); ATA_OUTL(ch->r_mem, AHCI_P_SCTL, ATA_SC_DET_IDLE | val | ((ch->pm_level > 0) ? 0 : (ATA_SC_IPM_DIS_PARTIAL | ATA_SC_IPM_DIS_SLUMBER))); - DELAY(5000); if (!ahci_sata_connect(ch)) { if (ch->caps & AHCI_CAP_SSS) { val = ATA_INL(ch->r_mem, AHCI_P_CMD); From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 20:41:00 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2C341065687; Tue, 19 Apr 2011 20:41:00 +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 D10FA8FC13; Tue, 19 Apr 2011 20:41:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JKf0go021529; Tue, 19 Apr 2011 20:41:00 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JKf0uC021526; Tue, 19 Apr 2011 20:41:00 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104192041.p3JKf0uC021526@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Apr 2011 20:41: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: r220870 - stable/8/sys/dev/ahci 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, 19 Apr 2011 20:41:01 -0000 Author: mav Date: Tue Apr 19 20:41:00 2011 New Revision: 220870 URL: http://svn.freebsd.org/changeset/base/220870 Log: MFC r220789: Handle ready timeout during polled operation same as done in mvs(4) before. Modified: stable/8/sys/dev/ahci/ahci.c stable/8/sys/dev/ahci/ahci.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Tue Apr 19 20:40:00 2011 (r220869) +++ stable/8/sys/dev/ahci/ahci.c Tue Apr 19 20:41:00 2011 (r220870) @@ -2845,4 +2845,9 @@ ahcipoll(struct cam_sim *sim) struct ahci_channel *ch = (struct ahci_channel *)cam_sim_softc(sim); ahci_ch_intr(ch->dev); + if (ch->resetting != 0 && + (--ch->resetpolldiv <= 0 || !callout_pending(&ch->reset_timer))) { + ch->resetpolldiv = 1000; + ahci_reset_to(ch->dev); + } } Modified: stable/8/sys/dev/ahci/ahci.h ============================================================================== --- stable/8/sys/dev/ahci/ahci.h Tue Apr 19 20:40:00 2011 (r220869) +++ stable/8/sys/dev/ahci/ahci.h Tue Apr 19 20:41:00 2011 (r220870) @@ -414,6 +414,7 @@ struct ahci_channel { int lastslot; /* Last used slot */ int taggedtarget; /* Last tagged target */ int resetting; /* Hard-reset in progress. */ + int resetpolldiv; /* Hard-reset poll divider. */ int listening; /* SUD bit is cleared. */ union ccb *frozen; /* Frozen command */ struct callout pm_timer; /* Power management events */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Apr 19 20:44:44 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66C371065674; Tue, 19 Apr 2011 20:44: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 53A308FC15; Tue, 19 Apr 2011 20:44:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3JKiiUk021785; Tue, 19 Apr 2011 20:44:44 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3JKiihu021782; Tue, 19 Apr 2011 20:44:44 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201104192044.p3JKiihu021782@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Apr 2011 20:44: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: r220872 - stable/8/sys/dev/mvs 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, 19 Apr 2011 20:44:44 -0000 Author: mav Date: Tue Apr 19 20:44:44 2011 New Revision: 220872 URL: http://svn.freebsd.org/changeset/base/220872 Log: MFC r220615: Refactor hard-reset implementation in mvs(4). Instead of spinning in a tight loop for up to 15 seconds, polling for device readiness while it spins up, return reset completion just after PHY reports "connect well" or 100ms connection timeout. If device was found, use callout for checking device readiness with 100ms period up to full 31 second timeout. This fixes system freeze for 5-10 seconds on drives hot plug-in. Modified: stable/8/sys/dev/mvs/mvs.c stable/8/sys/dev/mvs/mvs.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/mvs/mvs.c ============================================================================== --- stable/8/sys/dev/mvs/mvs.c Tue Apr 19 20:44:43 2011 (r220871) +++ stable/8/sys/dev/mvs/mvs.c Tue Apr 19 20:44:44 2011 (r220872) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -74,7 +75,7 @@ static int mvs_sata_phy_reset(device_t d static int mvs_wait(device_t dev, u_int s, u_int c, int t); static void mvs_tfd_read(device_t dev, union ccb *ccb); static void mvs_tfd_write(device_t dev, union ccb *ccb); -static void mvs_legacy_intr(device_t dev); +static void mvs_legacy_intr(device_t dev, int poll); static void mvs_crbq_intr(device_t dev); static void mvs_begin_transaction(device_t dev, union ccb *ccb); static void mvs_legacy_execute_transaction(struct mvs_slot *slot); @@ -124,6 +125,7 @@ mvs_ch_attach(device_t dev) device_get_unit(dev), "pm_level", &ch->pm_level); if (ch->pm_level > 3) callout_init_mtx(&ch->pm_timer, &ch->mtx, 0); + callout_init_mtx(&ch->reset_timer, &ch->mtx, 0); resource_int_value(device_get_name(dev), device_get_unit(dev), "sata_rev", &sata_rev); for (i = 0; i < 16; i++) { @@ -217,6 +219,11 @@ mvs_ch_detach(device_t dev) mtx_lock(&ch->mtx); xpt_async(AC_LOST_DEVICE, ch->path, NULL); + /* Forget about reset. */ + if (ch->resetting) { + ch->resetting = 0; + xpt_release_simq(ch->sim, TRUE); + } xpt_free_path(ch->path); xpt_bus_deregister(cam_sim_path(ch->sim)); cam_sim_free(ch->sim, /*free_devq*/TRUE); @@ -224,6 +231,7 @@ mvs_ch_detach(device_t dev) if (ch->pm_level > 3) callout_drain(&ch->pm_timer); + callout_drain(&ch->reset_timer); bus_teardown_intr(dev, ch->r_irq, ch->ih); bus_release_resource(dev, SYS_RES_IRQ, ATA_IRQ_RID, ch->r_irq); @@ -285,6 +293,12 @@ mvs_ch_suspend(device_t dev) xpt_freeze_simq(ch->sim, 1); while (ch->oslots) msleep(ch, &ch->mtx, PRIBIO, "mvssusp", hz/100); + /* Forget about reset. */ + if (ch->resetting) { + ch->resetting = 0; + callout_stop(&ch->reset_timer); + xpt_release_simq(ch->sim, TRUE); + } mvs_ch_deinit(dev); mtx_unlock(&ch->mtx); return (0); @@ -803,7 +817,7 @@ mvs_ch_intr(void *data) } /* Legacy mode device interrupt. */ if ((arg->cause & 2) && !edma) - mvs_legacy_intr(dev); + mvs_legacy_intr(dev, arg->cause & 4); } static uint8_t @@ -822,7 +836,7 @@ mvs_getstatus(device_t dev, int clear) } static void -mvs_legacy_intr(device_t dev) +mvs_legacy_intr(device_t dev, int poll) { struct mvs_channel *ch = device_get_softc(dev); struct mvs_slot *slot = &ch->slot[0]; /* PIO is always in slot 0. */ @@ -840,6 +854,8 @@ mvs_legacy_intr(device_t dev) port = ccb->ccb_h.target_id & 0x0f; /* Wait a bit for late !BUSY status update. */ if (status & ATA_S_BUSY) { + if (poll) + return; DELAY(100); if ((status = mvs_getstatus(dev, 1)) & ATA_S_BUSY) { DELAY(1000); @@ -1316,7 +1332,7 @@ mvs_legacy_execute_transaction(struct mv DELAY(10); ccb->ataio.res.status = ATA_INB(ch->r_mem, ATA_STATUS); } while (ccb->ataio.res.status & ATA_S_BUSY && timeout--); - mvs_legacy_intr(dev); + mvs_legacy_intr(dev, 1); return; } ch->donecount = 0; @@ -1909,11 +1925,13 @@ mvs_wait(device_t dev, u_int s, u_int c, uint8_t st; while (((st = mvs_getstatus(dev, 0)) & (s | c)) != s) { - DELAY(1000); - if (timeout++ > t) { - device_printf(dev, "Wait status %02x\n", st); + if (timeout >= t) { + if (t != 0) + device_printf(dev, "Wait status %02x\n", st); return (-1); } + DELAY(1000); + timeout++; } return (timeout); } @@ -1936,6 +1954,35 @@ mvs_requeue_frozen(device_t dev) } static void +mvs_reset_to(void *arg) +{ + device_t dev = arg; + struct mvs_channel *ch = device_get_softc(dev); + int t; + + if (ch->resetting == 0) + return; + ch->resetting--; + if ((t = mvs_wait(dev, 0, ATA_S_BUSY | ATA_S_DRQ, 0)) >= 0) { + if (bootverbose) { + device_printf(dev, + "MVS reset: device ready after %dms\n", + (310 - ch->resetting) * 100); + } + ch->resetting = 0; + xpt_release_simq(ch->sim, TRUE); + return; + } + if (ch->resetting == 0) { + device_printf(dev, + "MVS reset: device not ready after 31000ms\n"); + xpt_release_simq(ch->sim, TRUE); + return; + } + callout_schedule(&ch->reset_timer, hz / 10); +} + +static void mvs_reset(device_t dev) { struct mvs_channel *ch = device_get_softc(dev); @@ -1944,6 +1991,12 @@ mvs_reset(device_t dev) xpt_freeze_simq(ch->sim, 1); if (bootverbose) device_printf(dev, "MVS reset...\n"); + /* Forget about previous reset. */ + if (ch->resetting) { + ch->resetting = 0; + callout_stop(&ch->reset_timer); + xpt_release_simq(ch->sim, TRUE); + } /* Requeue freezed command. */ mvs_requeue_frozen(dev); /* Kill the engine and requeue all running commands. */ @@ -1968,6 +2021,7 @@ mvs_reset(device_t dev) ch->eslots = 0; ch->toslots = 0; ch->fatalerr = 0; + ch->fake_busy = 0; /* Tell the XPT about the event */ xpt_async(AC_BUS_RESET, ch->path, NULL); ATA_OUTL(ch->r_mem, EDMA_IEM, 0); @@ -1977,8 +2031,7 @@ mvs_reset(device_t dev) /* Reset and reconnect PHY, */ if (!mvs_sata_phy_reset(dev)) { if (bootverbose) - device_printf(dev, - "MVS reset done: phy reset found no device\n"); + device_printf(dev, "MVS reset: device not found\n"); ch->devices = 0; ATA_OUTL(ch->r_mem, SATA_SE, 0xffffffff); ATA_OUTL(ch->r_mem, EDMA_IEC, 0); @@ -1986,18 +2039,26 @@ mvs_reset(device_t dev) xpt_release_simq(ch->sim, TRUE); return; } + if (bootverbose) + device_printf(dev, "MVS reset: device found\n"); /* Wait for clearing busy status. */ - if ((i = mvs_wait(dev, 0, ATA_S_BUSY | ATA_S_DRQ, 15000)) < 0) - device_printf(dev, "device is not ready\n"); - else if (bootverbose) - device_printf(dev, "ready wait time=%dms\n", i); + if ((i = mvs_wait(dev, 0, ATA_S_BUSY | ATA_S_DRQ, + dumping ? 31000 : 0)) < 0) { + if (dumping) { + device_printf(dev, + "MVS reset: device not ready after 31000ms\n"); + } else + ch->resetting = 310; + } else if (bootverbose) + device_printf(dev, "MVS reset: device ready after %dms\n", i); ch->devices = 1; ATA_OUTL(ch->r_mem, SATA_SE, 0xffffffff); ATA_OUTL(ch->r_mem, EDMA_IEC, 0); ATA_OUTL(ch->r_mem, EDMA_IEM, ~EDMA_IE_TRANSIENT); - if (bootverbose) - device_printf(dev, "MVS reset done: device found\n"); - xpt_release_simq(ch->sim, TRUE); + if (ch->resetting) + callout_reset(&ch->reset_timer, hz / 10, mvs_reset_to, dev); + else + xpt_release_simq(ch->sim, TRUE); } static void @@ -2299,7 +2360,12 @@ mvspoll(struct cam_sim *sim) struct mvs_intr_arg arg; arg.arg = ch->dev; - arg.cause = 2; /* XXX */ + arg.cause = 2 | 4; /* XXX */ mvs_ch_intr(&arg); + if (ch->resetting != 0 && + (--ch->resetpolldiv <= 0 || !callout_pending(&ch->reset_timer))) { + ch->resetpolldiv = 1000; + mvs_reset_to(ch->dev); + } } Modified: stable/8/sys/dev/mvs/mvs.h ============================================================================== --- stable/8/sys/dev/mvs/mvs.h Tue Apr 19 20:44:43 2011 (r220871) +++ stable/8/sys/dev/mvs/mvs.h Tue Apr 19 20:44:44 2011 (r220872) @@ -561,6 +561,8 @@ struct mvs_channel { int fatalerr; /* Fatal error happend */ int lastslot; /* Last used slot */ int taggedtarget; /* Last tagged target */ + int resetting; /* Hard-reset in progress. */ + int resetpolldiv; /* Hard-reset poll divider. */ int out_idx; /* Next written CRQB */ int in_idx; /* Next read CRPB */ u_int transfersize; /* PIO transfer size */ @@ -569,6 +571,7 @@ struct mvs_channel { u_int fake_busy; /* Fake busy bit after command submission */ union ccb *frozen; /* Frozen command */ struct callout pm_timer; /* Power management events */ + struct callout reset_timer; /* Hard-reset timeout */ struct mvs_device user[16]; /* User-specified settings */ struct mvs_device curr[16]; /* Current settings */ From owner-svn-src-stable-8@FreeBSD.ORG Wed Apr 20 11:15:18 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0163F106564A; Wed, 20 Apr 2011 11:15:18 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E3B948FC12; Wed, 20 Apr 2011 11:15:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3KBFHjs045806; Wed, 20 Apr 2011 11:15:17 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3KBFHvE045804; Wed, 20 Apr 2011 11:15:17 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201104201115.p3KBFHvE045804@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 20 Apr 2011 11:15:17 +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: r220883 - stable/8/sys/boot/forth 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, 20 Apr 2011 11:15:18 -0000 Author: pluknet Date: Wed Apr 20 11:15:17 2011 New Revision: 220883 URL: http://svn.freebsd.org/changeset/base/220883 Log: MFC r220594: Remove the now defunct kern.ipc.nmbufs tunable. PR: kern/132497 (part) Modified: stable/8/sys/boot/forth/loader.conf Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/boot/forth/loader.conf ============================================================================== --- stable/8/sys/boot/forth/loader.conf Wed Apr 20 08:38:25 2011 (r220882) +++ stable/8/sys/boot/forth/loader.conf Wed Apr 20 11:15:17 2011 (r220883) @@ -107,7 +107,6 @@ module_path="/boot/modules" # Set the mo #kern.cam.scsi_delay="2000" # Delay (in ms) before probing SCSI #kern.ipc.maxsockets="" # Set the maximum number of sockets avaliable #kern.ipc.nmbclusters="" # Set the number of mbuf clusters -#kern.ipc.nmbufs="" # Set the maximum number of mbufs #kern.ipc.nsfbufs="" # Set the number of sendfile(2) bufs #net.inet.tcp.tcbhashsize="" # Set the value of TCBHASHSIZE #vfs.root.mountfrom="" # Specify root partition in a way the From owner-svn-src-stable-8@FreeBSD.ORG Wed Apr 20 21:00:25 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 69C491065678; Wed, 20 Apr 2011 21:00:25 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 55CD48FC0C; Wed, 20 Apr 2011 21:00:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3KL0PsK066221; Wed, 20 Apr 2011 21:00:25 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3KL0PdM066219; Wed, 20 Apr 2011 21:00:25 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201104202100.p3KL0PdM066219@svn.freebsd.org> From: Colin Percival Date: Wed, 20 Apr 2011 21:00:25 +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: r220901 - releng/7.3 releng/7.3/sys/conf releng/7.3/usr.sbin/mountd releng/7.4 releng/7.4/sys/conf releng/7.4/usr.sbin/mountd releng/8.1 releng/8.1/sys/conf releng/8.1/usr.sbin/mountd r... 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, 20 Apr 2011 21:00:25 -0000 Author: cperciva Date: Wed Apr 20 21:00:24 2011 New Revision: 220901 URL: http://svn.freebsd.org/changeset/base/220901 Log: Fix CIDR parsing bug in mountd ACLs. Approved by: so (cperciva) Security: FreeBSD-SA-11:01.mountd Modified: stable/8/usr.sbin/mountd/mountd.c Changes in other areas also in this revision: Modified: releng/7.3/UPDATING releng/7.3/sys/conf/newvers.sh releng/7.3/usr.sbin/mountd/mountd.c releng/7.4/UPDATING releng/7.4/sys/conf/newvers.sh releng/7.4/usr.sbin/mountd/mountd.c releng/8.1/UPDATING releng/8.1/sys/conf/newvers.sh releng/8.1/usr.sbin/mountd/mountd.c releng/8.2/UPDATING releng/8.2/sys/conf/newvers.sh releng/8.2/usr.sbin/mountd/mountd.c stable/7/usr.sbin/mountd/mountd.c Modified: stable/8/usr.sbin/mountd/mountd.c ============================================================================== --- stable/8/usr.sbin/mountd/mountd.c Wed Apr 20 19:41:08 2011 (r220900) +++ stable/8/usr.sbin/mountd/mountd.c Wed Apr 20 21:00:24 2011 (r220901) @@ -2937,7 +2937,7 @@ makemask(struct sockaddr_storage *ssp, i for (i = 0; i < len; i++) { bits = (bitlen > CHAR_BIT) ? CHAR_BIT : bitlen; - *p++ = (1 << bits) - 1; + *p++ = (u_char)~0 << (CHAR_BIT - bits); bitlen -= bits; } return 0; From owner-svn-src-stable-8@FreeBSD.ORG Wed Apr 20 22:10:44 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 864731065673; Wed, 20 Apr 2011 22:10:44 +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 729138FC16; Wed, 20 Apr 2011 22:10:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3KMAiD6068485; Wed, 20 Apr 2011 22:10:44 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3KMAihG068474; Wed, 20 Apr 2011 22:10:44 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201104202210.p3KMAihG068474@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 20 Apr 2011 22:10: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: r220902 - in stable/8/tools/regression/bin/sh: builtins execution expansion parser 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, 20 Apr 2011 22:10:44 -0000 Author: jilles Date: Wed Apr 20 22:10:44 2011 New Revision: 220902 URL: http://svn.freebsd.org/changeset/base/220902 Log: MFC r218205,r218821,r218891,r219390,r219611,r220654,r220655,r220656: sh: New testcases that already work in stable/8. Added: stable/8/tools/regression/bin/sh/builtins/case4.0 - copied unchanged from r220654, head/tools/regression/bin/sh/builtins/case4.0 stable/8/tools/regression/bin/sh/builtins/dot3.0 - copied unchanged from r219390, head/tools/regression/bin/sh/builtins/dot3.0 stable/8/tools/regression/bin/sh/builtins/read5.0 - copied unchanged from r218821, head/tools/regression/bin/sh/builtins/read5.0 stable/8/tools/regression/bin/sh/execution/shellproc1.0 - copied unchanged from r218205, head/tools/regression/bin/sh/execution/shellproc1.0 stable/8/tools/regression/bin/sh/expansion/length1.0 - copied unchanged from r219611, head/tools/regression/bin/sh/expansion/length1.0 stable/8/tools/regression/bin/sh/expansion/length2.0 - copied unchanged from r219611, head/tools/regression/bin/sh/expansion/length2.0 stable/8/tools/regression/bin/sh/expansion/length3.0 - copied unchanged from r219611, head/tools/regression/bin/sh/expansion/length3.0 stable/8/tools/regression/bin/sh/expansion/length4.0 - copied unchanged from r220655, head/tools/regression/bin/sh/expansion/length4.0 stable/8/tools/regression/bin/sh/expansion/length5.0 - copied unchanged from r220656, head/tools/regression/bin/sh/expansion/length5.0 stable/8/tools/regression/bin/sh/parser/no-space1.0 - copied unchanged from r218891, head/tools/regression/bin/sh/parser/no-space1.0 stable/8/tools/regression/bin/sh/parser/no-space2.0 - copied unchanged from r218891, head/tools/regression/bin/sh/parser/no-space2.0 Modified: Directory Properties: stable/8/tools/regression/bin/sh/ (props changed) Copied: stable/8/tools/regression/bin/sh/builtins/case4.0 (from r220654, head/tools/regression/bin/sh/builtins/case4.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/case4.0 Wed Apr 20 22:10:44 2011 (r220902, copy of r220654, head/tools/regression/bin/sh/builtins/case4.0) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +set -- "*" +case x in +"$1") echo failed ;; +esac Copied: stable/8/tools/regression/bin/sh/builtins/dot3.0 (from r219390, head/tools/regression/bin/sh/builtins/dot3.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/dot3.0 Wed Apr 20 22:10:44 2011 (r220902, copy of r219390, head/tools/regression/bin/sh/builtins/dot3.0) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +# . should return 0 if no command was executed. + +if false; then + exit 3 +else + . /dev/null + exit $? +fi Copied: stable/8/tools/regression/bin/sh/builtins/read5.0 (from r218821, head/tools/regression/bin/sh/builtins/read5.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/read5.0 Wed Apr 20 22:10:44 2011 (r220902, copy of r218821, head/tools/regression/bin/sh/builtins/read5.0) @@ -0,0 +1,32 @@ +# $FreeBSD$ + +unset LC_ALL +LC_CTYPE=en_US.ISO8859-1 +export LC_CTYPE + +# Note: the first and last characters are not whitespace. +# Exclude backslash and newline. +bad1=`printf %03o \'\\\\` +bad2=`printf %03o \'' +'` +e= +for i in 0 1 2 3; do + for j in 0 1 2 3 4 5 6 7; do + for k in 0 1 2 3 4 5 6 7; do + case $i$j$k in + 000|$bad1|$bad2) continue ;; + esac + e="$e\\$i$j$k" + done + done +done +e=`printf "$e"` +[ "${#e}" = 253 ] || echo length bad + +r1=`printf '%s\n' "$e" | { read -r x; printf '%s' "$x"; }` +[ "$r1" = "$e" ] || echo "read with -r bad" +r2=`printf '%s\n' "$e" | { read x; printf '%s' "$x"; }` +[ "$r2" = "$e" ] || echo "read without -r bad 1" +IFS= +r3=`printf '%s\n' "$e" | { read x; printf '%s' "$x"; }` +[ "$r3" = "$e" ] || echo "read without -r bad 2" Copied: stable/8/tools/regression/bin/sh/execution/shellproc1.0 (from r218205, head/tools/regression/bin/sh/execution/shellproc1.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/execution/shellproc1.0 Wed Apr 20 22:10:44 2011 (r220902, copy of r218205, head/tools/regression/bin/sh/execution/shellproc1.0) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +T=`mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXXXX"` || exit +trap 'rm -rf "${T}"' 0 +cat <"$T/testshellproc" +printf 'this ' +echo is a test +EOF +chmod 755 "$T/testshellproc" +PATH=$T:$PATH +[ "`testshellproc`" = "this is a test" ] Copied: stable/8/tools/regression/bin/sh/expansion/length1.0 (from r219611, head/tools/regression/bin/sh/expansion/length1.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/expansion/length1.0 Wed Apr 20 22:10:44 2011 (r220902, copy of r219611, head/tools/regression/bin/sh/expansion/length1.0) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +v=abcd +[ "${#v}" = 4 ] || echo '${#v} wrong' +v=$$ +[ "${#$}" = "${#v}" ] || echo '${#$} wrong' +[ "${#!}" = 0 ] || echo '${#!} wrong' +set -- 01 2 3 4 5 6 7 8 9 10 11 12 0013 +[ "${#1}" = 2 ] || echo '${#1} wrong' +[ "${#13}" = 4 ] || echo '${#13} wrong' +v=$0 +[ "${#0}" = "${#v}" ] || echo '${#0} wrong' Copied: stable/8/tools/regression/bin/sh/expansion/length2.0 (from r219611, head/tools/regression/bin/sh/expansion/length2.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/expansion/length2.0 Wed Apr 20 22:10:44 2011 (r220902, copy of r219611, head/tools/regression/bin/sh/expansion/length2.0) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +v=$- +[ "${#-}" = "${#v}" ] || echo '${#-} wrong' Copied: stable/8/tools/regression/bin/sh/expansion/length3.0 (from r219611, head/tools/regression/bin/sh/expansion/length3.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/expansion/length3.0 Wed Apr 20 22:10:44 2011 (r220902, copy of r219611, head/tools/regression/bin/sh/expansion/length3.0) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +set -- 1 2 3 4 5 6 7 8 9 10 11 12 13 +[ "$#" = 13 ] || echo '$# wrong' +[ "${#}" = 13 ] || echo '${#} wrong' +[ "${##}" = 2 ] || echo '${##} wrong' +set -- +[ "$#" = 0 ] || echo '$# wrong' +[ "${#}" = 0 ] || echo '${#} wrong' +[ "${##}" = 1 ] || echo '${##} wrong' Copied: stable/8/tools/regression/bin/sh/expansion/length4.0 (from r220655, head/tools/regression/bin/sh/expansion/length4.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/expansion/length4.0 Wed Apr 20 22:10:44 2011 (r220902, copy of r220655, head/tools/regression/bin/sh/expansion/length4.0) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +# The construct ${#?} is ambiguous in POSIX.1-2008: it could be the length +# of $? or it could be $# giving an error in the (impossible) case that it +# is not set. +# We use the former interpretation; it seems more useful. + +: +[ "${#?}" = 1 ] || echo '${#?} wrong' +(exit 42) +[ "${#?}" = 2 ] || echo '${#?} wrong' Copied: stable/8/tools/regression/bin/sh/expansion/length5.0 (from r220656, head/tools/regression/bin/sh/expansion/length5.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/expansion/length5.0 Wed Apr 20 22:10:44 2011 (r220902, copy of r220656, head/tools/regression/bin/sh/expansion/length5.0) @@ -0,0 +1,27 @@ +# $FreeBSD$ + +unset LC_ALL +LC_CTYPE=en_US.ISO8859-1 +export LC_CTYPE + +e= +for i in 0 1 2 3; do + for j in 0 1 2 3 4 5 6 7; do + for k in 0 1 2 3 4 5 6 7; do + case $i$j$k in + 000) continue ;; + esac + e="$e\\$i$j$k" + done + done +done +ee=`printf "$e"` +[ ${#ee} = 255 ] || echo bad 1 +[ "${#ee}" = 255 ] || echo bad 2 +[ $((${#ee})) = 255 ] || echo bad 3 +[ "$((${#ee}))" = 255 ] || echo bad 4 +set -- "$ee" +[ ${#1} = 255 ] || echo bad 5 +[ "${#1}" = 255 ] || echo bad 6 +[ $((${#1})) = 255 ] || echo bad 7 +[ "$((${#1}))" = 255 ] || echo bad 8 Copied: stable/8/tools/regression/bin/sh/parser/no-space1.0 (from r218891, head/tools/regression/bin/sh/parser/no-space1.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/parser/no-space1.0 Wed Apr 20 22:10:44 2011 (r220902, copy of r218891, head/tools/regression/bin/sh/parser/no-space1.0) @@ -0,0 +1,18 @@ +# $FreeBSD$ + +# These are ugly but are required to work. + +set -e + +while(false)do(:)done +if(false)then(:)fi +if(false)then(:)else(:)fi +(:&&:)||: +until(:)do(:)done +case x in(x);;*)exit 1;(:)esac +case x in(x);;*)exit 1;;esac +for i do(:)done +{(:)} +f(){(:)} +:|: +(:)|(:) Copied: stable/8/tools/regression/bin/sh/parser/no-space2.0 (from r218891, head/tools/regression/bin/sh/parser/no-space2.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/parser/no-space2.0 Wed Apr 20 22:10:44 2011 (r220902, copy of r218891, head/tools/regression/bin/sh/parser/no-space2.0) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +# This conflicts with ksh extended patterns but occurs in the wild. + +set -e + +!(false) From owner-svn-src-stable-8@FreeBSD.ORG Thu Apr 21 08:13:44 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72DE4106566C; Thu, 21 Apr 2011 08:13:44 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 61BAA8FC1C; Thu, 21 Apr 2011 08:13:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3L8DiuY086719; Thu, 21 Apr 2011 08:13:44 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3L8Div3086717; Thu, 21 Apr 2011 08:13:44 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201104210813.p3L8Div3086717@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 21 Apr 2011 08:13: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: r220912 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Apr 2011 08:13:44 -0000 Author: glebius Date: Thu Apr 21 08:13:44 2011 New Revision: 220912 URL: http://svn.freebsd.org/changeset/base/220912 Log: Merge from head/ 220622: Revert r194662, since it breaks ng_ksocket(4) and may break other socket consumers with alternate sb_upcall. PR: kern/154676 Submitted by: Arnaud Lacombe Modified: stable/8/sys/kern/uipc_sockbuf.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/uipc_sockbuf.c ============================================================================== --- stable/8/sys/kern/uipc_sockbuf.c Thu Apr 21 07:26:14 2011 (r220911) +++ stable/8/sys/kern/uipc_sockbuf.c Thu Apr 21 08:13:44 2011 (r220912) @@ -528,9 +528,6 @@ sbappendstream_locked(struct sockbuf *sb SBLASTMBUFCHK(sb); - /* Remove all packet headers and mbuf tags to get a pure data chain. */ - m_demote(m, 1); - sbcompress(sb, m, sb->sb_mbtail); sb->sb_lastrecord = sb->sb_mb; From owner-svn-src-stable-8@FreeBSD.ORG Thu Apr 21 08:15:30 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AE11106566B; Thu, 21 Apr 2011 08:15:30 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 09B7E8FC19; Thu, 21 Apr 2011 08:15:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3L8FT8I086819; Thu, 21 Apr 2011 08:15:29 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3L8FTI6086817; Thu, 21 Apr 2011 08:15:29 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201104210815.p3L8FTI6086817@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 21 Apr 2011 08:15: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: r220913 - stable/8/sys/netgraph 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, 21 Apr 2011 08:15:30 -0000 Author: glebius Date: Thu Apr 21 08:15:29 2011 New Revision: 220913 URL: http://svn.freebsd.org/changeset/base/220913 Log: Merge from head/ 220745: Fix error where error variable was assigned result of comparison, instead of function return value. Submitted by: Przemyslaw Frasunek Modified: stable/8/sys/netgraph/ng_base.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/netgraph/ng_base.c ============================================================================== --- stable/8/sys/netgraph/ng_base.c Thu Apr 21 08:13:44 2011 (r220912) +++ stable/8/sys/netgraph/ng_base.c Thu Apr 21 08:15:29 2011 (r220913) @@ -596,7 +596,7 @@ ng_make_node(const char *typename, node_ */ if (type->constructor != NULL) { if ((error = ng_make_node_common(type, nodepp)) == 0) { - if ((error = ((*type->constructor)(*nodepp)) != 0)) { + if ((error = ((*type->constructor)(*nodepp))) != 0) { NG_NODE_UNREF(*nodepp); } } From owner-svn-src-stable-8@FreeBSD.ORG Thu Apr 21 09:01:44 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20A5D1065670; Thu, 21 Apr 2011 09:01:44 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0E41F8FC1A; Thu, 21 Apr 2011 09:01:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3L91hbg088355; Thu, 21 Apr 2011 09:01:43 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3L91hp0088352; Thu, 21 Apr 2011 09:01:43 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201104210901.p3L91hp0088352@svn.freebsd.org> From: Sergey Kandaurov Date: Thu, 21 Apr 2011 09:01:43 +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: r220916 - 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: Thu, 21 Apr 2011 09:01:44 -0000 Author: pluknet Date: Thu Apr 21 09:01:43 2011 New Revision: 220916 URL: http://svn.freebsd.org/changeset/base/220916 Log: MFC r220621: Remove stale M_ZOMBIE malloc type. Modified: stable/8/sys/kern/kern_exit.c stable/8/sys/sys/proc.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/kern_exit.c ============================================================================== --- stable/8/sys/kern/kern_exit.c Thu Apr 21 08:20:56 2011 (r220915) +++ stable/8/sys/kern/kern_exit.c Thu Apr 21 09:01:43 2011 (r220916) @@ -93,9 +93,6 @@ SDT_PROVIDER_DECLARE(proc); SDT_PROBE_DEFINE(proc, kernel, , exit, exit); SDT_PROBE_ARGTYPE(proc, kernel, , exit, 0, "int"); -/* Required to be non-static for SysVR4 emulator */ -MALLOC_DEFINE(M_ZOMBIE, "zombie", "zombie proc status"); - /* Hook for NFS teardown procedure. */ void (*nlminfo_release_p)(struct proc *p); Modified: stable/8/sys/sys/proc.h ============================================================================== --- stable/8/sys/sys/proc.h Thu Apr 21 08:20:56 2011 (r220915) +++ stable/8/sys/sys/proc.h Thu Apr 21 09:01:43 2011 (r220916) @@ -660,7 +660,6 @@ MALLOC_DECLARE(M_PARGS); MALLOC_DECLARE(M_PGRP); MALLOC_DECLARE(M_SESSION); MALLOC_DECLARE(M_SUBPROC); -MALLOC_DECLARE(M_ZOMBIE); #endif #define FOREACH_PROC_IN_SYSTEM(p) \ From owner-svn-src-stable-8@FreeBSD.ORG Thu Apr 21 09:34:45 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25002106566C; Thu, 21 Apr 2011 09:34:45 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 094348FC0A; Thu, 21 Apr 2011 09:34:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3L9Yi3V089481; Thu, 21 Apr 2011 09:34:44 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3L9YiTP089478; Thu, 21 Apr 2011 09:34:44 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201104210934.p3L9YiTP089478@svn.freebsd.org> From: Ruslan Ermilov Date: Thu, 21 Apr 2011 09:34: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: r220919 - stable/8/sbin/conscontrol 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, 21 Apr 2011 09:34:45 -0000 Author: ru Date: Thu Apr 21 09:34:44 2011 New Revision: 220919 URL: http://svn.freebsd.org/changeset/base/220919 Log: MFC r220801: Changed "conscontrol unset" to accept an existing virtual console device as an argument. Unsetting virtual console using /dev/console seems to have never worked. Modified: stable/8/sbin/conscontrol/conscontrol.8 stable/8/sbin/conscontrol/conscontrol.c Directory Properties: stable/8/sbin/conscontrol/ (props changed) Modified: stable/8/sbin/conscontrol/conscontrol.8 ============================================================================== --- stable/8/sbin/conscontrol/conscontrol.8 Thu Apr 21 09:03:48 2011 (r220918) +++ stable/8/sbin/conscontrol/conscontrol.8 Thu Apr 21 09:34:44 2011 (r220919) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 23, 2001 +.Dd April 14, 2011 .Dt CONSCONTROL 8 .Os .Sh NAME @@ -40,7 +40,7 @@ .Cm add | delete .Ar console .Nm -.Cm set Ar console | Cm unset +.Cm set | unset Ar console .Sh DESCRIPTION The .Nm @@ -91,7 +91,7 @@ the name of the directory may be omitted Change the state of console muting. All console output is suppressed when console muting is .Cm on . -.It Cm set Ar console | Cm unset +.It Cm set | unset Ar console Set or unset the virtual console. When unset, output from the system, such as the kernel .Xr printf 9 , Modified: stable/8/sbin/conscontrol/conscontrol.c ============================================================================== --- stable/8/sbin/conscontrol/conscontrol.c Thu Apr 21 09:03:48 2011 (r220918) +++ stable/8/sbin/conscontrol/conscontrol.c Thu Apr 21 09:34:44 2011 (r220919) @@ -50,7 +50,7 @@ usage(void) "usage: conscontrol [list]", " conscontrol mute on | off", " conscontrol add | delete console", - " conscontrol set console | unset"); + " conscontrol set | unset console"); exit(1); } @@ -153,28 +153,16 @@ consdel(char *devnam) } static void -consset(char *devnam) +consset(char *devnam, int flag) { - int ttyfd, flag = 1; + int ttyfd; ttyfd = open(devnam, O_RDONLY); if (ttyfd == -1) err(1, "opening %s", devnam); if (ioctl(ttyfd, TIOCCONS, &flag) == -1) - err(1, "could not set %s as virtual console", devnam); - close(ttyfd); -} - -static void -consunset(void) -{ - int ttyfd, flag = 0; - - ttyfd = open(DEVDIR "console", O_RDONLY); - if (ttyfd == -1) - err(1, "opening virtual console"); - if (ioctl(ttyfd, TIOCCONS, &flag) == -1) - err(1, "could not unset virtual console"); + err(1, "could not %s %s as virtual console", + flag ? "set" : "unset", devnam); close(ttyfd); } @@ -188,9 +176,7 @@ main(int argc, char **argv) argv += optind; if (argc > 0 && strcmp(argv[0], "list") != 0) { - if (argc == 1 && strcmp(argv[0], "unset") == 0) - consunset(); - else if (argc != 2) + if (argc != 2) usage(); else if (strcmp(argv[0], "mute") == 0) consmute(argv[1]); @@ -199,7 +185,9 @@ main(int argc, char **argv) else if (strcmp(argv[0], "delete") == 0) consdel(argv[1]); else if (strcmp(argv[0], "set") == 0) - consset(argv[1]); + consset(argv[1], 1); + else if (strcmp(argv[0], "unset") == 0) + consset(argv[1], 0); else usage(); } From owner-svn-src-stable-8@FreeBSD.ORG Fri Apr 22 00:31:07 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA8E81065688; Fri, 22 Apr 2011 00:31:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A712A8FC1F; Fri, 22 Apr 2011 00:31:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3M0V765018907; Fri, 22 Apr 2011 00:31:07 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3M0V7he018905; Fri, 22 Apr 2011 00:31:07 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201104220031.p3M0V7he018905@svn.freebsd.org> From: Xin LI Date: Fri, 22 Apr 2011 00:31: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: r220933 - stable/8/lib/libutil 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, 22 Apr 2011 00:31:07 -0000 Author: delphij Date: Fri Apr 22 00:31:07 2011 New Revision: 220933 URL: http://svn.freebsd.org/changeset/base/220933 Log: MFC r219939: humanize_number(3) multiply the input number by 100, which could cause an integer overflow when the input is very large (for example, 100 Pi would become about 10 Ei which exceeded signed int64_t). Solve this issue by splitting the division into two parts and avoid the multiplication. PR: bin/146205 Reviewed by: arundel Modified: stable/8/lib/libutil/humanize_number.c Directory Properties: stable/8/lib/libutil/ (props changed) Modified: stable/8/lib/libutil/humanize_number.c ============================================================================== --- stable/8/lib/libutil/humanize_number.c Thu Apr 21 23:06:00 2011 (r220932) +++ stable/8/lib/libutil/humanize_number.c Fri Apr 22 00:31:07 2011 (r220933) @@ -43,11 +43,11 @@ __FBSDID("$FreeBSD$"); #include int -humanize_number(char *buf, size_t len, int64_t bytes, +humanize_number(char *buf, size_t len, int64_t quotient, const char *suffix, int scale, int flags) { const char *prefixes, *sep; - int b, i, r, maxscale, s1, s2, sign; + int i, r, remainder, maxscale, s1, s2, sign; int64_t divisor, max; size_t baselen; @@ -55,6 +55,8 @@ humanize_number(char *buf, size_t len, i assert(suffix != NULL); assert(scale >= 0); + remainder = 0; + if (flags & HN_DIVISOR_1000) { /* SI for decimal multiplies */ divisor = 1000; @@ -86,13 +88,12 @@ humanize_number(char *buf, size_t len, i if (len > 0) buf[0] = '\0'; - if (bytes < 0) { + if (quotient < 0) { sign = -1; - bytes *= -100; + quotient = -quotient; baselen = 3; /* sign, digit, prefix */ } else { sign = 1; - bytes *= 100; baselen = 2; /* digit, prefix */ } if (flags & HN_NOSPACE) @@ -109,7 +110,7 @@ humanize_number(char *buf, size_t len, i if (scale & (HN_AUTOSCALE | HN_GETSCALE)) { /* See if there is additional columns can be used. */ - for (max = 100, i = len - baselen; i-- > 0;) + for (max = 1, i = len - baselen; i-- > 0;) max *= 10; /* @@ -117,30 +118,37 @@ humanize_number(char *buf, size_t len, i * If there will be an overflow by the rounding below, * divide once more. */ - for (i = 0; bytes >= max - 50 && i < maxscale; i++) - bytes /= divisor; + for (i = 0; + (quotient >= max || (quotient == max - 1 && remainder >= 950)) && + i < maxscale; i++) { + remainder = quotient % divisor; + quotient /= divisor; + } if (scale & HN_GETSCALE) return (i); - } else - for (i = 0; i < scale && i < maxscale; i++) - bytes /= divisor; + } else { + for (i = 0; i < scale && i < maxscale; i++) { + remainder = quotient % divisor; + quotient /= divisor; + } + } /* If a value <= 9.9 after rounding and ... */ - if (bytes < 995 && i > 0 && flags & HN_DECIMAL) { + if (quotient <= 9 && remainder < 950 && i > 0 && flags & HN_DECIMAL) { /* baselen + \0 + .N */ if (len < baselen + 1 + 2) return (-1); - b = ((int)bytes + 5) / 10; - s1 = b / 10; - s2 = b % 10; + s1 = (int)quotient + ((remainder + 50) / 1000); + s2 = ((remainder + 50) / 100) % 10; r = snprintf(buf, len, "%d%s%d%s%s%s", sign * s1, localeconv()->decimal_point, s2, sep, SCALE2PREFIX(i), suffix); } else r = snprintf(buf, len, "%" PRId64 "%s%s%s", - sign * ((bytes + 50) / 100), + sign * (quotient + (remainder + 50) / 1000), sep, SCALE2PREFIX(i), suffix); return (r); } + From owner-svn-src-stable-8@FreeBSD.ORG Fri Apr 22 02:22:36 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ABBE7106566C; Fri, 22 Apr 2011 02:22:36 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9765D8FC12; Fri, 22 Apr 2011 02:22:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3M2MaVV022490; Fri, 22 Apr 2011 02:22:36 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3M2Ma3w022484; Fri, 22 Apr 2011 02:22:36 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201104220222.p3M2Ma3w022484@svn.freebsd.org> From: Navdeep Parhar Date: Fri, 22 Apr 2011 02:22: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: r220936 - in stable/8/sys/dev/cxgbe: . common 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, 22 Apr 2011 02:22:36 -0000 Author: np Date: Fri Apr 22 02:22:36 2011 New Revision: 220936 URL: http://svn.freebsd.org/changeset/base/220936 Log: MFC r220649, r220874 r220649: Fix a couple of bad races that can occur when a cxgbe interface is taken down. The ingress queue lock was unused and has been removed as part of these changes. - An in-flight egress update from the SGE must be handled before the queue that requested it is destroyed. Wait for the update to arrive. - Interrupt handlers must stop processing rx events for a queue before the queue is destroyed. Events that have not yet been processed should be ignored once the queue disappears. r220874: Use Toeplitz hash for RSS. Modified: stable/8/sys/dev/cxgbe/adapter.h stable/8/sys/dev/cxgbe/common/t4_hw.c stable/8/sys/dev/cxgbe/osdep.h stable/8/sys/dev/cxgbe/t4_main.c stable/8/sys/dev/cxgbe/t4_sge.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/cxgbe/adapter.h ============================================================================== --- stable/8/sys/dev/cxgbe/adapter.h Fri Apr 22 00:44:27 2011 (r220935) +++ stable/8/sys/dev/cxgbe/adapter.h Fri Apr 22 02:22:36 2011 (r220936) @@ -227,6 +227,11 @@ enum { /* iq flags */ IQ_ALLOCATED = (1 << 1), /* firmware resources allocated */ IQ_STARTED = (1 << 2), /* started */ + + /* iq state */ + IQS_DISABLED = 0, + IQS_BUSY = 1, + IQS_IDLE = 2, }; /* @@ -244,7 +249,7 @@ struct sge_iq { iq_intr_handler_t *handler; __be64 *desc; /* KVA of descriptor ring */ - struct mtx iq_lock; + volatile uint32_t state; struct adapter *adapter; const __be64 *cdesc; /* current descriptor */ uint8_t gen; /* generation bit */ @@ -445,22 +450,12 @@ struct adapter { #define PORT_LOCK_ASSERT_OWNED(pi) mtx_assert(&(pi)->pi_lock, MA_OWNED) #define PORT_LOCK_ASSERT_NOTOWNED(pi) mtx_assert(&(pi)->pi_lock, MA_NOTOWNED) -#define IQ_LOCK(iq) mtx_lock(&(iq)->iq_lock) -#define IQ_UNLOCK(iq) mtx_unlock(&(iq)->iq_lock) -#define IQ_LOCK_ASSERT_OWNED(iq) mtx_assert(&(iq)->iq_lock, MA_OWNED) -#define IQ_LOCK_ASSERT_NOTOWNED(iq) mtx_assert(&(iq)->iq_lock, MA_NOTOWNED) - #define FL_LOCK(fl) mtx_lock(&(fl)->fl_lock) #define FL_TRYLOCK(fl) mtx_trylock(&(fl)->fl_lock) #define FL_UNLOCK(fl) mtx_unlock(&(fl)->fl_lock) #define FL_LOCK_ASSERT_OWNED(fl) mtx_assert(&(fl)->fl_lock, MA_OWNED) #define FL_LOCK_ASSERT_NOTOWNED(fl) mtx_assert(&(fl)->fl_lock, MA_NOTOWNED) -#define RXQ_LOCK(rxq) IQ_LOCK(&(rxq)->iq) -#define RXQ_UNLOCK(rxq) IQ_UNLOCK(&(rxq)->iq) -#define RXQ_LOCK_ASSERT_OWNED(rxq) IQ_LOCK_ASSERT_OWNED(&(rxq)->iq) -#define RXQ_LOCK_ASSERT_NOTOWNED(rxq) IQ_LOCK_ASSERT_NOTOWNED(&(rxq)->iq) - #define RXQ_FL_LOCK(rxq) FL_LOCK(&(rxq)->fl) #define RXQ_FL_UNLOCK(rxq) FL_UNLOCK(&(rxq)->fl) #define RXQ_FL_LOCK_ASSERT_OWNED(rxq) FL_LOCK_ASSERT_OWNED(&(rxq)->fl) @@ -586,6 +581,8 @@ void t4_intr_fwd(void *); void t4_intr_err(void *); void t4_intr_evt(void *); void t4_intr_data(void *); +void t4_evt_rx(void *); +void t4_eth_rx(void *); int t4_eth_tx(struct ifnet *, struct sge_txq *, struct mbuf *); void t4_update_fl_bufsize(struct ifnet *); Modified: stable/8/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- stable/8/sys/dev/cxgbe/common/t4_hw.c Fri Apr 22 00:44:27 2011 (r220935) +++ stable/8/sys/dev/cxgbe/common/t4_hw.c Fri Apr 22 02:22:36 2011 (r220936) @@ -32,6 +32,8 @@ __FBSDID("$FreeBSD$"); #include "t4_regs_values.h" #include "t4fw_interface.h" +#undef msleep +#define msleep(x) DELAY((x) * 1000) /** * t4_wait_op_done_val - wait until an operation is completed Modified: stable/8/sys/dev/cxgbe/osdep.h ============================================================================== --- stable/8/sys/dev/cxgbe/osdep.h Fri Apr 22 00:44:27 2011 (r220935) +++ stable/8/sys/dev/cxgbe/osdep.h Fri Apr 22 02:22:36 2011 (r220936) @@ -74,8 +74,6 @@ typedef boolean_t bool; #define false FALSE #define true TRUE -#undef msleep -#define msleep(x) DELAY((x) * 1000) #define mdelay(x) DELAY((x) * 1000) #define udelay(x) DELAY(x) Modified: stable/8/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/8/sys/dev/cxgbe/t4_main.c Fri Apr 22 00:44:27 2011 (r220935) +++ stable/8/sys/dev/cxgbe/t4_main.c Fri Apr 22 02:22:36 2011 (r220936) @@ -378,6 +378,7 @@ t4_attach(device_t dev) rc = -t4_config_glbl_rss(sc, sc->mbox, FW_RSS_GLB_CONFIG_CMD_MODE_BASICVIRTUAL, F_FW_RSS_GLB_CONFIG_CMD_TNLMAPEN | + F_FW_RSS_GLB_CONFIG_CMD_HASHTOEPLITZ | F_FW_RSS_GLB_CONFIG_CMD_TNLALLLKP); if (rc != 0) { device_printf(dev, @@ -1038,8 +1039,21 @@ static void cxgbe_qflush(struct ifnet *ifp) { struct port_info *pi = ifp->if_softc; + struct sge_txq *txq; + int i; + struct mbuf *m; - device_printf(pi->dev, "%s unimplemented.\n", __func__); + /* queues do not exist if !IFF_DRV_RUNNING. */ + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + for_each_txq(pi, i, txq) { + TXQ_LOCK(txq); + m_freem(txq->m); + while ((m = buf_ring_dequeue_sc(txq->eq.br)) != NULL) + m_freem(m); + TXQ_UNLOCK(txq); + } + } + if_qflush(ifp); } static int @@ -2673,8 +2687,11 @@ cxgbe_txq_start(void *arg, int count) struct sge_txq *txq = arg; TXQ_LOCK(txq); - txq->eq.flags &= ~EQ_CRFLUSHED; - txq_start(txq->ifp, txq); + if (txq->eq.flags & EQ_CRFLUSHED) { + txq->eq.flags &= ~EQ_CRFLUSHED; + txq_start(txq->ifp, txq); + } else + wakeup_one(txq); /* txq is going away, wakeup free_txq */ TXQ_UNLOCK(txq); } Modified: stable/8/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/8/sys/dev/cxgbe/t4_sge.c Fri Apr 22 00:44:27 2011 (r220935) +++ stable/8/sys/dev/cxgbe/t4_sge.c Fri Apr 22 02:22:36 2011 (r220936) @@ -279,7 +279,7 @@ t4_setup_adapter_iqs(struct adapter *sc) } } - handler = t4_intr_evt; + handler = t4_evt_rx; i = 0; /* forward fwq's interrupt to the first fiq */ } else { handler = NULL; @@ -345,7 +345,7 @@ t4_setup_eth_queues(struct port_info *pi device_get_nameunit(pi->dev), i); init_iq(&rxq->iq, sc, pi->tmr_idx, pi->pktc_idx, pi->qsize_rxq, RX_IQ_ESIZE, - sc->flags & INTR_FWD ? t4_intr_data: NULL, name); + sc->flags & INTR_FWD ? t4_eth_rx : NULL, name); snprintf(name, sizeof(name), "%s rxq%d-fl", device_get_nameunit(pi->dev), i); @@ -428,6 +428,9 @@ t4_intr_fwd(void *arg) int ndesc_pending = 0, ndesc_total = 0; int qid; + if (!atomic_cmpset_32(&iq->state, IQS_IDLE, IQS_BUSY)) + return; + while (is_new_response(iq, &ctrl)) { rmb(); @@ -460,6 +463,8 @@ t4_intr_fwd(void *arg) V_CIDXINC(ndesc_pending) | V_INGRESSQID((u32)iq->cntxt_id) | V_SEINTARM(iq->intr_params)); } + + atomic_cmpset_32(&iq->state, IQS_BUSY, IQS_IDLE); } /* Deals with error interrupts */ @@ -479,6 +484,32 @@ void t4_intr_evt(void *arg) { struct sge_iq *iq = arg; + + if (!atomic_cmpset_32(&iq->state, IQS_IDLE, IQS_BUSY)) + return; + + t4_evt_rx(arg); + + atomic_cmpset_32(&iq->state, IQS_BUSY, IQS_IDLE); +} + +void +t4_intr_data(void *arg) +{ + struct sge_iq *iq = arg; + + if (!atomic_cmpset_32(&iq->state, IQS_IDLE, IQS_BUSY)) + return; + + t4_eth_rx(arg); + + atomic_cmpset_32(&iq->state, IQS_BUSY, IQS_IDLE); +} + +void +t4_evt_rx(void *arg) +{ + struct sge_iq *iq = arg; struct adapter *sc = iq->adapter; struct rsp_ctrl *ctrl; const struct rss_header *rss; @@ -537,7 +568,7 @@ t4_intr_evt(void *arg) } void -t4_intr_data(void *arg) +t4_eth_rx(void *arg) { struct sge_rxq *rxq = arg; struct sge_iq *iq = arg; @@ -1017,8 +1048,6 @@ alloc_iq_fl(struct port_info *pi, struct if (pi == NULL) pi = sc->port[0]; - mtx_init(&iq->iq_lock, iq->lockname, NULL, MTX_DEF); - len = iq->qsize * iq->esize; rc = alloc_ring(sc, len, &iq->desc_tag, &iq->desc_map, &iq->ba, (void **)&iq->desc); @@ -1148,6 +1177,7 @@ alloc_iq_fl(struct port_info *pi, struct } /* Enable IQ interrupts */ + atomic_store_rel_32(&iq->state, IQS_IDLE); t4_write_reg(sc, MYPF_REG(A_SGE_PF_GTS), V_SEINTARM(iq->intr_params) | V_INGRESSQID(iq->cntxt_id)); @@ -1179,6 +1209,10 @@ free_iq_fl(struct port_info *pi, struct return (rc); } iq->flags &= ~IQ_STARTED; + + /* Synchronize with the interrupt handler */ + while (!atomic_cmpset_32(&iq->state, IQS_IDLE, IQS_DISABLED)) + pause("iqfree", hz / 1000); } if (iq->flags & IQ_ALLOCATED) { @@ -1196,9 +1230,6 @@ free_iq_fl(struct port_info *pi, struct free_ring(sc, iq->desc_tag, iq->desc_map, iq->ba, iq->desc); - if (mtx_initialized(&iq->iq_lock)) - mtx_destroy(&iq->iq_lock); - bzero(iq, sizeof(*iq)); if (fl) { @@ -1425,6 +1456,27 @@ free_txq(struct port_info *pi, struct sg struct sge_eq *eq = &txq->eq; if (eq->flags & (EQ_ALLOCATED | EQ_STARTED)) { + + /* + * Wait for the response to a credit flush if there's one + * pending. Clearing the flag tells handle_sge_egr_update or + * cxgbe_txq_start (depending on how far the response has made + * it) that they should ignore the response and wake up free_txq + * instead. + * + * The interface has been marked down by the time we get here + * (both IFF_UP and IFF_DRV_RUNNING cleared). qflush has + * emptied the tx buf_rings and we know nothing new is being + * queued for tx so we don't have to worry about a new credit + * flush request. + */ + TXQ_LOCK(txq); + if (eq->flags & EQ_CRFLUSHED) { + eq->flags &= ~EQ_CRFLUSHED; + msleep(txq, &eq->eq_lock, 0, "crflush", 0); + } + TXQ_UNLOCK(txq); + rc = -t4_eth_eq_free(sc, sc->mbox, sc->pf, 0, eq->cntxt_id); if (rc != 0) { device_printf(pi->dev, @@ -2444,13 +2496,14 @@ handle_sge_egr_update(struct adapter *sc struct port_info *pi; txq = (void *)s->eqmap[qid - s->eq_start]; - - KASSERT(txq->eq.flags & EQ_CRFLUSHED, - ("%s: tx queue %p not expecting an update.", __func__, txq)); - - pi = txq->ifp->if_softc; - taskqueue_enqueue(pi->tq, &txq->resume_tx); - txq->egr_update++; + TXQ_LOCK(txq); + if (txq->eq.flags & EQ_CRFLUSHED) { + pi = txq->ifp->if_softc; + taskqueue_enqueue(pi->tq, &txq->resume_tx); + txq->egr_update++; + } else + wakeup_one(txq); /* txq is going away, wakeup free_txq */ + TXQ_UNLOCK(txq); return (0); } From owner-svn-src-stable-8@FreeBSD.ORG Fri Apr 22 09:43:00 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B00CC106564A; Fri, 22 Apr 2011 09:43:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9DB208FC0C; Fri, 22 Apr 2011 09:43:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3M9h0lI035888; Fri, 22 Apr 2011 09:43:00 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3M9h0Is035883; Fri, 22 Apr 2011 09:43:00 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201104220943.p3M9h0Is035883@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 22 Apr 2011 09:43: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: r220942 - in stable/8/sys: dev/usb/controller mips/atheros mips/rmi 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, 22 Apr 2011 09:43:00 -0000 Author: hselasky Date: Fri Apr 22 09:43:00 2011 New Revision: 220942 URL: http://svn.freebsd.org/changeset/base/220942 Log: MFC r220558. We don't need to call EOWRITE4(sc, EHCI_USBINTR, 0) directly from each EHCI bus driver at detach, hence ehci_detach() does exactly this since r199718. Approved by: thompsa Modified: stable/8/sys/dev/usb/controller/ehci_ixp4xx.c stable/8/sys/dev/usb/controller/ehci_pci.c stable/8/sys/mips/atheros/ar71xx_ehci.c stable/8/sys/mips/rmi/xls_ehci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/usb/controller/ehci_ixp4xx.c ============================================================================== --- stable/8/sys/dev/usb/controller/ehci_ixp4xx.c Fri Apr 22 09:41:51 2011 (r220941) +++ stable/8/sys/dev/usb/controller/ehci_ixp4xx.c Fri Apr 22 09:43:00 2011 (r220942) @@ -260,13 +260,6 @@ ehci_ixp_detach(device_t self) /* during module unload there are lots of children leftover */ device_delete_all_children(self); - /* - * disable interrupts that might have been switched on in ehci_init - */ - if (sc->sc_io_res) { - EOWRITE4(sc, EHCI_USBINTR, 0); - } - if (sc->sc_irq_res && sc->sc_intr_hdl) { /* * only call ehci_detach() after ehci_init() Modified: stable/8/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- stable/8/sys/dev/usb/controller/ehci_pci.c Fri Apr 22 09:41:51 2011 (r220941) +++ stable/8/sys/dev/usb/controller/ehci_pci.c Fri Apr 22 09:43:00 2011 (r220942) @@ -503,12 +503,6 @@ ehci_pci_detach(device_t self) pci_disable_busmaster(self); - /* - * disable interrupts that might have been switched on in ehci_init - */ - if (sc->sc_io_res) { - EOWRITE4(sc, EHCI_USBINTR, 0); - } if (sc->sc_irq_res && sc->sc_intr_hdl) { /* * only call ehci_detach() after ehci_init() Modified: stable/8/sys/mips/atheros/ar71xx_ehci.c ============================================================================== --- stable/8/sys/mips/atheros/ar71xx_ehci.c Fri Apr 22 09:41:51 2011 (r220941) +++ stable/8/sys/mips/atheros/ar71xx_ehci.c Fri Apr 22 09:43:00 2011 (r220942) @@ -225,13 +225,6 @@ ar71xx_ehci_detach(device_t self) /* during module unload there are lots of children leftover */ device_delete_all_children(self); - /* - * disable interrupts that might have been switched on in ehci_init - */ - if (sc->sc_io_res) { - EOWRITE4(sc, EHCI_USBINTR, 0); - } - if (sc->sc_irq_res && sc->sc_intr_hdl) { /* * only call ehci_detach() after ehci_init() Modified: stable/8/sys/mips/rmi/xls_ehci.c ============================================================================== --- stable/8/sys/mips/rmi/xls_ehci.c Fri Apr 22 09:41:51 2011 (r220941) +++ stable/8/sys/mips/rmi/xls_ehci.c Fri Apr 22 09:43:00 2011 (r220942) @@ -224,13 +224,6 @@ ehci_xls_detach(device_t self) /* during module unload there are lots of children leftover */ device_delete_all_children(self); - /* - * disable interrupts that might have been switched on in ehci_init - */ - if (sc->sc_io_res) { - EOWRITE4(sc, EHCI_USBINTR, 0); - } - if (sc->sc_irq_res && sc->sc_intr_hdl) { ehci_detach(sc); From owner-svn-src-stable-8@FreeBSD.ORG Fri Apr 22 14:41:29 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A622106566C; Fri, 22 Apr 2011 14:41:29 +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 5A16B8FC13; Fri, 22 Apr 2011 14:41:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3MEfTfW046519; Fri, 22 Apr 2011 14:41:29 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3MEfT8b046517; Fri, 22 Apr 2011 14:41:29 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201104221441.p3MEfT8b046517@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 22 Apr 2011 14:41: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: r220952 - stable/8/lib/libc/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, 22 Apr 2011 14:41:29 -0000 Author: jilles Date: Fri Apr 22 14:41:29 2011 New Revision: 220952 URL: http://svn.freebsd.org/changeset/base/220952 Log: MFC r220646: getfh(2): Add xrefs for fhopen(2), open(2), stat(2). Modified: stable/8/lib/libc/sys/getfh.2 Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) Modified: stable/8/lib/libc/sys/getfh.2 ============================================================================== --- stable/8/lib/libc/sys/getfh.2 Fri Apr 22 13:56:21 2011 (r220951) +++ stable/8/lib/libc/sys/getfh.2 Fri Apr 22 14:41:29 2011 (r220952) @@ -28,7 +28,7 @@ .\" @(#)getfh.2 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd April 6, 2004 +.Dd April 14, 2011 .Dt GETFH 2 .Os .Sh NAME @@ -104,6 +104,10 @@ An .Tn I/O error occurred while reading from or writing to the file system. .El +.Sh SEE ALSO +.Xr fhopen 2 , +.Xr open 2 , +.Xr stat 2 .Sh HISTORY The .Fn getfh From owner-svn-src-stable-8@FreeBSD.ORG Fri Apr 22 23:42:24 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DB45106566B; Fri, 22 Apr 2011 23:42:24 +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 E46E38FC12; Fri, 22 Apr 2011 23:42:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3MNgNMq062602; Fri, 22 Apr 2011 23:42:23 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3MNgNMm062601; Fri, 22 Apr 2011 23:42:23 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201104222342.p3MNgNMm062601@svn.freebsd.org> From: Doug Barton Date: Fri, 22 Apr 2011 23: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: r220957 - in stable/8/etc: . mtree 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, 22 Apr 2011 23:42:24 -0000 Author: dougb Date: Fri Apr 22 23:42:23 2011 New Revision: 220957 URL: http://svn.freebsd.org/changeset/base/220957 Log: Pull mergeinfo from r220370 up to etc/ where it belongs Modified: Directory Properties: stable/8/etc/ (props changed) stable/8/etc/mtree/ (props changed) From owner-svn-src-stable-8@FreeBSD.ORG Fri Apr 22 23:44:25 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7068B106566C; Fri, 22 Apr 2011 23:44:25 +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 5D2888FC08; Fri, 22 Apr 2011 23:44:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3MNiP3k062725; Fri, 22 Apr 2011 23:44:25 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3MNiPJR062723; Fri, 22 Apr 2011 23:44:25 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201104222344.p3MNiPJR062723@svn.freebsd.org> From: Doug Barton Date: Fri, 22 Apr 2011 23:44:25 +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: r220958 - stable/8/etc 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, 22 Apr 2011 23:44:25 -0000 Author: dougb Date: Fri Apr 22 23:44:25 2011 New Revision: 220958 URL: http://svn.freebsd.org/changeset/base/220958 Log: MFC r220760: The change in r206686 to allow the stop argument to work for a service that is running even though not _enable'd had an annoying side effect. If the service was already started at boot time by another means when the related script came around again in rcorder it would start again, regardless of _enable, because there was a valid pid. So, split the test into 2 parts, one for (!rcvar && !stop), and one for (stop && !valid_pid). This preserves the behavior from r206686 while preventing the undesired side effect. Modified: stable/8/etc/rc.subr Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/rc.subr ============================================================================== --- stable/8/etc/rc.subr Fri Apr 22 23:42:23 2011 (r220957) +++ stable/8/etc/rc.subr Fri Apr 22 23:44:25 2011 (r220958) @@ -651,7 +651,8 @@ run_rc_command() # checkyesno ${rcvar} # and return if that failed # - if [ -n "${rcvar}" -a "$rc_arg" != "rcvar" -a -z "${rc_pid}" ]; then + if [ -n "${rcvar}" -a "$rc_arg" != "rcvar" -a "$rc_arg" != "stop" ] || + [ -n "${rcvar}" -a "$rc_arg" = "stop" -a -z "${rc_pid}" ]; then if ! checkyesno ${rcvar}; then if [ -n "${rc_quiet}" ]; then return 0 From owner-svn-src-stable-8@FreeBSD.ORG Sat Apr 23 02:03:18 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66C241065672; Sat, 23 Apr 2011 02:03:18 +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 54BF88FC08; Sat, 23 Apr 2011 02:03:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3N23IJf066910; Sat, 23 Apr 2011 02:03:18 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3N23I1b066908; Sat, 23 Apr 2011 02:03:18 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201104230203.p3N23I1b066908@svn.freebsd.org> From: Doug Barton Date: Sat, 23 Apr 2011 02:03: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: r220960 - stable/8/etc 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, 23 Apr 2011 02:03:18 -0000 Author: dougb Date: Sat Apr 23 02:03:18 2011 New Revision: 220960 URL: http://svn.freebsd.org/changeset/base/220960 Log: MFC r201038: Update the comments about files ending in .sh Modified: stable/8/etc/rc.subr Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/rc.subr ============================================================================== --- stable/8/etc/rc.subr Fri Apr 22 23:45:33 2011 (r220959) +++ stable/8/etc/rc.subr Sat Apr 23 02:03:18 2011 (r220960) @@ -945,10 +945,11 @@ _run_rc_killcmd() # # run_rc_script file arg # Start the script `file' with `arg', and correctly handle the -# return value from the script. If `file' ends with `.sh', it's -# sourced into the current environment. If `file' appears to be -# a backup or scratch file, ignore it. Otherwise if it's -# executable run as a child process. +# return value from the script. +# If `file' ends with `.sh', it's sourced into the current environment +# when $rc_fast_and_loose is set, otherwise it is run as a child process. +# If `file' appears to be a backup or scratch file, ignore it. +# Otherwise if it is executable run as a child process. # run_rc_script() { From owner-svn-src-stable-8@FreeBSD.ORG Sat Apr 23 05:29:59 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 720BF1065670; Sat, 23 Apr 2011 05:29:59 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 601D58FC08; Sat, 23 Apr 2011 05:29:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3N5Txpx073364; Sat, 23 Apr 2011 05:29:59 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3N5TxjM073362; Sat, 23 Apr 2011 05:29:59 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201104230529.p3N5TxjM073362@svn.freebsd.org> From: Ruslan Ermilov Date: Sat, 23 Apr 2011 05:29: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: r220964 - stable/8/contrib/bsnmp/snmpd 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, 23 Apr 2011 05:29:59 -0000 Author: ru Date: Sat Apr 23 05:29:59 2011 New Revision: 220964 URL: http://svn.freebsd.org/changeset/base/220964 Log: MFC r220882: Don't clog syslog up with "inet_ntop(): Address family not supported by protocol family" when processing requests received from the UNIX domain socket. Modified: stable/8/contrib/bsnmp/snmpd/main.c Directory Properties: stable/8/contrib/bsnmp/ (props changed) Modified: stable/8/contrib/bsnmp/snmpd/main.c ============================================================================== --- stable/8/contrib/bsnmp/snmpd/main.c Sat Apr 23 05:24:17 2011 (r220963) +++ stable/8/contrib/bsnmp/snmpd/main.c Sat Apr 23 05:29:59 2011 (r220964) @@ -909,7 +909,8 @@ snmpd_input(struct port_input *pi, struc /* * In case of AF_INET{6} peer, do hosts_access(5) check. */ - if (inet_ntop(pi->peer->sa_family, + if (pi->peer->sa_family != AF_LOCAL && + inet_ntop(pi->peer->sa_family, &((const struct sockaddr_in *)(const void *)pi->peer)->sin_addr, client, sizeof(client)) != NULL) { request_set(&req, RQ_CLIENT_ADDR, client, 0); @@ -918,7 +919,7 @@ snmpd_input(struct port_input *pi, struc eval_client(&req)); return (-1); } - } else + } else if (pi->peer->sa_family != AF_LOCAL) syslog(LOG_ERR, "inet_ntop(): %m"); #endif