patch-2.3.10 linux/drivers/block/piix.c

Next file: linux/drivers/block/smart1,2.h
Previous file: linux/drivers/block/pdc202xx.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.9/linux/drivers/block/piix.c linux/drivers/block/piix.c
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/block/piix.c	Version 0.23	May 29, 1999
+ * linux/drivers/block/piix.c	Version 0.24	June 28, 1999
  *
  *  Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer
  *  Copyright (C) 1998-1999 Andre Hedrick, Author and Maintainer
@@ -44,8 +44,15 @@
  * pci_read_config_word(HWIF(drive)->pci_dev, 0x48, &reg48);
  * pci_read_config_word(HWIF(drive)->pci_dev, 0x4a, &reg4a);
  *
+ * #if 0
+ * int err;
+ * err = ide_config_drive_speed(drive, speed);
+ * (void) ide_config_drive_speed(drive, speed);
+ * #else
+ * #endif
  */
 
+#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/ioport.h>
@@ -62,6 +69,7 @@
 
 extern char *ide_xfer_verbose (byte xfer_rate);
 
+#ifdef CONFIG_BLK_DEV_PIIX_TUNING
 /*
  *
  */
@@ -91,6 +99,7 @@
 			return 0;
 	}
 }
+#endif /* CONFIG_BLK_DEV_PIIX_TUNING */
 
 /*
  *  Based on settings done by AMI BIOS
@@ -111,11 +120,7 @@
 				    { 2, 1 },
 				    { 2, 3 }, };
 
-#if 1
 	pio = ide_get_best_pio_mode(drive, pio, 5, NULL);
-#else
-	pio = ide_get_best_pio_mode(drive, pio, 4, NULL);
-#endif
 	pci_read_config_word(HWIF(drive)->pci_dev, master_port, &master_data);
 	if (is_slave) {
 		master_data = master_data | 0x4000;
@@ -142,6 +147,8 @@
 	restore_flags(flags);
 }
 
+#ifdef CONFIG_BLK_DEV_PIIX_TUNING
+
 static int piix_config_drive_for_dma(ide_drive_t *drive, int ultra)
 {
 	struct hd_driveid *id = drive->id;
@@ -246,17 +253,13 @@
 		}
 		speed = XFER_SW_DMA_2;
         } else {
-#if 0
-		speed = XFER_PIO_0;
-#else
 		speed = XFER_PIO_0 + ide_get_best_pio_mode(drive, 255, 5, NULL);
-#endif
 	}
 
 	restore_flags(flags);
 	piix_tune_drive(drive, piix_dma_2_pio(speed));
 
-	(void) ide_wait_cmd(drive, WIN_SETFEATURES, speed, SETFEATURES_XFER, 0, NULL);
+	(void) ide_config_drive_speed(drive, speed);
 
 #if PIIX_DEBUG_DRIVE_INFO
 	printk("%s: %s drive%d ",
@@ -284,11 +287,19 @@
 	/* Other cases are done by generic IDE-DMA code. */
 	return ide_dmaproc(func, drive);
 }
+#endif /* CONFIG_BLK_DEV_PIIX_TUNING */
 
 void ide_init_piix (ide_hwif_t *hwif)
 {
 	hwif->tuneproc = &piix_tune_drive;
+#ifdef CONFIG_BLK_DEV_PIIX_TUNING
 	if (hwif->dma_base) {
 		hwif->dmaproc = &piix_dmaproc;
+	} else
+#endif /* CONFIG_BLK_DEV_PIIX_TUNING */
+	{
+		hwif->drives[0].autotune = 1;
+		hwif->drives[1].autotune = 1;
 	}
+
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)