From owner-svn-src-stable-8@FreeBSD.ORG Sun May 8 06:25: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 A69371065670; Sun, 8 May 2011 06:25:50 +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 981F28FC12; Sun, 8 May 2011 06:25:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p486Pobf032458; Sun, 8 May 2011 06:25:50 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p486PoUE032456; Sun, 8 May 2011 06:25:50 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201105080625.p486PoUE032456@svn.freebsd.org> From: Navdeep Parhar Date: Sun, 8 May 2011 06:25: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: r221619 - 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: Sun, 08 May 2011 06:25:50 -0000 Author: np Date: Sun May 8 06:25:50 2011 New Revision: 221619 URL: http://svn.freebsd.org/changeset/base/221619 Log: MFC r221516: Bump up the number of egress queues that the driver is allowed to use. Modified: stable/8/sys/dev/cxgbe/t4_main.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/t4_main.c ============================================================================== --- stable/8/sys/dev/cxgbe/t4_main.c Sun May 8 05:45:06 2011 (r221618) +++ stable/8/sys/dev/cxgbe/t4_main.c Sun May 8 06:25:50 2011 (r221619) @@ -388,7 +388,7 @@ t4_attach(device_t dev) /* These are total (sum of all ports) limits for a bus driver */ rc = -t4_cfg_pfvf(sc, sc->mbox, sc->pf, 0, - 64, /* max # of egress queues */ + 128, /* max # of egress queues */ 64, /* max # of egress Ethernet or control queues */ 64, /* max # of ingress queues with fl/interrupt */ 0, /* max # of ingress queues without interrupt */ From owner-svn-src-stable-8@FreeBSD.ORG Sun May 8 08:17: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 621FA106566B; Sun, 8 May 2011 08:17:17 +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 537458FC0A; Sun, 8 May 2011 08:17:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p488HHLD035909; Sun, 8 May 2011 08:17:17 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p488HHp0035906; Sun, 8 May 2011 08:17:17 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201105080817.p488HHp0035906@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 8 May 2011 08:17: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: r221621 - stable/8/sys/dev/usb X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 08:17:17 -0000 Author: hselasky Date: Sun May 8 08:17:16 2011 New Revision: 221621 URL: http://svn.freebsd.org/changeset/base/221621 Log: MFC r214221, r216072 and r214809. Make configuration of USB stack more flexible. Modified: stable/8/sys/dev/usb/usb_device.c stable/8/sys/dev/usb/usb_freebsd.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/usb/usb_device.c ============================================================================== --- stable/8/sys/dev/usb/usb_device.c Sun May 8 07:21:09 2011 (r221620) +++ stable/8/sys/dev/usb/usb_device.c Sun May 8 08:17:16 2011 (r221621) @@ -97,8 +97,10 @@ static void usb_suspend_resume_sub(struc static void usbd_clear_stall_proc(struct usb_proc_msg *_pm); static usb_error_t usb_config_parse(struct usb_device *, uint8_t, uint8_t); static void usbd_set_device_strings(struct usb_device *); -#if USB_HAVE_UGEN +#if USB_HAVE_DEVCTL static void usb_notify_addq(const char *type, struct usb_device *); +#endif +#if USB_HAVE_UGEN static void usb_fifo_free_wrap(struct usb_device *, uint8_t, uint8_t); static struct cdev *usb_make_dev(struct usb_device *, int, int); static void usb_cdev_create(struct usb_device *); @@ -1865,7 +1867,9 @@ config_done: printf("%s: <%s> at %s\n", udev->ugen_name, usb_get_manufacturer(udev), device_get_nameunit(udev->bus->bdev)); +#endif +#if USB_HAVE_DEVCTL usb_notify_addq("ATTACH", udev); #endif done: @@ -2011,9 +2015,11 @@ usb_free_device(struct usb_device *udev, bus = udev->bus; usb_set_device_state(udev, USB_STATE_DETACHED); -#if USB_HAVE_UGEN +#if USB_HAVE_DEVCTL usb_notify_addq("DETACH", udev); +#endif +#if USB_HAVE_UGEN printf("%s: <%s> at %s (disconnected)\n", udev->ugen_name, usb_get_manufacturer(udev), device_get_nameunit(bus->bdev)); @@ -2380,7 +2386,7 @@ usbd_get_device_index(struct usb_device return (udev->device_index); } -#if USB_HAVE_UGEN +#if USB_HAVE_DEVCTL /*------------------------------------------------------------------------* * usb_notify_addq * @@ -2416,7 +2422,9 @@ usb_notify_addq_compat(const char *type, /* String it all together. */ snprintf(data, buf_size, "%s" +#if USB_HAVE_UGEN "%s " +#endif "at port=%u " "vendor=0x%04x " "product=0x%04x " @@ -2424,20 +2432,27 @@ usb_notify_addq_compat(const char *type, "devsubclass=0x%02x " "sernum=\"%s\" " "release=0x%04x " - "on " - "%s\n", +#if USB_HAVE_UGEN + "on %s\n" +#endif + "", ntype, +#if USB_HAVE_UGEN udev->ugen_name, +#endif udev->port_no, UGETW(udev->ddesc.idVendor), UGETW(udev->ddesc.idProduct), udev->ddesc.bDeviceClass, udev->ddesc.bDeviceSubClass, usb_get_serial(udev), - UGETW(udev->ddesc.bcdDevice), - udev->parent_hub != NULL ? + UGETW(udev->ddesc.bcdDevice) +#if USB_HAVE_UGEN + , udev->parent_hub != NULL ? udev->parent_hub->ugen_name : - device_get_nameunit(device_get_parent(udev->bus->bdev))); + device_get_nameunit(device_get_parent(udev->bus->bdev)) +#endif + ); devctl_queue_data(data); } @@ -2457,7 +2472,10 @@ usb_notify_addq(const char *type, struct /* announce the device */ sb = sbuf_new_auto(); sbuf_printf(sb, +#if USB_HAVE_UGEN + "ugen=%s " "cdev=%s " +#endif "vendor=0x%04x " "product=0x%04x " "devclass=0x%02x " @@ -2466,8 +2484,14 @@ usb_notify_addq(const char *type, struct "release=0x%04x " "mode=%s " "port=%u " - "parent=%s", +#if USB_HAVE_UGEN + "parent=%s" +#endif + "", +#if USB_HAVE_UGEN + udev->ugen_name, udev->ugen_name, +#endif UGETW(udev->ddesc.idVendor), UGETW(udev->ddesc.idProduct), udev->ddesc.bDeviceClass, @@ -2475,10 +2499,13 @@ usb_notify_addq(const char *type, struct usb_get_serial(udev), UGETW(udev->ddesc.bcdDevice), (udev->flags.usb_mode == USB_MODE_HOST) ? "host" : "device", - udev->port_no, - udev->parent_hub != NULL ? - udev->parent_hub->ugen_name : - device_get_nameunit(device_get_parent(udev->bus->bdev))); + udev->port_no +#if USB_HAVE_UGEN + , udev->parent_hub != NULL ? + udev->parent_hub->ugen_name : + device_get_nameunit(device_get_parent(udev->bus->bdev)) +#endif + ); sbuf_finish(sb); devctl_notify("USB", "DEVICE", type, sbuf_data(sb)); sbuf_delete(sb); @@ -2493,7 +2520,10 @@ usb_notify_addq(const char *type, struct sb = sbuf_new_auto(); sbuf_printf(sb, +#if USB_HAVE_UGEN + "ugen=%s " "cdev=%s " +#endif "vendor=0x%04x " "product=0x%04x " "devclass=0x%02x " @@ -2506,7 +2536,10 @@ usb_notify_addq(const char *type, struct "intclass=0x%02x " "intsubclass=0x%02x " "intprotocol=0x%02x", +#if USB_HAVE_UGEN udev->ugen_name, + udev->ugen_name, +#endif UGETW(udev->ddesc.idVendor), UGETW(udev->ddesc.idProduct), udev->ddesc.bDeviceClass, @@ -2524,7 +2557,9 @@ usb_notify_addq(const char *type, struct sbuf_delete(sb); } } +#endif +#if USB_HAVE_UGEN /*------------------------------------------------------------------------* * usb_fifo_free_wrap * Modified: stable/8/sys/dev/usb/usb_freebsd.h ============================================================================== --- stable/8/sys/dev/usb/usb_freebsd.h Sun May 8 07:21:09 2011 (r221620) +++ stable/8/sys/dev/usb/usb_freebsd.h Sun May 8 08:17:16 2011 (r221621) @@ -33,6 +33,7 @@ /* Default USB configuration */ #define USB_HAVE_UGEN 1 +#define USB_HAVE_DEVCTL 1 #define USB_HAVE_BUSDMA 1 #define USB_HAVE_COMPAT_LINUX 1 #define USB_HAVE_USER_IO 1 From owner-svn-src-stable-8@FreeBSD.ORG Sun May 8 09:09: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 C27941065679; Sun, 8 May 2011 09:09:36 +0000 (UTC) (envelope-from jhellenthal@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 42A2A8FC1B; Sun, 8 May 2011 09:09:36 +0000 (UTC) Received: by iwn33 with SMTP id 33so5153190iwn.13 for ; Sun, 08 May 2011 02:09:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:date:from:to:cc:subject:message-id :references:mime-version:content-type:content-disposition :in-reply-to:x-openpgp-key-id:x-openpgp-key-fingerprint :x-openpgp-key-url; bh=vNr/PBhJqyrszdyvANkZJK7wiOr6raAxoH6HGroaXdk=; b=qUfLPZI+QY0M8UXlC9MXrrQfnVF5rXkVFvbub89te220yjpWzE8al5m6KN49nKhV4N UTL5SQ6DJTq2Us5fgBZomxC8g1q2Z/6ylUXAjZXk1os7lRVtSGyoURn9zCxB1lFhaVEg rQu5nJbP7LVX6LItaEEdbJ9HxJW2E35ufSEgs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:x-openpgp-key-id :x-openpgp-key-fingerprint:x-openpgp-key-url; b=WKsm1laUmgqaUNhf1nWYFV1YCxx4v6UfwrXBICz1glkjYg9/EQhKXkfjrHNzzqtG2v YR/pctVKXpWsP4EoLnjgVjphlD5dRz4N1Aqv2t4rTk90dA2WZk5gT0Q1pYLxfwjiAdEf TuX22cEunYNgBraw4dDzp7+PPwQjGFfKjDHHE= Received: by 10.42.130.130 with SMTP id v2mr5021572ics.233.1304844343449; Sun, 08 May 2011 01:45:43 -0700 (PDT) Received: from DataIX.net (adsl-99-190-84-116.dsl.klmzmi.sbcglobal.net [99.190.84.116]) by mx.google.com with ESMTPS id o3sm2112317ibd.10.2011.05.08.01.45.41 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 08 May 2011 01:45:42 -0700 (PDT) Sender: "J. Hellenthal" Received: from DataIX.net (localhost [127.0.0.1]) by DataIX.net (8.14.4/8.14.4) with ESMTP id p488jcgQ094710 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 8 May 2011 04:45:39 -0400 (EDT) (envelope-from jhell@DataIX.net) Received: (from jhell@localhost) by DataIX.net (8.14.4/8.14.4/Submit) id p488jblN094709; Sun, 8 May 2011 04:45:37 -0400 (EDT) (envelope-from jhell@DataIX.net) Date: Sun, 8 May 2011 04:45:37 -0400 From: Jason Hellenthal To: Hans Petter Selasky Message-ID: <20110508084537.GA70268@DataIX.net> References: <201105080817.p488HHp0035906@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="wac7ysb48OaltWcw" Content-Disposition: inline In-Reply-To: <201105080817.p488HHp0035906@svn.freebsd.org> X-OpenPGP-Key-Id: 0x89D8547E X-OpenPGP-Key-Fingerprint: 85EF E26B 07BB 3777 76BE B12A 9057 8789 89D8 547E X-OpenPGP-Key-URL: http://bit.ly/0x89D8547E 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: r221621 - stable/8/sys/dev/usb X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 09:09:37 -0000 --wac7ysb48OaltWcw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hans, Was this intended. ? "udev->ugen_name," On Sun, May 08, 2011 at 08:17:17AM +0000, Hans Petter Selasky wrote:=20 > Author: hselasky > Date: Sun May 8 08:17:16 2011 > New Revision: 221621 > URL: http://svn.freebsd.org/changeset/base/221621 >=20 [...] > +#if USB_HAVE_UGEN > + "parent=3D%s" > +#endif > + "", > +#if USB_HAVE_UGEN > + udev->ugen_name, > udev->ugen_name, > +#endif [...] > +#if USB_HAVE_UGEN > udev->ugen_name, > + udev->ugen_name, > +#endif --=20 Regards, (jhell) Jason Hellenthal --wac7ysb48OaltWcw Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (FreeBSD) Comment: http://bit.ly/0x89D8547E iQEcBAEBAgAGBQJNxlgxAAoJEJBXh4mJ2FR+ySoH/2dYPFMxfwpTdKJSw1DxVOBA O5pKONp9SHxGNX023/G4r3Zktuegd4URWtUb2G2hcDDPqwaa9ZcQ9G8oYm2vITUS YQj6aXfWNtDsKLHdr5CqKcK/R5u89pIySWi/IxxZ+jzd6DDO3f94LNB9vV5l5cTu 5fW9nvfPmW/gmnqdmGUHiCb4CENVKZokhRH1LYzxtdtLroBJjCkEnN3q4hdl7k+q rF66DkxzR8hy3feyZl47D3lTLMzO5M9PrAR8gId0gb1ctejMczejLDsu7EB2nSe6 Bqg+BdOOalOEJ5g1fLQiEaTQtHdhciDuPeugPdFtgl9+5Rfl+x6yJIyt7Bhf/pU= =OCa4 -----END PGP SIGNATURE----- --wac7ysb48OaltWcw-- From owner-svn-src-stable-8@FreeBSD.ORG Sun May 8 09:48: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 E9D86106564A; Sun, 8 May 2011 09:48:24 +0000 (UTC) (envelope-from hselasky@freebsd.org) Received: from swip.net (mailfe06.c2i.net [212.247.154.162]) by mx1.freebsd.org (Postfix) with ESMTP id 3D84E8FC17; Sun, 8 May 2011 09:48:23 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=NvrFngl24Vvwb7eBef0tfsytOWEnP/WlkqxQrRnklhk= c=1 sm=1 a=SvYTsOw2Z4kA:10 a=YKcn08c2pF4A:10 a=dBRESv0yCI8A:10 a=Q9fys5e9bTEA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=DiimSGeJN9pgu_E7FloA:9 a=PUjeQqilurYA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe06.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 123106928; Sun, 08 May 2011 11:38:19 +0200 Received-SPF: softfail receiver=mailfe06.swip.net; client-ip=188.126.198.129; envelope-from=hselasky@freebsd.org From: Hans Petter Selasky To: Jason Hellenthal Date: Sun, 8 May 2011 11:37:10 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <201105080817.p488HHp0035906@svn.freebsd.org> <20110508084537.GA70268@DataIX.net> In-Reply-To: <20110508084537.GA70268@DataIX.net> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201105081137.10517.hselasky@freebsd.org> 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: r221621 - stable/8/sys/dev/usb X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 09:48:25 -0000 On Sunday 08 May 2011 10:45:37 Jason Hellenthal wrote: > Hans, > > Was this intended. ? "udev->ugen_name," > No, we added a second variable, ugen=ugenX.Y. That's why it is listed twice. I think if ugen_name is NULL, the print statement will not panic. Thanks for your comment! --HPS From owner-svn-src-stable-8@FreeBSD.ORG Mon May 9 18:05: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 AE930106564A; Mon, 9 May 2011 18:05:13 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F7F48FC12; Mon, 9 May 2011 18:05:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p49I5DXF007203; Mon, 9 May 2011 18:05:13 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p49I5D47007200; Mon, 9 May 2011 18:05:13 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105091805.p49I5D47007200@svn.freebsd.org> From: Attilio Rao Date: Mon, 9 May 2011 18:05: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: r221704 - stable/8/sys/dev/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: Mon, 09 May 2011 18:05:13 -0000 Author: attilio Date: Mon May 9 18:05:13 2011 New Revision: 221704 URL: http://svn.freebsd.org/changeset/base/221704 Log: MFC r220925,221015,221016: - Define new registers offsets - Add toggling functions for SMI default setting Sponsored by: Sandvine Incorporated Modified: 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/ichwd/ichwd.c ============================================================================== --- stable/8/sys/dev/ichwd/ichwd.c Mon May 9 17:34:00 2011 (r221703) +++ stable/8/sys/dev/ichwd/ichwd.c Mon May 9 18:05:13 2011 (r221704) @@ -171,6 +171,15 @@ ichwd_smi_enable(struct ichwd_softc *sc) } /* + * Check if the watchdog SMI triggering is enabled. + */ +static __inline int +ichwd_smi_is_enabled(struct ichwd_softc *sc) +{ + return ((ichwd_read_smi_4(sc, SMI_EN) & SMI_TCO_EN) != 0); +} + +/* * Reset the watchdog status bits. */ static __inline void @@ -488,6 +497,7 @@ ichwd_attach(device_t dev) sc->ev_tag = EVENTHANDLER_REGISTER(watchdog_list, ichwd_event, sc, 0); /* disable the SMI handler */ + sc->smi_enabled = ichwd_smi_is_enabled(sc); ichwd_smi_disable(sc); return (0); @@ -519,7 +529,8 @@ ichwd_detach(device_t dev) ichwd_tmr_disable(sc); /* enable the SMI handler */ - ichwd_smi_enable(sc); + if (sc->smi_enabled != 0) + ichwd_smi_enable(sc); /* deregister event handler */ if (sc->ev_tag != NULL) Modified: stable/8/sys/dev/ichwd/ichwd.h ============================================================================== --- stable/8/sys/dev/ichwd/ichwd.h Mon May 9 17:34:00 2011 (r221703) +++ stable/8/sys/dev/ichwd/ichwd.h Mon May 9 18:05:13 2011 (r221704) @@ -45,6 +45,7 @@ struct ichwd_softc { int active; unsigned int timeout; + int smi_enabled; int smi_rid; struct resource *smi_res; bus_space_tag_t smi_bst; @@ -135,15 +136,19 @@ struct ichwd_softc { #define TCO2_STS 0x06 /* TCO Status 2 */ #define TCO1_CNT 0x08 /* TCO Control 1 */ #define TCO2_CNT 0x08 /* TCO Control 2 */ +#define TCO_MESSAGE1 0x0c /* TCO Message 1 */ +#define TCO_MESSAGE2 0x0d /* TCO Message 2 */ /* bit definitions for SMI_EN and SMI_STS */ #define SMI_TCO_EN 0x2000 #define SMI_TCO_STS 0x2000 +#define SMI_GBL_EN 0x0001 /* timer value mask for TCO_RLD and TCO_TMR */ #define TCO_TIMER_MASK 0x1f /* status bits for TCO1_STS */ +#define TCO_NEWCENTURY 0x80 /* set for RTC year roll over (99 to 00) */ #define TCO_TIMEOUT 0x08 /* timed out */ #define TCO_INT_STS 0x04 /* data out (DO NOT USE) */ #define TCO_SMI_STS 0x02 /* data in (DO NOT USE) */ @@ -153,8 +158,10 @@ struct ichwd_softc { #define TCO_SECOND_TO_STS 0x02 /* ran down twice */ /* control bits for TCO1_CNT */ -#define TCO_TMR_HALT 0x0800 /* clear to enable WDT */ -#define TCO_CNT_PRESERVE 0x0200 /* preserve these bits */ +#define TCO_TMR_HALT 0x0800 /* clear to enable WDT */ +#define TCO_NMI2SMI_EN 0x0200 /* convert NMIs to SMIs */ +#define TCO_CNT_PRESERVE TCO_NMI2SMI_EN /* preserve these bits */ +#define TCO_NMI_NOW 0x0100 /* trigger an NMI */ /* * Masks for the TCO timer value field in TCO_RLD. From owner-svn-src-stable-8@FreeBSD.ORG Mon May 9 18:29:49 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 E1887106566B; Mon, 9 May 2011 18:29:48 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D189F8FC08; Mon, 9 May 2011 18:29:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p49ITmtf008033; Mon, 9 May 2011 18:29:48 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p49ITmnl008028; Mon, 9 May 2011 18:29:48 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105091829.p49ITmnl008028@svn.freebsd.org> From: Attilio Rao Date: Mon, 9 May 2011 18:29:48 +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: r221705 - 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: Mon, 09 May 2011 18:29:49 -0000 Author: attilio Date: Mon May 9 18:29:48 2011 New Revision: 221705 URL: http://svn.freebsd.org/changeset/base/221705 Log: MFC r221023: Add the possibility to verify MD5 hash of incoming TCP packets. Sponsored by: Sandvine Incorporated Modified: stable/8/sys/netinet/tcp_input.c stable/8/sys/netinet/tcp_subr.c stable/8/sys/netinet/tcp_syncache.c stable/8/sys/netinet/tcp_var.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/netinet/tcp_input.c ============================================================================== --- stable/8/sys/netinet/tcp_input.c Mon May 9 18:05:13 2011 (r221704) +++ stable/8/sys/netinet/tcp_input.c Mon May 9 18:29:48 2011 (r221705) @@ -205,6 +205,12 @@ static void tcp_xmit_timer(struct tcpcb static void tcp_newreno_partial_ack(struct tcpcb *, struct tcphdr *); static void inline tcp_congestion_exp(struct tcpcb *); +static void inline tcp_fields_to_host(struct tcphdr *); +#ifdef TCP_SIGNATURE +static void inline tcp_fields_to_net(struct tcphdr *); +static int inline tcp_signature_verify_input(struct mbuf *, int, int, + int, struct tcpopt *, struct tcphdr *, u_int); +#endif /* * Kernel module interface for updating tcpstat. The argument is an index @@ -236,6 +242,40 @@ tcp_congestion_exp(struct tcpcb *tp) tp->t_flags |= TF_ECN_SND_CWR; } +static inline void +tcp_fields_to_host(struct tcphdr *th) +{ + + th->th_seq = ntohl(th->th_seq); + th->th_ack = ntohl(th->th_ack); + th->th_win = ntohs(th->th_win); + th->th_urp = ntohs(th->th_urp); +} + +#ifdef TCP_SIGNATURE +static inline void +tcp_fields_to_net(struct tcphdr *th) +{ + + th->th_seq = htonl(th->th_seq); + th->th_ack = htonl(th->th_ack); + th->th_win = htons(th->th_win); + th->th_urp = htons(th->th_urp); +} + +static inline int +tcp_signature_verify_input(struct mbuf *m, int off0, int tlen, int optlen, + struct tcpopt *to, struct tcphdr *th, u_int tcpbflag) +{ + int ret; + + tcp_fields_to_net(th); + ret = tcp_signature_verify(m, off0, tlen, optlen, to, th, tcpbflag); + tcp_fields_to_host(th); + return (ret); +} +#endif + /* Neighbor Discovery, Neighbor Unreachability Detection Upper layer hint. */ #ifdef INET6 #define ND6_HINT(tp) \ @@ -315,6 +355,9 @@ tcp_input(struct mbuf *m, int off0) int thflags; int rstreason = 0; /* For badport_bandlim accounting purposes */ uint8_t iptos; +#ifdef TCP_SIGNATURE + uint8_t sig_checked = 0; +#endif #ifdef IPFIREWALL_FORWARD struct m_tag *fwd_tag; #endif @@ -472,10 +515,7 @@ tcp_input(struct mbuf *m, int off0) /* * Convert TCP protocol specific fields to host format. */ - th->th_seq = ntohl(th->th_seq); - th->th_ack = ntohl(th->th_ack); - th->th_win = ntohs(th->th_win); - th->th_urp = ntohs(th->th_urp); + tcp_fields_to_host(th); /* * Delay dropping TCP, IP headers, IPv6 ext headers, and TCP options. @@ -657,8 +697,24 @@ relocked: } INP_INFO_WLOCK_ASSERT(&V_tcbinfo); +#ifdef TCP_SIGNATURE + tcp_dooptions(&to, optp, optlen, + (thflags & TH_SYN) ? TO_SYN : 0); + if (sig_checked == 0) { + tp = intotcpcb(inp); + if (tp == NULL || tp->t_state == TCPS_CLOSED) { + rstreason = BANDLIM_RST_CLOSEDPORT; + goto dropwithreset; + } + if (!tcp_signature_verify_input(m, off0, tlen, optlen, + &to, th, tp->t_flags)) + goto dropunlock; + sig_checked = 1; + } +#else if (thflags & TH_SYN) tcp_dooptions(&to, optp, optlen, TO_SYN); +#endif /* * NB: tcp_twcheck unlocks the INP and frees the mbuf. */ @@ -817,6 +873,26 @@ relocked: tp = intotcpcb(inp); KASSERT(tp->t_state == TCPS_SYN_RECEIVED, ("%s: ", __func__)); +#ifdef TCP_SIGNATURE + if (sig_checked == 0) { + tcp_dooptions(&to, optp, optlen, + (thflags & TH_SYN) ? TO_SYN : 0); + if (!tcp_signature_verify_input(m, off0, tlen, + optlen, &to, th, tp->t_flags)) { + + /* + * In SYN_SENT state if it receives an + * RST, it is allowed for further + * processing. + */ + if ((thflags & TH_RST) == 0 || + (tp->t_state == TCPS_SYN_SENT) == 0) + goto dropunlock; + } + sig_checked = 1; + } +#endif + /* * Process the segment and the data it * contains. tcp_do_segment() consumes @@ -1021,6 +1097,25 @@ relocked: return; } +#ifdef TCP_SIGNATURE + if (sig_checked == 0) { + tcp_dooptions(&to, optp, optlen, + (thflags & TH_SYN) ? TO_SYN : 0); + if (!tcp_signature_verify_input(m, off0, tlen, optlen, &to, + th, tp->t_flags)) { + + /* + * In SYN_SENT state if it receives an RST, it is + * allowed for further processing. + */ + if ((thflags & TH_RST) == 0 || + (tp->t_state == TCPS_SYN_SENT) == 0) + goto dropunlock; + } + sig_checked = 1; + } +#endif + /* * Segment belongs to a connection in SYN_SENT, ESTABLISHED or later * state. tcp_do_segment() always consumes the mbuf chain, unlocks Modified: stable/8/sys/netinet/tcp_subr.c ============================================================================== --- stable/8/sys/netinet/tcp_subr.c Mon May 9 18:05:13 2011 (r221704) +++ stable/8/sys/netinet/tcp_subr.c Mon May 9 18:29:48 2011 (r221705) @@ -257,6 +257,12 @@ SYSCTL_VNET_INT(_net_inet_tcp_inflight, &VNET_NAME(tcp_inflight_stab), 0, "Inflight Algorithm Stabilization 20 = 2 packets"); +#ifdef TCP_SIGNATURE +static int tcp_sig_checksigs = 1; +SYSCTL_INT(_net_inet_tcp, OID_AUTO, signature_verify_input, CTLFLAG_RW, + &tcp_sig_checksigs, 0, "Verify RFC2385 digests on inbound traffic"); +#endif + VNET_DEFINE(uma_zone_t, sack_hole_zone); #define V_sack_hole_zone VNET(sack_hole_zone) @@ -2084,6 +2090,66 @@ tcp_signature_compute(struct mbuf *m, in KEY_FREESAV(&sav); return (0); } + +/* + * Verify the TCP-MD5 hash of a TCP segment. (RFC2385) + * + * Parameters: + * m pointer to head of mbuf chain + * len length of TCP segment data, excluding options + * optlen length of TCP segment options + * buf pointer to storage for computed MD5 digest + * direction direction of flow (IPSEC_DIR_INBOUND or OUTBOUND) + * + * Return 1 if successful, otherwise return 0. + */ +int +tcp_signature_verify(struct mbuf *m, int off0, int tlen, int optlen, + struct tcpopt *to, struct tcphdr *th, u_int tcpbflag) +{ + char tmpdigest[TCP_SIGLEN]; + + if (tcp_sig_checksigs == 0) + return (1); + if ((tcpbflag & TF_SIGNATURE) == 0) { + if ((to->to_flags & TOF_SIGNATURE) != 0) { + + /* + * If this socket is not expecting signature but + * the segment contains signature just fail. + */ + TCPSTAT_INC(tcps_sig_err_sigopt); + TCPSTAT_INC(tcps_sig_rcvbadsig); + return (0); + } + + /* Signature is not expected, and not present in segment. */ + return (1); + } + + /* + * If this socket is expecting signature but the segment does not + * contain any just fail. + */ + if ((to->to_flags & TOF_SIGNATURE) == 0) { + TCPSTAT_INC(tcps_sig_err_nosigopt); + TCPSTAT_INC(tcps_sig_rcvbadsig); + return (0); + } + if (tcp_signature_compute(m, off0, tlen, optlen, &tmpdigest[0], + IPSEC_DIR_INBOUND) == -1) { + TCPSTAT_INC(tcps_sig_err_buildsig); + TCPSTAT_INC(tcps_sig_rcvbadsig); + return (0); + } + + if (bcmp(to->to_signature, &tmpdigest[0], TCP_SIGLEN) != 0) { + TCPSTAT_INC(tcps_sig_rcvbadsig); + return (0); + } + TCPSTAT_INC(tcps_sig_rcvgoodsig); + return (1); +} #endif /* TCP_SIGNATURE */ static int Modified: stable/8/sys/netinet/tcp_syncache.c ============================================================================== --- stable/8/sys/netinet/tcp_syncache.c Mon May 9 18:05:13 2011 (r221704) +++ stable/8/sys/netinet/tcp_syncache.c Mon May 9 18:29:48 2011 (r221705) @@ -1010,7 +1010,8 @@ _syncache_add(struct in_conninfo *inc, s struct syncache_head *sch; struct mbuf *ipopts = NULL; u_int32_t flowtmp; - int win, sb_hiwat, ip_ttl, ip_tos, noopt; + u_int ltflags; + int win, sb_hiwat, ip_ttl, ip_tos; char *s; #ifdef INET6 int autoflowlabel = 0; @@ -1043,7 +1044,7 @@ _syncache_add(struct in_conninfo *inc, s ip_tos = inp->inp_ip_tos; win = sbspace(&so->so_rcv); sb_hiwat = so->so_rcv.sb_hiwat; - noopt = (tp->t_flags & TF_NOOPT); + ltflags = (tp->t_flags & (TF_NOOPT | TF_SIGNATURE)); /* By the time we drop the lock these should no longer be used. */ so = NULL; @@ -1238,14 +1239,14 @@ _syncache_add(struct in_conninfo *inc, s * XXX: Currently we always record the option by default and will * attempt to use it in syncache_respond(). */ - if (to->to_flags & TOF_SIGNATURE) + if (to->to_flags & TOF_SIGNATURE || ltflags & TF_SIGNATURE) sc->sc_flags |= SCF_SIGNATURE; #endif if (to->to_flags & TOF_SACKPERM) sc->sc_flags |= SCF_SACK; if (to->to_flags & TOF_MSS) sc->sc_peer_mss = to->to_mss; /* peer mss may be zero */ - if (noopt) + if (ltflags & TF_NOOPT) sc->sc_flags |= SCF_NOOPT; if ((th->th_flags & (TH_ECE|TH_CWR)) && V_tcp_do_ecn) sc->sc_flags |= SCF_ECN; Modified: stable/8/sys/netinet/tcp_var.h ============================================================================== --- stable/8/sys/netinet/tcp_var.h Mon May 9 18:05:13 2011 (r221704) +++ stable/8/sys/netinet/tcp_var.h Mon May 9 18:29:48 2011 (r221705) @@ -470,7 +470,14 @@ struct tcpstat { u_long tcps_ecn_shs; /* ECN successful handshakes */ u_long tcps_ecn_rcwnd; /* # times ECN reduced the cwnd */ - u_long _pad[12]; /* 6 UTO, 6 TBD */ + /* TCP_SIGNATURE related stats */ + u_long tcps_sig_rcvgoodsig; /* Total matching signature received */ + u_long tcps_sig_rcvbadsig; /* Total bad signature received */ + u_long tcps_sig_err_buildsig; /* Mismatching signature received */ + u_long tcps_sig_err_sigopt; /* No signature expected by socket */ + u_long tcps_sig_err_nosigopt; /* No signature provided by segment */ + + u_long _pad[7]; /* 6 UTO, 1 TBD */ }; #ifdef _KERNEL @@ -638,6 +645,8 @@ int tcp_twrespond(struct tcptw *, int); void tcp_setpersist(struct tcpcb *); #ifdef TCP_SIGNATURE int tcp_signature_compute(struct mbuf *, int, int, int, u_char *, u_int); +int tcp_signature_verify(struct mbuf *, int, int, int, struct tcpopt *, + struct tcphdr *, u_int); #endif void tcp_slowtimo(void); struct tcptemp * From owner-svn-src-stable-8@FreeBSD.ORG Tue May 10 02:58: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 6175D106566C; Tue, 10 May 2011 02:58:08 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 51B858FC0C; Tue, 10 May 2011 02:58:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4A2w8Ur023611; Tue, 10 May 2011 02:58:08 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4A2w8am023609; Tue, 10 May 2011 02:58:08 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201105100258.p4A2w8am023609@svn.freebsd.org> From: Andrew Thompson Date: Tue, 10 May 2011 02:58: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: r221721 - stable/8/sys/net 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, 10 May 2011 02:58:08 -0000 Author: thompsa Date: Tue May 10 02:58:08 2011 New Revision: 221721 URL: http://svn.freebsd.org/changeset/base/221721 Log: MFC r221270 LACP frames must not be send VLAN-tagged, check for that before processing. PR: kern/156743 Submitted by: Dmitrij Tejblum Modified: stable/8/sys/net/if_lagg.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/net/if_lagg.c ============================================================================== --- stable/8/sys/net/if_lagg.c Tue May 10 02:38:44 2011 (r221720) +++ stable/8/sys/net/if_lagg.c Tue May 10 02:58:08 2011 (r221721) @@ -1786,7 +1786,7 @@ lagg_lacp_input(struct lagg_softc *sc, s etype = ntohs(eh->ether_type); /* Tap off LACP control messages */ - if (etype == ETHERTYPE_SLOW) { + if ((m->m_flags & M_VLANTAG) == 0 && etype == ETHERTYPE_SLOW) { m = lacp_input(lp, m); if (m == NULL) return (NULL); From owner-svn-src-stable-8@FreeBSD.ORG Tue May 10 05:30:10 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 CF5E81065672; Tue, 10 May 2011 05:30:10 +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 336D18FC08; Tue, 10 May 2011 05:30:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4A5U7FQ028422; Tue, 10 May 2011 05:30:07 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4A5U7Vq028420; Tue, 10 May 2011 05:30:07 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201105100530.p4A5U7Vq028420@svn.freebsd.org> From: Ruslan Ermilov Date: Tue, 10 May 2011 05:30: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: r221723 - stable/8/bin/stty 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, 10 May 2011 05:30:10 -0000 Author: ru Date: Tue May 10 05:30:06 2011 New Revision: 221723 URL: http://svn.freebsd.org/changeset/base/221723 Log: MFC r221372: Don't call -f option's argument "stdin". Modified: stable/8/bin/stty/stty.c Directory Properties: stable/8/bin/stty/ (props changed) Modified: stable/8/bin/stty/stty.c ============================================================================== --- stable/8/bin/stty/stty.c Tue May 10 04:32:27 2011 (r221722) +++ stable/8/bin/stty/stty.c Tue May 10 05:30:06 2011 (r221723) @@ -61,9 +61,11 @@ main(int argc, char *argv[]) struct info i; enum FMT fmt; int ch; + const char *file; fmt = NOTSET; i.fd = STDIN_FILENO; + file = "stdin"; opterr = 0; while (optind < argc && @@ -79,6 +81,7 @@ main(int argc, char *argv[]) case 'f': if ((i.fd = open(optarg, O_RDONLY | O_NONBLOCK)) < 0) err(1, "%s", optarg); + file = optarg; break; case 'g': fmt = GFLAG; @@ -92,7 +95,7 @@ args: argc -= optind; argv += optind; if (tcgetattr(i.fd, &i.t) < 0) - errx(1, "stdin isn't a terminal"); + errx(1, "%s isn't a terminal", file); if (ioctl(i.fd, TIOCGETD, &i.ldisc) < 0) err(1, "TIOCGETD"); if (ioctl(i.fd, TIOCGWINSZ, &i.win) < 0) From owner-svn-src-stable-8@FreeBSD.ORG Tue May 10 05:33:38 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 45F4F106566B; Tue, 10 May 2011 05:33:38 +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 360A08FC08; Tue, 10 May 2011 05:33:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4A5XcZe028574; Tue, 10 May 2011 05:33:38 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4A5Xcrr028572; Tue, 10 May 2011 05:33:38 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201105100533.p4A5Xcrr028572@svn.freebsd.org> From: Ruslan Ermilov Date: Tue, 10 May 2011 05:33:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221724 - in stable/8/contrib/bsnmp: snmp_mibII 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: Tue, 10 May 2011 05:33:38 -0000 Author: ru Date: Tue May 10 05:33:37 2011 New Revision: 221724 URL: http://svn.freebsd.org/changeset/base/221724 Log: MFC r221373: Properly detect interface's state in the LINK_STATE_UNKNOWN case. Modified: stable/8/contrib/bsnmp/snmp_mibII/mibII_interfaces.c Directory Properties: stable/8/contrib/bsnmp/ (props changed) stable/8/contrib/bsnmp/snmpd/bsnmpd.1 (props changed) Modified: stable/8/contrib/bsnmp/snmp_mibII/mibII_interfaces.c ============================================================================== --- stable/8/contrib/bsnmp/snmp_mibII/mibII_interfaces.c Tue May 10 05:30:06 2011 (r221723) +++ stable/8/contrib/bsnmp/snmp_mibII/mibII_interfaces.c Tue May 10 05:33:37 2011 (r221724) @@ -289,8 +289,7 @@ op_ifentry(struct snmp_context *ctx, str * cable) and hence return 'dormant'. */ if (ifp->mib.ifmd_flags & IFF_RUNNING) { - if (ifp->mib.ifmd_data.ifi_link_state == - LINK_STATE_DOWN) + if (ifp->mib.ifmd_data.ifi_link_state != LINK_STATE_UP) value->v.integer = 5; /* state dormant */ else value->v.integer = 1; /* state up */ From owner-svn-src-stable-8@FreeBSD.ORG Tue May 10 18:43:19 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 426921065673; Tue, 10 May 2011 18:43:19 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 31EDC8FC13; Tue, 10 May 2011 18:43:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4AIhJfE055886; Tue, 10 May 2011 18:43:19 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4AIhJfp055884; Tue, 10 May 2011 18:43:19 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201105101843.p4AIhJfp055884@svn.freebsd.org> From: Marius Strobl Date: Tue, 10 May 2011 18:43:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221748 - stable/8/sys/dev/mii X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2011 18:43:19 -0000 Author: marius Date: Tue May 10 18:43:18 2011 New Revision: 221748 URL: http://svn.freebsd.org/changeset/base/221748 Log: Supply the correct size of the softc. This is a direct commit to stable/8 as in head the problem is no longer present as of r221407 but that revision can't be MFC'ed. Modified: stable/8/sys/dev/mii/ip1000phy.c Modified: stable/8/sys/dev/mii/ip1000phy.c ============================================================================== --- stable/8/sys/dev/mii/ip1000phy.c Tue May 10 18:41:46 2011 (r221747) +++ stable/8/sys/dev/mii/ip1000phy.c Tue May 10 18:43:18 2011 (r221748) @@ -76,7 +76,7 @@ static devclass_t ip1000phy_devclass; static driver_t ip1000phy_driver = { "ip1000phy", ip1000phy_methods, - sizeof (struct mii_softc) + sizeof(struct ip1000phy_softc) }; DRIVER_MODULE(ip1000phy, miibus, ip1000phy_driver, ip1000phy_devclass, 0, 0); From owner-svn-src-stable-8@FreeBSD.ORG Wed May 11 04:46:33 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC21E106564A; Wed, 11 May 2011 04:46:33 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8FBA98FC0A; Wed, 11 May 2011 04:46:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4B4kXFx074077; Wed, 11 May 2011 04:46:33 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4B4kXjk074075; Wed, 11 May 2011 04:46:33 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201105110446.p4B4kXjk074075@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 11 May 2011 04:46:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221754 - stable/8/sys/geom/cache 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, 11 May 2011 04:46:33 -0000 Author: ae Date: Wed May 11 04:46:33 2011 New Revision: 221754 URL: http://svn.freebsd.org/changeset/base/221754 Log: MFC r221446: Remove unneeded checks, g_new_xxx functions can not fail. Modified: stable/8/sys/geom/cache/g_cache.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/geom/cache/g_cache.c ============================================================================== --- stable/8/sys/geom/cache/g_cache.c Wed May 11 00:52:41 2011 (r221753) +++ stable/8/sys/geom/cache/g_cache.c Wed May 11 04:46:33 2011 (r221754) @@ -499,12 +499,6 @@ g_cache_create(struct g_class *mp, struc } gp = g_new_geomf(mp, md->md_name); - if (gp == NULL) { - G_CACHE_DEBUG(0, "Cannot create geom %s.", md->md_name); - return (NULL); - } - gp->softc = NULL; /* for a moment */ - sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); sc->sc_type = type; sc->sc_bshift = bshift; @@ -525,10 +519,6 @@ g_cache_create(struct g_class *mp, struc gp->dumpconf = g_cache_dumpconf; newpp = g_new_providerf(gp, "cache/%s", gp->name); - if (newpp == NULL) { - G_CACHE_DEBUG(0, "Cannot create provider cache/%s.", gp->name); - goto fail; - } newpp->sectorsize = pp->sectorsize; newpp->mediasize = pp->mediasize; if (type == G_CACHE_TYPE_AUTOMATIC) @@ -536,35 +526,20 @@ g_cache_create(struct g_class *mp, struc sc->sc_tail = BNO2OFF(OFF2BNO(newpp->mediasize, sc), sc); cp = g_new_consumer(gp); - if (cp == NULL) { - G_CACHE_DEBUG(0, "Cannot create consumer for %s.", gp->name); - goto fail; - } if (g_attach(cp, pp) != 0) { G_CACHE_DEBUG(0, "Cannot attach to provider %s.", pp->name); - goto fail; + g_destroy_consumer(cp); + g_destroy_provider(newpp); + mtx_destroy(&sc->sc_mtx); + g_free(sc); + g_destroy_geom(gp); + return (NULL); } g_error_provider(newpp, 0); G_CACHE_DEBUG(0, "Device %s created.", gp->name); callout_reset(&sc->sc_callout, g_cache_timeout * hz, g_cache_go, sc); return (gp); -fail: - if (cp != NULL) { - if (cp->provider != NULL) - g_detach(cp); - g_destroy_consumer(cp); - } - if (newpp != NULL) - g_destroy_provider(newpp); - if (gp != NULL) { - if (gp->softc != NULL) { - mtx_destroy(&sc->sc_mtx); - g_free(gp->softc); - } - g_destroy_geom(gp); - } - return (NULL); } static int From owner-svn-src-stable-8@FreeBSD.ORG Wed May 11 04:48:04 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 6263E106566B; Wed, 11 May 2011 04:48:04 +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 35B698FC12; Wed, 11 May 2011 04:48:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4B4m40N074175; Wed, 11 May 2011 04:48:04 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4B4m4eD074170; Wed, 11 May 2011 04:48:04 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201105110448.p4B4m4eD074170@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 11 May 2011 04:48: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: r221755 - in stable/8/sys/geom: concat eli shsec stripe 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, 11 May 2011 04:48:04 -0000 Author: ae Date: Wed May 11 04:48:03 2011 New Revision: 221755 URL: http://svn.freebsd.org/changeset/base/221755 Log: MFC r221447: Remove "for a moment" assignment. struct g_geom zeroed when allocated. Modified: stable/8/sys/geom/concat/g_concat.c stable/8/sys/geom/eli/g_eli.c stable/8/sys/geom/shsec/g_shsec.c stable/8/sys/geom/stripe/g_stripe.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/geom/concat/g_concat.c ============================================================================== --- stable/8/sys/geom/concat/g_concat.c Wed May 11 04:46:33 2011 (r221754) +++ stable/8/sys/geom/concat/g_concat.c Wed May 11 04:48:03 2011 (r221755) @@ -546,8 +546,6 @@ g_concat_create(struct g_class *mp, cons } } gp = g_new_geomf(mp, "%s", md->md_name); - gp->softc = NULL; /* for a moment */ - sc = malloc(sizeof(*sc), M_CONCAT, M_WAITOK | M_ZERO); gp->start = g_concat_start; gp->spoiled = g_concat_orphan; Modified: stable/8/sys/geom/eli/g_eli.c ============================================================================== --- stable/8/sys/geom/eli/g_eli.c Wed May 11 04:46:33 2011 (r221754) +++ stable/8/sys/geom/eli/g_eli.c Wed May 11 04:48:03 2011 (r221755) @@ -709,8 +709,6 @@ g_eli_create(struct gctl_req *req, struc G_ELI_DEBUG(1, "Creating device %s%s.", bpp->name, G_ELI_SUFFIX); gp = g_new_geomf(mp, "%s%s", bpp->name, G_ELI_SUFFIX); - gp->softc = NULL; /* for a moment */ - sc = malloc(sizeof(*sc), M_ELI, M_WAITOK | M_ZERO); gp->start = g_eli_start; /* Modified: stable/8/sys/geom/shsec/g_shsec.c ============================================================================== --- stable/8/sys/geom/shsec/g_shsec.c Wed May 11 04:46:33 2011 (r221754) +++ stable/8/sys/geom/shsec/g_shsec.c Wed May 11 04:48:03 2011 (r221755) @@ -545,8 +545,6 @@ g_shsec_create(struct g_class *mp, const } } gp = g_new_geomf(mp, "%s", md->md_name); - gp->softc = NULL; /* for a moment */ - sc = malloc(sizeof(*sc), M_SHSEC, M_WAITOK | M_ZERO); gp->start = g_shsec_start; gp->spoiled = g_shsec_orphan; Modified: stable/8/sys/geom/stripe/g_stripe.c ============================================================================== --- stable/8/sys/geom/stripe/g_stripe.c Wed May 11 04:46:33 2011 (r221754) +++ stable/8/sys/geom/stripe/g_stripe.c Wed May 11 04:48:03 2011 (r221755) @@ -818,8 +818,6 @@ g_stripe_create(struct g_class *mp, cons } } gp = g_new_geomf(mp, "%s", md->md_name); - gp->softc = NULL; /* for a moment */ - sc = malloc(sizeof(*sc), M_STRIPE, M_WAITOK | M_ZERO); gp->start = g_stripe_start; gp->spoiled = g_stripe_orphan; From owner-svn-src-stable-8@FreeBSD.ORG Wed May 11 04:53: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 462BA106566C; Wed, 11 May 2011 04:53:57 +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 33EAA8FC0A; Wed, 11 May 2011 04:53:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4B4rvuC074393; Wed, 11 May 2011 04:53:57 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4B4rvIi074390; Wed, 11 May 2011 04:53:57 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201105110453.p4B4rvIi074390@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 11 May 2011 04:53: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: r221756 - in stable/8/sys/geom: multipath sched 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, 11 May 2011 04:53:57 -0000 Author: ae Date: Wed May 11 04:53:56 2011 New Revision: 221756 URL: http://svn.freebsd.org/changeset/base/221756 Log: MFC r221452,221453: Remove unneeded code. Modified: stable/8/sys/geom/multipath/g_multipath.c stable/8/sys/geom/sched/g_sched.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/geom/multipath/g_multipath.c ============================================================================== --- stable/8/sys/geom/multipath/g_multipath.c Wed May 11 04:48:03 2011 (r221755) +++ stable/8/sys/geom/multipath/g_multipath.c Wed May 11 04:53:56 2011 (r221756) @@ -292,9 +292,6 @@ g_multipath_create(struct g_class *mp, s } gp = g_new_geomf(mp, md->md_name); - if (gp == NULL) - goto fail; - sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); gp->softc = sc; gp->start = g_multipath_start; @@ -304,21 +301,12 @@ g_multipath_create(struct g_class *mp, s memcpy(sc->sc_name, md->md_name, sizeof (sc->sc_name)); pp = g_new_providerf(gp, "multipath/%s", md->md_name); - if (pp == NULL) - goto fail; /* limit the provider to not have it stomp on metadata */ pp->mediasize = md->md_size - md->md_sectorsize; pp->sectorsize = md->md_sectorsize; sc->pp = pp; g_error_provider(pp, 0); return (gp); -fail: - if (gp != NULL) { - if (gp->softc != NULL) - g_free(gp->softc); - g_destroy_geom(gp); - } - return (NULL); } static int @@ -347,8 +335,6 @@ g_multipath_add_disk(struct g_geom *gp, } nxtcp = LIST_FIRST(&gp->consumer); cp = g_new_consumer(gp); - if (cp == NULL) - return (ENOMEM); error = g_attach(cp, pp); if (error != 0) { printf("GEOM_MULTIPATH: cannot attach %s to %s", Modified: stable/8/sys/geom/sched/g_sched.c ============================================================================== --- stable/8/sys/geom/sched/g_sched.c Wed May 11 04:48:03 2011 (r221755) +++ stable/8/sys/geom/sched/g_sched.c Wed May 11 04:53:56 2011 (r221756) @@ -1004,11 +1004,6 @@ g_sched_create(struct gctl_req *req, str gp = g_new_geomf(mp, name); dstgp = proxy ? pp->geom : gp; /* where do we link the provider */ - if (gp == NULL) { - gctl_error(req, "Cannot create geom %s.", name); - error = ENOMEM; - goto fail; - } sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); sc->sc_gsched = gsp; @@ -1034,23 +1029,10 @@ g_sched_create(struct gctl_req *req, str gp->dumpconf = g_sched_dumpconf; newpp = g_new_providerf(dstgp, gp->name); - if (newpp == NULL) { - gctl_error(req, "Cannot create provider %s.", name); - error = ENOMEM; - goto fail; - } - newpp->mediasize = pp->mediasize; newpp->sectorsize = pp->sectorsize; cp = g_new_consumer(gp); - if (cp == NULL) { - gctl_error(req, "Cannot create consumer for %s.", - gp->name); - error = ENOMEM; - goto fail; - } - error = g_attach(cp, proxy ? newpp : pp); if (error != 0) { gctl_error(req, "Cannot attach to provider %s.", @@ -1076,23 +1058,15 @@ fail: g_detach(cp); g_destroy_consumer(cp); } - if (newpp != NULL) g_destroy_provider(newpp); - - if (sc && sc->sc_hash) { + if (sc->sc_hash) g_sched_hash_fini(gp, sc->sc_hash, sc->sc_mask, gsp, sc->sc_data); - } - - if (sc && sc->sc_data) + if (sc->sc_data) gsp->gs_fini(sc->sc_data); - - if (gp != NULL) { - if (gp->softc != NULL) - g_free(gp->softc); - g_destroy_geom(gp); - } + g_free(gp->softc); + g_destroy_geom(gp); return (error); } From owner-svn-src-stable-8@FreeBSD.ORG Wed May 11 05:53: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 3C8101065670; Wed, 11 May 2011 05:53:17 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A4338FC0A; Wed, 11 May 2011 05:53:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4B5rHtH076194; Wed, 11 May 2011 05:53:17 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4B5rHTO076192; Wed, 11 May 2011 05:53:17 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201105110553.p4B5rHTO076192@svn.freebsd.org> From: Andriy Gapon Date: Wed, 11 May 2011 05:53: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: r221757 - stable/8/sys/boot/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: Wed, 11 May 2011 05:53:17 -0000 Author: avg Date: Wed May 11 05:53:16 2011 New Revision: 221757 URL: http://svn.freebsd.org/changeset/base/221757 Log: MFC r221593,221601: whitespace nits Modified: stable/8/sys/boot/common/interp.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/boot/common/interp.c ============================================================================== --- stable/8/sys/boot/common/interp.c Wed May 11 04:53:56 2011 (r221756) +++ stable/8/sys/boot/common/interp.c Wed May 11 05:53:16 2011 (r221757) @@ -105,7 +105,7 @@ interact(void) /* * Read our default configuration */ - if(include("/boot/loader.rc")!=CMD_OK) + if (include("/boot/loader.rc") != CMD_OK) include("/boot/boot.conf"); printf("\n"); /* From owner-svn-src-stable-8@FreeBSD.ORG Wed May 11 07:33: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 04EBB106564A; Wed, 11 May 2011 07:33:07 +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 E5E4A8FC0C; Wed, 11 May 2011 07:33:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4B7X6hZ079225; Wed, 11 May 2011 07:33:06 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4B7X6df079216; Wed, 11 May 2011 07:33:06 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201105110733.p4B7X6df079216@svn.freebsd.org> From: Ruslan Ermilov Date: Wed, 11 May 2011 07:33:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221759 - in stable/8: sbin/mount_nfs sys/fs/nfsclient 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: Wed, 11 May 2011 07:33:07 -0000 Author: ru Date: Wed May 11 07:33:06 2011 New Revision: 221759 URL: http://svn.freebsd.org/changeset/base/221759 Log: MFC r221436: Implemented a mount option "nocto" that disables cache coherency checking at open time. It may improve performance for read-only NFS mounts. Modified: stable/8/sbin/mount_nfs/mount_nfs.8 stable/8/sys/fs/nfsclient/nfs_clvfsops.c stable/8/sys/fs/nfsclient/nfs_clvnops.c stable/8/sys/fs/nfsclient/nfsargs.h stable/8/sys/nfsclient/nfs_diskless.c stable/8/sys/nfsclient/nfs_vfsops.c stable/8/sys/nfsclient/nfs_vnops.c stable/8/sys/nfsclient/nfsargs.h Directory Properties: stable/8/sbin/mount_nfs/ (props changed) stable/8/sys/ (props changed) Modified: stable/8/sbin/mount_nfs/mount_nfs.8 ============================================================================== --- stable/8/sbin/mount_nfs/mount_nfs.8 Wed May 11 06:03:12 2011 (r221758) +++ stable/8/sbin/mount_nfs/mount_nfs.8 Wed May 11 07:33:06 2011 (r221759) @@ -28,7 +28,7 @@ .\" @(#)mount_nfs.8 8.3 (Berkeley) 3/29/95 .\" $FreeBSD$ .\" -.Dd July 28, 2009 +.Dd May 3, 2011 .Dt MOUNT_NFS 8 .Os .Sh NAME @@ -176,6 +176,17 @@ NFS port number 2049 or replies to reque Setting the .Va vfs.nfs.nfs_ip_paranoia sysctl to 0 will make this option the default. +.It Cm nocto +Normally, NFS clients maintain the close-to-open cache coherency. +This works by flushing at close time and checking at open time. +Checking at open time is implemented by getting attributes from +the server and purging the data cache if they do not match +attributes cached by the client. +.Pp +This option disables checking at open time. +It may improve performance for read-only mounts, +but should only be used if the data on the server changes rarely. +Be sure to understand the consequences before enabling this option. .It Cm noinet4 , noinet6 Disables .Dv AF_INET Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvfsops.c Wed May 11 06:03:12 2011 (r221758) +++ stable/8/sys/fs/nfsclient/nfs_clvfsops.c Wed May 11 07:33:06 2011 (r221759) @@ -700,7 +700,7 @@ static const char *nfs_opts[] = { "from" "retrans", "acregmin", "acregmax", "acdirmin", "acdirmax", "resvport", "readahead", "hostname", "timeout", "addr", "fh", "nfsv3", "sec", "principal", "nfsv4", "gssname", "allgssname", "dirpath", - "negnametimeo", + "negnametimeo", "nocto", NULL }; /* @@ -799,6 +799,8 @@ nfs_mount(struct mount *mp) } if (vfs_getopt(mp->mnt_optnew, "allgssname", NULL, NULL) == 0) args.flags |= NFSMNT_ALLGSSNAME; + if (vfs_getopt(mp->mnt_optnew, "nocto", NULL, NULL) == 0) + args.flags |= NFSMNT_NOCTO; if (vfs_getopt(mp->mnt_optnew, "readdirsize", (void **)&opt, NULL) == 0) { if (opt == NULL) { vfs_mount_error(mp, "illegal readdirsize"); Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvnops.c Wed May 11 06:03:12 2011 (r221758) +++ stable/8/sys/fs/nfsclient/nfs_clvnops.c Wed May 11 07:33:06 2011 (r221759) @@ -1026,7 +1026,8 @@ nfs_lookup(struct vop_lookup_args *ap) */ newvp = *vpp; newnp = VTONFS(newvp); - if ((flags & (ISLASTCN | ISOPEN)) == (ISLASTCN | ISOPEN) && + if (!(nmp->nm_flag & NFSMNT_NOCTO) && + (flags & (ISLASTCN | ISOPEN)) == (ISLASTCN | ISOPEN) && !(newnp->n_flag & NMODIFIED)) { mtx_lock(&newnp->n_mtx); newnp->n_attrstamp = 0; Modified: stable/8/sys/fs/nfsclient/nfsargs.h ============================================================================== --- stable/8/sys/fs/nfsclient/nfsargs.h Wed May 11 06:03:12 2011 (r221758) +++ stable/8/sys/fs/nfsclient/nfsargs.h Wed May 11 07:33:06 2011 (r221759) @@ -100,5 +100,6 @@ struct nfs_args { #define NFSMNT_HASSETFSID 0x02000000 /* Has set FSID */ #define NFSMNT_RESVPORT 0x04000000 /* Use a reserved port (Bunk!!) */ #define NFSMNT_AUTOM 0x08000000 /* Done by autofs */ +#define NFSMNT_NOCTO 0x20000000 /* Don't flush attrcache on open */ #endif /* _NFSCLIENT_NFSARGS_H_ */ Modified: stable/8/sys/nfsclient/nfs_diskless.c ============================================================================== --- stable/8/sys/nfsclient/nfs_diskless.c Wed May 11 06:03:12 2011 (r221758) +++ stable/8/sys/nfsclient/nfs_diskless.c Wed May 11 07:33:06 2011 (r221759) @@ -103,6 +103,8 @@ nfs_parse_options(const char *envopts, s nd->flags |= NFSMNT_NOCONN; else if (strcmp(o, "nolockd") == 0) nd->flags |= NFSMNT_NOLOCKD; + else if (strcmp(o, "nocto") == 0) + nd->flags |= NFSMNT_NOCTO; else if (strcmp(o, "nfsv2") == 0) nd->flags &= ~(NFSMNT_NFSV3 | NFSMNT_NFSV4); else if (strcmp(o, "nfsv3") == 0) { Modified: stable/8/sys/nfsclient/nfs_vfsops.c ============================================================================== --- stable/8/sys/nfsclient/nfs_vfsops.c Wed May 11 06:03:12 2011 (r221758) +++ stable/8/sys/nfsclient/nfs_vfsops.c Wed May 11 07:33:06 2011 (r221759) @@ -781,7 +781,7 @@ static const char *nfs_opts[] = { "from" "readahead", "readdirsize", "soft", "hard", "mntudp", "tcp", "udp", "wsize", "rsize", "retrans", "acregmin", "acregmax", "acdirmin", "acdirmax", "deadthresh", "hostname", "timeout", "addr", "fh", "nfsv3", - "sec", "maxgroups", "principal", "negnametimeo", + "sec", "maxgroups", "principal", "negnametimeo", "nocto", NULL }; /* @@ -896,6 +896,8 @@ nfs_mount(struct mount *mp) args.sotype = SOCK_STREAM; if (vfs_getopt(mp->mnt_optnew, "nfsv3", NULL, NULL) == 0) args.flags |= NFSMNT_NFSV3; + if (vfs_getopt(mp->mnt_optnew, "nocto", NULL, NULL) == 0) + args.flags |= NFSMNT_NOCTO; if (vfs_getopt(mp->mnt_optnew, "readdirsize", (void **)&opt, NULL) == 0) { if (opt == NULL) { vfs_mount_error(mp, "illegal readdirsize"); Modified: stable/8/sys/nfsclient/nfs_vnops.c ============================================================================== --- stable/8/sys/nfsclient/nfs_vnops.c Wed May 11 06:03:12 2011 (r221758) +++ stable/8/sys/nfsclient/nfs_vnops.c Wed May 11 07:33:06 2011 (r221759) @@ -960,7 +960,8 @@ nfs_lookup(struct vop_lookup_args *ap) */ newvp = *vpp; newnp = VTONFS(newvp); - if ((flags & (ISLASTCN | ISOPEN)) == (ISLASTCN | ISOPEN) && + if (!(nmp->nm_flag & NFSMNT_NOCTO) && + (flags & (ISLASTCN | ISOPEN)) == (ISLASTCN | ISOPEN) && !(newnp->n_flag & NMODIFIED)) { mtx_lock(&newnp->n_mtx); newnp->n_attrstamp = 0; Modified: stable/8/sys/nfsclient/nfsargs.h ============================================================================== --- stable/8/sys/nfsclient/nfsargs.h Wed May 11 06:03:12 2011 (r221758) +++ stable/8/sys/nfsclient/nfsargs.h Wed May 11 07:33:06 2011 (r221759) @@ -93,5 +93,6 @@ struct nfs_args { #define NFSMNT_NOLOCKD 0x00400000 /* Locks are local */ #define NFSMNT_NFSV4 0x00800000 /* Use NFS Version 4 protocol */ #define NFSMNT_HASWRITEVERF 0x01000000 /* NFSv4 Write verifier */ +#define NFSMNT_NOCTO 0x20000000 /* Don't flush attrcache on open */ #endif From owner-svn-src-stable-8@FreeBSD.ORG Wed May 11 07:39:09 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 2FAE51065670; Wed, 11 May 2011 07:39:09 +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 1E50F8FC17; Wed, 11 May 2011 07:39:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4B7d9pN079446; Wed, 11 May 2011 07:39:09 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4B7d99L079444; Wed, 11 May 2011 07:39:09 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201105110739.p4B7d99L079444@svn.freebsd.org> From: Ruslan Ermilov Date: Wed, 11 May 2011 07:39: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: r221760 - stable/8/sys/fs/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: Wed, 11 May 2011 07:39:09 -0000 Author: ru Date: Wed May 11 07:39:08 2011 New Revision: 221760 URL: http://svn.freebsd.org/changeset/base/221760 Log: MFC r221429: In ncl_printf(), call vprintf() instead of printf(). Modified: stable/8/sys/fs/nfsclient/nfs_clsubs.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clsubs.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clsubs.c Wed May 11 07:33:06 2011 (r221759) +++ stable/8/sys/fs/nfsclient/nfs_clsubs.c Wed May 11 07:39:08 2011 (r221760) @@ -167,7 +167,7 @@ ncl_printf(const char *fmt, ...) mtx_lock(&Giant); va_start(ap, fmt); - printf(fmt, ap); + vprintf(fmt, ap); va_end(ap); mtx_unlock(&Giant); } From owner-svn-src-stable-8@FreeBSD.ORG Wed May 11 09:42:41 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 0BC1E1065670; Wed, 11 May 2011 09:42:41 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE7E28FC18; Wed, 11 May 2011 09:42:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4B9gerO083460; Wed, 11 May 2011 09:42:40 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4B9ger0083456; Wed, 11 May 2011 09:42:40 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201105110942.p4B9ger0083456@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Wed, 11 May 2011 09:42:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221764 - stable/8/lib/libfetch X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2011 09:42:41 -0000 Author: des Date: Wed May 11 09:42:40 2011 New Revision: 221764 URL: http://svn.freebsd.org/changeset/base/221764 Log: Sync with head: proxy authentication, SSL hang, cached connection crash. Modified: stable/8/lib/libfetch/common.c stable/8/lib/libfetch/ftp.c stable/8/lib/libfetch/http.c Directory Properties: stable/8/lib/libfetch/ (props changed) Modified: stable/8/lib/libfetch/common.c ============================================================================== --- stable/8/lib/libfetch/common.c Wed May 11 08:42:32 2011 (r221763) +++ stable/8/lib/libfetch/common.c Wed May 11 09:42:40 2011 (r221764) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -295,7 +296,8 @@ fetch_connect(const char *host, int port close(sd); continue; } - if (connect(sd, res->ai_addr, res->ai_addrlen) == 0) + if (connect(sd, res->ai_addr, res->ai_addrlen) == 0 && + fcntl(sd, F_SETFL, O_NONBLOCK) == 0) break; close(sd); } @@ -319,8 +321,9 @@ fetch_connect(const char *host, int port int fetch_ssl(conn_t *conn, int verbose) { - #ifdef WITH_SSL + int ret, ssl_err; + /* Init the SSL library and context */ if (!SSL_library_init()){ fprintf(stderr, "SSL library init failed\n"); @@ -339,9 +342,13 @@ fetch_ssl(conn_t *conn, int verbose) return (-1); } SSL_set_fd(conn->ssl, conn->sd); - if (SSL_connect(conn->ssl) == -1){ - ERR_print_errors_fp(stderr); - return (-1); + while ((ret = SSL_connect(conn->ssl)) == -1) { + ssl_err = SSL_get_error(conn->ssl, ret); + if (ssl_err != SSL_ERROR_WANT_READ && + ssl_err != SSL_ERROR_WANT_WRITE) { + ERR_print_errors_fp(stderr); + return (-1); + } } if (verbose) { @@ -370,6 +377,46 @@ fetch_ssl(conn_t *conn, int verbose) #endif } +#define FETCH_READ_WAIT -2 +#define FETCH_READ_ERROR -1 +#define FETCH_READ_DONE 0 + +#ifdef WITH_SSL +static ssize_t +fetch_ssl_read(SSL *ssl, char *buf, size_t len) +{ + ssize_t rlen; + int ssl_err; + + rlen = SSL_read(ssl, buf, len); + if (rlen < 0) { + ssl_err = SSL_get_error(ssl, rlen); + if (ssl_err == SSL_ERROR_WANT_READ || + ssl_err == SSL_ERROR_WANT_WRITE) { + return (FETCH_READ_WAIT); + } else { + ERR_print_errors_fp(stderr); + return (FETCH_READ_ERROR); + } + } + return (rlen); +} +#endif + +static ssize_t +fetch_socket_read(int sd, char *buf, size_t len) +{ + ssize_t rlen; + + rlen = read(sd, buf, len); + if (rlen < 0) { + if (errno == EAGAIN || (errno == EINTR && fetchRestartCalls)) + return (FETCH_READ_WAIT); + else + return (FETCH_READ_ERROR); + } + return (rlen); +} /* * Read a character from a connection w/ timeout @@ -390,6 +437,43 @@ fetch_read(conn_t *conn, char *buf, size total = 0; while (len > 0) { + /* + * The socket is non-blocking. Instead of the canonical + * select() -> read(), we do the following: + * + * 1) call read() or SSL_read(). + * 2) if an error occurred, return -1. + * 3) if we received data but we still expect more, + * update our counters and loop. + * 4) if read() or SSL_read() signaled EOF, return. + * 5) if we did not receive any data but we're not at EOF, + * call select(). + * + * In the SSL case, this is necessary because if we + * receive a close notification, we have to call + * SSL_read() one additional time after we've read + * everything we received. + * + * In the non-SSL case, it may improve performance (very + * slightly) when reading small amounts of data. + */ +#ifdef WITH_SSL + if (conn->ssl != NULL) + rlen = fetch_ssl_read(conn->ssl, buf, len); + else +#endif + rlen = fetch_socket_read(conn->sd, buf, len); + if (rlen == 0) { + break; + } else if (rlen > 0) { + len -= rlen; + buf += rlen; + total += rlen; + continue; + } else if (rlen == FETCH_READ_ERROR) { + return (-1); + } + // assert(rlen == FETCH_READ_WAIT); while (fetchTimeout && !FD_ISSET(conn->sd, &readfds)) { FD_SET(conn->sd, &readfds); gettimeofday(&now, NULL); @@ -413,22 +497,6 @@ fetch_read(conn_t *conn, char *buf, size return (-1); } } -#ifdef WITH_SSL - if (conn->ssl != NULL) - rlen = SSL_read(conn->ssl, buf, len); - else -#endif - rlen = read(conn->sd, buf, len); - if (rlen == 0) - break; - if (rlen < 0) { - if (errno == EINTR && fetchRestartCalls) - continue; - return (-1); - } - len -= rlen; - buf += rlen; - total += rlen; } return (total); } @@ -548,6 +616,7 @@ fetch_writev(conn_t *conn, struct iovec wlen = writev(conn->sd, iov, iovcnt); if (wlen == 0) { /* we consider a short write a failure */ + /* XXX perhaps we shouldn't in the SSL case */ errno = EPIPE; fetch_syserr(); return (-1); Modified: stable/8/lib/libfetch/ftp.c ============================================================================== --- stable/8/lib/libfetch/ftp.c Wed May 11 08:42:32 2011 (r221763) +++ stable/8/lib/libfetch/ftp.c Wed May 11 09:42:40 2011 (r221764) @@ -1132,6 +1132,7 @@ ftp_request(struct url *url, const char /* just a stat */ if (strcmp(op, "STAT") == 0) { + --conn->ref; ftp_disconnect(conn); return (FILE *)1; /* bogus return value */ } Modified: stable/8/lib/libfetch/http.c ============================================================================== --- stable/8/lib/libfetch/http.c Wed May 11 08:42:32 2011 (r221763) +++ stable/8/lib/libfetch/http.c Wed May 11 09:42:40 2011 (r221764) @@ -1786,12 +1786,14 @@ http_request(struct url *URL, const char case hdr_www_authenticate: if (conn->err != HTTP_NEED_AUTH) break; - http_parse_authenticate(p, &server_challenges); + if (http_parse_authenticate(p, &server_challenges) == 0) + ++n; break; case hdr_proxy_authenticate: if (conn->err != HTTP_NEED_PROXY_AUTH) break; - http_parse_authenticate(p, &proxy_challenges); + if (http_parse_authenticate(p, &proxy_challenges) == 0) + ++n; break; case hdr_end: /* fall through */ From owner-svn-src-stable-8@FreeBSD.ORG Wed May 11 09:48:15 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 CD052106564A; Wed, 11 May 2011 09:48:15 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A26178FC18; Wed, 11 May 2011 09:48:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4B9mFIL083818; Wed, 11 May 2011 09:48:15 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4B9mFIF083817; Wed, 11 May 2011 09:48:15 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201105110948.p4B9mFIF083817@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Wed, 11 May 2011 09:48:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221767 - stable/8/usr.bin/fetch 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, 11 May 2011 09:48:15 -0000 Author: des Date: Wed May 11 09:48:15 2011 New Revision: 221767 URL: http://svn.freebsd.org/changeset/base/221767 Log: Fix broken mergeinfo. Modified: Directory Properties: stable/8/usr.bin/fetch/ (props changed) From owner-svn-src-stable-8@FreeBSD.ORG Wed May 11 09:50: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 7DA891065758; Wed, 11 May 2011 09:50:34 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6D3158FC2D; Wed, 11 May 2011 09:50:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4B9oYCZ083949; Wed, 11 May 2011 09:50:34 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4B9oYRA083947; Wed, 11 May 2011 09:50:34 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201105110950.p4B9oYRA083947@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Wed, 11 May 2011 09:50:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221768 - stable/8/usr.bin/fetch 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, 11 May 2011 09:50:34 -0000 Author: des Date: Wed May 11 09:50:34 2011 New Revision: 221768 URL: http://svn.freebsd.org/changeset/base/221768 Log: Sync with head: WARNS, static linking. Modified: stable/8/usr.bin/fetch/Makefile Directory Properties: stable/8/usr.bin/fetch/ (props changed) Modified: stable/8/usr.bin/fetch/Makefile ============================================================================== --- stable/8/usr.bin/fetch/Makefile Wed May 11 09:48:15 2011 (r221767) +++ stable/8/usr.bin/fetch/Makefile Wed May 11 09:50:34 2011 (r221768) @@ -4,9 +4,8 @@ PROG= fetch CSTD?= c99 -WARNS?= 6 -DPADD= ${LIBFETCH} -LDADD= -lfetch +DPADD= ${LIBFETCH} ${LIBMD} +LDADD= -lfetch -lmd .if ${MK_OPENSSL} != "no" DPADD+= ${LIBSSL} ${LIBCRYPTO} LDADD+= -lssl -lcrypto From owner-svn-src-stable-8@FreeBSD.ORG Wed May 11 09:56:31 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 A8F4A1065674; Wed, 11 May 2011 09:56:31 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 988CF8FC1D; Wed, 11 May 2011 09:56:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4B9uVxP084286; Wed, 11 May 2011 09:56:31 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4B9uVAv084284; Wed, 11 May 2011 09:56:31 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201105110956.p4B9uVAv084284@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Wed, 11 May 2011 09:56:31 +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: r221771 - stable/8/usr.bin/fetch 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, 11 May 2011 09:56:31 -0000 Author: des Date: Wed May 11 09:56:31 2011 New Revision: 221771 URL: http://svn.freebsd.org/changeset/base/221771 Log: Partially revert previous commit - WARNS does not default to 6 as in head. Modified: stable/8/usr.bin/fetch/Makefile Modified: stable/8/usr.bin/fetch/Makefile ============================================================================== --- stable/8/usr.bin/fetch/Makefile Wed May 11 09:55:29 2011 (r221770) +++ stable/8/usr.bin/fetch/Makefile Wed May 11 09:56:31 2011 (r221771) @@ -4,6 +4,7 @@ PROG= fetch CSTD?= c99 +WARNS?= 6 DPADD= ${LIBFETCH} ${LIBMD} LDADD= -lfetch -lmd .if ${MK_OPENSSL} != "no" From owner-svn-src-stable-8@FreeBSD.ORG Wed May 11 19:06:09 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 CC95D106566C; Wed, 11 May 2011 19:06:09 +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 BC6C08FC13; Wed, 11 May 2011 19:06:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4BJ69Xh002511; Wed, 11 May 2011 19:06:09 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4BJ692Y002509; Wed, 11 May 2011 19:06:09 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <201105111906.p4BJ692Y002509@svn.freebsd.org> From: Maksim Yevmenkin Date: Wed, 11 May 2011 19:06:09 +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: r221787 - stable/8/usr.sbin/bluetooth/bthidd 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, 11 May 2011 19:06:09 -0000 Author: emax Date: Wed May 11 19:06:09 2011 New Revision: 221787 URL: http://svn.freebsd.org/changeset/base/221787 Log: MFC r221448 Encode horizontal scroll events (AC Pan) as button presses (bit 5 and 6) Submitted by: David Demelier demelier dot david at gmail dot com Modified: stable/8/usr.sbin/bluetooth/bthidd/hid.c Directory Properties: stable/8/usr.sbin/bluetooth/bthidd/ (props changed) Modified: stable/8/usr.sbin/bluetooth/bthidd/hid.c ============================================================================== --- stable/8/usr.sbin/bluetooth/bthidd/hid.c Wed May 11 18:58:56 2011 (r221786) +++ stable/8/usr.sbin/bluetooth/bthidd/hid.c Wed May 11 19:06:09 2011 (r221787) @@ -229,6 +229,17 @@ hid_interrupt(bthid_session_p s, uint8_t break; switch (usage) { + case HUC_AC_PAN: + /* Horizontal scroll */ + if (val < 0) + mouse_butt |= (1 << 5); + else + mouse_butt |= (1 << 6); + + mevents ++; + val = 0; + break; + case 0xb5: /* Scan Next Track */ val = 0x19; break; From owner-svn-src-stable-8@FreeBSD.ORG Thu May 12 01:22: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 26D5C1065674; Thu, 12 May 2011 01:22:24 +0000 (UTC) (envelope-from mlaier@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 162298FC1A; Thu, 12 May 2011 01:22:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4C1MNw8013755; Thu, 12 May 2011 01:22:23 GMT (envelope-from mlaier@svn.freebsd.org) Received: (from mlaier@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4C1MNO0013753; Thu, 12 May 2011 01:22:23 GMT (envelope-from mlaier@svn.freebsd.org) Message-Id: <201105120122.p4C1MNO0013753@svn.freebsd.org> From: Max Laier Date: Thu, 12 May 2011 01:22: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: r221795 - stable/8/sys/vm X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 01:22:24 -0000 Author: mlaier Date: Thu May 12 01:22:23 2011 New Revision: 221795 URL: http://svn.freebsd.org/changeset/base/221795 Log: MFH r221714: Another long standing vm bug found at Isilon: Fix a race between vm_object_collapse and vm_fault. Reviewed by: alc@ Modified: stable/8/sys/vm/vm_object.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/vm/vm_object.c ============================================================================== --- stable/8/sys/vm/vm_object.c Thu May 12 00:10:29 2011 (r221794) +++ stable/8/sys/vm/vm_object.c Thu May 12 01:22:23 2011 (r221795) @@ -1458,6 +1458,24 @@ vm_object_backing_scan(vm_object_t objec pp = vm_page_lookup(object, new_pindex); if ( + (op & OBSC_COLLAPSE_NOWAIT) != 0 && + (pp != NULL && pp->valid == 0) + ) { + /* + * The page in the parent is not (yet) valid. + * We don't know anything about the state of + * the original page. It might be mapped, + * so we must avoid the next if here. + * + * This is due to a race in vm_fault() where + * we must unbusy the original (backing_obj) + * page before we can (re)lock the parent. + * Hence we can get here. + */ + p = next; + continue; + } + if ( pp != NULL || vm_pager_has_page(object, new_pindex, NULL, NULL) ) { From owner-svn-src-stable-8@FreeBSD.ORG Thu May 12 01:46: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 619871065786; Thu, 12 May 2011 01:46:21 +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 50A9C8FC13; Thu, 12 May 2011 01:46:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4C1kLpn014616; Thu, 12 May 2011 01:46:21 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4C1kLuI014614; Thu, 12 May 2011 01:46:21 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201105120146.p4C1kLuI014614@svn.freebsd.org> From: Alexander Motin Date: Thu, 12 May 2011 01:46: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: r221797 - 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: Thu, 12 May 2011 01:46:21 -0000 Author: mav Date: Thu May 12 01:46:20 2011 New Revision: 221797 URL: http://svn.freebsd.org/changeset/base/221797 Log: MFC r221504: Add PCI ID for Marvell 88SE9182 -- PCIe 2.x x2 relative of the 88SE912x. 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 Thu May 12 01:38:42 2011 (r221796) +++ stable/8/sys/dev/ahci/ahci.c Thu May 12 01:46:20 2011 (r221797) @@ -184,6 +184,7 @@ static struct { {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}, + {0x91821b4b, 0x00, "Marvell 88SE9182", AHCI_Q_NOBSYRES}, {0x06201103, 0x00, "HighPoint RocketRAID 620", AHCI_Q_NOBSYRES}, {0x06201b4b, 0x00, "HighPoint RocketRAID 620", AHCI_Q_NOBSYRES}, {0x06221103, 0x00, "HighPoint RocketRAID 622", AHCI_Q_NOBSYRES}, From owner-svn-src-stable-8@FreeBSD.ORG Fri May 13 09:52:04 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 BFB38106566B; Fri, 13 May 2011 09:52:04 +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 AEF998FC12; Fri, 13 May 2011 09:52:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4D9q4io065972; Fri, 13 May 2011 09:52:04 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4D9q4lg065969; Fri, 13 May 2011 09:52:04 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201105130952.p4D9q4lg065969@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 13 May 2011 09:52: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: r221831 - 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: Fri, 13 May 2011 09:52:04 -0000 Author: ae Date: Fri May 13 09:52:04 2011 New Revision: 221831 URL: http://svn.freebsd.org/changeset/base/221831 Log: MFC r221521: Convert delay parameter back to ms when reporting to user. PR: 156838 Modified: stable/8/sys/netinet/ipfw/ip_dn_glue.c stable/8/sys/netinet/ipfw/ip_dummynet.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_dn_glue.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_dn_glue.c Fri May 13 07:21:41 2011 (r221830) +++ stable/8/sys/netinet/ipfw/ip_dn_glue.c Fri May 13 09:52:04 2011 (r221831) @@ -624,7 +624,7 @@ dn_c_copy_pipe(struct dn_schk *s, struct /* These 4 field are the same in pipe7 and pipe8 */ pipe7->next.sle_next = (struct dn_pipe7 *)DN_IS_PIPE; pipe7->bandwidth = l->bandwidth; - pipe7->delay = l->delay; + pipe7->delay = l->delay * 1000 / hz; pipe7->pipe_nr = l->link_nr - DN_MAX_ID; if (!is7) { Modified: stable/8/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_dummynet.c Fri May 13 07:21:41 2011 (r221830) +++ stable/8/sys/netinet/ipfw/ip_dummynet.c Fri May 13 09:52:04 2011 (r221831) @@ -807,6 +807,7 @@ copy_obj(char **start, char *end, void * /* Adjust burst parameter for link */ struct dn_link *l = (struct dn_link *)*start; l->burst = div64(l->burst, 8 * hz); + l->delay = l->delay * 1000 / hz; } else if (o->type == DN_SCH) { /* Set id->id to the number of instances */ struct dn_schk *s = _o; From owner-svn-src-stable-8@FreeBSD.ORG Fri May 13 18:20: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 EF6631065672; Fri, 13 May 2011 18:20:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D59B78FC13; Fri, 13 May 2011 18:20:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4DIKOCv078761; Fri, 13 May 2011 18:20:24 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4DIKORl078755; Fri, 13 May 2011 18:20:24 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201105131820.p4DIKORl078755@svn.freebsd.org> From: Warner Losh Date: Fri, 13 May 2011 18:20:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221849 - in stable/8/sys/modules: cryptodev dtrace/lockstat mqueue sysvipc/sysvmsg sysvipc/sysvsem 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, 13 May 2011 18:20:25 -0000 Author: imp Date: Fri May 13 18:20:24 2011 New Revision: 221849 URL: http://svn.freebsd.org/changeset/base/221849 Log: MFC: 197075, 209442, 213781: Various fixes for MODULES_WITH_WORLD r197075 | n_hibma | 2009-09-10 13:12:08 -0600 (Thu, 10 Sep 2009) | 4 lines Missing opt_*.h file reference for make depend in sys/modules r209442 | thompsa | 2010-06-22 14:52:35 -0600 (Tue, 22 Jun 2010) | 4 lines Add missing opt_compat.h dependency. r213781 | rpaulo | 2010-10-13 08:44:38 -0600 (Wed, 13 Oct 2010) | 2 lines Add opt_compat.h to SRCS. PR: 138341 Modified: stable/8/sys/modules/cryptodev/Makefile stable/8/sys/modules/dtrace/lockstat/Makefile stable/8/sys/modules/mqueue/Makefile stable/8/sys/modules/sysvipc/sysvmsg/Makefile stable/8/sys/modules/sysvipc/sysvsem/Makefile 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/modules/cryptodev/Makefile ============================================================================== --- stable/8/sys/modules/cryptodev/Makefile Fri May 13 17:50:30 2011 (r221848) +++ stable/8/sys/modules/cryptodev/Makefile Fri May 13 18:20:24 2011 (r221849) @@ -3,6 +3,6 @@ .PATH: ${.CURDIR}/../../opencrypto KMOD = cryptodev SRCS = cryptodev.c -SRCS += bus_if.h device_if.h +SRCS += bus_if.h device_if.h opt_compat.h .include Modified: stable/8/sys/modules/dtrace/lockstat/Makefile ============================================================================== --- stable/8/sys/modules/dtrace/lockstat/Makefile Fri May 13 17:50:30 2011 (r221848) +++ stable/8/sys/modules/dtrace/lockstat/Makefile Fri May 13 18:20:24 2011 (r221849) @@ -5,7 +5,7 @@ KMOD= lockstat SRCS= lockstat.c -SRCS+= vnode_if.h +SRCS+= vnode_if.h opt_kdtrace.h CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris \ -I${.CURDIR}/../../../cddl/contrib/opensolaris/uts/common \ Modified: stable/8/sys/modules/mqueue/Makefile ============================================================================== --- stable/8/sys/modules/mqueue/Makefile Fri May 13 17:50:30 2011 (r221848) +++ stable/8/sys/modules/mqueue/Makefile Fri May 13 18:20:24 2011 (r221849) @@ -5,6 +5,6 @@ KMOD= mqueuefs SRCS= uipc_mqueue.c \ vnode_if.h \ - opt_posix.h + opt_posix.h opt_compat.h .include Modified: stable/8/sys/modules/sysvipc/sysvmsg/Makefile ============================================================================== --- stable/8/sys/modules/sysvipc/sysvmsg/Makefile Fri May 13 17:50:30 2011 (r221848) +++ stable/8/sys/modules/sysvipc/sysvmsg/Makefile Fri May 13 18:20:24 2011 (r221849) @@ -3,6 +3,6 @@ .PATH: ${.CURDIR}/../../../kern KMOD= sysvmsg -SRCS= sysv_msg.c opt_sysvipc.h +SRCS= sysv_msg.c opt_sysvipc.h opt_compat.h .include Modified: stable/8/sys/modules/sysvipc/sysvsem/Makefile ============================================================================== --- stable/8/sys/modules/sysvipc/sysvsem/Makefile Fri May 13 17:50:30 2011 (r221848) +++ stable/8/sys/modules/sysvipc/sysvsem/Makefile Fri May 13 18:20:24 2011 (r221849) @@ -3,6 +3,6 @@ .PATH: ${.CURDIR}/../../../kern KMOD= sysvsem -SRCS= sysv_sem.c opt_sysvipc.h +SRCS= sysv_sem.c opt_sysvipc.h opt_compat.h .include From owner-svn-src-stable-8@FreeBSD.ORG Fri May 13 21:25: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 8CF0F106564A; Fri, 13 May 2011 21:25:14 +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 7CC768FC13; Fri, 13 May 2011 21:25:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4DLPEZ4082919; Fri, 13 May 2011 21:25:14 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4DLPEhP082917; Fri, 13 May 2011 21:25:14 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201105132125.p4DLPEhP082917@svn.freebsd.org> From: Navdeep Parhar Date: Fri, 13 May 2011 21:25: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: r221859 - 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: Fri, 13 May 2011 21:25:14 -0000 Author: np Date: Fri May 13 21:25:14 2011 New Revision: 221859 URL: http://svn.freebsd.org/changeset/base/221859 Log: MFC r221464: Always re-arm an iq's interrupt before leaving the handler. Modified: stable/8/sys/dev/cxgbe/t4_sge.c Modified: stable/8/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/8/sys/dev/cxgbe/t4_sge.c Fri May 13 20:58:48 2011 (r221858) +++ stable/8/sys/dev/cxgbe/t4_sge.c Fri May 13 21:25:14 2011 (r221859) @@ -499,11 +499,8 @@ t4_intr_fwd(void *arg) iq_next(iq); } - if (ndesc_total > 0) { - t4_write_reg(sc, MYPF_REG(A_SGE_PF_GTS), - V_CIDXINC(ndesc_pending) | V_INGRESSQID((u32)iq->cntxt_id) | - V_SEINTARM(iq->intr_params)); - } + t4_write_reg(sc, MYPF_REG(A_SGE_PF_GTS), V_CIDXINC(ndesc_pending) | + V_INGRESSQID((u32)iq->cntxt_id) | V_SEINTARM(iq->intr_params)); atomic_cmpset_32(&iq->state, IQS_BUSY, IQS_IDLE); } @@ -601,11 +598,8 @@ t4_evt_rx(void *arg) iq_next(iq); } - if (ndesc_total > 0) { - t4_write_reg(sc, MYPF_REG(A_SGE_PF_GTS), - V_CIDXINC(ndesc_pending) | V_INGRESSQID(iq->cntxt_id) | - V_SEINTARM(iq->intr_params)); - } + t4_write_reg(sc, MYPF_REG(A_SGE_PF_GTS), V_CIDXINC(ndesc_pending) | + V_INGRESSQID(iq->cntxt_id) | V_SEINTARM(iq->intr_params)); } void From owner-svn-src-stable-8@FreeBSD.ORG Fri May 13 22:48: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 D042B106564A; Fri, 13 May 2011 22:48:44 +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 BE04D8FC14; Fri, 13 May 2011 22:48:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4DMmibN084567; Fri, 13 May 2011 22:48:44 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4DMmiJc084561; Fri, 13 May 2011 22:48:44 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201105132248.p4DMmiJc084561@svn.freebsd.org> From: Navdeep Parhar Date: Fri, 13 May 2011 22:48: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: r221861 - in stable/8/sys: dev/cxgbe modules/cxgbe/if_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: Fri, 13 May 2011 22:48:44 -0000 Author: np Date: Fri May 13 22:48:44 2011 New Revision: 221861 URL: http://svn.freebsd.org/changeset/base/221861 Log: MFC r221474, r221477 (packet filter/steer/switch, timestamps) r221474: T4 packet filtering/steering. - Enable 5-tuple and every-packet lookup. - Setup the default filter mode to allow filtering/steering based on IP protocol, ingress port, inner VLAN ID, IP frag, FCoE, and MPS match type; all combined together. You can also filter based on MAC index, Ethernet type, IP TOS/IPv6 Traffic Class, and outer VLAN ID but you'll have to modify the default filter mode and exclude some of the match-fields in it. IPv4 and IPv6 SIP/DIP/SPORT/DPORT are always available in all filter rules. - Add driver ioctls to get/set the global filter mode. - Add driver ioctls to program and delete hardware filters. A couple of the "switch" actions that rewrite Ethernet and VLAN information and switch the packet out of another port may not work as the L2 code is not yet in place. Everything else, including all "drop" and "pass" rules with RSS or absolute qid, should work. r221477: T4 packet timestamps. Reference code that shows how to get a packet's timestamp out of cxgbe(4). Disabled by default because we don't have a standard way today to pass this information up the stack. The timestamp is 60 bits wide and each increment represents 1 tick of the T4's core clock. As an example, the timestamp granularity is ~4.4ns for this card: # sysctl dev.t4nex.0.core_clock dev.t4nex.0.core_clock: 228125 Modified: stable/8/sys/dev/cxgbe/offload.h stable/8/sys/dev/cxgbe/t4_ioctl.h stable/8/sys/dev/cxgbe/t4_main.c stable/8/sys/dev/cxgbe/t4_sge.c stable/8/sys/modules/cxgbe/if_cxgbe/Makefile 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/offload.h ============================================================================== --- stable/8/sys/dev/cxgbe/offload.h Fri May 13 22:35:06 2011 (r221860) +++ stable/8/sys/dev/cxgbe/offload.h Fri May 13 22:48:44 2011 (r221861) @@ -61,8 +61,10 @@ struct tid_info { union aopen_entry *atid_tab; unsigned int natids; + struct filter_entry *ftid_tab; unsigned int nftids; unsigned int ftid_base; + unsigned int ftids_in_use; union aopen_entry *afree; unsigned int atids_in_use; Modified: stable/8/sys/dev/cxgbe/t4_ioctl.h ============================================================================== --- stable/8/sys/dev/cxgbe/t4_ioctl.h Fri May 13 22:35:06 2011 (r221860) +++ stable/8/sys/dev/cxgbe/t4_ioctl.h Fri May 13 22:48:44 2011 (r221861) @@ -31,6 +31,9 @@ #ifndef __T4_IOCTL_H__ #define __T4_IOCTL_H__ +#include +#include + /* * Ioctl commands specific to this driver. */ @@ -38,6 +41,11 @@ enum { T4_GETREG = 0x40, /* read register */ T4_SETREG, /* write register */ T4_REGDUMP, /* dump of all registers */ + T4_GET_FILTER_MODE, /* get global filter mode */ + T4_SET_FILTER_MODE, /* set global filter mode */ + T4_GET_FILTER, /* get information about a filter */ + T4_SET_FILTER, /* program a filter */ + T4_DEL_FILTER, /* delete a filter */ }; struct t4_reg { @@ -53,7 +61,133 @@ struct t4_regdump { uint32_t *data; }; +/* + * A hardware filter is some valid combination of these. + */ +#define T4_FILTER_IPv4 0x1 /* IPv4 packet */ +#define T4_FILTER_IPv6 0x2 /* IPv6 packet */ +#define T4_FILTER_IP_SADDR 0x4 /* Source IP address or network */ +#define T4_FILTER_IP_DADDR 0x8 /* Destination IP address or network */ +#define T4_FILTER_IP_SPORT 0x10 /* Source IP port */ +#define T4_FILTER_IP_DPORT 0x20 /* Destination IP port */ +#define T4_FILTER_FCoE 0x40 /* Fibre Channel over Ethernet packet */ +#define T4_FILTER_PORT 0x80 /* Physical ingress port */ +#define T4_FILTER_OVLAN 0x100 /* Outer VLAN ID */ +#define T4_FILTER_IVLAN 0x200 /* Inner VLAN ID */ +#define T4_FILTER_IP_TOS 0x400 /* IPv4 TOS/IPv6 Traffic Class */ +#define T4_FILTER_IP_PROTO 0x800 /* IP protocol */ +#define T4_FILTER_ETH_TYPE 0x1000 /* Ethernet Type */ +#define T4_FILTER_MAC_IDX 0x2000 /* MPS MAC address match index */ +#define T4_FILTER_MPS_HIT_TYPE 0x4000 /* MPS match type */ +#define T4_FILTER_IP_FRAGMENT 0x8000 /* IP fragment */ + +/* Filter action */ +enum { + FILTER_PASS = 0, /* default */ + FILTER_DROP, + FILTER_SWITCH +}; + +/* 802.1q manipulation on FILTER_SWITCH */ +enum { + VLAN_NOCHANGE = 0, /* default */ + VLAN_REMOVE, + VLAN_INSERT, + VLAN_REWRITE +}; + +/* MPS match type */ +enum { + UCAST_EXACT = 0, /* exact unicast match */ + UCAST_HASH = 1, /* inexact (hashed) unicast match */ + MCAST_EXACT = 2, /* exact multicast match */ + MCAST_HASH = 3, /* inexact (hashed) multicast match */ + PROMISC = 4, /* no match but port is promiscuous */ + HYPPROMISC = 5, /* port is hypervisor-promisuous + not bcast */ + BCAST = 6, /* broadcast packet */ +}; + +/* Rx steering */ +enum { + DST_MODE_QUEUE, /* queue is directly specified by filter */ + DST_MODE_RSS_QUEUE, /* filter specifies RSS entry containing queue */ + DST_MODE_RSS, /* queue selected by default RSS hash lookup */ + DST_MODE_FILT_RSS /* queue selected by hashing in filter-specified + RSS subtable */ +}; + +struct t4_filter_tuple { + /* + * These are always available. + */ + uint8_t sip[16]; /* source IP address (IPv4 in [3:0]) */ + uint8_t dip[16]; /* destinatin IP address (IPv4 in [3:0]) */ + uint16_t sport; /* source port */ + uint16_t dport; /* destination port */ + + /* + * A combination of these (upto 36 bits) is available. TP_VLAN_PRI_MAP + * is used to select the global mode and all filters are limited to the + * set of fields allowed by the global mode. + */ + uint16_t ovlan; /* outer VLAN */ + uint16_t ivlan; /* inner VLAN */ + uint16_t ethtype; /* Ethernet type */ + uint8_t tos; /* TOS/Traffic Type */ + uint8_t proto; /* protocol type */ + uint32_t fcoe:1; /* FCoE packet */ + uint32_t iport:3; /* ingress port */ + uint32_t matchtype:3; /* MPS match type */ + uint32_t frag:1; /* fragmentation extension header */ + uint32_t macidx:9; /* exact match MAC index */ + uint32_t ivlan_vld:1; /* inner VLAN valid */ + uint32_t ovlan_vld:1; /* outer VLAN valid */ +}; + +struct t4_filter_specification { + uint32_t hitcnts:1; /* count filter hits in TCB */ + uint32_t prio:1; /* filter has priority over active/server */ + uint32_t type:1; /* 0 => IPv4, 1 => IPv6 */ + uint32_t action:2; /* drop, pass, switch */ + uint32_t rpttid:1; /* report TID in RSS hash field */ + uint32_t dirsteer:1; /* 0 => RSS, 1 => steer to iq */ + uint32_t iq:10; /* ingress queue */ + uint32_t maskhash:1; /* dirsteer=0: store RSS hash in TCB */ + uint32_t dirsteerhash:1;/* dirsteer=1: 0 => TCB contains RSS hash */ + /* 1 => TCB contains IQ ID */ + + /* + * Switch proxy/rewrite fields. An ingress packet which matches a + * filter with "switch" set will be looped back out as an egress + * packet -- potentially with some Ethernet header rewriting. + */ + uint32_t eport:2; /* egress port to switch packet out */ + uint32_t newdmac:1; /* rewrite destination MAC address */ + uint32_t newsmac:1; /* rewrite source MAC address */ + uint32_t newvlan:2; /* rewrite VLAN Tag */ + uint8_t dmac[ETHER_ADDR_LEN]; /* new destination MAC address */ + uint8_t smac[ETHER_ADDR_LEN]; /* new source MAC address */ + uint16_t vlan; /* VLAN Tag to insert */ + + /* + * Filter rule value/mask pairs. + */ + struct t4_filter_tuple val; + struct t4_filter_tuple mask; +}; + +struct t4_filter { + uint32_t idx; + uint64_t hits; + struct t4_filter_specification fs; +}; + #define CHELSIO_T4_GETREG _IOWR('f', T4_GETREG, struct t4_reg) #define CHELSIO_T4_SETREG _IOW('f', T4_SETREG, struct t4_reg) #define CHELSIO_T4_REGDUMP _IOWR('f', T4_REGDUMP, struct t4_regdump) +#define CHELSIO_T4_GET_FILTER_MODE _IOWR('f', T4_GET_FILTER_MODE, uint32_t) +#define CHELSIO_T4_SET_FILTER_MODE _IOW('f', T4_SET_FILTER_MODE, uint32_t) +#define CHELSIO_T4_GET_FILTER _IOWR('f', T4_GET_FILTER, struct t4_filter) +#define CHELSIO_T4_SET_FILTER _IOW('f', T4_SET_FILTER, struct t4_filter) +#define CHELSIO_T4_DEL_FILTER _IOW('f', T4_DEL_FILTER, struct t4_filter) #endif Modified: stable/8/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/8/sys/dev/cxgbe/t4_main.c Fri May 13 22:35:06 2011 (r221860) +++ stable/8/sys/dev/cxgbe/t4_main.c Fri May 13 22:48:44 2011 (r221861) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include "common/t4_hw.h" #include "common/common.h" +#include "common/t4_msg.h" #include "common/t4_regs.h" #include "common/t4_regs_values.h" #include "common/t4fw_interface.h" @@ -218,6 +219,11 @@ TUNABLE_INT("hw.cxgbe.interrupt_forwardi SYSCTL_UINT(_hw_cxgbe, OID_AUTO, interrupt_forwarding, CTLFLAG_RDTUN, &intr_fwd, 0, "always use forwarded interrupts"); +static unsigned int filter_mode = HW_TPL_FR_MT_PR_IV_P_FC; +TUNABLE_INT("hw.cxgbe.filter_mode", &filter_mode); +SYSCTL_UINT(_hw_cxgbe, OID_AUTO, filter_mode, CTLFLAG_RDTUN, + &filter_mode, 0, "default global filter mode."); + struct intrs_and_queues { int intr_type; /* INTx, MSI, or MSI-X */ int nirq; /* Number of vectors */ @@ -228,6 +234,15 @@ struct intrs_and_queues { int nrxq1g; /* # of NIC rxq's for each 1G port */ }; +struct filter_entry { + uint32_t valid:1; /* filter allocated and valid */ + uint32_t locked:1; /* filter is administratively locked */ + uint32_t pending:1; /* filter action is pending firmware reply */ + uint32_t smtidx:8; /* Source MAC Table index for smac */ + + struct t4_filter_specification fs; +}; + enum { MEMWIN0_APERTURE = 2048, MEMWIN0_BASE = 0x1b800, @@ -280,6 +295,18 @@ static int sysctl_qsize_rxq(SYSCTL_HANDL static int sysctl_qsize_txq(SYSCTL_HANDLER_ARGS); static int sysctl_handle_t4_reg64(SYSCTL_HANDLER_ARGS); static inline void txq_start(struct ifnet *, struct sge_txq *); +static uint32_t fconf_to_mode(uint32_t); +static uint32_t mode_to_fconf(uint32_t); +static uint32_t fspec_to_fconf(struct t4_filter_specification *); +static int get_filter_mode(struct adapter *, uint32_t *); +static int set_filter_mode(struct adapter *, uint32_t); +static int get_filter(struct adapter *, struct t4_filter *); +static int set_filter(struct adapter *, struct t4_filter *); +static int del_filter(struct adapter *, struct t4_filter *); +static void clear_filter(struct adapter *, struct filter_entry *); +static int set_filter_wr(struct adapter *, int); +static int del_filter_wr(struct adapter *, int); +void filter_rpl(struct adapter *, const struct cpl_set_tcb_rpl *); static int t4_mod_event(module_t, int, void *); struct t4_pciids { @@ -421,9 +448,12 @@ t4_attach(device_t dev) t4_sge_init(sc); - /* - * XXX: This is the place to call t4_set_filter_mode() - */ + t4_set_filter_mode(sc, filter_mode); + t4_set_reg_field(sc, A_TP_GLOBAL_CONFIG, + V_FIVETUPLELOOKUP(M_FIVETUPLELOOKUP), + V_FIVETUPLELOOKUP(M_FIVETUPLELOOKUP)); + t4_tp_wr_bits_indirect(sc, A_TP_INGRESS_CONFIG, F_CSUM_HAS_PSEUDO_HDR, + F_LOOKUPEVERYPKT); /* get basic stuff going */ rc = -t4_early_init(sc, sc->mbox); @@ -661,6 +691,7 @@ t4_detach(device_t dev) free(sc->sge.fiq, M_CXGBE); free(sc->sge.iqmap, M_CXGBE); free(sc->sge.eqmap, M_CXGBE); + free(sc->tids.ftid_tab, M_CXGBE); t4_destroy_dma_tag(sc); mtx_destroy(&sc->sc_lock); @@ -2699,6 +2730,481 @@ cxgbe_txq_start(void *arg, int count) TXQ_UNLOCK(txq); } +static uint32_t +fconf_to_mode(uint32_t fconf) +{ + uint32_t mode; + + mode = T4_FILTER_IPv4 | T4_FILTER_IPv6 | T4_FILTER_IP_SADDR | + T4_FILTER_IP_DADDR | T4_FILTER_IP_SPORT | T4_FILTER_IP_DPORT; + + if (fconf & F_FRAGMENTATION) + mode |= T4_FILTER_IP_FRAGMENT; + + if (fconf & F_MPSHITTYPE) + mode |= T4_FILTER_MPS_HIT_TYPE; + + if (fconf & F_MACMATCH) + mode |= T4_FILTER_MAC_IDX; + + if (fconf & F_ETHERTYPE) + mode |= T4_FILTER_ETH_TYPE; + + if (fconf & F_PROTOCOL) + mode |= T4_FILTER_IP_PROTO; + + if (fconf & F_TOS) + mode |= T4_FILTER_IP_TOS; + + if (fconf & F_VLAN) + mode |= T4_FILTER_IVLAN; + + if (fconf & F_VNIC_ID) + mode |= T4_FILTER_OVLAN; + + if (fconf & F_PORT) + mode |= T4_FILTER_PORT; + + if (fconf & F_FCOE) + mode |= T4_FILTER_FCoE; + + return (mode); +} + +static uint32_t +mode_to_fconf(uint32_t mode) +{ + uint32_t fconf = 0; + + if (mode & T4_FILTER_IP_FRAGMENT) + fconf |= F_FRAGMENTATION; + + if (mode & T4_FILTER_MPS_HIT_TYPE) + fconf |= F_MPSHITTYPE; + + if (mode & T4_FILTER_MAC_IDX) + fconf |= F_MACMATCH; + + if (mode & T4_FILTER_ETH_TYPE) + fconf |= F_ETHERTYPE; + + if (mode & T4_FILTER_IP_PROTO) + fconf |= F_PROTOCOL; + + if (mode & T4_FILTER_IP_TOS) + fconf |= F_TOS; + + if (mode & T4_FILTER_IVLAN) + fconf |= F_VLAN; + + if (mode & T4_FILTER_OVLAN) + fconf |= F_VNIC_ID; + + if (mode & T4_FILTER_PORT) + fconf |= F_PORT; + + if (mode & T4_FILTER_FCoE) + fconf |= F_FCOE; + + return (fconf); +} + +static uint32_t +fspec_to_fconf(struct t4_filter_specification *fs) +{ + uint32_t fconf = 0; + + if (fs->val.frag || fs->mask.frag) + fconf |= F_FRAGMENTATION; + + if (fs->val.matchtype || fs->mask.matchtype) + fconf |= F_MPSHITTYPE; + + if (fs->val.macidx || fs->mask.macidx) + fconf |= F_MACMATCH; + + if (fs->val.ethtype || fs->mask.ethtype) + fconf |= F_ETHERTYPE; + + if (fs->val.proto || fs->mask.proto) + fconf |= F_PROTOCOL; + + if (fs->val.tos || fs->mask.tos) + fconf |= F_TOS; + + if (fs->val.ivlan_vld || fs->mask.ivlan_vld) + fconf |= F_VLAN; + + if (fs->val.ovlan_vld || fs->mask.ovlan_vld) + fconf |= F_VNIC_ID; + + if (fs->val.iport || fs->mask.iport) + fconf |= F_PORT; + + if (fs->val.fcoe || fs->mask.fcoe) + fconf |= F_FCOE; + + return (fconf); +} + +static int +get_filter_mode(struct adapter *sc, uint32_t *mode) +{ + uint32_t fconf; + + t4_read_indirect(sc, A_TP_PIO_ADDR, A_TP_PIO_DATA, &fconf, 1, + A_TP_VLAN_PRI_MAP); + + *mode = fconf_to_mode(fconf); + + return (0); +} + +static int +set_filter_mode(struct adapter *sc, uint32_t mode) +{ + uint32_t fconf; + int rc; + + fconf = mode_to_fconf(mode); + + ADAPTER_LOCK(sc); + if (IS_BUSY(sc)) { + rc = EAGAIN; + goto done; + } + + if (sc->tids.ftids_in_use > 0) { + rc = EBUSY; + goto done; + } + + rc = -t4_set_filter_mode(sc, fconf); +done: + ADAPTER_UNLOCK(sc); + return (rc); +} + +static int +get_filter(struct adapter *sc, struct t4_filter *t) +{ + int i, nfilters = sc->tids.nftids; + struct filter_entry *f; + + ADAPTER_LOCK_ASSERT_OWNED(sc); + + if (IS_BUSY(sc)) + return (EAGAIN); + + if (sc->tids.ftids_in_use == 0 || sc->tids.ftid_tab == NULL || + t->idx >= nfilters) { + t->idx = 0xffffffff; + return (0); + } + + f = &sc->tids.ftid_tab[t->idx]; + for (i = t->idx; i < nfilters; i++, f++) { + if (f->valid) { + t->idx = i; + t->fs = f->fs; + t->hits = 0; /* XXX implement */ + + return (0); + } + } + + t->idx = 0xffffffff; + return (0); +} + +static int +set_filter(struct adapter *sc, struct t4_filter *t) +{ + uint32_t fconf; + unsigned int nfilters, nports; + struct filter_entry *f; + int i; + + ADAPTER_LOCK_ASSERT_OWNED(sc); + + nfilters = sc->tids.nftids; + nports = sc->params.nports; + + if (nfilters == 0) + return (ENOTSUP); + + if (!(sc->flags & FULL_INIT_DONE)) + return (EAGAIN); + + if (t->idx >= nfilters) + return (EINVAL); + + /* Validate against the global filter mode */ + t4_read_indirect(sc, A_TP_PIO_ADDR, A_TP_PIO_DATA, &fconf, 1, + A_TP_VLAN_PRI_MAP); + if ((fconf | fspec_to_fconf(&t->fs)) != fconf) + return (E2BIG); + + if (t->fs.action == FILTER_SWITCH && t->fs.eport >= nports) + return (EINVAL); + + if (t->fs.val.iport >= nports) + return (EINVAL); + + /* Can't specify an iq if not steering to it */ + if (!t->fs.dirsteer && t->fs.iq) + return (EINVAL); + + /* IPv6 filter idx must be 4 aligned */ + if (t->fs.type == 1 && + ((t->idx & 0x3) || t->idx + 4 >= nfilters)) + return (EINVAL); + + if (sc->tids.ftid_tab == NULL) { + KASSERT(sc->tids.ftids_in_use == 0, + ("%s: no memory allocated but filters_in_use > 0", + __func__)); + + sc->tids.ftid_tab = malloc(sizeof (struct filter_entry) * + nfilters, M_CXGBE, M_NOWAIT | M_ZERO); + if (sc->tids.ftid_tab == NULL) + return (ENOMEM); + } + + for (i = 0; i < 4; i++) { + f = &sc->tids.ftid_tab[t->idx + i]; + + if (f->pending || f->valid) + return (EBUSY); + if (f->locked) + return (EPERM); + + if (t->fs.type == 0) + break; + } + + f = &sc->tids.ftid_tab[t->idx]; + f->fs = t->fs; + + return set_filter_wr(sc, t->idx); +} + +static int +del_filter(struct adapter *sc, struct t4_filter *t) +{ + unsigned int nfilters; + struct filter_entry *f; + + ADAPTER_LOCK_ASSERT_OWNED(sc); + + if (IS_BUSY(sc)) + return (EAGAIN); + + nfilters = sc->tids.nftids; + + if (nfilters == 0) + return (ENOTSUP); + + if (sc->tids.ftid_tab == NULL || sc->tids.ftids_in_use == 0 || + t->idx >= nfilters) + return (EINVAL); + + if (!(sc->flags & FULL_INIT_DONE)) + return (EAGAIN); + + f = &sc->tids.ftid_tab[t->idx]; + + if (f->pending) + return (EBUSY); + if (f->locked) + return (EPERM); + + if (f->valid) { + t->fs = f->fs; /* extra info for the caller */ + return del_filter_wr(sc, t->idx); + } + + return (0); +} + +/* XXX: L2T */ +static void +clear_filter(struct adapter *sc, struct filter_entry *f) +{ + (void) sc; + bzero(f, sizeof (*f)); +} + +static int +set_filter_wr(struct adapter *sc, int fidx) +{ + int rc; + struct filter_entry *f = &sc->tids.ftid_tab[fidx]; + struct mbuf *m; + struct fw_filter_wr *fwr; + unsigned int ftid; + + ADAPTER_LOCK_ASSERT_OWNED(sc); + + if (f->fs.newdmac || f->fs.newvlan) + return (ENOTSUP); /* XXX: fix after L2T code */ + + ftid = sc->tids.ftid_base + fidx; + + m = m_gethdr(M_NOWAIT, MT_DATA); + if (m == NULL) + return (ENOMEM); + + fwr = mtod(m, struct fw_filter_wr *); + m->m_len = m->m_pkthdr.len = sizeof(*fwr); + bzero(fwr, sizeof (*fwr)); + + fwr->op_pkd = htobe32(V_FW_WR_OP(FW_FILTER_WR)); + fwr->len16_pkd = htobe32(FW_LEN16(*fwr)); + fwr->tid_to_iq = + htobe32(V_FW_FILTER_WR_TID(ftid) | + V_FW_FILTER_WR_RQTYPE(f->fs.type) | + V_FW_FILTER_WR_NOREPLY(0) | + V_FW_FILTER_WR_IQ(f->fs.iq)); + fwr->del_filter_to_l2tix = + htobe32(V_FW_FILTER_WR_RPTTID(f->fs.rpttid) | + V_FW_FILTER_WR_DROP(f->fs.action == FILTER_DROP) | + V_FW_FILTER_WR_DIRSTEER(f->fs.dirsteer) | + V_FW_FILTER_WR_MASKHASH(f->fs.maskhash) | + V_FW_FILTER_WR_DIRSTEERHASH(f->fs.dirsteerhash) | + V_FW_FILTER_WR_LPBK(f->fs.action == FILTER_SWITCH) | + V_FW_FILTER_WR_DMAC(f->fs.newdmac) | + V_FW_FILTER_WR_SMAC(f->fs.newsmac) | + V_FW_FILTER_WR_INSVLAN(f->fs.newvlan == VLAN_INSERT || + f->fs.newvlan == VLAN_REWRITE) | + V_FW_FILTER_WR_RMVLAN(f->fs.newvlan == VLAN_REMOVE || + f->fs.newvlan == VLAN_REWRITE) | + V_FW_FILTER_WR_HITCNTS(f->fs.hitcnts) | + V_FW_FILTER_WR_TXCHAN(f->fs.eport) | + V_FW_FILTER_WR_PRIO(f->fs.prio) | + V_FW_FILTER_WR_L2TIX(0)); /* XXX: L2T */ + fwr->ethtype = htobe16(f->fs.val.ethtype); + fwr->ethtypem = htobe16(f->fs.mask.ethtype); + fwr->frag_to_ovlan_vldm = + (V_FW_FILTER_WR_FRAG(f->fs.val.frag) | + V_FW_FILTER_WR_FRAGM(f->fs.mask.frag) | + V_FW_FILTER_WR_IVLAN_VLD(f->fs.val.ivlan_vld) | + V_FW_FILTER_WR_OVLAN_VLD(f->fs.val.ovlan_vld) | + V_FW_FILTER_WR_IVLAN_VLDM(f->fs.mask.ivlan_vld) | + V_FW_FILTER_WR_OVLAN_VLDM(f->fs.mask.ovlan_vld)); + fwr->smac_sel = 0; + fwr->rx_chan_rx_rpl_iq = htobe16(V_FW_FILTER_WR_RX_CHAN(0) | + V_FW_FILTER_WR_RX_RPL_IQ(sc->sge.fwq.abs_id)); + fwr->maci_to_matchtypem = + htobe32(V_FW_FILTER_WR_MACI(f->fs.val.macidx) | + V_FW_FILTER_WR_MACIM(f->fs.mask.macidx) | + V_FW_FILTER_WR_FCOE(f->fs.val.fcoe) | + V_FW_FILTER_WR_FCOEM(f->fs.mask.fcoe) | + V_FW_FILTER_WR_PORT(f->fs.val.iport) | + V_FW_FILTER_WR_PORTM(f->fs.mask.iport) | + V_FW_FILTER_WR_MATCHTYPE(f->fs.val.matchtype) | + V_FW_FILTER_WR_MATCHTYPEM(f->fs.mask.matchtype)); + fwr->ptcl = f->fs.val.proto; + fwr->ptclm = f->fs.mask.proto; + fwr->ttyp = f->fs.val.tos; + fwr->ttypm = f->fs.mask.tos; + fwr->ivlan = htobe16(f->fs.val.ivlan); + fwr->ivlanm = htobe16(f->fs.mask.ivlan); + fwr->ovlan = htobe16(f->fs.val.ovlan); + fwr->ovlanm = htobe16(f->fs.mask.ovlan); + bcopy(f->fs.val.dip, fwr->lip, sizeof (fwr->lip)); + bcopy(f->fs.mask.dip, fwr->lipm, sizeof (fwr->lipm)); + bcopy(f->fs.val.sip, fwr->fip, sizeof (fwr->fip)); + bcopy(f->fs.mask.sip, fwr->fipm, sizeof (fwr->fipm)); + fwr->lp = htobe16(f->fs.val.dport); + fwr->lpm = htobe16(f->fs.mask.dport); + fwr->fp = htobe16(f->fs.val.sport); + fwr->fpm = htobe16(f->fs.mask.sport); + if (f->fs.newsmac) + bcopy(f->fs.smac, fwr->sma, sizeof (fwr->sma)); + + f->pending = 1; + sc->tids.ftids_in_use++; + rc = t4_mgmt_tx(sc, m); + if (rc != 0) { + sc->tids.ftids_in_use--; + m_freem(m); + clear_filter(sc, f); + } + return (rc); +} + +static int +del_filter_wr(struct adapter *sc, int fidx) +{ + struct filter_entry *f = &sc->tids.ftid_tab[fidx]; + struct mbuf *m; + struct fw_filter_wr *fwr; + unsigned int rc, ftid; + + ADAPTER_LOCK_ASSERT_OWNED(sc); + + ftid = sc->tids.ftid_base + fidx; + + m = m_gethdr(M_NOWAIT, MT_DATA); + if (m == NULL) + return (ENOMEM); + + fwr = mtod(m, struct fw_filter_wr *); + m->m_len = m->m_pkthdr.len = sizeof(*fwr); + bzero(fwr, sizeof (*fwr)); + + t4_mk_filtdelwr(ftid, fwr, sc->sge.fwq.abs_id); + + f->pending = 1; + rc = t4_mgmt_tx(sc, m); + if (rc != 0) { + f->pending = 0; + m_freem(m); + } + return (rc); +} + +/* XXX move intr handlers to main.c and make this static */ +void +filter_rpl(struct adapter *sc, const struct cpl_set_tcb_rpl *rpl) +{ + unsigned int idx = GET_TID(rpl); + + if (idx >= sc->tids.ftid_base && + (idx -= sc->tids.ftid_base) < sc->tids.nftids) { + unsigned int rc = G_COOKIE(rpl->cookie); + struct filter_entry *f = &sc->tids.ftid_tab[idx]; + + if (rc == FW_FILTER_WR_FLT_DELETED) { + /* + * Clear the filter when we get confirmation from the + * hardware that the filter has been deleted. + */ + clear_filter(sc, f); + sc->tids.ftids_in_use--; + } else if (rc == FW_FILTER_WR_SMT_TBL_FULL) { + device_printf(sc->dev, + "filter %u setup failed due to full SMT\n", idx); + clear_filter(sc, f); + sc->tids.ftids_in_use--; + } else if (rc == FW_FILTER_WR_FLT_ADDED) { + f->smtidx = (be64toh(rpl->oldval) >> 24) & 0xff; + f->pending = 0; /* asynchronous setup completed */ + f->valid = 1; + } else { + /* + * Something went wrong. Issue a warning about the + * problem and clear everything out. + */ + device_printf(sc->dev, + "filter %u setup failed with error %u\n", idx, rc); + clear_filter(sc, f); + sc->tids.ftids_in_use--; + } + } +} + int t4_os_find_pci_capability(struct adapter *sc, int cap) { @@ -2873,6 +3379,27 @@ t4_ioctl(struct cdev *dev, unsigned long free(buf, M_CXGBE); break; } + case CHELSIO_T4_GET_FILTER_MODE: + rc = get_filter_mode(sc, (uint32_t *)data); + break; + case CHELSIO_T4_SET_FILTER_MODE: + rc = set_filter_mode(sc, *(uint32_t *)data); + break; + case CHELSIO_T4_GET_FILTER: + ADAPTER_LOCK(sc); + rc = get_filter(sc, (struct t4_filter *)data); + ADAPTER_UNLOCK(sc); + break; + case CHELSIO_T4_SET_FILTER: + ADAPTER_LOCK(sc); + rc = set_filter(sc, (struct t4_filter *)data); + ADAPTER_UNLOCK(sc); + break; + case CHELSIO_T4_DEL_FILTER: + ADAPTER_LOCK(sc); + rc = del_filter(sc, (struct t4_filter *)data); + ADAPTER_UNLOCK(sc); + break; default: rc = EINVAL; } Modified: stable/8/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/8/sys/dev/cxgbe/t4_sge.c Fri May 13 22:35:06 2011 (r221860) +++ stable/8/sys/dev/cxgbe/t4_sge.c Fri May 13 22:48:44 2011 (r221861) @@ -142,6 +142,8 @@ static int handle_sge_egr_update(struct static int ctrl_tx(struct adapter *, struct sge_ctrlq *, struct mbuf *); +extern void filter_rpl(struct adapter *, const struct cpl_set_tcb_rpl *); + /* * Called on MOD_LOAD and fills up fl_buf_info[]. */ @@ -580,7 +582,9 @@ t4_evt_rx(void *arg) case CPL_SGE_EGR_UPDATE: handle_sge_egr_update(sc, (const void *)(rss + 1)); break; - + case CPL_SET_TCB_RPL: + filter_rpl(sc, (const void *) (rss + 1)); + break; default: device_printf(sc->dev, "can't handle CPL opcode %d.", rss->opcode); @@ -602,6 +606,12 @@ t4_evt_rx(void *arg) V_INGRESSQID(iq->cntxt_id) | V_SEINTARM(iq->intr_params)); } +#ifdef T4_PKT_TIMESTAMP +#define RX_COPY_THRESHOLD (MINCLSIZE - 8) +#else +#define RX_COPY_THRESHOLD MINCLSIZE +#endif + void t4_eth_rx(void *arg) { @@ -665,7 +675,22 @@ t4_eth_rx(void *arg) BUS_DMASYNC_POSTREAD); m_init(m0, NULL, 0, M_NOWAIT, MT_DATA, M_PKTHDR); - if (len < MINCLSIZE) { + +#ifdef T4_PKT_TIMESTAMP + *mtod(m0, uint64_t *) = + be64toh(ctrl->u.last_flit & 0xfffffffffffffff); + m0->m_data += 8; + + /* + * 60 bit timestamp value is *(uint64_t *)m0->m_pktdat. Note + * that it is in the leading free-space (see M_LEADINGSPACE) in + * the mbuf. The kernel can clobber it during a pullup, + * m_copymdata, etc. You need to make sure that the mbuf + * reaches you unmolested if you care about the timestamp. + */ +#endif + + if (len < RX_COPY_THRESHOLD) { /* copy data to mbuf, buffer will be recycled */ bcopy(sd->cl, mtod(m0, caddr_t), len); m0->m_len = len; Modified: stable/8/sys/modules/cxgbe/if_cxgbe/Makefile ============================================================================== --- stable/8/sys/modules/cxgbe/if_cxgbe/Makefile Fri May 13 22:35:06 2011 (r221860) +++ stable/8/sys/modules/cxgbe/if_cxgbe/Makefile Fri May 13 22:48:44 2011 (r221861) @@ -13,4 +13,7 @@ SRCS+= opt_inet.h CFLAGS+= -I${CXGBE} +# Provide the timestamp of a packet in its header mbuf. +#CFLAGS+= -DT4_PKT_TIMESTAMP + .include From owner-svn-src-stable-8@FreeBSD.ORG Sat May 14 00:35: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 6C4D11065670; Sat, 14 May 2011 00:35:56 +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 5A6978FC08; Sat, 14 May 2011 00:35:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4E0Zuw4086857; Sat, 14 May 2011 00:35:56 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4E0Zupj086853; Sat, 14 May 2011 00:35:56 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201105140035.p4E0Zupj086853@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 May 2011 00:35: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: r221864 - in stable/8/sys/dev: ahci mvs siis X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 00:35:56 -0000 Author: mav Date: Sat May 14 00:35:56 2011 New Revision: 221864 URL: http://svn.freebsd.org/changeset/base/221864 Log: MFC r220829: According to specification. device should respond to COMRESET with COMINIT in no more then 10ms. If we detected no device presence within that time, there is no reason to wait longer. Modified: stable/8/sys/dev/ahci/ahci.c stable/8/sys/dev/mvs/mvs.c 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/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Sat May 14 00:28:09 2011 (r221863) +++ stable/8/sys/dev/ahci/ahci.c Sat May 14 00:35:56 2011 (r221864) @@ -2575,11 +2575,13 @@ static int ahci_sata_connect(struct ahci_channel *ch) { u_int32_t status; - int timeout; + int timeout, found = 0; /* Wait up to 100ms for "connect well" */ for (timeout = 0; timeout < 1000 ; timeout++) { status = ATA_INL(ch->r_mem, AHCI_P_SSTS); + if ((status & ATA_SS_DET_MASK) != ATA_SS_DET_NO_DEVICE) + found = 1; 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)) @@ -2591,12 +2593,15 @@ ahci_sata_connect(struct ahci_channel *c } return (0); } + if (found == 0 && timeout >= 100) + break; DELAY(100); } - if (timeout >= 1000) { + if (timeout >= 1000 || !found) { if (bootverbose) { - device_printf(ch->dev, "SATA connect timeout status=%08x\n", - status); + device_printf(ch->dev, + "SATA connect timeout time=%dus status=%08x\n", + timeout * 100, status); } return (0); } Modified: stable/8/sys/dev/mvs/mvs.c ============================================================================== --- stable/8/sys/dev/mvs/mvs.c Sat May 14 00:28:09 2011 (r221863) +++ stable/8/sys/dev/mvs/mvs.c Sat May 14 00:35:56 2011 (r221864) @@ -2101,11 +2101,13 @@ static int mvs_sata_connect(struct mvs_channel *ch) { u_int32_t status; - int timeout; + int timeout, found = 0; /* 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, SATA_SS); + if ((status & SATA_SS_DET_MASK) != SATA_SS_DET_NO_DEVICE) + found = 1; if (((status & SATA_SS_DET_MASK) == SATA_SS_DET_PHY_ONLINE) && ((status & SATA_SS_SPD_MASK) != SATA_SS_SPD_NO_SPEED) && ((status & SATA_SS_IPM_MASK) == SATA_SS_IPM_ACTIVE)) @@ -2117,18 +2119,21 @@ mvs_sata_connect(struct mvs_channel *ch) } return (0); } - DELAY(1000); + if (found == 0 && timeout >= 100) + break; + DELAY(100); } - if (timeout >= 100) { + if (timeout >= 1000 || !found) { if (bootverbose) { - device_printf(ch->dev, "SATA connect timeout status=%08x\n", - status); + device_printf(ch->dev, + "SATA connect timeout time=%dus status=%08x\n", + timeout * 100, status); } 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, SATA_SE, 0xffffffff); @@ -2154,11 +2159,10 @@ mvs_sata_phy_reset(device_t dev) ATA_OUTL(ch->r_mem, SATA_SC, SATA_SC_DET_RESET | val | SATA_SC_IPM_DIS_PARTIAL | SATA_SC_IPM_DIS_SLUMBER); - DELAY(5000); + DELAY(1000); ATA_OUTL(ch->r_mem, SATA_SC, SATA_SC_DET_IDLE | val | ((ch->pm_level > 0) ? 0 : (SATA_SC_IPM_DIS_PARTIAL | SATA_SC_IPM_DIS_SLUMBER))); - DELAY(5000); if (!mvs_sata_connect(ch)) { if (ch->pm_level > 0) ATA_OUTL(ch->r_mem, SATA_SC, SATA_SC_DET_DISABLE); Modified: stable/8/sys/dev/siis/siis.c ============================================================================== --- stable/8/sys/dev/siis/siis.c Sat May 14 00:28:09 2011 (r221863) +++ stable/8/sys/dev/siis/siis.c Sat May 14 00:35:56 2011 (r221864) @@ -1540,10 +1540,10 @@ siis_devreset(device_t dev) ATA_OUTL(ch->r_mem, SIIS_P_CTLSET, SIIS_P_CTL_DEV_RESET); while (((val = ATA_INL(ch->r_mem, SIIS_P_STS)) & SIIS_P_CTL_DEV_RESET) != 0) { - DELAY(1000); - if (timeout++ > 100) { - device_printf(dev, "device reset stuck (timeout %dms) " - "status = %08x\n", timeout, val); + DELAY(100); + if (timeout++ > 1000) { + device_printf(dev, "device reset stuck " + "(timeout 100ms) status = %08x\n", val); return (EBUSY); } } @@ -1731,27 +1731,39 @@ static int siis_sata_connect(struct siis_channel *ch) { u_int32_t status; - int timeout; + int timeout, found = 0; /* 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, SIIS_P_SSTS); + if ((status & ATA_SS_DET_MASK) != ATA_SS_DET_NO_DEVICE) + found = 1; 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)) break; - DELAY(1000); + if ((status & ATA_SS_DET_MASK) == ATA_SS_DET_PHY_OFFLINE) { + if (bootverbose) { + device_printf(ch->dev, "SATA offline status=%08x\n", + status); + } + return (0); + } + if (found == 0 && timeout >= 100) + break; + DELAY(100); } - if (timeout >= 100) { + if (timeout >= 1000 || !found) { if (bootverbose) { - device_printf(ch->dev, "SATA connect timeout status=%08x\n", - status); + device_printf(ch->dev, + "SATA connect timeout time=%dus status=%08x\n", + timeout * 100, status); } 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, SIIS_P_SERR, 0xffffffff); From owner-svn-src-stable-8@FreeBSD.ORG Sat May 14 00:39:47 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 5738B106564A; Sat, 14 May 2011 00:39:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4563C8FC15; Sat, 14 May 2011 00:39:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4E0dlhV087012; Sat, 14 May 2011 00:39:47 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4E0dlWa087005; Sat, 14 May 2011 00:39:47 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201105140039.p4E0dlWa087005@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 May 2011 00:39:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221865 - in stable/8/sys/dev: ahci mvs siis X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 00:39:47 -0000 Author: mav Date: Sat May 14 00:39:46 2011 New Revision: 221865 URL: http://svn.freebsd.org/changeset/base/221865 Log: MFC r220830: Fix some English grammar. Modified: stable/8/sys/dev/ahci/ahci.c stable/8/sys/dev/ahci/ahci.h stable/8/sys/dev/mvs/mvs.c stable/8/sys/dev/mvs/mvs.h 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/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Sat May 14 00:35:56 2011 (r221864) +++ stable/8/sys/dev/ahci/ahci.c Sat May 14 00:39:46 2011 (r221865) @@ -2127,16 +2127,16 @@ ahci_issue_recovery(device_t dev) struct ccb_scsiio *csio; int i; - /* Find some holden command. */ + /* Find some held command. */ for (i = 0; i < ch->numslots; i++) { if (ch->hold[i]) break; } ccb = xpt_alloc_ccb_nowait(); if (ccb == NULL) { - device_printf(dev, "Unable allocate recovery command\n"); + device_printf(dev, "Unable to allocate recovery command\n"); completeall: - /* We can't do anything -- complete holden commands. */ + /* We can't do anything -- complete held commands. */ for (i = 0; i < ch->numslots; i++) { if (ch->hold[i] == NULL) continue; @@ -2161,7 +2161,7 @@ completeall: if (ataio->data_ptr == NULL) { xpt_free_ccb(ccb); device_printf(dev, - "Unable allocate memory for READ LOG command\n"); + "Unable to allocate memory for READ LOG command\n"); goto completeall; } ataio->dxfer_len = 512; Modified: stable/8/sys/dev/ahci/ahci.h ============================================================================== --- stable/8/sys/dev/ahci/ahci.h Sat May 14 00:35:56 2011 (r221864) +++ stable/8/sys/dev/ahci/ahci.h Sat May 14 00:39:46 2011 (r221865) @@ -408,7 +408,7 @@ struct ahci_channel { int numrslotspd[16];/* Number of running slots per dev */ int numtslots; /* Number of tagged slots */ int numtslotspd[16];/* Number of tagged slots per dev */ - int numhslots; /* Number of holden slots */ + int numhslots; /* Number of held slots */ int recoverycmd; /* Our READ LOG active */ int fatalerr; /* Fatal error happend */ int lastslot; /* Last used slot */ Modified: stable/8/sys/dev/mvs/mvs.c ============================================================================== --- stable/8/sys/dev/mvs/mvs.c Sat May 14 00:35:56 2011 (r221864) +++ stable/8/sys/dev/mvs/mvs.c Sat May 14 00:39:46 2011 (r221865) @@ -1780,16 +1780,16 @@ mvs_issue_recovery(device_t dev) struct ccb_scsiio *csio; int i; - /* Find some holden command. */ + /* Find some held command. */ for (i = 0; i < MVS_MAX_SLOTS; i++) { if (ch->hold[i]) break; } ccb = xpt_alloc_ccb_nowait(); if (ccb == NULL) { - device_printf(dev, "Unable allocate recovery command\n"); + device_printf(dev, "Unable to allocate recovery command\n"); completeall: - /* We can't do anything -- complete holden commands. */ + /* We can't do anything -- complete held commands. */ for (i = 0; i < MVS_MAX_SLOTS; i++) { if (ch->hold[i] == NULL) continue; @@ -1814,7 +1814,7 @@ completeall: if (ataio->data_ptr == NULL) { xpt_free_ccb(ccb); device_printf(dev, - "Unable allocate memory for READ LOG command\n"); + "Unable to allocate memory for READ LOG command\n"); goto completeall; } ataio->dxfer_len = 512; Modified: stable/8/sys/dev/mvs/mvs.h ============================================================================== --- stable/8/sys/dev/mvs/mvs.h Sat May 14 00:35:56 2011 (r221864) +++ stable/8/sys/dev/mvs/mvs.h Sat May 14 00:39:46 2011 (r221865) @@ -538,7 +538,7 @@ struct mvs_channel { struct mvs_slot slot[MVS_MAX_SLOTS]; union ccb *hold[MVS_MAX_SLOTS]; - int holdtag[MVS_MAX_SLOTS]; /* Tags used for holden commands. */ + int holdtag[MVS_MAX_SLOTS]; /* Tags used for held commands. */ struct mtx mtx; /* state lock */ int devices; /* What is present */ int pm_present; /* PM presence reported */ @@ -556,7 +556,7 @@ struct mvs_channel { int numdslots; /* Number of DMA slots */ int numtslots; /* Number of NCQ slots */ int numtslotspd[16];/* Number of NCQ slots per dev */ - int numhslots; /* Number of holden slots */ + int numhslots; /* Number of held slots */ int recoverycmd; /* Our READ LOG active */ int fatalerr; /* Fatal error happend */ int lastslot; /* Last used slot */ Modified: stable/8/sys/dev/siis/siis.c ============================================================================== --- stable/8/sys/dev/siis/siis.c Sat May 14 00:35:56 2011 (r221864) +++ stable/8/sys/dev/siis/siis.c Sat May 14 00:39:46 2011 (r221865) @@ -1366,7 +1366,7 @@ siis_issue_recovery(device_t dev) struct ccb_scsiio *csio; int i; - /* Find some holden command. */ + /* Find some held command. */ for (i = 0; i < SIIS_MAX_SLOTS; i++) { if (ch->hold[i]) break; @@ -1375,9 +1375,9 @@ siis_issue_recovery(device_t dev) return; ccb = xpt_alloc_ccb_nowait(); if (ccb == NULL) { - device_printf(dev, "Unable allocate recovery command\n"); + device_printf(dev, "Unable to allocate recovery command\n"); completeall: - /* We can't do anything -- complete holden commands. */ + /* We can't do anything -- complete held commands. */ for (i = 0; i < SIIS_MAX_SLOTS; i++) { if (ch->hold[i] == NULL) continue; @@ -1402,7 +1402,7 @@ completeall: if (ataio->data_ptr == NULL) { xpt_free_ccb(ccb); device_printf(dev, - "Unable allocate memory for READ LOG command\n"); + "Unable to allocate memory for READ LOG command\n"); goto completeall; } ataio->dxfer_len = 512; @@ -1601,7 +1601,7 @@ siis_reset(device_t dev) /* XXX; Commands in loading state. */ siis_end_transaction(&ch->slot[i], SIIS_ERR_INNOCENT); } - /* Finish all holden commands as-is. */ + /* Finish all held commands as-is. */ for (i = 0; i < SIIS_MAX_SLOTS; i++) { if (!ch->hold[i]) continue; Modified: stable/8/sys/dev/siis/siis.h ============================================================================== --- stable/8/sys/dev/siis/siis.h Sat May 14 00:35:56 2011 (r221864) +++ stable/8/sys/dev/siis/siis.h Sat May 14 00:39:46 2011 (r221865) @@ -387,7 +387,7 @@ struct siis_channel { uint32_t toslots; /* Slots in timeout */ int numrslots; /* Number of running slots */ int numtslots[SIIS_MAX_SLOTS]; /* Number of tagged slots */ - int numhslots; /* Number of holden slots */ + int numhslots; /* Number of held slots */ int recoverycmd; /* Our READ LOG active */ int fatalerr; /* Fatal error happend */ int recovery; /* Some slots are in error */ From owner-svn-src-stable-8@FreeBSD.ORG Sat May 14 00:45: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 45CE21065674; Sat, 14 May 2011 00:45: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 346448FC12; Sat, 14 May 2011 00:45:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4E0jasF087318; Sat, 14 May 2011 00:45:36 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4E0ja33087316; Sat, 14 May 2011 00:45:36 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201105140045.p4E0ja33087316@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 May 2011 00:45: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: r221866 - stable/8/sys/cam X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 00:45:36 -0000 Author: mav Date: Sat May 14 00:45:35 2011 New Revision: 221866 URL: http://svn.freebsd.org/changeset/base/221866 Log: MFC r221201 Make CAM_DEBUG_CDB also dump ATA commands in addition to SCSI. Modified: stable/8/sys/cam/cam_xpt.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_xpt.c ============================================================================== --- stable/8/sys/cam/cam_xpt.c Sat May 14 00:39:46 2011 (r221865) +++ stable/8/sys/cam/cam_xpt.c Sat May 14 00:45:35 2011 (r221866) @@ -2296,19 +2296,18 @@ xpt_action(union ccb *start_ccb) void xpt_action_default(union ccb *start_ccb) { +#ifdef CAMDEBUG + char cdb_str[(SCSI_MAX_CDBLEN * 3) + 1]; +#endif + struct cam_path *path; - CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("xpt_action_default\n")); + path = start_ccb->ccb_h.path; + CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_action_default\n")); switch (start_ccb->ccb_h.func_code) { case XPT_SCSI_IO: { struct cam_ed *device; -#ifdef CAMDEBUG - char cdb_str[(SCSI_MAX_CDBLEN * 3) + 1]; - struct cam_path *path; - - path = start_ccb->ccb_h.path; -#endif /* * For the sake of compatibility with SCSI-1 @@ -2326,7 +2325,7 @@ xpt_action_default(union ccb *start_ccb) * This means that this code will be exercised while probing * devices with an ANSI revision greater than 2. */ - device = start_ccb->ccb_h.path->device; + device = path->device; if (device->protocol_version <= SCSI_REV_2 && start_ccb->ccb_h.target_lun < 8 && (start_ccb->ccb_h.flags & CAM_CDB_POINTER) == 0) { @@ -2350,12 +2349,15 @@ xpt_action_default(union ccb *start_ccb) case XPT_ATA_IO: if (start_ccb->ccb_h.func_code == XPT_ATA_IO) { start_ccb->ataio.resid = 0; + CAM_DEBUG(path, CAM_DEBUG_CDB,("%s. ACB: %s\n", + ata_op_string(&start_ccb->ataio.cmd), + ata_cmd_string(&start_ccb->ataio.cmd, + cdb_str, sizeof(cdb_str)))); } /* FALLTHROUGH */ case XPT_RESET_DEV: case XPT_ENG_EXEC: { - struct cam_path *path = start_ccb->ccb_h.path; int frozen; frozen = cam_ccbq_insert_ccb(&path->device->ccbq, start_ccb); @@ -2394,7 +2396,7 @@ xpt_action_default(union ccb *start_ccb) break; } #endif - sim = start_ccb->ccb_h.path->bus->sim; + sim = path->bus->sim; (*(sim->sim_action))(sim, start_ccb); break; } @@ -2462,7 +2464,7 @@ xpt_action_default(union ccb *start_ccb) { struct cam_sim *sim; - sim = start_ccb->ccb_h.path->bus->sim; + sim = path->bus->sim; (*(sim->sim_action))(sim, start_ccb); break; } @@ -2470,20 +2472,19 @@ xpt_action_default(union ccb *start_ccb) { struct cam_sim *sim; - sim = start_ccb->ccb_h.path->bus->sim; + sim = path->bus->sim; (*(sim->sim_action))(sim, start_ccb); break; } case XPT_PATH_STATS: - start_ccb->cpis.last_reset = - start_ccb->ccb_h.path->bus->last_reset; + start_ccb->cpis.last_reset = path->bus->last_reset; start_ccb->ccb_h.status = CAM_REQ_CMP; break; case XPT_GDEV_TYPE: { struct cam_ed *dev; - dev = start_ccb->ccb_h.path->device; + dev = path->device; if ((dev->flags & CAM_DEV_UNCONFIGURED) != 0) { start_ccb->ccb_h.status = CAM_DEV_NOT_THERE; } else { @@ -2511,7 +2512,7 @@ xpt_action_default(union ccb *start_ccb) { struct cam_ed *dev; - dev = start_ccb->ccb_h.path->device; + dev = path->device; if ((dev->flags & CAM_DEV_UNCONFIGURED) != 0) { start_ccb->ccb_h.status = CAM_DEV_NOT_THERE; } else { @@ -2520,8 +2521,8 @@ xpt_action_default(union ccb *start_ccb) struct cam_et *tar; cgds = &start_ccb->cgds; - bus = cgds->ccb_h.path->bus; - tar = cgds->ccb_h.path->target; + bus = path->bus; + tar = path->target; cgds->dev_openings = dev->ccbq.dev_openings; cgds->dev_active = dev->ccbq.dev_active; cgds->devq_openings = dev->ccbq.devq_openings; @@ -2551,7 +2552,7 @@ xpt_action_default(union ccb *start_ccb) /* * Don't want anyone mucking with our data. */ - device = start_ccb->ccb_h.path->device; + device = path->device; periph_head = &device->periphs; cgdl = &start_ccb->cgdl; @@ -2668,7 +2669,7 @@ xpt_action_default(union ccb *start_ccb) csa = &start_ccb->csa; added = csa->event_enable; - async_head = &csa->ccb_h.path->device->asyncs; + async_head = &path->device->asyncs; /* * If there is already an entry for us, simply @@ -2691,7 +2692,7 @@ xpt_action_default(union ccb *start_ccb) if (csa->event_enable == 0) { SLIST_REMOVE(async_head, cur_entry, async_node, links); - xpt_release_device(csa->ccb_h.path->device); + xpt_release_device(path->device); free(cur_entry, M_CAMXPT); } else { cur_entry->event_enable = csa->event_enable; @@ -2708,7 +2709,7 @@ xpt_action_default(union ccb *start_ccb) cur_entry->callback_arg = csa->callback_arg; cur_entry->callback = csa->callback; SLIST_INSERT_HEAD(async_head, cur_entry, links); - xpt_acquire_device(csa->ccb_h.path->device); + xpt_acquire_device(path->device); } start_ccb->ccb_h.status = CAM_REQ_CMP; break; @@ -2719,7 +2720,7 @@ xpt_action_default(union ccb *start_ccb) struct cam_ed *dev; crs = &start_ccb->crs; - dev = crs->ccb_h.path->device; + dev = path->device; if (dev == NULL) { crs->ccb_h.status = CAM_DEV_NOT_THERE; @@ -2731,11 +2732,11 @@ xpt_action_default(union ccb *start_ccb) if (INQ_DATA_TQ_ENABLED(&dev->inq_data)) { /* Don't ever go below one opening */ if (crs->openings > 0) { - xpt_dev_ccbq_resize(crs->ccb_h.path, + xpt_dev_ccbq_resize(path, crs->openings); if (bootverbose) { - xpt_print(crs->ccb_h.path, + xpt_print(path, "tagged openings now %d\n", crs->openings); } @@ -2797,7 +2798,7 @@ xpt_action_default(union ccb *start_ccb) } if ((start_ccb->ccb_h.flags & CAM_DEV_QFREEZE) == 0) { - xpt_release_devq_rl(crs->ccb_h.path, /*runlevel*/ + xpt_release_devq_rl(path, /*runlevel*/ (crs->release_flags & RELSIM_RELEASE_RUNLEVEL) ? crs->release_timeout : 0, /*count*/1, /*run_queue*/TRUE); @@ -2843,7 +2844,7 @@ xpt_action_default(union ccb *start_ccb) { struct ccb_relsim *crs = &start_ccb->crs; - xpt_freeze_devq_rl(crs->ccb_h.path, /*runlevel*/ + xpt_freeze_devq_rl(path, /*runlevel*/ (crs->release_flags & RELSIM_RELEASE_RUNLEVEL) ? crs->release_timeout : 0, /*count*/1); start_ccb->ccb_h.status = CAM_REQ_CMP; @@ -2851,7 +2852,7 @@ xpt_action_default(union ccb *start_ccb) } case XPT_NOOP: if ((start_ccb->ccb_h.flags & CAM_DEV_QFREEZE) != 0) - xpt_freeze_devq(start_ccb->ccb_h.path, 1); + xpt_freeze_devq(path, 1); start_ccb->ccb_h.status = CAM_REQ_CMP; break; default: From owner-svn-src-stable-8@FreeBSD.ORG Sat May 14 02:28:22 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 149DA1065672; Sat, 14 May 2011 02:28:22 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE54A8FC14; Sat, 14 May 2011 02:28:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4E2SLZ7089839; Sat, 14 May 2011 02:28:21 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4E2SLcG089835; Sat, 14 May 2011 02:28:21 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201105140228.p4E2SLcG089835@svn.freebsd.org> From: Rick Macklem Date: Sat, 14 May 2011 02:28: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: r221871 - in stable/8/sys: fs/nfs fs/nfsclient 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: Sat, 14 May 2011 02:28:22 -0000 Author: rmacklem Date: Sat May 14 02:28:21 2011 New Revision: 221871 URL: http://svn.freebsd.org/changeset/base/221871 Log: MFC: r221014,r221018 Modify the experimental NFS client so that it uses the same "struct nfs_args" as the regular NFS client. This is needed so that the old mount(2) syscall will work and it makes sharing of the diskless NFS root code easier. Eary in the porting exercise I introduced a new revision of nfs_args, but didn't actually need it, thanks to nmount(2). I re-introduced the NFSMNT_KERB flag, since it does essentially the same thing and the old one would not have been used because it never worked. I also added a few new NFSMNT_xxx flags to sys/nfsclient/nfs_args.h that are used by the experimental NFS client. Also fix the NFS client so that it doesn't bogusly set the f_flags argument of "struct statfs", Deleted: stable/8/sys/fs/nfsclient/nfsargs.h Modified: stable/8/sys/fs/nfs/nfsport.h stable/8/sys/fs/nfsclient/nfs_clvfsops.c stable/8/sys/nfsclient/nfsargs.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/fs/nfs/nfsport.h ============================================================================== --- stable/8/sys/fs/nfs/nfsport.h Sat May 14 01:56:48 2011 (r221870) +++ stable/8/sys/fs/nfs/nfsport.h Sat May 14 02:28:21 2011 (r221871) @@ -372,7 +372,7 @@ struct ext_nfsstats { #include #include #include -#include +#include #include /* Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvfsops.c Sat May 14 01:56:48 2011 (r221870) +++ stable/8/sys/fs/nfsclient/nfs_clvfsops.c Sat May 14 02:28:21 2011 (r221871) @@ -100,8 +100,9 @@ static void nfs_decode_args(struct mount struct nfs_args *argp, const char *, struct ucred *, struct thread *); static int mountnfs(struct nfs_args *, struct mount *, - struct sockaddr *, char *, u_char *, u_char *, u_char *, - struct vnode **, struct ucred *, struct thread *, int); + struct sockaddr *, char *, u_char *, int, u_char *, int, + u_char *, int, struct vnode **, struct ucred *, + struct thread *, int); static void nfs_getnlminfo(struct vnode *, uint8_t *, size_t *, struct sockaddr_storage *, int *, off_t *, struct timeval *); @@ -315,7 +316,6 @@ nfs_statfs(struct mount *mp, struct stat if (gotfsinfo || (nmp->nm_flag & NFSMNT_NFSV4)) nfscl_loadfsinfo(nmp, &fs); nfscl_loadsbinfo(nmp, &sb, sbp); - sbp->f_flags = nmp->nm_flag; sbp->f_iosize = newnfs_iosize(nmp); mtx_unlock(&nmp->nm_mtx); if (sbp != &mp->mnt_stat) { @@ -501,11 +501,21 @@ nfs_mountdiskless(char *path, struct vnode **vpp, struct mount *mp) { struct sockaddr *nam; - int error; + int dirlen, error; + char *dirpath; + /* + * Find the directory path in "path", which also has the server's + * name/ip address in it. + */ + dirpath = strchr(path, ':'); + if (dirpath != NULL) + dirlen = strlen(++dirpath); + else + dirlen = 0; nam = sodupsockaddr((struct sockaddr *)sin, M_WAITOK); - if ((error = mountnfs(args, mp, nam, path, NULL, NULL, NULL, vpp, - td->td_ucred, td, NFS_DEFAULT_NEGNAMETIMEO)) != 0) { + if ((error = mountnfs(args, mp, nam, path, NULL, 0, dirpath, dirlen, + NULL, 0, vpp, td->td_ucred, td, NFS_DEFAULT_NEGNAMETIMEO)) != 0) { printf("nfs_mountroot: mount %s on /: %d\n", path, error); return (error); } @@ -733,14 +743,10 @@ nfs_mount(struct mount *mp) .readahead = NFS_DEFRAHEAD, .wcommitsize = 0, /* was: NQ_DEFLEASE */ .hostname = NULL, - /* args version 4 */ .acregmin = NFS_MINATTRTIMO, .acregmax = NFS_MAXATTRTIMO, .acdirmin = NFS_MINDIRATTRTIMO, .acdirmax = NFS_MAXDIRATTRTIMO, - .dirlen = 0, - .krbnamelen = 0, - .srvkrbnamelen = 0, }; int error = 0, ret, len; struct sockaddr *nam = NULL; @@ -750,6 +756,7 @@ nfs_mount(struct mount *mp) u_char nfh[NFSX_FHMAX], krbname[100], dirpath[100], srvkrbname[100]; char *opt, *name, *secname; int negnametimeo = NFS_DEFAULT_NEGNAMETIMEO; + int dirlen, krbnamelen, srvkrbnamelen; if (vfs_filteropt(mp->mnt_optnew, nfs_opts)) { error = EINVAL; @@ -1008,19 +1015,19 @@ nfs_mount(struct mount *mp) strlcpy(srvkrbname, name, sizeof (srvkrbname)); else snprintf(srvkrbname, sizeof (srvkrbname), "nfs@%s", hst); - args.srvkrbnamelen = strlen(srvkrbname); + srvkrbnamelen = strlen(srvkrbname); if (vfs_getopt(mp->mnt_optnew, "gssname", (void **)&name, NULL) == 0) strlcpy(krbname, name, sizeof (krbname)); else krbname[0] = '\0'; - args.krbnamelen = strlen(krbname); + krbnamelen = strlen(krbname); if (vfs_getopt(mp->mnt_optnew, "dirpath", (void **)&name, NULL) == 0) strlcpy(dirpath, name, sizeof (dirpath)); else dirpath[0] = '\0'; - args.dirlen = strlen(dirpath); + dirlen = strlen(dirpath); if (vfs_getopt(mp->mnt_optnew, "addr", (void **)&args.addr, &args.addrlen) == 0) { @@ -1034,8 +1041,9 @@ nfs_mount(struct mount *mp) } args.fh = nfh; - error = mountnfs(&args, mp, nam, hst, krbname, dirpath, srvkrbname, - &vp, td->td_ucred, td, negnametimeo); + error = mountnfs(&args, mp, nam, hst, krbname, krbnamelen, dirpath, + dirlen, srvkrbname, srvkrbnamelen, &vp, td->td_ucred, td, + negnametimeo); out: if (!error) { MNT_ILOCK(mp); @@ -1077,9 +1085,9 @@ nfs_cmount(struct mntarg *ma, void *data */ static int mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, - char *hst, u_char *krbname, u_char *dirpath, u_char *srvkrbname, - struct vnode **vpp, struct ucred *cred, struct thread *td, - int negnametimeo) + char *hst, u_char *krbname, int krbnamelen, u_char *dirpath, int dirlen, + u_char *srvkrbname, int srvkrbnamelen, struct vnode **vpp, + struct ucred *cred, struct thread *td, int negnametimeo) { struct nfsmount *nmp; struct nfsnode *np; @@ -1094,17 +1102,15 @@ mountnfs(struct nfs_args *argp, struct m return (0); } else { MALLOC(nmp, struct nfsmount *, sizeof (struct nfsmount) + - argp->krbnamelen + argp->dirlen + argp->srvkrbnamelen + 2, - M_NEWNFSMNT, M_WAITOK); - bzero((caddr_t)nmp, sizeof (struct nfsmount) + - argp->krbnamelen + argp->dirlen + argp->srvkrbnamelen + 2); + krbnamelen + dirlen + srvkrbnamelen + 2, + M_NEWNFSMNT, M_WAITOK | M_ZERO); TAILQ_INIT(&nmp->nm_bufq); if (clval == 0) clval = (u_int64_t)nfsboottime.tv_sec; nmp->nm_clval = clval++; - nmp->nm_krbnamelen = argp->krbnamelen; - nmp->nm_dirpathlen = argp->dirlen; - nmp->nm_srvkrbnamelen = argp->srvkrbnamelen; + nmp->nm_krbnamelen = krbnamelen; + nmp->nm_dirpathlen = dirlen; + nmp->nm_srvkrbnamelen = srvkrbnamelen; if (td->td_ucred->cr_uid != (uid_t)0) { /* * nm_uid is used to get KerberosV credentials for Modified: stable/8/sys/nfsclient/nfsargs.h ============================================================================== --- stable/8/sys/nfsclient/nfsargs.h Sat May 14 01:56:48 2011 (r221870) +++ stable/8/sys/nfsclient/nfsargs.h Sat May 14 02:28:21 2011 (r221871) @@ -78,7 +78,7 @@ struct nfs_args { #define NFSMNT_NOCONN 0x00000080 /* Don't Connect the socket */ /* 0x100 free, was NFSMNT_NQNFS */ #define NFSMNT_NFSV3 0x00000200 /* Use NFS Version 3 protocol */ -/* 0x400 free, was NFSMNT_KERB */ +#define NFSMNT_KERB 0x00000400 /* Use RPCSEC_GSS/Krb5 */ #define NFSMNT_DUMBTIMR 0x00000800 /* Don't estimate rtt dynamically */ #define NFSMNT_WCOMMITSIZE 0x00001000 /* set max write commit size */ #define NFSMNT_READAHEAD 0x00002000 /* set read ahead */ @@ -93,6 +93,10 @@ struct nfs_args { #define NFSMNT_NOLOCKD 0x00400000 /* Locks are local */ #define NFSMNT_NFSV4 0x00800000 /* Use NFS Version 4 protocol */ #define NFSMNT_HASWRITEVERF 0x01000000 /* NFSv4 Write verifier */ +#define NFSMNT_INTEGRITY 0x02000000 /* Use integrity with RPCSEC_GSS */ +#define NFSMNT_PRIVACY 0x04000000 /* Use privacy with RPCSEC_GSS */ +#define NFSMNT_ALLGSSNAME 0x08000000 /* Use principal for all accesses */ +#define NFSMNT_STRICT3530 0x10000000 /* Adhere strictly to RFC3530 */ #define NFSMNT_NOCTO 0x20000000 /* Don't flush attrcache on open */ #endif From owner-svn-src-stable-8@FreeBSD.ORG Sat May 14 12:02: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 8A5491065678; Sat, 14 May 2011 12:02:03 +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 784F18FC1D; Sat, 14 May 2011 12:02:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4EC23R7002727; Sat, 14 May 2011 12:02:03 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4EC231D002722; Sat, 14 May 2011 12:02:03 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201105141202.p4EC231D002722@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 14 May 2011 12:02: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: r221880 - in stable/8/sys/dev: sound/usb usb usb/quirk 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, 14 May 2011 12:02:03 -0000 Author: hselasky Date: Sat May 14 12:02:03 2011 New Revision: 221880 URL: http://svn.freebsd.org/changeset/base/221880 Log: MFC r218791 and r218988. USB MIDI related changes and improvements. Modified: stable/8/sys/dev/sound/usb/uaudio.c stable/8/sys/dev/usb/quirk/usb_quirk.c stable/8/sys/dev/usb/quirk/usb_quirk.h stable/8/sys/dev/usb/usbdevs 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/sound/usb/uaudio.c ============================================================================== --- stable/8/sys/dev/sound/usb/uaudio.c Sat May 14 11:26:00 2011 (r221879) +++ stable/8/sys/dev/sound/usb/uaudio.c Sat May 14 12:02:03 2011 (r221880) @@ -191,10 +191,15 @@ struct uaudio_chan { uint8_t iface_alt_index; }; -#define UMIDI_N_TRANSFER 4 /* units */ #define UMIDI_CABLES_MAX 16 /* units */ #define UMIDI_BULK_SIZE 1024 /* bytes */ +enum { + UMIDI_TX_TRANSFER, + UMIDI_RX_TRANSFER, + UMIDI_N_TRANSFER, +}; + struct umidi_sub_chan { struct usb_fifo_sc fifo; uint8_t *temp_cmd; @@ -224,10 +229,6 @@ struct umidi_chan { uint8_t iface_index; uint8_t iface_alt_index; - uint8_t flags; -#define UMIDI_FLAG_READ_STALL 0x01 -#define UMIDI_FLAG_WRITE_STALL 0x02 - uint8_t read_open_refcount; uint8_t write_open_refcount; @@ -264,6 +265,7 @@ struct uaudio_softc { uint8_t sc_uq_au_inp_async:1; uint8_t sc_uq_au_no_xu:1; uint8_t sc_uq_bad_adc:1; + uint8_t sc_uq_au_vendor_class:1; }; struct uaudio_search_result { @@ -336,9 +338,7 @@ static device_detach_t uaudio_detach; static usb_callback_t uaudio_chan_play_callback; static usb_callback_t uaudio_chan_record_callback; static usb_callback_t uaudio_mixer_write_cfg_callback; -static usb_callback_t umidi_read_clear_stall_callback; static usb_callback_t umidi_bulk_read_callback; -static usb_callback_t umidi_write_clear_stall_callback; static usb_callback_t umidi_bulk_write_callback; static void uaudio_chan_fill_info_sub(struct uaudio_softc *, @@ -402,8 +402,8 @@ static int umidi_open(struct usb_fifo *, static int umidi_ioctl(struct usb_fifo *, u_long cmd, void *, int); static void umidi_close(struct usb_fifo *, int); static void umidi_init(device_t dev); -static int32_t umidi_probe(device_t dev); -static int32_t umidi_detach(device_t dev); +static int umidi_probe(device_t dev); +static int umidi_detach(device_t dev); #ifdef USB_DEBUG static void uaudio_chan_dump_ep_desc( @@ -493,7 +493,7 @@ uint8_t umidi_cmd_to_len[16] = { static const struct usb_config umidi_config[UMIDI_N_TRANSFER] = { - [0] = { + [UMIDI_TX_TRANSFER] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, @@ -502,7 +502,7 @@ static const struct usb_config .callback = &umidi_bulk_write_callback, }, - [1] = { + [UMIDI_RX_TRANSFER] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, @@ -510,26 +510,6 @@ static const struct usb_config .flags = {.pipe_bof = 1,.short_xfer_ok = 1,.proxy_buffer = 1,}, .callback = &umidi_bulk_read_callback, }, - - [2] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* Control pipe */ - .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb_device_request), - .callback = &umidi_write_clear_stall_callback, - .timeout = 1000, /* 1 second */ - .interval = 50, /* 50ms */ - }, - - [3] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* Control pipe */ - .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb_device_request), - .callback = &umidi_read_clear_stall_callback, - .timeout = 1000, /* 1 second */ - .interval = 50, /* 50ms */ - }, }; static devclass_t uaudio_devclass; @@ -562,10 +542,16 @@ uaudio_probe(device_t dev) if (uaa->use_generic == 0) return (ENXIO); - /* trigger on the control interface */ + /* lookup non-standard device */ - if ((uaa->info.bInterfaceClass == UICLASS_AUDIO) && - (uaa->info.bInterfaceSubClass == UISUBCLASS_AUDIOCONTROL)) { + if (uaa->info.bInterfaceClass != UICLASS_AUDIO) { + if (usb_test_quirk(uaa, UQ_AU_VENDOR_CLASS) == 0) + return (ENXIO); + } + + /* check for AUDIO control interface */ + + if (uaa->info.bInterfaceSubClass == UISUBCLASS_AUDIOCONTROL) { if (usb_test_quirk(uaa, UQ_BAD_AUDIO)) return (ENXIO); else @@ -574,9 +560,11 @@ uaudio_probe(device_t dev) /* check for MIDI stream */ - if ((uaa->info.bInterfaceClass == UICLASS_AUDIO) && - (uaa->info.bInterfaceSubClass == UISUBCLASS_MIDISTREAM)) { - return (0); + if (uaa->info.bInterfaceSubClass == UISUBCLASS_MIDISTREAM) { + if (usb_test_quirk(uaa, UQ_BAD_MIDI)) + return (ENXIO); + else + return (0); } return (ENXIO); } @@ -607,6 +595,9 @@ uaudio_attach(device_t dev) if (usb_test_quirk(uaa, UQ_BAD_ADC)) sc->sc_uq_bad_adc = 1; + if (usb_test_quirk(uaa, UQ_AU_VENDOR_CLASS)) + sc->sc_uq_au_vendor_class = 1; + umidi_init(dev); device_set_usb_desc(dev); @@ -821,6 +812,7 @@ uaudio_chan_fill_info_sub(struct uaudio_ uint8_t bBitResolution; uint8_t x; uint8_t audio_if = 0; + uint8_t uma_if_class; while ((desc = usb_desc_foreach(cd, desc))) { @@ -838,19 +830,22 @@ uaudio_chan_fill_info_sub(struct uaudio_ alt_index++; } - if ((id->bInterfaceClass == UICLASS_AUDIO) && - (id->bInterfaceSubClass == UISUBCLASS_AUDIOSTREAM)) { + uma_if_class = + ((id->bInterfaceClass == UICLASS_AUDIO) || + ((id->bInterfaceClass == UICLASS_VENDOR) && + (sc->sc_uq_au_vendor_class != 0))); + + if ((uma_if_class != 0) && (id->bInterfaceSubClass == UISUBCLASS_AUDIOSTREAM)) { audio_if = 1; } else { audio_if = 0; } - if ((id->bInterfaceClass == UICLASS_AUDIO) && + if ((uma_if_class != 0) && (id->bInterfaceSubClass == UISUBCLASS_MIDISTREAM)) { /* * XXX could allow multiple MIDI interfaces - * XXX */ if ((sc->sc_midi_chan.valid == 0) && @@ -1361,7 +1356,8 @@ uaudio_chan_init(struct uaudio_softc *sc usbd_errstr(err)); goto error; } - usbd_set_parent_iface(sc->sc_udev, iface_index, sc->sc_mixer_iface_index); + usbd_set_parent_iface(sc->sc_udev, iface_index, + sc->sc_mixer_iface_index); /* * Only set the sample rate if the channel reports that it @@ -1576,10 +1572,10 @@ static void uaudio_mixer_add_ctl_sub(struct uaudio_softc *sc, struct uaudio_mixer_node *mc) { struct uaudio_mixer_node *p_mc_new = - malloc(sizeof(*p_mc_new), M_USBDEV, M_WAITOK); + malloc(sizeof(*p_mc_new), M_USBDEV, M_WAITOK); - if (p_mc_new) { - bcopy(mc, p_mc_new, sizeof(*p_mc_new)); + if (p_mc_new != NULL) { + memcpy(p_mc_new, mc, sizeof(*p_mc_new)); p_mc_new->next = sc->sc_mixer_root; sc->sc_mixer_root = p_mc_new; sc->sc_mixer_count++; @@ -1721,7 +1717,7 @@ uaudio_mixer_add_mixer(struct uaudio_sof DPRINTFN(3, "ichs=%d ochs=%d\n", ichs, ochs); - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); mix.wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); uaudio_mixer_determine_class(&iot[id], &mix); @@ -1781,7 +1777,7 @@ uaudio_mixer_add_selector(struct uaudio_ if (d->bNrInPins == 0) { return; } - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); mix.wIndex = MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no); mix.wValue[0] = MAKE_WORD(0, 0); @@ -1851,7 +1847,7 @@ uaudio_mixer_add_feature(struct uaudio_s if (d->bControlSize == 0) { return; } - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); nchan = (d->bLength - 7) / d->bControlSize; mmask = uaudio_mixer_feature_get_bmaControls(d, 0); @@ -1985,7 +1981,7 @@ uaudio_mixer_add_processing_updown(struc DPRINTF("no mode select\n"); return; } - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); mix.wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); mix.nchan = 1; @@ -2011,7 +2007,7 @@ uaudio_mixer_add_processing(struct uaudi struct uaudio_mixer_node mix; uint16_t ptype; - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); ptype = UGETW(d0->wProcessType); @@ -2066,7 +2062,7 @@ uaudio_mixer_add_extension(struct uaudio } if (d1->bmControls[0] & UA_EXT_ENABLE_MASK) { - bzero(&mix, sizeof(mix)); + memset(&mix, 0, sizeof(mix)); mix.wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); mix.nchan = 1; @@ -2293,7 +2289,7 @@ uaudio_mixer_get_cluster(uint8_t id, con } error: DPRINTF("bad data\n"); - bzero(&r, sizeof(r)); + memset(&r, 0, sizeof(r)); done: return (r); } @@ -3283,25 +3279,12 @@ uaudio_mixer_setrecsrc(struct uaudio_sof *========================================================================*/ static void -umidi_read_clear_stall_callback(struct usb_xfer *xfer, usb_error_t error) -{ - struct umidi_chan *chan = usbd_xfer_softc(xfer); - struct usb_xfer *xfer_other = chan->xfer[1]; - - if (usbd_clear_stall_callback(xfer, xfer_other)) { - DPRINTF("stall cleared\n"); - chan->flags &= ~UMIDI_FLAG_READ_STALL; - usbd_transfer_start(xfer_other); - } -} - -static void umidi_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) { struct umidi_chan *chan = usbd_xfer_softc(xfer); struct umidi_sub_chan *sub; struct usb_page_cache *pc; - uint8_t buf[1]; + uint8_t buf[4]; uint8_t cmd_len; uint8_t cn; uint16_t pos; @@ -3319,57 +3302,47 @@ umidi_bulk_read_callback(struct usb_xfer while (actlen >= 4) { - usbd_copy_out(pc, pos, buf, 1); - - cmd_len = umidi_cmd_to_len[buf[0] & 0xF]; /* command length */ - cn = buf[0] >> 4; /* cable number */ + /* copy out the MIDI data */ + usbd_copy_out(pc, pos, buf, 4); + /* command length */ + cmd_len = umidi_cmd_to_len[buf[0] & 0xF]; + /* cable number */ + cn = buf[0] >> 4; + /* + * Lookup sub-channel. The index is range + * checked below. + */ sub = &chan->sub[cn]; - if (cmd_len && (cn < chan->max_cable) && sub->read_open) { - usb_fifo_put_data(sub->fifo.fp[USB_FIFO_RX], pc, - pos + 1, cmd_len, 1); - } else { - /* ignore the command */ + if ((cmd_len != 0) && + (cn < chan->max_cable) && + (sub->read_open != 0)) { + + /* Send data to the application */ + usb_fifo_put_data_linear( + sub->fifo.fp[USB_FIFO_RX], + buf + 1, cmd_len, 1); } - actlen -= 4; pos += 4; } case USB_ST_SETUP: DPRINTF("start\n"); - - if (chan->flags & UMIDI_FLAG_READ_STALL) { - usbd_transfer_start(chan->xfer[3]); - return; - } +tr_setup: usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); usbd_transfer_submit(xfer); - return; + break; default: DPRINTF("error=%s\n", usbd_errstr(error)); if (error != USB_ERR_CANCELLED) { /* try to clear stall first */ - chan->flags |= UMIDI_FLAG_READ_STALL; - usbd_transfer_start(chan->xfer[3]); + usbd_xfer_set_stall(xfer); + goto tr_setup; } - return; - - } -} - -static void -umidi_write_clear_stall_callback(struct usb_xfer *xfer, usb_error_t error) -{ - struct umidi_chan *chan = usbd_xfer_softc(xfer); - struct usb_xfer *xfer_other = chan->xfer[0]; - - if (usbd_clear_stall_callback(xfer, xfer_other)) { - DPRINTF("stall cleared\n"); - chan->flags &= ~UMIDI_FLAG_WRITE_STALL; - usbd_transfer_start(xfer_other); + break; } } @@ -3501,6 +3474,8 @@ umidi_convert_to_usb(struct umidi_sub_ch sub->temp_cmd = sub->temp_1; sub->state = UMIDI_ST_SYSEX_0; return (1); + default: + break; } } return (0); @@ -3526,13 +3501,9 @@ umidi_bulk_write_callback(struct usb_xfe DPRINTF("actlen=%d bytes\n", len); case USB_ST_SETUP: - +tr_setup: DPRINTF("start\n"); - if (chan->flags & UMIDI_FLAG_WRITE_STALL) { - usbd_transfer_start(chan->xfer[2]); - return; - } total_length = 0; /* reset */ start_cable = chan->curr_cable; tr_any = 0; @@ -3592,7 +3563,7 @@ umidi_bulk_write_callback(struct usb_xfe usbd_xfer_set_frame_len(xfer, 0, total_length); usbd_transfer_submit(xfer); } - return; + break; default: /* Error */ @@ -3600,11 +3571,10 @@ umidi_bulk_write_callback(struct usb_xfe if (error != USB_ERR_CANCELLED) { /* try to clear stall first */ - chan->flags |= UMIDI_FLAG_WRITE_STALL; - usbd_transfer_start(chan->xfer[2]); + usbd_xfer_set_stall(xfer); + goto tr_setup; } - return; - + break; } } @@ -3634,7 +3604,7 @@ umidi_start_read(struct usb_fifo *fifo) { struct umidi_chan *chan = usb_fifo_softc(fifo); - usbd_transfer_start(chan->xfer[1]); + usbd_transfer_start(chan->xfer[UMIDI_RX_TRANSFER]); } static void @@ -3661,7 +3631,7 @@ umidi_start_write(struct usb_fifo *fifo) { struct umidi_chan *chan = usb_fifo_softc(fifo); - usbd_transfer_start(chan->xfer[0]); + usbd_transfer_start(chan->xfer[UMIDI_TX_TRANSFER]); } static void @@ -3676,8 +3646,7 @@ umidi_stop_write(struct usb_fifo *fifo) if (--(chan->write_open_refcount) == 0) { DPRINTF("(stopping write transfer)\n"); - usbd_transfer_stop(chan->xfer[2]); - usbd_transfer_stop(chan->xfer[0]); + usbd_transfer_stop(chan->xfer[UMIDI_TX_TRANSFER]); } } @@ -3702,7 +3671,7 @@ umidi_open(struct usb_fifo *fifo, int ff } /* clear stall first */ mtx_lock(&chan->mtx); - chan->flags |= UMIDI_FLAG_WRITE_STALL; + usbd_xfer_set_stall(chan->xfer[UMIDI_TX_TRANSFER]); chan->write_open_refcount++; sub->write_open = 1; @@ -3752,7 +3721,7 @@ static struct usb_fifo_methods umidi_fif .basename[0] = "umidi", }; -static int32_t +static int umidi_probe(device_t dev) { struct uaudio_softc *sc = device_get_softc(dev); @@ -3768,7 +3737,8 @@ umidi_probe(device_t dev) DPRINTF("setting of alternate index failed!\n"); goto detach; } - usbd_set_parent_iface(sc->sc_udev, chan->iface_index, sc->sc_mixer_iface_index); + usbd_set_parent_iface(sc->sc_udev, chan->iface_index, + sc->sc_mixer_iface_index); error = usbd_transfer_setup(uaa->device, &chan->iface_index, chan->xfer, umidi_config, UMIDI_N_TRANSFER, @@ -3798,13 +3768,15 @@ umidi_probe(device_t dev) mtx_lock(&chan->mtx); /* clear stall first */ - chan->flags |= UMIDI_FLAG_READ_STALL; + usbd_xfer_set_stall(chan->xfer[UMIDI_RX_TRANSFER]); /* - * NOTE: at least one device will not work properly unless - * the BULK pipe is open all the time. + * NOTE: At least one device will not work properly unless the + * BULK IN pipe is open all the time. This might have to do + * about that the internal queues of the device overflow if we + * don't read them regularly. */ - usbd_transfer_start(chan->xfer[1]); + usbd_transfer_start(chan->xfer[UMIDI_RX_TRANSFER]); mtx_unlock(&chan->mtx); @@ -3814,7 +3786,7 @@ detach: return (ENXIO); /* failure */ } -static int32_t +static int umidi_detach(device_t dev) { struct uaudio_softc *sc = device_get_softc(dev); @@ -3827,8 +3799,7 @@ umidi_detach(device_t dev) mtx_lock(&chan->mtx); - usbd_transfer_stop(chan->xfer[3]); - usbd_transfer_stop(chan->xfer[1]); + usbd_transfer_stop(chan->xfer[UMIDI_RX_TRANSFER]); mtx_unlock(&chan->mtx); Modified: stable/8/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- stable/8/sys/dev/usb/quirk/usb_quirk.c Sat May 14 11:26:00 2011 (r221879) +++ stable/8/sys/dev/usb/quirk/usb_quirk.c Sat May 14 12:02:03 2011 (r221880) @@ -94,11 +94,7 @@ static struct usb_quirk_entry usb_quirks USB_QUIRK(SILICONPORTALS, YAPPHONE, 0x100, 0x100, UQ_AU_INP_ASYNC), USB_QUIRK(LOGITECH, UN53B, 0x0000, 0xffff, UQ_NO_STRINGS), USB_QUIRK(ELSA, MODEM1, 0x0000, 0xffff, UQ_CFG_INDEX_1), - - /* - * XXX The following quirks should have a more specific revision - * number: - */ + /* Quirks for printer devices */ USB_QUIRK(HP, 895C, 0x0000, 0xffff, UQ_BROKEN_BIDIR), USB_QUIRK(HP, 880C, 0x0000, 0xffff, UQ_BROKEN_BIDIR), USB_QUIRK(HP, 815C, 0x0000, 0xffff, UQ_BROKEN_BIDIR), @@ -458,6 +454,24 @@ static struct usb_quirk_entry usb_quirks USB_QUIRK(CHIPSBANK, USBMEMSTICK, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(CHIPSBANK, USBMEMSTICK1, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(NEWLINK, USB2IDEBRIDGE, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), + + /* Non-standard USB MIDI devices */ + USB_QUIRK(ROLAND, UM1, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, SC8850, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, SD90, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, UM880N, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, UA100, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, UM4, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, U8, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, UM2, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, SC8820, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, PC300, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, SK500, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, SCD70, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, UM550, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, SD20, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, SD80, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, UA700, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), }; #undef USB_QUIRK_VP #undef USB_QUIRK @@ -522,6 +536,8 @@ static const char *usb_quirk_str[USB_QUI [UQ_MSC_EJECT_SAEL_M460] = "UQ_MSC_EJECT_SAEL_M460", [UQ_MSC_EJECT_HUAWEISCSI] = "UQ_MSC_EJECT_HUAWEISCSI", [UQ_MSC_EJECT_TCT] = "UQ_MSC_EJECT_TCT", + [UQ_BAD_MIDI] = "UQ_BAD_MIDI", + [UQ_AU_VENDOR_CLASS] = "UQ_AU_VENDOR_CLASS", }; /*------------------------------------------------------------------------* Modified: stable/8/sys/dev/usb/quirk/usb_quirk.h ============================================================================== --- stable/8/sys/dev/usb/quirk/usb_quirk.h Sat May 14 11:26:00 2011 (r221879) +++ stable/8/sys/dev/usb/quirk/usb_quirk.h Sat May 14 12:02:03 2011 (r221880) @@ -100,6 +100,9 @@ enum { UQ_MSC_EJECT_HUAWEISCSI, /* ejects after Huawei SCSI command */ UQ_MSC_EJECT_TCT, /* ejects after TCT SCSI command */ + UQ_BAD_MIDI, /* device claims MIDI class, but isn't */ + UQ_AU_VENDOR_CLASS, /* audio device uses vendor and not audio class */ + USB_QUIRK_MAX }; Modified: stable/8/sys/dev/usb/usbdevs ============================================================================== --- stable/8/sys/dev/usb/usbdevs Sat May 14 11:26:00 2011 (r221879) +++ stable/8/sys/dev/usb/usbdevs Sat May 14 12:02:03 2011 (r221880) @@ -2771,9 +2771,23 @@ product RICOH VGPVCC8 0x183b VGP-VCC8 C product REINERSCT CYBERJACK_ECOM 0x0100 e-com cyberJack /* Roland products */ +product ROLAND UA100 0x0000 UA-100 Audio I/F +product ROLAND UM4 0x0002 UM-4 MIDI I/F +product ROLAND SC8850 0x0003 SC-8850 MIDI Synth +product ROLAND U8 0x0004 U-8 Audio I/F +product ROLAND UM2 0x0005 UM-2 MIDI I/F +product ROLAND SC8820 0x0007 SC-8820 MIDI Synth +product ROLAND PC300 0x0008 PC-300 MIDI Keyboard product ROLAND UM1 0x0009 UM-1 MIDI I/F +product ROLAND SK500 0x000b SK-500 MIDI Keyboard +product ROLAND SCD70 0x000c SC-D70 MIDI Synth product ROLAND UM880N 0x0014 EDIROL UM-880 MIDI I/F (native) product ROLAND UM880G 0x0015 EDIROL UM-880 MIDI I/F (generic) +product ROLAND SD90 0x0016 SD-90 MIDI Synth +product ROLAND UM550 0x0023 UM-550 MIDI I/F +product ROLAND SD20 0x0027 SD-20 MIDI Synth +product ROLAND SD80 0x0029 SD-80 MIDI Synth +product ROLAND UA700 0x002b UA-700 Audio I/F /* Rockfire products */ product ROCKFIRE GAMEPAD 0x2033 gamepad 203USB @@ -3381,10 +3395,11 @@ product XYRATEX PRISM_GT_2 0x2002 PrismG /* Yamaha products */ product YAMAHA UX256 0x1000 UX256 MIDI I/F product YAMAHA UX96 0x1008 UX96 MIDI I/F +product YAMAHA RPU200 0x3104 RP-U200 product YAMAHA RTA54I 0x4000 NetVolante RTA54i Broadband&ISDN Router -product YAMAHA RTA55I 0x4004 NetVolante RTA55i Broadband VoIP Router product YAMAHA RTW65B 0x4001 NetVolante RTW65b Broadband Wireless Router product YAMAHA RTW65I 0x4002 NetVolante RTW65i Broadband&ISDN Wireless Router +product YAMAHA RTA55I 0x4004 NetVolante RTA55i Broadband VoIP Router /* Yano products */ product YANO U640MO 0x0101 U640MO-03 From owner-svn-src-stable-8@FreeBSD.ORG Sat May 14 12:06:01 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1352A106566B; Sat, 14 May 2011 12:06:01 +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 DE04A8FC12; Sat, 14 May 2011 12:06:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4EC603Q002902; Sat, 14 May 2011 12:06:00 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4EC60a4002900; Sat, 14 May 2011 12:06:00 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201105141206.p4EC60a4002900@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 14 May 2011 12:06: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: r221881 - stable/8/sys/dev/sound/usb X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 12:06:01 -0000 Author: hselasky Date: Sat May 14 12:06:00 2011 New Revision: 221881 URL: http://svn.freebsd.org/changeset/base/221881 Log: MFC r221695. Workaround for broken no-name USB audio devices sold by dealextreme called "3D sound" and the alike when using duplex audio. Modified: stable/8/sys/dev/sound/usb/uaudio.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/sound/usb/uaudio.c ============================================================================== --- stable/8/sys/dev/sound/usb/uaudio.c Sat May 14 12:02:03 2011 (r221880) +++ stable/8/sys/dev/sound/usb/uaudio.c Sat May 14 12:06:00 2011 (r221881) @@ -789,6 +789,46 @@ uaudio_chan_dump_ep_desc(const usb_endpo #endif +/* + * The following is a workaround for broken no-name USB audio devices + * sold by dealextreme called "3D sound". The problem is that the + * manufacturer computed wMaxPacketSize is too small to hold the + * actual data sent. In other words the device sometimes sends more + * data than it actually reports it can send in a single isochronous + * packet. + */ +static void +uaudio_record_fix_fs(usb_endpoint_descriptor_audio_t *ep, + uint32_t xps, uint32_t add) +{ + uint32_t mps; + + mps = UGETW(ep->wMaxPacketSize); + + /* + * If the device indicates it can send more data than what the + * sample rate indicates, we apply the workaround. + */ + if (mps > xps) { + + /* allow additional data */ + xps += add; + + /* check against the maximum USB 1.x length */ + if (xps > 1023) + xps = 1023; + + /* check if we should do an update */ + if (mps < xps) { + /* simply update the wMaxPacketSize field */ + USETW(ep->wMaxPacketSize, xps); + DPRINTF("Workaround: Updated wMaxPacketSize " + "from %d to %d bytes.\n", + (int)mps, (int)xps); + } + } +} + static void uaudio_chan_fill_info_sub(struct uaudio_softc *sc, struct usb_device *udev, uint32_t rate, uint8_t channels, uint8_t bit_resolution) @@ -797,7 +837,7 @@ uaudio_chan_fill_info_sub(struct uaudio_ const struct usb_audio_streaming_interface_descriptor *asid = NULL; const struct usb_audio_streaming_type1_descriptor *asf1d = NULL; const struct usb_audio_streaming_endpoint_descriptor *sed = NULL; - const usb_endpoint_descriptor_audio_t *ed1 = NULL; + usb_endpoint_descriptor_audio_t *ed1 = NULL; const usb_endpoint_descriptor_audio_t *ed2 = NULL; struct usb_config_descriptor *cd = usbd_get_config_descriptor(udev); struct usb_interface_descriptor *id; @@ -999,6 +1039,13 @@ uaudio_chan_fill_info_sub(struct uaudio_ UAUDIO_MAX_CHAN(chan->p_asf1d->bNrChannels) * chan->p_asf1d->bBitResolution) / 8); + if (ep_dir == UE_DIR_IN && + usbd_get_speed(udev) == USB_SPEED_FULL) { + uaudio_record_fix_fs(ed1, + chan->sample_size * (rate / 1000), + chan->sample_size * (rate / 4000)); + } + if (sc->sc_sndstat_valid) { sbuf_printf(&sc->sc_sndstat, "\n\t" "mode %d.%d:(%s) %dch, %d/%dbit, %s, %dHz", From owner-svn-src-stable-8@FreeBSD.ORG Sat May 14 12:11: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 93995106566C; Sat, 14 May 2011 12:11:17 +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 8030C8FC08; Sat, 14 May 2011 12:11:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4ECBHb7003058; Sat, 14 May 2011 12:11:17 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4ECBHXq003056; Sat, 14 May 2011 12:11:17 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201105141211.p4ECBHXq003056@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 14 May 2011 12:11: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: r221882 - in stable/8/usr.sbin: . bsnmpd/modules/snmp_hostres dumpcis makefs makefs/ffs usbdump 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, 14 May 2011 12:11:17 -0000 Author: hselasky Date: Sat May 14 12:11:17 2011 New Revision: 221882 URL: http://svn.freebsd.org/changeset/base/221882 Log: MFC r221604. Minor usbdump update: - Improve exit error codes and update displayed usage text. Modified: stable/8/usr.sbin/usbdump/usbdump.c Directory Properties: stable/8/usr.sbin/ (props changed) stable/8/usr.sbin/Makefile (props changed) stable/8/usr.sbin/acpi/ (props changed) stable/8/usr.sbin/arp/ (props changed) stable/8/usr.sbin/asf/ (props changed) stable/8/usr.sbin/bluetooth/ (props changed) stable/8/usr.sbin/bluetooth/bthidcontrol/ (props changed) stable/8/usr.sbin/bluetooth/bthidd/ (props changed) stable/8/usr.sbin/bluetooth/l2control/ (props changed) stable/8/usr.sbin/bluetooth/l2ping/ (props changed) stable/8/usr.sbin/boot0cfg/ (props changed) stable/8/usr.sbin/bsnmpd/ (props changed) stable/8/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_processor_tbl.c (props changed) stable/8/usr.sbin/burncd/ (props changed) stable/8/usr.sbin/cdcontrol/ (props changed) stable/8/usr.sbin/chown/ (props changed) stable/8/usr.sbin/config/ (props changed) stable/8/usr.sbin/config/SMM.doc/ (props changed) stable/8/usr.sbin/cpucontrol/ (props changed) stable/8/usr.sbin/crashinfo/ (props changed) stable/8/usr.sbin/cron/ (props changed) stable/8/usr.sbin/crunch/examples/ (props changed) stable/8/usr.sbin/ctm/ (props changed) stable/8/usr.sbin/cxgbtool/ (props changed) stable/8/usr.sbin/devinfo/ (props changed) stable/8/usr.sbin/diskinfo/ (props changed) stable/8/usr.sbin/dumpcis/cardinfo.h (props changed) stable/8/usr.sbin/dumpcis/cis.h (props changed) stable/8/usr.sbin/faithd/ (props changed) stable/8/usr.sbin/fdcontrol/ (props changed) stable/8/usr.sbin/fdformat/ (props changed) stable/8/usr.sbin/fdread/ (props changed) stable/8/usr.sbin/fdwrite/ (props changed) stable/8/usr.sbin/fifolog/ (props changed) stable/8/usr.sbin/flowctl/ (props changed) stable/8/usr.sbin/freebsd-update/ (props changed) stable/8/usr.sbin/i2c/ (props changed) stable/8/usr.sbin/inetd/ (props changed) stable/8/usr.sbin/iostat/ (props changed) stable/8/usr.sbin/jail/ (props changed) stable/8/usr.sbin/jls/ (props changed) stable/8/usr.sbin/lpr/ (props changed) stable/8/usr.sbin/mailwrapper/ (props changed) stable/8/usr.sbin/makefs/ffs/ffs_bswap.c (props changed) stable/8/usr.sbin/makefs/ffs/ffs_subr.c (props changed) stable/8/usr.sbin/makefs/ffs/ufs_bswap.h (props changed) stable/8/usr.sbin/makefs/getid.c (props changed) stable/8/usr.sbin/mergemaster/ (props changed) stable/8/usr.sbin/mfiutil/ (props changed) stable/8/usr.sbin/mountd/ (props changed) stable/8/usr.sbin/moused/ (props changed) stable/8/usr.sbin/mptutil/ (props changed) stable/8/usr.sbin/mtest/ (props changed) stable/8/usr.sbin/mtree/ (props changed) stable/8/usr.sbin/named/ (props changed) stable/8/usr.sbin/ndp/ (props changed) stable/8/usr.sbin/newsyslog/ (props changed) stable/8/usr.sbin/nfsd/ (props changed) stable/8/usr.sbin/nfsdumpstate/ (props changed) stable/8/usr.sbin/ntp/ (props changed) stable/8/usr.sbin/pciconf/ (props changed) stable/8/usr.sbin/periodic/ (props changed) stable/8/usr.sbin/pkg_install/ (props changed) stable/8/usr.sbin/pmcannotate/ (props changed) stable/8/usr.sbin/pmccontrol/ (props changed) stable/8/usr.sbin/pmcstat/ (props changed) stable/8/usr.sbin/powerd/ (props changed) stable/8/usr.sbin/ppp/ (props changed) stable/8/usr.sbin/pppctl/ (props changed) stable/8/usr.sbin/pstat/ (props changed) stable/8/usr.sbin/pw/ (props changed) stable/8/usr.sbin/rpc.lockd/ (props changed) stable/8/usr.sbin/rpc.umntall/ (props changed) stable/8/usr.sbin/rpcbind/ (props changed) stable/8/usr.sbin/rtadvd/ (props changed) stable/8/usr.sbin/rtsold/ (props changed) stable/8/usr.sbin/sade/ (props changed) stable/8/usr.sbin/service/ (props changed) stable/8/usr.sbin/services_mkdb/ (props changed) stable/8/usr.sbin/setfmac/ (props changed) stable/8/usr.sbin/setpmac/ (props changed) stable/8/usr.sbin/smbmsg/ (props changed) stable/8/usr.sbin/sysinstall/ (props changed) stable/8/usr.sbin/syslogd/ (props changed) stable/8/usr.sbin/traceroute/ (props changed) stable/8/usr.sbin/traceroute6/ (props changed) stable/8/usr.sbin/tzsetup/ (props changed) stable/8/usr.sbin/uathload/ (props changed) stable/8/usr.sbin/ugidfw/ (props changed) stable/8/usr.sbin/uhsoctl/ (props changed) stable/8/usr.sbin/usbconfig/ (props changed) stable/8/usr.sbin/usbdump/ (props changed) stable/8/usr.sbin/vidcontrol/ (props changed) stable/8/usr.sbin/watchdogd/ (props changed) stable/8/usr.sbin/wpa/ (props changed) stable/8/usr.sbin/ypserv/ (props changed) stable/8/usr.sbin/zic/ (props changed) Modified: stable/8/usr.sbin/usbdump/usbdump.c ============================================================================== --- stable/8/usr.sbin/usbdump/usbdump.c Sat May 14 12:06:00 2011 (r221881) +++ stable/8/usr.sbin/usbdump/usbdump.c Sat May 14 12:11:17 2011 (r221882) @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include @@ -49,6 +48,8 @@ #include #include #include +#include +#include struct usbcap { int fd; /* fd for /dev/usbpf */ @@ -414,9 +415,15 @@ write_packets(struct usbcap *p, const ui int ret; ret = write(p->wfd, &len, sizeof(int)); - assert(ret == sizeof(int)); + if (ret != sizeof(int)) { + err(EXIT_FAILURE, "Could not write length " + "field of USB data payload"); + } ret = write(p->wfd, data, datalen); - assert(ret == datalen); + if (ret != datalen) { + err(EXIT_FAILURE, "Could not write " + "complete USB data payload"); + } } static void @@ -429,14 +436,16 @@ read_file(struct usbcap *p) while ((ret = read(p->rfd, &datalen, sizeof(int))) == sizeof(int)) { datalen = le32toh(datalen); data = malloc(datalen); - assert(data != NULL); + if (data == NULL) + errx(EX_SOFTWARE, "Out of memory."); ret = read(p->rfd, data, datalen); - assert(ret == datalen); + if (ret != datalen) { + err(EXIT_FAILURE, "Could not read complete " + "USB data payload"); + } print_packets(data, datalen); free(data); } - if (ret == -1) - fprintf(stderr, "read: %s\n", strerror(errno)); } static void @@ -472,14 +481,27 @@ init_rfile(struct usbcap *p) p->rfd = open(r_arg, O_RDONLY); if (p->rfd < 0) { - fprintf(stderr, "open: %s (%s)\n", r_arg, strerror(errno)); - exit(EXIT_FAILURE); + err(EXIT_FAILURE, "Could not open " + "'%s' for read", r_arg); } ret = read(p->rfd, &uf, sizeof(uf)); - assert(ret == sizeof(uf)); - assert(le32toh(uf.magic) == USBCAP_FILEHDR_MAGIC); - assert(uf.major == 0); - assert(uf.minor == 2); + if (ret != sizeof(uf)) { + err(EXIT_FAILURE, "Could not read USB capture " + "file header"); + } + if (le32toh(uf.magic) != USBCAP_FILEHDR_MAGIC) { + errx(EX_SOFTWARE, "Invalid magic field(0x%08x) " + "in USB capture file header.", + (unsigned int)le32toh(uf.magic)); + } + if (uf.major != 0) { + errx(EX_SOFTWARE, "Invalid major version(%d) " + "field in USB capture file header.", (int)uf.major); + } + if (uf.minor != 2) { + errx(EX_SOFTWARE, "Invalid minor version(%d) " + "field in USB capture file header.", (int)uf.minor); + } } static void @@ -490,15 +512,18 @@ init_wfile(struct usbcap *p) p->wfd = open(w_arg, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR); if (p->wfd < 0) { - fprintf(stderr, "open: %s (%s)\n", w_arg, strerror(errno)); - exit(EXIT_FAILURE); + err(EXIT_FAILURE, "Could not open " + "'%s' for write", r_arg); } - bzero(&uf, sizeof(uf)); + memset(&uf, 0, sizeof(uf)); uf.magic = htole32(USBCAP_FILEHDR_MAGIC); uf.major = 0; uf.minor = 2; ret = write(p->wfd, (const void *)&uf, sizeof(uf)); - assert(ret == sizeof(uf)); + if (ret != sizeof(uf)) { + err(EXIT_FAILURE, "Could not write " + "USB capture header"); + } } static void @@ -507,13 +532,13 @@ usage(void) #define FMT " %-14s %s\n" fprintf(stderr, "usage: usbdump [options]\n"); - fprintf(stderr, FMT, "-i ifname", "Listen on USB bus interface"); - fprintf(stderr, FMT, "-r file", "Read the raw packets from file"); - fprintf(stderr, FMT, "-s snaplen", "Snapshot bytes from each packet"); - fprintf(stderr, FMT, "-v", "Increases the verbose level"); - fprintf(stderr, FMT, "-w file", "Write the raw packets to file"); + fprintf(stderr, FMT, "-i ", "Listen on USB bus interface"); + fprintf(stderr, FMT, "-r ", "Read the raw packets from file"); + fprintf(stderr, FMT, "-s ", "Snapshot bytes from each packet"); + fprintf(stderr, FMT, "-v", "Increase the verbose level"); + fprintf(stderr, FMT, "-w ", "Write the raw packets to file"); #undef FMT - exit(1); + exit(EX_USAGE); } int @@ -531,7 +556,7 @@ main(int argc, char *argv[]) int fd, o; const char *optstring; - bzero(&uc, sizeof(struct usbcap)); + memset(&uc, 0, sizeof(struct usbcap)); optstring = "i:r:s:vw:"; while ((o = getopt(argc, argv, optstring)) != -1) { @@ -571,20 +596,15 @@ main(int argc, char *argv[]) } p->fd = fd = open("/dev/bpf", O_RDONLY); - if (p->fd < 0) { - fprintf(stderr, "(no devices found)\n"); - return (EXIT_FAILURE); - } + if (p->fd < 0) + err(EXIT_FAILURE, "Could not open BPF device"); + + if (ioctl(fd, BIOCVERSION, (caddr_t)&bv) < 0) + err(EXIT_FAILURE, "BIOCVERSION ioctl failed"); - if (ioctl(fd, BIOCVERSION, (caddr_t)&bv) < 0) { - fprintf(stderr, "BIOCVERSION: %s\n", strerror(errno)); - return (EXIT_FAILURE); - } if (bv.bv_major != BPF_MAJOR_VERSION || - bv.bv_minor < BPF_MINOR_VERSION) { - fprintf(stderr, "kernel bpf filter out of date"); - return (EXIT_FAILURE); - } + bv.bv_minor < BPF_MINOR_VERSION) + errx(EXIT_FAILURE, "Kernel BPF filter out of date"); /* USB transfers can be greater than 64KByte */ v = 1U << 16; @@ -598,22 +618,16 @@ main(int argc, char *argv[]) if (ioctl(fd, BIOCSETIF, (caddr_t)&ifr) >= 0) break; } - if (v == 0) { - fprintf(stderr, "BIOCSBLEN: %s: No buffer size worked", i_arg); - return (EXIT_FAILURE); - } + if (v == 0) + errx(EXIT_FAILURE, "No buffer size worked."); - if (ioctl(fd, BIOCGBLEN, (caddr_t)&v) < 0) { - fprintf(stderr, "BIOCGBLEN: %s", strerror(errno)); - return (EXIT_FAILURE); - } + if (ioctl(fd, BIOCGBLEN, (caddr_t)&v) < 0) + err(EXIT_FAILURE, "BIOCGBLEN ioctl failed"); p->bufsize = v; p->buffer = (uint8_t *)malloc(p->bufsize); - if (p->buffer == NULL) { - fprintf(stderr, "malloc: %s", strerror(errno)); - return (EXIT_FAILURE); - } + if (p->buffer == NULL) + errx(EX_SOFTWARE, "Out of memory."); /* XXX no read filter rules yet so at this moment accept everything */ total_insn.code = (u_short)(BPF_RET | BPF_K); @@ -623,27 +637,21 @@ main(int argc, char *argv[]) total_prog.bf_len = 1; total_prog.bf_insns = &total_insn; - if (ioctl(p->fd, BIOCSETF, (caddr_t)&total_prog) < 0) { - fprintf(stderr, "BIOCSETF: %s", strerror(errno)); - return (EXIT_FAILURE); - } + if (ioctl(p->fd, BIOCSETF, (caddr_t)&total_prog) < 0) + err(EXIT_FAILURE, "BIOCSETF ioctl failed"); /* 1 second read timeout */ tv.tv_sec = 1; tv.tv_usec = 0; - if (ioctl(p->fd, BIOCSRTIMEOUT, (caddr_t)&tv) < 0) { - fprintf(stderr, "BIOCSRTIMEOUT: %s", strerror(errno)); - return (EXIT_FAILURE); - } + if (ioctl(p->fd, BIOCSRTIMEOUT, (caddr_t)&tv) < 0) + err(EXIT_FAILURE, "BIOCSRTIMEOUT ioctl failed"); (void)signal(SIGINT, handle_sigint); do_loop(p); - if (ioctl(fd, BIOCGSTATS, (caddr_t)&us) < 0) { - fprintf(stderr, "BIOCGSTATS: %s", strerror(errno)); - return (EXIT_FAILURE); - } + if (ioctl(fd, BIOCGSTATS, (caddr_t)&us) < 0) + err(EXIT_FAILURE, "BIOCGSTATS ioctl failed"); /* XXX what's difference between pkt_captured and us.us_recv? */ printf("\n"); From owner-svn-src-stable-8@FreeBSD.ORG Sat May 14 12:25:33 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85330106566C; Sat, 14 May 2011 12:25:33 +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 6A0218FC13; Sat, 14 May 2011 12:25:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4ECPXTe003447; Sat, 14 May 2011 12:25:33 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4ECPXCb003444; Sat, 14 May 2011 12:25:33 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201105141225.p4ECPXCb003444@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 14 May 2011 12:25:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221885 - in stable/8/sys/dev/usb: . serial X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 12:25:33 -0000 Author: hselasky Date: Sat May 14 12:25:33 2011 New Revision: 221885 URL: http://svn.freebsd.org/changeset/base/221885 Log: MFC r218229. Fix for detection of MTK 3329 GPS USB devices. Modified: stable/8/sys/dev/usb/serial/umodem.c stable/8/sys/dev/usb/usbdevs 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/serial/umodem.c ============================================================================== --- stable/8/sys/dev/usb/serial/umodem.c Sat May 14 12:22:58 2011 (r221884) +++ stable/8/sys/dev/usb/serial/umodem.c Sat May 14 12:25:33 2011 (r221885) @@ -197,6 +197,8 @@ static void *umodem_get_desc(struct usb_ static usb_error_t umodem_set_comm_feature(struct usb_device *, uint8_t, uint16_t, uint16_t); static void umodem_poll(struct ucom_softc *ucom); +static void umodem_find_data_iface(struct usb_attach_arg *uaa, + uint8_t, uint8_t *, uint8_t *); static const struct usb_config umodem_config[UMODEM_N_TRANSFER] = { @@ -311,13 +313,30 @@ umodem_attach(device_t dev) 0 - 1, UDESCSUB_CDC_UNION, 0 - 1); if ((cud == NULL) || (cud->bLength < sizeof(*cud))) { - device_printf(dev, "Missing descriptor. " + DPRINTF("Missing descriptor. " "Assuming data interface is next.\n"); - if (sc->sc_ctrl_iface_no == 0xFF) + if (sc->sc_ctrl_iface_no == 0xFF) { goto detach; - else - sc->sc_data_iface_no = - sc->sc_ctrl_iface_no + 1; + } else { + uint8_t class_match = 0; + + /* set default interface number */ + sc->sc_data_iface_no = 0xFF; + + /* try to find the data interface backwards */ + umodem_find_data_iface(uaa, + uaa->info.bIfaceIndex - 1, + &sc->sc_data_iface_no, &class_match); + + /* try to find the data interface forwards */ + umodem_find_data_iface(uaa, + uaa->info.bIfaceIndex + 1, + &sc->sc_data_iface_no, &class_match); + + /* check if nothing was found */ + if (sc->sc_data_iface_no == 0xFF) + goto detach; + } } else { sc->sc_data_iface_no = cud->bSlaveInterface[0]; } @@ -398,6 +417,36 @@ detach: } static void +umodem_find_data_iface(struct usb_attach_arg *uaa, + uint8_t iface_index, uint8_t *p_data_no, uint8_t *p_match_class) +{ + struct usb_interface_descriptor *id; + struct usb_interface *iface; + + iface = usbd_get_iface(uaa->device, iface_index); + + /* check for end of interfaces */ + if (iface == NULL) + return; + + id = usbd_get_interface_descriptor(iface); + + /* check for non-matching interface class */ + if (id->bInterfaceClass != UICLASS_CDC_DATA || + id->bInterfaceSubClass != UISUBCLASS_DATA) { + /* if we got a class match then return */ + if (*p_match_class) + return; + } else { + *p_match_class = 1; + } + + DPRINTFN(11, "Match at index %u\n", iface_index); + + *p_data_no = id->bInterfaceNumber; +} + +static void umodem_start_read(struct ucom_softc *ucom) { struct umodem_softc *sc = ucom->sc_parent; Modified: stable/8/sys/dev/usb/usbdevs ============================================================================== --- stable/8/sys/dev/usb/usbdevs Sat May 14 12:22:58 2011 (r221884) +++ stable/8/sys/dev/usb/usbdevs Sat May 14 12:25:33 2011 (r221885) @@ -536,6 +536,7 @@ vendor SPEEDDRAGON 0x0e55 Speed Dragon M vendor HAWKING 0x0e66 Hawking vendor FOSSIL 0x0e67 Fossil, Inc vendor GMATE 0x0e7e G.Mate, Inc +vendor MEDIATEK 0x0e8d MediaTek, Inc. vendor OTI 0x0ea0 Ours Technology vendor YISO 0x0eab Yiso Wireless Co. vendor PILOTECH 0x0eaf Pilotech @@ -2120,6 +2121,9 @@ product MCT DU_H3SP_USB232 0x0200 D-Link product MCT USB232 0x0210 USB-232 Interface product MCT SITECOM_USB232 0x0230 Sitecom USB-232 Products +/* MediaTek, Inc. */ +product MEDIATEK MTK3329 0x3329 MTK II GPS Receiver + /* Meizu Electronics */ product MEIZU M6_SL 0x0140 MiniPlayer M6 (SL) From owner-svn-src-stable-8@FreeBSD.ORG Sat May 14 20:51: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 07EEA106564A; Sat, 14 May 2011 20:51:18 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EAF5A8FC14; Sat, 14 May 2011 20:51:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4EKpH7V015232; Sat, 14 May 2011 20:51:17 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4EKpHd8015229; Sat, 14 May 2011 20:51:17 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201105142051.p4EKpHd8015229@svn.freebsd.org> From: Marius Strobl Date: Sat, 14 May 2011 20: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: r221916 - stable/8/sys/dev/mii X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 20:51:18 -0000 Author: marius Date: Sat May 14 20:51:17 2011 New Revision: 221916 URL: http://svn.freebsd.org/changeset/base/221916 Log: MFC: r221341, r221713 - Probe the PHY accompanying BCM57765. - Recognize BCM5719C PHY. Modified: stable/8/sys/dev/mii/brgphy.c stable/8/sys/dev/mii/miidevs Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/mii/brgphy.c ============================================================================== --- stable/8/sys/dev/mii/brgphy.c Sat May 14 20:48:23 2011 (r221915) +++ stable/8/sys/dev/mii/brgphy.c Sat May 14 20:51:17 2011 (r221916) @@ -142,6 +142,8 @@ static const struct mii_phydesc brgphys[ MII_PHY_DESC(xxBROADCOM_ALT1, BCM5761), MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709S), MII_PHY_DESC(xxBROADCOM_ALT2, BCM5717C), + MII_PHY_DESC(xxBROADCOM_ALT2, BCM5719C), + MII_PHY_DESC(xxBROADCOM_ALT2, BCM57765), MII_PHY_DESC(BROADCOM2, BCM5906), MII_PHY_END }; Modified: stable/8/sys/dev/mii/miidevs ============================================================================== --- stable/8/sys/dev/mii/miidevs Sat May 14 20:48:23 2011 (r221915) +++ stable/8/sys/dev/mii/miidevs Sat May 14 20:51:17 2011 (r221916) @@ -158,6 +158,8 @@ model xxBROADCOM_ALT1 BCM5709C 0x003c BC model xxBROADCOM_ALT1 BCM5761 0x003d BCM5761 10/100/1000baseTX PHY model xxBROADCOM_ALT1 BCM5709S 0x003f BCM5709S 1000/2500baseSX PHY model xxBROADCOM_ALT2 BCM5717C 0x0020 BCM5717C 10/100/1000baseTX PHY +model xxBROADCOM_ALT2 BCM5719C 0x0022 BCM5719C 10/100/1000baseTX PHY +model xxBROADCOM_ALT2 BCM57765 0x0024 BCM57765 10/100/1000baseTX PHY model BROADCOM2 BCM5906 0x0004 BCM5906 10/100baseTX PHY /* Cicada Semiconductor PHYs (now owned by Vitesse?) */ From owner-svn-src-stable-8@FreeBSD.ORG Sat May 14 21:03: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 75EDB1065672; Sat, 14 May 2011 21:03:44 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 631138FC13; Sat, 14 May 2011 21:03:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4EL3ik4015673; Sat, 14 May 2011 21:03:44 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4EL3iCc015665; Sat, 14 May 2011 21:03:44 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201105142103.p4EL3iCc015665@svn.freebsd.org> From: Marius Strobl Date: Sat, 14 May 2011 21:03: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: r221918 - in stable/8/sys/sparc64: include sparc64 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, 14 May 2011 21:03:44 -0000 Author: marius Date: Sat May 14 21:03:44 2011 New Revision: 221918 URL: http://svn.freebsd.org/changeset/base/221918 Log: MFC: r216803, r217058, r217514, r218457 On UltraSPARC-III+ and greater take advantage of ASI_ATOMIC_QUAD_LDD_PHYS, which takes an physical address instead of an virtual one, for loading TTEs of the kernel TSB so we no longer need to lock the kernel TSB into the dTLB, which only has a very limited number of lockable dTLB slots. The net result is that we now basically can handle a kernel TSB of any size and no longer need to limit the kernel address space based on the number of dTLB slots available for locked entries. Consequently, other parts of the trap handlers now also only access the the kernel TSB via its physical address in order to avoid nested traps, as does the PMAP bootstrap code as we haven't taken over the trap table at that point, yet. Apart from that the kernel TSB now is accessed via a direct mapping when we are otherwise taking advantage of ASI_ATOMIC_QUAD_LDD_PHYS so no further code changes are needed. Most of this is implemented by extending the patching of the TSB addresses and mask as well as the ASIs used to load it into the trap table so the runtime overhead of this change is rather low. Theoretically it should be possible to use the same approach also for the user TSB, which already is not locked into the dTLB, avoiding nested traps. However, for reasons I don't understand yet OpenSolaris only does that with SPARC64 CPUs. On the other hand I think that also addressing the user TSB physically and thus avoiding nested traps would get us closer to sharing this code with sun4v, which only supports trap level 0 and 1, so eventually we could have a single kernel which runs on both sun4u and sun4v (as does Linux and OpenBSD). Modified: stable/8/sys/sparc64/include/pmap.h stable/8/sys/sparc64/include/tsb.h stable/8/sys/sparc64/sparc64/exception.S stable/8/sys/sparc64/sparc64/genassym.c stable/8/sys/sparc64/sparc64/mp_machdep.c stable/8/sys/sparc64/sparc64/pmap.c stable/8/sys/sparc64/sparc64/tsb.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/sparc64/include/pmap.h ============================================================================== --- stable/8/sys/sparc64/include/pmap.h Sat May 14 20:51:19 2011 (r221917) +++ stable/8/sys/sparc64/include/pmap.h Sat May 14 21:03:44 2011 (r221918) @@ -61,16 +61,16 @@ struct pmap { struct mtx pm_mtx; struct tte *pm_tsb; vm_object_t pm_tsb_obj; - cpumask_t pm_active; + cpumask_t pm_active; u_int pm_context[MAXCPU]; struct pmap_statistics pm_stats; }; #define PMAP_LOCK(pmap) mtx_lock(&(pmap)->pm_mtx) -#define PMAP_LOCK_ASSERT(pmap, type) \ +#define PMAP_LOCK_ASSERT(pmap, type) \ mtx_assert(&(pmap)->pm_mtx, (type)) #define PMAP_LOCK_DESTROY(pmap) mtx_destroy(&(pmap)->pm_mtx) -#define PMAP_LOCK_INIT(pmap) mtx_init(&(pmap)->pm_mtx, "pmap", \ +#define PMAP_LOCK_INIT(pmap) mtx_init(&(pmap)->pm_mtx, "pmap", \ NULL, MTX_DEF | MTX_DUPOK) #define PMAP_LOCKED(pmap) mtx_owned(&(pmap)->pm_mtx) #define PMAP_MTX(pmap) (&(pmap)->pm_mtx) @@ -97,6 +97,7 @@ int pmap_protect_tte(struct pmap *pm1, s vm_offset_t va); void pmap_map_tsb(void); +void pmap_set_kctx(void); #define vtophys(va) pmap_kextract((vm_offset_t)(va)) @@ -112,7 +113,7 @@ SYSCTL_DECL(_debug_pmap_stats); #define PMAP_STATS_VAR(name) \ static long name; \ - SYSCTL_LONG(_debug_pmap_stats, OID_AUTO, name, CTLFLAG_RW, \ + SYSCTL_LONG(_debug_pmap_stats, OID_AUTO, name, CTLFLAG_RW, \ &name, 0, "") #define PMAP_STATS_INC(var) \ Modified: stable/8/sys/sparc64/include/tsb.h ============================================================================== --- stable/8/sys/sparc64/include/tsb.h Sat May 14 20:51:19 2011 (r221917) +++ stable/8/sys/sparc64/include/tsb.h Sat May 14 21:03:44 2011 (r221918) @@ -50,6 +50,7 @@ extern struct tte *tsb_kernel; extern vm_size_t tsb_kernel_mask; extern vm_size_t tsb_kernel_size; extern vm_paddr_t tsb_kernel_phys; +extern u_int tsb_kernel_ldd_phys; static __inline struct tte * tsb_vpntobucket(pmap_t pm, vm_offset_t vpn) Modified: stable/8/sys/sparc64/sparc64/exception.S ============================================================================== --- stable/8/sys/sparc64/sparc64/exception.S Sat May 14 20:51:19 2011 (r221917) +++ stable/8/sys/sparc64/sparc64/exception.S Sat May 14 21:03:44 2011 (r221918) @@ -75,8 +75,12 @@ __FBSDID("$FreeBSD$"); #include "assym.s" -#define TSB_KERNEL_MASK 0x0 -#define TSB_KERNEL 0x0 +#define TSB_ASI 0x0 +#define TSB_KERNEL 0x0 +#define TSB_KERNEL_MASK 0x0 +#define TSB_KERNEL_PHYS 0x0 +#define TSB_KERNEL_PHYS_END 0x0 +#define TSB_QUAD_LDD 0x0 .register %g2,#ignore .register %g3,#ignore @@ -84,19 +88,19 @@ __FBSDID("$FreeBSD$"); .register %g7,#ignore /* - * Atomically set the reference bit in a TTE. + * Atomically set a bit in a TTE. */ -#define TTE_SET_BIT(r1, r2, r3, bit) \ +#define TTE_SET_BIT(r1, r2, r3, bit, a, asi) \ add r1, TTE_DATA, r1 ; \ - ldx [r1], r2 ; \ + LD(x, a) [r1] asi, r2 ; \ 9: or r2, bit, r3 ; \ - casxa [r1] ASI_N, r2, r3 ; \ + CAS(x, a) [r1] asi, r2, r3 ; \ cmp r2, r3 ; \ bne,pn %xcc, 9b ; \ mov r3, r2 -#define TTE_SET_REF(r1, r2, r3) TTE_SET_BIT(r1, r2, r3, TD_REF) -#define TTE_SET_W(r1, r2, r3) TTE_SET_BIT(r1, r2, r3, TD_W) +#define TTE_SET_REF(r1, r2, r3, a, asi) TTE_SET_BIT(r1, r2, r3, TD_REF, a, asi) +#define TTE_SET_W(r1, r2, r3, a, asi) TTE_SET_BIT(r1, r2, r3, TD_W, a, asi) /* * Macros for spilling and filling live windows. @@ -691,7 +695,7 @@ ENTRY(tl0_immu_miss_set_ref) /* * Set the reference bit. */ - TTE_SET_REF(%g4, %g2, %g3) + TTE_SET_REF(%g4, %g2, %g3, a, ASI_N) /* * May have become invalid during casxa, in which case start over. @@ -849,7 +853,7 @@ ENTRY(tl0_dmmu_miss_set_ref) /* * Set the reference bit. */ - TTE_SET_REF(%g4, %g2, %g3) + TTE_SET_REF(%g4, %g2, %g3, a, ASI_N) /* * May have become invalid during casxa, in which case start over. @@ -997,7 +1001,7 @@ tl1_dmmu_prot_user: /* * Set the hardware write bit. */ - TTE_SET_W(%g4, %g2, %g3) + TTE_SET_W(%g4, %g2, %g3, a, ASI_N) /* * Delete the old TLB entry and clear the SFSR. @@ -1327,11 +1331,17 @@ END(tl1_sfsr_trap) * Compute the address of the TTE. The TSB mask and address of the * TSB are patched at startup. */ - .globl tl1_immu_miss_patch_1 -tl1_immu_miss_patch_1: + .globl tl1_immu_miss_patch_tsb_1 +tl1_immu_miss_patch_tsb_1: + sethi %uhi(TSB_KERNEL), %g6 + or %g6, %ulo(TSB_KERNEL), %g6 + sllx %g6, 32, %g6 + sethi %hi(TSB_KERNEL), %g7 + or %g7, %g6, %g7 + .globl tl1_immu_miss_patch_tsb_mask_1 +tl1_immu_miss_patch_tsb_mask_1: sethi %hi(TSB_KERNEL_MASK), %g6 or %g6, %lo(TSB_KERNEL_MASK), %g6 - sethi %hi(TSB_KERNEL), %g7 srlx %g5, TAR_VPN_SHIFT, %g5 and %g5, %g6, %g6 @@ -1341,7 +1351,9 @@ tl1_immu_miss_patch_1: /* * Load the TTE. */ - ldda [%g6] ASI_NUCLEUS_QUAD_LDD, %g6 /*, %g7 */ + .globl tl1_immu_miss_patch_quad_ldd_1 +tl1_immu_miss_patch_quad_ldd_1: + ldda [%g6] TSB_QUAD_LDD, %g6 /*, %g7 */ /* * Check that it's valid and executable and that the virtual page @@ -1375,11 +1387,17 @@ ENTRY(tl1_immu_miss_set_ref) * Recompute the TTE address, which we clobbered loading the TTE. * The TSB mask and address of the TSB are patched at startup. */ - .globl tl1_immu_miss_patch_2 -tl1_immu_miss_patch_2: + .globl tl1_immu_miss_patch_tsb_2 +tl1_immu_miss_patch_tsb_2: + sethi %uhi(TSB_KERNEL), %g6 + or %g6, %ulo(TSB_KERNEL), %g6 + sllx %g6, 32, %g6 + sethi %hi(TSB_KERNEL), %g7 + or %g7, %g6, %g7 + .globl tl1_immu_miss_patch_tsb_mask_2 +tl1_immu_miss_patch_tsb_mask_2: sethi %hi(TSB_KERNEL_MASK), %g6 or %g6, %lo(TSB_KERNEL_MASK), %g6 - sethi %hi(TSB_KERNEL), %g7 and %g5, %g6, %g5 sllx %g5, TTE_SHIFT, %g5 @@ -1388,7 +1406,10 @@ tl1_immu_miss_patch_2: /* * Set the reference bit. */ - TTE_SET_REF(%g5, %g6, %g7) + .globl tl1_immu_miss_patch_asi_1 +tl1_immu_miss_patch_asi_1: + wr %g0, TSB_ASI, %asi + TTE_SET_REF(%g5, %g6, %g7, a, %asi) /* * May have become invalid during casxa, in which case start over. @@ -1447,11 +1468,17 @@ END(tl1_immu_miss_trap) * Compute the address of the TTE. The TSB mask and address of the * TSB are patched at startup. */ - .globl tl1_dmmu_miss_patch_1 -tl1_dmmu_miss_patch_1: + .globl tl1_dmmu_miss_patch_tsb_1 +tl1_dmmu_miss_patch_tsb_1: + sethi %uhi(TSB_KERNEL), %g6 + or %g6, %ulo(TSB_KERNEL), %g6 + sllx %g6, 32, %g6 + sethi %hi(TSB_KERNEL), %g7 + or %g7, %g6, %g7 + .globl tl1_dmmu_miss_patch_tsb_mask_1 +tl1_dmmu_miss_patch_tsb_mask_1: sethi %hi(TSB_KERNEL_MASK), %g6 or %g6, %lo(TSB_KERNEL_MASK), %g6 - sethi %hi(TSB_KERNEL), %g7 srlx %g5, TAR_VPN_SHIFT, %g5 and %g5, %g6, %g6 @@ -1461,7 +1488,9 @@ tl1_dmmu_miss_patch_1: /* * Load the TTE. */ - ldda [%g6] ASI_NUCLEUS_QUAD_LDD, %g6 /*, %g7 */ + .globl tl1_dmmu_miss_patch_quad_ldd_1 +tl1_dmmu_miss_patch_quad_ldd_1: + ldda [%g6] TSB_QUAD_LDD, %g6 /*, %g7 */ /* * Check that it's valid and that the virtual page numbers match. @@ -1492,11 +1521,17 @@ ENTRY(tl1_dmmu_miss_set_ref) * Recompute the TTE address, which we clobbered loading the TTE. * The TSB mask and address of the TSB are patched at startup. */ - .globl tl1_dmmu_miss_patch_2 -tl1_dmmu_miss_patch_2: + .globl tl1_dmmu_miss_patch_tsb_mask_2 +tl1_dmmu_miss_patch_tsb_2: + sethi %uhi(TSB_KERNEL), %g6 + or %g6, %ulo(TSB_KERNEL), %g6 + sllx %g6, 32, %g6 + sethi %hi(TSB_KERNEL), %g7 + or %g7, %g6, %g7 + .globl tl1_dmmu_miss_patch_tsb_2 +tl1_dmmu_miss_patch_tsb_mask_2: sethi %hi(TSB_KERNEL_MASK), %g6 or %g6, %lo(TSB_KERNEL_MASK), %g6 - sethi %hi(TSB_KERNEL), %g7 and %g5, %g6, %g5 sllx %g5, TTE_SHIFT, %g5 @@ -1505,7 +1540,10 @@ tl1_dmmu_miss_patch_2: /* * Set the reference bit. */ - TTE_SET_REF(%g5, %g6, %g7) + .globl tl1_dmmu_miss_patch_asi_1 +tl1_dmmu_miss_patch_asi_1: + wr %g0, TSB_ASI, %asi + TTE_SET_REF(%g5, %g6, %g7, a, %asi) /* * May have become invalid during casxa, in which case start over. @@ -1545,15 +1583,42 @@ ENTRY(tl1_dmmu_miss_direct) * correspond to the TTE valid and page size bits are left set, so * they don't have to be included in the TTE bits below. We know they * are set because the virtual address is in the upper va hole. + * NB: if we are taking advantage of the ASI_ATOMIC_QUAD_LDD_PHYS + * and we get a miss on the directly accessed kernel TSB we must not + * set TD_CV in order to access it uniformly bypassing the D$. */ + setx TLB_DIRECT_ADDRESS_MASK, %g7, %g4 + and %g5, %g4, %g4 setx TLB_DIRECT_TO_TTE_MASK, %g7, %g6 and %g5, %g6, %g5 - or %g5, TD_CP | TD_CV | TD_W, %g5 + .globl tl1_dmmu_miss_direct_patch_tsb_phys_1 +tl1_dmmu_miss_direct_patch_tsb_phys_1: + sethi %uhi(TSB_KERNEL_PHYS), %g3 + or %g3, %ulo(TSB_KERNEL_PHYS), %g3 + sllx %g3, 32, %g3 + sethi %hi(TSB_KERNEL_PHYS), %g3 + or %g7, %g3, %g7 + cmp %g4, %g7 + bl,pt %xcc, 1f + or %g5, TD_CP | TD_W, %g5 + .globl tl1_dmmu_miss_direct_patch_tsb_phys_end_1 +tl1_dmmu_miss_direct_patch_tsb_phys_end_1: + sethi %uhi(TSB_KERNEL_PHYS_END), %g3 + or %g3, %ulo(TSB_KERNEL_PHYS_END), %g3 + sllx %g3, 32, %g3 + sethi %hi(TSB_KERNEL_PHYS_END), %g7 + or %g7, %g3, %g7 + cmp %g4, %g7 + bg,a,pt %xcc, 1f + nop + ba,pt %xcc, 2f + nop +1: or %g5, TD_CV, %g5 /* * Load the TTE data into the TLB and retry the instruction. */ - stxa %g5, [%g0] ASI_DTLB_DATA_IN_REG +2: stxa %g5, [%g0] ASI_DTLB_DATA_IN_REG retry END(tl1_dmmu_miss_direct) @@ -1584,11 +1649,17 @@ ENTRY(tl1_dmmu_prot_1) * Compute the address of the TTE. The TSB mask and address of the * TSB are patched at startup. */ - .globl tl1_dmmu_prot_patch_1 -tl1_dmmu_prot_patch_1: + .globl tl1_dmmu_prot_patch_tsb_1 +tl1_dmmu_prot_patch_tsb_1: + sethi %uhi(TSB_KERNEL), %g6 + or %g6, %ulo(TSB_KERNEL), %g6 + sllx %g6, 32, %g6 + sethi %hi(TSB_KERNEL), %g7 + or %g7, %g6, %g7 + .globl tl1_dmmu_prot_patch_tsb_mask_1 +tl1_dmmu_prot_patch_tsb_mask_1: sethi %hi(TSB_KERNEL_MASK), %g6 or %g6, %lo(TSB_KERNEL_MASK), %g6 - sethi %hi(TSB_KERNEL), %g7 srlx %g5, TAR_VPN_SHIFT, %g5 and %g5, %g6, %g6 @@ -1598,7 +1669,9 @@ tl1_dmmu_prot_patch_1: /* * Load the TTE. */ - ldda [%g6] ASI_NUCLEUS_QUAD_LDD, %g6 /*, %g7 */ + .globl tl1_dmmu_prot_patch_quad_ldd_1 +tl1_dmmu_prot_patch_quad_ldd_1: + ldda [%g6] TSB_QUAD_LDD, %g6 /*, %g7 */ /* * Check that it's valid and writeable and that the virtual page @@ -1625,12 +1698,17 @@ tl1_dmmu_prot_patch_1: * Recompute the TTE address, which we clobbered loading the TTE. * The TSB mask and address of the TSB are patched at startup. */ - .globl tl1_dmmu_prot_patch_2 -tl1_dmmu_prot_patch_2: + .globl tl1_dmmu_prot_patch_tsb_2 +tl1_dmmu_prot_patch_tsb_2: + sethi %uhi(TSB_KERNEL), %g6 + or %g6, %ulo(TSB_KERNEL), %g6 + sllx %g6, 32, %g6 + sethi %hi(TSB_KERNEL), %g7 + or %g7, %g6, %g7 + .globl tl1_dmmu_prot_patch_tsb_mask_2 +tl1_dmmu_prot_patch_tsb_mask_2: sethi %hi(TSB_KERNEL_MASK), %g6 or %g6, %lo(TSB_KERNEL_MASK), %g6 - sethi %hi(TSB_KERNEL), %g7 - and %g5, %g6, %g5 sllx %g5, TTE_SHIFT, %g5 add %g5, %g7, %g5 @@ -1638,7 +1716,10 @@ tl1_dmmu_prot_patch_2: /* * Set the hardware write bit. */ - TTE_SET_W(%g5, %g6, %g7) + .globl tl1_dmmu_prot_patch_asi_1 +tl1_dmmu_prot_patch_asi_1: + wr %g0, TSB_ASI, %asi + TTE_SET_W(%g5, %g6, %g7, a, %asi) /* * May have become invalid during casxa, in which case start over. Modified: stable/8/sys/sparc64/sparc64/genassym.c ============================================================================== --- stable/8/sys/sparc64/sparc64/genassym.c Sat May 14 20:51:19 2011 (r221917) +++ stable/8/sys/sparc64/sparc64/genassym.c Sat May 14 21:03:44 2011 (r221918) @@ -136,6 +136,7 @@ ASSYM(TS_MIN, TS_MIN); ASSYM(TS_MAX, TS_MAX); ASSYM(TLB_DAR_SLOT_SHIFT, TLB_DAR_SLOT_SHIFT); ASSYM(TLB_CXR_PGSZ_MASK, TLB_CXR_PGSZ_MASK); +ASSYM(TLB_DIRECT_ADDRESS_MASK, TLB_DIRECT_ADDRESS_MASK); ASSYM(TLB_DIRECT_TO_TTE_MASK, TLB_DIRECT_TO_TTE_MASK); ASSYM(TV_SIZE_BITS, TV_SIZE_BITS); #endif Modified: stable/8/sys/sparc64/sparc64/mp_machdep.c ============================================================================== --- stable/8/sys/sparc64/sparc64/mp_machdep.c Sat May 14 20:51:19 2011 (r221917) +++ stable/8/sys/sparc64/sparc64/mp_machdep.c Sat May 14 21:03:44 2011 (r221918) @@ -89,6 +89,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -437,8 +438,12 @@ cpu_mp_bootstrap(struct pcpu *pc) tick_clear(pc->pc_impl); tick_stop(pc->pc_impl); - /* Lock the kernel TSB in the TLB. */ - pmap_map_tsb(); + /* Set the kernel context. */ + pmap_set_kctx(); + + /* Lock the kernel TSB in the TLB if necessary. */ + if (tsb_kernel_ldd_phys == 0) + pmap_map_tsb(); /* * Flush all non-locked TLB entries possibly left over by the Modified: stable/8/sys/sparc64/sparc64/pmap.c ============================================================================== --- stable/8/sys/sparc64/sparc64/pmap.c Sat May 14 20:51:19 2011 (r221917) +++ stable/8/sys/sparc64/sparc64/pmap.c Sat May 14 21:03:44 2011 (r221918) @@ -151,6 +151,8 @@ struct pmap kernel_pmap_store; */ static vm_paddr_t pmap_bootstrap_alloc(vm_size_t size, uint32_t colors); +static void pmap_bootstrap_set_tte(struct tte *tp, u_long vpn, u_long data); + /* * Map the given physical page at the specified virtual address in the * target pmap with the protection requested. If specified the page @@ -161,12 +163,26 @@ static vm_paddr_t pmap_bootstrap_alloc(v static void pmap_enter_locked(pmap_t pm, vm_offset_t va, vm_page_t m, vm_prot_t prot, boolean_t wired); -extern int tl1_immu_miss_patch_1[]; -extern int tl1_immu_miss_patch_2[]; -extern int tl1_dmmu_miss_patch_1[]; -extern int tl1_dmmu_miss_patch_2[]; -extern int tl1_dmmu_prot_patch_1[]; -extern int tl1_dmmu_prot_patch_2[]; +extern int tl1_dmmu_miss_direct_patch_tsb_phys_1[]; +extern int tl1_dmmu_miss_direct_patch_tsb_phys_end_1[]; +extern int tl1_dmmu_miss_patch_asi_1[]; +extern int tl1_dmmu_miss_patch_quad_ldd_1[]; +extern int tl1_dmmu_miss_patch_tsb_1[]; +extern int tl1_dmmu_miss_patch_tsb_2[]; +extern int tl1_dmmu_miss_patch_tsb_mask_1[]; +extern int tl1_dmmu_miss_patch_tsb_mask_2[]; +extern int tl1_dmmu_prot_patch_asi_1[]; +extern int tl1_dmmu_prot_patch_quad_ldd_1[]; +extern int tl1_dmmu_prot_patch_tsb_1[]; +extern int tl1_dmmu_prot_patch_tsb_2[]; +extern int tl1_dmmu_prot_patch_tsb_mask_1[]; +extern int tl1_dmmu_prot_patch_tsb_mask_2[]; +extern int tl1_immu_miss_patch_asi_1[]; +extern int tl1_immu_miss_patch_quad_ldd_1[]; +extern int tl1_immu_miss_patch_tsb_1[]; +extern int tl1_immu_miss_patch_tsb_2[]; +extern int tl1_immu_miss_patch_tsb_mask_1[]; +extern int tl1_immu_miss_patch_tsb_mask_2[]; /* * If user pmap is processed with pmap_remove and with pmap_remove and the @@ -297,13 +313,21 @@ pmap_bootstrap(u_int cpu_impl) vm_size_t physsz; vm_size_t virtsz; u_long data; + u_long vpn; phandle_t pmem; phandle_t vmem; u_int dtlb_slots_avail; int i; int j; int sz; + uint32_t asi; uint32_t colors; + uint32_t ldd; + + /* + * Set the kernel context. + */ + pmap_set_kctx(); colors = dcache_color_ignore != 0 ? 1 : DCACHE_COLORS; @@ -350,40 +374,57 @@ pmap_bootstrap(u_int cpu_impl) /* * Calculate the size of kernel virtual memory, and the size and mask * for the kernel TSB based on the phsyical memory size but limited - * by the amount of dTLB slots available for locked entries (given - * that for spitfire-class CPUs all of the dt64 slots can hold locked - * entries but there is no large dTLB for unlocked ones, we don't use - * more than half of it for locked entries). - */ - dtlb_slots_avail = 0; - for (i = 0; i < dtlb_slots; i++) { - data = dtlb_get_data(i); - if ((data & (TD_V | TD_L)) != (TD_V | TD_L)) - dtlb_slots_avail++; - } + * by the amount of dTLB slots available for locked entries if we have + * to lock the TSB in the TLB (given that for spitfire-class CPUs all + * of the dt64 slots can hold locked entries but there is no large + * dTLB for unlocked ones, we don't use more than half of it for the + * TSB). + * Note that for reasons unknown OpenSolaris doesn't take advantage of + * ASI_ATOMIC_QUAD_LDD_PHYS on UltraSPARC-III. However, given that no + * public documentation is available for these, the latter just might + * not support it, yet. + */ + virtsz = roundup(physsz, PAGE_SIZE_4M << (PAGE_SHIFT - TTE_SHIFT)); + if (cpu_impl == CPU_IMPL_SPARC64V || + cpu_impl >= CPU_IMPL_ULTRASPARCIIIp) + tsb_kernel_ldd_phys = 1; + else { + dtlb_slots_avail = 0; + for (i = 0; i < dtlb_slots; i++) { + data = dtlb_get_data(i); + if ((data & (TD_V | TD_L)) != (TD_V | TD_L)) + dtlb_slots_avail++; + } #ifdef SMP - dtlb_slots_avail -= PCPU_PAGES; + dtlb_slots_avail -= PCPU_PAGES; #endif - if (cpu_impl >= CPU_IMPL_ULTRASPARCI && - cpu_impl < CPU_IMPL_ULTRASPARCIII) - dtlb_slots_avail /= 2; - virtsz = roundup(physsz, PAGE_SIZE_4M << (PAGE_SHIFT - TTE_SHIFT)); - virtsz = MIN(virtsz, - (dtlb_slots_avail * PAGE_SIZE_4M) << (PAGE_SHIFT - TTE_SHIFT)); + if (cpu_impl >= CPU_IMPL_ULTRASPARCI && + cpu_impl < CPU_IMPL_ULTRASPARCIII) + dtlb_slots_avail /= 2; + virtsz = MIN(virtsz, (dtlb_slots_avail * PAGE_SIZE_4M) << + (PAGE_SHIFT - TTE_SHIFT)); + } vm_max_kernel_address = VM_MIN_KERNEL_ADDRESS + virtsz; tsb_kernel_size = virtsz >> (PAGE_SHIFT - TTE_SHIFT); tsb_kernel_mask = (tsb_kernel_size >> TTE_SHIFT) - 1; /* - * Allocate the kernel TSB and lock it in the TLB. + * Allocate the kernel TSB and lock it in the TLB if necessary. */ pa = pmap_bootstrap_alloc(tsb_kernel_size, colors); if (pa & PAGE_MASK_4M) - panic("pmap_bootstrap: tsb unaligned\n"); + panic("pmap_bootstrap: TSB unaligned\n"); tsb_kernel_phys = pa; - tsb_kernel = (struct tte *)(VM_MIN_KERNEL_ADDRESS - tsb_kernel_size); - pmap_map_tsb(); - bzero(tsb_kernel, tsb_kernel_size); + if (tsb_kernel_ldd_phys == 0) { + tsb_kernel = + (struct tte *)(VM_MIN_KERNEL_ADDRESS - tsb_kernel_size); + pmap_map_tsb(); + bzero(tsb_kernel, tsb_kernel_size); + } else { + tsb_kernel = + (struct tte *)TLB_PHYS_TO_DIRECT(tsb_kernel_phys); + aszero(ASI_PHYS_USE_EC, tsb_kernel_phys, tsb_kernel_size); + } /* * Allocate and map the dynamic per-CPU area for the BSP. @@ -398,35 +439,99 @@ pmap_bootstrap(u_int cpu_impl) msgbufp = (struct msgbuf *)TLB_PHYS_TO_DIRECT(pa); /* - * Patch the virtual address and the tsb mask into the trap table. + * Patch the TSB addresses and mask as well as the ASIs used to load + * it into the trap table. */ -#define SETHI(rd, imm22) \ - (EIF_OP(IOP_FORM2) | EIF_F2_RD(rd) | EIF_F2_OP2(INS0_SETHI) | \ +#define LDDA_R_I_R(rd, imm_asi, rs1, rs2) \ + (EIF_OP(IOP_LDST) | EIF_F3_RD(rd) | EIF_F3_OP3(INS3_LDDA) | \ + EIF_F3_RS1(rs1) | EIF_F3_I(0) | EIF_F3_IMM_ASI(imm_asi) | \ + EIF_F3_RS2(rs2)) +#define OR_R_I_R(rd, imm13, rs1) \ + (EIF_OP(IOP_MISC) | EIF_F3_RD(rd) | EIF_F3_OP3(INS2_OR) | \ + EIF_F3_RS1(rs1) | EIF_F3_I(1) | EIF_IMM(imm13, 13)) +#define SETHI(rd, imm22) \ + (EIF_OP(IOP_FORM2) | EIF_F2_RD(rd) | EIF_F2_OP2(INS0_SETHI) | \ EIF_IMM((imm22) >> 10, 22)) -#define OR_R_I_R(rd, imm13, rs1) \ - (EIF_OP(IOP_MISC) | EIF_F3_RD(rd) | EIF_F3_OP3(INS2_OR) | \ +#define WR_R_I(rd, imm13, rs1) \ + (EIF_OP(IOP_MISC) | EIF_F3_RD(rd) | EIF_F3_OP3(INS2_WR) | \ EIF_F3_RS1(rs1) | EIF_F3_I(1) | EIF_IMM(imm13, 13)) -#define PATCH(addr) do { \ - if (addr[0] != SETHI(IF_F2_RD(addr[0]), 0x0) || \ - addr[1] != OR_R_I_R(IF_F3_RD(addr[1]), 0x0, IF_F3_RS1(addr[1])) || \ - addr[2] != SETHI(IF_F2_RD(addr[2]), 0x0)) \ - panic("pmap_boostrap: patched instructions have changed"); \ - addr[0] |= EIF_IMM((tsb_kernel_mask) >> 10, 22); \ - addr[1] |= EIF_IMM(tsb_kernel_mask, 10); \ - addr[2] |= EIF_IMM(((vm_offset_t)tsb_kernel) >> 10, 22); \ - flush(addr); \ - flush(addr + 1); \ - flush(addr + 2); \ +#define PATCH_ASI(addr, asi) do { \ + if (addr[0] != WR_R_I(IF_F3_RD(addr[0]), 0x0, \ + IF_F3_RS1(addr[0]))) \ + panic("%s: patched instructions have changed", \ + __func__); \ + addr[0] |= EIF_IMM((asi), 13); \ + flush(addr); \ +} while (0) + +#define PATCH_LDD(addr, asi) do { \ + if (addr[0] != LDDA_R_I_R(IF_F3_RD(addr[0]), 0x0, \ + IF_F3_RS1(addr[0]), IF_F3_RS2(addr[0]))) \ + panic("%s: patched instructions have changed", \ + __func__); \ + addr[0] |= EIF_F3_IMM_ASI(asi); \ + flush(addr); \ } while (0) - PATCH(tl1_immu_miss_patch_1); - PATCH(tl1_immu_miss_patch_2); - PATCH(tl1_dmmu_miss_patch_1); - PATCH(tl1_dmmu_miss_patch_2); - PATCH(tl1_dmmu_prot_patch_1); - PATCH(tl1_dmmu_prot_patch_2); +#define PATCH_TSB(addr, val) do { \ + if (addr[0] != SETHI(IF_F2_RD(addr[0]), 0x0) || \ + addr[1] != OR_R_I_R(IF_F3_RD(addr[1]), 0x0, \ + IF_F3_RS1(addr[1])) || \ + addr[3] != SETHI(IF_F2_RD(addr[3]), 0x0)) \ + panic("%s: patched instructions have changed", \ + __func__); \ + addr[0] |= EIF_IMM((val) >> 42, 22); \ + addr[1] |= EIF_IMM((val) >> 32, 10); \ + addr[3] |= EIF_IMM((val) >> 10, 22); \ + flush(addr); \ + flush(addr + 1); \ + flush(addr + 3); \ +} while (0) + +#define PATCH_TSB_MASK(addr, val) do { \ + if (addr[0] != SETHI(IF_F2_RD(addr[0]), 0x0) || \ + addr[1] != OR_R_I_R(IF_F3_RD(addr[1]), 0x0, \ + IF_F3_RS1(addr[1]))) \ + panic("%s: patched instructions have changed", \ + __func__); \ + addr[0] |= EIF_IMM((val) >> 10, 22); \ + addr[1] |= EIF_IMM((val), 10); \ + flush(addr); \ + flush(addr + 1); \ +} while (0) + + if (tsb_kernel_ldd_phys == 0) { + asi = ASI_N; + ldd = ASI_NUCLEUS_QUAD_LDD; + off = (vm_offset_t)tsb_kernel; + } else { + asi = ASI_PHYS_USE_EC; + ldd = ASI_ATOMIC_QUAD_LDD_PHYS; + off = (vm_offset_t)tsb_kernel_phys; + } + PATCH_TSB(tl1_dmmu_miss_direct_patch_tsb_phys_1, tsb_kernel_phys); + PATCH_TSB(tl1_dmmu_miss_direct_patch_tsb_phys_end_1, + tsb_kernel_phys + tsb_kernel_size - 1); + PATCH_ASI(tl1_dmmu_miss_patch_asi_1, asi); + PATCH_LDD(tl1_dmmu_miss_patch_quad_ldd_1, ldd); + PATCH_TSB(tl1_dmmu_miss_patch_tsb_1, off); + PATCH_TSB(tl1_dmmu_miss_patch_tsb_2, off); + PATCH_TSB_MASK(tl1_dmmu_miss_patch_tsb_mask_1, tsb_kernel_mask); + PATCH_TSB_MASK(tl1_dmmu_miss_patch_tsb_mask_2, tsb_kernel_mask); + PATCH_ASI(tl1_dmmu_prot_patch_asi_1, asi); + PATCH_LDD(tl1_dmmu_prot_patch_quad_ldd_1, ldd); + PATCH_TSB(tl1_dmmu_prot_patch_tsb_1, off); + PATCH_TSB(tl1_dmmu_prot_patch_tsb_2, off); + PATCH_TSB_MASK(tl1_dmmu_prot_patch_tsb_mask_1, tsb_kernel_mask); + PATCH_TSB_MASK(tl1_dmmu_prot_patch_tsb_mask_2, tsb_kernel_mask); + PATCH_ASI(tl1_immu_miss_patch_asi_1, asi); + PATCH_LDD(tl1_immu_miss_patch_quad_ldd_1, ldd); + PATCH_TSB(tl1_immu_miss_patch_tsb_1, off); + PATCH_TSB(tl1_immu_miss_patch_tsb_2, off); + PATCH_TSB_MASK(tl1_immu_miss_patch_tsb_mask_1, tsb_kernel_mask); + PATCH_TSB_MASK(tl1_immu_miss_patch_tsb_mask_2, tsb_kernel_mask); /* * Enter fake 8k pages for the 4MB kernel pages, so that @@ -437,9 +542,10 @@ pmap_bootstrap(u_int cpu_impl) va = kernel_tlbs[i].te_va; for (off = 0; off < PAGE_SIZE_4M; off += PAGE_SIZE) { tp = tsb_kvtotte(va + off); - tp->tte_vpn = TV_VPN(va + off, TS_8K); - tp->tte_data = TD_V | TD_8K | TD_PA(pa + off) | - TD_REF | TD_SW | TD_CP | TD_CV | TD_P | TD_W; + vpn = TV_VPN(va + off, TS_8K); + data = TD_V | TD_8K | TD_PA(pa + off) | TD_REF | + TD_SW | TD_CP | TD_CV | TD_P | TD_W; + pmap_bootstrap_set_tte(tp, vpn, data); } } @@ -480,9 +586,10 @@ pmap_bootstrap(u_int cpu_impl) pa = kstack0_phys + i * PAGE_SIZE; va = kstack0 + i * PAGE_SIZE; tp = tsb_kvtotte(va); - tp->tte_vpn = TV_VPN(va, TS_8K); - tp->tte_data = TD_V | TD_8K | TD_PA(pa) | TD_REF | TD_SW | - TD_CP | TD_CV | TD_P | TD_W; + vpn = TV_VPN(va, TS_8K); + data = TD_V | TD_8K | TD_PA(pa) | TD_REF | TD_SW | TD_CP | + TD_CV | TD_P | TD_W; + pmap_bootstrap_set_tte(tp, vpn, data); } /* @@ -522,9 +629,8 @@ pmap_bootstrap(u_int cpu_impl) off += PAGE_SIZE) { va = translations[i].om_start + off; tp = tsb_kvtotte(va); - tp->tte_vpn = TV_VPN(va, TS_8K); - tp->tte_data = - ((translations[i].om_tte & + vpn = TV_VPN(va, TS_8K); + data = ((translations[i].om_tte & ~((TD_SOFT2_MASK << TD_SOFT2_SHIFT) | (cpu_impl >= CPU_IMPL_ULTRASPARCI && cpu_impl < CPU_IMPL_ULTRASPARCIII ? @@ -532,6 +638,7 @@ pmap_bootstrap(u_int cpu_impl) (TD_RSVD_CH_MASK << TD_RSVD_CH_SHIFT)) | (TD_SOFT_MASK << TD_SOFT_SHIFT))) | TD_EXEC) + off; + pmap_bootstrap_set_tte(tp, vpn, data); } } @@ -566,20 +673,17 @@ pmap_bootstrap(u_int cpu_impl) tlb_flush_nonlocked(); } +/* + * Map the 4MB kernel TSB pages. + */ void pmap_map_tsb(void) { vm_offset_t va; vm_paddr_t pa; u_long data; - register_t s; int i; - s = intr_disable(); - - /* - * Map the 4MB TSB pages. - */ for (i = 0; i < tsb_kernel_size; i += PAGE_SIZE_4M) { va = (vm_offset_t)tsb_kernel + i; pa = tsb_kernel_phys + i; @@ -589,16 +693,19 @@ pmap_map_tsb(void) TLB_TAR_CTX(TLB_CTX_KERNEL)); stxa_sync(0, ASI_DTLB_DATA_IN_REG, data); } +} + +/* + * Set the secondary context to be the kernel context (needed for FP block + * operations in the kernel). + */ +void +pmap_set_kctx(void) +{ - /* - * Set the secondary context to be the kernel context (needed for - * FP block operations in the kernel). - */ stxa(AA_DMMU_SCXR, ASI_DMMU, (ldxa(AA_DMMU_SCXR, ASI_DMMU) & TLB_CXR_PGSZ_MASK) | TLB_CTX_KERNEL); flush(KERNBASE); - - intr_restore(s); } /* @@ -624,6 +731,27 @@ pmap_bootstrap_alloc(vm_size_t size, uin } /* + * Set a TTE. This function is intended as a helper when tsb_kernel is + * direct-mapped but we haven't taken over the trap table, yet, as it's the + * case when we are taking advantage of ASI_ATOMIC_QUAD_LDD_PHYS to access + * the kernel TSB. + */ +void +pmap_bootstrap_set_tte(struct tte *tp, u_long vpn, u_long data) +{ + + if (tsb_kernel_ldd_phys == 0) { + tp->tte_vpn = vpn; + tp->tte_data = data; + } else { + stxa((vm_paddr_t)tp + offsetof(struct tte, tte_vpn), + ASI_PHYS_USE_EC, vpn); + stxa((vm_paddr_t)tp + offsetof(struct tte, tte_data), + ASI_PHYS_USE_EC, data); + } +} + +/* * Initialize a vm_page's machine-dependent fields. */ void Modified: stable/8/sys/sparc64/sparc64/tsb.c ============================================================================== --- stable/8/sys/sparc64/sparc64/tsb.c Sat May 14 20:51:19 2011 (r221917) +++ stable/8/sys/sparc64/sparc64/tsb.c Sat May 14 21:03:44 2011 (r221918) @@ -26,9 +26,11 @@ * SUCH DAMAGE. * * from BSDI: pmap.c,v 1.28.2.15 2000/04/27 03:10:31 cp Exp - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + #include "opt_ddb.h" #include "opt_pmap.h" @@ -42,7 +44,7 @@ #include #include -#include +#include #include #include #include @@ -77,6 +79,7 @@ struct tte *tsb_kernel; vm_size_t tsb_kernel_mask; vm_size_t tsb_kernel_size; vm_paddr_t tsb_kernel_phys; +u_int tsb_kernel_ldd_phys; struct tte * tsb_tte_lookup(pmap_t pm, vm_offset_t va) From owner-svn-src-stable-8@FreeBSD.ORG Sat May 14 21:07: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 CCB9F106564A; Sat, 14 May 2011 21:07:51 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A14B08FC13; Sat, 14 May 2011 21:07:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4EL7p0Q015812; Sat, 14 May 2011 21:07:51 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4EL7pQ1015810; Sat, 14 May 2011 21:07:51 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201105142107.p4EL7pQ1015810@svn.freebsd.org> From: Marius Strobl Date: Sat, 14 May 2011 21:07: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: r221919 - stable/8/sys/sparc64/pci 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, 14 May 2011 21:07:51 -0000 Author: marius Date: Sat May 14 21:07:51 2011 New Revision: 221919 URL: http://svn.freebsd.org/changeset/base/221919 Log: MFC: r219785 - Make a panic message better reflect the actual problem. - A closer inspection of the OpenSolaris code indicates the block store workaround is only necessary in case of BUS_DMASYNC_POSTREAD. - Mark some unused parameters as such. Modified: stable/8/sys/sparc64/pci/fire.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/sparc64/pci/fire.c ============================================================================== --- stable/8/sys/sparc64/pci/fire.c Sat May 14 21:03:44 2011 (r221918) +++ stable/8/sys/sparc64/pci/fire.c Sat May 14 21:07:51 2011 (r221919) @@ -337,7 +337,7 @@ fire_attach(device_t dev) if (OF_getprop(node, "portid", &sc->sc_ign, sizeof(sc->sc_ign)) == -1) panic("%s: could not determine IGN", __func__); if (OF_getprop(node, "module-revision#", &prop, sizeof(prop)) == -1) - panic("%s: could not determine revision", __func__); + panic("%s: could not determine module-revision", __func__); device_printf(dev, "%s, module-revision %d, IGN %#x\n", desc->fd_name, prop, sc->sc_ign); @@ -1510,18 +1510,20 @@ fire_dmamap_sync(bus_dma_tag_t dt __unus static u_char buf[VIS_BLOCKSIZE] __aligned(VIS_BLOCKSIZE); register_t reg, s; - if ((map->dm_flags & DMF_LOADED) == 0 || - (op & ~BUS_DMASYNC_POSTWRITE) == 0) + if ((map->dm_flags & DMF_LOADED) == 0) return; - s = intr_disable(); - reg = rd(fprs); - wr(fprs, reg | FPRS_FEF, 0); - __asm __volatile("stda %%f0, [%0] %1" - : : "r" (buf), "n" (ASI_BLK_COMMIT_S)); - membar(Sync); - wr(fprs, reg, 0); - intr_restore(s); + if ((op & BUS_DMASYNC_POSTREAD) != 0) { + s = intr_disable(); + reg = rd(fprs); + wr(fprs, reg | FPRS_FEF, 0); + __asm __volatile("stda %%f0, [%0] %1" + : : "r" (buf), "n" (ASI_BLK_COMMIT_S)); + membar(Sync); + wr(fprs, reg, 0); + intr_restore(s); + } else if ((op & BUS_DMASYNC_PREWRITE) != 0) + membar(Sync); } static void @@ -2128,7 +2130,7 @@ fire_release_resource(device_t bus, devi } static bus_dma_tag_t -fire_get_dma_tag(device_t bus, device_t child) +fire_get_dma_tag(device_t bus, device_t child __unused) { struct fire_softc *sc; @@ -2137,7 +2139,7 @@ fire_get_dma_tag(device_t bus, device_t } static phandle_t -fire_get_node(device_t bus, device_t dev) +fire_get_node(device_t bus, device_t child __unused) { struct fire_softc *sc; From owner-svn-src-stable-8@FreeBSD.ORG Sat May 14 21:10: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 EF229106566B; Sat, 14 May 2011 21:10:13 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C37938FC08; Sat, 14 May 2011 21:10:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4ELADQX015985; Sat, 14 May 2011 21:10:13 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4ELADEj015983; Sat, 14 May 2011 21:10:13 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201105142110.p4ELADEj015983@svn.freebsd.org> From: Marius Strobl Date: Sat, 14 May 2011 21:10: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: r221921 - stable/8/sys/sparc64/pci 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, 14 May 2011 21:10:14 -0000 Author: marius Date: Sat May 14 21:10:13 2011 New Revision: 221921 URL: http://svn.freebsd.org/changeset/base/221921 Log: MFC: r218930 Resurrect ofw_pci_if.m from r178578. Added: stable/8/sys/sparc64/pci/ofw_pci_if.m - copied unchanged from r218930, head/sys/sparc64/pci/ofw_pci_if.m Modified: 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) Copied: stable/8/sys/sparc64/pci/ofw_pci_if.m (from r218930, head/sys/sparc64/pci/ofw_pci_if.m) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/sparc64/pci/ofw_pci_if.m Sat May 14 21:10:13 2011 (r221921, copy of r218930, head/sys/sparc64/pci/ofw_pci_if.m) @@ -0,0 +1,53 @@ +#- +# Copyright (c) 2001, 2003 by Thomas Moestl +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# $FreeBSD$ + +#include + +#include + +#include + +INTERFACE ofw_pci; + +CODE { + static ofw_pci_intr_pending_t ofw_pci_default_intr_pending; + + static int + ofw_pci_default_intr_pending(device_t dev, ofw_pci_intr_t intr) + { + + if (device_get_parent(dev) != NULL) + return (OFW_PCI_INTR_PENDING(device_get_parent(dev), + intr)); + return (0); + } +}; + +# Return whether an interrupt request is pending for the INO intr. +METHOD int intr_pending { + device_t dev; + ofw_pci_intr_t intr; +} DEFAULT ofw_pci_default_intr_pending; From owner-svn-src-stable-8@FreeBSD.ORG Sat May 14 21:12: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 72B151065672; Sat, 14 May 2011 21:12:00 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6038C8FC12; Sat, 14 May 2011 21:12:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4ELC0dj016156; Sat, 14 May 2011 21:12:00 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4ELC09d016139; Sat, 14 May 2011 21:12:00 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201105142112.p4ELC09d016139@svn.freebsd.org> From: Marius Strobl Date: Sat, 14 May 2011 21:12: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: r221923 - in stable/8/sys: conf sparc64/pci 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, 14 May 2011 21:12:00 -0000 Author: marius Date: Sat May 14 21:12:00 2011 New Revision: 221923 URL: http://svn.freebsd.org/changeset/base/221923 Log: MFC: r220038 - Merge the *_SET macros from fire(4) which generally print out the register changes when compiled with SCHIZO_DEBUG and take advantage of them. - Add support for the XMITS Fireplane/Safari to PCI-X bridges. I tought I'd need this for a Sun Fire 3800, which then turned out to not being equipped with such a bridge though. The support for these should be complete but given that it hasn't actually been tested probing is disabled for now. This required a way to alter the XMITS configuration in case a PCI-X device is found further down the device tree so the sparc64 specific ofw_pci kobj was revived with a ofw_pci_setup_device method, which is called by the ofw_pcibus code for every device added. - A closer inspection of the OpenSolaris code indicates that consistent DMA flushing/syncing as well as the block store workaround should be applied with every BUS_DMASYNC_POSTREAD instead of in a wrapper around interrupt handlers for devices behind PCI-PCI bridges only as suggested by the documentation (code for the latter actually exists in OpenSolaris but is disabled by default), which also makes more sense. - Add a workaround for Casinni/Skyhawk combinations. Chances are that this solves the crashes seen when using the the on-board Casinni NICs of Sun Fire V480 equipped with centerplanes other than 501-6780 or 501-6790. This also takes advantage of the ofw_pci_setup_device method. - Mark some unused parameters as such. Modified: stable/8/sys/conf/files.sparc64 stable/8/sys/conf/files.sun4v stable/8/sys/sparc64/pci/ofw_pci.h stable/8/sys/sparc64/pci/ofw_pci_if.m stable/8/sys/sparc64/pci/ofw_pcibus.c stable/8/sys/sparc64/pci/schizo.c stable/8/sys/sparc64/pci/schizoreg.h stable/8/sys/sparc64/pci/schizovar.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/conf/files.sparc64 ============================================================================== --- stable/8/sys/conf/files.sparc64 Sat May 14 21:10:19 2011 (r221922) +++ stable/8/sys/conf/files.sparc64 Sat May 14 21:12:00 2011 (r221923) @@ -79,6 +79,7 @@ sparc64/pci/fire.c optional pci sparc64/pci/ofw_pcib.c optional pci sparc64/pci/ofw_pcib_subr.c optional pci sparc64/pci/ofw_pcibus.c optional pci +sparc64/pci/ofw_pci_if.m optional pci sparc64/pci/psycho.c optional pci sparc64/pci/schizo.c optional pci sparc64/sbus/dma_sbus.c optional sbus Modified: stable/8/sys/conf/files.sun4v ============================================================================== --- stable/8/sys/conf/files.sun4v Sat May 14 21:10:19 2011 (r221922) +++ stable/8/sys/conf/files.sun4v Sat May 14 21:12:00 2011 (r221923) @@ -55,6 +55,7 @@ sun4v/sun4v/trap_trace.S optional trap_t sparc64/pci/ofw_pcib.c optional pci sparc64/pci/ofw_pcib_subr.c optional pci sparc64/pci/ofw_pcibus.c optional pci +sparc64/pci/ofw_pci_if.m optional pci # XXX hvcons should be optional sun4v/sun4v/hvcons.c standard Modified: stable/8/sys/sparc64/pci/ofw_pci.h ============================================================================== --- stable/8/sys/sparc64/pci/ofw_pci.h Sat May 14 21:10:19 2011 (r221922) +++ stable/8/sys/sparc64/pci/ofw_pci.h Sat May 14 21:12:00 2011 (r221923) @@ -64,6 +64,8 @@ #include +#include "ofw_pci_if.h" + typedef uint32_t ofw_pci_intr_t; /* PCI range child spaces. XXX: are these MI? */ Modified: stable/8/sys/sparc64/pci/ofw_pci_if.m ============================================================================== --- stable/8/sys/sparc64/pci/ofw_pci_if.m Sat May 14 21:10:19 2011 (r221922) +++ stable/8/sys/sparc64/pci/ofw_pci_if.m Sat May 14 21:12:00 2011 (r221923) @@ -1,5 +1,6 @@ #- # Copyright (c) 2001, 2003 by Thomas Moestl +# Copyright (c) 2011 Marius Strobl # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -26,28 +27,22 @@ #include -#include - -#include - INTERFACE ofw_pci; CODE { - static ofw_pci_intr_pending_t ofw_pci_default_intr_pending; + static ofw_pci_setup_device_t ofw_pci_default_setup_device; - static int - ofw_pci_default_intr_pending(device_t dev, ofw_pci_intr_t intr) + static void + ofw_pci_default_setup_device(device_t dev, device_t child) { if (device_get_parent(dev) != NULL) - return (OFW_PCI_INTR_PENDING(device_get_parent(dev), - intr)); - return (0); + OFW_PCI_SETUP_DEVICE(device_get_parent(dev), child); } }; -# Return whether an interrupt request is pending for the INO intr. -METHOD int intr_pending { +# Setup a device further upward in the tree. +METHOD void setup_device { device_t dev; - ofw_pci_intr_t intr; -} DEFAULT ofw_pci_default_intr_pending; + device_t child; +} DEFAULT ofw_pci_default_setup_device; Modified: stable/8/sys/sparc64/pci/ofw_pcibus.c ============================================================================== --- stable/8/sys/sparc64/pci/ofw_pcibus.c Sat May 14 21:10:19 2011 (r221922) +++ stable/8/sys/sparc64/pci/ofw_pcibus.c Sat May 14 21:12:00 2011 (r221923) @@ -277,6 +277,7 @@ ofw_pcibus_attach(device_t dev) continue; } pci_add_child(dev, (struct pci_devinfo *)dinfo); + OFW_PCI_SETUP_DEVICE(pcib, dinfo->opd_dinfo.cfg.dev); } return (bus_generic_attach(dev)); Modified: stable/8/sys/sparc64/pci/schizo.c ============================================================================== --- stable/8/sys/sparc64/pci/schizo.c Sat May 14 21:10:19 2011 (r221922) +++ stable/8/sys/sparc64/pci/schizo.c Sat May 14 21:12:00 2011 (r221923) @@ -1,7 +1,7 @@ /*- * Copyright (c) 1999, 2000 Matthew R. Green * Copyright (c) 2001 - 2003 by Thomas Moestl - * Copyright (c) 2005, 2007, 2008 by Marius Strobl + * Copyright (c) 2005 - 2011 by Marius Strobl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,8 +35,8 @@ __FBSDID("$FreeBSD$"); /* - * Driver for `Schizo' Fireplane/Safari to PCI 2.1 and `Tomatillo' JBus to - * PCI 2.2 bridges + * Driver for `Schizo' Fireplane/Safari to PCI 2.1, `Tomatillo' JBus to + * PCI 2.2 and `XMITS' Fireplane/Safari to PCI-X bridges */ #include "opt_ofw_pci.h" @@ -80,8 +80,10 @@ __FBSDID("$FreeBSD$"); static const struct schizo_desc *schizo_get_desc(device_t); static void schizo_set_intr(struct schizo_softc *, u_int, u_int, driver_filter_t); -static driver_filter_t schizo_dma_sync_stub; -static driver_filter_t ichip_dma_sync_stub; +static void schizo_dmamap_sync(bus_dma_tag_t dt, bus_dmamap_t map, + bus_dmasync_op_t op); +static void ichip_dmamap_sync(bus_dma_tag_t dt, bus_dmamap_t map, + bus_dmasync_op_t op); static void schizo_intr_enable(void *); static void schizo_intr_disable(void *); static void schizo_intr_assign(void *); @@ -109,18 +111,17 @@ static device_probe_t schizo_probe; static device_attach_t schizo_attach; static bus_read_ivar_t schizo_read_ivar; static bus_setup_intr_t schizo_setup_intr; -static bus_teardown_intr_t schizo_teardown_intr; static bus_alloc_resource_t schizo_alloc_resource; static bus_activate_resource_t schizo_activate_resource; static bus_deactivate_resource_t schizo_deactivate_resource; static bus_release_resource_t schizo_release_resource; -static bus_describe_intr_t schizo_describe_intr; static bus_get_dma_tag_t schizo_get_dma_tag; static pcib_maxslots_t schizo_maxslots; static pcib_read_config_t schizo_read_config; static pcib_write_config_t schizo_write_config; static pcib_route_interrupt_t schizo_route_interrupt; static ofw_bus_get_node_t schizo_get_node; +static ofw_pci_setup_device_t schizo_setup_device; static device_method_t schizo_methods[] = { /* Device interface */ @@ -134,12 +135,11 @@ static device_method_t schizo_methods[] DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_read_ivar, schizo_read_ivar), DEVMETHOD(bus_setup_intr, schizo_setup_intr), - DEVMETHOD(bus_teardown_intr, schizo_teardown_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), DEVMETHOD(bus_alloc_resource, schizo_alloc_resource), DEVMETHOD(bus_activate_resource, schizo_activate_resource), DEVMETHOD(bus_deactivate_resource, schizo_deactivate_resource), DEVMETHOD(bus_release_resource, schizo_release_resource), - DEVMETHOD(bus_describe_intr, schizo_describe_intr), DEVMETHOD(bus_get_dma_tag, schizo_get_dma_tag), /* pcib interface */ @@ -151,6 +151,9 @@ static device_method_t schizo_methods[] /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_node, schizo_get_node), + /* ofw_pci interface */ + DEVMETHOD(ofw_pci_setup_device, schizo_setup_device), + KOBJMETHOD_END }; @@ -177,25 +180,27 @@ struct schizo_icarg { bus_addr_t sica_clr; }; -struct schizo_dma_sync { - struct schizo_softc *sds_sc; - driver_filter_t *sds_handler; - void *sds_arg; - void *sds_cookie; - uint64_t sds_syncval; - device_t sds_ppb; /* farest PCI-PCI bridge */ - uint8_t sds_bus; /* bus of farest PCI dev. */ - uint8_t sds_slot; /* slot of farest PCI dev. */ - uint8_t sds_func; /* func. of farest PCI dev. */ -}; - #define SCHIZO_PERF_CNT_QLTY 100 +#define SCHIZO_SPC_BARRIER(spc, sc, offs, len, flags) \ + bus_barrier((sc)->sc_mem_res[(spc)], (offs), (len), (flags)) #define SCHIZO_SPC_READ_8(spc, sc, offs) \ bus_read_8((sc)->sc_mem_res[(spc)], (offs)) #define SCHIZO_SPC_WRITE_8(spc, sc, offs, v) \ bus_write_8((sc)->sc_mem_res[(spc)], (offs), (v)) +#ifndef SCHIZO_DEBUG +#define SCHIZO_SPC_SET(spc, sc, offs, reg, v) \ + SCHIZO_SPC_WRITE_8((spc), (sc), (offs), (v)) +#else +#define SCHIZO_SPC_SET(spc, sc, offs, reg, v) do { \ + device_printf((sc)->sc_dev, reg " 0x%016llx -> 0x%016llx\n", \ + (unsigned long long)SCHIZO_SPC_READ_8((spc), (sc), (offs)), \ + (unsigned long long)(v)); \ + SCHIZO_SPC_WRITE_8((spc), (sc), (offs), (v)); \ + } while (0) +#endif + #define SCHIZO_PCI_READ_8(sc, offs) \ SCHIZO_SPC_READ_8(STX_PCI, (sc), (offs)) #define SCHIZO_PCI_WRITE_8(sc, offs, v) \ @@ -213,6 +218,11 @@ struct schizo_dma_sync { #define SCHIZO_ICON_WRITE_8(sc, offs, v) \ SCHIZO_SPC_WRITE_8(STX_ICON, (sc), (offs), (v)) +#define SCHIZO_PCI_SET(sc, offs, v) \ + SCHIZO_SPC_SET(STX_PCI, (sc), (offs), # offs, (v)) +#define SCHIZO_CTRL_SET(sc, offs, v) \ + SCHIZO_SPC_SET(STX_CTRL, (sc), (offs), # offs, (v)) + struct schizo_desc { const char *sd_string; int sd_mode; @@ -221,6 +231,9 @@ struct schizo_desc { static const struct schizo_desc const schizo_compats[] = { { "pci108e,8001", SCHIZO_MODE_SCZ, "Schizo" }, +#if 0 + { "pci108e,8002", SCHIZO_MODE_XMS, "XMITS" }, +#endif { "pci108e,a801", SCHIZO_MODE_TOM, "Tomatillo" }, { NULL, 0, NULL } }; @@ -340,65 +353,70 @@ schizo_attach(device_t dev) if (OF_getprop(node, "version#", &sc->sc_ver, sizeof(sc->sc_ver)) == -1) panic("%s: could not determine version", __func__); + if (mode == SCHIZO_MODE_XMS && OF_getprop(node, "module-revision#", + &sc->sc_mrev, sizeof(sc->sc_mrev)) == -1) + panic("%s: could not determine module-revision", __func__); if (OF_getprop(node, "clock-frequency", &prop, sizeof(prop)) == -1) prop = 33000000; - device_printf(dev, "%s, version %d, IGN %#x, bus %c, %dMHz\n", - desc->sd_name, sc->sc_ver, sc->sc_ign, 'A' + sc->sc_half, - prop / 1000 / 1000); + if (mode == SCHIZO_MODE_XMS && (SCHIZO_PCI_READ_8(sc, STX_PCI_CTRL) & + XMS_PCI_CTRL_X_MODE) != 0) { + if (sc->sc_mrev < 1) + panic("PCI-X mode unsupported"); + sc->sc_flags |= SCHIZO_FLAGS_XMODE; + } + + device_printf(dev, "%s, version %d, ", desc->sd_name, sc->sc_ver); + if (mode == SCHIZO_MODE_XMS) + printf("module-revision %d, ", sc->sc_mrev); + printf("IGN %#x, bus %c, PCI%s mode, %dMHz\n", sc->sc_ign, + 'A' + sc->sc_half, (sc->sc_flags & SCHIZO_FLAGS_XMODE) != 0 ? + "-X" : "", prop / 1000 / 1000); /* Set up the PCI interrupt retry timer. */ -#ifdef SCHIZO_DEBUG - device_printf(dev, "PCI IRT 0x%016llx\n", (unsigned long long) - SCHIZO_PCI_READ_8(sc, STX_PCI_INTR_RETRY_TIM)); -#endif - SCHIZO_PCI_WRITE_8(sc, STX_PCI_INTR_RETRY_TIM, 5); + SCHIZO_PCI_SET(sc, STX_PCI_INTR_RETRY_TIM, 5); /* Set up the PCI control register. */ reg = SCHIZO_PCI_READ_8(sc, STX_PCI_CTRL); + reg &= ~(TOM_PCI_CTRL_DTO_IEN | STX_PCI_CTRL_ARB_PARK | + STX_PCI_CTRL_ARB_MASK); reg |= STX_PCI_CTRL_MMU_IEN | STX_PCI_CTRL_SBH_IEN | - STX_PCI_CTRL_ERR_IEN | STX_PCI_CTRL_ARB_MASK; - reg &= ~(TOM_PCI_CTRL_DTO_IEN | STX_PCI_CTRL_ARB_PARK); + STX_PCI_CTRL_ERR_IEN; if (OF_getproplen(node, "no-bus-parking") < 0) reg |= STX_PCI_CTRL_ARB_PARK; + if (mode == SCHIZO_MODE_XMS && sc->sc_mrev == 1) + reg |= XMS_PCI_CTRL_XMITS10_ARB_MASK; + else + reg |= STX_PCI_CTRL_ARB_MASK; if (mode == SCHIZO_MODE_TOM) { reg |= TOM_PCI_CTRL_PRM | TOM_PCI_CTRL_PRO | TOM_PCI_CTRL_PRL; if (sc->sc_ver <= 1) /* revision <= 2.0 */ reg |= TOM_PCI_CTRL_DTO_IEN; else reg |= STX_PCI_CTRL_PTO; + } else if (mode == SCHIZO_MODE_XMS) { + SCHIZO_PCI_SET(sc, XMS_PCI_PARITY_DETECT, 0x3fff); + SCHIZO_PCI_SET(sc, XMS_PCI_UPPER_RETRY_COUNTER, 0x3e8); + reg |= XMS_PCI_CTRL_X_ERRINT_EN; } -#ifdef SCHIZO_DEBUG - device_printf(dev, "PCI CSR 0x%016llx -> 0x%016llx\n", - (unsigned long long)SCHIZO_PCI_READ_8(sc, STX_PCI_CTRL), - (unsigned long long)reg); -#endif - SCHIZO_PCI_WRITE_8(sc, STX_PCI_CTRL, reg); + SCHIZO_PCI_SET(sc, STX_PCI_CTRL, reg); /* Set up the PCI diagnostic register. */ reg = SCHIZO_PCI_READ_8(sc, STX_PCI_DIAG); reg &= ~(SCZ_PCI_DIAG_RTRYARB_DIS | STX_PCI_DIAG_RETRY_DIS | STX_PCI_DIAG_INTRSYNC_DIS); -#ifdef SCHIZO_DEBUG - device_printf(dev, "PCI DR 0x%016llx -> 0x%016llx\n", - (unsigned long long)SCHIZO_PCI_READ_8(sc, STX_PCI_DIAG), - (unsigned long long)reg); -#endif - SCHIZO_PCI_WRITE_8(sc, STX_PCI_DIAG, reg); + SCHIZO_PCI_SET(sc, STX_PCI_DIAG, reg); /* * Enable DMA write parity error interrupts of version >= 7 (i.e. - * revision >= 2.5) Schizo. + * revision >= 2.5) Schizo and XMITS (enabling it on XMITS < 3.0 has + * no effect though). */ - if (mode == SCHIZO_MODE_SCZ && sc->sc_ver >= 7) { + if ((mode == SCHIZO_MODE_SCZ && sc->sc_ver >= 7) || + mode == SCHIZO_MODE_XMS) { reg = SCHIZO_PCI_READ_8(sc, SX_PCI_CFG_ICD); reg |= SX_PCI_CFG_ICD_DMAW_PERR_IEN; -#ifdef SCHIZO_DEBUG - device_printf(dev, "PCI CFG/ICD 0x%016llx -> 0x%016llx\n", - (unsigned long long)SCHIZO_PCI_READ_8(sc, SX_PCI_CFG_ICD), - (unsigned long long)reg); -#endif - SCHIZO_PCI_WRITE_8(sc, SX_PCI_CFG_ICD, reg); + SCHIZO_PCI_SET(sc, SX_PCI_CFG_ICD, reg); } /* @@ -406,7 +424,7 @@ schizo_attach(device_t dev) * Jalapeno bug). */ if (mode == SCHIZO_MODE_TOM) - SCHIZO_PCI_WRITE_8(sc, TOM_PCI_IOC_CSR, TOM_PCI_IOC_PW | + SCHIZO_PCI_SET(sc, TOM_PCI_IOC_CSR, TOM_PCI_IOC_PW | (1 << TOM_PCI_IOC_PREF_OFF_SHIFT) | TOM_PCI_IOC_CPRM | TOM_PCI_IOC_CPRO | TOM_PCI_IOC_CPRL); @@ -457,7 +475,7 @@ schizo_attach(device_t dev) * "pair" of Tomatillos, too. */ if (sc->sc_half == 0) { - SCHIZO_CTRL_WRITE_8(sc, STX_CTRL_PERF, + SCHIZO_CTRL_SET(sc, STX_CTRL_PERF, (STX_CTRL_PERF_DIS << STX_CTRL_PERF_CNT1_SHIFT) | (STX_CTRL_PERF_BUSCYC << STX_CTRL_PERF_CNT0_SHIFT)); tc = malloc(sizeof(*tc), M_DEVBUF, M_NOWAIT | M_ZERO); @@ -486,12 +504,15 @@ schizo_attach(device_t dev) * buffer, in Schizo version < 5 (i.e. revision < 2.3) it's * affected by several errata and basically unusable though. */ - sc->sc_is.is_flags = IOMMU_PRESERVE_PROM; - sc->sc_is.is_pmaxaddr = IOMMU_MAXADDR(STX_IOMMU_BITS); - sc->sc_is.is_sb[0] = sc->sc_is.is_sb[1] = 0; + memcpy(&sc->sc_dma_methods, &iommu_dma_methods, + sizeof(sc->sc_dma_methods)); + sc->sc_is.sis_sc = sc; + sc->sc_is.sis_is.is_flags = IOMMU_PRESERVE_PROM; + sc->sc_is.sis_is.is_pmaxaddr = IOMMU_MAXADDR(STX_IOMMU_BITS); + sc->sc_is.sis_is.is_sb[0] = sc->sc_is.sis_is.is_sb[1] = 0; if (OF_getproplen(node, "no-streaming-cache") < 0 && !(sc->sc_mode == SCHIZO_MODE_SCZ && sc->sc_ver < 5)) - sc->sc_is.is_sb[0] = STX_PCI_STRBUF; + sc->sc_is.sis_is.is_sb[0] = STX_PCI_STRBUF; #define TSBCASE(x) \ case (IOTSB_BASESZ << (x)) << (IO_PAGE_SHIFT - IOTTE_SHIFT): \ @@ -564,12 +585,13 @@ schizo_attach(device_t dev) sc->sc_pci_iot = schizo_alloc_bus_tag(sc, PCI_IO_BUS_SPACE); sc->sc_pci_cfgt = schizo_alloc_bus_tag(sc, PCI_CONFIG_BUS_SPACE); if (bus_dma_tag_create(bus_get_dma_tag(dev), 8, 0, - sc->sc_is.is_pmaxaddr, ~0, NULL, NULL, sc->sc_is.is_pmaxaddr, - 0xff, 0xffffffff, 0, NULL, NULL, &sc->sc_pci_dmat) != 0) + sc->sc_is.sis_is.is_pmaxaddr, ~0, NULL, NULL, + sc->sc_is.sis_is.is_pmaxaddr, 0xff, 0xffffffff, 0, NULL, NULL, + &sc->sc_pci_dmat) != 0) panic("%s: bus_dma_tag_create failed", __func__); /* Customize the tag. */ sc->sc_pci_dmat->dt_cookie = &sc->sc_is; - sc->sc_pci_dmat->dt_mt = &iommu_dma_methods; + sc->sc_pci_dmat->dt_mt = &sc->sc_dma_methods; /* * Get the bus range from the firmware. @@ -591,10 +613,8 @@ schizo_attach(device_t dev) PCIB_WRITE_CONFIG(dev, sc->sc_pci_secbus, STX_CS_DEVICE, STX_CS_FUNC, PCIR_STATUS, PCIB_READ_CONFIG(dev, sc->sc_pci_secbus, STX_CS_DEVICE, STX_CS_FUNC, PCIR_STATUS, 2), 2); - SCHIZO_PCI_WRITE_8(sc, STX_PCI_CTRL, - SCHIZO_PCI_READ_8(sc, STX_PCI_CTRL)); - SCHIZO_PCI_WRITE_8(sc, STX_PCI_AFSR, - SCHIZO_PCI_READ_8(sc, STX_PCI_AFSR)); + SCHIZO_PCI_SET(sc, STX_PCI_CTRL, SCHIZO_PCI_READ_8(sc, STX_PCI_CTRL)); + SCHIZO_PCI_SET(sc, STX_PCI_AFSR, SCHIZO_PCI_READ_8(sc, STX_PCI_AFSR)); /* * Establish handlers for interesting interrupts... @@ -671,9 +691,10 @@ schizo_attach(device_t dev) if ((sc->sc_mode == SCHIZO_MODE_SCZ && sc->sc_ver >= 5) || sc->sc_mode == SCHIZO_MODE_TOM || sc->sc_mode == SCHIZO_MODE_XMS) { - sc->sc_flags |= SCHIZO_FLAGS_CDMA; if (sc->sc_mode == SCHIZO_MODE_SCZ) { - sc->sc_cdma_state = SCHIZO_CDMA_STATE_DONE; + sc->sc_dma_methods.dm_dmamap_sync = + schizo_dmamap_sync; + sc->sc_cdma_state = SCHIZO_CDMA_STATE_IDLE; /* * Some firmware versions include the CDMA interrupt * at RID 4 but most don't. With the latter we add @@ -700,6 +721,14 @@ schizo_attach(device_t dev) &sc->sc_cdma_clr); schizo_set_intr(sc, 5, i, schizo_cdma); } + } else { + if (sc->sc_mode == SCHIZO_MODE_XMS) + mtx_init(&sc->sc_sync_mtx, "pcib_sync_mtx", + NULL, MTX_SPIN); + sc->sc_sync_val = 1ULL << (STX_PCIERR_A_INO + + sc->sc_half); + sc->sc_dma_methods.dm_dmamap_sync = + ichip_dmamap_sync; } if (sc->sc_mode == SCHIZO_MODE_TOM && sc->sc_ver <= 4) sc->sc_flags |= SCHIZO_FLAGS_BSWAR; @@ -820,7 +849,7 @@ static int schizo_pci_bus(void *arg) { struct schizo_softc *sc = arg; - uint64_t afar, afsr, csr, iommu; + uint64_t afar, afsr, csr, iommu, xstat; uint32_t status; u_int fatal; @@ -832,6 +861,10 @@ schizo_pci_bus(void *arg) afsr = SCHIZO_PCI_READ_8(sc, STX_PCI_AFSR); csr = SCHIZO_PCI_READ_8(sc, STX_PCI_CTRL); iommu = SCHIZO_PCI_READ_8(sc, STX_PCI_IOMMU); + if ((sc->sc_flags & SCHIZO_FLAGS_XMODE) != 0) + xstat = SCHIZO_PCI_READ_8(sc, XMS_PCI_X_ERR_STAT); + else + xstat = 0; status = PCIB_READ_CONFIG(sc->sc_dev, sc->sc_pci_secbus, STX_CS_DEVICE, STX_CS_FUNC, PCIR_STATUS, 2); @@ -858,14 +891,19 @@ schizo_pci_bus(void *arg) STX_PCI_AFSR_P_RTRY | STX_PCI_AFSR_P_PERR | STX_PCI_AFSR_P_TTO | STX_PCI_AFSR_P_UNUS)) != 0) fatal = 1; + if (xstat & (XMS_PCI_X_ERR_STAT_P_SC_DSCRD | + XMS_PCI_X_ERR_STAT_P_SC_TTO | XMS_PCI_X_ERR_STAT_P_SDSTAT | + XMS_PCI_X_ERR_STAT_P_SMMU | XMS_PCI_X_ERR_STAT_P_CDSTAT | + XMS_PCI_X_ERR_STAT_P_CMMU | XMS_PCI_X_ERR_STAT_PERR_RCV)) + fatal = 1; if (fatal == 0) sc->sc_stats_pci_non_fatal++; device_printf(sc->sc_dev, "PCI bus %c error AFAR %#llx AFSR %#llx " - "PCI CSR %#llx IOMMU %#llx STATUS %#llx\n", 'A' + sc->sc_half, - (unsigned long long)afar, (unsigned long long)afsr, - (unsigned long long)csr, (unsigned long long)iommu, - (unsigned long long)status); + "PCI CSR %#llx IOMMU %#llx PCI-X %#llx STATUS %#x\n", + 'A' + sc->sc_half, (unsigned long long)afar, + (unsigned long long)afsr, (unsigned long long)csr, + (unsigned long long)iommu, (unsigned long long)xstat, status); /* Clear the error bits that we caught. */ PCIB_WRITE_CONFIG(sc->sc_dev, sc->sc_pci_secbus, STX_CS_DEVICE, @@ -873,6 +911,8 @@ schizo_pci_bus(void *arg) SCHIZO_PCI_WRITE_8(sc, STX_PCI_CTRL, csr); SCHIZO_PCI_WRITE_8(sc, STX_PCI_AFSR, afsr); SCHIZO_PCI_WRITE_8(sc, STX_PCI_IOMMU, iommu); + if ((sc->sc_flags & SCHIZO_FLAGS_XMODE) != 0) + SCHIZO_PCI_WRITE_8(sc, XMS_PCI_X_ERR_STAT, xstat); mtx_unlock_spin(sc->sc_mtx); @@ -945,7 +985,7 @@ schizo_cdma(void *arg) { struct schizo_softc *sc = arg; - atomic_store_rel_32(&sc->sc_cdma_state, SCHIZO_CDMA_STATE_DONE); + atomic_store_rel_32(&sc->sc_cdma_state, SCHIZO_CDMA_STATE_RECEIVED); return (FILTER_HANDLED); } @@ -954,17 +994,18 @@ schizo_iommu_init(struct schizo_softc *s { /* Punch in our copies. */ - sc->sc_is.is_bustag = rman_get_bustag(sc->sc_mem_res[STX_PCI]); - sc->sc_is.is_bushandle = rman_get_bushandle(sc->sc_mem_res[STX_PCI]); - sc->sc_is.is_iommu = STX_PCI_IOMMU; - sc->sc_is.is_dtag = STX_PCI_IOMMU_TLB_TAG_DIAG; - sc->sc_is.is_ddram = STX_PCI_IOMMU_TLB_DATA_DIAG; - sc->sc_is.is_dqueue = STX_PCI_IOMMU_QUEUE_DIAG; - sc->sc_is.is_dva = STX_PCI_IOMMU_SVADIAG; - sc->sc_is.is_dtcmp = STX_PCI_IOMMU_TLB_CMP_DIAG; + sc->sc_is.sis_is.is_bustag = rman_get_bustag(sc->sc_mem_res[STX_PCI]); + sc->sc_is.sis_is.is_bushandle = + rman_get_bushandle(sc->sc_mem_res[STX_PCI]); + sc->sc_is.sis_is.is_iommu = STX_PCI_IOMMU; + sc->sc_is.sis_is.is_dtag = STX_PCI_IOMMU_TLB_TAG_DIAG; + sc->sc_is.sis_is.is_ddram = STX_PCI_IOMMU_TLB_DATA_DIAG; + sc->sc_is.sis_is.is_dqueue = STX_PCI_IOMMU_QUEUE_DIAG; + sc->sc_is.sis_is.is_dva = STX_PCI_IOMMU_SVADIAG; + sc->sc_is.sis_is.is_dtcmp = STX_PCI_IOMMU_TLB_CMP_DIAG; - iommu_init(device_get_nameunit(sc->sc_dev), &sc->sc_is, tsbsize, - dvmabase, 0); + iommu_init(device_get_nameunit(sc->sc_dev), + (struct iommu_state *)&sc->sc_is, tsbsize, dvmabase, 0); } static int @@ -1103,67 +1144,100 @@ schizo_read_ivar(device_t dev, device_t return (ENOENT); } -static int -schizo_dma_sync_stub(void *arg) +static void +schizo_dmamap_sync(bus_dma_tag_t dt, bus_dmamap_t map, bus_dmasync_op_t op) { struct timeval cur, end; - struct schizo_dma_sync *sds = arg; - struct schizo_softc *sc = sds->sds_sc; - uint32_t state; - - (void)PCIB_READ_CONFIG(sds->sds_ppb, sds->sds_bus, sds->sds_slot, - sds->sds_func, PCIR_VENDOR, 2); - for (; atomic_cmpset_acq_32(&sc->sc_cdma_state, - SCHIZO_CDMA_STATE_DONE, SCHIZO_CDMA_STATE_PENDING) == 0;) - ; - SCHIZO_PCI_WRITE_8(sc, sc->sc_cdma_clr, INTCLR_RECEIVED); - microuptime(&cur); - end.tv_sec = 1; - end.tv_usec = 0; - timevaladd(&end, &cur); - for (; (state = atomic_load_32(&sc->sc_cdma_state)) != - SCHIZO_CDMA_STATE_DONE && timevalcmp(&cur, &end, <=);) + struct schizo_iommu_state *sis = dt->dt_cookie; + struct schizo_softc *sc = sis->sis_sc; + int res; + + if ((map->dm_flags & DMF_STREAMED) != 0) { + iommu_dma_methods.dm_dmamap_sync(dt, map, op); + return; + } + + if ((map->dm_flags & DMF_LOADED) == 0) + return; + + if ((op & BUS_DMASYNC_POSTREAD) != 0) { + /* + * Note that in order to allow this function to be called from + * filters we would need to use a spin mutex for serialization + * but given that these disable interrupts we have to emulate + * one. + */ + for (; atomic_cmpset_acq_32(&sc->sc_cdma_state, + SCHIZO_CDMA_STATE_IDLE, SCHIZO_CDMA_STATE_PENDING) == 0;) + ; + SCHIZO_PCI_WRITE_8(sc, sc->sc_cdma_clr, INTCLR_RECEIVED); microuptime(&cur); - if (state != SCHIZO_CDMA_STATE_DONE) - panic("%s: DMA does not sync", __func__); - return (sds->sds_handler(sds->sds_arg)); + end.tv_sec = 1; + end.tv_usec = 0; + timevaladd(&end, &cur); + for (; (res = atomic_cmpset_rel_32(&sc->sc_cdma_state, + SCHIZO_CDMA_STATE_RECEIVED, SCHIZO_CDMA_STATE_IDLE)) == + 0 && timevalcmp(&cur, &end, <=);) + microuptime(&cur); + if (res == 0) + panic("%s: DMA does not sync", __func__); + } + + if ((op & BUS_DMASYNC_PREWRITE) != 0) + membar(Sync); } #define VIS_BLOCKSIZE 64 -static int -ichip_dma_sync_stub(void *arg) +static void +ichip_dmamap_sync(bus_dma_tag_t dt, bus_dmamap_t map, bus_dmasync_op_t op) { static u_char buf[VIS_BLOCKSIZE] __aligned(VIS_BLOCKSIZE); struct timeval cur, end; - struct schizo_dma_sync *sds = arg; - struct schizo_softc *sc = sds->sds_sc; + struct schizo_iommu_state *sis = dt->dt_cookie; + struct schizo_softc *sc = sis->sis_sc; register_t reg, s; - (void)PCIB_READ_CONFIG(sds->sds_ppb, sds->sds_bus, sds->sds_slot, - sds->sds_func, PCIR_VENDOR, 2); - SCHIZO_PCI_WRITE_8(sc, TOMXMS_PCI_DMA_SYNC_PEND, sds->sds_syncval); - microuptime(&cur); - end.tv_sec = 1; - end.tv_usec = 0; - timevaladd(&end, &cur); - for (; ((reg = SCHIZO_PCI_READ_8(sc, TOMXMS_PCI_DMA_SYNC_PEND)) & - sds->sds_syncval) != 0 && timevalcmp(&cur, &end, <=);) + if ((map->dm_flags & DMF_STREAMED) != 0) { + iommu_dma_methods.dm_dmamap_sync(dt, map, op); + return; + } + + if ((map->dm_flags & DMF_LOADED) == 0) + return; + + if ((op & BUS_DMASYNC_POSTREAD) != 0) { + if (sc->sc_mode == SCHIZO_MODE_XMS) + mtx_lock_spin(&sc->sc_sync_mtx); + SCHIZO_PCI_WRITE_8(sc, TOMXMS_PCI_DMA_SYNC_PEND, + sc->sc_sync_val); microuptime(&cur); - if ((reg & sds->sds_syncval) != 0) - panic("%s: DMA does not sync", __func__); + end.tv_sec = 1; + end.tv_usec = 0; + timevaladd(&end, &cur); + for (; ((reg = SCHIZO_PCI_READ_8(sc, + TOMXMS_PCI_DMA_SYNC_PEND)) & sc->sc_sync_val) != 0 && + timevalcmp(&cur, &end, <=);) + microuptime(&cur); + if ((reg & sc->sc_sync_val) != 0) + panic("%s: DMA does not sync", __func__); + if (sc->sc_mode == SCHIZO_MODE_XMS) + mtx_unlock_spin(&sc->sc_sync_mtx); + else if ((sc->sc_flags & SCHIZO_FLAGS_BSWAR) != 0) { + s = intr_disable(); + reg = rd(fprs); + wr(fprs, reg | FPRS_FEF, 0); + __asm __volatile("stda %%f0, [%0] %1" + : : "r" (buf), "n" (ASI_BLK_COMMIT_S)); + membar(Sync); + wr(fprs, reg, 0); + intr_restore(s); + return; + } + } - if ((sc->sc_flags & SCHIZO_FLAGS_BSWAR) != 0) { - s = intr_disable(); - reg = rd(fprs); - wr(fprs, reg | FPRS_FEF, 0); - __asm __volatile("stda %%f0, [%0] %1" - : : "r" (buf), "n" (ASI_BLK_COMMIT_S)); + if ((op & BUS_DMASYNC_PREWRITE) != 0) membar(Sync); - wr(fprs, reg, 0); - intr_restore(s); - } - return (sds->sds_handler(sds->sds_arg)); } static void @@ -1209,12 +1283,9 @@ schizo_setup_intr(device_t dev, device_t int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep) { - devclass_t pci_devclass; - device_t cdev, pdev, pcidev; - struct schizo_dma_sync *sds; struct schizo_softc *sc; u_long vec; - int error, found; + int error; sc = device_get_softc(dev); /* @@ -1252,112 +1323,10 @@ schizo_setup_intr(device_t dev, device_t "invalid interrupt controller for vector 0x%lx\n", vec); return (EINVAL); } - - /* - * Install a a wrapper for CDMA flushing/syncing for devices - * behind PCI-PCI bridges if possible. - */ - pcidev = NULL; - found = 0; - pci_devclass = devclass_find("pci"); - for (cdev = child; cdev != dev; cdev = pdev) { - pdev = device_get_parent(cdev); - if (pcidev == NULL) { - if (device_get_devclass(pdev) != pci_devclass) - continue; - pcidev = cdev; - continue; - } - if (pci_get_class(cdev) == PCIC_BRIDGE && - pci_get_subclass(cdev) == PCIS_BRIDGE_PCI) - found = 1; - } - if ((sc->sc_flags & SCHIZO_FLAGS_CDMA) != 0) { - sds = malloc(sizeof(*sds), M_DEVBUF, M_NOWAIT | M_ZERO); - if (sds == NULL) - return (ENOMEM); - if (found != 0 && pcidev != NULL) { - sds->sds_sc = sc; - sds->sds_arg = arg; - sds->sds_ppb = - device_get_parent(device_get_parent(pcidev)); - sds->sds_bus = pci_get_bus(pcidev); - sds->sds_slot = pci_get_slot(pcidev); - sds->sds_func = pci_get_function(pcidev); - sds->sds_syncval = 1ULL << INTINO(vec); - if (bootverbose) - device_printf(dev, "installed DMA sync " - "wrapper for device %d.%d on bus %d\n", - sds->sds_slot, sds->sds_func, - sds->sds_bus); - -#define DMA_SYNC_STUB \ - (sc->sc_mode == SCHIZO_MODE_SCZ ? schizo_dma_sync_stub : \ - ichip_dma_sync_stub) - - if (intr == NULL) { - sds->sds_handler = filt; - error = bus_generic_setup_intr(dev, child, - ires, flags, DMA_SYNC_STUB, intr, sds, - cookiep); - } else { - sds->sds_handler = (driver_filter_t *)intr; - error = bus_generic_setup_intr(dev, child, - ires, flags, filt, (driver_intr_t *) - DMA_SYNC_STUB, sds, cookiep); - } - -#undef DMA_SYNC_STUB - - } else - error = bus_generic_setup_intr(dev, child, ires, - flags, filt, intr, arg, cookiep); - if (error != 0) { - free(sds, M_DEVBUF); - return (error); - } - sds->sds_cookie = *cookiep; - *cookiep = sds; - return (error); - } else if (found != 0) - device_printf(dev, "WARNING: using devices behind PCI-PCI " - "bridges may cause data corruption\n"); return (bus_generic_setup_intr(dev, child, ires, flags, filt, intr, arg, cookiep)); } -static int -schizo_teardown_intr(device_t dev, device_t child, struct resource *vec, - void *cookie) -{ - struct schizo_dma_sync *sds; - struct schizo_softc *sc; - int error; - - sc = device_get_softc(dev); - if ((sc->sc_flags & SCHIZO_FLAGS_CDMA) != 0) { - sds = cookie; - error = bus_generic_teardown_intr(dev, child, vec, - sds->sds_cookie); - if (error == 0) - free(sds, M_DEVBUF); - return (error); - } - return (bus_generic_teardown_intr(dev, child, vec, cookie)); -} - -static int -schizo_describe_intr(device_t dev, device_t child, struct resource *vec, - void *cookie, const char *descr) -{ - struct schizo_softc *sc; - - sc = device_get_softc(dev); - if ((sc->sc_flags & SCHIZO_FLAGS_CDMA) != 0) - cookie = ((struct schizo_dma_sync *)cookie)->sds_cookie; - return (bus_generic_describe_intr(dev, child, vec, cookie, descr)); -} - static struct resource * schizo_alloc_resource(device_t bus, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags) @@ -1476,7 +1445,7 @@ schizo_release_resource(device_t bus, de } static bus_dma_tag_t -schizo_get_dma_tag(device_t bus, device_t child) +schizo_get_dma_tag(device_t bus, device_t child __unused) { struct schizo_softc *sc; @@ -1485,7 +1454,7 @@ schizo_get_dma_tag(device_t bus, device_ } static phandle_t -schizo_get_node(device_t bus, device_t dev) +schizo_get_node(device_t bus, device_t child __unused) { struct schizo_softc *sc; @@ -1494,6 +1463,42 @@ schizo_get_node(device_t bus, device_t d return (sc->sc_node); } +static void +schizo_setup_device(device_t bus, device_t child) +{ + struct schizo_softc *sc; + uint64_t reg; + int capreg; + + sc = device_get_softc(bus); + /* + * Disable bus parking in order to work around a bus hang caused by + * Casinni/Skyhawk combinations. + */ + if (OF_getproplen(ofw_bus_get_node(child), "pci-req-removal") >= 0) + SCHIZO_PCI_SET(sc, STX_PCI_CTRL, SCHIZO_PCI_READ_8(sc, + STX_PCI_CTRL) & ~STX_PCI_CTRL_ARB_PARK); + + if (sc->sc_mode == SCHIZO_MODE_XMS) { + /* XMITS NCPQ WAR: set outstanding split transactions to 1. */ + if ((sc->sc_flags & SCHIZO_FLAGS_XMODE) != 0 && + (pci_read_config(child, PCIR_HDRTYPE, 1) & + PCIM_HDRTYPE) != PCIM_HDRTYPE_BRIDGE && + pci_find_cap(child, PCIY_PCIX, &capreg) == 0) + pci_write_config(child, capreg + PCIXR_COMMAND, + pci_read_config(child, capreg + PCIXR_COMMAND, + 2) & 0x7c, 2); + /* XMITS 3.x WAR: set BUGCNTL iff value is unexpected. */ + if (sc->sc_mrev >= 4) { + reg = ((sc->sc_flags & SCHIZO_FLAGS_XMODE) != 0 ? + 0xa0UL : 0xffUL) << XMS_PCI_X_DIAG_BUGCNTL_SHIFT; + if ((SCHIZO_PCI_READ_8(sc, XMS_PCI_X_DIAG) & + XMS_PCI_X_DIAG_BUGCNTL_MASK) != reg) + SCHIZO_PCI_SET(sc, XMS_PCI_X_DIAG, reg); + } + } +} + static bus_space_tag_t schizo_alloc_bus_tag(struct schizo_softc *sc, int type) { Modified: stable/8/sys/sparc64/pci/schizoreg.h ============================================================================== --- stable/8/sys/sparc64/pci/schizoreg.h Sat May 14 21:10:19 2011 (r221922) +++ stable/8/sys/sparc64/pci/schizoreg.h Sat May 14 21:12:00 2011 (r221923) @@ -55,9 +55,13 @@ #define STX_PCI_AFSR 0x02010 #define STX_PCI_AFAR 0x02018 #define STX_PCI_DIAG 0x02020 +#define XMS_PCI_PARITY_DETECT 0x02040 #define TOM_PCI_IOC_CSR 0x02248 #define TOM_PCI_IOC_TAG 0x02290 #define TOM_PCI_IOC_DATA 0x02290 +#define XMS_PCI_X_ERR_STAT 0x02300 +#define XMS_PCI_X_DIAG 0x02308 +#define XMS_PCI_UPPER_RETRY_COUNTER 0x02310 #define STX_PCI_STRBUF 0x02800 #define STX_PCI_STRBUF_CTXFLUSH 0x02818 #define STX_PCI_IOMMU_SVADIAG 0x0a400 @@ -68,7 +72,7 @@ #define STX_PCI_IOBIO_DIAG 0x0a808 #define STX_PCI_STRBUF_CTXMATCH 0x10000 -/* PCI configuration/idle check diagnostic registers */ +/* PCI configuration/idle check diagnostic register */ #define SX_PCI_CFG_ICD_PCI_2_0_COMPAT 0x0000000000008000ULL #define SX_PCI_CFG_ICD_DMAW_PERR_IEN 0x0000000000004000ULL #define SX_PCI_CFG_ICD_IFC_NOT_IDLE 0x0000000000000010ULL @@ -77,7 +81,7 @@ #define SX_PCI_CFG_ICD_PBM_NOT_IDLE 0x0000000000000002ULL #define SX_PCI_CFG_ICD_STC_NOT_IDLE 0x0000000000000001ULL -/* PCI IOMMU control registers */ +/* PCI IOMMU control register */ #define TOM_PCI_IOMMU_ERR_BAD_VA 0x0000000010000000ULL #define TOM_PCI_IOMMU_ERR_ILLTSBTBW 0x0000000008000000ULL #define TOM_PCI_IOMMU_ECC_ERR 0x0000000006000000ULL @@ -94,6 +98,7 @@ #define TOM_PCI_CTRL_DTO_ERR 0x4000000000000000ULL #define TOM_PCI_CTRL_DTO_IEN 0x2000000000000000ULL #define SCZ_PCI_CTRL_ESLCK 0x0008000000000000ULL +#define XMS_PCI_CTRL_DMA_WR_PERR 0x0008000000000000ULL #define SCZ_PCI_CTRL_ERRSLOT 0x0007000000000000ULL #define STX_PCI_CTRL_TTO_ERR 0x0000004000000000ULL #define STX_PCI_CTRL_RTRY_ERR 0x0000002000000000ULL @@ -101,16 +106,19 @@ #define SCZ_PCI_CTRL_SBH_ERR 0x0000000800000000ULL #define STX_PCI_CTRL_SERR 0x0000000400000000ULL #define SCZ_PCI_CTRL_PCISPD 0x0000000200000000ULL +#define XMS_PCI_CTRL_X_MODE 0x0000000100000000ULL #define TOM_PCI_CTRL_PRM 0x0000000040000000ULL #define TOM_PCI_CTRL_PRO 0x0000000020000000ULL #define TOM_PCI_CTRL_PRL 0x0000000010000000ULL #define STX_PCI_CTRL_PTO 0x0000000003000000ULL +#define XMS_PCI_CTRL_X_ERRINT_EN 0x0000000000100000ULL #define STX_PCI_CTRL_MMU_IEN 0x0000000000080000ULL #define STX_PCI_CTRL_SBH_IEN 0x0000000000040000ULL #define STX_PCI_CTRL_ERR_IEN 0x0000000000020000ULL #define STX_PCI_CTRL_ARB_PARK 0x0000000000010000ULL #define SCZ_PCI_CTRL_PCIRST 0x0000000000000100ULL #define STX_PCI_CTRL_ARB_MASK 0x00000000000000ffULL +#define XMS_PCI_CTRL_XMITS10_ARB_MASK 0x000000000000000fULL /* PCI asynchronous fault status register */ #define STX_PCI_AFSR_P_MA 0x8000000000000000ULL @@ -160,6 +168,32 @@ #define TOM_PCI_IOC_CPRO 0x0000000000000002ULL #define TOM_PCI_IOC_CPRL 0x0000000000000001ULL +/* XMITS PCI-X error status register */ +#define XMS_PCI_X_ERR_STAT_P_SC_DSCRD 0x8000000000000000ULL +#define XMS_PCI_X_ERR_STAT_P_SC_TTO 0x4000000000000000ULL +#define XMS_PCI_X_ERR_STAT_P_SDSTAT 0x2000000000000000ULL +#define XMS_PCI_X_ERR_STAT_P_SMMU 0x1000000000000000ULL +#define XMS_PCI_X_ERR_STAT_P_CDSTAT 0x0800000000000000ULL +#define XMS_PCI_X_ERR_STAT_P_CMMU 0x0400000000000000ULL +#define XMS_PCI_X_ERR_STAT_S_SC_DSCRD 0x0080000000000000ULL +#define XMS_PCI_X_ERR_STAT_S_SC_TTO 0x0040000000000000ULL +#define XMS_PCI_X_ERR_STAT_S_SDSTAT 0x0020000000000000ULL +#define XMS_PCI_X_ERR_STAT_S_SMMU 0x0010000000000000ULL +#define XMS_PCI_X_ERR_STAT_S_CDSTAT 0x0008000000000000ULL +#define XMS_PCI_X_ERR_STAT_S_CMMU 0x0004000000000000ULL +#define XMS_PCI_X_ERR_STAT_PERR_RCV_IEN 0x0000000400000000ULL +#define XMS_PCI_X_ERR_STAT_PERR_RCV 0x0000000200000000ULL +#define XMS_PCI_X_ERR_STAT_SERR_ON_PERR 0x0000000100000000ULL + +/* XMITS PCI-X diagnostic register */ +#define XMS_PCI_X_DIAG_DIS_FAIR 0x0000000000080000ULL +#define XMS_PCI_X_DIAG_CRCQ_VALID 0x0000000000040000ULL +#define XMS_PCI_X_DIAG_SRCQ_ONE 0x0000000000000200ULL +#define XMS_PCI_X_DIAG_CRCQ_FLUSH 0x0000000000000100ULL +#define XMS_PCI_X_DIAG_BUGCNTL_MASK 0x0000ffff00000000ULL +#define XMS_PCI_X_DIAG_BUGCNTL_SHIFT 32 +#define XMS_PCI_X_DIAG_SRCQ_MASK 0x00000000000000ffULL + /* Controller configuration and status registers */ /* Note that these are shared on Schizo but per-PBM on Tomatillo. */ #define STX_CTRL_BUS_ERRLOG 0x00018 Modified: stable/8/sys/sparc64/pci/schizovar.h ============================================================================== --- stable/8/sys/sparc64/pci/schizovar.h Sat May 14 21:10:19 2011 (r221922) +++ stable/8/sys/sparc64/pci/schizovar.h Sat May 14 21:12:00 2011 (r221923) @@ -31,9 +31,21 @@ #ifndef _SPARC64_PCI_SCHIZOVAR_H_ #define _SPARC64_PCI_SCHIZOVAR_H_ +struct schizo_softc; + +struct schizo_iommu_state { + struct iommu_state sis_is; + struct schizo_softc *sis_sc; +}; + struct schizo_softc { + struct bus_dma_methods sc_dma_methods; + device_t sc_dev; + struct mtx sc_sync_mtx; + uint64_t sc_sync_val; + struct mtx *sc_mtx; phandle_t sc_node; @@ -45,22 +57,24 @@ struct schizo_softc { u_int sc_flags; #define SCHIZO_FLAGS_BSWAR (1 << 0) -#define SCHIZO_FLAGS_CDMA (1 << 1) +#define SCHIZO_FLAGS_XMODE (1 << 1) bus_addr_t sc_cdma_clr; uint32_t sc_cdma_state; -#define SCHIZO_CDMA_STATE_DONE (1 << 0) +#define SCHIZO_CDMA_STATE_IDLE (1 << 0) #define SCHIZO_CDMA_STATE_PENDING (1 << 1) +#define SCHIZO_CDMA_STATE_RECEIVED (1 << 2) u_int sc_half; uint32_t sc_ign; uint32_t sc_ver; + uint32_t sc_mrev; struct resource *sc_mem_res[TOM_NREG]; struct resource *sc_irq_res[STX_NINTR]; void *sc_ihand[STX_NINTR]; - struct iommu_state sc_is; + struct schizo_iommu_state sc_is; struct rman sc_pci_mem_rman; struct rman sc_pci_io_rman; From owner-svn-src-stable-8@FreeBSD.ORG Sat May 14 21:15:49 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 8BFE0106566B; Sat, 14 May 2011 21:15:49 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A3CF8FC08; Sat, 14 May 2011 21:15:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4ELFnKj016350; Sat, 14 May 2011 21:15:49 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4ELFnNm016347; Sat, 14 May 2011 21:15:49 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201105142115.p4ELFnNm016347@svn.freebsd.org> From: Marius Strobl Date: Sat, 14 May 2011 21:15:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221925 - stable/8/sys/sparc64/pci 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, 14 May 2011 21:15:49 -0000 Author: marius Date: Sat May 14 21:15:49 2011 New Revision: 221925 URL: http://svn.freebsd.org/changeset/base/221925 Log: MFC: r220039, 220147 - A closer inspection of the OpenSolaris code indicates that the DMA syncing for Hummingbird and Sabre bridges should be applied with every BUS_DMASYNC_POSTREAD instead of in a wrapper around interrupt handlers for devices behind PCI-PCI bridges only as suggested by the documentation (code for the latter actually exists in OpenSolaris but is disabled by default), which also makes more sense. - Take advantage of the ofw_pci_setup_device method introduced in r220038 (MFC'ed to stable/8 in r221923) for disabling bus parking for certain EBus bridges in order to work around hardware bugs. - Mark some unused parameters as such. Modified: stable/8/sys/sparc64/pci/psycho.c stable/8/sys/sparc64/pci/psychovar.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/sparc64/pci/psycho.c ============================================================================== --- stable/8/sys/sparc64/pci/psycho.c Sat May 14 21:12:00 2011 (r221924) +++ stable/8/sys/sparc64/pci/psycho.c Sat May 14 21:15:49 2011 (r221925) @@ -83,7 +83,8 @@ static void psycho_set_intr(struct psych driver_filter_t, driver_intr_t); static int psycho_find_intrmap(struct psycho_softc *, u_int, bus_addr_t *, bus_addr_t *, u_long *); -static driver_filter_t psycho_dma_sync_stub; +static void sabre_dmamap_sync(bus_dma_tag_t dt, bus_dmamap_t map, + bus_dmasync_op_t op); static void psycho_intr_enable(void *); static void psycho_intr_disable(void *); static void psycho_intr_assign(void *); @@ -110,18 +111,17 @@ static device_probe_t psycho_probe; static device_attach_t psycho_attach; static bus_read_ivar_t psycho_read_ivar; static bus_setup_intr_t psycho_setup_intr; -static bus_teardown_intr_t psycho_teardown_intr; static bus_alloc_resource_t psycho_alloc_resource; static bus_activate_resource_t psycho_activate_resource; static bus_deactivate_resource_t psycho_deactivate_resource; static bus_release_resource_t psycho_release_resource; -static bus_describe_intr_t psycho_describe_intr; static bus_get_dma_tag_t psycho_get_dma_tag; static pcib_maxslots_t psycho_maxslots; static pcib_read_config_t psycho_read_config; static pcib_write_config_t psycho_write_config; static pcib_route_interrupt_t psycho_route_interrupt; static ofw_bus_get_node_t psycho_get_node; +static ofw_pci_setup_device_t psycho_setup_device; static device_method_t psycho_methods[] = { /* Device interface */ @@ -135,12 +135,12 @@ static device_method_t psycho_methods[] DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_read_ivar, psycho_read_ivar), DEVMETHOD(bus_setup_intr, psycho_setup_intr), - DEVMETHOD(bus_teardown_intr, psycho_teardown_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), DEVMETHOD(bus_alloc_resource, psycho_alloc_resource), DEVMETHOD(bus_activate_resource, psycho_activate_resource), DEVMETHOD(bus_deactivate_resource, psycho_deactivate_resource), DEVMETHOD(bus_release_resource, psycho_release_resource), - DEVMETHOD(bus_describe_intr, psycho_describe_intr), + DEVMETHOD(bus_describe_intr, bus_generic_describe_intr), DEVMETHOD(bus_get_dma_tag, psycho_get_dma_tag), /* pcib interface */ @@ -152,6 +152,9 @@ static device_method_t psycho_methods[] /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_node, psycho_get_node), + /* ofw_pci interface */ + DEVMETHOD(ofw_pci_setup_device, psycho_setup_device), + KOBJMETHOD_END }; @@ -178,17 +181,6 @@ struct psycho_icarg { bus_addr_t pica_clr; }; -struct psycho_dma_sync { - struct psycho_softc *pds_sc; - driver_filter_t *pds_handler; /* handler to call */ - void *pds_arg; /* argument for the handler */ - void *pds_cookie; /* parent bus int. cookie */ - device_t pds_ppb; /* farest PCI-PCI bridge */ - uint8_t pds_bus; /* bus of farest PCI dev. */ - uint8_t pds_slot; /* slot of farest PCI dev. */ - uint8_t pds_func; /* func. of farest PCI dev. */ -}; - #define PSYCHO_READ8(sc, off) \ bus_read_8((sc)->sc_mem_res, (off)) #define PSYCHO_WRITE8(sc, off, v) \ @@ -288,16 +280,14 @@ psycho_probe(device_t dev) static int psycho_attach(device_t dev) { - char name[sizeof("pci108e,1000")]; struct psycho_icarg *pica; struct psycho_softc *asc, *sc, *osc; struct ofw_pci_ranges *range; const struct psycho_desc *desc; bus_addr_t intrclr, intrmap; uint64_t csr, dr; - phandle_t child, node; + phandle_t node; uint32_t dvmabase, prop, prop_array[2]; - int32_t rev; u_int rerun, ver; int i, j; @@ -387,23 +377,9 @@ psycho_attach(device_t dev) /* Set up the PCI control and PCI diagnostic registers. */ - /* - * Revision 0 EBus bridges have a bug which prevents them from - * working when bus parking is enabled. - */ - rev = -1; csr = PCICTL_READ8(sc, PCR_CS); csr &= ~PCICTL_ARB_PARK; - for (child = OF_child(node); child != 0; child = OF_peer(child)) { - if (OF_getprop(child, "name", name, sizeof(name)) == -1) - continue; - if ((strcmp(name, "ebus") == 0 || - strcmp(name, "pci108e,1000") == 0) && - OF_getprop(child, "revision-id", &rev, sizeof(rev)) > 0 && - rev == 0) - break; - } - if (rev != 0 && OF_getproplen(node, "no-bus-parking") < 0) + if (OF_getproplen(node, "no-bus-parking") < 0) csr |= PCICTL_ARB_PARK; /* Workarounds for version specific bugs. */ @@ -553,17 +529,29 @@ psycho_attach(device_t dev) * * For the moment, 32KB should be more than enough. */ - sc->sc_is = malloc(sizeof(struct iommu_state), M_DEVBUF, - M_NOWAIT | M_ZERO); + sc->sc_is = malloc(sizeof(*sc->sc_is), M_DEVBUF, M_NOWAIT | + M_ZERO); if (sc->sc_is == NULL) - panic("%s: malloc iommu_state failed", __func__); + panic("%s: could not malloc IOMMU state", __func__); sc->sc_is->is_flags = IOMMU_PRESERVE_PROM; - if (sc->sc_mode == PSYCHO_MODE_SABRE) + if (sc->sc_mode == PSYCHO_MODE_SABRE) { + sc->sc_dma_methods = + malloc(sizeof(*sc->sc_dma_methods), M_DEVBUF, + M_NOWAIT); + if (sc->sc_dma_methods == NULL) + panic("%s: could not malloc DMA methods", + __func__); + memcpy(sc->sc_dma_methods, &iommu_dma_methods, + sizeof(*sc->sc_dma_methods)); + sc->sc_dma_methods->dm_dmamap_sync = + sabre_dmamap_sync; sc->sc_is->is_pmaxaddr = IOMMU_MAXADDR(SABRE_IOMMU_BITS); - else + } else { + sc->sc_dma_methods = &iommu_dma_methods; sc->sc_is->is_pmaxaddr = IOMMU_MAXADDR(PSYCHO_IOMMU_BITS); + } sc->sc_is->is_sb[0] = sc->sc_is->is_sb[1] = 0; if (OF_getproplen(node, "no-streaming-cache") < 0) sc->sc_is->is_sb[0] = sc->sc_pcictl + PCR_STRBUF; @@ -571,6 +559,7 @@ psycho_attach(device_t dev) psycho_iommu_init(sc, 3, dvmabase); } else { /* Just copy IOMMU state, config tag and address. */ + sc->sc_dma_methods = &iommu_dma_methods; sc->sc_is = osc->sc_is; if (OF_getproplen(node, "no-streaming-cache") < 0) sc->sc_is->is_sb[1] = sc->sc_pcictl + PCR_STRBUF; @@ -587,7 +576,7 @@ psycho_attach(device_t dev) panic("%s: bus_dma_tag_create failed", __func__); /* Customize the tag. */ sc->sc_pci_dmat->dt_cookie = sc->sc_is; - sc->sc_pci_dmat->dt_mt = &iommu_dma_methods; + sc->sc_pci_dmat->dt_mt = sc->sc_dma_methods; i = OF_getprop(node, "bus-range", (void *)prop_array, sizeof(prop_array)); @@ -1092,15 +1081,20 @@ psycho_read_ivar(device_t dev, device_t return (ENOENT); } -static int -psycho_dma_sync_stub(void *arg) +static void +sabre_dmamap_sync(bus_dma_tag_t dt, bus_dmamap_t map, bus_dmasync_op_t op) { - struct psycho_dma_sync *pds = arg; + struct iommu_state *is = dt->dt_cookie; + + if ((map->dm_flags & DMF_LOADED) == 0) + return; - (void)PCIB_READ_CONFIG(pds->pds_ppb, pds->pds_bus, pds->pds_slot, - pds->pds_func, PCIR_VENDOR, 2); - (void)PSYCHO_READ8(pds->pds_sc, PSR_DMA_WRITE_SYNC); - return (pds->pds_handler(pds->pds_arg)); + if ((op & BUS_DMASYNC_POSTREAD) != 0) + (void)bus_space_read_8(is->is_bustag, is->is_bushandle, + PSR_DMA_WRITE_SYNC); + + if ((op & BUS_DMASYNC_PREWRITE) != 0) + membar(Sync); } static void @@ -1146,16 +1140,8 @@ psycho_setup_intr(device_t dev, device_t int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep) { - struct { - int apb:1; - int ppb:1; - } found; - devclass_t pci_devclass; - device_t cdev, pdev, pcidev; struct psycho_softc *sc; - struct psycho_dma_sync *pds; u_long vec; - int error; sc = device_get_softc(dev); /* @@ -1168,114 +1154,10 @@ psycho_setup_intr(device_t dev, device_t device_printf(dev, "invalid interrupt vector 0x%lx\n", vec); return (EINVAL); } - - /* - * The Sabre-APB-combination does not automatically flush DMA - * write data for devices behind additional PCI-PCI bridges - * underneath the APB PCI-PCI bridge. The procedure for a - * manual flush is to do a PIO read on the far side of the - * farthest PCI-PCI bridge followed by a read of the PCI DMA - * write sync register of the Sabre. - */ - if (sc->sc_mode == PSYCHO_MODE_SABRE) { - pds = malloc(sizeof(*pds), M_DEVBUF, M_NOWAIT | M_ZERO); - if (pds == NULL) - return (ENOMEM); - pcidev = NULL; - found.apb = found.ppb = 0; - pci_devclass = devclass_find("pci"); - for (cdev = child; cdev != dev; cdev = pdev) { - pdev = device_get_parent(cdev); - if (pcidev == NULL) { - if (device_get_devclass(pdev) != pci_devclass) - continue; - pcidev = cdev; - continue; - } - /* - * NB: APB would also match as PCI-PCI bridges. - */ - if (pci_get_vendor(cdev) == 0x108e && - pci_get_device(cdev) == 0x5000) { - found.apb = 1; - break; - } - if (pci_get_class(cdev) == PCIC_BRIDGE && - pci_get_subclass(cdev) == PCIS_BRIDGE_PCI) - found.ppb = 1; - } - if (found.apb && found.ppb && pcidev != NULL) { - pds->pds_sc = sc; - pds->pds_arg = arg; - pds->pds_ppb = - device_get_parent(device_get_parent(pcidev)); - pds->pds_bus = pci_get_bus(pcidev); - pds->pds_slot = pci_get_slot(pcidev); - pds->pds_func = pci_get_function(pcidev); - if (bootverbose) - device_printf(dev, "installed DMA sync " - "wrapper for device %d.%d on bus %d\n", - pds->pds_slot, pds->pds_func, - pds->pds_bus); - if (intr == NULL) { - pds->pds_handler = filt; - error = bus_generic_setup_intr(dev, child, - ires, flags, psycho_dma_sync_stub, intr, - pds, cookiep); - } else { - pds->pds_handler = (driver_filter_t *)intr; - error = bus_generic_setup_intr(dev, child, - ires, flags, filt, - (driver_intr_t *)psycho_dma_sync_stub, - pds, cookiep); - } - } else - error = bus_generic_setup_intr(dev, child, ires, - flags, filt, intr, arg, cookiep); - if (error != 0) { - free(pds, M_DEVBUF); - return (error); - } - pds->pds_cookie = *cookiep; - *cookiep = pds; - return (error); - } return (bus_generic_setup_intr(dev, child, ires, flags, filt, intr, arg, cookiep)); } -static int -psycho_teardown_intr(device_t dev, device_t child, struct resource *vec, - void *cookie) -{ - struct psycho_softc *sc; - struct psycho_dma_sync *pds; - int error; - - sc = device_get_softc(dev); - if (sc->sc_mode == PSYCHO_MODE_SABRE) { - pds = cookie; - error = bus_generic_teardown_intr(dev, child, vec, - pds->pds_cookie); - if (error == 0) - free(pds, M_DEVBUF); - return (error); - } - return (bus_generic_teardown_intr(dev, child, vec, cookie)); -} - -static int -psycho_describe_intr(device_t dev, device_t child, struct resource *vec, - void *cookie, const char *descr) -{ - struct psycho_softc *sc; - - sc = device_get_softc(dev); - if (sc->sc_mode == PSYCHO_MODE_SABRE) - cookie = ((struct psycho_dma_sync *)cookie)->pds_cookie; - return (bus_generic_describe_intr(dev, child, vec, cookie, descr)); -} - static struct resource * psycho_alloc_resource(device_t bus, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags) @@ -1394,7 +1276,7 @@ psycho_release_resource(device_t bus, de } static bus_dma_tag_t -psycho_get_dma_tag(device_t bus, device_t child) +psycho_get_dma_tag(device_t bus, device_t child __unused) { struct psycho_softc *sc; @@ -1403,7 +1285,7 @@ psycho_get_dma_tag(device_t bus, device_ } static phandle_t -psycho_get_node(device_t bus, device_t dev) +psycho_get_node(device_t bus, device_t child __unused) { struct psycho_softc *sc; @@ -1412,6 +1294,25 @@ psycho_get_node(device_t bus, device_t d return (sc->sc_node); } +static void +psycho_setup_device(device_t bus, device_t child) +{ + struct psycho_softc *sc; + uint32_t rev; + + sc = device_get_softc(bus); + /* + * Revision 0 EBus bridges have a bug which prevents them from + * working when bus parking is enabled. + */ + if ((strcmp(ofw_bus_get_name(child), "ebus") == 0 || + strcmp(ofw_bus_get_name(child), "pci108e,1000") == 0) && + OF_getprop(ofw_bus_get_node(child), "revision-id", &rev, + sizeof(rev)) > 0 && rev == 0) + PCICTL_WRITE8(sc, PCR_CS, PCICTL_READ8(sc, PCR_CS) & + ~PCICTL_ARB_PARK); +} + static bus_space_tag_t psycho_alloc_bus_tag(struct psycho_softc *sc, int type) { Modified: stable/8/sys/sparc64/pci/psychovar.h ============================================================================== --- stable/8/sys/sparc64/pci/psychovar.h Sat May 14 21:12:00 2011 (r221924) +++ stable/8/sys/sparc64/pci/psychovar.h Sat May 14 21:15:49 2011 (r221925) @@ -36,6 +36,8 @@ * per pair of psychos. */ struct psycho_softc { + struct bus_dma_methods *sc_dma_methods; + device_t sc_dev; struct mtx *sc_mtx; From owner-svn-src-stable-8@FreeBSD.ORG Sat May 14 21:31:19 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 2EB981065670; Sat, 14 May 2011 21:31:19 +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 1E11B8FC0C; Sat, 14 May 2011 21:31:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4ELVJA2016735; Sat, 14 May 2011 21:31:19 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4ELVIZS016733; Sat, 14 May 2011 21:31:19 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201105142131.p4ELVIZS016733@svn.freebsd.org> From: Doug Barton Date: Sat, 14 May 2011 21:31: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: r221927 - 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, 14 May 2011 21:31:19 -0000 Author: dougb Date: Sat May 14 21:31:18 2011 New Revision: 221927 URL: http://svn.freebsd.org/changeset/base/221927 Log: MFC r221227: Keep a list of the scripts run before early_late_divider, and use that list to skip things in the second run. Modified: stable/8/etc/rc Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/rc ============================================================================== --- stable/8/etc/rc Sat May 14 21:15:50 2011 (r221926) +++ stable/8/etc/rc Sat May 14 21:31:18 2011 (r221927) @@ -84,8 +84,10 @@ fi # files=`rcorder ${skip} /etc/rc.d/* 2>/dev/null` +_rc_elem_done=' ' for _rc_elem in ${files}; do run_rc_script ${_rc_elem} ${_boot} + _rc_elem_done="${_rc_elem_done}${_rc_elem} " case "$_rc_elem" in */${early_late_divider}) break ;; @@ -103,14 +105,9 @@ case ${local_startup} in esac files=`rcorder ${skip} /etc/rc.d/* ${local_rc} 2>/dev/null` -_skip_early=1 for _rc_elem in ${files}; do - case "$_skip_early" in - 1) case "$_rc_elem" in - */${early_late_divider}) _skip_early=0 ;; - esac - continue - ;; + case "$_rc_elem_done" in + *" $_rc_elem "*) continue ;; esac run_rc_script ${_rc_elem} ${_boot} From owner-svn-src-stable-8@FreeBSD.ORG Sat May 14 21:42:09 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 310E71065686; Sat, 14 May 2011 21:42:09 +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 2027F8FC0C; Sat, 14 May 2011 21:42:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4ELg9FY017034; Sat, 14 May 2011 21:42:09 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4ELg9RZ017032; Sat, 14 May 2011 21:42:09 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201105142142.p4ELg9RZ017032@svn.freebsd.org> From: Doug Barton Date: Sat, 14 May 2011 21:42:09 +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: r221929 - stable/8/etc/periodic/daily 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, 14 May 2011 21:42:09 -0000 Author: dougb Date: Sat May 14 21:42:08 2011 New Revision: 221929 URL: http://svn.freebsd.org/changeset/base/221929 Log: MFC r221475: 1. If PKG_DBDIR cannot be determined from make, set the default 2. Add the -H flag to tar in case /var/db/pkg itself is a symlink 3. Direct stderr to /dev/null to suppress the leading slash warning Modified: stable/8/etc/periodic/daily/220.backup-pkgdb Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/periodic/daily/220.backup-pkgdb ============================================================================== --- stable/8/etc/periodic/daily/220.backup-pkgdb Sat May 14 21:34:21 2011 (r221928) +++ stable/8/etc/periodic/daily/220.backup-pkgdb Sat May 14 21:42:08 2011 (r221929) @@ -18,7 +18,8 @@ case "$daily_backup_pkgdb_enable" in bak="${daily_backup_pkgdb_dir:-/var/backups}" bak_file="${bak}/pkgdb.bak.tbz" - pkg_dbdir=`make -f/usr/share/mk/bsd.port.mk -V PKG_DBDIR 2>/dev/null` + pkg_dbdir=`make -f/usr/share/mk/bsd.port.mk -V PKG_DBDIR 2>/dev/null` || + pkg_dbdir=/var/db/pkg if [ ! -d "$bak" ] then @@ -33,7 +34,7 @@ case "$daily_backup_pkgdb_enable" in new_bak_file=`mktemp ${bak_file}-XXXXX` - if tar -cjf "${new_bak_file}" "$pkg_dbdir"; then + if tar -cjHf "${new_bak_file}" "$pkg_dbdir" 2>/dev/null; then chmod 644 "${new_bak_file}" if [ -e "${bak_file}.2" -a -e "${bak_file}" ]; then