linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Art Haas <ahaas@airmail.net>
Cc: linux-ide@vger.kernel.org
Subject: Re: CDROM drive not found when booting using new libata code
Date: Thu, 07 Dec 2006 13:28:02 +0900	[thread overview]
Message-ID: <45779852.1030909@gmail.com> (raw)
In-Reply-To: <20061206181652.GA3107@artsapartment.org>

[-- Attachment #1: Type: text/plain, Size: 52 bytes --]

Please test the attached patch.

Thanks.

-- 
tejun

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1369 bytes --]

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index f8ec389..6d0f0ee 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3396,6 +3396,7 @@ static void ata_dev_xfermask(struct ata_device *dev)
 	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,
@@ -3413,11 +3414,27 @@ static void ata_dev_xfermask(struct ata_device *dev)
         if (ata_drive_40wire(dev->id) && (ap->cbl == ATA_CBL_PATA_UNK || ap->cbl == ATA_CBL_PATA80))
 		xfer_mask &= ~(0xF8 << ATA_SHIFT_UDMA);
 
-
+	/* apply xfermask limits of this device */
 	xfer_mask &= ata_pack_xfermask(dev->pio_mask,
 				       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

  reply	other threads:[~2006-12-07  4:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-24 22:10 CDROM drive not found when booting using new libata code Art Haas
2006-11-21  9:26 ` Tejun Heo
2006-12-06 18:16   ` Art Haas
2006-12-07  4:28     ` Tejun Heo [this message]
2006-12-07 10:55       ` Alan
2006-12-07 12:37         ` Tejun Heo
2006-12-08  1:06           ` Art Haas
2006-12-27 13:29             ` Tejun Heo
2006-12-28  3:51               ` Tejun Heo
2007-01-02 21:07                 ` Art Haas
2007-01-03  3:31                   ` Tejun Heo
2007-01-03 18:08                     ` Art Haas
2007-01-03 23:19                       ` Dâniel Fraga
  -- strict thread matches above, loose matches on Subject: below --
2007-03-14 19:33 YUP
2007-03-14 19:59 YUP

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45779852.1030909@gmail.com \
    --to=htejun@gmail.com \
    --cc=ahaas@airmail.net \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).