From owner-svn-src-all@FreeBSD.ORG Wed Aug 13 08:18:50 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 325007E9; Wed, 13 Aug 2014 08:18:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1DE0E2233; Wed, 13 Aug 2014 08:18:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7D8InPg079422; Wed, 13 Aug 2014 08:18:49 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7D8Inlt079420; Wed, 13 Aug 2014 08:18:49 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201408130818.s7D8Inlt079420@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 13 Aug 2014 08:18:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269921 - stable/10/sys/boot/usb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 08:18:50 -0000 Author: hselasky Date: Wed Aug 13 08:18:49 2014 New Revision: 269921 URL: http://svnweb.freebsd.org/changeset/base/269921 Log: MFC r266396 and r267183: Build fixes. Add support for fast interrupts. Modified: stable/10/sys/boot/usb/bsd_kernel.c stable/10/sys/boot/usb/bsd_kernel.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/usb/bsd_kernel.c ============================================================================== --- stable/10/sys/boot/usb/bsd_kernel.c Wed Aug 13 07:13:42 2014 (r269920) +++ stable/10/sys/boot/usb/bsd_kernel.c Wed Aug 13 08:18:49 2014 (r269921) @@ -380,8 +380,10 @@ device_get_parent(device_t dev) } void -device_set_interrupt(device_t dev, intr_fn_t *fn, void *arg) +device_set_interrupt(device_t dev, driver_filter_t *filter, + driver_intr_t *fn, void *arg) { + dev->dev_irq_filter = filter; dev->dev_irq_fn = fn; dev->dev_irq_arg = arg; } @@ -395,8 +397,16 @@ device_run_interrupts(device_t parent) return; TAILQ_FOREACH(child, &parent->dev_children, dev_link) { - if (child->dev_irq_fn != NULL) - (child->dev_irq_fn) (child->dev_irq_arg); + int status; + if (child->dev_irq_filter != NULL) + status = child->dev_irq_filter(child->dev_irq_arg); + else + status = FILTER_SCHEDULE_THREAD; + + if (status == FILTER_SCHEDULE_THREAD) { + if (child->dev_irq_fn != NULL) + (child->dev_irq_fn) (child->dev_irq_arg); + } } } Modified: stable/10/sys/boot/usb/bsd_kernel.h ============================================================================== --- stable/10/sys/boot/usb/bsd_kernel.h Wed Aug 13 07:13:42 2014 (r269920) +++ stable/10/sys/boot/usb/bsd_kernel.h Wed Aug 13 08:18:49 2014 (r269921) @@ -37,6 +37,7 @@ #define isalpha(x) (((x) >= 'a' && (x) <= 'z') || ((x) >= 'A' && (x) <= 'Z')) #define isdigit(x) ((x) >= '0' && (x) <= '9') #define panic(...) do { printf("USB PANIC: " __VA_ARGS__); while (1) ; } while (0) +#define rebooting 0 #define M_USB 0 #define M_USBDEV 0 #define USB_PROC_MAX 3 @@ -96,6 +97,7 @@ SYSINIT_ENTRY(uniq##_entry, "sysuninit", #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #define MAX(a,b) (((a) > (b)) ? (a) : (b)) #define MTX_DEF 0 +#define MTX_SPIN 0 #define MTX_RECURSE 0 #define SX_DUPOK 0 #define SX_NOWITNESS 0 @@ -201,6 +203,8 @@ struct mtx { void mtx_init(struct mtx *, const char *, const char *, int); void mtx_lock(struct mtx *); void mtx_unlock(struct mtx *); +#define mtx_lock_spin(x) mtx_lock(x) +#define mtx_unlock_spin(x) mtx_unlock(x) int mtx_owned(struct mtx *); void mtx_destroy(struct mtx *); @@ -266,7 +270,11 @@ struct module_data; typedef struct driver driver_t; typedef struct devclass *devclass_t; typedef struct device *device_t; -typedef void (intr_fn_t)(void *arg); +typedef void (driver_intr_t)(void *arg); +typedef int (driver_filter_t)(void *arg); +#define FILTER_STRAY 0x01 +#define FILTER_HANDLED 0x02 +#define FILTER_SCHEDULE_THREAD 0x04 typedef int device_attach_t (device_t dev); typedef int device_detach_t (device_t dev); @@ -294,7 +302,8 @@ struct device { const struct module_data *dev_module; void *dev_sc; void *dev_aux; - intr_fn_t *dev_irq_fn; + driver_filter_t *dev_irq_filter; + driver_intr_t *dev_irq_fn; void *dev_irq_arg; uint16_t dev_unit; @@ -341,7 +350,7 @@ const char *device_get_nameunit(device_t printf("%s: " fmt, device_get_nameunit(dev),## __VA_ARGS__) device_t device_add_child(device_t dev, const char *name, int unit); void device_quiet(device_t dev); -void device_set_interrupt(device_t dev, intr_fn_t *fn, void *arg); +void device_set_interrupt(device_t dev, driver_filter_t *, driver_intr_t *, void *); void device_run_interrupts(device_t parent); void device_set_ivars(device_t dev, void *ivars); void *device_get_ivars(device_t dev);