summaryrefslogtreecommitdiffstats
path: root/sys/dev/pdq/pdq_freebsd.h
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2009-11-19 19:25:47 +0000
committerjhb <jhb@FreeBSD.org>2009-11-19 19:25:47 +0000
commitfe250fcdf4c9009883dd08122d4d08d2f070dcc8 (patch)
tree8e7c8dbe27ba288246c747dd803c2e949f1da3cd /sys/dev/pdq/pdq_freebsd.h
parent92fc9b53e8ad2c7ba20dc51ea8c0099d4196560f (diff)
downloadFreeBSD-src-fe250fcdf4c9009883dd08122d4d08d2f070dcc8.zip
FreeBSD-src-fe250fcdf4c9009883dd08122d4d08d2f070dcc8.tar.gz
Several fixes to these drivers. Note that these two drivers are actually
just two different attachments (EISA and PCI) to a single driver. - Add real locking. Previously these drivers only acquired their lock in their interrupt handler or in the ioctl routine (but too broadly in the latter). No locking was used for the stack calling down into the driver via if_init() or if_start(), for device shutdown or detach. Also, the interrupt handler held the driver lock while calling if_input(). All this stuff should be fixed in the locking changes. - Really fix these drivers to handle if_alloc(). The front-end attachments were using if_initname() before the ifnet was allocated. Fix this by moving some of the duplicated logic from each driver into pdq_ifattach(). While here, make pdq_ifattach() return an error so that the driver just fails to attach if if_alloc() fails rather than panic'ing. Also, defer freeing the ifnet until the driver has stopped using it during detach. - Add a new private timer to drive the watchdog timer. - Pass the softc pointer to the interrupt handlers instead of the device_t so we can avoid the use of device_get_softc() and to better match what other drivers do.
Diffstat (limited to 'sys/dev/pdq/pdq_freebsd.h')
-rw-r--r--sys/dev/pdq/pdq_freebsd.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/dev/pdq/pdq_freebsd.h b/sys/dev/pdq/pdq_freebsd.h
index cdbf389..6efd684 100644
--- a/sys/dev/pdq/pdq_freebsd.h
+++ b/sys/dev/pdq/pdq_freebsd.h
@@ -124,10 +124,13 @@ typedef struct _pdq_os_ctx_t {
void * irq_ih;
struct mtx mtx;
+ struct callout watchdog;
+ int timer;
} pdq_softc_t;
#define PDQ_LOCK(_sc) mtx_lock(&(_sc)->mtx)
#define PDQ_UNLOCK(_sc) mtx_unlock(&(_sc)->mtx)
+#define PDQ_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->mtx, MA_OWNED)
#define PDQ_OS_HDR_OFFSET PDQ_RX_FC_OFFSET
@@ -255,7 +258,8 @@ pdq_state_t pdq_stop (pdq_t *pdq);
* OS dependent functions provided by
* pdq_ifsubr.c or pdq.c to the bus front ends
*/
-void pdq_ifattach (pdq_softc_t *, const pdq_uint8_t *);
+int pdq_ifattach (pdq_softc_t *, const pdq_uint8_t *,
+ pdq_type_t type);
void pdq_ifdetach (pdq_softc_t *);
void pdq_free (device_t);
int pdq_interrupt (pdq_t *pdq);
OpenPOWER on IntegriCloud