Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Jun 2008 13:53:39 +0400
From:      "Andrey V. Elsukov" <bu7cher@yandex.ru>
To:        Fabian Keil <freebsd-listen@fabiankeil.de>
Cc:        cvs-src@FreeBSD.org, =?UTF-8?B?U8O4cmVuIFNjaG1pZHQ=?= <sos@FreeBSD.org>
Subject:   Re: cvs commit: src/sys/dev/ata ata-all.c ata-all.h ata-chipset.c ata-disk.c ata-dma.c ata-lowlevel.c ata-pci.c ata-queue.c ata-raid.c atapi-cam.c atapi-cd.c atapi-fd.c atapi-tape.c
Message-ID:  <484514A3.5060501@yandex.ru>
In-Reply-To: <20080417195338.257a1df2@fabiankeil.de>
References:  <200804171229.m3HCTaG4089203@repoman.freebsd.org> <20080417195338.257a1df2@fabiankeil.de>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
Fabian Keil wrote:
> With this commit, I'm getting a page fault in bus_dmamap_load()
> reached through ata_dmaload(), right after ad1 is detected:
> http://www.fabiankeil.de/tmp/freebsd/ata-bus-dmamap-load-page-fault-600x383.jpg
> http://www.fabiankeil.de/tmp/freebsd/ata-bus-dmamap-load-page-fault-where-600x440.jpg

I'm writing AHCI-capable driver which based on ata(4) and I have
the same problem. Problem was introduced with this commit.
AHCI driver is trying use DMA without ata_dmaalloc call.
Problem fixed for me with attached patch.

-- 
WBR, Andrey V. Elsukov

[-- Attachment #2 --]
--- ata.orig/ata-pci.c	2008-06-03 13:17:59.000000000 +0400
+++ ata/ata-pci.c	2008-06-03 13:33:36.000000000 +0400
@@ -617,14 +622,16 @@ ata_pcichannel_attach(device_t dev)
     if (ctlr->dmainit)
 	ctlr->dmainit(dev);
 
-    if ((error = ctlr->allocate(dev)))
-	return error;
+    if (ch->dma.alloc)
+	ch->dma.alloc(dev);
 
-    if ((error = ata_attach(dev)))
+    if ((error = ctlr->allocate(dev))) {
+	if (ch->dma.free)
+	    ch->dma.free(dev);
 	return error;
+    }
 
-    ch->dma.alloc(dev);
-    return 0;
+    return ata_attach(dev);
 }
 
 static int

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?484514A3.5060501>