Subject: Any objections? Patch to change routine to print ata dma modes for
To: None <tech-kern@netbsd.org>
From: Bill Studenmund <wrstuden@zembu.com>
List: tech-kern
Date: 11/07/2000 17:42:05
Subject says it all. Devices on more than just pciide (like the wdc
built into power macs) can support DMA. This patch moves the pretty-print
routine to wdc.c. Comments?

Take care,

Bill

Index: dev/ic/wdc.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/wdc.c,v
retrieving revision 1.92
diff -u -r1.92 wdc.c
--- dev/ic/wdc.c	2000/06/28 17:13:06	1.92
+++ dev/ic/wdc.c	2000/11/08 01:23:08
@@ -1590,3 +1590,27 @@
 		(void) (*adapter->_generic.scsipi_enable)(wdc, 0);
 	splx(s);
 }
+
+void
+wdc_print_modes(struct channel_softc *chp)
+{
+	int drive;
+	struct ata_drive_datas *drvp;
+
+	for (drive = 0; drive < 2; drive++) {
+		drvp = &chp->ch_drive[drive];
+		if ((drvp->drive_flags & DRIVE) == 0)
+			continue;
+		printf("%s(%s:%d:%d): using PIO mode %d",
+			drvp->drv_softc->dv_xname,
+			chp->wdc->sc_dev.dv_xname,
+			chp->channel, drive, drvp->PIO_mode);
+		if (drvp->drive_flags & DRIVE_DMA)
+			printf(", DMA mode %d", drvp->DMA_mode);
+		if (drvp->drive_flags & DRIVE_UDMA)
+			printf(", Ultra-DMA mode %d", drvp->UDMA_mode);
+		if (drvp->drive_flags & (DRIVE_DMA | DRIVE_UDMA))
+			printf(" (using DMA data transfers)");
+		printf("\n");
+	}
+}
Index: dev/ic/wdcvar.h
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/wdcvar.h,v
retrieving revision 1.25
diff -u -r1.25 wdcvar.h
--- dev/ic/wdcvar.h	2000/06/12 21:10:41	1.25
+++ dev/ic/wdcvar.h	2000/11/08 01:23:08
@@ -194,6 +194,8 @@
 void	wdc_delref __P((struct channel_softc *));
 void	wdc_kill_pending __P((struct channel_softc *));
 
+void	wdc_print_modes (struct channel_softc *);
+
 /*	
  * ST506 spec says that if READY or SEEKCMPLT go off, then the read or write
  * command is aborted.
Index: dev/pci/pciide.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/pci/pciide.c,v
retrieving revision 1.88
diff -u -r1.88 pciide.c
--- dev/pci/pciide.c	2000/10/04 09:34:09	1.88
+++ dev/pci/pciide.c	2000/11/08 01:23:11
@@ -1141,28 +1141,7 @@
 pciide_print_modes(cp)
 	struct pciide_channel *cp;
 {
-	struct pciide_softc *sc = (struct pciide_softc *)cp->wdc_channel.wdc;
-	int drive;
-	struct channel_softc *chp;
-	struct ata_drive_datas *drvp;
-
-	chp = &cp->wdc_channel;
-	for (drive = 0; drive < 2; drive++) {
-		drvp = &chp->ch_drive[drive];
-		if ((drvp->drive_flags & DRIVE) == 0)
-			continue;
-		printf("%s(%s:%d:%d): using PIO mode %d",
-		    drvp->drv_softc->dv_xname,
-		    sc->sc_wdcdev.sc_dev.dv_xname,
-		    chp->channel, drive, drvp->PIO_mode);
-		if (drvp->drive_flags & DRIVE_DMA)
-			printf(", DMA mode %d", drvp->DMA_mode);
-		if (drvp->drive_flags & DRIVE_UDMA)
-			printf(", Ultra-DMA mode %d", drvp->UDMA_mode);
-		if (drvp->drive_flags & (DRIVE_DMA | DRIVE_UDMA))
-			printf(" (using DMA data transfers)");
-		printf("\n");
-	}
+	wdc_print_modes(&cp->wdc_channel);
 }
 
 void
Index: arch/macppc/dev/wdc_obio.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/macppc/dev/wdc_obio.c,v
retrieving revision 1.10
diff -u -r1.10 wdc_obio.c
--- arch/macppc/dev/wdc_obio.c	2000/06/29 08:10:45	1.10
+++ arch/macppc/dev/wdc_obio.c	2000/11/08 01:23:13
@@ -204,6 +204,8 @@
 	/* modify DMA access timings */
 	if (use_dma)
 		adjust_timing(chp);
+
+	wdc_print_modes(chp);
 }
 
 /* Multiword DMA transfer timings */