diff --git a/sys/arm/arm/busdma_machdep.c b/sys/arm/arm/busdma_machdep.c --- a/sys/arm/arm/busdma_machdep.c +++ b/sys/arm/arm/busdma_machdep.c @@ -375,41 +375,6 @@ return (0); } -/* - * Convenience function for manipulating driver locks from busdma (during - * busdma_swi, for example). - */ -void -busdma_lock_mutex(void *arg, bus_dma_lock_op_t op) -{ - struct mtx *dmtx; - - dmtx = (struct mtx *)arg; - switch (op) { - case BUS_DMA_LOCK: - mtx_lock(dmtx); - break; - case BUS_DMA_UNLOCK: - mtx_unlock(dmtx); - break; - default: - panic("Unknown operation 0x%x for busdma_lock_mutex!", op); - } -} - -/* - * dflt_lock should never get called. It gets put into the dma tag when - * lockfunc == NULL, which is only valid if the maps that are associated - * with the tag are meant to never be defered. - * XXX Should have a way to identify which driver is responsible here. - */ -static void -dflt_lock(void *arg, bus_dma_lock_op_t op) -{ - - panic("driver error: busdma dflt_lock called"); -} - /* * Allocate a device specific dma_tag. */ @@ -461,7 +426,7 @@ newtag->lockfunc = lockfunc; newtag->lockfuncarg = lockfuncarg; } else { - newtag->lockfunc = dflt_lock; + newtag->lockfunc = _busdma_dflt_lock; newtag->lockfuncarg = NULL; } diff --git a/sys/arm64/arm64/busdma_machdep.c b/sys/arm64/arm64/busdma_machdep.c --- a/sys/arm64/arm64/busdma_machdep.c +++ b/sys/arm64/arm64/busdma_machdep.c @@ -51,41 +51,6 @@ #include #include -/* - * Convenience function for manipulating driver locks from busdma (during - * busdma_swi, for example). - */ -void -busdma_lock_mutex(void *arg, bus_dma_lock_op_t op) -{ - struct mtx *dmtx; - - dmtx = (struct mtx *)arg; - switch (op) { - case BUS_DMA_LOCK: - mtx_lock(dmtx); - break; - case BUS_DMA_UNLOCK: - mtx_unlock(dmtx); - break; - default: - panic("Unknown operation 0x%x for busdma_lock_mutex!", op); - } -} - -/* - * dflt_lock should never get called. It gets put into the dma tag when - * lockfunc == NULL, which is only valid if the maps that are associated - * with the tag are meant to never be defered. - * XXX Should have a way to identify which driver is responsible here. - */ -void -bus_dma_dflt_lock(void *arg, bus_dma_lock_op_t op) -{ - - panic("driver error: busdma dflt_lock called"); -} - /* * Return true if a match is made. * @@ -154,7 +119,7 @@ common->lockfunc = lockfunc; common->lockfuncarg = lockfuncarg; } else { - common->lockfunc = bus_dma_dflt_lock; + common->lockfunc = _busdma_dflt_lock; common->lockfuncarg = NULL; } diff --git a/sys/arm64/include/bus_dma_impl.h b/sys/arm64/include/bus_dma_impl.h --- a/sys/arm64/include/bus_dma_impl.h +++ b/sys/arm64/include/bus_dma_impl.h @@ -84,7 +84,6 @@ bus_dmasync_op_t op); }; -void bus_dma_dflt_lock(void *arg, bus_dma_lock_op_t op); int bus_dma_run_filter(struct bus_dma_tag_common *dmat, bus_addr_t paddr); int common_bus_dma_tag_create(struct bus_dma_tag_common *parent, bus_size_t alignment, diff --git a/sys/kern/subr_bus_dma.c b/sys/kern/subr_bus_dma.c --- a/sys/kern/subr_bus_dma.c +++ b/sys/kern/subr_bus_dma.c @@ -42,8 +42,10 @@ #include #include #include +#include #include #include +#include #include #include @@ -59,6 +61,43 @@ #include +/* + * Convenience function for manipulating driver locks from busdma (during + * busdma_swi, for example). + */ +void +busdma_lock_mutex(void *arg, bus_dma_lock_op_t op) +{ + struct mtx *dmtx; + + dmtx = (struct mtx *)arg; + switch (op) { + case BUS_DMA_LOCK: + mtx_lock(dmtx); + break; + case BUS_DMA_UNLOCK: + mtx_unlock(dmtx); + break; + default: + panic("Unknown operation 0x%x for busdma_lock_mutex!", op); + } +} + +/* + * dflt_lock should never get called. It gets put into the dma tag when + * lockfunc == NULL, which is only valid if the maps that are associated + * with the tag are meant to never be deferred. + * + * XXX Should have a way to identify which driver is responsible here. + */ +void +_busdma_dflt_lock(void *arg, bus_dma_lock_op_t op) +{ + + panic("driver error: _bus_dma_dflt_lock called"); +} + + /* * Load up data starting at offset within a region specified by a * list of virtual address ranges until either length or the region diff --git a/sys/powerpc/powerpc/busdma_machdep.c b/sys/powerpc/powerpc/busdma_machdep.c --- a/sys/powerpc/powerpc/busdma_machdep.c +++ b/sys/powerpc/powerpc/busdma_machdep.c @@ -146,40 +146,6 @@ return (retval); } -/* - * Convenience function for manipulating driver locks from busdma (during - * busdma_swi, for example). - */ -void -busdma_lock_mutex(void *arg, bus_dma_lock_op_t op) -{ - struct mtx *dmtx; - - dmtx = (struct mtx *)arg; - switch (op) { - case BUS_DMA_LOCK: - mtx_lock(dmtx); - break; - case BUS_DMA_UNLOCK: - mtx_unlock(dmtx); - break; - default: - panic("Unknown operation 0x%x for busdma_lock_mutex!", op); - } -} - -/* - * dflt_lock should never get called. It gets put into the dma tag when - * lockfunc == NULL, which is only valid if the maps that are associated - * with the tag are meant to never be defered. - * XXX Should have a way to identify which driver is responsible here. - */ -static void -dflt_lock(void *arg, bus_dma_lock_op_t op) -{ - panic("driver error: busdma dflt_lock called"); -} - #define BUS_DMA_COULD_BOUNCE BUS_DMA_BUS3 #define BUS_DMA_MIN_ALLOC_COMP BUS_DMA_BUS4 /* @@ -232,7 +198,7 @@ newtag->lockfunc = lockfunc; newtag->lockfuncarg = lockfuncarg; } else { - newtag->lockfunc = dflt_lock; + newtag->lockfunc = _busdma_dflt_lock; newtag->lockfuncarg = NULL; } diff --git a/sys/riscv/include/bus_dma_impl.h b/sys/riscv/include/bus_dma_impl.h --- a/sys/riscv/include/bus_dma_impl.h +++ b/sys/riscv/include/bus_dma_impl.h @@ -81,7 +81,6 @@ bus_dmasync_op_t op); }; -void bus_dma_dflt_lock(void *arg, bus_dma_lock_op_t op); int bus_dma_run_filter(struct bus_dma_tag_common *dmat, bus_addr_t paddr); int common_bus_dma_tag_create(struct bus_dma_tag_common *parent, bus_size_t alignment, diff --git a/sys/riscv/riscv/busdma_machdep.c b/sys/riscv/riscv/busdma_machdep.c --- a/sys/riscv/riscv/busdma_machdep.c +++ b/sys/riscv/riscv/busdma_machdep.c @@ -51,41 +51,6 @@ #include #include -/* - * Convenience function for manipulating driver locks from busdma (during - * busdma_swi, for example). - */ -void -busdma_lock_mutex(void *arg, bus_dma_lock_op_t op) -{ - struct mtx *dmtx; - - dmtx = (struct mtx *)arg; - switch (op) { - case BUS_DMA_LOCK: - mtx_lock(dmtx); - break; - case BUS_DMA_UNLOCK: - mtx_unlock(dmtx); - break; - default: - panic("Unknown operation 0x%x for busdma_lock_mutex!", op); - } -} - -/* - * dflt_lock should never get called. It gets put into the dma tag when - * lockfunc == NULL, which is only valid if the maps that are associated - * with the tag are meant to never be defered. - * XXX Should have a way to identify which driver is responsible here. - */ -void -bus_dma_dflt_lock(void *arg, bus_dma_lock_op_t op) -{ - - panic("driver error: busdma dflt_lock called"); -} - /* * Return true if a match is made. * @@ -156,7 +121,7 @@ common->lockfunc = lockfunc; common->lockfuncarg = lockfuncarg; } else { - common->lockfunc = bus_dma_dflt_lock; + common->lockfunc = _busdma_dflt_lock; common->lockfuncarg = NULL; } diff --git a/sys/sys/bus_dma.h b/sys/sys/bus_dma.h --- a/sys/sys/bus_dma.h +++ b/sys/sys/bus_dma.h @@ -149,6 +149,11 @@ */ void busdma_lock_mutex(void *arg, bus_dma_lock_op_t op); +/* + * Internal helper function used by tags that do not defer loads. + */ +void _busdma_dflt_lock(void *arg, bus_dma_lock_op_t op); + /* * Allocate a device specific dma_tag encapsulating the constraints of * the parent tag in addition to other restrictions specified: diff --git a/sys/x86/include/busdma_impl.h b/sys/x86/include/busdma_impl.h --- a/sys/x86/include/busdma_impl.h +++ b/sys/x86/include/busdma_impl.h @@ -89,7 +89,6 @@ #endif }; -void bus_dma_dflt_lock(void *arg, bus_dma_lock_op_t op); int bus_dma_run_filter(struct bus_dma_tag_common *dmat, vm_paddr_t paddr); int common_bus_dma_tag_create(struct bus_dma_tag_common *parent, bus_size_t alignment, diff --git a/sys/x86/x86/busdma_machdep.c b/sys/x86/x86/busdma_machdep.c --- a/sys/x86/x86/busdma_machdep.c +++ b/sys/x86/x86/busdma_machdep.c @@ -55,41 +55,6 @@ #include #include -/* - * Convenience function for manipulating driver locks from busdma (during - * busdma_swi, for example). - */ -void -busdma_lock_mutex(void *arg, bus_dma_lock_op_t op) -{ - struct mtx *dmtx; - - dmtx = (struct mtx *)arg; - switch (op) { - case BUS_DMA_LOCK: - mtx_lock(dmtx); - break; - case BUS_DMA_UNLOCK: - mtx_unlock(dmtx); - break; - default: - panic("Unknown operation 0x%x for busdma_lock_mutex!", op); - } -} - -/* - * dflt_lock should never get called. It gets put into the dma tag when - * lockfunc == NULL, which is only valid if the maps that are associated - * with the tag are meant to never be defered. - * XXX Should have a way to identify which driver is responsible here. - */ -void -bus_dma_dflt_lock(void *arg, bus_dma_lock_op_t op) -{ - - panic("driver error: busdma dflt_lock called"); -} - /* * Return true if a match is made. * @@ -161,7 +126,7 @@ common->lockfunc = lockfunc; common->lockfuncarg = lockfuncarg; } else { - common->lockfunc = bus_dma_dflt_lock; + common->lockfunc = _busdma_dflt_lock; common->lockfuncarg = NULL; }