diff options
author | mjacob <mjacob@FreeBSD.org> | 2000-12-06 00:52:28 +0000 |
---|---|---|
committer | mjacob <mjacob@FreeBSD.org> | 2000-12-06 00:52:28 +0000 |
commit | 5e456a15ec12de9e79220564cda4fcce69219d2f (patch) | |
tree | 9c0d3c9c18e18a07e0b870abbf2643c0d0c0046f /sys/pci/if_wxvar.h | |
parent | d3cbb874753bd9d5fe2635b24419ef95ed9c7a41 (diff) | |
download | FreeBSD-src-5e456a15ec12de9e79220564cda4fcce69219d2f.zip FreeBSD-src-5e456a15ec12de9e79220564cda4fcce69219d2f.tar.gz |
Restore a sense of cleanly supporting multiple platforms. That is,
place the LOCKing macros within the areas within if_wxvar.h that
is set aside for them. Put any platform specific data also in those
areas.
For ease of maintenance purposes, merge in the OpenBSD version codebase here.
Diffstat (limited to 'sys/pci/if_wxvar.h')
-rw-r--r-- | sys/pci/if_wxvar.h | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/sys/pci/if_wxvar.h b/sys/pci/if_wxvar.h index c665ef0..09e6594 100644 --- a/sys/pci/if_wxvar.h +++ b/sys/pci/if_wxvar.h @@ -1,3 +1,4 @@ +/* $FreeBSD$ */ /* * Copyright (c) 1999, Traakan Software * All rights reserved. @@ -24,7 +25,6 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD$ */ /* @@ -102,6 +102,7 @@ struct wxmdvar { bus_space_handle_t sh; /* bus space handle */ struct ifmedia ifm; struct wx_softc * next; + int spl; }; #define wx_dev w.dev #define wx_enaddr w.enaddr @@ -121,6 +122,10 @@ struct wxmdvar { #define VTIMEOUT(sc, func, arg, time) timeout(func, arg, time) #define UNTIMEOUT(f, arg, sc) untimeout(f, arg) #define INLINE inline +#define WX_LOCK(_sc) _sc->w.spl = splimp() +#define WX_UNLOCK(_sc) splx(_sc->w.spl) +#define WX_ILOCK(_sc) +#define WX_IUNLK(_sc) #define vm_offset_t vaddr_t #ifndef IFM_1000_SX @@ -130,6 +135,11 @@ struct wxmdvar { #define WRITE_CSR _write_csr #elif defined(__FreeBSD__) +/* + * Enable for FreeBSD 5.0 SMP code + */ +/* #define SMPNG 1 */ + #include <sys/param.h> #include <sys/systm.h> #include <sys/mbuf.h> @@ -178,6 +188,11 @@ struct wxmdvar { bus_space_handle_t sh; /* bus space handle */ struct ifmedia ifm; struct wx_softc * next; +#ifdef SMPNG + struct mtx wxmtx; +#else + int spl; +#endif }; #define wx_dev w.dev #define wx_enaddr w.arpcom.ac_enaddr @@ -187,6 +202,7 @@ struct wxmdvar { #define wx_if w.arpcom.ac_if #define wx_name w.name +#define wx_mtx w.wxmtx #define IOCTL_CMD_TYPE u_long #define WXMALLOC(len) malloc(len, M_DEVBUF, M_NOWAIT) @@ -197,6 +213,18 @@ struct wxmdvar { #define TIMEOUT(sc, func, arg, time) (sc)->w.sch = timeout(func, arg, time) #define UNTIMEOUT(f, arg, sc) untimeout(f, arg, (sc)->w.sch) #define INLINE __inline +#ifdef SMPNG +#define WX_LOCK(_sc) mtx_enter(&(_sc)->wx_mtx, MTX_DEF) +#define WX_UNLOCK(_sc) mtx_exit(&(_sc)->wx_mtx, MTX_DEF) +#define WX_ILOCK(_sc) mtx_enter(&(_sc)->wx_mtx, MTX_DEF) +#define WX_IUNLK(_sc) mtx_exit(&(_sc)->wx_mtx, MTX_DEF) +#else +#define WX_LOCK(_sc) _sc->w.spl = splimp() +#define WX_UNLOCK(_sc) splx(_sc->w.spl) +#define WX_ILOCK(_sc) +#define WX_IUNLK(_sc) +#endif + #define READ_CSR(sc, reg) \ bus_space_read_4((sc)->w.st, (sc)->w.sh, (reg)) @@ -260,6 +288,7 @@ struct wxmdvar { bus_space_handle_t sh; /* bus space handle */ struct ifmedia ifm; struct wx_softc * next; + int spl; }; #define wx_dev w.dev #define wx_enaddr w.arpcom.ac_enaddr @@ -279,6 +308,10 @@ struct wxmdvar { #define VTIMEOUT(sc, func, arg, time) timeout(func, arg, time) #define UNTIMEOUT(f, arg, sc) untimeout(f, arg) #define INLINE inline +#define WX_LOCK(_sc) _sc->w.spl = splimp() +#define WX_UNLOCK(_sc) splx(_sc->w.spl) +#define WX_ILOCK(_sc) +#define WX_IUNLK(_sc) #define vm_offset_t vaddr_t #define READ_CSR _read_csr @@ -375,12 +408,8 @@ typedef struct wx_softc { wxtd_t *tdescriptors; /* transmit descriptor ring */ u_int16_t tnxtfree; /* next free index (circular) */ u_int16_t tactive; /* # active */ - struct mtx wx_mtx; } wx_softc_t; -#define WX_LOCK(_sc) mtx_enter(&(_sc)->wx_mtx, MTX_DEF) -#define WX_UNLOCK(_sc) mtx_exit(&(_sc)->wx_mtx, MTX_DEF) - /* * We offset the the receive frame header by two bytes so that the actual * payload is 32 bit aligned. On platforms that require strict structure |