Skip to contentSkip to conversation

Linux 2.5.21

PATCH New Linus Torvalds 25 participants 99 messages Jun 9, 2002 – Jun 16, 2002 Page 2 of 2

Subsystems (23)
lore
Share & tools
lore
#81 lore raw

PATCH 1/1 2.5.21 IDE 90

In reply to Linus Torvalds

Thu Jun 13 20:29:06 CEST 2002 ide-clean-90

- Implement the assertion that the lock is already held, if we run ata_status_poll.

- The usual host chip code load from Bartomiej onierkiewicz. Fortunately I'm able to check the sis5513 fixes on a life system.

More serious stuff... for IDE 88:

- implement ata_best_pio_mode() in ata-timing.c (play safer than driver's config_chipset_for_pio())

- replace config_chipset_for_pio() by ata_best_pio_mode() in host chips drivers
(trivial for hpt34x.c, hpt366.c and serverworks.c,
non-trivial for cmd64x.c and sis5513.c)

- set PIO also for (U)DMA modes in cmd64x_tune_chipset() (cmd64x.c)

- fix bug in setting PIO0-2 for devices also supporting PIO3/4 (sis5513.c)

- misc cleanups

- Rename XXX_do_request back do do_request. This was just tmporary tagging.

- Move ata_taskfile() call down to the ide-disk request handler.c, which is the only place needing it. Rename ata_taskfile to ata_do_taskfile(). This allowed us to implement the assertion that ata_do_taskfile() will be only called with the channel lock already held.

drivers/ide/alim15x3.c +1 -6
diff -urN linux-2.5.21/drivers/ide/alim15x3.c linux/drivers/ide/alim15x3.c
@@ -176,11 +176,6 @@
 	return ide_config_drive_speed(drive, speed);
 }
 
-static void config_chipset_for_pio(struct ata_device *drive)
-{
-	ali15x3_tune_drive(drive, 5);
-}
-
 #ifdef CONFIG_BLK_DEV_IDEDMA
 static int config_chipset_for_dma(struct ata_device *drive, u8 udma)
 {
@@ -253,7 +248,7 @@
 		on = 0;
 		verbose = 0;
 no_dma_set:
-		config_chipset_for_pio(drive);
+		ali15x3_tune_drive(drive, 255);
 	}
 
 	udma_enable(drive, on, verbose);
drivers/ide/ata-timing.c +22 -0
diff -urN linux-2.5.21/drivers/ide/ata-timing.c linux/drivers/ide/ata-timing.c
@@ -270,3 +270,25 @@
 
 	return 0;
 }
+
+u8 ata_best_pio_mode(struct ata_device *drive)
+{
+	static u16 eide_pio_timing[6] = { 600, 383, 240, 180, 120, 90 };
+	u16 pio_min;
+	u8 pio;
+
+	pio = ata_timing_mode(drive, XFER_PIO | XFER_EPIO) - XFER_PIO_0;
+
+	/* downgrade mode if necessary */
+	pio_min = (pio > 2) ? drive->id->eide_pio_iordy : drive->id->eide_pio;
+
+	if (pio_min)
+		while (pio && pio_min > eide_pio_timing[pio])
+			pio--;
+
+	if (!pio && drive->id->tPIO)
+		return XFER_PIO_SLOW;
+
+	/* don't allow XFER_PIO_5 for now */
+	return XFER_PIO_0 + min_t(u8, pio, 4);
+}
drivers/ide/ata-timing.h +1 -0
diff -urN linux-2.5.21/drivers/ide/ata-timing.h linux/drivers/ide/ata-timing.h
@@ -83,5 +83,6 @@
 extern struct ata_timing* ata_timing_data(short speed);
 extern int ata_timing_compute(struct ata_device *drive,
 		short speed, struct ata_timing *t, int T, int UT);
+extern u8 ata_best_pio_mode(struct ata_device *drive);
 
 #endif
drivers/ide/cmd64x.c +41 -65

193 lines not on this page · raw message

drivers/ide/device.c +2 -2
diff -urN linux-2.5.21/drivers/ide/device.c linux/drivers/ide/device.c
@@ -126,9 +126,8 @@
  * setting a timer to wake up at half second intervals thereafter, until
  * timeout is achieved, before timing out.
  *
- * FIXME: Channel lock should be held.
+ * Channel lock should be held.
  */
-
 int ata_status_poll(struct ata_device *drive, u8 good, u8 bad,
 		unsigned long timeout,
 		struct request *rq, ide_startstop_t *startstop)
@@ -159,6 +158,7 @@
 		if (ata_status(drive, good, bad))
 			return 0;
 	}
+
 	*startstop = ata_error(drive, rq, "status error");
 
 	return 1;
drivers/ide/hpt34x.c +1 -38
diff -urN linux-2.5.21/drivers/ide/hpt34x.c linux/drivers/ide/hpt34x.c
@@ -67,43 +67,6 @@
 	return ide_config_drive_speed(drive, speed);
 }
 
-static void config_chipset_for_pio(struct ata_device *drive)
-{
-	unsigned short eide_pio_timing[6] = {960, 480, 240, 180, 120, 90};
-	unsigned short xfer_pio = drive->id->eide_pio_modes;
-
-	u8 timing, speed, pio;
-
-	pio = ata_timing_mode(drive, XFER_PIO | XFER_EPIO) - XFER_PIO_0;
-
-	if (xfer_pio > 4)
-		xfer_pio = 0;
-
-	if (drive->id->eide_pio_iordy > 0) {
-		for (xfer_pio = 5;
-			xfer_pio>0 &&
-			drive->id->eide_pio_iordy>eide_pio_timing[xfer_pio];
-			xfer_pio--);
-	} else {
-		xfer_pio = (drive->id->eide_pio_modes & 4) ? 0x05 :
-			   (drive->id->eide_pio_modes & 2) ? 0x04 :
-			   (drive->id->eide_pio_modes & 1) ? 0x03 : xfer_pio;
-	}
-
-	timing = (xfer_pio >= pio) ? xfer_pio : pio;
-
-	switch(timing) {
-		case 4: speed = XFER_PIO_4;break;
-		case 3: speed = XFER_PIO_3;break;
-		case 2: speed = XFER_PIO_2;break;
-		case 1: speed = XFER_PIO_1;break;
-		default:
-			speed = (!drive->id->tPIO) ? XFER_PIO_0 : XFER_PIO_SLOW;
-			break;
-		}
-	(void) hpt34x_tune_chipset(drive, speed);
-}
-
 static void hpt34x_tune_drive(struct ata_device *drive, u8 pio)
 {
 	(void) hpt34x_tune_chipset(drive, XFER_PIO_0 + min_t(u8, pio, 4));
@@ -177,7 +140,7 @@
 		on = 0;
 		verbose = 0;
 no_dma_set:
-		config_chipset_for_pio(drive);
+		hpt34x_tune_chipset(drive, ata_best_pio_mode(drive));
 	}
 
 #ifndef CONFIG_HPT34X_AUTODMA
drivers/ide/hpt366.c +1 -40

53 lines not on this page · raw message

drivers/ide/ide.c +3 -19
diff -urN linux-2.5.21/drivers/ide/ide.c linux/drivers/ide/ide.c
@@ -671,28 +671,12 @@
 		block = 1;  /* redirect MBR access to EZ-Drive partn table */
 
 	ata_select(drive, 0);
-	spin_unlock_irq(ch->lock);
 	if (ata_status_poll(drive, drive->ready_stat, BUSY_STAT | DRQ_STAT,
 				WAIT_READY, rq, &ret)) {
 		printk(KERN_WARNING "%s: drive not ready for command\n", drive->name);
-		spin_lock_irq(ch->lock);
 
-		return ret;
+		goto kill_rq;
 	}
