All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libata: share PIO limits among devices sharing a channel
@ 2007-01-25 11:29 Tejun Heo
  2007-01-25 12:30 ` Alan
  0 siblings, 1 reply; 9+ messages in thread
From: Tejun Heo @ 2007-01-25 11:29 UTC (permalink / raw)
  To: Jeff Garzik, linux-ide, Alan Cox

PIO xfermask limits should be shared by all devices on the same
channel to avoid violating device selection timing.  libata used to
guarantee this at core level but I mistakenly dropped the code during
conversion to new EH.  This patch revives that guarantee.

Signed-off-by: Tejun Heo <htejun@gmail.com>
---
Jeff, IMHO, this is a regression and should go into #upstream-fixes.
Thanks.

 drivers/ata/libata-core.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Index: work/drivers/ata/libata-core.c
===================================================================
--- work.orig/drivers/ata/libata-core.c
+++ work/drivers/ata/libata-core.c
@@ -3390,6 +3390,7 @@ static void ata_dev_xfermask(struct ata_
 	struct ata_port *ap = dev->ap;
 	struct ata_host *host = ap->host;
 	unsigned long xfer_mask;
+	int i;
 
 	/* controller modes available */
 	xfer_mask = ata_pack_xfermask(ap->pio_mask,
@@ -3412,6 +3413,22 @@ static void ata_dev_xfermask(struct ata_
 				       dev->mwdma_mask, dev->udma_mask);
 	xfer_mask &= ata_id_xfermask(dev->id);
 
+	/* PIO xfermask limits are shared by all devices on the same
+	 * channel to avoid violating device selection timing.
+	 */
+	for (i = 0; i < ATA_MAX_DEVICES; i++) {
+		struct ata_device *d = &ap->device[i];
+		unsigned int pio_mask;
+
+		if (ata_dev_absent(d))
+			continue;
+
+		ata_unpack_xfermask(ata_id_xfermask(d->id),
+				    &pio_mask, NULL, NULL);
+		pio_mask &= d->pio_mask;
+		xfer_mask &= ata_pack_xfermask(pio_mask, UINT_MAX, UINT_MAX);
+	}
+
 	/*
 	 *	CFA Advanced TrueIDE timings are not allowed on a shared
 	 *	cable

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-01-25 14:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-25 11:29 [PATCH] libata: share PIO limits among devices sharing a channel Tejun Heo
2007-01-25 12:30 ` Alan
2007-01-25 12:44   ` Jeff Garzik
2007-01-25 13:30     ` Tejun Heo
2007-01-25 13:50       ` Alan
2007-01-25 14:36         ` Tejun Heo
2007-01-25 14:25   ` Sergei Shtylyov
2007-01-25 14:51     ` Alan
2007-01-25 14:54       ` Sergei Shtylyov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.