Date: Fri, 15 Nov 2002 06:10:55 -0800 From: Chuck Tuffli <chuck_tuffli@agilent.com> To: freebsd-hackers@FreeBSD.ORG Subject: bus_dmamem_alloc failing Message-ID: <20021115141048.GA367@thegrail.rose.agilent.com>
next in thread | raw e-mail | index | archive | help
I'm writting a PCI device driver that needs to allocate "large" aligned chunks of DMA memory for the hardware's queues. After loading and unloading the driver a number of times, bus_dmamem_alloc starts to fail. In the device attach, the allocation code looks like (error checking removed for brevity) bus_dma_tag_create(NULL, 4, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, BUS_SPACE_MAXSIZE_32BIT, BUS_SPACE_UNRESTRICTED, 0, &parent); bus_dma_tag_create(parent, 65536, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, 65536, 1, 65536, 0, &child); bus_dmamem_alloc(child, &virt, BUS_DMA_NOWAIT, &map); bus_dmamap_load(child, map, virt, 65536, map_request, NULL, 0); In the device detach, the code that frees up the memory if (virt != NULL) { bus_dmamap_unload(child, map); bus_dmamem_free(child, virt, map); bus_dmamap_destroy(child, map); } bus_dma_tag_destroy(child); bus_dma_tag_destroy(parent); I'm clearly doing something wrong, but I don't understand what the problem is. Any ideas? Thanks! -- Chuck Tuffli <chuck_tuffli AT NO_SPAM agilent DOT com> Agilent Technologies, Storage and Networking To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021115141048.GA367>