-	spin_lock_irq(ch->lock);
-
-	/* This issues a special drive command.
-	 *
-	 * FIXME: move this down to idedisk_do_request().
-	 */
-	if (rq->flags & REQ_SPECIAL)
-		if (drive->type == ATA_DISK) {
-			spin_unlock_irq(ch->lock);
-			ret = ata_taskfile(drive, rq->special, NULL);
-			spin_lock_irq(ch->lock);
-
-			return ret;
-		}
 
 	if (!ata_ops(drive)) {
 		printk(KERN_WARNING "%s: device type %d not supported\n",
@@ -704,8 +688,8 @@
 	 * handler down to the device type driver.
 	 */
 
-	if (ata_ops(drive)->XXX_do_request) {
-		ret = ata_ops(drive)->XXX_do_request(drive, rq, block);
+	if (ata_ops(drive)->do_request) {
+		ret = ata_ops(drive)->do_request(drive, rq, block);
 	} else {
 		__ata_end_request(drive, rq, 0, 0);
 		ret = ide_stopped;
drivers/ide/ide-cd.c +51 -41

146 lines not on this page · raw message

drivers/ide/ide-disk.c +10 -7
diff -urN linux-2.5.21/drivers/ide/ide-disk.c linux/drivers/ide/ide-disk.c
@@ -456,7 +456,7 @@
 
 	rq->special = &args;
 
-	return ata_taskfile(drive, &args, rq);
+	return ata_do_taskfile(drive, &args, rq);
 }
 
 static ide_startstop_t lba28_do_request(struct ata_device *drive, struct request *rq, sector_t block)
@@ -496,7 +496,7 @@
 
 	rq->special = &args;
 
-	return ata_taskfile(drive, &args, rq);
+	return ata_do_taskfile(drive, &args, rq);
 }
 
 /*
@@ -548,7 +548,7 @@
 
 	rq->special = &args;
 
-	return ata_taskfile(drive, &args, rq);
+	return ata_do_taskfile(drive, &args, rq);
 }
 
 /*
@@ -560,14 +560,16 @@
  */
 static ide_startstop_t idedisk_do_request(struct ata_device *drive, struct request *rq, sector_t block)
 {
-	unsigned long flags;
-	struct ata_channel *ch = drive->channel;
-	int ret;
+	/* This issues a special drive command.
+	 */
+	if (rq->flags & REQ_SPECIAL)
+		return ata_do_taskfile(drive, rq->special, rq);
 
 	/* FIXME: this check doesn't make sense */
 	if (!(rq->flags & REQ_CMD)) {
 		blk_dump_rq_flags(rq, "idedisk_do_request - bad command");
 		__ata_end_request(drive, rq, 0, 0);
+
 		return ide_stopped;
 	}
 
@@ -590,6 +592,7 @@
 
 		if (st) {
 			BUG_ON(!ata_pending_commands(drive));
+
 			return ide_started;
 		}
 	}
@@ -1405,7 +1408,7 @@
 	attach:			idedisk_attach,
 	cleanup:		idedisk_cleanup,
 	standby:		idedisk_standby,
-	XXX_do_request:		idedisk_do_request,
+	do_request:		idedisk_do_request,
 	end_request:		NULL,
 	ioctl:			idedisk_ioctl,
 	open:			idedisk_open,
drivers/ide/ide-floppy.c +15 -17
diff -urN linux-2.5.21/drivers/ide/ide-floppy.c linux/drivers/ide/ide-floppy.c
@@ -958,27 +958,25 @@
 	idefloppy_ireason_reg_t ireason;
 	int ret;
 
+	/* FIXME: Move this lock upwards.
+	 */
+	spin_lock_irqsave(ch->lock, flags);
 	if (ata_status_poll(drive, DRQ_STAT, BUSY_STAT,
 				WAIT_READY, rq, &startstop)) {
 		printk (KERN_ERR "ide-floppy: Strange, packet command initiated yet DRQ isn't asserted\n");
 
-		return startstop;
-	}
-
-	/* FIXME: this locking should encompass the above register
-	 * file access too.
-	 */
-
-	spin_lock_irqsave(ch->lock, flags);
-	ireason.all=IN_BYTE (IDE_IREASON_REG);
-
-	if (!ireason.b.cod || ireason.b.io) {
-		printk (KERN_ERR "ide-floppy: (IO,CoD) != (0,1) while issuing a packet command\n");
-		ret = ide_stopped;
+		ret = startstop;
 	} else {
-		ata_set_handler (drive, idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL);	/* Set the interrupt routine */
-		atapi_write(drive, floppy->pc->c, 12); /* Send the actual packet */
-		ret = ide_started;
+		ireason.all=IN_BYTE (IDE_IREASON_REG);
+
+		if (!ireason.b.cod || ireason.b.io) {
+			printk (KERN_ERR "ide-floppy: (IO,CoD) != (0,1) while issuing a packet command\n");
+			ret = ide_stopped;
+		} else {
+			ata_set_handler (drive, idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL);	/* Set the interrupt routine */
+			atapi_write(drive, floppy->pc->c, 12); /* Send the actual packet */
+			ret = ide_started;
+		}
 	}
 	spin_unlock_irqrestore(ch->lock, flags);
 
@@ -2047,7 +2045,7 @@
 	attach:			idefloppy_attach,
 	cleanup:		idefloppy_cleanup,
 	standby:		NULL,
-	XXX_do_request:		idefloppy_do_request,
+	do_request:		idefloppy_do_request,
 	end_request:		idefloppy_end_request,
 	ioctl:			idefloppy_ioctl,
 	open:			idefloppy_open,
drivers/ide/ide-tape.c +33 -34

113 lines not on this page · raw message

drivers/ide/ide-taskfile.c +12 -11
diff -urN linux-2.5.21/drivers/ide/ide-taskfile.c linux/drivers/ide/ide-taskfile.c
@@ -177,9 +177,9 @@
 }
 
 /*
- * FIXME: Channel lock should be held on entry.
+ * Channel lock should be held on entry.
  */
-ide_startstop_t ata_taskfile(struct ata_device *drive,
+ide_startstop_t ata_do_taskfile(struct ata_device *drive,
 		struct ata_taskfile *ar, struct request *rq)
 {
 	struct hd_driveid *id = drive->id;
@@ -196,27 +196,21 @@
 	if ((id->command_set_2 & 0x0400) && (id->cfs_enable_2 & 0x0400) &&
 	    (drive->addressing == 1))
 		ata_out_regfile(drive, &ar->hobfile);
+
 	ata_out_regfile(drive, &ar->taskfile);
 
 	OUT_BYTE((ar->taskfile.device_head & (drive->addressing ? 0xE0 : 0xEF)) | drive->select.all,
 			IDE_SELECT_REG);
 
 	if (ar->handler) {
-		unsigned long flags;
 		struct ata_channel *ch = drive->channel;
 
 		/* This is apparently supposed to reset the wait timeout for
 		 * the interrupt to accur.
 		 */
 
-		/* FIXME: this locking should encompass the above register
-		 * file access too.
-		 */
-
-		spin_lock_irqsave(ch->lock, flags);
 		ata_set_handler(drive, ar->handler, WAIT_CMD, NULL);
 		OUT_BYTE(ar->cmd, IDE_COMMAND_REG);
-		spin_unlock_irqrestore(ch->lock, flags);
 
 		/* FIXME: Warning check for race between handler and prehandler
 		 * for writing first block of data.  however since we are well
@@ -240,6 +234,7 @@
 						WAIT_DRQ, rq, &startstop)) {
 				printk(KERN_ERR "%s: no DRQ after issuing %s\n",
 						drive->name, drive->mult_count ? "MULTWRITE" : "WRITE");
+
 				return startstop;
 			}
 
@@ -261,6 +256,7 @@
 				return ide_started;
 			} else {
 				int i;
+				int ret;
 
 				/* Polling wait until the drive is ready.
 				 *
@@ -278,7 +274,12 @@
 				if (!drive_is_ready(drive)) {
 					printk(KERN_ERR "DISASTER WAITING TO HAPPEN!\n");
 				}
-				return ar->handler(drive, rq);
+				/* FIXME: make this unlocking go away*/
+				spin_unlock_irq(ch->lock);
+				ret =  ar->handler(drive, rq);
+				spin_lock_irq(ch->lock);
+
+				return ret;
 			}
 		}
 	} else {
@@ -448,6 +449,6 @@
 EXPORT_SYMBOL(ide_do_drive_cmd);
 EXPORT_SYMBOL(ata_read);
 EXPORT_SYMBOL(ata_write);
-EXPORT_SYMBOL(ata_taskfile);
+EXPORT_SYMBOL(ata_do_taskfile);
 EXPORT_SYMBOL(ata_special_intr);
 EXPORT_SYMBOL(ide_raw_taskfile);
drivers/ide/pdc202xx.c +5 -5
diff -urN linux-2.5.21/drivers/ide/pdc202xx.c linux/drivers/ide/pdc202xx.c
@@ -364,12 +364,12 @@
  * 180, 120,  90,  90,  90,  60,  30
  *  11,   5,   4,   3,   2,   1,   0
  */
-static void config_chipset_for_pio(struct ata_device *drive, byte pio)
+static void pdc202xx_tune_drive(struct ata_device *drive, u8 pio)
 {
-	byte speed;
+	u8 speed;
 
 	if (pio == 255)
-		speed = ata_timing_mode(drive, XFER_PIO | XFER_EPIO);
+		speed = ata_best_pio_mode(drive);
 	else	speed = XFER_PIO_0 + min_t(byte, pio, 4);
 
 	pdc202xx_tune_chipset(drive, speed);
@@ -543,7 +543,7 @@
 		} else goto no_dma_set;
 	} else if ((id->capability & 8) || (id->field_valid & 2)) {
 no_dma_set:
-		config_chipset_for_pio(drive, 5);
+		pdc202xx_tune_drive(drive, 255);
 	}
 
 	udma_enable(drive, on, verbose);
@@ -723,7 +723,7 @@
 
 static void __init ide_init_pdc202xx(struct ata_channel *hwif)
 {
-	hwif->tuneproc  = &config_chipset_for_pio;
+	hwif->tuneproc  = &pdc202xx_tune_drive;
 	hwif->quirkproc = &check_in_drive_lists;
 
         switch(hwif->pci_dev->device) {
drivers/ide/pdc4030.c +27 -7
diff -urN linux-2.5.21/drivers/ide/pdc4030.c linux/drivers/ide/pdc4030.c
@@ -247,12 +247,19 @@
 	if (pdc4030_cmd(drive, PROMISE_GET_CONFIG)) {
 		return 0;
 	}
+
+	/* FIXME: Make this go away. */
+	spin_lock_irq(hwif->lock);
 	if (ata_status_poll(drive, DATA_READY, BAD_W_STAT,
 				WAIT_DRQ, NULL, &startstop)) {
 		printk(KERN_INFO
 			"%s: Failed Promise read config!\n",hwif->name);
+		spin_unlock_irq(hwif->lock);
+
 		return 0;
 	}
+	spin_unlock_irq(hwif->lock);
+
 	promise_read(drive, &ident, SECTOR_WORDS);
 	if (ident.id[1] != 'P' || ident.id[0] != 'T') {
 		return 0;
@@ -720,21 +727,34 @@
 
 	case WRITE: {
 		ide_startstop_t startstop;
-/*
- * Strategy on write is:
- *	look for the DRQ that should have been immediately asserted
- *	copy the request into the hwgroup's scratchpad
- *	call the promise_write function to deal with writing the data out
- * NOTE: No interrupts are generated on writes. Write completion must be polled
- */
+		unsigned long flags;
+		struct ata_channel *ch = drive->channel;
+
+		/*
+		 * Strategy on write is: look for the DRQ that should have been
+		 * immediately asserted copy the request into the hwgroup's
+		 * scratchpad call the promise_write function to deal with
+		 * writing the data out.
+		 *
+		 * NOTE: No interrupts are generated on writes. Write
+		 * completion must be polled
+		 */
+
+		/* FIXME: Move this lock upwards.
+		 */
+		spin_lock_irqsave(ch->lock, flags);
 		if (ata_status_poll(drive, DATA_READY, drive->bad_wstat,
 					WAIT_DRQ, rq, &startstop )) {
 			printk(KERN_ERR "%s: no DRQ after issuing "
 			       "PROMISE_WRITE\n", drive->name);
+			spin_unlock_irqrestore(ch->lock, flags);
+
 			return startstop;
 		}
 		if (!drive->channel->unmask)
 			__cli();	/* local CPU only */
+		spin_unlock_irqrestore(ch->lock, flags);
+
 		return promise_do_write(drive, rq);
 	}
 
drivers/ide/serverworks.c +1 -39
diff -urN linux-2.5.21/drivers/ide/serverworks.c linux/drivers/ide/serverworks.c
@@ -226,44 +226,6 @@
 	return ide_config_drive_speed(drive, speed);
 }
 
-static void config_chipset_for_pio(struct ata_device *drive)
-{
-	unsigned short eide_pio_timing[6] = {960, 480, 240, 180, 120, 90};
-	unsigned short xfer_pio = drive->id->eide_pio_modes;
-	byte timing, speed, pio;
-
-	pio = ata_timing_mode(drive, XFER_PIO | XFER_EPIO) - XFER_PIO_0;
-
-	if (xfer_pio > 4)
-		xfer_pio = 0;
-
-	if (drive->id->eide_pio_iordy > 0)
-		for (xfer_pio = 5;
-			xfer_pio>0 &&
-			drive->id->eide_pio_iordy>eide_pio_timing[xfer_pio];
-			xfer_pio--);
-	else
-		xfer_pio = (drive->id->eide_pio_modes & 4) ? 0x05 :
-			   (drive->id->eide_pio_modes & 2) ? 0x04 :
-			   (drive->id->eide_pio_modes & 1) ? 0x03 :
-			   (drive->id->tPIO & 2) ? 0x02 :
-			   (drive->id->tPIO & 1) ? 0x01 : xfer_pio;
-
-	timing = (xfer_pio >= pio) ? xfer_pio : pio;
-
-	switch(timing) {
-		case 4: speed = XFER_PIO_4;break;
-		case 3: speed = XFER_PIO_3;break;
-		case 2: speed = XFER_PIO_2;break;
-		case 1: speed = XFER_PIO_1;break;
-		default:
-			speed = (!drive->id->tPIO) ? XFER_PIO_0 : XFER_PIO_SLOW;
-			break;
-	}
-	(void) svwks_tune_chipset(drive, speed);
-	drive->current_speed = speed;
-}
-
 static void svwks_tune_drive(struct ata_device *drive, byte pio)
 {
 	byte speed;
@@ -337,7 +299,7 @@
 		on = 0;
 		verbose = 0;
 no_dma_set:
-		config_chipset_for_pio(drive);
+		svwks_tune_chipset(drive, ata_best_pio_mode(drive));
 	}
 
 	udma_enable(drive, on, verbose);
drivers/ide/sis5513.c +20 -53

136 lines not on this page · raw message

drivers/scsi/ide-scsi.c +15 -16
diff -urN linux-2.5.21/drivers/scsi/ide-scsi.c linux/drivers/scsi/ide-scsi.c
@@ -403,25 +403,24 @@
 	ide_startstop_t startstop;
 	int ret;
 
+	/* FIXME: Move this lock upwards.
+	 */
+	spin_lock_irqsave(ch->lock, flags);
 	if (ata_status_poll(drive, DRQ_STAT, BUSY_STAT,
 				WAIT_READY, rq, &startstop)) {
 		printk (KERN_ERR "ide-scsi: Strange, packet command initiated yet DRQ isn't asserted\n");
-		return startstop;
-	}
-
-	/* FIXME: this locking should encompass the above register
-	 * file access too.
-	 */
-	spin_lock_irqsave(ch->lock, flags);
-	ireason = IN_BYTE(IDE_IREASON_REG);
-
-	if ((ireason & (IDESCSI_IREASON_IO | IDESCSI_IREASON_COD)) != IDESCSI_IREASON_COD) {
-		printk (KERN_ERR "ide-scsi: (IO,CoD) != (0,1) while issuing a packet command\n");
-		ret = ide_stopped;
+		ret = startstop;
 	} else {
-		ata_set_handler(drive, idescsi_pc_intr, get_timeout(pc), NULL);
-		atapi_write(drive, scsi->pc->c, 12);
-		ret = ide_started;
+		ireason = IN_BYTE(IDE_IREASON_REG);
+
+		if ((ireason & (IDESCSI_IREASON_IO | IDESCSI_IREASON_COD)) != IDESCSI_IREASON_COD) {
+			printk (KERN_ERR "ide-scsi: (IO,CoD) != (0,1) while issuing a packet command\n");
+			ret = ide_stopped;
+		} else {
+			ata_set_handler(drive, idescsi_pc_intr, get_timeout(pc), NULL);
+			atapi_write(drive, scsi->pc->c, 12);
+			ret = ide_started;
+		}
 	}
 	spin_unlock_irqrestore(ch->lock, flags);
 
@@ -549,7 +548,7 @@
 	owner:			THIS_MODULE,
 	attach:			idescsi_attach,
 	cleanup:		idescsi_cleanup,
-	XXX_do_request:		idescsi_do_request,
+	do_request:		idescsi_do_request,
 	end_request:		idescsi_end_request,
 	open:			idescsi_open,
 	release:		idescsi_release,
include/linux/ide.h +2 -2
diff -urN linux-2.5.21/include/linux/ide.h linux/include/linux/ide.h
@@ -545,7 +545,7 @@
 	void (*attach) (struct ata_device *);
 	int (*cleanup)(struct ata_device *);
 	int (*standby)(struct ata_device *);
-	ide_startstop_t	(*XXX_do_request)(struct ata_device *, struct request *, sector_t);
+	ide_startstop_t	(*do_request)(struct ata_device *, struct request *, sector_t);
 	int (*end_request)(struct ata_device *, struct request *, int);
 
 	int (*ioctl)(struct ata_device *, struct inode *, struct file *, unsigned int, unsigned long);
@@ -657,7 +657,7 @@
 extern void ata_read(struct ata_device *, void *, unsigned int);
 extern void ata_write(struct ata_device *, void *, unsigned int);
 
-extern ide_startstop_t ata_taskfile(struct ata_device *,
+extern ide_startstop_t ata_do_taskfile(struct ata_device *,
 	struct ata_taskfile *, struct request *);
 
 /*
#82 lore raw

PATCH 1/1 2.5.21 IDE 91

In reply to Linus Torvalds

Thu Jun 13 22:59:54 CEST 2002 ide-clean-91

- Realize that the only place where ata_do_taskfile gets used is ide-disk.c move it and its "friends' over there.

- Unify the do_request method for disk devices. This saves quite a lot of code.

- Make task_muin_intr and task_in_intr use the same busy status checks on entry.

- Unfold get_command at the single only place where it's used.

- Add missing __ata_end_request on kill_rq path.

- Rename udma_tcq_taskfile() to udma_tcq_init to make the code look like to normal udma_init. Revert the logics of udma_init and it's implementations to mirror that of udma_tcq_init().

- Fix a tinny bug in pmac_udma_init() where it was reporting the wrong value up on failure.

- Revert the logics of udma_start(). It's called from udma_init context. Realize that it is always returning ide_started. Make it self and the implementations of it return void.

drivers/ide/alim15x3.c +1 -1
diff -urN linux-2.5.21/drivers/ide/alim15x3.c linux/drivers/ide/alim15x3.c
@@ -259,7 +259,7 @@
 static int ali15x3_udma_init(struct ata_device *drive, struct request *rq)
 {
 	if ((m5229_revision < 0xC2) && (drive->type != ATA_DISK))
-		return 1;	/* try PIO instead of DMA */
+		return ide_stopped;	/* try PIO instead of DMA */
 
 	return udma_pci_init(drive, rq);
 }
drivers/ide/hpt34x.c +2 -2
diff -urN linux-2.5.21/drivers/ide/hpt34x.c linux/drivers/ide/hpt34x.c
@@ -175,7 +175,7 @@
 	u8 cmd;
 
 	if (!(count = udma_new_table(drive, rq)))
-		return 1;	/* try PIO instead of DMA */
+		return ide_stopped;	/* try PIO instead of DMA */
 
 	if (rq_data_dir(rq) == READ)
 		cmd = 0x09;
@@ -192,7 +192,7 @@
 		OUT_BYTE((cmd == 0x09) ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG);
 	}
 
-	return 0;
+	return ide_started;
 }
 #endif
 
drivers/ide/hpt366.c +1 -3
diff -urN linux-2.5.21/drivers/ide/hpt366.c linux/drivers/ide/hpt366.c
@@ -858,7 +858,7 @@
 	udelay(10);
 }
 
