Date: Thu, 1 Mar 2012 19:58:35 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r232356 - in head/sys: arm/arm ia64/ia64 kern mips/mips powerpc/powerpc powerpc/ps3 sparc64/include sparc64/sparc64 sys x86/x86 Message-ID: <201203011958.q21JwZ8C093846@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Thu Mar 1 19:58:34 2012 New Revision: 232356 URL: http://svn.freebsd.org/changeset/base/232356 Log: - Change contigmalloc() to use the vm_paddr_t type instead of an unsigned long for specifying a boundary constraint. - Change bus_dma tags to use bus_addr_t instead of bus_size_t for boundary constraints. These allow boundary constraints to be fully expressed for cases where sizeof(bus_addr_t) != sizeof(bus_size_t). Specifically, it allows a driver to properly specify a 4GB boundary in a PAE kernel. Note that this cannot be safely MFC'd without a lot of compat shims due to KBI changes, so I do not intend to merge it. Reviewed by: scottl Modified: head/sys/arm/arm/busdma_machdep.c head/sys/ia64/ia64/busdma_machdep.c head/sys/kern/kern_malloc.c head/sys/mips/mips/busdma_machdep.c head/sys/powerpc/powerpc/busdma_machdep.c head/sys/powerpc/powerpc/iommu_if.m head/sys/powerpc/ps3/ps3bus.c head/sys/sparc64/include/bus_dma.h head/sys/sparc64/sparc64/bus_machdep.c head/sys/sys/bus_dma.h head/sys/sys/malloc.h head/sys/x86/x86/busdma_machdep.c Modified: head/sys/arm/arm/busdma_machdep.c ============================================================================== --- head/sys/arm/arm/busdma_machdep.c Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/arm/arm/busdma_machdep.c Thu Mar 1 19:58:34 2012 (r232356) @@ -68,7 +68,7 @@ struct bounce_zone; struct bus_dma_tag { bus_dma_tag_t parent; bus_size_t alignment; - bus_size_t boundary; + bus_addr_t boundary; bus_addr_t lowaddr; bus_addr_t highaddr; bus_dma_filter_t *filter; @@ -332,7 +332,7 @@ _busdma_free_dmamap(bus_dmamap_t map) int bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, - bus_size_t boundary, bus_addr_t lowaddr, + bus_addr_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr, bus_dma_filter_t *filter, void *filterarg, bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, @@ -378,12 +378,12 @@ bus_dma_tag_create(bus_dma_tag_t parent, * Take into account any restrictions imposed by our parent tag */ if (parent != NULL) { - newtag->lowaddr = min(parent->lowaddr, newtag->lowaddr); - newtag->highaddr = max(parent->highaddr, newtag->highaddr); + newtag->lowaddr = MIN(parent->lowaddr, newtag->lowaddr); + newtag->highaddr = MAX(parent->highaddr, newtag->highaddr); if (newtag->boundary == 0) newtag->boundary = parent->boundary; else if (parent->boundary != 0) - newtag->boundary = min(parent->boundary, + newtag->boundary = MIN(parent->boundary, newtag->boundary); if ((newtag->filter != NULL) || ((parent->flags & BUS_DMA_COULD_BOUNCE) != 0)) Modified: head/sys/ia64/ia64/busdma_machdep.c ============================================================================== --- head/sys/ia64/ia64/busdma_machdep.c Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/ia64/ia64/busdma_machdep.c Thu Mar 1 19:58:34 2012 (r232356) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); struct bus_dma_tag { bus_dma_tag_t parent; bus_size_t alignment; - bus_size_t boundary; + bus_addr_t boundary; bus_addr_t lowaddr; bus_addr_t highaddr; bus_dma_filter_t *filter; @@ -139,7 +139,7 @@ static __inline int run_filter(bus_dma_t static __inline int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr, bus_size_t len) { - bus_size_t bndy; + bus_addr_t bndy; int retval; retval = 0; @@ -199,7 +199,7 @@ dflt_lock(void *arg, bus_dma_lock_op_t o */ int bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, - bus_size_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr, + bus_addr_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr, bus_dma_filter_t *filter, void *filterarg, bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, void *lockfuncarg, bus_dma_tag_t *dmat) Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/kern/kern_malloc.c Thu Mar 1 19:58:34 2012 (r232356) @@ -418,7 +418,7 @@ malloc_type_freed(struct malloc_type *mt void * contigmalloc(unsigned long size, struct malloc_type *type, int flags, vm_paddr_t low, vm_paddr_t high, unsigned long alignment, - unsigned long boundary) + vm_paddr_t boundary) { void *ret; Modified: head/sys/mips/mips/busdma_machdep.c ============================================================================== --- head/sys/mips/mips/busdma_machdep.c Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/mips/mips/busdma_machdep.c Thu Mar 1 19:58:34 2012 (r232356) @@ -67,7 +67,7 @@ struct bounce_zone; struct bus_dma_tag { bus_dma_tag_t parent; bus_size_t alignment; - bus_size_t boundary; + bus_addr_t boundary; bus_addr_t lowaddr; bus_addr_t highaddr; bus_dma_filter_t *filter; @@ -310,7 +310,7 @@ _busdma_free_dmamap(bus_dmamap_t map) int bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, - bus_size_t boundary, bus_addr_t lowaddr, + bus_addr_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr, bus_dma_filter_t *filter, void *filterarg, bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, @@ -356,13 +356,13 @@ bus_dma_tag_create(bus_dma_tag_t parent, * Take into account any restrictions imposed by our parent tag */ if (parent != NULL) { - newtag->lowaddr = min(parent->lowaddr, newtag->lowaddr); - newtag->highaddr = max(parent->highaddr, newtag->highaddr); + newtag->lowaddr = MIN(parent->lowaddr, newtag->lowaddr); + newtag->highaddr = MAX(parent->highaddr, newtag->highaddr); if (newtag->boundary == 0) newtag->boundary = parent->boundary; else if (parent->boundary != 0) newtag->boundary = - min(parent->boundary, newtag->boundary); + MIN(parent->boundary, newtag->boundary); if ((newtag->filter != NULL) || ((parent->flags & BUS_DMA_COULD_BOUNCE) != 0)) newtag->flags |= BUS_DMA_COULD_BOUNCE; Modified: head/sys/powerpc/powerpc/busdma_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/busdma_machdep.c Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/powerpc/powerpc/busdma_machdep.c Thu Mar 1 19:58:34 2012 (r232356) @@ -63,7 +63,7 @@ struct bounce_zone; struct bus_dma_tag { bus_dma_tag_t parent; bus_size_t alignment; - bus_size_t boundary; + bus_addr_t boundary; bus_addr_t lowaddr; bus_addr_t highaddr; bus_dma_filter_t *filter; @@ -219,7 +219,7 @@ dflt_lock(void *arg, bus_dma_lock_op_t o */ int bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, - bus_size_t boundary, bus_addr_t lowaddr, + bus_addr_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr, bus_dma_filter_t *filter, void *filterarg, bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, Modified: head/sys/powerpc/powerpc/iommu_if.m ============================================================================== --- head/sys/powerpc/powerpc/iommu_if.m Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/powerpc/powerpc/iommu_if.m Thu Mar 1 19:58:34 2012 (r232356) @@ -41,7 +41,7 @@ METHOD int map { bus_addr_t lowaddr; bus_addr_t highaddr; bus_size_t alignment; - bus_size_t boundary; + bus_addr_t boundary; void *cookie; }; Modified: head/sys/powerpc/ps3/ps3bus.c ============================================================================== --- head/sys/powerpc/ps3/ps3bus.c Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/powerpc/ps3/ps3bus.c Thu Mar 1 19:58:34 2012 (r232356) @@ -64,7 +64,7 @@ static int ps3bus_activate_resource(devi int rid, struct resource *res); static bus_dma_tag_t ps3bus_get_dma_tag(device_t dev, device_t child); static int ps3_iommu_map(device_t dev, bus_dma_segment_t *segs, int *nsegs, bus_addr_t min, bus_addr_t max, bus_size_t alignment, - bus_size_t boundary, void *cookie); + bus_addr_t boundary, void *cookie); static int ps3_iommu_unmap(device_t dev, bus_dma_segment_t *segs, int nsegs, void *cookie); static int ps3_gettime(device_t dev, struct timespec *ts); @@ -697,7 +697,7 @@ fail: static int ps3_iommu_map(device_t dev, bus_dma_segment_t *segs, int *nsegs, - bus_addr_t min, bus_addr_t max, bus_size_t alignment, bus_size_t boundary, + bus_addr_t min, bus_addr_t max, bus_size_t alignment, bus_addr_t boundary, void *cookie) { struct ps3bus_devinfo *dinfo = cookie; Modified: head/sys/sparc64/include/bus_dma.h ============================================================================== --- head/sys/sparc64/include/bus_dma.h Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/sparc64/include/bus_dma.h Thu Mar 1 19:58:34 2012 (r232356) @@ -103,7 +103,7 @@ struct bus_dma_tag { void *dt_cookie; /* cookie used in the guts */ bus_dma_tag_t dt_parent; bus_size_t dt_alignment; - bus_size_t dt_boundary; + bus_addr_t dt_boundary; bus_addr_t dt_lowaddr; bus_addr_t dt_highaddr; bus_dma_filter_t *dt_filter; Modified: head/sys/sparc64/sparc64/bus_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/bus_machdep.c Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/sparc64/sparc64/bus_machdep.c Thu Mar 1 19:58:34 2012 (r232356) @@ -185,7 +185,7 @@ dflt_lock(void *arg, bus_dma_lock_op_t o */ int bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, - bus_size_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr, + bus_addr_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr, bus_dma_filter_t *filter, void *filterarg, bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, void *lockfuncarg, bus_dma_tag_t *dmat) Modified: head/sys/sys/bus_dma.h ============================================================================== --- head/sys/sys/bus_dma.h Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/sys/bus_dma.h Thu Mar 1 19:58:34 2012 (r232356) @@ -169,7 +169,7 @@ void busdma_lock_mutex(void *arg, bus_dm */ /* XXX Should probably allow specification of alignment */ int bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, - bus_size_t boundary, bus_addr_t lowaddr, + bus_addr_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr, bus_dma_filter_t *filtfunc, void *filtfuncarg, bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, Modified: head/sys/sys/malloc.h ============================================================================== --- head/sys/sys/malloc.h Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/sys/malloc.h Thu Mar 1 19:58:34 2012 (r232356) @@ -171,7 +171,7 @@ typedef void malloc_type_list_func_t(str void contigfree(void *addr, unsigned long size, struct malloc_type *type); void *contigmalloc(unsigned long size, struct malloc_type *type, int flags, vm_paddr_t low, vm_paddr_t high, unsigned long alignment, - unsigned long boundary) __malloc_like; + vm_paddr_t boundary) __malloc_like; void free(void *addr, struct malloc_type *type); void *malloc(unsigned long size, struct malloc_type *type, int flags) __malloc_like; void malloc_init(void *); Modified: head/sys/x86/x86/busdma_machdep.c ============================================================================== --- head/sys/x86/x86/busdma_machdep.c Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/x86/x86/busdma_machdep.c Thu Mar 1 19:58:34 2012 (r232356) @@ -63,7 +63,7 @@ struct bounce_zone; struct bus_dma_tag { bus_dma_tag_t parent; bus_size_t alignment; - bus_size_t boundary; + bus_addr_t boundary; bus_addr_t lowaddr; bus_addr_t highaddr; bus_dma_filter_t *filter; @@ -218,7 +218,7 @@ dflt_lock(void *arg, bus_dma_lock_op_t o */ int bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, - bus_size_t boundary, bus_addr_t lowaddr, + bus_addr_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr, bus_dma_filter_t *filter, void *filterarg, bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203011958.q21JwZ8C093846>