diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2001-11-05 17:25:59 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2001-11-05 17:25:59 +0000 |
commit | 85530efaf7a6a42f72dd88dd2812fc34f33a931e (patch) | |
tree | fe27ed806015eba36ede599b284de31066d02abb | |
parent | 6278fb02068a0fc75a8a6ecb4ed0a3292aad76ab (diff) |
Switch everything to the new bus_dmamap_sync API.
Most work by Wilbern Cobb <vedge@csoft.org> with some fixes from me, mickey@
and drahn@.
49 files changed, 421 insertions, 501 deletions
diff --git a/sys/arch/alpha/dev/bus_dma.c b/sys/arch/alpha/dev/bus_dma.c index 2a09c4552a4..81b7171a774 100644 --- a/sys/arch/alpha/dev/bus_dma.c +++ b/sys/arch/alpha/dev/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.4 2001/09/19 20:50:56 mickey Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.5 2001/11/05 17:25:57 art Exp $ */ /* $NetBSD: bus_dma.c,v 1.40 2000/07/17 04:47:56 thorpej Exp $ */ /*- @@ -429,10 +429,12 @@ _bus_dmamap_unload(t, map) * by chipset-specific DMA map synchronization functions. */ void -_bus_dmamap_sync(t, map, op) +_bus_dmamap_sync(t, map, offset, len, op) bus_dma_tag_t t; bus_dmamap_t map; - bus_dmasync_op_t op; + bus_addr_t offset; + bus_size_t len; + int op; { /* diff --git a/sys/arch/alpha/include/bus.h b/sys/arch/alpha/include/bus.h index 2c6070bcfc3..0f7d4a1c183 100644 --- a/sys/arch/alpha/include/bus.h +++ b/sys/arch/alpha/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.14 2001/10/26 01:28:06 nate Exp $ */ +/* $OpenBSD: bus.h,v 1.15 2001/11/05 17:25:57 art Exp $ */ /* $NetBSD: bus.h,v 1.10 1996/12/02 22:19:32 cgd Exp $ */ /* @@ -430,16 +430,12 @@ struct uio; struct alpha_sgmap; /* - * bus_dmasync_op_t - * * Operations performed by bus_dmamap_sync(). */ -typedef enum { - BUS_DMASYNC_PREREAD, - BUS_DMASYNC_POSTREAD, - BUS_DMASYNC_PREWRITE, - BUS_DMASYNC_POSTWRITE, -} bus_dmasync_op_t; +#define BUS_DMASYNC_PREREAD 0x01 +#define BUS_DMASYNC_POSTREAD 0x02 +#define BUS_DMASYNC_PREWRITE 0x04 +#define BUS_DMASYNC_POSTWRITE 0x08 /* * alpha_bus_t @@ -537,7 +533,7 @@ struct alpha_bus_dma_tag { bus_dma_segment_t *, int, bus_size_t, int); void (*_dmamap_unload)(bus_dma_tag_t, bus_dmamap_t); void (*_dmamap_sync)(bus_dma_tag_t, bus_dmamap_t, - bus_dmasync_op_t); + bus_addr_t, bus_size_t, int); /* * DMA memory utility functions. @@ -570,8 +566,8 @@ struct alpha_bus_dma_tag { (*(t)->_dmamap_load_raw)((t), (m), (sg), (n), (s), (f)) #define bus_dmamap_unload(t, p) \ (*(t)->_dmamap_unload)((t), (p)) -#define bus_dmamap_sync(t, p, op) \ - (*(t)->_dmamap_sync)((t), (p), (op)) +#define bus_dmamap_sync(t, p, a, s, op) \ + (*(t)->_dmamap_sync)((t), (p), (a), (s), (op)) #define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \ (*(t)->_dmamem_alloc)((t), (s), (a), (b), (sg), (n), (r), (f)) #define bus_dmamem_free(t, sg, n) \ @@ -635,7 +631,8 @@ int _bus_dmamap_load_raw_direct(bus_dma_tag_t, bus_dmamap_t, bus_dma_segment_t *, int, bus_size_t, int); void _bus_dmamap_unload(bus_dma_tag_t, bus_dmamap_t); -void _bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_dmasync_op_t); +void _bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t, + bus_size_t, int); int _bus_dmamem_alloc(bus_dma_tag_t tag, bus_size_t size, bus_size_t alignment, bus_size_t boundary, diff --git a/sys/arch/alpha/isa/isa_machdep.h b/sys/arch/alpha/isa/isa_machdep.h index 0fdf551a634..2c9f75f5a07 100644 --- a/sys/arch/alpha/isa/isa_machdep.h +++ b/sys/arch/alpha/isa/isa_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: isa_machdep.h,v 1.9 2001/11/05 02:39:57 art Exp $ */ +/* $OpenBSD: isa_machdep.h,v 1.10 2001/11/05 17:25:57 art Exp $ */ /* $NetBSD: isa_machdep.h,v 1.3 1996/11/19 04:53:07 cgd Exp $ */ /* @@ -77,8 +77,8 @@ int isadma_bounce_dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t, int isadma_bounce_dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t, bus_dma_segment_t *, int, bus_size_t, int); void isadma_bounce_dmamap_unload(bus_dma_tag_t, bus_dmamap_t); -void isadma_bounce_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, - bus_dmasync_op_t); +void isadma_bounce_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t, + bus_size_t, int); int isadma_bounce_dmamem_alloc(bus_dma_tag_t, bus_size_t, bus_size_t, bus_size_t, bus_dma_segment_t *, int, int *, int); #endif /* _ALPHA_BUS_DMA_PRIVATE */ diff --git a/sys/arch/alpha/isa/isadma_bounce.c b/sys/arch/alpha/isa/isadma_bounce.c index 7dc9014957d..14b61e65560 100644 --- a/sys/arch/alpha/isa/isadma_bounce.c +++ b/sys/arch/alpha/isa/isadma_bounce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isadma_bounce.c,v 1.1 2001/11/05 02:39:56 art Exp $ */ +/* $OpenBSD: isadma_bounce.c,v 1.2 2001/11/05 17:25:57 art Exp $ */ /* $NetBSD: isadma_bounce.c,v 1.3 2000/06/29 09:02:57 mrg Exp $ */ /*- @@ -386,12 +386,10 @@ isadma_bounce_dmamap_unload(bus_dma_tag_t t, bus_dmamap_t map) } void -isadma_bounce_dmamap_sync(bus_dma_tag_t t, bus_dmamap_t map, - bus_dmasync_op_t ops) +isadma_bounce_dmamap_sync(bus_dma_tag_t t, bus_dmamap_t map, bus_addr_t offset, + bus_size_t len, int ops) { struct isadma_bounce_cookie *cookie = map->_dm_cookie; - bus_addr_t offset = 0; - bus_size_t len = map->dm_mapsize; /* * Mixing PRE and POST operations is not allowed. diff --git a/sys/arch/hppa/gsc/gscbus.c b/sys/arch/hppa/gsc/gscbus.c index c12c94147bb..02ed051d1cf 100644 --- a/sys/arch/hppa/gsc/gscbus.c +++ b/sys/arch/hppa/gsc/gscbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gscbus.c,v 1.14 2001/10/04 22:01:30 mickey Exp $ */ +/* $OpenBSD: gscbus.c,v 1.15 2001/11/05 17:25:57 art Exp $ */ /* * Copyright (c) 1998 Michael Shalayeff @@ -106,7 +106,8 @@ int gsc_dmamap_load_uio __P((void *, bus_dmamap_t, struct uio *, int)); int gsc_dmamap_load_raw __P((void *, bus_dmamap_t, bus_dma_segment_t *, int, bus_size_t, int)); void gsc_dmamap_unload __P((void *, bus_dmamap_t)); -void gsc_dmamap_sync __P((void *, bus_dmamap_t, bus_dmasync_op_t)); +void gsc_dmamap_sync __P((void *, bus_dmamap_t, bus_addr_t, bus_size_t, + int)); int gsc_dmamem_alloc __P((void *, bus_size_t, bus_size_t, bus_size_t, bus_dma_segment_t *, int, int *, int)); @@ -347,10 +348,12 @@ gsc_dmamap_unload(v, map) } void -gsc_dmamap_sync(v, map, op) +gsc_dmamap_sync(v, map, offset, len, op) void *v; bus_dmamap_t map; - bus_dmasync_op_t op; + bus_addr_t offset; + bus_size_t len; + int op; { } diff --git a/sys/arch/hppa/hppa/mainbus.c b/sys/arch/hppa/hppa/mainbus.c index b31a8ed923b..d1c50ad91c7 100644 --- a/sys/arch/hppa/hppa/mainbus.c +++ b/sys/arch/hppa/hppa/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.13 2001/09/19 20:50:56 mickey Exp $ */ +/* $OpenBSD: mainbus.c,v 1.14 2001/11/05 17:25:57 art Exp $ */ /* * Copyright (c) 1998-2000 Michael Shalayeff @@ -682,7 +682,8 @@ mbus_dmamap_unload(void *v, bus_dmamap_t map) } void -mbus_dmamap_sync(void *v, bus_dmamap_t map, bus_dmasync_op_t ops) +mbus_dmamap_sync(void *v, bus_dmamap_t map, bus_addr_t offset, bus_size_t len, + int ops) { int i; switch (ops) { @@ -693,15 +694,17 @@ mbus_dmamap_sync(void *v, bus_dmamap_t map, bus_dmasync_op_t ops) case BUS_DMASYNC_PREREAD: for (i = map->dm_nsegs; i--; ) - pdcache(HPPA_SID_KERNEL, map->dm_segs[i].ds_addr, - map->dm_segs[i].ds_len); + pdcache(HPPA_SID_KERNEL, + map->dm_segs[i].ds_addr + offset, + len); sync_caches(); break; case BUS_DMASYNC_PREWRITE: for (i = map->dm_nsegs; i--; ) - fdcache(HPPA_SID_KERNEL, map->dm_segs[i].ds_addr, - map->dm_segs[i].ds_len); + fdcache(HPPA_SID_KERNEL, + map->dm_segs[i].ds_addr + offset, + len); sync_caches(); break; } diff --git a/sys/arch/hppa/include/bus.h b/sys/arch/hppa/include/bus.h index 1139bb4c994..4465645ca40 100644 --- a/sys/arch/hppa/include/bus.h +++ b/sys/arch/hppa/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.13 2001/07/30 14:15:59 art Exp $ */ +/* $OpenBSD: bus.h,v 1.14 2001/11/05 17:25:57 art Exp $ */ /* * Copyright (c) 1998,1999 Michael Shalayeff @@ -298,12 +298,11 @@ struct mbuf; struct proc; struct uio; -typedef enum { - BUS_DMASYNC_POSTREAD, - BUS_DMASYNC_POSTWRITE, - BUS_DMASYNC_PREREAD, - BUS_DMASYNC_PREWRITE -} bus_dmasync_op_t; +/* Operations performed by bus_dmamap_sync(). */ +#define BUS_DMASYNC_POSTREAD 0x01 +#define BUS_DMASYNC_POSTWRITE 0x02 +#define BUS_DMASYNC_PREREAD 0x04 +#define BUS_DMASYNC_PREWRITE 0x08 typedef const struct hppa_bus_dma_tag *bus_dma_tag_t; typedef struct hppa_bus_dmamap *bus_dmamap_t; @@ -345,7 +344,8 @@ struct hppa_bus_dma_tag { int (*_dmamap_load_raw) __P((void *, bus_dmamap_t, bus_dma_segment_t *, int, bus_size_t, int)); void (*_dmamap_unload) __P((void *, bus_dmamap_t)); - void (*_dmamap_sync) __P((void *, bus_dmamap_t, bus_dmasync_op_t)); + void (*_dmamap_sync) __P((void *, bus_dmamap_t, bus_addr_t, + bus_size_t, int)); /* * DMA memory utility functions. @@ -374,9 +374,9 @@ struct hppa_bus_dma_tag { (*(t)->_dmamap_load_raw)((t)->_cookie, (m), (sg), (n), (s), (f)) #define bus_dmamap_unload(t, p) \ (*(t)->_dmamap_unload)((t)->_cookie, (p)) -#define bus_dmamap_sync(t, p, o) \ +#define bus_dmamap_sync(t, p, a, l, o) \ (void)((t)->_dmamap_sync ? \ - (*(t)->_dmamap_sync)((t)->_cookie, (p), (o)) : (void)0) + (*(t)->_dmamap_sync)((t)->_cookie, (p), (a), (l), (o)) : (void)0) #define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \ (*(t)->_dmamem_alloc)((t)->_cookie, (s), (a), (b), (sg), (n), (r), (f)) diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 72d05721a4c..db953029c67 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.178 2001/10/04 21:25:03 mickey Exp $ */ +/* $OpenBSD: machdep.c,v 1.179 2001/11/05 17:25:57 art Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -3012,10 +3012,12 @@ _bus_dmamap_unload(t, map) * by bus-specific DMA map synchronization functions. */ void -_bus_dmamap_sync(t, map, op) +_bus_dmamap_sync(t, map, addr, size, op) bus_dma_tag_t t; bus_dmamap_t map; - bus_dmasync_op_t op; + bus_addr_t addr; + bus_size_t size; + int op; { /* Nothing to do here. */ diff --git a/sys/arch/i386/include/bus.h b/sys/arch/i386/include/bus.h index c04d967e0cd..7f65068456f 100644 --- a/sys/arch/i386/include/bus.h +++ b/sys/arch/i386/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.30 2001/07/30 14:15:59 art Exp $ */ +/* $OpenBSD: bus.h,v 1.31 2001/11/05 17:25:57 art Exp $ */ /* $NetBSD: bus.h,v 1.6 1996/11/10 03:19:25 thorpej Exp $ */ /*- @@ -747,16 +747,12 @@ struct proc; struct uio; /* - * bus_dmasync_op_t - * - * Operations performed by bus_dmamap_sync(). + * Operations performed by bus_dmamap_sync(). */ -typedef enum { - BUS_DMASYNC_PREREAD, - BUS_DMASYNC_POSTREAD, - BUS_DMASYNC_PREWRITE, - BUS_DMASYNC_POSTWRITE, -} bus_dmasync_op_t; +#define BUS_DMASYNC_PREREAD 0x01 +#define BUS_DMASYNC_POSTREAD 0x02 +#define BUS_DMASYNC_PREWRITE 0x04 +#define BUS_DMASYNC_POSTWRITE 0x08 typedef struct i386_bus_dma_tag *bus_dma_tag_t; typedef struct i386_bus_dmamap *bus_dmamap_t; @@ -799,7 +795,7 @@ struct i386_bus_dma_tag { bus_dma_segment_t *, int, bus_size_t, int)); void (*_dmamap_unload) __P((bus_dma_tag_t, bus_dmamap_t)); void (*_dmamap_sync) __P((bus_dma_tag_t, bus_dmamap_t, - bus_dmasync_op_t)); + bus_addr_t, bus_size_t, int)); /* * DMA memory utility functions. @@ -829,9 +825,9 @@ struct i386_bus_dma_tag { (*(t)->_dmamap_load_raw)((t), (m), (sg), (n), (s), (f)) #define bus_dmamap_unload(t, p) \ (*(t)->_dmamap_unload)((t), (p)) -#define bus_dmamap_sync(t, p, o) \ +#define bus_dmamap_sync(t, p, o, l, ops) \ (void)((t)->_dmamap_sync ? \ - (*(t)->_dmamap_sync)((t), (p), (o)) : (void)0) + (*(t)->_dmamap_sync)((t), (p), (o), (l), (ops)) : (void)0) #define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \ (*(t)->_dmamem_alloc)((t), (s), (a), (b), (sg), (n), (r), (f)) @@ -882,7 +878,8 @@ int _bus_dmamap_load_uio __P((bus_dma_tag_t, bus_dmamap_t, int _bus_dmamap_load_raw __P((bus_dma_tag_t, bus_dmamap_t, bus_dma_segment_t *, int, bus_size_t, int)); void _bus_dmamap_unload __P((bus_dma_tag_t, bus_dmamap_t)); -void _bus_dmamap_sync __P((bus_dma_tag_t, bus_dmamap_t, bus_dmasync_op_t)); +void _bus_dmamap_sync __P((bus_dma_tag_t, bus_dmamap_t, bus_addr_t, + bus_size_t, int)); int _bus_dmamem_alloc __P((bus_dma_tag_t tag, bus_size_t size, bus_size_t alignment, bus_size_t boundary, diff --git a/sys/arch/i386/isa/isa_machdep.c b/sys/arch/i386/isa/isa_machdep.c index 345633fc772..13cdd3ff3cb 100644 --- a/sys/arch/i386/isa/isa_machdep.c +++ b/sys/arch/i386/isa/isa_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isa_machdep.c,v 1.38 2001/07/30 14:15:59 art Exp $ */ +/* $OpenBSD: isa_machdep.c,v 1.39 2001/11/05 17:25:57 art Exp $ */ /* $NetBSD: isa_machdep.c,v 1.22 1997/06/12 23:57:32 thorpej Exp $ */ #define ISA_DMA_STATS @@ -169,7 +169,7 @@ int _isa_bus_dmamap_load_raw __P((bus_dma_tag_t, bus_dmamap_t, bus_dma_segment_t *, int, bus_size_t, int)); void _isa_bus_dmamap_unload __P((bus_dma_tag_t, bus_dmamap_t)); void _isa_bus_dmamap_sync __P((bus_dma_tag_t, bus_dmamap_t, - bus_dmasync_op_t)); + bus_addr_t, bus_size_t, int)); int _isa_bus_dmamem_alloc __P((bus_dma_tag_t, bus_size_t, bus_size_t, bus_size_t, bus_dma_segment_t *, int, int *, int)); @@ -885,13 +885,24 @@ _isa_bus_dmamap_unload(t, map) * Synchronize an ISA DMA map. */ void -_isa_bus_dmamap_sync(t, map, op) +_isa_bus_dmamap_sync(t, map, offset, len, op) bus_dma_tag_t t; bus_dmamap_t map; - bus_dmasync_op_t op; + bus_addr_t offset; + bus_size_t len; + int op; { struct i386_isa_dma_cookie *cookie = map->_dm_cookie; +#ifdef DEBUG + if ((op & (BUS_DMASYNC_PREWRITE|BUS_DMASYNC_POSTREAD)) != 0) { + if (offset >= map->dm_mapsize) + panic("_isa_bus_dmamap_sync: bad offset"); + if (len == 0 || (offset + len) > map->dm_mapsize) + panic("_isa_bus_dmamap_sync: bad length"); + } +#endif + switch (op) { case BUS_DMASYNC_PREREAD: /* @@ -905,8 +916,9 @@ _isa_bus_dmamap_sync(t, map, op) * caller's buffer to the bounce buffer. */ if (cookie->id_flags & ID_IS_BOUNCING) - bcopy(cookie->id_origbuf, cookie->id_bouncebuf, - cookie->id_origbuflen); + bcopy(cookie->id_origbuf + offset, + cookie->id_bouncebuf + offset, + len); break; case BUS_DMASYNC_POSTREAD: @@ -915,8 +927,9 @@ _isa_bus_dmamap_sync(t, map, op) * bounce buffer to the caller's buffer. */ if (cookie->id_flags & ID_IS_BOUNCING) - bcopy(cookie->id_bouncebuf, cookie->id_origbuf, - cookie->id_origbuflen); + bcopy(cookie->id_bouncebuf + offset, + cookie->id_origbuf + offset, + len); break; case BUS_DMASYNC_POSTWRITE: @@ -1214,7 +1227,7 @@ isadma_copyfrombuf(addr, nbytes, nphys, phys) bus_dma_tag_t dmat = ((struct isa_softc *)isa_dev)->sc_dmat; bus_dmamap_t dmam = phys[0].dmam; - bus_dmamap_sync(dmat, dmam, BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(dmat, dmam, 0, dmam->dm_mapsize, BUS_DMASYNC_POSTREAD); } /* @@ -1230,7 +1243,7 @@ isadma_copytobuf(addr, nbytes, nphys, phys) bus_dma_tag_t dmat = ((struct isa_softc *)isa_dev)->sc_dmat; bus_dmamap_t dmam = phys[0].dmam; - bus_dmamap_sync(dmat, dmam, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(dmat, dmam, 0, dmam->dm_mapsize, BUS_DMASYNC_PREWRITE); } #endif /* __ISADMA_COMPAT */ #endif /* NISADMA > 0 */ diff --git a/sys/arch/macppc/include/bus.h b/sys/arch/macppc/include/bus.h index eb4904a0ad5..91243530911 100644 --- a/sys/arch/macppc/include/bus.h +++ b/sys/arch/macppc/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */ +/* $OpenBSD: bus.h,v 1.2 2001/11/05 17:25:58 art Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom. All rights reserved. @@ -393,12 +393,10 @@ struct mbuf; struct proc; struct uio; -typedef enum { - BUS_DMASYNC_POSTREAD, - BUS_DMASYNC_POSTWRITE, - BUS_DMASYNC_PREREAD, - BUS_DMASYNC_PREWRITE -} bus_dmasync_op_t; +#define BUS_DMASYNC_POSTREAD 0x01 +#define BUS_DMASYNC_POSTWRITE 0x02 +#define BUS_DMASYNC_PREREAD 0x04 +#define BUS_DMASYNC_PREWRITE 0x08 typedef struct powerpc_bus_dma_tag *bus_dma_tag_t; typedef struct powerpc_bus_dmamap *bus_dmamap_t; @@ -440,7 +438,8 @@ struct powerpc_bus_dma_tag { int (*_dmamap_load_raw) __P((bus_dma_tag_t , bus_dmamap_t, bus_dma_segment_t *, int, bus_size_t, int)); void (*_dmamap_unload) __P((bus_dma_tag_t , bus_dmamap_t)); - void (*_dmamap_sync) __P((bus_dma_tag_t , bus_dmamap_t, bus_dmasync_op_t)); + void (*_dmamap_sync) __P((bus_dma_tag_t , bus_dmamap_t, + bus_addr_t, bus_size_t, int)); /* * DMA memory utility functions. @@ -469,9 +468,9 @@ struct powerpc_bus_dma_tag { (*(t)->_dmamap_load_raw)((t), (m), (sg), (n), (s), (f)) #define bus_dmamap_unload(t, p) \ (*(t)->_dmamap_unload)((t), (p)) -#define bus_dmamap_sync(t, p, o) \ +#define bus_dmamap_sync(t, p, a, l, o) \ (void)((t)->_dmamap_sync ? \ - (*(t)->_dmamap_sync)((t), (p), (o)) : (void)0) + (*(t)->_dmamap_sync)((t), (p), (a), (l), (o)) : (void)0) #define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \ (*(t)->_dmamem_alloc)((t)->_cookie, (s), (a), (b), (sg), (n), (r), (f)) @@ -494,7 +493,8 @@ int _dmamap_load_uio __P((bus_dma_tag_t, bus_dmamap_t, struct uio *, int)); int _dmamap_load_raw __P((bus_dma_tag_t, bus_dmamap_t, bus_dma_segment_t *, int, bus_size_t, int)); void _dmamap_unload __P((bus_dma_tag_t, bus_dmamap_t)); -void _dmamap_sync __P((bus_dma_tag_t, bus_dmamap_t, bus_dmasync_op_t)); +void _dmamap_sync __P((bus_dma_tag_t, bus_dmamap_t, bus_addr_t, bus_size_t, + int)); int _dmamem_alloc __P((bus_dma_tag_t, bus_size_t, bus_size_t, bus_size_t, bus_dma_segment_t *, int, int *, int)); @@ -524,6 +524,7 @@ struct powerpc_bus_dmamap { /* * PUBLIC MEMBERS: these are used by machine-independent code. */ + bus_size_t dm_mapsize; /* size of the mapping */ int dm_nsegs; /* # valid segments in mapping */ bus_dma_segment_t dm_segs[1]; /* segments; variable length */ }; diff --git a/sys/arch/macppc/macppc/dma.c b/sys/arch/macppc/macppc/dma.c index 0258f412bbf..c7b1b7198f6 100644 --- a/sys/arch/macppc/macppc/dma.c +++ b/sys/arch/macppc/macppc/dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dma.c,v 1.3 2001/09/19 20:50:57 mickey Exp $ */ +/* $OpenBSD: dma.c,v 1.4 2001/11/05 17:25:58 art Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -104,6 +104,7 @@ _dmamap_create(t, size, nsegments, maxsegsz, boundary, flags, dmamp) map->_dm_boundary = boundary; map->_dm_flags = flags & ~(BUS_DMA_WAITOK|BUS_DMA_NOWAIT); map->dm_nsegs = 0; /* no valid mappings */ + map->dm_mapsize = 0; *dmamp = map; return (0); @@ -140,11 +141,13 @@ _dmamap_load(t, map, buf, buflen, p, flags) caddr_t vaddr = buf; int first, seg; pmap_t pmap; + bus_size_t saved_buflen; /* * Make sure that on error condition we return "no valid mappings". */ map->dm_nsegs = 0; + map->dm_mapsize = 0; if (buflen > map->_dm_size) return (EINVAL); @@ -157,6 +160,7 @@ _dmamap_load(t, map, buf, buflen, p, flags) lastaddr = ~0; /* XXX gcc */ bmask = ~(map->_dm_boundary - 1); + saved_buflen = buflen; for (first = 1, seg = 0; buflen > 0; ) { /* * Get the physical address for this segment. @@ -215,6 +219,7 @@ _dmamap_load(t, map, buf, buflen, p, flags) return (EFBIG); /* XXX better return value here? */ map->dm_nsegs = seg + 1; + map->dm_mapsize = saved_buflen; return (0); } @@ -280,6 +285,7 @@ _dmamap_load_raw(t, map, segs, nsegs, size, flags) bcopy(segs, map->dm_segs, nsegs * sizeof(*segs)); map->dm_nsegs = nsegs; + map->dm_mapsize = size; return (0); } @@ -298,6 +304,7 @@ _dmamap_unload(t, map) * invalid. */ map->dm_nsegs = 0; + map->dm_mapsize = 0; } /* @@ -305,10 +312,12 @@ _dmamap_unload(t, map) * by bus-specific DMA map synchronization functions. */ void -_dmamap_sync(t, map, op) +_dmamap_sync(t, map, offset, len, op) bus_dma_tag_t t; bus_dmamap_t map; - bus_dmasync_op_t op; + bus_addr_t offset; + bus_size_t len; + int op; { /* Nothing to do here. */ diff --git a/sys/arch/mvmeppc/include/bus_mi.h b/sys/arch/mvmeppc/include/bus_mi.h index 9ce8209835b..a2cc5b80ba3 100644 --- a/sys/arch/mvmeppc/include/bus_mi.h +++ b/sys/arch/mvmeppc/include/bus_mi.h @@ -1,5 +1,5 @@ /* $NetBSD: bus.h,v 1.1 2001/06/06 17:37:37 matt Exp $ */ -/* $OpenBSD: bus_mi.h,v 1.2 2001/09/23 01:42:38 miod Exp $ */ +/* $OpenBSD: bus_mi.h,v 1.3 2001/11/05 17:25:58 art Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -977,15 +977,10 @@ bus_space_copy_region_4(t, h1, o1, h2, o2, c) struct mbuf; struct uio; -/* - * Operations performed by bus_dmamap_sync(). - */ -typedef enum { - BUS_DMASYNC_PREREAD = 0x01, /* pre-read synchronization */ - BUS_DMASYNC_POSTREAD = 0x02, /* post-read synchronization */ - BUS_DMASYNC_PREWRITE = 0x04, /* pre-write synchronization */ - BUS_DMASYNC_POSTWRITE = 0x08 /* post-write synchronization */ -} bus_dmasync_op_t; +#define BUS_DMASYNC_PREREAD 0x01 +#define BUS_DMASYNC_POSTREAD 0x02 +#define BUS_DMASYNC_PREWRITE 0x04 +#define BUS_DMASYNC_POSTWRITE 0x08 typedef struct powerpc_bus_dma_tag *bus_dma_tag_t; typedef struct powerpc_bus_dmamap *bus_dmamap_t; @@ -1035,7 +1030,8 @@ struct powerpc_bus_dma_tag { int (*_dmamap_load_raw) __P((bus_dma_tag_t, bus_dmamap_t, bus_dma_segment_t *, int, bus_size_t, int)); void (*_dmamap_unload) __P((bus_dma_tag_t, bus_dmamap_t)); - void (*_dmamap_sync) __P((bus_dma_tag_t , bus_dmamap_t, bus_dmasync_op_t)); + void (*_dmamap_sync) __P((bus_dma_tag_t, bus_dmamap_t, + bus_addr_t, bus_size_t, int)); /* * DMA memory utility functions. @@ -1065,9 +1061,9 @@ struct powerpc_bus_dma_tag { (*(t)->_dmamap_load_raw)((t), (m), (sg), (n), (s), (f)) #define bus_dmamap_unload(t, p) \ (*(t)->_dmamap_unload)((t), (p)) -#define bus_dmamap_sync(t, p, o) \ +#define bus_dmamap_sync(t, p, a, l, o) \ (void)((t)->_dmamap_sync ? \ - (*(t)->_dmamap_sync)((t), (p), (o)) : (void)0) + (*(t)->_dmamap_sync)((t), (p), (a), (l), (o)) : (void)0) #define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \ (*(t)->_dmamem_alloc)((t), (s), (a), (b), (sg), (n), (r), (f)) @@ -1119,7 +1115,8 @@ int _bus_dmamap_load_uio __P((bus_dma_tag_t, bus_dmamap_t, int _bus_dmamap_load_raw __P((bus_dma_tag_t, bus_dmamap_t, bus_dma_segment_t *, int, bus_size_t, int)); void _bus_dmamap_unload __P((bus_dma_tag_t, bus_dmamap_t)); -void _bus_dmamap_sync __P((bus_dma_tag_t, bus_dmamap_t, bus_dmasync_op_t)); +void _bus_dmamap_sync __P((bus_dma_tag_t, bus_dmamap_t, bus_addr_t, + bus_size_t, int)); int _bus_dmamem_alloc __P((bus_dma_tag_t tag, bus_size_t size, bus_size_t alignment, bus_size_t boundary, diff --git a/sys/arch/mvmeppc/mvmeppc/bus_dma.c b/sys/arch/mvmeppc/mvmeppc/bus_dma.c index c00ab320083..eef88567b78 100644 --- a/sys/arch/mvmeppc/mvmeppc/bus_dma.c +++ b/sys/arch/mvmeppc/mvmeppc/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.5 2001/09/19 20:50:57 mickey Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.6 2001/11/05 17:25:58 art Exp $ */ /* $NetBSD: bus_dma.c,v 1.2 2001/06/10 02:31:25 briggs Exp $ */ /*- @@ -405,10 +405,12 @@ _bus_dmamap_unload(t, map) */ void -_bus_dmamap_sync(t, map, op) +_bus_dmamap_sync(t, map, offset, len, op) bus_dma_tag_t t; bus_dmamap_t map; - bus_dmasync_op_t op; + bus_addr_t offset; + bus_size_t len; + int op; { int i; switch (op) { @@ -418,7 +420,7 @@ _bus_dmamap_sync(t, map, op) case BUS_DMASYNC_PREREAD: for (i = map->dm_nsegs; i--; ) invdcache(map->dm_segs[i].ds_addr, - map->dm_segs[i].ds_len); + len); break; } } diff --git a/sys/dev/eisa/cac_eisa.c b/sys/dev/eisa/cac_eisa.c index 7c90dea630c..0e79cffc4d5 100644 --- a/sys/dev/eisa/cac_eisa.c +++ b/sys/dev/eisa/cac_eisa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cac_eisa.c,v 1.1 2000/12/17 21:35:03 mickey Exp $ */ +/* $OpenBSD: cac_eisa.c,v 1.2 2001/11/05 17:25:58 art Exp $ */ /* $NetBSD: cac_eisa.c,v 1.1 2000/09/01 12:15:20 ad Exp $ */ /*- @@ -244,8 +244,8 @@ cac_eisa_l0_submit(struct cac_softc *sc, struct cac_ccb *ccb) size = letoh16(ccb->ccb_hdr.size) << 2; ccb->ccb_hdr.size = 0; - bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, - BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, (caddr_t)ccb - sc->sc_ccbs, + sizeof(struct cac_ccb), BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); cac_outb(sc, CAC_EISAREG_SYSTEM_DOORBELL, CAC_EISA_CHANNEL_CLEAR); cac_outl(sc, CAC_EISAREG_LIST_ADDR, ccb->ccb_paddr); @@ -275,7 +275,7 @@ cac_eisa_l0_completed(struct cac_softc *sc) off = (off & ~3) - sc->sc_ccbs_paddr; ccb = (struct cac_ccb *)(sc->sc_ccbs + off); - bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, + bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, off, sizeof(struct cac_ccb), BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD); ccb->ccb_req.error = status; diff --git a/sys/dev/i2o/iop.c b/sys/dev/i2o/iop.c index 834ecf43578..a3c20855c8f 100644 --- a/sys/dev/i2o/iop.c +++ b/sys/dev/i2o/iop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iop.c,v 1.19 2001/10/27 20:54:24 mickey Exp $ */ +/* $OpenBSD: iop.c,v 1.20 2001/11/05 17:25:58 art Exp $ */ /* $NetBSD: iop.c,v 1.12 2001/03/21 14:27:05 ad Exp $ */ /*- @@ -914,15 +914,16 @@ iop_status_get(struct iop_softc *sc, int nosleep) mf.length = sizeof(*st); bzero(st, sizeof(*st)); - bus_dmamap_sync(sc->sc_dmat, sc->sc_scr_dmamap, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->sc_dmat, sc->sc_scr_dmamap, 0, sizeof(*st), + BUS_DMASYNC_PREREAD); if ((rv = iop_post(sc, (u_int32_t *)&mf))) return (rv); /* XXX */ POLL(2500, - (bus_dmamap_sync(sc->sc_dmat, sc->sc_scr_dmamap, - BUS_DMASYNC_POSTREAD), st->syncbyte == 0xff)); + (bus_dmamap_sync(sc->sc_dmat, sc->sc_scr_dmamap, 0, + sizeof(*st), BUS_DMASYNC_POSTREAD), st->syncbyte == 0xff)); if (st->syncbyte != 0xff) return (EIO); @@ -957,7 +958,8 @@ iop_ofifo_init(struct iop_softc *sc) mb[0] += 2 << 16; *sw = 0; - bus_dmamap_sync(sc->sc_dmat, sc->sc_scr_dmamap, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->sc_dmat, sc->sc_scr_dmamap, 0, sizeof(*sw), + BUS_DMASYNC_PREREAD); /* * The I2O spec says that there are two SGLs: one for the status @@ -970,7 +972,7 @@ iop_ofifo_init(struct iop_softc *sc) /* XXX */ POLL(5000, - (bus_dmamap_sync(sc->sc_dmat, sc->sc_scr_dmamap, + (bus_dmamap_sync(sc->sc_dmat, sc->sc_scr_dmamap, 0, sizeof(*sw), BUS_DMASYNC_POSTREAD), *sw == htole32(I2O_EXEC_OUTBOUND_INIT_COMPLETE))); if (*sw != htole32(I2O_EXEC_OUTBOUND_INIT_COMPLETE)) { @@ -1367,14 +1369,15 @@ iop_reset(struct iop_softc *sc) mf.statushigh = sizeof pa > sizeof mf.statuslow ? pa >> 32 : 0; *sw = htole32(0); - bus_dmamap_sync(sc->sc_dmat, sc->sc_scr_dmamap, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->sc_dmat, sc->sc_scr_dmamap, 0, sizeof(*sw), + BUS_DMASYNC_PREREAD); if ((rv = iop_post(sc, (u_int32_t *)&mf))) return (rv); /* XXX */ POLL(2500, - (bus_dmamap_sync(sc->sc_dmat, sc->sc_scr_dmamap, + (bus_dmamap_sync(sc->sc_dmat, sc->sc_scr_dmamap, 0, sizeof(*sw), BUS_DMASYNC_POSTREAD), *sw != htole32(0))); if (*sw != htole32(I2O_RESET_IN_PROGRESS)) { printf("%s: reset rejected, status 0x%x\n", @@ -1462,10 +1465,11 @@ iop_handle_reply(struct iop_softc *sc, u_int32_t rmfa) rb = (struct i2o_reply *)(sc->sc_rep + off); /* Perform reply queue DMA synchronisation. XXX This is rubbish. */ - bus_dmamap_sync(sc->sc_dmat, sc->sc_rep_dmamap, BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(sc->sc_dmat, sc->sc_rep_dmamap, off, + sc->sc_rep_dmamap->dm_mapsize, BUS_DMASYNC_POSTREAD); if (--sc->sc_curib != 0) - bus_dmamap_sync(sc->sc_dmat, sc->sc_rep_dmamap, - BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->sc_dmat, sc->sc_rep_dmamap, 0, + sc->sc_rep_size, BUS_DMASYNC_PREREAD); #ifdef I2ODEBUG if ((letoh32(rb->msgflags) & I2O_MSGFLAGS_64BIT) != 0) @@ -1761,7 +1765,7 @@ iop_msg_map(struct iop_softc *sc, struct iop_msg *im, u_int32_t *mb, /* Fix up the transfer record, and sync the map. */ ix->ix_flags = (out ? IX_OUT : IX_IN); ix->ix_size = xfersize; - bus_dmamap_sync(sc->sc_dmat, ix->ix_map, + bus_dmamap_sync(sc->sc_dmat, ix->ix_map, 0, xfersize, out ? BUS_DMASYNC_POSTWRITE : BUS_DMASYNC_POSTREAD); /* @@ -1866,7 +1870,8 @@ iop_msg_map_bio(struct iop_softc *sc, struct iop_msg *im, u_int32_t *mb, /* Fix up the transfer record, and sync the map. */ ix->ix_flags = (out ? IX_OUT : IX_IN); ix->ix_size = xfersize; - bus_dmamap_sync(sc->sc_dmat, ix->ix_map, + bus_dmamap_sync(sc->sc_dmat, ix->ix_map, 0, + ix->ix_map->dm_mapsize, out ? BUS_DMASYNC_POSTWRITE : BUS_DMASYNC_POSTREAD); /* @@ -1892,7 +1897,7 @@ iop_msg_unmap(struct iop_softc *sc, struct iop_msg *im) #endif for (ix = im->im_xfer, i = 0;;) { - bus_dmamap_sync(sc->sc_dmat, ix->ix_map, + bus_dmamap_sync(sc->sc_dmat, ix->ix_map, 0, ix->ix_size, ix->ix_flags & IX_OUT ? BUS_DMASYNC_POSTWRITE : BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc->sc_dmat, ix->ix_map); @@ -1948,8 +1953,8 @@ iop_post(struct iop_softc *sc, u_int32_t *mb) /* Perform reply buffer DMA synchronisation. XXX This is rubbish. */ if (sc->sc_curib++ == 0) - bus_dmamap_sync(sc->sc_dmat, sc->sc_rep_dmamap, - BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->sc_dmat, sc->sc_rep_dmamap, 0, + sc->sc_rep_size, BUS_DMASYNC_PREREAD); /* Copy out the message frame. */ bus_space_write_region_4(sc->sc_iot, sc->sc_ioh, mfa, mb, diff --git a/sys/dev/ic/aac.c b/sys/dev/ic/aac.c index ff88c3e58cc..1b69cbd1821 100644 --- a/sys/dev/ic/aac.c +++ b/sys/dev/ic/aac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aac.c,v 1.8 2001/09/21 17:55:43 miod Exp $ */ +/* $OpenBSD: aac.c,v 1.9 2001/11/05 17:25:58 art Exp $ */ /*- * Copyright (c) 2000 Michael Smith @@ -1640,7 +1640,8 @@ aac_map_command(struct aac_ccb *ccb) return (error); } - bus_dmamap_sync(sc->sc_dmat, ccb->ac_dmamap_xfer, + bus_dmamap_sync(sc->sc_dmat, ccb->ac_dmamap_xfer, 0, + ccb->ac_dmamap_xfer->dm_mapsize, (xs->flags & SCSI_DATA_IN) ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); } @@ -1666,7 +1667,8 @@ aac_unmap_command(struct aac_ccb *ccb) #endif if (xs->datalen != 0) { - bus_dmamap_sync(sc->sc_dmat, ccb->ac_dmamap_xfer, + bus_dmamap_sync(sc->sc_dmat, ccb->ac_dmamap_xfer, 0, + ccb->ac_dmamap_xfer->dm_mapsize, (xs->flags & SCSI_DATA_IN) ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); diff --git a/sys/dev/ic/adv.c b/sys/dev/ic/adv.c index e6a22226a3d..5200e1d0b78 100644 --- a/sys/dev/ic/adv.c +++ b/sys/dev/ic/adv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adv.c,v 1.9 2001/08/26 18:03:07 krw Exp $ */ +/* $OpenBSD: adv.c,v 1.10 2001/11/05 17:25:58 art Exp $ */ /* $NetBSD: adv.c,v 1.6 1998/10/28 20:39:45 dante Exp $ */ /* @@ -778,7 +778,7 @@ adv_scsi_cmd(xs) adv_free_ccb(sc, ccb); return (COMPLETE); } - adv_bus_dmamap_sync(dmat, ccb->dmamap_xfer, + bus_dmamap_sync(dmat, ccb->dmamap_xfer, 0, ccb->dmamap_xfer->dm_mapsize, ((flags & SCSI_DATA_IN) ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE)); @@ -990,7 +990,7 @@ adv_narrow_isr_callback(sc, qdonep) * the data buffer. */ if (xs->datalen) { - adv_bus_dmamap_sync(dmat, ccb->dmamap_xfer, + bus_dmamap_sync(dmat, ccb->dmamap_xfer, 0, ccb->dmamap_xfer->dm_mapsize, ((xs->flags & SCSI_DATA_IN) ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE)); diff --git a/sys/dev/ic/adv.h b/sys/dev/ic/adv.h index e3498fb2101..d8e9b31ae2f 100644 --- a/sys/dev/ic/adv.h +++ b/sys/dev/ic/adv.h @@ -1,4 +1,4 @@ -/* $OpenBSD: adv.h,v 1.3 2001/08/26 18:03:07 krw Exp $ */ +/* $OpenBSD: adv.h,v 1.4 2001/11/05 17:25:58 art Exp $ */ /* $NetBSD: adv.h,v 1.3 1998/09/26 16:02:56 dante Exp $ */ /* @@ -93,12 +93,4 @@ int adv_intr __P((void *arg)); /******************************************************************************/ -#ifdef __HAS_NEW_BUS_DMAMAP_SYNC -#define adv_bus_dmamap_sync(tag, map, off, len, op) \ - bus_dmamap_sync((tag), (map), (off), (len), (op)) -#else -#define adv_bus_dmamap_sync(tag, map, off, len, op) \ - bus_dmamap_sync((tag), (map), (op)) -#endif - #endif /* _ADVANSYS_NARROW_H_ */ diff --git a/sys/dev/ic/adw.c b/sys/dev/ic/adw.c index a71e92f199d..6ab8bb987d4 100644 --- a/sys/dev/ic/adw.c +++ b/sys/dev/ic/adw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adw.c,v 1.22 2001/09/21 17:55:43 miod Exp $ */ +/* $OpenBSD: adw.c,v 1.23 2001/11/05 17:25:58 art Exp $ */ /* $NetBSD: adw.c,v 1.23 2000/05/27 18:24:50 dante Exp $ */ /* @@ -854,7 +854,7 @@ adw_build_req(xs, ccb, flags) adw_free_ccb(sc, ccb); return (0); } - adw_bus_dmamap_sync(dmat, ccb->dmamap_xfer, + bus_dmamap_sync(dmat, ccb->dmamap_xfer, 0, ccb->dmamap_xfer->dm_mapsize, (xs->flags & SCSI_DATA_IN) ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); @@ -1206,7 +1206,7 @@ adw_isr_callback(sc, scsiq) */ dmat = sc->sc_dmat; if (xs->datalen) { - adw_bus_dmamap_sync(dmat, ccb->dmamap_xfer, + bus_dmamap_sync(dmat, ccb->dmamap_xfer, 0, ccb->dmamap_xfer->dm_mapsize, ((xs->flags & SCSI_DATA_IN) ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE)); diff --git a/sys/dev/ic/adw.h b/sys/dev/ic/adw.h index 00eccde2028..a2ee9d74e27 100644 --- a/sys/dev/ic/adw.h +++ b/sys/dev/ic/adw.h @@ -1,4 +1,4 @@ -/* $OpenBSD: adw.h,v 1.7 2001/08/26 02:39:05 krw Exp $ */ +/* $OpenBSD: adw.h,v 1.8 2001/11/05 17:25:58 art Exp $ */ /* $NetBSD: adw.h,v 1.9 2000/05/26 15:13:43 dante Exp $ */ /* @@ -116,13 +116,4 @@ ADW_CCB *adw_ccb_phys_kv __P((ADW_SOFTC *, u_int32_t)); /******************************************************************************/ -#ifdef __HAS_NEW_BUS_DMAMAP_SYNC -#define adw_bus_dmamap_sync(tag, map, off, len, op) \ - bus_dmamap_sync((tag), (map), (off), (len), (op)) -#else -#define adw_bus_dmamap_sync(tag, map, off, len, op) \ - bus_dmamap_sync((tag), (map), (op)) -#endif - - #endif /* _ADVANSYS_ADW_H_ */ diff --git a/sys/dev/ic/aic7xxx.c b/sys/dev/ic/aic7xxx.c index 4849d17e887..d1bbca9dd1b 100644 --- a/sys/dev/ic/aic7xxx.c +++ b/sys/dev/ic/aic7xxx.c @@ -33,7 +33,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/aic7xxx/aic7xxx.c,v 1.40 2000/01/07 23:08:17 gibbs Exp $ - * $OpenBSD: aic7xxx.c,v 1.31 2001/09/20 17:02:31 mpech Exp $ + * $OpenBSD: aic7xxx.c,v 1.32 2001/11/05 17:25:58 art Exp $ */ /* * A few notes on features of the driver. @@ -255,14 +255,6 @@ typedef enum { MSGLOOP_TERMINATED } msg_loop_stat; -#ifdef __HAS_NEW_BUS_DMAMAP_SYNC -#define ahc_bus_dmamap_sync(tag, map, off, len, op) \ - bus_dmamap_sync((tag), (map), (off), (len), (op)) -#else -#define ahc_bus_dmamap_sync(tag, map, off, len, op) \ - bus_dmamap_sync((tag), (map), (op)) -#endif - STATIC int ahc_parse_msg __P((struct ahc_softc *ahc, struct scsi_link *sc_link, struct ahc_devinfo *devinfo)); @@ -531,7 +523,7 @@ ahc_index_busy_tcl(ahc, tcl, unbusy) scbid = ahc->untagged_scbs[tcl]; if (unbusy) { ahc->untagged_scbs[tcl] = SCB_LIST_NULL; - ahc_bus_dmamap_sync(ahc->sc_dmat, ahc->shared_data_dmamap, + bus_dmamap_sync(ahc->sc_dmat, ahc->shared_data_dmamap, UNTAGGEDSCB_OFFSET * 256, 256, BUS_DMASYNC_PREWRITE); } @@ -544,7 +536,7 @@ ahc_busy_tcl(ahc, scb) struct scb *scb; { ahc->untagged_scbs[scb->hscb->tcl] = scb->hscb->tag; - ahc_bus_dmamap_sync(ahc->sc_dmat, ahc->shared_data_dmamap, + bus_dmamap_sync(ahc->sc_dmat, ahc->shared_data_dmamap, UNTAGGEDSCB_OFFSET * 256, 256, BUS_DMASYNC_PREWRITE); } @@ -606,7 +598,7 @@ ahc_run_qoutfifo(ahc) struct scb *scb; u_int scb_index; - ahc_bus_dmamap_sync(ahc->sc_dmat, ahc->shared_data_dmamap, + bus_dmamap_sync(ahc->sc_dmat, ahc->shared_data_dmamap, 0, 256, BUS_DMASYNC_POSTREAD); while (ahc->qoutfifo[ahc->qoutfifonext] != SCB_LIST_NULL) { @@ -3455,13 +3447,13 @@ ahc_done(ahc, scb) target = sc_link->target; if (xs->datalen) { - bus_dmasync_op_t op; + int op; if ((xs->flags & SCSI_DATA_IN) != 0) op = BUS_DMASYNC_POSTREAD; else op = BUS_DMASYNC_POSTWRITE; - ahc_bus_dmamap_sync(ahc->sc_dmat, scb->dmamap, + bus_dmamap_sync(ahc->sc_dmat, scb->dmamap, 0, scb->dmamap->dm_mapsize, op); bus_dmamap_unload(ahc->sc_dmat, scb->dmamap); } @@ -3681,7 +3673,7 @@ ahc_init(ahc) for (i = 0; i < 256; i++) ahc->qoutfifo[i] = SCB_LIST_NULL; - ahc_bus_dmamap_sync(ahc->sc_dmat, ahc->shared_data_dmamap, + bus_dmamap_sync(ahc->sc_dmat, ahc->shared_data_dmamap, 0, driver_data_size, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); /* @@ -4297,9 +4289,9 @@ ahc_execute_scb(arg, dm_segs, nsegments) if (nsegments != 0) { - struct ahc_dma_seg *sg; + struct ahc_dma_seg *sg; bus_dma_segment_t *end_seg; - bus_dmasync_op_t op; + int op; end_seg = dm_segs + nsegments; @@ -4323,7 +4315,7 @@ ahc_execute_scb(arg, dm_segs, nsegments) op = BUS_DMASYNC_PREREAD; else op = BUS_DMASYNC_PREWRITE; - ahc_bus_dmamap_sync(ahc->sc_dmat, scb->dmamap, + bus_dmamap_sync(ahc->sc_dmat, scb->dmamap, 0, scb->dmamap->dm_mapsize, op); } else { scb->hscb->SG_pointer = 0; @@ -4379,7 +4371,7 @@ ahc_execute_scb(arg, dm_segs, nsegments) ahc->qinfifo[ahc->qinfifonext++] = scb->hscb->tag; - ahc_bus_dmamap_sync(ahc->sc_dmat, ahc->shared_data_dmamap, + bus_dmamap_sync(ahc->sc_dmat, ahc->shared_data_dmamap, QINFIFO_OFFSET * 256, 256, BUS_DMASYNC_PREWRITE); if ((ahc->features & AHC_QUEUE_REGS) != 0) { @@ -5080,7 +5072,7 @@ bus_reset: ahc->qinfifo[ahc->qinfifonext++] = scb->hscb->tag; - ahc_bus_dmamap_sync(ahc->sc_dmat, + bus_dmamap_sync(ahc->sc_dmat, ahc->shared_data_dmamap, QINFIFO_OFFSET * 256, 256, BUS_DMASYNC_PREWRITE); @@ -5134,7 +5126,7 @@ ahc_search_qinfifo(ahc, target, channel, lun, tag, role, status, action) * for removal will be re-added to the queue as we go. */ ahc->qinfifonext = qinpos; - ahc_bus_dmamap_sync(ahc->sc_dmat, ahc->shared_data_dmamap, + bus_dmamap_sync(ahc->sc_dmat, ahc->shared_data_dmamap, QINFIFO_OFFSET * 256, 256, BUS_DMASYNC_POSTREAD); while (qinpos != qintail) { @@ -5165,7 +5157,7 @@ ahc_search_qinfifo(ahc, target, channel, lun, tag, role, status, action) } qinpos++; } - ahc_bus_dmamap_sync(ahc->sc_dmat, ahc->shared_data_dmamap, + bus_dmamap_sync(ahc->sc_dmat, ahc->shared_data_dmamap, QINFIFO_OFFSET * 256, 256, BUS_DMASYNC_PREWRITE); if ((ahc->features & AHC_QUEUE_REGS) != 0) { diff --git a/sys/dev/ic/ami.c b/sys/dev/ic/ami.c index 9d0dc8fc8e5..35a73263a2d 100644 --- a/sys/dev/ic/ami.c +++ b/sys/dev/ic/ami.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ami.c,v 1.11 2001/09/11 20:05:25 miod Exp $ */ +/* $OpenBSD: ami.c,v 1.12 2001/11/05 17:25:58 art Exp $ */ /* * Copyright (c) 2001 Michael Shalayeff @@ -536,7 +536,8 @@ ami_quartz_done(sc, mbox) qdb = bus_space_read_4(sc->iot, sc->ioh, AMI_QODB); if (qdb == AMI_QODB_READY) { - bus_dmamap_sync(sc->dmat, sc->sc_cmdmap, BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(sc->dmat, sc->sc_cmdmap, 0, + sc->sc_cmdmap->dm_mapsize, BUS_DMASYNC_POSTREAD); *mbox = *sc->sc_mbox; /* ack interrupt */ @@ -659,9 +660,11 @@ ami_cmd(ccb, flags, wait) } AMI_DPRINTF(AMI_D_DMA, ("> ")); - bus_dmamap_sync(sc->dmat, dmap, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->dmat, dmap, 0, dmap->dm_mapsize, + BUS_DMASYNC_PREWRITE); } - bus_dmamap_sync(sc->dmat, sc->sc_cmdmap, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->dmat, sc->sc_cmdmap, 0, sc->sc_cmdmap->dm_mapsize, + BUS_DMASYNC_PREWRITE); if ((error = ami_start(ccb, wait))) { AMI_DPRINTF(AMI_D_DMA, ("error=%d ", error)); @@ -858,7 +861,8 @@ ami_done(sc, idx) timeout_del(&xs->stimeout); if (xs->cmd->opcode != PREVENT_ALLOW && xs->cmd->opcode != SYNCHRONIZE_CACHE) { - bus_dmamap_sync(sc->dmat, ccb->ccb_dmamap, + bus_dmamap_sync(sc->dmat, ccb->ccb_dmamap, 0, + ccb->ccb_dmamap->dm_mapsize, (xs->flags & SCSI_DATA_IN) ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); @@ -871,8 +875,8 @@ ami_done(sc, idx) case AMI_INQUIRY: case AMI_EINQUIRY: case AMI_EINQUIRY3: - bus_dmamap_sync(sc->dmat, ccb->ccb_dmamap, - BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(sc->dmat, ccb->ccb_dmamap, 0, + ccb->ccb_dmamap->dm_mapsize, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc->dmat, ccb->ccb_dmamap); break; default: diff --git a/sys/dev/ic/awi_wep.c b/sys/dev/ic/awi_wep.c index 68d2984632f..d5c920aaa12 100644 --- a/sys/dev/ic/awi_wep.c +++ b/sys/dev/ic/awi_wep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: awi_wep.c,v 1.5 2001/11/05 16:35:00 mickey Exp $ */ +/* $OpenBSD: awi_wep.c,v 1.6 2001/11/05 17:25:58 art Exp $ */ /* $NetBSD: awi_wep.c,v 1.2 2000/07/04 14:47:58 onoe Exp $ */ /* @@ -90,6 +90,7 @@ #include <dev/ic/am79c930var.h> #include <dev/ic/awireg.h> #include <dev/ic/awivar.h> +#include <dev/rndvar.h> #endif #ifdef __OpenBSD__ diff --git a/sys/dev/ic/cac.c b/sys/dev/ic/cac.c index b1b983556b3..0dc2bbaf0bd 100644 --- a/sys/dev/ic/cac.c +++ b/sys/dev/ic/cac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cac.c,v 1.7 2001/10/18 20:24:10 mickey Exp $ */ +/* $OpenBSD: cac.c,v 1.8 2001/11/05 17:25:58 art Exp $ */ /* $NetBSD: cac.c,v 1.15 2000/11/08 19:20:35 ad Exp $ */ /* @@ -339,7 +339,8 @@ cac_cmd(struct cac_softc *sc, int command, void *data, int datasize, bus_dmamap_load(sc->sc_dmat, ccb->ccb_dmamap_xfer, (void *)data, datasize, NULL, BUS_DMA_NOWAIT); - bus_dmamap_sync(sc->sc_dmat, ccb->ccb_dmamap_xfer, + bus_dmamap_sync(sc->sc_dmat, ccb->ccb_dmamap_xfer, 0, + ccb->ccb_dmamap_xfer->dm_mapsize, (flags & CAC_CCB_DATA_IN) != 0 ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); @@ -464,7 +465,8 @@ cac_ccb_done(struct cac_softc *sc, struct cac_ccb *ccb) ccb->ccb_flags &= ~CAC_CCB_ACTIVE; if ((ccb->ccb_flags & (CAC_CCB_DATA_IN | CAC_CCB_DATA_OUT)) != 0) { - bus_dmamap_sync(sc->sc_dmat, ccb->ccb_dmamap_xfer, + bus_dmamap_sync(sc->sc_dmat, ccb->ccb_dmamap_xfer, 0, + ccb->ccb_dmamap_xfer->dm_mapsize, ccb->ccb_flags & CAC_CCB_DATA_IN ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(sc->sc_dmat, ccb->ccb_dmamap_xfer); @@ -795,7 +797,8 @@ cac_l0_submit(struct cac_softc *sc, struct cac_ccb *ccb) #ifdef CAC_DEBUG printf("submit-%x ", ccb->ccb_paddr); #endif - bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, + bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, 0, + sc->sc_dmamap->dm_mapsize, BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); cac_outl(sc, CAC_REG_CMD_FIFO, ccb->ccb_paddr); } @@ -815,7 +818,8 @@ cac_l0_completed(sc) ccb = (struct cac_ccb *)(sc->sc_ccbs + ((off & ~3) - sc->sc_ccbs_paddr)); - bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, + bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, 0, + sc->sc_dmamap->dm_mapsize, BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD); return (ccb); diff --git a/sys/dev/ic/dpt.c b/sys/dev/ic/dpt.c index b5e5b51a52b..7f0cbf6daca 100644 --- a/sys/dev/ic/dpt.c +++ b/sys/dev/ic/dpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dpt.c,v 1.4 2001/07/13 17:04:28 mickey Exp $ */ +/* $OpenBSD: dpt.c,v 1.5 2001/11/05 17:25:58 art Exp $ */ /* $NetBSD: dpt.c,v 1.12 1999/10/23 16:26:33 ad Exp $ */ /*- @@ -202,14 +202,8 @@ dpt_intr(xxx_sc) break; } -#ifdef __NetBSD__ bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap_ccb, sc->sc_spoff, sizeof(struct eata_sp), BUS_DMASYNC_POSTREAD); -#endif /* __NetBSD__ */ -#ifdef __OpenBSD__ - bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap_ccb, - BUS_DMASYNC_POSTREAD); -#endif /* __OpenBSD__ */ if (!sp) { more = dpt_inb(sc, HA_STATUS) & HA_ST_MORE; @@ -234,15 +228,9 @@ dpt_intr(xxx_sc) sc->sc_dv.dv_xname); #endif /* Re-sync DMA map */ -#ifdef __NetBSD__ bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap_ccb, sc->sc_spoff, sizeof(struct eata_sp), BUS_DMASYNC_POSTREAD); -#endif /* __NetBSD__ */ -#ifdef __OpenBSD__ - bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap_ccb, - BUS_DMASYNC_POSTREAD); -#endif /* __OpenBSD__ */ } /* Make sure CCB ID from status packet is realistic */ @@ -250,15 +238,9 @@ dpt_intr(xxx_sc) /* Sync up DMA map and cache cmd status */ ccb = sc->sc_ccbs + sp->sp_ccbid; -#ifdef __NetBSD__ bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap_ccb, CCB_OFF(sc, ccb), sizeof(struct dpt_ccb), BUS_DMASYNC_POSTWRITE); -#endif /* __NetBSD__ */ -#ifdef __OpenBSD__ - bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap_ccb, - BUS_DMASYNC_POSTWRITE); -#endif /* __OpenBSD__ */ ccb->ccb_hba_status = sp->sp_hba_status & 0x7F; ccb->ccb_scsi_status = sp->sp_scsi_status; @@ -824,17 +806,10 @@ dpt_done_ccb(sc, ccb) * data buffer. */ if (xs->datalen) { -#ifdef __NetBSD__ bus_dmamap_sync(dmat, ccb->ccb_dmamap_xfer, 0, ccb->ccb_dmamap_xfer->dm_mapsize, - (xs->xs_control & XS_CTL_DATA_IN) ? BUS_DMASYNC_POSTREAD : - BUS_DMASYNC_POSTWRITE); -#endif /* __NetBSD__ */ -#ifdef __OpenBSD__ - bus_dmamap_sync(dmat, ccb->ccb_dmamap_xfer, (xs->flags & SCSI_DATA_IN) ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); -#endif /* __OpenBSD__ */ bus_dmamap_unload(dmat, ccb->ccb_dmamap_xfer); } @@ -1195,15 +1170,9 @@ dpt_scsi_cmd(xs) return (COMPLETE); } -#ifdef __NetBSD__ bus_dmamap_sync(dmat, xfer, 0, xfer->dm_mapsize, - (flags & XS_CTL_DATA_IN) ? BUS_DMASYNC_PREREAD : + (flags & SCSI_DATA_IN) ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); -#endif /* __NetBSD__ */ -#ifdef __OpenBSD__ - bus_dmamap_sync(dmat, xfer, (xs->flags & SCSI_DATA_IN) ? - BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); -#endif /* __OpenBSD__ */ /* Don't bother using scatter/gather for just 1 segment */ if (xfer->dm_nsegs == 1) { @@ -1235,16 +1204,10 @@ dpt_scsi_cmd(xs) } /* Sync up CCB and status packet */ -#ifdef __NetBSD__ bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap_ccb, CCB_OFF(sc, ccb), sizeof(struct dpt_ccb), BUS_DMASYNC_PREWRITE); bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap_ccb, sc->sc_spoff, sizeof(struct eata_sp), BUS_DMASYNC_PREREAD); -#endif /* __NetBSD__ */ -#ifdef __OpenBSD__ - bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap_ccb, BUS_DMASYNC_PREWRITE); - bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap_ccb, BUS_DMASYNC_PREREAD); -#endif /* __OpenBSD__ */ /* * Start the command. If we are polling on completion, mark it @@ -1405,19 +1368,12 @@ dpt_hba_inquire(sc, ei) cp->cp_len = sizeof(struct eata_inquiry_data); /* Sync up CCB, status packet and scratch area */ -#ifdef __NetBSD__ bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap_ccb, CCB_OFF(sc, ccb), sizeof(struct dpt_ccb), BUS_DMASYNC_PREWRITE); bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap_ccb, sc->sc_spoff, sizeof(struct eata_sp), BUS_DMASYNC_PREREAD); bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap_ccb, sc->sc_scroff, sizeof(struct eata_inquiry_data), BUS_DMASYNC_PREREAD); -#endif /* __NetBSD__ */ -#ifdef __OpenBSD__ - bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap_ccb, BUS_DMASYNC_PREWRITE); - bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap_ccb, BUS_DMASYNC_PREREAD); - bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap_ccb, BUS_DMASYNC_PREREAD); -#endif /* __OpenBSD__ */ /* Start the command and poll on completion */ if (dpt_cmd(sc, &ccb->ccb_eata_cp, ccb->ccb_ccbpa, CP_DMA_CMD, 0)) @@ -1433,12 +1389,7 @@ dpt_hba_inquire(sc, ei) ccb->ccb_scsi_status); /* Sync up the DMA map and free CCB, returning */ -#ifdef __NetBSD__ bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap_ccb, sc->sc_scroff, sizeof(struct eata_inquiry_data), BUS_DMASYNC_POSTREAD); -#endif /* __NetBSD__ */ -#ifdef __OpenBSD__ - bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap_ccb, BUS_DMASYNC_POSTREAD); -#endif /* __OpenBSD__ */ dpt_free_ccb(sc, ccb); } diff --git a/sys/dev/ic/fxp.c b/sys/dev/ic/fxp.c index 716b1a195d8..e107cb76b81 100644 --- a/sys/dev/ic/fxp.c +++ b/sys/dev/ic/fxp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fxp.c,v 1.28 2001/09/20 17:02:31 mpech Exp $ */ +/* $OpenBSD: fxp.c,v 1.29 2001/11/05 17:25:58 art Exp $ */ /* $NetBSD: if_fxp.c,v 1.2 1997/06/05 02:01:55 thorpej Exp $ */ /* @@ -812,7 +812,7 @@ rcvloop: m = sc->rfa_headm; rfap = m->m_ext.ext_buf + RFA_ALIGNMENT_FUDGE; rxmap = *((bus_dmamap_t *)m->m_ext.ext_buf); - fxp_bus_dmamap_sync(sc->sc_dmat, rxmap, + bus_dmamap_sync(sc->sc_dmat, rxmap, 0, MCLBYTES, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); @@ -1223,8 +1223,9 @@ fxp_init(xsc) sc->sc_cbt_cnt = 1; sc->sc_ctrl->tx_cb[0].cb_command = FXP_CB_COMMAND_NOP | FXP_CB_COMMAND_S | FXP_CB_COMMAND_I; - fxp_bus_dmamap_sync(sc->sc_dmat, sc->tx_cb_map, 0, - sc->tx_cb_map->dm_mapsize, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->sc_dmat, sc->tx_cb_map, 0, + sc->tx_cb_map->dm_mapsize, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); fxp_scb_wait(sc); CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, sc->tx_cb_map->dm_segs->ds_addr + @@ -1383,7 +1384,7 @@ fxp_add_rfabuf(sc, oldm) sc->rfa_tailm = m; - fxp_bus_dmamap_sync(sc->sc_dmat, rxmap, 0, MCLBYTES, + bus_dmamap_sync(sc->sc_dmat, rxmap, 0, MCLBYTES, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); return (m == oldm); diff --git a/sys/dev/ic/fxpvar.h b/sys/dev/ic/fxpvar.h index 99c7f172676..5132ef41d5a 100644 --- a/sys/dev/ic/fxpvar.h +++ b/sys/dev/ic/fxpvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fxpvar.h,v 1.9 2001/09/17 16:24:49 jason Exp $ */ +/* $OpenBSD: fxpvar.h,v 1.10 2001/11/05 17:25:58 art Exp $ */ /* $NetBSD: if_fxpvar.h,v 1.1 1997/06/05 02:01:58 thorpej Exp $ */ /* @@ -129,29 +129,21 @@ extern int fxp_detach __P((struct fxp_softc *)); #define FXP_RXMAP_GET(sc) ((sc)->sc_rxmaps[(sc)->sc_rxfree++]) #define FXP_RXMAP_PUT(sc,map) ((sc)->sc_rxmaps[--(sc)->sc_rxfree] = (map)) -#ifdef __HAS_NEW_BUS_DMAMAP_SYNC -#define fxp_bus_dmamap_sync(t, m, o, l, p) \ - bus_dmamap_sync((t), (m), (o), (l), (p)) -#else -#define fxp_bus_dmamap_sync(t, m, o, l, p) \ - bus_dmamap_sync((t), (m), (p)) -#endif - #define FXP_TXCB_SYNC(sc, txs, p) \ - fxp_bus_dmamap_sync((sc)->sc_dmat, (sc)->tx_cb_map, (txs)->tx_off, \ + bus_dmamap_sync((sc)->sc_dmat, (sc)->tx_cb_map, (txs)->tx_off, \ sizeof(struct fxp_cb_tx), (p)) #define FXP_MCS_SYNC(sc, p) \ - fxp_bus_dmamap_sync((sc)->sc_dmat, (sc)->tx_cb_map, \ + bus_dmamap_sync((sc)->sc_dmat, (sc)->tx_cb_map, \ offsetof(struct fxp_ctrl, u.mcs), sizeof(struct fxp_cb_mcs), (p)) #define FXP_IAS_SYNC(sc, p) \ - fxp_bus_dmamap_sync((sc)->sc_dmat, (sc)->tx_cb_map, \ + bus_dmamap_sync((sc)->sc_dmat, (sc)->tx_cb_map, \ offsetof(struct fxp_ctrl, u.ias), sizeof(struct fxp_cb_ias), (p)) #define FXP_CFG_SYNC(sc, p) \ - fxp_bus_dmamap_sync((sc)->sc_dmat, (sc)->tx_cb_map, \ + bus_dmamap_sync((sc)->sc_dmat, (sc)->tx_cb_map, \ offsetof(struct fxp_ctrl, u.cfg), sizeof(struct fxp_cb_config), (p)) #define FXP_MBUF_SYNC(sc, m, p) \ - fxp_bus_dmamap_sync((sc)->sc_dmat, (m), 0, (m)->dm_mapsize, (p)) + bus_dmamap_sync((sc)->sc_dmat, (m), 0, (m)->dm_mapsize, (p)) diff --git a/sys/dev/ic/gdt_common.c b/sys/dev/ic/gdt_common.c index 7a50216bb66..90e139dac90 100644 --- a/sys/dev/ic/gdt_common.c +++ b/sys/dev/ic/gdt_common.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gdt_common.c,v 1.14 2001/08/12 20:12:12 mickey Exp $ */ +/* $OpenBSD: gdt_common.c,v 1.15 2001/11/05 17:25:58 art Exp $ */ /* * Copyright (c) 1999, 2000 Niklas Hallqvist. All rights reserved. @@ -643,7 +643,8 @@ gdt_scsi_cmd(xs) scsi_done(xs); goto ready; } - bus_dmamap_sync(gdt->sc_dmat, xfer, + bus_dmamap_sync(gdt->sc_dmat, xfer, 0, + xfer->dm_mapsize, (xs->flags & SCSI_DATA_IN) ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); @@ -1062,7 +1063,8 @@ gdt_intr(arg) prev_cmd = ccb->gc_flags & GDT_GCF_CMD_MASK; if (xs && xs->cmd->opcode != PREVENT_ALLOW && xs->cmd->opcode != SYNCHRONIZE_CACHE) { - bus_dmamap_sync(gdt->sc_dmat, ccb->gc_dmamap_xfer, + bus_dmamap_sync(gdt->sc_dmat, ccb->gc_dmamap_xfer, 0, + ccb->gc_dmamap_xfer->dm_mapsize, (xs->flags & SCSI_DATA_IN) ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(gdt->sc_dmat, ccb->gc_dmamap_xfer); diff --git a/sys/dev/ic/iha.c b/sys/dev/ic/iha.c index 41027cb49ed..76a108aa76e 100644 --- a/sys/dev/ic/iha.c +++ b/sys/dev/ic/iha.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iha.c,v 1.10 2001/10/14 02:56:34 krw Exp $ */ +/* $OpenBSD: iha.c,v 1.11 2001/11/05 17:25:58 art Exp $ */ /* * Initio INI-9xxxU/UW SCSI Device Driver * @@ -308,7 +308,7 @@ iha_scsi_cmd(xs) } else pScb->SCB_BufPAddr = dm->dm_segs[0].ds_addr; - iha_bus_dmamap_sync(sc->sc_dmat, pScb->SCB_Dmamap, + bus_dmamap_sync(sc->sc_dmat, pScb->SCB_Dmamap, 0, pScb->SCB_Dmamap->dm_mapsize, (pScb->SCB_Flags & SCSI_DATA_IN) ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); @@ -2473,7 +2473,7 @@ iha_done_scb(sc, pScb) } if (xs->datalen > 0) { - iha_bus_dmamap_sync(sc->sc_dmat, pScb->SCB_Dmamap, + bus_dmamap_sync(sc->sc_dmat, pScb->SCB_Dmamap, 0, pScb->SCB_Dmamap->dm_mapsize, ((xs->flags & SCSI_DATA_IN) ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE)); diff --git a/sys/dev/ic/iha.h b/sys/dev/ic/iha.h index 1f1aa3e7592..abe3eb522ed 100644 --- a/sys/dev/ic/iha.h +++ b/sys/dev/ic/iha.h @@ -1,4 +1,4 @@ -/* $OpenBSD: iha.h,v 1.7 2001/08/26 02:39:05 krw Exp $ */ +/* $OpenBSD: iha.h,v 1.8 2001/11/05 17:25:58 art Exp $ */ /* * Initio INI-9xxxU/UW SCSI Device Driver * @@ -446,14 +446,4 @@ int iha_intr __P((void *)); void iha_minphys __P((struct buf *)); int iha_init_tulip __P((struct iha_softc *)); -#ifdef __HAS_NEW_BUS_DMAMAP_SYNC -#define iha_bus_dmamap_sync(tag, map, off, len, op) \ - bus_dmamap_sync((tag), (map), (off), (len), (op)) -#else -#define iha_bus_dmamap_sync(tag, map, off, len, op) \ - bus_dmamap_sync((tag), (map), (op)) -#endif - - - diff --git a/sys/dev/ic/siop.c b/sys/dev/ic/siop.c index 5393b229d2a..e7c167075fb 100644 --- a/sys/dev/ic/siop.c +++ b/sys/dev/ic/siop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: siop.c,v 1.16 2001/10/30 00:02:55 krw Exp $ */ +/* $OpenBSD: siop.c,v 1.17 2001/11/05 17:25:58 art Exp $ */ /* $NetBSD: siop.c,v 1.39 2001/02/11 18:04:49 bouyer Exp $ */ /* @@ -126,7 +126,7 @@ siop_script_sync(sc, ops) int ops; { if ((sc->features & SF_CHIP_RAM) == 0) - siop_bus_dmamap_sync(sc->sc_dmat, sc->sc_scriptdma, + bus_dmamap_sync(sc->sc_dmat, sc->sc_scriptdma, 0, PAGE_SIZE, ops); } @@ -1049,7 +1049,7 @@ siop_scsicmd_end(siop_cmd) } if (siop_cmd->status != CMDST_SENSE_DONE && xs->flags & (SCSI_DATA_IN | SCSI_DATA_OUT)) { - siop_bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_data, + bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_data, 0, siop_cmd->dmamap_data->dm_mapsize, (xs->flags & SCSI_DATA_IN) ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); @@ -1086,10 +1086,10 @@ siop_scsicmd_end(siop_cmd) bus_dmamap_unload(sc->sc_dmat, siop_cmd->dmamap_cmd); goto out; } - siop_bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_data, + bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_data, 0, siop_cmd->dmamap_data->dm_mapsize, BUS_DMASYNC_PREREAD); - siop_bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_cmd, + bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_cmd, 0, siop_cmd->dmamap_data->dm_mapsize, BUS_DMASYNC_PREWRITE); @@ -1098,7 +1098,7 @@ siop_scsicmd_end(siop_cmd) TAILQ_INSERT_HEAD(&sc->urgent_list, siop_cmd, next); return; } else if (siop_cmd->status == CMDST_SENSE_DONE) { - siop_bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_data, + bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_data, 0, siop_cmd->dmamap_data->dm_mapsize, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc->sc_dmat, siop_cmd->dmamap_data); @@ -1348,12 +1348,12 @@ siop_scsicmd(xs) splx(s); return(TRY_AGAIN_LATER); } - siop_bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_data, + bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_data, 0, siop_cmd->dmamap_data->dm_mapsize, (xs->flags & SCSI_DATA_IN) ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); } - siop_bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_cmd, + bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_cmd, 0, siop_cmd->dmamap_data->dm_mapsize, BUS_DMASYNC_PREWRITE); diff --git a/sys/dev/ic/siopvar_common.h b/sys/dev/ic/siopvar_common.h index a3cb9f9d86a..8d899781ee6 100644 --- a/sys/dev/ic/siopvar_common.h +++ b/sys/dev/ic/siopvar_common.h @@ -1,4 +1,4 @@ -/* $OpenBSD: siopvar_common.h,v 1.8 2001/10/30 00:02:55 krw Exp $ */ +/* $OpenBSD: siopvar_common.h,v 1.9 2001/11/05 17:25:58 art Exp $ */ /* $NetBSD: siopvar_common.h,v 1.10 2001/01/26 21:58:56 bouyer Exp $ */ /* @@ -182,14 +182,6 @@ struct siop_lunsw { u_int32_t lunsw_size; /* size of this lun sw */ }; -#ifdef __HAS_NEW_BUS_DMAMAP_SYNC -#define siop_bus_dmamap_sync(tag, map, off, len, op) \ - bus_dmamap_sync((tag), (map), (off), (len), (op)) -#else -#define siop_bus_dmamap_sync(tag, map, off, len, op) \ - bus_dmamap_sync((tag), (map), (op)) -#endif - static __inline__ void siop_table_sync __P((struct siop_cmd *, int)); static __inline__ void siop_table_sync(siop_cmd, ops) @@ -201,7 +193,7 @@ siop_table_sync(siop_cmd, ops) offset = siop_cmd->dsa - siop_cmd->siop_cbdp->xferdma->dm_segs[0].ds_addr; - siop_bus_dmamap_sync(sc->sc_dmat, siop_cmd->siop_cbdp->xferdma, offset, + bus_dmamap_sync(sc->sc_dmat, siop_cmd->siop_cbdp->xferdma, offset, sizeof(struct siop_xfer), ops); } diff --git a/sys/dev/ic/twe.c b/sys/dev/ic/twe.c index 2c6e5800706..a9db2c78648 100644 --- a/sys/dev/ic/twe.c +++ b/sys/dev/ic/twe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: twe.c,v 1.13 2001/09/24 06:52:33 mickey Exp $ */ +/* $OpenBSD: twe.c,v 1.14 2001/11/05 17:25:58 art Exp $ */ /* * Copyright (c) 2000, 2001 Michael Shalayeff. All rights reserved. @@ -496,9 +496,11 @@ twe_cmd(ccb, flags, wait) } } TWE_DPRINTF(TWE_D_DMA, ("> ")); - bus_dmamap_sync(sc->dmat, dmap, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->dmat, dmap, 0, dmap->dm_mapsize, + BUS_DMASYNC_PREWRITE); } - bus_dmamap_sync(sc->dmat, sc->sc_cmdmap, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->dmat, sc->sc_cmdmap, 0, sc->sc_cmdmap->dm_mapsize, + BUS_DMASYNC_PREWRITE); if ((error = twe_start(ccb, wait))) { bus_dmamap_unload(sc->dmat, dmap); @@ -624,8 +626,8 @@ twe_done(sc, idx) if (xs) { if (xs->cmd->opcode != PREVENT_ALLOW && xs->cmd->opcode != SYNCHRONIZE_CACHE) { - bus_dmamap_sync(sc->dmat, dmap, - (xs->flags & SCSI_DATA_IN) ? + bus_dmamap_sync(sc->dmat, dmap, 0, + dmap->dm_mapsize, (xs->flags & SCSI_DATA_IN) ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(sc->dmat, dmap); } @@ -633,12 +635,14 @@ twe_done(sc, idx) switch (letoh16(cmd->cmd_op)) { case TWE_CMD_GPARAM: case TWE_CMD_READ: - bus_dmamap_sync(sc->dmat, dmap, BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(sc->dmat, dmap, 0, + dmap->dm_mapsize, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc->dmat, dmap); break; case TWE_CMD_SPARAM: case TWE_CMD_WRITE: - bus_dmamap_sync(sc->dmat, dmap, BUS_DMASYNC_POSTWRITE); + bus_dmamap_sync(sc->dmat, dmap, 0, + dmap->dm_mapsize, BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(sc->dmat, dmap); break; default: diff --git a/sys/dev/isa/if_tr_isa.c b/sys/dev/isa/if_tr_isa.c index bfd9bcfe485..48e1452366f 100644 --- a/sys/dev/isa/if_tr_isa.c +++ b/sys/dev/isa/if_tr_isa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tr_isa.c,v 1.1 1999/12/27 21:51:35 fgsch Exp $ */ +/* $OpenBSD: if_tr_isa.c,v 1.2 2001/11/05 17:25:58 art Exp $ */ /* $NetBSD: if_tr_isa.c,v 1.4 1999/04/30 15:29:24 bad Exp $ */ #undef TRISADEBUG @@ -42,6 +42,7 @@ #include <sys/systm.h> #include <sys/socket.h> #include <sys/device.h> +#include <sys/timeout.h> #include <net/if.h> #include <net/if_media.h> diff --git a/sys/dev/isa/if_tribm_isa.c b/sys/dev/isa/if_tribm_isa.c index 69f92b688f9..c07d221a102 100644 --- a/sys/dev/isa/if_tribm_isa.c +++ b/sys/dev/isa/if_tribm_isa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tribm_isa.c,v 1.1 1999/12/27 21:51:35 fgsch Exp $ */ +/* $OpenBSD: if_tribm_isa.c,v 1.2 2001/11/05 17:25:58 art Exp $ */ /* $NetBSD: if_tribm_isa.c,v 1.2 1999/03/22 23:01:37 bad Exp $ */ /* @@ -41,6 +41,7 @@ #include <sys/systm.h> #include <sys/socket.h> #include <sys/device.h> +#include <sys/timeout.h> #include <net/if.h> #include <net/if_media.h> diff --git a/sys/dev/isa/if_trtcm_isa.c b/sys/dev/isa/if_trtcm_isa.c index 3fb6063b675..cef9b1cfa85 100644 --- a/sys/dev/isa/if_trtcm_isa.c +++ b/sys/dev/isa/if_trtcm_isa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_trtcm_isa.c,v 1.1 1999/12/27 21:51:35 fgsch Exp $ */ +/* $OpenBSD: if_trtcm_isa.c,v 1.2 2001/11/05 17:25:58 art Exp $ */ /* $NetBSD: if_trtcm_isa.c,v 1.3 1999/04/30 15:29:24 bad Exp $ */ #undef TRTCMISADEBUG @@ -43,6 +43,7 @@ #include <sys/socket.h> #include <sys/device.h> #include <sys/malloc.h> +#include <sys/timeout.h> #include <net/if.h> #include <net/if_media.h> diff --git a/sys/dev/isa/isadma.c b/sys/dev/isa/isadma.c index 80efb570834..b108e4d52ae 100644 --- a/sys/dev/isa/isadma.c +++ b/sys/dev/isa/isadma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isadma.c,v 1.23 2001/10/31 11:00:24 art Exp $ */ +/* $OpenBSD: isadma.c,v 1.24 2001/11/05 17:25:58 art Exp $ */ /* $NetBSD: isadma.c,v 1.32 1997/09/05 01:48:33 thorpej Exp $ */ /*- @@ -352,10 +352,14 @@ isa_dmastart(isadev, chan, addr, nbytes, p, flags, busdmaflags) #endif if (flags & DMAMODE_READ) { - bus_dmamap_sync(sc->sc_dmat, dmam, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->sc_dmat, dmam, 0, + dmam->dm_mapsize, + BUS_DMASYNC_PREREAD); sc->sc_dmareads |= (1 << chan); } else { - bus_dmamap_sync(sc->sc_dmat, dmam, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->sc_dmat, dmam, 0, + dmam->dm_mapsize, + BUS_DMASYNC_PREWRITE); sc->sc_dmareads &= ~(1 << chan); } @@ -531,7 +535,8 @@ isa_dmadone(isadev, chan) printf("%s: isa_dmadone: channel %d not finished\n", sc->sc_dev.dv_xname, chan); - bus_dmamap_sync(sc->sc_dmat, dmam, + bus_dmamap_sync(sc->sc_dmat, dmam, 0, + dmam->dm_mapsize, (sc->sc_dmareads & (1 << chan)) ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); diff --git a/sys/dev/pci/cac_pci.c b/sys/dev/pci/cac_pci.c index ca88b166a14..f31c79e2a71 100644 --- a/sys/dev/pci/cac_pci.c +++ b/sys/dev/pci/cac_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cac_pci.c,v 1.6 2001/10/11 21:03:35 mickey Exp $ */ +/* $OpenBSD: cac_pci.c,v 1.7 2001/11/05 17:25:58 art Exp $ */ /* $NetBSD: cac_pci.c,v 1.10 2001/01/10 16:48:04 ad Exp $ */ /*- @@ -246,7 +246,8 @@ void cac_pci_l0_submit(struct cac_softc *sc, struct cac_ccb *ccb) { - bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, + bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, 0, + sc->sc_dmamap->dm_mapsize, BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); cac_outl(sc, CAC_42REG_CMD_FIFO, ccb->ccb_paddr); } @@ -264,7 +265,8 @@ cac_pci_l0_completed(struct cac_softc *sc) off = (off & ~3) - sc->sc_ccbs_paddr; ccb = (struct cac_ccb *)(sc->sc_ccbs + off); - bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, + bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, 0, + sc->sc_dmamap->dm_mapsize, BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); return (ccb); diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c index 7b34a367722..fb19508249f 100644 --- a/sys/dev/pci/hifn7751.c +++ b/sys/dev/pci/hifn7751.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hifn7751.c,v 1.104 2001/11/04 18:31:42 jason Exp $ */ +/* $OpenBSD: hifn7751.c,v 1.105 2001/11/05 17:25:58 art Exp $ */ /* * Invertex AEON / Hifn 7751 driver @@ -106,14 +106,6 @@ void hifn_abort __P((struct hifn_softc *)); struct hifn_stats hifnstats; -#ifdef __HAS_NEW_BUS_DMAMAP_SYNC -#define hifn_bus_dmamap_sync(t, m, o, l, f) \ - bus_dmamap_sync((t), (m), (o), (l), (f)) -#else -#define hifn_bus_dmamap_sync(t, m, o, l, f) \ - bus_dmamap_sync((t), (m), (f)) -#endif - int hifn_probe(parent, match, aux) struct device *parent; @@ -318,7 +310,7 @@ hifn_attach(parent, self, aux) NULL, NULL, NULL); } - hifn_bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, 0, + bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, 0, sc->sc_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); @@ -874,13 +866,13 @@ hifn_writeramaddr(sc, addr, data, slot) dma->dstr[slot].l = 4 | masks; dma->resr[slot].l = 4 | masks; - hifn_bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, + bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, 0, sc->sc_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); DELAY(3000); /* let write command execute */ - hifn_bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, + bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, 0, sc->sc_dmamap->dm_mapsize, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); @@ -934,13 +926,13 @@ hifn_readramaddr(sc, addr, data, slot) dma->dstr[slot].l = 8 | masks; dma->resr[slot].l = HIFN_MAX_RESULT | masks; - hifn_bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, + bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, 0, sc->sc_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); DELAY(3000); /* let read command execute */ - hifn_bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, + bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, 0, sc->sc_dmamap->dm_mapsize, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); @@ -1350,13 +1342,13 @@ hifn_crypto(sc, cmd, crp) #endif if (cmd->src_map == cmd->dst_map) - hifn_bus_dmamap_sync(sc->sc_dmat, cmd->src_map, + bus_dmamap_sync(sc->sc_dmat, cmd->src_map, 0, cmd->src_map->dm_mapsize, BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD); else { - hifn_bus_dmamap_sync(sc->sc_dmat, cmd->src_map, + bus_dmamap_sync(sc->sc_dmat, cmd->src_map, 0, cmd->src_map->dm_mapsize, BUS_DMASYNC_PREWRITE); - hifn_bus_dmamap_sync(sc->sc_dmat, cmd->dst_map, + bus_dmamap_sync(sc->sc_dmat, cmd->dst_map, 0, cmd->dst_map->dm_mapsize, BUS_DMASYNC_PREREAD); } @@ -1994,14 +1986,14 @@ hifn_abort(sc) hifn_callback(sc, cmd, macbuf); } else { if (cmd->src_map == cmd->dst_map) - hifn_bus_dmamap_sync(sc->sc_dmat, cmd->src_map, + bus_dmamap_sync(sc->sc_dmat, cmd->src_map, 0, cmd->src_map->dm_mapsize, BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); else { - hifn_bus_dmamap_sync(sc->sc_dmat, cmd->src_map, + bus_dmamap_sync(sc->sc_dmat, cmd->src_map, 0, cmd->src_map->dm_mapsize, BUS_DMASYNC_POSTWRITE); - hifn_bus_dmamap_sync(sc->sc_dmat, cmd->dst_map, + bus_dmamap_sync(sc->sc_dmat, cmd->dst_map, 0, cmd->dst_map->dm_mapsize, BUS_DMASYNC_POSTREAD); } @@ -2060,13 +2052,13 @@ hifn_callback(sc, cmd, macbuf) int totlen, i, u; if (cmd->src_map == cmd->dst_map) - hifn_bus_dmamap_sync(sc->sc_dmat, cmd->src_map, + bus_dmamap_sync(sc->sc_dmat, cmd->src_map, 0, cmd->src_map->dm_mapsize, BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD); else { - hifn_bus_dmamap_sync(sc->sc_dmat, cmd->src_map, + bus_dmamap_sync(sc->sc_dmat, cmd->src_map, 0, cmd->src_map->dm_mapsize, BUS_DMASYNC_POSTWRITE); - hifn_bus_dmamap_sync(sc->sc_dmat, cmd->dst_map, + bus_dmamap_sync(sc->sc_dmat, cmd->dst_map, 0, cmd->dst_map->dm_mapsize, BUS_DMASYNC_POSTREAD); } @@ -2100,11 +2092,11 @@ hifn_callback(sc, cmd, macbuf) i = dma->dstk; u = dma->dstu; while (u != 0) { - hifn_bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, + bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, offsetof(struct hifn_dma, dstr[i]), sizeof(struct hifn_desc), BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); if (dma->dstr[i].l & HIFN_D_VALID) { - hifn_bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, + bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, offsetof(struct hifn_dma, dstr[i]), sizeof(struct hifn_desc), BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); diff --git a/sys/dev/pci/hifn7751var.h b/sys/dev/pci/hifn7751var.h index 5daeae657f0..9445c3a4294 100644 --- a/sys/dev/pci/hifn7751var.h +++ b/sys/dev/pci/hifn7751var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hifn7751var.h,v 1.38 2001/11/04 18:31:42 jason Exp $ */ +/* $OpenBSD: hifn7751var.h,v 1.39 2001/11/05 17:25:58 art Exp $ */ /* * Invertex AEON / Hifn 7751 driver @@ -104,7 +104,7 @@ struct hifn_session { }; #define HIFN_RING_SYNC(sc, r, i, f) \ - hifn_bus_dmamap_sync((sc)->sc_dmat, (sc)->sc_dmamap, \ + bus_dmamap_sync((sc)->sc_dmat, (sc)->sc_dmamap, \ offsetof(struct hifn_dma, r[i]), sizeof(struct hifn_desc), (f)) #define HIFN_CMDR_SYNC(sc, i, f) HIFN_RING_SYNC((sc), cmdr, (i), (f)) @@ -113,12 +113,12 @@ struct hifn_session { #define HIFN_DSTR_SYNC(sc, i, f) HIFN_RING_SYNC((sc), dstr, (i), (f)) #define HIFN_CMD_SYNC(sc, i, f) \ - hifn_bus_dmamap_sync((sc)->sc_dmat, (sc)->sc_dmamap, \ + bus_dmamap_sync((sc)->sc_dmat, (sc)->sc_dmamap, \ offsetof(struct hifn_dma, command_bufs[(i)][0]), \ HIFN_MAX_COMMAND, (f)) #define HIFN_RES_SYNC(sc, i, f) \ - hifn_bus_dmamap_sync((sc)->sc_dmat, (sc)->sc_dmamap, \ + bus_dmamap_sync((sc)->sc_dmat, (sc)->sc_dmamap, \ offsetof(struct hifn_dma, result_bufs[(i)][0]), \ HIFN_MAX_RESULT, (f)) diff --git a/sys/dev/pci/if_txp.c b/sys/dev/pci/if_txp.c index 2378defb05a..8a3381fd9c0 100644 --- a/sys/dev/pci/if_txp.c +++ b/sys/dev/pci/if_txp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_txp.c,v 1.57 2001/11/02 19:31:00 jason Exp $ */ +/* $OpenBSD: if_txp.c,v 1.58 2001/11/05 17:25:58 art Exp $ */ /* * Copyright (c) 2001 @@ -512,7 +512,7 @@ txp_download_fw_section(sc, sect, sectnum) goto bail; } - txp_bus_dmamap_sync(sc->sc_dmat, dma.dma_map, 0, + bus_dmamap_sync(sc->sc_dmat, dma.dma_map, 0, dma.dma_map->dm_mapsize, BUS_DMASYNC_PREWRITE); WRITE_REG(sc, TXP_H2A_1, sect->nbytes); @@ -528,7 +528,7 @@ txp_download_fw_section(sc, sect, sectnum) err = -1; } - txp_bus_dmamap_sync(sc->sc_dmat, dma.dma_map, 0, + bus_dmamap_sync(sc->sc_dmat, dma.dma_map, 0, dma.dma_map->dm_mapsize, BUS_DMASYNC_POSTWRITE); bail: @@ -553,7 +553,7 @@ txp_intr(vsc) TXP_INT_DMA3 | TXP_INT_DMA2 | TXP_INT_DMA1 | TXP_INT_DMA0 | TXP_INT_PCI_TABORT | TXP_INT_PCI_MABORT | TXP_INT_LATCH); - txp_bus_dmamap_sync(sc->sc_dmat, sc->sc_host_dma.dma_map, 0, + bus_dmamap_sync(sc->sc_dmat, sc->sc_host_dma.dma_map, 0, sizeof(struct txp_hostvar), BUS_DMASYNC_POSTWRITE|BUS_DMASYNC_POSTREAD); isr = READ_REG(sc, TXP_ISR); @@ -580,7 +580,7 @@ txp_intr(vsc) isr = READ_REG(sc, TXP_ISR); } - txp_bus_dmamap_sync(sc->sc_dmat, sc->sc_host_dma.dma_map, 0, + bus_dmamap_sync(sc->sc_dmat, sc->sc_host_dma.dma_map, 0, sizeof(struct txp_hostvar), BUS_DMASYNC_POSTWRITE|BUS_DMASYNC_POSTREAD); /* unmask all interrupts */ @@ -611,7 +611,7 @@ txp_rx_reclaim(sc, r, dma) while (roff != woff) { - txp_bus_dmamap_sync(sc->sc_dmat, dma->dma_map, + bus_dmamap_sync(sc->sc_dmat, dma->dma_map, idx * sizeof(struct txp_rx_desc), sizeof(struct txp_rx_desc), BUS_DMASYNC_POSTREAD); @@ -625,7 +625,7 @@ txp_rx_reclaim(sc, r, dma) /* retrieve stashed pointer */ bcopy((u_long *)&rxd->rx_vaddrlo, &sd, sizeof(sd)); - txp_bus_dmamap_sync(sc->sc_dmat, sd->sd_map, 0, + bus_dmamap_sync(sc->sc_dmat, sd->sd_map, 0, sd->sd_map->dm_mapsize, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc->sc_dmat, sd->sd_map); bus_dmamap_destroy(sc->sc_dmat, sd->sd_map); @@ -701,7 +701,7 @@ txp_rx_reclaim(sc, r, dma) ether_input_mbuf(ifp, m); next: - txp_bus_dmamap_sync(sc->sc_dmat, dma->dma_map, + bus_dmamap_sync(sc->sc_dmat, dma->dma_map, idx * sizeof(struct txp_rx_desc), sizeof(struct txp_rx_desc), BUS_DMASYNC_PREREAD); @@ -762,7 +762,7 @@ txp_rxbuf_reclaim(sc) goto err_mbuf; } - txp_bus_dmamap_sync(sc->sc_dmat, sc->sc_rxbufring_dma.dma_map, + bus_dmamap_sync(sc->sc_dmat, sc->sc_rxbufring_dma.dma_map, i * sizeof(struct txp_rxbuf_desc), sizeof(struct txp_rxbuf_desc), BUS_DMASYNC_POSTWRITE); @@ -774,10 +774,10 @@ txp_rxbuf_reclaim(sc) rbd->rb_paddrhi = ((u_int64_t)sd->sd_map->dm_segs[0].ds_addr) >> 32; - txp_bus_dmamap_sync(sc->sc_dmat, sd->sd_map, 0, + bus_dmamap_sync(sc->sc_dmat, sd->sd_map, 0, sd->sd_map->dm_mapsize, BUS_DMASYNC_PREREAD); - txp_bus_dmamap_sync(sc->sc_dmat, sc->sc_rxbufring_dma.dma_map, + bus_dmamap_sync(sc->sc_dmat, sc->sc_rxbufring_dma.dma_map, i * sizeof(struct txp_rxbuf_desc), sizeof(struct txp_rxbuf_desc), BUS_DMASYNC_PREWRITE); @@ -817,14 +817,14 @@ txp_tx_reclaim(sc, r, dma) if (cnt == 0) break; - txp_bus_dmamap_sync(sc->sc_dmat, dma->dma_map, + bus_dmamap_sync(sc->sc_dmat, dma->dma_map, cons * sizeof(struct txp_tx_desc), sizeof(struct txp_tx_desc), BUS_DMASYNC_POSTWRITE); if ((txd->tx_flags & TX_FLAGS_TYPE_M) == TX_FLAGS_TYPE_DATA) { - txp_bus_dmamap_sync(sc->sc_dmat, sd->sd_map, 0, + bus_dmamap_sync(sc->sc_dmat, sd->sd_map, 0, sd->sd_map->dm_mapsize, BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(sc->sc_dmat, sd->sd_map); m = sd->sd_mbuf; @@ -959,7 +959,7 @@ txp_alloc_rings(sc) (struct txp_rx_desc *)sc->sc_rxhiring_dma.dma_vaddr; sc->sc_rxhir.r_roff = &sc->sc_hostvar->hv_rx_hi_read_idx; sc->sc_rxhir.r_woff = &sc->sc_hostvar->hv_rx_hi_write_idx; - txp_bus_dmamap_sync(sc->sc_dmat, sc->sc_rxhiring_dma.dma_map, + bus_dmamap_sync(sc->sc_dmat, sc->sc_rxhiring_dma.dma_map, 0, sc->sc_rxhiring_dma.dma_map->dm_mapsize, BUS_DMASYNC_PREREAD); /* low priority ring */ @@ -976,7 +976,7 @@ txp_alloc_rings(sc) (struct txp_rx_desc *)sc->sc_rxloring_dma.dma_vaddr; sc->sc_rxlor.r_roff = &sc->sc_hostvar->hv_rx_lo_read_idx; sc->sc_rxlor.r_woff = &sc->sc_hostvar->hv_rx_lo_write_idx; - txp_bus_dmamap_sync(sc->sc_dmat, sc->sc_rxloring_dma.dma_map, + bus_dmamap_sync(sc->sc_dmat, sc->sc_rxloring_dma.dma_map, 0, sc->sc_rxloring_dma.dma_map->dm_mapsize, BUS_DMASYNC_PREREAD); /* command ring */ @@ -1044,7 +1044,7 @@ txp_alloc_rings(sc) bus_dmamap_destroy(sc->sc_dmat, sd->sd_map); goto bail_rxbufring; } - txp_bus_dmamap_sync(sc->sc_dmat, sd->sd_map, 0, + bus_dmamap_sync(sc->sc_dmat, sd->sd_map, 0, sd->sd_map->dm_mapsize, BUS_DMASYNC_PREREAD); /* stash away pointer */ @@ -1055,7 +1055,7 @@ txp_alloc_rings(sc) sc->sc_rxbufs[i].rb_paddrhi = ((u_int64_t)sd->sd_map->dm_segs[0].ds_addr) >> 32; } - txp_bus_dmamap_sync(sc->sc_dmat, sc->sc_rxbufring_dma.dma_map, + bus_dmamap_sync(sc->sc_dmat, sc->sc_rxbufring_dma.dma_map, 0, sc->sc_rxbufring_dma.dma_map->dm_mapsize, BUS_DMASYNC_PREWRITE); sc->sc_hostvar->hv_rx_buf_write_idx = (RXBUF_ENTRIES - 1) * @@ -1414,13 +1414,13 @@ txp_start(ifp) txd->tx_pflags |= TX_PFLAGS_UDPCKSUM; #endif - txp_bus_dmamap_sync(sc->sc_dmat, sd->sd_map, 0, + bus_dmamap_sync(sc->sc_dmat, sd->sd_map, 0, sd->sd_map->dm_mapsize, BUS_DMASYNC_PREWRITE); fxd = (struct txp_frag_desc *)(r->r_desc + prod); for (i = 0; i < sd->sd_map->dm_nsegs; i++) { if (++cnt >= (TX_ENTRIES - 4)) { - txp_bus_dmamap_sync(sc->sc_dmat, sd->sd_map, + bus_dmamap_sync(sc->sc_dmat, sd->sd_map, 0, sd->sd_map->dm_mapsize, BUS_DMASYNC_POSTWRITE); goto oactive; @@ -1438,7 +1438,7 @@ txp_start(ifp) 32; fxd->frag_rsvd2 = 0; - txp_bus_dmamap_sync(sc->sc_dmat, + bus_dmamap_sync(sc->sc_dmat, sc->sc_txhiring_dma.dma_map, prod * sizeof(struct txp_frag_desc), sizeof(struct txp_frag_desc), BUS_DMASYNC_PREWRITE); @@ -1459,7 +1459,7 @@ txp_start(ifp) #endif txd->tx_flags |= TX_FLAGS_VALID; - txp_bus_dmamap_sync(sc->sc_dmat, sc->sc_txhiring_dma.dma_map, + bus_dmamap_sync(sc->sc_dmat, sc->sc_txhiring_dma.dma_map, txdidx * sizeof(struct txp_tx_desc), sizeof(struct txp_tx_desc), BUS_DMASYNC_PREWRITE); @@ -1575,14 +1575,14 @@ txp_command2(sc, id, in1, in2, in3, in_extp, in_extn, rspp, wait) sc->sc_cmdring.lastwrite = idx; WRITE_REG(sc, TXP_H2A_2, sc->sc_cmdring.lastwrite); - txp_bus_dmamap_sync(sc->sc_dmat, sc->sc_host_dma.dma_map, 0, + bus_dmamap_sync(sc->sc_dmat, sc->sc_host_dma.dma_map, 0, sizeof(struct txp_hostvar), BUS_DMASYNC_PREREAD); if (!wait) return (0); for (i = 0; i < 10000; i++) { - txp_bus_dmamap_sync(sc->sc_dmat, sc->sc_host_dma.dma_map, 0, + bus_dmamap_sync(sc->sc_dmat, sc->sc_host_dma.dma_map, 0, sizeof(struct txp_hostvar), BUS_DMASYNC_POSTREAD); idx = hv->hv_resp_read_idx; if (idx != hv->hv_resp_write_idx) { @@ -1592,7 +1592,7 @@ txp_command2(sc, id, in1, in2, in3, in_extp, in_extn, rspp, wait) if (*rspp != NULL) break; } - txp_bus_dmamap_sync(sc->sc_dmat, sc->sc_host_dma.dma_map, 0, + bus_dmamap_sync(sc->sc_dmat, sc->sc_host_dma.dma_map, 0, sizeof(struct txp_hostvar), BUS_DMASYNC_PREREAD); DELAY(50); } diff --git a/sys/dev/pci/if_txpreg.h b/sys/dev/pci/if_txpreg.h index 9aae779d378..701b138af7e 100644 --- a/sys/dev/pci/if_txpreg.h +++ b/sys/dev/pci/if_txpreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_txpreg.h,v 1.33 2001/11/02 19:31:00 jason Exp $ */ +/* $OpenBSD: if_txpreg.h,v 1.34 2001/11/05 17:25:58 art Exp $ */ /* * Copyright (c) 2001 Aaron Campbell <aaron@monkey.org>. @@ -621,10 +621,3 @@ struct txp_fw_section_header { #define READ_REG(sc,reg) \ bus_space_read_4((sc)->sc_bt, (sc)->sc_bh, reg) -#ifdef __HAS_NEW_BUS_DMAMAP_SYNC -#define txp_bus_dmamap_sync(tag, map, off, len, op) \ - bus_dmamap_sync((tag), (map), (off), (len), (op)) -#else -#define txp_bus_dmamap_sync(tag, map, off, len, op) \ - bus_dmamap_sync((tag), (map), (op)) -#endif diff --git a/sys/dev/pci/ises.c b/sys/dev/pci/ises.c index d64d54ecda9..6d3a2dc5b52 100644 --- a/sys/dev/pci/ises.c +++ b/sys/dev/pci/ises.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ises.c,v 1.16 2001/09/21 19:41:13 ho Exp $ */ +/* $OpenBSD: ises.c,v 1.17 2001/11/05 17:25:58 art Exp $ */ /* * Copyright (c) 2000, 2001 Håkan Olsson (ho@crt.se) @@ -751,8 +751,8 @@ ises_intr(void *arg) (dma_status & ISES_DMA_STATUS_R_RUN) == 0) { DPRINTF(("%s: DMA read complete\n", dv)); - bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, - BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, 0, + sc->sc_dmamap->dm_mapsize, BUS_DMASYNC_POSTREAD); /* XXX Pick up and return the data.*/ @@ -762,8 +762,8 @@ ises_intr(void *arg) (dma_status & ISES_DMA_STATUS_W_RUN) == 0) { DPRINTF(("%s: DMA write complete\n", dv)); - bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, - BUS_DMASYNC_POSTWRITE); + bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, 0, + sc->sc_dmamap->dm_mapsize, BUS_DMASYNC_POSTWRITE); WRITE_REG(sc, ISES_DMA_RESET, 0); ises_feed(sc); @@ -902,7 +902,8 @@ ises_feed(struct ises_softc *sc) /* ... else */ /* Start writing data to the ises. */ - bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, 0, + sc->sc_dmamap->dm_mapsize, BUS_DMASYNC_PREWRITE); DPRINTF(("%s:ises_feed: writing DMA\n", dv)); DELAY(1000000); @@ -1763,7 +1764,8 @@ ises_read_dma (struct ises_softc *sc) bus_dma_segment_t *ds = &sc->sc_dmamap->dm_segs[0]; u_int32_t dma_status; - bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, 0, + sc->sc_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD); WRITE_REG(sc, ISES_DMA_READ_START, ds->ds_addr); WRITE_REG(sc, ISES_DMA_READ_START, ISES_DMA_RCOUNT(ds->ds_len)); diff --git a/sys/dev/pci/isp_pci.c b/sys/dev/pci/isp_pci.c index a28dae32fb1..063c5033aec 100644 --- a/sys/dev/pci/isp_pci.c +++ b/sys/dev/pci/isp_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isp_pci.c,v 1.25 2001/10/06 22:45:52 mjacob Exp $ */ +/* $OpenBSD: isp_pci.c,v 1.26 2001/11/05 17:25:58 art Exp $ */ /* * PCI specific probe and attach routines for Qlogic ISP SCSI adapters. * @@ -290,14 +290,6 @@ static struct ispmdvec mdvec_2300 = { #define BUS_DMA_COHERENT BUS_DMAMEM_NOSYNC #endif -#ifdef __HAS_NEW_BUS_DMAMAP_SYNC -#define isp_bus_dmamap_sync(t, m, o, l, f) \ - bus_dmamap_sync((t), (m), (o), (l), (f)) -#else -#define isp_bus_dmamap_sync(t, m, o, l, f) \ - bus_dmamap_sync((t), (m), (f)) -#endif - static int isp_pci_probe (struct device *, void *, void *); static void isp_pci_attach (struct device *, struct device *, void *); @@ -1067,13 +1059,13 @@ isp_pci_dmasetup(struct ispsoftc *isp, XS_T *xs, ispreq_t *rq, u_int16_t *iptrp, } while (seg < segcnt); dmasync: - isp_bus_dmamap_sync(pci->pci_dmat, dmap, 0, dmap->dm_mapsize, + bus_dmamap_sync(pci->pci_dmat, dmap, 0, dmap->dm_mapsize, (xs->flags & SCSI_DATA_IN) ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); mbxsync: ISP_SWIZZLE_REQUEST(isp, rq); - isp_bus_dmamap_sync(pci->pci_dmat, pci->pci_rquest_dmap, 0, + bus_dmamap_sync(pci->pci_dmat, pci->pci_rquest_dmap, 0, pci->pci_rquest_dmap->dm_mapsize, BUS_DMASYNC_PREWRITE); return (CMD_QUEUED); } @@ -1090,7 +1082,7 @@ isp_pci_intr(void *arg) isp->isp_intbogus++; return (0); } else { - isp_bus_dmamap_sync(p->pci_dmat, p->pci_result_dmap, 0, + bus_dmamap_sync(p->pci_dmat, p->pci_result_dmap, 0, p->pci_result_dmap->dm_mapsize, BUS_DMASYNC_POSTREAD); isp->isp_osinfo.onintstack = 1; isp_intr(isp, isr, sema, mbox); @@ -1104,7 +1096,7 @@ isp_pci_dmateardown(struct ispsoftc *isp, XS_T *xs, u_int16_t handle) { struct isp_pcisoftc *pci = (struct isp_pcisoftc *)isp; bus_dmamap_t dmap = pci->pci_xfer_dmap[isp_handle_index(handle)]; - isp_bus_dmamap_sync(pci->pci_dmat, dmap, 0, dmap->dm_mapsize, + bus_dmamap_sync(pci->pci_dmat, dmap, 0, dmap->dm_mapsize, xs->flags & SCSI_DATA_IN ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(pci->pci_dmat, dmap); diff --git a/sys/dev/pci/pciide.c b/sys/dev/pci/pciide.c index 7c8e1a776d3..095dde889c8 100644 --- a/sys/dev/pci/pciide.c +++ b/sys/dev/pci/pciide.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pciide.c,v 1.71 2001/09/29 04:46:49 jason Exp $ */ +/* $OpenBSD: pciide.c,v 1.72 2001/11/05 17:25:58 art Exp $ */ /* $NetBSD: pciide.c,v 1.127 2001/08/03 01:31:08 tsutsui Exp $ */ /* @@ -1032,16 +1032,10 @@ pciide_dma_init(v, channel, drive, databuf, datalen, flags) return error; } -#ifdef __HAVE_NEW_BUS_DMAMAP_SYNC bus_dmamap_sync(sc->sc_dmat, dma_maps->dmamap_xfer, 0, dma_maps->dmamap_xfer->dm_mapsize, (flags & WDC_DMA_READ) ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); -#else - bus_dmamap_sync(sc->sc_dmat, dma_maps->dmamap_xfer, - (flags & WDC_DMA_READ) ? - BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); -#endif for (seg = 0; seg < dma_maps->dmamap_xfer->dm_nsegs; seg++) { #ifdef DIAGNOSTIC @@ -1071,14 +1065,9 @@ pciide_dma_init(v, channel, drive, databuf, datalen, flags) dma_maps->dma_table[dma_maps->dmamap_xfer->dm_nsegs -1].byte_count |= htole32(IDEDMA_BYTE_COUNT_EOT); -#ifdef __HAVE_NEW_BUS_DMAMAP_SYNC bus_dmamap_sync(sc->sc_dmat, dma_maps->dmamap_table, 0, dma_maps->dmamap_table->dm_mapsize, BUS_DMASYNC_PREWRITE); -#else - bus_dmamap_sync(sc->sc_dmat, dma_maps->dmamap_table, - BUS_DMASYNC_PREWRITE); -#endif /* Maps are ready. Start DMA function */ #ifdef DIAGNOSTIC @@ -1148,16 +1137,10 @@ pciide_dma_finish(v, channel, drive) 0x00 : IDEDMA_CMD_WRITE); /* Unload the map of the data buffer */ -#ifdef __HAVE_NEW_BUS_DMAMAP_SYNC bus_dmamap_sync(sc->sc_dmat, dma_maps->dmamap_xfer, 0, dma_maps->dmamap_xfer->dm_mapsize, (dma_maps->dma_flags & WDC_DMA_READ) ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); -#else - bus_dmamap_sync(sc->sc_dmat, dma_maps->dmamap_xfer, - (dma_maps->dma_flags & WDC_DMA_READ) ? - BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); -#endif bus_dmamap_unload(sc->sc_dmat, dma_maps->dmamap_xfer); /* Clear status bits */ diff --git a/sys/dev/pci/pcscp.c b/sys/dev/pci/pcscp.c index 1f1763d09e4..493fbfe09b7 100644 --- a/sys/dev/pci/pcscp.c +++ b/sys/dev/pci/pcscp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcscp.c,v 1.7 2001/09/27 04:01:42 jason Exp $ */ +/* $OpenBSD: pcscp.c,v 1.8 2001/11/05 17:25:58 art Exp $ */ /* $NetBSD: pcscp.c,v 1.11 2000/11/14 18:42:58 thorpej Exp $ */ /*- @@ -149,14 +149,6 @@ struct ncr53c9x_glue pcscp_glue = { NULL, /* gl_clear_latched_intr */ }; -#ifdef __HAS_NEW_BUS_DMAMAP_SYNC -#define pcscp_bus_dmamap_sync(t, m, o, l, f) \ - bus_dmamap_sync((t), (m), (o), (l), (f)) -#else -#define pcscp_bus_dmamap_sync(t, m, o, l, f) \ - bus_dmamap_sync((t), (m), (f)) -#endif - int pcscp_match(parent, match, aux) struct device *parent; @@ -494,7 +486,7 @@ pcscp_dma_intr(sc) WRITE_DMAREG(esc, DMA_CMD, DMACMD_IDLE | (datain ? DMACMD_DIR : 0)); - pcscp_bus_dmamap_sync(esc->sc_dmat, dmap, 0, dmap->dm_mapsize, + bus_dmamap_sync(esc->sc_dmat, dmap, 0, dmap->dm_mapsize, datain ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(esc->sc_dmat, dmap); @@ -643,11 +635,11 @@ pcscp_dma_go(sc) return; /* sync transfer buffer */ - pcscp_bus_dmamap_sync(esc->sc_dmat, dmap, 0, dmap->dm_mapsize, + bus_dmamap_sync(esc->sc_dmat, dmap, 0, dmap->dm_mapsize, datain ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); /* sync MDL */ - pcscp_bus_dmamap_sync(esc->sc_dmat, mdldmap, 0, mdldmap->dm_mapsize, + bus_dmamap_sync(esc->sc_dmat, mdldmap, 0, mdldmap->dm_mapsize, BUS_DMASYNC_PREWRITE); /* set Starting MDL Address */ diff --git a/sys/dev/pci/ubsec.c b/sys/dev/pci/ubsec.c index 137088f98ae..c2a0be5d7fc 100644 --- a/sys/dev/pci/ubsec.c +++ b/sys/dev/pci/ubsec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ubsec.c,v 1.70 2001/08/27 22:02:37 jason Exp $ */ +/* $OpenBSD: ubsec.c,v 1.71 2001/11/05 17:25:58 art Exp $ */ /* * Copyright (c) 2000 Jason L. Wright (jason@thought.net) @@ -100,14 +100,6 @@ void ubsec_dma_free __P((struct ubsec_softc *, struct ubsec_dma_alloc *)); #define SWAP32(x) (x) = swap32((x)) -#ifdef __HAS_NEW_BUS_DMAMAP_SYNC -#define ubsec_bus_dmamap_sync(t, m, o, l, f) \ - bus_dmamap_sync((t), (m), (o), (l), (f)) -#else -#define ubsec_bus_dmamap_sync(t, m, o, l, f) \ - bus_dmamap_sync((t), (m), (f)) -#endif - int ubsec_probe(parent, match, aux) struct device *parent; @@ -303,13 +295,13 @@ ubsec_intr(arg) while (!SIMPLEQ_EMPTY(&sc->sc_qchip2)) { q2 = SIMPLEQ_FIRST(&sc->sc_qchip2); - ubsec_bus_dmamap_sync(sc->sc_dmat, q2->q_mcr.dma_map, + bus_dmamap_sync(sc->sc_dmat, q2->q_mcr.dma_map, 0, q2->q_mcr.dma_map->dm_mapsize, BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); mcr = (struct ubsec_mcr *)q2->q_mcr.dma_vaddr; if ((mcr->mcr_flags & UBS_MCR_DONE) == 0) { - ubsec_bus_dmamap_sync(sc->sc_dmat, + bus_dmamap_sync(sc->sc_dmat, q2->q_mcr.dma_map, 0, q2->q_mcr.dma_map->dm_mapsize, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); @@ -1046,7 +1038,7 @@ ubsec_process(crp) bcopy(&ctx, dmap->d_alloc.dma_vaddr + offsetof(struct ubsec_dmachunk, d_ctx), sizeof(struct ubsec_pktctx)); - ubsec_bus_dmamap_sync(sc->sc_dmat, dmap->d_alloc.dma_map, 0, + bus_dmamap_sync(sc->sc_dmat, dmap->d_alloc.dma_map, 0, dmap->d_alloc.dma_map->dm_mapsize, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); @@ -1084,7 +1076,7 @@ ubsec_callback(sc, q) struct cryptodesc *crd; struct ubsec_dma *dmap = q->q_dma; - ubsec_bus_dmamap_sync(sc->sc_dmat, dmap->d_alloc.dma_map, 0, + bus_dmamap_sync(sc->sc_dmat, dmap->d_alloc.dma_map, 0, dmap->d_alloc.dma_map->dm_mapsize, BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); @@ -1189,10 +1181,10 @@ ubsec_feed2(sc) break; q = SIMPLEQ_FIRST(&sc->sc_queue2); - ubsec_bus_dmamap_sync(sc->sc_dmat, q->q_mcr.dma_map, 0, + bus_dmamap_sync(sc->sc_dmat, q->q_mcr.dma_map, 0, q->q_mcr.dma_map->dm_mapsize, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - ubsec_bus_dmamap_sync(sc->sc_dmat, q->q_ctx.dma_map, 0, + bus_dmamap_sync(sc->sc_dmat, q->q_ctx.dma_map, 0, q->q_ctx.dma_map->dm_mapsize, BUS_DMASYNC_PREWRITE); @@ -1212,7 +1204,7 @@ ubsec_callback2(sc, q) struct ubsec_ctx_keyop *ctx; ctx = (struct ubsec_ctx_keyop *)q->q_ctx.dma_vaddr; - ubsec_bus_dmamap_sync(sc->sc_dmat, q->q_ctx.dma_map, 0, + bus_dmamap_sync(sc->sc_dmat, q->q_ctx.dma_map, 0, q->q_ctx.dma_map->dm_mapsize, BUS_DMASYNC_POSTWRITE); switch (ctx->ctx_op) { @@ -1221,7 +1213,7 @@ ubsec_callback2(sc, q) u_int32_t *p; int i; - ubsec_bus_dmamap_sync(sc->sc_dmat, rng->rng_buf.dma_map, 0, + bus_dmamap_sync(sc->sc_dmat, rng->rng_buf.dma_map, 0, rng->rng_buf.dma_map->dm_mapsize, BUS_DMASYNC_POSTREAD); p = (u_int32_t *)rng->rng_buf.dma_vaddr; for (i = 0; i < UBSEC_RNG_BUFSIZ; p++, i++) @@ -1290,7 +1282,7 @@ ubsec_rng(vsc) ctx->rbp_len = sizeof(struct ubsec_ctx_rngbypass); ctx->rbp_op = UBS_CTXOP_RNGBYPASS; - ubsec_bus_dmamap_sync(sc->sc_dmat, rng->rng_buf.dma_map, 0, + bus_dmamap_sync(sc->sc_dmat, rng->rng_buf.dma_map, 0, rng->rng_buf.dma_map->dm_mapsize, BUS_DMASYNC_PREREAD); SIMPLEQ_INSERT_TAIL(&sc->sc_queue2, (struct ubsec_q2 *)rng, q_next); diff --git a/sys/dev/pci/yds.c b/sys/dev/pci/yds.c index 7b0663d125d..5c29a73f8f6 100644 --- a/sys/dev/pci/yds.c +++ b/sys/dev/pci/yds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: yds.c,v 1.7 2001/10/31 11:00:24 art Exp $ */ +/* $OpenBSD: yds.c,v 1.8 2001/11/05 17:25:58 art Exp $ */ /* $NetBSD: yds.c,v 1.5 2001/05/21 23:55:04 minoura Exp $ */ /* @@ -42,6 +42,7 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> +#include <sys/fcntl.h> #include <sys/malloc.h> #include <sys/device.h> #include <sys/proc.h> @@ -90,18 +91,11 @@ int yds_match __P((struct device *, void *, void *)); void yds_attach __P((struct device *, struct device *, void *)); int yds_intr __P((void *)); -#ifdef __HAS_NEW_BUS_DMAMAP_SYNC -#define yds_bus_dmamap_sync(t, m, o, l, f) \ - bus_dmamap_sync((t), (m), (o), (l), (f)) -#else -#define yds_bus_dmamap_sync(t, m, o, l, f) \ - bus_dmamap_sync((t), (m), (f)) -#endif - #define DMAADDR(p) ((p)->map->dm_segs[0].ds_addr) #define KERNADDR(p) ((void *)((p)->addr)) -int yds_allocmem __P((struct yds_softc *, size_t, size_t, struct yds_dma *)); +int yds_allocmem __P((struct yds_softc *, size_t, size_t, + struct yds_dma *)); int yds_freemem __P((struct yds_softc *, struct yds_dma *)); #ifndef AUDIO_DEBUG @@ -149,18 +143,19 @@ void YWRITE4(struct yds_softc *sc,bus_size_t r,u_int32_t x) #define YWRITEREGION4(sc, r, x, c) \ bus_space_write_region_4((sc)->memt, (sc)->memh, (r), (x), (c) / 4) -struct cfdriver yds_cd = { - NULL, "yds", DV_DULL -}; - struct cfattach yds_ca = { sizeof(struct yds_softc), yds_match, yds_attach }; +struct cfdriver yds_cd = { + NULL, "yds", DV_DULL +}; + int yds_open __P((void *, int)); void yds_close __P((void *)); int yds_query_encoding __P((void *, struct audio_encoding *)); -int yds_set_params __P((void *, int, int, struct audio_params *, struct audio_params *)); +int yds_set_params __P((void *, int, int, + struct audio_params *, struct audio_params *)); int yds_round_blocksize __P((void *, int)); int yds_trigger_output __P((void *, void *, void *, int, void (*)(void *), void *, struct audio_params *)); @@ -183,7 +178,7 @@ int yds_read_codec __P((void *sc, u_int8_t a, u_int16_t *d)); int yds_write_codec __P((void *sc, u_int8_t a, u_int16_t d)); void yds_reset_codec __P((void *sc)); int yds_get_portnum_by_name __P((struct yds_softc *, char *, char *, - char *)); + char *)); static u_int yds_get_dstype __P((int)); static int yds_download_mcode __P((struct yds_softc *)); @@ -231,7 +226,7 @@ static struct audio_hw_if yds_hw_if = { yds_mappage, yds_get_props, yds_trigger_output, - yds_trigger_input, + yds_trigger_input }; struct audio_device yds_device = { @@ -485,9 +480,9 @@ yds_allocate_slots(sc) cb += pcs; } /* Sync play control data table */ - yds_bus_dmamap_sync(sc->sc_dmatag, p->map, sc->ptbloff, - (N_PLAY_SLOT_CTRL+1) * sizeof(u_int32_t), - BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->sc_dmatag, p->map, + sc->ptbloff, (N_PLAY_SLOT_CTRL+1) * sizeof(u_int32_t), + BUS_DMASYNC_PREWRITE); return 0; } @@ -661,10 +656,16 @@ yds_attach(parent, self, aux) pci_intr_handle_t ih; pcireg_t reg; struct yds_codec_softc *codec; + char devinfo[256]; mixer_ctrl_t ctl; int i, r, to; + int revision; int ac97_id2; + pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo); + revision = PCI_REVISION(pa->pa_class); + printf(": %s (rev. 0x%02x)\n", devinfo, revision); + /* Map register to memory */ if (pci_mapreg_map(pa, YDS_PCI_MBA, PCI_MAPREG_TYPE_MEM, 0, &sc->memt, &sc->memh, NULL, NULL, 0)) { @@ -1004,11 +1005,13 @@ yds_intr(p) u_int dma, cpu, blk, len; /* Sync play slot control data */ - yds_bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map, - sc->pbankoff, - sizeof(struct play_slot_ctrl_bank) * (*sc->ptbl)* - N_PLAY_SLOT_CTRL_BANK, - BUS_DMASYNC_POSTWRITE|BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map, + sc->pbankoff, + sizeof(struct play_slot_ctrl_bank)* + (*sc->ptbl)* + N_PLAY_SLOT_CTRL_BANK, + BUS_DMASYNC_POSTWRITE| + BUS_DMASYNC_POSTREAD); dma = sc->pbankp[nbank]->pgstart * sc->sc_play.factor; cpu = sc->sc_play.offset; blk = sc->sc_play.blksize; @@ -1017,11 +1020,11 @@ yds_intr(p) if (((dma > cpu) && (dma - cpu > blk * 2)) || ((cpu > dma) && (dma + len - cpu > blk * 2))) { /* We can fill the next block */ - /* Sync ring buffer first for previous write */ - yds_bus_dmamap_sync(sc->sc_dmatag, - sc->sc_play.dma->map, - cpu, blk, - BUS_DMASYNC_POSTWRITE); + /* Sync ring buffer for previous write */ + bus_dmamap_sync(sc->sc_dmatag, + sc->sc_play.dma->map, + cpu, blk, + BUS_DMASYNC_POSTWRITE); sc->sc_play.intr(sc->sc_play.intr_arg); sc->sc_play.offset += blk; if (sc->sc_play.offset >= len) { @@ -1032,19 +1035,23 @@ yds_intr(p) #endif } /* Sync ring buffer for next write */ - yds_bus_dmamap_sync(sc->sc_dmatag, - sc->sc_play.dma->map, cpu, blk, - BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->sc_dmatag, + sc->sc_play.dma->map, + cpu, blk, + BUS_DMASYNC_PREWRITE); } } if (sc->sc_rec.intr) { u_int dma, cpu, blk, len; /* Sync rec slot control data */ - yds_bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map, - sc->rbankoff, sizeof(struct rec_slot_ctrl_bank)* - N_REC_SLOT_CTRL * N_REC_SLOT_CTRL_BANK, - BUS_DMASYNC_POSTWRITE|BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map, + sc->rbankoff, + sizeof(struct rec_slot_ctrl_bank)* + N_REC_SLOT_CTRL* + N_REC_SLOT_CTRL_BANK, + BUS_DMASYNC_POSTWRITE| + BUS_DMASYNC_POSTREAD); dma = sc->rbank[YDS_INPUT_SLOT*2 + nbank].pgstartadr; cpu = sc->sc_rec.offset; blk = sc->sc_rec.blksize; @@ -1054,9 +1061,10 @@ yds_intr(p) ((cpu > dma) && (dma + len - cpu > blk * 2))) { /* We can drain the current block */ /* Sync ring buffer first */ - yds_bus_dmamap_sync(sc->sc_dmatag, - sc->sc_rec.dma->map, cpu, blk, - BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(sc->sc_dmatag, + sc->sc_rec.dma->map, + cpu, blk, + BUS_DMASYNC_POSTREAD); sc->sc_rec.intr(sc->sc_rec.intr_arg); sc->sc_rec.offset += blk; if (sc->sc_rec.offset >= len) { @@ -1067,9 +1075,10 @@ yds_intr(p) #endif } /* Sync ring buffer for next read */ - yds_bus_dmamap_sync(sc->sc_dmatag, - sc->sc_rec.dma->map, cpu, blk, - BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->sc_dmatag, + sc->sc_rec.dma->map, + cpu, blk, + BUS_DMASYNC_PREREAD); } } } @@ -1489,12 +1498,14 @@ yds_trigger_output(addr, start, end, blksize, intr, arg, param) /* Now the play slot for the next frame is set up!! */ /* Sync play slot control data for both directions */ - yds_bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map, - sc->ptbloff, sizeof(struct play_slot_ctrl_bank) * channels * - N_PLAY_SLOT_CTRL_BANK, BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map, + sc->ptbloff, + sizeof(struct play_slot_ctrl_bank) * + channels * N_PLAY_SLOT_CTRL_BANK, + BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD); /* Sync ring buffer */ - yds_bus_dmamap_sync(sc->sc_dmatag, p->map, 0, blksize, - BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->sc_dmatag, p->map, 0, blksize, + BUS_DMASYNC_PREWRITE); /* HERE WE GO!! */ YWRITE4(sc, YDS_MODE, YREAD4(sc, YDS_MODE) | YDS_MODE_ACTV | YDS_MODE_ACTV2); @@ -1589,11 +1600,15 @@ yds_trigger_input(addr, start, end, blksize, intr, arg, param) #endif /* Now the rec slot for the next frame is set up!! */ /* Sync record slot control data */ - yds_bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map, sc->rbankoff, - sizeof(struct rec_slot_ctrl_bank) * N_REC_SLOT_CTRL * - N_REC_SLOT_CTRL_BANK, BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map, + sc->rbankoff, + sizeof(struct rec_slot_ctrl_bank)* + N_REC_SLOT_CTRL* + N_REC_SLOT_CTRL_BANK, + BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD); /* Sync ring buffer */ - yds_bus_dmamap_sync(sc->sc_dmatag, p->map, 0, blksize, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->sc_dmatag, p->map, 0, blksize, + BUS_DMASYNC_PREREAD); /* HERE WE GO!! */ YWRITE4(sc, YDS_MODE, YREAD4(sc, YDS_MODE) | YDS_MODE_ACTV | YDS_MODE_ACTV2); @@ -1632,18 +1647,19 @@ yds_halt_output(addr) if (sc->sc_play.intr) { sc->sc_play.intr = 0; /* Sync play slot control data */ - yds_bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map, - sc->pbankoff, sizeof(struct play_slot_ctrl_bank) * - (*sc->ptbl)*N_PLAY_SLOT_CTRL_BANK, - BUS_DMASYNC_POSTWRITE|BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map, + sc->pbankoff, + sizeof(struct play_slot_ctrl_bank)* + (*sc->ptbl)*N_PLAY_SLOT_CTRL_BANK, + BUS_DMASYNC_POSTWRITE|BUS_DMASYNC_POSTREAD); /* Stop the play slot operation */ sc->pbankp[0]->status = sc->pbankp[1]->status = sc->pbankp[2]->status = sc->pbankp[3]->status = 1; /* Sync ring buffer */ - yds_bus_dmamap_sync(sc->sc_dmatag, sc->sc_play.dma->map, 0, - sc->sc_play.length, BUS_DMASYNC_POSTWRITE); + bus_dmamap_sync(sc->sc_dmatag, sc->sc_play.dma->map, + 0, sc->sc_play.length, BUS_DMASYNC_POSTWRITE); } return 0; @@ -1662,13 +1678,14 @@ yds_halt_input(addr) YWRITE4(sc, YDS_MAPOF_REC, 0); sc->sc_rec.intr = 0; /* Sync rec slot control data */ - yds_bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map, - sc->rbankoff, sizeof(struct rec_slot_ctrl_bank)* - N_REC_SLOT_CTRL*N_REC_SLOT_CTRL_BANK, - BUS_DMASYNC_POSTWRITE|BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map, + sc->rbankoff, + sizeof(struct rec_slot_ctrl_bank)* + N_REC_SLOT_CTRL*N_REC_SLOT_CTRL_BANK, + BUS_DMASYNC_POSTWRITE|BUS_DMASYNC_POSTREAD); /* Sync ring buffer */ - yds_bus_dmamap_sync(sc->sc_dmatag, sc->sc_rec.dma->map, 0, - sc->sc_rec.length, BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(sc->sc_dmatag, sc->sc_rec.dma->map, + 0, sc->sc_rec.length, BUS_DMASYNC_POSTREAD); } return 0; |