Subject: Re: problems with second ide drive
To: Christos Zoulas <christos@zoulas.com>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: current-users
Date: 05/20/1999 08:56:16
--rZ03NoBR/3+SXJZ6
Content-Type: text/plain; charset=us-ascii
On May 19, Christos Zoulas wrote
> [...]
> wd0(pciide0:0:0): using PIO mode 0, DMA mode 1 (using DMA data transfers)
> wd1(pciide0:0:1): using PIO mode 4
That's the problem: the PIIX can't use different modes for the master and
slave device, so there's a bug in the driver.
Could you try the attached patch ? It should even allow DMA to properly
work.
> | Did you try to newfs again the filesystems before ? It may be possible that
> | some table got corrupted, which are not checked by fsck.
>
> I would consider this a serious bug in fsck then...
I already tracked something like this down. Some tables are computed at newfs
time and stored on disk, then never changed, so fsck doesn't check them.
But I don't know how to check and correct them. Using the newfs algorithm
works, but I'm not sure other OS's newfs would produce the same table.
--
Manuel Bouyer, LIP6, Universite Paris VI. Manuel.Bouyer@lip6.fr
--
--rZ03NoBR/3+SXJZ6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff
Index: pciide.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/pciide.c,v
retrieving revision 1.37
diff -u -r1.37 pciide.c
--- pciide.c 1999/05/05 15:24:59 1.37
+++ pciide.c 1999/05/20 06:55:38
@@ -1283,6 +1283,7 @@
mode[0] = mode[1] =
min(drvp[0].DMA_mode, drvp[1].DMA_mode);
drvp[0].DMA_mode = mode[0];
+ drvp[1].DMA_mode = mode[1];
goto ok;
}
/*
@@ -1294,7 +1295,7 @@
mode[1] = drvp[1].PIO_mode;
if (piix_isp_pio[mode[1]] != piix_isp_dma[mode[0]] ||
piix_rtc_pio[mode[1]] != piix_rtc_dma[mode[0]])
- mode[1] = 0;
+ mode[1] = drvp[1].PIO_mode = 0;
goto ok;
}
if (drvp[1].drive_flags & DRIVE_DMA) {
@@ -1302,7 +1303,7 @@
mode[0] = drvp[0].PIO_mode;
if (piix_isp_pio[mode[0]] != piix_isp_dma[mode[1]] ||
piix_rtc_pio[mode[0]] != piix_rtc_dma[mode[1]])
- mode[0] = 0;
+ mode[0] = drvp[0].PIO_mode = 0;
goto ok;
}
/*
@@ -1310,24 +1311,24 @@
* one of them is PIO mode < 2
*/
if (drvp[0].PIO_mode < 2) {
- mode[0] = 0;
+ mode[0] = drvp[0].PIO_mode = 0;
mode[1] = drvp[1].PIO_mode;
} else if (drvp[1].PIO_mode < 2) {
- mode[1] = 0;
+ mode[1] = drvp[1].PIO_mode = 0;
mode[0] = drvp[0].PIO_mode;
} else {
mode[0] = mode[1] =
min(drvp[1].PIO_mode, drvp[0].PIO_mode);
+ drvp[0].PIO_mode = mode[0];
+ drvp[1].PIO_mode = mode[1];
}
ok: /* The modes are setup */
for (drive = 0; drive < 2; drive++) {
if (drvp[drive].drive_flags & DRIVE_DMA) {
- drvp[drive].DMA_mode = mode[drive];
idetim |= piix_setup_idetim_timings(
mode[drive], 1, chp->channel);
goto end;
- } else
- drvp[drive].PIO_mode = mode[drive];
+ }
}
/* If we are there, none of the drives are DMA */
if (mode[0] >= 2)
--rZ03NoBR/3+SXJZ6--