From owner-freebsd-hackers Fri Nov 15 6:23:10 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B28BD37B404 for ; Fri, 15 Nov 2002 06:23:05 -0800 (PST) Received: from msgbas1x.cos.agilent.com (msgbas1x.cos.agilent.com [192.25.240.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id 191EF44080 for ; Fri, 15 Nov 2002 06:15:49 -0800 (PST) (envelope-from ctuffli@rose.agilent.com) Received: from relcos1.cos.agilent.com (relcos1.cos.agilent.com [130.29.152.239]) by msgbas1x.cos.agilent.com (Postfix) with ESMTP id 09101C815 for ; Fri, 15 Nov 2002 07:14:57 -0700 (MST) Received: from rtl.rose.agilent.com (rtl.rose.agilent.com [130.30.179.189]) by relcos1.cos.agilent.com (Postfix) with ESMTP id 8F58C1A for ; Fri, 15 Nov 2002 07:14:56 -0700 (MST) Received: from mail.rose.agilent.com (mailsrv@bellhop [130.30.179.19]) by rtl.rose.agilent.com (8.9.3 (PHNE_18979)/8.9.3 SMKit7.1.0) with ESMTP id GAA14382 for ; Fri, 15 Nov 2002 06:14:55 -0800 (PST) Received: from thegrail (anu.rose.agilent.com [156.140.225.186]) by mail.rose.agilent.com (Netscape Messaging Server 3.6) with ESMTP id AAA5341 for ; Fri, 15 Nov 2002 06:14:52 -0800 Received: by thegrail (Postfix, from userid 1001) id 3407184658; Fri, 15 Nov 2002 06:10:55 -0800 (PST) Date: Fri, 15 Nov 2002 06:10:55 -0800 From: Chuck Tuffli To: freebsd-hackers@FreeBSD.ORG Subject: bus_dmamem_alloc failing Message-ID: <20021115141048.GA367@thegrail.rose.agilent.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 Agilent Technologies, Storage and Networking To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message