From owner-svn-src-user@FreeBSD.ORG Sun Jun 20 22:37:24 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD97D106566B; Sun, 20 Jun 2010 22:37:24 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BD7AF8FC16; Sun, 20 Jun 2010 22:37:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5KMbOgm037203; Sun, 20 Jun 2010 22:37:24 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5KMbOGf037201; Sun, 20 Jun 2010 22:37:24 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006202237.o5KMbOGf037201@svn.freebsd.org> From: Juli Mallett Date: Sun, 20 Jun 2010 22:37:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209372 - user/jmallett/octeon/sys/mips/cavium/usb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jun 2010 22:37:24 -0000 Author: jmallett Date: Sun Jun 20 22:37:24 2010 New Revision: 209372 URL: http://svn.freebsd.org/changeset/base/209372 Log: Actually, the maximum number of USB ports is 2. Clamp that down to 1 for now because we only support the first interrupt. Modified: user/jmallett/octeon/sys/mips/cavium/usb/octusb.h Modified: user/jmallett/octeon/sys/mips/cavium/usb/octusb.h ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/usb/octusb.h Sun Jun 20 21:33:29 2010 (r209371) +++ user/jmallett/octeon/sys/mips/cavium/usb/octusb.h Sun Jun 20 22:37:24 2010 (r209372) @@ -29,7 +29,14 @@ #define _OCTUSB_H_ #define OCTUSB_MAX_DEVICES MIN(USB_MAX_DEVICES, 64) -#define OCTUSB_MAX_PORTS 7 /* hardcoded */ +/* + * The second port is on a different IRQ and so we disable it for now. + */ +#if 1 +#define OCTUSB_MAX_PORTS 1 /* hardcoded */ +#else +#define OCTUSB_MAX_PORTS 2 /* hardcoded */ +#endif #define OCTUSB_MAX_FIXUP 4096 /* bytes */ #define OCTUSB_INTR_ENDPT 0x01 From owner-svn-src-user@FreeBSD.ORG Sun Jun 20 22:40:46 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D992106566B; Sun, 20 Jun 2010 22:40:46 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 62DD88FC0C; Sun, 20 Jun 2010 22:40:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5KMekmv038024; Sun, 20 Jun 2010 22:40:46 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5KMekAp038022; Sun, 20 Jun 2010 22:40:46 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006202240.o5KMekAp038022@svn.freebsd.org> From: Juli Mallett Date: Sun, 20 Jun 2010 22:40:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209373 - user/jmallett/octeon/sys/mips/cavium/usb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jun 2010 22:40:46 -0000 Author: jmallett Date: Sun Jun 20 22:40:46 2010 New Revision: 209373 URL: http://svn.freebsd.org/changeset/base/209373 Log: Add a bus front-end to hps's Octeon USB controller based on his at91 front-end. Added: user/jmallett/octeon/sys/mips/cavium/usb/octusb_octeon.c Added: user/jmallett/octeon/sys/mips/cavium/usb/octusb_octeon.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/jmallett/octeon/sys/mips/cavium/usb/octusb_octeon.c Sun Jun 20 22:40:46 2010 (r209373) @@ -0,0 +1,223 @@ +#include +__FBSDID("$FreeBSD: user/jmallett/octeon/sys/dev/usb/controller/octusb_atmelarm.c 196219 2009-08-14 20:03:53Z jhb $"); + +/*- + * Copyright (c) 2007-2008 Hans Petter Selasky. 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include + +#define MEM_RID 0 + +static device_identify_t octusb_octeon_identify; +static device_probe_t octusb_octeon_probe; +static device_attach_t octusb_octeon_attach; +static device_detach_t octusb_octeon_detach; +static device_shutdown_t octusb_octeon_shutdown; + +struct octusb_octeon_softc { + struct octusb_softc sc_dci; /* must be first */ +}; + +static void +octusb_octeon_identify(driver_t *drv, device_t parent) +{ + if (octeon_has_feature(OCTEON_FEATURE_USB)) + BUS_ADD_CHILD(parent, 0, "octusb", 0); +} + +static int +octusb_octeon_probe(device_t dev) +{ + device_set_desc(dev, "Cavium Octeon USB controller"); + return (0); +} + +static int +octusb_octeon_attach(device_t dev) +{ + struct octusb_octeon_softc *sc = device_get_softc(dev); + int err; + int rid; + + /* setup controller interface softc */ + + /* initialise some bus fields */ + sc->sc_dci.sc_bus.parent = dev; + sc->sc_dci.sc_bus.devices = sc->sc_dci.sc_devices; + sc->sc_dci.sc_bus.devices_max = OCTUSB_MAX_DEVICES; + + /* get all DMA memory */ + if (usb_bus_mem_alloc_all(&sc->sc_dci.sc_bus, + USB_GET_DMA_TAG(dev), NULL)) { + return (ENOMEM); + } + rid = 0; + sc->sc_dci.sc_irq_res = + bus_alloc_resource(dev, SYS_RES_IRQ, &rid, + CVMX_IRQ_USB, CVMX_IRQ_USB, 1, RF_ACTIVE); + if (!(sc->sc_dci.sc_irq_res)) { + goto error; + } + + sc->sc_dci.sc_bus.bdev = device_add_child(dev, "usbus", -1); + if (!(sc->sc_dci.sc_bus.bdev)) { + goto error; + } + device_set_ivars(sc->sc_dci.sc_bus.bdev, &sc->sc_dci.sc_bus); + +#if (__FreeBSD_version >= 700031) + err = bus_setup_intr(dev, sc->sc_dci.sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, + NULL, (driver_intr_t *)octusb_interrupt, sc, &sc->sc_dci.sc_intr_hdl); +#else + err = bus_setup_intr(dev, sc->sc_dci.sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, + (driver_intr_t *)octusb_interrupt, sc, &sc->sc_dci.sc_intr_hdl); +#endif + if (err) { + sc->sc_dci.sc_intr_hdl = NULL; + goto error; + } + err = octusb_init(&sc->sc_dci); + if (!err) { + err = device_probe_and_attach(sc->sc_dci.sc_bus.bdev); + } + if (err) { + goto error; + } + return (0); + +error: + octusb_octeon_detach(dev); + return (ENXIO); +} + +static int +octusb_octeon_detach(device_t dev) +{ + struct octusb_octeon_softc *sc = device_get_softc(dev); + device_t bdev; + int err; + + if (sc->sc_dci.sc_bus.bdev) { + bdev = sc->sc_dci.sc_bus.bdev; + device_detach(bdev); + device_delete_child(dev, bdev); + } + /* during module unload there are lots of children leftover */ + device_delete_all_children(dev); + + if (sc->sc_dci.sc_irq_res && sc->sc_dci.sc_intr_hdl) { + /* + * only call octusb_octeon_uninit() after octusb_octeon_init() + */ + octusb_uninit(&sc->sc_dci); + + err = bus_teardown_intr(dev, sc->sc_dci.sc_irq_res, + sc->sc_dci.sc_intr_hdl); + sc->sc_dci.sc_intr_hdl = NULL; + } + if (sc->sc_dci.sc_irq_res) { + bus_release_resource(dev, SYS_RES_IRQ, 0, + sc->sc_dci.sc_irq_res); + sc->sc_dci.sc_irq_res = NULL; + } + usb_bus_mem_free_all(&sc->sc_dci.sc_bus, NULL); + + return (0); +} + +static int +octusb_octeon_shutdown(device_t dev) +{ + struct octusb_octeon_softc *sc = device_get_softc(dev); + int err; + + err = bus_generic_shutdown(dev); + if (err) + return (err); + + octusb_uninit(&sc->sc_dci); + + return (0); +} + +static device_method_t octusb_octeon_methods[] = { + /* Device interface */ + DEVMETHOD(device_identify, octusb_octeon_identify), + DEVMETHOD(device_probe, octusb_octeon_probe), + DEVMETHOD(device_attach, octusb_octeon_attach), + DEVMETHOD(device_detach, octusb_octeon_detach), + DEVMETHOD(device_shutdown, octusb_octeon_shutdown), + + /* Bus interface */ + DEVMETHOD(bus_print_child, bus_generic_print_child), + + {0, 0} +}; + +static driver_t octusb_octeon_driver = { + "octusb", + octusb_octeon_methods, + sizeof(struct octusb_octeon_softc), +}; + +static devclass_t octusb_octeon_devclass; + +DRIVER_MODULE(octusb, ciu, octusb_octeon_driver, octusb_octeon_devclass, 0, 0); From owner-svn-src-user@FreeBSD.ORG Sun Jun 20 22:54:43 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18D971065672; Sun, 20 Jun 2010 22:54:43 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0899F8FC24; Sun, 20 Jun 2010 22:54:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5KMsgU0041132; Sun, 20 Jun 2010 22:54:42 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5KMsfE2041131; Sun, 20 Jun 2010 22:54:41 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006202254.o5KMsfE2041131@svn.freebsd.org> From: Juli Mallett Date: Sun, 20 Jun 2010 22:54:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209374 - user/jmallett/octeon/sys/mips/cavium/usb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jun 2010 22:54:43 -0000 Author: jmallett Date: Sun Jun 20 22:54:41 2010 New Revision: 209374 URL: http://svn.freebsd.org/changeset/base/209374 Log: DPRINTF -> DPRINTFN where a level is specified. Modified: user/jmallett/octeon/sys/mips/cavium/usb/octusb.c Modified: user/jmallett/octeon/sys/mips/cavium/usb/octusb.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/usb/octusb.c Sun Jun 20 22:40:46 2010 (r209373) +++ user/jmallett/octeon/sys/mips/cavium/usb/octusb.c Sun Jun 20 22:54:41 2010 (r209374) @@ -337,7 +337,7 @@ octusb_host_control_data_tx(struct octus if (td->remainder > rem) { td->error_any = 1; - DPRINTF(1, "Excess setup transmit data\n"); + DPRINTFN(1, "Excess setup transmit data\n"); return (0); /* done */ } usbd_copy_out(td->pc, td->offset, td->qh->fixup_buf + td->qh->fixup_off, td->remainder); @@ -462,7 +462,7 @@ octusb_non_control_data_tx(struct octusb if (rem == 0) { /* should not happen */ - DPRINTF(1, "Fixup buffer is too small\n"); + DPRINTFN(1, "Fixup buffer is too small\n"); td->error_any = 1; return (0); /* done */ } @@ -590,7 +590,7 @@ octusb_non_control_data_rx(struct octusb if (rem == 0) { /* should not happen */ - DPRINTF(1, "Fixup buffer is too small\n"); + DPRINTFN(1, "Fixup buffer is too small\n"); td->error_any = 1; return (0); /* done */ } From owner-svn-src-user@FreeBSD.ORG Sun Jun 20 23:12:46 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 42DC2106566B; Sun, 20 Jun 2010 23:12:46 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3290A8FC17; Sun, 20 Jun 2010 23:12:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5KNCkgm045163; Sun, 20 Jun 2010 23:12:46 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5KNCk5Y045161; Sun, 20 Jun 2010 23:12:46 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006202312.o5KNCk5Y045161@svn.freebsd.org> From: Juli Mallett Date: Sun, 20 Jun 2010 23:12:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209375 - user/jmallett/octeon/sys/dev/usb/controller X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jun 2010 23:12:46 -0000 Author: jmallett Date: Sun Jun 20 23:12:45 2010 New Revision: 209375 URL: http://svn.freebsd.org/changeset/base/209375 Log: Add a usbus attachment to octusb. Modified: user/jmallett/octeon/sys/dev/usb/controller/usb_controller.c Modified: user/jmallett/octeon/sys/dev/usb/controller/usb_controller.c ============================================================================== --- user/jmallett/octeon/sys/dev/usb/controller/usb_controller.c Sun Jun 20 22:54:41 2010 (r209374) +++ user/jmallett/octeon/sys/dev/usb/controller/usb_controller.c Sun Jun 20 23:12:45 2010 (r209375) @@ -108,6 +108,7 @@ DRIVER_MODULE(usbus, uhci, usb_driver, u DRIVER_MODULE(usbus, ehci, usb_driver, usb_devclass, 0, 0); DRIVER_MODULE(usbus, at91_udp, usb_driver, usb_devclass, 0, 0); DRIVER_MODULE(usbus, uss820, usb_driver, usb_devclass, 0, 0); +DRIVER_MODULE(usbus, octusb, usb_driver, usb_devclass, 0, 0); /*------------------------------------------------------------------------* * usb_probe From owner-svn-src-user@FreeBSD.ORG Sun Jun 20 23:41:29 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 864BB106566C; Sun, 20 Jun 2010 23:41:29 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 75E308FC1B; Sun, 20 Jun 2010 23:41:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5KNfT5D051486; Sun, 20 Jun 2010 23:41:29 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5KNfT1S051484; Sun, 20 Jun 2010 23:41:29 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006202341.o5KNfT1S051484@svn.freebsd.org> From: Juli Mallett Date: Sun, 20 Jun 2010 23:41:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209376 - user/jmallett/octeon/sys/mips/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jun 2010 23:41:29 -0000 Author: jmallett Date: Sun Jun 20 23:41:29 2010 New Revision: 209376 URL: http://svn.freebsd.org/changeset/base/209376 Log: Temporarily disable octusb since it's hanging root mount. Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-32 ============================================================================== --- user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Sun Jun 20 23:12:45 2010 (r209375) +++ user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Sun Jun 20 23:41:29 2010 (r209376) @@ -101,7 +101,7 @@ device uhci # UHCI PCI->USB interface device ohci # OHCI PCI->USB interface device ehci # EHCI PCI->USB interface (USB 2.0) device usb # USB Bus (required) -device octusb # Cavium Octeon USB Bus +#device octusb # Cavium Octeon USB Bus # ATA and ATAPI devices device ata From owner-svn-src-user@FreeBSD.ORG Sun Jun 20 23:42:15 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 470BA1065702; Sun, 20 Jun 2010 23:42:15 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 36E448FC13; Sun, 20 Jun 2010 23:42:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5KNgF51051693; Sun, 20 Jun 2010 23:42:15 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5KNgFM3051691; Sun, 20 Jun 2010 23:42:15 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006202342.o5KNgFM3051691@svn.freebsd.org> From: Juli Mallett Date: Sun, 20 Jun 2010 23:42:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209377 - user/jmallett/octeon/sys/mips/cavium X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jun 2010 23:42:15 -0000 Author: jmallett Date: Sun Jun 20 23:42:14 2010 New Revision: 209377 URL: http://svn.freebsd.org/changeset/base/209377 Log: Whoops; add missed update to files listing for octusb bus attachment. Modified: user/jmallett/octeon/sys/mips/cavium/files.octeon1 Modified: user/jmallett/octeon/sys/mips/cavium/files.octeon1 ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/files.octeon1 Sun Jun 20 23:41:29 2010 (r209376) +++ user/jmallett/octeon/sys/mips/cavium/files.octeon1 Sun Jun 20 23:42:14 2010 (r209377) @@ -37,6 +37,7 @@ mips/cavium/octopci.c optional pci mips/cavium/octopci_bus_space.c optional pci mips/cavium/usb/octusb.c optional usb octusb +mips/cavium/usb/octusb_octeon.c optional usb octusb contrib/octeon-sdk/cvmx-cmd-queue.c optional octe contrib/octeon-sdk/cvmx-fpa.c optional octe From owner-svn-src-user@FreeBSD.ORG Mon Jun 21 00:49:24 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12030106564A; Mon, 21 Jun 2010 00:49:24 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F41218FC15; Mon, 21 Jun 2010 00:49:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5L0nNBo066512; Mon, 21 Jun 2010 00:49:23 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5L0nNEt066508; Mon, 21 Jun 2010 00:49:23 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006210049.o5L0nNEt066508@svn.freebsd.org> From: Juli Mallett Date: Mon, 21 Jun 2010 00:49:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209379 - user/jmallett/octeon/sys/mips/cavium/cryptocteon X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jun 2010 00:49:24 -0000 Author: jmallett Date: Mon Jun 21 00:49:23 2010 New Revision: 209379 URL: http://svn.freebsd.org/changeset/base/209379 Log: o) Add a device attachment. o) Move some globals into device softc. o) Make compile. o) Some cosmetic cleanups. Modified: user/jmallett/octeon/sys/mips/cavium/cryptocteon/cavium_crypto.c user/jmallett/octeon/sys/mips/cavium/cryptocteon/cryptocteon.c user/jmallett/octeon/sys/mips/cavium/cryptocteon/cryptocteonvar.h Modified: user/jmallett/octeon/sys/mips/cavium/cryptocteon/cavium_crypto.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/cryptocteon/cavium_crypto.c Sun Jun 20 23:45:19 2010 (r209378) +++ user/jmallett/octeon/sys/mips/cavium/cryptocteon/cavium_crypto.c Mon Jun 21 00:49:23 2010 (r209379) @@ -65,8 +65,6 @@ __FBSDID("$FreeBSD$"); struct octeon_cop2_state { }; -#define dprintf printf - static inline unsigned long octeon_crypto_enable(struct octeon_cop2_state *state) { return (0); Modified: user/jmallett/octeon/sys/mips/cavium/cryptocteon/cryptocteon.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/cryptocteon/cryptocteon.c Sun Jun 20 23:45:19 2010 (r209378) +++ user/jmallett/octeon/sys/mips/cavium/cryptocteon/cryptocteon.c Mon Jun 21 00:49:23 2010 (r209379) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -40,70 +41,62 @@ __FBSDID("$FreeBSD$"); #include -struct { - softc_device_decl sc_dev; -} octo_softc; - -struct octo_sess { - int octo_encalg; - #define MAX_CIPHER_KEYLEN 64 - char octo_enckey[MAX_CIPHER_KEYLEN]; - int octo_encklen; - - int octo_macalg; - #define MAX_HASH_KEYLEN 64 - char octo_mackey[MAX_HASH_KEYLEN]; - int octo_macklen; - int octo_mackey_set; - - int octo_mlen; - int octo_ivsize; - - int (*octo_encrypt)(struct octo_sess *od, - const uint8_t *buf, int buflen, - int auth_off, int auth_len, - int crypt_off, int crypt_len, - int icv_off, uint8_t *ivp); - int (*octo_decrypt)(struct octo_sess *od, - const uint8_t *buf, int buflen, - int auth_off, int auth_len, - int crypt_off, int crypt_len, - int icv_off, uint8_t *ivp); +#include - uint64_t octo_hminner[3]; - uint64_t octo_hmouter[3]; +#include "cryptodev_if.h" + +struct cryptocteon_softc { + int32_t sc_cid; /* opencrypto id */ + struct octo_sess **sc_sessions; + uint32_t sc_sesnum; }; -int32_t octo_id = -1; -#if 0 -module_param(octo_id, int, 0444); -MODULE_PARM_DESC(octo_id, "Read-Only OCF ID for cryptocteon driver"); -#endif +static void cryptocteon_identify(driver_t *, device_t); +static int cryptocteon_probe(device_t); +static int cryptocteon_attach(device_t); + +static int cryptocteon_process(device_t, struct cryptop *, int); +static int cryptocteon_newsession(device_t, u_int32_t *, struct cryptoini *); +static int cryptocteon_freesession(device_t, u_int64_t); -static struct octo_sess **octo_sessions = NULL; -static u_int32_t octo_sesnum = 0; +int cryptocteon_debug = 0; +TUNABLE_INT("hw.cryptocteon.debug", &cryptocteon_debug); -static int octo_process(device_t, struct cryptop *, int); -static int octo_newsession(device_t, u_int32_t *, struct cryptoini *); -static int octo_freesession(device_t, u_int64_t); +static void +cryptocteon_identify(driver_t *drv, device_t parent) +{ + if (octeon_has_feature(OCTEON_FEATURE_CRYPTO)) + BUS_ADD_CHILD(parent, 0, "cryptocteon", 0); +} -static device_method_t octo_methods = { - /* crypto device methods */ - DEVMETHOD(cryptodev_newsession, octo_newsession), - DEVMETHOD(cryptodev_freesession,octo_freesession), - DEVMETHOD(cryptodev_process, octo_process), -}; +static int +cryptocteon_probe(device_t dev) +{ + device_set_desc(dev, "Octeon Secure Coprocessor"); + return (0); +} -int octo_debug = 0; -#if 0 -module_param(octo_debug, int, 0644); -MODULE_PARM_DESC(octo_debug, "Enable debug"); -#endif +static int +cryptocteon_attach(device_t dev) +{ + struct cryptocteon_softc *sc; -#define dprintf printf + sc = device_get_softc(dev); -#include "cavium_crypto.c" + sc->sc_cid = crypto_get_driverid(dev, CRYPTOCAP_F_HARDWARE | CRYPTOCAP_F_SYNC); + if (sc->sc_cid < 0) { + device_printf(dev, "crypto_get_driverid ret %d\n", sc->sc_cid); + return (ENXIO); + } + crypto_register(sc->sc_cid, CRYPTO_MD5_HMAC, 0, 0); + crypto_register(sc->sc_cid, CRYPTO_SHA1_HMAC, 0, 0); + crypto_register(sc->sc_cid, CRYPTO_DES_CBC, 0, 0); + crypto_register(sc->sc_cid, CRYPTO_3DES_CBC, 0, 0); + crypto_register(sc->sc_cid, CRYPTO_AES_CBC, 0, 0); + + return (0); +} /* * Generate a new octo session. We artifically limit it to a single @@ -111,17 +104,17 @@ MODULE_PARM_DESC(octo_debug, "Enable deb * do not expect more than this anyway. */ static int -octo_newsession(device_t dev, u_int32_t *sid, struct cryptoini *cri) +cryptocteon_newsession(device_t dev, u_int32_t *sid, struct cryptoini *cri) { struct cryptoini *c, *encini = NULL, *macini = NULL; + struct cryptocteon_softc *sc; struct octo_sess **ocd; int i; - dprintf("%s()\n", __FUNCTION__); - if (sid == NULL || cri == NULL) { - dprintf("%s,%d - EINVAL\n", __FILE__, __LINE__); - return EINVAL; - } + sc = device_get_softc(dev); + + if (sid == NULL || cri == NULL || sc == NULL) + return (EINVAL); /* * To keep it simple, we only handle hash, cipher or hash/cipher in a @@ -131,17 +124,17 @@ octo_newsession(device_t dev, u_int32_t */ for (i = 0, c = cri; c && i < 2; i++) { if (c->cri_alg == CRYPTO_MD5_HMAC || - c->cri_alg == CRYPTO_SHA1_HMAC || - c->cri_alg == CRYPTO_NULL_HMAC) { + c->cri_alg == CRYPTO_SHA1_HMAC || + c->cri_alg == CRYPTO_NULL_HMAC) { if (macini) { break; } macini = c; } if (c->cri_alg == CRYPTO_DES_CBC || - c->cri_alg == CRYPTO_3DES_CBC || - c->cri_alg == CRYPTO_AES_CBC || - c->cri_alg == CRYPTO_NULL_CBC) { + c->cri_alg == CRYPTO_3DES_CBC || + c->cri_alg == CRYPTO_AES_CBC || + c->cri_alg == CRYPTO_NULL_CBC) { if (encini) { break; } @@ -164,49 +157,49 @@ octo_newsession(device_t dev, u_int32_t * So we have something we can do, lets setup the session */ - if (octo_sessions) { - for (i = 1; i < octo_sesnum; i++) - if (octo_sessions[i] == NULL) + if (sc->sc_sessions) { + for (i = 1; i < sc->sc_sesnum; i++) + if (sc->sc_sessions[i] == NULL) break; } else i = 1; /* NB: to silence compiler warning */ - if (octo_sessions == NULL || i == octo_sesnum) { - if (octo_sessions == NULL) { - i = 1; /* We leave octo_sessions[0] empty */ - octo_sesnum = CRYPTO_SW_SESSIONS; + if (sc->sc_sessions == NULL || i == sc->sc_sesnum) { + if (sc->sc_sessions == NULL) { + i = 1; /* We leave sc->sc_sessions[0] empty */ + sc->sc_sesnum = CRYPTO_SW_SESSIONS; } else - octo_sesnum *= 2; + sc->sc_sesnum *= 2; - ocd = kmalloc(octo_sesnum * sizeof(struct octo_sess *), SLAB_ATOMIC); + ocd = malloc(sc->sc_sesnum * sizeof(struct octo_sess *), + M_DEVBUF, M_NOWAIT); if (ocd == NULL) { /* Reset session number */ - if (octo_sesnum == CRYPTO_SW_SESSIONS) - octo_sesnum = 0; + if (sc->sc_sesnum == CRYPTO_SW_SESSIONS) + sc->sc_sesnum = 0; else - octo_sesnum /= 2; + sc->sc_sesnum /= 2; dprintf("%s,%d: ENOBUFS\n", __FILE__, __LINE__); return ENOBUFS; } - memset(ocd, 0, octo_sesnum * sizeof(struct octo_sess *)); + memset(ocd, 0, sc->sc_sesnum * sizeof(struct octo_sess *)); /* Copy existing sessions */ - if (octo_sessions) { - memcpy(ocd, octo_sessions, - (octo_sesnum / 2) * sizeof(struct octo_sess *)); - kfree(octo_sessions); + if (sc->sc_sessions) { + memcpy(ocd, sc->sc_sessions, + (sc->sc_sesnum / 2) * sizeof(struct octo_sess *)); + free(sc->sc_sessions, M_DEVBUF); } - octo_sessions = ocd; + sc->sc_sessions = ocd; } - ocd = &octo_sessions[i]; + ocd = &sc->sc_sessions[i]; *sid = i; - - *ocd = (struct octo_sess *) kmalloc(sizeof(struct octo_sess), SLAB_ATOMIC); + *ocd = malloc(sizeof(struct octo_sess), M_DEVBUF, M_NOWAIT); if (*ocd == NULL) { - octo_freesession(NULL, i); + cryptocteon_freesession(NULL, i); dprintf("%s,%d: ENOBUFS\n", __FILE__, __LINE__); return ENOBUFS; } @@ -257,7 +250,7 @@ octo_newsession(device_t dev, u_int32_t (*ocd)->octo_decrypt = octo_des_cbc_decrypt; break; default: - octo_freesession(NULL, i); + cryptocteon_freesession(NULL, i); dprintf("%s,%d: EINVALn", __FILE__, __LINE__); return EINVAL; } @@ -282,7 +275,7 @@ octo_newsession(device_t dev, u_int32_t (*ocd)->octo_decrypt = octo_aes_cbc_decrypt; break; default: - octo_freesession(NULL, i); + cryptocteon_freesession(NULL, i); dprintf("%s,%d: EINVALn", __FILE__, __LINE__); return EINVAL; } @@ -300,7 +293,7 @@ octo_newsession(device_t dev, u_int32_t (*ocd)->octo_hmouter); break; default: - octo_freesession(NULL, i); + cryptocteon_freesession(NULL, i); dprintf("%s,%d: EINVALn", __FILE__, __LINE__); return EINVAL; } @@ -315,24 +308,27 @@ octo_newsession(device_t dev, u_int32_t * Free a session. */ static int -octo_freesession(device_t dev, u_int64_t tid) +cryptocteon_freesession(device_t dev, u_int64_t tid) { + struct cryptocteon_softc *sc; u_int32_t sid = CRYPTO_SESID2LID(tid); - dprintf("%s()\n", __FUNCTION__); - if (sid > octo_sesnum || octo_sessions == NULL || - octo_sessions[sid] == NULL) { - dprintf("%s,%d: EINVAL\n", __FILE__, __LINE__); - return(EINVAL); - } + sc = device_get_softc(dev); + + if (sc == NULL) + return (EINVAL); + + if (sid > sc->sc_sesnum || sc->sc_sessions == NULL || + sc->sc_sessions[sid] == NULL) + return (EINVAL); /* Silently accept and return */ if (sid == 0) return(0); - if (octo_sessions[sid]) - kfree(octo_sessions[sid]); - octo_sessions[sid] = NULL; + if (sc->sc_sessions[sid]) + free(sc->sc_sessions[sid], M_DEVBUF); + sc->sc_sessions[sid] = NULL; return 0; } @@ -340,24 +336,25 @@ octo_freesession(device_t dev, u_int64_t * Process a request. */ static int -octo_process(device_t dev, struct cryptop *crp, int hint) +cryptocteon_process(device_t dev, struct cryptop *crp, int hint) { struct cryptodesc *crd; struct octo_sess *od; u_int32_t lid; +#if 0 struct mbuf *m = NULL; struct uio *uiop = NULL; +#endif struct cryptodesc *enccrd = NULL, *maccrd = NULL; unsigned char *ivp = NULL; unsigned char iv_data[HASH_MAX_LEN]; int auth_off = 0, auth_len = 0, crypt_off = 0, crypt_len = 0, icv_off = 0; + struct cryptocteon_softc *sc; - dprintf("%s()\n", __FUNCTION__); - /* Sanity check */ - if (crp == NULL) { - dprintf("%s,%d: EINVAL\n", __FILE__, __LINE__); + sc = device_get_softc(dev); + + if (sc == NULL || crp == NULL) return EINVAL; - } crp->crp_etype = 0; @@ -368,13 +365,13 @@ octo_process(device_t dev, struct crypto } lid = crp->crp_sid & 0xffffffff; - if (lid >= octo_sesnum || lid == 0 || octo_sessions == NULL || - octo_sessions[lid] == NULL) { + if (lid >= sc->sc_sesnum || lid == 0 || sc->sc_sessions == NULL || + sc->sc_sessions[lid] == NULL) { crp->crp_etype = ENOENT; dprintf("%s,%d: ENOENT\n", __FILE__, __LINE__); goto done; } - od = octo_sessions[lid]; + od = sc->sc_sessions[lid]; #if 0 /* @@ -439,7 +436,6 @@ octo_process(device_t dev, struct crypto icv_off = maccrd->crd_inject; } - #if 0 /* * setup the SG list to cover the buffer @@ -525,37 +521,25 @@ done: crypto_done(crp); return 0; } -#if 0 -static int -cryptocteon_init(void) -{ - dprintf("%s(%p)\n", __FUNCTION__, cryptocteon_init); - softc_device_init(&octo_softc, "cryptocteon", 0, octo_methods); +static device_method_t cryptocteon_methods[] = { + /* device methods */ + DEVMETHOD(device_identify, cryptocteon_identify), + DEVMETHOD(device_probe, cryptocteon_probe), + DEVMETHOD(device_attach, cryptocteon_attach), - octo_id = crypto_get_driverid(softc_get_device(&octo_softc), - CRYPTOCAP_F_HARDWARE | CRYPTOCAP_F_SYNC); - if (octo_id < 0) { - printf("Cryptocteon device cannot initialize!"); - return -ENODEV; - } - - crypto_register(octo_id, CRYPTO_MD5_HMAC, 0,0); - crypto_register(octo_id, CRYPTO_SHA1_HMAC, 0,0); - //crypto_register(octo_id, CRYPTO_MD5, 0,0); - //crypto_register(octo_id, CRYPTO_SHA1, 0,0); - crypto_register(octo_id, CRYPTO_DES_CBC, 0,0); - crypto_register(octo_id, CRYPTO_3DES_CBC, 0,0); - crypto_register(octo_id, CRYPTO_AES_CBC, 0,0); + /* crypto device methods */ + DEVMETHOD(cryptodev_newsession, cryptocteon_newsession), + DEVMETHOD(cryptodev_freesession,cryptocteon_freesession), + DEVMETHOD(cryptodev_process, cryptocteon_process), - return(0); -} + { 0, 0 } +}; -static void -cryptocteon_exit(void) -{ - dprintf("%s()\n", __FUNCTION__); - crypto_unregister_all(octo_id); - octo_id = -1; -} -#endif +static driver_t cryptocteon_driver = { + "cryptocteon", + cryptocteon_methods, + sizeof (struct cryptocteon_softc), +}; +static devclass_t cryptocteon_devclass; +DRIVER_MODULE(cryptocteon, nexus, cryptocteon_driver, cryptocteon_devclass, 0, 0); Modified: user/jmallett/octeon/sys/mips/cavium/cryptocteon/cryptocteonvar.h ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/cryptocteon/cryptocteonvar.h Sun Jun 20 23:45:19 2010 (r209378) +++ user/jmallett/octeon/sys/mips/cavium/cryptocteon/cryptocteonvar.h Mon Jun 21 00:49:23 2010 (r209379) @@ -57,6 +57,14 @@ struct octo_sess { uint64_t octo_hmouter[3]; }; +#define dprintf(fmt, ...) \ + do { \ + if (cryptocteon_debug) \ + printf("%s: " fmt, __func__, ## __VA_ARGS__); \ + } while (0) + +extern int cryptocteon_debug; + void octo_calc_hash(uint8_t, unsigned char *, uint64_t *, uint64_t *); /* XXX Actually just hashing functions, not encryption. */ From owner-svn-src-user@FreeBSD.ORG Mon Jun 21 02:32:42 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B0CD106564A; Mon, 21 Jun 2010 02:32:42 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 186A18FC08; Mon, 21 Jun 2010 02:32:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5L2WgCT089171; Mon, 21 Jun 2010 02:32:42 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5L2WgXn089168; Mon, 21 Jun 2010 02:32:42 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006210232.o5L2WgXn089168@svn.freebsd.org> From: Juli Mallett Date: Mon, 21 Jun 2010 02:32:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209380 - in user/jmallett/octeon/sys/mips/cavium: . cryptocteon X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jun 2010 02:32:42 -0000 Author: jmallett Date: Mon Jun 21 02:32:41 2010 New Revision: 209380 URL: http://svn.freebsd.org/changeset/base/209380 Log: o) Switch to an iovec-oriented API for the crypto API using the previous scatterlist macros as a base. XXX Said macros are definitely at least a little buggy and read/write macros would allow better sanity checking. XXX The code here is all so basically identical that it ought to be possible to abstract out functions to do the various functions for each type and compose those into sane functions rather than the massive duplicated blobs that there are now. o) Actually build the crypto front-end now. This still can't work because I need to add trivial functions to enable the crypto coprocessor. Modified: user/jmallett/octeon/sys/mips/cavium/cryptocteon/cavium_crypto.c user/jmallett/octeon/sys/mips/cavium/cryptocteon/cryptocteon.c user/jmallett/octeon/sys/mips/cavium/cryptocteon/cryptocteonvar.h user/jmallett/octeon/sys/mips/cavium/files.octeon1 Modified: user/jmallett/octeon/sys/mips/cavium/cryptocteon/cavium_crypto.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/cryptocteon/cavium_crypto.c Mon Jun 21 00:49:23 2010 (r209379) +++ user/jmallett/octeon/sys/mips/cavium/cryptocteon/cavium_crypto.c Mon Jun 21 02:32:41 2010 (r209380) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -58,6 +59,34 @@ __FBSDID("$FreeBSD$"); /****************************************************************************/ +#define IOV_INIT(iov, ptr, idx, len) \ + do { \ + (idx) = 0; \ + (ptr) = (iov)[(idx)].iov_base; \ + (len) = (iov)[(idx)].iov_len; \ + } while (0) + +/* + * XXX + * It would be better if this were an IOV_READ/IOV_WRITE macro instead so + * that we could detect overflow before it happens rather than right after, + * which is especially bad since there is usually no IOV_CONSUME after the + * final read or write. + */ +#define IOV_CONSUME(iov, ptr, idx, len) \ + do { \ + if ((len) > sizeof *(ptr)) { \ + (len) -= sizeof *(ptr); \ + (ptr)++; \ + } else { \ + if ((len) != sizeof *(ptr)) \ + panic("%s: went past end of iovec.", __func__); \ + (idx)++; \ + (ptr) = (iov)[(idx)].iov_base; \ + (len) = (iov)[(idx)].iov_len; \ + } \ + } while (0) + /* * XXX * Not yet. @@ -226,6 +255,8 @@ octo_calc_hash(uint8_t auth, unsigned ch struct octeon_cop2_state state; unsigned long flags; + dprintf("%s()\n", __func__); + memset(hash_key, 0, sizeof(hash_key)); memcpy(hash_key, (uint8_t *) key, (auth ? 20 : 16)); key1 = (uint64_t *) hash_key; @@ -312,25 +343,28 @@ octo_calc_hash(uint8_t auth, unsigned ch int octo_des_cbc_encrypt( struct octo_sess *od, - void *buf, int buflen, + struct iovec *iov, size_t iovcnt, size_t iovlen, int auth_off, int auth_len, int crypt_off, int crypt_len, int icv_off, uint8_t *ivp) { uint64_t *data; + int data_i, data_l; struct octeon_cop2_state state; unsigned long flags; - if (__predict_false(od == NULL || buf==NULL || buflen==0 || ivp==NULL || - (crypt_off & 0x7) || (crypt_off + crypt_len > buflen))) { - dprintf("%s: Bad parameters od=%p buf=%p buflen=%d " + dprintf("%s()\n", __func__); + + if (__predict_false(od == NULL || iov==NULL || iovlen==0 || ivp==NULL || + (crypt_off & 0x7) || (crypt_off + crypt_len > iovlen))) { + dprintf("%s: Bad parameters od=%p iov=%p iovlen=%d " "auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d " - "icv_off=%d ivp=%p\n", __func__, od, buf, buflen, + "icv_off=%d ivp=%p\n", __func__, od, iov, iovlen, auth_off, auth_len, crypt_off, crypt_len, icv_off, ivp); return -EINVAL; } - data = buf; + IOV_INIT(iov, data, data_i, data_l); CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); @@ -354,15 +388,15 @@ octo_des_cbc_encrypt( CVMX_MT_3DES_IV(* (uint64_t *) ivp); while (crypt_off > 0) { - data++; - crypt_off -= sizeof *data; + IOV_CONSUME(iov, data, data_i, data_l); + crypt_off -= 8; } while (crypt_len > 0) { CVMX_MT_3DES_ENC_CBC(*data); CVMX_MF_3DES_RESULT(*data); - data++; - crypt_len -= sizeof *data; + IOV_CONSUME(iov, data, data_i, data_l); + crypt_len -= 8; } octeon_crypto_disable(&state, flags); @@ -373,25 +407,28 @@ octo_des_cbc_encrypt( int octo_des_cbc_decrypt( struct octo_sess *od, - void *buf, int buflen, + struct iovec *iov, size_t iovcnt, size_t iovlen, int auth_off, int auth_len, int crypt_off, int crypt_len, int icv_off, uint8_t *ivp) { uint64_t *data; + int data_i, data_l; struct octeon_cop2_state state; unsigned long flags; - if (__predict_false(od == NULL || buf==NULL || buflen==0 || ivp==NULL || - (crypt_off & 0x7) || (crypt_off + crypt_len > buflen))) { - dprintf("%s: Bad parameters od=%p buf=%p buflen=%d " + dprintf("%s()\n", __func__); + + if (__predict_false(od == NULL || iov==NULL || iovlen==0 || ivp==NULL || + (crypt_off & 0x7) || (crypt_off + crypt_len > iovlen))) { + dprintf("%s: Bad parameters od=%p iov=%p iovlen=%d " "auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d " - "icv_off=%d ivp=%p\n", __func__, od, buf, buflen, + "icv_off=%d ivp=%p\n", __func__, od, iov, iovlen, auth_off, auth_len, crypt_off, crypt_len, icv_off, ivp); return -EINVAL; } - data = buf; + IOV_INIT(iov, data, data_i, data_l); CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); @@ -415,15 +452,15 @@ octo_des_cbc_decrypt( CVMX_MT_3DES_IV(* (uint64_t *) ivp); while (crypt_off > 0) { - data++; - crypt_off -= sizeof *data; + IOV_CONSUME(iov, data, data_i, data_l); + crypt_off -= 8; } while (crypt_len > 0) { CVMX_MT_3DES_DEC_CBC(*data); CVMX_MF_3DES_RESULT(*data); - data++; - crypt_len -= sizeof *data; + IOV_CONSUME(iov, data, data_i, data_l); + crypt_len -= 8; } octeon_crypto_disable(&state, flags); @@ -436,25 +473,28 @@ octo_des_cbc_decrypt( int octo_aes_cbc_encrypt( struct octo_sess *od, - void *buf, int buflen, + struct iovec *iov, size_t iovcnt, size_t iovlen, int auth_off, int auth_len, int crypt_off, int crypt_len, int icv_off, uint8_t *ivp) { - uint64_t *data; + uint64_t *data, *pdata; + int data_i, data_l; struct octeon_cop2_state state; unsigned long flags; - if (__predict_false(od == NULL || buf==NULL || buflen==0 || ivp==NULL || - (crypt_off & 0x7) || (crypt_off + crypt_len > buflen))) { - dprintf("%s: Bad parameters od=%p buf=%p buflen=%d " + dprintf("%s()\n", __func__); + + if (__predict_false(od == NULL || iov==NULL || iovlen==0 || ivp==NULL || + (crypt_off & 0x7) || (crypt_off + crypt_len > iovlen))) { + dprintf("%s: Bad parameters od=%p iov=%p iovlen=%d " "auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d " - "icv_off=%d ivp=%p\n", __func__, od, buf, buflen, + "icv_off=%d ivp=%p\n", __func__, od, iov, iovlen, auth_off, auth_len, crypt_off, crypt_len, icv_off, ivp); return -EINVAL; } - data = buf; + IOV_INIT(iov, data, data_i, data_l); CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); @@ -485,17 +525,19 @@ octo_aes_cbc_encrypt( CVMX_MT_AES_IV(((uint64_t *) ivp)[1], 1); while (crypt_off > 0) { - data++; - crypt_off -= sizeof *data; + IOV_CONSUME(iov, data, data_i, data_l); + crypt_off -= 8; } while (crypt_len > 0) { - CVMX_MT_AES_ENC_CBC0(data[0]); - CVMX_MT_AES_ENC_CBC1(data[1]); - CVMX_MF_AES_RESULT(data[0], 0); - CVMX_MF_AES_RESULT(data[1], 1); - data += 2; - crypt_len -= 2 * sizeof *data; + pdata = data; + CVMX_MT_AES_ENC_CBC0(*data); + IOV_CONSUME(iov, data, data_i, data_l); + CVMX_MT_AES_ENC_CBC1(*data); + CVMX_MF_AES_RESULT(*pdata, 0); + CVMX_MF_AES_RESULT(*data, 1); + IOV_CONSUME(iov, data, data_i, data_l); + crypt_len -= 16; } octeon_crypto_disable(&state, flags); @@ -506,25 +548,28 @@ octo_aes_cbc_encrypt( int octo_aes_cbc_decrypt( struct octo_sess *od, - void *buf, int buflen, + struct iovec *iov, size_t iovcnt, size_t iovlen, int auth_off, int auth_len, int crypt_off, int crypt_len, int icv_off, uint8_t *ivp) { - uint64_t *data; + uint64_t *data, *pdata; + int data_i, data_l; struct octeon_cop2_state state; unsigned long flags; - if (__predict_false(od == NULL || buf==NULL || buflen==0 || ivp==NULL || - (crypt_off & 0x7) || (crypt_off + crypt_len > buflen))) { - dprintf("%s: Bad parameters od=%p buf=%p buflen=%d " + dprintf("%s()\n", __func__); + + if (__predict_false(od == NULL || iov==NULL || iovlen==0 || ivp==NULL || + (crypt_off & 0x7) || (crypt_off + crypt_len > iovlen))) { + dprintf("%s: Bad parameters od=%p iov=%p iovlen=%d " "auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d " - "icv_off=%d ivp=%p\n", __func__, od, buf, buflen, + "icv_off=%d ivp=%p\n", __func__, od, iov, iovlen, auth_off, auth_len, crypt_off, crypt_len, icv_off, ivp); return -EINVAL; } - data = buf; + IOV_INIT(iov, data, data_i, data_l); CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); @@ -555,17 +600,19 @@ octo_aes_cbc_decrypt( CVMX_MT_AES_IV(((uint64_t *) ivp)[1], 1); while (crypt_off > 0) { - data++; - crypt_off -= sizeof *data; + IOV_CONSUME(iov, data, data_i, data_l); + crypt_off -= 8; } while (crypt_len > 0) { - CVMX_MT_AES_DEC_CBC0(data[0]); - CVMX_MT_AES_DEC_CBC1(data[1]); - CVMX_MF_AES_RESULT(data[0], 0); - CVMX_MF_AES_RESULT(data[1], 1); - data += 2; - crypt_len -= 2 * sizeof *data; + pdata = data; + CVMX_MT_AES_DEC_CBC0(*data); + IOV_CONSUME(iov, data, data_i, data_l); + CVMX_MT_AES_DEC_CBC1(*data); + CVMX_MF_AES_RESULT(*pdata, 0); + CVMX_MF_AES_RESULT(*data, 1); + IOV_CONSUME(iov, data, data_i, data_l); + crypt_len -= 16; } octeon_crypto_disable(&state, flags); @@ -578,7 +625,7 @@ octo_aes_cbc_decrypt( int octo_null_md5_encrypt( struct octo_sess *od, - void *buf, int buflen, + struct iovec *iov, size_t iovcnt, size_t iovlen, int auth_off, int auth_len, int crypt_off, int crypt_len, int icv_off, uint8_t *ivp) @@ -586,20 +633,22 @@ octo_null_md5_encrypt( register int next = 0; uint64_t *data; uint64_t tmp1, tmp2; - int alen = auth_len; + int data_i, data_l, alen = auth_len; struct octeon_cop2_state state; unsigned long flags; - if (__predict_false(od == NULL || buf==NULL || buflen==0 || - (auth_off & 0x7) || (auth_off + auth_len > buflen))) { - dprintf("%s: Bad parameters od=%p buf=%p buflen=%d " + dprintf("%s()\n", __func__); + + if (__predict_false(od == NULL || iov==NULL || iovlen==0 || + (auth_off & 0x7) || (auth_off + auth_len > iovlen))) { + dprintf("%s: Bad parameters od=%p iov=%p iovlen=%d " "auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d " - "icv_off=%d ivp=%p\n", __func__, od, buf, buflen, + "icv_off=%d ivp=%p\n", __func__, od, iov, iovlen, auth_off, auth_len, crypt_off, crypt_len, icv_off, ivp); return -EINVAL; } - data = buf; + IOV_INIT(iov, data, data_i, data_l); flags = octeon_crypto_enable(&state); @@ -608,14 +657,14 @@ octo_null_md5_encrypt( CVMX_MT_HSH_IV(od->octo_hminner[1], 1); while (auth_off > 0) { - data++; - auth_off -= sizeof *data; + IOV_CONSUME(iov, data, data_i, data_l); + auth_off -= 8; } while (auth_len > 0) { CVM_LOAD_MD5_UNIT(*data, next); - data++; - auth_len -= sizeof *data; + auth_len -= 8; + IOV_CONSUME(iov, data, data_i, data_l); } /* finish the hash */ @@ -663,13 +712,13 @@ octo_null_md5_encrypt( CVMX_MT_HSH_STARTMD5(tmp1); /* save the HMAC */ - data = buf; + IOV_INIT(iov, data, data_i, data_l); while (icv_off > 0) { - data++; - icv_off -= sizeof *data; + IOV_CONSUME(iov, data, data_i, data_l); + icv_off -= 8; } CVMX_MF_HSH_IV(*data, 0); - data++; + IOV_CONSUME(iov, data, data_i, data_l); CVMX_MF_HSH_IV(tmp1, 1); *(uint32_t *)data = (uint32_t) (tmp1 >> 32); @@ -683,7 +732,7 @@ octo_null_md5_encrypt( int octo_null_sha1_encrypt( struct octo_sess *od, - void *buf, int buflen, + struct iovec *iov, size_t iovcnt, size_t iovlen, int auth_off, int auth_len, int crypt_off, int crypt_len, int icv_off, uint8_t *ivp) @@ -691,20 +740,22 @@ octo_null_sha1_encrypt( register int next = 0; uint64_t *data; uint64_t tmp1, tmp2, tmp3; - int alen = auth_len; + int data_i, data_l, alen = auth_len; struct octeon_cop2_state state; unsigned long flags; - if (__predict_false(od == NULL || buf==NULL || buflen==0 || - (auth_off & 0x7) || (auth_off + auth_len > buflen))) { - dprintf("%s: Bad parameters od=%p buf=%p buflen=%d " + dprintf("%s()\n", __func__); + + if (__predict_false(od == NULL || iov==NULL || iovlen==0 || + (auth_off & 0x7) || (auth_off + auth_len > iovlen))) { + dprintf("%s: Bad parameters od=%p iov=%p iovlen=%d " "auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d " - "icv_off=%d ivp=%p\n", __func__, od, buf, buflen, + "icv_off=%d ivp=%p\n", __func__, od, iov, iovlen, auth_off, auth_len, crypt_off, crypt_len, icv_off, ivp); return -EINVAL; } - data = buf; + IOV_INIT(iov, data, data_i, data_l); flags = octeon_crypto_enable(&state); @@ -714,14 +765,14 @@ octo_null_sha1_encrypt( CVMX_MT_HSH_IV(od->octo_hminner[2], 2); while (auth_off > 0) { - data++; - auth_off -= sizeof *data; + IOV_CONSUME(iov, data, data_i, data_l); + auth_off -= 8; } while (auth_len > 0) { CVM_LOAD_SHA_UNIT(*data, next); - data++; - auth_len -= sizeof *data; + auth_len -= 8; + IOV_CONSUME(iov, data, data_i, data_l); } /* finish the hash */ @@ -771,13 +822,13 @@ octo_null_sha1_encrypt( CVMX_MT_HSH_STARTSHA((uint64_t) ((64 + 20) << 3)); /* save the HMAC */ - data = buf; + IOV_INIT(iov, data, data_i, data_l); while (icv_off > 0) { - data++; - icv_off -= sizeof *data; + IOV_CONSUME(iov, data, data_i, data_l); + icv_off -= 8; } CVMX_MF_HSH_IV(*data, 0); - data++; + IOV_CONSUME(iov, data, data_i, data_l); CVMX_MF_HSH_IV(tmp1, 1); *(uint32_t *)data = (uint32_t) (tmp1 >> 32); @@ -791,7 +842,7 @@ octo_null_sha1_encrypt( int octo_des_cbc_md5_encrypt( struct octo_sess *od, - void *buf, int buflen, + struct iovec *iov, size_t iovcnt, size_t iovlen, int auth_off, int auth_len, int crypt_off, int crypt_len, int icv_off, uint8_t *ivp) @@ -804,23 +855,25 @@ octo_des_cbc_md5_encrypt( uint64_t *data = &mydata.data64[0]; uint32_t *data32; uint64_t tmp1, tmp2; - int alen = auth_len; + int data_i, data_l, alen = auth_len; struct octeon_cop2_state state; unsigned long flags; - if (__predict_false(od == NULL || buf==NULL || buflen==0 || ivp==NULL || - (crypt_off & 0x3) || (crypt_off + crypt_len > buflen) || + dprintf("%s()\n", __func__); + + if (__predict_false(od == NULL || iov==NULL || iovlen==0 || ivp==NULL || + (crypt_off & 0x3) || (crypt_off + crypt_len > iovlen) || (crypt_len & 0x7) || (auth_len & 0x7) || - (auth_off & 0x3) || (auth_off + auth_len > buflen))) { - dprintf("%s: Bad parameters od=%p buf=%p buflen=%d " + (auth_off & 0x3) || (auth_off + auth_len > iovlen))) { + dprintf("%s: Bad parameters od=%p iov=%p iovlen=%d " "auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d " - "icv_off=%d ivp=%p\n", __func__, od, buf, buflen, + "icv_off=%d ivp=%p\n", __func__, od, iov, iovlen, auth_off, auth_len, crypt_off, crypt_len, icv_off, ivp); return -EINVAL; } - data32 = buf; + IOV_INIT(iov, data32, data_i, data_l); CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); @@ -848,14 +901,16 @@ octo_des_cbc_md5_encrypt( CVMX_MT_HSH_IV(od->octo_hminner[1], 1); while (crypt_off > 0 && auth_off > 0) { - data32++; - crypt_off -= sizeof *data32; - auth_off -= sizeof *data32; + IOV_CONSUME(iov, data32, data_i, data_l); + crypt_off -= 4; + auth_off -= 4; } while (crypt_len > 0 || auth_len > 0) { - mydata.data32[0] = data32[0]; - mydata.data32[1] = data32[1]; + uint32_t *first = data32; + mydata.data32[0] = *first; + IOV_CONSUME(iov, data32, data_i, data_l); + mydata.data32[1] = *data32; if (crypt_off <= 0) { if (crypt_len > 0) { CVMX_MT_3DES_ENC_CBC(*data); @@ -871,9 +926,9 @@ octo_des_cbc_md5_encrypt( } } else auth_off -= 8; - data32[0] = mydata.data32[0]; - data32[1] = mydata.data32[1]; - data32 += 2; + *first = mydata.data32[0]; + *data32 = mydata.data32[1]; + IOV_CONSUME(iov, data32, data_i, data_l); } /* finish the hash */ @@ -921,14 +976,16 @@ octo_des_cbc_md5_encrypt( CVMX_MT_HSH_STARTMD5(tmp1); /* save the HMAC */ - data32 = buf; + IOV_INIT(iov, data32, data_i, data_l); while (icv_off > 0) { - data32++; - icv_off -= sizeof *data32; + IOV_CONSUME(iov, data32, data_i, data_l); + icv_off -= 4; } CVMX_MF_HSH_IV(tmp1, 0); - *data32++ = (uint32_t) (tmp1 >> 32); - *data32++ = (uint32_t) tmp1; + *data32 = (uint32_t) (tmp1 >> 32); + IOV_CONSUME(iov, data32, data_i, data_l); + *data32 = (uint32_t) tmp1; + IOV_CONSUME(iov, data32, data_i, data_l); CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); @@ -939,7 +996,7 @@ octo_des_cbc_md5_encrypt( int octo_des_cbc_md5_decrypt( struct octo_sess *od, - void *buf, int buflen, + struct iovec *iov, size_t iovcnt, size_t iovlen, int auth_off, int auth_len, int crypt_off, int crypt_len, int icv_off, uint8_t *ivp) @@ -952,23 +1009,25 @@ octo_des_cbc_md5_decrypt( uint64_t *data = &mydata.data64[0]; uint32_t *data32; uint64_t tmp1, tmp2; - int alen = auth_len; + int data_i, data_l, alen = auth_len; struct octeon_cop2_state state; unsigned long flags; - if (__predict_false(od == NULL || buf==NULL || buflen==0 || ivp==NULL || - (crypt_off & 0x3) || (crypt_off + crypt_len > buflen) || + dprintf("%s()\n", __func__); + + if (__predict_false(od == NULL || iov==NULL || iovlen==0 || ivp==NULL || + (crypt_off & 0x3) || (crypt_off + crypt_len > iovlen) || (crypt_len & 0x7) || (auth_len & 0x7) || - (auth_off & 0x3) || (auth_off + auth_len > buflen))) { - dprintf("%s: Bad parameters od=%p buf=%p buflen=%d " + (auth_off & 0x3) || (auth_off + auth_len > iovlen))) { + dprintf("%s: Bad parameters od=%p iov=%p iovlen=%d " "auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d " - "icv_off=%d ivp=%p\n", __func__, od, buf, buflen, + "icv_off=%d ivp=%p\n", __func__, od, iov, iovlen, auth_off, auth_len, crypt_off, crypt_len, icv_off, ivp); return -EINVAL; } - data32 = buf; + IOV_INIT(iov, data32, data_i, data_l); CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); @@ -996,14 +1055,16 @@ octo_des_cbc_md5_decrypt( CVMX_MT_HSH_IV(od->octo_hminner[1], 1); while (crypt_off > 0 && auth_off > 0) { - data32++; - crypt_off -= sizeof *data32; - auth_off -= sizeof *data32; + IOV_CONSUME(iov, data32, data_i, data_l); + crypt_off -= 4; + auth_off -= 4; } while (crypt_len > 0 || auth_len > 0) { - mydata.data32[0] = data32[0]; - mydata.data32[1] = data32[1]; + uint32_t *first = data32; + mydata.data32[0] = *first; + IOV_CONSUME(iov, data32, data_i, data_l); + mydata.data32[1] = *data32; if (auth_off <= 0) { if (auth_len > 0) { CVM_LOAD_MD5_UNIT(*data, next); @@ -1019,9 +1080,9 @@ octo_des_cbc_md5_decrypt( } } else crypt_off -= 8; - data32[0] = mydata.data32[0]; - data32[1] = mydata.data32[1]; - data32 += 2; + *first = mydata.data32[0]; + *data32 = mydata.data32[1]; + IOV_CONSUME(iov, data32, data_i, data_l); } /* finish the hash */ @@ -1069,14 +1130,16 @@ octo_des_cbc_md5_decrypt( CVMX_MT_HSH_STARTMD5(tmp1); /* save the HMAC */ - data32 = buf; + IOV_INIT(iov, data32, data_i, data_l); while (icv_off > 0) { - data32++; - icv_off -= sizeof *data32; + IOV_CONSUME(iov, data32, data_i, data_l); + icv_off -= 4; } CVMX_MF_HSH_IV(tmp1, 0); - *data32++ = (uint32_t) (tmp1 >> 32); - *data32++ = (uint32_t) tmp1; + *data32 = (uint32_t) (tmp1 >> 32); + IOV_CONSUME(iov, data32, data_i, data_l); + *data32 = (uint32_t) tmp1; + IOV_CONSUME(iov, data32, data_i, data_l); CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); @@ -1090,7 +1153,7 @@ octo_des_cbc_md5_decrypt( int octo_des_cbc_sha1_encrypt( struct octo_sess *od, - void *buf, int buflen, + struct iovec *iov, size_t iovcnt, size_t iovlen, int auth_off, int auth_len, int crypt_off, int crypt_len, int icv_off, uint8_t *ivp) @@ -1103,23 +1166,25 @@ octo_des_cbc_sha1_encrypt( uint64_t *data = &mydata.data64[0]; uint32_t *data32; uint64_t tmp1, tmp2, tmp3; - int alen = auth_len; + int data_i, data_l, alen = auth_len; struct octeon_cop2_state state; unsigned long flags; - if (__predict_false(od == NULL || buf==NULL || buflen==0 || ivp==NULL || - (crypt_off & 0x3) || (crypt_off + crypt_len > buflen) || + dprintf("%s()\n", __func__); + + if (__predict_false(od == NULL || iov==NULL || iovlen==0 || ivp==NULL || + (crypt_off & 0x3) || (crypt_off + crypt_len > iovlen) || (crypt_len & 0x7) || (auth_len & 0x7) || - (auth_off & 0x3) || (auth_off + auth_len > buflen))) { - dprintf("%s: Bad parameters od=%p buf=%p buflen=%d " + (auth_off & 0x3) || (auth_off + auth_len > iovlen))) { + dprintf("%s: Bad parameters od=%p iov=%p iovlen=%d " "auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d " - "icv_off=%d ivp=%p\n", __func__, od, buf, buflen, + "icv_off=%d ivp=%p\n", __func__, od, iov, iovlen, auth_off, auth_len, crypt_off, crypt_len, icv_off, ivp); return -EINVAL; } - data32 = buf; + IOV_INIT(iov, data32, data_i, data_l); CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); @@ -1148,14 +1213,16 @@ octo_des_cbc_sha1_encrypt( CVMX_MT_HSH_IV(od->octo_hminner[2], 2); while (crypt_off > 0 && auth_off > 0) { - data32++; - crypt_off -= sizeof *data32; - auth_off -= sizeof *data32; + IOV_CONSUME(iov, data32, data_i, data_l); + crypt_off -= 4; + auth_off -= 4; } while (crypt_len > 0 || auth_len > 0) { - mydata.data32[0] = data32[0]; - mydata.data32[1] = data32[1]; + uint32_t *first = data32; + mydata.data32[0] = *first; + IOV_CONSUME(iov, data32, data_i, data_l); + mydata.data32[1] = *data32; if (crypt_off <= 0) { if (crypt_len > 0) { CVMX_MT_3DES_ENC_CBC(*data); @@ -1171,9 +1238,9 @@ octo_des_cbc_sha1_encrypt( } } else auth_off -= 8; - data32[0] = mydata.data32[0]; - data32[1] = mydata.data32[1]; - data32 += 2; + *first = mydata.data32[0]; + *data32 = mydata.data32[1]; + IOV_CONSUME(iov, data32, data_i, data_l); } /* finish the hash */ @@ -1223,14 +1290,16 @@ octo_des_cbc_sha1_encrypt( CVMX_MT_HSH_STARTSHA((uint64_t) ((64 + 20) << 3)); /* save the HMAC */ - data32 = buf; + IOV_INIT(iov, data32, data_i, data_l); while (icv_off > 0) { - data32++; - icv_off -= sizeof *data32; + IOV_CONSUME(iov, data32, data_i, data_l); + icv_off -= 4; } CVMX_MF_HSH_IV(tmp1, 0); - *data32++ = (uint32_t) (tmp1 >> 32); - *data32++ = (uint32_t) tmp1; + *data32 = (uint32_t) (tmp1 >> 32); + IOV_CONSUME(iov, data32, data_i, data_l); + *data32 = (uint32_t) tmp1; + IOV_CONSUME(iov, data32, data_i, data_l); CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); @@ -1241,7 +1310,7 @@ octo_des_cbc_sha1_encrypt( int octo_des_cbc_sha1_decrypt( struct octo_sess *od, - void *buf, int buflen, + struct iovec *iov, size_t iovcnt, size_t iovlen, int auth_off, int auth_len, int crypt_off, int crypt_len, int icv_off, uint8_t *ivp) @@ -1254,23 +1323,25 @@ octo_des_cbc_sha1_decrypt( uint64_t *data = &mydata.data64[0]; uint32_t *data32; uint64_t tmp1, tmp2, tmp3; - int alen = auth_len; + int data_i, data_l, alen = auth_len; struct octeon_cop2_state state; unsigned long flags; - if (__predict_false(od == NULL || buf==NULL || buflen==0 || ivp==NULL || - (crypt_off & 0x3) || (crypt_off + crypt_len > buflen) || + dprintf("%s()\n", __func__); + + if (__predict_false(od == NULL || iov==NULL || iovlen==0 || ivp==NULL || + (crypt_off & 0x3) || (crypt_off + crypt_len > iovlen) || (crypt_len & 0x7) || (auth_len & 0x7) || - (auth_off & 0x3) || (auth_off + auth_len > buflen))) { - dprintf("%s: Bad parameters od=%p buf=%p buflen=%d " + (auth_off & 0x3) || (auth_off + auth_len > iovlen))) { + dprintf("%s: Bad parameters od=%p iov=%p iovlen=%d " "auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d " - "icv_off=%d ivp=%p\n", __func__, od, buf, buflen, + "icv_off=%d ivp=%p\n", __func__, od, iov, iovlen, auth_off, auth_len, crypt_off, crypt_len, icv_off, ivp); return -EINVAL; } - data32 = buf; + IOV_INIT(iov, data32, data_i, data_l); CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); @@ -1299,14 +1370,16 @@ octo_des_cbc_sha1_decrypt( CVMX_MT_HSH_IV(od->octo_hminner[2], 2); while (crypt_off > 0 && auth_off > 0) { - data32++; - crypt_off -= sizeof *data32; - auth_off -= sizeof *data32; + IOV_CONSUME(iov, data32, data_i, data_l); + crypt_off -= 4; + auth_off -= 4; } while (crypt_len > 0 || auth_len > 0) { - mydata.data32[0] = data32[0]; - mydata.data32[1] = data32[1]; + uint32_t *first = data32; + mydata.data32[0] = *first; + IOV_CONSUME(iov, data32, data_i, data_l); + mydata.data32[1] = *data32; if (auth_off <= 0) { if (auth_len > 0) { CVM_LOAD_SHA_UNIT(*data, next); @@ -1322,9 +1395,9 @@ octo_des_cbc_sha1_decrypt( } } else crypt_off -= 8; - data32[0] = mydata.data32[0]; - data32[1] = mydata.data32[1]; - data32 += 2; + *first = mydata.data32[0]; + *data32 = mydata.data32[1]; + IOV_CONSUME(iov, data32, data_i, data_l); } /* finish the hash */ @@ -1373,14 +1446,16 @@ octo_des_cbc_sha1_decrypt( CVMX_MT_HSH_DATZ(6); CVMX_MT_HSH_STARTSHA((uint64_t) ((64 + 20) << 3)); /* save the HMAC */ - data32 = buf; + IOV_INIT(iov, data32, data_i, data_l); while (icv_off > 0) { - data32++; - icv_off -= sizeof *data32; + IOV_CONSUME(iov, data32, data_i, data_l); + icv_off -= 4; } CVMX_MF_HSH_IV(tmp1, 0); - *data32++ = (uint32_t) (tmp1 >> 32); - *data32++ = (uint32_t) tmp1; + *data32 = (uint32_t) (tmp1 >> 32); + IOV_CONSUME(iov, data32, data_i, data_l); + *data32 = (uint32_t) tmp1; + IOV_CONSUME(iov, data32, data_i, data_l); CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); @@ -1394,7 +1469,7 @@ octo_des_cbc_sha1_decrypt( int octo_aes_cbc_md5_encrypt( struct octo_sess *od, - void *buf, int buflen, + struct iovec *iov, size_t iovcnt, size_t iovlen, int auth_off, int auth_len, int crypt_off, int crypt_len, int icv_off, uint8_t *ivp) @@ -1408,23 +1483,25 @@ octo_aes_cbc_md5_encrypt( uint64_t *data = &mydata[1].data64[0]; uint32_t *data32; uint64_t tmp1, tmp2; - int alen = auth_len; + int data_i, data_l, alen = auth_len; struct octeon_cop2_state state; unsigned long flags; - if (__predict_false(od == NULL || buf==NULL || buflen==0 || ivp==NULL || - (crypt_off & 0x3) || (crypt_off + crypt_len > buflen) || + dprintf("%s()\n", __func__); + + if (__predict_false(od == NULL || iov==NULL || iovlen==0 || ivp==NULL || + (crypt_off & 0x3) || (crypt_off + crypt_len > iovlen) || (crypt_len & 0x7) || (auth_len & 0x7) || - (auth_off & 0x3) || (auth_off + auth_len > buflen))) { - dprintf("%s: Bad parameters od=%p buf=%p buflen=%d " + (auth_off & 0x3) || (auth_off + auth_len > iovlen))) { + dprintf("%s: Bad parameters od=%p iov=%p iovlen=%d " "auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d " - "icv_off=%d ivp=%p\n", __func__, od, buf, buflen, + "icv_off=%d ivp=%p\n", __func__, od, iov, iovlen, auth_off, auth_len, crypt_off, crypt_len, icv_off, ivp); return -EINVAL; } - data32 = buf; + IOV_INIT(iov, data32, data_i, data_l); CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); @@ -1459,9 +1536,9 @@ octo_aes_cbc_md5_encrypt( CVMX_MT_HSH_IV(od->octo_hminner[1], 1); while (crypt_off > 0 && auth_off > 0) { - data32++; - crypt_off -= sizeof *data32; - auth_off -= sizeof *data32; + IOV_CONSUME(iov, data32, data_i, data_l); + crypt_off -= 4; + auth_off -= 4; } while (crypt_len > 0 || auth_len > 0) { @@ -1469,15 +1546,15 @@ octo_aes_cbc_md5_encrypt( pdata32[0] = data32; mydata[0].data32[0] = *data32; - data32++; + IOV_CONSUME(iov, data32, data_i, data_l); pdata32[1] = data32; mydata[0].data32[1] = *data32; - data32++; + IOV_CONSUME(iov, data32, data_i, data_l); pdata32[2] = data32; mydata[1].data32[0] = *data32; - data32++; + IOV_CONSUME(iov, data32, data_i, data_l); mydata[1].data32[1] = *data32; @@ -1507,7 +1584,7 @@ octo_aes_cbc_md5_encrypt( *pdata32[2] = mydata[1].data32[0]; *data32 = mydata[1].data32[1]; - data32++; + IOV_CONSUME(iov, data32, data_i, data_l); } /* finish the hash */ @@ -1555,14 +1632,16 @@ octo_aes_cbc_md5_encrypt( CVMX_MT_HSH_STARTMD5(tmp1); /* save the HMAC */ - data32 = buf; + IOV_INIT(iov, data32, data_i, data_l); while (icv_off > 0) { - data32++; - icv_off -= sizeof *data32; + IOV_CONSUME(iov, data32, data_i, data_l); + icv_off -= 4; } CVMX_MF_HSH_IV(tmp1, 0); - *data32++ = (uint32_t) (tmp1 >> 32); - *data32++ = (uint32_t) tmp1; + *data32 = (uint32_t) (tmp1 >> 32); + IOV_CONSUME(iov, data32, data_i, data_l); + *data32 = (uint32_t) tmp1; + IOV_CONSUME(iov, data32, data_i, data_l); CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); @@ -1573,7 +1652,7 @@ octo_aes_cbc_md5_encrypt( int octo_aes_cbc_md5_decrypt( struct octo_sess *od, - void *buf, int buflen, + struct iovec *iov, size_t iovcnt, size_t iovlen, int auth_off, int auth_len, int crypt_off, int crypt_len, int icv_off, uint8_t *ivp) @@ -1587,23 +1666,25 @@ octo_aes_cbc_md5_decrypt( uint64_t *data = &mydata[1].data64[0]; uint32_t *data32; uint64_t tmp1, tmp2; - int alen = auth_len; + int data_i, data_l, alen = auth_len; struct octeon_cop2_state state; unsigned long flags; - if (__predict_false(od == NULL || buf==NULL || buflen==0 || ivp==NULL || - (crypt_off & 0x3) || (crypt_off + crypt_len > buflen) || + dprintf("%s()\n", __func__); + + if (__predict_false(od == NULL || iov==NULL || iovlen==0 || ivp==NULL || + (crypt_off & 0x3) || (crypt_off + crypt_len > iovlen) || (crypt_len & 0x7) || (auth_len & 0x7) || - (auth_off & 0x3) || (auth_off + auth_len > buflen))) { - dprintf("%s: Bad parameters od=%p buf=%p buflen=%d " + (auth_off & 0x3) || (auth_off + auth_len > iovlen))) { + dprintf("%s: Bad parameters od=%p iov=%p iovlen=%d " "auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d " - "icv_off=%d ivp=%p\n", __func__, od, buf, buflen, + "icv_off=%d ivp=%p\n", __func__, od, iov, iovlen, auth_off, auth_len, crypt_off, crypt_len, icv_off, ivp); return -EINVAL; } - data32 = buf; + IOV_INIT(iov, data32, data_i, data_l); CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); @@ -1638,9 +1719,9 @@ octo_aes_cbc_md5_decrypt( CVMX_MT_HSH_IV(od->octo_hminner[1], 1); while (crypt_off > 0 && auth_off > 0) { - data32++; - crypt_off -= sizeof *data32; - auth_off -= sizeof *data32; + IOV_CONSUME(iov, data32, data_i, data_l); + crypt_off -= 4; + auth_off -= 4; } while (crypt_len > 0 || auth_len > 0) { @@ -1648,13 +1729,13 @@ octo_aes_cbc_md5_decrypt( *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Mon Jun 21 03:05:31 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67993106566B; Mon, 21 Jun 2010 03:05:31 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 557298FC19; Mon, 21 Jun 2010 03:05:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5L35VCG096497; Mon, 21 Jun 2010 03:05:31 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5L35VkK096495; Mon, 21 Jun 2010 03:05:31 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006210305.o5L35VkK096495@svn.freebsd.org> From: Juli Mallett Date: Mon, 21 Jun 2010 03:05:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209381 - user/jmallett/octeon/sys/mips/cavium/cryptocteon X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jun 2010 03:05:31 -0000 Author: jmallett Date: Mon Jun 21 03:05:31 2010 New Revision: 209381 URL: http://svn.freebsd.org/changeset/base/209381 Log: o) We always run with COP2 access enabled, as far as I can tell, so we just need to disable interrupts for now for safe use of the crypto coprocessor within the kernel. XXX We shouldn't always have COP2 access enabled, we should trap on first access and enable it and do something like with fpcurthread. I now have a good idea of how to handle this generically via some arrays in the pcpu struct, but as I only need to use COP2 in the kernel, it's not a priority for me to do anything that makes userland COP2 use work. Modified: user/jmallett/octeon/sys/mips/cavium/cryptocteon/cavium_crypto.c Modified: user/jmallett/octeon/sys/mips/cavium/cryptocteon/cavium_crypto.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/cryptocteon/cavium_crypto.c Mon Jun 21 02:32:41 2010 (r209380) +++ user/jmallett/octeon/sys/mips/cavium/cryptocteon/cavium_crypto.c Mon Jun 21 03:05:31 2010 (r209381) @@ -87,22 +87,6 @@ __FBSDID("$FreeBSD$"); } \ } while (0) -/* - * XXX - * Not yet. - */ -struct octeon_cop2_state { -}; - -static inline unsigned long octeon_crypto_enable(struct octeon_cop2_state *state) -{ - return (0); -} - -static inline void octeon_crypto_disable(struct octeon_cop2_state *state, unsigned long flags) -{ -} - #define ESP_HEADER_LENGTH 8 #define DES_CBC_IV_LENGTH 8 #define AES_CBC_IV_LENGTH 16 @@ -252,15 +236,14 @@ octo_calc_hash(uint8_t auth, unsigned ch uint64_t *key1; register uint64_t xor1 = 0x3636363636363636ULL; register uint64_t xor2 = 0x5c5c5c5c5c5c5c5cULL; - struct octeon_cop2_state state; - unsigned long flags; + register_t s; dprintf("%s()\n", __func__); memset(hash_key, 0, sizeof(hash_key)); memcpy(hash_key, (uint8_t *) key, (auth ? 20 : 16)); key1 = (uint64_t *) hash_key; - flags = octeon_crypto_enable(&state); + s = intr_disable(); if (auth) { CVMX_MT_HSH_IV(0x67452301EFCDAB89ULL, 0); CVMX_MT_HSH_IV(0x98BADCFE10325476ULL, 1); @@ -333,7 +316,7 @@ octo_calc_hash(uint8_t auth, unsigned ch outer[2] = 0; CVMX_MF_HSH_IV(outer[2], 2); } - octeon_crypto_disable(&state, flags); + intr_restore(s); return; } @@ -350,8 +333,7 @@ octo_des_cbc_encrypt( { uint64_t *data; int data_i, data_l; - struct octeon_cop2_state state; - unsigned long flags; + register_t s; dprintf("%s()\n", __func__); @@ -369,7 +351,7 @@ octo_des_cbc_encrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - flags = octeon_crypto_enable(&state); + s = intr_disable(); /* load 3DES Key */ CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -380,7 +362,7 @@ octo_des_cbc_encrypt( CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1); CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2); } else { - octeon_crypto_disable(&state, flags); + intr_restore(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -399,7 +381,7 @@ octo_des_cbc_encrypt( crypt_len -= 8; } - octeon_crypto_disable(&state, flags); + intr_restore(s); return 0; } @@ -414,8 +396,7 @@ octo_des_cbc_decrypt( { uint64_t *data; int data_i, data_l; - struct octeon_cop2_state state; - unsigned long flags; + register_t s; dprintf("%s()\n", __func__); @@ -433,7 +414,7 @@ octo_des_cbc_decrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - flags = octeon_crypto_enable(&state); + s = intr_disable(); /* load 3DES Key */ CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -444,7 +425,7 @@ octo_des_cbc_decrypt( CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1); CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2); } else { - octeon_crypto_disable(&state, flags); + intr_restore(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -463,7 +444,7 @@ octo_des_cbc_decrypt( crypt_len -= 8; } - octeon_crypto_disable(&state, flags); + intr_restore(s); return 0; } @@ -480,8 +461,7 @@ octo_aes_cbc_encrypt( { uint64_t *data, *pdata; int data_i, data_l; - struct octeon_cop2_state state; - unsigned long flags; + register_t s; dprintf("%s()\n", __func__); @@ -499,7 +479,7 @@ octo_aes_cbc_encrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - flags = octeon_crypto_enable(&state); + s = intr_disable(); /* load AES Key */ CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -515,7 +495,7 @@ octo_aes_cbc_encrypt( CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[2], 2); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[3], 3); } else { - octeon_crypto_disable(&state, flags); + intr_restore(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -540,7 +520,7 @@ octo_aes_cbc_encrypt( crypt_len -= 16; } - octeon_crypto_disable(&state, flags); + intr_restore(s); return 0; } @@ -555,8 +535,7 @@ octo_aes_cbc_decrypt( { uint64_t *data, *pdata; int data_i, data_l; - struct octeon_cop2_state state; - unsigned long flags; + register_t s; dprintf("%s()\n", __func__); @@ -574,7 +553,7 @@ octo_aes_cbc_decrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - flags = octeon_crypto_enable(&state); + s = intr_disable(); /* load AES Key */ CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -590,7 +569,7 @@ octo_aes_cbc_decrypt( CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[2], 2); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[3], 3); } else { - octeon_crypto_disable(&state, flags); + intr_restore(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -615,7 +594,7 @@ octo_aes_cbc_decrypt( crypt_len -= 16; } - octeon_crypto_disable(&state, flags); + intr_restore(s); return 0; } @@ -634,8 +613,7 @@ octo_null_md5_encrypt( uint64_t *data; uint64_t tmp1, tmp2; int data_i, data_l, alen = auth_len; - struct octeon_cop2_state state; - unsigned long flags; + register_t s; dprintf("%s()\n", __func__); @@ -650,7 +628,7 @@ octo_null_md5_encrypt( IOV_INIT(iov, data, data_i, data_l); - flags = octeon_crypto_enable(&state); + s = intr_disable(); /* Load MD5 IV */ CVMX_MT_HSH_IV(od->octo_hminner[0], 0); @@ -722,7 +700,7 @@ octo_null_md5_encrypt( CVMX_MF_HSH_IV(tmp1, 1); *(uint32_t *)data = (uint32_t) (tmp1 >> 32); - octeon_crypto_disable(&state, flags); + intr_restore(s); return 0; } @@ -741,8 +719,7 @@ octo_null_sha1_encrypt( uint64_t *data; uint64_t tmp1, tmp2, tmp3; int data_i, data_l, alen = auth_len; - struct octeon_cop2_state state; - unsigned long flags; + register_t s; dprintf("%s()\n", __func__); @@ -757,7 +734,7 @@ octo_null_sha1_encrypt( IOV_INIT(iov, data, data_i, data_l); - flags = octeon_crypto_enable(&state); + s = intr_disable(); /* Load SHA1 IV */ CVMX_MT_HSH_IV(od->octo_hminner[0], 0); @@ -832,7 +809,7 @@ octo_null_sha1_encrypt( CVMX_MF_HSH_IV(tmp1, 1); *(uint32_t *)data = (uint32_t) (tmp1 >> 32); - octeon_crypto_disable(&state, flags); + intr_restore(s); return 0; } @@ -856,8 +833,7 @@ octo_des_cbc_md5_encrypt( uint32_t *data32; uint64_t tmp1, tmp2; int data_i, data_l, alen = auth_len; - struct octeon_cop2_state state; - unsigned long flags; + register_t s; dprintf("%s()\n", __func__); @@ -878,7 +854,7 @@ octo_des_cbc_md5_encrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - flags = octeon_crypto_enable(&state); + s = intr_disable(); /* load 3DES Key */ CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -889,7 +865,7 @@ octo_des_cbc_md5_encrypt( CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1); CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2); } else { - octeon_crypto_disable(&state, flags); + intr_restore(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -989,7 +965,7 @@ octo_des_cbc_md5_encrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - octeon_crypto_disable(&state, flags); + intr_restore(s); return 0; } @@ -1010,8 +986,7 @@ octo_des_cbc_md5_decrypt( uint32_t *data32; uint64_t tmp1, tmp2; int data_i, data_l, alen = auth_len; - struct octeon_cop2_state state; - unsigned long flags; + register_t s; dprintf("%s()\n", __func__); @@ -1032,7 +1007,7 @@ octo_des_cbc_md5_decrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - flags = octeon_crypto_enable(&state); + s = intr_disable(); /* load 3DES Key */ CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -1043,7 +1018,7 @@ octo_des_cbc_md5_decrypt( CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1); CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2); } else { - octeon_crypto_disable(&state, flags); + intr_restore(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -1143,7 +1118,7 @@ octo_des_cbc_md5_decrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - octeon_crypto_disable(&state, flags); + intr_restore(s); return 0; } @@ -1167,8 +1142,7 @@ octo_des_cbc_sha1_encrypt( uint32_t *data32; uint64_t tmp1, tmp2, tmp3; int data_i, data_l, alen = auth_len; - struct octeon_cop2_state state; - unsigned long flags; + register_t s; dprintf("%s()\n", __func__); @@ -1189,7 +1163,7 @@ octo_des_cbc_sha1_encrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - flags = octeon_crypto_enable(&state); + s = intr_disable(); /* load 3DES Key */ CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -1200,7 +1174,7 @@ octo_des_cbc_sha1_encrypt( CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1); CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2); } else { - octeon_crypto_disable(&state, flags); + intr_restore(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -1303,7 +1277,7 @@ octo_des_cbc_sha1_encrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - octeon_crypto_disable(&state, flags); + intr_restore(s); return 0; } @@ -1324,8 +1298,7 @@ octo_des_cbc_sha1_decrypt( uint32_t *data32; uint64_t tmp1, tmp2, tmp3; int data_i, data_l, alen = auth_len; - struct octeon_cop2_state state; - unsigned long flags; + register_t s; dprintf("%s()\n", __func__); @@ -1346,7 +1319,7 @@ octo_des_cbc_sha1_decrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - flags = octeon_crypto_enable(&state); + s = intr_disable(); /* load 3DES Key */ CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -1357,7 +1330,7 @@ octo_des_cbc_sha1_decrypt( CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1); CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2); } else { - octeon_crypto_disable(&state, flags); + intr_restore(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -1459,7 +1432,7 @@ octo_des_cbc_sha1_decrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - octeon_crypto_disable(&state, flags); + intr_restore(s); return 0; } @@ -1484,8 +1457,7 @@ octo_aes_cbc_md5_encrypt( uint32_t *data32; uint64_t tmp1, tmp2; int data_i, data_l, alen = auth_len; - struct octeon_cop2_state state; - unsigned long flags; + register_t s; dprintf("%s()\n", __func__); @@ -1506,7 +1478,7 @@ octo_aes_cbc_md5_encrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - flags = octeon_crypto_enable(&state); + s = intr_disable(); /* load AES Key */ CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -1522,7 +1494,7 @@ octo_aes_cbc_md5_encrypt( CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[2], 2); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[3], 3); } else { - octeon_crypto_disable(&state, flags); + intr_restore(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -1645,7 +1617,7 @@ octo_aes_cbc_md5_encrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - octeon_crypto_disable(&state, flags); + intr_restore(s); return 0; } @@ -1667,8 +1639,7 @@ octo_aes_cbc_md5_decrypt( uint32_t *data32; uint64_t tmp1, tmp2; int data_i, data_l, alen = auth_len; - struct octeon_cop2_state state; - unsigned long flags; + register_t s; dprintf("%s()\n", __func__); @@ -1689,7 +1660,7 @@ octo_aes_cbc_md5_decrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - flags = octeon_crypto_enable(&state); + s = intr_disable(); /* load AES Key */ CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -1705,7 +1676,7 @@ octo_aes_cbc_md5_decrypt( CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[2], 2); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[3], 3); } else { - octeon_crypto_disable(&state, flags); + intr_restore(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -1824,7 +1795,7 @@ octo_aes_cbc_md5_decrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - octeon_crypto_disable(&state, flags); + intr_restore(s); return 0; } @@ -1849,8 +1820,7 @@ octo_aes_cbc_sha1_encrypt( uint32_t *data32; uint64_t tmp1, tmp2, tmp3; int data_i, data_l, alen = auth_len; - struct octeon_cop2_state state; - unsigned long flags; + register_t s; dprintf("%s()\n", __func__); @@ -1871,7 +1841,7 @@ octo_aes_cbc_sha1_encrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - flags = octeon_crypto_enable(&state); + s = intr_disable(); /* load AES Key */ CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -1887,7 +1857,7 @@ octo_aes_cbc_sha1_encrypt( CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[2], 2); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[3], 3); } else { - octeon_crypto_disable(&state, flags); + intr_restore(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -2029,7 +1999,7 @@ octo_aes_cbc_sha1_encrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - octeon_crypto_disable(&state, flags); + intr_restore(s); return 0; } @@ -2051,8 +2021,7 @@ octo_aes_cbc_sha1_decrypt( uint32_t *data32; uint64_t tmp1, tmp2, tmp3; int data_i, data_l, alen = auth_len; - struct octeon_cop2_state state; - unsigned long flags; + register_t s; dprintf("%s()\n", __func__); @@ -2073,7 +2042,7 @@ octo_aes_cbc_sha1_decrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - flags = octeon_crypto_enable(&state); + s = intr_disable(); /* load AES Key */ CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -2089,7 +2058,7 @@ octo_aes_cbc_sha1_decrypt( CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[2], 2); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[3], 3); } else { - octeon_crypto_disable(&state, flags); + intr_restore(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -2230,7 +2199,7 @@ octo_aes_cbc_sha1_decrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - octeon_crypto_disable(&state, flags); + intr_restore(s); return 0; } From owner-svn-src-user@FreeBSD.ORG Mon Jun 21 04:06:02 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1FB5E1065672; Mon, 21 Jun 2010 04:06:02 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0DB028FC13; Mon, 21 Jun 2010 04:06:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5L461Zg010079; Mon, 21 Jun 2010 04:06:01 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5L4616N010075; Mon, 21 Jun 2010 04:06:01 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006210406.o5L4616N010075@svn.freebsd.org> From: Juli Mallett Date: Mon, 21 Jun 2010 04:06:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209382 - user/jmallett/octeon/sys/mips/cavium/cryptocteon X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jun 2010 04:06:02 -0000 Author: jmallett Date: Mon Jun 21 04:06:01 2010 New Revision: 209382 URL: http://svn.freebsd.org/changeset/base/209382 Log: o) Actually, we don't reenable COP2 access when entering the kernel from userland, so we need to enable it here along with disabling interrupts during crypto operations. o) Rather than trying to allocate a shocking amount of stack space, put the iovecs for crypto operations in the session structure. o) Remove a debugging panic. With this the crypto coprocessor seems to be working. Modified: user/jmallett/octeon/sys/mips/cavium/cryptocteon/cavium_crypto.c user/jmallett/octeon/sys/mips/cavium/cryptocteon/cryptocteon.c user/jmallett/octeon/sys/mips/cavium/cryptocteon/cryptocteonvar.h Modified: user/jmallett/octeon/sys/mips/cavium/cryptocteon/cavium_crypto.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/cryptocteon/cavium_crypto.c Mon Jun 21 03:05:31 2010 (r209381) +++ user/jmallett/octeon/sys/mips/cavium/cryptocteon/cavium_crypto.c Mon Jun 21 04:06:01 2010 (r209382) @@ -87,6 +87,22 @@ __FBSDID("$FreeBSD$"); } \ } while (0) +static inline unsigned long octeon_crypto_enable(void) +{ + register_t s; + + s = intr_disable(); + mips_wr_status(mips_rd_status() | MIPS_SR_COP_2_BIT); + + return (s); +} + +static inline void octeon_crypto_disable(register_t s) +{ + mips_wr_status(mips_rd_status() & ~MIPS_SR_COP_2_BIT); + intr_restore(s); +} + #define ESP_HEADER_LENGTH 8 #define DES_CBC_IV_LENGTH 8 #define AES_CBC_IV_LENGTH 16 @@ -243,7 +259,7 @@ octo_calc_hash(uint8_t auth, unsigned ch memset(hash_key, 0, sizeof(hash_key)); memcpy(hash_key, (uint8_t *) key, (auth ? 20 : 16)); key1 = (uint64_t *) hash_key; - s = intr_disable(); + s = octeon_crypto_enable(); if (auth) { CVMX_MT_HSH_IV(0x67452301EFCDAB89ULL, 0); CVMX_MT_HSH_IV(0x98BADCFE10325476ULL, 1); @@ -316,7 +332,7 @@ octo_calc_hash(uint8_t auth, unsigned ch outer[2] = 0; CVMX_MF_HSH_IV(outer[2], 2); } - intr_restore(s); + octeon_crypto_disable(s); return; } @@ -351,7 +367,7 @@ octo_des_cbc_encrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = intr_disable(); + s = octeon_crypto_enable(); /* load 3DES Key */ CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -362,7 +378,7 @@ octo_des_cbc_encrypt( CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1); CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2); } else { - intr_restore(s); + octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -381,7 +397,7 @@ octo_des_cbc_encrypt( crypt_len -= 8; } - intr_restore(s); + octeon_crypto_disable(s); return 0; } @@ -414,7 +430,7 @@ octo_des_cbc_decrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = intr_disable(); + s = octeon_crypto_enable(); /* load 3DES Key */ CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -425,7 +441,7 @@ octo_des_cbc_decrypt( CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1); CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2); } else { - intr_restore(s); + octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -444,7 +460,7 @@ octo_des_cbc_decrypt( crypt_len -= 8; } - intr_restore(s); + octeon_crypto_disable(s); return 0; } @@ -479,7 +495,7 @@ octo_aes_cbc_encrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = intr_disable(); + s = octeon_crypto_enable(); /* load AES Key */ CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -495,7 +511,7 @@ octo_aes_cbc_encrypt( CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[2], 2); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[3], 3); } else { - intr_restore(s); + octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -520,7 +536,7 @@ octo_aes_cbc_encrypt( crypt_len -= 16; } - intr_restore(s); + octeon_crypto_disable(s); return 0; } @@ -553,7 +569,7 @@ octo_aes_cbc_decrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = intr_disable(); + s = octeon_crypto_enable(); /* load AES Key */ CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -569,7 +585,7 @@ octo_aes_cbc_decrypt( CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[2], 2); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[3], 3); } else { - intr_restore(s); + octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -594,7 +610,7 @@ octo_aes_cbc_decrypt( crypt_len -= 16; } - intr_restore(s); + octeon_crypto_disable(s); return 0; } @@ -628,7 +644,7 @@ octo_null_md5_encrypt( IOV_INIT(iov, data, data_i, data_l); - s = intr_disable(); + s = octeon_crypto_enable(); /* Load MD5 IV */ CVMX_MT_HSH_IV(od->octo_hminner[0], 0); @@ -700,7 +716,7 @@ octo_null_md5_encrypt( CVMX_MF_HSH_IV(tmp1, 1); *(uint32_t *)data = (uint32_t) (tmp1 >> 32); - intr_restore(s); + octeon_crypto_disable(s); return 0; } @@ -734,7 +750,7 @@ octo_null_sha1_encrypt( IOV_INIT(iov, data, data_i, data_l); - s = intr_disable(); + s = octeon_crypto_enable(); /* Load SHA1 IV */ CVMX_MT_HSH_IV(od->octo_hminner[0], 0); @@ -809,7 +825,7 @@ octo_null_sha1_encrypt( CVMX_MF_HSH_IV(tmp1, 1); *(uint32_t *)data = (uint32_t) (tmp1 >> 32); - intr_restore(s); + octeon_crypto_disable(s); return 0; } @@ -854,7 +870,7 @@ octo_des_cbc_md5_encrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = intr_disable(); + s = octeon_crypto_enable(); /* load 3DES Key */ CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -865,7 +881,7 @@ octo_des_cbc_md5_encrypt( CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1); CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2); } else { - intr_restore(s); + octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -965,7 +981,7 @@ octo_des_cbc_md5_encrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - intr_restore(s); + octeon_crypto_disable(s); return 0; } @@ -1007,7 +1023,7 @@ octo_des_cbc_md5_decrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = intr_disable(); + s = octeon_crypto_enable(); /* load 3DES Key */ CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -1018,7 +1034,7 @@ octo_des_cbc_md5_decrypt( CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1); CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2); } else { - intr_restore(s); + octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -1118,7 +1134,7 @@ octo_des_cbc_md5_decrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - intr_restore(s); + octeon_crypto_disable(s); return 0; } @@ -1163,7 +1179,7 @@ octo_des_cbc_sha1_encrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = intr_disable(); + s = octeon_crypto_enable(); /* load 3DES Key */ CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -1174,7 +1190,7 @@ octo_des_cbc_sha1_encrypt( CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1); CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2); } else { - intr_restore(s); + octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -1277,7 +1293,7 @@ octo_des_cbc_sha1_encrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - intr_restore(s); + octeon_crypto_disable(s); return 0; } @@ -1319,7 +1335,7 @@ octo_des_cbc_sha1_decrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = intr_disable(); + s = octeon_crypto_enable(); /* load 3DES Key */ CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -1330,7 +1346,7 @@ octo_des_cbc_sha1_decrypt( CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1); CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2); } else { - intr_restore(s); + octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -1432,7 +1448,7 @@ octo_des_cbc_sha1_decrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - intr_restore(s); + octeon_crypto_disable(s); return 0; } @@ -1478,7 +1494,7 @@ octo_aes_cbc_md5_encrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = intr_disable(); + s = octeon_crypto_enable(); /* load AES Key */ CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -1494,7 +1510,7 @@ octo_aes_cbc_md5_encrypt( CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[2], 2); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[3], 3); } else { - intr_restore(s); + octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -1617,7 +1633,7 @@ octo_aes_cbc_md5_encrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - intr_restore(s); + octeon_crypto_disable(s); return 0; } @@ -1660,7 +1676,7 @@ octo_aes_cbc_md5_decrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = intr_disable(); + s = octeon_crypto_enable(); /* load AES Key */ CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -1676,7 +1692,7 @@ octo_aes_cbc_md5_decrypt( CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[2], 2); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[3], 3); } else { - intr_restore(s); + octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -1795,7 +1811,7 @@ octo_aes_cbc_md5_decrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - intr_restore(s); + octeon_crypto_disable(s); return 0; } @@ -1841,7 +1857,7 @@ octo_aes_cbc_sha1_encrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = intr_disable(); + s = octeon_crypto_enable(); /* load AES Key */ CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -1857,7 +1873,7 @@ octo_aes_cbc_sha1_encrypt( CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[2], 2); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[3], 3); } else { - intr_restore(s); + octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -1999,7 +2015,7 @@ octo_aes_cbc_sha1_encrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - intr_restore(s); + octeon_crypto_disable(s); return 0; } @@ -2042,7 +2058,7 @@ octo_aes_cbc_sha1_decrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = intr_disable(); + s = octeon_crypto_enable(); /* load AES Key */ CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -2058,7 +2074,7 @@ octo_aes_cbc_sha1_decrypt( CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[2], 2); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[3], 3); } else { - intr_restore(s); + octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -2199,7 +2215,7 @@ octo_aes_cbc_sha1_decrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - intr_restore(s); + octeon_crypto_disable(s); return 0; } Modified: user/jmallett/octeon/sys/mips/cavium/cryptocteon/cryptocteon.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/cryptocteon/cryptocteon.c Mon Jun 21 03:05:31 2010 (r209381) +++ user/jmallett/octeon/sys/mips/cavium/cryptocteon/cryptocteon.c Mon Jun 21 04:06:01 2010 (r209382) @@ -343,7 +343,6 @@ cryptocteon_process(device_t dev, struct struct cryptodesc *crd; struct octo_sess *od; u_int32_t lid; - struct iovec iov[UIO_MAXIOV]; size_t iovcnt, iovlen; struct mbuf *m = NULL; struct uio *uiop = NULL; @@ -444,30 +443,30 @@ cryptocteon_process(device_t dev, struct /* * setup the I/O vector to cover the buffer */ - memset(iov, 0, sizeof iov); + memset(od->octo_iov, 0, sizeof od->octo_iov); if (crp->crp_flags & CRYPTO_F_IMBUF) { iovcnt = 0; iovlen = 0; while (m != NULL) { - iov[iovcnt].iov_base = mtod(m, void *); - iov[iovcnt].iov_len = m->m_len; + od->octo_iov[iovcnt].iov_base = mtod(m, void *); + od->octo_iov[iovcnt].iov_len = m->m_len; m = m->m_next; - iovlen += iov[iovcnt++].iov_len; + iovlen += od->octo_iov[iovcnt++].iov_len; } } else if (crp->crp_flags & CRYPTO_F_IOV) { iovlen = 0; for (iovcnt = 0; iovcnt < uiop->uio_iovcnt; iovcnt++) { - iov[iovcnt].iov_base = uiop->uio_iov[iovcnt].iov_base; - iov[iovcnt].iov_len = uiop->uio_iov[iovcnt].iov_len; + od->octo_iov[iovcnt].iov_base = uiop->uio_iov[iovcnt].iov_base; + od->octo_iov[iovcnt].iov_len = uiop->uio_iov[iovcnt].iov_len; - iovlen += iov[iovcnt].iov_len; + iovlen += od->octo_iov[iovcnt].iov_len; } } else { iovlen = crp->crp_ilen; - iov[0].iov_base = crp->crp_buf; - iov[0].iov_len = crp->crp_ilen; + od->octo_iov[0].iov_base = crp->crp_buf; + od->octo_iov[0].iov_len = crp->crp_ilen; iovcnt = 1; } @@ -496,12 +495,11 @@ cryptocteon_process(device_t dev, struct if (!enccrd || (enccrd->crd_flags & CRD_F_ENCRYPT)) - (*od->octo_encrypt)(od, iov, iovcnt, iovlen, + (*od->octo_encrypt)(od, od->octo_iov, iovcnt, iovlen, auth_off, auth_len, crypt_off, crypt_len, icv_off, ivp); else - (*od->octo_decrypt)(od, iov, iovcnt, iovlen, + (*od->octo_decrypt)(od, od->octo_iov, iovcnt, iovlen, auth_off, auth_len, crypt_off, crypt_len, icv_off, ivp); - panic("%s: pass I/O vectors to encrypt/decrypt functions.", __func__); done: crypto_done(crp); Modified: user/jmallett/octeon/sys/mips/cavium/cryptocteon/cryptocteonvar.h ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/cryptocteon/cryptocteonvar.h Mon Jun 21 03:05:31 2010 (r209381) +++ user/jmallett/octeon/sys/mips/cavium/cryptocteon/cryptocteonvar.h Mon Jun 21 04:06:01 2010 (r209382) @@ -55,6 +55,8 @@ struct octo_sess { uint64_t octo_hminner[3]; uint64_t octo_hmouter[3]; + + struct iovec octo_iov[UIO_MAXIOV]; }; #define dprintf(fmt, ...) \ From owner-svn-src-user@FreeBSD.ORG Mon Jun 21 05:42:21 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F7C8106566C; Mon, 21 Jun 2010 05:42:21 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 756078FC13; Mon, 21 Jun 2010 05:42:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5L5gL4o031375; Mon, 21 Jun 2010 05:42:21 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5L5gLZY031373; Mon, 21 Jun 2010 05:42:21 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006210542.o5L5gLZY031373@svn.freebsd.org> From: Juli Mallett Date: Mon, 21 Jun 2010 05:42:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209384 - user/jmallett/octeon/sys/mips/cavium/cryptocteon X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jun 2010 05:42:21 -0000 Author: jmallett Date: Mon Jun 21 05:42:21 2010 New Revision: 209384 URL: http://svn.freebsd.org/changeset/base/209384 Log: o) Use M_ZERO when allocating session data that we want zeroed rather than calling memset by hand. o) Don't memset the iovec array before using it -- it should be adequately bounds-checked and not need the safety net of NULL pointers and 0 lengths. This significantly reduces overhead. OpenSSL speed test, before: type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes aes-128-cbc 447.60k 1754.91k 6431.14k 19025.51k 35813.38k OpenSSL speed test, after: type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes aes-128-cbc 782.49k 3006.76k 10510.03k 26280.64k 38939.45k Modified: user/jmallett/octeon/sys/mips/cavium/cryptocteon/cryptocteon.c Modified: user/jmallett/octeon/sys/mips/cavium/cryptocteon/cryptocteon.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/cryptocteon/cryptocteon.c Mon Jun 21 04:37:39 2010 (r209383) +++ user/jmallett/octeon/sys/mips/cavium/cryptocteon/cryptocteon.c Mon Jun 21 05:42:21 2010 (r209384) @@ -174,7 +174,7 @@ cryptocteon_newsession(device_t dev, u_i sc->sc_sesnum *= 2; ocd = malloc(sc->sc_sesnum * sizeof(struct octo_sess *), - M_DEVBUF, M_NOWAIT); + M_DEVBUF, M_NOWAIT | M_ZERO); if (ocd == NULL) { /* Reset session number */ if (sc->sc_sesnum == CRYPTO_SW_SESSIONS) @@ -184,7 +184,6 @@ cryptocteon_newsession(device_t dev, u_i dprintf("%s,%d: ENOBUFS\n", __FILE__, __LINE__); return ENOBUFS; } - memset(ocd, 0, sc->sc_sesnum * sizeof(struct octo_sess *)); /* Copy existing sessions */ if (sc->sc_sessions) { @@ -199,13 +198,12 @@ cryptocteon_newsession(device_t dev, u_i ocd = &sc->sc_sessions[i]; *sid = i; - *ocd = malloc(sizeof(struct octo_sess), M_DEVBUF, M_NOWAIT); + *ocd = malloc(sizeof(struct octo_sess), M_DEVBUF, M_NOWAIT | M_ZERO); if (*ocd == NULL) { cryptocteon_freesession(NULL, i); dprintf("%s,%d: ENOBUFS\n", __FILE__, __LINE__); return ENOBUFS; } - memset(*ocd, 0, sizeof(struct octo_sess)); if (encini && encini->cri_key) { (*ocd)->octo_encklen = (encini->cri_klen + 7) / 8; @@ -443,7 +441,6 @@ cryptocteon_process(device_t dev, struct /* * setup the I/O vector to cover the buffer */ - memset(od->octo_iov, 0, sizeof od->octo_iov); if (crp->crp_flags & CRYPTO_F_IMBUF) { iovcnt = 0; iovlen = 0; From owner-svn-src-user@FreeBSD.ORG Mon Jun 21 07:06:05 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD0E1106564A; Mon, 21 Jun 2010 07:06:05 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CCD298FC18; Mon, 21 Jun 2010 07:06:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5L765JS049849; Mon, 21 Jun 2010 07:06:05 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5L765Zq049847; Mon, 21 Jun 2010 07:06:05 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006210706.o5L765Zq049847@svn.freebsd.org> From: Juli Mallett Date: Mon, 21 Jun 2010 07:06:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209386 - user/jmallett/octeon/sys/mips/cavium/usb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jun 2010 07:06:05 -0000 Author: jmallett Date: Mon Jun 21 07:06:05 2010 New Revision: 209386 URL: http://svn.freebsd.org/changeset/base/209386 Log: Set USB revision. Modified: user/jmallett/octeon/sys/mips/cavium/usb/octusb.c Modified: user/jmallett/octeon/sys/mips/cavium/usb/octusb.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/usb/octusb.c Mon Jun 21 05:42:36 2010 (r209385) +++ user/jmallett/octeon/sys/mips/cavium/usb/octusb.c Mon Jun 21 07:06:05 2010 (r209386) @@ -867,6 +867,9 @@ octusb_init(struct octusb_softc *sc) if (sc->sc_noport > OCTUSB_MAX_PORTS) sc->sc_noport = OCTUSB_MAX_PORTS; + /* set USB revision */ + sc->sc_bus.usbrev = USB_REV_2_0; + USB_BUS_LOCK(&sc->sc_bus); /* setup all ports */ From owner-svn-src-user@FreeBSD.ORG Mon Jun 21 07:17:49 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 180921065670; Mon, 21 Jun 2010 07:17:49 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 07DC88FC17; Mon, 21 Jun 2010 07:17:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5L7HmIh052465; Mon, 21 Jun 2010 07:17:48 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5L7HmWx052463; Mon, 21 Jun 2010 07:17:48 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006210717.o5L7HmWx052463@svn.freebsd.org> From: Juli Mallett Date: Mon, 21 Jun 2010 07:17:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209387 - user/jmallett/octeon/sys/contrib/octeon-sdk X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jun 2010 07:17:49 -0000 Author: jmallett Date: Mon Jun 21 07:17:48 2010 New Revision: 209387 URL: http://svn.freebsd.org/changeset/base/209387 Log: The Lanner MR320's on-board USB has a 12MHz clock. Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-board.c Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-board.c ============================================================================== --- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-board.c Mon Jun 21 07:06:05 2010 (r209386) +++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-board.c Mon Jun 21 07:17:48 2010 (r209387) @@ -690,6 +690,9 @@ cvmx_helper_board_usb_clock_types_t __cv { switch (cvmx_sysinfo_get()->board_type) { case CVMX_BOARD_TYPE_BBGW_REF: +#if defined(OCTEON_VENDOR_LANNER) + case CVMX_BOARD_TYPE_CUST_LANNER_MR320: +#endif return USB_CLOCK_TYPE_CRYSTAL_12; } return USB_CLOCK_TYPE_REF_48; From owner-svn-src-user@FreeBSD.ORG Mon Jun 21 10:43:13 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF6F81065688; Mon, 21 Jun 2010 10:43:13 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CF7AE8FC17; Mon, 21 Jun 2010 10:43:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5LAhD4R098818; Mon, 21 Jun 2010 10:43:13 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5LAhDJK098816; Mon, 21 Jun 2010 10:43:13 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006211043.o5LAhDJK098816@svn.freebsd.org> From: Juli Mallett Date: Mon, 21 Jun 2010 10:43:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209391 - user/jmallett/octeon/sys/mips/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jun 2010 10:43:14 -0000 Author: jmallett Date: Mon Jun 21 10:43:13 2010 New Revision: 209391 URL: http://svn.freebsd.org/changeset/base/209391 Log: Reenable octusb now that the hang on boot is fixed. Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-32 ============================================================================== --- user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Mon Jun 21 09:55:56 2010 (r209390) +++ user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Mon Jun 21 10:43:13 2010 (r209391) @@ -101,7 +101,8 @@ device uhci # UHCI PCI->USB interface device ohci # OHCI PCI->USB interface device ehci # EHCI PCI->USB interface (USB 2.0) device usb # USB Bus (required) -#device octusb # Cavium Octeon USB Bus +device octusb # Cavium Octeon USB Bus +options USB_DEBUG # ATA and ATAPI devices device ata From owner-svn-src-user@FreeBSD.ORG Mon Jun 21 13:59:50 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5CC03106567B; Mon, 21 Jun 2010 13:59:50 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3294A8FC1F; Mon, 21 Jun 2010 13:59:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5LDxoYv042463; Mon, 21 Jun 2010 13:59:50 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5LDxoSd042461; Mon, 21 Jun 2010 13:59:50 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006211359.o5LDxoSd042461@svn.freebsd.org> From: Juli Mallett Date: Mon, 21 Jun 2010 13:59:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209395 - user/jmallett/octeon/sys/mips/cavium/octe X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jun 2010 13:59:50 -0000 Author: jmallett Date: Mon Jun 21 13:59:49 2010 New Revision: 209395 URL: http://svn.freebsd.org/changeset/base/209395 Log: o) Allow for software vlans in MTU calculation. o) Reenable cvm_oct_common_set_multicast_list and fix CAM programming to use the MAC address without assuming it is badded out to be a 64-bit quantity like the code used to do. o) Do not fix a typo about rejecting some sort of "multicat". Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c Mon Jun 21 13:52:31 2010 (r209394) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c Mon Jun 21 13:59:49 2010 (r209395) @@ -100,7 +100,6 @@ static struct ifnet_stats *cvm_oct_commo */ void cvm_oct_common_set_multicast_list(struct ifnet *ifp) { -#if 0 cvmx_gmxx_prtx_cfg_t gmx_cfg; cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; int interface = INTERFACE(priv->port); @@ -133,7 +132,6 @@ void cvm_oct_common_set_multicast_list(s cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64); } -#endif } @@ -164,12 +162,12 @@ static int cvm_oct_common_set_mac_addres cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64 & ~1ull); cvmx_write_csr(CVMX_GMXX_SMACX(index, interface), mac); - cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM0(index, interface), ptr[2]); - cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM1(index, interface), ptr[3]); - cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM2(index, interface), ptr[4]); - cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM3(index, interface), ptr[5]); - cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM4(index, interface), ptr[6]); - cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM5(index, interface), ptr[7]); + cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM0(index, interface), ptr[0]); + cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM1(index, interface), ptr[1]); + cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM2(index, interface), ptr[2]); + cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM3(index, interface), ptr[3]); + cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM4(index, interface), ptr[4]); + cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM5(index, interface), ptr[5]); cvm_oct_common_set_multicast_list(ifp); cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64); } @@ -189,11 +187,7 @@ int cvm_oct_common_change_mtu(struct ifn cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; int interface = INTERFACE(priv->port); int index = INDEX(priv->port); -#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) int vlan_bytes = 4; -#else - int vlan_bytes = 0; -#endif /* Limit the MTU to make sure the ethernet packets are between 64 bytes and 65535 bytes */ From owner-svn-src-user@FreeBSD.ORG Mon Jun 21 14:25:45 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21E2F1065670; Mon, 21 Jun 2010 14:25:45 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 115AE8FC1F; Mon, 21 Jun 2010 14:25:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5LEPilJ048319; Mon, 21 Jun 2010 14:25:44 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5LEPiER048315; Mon, 21 Jun 2010 14:25:44 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006211425.o5LEPiER048315@svn.freebsd.org> From: Juli Mallett Date: Mon, 21 Jun 2010 14:25:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209396 - user/jmallett/octeon/sys/mips/cavium/octe X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jun 2010 14:25:45 -0000 Author: jmallett Date: Mon Jun 21 14:25:44 2010 New Revision: 209396 URL: http://svn.freebsd.org/changeset/base/209396 Log: o) Support TCP and UDP checksum offload. XXX We also check IP on input but don't insert IP on output, so it would sure be nice to have a way to signal support for RXCSUM != TXCSUM. o) Note support for VLAN MTUs as well as hardware VLAN tagging. o) Attempt to use hardware VLAN tagging on receive; I haven't yet gotten this to work and there isn't an obvious way to insert tags on transmit that I've found yet, either. o) Remove a stale comment about MII. Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c user/jmallett/octeon/sys/mips/cavium/octe/octe.c Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c Mon Jun 21 13:59:49 2010 (r209395) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c Mon Jun 21 14:25:44 2010 (r209396) @@ -326,6 +326,11 @@ void cvm_oct_tasklet_rx(void *context, i m->m_pkthdr.csum_data = 0xffff; } + if (work->word2.s.vlan_valid) { + m->m_pkthdr.ether_vtag = work->word2.s.vlan_id; + m->m_flags |= M_VLANTAG; + } + if (priv->intercept_cb) { callback_result = priv->intercept_cb(ifp, work, m); Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c Mon Jun 21 13:59:49 2010 (r209395) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c Mon Jun 21 14:25:44 2010 (r209396) @@ -291,15 +291,11 @@ dont_put_mbuf_in_hw: #endif /* REUSE_MBUFS_WITHOUT_FREE */ /* Check if we can use the hardware checksumming */ -#if 0 - if (USE_HW_TCPUDP_CHECKSUM && (m->protocol == htons(ETH_P_IP)) && - (ip_hdr(m)->version == 4) && (ip_hdr(m)->ihl == 5) && - ((ip_hdr(m)->frag_off == 0) || (ip_hdr(m)->frag_off == 1<<14)) && - ((ip_hdr(m)->protocol == IP_PROTOCOL_TCP) || (ip_hdr(m)->protocol == IP_PROTOCOL_UDP))) { + if (USE_HW_TCPUDP_CHECKSUM && + (m->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP)) != 0) { /* Use hardware checksum calc */ - pko_command.s.ipoffp1 = sizeof(struct ethhdr) + 1; + pko_command.s.ipoffp1 = ETHER_HDR_LEN + 1; } -#endif if (USE_ASYNC_IOBDMA) { /* Get the number of mbufs in use by the hardware */ Modified: user/jmallett/octeon/sys/mips/cavium/octe/octe.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/octe.c Mon Jun 21 13:59:49 2010 (r209395) +++ user/jmallett/octeon/sys/mips/cavium/octe/octe.c Mon Jun 21 14:25:44 2010 (r209396) @@ -32,10 +32,6 @@ * XXX This file should be moved to if_octe.c * XXX The driver may have sufficient locking but we need locking to protect * the interfaces presented here, right? - * XXX There is a common MII bus on Octeon, we get the identifier of our PHY - * in priv->phy_id; right now we attach all the PHYs to each interface, - * which is clearly wrong. Need to either modify miibus or probe and - * attach the specific PHY for each interface without an miibus in between. */ #include "opt_inet.h" @@ -59,6 +55,7 @@ #include #include #include +#include #ifdef INET #include @@ -186,6 +183,11 @@ octe_attach(device_t dev) ether_ifattach(ifp, priv->mac); + ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); + ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING | IFCAP_HWCSUM; + ifp->if_capenable = ifp->if_capabilities; + ifp->if_hwassist = CSUM_TCP | CSUM_UDP; + OCTE_TX_LOCK(priv); IFQ_SET_MAXLEN(&ifp->if_snd, MAX_OUT_QUEUE_DEPTH); ifp->if_snd.ifq_drv_maxlen = MAX_OUT_QUEUE_DEPTH; From owner-svn-src-user@FreeBSD.ORG Mon Jun 21 15:07:10 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3C0C106564A; Mon, 21 Jun 2010 15:07:10 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6CE288FC18; Mon, 21 Jun 2010 15:07:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5LF7AVw057486; Mon, 21 Jun 2010 15:07:10 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5LF7Atg057484; Mon, 21 Jun 2010 15:07:10 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006211507.o5LF7Atg057484@svn.freebsd.org> From: Juli Mallett Date: Mon, 21 Jun 2010 15:07:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209398 - user/jmallett/octeon/sys/mips/cavium/usb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jun 2010 15:07:10 -0000 Author: jmallett Date: Mon Jun 21 15:07:10 2010 New Revision: 209398 URL: http://svn.freebsd.org/changeset/base/209398 Log: Don't wait for a fixup that will never come if we're done. Modified: user/jmallett/octeon/sys/mips/cavium/usb/octusb.c Modified: user/jmallett/octeon/sys/mips/cavium/usb/octusb.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/usb/octusb.c Mon Jun 21 14:37:16 2010 (r209397) +++ user/jmallett/octeon/sys/mips/cavium/usb/octusb.c Mon Jun 21 15:07:10 2010 (r209398) @@ -374,7 +374,7 @@ octusb_host_control_data_rx(struct octus td->remainder -= rem; td->qh->fixup_off += rem; - return (1); /* done */ + return (0); /* done */ } static uint8_t From owner-svn-src-user@FreeBSD.ORG Tue Jun 22 18:54:06 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3374106566C; Tue, 22 Jun 2010 18:54:06 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 928BC8FC17; Tue, 22 Jun 2010 18:54:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5MIs6S0028586; Tue, 22 Jun 2010 18:54:06 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5MIs6Hj028584; Tue, 22 Jun 2010 18:54:06 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006221854.o5MIs6Hj028584@svn.freebsd.org> From: Juli Mallett Date: Tue, 22 Jun 2010 18:54:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209435 - user/jmallett/octeon/sys/mips/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jun 2010 18:54:06 -0000 Author: jmallett Date: Tue Jun 22 18:54:06 2010 New Revision: 209435 URL: http://svn.freebsd.org/changeset/base/209435 Log: Add more ATA, USB and pseudo- devices. Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-32 ============================================================================== --- user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Tue Jun 22 18:24:26 2010 (r209434) +++ user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Tue Jun 22 18:54:06 2010 (r209435) @@ -66,17 +66,28 @@ options INVARIANT_SUPPORT #Extra sanity #options WITNESS #Enable checks to detect deadlocks and cycles #options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed +# Pseudo devices. +device loop # Network loopback +device random # Entropy device +device ether # Ethernet support +device vlan # 802.1Q VLAN support +device tun # Packet tunnel. +device pty # BSD-style compatibility pseudo ttys +device md # Memory "disks" +device gif # IPv6 and IPv4 tunneling +device faith # IPv6-to-IPv4 relaying (translation) +device firmware # firmware assist module + #XXXimp device genclock -device loop -device ether -device md device puc device uart device octe #options VERBOSE_SYSINIT -device bpf -device random +# The `bpf' device enables the Berkeley Packet Filter. +# Be aware of the administrative consequences of enabling this! +# Note that 'bpf' is required for DHCP. +device bpf # Berkeley packet filter device crypto device cryptodev @@ -97,20 +108,58 @@ options AH_SUPPORT_AR5416 # enable AR54 device ath_rate_sample # SampleRate tx rate control for ath # USB support +options USB_DEBUG # enable debug msgs +device octusb # Cavium Octeon USB Bus device uhci # UHCI PCI->USB interface device ohci # OHCI PCI->USB interface device ehci # EHCI PCI->USB interface (USB 2.0) device usb # USB Bus (required) -device octusb # Cavium Octeon USB Bus -options USB_DEBUG +#device udbp # USB Double Bulk Pipe devices +device uhid # "Human Interface Devices" +device ulpt # Printer +device umass # Disks/Mass storage - Requires scbus and da +device urio # Diamond Rio 500 MP3 player +# USB Serial devices +device uark # Technologies ARK3116 based serial adapters +device ubsa # Belkin F5U103 and compatible serial adapters +device uftdi # For FTDI usb serial adapters +device uipaq # Some WinCE based devices +device uplcom # Prolific PL-2303 serial adapters +device uslcom # SI Labs CP2101/CP2102 serial adapters +device uvisor # Visor and Palm devices +device uvscom # USB serial support for DDI pocket's PHS +# USB Ethernet, requires miibus +device aue # ADMtek USB Ethernet +device axe # ASIX Electronics USB Ethernet +device cdce # Generic USB over Ethernet +device cue # CATC USB Ethernet +device kue # Kawasaki LSI USB Ethernet +device rue # RealTek RTL8150 USB Ethernet +device udav # Davicom DM9601E USB +# USB Wireless +device rum # Ralink Technology RT2501USB wireless NICs +device uath # Atheros AR5523 wireless NICs +device ural # Ralink Technology RT2500USB wireless NICs +device zyd # ZyDAS zb1211/zb1211b wireless NICs # ATA and ATAPI devices device ata device atadisk # ATA disk drives device ataraid # ATA RAID drives device atapicd # ATAPI CDROM drives +device atapifd # ATAPI floppy drives +device atapist # ATAPI tape drives options ATA_STATIC_ID # Static device numbering +# SCSI peripherals +device scbus # SCSI bus (required for SCSI) +device ch # SCSI media changers +device da # Direct Access (disks) +device sa # Sequential Access (tape etc) +device cd # CD +device pass # Passthrough device (direct SCSI access) +device ses # SCSI Environmental Services (and SAF-TE) + # PCI Ethernet NICs that use the common MII bus controller code. # NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! device miibus # MII bus support From owner-svn-src-user@FreeBSD.ORG Tue Jun 22 18:56:10 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51C9C1065673; Tue, 22 Jun 2010 18:56:10 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 413B68FC1A; Tue, 22 Jun 2010 18:56:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5MIuAGh029102; Tue, 22 Jun 2010 18:56:10 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5MIuAH8029100; Tue, 22 Jun 2010 18:56:10 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006221856.o5MIuAH8029100@svn.freebsd.org> From: Juli Mallett Date: Tue, 22 Jun 2010 18:56:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209436 - user/jmallett/octeon/sys/mips/cavium/usb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jun 2010 18:56:10 -0000 Author: jmallett Date: Tue Jun 22 18:56:09 2010 New Revision: 209436 URL: http://svn.freebsd.org/changeset/base/209436 Log: Merge latest from hps@. Modified: user/jmallett/octeon/sys/mips/cavium/usb/octusb.c Modified: user/jmallett/octeon/sys/mips/cavium/usb/octusb.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/usb/octusb.c Tue Jun 22 18:54:06 2010 (r209435) +++ user/jmallett/octeon/sys/mips/cavium/usb/octusb.c Tue Jun 22 18:56:09 2010 (r209436) @@ -282,14 +282,14 @@ octusb_host_control_header_tx(struct oct td->offset += 8; td->remainder -= 8; + /* setup data length and offset */ td->qh->fixup_len = UGETW(td->qh->fixup_buf + 6); + td->qh->fixup_off = 0; + if (td->qh->fixup_len > (OCTUSB_MAX_FIXUP - 8)) { td->error_any = 1; return (0); /* done */ } - td->qh->fixup_len += 8; - td->qh->fixup_off = 8; - /* do control IN request */ if (td->qh->fixup_buf[0] & UE_DIR_IN) { @@ -304,7 +304,7 @@ octusb_host_control_header_tx(struct oct status = cvmx_usb_submit_control( &sc->sc_port[td->qh->port_index].state, td->qh->ep_handle, td->qh->fixup_phys, - td->qh->fixup_phys + 8ULL, td->qh->fixup_len - 8, + td->qh->fixup_phys + 8, td->qh->fixup_len, &octusb_complete_cb, td); /* check status */ if (status < 0) { @@ -340,7 +340,8 @@ octusb_host_control_data_tx(struct octus DPRINTFN(1, "Excess setup transmit data\n"); return (0); /* done */ } - usbd_copy_out(td->pc, td->offset, td->qh->fixup_buf + td->qh->fixup_off, td->remainder); + usbd_copy_out(td->pc, td->offset, td->qh->fixup_buf + + td->qh->fixup_off + 8, td->remainder); td->offset += td->remainder; td->qh->fixup_off += td->remainder; @@ -363,12 +364,13 @@ octusb_host_control_data_rx(struct octus return (0); /* done */ /* copy data from buffer */ - rem = 8 + td->qh->fixup_actlen - td->qh->fixup_off; + rem = td->qh->fixup_actlen - td->qh->fixup_off; if (rem > td->remainder) rem = td->remainder; - usbd_copy_in(td->pc, td->offset, td->qh->fixup_buf + td->qh->fixup_off, rem); + usbd_copy_in(td->pc, td->offset, td->qh->fixup_buf + + td->qh->fixup_off + 8, rem); td->offset += rem; td->remainder -= rem; @@ -411,7 +413,7 @@ octusb_host_control_status_tx(struct oct status = cvmx_usb_submit_control( &sc->sc_port[td->qh->port_index].state, td->qh->ep_handle, td->qh->fixup_phys, - td->qh->fixup_phys + 8ULL, td->qh->fixup_len - 8, + td->qh->fixup_phys + 8, td->qh->fixup_len, &octusb_complete_cb, td); /* check status */ @@ -1122,18 +1124,23 @@ octusb_setup_standard_chain(struct usb_x static void octusb_device_done(struct usb_xfer *xfer, usb_error_t error) { - struct octusb_td *td; - USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED); DPRINTFN(2, "xfer=%p, endpoint=%p, error=%d\n", xfer, xfer->endpoint, error); - td = xfer->td_start[0]; + /* + * 1) Free any endpoints. + * 2) Control transfers can be split and we should not re-open + * the data pipe between transactions unless there is an error. + */ + if ((xfer->flags_int.control_act == 0) || (error != 0)) { + struct octusb_td *td; - /* free any endpoints */ - octusb_host_free_endpoint(td); + td = xfer->td_start[0]; + octusb_host_free_endpoint(td); + } /* dequeue transfer and start next transfer */ usbd_transfer_done(xfer, error); } From owner-svn-src-user@FreeBSD.ORG Tue Jun 22 19:17:57 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7512106566B; Tue, 22 Jun 2010 19:17:57 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A6F108FC0A; Tue, 22 Jun 2010 19:17:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5MJHvxf033921; Tue, 22 Jun 2010 19:17:57 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5MJHvYC033919; Tue, 22 Jun 2010 19:17:57 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006221917.o5MJHvYC033919@svn.freebsd.org> From: Juli Mallett Date: Tue, 22 Jun 2010 19:17:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209437 - user/jmallett/octeon/sys/mips/cavium/usb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jun 2010 19:17:57 -0000 Author: jmallett Date: Tue Jun 22 19:17:57 2010 New Revision: 209437 URL: http://svn.freebsd.org/changeset/base/209437 Log: At really, really high debug levels, turn on the debugging within the Simple Executive, too. Modified: user/jmallett/octeon/sys/mips/cavium/usb/octusb.c Modified: user/jmallett/octeon/sys/mips/cavium/usb/octusb.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/usb/octusb.c Tue Jun 22 18:56:09 2010 (r209436) +++ user/jmallett/octeon/sys/mips/cavium/usb/octusb.c Tue Jun 22 19:17:57 2010 (r209437) @@ -852,6 +852,7 @@ octusb_iterate_hw_softc(struct usb_bus * usb_error_t octusb_init(struct octusb_softc *sc) { + cvmx_usb_initialize_flags_t flags; int status; uint8_t x; @@ -872,13 +873,18 @@ octusb_init(struct octusb_softc *sc) /* set USB revision */ sc->sc_bus.usbrev = USB_REV_2_0; + /* flags for port initialization */ + flags = CVMX_USB_INITIALIZE_FLAGS_CLOCK_AUTO; +#ifdef USB_DEBUG + if (octusbdebug > 100) + flags |= CVMX_USB_INITIALIZE_FLAGS_DEBUG_ALL; +#endif + USB_BUS_LOCK(&sc->sc_bus); /* setup all ports */ for (x = 0; x != sc->sc_noport; x++) { - status = cvmx_usb_initialize( - &sc->sc_port[x].state, x, - CVMX_USB_INITIALIZE_FLAGS_CLOCK_AUTO); + status = cvmx_usb_initialize(&sc->sc_port[x].state, x, flags); if (status < 0) sc->sc_port[x].disabled = 1; } From owner-svn-src-user@FreeBSD.ORG Thu Jun 24 08:35:02 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D97D3106564A; Thu, 24 Jun 2010 08:35:02 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C88688FC14; Thu, 24 Jun 2010 08:35:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5O8Z2JT033093; Thu, 24 Jun 2010 08:35:02 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5O8Z22Q033089; Thu, 24 Jun 2010 08:35:02 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006240835.o5O8Z22Q033089@svn.freebsd.org> From: Juli Mallett Date: Thu, 24 Jun 2010 08:35:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209501 - user/jmallett/octeon/sys/mips/cavium/octe X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jun 2010 08:35:02 -0000 Author: jmallett Date: Thu Jun 24 08:35:02 2010 New Revision: 209501 URL: http://svn.freebsd.org/changeset/base/209501 Log: Handle MAC setting and promiscuous/allmulti more gracefully. Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h user/jmallett/octeon/sys/mips/cavium/octe/octe.c Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c Thu Jun 24 08:08:43 2010 (r209500) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c Thu Jun 24 08:35:02 2010 (r209501) @@ -139,10 +139,9 @@ void cvm_oct_common_set_multicast_list(s * Set the hardware MAC address for a device * * @param dev Device to change the MAC address for - * @param addr Address structure to change it too. MAC address is addr + 2. - * @return Zero on success + * @param addr Address structure to change it too. */ -static int cvm_oct_common_set_mac_address(struct ifnet *ifp, void *addr) +void cvm_oct_common_set_mac_address(struct ifnet *ifp, const void *addr) { cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; cvmx_gmxx_prtx_cfg_t gmx_cfg; @@ -153,7 +152,7 @@ static int cvm_oct_common_set_mac_addres if ((interface < 2) && (cvmx_helper_interface_get_mode(interface) != CVMX_HELPER_INTERFACE_MODE_SPI)) { int i; - uint8_t *ptr = addr; + const uint8_t *ptr = addr; uint64_t mac = 0; for (i = 0; i < 6; i++) mac = (mac<<8) | (uint64_t)(ptr[i]); @@ -171,7 +170,6 @@ static int cvm_oct_common_set_mac_addres cvm_oct_common_set_multicast_list(ifp); cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64); } - return 0; } @@ -245,18 +243,10 @@ int cvm_oct_common_init(struct ifnet *if ifp->if_mtu = ETHERMTU; -#if 0 - if (priv->queue != -1) { - if (USE_HW_TCPUDP_CHECKSUM) - ifp->features |= NETIF_F_IP_CSUM; - } -#endif count++; #if 0 ifp->get_stats = cvm_oct_common_get_stats; - ifp->set_mac_address = cvm_oct_common_set_mac_address; - ifp->features |= NETIF_F_LLTX; /* We do our own locking, Linux doesn't need to */ #ifdef CONFIG_NET_POLL_CONTROLLER ifp->poll_controller = cvm_oct_poll_controller; #endif Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h Thu Jun 24 08:08:43 2010 (r209500) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h Thu Jun 24 08:35:02 2010 (r209501) @@ -32,6 +32,7 @@ void cvm_oct_common_uninit(struct ifnet int cvm_oct_common_change_mtu(struct ifnet *ifp, int new_mtu); void cvm_oct_common_set_multicast_list(struct ifnet *ifp); +void cvm_oct_common_set_mac_address(struct ifnet *ifp, const void *); int cvm_oct_init_module(device_t); void cvm_oct_cleanup_module(void); Modified: user/jmallett/octeon/sys/mips/cavium/octe/octe.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/octe.c Thu Jun 24 08:08:43 2010 (r209500) +++ user/jmallett/octeon/sys/mips/cavium/octe/octe.c Thu Jun 24 08:35:02 2010 (r209501) @@ -53,8 +53,10 @@ #include #include #include +#include #include #include +#include #include #ifdef INET @@ -167,7 +169,13 @@ octe_attach(device_t dev) ifmedia_set(&priv->media, IFM_ETHER | IFM_AUTO); } - ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + /* + * XXX + * We don't support programming the multicast filter right now, although it + * ought to be easy enough. (Presumably it's just a matter of putting + * multicast addresses in the CAM?) + */ + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST | IFF_ALLMULTI; ifp->if_init = octe_init; ifp->if_ioctl = octe_ioctl; ifp->if_start = octe_start; @@ -252,6 +260,11 @@ octe_init(void *arg) if (priv->open != NULL) priv->open(ifp); + if (((ifp->if_flags ^ priv->if_flags) & (IFF_ALLMULTI | IFF_MULTICAST | IFF_PROMISC)) != 0) + cvm_oct_common_set_multicast_list(ifp); + + cvm_oct_common_set_mac_address(ifp, IF_LLADDR(ifp)); + if (priv->miibus != NULL) mii_mediachg(device_get_softc(priv->miibus)); @@ -450,6 +463,8 @@ octe_ioctl(struct ifnet *ifp, u_long cmd return (0); case SIOCSIFFLAGS: + if (ifp->if_flags == priv->if_flags) + return (0); if ((ifp->if_flags & IFF_UP) != 0) { if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) octe_init(priv); From owner-svn-src-user@FreeBSD.ORG Sat Jun 26 03:08:13 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50A5E1065672; Sat, 26 Jun 2010 03:08:13 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A3098FC15; Sat, 26 Jun 2010 03:08:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5Q38D5k098618; Sat, 26 Jun 2010 03:08:13 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5Q38CxF098592; Sat, 26 Jun 2010 03:08:12 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006260308.o5Q38CxF098592@svn.freebsd.org> From: Juli Mallett Date: Sat, 26 Jun 2010 03:08:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209528 - in user/jmallett/octeon: . bin/pkill bin/sh cddl/contrib/opensolaris/lib/libdtrace/common contrib/binutils/binutils/doc etc/mtree gnu/usr.bin/binutils/ld lib lib/libc/mips/sys... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jun 2010 03:08:13 -0000 Author: jmallett Date: Sat Jun 26 03:08:12 2010 New Revision: 209528 URL: http://svn.freebsd.org/changeset/base/209528 Log: Merge from head and expand pte.h's description of cache coherency attributes at the same time. Added: user/jmallett/octeon/Makefile.mips - copied unchanged from r209526, head/Makefile.mips user/jmallett/octeon/share/man/man4/aibs.4 - copied unchanged from r209526, head/share/man/man4/aibs.4 user/jmallett/octeon/sys/conf/ldscript.mips.n32 - copied unchanged from r209526, head/sys/conf/ldscript.mips.n32 user/jmallett/octeon/sys/dev/acpi_support/atk0110.c - copied unchanged from r209526, head/sys/dev/acpi_support/atk0110.c user/jmallett/octeon/sys/kern/kern_et.c - copied unchanged from r209526, head/sys/kern/kern_et.c user/jmallett/octeon/sys/mips/conf/XLRN32 - copied unchanged from r209526, head/sys/mips/conf/XLRN32 user/jmallett/octeon/sys/modules/acpi/aibs/ - copied from r209526, head/sys/modules/acpi/aibs/ user/jmallett/octeon/sys/sys/timeet.h - copied unchanged from r209526, head/sys/sys/timeet.h user/jmallett/octeon/sys/x86/x86/timeevents.c - copied unchanged from r209526, head/sys/x86/x86/timeevents.c user/jmallett/octeon/tools/tools/netrate/tcpp/parallelism.csh - copied unchanged from r209526, head/tools/tools/netrate/tcpp/parallelism.csh user/jmallett/octeon/tools/tools/netrate/tcpp/runit.pl - copied unchanged from r209526, head/tools/tools/netrate/tcpp/runit.pl user/jmallett/octeon/usr.sbin/pc-sysinstall/ - copied from r209526, head/usr.sbin/pc-sysinstall/ Modified: user/jmallett/octeon/Makefile.inc1 user/jmallett/octeon/bin/pkill/pkill.1 user/jmallett/octeon/bin/pkill/pkill.c user/jmallett/octeon/bin/sh/parser.c user/jmallett/octeon/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l user/jmallett/octeon/contrib/binutils/binutils/doc/readelf.1 user/jmallett/octeon/etc/mtree/BSD.usr.dist user/jmallett/octeon/gnu/usr.bin/binutils/ld/elf32btsmipn32_fbsd.sh user/jmallett/octeon/gnu/usr.bin/binutils/ld/elf32ltsmipn32_fbsd.sh user/jmallett/octeon/lib/Makefile user/jmallett/octeon/lib/libc/mips/sys/brk.S user/jmallett/octeon/lib/libc/mips/sys/sbrk.S user/jmallett/octeon/lib/libc/nls/ru_RU.KOI8-R.msg (contents, props changed) user/jmallett/octeon/sbin/fsck_ffs/main.c user/jmallett/octeon/sbin/fsck_ffs/suj.c user/jmallett/octeon/sbin/fsck_msdosfs/Makefile user/jmallett/octeon/sbin/fsck_msdosfs/boot.c user/jmallett/octeon/sbin/fsck_msdosfs/check.c user/jmallett/octeon/sbin/fsck_msdosfs/dir.c user/jmallett/octeon/sbin/fsck_msdosfs/fat.c user/jmallett/octeon/sbin/geom/class/part/geom_part.c user/jmallett/octeon/sbin/geom/class/sched/gsched.8 user/jmallett/octeon/sbin/geom/core/geom.c user/jmallett/octeon/sbin/geom/core/geom.h user/jmallett/octeon/sbin/geom/misc/subr.c user/jmallett/octeon/sbin/geom/misc/subr.h user/jmallett/octeon/sbin/ping/ping.c user/jmallett/octeon/share/examples/perfmon/perfmon.c user/jmallett/octeon/share/man/man4/Makefile user/jmallett/octeon/sys/amd64/amd64/exception.S user/jmallett/octeon/sys/amd64/amd64/machdep.c user/jmallett/octeon/sys/amd64/amd64/mp_machdep.c user/jmallett/octeon/sys/amd64/ia32/ia32_exception.S user/jmallett/octeon/sys/amd64/include/apicvar.h user/jmallett/octeon/sys/amd64/include/asmacros.h user/jmallett/octeon/sys/boot/ficl/ficl.h user/jmallett/octeon/sys/boot/forth/loader.conf user/jmallett/octeon/sys/compat/x86bios/x86bios.c user/jmallett/octeon/sys/compat/x86bios/x86bios.h user/jmallett/octeon/sys/conf/files user/jmallett/octeon/sys/conf/files.amd64 user/jmallett/octeon/sys/conf/files.i386 user/jmallett/octeon/sys/dev/acpica/acpi_hpet.c user/jmallett/octeon/sys/dev/acpica/acpi_hpet.h user/jmallett/octeon/sys/dev/e1000/if_igb.c user/jmallett/octeon/sys/dev/fb/fbreg.h user/jmallett/octeon/sys/dev/fb/vesa.c user/jmallett/octeon/sys/dev/hptiop/hptiop.c user/jmallett/octeon/sys/dev/hptmv/entry.c user/jmallett/octeon/sys/dev/sound/usb/uaudio.c user/jmallett/octeon/sys/dev/sound/usb/uaudioreg.h user/jmallett/octeon/sys/dev/usb/controller/ehci.c user/jmallett/octeon/sys/dev/usb/controller/ohci.c user/jmallett/octeon/sys/dev/usb/controller/uhci.c user/jmallett/octeon/sys/dev/usb/net/if_rue.c user/jmallett/octeon/sys/dev/usb/quirk/usb_quirk.c user/jmallett/octeon/sys/dev/usb/usb_transfer.c user/jmallett/octeon/sys/dev/usb/usbdevs user/jmallett/octeon/sys/dev/usb/wlan/if_upgt.c user/jmallett/octeon/sys/fs/udf/udf_vnops.c user/jmallett/octeon/sys/i386/conf/NOTES user/jmallett/octeon/sys/i386/i386/apic_vector.s user/jmallett/octeon/sys/i386/i386/atpic_vector.s user/jmallett/octeon/sys/i386/i386/exception.s user/jmallett/octeon/sys/i386/i386/identcpu.c user/jmallett/octeon/sys/i386/i386/machdep.c user/jmallett/octeon/sys/i386/i386/mp_machdep.c user/jmallett/octeon/sys/i386/i386/support.s user/jmallett/octeon/sys/i386/i386/vm_machdep.c user/jmallett/octeon/sys/i386/include/apicvar.h user/jmallett/octeon/sys/i386/include/md_var.h user/jmallett/octeon/sys/i386/include/npx.h user/jmallett/octeon/sys/i386/include/pcb.h user/jmallett/octeon/sys/i386/isa/npx.c user/jmallett/octeon/sys/isa/rtc.h user/jmallett/octeon/sys/kern/kern_acct.c user/jmallett/octeon/sys/kern/kern_clock.c user/jmallett/octeon/sys/kern/kern_malloc.c user/jmallett/octeon/sys/kern/kern_mbuf.c user/jmallett/octeon/sys/kern/kern_module.c user/jmallett/octeon/sys/kern/kern_resource.c user/jmallett/octeon/sys/kern/kern_sdt.c user/jmallett/octeon/sys/kern/kern_sig.c user/jmallett/octeon/sys/kern/kern_tc.c user/jmallett/octeon/sys/kern/kern_umtx.c user/jmallett/octeon/sys/kern/makesyscalls.sh user/jmallett/octeon/sys/kern/subr_bus.c user/jmallett/octeon/sys/kern/subr_devstat.c user/jmallett/octeon/sys/kern/subr_fattime.c user/jmallett/octeon/sys/kern/subr_lock.c user/jmallett/octeon/sys/kern/subr_mchain.c user/jmallett/octeon/sys/kern/subr_module.c user/jmallett/octeon/sys/kern/subr_param.c user/jmallett/octeon/sys/kern/subr_trap.c user/jmallett/octeon/sys/kern/subr_witness.c user/jmallett/octeon/sys/kern/sys_process.c user/jmallett/octeon/sys/kern/systrace_args.c user/jmallett/octeon/sys/kern/uipc_mbuf.c user/jmallett/octeon/sys/kern/uipc_mbuf2.c user/jmallett/octeon/sys/kern/uipc_mqueue.c user/jmallett/octeon/sys/kern/uipc_syscalls.c user/jmallett/octeon/sys/kern/vfs_cache.c user/jmallett/octeon/sys/kern/vfs_subr.c user/jmallett/octeon/sys/mips/atheros/ar71xx_wdog.c user/jmallett/octeon/sys/mips/atheros/ar71xxreg.h user/jmallett/octeon/sys/mips/include/pte.h user/jmallett/octeon/sys/mips/include/vm.h user/jmallett/octeon/sys/mips/include/vmparam.h user/jmallett/octeon/sys/mips/mips/exception.S user/jmallett/octeon/sys/mips/mips/machdep.c user/jmallett/octeon/sys/mips/mips/pm_machdep.c user/jmallett/octeon/sys/mips/mips/pmap.c user/jmallett/octeon/sys/modules/acpi/Makefile user/jmallett/octeon/sys/modules/mqueue/Makefile user/jmallett/octeon/sys/netinet/sctp_pcb.c user/jmallett/octeon/sys/pc98/cbus/clock.c user/jmallett/octeon/sys/pc98/include/npx.h user/jmallett/octeon/sys/pc98/pc98/machdep.c user/jmallett/octeon/sys/powerpc/aim/mmu_oea.c user/jmallett/octeon/sys/powerpc/aim/nexus.c user/jmallett/octeon/sys/powerpc/booke/pmap.c user/jmallett/octeon/sys/powerpc/include/intr_machdep.h user/jmallett/octeon/sys/powerpc/include/openpicvar.h user/jmallett/octeon/sys/powerpc/mpc85xx/atpic.c user/jmallett/octeon/sys/powerpc/mpc85xx/ocpbus.c user/jmallett/octeon/sys/powerpc/mpc85xx/opic.c user/jmallett/octeon/sys/powerpc/mpc85xx/pci_ocp.c user/jmallett/octeon/sys/powerpc/powermac/cpcht.c user/jmallett/octeon/sys/powerpc/powermac/openpic_macio.c user/jmallett/octeon/sys/powerpc/powerpc/intr_machdep.c user/jmallett/octeon/sys/powerpc/powerpc/openpic.c user/jmallett/octeon/sys/powerpc/powerpc/pic_if.m user/jmallett/octeon/sys/sys/systm.h user/jmallett/octeon/sys/ufs/ufs/ufs_lookup.c user/jmallett/octeon/sys/vm/vm_page.c user/jmallett/octeon/sys/vm/vm_page.h user/jmallett/octeon/sys/vm/vm_pageout.c user/jmallett/octeon/sys/x86/cpufreq/est.c user/jmallett/octeon/sys/x86/isa/atrtc.c user/jmallett/octeon/sys/x86/isa/clock.c user/jmallett/octeon/sys/x86/x86/local_apic.c user/jmallett/octeon/tools/tools/netrate/tcpp/README user/jmallett/octeon/usr.bin/du/du.1 user/jmallett/octeon/usr.bin/du/du.c user/jmallett/octeon/usr.bin/ypwhich/ypwhich.c user/jmallett/octeon/usr.sbin/Makefile user/jmallett/octeon/usr.sbin/boot0cfg/boot0cfg.c user/jmallett/octeon/usr.sbin/cpucontrol/amd.c user/jmallett/octeon/usr.sbin/cpucontrol/intel.c user/jmallett/octeon/usr.sbin/mptutil/mptutil.8 user/jmallett/octeon/usr.sbin/sysinstall/Makefile user/jmallett/octeon/usr.sbin/sysinstall/dist.c user/jmallett/octeon/usr.sbin/sysinstall/index.c user/jmallett/octeon/usr.sbin/sysinstall/install.c user/jmallett/octeon/usr.sbin/sysinstall/misc.c user/jmallett/octeon/usr.sbin/sysinstall/sysinstall.8 user/jmallett/octeon/usr.sbin/sysinstall/sysinstall.h user/jmallett/octeon/usr.sbin/timed/timed/measure.c Directory Properties: user/jmallett/octeon/ (props changed) user/jmallett/octeon/share/mk/bsd.arch.inc.mk (props changed) user/jmallett/octeon/sys/arm/include/bootinfo.h (props changed) Modified: user/jmallett/octeon/Makefile.inc1 ============================================================================== --- user/jmallett/octeon/Makefile.inc1 Fri Jun 25 22:35:19 2010 (r209527) +++ user/jmallett/octeon/Makefile.inc1 Sat Jun 26 03:08:12 2010 (r209528) @@ -30,9 +30,7 @@ .include -.if ${MACHINE_ARCH} == "mips" -MK_RESCUE=no # not yet -.endif +.include # We must do share/info early so that installation of info `dir' # entries works correctly. Do it first since it is less likely to @@ -167,7 +165,7 @@ BUILD_ARCH!= uname -p .if ${MACHINE} == ${TARGET} && !defined(CROSS_BUILD_TESTING) OBJTREE= ${MAKEOBJDIRPREFIX} .else -OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET} +OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH} .endif WORLDTMP= ${OBJTREE}${.CURDIR}/tmp # /usr/games added for fortune which depend on strfile @@ -1110,10 +1108,10 @@ _prereq_libs= gnu/lib/libssp/libssp_nons # all shared libraries for ELF. # _startup_libs= gnu/lib/csu -.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf) -_startup_libs+= lib/csu/${MACHINE_ARCH}-elf +.if exists(${.CURDIR}/lib/csu/${MACHINE_CPUARCH}-elf) +_startup_libs+= lib/csu/${MACHINE_CPUARCH}-elf .else -_startup_libs+= lib/csu/${MACHINE_ARCH} +_startup_libs+= lib/csu/${MACHINE_CPUARCH} .endif _startup_libs+= gnu/lib/libgcc _startup_libs+= lib/libc Copied: user/jmallett/octeon/Makefile.mips (from r209526, head/Makefile.mips) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/jmallett/octeon/Makefile.mips Sat Jun 26 03:08:12 2010 (r209528, copy of r209526, head/Makefile.mips) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +# A bug in binutils prevents rescue from building, so override the user's +# choice. +MK_RESCUE=no Modified: user/jmallett/octeon/bin/pkill/pkill.1 ============================================================================== --- user/jmallett/octeon/bin/pkill/pkill.1 Fri Jun 25 22:35:19 2010 (r209527) +++ user/jmallett/octeon/bin/pkill/pkill.1 Sat Jun 26 03:08:12 2010 (r209528) @@ -156,14 +156,16 @@ The value matches processes not in jail. .It Fl l Long output. -Print the process name in addition to the process ID for each matching +For +.Nm pgrep , +print the process name in addition to the process ID for each matching process. If used in conjunction with .Fl f , print the process ID and the full argument list for each matching process. -This option can only be used with the -.Nm pgrep -command. +For +.Nm pkill , +display the kill command used for each process killed. .It Fl n Select only the newest (most recently started) of the matching processes. .It Fl o Modified: user/jmallett/octeon/bin/pkill/pkill.c ============================================================================== --- user/jmallett/octeon/bin/pkill/pkill.c Fri Jun 25 22:35:19 2010 (r209527) +++ user/jmallett/octeon/bin/pkill/pkill.c Sat Jun 26 03:08:12 2010 (r209528) @@ -128,7 +128,7 @@ main(int argc, char **argv) { char buf[_POSIX2_LINE_MAX], *mstr, **pargv, *p, *q, *pidfile; const char *execf, *coref; - int ancestors, debug_opt; + int ancestors, debug_opt, did_action; int i, ch, bestidx, rv, criteria, pidfromfile, pidfilelock; size_t jsz; int (*action)(const struct kinfo_proc *); @@ -242,8 +242,6 @@ main(int argc, char **argv) criteria = 1; break; case 'l': - if (!pgrep) - usage(); longfmt = 1; break; case 'n': @@ -530,16 +528,24 @@ main(int argc, char **argv) /* * Take the appropriate action for each matched process, if any. */ + did_action = 0; for (i = 0, rv = 0, kp = plist; i < nproc; i++, kp++) { if (PSKIP(kp)) continue; if (selected[i]) { + if (longfmt && !pgrep) { + did_action = 1; + printf("kill -%d %d\n", signum, kp->ki_pid); + } if (inverse) continue; } else if (!inverse) continue; rv |= (*action)(kp); } + if (!did_action && !pgrep && longfmt) + fprintf(stderr, + "No matching processes belonging to you were found\n"); exit(rv ? STATUS_MATCH : STATUS_NOMATCH); } @@ -552,7 +558,7 @@ usage(void) if (pgrep) ustr = "[-LSfilnoqvx] [-d delim]"; else - ustr = "[-signal] [-ILfinovx]"; + ustr = "[-signal] [-ILfilnovx]"; fprintf(stderr, "usage: %s %s [-F pidfile] [-G gid] [-M core] [-N system]\n" Modified: user/jmallett/octeon/bin/sh/parser.c ============================================================================== --- user/jmallett/octeon/bin/sh/parser.c Fri Jun 25 22:35:19 2010 (r209527) +++ user/jmallett/octeon/bin/sh/parser.c Sat Jun 26 03:08:12 2010 (r209528) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "shell.h" #include "parser.h" Modified: user/jmallett/octeon/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l ============================================================================== --- user/jmallett/octeon/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l Fri Jun 25 22:35:19 2010 (r209527) +++ user/jmallett/octeon/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l Sat Jun 26 03:08:12 2010 (r209528) @@ -67,8 +67,12 @@ * for all subsequent invocations, which is the effect desired. */ #undef unput -#define unput(c) \ - if (c != EOF) yyunput( c, yytext_ptr ) +#define unput(c) \ + do { \ + int _c = c; \ + if (_c != EOF) \ + yyunput(_c, yytext_ptr); \ + } while(0) #endif static int id_or_type(const char *); Modified: user/jmallett/octeon/contrib/binutils/binutils/doc/readelf.1 ============================================================================== --- user/jmallett/octeon/contrib/binutils/binutils/doc/readelf.1 Fri Jun 25 22:35:19 2010 (r209527) +++ user/jmallett/octeon/contrib/binutils/binutils/doc/readelf.1 Sat Jun 26 03:08:12 2010 (r209528) @@ -247,14 +247,6 @@ Displays the contents of the file's relo .PD Displays the contents of the file's unwind section, if it has one. Only the unwind sections for \s-1IA64\s0 \s-1ELF\s0 files are currently supported. -.IP "\fB\-u\fR" 4 -.IX Item "-u" -.PD 0 -.IP "\fB\-\-unwind\fR" 4 -.IX Item "--unwind" -.PD -Displays the contents of the file's unwind section, if it has one. Only -the unwind sections for \s-1IA64\s0 \s-1ELF\s0 files are currently supported. .IP "\fB\-d\fR" 4 .IX Item "-d" .PD 0 Modified: user/jmallett/octeon/etc/mtree/BSD.usr.dist ============================================================================== --- user/jmallett/octeon/etc/mtree/BSD.usr.dist Fri Jun 25 22:35:19 2010 (r209527) +++ user/jmallett/octeon/etc/mtree/BSD.usr.dist Sat Jun 26 03:08:12 2010 (r209528) @@ -261,6 +261,8 @@ .. nwclient .. + pc-sysinstall + .. perfmon .. pf @@ -1226,6 +1228,20 @@ .. .. .. + pc-sysinstall + backend + .. + backend-partmanager + .. + backend-query + .. + conf + license + .. + .. + doc + .. + .. security .. sendmail Modified: user/jmallett/octeon/gnu/usr.bin/binutils/ld/elf32btsmipn32_fbsd.sh ============================================================================== --- user/jmallett/octeon/gnu/usr.bin/binutils/ld/elf32btsmipn32_fbsd.sh Fri Jun 25 22:35:19 2010 (r209527) +++ user/jmallett/octeon/gnu/usr.bin/binutils/ld/elf32btsmipn32_fbsd.sh Sat Jun 26 03:08:12 2010 (r209528) @@ -2,3 +2,4 @@ . ${srcdir}/emulparams/elf32btsmipn32.sh . ${srcdir}/emulparams/elf_fbsd.sh GENERATE_PIE_SCRIPT=yes +ALIGNMENT=8 Modified: user/jmallett/octeon/gnu/usr.bin/binutils/ld/elf32ltsmipn32_fbsd.sh ============================================================================== --- user/jmallett/octeon/gnu/usr.bin/binutils/ld/elf32ltsmipn32_fbsd.sh Fri Jun 25 22:35:19 2010 (r209527) +++ user/jmallett/octeon/gnu/usr.bin/binutils/ld/elf32ltsmipn32_fbsd.sh Sat Jun 26 03:08:12 2010 (r209528) @@ -2,3 +2,4 @@ . ${srcdir}/emulparams/elf32ltsmipn32.sh . ${srcdir}/emulparams/elf_fbsd.sh GENERATE_PIE_SCRIPT=yes +ALIGNMENT=8 Modified: user/jmallett/octeon/lib/Makefile ============================================================================== --- user/jmallett/octeon/lib/Makefile Fri Jun 25 22:35:19 2010 (r209527) +++ user/jmallett/octeon/lib/Makefile Sat Jun 26 03:08:12 2010 (r209528) @@ -138,7 +138,7 @@ _libsdp= libsdp _libbsnmp= libbsnmp .endif -.if ${MK_CLANG} != "no" +.if ${MK_CLANG} != "no" && !defined(COMPAT_32BIT) _clang= clang .endif Modified: user/jmallett/octeon/lib/libc/mips/sys/brk.S ============================================================================== --- user/jmallett/octeon/lib/libc/mips/sys/brk.S Fri Jun 25 22:35:19 2010 (r209527) +++ user/jmallett/octeon/lib/libc/mips/sys/brk.S Sat Jun 26 03:08:12 2010 (r209528) @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); .data _C_LABEL(minbrk): - .word _C_LABEL(_end) + PTR_WORD _C_LABEL(_end) .text LEAF(__sys_brk) Modified: user/jmallett/octeon/lib/libc/mips/sys/sbrk.S ============================================================================== --- user/jmallett/octeon/lib/libc/mips/sys/sbrk.S Fri Jun 25 22:35:19 2010 (r209527) +++ user/jmallett/octeon/lib/libc/mips/sys/sbrk.S Sat Jun 26 03:08:12 2010 (r209528) @@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$"); .data _C_LABEL(__curbrk): - .word _C_LABEL(_end) + PTR_WORD _C_LABEL(_end) .text LEAF(__sys_sbrk) Modified: user/jmallett/octeon/lib/libc/nls/ru_RU.KOI8-R.msg ============================================================================== --- user/jmallett/octeon/lib/libc/nls/ru_RU.KOI8-R.msg Fri Jun 25 22:35:19 2010 (r209527) +++ user/jmallett/octeon/lib/libc/nls/ru_RU.KOI8-R.msg Sat Jun 26 03:08:12 2010 (r209528) @@ -183,6 +183,16 @@ $ ENOATTR 87 Атрибут не найден $ EDOOFUS 88 Ошибка программирования +$ EBADMSG +89 Плохой формат сообщения +$ EMULTIHOP +90 Попытка мультихопа +$ ENOLINK +91 Канал разорван +$ EPROTO +92 Ошибка протокола +$ ENOTCAPABLE +93 Недостаточно возможностей $ $ strsignal() support catalog $ Modified: user/jmallett/octeon/sbin/fsck_ffs/main.c ============================================================================== --- user/jmallett/octeon/sbin/fsck_ffs/main.c Fri Jun 25 22:35:19 2010 (r209527) +++ user/jmallett/octeon/sbin/fsck_ffs/main.c Sat Jun 26 03:08:12 2010 (r209528) @@ -388,16 +388,18 @@ checkfilesys(char *filesys) /* * Determine if we can and should do journal recovery. */ - if ((sblock.fs_flags & (FS_SUJ | FS_NEEDSFSCK)) == FS_SUJ) { - if (preen || reply("USE JOURNAL?")) { - if (suj_check(filesys) == 0) { - if (chkdoreload(mntp) == 0) - exit(0); - exit(4); + if ((sblock.fs_flags & FS_SUJ) == FS_SUJ) { + if ((sblock.fs_flags & FS_NEEDSFSCK) != FS_NEEDSFSCK && skipclean) { + if (preen || reply("USE JOURNAL?")) { + if (suj_check(filesys) == 0) { + printf("\n***** FILE SYSTEM MARKED CLEAN *****\n"); + if (chkdoreload(mntp) == 0) + exit(0); + exit(4); + } } - /* suj_check failed, fall through. */ + printf("** Skipping journal, falling through to full fsck\n\n"); } - printf("** Skipping journal, falling through to full fsck\n"); /* * Write the superblock so we don't try to recover the * journal on another pass. Modified: user/jmallett/octeon/sbin/fsck_ffs/suj.c ============================================================================== --- user/jmallett/octeon/sbin/fsck_ffs/suj.c Fri Jun 25 22:35:19 2010 (r209527) +++ user/jmallett/octeon/sbin/fsck_ffs/suj.c Sat Jun 26 03:08:12 2010 (r209528) @@ -37,12 +37,15 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include #include #include #include +#include #include #include @@ -141,7 +144,10 @@ uint64_t freedir; uint64_t jbytes; uint64_t jrecs; +static jmp_buf jmpbuf; + typedef void (*ino_visitor)(ino_t, ufs_lbn_t, ufs2_daddr_t, int); +static void err_suj(const char *, ...) __dead2; static void ino_trunc(ino_t, off_t); static void ino_decr(ino_t); static void ino_adjust(struct suj_ino *); @@ -155,11 +161,30 @@ errmalloc(size_t n) a = malloc(n); if (a == NULL) - errx(1, "malloc(%zu)", n); + err(EX_OSERR, "malloc(%zu)", n); return (a); } /* + * When hit a fatal error in journalling check, print out + * the error and then offer to fallback to normal fsck. + */ +static void +err_suj(const char * restrict fmt, ...) +{ + va_list ap; + + if (preen) + (void)fprintf(stdout, "%s: ", cdevname); + + va_start(ap, fmt); + (void)vfprintf(stdout, fmt, ap); + va_end(ap); + + longjmp(jmpbuf, -1); +} + +/* * Open the given provider, load superblock. */ static void @@ -169,9 +194,9 @@ opendisk(const char *devnam) return; disk = malloc(sizeof(*disk)); if (disk == NULL) - errx(1, "malloc(%zu)", sizeof(*disk)); + err(EX_OSERR, "malloc(%zu)", sizeof(*disk)); if (ufs_disk_fillout(disk, devnam) == -1) { - err(1, "ufs_disk_fillout(%s) failed: %s", devnam, + err(EX_OSERR, "ufs_disk_fillout(%s) failed: %s", devnam, disk->d_error); } fs = &disk->d_fs; @@ -203,9 +228,9 @@ closedisk(const char *devnam) fs->fs_time = time(NULL); fs->fs_mtime = time(NULL); if (sbwrite(disk, 0) == -1) - err(1, "sbwrite(%s)", devnam); + err(EX_OSERR, "sbwrite(%s)", devnam); if (ufs_disk_close(disk) == -1) - err(1, "ufs_disk_close(%s)", devnam); + err(EX_OSERR, "ufs_disk_close(%s)", devnam); free(disk); disk = NULL; fs = NULL; @@ -221,10 +246,8 @@ cg_lookup(int cgx) struct cghd *hd; struct suj_cg *sc; - if (cgx < 0 || cgx >= fs->fs_ncg) { - abort(); - errx(1, "Bad cg number %d", cgx); - } + if (cgx < 0 || cgx >= fs->fs_ncg) + err_suj("Bad cg number %d\n", cgx); if (lastcg && lastcg->sc_cgx == cgx) return (lastcg); hd = &cghash[SUJ_HASH(cgx)]; @@ -241,7 +264,7 @@ cg_lookup(int cgx) LIST_INSERT_HEAD(hd, sc, sc_next); if (bread(disk, fsbtodb(fs, cgtod(fs, sc->sc_cgx)), sc->sc_cgbuf, fs->fs_bsize) == -1) - err(1, "Unable to read cylinder group %d", sc->sc_cgx); + err_suj("Unable to read cylinder group %d\n", sc->sc_cgx); return (sc); } @@ -344,7 +367,7 @@ dblk_read(ufs2_daddr_t blk, int size) dblk->db_buf = errmalloc(size); dblk->db_size = size; if (bread(disk, fsbtodb(fs, blk), dblk->db_buf, size) == -1) - err(1, "Failed to read data block %jd", blk); + err_suj("Failed to read data block %jd\n", blk); } return (dblk->db_buf); } @@ -370,7 +393,7 @@ dblk_write(void) continue; if (bwrite(disk, fsbtodb(fs, dblk->db_blk), dblk->db_buf, dblk->db_size) == -1) - err(1, "Unable to write block %jd", + err_suj("Unable to write block %jd\n", dblk->db_blk); } } @@ -403,7 +426,7 @@ ino_read(ino_t ino) iblk->ib_blk = blk; LIST_INSERT_HEAD(hd, iblk, ib_next); if (bread(disk, fsbtodb(fs, blk), iblk->ib_buf, fs->fs_bsize) == -1) - err(1, "Failed to read inode block %jd", blk); + err_suj("Failed to read inode block %jd\n", blk); found: sc->sc_lastiblk = iblk; off = ino_to_fsbo(fs, ino); @@ -447,7 +470,7 @@ iblk_write(struct ino_blk *iblk) return; if (bwrite(disk, fsbtodb(fs, iblk->ib_blk), iblk->ib_buf, fs->fs_bsize) == -1) - err(1, "Failed to write inode block %jd", iblk->ib_blk); + err_suj("Failed to write inode block %jd\n", iblk->ib_blk); } static int @@ -679,9 +702,9 @@ indir_blkatoff(ufs2_daddr_t blk, ino_t i return (0); level = lbn_level(cur); if (level == -1) - errx(1, "Invalid indir lbn %jd", lbn); + err_suj("Invalid indir lbn %jd\n", lbn); if (level == 0 && lbn < 0) - errx(1, "Invalid lbn %jd", lbn); + err_suj("Invalid lbn %jd\n", lbn); bap2 = (void *)dblk_read(blk, fs->fs_bsize); bap1 = (void *)bap2; lbnadd = 1; @@ -693,7 +716,7 @@ indir_blkatoff(ufs2_daddr_t blk, ino_t i else i = (-lbn - base) / lbnadd; if (i < 0 || i >= NINDIR(fs)) - errx(1, "Invalid indirect index %d produced by lbn %jd", + err_suj("Invalid indirect index %d produced by lbn %jd\n", i, lbn); if (level == 0) cur = base + (i * lbnadd); @@ -705,10 +728,8 @@ indir_blkatoff(ufs2_daddr_t blk, ino_t i blk = bap2[i]; if (cur == lbn) return (blk); - if (level == 0) { - abort(); - errx(1, "Invalid lbn %jd at level 0", lbn); - } + if (level == 0) + err_suj("Invalid lbn %jd at level 0\n", lbn); return indir_blkatoff(blk, ino, cur, lbn); } @@ -762,7 +783,8 @@ ino_blkatoff(union dinode *ip, ino_t ino continue; return indir_blkatoff(DIP(ip, di_ib[i]), ino, -cur - i, lbn); } - errx(1, "lbn %jd not in ino", lbn); + err_suj("lbn %jd not in ino\n", lbn); + /* NOTREACHED */ } /* @@ -851,7 +873,7 @@ ino_isat(ino_t parent, off_t diroff, ino dpoff += dp->d_reclen; } while (dpoff <= doff); if (dpoff > fs->fs_bsize) - errx(1, "Corrupt directory block in dir ino %d", parent); + err_suj("Corrupt directory block in dir ino %d\n", parent); /* Not found. */ if (dpoff != doff) { if (debug) @@ -907,7 +929,7 @@ indir_visit(ino_t ino, ufs_lbn_t lbn, uf return; level = lbn_level(lbn); if (level == -1) - errx(1, "Invalid level for lbn %jd", lbn); + err_suj("Invalid level for lbn %jd\n", lbn); if ((flags & VISIT_ROOT) == 0 && blk_isindir(blk, ino, lbn) == 0) { if (debug) printf("blk %jd ino %d lbn %jd(%d) is not indir.\n", @@ -1203,7 +1225,7 @@ ino_reclaim(union dinode *ip, ino_t ino, uint32_t gen; if (ino == ROOTINO) - errx(1, "Attempting to free ROOTINO"); + err_suj("Attempting to free ROOTINO\n"); if (debug) printf("Truncating and freeing ino %d, nlink %d, mode %o\n", ino, DIP(ip, di_nlink), DIP(ip, di_mode)); @@ -1240,9 +1262,9 @@ ino_decr(ino_t ino) nlink = DIP(ip, di_nlink); mode = DIP(ip, di_mode); if (nlink < 1) - errx(1, "Inode %d link count %d invalid", ino, nlink); + err_suj("Inode %d link count %d invalid\n", ino, nlink); if (mode == 0) - errx(1, "Inode %d has a link of %d with 0 mode.", ino, nlink); + err_suj("Inode %d has a link of %d with 0 mode\n", ino, nlink); nlink--; if ((mode & IFMT) == IFDIR) reqlink = 2; @@ -1300,8 +1322,8 @@ ino_adjust(struct suj_ino *sino) ip = ino_read(ino); mode = DIP(ip, di_mode) & IFMT; if (nlink > LINK_MAX) - errx(1, - "ino %d nlink manipulation error, new link %d, old link %d", + err_suj( + "ino %d nlink manipulation error, new link %d, old link %d\n", ino, nlink, DIP(ip, di_nlink)); if (debug) printf("Adjusting ino %d, nlink %d, old link %d lastmode %o\n", @@ -1359,7 +1381,7 @@ indir_trunc(ino_t ino, ufs_lbn_t lbn, uf dirty = 0; level = lbn_level(lbn); if (level == -1) - errx(1, "Invalid level for lbn %jd", lbn); + err_suj("Invalid level for lbn %jd\n", lbn); lbnadd = 1; for (i = level; i > 0; i--) lbnadd *= NINDIR(fs); @@ -1488,7 +1510,7 @@ ino_trunc(ino_t ino, off_t size) bn = DIP(ip, di_db[visitlbn]); if (bn == 0) - errx(1, "Bad blk at ino %d lbn %jd\n", ino, visitlbn); + err_suj("Bad blk at ino %d lbn %jd\n", ino, visitlbn); oldspace = sblksize(fs, cursize, visitlbn); newspace = sblksize(fs, size, visitlbn); if (oldspace != newspace) { @@ -1512,7 +1534,7 @@ ino_trunc(ino_t ino, off_t size) bn = ino_blkatoff(ip, ino, visitlbn, &frags); if (bn == 0) - errx(1, "Block missing from ino %d at lbn %jd\n", + err_suj("Block missing from ino %d at lbn %jd\n", ino, visitlbn); clrsize = frags * fs->fs_fsize; buf = dblk_read(bn, clrsize); @@ -1555,7 +1577,7 @@ ino_check(struct suj_ino *sino) isat = ino_isat(rrec->jr_parent, rrec->jr_diroff, rrec->jr_ino, &mode, &isdot); if (isat && (mode & IFMT) != (rrec->jr_mode & IFMT)) - errx(1, "Inode mode/directory type mismatch %o != %o", + err_suj("Inode mode/directory type mismatch %o != %o\n", mode, rrec->jr_mode); if (debug) printf("jrefrec: op %d ino %d, nlink %d, parent %d, " @@ -1778,7 +1800,7 @@ cg_write(struct suj_cg *sc) fs->fs_cs(fs, sc->sc_cgx) = cgp->cg_cs; if (bwrite(disk, fsbtodb(fs, cgtod(fs, sc->sc_cgx)), sc->sc_cgbuf, fs->fs_bsize) == -1) - err(1, "Unable to write cylinder group %d", sc->sc_cgx); + err_suj("Unable to write cylinder group %d\n", sc->sc_cgx); } /* @@ -1970,6 +1992,7 @@ ino_build_ref(struct suj_ino *sino, stru continue; diroff = mvrec->jm_oldoff; TAILQ_REMOVE(&sino->si_movs, srn, sr_next); + free(srn); ino_dup_ref(sino, refrec, diroff); } } @@ -2026,7 +2049,7 @@ ino_build_ref(struct suj_ino *sino, stru TAILQ_REMOVE(&sino->si_newrecs, srn, sr_next); break; default: - errx(1, "ino_build_ref: Unknown op %d", + err_suj("ino_build_ref: Unknown op %d\n", srn->sr_rec->rec_jrefrec.jr_op); } } @@ -2056,7 +2079,7 @@ ino_build(struct suj_ino *sino) TAILQ_INSERT_TAIL(&sino->si_movs, srec, sr_next); break; default: - errx(1, "ino_build: Unknown op %d", + err_suj("ino_build: Unknown op %d\n", srec->sr_rec->rec_jrefrec.jr_op); } } @@ -2107,7 +2130,7 @@ blk_build(struct jblkrec *blkrec) blkrec->jb_blkno -= frag; blkrec->jb_oldfrags = frag; if (blkrec->jb_oldfrags + blkrec->jb_frags > fs->fs_frag) - errx(1, "Invalid fragment count %d oldfrags %d", + err_suj("Invalid fragment count %d oldfrags %d\n", blkrec->jb_frags, frag); /* * Detect dups. If we detect a dup we always discard the oldest @@ -2185,7 +2208,7 @@ suj_build(void) ino_build_trunc((struct jtrncrec *)rec); break; default: - errx(1, "Unknown journal operation %d (%d)", + err_suj("Unknown journal operation %d (%d)\n", rec->rec_jrefrec.jr_op, off); } i++; @@ -2233,9 +2256,10 @@ suj_prune(void) newseq = seg->ss_rec.jsr_seq; } - if (newseq != oldseq) - errx(1, "Journal file sequence mismatch %jd != %jd", + if (newseq != oldseq) { + err_suj("Journal file sequence mismatch %jd != %jd\n", newseq, oldseq); + } /* * The kernel may asynchronously write segments which can create * gaps in the sequence space. Throw away any segments after the @@ -2463,9 +2487,10 @@ restart: /* * Read 1MB at a time and scan for records within this block. */ - if (bread(disk, blk, &block, size) == -1) - err(1, "Error reading journal block %jd", + if (bread(disk, blk, &block, size) == -1) { + err_suj("Error reading journal block %jd\n", (intmax_t)blk); + } for (rec = (void *)block; size; size -= recsize, rec = (struct jsegrec *)((uintptr_t)rec + recsize)) { recsize = DEV_BSIZE; @@ -2544,7 +2569,7 @@ suj_find(ino_t ino, ufs_lbn_t lbn, ufs2_ return; bytes = lfragtosize(fs, frags); if (bread(disk, fsbtodb(fs, blk), block, bytes) <= 0) - err(1, "Failed to read ROOTINO directory block %jd", blk); + err_suj("Failed to read ROOTINO directory block %jd\n", blk); for (off = 0; off < bytes; off += dp->d_reclen) { dp = (struct direct *)&block[off]; if (dp->d_reclen == 0) @@ -2569,17 +2594,43 @@ suj_check(const char *filesys) union dinode *jip; union dinode *ip; uint64_t blocks; + int retval; + struct suj_seg *seg; + struct suj_seg *segn; opendisk(filesys); TAILQ_INIT(&allsegs); + + /* + * Set an exit point when SUJ check failed + */ + retval = setjmp(jmpbuf); + if (retval != 0) { + pwarn("UNEXPECTED SU+J INCONSISTENCY\n"); + TAILQ_FOREACH_SAFE(seg, &allsegs, ss_next, segn) { + TAILQ_REMOVE(&allsegs, seg, ss_next); + free(seg->ss_blk); + free(seg); + } + if (reply("FALLBACK TO FULL FSCK") == 0) { + ckfini(0); + exit(EEXIT); + } else + return (-1); + } + /* * Find the journal inode. */ ip = ino_read(ROOTINO); sujino = 0; ino_visit(ip, ROOTINO, suj_find, 0); - if (sujino == 0) - errx(1, "Journal inode removed. Use tunefs to re-create."); + if (sujino == 0) { + printf("Journal inode removed. Use tunefs to re-create.\n"); + sblock.fs_flags &= ~FS_SUJ; + sblock.fs_sujfree = 0; + return (-1); + } /* * Fetch the journal inode and verify it. */ @@ -2595,8 +2646,10 @@ suj_check(const char *filesys) DIP(jip, di_size), sujino); suj_jblocks = jblocks_create(); blocks = ino_visit(jip, sujino, suj_add_block, 0); - if (blocks != numfrags(fs, DIP(jip, di_size))) - errx(1, "Sparse journal inode %d.\n", sujino); + if (blocks != numfrags(fs, DIP(jip, di_size))) { + printf("Sparse journal inode %d.\n", sujino); + return (-1); + } suj_read(); jblocks_destroy(suj_jblocks); suj_jblocks = NULL; @@ -2612,7 +2665,7 @@ suj_check(const char *filesys) cg_apply(cg_check_blk); cg_apply(cg_check_ino); } - if (preen == 0 && reply("WRITE CHANGES") == 0) + if (preen == 0 && (jrecs > 0 || jbytes > 0) && reply("WRITE CHANGES") == 0) return (0); /* * To remain idempotent with partial truncations the free bitmaps @@ -2625,10 +2678,12 @@ suj_check(const char *filesys) cg_apply(cg_write_inos); /* Write back superblock. */ closedisk(filesys); - printf("** %jd journal records in %jd bytes for %.2f%% utilization\n", - jrecs, jbytes, ((float)jrecs / (float)(jbytes / JREC_SIZE)) * 100); - printf("** Freed %jd inodes (%jd dirs) %jd blocks, and %jd frags.\n", - freeinos, freedir, freeblocks, freefrags); + if (jrecs > 0 || jbytes > 0) { + printf("** %jd journal records in %jd bytes for %.2f%% utilization\n", + jrecs, jbytes, ((float)jrecs / (float)(jbytes / JREC_SIZE)) * 100); + printf("** Freed %jd inodes (%jd dirs) %jd blocks, and %jd frags.\n", + freeinos, freedir, freeblocks, freefrags); + } return (0); } Modified: user/jmallett/octeon/sbin/fsck_msdosfs/Makefile ============================================================================== --- user/jmallett/octeon/sbin/fsck_msdosfs/Makefile Fri Jun 25 22:35:19 2010 (r209527) +++ user/jmallett/octeon/sbin/fsck_msdosfs/Makefile Sat Jun 26 03:08:12 2010 (r209528) @@ -9,6 +9,6 @@ MAN= fsck_msdosfs.8 SRCS= main.c check.c boot.c fat.c dir.c fsutil.c CFLAGS+= -I${FSCK} -WARNS?= 0 +WARNS?= 2 .include Modified: user/jmallett/octeon/sbin/fsck_msdosfs/boot.c ============================================================================== --- user/jmallett/octeon/sbin/fsck_msdosfs/boot.c Fri Jun 25 22:35:19 2010 (r209527) +++ user/jmallett/octeon/sbin/fsck_msdosfs/boot.c Sat Jun 26 03:08:12 2010 (r209528) @@ -48,13 +48,14 @@ readboot(int dosfs, struct bootblock *bo int ret = FSOK; int i; - if ((size_t)read(dosfs, block, sizeof block) != sizeof block) { + if (read(dosfs, block, sizeof block) != sizeof block) { perror("could not read boot block"); return FSFATAL; } if (block[510] != 0x55 || block[511] != 0xaa) { - pfatal("Invalid signature in boot block: %02x%02x", block[511], block[510]); + pfatal("Invalid signature in boot block: %02x%02x", + block[511], block[510]); return FSFATAL; } @@ -72,8 +73,10 @@ readboot(int dosfs, struct bootblock *bo boot->bpbFATsmall = block[22] + (block[23] << 8); boot->SecPerTrack = block[24] + (block[25] << 8); boot->bpbHeads = block[26] + (block[27] << 8); - boot->bpbHiddenSecs = block[28] + (block[29] << 8) + (block[30] << 16) + (block[31] << 24); - boot->bpbHugeSectors = block[32] + (block[33] << 8) + (block[34] << 16) + (block[35] << 24); + boot->bpbHiddenSecs = block[28] + (block[29] << 8) + + (block[30] << 16) + (block[31] << 24); + boot->bpbHugeSectors = block[32] + (block[33] << 8) + + (block[34] << 16) + (block[35] << 24); boot->FATsecs = boot->bpbFATsmall; @@ -97,10 +100,9 @@ readboot(int dosfs, struct bootblock *bo boot->bpbFSInfo = block[48] + (block[49] << 8); boot->bpbBackup = block[50] + (block[51] << 8); - if (lseek(dosfs, boot->bpbFSInfo * boot->bpbBytesPerSec, SEEK_SET) - != boot->bpbFSInfo * boot->bpbBytesPerSec - || read(dosfs, fsinfo, sizeof fsinfo) - != sizeof fsinfo) { + if (lseek(dosfs, boot->bpbFSInfo * boot->bpbBytesPerSec, + SEEK_SET) != boot->bpbFSInfo * boot->bpbBytesPerSec + || read(dosfs, fsinfo, sizeof fsinfo) != sizeof fsinfo) { perror("could not read fsinfo block"); return FSFATAL; } @@ -124,7 +126,8 @@ readboot(int dosfs, struct bootblock *bo fsinfo[0x3fc] = fsinfo[0x3fd] = 0; fsinfo[0x3fe] = 0x55; fsinfo[0x3ff] = 0xaa; - if (lseek(dosfs, boot->bpbFSInfo * boot->bpbBytesPerSec, SEEK_SET) + if (lseek(dosfs, boot->bpbFSInfo * + boot->bpbBytesPerSec, SEEK_SET) != boot->bpbFSInfo * boot->bpbBytesPerSec || write(dosfs, fsinfo, sizeof fsinfo) != sizeof fsinfo) { @@ -144,7 +147,8 @@ readboot(int dosfs, struct bootblock *bo + (fsinfo[0x1ef] << 24); } - if (lseek(dosfs, boot->bpbBackup * boot->bpbBytesPerSec, SEEK_SET) + if (lseek(dosfs, boot->bpbBackup * boot->bpbBytesPerSec, + SEEK_SET) != boot->bpbBackup * boot->bpbBytesPerSec || read(dosfs, backup, sizeof backup) != sizeof backup) { perror("could not read backup bootblock"); @@ -172,11 +176,10 @@ readboot(int dosfs, struct bootblock *bo /* Check backup bpbFSInfo? XXX */ } - boot->ClusterOffset = (boot->bpbRootDirEnts * 32 + boot->bpbBytesPerSec - 1) - / boot->bpbBytesPerSec - + boot->bpbResSectors - + boot->bpbFATs * boot->FATsecs - - CLUST_FIRST * boot->bpbSecPerClust; + boot->ClusterOffset = (boot->bpbRootDirEnts * 32 + + boot->bpbBytesPerSec - 1) / boot->bpbBytesPerSec + + boot->bpbResSectors + boot->bpbFATs * boot->FATsecs - + CLUST_FIRST * boot->bpbSecPerClust; if (boot->bpbBytesPerSec % DOSBOOTBLOCKSIZE != 0) { pfatal("Invalid sector size: %u", boot->bpbBytesPerSec); @@ -191,7 +194,8 @@ readboot(int dosfs, struct bootblock *bo boot->NumSectors = boot->bpbSectors; } else boot->NumSectors = boot->bpbHugeSectors; - boot->NumClusters = (boot->NumSectors - boot->ClusterOffset) / boot->bpbSecPerClust; + boot->NumClusters = (boot->NumSectors - boot->ClusterOffset) / + boot->bpbSecPerClust; if (boot->flags&FAT32) boot->ClustMask = CLUST32_MASK; Modified: user/jmallett/octeon/sbin/fsck_msdosfs/check.c ============================================================================== --- user/jmallett/octeon/sbin/fsck_msdosfs/check.c Fri Jun 25 22:35:19 2010 (r209527) +++ user/jmallett/octeon/sbin/fsck_msdosfs/check.c Sat Jun 26 03:08:12 2010 (r209528) @@ -98,7 +98,7 @@ checkfilesys(const char *fname) } if (boot.ValidFat < 0) - for (i = 1; i < (int)boot.bpbFATs; i++) { + for (i = 1; i < boot.bpbFATs; i++) { struct fatEntry *currentFat; mod |= readfat(dosfs, &boot, i, ¤tFat); Modified: user/jmallett/octeon/sbin/fsck_msdosfs/dir.c ============================================================================== --- user/jmallett/octeon/sbin/fsck_msdosfs/dir.c Fri Jun 25 22:35:19 2010 (r209527) +++ user/jmallett/octeon/sbin/fsck_msdosfs/dir.c Sat Jun 26 03:08:12 2010 (r209528) @@ -242,7 +242,8 @@ resetDosDirSection(struct bootblock *boo memset(rootDir, 0, sizeof *rootDir); if (boot->flags & FAT32) { - if (boot->bpbRootClust < CLUST_FIRST || boot->bpbRootClust >= boot->NumClusters) { + if (boot->bpbRootClust < CLUST_FIRST || + boot->bpbRootClust >= boot->NumClusters) { pfatal("Root directory starts with cluster out of range(%u)", boot->bpbRootClust); return FSFATAL; @@ -356,7 +357,8 @@ removede(int f, struct bootblock *boot, pwarn("Invalid long filename entry for %s\n", path); break; case 1: - pwarn("Invalid long filename entry at end of directory %s\n", path); + pwarn("Invalid long filename entry at end of directory %s\n", + path); break; case 2: pwarn("Invalid long filename entry for volume label\n"); @@ -418,7 +420,8 @@ checksize(struct bootblock *boot, struct cl_t cl; u_int32_t sz = 0; - for (cl = dir->head; (sz += boot->ClusterSize) < dir->size;) + for (cl = dir->head; (sz += boot->ClusterSize) < + dir->size;) cl = fat[cl].next; clearchain(boot, fat, fat[cl].next); fat[cl].next = CLUST_EOF; @@ -462,7 +465,8 @@ readDosDirSection(int f, struct bootbloc do { if (!(boot->flags & FAT32) && !dir->parent) { last = boot->bpbRootDirEnts * 32; - off = boot->bpbResSectors + boot->bpbFATs * boot->FATsecs; + off = boot->bpbResSectors + boot->bpbFATs * + boot->FATsecs; } else { last = boot->bpbSecPerClust * boot->bpbBytesPerSec; off = cl * boot->bpbSecPerClust + boot->ClusterOffset; @@ -547,7 +551,8 @@ readDosDirSection(int f, struct bootbloc } lidx = *p & LRNOMASK; t = longName + --lidx * 13; - for (k = 1; k < 11 && t < longName + sizeof(longName); k += 2) { + for (k = 1; k < 11 && t < longName + + sizeof(longName); k += 2) { if (!p[k] && !p[k + 1]) break; *t++ = p[k]; Modified: user/jmallett/octeon/sbin/fsck_msdosfs/fat.c ============================================================================== --- user/jmallett/octeon/sbin/fsck_msdosfs/fat.c Fri Jun 25 22:35:19 2010 (r209527) +++ user/jmallett/octeon/sbin/fsck_msdosfs/fat.c Sat Jun 26 03:08:12 2010 (r209528) @@ -87,7 +87,8 @@ checkdirty(int fs, struct bootblock *boo goto err; } - if (read(fs, buffer, boot->bpbBytesPerSec) != boot->bpbBytesPerSec) { + if ((size_t)read(fs, buffer, boot->bpbBytesPerSec) != + boot->bpbBytesPerSec) { perror("Unable to read FAT"); goto err; } Modified: user/jmallett/octeon/sbin/geom/class/part/geom_part.c ============================================================================== --- user/jmallett/octeon/sbin/geom/class/part/geom_part.c Fri Jun 25 22:35:19 2010 (r209527) +++ user/jmallett/octeon/sbin/geom/class/part/geom_part.c Sat Jun 26 03:08:12 2010 (r209528) @@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -60,6 +62,9 @@ static char autofill[] = "*"; static char optional[] = ""; static char flags[] = "C"; +static char sstart[32]; +static char ssize[32]; + static const char const bootcode_param[] = "bootcode"; static const char const index_param[] = "index"; static const char const partcode_param[] = "partcode"; @@ -68,8 +73,7 @@ static struct gclass *find_class(struct static struct ggeom * find_geom(struct gclass *, const char *); static const char *find_geomcfg(struct ggeom *, const char *); static const char *find_provcfg(struct gprovider *, const char *); -static struct gprovider *find_provider(struct ggeom *, - unsigned long long); +static struct gprovider *find_provider(struct ggeom *, off_t); static const char *fmtsize(int64_t); static int gpart_autofill(struct gctl_req *); static int gpart_autofill_resize(struct gctl_req *); @@ -84,8 +88,8 @@ static void gpart_write_partcode_vtoc8(s struct g_command PUBSYM(class_commands)[] = { { "add", 0, gpart_issue, { - { 'b', "start", autofill, G_TYPE_ASCLBA }, - { 's', "size", autofill, G_TYPE_ASCLBA }, + { 'b', "start", autofill, G_TYPE_STRING }, + { 's', "size", autofill, G_TYPE_STRING }, { 't', "type", NULL, G_TYPE_STRING }, { 'i', index_param, optional, G_TYPE_ASCNUM }, { 'l', "label", optional, G_TYPE_STRING }, @@ -149,7 +153,7 @@ struct g_command PUBSYM(class_commands)[ "geom", NULL }, { "resize", 0, gpart_issue, { - { 's', "size", autofill, G_TYPE_ASCLBA }, + { 's', "size", autofill, G_TYPE_STRING }, { 'i', index_param, NULL, G_TYPE_ASCNUM }, { 'f', "flags", flags, G_TYPE_STRING }, G_OPT_SENTINEL }, @@ -207,11 +211,11 @@ find_provcfg(struct gprovider *pp, const } static struct gprovider * -find_provider(struct ggeom *gp, unsigned long long minsector) +find_provider(struct ggeom *gp, off_t minsector) { struct gprovider *pp, *bestpp; const char *s; - unsigned long long sector, bestsector; + off_t sector, bestsector; bestpp = NULL; bestsector = 0; @@ -219,9 +223,10 @@ find_provider(struct ggeom *gp, unsigned s = find_provcfg(pp, "start"); if (s == NULL) { s = find_provcfg(pp, "offset"); - sector = atoll(s) / pp->lg_sectorsize; + sector = + (off_t)strtoimax(s, NULL, 0) / pp->lg_sectorsize; } else - sector = atoll(s); + sector = (off_t)strtoimax(s, NULL, 0); if (sector < minsector) continue; @@ -271,18 +276,12 @@ gpart_autofill_resize(struct gctl_req *r struct gclass *cp; struct ggeom *gp; struct gprovider *pp; - unsigned long long last, size, start, new_size; - unsigned long long lba, new_lba; + off_t last, size, start, new_size; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Sat Jun 26 03:11:29 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6C8B1065674; Sat, 26 Jun 2010 03:11:29 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B68888FC17; Sat, 26 Jun 2010 03:11:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5Q3BTTO099533; Sat, 26 Jun 2010 03:11:29 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5Q3BTjr099529; Sat, 26 Jun 2010 03:11:29 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006260311.o5Q3BTjr099529@svn.freebsd.org> From: Juli Mallett Date: Sat, 26 Jun 2010 03:11:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209529 - user/jmallett/octeon/sys/mips/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jun 2010 03:11:29 -0000 Author: jmallett Date: Sat Jun 26 03:11:29 2010 New Revision: 209529 URL: http://svn.freebsd.org/changeset/base/209529 Log: Use the cnMIPS CPU type we already have. Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1 user/jmallett/octeon/sys/mips/conf/OCTEON1-32 user/jmallett/octeon/sys/mips/conf/OCTEON1-o32 Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1 ============================================================================== --- user/jmallett/octeon/sys/mips/conf/OCTEON1 Sat Jun 26 03:08:12 2010 (r209528) +++ user/jmallett/octeon/sys/mips/conf/OCTEON1 Sat Jun 26 03:11:29 2010 (r209529) @@ -25,7 +25,7 @@ ############################################################################## machine mips -cpu CPU_MIPS4KC +cpu CPU_CNMIPS ident OCTEON1 makeoptions ARCH_FLAGS="-march=octeon" Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-32 ============================================================================== --- user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Sat Jun 26 03:08:12 2010 (r209528) +++ user/jmallett/octeon/sys/mips/conf/OCTEON1-32 Sat Jun 26 03:11:29 2010 (r209529) @@ -18,7 +18,7 @@ # $FreeBSD$ machine mips -cpu CPU_MIPS4KC +cpu CPU_CNMIPS ident OCTEON1 # Don't build any modules yet. Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-o32 ============================================================================== --- user/jmallett/octeon/sys/mips/conf/OCTEON1-o32 Sat Jun 26 03:08:12 2010 (r209528) +++ user/jmallett/octeon/sys/mips/conf/OCTEON1-o32 Sat Jun 26 03:11:29 2010 (r209529) @@ -18,7 +18,7 @@ # $FreeBSD: user/jmallett/octeon/sys/mips/conf/OCTEON1-32 204680 2010-03-04 00:40:53Z jmallett $ machine mips -cpu CPU_MIPS4KC +cpu CPU_CNMIPS ident OCTEON1 # Don't build any modules yet. From owner-svn-src-user@FreeBSD.ORG Sat Jun 26 03:15:20 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E557106566C; Sat, 26 Jun 2010 03:15:20 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C8948FC08; Sat, 26 Jun 2010 03:15:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5Q3FKel000538; Sat, 26 Jun 2010 03:15:20 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5Q3FJB5000518; Sat, 26 Jun 2010 03:15:19 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006260315.o5Q3FJB5000518@svn.freebsd.org> From: Juli Mallett Date: Sat, 26 Jun 2010 03:15:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209530 - in user/jmallett/octeon/sys: conf mips/cavium mips/include mips/mips X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jun 2010 03:15:20 -0000 Author: jmallett Date: Sat Jun 26 03:15:19 2010 New Revision: 209530 URL: http://svn.freebsd.org/changeset/base/209530 Log: Instead of using a hackish TARGET_OCTEON option, use a CPU_CNMIPS option to detect code that needs specific changes for the Cavium Octeon, and presumably any other cnMIPS platform we would support. This allows removing some includes of opt_cputype.h, but I have not made an exhaustive check of the remaining ones. Modified: user/jmallett/octeon/sys/conf/options.mips user/jmallett/octeon/sys/mips/cavium/std.octeon1 user/jmallett/octeon/sys/mips/include/_bus.h user/jmallett/octeon/sys/mips/include/cache_mipsNN.h user/jmallett/octeon/sys/mips/include/cpufunc.h user/jmallett/octeon/sys/mips/include/cpuregs.h user/jmallett/octeon/sys/mips/mips/bus_space_generic.c user/jmallett/octeon/sys/mips/mips/cache.c user/jmallett/octeon/sys/mips/mips/cache_mipsNN.c user/jmallett/octeon/sys/mips/mips/cpu.c user/jmallett/octeon/sys/mips/mips/exception.S user/jmallett/octeon/sys/mips/mips/locore.S user/jmallett/octeon/sys/mips/mips/machdep.c user/jmallett/octeon/sys/mips/mips/mainbus.c user/jmallett/octeon/sys/mips/mips/mpboot.S user/jmallett/octeon/sys/mips/mips/pm_machdep.c user/jmallett/octeon/sys/mips/mips/support.S user/jmallett/octeon/sys/mips/mips/vm_machdep.c Modified: user/jmallett/octeon/sys/conf/options.mips ============================================================================== --- user/jmallett/octeon/sys/conf/options.mips Sat Jun 26 03:11:29 2010 (r209529) +++ user/jmallett/octeon/sys/conf/options.mips Sat Jun 26 03:15:19 2010 (r209530) @@ -50,7 +50,6 @@ CFE_ENV opt_global.h CFE_ENV_SIZE opt_global.h NOFPU opt_global.h -TARGET_OCTEON opt_global.h TARGET_EMULATOR opt_ddb.h TARGET_XLR_XLS opt_global.h Modified: user/jmallett/octeon/sys/mips/cavium/std.octeon1 ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/std.octeon1 Sat Jun 26 03:11:29 2010 (r209529) +++ user/jmallett/octeon/sys/mips/cavium/std.octeon1 Sat Jun 26 03:15:19 2010 (r209530) @@ -17,6 +17,3 @@ device pci #device clock #device obio #device uart - -# Kludge -options TARGET_OCTEON Modified: user/jmallett/octeon/sys/mips/include/_bus.h ============================================================================== --- user/jmallett/octeon/sys/mips/include/_bus.h Sat Jun 26 03:11:29 2010 (r209529) +++ user/jmallett/octeon/sys/mips/include/_bus.h Sat Jun 26 03:15:19 2010 (r209530) @@ -34,8 +34,7 @@ /* * Bus address and size types */ -#include "opt_cputype.h" -#if defined(TARGET_OCTEON) && (defined(__mips_n32) || defined(__mips_o32)) +#if defined(CPU_CNMIPS) && (defined(__mips_n32) || defined(__mips_o32)) typedef uint64_t bus_addr_t; #else typedef uintptr_t bus_addr_t; Modified: user/jmallett/octeon/sys/mips/include/cache_mipsNN.h ============================================================================== --- user/jmallett/octeon/sys/mips/include/cache_mipsNN.h Sat Jun 26 03:11:29 2010 (r209529) +++ user/jmallett/octeon/sys/mips/include/cache_mipsNN.h Sat Jun 26 03:15:19 2010 (r209530) @@ -57,7 +57,7 @@ void mipsNN_pdcache_inv_range_16(vm_offs void mipsNN_pdcache_inv_range_32(vm_offset_t, vm_size_t); void mipsNN_pdcache_wb_range_16(vm_offset_t, vm_size_t); void mipsNN_pdcache_wb_range_32(vm_offset_t, vm_size_t); -#ifdef TARGET_OCTEON +#ifdef CPU_CNMIPS void mipsNN_icache_sync_all_128(void); void mipsNN_icache_sync_range_128(vm_offset_t, vm_size_t); void mipsNN_icache_sync_range_index_128(vm_offset_t, vm_size_t); Modified: user/jmallett/octeon/sys/mips/include/cpufunc.h ============================================================================== --- user/jmallett/octeon/sys/mips/include/cpufunc.h Sat Jun 26 03:11:29 2010 (r209529) +++ user/jmallett/octeon/sys/mips/include/cpufunc.h Sat Jun 26 03:15:19 2010 (r209530) @@ -186,7 +186,7 @@ mips_wr_ ## n(uint32_t a0) \ mips_barrier(); \ } struct __hack -#ifdef TARGET_OCTEON +#ifdef CPU_CNMIPS static __inline void mips_sync_icache (void) { __asm __volatile ( Modified: user/jmallett/octeon/sys/mips/include/cpuregs.h ============================================================================== --- user/jmallett/octeon/sys/mips/include/cpuregs.h Sat Jun 26 03:11:29 2010 (r209529) +++ user/jmallett/octeon/sys/mips/include/cpuregs.h Sat Jun 26 03:15:19 2010 (r209530) @@ -110,7 +110,7 @@ #define MIPS_XKSEG_END 0xc00000ff80000000 /* CPU dependent mtc0 hazard hook */ -#ifdef TARGET_OCTEON +#ifdef CPU_CNMIPS #define COP0_SYNC nop; nop; nop; nop; nop; #elif defined(CPU_SB1) #define COP0_SYNC ssnop; ssnop; ssnop; ssnop; ssnop; ssnop; ssnop; ssnop; ssnop Modified: user/jmallett/octeon/sys/mips/mips/bus_space_generic.c ============================================================================== --- user/jmallett/octeon/sys/mips/mips/bus_space_generic.c Sat Jun 26 03:11:29 2010 (r209529) +++ user/jmallett/octeon/sys/mips/mips/bus_space_generic.c Sat Jun 26 03:15:19 2010 (r209530) @@ -198,7 +198,7 @@ static struct bus_space generic_space = /* Ultra-gross kludge */ #include "opt_cputype.h" -#if defined(TARGET_OCTEON) && (defined(__mips_n32) || defined(__mips_o32)) +#if defined(CPU_CNMIPS) && (defined(__mips_n32) || defined(__mips_o32)) #include #define rd8(a) cvmx_read64_uint8(a) #define rd16(a) cvmx_read64_uint16(a) Modified: user/jmallett/octeon/sys/mips/mips/cache.c ============================================================================== --- user/jmallett/octeon/sys/mips/mips/cache.c Sat Jun 26 03:11:29 2010 (r209529) +++ user/jmallett/octeon/sys/mips/mips/cache.c Sat Jun 26 03:15:19 2010 (r209530) @@ -99,7 +99,7 @@ mips_config_cache(struct mips_cpuinfo * mips_cache_ops.mco_icache_sync_range_index = mipsNN_icache_sync_range_index_32; break; -#ifdef TARGET_OCTEON +#ifdef CPU_CNMIPS case 128: mips_cache_ops.mco_icache_sync_all = mipsNN_icache_sync_all_128; mips_cache_ops.mco_icache_sync_range = @@ -154,7 +154,7 @@ mips_config_cache(struct mips_cpuinfo * mips_cache_ops.mco_intern_pdcache_wb_range = mipsNN_pdcache_wb_range_32; break; -#ifdef TARGET_OCTEON +#ifdef CPU_CNMIPS case 128: mips_cache_ops.mco_pdcache_wbinv_all = mips_cache_ops.mco_intern_pdcache_wbinv_all = Modified: user/jmallett/octeon/sys/mips/mips/cache_mipsNN.c ============================================================================== --- user/jmallett/octeon/sys/mips/mips/cache_mipsNN.c Sat Jun 26 03:11:29 2010 (r209529) +++ user/jmallett/octeon/sys/mips/mips/cache_mipsNN.c Sat Jun 26 03:15:19 2010 (r209530) @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$"); #define SYNC __asm volatile("sync") #endif -#ifdef TARGET_OCTEON +#ifdef CPU_CNMIPS #define SYNCI mips_sync_icache(); #else #define SYNCI @@ -568,7 +568,7 @@ mipsNN_pdcache_wb_range_32(vm_offset_t v } -#ifdef TARGET_OCTEON +#ifdef CPU_CNMIPS void mipsNN_icache_sync_all_128(void) Modified: user/jmallett/octeon/sys/mips/mips/cpu.c ============================================================================== --- user/jmallett/octeon/sys/mips/mips/cpu.c Sat Jun 26 03:11:29 2010 (r209529) +++ user/jmallett/octeon/sys/mips/mips/cpu.c Sat Jun 26 03:15:19 2010 (r209530) @@ -117,7 +117,7 @@ mips_get_identity(struct mips_cpuinfo *c cpuinfo->l1.dc_nsets = 1 << (((cfg1 & MIPS_CONFIG1_DS_MASK) >> MIPS_CONFIG1_DS_SHIFT) + 6); } -#ifdef TARGET_OCTEON +#ifdef CPU_CNMIPS /* * Octeon does 128 byte line-size. But Config-Sel1 doesn't show * 128 line-size, 1 Set, 64 ways. Modified: user/jmallett/octeon/sys/mips/mips/exception.S ============================================================================== --- user/jmallett/octeon/sys/mips/mips/exception.S Sat Jun 26 03:11:29 2010 (r209529) +++ user/jmallett/octeon/sys/mips/mips/exception.S Sat Jun 26 03:15:19 2010 (r209530) @@ -235,7 +235,7 @@ SlowFault: #define SAVE_REG(reg, offs, base) \ REG_S reg, CALLFRAME_SIZ + (SZREG * offs) (base) -#ifdef TARGET_OCTEON +#ifdef CPU_CNMIPS #define CLEAR_STATUS \ mfc0 a0, COP_0_STATUS_REG ;\ li a2, (MIPS_SR_KX | MIPS_SR_SX | MIPS_SR_UX) ; \ @@ -475,7 +475,7 @@ NNON_LEAF(MipsUserGenException, CALLFRAM PTR_LA gp, _C_LABEL(_gp) # switch to kernel GP # Turn off fpu and enter kernel mode and t0, a0, ~(SR_COP_1_BIT | SR_EXL | SR_KSU_MASK | SR_INT_ENAB) -#ifdef TARGET_OCTEON +#ifdef CPU_CNMIPS or t0, t0, (MIPS_SR_KX | MIPS_SR_SX | MIPS_SR_UX | MIPS32_SR_PX) #endif mtc0 t0, COP_0_STATUS_REG @@ -691,7 +691,7 @@ NNON_LEAF(MipsUserIntr, CALLFRAME_SIZ, r # Turn off fpu, disable interrupts, set kernel mode kernel mode, clear exception level. and t0, a0, ~(SR_COP_1_BIT | SR_EXL | SR_INT_ENAB | SR_KSU_MASK) -#ifdef TARGET_OCTEON +#ifdef CPU_CNMIPS or t0, t0, (MIPS_SR_KX | MIPS_SR_SX | MIPS_SR_UX | MIPS32_SR_PX) #endif mtc0 t0, COP_0_STATUS_REG Modified: user/jmallett/octeon/sys/mips/mips/locore.S ============================================================================== --- user/jmallett/octeon/sys/mips/mips/locore.S Sat Jun 26 03:11:29 2010 (r209529) +++ user/jmallett/octeon/sys/mips/mips/locore.S Sat Jun 26 03:15:19 2010 (r209530) @@ -88,7 +88,7 @@ VECTOR(_locore, unknown) /* UNSAFE TO USE a0..a3, since some bootloaders pass that to us */ mtc0 zero, COP_0_CAUSE_REG # Clear soft interrupts -#if defined(TARGET_OCTEON) +#if defined(CPU_CNMIPS) /* * t1: Bits to set explicitly: * Enable FPU @@ -162,7 +162,7 @@ VECTOR(_locore, unknown) sw a2, _C_LABEL(fenvp) #endif -#if defined(TARGET_OCTEON) && defined(SMP) +#if defined(CPU_CNMIPS) && defined(SMP) .set push .set mips32r2 rdhwr t2, $0 Modified: user/jmallett/octeon/sys/mips/mips/machdep.c ============================================================================== --- user/jmallett/octeon/sys/mips/mips/machdep.c Sat Jun 26 03:11:29 2010 (r209529) +++ user/jmallett/octeon/sys/mips/mips/machdep.c Sat Jun 26 03:15:19 2010 (r209530) @@ -347,7 +347,7 @@ mips_vector_init(void) bcopy(MipsTLBMiss, (void *)TLB_MISS_EXC_VEC, MipsTLBMissEnd - MipsTLBMiss); -#if defined(TARGET_OCTEON) || defined(TARGET_XLR_XLS) +#if defined(CPU_CNMIPS) || defined(TARGET_XLR_XLS) /* Fake, but sufficient, for the 32-bit with 64-bit hardware addresses */ bcopy(MipsTLBMiss, (void *)XTLB_MISS_EXC_VEC, MipsTLBMissEnd - MipsTLBMiss); Modified: user/jmallett/octeon/sys/mips/mips/mainbus.c ============================================================================== --- user/jmallett/octeon/sys/mips/mips/mainbus.c Sat Jun 26 03:11:29 2010 (r209529) +++ user/jmallett/octeon/sys/mips/mips/mainbus.c Sat Jun 26 03:15:19 2010 (r209530) @@ -251,7 +251,7 @@ mainbus_activate_resource(device_t bus, /* * If this is a memory resource, map it into the kernel. */ -#ifdef TARGET_OCTEON +#ifdef CPU_CNMIPS uint64_t temp; #endif if (rman_get_bustag(r) == MIPS_BUS_SPACE_MEM) { @@ -267,7 +267,7 @@ mainbus_activate_resource(device_t bus, + poffs; } rman_set_virtual(r, vaddr); -#ifdef TARGET_OCTEON +#ifdef CPU_CNMIPS temp = 0x0000000000000000; temp |= (uint32_t)vaddr; rman_set_bushandle(r, (bus_space_handle_t) temp); Modified: user/jmallett/octeon/sys/mips/mips/mpboot.S ============================================================================== --- user/jmallett/octeon/sys/mips/mips/mpboot.S Sat Jun 26 03:11:29 2010 (r209529) +++ user/jmallett/octeon/sys/mips/mips/mpboot.S Sat Jun 26 03:15:19 2010 (r209530) @@ -36,7 +36,7 @@ .set noat .set noreorder -#ifdef TARGET_OCTEON +#ifdef CPU_CNMIPS #define CLEAR_STATUS \ mfc0 a0, COP_0_STATUS_REG ;\ li a2, (MIPS_SR_KX | MIPS_SR_SX | MIPS_SR_UX) ; \ Modified: user/jmallett/octeon/sys/mips/mips/pm_machdep.c ============================================================================== --- user/jmallett/octeon/sys/mips/mips/pm_machdep.c Sat Jun 26 03:11:29 2010 (r209529) +++ user/jmallett/octeon/sys/mips/mips/pm_machdep.c Sat Jun 26 03:15:19 2010 (r209530) @@ -488,7 +488,7 @@ exec_setregs(struct thread *td, struct i #if defined(__mips_n32) || defined(__mips_n64) td->td_frame->sr |= SR_PX; #endif -#ifdef TARGET_OCTEON +#ifdef CPU_CNMIPS td->td_frame->sr |= MIPS_SR_COP_2_BIT | MIPS32_SR_PX | MIPS_SR_UX | MIPS_SR_KX | MIPS_SR_SX; #endif Modified: user/jmallett/octeon/sys/mips/mips/support.S ============================================================================== --- user/jmallett/octeon/sys/mips/mips/support.S Sat Jun 26 03:11:29 2010 (r209529) +++ user/jmallett/octeon/sys/mips/mips/support.S Sat Jun 26 03:15:19 2010 (r209530) @@ -1431,7 +1431,7 @@ LEAF(casuptr) END(casuptr) -#ifdef TARGET_OCTEON +#ifdef CPU_CNMIPS /* * void octeon_enable_shadow(void) * turns on access to CC and CCRes Modified: user/jmallett/octeon/sys/mips/mips/vm_machdep.c ============================================================================== --- user/jmallett/octeon/sys/mips/mips/vm_machdep.c Sat Jun 26 03:11:29 2010 (r209529) +++ user/jmallett/octeon/sys/mips/mips/vm_machdep.c Sat Jun 26 03:15:19 2010 (r209530) @@ -161,7 +161,7 @@ cpu_fork(register struct thread *td1,reg td2->td_md.md_tls = td1->td_md.md_tls; td2->td_md.md_saved_intr = MIPS_SR_INT_IE; td2->td_md.md_spinlock_count = 1; -#ifdef TARGET_OCTEON +#ifdef CPU_CNMIPS pcb2->pcb_context[PCB_REG_SR] |= MIPS_SR_COP_2_BIT | MIPS32_SR_PX | MIPS_SR_UX | MIPS_SR_KX | MIPS_SR_SX; #endif @@ -364,7 +364,7 @@ cpu_set_upcall(struct thread *td, struct /* Dont set IE bit in SR. sched lock release will take care of it */ pcb2->pcb_context[PCB_REG_SR] = SR_INT_MASK & mips_rd_status(); -#ifdef TARGET_OCTEON +#ifdef CPU_CNMIPS pcb2->pcb_context[PCB_REG_SR] |= MIPS_SR_COP_2_BIT | MIPS_SR_COP_0_BIT | MIPS32_SR_PX | MIPS_SR_UX | MIPS_SR_KX | MIPS_SR_SX; #endif @@ -426,7 +426,7 @@ cpu_set_upcall_kse(struct thread *td, vo */ tf->sr = SR_KSU_USER | SR_EXL | (SR_INT_MASK & mips_rd_status()) | MIPS_SR_INT_IE; -#ifdef TARGET_OCTEON +#ifdef CPU_CNMIPS tf->sr |= MIPS_SR_INT_IE | MIPS_SR_COP_0_BIT | MIPS32_SR_PX | MIPS_SR_UX | MIPS_SR_KX; #endif From owner-svn-src-user@FreeBSD.ORG Sat Jun 26 07:42:18 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13E8E106564A; Sat, 26 Jun 2010 07:42:18 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 02D378FC1E; Sat, 26 Jun 2010 07:42:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5Q7gHqZ065859; Sat, 26 Jun 2010 07:42:17 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5Q7gHbV065857; Sat, 26 Jun 2010 07:42:17 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006260742.o5Q7gHbV065857@svn.freebsd.org> From: Juli Mallett Date: Sat, 26 Jun 2010 07:42:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209532 - user/jmallett/octeon/sys/mips/cavium/octe X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jun 2010 07:42:18 -0000 Author: jmallett Date: Sat Jun 26 07:42:17 2010 New Revision: 209532 URL: http://svn.freebsd.org/changeset/base/209532 Log: Remove unused Linuxisms. Deleted: user/jmallett/octeon/sys/mips/cavium/octe/Kconfig user/jmallett/octeon/sys/mips/cavium/octe/Makefile user/jmallett/octeon/sys/mips/cavium/octe/ethernet-proc.c user/jmallett/octeon/sys/mips/cavium/octe/ethernet-proc.h Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-headers.h Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-headers.h ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-headers.h Sat Jun 26 07:02:31 2010 (r209531) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-headers.h Sat Jun 26 07:42:17 2010 (r209532) @@ -34,7 +34,6 @@ AND WITH ALL FAULTS AND CAVIUM NETWORKS #include "ethernet-defines.h" #include "ethernet-mdio.h" #include "ethernet-mem.h" -#include "ethernet-proc.h" #include "ethernet-rx.h" #include "ethernet-tx.h" #include "ethernet-util.h" From owner-svn-src-user@FreeBSD.ORG Sat Jun 26 07:42:34 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 42593106566B; Sat, 26 Jun 2010 07:42:34 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 17EC28FC1C; Sat, 26 Jun 2010 07:42:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5Q7gX2Y065958; Sat, 26 Jun 2010 07:42:33 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5Q7gXNC065957; Sat, 26 Jun 2010 07:42:33 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006260742.o5Q7gXNC065957@svn.freebsd.org> From: Juli Mallett Date: Sat, 26 Jun 2010 07:42:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209533 - user/jmallett/octeon/sys/mips/cavium/cryptocteon X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jun 2010 07:42:34 -0000 Author: jmallett Date: Sat Jun 26 07:42:33 2010 New Revision: 209533 URL: http://svn.freebsd.org/changeset/base/209533 Log: Remove unused Linuxism. Deleted: user/jmallett/octeon/sys/mips/cavium/cryptocteon/Makefile From owner-svn-src-user@FreeBSD.ORG Sat Jun 26 07:59:57 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E26C106564A; Sat, 26 Jun 2010 07:59:57 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5CFFB8FC18; Sat, 26 Jun 2010 07:59:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5Q7xv4C069754; Sat, 26 Jun 2010 07:59:57 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5Q7xvtG069751; Sat, 26 Jun 2010 07:59:57 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006260759.o5Q7xvtG069751@svn.freebsd.org> From: Juli Mallett Date: Sat, 26 Jun 2010 07:59:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209534 - user/jmallett/octeon/sys/mips/cavium/octe X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jun 2010 07:59:57 -0000 Author: jmallett Date: Sat Jun 26 07:59:57 2010 New Revision: 209534 URL: http://svn.freebsd.org/changeset/base/209534 Log: Don't try to use VLAN hw tagging, it doesn't seem to work as I'd hoped. Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c user/jmallett/octeon/sys/mips/cavium/octe/octe.c Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c Sat Jun 26 07:42:33 2010 (r209533) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c Sat Jun 26 07:59:57 2010 (r209534) @@ -326,11 +326,6 @@ void cvm_oct_tasklet_rx(void *context, i m->m_pkthdr.csum_data = 0xffff; } - if (work->word2.s.vlan_valid) { - m->m_pkthdr.ether_vtag = work->word2.s.vlan_id; - m->m_flags |= M_VLANTAG; - } - if (priv->intercept_cb) { callback_result = priv->intercept_cb(ifp, work, m); Modified: user/jmallett/octeon/sys/mips/cavium/octe/octe.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/octe.c Sat Jun 26 07:42:33 2010 (r209533) +++ user/jmallett/octeon/sys/mips/cavium/octe/octe.c Sat Jun 26 07:59:57 2010 (r209534) @@ -192,7 +192,7 @@ octe_attach(device_t dev) ether_ifattach(ifp, priv->mac); ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); - ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING | IFCAP_HWCSUM; + ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_HWCSUM; ifp->if_capenable = ifp->if_capabilities; ifp->if_hwassist = CSUM_TCP | CSUM_UDP; From owner-svn-src-user@FreeBSD.ORG Sat Jun 26 08:34:23 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37E24106566B; Sat, 26 Jun 2010 08:34:23 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 268D18FC13; Sat, 26 Jun 2010 08:34:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5Q8YNKq077355; Sat, 26 Jun 2010 08:34:23 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5Q8YNeH077353; Sat, 26 Jun 2010 08:34:23 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006260834.o5Q8YNeH077353@svn.freebsd.org> From: Juli Mallett Date: Sat, 26 Jun 2010 08:34:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209535 - user/jmallett/octeon/sys/mips/cavium X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jun 2010 08:34:23 -0000 Author: jmallett Date: Sat Jun 26 08:34:22 2010 New Revision: 209535 URL: http://svn.freebsd.org/changeset/base/209535 Log: Print the Octeon SDK version on boot. Modified: user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c Modified: user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c Sat Jun 26 07:59:57 2010 (r209534) +++ user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c Sat Jun 26 08:34:22 2010 (r209535) @@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #if defined(__mips_n64) #define MAX_APP_DESC_ADDR 0xffffffffafffffff @@ -350,6 +351,7 @@ platform_start(__register_t a0, __regist cvmx_write_csr(CVMX_CIU_MBOX_CLRX(0), 0xffffffff); #endif + printf("Octeon SDK: %s\n", OCTEON_SDK_VERSION_STRING); printf("Available Octeon features:"); for (ofd = octeon_feature_descriptions; ofd->ofd_string != NULL; ofd++) if (octeon_has_feature(ofd->ofd_feature))