FYI: ata(4) is broken for kauai and macio

Peter Grehan grehan at freebsd.org
Wed Apr 30 05:01:32 UTC 2008


> I have it to the point where the system doesn't crash or hang, but is 
> barely usable due to ATA i/o's taking 300ms.

  It helps to remove the 300ms DELAY() used during debugging :) Patch 
attached.

  Søren: this fixes the ata issues on Powermacs, and it may help other 
platforms that have PIO ATA. I haven't tested the floppy and tape code, 
though it appears based on RELENG_7 that the change should work.

later,

Peter.
-------------- next part --------------
Index: ata-disk.c
===================================================================
RCS file: /usr/home/ncvs/src/sys/dev/ata/ata-disk.c,v
retrieving revision 1.210
diff -d -u -r1.210 ata-disk.c
--- ata-disk.c	17 Apr 2008 12:29:35 -0000	1.210
+++ ata-disk.c	29 Apr 2008 05:37:33 -0000
@@ -125,7 +125,7 @@
     adp->disk->d_dump = ad_dump;
     adp->disk->d_name = "ad";
     adp->disk->d_drv1 = dev;
-    adp->disk->d_maxsize = ch->dma.max_iosize;
+    adp->disk->d_maxsize = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS;
     adp->disk->d_sectorsize = DEV_BSIZE;
     adp->disk->d_mediasize = DEV_BSIZE * (off_t)adp->total_secs;
     adp->disk->d_fwsectors = adp->sectors;
Index: ata-lowlevel.c
===================================================================
RCS file: /usr/home/ncvs/src/sys/dev/ata/ata-lowlevel.c,v
retrieving revision 1.83
diff -d -u -r1.83 ata-lowlevel.c
--- ata-lowlevel.c	17 Apr 2008 12:29:35 -0000	1.83
+++ ata-lowlevel.c	27 Apr 2008 23:33:50 -0000
@@ -213,7 +213,9 @@
     printf("ata_begin_transaction OOPS!!!\n");
 
 begin_finished:
-    ch->dma.unload(request);
+    if (ch->dma.unload) {
+        ch->dma.unload(request);
+    }
     return ATA_OP_FINISHED;
 
 begin_continue:
Index: atapi-cd.c
===================================================================
RCS file: /usr/home/ncvs/src/sys/dev/ata/atapi-cd.c,v
retrieving revision 1.199
diff -d -u -r1.199 atapi-cd.c
--- atapi-cd.c	17 Apr 2008 12:29:35 -0000	1.199
+++ atapi-cd.c	29 Apr 2008 05:05:49 -0000
@@ -906,8 +906,11 @@
 {
     struct ata_channel *ch = device_get_softc(device_get_parent(dev));
     struct acd_softc *cdp = device_get_ivars(dev);
+    uint32_t max_iosize;
 
-    cdp->iomax = min(ch->dma.max_iosize, 65534);
+    max_iosize = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS;
+
+    cdp->iomax = min(max_iosize, 65534);
 }
 
 static void 
Index: atapi-fd.c
===================================================================
RCS file: /usr/home/ncvs/src/sys/dev/ata/atapi-fd.c,v
retrieving revision 1.114
diff -d -u -r1.114 atapi-fd.c
--- atapi-fd.c	17 Apr 2008 12:29:35 -0000	1.114
+++ atapi-fd.c	30 Apr 2008 04:53:28 -0000
@@ -105,7 +105,7 @@
     fdp->disk->d_ioctl = afd_ioctl;
     fdp->disk->d_name = "afd";
     fdp->disk->d_drv1 = dev;
-    fdp->disk->d_maxsize = ch->dma.max_iosize;
+    fdp->disk->d_maxsize = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS;
     fdp->disk->d_unit = device_get_unit(dev);
     disk_create(fdp->disk, DISK_VERSION);
     return 0;
Index: atapi-tape.c
===================================================================
RCS file: /usr/home/ncvs/src/sys/dev/ata/atapi-tape.c,v
retrieving revision 1.107
diff -d -u -r1.107 atapi-tape.c
--- atapi-tape.c	17 Apr 2008 12:29:35 -0000	1.107
+++ atapi-tape.c	30 Apr 2008 04:55:08 -0000
@@ -142,7 +142,7 @@
 		      UID_ROOT, GID_OPERATOR, 0640, "ast%d",
 		      device_get_unit(dev));
     device->si_drv1 = dev;
-    device->si_iosize_max = ch->dma.max_iosize;
+    device->si_iosize_max = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS;
     stp->dev1 = device;
     device = make_dev(&ast_cdevsw, 2 * device_get_unit(dev) + 1,
 		      UID_ROOT, GID_OPERATOR, 0640, "nast%d",


More information about the freebsd-ppc mailing list