-static int hpt370_udma_start(struct ata_device *drive, struct request *__rq)
+static void hpt370_udma_start(struct ata_device *drive, struct request *__rq)
 {
 	struct ata_channel *ch = drive->channel;
 
@@ -870,8 +870,6 @@
 	 */
 
 	outb(inb(ch->dma_base) | 1, ch->dma_base);	/* start DMA */
-
-	return 0;
 }
 
 static void do_timeout_irq(struct ata_device *drive)
drivers/ide/icside.c +5 -10
diff -urN linux-2.5.21/drivers/ide/icside.c linux/drivers/ide/icside.c
@@ -447,18 +447,13 @@
 	return get_dma_residue(ch->hw.dma) != 0;
 }
 
-static int icside_dma_start(struct ata_device *drive, struct request *rq)
+static void icside_dma_start(struct ata_device *drive, struct request *rq)
 {
 	struct ata_channel *ch = drive->channel;
 
-	/*
-	 * We can not enable DMA on both channels.
-	 */
+	/* We can not enable DMA on both channels simultaneously. */
 	BUG_ON(dma_channel_active(ch->hw.dma));
-
 	enable_dma(ch->hw.dma);
-
-	return 0;
 }
 
 /*
@@ -524,10 +519,10 @@
 	u8 int cmd;
 
 	if (icside_dma_common(drive, rq, DMA_MODE_WRITE))
-		return 1;
+		return ide_stopped;
 
 	if (drive->type != ATA_DISK)
-		return 0;
+		return ide_started;
 
 	ata_set_handler(drive, icside_dmaintr, WAIT_CMD, NULL);
 
@@ -543,7 +538,7 @@
 
 	enable_dma(ch->hw.dma);
 
-	return 0;
+	return ide_started;
 }
 
 static int icside_irq_status(struct ata_device *drive)
drivers/ide/ide.c +2 -1
diff -urN linux-2.5.21/drivers/ide/ide.c linux/drivers/ide/ide.c
@@ -702,7 +702,8 @@
 			spin_unlock_irq(ch->lock);
 			ata_ops(drive)->end_request(drive, rq, 0);
 			spin_lock_irq(ch->lock);
-		}
+		} else
+			__ata_end_request(drive, rq, 0, 0);
 	} else
 		__ata_end_request(drive, rq, 0, 0);
 
drivers/ide/ide-cd.c +1 -1
diff -urN linux-2.5.21/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
@@ -741,7 +741,7 @@
 	else {
 		if (info->dma) {
 			if (info->cmd == READ || info->cmd == WRITE)
-				info->dma = !udma_init(drive, rq);
+				info->dma = udma_init(drive, rq);
 			else
 				printk("ide-cd: DMA set, but not allowed\n");
 		}
drivers/ide/ide-disk.c +293 -225

593 lines not on this page · raw message

drivers/ide/ide-floppy.c +1 -1
diff -urN linux-2.5.21/drivers/ide/ide-floppy.c linux/drivers/ide/ide-floppy.c
@@ -1102,7 +1102,7 @@
 		udma_enable(drive, 0, 1);
 
 	if (test_bit (PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma)
-		dma_ok = !udma_init(drive, rq);
+		dma_ok = udma_init(drive, rq);
 #endif
 
 	ata_irq_enable(drive, 1);
drivers/ide/ide-pmac.c +10 -6
diff -urN linux-2.5.21/drivers/ide/ide-pmac.c linux/drivers/ide/ide-pmac.c
@@ -1365,7 +1365,8 @@
 	 */
 	ix = pmac_ide_find(drive);
 	if (ix < 0)
-		return 0;
+		return ide_started;
+
 	dma = pmac_ide[ix].dma_regs;
 	ata4 = (pmac_ide[ix].kind == controller_kl_ata4 ||
 		pmac_ide[ix].kind == controller_kl_ata4_80);
@@ -1373,7 +1374,8 @@
 	out_le32(&dma->control, (RUN << 16) | RUN);
 	/* Make sure it gets to the controller right now */
 	(void)in_le32(&dma->control);
-	return 0;
+
+	return ide_started;
 }
 
 static int pmac_udma_stop(struct ata_device *drive)
@@ -1411,7 +1413,7 @@
 	 */
 	ix = pmac_ide_find(drive);
 	if (ix < 0)
-		return 0;
+		return ide_stopped;
 
 	if (rq_data_dir(rq) == READ)
 		reading = 1;
@@ -1423,7 +1425,7 @@
 		pmac_ide[ix].kind == controller_kl_ata4_80);
 
 	if (!pmac_ide_build_dmatable(drive, rq, ix, !reading))
-		return 1;
+		return ide_stopped;
 	/* Apple adds 60ns to wrDataSetup on reads */
 	if (ata4 && (pmac_ide[ix].timings[unit] & TR_66_UDMA_EN)) {
 		out_le32((unsigned *)(IDE_DATA_REG + IDE_TIMING_CONFIG + _IO_BASE),
@@ -1433,7 +1435,7 @@
 	}
 	drive->waiting_for_dma = 1;
 	if (drive->type != ATA_DISK)
-		return 0;
+		return ide_started;
 
 	ata_set_handler(drive, ide_dma_intr, WAIT_CMD, NULL);
 	if ((rq->flags & REQ_SPECIAL) &&
@@ -1447,7 +1449,9 @@
 		OUT_BYTE(reading ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG);
 	}
 
-	return udma_start(drive, rq);
+	udma_start(drive, rq);
+
+	return ide_started;
 }
 
 /*
drivers/ide/ide-tape.c +1 -1
diff -urN linux-2.5.21/drivers/ide/ide-tape.c linux/drivers/ide/ide-tape.c
@@ -2290,7 +2290,7 @@
 		udma_enable(drive, 0, 1);
 	}
 	if (test_bit (PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma)
-		dma_ok = !udma_init(drive, rq);
+		dma_ok = udma_init(drive, rq);
 #endif
 
 	ata_irq_enable(drive, 1);
drivers/ide/ide-taskfile.c +1 -141

159 lines not on this page · raw message

drivers/ide/ioctl.c +6 -5
diff -urN linux-2.5.21/drivers/ide/ioctl.c linux/drivers/ide/ioctl.c
@@ -54,9 +54,6 @@
 	if (copy_from_user(vals, (void *)arg, 4))
 		return -EFAULT;
 
-	memset(&req, 0, sizeof(req));
-	req.flags = REQ_SPECIAL;
-
 	memset(&args, 0, sizeof(args));
 
 	args.taskfile.feature = vals[2];
@@ -83,10 +80,14 @@
 
 	/* Issue ATA command and wait for completion.
 	 */
-	args.handler = ata_special_intr;
+	args.command_type = IDE_DRIVE_TASK_NO_DATA;
+	args.XXX_handler = ata_special_intr;
 
-	req.buffer = argbuf + 4;
+	memset(&req, 0, sizeof(req));
+	req.flags = REQ_SPECIAL;
 	req.special = &args;
+
+	req.buffer = argbuf + 4;
 	err = ide_do_drive_cmd(drive, &req, ide_wait);
 
 	argbuf[0] = drive->status;
drivers/ide/ns87415.c +3 -3
diff -urN linux-2.5.21/drivers/ide/ns87415.c linux/drivers/ide/ns87415.c
@@ -105,12 +105,12 @@
 {
 	ns87415_prepare_drive(drive, 1);	/* select DMA xfer */
 
-	if (!udma_pci_init(drive, rq))		/* use standard DMA stuff */
-		return 0;
+	if (udma_pci_init(drive, rq))		/* use standard DMA stuff */
+		return ide_started;
 
 	ns87415_prepare_drive(drive, 0);	/* DMA failed: select PIO xfer */
 
-	return 1;
+	return ide_stopped;
 }
 
 static int ns87415_udma_setup(struct ata_device *drive)
drivers/ide/pcidma.c +9 -9
diff -urN linux-2.5.21/drivers/ide/pcidma.c linux/drivers/ide/pcidma.c
@@ -420,13 +420,11 @@
 	struct ata_channel *ch = drive->channel;
 	unsigned long dma_base = ch->dma_base;
 
-	/* Note that this is done *after* the cmd has
-	 * been issued to the drive, as per the BM-IDE spec.
-	 * The Promise Ultra33 doesn't work correctly when
-	 * we do this part before issuing the drive cmd.
+	/* Note that this is done *after* the cmd has been issued to the drive,
+	 * as per the BM-IDE spec.  The Promise Ultra33 doesn't work correctly
+	 * when we do this part before issuing the drive cmd.
 	 */
