From 606881540916898b4c535fa0d5ac430c257e9031 Mon Sep 17 00:00:00 2001 From: kettenis Date: Sat, 24 Jan 2015 20:59:42 +0000 Subject: [PATCH] Implement bus_dmamem_alloc_range(9) for macppc/socppc. --- sys/arch/macppc/include/bus.h | 11 ++++++++++- sys/arch/macppc/pci/pci_machdep.c | 3 ++- sys/arch/powerpc/powerpc/bus_dma.c | 7 ++----- sys/arch/socppc/dev/ehci_obio.c | 3 ++- sys/arch/socppc/include/bus.h | 11 ++++++++++- sys/arch/socppc/socppc/mainbus.c | 3 ++- 6 files changed, 28 insertions(+), 10 deletions(-) diff --git a/sys/arch/macppc/include/bus.h b/sys/arch/macppc/include/bus.h index 4f414256dd4..bfd11f58a36 100644 --- a/sys/arch/macppc/include/bus.h +++ b/sys/arch/macppc/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.23 2014/03/29 18:09:29 guenther Exp $ */ +/* $OpenBSD: bus.h,v 1.24 2015/01/24 20:59:42 kettenis Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom. All rights reserved. @@ -521,6 +521,9 @@ struct powerpc_bus_dma_tag { */ int (*_dmamem_alloc)(bus_dma_tag_t, bus_size_t, bus_size_t, bus_size_t, bus_dma_segment_t *, int, int *, int); + int (*_dmamem_alloc_range)(bus_dma_tag_t, bus_size_t, bus_size_t, + bus_size_t, bus_dma_segment_t *, int, int *, int, + bus_addr_t, bus_addr_t); void (*_dmamem_free)(bus_dma_tag_t, bus_dma_segment_t *, int); int (*_dmamem_map)(bus_dma_tag_t, bus_dma_segment_t *, int, size_t, caddr_t *, int); @@ -549,6 +552,9 @@ struct powerpc_bus_dma_tag { #define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \ (*(t)->_dmamem_alloc)((t)->_cookie, (s), (a), (b), (sg), (n), (r), (f)) +#define bus_dmamem_alloc_range(t, s, a, b, sg, n, r, f, l, h) \ + (*(t)->_dmamem_alloc_range)((t), (s), (a), (b), (sg), \ + (n), (r), (f), (l), (h)) #define bus_dmamem_free(t, sg, n) \ (*(t)->_dmamem_free)((t)->_cookie, (sg), (n)) #define bus_dmamem_map(t, sg, n, s, k, f) \ @@ -573,6 +579,9 @@ void _dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t, bus_size_t, int _dmamem_alloc(bus_dma_tag_t, bus_size_t, bus_size_t, bus_size_t, bus_dma_segment_t *, int, int *, int); +int _dmamem_alloc_range( bus_dma_tag_t, bus_size_t, bus_size_t, + bus_size_t, bus_dma_segment_t *, int, int *, int, + bus_addr_t, bus_addr_t); void _dmamem_free(bus_dma_tag_t, bus_dma_segment_t *, int); int _dmamem_map(bus_dma_tag_t, bus_dma_segment_t *, int, size_t, caddr_t *, int); diff --git a/sys/arch/macppc/pci/pci_machdep.c b/sys/arch/macppc/pci/pci_machdep.c index 11d4f5d9dd7..de15b56c205 100644 --- a/sys/arch/macppc/pci/pci_machdep.c +++ b/sys/arch/macppc/pci/pci_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.c,v 1.3 2014/04/26 14:26:48 mpi Exp $ */ +/* $OpenBSD: pci_machdep.c,v 1.4 2015/01/24 20:59:42 kettenis Exp $ */ /* * Copyright (c) 2013 Martin Pieuchot @@ -50,6 +50,7 @@ struct powerpc_bus_dma_tag pci_bus_dma_tag = { _dmamap_unload, _dmamap_sync, _dmamem_alloc, + _dmamem_alloc_range, _dmamem_free, _dmamem_map, _dmamem_unmap, diff --git a/sys/arch/powerpc/powerpc/bus_dma.c b/sys/arch/powerpc/powerpc/bus_dma.c index 963bbb1d0c4..ec77838eb3b 100644 --- a/sys/arch/powerpc/powerpc/bus_dma.c +++ b/sys/arch/powerpc/powerpc/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.1 2015/01/20 17:08:35 mpi Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.2 2015/01/24 20:59:42 kettenis Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -47,9 +47,6 @@ #include -int _dmamem_alloc_range( bus_dma_tag_t t, bus_size_t size, - bus_size_t alignment, bus_size_t boundary, bus_dma_segment_t *segs, - int nsegs, int *rsegs, int flags, vaddr_t low, vaddr_t high); int _dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *, bus_size_t, struct proc *, int, bus_addr_t *, int *, int); /* @@ -561,7 +558,7 @@ _dmamem_mmap(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, off_t off, int _dmamem_alloc_range(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment, bus_size_t boundary, bus_dma_segment_t *segs, int nsegs, int *rsegs, - int flags, vaddr_t low, vaddr_t high) + int flags, bus_addr_t low, bus_addr_t high) { vaddr_t curaddr, lastaddr; struct vm_page *m; diff --git a/sys/arch/socppc/dev/ehci_obio.c b/sys/arch/socppc/dev/ehci_obio.c index 85f23704393..c8ff01859a7 100644 --- a/sys/arch/socppc/dev/ehci_obio.c +++ b/sys/arch/socppc/dev/ehci_obio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ehci_obio.c,v 1.4 2014/05/19 13:11:31 mpi Exp $ */ +/* $OpenBSD: ehci_obio.c,v 1.5 2015/01/24 20:59:42 kettenis Exp $ */ /* * Copyright (c) 2008 Mark Kettenis @@ -64,6 +64,7 @@ struct powerpc_bus_dma_tag ehci_bus_dma_tag = { _dmamap_unload, _dmamap_sync, _dmamem_alloc, + _dmamem_alloc_range, _dmamem_free, _dmamem_map, _dmamem_unmap, diff --git a/sys/arch/socppc/include/bus.h b/sys/arch/socppc/include/bus.h index 1150642c755..6c782eba8a2 100644 --- a/sys/arch/socppc/include/bus.h +++ b/sys/arch/socppc/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.10 2015/01/20 17:08:35 mpi Exp $ */ +/* $OpenBSD: bus.h,v 1.11 2015/01/24 20:59:42 kettenis Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom. All rights reserved. @@ -521,6 +521,9 @@ struct powerpc_bus_dma_tag { */ int (*_dmamem_alloc)(bus_dma_tag_t, bus_size_t, bus_size_t, bus_size_t, bus_dma_segment_t *, int, int *, int); + int (*_dmamem_alloc_range)(bus_dma_tag_t, bus_size_t, bus_size_t, + bus_size_t, bus_dma_segment_t *, int, int *, int, + bus_addr_t, bus_addr_t); void (*_dmamem_free)(bus_dma_tag_t, bus_dma_segment_t *, int); int (*_dmamem_map)(bus_dma_tag_t, bus_dma_segment_t *, int, size_t, caddr_t *, int); @@ -549,6 +552,9 @@ struct powerpc_bus_dma_tag { #define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \ (*(t)->_dmamem_alloc)((t)->_cookie, (s), (a), (b), (sg), (n), (r), (f)) +#define bus_dmamem_alloc_range(t, s, a, b, sg, n, r, f, l, h) \ + (*(t)->_dmamem_alloc_range)((t), (s), (a), (b), (sg), \ + (n), (r), (f), (l), (h)) #define bus_dmamem_free(t, sg, n) \ (*(t)->_dmamem_free)((t)->_cookie, (sg), (n)) #define bus_dmamem_map(t, sg, n, s, k, f) \ @@ -573,6 +579,9 @@ void _dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t, bus_size_t, int _dmamem_alloc(bus_dma_tag_t, bus_size_t, bus_size_t, bus_size_t, bus_dma_segment_t *, int, int *, int); +int _dmamem_alloc_range( bus_dma_tag_t, bus_size_t, bus_size_t, + bus_size_t, bus_dma_segment_t *, int, int *, int, + bus_addr_t, bus_addr_t); void _dmamem_free(bus_dma_tag_t, bus_dma_segment_t *, int); int _dmamem_map(bus_dma_tag_t, bus_dma_segment_t *, int, size_t, caddr_t *, int); diff --git a/sys/arch/socppc/socppc/mainbus.c b/sys/arch/socppc/socppc/mainbus.c index f4b69114700..805128a1b19 100644 --- a/sys/arch/socppc/socppc/mainbus.c +++ b/sys/arch/socppc/socppc/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.5 2010/03/25 19:42:55 deraadt Exp $ */ +/* $OpenBSD: mainbus.c,v 1.6 2015/01/24 20:59:42 kettenis Exp $ */ /* * Copyright (c) 2008 Mark Kettenis @@ -48,6 +48,7 @@ struct powerpc_bus_dma_tag mainbus_bus_dma_tag = { _dmamap_unload, _dmamap_sync, _dmamem_alloc, + _dmamem_alloc_range, _dmamem_free, _dmamem_map, _dmamem_unmap, -- 2.20.1