- 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
This commit is contained in:
parent
4304af4a28
commit
831ce4cb3d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=232356
@ -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, bus_size_t alignment,
|
||||
* 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))
|
||||
|
@ -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_tag_t dmat, bus_addr_t paddr,
|
||||
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 op)
|
||||
*/
|
||||
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)
|
||||
|
@ -418,7 +418,7 @@ malloc_type_freed(struct malloc_type *mtp, unsigned long size)
|
||||
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;
|
||||
|
||||
|
@ -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, bus_size_t alignment,
|
||||
* 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;
|
||||
|
@ -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 op)
|
||||
*/
|
||||
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,
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -64,7 +64,7 @@ static int ps3bus_activate_resource(device_t bus, device_t child, int type,
|
||||
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 @@ 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,
|
||||
bus_addr_t min, bus_addr_t max, bus_size_t alignment, bus_addr_t boundary,
|
||||
void *cookie)
|
||||
{
|
||||
struct ps3bus_devinfo *dinfo = cookie;
|
||||
|
@ -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;
|
||||
|
@ -185,7 +185,7 @@ dflt_lock(void *arg, bus_dma_lock_op_t op)
|
||||
*/
|
||||
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)
|
||||
|
@ -169,7 +169,7 @@ void busdma_lock_mutex(void *arg, bus_dma_lock_op_t op);
|
||||
*/
|
||||
/* 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,
|
||||
|
@ -171,7 +171,7 @@ typedef void malloc_type_list_func_t(struct malloc_type *, void *);
|
||||
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 *);
|
||||
|
@ -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 op)
|
||||
*/
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user