-	outb(inb(dma_base)|1, dma_base);		/* start DMA */
-	return 0;
+	outb(inb(dma_base) | 1, dma_base);	/* start DMA */
 }
 
 /*
@@ -545,11 +543,11 @@
 	u8 cmd;
 
 	if (ata_start_dma(drive, rq))
-		return 1;
+		return ide_stopped;
 
 	/* No DMA transfers on ATAPI devices. */
 	if (drive->type != ATA_DISK)
-		return 0;
+		return ide_started;
 
 	if (rq_data_dir(rq) == READ)
 		cmd = 0x08;
@@ -562,7 +560,9 @@
 	else
 		outb(cmd ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG);
 
-	return udma_start(drive, rq);
+	udma_start(drive, rq);
+
+	return ide_started;
 }
 
 EXPORT_SYMBOL(ide_dma_intr);
drivers/ide/pdc202xx.c +0 -2
diff -urN linux-2.5.21/drivers/ide/pdc202xx.c linux/drivers/ide/pdc202xx.c
@@ -573,8 +573,6 @@
 	 */
 
 	outb(inb(ch->dma_base) | 1, ch->dma_base); /* start DMA */
-
-	return 0;
 }
 
 int pdc202xx_udma_stop(struct ata_device *drive)
drivers/ide/pdc4030.c +1 -1
diff -urN linux-2.5.21/drivers/ide/pdc4030.c linux/drivers/ide/pdc4030.c
@@ -784,7 +784,7 @@
 	args.taskfile.high_cylinder	= (block>>=8);
 	args.taskfile.device_head	= ((block>>8)&0x0f)|drive->select.all;
 	args.cmd = (rq_data_dir(rq) == READ) ? PROMISE_READ : PROMISE_WRITE;
-	args.handler	= NULL;
+	args.XXX_handler	= NULL;
 	rq->special	= &args;
 
 	return do_pdc4030_io(drive, &args, rq);
drivers/ide/sl82c105.c +1 -0
diff -urN linux-2.5.21/drivers/ide/sl82c105.c linux/drivers/ide/sl82c105.c
@@ -209,6 +209,7 @@
 static int sl82c105_dma_init(struct ata_device *drive, struct request *rq)
 {
 	sl82c105_reset_host(drive->channel->pci_dev);
+
 	return udma_pci_init(drive, rq);
 }
 
drivers/ide/tcq.c +10 -11
diff -urN linux-2.5.21/drivers/ide/tcq.c linux/drivers/ide/tcq.c
@@ -84,7 +84,7 @@
 {
 	struct ata_channel *ch = drive->channel;
 	request_queue_t *q = &drive->queue;
-	struct ata_taskfile *args;
+	struct ata_taskfile *ar;
 	struct request *rq;
 	unsigned long flags;
 
@@ -110,8 +110,8 @@
 	 * executed before any new commands are started. issue a NOP
 	 * to clear internal queue on drive.
 	 */
-	args = kmalloc(sizeof(*args), GFP_ATOMIC);
-	if (!args) {
+	ar = kmalloc(sizeof(*ar), GFP_ATOMIC);
+	if (!ar) {
 		printk(KERN_ERR "ATA: %s: failed to issue NOP\n", drive->name);
 		goto out;
 	}
@@ -126,10 +126,10 @@
 	 */
 	BUG_ON(!rq);
 
-	rq->special = args;
-	args->cmd = WIN_NOP;
-	args->handler = tcq_nop_handler;
-	args->command_type = IDE_DRIVE_TASK_NO_DATA;
+	rq->special = ar;
+	ar->cmd = WIN_NOP;
+	ar->XXX_handler = tcq_nop_handler;
+	ar->command_type = IDE_DRIVE_TASK_NO_DATA;
 
 	rq->rq_dev = mk_kdev(drive->channel->major, (drive->select.b.unit)<<PARTN_BITS);
 	_elv_add_request(q, rq, 0, 0);
@@ -539,10 +539,9 @@
 		return ide_stopped;
 
 	set_irq(drive, ide_dmaq_intr);
-	if (!udma_start(drive, rq))
-		return ide_started;
+	udma_start(drive, rq);
 
-	return ide_stopped;
+	return ide_started;
 }
 
 /*
@@ -550,7 +549,7 @@
  *
  * Channel lock should be held.
  */
-ide_startstop_t udma_tcq_taskfile(struct ata_device *drive, struct request *rq)
+ide_startstop_t udma_tcq_init(struct ata_device *drive, struct request *rq)
 {
 	u8 stat;
 	u8 feat;
drivers/ide/trm290.c +3 -4
diff -urN linux-2.5.21/drivers/ide/trm290.c linux/drivers/ide/trm290.c
@@ -179,7 +179,6 @@
 static int trm290_udma_start(struct ata_device *drive, struct request *__rq)
 {
 	/* Nothing to be done here. */
-	return 0;
 }
 
 static int trm290_udma_stop(struct ata_device *drive)
@@ -210,7 +209,7 @@
 #ifdef TRM290_NO_DMA_WRITES
 		trm290_prepare_drive(drive, 0);	/* select PIO xfer */
 
-		return 1;
+		return ide_stopped;
 #endif
 	} else {
 		reading = 2;
@@ -219,7 +218,7 @@
 
 	if (!(count = udma_new_table(drive, rq))) {
 		trm290_prepare_drive(drive, 0);	/* select PIO xfer */
-		return 1;	/* try PIO instead of DMA */
+		return ide_stopped;	/* try PIO instead of DMA */
 	}
 
 	trm290_prepare_drive(drive, 1);	/* select DMA xfer */
@@ -233,7 +232,7 @@
 		outb(reading ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG);
 	}
 
-	return 0;
+	return ide_started;
 }
 
 static int trm290_udma_irq_status(struct ata_device *drive)
drivers/scsi/ide-scsi.c +1 -1
diff -urN linux-2.5.21/drivers/scsi/ide-scsi.c linux/drivers/scsi/ide-scsi.c
@@ -444,7 +444,7 @@
 	bcount = min(pc->request_transfer, 63 * 1024);		/* Request to transfer the entire buffer at once */
 
 	if (drive->using_dma && rq->bio)
-		dma_ok = !udma_init(drive, rq);
+		dma_ok = udma_init(drive, rq);
 
 	ata_select(drive, 10);
 	ata_irq_enable(drive, 1);
include/linux/ide.h +7 -10
diff -urN linux-2.5.21/include/linux/ide.h linux/include/linux/ide.h
@@ -459,9 +459,9 @@
 	int (*udma_setup)(struct ata_device *);
 
 	void (*udma_enable)(struct ata_device *, int, int);
-	int (*udma_start) (struct ata_device *, struct request *rq);
+	void (*udma_start) (struct ata_device *, struct request *);
 	int (*udma_stop) (struct ata_device *);
-	int (*udma_init) (struct ata_device *, struct request *rq);
+	int (*udma_init) (struct ata_device *, struct request *);
 	int (*udma_irq_status) (struct ata_device *);
 	void (*udma_timeout) (struct ata_device *);
 	void (*udma_irq_lost) (struct ata_device *);
@@ -651,15 +651,12 @@
 	struct hd_drive_task_hdr  hobfile;
 	u8 cmd;					/* actual ATA command */
 	int command_type;
-	ide_startstop_t (*handler)(struct ata_device *, struct request *);
+	ide_startstop_t (*XXX_handler)(struct ata_device *, struct request *);
 };
 
 extern void ata_read(struct ata_device *, void *, unsigned int);
 extern void ata_write(struct ata_device *, void *, unsigned int);
 
-extern ide_startstop_t ata_do_taskfile(struct ata_device *,
-	struct ata_taskfile *, struct request *);
-
 /*
  * Special Flagged Register Validation Caller
  */
@@ -751,9 +748,9 @@
 	drive->channel->udma_enable(drive, on, verbose);
 }
 
-static inline int udma_start(struct ata_device *drive, struct request *rq)
+static inline void udma_start(struct ata_device *drive, struct request *rq)
 {
-	return drive->channel->udma_start(drive, rq);
+	drive->channel->udma_start(drive, rq);
 }
 
 static inline int udma_stop(struct ata_device *drive)
@@ -764,7 +761,7 @@
 /*
  * Initiate actual DMA data transfer. The direction is encoded in the request.
  */
-static inline int udma_init(struct ata_device *drive, struct request *rq)
+static inline ide_startstop_t udma_init(struct ata_device *drive, struct request *rq)
 {
 	return drive->channel->udma_init(drive, rq);
 }
@@ -802,7 +799,7 @@
 extern int udma_black_list(struct ata_device *);
 extern int udma_white_list(struct ata_device *);
 
-extern ide_startstop_t udma_tcq_taskfile(struct ata_device *, struct request *);
+extern ide_startstop_t udma_tcq_init(struct ata_device *, struct request *);
 extern int udma_tcq_enable(struct ata_device *, int);
 
 extern ide_startstop_t ide_dma_intr(struct ata_device *, struct request *);
#83 lore raw

Re: [PATCH] 2.5.21 IDE 91

In reply to Linus Torvalds
Quoted 4 lines · Martin Dalecki

Thu Jun 13 22:59:54 CEST 2002 ide-clean-91

- Realize that the only place where ata_do_taskfile gets used is ide-disk.c move it and its "friends' over there.

Ehm, isn't that a bit odd? The typical "I'm not looking at the interface, if only one person is currently using it then heck lets move it" Martin approach (refer to prep_rq_fn cdb builder as well)

The above is just a minor thing, the reason I'm mailing is really:

- current 2.5 bk deadlocks reading partition info off disk. Again a locking problem I suppose, to be honest I just got very tired when seeing it happen and didn't want to spend tim looking into it.

I thought IDE locking couldn't get worse than 2.4, but I think you are well into doing just that. What exactly are you plans with the channel locks? Right now, to me, it seems you are extending the use of them to the point where they would be used to serialize the entire request operation start? Heck, ide-cd is even holding the channel lock when outputting the cdb now.

- ata_end_request(). why didn't you just remove the last argument to __ata_end_request() instead just changing the comment saying why we pass nr_secs == 0 in from some sites?

- what's the reasoning behind moving the active request into the ata_device?! we are serializing requests for ata_device's on the ata_channel anyways, which is why it made sense to have the active request there.

And finally a small plea for more testing. Do you even test before blindly sending patches off to Linus?! Sometimes just watching how quickly these big patches appears makes it impossible that they have gotten any kind of testing other than the 'hey it compiles', which I think it just way too little for something that could possible screw peoples data up very badly. Frankly, _I'm_ too scared to run 2.5 IDE currently. The success ratio of posted over working patches is too big.

Signature · 1 line
Jens Axboe
#84 lore raw

Re: [PATCH] 2.5.21 IDE 91

Quoted 4 lines · Jens Axboe

- current 2.5 bk deadlocks reading partition info off disk. Again a locking problem I suppose, to be honest I just got very tired when seeing it happen and didn't want to spend tim looking into it.

Hmm. There's a bug in "balance_irq()" if you are trying to run a SMP kernel on an UP machine right now, and it _might_ be that the lockup has nothing to do with the IDE layer, but simple with the first PCI interrupt (as opposed to local timer interrupt) coming in.

One-liner from Zwane Mwaikambo (cut-and-paste, so space is wrong, please apply by hand).

arch/i386/kernel/io_apic.c Fri Jun 14 17:42:23 2002 renamed from arch/i386/kernel/io_apic.c.orig Fri Jun 14 17:43:20 2002 +1 -1
@@ -251,7 +251,7 @@
        irq_balance_t *entry = irq_balance + irq;
        unsigned long now = jiffies;
 
