diff options
Diffstat (limited to 'sys/arm/arm/busdma_machdep.c')
-rw-r--r-- | sys/arm/arm/busdma_machdep.c | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/sys/arm/arm/busdma_machdep.c b/sys/arm/arm/busdma_machdep.c index f48ed75..f665057 100644 --- a/sys/arm/arm/busdma_machdep.c +++ b/sys/arm/arm/busdma_machdep.c @@ -177,8 +177,11 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, *dmat = NULL; newtag = (bus_dma_tag_t)malloc(sizeof(*newtag), M_DEVBUF, M_NOWAIT); - if (newtag == NULL) + if (newtag == NULL) { + CTR3(KTR_BUSDMA, "bus_dma_tag_create returned tag %p tag " + "flags 0x%x error %d", newtag, 0, error); return (ENOMEM); + } newtag->parent = parent; newtag->alignment = alignment; @@ -227,12 +230,17 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, } *dmat = newtag; + CTR3(KTR_BUSDMA, "bus_dma_tag_create returned tag %p tag flags 0x%x " + "error %d", newtag, (newtag != NULL ? newtag->flags : 0), error); + return (error); } int bus_dma_tag_destroy(bus_dma_tag_t dmat) { + bus_dma_tag_t dmat_copy = dmat; + if (dmat != NULL) { if (dmat->map_count != 0) @@ -255,6 +263,8 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat) dmat = NULL; } } + CTR1(KTR_BUSDMA, "bus_dma_tag_destroy tag %p", dmat_copy); + return (0); } @@ -266,15 +276,22 @@ int bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) { bus_dmamap_t newmap; + int error = 0; newmap = malloc(sizeof(*newmap), M_DEVBUF, M_NOWAIT | M_ZERO); - if (newmap == NULL) + if (newmap == NULL) { + CTR2(KTR_BUSDMA, "bus_dmamap_create: tag %p error %d", + dmat, ENOMEM); return (ENOMEM); + } *mapp = newmap; newmap->dmat = dmat; newmap->flags = 0; dmat->map_count++; + CTR3(KTR_BUSDMA, "bus_dmamap_create: tag %p tag flags 0x%x error %d", + dmat, dmat->flags, error); + return (0); } @@ -288,6 +305,7 @@ bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map) free(map, M_DEVBUF); dmat->map_count--; + CTR1(KTR_BUSDMA, "bus_dmamap_destroy: tag %p error 0", dmat); return (0); } @@ -313,8 +331,11 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, if (!*mapp) { newmap = malloc(sizeof(*newmap), M_DEVBUF, M_NOWAIT | M_ZERO); - if (newmap == NULL) + if (newmap == NULL) { + CTR3(KTR_BUSDMA, "bus_dmamem_alloc: tag %p tag " + "flags %0x%x error Md", dmat, dmat->flags, ENOMEM); return (ENOMEM); + } dmat->map_count++; newmap->flags = 0; *mapp = newmap; @@ -333,9 +354,11 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, 0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul, dmat->boundary); } - if (*vaddr == NULL && newmap != NULL) { - free(newmap, M_DEVBUF); - dmat->map_count--; + if (*vaddr == NULL) { + if (newmap != NULL) { + free(newmap, M_DEVBUF); + dmat->map_count--; + } *mapp = NULL; return (ENOMEM); } @@ -356,6 +379,8 @@ bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) } dmat->map_count--; free(map, M_DEVBUF); + CTR2(KTR_BUSDMA, "bus_dmamem_free: tag %p flags 0x%x", dmat, + dmat->flags); } /* @@ -386,6 +411,9 @@ bus_dmamap_load(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, else (*callback)(callback_arg, dm_segments, nsegs + 1, error); + CTR4(KTR_BUSDMA, "bus_dmamap_load: tag %p tag flags 0x%x error %d " + "nsegs %d", dmat, dmat->flags, nsegs + 1, error); + return (0); } @@ -412,6 +440,9 @@ bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dma_segment_t segs[], lastaddr = *lastaddrp; bmask = ~(dmat->boundary - 1); + CTR3(KTR_BUSDMA, "lowaddr= %d boundary= %d, " + "alignment= %d", dmat->lowaddr, dmat->boundary, dmat->alignment); + for (seg = *segp; buflen > 0 ; ) { /* * Get the physical address for this segment. @@ -564,6 +595,9 @@ bus_dmamap_load_mbuf(bus_dma_tag_t dmat, bus_dmamap_t map, struct mbuf *m0, (*callback)(callback_arg, dm_segments, nsegs + 1, m0->m_pkthdr.len, error); } + CTR4(KTR_BUSDMA, "bus_dmamap_load_mbuf: tag %p tag flags 0x%x " + "error %d nsegs %d", dmat, dmat->flags, error, nsegs + 1); + return (error); } @@ -663,6 +697,8 @@ bus_dmamap_load_uio(bus_dma_tag_t dmat, bus_dmamap_t map, struct uio *uio, uio->uio_resid, error); } + CTR4(KTR_BUSDMA, "bus_dmamap_load_uio: tag %p tag flags 0x%x " + "error %d nsegs %d", dmat, dmat->flags, error, nsegs + 1); return (error); } @@ -707,6 +743,7 @@ bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op) return; if (map->flags & DMAMAP_COHERENT) return; + CTR2(KTR_BUSDMA, "bus_dmamap_sync: op %x flags %x", op, map->flags); switch(map->flags & DMAMAP_TYPE_MASK) { case DMAMAP_LINEAR: bus_dmamap_sync_buf(map->buffer, map->len, op); |