I've been hacking on DMA windows on alpha.  While I've been getting
things wrong, I've been provoking a panic in the ata driver because
it cannot do DMA when attaching a disk.

The panic is triggered at the end of ad_attach() by the raid probe
causing a transfer to fail and the disk to be detached.  That's fine
and dandy, but ad_print() is called with the (now stale) ad pointer.

Here's a patch which fixes the problem.  The disk is now correctly
detached and the boot proceeds "normally" (modulo my dma window
hacking).  The patch is against stable, but should also apply to
-current.   I think it might appease some people w/marginal hardware
who see panics at boot...


Index: ata-disk.c
RCS file: /home/ncvs/src/sys/dev/ata/ata-disk.c,v
retrieving revision
diff -u -r1.60.2.23 ata-disk.c
--- ata-disk.c  30 May 2002 11:42:13 -0000
+++ ata-disk.c  4 Dec 2002 16:16:59 -0000
@@ -217,8 +217,9 @@
     /* if this disk belongs to an ATA RAID dont print the probe */
     if (ata_raiddisk_attach(adp))
        adp->flags |= AD_F_RAID_SUBDISK;
-    else
-       ad_print(adp);
+    else if (atadev->driver != NULL)
+        ad_print(atadev->driver);

The panic is as follows:

sc0: <System console> on isa0
sc0: VGA <16 virtual consoles, flags=0x0>
mcclock0: <MC146818A real time clock> at port 0x70-0x71 on isa0
ad1: READ command timeout tag=0 serv=0 - resetting
ata2: resetting devices .. 
ad1: removed from configuration

fatal kernel trap:

    trap entry = 0x2 (memory management fault)
    a0         = 0x0
    a1         = 0x1
    a2         = 0x0
    pc         = 0xfffffc000036ddb8
    ra         = 0xfffffc000036b69c
    curproc    = 0xfffffc000073d458
        pid = 0, comm = swapper

ddbprinttrap from 0xfffffc000036ddb8
ddbprinttrap(0x0, 0x1, 0x0, 0x2)
panic: trap
Stopped at      Debugger+0x2c:  ldq     ra,0(sp) <0xfffffc00007dda70>
db> tr
Debugger() at Debugger+0x2c
panic() at panic+0x100
trap() at trap+0x600
XentMM() at XentMM+0x2c
--- memory management fault (from ipl 4) ---
ad_print() at ad_print+0x1f8
ad_attach() at ad_attach+0x5bc
ata_boot_attach() at ata_boot_attach+0x1a4
run_interrupt_driven_config_hooks() at
mi_startup() at mi_startup+0xf4
locorestart() at locorestart+0x68
--- root of call graph ---

(gdb) l *ad_attach+0x5bc
0xfffffc000036b69c is in ad_interrupt (../../dev/ata/ata-disk.c:221).
217         /* if this disk belongs to an ATA RAID dont print the probe */
218         if (ata_raiddisk_attach(adp))
219             adp->flags |= AD_F_RAID_SUBDISK;
220         else
221             ad_print(adp);
222     }
224     void
225     ad_detach(struct ata_device *atadev, int flush) /* get rid of
flush XXX SOS */

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to