-       if (unlikely(entry->timestamp != now)) {
+       if ((entry->timestamp != now) && (smp_num_cpus > 1)) {
                unsigned long allowed_mask;
                int random_number;
 

I don't know. Might be the IDE code too, of course.

Linus

#85 lore raw

Re: [PATCH] 2.5.21 IDE 91

Quoted 12 lines · Użytkownik Linus Torvalds
Quoted 3 lines · Jens Axboe

- current 2.5 bk deadlocks reading partition info off disk. Again a locking problem I suppose, to be honest I just got very tired when seeing it happen and didn't want to spend tim looking into it.

Hmm. There's a bug in "balance_irq()" if you are trying to run a SMP kernel on an UP machine right now, and it _might_ be that the lockup has nothing to do with the IDE layer, but simple with the first PCI interrupt (as opposed to local timer interrupt) coming in.

...

Quoted 1 line

I don't know. Might be the IDE code too, of course.

Just to complete the picture: I'm running SMP kernels on UP for the sake of spinlock debugging and compilatoin coverage too. But as I have already stated - I run my own patches on top of the last offical release instead of BK contents.

#86 lore raw

Re: [PATCH] 2.5.21 IDE 91

In reply to Jens Axboe
Quoted 27 lines · Linus Torvalds
Quoted 4 lines · Jens Axboe

- current 2.5 bk deadlocks reading partition info off disk. Again a locking problem I suppose, to be honest I just got very tired when seeing it happen and didn't want to spend tim looking into it.

Hmm. There's a bug in "balance_irq()" if you are trying to run a SMP kernel on an UP machine right now, and it _might_ be that the lockup has nothing to do with the IDE layer, but simple with the first PCI interrupt (as opposed to local timer interrupt) coming in.

One-liner from Zwane Mwaikambo (cut-and-paste, so space is wrong, please apply by hand).

arch/i386/kernel/io_apic.c Fri Jun 14 17:42:23 2002 renamed from arch/i386/kernel/io_apic.c.orig Fri Jun 14 17:43:20 2002 +1 -1
@@ -251,7 +251,7 @@
        irq_balance_t *entry = irq_balance + irq;
        unsigned long now = jiffies;
 
-       if (unlikely(entry->timestamp != now)) {
+       if ((entry->timestamp != now) && (smp_num_cpus > 1)) {
                unsigned long allowed_mask;
                int random_number;
 
Quoted 1 line

I don't know. Might be the IDE code too, of course.

If it's just a SMP kernel on UP, then that's not the problem here. This was SMP kernel on SMP machine.

Signature · 1 line
Jens Axboe
#87 lore raw

Re: [PATCH] 2.5.21 IDE 91

In reply to Linus Torvalds
Quoted 7 lines · Jens Axboe

And finally a small plea for more testing. Do you even test before blindly sending patches off to Linus?! Sometimes just watching how quickly these big patches appears makes it impossible that they have gotten any kind of testing other than the 'hey it compiles', which I think it just way too little for something that could possible screw peoples data up very badly. Frankly, _I'm_ too scared to run 2.5 IDE currently. The success ratio of posted over working patches is too big.

Ditto. As we rapidly approach the 100th incarnation of Martin's IDE patches, there are still cases where we die within seconds of booting on some old PIO-only boxes for eg. There seems to be far too much "lets rip this out as it doesn't do much anyway" rather than fixing known problems.

When the IDE carnage first started back circa 2.5.3, I had contemplated not merging *any* of the IDE patches, just so that people who want to work on other areas could have something solid to build upon. I regret not following through on that instinct.

Dave.

Signature · 2 lines
| Dave Jones.        http://www.codemonkey.org.uk
| SuSE Labs
#88 lore raw

Re: [PATCH] 2.5.21 IDE 91

Just my 0.02 plns...

Quoted 10 lines · Dave Jones
Quoted 7 lines · Jens Axboe

And finally a small plea for more testing. Do you even test before blindly sending patches off to Linus?! Sometimes just watching how quickly these big patches appears makes it impossible that they have gotten any kind of testing other than the 'hey it compiles', which I think it just way too little for something that could possible screw peoples data up very badly. Frankly, _I'm_ too scared to run 2.5 IDE currently. The success ratio of posted over working patches is too big.

I review every single patch from Martin and they are usually ok, but it is generally good habbit to wait for next patch before running previous one (just to see if there was any bugs in previous one)...

Quoted 5 lines

Ditto. As we rapidly approach the 100th incarnation of Martin's IDE patches, there are still cases where we die within seconds of booting on some old PIO-only boxes for eg. There seems to be far too much "lets rip this out as it doesn't do much anyway" rather than fixing known problems.

I will try to fix them one by one soon...

Quoted 6 lines

When the IDE carnage first started back circa 2.5.3, I had contemplated not merging *any* of the IDE patches, just so that people who want to work on other areas could have something solid to build upon. I regret not following through on that instinct.

Your mistake, Dave ;)

Quoted 6 lines

Dave.

--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs
-

--
Bartlomiej

#89 lore raw

Re: [PATCH] 2.5.21 IDE 91

Quoted 15 lines · Użytkownik Bartlomiej Zolnierkiewicz

Just my 0.02 plns...

Quoted 9 lines · Dave Jones
Quoted 7 lines · Jens Axboe

And finally a small plea for more testing. Do you even test before blindly sending patches off to Linus?! Sometimes just watching how quickly these big patches appears makes it impossible that they have gotten any kind of testing other than the 'hey it compiles', which I think it just way too little for something that could possible screw peoples data up very badly. Frankly, _I'm_ too scared to run 2.5 IDE currently. The success ratio of posted over working patches is too big.

Quoted 3 lines

I review every single patch from Martin and they are usually ok, but it is generally good habbit to wait for next patch before running previous one (just to see if there was any bugs in previous one)...

And I'm gald you do. You know that I admit if I screw things up even in my change logs. Finally I'm sometimes just the shield for screwups done by others. (No problem I can take the heat :-).

Quoted 8 lines
Quoted 5 lines

Ditto. As we rapidly approach the 100th incarnation of Martin's IDE patches, there are still cases where we die within seconds of booting on some old PIO-only boxes for eg. There seems to be far too much "lets rip this out as it doesn't do much anyway" rather than fixing known problems.

I will try to fix them one by one soon...

Many people just do not realize that I don't hunt for the easy fruits. I tend to solve fundamental things first before getting down. (See for example the TCQ in and out discussion I had with Jens - it turned out to be much better to do the infrastructure thing at same time instead of hacking up on the existing thing.)

Down to the point - there was *no way in hell* to
solve the PIO problems util:

1. The basic datastructures we have now where there.

2. The locking issues get resolved and take place on a sane level.

3. The number of possible code flows got sanitized.

Heck, contrary to the habbits of many others I'm constantly trying to explain even the reasoning behing the changes I do. Not just what gets changes.

But fortunately right now we are indeed "getting just there" as the fact shows that the last series of the IDE patches is moving more and more down to the actual transport layer. And since the overall structure starts to become more and more clean even more and more people start to work together with me on not just some very well separated areas like for example host chip timing but the overall infrastructure as well. (Adam, Bartek - I'm glad you are around :-).

Everybody out there proclaiming that this could have all been solved far earlier by some kind of "easy" fix had just enough of time to prove me worng on this issue.

Unless I get complains from people who work with me together on the code itself I indeed tend to follow my own agenda of prio.

It's that simple.

#90 lore raw

Re: [PATCH] 2.5.21 IDE 91

In reply to Dave Jones
Quoted 10 lines · Dave Jones
Quoted 7 lines · Jens Axboe

And finally a small plea for more testing. Do you even test before blindly sending patches off to Linus?! Sometimes just watching how quickly these big patches appears makes it impossible that they have gotten any kind of testing other than the 'hey it compiles', which I think it just way too little for something that could possible screw peoples data up very badly. Frankly, _I'm_ too scared to run 2.5 IDE currently. The success ratio of posted over working patches is too big.

Quoted 5 lines

Ditto. As we rapidly approach the 100th incarnation of Martin's IDE patches, there are still cases where we die within seconds of booting on some old PIO-only boxes for eg. There seems to be far too much "lets rip this out as it doesn't do much anyway" rather than fixing known problems.

Are we perhaps forgetting the _point_ of open source?

We're not supposed to be writing code and then releasing it when it is done. We _want_ incremental changes, and open breakage.

Do bugs happen? Should we expect locking problems if the author is working on changing the locking (which everybody who has ever looked at the code admits was totally broken)?

YES.

Am I personally disturbed over the fact that PIO is still totally broken? Yes. I don't like that part at all, but I do know that Martin is aware of it, and I keep pushing on him all the time. Martin claims to be on top of it, and getting close to be able to fix it. I haven't seen any real reason to doubt him on that so far. We'll get there.

Linus

#91 lore raw

Re: [PATCH] 2.5.21 IDE 91

In reply to Linus Torvalds
Quoted 7 lines

And finally a small plea for more testing. Do you even test before blindly sending patches off to Linus?! Sometimes just watching how quickly these big patches appears makes it impossible that they have gotten any kind of testing other than the 'hey it compiles', which I think it just way too little for something that could possible screw peoples data up very badly. Frankly, _I'm_ too scared to run 2.5 IDE currently. The success ratio of posted over working patches is too big.

I run all all of Martin's patches on my machine, and I haven't run into
any catastrophic problems (by this I mean problems that cause data loss though I realize that this may not be much of a standard).

I rather like the fact that Martin releases early and often... it usually means that I get a fix right away. I like the "release early and often" approach in a development kernel branch since I do not believe that releasing less often has any correlation to the stability of the product released (look at Windows :).

Martin or Jens, are there any test suites that you would like me to run?

I am currently too stupid to be able to aid in the development directly (lord knows i'm trying to get up to speed), but, in the meantime, I can test the crap out of a kernel :).

-o) J o h n W e b e r
/\\ [email protected]
_\/v http://www.linuxhq.com/people/weber/

#92 lore raw

Re: [PATCH] 2.5.21 IDE 91

In reply to Linus Torvalds
Quoted 7 lines · Jens Axboe

And finally a small plea for more testing. Do you even test before blindly sending patches off to Linus?! Sometimes just watching how quickly these big patches appears makes it impossible that they have gotten any kind of testing other than the 'hey it compiles', which I think it just way too little for something that could possible screw peoples data up very badly. Frankly, _I'm_ too scared to run 2.5 IDE currently. The success ratio of posted over working patches is too big.

Add my voice to these concerns. At the very least the code should have been moved into a second tree to allow people to work with the old stable driver as needed.

-ben

Signature · 1 line
"You will be reincarnated as a toad; and you will be much happier."
#93 lore raw

Re: [PATCH] 2.5.21 IDE 91

You can just copy old drives/ide/ + include/linux/[ide.h, hdreg.h]
+ asm/ide.h and it should compile/work?...

Quoted 22 lines · Benjamin LaHaise
Quoted 7 lines · Jens Axboe

And finally a small plea for more testing. Do you even test before blindly sending patches off to Linus?! Sometimes just watching how quickly these big patches appears makes it impossible that they have gotten any kind of testing other than the 'hey it compiles', which I think it just way too little for something that could possible screw peoples data up very badly. Frankly, _I'm_ too scared to run 2.5 IDE currently. The success ratio of posted over working patches is too big.

Add my voice to these concerns. At the very least the code should have been moved into a second tree to allow people to work with the old stable driver as needed.

-ben
--
"You will be reincarnated as a toad; and you will be much happier." -
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#94 lore raw

Re: [PATCH] 2.5.21 IDE 91

In reply to Linus Torvalds
Quoted 3 lines · Benjamin LaHaise

Add my voice to these concerns. At the very least the code should have been moved into a second tree to allow people to work with the old stable driver as needed.

*nod*, with periodic known-good _tested_ bits getting merged to mainline, to avoid the need for an IDE merge flag day as has been the norm in the past.

Dave

Signature · 2 lines
| Dave Jones.        http://www.codemonkey.org.uk
| SuSE Labs
#95 lore raw

Re: [PATCH] 2.5.21 IDE 91

In reply to Linus Torvalds
Quoted 11 lines · Użytkownik Jens Axboe
Quoted 4 lines · Martin Dalecki

Thu Jun 13 22:59:54 CEST 2002 ide-clean-91

- Realize that the only place where ata_do_taskfile gets used is ide-disk.c move it and its "friends' over there.

Ehm, isn't that a bit odd? The typical "I'm not looking at the interface, if only one person is currently using it then heck lets move it" Martin approach (refer to prep_rq_fn cdb builder as well)

Yes this is the usual Marcin aproach. The fscking best road to bloat is providing interfaces "on the heap" and "just in case", which then nobody sane uses. Wen one discovers later that they are inadequate, we try to support them until the end of days becouse
some silly python based incompetently written setup application turns out to love to having you know what with.

And since application level programming expierence shows me that in 99% of the cases where interfaces are designed in front of beeing used they turn out to be inadequate I don't do it.

Won't to see some silly things like the situation described above? Please just count the number of ioctl for the /dev/random. 90% of them qualify as "debuggin during developement" or are working against the purpose of the thing. Just one example. Once another even more striking is the whole /proc/ mess.

Quoted 5 lines

The above is just a minor thing, the reason I'm mailing is really:

- current 2.5 bk deadlocks reading partition info off disk. Again a locking problem I suppose, to be honest I just got very tired when seeing it happen and didn't want to spend tim looking into it.

2.5.21 + the patches I did doesn't. Likely it's the driverfs?

Quoted 6 lines

I thought IDE locking couldn't get worse than 2.4, but I think you are well into doing just that. What exactly are you plans with the channel locks? Right now, to me, it seems you are extending the use of them to the point where they would be used to serialize the entire request operation start? Heck, ide-cd is even holding the channel lock when outputting the cdb now.

After extracting out 80% of the host controller register file access one has to realize that in reality we where releasing the lock just to regain it immediately. Or alternatively accessing them without any lock protection at all. (Same goes for BIO ummer layer memmbers.) This is why they are pushed up. It's just avoiding the "windows" between unlock and immediate relock and making the real behaviour more "obvious". You have just realized this.

2.4 prevents the locking problems basically by georgeously disabling IRQs. Too fine grained locking is a futile exercise. Unless I see the time spent in system state during concurrent disk access going really up (it doesn't right now), I don't see any thing bad in making the locking more coarse. Locks don't came for free and having fine grained locking isn't justifying itself.

Another "usual Marcin approach" - don't optimze for the sake of it. See futile unlikely() tagging and inlining in tcq.c for example. I don't do somethig like that. I have just written too much numerical code which was really time constrained to do something like this before looking at benchmarks.
Really constrained means having a program running 7 or "just" 5 *days*. This can make a difference, a difference in hard real money on the range of multiple kEUR!

Finally - unless there appears some aother way to block access to busy devices on the generic block layer I do it the only way we have right now - spinlocks. (... looking forward to working queue pugging and the work done by Adam richter). Unless there is a sane way to signal partial completion - we will be doing it at once. Unless we have a sane async io infrastructure most of the above will be likely not solved anyway.

Quoted 3 lines

- ata_end_request(). why didn't you just remove the last argument to __ata_end_request() instead just changing the comment saying why we pass nr_secs == 0 in from some sites?

One step after another. Watch for hard_xxx members from struch request to see why I hesitated please.

Quoted 4 lines

- what's the reasoning behind moving the active request into the ata_device?! we are serializing requests for ata_device's on the ata_channel anyways, which is why it made sense to have the active request there.

Becouse it is going to go away altogether. We need it there just only for the purpose of the default ide_timer_expiry function, which is subject to go away since a long time. And finally becouse it doesn't hurt.

Further on I refer you to the discussion we had (or was it Linus?) once about the fact that attaching physical properties of the device to the request queue and replicating those parameters in every single request struct, is well ... "unpleasant" on behalf of the upper layers. Loop devices expose the same problem.
Once again just grepping for hard_ memebers of the struct request makes it obvious.

Somce people say that using the gratest common denominator in the case of the loop devices is the solution,
but I think that it's rather a work around.

Quoted 7 lines

And finally a small plea for more testing. Do you even test before blindly sending patches off to Linus?! Sometimes just watching how quickly these big patches appears makes it impossible that they have gotten any kind of testing other than the 'hey it compiles', which I think it just way too little for something that could possible screw peoples data up very badly. Frankly, _I'm_ too scared to run 2.5 IDE currently. The success ratio of posted over working patches is too big.

Fact is: many of the patches are just big becouse they contain
host chip handling cleanups done by others, and becouse
we have just too many different drivers for the same purpose:
ATAPI packet command devices. Which I'm more and more tempted
to scarp... in favour of just ide-scsi.c. But that's another
story. (Adam J. Richter is givng me constant preassure to do just that and I start really tending to admitt that he is just right.)

As of testing. Well at least I can assure you that I'm eating my dogfood, since I run constantly on the patches. (Heck even the time I write this.) But I don't use kernels from the BK repository at all.
In fact I just don't use BK at all and I don't intend too.

#96 lore raw

Re: [PATCH] 2.5.21 IDE 91

In reply to Linus Torvalds
Quoted 9 lines · Użytkownik Dave Jones
Quoted 3 lines · Benjamin LaHaise

Add my voice to these concerns. At the very least the code should have been moved into a second tree to allow people to work with the old stable driver as needed.

*nod*, with periodic known-good _tested_ bits getting merged to mainline, to avoid the need for an IDE merge flag day as has been the norm in the past.

And they where the best way to basically halt the whole thing. Right now the only thing you would achieve would be to kick out the other people with wich I work *together*.
Oh perhaps noone of them would have got involved...
I simply don't like to idea of lonely developement on a separate small iland called a "dedicated mailing list". And I don't see any need for it - the traffic on LKML isn't that high if one learn how to use mozillas filtering facilities.

#97 lore raw

Re: [PATCH] 2.5.21 IDE 91

In reply to Linus Torvalds
Quoted 5 lines · Martin Dalecki
Quoted 3 lines

- current 2.5 bk deadlocks reading partition info off disk. Again a locking problem I suppose, to be honest I just got very tired when seeing it happen and didn't want to spend tim looking into it.

2.5.21 + the patches I did doesn't. Likely it's the driverfs?

This particular problem I don't know, I'm simply just out lining it.

Quoted 7 lines
Quoted 6 lines

I thought IDE locking couldn't get worse than 2.4, but I think you are well into doing just that. What exactly are you plans with the channel locks? Right now, to me, it seems you are extending the use of them to the point where they would be used to serialize the entire request operation start? Heck, ide-cd is even holding the channel lock when outputting the cdb now.

Quoted 7 lines

After extracting out 80% of the host controller register file access one has to realize that in reality we where releasing the lock just to regain it immediately. Or alternatively accessing them without any lock protection at all. (Same goes for BIO ummer layer memmbers.) This is why they are pushed up. It's just avoiding the "windows" between unlock and immediate relock and making the real behaviour more "obvious". You have just realized this.

I know the locking needs to be reworked, it just very much looks like that you are just extending the scope of the channel lock to basically be held the entire way through. I'm hoping this is just a transition?

Quoted 2 lines

2.4 prevents the locking problems basically by georgeously disabling IRQs. Too fine grained locking is a futile exercise.

Yep

Quoted 4 lines

Unless I see the time spent in system state during concurrent disk access going really up (it doesn't right now), I don't see any thing bad in making the locking more coarse. Locks don't came for free and having fine grained locking isn't justifying itself.

That's silly. Most of the "locking" required is just serializing access to the channel (or interface). Just making the locking coarse and grabbing it to do just that is pretty dumb.

Quoted 8 lines

Another "usual Marcin approach" - don't optimze for the sake of it. See futile unlikely() tagging and inlining in tcq.c for example. I don't do somethig like that. I have just written too much numerical code which was really time constrained to do something like this before looking at benchmarks.
Really constrained means having a program running 7 or "just" 5 *days*. This can make a difference, a difference in hard real money on the range of multiple kEUR!

Listing to complaints about unlikely() as micro-optimization from someone who doesn't think that using a spin lock to serialize looong operations is a problem doesn't carry a lot of weight, sorry. I don't know why you bring this up again, I've already stated my case in the last mail and I see no reason to repeat it.

Quoted 4 lines

Finally - unless there appears some aother way to block access to busy devices on the generic block layer I do it the only way we have right now - spinlocks. (... looking forward to working queue pugging and the work done by Adam richter).

First of all, queue plugging works now. Second, this is no excuse for using a spin lock to serialize request starts?! Please tell me you don't really mean this. At worst you could have spurious request_fn runs before, but that's hardly a big problem. I know the start/stop queue is a nicer interface (that's why it's there now), but there's nothing wrong with simply recalling your queueing function once a request completes. That's how it was done before too. In short, this is not an argument, it has little relevance to this case. And the big-bio stuff, how is that relevant?

Quoted 3 lines

Unless there is a sane way to signal partial completion - we will be doing it at once. Unless we have a sane async io infrastructure most of the above will be likely not solved anyway.

??

Quoted 8 lines
Quoted 3 lines

ata_device?! we are serializing requests for ata_device's on the ata_channel anyways, which is why it made sense to have the active request there.

Becouse it is going to go away altogether. We need it there just only for the purpose of the default ide_timer_expiry function, which is subject to go away since a long time. And finally becouse it doesn't hurt.

Because it doesn't hurt? From the same book of code writing an optimization? Again, the serialization point is the channel, why move the active request to the drive?! To me, this is loosing information and making the whole thing more confusing.

Quoted 4 lines

Further on I refer you to the discussion we had (or was it Linus?) once about the fact that attaching physical properties of the device to the request queue and replicating those parameters in every single request struct, is well ... "unpleasant" on behalf of the

The drive <-> queue relationship has no bearing on the active request serialization.

Quoted 1 line

upper layers. Loop devices expose the same problem.

Please explain the loop case?

Quoted 2 lines

Once again just grepping for hard_ memebers of the struct request makes it obvious.

Do you understand why we have the hard_ members? It seems you don't, because I don't see how that is remotely related to this. The hard_ members are just there so that low level drivers can screw with the nr_sectors and current_nr_sectors as much as they want, and the block layer can still maintain a consistent request state regardless of what happens.

Quoted 3 lines

Somce people say that using the gratest common denominator in the case of the loop devices is the solution,
but I think that it's rather a work around.

This sounds like nonsense.

Quoted 8 lines
Quoted 7 lines

And finally a small plea for more testing. Do you even test before blindly sending patches off to Linus?! Sometimes just watching how quickly these big patches appears makes it impossible that they have gotten any kind of testing other than the 'hey it compiles', which I think it just way too little for something that could possible screw peoples data up very badly. Frankly, _I'm_ too scared to run 2.5 IDE currently. The success ratio of posted over working patches is too big.

Quoted 7 lines

Fact is: many of the patches are just big becouse they contain host chip handling cleanups done by others, and becouse
we have just too many different drivers for the same purpose:
ATAPI packet command devices. Which I'm more and more tempted to scarp... in favour of just ide-scsi.c. But that's another story. (Adam J. Richter is givng me constant preassure to do just that and I start really tending to admitt that he is just right.)

Yeah I know that they are mostly big because of cleanups, and I'm not worried about that at all. But even when just maybe 10% of the patch is changing stuff radically, problems can sneak in. Plus, there appears to be no clear goal in what you are doing. Things change in one direction one day, back in another the next day. I have a hard time seeing how this will lead to a cleaner and more maintainable code base.

Quoted 2 lines

As of testing. Well at least I can assure you that I'm eating my dogfood, since I run constantly on the patches. (Heck even the time I write this.)

That's good for you, but a single person testing is usually not enough. Especially not with stuff like IDE where there are sooo many different pieces of hardware and setups out there. I'm not saying that you should do complete validation of the code every single time, but maybe having a bleding edge tree and a linus tree would go along way. Then you could ship cleanups as much as you want, but do the more radical changes a bit slower. I think that would also solve your direction problem, letting the more radical changes mature a bit before shipping it.

Quoted 2 lines

But I don't use kernels from the BK repository at all. In fact I just don't use BK at all and I don't intend too.

Doesn't matter. Fact is, you don't know when Linus will tag the BK tree as the next release. Or how many of your ide-xx patches are in at that point.

Signature · 1 line
Jens Axboe
#98 lore raw

PATCH 1/1 2.5.21 ide 92

In reply to Linus Torvalds

Fri Jun 14 15:32:38 CEST 2002 ide-clean-92

- Finally unify task_in_intr and task_mulin_intr. One crucial code path less to watch out, but a quite dangerous step in itself. PIO reading is functional again. The next step will be the unification of the write path of course.

- Introduce a small helper for the execution of task file commands which basically just send a simple command down to the drive.

- Add a buffer parameter to ide_raw_taskfile allowing to unify the handling of ioctl and normal ide_raw_taskfile request.

- Fix some small function pointer type mismatches.

Apply more host chip controller clenups by Bartlomiej:

- move setting drive->current_speed from *_tune_chipset() to ide_config_drive_speed()

cmd64x.c:
- convert cmd64x_tuneproc() to use ata-timing library
- clean cmd64x_tune_chipset() and cmd680_tune_chipset()

hpt366.c:
- remove empty timings table

it8172.c:
- kill prototypes
- update to new udma_setup() scheme

+ misc cleanups

arch/i386/kernel/dmi_scan.c +0 -28
diff -urN linux-2.5.21/arch/i386/kernel/dmi_scan.c linux/arch/i386/kernel/dmi_scan.c
@@ -185,28 +185,6 @@
 #define NO_MATCH	{ NONE, NULL}
 #define MATCH(a,b)	{ a, b }
 
-/*
- *	We have problems with IDE DMA on some platforms. In paticular the
- *	KT7 series. On these it seems the newer BIOS has fixed them. The
- *	rule needs to be improved to match specific BIOS revisions with
- *	corruption problems
- */ 
- 
-#if 0
-static __init int disable_ide_dma(struct dmi_blacklist *d)
-{
-#ifdef CONFIG_BLK_DEV_IDE
-	extern int noautodma;
-	if(noautodma == 0)
-	{
-		noautodma = 1;
-		printk(KERN_INFO "%s series board detected. Disabling IDE DMA.\n", d->ident);
-	}
-#endif	
-	return 0;
-}
-#endif
-
 /* 
  * Reboot options and system auto-detection code provided by
  * Dell Computer Corporation so their systems "just work". :-)
@@ -511,12 +489,6 @@
  */
  
 static __initdata struct dmi_blacklist dmi_blacklist[]={
-#if 0
-	{ disable_ide_dma, "KT7", {	/* Overbroad right now - kill DMA on problem KT7 boards */
-			MATCH(DMI_PRODUCT_NAME, "KT7-RAID"),
-			NO_MATCH, NO_MATCH, NO_MATCH
-			} },
-#endif			
 	{ broken_ps2_resume, "Dell Latitude C600", {	/* Handle problems with APM on the C600 */
 			MATCH(DMI_SYS_VENDOR, "Dell"),
 			MATCH(DMI_PRODUCT_NAME, "Latitude C600"),
drivers/ide/aec62xx.c +0 -2
diff -urN linux-2.5.21/drivers/ide/aec62xx.c linux/drivers/ide/aec62xx.c
@@ -141,8 +141,6 @@
 	else
 		aec_set_speed_new(drive->channel->pci_dev, drive->dn, &t);
 
-	drive->current_speed = speed;
-
 	return 0;
 }
 
drivers/ide/alim15x3.c +1 -2
diff -urN linux-2.5.21/drivers/ide/alim15x3.c linux/drivers/ide/alim15x3.c
@@ -53,6 +53,7 @@
 
 	t = ata_timing_data(pio);
 
+	/* FIXME: use generic ata-timing library  --bkz */
 	s_time = t->setup;
 	a_time = t->active;
 	if ((s_clc = (s_time * system_bus_speed + 999999) / 1000000) >= 8)
@@ -171,8 +172,6 @@
 	}
 #endif /* CONFIG_BLK_DEV_IDEDMA */
 
-	drive->current_speed = speed;
-
 	return ide_config_drive_speed(drive, speed);
 }
 
drivers/ide/amd74xx.c +0 -2
diff -urN linux-2.5.21/drivers/ide/amd74xx.c linux/drivers/ide/amd74xx.c
@@ -153,8 +153,6 @@
 
 	amd_set_speed(drive->channel->pci_dev, drive->dn, &t);
 
-	drive->current_speed = speed;
-
 	return 0;
 }
 
drivers/ide/cmd64x.c +88 -93

310 lines not on this page · raw message

drivers/ide/Config.help +2 -0
diff -urN linux-2.5.21/drivers/ide/Config.help linux/drivers/ide/Config.help
@@ -372,6 +372,8 @@
   HPT366 is an Ultra DMA chipset for ATA-66.
   HPT368 is an Ultra DMA chipset for ATA-66 RAID Based.
   HPT370 is an Ultra DMA chipset for ATA-100.
+  HPT372 is an Ultra DMA chipset for ATA-100.
+  HPT374 is an Ultra DMA chipset for ATA-100.
 
   This driver adds up to 4 more EIDE devices sharing a single
   interrupt.
drivers/ide/Config.in +1 -1
diff -urN linux-2.5.21/drivers/ide/Config.in linux/drivers/ide/Config.in
@@ -50,7 +50,7 @@
       dep_bool '    Cyrix CS5530 MediaGX chipset support' CONFIG_BLK_DEV_CS5530 $CONFIG_BLK_DEV_IDEDMA_PCI
       dep_bool '    HPT34X chipset support' CONFIG_BLK_DEV_HPT34X $CONFIG_BLK_DEV_IDEDMA_PCI
       dep_mbool '      HPT34X AUTODMA support (EXPERMENTAL)' CONFIG_HPT34X_AUTODMA $CONFIG_BLK_DEV_HPT34X $CONFIG_EXPERIMENTAL
-      dep_bool '    HPT366 chipset support' CONFIG_BLK_DEV_HPT366 $CONFIG_BLK_DEV_IDEDMA_PCI
+      dep_bool '    HPT36X/37X chipset support' CONFIG_BLK_DEV_HPT366 $CONFIG_BLK_DEV_IDEDMA_PCI
       dep_bool '    Intel and Efar (SMsC) chipset support' CONFIG_BLK_DEV_PIIX $CONFIG_BLK_DEV_IDEDMA_PCI
       if [ "$CONFIG_MIPS_ITE8172" = "y" -o "$CONFIG_MIPS_IVR" = "y" ]; then
          dep_mbool '    IT8172 IDE support' CONFIG_BLK_DEV_IT8172 $CONFIG_BLK_DEV_IDEDMA_PCI
drivers/ide/cy82c693.c +4 -4
diff -urN linux-2.5.21/drivers/ide/cy82c693.c linux/drivers/ide/cy82c693.c
@@ -204,7 +204,7 @@
 	data = IN_BYTE(CY82_DATA_PORT);
 
 	printk (KERN_INFO "%s (ch=%d, dev=%d): DMA mode is %d (single=%d)\n", drive->name, drive->channel->unit, drive->select.b.unit, (data&0x3), ((data>>2)&1));
-#endif /* CY82C693_DEBUG_LOGS */
+#endif
 
 	data = (byte)mode|(byte)(single<<2);
 
@@ -213,7 +213,7 @@
 
 #if CY82C693_DEBUG_INFO
 	printk (KERN_INFO "%s (ch=%d, dev=%d): set DMA mode to %d (single=%d)\n", drive->name, drive->channel->unit, drive->select.b.unit, mode, single);
-#endif /* CY82C693_DEBUG_INFO */
+#endif
 
 	/*
 	 * note: below we set the value for Bus Master IDE TimeOut Register
@@ -231,7 +231,7 @@
 
 #if CY82C693_DEBUG_INFO
 	printk (KERN_INFO "%s: Set IDE Bus Master TimeOut Register to 0x%X\n", drive->name, data);
-#endif /* CY82C693_DEBUG_INFO */
+#endif
 }
 
 /*
@@ -331,7 +331,7 @@
 
 #if CY82C693_DEBUG_INFO
 	printk (KERN_INFO "%s: Selected PIO mode %d\n", drive->name, pio);
-#endif /* CY82C693_DEBUG_INFO */
+#endif
 
         compute_clocks(pio, &pclk);  /* let's calc the values for this PIO mode */
 
drivers/ide/hpt34x.c +0 -1
diff -urN linux-2.5.21/drivers/ide/hpt34x.c linux/drivers/ide/hpt34x.c
@@ -63,7 +63,6 @@
 		udma, pio, err);
 #endif
 
-	drive->current_speed = speed;
 	return ide_config_drive_speed(drive, speed);
 }
 
drivers/ide/hpt366.c +3 -31
diff -urN linux-2.5.21/drivers/ide/hpt366.c linux/drivers/ide/hpt366.c
@@ -140,7 +140,7 @@
 	unsigned int	chipset_settings;
 };
 
-/* key for bus clock timings
+/* key for bus clock timings for HPT370
  * bit
  * 0:3    data_high_time. inactive time of DIOW_/DIOR_ for PIO and MW
  *        DMA. cycles = value + 1
@@ -409,26 +409,6 @@
 };
 
 #if 0
-static struct chipset_bus_clock_list_entry fifty_base_hpt374[] = {
-	{	XFER_UDMA_6,	},
-	{	XFER_UDMA_5,	},
-	{	XFER_UDMA_4,	},
-	{	XFER_UDMA_3,	},
-	{	XFER_UDMA_2,	},
-	{	XFER_UDMA_1,	},
-	{	XFER_UDMA_0,	},
-	{	XFER_MW_DMA_2,	},
-	{	XFER_MW_DMA_1,	},
-	{	XFER_MW_DMA_0,	},
-	{	XFER_PIO_4,	},
-	{	XFER_PIO_3,	},
-	{	XFER_PIO_2,	},
-	{	XFER_PIO_1,	},
-	{	XFER_PIO_0,	},
-	{	0,	}
-};
-#endif
-#if 0
 static struct chipset_bus_clock_list_entry sixty_six_base_hpt374[] = {
 	{	XFER_UDMA_6,	0x12406231	},	/* checkme */
 	{	XFER_UDMA_5,	0x12446231	},
@@ -678,21 +658,13 @@
 	} else {
                 hpt366_tune_chipset(drive, speed);
         }
