From owner-svn-src-user@FreeBSD.ORG Sun Oct 10 21:40:36 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 408D6106564A; Sun, 10 Oct 2010 21:40:36 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 25FAB8FC14; Sun, 10 Oct 2010 21:40:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9ALeag9093802; Sun, 10 Oct 2010 21:40:36 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9ALeadX093798; Sun, 10 Oct 2010 21:40:36 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010102140.o9ALeadX093798@svn.freebsd.org> From: Weongyo Jeong Date: Sun, 10 Oct 2010 21:40:36 +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: r213675 - in user/weongyo/usb/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, 10 Oct 2010 21:40:36 -0000 Author: weongyo Date: Sun Oct 10 21:40:35 2010 New Revision: 213675 URL: http://svn.freebsd.org/changeset/base/213675 Log: Adds a global linked-list to link all `struct usb_bus' structures. This would be used to find a USB bus pointer by name that main consumer would be a implementation like USB transaction monitoring tools (e.g. usbmon in linux). Modified: user/weongyo/usb/sys/dev/usb/controller/usb_controller.c user/weongyo/usb/sys/dev/usb/usb_bus.h user/weongyo/usb/sys/dev/usb/usb_controller.h Modified: user/weongyo/usb/sys/dev/usb/controller/usb_controller.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Sun Oct 10 20:54:01 2010 (r213674) +++ user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Sun Oct 10 21:40:35 2010 (r213675) @@ -72,6 +72,8 @@ static void usb_bus_mem_free_all(struct /* static variables */ +static TAILQ_HEAD(, usb_bus) usb_bus_head; + #ifdef USB_DEBUG static int usb_ctrl_debug = 0; @@ -540,6 +542,9 @@ usb_bus_struct_init(struct usb_bus *bus, /* get all DMA memory */ if (usb_bus_mem_alloc_all(bus, USB_GET_DMA_TAG(dev))) return (ENOMEM); + + TAILQ_INSERT_TAIL(&usb_bus_head, bus, bus_link); + return (0); } @@ -547,6 +552,31 @@ void usb_bus_struct_fini(struct usb_bus *bus) { + TAILQ_REMOVE(&usb_bus_head, bus, bus_link); + usb_bus_mem_free_all(bus); mtx_destroy(&bus->bus_mtx); } + +struct usb_bus * +usb_bus_find(const char *name) +{ + struct usb_bus *bus; + const char *nameunit; + + TAILQ_FOREACH(bus, &usb_bus_head, bus_link) { + nameunit = device_get_nameunit(bus->bdev); + if (!strncmp(nameunit, name, strlen(nameunit))) + return (bus); + } + return (NULL); +} + +static void +usb_bus_first(void *arg) +{ + + TAILQ_INIT(&usb_bus_head); +} + +SYSINIT(usb_bus_first, SI_SUB_KLD, SI_ORDER_FIRST, usb_bus_first, NULL); Modified: user/weongyo/usb/sys/dev/usb/usb_bus.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_bus.h Sun Oct 10 20:54:01 2010 (r213674) +++ user/weongyo/usb/sys/dev/usb/usb_bus.h Sun Oct 10 21:40:35 2010 (r213675) @@ -103,6 +103,8 @@ struct usb_bus { struct usb_temp_setup temp_setup[1]; uint8_t data[255]; } scratch[1]; + + TAILQ_ENTRY(usb_bus) bus_link; }; #endif /* _USB_BUS_H_ */ Modified: user/weongyo/usb/sys/dev/usb/usb_controller.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_controller.h Sun Oct 10 20:54:01 2010 (r213674) +++ user/weongyo/usb/sys/dev/usb/usb_controller.h Sun Oct 10 21:40:35 2010 (r213675) @@ -199,6 +199,7 @@ int usb_bus_struct_init(struct usb_bus void (*busmem_func)(struct usb_bus *, usb_bus_mem_callback_t *)); void usb_bus_struct_fini(struct usb_bus *bus); +struct usb_bus *usb_bus_find(const char *name); void usb_bus_mem_flush_all(struct usb_bus *bus); uint16_t usb_isoc_time_expand(struct usb_bus *bus, uint16_t isoc_time_curr); From owner-svn-src-user@FreeBSD.ORG Sun Oct 10 22:11:39 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 23EC3106566B; Sun, 10 Oct 2010 22:11:39 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ECDAD8FC18; Sun, 10 Oct 2010 22:11:38 +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 o9AMBc6e094495; Sun, 10 Oct 2010 22:11:38 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9AMBceD094491; Sun, 10 Oct 2010 22:11:38 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010102211.o9AMBceD094491@svn.freebsd.org> From: Weongyo Jeong Date: Sun, 10 Oct 2010 22:11:38 +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: r213676 - in user/weongyo/usb/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, 10 Oct 2010 22:11:39 -0000 Author: weongyo Date: Sun Oct 10 22:11:38 2010 New Revision: 213676 URL: http://svn.freebsd.org/changeset/base/213676 Log: Reverts r213675 that already the device tree knows how to find it using devclass_find(9). Pointed by: yongari Modified: user/weongyo/usb/sys/dev/usb/controller/usb_controller.c user/weongyo/usb/sys/dev/usb/usb_bus.h user/weongyo/usb/sys/dev/usb/usb_controller.h Modified: user/weongyo/usb/sys/dev/usb/controller/usb_controller.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Sun Oct 10 21:40:35 2010 (r213675) +++ user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Sun Oct 10 22:11:38 2010 (r213676) @@ -72,8 +72,6 @@ static void usb_bus_mem_free_all(struct /* static variables */ -static TAILQ_HEAD(, usb_bus) usb_bus_head; - #ifdef USB_DEBUG static int usb_ctrl_debug = 0; @@ -542,9 +540,6 @@ usb_bus_struct_init(struct usb_bus *bus, /* get all DMA memory */ if (usb_bus_mem_alloc_all(bus, USB_GET_DMA_TAG(dev))) return (ENOMEM); - - TAILQ_INSERT_TAIL(&usb_bus_head, bus, bus_link); - return (0); } @@ -552,31 +547,6 @@ void usb_bus_struct_fini(struct usb_bus *bus) { - TAILQ_REMOVE(&usb_bus_head, bus, bus_link); - usb_bus_mem_free_all(bus); mtx_destroy(&bus->bus_mtx); } - -struct usb_bus * -usb_bus_find(const char *name) -{ - struct usb_bus *bus; - const char *nameunit; - - TAILQ_FOREACH(bus, &usb_bus_head, bus_link) { - nameunit = device_get_nameunit(bus->bdev); - if (!strncmp(nameunit, name, strlen(nameunit))) - return (bus); - } - return (NULL); -} - -static void -usb_bus_first(void *arg) -{ - - TAILQ_INIT(&usb_bus_head); -} - -SYSINIT(usb_bus_first, SI_SUB_KLD, SI_ORDER_FIRST, usb_bus_first, NULL); Modified: user/weongyo/usb/sys/dev/usb/usb_bus.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_bus.h Sun Oct 10 21:40:35 2010 (r213675) +++ user/weongyo/usb/sys/dev/usb/usb_bus.h Sun Oct 10 22:11:38 2010 (r213676) @@ -103,8 +103,6 @@ struct usb_bus { struct usb_temp_setup temp_setup[1]; uint8_t data[255]; } scratch[1]; - - TAILQ_ENTRY(usb_bus) bus_link; }; #endif /* _USB_BUS_H_ */ Modified: user/weongyo/usb/sys/dev/usb/usb_controller.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_controller.h Sun Oct 10 21:40:35 2010 (r213675) +++ user/weongyo/usb/sys/dev/usb/usb_controller.h Sun Oct 10 22:11:38 2010 (r213676) @@ -199,7 +199,6 @@ int usb_bus_struct_init(struct usb_bus void (*busmem_func)(struct usb_bus *, usb_bus_mem_callback_t *)); void usb_bus_struct_fini(struct usb_bus *bus); -struct usb_bus *usb_bus_find(const char *name); void usb_bus_mem_flush_all(struct usb_bus *bus); uint16_t usb_isoc_time_expand(struct usb_bus *bus, uint16_t isoc_time_curr); From owner-svn-src-user@FreeBSD.ORG Mon Oct 11 00:59:47 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 2C5C3106564A; Mon, 11 Oct 2010 00:59:47 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A9D58FC0A; Mon, 11 Oct 2010 00:59:47 +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 o9B0xlQV097917; Mon, 11 Oct 2010 00:59:47 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9B0xlgW097911; Mon, 11 Oct 2010 00:59:47 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010110059.o9B0xlgW097911@svn.freebsd.org> From: Weongyo Jeong Date: Mon, 11 Oct 2010 00:59:47 +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: r213677 - in user/weongyo/usb/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: Mon, 11 Oct 2010 00:59:47 -0000 Author: weongyo Date: Mon Oct 11 00:59:46 2010 New Revision: 213677 URL: http://svn.freebsd.org/changeset/base/213677 Log: Commits a experimental USB packet filter (aka usbpf) to capture USB packets between the driver and the host controller. It's for USB debugging and monitoring. Most code are extracted from bpf(9) interfaces and customized only for USB packets. As next step the userland application, usbdump(1), would be coming. Reviews welcome. Added: user/weongyo/usb/sys/dev/usb/usb_pf.c (contents, props changed) user/weongyo/usb/sys/dev/usb/usb_pf.h (contents, props changed) Modified: user/weongyo/usb/sys/dev/usb/controller/usb_controller.c user/weongyo/usb/sys/dev/usb/usb_bus.h user/weongyo/usb/sys/dev/usb/usb_controller.h Modified: user/weongyo/usb/sys/dev/usb/controller/usb_controller.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Sun Oct 10 22:11:38 2010 (r213676) +++ user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Mon Oct 11 00:59:46 2010 (r213677) @@ -60,6 +60,7 @@ #include #include +#include /* function prototypes */ @@ -540,6 +541,9 @@ usb_bus_struct_init(struct usb_bus *bus, /* get all DMA memory */ if (usb_bus_mem_alloc_all(bus, USB_GET_DMA_TAG(dev))) return (ENOMEM); + + usbpf_attach(bus, &bus->uif); + return (0); } @@ -547,6 +551,35 @@ void usb_bus_struct_fini(struct usb_bus *bus) { + usbpf_detach(bus); + usb_bus_mem_free_all(bus); mtx_destroy(&bus->bus_mtx); } + +struct usb_bus * +usb_bus_find(const char *name) +{ + struct usb_bus *ubus; + devclass_t dc; + device_t *devlist; + int devcount, error, i; + const char *nameunit; + + dc = devclass_find("usbus"); + if (dc == NULL) + return (NULL); + error = devclass_get_devices(dc, &devlist, &devcount); + if (error != 0) + return (NULL); + for (i = 0; i < devcount; i++) { + nameunit = device_get_nameunit(devlist[i]); + if (!strncmp(name, nameunit, strlen(nameunit))) { + ubus = device_get_ivars(devlist[i]); + free(devlist, M_TEMP); + return (ubus); + } + } + free(devlist, M_TEMP); + return (NULL); +} Modified: user/weongyo/usb/sys/dev/usb/usb_bus.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_bus.h Sun Oct 10 22:11:38 2010 (r213676) +++ user/weongyo/usb/sys/dev/usb/usb_bus.h Mon Oct 11 00:59:46 2010 (r213677) @@ -80,6 +80,8 @@ struct usb_bus { struct usb_bus_methods *methods; /* filled by HC driver */ struct usb_device **devices; + struct usbpf_if *uif; /* USB Packet Filter */ + void (*busmem_func)(struct usb_bus *, usb_bus_mem_callback_t *); usb_power_mask_t hw_power_state; /* see USB_HW_POWER_XXX */ Modified: user/weongyo/usb/sys/dev/usb/usb_controller.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_controller.h Sun Oct 10 22:11:38 2010 (r213676) +++ user/weongyo/usb/sys/dev/usb/usb_controller.h Mon Oct 11 00:59:46 2010 (r213677) @@ -199,6 +199,7 @@ int usb_bus_struct_init(struct usb_bus void (*busmem_func)(struct usb_bus *, usb_bus_mem_callback_t *)); void usb_bus_struct_fini(struct usb_bus *bus); +struct usb_bus *usb_bus_find(const char *name); void usb_bus_mem_flush_all(struct usb_bus *bus); uint16_t usb_isoc_time_expand(struct usb_bus *bus, uint16_t isoc_time_curr); Added: user/weongyo/usb/sys/dev/usb/usb_pf.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/weongyo/usb/sys/dev/usb/usb_pf.c Mon Oct 11 00:59:46 2010 (r213677) @@ -0,0 +1,1719 @@ +/*- + * Copyright (c) 2010 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * 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. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +/* + * All usbpf implementations are extracted from bpf(9) APIs and it's + * specialized for USB packet filtering between the driver and the host + * controller. + */ + +MALLOC_DEFINE(M_USBPF, "USBPktFilter", "USB Packet Filter"); + +/* + * Rotate the packet buffers in descriptor ud. Move the store buffer into the + * hold slot, and the free buffer ino the store slot. Zero the length of the + * new store buffer. Descriptor lock should be held. + */ +#define USBPF_ROTATE_BUFFERS(ud) do { \ + (ud)->ud_hbuf = (ud)->ud_sbuf; \ + (ud)->ud_hlen = (ud)->ud_slen; \ + (ud)->ud_sbuf = (ud)->ud_fbuf; \ + (ud)->ud_slen = 0; \ + (ud)->ud_fbuf = NULL; \ + usbpf_bufheld(ud); \ +} while (0) + +#ifndef __i386__ +#define USBPF_ALIGN +#endif + +#ifndef USBPF_ALIGN +#define USBPF_EXTRACT_SHORT(p) ((u_int16_t)ntohs(*(u_int16_t *)p)) +#define USBPF_EXTRACT_LONG(p) (ntohl(*(u_int32_t *)p)) +#else +#define USBPF_EXTRACT_SHORT(p) \ + ((u_int16_t) \ + ((u_int16_t)*((u_char *)p+0)<<8| \ + (u_int16_t)*((u_char *)p+1)<<0)) +#define USBPF_EXTRACT_LONG(p) \ + ((u_int32_t)*((u_char *)p+0)<<24| \ + (u_int32_t)*((u_char *)p+1)<<16| \ + (u_int32_t)*((u_char *)p+2)<<8| \ + (u_int32_t)*((u_char *)p+3)<<0) +#endif + +/* + * The instruction encodings. + */ + +/* instruction classes */ +#define USBPF_CLASS(code) ((code) & 0x07) +#define USBPF_LD 0x00 +#define USBPF_LDX 0x01 +#define USBPF_ST 0x02 +#define USBPF_STX 0x03 +#define USBPF_ALU 0x04 +#define USBPF_JMP 0x05 +#define USBPF_RET 0x06 +#define USBPF_MISC 0x07 + +/* ld/ldx fields */ +#define USBPF_SIZE(code) ((code) & 0x18) +#define USBPF_W 0x00 +#define USBPF_H 0x08 +#define USBPF_B 0x10 +#define USBPF_MODE(code) ((code) & 0xe0) +#define USBPF_IMM 0x00 +#define USBPF_ABS 0x20 +#define USBPF_IND 0x40 +#define USBPF_MEM 0x60 +#define USBPF_LEN 0x80 +#define USBPF_MSH 0xa0 + +/* alu/jmp fields */ +#define USBPF_OP(code) ((code) & 0xf0) +#define USBPF_ADD 0x00 +#define USBPF_SUB 0x10 +#define USBPF_MUL 0x20 +#define USBPF_DIV 0x30 +#define USBPF_OR 0x40 +#define USBPF_AND 0x50 +#define USBPF_LSH 0x60 +#define USBPF_RSH 0x70 +#define USBPF_NEG 0x80 +#define USBPF_JA 0x00 +#define USBPF_JEQ 0x10 +#define USBPF_JGT 0x20 +#define USBPF_JGE 0x30 +#define USBPF_JSET 0x40 +#define USBPF_SRC(code) ((code) & 0x08) +#define USBPF_K 0x00 +#define USBPF_X 0x08 + +/* ret - USBPF_K and USBPF_X also apply */ +#define USBPF_RVAL(code) ((code) & 0x18) +#define USBPF_A 0x10 + +/* misc */ +#define USBPF_MISCOP(code) ((code) & 0xf8) +#define USBPF_TAX 0x00 +#define USBPF_TXA 0x80 + +/* + * Number of scratch memory words (for USBPF_LD|USBPF_MEM and USBPF_ST). + */ +#define USBPF_MEMWORDS 16 + +/* Values for ud_state */ +#define USBPF_IDLE 0 /* no select in progress */ +#define USBPF_WAITING 1 /* waiting for read timeout in select */ +#define USBPF_TIMED_OUT 2 /* read timeout has expired in select */ + +#define PRIUSB 26 /* interruptible */ + +/* Frame directions */ +enum usbpf_direction { + USBPF_D_IN, /* See incoming frames */ + USBPF_D_INOUT, /* See incoming and outgoing frames */ + USBPF_D_OUT /* See outgoing frames */ +}; + +static void usbpf_append_bytes(struct usbpf_d *, caddr_t, u_int, void *, + u_int); +static void usbpf_attachd(struct usbpf_d *, struct usbpf_if *); +static void usbpf_detachd(struct usbpf_d *); +static int usbpf_canfreebuf(struct usbpf_d *); +static void usbpf_buf_reclaimed(struct usbpf_d *); +static int usbpf_canwritebuf(struct usbpf_d *); + +static d_open_t usbpf_open; +static d_read_t usbpf_read; +static d_write_t usbpf_write; +static d_ioctl_t usbpf_ioctl; +static d_poll_t usbpf_poll; +static d_kqfilter_t usbpf_kqfilter; + +static struct cdevsw usbpf_cdevsw = { + .d_version = D_VERSION, + .d_open = usbpf_open, + .d_read = usbpf_read, + .d_write = usbpf_write, + .d_ioctl = usbpf_ioctl, + .d_poll = usbpf_poll, + .d_name = "usbpf", + .d_kqfilter = usbpf_kqfilter, +}; + +static LIST_HEAD(, usbpf_if) usbpf_iflist; +static struct mtx usbpf_mtx; /* global lock */ +static int usbpf_uifd_cnt; + +static int usbpf_bufsize = 4096; +#define USBPF_MINBUFSIZE 32 +#define USBPF_MAXBUFSIZE 0x80000 +static int usbpf_maxbufsize = USBPF_MAXBUFSIZE; +#define USBPF_MAXINSNS 512 +static int usbpf_maxinsns = USBPF_MAXINSNS; + +static void +usbpf_buffer_init(struct usbpf_d *ud) +{ + + ud->ud_bufsize = usbpf_bufsize; +} + +/* + * Free USBPF kernel buffers on device close. + */ +static void +usbpf_buffer_free(struct usbpf_d *ud) +{ + + if (ud->ud_sbuf != NULL) + free(ud->ud_sbuf, M_USBPF); + if (ud->ud_hbuf != NULL) + free(ud->ud_hbuf, M_USBPF); + if (ud->ud_fbuf != NULL) + free(ud->ud_fbuf, M_USBPF); + +#ifdef INVARIANTS + ud->ud_sbuf = ud->ud_hbuf = ud->ud_fbuf = (caddr_t)~0; +#endif +} + +static void +usbpf_buffer_alloc(struct usbpf_d *ud) +{ + + KASSERT(ud->ud_fbuf == NULL, ("usbpf_buffer_alloc: ud_fbuf != NULL")); + KASSERT(ud->ud_sbuf == NULL, ("usbpf_buffer_alloc: ud_sbuf != NULL")); + KASSERT(ud->ud_hbuf == NULL, ("usbpf_buffer_alloc: ud_hbuf != NULL")); + + ud->ud_fbuf = (caddr_t)malloc(ud->ud_bufsize, M_USBPF, M_WAITOK); + ud->ud_sbuf = (caddr_t)malloc(ud->ud_bufsize, M_USBPF, M_WAITOK); + ud->ud_hbuf = NULL; + ud->ud_slen = 0; + ud->ud_hlen = 0; +} + +/* + * Copy buffer storage to user space in read(). + */ +static int +usbpf_buffer_uiomove(struct usbpf_d *ud, caddr_t buf, u_int len, + struct uio *uio) +{ + + return (uiomove(buf, len, uio)); +} + +/* + * Simple data copy to the current kernel buffer. + */ +static void +usbpf_buffer_append_bytes(struct usbpf_d *ud, caddr_t buf, u_int offset, + void *src, u_int len) +{ + u_char *src_bytes; + + src_bytes = (u_char *)src; + bcopy(src_bytes, buf + offset, len); +} + +/* + * Allocate or resize buffers. + */ +static int +usbpf_buffer_ioctl_sblen(struct usbpf_d *ud, u_int *i) +{ + u_int size; + + USBPFD_LOCK(ud); + if (ud->ud_bif != NULL) { + USBPFD_UNLOCK(ud); + return (EINVAL); + } + size = *i; + if (size > usbpf_maxbufsize) + *i = size = usbpf_maxbufsize; + else if (size < USBPF_MINBUFSIZE) + *i = size = USBPF_MINBUFSIZE; + ud->ud_bufsize = size; + USBPFD_UNLOCK(ud); + return (0); +} + +static const u_short usbpf_code_map[] = { + 0x10ff, /* 0x00-0x0f: 1111111100001000 */ + 0x3070, /* 0x10-0x1f: 0000111000001100 */ + 0x3131, /* 0x20-0x2f: 1000110010001100 */ + 0x3031, /* 0x30-0x3f: 1000110000001100 */ + 0x3131, /* 0x40-0x4f: 1000110010001100 */ + 0x1011, /* 0x50-0x5f: 1000100000001000 */ + 0x1013, /* 0x60-0x6f: 1100100000001000 */ + 0x1010, /* 0x70-0x7f: 0000100000001000 */ + 0x0093, /* 0x80-0x8f: 1100100100000000 */ + 0x0000, /* 0x90-0x9f: 0000000000000000 */ + 0x0000, /* 0xa0-0xaf: 0000000000000000 */ + 0x0002, /* 0xb0-0xbf: 0100000000000000 */ + 0x0000, /* 0xc0-0xcf: 0000000000000000 */ + 0x0000, /* 0xd0-0xdf: 0000000000000000 */ + 0x0000, /* 0xe0-0xef: 0000000000000000 */ + 0x0000 /* 0xf0-0xff: 0000000000000000 */ +}; + +#define USBPF_VALIDATE_CODE(c) \ + ((c) <= 0xff && (usbpf_code_map[(c) >> 4] & (1 << ((c) & 0xf))) != 0) + +/* + * Return true if the 'fcode' is a valid filter program. + * The constraints are that each jump be forward and to a valid + * code. The code must terminate with either an accept or reject. + * + * The kernel needs to be able to verify an application's filter code. + * Otherwise, a bogus program could easily crash the system. + */ +static int +usbpf_validate(const struct usbpf_insn *f, int len) +{ + register int i; + register const struct usbpf_insn *p; + + /* Do not accept negative length filter. */ + if (len < 0) + return (0); + + /* An empty filter means accept all. */ + if (len == 0) + return (1); + + for (i = 0; i < len; ++i) { + p = &f[i]; + /* + * Check that the code is valid. + */ + if (!USBPF_VALIDATE_CODE(p->code)) + return (0); + /* + * Check that that jumps are forward, and within + * the code block. + */ + if (USBPF_CLASS(p->code) == USBPF_JMP) { + register u_int offset; + + if (p->code == (USBPF_JMP|USBPF_JA)) + offset = p->k; + else + offset = p->jt > p->jf ? p->jt : p->jf; + if (offset >= (u_int)(len - i) - 1) + return (0); + continue; + } + /* + * Check that memory operations use valid addresses. + */ + if (p->code == USBPF_ST || p->code == USBPF_STX || + p->code == (USBPF_LD|USBPF_MEM) || + p->code == (USBPF_LDX|USBPF_MEM)) { + if (p->k >= USBPF_MEMWORDS) + return (0); + continue; + } + /* + * Check for constant division by 0. + */ + if (p->code == (USBPF_ALU|USBPF_DIV|USBPF_K) && p->k == 0) + return (0); + } + return (USBPF_CLASS(f[len - 1].code) == USBPF_RET); +} + +#ifdef _KERNEL +#define MINDEX(m, k) \ +{ \ + register int len = m->m_len; \ + \ + while (k >= len) { \ + k -= len; \ + m = m->m_next; \ + if (m == 0) \ + return (0); \ + len = m->m_len; \ + } \ +} + +static u_int16_t m_xhalf(struct mbuf *m, usbpf_u_int32 k, int *err); +static u_int32_t m_xword(struct mbuf *m, usbpf_u_int32 k, int *err); + +static u_int32_t +m_xword(struct mbuf *m, usbpf_u_int32 k, int *err) +{ + size_t len; + u_char *cp, *np; + struct mbuf *m0; + + len = m->m_len; + while (k >= len) { + k -= len; + m = m->m_next; + if (m == 0) + goto bad; + len = m->m_len; + } + cp = mtod(m, u_char *) + k; + if (len - k >= 4) { + *err = 0; + return (USBPF_EXTRACT_LONG(cp)); + } + m0 = m->m_next; + if (m0 == 0 || m0->m_len + len - k < 4) + goto bad; + *err = 0; + np = mtod(m0, u_char *); + switch (len - k) { + case 1: + return (((u_int32_t)cp[0] << 24) | + ((u_int32_t)np[0] << 16) | + ((u_int32_t)np[1] << 8) | + (u_int32_t)np[2]); + + case 2: + return (((u_int32_t)cp[0] << 24) | + ((u_int32_t)cp[1] << 16) | + ((u_int32_t)np[0] << 8) | + (u_int32_t)np[1]); + + default: + return (((u_int32_t)cp[0] << 24) | + ((u_int32_t)cp[1] << 16) | + ((u_int32_t)cp[2] << 8) | + (u_int32_t)np[0]); + } + bad: + *err = 1; + return (0); +} + +static u_int16_t +m_xhalf(struct mbuf *m, usbpf_u_int32 k, int *err) +{ + size_t len; + u_char *cp; + struct mbuf *m0; + + len = m->m_len; + while (k >= len) { + k -= len; + m = m->m_next; + if (m == 0) + goto bad; + len = m->m_len; + } + cp = mtod(m, u_char *) + k; + if (len - k >= 2) { + *err = 0; + return (USBPF_EXTRACT_SHORT(cp)); + } + m0 = m->m_next; + if (m0 == 0) + goto bad; + *err = 0; + return ((cp[0] << 8) | mtod(m0, u_char *)[0]); + bad: + *err = 1; + return (0); +} +#endif + +/* + * Execute the filter program starting at pc on the packet p + * wirelen is the length of the original packet + * buflen is the amount of data present + */ +static u_int +usbpf_filter(const struct usbpf_insn *pc, u_char *p, u_int wirelen, + u_int buflen) +{ + u_int32_t A = 0, X = 0; + usbpf_u_int32 k; + u_int32_t mem[USBPF_MEMWORDS]; + + if (pc == NULL) + /* + * No filter means accept all. + */ + return ((u_int)-1); + + --pc; + while (1) { + ++pc; + switch (pc->code) { + default: +#ifdef _KERNEL + return (0); +#else + abort(); +#endif + + case USBPF_RET|USBPF_K: + return ((u_int)pc->k); + + case USBPF_RET|USBPF_A: + return ((u_int)A); + + case USBPF_LD|USBPF_W|USBPF_ABS: + k = pc->k; + if (k > buflen || sizeof(int32_t) > buflen - k) { +#ifdef _KERNEL + int merr; + + if (buflen != 0) + return (0); + A = m_xword((struct mbuf *)p, k, &merr); + if (merr != 0) + return (0); + continue; +#else + return (0); +#endif + } +#ifdef USBPF_ALIGN + if (((intptr_t)(p + k) & 3) != 0) + A = USBPF_EXTRACT_LONG(&p[k]); + else +#endif + A = ntohl(*(int32_t *)(p + k)); + continue; + + case USBPF_LD|USBPF_H|USBPF_ABS: + k = pc->k; + if (k > buflen || sizeof(int16_t) > buflen - k) { +#ifdef _KERNEL + int merr; + + if (buflen != 0) + return (0); + A = m_xhalf((struct mbuf *)p, k, &merr); + continue; +#else + return (0); +#endif + } + A = USBPF_EXTRACT_SHORT(&p[k]); + continue; + + case USBPF_LD|USBPF_B|USBPF_ABS: + k = pc->k; + if (k >= buflen) { +#ifdef _KERNEL + struct mbuf *m; + + if (buflen != 0) + return (0); + m = (struct mbuf *)p; + MINDEX(m, k); + A = mtod(m, u_char *)[k]; + continue; +#else + return (0); +#endif + } + A = p[k]; + continue; + + case USBPF_LD|USBPF_W|USBPF_LEN: + A = wirelen; + continue; + + case USBPF_LDX|USBPF_W|USBPF_LEN: + X = wirelen; + continue; + + case USBPF_LD|USBPF_W|USBPF_IND: + k = X + pc->k; + if (pc->k > buflen || X > buflen - pc->k || + sizeof(int32_t) > buflen - k) { +#ifdef _KERNEL + int merr; + + if (buflen != 0) + return (0); + A = m_xword((struct mbuf *)p, k, &merr); + if (merr != 0) + return (0); + continue; +#else + return (0); +#endif + } +#ifdef USBPF_ALIGN + if (((intptr_t)(p + k) & 3) != 0) + A = USBPF_EXTRACT_LONG(&p[k]); + else +#endif + A = ntohl(*(int32_t *)(p + k)); + continue; + + case USBPF_LD|USBPF_H|USBPF_IND: + k = X + pc->k; + if (X > buflen || pc->k > buflen - X || + sizeof(int16_t) > buflen - k) { +#ifdef _KERNEL + int merr; + + if (buflen != 0) + return (0); + A = m_xhalf((struct mbuf *)p, k, &merr); + if (merr != 0) + return (0); + continue; +#else + return (0); +#endif + } + A = USBPF_EXTRACT_SHORT(&p[k]); + continue; + + case USBPF_LD|USBPF_B|USBPF_IND: + k = X + pc->k; + if (pc->k >= buflen || X >= buflen - pc->k) { +#ifdef _KERNEL + struct mbuf *m; + + if (buflen != 0) + return (0); + m = (struct mbuf *)p; + MINDEX(m, k); + A = mtod(m, u_char *)[k]; + continue; +#else + return (0); +#endif + } + A = p[k]; + continue; + + case USBPF_LDX|USBPF_MSH|USBPF_B: + k = pc->k; + if (k >= buflen) { +#ifdef _KERNEL + register struct mbuf *m; + + if (buflen != 0) + return (0); + m = (struct mbuf *)p; + MINDEX(m, k); + X = (mtod(m, u_char *)[k] & 0xf) << 2; + continue; +#else + return (0); +#endif + } + X = (p[pc->k] & 0xf) << 2; + continue; + + case USBPF_LD|USBPF_IMM: + A = pc->k; + continue; + + case USBPF_LDX|USBPF_IMM: + X = pc->k; + continue; + + case USBPF_LD|USBPF_MEM: + A = mem[pc->k]; + continue; + + case USBPF_LDX|USBPF_MEM: + X = mem[pc->k]; + continue; + + case USBPF_ST: + mem[pc->k] = A; + continue; + + case USBPF_STX: + mem[pc->k] = X; + continue; + + case USBPF_JMP|USBPF_JA: + pc += pc->k; + continue; + + case USBPF_JMP|USBPF_JGT|USBPF_K: + pc += (A > pc->k) ? pc->jt : pc->jf; + continue; + + case USBPF_JMP|USBPF_JGE|USBPF_K: + pc += (A >= pc->k) ? pc->jt : pc->jf; + continue; + + case USBPF_JMP|USBPF_JEQ|USBPF_K: + pc += (A == pc->k) ? pc->jt : pc->jf; + continue; + + case USBPF_JMP|USBPF_JSET|USBPF_K: + pc += (A & pc->k) ? pc->jt : pc->jf; + continue; + + case USBPF_JMP|USBPF_JGT|USBPF_X: + pc += (A > X) ? pc->jt : pc->jf; + continue; + + case USBPF_JMP|USBPF_JGE|USBPF_X: + pc += (A >= X) ? pc->jt : pc->jf; + continue; + + case USBPF_JMP|USBPF_JEQ|USBPF_X: + pc += (A == X) ? pc->jt : pc->jf; + continue; + + case USBPF_JMP|USBPF_JSET|USBPF_X: + pc += (A & X) ? pc->jt : pc->jf; + continue; + + case USBPF_ALU|USBPF_ADD|USBPF_X: + A += X; + continue; + + case USBPF_ALU|USBPF_SUB|USBPF_X: + A -= X; + continue; + + case USBPF_ALU|USBPF_MUL|USBPF_X: + A *= X; + continue; + + case USBPF_ALU|USBPF_DIV|USBPF_X: + if (X == 0) + return (0); + A /= X; + continue; + + case USBPF_ALU|USBPF_AND|USBPF_X: + A &= X; + continue; + + case USBPF_ALU|USBPF_OR|USBPF_X: + A |= X; + continue; + + case USBPF_ALU|USBPF_LSH|USBPF_X: + A <<= X; + continue; + + case USBPF_ALU|USBPF_RSH|USBPF_X: + A >>= X; + continue; + + case USBPF_ALU|USBPF_ADD|USBPF_K: + A += pc->k; + continue; + + case USBPF_ALU|USBPF_SUB|USBPF_K: + A -= pc->k; + continue; + + case USBPF_ALU|USBPF_MUL|USBPF_K: + A *= pc->k; + continue; + + case USBPF_ALU|USBPF_DIV|USBPF_K: + A /= pc->k; + continue; + + case USBPF_ALU|USBPF_AND|USBPF_K: + A &= pc->k; + continue; + + case USBPF_ALU|USBPF_OR|USBPF_K: + A |= pc->k; + continue; + + case USBPF_ALU|USBPF_LSH|USBPF_K: + A <<= pc->k; + continue; + + case USBPF_ALU|USBPF_RSH|USBPF_K: + A >>= pc->k; + continue; + + case USBPF_ALU|USBPF_NEG: + A = -A; + continue; + + case USBPF_MISC|USBPF_TAX: + X = A; + continue; + + case USBPF_MISC|USBPF_TXA: + A = X; + continue; + } + } +} + +static void +usbpf_free(struct usbpf_d *ud) +{ + + switch (ud->ud_bufmode) { + case USBPF_BUFMODE_BUFFER: + return (usbpf_buffer_free(ud)); + default: + panic("usbpf_buf_free"); + } +} + +/* + * Notify the buffer model that a buffer has moved into the hold position. + */ +static void +usbpf_bufheld(struct usbpf_d *ud) +{ + + USBPFD_LOCK_ASSERT(ud); +} + +/* + * Free buffers currently in use by a descriptor. + * Called on close. + */ +static void +usbpf_freed(struct usbpf_d *ud) +{ + + /* + * We don't need to lock out interrupts since this descriptor has + * been detached from its interface and it yet hasn't been marked + * free. + */ + usbpf_free(ud); + if (ud->ud_rfilter != NULL) + free((caddr_t)ud->ud_rfilter, M_USBPF); + if (ud->ud_wfilter != NULL) + free((caddr_t)ud->ud_wfilter, M_USBPF); + mtx_destroy(&ud->ud_mtx); +} + +/* + * Close the descriptor by detaching it from its interface, + * deallocating its buffers, and marking it free. + */ +static void +usbpf_dtor(void *data) +{ + struct usbpf_d *ud = data; + + USBPFD_LOCK(ud); + if (ud->ud_state == USBPF_WAITING) + callout_stop(&ud->ud_callout); + ud->ud_state = USBPF_IDLE; + USBPFD_UNLOCK(ud); + funsetown(&ud->ud_sigio); + mtx_lock(&usbpf_mtx); + if (ud->ud_bif) + usbpf_detachd(ud); + mtx_unlock(&usbpf_mtx); + selwakeuppri(&ud->ud_sel, PRIUSB); + knlist_destroy(&ud->ud_sel.si_note); + callout_drain(&ud->ud_callout); + usbpf_freed(ud); + free(ud, M_USBPF); +} + +/* + * Open device. Returns ENXIO for illegal minor device number, + * EBUSY if file is open by another process. + */ +/* ARGSUSED */ +static int +usbpf_open(struct cdev *dev, int flags, int fmt, struct thread *td) +{ + struct usbpf_d *ud; + int error; + + ud = malloc(sizeof(*ud), M_USBPF, M_WAITOK | M_ZERO); + error = devfs_set_cdevpriv(ud, usbpf_dtor); + if (error != 0) { + free(ud, M_USBPF); + return (error); + } + + usbpf_buffer_init(ud); + ud->ud_bufmode = USBPF_BUFMODE_BUFFER; + ud->ud_sig = SIGIO; + ud->ud_direction = USBPF_D_INOUT; + ud->ud_pid = td->td_proc->p_pid; + mtx_init(&ud->ud_mtx, devtoname(dev), "usbpf cdev lock", MTX_DEF); + callout_init_mtx(&ud->ud_callout, &ud->ud_mtx, 0); + knlist_init_mtx(&ud->ud_sel.si_note, &ud->ud_mtx); + + return (0); +} + +static int +usbpf_uiomove(struct usbpf_d *ud, caddr_t buf, u_int len, struct uio *uio) +{ + + if (ud->ud_bufmode != USBPF_BUFMODE_BUFFER) + return (EOPNOTSUPP); + return (usbpf_buffer_uiomove(ud, buf, len, uio)); +} + +/* + * usbpf_read - read next chunk of packets from buffers + */ +static int +usbpf_read(struct cdev *dev, struct uio *uio, int ioflag) +{ + struct usbpf_d *ud; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Mon Oct 11 01:01:36 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 912E41065675; Mon, 11 Oct 2010 01:01:36 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 810318FC16; Mon, 11 Oct 2010 01:01:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9B11aXZ098013; Mon, 11 Oct 2010 01:01:36 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9B11agI098011; Mon, 11 Oct 2010 01:01:36 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010110101.o9B11agI098011@svn.freebsd.org> From: Weongyo Jeong Date: Mon, 11 Oct 2010 01:01:36 +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: r213678 - user/weongyo/usb/sys/modules/usb/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, 11 Oct 2010 01:01:36 -0000 Author: weongyo Date: Mon Oct 11 01:01:36 2010 New Revision: 213678 URL: http://svn.freebsd.org/changeset/base/213678 Log: Adds usb_pf.[ch] files to Makefile. Modified: user/weongyo/usb/sys/modules/usb/usb/Makefile Modified: user/weongyo/usb/sys/modules/usb/usb/Makefile ============================================================================== --- user/weongyo/usb/sys/modules/usb/usb/Makefile Mon Oct 11 00:59:46 2010 (r213677) +++ user/weongyo/usb/sys/modules/usb/usb/Makefile Mon Oct 11 01:01:36 2010 (r213678) @@ -33,11 +33,11 @@ KMOD= usb SRCS= bus_if.h device_if.h usb_if.h usb_if.c vnode_if.h \ opt_usb.h opt_bus.h opt_ddb.h \ usbdevs.h usbdevs_data.h \ - usb_sleepout.h \ + usb_pf.h usb_sleepout.h \ usb_busdma.c usb_controller.c usb_compat_linux.c usb_core.c usb_debug.c \ usb_dev.c usb_device.c usb_dynamic.c usb_error.c usb_generic.c \ usb_handle_request.c usb_hid.c usb_hub.c usb_lookup.c usb_mbuf.c \ - usb_msctest.c usb_parse.c usb_process.c usb_request.c \ + usb_msctest.c usb_parse.c usb_pf.c usb_process.c usb_request.c \ usb_sleepout.c usb_transfer.c usb_util.c .include From owner-svn-src-user@FreeBSD.ORG Mon Oct 11 01:02:14 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 8AB1B106566B; Mon, 11 Oct 2010 01:02:14 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A90A8FC19; Mon, 11 Oct 2010 01:02:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9B12Etf098061; Mon, 11 Oct 2010 01:02:14 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9B12Ek5098059; Mon, 11 Oct 2010 01:02:14 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010110102.o9B12Ek5098059@svn.freebsd.org> From: Weongyo Jeong Date: Mon, 11 Oct 2010 01:02:14 +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: r213679 - user/weongyo/usb/sys/modules/usb/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, 11 Oct 2010 01:02:14 -0000 Author: weongyo Date: Mon Oct 11 01:02:14 2010 New Revision: 213679 URL: http://svn.freebsd.org/changeset/base/213679 Log: Removes usb_process.c that it's removed at the previous. Modified: user/weongyo/usb/sys/modules/usb/usb/Makefile Modified: user/weongyo/usb/sys/modules/usb/usb/Makefile ============================================================================== --- user/weongyo/usb/sys/modules/usb/usb/Makefile Mon Oct 11 01:01:36 2010 (r213678) +++ user/weongyo/usb/sys/modules/usb/usb/Makefile Mon Oct 11 01:02:14 2010 (r213679) @@ -37,7 +37,7 @@ SRCS= bus_if.h device_if.h usb_if.h usb_ usb_busdma.c usb_controller.c usb_compat_linux.c usb_core.c usb_debug.c \ usb_dev.c usb_device.c usb_dynamic.c usb_error.c usb_generic.c \ usb_handle_request.c usb_hid.c usb_hub.c usb_lookup.c usb_mbuf.c \ - usb_msctest.c usb_parse.c usb_pf.c usb_process.c usb_request.c \ + usb_msctest.c usb_parse.c usb_pf.c usb_request.c \ usb_sleepout.c usb_transfer.c usb_util.c .include From owner-svn-src-user@FreeBSD.ORG Mon Oct 11 01:05: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 B4A35106566B; Mon, 11 Oct 2010 01:05:42 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A41A88FC15; Mon, 11 Oct 2010 01:05: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 o9B15gbl098159; Mon, 11 Oct 2010 01:05:42 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9B15gcW098156; Mon, 11 Oct 2010 01:05:42 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010110105.o9B15gcW098156@svn.freebsd.org> From: Weongyo Jeong Date: Mon, 11 Oct 2010 01:05: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: r213680 - user/weongyo/usb/sys/dev/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, 11 Oct 2010 01:05:42 -0000 Author: weongyo Date: Mon Oct 11 01:05:42 2010 New Revision: 213680 URL: http://svn.freebsd.org/changeset/base/213680 Log: style(9) Modified: user/weongyo/usb/sys/dev/usb/usb_pf.c user/weongyo/usb/sys/dev/usb/usb_pf.h Modified: user/weongyo/usb/sys/dev/usb/usb_pf.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_pf.c Mon Oct 11 01:02:14 2010 (r213679) +++ user/weongyo/usb/sys/dev/usb/usb_pf.c Mon Oct 11 01:05:42 2010 (r213680) @@ -74,18 +74,18 @@ MALLOC_DEFINE(M_USBPF, "USBPktFilter", " } while (0) #ifndef __i386__ -#define USBPF_ALIGN +#define USBPF_ALIGN #endif #ifndef USBPF_ALIGN -#define USBPF_EXTRACT_SHORT(p) ((u_int16_t)ntohs(*(u_int16_t *)p)) -#define USBPF_EXTRACT_LONG(p) (ntohl(*(u_int32_t *)p)) +#define USBPF_EXTRACT_SHORT(p) ((u_int16_t)ntohs(*(u_int16_t *)p)) +#define USBPF_EXTRACT_LONG(p) (ntohl(*(u_int32_t *)p)) #else -#define USBPF_EXTRACT_SHORT(p) \ +#define USBPF_EXTRACT_SHORT(p) \ ((u_int16_t) \ ((u_int16_t)*((u_char *)p+0)<<8| \ (u_int16_t)*((u_char *)p+1)<<0)) -#define USBPF_EXTRACT_LONG(p) \ +#define USBPF_EXTRACT_LONG(p) \ ((u_int32_t)*((u_char *)p+0)<<24| \ (u_int32_t)*((u_char *)p+1)<<16| \ (u_int32_t)*((u_char *)p+2)<<8| \ @@ -97,7 +97,7 @@ MALLOC_DEFINE(M_USBPF, "USBPktFilter", " */ /* instruction classes */ -#define USBPF_CLASS(code) ((code) & 0x07) +#define USBPF_CLASS(code) ((code) & 0x07) #define USBPF_LD 0x00 #define USBPF_LDX 0x01 #define USBPF_ST 0x02 @@ -108,11 +108,11 @@ MALLOC_DEFINE(M_USBPF, "USBPktFilter", " #define USBPF_MISC 0x07 /* ld/ldx fields */ -#define USBPF_SIZE(code) ((code) & 0x18) +#define USBPF_SIZE(code) ((code) & 0x18) #define USBPF_W 0x00 #define USBPF_H 0x08 #define USBPF_B 0x10 -#define USBPF_MODE(code) ((code) & 0xe0) +#define USBPF_MODE(code) ((code) & 0xe0) #define USBPF_IMM 0x00 #define USBPF_ABS 0x20 #define USBPF_IND 0x40 @@ -121,7 +121,7 @@ MALLOC_DEFINE(M_USBPF, "USBPktFilter", " #define USBPF_MSH 0xa0 /* alu/jmp fields */ -#define USBPF_OP(code) ((code) & 0xf0) +#define USBPF_OP(code) ((code) & 0xf0) #define USBPF_ADD 0x00 #define USBPF_SUB 0x10 #define USBPF_MUL 0x20 @@ -136,28 +136,28 @@ MALLOC_DEFINE(M_USBPF, "USBPktFilter", " #define USBPF_JGT 0x20 #define USBPF_JGE 0x30 #define USBPF_JSET 0x40 -#define USBPF_SRC(code) ((code) & 0x08) +#define USBPF_SRC(code) ((code) & 0x08) #define USBPF_K 0x00 #define USBPF_X 0x08 /* ret - USBPF_K and USBPF_X also apply */ -#define USBPF_RVAL(code) ((code) & 0x18) +#define USBPF_RVAL(code) ((code) & 0x18) #define USBPF_A 0x10 /* misc */ -#define USBPF_MISCOP(code) ((code) & 0xf8) +#define USBPF_MISCOP(code) ((code) & 0xf8) #define USBPF_TAX 0x00 #define USBPF_TXA 0x80 /* * Number of scratch memory words (for USBPF_LD|USBPF_MEM and USBPF_ST). */ -#define USBPF_MEMWORDS 16 +#define USBPF_MEMWORDS 16 /* Values for ud_state */ -#define USBPF_IDLE 0 /* no select in progress */ -#define USBPF_WAITING 1 /* waiting for read timeout in select */ -#define USBPF_TIMED_OUT 2 /* read timeout has expired in select */ +#define USBPF_IDLE 0 /* no select in progress */ +#define USBPF_WAITING 1 /* waiting for read timeout in select */ +#define USBPF_TIMED_OUT 2 /* read timeout has expired in select */ #define PRIUSB 26 /* interruptible */ @@ -199,10 +199,10 @@ static struct mtx usbpf_mtx; /* global static int usbpf_uifd_cnt; static int usbpf_bufsize = 4096; -#define USBPF_MINBUFSIZE 32 -#define USBPF_MAXBUFSIZE 0x80000 +#define USBPF_MINBUFSIZE 32 +#define USBPF_MAXBUFSIZE 0x80000 static int usbpf_maxbufsize = USBPF_MAXBUFSIZE; -#define USBPF_MAXINSNS 512 +#define USBPF_MAXINSNS 512 static int usbpf_maxinsns = USBPF_MAXINSNS; static void @@ -379,7 +379,7 @@ usbpf_validate(const struct usbpf_insn * } #ifdef _KERNEL -#define MINDEX(m, k) \ +#define MINDEX(m, k) \ { \ register int len = m->m_len; \ \ @@ -1508,8 +1508,8 @@ usbpf_buf_reclaimed(struct usbpf_d *ud) * Alignment macros. USBPF_WORDALIGN rounds up to the next * even multiple of USBPF_ALIGNMENT. */ -#define USBPF_ALIGNMENT sizeof(long) -#define USBPF_WORDALIGN(x) (((x)+(USBPF_ALIGNMENT-1))&~(USBPF_ALIGNMENT-1)) +#define USBPF_ALIGNMENT sizeof(long) +#define USBPF_WORDALIGN(x) (((x)+(USBPF_ALIGNMENT-1))&~(USBPF_ALIGNMENT-1)) #define SIZEOF_USBPF_HDR(type) \ (offsetof(type, uh_hdrlen) + sizeof(((type *)0)->uh_hdrlen)) Modified: user/weongyo/usb/sys/dev/usb/usb_pf.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_pf.h Mon Oct 11 01:02:14 2010 (r213679) +++ user/weongyo/usb/sys/dev/usb/usb_pf.h Mon Oct 11 01:05:42 2010 (r213680) @@ -77,14 +77,14 @@ struct usbpf_d { caddr_t ud_sbuf; /* store slot */ caddr_t ud_hbuf; /* hold slot */ caddr_t ud_fbuf; /* free slot */ - int ud_slen; /* current length of store buffer */ - int ud_hlen; /* current length of hold buffer */ + int ud_slen; /* current length of store buffer */ + int ud_hlen; /* current length of hold buffer */ int ud_bufsize; /* absolute length of buffers */ struct usbpf_if *ud_bif; /* interface descriptor */ u_long ud_rtout; /* Read timeout in 'ticks' */ - struct usbpf_insn *ud_rfilter; /* read filter code */ + struct usbpf_insn *ud_rfilter; /* read filter code */ struct usbpf_insn *ud_wfilter; /* write filter code */ void *ud_bfilter; /* binary filter code */ u_int64_t ud_rcount; /* number of packets received */ @@ -115,9 +115,9 @@ struct usbpf_d { u_char ud_compat32; /* 32-bit stream on LP64 system */ }; -#define USBPFD_LOCK(ud) mtx_lock(&(ud)->ud_mtx) -#define USBPFD_UNLOCK(ud) mtx_unlock(&(ud)->ud_mtx) -#define USBPFD_LOCK_ASSERT(ud) mtx_assert(&(ud)->ud_mtx, MA_OWNED) +#define USBPFD_LOCK(ud) mtx_lock(&(ud)->ud_mtx) +#define USBPFD_UNLOCK(ud) mtx_unlock(&(ud)->ud_mtx) +#define USBPFD_LOCK_ASSERT(ud) mtx_assert(&(ud)->ud_mtx, MA_OWNED) /* * Descriptor associated with each attached hardware interface. @@ -130,8 +130,8 @@ struct usbpf_if { struct mtx uif_mtx; /* mutex for interface */ }; -#define USBPFIF_LOCK(uif) mtx_lock(&(uif)->uif_mtx) -#define USBPFIF_UNLOCK(uif) mtx_unlock(&(uif)->uif_mtx) +#define USBPFIF_LOCK(uif) mtx_lock(&(uif)->uif_mtx) +#define USBPFIF_UNLOCK(uif) mtx_unlock(&(uif)->uif_mtx) /* * Structure prepended to each packet. From owner-svn-src-user@FreeBSD.ORG Mon Oct 11 15:48:09 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 076B9106566C; Mon, 11 Oct 2010 15:48:09 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe04.swip.net [212.247.154.97]) by mx1.freebsd.org (Postfix) with ESMTP id 1363B8FC13; Mon, 11 Oct 2010 15:48:07 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=gl0LPzB4YDQuuzpDoHYit7deEV0cOo++Sg28kyvF6vg= c=1 sm=1 a=N5aUfcWtHcIA:10 a=N659UExz7-8A:10 a=Zf7CodC7etEA:10 a=A6tapMhSE0WbTaevTJclhA==:17 a=6I5d2MoRAAAA:8 a=uj5t8jSYDI0O7PI8wr8A:9 a=zh3xPsqSVAV-36oP9k8A:7 a=92FE7BRcOKfeC6kiaR6y_2eCYYAA:4 a=pILNOxqGKmIA:10 a=23Q-8MAu2lu-WsR3:21 a=XcIZEEAUDFbn3qW9:21 a=A6tapMhSE0WbTaevTJclhA==:117 Received: from [188.126.198.168] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe04.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 33625312; Mon, 11 Oct 2010 17:38:04 +0200 From: Hans Petter Selasky To: Weongyo Jeong Date: Mon, 11 Oct 2010 17:39:25 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.1-STABLE; KDE/4.4.5; amd64; ; ) References: <201010080152.o981q1gJ074407@svn.freebsd.org> In-Reply-To: <201010080152.o981q1gJ074407@svn.freebsd.org> X-Face: +~\`s("[*|O,="7?X@L.elg*F"OA\I/3%^p8g?ab%RN'(; _IjlA: hGE..Ew, XAQ*o#\/M~SC=S1-f9{EzRfT'|Hhll5Q]ha5Bt-s|oTlKMusi:1e[wJl}kd}GR Z0adGx-x_0zGbZj'e(Y[(UNle~)8CQWXW@:DX+9)_YlB[tIccCPN$7/L' MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201010111739.25082.hselasky@c2i.net> Cc: "src-committers@freebsd.org" , "svn-src-user@freebsd.org" Subject: Re: svn commit: r213540 - user/weongyo/usb/sys/dev/usb/net 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, 11 Oct 2010 15:48:09 -0000 On Friday 08 October 2010 03:52:01 Weongyo Jeong wrote: > Author: weongyo > Date: Fri Oct 8 01:52:01 2010 > New Revision: 213540 > URL: http://svn.freebsd.org/changeset/base/213540 > > Log: > o fixes a regression that setting the promiscuous mode should be > happened at the taskqueue. It's to avoid a `sleepable after > non-sleepable' because ioctl handler could be called with holding bpf > mtx which is a default mutex. > o defines SLEEPOUT_DRAIN_TASK helper. > > Modified: > user/weongyo/usb/sys/dev/usb/net/if_aue.c > user/weongyo/usb/sys/dev/usb/net/if_auereg.h > user/weongyo/usb/sys/dev/usb/net/if_axe.c > user/weongyo/usb/sys/dev/usb/net/if_axereg.h > user/weongyo/usb/sys/dev/usb/net/if_cue.c > user/weongyo/usb/sys/dev/usb/net/if_cuereg.h > user/weongyo/usb/sys/dev/usb/net/if_kue.c > user/weongyo/usb/sys/dev/usb/net/if_rue.c > user/weongyo/usb/sys/dev/usb/net/if_ruereg.h > user/weongyo/usb/sys/dev/usb/net/if_udav.c > user/weongyo/usb/sys/dev/usb/net/if_udavreg.h > > Modified: user/weongyo/usb/sys/dev/usb/net/if_aue.c > =========================================================================== > === --- user/weongyo/usb/sys/dev/usb/net/if_aue.c Fri Oct 8 01:47:14 > 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_aue.c Fri Oct 8 > 01:52:01 2010 (r213540) @@ -230,7 +230,8 @@ static > void aue_setmulti_locked(struct a > static void aue_rxflush(struct aue_softc *); > static int aue_rxbuf(struct aue_softc *, struct usb_page_cache *, > unsigned int, unsigned int); > -static void aue_setpromisc(struct aue_softc *); > +static void aue_setpromisc(void *, int); > +static void aue_setpromisc_locked(struct aue_softc *); > static void aue_init_locked(struct aue_softc *); > static void aue_watchdog(void *); > > @@ -709,6 +710,7 @@ aue_attach(device_t dev) > sleepout_create(&sc->sc_sleepout, "aue sleepout"); > sleepout_init_mtx(&sc->sc_sleepout, &sc->sc_watchdog, &sc->sc_mtx, 0); > TASK_INIT(&sc->sc_setmulti, 0, aue_setmulti, sc); > + TASK_INIT(&sc->sc_setpromisc, 0, aue_setpromisc, sc); > > iface_index = AUE_IFACE_IDX; > error = usbd_transfer_setup(uaa->device, &iface_index, > @@ -764,7 +766,8 @@ aue_detach(device_t dev) > struct ifnet *ifp = sc->sc_ifp; > > sleepout_drain(&sc->sc_watchdog); > - taskqueue_drain(sc->sc_sleepout.s_taskqueue, &sc->sc_setmulti); > + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setpromisc); > + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); > usbd_transfer_unsetup(sc->sc_xfer, AUE_N_TRANSFER); > > if (sc->sc_miibus != NULL) > @@ -1032,7 +1035,7 @@ aue_init_locked(struct aue_softc *sc) > aue_csr_write_1(sc, AUE_PAR0 + i, IF_LLADDR(ifp)[i]); > > /* update promiscuous setting */ > - aue_setpromisc(sc); > + aue_setpromisc_locked(sc); > > /* Load the multicast filter. */ > aue_setmulti_locked(sc); > @@ -1050,7 +1053,17 @@ aue_init_locked(struct aue_softc *sc) > } > > static void > -aue_setpromisc(struct aue_softc *sc) > +aue_setpromisc(void *arg, int npending) > +{ > + struct aue_softc *sc = arg; > + > + AUE_LOCK(sc); > + aue_setpromisc_locked(sc); > + AUE_UNLOCK(sc); > +} > + > +static void > +aue_setpromisc_locked(struct aue_softc *sc) > { > struct ifnet *ifp = sc->sc_ifp; > > @@ -1140,7 +1153,8 @@ aue_ioctl(struct ifnet *ifp, u_long comm > AUE_LOCK(sc); > if (ifp->if_flags & IFF_UP) { > if (ifp->if_drv_flags & IFF_DRV_RUNNING) > - aue_setpromisc(sc); > + SLEEPOUT_RUN_TASK(&sc->sc_sleepout, > + &sc->sc_setpromisc); > else > aue_init_locked(sc); > } else > > Modified: user/weongyo/usb/sys/dev/usb/net/if_auereg.h > =========================================================================== > === --- user/weongyo/usb/sys/dev/usb/net/if_auereg.h Fri Oct 8 01:47:14 > 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_auereg.h Fri Oct 8 > 01:52:01 2010 (r213540) @@ -222,6 +222,7 @@ struct aue_softc { > struct sleepout sc_sleepout; > struct sleepout_task sc_watchdog; > struct task sc_setmulti; > + struct task sc_setpromisc; > }; > > #define AUE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) > > Modified: user/weongyo/usb/sys/dev/usb/net/if_axe.c > =========================================================================== > === --- user/weongyo/usb/sys/dev/usb/net/if_axe.c Fri Oct 8 01:47:14 > 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_axe.c Fri Oct 8 > 01:52:01 2010 (r213540) @@ -206,6 +206,8 @@ static > void axe_start_locked(struct ifne > static void axe_tick(struct axe_softc *); > static void axe_stop(struct axe_softc *); > static void axe_setmulti_locked(struct axe_softc *); > +static void axe_setpromisc(void *, int); > +static void axe_setpromisc_locked(struct axe_softc *); > > static const struct usb_config axe_config[AXE_N_TRANSFER] = { > [AXE_BULK_DT_WR] = { > @@ -787,6 +789,7 @@ axe_attach(device_t dev) > sleepout_create(&sc->sc_sleepout, "axe sleepout"); > sleepout_init_mtx(&sc->sc_sleepout, &sc->sc_watchdog, &sc->sc_mtx, 0); > TASK_INIT(&sc->sc_setmulti, 0, axe_setmulti, sc); > + TASK_INIT(&sc->sc_setpromisc, 0, axe_setpromisc, sc); > > iface_index = AXE_IFACE_IDX; > error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, > @@ -846,7 +849,8 @@ axe_detach(device_t dev) > struct ifnet *ifp = sc->sc_ifp; > > sleepout_drain(&sc->sc_watchdog); > - taskqueue_drain(sc->sc_sleepout.s_taskqueue, &sc->sc_setmulti); > + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setpromisc); > + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); > usbd_transfer_unsetup(sc->sc_xfer, AXE_N_TRANSFER); > > if (sc->sc_miibus != NULL) > @@ -1232,7 +1236,17 @@ axe_init_locked(struct axe_softc *sc) > } > > static void > -axe_setpromisc(struct axe_softc *sc) > +axe_setpromisc(void *arg, int npending) > +{ > + struct axe_softc *sc = arg; > + > + AXE_LOCK(sc); > + axe_setpromisc_locked(sc); > + AXE_UNLOCK(sc); > +} > + > +static void > +axe_setpromisc_locked(struct axe_softc *sc) > { > struct ifnet *ifp = sc->sc_ifp; > uint16_t rxmode; > @@ -1286,7 +1300,8 @@ axe_ioctl(struct ifnet *ifp, u_long comm > AXE_LOCK(sc); > if (ifp->if_flags & IFF_UP) { > if (ifp->if_drv_flags & IFF_DRV_RUNNING) > - axe_setpromisc(sc); > + SLEEPOUT_RUN_TASK(&sc->sc_sleepout, > + &sc->sc_setpromisc); > else > axe_init_locked(sc); > } else > > Modified: user/weongyo/usb/sys/dev/usb/net/if_axereg.h > =========================================================================== > === --- user/weongyo/usb/sys/dev/usb/net/if_axereg.h Fri Oct 8 01:47:14 > 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_axereg.h Fri Oct 8 > 01:52:01 2010 (r213540) @@ -210,6 +210,7 @@ struct axe_softc { > struct sleepout sc_sleepout; > struct sleepout_task sc_watchdog; > struct task sc_setmulti; > + struct task sc_setpromisc; > > int sc_phyno; > int sc_flags; > > Modified: user/weongyo/usb/sys/dev/usb/net/if_cue.c > =========================================================================== > === --- user/weongyo/usb/sys/dev/usb/net/if_cue.c Fri Oct 8 01:47:14 > 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_cue.c Fri Oct 8 > 01:52:01 2010 (r213540) @@ -131,6 +131,8 @@ static int cue_rxbuf(struct > cue_softc *, > static void cue_rxflush(struct cue_softc *); > static void cue_stop(struct cue_softc *); > static void cue_watchdog(void *); > +static void cue_setpromisc(void *, int); > +static void cue_setpromisc_locked(struct cue_softc *); > > #ifdef USB_DEBUG > static int cue_debug = 0; > @@ -286,7 +288,17 @@ cue_mchash(const uint8_t *addr) > } > > static void > -cue_setpromisc(struct cue_softc *sc) > +cue_setpromisc(void *arg, int npending) > +{ > + struct cue_softc *sc = arg; > + > + CUE_LOCK(sc); > + cue_setpromisc_locked(sc); > + CUE_UNLOCK(sc); > +} > + > +static void > +cue_setpromisc_locked(struct cue_softc *sc) > { > struct ifnet *ifp = sc->sc_ifp; > > @@ -406,6 +418,7 @@ cue_attach(device_t dev) > mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); > sleepout_create(&sc->sc_sleepout, "cue sleepout"); > sleepout_init_mtx(&sc->sc_sleepout, &sc->sc_watchdog, &sc->sc_mtx, 0); > + TASK_INIT(&sc->sc_setpromisc, 0, cue_setpromisc, sc); > TASK_INIT(&sc->sc_setmulti, 0, cue_setmulti, sc); > > iface_index = CUE_IFACE_IDX; > @@ -454,7 +467,8 @@ cue_detach(device_t dev) > struct ifnet *ifp = sc->sc_ifp; > > sleepout_drain(&sc->sc_watchdog); > - taskqueue_drain(sc->sc_sleepout.s_taskqueue, &sc->sc_setmulti); > + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setpromisc); > + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); > usbd_transfer_unsetup(sc->sc_xfer, CUE_N_TRANSFER); > if (ifp != NULL) { > CUE_LOCK(sc); > @@ -643,7 +657,7 @@ cue_init_locked(struct cue_softc *sc) > cue_csr_write_1(sc, CUE_ETHCTL, CUE_ETHCTL_RX_ON | CUE_ETHCTL_MCAST_ON); > > /* Load the multicast filter */ > - cue_setpromisc(sc); > + cue_setpromisc_locked(sc); > > /* > * Set the number of RX and TX buffers that we want > @@ -766,7 +780,8 @@ cue_ioctl(struct ifnet *ifp, u_long comm > CUE_LOCK(sc); > if (ifp->if_flags & IFF_UP) { > if (ifp->if_drv_flags & IFF_DRV_RUNNING) > - cue_setpromisc(sc); > + SLEEPOUT_RUN_TASK(&sc->sc_sleepout, > + &sc->sc_setpromisc); > else > cue_init_locked(sc); > } else > > Modified: user/weongyo/usb/sys/dev/usb/net/if_cuereg.h > =========================================================================== > === --- user/weongyo/usb/sys/dev/usb/net/if_cuereg.h Fri Oct 8 01:47:14 > 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_cuereg.h Fri Oct 8 > 01:52:01 2010 (r213540) @@ -126,6 +126,7 @@ struct cue_softc { > struct usb_xfer *sc_xfer[CUE_N_TRANSFER]; > struct sleepout sc_sleepout; > struct sleepout_task sc_watchdog; > + struct task sc_setpromisc; > struct task sc_setmulti; > struct ifqueue sc_rxq; > /* ethernet address from eeprom */ > > Modified: user/weongyo/usb/sys/dev/usb/net/if_kue.c > =========================================================================== > === --- user/weongyo/usb/sys/dev/usb/net/if_kue.c Fri Oct 8 01:47:14 > 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_kue.c Fri Oct 8 > 01:52:01 2010 (r213540) @@ -527,7 +527,7 @@ kue_detach(device_t dev) > struct kue_softc *sc = device_get_softc(dev); > struct ifnet *ifp = sc->sc_ifp; > > - taskqueue_drain(sc->sc_sleepout.s_taskqueue, &sc->sc_setmulti); > + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); > usbd_transfer_unsetup(sc->sc_xfer, KUE_N_TRANSFER); > if (ifp != NULL) { > KUE_LOCK(sc); > > Modified: user/weongyo/usb/sys/dev/usb/net/if_rue.c > =========================================================================== > === --- user/weongyo/usb/sys/dev/usb/net/if_rue.c Fri Oct 8 01:47:14 > 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_rue.c Fri Oct 8 > 01:52:01 2010 (r213540) @@ -160,6 +160,8 @@ static void rue_start(struct > ifnet *); > static void rue_start_locked(struct ifnet *); > static void rue_stop(struct rue_softc *); > static void rue_watchdog(void *); > +static void rue_setpromisc(void *, int); > +static void rue_setpromisc_locked(struct rue_softc *); > > static const struct usb_config rue_config[RUE_N_TRANSFER] = { > [RUE_BULK_DT_WR] = { > @@ -451,7 +453,17 @@ rue_miibus_statchg(device_t dev) > } > > static void > -rue_setpromisc(struct rue_softc *sc) > +rue_setpromisc(void *arg, int npending) > +{ > + struct rue_softc *sc = arg; > + > + RUE_LOCK(sc); > + rue_setpromisc_locked(sc); > + RUE_UNLOCK(sc); > +} > + > +static void > +rue_setpromisc_locked(struct rue_softc *sc) > { > struct ifnet *ifp = sc->sc_ifp; > > @@ -588,6 +600,7 @@ rue_attach(device_t dev) > mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); > sleepout_create(&sc->sc_sleepout, "rue sleepout"); > sleepout_init_mtx(&sc->sc_sleepout, &sc->sc_watchdog, &sc->sc_mtx, 0); > + TASK_INIT(&sc->sc_setpromisc, 0, rue_setpromisc, sc); > TASK_INIT(&sc->sc_setmulti, 0, rue_setmulti, sc); > > iface_index = RUE_IFACE_IDX; > @@ -644,7 +657,8 @@ rue_detach(device_t dev) > struct ifnet *ifp = sc->sc_ifp; > > sleepout_drain(&sc->sc_watchdog); > - taskqueue_drain(sc->sc_sleepout.s_taskqueue, &sc->sc_setmulti); > + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setpromisc); > + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); > usbd_transfer_unsetup(sc->sc_xfer, RUE_N_TRANSFER); > if (sc->sc_miibus != NULL) > device_delete_child(sc->sc_dev, sc->sc_miibus); > @@ -957,7 +971,7 @@ rue_init_locked(struct rue_softc *sc) > rue_csr_write_2(sc, RUE_RCR, RUE_RCR_CONFIG|RUE_RCR_AB); > > /* Load the multicast filter */ > - rue_setpromisc(sc); > + rue_setpromisc_locked(sc); > /* Load the multicast filter. */ > rue_setmulti(sc, 0); > > @@ -1044,7 +1058,8 @@ rue_ioctl(struct ifnet *ifp, u_long comm > RUE_LOCK(sc); > if (ifp->if_flags & IFF_UP) { > if (ifp->if_drv_flags & IFF_DRV_RUNNING) > - rue_setpromisc(sc); > + SLEEPOUT_RUN_TASK(&sc->sc_sleepout, > + &sc->sc_setpromisc); > else > rue_init_locked(sc); > } else > > Modified: user/weongyo/usb/sys/dev/usb/net/if_ruereg.h > =========================================================================== > === --- user/weongyo/usb/sys/dev/usb/net/if_ruereg.h Fri Oct 8 01:47:14 > 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_ruereg.h Fri Oct 8 > 01:52:01 2010 (r213540) @@ -178,6 +178,7 @@ struct rue_softc { > struct usb_xfer *sc_xfer[RUE_N_TRANSFER]; > struct sleepout sc_sleepout; > struct sleepout_task sc_watchdog; > + struct task sc_setpromisc; > struct task sc_setmulti; > struct ifqueue sc_rxq; > /* ethernet address from eeprom */ > > Modified: user/weongyo/usb/sys/dev/usb/net/if_udav.c > =========================================================================== > === --- user/weongyo/usb/sys/dev/usb/net/if_udav.c Fri Oct 8 01:47:14 > 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_udav.c Fri Oct 8 > 01:52:01 2010 (r213540) @@ -116,7 +116,8 @@ static void udav_start(struct > ifnet *); > static void udav_start_locked(struct ifnet *); > static void udav_setmulti(void *, int); > static void udav_stop(struct udav_softc *); > -static void udav_setpromisc(struct udav_softc *); > +static void udav_setpromisc(void *, int); > +static void udav_setpromisc_locked(struct udav_softc *); > static void udav_watchdog(void *); > > static miibus_readreg_t udav_miibus_readreg; > @@ -250,6 +251,7 @@ udav_attach(device_t dev) > sleepout_create(&sc->sc_sleepout, "axe sleepout"); > sleepout_init_mtx(&sc->sc_sleepout, &sc->sc_watchdog, &sc->sc_mtx, 0); > TASK_INIT(&sc->sc_setmulti, 0, udav_setmulti, sc); > + TASK_INIT(&sc->sc_setpromisc, 0, udav_setpromisc, sc); > > iface_index = UDAV_IFACE_INDEX; > error = usbd_transfer_setup(uaa->device, &iface_index, > @@ -304,7 +306,8 @@ udav_detach(device_t dev) > struct ifnet *ifp = sc->sc_ifp; > > sleepout_drain(&sc->sc_watchdog); > - taskqueue_drain(sc->sc_sleepout.s_taskqueue, &sc->sc_setmulti); > + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setpromisc); > + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); > usbd_transfer_unsetup(sc->sc_xfer, UDAV_N_TRANSFER); > > if (sc->sc_miibus != NULL) > @@ -469,7 +472,7 @@ udav_init_locked(struct udav_softc *sc) > UDAV_SETBIT(sc, UDAV_RCR, UDAV_RCR_DIS_LONG | UDAV_RCR_DIS_CRC); > > /* load multicast filter and update promiscious mode bit */ > - udav_setpromisc(sc); > + udav_setpromisc_locked(sc); > > /* enable RX */ > UDAV_SETBIT(sc, UDAV_RCR, UDAV_RCR_RXEN); > @@ -557,7 +560,17 @@ udav_setmulti(void *arg, int npending) > } > > static void > -udav_setpromisc(struct udav_softc *sc) > +udav_setpromisc(void *arg, int npending) > +{ > + struct udav_softc *sc = arg; > + > + UDAV_LOCK(sc); > + udav_setpromisc_locked(sc); > + UDAV_UNLOCK(sc); > +} > + > +static void > +udav_setpromisc_locked(struct udav_softc *sc) > { > struct ifnet *ifp = sc->sc_ifp; > uint8_t rxmode; > @@ -982,7 +995,8 @@ udav_ioctl(struct ifnet *ifp, u_long com > UDAV_LOCK(sc); > if (ifp->if_flags & IFF_UP) { > if (ifp->if_drv_flags & IFF_DRV_RUNNING) > - udav_setpromisc(sc); > + SLEEPOUT_RUN_TASK(&sc->sc_sleepout, > + &sc->sc_setpromisc); > else > udav_init_locked(sc); > } else > > Modified: user/weongyo/usb/sys/dev/usb/net/if_udavreg.h > =========================================================================== > === --- user/weongyo/usb/sys/dev/usb/net/if_udavreg.h Fri Oct 8 01:47:14 > 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_udavreg.h Fri Oct > 8 01:52:01 2010 (r213540) @@ -161,6 +161,7 @@ struct udav_softc { > struct sleepout sc_sleepout; > struct sleepout_task sc_watchdog; > struct task sc_setmulti; > + struct task sc_setpromisc; > struct ifqueue sc_rxq; > /* ethernet address from eeprom */ > uint8_t sc_eaddr[ETHER_ADDR_LEN]; These taskqueues belong in the network stack and not the USB drivers! And please understand that you cannot use taskqueues for these commands, because the events can be executed out of order!!! --HPS From owner-svn-src-user@FreeBSD.ORG Mon Oct 11 16:45:03 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 AF157106564A; Mon, 11 Oct 2010 16:45:03 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from out-0.mx.aerioconnect.net (out-0-24.mx.aerioconnect.net [216.240.47.84]) by mx1.freebsd.org (Postfix) with ESMTP id 8C6268FC12; Mon, 11 Oct 2010 16:45:03 +0000 (UTC) Received: from idiom.com (postfix@mx0.idiom.com [216.240.32.160]) by out-0.mx.aerioconnect.net (8.13.8/8.13.8) with ESMTP id o9BGR4at020055; Mon, 11 Oct 2010 09:27:05 -0700 X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (h-67-100-89-137.snfccasy.static.covad.net [67.100.89.137]) by idiom.com (Postfix) with ESMTP id 9607D2D6018; Mon, 11 Oct 2010 09:27:02 -0700 (PDT) Message-ID: <4CB33B04.8070609@freebsd.org> Date: Mon, 11 Oct 2010 09:27:48 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 To: Hans Petter Selasky References: <201010080152.o981q1gJ074407@svn.freebsd.org> <201010111739.25082.hselasky@c2i.net> In-Reply-To: <201010111739.25082.hselasky@c2i.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.67 on 216.240.47.51 Cc: "src-committers@freebsd.org" , Weongyo Jeong , "svn-src-user@freebsd.org" Subject: Re: svn commit: r213540 - user/weongyo/usb/sys/dev/usb/net 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, 11 Oct 2010 16:45:03 -0000 On 10/11/10 8:39 AM, Hans Petter Selasky wrote: > On Friday 08 October 2010 03:52:01 Weongyo Jeong wrote: >> Author: weongyo >> Date: Fri Oct 8 01:52:01 2010 >> New Revision: 213540 >> URL: http://svn.freebsd.org/changeset/base/213540 >> >> Log: >> o fixes a regression that setting the promiscuous mode should be >> happened at the taskqueue. It's to avoid a `sleepable after >> non-sleepable' because ioctl handler could be called with holding bpf >> mtx which is a default mutex. >> o defines SLEEPOUT_DRAIN_TASK helper. >> [...] > These taskqueues belong in the network stack and not the USB drivers! And > please understand that you cannot use taskqueues for these commands, because > the events can be executed out of order!!! sounds like we should add an option to taskqueues to fix this then. I'd rather fix the standard facility than make a new one. > --HPS > From owner-svn-src-user@FreeBSD.ORG Mon Oct 11 20:23:00 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 1029A106566B for ; Mon, 11 Oct 2010 20:23:00 +0000 (UTC) (envelope-from weongyo.jeong@gmail.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id A66868FC08 for ; Mon, 11 Oct 2010 20:22:59 +0000 (UTC) Received: by vws1 with SMTP id 1so1543355vws.13 for ; Mon, 11 Oct 2010 13:22:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:from:date:to:cc :subject:message-id:reply-to:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent:organization:x-operation-sytem; bh=AyZ94hk+m1hd6qV/yTQsGrYYQ24q4tSqFdxKOxbEaaE=; b=Yymp5EgshY81ttST+ATyOYhCnBvQ5o4CkF0XG9+h0TAwRfD1yKJq7PelajFgckW9R6 zOQSg+eVXCIQgINJ0eTnuq6w97vJ+Gax6f2bH70L6zLoCiQEmjY4NAAigwjcmZQe+DuS WH4SIpfUKTu9bOJHQZgl1yrL33iB9hPmlHONU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:date:to:cc:subject:message-id:reply-to:mail-followup-to :references:mime-version:content-type:content-disposition :in-reply-to:user-agent:organization:x-operation-sytem; b=Tp30Xg+TlxsnBedhT+hphedUeUs2lYMhi8zyQaJGt4Va3OhbWQRNqjQABLU/tKv01C P9khtVErQJo7on1fV8zT5gPwjlv1UZCGX7gSx0A6xC97cTP/XE2B1hN0AyFA4YqlSEAJ ar485rdW+lhoZ1vIS9s+w4F+ZHGG7Z2+2gxIo= Received: by 10.220.99.141 with SMTP id u13mr1334985vcn.69.1286828118439; Mon, 11 Oct 2010 13:15:18 -0700 (PDT) Received: from weongyo ([174.35.1.224]) by mx.google.com with ESMTPS id e31sm4194571vbe.9.2010.10.11.13.15.16 (version=SSLv3 cipher=RC4-MD5); Mon, 11 Oct 2010 13:15:17 -0700 (PDT) Received: by weongyo (sSMTP sendmail emulation); Mon, 11 Oct 2010 13:15:22 -0700 From: Weongyo Jeong Date: Mon, 11 Oct 2010 13:15:22 -0700 To: Julian Elischer Message-ID: <20101011201522.GB38869@weongyo> Mail-Followup-To: Julian Elischer , Hans Petter Selasky , "src-committers@freebsd.org" , "svn-src-user@freebsd.org" References: <201010080152.o981q1gJ074407@svn.freebsd.org> <201010111739.25082.hselasky@c2i.net> <4CB33B04.8070609@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4CB33B04.8070609@freebsd.org> User-Agent: Mutt/1.4.2.3i Organization: CDNetworks. X-Operation-Sytem: FreeBSD Cc: "src-committers@freebsd.org" , "svn-src-user@freebsd.org" , Hans Petter Selasky Subject: Re: svn commit: r213540 - user/weongyo/usb/sys/dev/usb/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Weongyo Jeong 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, 11 Oct 2010 20:23:00 -0000 On Mon, Oct 11, 2010 at 09:27:48AM -0700, Julian Elischer wrote: > On 10/11/10 8:39 AM, Hans Petter Selasky wrote: > >On Friday 08 October 2010 03:52:01 Weongyo Jeong wrote: > >>Author: weongyo > >>Date: Fri Oct 8 01:52:01 2010 > >>New Revision: 213540 > >>URL: http://svn.freebsd.org/changeset/base/213540 > >> > >>Log: > >> o fixes a regression that setting the promiscuous mode should be > >> happened at the taskqueue. It's to avoid a `sleepable after > >> non-sleepable' because ioctl handler could be called with holding bpf > >> mtx which is a default mutex. > >> o defines SLEEPOUT_DRAIN_TASK helper. > >> > [...] > > >These taskqueues belong in the network stack and not the USB drivers! And > >please understand that you cannot use taskqueues for these commands, > >because > >the events can be executed out of order!!! > > sounds like we should add an option to taskqueues to fix this then. > I'd rather fix the standard facility than make a new one. I agree with you that if it really requires the extension for USB it'd be better to fix the taskqueue than reimplementing almost same thing (usb_process.[ch]). regards, Weongyo Jeong From owner-svn-src-user@FreeBSD.ORG Mon Oct 11 20:38:22 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 998C31065679 for ; Mon, 11 Oct 2010 20:38:22 +0000 (UTC) (envelope-from weongyo.jeong@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 3ECBB8FC1B for ; Mon, 11 Oct 2010 20:38:21 +0000 (UTC) Received: by qwe4 with SMTP id 4so1687174qwe.13 for ; Mon, 11 Oct 2010 13:38:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:from:date:to:cc :subject:message-id:reply-to:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent:organization:x-operation-sytem; bh=rJT96tVf8m7ECR33iQY59Jcz1gOq7HwkI+f+8rFM5qc=; b=s8u19WTfD/UZ3TTQzOgWdEB1N/Qgs7711PxpTLAvqMAaHaZWW8vaiKZ83QTHTRfdy5 ALXAnTKDOL8qzx+65+d/jxi/Sa8barDdOzo7b65dg9EGHbDzv1KPZ87qnDjuHroODBCq 2weXDv+okiOO6+PEMBVF138Pt53AvYt6UdYLw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:date:to:cc:subject:message-id:reply-to:mail-followup-to :references:mime-version:content-type:content-disposition :in-reply-to:user-agent:organization:x-operation-sytem; b=Qryzqm9Tg7D2do7KWI0J6Zm6udIiRAXsebpTvIIA8pkRm3f57FuzhEFb+tt/ZJ3FUt HeBnPzRoBoHmNuu/kagfGhwVEjMNZraKGSKIla3ouH02htRxNgb+ja/ZOS7GLKP2gvO/ vtW9tqSjIfBnzDzoh872R4ty/2+iKOlXPNvDA= Received: by 10.229.229.83 with SMTP id jh19mr5461256qcb.76.1286827721164; Mon, 11 Oct 2010 13:08:41 -0700 (PDT) Received: from weongyo ([174.35.1.224]) by mx.google.com with ESMTPS id m7sm2744148qck.13.2010.10.11.13.08.39 (version=SSLv3 cipher=RC4-MD5); Mon, 11 Oct 2010 13:08:40 -0700 (PDT) Received: by weongyo (sSMTP sendmail emulation); Mon, 11 Oct 2010 13:08:45 -0700 From: Weongyo Jeong Date: Mon, 11 Oct 2010 13:08:45 -0700 To: Hans Petter Selasky Message-ID: <20101011200845.GA38869@weongyo> Mail-Followup-To: Hans Petter Selasky , "src-committers@freebsd.org" , "svn-src-user@freebsd.org" References: <201010080152.o981q1gJ074407@svn.freebsd.org> <201010111739.25082.hselasky@c2i.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201010111739.25082.hselasky@c2i.net> User-Agent: Mutt/1.4.2.3i Organization: CDNetworks. X-Operation-Sytem: FreeBSD Cc: "src-committers@freebsd.org" , "svn-src-user@freebsd.org" Subject: Re: svn commit: r213540 - user/weongyo/usb/sys/dev/usb/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Weongyo Jeong 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, 11 Oct 2010 20:38:22 -0000 On Mon, Oct 11, 2010 at 05:39:25PM +0200, Hans Petter Selasky wrote: > On Friday 08 October 2010 03:52:01 Weongyo Jeong wrote: > > Author: weongyo > > Date: Fri Oct 8 01:52:01 2010 > > New Revision: 213540 > > URL: http://svn.freebsd.org/changeset/base/213540 > > > > Log: > > o fixes a regression that setting the promiscuous mode should be > > happened at the taskqueue. It's to avoid a `sleepable after > > non-sleepable' because ioctl handler could be called with holding bpf > > mtx which is a default mutex. > > o defines SLEEPOUT_DRAIN_TASK helper. > > > > Modified: > > user/weongyo/usb/sys/dev/usb/net/if_aue.c > > user/weongyo/usb/sys/dev/usb/net/if_auereg.h > > user/weongyo/usb/sys/dev/usb/net/if_axe.c > > user/weongyo/usb/sys/dev/usb/net/if_axereg.h > > user/weongyo/usb/sys/dev/usb/net/if_cue.c > > user/weongyo/usb/sys/dev/usb/net/if_cuereg.h > > user/weongyo/usb/sys/dev/usb/net/if_kue.c > > user/weongyo/usb/sys/dev/usb/net/if_rue.c > > user/weongyo/usb/sys/dev/usb/net/if_ruereg.h > > user/weongyo/usb/sys/dev/usb/net/if_udav.c > > user/weongyo/usb/sys/dev/usb/net/if_udavreg.h > > > > Modified: user/weongyo/usb/sys/dev/usb/net/if_aue.c > > =========================================================================== > > === --- user/weongyo/usb/sys/dev/usb/net/if_aue.c Fri Oct 8 01:47:14 > > 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_aue.c Fri Oct 8 > > 01:52:01 2010 (r213540) @@ -230,7 +230,8 @@ static > > void aue_setmulti_locked(struct a > > static void aue_rxflush(struct aue_softc *); > > static int aue_rxbuf(struct aue_softc *, struct usb_page_cache *, > > unsigned int, unsigned int); > > -static void aue_setpromisc(struct aue_softc *); > > +static void aue_setpromisc(void *, int); > > +static void aue_setpromisc_locked(struct aue_softc *); > > static void aue_init_locked(struct aue_softc *); > > static void aue_watchdog(void *); > > > > @@ -709,6 +710,7 @@ aue_attach(device_t dev) > > sleepout_create(&sc->sc_sleepout, "aue sleepout"); > > sleepout_init_mtx(&sc->sc_sleepout, &sc->sc_watchdog, &sc->sc_mtx, 0); > > TASK_INIT(&sc->sc_setmulti, 0, aue_setmulti, sc); > > + TASK_INIT(&sc->sc_setpromisc, 0, aue_setpromisc, sc); > > > > iface_index = AUE_IFACE_IDX; > > error = usbd_transfer_setup(uaa->device, &iface_index, > > @@ -764,7 +766,8 @@ aue_detach(device_t dev) > > struct ifnet *ifp = sc->sc_ifp; > > > > sleepout_drain(&sc->sc_watchdog); > > - taskqueue_drain(sc->sc_sleepout.s_taskqueue, &sc->sc_setmulti); > > + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setpromisc); > > + SLEEPOUT_DRAIN_TASK(&sc->sc_sleepout, &sc->sc_setmulti); > > usbd_transfer_unsetup(sc->sc_xfer, AUE_N_TRANSFER); > > > > if (sc->sc_miibus != NULL) > > @@ -1032,7 +1035,7 @@ aue_init_locked(struct aue_softc *sc) > > aue_csr_write_1(sc, AUE_PAR0 + i, IF_LLADDR(ifp)[i]); > > > > /* update promiscuous setting */ > > - aue_setpromisc(sc); > > + aue_setpromisc_locked(sc); > > > > /* Load the multicast filter. */ > > aue_setmulti_locked(sc); > > @@ -1050,7 +1053,17 @@ aue_init_locked(struct aue_softc *sc) > > } > > > > static void > > -aue_setpromisc(struct aue_softc *sc) > > +aue_setpromisc(void *arg, int npending) > > +{ > > + struct aue_softc *sc = arg; > > + > > + AUE_LOCK(sc); > > + aue_setpromisc_locked(sc); > > + AUE_UNLOCK(sc); > > +} > > + > > +static void > > +aue_setpromisc_locked(struct aue_softc *sc) > > { > > struct ifnet *ifp = sc->sc_ifp; > > > > @@ -1140,7 +1153,8 @@ aue_ioctl(struct ifnet *ifp, u_long comm > > AUE_LOCK(sc); > > if (ifp->if_flags & IFF_UP) { > > if (ifp->if_drv_flags & IFF_DRV_RUNNING) > > - aue_setpromisc(sc); > > + SLEEPOUT_RUN_TASK(&sc->sc_sleepout, > > + &sc->sc_setpromisc); > > else > > aue_init_locked(sc); > > } else > > > > Modified: user/weongyo/usb/sys/dev/usb/net/if_auereg.h > > =========================================================================== > > === --- user/weongyo/usb/sys/dev/usb/net/if_auereg.h Fri Oct 8 01:47:14 > > 2010 (r213539) +++ user/weongyo/usb/sys/dev/usb/net/if_auereg.h Fri Oct > 8 > > 01:52:01 2010 (r213540) @@ -222,6 +222,7 @@ struct aue_softc { > > struct sleepout sc_sleepout; > > struct sleepout_task sc_watchdog; > > struct task sc_setmulti; > > + struct task sc_setpromisc; > > }; > > > > #define AUE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) > > These taskqueues belong in the network stack and not the USB drivers! And No it's not in the network stack. The taskqueue is created from USB driver and it's under control. > please understand that you cannot use taskqueues for these commands, because > the events can be executed out of order!!! Please share your story with all when the events are executed out of order. I'm ready to fix it. regards, Weongyo Jeong From owner-svn-src-user@FreeBSD.ORG Wed Oct 13 02:09: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 97235106564A; Wed, 13 Oct 2010 02:09:06 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7B2FC8FC0A; Wed, 13 Oct 2010 02:09: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 o9D296qu069121; Wed, 13 Oct 2010 02:09:06 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9D296wh069117; Wed, 13 Oct 2010 02:09:06 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201010130209.o9D296wh069117@svn.freebsd.org> From: Nathan Whitehorn Date: Wed, 13 Oct 2010 02:09: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: r213757 - in user/nwhitehorn/ps3/powerpc: aim booke powerpc 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: Wed, 13 Oct 2010 02:09:06 -0000 Author: nwhitehorn Date: Wed Oct 13 02:09:06 2010 New Revision: 213757 URL: http://svn.freebsd.org/changeset/base/213757 Log: Unify Book-E/AIM mem_valid() implementation in terms of the platform-specific mem_regions() routine. Modified: user/nwhitehorn/ps3/powerpc/aim/ofw_machdep.c user/nwhitehorn/ps3/powerpc/booke/machdep.c user/nwhitehorn/ps3/powerpc/powerpc/platform.c Modified: user/nwhitehorn/ps3/powerpc/aim/ofw_machdep.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/aim/ofw_machdep.c Wed Oct 13 00:57:14 2010 (r213756) +++ user/nwhitehorn/ps3/powerpc/aim/ofw_machdep.c Wed Oct 13 02:09:06 2010 (r213757) @@ -367,7 +367,7 @@ OF_bootstrap() * background processes. */ ofw_quiesce(); - } else { + } else if (fdt != NULL) { ofw_real_mode = 1; /* XXX: don't use special virt mode code */ status = OF_install(OFW_FDT, 0); @@ -693,16 +693,3 @@ OF_decode_addr(phandle_t dev, int regno, return (bus_space_map(*tag, addr, size, 0, handle)); } -int -mem_valid(vm_offset_t addr, int len) -{ - int i; - - for (i = 0; i < nOFmem; i++) - if ((addr >= OFmem[i].mr_start) - && (addr + len < OFmem[i].mr_start + OFmem[i].mr_size)) - return (0); - - return (EFAULT); -} - Modified: user/nwhitehorn/ps3/powerpc/booke/machdep.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/booke/machdep.c Wed Oct 13 00:57:14 2010 (r213756) +++ user/nwhitehorn/ps3/powerpc/booke/machdep.c Wed Oct 13 02:09:06 2010 (r213757) @@ -591,12 +591,3 @@ bzero(void *buf, size_t len) } } -/* - * XXX what is the better/proper place for this routine? - */ -int -mem_valid(vm_offset_t addr, int len) -{ - - return (1); -} Modified: user/nwhitehorn/ps3/powerpc/powerpc/platform.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/powerpc/platform.c Wed Oct 13 00:57:14 2010 (r213756) +++ user/nwhitehorn/ps3/powerpc/powerpc/platform.c Wed Oct 13 02:09:06 2010 (r213757) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -63,11 +64,39 @@ static char plat_name[64] = ""; SYSCTL_STRING(_hw, OID_AUTO, platform, CTLFLAG_RD | CTLFLAG_TUN, plat_name, 0, "Platform currently in use"); +static struct mem_region *pregions = NULL; +static struct mem_region *aregions = NULL; +static int npregions, naregions; + void mem_regions(struct mem_region **phys, int *physsz, struct mem_region **avail, int *availsz) { - PLATFORM_MEM_REGIONS(plat_obj, phys, physsz, avail, availsz); + if (pregions == NULL) + PLATFORM_MEM_REGIONS(plat_obj, &pregions, &npregions, + &aregions, &naregions); + + *phys = pregions; + *avail = aregions; + *physsz = npregions; + *availsz = naregions; +} + +int +mem_valid(vm_offset_t addr, int len) +{ + int i; + + if (pregions == NULL) + PLATFORM_MEM_REGIONS(plat_obj, &pregions, &npregions, + &aregions, &naregions); + + for (i = 0; i < npregions; i++) + if ((addr >= pregions[i].mr_start) + && (addr + len < pregions[i].mr_start + pregions[i].mr_size)) + return (0); + + return (EFAULT); } vm_offset_t From owner-svn-src-user@FreeBSD.ORG Wed Oct 13 02:10:56 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 BBF9E106566C; Wed, 13 Oct 2010 02:10:56 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A9C7D8FC17; Wed, 13 Oct 2010 02:10:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9D2AuiR069192; Wed, 13 Oct 2010 02:10:56 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9D2Auhs069189; Wed, 13 Oct 2010 02:10:56 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201010130210.o9D2Auhs069189@svn.freebsd.org> From: Nathan Whitehorn Date: Wed, 13 Oct 2010 02:10:56 +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: r213758 - in user/nwhitehorn/ps3: dev/ofw powerpc/aim 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: Wed, 13 Oct 2010 02:10:56 -0000 Author: nwhitehorn Date: Wed Oct 13 02:10:56 2010 New Revision: 213758 URL: http://svn.freebsd.org/changeset/base/213758 Log: Make the generic OF layer do the right thing (all OF client interface routines return errors) if no OF client interface module is installed instead of calling NULL functions. Modified: user/nwhitehorn/ps3/dev/ofw/openfirm.c user/nwhitehorn/ps3/powerpc/aim/mmu_oea64.c Modified: user/nwhitehorn/ps3/dev/ofw/openfirm.c ============================================================================== --- user/nwhitehorn/ps3/dev/ofw/openfirm.c Wed Oct 13 02:09:06 2010 (r213757) +++ user/nwhitehorn/ps3/dev/ofw/openfirm.c Wed Oct 13 02:10:56 2010 (r213758) @@ -76,7 +76,7 @@ MALLOC_DEFINE(M_OFWPROP, "openfirm", "Op static ihandle_t stdout; -static ofw_def_t *ofw_def_impl; +static ofw_def_t *ofw_def_impl = NULL; static ofw_t ofw_obj; static struct ofw_kobj ofw_kernel_obj; static struct kobj_ops ofw_kernel_kops; @@ -118,6 +118,9 @@ OF_init(void *cookie) phandle_t chosen; int rv; + if (ofw_def_impl == NULL) + return (-1); + ofw_obj = &ofw_kernel_obj; /* * Take care of compiling the selected class, and @@ -156,6 +159,9 @@ int OF_test(const char *name) { + if (ofw_def_impl == NULL) + return (-1); + return (OFW_TEST(ofw_obj, name)); } @@ -167,6 +173,9 @@ OF_interpret(const char *cmd, int nretur int i = 0; int status; + if (ofw_def_impl == NULL) + return (-1); + status = OFW_INTERPRET(ofw_obj, cmd, nreturns, slots); if (status == -1) return (status); @@ -188,6 +197,9 @@ phandle_t OF_peer(phandle_t node) { + if (ofw_def_impl == NULL) + return (0); + return (OFW_PEER(ofw_obj, node)); } @@ -196,6 +208,9 @@ phandle_t OF_child(phandle_t node) { + if (ofw_def_impl == NULL) + return (0); + return (OFW_CHILD(ofw_obj, node)); } @@ -204,6 +219,9 @@ phandle_t OF_parent(phandle_t node) { + if (ofw_def_impl == NULL) + return (0); + return (OFW_PARENT(ofw_obj, node)); } @@ -212,6 +230,9 @@ phandle_t OF_instance_to_package(ihandle_t instance) { + if (ofw_def_impl == NULL) + return (-1); + return (OFW_INSTANCE_TO_PACKAGE(ofw_obj, instance)); } @@ -220,6 +241,9 @@ ssize_t OF_getproplen(phandle_t package, const char *propname) { + if (ofw_def_impl == NULL) + return (-1); + return (OFW_GETPROPLEN(ofw_obj, package, propname)); } @@ -228,6 +252,9 @@ ssize_t OF_getprop(phandle_t package, const char *propname, void *buf, size_t buflen) { + if (ofw_def_impl == NULL) + return (-1); + return (OFW_GETPROP(ofw_obj, package, propname, buf, buflen)); } @@ -276,6 +303,9 @@ int OF_nextprop(phandle_t package, const char *previous, char *buf, size_t size) { + if (ofw_def_impl == NULL) + return (-1); + return (OFW_NEXTPROP(ofw_obj, package, previous, buf, size)); } @@ -284,6 +314,9 @@ int OF_setprop(phandle_t package, const char *propname, const void *buf, size_t len) { + if (ofw_def_impl == NULL) + return (-1); + return (OFW_SETPROP(ofw_obj, package, propname, buf,len)); } @@ -292,6 +325,9 @@ ssize_t OF_canon(const char *device, char *buf, size_t len) { + if (ofw_def_impl == NULL) + return (-1); + return (OFW_CANON(ofw_obj, device, buf, len)); } @@ -300,6 +336,9 @@ phandle_t OF_finddevice(const char *device) { + if (ofw_def_impl == NULL) + return (-1); + return (OFW_FINDDEVICE(ofw_obj, device)); } @@ -308,6 +347,9 @@ ssize_t OF_instance_to_path(ihandle_t instance, char *buf, size_t len) { + if (ofw_def_impl == NULL) + return (-1); + return (OFW_INSTANCE_TO_PATH(ofw_obj, instance, buf, len)); } @@ -316,6 +358,9 @@ ssize_t OF_package_to_path(phandle_t package, char *buf, size_t len) { + if (ofw_def_impl == NULL) + return (-1); + return (OFW_PACKAGE_TO_PATH(ofw_obj, package, buf, len)); } @@ -328,7 +373,7 @@ OF_call_method(const char *method, ihand cell_t args_n_results[12]; int n, status; - if (nargs > 6) + if (nargs > 6 || ofw_def_impl == NULL) return (-1); va_start(ap, nreturns); for (n = 0; n < nargs; n++) @@ -354,6 +399,9 @@ ihandle_t OF_open(const char *device) { + if (ofw_def_impl == NULL) + return (0); + return (OFW_OPEN(ofw_obj, device)); } @@ -362,6 +410,9 @@ void OF_close(ihandle_t instance) { + if (ofw_def_impl == NULL) + return; + OFW_CLOSE(ofw_obj, instance); } @@ -370,6 +421,9 @@ ssize_t OF_read(ihandle_t instance, void *addr, size_t len) { + if (ofw_def_impl == NULL) + return (-1); + return (OFW_READ(ofw_obj, instance, addr, len)); } @@ -378,6 +432,9 @@ ssize_t OF_write(ihandle_t instance, const void *addr, size_t len) { + if (ofw_def_impl == NULL) + return (-1); + return (OFW_WRITE(ofw_obj, instance, addr, len)); } @@ -386,6 +443,9 @@ int OF_seek(ihandle_t instance, uint64_t pos) { + if (ofw_def_impl == NULL) + return (-1); + return (OFW_SEEK(ofw_obj, instance, pos)); } @@ -398,6 +458,9 @@ void * OF_claim(void *virt, size_t size, u_int align) { + if (ofw_def_impl == NULL) + return ((void *)-1); + return (OFW_CLAIM(ofw_obj, virt, size, align)); } @@ -406,6 +469,9 @@ void OF_release(void *virt, size_t size) { + if (ofw_def_impl == NULL) + return; + OFW_RELEASE(ofw_obj, virt, size); } @@ -418,6 +484,9 @@ void OF_enter() { + if (ofw_def_impl == NULL) + return; + OFW_ENTER(ofw_obj); } @@ -425,6 +494,8 @@ OF_enter() void OF_exit() { + if (ofw_def_impl == NULL) + panic("OF_exit: Open Firmware not available"); /* Should not return */ OFW_EXIT(ofw_obj); Modified: user/nwhitehorn/ps3/powerpc/aim/mmu_oea64.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/aim/mmu_oea64.c Wed Oct 13 02:09:06 2010 (r213757) +++ user/nwhitehorn/ps3/powerpc/aim/mmu_oea64.c Wed Oct 13 02:10:56 2010 (r213758) @@ -1134,7 +1134,9 @@ moea64_late_bootstrap(mmu_t mmup, vm_off * mode. */ - if (!ofw_real_mode) { + chosen = OF_finddevice("/chosen"); + + if (chosen != -1 && OF_getprop(chosen, "mmu", &mmui, 4) != -1) { #ifndef __powerpc64__ moea64_pinit(mmup, &ofw_pmap); From owner-svn-src-user@FreeBSD.ORG Wed Oct 13 02:11:59 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 EBF7D106579D; Wed, 13 Oct 2010 02:11:59 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D9BEB8FC16; Wed, 13 Oct 2010 02:11:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9D2Bx5j069266; Wed, 13 Oct 2010 02:11:59 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9D2BxuY069261; Wed, 13 Oct 2010 02:11:59 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201010130211.o9D2BxuY069261@svn.freebsd.org> From: Nathan Whitehorn Date: Wed, 13 Oct 2010 02:11:59 +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: r213759 - in user/nwhitehorn/ps3: boot/powerpc/ps3 powerpc/conf powerpc/ps3 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: Wed, 13 Oct 2010 02:12:00 -0000 Author: nwhitehorn Date: Wed Oct 13 02:11:59 2010 New Revision: 213759 URL: http://svn.freebsd.org/changeset/base/213759 Log: Remove PS3 vestiges of pointless FDT code that never worked anyway, and add PS3 to GENERIC64 since it no longer conflicts with POWERMAC. Modified: user/nwhitehorn/ps3/boot/powerpc/ps3/Makefile user/nwhitehorn/ps3/boot/powerpc/ps3/main.c user/nwhitehorn/ps3/powerpc/conf/GENERIC64 user/nwhitehorn/ps3/powerpc/ps3/platform_ps3.c Modified: user/nwhitehorn/ps3/boot/powerpc/ps3/Makefile ============================================================================== --- user/nwhitehorn/ps3/boot/powerpc/ps3/Makefile Wed Oct 13 02:10:56 2010 (r213758) +++ user/nwhitehorn/ps3/boot/powerpc/ps3/Makefile Wed Oct 13 02:11:59 2010 (r213759) @@ -21,7 +21,7 @@ LOADER_NET_SUPPORT?= yes LOADER_NFS_SUPPORT?= yes LOADER_TFTP_SUPPORT?= no LOADER_GZIP_SUPPORT?= yes -LOADER_FDT_SUPPORT?= yes +LOADER_FDT_SUPPORT?= no LOADER_BZIP2_SUPPORT?= no .if ${LOADER_DISK_SUPPORT} == "yes" Modified: user/nwhitehorn/ps3/boot/powerpc/ps3/main.c ============================================================================== --- user/nwhitehorn/ps3/boot/powerpc/ps3/main.c Wed Oct 13 02:10:56 2010 (r213758) +++ user/nwhitehorn/ps3/boot/powerpc/ps3/main.c Wed Oct 13 02:11:59 2010 (r213759) @@ -101,6 +101,7 @@ main(void) env_setenv("currdev", EV_VOLATILE, "net", ps3_setcurrdev, env_nounset); env_setenv("loaddev", EV_VOLATILE, "net", env_noset, env_nounset); setenv("LINES", "24", 1); + setenv("hw.platform", "ps3", 1); interact(); /* doesn't return */ @@ -204,7 +205,7 @@ ps3_readin(const int fd, vm_offset_t des int ps3_autoload(void) { - /* XXX Load PS3 FDT? */ + return (0); } Modified: user/nwhitehorn/ps3/powerpc/conf/GENERIC64 ============================================================================== --- user/nwhitehorn/ps3/powerpc/conf/GENERIC64 Wed Oct 13 02:10:56 2010 (r213758) +++ user/nwhitehorn/ps3/powerpc/conf/GENERIC64 Wed Oct 13 02:11:59 2010 (r213759) @@ -26,8 +26,9 @@ machine powerpc powerpc64 makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols # Platform support -options POWERMAC #NewWorld Apple PowerMacs options MAMBO #IBM Mambo Full System Simulator +options POWERMAC #NewWorld Apple PowerMacs +options PS3 #Sony PlayStation 3 options SCHED_ULE #ULE scheduler options INET #InterNETworking @@ -126,6 +127,7 @@ device bge # Broadcom BCM570xx Gigabit device gem # Sun GEM/Sun ERI/Apple GMAC device dc # DEC/Intel 21143 and various workalikes device fxp # Intel EtherExpress PRO/100B (82557, 82558) +device glc # Playstation 3 Ethernet # Pseudo devices. device loop # Network loopback Modified: user/nwhitehorn/ps3/powerpc/ps3/platform_ps3.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/ps3/platform_ps3.c Wed Oct 13 02:10:56 2010 (r213758) +++ user/nwhitehorn/ps3/powerpc/ps3/platform_ps3.c Wed Oct 13 02:11:59 2010 (r213759) @@ -49,8 +49,6 @@ __FBSDID("$FreeBSD: user/nwhitehorn/ps3/ #include #include -#include - #include "platform_if.h" #include "ps3-hvcall.h" @@ -105,22 +103,8 @@ PLATFORM_DEF(ps3_platform); static int ps3_probe(platform_t plat) { -#if 0 - phandle_t root; - char compatible[64]; - - root = OF_finddevice("/"); - - if (OF_getprop(root, "compatible", compatible, sizeof(compatible)) <= 0) - return (ENXIO); - - if (strncmp(compatible, "sony,ps3", sizeof(compatible)) == 0) - return (BUS_PROBE_SPECIFIC); - return (ENXIO); -#else return (BUS_PROBE_NOWILDCARD); -#endif } #define MEM_REGIONS 2 From owner-svn-src-user@FreeBSD.ORG Thu Oct 14 15:42:33 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 75B82106567A; Thu, 14 Oct 2010 15:42:33 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F2138FC15; Thu, 14 Oct 2010 15:42:33 +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 o9EFgXPH028710; Thu, 14 Oct 2010 15:42:33 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9EFgX5N028691; Thu, 14 Oct 2010 15:42:33 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201010141542.o9EFgX5N028691@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 14 Oct 2010 15: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: r213838 - in user/nwhitehorn/ps3: amd64/amd64 amd64/conf amd64/include amd64/linux32 arm/arm arm/at91 arm/conf arm/include arm/mv boot/common boot/forth boot/i386/boot2 boot/i386/common... 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, 14 Oct 2010 15:42:33 -0000 Author: nwhitehorn Date: Thu Oct 14 15:42:32 2010 New Revision: 213838 URL: http://svn.freebsd.org/changeset/base/213838 Log: IFC @ r213837 Take advantage of new features, including grehan's MMU inheritance code, to simplify PS3 bits. Also map the PS3 framebuffer write-combining now that we can do that. Added: user/nwhitehorn/ps3/arm/at91/at91_pio_sam9g20.h - copied unchanged from r213837, head/sys/arm/at91/at91_pio_sam9g20.h user/nwhitehorn/ps3/arm/at91/at91_reset.S - copied unchanged from r213837, head/sys/arm/at91/at91_reset.S user/nwhitehorn/ps3/arm/at91/at91_rst.c - copied unchanged from r213837, head/sys/arm/at91/at91_rst.c user/nwhitehorn/ps3/arm/at91/at91_rstreg.h - copied unchanged from r213837, head/sys/arm/at91/at91_rstreg.h user/nwhitehorn/ps3/arm/at91/at91_wdt.c - copied unchanged from r213837, head/sys/arm/at91/at91_wdt.c user/nwhitehorn/ps3/arm/at91/at91_wdtreg.h - copied unchanged from r213837, head/sys/arm/at91/at91_wdtreg.h user/nwhitehorn/ps3/arm/at91/at91reg.h - copied unchanged from r213837, head/sys/arm/at91/at91reg.h user/nwhitehorn/ps3/arm/at91/at91rm9200.c - copied unchanged from r213837, head/sys/arm/at91/at91rm9200.c user/nwhitehorn/ps3/arm/at91/at91sam9260.c - copied unchanged from r213837, head/sys/arm/at91/at91sam9260.c user/nwhitehorn/ps3/arm/at91/at91sam9260reg.h - copied unchanged from r213837, head/sys/arm/at91/at91sam9260reg.h user/nwhitehorn/ps3/arm/at91/at91sam9g20.c - copied unchanged from r213837, head/sys/arm/at91/at91sam9g20.c user/nwhitehorn/ps3/arm/at91/board_qila9g20.c - copied unchanged from r213837, head/sys/arm/at91/board_qila9g20.c user/nwhitehorn/ps3/arm/at91/board_sam9g20ek.c - copied unchanged from r213837, head/sys/arm/at91/board_sam9g20ek.c user/nwhitehorn/ps3/arm/at91/std.qila9g20 - copied unchanged from r213837, head/sys/arm/at91/std.qila9g20 user/nwhitehorn/ps3/arm/at91/std.sam9g20ek - copied unchanged from r213837, head/sys/arm/at91/std.sam9g20ek user/nwhitehorn/ps3/arm/conf/QILA9G20 - copied unchanged from r213837, head/sys/arm/conf/QILA9G20 user/nwhitehorn/ps3/arm/conf/QILA9G20.hints - copied unchanged from r213837, head/sys/arm/conf/QILA9G20.hints user/nwhitehorn/ps3/arm/conf/SAM9G20EK - copied unchanged from r213837, head/sys/arm/conf/SAM9G20EK user/nwhitehorn/ps3/arm/conf/SAM9G20EK.hints - copied unchanged from r213837, head/sys/arm/conf/SAM9G20EK.hints user/nwhitehorn/ps3/boot/common/crc32.c - copied unchanged from r213837, head/sys/boot/common/crc32.c user/nwhitehorn/ps3/boot/common/crc32.h - copied unchanged from r213837, head/sys/boot/common/crc32.h user/nwhitehorn/ps3/boot/common/gpt.c - copied unchanged from r213837, head/sys/boot/common/gpt.c user/nwhitehorn/ps3/boot/common/gpt.h - copied unchanged from r213837, head/sys/boot/common/gpt.h user/nwhitehorn/ps3/boot/common/util.c - copied unchanged from r213837, head/sys/boot/common/util.c user/nwhitehorn/ps3/boot/common/util.h - copied unchanged from r213837, head/sys/boot/common/util.h user/nwhitehorn/ps3/boot/i386/common/ - copied from r213837, head/sys/boot/i386/common/ user/nwhitehorn/ps3/contrib/dev/acpica/compiler/aslmessages.h - copied unchanged from r213837, head/sys/contrib/dev/acpica/compiler/aslmessages.h user/nwhitehorn/ps3/contrib/dev/acpica/hardware/hwpci.c - copied unchanged from r213837, head/sys/contrib/dev/acpica/hardware/hwpci.c user/nwhitehorn/ps3/contrib/dev/acpica/utilities/utxferror.c - copied unchanged from r213837, head/sys/contrib/dev/acpica/utilities/utxferror.c user/nwhitehorn/ps3/dev/gpio/ - copied from r213837, head/sys/dev/gpio/ user/nwhitehorn/ps3/dev/usb/controller/xhci.c - copied unchanged from r213837, head/sys/dev/usb/controller/xhci.c user/nwhitehorn/ps3/dev/usb/controller/xhci.h - copied unchanged from r213837, head/sys/dev/usb/controller/xhci.h user/nwhitehorn/ps3/dev/usb/controller/xhci_pci.c - copied unchanged from r213837, head/sys/dev/usb/controller/xhci_pci.c user/nwhitehorn/ps3/dev/usb/controller/xhcireg.h - copied unchanged from r213837, head/sys/dev/usb/controller/xhcireg.h user/nwhitehorn/ps3/dev/usb/net/if_ipheth.c - copied unchanged from r213837, head/sys/dev/usb/net/if_ipheth.c user/nwhitehorn/ps3/dev/usb/net/if_iphethvar.h - copied unchanged from r213837, head/sys/dev/usb/net/if_iphethvar.h user/nwhitehorn/ps3/fs/devfs/devfs_dir.c - copied unchanged from r213837, head/sys/fs/devfs/devfs_dir.c user/nwhitehorn/ps3/kern/vfs_mountroot.c - copied unchanged from r213837, head/sys/kern/vfs_mountroot.c user/nwhitehorn/ps3/libkern/inet_ntop.c - copied unchanged from r213837, head/sys/libkern/inet_ntop.c user/nwhitehorn/ps3/libkern/inet_pton.c - copied unchanged from r213837, head/sys/libkern/inet_pton.c user/nwhitehorn/ps3/mips/atheros/ar71xx_gpio.c - copied unchanged from r213837, head/sys/mips/atheros/ar71xx_gpio.c user/nwhitehorn/ps3/mips/atheros/ar71xx_gpiovar.h - copied unchanged from r213837, head/sys/mips/atheros/ar71xx_gpiovar.h user/nwhitehorn/ps3/mips/cavium/octe/ethernet-mv88e61xx.c - copied unchanged from r213837, head/sys/mips/cavium/octe/ethernet-mv88e61xx.c user/nwhitehorn/ps3/mips/cavium/octe/ethernet-mv88e61xx.h - copied unchanged from r213837, head/sys/mips/cavium/octe/ethernet-mv88e61xx.h user/nwhitehorn/ps3/mips/cavium/octe/mv88e61xxphy.c - copied unchanged from r213837, head/sys/mips/cavium/octe/mv88e61xxphy.c user/nwhitehorn/ps3/mips/cavium/octe/mv88e61xxphyreg.h - copied unchanged from r213837, head/sys/mips/cavium/octe/mv88e61xxphyreg.h user/nwhitehorn/ps3/modules/usb/ipheth/ - copied from r213837, head/sys/modules/usb/ipheth/ user/nwhitehorn/ps3/modules/usb/xhci/ - copied from r213837, head/sys/modules/usb/xhci/ user/nwhitehorn/ps3/sys/gpio.h - copied unchanged from r213837, head/sys/sys/gpio.h Replaced: user/nwhitehorn/ps3/kern/Makefile - copied unchanged from r213837, head/sys/kern/Makefile Deleted: user/nwhitehorn/ps3/arm/at91/at91_pio_sam9.h user/nwhitehorn/ps3/arm/at91/at91sam9.c user/nwhitehorn/ps3/arm/at91/at91sam9_machdep.c user/nwhitehorn/ps3/dev/mii/axphyreg.h user/nwhitehorn/ps3/mips/rmi/dev/sec/stats.h user/nwhitehorn/ps3/rpc/inet_ntop.c user/nwhitehorn/ps3/rpc/inet_pton.c Modified: user/nwhitehorn/ps3/amd64/amd64/busdma_machdep.c user/nwhitehorn/ps3/amd64/amd64/identcpu.c user/nwhitehorn/ps3/amd64/amd64/machdep.c user/nwhitehorn/ps3/amd64/amd64/mp_machdep.c user/nwhitehorn/ps3/amd64/conf/GENERIC user/nwhitehorn/ps3/amd64/conf/NOTES user/nwhitehorn/ps3/amd64/include/specialreg.h user/nwhitehorn/ps3/amd64/include/vmparam.h user/nwhitehorn/ps3/amd64/linux32/linux32_proto.h user/nwhitehorn/ps3/amd64/linux32/linux32_syscall.h user/nwhitehorn/ps3/amd64/linux32/linux32_sysent.c user/nwhitehorn/ps3/amd64/linux32/linux32_sysvec.c user/nwhitehorn/ps3/amd64/linux32/syscalls.master user/nwhitehorn/ps3/arm/arm/cpufunc.c user/nwhitehorn/ps3/arm/arm/cpufunc_asm_sheeva.S user/nwhitehorn/ps3/arm/at91/at91.c user/nwhitehorn/ps3/arm/at91/at91_machdep.c user/nwhitehorn/ps3/arm/at91/at91_mci.c user/nwhitehorn/ps3/arm/at91/at91_pio.c user/nwhitehorn/ps3/arm/at91/at91_pio_rm9200.h user/nwhitehorn/ps3/arm/at91/at91_pioreg.h user/nwhitehorn/ps3/arm/at91/at91_pit.c user/nwhitehorn/ps3/arm/at91/at91_pmc.c user/nwhitehorn/ps3/arm/at91/at91_pmcreg.h user/nwhitehorn/ps3/arm/at91/at91_pmcvar.h user/nwhitehorn/ps3/arm/at91/at91_twi.c user/nwhitehorn/ps3/arm/at91/at91_twireg.h user/nwhitehorn/ps3/arm/at91/at91rm92reg.h user/nwhitehorn/ps3/arm/at91/at91sam9g20reg.h user/nwhitehorn/ps3/arm/at91/at91var.h user/nwhitehorn/ps3/arm/at91/board_hl201.c user/nwhitehorn/ps3/arm/at91/board_kb920x.c user/nwhitehorn/ps3/arm/at91/files.at91 user/nwhitehorn/ps3/arm/at91/files.at91sam9 user/nwhitehorn/ps3/arm/at91/if_ate.c user/nwhitehorn/ps3/arm/at91/if_atereg.h user/nwhitehorn/ps3/arm/at91/if_macb.c user/nwhitehorn/ps3/arm/at91/std.at91sam9 user/nwhitehorn/ps3/arm/at91/std.kb920x user/nwhitehorn/ps3/arm/at91/uart_cpu_at91rm9200usart.c user/nwhitehorn/ps3/arm/at91/uart_dev_at91usart.c user/nwhitehorn/ps3/arm/include/cpufunc.h user/nwhitehorn/ps3/arm/mv/timer.c user/nwhitehorn/ps3/boot/common/loader.8 user/nwhitehorn/ps3/boot/forth/loader.conf user/nwhitehorn/ps3/boot/i386/boot2/Makefile user/nwhitehorn/ps3/boot/i386/gptboot/Makefile user/nwhitehorn/ps3/boot/i386/gptboot/gptboot.c user/nwhitehorn/ps3/boot/i386/gptzfsboot/Makefile user/nwhitehorn/ps3/boot/i386/libi386/biosdisk.c user/nwhitehorn/ps3/boot/i386/zfsboot/Makefile user/nwhitehorn/ps3/boot/i386/zfsboot/zfsboot.c user/nwhitehorn/ps3/boot/pc98/boot2/Makefile user/nwhitehorn/ps3/boot/zfs/Makefile user/nwhitehorn/ps3/boot/zfs/zfs.c user/nwhitehorn/ps3/boot/zfs/zfsimpl.c user/nwhitehorn/ps3/cam/cam_xpt.c user/nwhitehorn/ps3/cam/scsi/scsi_pass.c user/nwhitehorn/ps3/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c user/nwhitehorn/ps3/cddl/compat/opensolaris/kern/opensolaris_kmem.c user/nwhitehorn/ps3/cddl/compat/opensolaris/kern/opensolaris_taskq.c user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scrub.c user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c user/nwhitehorn/ps3/compat/linprocfs/linprocfs.c user/nwhitehorn/ps3/compat/linux/linux_futex.c user/nwhitehorn/ps3/compat/ndis/subr_ntoskrnl.c user/nwhitehorn/ps3/compat/svr4/svr4_sysvec.c user/nwhitehorn/ps3/compat/x86bios/x86bios.c user/nwhitehorn/ps3/conf/NOTES user/nwhitehorn/ps3/conf/files user/nwhitehorn/ps3/conf/files.amd64 user/nwhitehorn/ps3/conf/files.powerpc user/nwhitehorn/ps3/conf/ldscript.mips.octeon1.64 user/nwhitehorn/ps3/conf/newvers.sh user/nwhitehorn/ps3/conf/options user/nwhitehorn/ps3/conf/options.arm user/nwhitehorn/ps3/contrib/dev/acpica/acpica_prep.sh user/nwhitehorn/ps3/contrib/dev/acpica/changes.txt user/nwhitehorn/ps3/contrib/dev/acpica/common/adfile.c user/nwhitehorn/ps3/contrib/dev/acpica/common/adisasm.c user/nwhitehorn/ps3/contrib/dev/acpica/common/adwalk.c user/nwhitehorn/ps3/contrib/dev/acpica/common/dmrestag.c user/nwhitehorn/ps3/contrib/dev/acpica/common/getopt.c user/nwhitehorn/ps3/contrib/dev/acpica/compiler/aslanalyze.c user/nwhitehorn/ps3/contrib/dev/acpica/compiler/aslcodegen.c user/nwhitehorn/ps3/contrib/dev/acpica/compiler/aslcompile.c user/nwhitehorn/ps3/contrib/dev/acpica/compiler/aslcompiler.h user/nwhitehorn/ps3/contrib/dev/acpica/compiler/asldefine.h user/nwhitehorn/ps3/contrib/dev/acpica/compiler/aslerror.c user/nwhitehorn/ps3/contrib/dev/acpica/compiler/aslfiles.c user/nwhitehorn/ps3/contrib/dev/acpica/compiler/asllisting.c user/nwhitehorn/ps3/contrib/dev/acpica/compiler/asllookup.c user/nwhitehorn/ps3/contrib/dev/acpica/compiler/aslmain.c user/nwhitehorn/ps3/contrib/dev/acpica/compiler/aslopcodes.c user/nwhitehorn/ps3/contrib/dev/acpica/compiler/aslpredef.c user/nwhitehorn/ps3/contrib/dev/acpica/compiler/aslresource.c user/nwhitehorn/ps3/contrib/dev/acpica/compiler/aslrestype1.c user/nwhitehorn/ps3/contrib/dev/acpica/compiler/aslrestype1i.c user/nwhitehorn/ps3/contrib/dev/acpica/compiler/aslrestype2d.c user/nwhitehorn/ps3/contrib/dev/acpica/compiler/aslrestype2e.c user/nwhitehorn/ps3/contrib/dev/acpica/compiler/aslrestype2q.c user/nwhitehorn/ps3/contrib/dev/acpica/compiler/aslrestype2w.c user/nwhitehorn/ps3/contrib/dev/acpica/compiler/aslstartup.c user/nwhitehorn/ps3/contrib/dev/acpica/compiler/asltypes.h user/nwhitehorn/ps3/contrib/dev/acpica/compiler/aslutils.c user/nwhitehorn/ps3/contrib/dev/acpica/compiler/dtcompile.c user/nwhitehorn/ps3/contrib/dev/acpica/compiler/dtio.c user/nwhitehorn/ps3/contrib/dev/acpica/compiler/dttemplate.c user/nwhitehorn/ps3/contrib/dev/acpica/debugger/dbexec.c user/nwhitehorn/ps3/contrib/dev/acpica/events/evrgnini.c user/nwhitehorn/ps3/contrib/dev/acpica/events/evxfregn.c user/nwhitehorn/ps3/contrib/dev/acpica/executer/exmutex.c user/nwhitehorn/ps3/contrib/dev/acpica/include/acapps.h user/nwhitehorn/ps3/contrib/dev/acpica/include/acglobal.h user/nwhitehorn/ps3/contrib/dev/acpica/include/achware.h user/nwhitehorn/ps3/contrib/dev/acpica/include/aclocal.h user/nwhitehorn/ps3/contrib/dev/acpica/include/acmacros.h user/nwhitehorn/ps3/contrib/dev/acpica/include/acnamesp.h user/nwhitehorn/ps3/contrib/dev/acpica/include/acpiosxf.h user/nwhitehorn/ps3/contrib/dev/acpica/include/acpixf.h user/nwhitehorn/ps3/contrib/dev/acpica/include/actypes.h user/nwhitehorn/ps3/contrib/dev/acpica/include/acutils.h user/nwhitehorn/ps3/contrib/dev/acpica/include/platform/acenv.h user/nwhitehorn/ps3/contrib/dev/acpica/include/platform/acfreebsd.h user/nwhitehorn/ps3/contrib/dev/acpica/include/platform/acgcc.h user/nwhitehorn/ps3/contrib/dev/acpica/namespace/nsrepair2.c user/nwhitehorn/ps3/contrib/dev/acpica/namespace/nsutils.c user/nwhitehorn/ps3/contrib/dev/acpica/osunixxf.c user/nwhitehorn/ps3/contrib/dev/acpica/tables/tbfadt.c user/nwhitehorn/ps3/contrib/dev/acpica/tools/acpiexec/aecommon.h user/nwhitehorn/ps3/contrib/dev/acpica/utilities/utdebug.c user/nwhitehorn/ps3/contrib/dev/acpica/utilities/utglobal.c user/nwhitehorn/ps3/contrib/dev/acpica/utilities/utids.c user/nwhitehorn/ps3/contrib/dev/acpica/utilities/utmath.c user/nwhitehorn/ps3/contrib/dev/acpica/utilities/utmisc.c user/nwhitehorn/ps3/contrib/dev/acpica/utilities/utmutex.c user/nwhitehorn/ps3/contrib/dev/acpica/utilities/utosi.c user/nwhitehorn/ps3/contrib/ipfilter/netinet/mlfk_ipl.c user/nwhitehorn/ps3/contrib/ngatm/netnatm/api/cc_conn.c user/nwhitehorn/ps3/contrib/ngatm/netnatm/msg/privmsg.c user/nwhitehorn/ps3/contrib/ngatm/netnatm/msg/uni_ie.c user/nwhitehorn/ps3/contrib/ngatm/netnatm/sig/sig_call.c user/nwhitehorn/ps3/contrib/ngatm/netnatm/sig/sig_reset.c user/nwhitehorn/ps3/contrib/octeon-sdk/cvmx-app-init.h user/nwhitehorn/ps3/contrib/octeon-sdk/cvmx-helper-board.c user/nwhitehorn/ps3/contrib/octeon-sdk/cvmx-helper-spi.c user/nwhitehorn/ps3/contrib/octeon-sdk/cvmx-helper.c user/nwhitehorn/ps3/contrib/octeon-sdk/cvmx-spi.c user/nwhitehorn/ps3/contrib/pf/netinet/in4_cksum.c user/nwhitehorn/ps3/crypto/aesni/aeskeys_i386.S user/nwhitehorn/ps3/crypto/aesni/aesni.c user/nwhitehorn/ps3/crypto/aesni/aesni.h user/nwhitehorn/ps3/crypto/aesni/aesni_wrap.c user/nwhitehorn/ps3/dev/aac/aac.c user/nwhitehorn/ps3/dev/aac/aac_cam.c user/nwhitehorn/ps3/dev/aac/aac_disk.c user/nwhitehorn/ps3/dev/aac/aacreg.h user/nwhitehorn/ps3/dev/aac/aacvar.h user/nwhitehorn/ps3/dev/acpi_support/acpi_wmi.c user/nwhitehorn/ps3/dev/acpica/Osd/OsdHardware.c user/nwhitehorn/ps3/dev/acpica/acpi.c user/nwhitehorn/ps3/dev/acpica/acpi_cpu.c user/nwhitehorn/ps3/dev/acpica/acpi_ec.c user/nwhitehorn/ps3/dev/acpica/acpi_hpet.c user/nwhitehorn/ps3/dev/ae/if_ae.c user/nwhitehorn/ps3/dev/aic7xxx/aicasm/aicasm_macro_scan.l user/nwhitehorn/ps3/dev/aic7xxx/aicasm/aicasm_scan.l user/nwhitehorn/ps3/dev/alc/if_alc.c user/nwhitehorn/ps3/dev/ata/chipsets/ata-ahci.c user/nwhitehorn/ps3/dev/ata/chipsets/ata-siliconimage.c user/nwhitehorn/ps3/dev/ata/chipsets/ata-via.c user/nwhitehorn/ps3/dev/bce/if_bce.c user/nwhitehorn/ps3/dev/bce/if_bcereg.h user/nwhitehorn/ps3/dev/bge/if_bge.c user/nwhitehorn/ps3/dev/bge/if_bgereg.h user/nwhitehorn/ps3/dev/bwn/if_bwn.c user/nwhitehorn/ps3/dev/ciss/ciss.c user/nwhitehorn/ps3/dev/cxgb/cxgb_sge.c user/nwhitehorn/ps3/dev/dc/dcphy.c user/nwhitehorn/ps3/dev/dc/pnphy.c user/nwhitehorn/ps3/dev/e1000/e1000_82571.c user/nwhitehorn/ps3/dev/e1000/e1000_82571.h user/nwhitehorn/ps3/dev/e1000/e1000_82575.c user/nwhitehorn/ps3/dev/e1000/e1000_82575.h user/nwhitehorn/ps3/dev/e1000/e1000_api.c user/nwhitehorn/ps3/dev/e1000/e1000_api.h user/nwhitehorn/ps3/dev/e1000/e1000_defines.h user/nwhitehorn/ps3/dev/e1000/e1000_hw.h user/nwhitehorn/ps3/dev/e1000/e1000_ich8lan.c user/nwhitehorn/ps3/dev/e1000/e1000_ich8lan.h user/nwhitehorn/ps3/dev/e1000/e1000_mac.c user/nwhitehorn/ps3/dev/e1000/e1000_nvm.c user/nwhitehorn/ps3/dev/e1000/e1000_nvm.h user/nwhitehorn/ps3/dev/e1000/e1000_phy.c user/nwhitehorn/ps3/dev/e1000/e1000_phy.h user/nwhitehorn/ps3/dev/e1000/e1000_regs.h user/nwhitehorn/ps3/dev/e1000/if_em.c user/nwhitehorn/ps3/dev/e1000/if_em.h user/nwhitehorn/ps3/dev/e1000/if_igb.c user/nwhitehorn/ps3/dev/e1000/if_igb.h user/nwhitehorn/ps3/dev/e1000/if_lem.c user/nwhitehorn/ps3/dev/e1000/if_lem.h user/nwhitehorn/ps3/dev/et/if_et.c user/nwhitehorn/ps3/dev/hifn/hifn7751.c user/nwhitehorn/ps3/dev/hifn/hifn7751var.h user/nwhitehorn/ps3/dev/hptrr/hptrr_osm_bsd.c user/nwhitehorn/ps3/dev/hwpmc/pmc_events.h user/nwhitehorn/ps3/dev/if_ndis/if_ndis.c user/nwhitehorn/ps3/dev/iwi/if_iwi.c user/nwhitehorn/ps3/dev/iwi/if_iwivar.h user/nwhitehorn/ps3/dev/iwn/if_iwn.c user/nwhitehorn/ps3/dev/iwn/if_iwnvar.h user/nwhitehorn/ps3/dev/kbd/kbd.c user/nwhitehorn/ps3/dev/kbdmux/kbdmux.c user/nwhitehorn/ps3/dev/mii/acphy.c user/nwhitehorn/ps3/dev/mii/amphy.c user/nwhitehorn/ps3/dev/mii/atphy.c user/nwhitehorn/ps3/dev/mii/axphy.c user/nwhitehorn/ps3/dev/mii/bmtphy.c user/nwhitehorn/ps3/dev/mii/brgphy.c user/nwhitehorn/ps3/dev/mii/ciphy.c user/nwhitehorn/ps3/dev/mii/e1000phy.c user/nwhitehorn/ps3/dev/mii/exphy.c user/nwhitehorn/ps3/dev/mii/gentbi.c user/nwhitehorn/ps3/dev/mii/icsphy.c user/nwhitehorn/ps3/dev/mii/inphy.c user/nwhitehorn/ps3/dev/mii/ip1000phy.c user/nwhitehorn/ps3/dev/mii/jmphy.c user/nwhitehorn/ps3/dev/mii/lxtphy.c user/nwhitehorn/ps3/dev/mii/mii.c user/nwhitehorn/ps3/dev/mii/mii.h user/nwhitehorn/ps3/dev/mii/mii_physubr.c user/nwhitehorn/ps3/dev/mii/mlphy.c user/nwhitehorn/ps3/dev/mii/nsgphy.c user/nwhitehorn/ps3/dev/mii/nsphy.c user/nwhitehorn/ps3/dev/mii/nsphyter.c user/nwhitehorn/ps3/dev/mii/pnaphy.c user/nwhitehorn/ps3/dev/mii/qsphy.c user/nwhitehorn/ps3/dev/mii/rgephy.c user/nwhitehorn/ps3/dev/mii/rlphy.c user/nwhitehorn/ps3/dev/mii/rlswitch.c user/nwhitehorn/ps3/dev/mii/ruephy.c user/nwhitehorn/ps3/dev/mii/smcphy.c user/nwhitehorn/ps3/dev/mii/tdkphy.c user/nwhitehorn/ps3/dev/mii/tlphy.c user/nwhitehorn/ps3/dev/mii/tlphyreg.h user/nwhitehorn/ps3/dev/mii/truephy.c user/nwhitehorn/ps3/dev/mii/ukphy.c user/nwhitehorn/ps3/dev/mii/ukphy_subr.c user/nwhitehorn/ps3/dev/mii/xmphy.c user/nwhitehorn/ps3/dev/mps/mps.c user/nwhitehorn/ps3/dev/mps/mps_ioctl.h user/nwhitehorn/ps3/dev/mps/mps_sas.c user/nwhitehorn/ps3/dev/mps/mps_user.c user/nwhitehorn/ps3/dev/mps/mpsvar.h user/nwhitehorn/ps3/dev/mpt/mpt.c user/nwhitehorn/ps3/dev/mpt/mpt.h user/nwhitehorn/ps3/dev/ral/rt2560.c user/nwhitehorn/ps3/dev/sf/if_sf.c user/nwhitehorn/ps3/dev/sound/pci/envy24ht.c user/nwhitehorn/ps3/dev/sound/pci/spicds.c user/nwhitehorn/ps3/dev/stge/if_stge.c user/nwhitehorn/ps3/dev/syscons/scvgarndr.c user/nwhitehorn/ps3/dev/syscons/syscons.c user/nwhitehorn/ps3/dev/usb/controller/at91dci.c user/nwhitehorn/ps3/dev/usb/controller/atmegadci.c user/nwhitehorn/ps3/dev/usb/controller/avr32dci.c user/nwhitehorn/ps3/dev/usb/controller/musb_otg.c user/nwhitehorn/ps3/dev/usb/controller/ohci.c user/nwhitehorn/ps3/dev/usb/controller/usb_controller.c user/nwhitehorn/ps3/dev/usb/controller/uss820dci.c user/nwhitehorn/ps3/dev/usb/net/if_axe.c user/nwhitehorn/ps3/dev/usb/net/if_axereg.h user/nwhitehorn/ps3/dev/usb/net/if_cdce.c user/nwhitehorn/ps3/dev/usb/net/if_cdcereg.h user/nwhitehorn/ps3/dev/usb/net/uhso.c user/nwhitehorn/ps3/dev/usb/net/usb_ethernet.c user/nwhitehorn/ps3/dev/usb/serial/u3g.c user/nwhitehorn/ps3/dev/usb/storage/umass.c user/nwhitehorn/ps3/dev/usb/usb.h user/nwhitehorn/ps3/dev/usb/usb_cdc.h user/nwhitehorn/ps3/dev/usb/usb_controller.h user/nwhitehorn/ps3/dev/usb/usb_dev.c user/nwhitehorn/ps3/dev/usb/usb_device.c user/nwhitehorn/ps3/dev/usb/usb_device.h user/nwhitehorn/ps3/dev/usb/usb_generic.c user/nwhitehorn/ps3/dev/usb/usb_handle_request.c user/nwhitehorn/ps3/dev/usb/usb_hub.c user/nwhitehorn/ps3/dev/usb/usb_hub.h user/nwhitehorn/ps3/dev/usb/usb_msctest.c user/nwhitehorn/ps3/dev/usb/usb_msctest.h user/nwhitehorn/ps3/dev/usb/usb_parse.c user/nwhitehorn/ps3/dev/usb/usb_request.c user/nwhitehorn/ps3/dev/usb/usb_request.h user/nwhitehorn/ps3/dev/usb/usb_transfer.c user/nwhitehorn/ps3/dev/usb/usb_transfer.h user/nwhitehorn/ps3/dev/usb/usbdevs user/nwhitehorn/ps3/dev/usb/usbdi.h user/nwhitehorn/ps3/dev/usb/usbdi_util.h user/nwhitehorn/ps3/dev/usb/wlan/if_rum.c user/nwhitehorn/ps3/dev/usb/wlan/if_upgt.c user/nwhitehorn/ps3/fs/cd9660/cd9660_mount.h user/nwhitehorn/ps3/fs/cd9660/cd9660_vfsops.c user/nwhitehorn/ps3/fs/devfs/devfs.h user/nwhitehorn/ps3/fs/devfs/devfs_devs.c user/nwhitehorn/ps3/fs/devfs/devfs_int.h user/nwhitehorn/ps3/fs/devfs/devfs_vnops.c user/nwhitehorn/ps3/fs/hpfs/hpfs_vfsops.c user/nwhitehorn/ps3/fs/hpfs/hpfsmount.h user/nwhitehorn/ps3/fs/msdosfs/msdosfs_denode.c user/nwhitehorn/ps3/fs/msdosfs/msdosfs_vfsops.c user/nwhitehorn/ps3/fs/msdosfs/msdosfs_vnops.c user/nwhitehorn/ps3/fs/msdosfs/msdosfsmount.h user/nwhitehorn/ps3/fs/nfsserver/nfs_nfsdport.c user/nwhitehorn/ps3/fs/nfsserver/nfs_nfsdstate.c user/nwhitehorn/ps3/fs/ntfs/ntfs_vfsops.c user/nwhitehorn/ps3/fs/ntfs/ntfsmount.h user/nwhitehorn/ps3/fs/nwfs/nwfs_vfsops.c user/nwhitehorn/ps3/fs/smbfs/smbfs_vfsops.c user/nwhitehorn/ps3/fs/tmpfs/tmpfs_vnops.c user/nwhitehorn/ps3/gdb/gdb_cons.c user/nwhitehorn/ps3/geom/concat/g_concat.c user/nwhitehorn/ps3/geom/eli/g_eli.c user/nwhitehorn/ps3/geom/eli/g_eli.h user/nwhitehorn/ps3/geom/eli/g_eli_crypto.c user/nwhitehorn/ps3/geom/eli/g_eli_ctl.c user/nwhitehorn/ps3/geom/eli/g_eli_integrity.c user/nwhitehorn/ps3/geom/eli/g_eli_key.c user/nwhitehorn/ps3/geom/eli/g_eli_privacy.c user/nwhitehorn/ps3/geom/part/g_part.c user/nwhitehorn/ps3/geom/part/g_part_ebr.c user/nwhitehorn/ps3/geom/part/g_part_gpt.c user/nwhitehorn/ps3/geom/part/g_part_mbr.c user/nwhitehorn/ps3/geom/part/g_part_pc98.c user/nwhitehorn/ps3/geom/vinum/geom_vinum_move.c user/nwhitehorn/ps3/geom/vinum/geom_vinum_rename.c user/nwhitehorn/ps3/geom/virstor/g_virstor.c user/nwhitehorn/ps3/gnu/fs/reiserfs/reiserfs_mount.h user/nwhitehorn/ps3/gnu/fs/reiserfs/reiserfs_vfsops.c user/nwhitehorn/ps3/i386/conf/GENERIC user/nwhitehorn/ps3/i386/conf/NOTES user/nwhitehorn/ps3/i386/i386/busdma_machdep.c user/nwhitehorn/ps3/i386/i386/identcpu.c user/nwhitehorn/ps3/i386/i386/locore.s user/nwhitehorn/ps3/i386/i386/machdep.c user/nwhitehorn/ps3/i386/i386/mp_machdep.c user/nwhitehorn/ps3/i386/i386/pmap.c user/nwhitehorn/ps3/i386/i386/support.s user/nwhitehorn/ps3/i386/ibcs2/ibcs2_sysvec.c user/nwhitehorn/ps3/i386/include/pmap.h user/nwhitehorn/ps3/i386/include/specialreg.h user/nwhitehorn/ps3/i386/linux/linux_sysvec.c user/nwhitehorn/ps3/ia64/ia64/busdma_machdep.c user/nwhitehorn/ps3/ia64/include/_stdint.h user/nwhitehorn/ps3/ia64/include/bus.h user/nwhitehorn/ps3/kern/imgact_shell.c user/nwhitehorn/ps3/kern/init_main.c user/nwhitehorn/ps3/kern/kern_clocksource.c user/nwhitehorn/ps3/kern/kern_conf.c user/nwhitehorn/ps3/kern/kern_exit.c user/nwhitehorn/ps3/kern/kern_fork.c user/nwhitehorn/ps3/kern/kern_kthread.c user/nwhitehorn/ps3/kern/kern_linker.c user/nwhitehorn/ps3/kern/kern_malloc.c user/nwhitehorn/ps3/kern/kern_ntptime.c user/nwhitehorn/ps3/kern/kern_proc.c user/nwhitehorn/ps3/kern/kern_resource.c user/nwhitehorn/ps3/kern/kern_shutdown.c user/nwhitehorn/ps3/kern/kern_sig.c user/nwhitehorn/ps3/kern/kern_sysctl.c user/nwhitehorn/ps3/kern/kern_tc.c user/nwhitehorn/ps3/kern/kern_thr.c user/nwhitehorn/ps3/kern/kern_thread.c user/nwhitehorn/ps3/kern/kern_time.c user/nwhitehorn/ps3/kern/kern_umtx.c user/nwhitehorn/ps3/kern/link_elf.c user/nwhitehorn/ps3/kern/link_elf_obj.c user/nwhitehorn/ps3/kern/p1003_1b.c user/nwhitehorn/ps3/kern/sched_ule.c user/nwhitehorn/ps3/kern/subr_acl_nfs4.c user/nwhitehorn/ps3/kern/subr_bus.c user/nwhitehorn/ps3/kern/subr_kdb.c user/nwhitehorn/ps3/kern/subr_lock.c user/nwhitehorn/ps3/kern/subr_sbuf.c user/nwhitehorn/ps3/kern/subr_sleepqueue.c user/nwhitehorn/ps3/kern/subr_smp.c user/nwhitehorn/ps3/kern/subr_stack.c user/nwhitehorn/ps3/kern/subr_taskqueue.c user/nwhitehorn/ps3/kern/subr_trap.c user/nwhitehorn/ps3/kern/subr_witness.c user/nwhitehorn/ps3/kern/sys_process.c user/nwhitehorn/ps3/kern/tty.c user/nwhitehorn/ps3/kern/uipc_mqueue.c user/nwhitehorn/ps3/kern/uipc_socket.c user/nwhitehorn/ps3/kern/vfs_aio.c user/nwhitehorn/ps3/kern/vfs_mount.c user/nwhitehorn/ps3/mips/atheros/ar71xx_machdep.c user/nwhitehorn/ps3/mips/atheros/ar71xxreg.h user/nwhitehorn/ps3/mips/atheros/files.ar71xx user/nwhitehorn/ps3/mips/cavium/ciu.c user/nwhitehorn/ps3/mips/cavium/files.octeon1 user/nwhitehorn/ps3/mips/cavium/obio.c user/nwhitehorn/ps3/mips/cavium/octe/cavium-ethernet.h user/nwhitehorn/ps3/mips/cavium/octe/ethernet-common.c user/nwhitehorn/ps3/mips/cavium/octe/ethernet-headers.h user/nwhitehorn/ps3/mips/cavium/octe/ethernet-mdio.c user/nwhitehorn/ps3/mips/cavium/octe/ethernet-rgmii.c user/nwhitehorn/ps3/mips/cavium/octe/ethernet-rx.c user/nwhitehorn/ps3/mips/cavium/octe/ethernet-sgmii.c user/nwhitehorn/ps3/mips/cavium/octe/ethernet-tx.c user/nwhitehorn/ps3/mips/cavium/octe/ethernet-xaui.c user/nwhitehorn/ps3/mips/cavium/octe/ethernet.c user/nwhitehorn/ps3/mips/cavium/octe/octe.c user/nwhitehorn/ps3/mips/cavium/octeon_machdep.c user/nwhitehorn/ps3/mips/cavium/octopci.c user/nwhitehorn/ps3/mips/cavium/octopcireg.h user/nwhitehorn/ps3/mips/cavium/std.octeon1 user/nwhitehorn/ps3/mips/cavium/uart_bus_octeonusart.c user/nwhitehorn/ps3/mips/cavium/uart_cpu_octeonusart.c user/nwhitehorn/ps3/mips/cavium/uart_dev_oct16550.c user/nwhitehorn/ps3/mips/cavium/usb/octusb.c user/nwhitehorn/ps3/mips/conf/AR71XX user/nwhitehorn/ps3/mips/conf/AR71XX.hints user/nwhitehorn/ps3/mips/conf/OCTEON1 user/nwhitehorn/ps3/mips/include/cpuregs.h user/nwhitehorn/ps3/mips/include/md_var.h user/nwhitehorn/ps3/mips/include/pmap.h user/nwhitehorn/ps3/mips/mips/locore.S user/nwhitehorn/ps3/mips/mips/machdep.c user/nwhitehorn/ps3/mips/mips/pmap.c user/nwhitehorn/ps3/mips/rmi/board.c user/nwhitehorn/ps3/mips/rmi/board.h user/nwhitehorn/ps3/mips/rmi/dev/nlge/if_nlge.c user/nwhitehorn/ps3/mips/rmi/dev/nlge/if_nlge.h user/nwhitehorn/ps3/mips/rmi/dev/sec/desc.h user/nwhitehorn/ps3/mips/rmi/dev/sec/rmilib.c user/nwhitehorn/ps3/mips/rmi/dev/sec/rmilib.h user/nwhitehorn/ps3/mips/rmi/dev/sec/rmisec.c user/nwhitehorn/ps3/mips/rmi/dev/xlr/rge.c user/nwhitehorn/ps3/mips/rmi/dev/xlr/rge.h user/nwhitehorn/ps3/mips/rmi/fmn.c user/nwhitehorn/ps3/mips/rmi/iodi.c user/nwhitehorn/ps3/mips/rmi/msgring.h user/nwhitehorn/ps3/mips/rmi/pic.h user/nwhitehorn/ps3/mips/rmi/rmi_mips_exts.h user/nwhitehorn/ps3/mips/rmi/xlr_machdep.c user/nwhitehorn/ps3/mips/rmi/xlr_pci.c user/nwhitehorn/ps3/mips/sibyte/sb_zbpci.c user/nwhitehorn/ps3/modules/acpi/acpi/Makefile user/nwhitehorn/ps3/modules/cryptodev/Makefile user/nwhitehorn/ps3/modules/krpc/Makefile user/nwhitehorn/ps3/modules/mem/Makefile user/nwhitehorn/ps3/modules/sysvipc/sysvmsg/Makefile user/nwhitehorn/ps3/modules/sysvipc/sysvsem/Makefile user/nwhitehorn/ps3/modules/usb/Makefile user/nwhitehorn/ps3/net/bpf.c user/nwhitehorn/ps3/net/if_tap.c user/nwhitehorn/ps3/net/if_tun.c user/nwhitehorn/ps3/net80211/ieee80211_scan_sta.c user/nwhitehorn/ps3/netgraph/ng_UI.c user/nwhitehorn/ps3/netgraph/ng_async.c user/nwhitehorn/ps3/netgraph/ng_frame_relay.c user/nwhitehorn/ps3/netgraph/ng_gif_demux.c user/nwhitehorn/ps3/netgraph/ng_iface.c user/nwhitehorn/ps3/netgraph/ng_rfc1490.c user/nwhitehorn/ps3/netgraph/ng_socket.c user/nwhitehorn/ps3/netgraph/ng_tty.c user/nwhitehorn/ps3/netinet/igmp.c user/nwhitehorn/ps3/netinet/in.h user/nwhitehorn/ps3/netinet/in_rmx.c user/nwhitehorn/ps3/netinet/ip_carp.c user/nwhitehorn/ps3/netinet/ip_options.c user/nwhitehorn/ps3/netinet/ip_output.c user/nwhitehorn/ps3/netinet/ipfw/dn_sched.h user/nwhitehorn/ps3/netinet/ipfw/dn_sched_qfq.c user/nwhitehorn/ps3/netinet/ipfw/dn_sched_wf2q.c user/nwhitehorn/ps3/netinet/ipfw/ip_dn_glue.c user/nwhitehorn/ps3/netinet/ipfw/ip_dn_io.c user/nwhitehorn/ps3/netinet/ipfw/ip_dn_private.h user/nwhitehorn/ps3/netinet/ipfw/ip_dummynet.c user/nwhitehorn/ps3/netinet/ipfw/ip_fw_pfil.c user/nwhitehorn/ps3/netinet/sctp_auth.c user/nwhitehorn/ps3/netinet/sctp_cc_functions.c user/nwhitehorn/ps3/netinet/sctp_constants.h user/nwhitehorn/ps3/netinet/sctp_indata.c user/nwhitehorn/ps3/netinet/sctp_output.c user/nwhitehorn/ps3/netinet/sctp_pcb.c user/nwhitehorn/ps3/netinet/sctp_sysctl.c user/nwhitehorn/ps3/netinet/sctp_sysctl.h user/nwhitehorn/ps3/netinet/sctp_timer.c user/nwhitehorn/ps3/netinet/siftr.c user/nwhitehorn/ps3/netinet/tcp.h user/nwhitehorn/ps3/netinet/tcp_input.c user/nwhitehorn/ps3/netinet/tcp_output.c user/nwhitehorn/ps3/netinet/tcp_reass.c user/nwhitehorn/ps3/netinet/tcp_subr.c user/nwhitehorn/ps3/netinet/tcp_timer.h user/nwhitehorn/ps3/netinet/tcp_usrreq.c user/nwhitehorn/ps3/netinet/tcp_var.h user/nwhitehorn/ps3/netinet6/in6_cksum.c user/nwhitehorn/ps3/netinet6/in6_rmx.c user/nwhitehorn/ps3/netinet6/ip6_output.c user/nwhitehorn/ps3/netipsec/ipsec_output.c user/nwhitehorn/ps3/nlm/nlm_prot_impl.c user/nwhitehorn/ps3/opencrypto/cryptodev.c user/nwhitehorn/ps3/opencrypto/cryptodev.h user/nwhitehorn/ps3/opencrypto/cryptosoft.c user/nwhitehorn/ps3/opencrypto/xform.c user/nwhitehorn/ps3/opencrypto/xform.h user/nwhitehorn/ps3/pc98/conf/GENERIC user/nwhitehorn/ps3/pc98/pc98/machdep.c user/nwhitehorn/ps3/pci/if_rl.c user/nwhitehorn/ps3/powerpc/aim/machdep.c user/nwhitehorn/ps3/powerpc/aim/mmu_oea.c user/nwhitehorn/ps3/powerpc/aim/mmu_oea64.c user/nwhitehorn/ps3/powerpc/aim/mmu_oea64.h user/nwhitehorn/ps3/powerpc/aim/trap.c user/nwhitehorn/ps3/powerpc/conf/GENERIC user/nwhitehorn/ps3/powerpc/conf/GENERIC64 user/nwhitehorn/ps3/powerpc/include/altivec.h user/nwhitehorn/ps3/powerpc/include/memdev.h user/nwhitehorn/ps3/powerpc/include/pcb.h user/nwhitehorn/ps3/powerpc/include/pmap.h user/nwhitehorn/ps3/powerpc/include/trap_aim.h user/nwhitehorn/ps3/powerpc/include/vm.h user/nwhitehorn/ps3/powerpc/ofw/ofw_syscons.c user/nwhitehorn/ps3/powerpc/powerpc/bus_machdep.c user/nwhitehorn/ps3/powerpc/powerpc/busdma_machdep.c user/nwhitehorn/ps3/powerpc/powerpc/mem.c user/nwhitehorn/ps3/powerpc/powerpc/mmu_if.m user/nwhitehorn/ps3/powerpc/powerpc/pmap_dispatch.c user/nwhitehorn/ps3/powerpc/ps3/mmu_ps3.c user/nwhitehorn/ps3/powerpc/ps3/ps3_syscons.c user/nwhitehorn/ps3/rpc/clnt_dg.c user/nwhitehorn/ps3/rpc/clnt_vc.c user/nwhitehorn/ps3/rpc/rpc_com.h user/nwhitehorn/ps3/rpc/rpc_generic.c user/nwhitehorn/ps3/sparc64/conf/GENERIC user/nwhitehorn/ps3/sparc64/include/endian.h user/nwhitehorn/ps3/sparc64/sparc64/bus_machdep.c user/nwhitehorn/ps3/sparc64/sparc64/elf_machdep.c user/nwhitehorn/ps3/sun4v/conf/GENERIC user/nwhitehorn/ps3/sun4v/include/endian.h user/nwhitehorn/ps3/sys/_task.h user/nwhitehorn/ps3/sys/acl.h user/nwhitehorn/ps3/sys/conf.h user/nwhitehorn/ps3/sys/disklabel.h user/nwhitehorn/ps3/sys/exec.h user/nwhitehorn/ps3/sys/gpt.h user/nwhitehorn/ps3/sys/module.h user/nwhitehorn/ps3/sys/mount.h user/nwhitehorn/ps3/sys/mutex.h user/nwhitehorn/ps3/sys/param.h user/nwhitehorn/ps3/sys/proc.h user/nwhitehorn/ps3/sys/sched.h user/nwhitehorn/ps3/sys/signalvar.h user/nwhitehorn/ps3/sys/socketvar.h user/nwhitehorn/ps3/sys/sysctl.h user/nwhitehorn/ps3/sys/taskqueue.h user/nwhitehorn/ps3/sys/time.h user/nwhitehorn/ps3/sys/unistd.h user/nwhitehorn/ps3/sys/user.h user/nwhitehorn/ps3/ufs/ffs/ffs_softdep.c user/nwhitehorn/ps3/ufs/ffs/ffs_vfsops.c user/nwhitehorn/ps3/ufs/ufs/ufsmount.h user/nwhitehorn/ps3/vm/uma_core.c user/nwhitehorn/ps3/vm/vm_kern.c user/nwhitehorn/ps3/vm/vm_map.c user/nwhitehorn/ps3/vm/vm_map.h user/nwhitehorn/ps3/vm/vm_mmap.c user/nwhitehorn/ps3/vm/vm_phys.c user/nwhitehorn/ps3/vm/vm_reserv.c user/nwhitehorn/ps3/x86/isa/clock.c Directory Properties: user/nwhitehorn/ps3/ (props changed) user/nwhitehorn/ps3/amd64/include/xen/ (props changed) user/nwhitehorn/ps3/boot/powerpc/ps3/ (props changed) user/nwhitehorn/ps3/cddl/contrib/opensolaris/ (props changed) user/nwhitehorn/ps3/contrib/dev/acpica/ (props changed) user/nwhitehorn/ps3/contrib/pf/ (props changed) user/nwhitehorn/ps3/contrib/x86emu/ (props changed) user/nwhitehorn/ps3/dev/usb/controller/ (props changed) user/nwhitehorn/ps3/dev/xen/xenpci/ (props changed) user/nwhitehorn/ps3/powerpc/ps3/ (props changed) Modified: user/nwhitehorn/ps3/amd64/amd64/busdma_machdep.c ============================================================================== --- user/nwhitehorn/ps3/amd64/amd64/busdma_machdep.c Thu Oct 14 15:15:22 2010 (r213837) +++ user/nwhitehorn/ps3/amd64/amd64/busdma_machdep.c Thu Oct 14 15:42:32 2010 (r213838) @@ -526,7 +526,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", __func__, dmat, dmat->flags, ENOMEM); return (ENOMEM); - } else if ((uintptr_t)*vaddr & (dmat->alignment - 1)) { + } else if (vtophys(*vaddr) & (dmat->alignment - 1)) { printf("bus_dmamem_alloc failed to align memory properly.\n"); } if (flags & BUS_DMA_NOCACHE) Modified: user/nwhitehorn/ps3/amd64/amd64/identcpu.c ============================================================================== --- user/nwhitehorn/ps3/amd64/amd64/identcpu.c Thu Oct 14 15:15:22 2010 (r213837) +++ user/nwhitehorn/ps3/amd64/amd64/identcpu.c Thu Oct 14 15:42:32 2010 (r213838) @@ -278,7 +278,7 @@ printcpuinfo(void) "\017xTPR" /* Send Task Priority Messages*/ "\020PDCM" /* Perf/Debug Capability MSR */ "\021" - "\022" + "\022PCID" /* Process-context Identifiers */ "\023DCA" /* Direct Cache Access */ "\024SSE4.1" "\025SSE4.2" Modified: user/nwhitehorn/ps3/amd64/amd64/machdep.c ============================================================================== --- user/nwhitehorn/ps3/amd64/amd64/machdep.c Thu Oct 14 15:15:22 2010 (r213837) +++ user/nwhitehorn/ps3/amd64/amd64/machdep.c Thu Oct 14 15:42:32 2010 (r213838) @@ -795,7 +795,8 @@ idle_sysctl_available(SYSCTL_HANDLER_ARG if (strcmp(idle_tbl[i].id_name, "acpi") == 0 && cpu_idle_hook == NULL) continue; - p += sprintf(p, "%s, ", idle_tbl[i].id_name); + p += sprintf(p, "%s%s", p != avail ? ", " : "", + idle_tbl[i].id_name); } error = sysctl_handle_string(oidp, avail, 0, req); free(avail, M_TEMP); @@ -1799,7 +1800,7 @@ makectx(struct trapframe *tf, struct pcb pcb->pcb_rbp = tf->tf_rbp; pcb->pcb_rbx = tf->tf_rbx; pcb->pcb_rip = tf->tf_rip; - pcb->pcb_rsp = (ISPL(tf->tf_cs)) ? tf->tf_rsp : (long)(tf + 1) - 8; + pcb->pcb_rsp = tf->tf_rsp; } int Modified: user/nwhitehorn/ps3/amd64/amd64/mp_machdep.c ============================================================================== --- user/nwhitehorn/ps3/amd64/amd64/mp_machdep.c Thu Oct 14 15:15:22 2010 (r213837) +++ user/nwhitehorn/ps3/amd64/amd64/mp_machdep.c Thu Oct 14 15:42:32 2010 (r213838) @@ -126,7 +126,6 @@ extern inthand_t IDTVEC(fast_syscall), I * Local data and functions. */ -static u_int logical_cpus; static volatile cpumask_t ipi_nmi_pending; /* used to hold the AP's until we are ready to release them */ @@ -152,8 +151,8 @@ int apic_cpuids[MAX_APIC_ID + 1]; static volatile u_int cpu_ipi_pending[MAXCPU]; static u_int boot_address; -static int cpu_logical; -static int cpu_cores; +static int cpu_logical; /* logical cpus per core */ +static int cpu_cores; /* cores per package */ static void assign_cpu_ids(void); static void set_interrupt_apic_ids(void); @@ -162,7 +161,7 @@ static int start_ap(int apic_id); static void release_aps(void *dummy); static int hlt_logical_cpus; -static u_int hyperthreading_cpus; +static u_int hyperthreading_cpus; /* logical cpus sharing L1 cache */ static cpumask_t hyperthreading_cpus_mask; static int hyperthreading_allowed = 1; static struct sysctl_ctx_list logical_cpu_clist; @@ -176,24 +175,105 @@ mem_range_AP_init(void) } static void +topo_probe_amd(void) +{ + + /* AMD processors do not support HTT. */ + cpu_cores = (amd_feature2 & AMDID2_CMP) != 0 ? + (cpu_procinfo2 & AMDID_CMP_CORES) + 1 : 1; + cpu_logical = 1; +} + +/* + * Round up to the next power of two, if necessary, and then + * take log2. + * Returns -1 if argument is zero. + */ +static __inline int +mask_width(u_int x) +{ + + return (fls(x << (1 - powerof2(x))) - 1); +} + +static void +topo_probe_0x4(void) +{ + u_int p[4]; + int pkg_id_bits; + int core_id_bits; + int max_cores; + int max_logical; + int id; + + /* Both zero and one here mean one logical processor per package. */ + max_logical = (cpu_feature & CPUID_HTT) != 0 ? + (cpu_procinfo & CPUID_HTT_CORES) >> 16 : 1; + if (max_logical <= 1) + return; + + /* + * Because of uniformity assumption we examine only + * those logical processors that belong to the same + * package as BSP. Further, we count number of + * logical processors that belong to the same core + * as BSP thus deducing number of threads per core. + */ + cpuid_count(0x04, 0, p); + max_cores = ((p[0] >> 26) & 0x3f) + 1; + core_id_bits = mask_width(max_logical/max_cores); + if (core_id_bits < 0) + return; + pkg_id_bits = core_id_bits + mask_width(max_cores); + + for (id = 0; id <= MAX_APIC_ID; id++) { + /* Check logical CPU availability. */ + if (!cpu_info[id].cpu_present || cpu_info[id].cpu_disabled) + continue; + /* Check if logical CPU has the same package ID. */ + if ((id >> pkg_id_bits) != (boot_cpu_id >> pkg_id_bits)) + continue; + cpu_cores++; + /* Check if logical CPU has the same package and core IDs. */ + if ((id >> core_id_bits) == (boot_cpu_id >> core_id_bits)) + cpu_logical++; + } + + cpu_cores /= cpu_logical; + hyperthreading_cpus = cpu_logical; +} + +static void topo_probe_0xb(void) { - int logical; - int p[4]; + u_int p[4]; int bits; - int type; int cnt; int i; + int logical; + int type; int x; - /* We only support two levels for now. */ + /* We only support three levels for now. */ for (i = 0; i < 3; i++) { - cpuid_count(0x0B, i, p); + cpuid_count(0x0b, i, p); + + /* Fall back if CPU leaf 11 doesn't really exist. */ + if (i == 0 && p[1] == 0) { + topo_probe_0x4(); + return; + } + bits = p[0] & 0x1f; logical = p[1] &= 0xffff; type = (p[2] >> 8) & 0xff; if (type == 0 || logical == 0) break; + /* + * Because of uniformity assumption we examine only + * those logical processors that belong to the same + * package as BSP. + */ for (cnt = 0, x = 0; x <= MAX_APIC_ID; x++) { if (!cpu_info[x].cpu_present || cpu_info[x].cpu_disabled) @@ -211,76 +291,16 @@ topo_probe_0xb(void) cpu_cores /= cpu_logical; } -static void -topo_probe_0x4(void) -{ - u_int threads_per_cache, p[4]; - u_int htt, cmp; - int i; - - htt = cmp = 1; - /* - * If this CPU supports HTT or CMP then mention the - * number of physical/logical cores it contains. - */ - if (cpu_feature & CPUID_HTT) - htt = (cpu_procinfo & CPUID_HTT_CORES) >> 16; - if (cpu_vendor_id == CPU_VENDOR_AMD && (amd_feature2 & AMDID2_CMP)) - cmp = (cpu_procinfo2 & AMDID_CMP_CORES) + 1; - else if (cpu_vendor_id == CPU_VENDOR_INTEL && (cpu_high >= 4)) { - cpuid_count(4, 0, p); - if ((p[0] & 0x1f) != 0) - cmp = ((p[0] >> 26) & 0x3f) + 1; - } - cpu_cores = cmp; - cpu_logical = htt / cmp; - - /* Setup the initial logical CPUs info. */ - if (cpu_feature & CPUID_HTT) - logical_cpus = (cpu_procinfo & CPUID_HTT_CORES) >> 16; - - /* - * Work out if hyperthreading is *really* enabled. This - * is made really ugly by the fact that processors lie: Dual - * core processors claim to be hyperthreaded even when they're - * not, presumably because they want to be treated the same - * way as HTT with respect to per-cpu software licensing. - * At the time of writing (May 12, 2005) the only hyperthreaded - * cpus are from Intel, and Intel's dual-core processors can be - * identified via the "deterministic cache parameters" cpuid - * calls. - */ - /* - * First determine if this is an Intel processor which claims - * to have hyperthreading support. - */ - if ((cpu_feature & CPUID_HTT) && cpu_vendor_id == CPU_VENDOR_INTEL) { - /* - * If the "deterministic cache parameters" cpuid calls - * are available, use them. - */ - if (cpu_high >= 4) { - /* Ask the processor about the L1 cache. */ - for (i = 0; i < 1; i++) { - cpuid_count(4, i, p); - threads_per_cache = ((p[0] & 0x3ffc000) >> 14) + 1; - if (hyperthreading_cpus < threads_per_cache) - hyperthreading_cpus = threads_per_cache; - if ((p[0] & 0x1f) == 0) - break; - } - } - - /* - * If the deterministic cache parameters are not - * available, or if no caches were reported to exist, - * just accept what the HTT flag indicated. - */ - if (hyperthreading_cpus == 0) - hyperthreading_cpus = logical_cpus; - } -} - +/* + * Both topology discovery code and code that consumes topology + * information assume top-down uniformity of the topology. + * That is, all physical packages must be identical and each + * core in a package must have the same number of threads. + * Topology information is queried only on BSP, on which this + * code runs and for which it can query CPUID information. + * Then topology is extrapolated on all packages using the + * uniformity assumption. + */ static void topo_probe(void) { @@ -289,13 +309,31 @@ topo_probe(void) if (cpu_topo_probed) return; - logical_cpus = logical_cpus_mask = 0; - if (cpu_high >= 0xb) - topo_probe_0xb(); - else if (cpu_high) - topo_probe_0x4(); + logical_cpus_mask = 0; + if (cpu_vendor_id == CPU_VENDOR_AMD) + topo_probe_amd(); + else if (cpu_vendor_id == CPU_VENDOR_INTEL) { + /* + * See Intel(R) 64 Architecture Processor + * Topology Enumeration article for details. + * + * Note that 0x1 <= cpu_high < 4 case should be + * compatible with topo_probe_0x4() logic when + * CPUID.1:EBX[23:16] > 0 (cpu_cores will be 1) + * or it should trigger the fallback otherwise. + */ + if (cpu_high >= 0xb) + topo_probe_0xb(); + else if (cpu_high >= 0x1) + topo_probe_0x4(); + } + + /* + * Fallback: assume each logical CPU is in separate + * physical package. That is, no multi-core, no SMT. + */ if (cpu_cores == 0) - cpu_cores = mp_ncpus > 0 ? mp_ncpus : 1; + cpu_cores = 1; if (cpu_logical == 0) cpu_logical = 1; cpu_topo_probed = 1; @@ -675,7 +713,8 @@ init_secondary(void) printf("SMP: AP CPU #%d Launched!\n", PCPU_GET(cpuid)); /* Determine if we are a logical CPU. */ - if (logical_cpus > 1 && PCPU_GET(apic_id) % logical_cpus != 0) + /* XXX Calculation depends on cpu_logical being a power of 2, e.g. 2 */ + if (cpu_logical > 1 && PCPU_GET(apic_id) % cpu_logical != 0) logical_cpus_mask |= PCPU_GET(cpumask); /* Determine if we are a hyperthread. */ Modified: user/nwhitehorn/ps3/amd64/conf/GENERIC ============================================================================== --- user/nwhitehorn/ps3/amd64/conf/GENERIC Thu Oct 14 15:15:22 2010 (r213837) +++ user/nwhitehorn/ps3/amd64/conf/GENERIC Thu Oct 14 15:42:32 2010 (r213838) @@ -55,7 +55,6 @@ options STACK # stack(9) support options SYSVSHM # SYSV-style shared memory options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores -options P1003_1B_SEMAPHORES # POSIX-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. options KBD_INSTALL_CDEV # install a CDEV entry in /dev Modified: user/nwhitehorn/ps3/amd64/conf/NOTES ============================================================================== --- user/nwhitehorn/ps3/amd64/conf/NOTES Thu Oct 14 15:15:22 2010 (r213837) +++ user/nwhitehorn/ps3/amd64/conf/NOTES Thu Oct 14 15:42:32 2010 (r213838) @@ -421,6 +421,7 @@ options SAFE_RNDTEST # enable rndtest s # vpd: Vital Product Data kernel interface # asmc: Apple System Management Controller # si: Specialix International SI/XIO or SX intelligent serial card +# tpm: Trusted Platform Module # Notes on the Specialix SI/XIO driver: # The host card is memory, not IO mapped. @@ -436,6 +437,7 @@ device smbios device vpd device asmc #device si +device tpm # # Laptop/Notebook options: Modified: user/nwhitehorn/ps3/amd64/include/specialreg.h ============================================================================== --- user/nwhitehorn/ps3/amd64/include/specialreg.h Thu Oct 14 15:15:22 2010 (r213837) +++ user/nwhitehorn/ps3/amd64/include/specialreg.h Thu Oct 14 15:42:32 2010 (r213838) @@ -126,6 +126,7 @@ #define CPUID2_CX16 0x00002000 #define CPUID2_XTPR 0x00004000 #define CPUID2_PDCM 0x00008000 +#define CPUID2_PCID 0x00020000 #define CPUID2_DCA 0x00040000 #define CPUID2_SSE41 0x00080000 #define CPUID2_SSE42 0x00100000 Modified: user/nwhitehorn/ps3/amd64/include/vmparam.h ============================================================================== --- user/nwhitehorn/ps3/amd64/include/vmparam.h Thu Oct 14 15:15:22 2010 (r213837) +++ user/nwhitehorn/ps3/amd64/include/vmparam.h Thu Oct 14 15:42:32 2010 (r213838) @@ -205,7 +205,7 @@ * is the total KVA space allocated for kmem_map. */ #ifndef VM_KMEM_SIZE_SCALE -#define VM_KMEM_SIZE_SCALE (3) +#define VM_KMEM_SIZE_SCALE (1) #endif /* Modified: user/nwhitehorn/ps3/amd64/linux32/linux32_proto.h ============================================================================== --- user/nwhitehorn/ps3/amd64/linux32/linux32_proto.h Thu Oct 14 15:15:22 2010 (r213837) +++ user/nwhitehorn/ps3/amd64/linux32/linux32_proto.h Thu Oct 14 15:42:32 2010 (r213838) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 210431 2010-07-23 21:30:33Z kib + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 213544 2010-10-08 07:18:44Z kib */ #ifndef _LINUX_SYSPROTO_H_ Modified: user/nwhitehorn/ps3/amd64/linux32/linux32_syscall.h ============================================================================== --- user/nwhitehorn/ps3/amd64/linux32/linux32_syscall.h Thu Oct 14 15:15:22 2010 (r213837) +++ user/nwhitehorn/ps3/amd64/linux32/linux32_syscall.h Thu Oct 14 15:42:32 2010 (r213838) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 210431 2010-07-23 21:30:33Z kib + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 213544 2010-10-08 07:18:44Z kib */ #define LINUX_SYS_exit 1 Modified: user/nwhitehorn/ps3/amd64/linux32/linux32_sysent.c ============================================================================== --- user/nwhitehorn/ps3/amd64/linux32/linux32_sysent.c Thu Oct 14 15:15:22 2010 (r213837) +++ user/nwhitehorn/ps3/amd64/linux32/linux32_sysent.c Thu Oct 14 15:42:32 2010 (r213838) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 210431 2010-07-23 21:30:33Z kib + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 213544 2010-10-08 07:18:44Z kib */ #include "opt_compat.h" @@ -267,7 +267,7 @@ struct sysent linux_sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 245 = linux_io_setup */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 246 = linux_io_destroy */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 247 = linux_io_getevents */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 248 = inux_io_submit */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 248 = linux_io_submit */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 249 = linux_io_cancel */ { 0, (sy_call_t *)linux_fadvise64, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 250 = linux_fadvise64 */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 251 = */ Modified: user/nwhitehorn/ps3/amd64/linux32/linux32_sysvec.c ============================================================================== --- user/nwhitehorn/ps3/amd64/linux32/linux32_sysvec.c Thu Oct 14 15:15:22 2010 (r213837) +++ user/nwhitehorn/ps3/amd64/linux32/linux32_sysvec.c Thu Oct 14 15:42:32 2010 (r213838) @@ -1210,4 +1210,4 @@ static moduledata_t linux_elf_mod = { 0 }; -DECLARE_MODULE(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); +DECLARE_MODULE_TIED(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); Modified: user/nwhitehorn/ps3/amd64/linux32/syscalls.master ============================================================================== --- user/nwhitehorn/ps3/amd64/linux32/syscalls.master Thu Oct 14 15:15:22 2010 (r213837) +++ user/nwhitehorn/ps3/amd64/linux32/syscalls.master Thu Oct 14 15:42:32 2010 (r213838) @@ -416,7 +416,7 @@ 245 AUE_NULL UNIMPL linux_io_setup 246 AUE_NULL UNIMPL linux_io_destroy 247 AUE_NULL UNIMPL linux_io_getevents -248 AUE_NULL UNIMPL inux_io_submit +248 AUE_NULL UNIMPL linux_io_submit 249 AUE_NULL UNIMPL linux_io_cancel 250 AUE_NULL STD { int linux_fadvise64(void); } 251 AUE_NULL UNIMPL Modified: user/nwhitehorn/ps3/arm/arm/cpufunc.c ============================================================================== --- user/nwhitehorn/ps3/arm/arm/cpufunc.c Thu Oct 14 15:15:22 2010 (r213837) +++ user/nwhitehorn/ps3/arm/arm/cpufunc.c Thu Oct 14 15:42:32 2010 (r213838) @@ -397,7 +397,7 @@ struct cpu_functions sheeva_cpufuncs = { cpufunc_nullop, /* flush_brnchtgt_C */ (void *)cpufunc_nullop, /* flush_brnchtgt_E */ - (void *)cpufunc_nullop, /* sleep */ + sheeva_cpu_sleep, /* sleep */ /* Soft functions */ @@ -1076,6 +1076,9 @@ set_cpufuncs() FC_DCACHE_STREAM_EN | FC_WR_ALLOC_EN | FC_BRANCH_TARG_BUF_DIS | FC_L2CACHE_EN); } + + /* Use powersave on this CPU. */ + cpu_do_powersave = 1; } else cpufuncs = armv5_ec_cpufuncs; Modified: user/nwhitehorn/ps3/arm/arm/cpufunc_asm_sheeva.S ============================================================================== --- user/nwhitehorn/ps3/arm/arm/cpufunc_asm_sheeva.S Thu Oct 14 15:15:22 2010 (r213837) +++ user/nwhitehorn/ps3/arm/arm/cpufunc_asm_sheeva.S Thu Oct 14 15:42:32 2010 (r213838) @@ -392,3 +392,10 @@ ENTRY(sheeva_control_ext) mcrne p15, 1, r2, c15, c1, 0 /* Write new control register */ mov r0, r3 /* Return old value */ RET + +ENTRY(sheeva_cpu_sleep) + mov r0, #0 + mcr p15, 0, r0, c7, c10, 4 /* Drain write buffer */ + mcr p15, 0, r0, c7, c0, 4 /* Wait for interrupt */ + mov pc, lr + Modified: user/nwhitehorn/ps3/arm/at91/at91.c ============================================================================== --- user/nwhitehorn/ps3/arm/at91/at91.c Thu Oct 14 15:15:22 2010 (r213837) +++ user/nwhitehorn/ps3/arm/at91/at91.c Thu Oct 14 15:42:32 2010 (r213838) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2005 Olivier Houchard. All rights reserved. + * Copyright (c) 2010 Greg Ansley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -43,14 +44,23 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include +#include static struct at91_softc *at91_softc; static void at91_eoi(void *); +extern const struct pmap_devmap at91_devmap[]; + +uint32_t at91_chip_id; + +#ifdef AT91C_MASTER_CLOCK uint32_t at91_master_clock = AT91C_MASTER_CLOCK; +#else +uint32_t at91_master_clock; +#endif static int at91_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags, @@ -99,6 +109,19 @@ at91_barrier(void *t, bus_space_handle_t { } +struct arm32_dma_range * +bus_dma_get_range(void) +{ + + return (NULL); +} + +int +bus_dma_get_range_nb(void) +{ + return (0); +} + bs_protos(generic); bs_protos(generic_armv4); @@ -212,6 +235,7 @@ struct bus_space at91_bs_tag = { static int at91_probe(device_t dev) { + device_set_desc(dev, "AT91 device bus"); arm_post_filter = at91_eoi; return (0); @@ -224,324 +248,38 @@ at91_identify(driver_t *drv, device_t pa BUS_ADD_CHILD(parent, 0, "atmelarm", 0); } -struct arm32_dma_range * -bus_dma_get_range(void) -{ - - return (NULL); -} - -int -bus_dma_get_range_nb(void) -{ - return (0); -} - -extern void irq_entry(void); - -static void -at91_add_child(device_t dev, int prio, const char *name, int unit, - bus_addr_t addr, bus_size_t size, int irq0, int irq1, int irq2) -{ - device_t kid; - struct at91_ivar *ivar; - - kid = device_add_child_ordered(dev, prio, name, unit); - if (kid == NULL) { - printf("Can't add child %s%d ordered\n", name, unit); - return; - } - ivar = malloc(sizeof(*ivar), M_DEVBUF, M_NOWAIT | M_ZERO); - if (ivar == NULL) { - device_delete_child(dev, kid); - printf("Can't add alloc ivar\n"); - return; - } - device_set_ivars(kid, ivar); - resource_list_init(&ivar->resources); - if (irq0 != -1) - bus_set_resource(kid, SYS_RES_IRQ, 0, irq0, 1); - if (irq1 != 0) - bus_set_resource(kid, SYS_RES_IRQ, 1, irq1, 1); - if (irq2 != 0) - bus_set_resource(kid, SYS_RES_IRQ, 2, irq2, 1); - if (addr != 0) - bus_set_resource(kid, SYS_RES_MEMORY, 0, addr, size); -} - -struct cpu_devs -{ - const char *name; - int unit; - bus_addr_t mem_base; - bus_size_t mem_len; - int irq0; - int irq1; - int irq2; -}; - -struct cpu_devs at91rm9200_devs[] = -{ - // All the "system" devices - { - "at91_st", 0, - AT91RM92_BASE + AT91RM92_ST_BASE, AT91RM92_ST_SIZE, - AT91RM92_IRQ_SYSTEM - }, - { - "at91_pio", 0, - AT91RM92_BASE + AT91RM92_PIOA_BASE, AT91RM92_PIO_SIZE, - AT91RM92_IRQ_SYSTEM - }, - { - "at91_pio", 1, - AT91RM92_BASE + AT91RM92_PIOB_BASE, AT91RM92_PIO_SIZE, - AT91RM92_IRQ_SYSTEM - }, - { - "at91_pio", 2, - AT91RM92_BASE + AT91RM92_PIOC_BASE, AT91RM92_PIO_SIZE, - AT91RM92_IRQ_SYSTEM - }, - { - "at91_pio", 3, - AT91RM92_BASE + AT91RM92_PIOD_BASE, AT91RM92_PIO_SIZE, - AT91RM92_IRQ_SYSTEM - }, - { - "at91_pmc", 0, - AT91RM92_BASE + AT91RM92_PMC_BASE, AT91RM92_PMC_SIZE, - AT91RM92_IRQ_SYSTEM - }, - { - "at91_aic", 0, - AT91RM92_BASE + AT91RM92_AIC_BASE, AT91RM92_AIC_SIZE, - 0 // Interrupt controller has no interrupts! - }, - { - "at91_rtc", 0, - AT91RM92_BASE + AT91RM92_RTC_BASE, AT91RM92_RTC_SIZE, - AT91RM92_IRQ_SYSTEM - }, - { - "at91_mc", 0, - AT91RM92_BASE + AT91RM92_MC_BASE, AT91RM92_MC_SIZE, - AT91RM92_IRQ_SYSTEM - }, - - // All other devices - { - "at91_tc", 0, - AT91RM92_BASE + AT91RM92_TC0_BASE, AT91RM92_TC_SIZE, - AT91RM92_IRQ_TC0, AT91RM92_IRQ_TC1, AT91RM92_IRQ_TC2 - }, - { - "at91_tc", 1, - AT91RM92_BASE + AT91RM92_TC1_BASE, AT91RM92_TC_SIZE, - AT91RM92_IRQ_TC3, AT91RM92_IRQ_TC4, AT91RM92_IRQ_TC5 - }, - { - "at91_udp", 0, - AT91RM92_BASE + AT91RM92_UDP_BASE, AT91RM92_UDP_SIZE, - AT91RM92_IRQ_UDP, AT91RM92_IRQ_PIOB - }, - { - "at91_mci", 0, - AT91RM92_BASE + AT91RM92_MCI_BASE, AT91RM92_MCI_SIZE, - AT91RM92_IRQ_MCI - }, - { - "at91_twi", 0, - AT91RM92_BASE + AT91RM92_TWI_BASE, AT91RM92_TWI_SIZE, - AT91RM92_IRQ_TWI - }, - { - "ate", 0, - AT91RM92_BASE + AT91RM92_EMAC_BASE, AT91RM92_EMAC_SIZE, - AT91RM92_IRQ_EMAC - }, -#ifndef SKYEYE_WORKAROUNDS - { - "uart", 0, - AT91RM92_BASE + AT91RM92_DBGU_BASE, AT91RM92_DBGU_SIZE, - AT91RM92_IRQ_SYSTEM - }, - { - "uart", 1, - AT91RM92_BASE + AT91RM92_USART0_BASE, AT91RM92_USART_SIZE, - AT91RM92_IRQ_USART0 - }, - { - "uart", 2, - AT91RM92_BASE + AT91RM92_USART1_BASE, AT91RM92_USART_SIZE, - AT91RM92_IRQ_USART1 - }, - { - "uart", 3, - AT91RM92_BASE + AT91RM92_USART2_BASE, AT91RM92_USART_SIZE, - AT91RM92_IRQ_USART2 - }, - { - "uart", 4, - AT91RM92_BASE + AT91RM92_USART3_BASE, AT91RM92_USART_SIZE, - AT91RM92_IRQ_USART3 - }, -#else - { - "uart", 0, - AT91RM92_BASE + AT91RM92_USART0_BASE, AT91RM92_USART_SIZE, - AT91RM92_IRQ_USART0 - }, -#endif - { - "at91_ssc", 0, - AT91RM92_BASE + AT91RM92_SSC0_BASE, AT91RM92_SSC_SIZE, - AT91RM92_IRQ_SSC0 - }, - { - "at91_ssc", 1, - AT91RM92_BASE + AT91RM92_SSC1_BASE, AT91RM92_SSC_SIZE, - AT91RM92_IRQ_SSC1 - }, - { - "at91_ssc", 2, - AT91RM92_BASE + AT91RM92_SSC2_BASE, AT91RM92_SSC_SIZE, - AT91RM92_IRQ_SSC2 - }, - { - "spi", 0, - AT91RM92_BASE + AT91RM92_SPI_BASE, AT91RM92_SPI_SIZE, - AT91RM92_IRQ_SPI - }, - { - "ohci", 0, - AT91RM92_OHCI_BASE, AT91RM92_OHCI_SIZE, - AT91RM92_IRQ_UHP - }, - { - "at91_cfata", 0, - AT91RM92_CF_BASE, AT91RM92_CF_SIZE, - -1 - }, - { 0, 0, 0, 0, 0 } -}; - -static void -at91_cpu_add_builtin_children(device_t dev, struct at91_softc *sc) -{ - int i; - struct cpu_devs *walker; - - // XXX should look at the device id in the DBGU register and - // XXX based on the CPU load in these devices - for (i = 0, walker = at91rm9200_devs; walker->name; i++, walker++) { - at91_add_child(dev, i, walker->name, walker->unit, - walker->mem_base, walker->mem_len, walker->irq0, - walker->irq1, walker->irq2); - } -} - -#define NORMDEV 50 - -/* - * Standard priority levels for the system. 0 is lowest and 7 is highest. - * These values are the ones Atmel uses for its Linux port, which differ - * a little form the ones that are in the standard distribution. Also, - * the ones marked with 'TWEEK' are different based on experience. - */ -static int irq_prio[32] = -{ - 7, /* Advanced Interrupt Controller (FIQ) */ - 7, /* System Peripherals */ - 1, /* Parallel IO Controller A */ - 1, /* Parallel IO Controller B */ - 1, /* Parallel IO Controller C */ - 1, /* Parallel IO Controller D */ - 5, /* USART 0 */ - 5, /* USART 1 */ - 5, /* USART 2 */ - 5, /* USART 3 */ - 0, /* Multimedia Card Interface */ - 2, /* USB Device Port */ - 4, /* Two-Wire Interface */ /* TWEEK */ - 5, /* Serial Peripheral Interface */ - 4, /* Serial Synchronous Controller 0 */ - 6, /* Serial Synchronous Controller 1 */ /* TWEEK */ - 4, /* Serial Synchronous Controller 2 */ - 0, /* Timer Counter 0 */ - 6, /* Timer Counter 1 */ /* TWEEK */ - 0, /* Timer Counter 2 */ - 0, /* Timer Counter 3 */ - 0, /* Timer Counter 4 */ - 0, /* Timer Counter 5 */ - 2, /* USB Host port */ - 3, /* Ethernet MAC */ - 0, /* Advanced Interrupt Controller (IRQ0) */ - 0, /* Advanced Interrupt Controller (IRQ1) */ - 0, /* Advanced Interrupt Controller (IRQ2) */ - 0, /* Advanced Interrupt Controller (IRQ3) */ - 0, /* Advanced Interrupt Controller (IRQ4) */ - 0, /* Advanced Interrupt Controller (IRQ5) */ - 0 /* Advanced Interrupt Controller (IRQ6) */ -}; - static int at91_attach(device_t dev) { struct at91_softc *sc = device_get_softc(dev); - int i; + const struct pmap_devmap *pdevmap; at91_softc = sc; sc->sc_st = &at91_bs_tag; - sc->sc_sh = AT91RM92_BASE; + sc->sc_sh = AT91_BASE; sc->dev = dev; - if (bus_space_subregion(sc->sc_st, sc->sc_sh, AT91RM92_SYS_BASE, - AT91RM92_SYS_SIZE, &sc->sc_sys_sh) != 0) - panic("Enable to map IRQ registers"); + sc->sc_irq_rman.rm_type = RMAN_ARRAY; sc->sc_irq_rman.rm_descr = "AT91 IRQs"; - sc->sc_mem_rman.rm_type = RMAN_ARRAY; - sc->sc_mem_rman.rm_descr = "AT91 Memory"; if (rman_init(&sc->sc_irq_rman) != 0 || rman_manage_region(&sc->sc_irq_rman, 1, 31) != 0) panic("at91_attach: failed to set up IRQ rman"); - if (rman_init(&sc->sc_mem_rman) != 0 || - rman_manage_region(&sc->sc_mem_rman, 0xdff00000ul, - 0xdffffffful) != 0) + + sc->sc_mem_rman.rm_type = RMAN_ARRAY; + sc->sc_mem_rman.rm_descr = "AT91 Memory"; + if (rman_init(&sc->sc_mem_rman) != 0) panic("at91_attach: failed to set up memory rman"); - if (rman_manage_region(&sc->sc_mem_rman, AT91RM92_OHCI_BASE, - AT91RM92_OHCI_BASE + AT91RM92_OHCI_SIZE - 1) != 0) - panic("at91_attach: failed to set up ohci memory"); - if (rman_manage_region(&sc->sc_mem_rman, AT91RM92_CF_BASE, - AT91RM92_CF_BASE + AT91RM92_CF_SIZE - 1) != 0) - panic("at91_attach: failed to set up CompactFlash ATA memory"); - - for (i = 0; i < 32; i++) { - bus_space_write_4(sc->sc_st, sc->sc_sys_sh, IC_SVR + - i * 4, i); - /* Priority. */ - bus_space_write_4(sc->sc_st, sc->sc_sys_sh, IC_SMR + i * 4, - irq_prio[i]); - if (i < 8) - bus_space_write_4(sc->sc_st, sc->sc_sys_sh, IC_EOICR, - 1); + for ( pdevmap = at91_devmap; pdevmap->pd_va != 0; pdevmap++) { + if (rman_manage_region(&sc->sc_mem_rman, pdevmap->pd_va, + pdevmap->pd_va + pdevmap->pd_size - 1) != 0) + panic("at91_attach: failed to set up memory rman"); } - bus_space_write_4(sc->sc_st, sc->sc_sys_sh, IC_SPU, 32); - /* No debug. */ - bus_space_write_4(sc->sc_st, sc->sc_sys_sh, IC_DCR, 0); - /* Disable and clear all interrupts. */ - bus_space_write_4(sc->sc_st, sc->sc_sys_sh, IC_IDCR, 0xffffffff); - bus_space_write_4(sc->sc_st, sc->sc_sys_sh, IC_ICCR, 0xffffffff); - - /* XXX */ - /* Disable all interrupts for RTC (0xe24 == RTC_IDR) */ - bus_space_write_4(sc->sc_st, sc->sc_sys_sh, 0xe24, 0xffffffff); - /* DIsable all interrupts for DBGU */ - bus_space_write_4(sc->sc_st, sc->sc_sys_sh, 0x20c, 0xffffffff); - /* Disable all interrupts for the SDRAM controller */ - bus_space_write_4(sc->sc_st, sc->sc_sys_sh, 0xfa8, 0xffffffff); - at91_cpu_add_builtin_children(dev, sc); + + /* Our device list will be added automatically by the cpu device + * e.g. at91rm9200.c when it is identified. To ensure that the + * CPU and PMC are attached first any other "identified" devices + * call BUS_ADD_CHILD(9) with an "order" of at least 2. */ bus_generic_probe(dev); bus_generic_attach(dev); @@ -630,11 +368,11 @@ at91_setup_intr(device_t dev, device_t c { struct at91_softc *sc = device_get_softc(dev); - if (rman_get_start(ires) == AT91RM92_IRQ_SYSTEM && filt == NULL) + if (rman_get_start(ires) == sc->sc_irq_system && filt == NULL) panic("All system interrupt ISRs must be FILTER"); BUS_SETUP_INTR(device_get_parent(dev), child, ires, flags, filt, intr, arg, cookiep); - bus_space_write_4(sc->sc_st, sc->sc_sys_sh, IC_IECR, + bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_IECR, 1 << rman_get_start(ires)); return (0); } @@ -645,7 +383,7 @@ at91_teardown_intr(device_t dev, device_ { struct at91_softc *sc = device_get_softc(dev); - bus_space_write_4(sc->sc_st, sc->sc_sys_sh, IC_IDCR, + bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_IDCR, 1 << rman_get_start(res)); return (BUS_TEARDOWN_INTR(device_get_parent(dev), child, res, cookie)); } @@ -697,8 +435,7 @@ arm_mask_irq(uintptr_t nb) { bus_space_write_4(at91_softc->sc_st, - at91_softc->sc_sys_sh, IC_IDCR, 1 << nb); - + at91_softc->sc_aic_sh, IC_IDCR, 1 << nb); } int @@ -708,12 +445,12 @@ arm_get_next_irq(int last __unused) int irq; irq = bus_space_read_4(at91_softc->sc_st, - at91_softc->sc_sys_sh, IC_IVR); + at91_softc->sc_aic_sh, IC_IVR); status = bus_space_read_4(at91_softc->sc_st, - at91_softc->sc_sys_sh, IC_ISR); + at91_softc->sc_aic_sh, IC_ISR); if (status == 0) { bus_space_write_4(at91_softc->sc_st, - at91_softc->sc_sys_sh, IC_EOICR, 1); + at91_softc->sc_aic_sh, IC_EOICR, 1); return (-1); } return (irq); @@ -724,16 +461,15 @@ arm_unmask_irq(uintptr_t nb) { bus_space_write_4(at91_softc->sc_st, - at91_softc->sc_sys_sh, IC_IECR, 1 << nb); - bus_space_write_4(at91_softc->sc_st, at91_softc->sc_sys_sh, + at91_softc->sc_aic_sh, IC_IECR, 1 << nb); + bus_space_write_4(at91_softc->sc_st, at91_softc->sc_aic_sh, IC_EOICR, 0); - } static void at91_eoi(void *unused) { - bus_space_write_4(at91_softc->sc_st, at91_softc->sc_sys_sh, + bus_space_write_4(at91_softc->sc_st, at91_softc->sc_aic_sh, IC_EOICR, 0); } @@ -761,6 +497,7 @@ static driver_t at91_driver = { at91_methods, sizeof(struct at91_softc), }; + static devclass_t at91_devclass; DRIVER_MODULE(atmelarm, nexus, at91_driver, at91_devclass, 0, 0); Modified: user/nwhitehorn/ps3/arm/at91/at91_machdep.c ============================================================================== --- user/nwhitehorn/ps3/arm/at91/at91_machdep.c Thu Oct 14 15:15:22 2010 (r213837) +++ user/nwhitehorn/ps3/arm/at91/at91_machdep.c Thu Oct 14 15:42:32 2010 (r213838) @@ -90,9 +90,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include -#include -#include +#include +#include #define KERNEL_PT_SYS 0 /* Page table for mapping proc0 zero page */ #define KERNEL_PT_KERN 1 @@ -140,7 +141,7 @@ static void *boot_arg2; static struct trapframe proc0_tf; /* Static device mappings. */ -static const struct pmap_devmap at91rm9200_devmap[] = { +const struct pmap_devmap at91_devmap[] = { /* * Map the on-board devices VA == PA so that we can access them * with the MMU on or off. @@ -153,60 +154,88 @@ static const struct pmap_devmap at91rm92 */ 0xdff00000, 0xfff00000, - 0x100000, + 0x00100000, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, - /* - * We can't just map the OHCI registers VA == PA, because - * AT91RM92_OHCI_BASE belongs to the userland address space. + /* We can't just map the OHCI registers VA == PA, because + * AT91xx_xxx_BASE belongs to the userland address space. * We could just choose a different virtual address, but a better * solution would probably be to just use pmap_mapdev() to allocate * KVA, as we don't need the OHCI controller before the vm * initialization is done. However, the AT91 resource allocation * system doesn't know how to use pmap_mapdev() yet. + * Care must be taken to ensure PA and VM address do not overlap + * between entries. */ { /* * Add the ohci controller, and anything else that might be * on this chip select for a VA/PA mapping. */ + /* Internal Memory 1MB */ AT91RM92_OHCI_BASE, AT91RM92_OHCI_PA_BASE, - AT91RM92_OHCI_SIZE, + 0x00100000, VM_PROT_READ|VM_PROT_WRITE, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Thu Oct 14 20:04: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 71ED9106564A; Thu, 14 Oct 2010 20:04:05 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 606F28FC12; Thu, 14 Oct 2010 20:04: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 o9EK45dn035373; Thu, 14 Oct 2010 20:04:05 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9EK458X035369; Thu, 14 Oct 2010 20:04:05 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010142004.o9EK458X035369@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 14 Oct 2010 20:04: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: r213847 - user/weongyo/usb/sys/dev/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: Thu, 14 Oct 2010 20:04:05 -0000 Author: weongyo Date: Thu Oct 14 20:04:05 2010 New Revision: 213847 URL: http://svn.freebsd.org/changeset/base/213847 Log: Hooks the USB transfer taps at two points that one of them is at usbd_pipe_start() where is a location before calling the host controller-dependent code which normally enqueues a xfer into scheduler then adds it into the interrupt queue. It means it hooks all USB transfers before going into the interrupt queue. Other is at usbd_callback_wrapper() where is a function to call the developer-defined callback with status, USB_ST_TRANSFERRED or USB_ST_ERROR that we don't tap if the status is USB_ST_SETUP. Currently sizeof(struct usbpf_pkthdr) == 128 bytes for further works. Modified: user/weongyo/usb/sys/dev/usb/usb_pf.c user/weongyo/usb/sys/dev/usb/usb_pf.h user/weongyo/usb/sys/dev/usb/usb_transfer.c Modified: user/weongyo/usb/sys/dev/usb/usb_pf.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_pf.c Thu Oct 14 19:30:44 2010 (r213846) +++ user/weongyo/usb/sys/dev/usb/usb_pf.c Thu Oct 14 20:04:05 2010 (r213847) @@ -47,9 +47,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +#include /* * All usbpf implementations are extracted from bpf(9) APIs and it's @@ -1663,7 +1665,7 @@ catchpacket(struct usbpf_d *ud, u_char * * by each process' filter, and if accepted, stashed into the corresponding * buffer. */ -void +static void usbpf_tap(struct usbpf_if *uif, u_char *pkt, u_int pktlen) { struct bintime bt; @@ -1689,6 +1691,76 @@ usbpf_tap(struct usbpf_if *uif, u_char * USBPFIF_UNLOCK(uif); } +void +usbpf_xfertap(struct usb_xfer *xfer, int type) +{ +#define USBPF_PAGE_SIZE (4 * 1024) + struct usb_endpoint *ep = xfer->endpoint; + struct usb_page_search res; + struct usb_xfer_root *info = xfer->xroot; + struct usb_bus *bus = info->bus; + struct usbpf_pkthdr *up; + int i; + char *buf, *ptr, *end; + + /* + * XXX TODO + * Allocating the buffer here causes copy operations twice what's + * really inefficient. Copying usbpf_pkthdr and data is for USB packet + * read filter to pass a virtually linear buffer. + */ + buf = ptr = malloc(sizeof(struct usbpf_pkthdr) + (USBPF_PAGE_SIZE * 5), + M_USBPF, M_NOWAIT); + if (buf == NULL) { + printf("usbpf_xfertap: out of memory\n"); /* XXX */ + return; + } + end = buf + sizeof(struct usbpf_pkthdr) + (USBPF_PAGE_SIZE * 5); + + bzero(ptr, sizeof(struct usbpf_pkthdr)); + up = (struct usbpf_pkthdr *)ptr; + up->up_busunit = device_get_unit(bus->bdev); + up->up_type = type; + up->up_xfertype = ep->edesc->bmAttributes & UE_XFERTYPE; + up->up_address = xfer->address; + up->up_endpoint = xfer->endpointno; + up->up_flags = xfer->flags; + up->up_status = xfer->status; + switch (type) { + case USBPF_XFERTAP_SUBMIT: + up->up_length = xfer->sumlen; + up->up_frames = xfer->nframes; + break; + case USBPF_XFERTAP_DONE: + up->up_length = xfer->actlen; + up->up_frames = xfer->aframes; + break; + default: + panic("wrong usbpf type (%d)", type); + } + + up->up_error = xfer->error; + up->up_interval = xfer->interval; + ptr += sizeof(struct usbpf_pkthdr); + + for (i = 0; i < up->up_frames; i++) { + if (ptr + sizeof(u_int32_t) >= end) + goto done; + *((u_int32_t *)ptr) = xfer->frlengths[i]; + ptr += sizeof(u_int32_t); + + if (ptr + xfer->frlengths[i] >= end) + goto done; + usbd_get_page(&xfer->frbuffers[i], 0, &res); + bcopy(res.buffer, ptr, xfer->frlengths[i]); + ptr += xfer->frlengths[i]; + } + + usbpf_tap(bus->uif, buf, ptr - buf); +done: + free(buf, M_USBPF); +} + static void usbpf_append_bytes(struct usbpf_d *ud, caddr_t buf, u_int offset, void *src, u_int len) Modified: user/weongyo/usb/sys/dev/usb/usb_pf.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_pf.h Thu Oct 14 19:30:44 2010 (r213846) +++ user/weongyo/usb/sys/dev/usb/usb_pf.h Thu Oct 14 20:04:05 2010 (r213847) @@ -151,6 +151,22 @@ struct usbpf_xhdr { #define USBPF_BUFMODE_BUFFER 1 /* Kernel buffers with read(). */ #define USBPF_BUFMODE_ZBUF 2 /* Zero-copy buffers. */ +struct usbpf_pkthdr { + int up_busunit; /* Host controller unit number */ + u_char up_address; /* USB device address */ + u_char up_endpoint; /* USB endpoint */ + u_char up_type; /* points SUBMIT / DONE */ + u_char up_xfertype; /* Transfer type */ + u_int32_t up_flags; /* Transfer flags */ + u_int32_t up_status; /* Transfer status */ + u_int32_t up_length; /* Total data length (submit/actual) */ + u_int32_t up_frames; /* USB frame number (submit/actual) */ + u_int32_t up_error; /* usb_error_t */ + u_int32_t up_interval; /* for interrupt and isoc */ + /* sizeof(struct usbpf_pkthdr) == 128 bytes */ + u_char up_reserved[96]; +} __packed; + struct usbpf_version { u_short uv_major; u_short uv_minor; @@ -181,6 +197,8 @@ struct usbpf_program { void usbpf_attach(struct usb_bus *, struct usbpf_if **); void usbpf_detach(struct usb_bus *); -void usbpf_tap(struct usbpf_if *, u_char *, u_int); +#define USBPF_XFERTAP_SUBMIT 0 +#define USBPF_XFERTAP_DONE 1 +void usbpf_xfertap(struct usb_xfer *, int); #endif Modified: user/weongyo/usb/sys/dev/usb/usb_transfer.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_transfer.c Thu Oct 14 19:30:44 2010 (r213846) +++ user/weongyo/usb/sys/dev/usb/usb_transfer.c Thu Oct 14 20:04:05 2010 (r213847) @@ -59,6 +59,7 @@ #include #include +#include struct usb_std_packet_size { struct { @@ -2059,6 +2060,9 @@ usbd_callback_wrapper(struct usb_xfer_qu } } + if (xfer->usb_state != USB_ST_SETUP) + usbpf_xfertap(xfer, USBPF_XFERTAP_DONE); + /* call processing routine */ (xfer->callback) (xfer, xfer->error); @@ -2426,6 +2430,8 @@ usbd_pipe_start(struct usb_xfer_queue *p } DPRINTF("start\n"); + usbpf_xfertap(xfer, USBPF_XFERTAP_SUBMIT); + /* start USB transfer */ (ep->methods->start) (xfer); From owner-svn-src-user@FreeBSD.ORG Thu Oct 14 20:17:53 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 1C0651065694; Thu, 14 Oct 2010 20:17:53 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe02.swip.net [212.247.154.33]) by mx1.freebsd.org (Postfix) with ESMTP id 458808FC0A; Thu, 14 Oct 2010 20:17:51 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=yevn+QCjI6xy199BDvBOOiO14qYvyLq62he9tTtU3M8= c=1 sm=1 a=5Dq7Mu5n-7QA:10 a=N659UExz7-8A:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=lWx4ykhcIHzQMHs0q9gA:9 a=J8fpxtDJhFrR3WHYP2gA:7 a=XLHpaDd6vhqiVB4rjwwz8oJjragA:4 a=pILNOxqGKmIA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe02.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 35218670; Thu, 14 Oct 2010 22:17:50 +0200 From: Hans Petter Selasky To: Weongyo Jeong Date: Thu, 14 Oct 2010 22:19:08 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.1-STABLE; KDE/4.4.5; amd64; ; ) References: <201010142004.o9EK458X035369@svn.freebsd.org> In-Reply-To: <201010142004.o9EK458X035369@svn.freebsd.org> X-Face: +~\`s("[*|O,="7?X@L.elg*F"OA\I/3%^p8g?ab%RN'( =?iso-8859-1?q?=3B=5FIjlA=3A=0A=09hGE=2E=2EEw?=, =?iso-8859-1?q?XAQ*o=23=5C/M=7ESC=3DS1-f9=7BEzRfT=27=7CHhll5Q=5Dha5Bt-s=7Co?= =?iso-8859-1?q?TlKMusi=3A1e=5BwJl=7Dkd=7DGR=0A=09Z0adGx-x=5F0zGbZj=27e?=(Y[(UNle~)8CQWXW@:DX+9)_YlB[tIccCPN$7/L' MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201010142219.08408.hselasky@c2i.net> Cc: "src-committers@freebsd.org" , "svn-src-user@freebsd.org" Subject: Re: svn commit: r213847 - user/weongyo/usb/sys/dev/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: Thu, 14 Oct 2010 20:17:53 -0000 On Thursday 14 October 2010 22:04:05 Weongyo Jeong wrote: > + for (i = 0; i < up->up_frames; i++) { > + if (ptr + sizeof(u_int32_t) >= end) > + goto done; > + *((u_int32_t *)ptr) = xfer->frlengths[i]; > + ptr += sizeof(u_int32_t); > + > + if (ptr + xfer->frlengths[i] >= end) > + goto done; > + usbd_get_page(&xfer->frbuffers[i], 0, &res); > + bcopy(res.buffer, ptr, xfer->frlengths[i]); > + ptr += xfer->frlengths[i]; > + } For isochronous transfers only the first frbuffer is used for all transfers, which are back to back. --HPS From owner-svn-src-user@FreeBSD.ORG Thu Oct 14 20:26:19 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 EF4ED1065675; Thu, 14 Oct 2010 20:26:19 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DE8278FC1C; Thu, 14 Oct 2010 20:26:19 +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 o9EKQJB1036012; Thu, 14 Oct 2010 20:26:19 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9EKQJYL036010; Thu, 14 Oct 2010 20:26:19 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010142026.o9EKQJYL036010@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 14 Oct 2010 20:26: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: r213850 - user/weongyo/usb/sys/dev/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: Thu, 14 Oct 2010 20:26:20 -0000 Author: weongyo Date: Thu Oct 14 20:26:19 2010 New Revision: 213850 URL: http://svn.freebsd.org/changeset/base/213850 Log: Uses USB_PAGE_SIZE instead of defining the new one. Modified: user/weongyo/usb/sys/dev/usb/usb_pf.c Modified: user/weongyo/usb/sys/dev/usb/usb_pf.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_pf.c Thu Oct 14 20:18:39 2010 (r213849) +++ user/weongyo/usb/sys/dev/usb/usb_pf.c Thu Oct 14 20:26:19 2010 (r213850) @@ -1694,7 +1694,6 @@ usbpf_tap(struct usbpf_if *uif, u_char * void usbpf_xfertap(struct usb_xfer *xfer, int type) { -#define USBPF_PAGE_SIZE (4 * 1024) struct usb_endpoint *ep = xfer->endpoint; struct usb_page_search res; struct usb_xfer_root *info = xfer->xroot; @@ -1709,13 +1708,13 @@ usbpf_xfertap(struct usb_xfer *xfer, int * really inefficient. Copying usbpf_pkthdr and data is for USB packet * read filter to pass a virtually linear buffer. */ - buf = ptr = malloc(sizeof(struct usbpf_pkthdr) + (USBPF_PAGE_SIZE * 5), + buf = ptr = malloc(sizeof(struct usbpf_pkthdr) + (USB_PAGE_SIZE * 5), M_USBPF, M_NOWAIT); if (buf == NULL) { printf("usbpf_xfertap: out of memory\n"); /* XXX */ return; } - end = buf + sizeof(struct usbpf_pkthdr) + (USBPF_PAGE_SIZE * 5); + end = buf + sizeof(struct usbpf_pkthdr) + (USB_PAGE_SIZE * 5); bzero(ptr, sizeof(struct usbpf_pkthdr)); up = (struct usbpf_pkthdr *)ptr; From owner-svn-src-user@FreeBSD.ORG Thu Oct 14 20:31:07 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 BB2D71065670; Thu, 14 Oct 2010 20:31:07 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA64C8FC13; Thu, 14 Oct 2010 20:31:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9EKV7t4036158; Thu, 14 Oct 2010 20:31:07 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9EKV7gZ036156; Thu, 14 Oct 2010 20:31:07 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010142031.o9EKV7gZ036156@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 14 Oct 2010 20:31:07 +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: r213851 - user/weongyo/usb/sys/dev/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: Thu, 14 Oct 2010 20:31:07 -0000 Author: weongyo Date: Thu Oct 14 20:31:07 2010 New Revision: 213851 URL: http://svn.freebsd.org/changeset/base/213851 Log: Removes a space. Modified: user/weongyo/usb/sys/dev/usb/usb_pf.c Modified: user/weongyo/usb/sys/dev/usb/usb_pf.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_pf.c Thu Oct 14 20:26:19 2010 (r213850) +++ user/weongyo/usb/sys/dev/usb/usb_pf.c Thu Oct 14 20:31:07 2010 (r213851) @@ -1737,7 +1737,7 @@ usbpf_xfertap(struct usb_xfer *xfer, int default: panic("wrong usbpf type (%d)", type); } - + up->up_error = xfer->error; up->up_interval = xfer->interval; ptr += sizeof(struct usbpf_pkthdr); From owner-svn-src-user@FreeBSD.ORG Thu Oct 14 20:39: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 41075106566C; Thu, 14 Oct 2010 20:39:23 +0000 (UTC) (envelope-from weongyo.jeong@gmail.com) Received: from mail-pw0-f54.google.com (mail-pw0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 034D58FC12; Thu, 14 Oct 2010 20:39:22 +0000 (UTC) Received: by pwi6 with SMTP id 6so190378pwi.13 for ; Thu, 14 Oct 2010 13:39:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:from:date:to:cc :subject:message-id:reply-to:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent:organization:x-operation-sytem; bh=55KK0uWD3qAUDpP+Wq6xipiEoPmvk+CU9Vx+W3fM7pg=; b=NgBUIY3dSE822x2qhWWRCI6Ivh3emfTfNFEtVBVHfi8XxcR1Hojqlqufs78U0gq4TL TBvTaDlxyTVz0jJxCddEBNNjemISOjjkneDVyDuzxj35lGUEp44TrUTOGQwyIIny9Twr x+knhO4O2fACmOBeJ/AfSOxaN76zcZZuhShzM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:date:to:cc:subject:message-id:reply-to:mail-followup-to :references:mime-version:content-type:content-disposition :in-reply-to:user-agent:organization:x-operation-sytem; b=qfwDUS0djLla+knHK2/csUJjY6PmgGWW18vg9JmMkFuIShY4UC708i2JBN01JLIdP3 bamyNREo7cLl9bYyvbDlxjicFR9o0VpsWxHsXJTkO0SiawIcAFh7GI/zdeF2QPJJE67u bsfDbMM4wQqzj+lEX81+Y/SmrflsP2Vz11ICw= Received: by 10.142.166.20 with SMTP id o20mr8392684wfe.382.1287088762354; Thu, 14 Oct 2010 13:39:22 -0700 (PDT) Received: from weongyo ([174.35.1.224]) by mx.google.com with ESMTPS id w14sm14235946wfd.6.2010.10.14.13.39.21 (version=SSLv3 cipher=RC4-MD5); Thu, 14 Oct 2010 13:39:21 -0700 (PDT) Received: by weongyo (sSMTP sendmail emulation); Thu, 14 Oct 2010 13:39:32 -0700 From: Weongyo Jeong Date: Thu, 14 Oct 2010 13:39:32 -0700 To: Hans Petter Selasky Message-ID: <20101014203932.GK38869@weongyo> Mail-Followup-To: Hans Petter Selasky , "src-committers@freebsd.org" , "svn-src-user@freebsd.org" References: <201010142004.o9EK458X035369@svn.freebsd.org> <201010142219.08408.hselasky@c2i.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201010142219.08408.hselasky@c2i.net> User-Agent: Mutt/1.4.2.3i Organization: CDNetworks. X-Operation-Sytem: FreeBSD Cc: "src-committers@freebsd.org" , "svn-src-user@freebsd.org" Subject: Re: svn commit: r213847 - user/weongyo/usb/sys/dev/usb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Weongyo Jeong 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, 14 Oct 2010 20:39:23 -0000 On Thu, Oct 14, 2010 at 10:19:08PM +0200, Hans Petter Selasky wrote: > On Thursday 14 October 2010 22:04:05 Weongyo Jeong wrote: > > + for (i = 0; i < up->up_frames; i++) { > > + if (ptr + sizeof(u_int32_t) >= end) > > + goto done; > > + *((u_int32_t *)ptr) = xfer->frlengths[i]; > > + ptr += sizeof(u_int32_t); > > + > > + if (ptr + xfer->frlengths[i] >= end) > > + goto done; > > + usbd_get_page(&xfer->frbuffers[i], 0, &res); > > + bcopy(res.buffer, ptr, xfer->frlengths[i]); > > + ptr += xfer->frlengths[i]; > > + } > > For isochronous transfers only the first frbuffer is used for all transfers, > which are back to back. Do you mean that we should dump only xfer->frbuffers[0] even if xfer->nframes > 1 for isochronous xfer? regards, Weongyo Jeong From owner-svn-src-user@FreeBSD.ORG Thu Oct 14 21: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 12B1E106564A; Thu, 14 Oct 2010 21:07:10 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0199B8FC08; Thu, 14 Oct 2010 21: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 o9EL79Gs037077; Thu, 14 Oct 2010 21:07:09 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9EL79x5037074; Thu, 14 Oct 2010 21:07:09 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010142107.o9EL79x5037074@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 14 Oct 2010 21:07:09 +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: r213854 - user/weongyo/usb/sys/dev/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: Thu, 14 Oct 2010 21:07:10 -0000 Author: weongyo Date: Thu Oct 14 21:07:09 2010 New Revision: 213854 URL: http://svn.freebsd.org/changeset/base/213854 Log: Distinguishes the kernel and userland parts for usb_pf.h. Modified: user/weongyo/usb/sys/dev/usb/usb_pf.c user/weongyo/usb/sys/dev/usb/usb_pf.h Modified: user/weongyo/usb/sys/dev/usb/usb_pf.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_pf.c Thu Oct 14 20:50:33 2010 (r213853) +++ user/weongyo/usb/sys/dev/usb/usb_pf.c Thu Oct 14 21:07:09 2010 (r213854) @@ -95,63 +95,6 @@ MALLOC_DEFINE(M_USBPF, "USBPktFilter", " #endif /* - * The instruction encodings. - */ - -/* instruction classes */ -#define USBPF_CLASS(code) ((code) & 0x07) -#define USBPF_LD 0x00 -#define USBPF_LDX 0x01 -#define USBPF_ST 0x02 -#define USBPF_STX 0x03 -#define USBPF_ALU 0x04 -#define USBPF_JMP 0x05 -#define USBPF_RET 0x06 -#define USBPF_MISC 0x07 - -/* ld/ldx fields */ -#define USBPF_SIZE(code) ((code) & 0x18) -#define USBPF_W 0x00 -#define USBPF_H 0x08 -#define USBPF_B 0x10 -#define USBPF_MODE(code) ((code) & 0xe0) -#define USBPF_IMM 0x00 -#define USBPF_ABS 0x20 -#define USBPF_IND 0x40 -#define USBPF_MEM 0x60 -#define USBPF_LEN 0x80 -#define USBPF_MSH 0xa0 - -/* alu/jmp fields */ -#define USBPF_OP(code) ((code) & 0xf0) -#define USBPF_ADD 0x00 -#define USBPF_SUB 0x10 -#define USBPF_MUL 0x20 -#define USBPF_DIV 0x30 -#define USBPF_OR 0x40 -#define USBPF_AND 0x50 -#define USBPF_LSH 0x60 -#define USBPF_RSH 0x70 -#define USBPF_NEG 0x80 -#define USBPF_JA 0x00 -#define USBPF_JEQ 0x10 -#define USBPF_JGT 0x20 -#define USBPF_JGE 0x30 -#define USBPF_JSET 0x40 -#define USBPF_SRC(code) ((code) & 0x08) -#define USBPF_K 0x00 -#define USBPF_X 0x08 - -/* ret - USBPF_K and USBPF_X also apply */ -#define USBPF_RVAL(code) ((code) & 0x18) -#define USBPF_A 0x10 - -/* misc */ -#define USBPF_MISCOP(code) ((code) & 0xf8) -#define USBPF_TAX 0x00 -#define USBPF_TXA 0x80 - -/* * Number of scratch memory words (for USBPF_LD|USBPF_MEM and USBPF_ST). */ #define USBPF_MEMWORDS 16 Modified: user/weongyo/usb/sys/dev/usb/usb_pf.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_pf.h Thu Oct 14 20:50:33 2010 (r213853) +++ user/weongyo/usb/sys/dev/usb/usb_pf.h Thu Oct 14 21:07:09 2010 (r213854) @@ -37,10 +37,12 @@ #ifndef _DEV_USB_PF_H #define _DEV_USB_PF_H +#ifdef _KERNEL #include #include #include #include +#endif typedef int32_t usbpf_int32; typedef u_int32_t usbpf_u_int32; @@ -50,6 +52,63 @@ typedef u_int64_t usbpf_u_int64; struct usbpf_if; /* + * The instruction encodings. + */ + +/* instruction classes */ +#define USBPF_CLASS(code) ((code) & 0x07) +#define USBPF_LD 0x00 +#define USBPF_LDX 0x01 +#define USBPF_ST 0x02 +#define USBPF_STX 0x03 +#define USBPF_ALU 0x04 +#define USBPF_JMP 0x05 +#define USBPF_RET 0x06 +#define USBPF_MISC 0x07 + +/* ld/ldx fields */ +#define USBPF_SIZE(code) ((code) & 0x18) +#define USBPF_W 0x00 +#define USBPF_H 0x08 +#define USBPF_B 0x10 +#define USBPF_MODE(code) ((code) & 0xe0) +#define USBPF_IMM 0x00 +#define USBPF_ABS 0x20 +#define USBPF_IND 0x40 +#define USBPF_MEM 0x60 +#define USBPF_LEN 0x80 +#define USBPF_MSH 0xa0 + +/* alu/jmp fields */ +#define USBPF_OP(code) ((code) & 0xf0) +#define USBPF_ADD 0x00 +#define USBPF_SUB 0x10 +#define USBPF_MUL 0x20 +#define USBPF_DIV 0x30 +#define USBPF_OR 0x40 +#define USBPF_AND 0x50 +#define USBPF_LSH 0x60 +#define USBPF_RSH 0x70 +#define USBPF_NEG 0x80 +#define USBPF_JA 0x00 +#define USBPF_JEQ 0x10 +#define USBPF_JGT 0x20 +#define USBPF_JGE 0x30 +#define USBPF_JSET 0x40 +#define USBPF_SRC(code) ((code) & 0x08) +#define USBPF_K 0x00 +#define USBPF_X 0x08 + +/* ret - USBPF_K and USBPF_X also apply */ +#define USBPF_RVAL(code) ((code) & 0x18) +#define USBPF_A 0x10 + +/* misc */ +#define USBPF_MISCOP(code) ((code) & 0xf8) +#define USBPF_TAX 0x00 +#define USBPF_TXA 0x80 + +/* * The instruction data structure. */ struct usbpf_insn { @@ -59,6 +118,8 @@ struct usbpf_insn { usbpf_u_int32 k; }; +#ifdef _KERNEL + /* * Descriptor associated with each open uff file. */ @@ -133,6 +194,8 @@ struct usbpf_if { #define USBPFIF_LOCK(uif) mtx_lock(&(uif)->uif_mtx) #define USBPFIF_UNLOCK(uif) mtx_unlock(&(uif)->uif_mtx) +#endif + /* * Structure prepended to each packet. */ @@ -195,10 +258,13 @@ struct usbpf_program { #define UIOCVERSION _IOR('U', 113, struct usbpf_version) #define UIOCSETWF _IOW('B', 123, struct usbpf_program) -void usbpf_attach(struct usb_bus *, struct usbpf_if **); -void usbpf_detach(struct usb_bus *); #define USBPF_XFERTAP_SUBMIT 0 #define USBPF_XFERTAP_DONE 1 + +#ifdef _KERNEL +void usbpf_attach(struct usb_bus *, struct usbpf_if **); +void usbpf_detach(struct usb_bus *); void usbpf_xfertap(struct usb_xfer *, int); +#endif #endif From owner-svn-src-user@FreeBSD.ORG Thu Oct 14 21:09:04 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 F2B0B106564A; Thu, 14 Oct 2010 21:09:04 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E191A8FC12; Thu, 14 Oct 2010 21:09:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9EL946s037162; Thu, 14 Oct 2010 21:09:04 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9EL94Xu037159; Thu, 14 Oct 2010 21:09:04 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010142109.o9EL94Xu037159@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 14 Oct 2010 21:09:04 +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: r213855 - user/weongyo/usb/sys/dev/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: Thu, 14 Oct 2010 21:09:05 -0000 Author: weongyo Date: Thu Oct 14 21:09:04 2010 New Revision: 213855 URL: http://svn.freebsd.org/changeset/base/213855 Log: Moves two macros for userland parts. Modified: user/weongyo/usb/sys/dev/usb/usb_pf.c user/weongyo/usb/sys/dev/usb/usb_pf.h Modified: user/weongyo/usb/sys/dev/usb/usb_pf.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_pf.c Thu Oct 14 21:07:09 2010 (r213854) +++ user/weongyo/usb/sys/dev/usb/usb_pf.c Thu Oct 14 21:09:04 2010 (r213855) @@ -1449,13 +1449,6 @@ usbpf_buf_reclaimed(struct usbpf_d *ud) } } -/* - * Alignment macros. USBPF_WORDALIGN rounds up to the next - * even multiple of USBPF_ALIGNMENT. - */ -#define USBPF_ALIGNMENT sizeof(long) -#define USBPF_WORDALIGN(x) (((x)+(USBPF_ALIGNMENT-1))&~(USBPF_ALIGNMENT-1)) - #define SIZEOF_USBPF_HDR(type) \ (offsetof(type, uh_hdrlen) + sizeof(((type *)0)->uh_hdrlen)) Modified: user/weongyo/usb/sys/dev/usb/usb_pf.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_pf.h Thu Oct 14 21:07:09 2010 (r213854) +++ user/weongyo/usb/sys/dev/usb/usb_pf.h Thu Oct 14 21:09:04 2010 (r213855) @@ -52,6 +52,13 @@ typedef u_int64_t usbpf_u_int64; struct usbpf_if; /* + * Alignment macros. USBPF_WORDALIGN rounds up to the next + * even multiple of USBPF_ALIGNMENT. + */ +#define USBPF_ALIGNMENT sizeof(long) +#define USBPF_WORDALIGN(x) (((x)+(USBPF_ALIGNMENT-1))&~(USBPF_ALIGNMENT-1)) + +/* * The instruction encodings. */ From owner-svn-src-user@FreeBSD.ORG Thu Oct 14 21:09: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 7CC841065672; Thu, 14 Oct 2010 21:09:15 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe08.swip.net [212.247.154.225]) by mx1.freebsd.org (Postfix) with ESMTP id A7D888FC15; Thu, 14 Oct 2010 21:09:14 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=4dE6tNKVm/0afO7MQGRPv7y2YwMo4emTIiDjbh74onY= c=1 sm=1 a=5Dq7Mu5n-7QA:10 a=N659UExz7-8A:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=dEu_AODzM5LTwu2e6o8A:9 a=KoUEy9day6YbimQM170A:7 a=fAxp8GihHkT_wXRD2ZstGAFSQVgA:4 a=pILNOxqGKmIA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe08.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 35309956; Thu, 14 Oct 2010 23:09:13 +0200 From: Hans Petter Selasky To: Weongyo Jeong Date: Thu, 14 Oct 2010 23:10:31 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.1-STABLE; KDE/4.4.5; amd64; ; ) References: <201010142219.08408.hselasky@c2i.net> <20101014203932.GK38869@weongyo> In-Reply-To: <20101014203932.GK38869@weongyo> X-Face: +~\`s("[*|O,="7?X@L.elg*F"OA\I/3%^p8g?ab%RN'(; _IjlA: hGE..Ew, XAQ*o#\/M~SC=S1-f9{EzRfT'|Hhll5Q]ha5Bt-s|oTlKMusi:1e[wJl}kd}GR Z0adGx-x_0zGbZj'e(Y[(UNle~)8CQWXW@:DX+9)_YlB[tIccCPN$7/L' MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201010142310.31272.hselasky@c2i.net> Cc: "src-committers@freebsd.org" , "svn-src-user@freebsd.org" Subject: Re: svn commit: r213847 - user/weongyo/usb/sys/dev/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: Thu, 14 Oct 2010 21:09:15 -0000 On Thursday 14 October 2010 22:39:32 Weongyo Jeong wrote: > On Thu, Oct 14, 2010 at 10:19:08PM +0200, Hans Petter Selasky wrote: > > On Thursday 14 October 2010 22:04:05 Weongyo Jeong wrote: > > > + for (i = 0; i < up->up_frames; i++) { > > > + if (ptr + sizeof(u_int32_t) >= end) > > > + goto done; > > > + *((u_int32_t *)ptr) = xfer->frlengths[i]; > > > + ptr += sizeof(u_int32_t); > > > + > > > + if (ptr + xfer->frlengths[i] >= end) > > > + goto done; > > > + usbd_get_page(&xfer->frbuffers[i], 0, &res); > > > + bcopy(res.buffer, ptr, xfer->frlengths[i]); > > > + ptr += xfer->frlengths[i]; > > > + } > > > > For isochronous transfers only the first frbuffer is used for all > > transfers, which are back to back. > > Do you mean that we should dump only xfer->frbuffers[0] even if > xfer->nframes > 1 for isochronous xfer? You should sum the frame lengths from 0 and upwards and use that for offset from xfer->frbuffers[0]. When the transfer is complete you need to know the old framelength, which I think there is already a variable for. --HPS From owner-svn-src-user@FreeBSD.ORG Thu Oct 14 22:45:14 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 C46B1106566B; Thu, 14 Oct 2010 22:45:14 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 98B8C8FC14; Thu, 14 Oct 2010 22:45:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9EMjEH8040670; Thu, 14 Oct 2010 22:45:14 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9EMjE9P040667; Thu, 14 Oct 2010 22:45:14 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010142245.o9EMjE9P040667@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 14 Oct 2010 22:45:14 +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: r213881 - user/weongyo/usb/sys/dev/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: Thu, 14 Oct 2010 22:45:14 -0000 Author: weongyo Date: Thu Oct 14 22:45:14 2010 New Revision: 213881 URL: http://svn.freebsd.org/changeset/base/213881 Log: Adds two ioctl interfaces, UIOCSRTIMEOUT and UIOCGRTIMEOUT to specify the read timeout. While I'm here fixes wrong group ids for other interfaces. Modified: user/weongyo/usb/sys/dev/usb/usb_pf.c user/weongyo/usb/sys/dev/usb/usb_pf.h Modified: user/weongyo/usb/sys/dev/usb/usb_pf.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_pf.c Thu Oct 14 22:14:55 2010 (r213880) +++ user/weongyo/usb/sys/dev/usb/usb_pf.c Thu Oct 14 22:45:14 2010 (r213881) @@ -1185,6 +1185,34 @@ usbpf_ioctl(struct cdev *dev, u_long cmd error = usbpf_setf(ud, (struct usbpf_program *)addr, cmd); break; + /* + * Set read timeout. + */ + case UIOCSRTIMEOUT: + { + struct timeval *tv = (struct timeval *)addr; + + /* + * Subtract 1 tick from tvtohz() since this isn't + * a one-shot timer. + */ + if ((error = itimerfix(tv)) == 0) + ud->ud_rtout = tvtohz(tv) - 1; + break; + } + + /* + * Get read timeout. + */ + case UIOCGRTIMEOUT: + { + struct timeval *tv = (struct timeval *)addr; + + tv->tv_sec = ud->ud_rtout / hz; + tv->tv_usec = (ud->ud_rtout % hz) * tick; + break; + } + case UIOCVERSION: { struct usbpf_version *uv = (struct usbpf_version *)addr; Modified: user/weongyo/usb/sys/dev/usb/usb_pf.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_pf.h Thu Oct 14 22:14:55 2010 (r213880) +++ user/weongyo/usb/sys/dev/usb/usb_pf.h Thu Oct 14 22:45:14 2010 (r213881) @@ -260,10 +260,12 @@ struct usbpf_program { #define UIOCGBLEN _IOR('U', 102, u_int) #define UIOCSBLEN _IOWR('U', 102, u_int) -#define UIOCSETF _IOW('B', 103, struct usbpf_program) +#define UIOCSETF _IOW('U', 103, struct usbpf_program) #define UIOCSETIF _IOW('U', 108, struct usbpf_ifreq) +#define UIOCSRTIMEOUT _IOW('U', 109, struct timeval) +#define UIOCGRTIMEOUT _IOR('U', 110, struct timeval) #define UIOCVERSION _IOR('U', 113, struct usbpf_version) -#define UIOCSETWF _IOW('B', 123, struct usbpf_program) +#define UIOCSETWF _IOW('U', 123, struct usbpf_program) #define USBPF_XFERTAP_SUBMIT 0 #define USBPF_XFERTAP_DONE 1 From owner-svn-src-user@FreeBSD.ORG Thu Oct 14 23:38:37 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 E9CDF106566B; Thu, 14 Oct 2010 23:38:37 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D89558FC08; Thu, 14 Oct 2010 23:38:37 +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 o9ENcbEL041870; Thu, 14 Oct 2010 23:38:37 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9ENcbBY041868; Thu, 14 Oct 2010 23:38:37 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010142338.o9ENcbBY041868@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 14 Oct 2010 23:38:37 +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: r213885 - user/weongyo/usb/sys/dev/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: Thu, 14 Oct 2010 23:38:38 -0000 Author: weongyo Date: Thu Oct 14 23:38:37 2010 New Revision: 213885 URL: http://svn.freebsd.org/changeset/base/213885 Log: Adds a XXX comment. Modified: user/weongyo/usb/sys/dev/usb/usb_pf.c Modified: user/weongyo/usb/sys/dev/usb/usb_pf.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_pf.c Thu Oct 14 23:31:58 2010 (r213884) +++ user/weongyo/usb/sys/dev/usb/usb_pf.c Thu Oct 14 23:38:37 2010 (r213885) @@ -1680,6 +1680,7 @@ usbpf_xfertap(struct usb_xfer *xfer, int } end = buf + sizeof(struct usbpf_pkthdr) + (USB_PAGE_SIZE * 5); + /* XXX need to care big/little endians. */ bzero(ptr, sizeof(struct usbpf_pkthdr)); up = (struct usbpf_pkthdr *)ptr; up->up_busunit = device_get_unit(bus->bdev); From owner-svn-src-user@FreeBSD.ORG Sat Oct 16 01:35: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 A87D7106566B; Sat, 16 Oct 2010 01:35:15 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9737D8FC31; Sat, 16 Oct 2010 01:35: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 o9G1ZFw8097267; Sat, 16 Oct 2010 01:35:15 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9G1ZFN8097264; Sat, 16 Oct 2010 01:35:15 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010160135.o9G1ZFN8097264@svn.freebsd.org> From: Weongyo Jeong Date: Sat, 16 Oct 2010 01:35: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: r213909 - user/weongyo/usb/sys/dev/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: Sat, 16 Oct 2010 01:35:15 -0000 Author: weongyo Date: Sat Oct 16 01:35:15 2010 New Revision: 213909 URL: http://svn.freebsd.org/changeset/base/213909 Log: Adds UIOCGSTATS. Modified: user/weongyo/usb/sys/dev/usb/usb_pf.c user/weongyo/usb/sys/dev/usb/usb_pf.h Modified: user/weongyo/usb/sys/dev/usb/usb_pf.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_pf.c Fri Oct 15 23:34:31 2010 (r213908) +++ user/weongyo/usb/sys/dev/usb/usb_pf.c Sat Oct 16 01:35:15 2010 (r213909) @@ -1213,6 +1213,19 @@ usbpf_ioctl(struct cdev *dev, u_long cmd break; } + /* + * Get packet stats. + */ + case UIOCGSTATS: + { + struct usbpf_stat *us = (struct usbpf_stat *)addr; + + /* XXXCSJP overflow */ + us->us_recv = ud->ud_rcount; + us->us_drop = ud->ud_dcount; + break; + } + case UIOCVERSION: { struct usbpf_version *uv = (struct usbpf_version *)addr; Modified: user/weongyo/usb/sys/dev/usb/usb_pf.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_pf.h Fri Oct 15 23:34:31 2010 (r213908) +++ user/weongyo/usb/sys/dev/usb/usb_pf.h Sat Oct 16 01:35:15 2010 (r213909) @@ -258,12 +258,21 @@ struct usbpf_program { struct usbpf_insn *uf_insns; }; +/* + * Struct returned by UIOCGSTATS. + */ +struct usbpf_stat { + u_int us_recv; /* number of packets received */ + u_int us_drop; /* number of packets dropped */ +}; + #define UIOCGBLEN _IOR('U', 102, u_int) #define UIOCSBLEN _IOWR('U', 102, u_int) #define UIOCSETF _IOW('U', 103, struct usbpf_program) #define UIOCSETIF _IOW('U', 108, struct usbpf_ifreq) #define UIOCSRTIMEOUT _IOW('U', 109, struct timeval) #define UIOCGRTIMEOUT _IOR('U', 110, struct timeval) +#define UIOCGSTATS _IOR('U', 111, struct usbpf_stat) #define UIOCVERSION _IOR('U', 113, struct usbpf_version) #define UIOCSETWF _IOW('U', 123, struct usbpf_program)