Skip to contentSkip to conversation

alim15x3: PIO mode setup fixes

PATCH In review Bartlomiej Zolnierkiewicz 2 participants 3 messages Jul 20, 2007 – Jul 22, 2007 libata

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 alim15x3: PIO mode setup fixes

* Return failure in ->speedproc method for unsupported/invalid transfer modes passed from user-space (fixes theoretical OOPS in ali_tune_pio() and/or setting random PIO timings on host controller + disabling UDMA bit + setting unsupported/invalid transfer mode on the device).

* Don't disable UDMA bit when programming PIO modes.

* Add FIXME about DMA timings never being set.

* Bump driver version.

---
 drivers/ide/pci/alim15x3.c |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/ide/pci/alim15x3.c +12 -3
Index: b/drivers/ide/pci/alim15x3.c
===================================================================
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/pci/alim15x3.c		Version 0.25	Jun 9 2007
+ * linux/drivers/ide/pci/alim15x3.c		Version 0.26	Jul 14 2007
  *
  *  Copyright (C) 1998-2000 Michel Aubry, Maintainer
  *  Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer
@@ -418,6 +418,14 @@ static int ali15x3_tune_chipset(ide_driv
 	u8 tmpbyte		= 0x00;
 	int m5229_udma		= (hwif->channel) ? 0x57 : 0x56;
 
+	if (speed < XFER_PIO_0)
+		return 1;
+
+	if (speed >= XFER_PIO_0 && speed <= XFER_PIO_5) {
+		ali_tune_pio(drive, speed - XFER_PIO_0);
+		return ide_config_drive_speed(drive, speed);
+	}
+
 	if (speed == XFER_UDMA_6)
 		speed1 = 0x47;
 
@@ -430,8 +438,9 @@ static int ali15x3_tune_chipset(ide_driv
 		tmpbyte &= ultra_enable;
 		pci_write_config_byte(dev, m5229_udma, tmpbyte);
 
-		if (speed < XFER_SW_DMA_0)
-			ali_tune_pio(drive, speed - XFER_PIO_0);
+		/*
+		 * FIXME: Oh, my... DMA timings are never set.
+		 */
 	} else {
 		pci_read_config_byte(dev, m5229_udma, &tmpbyte);
 		tmpbyte &= (0x0f << ((1-unit) << 2));
Acked-by on v1 1/4
#1 lore raw

Hi.

Quoted 6 lines · Bartlomiej Zolnierkiewicz

* Return failure in ->speedproc method for unsupported/invalid transfer modes passed from user-space (fixes theoretical OOPS in ali_tune_pio() and/or setting random PIO timings on host controller + disabling UDMA bit + setting unsupported/invalid transfer mode on the device).

* Don't disable UDMA bit when programming PIO modes.

Not an issue per se sice ide_config_drive_speed() will turn DMA off anyway
(unless a drive denies to set a given xfer mode).

Quoted 5 lines

* Add FIXME about DMA timings never being set.

* Bump driver version.

MBR, Sergei

#2 lore raw
Quoted 9 lines · Sergei Shtylyov

Hi.

Quoted 4 lines · Bartlomiej Zolnierkiewicz

* Return failure in ->speedproc method for unsupported/invalid transfer modes passed from user-space (fixes theoretical OOPS in ali_tune_pio() and/or setting random PIO timings on host controller + disabling UDMA bit + setting unsupported/invalid transfer mode on the device).

Quoted 4 lines
Quoted 1 line

* Don't disable UDMA bit when programming PIO modes.

Not an issue per se sice ide_config_drive_speed() will turn DMA off anyway
(unless a drive denies to set a given xfer mode).

Yep but it is needed for patch #4/4.

Quoted 7 lines
Quoted 5 lines

* Add FIXME about DMA timings never being set.

* Bump driver version.

added