-	drive->current_speed = speed;
+
 	return ide_config_drive_speed(drive, speed);
 }
 
 static void hpt3xx_tune_drive(struct ata_device *drive, u8 pio)
 {
-	u8 speed;
-	switch(pio) {
-		case 4:		speed = XFER_PIO_4;break;
-		case 3:		speed = XFER_PIO_3;break;
-		case 2:		speed = XFER_PIO_2;break;
-		case 1:		speed = XFER_PIO_1;break;
-		default:	speed = XFER_PIO_0;break;
-	}
-	(void) hpt3xx_tune_chipset(drive, speed);
+	(void) hpt3xx_tune_chipset(drive, XFER_PIO_0 + min_t(u8, pio, 4));
 }
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
drivers/ide/ide.c +1 -1
diff -urN linux-2.5.21/drivers/ide/ide.c linux/drivers/ide/ide.c
@@ -560,7 +560,7 @@
 		memset(&args, 0, sizeof(args));
 		args.taskfile.sector_count = drive->sect;
 		args.cmd = WIN_RESTORE;
-		ide_raw_taskfile(drive, &args);
+		ide_raw_taskfile(drive, &args, NULL);
 		printk(KERN_INFO "%s: done!\n", drive->name);
 	}
 
drivers/ide/ide-disk.c +67 -131

