From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 01:22:21 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2AA16106564A; Sun, 5 Aug 2012 01:22:20 +0000 (UTC) (envelope-from marcel@xcllnt.net) Received: from mail.xcllnt.net (mail.xcllnt.net [70.36.220.4]) by mx1.freebsd.org (Postfix) with ESMTP id 4B90C8FC08; Sun, 5 Aug 2012 01:22:20 +0000 (UTC) Received: from marcelm-sslvpn-nc.jnpr.net (natint3.juniper.net [66.129.224.36]) (authenticated bits=0) by mail.xcllnt.net (8.14.5/8.14.5) with ESMTP id q750wdds044935 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sat, 4 Aug 2012 17:58:44 -0700 (PDT) (envelope-from marcel@xcllnt.net) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.0 \(1485\)) From: Marcel Moolenaar In-Reply-To: <201207310523.q6V5NN0j089530@svn.freebsd.org> Date: Sat, 4 Aug 2012 17:58:34 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <83692D6C-719A-4735-9EC1-7963C4A8EC7A@xcllnt.net> References: <201207310523.q6V5NN0j089530@svn.freebsd.org> To: Max Khon X-Mailer: Apple Mail (2.1485) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r238933 - head/sys/dev/puc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 01:22:21 -0000 On Jul 30, 2012, at 10:23 PM, Max Khon wrote: > Author: fjoe > Date: Tue Jul 31 05:23:23 2012 > New Revision: 238933 > URL: http://svn.freebsd.org/changeset/base/238933 >=20 > Log: > - Change back "d_ofs" to int8_t to not pessimize padding and size of = "struct puc_cfg". > - Use "puc_config_moxa" for Moxa boards that need d_ofs greater than = 0x7f Thanks, I appreciate it. --=20 Marcel Moolenaar marcel@xcllnt.net From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 06:15:13 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DD8A106564A; Sun, 5 Aug 2012 06:15:13 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 097628FC08; Sun, 5 Aug 2012 06:15: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 q756FCUp044857; Sun, 5 Aug 2012 06:15:12 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q756FCtw044855; Sun, 5 Aug 2012 06:15:12 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201208050615.q756FCtw044855@svn.freebsd.org> From: Andreas Tobler Date: Sun, 5 Aug 2012 06:15:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239046 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 06:15:13 -0000 Author: andreast Date: Sun Aug 5 06:15:12 2012 New Revision: 239046 URL: http://svn.freebsd.org/changeset/base/239046 Log: Fix typo. Reviewed by: jhb Modified: head/sys/sys/bus.h Modified: head/sys/sys/bus.h ============================================================================== --- head/sys/sys/bus.h Sun Aug 5 00:00:52 2012 (r239045) +++ head/sys/sys/bus.h Sun Aug 5 06:15:12 2012 (r239046) @@ -536,7 +536,7 @@ void bus_data_generation_update(void); * is for drivers that wish to have a generic form and a specialized form, * like is done with the pci bus and the acpi pci bus. BUS_PROBE_HOOVER is * for those busses that implement a generic device place-holder for devices on - * the bus that have no more specific river for them (aka ugen). + * the bus that have no more specific driver for them (aka ugen). * BUS_PROBE_NOWILDCARD or lower means that the device isn't really bidding * for a device node, but accepts only devices that its parent has told it * use this driver. From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 08:08:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1F61106564A; Sun, 5 Aug 2012 08:08:34 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A2DB68FC08; Sun, 5 Aug 2012 08:08:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7588YN7054965; Sun, 5 Aug 2012 08:08:34 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7588Ygl054963; Sun, 5 Aug 2012 08:08:34 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201208050808.q7588Ygl054963@svn.freebsd.org> From: Eitan Adler Date: Sun, 5 Aug 2012 08:08:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239047 - head/sys/dev/aic7xxx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 08:08:35 -0000 Author: eadler Date: Sun Aug 5 08:08:34 2012 New Revision: 239047 URL: http://svn.freebsd.org/changeset/base/239047 Log: Remove variables which are initialized but never used thereafter reported by gcc46 warning Reviewed by: scottl Approved by: cperciva MFC after: 1 week Modified: head/sys/dev/aic7xxx/aic_osm_lib.c Modified: head/sys/dev/aic7xxx/aic_osm_lib.c ============================================================================== --- head/sys/dev/aic7xxx/aic_osm_lib.c Sun Aug 5 06:15:12 2012 (r239046) +++ head/sys/dev/aic7xxx/aic_osm_lib.c Sun Aug 5 08:08:34 2012 (r239047) @@ -54,9 +54,6 @@ aic_set_recoveryscb(struct aic_softc *ai * them after we've successfully fixed this problem. */ LIST_FOREACH(list_scb, &aic->pending_scbs, pending_links) { - union ccb *ccb; - - ccb = list_scb->io_ctx; callout_stop(&scb->io_timer); } } From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 08:10:03 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C9589106566C; Sun, 5 Aug 2012 08:10:02 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF9C38FC0C; Sun, 5 Aug 2012 08:10:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q758A2Qk055119; Sun, 5 Aug 2012 08:10:02 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q758A2Wq055118; Sun, 5 Aug 2012 08:10:02 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201208050810.q758A2Wq055118@svn.freebsd.org> From: Eitan Adler Date: Sun, 5 Aug 2012 08:10:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239048 - head/sys/dev/puc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 08:10:03 -0000 Author: eadler Date: Sun Aug 5 08:10:02 2012 New Revision: 239048 URL: http://svn.freebsd.org/changeset/base/239048 Log: Add additional Perle Speed LE serial cards PR: kern/168816 Submitted by: Dennis Oyama Approved by: cperciva MFC after: 1 week Modified: head/sys/dev/puc/pucdata.c Modified: head/sys/dev/puc/pucdata.c ============================================================================== --- head/sys/dev/puc/pucdata.c Sun Aug 5 08:08:34 2012 (r239047) +++ head/sys/dev/puc/pucdata.c Sun Aug 5 08:10:02 2012 (r239048) @@ -768,11 +768,36 @@ const struct puc_cfg puc_pci_devices[] = */ { 0x155f, 0x0331, 0xffff, 0, + "Perle Ultraport4 Express", + DEFAULT_RCLK * 8, + PUC_PORT_4S, 0x10, 0, 8, + }, + + { 0x155f, 0xB012, 0xffff, 0, + "Perle Speed2 LE", + DEFAULT_RCLK * 8, + PUC_PORT_2S, 0x10, 0, 8, + }, + + { 0x155f, 0xB022, 0xffff, 0, + "Perle Speed2 LE", + DEFAULT_RCLK * 8, + PUC_PORT_2S, 0x10, 0, 8, + }, + + { 0x155f, 0xB004, 0xffff, 0, "Perle Speed4 LE", DEFAULT_RCLK * 8, PUC_PORT_4S, 0x10, 0, 8, }, + { 0x155f, 0xB008, 0xffff, 0, + "Perle Speed8 LE", + DEFAULT_RCLK * 8, + PUC_PORT_8S, 0x10, 0, 8, + }, + + /* * Oxford Semiconductor PCI Express Expresso family * From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 08:19:53 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 605BD106566B; Sun, 5 Aug 2012 08:19:53 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4AAFF8FC0A; Sun, 5 Aug 2012 08:19:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q758Jr1r056380; Sun, 5 Aug 2012 08:19:53 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q758JreP056378; Sun, 5 Aug 2012 08:19:53 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201208050819.q758JreP056378@svn.freebsd.org> From: Eitan Adler Date: Sun, 5 Aug 2012 08:19:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239049 - head/share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 08:19:53 -0000 Author: eadler Date: Sun Aug 5 08:19:52 2012 New Revision: 239049 URL: http://svn.freebsd.org/changeset/base/239049 Log: Use new method of assigning IPv4 addresses PR: conf/167648 Submitted by: Jeff Kletsky Approved by: bcr MFC after: 3 days Modified: head/share/man/man5/rc.conf.5 Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Sun Aug 5 08:10:02 2012 (r239048) +++ head/share/man/man5/rc.conf.5 Sun Aug 5 08:19:52 2012 (r239049) @@ -1201,7 +1201,7 @@ on with the vlan tag 101 and the optional the IPv4 address 192.0.2.1/24: .Bd -literal vlans_em0="101" -ifconfig_em0_101="inet 192.0.2.1/24" +ipv4_addrs_em0_101="192.0.2.1/24" .Ed .Pp To create a vlan device named From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 08:56:30 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64595106566B; Sun, 5 Aug 2012 08:56:30 +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 4DD868FC12; Sun, 5 Aug 2012 08:56:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q758uUO0059945; Sun, 5 Aug 2012 08:56:30 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q758uUiT059943; Sun, 5 Aug 2012 08:56:30 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201208050856.q758uUiT059943@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 5 Aug 2012 08:56:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239050 - head/sys/dev/usb/serial X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 08:56:30 -0000 Author: hselasky Date: Sun Aug 5 08:56:29 2012 New Revision: 239050 URL: http://svn.freebsd.org/changeset/base/239050 Log: Minor style nit: Use the interface number from the USB interface descriptor like in the other USB serial drivers. These numbers are not supposed to be different, though in theory they can. Make sure that the driver then uses the interface number given by the USB descriptor, and not the logical index of the USB stack. For the future: Whenever the term "index" is used in the USB code, it refers to a number computed by the USB stack. Whenever the term "number" is used in the USB code, it refers to a number in a USB descriptor. MFC after: 2 weeks Modified: head/sys/dev/usb/serial/uslcom.c Modified: head/sys/dev/usb/serial/uslcom.c ============================================================================== --- head/sys/dev/usb/serial/uslcom.c Sun Aug 5 08:19:52 2012 (r239049) +++ head/sys/dev/usb/serial/uslcom.c Sun Aug 5 08:56:29 2012 (r239050) @@ -135,7 +135,7 @@ struct uslcom_softc { uint8_t sc_msr; uint8_t sc_lsr; - uint8_t sc_IfIdx; + uint8_t sc_iface_no; }; static device_probe_t uslcom_probe; @@ -382,7 +382,8 @@ uslcom_attach(device_t dev) usb_callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0); sc->sc_udev = uaa->device; - sc->sc_IfIdx = uaa->info.bIfaceIndex; + /* use the interface number from the USB interface descriptor */ + sc->sc_iface_no = uaa->info.bIfaceNum; error = usbd_transfer_setup(uaa->device, &uaa->info.bIfaceIndex, sc->sc_xfer, uslcom_config, @@ -437,7 +438,7 @@ uslcom_open(struct ucom_softc *ucom) req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_UART; USETW(req.wValue, USLCOM_UART_ENABLE); - USETW(req.wIndex, sc->sc_IfIdx); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -461,7 +462,7 @@ uslcom_close(struct ucom_softc *ucom) req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_UART; USETW(req.wValue, USLCOM_UART_DISABLE); - USETW(req.wIndex, sc->sc_IfIdx); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -485,7 +486,7 @@ uslcom_set_dtr(struct ucom_softc *ucom, req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_CTRL; USETW(req.wValue, ctl); - USETW(req.wIndex, sc->sc_IfIdx); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -509,7 +510,7 @@ uslcom_set_rts(struct ucom_softc *ucom, req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_CTRL; USETW(req.wValue, ctl); - USETW(req.wIndex, sc->sc_IfIdx); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -540,7 +541,7 @@ uslcom_param(struct ucom_softc *ucom, st req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_SET_BAUD_RATE; USETW(req.wValue, 0); - USETW(req.wIndex, sc->sc_IfIdx); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, sizeof(baudrate)); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -577,7 +578,7 @@ uslcom_param(struct ucom_softc *ucom, st req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_DATA; USETW(req.wValue, data); - USETW(req.wIndex, sc->sc_IfIdx); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -599,7 +600,7 @@ uslcom_param(struct ucom_softc *ucom, st req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_SET_FLOWCTRL; USETW(req.wValue, 0); - USETW(req.wIndex, sc->sc_IfIdx); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, sizeof(flowctrl)); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -629,7 +630,7 @@ uslcom_set_break(struct ucom_softc *ucom req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_BREAK; USETW(req.wValue, brk); - USETW(req.wIndex, sc->sc_IfIdx); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -783,7 +784,7 @@ uslcom_control_callback(struct usb_xfer req.bmRequestType = USLCOM_READ; req.bRequest = USLCOM_RCTRL; USETW(req.wValue, 0); - USETW(req.wIndex, sc->sc_IfIdx); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, sizeof(buf)); usbd_xfer_set_frames(xfer, 2); From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 09:04:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2B77B106564A; Sun, 5 Aug 2012 09:04:07 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe07.c2i.net [212.247.154.194]) by mx1.freebsd.org (Postfix) with ESMTP id 2B08A8FC08; Sun, 5 Aug 2012 09:04:05 +0000 (UTC) X-T2-Spam-Status: No, hits=-0.2 required=5.0 tests=ALL_TRUSTED, BAYES_50 Received: from [176.74.212.201] (account mc467741@c2i.net HELO laptop015.hselasky.homeunix.org) by mailfe07.swip.net (CommuniGate Pro SMTP 5.4.4) with ESMTPA id 304274581; Sun, 05 Aug 2012 10:58:57 +0200 From: Hans Petter Selasky To: Gavin Atkinson Date: Sun, 5 Aug 2012 10:59:25 +0200 User-Agent: KMail/1.13.7 (FreeBSD/9.0-STABLE; KDE/4.7.4; amd64; ; ) References: <201208041511.q74FBbIm066215@svn.freebsd.org> In-Reply-To: <201208041511.q74FBbIm066215@svn.freebsd.org> X-Face: 'mmZ:T{)),Oru^0c+/}w'`gU1$ubmG?lp!=R4Wy\ELYo2)@'UZ24N@ =?iso-8859-1?q?d2+AyewRX=7DmAm=3BYp=0A=09=7CU=5B?=@, _z/([?1bCfM{_"B<.J>mICJCHAzzGHI{y7{%JVz%R~yJHIji`y> =?iso-8859-1?q?Y=7Dk1C4TfysrsUI=0A=09-=25GU9V5=5DiUZF=26nRn9mJ=27=3F=26?=>O MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201208051059.25660.hselasky@c2i.net> Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r239037 - in head: share/man/man4 sys/dev/usb/serial X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 09:04:07 -0000 On Saturday 04 August 2012 17:11:37 Gavin Atkinson wrote: > MFC after: 2 weeks Hi Gavin, When you MFC this, could you also include this patch: http://svn.freebsd.org/changeset/base/239050 --HPS From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 10:12:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A073106566C; Sun, 5 Aug 2012 10:12:28 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 22F1B8FC12; Sun, 5 Aug 2012 10:12:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q75ACSYu065993; Sun, 5 Aug 2012 10:12:28 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75ACRd1065979; Sun, 5 Aug 2012 10:12:27 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201208051012.q75ACRd1065979@svn.freebsd.org> From: Adrian Chadd Date: Sun, 5 Aug 2012 10:12:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239051 - in head/sys/dev/ath: . ath_hal ath_hal/ar5210 ath_hal/ar5211 ath_hal/ar5212 ath_hal/ar5416 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 10:12:28 -0000 Author: adrian Date: Sun Aug 5 10:12:27 2012 New Revision: 239051 URL: http://svn.freebsd.org/changeset/base/239051 Log: Migrate the ath_hal_filltxdesc() API to take a list of buffer/seglen values. The existing API only exposes 'seglen' (the current buffer (segment) length) with the data buffer pointer set in 'ds_data'. This is fine for the legacy DMA engine but it won't work for the EDMA engines. The EDMA engine has a significantly different TX descriptor layout. * The legacy DMA engine had a ds_data pointer at the same offset in the descriptor for both TX and RX buffers; * The EDMA engine has no ds_data for RX - the data is DMAed after the descriptor; * The EDMA engine has support for 4 TX buffer/segment pairs in the TX DMA descriptor; * The EDMA TX completion is in a different FIFO, and the driver will 'link' the status completion entry to a QCU by a "QCU ID". I don't know why it's just not filled in by the hardware, alas. So given that, here are the changes: * Instead of directly fondling 'ds_data' in ath_desc, change the ath_hal_filltxdesc() to take an array of buffer pointers as well as segment len pointers; * The EDMA TX completion status wants a descriptor and queue id. This (for now) uses bf_state.bfs_txq and will extract the hardware QCU ID from that. * .. and this is ugly and wasteful; it should change to just store the QCU in the bf_state and save 3/7 bytes in the process. Now, the weird crap: * The aggregate TX path was using bf_state->bfs_txq for the TXQ, rather than taking a function argument. I've tidied that up. * The multicast queue frames get put on a software TXQ and then that is appended to the hardware CABQ when appropriate. So for now, make sure that bf_state->bfs_txq points at the CABQ when adding frames to the multicast queue. * .. but the multicast queue TX path for now doesn't use the software queue and instead (a) directly sets up the descriptor contents at that point; (b) the frames on the vap->avp_mcastq are then just appended wholesale to the CABQ. So for now, I don't have to worry about making the multicast path work with aggregation or the per-TID software queue. Phew. What's left to do: * I need to modify the 11n ath_hal_chaintxdesc() API to do the same. I'll do that in a subsequent commit. * Remove bf_state.bfs_txq entirely and store the QCU as appropriate. * .. then do the runtime "is this going on the right HWQ?" checks using that, rather than comparing pointer values. Tested on: * AR9280 STA/AP * AR5416 STA/AP Modified: head/sys/dev/ath/ah_osdep.h head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ar5210/ar5210.h head/sys/dev/ath/ath_hal/ar5210/ar5210_xmit.c head/sys/dev/ath/ath_hal/ar5211/ar5211.h head/sys/dev/ath/ath_hal/ar5211/ar5211_xmit.c head/sys/dev/ath/ath_hal/ar5212/ar5212.h head/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c head/sys/dev/ath/ath_hal/ar5416/ar5416.h head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c head/sys/dev/ath/if_ath_beacon.c head/sys/dev/ath/if_ath_tx.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/ah_osdep.h ============================================================================== --- head/sys/dev/ath/ah_osdep.h Sun Aug 5 08:56:29 2012 (r239050) +++ head/sys/dev/ath/ah_osdep.h Sun Aug 5 10:12:27 2012 (r239051) @@ -49,6 +49,12 @@ typedef bus_space_tag_t HAL_BUS_TAG; typedef bus_space_handle_t HAL_BUS_HANDLE; /* + * Although the underlying hardware may support 64 bit DMA, the + * current Atheros hardware only supports 32 bit addressing. + */ +typedef uint32_t HAL_DMA_ADDR; + +/* * Linker set writearounds for chip and RF backend registration. */ #define OS_DATA_SET(set, item) DATA_SET(set, item) Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Sun Aug 5 08:56:29 2012 (r239050) +++ head/sys/dev/ath/ath_hal/ah.h Sun Aug 5 10:12:27 2012 (r239051) @@ -1081,7 +1081,8 @@ struct ath_hal { u_int txRate2, u_int txTries2, u_int txRate3, u_int txTries3); HAL_BOOL __ahdecl(*ah_fillTxDesc)(struct ath_hal *, struct ath_desc *, - u_int segLen, HAL_BOOL firstSeg, + HAL_DMA_ADDR *bufAddrList, uint32_t *segLenList, + u_int descId, u_int qcuId, HAL_BOOL firstSeg, HAL_BOOL lastSeg, const struct ath_desc *); HAL_STATUS __ahdecl(*ah_procTxDesc)(struct ath_hal *, struct ath_desc *, struct ath_tx_status *); Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5210/ar5210.h Sun Aug 5 08:56:29 2012 (r239050) +++ head/sys/dev/ath/ath_hal/ar5210/ar5210.h Sun Aug 5 10:12:27 2012 (r239051) @@ -171,7 +171,8 @@ extern HAL_BOOL ar5210SetupXTxDesc(struc u_int txRate2, u_int txRetries2, u_int txRate3, u_int txRetries3); extern HAL_BOOL ar5210FillTxDesc(struct ath_hal *, struct ath_desc *, - u_int segLen, HAL_BOOL firstSeg, HAL_BOOL lastSeg, + HAL_DMA_ADDR *bufAddrList, uint32_t *segLenList, + u_int descId, u_int qcuId, HAL_BOOL firstSeg, HAL_BOOL lastSeg, const struct ath_desc *ds0); extern HAL_STATUS ar5210ProcTxDesc(struct ath_hal *, struct ath_desc *, struct ath_tx_status *); Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210_xmit.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5210/ar5210_xmit.c Sun Aug 5 08:56:29 2012 (r239050) +++ head/sys/dev/ath/ath_hal/ar5210/ar5210_xmit.c Sun Aug 5 10:12:27 2012 (r239051) @@ -546,13 +546,17 @@ ar5210IntrReqTxDesc(struct ath_hal *ah, HAL_BOOL ar5210FillTxDesc(struct ath_hal *ah, struct ath_desc *ds, - u_int segLen, HAL_BOOL firstSeg, HAL_BOOL lastSeg, + HAL_DMA_ADDR *bufAddrList, uint32_t *segLenList, u_int descId, + u_int qcuId, HAL_BOOL firstSeg, HAL_BOOL lastSeg, const struct ath_desc *ds0) { struct ar5210_desc *ads = AR5210DESC(ds); + uint32_t segLen = segLenList[0]; HALASSERT((segLen &~ AR_BufLen) == 0); + ds->ds_data = bufAddrList[0]; + if (firstSeg) { /* * First descriptor, don't clobber xmit control data Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5211/ar5211.h Sun Aug 5 08:56:29 2012 (r239050) +++ head/sys/dev/ath/ath_hal/ar5211/ar5211.h Sun Aug 5 10:12:27 2012 (r239051) @@ -196,7 +196,8 @@ extern HAL_BOOL ar5211SetupXTxDesc(struc u_int txRate2, u_int txRetries2, u_int txRate3, u_int txRetries3); extern HAL_BOOL ar5211FillTxDesc(struct ath_hal *, struct ath_desc *, - u_int segLen, HAL_BOOL firstSeg, HAL_BOOL lastSeg, + HAL_DMA_ADDR *bufAddrList, uint32_t *segLenList, + u_int descId, u_int qcuId, HAL_BOOL firstSeg, HAL_BOOL lastSeg, const struct ath_desc *ds0); extern HAL_STATUS ar5211ProcTxDesc(struct ath_hal *, struct ath_desc *, struct ath_tx_status *); Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211_xmit.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5211/ar5211_xmit.c Sun Aug 5 08:56:29 2012 (r239050) +++ head/sys/dev/ath/ath_hal/ar5211/ar5211_xmit.c Sun Aug 5 10:12:27 2012 (r239051) @@ -577,10 +577,14 @@ ar5211IntrReqTxDesc(struct ath_hal *ah, HAL_BOOL ar5211FillTxDesc(struct ath_hal *ah, struct ath_desc *ds, - u_int segLen, HAL_BOOL firstSeg, HAL_BOOL lastSeg, + HAL_DMA_ADDR *bufAddrList, uint32_t *segLenList, u_int qcuId, + u_int descId, HAL_BOOL firstSeg, HAL_BOOL lastSeg, const struct ath_desc *ds0) { struct ar5211_desc *ads = AR5211DESC(ds); + uint32_t segLen = segLenList[0]; + + ds->ds_data = bufAddrList[0]; HALASSERT((segLen &~ AR_BufLen) == 0); Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212.h Sun Aug 5 08:56:29 2012 (r239050) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212.h Sun Aug 5 10:12:27 2012 (r239051) @@ -594,7 +594,8 @@ extern HAL_BOOL ar5212SetupXTxDesc(struc u_int txRate2, u_int txRetries2, u_int txRate3, u_int txRetries3); extern HAL_BOOL ar5212FillTxDesc(struct ath_hal *ah, struct ath_desc *ds, - u_int segLen, HAL_BOOL firstSeg, HAL_BOOL lastSeg, + HAL_DMA_ADDR *bufAddrList, uint32_t *segLenList, + u_int descId, u_int qcuId, HAL_BOOL firstSeg, HAL_BOOL lastSeg, const struct ath_desc *ds0); extern HAL_STATUS ar5212ProcTxDesc(struct ath_hal *ah, struct ath_desc *, struct ath_tx_status *); Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c Sun Aug 5 08:56:29 2012 (r239050) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c Sun Aug 5 10:12:27 2012 (r239051) @@ -802,13 +802,17 @@ ar5212IntrReqTxDesc(struct ath_hal *ah, HAL_BOOL ar5212FillTxDesc(struct ath_hal *ah, struct ath_desc *ds, - u_int segLen, HAL_BOOL firstSeg, HAL_BOOL lastSeg, + HAL_DMA_ADDR *bufAddrList, uint32_t *segLenList, u_int qcuId, + u_int descId, HAL_BOOL firstSeg, HAL_BOOL lastSeg, const struct ath_desc *ds0) { struct ar5212_desc *ads = AR5212DESC(ds); + uint32_t segLen = segLenList[0]; HALASSERT((segLen &~ AR_BufLen) == 0); + ds->ds_data = bufAddrList[0]; + if (firstSeg) { /* * First descriptor, don't clobber xmit control data Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416.h Sun Aug 5 08:56:29 2012 (r239050) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h Sun Aug 5 10:12:27 2012 (r239051) @@ -360,7 +360,8 @@ extern HAL_BOOL ar5416SetupXTxDesc(struc u_int txRate2, u_int txRetries2, u_int txRate3, u_int txRetries3); extern HAL_BOOL ar5416FillTxDesc(struct ath_hal *ah, struct ath_desc *ds, - u_int segLen, HAL_BOOL firstSeg, HAL_BOOL lastSeg, + HAL_DMA_ADDR *bufAddrList, uint32_t *segLenList, + u_int descId, u_int qcuId, HAL_BOOL firstSeg, HAL_BOOL lastSeg, const struct ath_desc *ds0); extern HAL_STATUS ar5416ProcTxDesc(struct ath_hal *ah, struct ath_desc *, struct ath_tx_status *); Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c Sun Aug 5 08:56:29 2012 (r239050) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c Sun Aug 5 10:12:27 2012 (r239051) @@ -277,13 +277,17 @@ ar5416SetupXTxDesc(struct ath_hal *ah, s HAL_BOOL ar5416FillTxDesc(struct ath_hal *ah, struct ath_desc *ds, - u_int segLen, HAL_BOOL firstSeg, HAL_BOOL lastSeg, + HAL_DMA_ADDR *bufAddrList, uint32_t *segLenList, u_int descId, + u_int qcuId, HAL_BOOL firstSeg, HAL_BOOL lastSeg, const struct ath_desc *ds0) { struct ar5416_desc *ads = AR5416DESC(ds); + uint32_t segLen = segLenList[0]; HALASSERT((segLen &~ AR_BufLen) == 0); + ds->ds_data = bufAddrList[0]; + if (firstSeg) { /* * First descriptor, don't clobber xmit control data Modified: head/sys/dev/ath/if_ath_beacon.c ============================================================================== --- head/sys/dev/ath/if_ath_beacon.c Sun Aug 5 08:56:29 2012 (r239050) +++ head/sys/dev/ath/if_ath_beacon.c Sun Aug 5 10:12:27 2012 (r239051) @@ -266,6 +266,8 @@ ath_beacon_setup(struct ath_softc *sc, s int flags, antenna; const HAL_RATE_TABLE *rt; u_int8_t rix, rate; + HAL_DMA_ADDR bufAddrList[4]; + uint32_t segLenList[4]; DPRINTF(sc, ATH_DEBUG_BEACON_PROC, "%s: m %p len %u\n", __func__, m, m->m_len); @@ -300,7 +302,7 @@ ath_beacon_setup(struct ath_softc *sc, s KASSERT(bf->bf_nseg == 1, ("multi-segment beacon frame; nseg %u", bf->bf_nseg)); - ds->ds_data = bf->bf_segs[0].ds_addr; + /* * Calculate rate code. * XXX everything at min xmit rate @@ -323,8 +325,15 @@ ath_beacon_setup(struct ath_softc *sc, s , 0 /* rts/cts duration */ ); /* NB: beacon's BufLen must be a multiple of 4 bytes */ + segLenList[0] = roundup(m->m_len, 4); + segLenList[1] = segLenList[2] = segLenList[3] = 0; + bufAddrList[0] = bf->bf_segs[0].ds_addr; + bufAddrList[1] = bufAddrList[2] = bufAddrList[3] = 0; ath_hal_filltxdesc(ah, ds - , roundup(m->m_len, 4) /* buffer length */ + , bufAddrList + , segLenList + , 0 /* XXX desc id */ + , sc->sc_bhalq /* hardware TXQ */ , AH_TRUE /* first segment */ , AH_TRUE /* last segment */ , ds /* first descriptor */ Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Sun Aug 5 08:56:29 2012 (r239050) +++ head/sys/dev/ath/if_ath_tx.c Sun Aug 5 10:12:27 2012 (r239051) @@ -302,6 +302,9 @@ ath_tx_chaindesclist(struct ath_softc *s struct ath_hal *ah = sc->sc_ah; struct ath_desc *ds, *ds0; int i; + HAL_DMA_ADDR bufAddrList[4]; + uint32_t segLenList[4]; + /* * XXX There's txdma and txdma_mgmt; the descriptor * sizes must match. @@ -313,14 +316,30 @@ ath_tx_chaindesclist(struct ath_softc *s */ ds0 = ds = bf->bf_desc; for (i = 0; i < bf->bf_nseg; i++, ds++) { - ds->ds_data = bf->bf_segs[i].ds_addr; + bufAddrList[0] = bf->bf_segs[i].ds_addr; + segLenList[0] = bf->bf_segs[i].ds_len; + + /* Blank this out until multi-buf support is added for AR9300 */ + bufAddrList[1] = bufAddrList[2] = bufAddrList[3] = 0; + segLenList[1] = segLenList[2] = segLenList[3] = 0; + if (i == bf->bf_nseg - 1) ath_hal_settxdesclink(ah, ds, 0); else ath_hal_settxdesclink(ah, ds, bf->bf_daddr + dd->dd_descsize * (i + 1)); + + /* + * XXX this assumes that bfs_txq is the actual destination + * hardware queue at this point. It may not have been assigned, + * it may actually be pointing to the multicast software + * TXQ id. These must be fixed! + */ ath_hal_filltxdesc(ah, ds - , bf->bf_segs[i].ds_len /* segment length */ + , bufAddrList + , segLenList + , 0 /* XXX desc id */ + , bf->bf_state.bfs_txq->axq_qnum /* XXX multicast? */ , i == 0 /* first segment */ , i == bf->bf_nseg - 1 /* last segment */ , ds0 /* first descriptor */ @@ -526,6 +545,20 @@ ath_tx_setds_11n(struct ath_softc *sc, s DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: end\n", __func__); } +/* + * Hand-off a frame to the multicast TX queue. + * + * This is a software TXQ which will be appended to the CAB queue + * during the beacon setup code. + * + * XXX TODO: since the AR9300 EDMA TX queue support wants the QCU ID + * as part of the TX descriptor, bf_state.bfs_txq must be updated + * with the actual hardware txq, or all of this will fall apart. + * + * XXX It may not be a bad idea to just stuff the QCU ID into bf_state + * and retire bfs_txq; then make sure the CABQ QCU ID is populated + * correctly. + */ static void ath_tx_handoff_mcast(struct ath_softc *sc, struct ath_txq *txq, struct ath_buf *bf) @@ -1065,6 +1098,11 @@ ath_tx_set_rtscts(struct ath_softc *sc, /* * Setup the descriptor chain for a normal or fast-frame * frame. + * + * XXX TODO: extend to include the destination hardware QCU ID. + * Make sure that is correct. Make sure that when being added + * to the mcastq, the CABQ QCUID is set or things will get a bit + * odd. */ static void ath_tx_setds(struct ath_softc *sc, struct ath_buf *bf) @@ -1546,6 +1584,11 @@ ath_tx_start(struct ath_softc *sc, struc DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: tid=%d, ac=%d, is_ampdu=%d\n", __func__, tid, pri, is_ampdu); + /* Set local packet state, used to queue packets to hardware */ + bf->bf_state.bfs_tid = tid; + bf->bf_state.bfs_txq = txq; + bf->bf_state.bfs_pri = pri; + /* * When servicing one or more stations in power-save mode * (or) if there is some mcast data waiting on the mcast @@ -1554,8 +1597,15 @@ ath_tx_start(struct ath_softc *sc, struc * * TODO: we should lock the mcastq before we check the length. */ - if (ismcast && (vap->iv_ps_sta || avp->av_mcastq.axq_depth)) + if (ismcast && (vap->iv_ps_sta || avp->av_mcastq.axq_depth)) { txq = &avp->av_mcastq; + /* + * Mark the frame as eventually belonging on the CAB + * queue, so the descriptor setup functions will + * correctly initialise the descriptor 'qcuId' field. + */ + bf->bf_state.bfs_txq = sc->sc_cabq; + } /* Do the generic frame setup */ /* XXX should just bzero the bf_state? */ @@ -1564,6 +1614,10 @@ ath_tx_start(struct ath_softc *sc, struc /* * Acquire the TXQ lock early, so both the encap and seqno * are allocated together. + * + * XXX should TXQ for CABQ traffic be the multicast queue, + * or the TXQ the given PRI would allocate from? (eg for + * sequence number allocation locking.) */ ATH_TXQ_LOCK(txq); @@ -1809,6 +1863,11 @@ ath_tx_raw_start(struct ath_softc *sc, s bf->bf_state.bfs_shpream = !! (params->ibp_flags & IEEE80211_BPF_SHORTPRE); + /* Set local packet state, used to queue packets to hardware */ + bf->bf_state.bfs_tid = WME_AC_TO_TID(pri); + bf->bf_state.bfs_txq = sc->sc_ac2q[pri]; + bf->bf_state.bfs_pri = pri; + /* XXX this should be done in ath_tx_setrate() */ bf->bf_state.bfs_ctsrate = 0; bf->bf_state.bfs_ctsduration = 0; @@ -2380,12 +2439,20 @@ ath_tx_tid_seqno_assign(struct ath_softc * Otherwise, schedule it as a single frame. */ static void -ath_tx_xmit_aggr(struct ath_softc *sc, struct ath_node *an, struct ath_buf *bf) +ath_tx_xmit_aggr(struct ath_softc *sc, struct ath_node *an, + struct ath_txq *txq, struct ath_buf *bf) { struct ath_tid *tid = &an->an_tid[bf->bf_state.bfs_tid]; - struct ath_txq *txq = bf->bf_state.bfs_txq; +// struct ath_txq *txq = bf->bf_state.bfs_txq; struct ieee80211_tx_ampdu *tap; + if (txq != bf->bf_state.bfs_txq) { + device_printf(sc->sc_dev, "%s: txq %d != bfs_txq %d!\n", + __func__, + txq->axq_qnum, + bf->bf_state.bfs_txq->axq_qnum); + } + ATH_TXQ_LOCK_ASSERT(txq); ATH_TID_LOCK_ASSERT(sc, tid); @@ -2464,6 +2531,8 @@ ath_tx_swq(struct ath_softc *sc, struct __func__, bf, pri, tid, IEEE80211_QOS_HAS_SEQ(wh)); /* Set local packet state, used to queue packets to hardware */ + /* XXX potentially duplicate info, re-check */ + /* XXX remember, txq must be the hardware queue, not the av_mcastq */ bf->bf_state.bfs_tid = tid; bf->bf_state.bfs_txq = txq; bf->bf_state.bfs_pri = pri; @@ -2501,7 +2570,7 @@ ath_tx_swq(struct ath_softc *sc, struct if (txq->axq_depth < sc->sc_hwq_limit) { bf = TAILQ_FIRST(&atid->axq_q); ATH_TXQ_REMOVE(atid, bf, bf_list); - ath_tx_xmit_aggr(sc, an, bf); + ath_tx_xmit_aggr(sc, an, txq, bf); DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: xmit_aggr\n", __func__); Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Sun Aug 5 08:56:29 2012 (r239050) +++ head/sys/dev/ath/if_athvar.h Sun Aug 5 10:12:27 2012 (r239051) @@ -1107,8 +1107,9 @@ void ath_intr(void *); _txr1, _txtr1, _txr2, _txtr2, _txr3, _txtr3) \ ((*(_ah)->ah_setupXTxDesc)((_ah), (_ds), \ (_txr1), (_txtr1), (_txr2), (_txtr2), (_txr3), (_txtr3))) -#define ath_hal_filltxdesc(_ah, _ds, _l, _first, _last, _ds0) \ - ((*(_ah)->ah_fillTxDesc)((_ah), (_ds), (_l), (_first), (_last), (_ds0))) +#define ath_hal_filltxdesc(_ah, _ds, _b, _l, _did, _qid, _first, _last, _ds0) \ + ((*(_ah)->ah_fillTxDesc)((_ah), (_ds), (_b), (_l), (_did), (_qid), \ + (_first), (_last), (_ds0))) #define ath_hal_txprocdesc(_ah, _ds, _ts) \ ((*(_ah)->ah_procTxDesc)((_ah), (_ds), (_ts))) #define ath_hal_gettxintrtxqs(_ah, _txqs) \ From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 10:26:29 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 410F7106566B; Sun, 5 Aug 2012 10:26:29 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id C2ED08FC12; Sun, 5 Aug 2012 10:26:28 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 230E6358C5F; Sun, 5 Aug 2012 12:26:28 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id F343A2847B; Sun, 5 Aug 2012 12:26:27 +0200 (CEST) Date: Sun, 5 Aug 2012 12:26:27 +0200 From: Jilles Tjoelker To: Hiroki Sato Message-ID: <20120805102627.GD99630@stack.nl> References: <501AF66A.8020804@FreeBSD.org> <20120803.124305.1981901625663633450.hrs@allbsd.org> <20120803.131746.1643150967050340012.hrs@allbsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120803.131746.1643150967050340012.hrs@allbsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, dougb@FreeBSD.org, emax@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r238622 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 10:26:29 -0000 On Fri, Aug 03, 2012 at 01:17:46PM +0900, Hiroki Sato wrote: > Hiroki Sato wrote > in <20120803.124305.1981901625663633450.hrs@allbsd.org>: > hr> Maksim Yevmenkin wrote > hr> in : > hr> em> of course :) we have ipv4 systems in production that make use of > hr> em> getaddrinfo(3) api. when a particular dns name is resolved, and, > hr> em> multiple A records are returned, the results get sorted according to > hr> em> the "default" address selection policy. rfc3484 has a set of rules > hr> em> according to which results should be sorted. all of the rules do not > hr> em> apply in our case, except one - the rule #9. the idea is that ipv4 > hr> em> addresses are "converted" to ipv6 addresses and then longest prefix > hr> em> match sorting is applied. in other words, if your system ip address > hr> em> happens to share high bits with the ip address from the A record, the > hr> em> IP address from the A record will always be preferred. of course, > hr> em> longest prefix match is performed without any extra information such > hr> em> as netmask and/or cidr. it really is just matching high bits of the > hr> em> address. > hr> em> so, what we found out, is that some systems tend to favor a particular > hr> em> ip address (from a bunch of ip addresses returned by name resolution) > hr> em> because 4 high bits were the same. basically, round-robin dns was > hr> em> completely shot. > hr> Is that issue solved by applying the attached patch and setting > hr> net.inet6.ip6.longestmatch_mapped=0? > hr> I do not think it is a good idea to use the empty rule to solve it > hr> because if the system has to support IPv6 as well the empty rule has > hr> negative effect. Adding flag to the IPv4 address line in the policy > hr> or adding a sysctl sounds a reasonable solution to me. > Gr, I got a wrong idea about the issue. What you want is to disable > longest match in the dest addr selection. It needs a change in > comp_dst() in getaddrinfo.c. In glibc, getaddrinfo() was changed to ignore common IPv4 address prefixes outside the netmask. This avoids breaking DNS round robin but still prefers truly local services. -- Jilles Tjoelker From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 10:47:18 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C367B106564A; Sun, 5 Aug 2012 10:47:18 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ADCD08FC08; Sun, 5 Aug 2012 10:47:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q75AlIhh074580; Sun, 5 Aug 2012 10:47:18 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75AlIVi074578; Sun, 5 Aug 2012 10:47:18 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201208051047.q75AlIVi074578@svn.freebsd.org> From: Michael Tuexen Date: Sun, 5 Aug 2012 10:47:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239052 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 10:47:18 -0000 Author: tuexen Date: Sun Aug 5 10:47:18 2012 New Revision: 239052 URL: http://svn.freebsd.org/changeset/base/239052 Log: Fix a refcount issue. The called only decrements is stcb is NULL. MFC after: 3 days Discussed with: rrs Modified: head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sun Aug 5 10:12:27 2012 (r239051) +++ head/sys/netinet/sctp_pcb.c Sun Aug 5 10:47:18 2012 (r239052) @@ -2308,10 +2308,9 @@ sctp_findassociation_ep_asconf(struct mb if (zero_address) { stcb = sctp_findassoc_by_vtag(NULL, dst, ntohl(sh->v_tag), inp_p, netp, sh->src_port, sh->dest_port, 1, vrf_id, 0); - /* - * SCTP_PRINTF("findassociation_ep_asconf: zero lookup - * address finds stcb 0x%x\n", (uint32_t)stcb); - */ + if (stcb != NULL) { + SCTP_INP_DECR_REF(*inp_p); + } } else { stcb = sctp_findassociation_ep_addr(inp_p, (struct sockaddr *)&remote_store, netp, From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 11:24:22 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2F278106566C; Sun, 5 Aug 2012 11:24:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 187A28FC08; Sun, 5 Aug 2012 11:24:22 +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 q75BOLPD077509; Sun, 5 Aug 2012 11:24:21 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75BOLtZ077503; Sun, 5 Aug 2012 11:24:21 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201208051124.q75BOLtZ077503@svn.freebsd.org> From: Adrian Chadd Date: Sun, 5 Aug 2012 11:24:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239053 - in head/sys/dev/ath: . ath_hal ath_hal/ar5416 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 11:24:22 -0000 Author: adrian Date: Sun Aug 5 11:24:21 2012 New Revision: 239053 URL: http://svn.freebsd.org/changeset/base/239053 Log: Migrate the 802.11n ath_hal_chaintxdesc() API to use a buffer/segment array, similar to what filltxdesc() uses. This removes the last reference to ds_data in the TX path outside of debugging statements. These need to be adjusted/fixed. Tested: * AR9280 STA/AP with iperf TCP traffic Modified: head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ar5416/ar5416.h head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c head/sys/dev/ath/if_ath_tx.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Sun Aug 5 10:47:18 2012 (r239052) +++ head/sys/dev/ath/ath_hal/ah.h Sun Aug 5 11:24:21 2012 (r239053) @@ -1227,8 +1227,11 @@ struct ath_hal { /* 802.11n Functions */ HAL_BOOL __ahdecl(*ah_chainTxDesc)(struct ath_hal *, - struct ath_desc *, u_int, u_int, HAL_PKT_TYPE, - u_int, HAL_CIPHER, uint8_t, u_int, HAL_BOOL, + struct ath_desc *, + HAL_DMA_ADDR *bufAddrList, + uint32_t *segLenList, + u_int, u_int, HAL_PKT_TYPE, + u_int, HAL_CIPHER, uint8_t, HAL_BOOL, HAL_BOOL, HAL_BOOL); HAL_BOOL __ahdecl(*ah_setupFirstTxDesc)(struct ath_hal *, struct ath_desc *, u_int, u_int, u_int, Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416.h Sun Aug 5 10:47:18 2012 (r239052) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h Sun Aug 5 11:24:21 2012 (r239053) @@ -373,8 +373,9 @@ extern int ar5416SetupTxQueue(struct ath const HAL_TXQ_INFO *qInfo); extern HAL_BOOL ar5416ChainTxDesc(struct ath_hal *ah, struct ath_desc *ds, + HAL_DMA_ADDR *bufAddrList, uint32_t *segLenList, u_int pktLen, u_int hdrLen, HAL_PKT_TYPE type, u_int keyIx, - HAL_CIPHER cipher, uint8_t delims, u_int segLen, + HAL_CIPHER cipher, uint8_t delims, HAL_BOOL firstSeg, HAL_BOOL lastSeg, HAL_BOOL lastAggr); extern HAL_BOOL ar5416SetupFirstTxDesc(struct ath_hal *ah, struct ath_desc *ds, u_int aggrLen, u_int flags, u_int txPower, u_int txRate0, u_int txTries0, Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c Sun Aug 5 10:47:18 2012 (r239052) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c Sun Aug 5 11:24:21 2012 (r239053) @@ -335,13 +335,14 @@ ar5416FillTxDesc(struct ath_hal *ah, str */ HAL_BOOL ar5416ChainTxDesc(struct ath_hal *ah, struct ath_desc *ds, + HAL_DMA_ADDR *bufAddrList, + uint32_t *segLenList, u_int pktLen, u_int hdrLen, HAL_PKT_TYPE type, u_int keyIx, HAL_CIPHER cipher, uint8_t delims, - u_int segLen, HAL_BOOL firstSeg, HAL_BOOL lastSeg, HAL_BOOL lastAggr) @@ -349,6 +350,7 @@ ar5416ChainTxDesc(struct ath_hal *ah, st struct ar5416_desc *ads = AR5416DESC(ds); uint32_t *ds_txstatus = AR5416_DS_TXSTATUS(ah,ads); struct ath_hal_5416 *ahp = AH5416(ah); + u_int segLen = segLenList[0]; int isaggr = 0; uint32_t last_aggr = 0; @@ -357,6 +359,7 @@ ar5416ChainTxDesc(struct ath_hal *ah, st (void) ah; HALASSERT((segLen &~ AR_BufLen) == 0); + ds->ds_data = bufAddrList[0]; HALASSERT(isValidPktType(type)); if (type == HAL_PKT_TYPE_AMPDU) { Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Sun Aug 5 10:47:18 2012 (r239052) +++ head/sys/dev/ath/if_ath_tx.c Sun Aug 5 11:24:21 2012 (r239053) @@ -365,6 +365,9 @@ ath_tx_chaindesclist_subframe(struct ath struct ath_hal *ah = sc->sc_ah; struct ath_desc *ds, *ds0; int i; + HAL_DMA_ADDR bufAddrList[4]; + uint32_t segLenList[4]; + /* * XXX There's txdma and txdma_mgmt; the descriptor * sizes must match. @@ -378,25 +381,30 @@ ath_tx_chaindesclist_subframe(struct ath * That's only going to occur for the first frame in an aggregate. */ for (i = 0; i < bf->bf_nseg; i++, ds++) { - ds->ds_data = bf->bf_segs[i].ds_addr; + bzero(bufAddrList, sizeof(bufAddrList)); + bzero(segLenList, sizeof(segLenList)); if (i == bf->bf_nseg - 1) ath_hal_settxdesclink(ah, ds, 0); else ath_hal_settxdesclink(ah, ds, bf->bf_daddr + dd->dd_descsize * (i + 1)); + bufAddrList[0] = bf->bf_segs[i].ds_addr; + segLenList[0] = bf->bf_segs[i].ds_len; + /* * This performs the setup for an aggregate frame. * This includes enabling the aggregate flags if needed. */ ath_hal_chaintxdesc(ah, ds, + bufAddrList, + segLenList, bf->bf_state.bfs_pktlen, bf->bf_state.bfs_hdrlen, HAL_PKT_TYPE_AMPDU, /* forces aggregate bits to be set */ bf->bf_state.bfs_keyix, 0, /* cipher, calculated from keyix */ bf->bf_state.bfs_ndelim, - bf->bf_segs[i].ds_len, /* segment length */ i == 0, /* first segment */ i == bf->bf_nseg - 1, /* last segment */ bf->bf_next == NULL /* last sub-frame in aggr */ Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Sun Aug 5 10:47:18 2012 (r239052) +++ head/sys/dev/ath/if_athvar.h Sun Aug 5 11:24:21 2012 (r239053) @@ -1130,10 +1130,10 @@ void ath_intr(void *); _txr0, _txtr0, _antm, _rcr, _rcd) \ ((*(_ah)->ah_setupFirstTxDesc)((_ah), (_ds), (_aggrlen), (_flags), \ (_txpower), (_txr0), (_txtr0), (_antm), (_rcr), (_rcd))) -#define ath_hal_chaintxdesc(_ah, _ds, _pktlen, _hdrlen, _type, _keyix, \ - _cipher, _delims, _seglen, _first, _last, _lastaggr) \ - ((*(_ah)->ah_chainTxDesc)((_ah), (_ds), (_pktlen), (_hdrlen), \ - (_type), (_keyix), (_cipher), (_delims), (_seglen), \ +#define ath_hal_chaintxdesc(_ah, _ds, _bl, _sl, _pktlen, _hdrlen, _type, \ + _keyix, _cipher, _delims, _first, _last, _lastaggr) \ + ((*(_ah)->ah_chainTxDesc)((_ah), (_ds), (_bl), (_sl), \ + (_pktlen), (_hdrlen), (_type), (_keyix), (_cipher), (_delims), \ (_first), (_last), (_lastaggr))) #define ath_hal_setuplasttxdesc(_ah, _ds, _ds0) \ ((*(_ah)->ah_setupLastTxDesc)((_ah), (_ds), (_ds0))) From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 11:29:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C40EF1065670; Sun, 5 Aug 2012 11:29:44 +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 AD2B98FC08; Sun, 5 Aug 2012 11:29: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 q75BTiF5077969; Sun, 5 Aug 2012 11:29:44 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75BTilo077967; Sun, 5 Aug 2012 11:29:44 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201208051129.q75BTilo077967@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sun, 5 Aug 2012 11:29:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239054 - head/sys/boot/common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 11:29:44 -0000 Author: ae Date: Sun Aug 5 11:29:44 2012 New Revision: 239054 URL: http://svn.freebsd.org/changeset/base/239054 Log: Create the interface to work with various partition tables from the loader(8). The following partition tables are supported: BSD label, GPT, MBR, EBR and VTOC8. Added: head/sys/boot/common/part.c (contents, props changed) head/sys/boot/common/part.h (contents, props changed) Added: head/sys/boot/common/part.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/common/part.c Sun Aug 5 11:29:44 2012 (r239054) @@ -0,0 +1,839 @@ +/*- + * Copyright (c) 2012 Andrey V. Elsukov + * 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 AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#ifdef PART_DEBUG +#define DEBUG(fmt, args...) printf("%s: " fmt "\n" , __func__ , ## args) +#else +#define DEBUG(fmt, args...) +#endif + +#ifdef LOADER_GPT_SUPPORT +#define MAXTBLSZ 64 +static const uuid_t gpt_uuid_unused = GPT_ENT_TYPE_UNUSED; +static const uuid_t gpt_uuid_ms_basic_data = GPT_ENT_TYPE_MS_BASIC_DATA; +static const uuid_t gpt_uuid_freebsd_ufs = GPT_ENT_TYPE_FREEBSD_UFS; +static const uuid_t gpt_uuid_efi = GPT_ENT_TYPE_EFI; +static const uuid_t gpt_uuid_freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT; +static const uuid_t gpt_uuid_freebsd_nandfs = GPT_ENT_TYPE_FREEBSD_NANDFS; +static const uuid_t gpt_uuid_freebsd_swap = GPT_ENT_TYPE_FREEBSD_SWAP; +static const uuid_t gpt_uuid_freebsd_zfs = GPT_ENT_TYPE_FREEBSD_ZFS; +static const uuid_t gpt_uuid_freebsd_vinum = GPT_ENT_TYPE_FREEBSD_VINUM; +#endif + +struct pentry { + struct ptable_entry part; + uint64_t flags; + union { + uint8_t bsd; + uint8_t mbr; + uuid_t gpt; + uint16_t vtoc8; + } type; + STAILQ_ENTRY(pentry) entry; +}; + +struct ptable { + enum ptable_type type; + uint16_t sectorsize; + uint64_t sectors; + + STAILQ_HEAD(, pentry) entries; +}; + +static struct parttypes { + enum partition_type type; + const char *desc; +} ptypes[] = { + { PART_UNKNOWN, "Unknown" }, + { PART_EFI, "EFI" }, + { PART_FREEBSD, "FreeBSD" }, + { PART_FREEBSD_BOOT, "FreeBSD boot" }, + { PART_FREEBSD_NANDFS, "FreeBSD nandfs" }, + { PART_FREEBSD_UFS, "FreeBSD UFS" }, + { PART_FREEBSD_ZFS, "FreeBSD ZFS" }, + { PART_FREEBSD_SWAP, "FreeBSD swap" }, + { PART_FREEBSD_VINUM, "FreeBSD vinum" }, + { PART_LINUX, "Linux" }, + { PART_LINUX_SWAP, "Linux swap" }, + { PART_DOS, "DOS/Windows" }, +}; + +const char * +parttype2str(enum partition_type type) +{ + int i; + + for (i = 0; i < sizeof(ptypes) / sizeof(ptypes[0]); i++) + if (ptypes[i].type == type) + return (ptypes[i].desc); + return (ptypes[0].desc); +} + +#ifdef LOADER_GPT_SUPPORT +static void +uuid_letoh(uuid_t *uuid) +{ + + uuid->time_low = le32toh(uuid->time_low); + uuid->time_mid = le16toh(uuid->time_mid); + uuid->time_hi_and_version = le16toh(uuid->time_hi_and_version); +} + +static enum partition_type +gpt_parttype(uuid_t type) +{ + + if (uuid_equal(&type, &gpt_uuid_efi, NULL)) + return (PART_EFI); + else if (uuid_equal(&type, &gpt_uuid_ms_basic_data, NULL)) + return (PART_DOS); + else if (uuid_equal(&type, &gpt_uuid_freebsd_boot, NULL)) + return (PART_FREEBSD_BOOT); + else if (uuid_equal(&type, &gpt_uuid_freebsd_ufs, NULL)) + return (PART_FREEBSD_UFS); + else if (uuid_equal(&type, &gpt_uuid_freebsd_zfs, NULL)) + return (PART_FREEBSD_ZFS); + else if (uuid_equal(&type, &gpt_uuid_freebsd_swap, NULL)) + return (PART_FREEBSD_SWAP); + else if (uuid_equal(&type, &gpt_uuid_freebsd_vinum, NULL)) + return (PART_FREEBSD_VINUM); + else if (uuid_equal(&type, &gpt_uuid_freebsd_nandfs, NULL)) + return (PART_FREEBSD_NANDFS); + return (PART_UNKNOWN); +} + +static struct gpt_hdr* +gpt_checkhdr(struct gpt_hdr *hdr, uint64_t lba_self, uint64_t lba_last, + uint16_t sectorsize) +{ + uint32_t sz, crc; + + if (memcmp(hdr->hdr_sig, GPT_HDR_SIG, sizeof(hdr->hdr_sig)) != 0) { + DEBUG("no GPT signature"); + return (NULL); + } + sz = le32toh(hdr->hdr_size); + if (sz < 92 || sz > sectorsize) { + DEBUG("invalid GPT header size: %d", sz); + return (NULL); + } + crc = le32toh(hdr->hdr_crc_self); + hdr->hdr_crc_self = 0; + if (crc32(hdr, sz) != crc) { + DEBUG("GPT header's CRC doesn't match"); + return (NULL); + } + hdr->hdr_crc_self = crc; + hdr->hdr_revision = le32toh(hdr->hdr_revision); + if (hdr->hdr_revision < GPT_HDR_REVISION) { + DEBUG("unsupported GPT revision %d", hdr->hdr_revision); + return (NULL); + } + hdr->hdr_lba_self = le64toh(hdr->hdr_lba_self); + if (hdr->hdr_lba_self != lba_self) { + DEBUG("self LBA doesn't match"); + return (NULL); + } + hdr->hdr_lba_alt = le64toh(hdr->hdr_lba_alt); + if (hdr->hdr_lba_alt == hdr->hdr_lba_self) { + DEBUG("invalid alternate LBA"); + return (NULL); + } + hdr->hdr_entries = le32toh(hdr->hdr_entries); + hdr->hdr_entsz = le32toh(hdr->hdr_entsz); + if (hdr->hdr_entries < 128 || + hdr->hdr_entsz < sizeof(struct gpt_ent) || + sectorsize % hdr->hdr_entsz != 0) { + DEBUG("invalid entry size or number of entries"); + return (NULL); + } + hdr->hdr_lba_start = le64toh(hdr->hdr_lba_start); + hdr->hdr_lba_end = le64toh(hdr->hdr_lba_end); + hdr->hdr_lba_table = le64toh(hdr->hdr_lba_table); + hdr->hdr_crc_table = le32toh(hdr->hdr_crc_table); + uuid_letoh(&hdr->hdr_uuid); + return (hdr); +} + +static int +gpt_checktbl(const struct gpt_hdr *hdr, u_char *tbl, size_t size, + uint64_t lba_last) +{ + struct gpt_ent *ent; + int i, cnt; + + cnt = size / hdr->hdr_entsz; + /* Check CRC only when buffer size is enough for table. */ + if (hdr->hdr_entries <= cnt && + crc32(tbl, size) != hdr->hdr_crc_table) { + DEBUG("GPT table's CRC doesn't match"); + return (-1); + } + ent = (struct gpt_ent *)tbl; + for (i = 0; i < cnt; i++, ent++) { + uuid_letoh(&ent->ent_type); + if (uuid_equal(&ent->ent_type, &gpt_uuid_unused, NULL)) + continue; + ent->ent_lba_start = le64toh(ent->ent_lba_start); + ent->ent_lba_end = le64toh(ent->ent_lba_end); + } + return (0); +} + +static struct ptable* +ptable_gptread(struct ptable *table, void *dev, diskread_t dread) +{ + struct pentry *entry; + struct gpt_hdr *phdr, hdr; + struct gpt_ent *ent; + u_char *buf, *tbl; + uint64_t offset; + int pri, sec, i; + size_t size; + + buf = malloc(table->sectorsize); + if (buf == NULL) + return (NULL); + tbl = malloc(table->sectorsize * MAXTBLSZ); + if (tbl == NULL) { + free(buf); + return (NULL); + } + /* Read the primary GPT header. */ + if (dread(dev, buf, 1, 1) != 0) { + ptable_close(table); + table = NULL; + goto out; + } + pri = sec = 0; + /* Check the primary GPT header. */ + phdr = gpt_checkhdr((struct gpt_hdr *)buf, 1, table->sectors - 1, + table->sectorsize); + if (phdr != NULL) { + /* Read the primary GPT table. */ + size = MIN(MAXTBLSZ, + phdr->hdr_entries * phdr->hdr_entsz / table->sectorsize); + if (dread(dev, tbl, size, phdr->hdr_lba_table) == 0 && + gpt_checktbl(phdr, tbl, size * table->sectorsize, + table->sectors - 1) == 0) { + memcpy(&hdr, phdr, sizeof(hdr)); + pri = 1; + } + } + offset = pri ? hdr.hdr_lba_alt: table->sectors - 1; + /* Read the backup GPT header. */ + if (dread(dev, buf, 1, offset) != 0) + phdr = NULL; + else + phdr = gpt_checkhdr((struct gpt_hdr *)buf, offset, + table->sectors - 1, table->sectorsize); + if (phdr != NULL) { + /* + * Compare primary and backup headers. + * If they are equal, then we do not need to read backup + * table. If they are different, then prefer backup header + * and try to read backup table. + */ + if (pri == 0 || + uuid_equal(&hdr.hdr_uuid, &phdr->hdr_uuid, NULL) == 0 || + hdr.hdr_revision != phdr->hdr_revision || + hdr.hdr_size != phdr->hdr_size || + hdr.hdr_lba_start != phdr->hdr_lba_start || + hdr.hdr_lba_end != phdr->hdr_lba_end || + hdr.hdr_entries != phdr->hdr_entries || + hdr.hdr_entsz != phdr->hdr_entsz || + hdr.hdr_crc_table != phdr->hdr_crc_table) { + /* Read the backup GPT table. */ + size = MIN(MAXTBLSZ, phdr->hdr_entries * + phdr->hdr_entsz / table->sectorsize); + if (dread(dev, tbl, size, phdr->hdr_lba_table) == 0 && + gpt_checktbl(phdr, tbl, size * table->sectorsize, + table->sectors - 1) == 0) { + memcpy(&hdr, phdr, sizeof(hdr)); + sec = 1; + } + } + } + if (pri == 0 && sec == 0) { + /* Both primary and backup tables are invalid. */ + table->type = PTABLE_NONE; + goto out; + } + ent = (struct gpt_ent *)tbl; + size = MIN(hdr.hdr_entries * hdr.hdr_entsz, + MAXTBLSZ * table->sectorsize); + for (i = 0; i < size / hdr.hdr_entsz; i++, ent++) { + if (uuid_equal(&ent->ent_type, &gpt_uuid_unused, NULL)) + continue; + entry = malloc(sizeof(*entry)); + if (entry == NULL) + break; + entry->part.start = ent->ent_lba_start; + entry->part.end = ent->ent_lba_end; + entry->part.index = i + 1; + entry->part.type = gpt_parttype(ent->ent_type); + entry->flags = le64toh(ent->ent_attr); + memcpy(&entry->type.gpt, &ent->ent_type, sizeof(uuid_t)); + STAILQ_INSERT_TAIL(&table->entries, entry, entry); + DEBUG("new GPT partition added"); + } +out: + free(buf); + free(tbl); + return (table); +} +#endif /* LOADER_GPT_SUPPORT */ + +#ifdef LOADER_MBR_SUPPORT +/* We do not need to support too many EBR partitions in the loader */ +#define MAXEBRENTRIES 8 +static enum partition_type +mbr_parttype(uint8_t type) +{ + + switch (type) { + case DOSPTYP_386BSD: + return (PART_FREEBSD); + case DOSPTYP_LINSWP: + return (PART_LINUX_SWAP); + case DOSPTYP_LINUX: + return (PART_LINUX); + case 0x01: + case 0x04: + case 0x06: + case 0x07: + case 0x0b: + case 0x0c: + case 0x0e: + return (PART_DOS); + } + return (PART_UNKNOWN); +} + +struct ptable* +ptable_ebrread(struct ptable *table, void *dev, diskread_t dread) +{ + struct dos_partition *dp; + struct pentry *e1, *entry; + uint32_t start, end, offset; + u_char *buf; + int i, index; + + STAILQ_FOREACH(e1, &table->entries, entry) { + if (e1->type.mbr == DOSPTYP_EXT || + e1->type.mbr == DOSPTYP_EXTLBA) + break; + } + if (e1 == NULL) + return (table); + index = 5; + offset = e1->part.start; + buf = malloc(table->sectorsize); + if (buf == NULL) + return (table); + for (i = 0; i < MAXEBRENTRIES; i++) { + if (offset >= table->sectors) + break; + if (dread(dev, buf, 1, offset) != 0) + break; + dp = (struct dos_partition *)(buf + DOSPARTOFF); + if (dp[0].dp_typ == 0) + break; + start = le32toh(dp[0].dp_start); + if (dp[0].dp_typ == DOSPTYP_EXT && + dp[1].dp_typ == 0) { + offset = e1->part.start + start; + continue; + } + end = le32toh(dp[0].dp_size); + entry = malloc(sizeof(*entry)); + if (entry == NULL) + break; + entry->part.start = e1->part.start + start; + entry->part.end = entry->part.start + end - 1; + entry->part.index = index++; + entry->part.type = mbr_parttype(dp[0].dp_typ); + entry->flags = dp[0].dp_flag; + entry->type.mbr = dp[0].dp_typ; + STAILQ_INSERT_TAIL(&table->entries, entry, entry); + DEBUG("new EBR partition added"); + if (dp[1].dp_typ == 0) + break; + offset = e1->part.start + le32toh(dp[1].dp_start); + } + free(buf); + return (table); +} +#endif /* LOADER_MBR_SUPPORT */ + +static enum partition_type +bsd_parttype(uint8_t type) +{ + + switch (type) { + case FS_NANDFS: + return (PART_FREEBSD_NANDFS); + case FS_SWAP: + return (PART_FREEBSD_SWAP); + case FS_BSDFFS: + return (PART_FREEBSD_UFS); + case FS_VINUM: + return (PART_FREEBSD_VINUM); + case FS_ZFS: + return (PART_FREEBSD_ZFS); + } + return (PART_UNKNOWN); +} + +struct ptable* +ptable_bsdread(struct ptable *table, void *dev, diskread_t dread) +{ + struct disklabel *dl; + struct partition *part; + struct pentry *entry; + u_char *buf; + uint32_t raw_offset; + int i; + + if (table->sectorsize < sizeof(struct disklabel)) { + DEBUG("Too small sectorsize"); + return (table); + } + buf = malloc(table->sectorsize); + if (buf == NULL) + return (table); + if (dread(dev, buf, 1, 1) != 0) { + DEBUG("read failed"); + ptable_close(table); + table = NULL; + goto out; + } + dl = (struct disklabel *)buf; + if (le32toh(dl->d_magic) != DISKMAGIC && + le32toh(dl->d_magic2) != DISKMAGIC) + goto out; + if (le32toh(dl->d_secsize) != table->sectorsize) { + DEBUG("unsupported sector size"); + goto out; + } + dl->d_npartitions = le16toh(dl->d_npartitions); + if (dl->d_npartitions > 20 || dl->d_npartitions < 8) { + DEBUG("invalid number of partitions"); + goto out; + } + part = &dl->d_partitions[0]; + raw_offset = le32toh(part[RAW_PART].p_offset); + for (i = 0; i < dl->d_npartitions; i++, part++) { + if (i == RAW_PART) + continue; + if (part->p_size == 0 || part->p_fstype == 0) + continue; + entry = malloc(sizeof(*entry)); + if (entry == NULL) + break; + entry->part.start = le32toh(part->p_offset) - raw_offset; + entry->part.end = entry->part.start + + le32toh(part->p_size) + 1; + entry->part.type = bsd_parttype(part->p_fstype); + entry->part.index = i; /* starts from zero */ + entry->type.bsd = part->p_fstype; + STAILQ_INSERT_TAIL(&table->entries, entry, entry); + DEBUG("new BSD partition added"); + } + table->type = PTABLE_BSD; +out: + free(buf); + return (table); +} + +#ifdef LOADER_VTOC8_SUPPORT +static enum partition_type +vtoc8_parttype(uint16_t type) +{ + + switch (type) { + case VTOC_TAG_FREEBSD_NANDFS: + return (PART_FREEBSD_NANDFS); + case VTOC_TAG_FREEBSD_SWAP: + return (PART_FREEBSD_SWAP); + case VTOC_TAG_FREEBSD_UFS: + return (PART_FREEBSD_UFS); + case VTOC_TAG_FREEBSD_VINUM: + return (PART_FREEBSD_VINUM); + case VTOC_TAG_FREEBSD_ZFS: + return (PART_FREEBSD_ZFS); + }; + return (PART_UNKNOWN); +} + +static struct ptable* +ptable_vtoc8read(struct ptable *table, void *dev, diskread_t dread) +{ + struct pentry *entry; + struct vtoc8 *dl; + u_char *buf; + uint16_t sum, heads, sectors; + int i; + + if (table->sectorsize != sizeof(struct vtoc8)) + return (table); + buf = malloc(table->sectorsize); + if (buf == NULL) + return (table); + if (dread(dev, buf, 1, 0) != 0) { + DEBUG("read failed"); + ptable_close(table); + table = NULL; + goto out; + } + dl = (struct vtoc8 *)buf; + /* Check the sum */ + for (i = sum = 0; i < sizeof(struct vtoc8); i += sizeof(sum)) + sum ^= be16dec(buf + i); + if (sum != 0) { + DEBUG("incorrect checksum"); + goto out; + } + if (be16toh(dl->nparts) != VTOC8_NPARTS) { + DEBUG("invalid number of entries"); + goto out; + } + sectors = be16toh(dl->nsecs); + heads = be16toh(dl->nheads); + if (sectors * heads == 0) { + DEBUG("invalid geometry"); + goto out; + } + for (i = 0; i < VTOC8_NPARTS; i++) { + dl->part[i].tag = be16toh(dl->part[i].tag); + if (i == VTOC_RAW_PART || + dl->part[i].tag == VTOC_TAG_UNASSIGNED) + continue; + entry = malloc(sizeof(*entry)); + if (entry == NULL) + break; + entry->part.start = be32toh(dl->map[i].cyl) * heads * sectors; + entry->part.end = be32toh(dl->map[i].nblks) + + entry->part.start - 1; + entry->part.type = vtoc8_parttype(dl->part[i].tag); + entry->part.index = i; /* starts from zero */ + entry->type.vtoc8 = dl->part[i].tag; + STAILQ_INSERT_TAIL(&table->entries, entry, entry); + DEBUG("new VTOC8 partition added"); + } + table->type = PTABLE_VTOC8; +out: + free(buf); + return (table); + +} +#endif /* LOADER_VTOC8_SUPPORT */ + +struct ptable* +ptable_open(void *dev, off_t sectors, uint16_t sectorsize, + diskread_t *dread) +{ + struct dos_partition *dp; + struct ptable *table; + u_char *buf; + int i, count; +#ifdef LOADER_MBR_SUPPORT + struct pentry *entry; + uint32_t start, end; + int has_ext; +#endif + table = NULL; + buf = malloc(sectorsize); + if (buf == NULL) + return (NULL); + /* First, read the MBR. */ + if (dread(dev, buf, 1, DOSBBSECTOR) != 0) { + DEBUG("read failed"); + goto out; + } + + table = malloc(sizeof(*table)); + if (table == NULL) + goto out; + table->sectors = sectors; + table->sectorsize = sectorsize; + table->type = PTABLE_NONE; + STAILQ_INIT(&table->entries); + +#ifdef LOADER_VTOC8_SUPPORT + if (be16dec(buf + offsetof(struct vtoc8, magic)) == VTOC_MAGIC) { + if (ptable_vtoc8read(table, dev, dread) == NULL) { + /* Read error. */ + table = NULL; + goto out; + } else if (table->type == PTABLE_VTOC8) + goto out; + } +#endif + /* Check the BSD label. */ + if (ptable_bsdread(table, dev, dread) == NULL) { /* Read error. */ + table = NULL; + goto out; + } else if (table->type == PTABLE_BSD) + goto out; + +#if defined(LOADER_GPT_SUPPORT) || defined(LOADER_MBR_SUPPORT) + /* Check the MBR magic. */ + if (buf[DOSMAGICOFFSET] != 0x55 || + buf[DOSMAGICOFFSET + 1] != 0xaa) { + DEBUG("magic sequence not found"); + goto out; + } + /* Check that we have PMBR. Also do some validation. */ + dp = (struct dos_partition *)(buf + DOSPARTOFF); + for (i = 0, count = 0; i < NDOSPART; i++) { + if (dp[i].dp_flag != 0 && dp[i].dp_flag != 0x80) { + DEBUG("invalid partition flag %x", dp[i].dp_flag); + break; + } +#ifdef LOADER_GPT_SUPPORT + if (dp[i].dp_typ == DOSPTYP_PMBR) { + table->type = PTABLE_GPT; + DEBUG("PMBR detected"); + } +#endif + if (dp[i].dp_typ != 0) + count++; + } + /* Do we have some invalid values? */ + if (i != NDOSPART || + (table->type == PTABLE_GPT && count > 1)) { + table->type = PTABLE_NONE; + DEBUG("invalid values detected, ignore partition table"); + goto out; + } +#ifdef LOADER_GPT_SUPPORT + if (table->type == PTABLE_GPT) { + table = ptable_gptread(table, dev, dread); + goto out; + } +#endif +#ifdef LOADER_MBR_SUPPORT + /* Read MBR. */ + table->type = PTABLE_MBR; + for (i = has_ext = 0; i < NDOSPART; i++) { + if (dp[i].dp_typ == 0) + continue; + start = le32toh(dp[i].dp_start); + end = le32toh(dp[i].dp_size); + if (start == 0 || end == 0) + continue; + if (start + end - 1 >= sectors) + continue; /* XXX: ignore */ + if (dp[i].dp_typ == DOSPTYP_EXT || + dp[i].dp_typ == DOSPTYP_EXTLBA) + has_ext = 1; + entry = malloc(sizeof(*entry)); + if (entry == NULL) + break; + entry->part.start = start; + entry->part.end = start + end - 1; + entry->part.index = i + 1; + entry->part.type = mbr_parttype(dp[i].dp_typ); + entry->flags = dp[i].dp_flag; + entry->type.mbr = dp[i].dp_typ; + STAILQ_INSERT_TAIL(&table->entries, entry, entry); + DEBUG("new MBR partition added"); + } + if (has_ext) { + table = ptable_ebrread(table, dev, dread); + /* FALLTHROUGH */ + } +#endif /* LOADER_MBR_SUPPORT */ +#endif /* LOADER_MBR_SUPPORT || LOADER_GPT_SUPPORT */ +out: + free(buf); + return (table); +} + +void +ptable_close(struct ptable *table) +{ + struct pentry *entry; + + while (!STAILQ_EMPTY(&table->entries)) { + entry = STAILQ_FIRST(&table->entries); + STAILQ_REMOVE_HEAD(&table->entries, entry); + free(entry); + } + free(table); +} + +enum ptable_type +ptable_gettype(const struct ptable *table) +{ + + return (table->type); +} + +int +ptable_getpart(const struct ptable *table, struct ptable_entry *part, int index) +{ + struct pentry *entry; + + if (part == NULL || table == NULL) + return (EINVAL); + + STAILQ_FOREACH(entry, &table->entries, entry) { + if (entry->part.index != index) + continue; + memcpy(part, &entry->part, sizeof(*part)); + return (0); + } + return (ENOENT); +} + +/* + * Search for a slice with the following preferences: + * + * 1: Active FreeBSD slice + * 2: Non-active FreeBSD slice + * 3: Active Linux slice + * 4: non-active Linux slice + * 5: Active FAT/FAT32 slice + * 6: non-active FAT/FAT32 slice + */ +#define PREF_RAWDISK 0 +#define PREF_FBSD_ACT 1 +#define PREF_FBSD 2 +#define PREF_LINUX_ACT 3 +#define PREF_LINUX 4 +#define PREF_DOS_ACT 5 +#define PREF_DOS 6 +#define PREF_NONE 7 +int +ptable_getbestpart(const struct ptable *table, struct ptable_entry *part) +{ + struct pentry *entry, *best; + int pref, preflevel; + + if (part == NULL || table == NULL) + return (EINVAL); + + best = NULL; + preflevel = pref = PREF_NONE; + STAILQ_FOREACH(entry, &table->entries, entry) { +#ifdef LOADER_MBR_SUPPORT + if (table->type == PTABLE_MBR) { + switch (entry->type.mbr) { + case DOSPTYP_386BSD: + pref = entry->flags & 0x80 ? PREF_FBSD_ACT: + PREF_FBSD; + break; + case DOSPTYP_LINUX: + pref = entry->flags & 0x80 ? PREF_LINUX_ACT: + PREF_LINUX; + break; + case 0x01: /* DOS/Windows */ + case 0x04: + case 0x06: + case 0x0c: + case 0x0e: + case DOSPTYP_FAT32: + pref = entry->flags & 0x80 ? PREF_DOS_ACT: + PREF_DOS; + break; + default: + pref = PREF_NONE; + } + } +#endif /* LOADER_MBR_SUPPORT */ +#ifdef LOADER_GPT_SUPPORT + if (table->type == PTABLE_GPT) { + if (entry->part.type == PART_DOS) + pref = PREF_DOS; + else if (entry->part.type == PART_FREEBSD_UFS || + entry->part.type == PART_FREEBSD_ZFS) + pref = PREF_FBSD; + else + pref = PREF_NONE; + } +#endif /* LOADER_GPT_SUPPORT */ + if (pref < preflevel) { + preflevel = pref; + best = entry; + } + } + if (best != NULL) { + memcpy(part, &best->part, sizeof(*part)); + return (0); + } + return (ENOENT); +} + +void +ptable_iterate(const struct ptable *table, void *arg, ptable_iterate_t *iter) +{ + struct pentry *entry; + char name[32]; + + name[0] = '\0'; + STAILQ_FOREACH(entry, &table->entries, entry) { +#ifdef LOADER_MBR_SUPPORT + if (table->type == PTABLE_MBR) + sprintf(name, "s%d", entry->part.index); + else +#endif +#ifdef LOADER_GPT_SUPPORT + if (table->type == PTABLE_GPT) + sprintf(name, "p%d", entry->part.index); + else +#endif +#ifdef LOADER_VTOC8_SUPPORT + if (table->type == PTABLE_VTOC8) + sprintf(name, "%c", (u_char) 'a' + + entry->part.index); + else +#endif + if (table->type == PTABLE_BSD) + sprintf(name, "%c", (u_char) 'a' + + entry->part.index); + iter(arg, name, &entry->part); + } +} + Added: head/sys/boot/common/part.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/common/part.h Sun Aug 5 11:29:44 2012 (r239054) @@ -0,0 +1,82 @@ +/*- + * Copyright (c) 2012 Andrey V. Elsukov + * 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 AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS 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$ + */ + +#ifndef _PART_H_ +#define _PART_H_ + +struct ptable; + +enum ptable_type { + PTABLE_NONE, + PTABLE_BSD, + PTABLE_MBR, + PTABLE_GPT, + PTABLE_VTOC8 +}; + +enum partition_type { + PART_UNKNOWN, + PART_EFI, + PART_FREEBSD, + PART_FREEBSD_BOOT, + PART_FREEBSD_NANDFS, + PART_FREEBSD_UFS, + PART_FREEBSD_ZFS, + PART_FREEBSD_SWAP, + PART_FREEBSD_VINUM, + PART_LINUX, + PART_LINUX_SWAP, + PART_DOS, +}; + +struct ptable_entry { + uint64_t start; + uint64_t end; + int index; + enum partition_type type; +}; + +/* The offset and size are in sectors */ +typedef int (diskread_t)(void *arg, void *buf, size_t blocks, off_t offset); +typedef void (ptable_iterate_t)(void *arg, const char *partname, + const struct ptable_entry *part); + +struct ptable *ptable_open(void *dev, off_t sectors, uint16_t sectorsize, + diskread_t *dread); +void ptable_close(struct ptable *table); +enum ptable_type ptable_gettype(const struct ptable *table); + +int ptable_getpart(const struct ptable *table, struct ptable_entry *part, + int index); +int ptable_getbestpart(const struct ptable *table, struct ptable_entry *part); + +void ptable_iterate(const struct ptable *table, void *arg, + ptable_iterate_t *iter); +const char *parttype2str(enum partition_type type); + +#endif /* !_PART_H_ */ From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 11:50:57 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 230E8106566C; Sun, 5 Aug 2012 11:50:57 +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 0A5D28FC0C; Sun, 5 Aug 2012 11:50: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 q75Boumr079630; Sun, 5 Aug 2012 11:50:56 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75BouF2079626; Sun, 5 Aug 2012 11:50:56 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201208051150.q75BouF2079626@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 5 Aug 2012 11:50:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239055 - in head/sys/dev/usb: . serial X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 11:50:57 -0000 Author: hselasky Date: Sun Aug 5 11:50:56 2012 New Revision: 239055 URL: http://svn.freebsd.org/changeset/base/239055 Log: Update the list of devices supported by the FTDI driver. It might be that the wrong UART reference clock will be used for a few of the IDs. It is currently not possible to figure that out because the Linux FTDI driver detects this run-time and not compile time based on the bcdDevice field of the USB device descriptor. Some of the ID's in usbdevs are not sorted according to the product ID value. Please feel free to fix this. I'm out of my xemacs magic today. This syncronises us with the linux kernel at kernel.org (HEAD). MFC after: 2 weeks Modified: head/sys/dev/usb/serial/uftdi.c head/sys/dev/usb/serial/uftdi_reg.h head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/serial/uftdi.c ============================================================================== --- head/sys/dev/usb/serial/uftdi.c Sun Aug 5 11:29:44 2012 (r239054) +++ head/sys/dev/usb/serial/uftdi.c Sun Aug 5 11:50:56 2012 (r239055) @@ -209,32 +209,228 @@ MODULE_VERSION(uftdi, 1); static const STRUCT_USB_HOST_ID uftdi_devs[] = { #define UFTDI_DEV(v, p, i) \ { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } + UFTDI_DEV(ACTON, SPECTRAPRO, UFTDI_TYPE_AUTO), + UFTDI_DEV(ALTI2, N3, UFTDI_TYPE_AUTO), + UFTDI_DEV(ANALOGDEVICES, GNICE, UFTDI_TYPE_AUTO | UFTDI_FLAG_JTAG), + UFTDI_DEV(ANALOGDEVICES, GNICEPLUS, UFTDI_TYPE_AUTO | UFTDI_FLAG_JTAG), UFTDI_DEV(ATMEL, STK541, UFTDI_TYPE_8U232AM), + UFTDI_DEV(BAYER, CONTOUR_CABLE, UFTDI_TYPE_AUTO), + UFTDI_DEV(BBELECTRONICS, 232USB9M, UFTDI_TYPE_AUTO), + UFTDI_DEV(BBELECTRONICS, 485USB9F_2W, UFTDI_TYPE_AUTO), + UFTDI_DEV(BBELECTRONICS, 485USB9F_4W, UFTDI_TYPE_AUTO), + UFTDI_DEV(BBELECTRONICS, 485USBTB_2W, UFTDI_TYPE_AUTO), + UFTDI_DEV(BBELECTRONICS, 485USBTB_4W, UFTDI_TYPE_AUTO), + UFTDI_DEV(BBELECTRONICS, TTL3USB9M, UFTDI_TYPE_AUTO), + UFTDI_DEV(BBELECTRONICS, TTL5USB9M, UFTDI_TYPE_AUTO), + UFTDI_DEV(BBELECTRONICS, USO9ML2, UFTDI_TYPE_AUTO), + UFTDI_DEV(BBELECTRONICS, USO9ML2DR, UFTDI_TYPE_AUTO), + UFTDI_DEV(BBELECTRONICS, USO9ML2DR_2, UFTDI_TYPE_AUTO), + UFTDI_DEV(BBELECTRONICS, USOPTL4, UFTDI_TYPE_AUTO), + UFTDI_DEV(BBELECTRONICS, USOPTL4DR, UFTDI_TYPE_AUTO), + UFTDI_DEV(BBELECTRONICS, USOPTL4DR2, UFTDI_TYPE_AUTO), UFTDI_DEV(BBELECTRONICS, USOTL4, UFTDI_TYPE_8U232AM), - UFTDI_DEV(DRESDENELEKTRONIK, SENSORTERMINALBOARD, - UFTDI_TYPE_8U232AM), - UFTDI_DEV(DRESDENELEKTRONIK, WIRELESSHANDHELDTERMINAL, - UFTDI_TYPE_8U232AM), + UFTDI_DEV(BBELECTRONICS, USPTL4, UFTDI_TYPE_AUTO), + UFTDI_DEV(BBELECTRONICS, USTL4, UFTDI_TYPE_AUTO), + UFTDI_DEV(BBELECTRONICS, ZZ_PROG1_USB, UFTDI_TYPE_AUTO), + UFTDI_DEV(CONTEC, COM1USBH, UFTDI_TYPE_AUTO), + UFTDI_DEV(DRESDENELEKTRONIK, SENSORTERMINALBOARD, UFTDI_TYPE_8U232AM), + UFTDI_DEV(DRESDENELEKTRONIK, WIRELESSHANDHELDTERMINAL, UFTDI_TYPE_8U232AM), + UFTDI_DEV(ELEKTOR, FT323R, UFTDI_TYPE_AUTO), + UFTDI_DEV(EVOLUTION, ER1, UFTDI_TYPE_AUTO), + UFTDI_DEV(EVOLUTION, HYBRID, UFTDI_TYPE_AUTO), + UFTDI_DEV(EVOLUTION, RCM4, UFTDI_TYPE_AUTO), + UFTDI_DEV(FALCOM, SAMBA, UFTDI_TYPE_AUTO), UFTDI_DEV(FALCOM, TWIST, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FIC, NEO1973_DEBUG, UFTDI_TYPE_AUTO | UFTDI_FLAG_JTAG), + UFTDI_DEV(FIC, NEO1973_DEBUG, UFTDI_TYPE_AUTO | UFTDI_FLAG_JTAG), + UFTDI_DEV(FTDI, 232H, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, 232RL, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, 4N_GALAXY_DE_1, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, 4N_GALAXY_DE_2, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, 4N_GALAXY_DE_3, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, 8U232AM_ALT, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ACCESSO, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ACG_HFDUAL, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ACTIVE_ROBOTS, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ACTZWAVE, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, AMC232, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ARTEMIS, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ASK_RDR400, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ATIK_ATK16, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ATIK_ATK16C, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ATIK_ATK16HR, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ATIK_ATK16HRC, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ATIK_ATK16IC, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, BCS_SE923, UFTDI_TYPE_AUTO), UFTDI_DEV(FTDI, BEAGLEBONE, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, CANDAPTER, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, CANUSB, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, CCSICDU20_0, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, CCSICDU40_1, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, CCSICDU64_4, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, CCSLOAD_N_GO_3, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, CCSMACHX_2, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, CCSPRIME8_5, UFTDI_TYPE_AUTO), UFTDI_DEV(FTDI, CFA_631, UFTDI_TYPE_8U232AM), UFTDI_DEV(FTDI, CFA_632, UFTDI_TYPE_8U232AM), UFTDI_DEV(FTDI, CFA_633, UFTDI_TYPE_8U232AM), UFTDI_DEV(FTDI, CFA_634, UFTDI_TYPE_8U232AM), UFTDI_DEV(FTDI, CFA_635, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, CHAMSYS_24_MASTER_WING, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, CHAMSYS_MAXI_WING, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, CHAMSYS_MEDIA_WING, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, CHAMSYS_MIDI_TIMECODE, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, CHAMSYS_MINI_WING, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, CHAMSYS_PC_WING, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, CHAMSYS_USB_DMX, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, CHAMSYS_WING, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, COM4SM, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, CONVERTER_0, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, CONVERTER_1, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, CONVERTER_2, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, CONVERTER_3, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, CONVERTER_4, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, CONVERTER_5, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, CONVERTER_6, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, CONVERTER_7, UFTDI_TYPE_AUTO), UFTDI_DEV(FTDI, CTI_USB_MINI_485, UFTDI_TYPE_8U232AM), UFTDI_DEV(FTDI, CTI_USB_NANO_485, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, DMX4ALL, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, DOMINTELL_DGQG, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, DOMINTELL_DUSB, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, DOTEC, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ECLO_COM_1WIRE, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ECO_PRO_CDS, UFTDI_TYPE_AUTO), UFTDI_DEV(FTDI, EISCOU, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, ELSTER_UNICOM, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_ALC8500, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_CLI7000, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_CSI8, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_EC3000, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_EM1000DL, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_EM1010PC, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_FEM, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_FHZ1000PC, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_FHZ1300PC, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_FM3RX, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_FS20SIG, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_HS485, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_KL100, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_MSM1, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_PCD200, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_PCK100, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_PPS7330, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_RFP500, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_T1100, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_TFD128, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_TFM100, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_TWS550, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_UAD8, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_UDA7, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_UDF77, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_UIO88, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_ULA200, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_UM100, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_UMS100, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_UO100, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_UR100, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_USI2, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_USR, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_UTP8, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_WS300PC, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_WS444PC, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_WS500, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_WS550, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_WS777, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, ELV_WS888, UFTDI_TYPE_AUTO), UFTDI_DEV(FTDI, EMCU2D, UFTDI_TYPE_8U232AM), UFTDI_DEV(FTDI, EMCU2H, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, FUTURE_0, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, FUTURE_1, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, FUTURE_2, UFTDI_TYPE_AUTO), UFTDI_DEV(FTDI, GAMMASCOUT, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, GENERIC, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, GUDEADS_E808, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, GUDEADS_E809, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, GUDEADS_E80A, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, GUDEADS_E80B, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, GUDEADS_E80C, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, GUDEADS_E80D, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, GUDEADS_E80E, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, GUDEADS_E80F, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, GUDEADS_E88D, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, GUDEADS_E88E, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, GUDEADS_E88F, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, HD_RADIO, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, HO720, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, HO730, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, HO820, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, HO870, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, IBS_APP70, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, IBS_PCMCIA, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, IBS_PEDO, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, IBS_PICPRO, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, IBS_PK1, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, IBS_PROD, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, IBS_RS232MON, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, IBS_US485, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, IPLUS, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, IPLUS2, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, IRTRANS, UFTDI_TYPE_AUTO), UFTDI_DEV(FTDI, KBS, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, LENZ_LIUSB, UFTDI_TYPE_AUTO), UFTDI_DEV(FTDI, LK202, UFTDI_TYPE_8U232AM), UFTDI_DEV(FTDI, LK204, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, LM3S_DEVEL_BOARD, UFTDI_TYPE_AUTO | UFTDI_FLAG_JTAG), + UFTDI_DEV(FTDI, LM3S_EVAL_BOARD, UFTDI_TYPE_AUTO | UFTDI_FLAG_JTAG), + UFTDI_DEV(FTDI, MASTERDEVEL2, UFTDI_TYPE_AUTO), UFTDI_DEV(FTDI, MAXSTREAM, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, MHAM_DB9, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, MHAM_IC, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, MHAM_KW, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, MHAM_RS232, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, MHAM_Y6, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, MHAM_Y8, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, MHAM_Y9, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, MHAM_YS, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, MICRO_CHAMELEON, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, MTXORB_5, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, MTXORB_6, UFTDI_TYPE_AUTO), UFTDI_DEV(FTDI, MX2_3, UFTDI_TYPE_8U232AM), UFTDI_DEV(FTDI, MX4_5, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, NXTCAM, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, OCEANIC, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, OOCDLINK, UFTDI_TYPE_AUTO | UFTDI_FLAG_JTAG), + UFTDI_DEV(FTDI, OPENDCC, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, OPENDCC_GATEWAY, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, OPENDCC_GBM, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, OPENDCC_SNIFFER, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, OPENDCC_THROTTLE, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, PCDJ_DAC2, UFTDI_TYPE_AUTO), UFTDI_DEV(FTDI, PCMSFU, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, PERLE_ULTRAPORT, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, PHI_FISCO, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, PIEGROUP, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, PROPOX_JTAGCABLEII, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, R2000KU_TRUE_RNG, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, R2X0, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, RELAIS, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, REU_TINY, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, RMP200, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, RM_CANVIEW, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, RRCIRKITS_LOCOBUFFER, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, SCIENCESCOPE_HS_LOGBOOK, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, SCIENCESCOPE_LOGBOOKML, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, SCIENCESCOPE_LS_LOGBOOK, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, SCS_DEVICE_0, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, SCS_DEVICE_1, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, SCS_DEVICE_2, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, SCS_DEVICE_3, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, SCS_DEVICE_4, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, SCS_DEVICE_5, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, SCS_DEVICE_6, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, SCS_DEVICE_7, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, SDMUSBQSS, UFTDI_TYPE_AUTO), UFTDI_DEV(FTDI, SEMC_DSS20, UFTDI_TYPE_8U232AM), UFTDI_DEV(FTDI, SERIAL_2232C, UFTDI_TYPE_8U232AM), UFTDI_DEV(FTDI, SERIAL_2232D, UFTDI_TYPE_8U232AM), @@ -242,20 +438,405 @@ static const STRUCT_USB_HOST_ID uftdi_de UFTDI_DEV(FTDI, SERIAL_8U100AX, UFTDI_TYPE_SIO), UFTDI_DEV(FTDI, SERIAL_8U232AM, UFTDI_TYPE_8U232AM), UFTDI_DEV(FTDI, SERIAL_8U232AM4, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, SIGNALYZER_SH2, UFTDI_TYPE_AUTO | UFTDI_FLAG_JTAG), + UFTDI_DEV(FTDI, SIGNALYZER_SH4, UFTDI_TYPE_AUTO | UFTDI_FLAG_JTAG), + UFTDI_DEV(FTDI, SIGNALYZER_SLITE, UFTDI_TYPE_AUTO | UFTDI_FLAG_JTAG), + UFTDI_DEV(FTDI, SIGNALYZER_ST, UFTDI_TYPE_AUTO | UFTDI_FLAG_JTAG), + UFTDI_DEV(FTDI, SPECIAL_1, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, SPECIAL_3, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, SPECIAL_4, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, SPROG_II, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, SR_RADIO, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, SUUNTO_SPORTS, UFTDI_TYPE_AUTO), UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13M, UFTDI_TYPE_8U232AM), UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13S, UFTDI_TYPE_8U232AM), UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13U, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, TAVIR_STK500, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, TERATRONIK_D2XX, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, TERATRONIK_VCP, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, THORLABS, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, TNC_X, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, TTUSB, UFTDI_TYPE_AUTO), UFTDI_DEV(FTDI, TURTELIZER2, UFTDI_TYPE_8U232AM | UFTDI_FLAG_JTAG), UFTDI_DEV(FTDI, UOPTBR, UFTDI_TYPE_8U232AM), UFTDI_DEV(FTDI, USBSERIAL, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, USBX_707, UFTDI_TYPE_AUTO), UFTDI_DEV(FTDI, USB_UIRT, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, USINT_CAT, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, USINT_RS232, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, USINT_WKEY, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, VARDAAN, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, VNHCPCUSB_D, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, WESTREX_MODEL_777, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, WESTREX_MODEL_8900F, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, XF_547, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, XF_640, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, XF_642, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, XM_RADIO, UFTDI_TYPE_AUTO), + UFTDI_DEV(FTDI, YEI_SERVOCENTER31, UFTDI_TYPE_AUTO), + UFTDI_DEV(GNOTOMETRICS, USB, UFTDI_TYPE_AUTO), + UFTDI_DEV(ICOM, SP1, UFTDI_TYPE_AUTO), + UFTDI_DEV(ICOM, OPC_U_UC, UFTDI_TYPE_AUTO), + UFTDI_DEV(ICOM, RP2C1, UFTDI_TYPE_AUTO), + UFTDI_DEV(ICOM, RP2C2, UFTDI_TYPE_AUTO), + UFTDI_DEV(ICOM, RP2D, UFTDI_TYPE_AUTO), + UFTDI_DEV(ICOM, RP2KVR, UFTDI_TYPE_AUTO), + UFTDI_DEV(ICOM, RP2KVT, UFTDI_TYPE_AUTO), + UFTDI_DEV(ICOM, RP2VR, UFTDI_TYPE_AUTO), + UFTDI_DEV(ICOM, RP2VT, UFTDI_TYPE_AUTO), + UFTDI_DEV(ICOM, RP4KVR, UFTDI_TYPE_AUTO), + UFTDI_DEV(ICOM, RP4KVT, UFTDI_TYPE_AUTO), + UFTDI_DEV(IDTECH, IDT1221U, UFTDI_TYPE_AUTO), + UFTDI_DEV(INTERBIOMETRICS, IOBOARD, UFTDI_TYPE_AUTO), + UFTDI_DEV(INTERBIOMETRICS, MINI_IOBOARD, UFTDI_TYPE_AUTO), UFTDI_DEV(INTREPIDCS, NEOVI, UFTDI_TYPE_8U232AM), UFTDI_DEV(INTREPIDCS, VALUECAN, UFTDI_TYPE_8U232AM), + UFTDI_DEV(IONICS, PLUGCOMPUTER, UFTDI_TYPE_AUTO | UFTDI_FLAG_JTAG), + UFTDI_DEV(JETI, SPC1201, UFTDI_TYPE_AUTO), + UFTDI_DEV(KOBIL, CONV_B1, UFTDI_TYPE_AUTO), + UFTDI_DEV(KOBIL, CONV_KAAN, UFTDI_TYPE_AUTO), + UFTDI_DEV(LARSENBRUSGAARD, ALTITRACK, UFTDI_TYPE_AUTO), UFTDI_DEV(MARVELL, SHEEVAPLUG, UFTDI_TYPE_8U232AM), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0100, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0101, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0102, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0103, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0104, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0105, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0106, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0107, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0108, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0109, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_010A, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_010B, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_010C, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_010D, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_010E, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_010F, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0110, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0111, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0112, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0113, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0114, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0115, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0116, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0117, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0118, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0119, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_011A, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_011B, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_011C, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_011D, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_011E, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_011F, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0120, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0121, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0122, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0123, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0124, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0125, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0126, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0128, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0129, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_012A, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_012B, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_012D, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_012E, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_012F, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0130, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0131, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0132, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0133, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0134, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0135, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0136, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0137, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0138, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0139, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_013A, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_013B, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_013C, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_013D, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_013E, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_013F, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0140, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0141, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0142, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0143, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0144, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0145, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0146, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0147, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0148, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0149, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_014A, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_014B, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_014C, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_014D, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_014E, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_014F, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0150, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0151, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0152, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0159, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_015A, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_015B, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_015C, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_015D, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_015E, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_015F, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0160, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0161, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0162, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0163, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0164, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0165, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0166, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0167, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0168, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0169, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_016A, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_016B, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_016C, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_016D, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_016E, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_016F, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0170, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0171, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0172, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0173, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0174, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0175, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0176, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0177, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0178, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0179, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_017A, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_017B, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_017C, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_017D, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_017E, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_017F, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0180, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0181, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0182, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0183, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0184, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0185, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0186, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0187, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0188, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0189, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_018A, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_018B, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_018C, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_018D, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_018E, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_018F, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0190, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0191, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0192, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0193, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0194, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0195, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0196, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0197, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0198, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_0199, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_019A, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_019B, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_019C, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_019D, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_019E, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_019F, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01A0, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01A1, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01A2, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01A3, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01A4, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01A5, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01A6, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01A7, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01A8, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01A9, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01AA, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01AB, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01AC, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01AD, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01AE, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01AF, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01B0, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01B1, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01B2, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01B3, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01B4, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01B5, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01B6, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01B7, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01B8, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01B9, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01BA, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01BB, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01BC, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01BD, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01BE, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01BF, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01C0, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01C1, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01C2, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01C3, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01C4, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01C5, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01C6, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01C7, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01C8, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01C9, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01CA, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01CB, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01CC, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01CD, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01CE, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01CF, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01D0, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01D1, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01D2, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01D3, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01D4, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01D5, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01D6, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01D7, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01D8, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01D9, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01DA, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01DB, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01DC, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01DD, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01DE, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01DF, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01E0, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01E1, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01E2, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01E3, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01E4, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01E5, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01E6, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01E7, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01E8, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01E9, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01EA, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01EB, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01EC, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01ED, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01EE, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01EF, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01F0, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01F1, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01F2, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01F3, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01F4, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01F5, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01F6, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01F7, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01F8, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01F9, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01FA, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01FB, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01FC, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01FD, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01FE, UFTDI_TYPE_AUTO), + UFTDI_DEV(MATRIXORBITAL, FTDI_RANGE_01FF, UFTDI_TYPE_AUTO), UFTDI_DEV(MATRIXORBITAL, MOUA, UFTDI_TYPE_8U232AM), UFTDI_DEV(MELCO, PCOPRS1, UFTDI_TYPE_8U232AM), + UFTDI_DEV(METAGEEK, TELLSTICK, UFTDI_TYPE_AUTO), + UFTDI_DEV(MOBILITY, USB_SERIAL, UFTDI_TYPE_AUTO), + UFTDI_DEV(OLIMEX, ARM_USB_OCD, UFTDI_TYPE_AUTO | UFTDI_FLAG_JTAG), + UFTDI_DEV(OLIMEX, ARM_USB_OCD_H, UFTDI_TYPE_AUTO | UFTDI_FLAG_JTAG), + UFTDI_DEV(PAPOUCH, AD4USB, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, AP485, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, AP485_2, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, DRAK5, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, DRAK6, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, GMSR, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, GMUX, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, IRAMP, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, LEC, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, MU, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, QUIDO10X1, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, QUIDO2X16, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, QUIDO2X2, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, QUIDO30X3, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, QUIDO3X32, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, QUIDO4X4, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, QUIDO60X3, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, QUIDO8X8, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, SB232, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, SB422, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, SB422_2, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, SB485, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, SB485C, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, SB485S, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, SB485_2, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, SIMUKEY, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, TMU, UFTDI_TYPE_AUTO), + UFTDI_DEV(PAPOUCH, UPSUSB, UFTDI_TYPE_AUTO), + UFTDI_DEV(POSIFLEX, PP7000, UFTDI_TYPE_AUTO), + UFTDI_DEV(QIHARDWARE, JTAGSERIAL, UFTDI_TYPE_AUTO | UFTDI_FLAG_JTAG), UFTDI_DEV(RATOC, REXUSB60F, UFTDI_TYPE_8U232AM), - UFTDI_DEV(SIIG2, US2308, UFTDI_TYPE_8U232AM) + UFTDI_DEV(RTSYSTEMS, CT29B, UFTDI_TYPE_AUTO), + UFTDI_DEV(RTSYSTEMS, SERIAL_VX7, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2101, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2102, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2103, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2104, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2106, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2201_1, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2201_2, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2202_1, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2202_2, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2203_1, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2203_2, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2401_1, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2401_2, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2401_3, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2401_4, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2402_1, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2402_2, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2402_3, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2402_4, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2403_1, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2403_2, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2403_3, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2403_4, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2801_1, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2801_2, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2801_3, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2801_4, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2801_5, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2801_6, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2801_7, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2801_8, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2802_1, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2802_2, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2802_3, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2802_4, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2802_5, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2802_6, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2802_7, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2802_8, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2803_1, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2803_2, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2803_3, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2803_4, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2803_5, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2803_6, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2803_7, UFTDI_TYPE_AUTO), + UFTDI_DEV(SEALEVEL, 2803_8, UFTDI_TYPE_AUTO), + UFTDI_DEV(SIIG2, DK201, UFTDI_TYPE_AUTO), + UFTDI_DEV(SIIG2, US2308, UFTDI_TYPE_8U232AM), + UFTDI_DEV(TESTO, USB_INTERFACE, UFTDI_TYPE_AUTO), + UFTDI_DEV(TML, USB_SERIAL, UFTDI_TYPE_AUTO), + UFTDI_DEV(TTI, QL355P, UFTDI_TYPE_AUTO), + UFTDI_DEV(UNKNOWN4, NF_RIC, UFTDI_TYPE_AUTO), #undef UFTDI_DEV }; @@ -314,6 +895,17 @@ uftdi_attach(device_t dev) sc->sc_type = USB_GET_DRIVER_INFO(uaa) & UFTDI_TYPE_MASK; switch (sc->sc_type) { + case UFTDI_TYPE_AUTO: + /* simplified type check */ + if (uaa->info.bcdDevice >= 0x0200 || + usbd_get_iface(uaa->device, 1) != NULL) { + sc->sc_type = UFTDI_TYPE_8U232AM; + sc->sc_hdrlen = 0; + } else { + sc->sc_type = UFTDI_TYPE_SIO; + sc->sc_hdrlen = 1; + } + break; case UFTDI_TYPE_SIO: sc->sc_hdrlen = 1; break; Modified: head/sys/dev/usb/serial/uftdi_reg.h ============================================================================== --- head/sys/dev/usb/serial/uftdi_reg.h Sun Aug 5 11:29:44 2012 (r239054) +++ head/sys/dev/usb/serial/uftdi_reg.h Sun Aug 5 11:50:56 2012 (r239055) @@ -39,6 +39,7 @@ #define UFTDI_TYPE_MASK 0x000000ff #define UFTDI_TYPE_SIO 0x00000001 #define UFTDI_TYPE_8U232AM 0x00000002 +#define UFTDI_TYPE_AUTO (UFTDI_TYPE_SIO | UFTDI_TYPE_8U232AM) #define UFTDI_FLAG_MASK 0x0000ff00 #define UFTDI_FLAG_JTAG 0x00000100 Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Sun Aug 5 11:29:44 2012 (r239054) +++ head/sys/dev/usb/usbdevs Sun Aug 5 11:50:56 2012 (r239055) @@ -322,6 +322,7 @@ vendor VIVITAR 0x0636 Vivitar vendor GUNZE 0x0637 Gunze Electronics USA vendor AVISION 0x0638 Avision vendor TEAC 0x0644 TEAC +vendor ACTON 0x0647 Acton Research Corp. vendor SGI 0x065e Silicon Graphics vendor SANWASUPPLY 0x0663 Sanwa Supply vendor MEGATEC 0x0665 Megatec @@ -346,6 +347,7 @@ vendor AGFA 0x06bd AGFA-Gevaert vendor ASIAMD 0x06be Asia Microelectronic Development vendor BIZLINK 0x06c4 Bizlink International vendor KEYSPAN 0x06cd Keyspan / InnoSys Inc. +vendor CONTEC 0x06ce Contec products vendor AASHIMA 0x06d6 Aashima Technology vendor LIEBERT 0x06da Liebert vendor MULTITECH 0x06e0 MultiTech @@ -488,7 +490,8 @@ vendor GREENHOUSE 0x0a6b GREENHOUSE vendor MEDELI 0x0a67 Medeli vendor GEOCAST 0x0a79 Geocast Network Systems vendor EGO 0x0a92 EGO systems -vendor IDQUANTIQUE 0x0aba id Quantique +vendor IDQUANTIQUE 0x0aba ID Quantique +vendor IDTECH 0x0acd ID TECH vendor ZYDAS 0x0ace Zydas Technology Corporation vendor NEODIO 0x0aec Neodio vendor OPTION 0x0af0 Option N.V. @@ -515,14 +518,20 @@ vendor ADDONICS2 0x0bf6 Addonics Technol vendor FSC 0x0bf8 Fujitsu Siemens Computers vendor AGATE 0x0c08 Agate Technologies vendor DMI 0x0c0b DMI +vendor ICOM 0x0c26 Icom Inc. +vendor GNOTOMETRICS 0x0c33 GN Otometrics vendor CHICONY2 0x0c45 Chicony vendor REINERSCT 0x0c4b Reiner-SCT vendor SEALEVEL 0x0c52 Sealevel System +vendor JETI 0x0c6c Jeti vendor LUWEN 0x0c76 Luwen +vendor ELEKTOR 0x0c7d ELEKTOR Electronics vendor KYOCERA2 0x0c88 Kyocera Wireless Corp. vendor ZCOM 0x0cde Z-Com vendor ATHEROS2 0x0cf3 Atheros Communications +vendor POSIFLEX 0x0d3a POSIFLEX vendor TANGTOP 0x0d3d Tangtop +vendor KOBIL 0x0d46 KOBIL vendor SMC3 0x0d5c Standard Microsystems vendor ADDON 0x0d7d Add-on Technology vendor ACDC 0x0d7e American Computer & Digital Components @@ -531,6 +540,7 @@ vendor CONCEPTRONIC 0x0d8e Conceptronic vendor SKANHEX 0x0d96 Skanhex Technology, Inc. vendor MSI 0x0db0 Micro Star International vendor ELCON 0x0db7 ELCON Systemtechnik +vendor UNKNOWN4 0x0dcd Unknown vendor vendor NETAC 0x0dd8 Netac vendor SITECOMEU 0x0df6 Sitecom Europe vendor MOBILEACTION 0x0df7 Mobile Action @@ -554,6 +564,7 @@ vendor VTECH 0x0f88 VTech vendor FALCOM 0x0f94 Falcom Wireless Communications GmbH vendor RIM 0x0fca Research In Motion vendor DYNASTREAM 0x0fcf Dynastream Innovations +vendor LARSENBRUSGAARD 0x0fd8 Larsen and Brusgaard vendor KONTRON 0x0fe6 Kontron AG vendor QUALCOMM 0x1004 Qualcomm vendor APACER 0x1005 Apacer @@ -561,6 +572,7 @@ vendor MOTOROLA4 0x100d Motorola vendor AIRPLUS 0x1011 Airplus vendor DESKNOTE 0x1019 Desknote vendor NEC3 0x1033 NEC +vendor TTI 0x103e Thurlby Thandar Instruments vendor GIGABYTE 0x1044 GIGABYTE vendor WESTERN 0x1058 Western Digital vendor MOTOROLA 0x1063 Motorola @@ -589,12 +601,14 @@ vendor TOPFIELD 0x11db Topfield Co., Lt vendor SIEMENS3 0x11f5 Siemens vendor NETINDEX 0x11f6 NetIndex vendor ALCATEL 0x11f7 Alcatel +vendor INTERBIOMETRICS 0x1209 Interbiometrics vendor UNKNOWN3 0x1233 Unknown vendor vendor TSUNAMI 0x1241 Tsunami vendor PHEENET 0x124a Pheenet vendor TARGUS 0x1267 Targus vendor TWINMOS 0x126f TwinMOS vendor TENDA 0x1286 Tenda +vendor TESTO 0x128d Testo products vendor CREATIVE2 0x1292 Creative Labs vendor BELKIN2 0x1293 Belkin Components vendor CYBERTAN 0x129b CyberTAN Technology @@ -616,6 +630,7 @@ vendor MERLIN 0x1416 Merlin vendor REDOCTANE 0x1430 RedOctane vendor WISTRONNEWEB 0x1435 Wistron NeWeb vendor RADIOSHACK 0x1453 Radio Shack +vendor FIC 0x1457 FIC / OpenMoko vendor HUAWEI3COM 0x1472 Huawei-3Com vendor ABOCOM2 0x1482 AboCom Systems vendor SILICOM 0x1485 Silicom @@ -634,6 +649,7 @@ vendor OQO 0x1557 OQO vendor UMEDIA 0x157e U-MEDIA Communications vendor FIBERLINE 0x1582 Fiberline vendor SPARKLAN 0x15a9 SparkLAN +vendor OLIMEX 0x15ba Olimex vendor SOUNDGRAPH 0x15c2 Soundgraph, Inc. vendor AMIT2 0x15c5 AMIT vendor TEXTECH 0x15ca Textech International Ltd. @@ -668,14 +684,18 @@ vendor QCOM 0x18e8 Qcom vendor ELV 0x18ef ELV vendor LINKSYS3 0x1915 Linksys vendor QUALCOMMINC 0x19d2 Qualcomm, Incorporated +vendor BAYER 0x1a79 Bayer vendor WCH2 0x1a86 QinHeng Electronics vendor STELERA 0x1a8d Stelera Wireless vendor MATRIXORBITAL 0x1b3d Matrix Orbital vendor OVISLINK 0x1b75 OvisLink +vendor TML 0x1b91 The Mobility Lab vendor TCTMOBILE 0x1bbb TCT Mobile +vendor ALTI2 0x1bc9 Alti-2 products vendor SUNPLUS 0x1bcf Sunplus Innovation Technology Inc. vendor WAGO 0x1be3 WAGO Kontakttechnik GmbH. vendor TELIT 0x1bc7 Telit +vendor IONICS 0x1c0c Ionics PlugComputer vendor LONGCHEER 0x1c9e Longcheer Holdings, Ltd. vendor MPMAN 0x1cae MpMan vendor DRESDENELEKTRONIK 0x1cf1 dresden elektronik @@ -692,8 +712,10 @@ vendor PLANEX2 0x2019 Planex Communicat vendor HAUPPAUGE2 0x2040 Hauppauge Computer Works vendor TLAYTECH 0x20b9 Tlay Tech vendor ENCORE 0x203d Encore +vendor QIHARDWARE 0x20b7 QI-hardware vendor PARA 0x20b8 PARA Industrial vendor SIMTEC 0x20df Simtec Electronics +vendor RTSYSTEMS 0x2100 RTSYSTEMS vendor VIALABS 0x2109 VIA Labs vendor ERICSSON 0x2282 Ericsson vendor MOTOROLA2 0x22b8 Motorola @@ -714,6 +736,7 @@ vendor IRIVER 0x4102 iRiver vendor DELL 0x413c Dell vendor WCH 0x4348 QinHeng Electronics vendor ACEECA 0x4766 Aceeca +vendor PAPOUCH 0x5050 Papouch products vendor AVERATEC 0x50c2 Averatec vendor SWEEX 0x5173 Sweex vendor PROLIFIC2 0x5372 Prolific Technologies @@ -730,6 +753,7 @@ vendor SITECOM2 0x9016 Sitecom vendor MOSCHIP 0x9710 MosChip Semiconductor vendor MARVELL 0x9e88 Marvell Technology Group Ltd. vendor 3COM3 0xa727 3Com +vendor EVOLUTION 0xdeee Evolution Robotics products vendor DATAAPEX 0xdaae DataApex vendor HP2 0xf003 Hewlett Packard vendor LOGILINK 0xfc08 LogiLink @@ -786,6 +810,9 @@ product ABOCOM RT2573_3 0xb21d RT2573 product ABOCOM RT2573_4 0xb21e RT2573 product ABOCOM WUG2700 0xb21f WUG2700 +/* Acton Research Corp. */ +product ACTON SPECTRAPRO 0x0100 FTDI compatible adapter + /* Accton products */ product ACCTON USB320_EC 0x1046 USB320-EC Ethernet Adapter product ACCTON 2664W 0x3501 2664W @@ -949,6 +976,9 @@ product ALINK 3GU 0x9200 3G modem product ALTEC ADA70 0x0070 ADA70 Speakers product ALTEC ASC495 0xff05 ASC495 Speakers +/* Alti-2 products */ +product ALTI2 N3 0x6001 FTDI compatible adapter + /* Allied Telesyn International products */ product ALLIEDTELESYN ATUSB100 0xb100 AT-USB100 @@ -995,6 +1025,10 @@ product AMIT RT2870_1 0x0012 RT2870 /* AMIT(2) products */ product AMIT2 RT2870 0x0008 RT2870 +/* Analog Devices products */ +product ANALOGDEVICES GNICE 0xf000 FTDI compatible adapter +product ANALOGDEVICES GNICEPLUS 0xf001 FTDI compatible adapter + /* Anchor products */ product ANCHOR SERIAL 0x2008 Serial product ANCHOR EZUSB 0x2131 EZUSB @@ -1129,8 +1163,27 @@ product AZUREWAVE RT3070_3 0x3305 RT3070 /* Baltech products */ product BALTECH CARDREADER 0x9999 Card reader +/* Bayer products */ +product BAYER CONTOUR_CABLE 0x6001 FTDI compatible adapter + /* B&B Electronics products */ product BBELECTRONICS USOTL4 0xAC01 RS-422/485 +product BBELECTRONICS 232USB9M 0xac27 FTDI compatible adapter +product BBELECTRONICS 485USB9F_2W 0xac25 FTDI compatible adapter +product BBELECTRONICS 485USB9F_4W 0xac26 FTDI compatible adapter +product BBELECTRONICS 485USBTB_2W 0xac33 FTDI compatible adapter +product BBELECTRONICS 485USBTB_4W 0xac34 FTDI compatible adapter +product BBELECTRONICS TTL3USB9M 0xac50 FTDI compatible adapter +product BBELECTRONICS TTL5USB9M 0xac49 FTDI compatible adapter +product BBELECTRONICS USO9ML2 0xac03 FTDI compatible adapter +product BBELECTRONICS USO9ML2DR 0xac17 FTDI compatible adapter +product BBELECTRONICS USO9ML2DR_2 0xac16 FTDI compatible adapter +product BBELECTRONICS USOPTL4 0xac11 FTDI compatible adapter +product BBELECTRONICS USOPTL4DR 0xac19 FTDI compatible adapter +product BBELECTRONICS USOPTL4DR2 0xac18 FTDI compatible adapter +product BBELECTRONICS USPTL4 0xac12 FTDI compatible adapter +product BBELECTRONICS USTL4 0xac02 FTDI compatible adapter +product BBELECTRONICS ZZ_PROG1_USB 0xba02 FTDI compatible adapter /* Belkin products */ /*product BELKIN F5U111 0x???? F5U111 Ethernet*/ @@ -1297,6 +1350,9 @@ product CONCEPTRONIC2 RT2870_6 0x3c28 RT /* Connectix products */ product CONNECTIX QUICKCAM 0x0001 QuickCam +/* Conect products */ +product CONTEC COM1USBH 0x8311 FTDI compatible adapter + /* Corega products */ product COREGA ETHER_USB_T 0x0001 Ether USB-T product COREGA FETHER_USB_TX 0x0004 FEther USB-TX @@ -1513,6 +1569,9 @@ product ELECOM UCSGT 0x5003 UC-SGT product ELECOM UCSGT0 0x5004 UC-SGT product ELECOM LDUSBTX3 0xabc1 LD-USB/TX +/* Elektor products */ +product ELEKTOR FT323R 0x0005 FTDI compatible adapter + /* Elsa products */ product ELSA MODEM1 0x2265 ELSA Modem Board product ELSA USB2ETHERNET 0x3000 Microlink USB2Ethernet @@ -1590,11 +1649,17 @@ product EPSON SX400 0x084a SX400/NX400/ /* e-TEK Labs products */ product ETEK 1COM 0x8007 Serial +/* Evolution products */ +product EVOLUTION ER1 0x0300 FTDI compatible adapter +product EVOLUTION HYBRID 0x0302 FTDI compatible adapter +product EVOLUTION RCM4 0x0303 FTDI compatible adapter + /* Extended Systems products */ product EXTENDED XTNDACCESS 0x0100 XTNDAccess IrDA /* Falcom products */ product FALCOM TWIST 0x0001 USB GSM/GPRS Modem +product FALCOM SAMBA 0x0005 FTDI compatible adapter /* FEIYA products */ product FEIYA DUMMY 0x0000 Dummy product @@ -1608,6 +1673,9 @@ product FESTO CMSP 0x0501 CMSP /* Fiberline */ product FIBERLINE WL430U 0x6003 WL-430U +/* FIC / OpenMoko */ +product FIC NEO1973_DEBUG 0x5118 FTDI compatible adapter + /* Fossil, Inc products */ product FOSSIL WRISTPDA 0x0002 Wrist PDA @@ -1627,6 +1695,7 @@ product FTDI SERIAL_8U100AX 0x8372 8U100 product FTDI SERIAL_8U232AM 0x6001 8U232AM Serial product FTDI SERIAL_8U232AM4 0x6004 8U232AM Serial product FTDI SERIAL_2232C 0x6010 FT2232C Dual port Serial +product FTDI 232H 0x6014 FTDI compatible adapter product FTDI SERIAL_2232D 0x9e90 FT2232D Dual port Serial product FTDI SERIAL_4232H 0x6011 FT4232H Quad port Serial product FTDI BEAGLEBONE 0xa6d0 BeagleBone @@ -1658,6 +1727,204 @@ product FTDI SEMC_DSS20 0xfc82 SEMC DSS /* Commerzielle und Technische Informationssysteme GmbH products */ product FTDI CTI_USB_NANO_485 0xf60b CTI USB-Nano 485 product FTDI CTI_USB_MINI_485 0xf608 CTI USB-Mini 485 +/* Other products */ +product FTDI 232RL 0xfbfa FTDI compatible adapter +product FTDI 4N_GALAXY_DE_1 0xf3c0 FTDI compatible adapter +product FTDI 4N_GALAXY_DE_2 0xf3c1 FTDI compatible adapter +product FTDI 4N_GALAXY_DE_3 0xf3c2 FTDI compatible adapter +product FTDI 8U232AM_ALT 0x6006 FTDI compatible adapter +product FTDI ACCESSO 0xfad0 FTDI compatible adapter +product FTDI ACG_HFDUAL 0xdd20 FTDI compatible adapter +product FTDI ACTIVE_ROBOTS 0xe548 FTDI compatible adapter +product FTDI ACTZWAVE 0xf2d0 FTDI compatible adapter +product FTDI AMC232 0xff00 FTDI compatible adapter +product FTDI ARTEMIS 0xdf28 FTDI compatible adapter +product FTDI ASK_RDR400 0xc991 FTDI compatible adapter +product FTDI ATIK_ATK16 0xdf30 FTDI compatible adapter +product FTDI ATIK_ATK16C 0xdf32 FTDI compatible adapter +product FTDI ATIK_ATK16HR 0xdf31 FTDI compatible adapter +product FTDI ATIK_ATK16HRC 0xdf33 FTDI compatible adapter +product FTDI ATIK_ATK16IC 0xdf35 FTDI compatible adapter +product FTDI BCS_SE923 0xfb99 FTDI compatible adapter +product FTDI CANDAPTER 0x9f80 FTDI compatible adapter +product FTDI CANUSB 0xffa8 FTDI compatible adapter +product FTDI CCSICDU20_0 0xf9d0 FTDI compatible adapter +product FTDI CCSICDU40_1 0xf9d1 FTDI compatible adapter +product FTDI CCSICDU64_4 0xf9d4 FTDI compatible adapter +product FTDI CCSLOAD_N_GO_3 0xf9d3 FTDI compatible adapter +product FTDI CCSMACHX_2 0xf9d2 FTDI compatible adapter +product FTDI CCSPRIME8_5 0xf9d5 FTDI compatible adapter +product FTDI CHAMSYS_24_MASTER_WING 0xdaf8 FTDI compatible adapter +product FTDI CHAMSYS_MAXI_WING 0xdafd FTDI compatible adapter +product FTDI CHAMSYS_MEDIA_WING 0xdafe FTDI compatible adapter +product FTDI CHAMSYS_MIDI_TIMECODE 0xdafb FTDI compatible adapter +product FTDI CHAMSYS_MINI_WING 0xdafc FTDI compatible adapter +product FTDI CHAMSYS_PC_WING 0xdaf9 FTDI compatible adapter +product FTDI CHAMSYS_USB_DMX 0xdafa FTDI compatible adapter +product FTDI CHAMSYS_WING 0xdaff FTDI compatible adapter +product FTDI COM4SM 0xd578 FTDI compatible adapter +product FTDI CONVERTER_0 0xd388 FTDI compatible adapter +product FTDI CONVERTER_1 0xd389 FTDI compatible adapter +product FTDI CONVERTER_2 0xd38a FTDI compatible adapter +product FTDI CONVERTER_3 0xd38b FTDI compatible adapter +product FTDI CONVERTER_4 0xd38c FTDI compatible adapter +product FTDI CONVERTER_5 0xd38d FTDI compatible adapter +product FTDI CONVERTER_6 0xd38e FTDI compatible adapter +product FTDI CONVERTER_7 0xd38f FTDI compatible adapter +product FTDI DMX4ALL 0xc850 FTDI compatible adapter +product FTDI DOMINTELL_DGQG 0xef50 FTDI compatible adapter +product FTDI DOMINTELL_DUSB 0xef51 FTDI compatible adapter +product FTDI DOTEC 0x9868 FTDI compatible adapter +product FTDI ECLO_COM_1WIRE 0xea90 FTDI compatible adapter +product FTDI ECO_PRO_CDS 0xe520 FTDI compatible adapter +product FTDI ELSTER_UNICOM 0xe700 FTDI compatible adapter +product FTDI ELV_ALC8500 0xf06e FTDI compatible adapter +product FTDI ELV_CLI7000 0xfb59 FTDI compatible adapter +product FTDI ELV_CSI8 0xe0f0 FTDI compatible adapter +product FTDI ELV_EC3000 0xe006 FTDI compatible adapter +product FTDI ELV_EM1000DL 0xe0f1 FTDI compatible adapter +product FTDI ELV_EM1010PC 0xe0ef FTDI compatible adapter +product FTDI ELV_FEM 0xe00a FTDI compatible adapter +product FTDI ELV_FHZ1000PC 0xf06f FTDI compatible adapter +product FTDI ELV_FHZ1300PC 0xe0e8 FTDI compatible adapter +product FTDI ELV_FM3RX 0xe0ed FTDI compatible adapter *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 11:53:17 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 620ED106566B; Sun, 5 Aug 2012 11:53: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 1087B8FC19; Sun, 5 Aug 2012 11: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 q75BrH8W079850; Sun, 5 Aug 2012 11:53:17 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75BrGCQ079848; Sun, 5 Aug 2012 11:53:16 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201208051153.q75BrGCQ079848@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 5 Aug 2012 11:53:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239056 - head/etc/devd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 11:53:17 -0000 Author: hselasky Date: Sun Aug 5 11:53:16 2012 New Revision: 239056 URL: http://svn.freebsd.org/changeset/base/239056 Log: Regenerate usb.conf MFC after: 2 weeks Modified: head/etc/devd/usb.conf Modified: head/etc/devd/usb.conf ============================================================================== --- head/etc/devd/usb.conf Sun Aug 5 11:50:56 2012 (r239055) +++ head/etc/devd/usb.conf Sun Aug 5 11:53:16 2012 (r239056) @@ -157,7 +157,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0403"; - match "product" "(0x6001|0x6004|0x6010|0x6011|0x8372|0x9e90|0xcc48|0xcc49|0xcc4a|0xd678|0xe6c8|0xe888|0xe889|0xe88a|0xe88b|0xe88c|0xee18|0xf608|0xf60b|0xf850|0xfa00|0xfa01|0xfa02|0xfa03|0xfa04|0xfc08|0xfc09|0xfc0b|0xfc0c|0xfc0d|0xfc82)"; + match "product" "(0x6001|0x6004|0x6006|0x6010|0x6011|0x6014|0x8372|0x9378|0x9379|0x937a|0x937c|0x9868|0x9e90|0x9f80|0xa6d0|0xabb8|0xb810|0xb811|0xb812|0xbaf8|0xbca0|0xbca1|0xbca2|0xbca4|0xbcd8|0xbcd9|0xbdc8|0xbfd8|0xbfd9|0xbfda|0xbfdb|0xbfdc|0xc7d0|0xc850|0xc991|0xcaa0|0xcc48|0xcc49|0xcc4a|0xd010|0xd011|0xd012|0xd013|0xd014|0xd015|0xd016|0xd017|0xd070|0xd071|0xd388|0xd389|0xd38a|0xd38b|0xd38c|0xd38d|0xd38e|0xd38f|0xd578|0xd678|0xd738|0xd780|0xdaf8|0xdaf9|0xdafa|0xdafb|0xdafc|0xdafd|0xdafe|0xdaff|0xdc00|0xdc01|0xdd20|0xdf28|0xdf30|0xdf31|0xdf32|0xdf33|0xdf35|0xe000|0xe001|0xe002|0xe004|0xe006|0xe008|0xe009|0xe00a|0xe050|0xe0e8|0xe0e9|0xe0ea|0xe0eb|0xe0ec|0xe0ed|0xe0ee|0xe0ef|0xe0f0|0xe0f1|0xe0f2|0xe0f3|0xe0f4|0xe0f5|0xe0f6|0xe0f7|0xe40b|0xe520|0xe548|0xe6c8|0xe700|0xe729|0xe808|0xe809|0xe80a|0xe80b|0xe80c|0xe80d|0xe80e|0xe80f|0xe888|0xe889|0xe88a|0xe88b|0xe88c|0xe88d|0xe88e|0xe88f|0xea90|0xebe0|0xec88|0xec89|0xed22|0xed71|0xed72|0xed73|0xed74|0xee18|0xeee8|0xeee9|0xeeea|0xeeeb|0xeee c|0xeeed|0xeeee|0xeeef|0xef50|0xef51|0xf068|0xf069|0xf06a|0xf06b|0xf06c|0xf06d|0xf06e|0xf06f|0xf070|0xf0c0|0xf0c8|0xf208|0xf2d0|0xf3c0|0xf3c1|0xf3c2|0xf448|0xf449|0xf44a|0xf44b|0xf44c|0xf460|0xf608|0xf60b|0xf680|0xf850|0xf857|0xf9d0|0xf9d1|0xf9d2|0xf9d3|0xf9d4|0xf9d5|0xfa00|0xfa01|0xfa02|0xfa03|0xfa04|0xfa05|0xfa06|0xfa10|0xfa33|0xfa88|0xfad0|0xfaf0|0xfb58|0xfb59|0xfb5a|0xfb5b|0xfb5c|0xfb5d|0xfb5e|0xfb5f|0xfb80|0xfb99|0xfbfa|0xfc08|0xfc09|0xfc0a|0xfc0b|0xfc0c|0xfc0d|0xfc0e|0xfc0f|0xfc60|0xfc70|0xfc71|0xfc72|0xfc73|0xfc82|0xfd60|0xfe38|0xff00|0xff18|0xff1c|0xff1d|0xff20|0xff38|0xff39|0xff3a|0xff3b|0xff3c|0xff3d|0xff3e|0xff3f|0xffa8)"; action "kldload -n uftdi"; }; @@ -293,7 +293,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0411"; - match "product" "(0x0148|0x0150|0x015d|0x016f|0x01a2)"; + match "product" "(0x0148|0x0150|0x015d|0x016f|0x01a2|0x01ee)"; action "kldload -n if_run"; }; @@ -324,6 +324,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x0456"; + match "product" "(0xf000|0xf001)"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x045a"; match "product" "(0x5001|0x5002)"; action "kldload -n urio"; @@ -1021,7 +1029,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x05c6"; - match "product" "(0x1000|0x6000|0x6613|0x9000)"; + match "product" "(0x1000|0x6000|0x6613|0x9000|0x9204|0x9205)"; action "kldload -n u3g"; }; @@ -1068,6 +1076,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x0647"; + match "product" "0x0100"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x066b"; match "product" "(0x200c|0x2202)"; action "kldload -n if_aue"; @@ -1109,7 +1125,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x067b"; - match "product" "(0x04bb|0x0609|0x0611|0x0612|0x1234|0x206a|0x2303)"; + match "product" "(0x0307|0x04bb|0x0609|0x0611|0x0612|0x1234|0x206a|0x2303)"; action "kldload -n uplcom"; }; @@ -1156,6 +1172,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x06ce"; + match "product" "0x8311"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x06e1"; match "product" "(0x0008|0x0009)"; action "kldload -n if_kue"; @@ -1301,7 +1325,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0789"; - match "product" "(0x0162|0x0163|0x0164|0x0166)"; + match "product" "(0x0162|0x0163|0x0164|0x0166|0x0168)"; action "kldload -n if_run"; }; @@ -1653,7 +1677,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0856"; - match "product" "0xac01"; + match "product" "(0xac01|0xac02|0xac03|0xac11|0xac12|0xac16|0xac17|0xac18|0xac19|0xac25|0xac26|0xac27|0xac33|0xac34|0xac49|0xac50|0xba02)"; action "kldload -n uftdi"; }; @@ -1876,6 +1900,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x0acd"; + match "product" "0x0300"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x0ace"; match "product" "(0x1211|0x1215)"; action "kldload -n if_zyd"; @@ -2045,6 +2077,14 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0b39"; + match "product" "0x0103"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x0b39"; match "product" "0x0109"; action "kldload -n if_aue"; }; @@ -2172,6 +2212,22 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x0c26"; + match "product" "(0x0004|0x0009|0x000a|0x000b|0x000c|0x000d|0x0010|0x0011|0x0012|0x0013|0x0018)"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x0c33"; + match "product" "0x0010"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x0c44"; match "product" "0x03a2"; action "kldload -n uipaq"; @@ -2180,6 +2236,30 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x0c52"; + match "product" "(0x2101|0x2102|0x2103|0x2104|0x2211|0x2212|0x2213|0x2221|0x2222|0x2223|0x2411|0x2412|0x2413|0x2421|0x2422|0x2423|0x2431|0x2432|0x2433|0x2441|0x2442|0x2443|0x2811|0x2812|0x2813|0x2821|0x2822|0x2823|0x2831|0x2832|0x2833|0x2841|0x2842|0x2843|0x2851|0x2852|0x2853|0x2861|0x2862|0x2863|0x2871|0x2872|0x2873|0x2881|0x2882|0x2883|0x9020)"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x0c6c"; + match "product" "0x04b2"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x0c7d"; + match "product" "0x0005"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x0c88"; match "product" "0x17da"; action "kldload -n u3g"; @@ -2276,6 +2356,22 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x0d3a"; + match "product" "0x0300"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x0d46"; + match "product" "(0x2020|0x2021)"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x0d8e"; match "product" "0x3762"; action "kldload -n if_upgt"; @@ -2340,6 +2436,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x0dcd"; + match "product" "0x0001"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x0df6"; match "product" "0x000d"; action "kldload -n if_urtw"; @@ -2557,7 +2661,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0f94"; - match "product" "0x0001"; + match "product" "(0x0001|0x0005)"; action "kldload -n uftdi"; }; @@ -2588,6 +2692,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x0fd8"; + match "product" "0x0001"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x0fe6"; match "product" "(0x8101|0x9700)"; action "kldload -n if_udav"; @@ -2612,6 +2724,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x103e"; + match "product" "0x03e8"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x1044"; match "product" "0x8001"; action "kldload -n if_ural"; @@ -2725,7 +2845,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x10c4"; - match "product" "(0x8066|0x806f|0x807a|0x80ca|0x80dd|0x80ed|0x80f6|0x8115|0x813d|0x813f|0x814a|0x814a|0x814b|0x8156|0x815e|0x818b|0x819f|0x81a6|0x81ac|0x81ad|0x81c8|0x81e2|0x81e7|0x81e8|0x81f2|0x8218|0x822b|0x826b|0x8293|0x82f9|0x8341|0x8382|0x83a8|0x8411|0x846e|0x8477|0xea60|0xea61|0xea71|0xf001|0xf002|0xf003|0xf004)"; + match "product" "(0x8066|0x806f|0x807a|0x80c4|0x80ca|0x80dd|0x80ed|0x80f6|0x8115|0x813d|0x813f|0x814a|0x814a|0x814b|0x8156|0x815e|0x815f|0x818b|0x819f|0x81a6|0x81a9|0x81ac|0x81ad|0x81c8|0x81e2|0x81e7|0x81e8|0x81f2|0x8218|0x822b|0x826b|0x8293|0x82f9|0x8341|0x8382|0x83a8|0x83d8|0x8411|0x8418|0x846e|0x8477|0x85ea|0x85eb|0x8664|0x8665|0xea60|0xea61|0xea70|0xea71|0xea80|0xf001|0xf002|0xf003|0xf004)"; action "kldload -n uslcom"; }; @@ -2900,6 +3020,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x1209"; + match "product" "(0x1002|0x1006)"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x1231"; match "product" "(0xce01|0xce02)"; action "kldload -n uipaq"; @@ -2916,6 +3044,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x128d"; + match "product" "0x0001"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x129b"; match "product" "0x1666"; action "kldload -n if_zyd"; @@ -2933,7 +3069,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x12d1"; - match "product" "(0x1001|0x1003|0x1004|0x1401|0x1402|0x1403|0x1404|0x1405|0x1406|0x1407|0x1408|0x1409|0x140a|0x140b|0x140c|0x140d|0x140e|0x140f|0x1410|0x1411|0x1412|0x1413|0x1414|0x1415|0x1416|0x1417|0x1418|0x1419|0x141a|0x141b|0x141c|0x141d|0x141e|0x141f|0x1420|0x1421|0x1422|0x1423|0x1424|0x1425|0x1426|0x1427|0x1428|0x1429|0x142a|0x142b|0x142c|0x142d|0x142e|0x142f|0x1430|0x1431|0x1432|0x1433|0x1434|0x1435|0x1436|0x1437|0x1438|0x1439|0x143a|0x143b|0x143c|0x143d|0x143e|0x143f|0x1446|0x1465|0x14ac|0x1520|0x1c05|0x1c0b)"; + match "product" "(0x1001|0x1003|0x1004|0x1401|0x1402|0x1403|0x1404|0x1405|0x1406|0x1407|0x1408|0x1409|0x140a|0x140b|0x140c|0x140d|0x140e|0x140f|0x1410|0x1411|0x1412|0x1413|0x1414|0x1415|0x1416|0x1417|0x1418|0x1419|0x141a|0x141b|0x141c|0x141d|0x141e|0x141f|0x1420|0x1421|0x1422|0x1423|0x1424|0x1425|0x1426|0x1427|0x1428|0x1429|0x142a|0x142b|0x142c|0x142d|0x142e|0x142f|0x1430|0x1431|0x1432|0x1433|0x1434|0x1435|0x1436|0x1437|0x1438|0x1439|0x143a|0x143b|0x143c|0x143d|0x143e|0x143f|0x1446|0x1465|0x14ac|0x14fe|0x1505|0x1506|0x1520|0x1803|0x1c05|0x1c0b)"; action "kldload -n u3g"; }; @@ -2949,6 +3085,14 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x1342"; + match "product" "0x0202"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x1342"; match "product" "0x0204"; action "kldload -n if_kue"; }; @@ -3108,6 +3252,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x1457"; + match "product" "(0x5118|0x5118)"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x1472"; match "product" "0x0009"; action "kldload -n if_rum"; @@ -3332,6 +3484,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x15ba"; + match "product" "(0x0003|0x002b)"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x15c5"; match "product" "0x0008"; action "kldload -n if_run"; @@ -3381,7 +3541,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x166a"; - match "product" "0x0303"; + match "product" "(0x0101|0x0201|0x0301|0x0303|0x0304|0x0305|0x0401)"; action "kldload -n uslcom"; }; @@ -3477,7 +3637,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x16d6"; - match "product" "(0x0001|0x0001)"; + match "product" "0x0001"; action "kldload -n uslcom"; }; @@ -3596,6 +3756,22 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x1781"; + match "product" "0x0c30"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x17a8"; + match "product" "(0x0001|0x0005)"; + action "kldload -n uslcom"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x17f4"; match "product" "0xaaaa"; action "kldload -n uslcom"; @@ -3676,6 +3852,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x1a79"; + match "product" "0x6001"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x1a86"; match "product" "0x7523"; action "kldload -n uchcom"; @@ -3693,7 +3877,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x1b3d"; - match "product" "0x0153"; + match "product" "(0x0100|0x0101|0x0102|0x0103|0x0104|0x0105|0x0106|0x0107|0x0108|0x0109|0x010a|0x010b|0x010c|0x010d|0x010e|0x010f|0x0110|0x0111|0x0112|0x0113|0x0114|0x0115|0x0116|0x0117|0x0118|0x0119|0x011a|0x011b|0x011c|0x011d|0x011e|0x011f|0x0120|0x0121|0x0122|0x0123|0x0124|0x0125|0x0126|0x0128|0x0129|0x012a|0x012b|0x012d|0x012e|0x012f|0x0130|0x0131|0x0132|0x0133|0x0134|0x0135|0x0136|0x0137|0x0138|0x0139|0x013a|0x013b|0x013c|0x013d|0x013e|0x013f|0x0140|0x0141|0x0142|0x0143|0x0144|0x0145|0x0146|0x0147|0x0148|0x0149|0x014a|0x014b|0x014c|0x014d|0x014e|0x014f|0x0150|0x0151|0x0152|0x0153|0x0159|0x015a|0x015b|0x015c|0x015d|0x015e|0x015f|0x0160|0x0161|0x0162|0x0163|0x0164|0x0165|0x0166|0x0167|0x0168|0x0169|0x016a|0x016b|0x016c|0x016d|0x016e|0x016f|0x0170|0x0171|0x0172|0x0173|0x0174|0x0175|0x0176|0x0177|0x0178|0x0179|0x017a|0x017b|0x017c|0x017d|0x017e|0x017f|0x0180|0x0181|0x0182|0x0183|0x0184|0x0185|0x0186|0x0187|0x0188|0x0189|0x018a|0x018b|0x018c|0x018d|0x018e|0x018f|0x0190|0x0191|0x019 2|0x0193|0x0194|0x0195|0x0196|0x0197|0x0198|0x0199|0x019a|0x019b|0x019c|0x019d|0x019e|0x019f|0x01a0|0x01a1|0x01a2|0x01a3|0x01a4|0x01a5|0x01a6|0x01a7|0x01a8|0x01a9|0x01aa|0x01ab|0x01ac|0x01ad|0x01ae|0x01af|0x01b0|0x01b1|0x01b2|0x01b3|0x01b4|0x01b5|0x01b6|0x01b7|0x01b8|0x01b9|0x01ba|0x01bb|0x01bc|0x01bd|0x01be|0x01bf|0x01c0|0x01c1|0x01c2|0x01c3|0x01c4|0x01c5|0x01c6|0x01c7|0x01c8|0x01c9|0x01ca|0x01cb|0x01cc|0x01cd|0x01ce|0x01cf|0x01d0|0x01d1|0x01d2|0x01d3|0x01d4|0x01d5|0x01d6|0x01d7|0x01d8|0x01d9|0x01da|0x01db|0x01dc|0x01dd|0x01de|0x01df|0x01e0|0x01e1|0x01e2|0x01e3|0x01e4|0x01e5|0x01e6|0x01e7|0x01e8|0x01e9|0x01ea|0x01eb|0x01ec|0x01ed|0x01ee|0x01ef|0x01f0|0x01f1|0x01f2|0x01f3|0x01f4|0x01f5|0x01f6|0x01f7|0x01f8|0x01f9|0x01fa|0x01fb|0x01fc|0x01fd|0x01fe|0x01ff)"; action "kldload -n uftdi"; }; @@ -3716,6 +3900,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x1b91"; + match "product" "0x0064"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x1bbb"; match "product" "(0x0000|0xf000)"; action "kldload -n u3g"; @@ -3732,6 +3924,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x1bc9"; + match "product" "0x6001"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x1be3"; match "product" "0x07a6"; action "kldload -n uslcom"; @@ -3740,6 +3940,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x1c0c"; + match "product" "0x0102"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x1c9e"; match "product" "(0x6061|0x9603|0x9605|0xf000)"; action "kldload -n u3g"; @@ -3788,6 +3996,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x1e29"; + match "product" "(0x0102|0x0501)"; + action "kldload -n uslcom"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x1eda"; match "product" "0x2310"; action "kldload -n if_run"; @@ -3924,6 +4140,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x20b7"; + match "product" "0x0713"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x20b8"; match "product" "0x8888"; action "kldload -n if_run"; @@ -3940,6 +4164,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x2100"; + match "product" "(0x9e52|0x9e54)"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x22b8"; match "product" "(0x4204|0x4214|0x4224|0x4234|0x4244)"; action "kldload -n uipaq"; @@ -3964,6 +4196,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x3195"; + match "product" "(0xf190|0xf280|0xf281)"; + action "kldload -n uslcom"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x3334"; match "product" "0x1701"; action "kldload -n if_aue"; @@ -4052,6 +4292,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x5050"; + match "product" "(0x0100|0x0101|0x0102|0x0103|0x0104|0x0105|0x0106|0x0107|0x0300|0x0301|0x0400|0x0500|0x0700|0x0800|0x0900|0x0a00|0x0b00|0x0c00|0x0d00|0x0e00|0x0f00|0x1000|0x8000|0x8001|0x8002|0x8003|0x8004|0x8005)"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x5173"; match "product" "0x1809"; action "kldload -n if_zyd"; @@ -4204,6 +4452,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0xdeee"; + match "product" "(0x0300|0x0302|0x0303)"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "intclass" "0x02"; match "intsubclass" "0x02"; match "intprotocol" "0x01"; @@ -4344,5 +4600,5 @@ nomatch 32 { action "kldload -n umass"; }; -# 1654 USB entries processed +# 2271 USB entries processed From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 11:59:47 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 58BBE106564A; Sun, 5 Aug 2012 11:59:47 +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 43F1D8FC12; Sun, 5 Aug 2012 11:59: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 q75BxlC0080442; Sun, 5 Aug 2012 11:59:47 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75Bxlcu080439; Sun, 5 Aug 2012 11:59:47 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201208051159.q75Bxlcu080439@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sun, 5 Aug 2012 11:59:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239057 - head/sys/boot/userboot/userboot X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 11:59:47 -0000 Author: ae Date: Sun Aug 5 11:59:46 2012 New Revision: 239057 URL: http://svn.freebsd.org/changeset/base/239057 Log: Remove unused variables. Modified: head/sys/boot/userboot/userboot/bootinfo32.c head/sys/boot/userboot/userboot/copy.c Modified: head/sys/boot/userboot/userboot/bootinfo32.c ============================================================================== --- head/sys/boot/userboot/userboot/bootinfo32.c Sun Aug 5 11:53:16 2012 (r239056) +++ head/sys/boot/userboot/userboot/bootinfo32.c Sun Aug 5 11:59:46 2012 (r239057) @@ -143,7 +143,7 @@ bi_load32(char *args, int *howtop, int * vm_offset_t size; vm_offset_t ssym, esym; char *rootdevname; - int bootdevnr, i, howto; + int bootdevnr, howto; char *kernelname; const char *kernelpath; Modified: head/sys/boot/userboot/userboot/copy.c ============================================================================== --- head/sys/boot/userboot/userboot/copy.c Sun Aug 5 11:53:16 2012 (r239056) +++ head/sys/boot/userboot/userboot/copy.c Sun Aug 5 11:59:46 2012 (r239057) @@ -50,7 +50,6 @@ userboot_copyout(vm_offset_t va, void *d ssize_t userboot_readin(int fd, vm_offset_t va, size_t len) { - void *pa; ssize_t res, s; size_t sz; char buf[4096]; From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 12:15:16 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 26C51106566B; Sun, 5 Aug 2012 12:15:16 +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 0FD248FC12; Sun, 5 Aug 2012 12:15:16 +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 q75CFFsG081810; Sun, 5 Aug 2012 12:15:15 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75CFFPO081805; Sun, 5 Aug 2012 12:15:15 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201208051215.q75CFFPO081805@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sun, 5 Aug 2012 12:15:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239058 - in head/sys/boot: common userboot userboot/test userboot/userboot X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 12:15:16 -0000 Author: ae Date: Sun Aug 5 12:15:15 2012 New Revision: 239058 URL: http://svn.freebsd.org/changeset/base/239058 Log: Introduce new API to work with disks from the loader's drivers. It uses new API from the part.c to work with partition tables. Update userboot's disk driver to use new API. Note that struct loader_callbacks_v1 has changed. Modified: head/sys/boot/common/Makefile.inc head/sys/boot/common/disk.c head/sys/boot/common/disk.h head/sys/boot/userboot/test/test.c head/sys/boot/userboot/userboot.h head/sys/boot/userboot/userboot/Makefile head/sys/boot/userboot/userboot/devicename.c head/sys/boot/userboot/userboot/userboot_disk.c Modified: head/sys/boot/common/Makefile.inc ============================================================================== --- head/sys/boot/common/Makefile.inc Sun Aug 5 11:59:46 2012 (r239057) +++ head/sys/boot/common/Makefile.inc Sun Aug 5 12:15:15 2012 (r239058) @@ -1,6 +1,6 @@ # $FreeBSD$ -SRCS+= boot.c commands.c console.c devopen.c disk.c interp.c +SRCS+= boot.c commands.c console.c devopen.c interp.c SRCS+= interp_backslash.c interp_parse.c ls.c misc.c SRCS+= module.c panic.c @@ -24,6 +24,18 @@ SRCS+= load_elf64.c reloc_elf64.c SRCS+= dev_net.c .endif +.if !defined(LOADER_NO_DISK_SUPPORT) +SRCS+= disk.c part.c +CFLAGS+= -DLOADER_DISK_SUPPORT +.if !defined(LOADER_NO_GPT_SUPPORT) +SRCS+= crc32.c +CFLAGS+= -DLOADER_GPT_SUPPORT +.endif +.if !defined(LOADER_NO_MBR_SUPPORT) +CFLAGS+= -DLOADER_MBR_SUPPORT +.endif +.endif + .if defined(HAVE_BCACHE) SRCS+= bcache.c .endif Modified: head/sys/boot/common/disk.c ============================================================================== --- head/sys/boot/common/disk.c Sun Aug 5 11:59:46 2012 (r239057) +++ head/sys/boot/common/disk.c Sun Aug 5 12:15:15 2012 (r239058) @@ -1,5 +1,6 @@ /*- * Copyright (c) 1998 Michael Smith + * Copyright (c) 2012 Andrey V. Elsukov * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,26 +28,11 @@ #include __FBSDID("$FreeBSD$"); -/* - * MBR/GPT partitioned disk device handling. - * - * Ideas and algorithms from: - * - * - NetBSD libi386/biosdisk.c - * - FreeBSD biosboot/disk.c - * - */ - +#include #include - -#include -#include -#include - #include -#include - #include +#include #include "disk.h" @@ -56,53 +42,26 @@ __FBSDID("$FreeBSD$"); # define DEBUG(fmt, args...) #endif -/* - * Search for a slice with the following preferences: - * - * 1: Active FreeBSD slice - * 2: Non-active FreeBSD slice - * 3: Active Linux slice - * 4: non-active Linux slice - * 5: Active FAT/FAT32 slice - * 6: non-active FAT/FAT32 slice - */ -#define PREF_RAWDISK 0 -#define PREF_FBSD_ACT 1 -#define PREF_FBSD 2 -#define PREF_LINUX_ACT 3 -#define PREF_LINUX 4 -#define PREF_DOS_ACT 5 -#define PREF_DOS 6 -#define PREF_NONE 7 - -#ifdef LOADER_GPT_SUPPORT - -struct gpt_part { - int gp_index; - uuid_t gp_type; - uint64_t gp_start; - uint64_t gp_end; +struct open_disk { + struct ptable *table; + off_t mediasize; + u_int sectorsize; }; -static uuid_t efi = GPT_ENT_TYPE_EFI; -static uuid_t freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT; -static uuid_t freebsd_ufs = GPT_ENT_TYPE_FREEBSD_UFS; -static uuid_t freebsd_swap = GPT_ENT_TYPE_FREEBSD_SWAP; -static uuid_t freebsd_zfs = GPT_ENT_TYPE_FREEBSD_ZFS; -static uuid_t ms_basic_data = GPT_ENT_TYPE_MS_BASIC_DATA; - -#endif - -#if defined(LOADER_GPT_SUPPORT) || defined(LOADER_MBR_SUPPORT) +struct print_args { + struct disk_devdesc *dev; + const char *prefix; + int verbose; +}; -/* Given a size in 512 byte sectors, convert it to a human-readable number. */ +/* Convert size to a human-readable number. */ static char * -display_size(uint64_t size) +display_size(uint64_t size, u_int sectorsize) { static char buf[80]; char unit; - size /= 2; + size = size * sectorsize / 1024; unit = 'K'; if (size >= 10485760000LL) { size /= 1073741824; @@ -114,687 +73,230 @@ display_size(uint64_t size) size /= 1024; unit = 'M'; } - sprintf(buf, "%.6ld%cB", (long)size, unit); + sprintf(buf, "%ld%cB", (long)size, unit); return (buf); } -#endif - -#ifdef LOADER_MBR_SUPPORT - -static void -disk_checkextended(struct disk_devdesc *dev, - struct dos_partition *slicetab, int slicenum, int *nslicesp) -{ - uint8_t buf[DISK_SECSIZE]; - struct dos_partition *dp; - uint32_t base; - int rc, i, start, end; - - dp = &slicetab[slicenum]; - start = *nslicesp; - - if (dp->dp_size == 0) - goto done; - if (dp->dp_typ != DOSPTYP_EXT) - goto done; - rc = dev->d_dev->dv_strategy(dev, F_READ, dp->dp_start, DISK_SECSIZE, - (char *) buf, NULL); - if (rc) - goto done; - if (buf[0x1fe] != 0x55 || buf[0x1ff] != 0xaa) { - DEBUG("no magic in extended table"); - goto done; - } - base = dp->dp_start; - dp = (struct dos_partition *) &buf[DOSPARTOFF]; - for (i = 0; i < NDOSPART; i++, dp++) { - if (dp->dp_size == 0) - continue; - if (*nslicesp == NEXTDOSPART) - goto done; - dp->dp_start += base; - bcopy(dp, &slicetab[*nslicesp], sizeof(*dp)); - (*nslicesp)++; - } - end = *nslicesp; - - /* - * now, recursively check the slices we just added - */ - for (i = start; i < end; i++) - disk_checkextended(dev, slicetab, i, nslicesp); -done: - return; -} - -static int -disk_readslicetab(struct disk_devdesc *dev, - struct dos_partition **slicetabp, int *nslicesp) -{ - struct dos_partition *slicetab = NULL; - int nslices, i; - int rc; - uint8_t buf[DISK_SECSIZE]; - - /* - * Find the slice in the DOS slice table. - */ - rc = dev->d_dev->dv_strategy(dev, F_READ, 0, DISK_SECSIZE, - (char *) buf, NULL); - if (rc) { - DEBUG("error reading MBR"); - return (rc); - } - - /* - * Check the slice table magic. - */ - if (buf[0x1fe] != 0x55 || buf[0x1ff] != 0xaa) { - DEBUG("no slice table/MBR (no magic)"); - return (rc); - } - - /* - * copy the partition table, then pick up any extended partitions. - */ - slicetab = malloc(NEXTDOSPART * sizeof(struct dos_partition)); - bcopy(buf + DOSPARTOFF, slicetab, - sizeof(struct dos_partition) * NDOSPART); - nslices = NDOSPART; /* extended slices start here */ - for (i = 0; i < NDOSPART; i++) - disk_checkextended(dev, slicetab, i, &nslices); - - *slicetabp = slicetab; - *nslicesp = nslices; - return (0); -} - -/* - * Search for the best MBR slice (typically the first FreeBSD slice). - */ -static int -disk_bestslice(struct dos_partition *slicetab, int nslices) -{ - struct dos_partition *dp; - int pref, preflevel; - int i, prefslice; - - prefslice = 0; - preflevel = PREF_NONE; - - dp = &slicetab[0]; - for (i = 0; i < nslices; i++, dp++) { - switch (dp->dp_typ) { - case DOSPTYP_386BSD: /* FreeBSD */ - pref = dp->dp_flag & 0x80 ? PREF_FBSD_ACT : PREF_FBSD; - break; - - case DOSPTYP_LINUX: - pref = dp->dp_flag & 0x80 ? PREF_LINUX_ACT : PREF_LINUX; - break; - - case 0x01: /* DOS/Windows */ - case 0x04: - case 0x06: - case 0x0b: - case 0x0c: - case 0x0e: - pref = dp->dp_flag & 0x80 ? PREF_DOS_ACT : PREF_DOS; - break; - - default: - pref = PREF_NONE; - } - if (pref < preflevel) { - preflevel = pref; - prefslice = i + 1; - } - } - return (prefslice); -} - static int -disk_openmbr(struct disk_devdesc *dev) -{ - struct dos_partition *slicetab = NULL, *dptr; - int nslices, sector, slice; - int rc; - uint8_t buf[DISK_SECSIZE]; - struct disklabel *lp; - - /* - * Following calculations attempt to determine the correct value - * for dev->d_offset by looking for the slice and partition specified, - * or searching for reasonable defaults. - */ - rc = disk_readslicetab(dev, &slicetab, &nslices); - if (rc) - return (rc); - - /* - * if a slice number was supplied but not found, this is an error. - */ - if (dev->d_slice > 0) { - slice = dev->d_slice - 1; - if (slice >= nslices) { - DEBUG("slice %d not found", slice); - rc = EPART; - goto out; - } - } - - /* - * Check for the historically bogus MBR found on true dedicated disks - */ - if (slicetab[3].dp_typ == DOSPTYP_386BSD && - slicetab[3].dp_start == 0 && slicetab[3].dp_size == 50000) { - sector = 0; - goto unsliced; - } - - /* - * Try to auto-detect the best slice; this should always give - * a slice number - */ - if (dev->d_slice == 0) { - slice = disk_bestslice(slicetab, nslices); - if (slice == -1) { - rc = ENOENT; - goto out; - } - dev->d_slice = slice; - } - - /* - * Accept the supplied slice number unequivocally (we may be looking - * at a DOS partition). - * Note: we number 1-4, offsets are 0-3 - */ - dptr = &slicetab[dev->d_slice - 1]; - sector = dptr->dp_start; - DEBUG("slice entry %d at %d, %d sectors", - dev->d_slice - 1, sector, dptr->dp_size); - -unsliced: - /* - * Now we have the slice offset, look for the partition in the - * disklabel if we have a partition to start with. - * - * XXX we might want to check the label checksum. - */ - if (dev->d_partition < 0) { - /* no partition, must be after the slice */ - DEBUG("opening raw slice"); - dev->d_offset = sector; - rc = 0; - goto out; - } - - rc = dev->d_dev->dv_strategy(dev, F_READ, sector + LABELSECTOR, - DISK_SECSIZE, (char *) buf, NULL); - if (rc) { - DEBUG("error reading disklabel"); - goto out; - } - - lp = (struct disklabel *) buf; - - if (lp->d_magic != DISKMAGIC) { - DEBUG("no disklabel"); - rc = ENOENT; - goto out; - } - if (dev->d_partition >= lp->d_npartitions) { - DEBUG("partition '%c' exceeds partitions in table (a-'%c')", - 'a' + dev->d_partition, - 'a' + lp->d_npartitions); - rc = EPART; - goto out; - } - - dev->d_offset = - lp->d_partitions[dev->d_partition].p_offset - - lp->d_partitions[RAW_PART].p_offset + - sector; - rc = 0; - -out: - if (slicetab) - free(slicetab); - return (rc); -} - -/* - * Print out each valid partition in the disklabel of a FreeBSD slice. - * For size calculations, we assume a 512 byte sector size. - */ -static void -disk_printbsdslice(struct disk_devdesc *dev, daddr_t offset, - char *prefix, int verbose) +ptblread(void *d, void *buf, size_t blocks, off_t offset) { - char line[80]; - char buf[DISK_SECSIZE]; - struct disklabel *lp; - int i, rc, fstype; - - /* read disklabel */ - rc = dev->d_dev->dv_strategy(dev, F_READ, offset + LABELSECTOR, - DISK_SECSIZE, (char *) buf, NULL); - if (rc) - return; - lp =(struct disklabel *)(&buf[0]); - if (lp->d_magic != DISKMAGIC) { - sprintf(line, "%s: FFS bad disklabel\n", prefix); - pager_output(line); - return; - } + struct disk_devdesc *dev; + struct open_disk *od; - /* Print partitions */ - for (i = 0; i < lp->d_npartitions; i++) { - /* - * For each partition, make sure we know what type of fs it - * is. If not, then skip it. - */ - fstype = lp->d_partitions[i].p_fstype; - if (fstype != FS_BSDFFS && - fstype != FS_SWAP && - fstype != FS_VINUM) - continue; - - /* Only print out statistics in verbose mode */ - if (verbose) - sprintf(line, " %s%c: %s %s (%d - %d)\n", - prefix, 'a' + i, - (fstype == FS_SWAP) ? "swap " : - (fstype == FS_VINUM) ? "vinum" : - "FFS ", - display_size(lp->d_partitions[i].p_size), - lp->d_partitions[i].p_offset, - (lp->d_partitions[i].p_offset - + lp->d_partitions[i].p_size)); - else - sprintf(line, " %s%c: %s\n", prefix, 'a' + i, - (fstype == FS_SWAP) ? "swap" : - (fstype == FS_VINUM) ? "vinum" : - "FFS"); - pager_output(line); - } + dev = (struct disk_devdesc *)d; + od = (struct open_disk *)dev->d_opendata; + return (dev->d_dev->dv_strategy(dev, F_READ, offset, + blocks * od->sectorsize, (char *)buf, NULL)); } +#define PWIDTH 35 static void -disk_printslice(struct disk_devdesc *dev, int slice, - struct dos_partition *dp, char *prefix, int verbose) +ptable_print(void *arg, const char *pname, const struct ptable_entry *part) { - char stats[80]; + struct print_args *pa, bsd; + struct open_disk *od; + struct ptable *table; char line[80]; - if (verbose) - sprintf(stats, " %s (%d - %d)", display_size(dp->dp_size), - dp->dp_start, dp->dp_start + dp->dp_size); - else - stats[0] = '\0'; - - switch (dp->dp_typ) { - case DOSPTYP_386BSD: - disk_printbsdslice(dev, (daddr_t)dp->dp_start, - prefix, verbose); - return; - case DOSPTYP_LINSWP: - sprintf(line, "%s: Linux swap%s\n", prefix, stats); - break; - case DOSPTYP_LINUX: - /* - * XXX - * read the superblock to confirm this is an ext2fs partition? - */ - sprintf(line, "%s: ext2fs%s\n", prefix, stats); - break; - case 0x00: /* unused partition */ - case DOSPTYP_EXT: - return; - case 0x01: - sprintf(line, "%s: FAT-12%s\n", prefix, stats); - break; - case 0x04: - case 0x06: - case 0x0e: - sprintf(line, "%s: FAT-16%s\n", prefix, stats); - break; - case 0x07: - sprintf(line, "%s: NTFS/HPFS%s\n", prefix, stats); - break; - case 0x0b: - case 0x0c: - sprintf(line, "%s: FAT-32%s\n", prefix, stats); - break; - default: - sprintf(line, "%s: Unknown fs: 0x%x %s\n", prefix, dp->dp_typ, - stats); - } + pa = (struct print_args *)arg; + od = (struct open_disk *)pa->dev->d_opendata; + sprintf(line, " %s%s: %s", pa->prefix, pname, + parttype2str(part->type)); + if (pa->verbose) + sprintf(line, "%-*s%s", PWIDTH, line, + display_size(part->end - part->start + 1, + od->sectorsize)); + strcat(line, "\n"); pager_output(line); -} - -static int -disk_printmbr(struct disk_devdesc *dev, char *prefix, int verbose) -{ - struct dos_partition *slicetab; - int nslices, i; - int rc; - char line[80]; - - rc = disk_readslicetab(dev, &slicetab, &nslices); - if (rc) - return (rc); - for (i = 0; i < nslices; i++) { - sprintf(line, "%ss%d", prefix, i + 1); - disk_printslice(dev, i, &slicetab[i], line, verbose); - } - free(slicetab); - return (0); -} - -#endif - -#ifdef LOADER_GPT_SUPPORT - -static int -disk_readgpt(struct disk_devdesc *dev, struct gpt_part **gptp, int *ngptp) -{ - struct dos_partition *dp; - struct gpt_hdr *hdr; - struct gpt_ent *ent; - struct gpt_part *gptab = NULL; - int entries_per_sec, rc, i, part; - daddr_t lba, elba; - uint8_t gpt[DISK_SECSIZE], tbl[DISK_SECSIZE]; - - /* - * Following calculations attempt to determine the correct value - * for dev->d_offset by looking for the slice and partition specified, - * or searching for reasonable defaults. - */ - rc = 0; - - /* First, read the MBR and see if we have a PMBR. */ - rc = dev->d_dev->dv_strategy(dev, F_READ, 0, DISK_SECSIZE, - (char *) tbl, NULL); - if (rc) { - DEBUG("error reading MBR"); - return (EIO); + if (part->type == PART_FREEBSD) { + /* Open slice with BSD label */ + pa->dev->d_offset = part->start; + table = ptable_open(pa->dev, part->end - part->start + 1, + od->sectorsize, ptblread); + if (table == NULL) + return; + sprintf(line, " %s%s", pa->prefix, pname); + bsd.dev = pa->dev; + bsd.prefix = line; + bsd.verbose = pa->verbose; + ptable_iterate(table, &bsd, ptable_print); + ptable_close(table); } - - /* Check the slice table magic. */ - if (tbl[0x1fe] != 0x55 || tbl[0x1ff] != 0xaa) - return (ENXIO); - - /* Check for GPT slice. */ - part = 0; - dp = (struct dos_partition *)(tbl + DOSPARTOFF); - for (i = 0; i < NDOSPART; i++) { - if (dp[i].dp_typ == 0xee) - part++; - else if ((part != 1) && (dp[i].dp_typ != 0x00)) - return (EINVAL); - } - if (part != 1) - return (EINVAL); - - /* Read primary GPT table header. */ - rc = dev->d_dev->dv_strategy(dev, F_READ, 1, DISK_SECSIZE, - (char *) gpt, NULL); - if (rc) { - DEBUG("error reading GPT header"); - return (EIO); - } - hdr = (struct gpt_hdr *)gpt; - if (bcmp(hdr->hdr_sig, GPT_HDR_SIG, sizeof(hdr->hdr_sig)) != 0 || - hdr->hdr_lba_self != 1 || hdr->hdr_revision < 0x00010000 || - hdr->hdr_entsz < sizeof(*ent) || - DISK_SECSIZE % hdr->hdr_entsz != 0) { - DEBUG("Invalid GPT header\n"); - return (EINVAL); - } - - /* Walk the partition table to count valid partitions. */ - part = 0; - entries_per_sec = DISK_SECSIZE / hdr->hdr_entsz; - elba = hdr->hdr_lba_table + hdr->hdr_entries / entries_per_sec; - for (lba = hdr->hdr_lba_table; lba < elba; lba++) { - rc = dev->d_dev->dv_strategy(dev, F_READ, lba, DISK_SECSIZE, - (char *) tbl, NULL); - if (rc) { - DEBUG("error reading GPT table"); - return (EIO); - } - for (i = 0; i < entries_per_sec; i++) { - ent = (struct gpt_ent *)(tbl + i * hdr->hdr_entsz); - if (uuid_is_nil(&ent->ent_type, NULL) || - ent->ent_lba_start == 0 || - ent->ent_lba_end < ent->ent_lba_start) - continue; - part++; - } - } - - /* Save the important information about all the valid partitions. */ - if (part != 0) { - gptab = malloc(part * sizeof(struct gpt_part)); - part = 0; - for (lba = hdr->hdr_lba_table; lba < elba; lba++) { - rc = dev->d_dev->dv_strategy(dev, F_READ, lba, DISK_SECSIZE, - (char *) tbl, NULL); - if (rc) { - DEBUG("error reading GPT table"); - free(gptab); - return (EIO); - } - for (i = 0; i < entries_per_sec; i++) { - ent = (struct gpt_ent *)(tbl + i * hdr->hdr_entsz); - if (uuid_is_nil(&ent->ent_type, NULL) || - ent->ent_lba_start == 0 || - ent->ent_lba_end < ent->ent_lba_start) - continue; - gptab[part].gp_index = (lba - hdr->hdr_lba_table) * - entries_per_sec + i + 1; - gptab[part].gp_type = ent->ent_type; - gptab[part].gp_start = ent->ent_lba_start; - gptab[part].gp_end = ent->ent_lba_end; - part++; - } - } - } - - *gptp = gptab; - *ngptp = part; - return (0); } +#undef PWIDTH -static struct gpt_part * -disk_bestgpt(struct gpt_part *gpt, int ngpt) +void +disk_print(struct disk_devdesc *dev, char *prefix, int verbose) { - struct gpt_part *gp, *prefpart; - int i, pref, preflevel; - - prefpart = NULL; - preflevel = PREF_NONE; + struct open_disk *od; + struct print_args pa; - gp = gpt; - for (i = 0; i < ngpt; i++, gp++) { - /* Windows. XXX: Also Linux. */ - if (uuid_equal(&gp->gp_type, &ms_basic_data, NULL)) - pref = PREF_DOS; - /* FreeBSD */ - else if (uuid_equal(&gp->gp_type, &freebsd_ufs, NULL) || - uuid_equal(&gp->gp_type, &freebsd_zfs, NULL)) - pref = PREF_FBSD; - else - pref = PREF_NONE; - if (pref < preflevel) { - preflevel = pref; - prefpart = gp; - } - } - return (prefpart); + /* Disk should be opened */ + od = (struct open_disk *)dev->d_opendata; + pa.dev = dev; + pa.prefix = prefix; + pa.verbose = verbose; + ptable_iterate(od->table, &pa, ptable_print); } -static int -disk_opengpt(struct disk_devdesc *dev) +int +disk_open(struct disk_devdesc *dev, off_t mediasize, u_int sectorsize) { - struct gpt_part *gpt = NULL, *gp; - int rc, ngpt, i; + struct open_disk *od; + struct ptable *table; + struct ptable_entry part; + int rc; - rc = disk_readgpt(dev, &gpt, &ngpt); - if (rc) - return (rc); - - /* Is this a request for the whole disk? */ - if (dev->d_slice < 0) { - dev->d_offset = 0; - rc = 0; - goto out; + od = (struct open_disk *)malloc(sizeof(struct open_disk)); + if (od == NULL) { + DEBUG("no memory"); + return (ENOMEM); } - /* - * If a partition number was supplied, then the user is trying to use - * an MBR address rather than a GPT address, so fail. + * While we are reading disk metadata, make sure we do it relative + * to the start of the disk */ - if (dev->d_partition != 0xff) { - rc = ENOENT; + rc = 0; + table = NULL; + dev->d_offset = 0; + dev->d_opendata = od; + od->mediasize = mediasize; + od->sectorsize = sectorsize; + DEBUG("open '%s', unit %d slice %d partition %d", + disk_fmtdev(dev), dev->d_unit, dev->d_slice, dev->d_partition); + + /* Determine disk layout. */ + od->table = ptable_open(dev, mediasize / sectorsize, sectorsize, + ptblread); + if (od->table == NULL) { + DEBUG("Can't read partition table"); + rc = ENXIO; goto out; } - - /* If a slice number was supplied but not found, this is an error. */ - gp = NULL; if (dev->d_slice > 0) { - for (i = 0; i < ngpt; i++) { - if (gpt[i].gp_index == dev->d_slice) { - gp = &gpt[i]; - break; - } - } - if (gp == NULL) { - DEBUG("partition %d not found", dev->d_slice); - rc = ENOENT; + /* Try to get information about partition */ + rc = ptable_getpart(od->table, &part, dev->d_slice); + if (rc != 0) /* Partition doesn't exist */ goto out; - } - } - - /* Try to auto-detect the best partition. */ - if (dev->d_slice == 0) { - gp = disk_bestgpt(gpt, ngpt); - if (gp == NULL) { - rc = ENOENT; + dev->d_offset = part.start; + if (dev->d_partition == -1 || + dev->d_partition == 255) + goto out; /* Nothing more to do */ + + /* Try to read BSD label */ + table = ptable_open(dev, part.end - part.start + 1, + od->sectorsize, ptblread); + if (table == NULL) { + DEBUG("Can't read BSD label"); + rc = ENXIO; goto out; } - dev->d_slice = gp->gp_index; + rc = ptable_getpart(table, &part, dev->d_partition); + if (rc != 0) + goto out; + dev->d_offset += part.start; + } else if (dev->d_slice == 0) { + rc = ptable_getbestpart(od->table, &part); + if (rc != 0) + goto out; + /* Save the slice number of best partition to dev */ + dev->d_slice = part.index; + dev->d_offset = part.start; } - - dev->d_offset = gp->gp_start; - rc = 0; - out: - if (gpt) - free(gpt); + if (table != NULL) + ptable_close(table); + if (rc != 0) { + if (od->table != NULL) + ptable_close(od->table); + free(od); + } return (rc); } -static void -disk_printgptpart(struct disk_devdesc *dev, struct gpt_part *gp, - char *prefix, int verbose) +int +disk_close(struct disk_devdesc *dev) { - char stats[80]; - char line[96]; - - if (verbose) - sprintf(stats, " %s", - display_size(gp->gp_end + 1 - gp->gp_start)); - else - stats[0] = '\0'; - - if (uuid_equal(&gp->gp_type, &efi, NULL)) - sprintf(line, "%s: EFI %s\n", prefix, stats); - else if (uuid_equal(&gp->gp_type, &ms_basic_data, NULL)) - sprintf(line, "%s: FAT/NTFS %s\n", prefix, stats); - else if (uuid_equal(&gp->gp_type, &freebsd_boot, NULL)) - sprintf(line, "%s: FreeBSD boot%s\n", prefix, stats); - else if (uuid_equal(&gp->gp_type, &freebsd_ufs, NULL)) - sprintf(line, "%s: FreeBSD UFS %s\n", prefix, stats); - else if (uuid_equal(&gp->gp_type, &freebsd_zfs, NULL)) - sprintf(line, "%s: FreeBSD ZFS %s\n", prefix, stats); - else if (uuid_equal(&gp->gp_type, &freebsd_swap, NULL)) - sprintf(line, "%s: FreeBSD swap%s\n", prefix, stats); - else - sprintf(line, - "%s: %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x%s\n", - prefix, - gp->gp_type.time_low, gp->gp_type.time_mid, - gp->gp_type.time_hi_and_version, - gp->gp_type.clock_seq_hi_and_reserved, - gp->gp_type.clock_seq_low, - gp->gp_type.node[0], - gp->gp_type.node[1], - gp->gp_type.node[2], - gp->gp_type.node[3], - gp->gp_type.node[4], - gp->gp_type.node[5], - stats); - pager_output(line); -} + struct open_disk *od; -static int -disk_printgpt(struct disk_devdesc *dev, char *prefix, int verbose) -{ - struct gpt_part *gpt = NULL; - int rc, ngpt, i; - char line[80]; - - rc = disk_readgpt(dev, &gpt, &ngpt); - if (rc) - return (rc); - for (i = 0; i < ngpt; i++) { - sprintf(line, "%sp%d", prefix, i + 1); - disk_printgptpart(dev, &gpt[i], line, verbose); - } - free(gpt); + od = (struct open_disk *)dev->d_opendata; + ptable_close(od->table); + free(od); return (0); } -#endif - -int -disk_open(struct disk_devdesc *dev) +char* +disk_fmtdev(struct disk_devdesc *dev) { - int rc; - - rc = 0; - /* - * While we are reading disk metadata, make sure we do it relative - * to the start of the disk - */ - dev->d_offset = 0; + static char buf[128]; + char *cp; + cp = buf + sprintf(buf, "%s%d", dev->d_dev->dv_name, dev->d_unit); + if (dev->d_slice > 0) { #ifdef LOADER_GPT_SUPPORT - rc = disk_opengpt(dev); - if (rc == 0) - return (0); + if (dev->d_partition == 255) { + sprintf(cp, "p%d:", dev->d_slice); + return (buf); + } else #endif #ifdef LOADER_MBR_SUPPORT - rc = disk_openmbr(dev); + cp += sprintf(cp, "s%d", dev->d_slice); #endif - - return (rc); + if (dev->d_partition >= 0) + cp += sprintf(cp, "%c", dev->d_partition + 'a'); + } + strcat(cp, ":"); + return (buf); } -void -disk_print(struct disk_devdesc *dev, char *prefix, int verbose) +int +disk_parsedev(struct disk_devdesc *dev, const char *devspec, const char **path) { - + int unit, slice, partition; + const char *np; + char *cp; + + np = devspec; + unit = slice = partition = -1; + if (*np != '\0' && *np != ':') { + unit = strtol(np, &cp, 10); + if (cp == np) + return (EUNIT); #ifdef LOADER_GPT_SUPPORT - if (disk_printgpt(dev, prefix, verbose) == 0) - return; + if (*cp == 'p') { + np = cp + 1; + slice = strtol(np, &cp, 10); + if (np == cp) + return (ESLICE); + /* we don't support nested partitions on GPT */ + if (*cp != '\0' && *cp != ':') + return (EINVAL); + partition = 255; + } else #endif #ifdef LOADER_MBR_SUPPORT - disk_printmbr(dev, prefix, verbose); + if (*cp == 's') { + np = cp + 1; + slice = strtol(np, &cp, 10); + if (np == cp) + return (ESLICE); + } #endif + if (*cp != '\0' && *cp != ':') { + partition = *cp - 'a'; + if (partition < 0) + return (EPART); + cp++; + } + } else + return (EINVAL); + + if (*cp != '\0' && *cp != ':') + return (EINVAL); + dev->d_unit = unit; + dev->d_slice = slice; + dev->d_partition = partition; + if (path != NULL) + *path = (*cp == '\0') ? cp: cp + 1; + return (0); } Modified: head/sys/boot/common/disk.h ============================================================================== --- head/sys/boot/common/disk.h Sun Aug 5 11:59:46 2012 (r239057) +++ head/sys/boot/common/disk.h Sun Aug 5 12:15:15 2012 (r239058) @@ -27,8 +27,7 @@ */ /* - * Device descriptor for partitioned disks. We assume that all disk addresses *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 12:16:12 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 19B3D106564A; Sun, 5 Aug 2012 12:16:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E04378FC16; Sun, 5 Aug 2012 12:16:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q75CGB37081912; Sun, 5 Aug 2012 12:16:11 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75CGBIW081910; Sun, 5 Aug 2012 12:16:11 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201208051216.q75CGBIW081910@svn.freebsd.org> From: Dimitry Andric Date: Sun, 5 Aug 2012 12:16:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239059 - head/sbin/camcontrol X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 12:16:12 -0000 Author: dim Date: Sun Aug 5 12:16:11 2012 New Revision: 239059 URL: http://svn.freebsd.org/changeset/base/239059 Log: In sbin/camcontrol/camcontrol.c, function smpcmd(), initialize the 'error' variable to zero, to avoid returning garbage in several cases. This fixes the following clang 3.2 warnings: sbin/camcontrol/camcontrol.c:4634:8: warning: variable 'error' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (amt_written == -1) { ^~~~~~~~~~~~~~~~~ sbin/camcontrol/camcontrol.c:4656:10: note: uninitialized use occurs here return (error); ^~~~~ sbin/camcontrol/camcontrol.c:4619:7: warning: variable 'error' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (fd_response == 0) { ^~~~~~~~~~~~~~~~ sbin/camcontrol/camcontrol.c:4656:10: note: uninitialized use occurs here return (error); ^~~~~ sbin/camcontrol/camcontrol.c:4617:6: warning: variable 'error' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sbin/camcontrol/camcontrol.c:4656:10: note: uninitialized use occurs here return (error); ^~~~~ MFC after: 1 week Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Sun Aug 5 12:15:15 2012 (r239058) +++ head/sbin/camcontrol/camcontrol.c Sun Aug 5 12:16:11 2012 (r239059) @@ -4464,7 +4464,7 @@ static int smpcmd(struct cam_device *device, int argc, char **argv, char *combinedopt, int retry_count, int timeout) { - int c, error; + int c, error = 0; union ccb *ccb; uint8_t *smp_request = NULL, *smp_response = NULL; int request_size = 0, response_size = 0; From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 12:57:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12F71106564A; Sun, 5 Aug 2012 12:57:39 +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 D82FB8FC12; Sun, 5 Aug 2012 12:57: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 q75CvcVY085423; Sun, 5 Aug 2012 12:57:38 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75CvcqA085421; Sun, 5 Aug 2012 12:57:38 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201208051257.q75CvcqA085421@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sun, 5 Aug 2012 12:57:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239060 - head/sys/boot/i386/pmbr X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 12:57:39 -0000 Author: ae Date: Sun Aug 5 12:57:38 2012 New Revision: 239060 URL: http://svn.freebsd.org/changeset/base/239060 Log: When GPT signature is invalid in the primary GPT header, then try to read backup GPT header. Submitted by: hrs (previous version) Modified: head/sys/boot/i386/pmbr/pmbr.s Modified: head/sys/boot/i386/pmbr/pmbr.s ============================================================================== --- head/sys/boot/i386/pmbr/pmbr.s Sun Aug 5 12:16:11 2012 (r239059) +++ head/sys/boot/i386/pmbr/pmbr.s Sun Aug 5 12:57:38 2012 (r239060) @@ -42,8 +42,8 @@ .set STACK,EXEC+SECSIZE*4 # Stack address .set GPT_ADDR,STACK # GPT header address .set GPT_SIG,0 - .set GPT_SIG_0,0x20494645 - .set GPT_SIG_1,0x54524150 + .set GPT_SIG_0,0x20494645 # "EFI " + .set GPT_SIG_1,0x54524150 # "PART" .set GPT_MYLBA,24 .set GPT_PART_LBA,72 .set GPT_NPART,80 @@ -52,6 +52,8 @@ .set PART_TYPE,0 .set PART_START_LBA,32 .set PART_END_LBA,40 + .set DPBUF,PART_ADDR+SECSIZE + .set DPBUF_SEC,0x10 # Number of sectors .set NHRDRV,0x475 # Number of hard drives @@ -91,15 +93,32 @@ main: cmpb $0x80,%dl # Drive valid? jb main.2 # Yes main.1: movb $0x80,%dl # Assume drive 0x80 # -# Load the primary GPT header from LBA 1 and verify signature. +# Load the GPT header and verify signature. Try LBA 1 for the primary one and +# the last LBA for the backup if it is broken. # -main.2: movw $GPT_ADDR,%bx +main.2: call getdrvparams # Read drive parameters + movb $1,%dh # %dh := 1 (reading primary) +main.2a: movw $GPT_ADDR,%bx movw $lba,%si - call read + call read # Read header and check GPT sig cmpl $GPT_SIG_0,GPT_ADDR+GPT_SIG - jnz err_pt + jnz main.2b cmpl $GPT_SIG_1,GPT_ADDR+GPT_SIG+4 - jnz err_pt + jnz main.2b + jmp load_part +main.2b: cmpb $1,%dh # Reading primary? + jne err_pt # If no - invalid table found +# +# Try alternative LBAs from the last sector for the GPT header. +# +main.3: movb $0,%dh # %dh := 0 (reading backup) + movw $DPBUF+DPBUF_SEC,%si # %si = last sector + 1 + movw $lba,%di # %di = $lba +main.3a: decl (%si) # 0x0(%si) = last sec (0-31) + movw $2,%cx + rep + movsw # $lastsec--, copy it to $lba + jmp main.2a # Read the next sector # # Load a partition table sector from disk and look for a FreeBSD boot # partition. @@ -172,6 +191,16 @@ read: pushl 0x4(%si) # Set the LBA jc err_rd # If error ret # +# Check the number of LBAs on the drive index %dx. Trashes %ax and %si. +# +getdrvparams: + movw $DPBUF,%si # Set the address of result buf + movw $0x001e,(%si) # len + movw $0x4800,%ax # BIOS: Read Drive Parameters + int $0x13 # Call the BIOS + jc err_rd # "I/O error" if error + ret +# # Various error message entry points. # err_big: movw $msg_big,%si # "Boot loader too From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 13:06:20 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D2901065675 for ; Sun, 5 Aug 2012 13:06:20 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 382D88FC18 for ; Sun, 5 Aug 2012 13:06:18 +0000 (UTC) Received: by wgbds11 with SMTP id ds11so1819439wgb.31 for ; Sun, 05 Aug 2012 06:06:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer :x-gm-message-state; bh=/81/AQGcMnqtv54KqlEgIrv597sHQvUIUvOOIoPQb+I=; b=lKdXVhy5Q2BbN2yGQN+ZrhzctnJVK0Y34Zj/XGAKOJfMUMFQaE0wNWaMXCFV6bayBQ j7P58qJSC33j38hnI0B53IcOd6vHL2DGIaqe6eXNeJ2DVXCmlxTx+44m+Vu+jU91EtvH i2iGhuX1i+P4s/343d8oNjyTtHy4DyV4/QbHEwd11+KSvoWHeaQyXzrzP2/cH4d5nuNa EtrLaB7Z2bUMj0KozyNhrs0XM3Ew4v0n+m/fPc747EHhil6MRS7D/zQgaJp+doNQdoPI k3zydchby7Q8jjMOUs9QF9q92kDN/ZJiWfhFRreEGfhJaamNByPUkCFtwd8TNZnP/LIx 2rxQ== Received: by 10.180.91.228 with SMTP id ch4mr10828700wib.7.1344171977936; Sun, 05 Aug 2012 06:06:17 -0700 (PDT) Received: from macpro.dyn.rabson.org (gate.rabson.org. [81.2.119.145]) by mx.google.com with ESMTPS id l5sm14052349wix.5.2012.08.05.06.06.15 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 05 Aug 2012 06:06:16 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=us-ascii From: Doug Rabson In-Reply-To: <201208051215.q75CFFPO081805@svn.freebsd.org> Date: Sun, 5 Aug 2012 14:06:06 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <050317CF-D855-4DA4-B15E-E032905260D5@rabson.org> References: <201208051215.q75CFFPO081805@svn.freebsd.org> To: "Andrey V. Elsukov" X-Mailer: Apple Mail (2.1278) X-Gm-Message-State: ALoCoQm5rFcmdf+3s0UvDuC++Q470wkvYvJEJG8n2cHfeHx2R5SDgFsjyVKQOUId4JXSh1/pjsrJ Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r239058 - in head/sys/boot: common userboot userboot/test userboot/userboot X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 13:06:20 -0000 If you change the loader callbacks structure, you need to change the = version number to avoid unexpected results for mismatched combinations = of application and userboot.so. On 5 Aug 2012, at 13:15, Andrey V. Elsukov wrote: > Author: ae > Date: Sun Aug 5 12:15:15 2012 > New Revision: 239058 > URL: http://svn.freebsd.org/changeset/base/239058 >=20 > Log: > Introduce new API to work with disks from the loader's drivers. > It uses new API from the part.c to work with partition tables. >=20 > Update userboot's disk driver to use new API. Note that struct > loader_callbacks_v1 has changed. >=20 > Modified: > head/sys/boot/common/Makefile.inc > head/sys/boot/common/disk.c > head/sys/boot/common/disk.h > head/sys/boot/userboot/test/test.c > head/sys/boot/userboot/userboot.h > head/sys/boot/userboot/userboot/Makefile > head/sys/boot/userboot/userboot/devicename.c > head/sys/boot/userboot/userboot/userboot_disk.c >=20 > Modified: head/sys/boot/common/Makefile.inc > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/common/Makefile.inc Sun Aug 5 11:59:46 2012 = (r239057) > +++ head/sys/boot/common/Makefile.inc Sun Aug 5 12:15:15 2012 = (r239058) > @@ -1,6 +1,6 @@ > # $FreeBSD$ >=20 > -SRCS+=3D boot.c commands.c console.c devopen.c disk.c interp.c=20 > +SRCS+=3D boot.c commands.c console.c devopen.c interp.c=20 > SRCS+=3D interp_backslash.c interp_parse.c ls.c misc.c=20 > SRCS+=3D module.c panic.c >=20 > @@ -24,6 +24,18 @@ SRCS+=3D load_elf64.c reloc_elf64.c > SRCS+=3D dev_net.c > .endif >=20 > +.if !defined(LOADER_NO_DISK_SUPPORT) > +SRCS+=3D disk.c part.c > +CFLAGS+=3D -DLOADER_DISK_SUPPORT > +.if !defined(LOADER_NO_GPT_SUPPORT) > +SRCS+=3D crc32.c > +CFLAGS+=3D -DLOADER_GPT_SUPPORT > +.endif > +.if !defined(LOADER_NO_MBR_SUPPORT) > +CFLAGS+=3D -DLOADER_MBR_SUPPORT > +.endif > +.endif > + > .if defined(HAVE_BCACHE) > SRCS+=3D bcache.c > .endif >=20 > Modified: head/sys/boot/common/disk.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/common/disk.c Sun Aug 5 11:59:46 2012 = (r239057) > +++ head/sys/boot/common/disk.c Sun Aug 5 12:15:15 2012 = (r239058) > @@ -1,5 +1,6 @@ > /*- > * Copyright (c) 1998 Michael Smith > + * Copyright (c) 2012 Andrey V. Elsukov > * All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > @@ -27,26 +28,11 @@ > #include > __FBSDID("$FreeBSD$"); >=20 > -/* > - * MBR/GPT partitioned disk device handling. > - * > - * Ideas and algorithms from: > - * > - * - NetBSD libi386/biosdisk.c > - * - FreeBSD biosboot/disk.c > - * > - */ > - > +#include > #include > - > -#include > -#include > -#include > - > #include > -#include > - > #include > +#include >=20 > #include "disk.h" >=20 > @@ -56,53 +42,26 @@ __FBSDID("$FreeBSD$"); > # define DEBUG(fmt, args...) > #endif >=20 > -/* > - * Search for a slice with the following preferences: > - * > - * 1: Active FreeBSD slice > - * 2: Non-active FreeBSD slice > - * 3: Active Linux slice > - * 4: non-active Linux slice > - * 5: Active FAT/FAT32 slice > - * 6: non-active FAT/FAT32 slice > - */ > -#define PREF_RAWDISK 0 > -#define PREF_FBSD_ACT 1 > -#define PREF_FBSD 2 > -#define PREF_LINUX_ACT 3 > -#define PREF_LINUX 4 > -#define PREF_DOS_ACT 5 > -#define PREF_DOS 6 > -#define PREF_NONE 7 > - > -#ifdef LOADER_GPT_SUPPORT > - > -struct gpt_part { > - int gp_index; > - uuid_t gp_type; > - uint64_t gp_start; > - uint64_t gp_end; > +struct open_disk { > + struct ptable *table; > + off_t mediasize; > + u_int sectorsize; > }; >=20 > -static uuid_t efi =3D GPT_ENT_TYPE_EFI; > -static uuid_t freebsd_boot =3D GPT_ENT_TYPE_FREEBSD_BOOT; > -static uuid_t freebsd_ufs =3D GPT_ENT_TYPE_FREEBSD_UFS; > -static uuid_t freebsd_swap =3D GPT_ENT_TYPE_FREEBSD_SWAP; > -static uuid_t freebsd_zfs =3D GPT_ENT_TYPE_FREEBSD_ZFS; > -static uuid_t ms_basic_data =3D GPT_ENT_TYPE_MS_BASIC_DATA; > - > -#endif > - > -#if defined(LOADER_GPT_SUPPORT) || defined(LOADER_MBR_SUPPORT) > +struct print_args { > + struct disk_devdesc *dev; > + const char *prefix; > + int verbose; > +}; >=20 > -/* Given a size in 512 byte sectors, convert it to a human-readable = number. */ > +/* Convert size to a human-readable number. */ > static char * > -display_size(uint64_t size) > +display_size(uint64_t size, u_int sectorsize) > { > static char buf[80]; > char unit; >=20 > - size /=3D 2; > + size =3D size * sectorsize / 1024; > unit =3D 'K'; > if (size >=3D 10485760000LL) { > size /=3D 1073741824; > @@ -114,687 +73,230 @@ display_size(uint64_t size) > size /=3D 1024; > unit =3D 'M'; > } > - sprintf(buf, "%.6ld%cB", (long)size, unit); > + sprintf(buf, "%ld%cB", (long)size, unit); > return (buf); > } >=20 > -#endif > - > -#ifdef LOADER_MBR_SUPPORT > - > -static void > -disk_checkextended(struct disk_devdesc *dev, > - struct dos_partition *slicetab, int slicenum, int *nslicesp) > -{ > - uint8_t buf[DISK_SECSIZE]; > - struct dos_partition *dp; > - uint32_t base; > - int rc, i, start, end; > - > - dp =3D &slicetab[slicenum]; > - start =3D *nslicesp; > - > - if (dp->dp_size =3D=3D 0) > - goto done; > - if (dp->dp_typ !=3D DOSPTYP_EXT) > - goto done; > - rc =3D dev->d_dev->dv_strategy(dev, F_READ, dp->dp_start, = DISK_SECSIZE, > - (char *) buf, NULL); > - if (rc) > - goto done; > - if (buf[0x1fe] !=3D 0x55 || buf[0x1ff] !=3D 0xaa) { > - DEBUG("no magic in extended table"); > - goto done; > - } > - base =3D dp->dp_start; > - dp =3D (struct dos_partition *) &buf[DOSPARTOFF]; > - for (i =3D 0; i < NDOSPART; i++, dp++) { > - if (dp->dp_size =3D=3D 0) > - continue; > - if (*nslicesp =3D=3D NEXTDOSPART) > - goto done; > - dp->dp_start +=3D base; > - bcopy(dp, &slicetab[*nslicesp], sizeof(*dp)); > - (*nslicesp)++; > - } > - end =3D *nslicesp; > - > - /* > - * now, recursively check the slices we just added > - */ > - for (i =3D start; i < end; i++) > - disk_checkextended(dev, slicetab, i, nslicesp); > -done: > - return; > -} > - > -static int > -disk_readslicetab(struct disk_devdesc *dev, > - struct dos_partition **slicetabp, int *nslicesp) > -{ > - struct dos_partition *slicetab =3D NULL; > - int nslices, i; > - int rc; > - uint8_t buf[DISK_SECSIZE]; > - > - /* > - * Find the slice in the DOS slice table. > - */ > - rc =3D dev->d_dev->dv_strategy(dev, F_READ, 0, DISK_SECSIZE, > - (char *) buf, NULL); > - if (rc) { > - DEBUG("error reading MBR"); > - return (rc); > - } > - > - /* > - * Check the slice table magic. > - */ > - if (buf[0x1fe] !=3D 0x55 || buf[0x1ff] !=3D 0xaa) { > - DEBUG("no slice table/MBR (no magic)"); > - return (rc); > - } > - > - /* > - * copy the partition table, then pick up any extended = partitions. > - */ > - slicetab =3D malloc(NEXTDOSPART * sizeof(struct dos_partition)); > - bcopy(buf + DOSPARTOFF, slicetab, > - sizeof(struct dos_partition) * NDOSPART); > - nslices =3D NDOSPART; /* extended slices start here */ > - for (i =3D 0; i < NDOSPART; i++) > - disk_checkextended(dev, slicetab, i, &nslices); > - > - *slicetabp =3D slicetab; > - *nslicesp =3D nslices; > - return (0); > -} > - > -/* > - * Search for the best MBR slice (typically the first FreeBSD slice). > - */ > -static int > -disk_bestslice(struct dos_partition *slicetab, int nslices) > -{ > - struct dos_partition *dp; > - int pref, preflevel; > - int i, prefslice; > - > - prefslice =3D 0; > - preflevel =3D PREF_NONE; > - > - dp =3D &slicetab[0]; > - for (i =3D 0; i < nslices; i++, dp++) { > - switch (dp->dp_typ) { > - case DOSPTYP_386BSD: /* FreeBSD */ > - pref =3D dp->dp_flag & 0x80 ? PREF_FBSD_ACT : = PREF_FBSD; > - break; > - > - case DOSPTYP_LINUX: > - pref =3D dp->dp_flag & 0x80 ? PREF_LINUX_ACT : = PREF_LINUX; > - break; > - > - case 0x01: /* DOS/Windows */ > - case 0x04: > - case 0x06: > - case 0x0b: > - case 0x0c: > - case 0x0e: > - pref =3D dp->dp_flag & 0x80 ? PREF_DOS_ACT : = PREF_DOS; > - break; > - > - default: > - pref =3D PREF_NONE; > - } > - if (pref < preflevel) { > - preflevel =3D pref; > - prefslice =3D i + 1; > - } > - } > - return (prefslice); > -} > - > static int > -disk_openmbr(struct disk_devdesc *dev) > -{ > - struct dos_partition *slicetab =3D NULL, *dptr; > - int nslices, sector, slice; > - int rc; > - uint8_t buf[DISK_SECSIZE]; > - struct disklabel *lp; > - > - /* > - * Following calculations attempt to determine the correct value > - * for dev->d_offset by looking for the slice and partition = specified, > - * or searching for reasonable defaults. > - */ > - rc =3D disk_readslicetab(dev, &slicetab, &nslices); > - if (rc) > - return (rc); > - > - /* > - * if a slice number was supplied but not found, this is an = error. > - */ > - if (dev->d_slice > 0) { > - slice =3D dev->d_slice - 1; > - if (slice >=3D nslices) { > - DEBUG("slice %d not found", slice); > - rc =3D EPART; > - goto out; > - } > - } > - > - /* > - * Check for the historically bogus MBR found on true dedicated = disks > - */ > - if (slicetab[3].dp_typ =3D=3D DOSPTYP_386BSD && > - slicetab[3].dp_start =3D=3D 0 && slicetab[3].dp_size =3D=3D = 50000) { > - sector =3D 0; > - goto unsliced; > - } > - > - /* > - * Try to auto-detect the best slice; this should always give > - * a slice number > - */ > - if (dev->d_slice =3D=3D 0) { > - slice =3D disk_bestslice(slicetab, nslices); > - if (slice =3D=3D -1) { > - rc =3D ENOENT; > - goto out; > - } > - dev->d_slice =3D slice; > - } > - > - /* > - * Accept the supplied slice number unequivocally (we may be = looking > - * at a DOS partition). > - * Note: we number 1-4, offsets are 0-3 > - */ > - dptr =3D &slicetab[dev->d_slice - 1]; > - sector =3D dptr->dp_start; > - DEBUG("slice entry %d at %d, %d sectors", > - dev->d_slice - 1, sector, dptr->dp_size); > - > -unsliced: > - /* > - * Now we have the slice offset, look for the partition in the > - * disklabel if we have a partition to start with. > - * > - * XXX we might want to check the label checksum. > - */ > - if (dev->d_partition < 0) { > - /* no partition, must be after the slice */ > - DEBUG("opening raw slice"); > - dev->d_offset =3D sector; > - rc =3D 0; > - goto out; > - } > - > - rc =3D dev->d_dev->dv_strategy(dev, F_READ, sector + = LABELSECTOR, > - DISK_SECSIZE, (char *) buf, NULL); > - if (rc) { > - DEBUG("error reading disklabel"); > - goto out; > - } > - > - lp =3D (struct disklabel *) buf; > - > - if (lp->d_magic !=3D DISKMAGIC) { > - DEBUG("no disklabel"); > - rc =3D ENOENT; > - goto out; > - } > - if (dev->d_partition >=3D lp->d_npartitions) { > - DEBUG("partition '%c' exceeds partitions in table = (a-'%c')", > - 'a' + dev->d_partition, > - 'a' + lp->d_npartitions); > - rc =3D EPART; > - goto out; > - } > - > - dev->d_offset =3D > - lp->d_partitions[dev->d_partition].p_offset - > - lp->d_partitions[RAW_PART].p_offset + > - sector; > - rc =3D 0; > - > -out: > - if (slicetab) > - free(slicetab); > - return (rc); > -} > - > -/* > - * Print out each valid partition in the disklabel of a FreeBSD = slice. > - * For size calculations, we assume a 512 byte sector size. > - */ > -static void > -disk_printbsdslice(struct disk_devdesc *dev, daddr_t offset, > - char *prefix, int verbose) > +ptblread(void *d, void *buf, size_t blocks, off_t offset) > { > - char line[80]; > - char buf[DISK_SECSIZE]; > - struct disklabel *lp; > - int i, rc, fstype; > - > - /* read disklabel */ > - rc =3D dev->d_dev->dv_strategy(dev, F_READ, offset + = LABELSECTOR, > - DISK_SECSIZE, (char *) buf, NULL); > - if (rc) > - return; > - lp =3D(struct disklabel *)(&buf[0]); > - if (lp->d_magic !=3D DISKMAGIC) { > - sprintf(line, "%s: FFS bad disklabel\n", prefix); > - pager_output(line); > - return; > - } > + struct disk_devdesc *dev; > + struct open_disk *od; >=20 > - /* Print partitions */ > - for (i =3D 0; i < lp->d_npartitions; i++) { > - /* > - * For each partition, make sure we know what type of fs = it > - * is. If not, then skip it. > - */ > - fstype =3D lp->d_partitions[i].p_fstype; > - if (fstype !=3D FS_BSDFFS && > - fstype !=3D FS_SWAP && > - fstype !=3D FS_VINUM) > - continue; > - > - /* Only print out statistics in verbose mode */ > - if (verbose) > - sprintf(line, " %s%c: %s %s (%d - %d)\n", > - prefix, 'a' + i, > - (fstype =3D=3D FS_SWAP) ? "swap " : > - (fstype =3D=3D FS_VINUM) ? "vinum" : > - "FFS ", > - display_size(lp->d_partitions[i].p_size), > - lp->d_partitions[i].p_offset, > - (lp->d_partitions[i].p_offset > - + lp->d_partitions[i].p_size)); > - else > - sprintf(line, " %s%c: %s\n", prefix, 'a' + i, > - (fstype =3D=3D FS_SWAP) ? "swap" : > - (fstype =3D=3D FS_VINUM) ? "vinum" : > - "FFS"); > - pager_output(line); > - } > + dev =3D (struct disk_devdesc *)d; > + od =3D (struct open_disk *)dev->d_opendata; > + return (dev->d_dev->dv_strategy(dev, F_READ, offset, > + blocks * od->sectorsize, (char *)buf, NULL)); > } >=20 > +#define PWIDTH 35 > static void > -disk_printslice(struct disk_devdesc *dev, int slice, > - struct dos_partition *dp, char *prefix, int verbose) > +ptable_print(void *arg, const char *pname, const struct ptable_entry = *part) > { > - char stats[80]; > + struct print_args *pa, bsd; > + struct open_disk *od; > + struct ptable *table; > char line[80]; >=20 > - if (verbose) > - sprintf(stats, " %s (%d - %d)", = display_size(dp->dp_size), > - dp->dp_start, dp->dp_start + dp->dp_size); > - else > - stats[0] =3D '\0'; > - > - switch (dp->dp_typ) { > - case DOSPTYP_386BSD: > - disk_printbsdslice(dev, (daddr_t)dp->dp_start, > - prefix, verbose); > - return; > - case DOSPTYP_LINSWP: > - sprintf(line, "%s: Linux swap%s\n", prefix, stats); > - break; > - case DOSPTYP_LINUX: > - /* > - * XXX > - * read the superblock to confirm this is an ext2fs = partition? > - */ > - sprintf(line, "%s: ext2fs%s\n", prefix, stats); > - break; > - case 0x00: /* unused partition */ > - case DOSPTYP_EXT: > - return; > - case 0x01: > - sprintf(line, "%s: FAT-12%s\n", prefix, stats); > - break; > - case 0x04: > - case 0x06: > - case 0x0e: > - sprintf(line, "%s: FAT-16%s\n", prefix, stats); > - break; > - case 0x07: > - sprintf(line, "%s: NTFS/HPFS%s\n", prefix, stats); > - break; > - case 0x0b: > - case 0x0c: > - sprintf(line, "%s: FAT-32%s\n", prefix, stats); > - break; > - default: > - sprintf(line, "%s: Unknown fs: 0x%x %s\n", prefix, = dp->dp_typ, > - stats); > - } > + pa =3D (struct print_args *)arg; > + od =3D (struct open_disk *)pa->dev->d_opendata; > + sprintf(line, " %s%s: %s", pa->prefix, pname, > + parttype2str(part->type)); > + if (pa->verbose) > + sprintf(line, "%-*s%s", PWIDTH, line, > + display_size(part->end - part->start + 1, > + od->sectorsize)); > + strcat(line, "\n"); > pager_output(line); > -} > - > -static int > -disk_printmbr(struct disk_devdesc *dev, char *prefix, int verbose) > -{ > - struct dos_partition *slicetab; > - int nslices, i; > - int rc; > - char line[80]; > - > - rc =3D disk_readslicetab(dev, &slicetab, &nslices); > - if (rc) > - return (rc); > - for (i =3D 0; i < nslices; i++) { > - sprintf(line, "%ss%d", prefix, i + 1); > - disk_printslice(dev, i, &slicetab[i], line, verbose); > - } > - free(slicetab); > - return (0); > -} > - > -#endif > - > -#ifdef LOADER_GPT_SUPPORT > - > -static int > -disk_readgpt(struct disk_devdesc *dev, struct gpt_part **gptp, int = *ngptp) > -{ > - struct dos_partition *dp; > - struct gpt_hdr *hdr; > - struct gpt_ent *ent; > - struct gpt_part *gptab =3D NULL; > - int entries_per_sec, rc, i, part; > - daddr_t lba, elba; > - uint8_t gpt[DISK_SECSIZE], tbl[DISK_SECSIZE]; > - > - /* > - * Following calculations attempt to determine the correct value > - * for dev->d_offset by looking for the slice and partition = specified, > - * or searching for reasonable defaults. > - */ > - rc =3D 0; > - > - /* First, read the MBR and see if we have a PMBR. */ > - rc =3D dev->d_dev->dv_strategy(dev, F_READ, 0, DISK_SECSIZE, > - (char *) tbl, NULL); > - if (rc) { > - DEBUG("error reading MBR"); > - return (EIO); > + if (part->type =3D=3D PART_FREEBSD) { > + /* Open slice with BSD label */ > + pa->dev->d_offset =3D part->start; > + table =3D ptable_open(pa->dev, part->end - part->start + = 1, > + od->sectorsize, ptblread); > + if (table =3D=3D NULL) > + return; > + sprintf(line, " %s%s", pa->prefix, pname); > + bsd.dev =3D pa->dev; > + bsd.prefix =3D line; > + bsd.verbose =3D pa->verbose; > + ptable_iterate(table, &bsd, ptable_print); > + ptable_close(table); > } > - > - /* Check the slice table magic. */ > - if (tbl[0x1fe] !=3D 0x55 || tbl[0x1ff] !=3D 0xaa) > - return (ENXIO); > - > - /* Check for GPT slice. */ > - part =3D 0; > - dp =3D (struct dos_partition *)(tbl + DOSPARTOFF); > - for (i =3D 0; i < NDOSPART; i++) { > - if (dp[i].dp_typ =3D=3D 0xee) > - part++; > - else if ((part !=3D 1) && (dp[i].dp_typ !=3D 0x00)) > - return (EINVAL); > - } > - if (part !=3D 1) > - return (EINVAL); > - > - /* Read primary GPT table header. */ > - rc =3D dev->d_dev->dv_strategy(dev, F_READ, 1, DISK_SECSIZE, > - (char *) gpt, NULL); > - if (rc) { > - DEBUG("error reading GPT header"); > - return (EIO); > - } > - hdr =3D (struct gpt_hdr *)gpt; > - if (bcmp(hdr->hdr_sig, GPT_HDR_SIG, sizeof(hdr->hdr_sig)) !=3D 0 = || > - hdr->hdr_lba_self !=3D 1 || hdr->hdr_revision < 0x00010000 = || > - hdr->hdr_entsz < sizeof(*ent) || > - DISK_SECSIZE % hdr->hdr_entsz !=3D 0) { > - DEBUG("Invalid GPT header\n"); > - return (EINVAL); > - } > - > - /* Walk the partition table to count valid partitions. */ > - part =3D 0; > - entries_per_sec =3D DISK_SECSIZE / hdr->hdr_entsz; > - elba =3D hdr->hdr_lba_table + hdr->hdr_entries / = entries_per_sec; > - for (lba =3D hdr->hdr_lba_table; lba < elba; lba++) { > - rc =3D dev->d_dev->dv_strategy(dev, F_READ, lba, = DISK_SECSIZE, > - (char *) tbl, NULL); > - if (rc) { > - DEBUG("error reading GPT table"); > - return (EIO); > - } > - for (i =3D 0; i < entries_per_sec; i++) { > - ent =3D (struct gpt_ent *)(tbl + i * = hdr->hdr_entsz); > - if (uuid_is_nil(&ent->ent_type, NULL) || > - ent->ent_lba_start =3D=3D 0 || > - ent->ent_lba_end < ent->ent_lba_start) > - continue; > - part++; > - } > - } > - > - /* Save the important information about all the valid = partitions. */ > - if (part !=3D 0) { > - gptab =3D malloc(part * sizeof(struct gpt_part)); > - part =3D 0; > - for (lba =3D hdr->hdr_lba_table; lba < elba; lba++) { > - rc =3D dev->d_dev->dv_strategy(dev, F_READ, lba, = DISK_SECSIZE, > - (char *) tbl, NULL); > - if (rc) { > - DEBUG("error reading GPT table"); > - free(gptab); > - return (EIO); > - } > - for (i =3D 0; i < entries_per_sec; i++) { > - ent =3D (struct gpt_ent *)(tbl + i * = hdr->hdr_entsz); > - if (uuid_is_nil(&ent->ent_type, NULL) || > - ent->ent_lba_start =3D=3D 0 || > - ent->ent_lba_end < = ent->ent_lba_start) > - continue; > - gptab[part].gp_index =3D (lba - = hdr->hdr_lba_table) * > - entries_per_sec + i + 1; > - gptab[part].gp_type =3D ent->ent_type; > - gptab[part].gp_start =3D = ent->ent_lba_start; > - gptab[part].gp_end =3D ent->ent_lba_end; > - part++; > - } > - } > - } > - > - *gptp =3D gptab; > - *ngptp =3D part; > - return (0); > } > +#undef PWIDTH >=20 > -static struct gpt_part * > -disk_bestgpt(struct gpt_part *gpt, int ngpt) > +void > +disk_print(struct disk_devdesc *dev, char *prefix, int verbose) > { > - struct gpt_part *gp, *prefpart; > - int i, pref, preflevel; > - > - prefpart =3D NULL; > - preflevel =3D PREF_NONE; > + struct open_disk *od; > + struct print_args pa; >=20 > - gp =3D gpt; > - for (i =3D 0; i < ngpt; i++, gp++) { > - /* Windows. XXX: Also Linux. */ > - if (uuid_equal(&gp->gp_type, &ms_basic_data, NULL)) > - pref =3D PREF_DOS; > - /* FreeBSD */ > - else if (uuid_equal(&gp->gp_type, &freebsd_ufs, NULL) || > - uuid_equal(&gp->gp_type, &freebsd_zfs, NULL)) > - pref =3D PREF_FBSD; > - else > - pref =3D PREF_NONE; > - if (pref < preflevel) { > - preflevel =3D pref; > - prefpart =3D gp; > - } > - } > - return (prefpart); > + /* Disk should be opened */ > + od =3D (struct open_disk *)dev->d_opendata; > + pa.dev =3D dev; > + pa.prefix =3D prefix; > + pa.verbose =3D verbose; > + ptable_iterate(od->table, &pa, ptable_print); > } >=20 > -static int > -disk_opengpt(struct disk_devdesc *dev) > +int > +disk_open(struct disk_devdesc *dev, off_t mediasize, u_int = sectorsize) > { > - struct gpt_part *gpt =3D NULL, *gp; > - int rc, ngpt, i; > + struct open_disk *od; > + struct ptable *table; > + struct ptable_entry part; > + int rc; >=20 > - rc =3D disk_readgpt(dev, &gpt, &ngpt); > - if (rc) > - return (rc); > - > - /* Is this a request for the whole disk? */ > - if (dev->d_slice < 0) { > - dev->d_offset =3D 0; > - rc =3D 0; > - goto out; > + od =3D (struct open_disk *)malloc(sizeof(struct open_disk)); > + if (od =3D=3D NULL) { > + DEBUG("no memory"); > + return (ENOMEM); > } > - > /* > - * If a partition number was supplied, then the user is trying = to use > - * an MBR address rather than a GPT address, so fail. > + * While we are reading disk metadata, make sure we do it = relative > + * to the start of the disk > */ > - if (dev->d_partition !=3D 0xff) { > - rc =3D ENOENT; > + rc =3D 0; > + table =3D NULL; > + dev->d_offset =3D 0; > + dev->d_opendata =3D od; > + od->mediasize =3D mediasize; > + od->sectorsize =3D sectorsize; > + DEBUG("open '%s', unit %d slice %d partition %d", > + disk_fmtdev(dev), dev->d_unit, dev->d_slice, = dev->d_partition); > + > + /* Determine disk layout. */ > + od->table =3D ptable_open(dev, mediasize / sectorsize, = sectorsize, > + ptblread); > + if (od->table =3D=3D NULL) { > + DEBUG("Can't read partition table"); > + rc =3D ENXIO; > goto out; > } > - > - /* If a slice number was supplied but not found, this is an = error. */ > - gp =3D NULL; > if (dev->d_slice > 0) { > - for (i =3D 0; i < ngpt; i++) { > - if (gpt[i].gp_index =3D=3D dev->d_slice) { > - gp =3D &gpt[i]; > - break; > - } > - } > - if (gp =3D=3D NULL) { > - DEBUG("partition %d not found", dev->d_slice); > - rc =3D ENOENT; > + /* Try to get information about partition */ > + rc =3D ptable_getpart(od->table, &part, dev->d_slice); > + if (rc !=3D 0) /* Partition doesn't exist */ > goto out; > - } > - } > - > - /* Try to auto-detect the best partition. */ > - if (dev->d_slice =3D=3D 0) { > - gp =3D disk_bestgpt(gpt, ngpt); > - if (gp =3D=3D NULL) { > - rc =3D ENOENT; > + dev->d_offset =3D part.start; > + if (dev->d_partition =3D=3D -1 || > + dev->d_partition =3D=3D 255) > + goto out; /* Nothing more to do */ > + > + /* Try to read BSD label */ > + table =3D ptable_open(dev, part.end - part.start + 1, > + od->sectorsize, ptblread); > + if (table =3D=3D NULL) { > + DEBUG("Can't read BSD label"); > + rc =3D ENXIO; > goto out; > } > - dev->d_slice =3D gp->gp_index; > + rc =3D ptable_getpart(table, &part, dev->d_partition); > + if (rc !=3D 0) > + goto out; > + dev->d_offset +=3D part.start; > + } else if (dev->d_slice =3D=3D 0) { > + rc =3D ptable_getbestpart(od->table, &part); > + if (rc !=3D 0) > + goto out; > + /* Save the slice number of best partition to dev */ > + dev->d_slice =3D part.index; > + dev->d_offset =3D part.start; > } > - > - dev->d_offset =3D gp->gp_start; > - rc =3D 0; > - > out: > - if (gpt) > - free(gpt); > + if (table !=3D NULL) > + ptable_close(table); > + if (rc !=3D 0) { > + if (od->table !=3D NULL) > + ptable_close(od->table); > + free(od); > + } > return (rc); > } >=20 > -static void > -disk_printgptpart(struct disk_devdesc *dev, struct gpt_part *gp, > - char *prefix, int verbose) > +int > +disk_close(struct disk_devdesc *dev) > { > - char stats[80]; > - char line[96]; > - > - if (verbose) > - sprintf(stats, " %s", > - display_size(gp->gp_end + 1 - gp->gp_start)); > - else > - stats[0] =3D '\0'; > - > - if (uuid_equal(&gp->gp_type, &efi, NULL)) > - sprintf(line, "%s: EFI %s\n", prefix, stats); > - else if (uuid_equal(&gp->gp_type, &ms_basic_data, NULL)) > - sprintf(line, "%s: FAT/NTFS %s\n", prefix, stats); > - else if (uuid_equal(&gp->gp_type, &freebsd_boot, NULL)) > - sprintf(line, "%s: FreeBSD boot%s\n", prefix, stats); > - else if (uuid_equal(&gp->gp_type, &freebsd_ufs, NULL)) > - sprintf(line, "%s: FreeBSD UFS %s\n", prefix, stats); > - else if (uuid_equal(&gp->gp_type, &freebsd_zfs, NULL)) > - sprintf(line, "%s: FreeBSD ZFS %s\n", prefix, stats); > - else if (uuid_equal(&gp->gp_type, &freebsd_swap, NULL)) > - sprintf(line, "%s: FreeBSD swap%s\n", prefix, stats); > - else > - sprintf(line, > - "%s: = %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x%s\n", > - prefix, > - gp->gp_type.time_low, gp->gp_type.time_mid, > - gp->gp_type.time_hi_and_version, > - gp->gp_type.clock_seq_hi_and_reserved, > - gp->gp_type.clock_seq_low, > - gp->gp_type.node[0], > - gp->gp_type.node[1], > - gp->gp_type.node[2], > - gp->gp_type.node[3], > - gp->gp_type.node[4], > - gp->gp_type.node[5], > - stats); > - pager_output(line); > -} > + struct open_disk *od; >=20 > -static int > -disk_printgpt(struct disk_devdesc *dev, char *prefix, int verbose) > -{ > - struct gpt_part *gpt =3D NULL; > - int rc, ngpt, i; > - char line[80]; > - > - rc =3D disk_readgpt(dev, &gpt, &ngpt); > - if (rc) > - return (rc); > - for (i =3D 0; i < ngpt; i++) { > - sprintf(line, "%sp%d", prefix, i + 1); > - disk_printgptpart(dev, &gpt[i], line, verbose); > - } > - free(gpt); > + od =3D (struct open_disk *)dev->d_opendata; > + ptable_close(od->table); > + free(od); > return (0); > } >=20 > -#endif > - > -int > -disk_open(struct disk_devdesc *dev) > +char* > +disk_fmtdev(struct disk_devdesc *dev) > { > - int rc; > - > - rc =3D 0; > - /* > - * While we are reading disk metadata, make sure we do it = relative > - * to the start of the disk > - */ > - dev->d_offset =3D 0; > + static char buf[128]; > + char *cp; >=20 > + cp =3D buf + sprintf(buf, "%s%d", dev->d_dev->dv_name, = dev->d_unit); > + if (dev->d_slice > 0) { > #ifdef LOADER_GPT_SUPPORT > - rc =3D disk_opengpt(dev); > - if (rc =3D=3D 0) > - return (0); > + if (dev->d_partition =3D=3D 255) { > + sprintf(cp, "p%d:", dev->d_slice); > + return (buf); > + } else > #endif > #ifdef LOADER_MBR_SUPPORT > - rc =3D disk_openmbr(dev); > + cp +=3D sprintf(cp, "s%d", dev->d_slice); > #endif > - > - return (rc); > + if (dev->d_partition >=3D 0) > + cp +=3D sprintf(cp, "%c", dev->d_partition + = 'a'); > + } > + strcat(cp, ":"); > + return (buf); > } >=20 > -void > -disk_print(struct disk_devdesc *dev, char *prefix, int verbose) > +int > +disk_parsedev(struct disk_devdesc *dev, const char *devspec, const = char **path) > { > - > + int unit, slice, partition; > + const char *np; > + char *cp; > + > + np =3D devspec; > + unit =3D slice =3D partition =3D -1; > + if (*np !=3D '\0' && *np !=3D ':') { > + unit =3D strtol(np, &cp, 10); > + if (cp =3D=3D np) > + return (EUNIT); > #ifdef LOADER_GPT_SUPPORT > - if (disk_printgpt(dev, prefix, verbose) =3D=3D 0) > - return; > + if (*cp =3D=3D 'p') { > + np =3D cp + 1; > + slice =3D strtol(np, &cp, 10); > + if (np =3D=3D cp) > + return (ESLICE); > + /* we don't support nested partitions on GPT */ > + if (*cp !=3D '\0' && *cp !=3D ':') > + return (EINVAL); > + partition =3D 255; > + } else > #endif > #ifdef LOADER_MBR_SUPPORT > - disk_printmbr(dev, prefix, verbose); > + if (*cp =3D=3D 's') { > + np =3D cp + 1; > + slice =3D strtol(np, &cp, 10); > + if (np =3D=3D cp) > + return (ESLICE); > + } > #endif > + if (*cp !=3D '\0' && *cp !=3D ':') { > + partition =3D *cp - 'a'; > + if (partition < 0) > + return (EPART); > + cp++; > + } > + } else > + return (EINVAL); > + > + if (*cp !=3D '\0' && *cp !=3D ':') > + return (EINVAL); > + dev->d_unit =3D unit; > + dev->d_slice =3D slice; > + dev->d_partition =3D partition; > + if (path !=3D NULL) > + *path =3D (*cp =3D=3D '\0') ? cp: cp + 1; > + return (0); > } >=20 > Modified: head/sys/boot/common/disk.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/boot/common/disk.h Sun Aug 5 11:59:46 2012 = (r239057) > +++ head/sys/boot/common/disk.h Sun Aug 5 12:15:15 2012 = (r239058) > @@ -27,8 +27,7 @@ > */ >=20 > /* > - * Device descriptor for partitioned disks. We assume that all disk = addresses >=20 > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 13:38:16 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 07E2E106566C; Sun, 5 Aug 2012 13:38:16 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E7FE68FC0C; Sun, 5 Aug 2012 13:38: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 q75DcFrk088563; Sun, 5 Aug 2012 13:38:15 GMT (envelope-from dfr@svn.freebsd.org) Received: (from dfr@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75DcF37088561; Sun, 5 Aug 2012 13:38:15 GMT (envelope-from dfr@svn.freebsd.org) Message-Id: <201208051338.q75DcF37088561@svn.freebsd.org> From: Doug Rabson Date: Sun, 5 Aug 2012 13:38:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239061 - head/include/gssapi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 13:38:16 -0000 Author: dfr Date: Sun Aug 5 13:38:15 2012 New Revision: 239061 URL: http://svn.freebsd.org/changeset/base/239061 Log: Reduce namespace pollution from gssapi.h MFC after: 2 weeks Modified: head/include/gssapi/gssapi.h Modified: head/include/gssapi/gssapi.h ============================================================================== --- head/include/gssapi/gssapi.h Sun Aug 5 12:57:38 2012 (r239060) +++ head/include/gssapi/gssapi.h Sun Aug 5 13:38:15 2012 (r239061) @@ -31,15 +31,13 @@ #ifndef _GSSAPI_GSSAPI_H_ #define _GSSAPI_GSSAPI_H_ -/* - * First, include stddef.h to get size_t defined. - */ -#include +#include +#include -/* - * Include stdint.h to get explicitly sized data types. - */ -#include +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif #ifndef _SSIZE_T_DECLARED typedef __ssize_t ssize_t; @@ -67,7 +65,7 @@ typedef struct _gss_name_t *gss_name_t; * unsigned integer supported by the platform that has at least * 32 bits of precision. */ -typedef uint32_t gss_uint32; +typedef __uint32_t gss_uint32; #ifdef OM_STRING @@ -89,7 +87,7 @@ typedef OM_object_identifier gss_OID_des */ typedef gss_uint32 OM_uint32; -typedef uint64_t OM_uint64; +typedef __uint64_t OM_uint64; typedef struct gss_OID_desc_struct { OM_uint32 length; From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 13:40:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B76D3106564A; Sun, 5 Aug 2012 13:40:35 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A24878FC16; Sun, 5 Aug 2012 13:40:35 +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 q75DeZnn088803; Sun, 5 Aug 2012 13:40:35 GMT (envelope-from dfr@svn.freebsd.org) Received: (from dfr@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75DeZJQ088801; Sun, 5 Aug 2012 13:40:35 GMT (envelope-from dfr@svn.freebsd.org) Message-Id: <201208051340.q75DeZJQ088801@svn.freebsd.org> From: Doug Rabson Date: Sun, 5 Aug 2012 13:40:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239062 - head/lib/libpam/modules/pam_krb5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 13:40:35 -0000 Author: dfr Date: Sun Aug 5 13:40:35 2012 New Revision: 239062 URL: http://svn.freebsd.org/changeset/base/239062 Log: Add an option for pam_krb5 to allow it to authenticate users which don't have a local account. PR: 76678 Submitted by: daved at tamu.edu MFC after: 2 weeks Modified: head/lib/libpam/modules/pam_krb5/pam_krb5.c Modified: head/lib/libpam/modules/pam_krb5/pam_krb5.c ============================================================================== --- head/lib/libpam/modules/pam_krb5/pam_krb5.c Sun Aug 5 13:38:15 2012 (r239061) +++ head/lib/libpam/modules/pam_krb5/pam_krb5.c Sun Aug 5 13:40:35 2012 (r239062) @@ -91,6 +91,7 @@ static void compat_free_data_contents(kr #define PAM_OPT_NO_CCACHE "no_ccache" #define PAM_OPT_NO_USER_CHECK "no_user_check" #define PAM_OPT_REUSE_CCACHE "reuse_ccache" +#define PAM_OPT_NO_USER_CHECK "no_user_check" #define PAM_LOG_KRB5_ERR(ctx, rv, fmt, ...) \ do { \ @@ -218,10 +219,12 @@ pam_sm_authenticate(pam_handle_t *pamh, PAM_LOG("PAM_USER Redone"); } - pwd = getpwnam(user); - if (pwd == NULL) { - retval = PAM_USER_UNKNOWN; - goto cleanup2; + if (!openpam_get_option(pamh, PAM_OPT_NO_USER_CHECK)) { + pwd = getpwnam(user); + if (pwd == NULL) { + retval = PAM_USER_UNKNOWN; + goto cleanup2; + } } PAM_LOG("Done getpwnam()"); From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 14:05:11 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B08E1106564A; Sun, 5 Aug 2012 14:05:11 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B2278FC08; Sun, 5 Aug 2012 14:05:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q75E5BKN090748; Sun, 5 Aug 2012 14:05:11 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75E5BPA090746; Sun, 5 Aug 2012 14:05:11 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201208051405.q75E5BPA090746@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 5 Aug 2012 14:05:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239063 - head/sys/boot/pc98/boot2 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 14:05:11 -0000 Author: nyan Date: Sun Aug 5 14:05:11 2012 New Revision: 239063 URL: http://svn.freebsd.org/changeset/base/239063 Log: MFi386: the part of r219452 and r236405. - bunch of variables are turned into uint8_t. - Remove unnecessary initializations. Modified: head/sys/boot/pc98/boot2/boot2.c Modified: head/sys/boot/pc98/boot2/boot2.c ============================================================================== --- head/sys/boot/pc98/boot2/boot2.c Sun Aug 5 13:40:35 2012 (r239062) +++ head/sys/boot/pc98/boot2/boot2.c Sun Aug 5 14:05:11 2012 (r239063) @@ -126,13 +126,13 @@ static struct dsk { unsigned unit; unsigned head; unsigned sec; - unsigned slice; - unsigned part; + uint8_t slice; + uint8_t part; unsigned start; } dsk; static char cmd[512], cmddup[512], knamebuf[1024]; -static const char *kname = NULL; -static uint32_t opts = 0; +static const char *kname; +static uint32_t opts; static int comspeed = SIOSPD; static struct bootinfo bootinfo; static uint8_t ioctrl = IO_KEYBOARD; @@ -615,7 +615,8 @@ dskread(void *buf, unsigned lba, unsigne struct pc98_partition *dp; struct disklabel *d; char *sec; - unsigned sl, i; + unsigned i; + uint8_t sl; u_char *p; if (!dsk_meta) { From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 14:11:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EB88A1065670; Sun, 5 Aug 2012 14:11:07 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D701B8FC08; Sun, 5 Aug 2012 14:11:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q75EB7TP091245; Sun, 5 Aug 2012 14:11:07 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75EB7E8091242; Sun, 5 Aug 2012 14:11:07 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201208051411.q75EB7E8091242@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 5 Aug 2012 14:11:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239064 - in head/sys/boot/pc98/btx: btxldr lib X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 14:11:08 -0000 Author: nyan Date: Sun Aug 5 14:11:07 2012 New Revision: 239064 URL: http://svn.freebsd.org/changeset/base/239064 Log: Reduce diffs against i386. Modified: head/sys/boot/pc98/btx/btxldr/btxldr.S head/sys/boot/pc98/btx/lib/btxcsu.S Modified: head/sys/boot/pc98/btx/btxldr/btxldr.S ============================================================================== --- head/sys/boot/pc98/btx/btxldr/btxldr.S Sun Aug 5 14:05:11 2012 (r239063) +++ head/sys/boot/pc98/btx/btxldr/btxldr.S Sun Aug 5 14:11:07 2012 (r239064) @@ -15,13 +15,13 @@ * $FreeBSD$ */ +#include + /* * Prototype BTX loader program, written in a couple of hours. The * real thing should probably be more flexible, and in C. */ -#include - /* * Memory locations. */ Modified: head/sys/boot/pc98/btx/lib/btxcsu.S ============================================================================== --- head/sys/boot/pc98/btx/lib/btxcsu.S Sun Aug 5 14:05:11 2012 (r239063) +++ head/sys/boot/pc98/btx/lib/btxcsu.S Sun Aug 5 14:11:07 2012 (r239064) @@ -15,12 +15,12 @@ # $FreeBSD$ +#include + # # BTX C startup code (ELF). # -#include - # # Globals. # From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 14:11:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4947F106564A; Sun, 5 Aug 2012 14:11:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 30D448FC08; Sun, 5 Aug 2012 14:11:43 +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 q75EBh0I091342; Sun, 5 Aug 2012 14:11:43 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75EBg3c091320; Sun, 5 Aug 2012 14:11:42 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208051411.q75EBg3c091320@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 5 Aug 2012 14:11:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239065 - in head/sys: arm/arm dev/agp dev/md fs/nfsclient fs/nwfs fs/smbfs fs/tmpfs ia64/ia64 kern net nfsclient ofed/include/linux ufs/ffs vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 14:11:43 -0000 Author: kib Date: Sun Aug 5 14:11:42 2012 New Revision: 239065 URL: http://svn.freebsd.org/changeset/base/239065 Log: After the PHYS_TO_VM_PAGE() function was de-inlined, the main reason to pull vm_param.h was removed. Other big dependency of vm_page.h on vm_param.h are PA_LOCK* definitions, which are only needed for in-kernel code, because modules use KBI-safe functions to lock the pages. Stop including vm_param.h into vm_page.h. Include vm_param.h explicitely for the kernel code which needs it. Suggested and reviewed by: alc MFC after: 2 weeks Modified: head/sys/arm/arm/pmap.c head/sys/dev/agp/agp.c head/sys/dev/agp/agp_i810.c head/sys/dev/md/md.c head/sys/fs/nfsclient/nfs_clbio.c head/sys/fs/nwfs/nwfs_io.c head/sys/fs/smbfs/smbfs_io.c head/sys/fs/tmpfs/tmpfs_subr.c head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/ia64/ia64/pmap.c head/sys/kern/kern_proc.c head/sys/kern/subr_uio.c head/sys/kern/uipc_syscalls.c head/sys/net/bpf_zerocopy.c head/sys/nfsclient/nfs_bio.c head/sys/ofed/include/linux/gfp.h head/sys/ufs/ffs/ffs_vnops.c head/sys/vm/device_pager.c head/sys/vm/sg_pager.c head/sys/vm/vm_page.h head/sys/vm/vnode_pager.c Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Sun Aug 5 14:11:07 2012 (r239064) +++ head/sys/arm/arm/pmap.c Sun Aug 5 14:11:42 2012 (r239065) @@ -154,6 +154,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -165,7 +166,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: head/sys/dev/agp/agp.c ============================================================================== --- head/sys/dev/agp/agp.c Sun Aug 5 14:11:07 2012 (r239064) +++ head/sys/dev/agp/agp.c Sun Aug 5 14:11:42 2012 (r239065) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: head/sys/dev/agp/agp_i810.c ============================================================================== --- head/sys/dev/agp/agp_i810.c Sun Aug 5 14:11:07 2012 (r239064) +++ head/sys/dev/agp/agp_i810.c Sun Aug 5 14:11:42 2012 (r239065) @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Sun Aug 5 14:11:07 2012 (r239064) +++ head/sys/dev/md/md.c Sun Aug 5 14:11:42 2012 (r239065) @@ -84,14 +84,13 @@ #include #include +#include #include #include #include #include #include -#include - #define MD_MODVER 1 #define MD_SHUTDOWN 0x10000 /* Tell worker thread to terminate. */ Modified: head/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clbio.c Sun Aug 5 14:11:07 2012 (r239064) +++ head/sys/fs/nfsclient/nfs_clbio.c Sun Aug 5 14:11:42 2012 (r239065) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: head/sys/fs/nwfs/nwfs_io.c ============================================================================== --- head/sys/fs/nwfs/nwfs_io.c Sun Aug 5 14:11:07 2012 (r239064) +++ head/sys/fs/nwfs/nwfs_io.c Sun Aug 5 14:11:42 2012 (r239065) @@ -38,6 +38,7 @@ #include #include +#include #include #include #include Modified: head/sys/fs/smbfs/smbfs_io.c ============================================================================== --- head/sys/fs/smbfs/smbfs_io.c Sun Aug 5 14:11:07 2012 (r239064) +++ head/sys/fs/smbfs/smbfs_io.c Sun Aug 5 14:11:42 2012 (r239065) @@ -41,6 +41,7 @@ #include #include +#include #include #include #include Modified: head/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_subr.c Sun Aug 5 14:11:07 2012 (r239064) +++ head/sys/fs/tmpfs/tmpfs_subr.c Sun Aug 5 14:11:42 2012 (r239065) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Sun Aug 5 14:11:07 2012 (r239064) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Sun Aug 5 14:11:42 2012 (r239065) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: head/sys/ia64/ia64/pmap.c ============================================================================== --- head/sys/ia64/ia64/pmap.c Sun Aug 5 14:11:07 2012 (r239064) +++ head/sys/ia64/ia64/pmap.c Sun Aug 5 14:11:42 2012 (r239065) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Sun Aug 5 14:11:07 2012 (r239064) +++ head/sys/kern/kern_proc.c Sun Aug 5 14:11:42 2012 (r239065) @@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$"); #endif #include +#include #include #include #include Modified: head/sys/kern/subr_uio.c ============================================================================== --- head/sys/kern/subr_uio.c Sun Aug 5 14:11:07 2012 (r239064) +++ head/sys/kern/subr_uio.c Sun Aug 5 14:11:42 2012 (r239065) @@ -53,11 +53,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include #ifdef ZERO_COPY_SOCKETS -#include #include #endif Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Sun Aug 5 14:11:07 2012 (r239064) +++ head/sys/kern/uipc_syscalls.c Sun Aug 5 14:11:42 2012 (r239065) @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: head/sys/net/bpf_zerocopy.c ============================================================================== --- head/sys/net/bpf_zerocopy.c Sun Aug 5 14:11:07 2012 (r239064) +++ head/sys/net/bpf_zerocopy.c Sun Aug 5 14:11:42 2012 (r239065) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: head/sys/nfsclient/nfs_bio.c ============================================================================== --- head/sys/nfsclient/nfs_bio.c Sun Aug 5 14:11:07 2012 (r239064) +++ head/sys/nfsclient/nfs_bio.c Sun Aug 5 14:11:42 2012 (r239065) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: head/sys/ofed/include/linux/gfp.h ============================================================================== --- head/sys/ofed/include/linux/gfp.h Sun Aug 5 14:11:07 2012 (r239064) +++ head/sys/ofed/include/linux/gfp.h Sun Aug 5 14:11:42 2012 (r239065) @@ -34,6 +34,7 @@ #include +#include #include #include #include Modified: head/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vnops.c Sun Aug 5 14:11:07 2012 (r239064) +++ head/sys/ufs/ffs/ffs_vnops.c Sun Aug 5 14:11:42 2012 (r239065) @@ -80,6 +80,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: head/sys/vm/device_pager.c ============================================================================== --- head/sys/vm/device_pager.c Sun Aug 5 14:11:07 2012 (r239064) +++ head/sys/vm/device_pager.c Sun Aug 5 14:11:42 2012 (r239065) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: head/sys/vm/sg_pager.c ============================================================================== --- head/sys/vm/sg_pager.c Sun Aug 5 14:11:07 2012 (r239064) +++ head/sys/vm/sg_pager.c Sun Aug 5 14:11:42 2012 (r239065) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Sun Aug 5 14:11:07 2012 (r239064) +++ head/sys/vm/vm_page.h Sun Aug 5 14:11:42 2012 (r239065) @@ -284,8 +284,6 @@ extern struct vpglocks pa_lock[]; #include -#include - #include /* Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Sun Aug 5 14:11:07 2012 (r239064) +++ head/sys/vm/vnode_pager.c Sun Aug 5 14:11:42 2012 (r239065) @@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 14:37:49 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 88ED11065670; Sun, 5 Aug 2012 14:37:49 +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 727378FC18; Sun, 5 Aug 2012 14:37: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 q75EbnW0093367; Sun, 5 Aug 2012 14:37:49 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75EbnJO093363; Sun, 5 Aug 2012 14:37:49 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201208051437.q75EbnJO093363@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sun, 5 Aug 2012 14:37:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239066 - head/sys/boot/i386/libi386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 14:37:49 -0000 Author: ae Date: Sun Aug 5 14:37:48 2012 New Revision: 239066 URL: http://svn.freebsd.org/changeset/base/239066 Log: Add offset field to the i386_devdesc structure to be compatible with disk_devdesc structure. Update biosdisk driver to the new disk API. Modified: head/sys/boot/i386/libi386/Makefile head/sys/boot/i386/libi386/biosdisk.c head/sys/boot/i386/libi386/devicename.c head/sys/boot/i386/libi386/libi386.h Modified: head/sys/boot/i386/libi386/Makefile ============================================================================== --- head/sys/boot/i386/libi386/Makefile Sun Aug 5 14:11:42 2012 (r239065) +++ head/sys/boot/i386/libi386/Makefile Sun Aug 5 14:37:48 2012 (r239066) @@ -39,10 +39,6 @@ CFLAGS+= -DSMBIOS_LITTLE_ENDIAN_UUID .endif .endif -.if !defined(LOADER_NO_GPT_SUPPORT) -CFLAGS+= -DLOADER_GPT_SUPPORT -.endif - # Include simple terminal emulation (cons25-compatible) CFLAGS+= -DTERM_EMU Modified: head/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- head/sys/boot/i386/libi386/biosdisk.c Sun Aug 5 14:11:42 2012 (r239065) +++ head/sys/boot/i386/libi386/biosdisk.c Sun Aug 5 14:37:48 2012 (r239066) @@ -1,5 +1,6 @@ /*- * Copyright (c) 1998 Michael Smith + * Copyright (c) 2012 Andrey V. Elsukov * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,21 +38,19 @@ __FBSDID("$FreeBSD$"); * */ +#include #include - -#include -#include -#include #include - #include -#include #include #include #include +#include "disk.h" #include "libi386.h" +CTASSERT(sizeof(struct i386_devdesc) >= sizeof(struct disk_devdesc)); + #define BIOS_NUMDRIVES 0x475 #define BIOSDISK_SECSIZE 512 #define BUFSIZE (1 * BIOSDISK_SECSIZE) @@ -68,174 +67,118 @@ __FBSDID("$FreeBSD$"); # define DEBUG(fmt, args...) #endif -#ifdef LOADER_GPT_SUPPORT -struct gpt_part { - int gp_index; - uuid_t gp_type; - uint64_t gp_start; - uint64_t gp_end; -}; -#endif - -struct open_disk { - int od_dkunit; /* disk unit number */ - int od_unit; /* BIOS unit number */ - int od_cyl; /* BIOS geometry */ - int od_hds; - int od_sec; - daddr_t od_boff; /* block offset from beginning of BIOS disk */ - int od_flags; -#define BD_MODEINT13 0x0000 -#define BD_MODEEDD1 0x0001 -#define BD_MODEEDD3 0x0002 -#define BD_MODEMASK 0x0003 -#define BD_FLOPPY 0x0004 -#define BD_LABELOK 0x0008 -#define BD_PARTTABOK 0x0010 -#ifdef LOADER_GPT_SUPPORT -#define BD_GPTOK 0x0020 -#endif - union { - struct { - struct disklabel mbr_disklabel; - int mbr_nslices; /* slice count */ - struct dos_partition mbr_slicetab[NEXTDOSPART]; - } _mbr; -#ifdef LOADER_GPT_SUPPORT - struct { - int gpt_nparts; - struct gpt_part *gpt_partitions; - } _gpt; -#endif - } _data; -}; - -#define od_disklabel _data._mbr.mbr_disklabel -#define od_nslices _data._mbr.mbr_nslices -#define od_slicetab _data._mbr.mbr_slicetab -#ifdef LOADER_GPT_SUPPORT -#define od_nparts _data._gpt.gpt_nparts -#define od_partitions _data._gpt.gpt_partitions -#endif - /* * List of BIOS devices, translation from disk unit number to * BIOS unit number. */ static struct bdinfo { - int bd_unit; /* BIOS unit number */ - int bd_flags; - int bd_type; /* BIOS 'drive type' (floppy only) */ + int bd_unit; /* BIOS unit number */ + int bd_cyl; /* BIOS geometry */ + int bd_hds; + int bd_sec; + int bd_flags; +#define BD_MODEINT13 0x0000 +#define BD_MODEEDD1 0x0001 +#define BD_MODEEDD3 0x0002 +#define BD_MODEMASK 0x0003 +#define BD_FLOPPY 0x0004 + int bd_type; /* BIOS 'drive type' (floppy only) */ + uint16_t bd_sectorsize; /* Sector size */ + uint64_t bd_sectors; /* Disk size */ } bdinfo [MAXBDDEV]; static int nbdinfo = 0; -static int bd_getgeom(struct open_disk *od); -static int bd_read(struct open_disk *od, daddr_t dblk, int blks, - caddr_t dest); -static int bd_write(struct open_disk *od, daddr_t dblk, int blks, - caddr_t dest); - -static int bd_int13probe(struct bdinfo *bd); - -#ifdef LOADER_GPT_SUPPORT -static void bd_printgptpart(struct open_disk *od, struct gpt_part *gp, - char *prefix, int verbose); -#endif -static void bd_printslice(struct open_disk *od, struct dos_partition *dp, - char *prefix, int verbose); -static void bd_printbsdslice(struct open_disk *od, daddr_t offset, - char *prefix, int verbose); - -static int bd_init(void); -static int bd_strategy(void *devdata, int flag, daddr_t dblk, - size_t size, char *buf, size_t *rsize); -static int bd_realstrategy(void *devdata, int flag, daddr_t dblk, - size_t size, char *buf, size_t *rsize); -static int bd_open(struct open_file *f, ...); -static int bd_close(struct open_file *f); -static void bd_print(int verbose); +#define BD(dev) (bdinfo[(dev)->d_unit]) + +static int bd_read(struct disk_devdesc *dev, daddr_t dblk, int blks, + caddr_t dest); +static int bd_write(struct disk_devdesc *dev, daddr_t dblk, int blks, + caddr_t dest); +static int bd_int13probe(struct bdinfo *bd); + +static int bd_init(void); +static int bd_strategy(void *devdata, int flag, daddr_t dblk, size_t size, + char *buf, size_t *rsize); +static int bd_realstrategy(void *devdata, int flag, daddr_t dblk, + size_t size, char *buf, size_t *rsize); +static int bd_open(struct open_file *f, ...); +static int bd_close(struct open_file *f); +static int bd_ioctl(struct open_file *f, u_long cmd, void *data); +static void bd_print(int verbose); struct devsw biosdisk = { - "disk", - DEVT_DISK, - bd_init, - bd_strategy, - bd_open, - bd_close, - noioctl, - bd_print, - NULL + "disk", + DEVT_DISK, + bd_init, + bd_strategy, + bd_open, + bd_close, + bd_ioctl, + bd_print, + NULL }; -static int bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev); -static void bd_closedisk(struct open_disk *od); -static int bd_open_mbr(struct open_disk *od, struct i386_devdesc *dev); -static int bd_bestslice(struct open_disk *od); -static void bd_checkextended(struct open_disk *od, int slicenum); -#ifdef LOADER_GPT_SUPPORT -static int bd_open_gpt(struct open_disk *od, struct i386_devdesc *dev); -static struct gpt_part *bd_best_gptpart(struct open_disk *od); -#endif - /* * Translate between BIOS device numbers and our private unit numbers. */ int bd_bios2unit(int biosdev) { - int i; - - DEBUG("looking for bios device 0x%x", biosdev); - for (i = 0; i < nbdinfo; i++) { - DEBUG("bd unit %d is BIOS device 0x%x", i, bdinfo[i].bd_unit); - if (bdinfo[i].bd_unit == biosdev) - return(i); - } - return(-1); + int i; + + DEBUG("looking for bios device 0x%x", biosdev); + for (i = 0; i < nbdinfo; i++) { + DEBUG("bd unit %d is BIOS device 0x%x", i, bdinfo[i].bd_unit); + if (bdinfo[i].bd_unit == biosdev) + return (i); + } + return (-1); } int bd_unit2bios(int unit) { - if ((unit >= 0) && (unit < nbdinfo)) - return(bdinfo[unit].bd_unit); - return(-1); + + if ((unit >= 0) && (unit < nbdinfo)) + return (bdinfo[unit].bd_unit); + return (-1); } -/* +/* * Quiz the BIOS for disk devices, save a little info about them. */ static int -bd_init(void) +bd_init(void) { - int base, unit, nfd = 0; + int base, unit, nfd = 0; - /* sequence 0, 0x80 */ - for (base = 0; base <= 0x80; base += 0x80) { - for (unit = base; (nbdinfo < MAXBDDEV); unit++) { + /* sequence 0, 0x80 */ + for (base = 0; base <= 0x80; base += 0x80) { + for (unit = base; (nbdinfo < MAXBDDEV); unit++) { #ifndef VIRTUALBOX - /* check the BIOS equipment list for number of fixed disks */ - if((base == 0x80) && - (nfd >= *(unsigned char *)PTOV(BIOS_NUMDRIVES))) - break; -#endif - - bdinfo[nbdinfo].bd_unit = unit; - bdinfo[nbdinfo].bd_flags = (unit < 0x80) ? BD_FLOPPY : 0; - - if (!bd_int13probe(&bdinfo[nbdinfo])) - break; - - /* XXX we need "disk aliases" to make this simpler */ - printf("BIOS drive %c: is disk%d\n", - (unit < 0x80) ? ('A' + unit) : ('C' + unit - 0x80), nbdinfo); - nbdinfo++; - if (base == 0x80) - nfd++; + /* + * Check the BIOS equipment list for number + * of fixed disks. + */ + if(base == 0x80 && + (nfd >= *(unsigned char *)PTOV(BIOS_NUMDRIVES))) + break; +#endif + bdinfo[nbdinfo].bd_unit = unit; + bdinfo[nbdinfo].bd_flags = unit < 0x80 ? BD_FLOPPY: 0; + if (!bd_int13probe(&bdinfo[nbdinfo])) + break; + + /* XXX we need "disk aliases" to make this simpler */ + printf("BIOS drive %c: is disk%d\n", (unit < 0x80) ? + ('A' + unit): ('C' + unit - 0x80), nbdinfo); + nbdinfo++; + if (base == 0x80) + nfd++; + } } - } - return(0); + return(0); } /* @@ -244,36 +187,60 @@ bd_init(void) static int bd_int13probe(struct bdinfo *bd) { - v86.ctl = V86_FLAGS; - v86.addr = 0x13; - v86.eax = 0x800; - v86.edx = bd->bd_unit; - v86int(); - - if (!(V86_CY(v86.efl)) && /* carry clear */ - ((v86.edx & 0xff) > ((unsigned)bd->bd_unit & 0x7f))) { /* unit # OK */ - if ((v86.ecx & 0x3f) == 0) { /* absurd sector size */ - DEBUG("Invalid geometry for unit %d", bd->bd_unit); - return(0); /* skip device */ - } - bd->bd_flags |= BD_MODEINT13; + struct edd_params params; + + v86.ctl = V86_FLAGS; + v86.addr = 0x13; + v86.eax = 0x800; + v86.edx = bd->bd_unit; + v86int(); + + if (V86_CY(v86.efl) || /* carry set */ + (v86.ecx & 0x3f) == 0 || /* absurd sector number */ + (v86.edx & 0xff) <= (unsigned)(bd->bd_unit & 0x7f)) /* unit # bad */ + return (0); /* skip device */ + + /* Convert max cyl # -> # of cylinders */ + bd->bd_cyl = ((v86.ecx & 0xc0) << 2) + ((v86.ecx & 0xff00) >> 8) + 1; + /* Convert max head # -> # of heads */ + bd->bd_hds = ((v86.edx & 0xff00) >> 8) + 1; + bd->bd_sec = v86.ecx & 0x3f; bd->bd_type = v86.ebx & 0xff; + bd->bd_flags |= BD_MODEINT13; + + /* Calculate sectors count from the geometry */ + bd->bd_sectors = bd->bd_cyl * bd->bd_hds * bd->bd_sec; + bd->bd_sectorsize = BIOSDISK_SECSIZE; + DEBUG("unit 0x%x geometry %d/%d/%d", bd->bd_unit, bd->bd_cyl, + bd->bd_hds, bd->bd_sec); /* Determine if we can use EDD with this device. */ v86.eax = 0x4100; v86.edx = bd->bd_unit; v86.ebx = 0x55aa; v86int(); - if (!(V86_CY(v86.efl)) && /* carry clear */ - ((v86.ebx & 0xffff) == 0xaa55) && /* signature */ - (v86.ecx & EDD_INTERFACE_FIXED_DISK)) { /* packets mode ok */ - bd->bd_flags |= BD_MODEEDD1; - if ((v86.eax & 0xff00) >= 0x3000) - bd->bd_flags |= BD_MODEEDD3; + if (V86_CY(v86.efl) || /* carry set */ + (v86.ebx & 0xffff) != 0xaa55 || /* signature */ + (v86.ecx & EDD_INTERFACE_FIXED_DISK) == 0) + return (1); + /* EDD supported */ + bd->bd_flags |= BD_MODEEDD1; + if ((v86.eax & 0xff00) >= 0x3000) + bd->bd_flags |= BD_MODEEDD3; + /* Get disk params */ + params.len = sizeof(struct edd_params); + v86.ctl = V86_FLAGS; + v86.addr = 0x13; + v86.eax = 0x4800; + v86.edx = bd->bd_unit; + v86.ds = VTOPSEG(¶ms); + v86.esi = VTOPOFF(¶ms); + v86int(); + if (!V86_CY(v86.efl)) { + bd->bd_sectors = params.sectors; + bd->bd_sectorsize = params.sector_size; } - return(1); - } - return(0); + return (1); } /* @@ -282,238 +249,30 @@ bd_int13probe(struct bdinfo *bd) static void bd_print(int verbose) { - int i, j; - char line[80]; - struct i386_devdesc dev; - struct open_disk *od; - struct dos_partition *dptr; - - for (i = 0; i < nbdinfo; i++) { - sprintf(line, " disk%d: BIOS drive %c:\n", i, - (bdinfo[i].bd_unit < 0x80) ? ('A' + bdinfo[i].bd_unit) : ('C' + bdinfo[i].bd_unit - 0x80)); - pager_output(line); - - /* try to open the whole disk */ - dev.d_unit = i; - dev.d_kind.biosdisk.slice = -1; - dev.d_kind.biosdisk.partition = -1; - - if (!bd_opendisk(&od, &dev)) { - -#ifdef LOADER_GPT_SUPPORT - /* Do we have a GPT table? */ - if (od->od_flags & BD_GPTOK) { - for (j = 0; j < od->od_nparts; j++) { - sprintf(line, " disk%dp%d", i, - od->od_partitions[j].gp_index); - bd_printgptpart(od, &od->od_partitions[j], line, verbose); + static char line[80]; + struct disk_devdesc dev; + int i; + + for (i = 0; i < nbdinfo; i++) { + sprintf(line, " disk%d: BIOS drive %c:\n", i, + (bdinfo[i].bd_unit < 0x80) ? ('A' + bdinfo[i].bd_unit): + ('C' + bdinfo[i].bd_unit - 0x80)); + pager_output(line); + dev.d_dev = &biosdisk; + dev.d_unit = i; + dev.d_slice = -1; + dev.d_partition = -1; + if (disk_open(&dev, + bdinfo[i].bd_sectorsize * bdinfo[i].bd_sectors, + bdinfo[i].bd_sectorsize) == 0) { + sprintf(line, " disk%d", i); + disk_print(&dev, line, verbose); + disk_close(&dev); } - } else -#endif - /* Do we have a partition table? */ - if (od->od_flags & BD_PARTTABOK) { - dptr = &od->od_slicetab[0]; - - /* Check for a "dedicated" disk */ - if ((dptr[3].dp_typ == DOSPTYP_386BSD) && - (dptr[3].dp_start == 0) && - (dptr[3].dp_size == 50000)) { - sprintf(line, " disk%d", i); - bd_printbsdslice(od, 0, line, verbose); - } else { - for (j = 0; j < od->od_nslices; j++) { - sprintf(line, " disk%ds%d", i, j + 1); - bd_printslice(od, &dptr[j], line, verbose); - } - } - } - bd_closedisk(od); - } - } -} - -/* Given a size in 512 byte sectors, convert it to a human-readable number. */ -static char * -display_size(uint64_t size) -{ - static char buf[80]; - char unit; - - size /= 2; - unit = 'K'; - if (size >= 10485760000LL) { - size /= 1073741824; - unit = 'T'; - } else if (size >= 10240000) { - size /= 1048576; - unit = 'G'; - } else if (size >= 10000) { - size /= 1024; - unit = 'M'; - } - sprintf(buf, "%.6ld%cB", (long)size, unit); - return (buf); -} - -#ifdef LOADER_GPT_SUPPORT -static uuid_t efi = GPT_ENT_TYPE_EFI; -static uuid_t freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT; -static uuid_t freebsd_ufs = GPT_ENT_TYPE_FREEBSD_UFS; -static uuid_t freebsd_swap = GPT_ENT_TYPE_FREEBSD_SWAP; -static uuid_t freebsd_zfs = GPT_ENT_TYPE_FREEBSD_ZFS; -static uuid_t ms_basic_data = GPT_ENT_TYPE_MS_BASIC_DATA; - -static void -bd_printgptpart(struct open_disk *od, struct gpt_part *gp, char *prefix, - int verbose) -{ - char stats[80]; - char line[96]; - - if (verbose) - sprintf(stats, " %s", display_size(gp->gp_end + 1 - gp->gp_start)); - else - stats[0] = '\0'; - - if (uuid_equal(&gp->gp_type, &efi, NULL)) - sprintf(line, "%s: EFI %s\n", prefix, stats); - else if (uuid_equal(&gp->gp_type, &ms_basic_data, NULL)) - sprintf(line, "%s: FAT/NTFS %s\n", prefix, stats); - else if (uuid_equal(&gp->gp_type, &freebsd_boot, NULL)) - sprintf(line, "%s: FreeBSD boot%s\n", prefix, stats); - else if (uuid_equal(&gp->gp_type, &freebsd_ufs, NULL)) - sprintf(line, "%s: FreeBSD UFS %s\n", prefix, stats); - else if (uuid_equal(&gp->gp_type, &freebsd_zfs, NULL)) - sprintf(line, "%s: FreeBSD ZFS %s\n", prefix, stats); - else if (uuid_equal(&gp->gp_type, &freebsd_swap, NULL)) - sprintf(line, "%s: FreeBSD swap%s\n", prefix, stats); - else - sprintf(line, "%s: %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x%s\n", - prefix, - gp->gp_type.time_low, gp->gp_type.time_mid, - gp->gp_type.time_hi_and_version, - gp->gp_type.clock_seq_hi_and_reserved, gp->gp_type.clock_seq_low, - gp->gp_type.node[0], gp->gp_type.node[1], gp->gp_type.node[2], - gp->gp_type.node[3], gp->gp_type.node[4], gp->gp_type.node[5], - stats); - pager_output(line); -} -#endif - -/* - * Print information about slices on a disk. For the size calculations we - * assume a 512 byte sector. - */ -static void -bd_printslice(struct open_disk *od, struct dos_partition *dp, char *prefix, - int verbose) -{ - char stats[80]; - char line[80]; - - if (verbose) - sprintf(stats, " %s (%d - %d)", display_size(dp->dp_size), - dp->dp_start, dp->dp_start + dp->dp_size); - else - stats[0] = '\0'; - - switch (dp->dp_typ) { - case DOSPTYP_386BSD: - bd_printbsdslice(od, (daddr_t)dp->dp_start, prefix, verbose); - return; - case DOSPTYP_LINSWP: - sprintf(line, "%s: Linux swap%s\n", prefix, stats); - break; - case DOSPTYP_LINUX: - /* - * XXX - * read the superblock to confirm this is an ext2fs partition? - */ - sprintf(line, "%s: ext2fs%s\n", prefix, stats); - break; - case 0x00: /* unused partition */ - case DOSPTYP_EXT: - return; - case 0x01: - sprintf(line, "%s: FAT-12%s\n", prefix, stats); - break; - case 0x04: - case 0x06: - case 0x0e: - sprintf(line, "%s: FAT-16%s\n", prefix, stats); - break; - case 0x07: - sprintf(line, "%s: NTFS/HPFS%s\n", prefix, stats); - break; - case 0x0b: - case 0x0c: - sprintf(line, "%s: FAT-32%s\n", prefix, stats); - break; - default: - sprintf(line, "%s: Unknown fs: 0x%x %s\n", prefix, dp->dp_typ, - stats); } - pager_output(line); } /* - * Print out each valid partition in the disklabel of a FreeBSD slice. - * For size calculations, we assume a 512 byte sector size. - */ -static void -bd_printbsdslice(struct open_disk *od, daddr_t offset, char *prefix, - int verbose) -{ - char line[80]; - char buf[BIOSDISK_SECSIZE]; - struct disklabel *lp; - int i; - - /* read disklabel */ - if (bd_read(od, offset + LABELSECTOR, 1, buf)) - return; - lp =(struct disklabel *)(&buf[0]); - if (lp->d_magic != DISKMAGIC) { - sprintf(line, "%s: FFS bad disklabel\n", prefix); - pager_output(line); - return; - } - - /* Print partitions */ - for (i = 0; i < lp->d_npartitions; i++) { - /* - * For each partition, make sure we know what type of fs it is. If - * not, then skip it. However, since floppies often have bogus - * fstypes, print the 'a' partition on a floppy even if it is marked - * unused. - */ - if ((lp->d_partitions[i].p_fstype == FS_BSDFFS) || - (lp->d_partitions[i].p_fstype == FS_SWAP) || - (lp->d_partitions[i].p_fstype == FS_VINUM) || - ((lp->d_partitions[i].p_fstype == FS_UNUSED) && - (od->od_flags & BD_FLOPPY) && (i == 0))) { - - /* Only print out statistics in verbose mode */ - if (verbose) - sprintf(line, " %s%c: %s %s (%d - %d)\n", prefix, 'a' + i, - (lp->d_partitions[i].p_fstype == FS_SWAP) ? "swap " : - (lp->d_partitions[i].p_fstype == FS_VINUM) ? "vinum" : - "FFS ", - display_size(lp->d_partitions[i].p_size), - lp->d_partitions[i].p_offset, - lp->d_partitions[i].p_offset + lp->d_partitions[i].p_size); - else - sprintf(line, " %s%c: %s\n", prefix, 'a' + i, - (lp->d_partitions[i].p_fstype == FS_SWAP) ? "swap" : - (lp->d_partitions[i].p_fstype == FS_VINUM) ? "vinum" : - "FFS"); - pager_output(line); - } - } -} - - -/* * Attempt to open the disk described by (dev) for use by (f). * * Note that the philosophy here is "give them exactly what @@ -523,564 +282,83 @@ bd_printbsdslice(struct open_disk *od, d * sliced - are they after the first BSD slice, or the DOS * slice before it?) */ -static int -bd_open(struct open_file *f, ...) -{ - va_list ap; - struct i386_devdesc *dev; - struct open_disk *od; - int error; - - va_start(ap, f); - dev = va_arg(ap, struct i386_devdesc *); - va_end(ap); - if ((error = bd_opendisk(&od, dev))) - return(error); - - /* - * Save our context - */ - ((struct i386_devdesc *)(f->f_devdata))->d_kind.biosdisk.data = od; - DEBUG("open_disk %p, partition at 0x%x", od, od->od_boff); - return(0); -} - static int -bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev) -{ - struct open_disk *od; - int error; - - if (dev->d_unit >= nbdinfo) { - DEBUG("attempt to open nonexistent disk"); - return(ENXIO); - } - - od = (struct open_disk *)malloc(sizeof(struct open_disk)); - if (!od) { - DEBUG("no memory"); - return (ENOMEM); - } - - /* Look up BIOS unit number, initalise open_disk structure */ - od->od_dkunit = dev->d_unit; - od->od_unit = bdinfo[od->od_dkunit].bd_unit; - od->od_flags = bdinfo[od->od_dkunit].bd_flags; - od->od_boff = 0; - error = 0; - DEBUG("open '%s', unit 0x%x slice %d partition %d", - i386_fmtdev(dev), dev->d_unit, - dev->d_kind.biosdisk.slice, dev->d_kind.biosdisk.partition); - - /* Get geometry for this open (removable device may have changed) */ - if (bd_getgeom(od)) { - DEBUG("can't get geometry"); - error = ENXIO; - goto out; - } - - /* Determine disk layout. */ -#ifdef LOADER_GPT_SUPPORT - error = bd_open_gpt(od, dev); - if (error) -#endif - error = bd_open_mbr(od, dev); - - out: - if (error) { - free(od); - } else { - *odp = od; /* return the open disk */ - } - return(error); -} - -static int -bd_open_mbr(struct open_disk *od, struct i386_devdesc *dev) +bd_open(struct open_file *f, ...) { - struct dos_partition *dptr; - struct disklabel *lp; - int sector, slice, i; - int error; - char buf[BUFSIZE]; - - /* - * Following calculations attempt to determine the correct value - * for d->od_boff by looking for the slice and partition specified, - * or searching for reasonable defaults. - */ - - /* - * Find the slice in the DOS slice table. - */ - od->od_nslices = 0; - if (bd_read(od, 0, 1, buf)) { - DEBUG("error reading MBR"); - return (EIO); - } - - /* - * Check the slice table magic. - */ - if (((u_char)buf[0x1fe] != 0x55) || ((u_char)buf[0x1ff] != 0xaa)) { - /* If a slice number was explicitly supplied, this is an error */ - if (dev->d_kind.biosdisk.slice > 0) { - DEBUG("no slice table/MBR (no magic)"); - return (ENOENT); - } - sector = 0; - goto unsliced; /* may be a floppy */ - } - - /* - * copy the partition table, then pick up any extended partitions. - */ - bcopy(buf + DOSPARTOFF, &od->od_slicetab, - sizeof(struct dos_partition) * NDOSPART); - od->od_nslices = 4; /* extended slices start here */ - for (i = 0; i < NDOSPART; i++) - bd_checkextended(od, i); - od->od_flags |= BD_PARTTABOK; - dptr = &od->od_slicetab[0]; - - /* Is this a request for the whole disk? */ - if (dev->d_kind.biosdisk.slice == -1) { - sector = 0; - goto unsliced; - } - - /* - * if a slice number was supplied but not found, this is an error. - */ - if (dev->d_kind.biosdisk.slice > 0) { - slice = dev->d_kind.biosdisk.slice - 1; - if (slice >= od->od_nslices) { - DEBUG("slice %d not found", slice); - return (ENOENT); - } - } - - /* - * Check for the historically bogus MBR found on true dedicated disks - */ - if ((dptr[3].dp_typ == DOSPTYP_386BSD) && - (dptr[3].dp_start == 0) && - (dptr[3].dp_size == 50000)) { - sector = 0; - goto unsliced; - } + struct disk_devdesc *dev; + va_list ap; - /* Try to auto-detect the best slice; this should always give a slice number */ - if (dev->d_kind.biosdisk.slice == 0) { - slice = bd_bestslice(od); - if (slice == -1) { - return (ENOENT); - } - dev->d_kind.biosdisk.slice = slice; - } + va_start(ap, f); + dev = va_arg(ap, struct disk_devdesc *); + va_end(ap); - dptr = &od->od_slicetab[0]; - /* - * Accept the supplied slice number unequivocally (we may be looking - * at a DOS partition). - */ - dptr += (dev->d_kind.biosdisk.slice - 1); /* we number 1-4, offsets are 0-3 */ - sector = dptr->dp_start; - DEBUG("slice entry %d at %d, %d sectors", dev->d_kind.biosdisk.slice - 1, sector, dptr->dp_size); - - /* - * If we are looking at a BSD slice, and the partition is < 0, assume the 'a' partition - */ - if ((dptr->dp_typ == DOSPTYP_386BSD) && (dev->d_kind.biosdisk.partition < 0)) - dev->d_kind.biosdisk.partition = 0; - - unsliced: - /* - * Now we have the slice offset, look for the partition in the disklabel if we have - * a partition to start with. - * - * XXX we might want to check the label checksum. - */ - if (dev->d_kind.biosdisk.partition < 0) { - od->od_boff = sector; /* no partition, must be after the slice */ - DEBUG("opening raw slice"); - } else { - - if (bd_read(od, sector + LABELSECTOR, 1, buf)) { - DEBUG("error reading disklabel"); - return (EIO); - } - DEBUG("copy %d bytes of label from %p to %p", sizeof(struct disklabel), buf + LABELOFFSET, &od->od_disklabel); - bcopy(buf + LABELOFFSET, &od->od_disklabel, sizeof(struct disklabel)); - lp = &od->od_disklabel; - od->od_flags |= BD_LABELOK; - - if (lp->d_magic != DISKMAGIC) { - DEBUG("no disklabel"); - return (ENOENT); - } - if (dev->d_kind.biosdisk.partition >= lp->d_npartitions) { - DEBUG("partition '%c' exceeds partitions in table (a-'%c')", - 'a' + dev->d_kind.biosdisk.partition, 'a' + lp->d_npartitions); - return (EPART); - } + if (dev->d_unit < 0 || dev->d_unit >= nbdinfo) + return (EIO); -#ifdef DISK_DEBUG - /* Complain if the partition is unused unless this is a floppy. */ - if ((lp->d_partitions[dev->d_kind.biosdisk.partition].p_fstype == FS_UNUSED) && - !(od->od_flags & BD_FLOPPY)) - DEBUG("warning, partition marked as unused"); -#endif - - od->od_boff = - lp->d_partitions[dev->d_kind.biosdisk.partition].p_offset - - lp->d_partitions[RAW_PART].p_offset + - sector; - } - return (0); + return (disk_open(dev, BD(dev).bd_sectors * BD(dev).bd_sectorsize, + BD(dev).bd_sectorsize)); } -static void -bd_checkextended(struct open_disk *od, int slicenum) -{ - char buf[BIOSDISK_SECSIZE]; - struct dos_partition *dp; - u_int base; - int i, start, end; - - dp = &od->od_slicetab[slicenum]; - start = od->od_nslices; - - if (dp->dp_size == 0) - goto done; - if (dp->dp_typ != DOSPTYP_EXT) - goto done; - if (bd_read(od, (daddr_t)dp->dp_start, 1, buf)) - goto done; - if (((u_char)buf[0x1fe] != 0x55) || ((u_char)buf[0x1ff] != 0xaa)) { - DEBUG("no magic in extended table"); - goto done; - } - base = dp->dp_start; - dp = (struct dos_partition *)(&buf[DOSPARTOFF]); - for (i = 0; i < NDOSPART; i++, dp++) { - if (dp->dp_size == 0) - continue; - if (od->od_nslices == NEXTDOSPART) - goto done; - dp->dp_start += base; - bcopy(dp, &od->od_slicetab[od->od_nslices], sizeof(*dp)); - od->od_nslices++; - } - end = od->od_nslices; - - /* - * now, recursively check the slices we just added - */ - for (i = start; i < end; i++) - bd_checkextended(od, i); -done: - return; -} - -/* - * Search for a slice with the following preferences: - * - * 1: Active FreeBSD slice - * 2: Non-active FreeBSD slice - * 3: Active Linux slice - * 4: non-active Linux slice - * 5: Active FAT/FAT32 slice - * 6: non-active FAT/FAT32 slice - */ -#define PREF_RAWDISK 0 -#define PREF_FBSD_ACT 1 -#define PREF_FBSD 2 -#define PREF_LINUX_ACT 3 -#define PREF_LINUX 4 -#define PREF_DOS_ACT 5 -#define PREF_DOS 6 -#define PREF_NONE 7 - -/* - * slicelimit is in the range 0 .. NDOSPART - */ static int -bd_bestslice(struct open_disk *od) +bd_close(struct open_file *f) { - struct dos_partition *dp; - int pref, preflevel; - int i, prefslice; - - prefslice = 0; - preflevel = PREF_NONE; - - dp = &od->od_slicetab[0]; - for (i = 0; i < od->od_nslices; i++, dp++) { - - switch (dp->dp_typ) { - case DOSPTYP_386BSD: /* FreeBSD */ - pref = dp->dp_flag & 0x80 ? PREF_FBSD_ACT : PREF_FBSD; - break; - - case DOSPTYP_LINUX: - pref = dp->dp_flag & 0x80 ? PREF_LINUX_ACT : PREF_LINUX; - break; - - case 0x01: /* DOS/Windows */ - case 0x04: - case 0x06: - case 0x0b: - case 0x0c: - case 0x0e: - pref = dp->dp_flag & 0x80 ? PREF_DOS_ACT : PREF_DOS; - break; + struct disk_devdesc *dev; - default: - pref = PREF_NONE; - } - if (pref < preflevel) { - preflevel = pref; - prefslice = i + 1; - } - } - return (prefslice); + dev = (struct disk_devdesc *)f->f_devdata; + return (disk_close(dev)); } -#ifdef LOADER_GPT_SUPPORT static int -bd_open_gpt(struct open_disk *od, struct i386_devdesc *dev) +bd_ioctl(struct open_file *f, u_long cmd, void *data) { - struct dos_partition *dp; - struct gpt_hdr *hdr; - struct gpt_ent *ent; - struct gpt_part *gp; - int entries_per_sec, error, i, part; - daddr_t lba, elba; - char gpt[BIOSDISK_SECSIZE], tbl[BIOSDISK_SECSIZE]; - - /* - * Following calculations attempt to determine the correct value *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 14:38:53 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AF45A106564A; Sun, 5 Aug 2012 14:38:53 +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 9A2C78FC17; Sun, 5 Aug 2012 14:38:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q75Ecr6E093480; Sun, 5 Aug 2012 14:38:53 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75EcrLd093478; Sun, 5 Aug 2012 14:38:53 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201208051438.q75EcrLd093478@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sun, 5 Aug 2012 14:38:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239067 - head/sys/boot/i386/loader X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 14:38:53 -0000 Author: ae Date: Sun Aug 5 14:38:53 2012 New Revision: 239067 URL: http://svn.freebsd.org/changeset/base/239067 Log: Remove unneeded flag. Modified: head/sys/boot/i386/loader/Makefile Modified: head/sys/boot/i386/loader/Makefile ============================================================================== --- head/sys/boot/i386/loader/Makefile Sun Aug 5 14:37:48 2012 (r239066) +++ head/sys/boot/i386/loader/Makefile Sun Aug 5 14:38:53 2012 (r239067) @@ -50,9 +50,6 @@ CFLAGS+= -DLOADER_BZIP2_SUPPORT .if !defined(LOADER_NO_GZIP_SUPPORT) CFLAGS+= -DLOADER_GZIP_SUPPORT .endif -.if !defined(LOADER_NO_GPT_SUPPORT) -CFLAGS+= -DLOADER_GPT_SUPPORT -.endif .if defined(LOADER_NANDFS_SUPPORT) CFLAGS+= -DLOADER_NANDFS_SUPPORT .endif From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 14:48:29 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00EA3106566B; Sun, 5 Aug 2012 14:48:29 +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 DFD6C8FC0A; Sun, 5 Aug 2012 14:48:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q75EmSko094325; Sun, 5 Aug 2012 14:48:28 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75EmSaU094322; Sun, 5 Aug 2012 14:48:28 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201208051448.q75EmSaU094322@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sun, 5 Aug 2012 14:48:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239068 - in head/sys/boot: i386/loader zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 14:48:29 -0000 Author: ae Date: Sun Aug 5 14:48:28 2012 New Revision: 239068 URL: http://svn.freebsd.org/changeset/base/239068 Log: Teach the ZFS use new partitions API when probing. Note: now ZFS does probe only for partitions with type "freebsd-zfs" and "freebsd". Modified: head/sys/boot/i386/loader/main.c head/sys/boot/zfs/zfs.c Modified: head/sys/boot/i386/loader/main.c ============================================================================== --- head/sys/boot/i386/loader/main.c Sun Aug 5 14:38:53 2012 (r239067) +++ head/sys/boot/i386/loader/main.c Sun Aug 5 14:48:28 2012 (r239068) @@ -356,25 +356,17 @@ static void i386_zfs_probe(void) { char devname[32]; - int unit, slice; + int unit; /* * Open all the disks we can find and see if we can reconstruct - * ZFS pools from them. Bogusly assumes that the disks are named - * diskN, diskNpM or diskNsM. + * ZFS pools from them. */ for (unit = 0; unit < MAXBDDEV; unit++) { + if (bd_unit2bios(unit) == -1) + break; sprintf(devname, "disk%d:", unit); - if (zfs_probe_dev(devname, NULL) == ENXIO) - continue; - for (slice = 1; slice <= 128; slice++) { - sprintf(devname, "disk%dp%d:", unit, slice); - zfs_probe_dev(devname, NULL); - } - for (slice = 1; slice <= 4; slice++) { - sprintf(devname, "disk%ds%d:", unit, slice); - zfs_probe_dev(devname, NULL); - } + zfs_probe_dev(devname, NULL); } } #endif Modified: head/sys/boot/zfs/zfs.c ============================================================================== --- head/sys/boot/zfs/zfs.c Sun Aug 5 14:38:53 2012 (r239067) +++ head/sys/boot/zfs/zfs.c Sun Aug 5 14:48:28 2012 (r239068) @@ -33,10 +33,11 @@ __FBSDID("$FreeBSD$"); * Stand-alone file reading package. */ +#include #include -#include #include #include +#include #include #include #include @@ -376,21 +377,103 @@ zfs_dev_init(void) return (0); } -int -zfs_probe_dev(const char *devname, uint64_t *pool_guid) +struct zfs_probe_args { + int fd; + const char *devname; + uint64_t *pool_guid; + uint16_t secsz; +}; + +static int +zfs_diskread(void *arg, void *buf, size_t blocks, off_t offset) +{ + struct zfs_probe_args *ppa; + + ppa = (struct zfs_probe_args *)arg; + return (vdev_read(NULL, (void *)(uintptr_t)ppa->fd, + offset * ppa->secsz, buf, blocks * ppa->secsz)); +} + +static int +zfs_probe(int fd, uint64_t *pool_guid) { spa_t *spa; - int fd; int ret; - fd = open(devname, O_RDONLY); - if (fd == -1) - return (ENXIO); ret = vdev_probe(vdev_read, (void *)(uintptr_t)fd, &spa); - if (ret != 0) - close(fd); - else if (pool_guid != NULL) + if (ret == 0 && pool_guid != NULL) *pool_guid = spa->spa_guid; + return (ret); +} + +static void +zfs_probe_partition(void *arg, const char *partname, + const struct ptable_entry *part) +{ + struct zfs_probe_args *ppa, pa; + struct ptable *table; + char devname[32]; + int ret; + + /* Probe only freebsd-zfs and freebsd partitions */ + if (part->type != PART_FREEBSD && + part->type != PART_FREEBSD_ZFS) + return; + + ppa = (struct zfs_probe_args *)arg; + strncpy(devname, ppa->devname, strlen(ppa->devname) - 1); + sprintf(devname, "%s%s:", devname, partname); + pa.fd = open(devname, O_RDONLY); + if (pa.fd == -1) + return; + ret = zfs_probe(pa.fd, ppa->pool_guid); + if (ret == 0) + return; + /* Do we have BSD label here? */ + if (part->type == PART_FREEBSD) { + pa.devname = devname; + pa.pool_guid = ppa->pool_guid; + pa.secsz = ppa->secsz; + table = ptable_open(&pa, part->end - part->start + 1, + ppa->secsz, zfs_diskread); + if (table != NULL) { + ptable_iterate(table, &pa, zfs_probe_partition); + ptable_close(table); + } + } + close(pa.fd); +} + +int +zfs_probe_dev(const char *devname, uint64_t *pool_guid) +{ + struct ptable *table; + struct zfs_probe_args pa; + off_t mediasz; + int ret; + + pa.fd = open(devname, O_RDONLY); + if (pa.fd == -1) + return (ENXIO); + /* Probe the whole disk */ + ret = zfs_probe(pa.fd, pool_guid); + if (ret == 0) + return (0); + /* Probe each partition */ + ret = ioctl(pa.fd, DIOCGMEDIASIZE, &mediasz); + if (ret == 0) + ret = ioctl(pa.fd, DIOCGSECTORSIZE, &pa.secsz); + if (ret == 0) { + pa.devname = devname; + pa.pool_guid = pool_guid; + table = ptable_open(&pa, mediasz / pa.secsz, pa.secsz, + zfs_diskread); + if (table != NULL) { + ptable_iterate(table, &pa, zfs_probe_partition); + ptable_close(table); + } + } + close(pa.fd); return (0); } From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 14:48:56 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 37EEF10657C1; Sun, 5 Aug 2012 14:48:56 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 22F268FC08; Sun, 5 Aug 2012 14:48: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 q75Emt5r094394; Sun, 5 Aug 2012 14:48:55 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75EmtE1094391; Sun, 5 Aug 2012 14:48:55 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201208051448.q75EmtE1094391@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 5 Aug 2012 14:48:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239069 - in head/sys/boot/pc98: cdboot libpc98 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 14:48:56 -0000 Author: nyan Date: Sun Aug 5 14:48:55 2012 New Revision: 239069 URL: http://svn.freebsd.org/changeset/base/239069 Log: Reduce diffs against i386. Modified: head/sys/boot/pc98/cdboot/cdboot.S head/sys/boot/pc98/libpc98/Makefile Modified: head/sys/boot/pc98/cdboot/cdboot.S ============================================================================== --- head/sys/boot/pc98/cdboot/cdboot.S Sun Aug 5 14:48:28 2012 (r239068) +++ head/sys/boot/pc98/cdboot/cdboot.S Sun Aug 5 14:48:55 2012 (r239069) @@ -30,14 +30,14 @@ # $FreeBSD$ -#include - # # Basically, we first create a set of boot arguments to pass to the loaded # binary. Then we attempt to load /boot/loader from the CD we were booted # off of. # +#include + # # Memory locations. # Modified: head/sys/boot/pc98/libpc98/Makefile ============================================================================== --- head/sys/boot/pc98/libpc98/Makefile Sun Aug 5 14:48:28 2012 (r239068) +++ head/sys/boot/pc98/libpc98/Makefile Sun Aug 5 14:48:55 2012 (r239069) @@ -37,7 +37,8 @@ CFLAGS+= -DTERM_EMU # XXX: make alloca() useable CFLAGS+= -Dalloca=__builtin_alloca -CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../btx/lib \ +CFLAGS+= -I${.CURDIR}/../../common \ + -I${.CURDIR}/../btx/lib \ -I${.CURDIR}/../../i386/libi386 \ -I${.CURDIR}/../../.. -I. # the location of libstand From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 15:40:17 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7B585106566C; Sun, 5 Aug 2012 15:40:17 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 650E18FC16; Sun, 5 Aug 2012 15:40:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q75FeH4F098411; Sun, 5 Aug 2012 15:40:17 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75FeHfR098408; Sun, 5 Aug 2012 15:40:17 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201208051540.q75FeHfR098408@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sun, 5 Aug 2012 15:40:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239070 - head/tools/tools/bootparttest X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 15:40:17 -0000 Author: ae Date: Sun Aug 5 15:40:16 2012 New Revision: 239070 URL: http://svn.freebsd.org/changeset/base/239070 Log: Add simple test program that uses the partition tables handling code. It is useful to test and debug how boot loader handles partition tables metadata. Added: head/tools/tools/bootparttest/ head/tools/tools/bootparttest/Makefile (contents, props changed) head/tools/tools/bootparttest/bootparttest.c (contents, props changed) head/tools/tools/bootparttest/malloc.c (contents, props changed) Added: head/tools/tools/bootparttest/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/bootparttest/Makefile Sun Aug 5 15:40:16 2012 (r239070) @@ -0,0 +1,19 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../../sys/boot/common + +BINDIR?= /usr/bin + +PROG= bootparttest +NO_MAN= + +SRCS= bootparttest.c crc32.c malloc.c part.c + +CFLAGS= -I${.CURDIR}/../../../sys/boot/common -I. \ + -DLOADER_GPT_SUPPORT -DLOADER_MBR_SUPPORT -DPART_DEBUG + +DPADD+= ${LIBGEOM} ${LIBUTIL} +LDADD+= ${LIBGEOM} ${LIBUTIL} +LDFLAGS+= -lgeom -lutil + +.include Added: head/tools/tools/bootparttest/bootparttest.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/bootparttest/bootparttest.c Sun Aug 5 15:40:16 2012 (r239070) @@ -0,0 +1,172 @@ +/*- + * Copyright (c) 2012 Andrey V. Elsukov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +struct disk { + const char *name; + uint64_t mediasize; + uint16_t sectorsize; + + int fd; + int file; + off_t offset; +}; + +static int +diskread(void *arg, void *buf, size_t blocks, off_t offset) +{ + struct disk *dp; + + dp = (struct disk *)arg; + printf("%s: read %d blocks from the offset %jd\n", dp->name, + blocks, offset); + if (offset >= dp->mediasize / dp->sectorsize) + return (-1); + + return (pread(dp->fd, buf, blocks * dp->sectorsize, + (offset + dp->offset) * dp->sectorsize) != blocks * dp->sectorsize); +} + +static const char* +ptable_type2str(const struct ptable *table) +{ + + switch (ptable_gettype(table)) { + case PTABLE_NONE: + return ("None"); + case PTABLE_BSD: + return ("BSD"); + case PTABLE_MBR: + return ("MBR"); + case PTABLE_GPT: + return ("GPT"); + case PTABLE_VTOC8: + return ("VTOC8"); + }; + return ("Unknown"); +} + +#define PWIDTH 35 +static void +ptable_print(void *arg, const char *pname, const struct ptable_entry *part) +{ + struct ptable *table; + struct disk *dp, bsd; + char line[80], size[6]; + + dp = (struct disk *)arg; + sprintf(line, " %s%s: %s", dp->file ? "disk0": dp->name, pname, + parttype2str(part->type)); + humanize_number(size, sizeof(size), + (part->end - part->start + 1) * dp->sectorsize, "", + HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL); + printf("%-*s%s\n", PWIDTH, line, size); + if (part->type == PART_FREEBSD) { + sprintf(line, "%s%s", dp->file ? "disk0": dp->name, pname); + bsd.name = line; + bsd.fd = dp->fd; + bsd.file = 0; /* to use dp->name in the next sprintf */ + bsd.offset = dp->offset + part->start; + bsd.sectorsize = dp->sectorsize; + bsd.mediasize = (part->end - part->start + 1) * dp->sectorsize; + table = ptable_open(&bsd, bsd.mediasize / bsd.sectorsize, + bsd.sectorsize, diskread); + if (table == NULL) + return; + ptable_iterate(table, &bsd, ptable_print); + ptable_close(table); + } +} +#undef PWIDTH + +static void +inspect_disk(struct disk *dp) +{ + struct ptable *table; + + table = ptable_open(dp, dp->mediasize / dp->sectorsize, + dp->sectorsize, diskread); + if (table == NULL) { + printf("ptable_open failed\n"); + return; + } + printf("Partition table detected: %s\n", ptable_type2str(table)); + ptable_iterate(table, dp, ptable_print); + ptable_close(table); +} + +int +main(int argc, char **argv) +{ + struct stat sb; + struct disk d; + + if (argc < 2) + errx(1, "Usage: %s | " + "", argv[0]); + d.name = argv[1]; + if (stat(d.name, &sb) == 0 && S_ISREG(sb.st_mode)) { + d.fd = open(d.name, O_RDONLY); + if (d.fd < 0) + err(1, "open %s", d.name); + d.mediasize = sb.st_size; + d.sectorsize = 512; + d.file = 1; + } else { + d.fd = g_open(d.name, 0); + if (d.fd < 0) + err(1, "g_open %s", d.name); + d.mediasize = g_mediasize(d.fd); + d.sectorsize = g_sectorsize(d.fd); + d.file = 0; + } + d.offset = 0; + printf("%s \"%s\" opened\n", d.file ? "Disk image": "GEOM provider", + d.name); + printf("Mediasize: %ju Bytes (%ju sectors)\nSectorsize: %u Bytes\n", + d.mediasize, d.mediasize / d.sectorsize, d.sectorsize); + + inspect_disk(&d); + + if (d.file) + close(d.fd); + else + g_close(d.fd); + return (0); +} Added: head/tools/tools/bootparttest/malloc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/bootparttest/malloc.c Sun Aug 5 15:40:16 2012 (r239070) @@ -0,0 +1,44 @@ +/*- + * Copyright (c) 2012 Andrey V. Elsukov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +void* +Malloc(size_t size, const char *file, int line) +{ + + return (malloc(size)); +} + +void +Free(void *ptr, const char *file, int line) +{ + + return (free(ptr)); +} From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 15:55:37 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 66FF11065672; Sun, 5 Aug 2012 15:55:37 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 50F788FC18; Sun, 5 Aug 2012 15:55:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q75FtbVd099803; Sun, 5 Aug 2012 15:55:37 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75Ftbaa099801; Sun, 5 Aug 2012 15:55:37 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201208051555.q75Ftbaa099801@svn.freebsd.org> From: Dimitry Andric Date: Sun, 5 Aug 2012 15:55:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239071 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 15:55:37 -0000 Author: dim Date: Sun Aug 5 15:55:36 2012 New Revision: 239071 URL: http://svn.freebsd.org/changeset/base/239071 Log: In usr.bin/make/var.c, function ParseModifier(), initialize the 'error' variable to NULL, to avoid using it uninitialized in certain cases. This fixes the following clang 3.2 warning: usr.bin/make/var.c:1770:10: error: variable 'error' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] if (vp->execute) { ^~~~~~~~~~~ usr.bin/make/var.c:1777:10: note: uninitialized use occurs here if (error) ^~~~~ usr.bin/make/var.c:1770:6: note: remove the 'if' if its condition is always true if (vp->execute) { ^~~~~~~~~~~~~~~~~ usr.bin/make/var.c:1768:23: note: initialize the variable 'error' to silence this warning const char *error; ^ = NULL MFC after: 1 week Modified: head/usr.bin/make/var.c Modified: head/usr.bin/make/var.c ============================================================================== --- head/usr.bin/make/var.c Sun Aug 5 15:40:16 2012 (r239070) +++ head/usr.bin/make/var.c Sun Aug 5 15:55:36 2012 (r239071) @@ -1765,7 +1765,7 @@ ParseModifier(VarParser *vp, char startc if ((vp->ptr[0] == 's') && (vp->ptr[1] == 'h') && (vp->ptr[2] == endc || vp->ptr[2] == ':')) { - const char *error; + const char *error = NULL; if (vp->execute) { newStr = Buf_Peel( From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 16:59:03 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3E4501065676; Sun, 5 Aug 2012 16:59:03 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A0C88FC17; Sun, 5 Aug 2012 16:59: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 q75Gx3IG004988; Sun, 5 Aug 2012 16:59:03 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75Gx26M004986; Sun, 5 Aug 2012 16:59:02 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201208051659.q75Gx26M004986@svn.freebsd.org> From: Alan Cox Date: Sun, 5 Aug 2012 16:59:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239072 - head/sys/amd64/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 16:59:03 -0000 Author: alc Date: Sun Aug 5 16:59:02 2012 New Revision: 239072 URL: http://svn.freebsd.org/changeset/base/239072 Log: Shave off a few more cycles from the average execution time of pmap_enter() by simplifying the control flow and reducing the live range of "om". Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sun Aug 5 15:55:36 2012 (r239071) +++ head/sys/amd64/amd64/pmap.c Sun Aug 5 16:59:02 2012 (r239072) @@ -3468,7 +3468,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, newpte |= PG_G; newpte |= pmap_cache_bits(m->md.pat_mode, 0); - mpte = om = NULL; + mpte = NULL; lock = NULL; rw_rlock(&pvh_global_lock); @@ -3540,12 +3540,6 @@ retry: if (((origpte ^ newpte) & ~(PG_M | PG_A)) == 0) goto unchanged; goto validate; - } else { - /* - * Yes, fall through to validate the new mapping. - */ - if ((origpte & PG_MANAGED) != 0) - om = PHYS_TO_VM_PAGE(opa); } } else { /* @@ -3578,6 +3572,7 @@ validate: opa = origpte & PG_FRAME; if (opa != pa) { if ((origpte & PG_MANAGED) != 0) { + om = PHYS_TO_VM_PAGE(opa); if ((origpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(om); From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 17:04:59 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1231C1065670; Sun, 5 Aug 2012 17:04:59 +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 F10188FC12; Sun, 5 Aug 2012 17:04:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q75H4wdP005484; Sun, 5 Aug 2012 17:04:58 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75H4wB6005480; Sun, 5 Aug 2012 17:04:58 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201208051704.q75H4wB6005480@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sun, 5 Aug 2012 17:04:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239073 - in head/sys/boot/userboot: . test userboot X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 17:04:59 -0000 Author: ae Date: Sun Aug 5 17:04:58 2012 New Revision: 239073 URL: http://svn.freebsd.org/changeset/base/239073 Log: Bump USERBOOT_VERSION. Requested by: dfr Modified: head/sys/boot/userboot/test/test.c head/sys/boot/userboot/userboot.h head/sys/boot/userboot/userboot/main.c Modified: head/sys/boot/userboot/test/test.c ============================================================================== --- head/sys/boot/userboot/test/test.c Sun Aug 5 16:59:02 2012 (r239072) +++ head/sys/boot/userboot/test/test.c Sun Aug 5 17:04:58 2012 (r239073) @@ -450,5 +450,5 @@ main(int argc, char** argv) term.c_lflag &= ~(ICANON|ECHO); tcsetattr(0, TCSAFLUSH, &term); - func(&cb, NULL, USERBOOT_VERSION_1, disk_fd >= 0); + func(&cb, NULL, USERBOOT_VERSION_2, disk_fd >= 0); } Modified: head/sys/boot/userboot/userboot.h ============================================================================== --- head/sys/boot/userboot/userboot.h Sun Aug 5 16:59:02 2012 (r239072) +++ head/sys/boot/userboot/userboot.h Sun Aug 5 17:04:58 2012 (r239073) @@ -30,6 +30,7 @@ * USERBOOT interface versions */ #define USERBOOT_VERSION_1 1 +#define USERBOOT_VERSION_2 2 /* * Exit codes from the loader Modified: head/sys/boot/userboot/userboot/main.c ============================================================================== --- head/sys/boot/userboot/userboot/main.c Sun Aug 5 16:59:02 2012 (r239072) +++ head/sys/boot/userboot/userboot/main.c Sun Aug 5 17:04:58 2012 (r239073) @@ -36,6 +36,8 @@ __FBSDID("$FreeBSD$"); #include "disk.h" #include "libuserboot.h" +#define USERBOOT_VERSION USERBOOT_VERSION_2 + struct loader_callbacks_v1 *callbacks; void *callbacks_arg; @@ -70,7 +72,7 @@ loader_main(struct loader_callbacks_v1 * static char malloc[512*1024]; int i; - if (version != USERBOOT_VERSION_1) + if (version != USERBOOT_VERSION) abort(); callbacks = cb; From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 17:23:47 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BB46D106564A; Sun, 5 Aug 2012 17:23:47 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8CBA68FC08; Sun, 5 Aug 2012 17:23: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 q75HNlhT006963; Sun, 5 Aug 2012 17:23:47 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75HNl80006961; Sun, 5 Aug 2012 17:23:47 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201208051723.q75HNl80006961@svn.freebsd.org> From: Dimitry Andric Date: Sun, 5 Aug 2012 17:23:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239074 - head/usr.sbin/ctladm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 17:23:47 -0000 Author: dim Date: Sun Aug 5 17:23:47 2012 New Revision: 239074 URL: http://svn.freebsd.org/changeset/base/239074 Log: In usr.sbin/ctladm/ctladm.c, function cctl_error_inject(), initialize the 'retval' variable to zero, to avoid returning garbage in several cases. This fixes the following clang 3.2 warnings: usr.sbin/ctladm/ctladm.c:1234:6: error: variable 'retval' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] if (ioctl(fd, CTL_ERROR_INJECT, &err_desc) == -1) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ usr.sbin/ctladm/ctladm.c:1243:10: note: uninitialized use occurs here return (retval); ^~~~~~ usr.sbin/ctladm/ctladm.c:1234:2: note: remove the 'if' if its condition is always true if (ioctl(fd, CTL_ERROR_INJECT, &err_desc) == -1) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ usr.sbin/ctladm/ctladm.c:1161:7: error: variable 'retval' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] if (ioctl(fd, CTL_ERROR_INJECT_DELETE, &err_desc) == -1) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ usr.sbin/ctladm/ctladm.c:1243:10: note: uninitialized use occurs here return (retval); ^~~~~~ usr.sbin/ctladm/ctladm.c:1161:3: note: remove the 'if' if its condition is always true if (ioctl(fd, CTL_ERROR_INJECT_DELETE, &err_desc) == -1) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ usr.sbin/ctladm/ctladm.c:1029:12: note: initialize the variable 'retval' to silence this warning int retval; ^ = 0 MFC after: 1 week Modified: head/usr.sbin/ctladm/ctladm.c Modified: head/usr.sbin/ctladm/ctladm.c ============================================================================== --- head/usr.sbin/ctladm/ctladm.c Sun Aug 5 17:04:58 2012 (r239073) +++ head/usr.sbin/ctladm/ctladm.c Sun Aug 5 17:23:47 2012 (r239074) @@ -1026,7 +1026,7 @@ static int cctl_error_inject(int fd, uint32_t target, uint32_t lun, int argc, char **argv, char *combinedopt) { - int retval; + int retval = 0; struct ctl_error_desc err_desc; uint64_t lba = 0; uint32_t len = 0; From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 17:30:18 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4A16A106568F; Sun, 5 Aug 2012 17:30:18 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3568F8FC18; Sun, 5 Aug 2012 17:30:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q75HUIsU007506; Sun, 5 Aug 2012 17:30:18 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75HUIBM007503; Sun, 5 Aug 2012 17:30:18 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201208051730.q75HUIBM007503@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 5 Aug 2012 17:30:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239075 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 17:30:18 -0000 Author: trociny Date: Sun Aug 5 17:30:17 2012 New Revision: 239075 URL: http://svn.freebsd.org/changeset/base/239075 Log: In tcp timers, check INP_DROPPED flag a little later, after callout_deactivate(), so if INP_DROPPED is set we return with the timer active flag cleared. For me this fixes negative keep timer values reported by `netstat -x' for connections in CLOSE state. Approved by: net (silence) MFC after: 2 weeks Modified: head/sys/netinet/tcp_timer.c Modified: head/sys/netinet/tcp_timer.c ============================================================================== --- head/sys/netinet/tcp_timer.c Sun Aug 5 17:23:47 2012 (r239074) +++ head/sys/netinet/tcp_timer.c Sun Aug 5 17:30:17 2012 (r239075) @@ -183,13 +183,18 @@ tcp_timer_delack(void *xtp) return; } INP_WLOCK(inp); - if ((inp->inp_flags & INP_DROPPED) || callout_pending(&tp->t_timers->tt_delack) - || !callout_active(&tp->t_timers->tt_delack)) { + if (callout_pending(&tp->t_timers->tt_delack) || + !callout_active(&tp->t_timers->tt_delack)) { INP_WUNLOCK(inp); CURVNET_RESTORE(); return; } callout_deactivate(&tp->t_timers->tt_delack); + if ((inp->inp_flags & INP_DROPPED) != 0) { + INP_WUNLOCK(inp); + CURVNET_RESTORE(); + return; + } tp->t_flags |= TF_ACKNOW; TCPSTAT_INC(tcps_delack); @@ -229,7 +234,7 @@ tcp_timer_2msl(void *xtp) } INP_WLOCK(inp); tcp_free_sackholes(tp); - if ((inp->inp_flags & INP_DROPPED) || callout_pending(&tp->t_timers->tt_2msl) || + if (callout_pending(&tp->t_timers->tt_2msl) || !callout_active(&tp->t_timers->tt_2msl)) { INP_WUNLOCK(tp->t_inpcb); INP_INFO_WUNLOCK(&V_tcbinfo); @@ -237,6 +242,12 @@ tcp_timer_2msl(void *xtp) return; } callout_deactivate(&tp->t_timers->tt_2msl); + if ((inp->inp_flags & INP_DROPPED) != 0) { + INP_WUNLOCK(inp); + INP_INFO_WUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); + return; + } /* * 2 MSL timeout in shutdown went off. If we're closed but * still waiting for peer to close and connection has been idle @@ -300,14 +311,20 @@ tcp_timer_keep(void *xtp) return; } INP_WLOCK(inp); - if ((inp->inp_flags & INP_DROPPED) || callout_pending(&tp->t_timers->tt_keep) - || !callout_active(&tp->t_timers->tt_keep)) { + if (callout_pending(&tp->t_timers->tt_keep) || + !callout_active(&tp->t_timers->tt_keep)) { INP_WUNLOCK(inp); INP_INFO_WUNLOCK(&V_tcbinfo); CURVNET_RESTORE(); return; } callout_deactivate(&tp->t_timers->tt_keep); + if ((inp->inp_flags & INP_DROPPED) != 0) { + INP_WUNLOCK(inp); + INP_INFO_WUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); + return; + } /* * Keep-alive timer went off; send something * or drop connection if idle for too long. @@ -397,14 +414,20 @@ tcp_timer_persist(void *xtp) return; } INP_WLOCK(inp); - if ((inp->inp_flags & INP_DROPPED) || callout_pending(&tp->t_timers->tt_persist) - || !callout_active(&tp->t_timers->tt_persist)) { + if (callout_pending(&tp->t_timers->tt_persist) || + !callout_active(&tp->t_timers->tt_persist)) { INP_WUNLOCK(inp); INP_INFO_WUNLOCK(&V_tcbinfo); CURVNET_RESTORE(); return; } callout_deactivate(&tp->t_timers->tt_persist); + if ((inp->inp_flags & INP_DROPPED) != 0) { + INP_WUNLOCK(inp); + INP_INFO_WUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); + return; + } /* * Persistance timer into zero window. * Force a byte to be output, if possible. @@ -469,14 +492,20 @@ tcp_timer_rexmt(void * xtp) return; } INP_WLOCK(inp); - if ((inp->inp_flags & INP_DROPPED) || callout_pending(&tp->t_timers->tt_rexmt) - || !callout_active(&tp->t_timers->tt_rexmt)) { + if (callout_pending(&tp->t_timers->tt_rexmt) || + !callout_active(&tp->t_timers->tt_rexmt)) { INP_WUNLOCK(inp); INP_INFO_RUNLOCK(&V_tcbinfo); CURVNET_RESTORE(); return; } callout_deactivate(&tp->t_timers->tt_rexmt); + if ((inp->inp_flags & INP_DROPPED) != 0) { + INP_WUNLOCK(inp); + INP_INFO_RUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); + return; + } tcp_free_sackholes(tp); /* * Retransmission timer went off. Message has not From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 17:53:58 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C59031065670; Sun, 5 Aug 2012 17:53:58 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) by mx1.freebsd.org (Postfix) with ESMTP id 9EC3A8FC15; Sun, 5 Aug 2012 17:53:58 +0000 (UTC) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.5/8.14.5) with ESMTP id q75Hrw9v050033; Sun, 5 Aug 2012 10:53:58 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.5/8.14.5/Submit) id q75HrwxT050032; Sun, 5 Aug 2012 10:53:58 -0700 (PDT) (envelope-from sgk) Date: Sun, 5 Aug 2012 10:53:57 -0700 From: Steve Kargl To: Dimitry Andric Message-ID: <20120805175357.GA50024@troutmask.apl.washington.edu> References: <201208051723.q75HNl80006961@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201208051723.q75HNl80006961@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r239074 - head/usr.sbin/ctladm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 17:53:58 -0000 On Sun, Aug 05, 2012 at 05:23:47PM +0000, Dimitry Andric wrote: > Author: dim > Date: Sun Aug 5 17:23:47 2012 > New Revision: 239074 > URL: http://svn.freebsd.org/changeset/base/239074 > > Log: > In usr.sbin/ctladm/ctladm.c, function cctl_error_inject(), initialize > the 'retval' variable to zero, to avoid returning garbage in several > cases. > > This fixes the following clang 3.2 warnings: > > usr.sbin/ctladm/ctladm.c:1234:6: error: variable 'retval' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] > if (ioctl(fd, CTL_ERROR_INJECT, &err_desc) == -1) { > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Dimitry can you wrap these long error messages to something shorter than 80 characters. The commit messages are otherwise pain to read. -- Steve From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 19:37:19 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A245F106566C; Sun, 5 Aug 2012 19:37:19 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8BAF28FC1C; Sun, 5 Aug 2012 19:37: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 q75JbJwK018912; Sun, 5 Aug 2012 19:37:19 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75JbJ1N018910; Sun, 5 Aug 2012 19:37:19 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201208051937.q75JbJ1N018910@svn.freebsd.org> From: Eitan Adler Date: Sun, 5 Aug 2012 19:37:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239076 - head/sys/dev/puc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 19:37:19 -0000 Author: eadler Date: Sun Aug 5 19:37:18 2012 New Revision: 239076 URL: http://svn.freebsd.org/changeset/base/239076 Log: Add support for SIIG Cyber Serial Dual PCI 16C850 Submitted by: David Boyd David.Boyd@insightbb.com Approved by: cperciva MFC after: 3 days Modified: head/sys/dev/puc/pucdata.c Modified: head/sys/dev/puc/pucdata.c ============================================================================== --- head/sys/dev/puc/pucdata.c Sun Aug 5 17:30:17 2012 (r239075) +++ head/sys/dev/puc/pucdata.c Sun Aug 5 19:37:18 2012 (r239076) @@ -737,6 +737,12 @@ const struct puc_cfg puc_pci_devices[] = PUC_PORT_2S, 0x10, 0, 8, }, + { 0x1415, 0x950a, 0x131f, 0x2032, + "SIIG Cyber Serial Dual PCI 16C850", + DEFAULT_RCLK * 10, + PUC_PORT_4S, 0x10, 0, 8, + }, + { 0x1415, 0x950a, 0xffff, 0, "Oxford Semiconductor OX16PCI954 UARTs", DEFAULT_RCLK, From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 20:19:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E546106564A; Sun, 5 Aug 2012 20:19:28 +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 488958FC08; Sun, 5 Aug 2012 20:19:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q75KJSQ4022378; Sun, 5 Aug 2012 20:19:28 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75KJSkY022376; Sun, 5 Aug 2012 20:19:28 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201208052019.q75KJSkY022376@svn.freebsd.org> From: Marius Strobl Date: Sun, 5 Aug 2012 20:19:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239077 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 20:19:28 -0000 Author: marius Date: Sun Aug 5 20:19:27 2012 New Revision: 239077 URL: http://svn.freebsd.org/changeset/base/239077 Log: Include for PA_LOCK_COUNT in order to fix kernel build with options ZFS after r239065. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Aug 5 19:37:18 2012 (r239076) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Aug 5 20:19:27 2012 (r239077) @@ -71,6 +71,7 @@ #include #include #include +#include #include /* From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 20:25:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F250B106566B; Sun, 5 Aug 2012 20:25:45 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 6BC898FC15; Sun, 5 Aug 2012 20:25:44 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q75KPrSq051500; Sun, 5 Aug 2012 23:25:53 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q75KPe9j022068; Sun, 5 Aug 2012 23:25:40 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q75KPeBC022067; Sun, 5 Aug 2012 23:25:40 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 5 Aug 2012 23:25:40 +0300 From: Konstantin Belousov To: Marius Strobl Message-ID: <20120805202540.GH2676@deviant.kiev.zoral.com.ua> References: <201208052019.q75KJSkY022376@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="lK6omsT1+wE+jTTc" Content-Disposition: inline In-Reply-To: <201208052019.q75KJSkY022376@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r239077 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 20:25:46 -0000 --lK6omsT1+wE+jTTc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Aug 05, 2012 at 08:19:28PM +0000, Marius Strobl wrote: > Author: marius > Date: Sun Aug 5 20:19:27 2012 > New Revision: 239077 > URL: http://svn.freebsd.org/changeset/base/239077 >=20 > Log: > Include for PA_LOCK_COUNT in order to fix kernel build > with options ZFS after r239065. Thank you for catching this. But, this means that we do not have any LINT file which build ZFS statically ? Would it make sense to add zfs somewhere ? Even if only for sparc64 ? --lK6omsT1+wE+jTTc Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAlAe1sQACgkQC3+MBN1Mb4i6bgCfUkWRb2DPiGamAx/ViIQPGvWY GGsAmwRKrAFe+mSM5Cx/vmKapeToCrur =i3r9 -----END PGP SIGNATURE----- --lK6omsT1+wE+jTTc-- From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 20:52:54 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 634E4106566B; Sun, 5 Aug 2012 20:52:54 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id EB2B58FC17; Sun, 5 Aug 2012 20:52:53 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id q75KqkZA058683; Sun, 5 Aug 2012 22:52:46 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id q75KqkRt058682; Sun, 5 Aug 2012 22:52:46 +0200 (CEST) (envelope-from marius) Date: Sun, 5 Aug 2012 22:52:46 +0200 From: Marius Strobl To: Konstantin Belousov Message-ID: <20120805205246.GW58433@alchemy.franken.de> References: <201208052019.q75KJSkY022376@svn.freebsd.org> <20120805202540.GH2676@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120805202540.GH2676@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r239077 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 20:52:54 -0000 On Sun, Aug 05, 2012 at 11:25:40PM +0300, Konstantin Belousov wrote: > On Sun, Aug 05, 2012 at 08:19:28PM +0000, Marius Strobl wrote: > > Author: marius > > Date: Sun Aug 5 20:19:27 2012 > > New Revision: 239077 > > URL: http://svn.freebsd.org/changeset/base/239077 > > > > Log: > > Include for PA_LOCK_COUNT in order to fix kernel build > > with options ZFS after r239065. > > Thank you for catching this. > But, this means that we do not have any LINT file which build ZFS > statically ? > > Would it make sense to add zfs somewhere ? Even if only for sparc64 ? Bascially, "options ZFS" is available on at least amd64, i386, pc98, powerpc64 and sparc64. At least for me it's handy in development as I don't have to additionally copy around modules that are in sync with testing kernels. I tried to add that option to all MD NOTES files except powerpc (powerpc and powerpc64 share one NOTES but ZFS only works on powerpc64 due to lack of 64-bit atomic operations on powerpc). However, this causes linking the kernel to fail due to some symbols being defined multiple times: linking kernel inflate.o: In function `z_inflateReset': inflate.c:(.text+0x0): multiple definition of `z_inflateReset' inflate.o:inflate.c:(.text+0x0): first defined here inflate.o: In function `inflatePrime': inflate.c:(.text+0xb0): multiple definition of `inflatePrime' inflate.o:inflate.c:(.text+0xb0): first defined here <...> zlib.o: In function `_tr_tally': zlib.c:(.text+0xc70): multiple definition of `_tr_tally' trees.o:trees.c:(.text+0x910): first defined here zlib.o: In function `_tr_init': zlib.c:(.text+0x17b0): multiple definition of `_tr_init' trees.o:trees.c:(.text+0x13e0): first defined here zlib.o: In function `_tr_align': zlib.c:(.text+0x1a90): multiple definition of `_tr_align' trees.o:trees.c:(.text+0x16f0): first defined here <...> and so on ... I currently can't remember the details but the fix seemed non-trivial to me, short of creating something like LINT-ZFS kernel config files similar to the LINT-VIMAGE etc we have. But generally, yes, building LINT kernels with static ZFS would be great, especially as this wasn't the first time it had been broken. Marius From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 21:13:22 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0FBEA106564A; Sun, 5 Aug 2012 21:13:22 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E59718FC0A; Sun, 5 Aug 2012 21:13: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 q75LDLVc027297; Sun, 5 Aug 2012 21:13:21 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75LDLF1027294; Sun, 5 Aug 2012 21:13:21 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201208052113.q75LDLF1027294@svn.freebsd.org> From: Eitan Adler Date: Sun, 5 Aug 2012 21:13:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239078 - head/usr.sbin/portsnap/portsnap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 21:13:22 -0000 Author: eadler Date: Sun Aug 5 21:13:21 2012 New Revision: 239078 URL: http://svn.freebsd.org/changeset/base/239078 Log: Add interactive option to override portsnap's automagical detection of a terminal. Submitted by: Hannes h2+fbsdports@fsfe.org Approved by: cperciva MFC after: 1 week Modified: head/usr.sbin/portsnap/portsnap/portsnap.8 head/usr.sbin/portsnap/portsnap/portsnap.sh Modified: head/usr.sbin/portsnap/portsnap/portsnap.8 ============================================================================== --- head/usr.sbin/portsnap/portsnap/portsnap.8 Sun Aug 5 20:19:27 2012 (r239077) +++ head/usr.sbin/portsnap/portsnap/portsnap.8 Sun Aug 5 21:13:21 2012 (r239078) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 15, 2008 +.Dd August 5, 2012 .Dt PORTSNAP 8 .Os FreeBSD .Sh NAME @@ -110,6 +110,12 @@ command only, operate only on parts of t .Ar sysutils/port would extract sysutils/portsman, sysutils/portsnap, sysutils/portupgrade, etc.) +.It Fl Fl interactive +override auto-detection of calling process. +Only use this when calling portsnap from an +.Sy interactive, non-terminal application. +(Cron jobs are particularly bad since they cause +load spikes on the Portsnap mirrors.) .El .Sh COMMANDS The Modified: head/usr.sbin/portsnap/portsnap/portsnap.sh ============================================================================== --- head/usr.sbin/portsnap/portsnap/portsnap.sh Sun Aug 5 20:19:27 2012 (r239077) +++ head/usr.sbin/portsnap/portsnap/portsnap.sh Sun Aug 5 21:13:21 2012 (r239078) @@ -48,6 +48,9 @@ Options: (default: /usr/ports/) -s server -- Server from which to fetch updates. (default: portsnap.FreeBSD.org) + --interactive -- interactive: override auto-detection of calling process + (use this when calling portsnap from an interactive, non- + terminal application AND NEVER ELSE). path -- Extract only parts of the tree starting with the given string. (extract command only) Commands: @@ -84,6 +87,7 @@ init_params() { SERVERNAME="" REFUSE="" LOCALDESC="" + INTERACTIVE="" } # Parse the command line @@ -103,6 +107,9 @@ parse_cmdline() { XARGST="-t" DDSTATS=".." ;; + --interactive) + INTERACTIVE="YES" + ;; -f) if [ $# -eq 1 ]; then usage; fi if [ ! -z "${CONFFILE}" ]; then usage; fi @@ -228,6 +235,13 @@ default_params() { eval ${X}=${__} fi done + if [ -z "${INTERACTIVE}" ]; then + if [ -t 0 ]; then + INTERACTIVE="YES" + else + INTERACTIVE="NO" + fi + fi } # Perform sanity checks and set some final parameters @@ -1023,10 +1037,10 @@ get_params() { # Fetch command. Make sure that we're being called # interactively, then run fetch_check_params and fetch_run cmd_fetch() { - if [ ! -t 0 ]; then + if [ "${INTERACTIVE}" != "YES" ]; then echo -n "`basename $0` fetch should not " echo "be run non-interactively." - echo "Run `basename $0` cron instead." + echo "Run `basename $0` cron instead" exit 1 fi fetch_check_params @@ -1069,7 +1083,7 @@ cmd_update() { # whether stdin is a terminal; then run 'update' or # 'extract' depending on whether ${PORTSDIR} exists. cmd_alfred() { - if [ -t 0 ]; then + if [ "${INTERACTIVE}" = "YES" ]; then cmd_fetch else cmd_cron From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 21:50:41 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 613A8106566B; Sun, 5 Aug 2012 21:50:41 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) by mx1.freebsd.org (Postfix) with ESMTP id 3D6AE8FC19; Sun, 5 Aug 2012 21:50:41 +0000 (UTC) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.5/8.14.5) with ESMTP id q75LoZuO050934; Sun, 5 Aug 2012 14:50:35 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.5/8.14.5/Submit) id q75LoZ4W050933; Sun, 5 Aug 2012 14:50:35 -0700 (PDT) (envelope-from sgk) Date: Sun, 5 Aug 2012 14:50:34 -0700 From: Steve Kargl To: Dimitry Andric Message-ID: <20120805215034.GA50893@troutmask.apl.washington.edu> References: <201208051555.q75Ftbaa099801@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201208051555.q75Ftbaa099801@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r239071 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 21:50:41 -0000 On Sun, Aug 05, 2012 at 03:55:37PM +0000, Dimitry Andric wrote: > Author: dim > Date: Sun Aug 5 15:55:36 2012 > New Revision: 239071 > URL: http://svn.freebsd.org/changeset/base/239071 > > Log: > In usr.bin/make/var.c, function ParseModifier(), initialize the 'error' > variable to NULL, to avoid using it uninitialized in certain cases. > > This fixes the following clang 3.2 warning: > > usr.bin/make/var.c:1770:10: error: variable 'error' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] > if (vp->execute) { > ^~~~~~~~~~~ Please wrap your commit messages to less than 80 characters. In fact, including the clang warning does not add any valuable information and should be omitted. -- Steve From owner-svn-src-head@FreeBSD.ORG Sun Aug 5 22:03:14 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3ED87106564A; Sun, 5 Aug 2012 22:03:14 +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 10AC08FC0C; Sun, 5 Aug 2012 22:03: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 q75M3D3X031427; Sun, 5 Aug 2012 22:03:13 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75M3DfU031424; Sun, 5 Aug 2012 22:03:13 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201208052203.q75M3DfU031424@svn.freebsd.org> From: Marius Strobl Date: Sun, 5 Aug 2012 22:03:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239079 - in head/sys/sparc64: include sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 22:03:14 -0000 Author: marius Date: Sun Aug 5 22:03:13 2012 New Revision: 239079 URL: http://svn.freebsd.org/changeset/base/239079 Log: Merge r236494 from x86: Isolate the global TTE list lock from data and other locks to prevent false sharing within the cache. MFC after: 3 days Modified: head/sys/sparc64/include/pmap.h head/sys/sparc64/sparc64/pmap.c Modified: head/sys/sparc64/include/pmap.h ============================================================================== --- head/sys/sparc64/include/pmap.h Sun Aug 5 21:13:21 2012 (r239078) +++ head/sys/sparc64/include/pmap.h Sun Aug 5 22:03:13 2012 (r239079) @@ -68,6 +68,11 @@ struct pmap { struct pmap_statistics pm_stats; }; +struct tte_list_lock { + struct rwlock lock; + char padding[CACHE_LINE_SIZE - sizeof(struct rwlock)]; +}; + #define PMAP_LOCK(pmap) mtx_lock(&(pmap)->pm_mtx) #define PMAP_LOCK_ASSERT(pmap, type) \ mtx_assert(&(pmap)->pm_mtx, (type)) @@ -103,7 +108,8 @@ void pmap_set_kctx(void); extern struct pmap kernel_pmap_store; #define kernel_pmap (&kernel_pmap_store) -extern struct rwlock tte_list_global_lock; +extern struct tte_list_lock tte_list_global; +#define tte_list_global_lock tte_list_global.lock extern vm_paddr_t phys_avail[]; extern vm_offset_t virtual_avail; extern vm_offset_t virtual_end; Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Sun Aug 5 21:13:21 2012 (r239078) +++ head/sys/sparc64/sparc64/pmap.c Sun Aug 5 22:03:13 2012 (r239079) @@ -135,9 +135,11 @@ vm_offset_t vm_max_kernel_address; struct pmap kernel_pmap_store; /* - * Global tte list lock + * Isolate the global TTE list lock from data and other locks to prevent + * false sharing within the cache (see also the declaration of struct + * tte_list_lock). */ -struct rwlock tte_list_global_lock; +struct tte_list_lock tte_list_global __aligned(CACHE_LINE_SIZE); /* * Allocate physical memory for use in pmap_bootstrap. @@ -672,7 +674,7 @@ pmap_bootstrap(u_int cpu_impl) pm->pm_context[i] = TLB_CTX_KERNEL; CPU_FILL(&pm->pm_active); - /* + /* * Initialize the global tte list lock, which is more commonly * known as the pmap pv global lock. */ From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 05:27:27 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84330106566C; Mon, 6 Aug 2012 05:27:27 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5567D8FC0A; Mon, 6 Aug 2012 05:27:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q765RRtZ091309; Mon, 6 Aug 2012 05:27:27 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q765RRUm091306; Mon, 6 Aug 2012 05:27:27 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201208060527.q765RRUm091306@svn.freebsd.org> From: Xin LI Date: Mon, 6 Aug 2012 05:27:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239084 - in head: share/man/man4 sys/dev/hptiop X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 05:27:27 -0000 Author: delphij Date: Mon Aug 6 05:27:26 2012 New Revision: 239084 URL: http://svn.freebsd.org/changeset/base/239084 Log: Add PCI IDs for various new High Point RocketRAID 43xx and 3xxx devices. Obtained from: FreeNAS MFC after: 3 days Modified: head/share/man/man4/hptiop.4 head/sys/dev/hptiop/hptiop.c Modified: head/share/man/man4/hptiop.4 ============================================================================== --- head/share/man/man4/hptiop.4 Mon Aug 6 00:36:07 2012 (r239083) +++ head/share/man/man4/hptiop.4 Mon Aug 6 05:27:26 2012 (r239084) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 1, 2011 +.Dd August 5, 2012 .Dt HPTIOP 4 .Os .Sh NAME @@ -58,34 +58,46 @@ driver supports the following SAS and SA .Pp .Bl -bullet -compact .It -HighPoint RocketRAID 4320 +HighPoint RocketRAID 4322 .It HighPoint RocketRAID 4321 .It -HighPoint RocketRAID 4322 +HighPoint RocketRAID 4320 .It -HighPoint RocketRAID 3220 +HighPoint RocketRAID 4311 .It -HighPoint RocketRAID 3320 +HighPoint RocketRAID 4310 .It -HighPoint RocketRAID 3410 +HighPoint RocketRAID 4211 .It -HighPoint RocketRAID 3520 +HighPoint RocketRAID 4210 .It -HighPoint RocketRAID 3510 +HighPoint RocketRAID 3560 .It -HighPoint RocketRAID 3511 +HighPoint RocketRAID 3540 .It -HighPoint RocketRAID 3521 +HighPoint RocketRAID 3530 .It HighPoint RocketRAID 3522 .It -HighPoint RocketRAID 3540 +HighPoint RocketRAID 3521 .It -HighPoint RocketRAID 3120 +HighPoint RocketRAID 3520 +.It +HighPoint RocketRAID 3511 +.It +HighPoint RocketRAID 3510 +.It +HighPoint RocketRAID 3410 +.It +HighPoint RocketRAID 3320 +.It +HighPoint RocketRAID 3220 .It HighPoint RocketRAID 3122 .It +HighPoint RocketRAID 3120 +.It HighPoint RocketRAID 3020 .El .Sh NOTES Modified: head/sys/dev/hptiop/hptiop.c ============================================================================== --- head/sys/dev/hptiop/hptiop.c Mon Aug 6 00:36:07 2012 (r239083) +++ head/sys/dev/hptiop/hptiop.c Mon Aug 6 05:27:26 2012 (r239084) @@ -1284,9 +1284,13 @@ static int hptiop_probe(device_t dev) id = pci_get_device(dev); switch (id) { - case 0x4322: - case 0x4321: + case 0x4210: + case 0x4211: + case 0x4310: + case 0x4311: case 0x4320: + case 0x4321: + case 0x4322: sas = 1; case 0x3220: case 0x3320: @@ -1296,12 +1300,14 @@ static int hptiop_probe(device_t dev) case 0x3511: case 0x3521: case 0x3522: + case 0x3530: case 0x3540: + case 0x3560: ops = &hptiop_itl_ops; break; + case 0x3020: case 0x3120: case 0x3122: - case 0x3020: ops = &hptiop_mv_ops; break; default: From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 07:08:37 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [69.147.83.53]) by hub.freebsd.org (Postfix) with ESMTP id E0EBE106564A; Mon, 6 Aug 2012 07:08:37 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from opti.dougb.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 2ACE314E8D8; Mon, 6 Aug 2012 07:08:37 +0000 (UTC) Message-ID: <501F6D74.9070409@FreeBSD.org> Date: Mon, 06 Aug 2012 00:08:36 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:14.0) Gecko/20120728 Thunderbird/14.0 MIME-Version: 1.0 To: Konstantin Belousov References: <201208011726.q71HQMPi079603@svn.freebsd.org> <20120801173240.GR2676@deviant.kiev.zoral.com.ua> In-Reply-To: <20120801173240.GR2676@deviant.kiev.zoral.com.ua> X-Enigmail-Version: 1.4.2 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238973 - head/sys/x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 07:08:38 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 08/01/2012 10:32, Konstantin Belousov wrote: > It should have been the text Forced commit? :) - -- I am only one, but I am one. I cannot do everything, but I can do something. And I will not let what I cannot do interfere with what I can do. -- Edward Everett Hale, (1822 - 1909) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAEBCAAGBQJQH210AAoJEFzGhvEaGryEQ/8H/jTrpM5C8TiyxU4A3wTieeUx 1IlDUpRaiLO65u6iWE2/NcxstL2QOnBHNmuIDSZ3MCDf7ytlH8XuDkEA0kj54zlK /evgsR4wP9us53lWtLPG4PUcKtjU0iZ10lP4iGENbdP/5pf/pbT1sZ7NDqeXajT/ RrwiIipgdCwZRqQ9MaU/3EUUH1gA40Y7Wohm6gRT0rFEBOHagjpIpOW1oPPmNSjE TJW30JDJXkccCn3BGjcPA93zhPcW1Hg+O6Ekr88gTp2SdGDgHhI6O27j/2zN/xgZ GjFHVlynA4p3a+e9sfi4j0b3jLVaoz5vyaWPJmeHfKpP02wxUL9l44AF/ErodpA= =GiTg -----END PGP SIGNATURE----- From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 07:24:37 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id E41E5106564A; Mon, 6 Aug 2012 07:24:36 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from opti.dougb.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 940F214E1CC; Mon, 6 Aug 2012 07:24:36 +0000 (UTC) Message-ID: <501F7134.9020200@FreeBSD.org> Date: Mon, 06 Aug 2012 00:24:36 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:14.0) Gecko/20120728 Thunderbird/14.0 MIME-Version: 1.0 To: Hiroki Sato References: <20120803.055554.1380323232583218022.hrs@allbsd.org> <501AF66A.8020804@FreeBSD.org> <20120803.125803.269418223701686293.hrs@allbsd.org> In-Reply-To: <20120803.125803.269418223701686293.hrs@allbsd.org> X-Enigmail-Version: 1.4.2 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, emax@FreeBSD.org Subject: Re: svn commit: r238622 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 07:24:37 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 08/02/2012 20:58, Hiroki Sato wrote: > Doug Barton wrote in > <501AF66A.8020804@FreeBSD.org>: > > do> On 8/2/2012 2:25 PM, Maksim Yevmenkin wrote: do> > On Thu, Aug > 2, 2012 at 1:55 PM, Hiroki Sato wrote: do> > do> > >> Just curious, why ip6addrctl_enable=NO is not enough here? do> > do> Because the behavior of the script for =NO is to prefer v4. > > No, when ip6addrctl_enable=NO the rc.d/ip6addtctl script will be > simply ignored. No rule will be installed in that case. I wondered about that, but the script has an explicit case for it. > do> >> I would do> >> like to eliminate yes/no/none keywords in > $ip6addrctl_policy because do> >> such keywords are vague. If we > need the empty rule for some reason, do> >> "empty" would be a > better name for the policy, I think. do> do> Personally I think > that the established meanings of "yes" and "no" are do> well > understood, but I wouldn't object to emitting a warning for them > to do> help the user make a more explicit selection. > > I do not think ip6addrctl_policy={yes|no} is meaningful. Aside from my argument that the script is poorly named, and the whole interface is badly designed ... I think users who would say "yes" here would expect that IPv6 would be preferred, and "no" to mean it would not be. That is in fact what happens now, so in that sense at least things seem to be meaningful. :) > do> While we're at it, the way that the current script replicates > the test do> for checkyesno in case is bogus, and should be > changed. I had fixed this do> in the change set that you(hrs) > backed out. To stick with the structure do> of the current script, > something like this would work: do> do> > http://people.freebsd.org/~dougb/ip6addrctl.diff do> do> That also > brings in the warning described above. > > I think additional warnings are not needed because a warning will > be displayed when ipv6_prefer={yes|no} is defined. I have no > objection to use checkyesno() itself to check if the variable is > defined as yes or no. There is a warning in the script already, I just made it consistent; and you were the one who suggested warnings for yes/no. But as you know I'm prohibited from making changes to that code, so you have my patch, do with it as you will. Doug - -- I am only one, but I am one. I cannot do everything, but I can do something. And I will not let what I cannot do interfere with what I can do. -- Edward Everett Hale, (1822 - 1909) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAEBCAAGBQJQH3E0AAoJEFzGhvEaGryENTMH/R6HW7J8+2BLJEwor+VyFWUH da9d+wrp7GSmBjY2dFko+6Z8A3McIqZDTJ9TdTKerilOMBpZkhT86ZUk1eOldBPp rMKmMcZlK5Z/8s6l1qGGAFbfX7MFq+qQU6d8xo730o5ldRmBQhhmgH0pAZOLF2Iv 4HI1njrJ56KUnDERh0LhrJ+A5n62JyO1ML/YgGFeU5qvDevomDygmrU+zWhTftLJ 0ACW1YVyK5d8Sg5J44s66nbjMeNk1PXpdVN0CA/n03bryoI39S7kLl1iVInQ99MA afK8UMV8TTbYd7KOlY091NaBny0K2U7LTY7iprMQ2cHE9DaXHewu3X4FFW9eXoY= =UNRQ -----END PGP SIGNATURE----- From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 07:49:31 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx2.freebsd.org (mx2.freebsd.org [69.147.83.53]) by hub.freebsd.org (Postfix) with ESMTP id 8A4F91065670; Mon, 6 Aug 2012 07:49:31 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from opti.dougb.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 77AA414E49B; Mon, 6 Aug 2012 07:49:30 +0000 (UTC) Message-ID: <501F7709.1080408@FreeBSD.org> Date: Mon, 06 Aug 2012 00:49:29 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:14.0) Gecko/20120728 Thunderbird/14.0 MIME-Version: 1.0 To: Hiroki Sato References: <20120803.124305.1981901625663633450.hrs@allbsd.org> <20120803042301.GA78461@zibbi.meraka.csir.co.za> <20120803.142847.874617321595545142.hrs@allbsd.org> In-Reply-To: <20120803.142847.874617321595545142.hrs@allbsd.org> X-Enigmail-Version: 1.4.2 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: jhay@meraka.org.za, svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, emax@FreeBSD.org Subject: Re: svn commit: r238622 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 07:49:31 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 08/02/2012 22:28, Hiroki Sato wrote: > John Hay wrote > in <20120803042301.GA78461@zibbi.meraka.csir.co.za>: > > jh> While you guys are here, may I add a request that we go back to prefering > jh> IPv6 when IPv6 addresses are enabled. That is the way it was from FBSD-4 > jh> up to FBSD-8. 9 is a big POLA here. Actually all that used to be needed was ipv6_enable. I modified the rc.d code for this prior to 9-release to make it compatible with the old knobs (aka, expected behavior), but hrs overruled me and installed his version instead. > jh> The world is past World IPv6 Launch > jh> and I think people expect that if they configure IPv6 addresses, that > jh> would be prefered. If you configure IPv6 addresses and do not want them > jh> prefered, you are the odd one out and should have to do something. I agree. My proposal was that if an interface is configured for IPv4 it should get the same treatment for IPv6. That is, if it's set up for DHCP in IPv4 then it should automatically do SLAAC/RA in IPv6; and if it's statically configured in v4, the user should have to configure it in v6 as well (either with a static definition or by explicitly enabling RA). I wanted to move to a model where you could simply say ifconfig_em0=auto and have it DTRT. > jh> Otherwise when in the future are we going to change it? > > IPv4-preferred was chosen as the default because difference of the > loopback performance was large. I am a big fun to make FreeBSD > IPv6-capable by default and prefer IPv6, but the concern was a > possible negative impact for people who are using only IPv4. Hiroki, you and Bjoern made the same argument over 2 years ago. Are you saying that nothing has been done to improve this in that whole time? If this is such an important problem, why hasn't it been addressed? > So, can we change it for 10.X now? We cannot use "whether IPv6 > address is configured" because ::1 is always configured in GENERIC > kernel. The change will be "IPv6-preferred if the kernel has INET6 > support". Aren't those 2 ways to say the same thing? There is no v6 address configured on lo0 if there is no INET6 in the kernel. In the current regime I think it would be sufficient to prefer v6 if the user has configured an interface with it (see below). I did this in my version of the code that you reverted, so you can crib from that if you need to. > Preferring IPv6 addresses has needed a knob in rc.conf even in 4.x: > > 4.X: > ipv6_enable="YES" Until you introduced the changes in 9, it was not necessary to configure the address if you were using RA. Now even with RA it's necessary to do ifconfig_em0_ipv6="inet6 accept_rtadv" > ipv6_ifconfig_em0="2001:db8::1 prefixlen 64" > > 9.X and later: > ip6addrctl_policy="ipv6_prefer" > ifconfig_em0_ipv6="inet6 2001:db8::1 prefixlen 64" > > and if we change the default to ipv6_prefer, ip6addrctl_policy= line > will be unnecessary. But it will still be necessary to configure the interface. John, In regards to your desire for this to work automatically, we're not there yet. We don't currently have a good way to build v6 into the kernel, and configure interfaces with it, but not actually *use* v6 unless we get a network. What you described was the end goal of the changes I put in, which were ultimately reverted. Doug - -- I am only one, but I am one. I cannot do everything, but I can do something. And I will not let what I cannot do interfere with what I can do. -- Edward Everett Hale, (1822 - 1909) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAEBCAAGBQJQH3cJAAoJEFzGhvEaGryEgkIIAIOEDh1f2pFXusK0bqytMJIo +6A+ZGNRXkNttXDX53XQxpxQ4MO4zhQIazWV5a8IpbnkIQfAU91st/7oNREPbrr4 18AU4XGlrij5biyhL7BmmP29h5AjHQ4M++WqUxltT64xQ3wTS6HEWCqtrT+CV18S zQK+OBCatU43Fc90FibFMA1N1WVsGpo7C2XCyDBhplwEBld3f4vuS4kBWx9XNGKu aeKqpCgT/XL2PzHlo/YRDHTYU2GiKEFuYyesZBhfLbBw3eFpNl31U8CGT4BzRVy+ +v0n1mfJqup6ApdPeKtOtviUW+5iEEQNf2dnHxKTvihBQ8pSJUqPWeMFalpbEDk= =f8Es -----END PGP SIGNATURE----- From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 08:39:30 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 077051065672; Mon, 6 Aug 2012 08:39:30 +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 E57608FC0A; Mon, 6 Aug 2012 08:39:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q768dTOZ007116; Mon, 6 Aug 2012 08:39:29 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q768dTJv007114; Mon, 6 Aug 2012 08:39:29 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201208060839.q768dTJv007114@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 6 Aug 2012 08:39:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239087 - head/tools/tools/bootparttest X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 08:39:30 -0000 Author: ae Date: Mon Aug 6 08:39:29 2012 New Revision: 239087 URL: http://svn.freebsd.org/changeset/base/239087 Log: Add to the debug output the offset from the parent partitioning scheme. Modified: head/tools/tools/bootparttest/bootparttest.c Modified: head/tools/tools/bootparttest/bootparttest.c ============================================================================== --- head/tools/tools/bootparttest/bootparttest.c Mon Aug 6 07:20:25 2012 (r239086) +++ head/tools/tools/bootparttest/bootparttest.c Mon Aug 6 08:39:29 2012 (r239087) @@ -54,8 +54,8 @@ diskread(void *arg, void *buf, size_t bl struct disk *dp; dp = (struct disk *)arg; - printf("%s: read %d blocks from the offset %jd\n", dp->name, - blocks, offset); + printf("%s: read %d blocks from the offset %jd [+%jd]\n", dp->name, + blocks, offset, dp->offset); if (offset >= dp->mediasize / dp->sectorsize) return (-1); From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 08:54:06 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EBBF2106566C; Mon, 6 Aug 2012 08:54:06 +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 D708D8FC08; Mon, 6 Aug 2012 08:54: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 q768s6h9008371; Mon, 6 Aug 2012 08:54:06 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q768s6PN008369; Mon, 6 Aug 2012 08:54:06 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201208060854.q768s6PN008369@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 6 Aug 2012 08:54:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239088 - head/sys/boot/common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 08:54:07 -0000 Author: ae Date: Mon Aug 6 08:54:06 2012 New Revision: 239088 URL: http://svn.freebsd.org/changeset/base/239088 Log: Fix start offset calculation for the EBR partitions. Modified: head/sys/boot/common/part.c Modified: head/sys/boot/common/part.c ============================================================================== --- head/sys/boot/common/part.c Mon Aug 6 08:39:29 2012 (r239087) +++ head/sys/boot/common/part.c Mon Aug 6 08:54:06 2012 (r239088) @@ -389,7 +389,7 @@ ptable_ebrread(struct ptable *table, voi entry = malloc(sizeof(*entry)); if (entry == NULL) break; - entry->part.start = e1->part.start + start; + entry->part.start = offset + start; entry->part.end = entry->part.start + end - 1; entry->part.index = index++; entry->part.type = mbr_parttype(dp[0].dp_typ); From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 08:58:55 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 780DA106566C; Mon, 6 Aug 2012 08:58:55 +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 5907A8FC08; Mon, 6 Aug 2012 08:58:55 +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 q768wtLU008865; Mon, 6 Aug 2012 08:58:55 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q768wtbb008863; Mon, 6 Aug 2012 08:58:55 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201208060858.q768wtbb008863@svn.freebsd.org> From: Marius Strobl Date: Mon, 6 Aug 2012 08:58:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239089 - head/sys/dev/esp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 08:58:55 -0000 Author: marius Date: Mon Aug 6 08:58:54 2012 New Revision: 239089 URL: http://svn.freebsd.org/changeset/base/239089 Log: - Merge from NetBSD: When issuing a non-DMA command, make sure to set the "remaining length of command to be transferred via DMA" (sc_cmdlen) to zero up-front, otherwise we might get confused on command competition interrupt (no DMA active but still data left to transfer). - Implement handling of MSG_IGN_WIDE_RESIDUE which some targets produce, as just rejecting these leads to a resend and disconnect loop. Reported and tested by: mjacob MFC after: 3 days Modified: head/sys/dev/esp/ncr53c9x.c Modified: head/sys/dev/esp/ncr53c9x.c ============================================================================== --- head/sys/dev/esp/ncr53c9x.c Mon Aug 6 08:54:06 2012 (r239088) +++ head/sys/dev/esp/ncr53c9x.c Mon Aug 6 08:58:54 2012 (r239089) @@ -26,7 +26,7 @@ * */ -/* $NetBSD: ncr53c9x.c,v 1.143 2011/07/31 18:39:00 jakllsch Exp $ */ +/* $NetBSD: ncr53c9x.c,v 1.145 2012/06/18 21:23:56 martin Exp $ */ /*- * Copyright (c) 1998, 2002 The NetBSD Foundation, Inc. @@ -256,7 +256,7 @@ ncr53c9x_attach(struct ncr53c9x_softc *s return (EINVAL); } - device_printf(sc->sc_dev, "%s, %dMHz, SCSI ID %d\n", + device_printf(sc->sc_dev, "%s, %d MHz, SCSI ID %d\n", ncr53c9x_variant_names[sc->sc_rev], sc->sc_freq, sc->sc_id); sc->sc_ntarg = (sc->sc_rev == NCR_VARIANT_FAS366) ? 16 : 8; @@ -890,11 +890,8 @@ ncr53c9x_select(struct ncr53c9x_softc *s sc->sc_cmdp = cmd; error = NCRDMA_SETUP(sc, &sc->sc_cmdp, &sc->sc_cmdlen, 0, &dmasize); - if (error != 0) { - sc->sc_cmdlen = 0; - sc->sc_cmdp = NULL; + if (error != 0) goto cmd; - } /* Program the SCSI counter. */ NCR_SET_COUNT(sc, dmasize); @@ -920,6 +917,7 @@ cmd: */ /* Now get the command into the FIFO. */ + sc->sc_cmdlen = 0; ncr53c9x_wrfifo(sc, cmd, clen); /* And get the target's attention. */ @@ -1771,7 +1769,7 @@ ncr53c9x_msgin(struct ncr53c9x_softc *sc struct ncr53c9x_linfo *li; struct ncr53c9x_tinfo *ti; uint8_t *pb; - int lun, plen; + int len, lun; NCR_LOCK_ASSERT(sc, MA_OWNED); @@ -1818,15 +1816,15 @@ ncr53c9x_msgin(struct ncr53c9x_softc *sc */ case NCR_RESELECTED: pb = sc->sc_imess + 1; - plen = sc->sc_imlen - 1; + len = sc->sc_imlen - 1; break; default: pb = sc->sc_imess; - plen = sc->sc_imlen; + len = sc->sc_imlen; } - if (__verify_msg_format(pb, plen)) + if (__verify_msg_format(pb, len)) goto gotit; } @@ -1963,6 +1961,29 @@ gotit: sc->sc_dleft = ecb->dleft; break; + case MSG_IGN_WIDE_RESIDUE: + NCR_MSGS(("ignore wide residue (%d bytes)", + sc->sc_imess[1])); + if (sc->sc_imess[1] != 1) { + xpt_print_path(ecb->ccb->ccb_h.path); + printf("unexpected MESSAGE IGNORE WIDE " + "RESIDUE (%d bytes); sending REJECT\n", + sc->sc_imess[1]); + goto reject; + } + /* + * If there was a last transfer of an even number of + * bytes, wipe the "done" memory and adjust by one + * byte (sc->sc_imess[1]). + */ + len = sc->sc_dleft - ecb->dleft; + if (len != 0 && (len & 1) == 0) { + ecb->flags &= ~ECB_TENTATIVE_DONE; + sc->sc_dp = (char *)sc->sc_dp - 1; + sc->sc_dleft--; + } + break; + case MSG_EXTENDED: NCR_MSGS(("extended(%x) ", sc->sc_imess[2])); switch (sc->sc_imess[2]) { @@ -2272,6 +2293,7 @@ cmd: /* * XXX FIFO size */ + sc->sc_cmdlen = 0; ncr53c9x_flushfifo(sc); ncr53c9x_wrfifo(sc, sc->sc_omp, sc->sc_omlen); NCRCMD(sc, NCRCMD_TRANS); @@ -2811,9 +2833,10 @@ again: * (Timing problems?) */ if (sc->sc_features & NCR_F_DMASELECT) { - if (sc->sc_cmdlen == 0) + if (sc->sc_cmdlen == 0) { /* Hope for the best... */ break; + } } else if ((NCR_READ_REG(sc, NCR_FFLAG) & NCRFIFO_FF) == 0) { /* Hope for the best... */ @@ -2986,11 +3009,8 @@ msgin: sc->sc_cmdp = (void *)&ecb->cmd.cmd; error = NCRDMA_SETUP(sc, &sc->sc_cmdp, &sc->sc_cmdlen, 0, &size); - if (error != 0) { - sc->sc_cmdlen = 0; - sc->sc_cmdp = NULL; + if (error != 0) goto cmd; - } /* Program the SCSI counter. */ NCR_SET_COUNT(sc, size); @@ -3005,6 +3025,7 @@ msgin: break; } cmd: + sc->sc_cmdlen = 0; ncr53c9x_wrfifo(sc, (uint8_t *)&ecb->cmd.cmd, ecb->clen); NCRCMD(sc, NCRCMD_TRANS); sc->sc_prevphase = COMMAND_PHASE; @@ -3046,7 +3067,7 @@ setup_xfer: goto finish; } - /* Target returned to data phase: wipe "done" memory */ + /* Target returned to data phase: wipe "done" memory. */ ecb->flags &= ~ECB_TENTATIVE_DONE; /* Program the SCSI counter. */ @@ -3105,8 +3126,8 @@ shortcut: * overhead to pay. For example, selecting, sending a message * and command and then doing some work can be done in one "pass". * - * The delay is a heuristic. It is 2 when at 20MHz, 2 at 25MHz and 1 - * at 40MHz. This needs testing. + * The delay is a heuristic. It is 2 when at 20 MHz, 2 at 25 MHz and + * 1 at 40 MHz. This needs testing. */ microtime(&wait); wait.tv_usec += 50 / sc->sc_freq; @@ -3191,8 +3212,7 @@ ncr53c9x_callout(void *arg) ncr53c9x_abort(sc, ecb); /* Disable sync mode if stuck in a data phase. */ - if (ecb == sc->sc_nexus && - ti->curr.offset != 0 && + if (ecb == sc->sc_nexus && ti->curr.offset != 0 && (sc->sc_phase & (MSGI | CDI)) == 0) { /* XXX ASYNC CALLBACK! */ ti->goal.offset = 0; From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 08:59:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D30541065670; Mon, 6 Aug 2012 08:59:39 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE7548FC20; Mon, 6 Aug 2012 08:59:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q768xdVA008961; Mon, 6 Aug 2012 08:59:39 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q768xdKe008959; Mon, 6 Aug 2012 08:59:39 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201208060859.q768xdKe008959@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 6 Aug 2012 08:59:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239090 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 08:59:40 -0000 Author: glebius Date: Mon Aug 6 08:59:39 2012 New Revision: 239090 URL: http://svn.freebsd.org/changeset/base/239090 Log: Add supported device. Modified: head/share/man/man4/umodem.4 Modified: head/share/man/man4/umodem.4 ============================================================================== --- head/share/man/man4/umodem.4 Mon Aug 6 08:58:54 2012 (r239089) +++ head/share/man/man4/umodem.4 Mon Aug 6 08:59:39 2012 (r239090) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 20, 2011 +.Dd August 6, 2012 .Dt UMODEM 4 .Os .Sh NAME @@ -92,6 +92,8 @@ Yamaha Broadband Wireless Router RTW65b ELSA MicroLink 56k USB modem .It Sony Ericsson W810i phone +.It +Sonim XP5300 Force .El .Sh SEE ALSO .Xr tty 4 , From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 10:50:23 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBBCD1065670; Mon, 6 Aug 2012 10:50:23 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C75698FC14; Mon, 6 Aug 2012 10:50:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q76AoNns027323; Mon, 6 Aug 2012 10:50:23 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q76AoNfk027321; Mon, 6 Aug 2012 10:50:23 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201208061050.q76AoNfk027321@svn.freebsd.org> From: Michael Tuexen Date: Mon, 6 Aug 2012 10:50:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239091 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 10:50:24 -0000 Author: tuexen Date: Mon Aug 6 10:50:23 2012 New Revision: 239091 URL: http://svn.freebsd.org/changeset/base/239091 Log: Fix a bug found by dim@: Don't use an uninitilized variable, if INVARIANTS is on and an illegal packet with destination 0 is received. MFC after: 3 days X-MFC with: 238003 Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Mon Aug 6 08:59:39 2012 (r239090) +++ head/sys/netinet/sctp_input.c Mon Aug 6 10:50:23 2012 (r239091) @@ -5600,7 +5600,7 @@ sctp_common_input_processing(struct mbuf struct mbuf *m = *mm; int un_sent; int cnt_ctrl_ready = 0; - struct sctp_inpcb *inp, *inp_decr = NULL; + struct sctp_inpcb *inp = NULL, *inp_decr = NULL; struct sctp_tcb *stcb = NULL; struct sctp_nets *net = NULL; From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 10:50:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B513C10657D9; Mon, 6 Aug 2012 10:50:43 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A122D8FC17; Mon, 6 Aug 2012 10:50:43 +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 q76AohSL027384; Mon, 6 Aug 2012 10:50:43 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q76AohxF027382; Mon, 6 Aug 2012 10:50:43 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201208061050.q76AohxF027382@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 6 Aug 2012 10:50:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239092 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 10:50:43 -0000 Author: luigi Date: Mon Aug 6 10:50:43 2012 New Revision: 239092 URL: http://svn.freebsd.org/changeset/base/239092 Log: use FREE_PKT instead of m_freem to free an mbuf. The former is the standard form used in ipfw/dummynet, so that it is easier to remap it to different memory managers depending on the platform. Modified: head/sys/netinet/ipfw/ip_fw_log.c Modified: head/sys/netinet/ipfw/ip_fw_log.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_log.c Mon Aug 6 10:50:23 2012 (r239091) +++ head/sys/netinet/ipfw/ip_fw_log.c Mon Aug 6 10:50:43 2012 (r239092) @@ -115,7 +115,7 @@ ipfw_log_output(struct ifnet *ifp, struc struct sockaddr *dst, struct route *ro) { if (m != NULL) - m_freem(m); + FREE_PKT(m); return EINVAL; } From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 11:02:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2E418106564A; Mon, 6 Aug 2012 11:02:24 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F411F8FC08; Mon, 6 Aug 2012 11:02:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q76B2Nmp028311; Mon, 6 Aug 2012 11:02:23 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q76B2NDn028309; Mon, 6 Aug 2012 11:02:23 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201208061102.q76B2NDn028309@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 6 Aug 2012 11:02:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239093 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 11:02:24 -0000 Author: luigi Date: Mon Aug 6 11:02:23 2012 New Revision: 239093 URL: http://svn.freebsd.org/changeset/base/239093 Log: move functions outside the SYSBEGIN/SYSEND block (SYSBEGIN/SYSEND are specific to ipfw/dummynet and are used to emulate sysctl on platforms that do not have them, and they work by creating an array which contains all the sysctl-ed symbols.) Modified: head/sys/netinet/ipfw/ip_dn_io.c Modified: head/sys/netinet/ipfw/ip_dn_io.c ============================================================================== --- head/sys/netinet/ipfw/ip_dn_io.c Mon Aug 6 10:50:43 2012 (r239092) +++ head/sys/netinet/ipfw/ip_dn_io.c Mon Aug 6 11:02:23 2012 (r239093) @@ -98,17 +98,11 @@ extern void (*bridge_dn_p)(struct mbuf * #ifdef SYSCTL_NODE -SYSBEGIN(f4) - -SYSCTL_DECL(_net_inet); -SYSCTL_DECL(_net_inet_ip); -static SYSCTL_NODE(_net_inet_ip, OID_AUTO, dummynet, CTLFLAG_RW, 0, "Dummynet"); - -/* wrapper to pass dn_cfg fields to SYSCTL_* */ -//#define DC(x) (&(VNET_NAME(_base_dn_cfg).x)) -#define DC(x) (&(dn_cfg.x)) -/* parameters */ - +/* + * Because of the way the SYSBEGIN/SYSEND macros work on other + * platforms, there should not be functions between them. + * So keep the handlers outside the block. + */ static int sysctl_hash_size(SYSCTL_HANDLER_ARGS) { @@ -124,10 +118,6 @@ sysctl_hash_size(SYSCTL_HANDLER_ARGS) return (0); } -SYSCTL_PROC(_net_inet_ip_dummynet, OID_AUTO, hash_size, - CTLTYPE_INT | CTLFLAG_RW, 0, 0, sysctl_hash_size, - "I", "Default hash table size"); - static int sysctl_limits(SYSCTL_HANDLER_ARGS) { @@ -154,6 +144,23 @@ sysctl_limits(SYSCTL_HANDLER_ARGS) return (0); } +SYSBEGIN(f4) + +SYSCTL_DECL(_net_inet); +SYSCTL_DECL(_net_inet_ip); +static SYSCTL_NODE(_net_inet_ip, OID_AUTO, dummynet, CTLFLAG_RW, 0, "Dummynet"); + +/* wrapper to pass dn_cfg fields to SYSCTL_* */ +//#define DC(x) (&(VNET_NAME(_base_dn_cfg).x)) +#define DC(x) (&(dn_cfg.x)) +/* parameters */ + + +SYSCTL_PROC(_net_inet_ip_dummynet, OID_AUTO, hash_size, + CTLTYPE_INT | CTLFLAG_RW, 0, 0, sysctl_hash_size, + "I", "Default hash table size"); + + SYSCTL_PROC(_net_inet_ip_dummynet, OID_AUTO, pipe_slot_limit, CTLTYPE_LONG | CTLFLAG_RW, 0, 1, sysctl_limits, "L", "Upper limit in slots for pipe queue."); From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 12:14:06 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DCE81065679; Mon, 6 Aug 2012 12:14:06 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 3E0378FC15; Mon, 6 Aug 2012 12:14:06 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 91AB7B968; Mon, 6 Aug 2012 08:14:05 -0400 (EDT) From: John Baldwin To: "Andrey V. Elsukov" Date: Mon, 6 Aug 2012 08:07:49 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p17; KDE/4.5.5; amd64; ; ) References: <201208051437.q75EbnJO093363@svn.freebsd.org> In-Reply-To: <201208051437.q75EbnJO093363@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201208060807.49114.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 06 Aug 2012 08:14:05 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r239066 - head/sys/boot/i386/libi386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 12:14:06 -0000 On Sunday, August 05, 2012 10:37:49 am Andrey V. Elsukov wrote: > Author: ae > Date: Sun Aug 5 14:37:48 2012 > New Revision: 239066 > URL: http://svn.freebsd.org/changeset/base/239066 > > Log: > Add offset field to the i386_devdesc structure to be compatible with > disk_devdesc structure. Update biosdisk driver to the new disk API. > > Modified: > head/sys/boot/i386/libi386/Makefile > head/sys/boot/i386/libi386/biosdisk.c > head/sys/boot/i386/libi386/devicename.c > head/sys/boot/i386/libi386/libi386.h > > Modified: head/sys/boot/i386/libi386/biosdisk.c > ============================================================================== > --- head/sys/boot/i386/libi386/biosdisk.c Sun Aug 5 14:11:42 2012 (r239065) > +++ head/sys/boot/i386/libi386/biosdisk.c Sun Aug 5 14:37:48 2012 (r239066) > > struct devsw biosdisk = { > - "disk", > - DEVT_DISK, > - bd_init, > - bd_strategy, > - bd_open, > - bd_close, > - noioctl, > - bd_print, > - NULL > + "disk", > + DEVT_DISK, > + bd_init, > + bd_strategy, > + bd_open, > + bd_close, > + bd_ioctl, > + bd_print, > + NULL > }; You should not have mixed style changes in with code changes. This makes the diff far harder to review and destroys history. I asked you to not do this before. *sigh* -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 12:14:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A852D106566C; Mon, 6 Aug 2012 12:14:07 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 7B71C8FC18; Mon, 6 Aug 2012 12:14:07 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id D198DB980; Mon, 6 Aug 2012 08:14:06 -0400 (EDT) From: John Baldwin To: "Andrey V. Elsukov" Date: Mon, 6 Aug 2012 08:08:39 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p17; KDE/4.5.5; amd64; ; ) References: <201208051704.q75H4wB6005480@svn.freebsd.org> In-Reply-To: <201208051704.q75H4wB6005480@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201208060808.39793.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 06 Aug 2012 08:14:06 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r239073 - in head/sys/boot/userboot: . test userboot X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 12:14:07 -0000 On Sunday, August 05, 2012 1:04:58 pm Andrey V. Elsukov wrote: > Author: ae > Date: Sun Aug 5 17:04:58 2012 > New Revision: 239073 > URL: http://svn.freebsd.org/changeset/base/239073 > > Log: > Bump USERBOOT_VERSION. > > Requested by: dfr > > Modified: > head/sys/boot/userboot/test/test.c > head/sys/boot/userboot/userboot.h > head/sys/boot/userboot/userboot/main.c > > Modified: head/sys/boot/userboot/test/test.c > ============================================================================== > --- head/sys/boot/userboot/test/test.c Sun Aug 5 16:59:02 2012 (r239072) > +++ head/sys/boot/userboot/test/test.c Sun Aug 5 17:04:58 2012 (r239073) > @@ -450,5 +450,5 @@ main(int argc, char** argv) > term.c_lflag &= ~(ICANON|ECHO); > tcsetattr(0, TCSAFLUSH, &term); > > - func(&cb, NULL, USERBOOT_VERSION_1, disk_fd >= 0); > + func(&cb, NULL, USERBOOT_VERSION_2, disk_fd >= 0); > } > > Modified: head/sys/boot/userboot/userboot.h > ============================================================================== > --- head/sys/boot/userboot/userboot.h Sun Aug 5 16:59:02 2012 (r239072) > +++ head/sys/boot/userboot/userboot.h Sun Aug 5 17:04:58 2012 (r239073) > @@ -30,6 +30,7 @@ > * USERBOOT interface versions > */ > #define USERBOOT_VERSION_1 1 > +#define USERBOOT_VERSION_2 2 > > /* > * Exit codes from the loader > > Modified: head/sys/boot/userboot/userboot/main.c > ============================================================================== > --- head/sys/boot/userboot/userboot/main.c Sun Aug 5 16:59:02 2012 (r239072) > +++ head/sys/boot/userboot/userboot/main.c Sun Aug 5 17:04:58 2012 (r239073) > @@ -36,6 +36,8 @@ __FBSDID("$FreeBSD$"); > #include "disk.h" > #include "libuserboot.h" > > +#define USERBOOT_VERSION USERBOOT_VERSION_2 > + > struct loader_callbacks_v1 *callbacks; > void *callbacks_arg; Should this be called loader_callbacks_v2 now? -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 12:14:08 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D163A106564A; Mon, 6 Aug 2012 12:14:08 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id A7D628FC0C; Mon, 6 Aug 2012 12:14:08 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id EF07FB982; Mon, 6 Aug 2012 08:14:07 -0400 (EDT) From: John Baldwin To: Eitan Adler Date: Mon, 6 Aug 2012 08:09:21 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p17; KDE/4.5.5; amd64; ; ) References: <201208051937.q75JbJ1N018910@svn.freebsd.org> In-Reply-To: <201208051937.q75JbJ1N018910@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201208060809.21289.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 06 Aug 2012 08:14:08 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r239076 - head/sys/dev/puc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 12:14:08 -0000 On Sunday, August 05, 2012 3:37:19 pm Eitan Adler wrote: > Author: eadler > Date: Sun Aug 5 19:37:18 2012 > New Revision: 239076 > URL: http://svn.freebsd.org/changeset/base/239076 > > Log: > Add support for SIIG Cyber Serial Dual PCI 16C850 > > Submitted by: David Boyd David.Boyd@insightbb.com > Approved by: cperciva > MFC after: 3 days Do you have a PR? For pucdata commits we always want the details about the new card logged in a PR so it is easier to track down details about a particular entry in the future if needed. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 14:12:46 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 12073106566B; Mon, 6 Aug 2012 14:12:46 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) by mx1.freebsd.org (Postfix) with ESMTP id C732E8FC0A; Mon, 6 Aug 2012 14:12:45 +0000 (UTC) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.5/8.14.5) with ESMTP id q76ECj2Y054298; Mon, 6 Aug 2012 07:12:45 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.5/8.14.5/Submit) id q76ECjtf054297; Mon, 6 Aug 2012 07:12:45 -0700 (PDT) (envelope-from sgk) Date: Mon, 6 Aug 2012 07:12:45 -0700 From: Steve Kargl To: Doug Barton Message-ID: <20120806141245.GA54263@troutmask.apl.washington.edu> References: <201208011726.q71HQMPi079603@svn.freebsd.org> <20120801173240.GR2676@deviant.kiev.zoral.com.ua> <501F6D74.9070409@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <501F6D74.9070409@FreeBSD.org> User-Agent: Mutt/1.4.2.3i Cc: Konstantin Belousov , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r238973 - head/sys/x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 14:12:46 -0000 On Mon, Aug 06, 2012 at 12:08:36AM -0700, Doug Barton wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > On 08/01/2012 10:32, Konstantin Belousov wrote: > > It should have been the text > > Forced commit? :) > Try 'svn log sys/x86/x86/tsc.c | more' -- Steve From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 15:48:52 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 3276C106564A; Mon, 6 Aug 2012 15:48:52 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from [127.0.0.1] (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 0116214DC2B; Mon, 6 Aug 2012 15:48:51 +0000 (UTC) Message-ID: <501FE763.5050107@FreeBSD.org> Date: Mon, 06 Aug 2012 08:48:51 -0700 From: Doug Barton Organization: http://www.FreeBSD.org/ User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: Steve Kargl References: <201208011726.q71HQMPi079603@svn.freebsd.org> <20120801173240.GR2676@deviant.kiev.zoral.com.ua> <501F6D74.9070409@FreeBSD.org> <20120806141245.GA54263@troutmask.apl.washington.edu> In-Reply-To: <20120806141245.GA54263@troutmask.apl.washington.edu> X-Enigmail-Version: 1.4.3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Konstantin Belousov , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r238973 - head/sys/x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 15:48:52 -0000 On 08/06/2012 07:12 AM, Steve Kargl wrote: > On Mon, Aug 06, 2012 at 12:08:36AM -0700, Doug Barton wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA256 >> >> On 08/01/2012 10:32, Konstantin Belousov wrote: >>> It should have been the text >> >> Forced commit? :) >> > > Try 'svn log sys/x86/x86/tsc.c | more' Awesome. :) From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 16:37:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61124106564A; Mon, 6 Aug 2012 16:37:44 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 42F9B8FC18; Mon, 6 Aug 2012 16:37: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 q76Gbiob058715; Mon, 6 Aug 2012 16:37:44 GMT (envelope-from kan@svn.freebsd.org) Received: (from kan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q76GbiZl058713; Mon, 6 Aug 2012 16:37:44 GMT (envelope-from kan@svn.freebsd.org) Message-Id: <201208061637.q76GbiZl058713@svn.freebsd.org> From: Alexander Kabaev Date: Mon, 6 Aug 2012 16:37:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239095 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 16:37:44 -0000 Author: kan Date: Mon Aug 6 16:37:43 2012 New Revision: 239095 URL: http://svn.freebsd.org/changeset/base/239095 Log: Do not add handler to event handlers list until ithread is created. In rare event when fast and ithread interrupts share the same vector and the fast handler was registered first, we can end up trying to schedule the ithread that is not created yet. The kernel built with INVARIANTS then triggers an assertion. Change the order to create the ithread first and only then add the handler that needs it to the interrupt event handlers list. Reviewed by: jhb Modified: head/sys/kern/kern_intr.c Modified: head/sys/kern/kern_intr.c ============================================================================== --- head/sys/kern/kern_intr.c Mon Aug 6 15:22:11 2012 (r239094) +++ head/sys/kern/kern_intr.c Mon Aug 6 16:37:43 2012 (r239095) @@ -545,17 +545,6 @@ intr_event_add_handler(struct intr_event } } - /* Add the new handler to the event in priority order. */ - TAILQ_FOREACH(temp_ih, &ie->ie_handlers, ih_next) { - if (temp_ih->ih_pri > ih->ih_pri) - break; - } - if (temp_ih == NULL) - TAILQ_INSERT_TAIL(&ie->ie_handlers, ih, ih_next); - else - TAILQ_INSERT_BEFORE(temp_ih, ih, ih_next); - intr_event_update(ie); - /* Create a thread if we need one. */ while (ie->ie_thread == NULL && handler != NULL) { if (ie->ie_flags & IE_ADDING_THREAD) @@ -572,6 +561,18 @@ intr_event_add_handler(struct intr_event wakeup(ie); } } + + /* Add the new handler to the event in priority order. */ + TAILQ_FOREACH(temp_ih, &ie->ie_handlers, ih_next) { + if (temp_ih->ih_pri > ih->ih_pri) + break; + } + if (temp_ih == NULL) + TAILQ_INSERT_TAIL(&ie->ie_handlers, ih, ih_next); + else + TAILQ_INSERT_BEFORE(temp_ih, ih, ih_next); + intr_event_update(ie); + CTR3(KTR_INTR, "%s: added %s to %s", __func__, ih->ih_name, ie->ie_name); mtx_unlock(&ie->ie_lock); @@ -618,23 +619,12 @@ intr_event_add_handler(struct intr_event } } - /* Add the new handler to the event in priority order. */ - TAILQ_FOREACH(temp_ih, &ie->ie_handlers, ih_next) { - if (temp_ih->ih_pri > ih->ih_pri) - break; - } - if (temp_ih == NULL) - TAILQ_INSERT_TAIL(&ie->ie_handlers, ih, ih_next); - else - TAILQ_INSERT_BEFORE(temp_ih, ih, ih_next); - intr_event_update(ie); - /* For filtered handlers, create a private ithread to run on. */ - if (filter != NULL && handler != NULL) { + if (filter != NULL && handler != NULL) { mtx_unlock(&ie->ie_lock); - it = ithread_create("intr: newborn", ih); + it = ithread_create("intr: newborn", ih); mtx_lock(&ie->ie_lock); - it->it_event = ie; + it->it_event = ie; ih->ih_thread = it; ithread_update(it); /* XXX - do we really need this?!?!? */ } else { /* Create the global per-event thread if we need one. */ @@ -654,6 +644,18 @@ intr_event_add_handler(struct intr_event } } } + + /* Add the new handler to the event in priority order. */ + TAILQ_FOREACH(temp_ih, &ie->ie_handlers, ih_next) { + if (temp_ih->ih_pri > ih->ih_pri) + break; + } + if (temp_ih == NULL) + TAILQ_INSERT_TAIL(&ie->ie_handlers, ih, ih_next); + else + TAILQ_INSERT_BEFORE(temp_ih, ih, ih_next); + intr_event_update(ie); + CTR3(KTR_INTR, "%s: added %s to %s", __func__, ih->ih_name, ie->ie_name); mtx_unlock(&ie->ie_lock); From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 16:58:36 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B21D106567B for ; Mon, 6 Aug 2012 16:58:36 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id EEEFF8FC1F for ; Mon, 6 Aug 2012 16:58:35 +0000 (UTC) Received: by yenl8 with SMTP id l8so3276805yen.13 for ; Mon, 06 Aug 2012 09:58:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=m7axAhxI94osk0k0O+HX8Q1ykxJyTZmi0v2MldLTCIE=; b=myi7yutTSmVKuBKEg/XTM1Fv3kTuNDv5EykK1pq+PWAZ+lcF1C+kZm+LneY7vLQG3b WbNKkuyMFPSIZo9ysLNG8Da6AwU1hzZHelK77rxu4TCNtrBceTEp+mAe8QoUVxYWfn6K SiOjQhrWCwkBgND/GlnnJuTjI8qGXEo4HBmf8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=m7axAhxI94osk0k0O+HX8Q1ykxJyTZmi0v2MldLTCIE=; b=Kxll6TjIEIcuzPiFBHfhcfk5e0jr6U91wxwErZq+qH/mrBxXEpEmjnLB0Sj2CNtWhO lX+gMbKmhzTPikJPXd1bKSTlf1BglBWbYy1zm0a3h14wN6ar5PldNlVVE5yuiweB2IqS QYdYghXWofyWhE1OQ30r9Z6WT6MPW/P3m05BrzeUqimAYJJwzh+lqP+w8AeqMOdx6If7 XupJiSsv+t7ntsuQA4932QW9cELeOjw0ZxQvIhHrk3A7gziq+vEOaWFQgJjnlij+N9LK BCBZv4E1tBR9sxHzdw+6F7CZcFAivkdhtgwblRuwIAPPx5hG3GUAGpU+4xrVvwf45HJZ jIYw== Received: by 10.68.238.68 with SMTP id vi4mr20328803pbc.123.1344272315043; Mon, 06 Aug 2012 09:58:35 -0700 (PDT) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.66.67.52 with HTTP; Mon, 6 Aug 2012 09:58:04 -0700 (PDT) In-Reply-To: <201208060809.21289.jhb@freebsd.org> References: <201208051937.q75JbJ1N018910@svn.freebsd.org> <201208060809.21289.jhb@freebsd.org> From: Eitan Adler Date: Mon, 6 Aug 2012 09:58:04 -0700 X-Google-Sender-Auth: MK_itEqKpQg3W_7__fpMr4cl-go Message-ID: To: John Baldwin Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQmFaifGksGxmuostMRM4HRh4iTWc6yTsWPEPFQG75KhUmkmVb25VxBIeg6nQfjpf13eFgn/ Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r239076 - head/sys/dev/puc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 16:58:36 -0000 On 6 August 2012 05:09, John Baldwin wrote: > Do you have a PR? For pucdata commits we always want the details about the > new card logged in a PR so it is easier to track down details about a > particular entry in the future if needed. No, I had a mailing list post: (http://docs.freebsd.org/cgi/getmsg.cgi?fetch=48206+0+current/freebsd-current). I'll make sure to wait for the PR next time. -- Eitan Adler Source & Ports committer X11, Bugbusting teams From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 18:40:15 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72501106566B; Mon, 6 Aug 2012 18:40:15 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D9E68FC1A; Mon, 6 Aug 2012 18:40: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 q76IeFfR069003; Mon, 6 Aug 2012 18:40:15 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q76IeFi0069001; Mon, 6 Aug 2012 18:40:15 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201208061840.q76IeFi0069001@svn.freebsd.org> From: Dimitry Andric Date: Mon, 6 Aug 2012 18:40:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239099 - head/lib/libpam/modules/pam_krb5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 18:40:15 -0000 Author: dim Date: Mon Aug 6 18:40:14 2012 New Revision: 239099 URL: http://svn.freebsd.org/changeset/base/239099 Log: Fix two instances in pam_krb5(8), where the variable 'princ_name' could be used uninitialized. Found by: clang 3.2 Reviewed by: des MFC after: 1 week Modified: head/lib/libpam/modules/pam_krb5/pam_krb5.c Modified: head/lib/libpam/modules/pam_krb5/pam_krb5.c ============================================================================== --- head/lib/libpam/modules/pam_krb5/pam_krb5.c Mon Aug 6 17:58:58 2012 (r239098) +++ head/lib/libpam/modules/pam_krb5/pam_krb5.c Mon Aug 6 18:40:14 2012 (r239099) @@ -338,11 +338,11 @@ cleanup: PAM_LOG("Done cleanup"); cleanup2: krb5_free_principal(pam_context, princ); - PAM_LOG("Done cleanup2"); -cleanup3: if (princ_name) free(princ_name); + PAM_LOG("Done cleanup2"); +cleanup3: krb5_free_context(pam_context); PAM_LOG("Done cleanup3"); @@ -805,11 +805,11 @@ cleanup: PAM_LOG("Done cleanup"); cleanup2: krb5_free_principal(pam_context, princ); - PAM_LOG("Done cleanup2"); -cleanup3: if (princ_name) free(princ_name); + PAM_LOG("Done cleanup2"); +cleanup3: krb5_free_context(pam_context); PAM_LOG("Done cleanup3"); From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 18:45:00 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2CC62106564A; Mon, 6 Aug 2012 18:45:00 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1826F8FC0C; Mon, 6 Aug 2012 18:45: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 q76IixEC069432; Mon, 6 Aug 2012 18:44:59 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q76IixiN069430; Mon, 6 Aug 2012 18:44:59 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201208061844.q76IixiN069430@svn.freebsd.org> From: Dimitry Andric Date: Mon, 6 Aug 2012 18:44:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239100 - head/lib/libpam/modules/pam_unix X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 18:45:00 -0000 Author: dim Date: Mon Aug 6 18:44:59 2012 New Revision: 239100 URL: http://svn.freebsd.org/changeset/base/239100 Log: Fix an instance in pam_krb5(8), where the variable 'user' could be used uninitialized. Found by: clang 3.2 Reviewed by: des MFC after: 1 week Modified: head/lib/libpam/modules/pam_unix/pam_unix.c Modified: head/lib/libpam/modules/pam_unix/pam_unix.c ============================================================================== --- head/lib/libpam/modules/pam_unix/pam_unix.c Mon Aug 6 18:40:14 2012 (r239099) +++ head/lib/libpam/modules/pam_unix/pam_unix.c Mon Aug 6 18:44:59 2012 (r239100) @@ -94,13 +94,13 @@ pam_sm_authenticate(pam_handle_t *pamh, const char *pass, *user, *realpw, *prompt; if (openpam_get_option(pamh, PAM_OPT_AUTH_AS_SELF)) { - pwd = getpwnam(getlogin()); + user = getlogin(); } else { retval = pam_get_user(pamh, &user, NULL); if (retval != PAM_SUCCESS) return (retval); - pwd = getpwnam(user); } + pwd = getpwnam(user); PAM_LOG("Got user: %s", user); From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 18:51:14 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C9A64106566B; Mon, 6 Aug 2012 18:51:14 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B4C3E8FC08; Mon, 6 Aug 2012 18:51: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 q76IpEOI069975; Mon, 6 Aug 2012 18:51:14 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q76IpEOt069973; Mon, 6 Aug 2012 18:51:14 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201208061851.q76IpEOt069973@svn.freebsd.org> From: Dimitry Andric Date: Mon, 6 Aug 2012 18:51:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239101 - head/sys/dev/cxgb/ulp/iw_cxgb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 18:51:14 -0000 Author: dim Date: Mon Aug 6 18:51:14 2012 New Revision: 239101 URL: http://svn.freebsd.org/changeset/base/239101 Log: In cxgb(4), in function iwch_reregister_phys_mem(), initialize the 'npages' variable to zero, to avoid using it uninitialized in certain cases. Found by: clang Reviewed by: np MFC after: 1 week Modified: head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Modified: head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c ============================================================================== --- head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Mon Aug 6 18:44:59 2012 (r239100) +++ head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Mon Aug 6 18:51:14 2012 (r239101) @@ -487,7 +487,7 @@ static int iwch_reregister_phys_mem(stru __be64 *page_list = NULL; int shift = 0; u64 total_size; - int npages; + int npages = 0; int ret; CTR3(KTR_IW_CXGB, "%s ib_mr %p ib_pd %p", __FUNCTION__, mr, pd); From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 18:54:17 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8F761065672; Mon, 6 Aug 2012 18:54:17 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A4A9D8FC0C; Mon, 6 Aug 2012 18:54: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 q76IsHP6070331; Mon, 6 Aug 2012 18:54:17 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q76IsHeF070329; Mon, 6 Aug 2012 18:54:17 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201208061854.q76IsHeF070329@svn.freebsd.org> From: Dimitry Andric Date: Mon, 6 Aug 2012 18:54:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239102 - head/sys/dev/cxgbe/firmware X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 18:54:17 -0000 Author: dim Date: Mon Aug 6 18:54:17 2012 New Revision: 239102 URL: http://svn.freebsd.org/changeset/base/239102 Log: In sys/dev/cxgbe/firmware/t4fw_interface.h, change the enum 'fw_hdr_intfver' into an anonymous enum, which avoids a clang 3.2 warning about all the enum values being the same value. Reviewed by: np MFC after: 1 week Modified: head/sys/dev/cxgbe/firmware/t4fw_interface.h Modified: head/sys/dev/cxgbe/firmware/t4fw_interface.h ============================================================================== --- head/sys/dev/cxgbe/firmware/t4fw_interface.h Mon Aug 6 18:51:14 2012 (r239101) +++ head/sys/dev/cxgbe/firmware/t4fw_interface.h Mon Aug 6 18:54:17 2012 (r239102) @@ -7413,7 +7413,7 @@ enum fw_hdr_chip { #define G_FW_HDR_FW_VER_BUILD(x) \ (((x) >> S_FW_HDR_FW_VER_BUILD) & M_FW_HDR_FW_VER_BUILD) -enum fw_hdr_intfver { +enum { FW_HDR_INTFVER_NIC = 0x00, FW_HDR_INTFVER_VNIC = 0x00, FW_HDR_INTFVER_OFLD = 0x00, From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 19:01:09 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F19C4106564A; Mon, 6 Aug 2012 19:01:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id AB81B8FC12; Mon, 6 Aug 2012 19:01:08 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:3d5b:6e64:5e1b:e5fd] (unknown [IPv6:2001:7b8:3a7:0:3d5b:6e64:5e1b:e5fd]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id DE2915C37; Mon, 6 Aug 2012 21:01:07 +0200 (CEST) Message-ID: <50201471.4060208@FreeBSD.org> Date: Mon, 06 Aug 2012 21:01:05 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201208061844.q76IixiN069430@svn.freebsd.org> In-Reply-To: <201208061844.q76IixiN069430@svn.freebsd.org> X-Enigmail-Version: 1.5a1pre Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Subject: Re: svn commit: r239100 - head/lib/libpam/modules/pam_unix X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 19:01:09 -0000 On 2012-08-06 20:44, Dimitry Andric wrote: > Author: dim > Date: Mon Aug 6 18:44:59 2012 > New Revision: 239100 > URL: http://svn.freebsd.org/changeset/base/239100 > > Log: > Fix an instance in pam_krb5(8), where the variable 'user' could be used > uninitialized. Ehm, this was obviously meant as pam_unix instead, sorry. :) From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 19:49:58 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F039E1065670; Mon, 6 Aug 2012 19:49:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DBB8A8FC15; Mon, 6 Aug 2012 19:49: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 q76Jnvq2076070; Mon, 6 Aug 2012 19:49:57 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q76Jnv7c076068; Mon, 6 Aug 2012 19:49:57 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201208061949.q76Jnv7c076068@svn.freebsd.org> From: John Baldwin Date: Mon, 6 Aug 2012 19:49:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239103 - head/sys/dev/pci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 19:49:58 -0000 Author: jhb Date: Mon Aug 6 19:49:57 2012 New Revision: 239103 URL: http://svn.freebsd.org/changeset/base/239103 Log: Explicitly enable busmastering on PCI-PCI bridges. Transactions initiated on the secondary side of a bridge will not be propagated to the primary bus unless this is enabled. Busmastering is not enabled by default (we have relied on firmware to set this bit to date). The OS needs to set it for any bridges not configured by system firmware. Tested by: Steve Polyack korvus comcast net MFC after: 2 weeks Modified: head/sys/dev/pci/pci_pci.c Modified: head/sys/dev/pci/pci_pci.c ============================================================================== --- head/sys/dev/pci/pci_pci.c Mon Aug 6 18:54:17 2012 (r239102) +++ head/sys/dev/pci/pci_pci.c Mon Aug 6 19:49:57 2012 (r239103) @@ -683,6 +683,13 @@ pcib_attach_common(device_t dev) * would be more widely routed than absolutely necessary. We could * then do a walk of the tree later and fix it. */ + + /* + * Always enable busmastering on bridges so that transactions + * initiated on the secondary bus are passed through to the + * primary bus. + */ + pci_enable_busmaster(dev); } int From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 20:01:33 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21399106566B; Mon, 6 Aug 2012 20:01:33 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C49A8FC08; Mon, 6 Aug 2012 20:01: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 q76K1WlL077173; Mon, 6 Aug 2012 20:01:32 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q76K1WrP077171; Mon, 6 Aug 2012 20:01:32 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201208062001.q76K1WrP077171@svn.freebsd.org> From: Dimitry Andric Date: Mon, 6 Aug 2012 20:01:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239104 - head/sys/dev/aic7xxx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 20:01:33 -0000 Author: dim Date: Mon Aug 6 20:01:32 2012 New Revision: 239104 URL: http://svn.freebsd.org/changeset/base/239104 Log: In sys/dev/aic7xxx/aic79xx_osm.c, function ahd_attach(), initialize the 'path' variable to NULL, to avoid using it uninitialized in certain cases. Found by: clang MFC after: 1 week Modified: head/sys/dev/aic7xxx/aic79xx_osm.c Modified: head/sys/dev/aic7xxx/aic79xx_osm.c ============================================================================== --- head/sys/dev/aic7xxx/aic79xx_osm.c Mon Aug 6 19:49:57 2012 (r239103) +++ head/sys/dev/aic7xxx/aic79xx_osm.c Mon Aug 6 20:01:32 2012 (r239104) @@ -222,6 +222,7 @@ ahd_attach(struct ahd_softc *ahd) count = 0; devq = NULL; sim = NULL; + path = NULL; /* * Create a thread to perform all recovery. From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 20:44:05 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CEA7E106566C; Mon, 6 Aug 2012 20:44:05 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA3C28FC08; Mon, 6 Aug 2012 20:44:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q76Ki59J081004; Mon, 6 Aug 2012 20:44:05 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q76Ki59o081002; Mon, 6 Aug 2012 20:44:05 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201208062044.q76Ki59o081002@svn.freebsd.org> From: Jack F Vogel Date: Mon, 6 Aug 2012 20:44:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239105 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 20:44:05 -0000 Author: jfv Date: Mon Aug 6 20:44:05 2012 New Revision: 239105 URL: http://svn.freebsd.org/changeset/base/239105 Log: Correct the mq_start routine to avoid out-of-order packet delivery, always enqueue when possible. Also correct the DEPLETED test as multiple bits might be set. Thanks to Randall Stewart for the changes! Modified: head/sys/dev/e1000/if_igb.c Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Mon Aug 6 20:01:32 2012 (r239104) +++ head/sys/dev/e1000/if_igb.c Mon Aug 6 20:44:05 2012 (r239105) @@ -100,7 +100,7 @@ int igb_display_debug_stats = 0; /********************************************************************* * Driver version: *********************************************************************/ -char igb_driver_version[] = "version - 2.3.4"; +char igb_driver_version[] = "version - 2.3.5"; /********************************************************************* @@ -961,7 +961,15 @@ igb_mq_start(struct ifnet *ifp, struct m que = &adapter->queues[i]; if (((txr->queue_status & IGB_QUEUE_DEPLETED) == 0) && IGB_TX_TRYLOCK(txr)) { - err = igb_mq_start_locked(ifp, txr, m); + struct mbuf *pm = NULL; + /* + ** Try to queue first to avoid + ** out-of-order delivery, but + ** settle for it if that fails + */ + if (m && drbr_enqueue(ifp, txr->br, m)) + pm = m; + err = igb_mq_start_locked(ifp, txr, pm); IGB_TX_UNLOCK(txr); } else { err = drbr_enqueue(ifp, txr->br, m); @@ -981,7 +989,7 @@ igb_mq_start_locked(struct ifnet *ifp, s IGB_TX_LOCK_ASSERT(txr); if (((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) || - (txr->queue_status == IGB_QUEUE_DEPLETED) || + (txr->queue_status & IGB_QUEUE_DEPLETED) || adapter->link_active == 0) { if (m != NULL) err = drbr_enqueue(ifp, txr->br, m); From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 21:02:41 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 09CCB106564A; Mon, 6 Aug 2012 21:02:41 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E88798FC16; Mon, 6 Aug 2012 21:02: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 q76L2eAJ082558; Mon, 6 Aug 2012 21:02:40 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q76L2e90082556; Mon, 6 Aug 2012 21:02:40 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201208062102.q76L2e90082556@svn.freebsd.org> From: Dimitry Andric Date: Mon, 6 Aug 2012 21:02:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239106 - head/sbin/ggate/shared X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 21:02:41 -0000 Author: dim Date: Mon Aug 6 21:02:40 2012 New Revision: 239106 URL: http://svn.freebsd.org/changeset/base/239106 Log: Make sure the compiler knows g_gate_xvlog() and g_gate_xlog() do not return. This silences a warning from clang 3.2 about uninitialized use of the variable 'mediasize' in sbin/ggate/shared/ggate.c. Reviewed by: pjd MFC after: 1 week Modified: head/sbin/ggate/shared/ggate.h Modified: head/sbin/ggate/shared/ggate.h ============================================================================== --- head/sbin/ggate/shared/ggate.h Mon Aug 6 20:44:05 2012 (r239105) +++ head/sbin/ggate/shared/ggate.h Mon Aug 6 21:02:40 2012 (r239106) @@ -95,8 +95,8 @@ struct g_gate_hdr { void g_gate_vlog(int priority, const char *message, va_list ap); void g_gate_log(int priority, const char *message, ...); -void g_gate_xvlog(const char *message, va_list ap); -void g_gate_xlog(const char *message, ...); +void g_gate_xvlog(const char *message, va_list ap) __dead2; +void g_gate_xlog(const char *message, ...) __dead2; off_t g_gate_mediasize(int fd); unsigned g_gate_sectorsize(int fd); void g_gate_open_device(void); From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 21:24:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F065A106566B; Mon, 6 Aug 2012 21:24:43 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DA5758FC16; Mon, 6 Aug 2012 21:24:43 +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 q76LOhRa084376; Mon, 6 Aug 2012 21:24:43 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q76LOhuS084374; Mon, 6 Aug 2012 21:24:43 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201208062124.q76LOhuS084374@svn.freebsd.org> From: Brooks Davis Date: Mon, 6 Aug 2012 21:24:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239107 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 21:24:44 -0000 Author: brooks Date: Mon Aug 6 21:24:43 2012 New Revision: 239107 URL: http://svn.freebsd.org/changeset/base/239107 Log: MFP4 change 214967: Make the process of embedding MDROOT images less perilous by makeing the target that links kernel and embedding the image depend on the image. This means, if the image doesn't exist you find out before you try to boot from it and that if you change the image you don't have to touch some random source file to cause a rebuild. Don't hide that we're embedding the image. Modified: head/sys/conf/kern.post.mk Modified: head/sys/conf/kern.post.mk ============================================================================== --- head/sys/conf/kern.post.mk Mon Aug 6 21:02:40 2012 (r239106) +++ head/sys/conf/kern.post.mk Mon Aug 6 21:24:43 2012 (r239107) @@ -121,7 +121,7 @@ gdbinit: .endif .endif -${FULLKERNEL}: ${SYSTEM_DEP} vers.o +${FULLKERNEL}: ${SYSTEM_DEP} vers.o ${MFS_IMAGE} @rm -f ${.TARGET} @echo linking ${.TARGET} ${SYSTEM_LD} @@ -133,7 +133,7 @@ ${FULLKERNEL}: ${SYSTEM_DEP} vers.o .endif ${SYSTEM_LD_TAIL} .if defined(MFS_IMAGE) - @sh ${S}/tools/embed_mfs.sh ${FULLKERNEL} ${MFS_IMAGE} + sh ${S}/tools/embed_mfs.sh ${FULLKERNEL} ${MFS_IMAGE} .endif .if !exists(${.OBJDIR}/.depend) From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 21:28:45 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B682A106566B; Mon, 6 Aug 2012 21:28:45 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (lor.one-eyed-alien.net [69.66.77.232]) by mx1.freebsd.org (Postfix) with ESMTP id EC15D8FC08; Mon, 6 Aug 2012 21:28:44 +0000 (UTC) Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.14.5/8.14.5) with ESMTP id q76LShIW058102; Mon, 6 Aug 2012 16:28:43 -0500 (CDT) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.14.5/8.14.5/Submit) id q76LShol058101; Mon, 6 Aug 2012 16:28:43 -0500 (CDT) (envelope-from brooks) Date: Mon, 6 Aug 2012 16:28:43 -0500 From: Brooks Davis To: Brooks Davis Message-ID: <20120806212843.GA58067@lor.one-eyed-alien.net> References: <201208062124.q76LOhuS084374@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="UugvWAfsgieZRqgk" Content-Disposition: inline In-Reply-To: <201208062124.q76LOhuS084374@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r239107 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 21:28:45 -0000 --UugvWAfsgieZRqgk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 06, 2012 at 09:24:43PM +0000, Brooks Davis wrote: > Author: brooks > Date: Mon Aug 6 21:24:43 2012 > New Revision: 239107 > URL: http://svn.freebsd.org/changeset/base/239107 >=20 > Log: > MFP4 change 214967: > Make the process of embedding MDROOT images less perilous by > makeing the target that links kernel and embedding the image > depend on the image. This means, if the image doesn't exist you > find out before you try to boot from it and that if you change > the image you don't have to touch some random source file to > cause a rebuild. > =20 > Don't hide that we're embedding the image. This commit message should have also included: Sponsored by: DARPA/AFRL -- Brooks --UugvWAfsgieZRqgk Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iD8DBQFQIDcLXY6L6fI4GtQRAiAyAJ9SworftQdBIqzHWt3lh/bYlXQG7QCeK2SZ EfOVetoQzcy8uL+w2zbNsK0= =UiDG -----END PGP SIGNATURE----- --UugvWAfsgieZRqgk-- From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 22:43:50 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 38AD8106566B; Mon, 6 Aug 2012 22:43:50 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0AA488FC15; Mon, 6 Aug 2012 22:43: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 q76MhnH5091071; Mon, 6 Aug 2012 22:43:49 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q76MhnkP091068; Mon, 6 Aug 2012 22:43:49 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201208062243.q76MhnkP091068@svn.freebsd.org> From: Jack F Vogel Date: Mon, 6 Aug 2012 22:43:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239109 - in head: share/man/man4 sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 22:43:50 -0000 Author: jfv Date: Mon Aug 6 22:43:49 2012 New Revision: 239109 URL: http://svn.freebsd.org/changeset/base/239109 Log: Make the polling interface in igb able to handle multiqueue, and correct the rxdone handling. Update the polling man page to include igb as well. Thanks to Mark Johnston for these changes. Modified: head/share/man/man4/polling.4 head/sys/dev/e1000/if_igb.c Modified: head/share/man/man4/polling.4 ============================================================================== --- head/share/man/man4/polling.4 Mon Aug 6 21:33:11 2012 (r239108) +++ head/share/man/man4/polling.4 Mon Aug 6 22:43:49 2012 (r239109) @@ -184,6 +184,7 @@ As of this writing, the .Xr fwe 4 , .Xr fwip 4 , .Xr fxp 4 , +.Xr igb 4 , .Xr ixgb 4 , .Xr nfe 4 , .Xr nge 4 , Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Mon Aug 6 21:33:11 2012 (r239108) +++ head/sys/dev/e1000/if_igb.c Mon Aug 6 22:43:49 2012 (r239109) @@ -1502,12 +1502,6 @@ igb_irq_fast(void *arg) } #ifdef DEVICE_POLLING -/********************************************************************* - * - * Legacy polling routine : if using this code you MUST be sure that - * multiqueue is not defined, ie, set igb_num_queues to 1. - * - *********************************************************************/ #if __FreeBSD_version >= 800000 #define POLL_RETURN_COUNT(a) (a) static int @@ -1518,8 +1512,8 @@ static void igb_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) { struct adapter *adapter = ifp->if_softc; - struct igb_queue *que = adapter->queues; - struct tx_ring *txr = adapter->tx_rings; + struct igb_queue *que; + struct tx_ring *txr; u32 reg_icr, rx_done = 0; u32 loop = IGB_MAX_LOOP; bool more; @@ -1541,20 +1535,26 @@ igb_poll(struct ifnet *ifp, enum poll_cm } IGB_CORE_UNLOCK(adapter); - igb_rxeof(que, count, &rx_done); + for (int i = 0; i < adapter->num_queues; i++) { + que = &adapter->queues[i]; + txr = que->txr; - IGB_TX_LOCK(txr); - do { - more = igb_txeof(txr); - } while (loop-- && more); + igb_rxeof(que, count, &rx_done); + + IGB_TX_LOCK(txr); + do { + more = igb_txeof(txr); + } while (loop-- && more); #if __FreeBSD_version >= 800000 - if (!drbr_empty(ifp, txr->br)) - igb_mq_start_locked(ifp, txr, NULL); + if (!drbr_empty(ifp, txr->br)) + igb_mq_start_locked(ifp, txr, NULL); #else - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - igb_start_locked(txr, ifp); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + igb_start_locked(txr, ifp); #endif - IGB_TX_UNLOCK(txr); + IGB_TX_UNLOCK(txr); + } + return POLL_RETURN_COUNT(rx_done); } #endif /* DEVICE_POLLING */ @@ -4901,7 +4901,7 @@ next_desc: } if (done != NULL) - *done = rxdone; + *done += rxdone; IGB_RX_UNLOCK(rxr); return ((staterr & E1000_RXD_STAT_DD) ? TRUE : FALSE); From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 22:53:25 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90F64106564A; Mon, 6 Aug 2012 22:53:25 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C3598FC0C; Mon, 6 Aug 2012 22:53:25 +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 q76MrP0F092023; Mon, 6 Aug 2012 22:53:25 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q76MrPnb092021; Mon, 6 Aug 2012 22:53:25 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201208062253.q76MrPnb092021@svn.freebsd.org> From: Davide Italiano Date: Mon, 6 Aug 2012 22:53:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239110 - head/sys/dev/bce X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 22:53:25 -0000 Author: davide Date: Mon Aug 6 22:53:24 2012 New Revision: 239110 URL: http://svn.freebsd.org/changeset/base/239110 Log: Remove a spurious bace which cause build fail in case BCE_DEBUG option is turned on. Reviewed by: delphij Approved by: gnn (mentor) Sponsored by: Google Summer of Code 2012 MFC after: 1 week Modified: head/sys/dev/bce/if_bce.c Modified: head/sys/dev/bce/if_bce.c ============================================================================== --- head/sys/dev/bce/if_bce.c Mon Aug 6 22:43:49 2012 (r239109) +++ head/sys/dev/bce/if_bce.c Mon Aug 6 22:53:24 2012 (r239110) @@ -10513,7 +10513,7 @@ bce_dump_ftqs(struct bce_softc *sc) (BCE_HC_STAT_GEN_SEL_0_GEN_SEL_0_CPQ_VALID_CNT << 8) | (BCE_HC_STAT_GEN_SEL_0_GEN_SEL_0_MGMQ_VALID_CNT); - if ((BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) + if (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) val = val | (BCE_HC_STAT_GEN_SEL_0_GEN_SEL_0_RV2PCSQ_VALID_CNT_XI << 24); From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 22:54:11 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4052A1065672; Mon, 6 Aug 2012 22:54:11 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2B07D8FC17; Mon, 6 Aug 2012 22:54:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q76MsBeO092122; Mon, 6 Aug 2012 22:54:11 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q76MsAxh092119; Mon, 6 Aug 2012 22:54:10 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201208062254.q76MsAxh092119@svn.freebsd.org> From: Adrian Chadd Date: Mon, 6 Aug 2012 22:54:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239111 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 22:54:11 -0000 Author: adrian Date: Mon Aug 6 22:54:10 2012 New Revision: 239111 URL: http://svn.freebsd.org/changeset/base/239111 Log: Remove unnecessary debugging printf()s. Modified: head/sys/dev/ath/if_ath_rx.c head/sys/dev/ath/if_ath_rx_edma.c Modified: head/sys/dev/ath/if_ath_rx.c ============================================================================== --- head/sys/dev/ath/if_ath_rx.c Mon Aug 6 22:53:24 2012 (r239110) +++ head/sys/dev/ath/if_ath_rx.c Mon Aug 6 22:54:10 2012 (r239111) @@ -1072,8 +1072,6 @@ ath_legacy_dma_rxsetup(struct ath_softc { int error; - device_printf(sc->sc_dev, "%s: called\n", __func__); - error = ath_descdma_setup(sc, &sc->sc_rxdma, &sc->sc_rxbuf, "rx", sizeof(struct ath_desc), ath_rxbuf, 1); if (error != 0) @@ -1086,8 +1084,6 @@ static int ath_legacy_dma_rxteardown(struct ath_softc *sc) { - device_printf(sc->sc_dev, "%s: called\n", __func__); - if (sc->sc_rxdma.dd_desc_len != 0) ath_descdma_cleanup(sc, &sc->sc_rxdma, &sc->sc_rxbuf); return (0); Modified: head/sys/dev/ath/if_ath_rx_edma.c ============================================================================== --- head/sys/dev/ath/if_ath_rx_edma.c Mon Aug 6 22:53:24 2012 (r239110) +++ head/sys/dev/ath/if_ath_rx_edma.c Mon Aug 6 22:54:10 2012 (r239111) @@ -507,8 +507,6 @@ ath_edma_rxbuf_init(struct ath_softc *sc ATH_RX_LOCK_ASSERT(sc); -// device_printf(sc->sc_dev, "%s: called; bf=%p\n", __func__, bf); - m = m_getm(NULL, sc->sc_edma_bufsize, M_DONTWAIT, MT_DATA); if (! m) return (ENOBUFS); /* XXX ?*/ @@ -799,8 +797,6 @@ static int ath_edma_dma_rxteardown(struct ath_softc *sc) { - device_printf(sc->sc_dev, "%s: called\n", __func__); - ATH_RX_LOCK(sc); ath_edma_rxfifo_flush(sc, HAL_RX_QUEUE_HP); ath_edma_rxfifo_free(sc, HAL_RX_QUEUE_HP); From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 23:17:04 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78B591065670; Mon, 6 Aug 2012 23:17:04 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from vps.rulingia.com (host-122-100-2-194.octopus.com.au [122.100.2.194]) by mx1.freebsd.org (Postfix) with ESMTP id E03568FC0C; Mon, 6 Aug 2012 23:17:03 +0000 (UTC) Received: from server.rulingia.com (c220-239-247-45.belrs5.nsw.optusnet.com.au [220.239.247.45]) by vps.rulingia.com (8.14.5/8.14.5) with ESMTP id q76NGupA044145 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 7 Aug 2012 09:16:56 +1000 (EST) (envelope-from peter@rulingia.com) X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.14.5/8.14.5) with ESMTP id q76NGiFn094781 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 7 Aug 2012 09:16:44 +1000 (EST) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.14.5/8.14.5/Submit) id q76NGh1l094776; Tue, 7 Aug 2012 09:16:43 +1000 (EST) (envelope-from peter) Date: Tue, 7 Aug 2012 09:16:43 +1000 From: Peter Jeremy To: Marius Strobl Message-ID: <20120806231643.GA25854@server.rulingia.com> References: <201208052019.q75KJSkY022376@svn.freebsd.org> <20120805202540.GH2676@deviant.kiev.zoral.com.ua> <20120805205246.GW58433@alchemy.franken.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="YZ5djTAD1cGYuMQK" Content-Disposition: inline In-Reply-To: <20120805205246.GW58433@alchemy.franken.de> X-PGP-Key: http://www.rulingia.com/keys/peter.pgp User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Konstantin Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r239077 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 23:17:04 -0000 --YZ5djTAD1cGYuMQK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2012-Aug-05 22:52:46 +0200, Marius Strobl wrote: >Bascially, "options ZFS" is available on at least amd64, i386, pc98, >powerpc64 and sparc64. At least in theory. In practise, it's not usable because: >powerpc). However, this causes linking the kernel to fail due to some >symbols being defined multiple times: =2E.. >I currently can't remember the details but the fix seemed non-trivial >to me, short of creating something like LINT-ZFS kernel config files >similar to the LINT-VIMAGE etc we have. The underlying problem is that there are 2 zlib's in the kernel tree. One is in sys/cddl/contrib/opensolaris/uts/common/zmod/ and the other is sys/net/zlib.c. The real fix is to get rid of one of them and use the remaining one for all subsystems that want zlib. I agree that merging them is non-trivial because they are based on different versions of zlib (1.2.3 & 1.0.4, respectively) and the original files have been munged is different ways. (And there's a third inflate(9) based on unzip-5.12 in sys/kern/inflate.c, as well as another complete zlib-1.2.7 in lib/libz) --=20 Peter Jeremy --YZ5djTAD1cGYuMQK Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlAgUFsACgkQ/opHv/APuIdITACdFOcCILSaKfHRKUXW487HjUNI Q+gAoKFWWeN4IysmPXz/0j0aC2AJJvBV =8xM/ -----END PGP SIGNATURE----- --YZ5djTAD1cGYuMQK-- From owner-svn-src-head@FreeBSD.ORG Mon Aug 6 23:43:33 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A12D71065670; Mon, 6 Aug 2012 23:43:33 +0000 (UTC) (envelope-from ache@vniz.net) Received: from vniz.net (vniz.net [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id 101E88FC08; Mon, 6 Aug 2012 23:43:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by vniz.net (8.14.5/8.14.5) with ESMTP id q76NhMqg080726; Tue, 7 Aug 2012 03:43:23 +0400 (MSK) (envelope-from ache@vniz.net) Received: (from ache@localhost) by localhost (8.14.5/8.14.5/Submit) id q76NhM2T080725; Tue, 7 Aug 2012 03:43:22 +0400 (MSK) (envelope-from ache) Date: Tue, 7 Aug 2012 03:43:21 +0400 From: Andrey Chernov To: Dimitry Andric Message-ID: <20120806234320.GA80675@vniz.net> Mail-Followup-To: Andrey Chernov , Dimitry Andric , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG References: <201208061844.q76IixiN069430@svn.freebsd.org> <50201471.4060208@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <50201471.4060208@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG Subject: Re: svn commit: r239100 - head/lib/libpam/modules/pam_unix X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 23:43:33 -0000 On Mon, Aug 06, 2012 at 09:01:05PM +0200, Dimitry Andric wrote: > On 2012-08-06 20:44, Dimitry Andric wrote: > > Author: dim > > Date: Mon Aug 6 18:44:59 2012 > > New Revision: 239100 > > URL: http://svn.freebsd.org/changeset/base/239100 > > > > Log: > > Fix an instance in pam_krb5(8), where the variable 'user' could be used > > uninitialized. > > Ehm, this was obviously meant as pam_unix instead, sorry. :) Could you please look at misc/170373 while you are there? -- http://ache.vniz.net/ From owner-svn-src-head@FreeBSD.ORG Tue Aug 7 00:42:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9E92106566B; Tue, 7 Aug 2012 00:42:46 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A520F8FC0A; Tue, 7 Aug 2012 00:42:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q770gk69001497; Tue, 7 Aug 2012 00:42:46 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q770gkIf001495; Tue, 7 Aug 2012 00:42:46 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201208070042.q770gkIf001495@svn.freebsd.org> From: Adrian Chadd Date: Tue, 7 Aug 2012 00:42:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239120 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Aug 2012 00:42:46 -0000 Author: adrian Date: Tue Aug 7 00:42:46 2012 New Revision: 239120 URL: http://svn.freebsd.org/changeset/base/239120 Log: Correct re-initialise the link pointer to be the final descriptor in the last buffer. This fixes traffic stalls that were occuring with stuck beacon events. PR: kern/170433 Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Tue Aug 7 00:34:15 2012 (r239119) +++ head/sys/dev/ath/if_ath_tx.c Tue Aug 7 00:42:46 2012 (r239120) @@ -751,7 +751,7 @@ ath_legacy_tx_dma_restart(struct ath_sof return; ath_hal_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr); - ath_hal_gettxdesclinkptr(ah, bf->bf_lastds, &txq->axq_link); + ath_hal_gettxdesclinkptr(ah, bf_last->bf_lastds, &txq->axq_link); ath_hal_txstart(ah, txq->axq_qnum); } From owner-svn-src-head@FreeBSD.ORG Tue Aug 7 04:48:15 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 417F5106564A; Tue, 7 Aug 2012 04:48:15 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2BD6A8FC0C; Tue, 7 Aug 2012 04:48: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 q774mE28021714; Tue, 7 Aug 2012 04:48:14 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q774mE2n021712; Tue, 7 Aug 2012 04:48:14 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201208070448.q774mE2n021712@svn.freebsd.org> From: Alan Cox Date: Tue, 7 Aug 2012 04:48:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239121 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Aug 2012 04:48:15 -0000 Author: alc Date: Tue Aug 7 04:48:14 2012 New Revision: 239121 URL: http://svn.freebsd.org/changeset/base/239121 Log: Never sleep on busy pages in vm_pageout_launder(), always skip them. Long ago, sleeping on busy pages in vm_pageout_launder() made sense. The call to vm_pageout_flush() specified asynchronous I/O and sleeping on busy pages blocked vm_pageout_launder() until the flush had completed. However, in CVS revision 1.35 of vm/vm_contig.c, the call to vm_pageout_flush() was changed to request synchronous I/O, but the sleep on busy pages was not removed. Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Tue Aug 7 00:42:46 2012 (r239120) +++ head/sys/vm/vm_pageout.c Tue Aug 7 04:48:14 2012 (r239121) @@ -586,23 +586,14 @@ vm_pageout_launder(int queue, int tries, continue; } object = m->object; - if (!VM_OBJECT_TRYLOCK(object) && + if ((!VM_OBJECT_TRYLOCK(object) && (!vm_pageout_fallback_object_lock(m, &next) || - m->hold_count != 0)) { + m->hold_count != 0)) || (m->oflags & VPO_BUSY) != 0 || + m->busy != 0) { vm_page_unlock(m); VM_OBJECT_UNLOCK(object); continue; } - if ((m->oflags & VPO_BUSY) != 0 || m->busy != 0) { - if (tries == 0) { - vm_page_unlock(m); - VM_OBJECT_UNLOCK(object); - continue; - } - vm_page_sleep(m, "vpctw0"); - VM_OBJECT_UNLOCK(object); - return (FALSE); - } vm_page_test_dirty(m); if (m->dirty == 0) pmap_remove_all(m); From owner-svn-src-head@FreeBSD.ORG Tue Aug 7 05:46:37 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 84DF7106564A; Tue, 7 Aug 2012 05:46:37 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F6DE8FC0A; Tue, 7 Aug 2012 05:46:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q775kbwJ026471; Tue, 7 Aug 2012 05:46:37 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q775kb4H026469; Tue, 7 Aug 2012 05:46:37 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201208070546.q775kb4H026469@svn.freebsd.org> From: Sergey Kandaurov Date: Tue, 7 Aug 2012 05:46:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239123 - head/sys/amd64/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Aug 2012 05:46:37 -0000 Author: pluknet Date: Tue Aug 7 05:46:36 2012 New Revision: 239123 URL: http://svn.freebsd.org/changeset/base/239123 Log: Remove duplicate header inclusion of Discussed with: bz Modified: head/sys/amd64/amd64/elf_machdep.c Modified: head/sys/amd64/amd64/elf_machdep.c ============================================================================== --- head/sys/amd64/amd64/elf_machdep.c Tue Aug 7 05:03:53 2012 (r239122) +++ head/sys/amd64/amd64/elf_machdep.c Tue Aug 7 05:46:36 2012 (r239123) @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include From owner-svn-src-head@FreeBSD.ORG Tue Aug 7 07:52:26 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47636106566C; Tue, 7 Aug 2012 07:52:26 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 318548FC08; Tue, 7 Aug 2012 07:52:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q777qQ2q036763; Tue, 7 Aug 2012 07:52:26 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q777qPAj036760; Tue, 7 Aug 2012 07:52:25 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201208070752.q777qPAj036760@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 7 Aug 2012 07:52:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239124 - in head/sys/netinet: . ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Aug 2012 07:52:26 -0000 Author: luigi Date: Tue Aug 7 07:52:25 2012 New Revision: 239124 URL: http://svn.freebsd.org/changeset/base/239124 Log: s/lenght/length/ in comments Modified: head/sys/netinet/ip_dummynet.h head/sys/netinet/ipfw/dummynet.txt Modified: head/sys/netinet/ip_dummynet.h ============================================================================== --- head/sys/netinet/ip_dummynet.h Tue Aug 7 05:46:36 2012 (r239123) +++ head/sys/netinet/ip_dummynet.h Tue Aug 7 07:52:25 2012 (r239124) @@ -171,8 +171,8 @@ struct dn_flow { struct ipfw_flow_id fid; uint64_t tot_pkts; /* statistics counters */ uint64_t tot_bytes; - uint32_t length; /* Queue lenght, in packets */ - uint32_t len_bytes; /* Queue lenght, in bytes */ + uint32_t length; /* Queue length, in packets */ + uint32_t len_bytes; /* Queue length, in bytes */ uint32_t drops; }; Modified: head/sys/netinet/ipfw/dummynet.txt ============================================================================== --- head/sys/netinet/ipfw/dummynet.txt Tue Aug 7 05:46:36 2012 (r239123) +++ head/sys/netinet/ipfw/dummynet.txt Tue Aug 7 07:52:25 2012 (r239124) @@ -839,7 +839,7 @@ scheduler functions. The struct scheduler represent the scheduler descriptor that is passed to dummynet when a scheduler module is loaded. -This struct contains the type of scheduler, the lenght of all structs and +This struct contains the type of scheduler, the length of all structs and all function pointers. If a function is not implemented should be initialize to NULL. Some functions are mandatory, other are mandatory if some memory should be freed. From owner-svn-src-head@FreeBSD.ORG Tue Aug 7 08:36:10 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3D60106564A; Tue, 7 Aug 2012 08:36:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CEB238FC08; Tue, 7 Aug 2012 08:36:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q778aAT9040382; Tue, 7 Aug 2012 08:36:10 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q778aAE3040380; Tue, 7 Aug 2012 08:36:10 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208070836.q778aAE3040380@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 7 Aug 2012 08:36:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239125 - head/sys/amd64/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Aug 2012 08:36:11 -0000 Author: kib Date: Tue Aug 7 08:36:10 2012 New Revision: 239125 URL: http://svn.freebsd.org/changeset/base/239125 Log: Do not apply errata 721 workaround when under hypervisor, since typical hypervisor does not implement access to the required MSR, causing #GP on boot. Reported and tested by: olgeni PR: amd64/170388 MFC after: 3 days Modified: head/sys/amd64/amd64/initcpu.c Modified: head/sys/amd64/amd64/initcpu.c ============================================================================== --- head/sys/amd64/amd64/initcpu.c Tue Aug 7 07:52:25 2012 (r239124) +++ head/sys/amd64/amd64/initcpu.c Tue Aug 7 08:36:10 2012 (r239125) @@ -91,11 +91,17 @@ init_amd(void) * * http://support.amd.com/us/Processor_TechDocs/41322_10h_Rev_Gd.pdf * http://support.amd.com/us/Processor_TechDocs/44739_12h_Rev_Gd.pdf + * + * Hypervisors do not provide access to the errata MSR, + * causing #GP exception on attempt to apply the errata. The + * MSR write shall be done on host and persist globally + * anyway, so do not try to do it when under virtualization. */ switch (CPUID_TO_FAMILY(cpu_id)) { case 0x10: case 0x12: - wrmsr(0xc0011029, rdmsr(0xc0011029) | 1); + if ((cpu_feature2 & CPUID2_HV) == 0) + wrmsr(0xc0011029, rdmsr(0xc0011029) | 1); break; } } From owner-svn-src-head@FreeBSD.ORG Tue Aug 7 08:37:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C8299106564A; Tue, 7 Aug 2012 08:37:35 +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 B35808FC0A; Tue, 7 Aug 2012 08:37:35 +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 q778bZR2040513; Tue, 7 Aug 2012 08:37:35 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q778bZsG040511; Tue, 7 Aug 2012 08:37:35 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201208070837.q778bZsG040511@svn.freebsd.org> From: Warner Losh Date: Tue, 7 Aug 2012 08:37:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239126 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Aug 2012 08:37:35 -0000 Author: imp Date: Tue Aug 7 08:37:35 2012 New Revision: 239126 URL: http://svn.freebsd.org/changeset/base/239126 Log: Fix obvious problem with emulate_fp sysctl. Submitted by: Paul Ambrose Modified: head/sys/mips/mips/trap.c Modified: head/sys/mips/mips/trap.c ============================================================================== --- head/sys/mips/mips/trap.c Tue Aug 7 08:36:10 2012 (r239125) +++ head/sys/mips/mips/trap.c Tue Aug 7 08:37:35 2012 (r239126) @@ -302,7 +302,7 @@ static int emulate_fp = 1; static int emulate_fp = 0; #endif SYSCTL_INT(_machdep, OID_AUTO, emulate_fp, CTLFLAG_RW, - &allow_unaligned_acc, 0, "Emulate unimplemented FPU instructions"); + &emulate_fp, 0, "Emulate unimplemented FPU instructions"); static int emulate_unaligned_access(struct trapframe *frame, int mode); From owner-svn-src-head@FreeBSD.ORG Tue Aug 7 08:43:38 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 248CF106564A; Tue, 7 Aug 2012 08:43:38 +0000 (UTC) (envelope-from fabien.thomas@netasq.com) Received: from work.netasq.com (gwlille.netasq.com [91.212.116.1]) by mx1.freebsd.org (Postfix) with ESMTP id A91328FC15; Tue, 7 Aug 2012 08:43:37 +0000 (UTC) Received: from [10.2.1.1] (unknown [10.2.1.1]) by work.netasq.com (Postfix) with ESMTPSA id 455B72704511; Tue, 7 Aug 2012 10:43:36 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: multipart/signed; boundary="Apple-Mail=_355BEF34-3FDC-4197-8401-CC7FF59FF36E"; protocol="application/pkcs7-signature"; micalg=sha1 From: Fabien Thomas In-Reply-To: <201208062044.q76Ki59o081002@svn.freebsd.org> Date: Tue, 7 Aug 2012 10:43:35 +0200 Message-Id: <905F03BA-907F-4330-BF59-77F0A2DB1B02@netasq.com> References: <201208062044.q76Ki59o081002@svn.freebsd.org> To: Jack F Vogel X-Mailer: Apple Mail (2.1278) X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r239105 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Aug 2012 08:43:38 -0000 --Apple-Mail=_355BEF34-3FDC-4197-8401-CC7FF59FF36E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii >=20 > @@ -961,7 +961,15 @@ igb_mq_start(struct ifnet *ifp, struct m > que =3D &adapter->queues[i]; > if (((txr->queue_status & IGB_QUEUE_DEPLETED) =3D=3D 0) && > IGB_TX_TRYLOCK(txr)) { > - err =3D igb_mq_start_locked(ifp, txr, m); > + struct mbuf *pm =3D NULL; > + /* > + ** Try to queue first to avoid > + ** out-of-order delivery, but=20 > + ** settle for it if that fails > + */ > + if (m && drbr_enqueue(ifp, txr->br, m)) > + pm =3D m; > + err =3D igb_mq_start_locked(ifp, txr, pm); > IGB_TX_UNLOCK(txr); > } else { Why not just enqueue / start with NULL ? err =3D drbr_enqueue(ifp, txr->br, m); igb_mq_start_locked(ifp, txr, NULL); It seems that in case the queue is full you will send out of order with = the current patch. > err =3D drbr_enqueue(ifp, txr->br, m); > @@ -981,7 +989,7 @@ igb_mq_start_locked(struct ifnet *ifp, s > IGB_TX_LOCK_ASSERT(txr); >=20 > if (((ifp->if_drv_flags & IFF_DRV_RUNNING) =3D=3D 0) || > - (txr->queue_status =3D=3D IGB_QUEUE_DEPLETED) || > + (txr->queue_status & IGB_QUEUE_DEPLETED) || > adapter->link_active =3D=3D 0) { > if (m !=3D NULL) > err =3D drbr_enqueue(ifp, txr->br, m); --Apple-Mail=_355BEF34-3FDC-4197-8401-CC7FF59FF36E-- From owner-svn-src-head@FreeBSD.ORG Tue Aug 7 09:22:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFB9B106566B; Tue, 7 Aug 2012 09:22:46 +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 AAECA8FC0A; Tue, 7 Aug 2012 09:22:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q779Mk8b044290; Tue, 7 Aug 2012 09:22:46 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q779MkPx044288; Tue, 7 Aug 2012 09:22:46 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201208070922.q779MkPx044288@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 7 Aug 2012 09:22:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239127 - head/sys/boot/common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Aug 2012 09:22:46 -0000 Author: ae Date: Tue Aug 7 09:22:46 2012 New Revision: 239127 URL: http://svn.freebsd.org/changeset/base/239127 Log: As it turned out, there are some installations, where BSD label contains partitions with type zero. And it has worked. So, allow detect these partitions. Reported by: glebius Modified: head/sys/boot/common/part.c Modified: head/sys/boot/common/part.c ============================================================================== --- head/sys/boot/common/part.c Tue Aug 7 08:37:35 2012 (r239126) +++ head/sys/boot/common/part.c Tue Aug 7 09:22:46 2012 (r239127) @@ -466,7 +466,7 @@ ptable_bsdread(struct ptable *table, voi for (i = 0; i < dl->d_npartitions; i++, part++) { if (i == RAW_PART) continue; - if (part->p_size == 0 || part->p_fstype == 0) + if (part->p_size == 0) continue; entry = malloc(sizeof(*entry)); if (entry == NULL) From owner-svn-src-head@FreeBSD.ORG Tue Aug 7 12:40:32 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 941BB106566C; Tue, 7 Aug 2012 12:40:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 804DE8FC14; Tue, 7 Aug 2012 12:40:32 +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 q77CeWQT062309; Tue, 7 Aug 2012 12:40:32 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q77CeWKm062306; Tue, 7 Aug 2012 12:40:32 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201208071240.q77CeWKm062306@svn.freebsd.org> From: John Baldwin Date: Tue, 7 Aug 2012 12:40:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239128 - head/sys/dev/ipmi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Aug 2012 12:40:32 -0000 Author: jhb Date: Tue Aug 7 12:40:31 2012 New Revision: 239128 URL: http://svn.freebsd.org/changeset/base/239128 Log: Don't try to stop the IPMI watchdog timer if it is not running. Starting or stopping the IPMI watchdog is rather expensive with the current implementation as all IPMI requests are bounced via thread. This is not viable during shutdown or dumps, and this avoids headache in the common case that the watchdog is not enabled. The IPMI watchdog should probably be reworked to not use a separate thread to fix this in the case when the watchdog timer is enabled. MFC after: 2 weeks Modified: head/sys/dev/ipmi/ipmi.c head/sys/dev/ipmi/ipmivars.h Modified: head/sys/dev/ipmi/ipmi.c ============================================================================== --- head/sys/dev/ipmi/ipmi.c Tue Aug 7 09:22:46 2012 (r239127) +++ head/sys/dev/ipmi/ipmi.c Tue Aug 7 12:40:31 2012 (r239128) @@ -653,11 +653,12 @@ ipmi_wd_event(void *arg, unsigned int cm if (timeout == 0) timeout = 1; e = ipmi_set_watchdog(sc, timeout); - if (e == 0) + if (e == 0) { *error = 0; - else + sc->ipmi_watchdog_active = 1; + } else (void)ipmi_set_watchdog(sc, 0); - } else { + } else if (atomic_readandclear_int(&sc->ipmi_watchdog_active) != 0) { e = ipmi_set_watchdog(sc, 0); if (e != 0 && cmd == 0) *error = EOPNOTSUPP; Modified: head/sys/dev/ipmi/ipmivars.h ============================================================================== --- head/sys/dev/ipmi/ipmivars.h Tue Aug 7 09:22:46 2012 (r239127) +++ head/sys/dev/ipmi/ipmivars.h Tue Aug 7 12:40:31 2012 (r239128) @@ -105,6 +105,7 @@ struct ipmi_softc { struct cdev *ipmi_cdev; TAILQ_HEAD(,ipmi_request) ipmi_pending_requests; eventhandler_tag ipmi_watchdog_tag; + int ipmi_watchdog_active; struct intr_config_hook ipmi_ich; struct mtx ipmi_lock; struct cv ipmi_request_added; From owner-svn-src-head@FreeBSD.ORG Tue Aug 7 13:11:48 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7D003106566C; Tue, 7 Aug 2012 13:11:48 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 67CAC8FC08; Tue, 7 Aug 2012 13:11: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 q77DBmcC064806; Tue, 7 Aug 2012 13:11:48 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q77DBmi6064804; Tue, 7 Aug 2012 13:11:48 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201208071311.q77DBmi6064804@svn.freebsd.org> From: Ed Maste Date: Tue, 7 Aug 2012 13:11:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239130 - head/share/examples/kld/dyn_sysctl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Aug 2012 13:11:48 -0000 Author: emaste Date: Tue Aug 7 13:11:47 2012 New Revision: 239130 URL: http://svn.freebsd.org/changeset/base/239130 Log: Minor style(9) improvement Modified: head/share/examples/kld/dyn_sysctl/dyn_sysctl.c Modified: head/share/examples/kld/dyn_sysctl/dyn_sysctl.c ============================================================================== --- head/share/examples/kld/dyn_sysctl/dyn_sysctl.c Tue Aug 7 12:45:46 2012 (r239129) +++ head/share/examples/kld/dyn_sysctl/dyn_sysctl.c Tue Aug 7 13:11:47 2012 (r239130) @@ -59,7 +59,7 @@ load(module_t mod, int cmd, void *arg) error = 0; switch (cmd) { - case MOD_LOAD : + case MOD_LOAD: /* Initialize the contexts */ printf("Initializing contexts and creating subtrees.\n\n"); sysctl_ctx_init(&clist); @@ -123,7 +123,7 @@ load(module_t mod, int cmd, void *arg) OID_AUTO, "string_c", CTLFLAG_RD, c, 0, "shouldn't panic"); printf("3. (%p) /kern/dyn_sysctl bad (WRONG!)\n", &clist2); break; - case MOD_UNLOAD : + case MOD_UNLOAD: printf("1. Try to free ctx1 (%p): ", &clist); if (sysctl_ctx_free(&clist) != 0) printf("failed: expected. Need to remove ctx3 first.\n"); @@ -153,7 +153,7 @@ load(module_t mod, int cmd, void *arg) } else printf("Ok\n"); break; - default : + default: error = EOPNOTSUPP; break; } From owner-svn-src-head@FreeBSD.ORG Tue Aug 7 18:50:34 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5802110657D0; Tue, 7 Aug 2012 18:50:34 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 40A5D8FC15; Tue, 7 Aug 2012 18: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 q77IoYTS093330; Tue, 7 Aug 2012 18:50:34 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q77IoYSi093328; Tue, 7 Aug 2012 18:50:34 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201208071850.q77IoYSi093328@svn.freebsd.org> From: Mikolaj Golub Date: Tue, 7 Aug 2012 18:50:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239131 - head/sys/geom/gate X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Aug 2012 18:50:34 -0000 Author: trociny Date: Tue Aug 7 18:50:33 2012 New Revision: 239131 URL: http://svn.freebsd.org/changeset/base/239131 Log: In g_gate_dumpconf() always check the result of g_gate_hold(). This fixes "Negative sc_ref" panic possible when sysctl_kern_geom_confxml() is run simultaneously with destroying GATE device. Reviewed by: pjd MFC after: 3 days Modified: head/sys/geom/gate/g_gate.c Modified: head/sys/geom/gate/g_gate.c ============================================================================== --- head/sys/geom/gate/g_gate.c Tue Aug 7 13:11:47 2012 (r239130) +++ head/sys/geom/gate/g_gate.c Tue Aug 7 18:50:33 2012 (r239131) @@ -398,7 +398,9 @@ g_gate_dumpconf(struct sbuf *sb, const c sc = gp->softc; if (sc == NULL || pp != NULL || cp != NULL) return; - g_gate_hold(sc->sc_unit, NULL); + sc = g_gate_hold(sc->sc_unit, NULL); + if (sc == NULL) + return; if ((sc->sc_flags & G_GATE_FLAG_READONLY) != 0) { sbuf_printf(sb, "%s%s\n", indent, "read-only"); } else if ((sc->sc_flags & G_GATE_FLAG_WRITEONLY) != 0) { From owner-svn-src-head@FreeBSD.ORG Tue Aug 7 20:16:10 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B3CE41065670; Tue, 7 Aug 2012 20:16:10 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F4AB8FC0A; Tue, 7 Aug 2012 20:16:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q77KGAGp000970; Tue, 7 Aug 2012 20:16:10 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q77KGAX9000968; Tue, 7 Aug 2012 20:16:10 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201208072016.q77KGAX9000968@svn.freebsd.org> From: Jim Harris Date: Tue, 7 Aug 2012 20:16:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239132 - head/sys/geom X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Aug 2012 20:16:10 -0000 Author: jimharris Date: Tue Aug 7 20:16:10 2012 New Revision: 239132 URL: http://svn.freebsd.org/changeset/base/239132 Log: Clone BIO_ORDERED flag, for disk drivers (namely CAM) that try to consume it. Sponsored by: Intel Discussed with: gibbs, scottl Modified: head/sys/geom/geom_io.c Modified: head/sys/geom/geom_io.c ============================================================================== --- head/sys/geom/geom_io.c Tue Aug 7 18:50:33 2012 (r239131) +++ head/sys/geom/geom_io.c Tue Aug 7 20:16:10 2012 (r239132) @@ -177,6 +177,12 @@ g_clone_bio(struct bio *bp) if (bp2 != NULL) { bp2->bio_parent = bp; bp2->bio_cmd = bp->bio_cmd; + /* + * BIO_ORDERED flag may be used by disk drivers to enforce + * ordering restrictions, so this flag needs to be cloned. + * Other bio flags are not suitable for cloning. + */ + bp2->bio_flags = bp->bio_flags & BIO_ORDERED; bp2->bio_length = bp->bio_length; bp2->bio_offset = bp->bio_offset; bp2->bio_data = bp->bio_data; From owner-svn-src-head@FreeBSD.ORG Tue Aug 7 23:16:12 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A66891065670; Tue, 7 Aug 2012 23:16:12 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 915F38FC12; Tue, 7 Aug 2012 23:16:12 +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 q77NGCQn016538; Tue, 7 Aug 2012 23:16:12 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q77NGC2s016536; Tue, 7 Aug 2012 23:16:12 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201208072316.q77NGC2s016536@svn.freebsd.org> From: Jim Harris Date: Tue, 7 Aug 2012 23:16:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239133 - head/sys/x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Aug 2012 23:16:12 -0000 Author: jimharris Date: Tue Aug 7 23:16:11 2012 New Revision: 239133 URL: http://svn.freebsd.org/changeset/base/239133 Log: During TSC synchronization test, use rdtsc() rather than rdtsc32(), to protect against 32-bit TSC overflow while the sync test is running. On dual-socket Xeon E5-2600 (SNB) systems with up to 32 threads, there is non-trivial chance (2-3%) that TSC synchronization test fails due to 32-bit TSC overflow while the synchronization test is running. Sponsored by: Intel Reviewed by: jkim Discussed with: jkim, kib Modified: head/sys/x86/x86/tsc.c Modified: head/sys/x86/x86/tsc.c ============================================================================== --- head/sys/x86/x86/tsc.c Tue Aug 7 20:16:10 2012 (r239132) +++ head/sys/x86/x86/tsc.c Tue Aug 7 23:16:11 2012 (r239133) @@ -363,11 +363,11 @@ init_TSC(void) static void \ tsc_read_##x(void *arg) \ { \ - uint32_t *tsc = arg; \ + uint64_t *tsc = arg; \ u_int cpu = PCPU_GET(cpuid); \ \ __asm __volatile("cpuid" : : : "eax", "ebx", "ecx", "edx"); \ - tsc[cpu * 3 + x] = rdtsc32(); \ + tsc[cpu * 3 + x] = rdtsc(); \ } TSC_READ(0) TSC_READ(1) @@ -379,8 +379,8 @@ TSC_READ(2) static void comp_smp_tsc(void *arg) { - uint32_t *tsc; - int32_t d1, d2; + uint64_t *tsc; + int64_t d1, d2; u_int cpu = PCPU_GET(cpuid); u_int i, j, size; @@ -401,7 +401,7 @@ comp_smp_tsc(void *arg) static int test_smp_tsc(void) { - uint32_t *data, *tsc; + uint64_t *data, *tsc; u_int i, size; if (!smp_tsc && !tsc_is_invariant) From owner-svn-src-head@FreeBSD.ORG Tue Aug 7 23:45:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 096CE106564A; Tue, 7 Aug 2012 23:45:44 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E76DC8FC0C; Tue, 7 Aug 2012 23:45:43 +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 q77NjhYF019106; Tue, 7 Aug 2012 23:45:43 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q77NjhF9019104; Tue, 7 Aug 2012 23:45:43 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201208072345.q77NjhF9019104@svn.freebsd.org> From: Adrian Chadd Date: Tue, 7 Aug 2012 23:45:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239134 - head/sys/dev/ath/ath_hal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Aug 2012 23:45:44 -0000 Author: adrian Date: Tue Aug 7 23:45:43 2012 New Revision: 239134 URL: http://svn.freebsd.org/changeset/base/239134 Log: Commit device IDs for the (eventually upcoming) AR9380 HAL. Obtained from: Qualcomm Atheros, Linux ath9k Modified: head/sys/dev/ath/ath_hal/ah_devid.h Modified: head/sys/dev/ath/ath_hal/ah_devid.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah_devid.h Tue Aug 7 23:16:11 2012 (r239133) +++ head/sys/dev/ath/ath_hal/ah_devid.h Tue Aug 7 23:45:43 2012 (r239134) @@ -83,6 +83,15 @@ #define AR9287_DEVID_PCI 0x002d /* AR9227 PCI Kiwi */ #define AR9287_DEVID_PCIE 0x002e /* AR9287 PCI-E Kiwi */ +/* AR9300 */ +#define AR9300_DEVID_AR9380_PCIE 0x0030 +#define AR9300_DEVID_AR9340 0x0031 +#define AR9300_DEVID_AR9485_PCIE 0x0032 +#define AR9300_DEVID_AR9580_PCIE 0x0033 +#define AR9300_DEVID_AR946X_PCIE 0x0034 +#define AR9300_DEVID_AR9330 0x0035 +#define AR9300_DEVID_QCA955X 0x0039 + #define AR_SUBVENDOR_ID_NOG 0x0e11 /* No 11G subvendor ID */ #define AR_SUBVENDOR_ID_NEW_A 0x7065 /* Update device to new RD */ #endif /* _DEV_ATH_DEVID_H */ From owner-svn-src-head@FreeBSD.ORG Wed Aug 8 00:20:31 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A336C1065670; Wed, 8 Aug 2012 00:20:31 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F9148FC0A; Wed, 8 Aug 2012 00:20: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 q780KV4o022287; Wed, 8 Aug 2012 00:20:31 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q780KVjw022285; Wed, 8 Aug 2012 00:20:31 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208080020.q780KVjw022285@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 8 Aug 2012 00:20:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239135 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Aug 2012 00:20:31 -0000 Author: kib Date: Wed Aug 8 00:20:30 2012 New Revision: 239135 URL: http://svn.freebsd.org/changeset/base/239135 Log: Always initialize pl_event. Submitted by: Andrey Zonov MFC after: 3 days Modified: head/sys/kern/sys_process.c Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Tue Aug 7 23:45:43 2012 (r239134) +++ head/sys/kern/sys_process.c Wed Aug 8 00:20:30 2012 (r239135) @@ -1112,6 +1112,7 @@ kern_ptrace(struct thread *td, int req, #endif pl = addr; pl->pl_lwpid = td2->td_tid; + pl->pl_event = PL_EVENT_NONE; pl->pl_flags = 0; if (td2->td_dbgflags & TDB_XSIG) { pl->pl_event = PL_EVENT_SIGNAL; From owner-svn-src-head@FreeBSD.ORG Wed Aug 8 05:28:31 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A8762106564A; Wed, 8 Aug 2012 05:28:31 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 57C568FC08; Wed, 8 Aug 2012 05:28: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 q785SVj1047253; Wed, 8 Aug 2012 05:28:31 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q785SVnl047251; Wed, 8 Aug 2012 05:28:31 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201208080528.q785SVnl047251@svn.freebsd.org> From: Alan Cox Date: Wed, 8 Aug 2012 05:28:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239137 - head/sys/amd64/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Aug 2012 05:28:31 -0000 Author: alc Date: Wed Aug 8 05:28:30 2012 New Revision: 239137 URL: http://svn.freebsd.org/changeset/base/239137 Log: The assertion that I added in r238889 could legitimately fail when a debugger creates a breakpoint. Replace that assertion with a narrower one that still achieves my objective. Reported and tested by: kib Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Wed Aug 8 04:28:45 2012 (r239136) +++ head/sys/amd64/amd64/pmap.c Wed Aug 8 05:28:30 2012 (r239137) @@ -3445,7 +3445,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, KASSERT(va < UPT_MIN_ADDRESS || va >= UPT_MAX_ADDRESS, ("pmap_enter: invalid to pmap_enter page table pages (va: 0x%lx)", va)); - KASSERT((prot & access) == access, ("pmap_enter: access not in prot")); KASSERT((m->oflags & VPO_UNMANAGED) != 0 || va < kmi.clean_sva || va >= kmi.clean_eva, ("pmap_enter: managed mapping within the clean submap")); @@ -3458,6 +3457,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, newpte |= PG_M; if ((prot & VM_PROT_WRITE) != 0) newpte |= PG_RW; + KASSERT((newpte & (PG_M | PG_RW)) != PG_M, + ("pmap_enter: access includes VM_PROT_WRITE but prot doesn't")); if ((prot & VM_PROT_EXECUTE) == 0) newpte |= pg_nx; if (wired) From owner-svn-src-head@FreeBSD.ORG Wed Aug 8 09:42:45 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C0065106566B; Wed, 8 Aug 2012 09:42:45 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A8E1E8FC0A; Wed, 8 Aug 2012 09:42:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q789gjrn068104; Wed, 8 Aug 2012 09:42:45 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q789gjXA068060; Wed, 8 Aug 2012 09:42:45 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201208080942.q789gjXA068060@svn.freebsd.org> From: Andrew Turner Date: Wed, 8 Aug 2012 09:42:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239138 - in head/contrib/compiler-rt: . lib lib/arm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Aug 2012 09:42:45 -0000 Author: andrew Date: Wed Aug 8 09:42:44 2012 New Revision: 239138 URL: http://svn.freebsd.org/changeset/base/239138 Log: Import compiler-rt r160957. This is mostly a no-op other than for ARM where it adds missing __aeabi_mem* and __aeabi_*divmod functions. Even on ARM these will remain unused until the rest of the ARM EABI code is merged. Added: head/contrib/compiler-rt/lib/arm/aeabi_idivmod.S - copied unchanged from r239137, vendor/compiler-rt/dist/lib/arm/aeabi_idivmod.S head/contrib/compiler-rt/lib/arm/aeabi_ldivmod.S - copied unchanged from r239137, vendor/compiler-rt/dist/lib/arm/aeabi_ldivmod.S head/contrib/compiler-rt/lib/arm/aeabi_memcmp.S - copied unchanged from r239137, vendor/compiler-rt/dist/lib/arm/aeabi_memcmp.S head/contrib/compiler-rt/lib/arm/aeabi_memcpy.S - copied unchanged from r239137, vendor/compiler-rt/dist/lib/arm/aeabi_memcpy.S head/contrib/compiler-rt/lib/arm/aeabi_memmove.S - copied unchanged from r239137, vendor/compiler-rt/dist/lib/arm/aeabi_memmove.S head/contrib/compiler-rt/lib/arm/aeabi_memset.S - copied unchanged from r239137, vendor/compiler-rt/dist/lib/arm/aeabi_memset.S head/contrib/compiler-rt/lib/arm/aeabi_uidivmod.S - copied unchanged from r239137, vendor/compiler-rt/dist/lib/arm/aeabi_uidivmod.S head/contrib/compiler-rt/lib/arm/aeabi_uldivmod.S - copied unchanged from r239137, vendor/compiler-rt/dist/lib/arm/aeabi_uldivmod.S head/contrib/compiler-rt/lib/atomic.c - copied unchanged from r239137, vendor/compiler-rt/dist/lib/atomic.c Modified: head/contrib/compiler-rt/LICENSE.TXT head/contrib/compiler-rt/lib/absvti2.c head/contrib/compiler-rt/lib/adddf3.c head/contrib/compiler-rt/lib/addsf3.c head/contrib/compiler-rt/lib/addvti3.c head/contrib/compiler-rt/lib/ashldi3.c head/contrib/compiler-rt/lib/ashlti3.c head/contrib/compiler-rt/lib/ashrdi3.c head/contrib/compiler-rt/lib/ashrti3.c head/contrib/compiler-rt/lib/assembly.h head/contrib/compiler-rt/lib/clzti2.c head/contrib/compiler-rt/lib/cmpti2.c head/contrib/compiler-rt/lib/ctzti2.c head/contrib/compiler-rt/lib/divdf3.c head/contrib/compiler-rt/lib/divmoddi4.c head/contrib/compiler-rt/lib/divsf3.c head/contrib/compiler-rt/lib/divsi3.c head/contrib/compiler-rt/lib/divti3.c head/contrib/compiler-rt/lib/extendsfdf2.c head/contrib/compiler-rt/lib/ffsti2.c head/contrib/compiler-rt/lib/fixdfdi.c head/contrib/compiler-rt/lib/fixdfsi.c head/contrib/compiler-rt/lib/fixdfti.c head/contrib/compiler-rt/lib/fixsfdi.c head/contrib/compiler-rt/lib/fixsfsi.c head/contrib/compiler-rt/lib/fixsfti.c head/contrib/compiler-rt/lib/fixunsdfdi.c head/contrib/compiler-rt/lib/fixunsdfsi.c head/contrib/compiler-rt/lib/fixunsdfti.c head/contrib/compiler-rt/lib/fixunssfdi.c head/contrib/compiler-rt/lib/fixunssfsi.c head/contrib/compiler-rt/lib/fixunssfti.c head/contrib/compiler-rt/lib/fixunsxfti.c head/contrib/compiler-rt/lib/fixxfti.c head/contrib/compiler-rt/lib/floatdidf.c head/contrib/compiler-rt/lib/floatdisf.c head/contrib/compiler-rt/lib/floatsidf.c head/contrib/compiler-rt/lib/floatsisf.c head/contrib/compiler-rt/lib/floattidf.c head/contrib/compiler-rt/lib/floattisf.c head/contrib/compiler-rt/lib/floattixf.c head/contrib/compiler-rt/lib/floatundidf.c head/contrib/compiler-rt/lib/floatundisf.c head/contrib/compiler-rt/lib/floatunsidf.c head/contrib/compiler-rt/lib/floatunsisf.c head/contrib/compiler-rt/lib/floatuntidf.c head/contrib/compiler-rt/lib/floatuntisf.c head/contrib/compiler-rt/lib/floatuntixf.c head/contrib/compiler-rt/lib/fp_lib.h head/contrib/compiler-rt/lib/int_endianness.h head/contrib/compiler-rt/lib/int_util.c head/contrib/compiler-rt/lib/int_util.h head/contrib/compiler-rt/lib/lshrdi3.c head/contrib/compiler-rt/lib/lshrti3.c head/contrib/compiler-rt/lib/modti3.c head/contrib/compiler-rt/lib/muldf3.c head/contrib/compiler-rt/lib/muldi3.c head/contrib/compiler-rt/lib/muloti4.c head/contrib/compiler-rt/lib/mulsf3.c head/contrib/compiler-rt/lib/multi3.c head/contrib/compiler-rt/lib/mulvti3.c head/contrib/compiler-rt/lib/negdf2.c head/contrib/compiler-rt/lib/negsf2.c head/contrib/compiler-rt/lib/negti2.c head/contrib/compiler-rt/lib/negvti2.c head/contrib/compiler-rt/lib/parityti2.c head/contrib/compiler-rt/lib/popcountti2.c head/contrib/compiler-rt/lib/powitf2.c head/contrib/compiler-rt/lib/subdf3.c head/contrib/compiler-rt/lib/subsf3.c head/contrib/compiler-rt/lib/subvti3.c head/contrib/compiler-rt/lib/truncdfsf2.c head/contrib/compiler-rt/lib/ucmpti2.c head/contrib/compiler-rt/lib/udivmoddi4.c head/contrib/compiler-rt/lib/udivmodti4.c head/contrib/compiler-rt/lib/udivsi3.c head/contrib/compiler-rt/lib/udivti3.c head/contrib/compiler-rt/lib/umodti3.c Directory Properties: head/contrib/compiler-rt/ (props changed) Modified: head/contrib/compiler-rt/LICENSE.TXT ============================================================================== --- head/contrib/compiler-rt/LICENSE.TXT Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/LICENSE.TXT Wed Aug 8 09:42:44 2012 (r239138) @@ -94,5 +94,4 @@ licenses, and/or restrictions: Program Directory ------- --------- -sysinfo lib/asan/sysinfo -mach_override lib/asan/mach_override +mach_override lib/interception/mach_override Modified: head/contrib/compiler-rt/lib/absvti2.c ============================================================================== --- head/contrib/compiler-rt/lib/absvti2.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/absvti2.c Wed Aug 8 09:42:44 2012 (r239138) @@ -12,10 +12,10 @@ * ===----------------------------------------------------------------------=== */ -#if __x86_64 - #include "int_lib.h" +#if __x86_64 + /* Returns: absolute value */ /* Effects: aborts if abs(x) < 0 */ Modified: head/contrib/compiler-rt/lib/adddf3.c ============================================================================== --- head/contrib/compiler-rt/lib/adddf3.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/adddf3.c Wed Aug 8 09:42:44 2012 (r239138) @@ -15,7 +15,7 @@ #define DOUBLE_PRECISION #include "fp_lib.h" -ARM_EABI_FNALIAS(dadd, adddf3); +ARM_EABI_FNALIAS(dadd, adddf3) COMPILER_RT_ABI fp_t __adddf3(fp_t a, fp_t b) { @@ -85,7 +85,7 @@ __adddf3(fp_t a, fp_t b) { // Shift the significand of b by the difference in exponents, with a sticky // bottom bit to get rounding correct. - const int align = aExponent - bExponent; + const unsigned int align = aExponent - bExponent; if (align) { if (align < typeWidth) { const bool sticky = bSignificand << (typeWidth - align); Modified: head/contrib/compiler-rt/lib/addsf3.c ============================================================================== --- head/contrib/compiler-rt/lib/addsf3.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/addsf3.c Wed Aug 8 09:42:44 2012 (r239138) @@ -15,7 +15,7 @@ #define SINGLE_PRECISION #include "fp_lib.h" -ARM_EABI_FNALIAS(fadd, addsf3); +ARM_EABI_FNALIAS(fadd, addsf3) fp_t __addsf3(fp_t a, fp_t b) { @@ -84,7 +84,7 @@ fp_t __addsf3(fp_t a, fp_t b) { // Shift the significand of b by the difference in exponents, with a sticky // bottom bit to get rounding correct. - const int align = aExponent - bExponent; + const unsigned int align = aExponent - bExponent; if (align) { if (align < typeWidth) { const bool sticky = bSignificand << (typeWidth - align); Modified: head/contrib/compiler-rt/lib/addvti3.c ============================================================================== --- head/contrib/compiler-rt/lib/addvti3.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/addvti3.c Wed Aug 8 09:42:44 2012 (r239138) @@ -12,10 +12,10 @@ * ===----------------------------------------------------------------------=== */ -#if __x86_64 - #include "int_lib.h" +#if __x86_64 + /* Returns: a + b */ /* Effects: aborts if a + b overflows */ Copied: head/contrib/compiler-rt/lib/arm/aeabi_idivmod.S (from r239137, vendor/compiler-rt/dist/lib/arm/aeabi_idivmod.S) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/compiler-rt/lib/arm/aeabi_idivmod.S Wed Aug 8 09:42:44 2012 (r239138, copy of r239137, vendor/compiler-rt/dist/lib/arm/aeabi_idivmod.S) @@ -0,0 +1,27 @@ +//===-- aeabi_idivmod.S - EABI idivmod implementation ---------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "../assembly.h" + +// struct { int quot, int rem} __aeabi_idivmod(int numerator, int denominator) { +// int rem, quot; +// quot = __divmodsi4(numerator, denominator, &rem); +// return {quot, rem}; +// } + + .syntax unified + .align 2 +DEFINE_COMPILERRT_FUNCTION(__aeabi_idivmod) + push { lr } + sub sp, sp, #4 + mov r2, sp + bl SYMBOL_NAME(__divmodsi4) + ldr r1, [sp] + add sp, sp, #4 + pop { pc } Copied: head/contrib/compiler-rt/lib/arm/aeabi_ldivmod.S (from r239137, vendor/compiler-rt/dist/lib/arm/aeabi_ldivmod.S) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/compiler-rt/lib/arm/aeabi_ldivmod.S Wed Aug 8 09:42:44 2012 (r239138, copy of r239137, vendor/compiler-rt/dist/lib/arm/aeabi_ldivmod.S) @@ -0,0 +1,30 @@ +//===-- aeabi_ldivmod.S - EABI ldivmod implementation ---------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "../assembly.h" + +// struct { int64_t quot, int64_t rem} +// __aeabi_ldivmod(int64_t numerator, int64_t denominator) { +// int64_t rem, quot; +// quot = __divmoddi4(numerator, denominator, &rem); +// return {quot, rem}; +// } + + .syntax unified + .align 2 +DEFINE_COMPILERRT_FUNCTION(__aeabi_ldivmod) + push {r11, lr} + sub sp, sp, #16 + add r12, sp, #8 + str r12, [sp] + bl SYMBOL_NAME(__divmoddi4) + ldr r2, [sp, #8] + ldr r3, [sp, #12] + add sp, sp, #16 + pop {r11, pc} Copied: head/contrib/compiler-rt/lib/arm/aeabi_memcmp.S (from r239137, vendor/compiler-rt/dist/lib/arm/aeabi_memcmp.S) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/compiler-rt/lib/arm/aeabi_memcmp.S Wed Aug 8 09:42:44 2012 (r239138, copy of r239137, vendor/compiler-rt/dist/lib/arm/aeabi_memcmp.S) @@ -0,0 +1,19 @@ +//===-- aeabi_memcmp.S - EABI memcmp implementation -----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "../assembly.h" + +// void __aeabi_memcmp(void *dest, void *src, size_t n) { memcmp(dest, src, n); } + + .align 2 +DEFINE_COMPILERRT_FUNCTION(__aeabi_memcmp) + b memcmp + +DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memcmp4, __aeabi_memcmp) +DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memcmp8, __aeabi_memcmp) Copied: head/contrib/compiler-rt/lib/arm/aeabi_memcpy.S (from r239137, vendor/compiler-rt/dist/lib/arm/aeabi_memcpy.S) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/compiler-rt/lib/arm/aeabi_memcpy.S Wed Aug 8 09:42:44 2012 (r239138, copy of r239137, vendor/compiler-rt/dist/lib/arm/aeabi_memcpy.S) @@ -0,0 +1,19 @@ +//===-- aeabi_memcpy.S - EABI memcpy implementation -----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "../assembly.h" + +// void __aeabi_memcpy(void *dest, void *src, size_t n) { memcpy(dest, src, n); } + + .align 2 +DEFINE_COMPILERRT_FUNCTION(__aeabi_memcpy) + b memcpy + +DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memcpy4, __aeabi_memcpy) +DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memcpy8, __aeabi_memcpy) Copied: head/contrib/compiler-rt/lib/arm/aeabi_memmove.S (from r239137, vendor/compiler-rt/dist/lib/arm/aeabi_memmove.S) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/compiler-rt/lib/arm/aeabi_memmove.S Wed Aug 8 09:42:44 2012 (r239138, copy of r239137, vendor/compiler-rt/dist/lib/arm/aeabi_memmove.S) @@ -0,0 +1,19 @@ +//===-- aeabi_memmove.S - EABI memmove implementation --------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===---------------------------------------------------------------------===// + +#include "../assembly.h" + +// void __aeabi_memmove(void *dest, void *src, size_t n) { memmove(dest, src, n); } + + .align 2 +DEFINE_COMPILERRT_FUNCTION(__aeabi_memmove) + b memmove + +DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memmove4, __aeabi_memmove) +DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memmove8, __aeabi_memmove) Copied: head/contrib/compiler-rt/lib/arm/aeabi_memset.S (from r239137, vendor/compiler-rt/dist/lib/arm/aeabi_memset.S) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/compiler-rt/lib/arm/aeabi_memset.S Wed Aug 8 09:42:44 2012 (r239138, copy of r239137, vendor/compiler-rt/dist/lib/arm/aeabi_memset.S) @@ -0,0 +1,32 @@ +//===-- aeabi_memset.S - EABI memset implementation -----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "../assembly.h" + +// void __aeabi_memset(void *dest, size_t n, int c) { memset(dest, c, n); } +// void __aeabi_memclr(void *dest, size_t n) { __aeabi_memset(dest, n, 0); } + + .align 2 +DEFINE_COMPILERRT_FUNCTION(__aeabi_memset) + mov r3, r1 + mov r1, r2 + mov r2, r3 + b memset + +DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memset4, __aeabi_memset) +DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memset8, __aeabi_memset) + +DEFINE_COMPILERRT_FUNCTION(__aeabi_memclr) + mov r2, r1 + mov r1, #0 + b memset + +DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memclr4, __aeabi_memclr) +DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memclr8, __aeabi_memclr) + Copied: head/contrib/compiler-rt/lib/arm/aeabi_uidivmod.S (from r239137, vendor/compiler-rt/dist/lib/arm/aeabi_uidivmod.S) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/compiler-rt/lib/arm/aeabi_uidivmod.S Wed Aug 8 09:42:44 2012 (r239138, copy of r239137, vendor/compiler-rt/dist/lib/arm/aeabi_uidivmod.S) @@ -0,0 +1,28 @@ +//===-- aeabi_uidivmod.S - EABI uidivmod implementation -------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "../assembly.h" + +// struct { unsigned quot, unsigned rem} +// __aeabi_uidivmod(unsigned numerator, unsigned denominator) { +// unsigned rem, quot; +// quot = __udivmodsi4(numerator, denominator, &rem); +// return {quot, rem}; +// } + + .syntax unified + .align 2 +DEFINE_COMPILERRT_FUNCTION(__aeabi_uidivmod) + push { lr } + sub sp, sp, #4 + mov r2, sp + bl SYMBOL_NAME(__udivmodsi4) + ldr r1, [sp] + add sp, sp, #4 + pop { pc } Copied: head/contrib/compiler-rt/lib/arm/aeabi_uldivmod.S (from r239137, vendor/compiler-rt/dist/lib/arm/aeabi_uldivmod.S) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/compiler-rt/lib/arm/aeabi_uldivmod.S Wed Aug 8 09:42:44 2012 (r239138, copy of r239137, vendor/compiler-rt/dist/lib/arm/aeabi_uldivmod.S) @@ -0,0 +1,30 @@ +//===-- aeabi_uldivmod.S - EABI uldivmod implementation -------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "../assembly.h" + +// struct { uint64_t quot, uint64_t rem} +// __aeabi_uldivmod(uint64_t numerator, uint64_t denominator) { +// uint64_t rem, quot; +// quot = __udivmoddi4(numerator, denominator, &rem); +// return {quot, rem}; +// } + + .syntax unified + .align 2 +DEFINE_COMPILERRT_FUNCTION(__aeabi_uldivmod) + push {r11, lr} + sub sp, sp, #16 + add r12, sp, #8 + str r12, [sp] + bl SYMBOL_NAME(__udivmoddi4) + ldr r2, [sp, #8] + ldr r3, [sp, #12] + add sp, sp, #16 + pop {r11, pc} \ No newline at end of file Modified: head/contrib/compiler-rt/lib/ashldi3.c ============================================================================== --- head/contrib/compiler-rt/lib/ashldi3.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/ashldi3.c Wed Aug 8 09:42:44 2012 (r239138) @@ -18,7 +18,7 @@ /* Precondition: 0 <= b < bits_in_dword */ -ARM_EABI_FNALIAS(llsl, ashldi3); +ARM_EABI_FNALIAS(llsl, ashldi3) COMPILER_RT_ABI di_int __ashldi3(di_int a, si_int b) Modified: head/contrib/compiler-rt/lib/ashlti3.c ============================================================================== --- head/contrib/compiler-rt/lib/ashlti3.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/ashlti3.c Wed Aug 8 09:42:44 2012 (r239138) @@ -12,10 +12,10 @@ * ===----------------------------------------------------------------------=== */ -#if __x86_64 - #include "int_lib.h" +#if __x86_64 + /* Returns: a << b */ /* Precondition: 0 <= b < bits_in_tword */ Modified: head/contrib/compiler-rt/lib/ashrdi3.c ============================================================================== --- head/contrib/compiler-rt/lib/ashrdi3.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/ashrdi3.c Wed Aug 8 09:42:44 2012 (r239138) @@ -18,7 +18,7 @@ /* Precondition: 0 <= b < bits_in_dword */ -ARM_EABI_FNALIAS(lasr, ashrdi3); +ARM_EABI_FNALIAS(lasr, ashrdi3) COMPILER_RT_ABI di_int __ashrdi3(di_int a, si_int b) Modified: head/contrib/compiler-rt/lib/ashrti3.c ============================================================================== --- head/contrib/compiler-rt/lib/ashrti3.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/ashrti3.c Wed Aug 8 09:42:44 2012 (r239138) @@ -12,10 +12,10 @@ * ===----------------------------------------------------------------------=== */ -#if __x86_64 - #include "int_lib.h" +#if __x86_64 + /* Returns: arithmetic a >> b */ /* Precondition: 0 <= b < bits_in_tword */ Modified: head/contrib/compiler-rt/lib/assembly.h ============================================================================== --- head/contrib/compiler-rt/lib/assembly.h Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/assembly.h Wed Aug 8 09:42:44 2012 (r239138) @@ -25,9 +25,11 @@ #if defined(__APPLE__) #define HIDDEN_DIRECTIVE .private_extern #define LOCAL_LABEL(name) L_##name +#define FILE_LEVEL_DIRECTIVE .subsections_via_symbols #else #define HIDDEN_DIRECTIVE .hidden #define LOCAL_LABEL(name) .L_##name +#define FILE_LEVEL_DIRECTIVE #endif #define GLUE2(a, b) a ## b @@ -42,6 +44,7 @@ #endif #define DEFINE_COMPILERRT_FUNCTION(name) \ + FILE_LEVEL_DIRECTIVE SEPARATOR \ .globl SYMBOL_NAME(name) SEPARATOR \ DECLARE_SYMBOL_VISIBILITY(name) \ SYMBOL_NAME(name): Copied: head/contrib/compiler-rt/lib/atomic.c (from r239137, vendor/compiler-rt/dist/lib/atomic.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/compiler-rt/lib/atomic.c Wed Aug 8 09:42:44 2012 (r239138, copy of r239137, vendor/compiler-rt/dist/lib/atomic.c) @@ -0,0 +1,315 @@ +/*===-- atomic.c - Implement support functions for atomic operations.------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + *===----------------------------------------------------------------------=== + * + * atomic.c defines a set of functions for performing atomic accesses on + * arbitrary-sized memory locations. This design uses locks that should + * be fast in the uncontended case, for two reasons: + * + * 1) This code must work with C programs that do not link to anything + * (including pthreads) and so it should not depend on any pthread + * functions. + * 2) Atomic operations, rather than explicit mutexes, are most commonly used + * on code where contended operations are rate. + * + * To avoid needing a per-object lock, this code allocates an array of + * locks and hashes the object pointers to find the one that it should use. + * For operations that must be atomic on two locations, the lower lock is + * always acquired first, to avoid deadlock. + * + *===----------------------------------------------------------------------=== + */ + +#include +#include + +// Clang objects if you redefine a builtin. This little hack allows us to +// define a function with the same name as an intrinsic. +#pragma redefine_extname __atomic_load_c __atomic_load +#pragma redefine_extname __atomic_store_c __atomic_store +#pragma redefine_extname __atomic_exchange_c __atomic_exchange +#pragma redefine_extname __atomic_compare_exchange_c __atomic_compare_exchange + +/// Number of locks. This allocates one page on 32-bit platforms, two on +/// 64-bit. This can be specified externally if a different trade between +/// memory usage and contention probability is required for a given platform. +#ifndef SPINLOCK_COUNT +#define SPINLOCK_COUNT (1<<10) +#endif +static const long SPINLOCK_MASK = SPINLOCK_COUNT - 1; + +//////////////////////////////////////////////////////////////////////////////// +// Platform-specific lock implementation. Falls back to spinlocks if none is +// defined. Each platform should define the Lock type, and corresponding +// lock() and unlock() functions. +//////////////////////////////////////////////////////////////////////////////// +#ifdef __FreeBSD__ +#include +#include +#include +#include +typedef struct _usem Lock; +inline static void unlock(Lock *l) { + __c11_atomic_store((_Atomic(uint32_t)*)&l->_count, 1, __ATOMIC_RELEASE); + __c11_atomic_thread_fence(__ATOMIC_SEQ_CST); + if (l->_has_waiters) + _umtx_op(l, UMTX_OP_SEM_WAKE, 1, 0, 0); +} +inline static void lock(Lock *l) { + uint32_t old = 1; + while (!__c11_atomic_compare_exchange_weak((_Atomic(uint32_t)*)&l->_count, &old, + 0, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) { + _umtx_op(l, UMTX_OP_SEM_WAIT, 0, 0, 0); + old = 1; + } +} +/// locks for atomic operations +static Lock locks[SPINLOCK_COUNT] = { [0 ... SPINLOCK_COUNT-1] = {0,1,0} }; +#else +typedef _Atomic(uintptr_t) Lock; +/// Unlock a lock. This is a release operation. +inline static void unlock(Lock *l) { + __c11_atomic_store(l, 0, __ATOMIC_RELEASE); +} +/// Locks a lock. In the current implementation, this is potentially +/// unbounded in the contended case. +inline static void lock(Lock *l) { + uintptr_t old = 0; + while (!__c11_atomic_compare_exchange_weak(l, &old, 1, __ATOMIC_ACQUIRE, + __ATOMIC_RELAXED)) + old = 0; +} +/// locks for atomic operations +static Lock locks[SPINLOCK_COUNT]; +#endif + + +/// Returns a lock to use for a given pointer. +static inline Lock *lock_for_pointer(void *ptr) { + intptr_t hash = (intptr_t)ptr; + // Disregard the lowest 4 bits. We want all values that may be part of the + // same memory operation to hash to the same value and therefore use the same + // lock. + hash >>= 4; + // Use the next bits as the basis for the hash + intptr_t low = hash & SPINLOCK_MASK; + // Now use the high(er) set of bits to perturb the hash, so that we don't + // get collisions from atomic fields in a single object + hash >>= 16; + hash ^= low; + // Return a pointer to the word to use + return locks + (hash & SPINLOCK_MASK); +} + +/// Macros for determining whether a size is lock free. Clang can not yet +/// codegen __atomic_is_lock_free(16), so for now we assume 16-byte values are +/// not lock free. +#define IS_LOCK_FREE_1 __c11_atomic_is_lock_free(1) +#define IS_LOCK_FREE_2 __c11_atomic_is_lock_free(2) +#define IS_LOCK_FREE_4 __c11_atomic_is_lock_free(4) +#define IS_LOCK_FREE_8 __c11_atomic_is_lock_free(8) +#define IS_LOCK_FREE_16 0 + +/// Macro that calls the compiler-generated lock-free versions of functions +/// when they exist. +#define LOCK_FREE_CASES() \ + do {\ + switch (size) {\ + case 2:\ + if (IS_LOCK_FREE_2) {\ + LOCK_FREE_ACTION(uint16_t);\ + }\ + case 4:\ + if (IS_LOCK_FREE_4) {\ + LOCK_FREE_ACTION(uint32_t);\ + }\ + case 8:\ + if (IS_LOCK_FREE_8) {\ + LOCK_FREE_ACTION(uint64_t);\ + }\ + case 16:\ + if (IS_LOCK_FREE_16) {\ + /* FIXME: __uint128_t isn't available on 32 bit platforms. + LOCK_FREE_ACTION(__uint128_t);*/\ + }\ + }\ + } while (0) + + +/// An atomic load operation. This is atomic with respect to the source +/// pointer only. +void __atomic_load_c(int size, void *src, void *dest, int model) { +#define LOCK_FREE_ACTION(type) \ + *((type*)dest) = __c11_atomic_load((_Atomic(type)*)src, model);\ + return; + LOCK_FREE_CASES(); +#undef LOCK_FREE_ACTION + Lock *l = lock_for_pointer(src); + lock(l); + memcpy(dest, src, size); + unlock(l); +} + +/// An atomic store operation. This is atomic with respect to the destination +/// pointer only. +void __atomic_store_c(int size, void *dest, void *src, int model) { +#define LOCK_FREE_ACTION(type) \ + __c11_atomic_store((_Atomic(type)*)dest, *(type*)dest, model);\ + return; + LOCK_FREE_CASES(); +#undef LOCK_FREE_ACTION + Lock *l = lock_for_pointer(dest); + lock(l); + memcpy(dest, src, size); + unlock(l); +} + +/// Atomic compare and exchange operation. If the value at *ptr is identical +/// to the value at *expected, then this copies value at *desired to *ptr. If +/// they are not, then this stores the current value from *ptr in *expected. +/// +/// This function returns 1 if the exchange takes place or 0 if it fails. +int __atomic_compare_exchange_c(int size, void *ptr, void *expected, + void *desired, int success, int failure) { +#define LOCK_FREE_ACTION(type) \ + return __c11_atomic_compare_exchange_strong((_Atomic(type)*)ptr, (type*)expected,\ + *(type*)desired, success, failure) + LOCK_FREE_CASES(); +#undef LOCK_FREE_ACTION + Lock *l = lock_for_pointer(ptr); + lock(l); + if (memcmp(ptr, expected, size) == 0) { + memcpy(ptr, desired, size); + unlock(l); + return 1; + } + memcpy(expected, ptr, size); + unlock(l); + return 0; +} + +/// Performs an atomic exchange operation between two pointers. This is atomic +/// with respect to the target address. +void __atomic_exchange_c(int size, void *ptr, void *val, void *old, int model) { +#define LOCK_FREE_ACTION(type) \ + *(type*)old = __c11_atomic_exchange((_Atomic(type)*)ptr, *(type*)val,\ + model);\ + return; + LOCK_FREE_CASES(); +#undef LOCK_FREE_ACTION + Lock *l = lock_for_pointer(ptr); + lock(l); + memcpy(old, ptr, size); + memcpy(ptr, val, size); + unlock(l); +} + +//////////////////////////////////////////////////////////////////////////////// +// Where the size is known at compile time, the compiler may emit calls to +// specialised versions of the above functions. +//////////////////////////////////////////////////////////////////////////////// +#define OPTIMISED_CASES\ + OPTIMISED_CASE(1, IS_LOCK_FREE_1, uint8_t)\ + OPTIMISED_CASE(2, IS_LOCK_FREE_2, uint16_t)\ + OPTIMISED_CASE(4, IS_LOCK_FREE_4, uint32_t)\ + OPTIMISED_CASE(8, IS_LOCK_FREE_8, uint64_t)\ + /* FIXME: __uint128_t isn't available on 32 bit platforms. + OPTIMISED_CASE(16, IS_LOCK_FREE_16, __uint128_t)*/\ + +#define OPTIMISED_CASE(n, lockfree, type)\ +type __atomic_load_##n(type *src, int model) {\ + if (lockfree)\ + return __c11_atomic_load((_Atomic(type)*)src, model);\ + Lock *l = lock_for_pointer(src);\ + lock(l);\ + type val = *src;\ + unlock(l);\ + return val;\ +} +OPTIMISED_CASES +#undef OPTIMISED_CASE + +#define OPTIMISED_CASE(n, lockfree, type)\ +void __atomic_store_##n(type *dest, type val, int model) {\ + if (lockfree) {\ + __c11_atomic_store((_Atomic(type)*)dest, val, model);\ + return;\ + }\ + Lock *l = lock_for_pointer(dest);\ + lock(l);\ + *dest = val;\ + unlock(l);\ + return;\ +} +OPTIMISED_CASES +#undef OPTIMISED_CASE + +#define OPTIMISED_CASE(n, lockfree, type)\ +type __atomic_exchange_##n(type *dest, type val, int model) {\ + if (lockfree)\ + return __c11_atomic_exchange((_Atomic(type)*)dest, val, model);\ + Lock *l = lock_for_pointer(dest);\ + lock(l);\ + type tmp = *dest;\ + *dest = val;\ + unlock(l);\ + return tmp;\ +} +OPTIMISED_CASES +#undef OPTIMISED_CASE + +#define OPTIMISED_CASE(n, lockfree, type)\ +int __atomic_compare_exchange_##n(type *ptr, type *expected, type desired,\ + int success, int failure) {\ + if (lockfree)\ + return __c11_atomic_compare_exchange_strong((_Atomic(type)*)ptr, expected, desired,\ + success, failure);\ + Lock *l = lock_for_pointer(ptr);\ + lock(l);\ + if (*ptr == *expected) {\ + *ptr = desired;\ + unlock(l);\ + return 1;\ + }\ + *expected = *ptr;\ + unlock(l);\ + return 0;\ +} +OPTIMISED_CASES +#undef OPTIMISED_CASE + +//////////////////////////////////////////////////////////////////////////////// +// Atomic read-modify-write operations for integers of various sizes. +//////////////////////////////////////////////////////////////////////////////// +#define ATOMIC_RMW(n, lockfree, type, opname, op) \ +type __atomic_fetch_##opname##_##n(type *ptr, type val, int model) {\ + if (lockfree) \ + return __c11_atomic_fetch_##opname((_Atomic(type)*)ptr, val, model);\ + Lock *l = lock_for_pointer(ptr);\ + lock(l);\ + type tmp = *ptr;\ + *ptr = tmp op val;\ + unlock(l);\ + return tmp;\ +} + +#define OPTIMISED_CASE(n, lockfree, type) ATOMIC_RMW(n, lockfree, type, add, +) +OPTIMISED_CASES +#undef OPTIMISED_CASE +#define OPTIMISED_CASE(n, lockfree, type) ATOMIC_RMW(n, lockfree, type, sub, -) +OPTIMISED_CASES +#undef OPTIMISED_CASE +#define OPTIMISED_CASE(n, lockfree, type) ATOMIC_RMW(n, lockfree, type, and, &) +OPTIMISED_CASES +#undef OPTIMISED_CASE +#define OPTIMISED_CASE(n, lockfree, type) ATOMIC_RMW(n, lockfree, type, or, |) +OPTIMISED_CASES +#undef OPTIMISED_CASE +#define OPTIMISED_CASE(n, lockfree, type) ATOMIC_RMW(n, lockfree, type, xor, ^) +OPTIMISED_CASES +#undef OPTIMISED_CASE Modified: head/contrib/compiler-rt/lib/clzti2.c ============================================================================== --- head/contrib/compiler-rt/lib/clzti2.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/clzti2.c Wed Aug 8 09:42:44 2012 (r239138) @@ -12,10 +12,10 @@ * ===----------------------------------------------------------------------=== */ -#if __x86_64 - #include "int_lib.h" +#if __x86_64 + /* Returns: the number of leading 0-bits */ /* Precondition: a != 0 */ Modified: head/contrib/compiler-rt/lib/cmpti2.c ============================================================================== --- head/contrib/compiler-rt/lib/cmpti2.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/cmpti2.c Wed Aug 8 09:42:44 2012 (r239138) @@ -12,10 +12,10 @@ * ===----------------------------------------------------------------------=== */ -#if __x86_64 - #include "int_lib.h" +#if __x86_64 + /* Returns: if (a < b) returns 0 * if (a == b) returns 1 * if (a > b) returns 2 Modified: head/contrib/compiler-rt/lib/ctzti2.c ============================================================================== --- head/contrib/compiler-rt/lib/ctzti2.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/ctzti2.c Wed Aug 8 09:42:44 2012 (r239138) @@ -12,10 +12,10 @@ * ===----------------------------------------------------------------------=== */ -#if __x86_64 - #include "int_lib.h" +#if __x86_64 + /* Returns: the number of trailing 0-bits */ /* Precondition: a != 0 */ Modified: head/contrib/compiler-rt/lib/divdf3.c ============================================================================== --- head/contrib/compiler-rt/lib/divdf3.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/divdf3.c Wed Aug 8 09:42:44 2012 (r239138) @@ -19,7 +19,7 @@ #define DOUBLE_PRECISION #include "fp_lib.h" -ARM_EABI_FNALIAS(ddiv, divdf3); +ARM_EABI_FNALIAS(ddiv, divdf3) fp_t __divdf3(fp_t a, fp_t b) { Modified: head/contrib/compiler-rt/lib/divmoddi4.c ============================================================================== --- head/contrib/compiler-rt/lib/divmoddi4.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/divmoddi4.c Wed Aug 8 09:42:44 2012 (r239138) @@ -16,8 +16,6 @@ extern COMPILER_RT_ABI di_int __divdi3(di_int a, di_int b); -ARM_EABI_FNALIAS(ldivmod, divmoddi4); - /* Returns: a / b, *rem = a % b */ COMPILER_RT_ABI di_int Modified: head/contrib/compiler-rt/lib/divsf3.c ============================================================================== --- head/contrib/compiler-rt/lib/divsf3.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/divsf3.c Wed Aug 8 09:42:44 2012 (r239138) @@ -19,7 +19,7 @@ #define SINGLE_PRECISION #include "fp_lib.h" -ARM_EABI_FNALIAS(fdiv, divsf3); +ARM_EABI_FNALIAS(fdiv, divsf3) fp_t __divsf3(fp_t a, fp_t b) { Modified: head/contrib/compiler-rt/lib/divsi3.c ============================================================================== --- head/contrib/compiler-rt/lib/divsi3.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/divsi3.c Wed Aug 8 09:42:44 2012 (r239138) @@ -18,7 +18,7 @@ su_int COMPILER_RT_ABI __udivsi3(su_int /* Returns: a / b */ -ARM_EABI_FNALIAS(idiv, divsi3); +ARM_EABI_FNALIAS(idiv, divsi3) COMPILER_RT_ABI si_int __divsi3(si_int a, si_int b) @@ -29,5 +29,11 @@ __divsi3(si_int a, si_int b) a = (a ^ s_a) - s_a; /* negate if s_a == -1 */ b = (b ^ s_b) - s_b; /* negate if s_b == -1 */ s_a ^= s_b; /* sign of quotient */ - return (__udivsi3(a, b) ^ s_a) - s_a; /* negate if s_a == -1 */ + /* + * On CPUs without unsigned hardware division support, + * this calls __udivsi3 (notice the cast to su_int). + * On CPUs with unsigned hardware division support, + * this uses the unsigned division instruction. + */ + return ((su_int)a/(su_int)b ^ s_a) - s_a; /* negate if s_a == -1 */ } Modified: head/contrib/compiler-rt/lib/divti3.c ============================================================================== --- head/contrib/compiler-rt/lib/divti3.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/divti3.c Wed Aug 8 09:42:44 2012 (r239138) @@ -12,10 +12,10 @@ * ===----------------------------------------------------------------------=== */ -#if __x86_64 - #include "int_lib.h" +#if __x86_64 + tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem); /* Returns: a / b */ Modified: head/contrib/compiler-rt/lib/extendsfdf2.c ============================================================================== --- head/contrib/compiler-rt/lib/extendsfdf2.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/extendsfdf2.c Wed Aug 8 09:42:44 2012 (r239138) @@ -66,7 +66,7 @@ static inline dst_t dstFromRep(dst_rep_t // End helper routines. Conversion implementation follows. -ARM_EABI_FNALIAS(f2d, extendsfdf2); +ARM_EABI_FNALIAS(f2d, extendsfdf2) dst_t __extendsfdf2(src_t a) { Modified: head/contrib/compiler-rt/lib/ffsti2.c ============================================================================== --- head/contrib/compiler-rt/lib/ffsti2.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/ffsti2.c Wed Aug 8 09:42:44 2012 (r239138) @@ -12,10 +12,10 @@ * ===----------------------------------------------------------------------=== */ -#if __x86_64 - #include "int_lib.h" +#if __x86_64 + /* Returns: the index of the least significant 1-bit in a, or * the value zero if a is zero. The least significant bit is index one. */ Modified: head/contrib/compiler-rt/lib/fixdfdi.c ============================================================================== --- head/contrib/compiler-rt/lib/fixdfdi.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/fixdfdi.c Wed Aug 8 09:42:44 2012 (r239138) @@ -23,7 +23,7 @@ /* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */ -ARM_EABI_FNALIAS(d2lz, fixdfdi); +ARM_EABI_FNALIAS(d2lz, fixdfdi) di_int __fixdfdi(double a) Modified: head/contrib/compiler-rt/lib/fixdfsi.c ============================================================================== --- head/contrib/compiler-rt/lib/fixdfsi.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/fixdfsi.c Wed Aug 8 09:42:44 2012 (r239138) @@ -18,7 +18,7 @@ #include "int_lib.h" -ARM_EABI_FNALIAS(d2iz, fixdfsi); +ARM_EABI_FNALIAS(d2iz, fixdfsi) int __fixdfsi(fp_t a) { Modified: head/contrib/compiler-rt/lib/fixdfti.c ============================================================================== --- head/contrib/compiler-rt/lib/fixdfti.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/fixdfti.c Wed Aug 8 09:42:44 2012 (r239138) @@ -12,10 +12,10 @@ * ===----------------------------------------------------------------------=== */ -#if __x86_64 - #include "int_lib.h" +#if __x86_64 + /* Returns: convert a to a signed long long, rounding toward zero. */ /* Assumption: double is a IEEE 64 bit floating point type Modified: head/contrib/compiler-rt/lib/fixsfdi.c ============================================================================== --- head/contrib/compiler-rt/lib/fixsfdi.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/fixsfdi.c Wed Aug 8 09:42:44 2012 (r239138) @@ -23,7 +23,7 @@ /* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */ -ARM_EABI_FNALIAS(d2lz, fixsfdi); +ARM_EABI_FNALIAS(d2lz, fixsfdi) COMPILER_RT_ABI di_int __fixsfdi(float a) Modified: head/contrib/compiler-rt/lib/fixsfsi.c ============================================================================== --- head/contrib/compiler-rt/lib/fixsfsi.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/fixsfsi.c Wed Aug 8 09:42:44 2012 (r239138) @@ -16,7 +16,7 @@ #define SINGLE_PRECISION #include "fp_lib.h" -ARM_EABI_FNALIAS(f2iz, fixsfsi); +ARM_EABI_FNALIAS(f2iz, fixsfsi) COMPILER_RT_ABI int __fixsfsi(fp_t a) { Modified: head/contrib/compiler-rt/lib/fixsfti.c ============================================================================== --- head/contrib/compiler-rt/lib/fixsfti.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/fixsfti.c Wed Aug 8 09:42:44 2012 (r239138) @@ -12,10 +12,10 @@ * ===----------------------------------------------------------------------=== */ -#if __x86_64 - #include "int_lib.h" +#if __x86_64 + /* Returns: convert a to a signed long long, rounding toward zero. */ /* Assumption: float is a IEEE 32 bit floating point type Modified: head/contrib/compiler-rt/lib/fixunsdfdi.c ============================================================================== --- head/contrib/compiler-rt/lib/fixunsdfdi.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/fixunsdfdi.c Wed Aug 8 09:42:44 2012 (r239138) @@ -26,7 +26,7 @@ /* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */ -ARM_EABI_FNALIAS(d2ulz, fixunsdfdi); +ARM_EABI_FNALIAS(d2ulz, fixunsdfdi) COMPILER_RT_ABI du_int __fixunsdfdi(double a) Modified: head/contrib/compiler-rt/lib/fixunsdfsi.c ============================================================================== --- head/contrib/compiler-rt/lib/fixunsdfsi.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/fixunsdfsi.c Wed Aug 8 09:42:44 2012 (r239138) @@ -26,7 +26,7 @@ /* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */ -ARM_EABI_FNALIAS(d2uiz, fixunsdfsi); +ARM_EABI_FNALIAS(d2uiz, fixunsdfsi) COMPILER_RT_ABI su_int __fixunsdfsi(double a) Modified: head/contrib/compiler-rt/lib/fixunsdfti.c ============================================================================== --- head/contrib/compiler-rt/lib/fixunsdfti.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/fixunsdfti.c Wed Aug 8 09:42:44 2012 (r239138) @@ -12,10 +12,10 @@ * ===----------------------------------------------------------------------=== */ -#if __x86_64 - #include "int_lib.h" +#if __x86_64 + /* Returns: convert a to a unsigned long long, rounding toward zero. * Negative values all become zero. */ Modified: head/contrib/compiler-rt/lib/fixunssfdi.c ============================================================================== --- head/contrib/compiler-rt/lib/fixunssfdi.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/fixunssfdi.c Wed Aug 8 09:42:44 2012 (r239138) @@ -25,7 +25,7 @@ /* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */ -ARM_EABI_FNALIAS(f2ulz, fixunssfdi); +ARM_EABI_FNALIAS(f2ulz, fixunssfdi) COMPILER_RT_ABI du_int __fixunssfdi(float a) Modified: head/contrib/compiler-rt/lib/fixunssfsi.c ============================================================================== --- head/contrib/compiler-rt/lib/fixunssfsi.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/fixunssfsi.c Wed Aug 8 09:42:44 2012 (r239138) @@ -26,7 +26,7 @@ /* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */ -ARM_EABI_FNALIAS(f2uiz, fixunssfsi); +ARM_EABI_FNALIAS(f2uiz, fixunssfsi) COMPILER_RT_ABI su_int __fixunssfsi(float a) Modified: head/contrib/compiler-rt/lib/fixunssfti.c ============================================================================== --- head/contrib/compiler-rt/lib/fixunssfti.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/fixunssfti.c Wed Aug 8 09:42:44 2012 (r239138) @@ -12,10 +12,10 @@ * ===----------------------------------------------------------------------=== */ -#if __x86_64 - #include "int_lib.h" +#if __x86_64 + /* Returns: convert a to a unsigned long long, rounding toward zero. * Negative values all become zero. */ Modified: head/contrib/compiler-rt/lib/fixunsxfti.c ============================================================================== --- head/contrib/compiler-rt/lib/fixunsxfti.c Wed Aug 8 05:28:30 2012 (r239137) +++ head/contrib/compiler-rt/lib/fixunsxfti.c Wed Aug 8 09:42:44 2012 (r239138) @@ -12,10 +12,10 @@ * ===----------------------------------------------------------------------=== */ -#if __x86_64 - #include "int_lib.h" *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Aug 8 13:54:26 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C842C1065670; Wed, 8 Aug 2012 13:54:26 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B3E268FC16; Wed, 8 Aug 2012 13:54:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q78DsQlx090371; Wed, 8 Aug 2012 13:54:26 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q78DsQJ4090369; Wed, 8 Aug 2012 13:54:26 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201208081354.q78DsQJ4090369@svn.freebsd.org> From: Ed Maste Date: Wed, 8 Aug 2012 13:54:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239139 - head/tools/tools/netmap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Aug 2012 13:54:26 -0000 Author: emaste Date: Wed Aug 8 13:54:26 2012 New Revision: 239139 URL: http://svn.freebsd.org/changeset/base/239139 Log: Round displayed pps (instead of truncating) Modified: head/tools/tools/netmap/pkt-gen.c Modified: head/tools/tools/netmap/pkt-gen.c ============================================================================== --- head/tools/tools/netmap/pkt-gen.c Wed Aug 8 09:42:44 2012 (r239138) +++ head/tools/tools/netmap/pkt-gen.c Wed Aug 8 13:54:26 2012 (r239139) @@ -1076,7 +1076,7 @@ main(int arc, char **argv) pps = toc.tv_sec* 1000000 + toc.tv_usec; if (pps < 10000) continue; - pps = (my_count - prev)*1000000 / pps; + pps = ((my_count - prev) * 1000000 + pps / 2) / pps; D("%" PRIu64 " pps", pps); prev = my_count; toc = now; From owner-svn-src-head@FreeBSD.ORG Wed Aug 8 15:27:02 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A0B861065677; Wed, 8 Aug 2012 15:27:02 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8B55B8FC20; Wed, 8 Aug 2012 15:27:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q78FR2kb098463; Wed, 8 Aug 2012 15:27:02 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q78FR2k8098460; Wed, 8 Aug 2012 15:27:02 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201208081527.q78FR2k8098460@svn.freebsd.org> From: Ed Maste Date: Wed, 8 Aug 2012 15:27:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239140 - head/sys/dev/netmap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Aug 2012 15:27:02 -0000 Author: emaste Date: Wed Aug 8 15:27:01 2012 New Revision: 239140 URL: http://svn.freebsd.org/changeset/base/239140 Log: Clarify comments about number of tx / rx rings Modified: head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_kern.h Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Wed Aug 8 13:54:26 2012 (r239139) +++ head/sys/dev/netmap/netmap.c Wed Aug 8 15:27:01 2012 (r239140) @@ -1282,7 +1282,8 @@ netmap_lock_wrapper(struct ifnet *dev, i * kring N+1 is only used for the selinfo for all queues. * Return 0 on success, ENOMEM otherwise. * - * na->num_tx_rings can be set for cards with different tx/rx setups + * By default the receive and transmit adapter ring counts are both initialized * to num_queues. na->num_tx_rings can be set for cards with different tx/rx + * setups. */ int netmap_attach(struct netmap_adapter *na, int num_queues) Modified: head/sys/dev/netmap/netmap_kern.h ============================================================================== --- head/sys/dev/netmap/netmap_kern.h Wed Aug 8 13:54:26 2012 (r239139) +++ head/sys/dev/netmap/netmap_kern.h Wed Aug 8 15:27:01 2012 (r239140) @@ -144,8 +144,8 @@ struct netmap_adapter { int separate_locks; /* set if the interface suports different locks for rx, tx and core. */ - u_int num_rx_rings; /* number of tx/rx ring pairs */ - u_int num_tx_rings; // if nonzero, overrides num_rx_rings + u_int num_rx_rings; /* number of adapter receive rings */ + u_int num_tx_rings; /* number of adapter transmit rings */ u_int num_tx_desc; /* number of descriptor in each queue */ u_int num_rx_desc; From owner-svn-src-head@FreeBSD.ORG Wed Aug 8 15:28:29 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F03A7106566B; Wed, 8 Aug 2012 15:28:29 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DAF438FC15; Wed, 8 Aug 2012 15:28:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q78FSTB0098604; Wed, 8 Aug 2012 15:28:29 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q78FSTak098602; Wed, 8 Aug 2012 15:28:29 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201208081528.q78FSTak098602@svn.freebsd.org> From: Ed Maste Date: Wed, 8 Aug 2012 15:28:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239141 - head/sys/dev/netmap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Aug 2012 15:28:30 -0000 Author: emaste Date: Wed Aug 8 15:28:29 2012 New Revision: 239141 URL: http://svn.freebsd.org/changeset/base/239141 Log: Fix whitespace (missing newline) Modified: head/sys/dev/netmap/netmap.c Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Wed Aug 8 15:27:01 2012 (r239140) +++ head/sys/dev/netmap/netmap.c Wed Aug 8 15:28:29 2012 (r239141) @@ -1282,7 +1282,8 @@ netmap_lock_wrapper(struct ifnet *dev, i * kring N+1 is only used for the selinfo for all queues. * Return 0 on success, ENOMEM otherwise. * - * By default the receive and transmit adapter ring counts are both initialized * to num_queues. na->num_tx_rings can be set for cards with different tx/rx + * By default the receive and transmit adapter ring counts are both initialized + * to num_queues. na->num_tx_rings can be set for cards with different tx/rx * setups. */ int From owner-svn-src-head@FreeBSD.ORG Wed Aug 8 17:16:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10406106566B; Wed, 8 Aug 2012 17:16:07 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EF97B8FC17; Wed, 8 Aug 2012 17:16: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 q78HG6iU007536; Wed, 8 Aug 2012 17:16:06 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q78HG6Th007534; Wed, 8 Aug 2012 17:16:06 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201208081716.q78HG6Th007534@svn.freebsd.org> From: Adrian Chadd Date: Wed, 8 Aug 2012 17:16:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239142 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Aug 2012 17:16:07 -0000 Author: adrian Date: Wed Aug 8 17:16:06 2012 New Revision: 239142 URL: http://svn.freebsd.org/changeset/base/239142 Log: Fix an incorrect comment. Modified: head/sys/net80211/ieee80211.h Modified: head/sys/net80211/ieee80211.h ============================================================================== --- head/sys/net80211/ieee80211.h Wed Aug 8 15:28:29 2012 (r239141) +++ head/sys/net80211/ieee80211.h Wed Aug 8 17:16:06 2012 (r239142) @@ -772,7 +772,7 @@ struct ieee80211_country_ie { (sizeof(struct ieee80211_country_ie) + 3*(IEEE80211_COUNTRY_MAX_BANDS-1)) /* - * 802.11h Channel Switch Announcement (CSA). + * 802.11h Quiet Time Element. */ struct ieee80211_quiet_ie { uint8_t quiet_ie; /* IEEE80211_ELEMID_QUIET */ From owner-svn-src-head@FreeBSD.ORG Wed Aug 8 18:24:34 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41575106566C; Wed, 8 Aug 2012 18:24:34 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 29C928FC14; Wed, 8 Aug 2012 18:24: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 q78IOYJv013337; Wed, 8 Aug 2012 18:24:34 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q78IOYC9013334; Wed, 8 Aug 2012 18:24:34 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201208081824.q78IOYC9013334@svn.freebsd.org> From: Matt Jacob Date: Wed, 8 Aug 2012 18:24:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239143 - head/sys/dev/isp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Aug 2012 18:24:34 -0000 Author: mjacob Date: Wed Aug 8 18:24:33 2012 New Revision: 239143 URL: http://svn.freebsd.org/changeset/base/239143 Log: More rototilling with target mode in an attemp to get multiple CCB at a time outstanding reliable. It's not there yet, but this is the direction to go in so might as well commit. So far, multiple at a time CCBs work (see ISP_INTERNAL_TARGET test mode), but it fails if there are more downstream than the SIM wants to handle and SRR is sort of confused when this happens, plus it is not entirely quite clear what one does if a CCB/CTIO fails and you have more in flight (that don't fail, say) and more queued up at the SIM level that haven't been started yet. Some of this is driven because there apparently is no flow control to requeue XPT_CONTINUE_IO requests like there are for XPT_SCSI_IO requests. It is also more driven in that the few target mode periph drivers there are are not really set up for handling pushback- heck most of them don't even check for errors (and what would they really do with them anyway? It's the initiator's problem, really....). The data transfer arithmetic has been worked over again to handle multiple outstanding commands, so you have a notion of what's been moved already as well as what's currently in flight. It turns that this led to uncovering a REPORT_LUNS bug in the ISP_INTERNAL_TARGET code which was sending back 24 bytes of rpl data instead of the specified 16. What happened furthermore here is that sending back 16 bytes and reporting an overrun of 8 bytes made the initiator (running FC-Tape aware f/w) mad enough to request, and keep requesting, another FCP response (I guess it didn't like the answer so kept asking for it again). Sponsored by: Spectralogic MFC after: 1 month Modified: head/sys/dev/isp/isp_freebsd.c head/sys/dev/isp/isp_freebsd.h Modified: head/sys/dev/isp/isp_freebsd.c ============================================================================== --- head/sys/dev/isp/isp_freebsd.c Wed Aug 8 17:16:06 2012 (r239142) +++ head/sys/dev/isp/isp_freebsd.c Wed Aug 8 18:24:33 2012 (r239143) @@ -74,6 +74,7 @@ static void isp_action(struct cam_sim *, static void isp_target_thread_pi(void *); static void isp_target_thread_fc(void *); #endif +static int isp_timer_count; static void isp_timer(void *); static struct cdevsw isp_cdevsw = { @@ -225,7 +226,8 @@ isp_attach(ispsoftc_t *isp) } callout_init_mtx(&isp->isp_osinfo.tmo, &isp->isp_osinfo.lock, 0); - callout_reset(&isp->isp_osinfo.tmo, hz, isp_timer, isp); + isp_timer_count = hz >> 2; + callout_reset(&isp->isp_osinfo.tmo, isp_timer_count, isp_timer, isp); isp->isp_osinfo.timer_active = 1; isp->isp_osinfo.cdev = make_dev(&isp_cdevsw, du, UID_ROOT, GID_OPERATOR, 0600, "%s", nu); @@ -777,6 +779,7 @@ static ISP_INLINE void isp_free_pcmd(ispsoftc_t *isp, union ccb *ccb) { if (ISP_PCMD(ccb)) { + memset(ISP_PCMD(ccb), 0, sizeof (struct isp_pcmd)); ((struct isp_pcmd *)ISP_PCMD(ccb))->next = isp->isp_osinfo.pcmd_free; isp->isp_osinfo.pcmd_free = ISP_PCMD(ccb); ISP_PCMD(ccb) = NULL; @@ -813,7 +816,7 @@ static timeout_t isp_refire_putback_atio static timeout_t isp_refire_notify_ack; static void isp_complete_ctio(union ccb *); static void isp_target_putback_atio(union ccb *); -enum Start_Ctio_How { FROM_CAM, FROM_SRR, FROM_CTIO_DONE }; +enum Start_Ctio_How { FROM_CAM, FROM_TIMER, FROM_SRR, FROM_CTIO_DONE }; static void isp_target_start_ctio(ispsoftc_t *, union ccb *, enum Start_Ctio_How); static void isp_handle_platform_atio(ispsoftc_t *, at_entry_t *); static void isp_handle_platform_atio2(ispsoftc_t *, at2_entry_t *); @@ -975,7 +978,9 @@ static void isp_tmcmd_restart(ispsoftc_t *isp) { inot_private_data_t *ntp; + inot_private_data_t *restart_queue; tstate_t *tptr; + union ccb *ccb; struct tslist *lhp; int bus, i; @@ -983,8 +988,8 @@ isp_tmcmd_restart(ispsoftc_t *isp) for (i = 0; i < LUN_HASH_SIZE; i++) { ISP_GET_PC_ADDR(isp, bus, lun_hash[i], lhp); SLIST_FOREACH(tptr, lhp, next) { - inot_private_data_t *restart_queue = tptr->restart_queue; - tptr->restart_queue = NULL; + if ((restart_queue = tptr->restart_queue) != NULL) + tptr->restart_queue = NULL; while (restart_queue) { ntp = restart_queue; restart_queue = ntp->rd.nt.nt_hba; @@ -1006,6 +1011,14 @@ isp_tmcmd_restart(ispsoftc_t *isp) break; } } + /* + * We only need to do this once per tptr + */ + if (!TAILQ_EMPTY(&tptr->waitq)) { + ccb = (union ccb *)TAILQ_LAST(&tptr->waitq, isp_ccbq); + TAILQ_REMOVE(&tptr->waitq, &ccb->ccb_h, periph_links.tqe); + isp_target_start_ctio(isp, ccb, FROM_TIMER); + } } } } @@ -1052,8 +1065,8 @@ isp_dump_atpd(ispsoftc_t *isp, tstate_t if (atp->tag == 0) { continue; } - xpt_print(tptr->owner, "ATP: [0x%x] origdlen %u bytes_xfrd %u last_xfr %u lun %u nphdl 0x%04x s_id 0x%06x d_id 0x%06x oxid 0x%04x state %s\n", - atp->tag, atp->orig_datalen, atp->bytes_xfered, atp->last_xframt, atp->lun, atp->nphdl, atp->sid, atp->portid, atp->oxid, states[atp->state & 0x7]); + xpt_print(tptr->owner, "ATP: [0x%x] origdlen %u bytes_xfrd %u lun %u nphdl 0x%04x s_id 0x%06x d_id 0x%06x oxid 0x%04x state %s\n", + atp->tag, atp->orig_datalen, atp->bytes_xfered, atp->lun, atp->nphdl, atp->sid, atp->portid, atp->oxid, states[atp->state & 0x7]); } } @@ -1118,6 +1131,7 @@ create_lun_state(ispsoftc_t *isp, int bu } SLIST_INIT(&tptr->atios); SLIST_INIT(&tptr->inots); + TAILQ_INIT(&tptr->waitq); for (i = 0; i < ATPDPSIZE-1; i++) { tptr->atpool[i].next = &tptr->atpool[i+1]; tptr->ntpool[i].next = &tptr->ntpool[i+1]; @@ -1534,533 +1548,544 @@ isp_ledone(ispsoftc_t *isp, lun_entry_t static void isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how) { - - void *qe; - int fctape, sendstatus, resid, repval = ISP_LOGTDEBUG0; + int fctape, sendstatus, resid; tstate_t *tptr; fcparam *fcp; atio_private_data_t *atp; - struct ccb_scsiio *cso = &ccb->csio; - uint32_t dmaresult, handle, xfrlen, sense_length; + struct ccb_scsiio *cso; + uint32_t dmaresult, handle, xfrlen, sense_length, tmp; uint8_t local[QENTRY_LEN]; - /* - * Do some sanity checks. - */ - xfrlen = cso->dxfer_len; - if (xfrlen == 0) { - if ((ccb->ccb_h.flags & CAM_SEND_STATUS) == 0) { - ISP_PATH_PRT(isp, ISP_LOGERR, ccb->ccb_h.path, "a data transfer length of zero but no status to send is wrong\n"); - ccb->ccb_h.status = CAM_REQ_INVALID; - xpt_done(ccb); - return; - } - } - tptr = get_lun_statep(isp, XS_CHANNEL(ccb), XS_LUN(ccb)); if (tptr == NULL) { tptr = get_lun_statep(isp, XS_CHANNEL(ccb), CAM_LUN_WILDCARD); if (tptr == NULL) { - ISP_PATH_PRT(isp, ISP_LOGERR, ccb->ccb_h.path, "%s: [0x%x] cannot find tstate pointer in %s\n", __func__, cso->tag_id); + isp_prt(isp, ISP_LOGERR, "%s: [0x%x] cannot find tstate pointer", __func__, ccb->csio.tag_id); ccb->ccb_h.status = CAM_DEV_NOT_THERE; xpt_done(ccb); return; } } + isp_prt(isp, ISP_LOGTDEBUG0, "%s: ENTRY[0x%x] how %u xfrlen %u sendstatus %d sense_len %u", __func__, ccb->csio.tag_id, how, ccb->csio.dxfer_len, + (ccb->ccb_h.flags & CAM_SEND_STATUS) != 0, ((ccb->ccb_h.flags & CAM_SEND_SENSE)? ccb->csio.sense_len : 0)); - atp = isp_get_atpd(isp, tptr, cso->tag_id); - if (atp == NULL) { - ISP_PATH_PRT(isp, ISP_LOGERR, ccb->ccb_h.path, "%s: [0x%x] cannot find private data adjunct\n", __func__, cso->tag_id); - isp_dump_atpd(isp, tptr); - ccb->ccb_h.status = CAM_REQ_CMP_ERR; - xpt_done(ccb); - return; - } - - /* - * Is this command a dead duck? - */ - if (atp->dead) { - ISP_PATH_PRT(isp, ISP_LOGERR, ccb->ccb_h.path, "%s: [0x%x] not sending a CTIO for a dead command\n", __func__, cso->tag_id); - ccb->ccb_h.status = CAM_REQ_ABORTED; - xpt_done(ccb); - return; + switch (how) { + case FROM_TIMER: + case FROM_CAM: + /* + * Insert at the tail of the list, if any, waiting CTIO CCBs + */ + TAILQ_INSERT_TAIL(&tptr->waitq, &ccb->ccb_h, periph_links.tqe); + break; + case FROM_SRR: + case FROM_CTIO_DONE: + TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe); + break; } - /* - * Check to make sure we're still in target mode. - */ - fcp = FCPARAM(isp, XS_CHANNEL(ccb)); - if ((fcp->role & ISP_ROLE_TARGET) == 0) { - ISP_PATH_PRT(isp, ISP_LOGERR, ccb->ccb_h.path, "%s: [0x%x] stopping sending a CTIO because we're no longer in target mode\n", __func__, cso->tag_id); - ccb->ccb_h.status = CAM_PROVIDE_FAIL; - xpt_done(ccb); - return; - } + while (TAILQ_FIRST(&tptr->waitq) != NULL) { + ccb = (union ccb *) TAILQ_FIRST(&tptr->waitq); + TAILQ_REMOVE(&tptr->waitq, &ccb->ccb_h, periph_links.tqe); - /* - * We're only handling one outstanding CTIO at a time (which - * could be split into two to split data and status) - */ - if (atp->ctcnt) { - ISP_PATH_PRT(isp, ISP_LOGINFO, ccb->ccb_h.path, "sending only one CTIO at a time\n"); - goto restart_delay; - } + cso = &ccb->csio; + xfrlen = cso->dxfer_len; + if (xfrlen == 0) { + if ((ccb->ccb_h.flags & CAM_SEND_STATUS) == 0) { + ISP_PATH_PRT(isp, ISP_LOGERR, ccb->ccb_h.path, "a data transfer length of zero but no status to send is wrong\n"); + ccb->ccb_h.status = CAM_REQ_INVALID; + xpt_done(ccb); + continue; + } + } + atp = isp_get_atpd(isp, tptr, cso->tag_id); + if (atp == NULL) { + isp_prt(isp, ISP_LOGERR, "%s: [0x%x] cannot find private data adjunct in %s", __func__, cso->tag_id, __func__); + isp_dump_atpd(isp, tptr); + ccb->ccb_h.status = CAM_REQ_CMP_ERR; + xpt_done(ccb); + continue; + } - /* - * Get some resources - */ - if (isp_get_pcmd(isp, ccb)) { - ISP_PATH_PRT(isp, ISP_LOGWARN, ccb->ccb_h.path, "out of PCMDs\n"); - goto restart_delay; - } - qe = isp_getrqentry(isp); - if (qe == NULL) { - ISP_PATH_PRT(isp, ISP_LOGWARN, ccb->ccb_h.path, rqo, __func__); - goto restart_delay; - } - memset(local, 0, QENTRY_LEN); + /* + * Is this command a dead duck? + */ + if (atp->dead) { + isp_prt(isp, ISP_LOGERR, "%s: [0x%x] not sending a CTIO for a dead command", __func__, cso->tag_id); + ccb->ccb_h.status = CAM_REQ_ABORTED; + xpt_done(ccb); + continue; + } - /* - * Does the initiator expect FC-Tape style responses? - * Can we provide them? - */ - if ((atp->word3 & PRLI_WD3_RETRY) && fcp->fctape_enabled) { - fctape = 1; - } else { - fctape = 0; - } + /* + * Check to make sure we're still in target mode. + */ + fcp = FCPARAM(isp, XS_CHANNEL(ccb)); + if ((fcp->role & ISP_ROLE_TARGET) == 0) { + isp_prt(isp, ISP_LOGERR, "%s: [0x%x] stopping sending a CTIO because we're no longer in target mode", __func__, cso->tag_id); + ccb->ccb_h.status = CAM_PROVIDE_FAIL; + xpt_done(ccb); + continue; + } - /* - * If we already did the data xfer portion of a CTIO that sends data - * and status, don't do it again and do the status portion now. - */ - if (atp->sendst) { - xfrlen = 0; /* we already did the data transfer */ - atp->sendst = 0; - } - if (ccb->ccb_h.flags & CAM_SEND_STATUS) { - sendstatus = 1; - } else { - sendstatus = 0; - } + /* + * We're only handling ATPD_CCB_OUTSTANDING outstanding CCB at a time (one of which + * could be split into two CTIOs to split data and status). + */ + if (atp->ctcnt >= ATPD_CCB_OUTSTANDING) { + isp_prt(isp, ISP_LOGTINFO, "[0x%x] handling only %d CCBs at a time (flags for this ccb: 0x%x)", cso->tag_id, ATPD_CCB_OUTSTANDING, ccb->ccb_h.flags); + TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe); + break; + } - if (ccb->ccb_h.flags & CAM_SEND_SENSE) { /* - * Sense length is not the entire sense data structure size. Periph - * drivers don't seem to be setting sense_len to reflect the actual - * size. We'll peek inside to get the right amount. + * Does the initiator expect FC-Tape style responses? */ - sense_length = cso->sense_len; + if ((atp->word3 & PRLI_WD3_RETRY) && fcp->fctape_enabled) { + fctape = 1; + } else { + fctape = 0; + } /* - * This 'cannot' happen + * If we already did the data xfer portion of a CTIO that sends data + * and status, don't do it again and do the status portion now. */ - if (sense_length > (XCMD_SIZE - MIN_FCP_RESPONSE_SIZE)) { - sense_length = XCMD_SIZE - MIN_FCP_RESPONSE_SIZE; + if (atp->sendst) { + isp_prt(isp, ISP_LOGTINFO, "[0x%x] now sending synthesized status orig_dl=%u xfered=%u bit=%u", + cso->tag_id, atp->orig_datalen, atp->bytes_xfered, atp->bytes_in_transit); + xfrlen = 0; /* we already did the data transfer */ + atp->sendst = 0; + } + if (ccb->ccb_h.flags & CAM_SEND_STATUS) { + sendstatus = 1; + } else { + sendstatus = 0; } - } else { - sense_length = 0; - } - if (how == FROM_SRR || atp->nsrr) - repval = ISP_LOGINFO; + if (ccb->ccb_h.flags & CAM_SEND_SENSE) { + KASSERT((sendstatus != 0), ("how can you have CAM_SEND_SENSE w/o CAM_SEND_STATUS?")); + /* + * Sense length is not the entire sense data structure size. Periph + * drivers don't seem to be setting sense_len to reflect the actual + * size. We'll peek inside to get the right amount. + */ + sense_length = cso->sense_len; - if (IS_24XX(isp)) { - ct7_entry_t *cto = (ct7_entry_t *) local; + /* + * This 'cannot' happen + */ + if (sense_length > (XCMD_SIZE - MIN_FCP_RESPONSE_SIZE)) { + sense_length = XCMD_SIZE - MIN_FCP_RESPONSE_SIZE; + } + } else { + sense_length = 0; + } - cto->ct_header.rqs_entry_type = RQSTYPE_CTIO7; - cto->ct_header.rqs_entry_count = 1; - cto->ct_header.rqs_seqno = 1; - cto->ct_nphdl = atp->nphdl; - cto->ct_rxid = atp->tag; - cto->ct_iid_lo = atp->portid; - cto->ct_iid_hi = atp->portid >> 16; - cto->ct_oxid = atp->oxid; - cto->ct_vpidx = ISP_GET_VPIDX(isp, XS_CHANNEL(ccb)); - cto->ct_timeout = 120; - cto->ct_flags = atp->tattr << CT7_TASK_ATTR_SHIFT; + memset(local, 0, QENTRY_LEN); /* - * Mode 1, status, no data. Only possible when we are sending status, have - * no data to transfer, and any sense length can fit in the ct7_entry. - * - * Mode 2, status, no data. We have to use this in the case sense data - * won't fit into a ct7_entry_t. - * + * Check for overflow */ - if (sendstatus && xfrlen == 0) { - cto->ct_flags |= CT7_SENDSTATUS | CT7_NO_DATA; - resid = atp->orig_datalen - atp->bytes_xfered; - if (sense_length <= MAXRESPLEN_24XX) { - if (resid < 0) { - cto->ct_resid = -resid; - } else if (resid > 0) { - cto->ct_resid = resid; - } - cto->ct_flags |= CT7_FLAG_MODE1; - cto->ct_scsi_status = cso->scsi_status; - if (resid < 0) { - cto->ct_scsi_status |= (FCP_RESID_OVERFLOW << 8); - } else if (resid > 0) { - cto->ct_scsi_status |= (FCP_RESID_UNDERFLOW << 8); - } - if (fctape) { - cto->ct_flags |= CT7_CONFIRM|CT7_EXPLCT_CONF; - } - if (sense_length) { - cto->ct_scsi_status |= (FCP_SNSLEN_VALID << 8); - cto->rsp.m1.ct_resplen = cto->ct_senselen = sense_length; - memcpy(cto->rsp.m1.ct_resp, &cso->sense_data, sense_length); - } - } else { - bus_addr_t addr; - char buf[XCMD_SIZE]; - fcp_rsp_iu_t *rp; + tmp = atp->bytes_xfered + atp->bytes_in_transit + xfrlen; + if (tmp > atp->orig_datalen) { + isp_prt(isp, ISP_LOGERR, "%s: [0x%x] data overflow by %u bytes", __func__, cso->tag_id, tmp - atp->orig_datalen); + ccb->ccb_h.status = CAM_DATA_RUN_ERR; + xpt_done(ccb); + continue; + } + + if (IS_24XX(isp)) { + ct7_entry_t *cto = (ct7_entry_t *) local; + + cto->ct_header.rqs_entry_type = RQSTYPE_CTIO7; + cto->ct_header.rqs_entry_count = 1; + cto->ct_header.rqs_seqno |= ATPD_SEQ_NOTIFY_CAM; + ATPD_SET_SEQNO(cto, atp); + cto->ct_nphdl = atp->nphdl; + cto->ct_rxid = atp->tag; + cto->ct_iid_lo = atp->portid; + cto->ct_iid_hi = atp->portid >> 16; + cto->ct_oxid = atp->oxid; + cto->ct_vpidx = ISP_GET_VPIDX(isp, XS_CHANNEL(ccb)); + cto->ct_timeout = 120; + cto->ct_flags = atp->tattr << CT7_TASK_ATTR_SHIFT; + + /* + * Mode 1, status, no data. Only possible when we are sending status, have + * no data to transfer, and any sense length can fit in the ct7_entry. + * + * Mode 2, status, no data. We have to use this in the case sense data + * won't fit into a ct7_entry_t. + * + */ + if (sendstatus && xfrlen == 0) { + cto->ct_flags |= CT7_SENDSTATUS | CT7_NO_DATA; + resid = atp->orig_datalen - atp->bytes_xfered - atp->bytes_in_transit; + if (sense_length <= MAXRESPLEN_24XX) { + if (resid < 0) { + cto->ct_resid = -resid; + } else if (resid > 0) { + cto->ct_resid = resid; + } + cto->ct_flags |= CT7_FLAG_MODE1; + cto->ct_scsi_status = cso->scsi_status; + if (resid < 0) { + cto->ct_scsi_status |= (FCP_RESID_OVERFLOW << 8); + } else if (resid > 0) { + cto->ct_scsi_status |= (FCP_RESID_UNDERFLOW << 8); + } + if (fctape) { + cto->ct_flags |= CT7_CONFIRM|CT7_EXPLCT_CONF; + } + if (sense_length) { + cto->ct_scsi_status |= (FCP_SNSLEN_VALID << 8); + cto->rsp.m1.ct_resplen = cto->ct_senselen = sense_length; + memcpy(cto->rsp.m1.ct_resp, &cso->sense_data, sense_length); + } + } else { + bus_addr_t addr; + char buf[XCMD_SIZE]; + fcp_rsp_iu_t *rp; - if (atp->ests == NULL) { - atp->ests = isp_get_ecmd(isp); if (atp->ests == NULL) { - goto restart_delay; + atp->ests = isp_get_ecmd(isp); + if (atp->ests == NULL) { + TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe); + break; + } } - } - memset(buf, 0, sizeof (buf)); - rp = (fcp_rsp_iu_t *)buf; - if (fctape) { - cto->ct_flags |= CT7_CONFIRM|CT7_EXPLCT_CONF; - rp->fcp_rsp_bits |= FCP_CONF_REQ; - } - cto->ct_flags |= CT7_FLAG_MODE2; - rp->fcp_rsp_scsi_status = cso->scsi_status; - if (resid < 0) { - rp->fcp_rsp_resid = -resid; - rp->fcp_rsp_bits |= FCP_RESID_OVERFLOW; - } else if (resid > 0) { - rp->fcp_rsp_resid = resid; - rp->fcp_rsp_bits |= FCP_RESID_UNDERFLOW; + memset(buf, 0, sizeof (buf)); + rp = (fcp_rsp_iu_t *)buf; + if (fctape) { + cto->ct_flags |= CT7_CONFIRM|CT7_EXPLCT_CONF; + rp->fcp_rsp_bits |= FCP_CONF_REQ; + } + cto->ct_flags |= CT7_FLAG_MODE2; + rp->fcp_rsp_scsi_status = cso->scsi_status; + if (resid < 0) { + rp->fcp_rsp_resid = -resid; + rp->fcp_rsp_bits |= FCP_RESID_OVERFLOW; + } else if (resid > 0) { + rp->fcp_rsp_resid = resid; + rp->fcp_rsp_bits |= FCP_RESID_UNDERFLOW; + } + if (sense_length) { + rp->fcp_rsp_snslen = sense_length; + cto->ct_senselen = sense_length; + rp->fcp_rsp_bits |= FCP_SNSLEN_VALID; + isp_put_fcp_rsp_iu(isp, rp, atp->ests); + memcpy(((fcp_rsp_iu_t *)atp->ests)->fcp_rsp_extra, &cso->sense_data, sense_length); + } else { + isp_put_fcp_rsp_iu(isp, rp, atp->ests); + } + if (isp->isp_dblev & ISP_LOGTDEBUG1) { + isp_print_bytes(isp, "FCP Response Frame After Swizzling", MIN_FCP_RESPONSE_SIZE + sense_length, atp->ests); + } + addr = isp->isp_osinfo.ecmd_dma; + addr += ((((isp_ecmd_t *)atp->ests) - isp->isp_osinfo.ecmd_base) * XCMD_SIZE); + isp_prt(isp, ISP_LOGTDEBUG0, "%s: ests base %p vaddr %p ecmd_dma %jx addr %jx len %u", __func__, isp->isp_osinfo.ecmd_base, atp->ests, + (uintmax_t) isp->isp_osinfo.ecmd_dma, (uintmax_t)addr, MIN_FCP_RESPONSE_SIZE + sense_length); + cto->rsp.m2.ct_datalen = MIN_FCP_RESPONSE_SIZE + sense_length; + cto->rsp.m2.ct_fcp_rsp_iudata.ds_base = DMA_LO32(addr); + cto->rsp.m2.ct_fcp_rsp_iudata.ds_basehi = DMA_HI32(addr); + cto->rsp.m2.ct_fcp_rsp_iudata.ds_count = MIN_FCP_RESPONSE_SIZE + sense_length; } if (sense_length) { - rp->fcp_rsp_snslen = sense_length; - cto->ct_senselen = sense_length; - rp->fcp_rsp_bits |= FCP_SNSLEN_VALID; - isp_put_fcp_rsp_iu(isp, rp, atp->ests); - memcpy(((fcp_rsp_iu_t *)atp->ests)->fcp_rsp_extra, &cso->sense_data, sense_length); + isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO7[0x%x] seq %u nc %d CDB0=%x sstatus=0x%x flags=0x%x resid=%d slen %u sense: %x %x/%x/%x", __func__, + cto->ct_rxid, ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), atp->cdb0, cto->ct_scsi_status, cto->ct_flags, cto->ct_resid, sense_length, + cso->sense_data.error_code, cso->sense_data.sense_buf[1], cso->sense_data.sense_buf[11], cso->sense_data.sense_buf[12]); } else { - isp_put_fcp_rsp_iu(isp, rp, atp->ests); - } - if (isp->isp_dblev & ISP_LOGTDEBUG1) { - isp_print_bytes(isp, "FCP Response Frame After Swizzling", MIN_FCP_RESPONSE_SIZE + sense_length, atp->ests); + isp_prt(isp, ISP_LOGDEBUG0, "%s: CTIO7[0x%x] seq %u nc %d CDB0=%x sstatus=0x%x flags=0x%x resid=%d", __func__, + cto->ct_rxid, ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), atp->cdb0, cto->ct_scsi_status, cto->ct_flags, cto->ct_resid); } - addr = isp->isp_osinfo.ecmd_dma; - addr += ((((isp_ecmd_t *)atp->ests) - isp->isp_osinfo.ecmd_base) * XCMD_SIZE); - isp_prt(isp, repval, "%s: ests base %p vaddr %p ecmd_dma %jx addr %jx len %u", __func__, isp->isp_osinfo.ecmd_base, atp->ests, - (uintmax_t) isp->isp_osinfo.ecmd_dma, (uintmax_t)addr, MIN_FCP_RESPONSE_SIZE + sense_length); - cto->rsp.m2.ct_datalen = MIN_FCP_RESPONSE_SIZE + sense_length; - cto->rsp.m2.ct_fcp_rsp_iudata.ds_base = DMA_LO32(addr); - cto->rsp.m2.ct_fcp_rsp_iudata.ds_basehi = DMA_HI32(addr); - cto->rsp.m2.ct_fcp_rsp_iudata.ds_count = MIN_FCP_RESPONSE_SIZE + sense_length; - } - if (sense_length) { - isp_prt(isp, repval, "%s: CTIO7[0x%x] CDB0=%x sstatus=0x%x flags=0x%x resid=%d slen %u sense: %x %x/%x/%x", __func__, - cto->ct_rxid, atp->cdb0, cto->ct_scsi_status, cto->ct_flags, cto->ct_resid, sense_length, cso->sense_data.error_code, - cso->sense_data.sense_buf[1], cso->sense_data.sense_buf[11], cso->sense_data.sense_buf[12]); - } else { - isp_prt(isp, repval, "%s: CTIO7[0x%x] CDB0=%x sstatus=0x%x flags=0x%x resid=%d", __func__, - cto->ct_rxid, atp->cdb0, cto->ct_scsi_status, cto->ct_flags, cto->ct_resid); - } - atp->state = ATPD_STATE_LAST_CTIO; - } - - /* - * Mode 0 data transfers, *possibly* with status. - */ - if (xfrlen != 0) { - cto->ct_flags |= CT7_FLAG_MODE0; - if ((cso->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { - cto->ct_flags |= CT7_DATA_IN; - } else { - cto->ct_flags |= CT7_DATA_OUT; + atp->state = ATPD_STATE_LAST_CTIO; } /* - * Don't overrun the limits placed on us, but record it as - * if we had so that we can set an overflow bit later. + * Mode 0 data transfers, *possibly* with status. */ - atp->last_xframt = xfrlen; - if (atp->bytes_xfered >= atp->orig_datalen) { - resid = atp->orig_datalen - (atp->bytes_xfered + xfrlen); - } else if (atp->bytes_xfered + xfrlen > atp->orig_datalen) { - resid = atp->orig_datalen - (atp->bytes_xfered + xfrlen); - xfrlen = atp->orig_datalen - atp->bytes_xfered; - } else { - resid = atp->orig_datalen - xfrlen; - } - cto->rsp.m0.reloff = atp->bytes_xfered; - cto->rsp.m0.ct_xfrlen = xfrlen; + if (xfrlen != 0) { + cto->ct_flags |= CT7_FLAG_MODE0; + if ((cso->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { + cto->ct_flags |= CT7_DATA_IN; + } else { + cto->ct_flags |= CT7_DATA_OUT; + } + + cto->rsp.m0.reloff = atp->bytes_xfered + atp->bytes_in_transit; + cto->rsp.m0.ct_xfrlen = xfrlen; #ifdef DEBUG - if (ISP_FC_PC(isp, XS_CHANNEL(ccb))->inject_lost_data_frame && xfrlen > ISP_FC_PC(isp, XS_CHANNEL(ccb))->inject_lost_data_frame) { - isp_prt(isp, ISP_LOGWARN, "%s: truncating data frame with xfrlen %d to %d", __func__, xfrlen, xfrlen - (xfrlen >> 2)); - ISP_FC_PC(isp, XS_CHANNEL(ccb))->inject_lost_data_frame = 0; - cto->rsp.m0.ct_xfrlen -= xfrlen >> 2; - } + if (ISP_FC_PC(isp, XS_CHANNEL(ccb))->inject_lost_data_frame && xfrlen > ISP_FC_PC(isp, XS_CHANNEL(ccb))->inject_lost_data_frame) { + isp_prt(isp, ISP_LOGWARN, "%s: truncating data frame with xfrlen %d to %d", __func__, xfrlen, xfrlen - (xfrlen >> 2)); + ISP_FC_PC(isp, XS_CHANNEL(ccb))->inject_lost_data_frame = 0; + cto->rsp.m0.ct_xfrlen -= xfrlen >> 2; + } #endif - if (sendstatus) { - if (cso->scsi_status == SCSI_STATUS_OK && resid == 0 && fctape == 0) { - cto->ct_flags |= CT7_SENDSTATUS; - atp->state = ATPD_STATE_LAST_CTIO; + if (sendstatus) { + resid = atp->orig_datalen - atp->bytes_xfered - xfrlen; + if (cso->scsi_status == SCSI_STATUS_OK && resid == 0 /* && fctape == 0 */) { + cto->ct_flags |= CT7_SENDSTATUS; + atp->state = ATPD_STATE_LAST_CTIO; + if (fctape) { + cto->ct_flags |= CT7_CONFIRM|CT7_EXPLCT_CONF; + } + } else { + atp->sendst = 1; /* send status later */ + cto->ct_header.rqs_seqno &= ~ATPD_SEQ_NOTIFY_CAM; + atp->state = ATPD_STATE_CTIO; + } } else { - atp->sendst = 1; /* send status later */ - cto->ct_header.rqs_seqno = 0; atp->state = ATPD_STATE_CTIO; } - } else { - atp->state = ATPD_STATE_CTIO; + isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO7[0x%x] seq %u nc %d CDB0=%x sstatus=0x%x flags=0x%x xfrlen=%u off=%u", __func__, + cto->ct_rxid, ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), atp->cdb0, cto->ct_scsi_status, cto->ct_flags, xfrlen, atp->bytes_xfered); } - isp_prt(isp, repval, "%s: CTIO7[0x%x] CDB0=%x sstatus=0x%x flags=0x%x xfrlen=%u off=%u", __func__, - cto->ct_rxid, atp->cdb0, cto->ct_scsi_status, cto->ct_flags, xfrlen, atp->bytes_xfered); - } - } else if (IS_FC(isp)) { - ct2_entry_t *cto = (ct2_entry_t *) local; + } else if (IS_FC(isp)) { + ct2_entry_t *cto = (ct2_entry_t *) local; - if (isp->isp_osinfo.sixtyfourbit) - cto->ct_header.rqs_entry_type = RQSTYPE_CTIO3; - else - cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2; - cto->ct_header.rqs_entry_count = 1; - cto->ct_header.rqs_seqno = 1; - if (ISP_CAP_2KLOGIN(isp) == 0) { - ((ct2e_entry_t *)cto)->ct_iid = cso->init_id; - } else { - cto->ct_iid = cso->init_id; - if (ISP_CAP_SCCFW(isp) == 0) { - cto->ct_lun = ccb->ccb_h.target_lun; + if (isp->isp_osinfo.sixtyfourbit) + cto->ct_header.rqs_entry_type = RQSTYPE_CTIO3; + else + cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2; + cto->ct_header.rqs_entry_count = 1; + cto->ct_header.rqs_seqno |= ATPD_SEQ_NOTIFY_CAM; + ATPD_SET_SEQNO(cto, atp); + if (ISP_CAP_2KLOGIN(isp) == 0) { + ((ct2e_entry_t *)cto)->ct_iid = cso->init_id; + } else { + cto->ct_iid = cso->init_id; + if (ISP_CAP_SCCFW(isp) == 0) { + cto->ct_lun = ccb->ccb_h.target_lun; + } } - } - cto->ct_timeout = 10; - cto->ct_rxid = cso->tag_id; + cto->ct_timeout = 10; + cto->ct_rxid = cso->tag_id; - /* - * Mode 1, status, no data. Only possible when we are sending status, have - * no data to transfer, and the sense length can fit in the ct7_entry. - * - * Mode 2, status, no data. We have to use this in the case the the response - * length won't fit into a ct2_entry_t. - * - * We'll fill out this structure with information as if this were a - * Mode 1. The hardware layer will create the Mode 2 FCP RSP IU as - * needed based upon this. - */ - if (sendstatus && xfrlen == 0) { - cto->ct_flags |= CT2_SENDSTATUS | CT2_NO_DATA; - resid = atp->orig_datalen - atp->bytes_xfered; - if (sense_length <= MAXRESPLEN) { - if (resid < 0) { - cto->ct_resid = -resid; - } else if (resid > 0) { - cto->ct_resid = resid; - } - cto->ct_flags |= CT2_FLAG_MODE1; - cto->rsp.m1.ct_scsi_status = cso->scsi_status; - if (resid < 0) { - cto->rsp.m1.ct_scsi_status |= CT2_DATA_OVER; - } else if (resid > 0) { - cto->rsp.m1.ct_scsi_status |= CT2_DATA_UNDER; - } - if (fctape) { - cto->ct_flags |= CT2_CONFIRM; - } - if (sense_length) { - cto->rsp.m1.ct_scsi_status |= CT2_SNSLEN_VALID; - cto->rsp.m1.ct_resplen = cto->rsp.m1.ct_senselen = sense_length; - memcpy(cto->rsp.m1.ct_resp, &cso->sense_data, sense_length); - } - } else { - bus_addr_t addr; - char buf[XCMD_SIZE]; - fcp_rsp_iu_t *rp; + /* + * Mode 1, status, no data. Only possible when we are sending status, have + * no data to transfer, and the sense length can fit in the ct7_entry. + * + * Mode 2, status, no data. We have to use this in the case the the response + * length won't fit into a ct2_entry_t. + * + * We'll fill out this structure with information as if this were a + * Mode 1. The hardware layer will create the Mode 2 FCP RSP IU as + * needed based upon this. + */ + if (sendstatus && xfrlen == 0) { + cto->ct_flags |= CT2_SENDSTATUS | CT2_NO_DATA; + resid = atp->orig_datalen - atp->bytes_xfered - atp->bytes_in_transit; + if (sense_length <= MAXRESPLEN) { + if (resid < 0) { + cto->ct_resid = -resid; + } else if (resid > 0) { + cto->ct_resid = resid; + } + cto->ct_flags |= CT2_FLAG_MODE1; + cto->rsp.m1.ct_scsi_status = cso->scsi_status; + if (resid < 0) { + cto->rsp.m1.ct_scsi_status |= CT2_DATA_OVER; + } else if (resid > 0) { + cto->rsp.m1.ct_scsi_status |= CT2_DATA_UNDER; + } + if (fctape) { + cto->ct_flags |= CT2_CONFIRM; + } + if (sense_length) { + cto->rsp.m1.ct_scsi_status |= CT2_SNSLEN_VALID; + cto->rsp.m1.ct_resplen = cto->rsp.m1.ct_senselen = sense_length; + memcpy(cto->rsp.m1.ct_resp, &cso->sense_data, sense_length); + } + } else { + bus_addr_t addr; + char buf[XCMD_SIZE]; + fcp_rsp_iu_t *rp; - if (atp->ests == NULL) { - atp->ests = isp_get_ecmd(isp); if (atp->ests == NULL) { - goto restart_delay; + atp->ests = isp_get_ecmd(isp); + if (atp->ests == NULL) { + TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe); + break; + } + } + memset(buf, 0, sizeof (buf)); + rp = (fcp_rsp_iu_t *)buf; + if (fctape) { + cto->ct_flags |= CT2_CONFIRM; + rp->fcp_rsp_bits |= FCP_CONF_REQ; + } + cto->ct_flags |= CT2_FLAG_MODE2; + rp->fcp_rsp_scsi_status = cso->scsi_status; + if (resid < 0) { + rp->fcp_rsp_resid = -resid; + rp->fcp_rsp_bits |= FCP_RESID_OVERFLOW; + } else if (resid > 0) { + rp->fcp_rsp_resid = resid; + rp->fcp_rsp_bits |= FCP_RESID_UNDERFLOW; + } + if (sense_length) { + rp->fcp_rsp_snslen = sense_length; + rp->fcp_rsp_bits |= FCP_SNSLEN_VALID; + isp_put_fcp_rsp_iu(isp, rp, atp->ests); + memcpy(((fcp_rsp_iu_t *)atp->ests)->fcp_rsp_extra, &cso->sense_data, sense_length); + } else { + isp_put_fcp_rsp_iu(isp, rp, atp->ests); + } + if (isp->isp_dblev & ISP_LOGTDEBUG1) { + isp_print_bytes(isp, "FCP Response Frame After Swizzling", MIN_FCP_RESPONSE_SIZE + sense_length, atp->ests); + } + addr = isp->isp_osinfo.ecmd_dma; + addr += ((((isp_ecmd_t *)atp->ests) - isp->isp_osinfo.ecmd_base) * XCMD_SIZE); + isp_prt(isp, ISP_LOGTDEBUG0, "%s: ests base %p vaddr %p ecmd_dma %jx addr %jx len %u", __func__, isp->isp_osinfo.ecmd_base, atp->ests, + (uintmax_t) isp->isp_osinfo.ecmd_dma, (uintmax_t)addr, MIN_FCP_RESPONSE_SIZE + sense_length); + cto->rsp.m2.ct_datalen = MIN_FCP_RESPONSE_SIZE + sense_length; + if (isp->isp_osinfo.sixtyfourbit) { + cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base = DMA_LO32(addr); + cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi = DMA_HI32(addr); + cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count = MIN_FCP_RESPONSE_SIZE + sense_length; + } else { + cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base = DMA_LO32(addr); + cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count = MIN_FCP_RESPONSE_SIZE + sense_length; } - } - memset(buf, 0, sizeof (buf)); - rp = (fcp_rsp_iu_t *)buf; - if (fctape) { - cto->ct_flags |= CT2_CONFIRM; - rp->fcp_rsp_bits |= FCP_CONF_REQ; - } - cto->ct_flags |= CT2_FLAG_MODE2; - rp->fcp_rsp_scsi_status = cso->scsi_status; - if (resid < 0) { - rp->fcp_rsp_resid = -resid; - rp->fcp_rsp_bits |= FCP_RESID_OVERFLOW; - } else if (resid > 0) { - rp->fcp_rsp_resid = resid; - rp->fcp_rsp_bits |= FCP_RESID_UNDERFLOW; } if (sense_length) { - rp->fcp_rsp_snslen = sense_length; - rp->fcp_rsp_bits |= FCP_SNSLEN_VALID; - isp_put_fcp_rsp_iu(isp, rp, atp->ests); - memcpy(((fcp_rsp_iu_t *)atp->ests)->fcp_rsp_extra, &cso->sense_data, sense_length); + isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO2[0x%x] seq %u nc %d CDB0=%x sstatus=0x%x flags=0x%x resid=%d sense: %x %x/%x/%x", __func__, + cto->ct_rxid, ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), atp->cdb0, cso->scsi_status, cto->ct_flags, cto->ct_resid, + cso->sense_data.error_code, cso->sense_data.sense_buf[1], cso->sense_data.sense_buf[11], cso->sense_data.sense_buf[12]); } else { - isp_put_fcp_rsp_iu(isp, rp, atp->ests); - } - if (isp->isp_dblev & ISP_LOGTDEBUG1) { - isp_print_bytes(isp, "FCP Response Frame After Swizzling", MIN_FCP_RESPONSE_SIZE + sense_length, atp->ests); + isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO2[0x%x] seq %u nc %d CDB0=%x sstatus=0x%x flags=0x%x resid=%d", __func__, cto->ct_rxid, + ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), atp->cdb0, cso->scsi_status, cto->ct_flags, cto->ct_resid); } - addr = isp->isp_osinfo.ecmd_dma; - addr += ((((isp_ecmd_t *)atp->ests) - isp->isp_osinfo.ecmd_base) * XCMD_SIZE); - isp_prt(isp, repval, "%s: ests base %p vaddr %p ecmd_dma %jx addr %jx len %u", __func__, isp->isp_osinfo.ecmd_base, atp->ests, - (uintmax_t) isp->isp_osinfo.ecmd_dma, (uintmax_t)addr, MIN_FCP_RESPONSE_SIZE + sense_length); - cto->rsp.m2.ct_datalen = MIN_FCP_RESPONSE_SIZE + sense_length; - if (isp->isp_osinfo.sixtyfourbit) { - cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base = DMA_LO32(addr); - cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi = DMA_HI32(addr); - cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count = MIN_FCP_RESPONSE_SIZE + sense_length; + atp->state = ATPD_STATE_LAST_CTIO; + } + + if (xfrlen != 0) { + cto->ct_flags |= CT2_FLAG_MODE0; + if ((cso->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { + cto->ct_flags |= CT2_DATA_IN; } else { - cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base = DMA_LO32(addr); - cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count = MIN_FCP_RESPONSE_SIZE + sense_length; + cto->ct_flags |= CT2_DATA_OUT; } - } - if (sense_length) { - isp_prt(isp, repval, "%s: CTIO2[0x%x] CDB0=%x sstatus=0x%x flags=0x%x resid=%d sense: %x %x/%x/%x", __func__, - cto->ct_rxid, atp->cdb0, cso->scsi_status, cto->ct_flags, cto->ct_resid, cso->sense_data.error_code, - cso->sense_data.sense_buf[1], cso->sense_data.sense_buf[11], cso->sense_data.sense_buf[12]); - } else { - isp_prt(isp, repval, "%s: CTIO2[0x%x] CDB0=%x sstatus=0x%x flags=0x%x resid=%d", __func__, - cto->ct_rxid, atp->cdb0, cso->scsi_status, cto->ct_flags, cto->ct_resid); - } - atp->state = ATPD_STATE_LAST_CTIO; - } - if (xfrlen != 0) { - int resid = 0; - cto->ct_flags |= CT2_FLAG_MODE0; - if ((cso->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { - cto->ct_flags |= CT2_DATA_IN; - } else { - cto->ct_flags |= CT2_DATA_OUT; - } + cto->ct_reloff = atp->bytes_xfered + atp->bytes_in_transit; + cto->rsp.m0.ct_xfrlen = xfrlen; - /* - * Don't overrun the limits placed on us, but record it as - * if we had so that we can set an overflow bit later. - */ - atp->last_xframt = xfrlen; - if (atp->bytes_xfered + xfrlen > atp->orig_datalen) { - resid = 1; - xfrlen = atp->orig_datalen - atp->bytes_xfered; - } - cto->ct_reloff = atp->bytes_xfered; - cto->rsp.m0.ct_xfrlen = xfrlen; - - if (sendstatus) { - if (cso->scsi_status == SCSI_STATUS_OK && resid == 0 && fctape == 0) { - cto->ct_flags |= CT2_SENDSTATUS; - atp->state = ATPD_STATE_LAST_CTIO; + if (sendstatus) { + resid = atp->orig_datalen - atp->bytes_xfered - xfrlen; + if (cso->scsi_status == SCSI_STATUS_OK && resid == 0 /*&& fctape == 0*/) { + cto->ct_flags |= CT2_SENDSTATUS; + atp->state = ATPD_STATE_LAST_CTIO; + if (fctape) { + cto->ct_flags |= CT2_CONFIRM; + } + } else { + atp->sendst = 1; /* send status later */ + cto->ct_header.rqs_seqno &= ~ATPD_SEQ_NOTIFY_CAM; + atp->state = ATPD_STATE_CTIO; + } } else { - atp->sendst = 1; /* send status later */ - cto->ct_header.rqs_seqno = 0; atp->state = ATPD_STATE_CTIO; } + } + isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO2[%x] seq %u nc %d CDB0=%x scsi status %x flags %x resid %d xfrlen %u offset %u", __func__, cto->ct_rxid, + ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), atp->cdb0, cso->scsi_status, cto->ct_flags, cto->ct_resid, cso->dxfer_len, atp->bytes_xfered); + } else { + ct_entry_t *cto = (ct_entry_t *) local; + + cto->ct_header.rqs_entry_type = RQSTYPE_CTIO; + cto->ct_header.rqs_entry_count = 1; + cto->ct_header.rqs_seqno |= ATPD_SEQ_NOTIFY_CAM; + ATPD_SET_SEQNO(cto, atp); + cto->ct_iid = cso->init_id; + cto->ct_iid |= XS_CHANNEL(ccb) << 7; + cto->ct_tgt = ccb->ccb_h.target_id; + cto->ct_lun = ccb->ccb_h.target_lun; + cto->ct_fwhandle = cso->tag_id; + if (atp->rxid) { + cto->ct_tag_val = atp->rxid; + cto->ct_flags |= CT_TQAE; + } + if (ccb->ccb_h.flags & CAM_DIS_DISCONNECT) { + cto->ct_flags |= CT_NODISC; + } + if (cso->dxfer_len == 0) { + cto->ct_flags |= CT_NO_DATA; + } else if ((cso->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { + cto->ct_flags |= CT_DATA_IN; } else { - atp->state = ATPD_STATE_CTIO; + cto->ct_flags |= CT_DATA_OUT; + } + if (ccb->ccb_h.flags & CAM_SEND_STATUS) { + cto->ct_flags |= CT_SENDSTATUS|CT_CCINCR; + cto->ct_scsi_status = cso->scsi_status; + cto->ct_resid = atp->orig_datalen - atp->bytes_xfered - atp->bytes_in_transit - xfrlen; + isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO[%x] seq %u nc %d scsi status %x resid %d tag_id %x", __func__, + cto->ct_fwhandle, ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), cso->scsi_status, cso->resid, cso->tag_id); } + ccb->ccb_h.flags &= ~CAM_SEND_SENSE; + cto->ct_timeout = 10; } - isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO2[%x] CDB0=%x scsi status %x flags %x resid %d xfrlen %u offset %u", __func__, cto->ct_rxid, - atp->cdb0, cso->scsi_status, cto->ct_flags, cto->ct_resid, cso->dxfer_len, atp->bytes_xfered); - } else { - ct_entry_t *cto = (ct_entry_t *) local; - cto->ct_header.rqs_entry_type = RQSTYPE_CTIO; - cto->ct_header.rqs_entry_count = 1; - cto->ct_header.rqs_seqno = 1; - cto->ct_iid = cso->init_id; - cto->ct_iid |= XS_CHANNEL(ccb) << 7; - cto->ct_tgt = ccb->ccb_h.target_id; - cto->ct_lun = ccb->ccb_h.target_lun; - cto->ct_fwhandle = cso->tag_id; - if (atp->rxid) { - cto->ct_tag_val = atp->rxid; - cto->ct_flags |= CT_TQAE; - } - if (ccb->ccb_h.flags & CAM_DIS_DISCONNECT) { - cto->ct_flags |= CT_NODISC; - } - if (cso->dxfer_len == 0) { - cto->ct_flags |= CT_NO_DATA; - } else if ((cso->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { - cto->ct_flags |= CT_DATA_IN; - } else { - cto->ct_flags |= CT_DATA_OUT; + if (isp_get_pcmd(isp, ccb)) { + ISP_PATH_PRT(isp, ISP_LOGWARN, ccb->ccb_h.path, "out of PCMDs\n"); + TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe); + break; } - if (ccb->ccb_h.flags & CAM_SEND_STATUS) { - cto->ct_flags |= CT_SENDSTATUS|CT_CCINCR; - cto->ct_scsi_status = cso->scsi_status; - cto->ct_resid = cso->resid; - isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO[%x] scsi status %x resid %d tag_id %x", __func__, - cto->ct_fwhandle, cso->scsi_status, cso->resid, cso->tag_id); + if (isp_allocate_xs_tgt(isp, ccb, &handle)) { + ISP_PATH_PRT(isp, ISP_LOGWARN, ccb->ccb_h.path, "No XFLIST pointers for %s\n", __func__); + TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe); + isp_free_pcmd(isp, ccb); + break; } - ccb->ccb_h.flags &= ~CAM_SEND_SENSE; - cto->ct_timeout = 10; - } + atp->bytes_in_transit += xfrlen; + PISP_PCMD(ccb)->datalen = xfrlen; - if (isp_allocate_xs_tgt(isp, ccb, &handle)) { - ISP_PATH_PRT(isp, ISP_LOGWARN, ccb->ccb_h.path, "No XFLIST pointers for %s\n", __func__); - goto restart_delay; - } - /* - * Call the dma setup routines for this entry (and any subsequent - * CTIOs) if there's data to move, and then tell the f/w it's got - * new things to play with. As with isp_start's usage of DMA setup, - * any swizzling is done in the machine dependent layer. Because - * of this, we put the request onto the queue area first in native *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Aug 8 19:15:02 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 12DB9106564A; Wed, 8 Aug 2012 19:15:02 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EAE1D8FC12; Wed, 8 Aug 2012 19:15:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q78JF1aX017952; Wed, 8 Aug 2012 19:15:01 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q78JF1ja017951; Wed, 8 Aug 2012 19:15:01 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201208081915.q78JF1ja017951@svn.freebsd.org> From: Ed Maste Date: Wed, 8 Aug 2012 19:15:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239145 - head/tools/tools/netmap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Aug 2012 19:15:02 -0000 Author: emaste Date: Wed Aug 8 19:15:01 2012 New Revision: 239145 URL: http://svn.freebsd.org/changeset/base/239145 Log: Be more descriptive about poll error / timeout when transmitting. Modified: head/tools/tools/netmap/pkt-gen.c Modified: head/tools/tools/netmap/pkt-gen.c ============================================================================== --- head/tools/tools/netmap/pkt-gen.c Wed Aug 8 18:39:29 2012 (r239144) +++ head/tools/tools/netmap/pkt-gen.c Wed Aug 8 19:15:01 2012 (r239145) @@ -468,13 +468,14 @@ static void * sender_body(void *data) { struct targ *targ = (struct targ *) data; - struct pollfd fds[1]; struct netmap_if *nifp = targ->nifp; struct netmap_ring *txring; int i, pkts_per_td = targ->g->npackets / targ->g->nthreads, sent = 0; int continuous = 0; int options = targ->g->options | OPT_COPY; + int retval; + D("start"); if (pkts_per_td == 0) { continuous = 1; @@ -508,10 +509,14 @@ D("start"); /* * wait for available room in the send queue(s) */ - if (poll(fds, 1, 2000) <= 0) { + if ((retval = poll(fds, 1, 2000)) <= 0) { if (targ->cancel) break; - D("poll error/timeout on queue %d\n", targ->me); + if (retval == 0) + D("poll timeout on queue %d\n", targ->me); + else + D("poll error on queue %d: %s\n", targ->me, + strerror(errno)); goto quit; } /* From owner-svn-src-head@FreeBSD.ORG Thu Aug 9 10:45:50 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A70C4106564A; Thu, 9 Aug 2012 10:45:50 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from vps.rulingia.com (host-122-100-2-194.octopus.com.au [122.100.2.194]) by mx1.freebsd.org (Postfix) with ESMTP id 3624A8FC17; Thu, 9 Aug 2012 10:45:49 +0000 (UTC) Received: from server.rulingia.com (c220-239-247-45.belrs5.nsw.optusnet.com.au [220.239.247.45]) by vps.rulingia.com (8.14.5/8.14.5) with ESMTP id q79Ajlbm056115 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 9 Aug 2012 20:45:48 +1000 (EST) (envelope-from peter@rulingia.com) X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.14.5/8.14.5) with ESMTP id q79AjcGx021894 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 9 Aug 2012 20:45:38 +1000 (EST) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.14.5/8.14.5/Submit) id q79AjbQA021893; Thu, 9 Aug 2012 20:45:37 +1000 (EST) (envelope-from peter) Date: Thu, 9 Aug 2012 20:45:36 +1000 From: Peter Jeremy To: Alan Cox Message-ID: <20120809104536.GA21404@server.rulingia.com> References: <201207161813.q6GIDhm1068181@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2fHTh5uZTiUOsy+g" Content-Disposition: inline In-Reply-To: <201207161813.q6GIDhm1068181@svn.freebsd.org> X-PGP-Key: http://www.rulingia.com/keys/peter.pgp User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238536 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Aug 2012 10:45:50 -0000 --2fHTh5uZTiUOsy+g Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2012-Jul-16 18:13:43 +0000, Alan Cox wrote: > Various improvements to vm_contig_grow_cache(). Most notably, even when > it can't sleep, it can still move clean pages from the inactive queue to > the cache. Also, when a page is cached, there is no need to restart the > scan. The "next" page pointer held by vm_contig_launder() is still > valid. Finally, add a comment summarizing what vm_contig_grow_cache() > does based upon the value of "tries". > =20 > MFC after: 3 weeks I realise 3 weeks is only just up but I'm wondering if you intend to MFC this (and hopefully r238456) soon. I've had a quick try at merging this back to 8.x but it relies on vm_pageout_page_lock() and vm_page_unlock() which were added in r207694 and I'm not sure about the impact of merging that. --=20 Peter Jeremy --2fHTh5uZTiUOsy+g Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlAjlNAACgkQ/opHv/APuIdlyQCdFHL86DSZ9l7yjxnelSrLvMpa 17UAn1bbrovgAlpkeyfsHJrr1+FyXQw3 =cHSr -----END PGP SIGNATURE----- --2fHTh5uZTiUOsy+g-- From owner-svn-src-head@FreeBSD.ORG Thu Aug 9 14:46:53 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07ADE106564A; Thu, 9 Aug 2012 14:46:53 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CD78E8FC19; Thu, 9 Aug 2012 14:46:52 +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 q79EkqE7020525; Thu, 9 Aug 2012 14:46:52 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q79EkqtH020523; Thu, 9 Aug 2012 14:46:52 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201208091446.q79EkqtH020523@svn.freebsd.org> From: Ed Maste Date: Thu, 9 Aug 2012 14:46:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239149 - head/sys/dev/netmap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Aug 2012 14:46:53 -0000 Author: emaste Date: Thu Aug 9 14:46:52 2012 New Revision: 239149 URL: http://svn.freebsd.org/changeset/base/239149 Log: Improve lock and unlock symmetry - Move destruction of per-ring locks to netmap_dtor_locked to mirror the initialization that happens in NIOCREGIF. Otherwise unloading a netmap- capable interface that was never put into netmap mode would try to mtx_destroy an uninitialized mutex, and panic. - Destroy core_lock in netmap_detach, mirroring init in netmap_attach. - Also comment out the knlist_destroy for now as there is currently no knlist_init. Sponsored by: ADARA Networks Reviewed by: luigi@ Modified: head/sys/dev/netmap/netmap.c Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Wed Aug 8 20:21:33 2012 (r239148) +++ head/sys/dev/netmap/netmap.c Thu Aug 9 14:46:52 2012 (r239149) @@ -356,13 +356,20 @@ netmap_dtor_locked(void *data) lim = na->tx_rings[i].nkr_num_slots; for (j = 0; j < lim; j++) netmap_free_buf(nifp, ring->slot[j].buf_idx); + /* knlist_destroy(&na->tx_rings[i].si.si_note); */ + mtx_destroy(&na->tx_rings[i].q_lock); } for (i = 0; i < na->num_rx_rings + 1; i++) { struct netmap_ring *ring = na->rx_rings[i].ring; lim = na->rx_rings[i].nkr_num_slots; for (j = 0; j < lim; j++) netmap_free_buf(nifp, ring->slot[j].buf_idx); + /* knlist_destroy(&na->rx_rings[i].si.si_note); */ + mtx_destroy(&na->rx_rings[i].q_lock); } + /* XXX kqueue(9) needed; these will mirror knlist_init. */ + /* knlist_destroy(&na->tx_si.si_note); */ + /* knlist_destroy(&na->rx_si.si_note); */ NMA_UNLOCK(); netmap_free_rings(na); wakeup(na); @@ -1318,13 +1325,14 @@ netmap_attach(struct netmap_adapter *na, ifp->if_capabilities |= IFCAP_NETMAP; na = buf; + /* Core lock initialized here. Others are initialized after + * netmap_if_new. + */ + mtx_init(&na->core_lock, "netmap core lock", MTX_NETWORK_LOCK, + MTX_DEF); if (na->nm_lock == NULL) { ND("using default locks for %s", ifp->if_xname); na->nm_lock = netmap_lock_wrapper; - /* core lock initialized here. - * others initialized after netmap_if_new - */ - mtx_init(&na->core_lock, "netmap core lock", MTX_NETWORK_LOCK, MTX_DEF); } } #ifdef linux @@ -1348,22 +1356,13 @@ netmap_attach(struct netmap_adapter *na, void netmap_detach(struct ifnet *ifp) { - u_int i; struct netmap_adapter *na = NA(ifp); if (!na) return; - for (i = 0; i < na->num_tx_rings + 1; i++) { - knlist_destroy(&na->tx_rings[i].si.si_note); - mtx_destroy(&na->tx_rings[i].q_lock); - } - for (i = 0; i < na->num_rx_rings + 1; i++) { - knlist_destroy(&na->rx_rings[i].si.si_note); - mtx_destroy(&na->rx_rings[i].q_lock); - } - knlist_destroy(&na->tx_si.si_note); - knlist_destroy(&na->rx_si.si_note); + mtx_destroy(&na->core_lock); + bzero(na, sizeof(*na)); WNA(ifp) = NULL; free(na, M_DEVBUF); From owner-svn-src-head@FreeBSD.ORG Thu Aug 9 15:04:06 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F27E41065670; Thu, 9 Aug 2012 15:04:06 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DDBEB8FC24; Thu, 9 Aug 2012 15:04: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 q79F467e021915; Thu, 9 Aug 2012 15:04:06 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q79F46rO021913; Thu, 9 Aug 2012 15:04:06 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201208091504.q79F46rO021913@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 9 Aug 2012 15:04:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239150 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Aug 2012 15:04:07 -0000 Author: jilles Date: Thu Aug 9 15:04:06 2012 New Revision: 239150 URL: http://svn.freebsd.org/changeset/base/239150 Log: nftw(): Do not check the maxfds argument against OPEN_MAX. Apart from the fact that nothing should have OPEN_MAX as a limit (as opposed to RLIMIT_NOFILE from getrlimit() or _SC_OPEN_MAX from sysconf()), POSIX does not require us to check this. PR: 95239 Submitted by: Todd Miller Modified: head/lib/libc/gen/nftw.c Modified: head/lib/libc/gen/nftw.c ============================================================================== --- head/lib/libc/gen/nftw.c Thu Aug 9 14:46:52 2012 (r239149) +++ head/lib/libc/gen/nftw.c Thu Aug 9 15:04:06 2012 (r239150) @@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include int nftw(const char *path, int (*fn)(const char *, const struct stat *, int, @@ -47,7 +46,7 @@ nftw(const char *path, int (*fn)(const c int error = 0, ftsflags, fnflag, postorder, sverrno; /* XXX - nfds is currently unused */ - if (nfds < 1 || nfds > OPEN_MAX) { + if (nfds < 1) { errno = EINVAL; return (-1); } From owner-svn-src-head@FreeBSD.ORG Thu Aug 9 15:11:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6B838106566C; Thu, 9 Aug 2012 15:11:39 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 56C808FC08; Thu, 9 Aug 2012 15:11:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q79FBdaI022559; Thu, 9 Aug 2012 15:11:39 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q79FBd63022557; Thu, 9 Aug 2012 15:11:39 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201208091511.q79FBd63022557@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 9 Aug 2012 15:11:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239151 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Aug 2012 15:11:39 -0000 Author: jilles Date: Thu Aug 9 15:11:38 2012 New Revision: 239151 URL: http://svn.freebsd.org/changeset/base/239151 Log: ftw(): Do not check the maxfds argument against OPEN_MAX. Apart from the fact that nothing should have OPEN_MAX as a limit (as opposed to RLIMIT_NOFILE from getrlimit() or _SC_OPEN_MAX from sysconf()), POSIX does not require us to check this. POSIX does have a requirement on the application that maxfds not exceed {OPEN_MAX}, but does not require the implementation to check it ("may fail"). PR: 95239 Modified: head/lib/libc/gen/ftw.c Modified: head/lib/libc/gen/ftw.c ============================================================================== --- head/lib/libc/gen/ftw.c Thu Aug 9 15:04:06 2012 (r239150) +++ head/lib/libc/gen/ftw.c Thu Aug 9 15:11:38 2012 (r239151) @@ -28,7 +28,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include int ftw(const char *path, int (*fn)(const char *, const struct stat *, int), @@ -40,7 +39,7 @@ ftw(const char *path, int (*fn)(const ch int error = 0, fnflag, sverrno; /* XXX - nfds is currently unused */ - if (nfds < 1 || nfds > OPEN_MAX) { + if (nfds < 1) { errno = EINVAL; return (-1); } From owner-svn-src-head@FreeBSD.ORG Thu Aug 9 16:38:18 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66B56106566C; Thu, 9 Aug 2012 16:38:18 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 502258FC0C; Thu, 9 Aug 2012 16:38:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q79GcIQR029767; Thu, 9 Aug 2012 16:38:18 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q79GcITC029764; Thu, 9 Aug 2012 16:38:18 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201208091638.q79GcITC029764@svn.freebsd.org> From: Alan Cox Date: Thu, 9 Aug 2012 16:38:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239152 - in head/sys/mips: include mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Aug 2012 16:38:18 -0000 Author: alc Date: Thu Aug 9 16:38:17 2012 New Revision: 239152 URL: http://svn.freebsd.org/changeset/base/239152 Log: Merge r132141 and r111272 from amd64/i386: Reduce the size of a PV entry by eliminating pv_ptem. There is no need to store a pointer to the page table page in the PV entry because it is easily computed during the walk down the page table. Eliminate the ptphint from the pmap. Long, long ago, page table pages belonged to a vm object, and we would look up page table pages based upon their offset within this vm object. In those days, this hint may have had tangible benefits. Tested by: jchandra Modified: head/sys/mips/include/pmap.h head/sys/mips/mips/pmap.c Modified: head/sys/mips/include/pmap.h ============================================================================== --- head/sys/mips/include/pmap.h Thu Aug 9 15:11:38 2012 (r239151) +++ head/sys/mips/include/pmap.h Thu Aug 9 16:38:17 2012 (r239152) @@ -90,7 +90,6 @@ struct pmap { u_int32_t gen:ASIDGEN_BITS; /* its generation number */ } pm_asid[MAXSMPCPU]; struct pmap_statistics pm_stats; /* pmap statistics */ - struct vm_page *pm_ptphint; /* pmap ptp hint */ struct mtx pm_mtx; }; @@ -126,7 +125,6 @@ typedef struct pv_entry { vm_offset_t pv_va; /* virtual address for mapping */ TAILQ_ENTRY(pv_entry) pv_list; TAILQ_ENTRY(pv_entry) pv_plist; - vm_page_t pv_ptem; /* VM page for pte */ } *pv_entry_t; /* Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Thu Aug 9 15:11:38 2012 (r239151) +++ head/sys/mips/mips/pmap.c Thu Aug 9 16:38:17 2012 (r239152) @@ -164,7 +164,8 @@ static pv_entry_t pmap_pvh_remove(struct static __inline void pmap_changebit(vm_page_t m, int bit, boolean_t setem); static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, vm_page_t mpte); -static int pmap_remove_pte(struct pmap *pmap, pt_entry_t *ptq, vm_offset_t va); +static int pmap_remove_pte(struct pmap *pmap, pt_entry_t *ptq, vm_offset_t va, + pd_entry_t pde); static void pmap_remove_page(struct pmap *pmap, vm_offset_t va); static void pmap_remove_entry(struct pmap *pmap, vm_page_t m, vm_offset_t va); static boolean_t pmap_try_insert_pv_entry(pmap_t pmap, vm_page_t mpte, @@ -176,7 +177,7 @@ static int _pmap_unwire_pte_hold(pmap_t static vm_page_t pmap_allocpte(pmap_t pmap, vm_offset_t va, int flags); static vm_page_t _pmap_allocpte(pmap_t pmap, unsigned ptepindex, int flags); -static int pmap_unuse_pt(pmap_t, vm_offset_t, vm_page_t); +static int pmap_unuse_pt(pmap_t, vm_offset_t, pd_entry_t); static pt_entry_t init_pte_prot(vm_offset_t va, vm_page_t m, vm_prot_t prot); #ifdef SMP @@ -973,8 +974,6 @@ _pmap_unwire_pte_hold(pmap_t pmap, vm_of pmap_unwire_pte_hold(pmap, va, pdpg); } #endif - if (pmap->pm_ptphint == m) - pmap->pm_ptphint = NULL; /* * If the page is finally unwired, simply free it. @@ -989,25 +988,14 @@ _pmap_unwire_pte_hold(pmap_t pmap, vm_of * conditionally free the page, and manage the hold/wire counts. */ static int -pmap_unuse_pt(pmap_t pmap, vm_offset_t va, vm_page_t mpte) +pmap_unuse_pt(pmap_t pmap, vm_offset_t va, pd_entry_t pde) { - unsigned ptepindex; - pd_entry_t pteva; + vm_page_t mpte; if (va >= VM_MAXUSER_ADDRESS) return (0); - - if (mpte == NULL) { - ptepindex = pmap_pde_pindex(va); - if (pmap->pm_ptphint && - (pmap->pm_ptphint->pindex == ptepindex)) { - mpte = pmap->pm_ptphint; - } else { - pteva = *pmap_pde(pmap, va); - mpte = PHYS_TO_VM_PAGE(MIPS_DIRECT_TO_PHYS(pteva)); - pmap->pm_ptphint = mpte; - } - } + KASSERT(pde != 0, ("pmap_unuse_pt: pde != 0")); + mpte = PHYS_TO_VM_PAGE(MIPS_DIRECT_TO_PHYS(pde)); return (pmap_unwire_pte_hold(pmap, va, mpte)); } @@ -1019,7 +1007,6 @@ pmap_pinit0(pmap_t pmap) PMAP_LOCK_INIT(pmap); pmap->pm_segtab = kernel_segmap; CPU_ZERO(&pmap->pm_active); - pmap->pm_ptphint = NULL; for (i = 0; i < MAXCPU; i++) { pmap->pm_asid[i].asid = PMAP_ASID_RESERVED; pmap->pm_asid[i].gen = 0; @@ -1079,7 +1066,6 @@ pmap_pinit(pmap_t pmap) ptdva = MIPS_PHYS_TO_DIRECT(VM_PAGE_TO_PHYS(ptdpg)); pmap->pm_segtab = (pd_entry_t *)ptdva; CPU_ZERO(&pmap->pm_active); - pmap->pm_ptphint = NULL; for (i = 0; i < MAXCPU; i++) { pmap->pm_asid[i].asid = PMAP_ASID_RESERVED; pmap->pm_asid[i].gen = 0; @@ -1156,17 +1142,11 @@ _pmap_allocpte(pmap_t pmap, unsigned pte /* Next level entry */ pde = (pd_entry_t *)*pdep; pde[pdeindex] = (pd_entry_t)pageva; - pmap->pm_ptphint = m; } #else pmap->pm_segtab[ptepindex] = (pd_entry_t)pageva; #endif pmap->pm_stats.resident_count++; - - /* - * Set the page table hint - */ - pmap->pm_ptphint = m; return (m); } @@ -1196,16 +1176,7 @@ retry: * count, and activate it. */ if (pde != NULL && *pde != NULL) { - /* - * In order to get the page table page, try the hint first. - */ - if (pmap->pm_ptphint && - (pmap->pm_ptphint->pindex == ptepindex)) { - m = pmap->pm_ptphint; - } else { - m = PHYS_TO_VM_PAGE(MIPS_DIRECT_TO_PHYS(*pde)); - pmap->pm_ptphint = m; - } + m = PHYS_TO_VM_PAGE(MIPS_DIRECT_TO_PHYS(*pde)); m->wire_count++; } else { /* @@ -1351,6 +1322,7 @@ get_pv_entry(pmap_t locked_pmap) static const struct timeval printinterval = { 60, 0 }; static struct timeval lastprint; struct vpgqueues *vpq; + pd_entry_t *pde; pt_entry_t *pte, oldpte; pmap_t pmap; pv_entry_t allocated_pv, next_pv, pv; @@ -1389,8 +1361,10 @@ retry: else if (pmap != locked_pmap && !PMAP_TRYLOCK(pmap)) continue; pmap->pm_stats.resident_count--; - pte = pmap_pte(pmap, va); - KASSERT(pte != NULL, ("pte")); + pde = pmap_pde(pmap, va); + KASSERT(pde != NULL && *pde != 0, + ("get_pv_entry: pde")); + pte = pmap_pde_to_pte(pde, va); oldpte = *pte; if (is_kernel_pmap(pmap)) *pte = PTE_G; @@ -1406,7 +1380,7 @@ retry: TAILQ_REMOVE(&pmap->pm_pvlist, pv, pv_plist); m->md.pv_list_count--; TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - pmap_unuse_pt(pmap, va, pv->pv_ptem); + pmap_unuse_pt(pmap, va, *pde); if (pmap != locked_pmap) PMAP_UNLOCK(pmap); if (allocated_pv == NULL) @@ -1513,7 +1487,6 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm pv_entry_count++; pv->pv_va = va; pv->pv_pmap = pmap; - pv->pv_ptem = mpte; TAILQ_INSERT_TAIL(&pmap->pm_pvlist, pv, pv_plist); TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); m->md.pv_list_count++; @@ -1526,7 +1499,8 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm * pmap_remove_pte: do the things to unmap a page in a process */ static int -pmap_remove_pte(struct pmap *pmap, pt_entry_t *ptq, vm_offset_t va) +pmap_remove_pte(struct pmap *pmap, pt_entry_t *ptq, vm_offset_t va, + pd_entry_t pde) { pt_entry_t oldpte; vm_page_t m; @@ -1561,7 +1535,7 @@ pmap_remove_pte(struct pmap *pmap, pt_en pmap_remove_entry(pmap, m, va); } - return (pmap_unuse_pt(pmap, va, NULL)); + return (pmap_unuse_pt(pmap, va, pde)); } /* @@ -1570,16 +1544,20 @@ pmap_remove_pte(struct pmap *pmap, pt_en static void pmap_remove_page(struct pmap *pmap, vm_offset_t va) { + pd_entry_t *pde; pt_entry_t *ptq; mtx_assert(&vm_page_queue_mtx, MA_OWNED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); - ptq = pmap_pte(pmap, va); + pde = pmap_pde(pmap, va); + if (pde == NULL || *pde == 0) + return; + ptq = pmap_pde_to_pte(pde, va); /* * if there is no pte for this address, just skip it!!! */ - if (!ptq || !pte_test(ptq, PTE_V)) { + if (!pte_test(ptq, PTE_V)) { return; } @@ -1591,7 +1569,7 @@ pmap_remove_page(struct pmap *pmap, vm_o /* * get a local va for mappings for this pmap. */ - (void)pmap_remove_pte(pmap, ptq, va); + (void)pmap_remove_pte(pmap, ptq, va, *pde); pmap_invalidate_page(pmap, va); return; @@ -1673,6 +1651,7 @@ void pmap_remove_all(vm_page_t m) { pv_entry_t pv; + pd_entry_t *pde; pt_entry_t *pte, tpte; KASSERT((m->oflags & VPO_UNMANAGED) == 0, @@ -1694,7 +1673,9 @@ pmap_remove_all(vm_page_t m) pv->pv_pmap->pm_stats.resident_count--; - pte = pmap_pte(pv->pv_pmap, pv->pv_va); + pde = pmap_pde(pv->pv_pmap, pv->pv_va); + KASSERT(pde != NULL && *pde != 0, ("pmap_remove_all: pde")); + pte = pmap_pde_to_pte(pde, pv->pv_va); tpte = *pte; if (is_kernel_pmap(pv->pv_pmap)) @@ -1719,7 +1700,7 @@ pmap_remove_all(vm_page_t m) TAILQ_REMOVE(&pv->pv_pmap->pm_pvlist, pv, pv_plist); TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); m->md.pv_list_count--; - pmap_unuse_pt(pv->pv_pmap, pv->pv_va, pv->pv_ptem); + pmap_unuse_pt(pv->pv_pmap, pv->pv_va, *pde); PMAP_UNLOCK(pv->pv_pmap); free_pv_entry(pv); } @@ -1925,7 +1906,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, pv = get_pv_entry(pmap); pv->pv_va = va; pv->pv_pmap = pmap; - pv->pv_ptem = mpte; TAILQ_INSERT_TAIL(&pmap->pm_pvlist, pv, pv_plist); TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); m->md.pv_list_count++; @@ -2063,14 +2043,8 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ * increment the hold count, and activate it. */ if (pde && *pde != 0) { - if (pmap->pm_ptphint && - (pmap->pm_ptphint->pindex == ptepindex)) { - mpte = pmap->pm_ptphint; - } else { - mpte = PHYS_TO_VM_PAGE( - MIPS_DIRECT_TO_PHYS(*pde)); - pmap->pm_ptphint = mpte; - } + mpte = PHYS_TO_VM_PAGE( + MIPS_DIRECT_TO_PHYS(*pde)); mpte->wire_count++; } else { mpte = _pmap_allocpte(pmap, ptepindex, @@ -2458,6 +2432,7 @@ pmap_page_exists_quick(pmap_t pmap, vm_p void pmap_remove_pages(pmap_t pmap) { + pd_entry_t *pde; pt_entry_t *pte, tpte; pv_entry_t pv, npv; vm_page_t m; @@ -2470,7 +2445,9 @@ pmap_remove_pages(pmap_t pmap) PMAP_LOCK(pmap); for (pv = TAILQ_FIRST(&pmap->pm_pvlist); pv != NULL; pv = npv) { - pte = pmap_pte(pv->pv_pmap, pv->pv_va); + pde = pmap_pde(pmap, pv->pv_va); + KASSERT(pde != NULL && *pde != 0, ("pmap_remove_pages: pde")); + pte = pmap_pde_to_pte(pde, pv->pv_va); if (!pte_test(pte, PTE_V)) panic("pmap_remove_pages: page on pm_pvlist has no pte"); tpte = *pte; @@ -2488,7 +2465,7 @@ pmap_remove_pages(pmap_t pmap) KASSERT(m != NULL, ("pmap_remove_pages: bad tpte %#jx", (uintmax_t)tpte)); - pv->pv_pmap->pm_stats.resident_count--; + pmap->pm_stats.resident_count--; /* * Update the vm_page_t clean and reference bits. @@ -2497,14 +2474,14 @@ pmap_remove_pages(pmap_t pmap) vm_page_dirty(m); } npv = TAILQ_NEXT(pv, pv_plist); - TAILQ_REMOVE(&pv->pv_pmap->pm_pvlist, pv, pv_plist); + TAILQ_REMOVE(&pmap->pm_pvlist, pv, pv_plist); m->md.pv_list_count--; TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); if (TAILQ_FIRST(&m->md.pv_list) == NULL) { vm_page_aflag_clear(m, PGA_WRITEABLE); } - pmap_unuse_pt(pv->pv_pmap, pv->pv_va, pv->pv_ptem); + pmap_unuse_pt(pmap, pv->pv_va, *pde); free_pv_entry(pv); } pmap_invalidate_all(pmap); From owner-svn-src-head@FreeBSD.ORG Thu Aug 9 17:15:11 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A1BC01065674; Thu, 9 Aug 2012 17:15:11 +0000 (UTC) (envelope-from alc@rice.edu) Received: from mh11.mail.rice.edu (mh11.mail.rice.edu [128.42.199.30]) by mx1.freebsd.org (Postfix) with ESMTP id 6F0A18FC0A; Thu, 9 Aug 2012 17:15:11 +0000 (UTC) Received: from mh11.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh11.mail.rice.edu (Postfix) with ESMTP id 8F8B44C01CE; Thu, 9 Aug 2012 12:15:10 -0500 (CDT) Received: from mh11.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh11.mail.rice.edu (Postfix) with ESMTP id 8DEE54C01C1; Thu, 9 Aug 2012 12:15:10 -0500 (CDT) X-Virus-Scanned: by amavis-2.7.0 at mh11.mail.rice.edu, auth channel Received: from mh11.mail.rice.edu ([127.0.0.1]) by mh11.mail.rice.edu (mh11.mail.rice.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id PgtDSlHPMsnC; Thu, 9 Aug 2012 12:15:10 -0500 (CDT) Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh11.mail.rice.edu (Postfix) with ESMTPSA id 159414C0179; Thu, 9 Aug 2012 12:15:10 -0500 (CDT) Message-ID: <5023F01B.9030005@rice.edu> Date: Thu, 09 Aug 2012 12:15:07 -0500 From: Alan Cox User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:8.0) Gecko/20111113 Thunderbird/8.0 MIME-Version: 1.0 To: Peter Jeremy References: <201207161813.q6GIDhm1068181@svn.freebsd.org> <20120809104536.GA21404@server.rulingia.com> In-Reply-To: <20120809104536.GA21404@server.rulingia.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Alan Cox , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238536 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Aug 2012 17:15:11 -0000 On 08/09/2012 05:45, Peter Jeremy wrote: > On 2012-Jul-16 18:13:43 +0000, Alan Cox wrote: >> Various improvements to vm_contig_grow_cache(). Most notably, even when >> it can't sleep, it can still move clean pages from the inactive queue to >> the cache. Also, when a page is cached, there is no need to restart the >> scan. The "next" page pointer held by vm_contig_launder() is still >> valid. Finally, add a comment summarizing what vm_contig_grow_cache() >> does based upon the value of "tries". >> >> MFC after: 3 weeks > I realise 3 weeks is only just up but I'm wondering if you intend to > MFC this (and hopefully r238456) soon. I've had a quick try at > merging this back to 8.x but it relies on vm_pageout_page_lock() > and vm_page_unlock() which were added in r207694 and I'm not sure > about the impact of merging that. > Probably not until the 9.1 release cycle runs its course. As for 8.x, the change will have to be revised for the different locking schema in 8.x. Alan From owner-svn-src-head@FreeBSD.ORG Thu Aug 9 18:10:00 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 878CD106566C; Thu, 9 Aug 2012 18:10:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 675D58FC0A; Thu, 9 Aug 2012 18:10: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 q79IA08R037354; Thu, 9 Aug 2012 18:10:00 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q79IA0eG037352; Thu, 9 Aug 2012 18:10:00 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201208091810.q79IA0eG037352@svn.freebsd.org> From: Alexander Motin Date: Thu, 9 Aug 2012 18:10:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239153 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Aug 2012 18:10:00 -0000 Author: mav Date: Thu Aug 9 18:09:59 2012 New Revision: 239153 URL: http://svn.freebsd.org/changeset/base/239153 Log: SCHED_4BSD scheduling quantum mechanism appears to be broken for some time. With switchticks variable being reset each time thread preempted (that is done regularly by interrupt threads) scheduling quantum may never expire. It was not noticed in time because several other factors still regularly trigger context switches. Handle the problem by replacing that mechanism with its equivalent from SCHED_ULE called time slice. It is effectively the same, just measured in context of stathz instead of hz. Some unification is probably not bad. Modified: head/sys/kern/sched_4bsd.c Modified: head/sys/kern/sched_4bsd.c ============================================================================== --- head/sys/kern/sched_4bsd.c Thu Aug 9 16:38:17 2012 (r239152) +++ head/sys/kern/sched_4bsd.c Thu Aug 9 18:09:59 2012 (r239153) @@ -94,6 +94,7 @@ struct td_sched { fixpt_t ts_pctcpu; /* (j) %cpu during p_swtime. */ int ts_cpticks; /* (j) Ticks of cpu time. */ int ts_slptime; /* (j) Seconds !RUNNING. */ + int ts_slice; /* Remaining part of time slice. */ int ts_flags; struct runq *ts_runq; /* runq the thread is currently on */ #ifdef KTR @@ -117,9 +118,9 @@ struct td_sched { static struct td_sched td_sched0; struct mtx sched_lock; +static int realstathz; /* stathz is sometimes 0 and run off of hz. */ static int sched_tdcnt; /* Total runnable threads in the system. */ -static int sched_quantum; /* Roundrobin scheduling quantum in ticks. */ -#define SCHED_QUANTUM (hz / 10) /* Default sched quantum */ +static int sched_slice = 1; /* Thread run time before rescheduling. */ static void setup_runqs(void); static void schedcpu(void); @@ -145,6 +146,10 @@ SYSINIT(schedcpu, SI_SUB_RUN_SCHEDULER, &sched_kp); SYSINIT(sched_setup, SI_SUB_RUN_QUEUE, SI_ORDER_FIRST, sched_setup, NULL); +static void sched_initticks(void *dummy); +SYSINIT(sched_initticks, SI_SUB_CLOCKS, SI_ORDER_THIRD, sched_initticks, + NULL); + /* * Global run queue. */ @@ -179,31 +184,12 @@ setup_runqs(void) runq_init(&runq); } -static int -sysctl_kern_quantum(SYSCTL_HANDLER_ARGS) -{ - int error, new_val; - - new_val = sched_quantum * tick; - error = sysctl_handle_int(oidp, &new_val, 0, req); - if (error != 0 || req->newptr == NULL) - return (error); - if (new_val < tick) - return (EINVAL); - sched_quantum = new_val / tick; - hogticks = 2 * sched_quantum; - return (0); -} - SYSCTL_NODE(_kern, OID_AUTO, sched, CTLFLAG_RD, 0, "Scheduler"); SYSCTL_STRING(_kern_sched, OID_AUTO, name, CTLFLAG_RD, "4BSD", 0, "Scheduler name"); - -SYSCTL_PROC(_kern_sched, OID_AUTO, quantum, CTLTYPE_INT | CTLFLAG_RW, - 0, sizeof sched_quantum, sysctl_kern_quantum, "I", - "Roundrobin scheduling quantum in microseconds"); - +SYSCTL_INT(_kern_sched, OID_AUTO, slice, CTLFLAG_RW, &sched_slice, 0, + "Slice size for timeshare threads"); #ifdef SMP /* Enable forwarding of wakeups to all other cpus */ static SYSCTL_NODE(_kern_sched, OID_AUTO, ipiwakeup, CTLFLAG_RD, NULL, @@ -471,9 +457,8 @@ schedcpu(void) struct thread *td; struct proc *p; struct td_sched *ts; - int awake, realstathz; + int awake; - realstathz = stathz ? stathz : hz; sx_slock(&allproc_lock); FOREACH_PROC_IN_SYSTEM(p) { PROC_LOCK(p); @@ -645,14 +630,28 @@ sched_setup(void *dummy) { setup_runqs(); - if (sched_quantum == 0) - sched_quantum = SCHED_QUANTUM; - hogticks = 2 * sched_quantum; + /* + * To avoid divide-by-zero, we set realstathz a dummy value + * in case which sched_clock() called before sched_initticks(). + */ + realstathz = hz; + sched_slice = realstathz / 10; /* ~100ms */ /* Account for thread0. */ sched_load_add(); } +/* + * This routine determines the sched_slice after stathz and hz are setup. + */ +static void +sched_initticks(void *dummy) +{ + + realstathz = stathz ? stathz : hz; + sched_slice = realstathz / 10; /* ~100ms */ +} + /* External interfaces start here */ /* @@ -670,6 +669,7 @@ schedinit(void) proc0.p_sched = NULL; /* XXX */ thread0.td_sched = &td_sched0; thread0.td_lock = &sched_lock; + td_sched0.ts_slice = sched_slice; mtx_init(&sched_lock, "sched lock", NULL, MTX_SPIN | MTX_RECURSE); } @@ -686,9 +686,9 @@ sched_runnable(void) int sched_rr_interval(void) { - if (sched_quantum == 0) - sched_quantum = SCHED_QUANTUM; - return (sched_quantum); + + /* Convert sched_slice from stathz to hz. */ + return (hz / (realstathz / sched_slice)); } /* @@ -725,9 +725,10 @@ sched_clock(struct thread *td) * Force a context switch if the current thread has used up a full * quantum (default quantum is 100ms). */ - if (!TD_IS_IDLETHREAD(td) && - ticks - PCPU_GET(switchticks) >= sched_quantum) + if (!TD_IS_IDLETHREAD(td) && (--ts->ts_slice <= 0)) { + ts->ts_slice = sched_slice; td->td_flags |= TDF_NEEDRESCHED; + } stat = DPCPU_PTR(idlestat); stat->oldidlecalls = stat->idlecalls; @@ -781,6 +782,7 @@ sched_fork_thread(struct thread *td, str ts = childtd->td_sched; bzero(ts, sizeof(*ts)); ts->ts_flags |= (td->td_sched->ts_flags & TSF_AFFINITY); + ts->ts_slice = 1; } void @@ -1077,6 +1079,7 @@ sched_wakeup(struct thread *td) } td->td_slptick = 0; ts->ts_slptime = 0; + ts->ts_slice = sched_slice; sched_add(td, SRQ_BORING); } From owner-svn-src-head@FreeBSD.ORG Thu Aug 9 19:22:55 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DB331065743; Thu, 9 Aug 2012 19:22:55 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 58CA48FC08; Thu, 9 Aug 2012 19:22:55 +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 q79JMtQ0043712; Thu, 9 Aug 2012 19:22:55 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q79JMtlR043710; Thu, 9 Aug 2012 19:22:55 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201208091922.q79JMtlR043710@svn.freebsd.org> From: Xin LI Date: Thu, 9 Aug 2012 19:22:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239156 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Aug 2012 19:22:55 -0000 Author: delphij Date: Thu Aug 9 19:22:54 2012 New Revision: 239156 URL: http://svn.freebsd.org/changeset/base/239156 Log: Refresh with OpenBSD RCS ID changes to reflect that we now have essentionally the same file. Modified: head/lib/libc/gen/nftw.c Modified: head/lib/libc/gen/nftw.c ============================================================================== --- head/lib/libc/gen/nftw.c Thu Aug 9 19:11:31 2012 (r239155) +++ head/lib/libc/gen/nftw.c Thu Aug 9 19:22:54 2012 (r239156) @@ -1,4 +1,4 @@ -/* $OpenBSD: nftw.c,v 1.4 2004/07/07 16:05:23 millert Exp $ */ +/* $OpenBSD: nftw.c,v 1.7 2006/03/31 19:41:44 millert Exp $ */ /* * Copyright (c) 2003, 2004 Todd C. Miller @@ -20,12 +20,6 @@ * Materiel Command, USAF, under agreement number F39502-99-1-0512. */ -#if 0 -#if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$OpenBSD: nftw.c,v 1.4 2004/07/07 16:05:23 millert Exp $"; -#endif /* LIBC_SCCS and not lint */ -#endif - #include __FBSDID("$FreeBSD$"); From owner-svn-src-head@FreeBSD.ORG Thu Aug 9 19:26:13 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DE010106566B; Thu, 9 Aug 2012 19:26:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C92F18FC08; Thu, 9 Aug 2012 19:26: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 q79JQD4o044018; Thu, 9 Aug 2012 19:26:13 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q79JQDSM044014; Thu, 9 Aug 2012 19:26:13 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201208091926.q79JQDSM044014@svn.freebsd.org> From: Alexander Motin Date: Thu, 9 Aug 2012 19:26:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239157 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Aug 2012 19:26:14 -0000 Author: mav Date: Thu Aug 9 19:26:13 2012 New Revision: 239157 URL: http://svn.freebsd.org/changeset/base/239157 Log: Rework r220198 change (by fabient). I believe it solves the problem from the wrong direction. Before it, if preemption and end of time slice happen same time, thread was put to the head of the queue as for only preemption. It could cause single thread to run for indefinitely long time. r220198 handles it by not clearing TDF_NEEDRESCHED in case of preemption. But that causes delayed context switch every time preemption happens, even when not needed. Solve problem by introducing scheduler-specifoc thread flag TDF_SLICEEND, set when thread's time slice is over and it should be put to the tail of queue. Using SW_PREEMPT flag for that purpose as it was before just not enough informative to work correctly. On my tests this by 2-3 times reduces run time deviation (improves fairness) in cases when several threads share one CPU. Reviewed by: fabient MFC after: 2 months Sponsored by: iXsystems, Inc. Modified: head/sys/kern/sched_4bsd.c head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_4bsd.c ============================================================================== --- head/sys/kern/sched_4bsd.c Thu Aug 9 19:22:54 2012 (r239156) +++ head/sys/kern/sched_4bsd.c Thu Aug 9 19:26:13 2012 (r239157) @@ -105,6 +105,7 @@ struct td_sched { /* flags kept in td_flags */ #define TDF_DIDRUN TDF_SCHED0 /* thread actually ran. */ #define TDF_BOUND TDF_SCHED1 /* Bound to one CPU. */ +#define TDF_SLICEEND TDF_SCHED2 /* Thread time slice is over. */ /* flags kept in ts_flags */ #define TSF_AFFINITY 0x0001 /* Has a non-"full" CPU set. */ @@ -727,7 +728,7 @@ sched_clock(struct thread *td) */ if (!TD_IS_IDLETHREAD(td) && (--ts->ts_slice <= 0)) { ts->ts_slice = sched_slice; - td->td_flags |= TDF_NEEDRESCHED; + td->td_flags |= TDF_NEEDRESCHED | TDF_SLICEEND; } stat = DPCPU_PTR(idlestat); @@ -943,6 +944,7 @@ sched_switch(struct thread *td, struct t struct mtx *tmtx; struct td_sched *ts; struct proc *p; + int preempted; tmtx = NULL; ts = td->td_sched; @@ -964,8 +966,8 @@ sched_switch(struct thread *td, struct t sched_load_rem(); td->td_lastcpu = td->td_oncpu; - if (!(flags & SW_PREEMPT)) - td->td_flags &= ~TDF_NEEDRESCHED; + preempted = !(td->td_flags & TDF_SLICEEND); + td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); td->td_owepreempt = 0; td->td_oncpu = NOCPU; @@ -983,7 +985,7 @@ sched_switch(struct thread *td, struct t } else { if (TD_IS_RUNNING(td)) { /* Put us back on the run queue. */ - sched_add(td, (flags & SW_PREEMPT) ? + sched_add(td, preempted ? SRQ_OURSELF|SRQ_YIELDING|SRQ_PREEMPTED : SRQ_OURSELF|SRQ_YIELDING); } Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Thu Aug 9 19:22:54 2012 (r239156) +++ head/sys/kern/sched_ule.c Thu Aug 9 19:26:13 2012 (r239157) @@ -189,6 +189,9 @@ static struct td_sched td_sched0; #define SCHED_INTERACT_HALF (SCHED_INTERACT_MAX / 2) #define SCHED_INTERACT_THRESH (30) +/* Flags kept in td_flags. */ +#define TDF_SLICEEND TDF_SCHED2 /* Thread time slice is over. */ + /* * tickincr: Converts a stathz tick into a hz domain scaled by * the shift factor. Without the shift the error rate @@ -1841,7 +1844,7 @@ sched_switch(struct thread *td, struct t struct td_sched *ts; struct mtx *mtx; int srqflag; - int cpuid; + int cpuid, preempted; THREAD_LOCK_ASSERT(td, MA_OWNED); KASSERT(newtd == NULL, ("sched_switch: Unsupported newtd argument")); @@ -1854,8 +1857,8 @@ sched_switch(struct thread *td, struct t ts->ts_rltick = ticks; td->td_lastcpu = td->td_oncpu; td->td_oncpu = NOCPU; - if (!(flags & SW_PREEMPT)) - td->td_flags &= ~TDF_NEEDRESCHED; + preempted = !(td->td_flags & TDF_SLICEEND); + td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); td->td_owepreempt = 0; tdq->tdq_switchcnt++; /* @@ -1867,7 +1870,7 @@ sched_switch(struct thread *td, struct t TD_SET_CAN_RUN(td); } else if (TD_IS_RUNNING(td)) { MPASS(td->td_lock == TDQ_LOCKPTR(tdq)); - srqflag = (flags & SW_PREEMPT) ? + srqflag = preempted ? SRQ_OURSELF|SRQ_YIELDING|SRQ_PREEMPTED : SRQ_OURSELF|SRQ_YIELDING; #ifdef SMP @@ -2237,7 +2240,7 @@ sched_clock(struct thread *td) * We're out of time, force a requeue at userret(). */ ts->ts_slice = sched_slice; - td->td_flags |= TDF_NEEDRESCHED; + td->td_flags |= TDF_NEEDRESCHED | TDF_SLICEEND; } /* From owner-svn-src-head@FreeBSD.ORG Thu Aug 9 22:05:41 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B0D25106566C; Thu, 9 Aug 2012 22:05:41 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9127E8FC08; Thu, 9 Aug 2012 22:05:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q79M5f6j058913; Thu, 9 Aug 2012 22:05:41 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q79M5fvN058909; Thu, 9 Aug 2012 22:05:41 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201208092205.q79M5fvN058909@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 9 Aug 2012 22:05:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239160 - in head: lib/libc/gen tools/regression/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Aug 2012 22:05:41 -0000 Author: jilles Date: Thu Aug 9 22:05:40 2012 New Revision: 239160 URL: http://svn.freebsd.org/changeset/base/239160 Log: nftw(): POSIX says directories causing loops should be silently skipped. Formerly, loops caused nftw() to abort the traversal with ELOOP. Added: head/tools/regression/lib/libc/gen/test-ftw.c (contents, props changed) Modified: head/lib/libc/gen/nftw.c head/tools/regression/lib/libc/gen/Makefile Modified: head/lib/libc/gen/nftw.c ============================================================================== --- head/lib/libc/gen/nftw.c Thu Aug 9 20:27:11 2012 (r239159) +++ head/lib/libc/gen/nftw.c Thu Aug 9 22:05:40 2012 (r239160) @@ -65,6 +65,8 @@ nftw(const char *path, int (*fn)(const c continue; fnflag = FTW_D; break; + case FTS_DC: + continue; case FTS_DNR: fnflag = FTW_DNR; break; @@ -87,9 +89,6 @@ nftw(const char *path, int (*fn)(const c case FTS_SLNONE: fnflag = FTW_SLN; break; - case FTS_DC: - errno = ELOOP; - /* FALLTHROUGH */ default: error = -1; goto done; Modified: head/tools/regression/lib/libc/gen/Makefile ============================================================================== --- head/tools/regression/lib/libc/gen/Makefile Thu Aug 9 20:27:11 2012 (r239159) +++ head/tools/regression/lib/libc/gen/Makefile Thu Aug 9 22:05:40 2012 (r239160) @@ -1,7 +1,7 @@ # $FreeBSD$ TESTS= test-arc4random test-fmtcheck test-fmtmsg test-fnmatch \ - test-fpclassify test-posix_spawn test-wordexp + test-fpclassify test-ftw test-posix_spawn test-wordexp .PHONY: tests tests: ${TESTS} Added: head/tools/regression/lib/libc/gen/test-ftw.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/lib/libc/gen/test-ftw.c Thu Aug 9 22:05:40 2012 (r239160) @@ -0,0 +1,141 @@ +/*- + * Copyright (c) 2012 Jilles Tjoelker + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Limited test program for nftw() as specified by IEEE Std. 1003.1-2008. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +extern char **environ; + +static char dir[] = "/tmp/testftw.XXXXXXXXXX"; +static int failures; +static int ftwflags; + +static void +cleanup(int ustatus __unused) +{ + int error, status; + pid_t pid, waitres; + const char *myargs[5]; + + err_set_exit(NULL); + myargs[0] = "rm"; + myargs[1] = "-rf"; + myargs[2] = "--"; + myargs[3] = dir; + myargs[4] = NULL; + error = posix_spawnp(&pid, myargs[0], NULL, NULL, + __DECONST(char **, myargs), environ); + if (error != 0) + warn("posix_spawnp rm"); + else { + waitres = waitpid(pid, &status, 0); + if (waitres != pid) + warnx("waitpid rm failed"); + else if (status != 0) + warnx("rm failed"); + } +} + +static int +cb(const char *path, const struct stat *st, int type, struct FTW *f) +{ + + switch (type) { + case FTW_D: + if ((ftwflags & FTW_DEPTH) == 0) + return (0); + break; + case FTW_DP: + if ((ftwflags & FTW_DEPTH) != 0) + return (0); + break; + case FTW_SL: + if ((ftwflags & FTW_PHYS) != 0) + return (0); + break; + } + warnx("unexpected path=%s type=%d f.level=%d\n", + path, type, f->level); + failures++; + return (0); +} + +int +main(int argc, char *argv[]) +{ + int fd; + + if (!mkdtemp(dir)) + err(2, "mkdtemp"); + + err_set_exit(cleanup); + + fd = open(dir, O_DIRECTORY | O_RDONLY); + if (fd == -1) + err(2, "open %s", dir); + + if (mkdirat(fd, "d1", 0777) == -1) + err(2, "mkdirat d1"); + + if (symlinkat(dir, fd, "d1/looper") == -1) + err(2, "symlinkat looper"); + + ftwflags = FTW_PHYS; + if (nftw(dir, cb, 10, ftwflags) == -1) + err(2, "nftw FTW_PHYS"); + ftwflags = FTW_PHYS | FTW_DEPTH; + if (nftw(dir, cb, 10, ftwflags) == -1) + err(2, "nftw FTW_PHYS | FTW_DEPTH"); + ftwflags = 0; + if (nftw(dir, cb, 10, ftwflags) == -1) + err(2, "nftw 0"); + ftwflags = FTW_DEPTH; + if (nftw(dir, cb, 10, ftwflags) == -1) + err(2, "nftw FTW_DEPTH"); + + close(fd); + + printf("PASS nftw()\n"); + + cleanup(failures != 0); + + return (failures != 0); +} From owner-svn-src-head@FreeBSD.ORG Thu Aug 9 23:04:21 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60178106566B; Thu, 9 Aug 2012 23:04:21 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4AA728FC08; Thu, 9 Aug 2012 23:04: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 q79N4Lek063896; Thu, 9 Aug 2012 23:04:21 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q79N4Lrg063892; Thu, 9 Aug 2012 23:04:21 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201208092304.q79N4Lrg063892@svn.freebsd.org> From: Adrian Chadd Date: Thu, 9 Aug 2012 23:04:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239161 - in head/tools/tools/ath: ath_prom_read athaggrstats athstats X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Aug 2012 23:04:21 -0000 Author: adrian Date: Thu Aug 9 23:04:20 2012 New Revision: 239161 URL: http://svn.freebsd.org/changeset/base/239161 Log: Add HAL_DMA_ADDR. Modified: head/tools/tools/ath/ath_prom_read/Makefile head/tools/tools/ath/athaggrstats/Makefile head/tools/tools/ath/athstats/Makefile Modified: head/tools/tools/ath/ath_prom_read/Makefile ============================================================================== --- head/tools/tools/ath/ath_prom_read/Makefile Thu Aug 9 22:05:40 2012 (r239160) +++ head/tools/tools/ath/ath_prom_read/Makefile Thu Aug 9 23:04:20 2012 (r239161) @@ -20,3 +20,4 @@ ah_osdep.h: echo 'typedef void *HAL_SOFTC;' >ah_osdep.h echo 'typedef int HAL_BUS_TAG;' >>ah_osdep.h echo 'typedef void *HAL_BUS_HANDLE;' >>ah_osdep.h + echo 'typedef uint32_t HAL_DMA_ADDR;' >>ah_osdep.h Modified: head/tools/tools/ath/athaggrstats/Makefile ============================================================================== --- head/tools/tools/ath/athaggrstats/Makefile Thu Aug 9 22:05:40 2012 (r239160) +++ head/tools/tools/ath/athaggrstats/Makefile Thu Aug 9 23:04:20 2012 (r239161) @@ -22,5 +22,6 @@ ah_osdep.h: echo 'typedef void *HAL_SOFTC;' >ah_osdep.h echo 'typedef int HAL_BUS_TAG;' >>ah_osdep.h echo 'typedef void *HAL_BUS_HANDLE;' >>ah_osdep.h + echo 'typedef uint32_t HAL_DMA_ADDR;' >>ah_osdep.h .include Modified: head/tools/tools/ath/athstats/Makefile ============================================================================== --- head/tools/tools/ath/athstats/Makefile Thu Aug 9 22:05:40 2012 (r239160) +++ head/tools/tools/ath/athstats/Makefile Thu Aug 9 23:04:20 2012 (r239161) @@ -22,5 +22,6 @@ ah_osdep.h: echo 'typedef void *HAL_SOFTC;' >ah_osdep.h echo 'typedef int HAL_BUS_TAG;' >>ah_osdep.h echo 'typedef void *HAL_BUS_HANDLE;' >>ah_osdep.h + echo 'typedef uint32_t HAL_DMA_ADDR;' >>ah_osdep.h .include From owner-svn-src-head@FreeBSD.ORG Thu Aug 9 23:08:23 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5433F106564A; Thu, 9 Aug 2012 23:08:23 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1982D8FC08; Thu, 9 Aug 2012 23:08:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q79N8MXp064309; Thu, 9 Aug 2012 23:08:22 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q79N8MLT064307; Thu, 9 Aug 2012 23:08:22 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201208092308.q79N8MLT064307@svn.freebsd.org> From: Adrian Chadd Date: Thu, 9 Aug 2012 23:08:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239162 - head/tools/tools/ath/common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Aug 2012 23:08:23 -0000 Author: adrian Date: Thu Aug 9 23:08:22 2012 New Revision: 239162 URL: http://svn.freebsd.org/changeset/base/239162 Log: Add a missing HAL_DMA_ADDR definition. Modified: head/tools/tools/ath/common/ah_osdep.h Modified: head/tools/tools/ath/common/ah_osdep.h ============================================================================== --- head/tools/tools/ath/common/ah_osdep.h Thu Aug 9 23:04:20 2012 (r239161) +++ head/tools/tools/ath/common/ah_osdep.h Thu Aug 9 23:08:22 2012 (r239162) @@ -41,6 +41,7 @@ typedef void *HAL_SOFTC; typedef int HAL_BUS_TAG; typedef void *HAL_BUS_HANDLE; +typedef uint32_t HAL_DMA_ADDR; #define OS_DELAY(_n) DELAY(_n) #define OS_INLINE __inline From owner-svn-src-head@FreeBSD.ORG Fri Aug 10 04:47:21 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 295111065674; Fri, 10 Aug 2012 04:47:21 +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 14C838FC17; Fri, 10 Aug 2012 04:47: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 q7A4lKAX092991; Fri, 10 Aug 2012 04:47:20 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7A4lKNo092989; Fri, 10 Aug 2012 04:47:20 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201208100447.q7A4lKNo092989@svn.freebsd.org> From: Warner Losh Date: Fri, 10 Aug 2012 04:47:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239167 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Aug 2012 04:47:21 -0000 Author: imp Date: Fri Aug 10 04:47:20 2012 New Revision: 239167 URL: http://svn.freebsd.org/changeset/base/239167 Log: Add charge pump current register. Modified: head/sys/arm/at91/at91_pmcreg.h Modified: head/sys/arm/at91/at91_pmcreg.h ============================================================================== --- head/sys/arm/at91/at91_pmcreg.h Fri Aug 10 03:01:39 2012 (r239166) +++ head/sys/arm/at91/at91_pmcreg.h Fri Aug 10 04:47:20 2012 (r239167) @@ -57,6 +57,11 @@ #define PMC_IDR 0x64 /* Interrupt Disable Register */ #define PMC_SR 0x68 /* Status Register */ #define PMC_IMR 0x6c /* Interrupt Mask Register */ + /* 0x70 reserved */ + /* 0x74 reserved */ + /* 0x78 reserved */ + /* 0x7c reserved */ +#define PMC_PLLICPR 0x80 /* PLL Charge Pump Current Register */ /* PMC System Clock Enable Register */ /* PMC System Clock Disable Register */ From owner-svn-src-head@FreeBSD.ORG Fri Aug 10 04:48:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6DCAA106568A; Fri, 10 Aug 2012 04:48:07 +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 555508FC1B; Fri, 10 Aug 2012 04:48: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 q7A4m7XV093087; Fri, 10 Aug 2012 04:48:07 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7A4m7gu093085; Fri, 10 Aug 2012 04:48:07 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201208100448.q7A4m7gu093085@svn.freebsd.org> From: Warner Losh Date: Fri, 10 Aug 2012 04:48:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239168 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Aug 2012 04:48:07 -0000 Author: imp Date: Fri Aug 10 04:48:06 2012 New Revision: 239168 URL: http://svn.freebsd.org/changeset/base/239168 Log: More comments about setting PLLA, or rather that we never do. Modified: head/sys/arm/at91/at91_pmc.c Modified: head/sys/arm/at91/at91_pmc.c ============================================================================== --- head/sys/arm/at91/at91_pmc.c Fri Aug 10 04:47:20 2012 (r239167) +++ head/sys/arm/at91/at91_pmc.c Fri Aug 10 04:48:06 2012 (r239168) @@ -500,6 +500,7 @@ at91_pmc_init_clock(void) uhpck.pmc_mask = PMC_SCER_UHP_SAM9; udpck.pmc_mask = PMC_SCER_UDP_SAM9; } + /* There is no pllb on AT91SAM9G45 */ if (at91_cpu_is(AT91_T_SAM9G45)) { uhpck.parent = &upll; @@ -509,6 +510,9 @@ at91_pmc_init_clock(void) mckr = RD4(sc, PMC_MCKR); main_ck.hz = main_clock; + // Note: this means outa calc code for plla never used since + // we never change it. If we did, we'd also have to mind + // ICPLLA to get the charge pump current right. at91_pmc_pll_rate(&plla, RD4(sc, CKGR_PLLAR)); if (at91_cpu_is(AT91_T_SAM9G45) && (mckr & PMC_MCKR_PLLADIV2)) @@ -516,16 +520,17 @@ at91_pmc_init_clock(void) /* * Initialize the usb clock. This sets up pllb, but disables the - * actual clock. + * actual clock. XXX except for the if 0 :( */ - pllb_init = at91_pmc_pll_calc(&pllb, 48000000 * 2) | 0x10000000; - at91_pmc_pll_rate(&pllb, pllb_init); - + if (!at91_cpu_is(AT91_T_SAM9G45)) { + pllb_init = at91_pmc_pll_calc(&pllb, 48000000 * 2) | 0x10000000; + at91_pmc_pll_rate(&pllb, pllb_init); #if 0 - /* Turn off USB clocks */ - at91_pmc_set_periph_mode(&ohci_clk, 0); - at91_pmc_set_periph_mode(&udc_clk, 0); + /* Turn off USB clocks */ + at91_pmc_set_periph_mode(&ohci_clk, 0); + at91_pmc_set_periph_mode(&udc_clk, 0); #endif + } if (at91_is_rm92()) { WR4(sc, PMC_SCDR, PMC_SCER_UHP | PMC_SCER_UDP); From owner-svn-src-head@FreeBSD.ORG Fri Aug 10 04:48:59 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB575106566B; Fri, 10 Aug 2012 04:48:58 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BCF6D8FC0C; Fri, 10 Aug 2012 04:48:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7A4mwVG093187; Fri, 10 Aug 2012 04:48:58 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7A4mwwc093184; Fri, 10 Aug 2012 04:48:58 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201208100448.q7A4mwwc093184@svn.freebsd.org> From: Xin LI Date: Fri, 10 Aug 2012 04:48:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239169 - head/contrib/opie/libopie X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Aug 2012 04:48:59 -0000 Author: delphij Date: Fri Aug 10 04:48:58 2012 New Revision: 239169 URL: http://svn.freebsd.org/changeset/base/239169 Log: RFC 2289 requires all hashes be stored in little endian format before folding to 64 bits, while SHA1 code is big endian. Therefore, a bswap32 is required before using the value. Without this change, the implementation does not conform to test vector found in RFC 2289. PR: bin/170519 Submitted by: Arthur Mesh (with changes) MFC after: 1 week Modified: head/contrib/opie/libopie/hash.c head/contrib/opie/libopie/hashlen.c Modified: head/contrib/opie/libopie/hash.c ============================================================================== --- head/contrib/opie/libopie/hash.c Fri Aug 10 04:48:06 2012 (r239168) +++ head/contrib/opie/libopie/hash.c Fri Aug 10 04:48:58 2012 (r239169) @@ -17,6 +17,8 @@ you didn't get a copy, you may request o $FreeBSD$ */ +#include + #include "opie_cfg.h" #include "opie.h" @@ -39,6 +41,13 @@ unsigned algorithm) SHA1_Final((unsigned char *)digest, &sha); results[0] = digest[0] ^ digest[2] ^ digest[4]; results[1] = digest[1] ^ digest[3]; + + /* + * RFC2289 mandates that we convert SHA1 digest from big-endian to little + * see Appendix A. + */ + results[0] = bswap32(results[0]); + results[1] = bswap32(results[1]); }; break; case 4: Modified: head/contrib/opie/libopie/hashlen.c ============================================================================== --- head/contrib/opie/libopie/hashlen.c Fri Aug 10 04:48:06 2012 (r239168) +++ head/contrib/opie/libopie/hashlen.c Fri Aug 10 04:48:58 2012 (r239169) @@ -14,6 +14,8 @@ you didn't get a copy, you may request o $FreeBSD$ */ +#include + #include "opie_cfg.h" #include "opie.h" @@ -36,6 +38,13 @@ VOIDPTR in AND struct opie_otpkey *out A SHA1_Final((unsigned char *)digest, &sha); results[0] = digest[0] ^ digest[2] ^ digest[4]; results[1] = digest[1] ^ digest[3]; + + /* + * RFC2289 mandates that we convert SHA1 digest from big-endian to little + * see Appendix A. + */ + results[0] = bswap32(results[0]); + results[1] = bswap32(results[1]); break; } case 4: { From owner-svn-src-head@FreeBSD.ORG Fri Aug 10 05:00:51 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8DDDA106564A; Fri, 10 Aug 2012 05:00:51 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7944E8FC08; Fri, 10 Aug 2012 05:00:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7A50pvw094262; Fri, 10 Aug 2012 05:00:51 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7A50pQq094260; Fri, 10 Aug 2012 05:00:51 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201208100500.q7A50pQq094260@svn.freebsd.org> From: Alan Cox Date: Fri, 10 Aug 2012 05:00:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239170 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Aug 2012 05:00:51 -0000 Author: alc Date: Fri Aug 10 05:00:50 2012 New Revision: 239170 URL: http://svn.freebsd.org/changeset/base/239170 Log: Merge r134393 from amd64/i386: The machine-independent parts of the virtual memory system always pass a valid pmap to the pmap functions that require one. Remove the checks for NULL. (These checks have their origins in the Mach pmap.c that was integrated into BSD. None of the new code written specifically for FreeBSD included them.) Modified: head/sys/mips/mips/pmap.c Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Fri Aug 10 04:48:58 2012 (r239169) +++ head/sys/mips/mips/pmap.c Fri Aug 10 05:00:50 2012 (r239170) @@ -1588,9 +1588,6 @@ pmap_remove(struct pmap *pmap, vm_offset pd_entry_t *pde, *pdpe; pt_entry_t *pte; - if (pmap == NULL) - return; - if (pmap->pm_stats.resident_count == 0) return; @@ -1721,9 +1718,6 @@ pmap_protect(pmap_t pmap, vm_offset_t sv pd_entry_t *pde, *pdpe; vm_offset_t va_next; - if (pmap == NULL) - return; - if ((prot & VM_PROT_READ) == VM_PROT_NONE) { pmap_remove(pmap, sva, eva); return; @@ -1806,9 +1800,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t mpte, om; pt_entry_t rw = 0; - if (pmap == NULL) - return; - va &= ~PAGE_MASK; KASSERT(va <= VM_MAX_KERNEL_ADDRESS, ("pmap_enter: toobig")); KASSERT((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) != 0, @@ -2251,9 +2242,6 @@ pmap_change_wiring(pmap_t pmap, vm_offse { pt_entry_t *pte; - if (pmap == NULL) - return; - PMAP_LOCK(pmap); pte = pmap_pte(pmap, va); From owner-svn-src-head@FreeBSD.ORG Fri Aug 10 05:47:05 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F5AA106566C; Fri, 10 Aug 2012 05:47:05 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4AE9B8FC0C; Fri, 10 Aug 2012 05:47:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7A5l5dr097904; Fri, 10 Aug 2012 05:47:05 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7A5l5dG097902; Fri, 10 Aug 2012 05:47:05 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201208100547.q7A5l5dG097902@svn.freebsd.org> From: Alan Cox Date: Fri, 10 Aug 2012 05:47:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239171 - head/sys/i386/xen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Aug 2012 05:47:05 -0000 Author: alc Date: Fri Aug 10 05:47:04 2012 New Revision: 239171 URL: http://svn.freebsd.org/changeset/base/239171 Log: Eliminate an unnecessary acquisition and release of the page queues lock from pmap_pte(). PT_SET_MA() is not a queued mapping update, but instead an immediate mapping update, so the page queues lock is not required here. Reviewed by: cperciva Modified: head/sys/i386/xen/pmap.c Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Fri Aug 10 05:00:50 2012 (r239170) +++ head/sys/i386/xen/pmap.c Fri Aug 10 05:47:04 2012 (r239171) @@ -965,9 +965,7 @@ pmap_pte(pmap_t pmap, vm_offset_t va) mtx_lock(&PMAP2mutex); newpf = *pde & PG_FRAME; if ((*PMAP2 & PG_FRAME) != newpf) { - vm_page_lock_queues(); PT_SET_MA(PADDR2, newpf | PG_V | PG_A | PG_M); - vm_page_unlock_queues(); CTR3(KTR_PMAP, "pmap_pte: pmap=%p va=0x%x newpte=0x%08x", pmap, va, (*PMAP2 & 0xffffffff)); } From owner-svn-src-head@FreeBSD.ORG Fri Aug 10 13:36:33 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E504D106566B; Fri, 10 Aug 2012 13:36:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D01648FC15; Fri, 10 Aug 2012 13:36: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 q7ADaXPA039090; Fri, 10 Aug 2012 13:36:33 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7ADaXRT039088; Fri, 10 Aug 2012 13:36:33 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201208101336.q7ADaXRT039088@svn.freebsd.org> From: Alexander Motin Date: Fri, 10 Aug 2012 13:36:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239175 - head/sys/geom/raid X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Aug 2012 13:36:34 -0000 Author: mav Date: Fri Aug 10 13:36:33 2012 New Revision: 239175 URL: http://svn.freebsd.org/changeset/base/239175 Log: Add missing FAILED event to g_raid_subdisk_event2str() to print it properly in debug messages. Submitted by: Dmitry Luhtionov Modified: head/sys/geom/raid/g_raid.c Modified: head/sys/geom/raid/g_raid.c ============================================================================== --- head/sys/geom/raid/g_raid.c Fri Aug 10 11:11:04 2012 (r239174) +++ head/sys/geom/raid/g_raid.c Fri Aug 10 13:36:33 2012 (r239175) @@ -218,6 +218,8 @@ g_raid_subdisk_event2str(int event) switch (event) { case G_RAID_SUBDISK_E_NEW: return ("NEW"); + case G_RAID_SUBDISK_E_FAILED: + return ("FAILED"); case G_RAID_SUBDISK_E_DISCONNECTED: return ("DISCONNECTED"); default: From owner-svn-src-head@FreeBSD.ORG Fri Aug 10 14:44:04 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BA4781065673; Fri, 10 Aug 2012 14:44:04 +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 A55A78FC18; Fri, 10 Aug 2012 14:44: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 q7AEi4Nv044700; Fri, 10 Aug 2012 14:44:04 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7AEi4Ej044698; Fri, 10 Aug 2012 14:44:04 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201208101444.q7AEi4Ej044698@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 10 Aug 2012 14:44:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239176 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Aug 2012 14:44:04 -0000 Author: hselasky Date: Fri Aug 10 14:44:04 2012 New Revision: 239176 URL: http://svn.freebsd.org/changeset/base/239176 Log: Fix spelling. MFC after: 2 weeks Modified: head/sys/dev/usb/usb_device.h Modified: head/sys/dev/usb/usb_device.h ============================================================================== --- head/sys/dev/usb/usb_device.h Fri Aug 10 13:36:33 2012 (r239175) +++ head/sys/dev/usb/usb_device.h Fri Aug 10 14:44:04 2012 (r239176) @@ -33,7 +33,7 @@ struct usb_fs_privdata; #define USB_CTRL_XFER_MAX 2 -/* "usb_parse_config()" commands */ +/* "usb_config_parse()" commands */ #define USB_CFG_ALLOC 0 #define USB_CFG_FREE 1 From owner-svn-src-head@FreeBSD.ORG Fri Aug 10 14:51:42 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2A7D1106566B; Fri, 10 Aug 2012 14:51:42 +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 14F068FC14; Fri, 10 Aug 2012 14:51:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7AEpf3n045337; Fri, 10 Aug 2012 14:51:41 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7AEpfhv045334; Fri, 10 Aug 2012 14:51:41 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201208101451.q7AEpfhv045334@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 10 Aug 2012 14:51:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239177 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Aug 2012 14:51:42 -0000 Author: hselasky Date: Fri Aug 10 14:51:41 2012 New Revision: 239177 URL: http://svn.freebsd.org/changeset/base/239177 Log: Style. MFC after: 2 weeks Modified: head/sys/dev/usb/usb_device.c Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Fri Aug 10 14:44:04 2012 (r239176) +++ head/sys/dev/usb/usb_device.c Fri Aug 10 14:51:41 2012 (r239177) @@ -202,7 +202,7 @@ usbd_get_ep_by_addr(struct usb_device *u /* * The default endpoint is always present and is checked separately: */ - if ((udev->ctrl_ep.edesc) && + if ((udev->ctrl_ep.edesc != NULL) && ((udev->ctrl_ep.edesc->bEndpointAddress & EA_MASK) == ea_val)) { ep = &udev->ctrl_ep; goto found; @@ -320,7 +320,7 @@ usbd_get_endpoint(struct usb_device *ude * address" and "any direction" returns the first endpoint of the * interface. "iface_index" and "direction" is ignored: */ - if ((udev->ctrl_ep.edesc) && + if ((udev->ctrl_ep.edesc != NULL) && ((udev->ctrl_ep.edesc->bEndpointAddress & ea_mask) == ea_val) && ((udev->ctrl_ep.edesc->bmAttributes & type_mask) == type_val) && (!index)) { From owner-svn-src-head@FreeBSD.ORG Fri Aug 10 15:02:50 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 90648106566B; Fri, 10 Aug 2012 15:02:50 +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 721F78FC12; Fri, 10 Aug 2012 15:02: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 q7AF2o0F046320; Fri, 10 Aug 2012 15:02:50 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7AF2ofC046316; Fri, 10 Aug 2012 15:02:50 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201208101502.q7AF2ofC046316@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 10 Aug 2012 15:02:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239178 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Aug 2012 15:02:50 -0000 Author: hselasky Date: Fri Aug 10 15:02:49 2012 New Revision: 239178 URL: http://svn.freebsd.org/changeset/base/239178 Log: Add new device method to free the automatically allocated softc structure which is returned by device_get_softc(). This method can be used to easily implement softc refcounting. This can be desirable when the softc has memory references which are controlled by userspace handles for example. This solves the problem of blocking the caller of device_detach() for a non-deterministic time. Discussed with: kib, ed MFC after: 2 weeks Modified: head/sys/kern/device_if.m head/sys/kern/subr_bus.c head/sys/sys/bus.h Modified: head/sys/kern/device_if.m ============================================================================== --- head/sys/kern/device_if.m Fri Aug 10 14:51:41 2012 (r239177) +++ head/sys/kern/device_if.m Fri Aug 10 15:02:49 2012 (r239178) @@ -316,3 +316,14 @@ METHOD int resume { METHOD int quiesce { device_t dev; } DEFAULT null_quiesce; + +/** + * @brief Free the device softc + * + * @param _dev device pointer + * @param _softc pointer to softc + */ +METHOD void free_softc { + device_t _dev; + void *_softc; +} DEFAULT device_free_softc; Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Fri Aug 10 14:51:41 2012 (r239177) +++ head/sys/kern/subr_bus.c Fri Aug 10 15:02:49 2012 (r239178) @@ -2406,8 +2406,8 @@ device_get_softc(device_t dev) void device_set_softc(device_t dev, void *softc) { - if (dev->softc && !(dev->flags & DF_EXTERNALSOFTC)) - free(dev->softc, M_BUS_SC); + if (dev->softc != NULL && !(dev->flags & DF_EXTERNALSOFTC)) + DEVICE_FREE_SOFTC(dev, dev->softc); dev->softc = softc; if (dev->softc) dev->flags |= DF_EXTERNALSOFTC; @@ -2604,8 +2604,8 @@ device_set_driver(device_t dev, driver_t if (dev->driver == driver) return (0); - if (dev->softc && !(dev->flags & DF_EXTERNALSOFTC)) { - free(dev->softc, M_BUS_SC); + if (dev->softc != NULL && !(dev->flags & DF_EXTERNALSOFTC)) { + DEVICE_FREE_SOFTC(dev, dev->softc); dev->softc = NULL; } device_set_desc(dev, NULL); @@ -4797,3 +4797,13 @@ bus_free_resource(device_t dev, int type return (0); return (bus_release_resource(dev, type, rman_get_rid(r), r)); } + +/* + * The "dev" argument passed to "device_free_softc()" is allowed to be + * NULL, if the device freeing the soft is not available. + */ +void +device_free_softc(device_t dev, void *softc) +{ + free(softc, M_BUS_SC); +} Modified: head/sys/sys/bus.h ============================================================================== --- head/sys/sys/bus.h Fri Aug 10 14:51:41 2012 (r239177) +++ head/sys/sys/bus.h Fri Aug 10 15:02:49 2012 (r239178) @@ -468,6 +468,7 @@ int device_set_unit(device_t dev, int un int device_shutdown(device_t dev); void device_unbusy(device_t dev); void device_verbose(device_t dev); +void device_free_softc(device_t dev, void *softc); /* * Access functions for devclass. From owner-svn-src-head@FreeBSD.ORG Fri Aug 10 15:21:13 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6AE1F106564A; Fri, 10 Aug 2012 15:21:13 +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 537E78FC0C; Fri, 10 Aug 2012 15:21: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 q7AFLDtD047839; Fri, 10 Aug 2012 15:21:13 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7AFLD3M047835; Fri, 10 Aug 2012 15:21:13 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201208101521.q7AFLD3M047835@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 10 Aug 2012 15:21:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239179 - in head/sys: dev/usb/serial sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Aug 2012 15:21:13 -0000 Author: hselasky Date: Fri Aug 10 15:21:12 2012 New Revision: 239179 URL: http://svn.freebsd.org/changeset/base/239179 Log: Switch unit management in UCOM to unrhdr. Extend the callback table of UCOM to include a "ucom_free" function pointer which is called when all refs on a UCOM super structure is gone. Implement various helper functions to handle refcounting and draining on the UCOM super structure. Implement macro which can be used in device drivers to avoid module unload before all pending TTY references are gone. The UCOM API is backwards compatible after this change and device drivers require no changes to function with this change. Only a recompilation of UCOM device drivers is required. The FreeBSD version has been bumped in that regard. Discussed with: kib, ed MFC after: 2 weeks Modified: head/sys/dev/usb/serial/usb_serial.c head/sys/dev/usb/serial/usb_serial.h head/sys/sys/param.h Modified: head/sys/dev/usb/serial/usb_serial.c ============================================================================== --- head/sys/dev/usb/serial/usb_serial.c Fri Aug 10 15:02:49 2012 (r239178) +++ head/sys/dev/usb/serial/usb_serial.c Fri Aug 10 15:21:12 2012 (r239179) @@ -146,7 +146,7 @@ static usb_proc_callback_t ucom_cfg_para static int ucom_unit_alloc(void); static void ucom_unit_free(int); static int ucom_attach_tty(struct ucom_super_softc *, struct ucom_softc *); -static void ucom_detach_tty(struct ucom_softc *); +static void ucom_detach_tty(struct ucom_super_softc *, struct ucom_softc *); static void ucom_queue_command(struct ucom_softc *, usb_proc_callback_t *, struct termios *pt, struct usb_proc_msg *t0, struct usb_proc_msg *t1); @@ -178,13 +178,37 @@ static struct ttydevsw ucom_class = { MODULE_DEPEND(ucom, usb, 1, 1, 1); MODULE_VERSION(ucom, 1); -#define UCOM_UNIT_MAX 128 /* limits size of ucom_bitmap */ +#define UCOM_UNIT_MAX 128 /* maximum number of units */ +#define UCOM_TTY_PREFIX "U" -static uint8_t ucom_bitmap[(UCOM_UNIT_MAX + 7) / 8]; -static struct mtx ucom_bitmap_mtx; -MTX_SYSINIT(ucom_bitmap_mtx, &ucom_bitmap_mtx, "ucom bitmap", MTX_DEF); +static struct unrhdr *ucom_unrhdr; +static struct mtx ucom_mtx; +static int ucom_close_refs; -#define UCOM_TTY_PREFIX "U" +static void +ucom_init(void *arg) +{ + DPRINTF("\n"); + ucom_unrhdr = new_unrhdr(0, UCOM_UNIT_MAX - 1, NULL); + mtx_init(&ucom_mtx, "UCOM MTX", NULL, MTX_DEF); +} +SYSINIT(ucom_init, SI_SUB_KLD - 1, SI_ORDER_ANY, ucom_init, NULL); + +static void +ucom_uninit(void *arg) +{ + struct unrhdr *hdr; + hdr = ucom_unrhdr; + ucom_unrhdr = NULL; + + DPRINTF("\n"); + + if (hdr != NULL) + delete_unrhdr(hdr); + + mtx_destroy(&ucom_mtx); +} +SYSUNINIT(ucom_uninit, SI_SUB_KLD - 2, SI_ORDER_ANY, ucom_uninit, NULL); /* * Mark a unit number (the X in cuaUX) as in use. @@ -197,21 +221,14 @@ ucom_unit_alloc(void) { int unit; - mtx_lock(&ucom_bitmap_mtx); - - for (unit = 0; unit < UCOM_UNIT_MAX; unit++) { - if ((ucom_bitmap[unit / 8] & (1 << (unit % 8))) == 0) { - ucom_bitmap[unit / 8] |= (1 << (unit % 8)); - break; - } + /* sanity checks */ + if (ucom_unrhdr == NULL) { + DPRINTF("ucom_unrhdr is NULL\n"); + return (-1); } - - mtx_unlock(&ucom_bitmap_mtx); - - if (unit == UCOM_UNIT_MAX) - return -1; - else - return unit; + unit = alloc_unr(ucom_unrhdr); + DPRINTF("unit %d is allocated\n", unit); + return (unit); } /* @@ -220,11 +237,13 @@ ucom_unit_alloc(void) static void ucom_unit_free(int unit) { - mtx_lock(&ucom_bitmap_mtx); - - ucom_bitmap[unit / 8] &= ~(1 << (unit % 8)); - - mtx_unlock(&ucom_bitmap_mtx); + /* sanity checks */ + if (unit < 0 || unit >= UCOM_UNIT_MAX || ucom_unrhdr == NULL) { + DPRINTF("cannot free unit number\n"); + return; + } + DPRINTF("unit %d is freed\n", unit); + free_unr(ucom_unrhdr, unit); } /* @@ -244,7 +263,8 @@ ucom_attach(struct ucom_super_softc *ssc if ((sc == NULL) || (subunits <= 0) || - (callback == NULL)) { + (callback == NULL) || + (mtx == NULL)) { return (EINVAL); } @@ -265,6 +285,11 @@ ucom_attach(struct ucom_super_softc *ssc } ssc->sc_subunits = subunits; + if (callback->ucom_free == NULL) { + ssc->sc_wait_refs = 1; + ucom_ref(ssc); + } + for (subunit = 0; subunit < ssc->sc_subunits; subunit++) { sc[subunit].sc_subunit = subunit; sc[subunit].sc_super = ssc; @@ -277,6 +302,10 @@ ucom_attach(struct ucom_super_softc *ssc ucom_detach(ssc, &sc[0]); return (error); } + /* increment reference count */ + ucom_ref(ssc); + + /* set subunit attached */ sc[subunit].sc_flag |= UCOM_FLAG_ATTACHED; } @@ -313,14 +342,41 @@ ucom_detach(struct ucom_super_softc *ssc for (subunit = 0; subunit < ssc->sc_subunits; subunit++) { if (sc[subunit].sc_flag & UCOM_FLAG_ATTACHED) { - ucom_detach_tty(&sc[subunit]); + ucom_detach_tty(ssc, &sc[subunit]); /* avoid duplicate detach */ sc[subunit].sc_flag &= ~UCOM_FLAG_ATTACHED; } } - ucom_unit_free(ssc->sc_unit); usb_proc_free(&ssc->sc_tq); + + if (ssc->sc_wait_refs != 0) { + ucom_unref(ssc); + ucom_drain(ssc); + } +} + +void +ucom_drain(struct ucom_super_softc *ssc) +{ + mtx_lock(&ucom_mtx); + while (ssc->sc_refs >= 2) { + printf("ucom: Waiting for a TTY device to close.\n"); + usb_pause_mtx(&ucom_mtx, hz); + } + mtx_unlock(&ucom_mtx); +} + +void +ucom_drain_all(void *arg) +{ + mtx_lock(&ucom_mtx); + while (ucom_close_refs > 0) { + printf("ucom: Waiting for all detached TTY " + "devices to have open fds closed.\n"); + usb_pause_mtx(&ucom_mtx, hz); + } + mtx_unlock(&ucom_mtx); } static int @@ -356,7 +412,6 @@ ucom_attach_tty(struct ucom_super_softc sc->sc_tty = tp; DPRINTF("ttycreate: %s\n", buf); - cv_init(&sc->sc_cv, "ucom"); /* Check if this device should be a console */ if ((ucom_cons_softc == NULL) && @@ -373,7 +428,7 @@ ucom_attach_tty(struct ucom_super_softc t.c_ospeed = t.c_ispeed; t.c_cflag = CS8; - mtx_lock(ucom_cons_softc->sc_mtx); + UCOM_MTX_LOCK(ucom_cons_softc); ucom_cons_rx_low = 0; ucom_cons_rx_high = 0; ucom_cons_tx_low = 0; @@ -381,56 +436,55 @@ ucom_attach_tty(struct ucom_super_softc sc->sc_flag |= UCOM_FLAG_CONSOLE; ucom_open(ucom_cons_softc->sc_tty); ucom_param(ucom_cons_softc->sc_tty, &t); - mtx_unlock(ucom_cons_softc->sc_mtx); + UCOM_MTX_UNLOCK(ucom_cons_softc); } return (0); } static void -ucom_detach_tty(struct ucom_softc *sc) +ucom_detach_tty(struct ucom_super_softc *ssc, struct ucom_softc *sc) { struct tty *tp = sc->sc_tty; DPRINTF("sc = %p, tp = %p\n", sc, sc->sc_tty); if (sc->sc_flag & UCOM_FLAG_CONSOLE) { - mtx_lock(ucom_cons_softc->sc_mtx); + UCOM_MTX_LOCK(ucom_cons_softc); ucom_close(ucom_cons_softc->sc_tty); sc->sc_flag &= ~UCOM_FLAG_CONSOLE; - mtx_unlock(ucom_cons_softc->sc_mtx); + UCOM_MTX_UNLOCK(ucom_cons_softc); ucom_cons_softc = NULL; } /* the config thread has been stopped when we get here */ - mtx_lock(sc->sc_mtx); + UCOM_MTX_LOCK(sc); sc->sc_flag |= UCOM_FLAG_GONE; sc->sc_flag &= ~(UCOM_FLAG_HL_READY | UCOM_FLAG_LL_READY); - mtx_unlock(sc->sc_mtx); + UCOM_MTX_UNLOCK(sc); + if (tp) { + mtx_lock(&ucom_mtx); + ucom_close_refs++; + mtx_unlock(&ucom_mtx); + tty_lock(tp); ucom_close(tp); /* close, if any */ tty_rel_gone(tp); - mtx_lock(sc->sc_mtx); - /* Wait for the callback after the TTY is torn down */ - while (sc->sc_ttyfreed == 0) - cv_wait(&sc->sc_cv, sc->sc_mtx); + UCOM_MTX_LOCK(sc); /* * make sure that read and write transfers are stopped */ - if (sc->sc_callback->ucom_stop_read) { + if (sc->sc_callback->ucom_stop_read) (sc->sc_callback->ucom_stop_read) (sc); - } - if (sc->sc_callback->ucom_stop_write) { + if (sc->sc_callback->ucom_stop_write) (sc->sc_callback->ucom_stop_write) (sc); - } - mtx_unlock(sc->sc_mtx); + UCOM_MTX_UNLOCK(sc); } - cv_destroy(&sc->sc_cv); } void @@ -476,7 +530,7 @@ ucom_queue_command(struct ucom_softc *sc struct ucom_super_softc *ssc = sc->sc_super; struct ucom_param_task *task; - mtx_assert(sc->sc_mtx, MA_OWNED); + UCOM_MTX_ASSERT(sc, MA_OWNED); if (usb_proc_is_gone(&ssc->sc_tq)) { DPRINTF("proc is gone\n"); @@ -520,7 +574,7 @@ ucom_shutdown(struct ucom_softc *sc) { struct tty *tp = sc->sc_tty; - mtx_assert(sc->sc_mtx, MA_OWNED); + UCOM_MTX_ASSERT(sc, MA_OWNED); DPRINTF("\n"); @@ -621,7 +675,7 @@ ucom_open(struct tty *tp) struct ucom_softc *sc = tty_softc(tp); int error; - mtx_assert(sc->sc_mtx, MA_OWNED); + UCOM_MTX_ASSERT(sc, MA_OWNED); if (sc->sc_flag & UCOM_FLAG_GONE) { return (ENXIO); @@ -699,7 +753,7 @@ ucom_close(struct tty *tp) { struct ucom_softc *sc = tty_softc(tp); - mtx_assert(sc->sc_mtx, MA_OWNED); + UCOM_MTX_ASSERT(sc, MA_OWNED); DPRINTF("tp=%p\n", tp); @@ -726,7 +780,7 @@ ucom_ioctl(struct tty *tp, u_long cmd, c struct ucom_softc *sc = tty_softc(tp); int error; - mtx_assert(sc->sc_mtx, MA_OWNED); + UCOM_MTX_ASSERT(sc, MA_OWNED); if (!(sc->sc_flag & UCOM_FLAG_HL_READY)) { return (EIO); @@ -770,7 +824,7 @@ ucom_modem(struct tty *tp, int sigon, in struct ucom_softc *sc = tty_softc(tp); uint8_t onoff; - mtx_assert(sc->sc_mtx, MA_OWNED); + UCOM_MTX_ASSERT(sc, MA_OWNED); if (!(sc->sc_flag & UCOM_FLAG_HL_READY)) { return (0); @@ -889,7 +943,7 @@ static void ucom_line_state(struct ucom_softc *sc, uint8_t set_bits, uint8_t clear_bits) { - mtx_assert(sc->sc_mtx, MA_OWNED); + UCOM_MTX_ASSERT(sc, MA_OWNED); if (!(sc->sc_flag & UCOM_FLAG_HL_READY)) { return; @@ -967,7 +1021,7 @@ ucom_cfg_status_change(struct usb_proc_m tp = sc->sc_tty; - mtx_assert(sc->sc_mtx, MA_OWNED); + UCOM_MTX_ASSERT(sc, MA_OWNED); if (!(sc->sc_flag & UCOM_FLAG_LL_READY)) { return; @@ -1029,7 +1083,7 @@ ucom_cfg_status_change(struct usb_proc_m void ucom_status_change(struct ucom_softc *sc) { - mtx_assert(sc->sc_mtx, MA_OWNED); + UCOM_MTX_ASSERT(sc, MA_OWNED); if (sc->sc_flag & UCOM_FLAG_CONSOLE) return; /* not supported */ @@ -1071,7 +1125,7 @@ ucom_param(struct tty *tp, struct termio uint8_t opened; int error; - mtx_assert(sc->sc_mtx, MA_OWNED); + UCOM_MTX_ASSERT(sc, MA_OWNED); opened = 0; error = 0; @@ -1138,7 +1192,7 @@ ucom_outwakeup(struct tty *tp) { struct ucom_softc *sc = tty_softc(tp); - mtx_assert(sc->sc_mtx, MA_OWNED); + UCOM_MTX_ASSERT(sc, MA_OWNED); DPRINTF("sc = %p\n", sc); @@ -1165,7 +1219,7 @@ ucom_get_data(struct ucom_softc *sc, str uint32_t cnt; uint32_t offset_orig; - mtx_assert(sc->sc_mtx, MA_OWNED); + UCOM_MTX_ASSERT(sc, MA_OWNED); if (sc->sc_flag & UCOM_FLAG_CONSOLE) { unsigned int temp; @@ -1244,7 +1298,7 @@ ucom_put_data(struct ucom_softc *sc, str char *buf; uint32_t cnt; - mtx_assert(sc->sc_mtx, MA_OWNED); + UCOM_MTX_ASSERT(sc, MA_OWNED); if (sc->sc_flag & UCOM_FLAG_CONSOLE) { unsigned int temp; @@ -1325,10 +1379,14 @@ ucom_free(void *xsc) { struct ucom_softc *sc = xsc; - mtx_lock(sc->sc_mtx); - sc->sc_ttyfreed = 1; - cv_signal(&sc->sc_cv); - mtx_unlock(sc->sc_mtx); + if (sc->sc_callback->ucom_free != NULL) + sc->sc_callback->ucom_free(sc); + else + ucom_unref(sc->sc_super); + + mtx_lock(&ucom_mtx); + ucom_close_refs--; + mtx_unlock(&ucom_mtx); } static cn_probe_t ucom_cnprobe; @@ -1381,7 +1439,7 @@ ucom_cngetc(struct consdev *cd) if (sc == NULL) return (-1); - mtx_lock(sc->sc_mtx); + UCOM_MTX_LOCK(sc); if (ucom_cons_rx_low != ucom_cons_rx_high) { c = ucom_cons_rx_buf[ucom_cons_rx_low]; @@ -1394,7 +1452,7 @@ ucom_cngetc(struct consdev *cd) /* start USB transfers */ ucom_outwakeup(sc->sc_tty); - mtx_unlock(sc->sc_mtx); + UCOM_MTX_UNLOCK(sc); /* poll if necessary */ if (kdb_active && sc->sc_callback->ucom_poll) @@ -1414,7 +1472,7 @@ ucom_cnputc(struct consdev *cd, int c) repeat: - mtx_lock(sc->sc_mtx); + UCOM_MTX_LOCK(sc); /* compute maximum TX length */ @@ -1430,7 +1488,7 @@ ucom_cnputc(struct consdev *cd, int c) /* start USB transfers */ ucom_outwakeup(sc->sc_tty); - mtx_unlock(sc->sc_mtx); + UCOM_MTX_UNLOCK(sc); /* poll if necessary */ if (kdb_active && sc->sc_callback->ucom_poll) { @@ -1441,6 +1499,50 @@ ucom_cnputc(struct consdev *cd, int c) } } +/*------------------------------------------------------------------------* + * ucom_ref + * + * This function will increment the super UCOM reference count. + *------------------------------------------------------------------------*/ +void +ucom_ref(struct ucom_super_softc *ssc) +{ + mtx_lock(&ucom_mtx); + ssc->sc_refs++; + mtx_unlock(&ucom_mtx); +} + +/*------------------------------------------------------------------------* + * ucom_unref + * + * This function will decrement the super UCOM reference count. + * + * Return values: + * 0: UCOM structures are still referenced. + * Else: UCOM structures are no longer referenced. + *------------------------------------------------------------------------*/ +int +ucom_unref(struct ucom_super_softc *ssc) +{ + int retval; + int free_unit; + + mtx_lock(&ucom_mtx); + retval = (ssc->sc_refs < 2); + free_unit = (ssc->sc_refs == 1); + ssc->sc_refs--; + mtx_unlock(&ucom_mtx); + + /* + * This function might be called when the "ssc" is only zero + * initialized and in that case the unit number should not be + * freed. + */ + if (free_unit) + ucom_unit_free(ssc->sc_unit); + return (retval); +} + #if defined(GDB) #include Modified: head/sys/dev/usb/serial/usb_serial.h ============================================================================== --- head/sys/dev/usb/serial/usb_serial.h Fri Aug 10 15:02:49 2012 (r239178) +++ head/sys/dev/usb/serial/usb_serial.h Fri Aug 10 15:21:12 2012 (r239179) @@ -107,6 +107,7 @@ struct ucom_callback { void (*ucom_stop_write) (struct ucom_softc *); void (*ucom_tty_name) (struct ucom_softc *, char *pbuf, uint16_t buflen, uint16_t unit, uint16_t subunit); void (*ucom_poll) (struct ucom_softc *); + void (*ucom_free) (struct ucom_softc *); }; /* Line status register */ @@ -135,6 +136,8 @@ struct ucom_super_softc { struct usb_process sc_tq; int sc_unit; int sc_subunits; + int sc_refs; + int sc_wait_refs; struct sysctl_oid *sc_sysctl_ttyname; struct sysctl_oid *sc_sysctl_ttyports; char sc_ttyname[16]; @@ -158,7 +161,6 @@ struct ucom_softc { struct ucom_cfg_task sc_line_state_task[2]; struct ucom_cfg_task sc_status_task[2]; struct ucom_param_task sc_param_task[2]; - struct cv sc_cv; /* Used to set "UCOM_FLAG_GP_DATA" flag: */ struct usb_proc_msg *sc_last_start_xfer; const struct ucom_callback *sc_callback; @@ -179,7 +181,6 @@ struct ucom_softc { uint8_t sc_lsr; uint8_t sc_msr; uint8_t sc_mcr; - uint8_t sc_ttyfreed; /* set when TTY has been freed */ /* programmed line state bits */ uint8_t sc_pls_set; /* set bits */ uint8_t sc_pls_clr; /* cleared bits */ @@ -190,6 +191,12 @@ struct ucom_softc { #define UCOM_LS_RING 0x08 }; +#define UCOM_MTX_ASSERT(sc, what) mtx_assert((sc)->sc_mtx, what) +#define UCOM_MTX_LOCK(sc) mtx_lock((sc)->sc_mtx) +#define UCOM_MTX_UNLOCK(sc) mtx_unlock((sc)->sc_mtx) +#define UCOM_UNLOAD_DRAIN(x) \ +SYSUNINIT(var, SI_SUB_KLD - 3, SI_ORDER_ANY, ucom_drain_all, 0) + #define ucom_cfg_do_request(udev,com,req,ptr,flags,timo) \ usbd_do_request_proc(udev,&(com)->sc_super->sc_tq,req,ptr,flags,NULL,timo) @@ -204,4 +211,8 @@ uint8_t ucom_get_data(struct ucom_softc void ucom_put_data(struct ucom_softc *, struct usb_page_cache *, uint32_t, uint32_t); uint8_t ucom_cfg_is_gone(struct ucom_softc *); +void ucom_drain(struct ucom_super_softc *); +void ucom_drain_all(void *); +void ucom_ref(struct ucom_super_softc *); +int ucom_unref(struct ucom_super_softc *); #endif /* _USB_SERIAL_H_ */ Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Fri Aug 10 15:02:49 2012 (r239178) +++ head/sys/sys/param.h Fri Aug 10 15:21:12 2012 (r239179) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1000015 /* Master, propagated to newvers */ +#define __FreeBSD_version 1000016 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@FreeBSD.ORG Fri Aug 10 15:29:42 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0690E106566C; Fri, 10 Aug 2012 15:29:42 +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 E30368FC0C; Fri, 10 Aug 2012 15:29:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7AFTfnq048549; Fri, 10 Aug 2012 15:29:41 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7AFTfpP048532; Fri, 10 Aug 2012 15:29:41 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201208101529.q7AFTfpP048532@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 10 Aug 2012 15:29:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239180 - in head/sys/dev/usb: net serial X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Aug 2012 15:29:42 -0000 Author: hselasky Date: Fri Aug 10 15:29:41 2012 New Revision: 239180 URL: http://svn.freebsd.org/changeset/base/239180 Log: Take advantage of new UCOM and bus functionality so that the device_detach() function doesn't block on UCOM device drivers until the TTY handle is closed by the userspace application. This is implemented by a postpone of the softc free where the UCOM structures reside until the TTY references are gone. Discussed with: kib, ed MFC after: 2 weeks Modified: head/sys/dev/usb/net/if_usie.c head/sys/dev/usb/net/uhso.c head/sys/dev/usb/serial/u3g.c head/sys/dev/usb/serial/uark.c head/sys/dev/usb/serial/ubsa.c head/sys/dev/usb/serial/ubser.c head/sys/dev/usb/serial/uchcom.c head/sys/dev/usb/serial/ucycom.c head/sys/dev/usb/serial/ufoma.c head/sys/dev/usb/serial/uftdi.c head/sys/dev/usb/serial/ugensa.c head/sys/dev/usb/serial/uipaq.c head/sys/dev/usb/serial/ulpt.c head/sys/dev/usb/serial/umcs.c head/sys/dev/usb/serial/umct.c head/sys/dev/usb/serial/umodem.c head/sys/dev/usb/serial/umoscom.c head/sys/dev/usb/serial/uplcom.c head/sys/dev/usb/serial/uslcom.c head/sys/dev/usb/serial/uvisor.c head/sys/dev/usb/serial/uvscom.c Modified: head/sys/dev/usb/net/if_usie.c ============================================================================== --- head/sys/dev/usb/net/if_usie.c Fri Aug 10 15:21:12 2012 (r239179) +++ head/sys/dev/usb/net/if_usie.c Fri Aug 10 15:29:41 2012 (r239180) @@ -95,7 +95,9 @@ static const STRUCT_USB_HOST_ID usie_dev static device_probe_t usie_probe; static device_attach_t usie_attach; static device_detach_t usie_detach; +static device_free_softc_t usie_free_softc; +static void usie_free(struct ucom_softc *); static void usie_uc_update_line_state(struct ucom_softc *, uint8_t); static void usie_uc_cfg_get_status(struct ucom_softc *, uint8_t *, uint8_t *); static void usie_uc_cfg_set_dtr(struct ucom_softc *, uint8_t); @@ -189,7 +191,8 @@ static device_method_t usie_methods[] = DEVMETHOD(device_probe, usie_probe), DEVMETHOD(device_attach, usie_attach), DEVMETHOD(device_detach, usie_detach), - {0, 0} + DEVMETHOD(device_free_softc, usie_free_softc), + DEVMETHOD_END }; static driver_t usie_driver = { @@ -216,6 +219,7 @@ static const struct ucom_callback usie_u .ucom_stop_read = &usie_uc_stop_read, .ucom_start_write = &usie_uc_start_write, .ucom_stop_write = &usie_uc_stop_write, + .ucom_free = &usie_free, }; static void @@ -298,6 +302,7 @@ usie_attach(device_t self) sc->sc_dev = self; mtx_init(&sc->sc_mtx, "usie", MTX_NETWORK_LOCK, MTX_DEF); + ucom_ref(&sc->sc_super_ucom); TASK_INIT(&sc->sc_if_status_task, 0, usie_if_status_cb, sc); TASK_INIT(&sc->sc_if_sync_task, 0, usie_if_sync_cb, sc); @@ -482,11 +487,30 @@ usie_detach(device_t self) for (x = 0; x != USIE_UCOM_MAX; x++) usbd_transfer_unsetup(sc->sc_uc_xfer[x], USIE_UC_N_XFER); - mtx_destroy(&sc->sc_mtx); return (0); } +UCOM_UNLOAD_DRAIN(usie); + +static void +usie_free_softc(device_t dev, void *arg) +{ + struct usie_softc *sc = arg; + + if (ucom_unref(&sc->sc_super_ucom)) { + if (mtx_initialized(&sc->sc_mtx)) + mtx_destroy(&sc->sc_mtx); + device_free_softc(dev, sc); + } +} + +static void +usie_free(struct ucom_softc *ucom) +{ + usie_free_softc(NULL, ucom->sc_parent); +} + static void usie_uc_update_line_state(struct ucom_softc *ucom, uint8_t ls) { Modified: head/sys/dev/usb/net/uhso.c ============================================================================== --- head/sys/dev/usb/net/uhso.c Fri Aug 10 15:21:12 2012 (r239179) +++ head/sys/dev/usb/net/uhso.c Fri Aug 10 15:29:41 2012 (r239180) @@ -455,6 +455,7 @@ static int uhso_driver_loaded(struct mo static int uhso_radio_sysctl(SYSCTL_HANDLER_ARGS); static int uhso_radio_ctrl(struct uhso_softc *, int); +static void uhso_free(struct ucom_softc *); static void uhso_ucom_start_read(struct ucom_softc *); static void uhso_ucom_stop_read(struct ucom_softc *); static void uhso_ucom_start_write(struct ucom_softc *); @@ -473,11 +474,13 @@ static void uhso_if_rxflush(void *); static device_probe_t uhso_probe; static device_attach_t uhso_attach; static device_detach_t uhso_detach; +static device_free_softc_t uhso_free_softc; static device_method_t uhso_methods[] = { DEVMETHOD(device_probe, uhso_probe), DEVMETHOD(device_attach, uhso_attach), DEVMETHOD(device_detach, uhso_detach), + DEVMETHOD(device_free_softc, uhso_free_softc), { 0, 0 } }; @@ -500,7 +503,8 @@ static struct ucom_callback uhso_ucom_ca .ucom_start_read = uhso_ucom_start_read, .ucom_stop_read = uhso_ucom_stop_read, .ucom_start_write = uhso_ucom_start_write, - .ucom_stop_write = uhso_ucom_stop_write + .ucom_stop_write = uhso_ucom_stop_write, + .ucom_free = &uhso_free, }; static int @@ -552,6 +556,7 @@ uhso_attach(device_t self) sc->sc_dev = self; sc->sc_udev = uaa->device; mtx_init(&sc->sc_mtx, "uhso", NULL, MTX_DEF); + ucom_ref(&sc->sc_super_ucom); sc->sc_ucom = NULL; sc->sc_ttys = 0; @@ -692,10 +697,29 @@ uhso_detach(device_t self) usbd_transfer_unsetup(sc->sc_if_xfer, UHSO_IFNET_MAX); } - mtx_destroy(&sc->sc_mtx); return (0); } +UCOM_UNLOAD_DRAIN(uhso); + +static void +uhso_free_softc(device_t dev, void *arg) +{ + struct uhso_softc *sc = arg; + + if (ucom_unref(&sc->sc_super_ucom)) { + if (mtx_initialized(&sc->sc_mtx)) + mtx_destroy(&sc->sc_mtx); + device_free_softc(dev, sc); + } +} + +static void +uhso_free(struct ucom_softc *ucom) +{ + uhso_free_softc(NULL, ucom->sc_parent); +} + static void uhso_test_autoinst(void *arg, struct usb_device *udev, struct usb_attach_arg *uaa) Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Fri Aug 10 15:21:12 2012 (r239179) +++ head/sys/dev/usb/serial/u3g.c Fri Aug 10 15:29:41 2012 (r239180) @@ -118,10 +118,12 @@ struct u3g_softc { static device_probe_t u3g_probe; static device_attach_t u3g_attach; static device_detach_t u3g_detach; +static device_free_softc_t u3g_free_softc; static usb_callback_t u3g_write_callback; static usb_callback_t u3g_read_callback; +static void u3g_free(struct ucom_softc *ucom); static void u3g_start_read(struct ucom_softc *ucom); static void u3g_stop_read(struct ucom_softc *ucom); static void u3g_start_write(struct ucom_softc *ucom); @@ -160,13 +162,15 @@ static const struct ucom_callback u3g_ca .ucom_stop_read = &u3g_stop_read, .ucom_start_write = &u3g_start_write, .ucom_stop_write = &u3g_stop_write, + .ucom_free = &u3g_free, }; static device_method_t u3g_methods[] = { DEVMETHOD(device_probe, u3g_probe), DEVMETHOD(device_attach, u3g_attach), DEVMETHOD(device_detach, u3g_detach), - {0, 0} + DEVMETHOD(device_free_softc, u3g_free_softc), + DEVMETHOD_END }; static devclass_t u3g_devclass; @@ -805,6 +809,7 @@ u3g_attach(device_t dev) device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "u3g", NULL, MTX_DEF); + ucom_ref(&sc->sc_super_ucom); sc->sc_udev = uaa->device; @@ -892,11 +897,30 @@ u3g_detach(device_t dev) for (subunit = 0; subunit != U3G_MAXPORTS; subunit++) usbd_transfer_unsetup(sc->sc_xfer[subunit], U3G_N_TRANSFER); - mtx_destroy(&sc->sc_mtx); return (0); } +UCOM_UNLOAD_DRAIN(u3g); + +static void +u3g_free_softc(device_t dev, void *arg) +{ + struct u3g_softc *sc = arg; + + if (ucom_unref(&sc->sc_super_ucom)) { + if (mtx_initialized(&sc->sc_mtx)) + mtx_destroy(&sc->sc_mtx); + device_free_softc(dev, sc); + } +} + +static void +u3g_free(struct ucom_softc *ucom) +{ + u3g_free_softc(NULL, ucom->sc_parent); +} + static void u3g_start_read(struct ucom_softc *ucom) { Modified: head/sys/dev/usb/serial/uark.c ============================================================================== --- head/sys/dev/usb/serial/uark.c Fri Aug 10 15:21:12 2012 (r239179) +++ head/sys/dev/usb/serial/uark.c Fri Aug 10 15:29:41 2012 (r239180) @@ -99,10 +99,12 @@ struct uark_softc { static device_probe_t uark_probe; static device_attach_t uark_attach; static device_detach_t uark_detach; +static device_free_softc_t uark_free_softc; static usb_callback_t uark_bulk_write_callback; static usb_callback_t uark_bulk_read_callback; +static void uark_free(struct ucom_softc *); static void uark_start_read(struct ucom_softc *); static void uark_stop_read(struct ucom_softc *); static void uark_start_write(struct ucom_softc *); @@ -147,6 +149,7 @@ static const struct ucom_callback uark_c .ucom_start_write = &uark_start_write, .ucom_stop_write = &uark_stop_write, .ucom_poll = &uark_poll, + .ucom_free = &uark_free, }; static device_method_t uark_methods[] = { @@ -154,7 +157,8 @@ static device_method_t uark_methods[] = DEVMETHOD(device_probe, uark_probe), DEVMETHOD(device_attach, uark_attach), DEVMETHOD(device_detach, uark_detach), - {0, 0} + DEVMETHOD(device_free_softc, uark_free_softc), + DEVMETHOD_END }; static devclass_t uark_devclass; @@ -201,6 +205,7 @@ uark_attach(device_t dev) device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "uark", NULL, MTX_DEF); + ucom_ref(&sc->sc_super_ucom); sc->sc_udev = uaa->device; @@ -242,11 +247,30 @@ uark_detach(device_t dev) ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom); usbd_transfer_unsetup(sc->sc_xfer, UARK_N_TRANSFER); - mtx_destroy(&sc->sc_mtx); return (0); } +UCOM_UNLOAD_DRAIN(uark); + +static void +uark_free_softc(device_t dev, void *arg) +{ + struct uark_softc *sc = arg; + + if (ucom_unref(&sc->sc_super_ucom)) { + if (mtx_initialized(&sc->sc_mtx)) + mtx_destroy(&sc->sc_mtx); + device_free_softc(dev, sc); + } +} + +static void +uark_free(struct ucom_softc *ucom) +{ + uark_free_softc(NULL, ucom->sc_parent); +} + static void uark_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) { Modified: head/sys/dev/usb/serial/ubsa.c ============================================================================== --- head/sys/dev/usb/serial/ubsa.c Fri Aug 10 15:21:12 2012 (r239179) +++ head/sys/dev/usb/serial/ubsa.c Fri Aug 10 15:29:41 2012 (r239180) @@ -176,12 +176,14 @@ struct ubsa_softc { static device_probe_t ubsa_probe; static device_attach_t ubsa_attach; static device_detach_t ubsa_detach; +static device_free_softc_t ubsa_free_softc; static usb_callback_t ubsa_write_callback; static usb_callback_t ubsa_read_callback; static usb_callback_t ubsa_intr_callback; static void ubsa_cfg_request(struct ubsa_softc *, uint8_t, uint16_t); +static void ubsa_free(struct ucom_softc *); static void ubsa_cfg_set_dtr(struct ucom_softc *, uint8_t); static void ubsa_cfg_set_rts(struct ucom_softc *, uint8_t); static void ubsa_cfg_set_break(struct ucom_softc *, uint8_t); @@ -237,6 +239,7 @@ static const struct ucom_callback ubsa_c .ucom_start_write = &ubsa_start_write, .ucom_stop_write = &ubsa_stop_write, .ucom_poll = &ubsa_poll, + .ucom_free = &ubsa_free, }; static const STRUCT_USB_HOST_ID ubsa_devs[] = { @@ -262,7 +265,8 @@ static device_method_t ubsa_methods[] = DEVMETHOD(device_probe, ubsa_probe), DEVMETHOD(device_attach, ubsa_attach), DEVMETHOD(device_detach, ubsa_detach), - {0, 0} + DEVMETHOD(device_free_softc, ubsa_free_softc), + DEVMETHOD_END }; static devclass_t ubsa_devclass; @@ -306,6 +310,7 @@ ubsa_attach(device_t dev) device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "ubsa", NULL, MTX_DEF); + ucom_ref(&sc->sc_super_ucom); sc->sc_udev = uaa->device; sc->sc_iface_no = uaa->info.bIfaceNum; @@ -348,11 +353,30 @@ ubsa_detach(device_t dev) ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom); usbd_transfer_unsetup(sc->sc_xfer, UBSA_N_TRANSFER); - mtx_destroy(&sc->sc_mtx); return (0); } +UCOM_UNLOAD_DRAIN(ubsa); + +static void +ubsa_free_softc(device_t dev, void *arg) +{ + struct ubsa_softc *sc = arg; + + if (ucom_unref(&sc->sc_super_ucom)) { + if (mtx_initialized(&sc->sc_mtx)) + mtx_destroy(&sc->sc_mtx); + device_free_softc(dev, sc); + } +} + +static void +ubsa_free(struct ucom_softc *ucom) +{ + ubsa_free_softc(NULL, ucom->sc_parent); +} + static void ubsa_cfg_request(struct ubsa_softc *sc, uint8_t index, uint16_t value) { Modified: head/sys/dev/usb/serial/ubser.c ============================================================================== --- head/sys/dev/usb/serial/ubser.c Fri Aug 10 15:21:12 2012 (r239179) +++ head/sys/dev/usb/serial/ubser.c Fri Aug 10 15:29:41 2012 (r239180) @@ -149,10 +149,12 @@ struct ubser_softc { static device_probe_t ubser_probe; static device_attach_t ubser_attach; static device_detach_t ubser_detach; +static device_free_softc_t ubser_free_softc; static usb_callback_t ubser_write_callback; static usb_callback_t ubser_read_callback; +static void ubser_free(struct ucom_softc *); static int ubser_pre_param(struct ucom_softc *, struct termios *); static void ubser_cfg_set_break(struct ucom_softc *, uint8_t); static void ubser_cfg_get_status(struct ucom_softc *, uint8_t *, @@ -193,13 +195,15 @@ static const struct ucom_callback ubser_ .ucom_start_write = &ubser_start_write, .ucom_stop_write = &ubser_stop_write, .ucom_poll = &ubser_poll, + .ucom_free = &ubser_free, }; static device_method_t ubser_methods[] = { DEVMETHOD(device_probe, ubser_probe), DEVMETHOD(device_attach, ubser_attach), DEVMETHOD(device_detach, ubser_detach), - {0, 0} + DEVMETHOD(device_free_softc, ubser_free_softc), + DEVMETHOD_END }; static devclass_t ubser_devclass; @@ -243,6 +247,7 @@ ubser_attach(device_t dev) device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "ubser", NULL, MTX_DEF); + ucom_ref(&sc->sc_super_ucom); snprintf(sc->sc_name, sizeof(sc->sc_name), "%s", device_get_nameunit(dev)); @@ -319,11 +324,30 @@ ubser_detach(device_t dev) ucom_detach(&sc->sc_super_ucom, sc->sc_ucom); usbd_transfer_unsetup(sc->sc_xfer, UBSER_N_TRANSFER); - mtx_destroy(&sc->sc_mtx); return (0); } +UCOM_UNLOAD_DRAIN(ubser); + +static void +ubser_free_softc(device_t dev, void *arg) +{ + struct ubser_softc *sc = arg; + + if (ucom_unref(&sc->sc_super_ucom)) { + if (mtx_initialized(&sc->sc_mtx)) + mtx_destroy(&sc->sc_mtx); + device_free_softc(dev, sc); + } +} + +static void +ubser_free(struct ucom_softc *ucom) +{ + ubser_free_softc(NULL, ucom->sc_parent); +} + static int ubser_pre_param(struct ucom_softc *ucom, struct termios *t) { Modified: head/sys/dev/usb/serial/uchcom.c ============================================================================== --- head/sys/dev/usb/serial/uchcom.c Fri Aug 10 15:21:12 2012 (r239179) +++ head/sys/dev/usb/serial/uchcom.c Fri Aug 10 15:29:41 2012 (r239180) @@ -211,6 +211,7 @@ static const STRUCT_USB_HOST_ID uchcom_d /* protypes */ +static void uchcom_free(struct ucom_softc *); static int uchcom_pre_param(struct ucom_softc *, struct termios *); static void uchcom_cfg_get_status(struct ucom_softc *, uint8_t *, uint8_t *); @@ -234,6 +235,7 @@ static void uchcom_poll(struct ucom_soft static device_probe_t uchcom_probe; static device_attach_t uchcom_attach; static device_detach_t uchcom_detach; +static device_free_softc_t uchcom_free_softc; static usb_callback_t uchcom_intr_callback; static usb_callback_t uchcom_write_callback; @@ -282,6 +284,7 @@ static struct ucom_callback uchcom_callb .ucom_start_write = &uchcom_start_write, .ucom_stop_write = &uchcom_stop_write, .ucom_poll = &uchcom_poll, + .ucom_free = &uchcom_free, }; /* ---------------------------------------------------------------------- @@ -319,6 +322,7 @@ uchcom_attach(device_t dev) device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "uchcom", NULL, MTX_DEF); + ucom_ref(&sc->sc_super_ucom); sc->sc_udev = uaa->device; @@ -371,11 +375,30 @@ uchcom_detach(device_t dev) ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom); usbd_transfer_unsetup(sc->sc_xfer, UCHCOM_N_TRANSFER); - mtx_destroy(&sc->sc_mtx); return (0); } +UCOM_UNLOAD_DRAIN(uchcom); + +static void +uchcom_free_softc(device_t dev, void *arg) +{ + struct uchcom_softc *sc = arg; + + if (ucom_unref(&sc->sc_super_ucom)) { + if (mtx_initialized(&sc->sc_mtx)) + mtx_destroy(&sc->sc_mtx); + device_free_softc(dev, sc); + } +} + +static void +uchcom_free(struct ucom_softc *ucom) +{ + uchcom_free_softc(NULL, ucom->sc_parent); +} + /* ---------------------------------------------------------------------- * low level i/o */ @@ -841,8 +864,8 @@ static device_method_t uchcom_methods[] DEVMETHOD(device_probe, uchcom_probe), DEVMETHOD(device_attach, uchcom_attach), DEVMETHOD(device_detach, uchcom_detach), - - {0, 0} + DEVMETHOD(device_free_softc, uchcom_free_softc), + DEVMETHOD_END }; static driver_t uchcom_driver = { Modified: head/sys/dev/usb/serial/ucycom.c ============================================================================== --- head/sys/dev/usb/serial/ucycom.c Fri Aug 10 15:21:12 2012 (r239179) +++ head/sys/dev/usb/serial/ucycom.c Fri Aug 10 15:29:41 2012 (r239180) @@ -111,10 +111,12 @@ struct ucycom_softc { static device_probe_t ucycom_probe; static device_attach_t ucycom_attach; static device_detach_t ucycom_detach; +static device_free_softc_t ucycom_free_softc; static usb_callback_t ucycom_ctrl_write_callback; static usb_callback_t ucycom_intr_read_callback; +static void ucycom_free(struct ucom_softc *); static void ucycom_cfg_open(struct ucom_softc *); static void ucycom_start_read(struct ucom_softc *); static void ucycom_stop_read(struct ucom_softc *); @@ -155,13 +157,15 @@ static const struct ucom_callback ucycom .ucom_start_write = &ucycom_start_write, .ucom_stop_write = &ucycom_stop_write, .ucom_poll = &ucycom_poll, + .ucom_free = &ucycom_free, }; static device_method_t ucycom_methods[] = { DEVMETHOD(device_probe, ucycom_probe), DEVMETHOD(device_attach, ucycom_attach), DEVMETHOD(device_detach, ucycom_detach), - {0, 0} + DEVMETHOD(device_free_softc, ucycom_free_softc), + DEVMETHOD_END }; static devclass_t ucycom_devclass; @@ -218,6 +222,7 @@ ucycom_attach(device_t dev) device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "ucycom", NULL, MTX_DEF); + ucom_ref(&sc->sc_super_ucom); snprintf(sc->sc_name, sizeof(sc->sc_name), "%s", device_get_nameunit(dev)); @@ -297,11 +302,30 @@ ucycom_detach(device_t dev) ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom); usbd_transfer_unsetup(sc->sc_xfer, UCYCOM_N_TRANSFER); - mtx_destroy(&sc->sc_mtx); return (0); } +UCOM_UNLOAD_DRAIN(ucycom); + +static void +ucycom_free_softc(device_t dev, void *arg) +{ + struct ucycom_softc *sc = arg; + + if (ucom_unref(&sc->sc_super_ucom)) { + if (mtx_initialized(&sc->sc_mtx)) + mtx_destroy(&sc->sc_mtx); + device_free_softc(dev, sc); + } +} + +static void +ucycom_free(struct ucom_softc *ucom) +{ + ucycom_free_softc(NULL, ucom->sc_parent); +} + static void ucycom_cfg_open(struct ucom_softc *ucom) { Modified: head/sys/dev/usb/serial/ufoma.c ============================================================================== --- head/sys/dev/usb/serial/ufoma.c Fri Aug 10 15:21:12 2012 (r239179) +++ head/sys/dev/usb/serial/ufoma.c Fri Aug 10 15:29:41 2012 (r239180) @@ -203,6 +203,7 @@ struct ufoma_softc { static device_probe_t ufoma_probe; static device_attach_t ufoma_attach; static device_detach_t ufoma_detach; +static device_free_softc_t ufoma_free_softc; static usb_callback_t ufoma_ctrl_read_callback; static usb_callback_t ufoma_ctrl_write_callback; @@ -214,6 +215,7 @@ static void *ufoma_get_intconf(struct us struct usb_interface_descriptor *, uint8_t, uint8_t); static void ufoma_cfg_link_state(struct ufoma_softc *); static void ufoma_cfg_activate_state(struct ufoma_softc *, uint16_t); +static void ufoma_free(struct ucom_softc *); static void ufoma_cfg_open(struct ucom_softc *); static void ufoma_cfg_close(struct ucom_softc *); static void ufoma_cfg_set_break(struct ucom_softc *, uint8_t); @@ -304,6 +306,7 @@ static const struct ucom_callback ufoma_ .ucom_start_write = &ufoma_start_write, .ucom_stop_write = &ufoma_stop_write, .ucom_poll = &ufoma_poll, + .ucom_free = &ufoma_free, }; static device_method_t ufoma_methods[] = { @@ -311,7 +314,8 @@ static device_method_t ufoma_methods[] = DEVMETHOD(device_probe, ufoma_probe), DEVMETHOD(device_attach, ufoma_attach), DEVMETHOD(device_detach, ufoma_detach), - {0, 0} + DEVMETHOD(device_free_softc, ufoma_free_softc), + DEVMETHOD_END }; static devclass_t ufoma_devclass; @@ -385,6 +389,7 @@ ufoma_attach(device_t dev) sc->sc_unit = device_get_unit(dev); mtx_init(&sc->sc_mtx, "ufoma", NULL, MTX_DEF); + ucom_ref(&sc->sc_super_ucom); cv_init(&sc->sc_cv, "CWAIT"); device_set_usb_desc(dev); @@ -495,12 +500,31 @@ ufoma_detach(device_t dev) if (sc->sc_modetable) { free(sc->sc_modetable, M_USBDEV); } - mtx_destroy(&sc->sc_mtx); cv_destroy(&sc->sc_cv); return (0); } +UCOM_UNLOAD_DRAIN(ufoma); + +static void +ufoma_free_softc(device_t dev, void *arg) +{ + struct ufoma_softc *sc = arg; + + if (ucom_unref(&sc->sc_super_ucom)) { + if (mtx_initialized(&sc->sc_mtx)) + mtx_destroy(&sc->sc_mtx); + device_free_softc(dev, sc); + } +} + +static void +ufoma_free(struct ucom_softc *ucom) +{ + ufoma_free_softc(NULL, ucom->sc_parent); +} + static void * ufoma_get_intconf(struct usb_config_descriptor *cd, struct usb_interface_descriptor *id, uint8_t type, uint8_t subtype) Modified: head/sys/dev/usb/serial/uftdi.c ============================================================================== --- head/sys/dev/usb/serial/uftdi.c Fri Aug 10 15:21:12 2012 (r239179) +++ head/sys/dev/usb/serial/uftdi.c Fri Aug 10 15:29:41 2012 (r239180) @@ -127,10 +127,12 @@ struct uftdi_param_config { static device_probe_t uftdi_probe; static device_attach_t uftdi_attach; static device_detach_t uftdi_detach; +static device_free_softc_t uftdi_free_softc; static usb_callback_t uftdi_write_callback; static usb_callback_t uftdi_read_callback; +static void uftdi_free(struct ucom_softc *); static void uftdi_cfg_open(struct ucom_softc *); static void uftdi_cfg_set_dtr(struct ucom_softc *, uint8_t); static void uftdi_cfg_set_rts(struct ucom_softc *, uint8_t); @@ -182,6 +184,7 @@ static const struct ucom_callback uftdi_ .ucom_start_write = &uftdi_start_write, .ucom_stop_write = &uftdi_stop_write, .ucom_poll = &uftdi_poll, + .ucom_free = &uftdi_free, }; static device_method_t uftdi_methods[] = { @@ -189,7 +192,7 @@ static device_method_t uftdi_methods[] = DEVMETHOD(device_probe, uftdi_probe), DEVMETHOD(device_attach, uftdi_attach), DEVMETHOD(device_detach, uftdi_detach), - + DEVMETHOD(device_free_softc, uftdi_free_softc), DEVMETHOD_END }; @@ -885,6 +888,7 @@ uftdi_attach(device_t dev) device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "uftdi", NULL, MTX_DEF); + ucom_ref(&sc->sc_super_ucom); snprintf(sc->sc_name, sizeof(sc->sc_name), "%s", device_get_nameunit(dev)); @@ -960,11 +964,30 @@ uftdi_detach(device_t dev) ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom); usbd_transfer_unsetup(sc->sc_xfer, UFTDI_N_TRANSFER); - mtx_destroy(&sc->sc_mtx); return (0); } +UCOM_UNLOAD_DRAIN(uftdi); + +static void +uftdi_free_softc(device_t dev, void *arg) +{ + struct uftdi_softc *sc = arg; + + if (ucom_unref(&sc->sc_super_ucom)) { + if (mtx_initialized(&sc->sc_mtx)) + mtx_destroy(&sc->sc_mtx); + device_free_softc(dev, sc); + } +} + +static void +uftdi_free(struct ucom_softc *ucom) +{ + uftdi_free_softc(NULL, ucom->sc_parent); +} + static void uftdi_cfg_open(struct ucom_softc *ucom) { Modified: head/sys/dev/usb/serial/ugensa.c ============================================================================== --- head/sys/dev/usb/serial/ugensa.c Fri Aug 10 15:21:12 2012 (r239179) +++ head/sys/dev/usb/serial/ugensa.c Fri Aug 10 15:29:41 2012 (r239180) @@ -94,10 +94,12 @@ struct ugensa_softc { static device_probe_t ugensa_probe; static device_attach_t ugensa_attach; static device_detach_t ugensa_detach; +static device_free_softc_t ugensa_free_softc; static usb_callback_t ugensa_bulk_write_callback; static usb_callback_t ugensa_bulk_read_callback; +static void ugensa_free(struct ucom_softc *); static void ugensa_start_read(struct ucom_softc *); static void ugensa_stop_read(struct ucom_softc *); static void ugensa_start_write(struct ucom_softc *); @@ -131,6 +133,7 @@ static const struct ucom_callback ugensa .ucom_start_write = &ugensa_start_write, .ucom_stop_write = &ugensa_stop_write, .ucom_poll = &ugensa_poll, + .ucom_free = &ugensa_free, }; static device_method_t ugensa_methods[] = { @@ -138,7 +141,8 @@ static device_method_t ugensa_methods[] DEVMETHOD(device_probe, ugensa_probe), DEVMETHOD(device_attach, ugensa_attach), DEVMETHOD(device_detach, ugensa_detach), - {0, 0} + DEVMETHOD(device_free_softc, ugensa_free_softc), + DEVMETHOD_END }; static devclass_t ugensa_devclass; @@ -192,6 +196,7 @@ ugensa_attach(device_t dev) device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "ugensa", NULL, MTX_DEF); + ucom_ref(&sc->sc_super_ucom); /* Figure out how many interfaces this device has got */ for (cnt = 0; cnt < UGENSA_IFACE_MAX; cnt++) { @@ -266,11 +271,30 @@ ugensa_detach(device_t dev) for (x = 0; x < sc->sc_niface; x++) { usbd_transfer_unsetup(sc->sc_sub[x].sc_xfer, UGENSA_N_TRANSFER); } - mtx_destroy(&sc->sc_mtx); return (0); } +UCOM_UNLOAD_DRAIN(ugensa); + +static void +ugensa_free_softc(device_t dev, void *arg) +{ + struct ugensa_softc *sc = arg; + + if (ucom_unref(&sc->sc_super_ucom)) { + if (mtx_initialized(&sc->sc_mtx)) + mtx_destroy(&sc->sc_mtx); + device_free_softc(dev, sc); + } +} + +static void +ugensa_free(struct ucom_softc *ucom) +{ + ugensa_free_softc(NULL, ucom->sc_parent); +} + static void ugensa_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) { Modified: head/sys/dev/usb/serial/uipaq.c ============================================================================== --- head/sys/dev/usb/serial/uipaq.c Fri Aug 10 15:21:12 2012 (r239179) +++ head/sys/dev/usb/serial/uipaq.c Fri Aug 10 15:29:41 2012 (r239180) @@ -103,10 +103,12 @@ struct uipaq_softc { static device_probe_t uipaq_probe; static device_attach_t uipaq_attach; static device_detach_t uipaq_detach; +static device_free_softc_t uipaq_free_softc; static usb_callback_t uipaq_write_callback; static usb_callback_t uipaq_read_callback; +static void uipaq_free(struct ucom_softc *); static void uipaq_start_read(struct ucom_softc *); static void uipaq_stop_read(struct ucom_softc *); static void uipaq_start_write(struct ucom_softc *); @@ -146,6 +148,7 @@ static const struct ucom_callback uipaq_ .ucom_start_write = &uipaq_start_write, .ucom_stop_write = &uipaq_stop_write, .ucom_poll = &uipaq_poll, + .ucom_free = &uipaq_free, }; /* @@ -1070,7 +1073,8 @@ static device_method_t uipaq_methods[] = DEVMETHOD(device_probe, uipaq_probe), DEVMETHOD(device_attach, uipaq_attach), DEVMETHOD(device_detach, uipaq_detach), - {0, 0} + DEVMETHOD(device_free_softc, uipaq_free_softc), + DEVMETHOD_END }; static devclass_t uipaq_devclass; @@ -1121,6 +1125,7 @@ uipaq_attach(device_t dev) device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "uipaq", NULL, MTX_DEF); + ucom_ref(&sc->sc_super_ucom); /* * Send magic bytes, cribbed from Linux ipaq driver that @@ -1176,11 +1181,30 @@ uipaq_detach(device_t dev) ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom); usbd_transfer_unsetup(sc->sc_xfer, UIPAQ_N_TRANSFER); - mtx_destroy(&sc->sc_mtx); return (0); } +UCOM_UNLOAD_DRAIN(uipaq); + +static void +uipaq_free_softc(device_t dev, void *arg) +{ + struct uipaq_softc *sc = arg; + + if (ucom_unref(&sc->sc_super_ucom)) { + if (mtx_initialized(&sc->sc_mtx)) + mtx_destroy(&sc->sc_mtx); + device_free_softc(dev, sc); + } +} + +static void +uipaq_free(struct ucom_softc *ucom) +{ + uipaq_free_softc(NULL, ucom->sc_parent); +} + static void uipaq_start_read(struct ucom_softc *ucom) { Modified: head/sys/dev/usb/serial/ulpt.c ============================================================================== --- head/sys/dev/usb/serial/ulpt.c Fri Aug 10 15:21:12 2012 (r239179) +++ head/sys/dev/usb/serial/ulpt.c Fri Aug 10 15:29:41 2012 (r239180) @@ -747,7 +747,7 @@ static device_method_t ulpt_methods[] = DEVMETHOD(device_probe, ulpt_probe), DEVMETHOD(device_attach, ulpt_attach), DEVMETHOD(device_detach, ulpt_detach), - {0, 0} + DEVMETHOD_END }; static driver_t ulpt_driver = { Modified: head/sys/dev/usb/serial/umcs.c ============================================================================== --- head/sys/dev/usb/serial/umcs.c Fri Aug 10 15:21:12 2012 (r239179) +++ head/sys/dev/usb/serial/umcs.c Fri Aug 10 15:29:41 2012 (r239180) @@ -154,6 +154,7 @@ static usb_error_t umcs7840_set_UART_reg static usb_error_t umcs7840_set_baudrate(struct umcs7840_softc *, uint8_t, uint32_t); static usb_error_t umcs7840_calc_baudrate(uint32_t rate, uint16_t *, uint8_t *); +static void umcs7840_free(struct ucom_softc *); static void umcs7840_cfg_get_status(struct ucom_softc *, uint8_t *, uint8_t *); static void umcs7840_cfg_set_dtr(struct ucom_softc *, uint8_t); static void umcs7840_cfg_set_rts(struct ucom_softc *, uint8_t); @@ -175,6 +176,7 @@ static void umcs7840_poll(struct ucom_so static device_probe_t umcs7840_probe; static device_attach_t umcs7840_attach; static device_detach_t umcs7840_detach; +static device_free_softc_t umcs7840_free_softc; static usb_callback_t umcs7840_intr_callback; static usb_callback_t umcs7840_read_callback1; @@ -251,6 +253,7 @@ static struct ucom_callback umcs7840_cal .ucom_stop_write = &umcs7840_stop_write, .ucom_poll = &umcs7840_poll, + .ucom_free = &umcs7840_free, }; static const STRUCT_USB_HOST_ID umcs7840_devs[] = { @@ -262,7 +265,8 @@ static device_method_t umcs7840_methods[ DEVMETHOD(device_probe, umcs7840_probe), DEVMETHOD(device_attach, umcs7840_attach), DEVMETHOD(device_detach, umcs7840_detach), - {0, 0} + DEVMETHOD(device_free_softc, umcs7840_free_softc), + DEVMETHOD_END }; static devclass_t umcs7840_devclass; @@ -310,6 +314,7 @@ umcs7840_attach(device_t dev) device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "umcs7840", NULL, MTX_DEF); + ucom_ref(&sc->sc_super_ucom); sc->sc_dev = dev; sc->sc_udev = uaa->device; @@ -408,10 +413,29 @@ umcs7840_detach(device_t dev) usbd_transfer_unsetup(sc->sc_ports[sc->sc_ucom[subunit].sc_portno].sc_xfer, UMCS7840_N_TRANSFERS); usbd_transfer_unsetup(&sc->sc_intr_xfer, 1); - mtx_destroy(&sc->sc_mtx); return (0); } +UCOM_UNLOAD_DRAIN(umcs7840); + +static void +umcs7840_free_softc(device_t dev, void *arg) +{ + struct umcs7840_softc *sc = arg; + + if (ucom_unref(&sc->sc_super_ucom)) { + if (mtx_initialized(&sc->sc_mtx)) + mtx_destroy(&sc->sc_mtx); + device_free_softc(dev, sc); + } +} + +static void +umcs7840_free(struct ucom_softc *ucom) +{ + umcs7840_free_softc(NULL, ucom->sc_parent); +} + static void umcs7840_cfg_open(struct ucom_softc *ucom) { Modified: head/sys/dev/usb/serial/umct.c ============================================================================== --- head/sys/dev/usb/serial/umct.c Fri Aug 10 15:21:12 2012 (r239179) +++ head/sys/dev/usb/serial/umct.c Fri Aug 10 15:29:41 2012 (r239180) @@ -123,6 +123,7 @@ struct umct_softc { static device_probe_t umct_probe; static device_attach_t umct_attach; static device_detach_t umct_detach; +static device_free_softc_t umct_free_softc; static usb_callback_t umct_intr_callback; static usb_callback_t umct_intr_callback_sub; @@ -132,6 +133,7 @@ static usb_callback_t umct_write_callbac static void umct_cfg_do_request(struct umct_softc *sc, uint8_t request, uint16_t len, uint32_t value); +static void umct_free(struct ucom_softc *); static void umct_cfg_get_status(struct ucom_softc *, uint8_t *, uint8_t *); static void umct_cfg_set_break(struct ucom_softc *, uint8_t); @@ -190,6 +192,7 @@ static const struct ucom_callback umct_c .ucom_start_write = &umct_start_write, .ucom_stop_write = &umct_stop_write, .ucom_poll = &umct_poll, + .ucom_free = &umct_free, }; static const STRUCT_USB_HOST_ID umct_devs[] = { @@ -204,7 +207,8 @@ static device_method_t umct_methods[] = DEVMETHOD(device_probe, umct_probe), DEVMETHOD(device_attach, umct_attach), DEVMETHOD(device_detach, umct_detach), - {0, 0} + DEVMETHOD(device_free_softc, umct_free_softc), + DEVMETHOD_END }; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Fri Aug 10 17:42:14 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CFF31106564A; Fri, 10 Aug 2012 17:42:14 +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 BA20E8FC08; Fri, 10 Aug 2012 17:42: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 q7AHgEc6059566; Fri, 10 Aug 2012 17:42:14 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7AHgEdc059560; Fri, 10 Aug 2012 17:42:14 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201208101742.q7AHgEdc059560@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 10 Aug 2012 17:42:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239181 - head/sys/dev/usb/serial X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Aug 2012 17:42:15 -0000 Author: hselasky Date: Fri Aug 10 17:42:14 2012 New Revision: 239181 URL: http://svn.freebsd.org/changeset/base/239181 Log: Remove unused structure field. MFC after: 2 weeks Modified: head/sys/dev/usb/serial/ubser.c head/sys/dev/usb/serial/ucycom.c head/sys/dev/usb/serial/ufoma.c head/sys/dev/usb/serial/uftdi.c head/sys/dev/usb/serial/umct.c Modified: head/sys/dev/usb/serial/ubser.c ============================================================================== --- head/sys/dev/usb/serial/ubser.c Fri Aug 10 15:29:41 2012 (r239180) +++ head/sys/dev/usb/serial/ubser.c Fri Aug 10 17:42:14 2012 (r239181) @@ -141,7 +141,6 @@ struct ubser_softc { uint8_t sc_iface_no; uint8_t sc_iface_index; uint8_t sc_curr_tx_unit; - uint8_t sc_name[16]; }; /* prototypes */ @@ -249,9 +248,6 @@ ubser_attach(device_t dev) mtx_init(&sc->sc_mtx, "ubser", NULL, MTX_DEF); ucom_ref(&sc->sc_super_ucom); - snprintf(sc->sc_name, sizeof(sc->sc_name), "%s", - device_get_nameunit(dev)); - sc->sc_iface_no = uaa->info.bIfaceNum; sc->sc_iface_index = uaa->info.bIfaceIndex; sc->sc_udev = uaa->device; Modified: head/sys/dev/usb/serial/ucycom.c ============================================================================== --- head/sys/dev/usb/serial/ucycom.c Fri Aug 10 15:29:41 2012 (r239180) +++ head/sys/dev/usb/serial/ucycom.c Fri Aug 10 17:42:14 2012 (r239181) @@ -101,7 +101,6 @@ struct ucycom_softc { #define UCYCOM_CFG_STOPB 0x08 #define UCYCOM_CFG_DATAB 0x03 uint8_t sc_ist; /* status flags from last input */ - uint8_t sc_name[16]; uint8_t sc_iface_no; uint8_t sc_temp_cfg[32]; }; @@ -224,9 +223,6 @@ ucycom_attach(device_t dev) mtx_init(&sc->sc_mtx, "ucycom", NULL, MTX_DEF); ucom_ref(&sc->sc_super_ucom); - snprintf(sc->sc_name, sizeof(sc->sc_name), - "%s", device_get_nameunit(dev)); - DPRINTF("\n"); /* get chip model */ Modified: head/sys/dev/usb/serial/ufoma.c ============================================================================== --- head/sys/dev/usb/serial/ufoma.c Fri Aug 10 15:29:41 2012 (r239180) +++ head/sys/dev/usb/serial/ufoma.c Fri Aug 10 17:42:14 2012 (r239181) @@ -195,7 +195,6 @@ struct ufoma_softc { uint8_t sc_msr; uint8_t sc_modetoactivate; uint8_t sc_currentmode; - uint8_t sc_name[16]; }; /* prototypes */ @@ -394,9 +393,6 @@ ufoma_attach(device_t dev) device_set_usb_desc(dev); - snprintf(sc->sc_name, sizeof(sc->sc_name), - "%s", device_get_nameunit(dev)); - DPRINTF("\n"); /* setup control transfers */ Modified: head/sys/dev/usb/serial/uftdi.c ============================================================================== --- head/sys/dev/usb/serial/uftdi.c Fri Aug 10 15:29:41 2012 (r239180) +++ head/sys/dev/usb/serial/uftdi.c Fri Aug 10 17:42:14 2012 (r239181) @@ -110,8 +110,6 @@ struct uftdi_softc { uint8_t sc_hdrlen; uint8_t sc_msr; uint8_t sc_lsr; - - uint8_t sc_name[16]; }; struct uftdi_param_config { @@ -890,9 +888,6 @@ uftdi_attach(device_t dev) mtx_init(&sc->sc_mtx, "uftdi", NULL, MTX_DEF); ucom_ref(&sc->sc_super_ucom); - snprintf(sc->sc_name, sizeof(sc->sc_name), - "%s", device_get_nameunit(dev)); - DPRINTF("\n"); sc->sc_iface_index = uaa->info.bIfaceIndex; Modified: head/sys/dev/usb/serial/umct.c ============================================================================== --- head/sys/dev/usb/serial/umct.c Fri Aug 10 15:29:41 2012 (r239180) +++ head/sys/dev/usb/serial/umct.c Fri Aug 10 17:42:14 2012 (r239181) @@ -115,7 +115,6 @@ struct umct_softc { uint8_t sc_mcr; uint8_t sc_iface_no; uint8_t sc_swap_cb; - uint8_t sc_name[16]; }; /* prototypes */ @@ -257,9 +256,6 @@ umct_attach(device_t dev) mtx_init(&sc->sc_mtx, "umct", NULL, MTX_DEF); ucom_ref(&sc->sc_super_ucom); - snprintf(sc->sc_name, sizeof(sc->sc_name), - "%s", device_get_nameunit(dev)); - sc->sc_iface_no = uaa->info.bIfaceNum; iface_index = UMCT_IFACE_INDEX; From owner-svn-src-head@FreeBSD.ORG Fri Aug 10 17:43:21 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 470E9106566C; Fri, 10 Aug 2012 17:43:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 323F08FC17; Fri, 10 Aug 2012 17:43: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 q7AHhLWI059698; Fri, 10 Aug 2012 17:43:21 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7AHhKPk059696; Fri, 10 Aug 2012 17:43:20 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201208101743.q7AHhKPk059696@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 10 Aug 2012 17:43:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239182 - head/sys/dev/usb/serial X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Aug 2012 17:43:21 -0000 Author: hselasky Date: Fri Aug 10 17:43:20 2012 New Revision: 239182 URL: http://svn.freebsd.org/changeset/base/239182 Log: Style. MFC after: 2 weeks Modified: head/sys/dev/usb/serial/u3g.c Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Fri Aug 10 17:42:14 2012 (r239181) +++ head/sys/dev/usb/serial/u3g.c Fri Aug 10 17:43:20 2012 (r239182) @@ -928,7 +928,6 @@ u3g_start_read(struct ucom_softc *ucom) /* start read endpoint */ usbd_transfer_start(sc->sc_xfer[ucom->sc_subunit][U3G_BULK_RD]); - return; } static void @@ -938,7 +937,6 @@ u3g_stop_read(struct ucom_softc *ucom) /* stop read endpoint */ usbd_transfer_stop(sc->sc_xfer[ucom->sc_subunit][U3G_BULK_RD]); - return; } static void @@ -947,7 +945,6 @@ u3g_start_write(struct ucom_softc *ucom) struct u3g_softc *sc = ucom->sc_parent; usbd_transfer_start(sc->sc_xfer[ucom->sc_subunit][U3G_BULK_WR]); - return; } static void @@ -956,7 +953,6 @@ u3g_stop_write(struct ucom_softc *ucom) struct u3g_softc *sc = ucom->sc_parent; usbd_transfer_stop(sc->sc_xfer[ucom->sc_subunit][U3G_BULK_WR]); - return; } static void @@ -985,7 +981,6 @@ tr_setup: } break; } - return; } static void @@ -1016,5 +1011,4 @@ tr_setup: } break; } - return; } From owner-svn-src-head@FreeBSD.ORG Fri Aug 10 18:19:57 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C6C6C106566C; Fri, 10 Aug 2012 18:19:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B1E168FC0A; Fri, 10 Aug 2012 18:19: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 q7AIJv0U063025; Fri, 10 Aug 2012 18:19:57 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7AIJvHJ063023; Fri, 10 Aug 2012 18:19:57 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201208101819.q7AIJvHJ063023@svn.freebsd.org> From: Alexander Motin Date: Fri, 10 Aug 2012 18:19:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239183 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Aug 2012 18:19:57 -0000 Author: mav Date: Fri Aug 10 18:19:57 2012 New Revision: 239183 URL: http://svn.freebsd.org/changeset/base/239183 Log: sched_rr_interval() seems always returned period in hz ticks, but same always it was used as rate. Fix use side units to period in hz ticks. Modified: head/sys/kern/ksched.c Modified: head/sys/kern/ksched.c ============================================================================== --- head/sys/kern/ksched.c Fri Aug 10 17:43:20 2012 (r239182) +++ head/sys/kern/ksched.c Fri Aug 10 18:19:57 2012 (r239183) @@ -64,7 +64,7 @@ ksched_attach(struct ksched **p) struct ksched *ksched= p31b_malloc(sizeof(*ksched)); ksched->rr_interval.tv_sec = 0; - ksched->rr_interval.tv_nsec = 1000000000L / sched_rr_interval(); + ksched->rr_interval.tv_nsec = 1000000000L / hz * sched_rr_interval(); *p = ksched; return 0; From owner-svn-src-head@FreeBSD.ORG Fri Aug 10 18:43:30 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5F95A106566B; Fri, 10 Aug 2012 18:43:30 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3182D8FC14; Fri, 10 Aug 2012 18:43:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7AIhUDB065016; Fri, 10 Aug 2012 18:43:30 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7AIhT6g065014; Fri, 10 Aug 2012 18:43:29 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201208101843.q7AIhT6g065014@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 10 Aug 2012 18:43:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239184 - head/sys/geom/eli X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Aug 2012 18:43:30 -0000 Author: pjd Date: Fri Aug 10 18:43:29 2012 New Revision: 239184 URL: http://svn.freebsd.org/changeset/base/239184 Log: Always initialize sc_ekey, because as of r238116 it is always used. If GELI provider was created on FreeBSD HEAD r238116 or later (but before this change), it is using very weak keys and the data is not protected. The bug was introduced on 4th July 2012. One can verify if its provider was created with weak keys by running: # geli dump | grep version If the version is 7 and the system didn't include this fix when provider was initialized, then the data has to be backed up, underlying provider overwritten with random data, system upgraded and provider recreated. Reported by: Fabian Keil Tested by: Fabian Keil Discussed with: so MFC after: 3 days Modified: head/sys/geom/eli/g_eli_key_cache.c Modified: head/sys/geom/eli/g_eli_key_cache.c ============================================================================== --- head/sys/geom/eli/g_eli_key_cache.c Fri Aug 10 18:19:57 2012 (r239183) +++ head/sys/geom/eli/g_eli_key_cache.c Fri Aug 10 18:43:29 2012 (r239184) @@ -193,24 +193,24 @@ g_eli_key_remove(struct g_eli_softc *sc, void g_eli_key_init(struct g_eli_softc *sc) { + uint8_t *mkey; mtx_lock(&sc->sc_ekeys_lock); - if ((sc->sc_flags & G_ELI_FLAG_SINGLE_KEY) != 0) { - uint8_t *mkey; - mkey = sc->sc_mkey + sizeof(sc->sc_ivkey); + mkey = sc->sc_mkey + sizeof(sc->sc_ivkey); + if ((sc->sc_flags & G_ELI_FLAG_AUTH) == 0) + bcopy(mkey, sc->sc_ekey, G_ELI_DATAKEYLEN); + else { + /* + * The encryption key is: ekey = HMAC_SHA512(Data-Key, 0x10) + */ + g_eli_crypto_hmac(mkey, G_ELI_MAXKEYLEN, "\x10", 1, + sc->sc_ekey, 0); + } + if ((sc->sc_flags & G_ELI_FLAG_SINGLE_KEY) != 0) { sc->sc_ekeys_total = 1; sc->sc_ekeys_allocated = 0; - if ((sc->sc_flags & G_ELI_FLAG_AUTH) == 0) - bcopy(mkey, sc->sc_ekey, G_ELI_DATAKEYLEN); - else { - /* - * The encryption key is: ekey = HMAC_SHA512(Data-Key, 0x10) - */ - g_eli_crypto_hmac(mkey, G_ELI_MAXKEYLEN, "\x10", 1, - sc->sc_ekey, 0); - } } else { off_t mediasize; size_t blocksize; @@ -241,6 +241,7 @@ g_eli_key_init(struct g_eli_softc *sc) (uintmax_t)sc->sc_ekeys_allocated)); } } + mtx_unlock(&sc->sc_ekeys_lock); } From owner-svn-src-head@FreeBSD.ORG Fri Aug 10 19:02:51 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8619C106566B; Fri, 10 Aug 2012 19:02:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 703E68FC18; Fri, 10 Aug 2012 19:02: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 q7AJ2oM2066768; Fri, 10 Aug 2012 19:02:50 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7AJ2omU066764; Fri, 10 Aug 2012 19:02:50 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201208101902.q7AJ2omU066764@svn.freebsd.org> From: Alexander Motin Date: Fri, 10 Aug 2012 19:02:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239185 - in head: share/man/man4 sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Aug 2012 19:02:51 -0000 Author: mav Date: Fri Aug 10 19:02:49 2012 New Revision: 239185 URL: http://svn.freebsd.org/changeset/base/239185 Log: Some minor tunings/cleanups inspired by bde@ after previous commits: - remove extra dynamic variable initializations; - restore (4BSD) and implement (ULE) hogticks variable setting; - make sched_rr_interval() more tolerant to options; - restore (4BSD) and implement (ULE) kern.sched.quantum sysctl, a more user-friendly wrapper for sched_slice; - tune some sysctl descriptions; - make some style fixes. Modified: head/share/man/man4/sched_ule.4 head/sys/kern/sched_4bsd.c head/sys/kern/sched_ule.c Modified: head/share/man/man4/sched_ule.4 ============================================================================== --- head/share/man/man4/sched_ule.4 Fri Aug 10 18:43:29 2012 (r239184) +++ head/share/man/man4/sched_ule.4 Fri Aug 10 19:02:49 2012 (r239185) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 21, 2008 +.Dd August 10, 2012 .Dt SCHED_ULE 4 .Os .Sh NAME @@ -59,6 +59,9 @@ The following sysctls are relevant to th .Bl -tag -width indent .It Va kern.sched.name This read-only sysctl reports the name of the active scheduler. +.It Va kern.sched.quantum +This read-write sysctl reports or sets the length of the quantum (in +micro-seconds) granted to a thread. .El .Sh SEE ALSO .Xr sched_4bsd 4 , Modified: head/sys/kern/sched_4bsd.c ============================================================================== --- head/sys/kern/sched_4bsd.c Fri Aug 10 18:43:29 2012 (r239184) +++ head/sys/kern/sched_4bsd.c Fri Aug 10 19:02:49 2012 (r239185) @@ -119,9 +119,9 @@ struct td_sched { static struct td_sched td_sched0; struct mtx sched_lock; -static int realstathz; /* stathz is sometimes 0 and run off of hz. */ +static int realstathz = 127; /* stathz is sometimes 0 and run off of hz. */ static int sched_tdcnt; /* Total runnable threads in the system. */ -static int sched_slice = 1; /* Thread run time before rescheduling. */ +static int sched_slice = 12; /* Thread run time before rescheduling. */ static void setup_runqs(void); static void schedcpu(void); @@ -185,12 +185,32 @@ setup_runqs(void) runq_init(&runq); } +static int +sysctl_kern_quantum(SYSCTL_HANDLER_ARGS) +{ + int error, new_val, period; + + period = 1000000 / realstathz; + new_val = period * sched_slice; + error = sysctl_handle_int(oidp, &new_val, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + if (new_val <= 0) + return (EINVAL); + sched_slice = max(1, (new_val + period / 2) / period); + hogticks = max(1, 2 * hz * sched_slice / realstathz); + return (0); +} + SYSCTL_NODE(_kern, OID_AUTO, sched, CTLFLAG_RD, 0, "Scheduler"); SYSCTL_STRING(_kern_sched, OID_AUTO, name, CTLFLAG_RD, "4BSD", 0, "Scheduler name"); +SYSCTL_PROC(_kern_sched, OID_AUTO, quantum, CTLTYPE_INT | CTLFLAG_RW, + NULL, 0, sysctl_kern_quantum, "I", + "Length of time granted to timeshare threads in microseconds"); SYSCTL_INT(_kern_sched, OID_AUTO, slice, CTLFLAG_RW, &sched_slice, 0, - "Slice size for timeshare threads"); + "Length of time granted to timeshare threads in stathz ticks"); #ifdef SMP /* Enable forwarding of wakeups to all other cpus */ static SYSCTL_NODE(_kern_sched, OID_AUTO, ipiwakeup, CTLFLAG_RD, NULL, @@ -629,21 +649,15 @@ resetpriority_thread(struct thread *td) static void sched_setup(void *dummy) { - setup_runqs(); - /* - * To avoid divide-by-zero, we set realstathz a dummy value - * in case which sched_clock() called before sched_initticks(). - */ - realstathz = hz; - sched_slice = realstathz / 10; /* ~100ms */ + setup_runqs(); /* Account for thread0. */ sched_load_add(); } /* - * This routine determines the sched_slice after stathz and hz are setup. + * This routine determines time constants after stathz and hz are setup. */ static void sched_initticks(void *dummy) @@ -651,6 +665,7 @@ sched_initticks(void *dummy) realstathz = stathz ? stathz : hz; sched_slice = realstathz / 10; /* ~100ms */ + hogticks = max(1, 2 * hz * sched_slice / realstathz); } /* External interfaces start here */ @@ -689,7 +704,7 @@ sched_rr_interval(void) { /* Convert sched_slice from stathz to hz. */ - return (hz / (realstathz / sched_slice)); + return (max(1, (sched_slice * hz + realstathz / 2) / realstathz)); } /* @@ -724,9 +739,9 @@ sched_clock(struct thread *td) /* * Force a context switch if the current thread has used up a full - * quantum (default quantum is 100ms). + * time slice (default is 100ms). */ - if (!TD_IS_IDLETHREAD(td) && (--ts->ts_slice <= 0)) { + if (!TD_IS_IDLETHREAD(td) && --ts->ts_slice <= 0) { ts->ts_slice = sched_slice; td->td_flags |= TDF_NEEDRESCHED | TDF_SLICEEND; } Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Fri Aug 10 18:43:29 2012 (r239184) +++ head/sys/kern/sched_ule.c Fri Aug 10 19:02:49 2012 (r239185) @@ -201,9 +201,9 @@ static struct td_sched td_sched0; * preempt_thresh: Priority threshold for preemption and remote IPIs. */ static int sched_interact = SCHED_INTERACT_THRESH; -static int realstathz; -static int tickincr; -static int sched_slice = 1; +static int realstathz = 127; +static int tickincr = 8 << SCHED_TICK_SHIFT;; +static int sched_slice = 12; #ifdef PREEMPTION #ifdef FULL_PREEMPTION static int preempt_thresh = PRI_MAX_IDLE; @@ -1363,13 +1363,6 @@ sched_setup(void *dummy) #else tdq_setup(tdq); #endif - /* - * To avoid divide-by-zero, we set realstathz a dummy value - * in case which sched_clock() called before sched_initticks(). - */ - realstathz = hz; - sched_slice = (realstathz/10); /* ~100ms */ - tickincr = 1 << SCHED_TICK_SHIFT; /* Add thread0's load since it's running. */ TDQ_LOCK(tdq); @@ -1380,7 +1373,7 @@ sched_setup(void *dummy) } /* - * This routine determines the tickincr after stathz and hz are setup. + * This routine determines time constants after stathz and hz are setup. */ /* ARGSUSED */ static void @@ -1389,7 +1382,8 @@ sched_initticks(void *dummy) int incr; realstathz = stathz ? stathz : hz; - sched_slice = (realstathz/10); /* ~100ms */ + sched_slice = realstathz / 10; /* ~100ms */ + hogticks = max(1, 2 * hz * sched_slice / realstathz); /* * tickincr is shifted out by 10 to avoid rounding errors due to @@ -1606,8 +1600,8 @@ int sched_rr_interval(void) { - /* Convert sched_slice to hz */ - return (hz/(realstathz/sched_slice)); + /* Convert sched_slice from stathz to hz. */ + return (max(1, (sched_slice * hz + realstathz / 2) / realstathz)); } /* @@ -2231,16 +2225,15 @@ sched_clock(struct thread *td) sched_interact_update(td); sched_priority(td); } + /* - * We used up one time slice. - */ - if (--ts->ts_slice > 0) - return; - /* - * We're out of time, force a requeue at userret(). + * Force a context switch if the current thread has used up a full + * time slice (default is 100ms). */ - ts->ts_slice = sched_slice; - td->td_flags |= TDF_NEEDRESCHED | TDF_SLICEEND; + if (!TD_IS_IDLETHREAD(td) && --ts->ts_slice <= 0) { + ts->ts_slice = sched_slice; + td->td_flags |= TDF_NEEDRESCHED | TDF_SLICEEND; + } } /* @@ -2795,11 +2788,31 @@ sysctl_kern_sched_topology_spec(SYSCTL_H #endif +static int +sysctl_kern_quantum(SYSCTL_HANDLER_ARGS) +{ + int error, new_val, period; + + period = 1000000 / realstathz; + new_val = period * sched_slice; + error = sysctl_handle_int(oidp, &new_val, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + if (new_val <= 0) + return (EINVAL); + sched_slice = max(1, (new_val + period / 2) / period); + hogticks = max(1, 2 * hz * sched_slice / realstathz); + return (0); +} + SYSCTL_NODE(_kern, OID_AUTO, sched, CTLFLAG_RW, 0, "Scheduler"); SYSCTL_STRING(_kern_sched, OID_AUTO, name, CTLFLAG_RD, "ULE", 0, "Scheduler name"); +SYSCTL_PROC(_kern_sched, OID_AUTO, quantum, CTLTYPE_INT | CTLFLAG_RW, + NULL, 0, sysctl_kern_quantum, "I", + "Length of time granted to timeshare threads in microseconds"); SYSCTL_INT(_kern_sched, OID_AUTO, slice, CTLFLAG_RW, &sched_slice, 0, - "Slice size for timeshare threads"); + "Length of time granted to timeshare threads in stathz ticks"); SYSCTL_INT(_kern_sched, OID_AUTO, interact, CTLFLAG_RW, &sched_interact, 0, "Interactivity score threshold"); SYSCTL_INT(_kern_sched, OID_AUTO, preempt_thresh, CTLFLAG_RW, &preempt_thresh, @@ -2807,9 +2820,9 @@ SYSCTL_INT(_kern_sched, OID_AUTO, preemp SYSCTL_INT(_kern_sched, OID_AUTO, static_boost, CTLFLAG_RW, &static_boost, 0,"Controls whether static kernel priorities are assigned to sleeping threads."); SYSCTL_INT(_kern_sched, OID_AUTO, idlespins, CTLFLAG_RW, &sched_idlespins, - 0,"Number of times idle will spin waiting for new work."); + 0,"Number of times idle thread will spin waiting for new work."); SYSCTL_INT(_kern_sched, OID_AUTO, idlespinthresh, CTLFLAG_RW, &sched_idlespinthresh, - 0,"Threshold before we will permit idle spinning."); + 0,"Threshold before we will permit idle thread spinning."); #ifdef SMP SYSCTL_INT(_kern_sched, OID_AUTO, affinity, CTLFLAG_RW, &affinity, 0, "Number of hz ticks to keep thread affinity for"); @@ -2817,17 +2830,14 @@ SYSCTL_INT(_kern_sched, OID_AUTO, balanc "Enables the long-term load balancer"); SYSCTL_INT(_kern_sched, OID_AUTO, balance_interval, CTLFLAG_RW, &balance_interval, 0, - "Average frequency in stathz ticks to run the long-term balancer"); + "Average period in stathz ticks to run the long-term balancer"); SYSCTL_INT(_kern_sched, OID_AUTO, steal_idle, CTLFLAG_RW, &steal_idle, 0, "Attempts to steal work from other cores before idling"); SYSCTL_INT(_kern_sched, OID_AUTO, steal_thresh, CTLFLAG_RW, &steal_thresh, 0, "Minimum load on remote cpu before we'll steal"); - -/* Retrieve SMP topology */ SYSCTL_PROC(_kern_sched, OID_AUTO, topology_spec, CTLTYPE_STRING | - CTLFLAG_RD, NULL, 0, sysctl_kern_sched_topology_spec, "A", + CTLFLAG_RD, NULL, 0, sysctl_kern_sched_topology_spec, "A", "XML dump of detected CPU topology"); - #endif /* ps compat. All cpu percentages from ULE are weighted. */ From owner-svn-src-head@FreeBSD.ORG Sat Aug 11 00:06:57 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3E10B106566B; Sat, 11 Aug 2012 00:06:57 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 28F638FC08; Sat, 11 Aug 2012 00:06: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 q7B06vsc092726; Sat, 11 Aug 2012 00:06:57 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7B06uPR092724; Sat, 11 Aug 2012 00:06:56 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201208110006.q7B06uPR092724@svn.freebsd.org> From: David Xu Date: Sat, 11 Aug 2012 00:06:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239187 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2012 00:06:57 -0000 Author: davidxu Date: Sat Aug 11 00:06:56 2012 New Revision: 239187 URL: http://svn.freebsd.org/changeset/base/239187 Log: tvtohz will print out an error message if a negative value is given to it, avoid this problem by detecting timeout earlier. Reported by: pho Modified: head/sys/kern/kern_umtx.c Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Fri Aug 10 21:11:00 2012 (r239186) +++ head/sys/kern/kern_umtx.c Sat Aug 11 00:06:56 2012 (r239187) @@ -587,11 +587,10 @@ abs_timeout_init2(struct abs_timeout *ti &umtxtime->_timeout); } -static int +static void abs_timeout_update(struct abs_timeout *timo) { kern_clock_gettime(curthread, timo->clockid, &timo->cur); - return (timespeccmp(&timo->cur, &timo->end, >=)); } static int @@ -601,6 +600,8 @@ abs_timeout_gethz(struct abs_timeout *ti tts = timo->end; timespecsub(&tts, &timo->cur); + if (tts.tv_sec < 0 || (tts.tv_sec == 0 && tts.tv_nsec == 0)) + return (-1); return (tstohz(&tts)); } @@ -613,22 +614,25 @@ umtxq_sleep(struct umtx_q *uq, const cha { struct umtxq_chain *uc; int error; + int pulse; uc = umtxq_getchain(&uq->uq_key); UMTXQ_LOCKED_ASSERT(uc); for (;;) { if (!(uq->uq_flags & UQF_UMTXQ)) return (0); - error = msleep(uq, &uc->uc_lock, PCATCH, wmesg, - timo == NULL ? 0 : abs_timeout_gethz(timo)); - if (error != EWOULDBLOCK) - break; - umtxq_unlock(&uq->uq_key); - if (abs_timeout_update(timo)) { - error = ETIMEDOUT; + if (timo != NULL) { + pulse = abs_timeout_gethz(timo); + if (pulse < 0) + return (ETIMEDOUT); + } else + pulse = 0; + error = msleep(uq, &uc->uc_lock, PCATCH|PDROP, wmesg, pulse); + if (error != EWOULDBLOCK) { umtxq_lock(&uq->uq_key); break; } + abs_timeout_update(timo); umtxq_lock(&uq->uq_key); } return (error); From owner-svn-src-head@FreeBSD.ORG Sat Aug 11 05:03:31 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 167E3106566C; Sat, 11 Aug 2012 05:03:31 +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 DBC158FC0C; Sat, 11 Aug 2012 05:03:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7B53Uun017383; Sat, 11 Aug 2012 05:03:30 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7B53UvN017381; Sat, 11 Aug 2012 05:03:30 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201208110503.q7B53UvN017381@svn.freebsd.org> From: Warner Losh Date: Sat, 11 Aug 2012 05:03:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239188 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2012 05:03:31 -0000 Author: imp Date: Sat Aug 11 05:03:30 2012 New Revision: 239188 URL: http://svn.freebsd.org/changeset/base/239188 Log: Don't use C++ comments. Modified: head/sys/arm/at91/at91_pmc.c Modified: head/sys/arm/at91/at91_pmc.c ============================================================================== --- head/sys/arm/at91/at91_pmc.c Sat Aug 11 00:06:56 2012 (r239187) +++ head/sys/arm/at91/at91_pmc.c Sat Aug 11 05:03:30 2012 (r239188) @@ -71,7 +71,7 @@ static void at91_pmc_set_periph_mode(str static void at91_pmc_clock_alias(const char *name, const char *alias); static struct at91_pmc_clock slck = { - .name = "slck", // 32,768 Hz slow clock + .name = "slck", /* 32,768 Hz slow clock */ .hz = 32768, .refcnt = 1, .id = 0, @@ -83,7 +83,7 @@ static struct at91_pmc_clock slck = { * are now created automatically. Only "system" clocks need be defined here. */ static struct at91_pmc_clock main_ck = { - .name = "main", // Main clock + .name = "main", /* Main clock */ .refcnt = 0, .id = 1, .primary = 1, @@ -91,7 +91,7 @@ static struct at91_pmc_clock main_ck = { }; static struct at91_pmc_clock plla = { - .name = "plla", // PLLA Clock, used for CPU clocking + .name = "plla", /* PLLA Clock, used for CPU clocking */ .parent = &main_ck, .refcnt = 1, .id = 0, @@ -101,7 +101,7 @@ static struct at91_pmc_clock plla = { }; static struct at91_pmc_clock pllb = { - .name = "pllb", // PLLB Clock, used for USB functions + .name = "pllb", /* PLLB Clock, used for USB functions */ .parent = &main_ck, .refcnt = 0, .id = 0, @@ -113,7 +113,7 @@ static struct at91_pmc_clock pllb = { /* Used by USB on at91sam9g45 */ static struct at91_pmc_clock upll = { - .name = "upll", // UTMI PLL, used for USB functions on 9G45 + .name = "upll", /* UTMI PLL, used for USB functions on 9G45 family */ .parent = &main_ck, .refcnt = 0, .id = 0, @@ -138,13 +138,13 @@ static struct at91_pmc_clock uhpck = { }; static struct at91_pmc_clock mck = { - .name = "mck", // Master (Peripheral) Clock + .name = "mck", /* Master (Peripheral) Clock */ .pmc_mask = PMC_IER_MCKRDY, .refcnt = 0, }; static struct at91_pmc_clock cpu = { - .name = "cpu", // CPU Clock + .name = "cpu", /* CPU Clock */ .parent = &plla, .pmc_mask = PMC_SCER_PCK, .refcnt = 0, @@ -329,7 +329,6 @@ at91_pmc_clock_ref(const char *name) return (clock_list[i]); } - //printf("at91_pmc: Warning - did not find clock '%s'", name); return (NULL); } @@ -510,9 +509,11 @@ at91_pmc_init_clock(void) mckr = RD4(sc, PMC_MCKR); main_ck.hz = main_clock; - // Note: this means outa calc code for plla never used since - // we never change it. If we did, we'd also have to mind - // ICPLLA to get the charge pump current right. + /* + * Note: this means outa calc code for plla never used since + * we never change it. If we did, we'd also have to mind + * ICPLLA to get the charge pump current right. + */ at91_pmc_pll_rate(&plla, RD4(sc, CKGR_PLLAR)); if (at91_cpu_is(AT91_T_SAM9G45) && (mckr & PMC_MCKR_PLLADIV2)) From owner-svn-src-head@FreeBSD.ORG Sat Aug 11 05:12:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D0AC3106566B; Sat, 11 Aug 2012 05:12:46 +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 BCAC88FC12; Sat, 11 Aug 2012 05:12:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7B5Ck1Z018160; Sat, 11 Aug 2012 05:12:46 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7B5Ck3r018158; Sat, 11 Aug 2012 05:12:46 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201208110512.q7B5Ck3r018158@svn.freebsd.org> From: Warner Losh Date: Sat, 11 Aug 2012 05:12:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239189 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2012 05:12:46 -0000 Author: imp Date: Sat Aug 11 05:12:46 2012 New Revision: 239189 URL: http://svn.freebsd.org/changeset/base/239189 Log: Update comments about setting PLLA and refernce the tables in the datasheet that express the limits. Modified: head/sys/arm/at91/at91sam9260.c Modified: head/sys/arm/at91/at91sam9260.c ============================================================================== --- head/sys/arm/at91/at91sam9260.c Sat Aug 11 05:03:30 2012 (r239188) +++ head/sys/arm/at91/at91sam9260.c Sat Aug 11 05:12:46 2012 (r239189) @@ -122,21 +122,30 @@ static const struct cpu_devs at91_devs[] { 0, 0, 0, 0, 0 } }; +/* + * The following is unused currently since we don't ever set the PLLA + * frequency of the device. + */ static uint32_t at91_pll_outa(int freq) { + uint32_t outa = 0; - if (freq > 195000000) - return (0x20000000); - else - return (0x20008000); + /* + * Set OUTA, per the data sheet. See Table 40-15 titled + * PLLA Characteristics in the SAM9260 doc. + */ + + if (freq > 155000000) + outa = 2 << 14; + return ((1 << 29) | outa); } static uint32_t at91_pll_outb(int freq) { - return (0x4000); + return (1 << 14); } static void @@ -173,7 +182,7 @@ at91_clock_init(void) * to be near the optimal 2 MHz per datasheet. We know * we are going to be using this for the USB clock at 96 MHz. * Causes no extra frequency deviation for all recomended crystal - * values. + * values. See Note 1, table 40-16 SAM9260 doc. */ clk = at91_pmc_clock_ref("pllb"); clk->pll_min_in = SAM9260_PLL_B_MIN_IN_FREQ; /* 1 MHz */ From owner-svn-src-head@FreeBSD.ORG Sat Aug 11 05:45:20 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 305DA106564A; Sat, 11 Aug 2012 05:45:20 +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 1ABC58FC14; Sat, 11 Aug 2012 05:45:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7B5jJpG021086; Sat, 11 Aug 2012 05:45:19 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7B5jJRd021080; Sat, 11 Aug 2012 05:45:19 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201208110545.q7B5jJRd021080@svn.freebsd.org> From: Warner Losh Date: Sat, 11 Aug 2012 05:45:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239190 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2012 05:45:20 -0000 Author: imp Date: Sat Aug 11 05:45:19 2012 New Revision: 239190 URL: http://svn.freebsd.org/changeset/base/239190 Log: Correct the PLLA setting functions and centralize. Modified: head/sys/arm/at91/at91_pmc.c head/sys/arm/at91/at91_pmcvar.h head/sys/arm/at91/at91sam9g20.c head/sys/arm/at91/at91sam9g45.c head/sys/arm/at91/at91sam9x5.c Modified: head/sys/arm/at91/at91_pmc.c ============================================================================== --- head/sys/arm/at91/at91_pmc.c Sat Aug 11 05:12:46 2012 (r239189) +++ head/sys/arm/at91/at91_pmc.c Sat Aug 11 05:45:19 2012 (r239190) @@ -187,6 +187,40 @@ WR4(struct at91_pmc_softc *sc, bus_size_ bus_write_4(sc->mem_res, off, val); } +/* + * The following is unused currently since we don't ever set the PLLA + * frequency of the device. If we did, we'd have to also pay attention + * to the ICPLLA bit in the PMC_PLLICPR register for frequencies lower + * than ~600MHz, which the PMC code doesn't do right now. + */ +uint32_t +at91_pmc_800mhz_plla_outb(int freq) +{ + uint32_t outa; + + /* + * Set OUTA, per the data sheet. See Table 46-16 titled + * PLLA Frequency Regarding ICPLLA and OUTA in the SAM9X25 doc, + * Table 46-17 in the SAM9G20 doc, or Table 46-16 in the SAM9G45 doc. + * Note: the frequencies overlap by 5MHz, so we add 3 here to + * center shoot the transition. + */ + + freq /= 1000000; /* MHz */ + if (freq >= 800) + freq = 800; + freq += 3; /* Allow for overlap. */ + outa = 3 - ((freq / 50) & 3); /* 750 / 50 = 7, see table */ + return (1 << 29)| (outa << 14); +} + +uint32_t +at91_pmc_800mhz_pllb_outb(int freq) +{ + + return (0); +} + void at91_pmc_set_pllb_mode(struct at91_pmc_clock *clk, int on) { Modified: head/sys/arm/at91/at91_pmcvar.h ============================================================================== --- head/sys/arm/at91/at91_pmcvar.h Sat Aug 11 05:12:46 2012 (r239189) +++ head/sys/arm/at91/at91_pmcvar.h Sat Aug 11 05:45:19 2012 (r239190) @@ -62,4 +62,6 @@ void at91_pmc_clock_deref(struct at91_pm void at91_pmc_clock_enable(struct at91_pmc_clock *); void at91_pmc_clock_disable(struct at91_pmc_clock *); +uint32_t at91_pmc_800mhz_plla_outb(int freq); +uint32_t at91_pmc_800mhz_pllb_outb(int freq); #endif /* ARM_AT91_AT91_PMCVAR_H */ Modified: head/sys/arm/at91/at91sam9g20.c ============================================================================== --- head/sys/arm/at91/at91sam9g20.c Sat Aug 11 05:12:46 2012 (r239189) +++ head/sys/arm/at91/at91sam9g20.c Sat Aug 11 05:45:19 2012 (r239190) @@ -122,30 +122,6 @@ static const struct cpu_devs at91_devs[] { 0, 0, 0, 0, 0 } }; -static uint32_t -at91_pll_outa(int freq) -{ - - switch (freq / 10000000) { - case 747 ... 801: return ((1 << 29) | (0 << 14)); - case 697 ... 746: return ((1 << 29) | (1 << 14)); - case 647 ... 696: return ((1 << 29) | (2 << 14)); - case 597 ... 646: return ((1 << 29) | (3 << 14)); - case 547 ... 596: return ((1 << 29) | (1 << 14)); - case 497 ... 546: return ((1 << 29) | (2 << 14)); - case 447 ... 496: return ((1 << 29) | (3 << 14)); - case 397 ... 446: return ((1 << 29) | (4 << 14)); - default: return (1 << 29); - } -} - -static uint32_t -at91_pll_outb(int freq) -{ - - return (0); -} - static void at91_clock_init(void) { @@ -171,7 +147,7 @@ at91_clock_init(void) clk->pll_mul_mask = SAM9G20_PLL_A_MUL_MASK; clk->pll_div_shift = SAM9G20_PLL_A_DIV_SHIFT; clk->pll_div_mask = SAM9G20_PLL_A_DIV_MASK; - clk->set_outb = at91_pll_outa; + clk->set_outb = at91_pmc_800mhz_plla_outb; at91_pmc_clock_deref(clk); clk = at91_pmc_clock_ref("pllb"); @@ -183,7 +159,7 @@ at91_clock_init(void) clk->pll_mul_mask = SAM9G20_PLL_B_MUL_MASK; clk->pll_div_shift = SAM9G20_PLL_B_DIV_SHIFT; clk->pll_div_mask = SAM9G20_PLL_B_DIV_MASK; - clk->set_outb = at91_pll_outb; + clk->set_outb = at91_pmc_800mhz_pllb_outb; at91_pmc_clock_deref(clk); } Modified: head/sys/arm/at91/at91sam9g45.c ============================================================================== --- head/sys/arm/at91/at91sam9g45.c Sat Aug 11 05:12:46 2012 (r239189) +++ head/sys/arm/at91/at91sam9g45.c Sat Aug 11 05:45:19 2012 (r239190) @@ -125,23 +125,6 @@ static const struct cpu_devs at91_devs[] { 0, 0, 0, 0, 0 } }; -static uint32_t -at91_pll_outa(int freq) -{ - - switch (freq / 10000000) { - case 747 ... 801: return ((1 << 29) | (0 << 14)); - case 697 ... 746: return ((1 << 29) | (1 << 14)); - case 647 ... 696: return ((1 << 29) | (2 << 14)); - case 597 ... 646: return ((1 << 29) | (3 << 14)); - case 547 ... 596: return ((1 << 29) | (4 << 14)); - case 497 ... 546: return ((1 << 29) | (5 << 14)); - case 447 ... 496: return ((1 << 29) | (6 << 14)); - case 397 ... 446: return ((1 << 29) | (7 << 14)); - default: return (1 << 29); - } -} - static void at91_clock_init(void) { @@ -162,7 +145,7 @@ at91_clock_init(void) clk->pll_mul_mask = SAM9G45_PLL_A_MUL_MASK; clk->pll_div_shift = SAM9G45_PLL_A_DIV_SHIFT; clk->pll_div_mask = SAM9G45_PLL_A_DIV_MASK; - clk->set_outb = at91_pll_outa; + clk->set_outb = at91_pmc_800mhz_plla_outb; at91_pmc_clock_deref(clk); } Modified: head/sys/arm/at91/at91sam9x5.c ============================================================================== --- head/sys/arm/at91/at91sam9x5.c Sat Aug 11 05:12:46 2012 (r239189) +++ head/sys/arm/at91/at91sam9x5.c Sat Aug 11 05:45:19 2012 (r239190) @@ -125,30 +125,6 @@ static const struct cpu_devs at91_devs[] { 0, 0, 0, 0, 0 } }; -static uint32_t -at91_pll_outa(int freq) -{ - - switch (freq / 10000000) { - case 747 ... 801: return ((1 << 29) | (0 << 14)); - case 697 ... 746: return ((1 << 29) | (1 << 14)); - case 647 ... 696: return ((1 << 29) | (2 << 14)); - case 597 ... 646: return ((1 << 29) | (3 << 14)); - case 547 ... 596: return ((1 << 29) | (1 << 14)); - case 497 ... 546: return ((1 << 29) | (2 << 14)); - case 447 ... 496: return ((1 << 29) | (3 << 14)); - case 397 ... 446: return ((1 << 29) | (4 << 14)); - default: return (1 << 29); - } -} - -static uint32_t -at91_pll_outb(int freq) -{ - - return (0); -} - static void at91_clock_init(void) { @@ -174,7 +150,7 @@ at91_clock_init(void) clk->pll_mul_mask = SAM9X25_PLL_A_MUL_MASK; clk->pll_div_shift = SAM9X25_PLL_A_DIV_SHIFT; clk->pll_div_mask = SAM9X25_PLL_A_DIV_MASK; - clk->set_outb = at91_pll_outa; + clk->set_outb = at91_pmc_800mhz_plla_outb; at91_pmc_clock_deref(clk); clk = at91_pmc_clock_ref("pllb"); @@ -186,7 +162,7 @@ at91_clock_init(void) clk->pll_mul_mask = SAM9X25_PLL_B_MUL_MASK; clk->pll_div_shift = SAM9X25_PLL_B_DIV_SHIFT; clk->pll_div_mask = SAM9X25_PLL_B_DIV_MASK; - clk->set_outb = at91_pll_outb; + clk->set_outb = at91_pmc_800mhz_pllb_outb; at91_pmc_clock_deref(clk); } From owner-svn-src-head@FreeBSD.ORG Sat Aug 11 05:58:56 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6EEE106566B; Sat, 11 Aug 2012 05:58:56 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B1C098FC08; Sat, 11 Aug 2012 05:58: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 q7B5wukl022190; Sat, 11 Aug 2012 05:58:56 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7B5wuAk022188; Sat, 11 Aug 2012 05:58:56 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201208110558.q7B5wuAk022188@svn.freebsd.org> From: Andrew Turner Date: Sat, 11 Aug 2012 05:58:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239191 - head/sys/arm/arm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2012 05:58:56 -0000 Author: andrew Date: Sat Aug 11 05:58:56 2012 New Revision: 239191 URL: http://svn.freebsd.org/changeset/base/239191 Log: Move the decoding of the swi instruction to the syscall function. With the ARM EABI the syscall value will be moved to a register to ease adding thumb support. When this happens decoding of the instruction will no longer be required. Modified: head/sys/arm/arm/trap.c Modified: head/sys/arm/arm/trap.c ============================================================================== --- head/sys/arm/arm/trap.c Sat Aug 11 05:45:19 2012 (r239190) +++ head/sys/arm/arm/trap.c Sat Aug 11 05:58:56 2012 (r239191) @@ -900,14 +900,13 @@ cpu_fetch_syscall_args(struct thread *td #include "../../kern/subr_syscall.c" static void -syscall(struct thread *td, trapframe_t *frame, u_int32_t insn) +syscall(struct thread *td, trapframe_t *frame) { struct syscall_args sa; int error; - td->td_frame = frame; - sa.insn = insn; - switch (insn & SWI_OS_MASK) { + sa.insn = *(uint32_t *)(frame->tf_pc - INSN_SIZE); + switch (sa.insn & SWI_OS_MASK) { case 0: /* XXX: we need our own one. */ sa.nap = 4; break; @@ -927,7 +926,6 @@ void swi_handler(trapframe_t *frame) { struct thread *td = curthread; - uint32_t insn; td->td_frame = frame; @@ -941,7 +939,6 @@ swi_handler(trapframe_t *frame) userret(td, frame); return; } - insn = *(u_int32_t *)(frame->tf_pc - INSN_SIZE); /* * Enable interrupts if they were enabled before the exception. * Since all syscalls *should* come from user mode it will always @@ -954,6 +951,6 @@ swi_handler(trapframe_t *frame) enable_interrupts(F32_bit); } - syscall(td, frame, insn); + syscall(td, frame); } From owner-svn-src-head@FreeBSD.ORG Sat Aug 11 10:27:44 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C37E7106564A; Sat, 11 Aug 2012 10:27:44 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail26.syd.optusnet.com.au (mail26.syd.optusnet.com.au [211.29.133.167]) by mx1.freebsd.org (Postfix) with ESMTP id EF5CA8FC15; Sat, 11 Aug 2012 10:27:43 +0000 (UTC) Received: from c122-106-171-246.carlnfd1.nsw.optusnet.com.au (c122-106-171-246.carlnfd1.nsw.optusnet.com.au [122.106.171.246]) by mail26.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q7BARXuw017534 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 11 Aug 2012 20:27:34 +1000 Date: Sat, 11 Aug 2012 20:27:32 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: David Xu In-Reply-To: <201208110006.q7B06uPR092724@svn.freebsd.org> Message-ID: <20120811181037.A853@besplex.bde.org> References: <201208110006.q7B06uPR092724@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r239187 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2012 10:27:44 -0000 On Sat, 11 Aug 2012, David Xu wrote: > Log: > tvtohz will print out an error message if a negative value is given > to it, avoid this problem by detecting timeout earlier. > > Reported by: pho It's interesting that anyone noticed that. In my version, the printf under DIAGNOSTIC (with prettyprinting of negative times) is simplified to an unconditional panic (with no prettyprinting). The panic never occurred here (but I don't have POSIX timers). However, I think I would go the other way and remove the diagnostic and return 1 (tick). In nanosleep(), I objected to returning an error for negative sleep times, and this is similar. A negative time is just the result of subtracting times with the one that is normally largest being smallest for some reason. Unless this must not happen for technical reasons, it is easiest to let it happen and silently handle the problem at the lowest level. For sleep intervals, negative ones should be silently converted to 0. However, there is the technical reason that 0 means infinity in the callout API, so negative sleep intervals would have to be converted to 1 tick, and this is not as good. > Modified: head/sys/kern/kern_umtx.c > ============================================================================== > --- head/sys/kern/kern_umtx.c Fri Aug 10 21:11:00 2012 (r239186) > +++ head/sys/kern/kern_umtx.c Sat Aug 11 00:06:56 2012 (r239187) > ... > @@ -601,6 +600,8 @@ abs_timeout_gethz(struct abs_timeout *ti > > tts = timo->end; > timespecsub(&tts, &timo->cur); > + if (tts.tv_sec < 0 || (tts.tv_sec == 0 && tts.tv_nsec == 0)) > + return (-1); > return (tstohz(&tts)); > } > Style bug: home made comparison of timespecs. This should be written as: % + if (timespeccmp(&timo->end, &timo->cur, whatever)) % + return (-1); % tts = timo->end; % timespecsub(&tts, &timo->cur); % return (tstohz(&tts)); (except it shouldn't be written as a function at all -- see below). > @@ -613,22 +614,25 @@ umtxq_sleep(struct umtx_q *uq, const cha > { > struct umtxq_chain *uc; > int error; > + int pulse; Style bug: int declarations not on the same line. > > uc = umtxq_getchain(&uq->uq_key); > UMTXQ_LOCKED_ASSERT(uc); > for (;;) { > if (!(uq->uq_flags & UQF_UMTXQ)) > return (0); > - error = msleep(uq, &uc->uc_lock, PCATCH, wmesg, > - timo == NULL ? 0 : abs_timeout_gethz(timo)); > - if (error != EWOULDBLOCK) > - break; > - umtxq_unlock(&uq->uq_key); > - if (abs_timeout_update(timo)) { > - error = ETIMEDOUT; I see that is part of the spec to return immediately with error ETIMEDOUT if the timeout expired. So we must check for both negative and zero timeouts. The clean way to do this is to let them reach msleep() and make it return EWOULDBLOCK immediately for them. Such timeouts can only be the result of bugs or races, so they shouldn't be optimized for with up-front checks before all calls to msleep(). Races turn negative timeouts into 1-2 tick ones anyway (this happens when the up-front check is done a few nsec before the timeout expires; then the check passes, but the timeout has expired before the sleep begins). This follows the null pointer in abs_timeout_update() if timo == NULL. timo == NULL has caused msleep to be called with a timeout of 0 ticks (infinity), so EWOULDBLOCK should not normally be returned in this case. However, I think it is always returned after the INT_MAX ticks since a timeout of infinity is not really infinite, but just INT_MAX, and there is no further magic for this value, so EWOULDBLOCK is returned as usual if the timeout expires. > + if (timo != NULL) { > + pulse = abs_timeout_gethz(timo); > + if (pulse < 0) > + return (ETIMEDOUT); > + } else > + pulse = 0; > + error = msleep(uq, &uc->uc_lock, PCATCH|PDROP, wmesg, pulse); Style bug: missing spaces around binary operator '|'. Style bug: poor variable name 'pulse'. The good name 'timo' is taken, and it is already confusing to use it for a point instead of for the timeout in ticks. (The good name 'timeout' rotted much more to 'callout' in the main timeout API.) Why is the lock dropped for just calling kern_clock_gettime()? > + if (error != EWOULDBLOCK) { > umtxq_lock(&uq->uq_key); > break; > } > + abs_timeout_update(timo); This still follows the null pointer, as above. abs_timeout_update() is only called once, and now is just kern_clock_gettime(). Manually inlining it would make its locking requirements clearer. abs_timeout_gethz() is only called once. This was convenient for using it in an expression. But now this is just an obfuscation related to 'pulse'. After manually inlning it, the expression can use tstohz() instead of it, and not need the 'pulse' variable to hold this value, and not need to abuse 'pulse' to hold the error status. > umtxq_lock(&uq->uq_key); > } > return (error); > Bruce From owner-svn-src-head@FreeBSD.ORG Sat Aug 11 10:39:47 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DC68F1065672; Sat, 11 Aug 2012 10:39:47 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail26.syd.optusnet.com.au (mail26.syd.optusnet.com.au [211.29.133.167]) by mx1.freebsd.org (Postfix) with ESMTP id 2A7598FC0C; Sat, 11 Aug 2012 10:39:46 +0000 (UTC) Received: from c122-106-171-246.carlnfd1.nsw.optusnet.com.au (c122-106-171-246.carlnfd1.nsw.optusnet.com.au [122.106.171.246]) by mail26.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q7BAdhwW019765 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 11 Aug 2012 20:39:44 +1000 Date: Sat, 11 Aug 2012 20:39:43 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans In-Reply-To: <20120811181037.A853@besplex.bde.org> Message-ID: <20120811203656.K1239@besplex.bde.org> References: <201208110006.q7B06uPR092724@svn.freebsd.org> <20120811181037.A853@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, David Xu Subject: Re: svn commit: r239187 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2012 10:39:48 -0000 On Sat, 11 Aug 2012, Bruce Evans wrote: > On Sat, 11 Aug 2012, David Xu wrote: >> ... >> for (;;) { >> if (!(uq->uq_flags & UQF_UMTXQ)) >> return (0); >> - error = msleep(uq, &uc->uc_lock, PCATCH, wmesg, >> - timo == NULL ? 0 : abs_timeout_gethz(timo)); >> - if (error != EWOULDBLOCK) >> - break; >> - umtxq_unlock(&uq->uq_key); >> - if (abs_timeout_update(timo)) { >> - error = ETIMEDOUT; > ... > This follows the null pointer in abs_timeout_update() if timo == NULL. > timo == NULL has caused msleep to be called with a timeout of 0 ticks > (infinity), so EWOULDBLOCK should not normally be returned in this > case. However, I think it is always returned after the INT_MAX ticks > since a timeout of infinity is not really infinite, but just INT_MAX, > and there is no further magic for this value, so EWOULDBLOCK is > returned as usual if the timeout expires. Oops, 0 really does mean infinity for msleep(), so there is no problem unless it somehow returns EWOULDBLOCK. > ... >> + abs_timeout_update(timo); > > This still follows the null pointer, as above. Still no problem. Bruce From owner-svn-src-head@FreeBSD.ORG Sat Aug 11 11:13:49 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75B05106564A; Sat, 11 Aug 2012 11:13:49 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 554C88FC08; Sat, 11 Aug 2012 11:13: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 q7BBDnR0049656; Sat, 11 Aug 2012 11:13:49 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7BBDnl3049649; Sat, 11 Aug 2012 11:13:49 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201208111113.q7BBDnl3049649@svn.freebsd.org> From: Dimitry Andric Date: Sat, 11 Aug 2012 11:13:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239192 - head/lib/msun/src X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2012 11:13:49 -0000 Author: dim Date: Sat Aug 11 11:13:48 2012 New Revision: 239192 URL: http://svn.freebsd.org/changeset/base/239192 Log: Change a few extern inline functions in libm to static inline, since they need to refer to static constants, which C99 does not allow for extern inline functions. While here, change a comment in e_rem_pio2f.c to mention the correct number of bits. Reviewed by: bde MFC after: 1 week Modified: head/lib/msun/src/e_rem_pio2.c head/lib/msun/src/e_rem_pio2f.c head/lib/msun/src/k_cosf.c head/lib/msun/src/k_sinf.c head/lib/msun/src/k_tanf.c head/lib/msun/src/math_private.h Modified: head/lib/msun/src/e_rem_pio2.c ============================================================================== --- head/lib/msun/src/e_rem_pio2.c Sat Aug 11 05:58:56 2012 (r239191) +++ head/lib/msun/src/e_rem_pio2.c Sat Aug 11 11:13:48 2012 (r239192) @@ -48,10 +48,10 @@ pio2_2t = 2.02226624879595063154e-21, / pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ -#ifndef INLINE_REM_PIO2 -extern +#ifdef INLINE_REM_PIO2 +static __inline #endif -__inline int +int __ieee754_rem_pio2(double x, double *y) { double z,w,t,r,fn; Modified: head/lib/msun/src/e_rem_pio2f.c ============================================================================== --- head/lib/msun/src/e_rem_pio2f.c Sat Aug 11 05:58:56 2012 (r239191) +++ head/lib/msun/src/e_rem_pio2f.c Sat Aug 11 11:13:48 2012 (r239192) @@ -31,7 +31,7 @@ __FBSDID("$FreeBSD$"); /* * invpio2: 53 bits of 2/pi - * pio2_1: first 33 bit of pi/2 + * pio2_1: first 25 bits of pi/2 * pio2_1t: pi/2 - pio2_1 */ @@ -40,10 +40,10 @@ invpio2 = 6.36619772367581382433e-01, / pio2_1 = 1.57079631090164184570e+00, /* 0x3FF921FB, 0x50000000 */ pio2_1t = 1.58932547735281966916e-08; /* 0x3E5110b4, 0x611A6263 */ -#ifndef INLINE_REM_PIO2F -extern +#ifdef INLINE_REM_PIO2F +static __inline #endif -__inline int +int __ieee754_rem_pio2f(float x, double *y) { double w,r,fn; Modified: head/lib/msun/src/k_cosf.c ============================================================================== --- head/lib/msun/src/k_cosf.c Sat Aug 11 05:58:56 2012 (r239191) +++ head/lib/msun/src/k_cosf.c Sat Aug 11 11:13:48 2012 (r239192) @@ -30,10 +30,10 @@ C1 = 0x155553e1053a42.0p-57, /* 0.041 C2 = -0x16c087e80f1e27.0p-62, /* -0.00138867637746099294692 */ C3 = 0x199342e0ee5069.0p-68; /* 0.0000243904487962774090654 */ -#ifndef INLINE_KERNEL_COSDF -extern +#ifdef INLINE_KERNEL_COSDF +static __inline #endif -__inline float +float __kernel_cosdf(double x) { double r, w, z; Modified: head/lib/msun/src/k_sinf.c ============================================================================== --- head/lib/msun/src/k_sinf.c Sat Aug 11 05:58:56 2012 (r239191) +++ head/lib/msun/src/k_sinf.c Sat Aug 11 11:13:48 2012 (r239192) @@ -29,10 +29,10 @@ S2 = 0x111110896efbb2.0p-59, /* 0.0083 S3 = -0x1a00f9e2cae774.0p-65, /* -0.000198393348360966317347 */ S4 = 0x16cd878c3b46a7.0p-71; /* 0.0000027183114939898219064 */ -#ifndef INLINE_KERNEL_SINDF -extern +#ifdef INLINE_KERNEL_SINDF +static __inline #endif -__inline float +float __kernel_sindf(double x) { double r, s, w, z; Modified: head/lib/msun/src/k_tanf.c ============================================================================== --- head/lib/msun/src/k_tanf.c Sat Aug 11 05:58:56 2012 (r239191) +++ head/lib/msun/src/k_tanf.c Sat Aug 11 11:13:48 2012 (r239192) @@ -32,10 +32,10 @@ T[] = { 0x1362b9bf971bcd.0p-59, /* 0.00946564784943673166728 */ }; -#ifndef INLINE_KERNEL_TANDF -extern +#ifdef INLINE_KERNEL_TANDF +static __inline #endif -__inline float +float __kernel_tandf(double x, int iy) { double z,r,w,s,t,u; Modified: head/lib/msun/src/math_private.h ============================================================================== --- head/lib/msun/src/math_private.h Sat Aug 11 05:58:56 2012 (r239191) +++ head/lib/msun/src/math_private.h Sat Aug 11 11:13:48 2012 (r239192) @@ -431,10 +431,9 @@ irintl(long double x) int __kernel_rem_pio2(double*,double*,int,int,int); /* double precision kernel functions */ -#ifdef INLINE_REM_PIO2 -__inline -#endif +#ifndef INLINE_REM_PIO2 int __ieee754_rem_pio2(double,double*); +#endif double __kernel_sin(double,double,int); double __kernel_cos(double,double); double __kernel_tan(double,double,int); @@ -444,22 +443,18 @@ double complex __ldexp_cexp(double compl #endif /* float precision kernel functions */ -#ifdef INLINE_REM_PIO2F -__inline -#endif +#ifndef INLINE_REM_PIO2F int __ieee754_rem_pio2f(float,double*); -#ifdef INLINE_KERNEL_SINDF -__inline #endif +#ifndef INLINE_KERNEL_SINDF float __kernel_sindf(double); -#ifdef INLINE_KERNEL_COSDF -__inline #endif +#ifndef INLINE_KERNEL_COSDF float __kernel_cosdf(double); -#ifdef INLINE_KERNEL_TANDF -__inline #endif +#ifndef INLINE_KERNEL_TANDF float __kernel_tandf(double,int); +#endif float __ldexp_expf(float,int); #ifdef _COMPLEX_H float complex __ldexp_cexpf(float complex,int); From owner-svn-src-head@FreeBSD.ORG Sat Aug 11 12:07:25 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4E9C9106567E; Sat, 11 Aug 2012 12:07:25 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 30D968FC16; Sat, 11 Aug 2012 12:07:25 +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 q7BC7PDb054228; Sat, 11 Aug 2012 12:07:25 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7BC7OjO054225; Sat, 11 Aug 2012 12:07:24 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201208111207.q7BC7OjO054225@svn.freebsd.org> From: Ed Schouten Date: Sat, 11 Aug 2012 12:07:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239193 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2012 12:07:25 -0000 Author: ed Date: Sat Aug 11 12:07:24 2012 New Revision: 239193 URL: http://svn.freebsd.org/changeset/base/239193 Log: Rename aux.c to auxv.c. On Windows, AUX is the auxiliary device, usually pointing to COM1. Therefore it is forbidden to create a file named aux.c. To make it a bit easier for Windows users to check out our source code, rename this file to auxv.c. MFC after: 1 month Discussed with: kib Suggested by: Eric van Gyzen Added: head/lib/libc/gen/auxv.c - copied unchanged from r239192, head/lib/libc/gen/aux.c Deleted: head/lib/libc/gen/aux.c Modified: head/lib/libc/gen/Makefile.inc Modified: head/lib/libc/gen/Makefile.inc ============================================================================== --- head/lib/libc/gen/Makefile.inc Sat Aug 11 11:13:48 2012 (r239192) +++ head/lib/libc/gen/Makefile.inc Sat Aug 11 12:07:24 2012 (r239193) @@ -7,7 +7,7 @@ SRCS+= __getosreldate.c __xuname.c \ _once_stub.c _pthread_stubs.c _rand48.c _spinlock_stub.c \ _thread_init.c \ - alarm.c arc4random.c assert.c aux.c basename.c check_utility_compat.c \ + alarm.c arc4random.c assert.c auxv.c basename.c check_utility_compat.c \ clock.c closedir.c confstr.c \ crypt.c ctermid.c daemon.c devname.c dirfd.c dirname.c disklabel.c \ dlfcn.c drand48.c elf_utils.c erand48.c err.c errlst.c errno.c \ Copied: head/lib/libc/gen/auxv.c (from r239192, head/lib/libc/gen/aux.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/gen/auxv.c Sat Aug 11 12:07:24 2012 (r239193, copy of r239192, head/lib/libc/gen/aux.c) @@ -0,0 +1,186 @@ +/*- + * Copyright 2010, 2012 Konstantin Belousov . + * 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 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. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "namespace.h" +#include +#include +#include +#include +#include +#include "un-namespace.h" +#include "libc_private.h" + +extern char **environ; +extern int _DYNAMIC; +#pragma weak _DYNAMIC + +void *__elf_aux_vector; +static pthread_once_t aux_vector_once = PTHREAD_ONCE_INIT; + +static void +init_aux_vector_once(void) +{ + Elf_Addr *sp; + + sp = (Elf_Addr *)environ; + while (*sp++ != 0) + ; + __elf_aux_vector = (Elf_Auxinfo *)sp; +} + +void +__init_elf_aux_vector(void) +{ + + if (&_DYNAMIC != NULL) + return; + _once(&aux_vector_once, init_aux_vector_once); +} + +static pthread_once_t aux_once = PTHREAD_ONCE_INIT; +static int pagesize, osreldate, canary_len, ncpus, pagesizes_len; +static char *canary, *pagesizes; +static void *timekeep; + +static void +init_aux(void) +{ + Elf_Auxinfo *aux; + + for (aux = __elf_aux_vector; aux->a_type != AT_NULL; aux++) { + switch (aux->a_type) { + case AT_CANARY: + canary = (char *)(aux->a_un.a_ptr); + break; + + case AT_CANARYLEN: + canary_len = aux->a_un.a_val; + break; + + case AT_PAGESIZES: + pagesizes = (char *)(aux->a_un.a_ptr); + break; + + case AT_PAGESIZESLEN: + pagesizes_len = aux->a_un.a_val; + break; + + case AT_PAGESZ: + pagesize = aux->a_un.a_val; + break; + + case AT_OSRELDATE: + osreldate = aux->a_un.a_val; + break; + + case AT_NCPUS: + ncpus = aux->a_un.a_val; + break; + + case AT_TIMEKEEP: + timekeep = aux->a_un.a_ptr; + break; + } + } +} + +int +_elf_aux_info(int aux, void *buf, int buflen) +{ + int res; + + __init_elf_aux_vector(); + if (__elf_aux_vector == NULL) + return (ENOSYS); + _once(&aux_once, init_aux); + + switch (aux) { + case AT_CANARY: + if (canary != NULL && canary_len >= buflen) { + memcpy(buf, canary, buflen); + memset(canary, 0, canary_len); + canary = NULL; + res = 0; + } else + res = ENOENT; + break; + case AT_PAGESIZES: + if (pagesizes != NULL && pagesizes_len >= buflen) { + memcpy(buf, pagesizes, buflen); + res = 0; + } else + res = ENOENT; + break; + + case AT_PAGESZ: + if (buflen == sizeof(int)) { + if (pagesize != 0) { + *(int *)buf = pagesize; + res = 0; + } else + res = ENOENT; + } else + res = EINVAL; + break; + case AT_OSRELDATE: + if (buflen == sizeof(int)) { + if (osreldate != 0) { + *(int *)buf = osreldate; + res = 0; + } else + res = ENOENT; + } else + res = EINVAL; + break; + case AT_NCPUS: + if (buflen == sizeof(int)) { + if (ncpus != 0) { + *(int *)buf = ncpus; + res = 0; + } else + res = ENOENT; + } else + res = EINVAL; + break; + case AT_TIMEKEEP: + if (buflen == sizeof(void *)) { + if (timekeep != NULL) { + *(void **)buf = timekeep; + res = 0; + } else + res = ENOENT; + } else + res = EINVAL; + break; + default: + res = ENOENT; + break; + } + return (res); +} From owner-svn-src-head@FreeBSD.ORG Sat Aug 11 14:31:25 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 423FA106566C for ; Sat, 11 Aug 2012 14:31:25 +0000 (UTC) (envelope-from bryan@shatow.net) Received: from secure.xzibition.com (secure.xzibition.com [173.160.118.92]) by mx1.freebsd.org (Postfix) with ESMTP id CEA5C8FC08 for ; Sat, 11 Aug 2012 14:31:24 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=shatow.net; h=message-id :date:from:mime-version:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; q=dns; s=sweb; b=mFaRb+ Fi8WvOdMOtAdJPbO7rw/rLNfB+7MGeH0UmLPTZeUuwYyGl7utXpimVh+yNTLP8WW rvA1roQ6Q+E8/5lqoGfqd47E3s4nO9Kg0eogJdUKmT2mLbQKKjW0MgUyEuTxn/rt oxYmyBFgmxYHQ96EAlA5PllQMjK0StW7xhJoA= DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=shatow.net; h=message-id :date:from:mime-version:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; s=sweb; bh=9tCQvUB127Gl YG2FIYxIQF+8hUhFEvbHhJD49Xo9/ss=; b=NnkAReEr5QqfTULBxkxEJ1asPd65 Oz07d/qqE1xkvsbL8GSgKWkcDtFH7BbL3lgzAPz8oA+ABhT3gOA2DyOn5RI6onCq osVRGag1WWD9TH9pSiVG3Mpar74rRtQwfk3C/SbcruF3YEY5lVBg4FZMVHnD83D1 RXQ7A0LXtSNP5tU= Received: (qmail 99738 invoked from network); 11 Aug 2012 09:31:22 -0500 Received: from unknown (HELO ?10.10.0.115?) (bryan@shatow.net@10.10.0.115) by sweb.xzibition.com with ESMTPA; 11 Aug 2012 09:31:22 -0500 Message-ID: <50266C9D.7080603@shatow.net> Date: Sat, 11 Aug 2012 09:30:53 -0500 From: Bryan Drewery User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 References: <201208111207.q7BC7OjO054225@svn.freebsd.org> In-Reply-To: <201208111207.q7BC7OjO054225@svn.freebsd.org> X-Enigmail-Version: 1.4.3 OpenPGP: id=3C9B0CF9; url=http://www.shatow.net/bryan/bryan.asc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r239193 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2012 14:31:25 -0000 On 8/11/2012 7:07 AM, Ed Schouten wrote: > Author: ed > Date: Sat Aug 11 12:07:24 2012 > New Revision: 239193 > URL: http://svn.freebsd.org/changeset/base/239193 > > Log: > Rename aux.c to auxv.c. > > On Windows, AUX is the auxiliary device, usually pointing to COM1. > Therefore it is forbidden to create a file named aux.c. To make it a bit > easier for Windows users to check out our source code, rename this file > to auxv.c. FWIW, here's the entire list [1] to try to avoid: CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9 [1] http://msdn.microsoft.com/en-us/library/aa365247.aspx -- Regards, Bryan Drewery bdrewery@freenode/EFNet From owner-svn-src-head@FreeBSD.ORG Sat Aug 11 15:03:40 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DCF6B106566B for ; Sat, 11 Aug 2012 15:03:40 +0000 (UTC) (envelope-from freebsd@damnhippie.dyndns.org) Received: from qmta12.emeryville.ca.mail.comcast.net (qmta12.emeryville.ca.mail.comcast.net [76.96.27.227]) by mx1.freebsd.org (Postfix) with ESMTP id 7A7838FC14 for ; Sat, 11 Aug 2012 15:03:40 +0000 (UTC) Received: from omta11.emeryville.ca.mail.comcast.net ([76.96.30.36]) by qmta12.emeryville.ca.mail.comcast.net with comcast id lQzX1j0080mlR8UACT3a1K; Sat, 11 Aug 2012 15:03:34 +0000 Received: from damnhippie.dyndns.org ([24.8.232.202]) by omta11.emeryville.ca.mail.comcast.net with comcast id lT3Z1j0054NgCEG8XT3Zaq; Sat, 11 Aug 2012 15:03:34 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id q7BF3Veb012163; Sat, 11 Aug 2012 09:03:31 -0600 (MDT) (envelope-from freebsd@damnhippie.dyndns.org) From: Ian Lepore To: svn-src-head@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org In-Reply-To: <50266C9D.7080603@shatow.net> References: <201208111207.q7BC7OjO054225@svn.freebsd.org> <50266C9D.7080603@shatow.net> Content-Type: text/plain; charset="us-ascii" Date: Sat, 11 Aug 2012 09:03:31 -0600 Message-ID: <1344697411.1186.2.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: Subject: Re: svn commit: r239193 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2012 15:03:41 -0000 On Sat, 2012-08-11 at 09:30 -0500, Bryan Drewery wrote: > On 8/11/2012 7:07 AM, Ed Schouten wrote: > > Author: ed > > Date: Sat Aug 11 12:07:24 2012 > > New Revision: 239193 > > URL: http://svn.freebsd.org/changeset/base/239193 > > > > Log: > > Rename aux.c to auxv.c. > > > > On Windows, AUX is the auxiliary device, usually pointing to COM1. > > Therefore it is forbidden to create a file named aux.c. To make it a bit > > easier for Windows users to check out our source code, rename this file > > to auxv.c. > > FWIW, here's the entire list [1] to try to avoid: > > CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, > COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9 > > [1] http://msdn.microsoft.com/en-us/library/aa365247.aspx > > If we're worrying about such things (which I'm agnostic about), filenames ending in a dot are apparently also not allowed. When I turn a fresh checkout of -current into a mercurial repo I get these warnings: warning: filename contains 'aux', which is reserved on Windows: 'share/examples/libusb20/aux.c' warning: filename contains 'aux', which is reserved on Windows: 'share/examples/libusb20/aux.h' warning: filename ends with '.', which is not allowed on Windows: 'tools/test/sort/bigtest/q-1.024.003.' -- Ian From owner-svn-src-head@FreeBSD.ORG Sat Aug 11 15:08:20 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5C30E106566B; Sat, 11 Aug 2012 15:08:20 +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 468438FC14; Sat, 11 Aug 2012 15:08:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7BF8JR6069273; Sat, 11 Aug 2012 15:08:19 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7BF8Jjp069271; Sat, 11 Aug 2012 15:08:19 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201208111508.q7BF8Jjp069271@svn.freebsd.org> From: Alexander Motin Date: Sat, 11 Aug 2012 15:08:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239194 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2012 15:08:20 -0000 Author: mav Date: Sat Aug 11 15:08:19 2012 New Revision: 239194 URL: http://svn.freebsd.org/changeset/base/239194 Log: Allow idle threads to steal second threads from other cores on systems with 8 or more cores to improve utilization. None of my tests on 2xXeon (2x6x2) system shown any slowdown from mentioned "excess thrashing". Same time in pbzip2 test with number of threads more then number of CPUs I see up to 10% speedup with SMT disabled and up 5% with SMT enabled. Thinking about trashing I was trying to limit that stealing within same last level cache, but got only worse results. Present code any way prefers to steal threads from topologically closer cores. Sponsored by: iXsystems, Inc. Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Sat Aug 11 12:07:24 2012 (r239193) +++ head/sys/kern/sched_ule.c Sat Aug 11 15:08:19 2012 (r239194) @@ -1403,12 +1403,6 @@ sched_initticks(void *dummy) * what realstathz is. */ balance_interval = realstathz; - /* - * Set steal thresh to roughly log2(mp_ncpu) but no greater than 4. - * This prevents excess thrashing on large machines and excess idle - * on smaller machines. - */ - steal_thresh = min(fls(mp_ncpus) - 1, 3); affinity = SCHED_AFFINITY_DEFAULT; #endif if (sched_idlespinthresh < 0) From owner-svn-src-head@FreeBSD.ORG Sat Aug 11 15:32:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B4968106564A; Sat, 11 Aug 2012 15:32:24 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 296378FC08; Sat, 11 Aug 2012 15:32:23 +0000 (UTC) Received: by vbmv11 with SMTP id v11so3188494vbm.13 for ; Sat, 11 Aug 2012 08:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=WYDNIMxDcjp/ctqIRfJXQ0rJn4P97d+obdkhj4rfdZk=; b=idRfUyTJOMVW1HnqMsFUV7XlemG0IEx10mk+5S0KixnEJCVG/C60CBB73ZUYdDcwxx YS3vt7EPRQhKbuYuvhuuq3NNlzjwtxvIpqRhm5DHF9ZSWn4y4xdvDkA6guGrIZLVsCVQ Y7477pEZYCi4TsKa/ykKQeMu1zdrH5FgQEPYO9VSbba5cK+oZ6xttK06g4q/qmXNTqGf 3r7yzUXNbreH4YPRnkSNl9daLR0CeQMFvxXTZB7+/xm87btWJLbETunZHN+SCiPwPL7F 9BARlzEC7tRlWfzhZxPVYDedOeQdJs85rfvA4lzNCCT0lQx1+rGCEq1kMhBpz0p0QR1o etXg== MIME-Version: 1.0 Received: by 10.58.31.228 with SMTP id d4mr5922965vei.40.1344699143101; Sat, 11 Aug 2012 08:32:23 -0700 (PDT) Received: by 10.58.114.102 with HTTP; Sat, 11 Aug 2012 08:32:23 -0700 (PDT) In-Reply-To: <201208111207.q7BC7OjO054225@svn.freebsd.org> References: <201208111207.q7BC7OjO054225@svn.freebsd.org> Date: Sat, 11 Aug 2012 11:32:23 -0400 Message-ID: From: Ryan Stone To: Ed Schouten Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r239193 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2012 15:32:24 -0000 On Sat, Aug 11, 2012 at 8:07 AM, Ed Schouten wrote: > On Windows, AUX is the auxiliary device, usually pointing to COM1. > Therefore it is forbidden to create a file named aux.c. To make it a bit > easier for Windows users to check out our source code, rename this file > to auxv.c. I have a long list of similar Windows problems which was probably originally compiled in the FreeBSD 4-FreeBSD 5 days. This prompted me to look again on HEAD, and I'm very happy to report that the vast majority of issues have been dealt with. The only one remaining is a pair of man pages whose names differ only by case (which works out really poorly on a case-insensitive fs): src/share/man/man9/vfs_mount.9 src/share/man/man9/VFS_MOUNT.9 (of course, new ones could have easily cropped up in the meantime). From owner-svn-src-head@FreeBSD.ORG Sat Aug 11 15:38:17 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3ED3C106566C; Sat, 11 Aug 2012 15:38:17 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) by mx1.freebsd.org (Postfix) with ESMTP id E8DC98FC0A; Sat, 11 Aug 2012 15:38:16 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:fd63:742f:8e7f:9fd5] (unknown [IPv6:2001:7b8:3a7:0:fd63:742f:8e7f:9fd5]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id BCF7F5C37; Sat, 11 Aug 2012 17:38:08 +0200 (CEST) Message-ID: <50267C67.8090406@FreeBSD.org> Date: Sat, 11 Aug 2012 17:38:15 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120731 Thunderbird/15.0 MIME-Version: 1.0 To: "Andrey V. Elsukov" References: <201208051437.q75EbnJO093363@svn.freebsd.org> In-Reply-To: <201208051437.q75EbnJO093363@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r239066 - head/sys/boot/i386/libi386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2012 15:38:17 -0000 On 2012-08-05 16:37, Andrey V. Elsukov wrote:> Author: ae > Date: Sun Aug 5 14:37:48 2012 > New Revision: 239066 > URL: http://svn.freebsd.org/changeset/base/239066 > > Log: > Add offset field to the i386_devdesc structure to be compatible with > disk_devdesc structure. Update biosdisk driver to the new disk API. > > Modified: > head/sys/boot/i386/libi386/Makefile > head/sys/boot/i386/libi386/biosdisk.c > head/sys/boot/i386/libi386/devicename.c > head/sys/boot/i386/libi386/libi386.h Though I still don't understand how, this breaks loader(8) for me. When I build a loader from this revision, I get the following at boot: /boot/config: -D -S115200 FreeBSD/x86 boot Default: 0:da(0,a)/boot/loader boot: 0:da(0,a)/boot/loader.testConsoles: internal video/keyboard serial port BIOS drive A: is disk0 BIOS drive C: is disk1 BIOS 638kB/1046464kB available memory FreeBSD/x86 bootstrap loader, Revision 1.1 (dim@vm-dvs-dimtest1.home.andric.com, Sat Aug 11 17:14:02 CEST 2012) can't load 'kernel' Type '?' for a list of commands, 'help' for more detailed help. OK ls open '/' failed: no such file or directory OK lsdev cd devices: disk devices: disk0: BIOS drive A: disk1: BIOS drive C: disk1a: FreeBSD UFS disk1b: FreeBSD swap pxe devices: OK reboot Rebooting... Building a loader from r239065 works just fine: /boot/config: -D -S115200 FreeBSD/x86 boot Default: 0:da(0,a)/boot/loader boot: Consoles: internal video/keyboard serial port BIOS drive A: is disk0 BIOS drive C: is disk1 BIOS 638kB/1046464kB available memory FreeBSD/x86 bootstrap loader, Revision 1.1 (dim@vm-dvs-dimtest1.home.andric.com, Sun Aug 5 01:20:40 CEST 2012) Loading /boot/defaults/loader.conf /boot/kernel/kernel text=0xc02345 data=0x108378+0x21bad0 syms=[0x4+0xd7610+0x4+0x19e1a8] /boot/kernel/pty.ko text=0x920 data=0x1c8 syms=[0x4+0x3b0+0x4+0x350] /boot/kernel/vmmemctl.ko text=0x1cac data=0xfc+0xe4 syms=[0x4+0x5a0+0x4+0x557] \ Hit [Enter] to boot immediately, or any other key for command prompt. Type '?' for a list of commands, 'help' for more detailed help. OK lsdev cd devices: disk devices: disk0: BIOS drive A: disk1: BIOS drive C: disk1a: FFS disk1b: swap pxe devices: OK ls / d .snap d dev d etc d cdrom d dist d bin d boot d lib d libexec d media d mnt d proc d rescue d root d sbin d tmp d usr d var d home d share entropy l sys .cshrc boot.config l compat COPYRIGHT .profile .sujournal OK boot [...booting normally...] This is all in a VMware guest, with 'dangerously dedicated' disks, e.g. /dev/da0a is root, /dev/da0b is swap. Any idea where I should start looking? :) From owner-svn-src-head@FreeBSD.ORG Sat Aug 11 15:47:23 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5E0EE1065672; Sat, 11 Aug 2012 15:47:23 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 48A2F8FC0C; Sat, 11 Aug 2012 15:47:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7BFlNLs072664; Sat, 11 Aug 2012 15:47:23 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7BFlNFD072661; Sat, 11 Aug 2012 15:47:23 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201208111547.q7BFlNFD072661@svn.freebsd.org> From: Dimitry Andric Date: Sat, 11 Aug 2012 15:47:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239195 - head/lib/msun/src X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2012 15:47:23 -0000 Author: dim Date: Sat Aug 11 15:47:22 2012 New Revision: 239195 URL: http://svn.freebsd.org/changeset/base/239195 Log: Add __always_inline to __ieee754_rem_pio2() and __ieee754_rem_pio2f(), since some older versions of gcc refuse to inline these otherwise. Requested by: bde MFC after: 1 week Modified: head/lib/msun/src/e_rem_pio2.c head/lib/msun/src/e_rem_pio2f.c Modified: head/lib/msun/src/e_rem_pio2.c ============================================================================== --- head/lib/msun/src/e_rem_pio2.c Sat Aug 11 15:08:19 2012 (r239194) +++ head/lib/msun/src/e_rem_pio2.c Sat Aug 11 15:47:22 2012 (r239195) @@ -49,7 +49,7 @@ pio2_3 = 2.02226624871116645580e-21, / pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ #ifdef INLINE_REM_PIO2 -static __inline +static __inline __always_inline #endif int __ieee754_rem_pio2(double x, double *y) Modified: head/lib/msun/src/e_rem_pio2f.c ============================================================================== --- head/lib/msun/src/e_rem_pio2f.c Sat Aug 11 15:08:19 2012 (r239194) +++ head/lib/msun/src/e_rem_pio2f.c Sat Aug 11 15:47:22 2012 (r239195) @@ -41,7 +41,7 @@ pio2_1 = 1.57079631090164184570e+00, / pio2_1t = 1.58932547735281966916e-08; /* 0x3E5110b4, 0x611A6263 */ #ifdef INLINE_REM_PIO2F -static __inline +static __inline __always_inline #endif int __ieee754_rem_pio2f(float x, double *y) From owner-svn-src-head@FreeBSD.ORG Sat Aug 11 20:24:40 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F4D0106564A; Sat, 11 Aug 2012 20:24:40 +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 8A0338FC17; Sat, 11 Aug 2012 20:24: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 q7BKOekK095666; Sat, 11 Aug 2012 20:24:40 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7BKOerT095663; Sat, 11 Aug 2012 20:24:40 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201208112024.q7BKOerT095663@svn.freebsd.org> From: Alexander Motin Date: Sat, 11 Aug 2012 20:24:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239196 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2012 20:24:40 -0000 Author: mav Date: Sat Aug 11 20:24:39 2012 New Revision: 239196 URL: http://svn.freebsd.org/changeset/base/239196 Log: Some more minor tunings inspired by bde@. Modified: head/sys/kern/sched_4bsd.c head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_4bsd.c ============================================================================== --- head/sys/kern/sched_4bsd.c Sat Aug 11 15:47:22 2012 (r239195) +++ head/sys/kern/sched_4bsd.c Sat Aug 11 20:24:39 2012 (r239196) @@ -193,12 +193,13 @@ sysctl_kern_quantum(SYSCTL_HANDLER_ARGS) period = 1000000 / realstathz; new_val = period * sched_slice; error = sysctl_handle_int(oidp, &new_val, 0, req); - if (error != 0 || req->newptr == NULL) + if (error != 0 || req->newptr == NULL) return (error); if (new_val <= 0) return (EINVAL); - sched_slice = max(1, (new_val + period / 2) / period); - hogticks = max(1, 2 * hz * sched_slice / realstathz); + sched_slice = imax(1, (new_val + period / 2) / period); + hogticks = imax(1, (2 * hz * sched_slice + realstathz / 2) / + realstathz); return (0); } @@ -208,9 +209,9 @@ SYSCTL_STRING(_kern_sched, OID_AUTO, nam "Scheduler name"); SYSCTL_PROC(_kern_sched, OID_AUTO, quantum, CTLTYPE_INT | CTLFLAG_RW, NULL, 0, sysctl_kern_quantum, "I", - "Length of time granted to timeshare threads in microseconds"); + "Quantum for timeshare threads in microseconds"); SYSCTL_INT(_kern_sched, OID_AUTO, slice, CTLFLAG_RW, &sched_slice, 0, - "Length of time granted to timeshare threads in stathz ticks"); + "Quantum for timeshare threads in stathz ticks"); #ifdef SMP /* Enable forwarding of wakeups to all other cpus */ static SYSCTL_NODE(_kern_sched, OID_AUTO, ipiwakeup, CTLFLAG_RD, NULL, @@ -665,7 +666,8 @@ sched_initticks(void *dummy) realstathz = stathz ? stathz : hz; sched_slice = realstathz / 10; /* ~100ms */ - hogticks = max(1, 2 * hz * sched_slice / realstathz); + hogticks = imax(1, (2 * hz * sched_slice + realstathz / 2) / + realstathz); } /* External interfaces start here */ @@ -704,7 +706,7 @@ sched_rr_interval(void) { /* Convert sched_slice from stathz to hz. */ - return (max(1, (sched_slice * hz + realstathz / 2) / realstathz)); + return (imax(1, (sched_slice * hz + realstathz / 2) / realstathz)); } /* Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Sat Aug 11 15:47:22 2012 (r239195) +++ head/sys/kern/sched_ule.c Sat Aug 11 20:24:39 2012 (r239196) @@ -1383,7 +1383,8 @@ sched_initticks(void *dummy) realstathz = stathz ? stathz : hz; sched_slice = realstathz / 10; /* ~100ms */ - hogticks = max(1, 2 * hz * sched_slice / realstathz); + hogticks = imax(1, (2 * hz * sched_slice + realstathz / 2) / + realstathz); /* * tickincr is shifted out by 10 to avoid rounding errors due to @@ -1406,7 +1407,7 @@ sched_initticks(void *dummy) affinity = SCHED_AFFINITY_DEFAULT; #endif if (sched_idlespinthresh < 0) - sched_idlespinthresh = max(16, 2 * hz / realstathz); + sched_idlespinthresh = imax(16, 2 * hz / realstathz); } @@ -1595,7 +1596,7 @@ sched_rr_interval(void) { /* Convert sched_slice from stathz to hz. */ - return (max(1, (sched_slice * hz + realstathz / 2) / realstathz)); + return (imax(1, (sched_slice * hz + realstathz / 2) / realstathz)); } /* @@ -2790,12 +2791,13 @@ sysctl_kern_quantum(SYSCTL_HANDLER_ARGS) period = 1000000 / realstathz; new_val = period * sched_slice; error = sysctl_handle_int(oidp, &new_val, 0, req); - if (error != 0 || req->newptr == NULL) + if (error != 0 || req->newptr == NULL) return (error); if (new_val <= 0) return (EINVAL); - sched_slice = max(1, (new_val + period / 2) / period); - hogticks = max(1, 2 * hz * sched_slice / realstathz); + sched_slice = imax(1, (new_val + period / 2) / period); + hogticks = imax(1, (2 * hz * sched_slice + realstathz / 2) / + realstathz); return (0); } @@ -2804,19 +2806,21 @@ SYSCTL_STRING(_kern_sched, OID_AUTO, nam "Scheduler name"); SYSCTL_PROC(_kern_sched, OID_AUTO, quantum, CTLTYPE_INT | CTLFLAG_RW, NULL, 0, sysctl_kern_quantum, "I", - "Length of time granted to timeshare threads in microseconds"); + "Quantum for timeshare threads in microseconds"); SYSCTL_INT(_kern_sched, OID_AUTO, slice, CTLFLAG_RW, &sched_slice, 0, - "Length of time granted to timeshare threads in stathz ticks"); + "Quantum for timeshare threads in stathz ticks"); SYSCTL_INT(_kern_sched, OID_AUTO, interact, CTLFLAG_RW, &sched_interact, 0, - "Interactivity score threshold"); -SYSCTL_INT(_kern_sched, OID_AUTO, preempt_thresh, CTLFLAG_RW, &preempt_thresh, - 0,"Min priority for preemption, lower priorities have greater precedence"); -SYSCTL_INT(_kern_sched, OID_AUTO, static_boost, CTLFLAG_RW, &static_boost, - 0,"Controls whether static kernel priorities are assigned to sleeping threads."); -SYSCTL_INT(_kern_sched, OID_AUTO, idlespins, CTLFLAG_RW, &sched_idlespins, - 0,"Number of times idle thread will spin waiting for new work."); -SYSCTL_INT(_kern_sched, OID_AUTO, idlespinthresh, CTLFLAG_RW, &sched_idlespinthresh, - 0,"Threshold before we will permit idle thread spinning."); + "Interactivity score threshold"); +SYSCTL_INT(_kern_sched, OID_AUTO, preempt_thresh, CTLFLAG_RW, + &preempt_thresh, 0, + "Maximal (lowest) priority for preemption"); +SYSCTL_INT(_kern_sched, OID_AUTO, static_boost, CTLFLAG_RW, &static_boost, 0, + "Assign static kernel priorities to sleeping threads"); +SYSCTL_INT(_kern_sched, OID_AUTO, idlespins, CTLFLAG_RW, &sched_idlespins, 0, + "Number of times idle thread will spin waiting for new work"); +SYSCTL_INT(_kern_sched, OID_AUTO, idlespinthresh, CTLFLAG_RW, + &sched_idlespinthresh, 0, + "Threshold before we will permit idle thread spinning"); #ifdef SMP SYSCTL_INT(_kern_sched, OID_AUTO, affinity, CTLFLAG_RW, &affinity, 0, "Number of hz ticks to keep thread affinity for"); @@ -2828,7 +2832,7 @@ SYSCTL_INT(_kern_sched, OID_AUTO, balanc SYSCTL_INT(_kern_sched, OID_AUTO, steal_idle, CTLFLAG_RW, &steal_idle, 0, "Attempts to steal work from other cores before idling"); SYSCTL_INT(_kern_sched, OID_AUTO, steal_thresh, CTLFLAG_RW, &steal_thresh, 0, - "Minimum load on remote cpu before we'll steal"); + "Minimum load on remote CPU before we'll steal"); SYSCTL_PROC(_kern_sched, OID_AUTO, topology_spec, CTLTYPE_STRING | CTLFLAG_RD, NULL, 0, sysctl_kern_sched_topology_spec, "A", "XML dump of detected CPU topology"); From owner-svn-src-head@FreeBSD.ORG Sat Aug 11 22:20:29 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 72DB11065672; Sat, 11 Aug 2012 22:20:29 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C28C8FC15; Sat, 11 Aug 2012 22:20:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7BMKTpd005630; Sat, 11 Aug 2012 22:20:29 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7BMKTUH005627; Sat, 11 Aug 2012 22:20:29 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201208112220.q7BMKTUH005627@svn.freebsd.org> From: Adrian Chadd Date: Sat, 11 Aug 2012 22:20:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239197 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2012 22:20:29 -0000 Author: adrian Date: Sat Aug 11 22:20:28 2012 New Revision: 239197 URL: http://svn.freebsd.org/changeset/base/239197 Log: Begin fleshing out the TX FIFO support. * Add ATH_TXQ_FIRST() for easy tasting of what's on the list; * Add an "axq_fifo_depth" for easy tracking of how deep the current FIFO is; * Flesh out the handoff (mcast, hw) functions; * Begin fleshing out a TX ISR proc, which tastes the TX status FIFO. The legacy hardware stuffs the TX completion at the end of the final frame descriptor (or final sub-frame when doing aggregate.) So it's feasible to do a per-TXQ drain and process, as the needed info is right there. For EDMA hardware, there's a separate TX completion FIFO. So the TX process routine needs to read the single FIFO and then process the frames in each hardware queue. This makes it difficult to do a per-queue process, as you'll end up with frames in the TX completion FIFO for a different TXQ to the one you've passed to ath_tx_draintxq() or ath_tx_processq(). Testing: I've tested the TX queue and TX completion code in hostap mode on an AR9380. Beacon frames successfully transmit and the completion routine is called. Occasional data frames end up in TXQ 1 and are also successfully completed. However, this requires some changes to the beacon code path as: * The AR9380 beacon configuration API is now in TU/8, rather than TU; * The AR9380 TX API requires the rate control is setup using a call to setup11nratescenario, rather than having the try0 series setup (rate/tries for the first series); so the beacon won't go out. I'll follow this up with commits to the beacon code. Modified: head/sys/dev/ath/if_ath_tx_edma.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath_tx_edma.c ============================================================================== --- head/sys/dev/ath/if_ath_tx_edma.c Sat Aug 11 20:24:39 2012 (r239196) +++ head/sys/dev/ath/if_ath_tx_edma.c Sat Aug 11 22:20:28 2012 (r239197) @@ -132,7 +132,7 @@ MALLOC_DECLARE(M_ATHDEV); /* * Re-initialise the DMA FIFO with the current contents of - * said FIFO. + * said TXQ. * * This should only be called as part of the chip reset path, as it * assumes the FIFO is currently empty. @@ -152,6 +152,90 @@ ath_edma_dma_restart(struct ath_softc *s } /* + * Hand off this frame to a hardware queue. + * + * Things are a bit hairy in the EDMA world. The TX FIFO is only + * 8 entries deep, so we need to keep track of exactly what we've + * pushed into the FIFO and what's just sitting in the TX queue, + * waiting to go out. + * + * So this is split into two halves - frames get appended to the + * TXQ; then a scheduler is called to push some frames into the + * actual TX FIFO. + */ +static void +ath_edma_xmit_handoff_hw(struct ath_softc *sc, struct ath_txq *txq, + struct ath_buf *bf) +{ + struct ath_hal *ah = sc->sc_ah; + + ATH_TXQ_LOCK_ASSERT(txq); + + KASSERT((bf->bf_flags & ATH_BUF_BUSY) == 0, + ("%s: busy status 0x%x", __func__, bf->bf_flags)); + + /* + * XXX TODO: write a hard-coded check to ensure that + * the queue id in the TX descriptor matches txq->axq_qnum. + */ + + /* Update aggr stats */ + if (bf->bf_state.bfs_aggr) + txq->axq_aggr_depth++; + + /* Push and update frame stats */ + ATH_TXQ_INSERT_TAIL(txq, bf, bf_list); + + /* Only schedule to the FIFO if there's space */ + if (txq->axq_fifo_depth < HAL_TXFIFO_DEPTH) { + ath_hal_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr); + ath_hal_txstart(ah, txq->axq_qnum); + } +} + +/* + * Hand off this frame to a multicast software queue. + * + * Unlike legacy DMA, this doesn't chain together frames via the + * link pointer. Instead, they're just added to the queue. + * When it comes time to populate the CABQ, these frames should + * be individually pushed into the FIFO as appropriate. + * + * Yes, this does mean that I'll eventually have to flesh out some + * replacement code to handle populating the CABQ, rather than + * what's done in ath_beacon_generate(). It'll have to push each + * frame from the HW CABQ to the FIFO rather than just appending + * it to the existing TXQ and kicking off DMA. + */ +static void +ath_edma_xmit_handoff_mcast(struct ath_softc *sc, struct ath_txq *txq, + struct ath_buf *bf) +{ + + ATH_TXQ_LOCK_ASSERT(txq); + KASSERT((bf->bf_flags & ATH_BUF_BUSY) == 0, + ("%s: busy status 0x%x", __func__, bf->bf_flags)); + + /* + * XXX this is mostly duplicated in ath_tx_handoff_mcast(). + */ + if (ATH_TXQ_FIRST(txq) != NULL) { + struct ath_buf *bf_last = ATH_TXQ_LAST(txq, axq_q_s); + struct ieee80211_frame *wh; + + /* mark previous frame */ + wh = mtod(bf_last->bf_m, struct ieee80211_frame *); + wh->i_fc[1] |= IEEE80211_FC1_MORE_DATA; + + /* sync descriptor to memory */ + bus_dmamap_sync(sc->sc_dmat, bf_last->bf_dmamap, + BUS_DMASYNC_PREWRITE); + } + + ATH_TXQ_INSERT_TAIL(txq, bf, bf_list); +} + +/* * Handoff this frame to the hardware. * * For the multicast queue, this will treat it as a software queue @@ -173,17 +257,26 @@ ath_edma_xmit_handoff(struct ath_softc * struct ath_buf *bf) { + ATH_TXQ_LOCK_ASSERT(txq); + device_printf(sc->sc_dev, "%s: called; bf=%p, txq=%p, qnum=%d\n", __func__, bf, txq, txq->axq_qnum); + if (txq->axq_qnum == ATH_TXQ_SWQ) + ath_edma_xmit_handoff_mcast(sc, txq, bf); + else + ath_edma_xmit_handoff_hw(sc, txq, bf); + +#if 0 /* * XXX For now this is a placeholder; free the buffer * and inform the stack that the TX failed. */ ath_tx_default_comp(sc, bf, 1); +#endif } static int @@ -255,26 +348,73 @@ ath_edma_dma_txteardown(struct ath_softc return (0); } +/* + * Process frames in the current queue and if necessary, re-schedule the + * software TXQ scheduler for this TXQ. + * + * XXX This is again a pain in the ass to do because the status descriptor + * information is in the TX status FIFO, not with the current descriptor. + */ static int ath_edma_tx_processq(struct ath_softc *sc, struct ath_txq *txq, int dosched) { + device_printf(sc->sc_dev, "%s: called\n", __func__); return (0); } +/* + * Completely drain the TXQ, completing frames that were completed. + * + * XXX this is going to be a complete pain in the ass because the + * completion status is in the TX status FIFO, not with the descriptor + * itself. Sigh. + */ static void ath_edma_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq) { + device_printf(sc->sc_dev, "%s: called\n", __func__); } +/* + * Process the TX status queue. + */ static void ath_edma_tx_proc(void *arg, int npending) { struct ath_softc *sc = (struct ath_softc *) arg; + struct ath_hal *ah = sc->sc_ah; + HAL_STATUS status; + struct ath_tx_status ts; + struct ath_txq *txq; device_printf(sc->sc_dev, "%s: called, npending=%d\n", __func__, npending); + + for (;;) { + ATH_TXSTATUS_LOCK(sc); + status = ath_hal_txprocdesc(ah, NULL, (void *) &ts); + ATH_TXSTATUS_UNLOCK(sc); + + if (status != HAL_OK) + break; + + /* + * At this point we have a valid status descriptor. + * The QID and descriptor ID (which currently isn't set) + * is part of the status. + * + * We then assume that the descriptor in question is the + * -head- of the given QID. Eventually we should verify + * this by using the descriptor ID. + */ + device_printf(sc->sc_dev, "%s: qcuid=%d\n", + __func__, + ts.ts_queue_id); + + txq = &sc->sc_txq[ts.ts_queue_id]; + } } static void Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Sat Aug 11 20:24:39 2012 (r239196) +++ head/sys/dev/ath/if_athvar.h Sat Aug 11 22:20:28 2012 (r239197) @@ -304,6 +304,7 @@ struct ath_txq { #define ATH_TXQ_PUTPENDING 0x0001 /* ath_hal_puttxbuf pending */ u_int axq_depth; /* queue depth (stat only) */ u_int axq_aggr_depth; /* how many aggregates are queued */ + u_int axq_fifo_depth; /* depth of FIFO frames */ u_int axq_intrcnt; /* interrupt count */ u_int32_t *axq_link; /* link ptr in last TX desc */ TAILQ_HEAD(axq_q_s, ath_buf) axq_q; /* transmit queue */ @@ -344,6 +345,7 @@ struct ath_txq { TAILQ_REMOVE(&(_tq)->axq_q, _elm, _field); \ (_tq)->axq_depth--; \ } while (0) +#define ATH_TXQ_FIRST(_tq) TAILQ_FIRST(&(_tq)->axq_q) #define ATH_TXQ_LAST(_tq, _field) TAILQ_LAST(&(_tq)->axq_q, _field) struct ath_vap { From owner-svn-src-head@FreeBSD.ORG Sat Aug 11 22:25:29 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 203BB1065678; Sat, 11 Aug 2012 22:25:29 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0BA798FC08; Sat, 11 Aug 2012 22:25:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7BMPSJ0006143; Sat, 11 Aug 2012 22:25:28 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7BMPSvJ006140; Sat, 11 Aug 2012 22:25:28 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201208112225.q7BMPSvJ006140@svn.freebsd.org> From: Adrian Chadd Date: Sat, 11 Aug 2012 22:25:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239198 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2012 22:25:29 -0000 Author: adrian Date: Sat Aug 11 22:25:28 2012 New Revision: 239198 URL: http://svn.freebsd.org/changeset/base/239198 Log: Add the AR9300 HAL ID in to the 11n check routine. I was having TX hang issues, which I root caused to having the legacy ath_hal_setupxtxdesc() called, rather than the 11n rate scenario setup code. This meant that rate control information wasn't being put into frames, causing the MAC to stall/hang. Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Sat Aug 11 22:20:28 2012 (r239197) +++ head/sys/dev/ath/if_ath_tx.c Sat Aug 11 22:25:28 2012 (r239198) @@ -120,7 +120,8 @@ static int ath_tx_action_frame_override_ static inline int ath_tx_is_11n(struct ath_softc *sc) { - return (sc->sc_ah->ah_magic == 0x20065416); + return ((sc->sc_ah->ah_magic == 0x20065416) || + (sc->sc_ah->ah_magic == 0x19741014)); } /* From owner-svn-src-head@FreeBSD.ORG Sat Aug 11 22:39:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 201BA106566B; Sat, 11 Aug 2012 22:39:28 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B7B98FC08; Sat, 11 Aug 2012 22:39:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7BMdRRD007311; Sat, 11 Aug 2012 22:39:27 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7BMdRib007309; Sat, 11 Aug 2012 22:39:27 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201208112239.q7BMdRib007309@svn.freebsd.org> From: Adrian Chadd Date: Sat, 11 Aug 2012 22:39:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239199 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2012 22:39:28 -0000 Author: adrian Date: Sat Aug 11 22:39:27 2012 New Revision: 239199 URL: http://svn.freebsd.org/changeset/base/239199 Log: Add the AR9380 HAL to the TX descriptor debugging, in order to dump all of the descriptor contents. Modified: head/sys/dev/ath/if_ath_debug.c Modified: head/sys/dev/ath/if_ath_debug.c ============================================================================== --- head/sys/dev/ath/if_ath_debug.c Sat Aug 11 22:25:28 2012 (r239198) +++ head/sys/dev/ath/if_ath_debug.c Sat Aug 11 22:39:27 2012 (r239199) @@ -158,7 +158,8 @@ ath_printtxbuf(struct ath_softc *sc, con ds->ds_ctl0, ds->ds_ctl1, ds->ds_hw[0], ds->ds_hw[1], ds->ds_hw[2], ds->ds_hw[3]); - if (ah->ah_magic == 0x20065416) { + if (ah->ah_magic == 0x20065416 || + ah->ah_magic == 0x19741014) { printf(" %08x %08x %08x %08x %08x %08x %08x %08x\n", ds->ds_hw[4], ds->ds_hw[5], ds->ds_hw[6], ds->ds_hw[7], ds->ds_hw[8], ds->ds_hw[9], From owner-svn-src-head@FreeBSD.ORG Sat Aug 11 23:17:03 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 88BF2106566B; Sat, 11 Aug 2012 23:17:03 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 72B5B8FC0A; Sat, 11 Aug 2012 23:17: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 q7BNH3Id010412; Sat, 11 Aug 2012 23:17:03 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7BNH3TG010406; Sat, 11 Aug 2012 23:17:03 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201208112317.q7BNH3TG010406@svn.freebsd.org> From: David Xu Date: Sat, 11 Aug 2012 23:17:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239200 - head/lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2012 23:17:03 -0000 Author: davidxu Date: Sat Aug 11 23:17:02 2012 New Revision: 239200 URL: http://svn.freebsd.org/changeset/base/239200 Log: MFp4: Further decreases unexpected context switches by defering mutex wakeup until internal sleep queue lock is released. Modified: head/lib/libthr/thread/thr_cond.c head/lib/libthr/thread/thr_kern.c head/lib/libthr/thread/thr_mutex.c head/lib/libthr/thread/thr_private.h head/lib/libthr/thread/thr_umtx.h Modified: head/lib/libthr/thread/thr_cond.c ============================================================================== --- head/lib/libthr/thread/thr_cond.c Sat Aug 11 22:39:27 2012 (r239199) +++ head/lib/libthr/thread/thr_cond.c Sat Aug 11 23:17:02 2012 (r239200) @@ -217,6 +217,7 @@ cond_wait_user(struct pthread_cond *cvp, struct sleepqueue *sq; int recurse; int error; + int defered; if (curthread->wchan != NULL) PANIC("thread was already on queue."); @@ -230,13 +231,23 @@ cond_wait_user(struct pthread_cond *cvp, * us to check it without locking in pthread_cond_signal(). */ cvp->__has_user_waiters = 1; - curthread->will_sleep = 1; - (void)_mutex_cv_unlock(mp, &recurse); + defered = 0; + (void)_mutex_cv_unlock(mp, &recurse, &defered); curthread->mutex_obj = mp; _sleepq_add(cvp, curthread); for(;;) { _thr_clear_wake(curthread); _sleepq_unlock(cvp); + if (defered) { + if ((mp->m_lock.m_owner & UMUTEX_CONTESTED) == 0) + (void)_umtx_op_err(&mp->m_lock, UMTX_OP_MUTEX_WAKE2, + mp->m_lock.m_flags, 0, 0); + } + if (curthread->nwaiter_defer > 0) { + _thr_wake_all(curthread->defer_waiters, + curthread->nwaiter_defer); + curthread->nwaiter_defer = 0; + } if (cancel) { _thr_cancel_enter2(curthread, 0); Modified: head/lib/libthr/thread/thr_kern.c ============================================================================== --- head/lib/libthr/thread/thr_kern.c Sat Aug 11 22:39:27 2012 (r239199) +++ head/lib/libthr/thread/thr_kern.c Sat Aug 11 23:17:02 2012 (r239200) @@ -199,13 +199,6 @@ _thr_sleep(struct pthread *curthread, in const struct timespec *abstime) { - curthread->will_sleep = 0; - if (curthread->nwaiter_defer > 0) { - _thr_wake_all(curthread->defer_waiters, - curthread->nwaiter_defer); - curthread->nwaiter_defer = 0; - } - if (curthread->wake_addr->value != 0) return (0); Modified: head/lib/libthr/thread/thr_mutex.c ============================================================================== --- head/lib/libthr/thread/thr_mutex.c Sat Aug 11 22:39:27 2012 (r239199) +++ head/lib/libthr/thread/thr_mutex.c Sat Aug 11 23:17:02 2012 (r239200) @@ -92,7 +92,7 @@ int __pthread_mutex_setyieldloops_np(pth static int mutex_self_trylock(pthread_mutex_t); static int mutex_self_lock(pthread_mutex_t, const struct timespec *abstime); -static int mutex_unlock_common(struct pthread_mutex *, int); +static int mutex_unlock_common(struct pthread_mutex *, int, int *); static int mutex_lock_sleep(struct pthread *, pthread_mutex_t, const struct timespec *); @@ -461,7 +461,7 @@ _pthread_mutex_unlock(pthread_mutex_t *m struct pthread_mutex *mp; mp = *mutex; - return (mutex_unlock_common(mp, 0)); + return (mutex_unlock_common(mp, 0, NULL)); } int @@ -476,7 +476,7 @@ _mutex_cv_lock(struct pthread_mutex *m, } int -_mutex_cv_unlock(struct pthread_mutex *m, int *count) +_mutex_cv_unlock(struct pthread_mutex *m, int *count, int *defer) { /* @@ -484,7 +484,7 @@ _mutex_cv_unlock(struct pthread_mutex *m */ *count = m->m_count; m->m_count = 0; - (void)mutex_unlock_common(m, 1); + (void)mutex_unlock_common(m, 1, defer); return (0); } @@ -629,7 +629,7 @@ mutex_self_lock(struct pthread_mutex *m, } static int -mutex_unlock_common(struct pthread_mutex *m, int cv) +mutex_unlock_common(struct pthread_mutex *m, int cv, int *mtx_defer) { struct pthread *curthread = _get_curthread(); uint32_t id; @@ -657,12 +657,12 @@ mutex_unlock_common(struct pthread_mutex defered = 1; m->m_flags &= ~PMUTEX_FLAG_DEFERED; } else - defered = 0; + defered = 0; DEQUEUE_MUTEX(curthread, m); - _thr_umutex_unlock(&m->m_lock, id); + _thr_umutex_unlock2(&m->m_lock, id, mtx_defer); - if (curthread->will_sleep == 0 && defered) { + if (mtx_defer == NULL && defered) { _thr_wake_all(curthread->defer_waiters, curthread->nwaiter_defer); curthread->nwaiter_defer = 0; Modified: head/lib/libthr/thread/thr_private.h ============================================================================== --- head/lib/libthr/thread/thr_private.h Sat Aug 11 22:39:27 2012 (r239199) +++ head/lib/libthr/thread/thr_private.h Sat Aug 11 23:17:02 2012 (r239200) @@ -727,10 +727,10 @@ extern struct umutex _thr_event_lock __h */ __BEGIN_DECLS int _thr_setthreaded(int) __hidden; -int _mutex_cv_lock(struct pthread_mutex *, int count) __hidden; -int _mutex_cv_unlock(struct pthread_mutex *, int *count) __hidden; -int _mutex_cv_attach(struct pthread_mutex *, int count) __hidden; -int _mutex_cv_detach(struct pthread_mutex *, int *count) __hidden; +int _mutex_cv_lock(struct pthread_mutex *, int) __hidden; +int _mutex_cv_unlock(struct pthread_mutex *, int *, int *) __hidden; +int _mutex_cv_attach(struct pthread_mutex *, int) __hidden; +int _mutex_cv_detach(struct pthread_mutex *, int *) __hidden; int _mutex_owned(struct pthread *, const struct pthread_mutex *) __hidden; int _mutex_reinit(pthread_mutex_t *) __hidden; void _mutex_fork(struct pthread *curthread) __hidden; Modified: head/lib/libthr/thread/thr_umtx.h ============================================================================== --- head/lib/libthr/thread/thr_umtx.h Sat Aug 11 22:39:27 2012 (r239199) +++ head/lib/libthr/thread/thr_umtx.h Sat Aug 11 23:17:02 2012 (r239200) @@ -120,7 +120,7 @@ _thr_umutex_timedlock(struct umutex *mtx } static inline int -_thr_umutex_unlock(struct umutex *mtx, uint32_t id) +_thr_umutex_unlock2(struct umutex *mtx, uint32_t id, int *defer) { uint32_t flags = mtx->m_flags; @@ -132,8 +132,12 @@ _thr_umutex_unlock(struct umutex *mtx, u return (EPERM); } while (__predict_false(!atomic_cmpset_rel_32(&mtx->m_owner, owner, UMUTEX_UNOWNED))); - if ((owner & UMUTEX_CONTESTED)) - (void)_umtx_op_err(mtx, UMTX_OP_MUTEX_WAKE2, flags, 0, 0); + if ((owner & UMUTEX_CONTESTED)) { + if (defer == NULL) + (void)_umtx_op_err(mtx, UMTX_OP_MUTEX_WAKE2, flags, 0, 0); + else + *defer = 1; + } return (0); } if (atomic_cmpset_rel_32(&mtx->m_owner, id, UMUTEX_UNOWNED)) @@ -142,6 +146,12 @@ _thr_umutex_unlock(struct umutex *mtx, u } static inline int +_thr_umutex_unlock(struct umutex *mtx, uint32_t id) +{ + return _thr_umutex_unlock2(mtx, id, NULL); +} + +static inline int _thr_rwlock_tryrdlock(struct urwlock *rwlock, int flags) { int32_t state; From owner-svn-src-head@FreeBSD.ORG Sat Aug 11 23:26:20 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2028C106564A; Sat, 11 Aug 2012 23:26:20 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F389C8FC15; Sat, 11 Aug 2012 23:26: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 q7BNQJnq011178; Sat, 11 Aug 2012 23:26:19 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7BNQJtQ011174; Sat, 11 Aug 2012 23:26:19 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201208112326.q7BNQJtQ011174@svn.freebsd.org> From: Adrian Chadd Date: Sat, 11 Aug 2012 23:26:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239201 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2012 23:26:20 -0000 Author: adrian Date: Sat Aug 11 23:26:19 2012 New Revision: 239201 URL: http://svn.freebsd.org/changeset/base/239201 Log: Extend the beacon code slightly to support AP mode beaconing for the EDMA HAL hardware. * The EDMA HAL code assumes the nexttbtt and intval values are in TU/8 units, rather than TU. For now, just "hack" around that here, at least until I code up something to translate it in the HAL. * Setup some different TXQ flags for EDMA hardware. * The EDMA HAL doesn't support setting the first rate series via ath_hal_setuptxdesc() - instead, a call to ath_hal_set11nratescenario() is always required. So for now, just do an 11n rate series setup for EDMA beacon frames. This allows my AR9380 to successfully transmit beacon frames. However, CABQ TX and all normal data frame TX and TX completion is still not functional and will require some more significant code churn to make work. Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_ath_beacon.c head/sys/dev/ath/if_ath_beacon.h Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Sat Aug 11 23:17:02 2012 (r239200) +++ head/sys/dev/ath/if_ath.c Sat Aug 11 23:26:19 2012 (r239201) @@ -443,7 +443,7 @@ ath_attach(u_int16_t devid, struct ath_s * * XXX PS-Poll */ - sc->sc_bhalq = ath_beaconq_setup(ah); + sc->sc_bhalq = ath_beaconq_setup(sc); if (sc->sc_bhalq == (u_int) -1) { if_printf(ifp, "unable to setup a beacon xmit queue!\n"); error = EIO; Modified: head/sys/dev/ath/if_ath_beacon.c ============================================================================== --- head/sys/dev/ath/if_ath_beacon.c Sat Aug 11 23:17:02 2012 (r239200) +++ head/sys/dev/ath/if_ath_beacon.c Sat Aug 11 23:26:19 2012 (r239201) @@ -108,8 +108,9 @@ __FBSDID("$FreeBSD$"); * Setup a h/w transmit queue for beacons. */ int -ath_beaconq_setup(struct ath_hal *ah) +ath_beaconq_setup(struct ath_softc *sc) { + struct ath_hal *ah = sc->sc_ah; HAL_TXQ_INFO qi; memset(&qi, 0, sizeof(qi)); @@ -118,6 +119,10 @@ ath_beaconq_setup(struct ath_hal *ah) qi.tqi_cwmax = HAL_TXQ_USEDEFAULT; /* NB: for dynamic turbo, don't enable any other interrupts */ qi.tqi_qflags = HAL_TXQ_TXDESCINT_ENABLE; + if (sc->sc_isedma) + qi.tqi_qflags |= HAL_TXQ_TXOKINT_ENABLE | + HAL_TXQ_TXERRINT_ENABLE; + return ath_hal_setuptxqueue(ah, HAL_TX_QUEUE_BEACON, &qi); } @@ -268,6 +273,7 @@ ath_beacon_setup(struct ath_softc *sc, s u_int8_t rix, rate; HAL_DMA_ADDR bufAddrList[4]; uint32_t segLenList[4]; + HAL_11N_RATE_SERIES rc[4]; DPRINTF(sc, ATH_DEBUG_BEACON_PROC, "%s: m %p len %u\n", __func__, m, m->m_len); @@ -324,6 +330,26 @@ ath_beacon_setup(struct ath_softc *sc, s , 0 /* rts/cts rate */ , 0 /* rts/cts duration */ ); + + /* + * The EDMA HAL currently assumes that _all_ rate control + * settings are done in ath_hal_set11nratescenario(), rather + * than in ath_hal_setuptxdesc(). + */ + if (sc->sc_isedma) { + memset(&rc, 0, sizeof(rc)); + + rc[0].ChSel = sc->sc_txchainmask; + rc[0].Tries = 1; + rc[0].Rate = rt->info[rix].rateCode; + rc[0].RateIndex = rix; + rc[0].tx_power_cap = 0x3f; + rc[0].PktDuration = + ath_hal_computetxtime(ah, rt, roundup(m->m_len, 4), + rix, 0); + ath_hal_set11nratescenario(ah, ds, 0, 0, rc, 4, flags); + } + /* NB: beacon's BufLen must be a multiple of 4 bytes */ segLenList[0] = roundup(m->m_len, 4); segLenList[1] = segLenList[2] = segLenList[3] = 0; @@ -458,12 +484,15 @@ ath_beacon_proc(void *arg, int pending) * This should never fail since we check above that no frames * are still pending on the queue. */ - if (!ath_hal_stoptxdma(ah, sc->sc_bhalq)) { - DPRINTF(sc, ATH_DEBUG_ANY, - "%s: beacon queue %u did not stop?\n", - __func__, sc->sc_bhalq); + if (! sc->sc_isedma) { + if (!ath_hal_stoptxdma(ah, sc->sc_bhalq)) { + DPRINTF(sc, ATH_DEBUG_ANY, + "%s: beacon queue %u did not stop?\n", + __func__, sc->sc_bhalq); + } } /* NB: cabq traffic should already be queued and primed */ + ath_hal_puttxbuf(ah, sc->sc_bhalq, bfaddr); ath_hal_txstart(ah, sc->sc_bhalq); @@ -673,6 +702,7 @@ ath_beacon_config(struct ath_softc *sc, struct ieee80211com *ic = sc->sc_ifp->if_l2com; struct ieee80211_node *ni; u_int32_t nexttbtt, intval, tsftu; + u_int32_t nexttbtt_u8, intval_u8; u_int64_t tsf; if (vap == NULL) @@ -836,7 +866,21 @@ ath_beacon_config(struct ath_softc *sc, sc->sc_imask |= HAL_INT_SWBA; /* beacon prepare */ ath_beaconq_config(sc); } - ath_hal_beaconinit(ah, nexttbtt, intval); + + /* + * Now dirty things because for now, the EDMA HAL has + * nexttbtt and intval is TU/8. + */ + if (sc->sc_isedma) { + nexttbtt_u8 = (nexttbtt << 3); + intval_u8 = (intval << 3); + if (intval & HAL_BEACON_ENA) + intval_u8 |= HAL_BEACON_ENA; + if (intval & HAL_BEACON_RESET_TSF) + intval_u8 |= HAL_BEACON_RESET_TSF; + ath_hal_beaconinit(ah, nexttbtt_u8, intval_u8); + } else + ath_hal_beaconinit(ah, nexttbtt, intval); sc->sc_bmisscount = 0; ath_hal_intrset(ah, sc->sc_imask); /* Modified: head/sys/dev/ath/if_ath_beacon.h ============================================================================== --- head/sys/dev/ath/if_ath_beacon.h Sat Aug 11 23:17:02 2012 (r239200) +++ head/sys/dev/ath/if_ath_beacon.h Sat Aug 11 23:26:19 2012 (r239201) @@ -33,7 +33,7 @@ extern int ath_bstuck_threshold; -extern int ath_beaconq_setup(struct ath_hal *ah); +extern int ath_beaconq_setup(struct ath_softc *sc); extern int ath_beaconq_config(struct ath_softc *sc); extern void ath_beacon_config(struct ath_softc *sc, struct ieee80211vap *vap); From owner-svn-src-head@FreeBSD.ORG Sat Aug 11 23:48:40 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6E54C106566C; Sat, 11 Aug 2012 23:48:40 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 03F898FC0A; Sat, 11 Aug 2012 23:48: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 q7BNmd4C013052; Sat, 11 Aug 2012 23:48:39 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7BNmdXq013050; Sat, 11 Aug 2012 23:48:39 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201208112348.q7BNmdXq013050@svn.freebsd.org> From: David Xu Date: Sat, 11 Aug 2012 23:48:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239202 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2012 23:48:40 -0000 Author: davidxu Date: Sat Aug 11 23:48:39 2012 New Revision: 239202 URL: http://svn.freebsd.org/changeset/base/239202 Log: Some style fixes inspired by @bde. Modified: head/sys/kern/kern_umtx.c Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Sat Aug 11 23:26:19 2012 (r239201) +++ head/sys/kern/kern_umtx.c Sat Aug 11 23:48:39 2012 (r239202) @@ -587,7 +587,7 @@ abs_timeout_init2(struct abs_timeout *ti &umtxtime->_timeout); } -static void +static inline void abs_timeout_update(struct abs_timeout *timo) { kern_clock_gettime(curthread, timo->clockid, &timo->cur); @@ -598,10 +598,10 @@ abs_timeout_gethz(struct abs_timeout *ti { struct timespec tts; + if (timespeccmp(&timo->end, &timo->cur, <=)) + return (-1); tts = timo->end; timespecsub(&tts, &timo->cur); - if (tts.tv_sec < 0 || (tts.tv_sec == 0 && tts.tv_nsec == 0)) - return (-1); return (tstohz(&tts)); } @@ -610,29 +610,29 @@ abs_timeout_gethz(struct abs_timeout *ti * thread was removed from umtx queue. */ static inline int -umtxq_sleep(struct umtx_q *uq, const char *wmesg, struct abs_timeout *timo) +umtxq_sleep(struct umtx_q *uq, const char *wmesg, struct abs_timeout *abstime) { struct umtxq_chain *uc; - int error; - int pulse; + int error, timo; uc = umtxq_getchain(&uq->uq_key); UMTXQ_LOCKED_ASSERT(uc); for (;;) { if (!(uq->uq_flags & UQF_UMTXQ)) return (0); - if (timo != NULL) { - pulse = abs_timeout_gethz(timo); - if (pulse < 0) + if (abstime != NULL) { + timo = abs_timeout_gethz(abstime); + if (timo < 0) return (ETIMEDOUT); } else - pulse = 0; - error = msleep(uq, &uc->uc_lock, PCATCH|PDROP, wmesg, pulse); + timo = 0; + error = msleep(uq, &uc->uc_lock, PCATCH | PDROP, wmesg, timo); if (error != EWOULDBLOCK) { umtxq_lock(&uq->uq_key); break; } - abs_timeout_update(timo); + if (abstime != NULL) + abs_timeout_update(abstime); umtxq_lock(&uq->uq_key); } return (error);