340 lines not on this page · raw message

drivers/ide/ide-pmac.c +1 -16
diff -urN linux-2.5.21/drivers/ide/ide-pmac.c linux/drivers/ide/ide-pmac.c
@@ -341,21 +341,6 @@
 	}
 }
 
-#if 0
-/* This one could be later extended to handle CMD IDE and be used by some kind
- * of /proc interface. I want to be able to get the devicetree path of a block
- * device for yaboot configuration
- */
-struct device_node*
-pmac_ide_get_devnode(struct ata_device *drive)
-{
-	int i = pmac_ide_find(drive);
-	if (i < 0)
-		return NULL;
-	return pmac_ide[i].node;
-}
-#endif
-
 /* Setup timings for the selected drive (master/slave). I still need to verify if this
  * is enough, I beleive selectproc will be called whenever an IDE command is started,
  * but... */
@@ -1365,7 +1350,7 @@
 	 */
 	ix = pmac_ide_find(drive);
 	if (ix < 0)
-		return ide_started;
+		return ide_stopped;
 
 	dma = pmac_ide[ix].dma_regs;
 	ata4 = (pmac_ide[ix].kind == controller_kl_ata4 ||
drivers/ide/ide-taskfile.c +7 -5
diff -urN linux-2.5.21/drivers/ide/ide-taskfile.c linux/drivers/ide/ide-taskfile.c
@@ -242,8 +242,9 @@
 /*
  * Invoked on completion of a special REQ_SPECIAL command.
  */
-ide_startstop_t ata_special_intr(struct ata_device *drive, struct
-		request *rq) {
+static ide_startstop_t special_intr(struct ata_device *drive,
+		struct request *rq)
+{
 
 	struct ata_taskfile *ar = rq->special;
 	ide_startstop_t ret = ide_stopped;
@@ -292,16 +293,18 @@
 	return ret;
 }
 
-int ide_raw_taskfile(struct ata_device *drive, struct ata_taskfile *ar)
+int ide_raw_taskfile(struct ata_device *drive, struct ata_taskfile *ar,
+		char *buffer)
 {
 	struct request req;
 
 	ar->command_type = IDE_DRIVE_TASK_NO_DATA;
-	ar->XXX_handler = ata_special_intr;
+	ar->XXX_handler = special_intr;
 
 	memset(&req, 0, sizeof(req));
 	req.flags = REQ_SPECIAL;
 	req.special = ar;
+	req.buffer = buffer;
 
 	return ide_do_drive_cmd(drive, &req, ide_wait);
 }
@@ -310,5 +313,4 @@
 EXPORT_SYMBOL(ide_do_drive_cmd);
 EXPORT_SYMBOL(ata_read);
 EXPORT_SYMBOL(ata_write);
-EXPORT_SYMBOL(ata_special_intr);
 EXPORT_SYMBOL(ide_raw_taskfile);
drivers/ide/ioctl.c +1 -12
diff -urN linux-2.5.21/drivers/ide/ioctl.c linux/drivers/ide/ioctl.c
@@ -47,7 +47,6 @@
 	u8 *argbuf = vals;
 	int argsize = 4;
 	struct ata_taskfile args;
-	struct request req;
 
 	/* Second phase.
 	 */
@@ -78,17 +77,7 @@
 		memset(argbuf + 4, 0, argsize - 4);
 	}
 
-	/* Issue ATA command and wait for completion.
-	 */
-	args.command_type = IDE_DRIVE_TASK_NO_DATA;
-	args.XXX_handler = ata_special_intr;
-
-	memset(&req, 0, sizeof(req));
-	req.flags = REQ_SPECIAL;
-	req.special = &args;
-
-	req.buffer = argbuf + 4;
-	err = ide_do_drive_cmd(drive, &req, ide_wait);
+	err = ide_raw_taskfile(drive, &args, argbuf + 4);
 
 	argbuf[0] = drive->status;
 	argbuf[1] = args.taskfile.feature;
drivers/ide/it8172.c +18 -52

127 lines not on this page · raw message

drivers/ide/opti621.c +1 -2
diff -urN linux-2.5.21/drivers/ide/opti621.c linux/drivers/ide/opti621.c
@@ -342,9 +342,8 @@
 {
 	int i;
 
-	for (i = 0; i < ARRAY_SIZE(chipsets); ++i) {
+	for (i = 0; i < ARRAY_SIZE(chipsets); ++i)
 		ata_register_chipset(&chipsets[i]);
-	}
 
         return 0;
 }
drivers/ide/pcidma.c +1 -1
diff -urN linux-2.5.21/drivers/ide/pcidma.c linux/drivers/ide/pcidma.c
@@ -415,7 +415,7 @@
  *
  * Channel lock should be held.
  */
-int udma_pci_start(struct ata_device *drive, struct request *rq)
+void udma_pci_start(struct ata_device *drive, struct request *rq)
 {
 	struct ata_channel *ch = drive->channel;
 	unsigned long dma_base = ch->dma_base;
drivers/ide/pdc202xx.c +1 -5
diff -urN linux-2.5.21/drivers/ide/pdc202xx.c linux/drivers/ide/pdc202xx.c
@@ -230,8 +230,6 @@
 	printk(KERN_DEBUG "DP(%x)\n", DP);
 #endif
 
-	drive->current_speed = speed;
-
 #if PDC202XX_DEBUG_DRIVE_INFO
 	printk("%s: %02x drive%d 0x%08x ",
 		drive->name, speed,
@@ -352,8 +350,6 @@
 			;
 	}
 
-	drive->current_speed = speed;
-
 	return ide_config_drive_speed(drive, speed);
 }
 
@@ -551,7 +547,7 @@
 	return 0;
 }
 
-static int pdc202xx_udma_start(struct ata_device *drive, struct request *rq)
+static void pdc202xx_udma_start(struct ata_device *drive, struct request *rq)
 {
 	struct ata_channel *ch = drive->channel;
 	u32 high_16 = pci_resource_start(ch->pci_dev, 4);
drivers/ide/piix.c +0 -2
diff -urN linux-2.5.21/drivers/ide/piix.c linux/drivers/ide/piix.c
@@ -222,8 +222,6 @@
 
 	piix_set_speed(drive->channel->pci_dev, drive->dn, &t, umul);
 
-	drive->current_speed = speed;
-
 	return 0;
 }
 
drivers/ide/probe.c +4 -0
diff -urN linux-2.5.21/drivers/ide/probe.c linux/drivers/ide/probe.c
@@ -339,6 +339,8 @@
 		ata_irq_enable(drive, 1);
 	udelay(1);
 
+	/* FIXME: use ata_status_poll()  --bkz */
+
 	ata_busy_poll(drive, WAIT_CMD);
 
 	/*
@@ -395,6 +397,8 @@
 		default: break;
 	}
 
+	drive->current_speed = speed;
+
 	return error;
 }
 
drivers/ide/serverworks.c +18 -31

109 lines not on this page · raw message

drivers/ide/sis5513.c +15 -22
diff -urN linux-2.5.21/drivers/ide/sis5513.c linux/drivers/ide/sis5513.c
@@ -267,7 +267,7 @@
 {
 	struct ata_channel *hwif = drive->channel;
 	struct pci_dev *dev = hwif->pci_dev;
-	u8 drive_pci, test1, test2, speed;
+	u8 drive_pci, test1, test2;
 
 #ifdef DEBUG
 	sis5513_load_verify_registers(dev, "config_drive_art_rwp_pio start");
@@ -280,13 +280,10 @@
 	       drive->dn, pio, timing);
 #endif
 
-	switch(drive->dn) {
-		case 0:		drive_pci = 0x40; break;
-		case 1:		drive_pci = 0x42; break;
-		case 2:		drive_pci = 0x44; break;
-		case 3:		drive_pci = 0x46; break;
-		default:	return 1;
-	}
+	if (drive->dn > 3)	/* FIXME: remove this  --bkz */
+		return 1;
+
+	drive_pci = 0x40 + (drive->dn << 1);
 
 	/* register layout changed with newer ATA100 chips */
 	if (chipset_family < ATA_100) {
@@ -321,9 +318,8 @@
 #ifdef DEBUG
 	sis5513_load_verify_registers(dev, "config_drive_art_rwp_pio start");
 #endif
-	speed = XFER_PIO_0 + min_t(u8, pio, 4);
-	drive->current_speed = speed;
-	return ide_config_drive_speed(drive, speed);
+
+	return ide_config_drive_speed(drive, XFER_PIO_0 + min_t(u8, pio, 4));
 }
 
 static int sis5513_tune_chipset(struct ata_device *drive, u8 speed)
@@ -338,13 +334,11 @@
 	printk("SIS5513: sis5513_tune_chipset, drive %d, speed %d\n",
 	       drive->dn, speed);
 #endif
-	switch(drive->dn) {
-		case 0:		drive_pci = 0x40; break;
-		case 1:		drive_pci = 0x42; break;
-		case 2:		drive_pci = 0x44; break;
-		case 3:		drive_pci = 0x46; break;
-		default:	return 0;
-	}
+
+	if (drive->dn > 3)	/* FIXME: remove this  --bkz */
+		return 1;
+
+	drive_pci = 0x40 + (drive->dn << 1);
 
 #ifdef BROKEN_LEVEL
 #ifdef DEBUG
@@ -396,11 +390,10 @@
 		default:
 			return config_art_rwp_pio(drive, 0);
 	}
-	drive->current_speed = speed;
 #ifdef DEBUG
 	sis5513_load_verify_registers(dev, "sis5513_tune_chipset end");
 #endif
-	return ((int) ide_config_drive_speed(drive, speed));
+	return ide_config_drive_speed(drive, speed);
 }
 
 static void sis5513_tune_drive(struct ata_device *drive, u8 pio)
@@ -568,8 +561,8 @@
 
 static unsigned int __init ata66_sis5513(struct ata_channel *hwif)
 {
-	byte reg48h = 0, ata66 = 0;
-	byte mask = hwif->unit ? 0x20 : 0x10;
+	u8 reg48h, ata66 = 0;
+	u8 mask = hwif->unit ? 0x20 : 0x10;
 	pci_read_config_byte(hwif->pci_dev, 0x48, &reg48h);
 
 	if (chipset_family >= ATA_66) {
drivers/ide/tcq.c +4 -4
diff -urN linux-2.5.21/drivers/ide/tcq.c linux/drivers/ide/tcq.c
@@ -430,7 +430,7 @@
 	memset(&args, 0, sizeof(args));
 	args.taskfile.feature = 0x01;
 	args.cmd = WIN_NOP;
-	ide_raw_taskfile(drive, &args);
+	ide_raw_taskfile(drive, &args, NULL);
 	if (args.taskfile.feature & ABRT_ERR)
 		return 1;
 
@@ -458,7 +458,7 @@
 	memset(&args, 0, sizeof(args));
 	args.taskfile.feature = SETFEATURES_EN_WCACHE;
 	args.cmd = WIN_SETFEATURES;
-	if (ide_raw_taskfile(drive, &args)) {
+	if (ide_raw_taskfile(drive, &args, NULL)) {
 		printk("%s: failed to enable write cache\n", drive->name);
 		return 1;
 	}
@@ -470,7 +470,7 @@
 	memset(&args, 0, sizeof(args));
 	args.taskfile.feature = SETFEATURES_DIS_RI;
 	args.cmd = WIN_SETFEATURES;
-	if (ide_raw_taskfile(drive, &args)) {
+	if (ide_raw_taskfile(drive, &args, NULL)) {
 		printk("%s: disabling release interrupt fail\n", drive->name);
 		return 1;
 	}
@@ -482,7 +482,7 @@
 	memset(&args, 0, sizeof(args));
 	args.taskfile.feature = SETFEATURES_EN_SI;
 	args.cmd = WIN_SETFEATURES;
-	if (ide_raw_taskfile(drive, &args)) {
+	if (ide_raw_taskfile(drive, &args, NULL)) {
 		printk("%s: enabling service interrupt fail\n", drive->name);
 		return 1;
 	}
drivers/ide/trm290.c +1 -1
diff -urN linux-2.5.21/drivers/ide/trm290.c linux/drivers/ide/trm290.c
@@ -176,7 +176,7 @@
 }
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
-static int trm290_udma_start(struct ata_device *drive, struct request *__rq)
+static void trm290_udma_start(struct ata_device *drive, struct request *__rq)
 {
 	/* Nothing to be done here. */
 }
drivers/ide/via82cxxx.c +0 -2
diff -urN linux-2.5.21/drivers/ide/via82cxxx.c linux/drivers/ide/via82cxxx.c
@@ -199,8 +199,6 @@
 
 	via_set_speed(drive->channel->pci_dev, drive->dn, &t);
 
-	drive->current_speed = speed;
-
 	return 0;
 }
 
include/linux/ide.h +2 -3
diff -urN linux-2.5.21/include/linux/ide.h linux/include/linux/ide.h
@@ -679,8 +679,7 @@
 		bio_kunmap_irq(to, flags);
 }
 
-extern ide_startstop_t ata_special_intr(struct ata_device *, struct request *);
-extern int ide_raw_taskfile(struct ata_device *, struct ata_taskfile *);
+extern int ide_raw_taskfile(struct ata_device *, struct ata_taskfile *, char *);
 
 extern void ide_fix_driveid(struct hd_driveid *id);
 extern int ide_config_drive_speed(struct ata_device *, byte);
@@ -784,7 +783,7 @@
 #ifdef CONFIG_BLK_DEV_IDEDMA
 
 extern void udma_pci_enable(struct ata_device *drive, int on, int verbose);
-extern int udma_pci_start(struct ata_device *drive, struct request *rq);
+extern void udma_pci_start(struct ata_device *drive, struct request *rq);
 extern int udma_pci_stop(struct ata_device *drive);
 extern int udma_pci_init(struct ata_device *drive, struct request *rq);
 extern int udma_pci_irq_status(struct ata_device *drive);