public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alan <alan@lxorguk.ukuu.org.uk>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Linus Torvalds <torvalds@osdl.org>,
	Alessandro Suardi <alessandro.suardi@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] libata: fix combined mode (was Re: Happy New Year (and v2.6.20-rc3 released))
Date: Tue, 2 Jan 2007 11:58:34 +0000	[thread overview]
Message-ID: <20070102115834.1e7644b2@localhost.localdomain> (raw)
In-Reply-To: <459973F6.2090201@pobox.com>

This is a slight variant on the patch I posted December 16th to fix
libata combined mode handling. The only real change is that we now
correctly also reserve BAR1,2,4. That is basically a neatness issue.

Jeff was unhappy about two things

1. That it didn't work in the case of one channel native one channel
legacy. 

This is a silly complaint because the SFF layer in libata doesn't handle
this case yet anyway.

2. The case where combined mode is in use and IDE=n. 

In this case the libata quirk code reserves the resources in question
correctly already.

Once the combined mode stuff is redone properly (2.6.21) then the entire
mess turns into a single pci_request_regions() for all cases and all the
ugly resource hackery goes away.

I'm sending this now rather than after running full test suites so that
it can get the maximal testing in a short time. I'll be running tests on
this after lunch. 

Signed-off-by: Alan Cox <alan@redhat.com>

--- linux.vanilla-2.6.20-rc3/drivers/ata/libata-sff.c	2007-01-01 21:43:27.000000000 +0000
+++ linux-2.6.20-rc3/drivers/ata/libata-sff.c	2007-01-02 11:15:53.000000000 +0000
@@ -1027,13 +1027,15 @@
 #endif
 	}
 
-	rc = pci_request_regions(pdev, DRV_NAME);
-	if (rc) {
-		disable_dev_on_err = 0;
-		goto err_out;
-	}
-
-	if (legacy_mode) {
+	if (!legacy_mode) {
+		rc = pci_request_regions(pdev, DRV_NAME);
+		if (rc) {
+			disable_dev_on_err = 0;
+			goto err_out;
+		}
+	} else {
+		/* Deal with combined mode hack. This side of the logic all
+		   goes away once the combined mode hack is killed in 2.6.21 */
 		if (!request_region(ATA_PRIMARY_CMD, 8, "libata")) {
 			struct resource *conflict, res;
 			res.start = ATA_PRIMARY_CMD;
@@ -1071,6 +1073,13 @@
 			}
 		} else
 			legacy_mode |= ATA_PORT_SECONDARY;
+
+		if (legacy_mode & ATA_PORT_PRIMARY)
+			pci_request_region(pdev, 1, DRV_NAME);
+		if (legacy_mode & ATA_PORT_SECONDARY)
+			pci_request_region(pdev, 3, DRV_NAME);
+		/* If there is a DMA resource, allocate it */
+		pci_request_region(pdev, 4, DRV_NAME);
 	}
 
 	/* we have legacy mode, but all ports are unavailable */
@@ -1114,11 +1123,20 @@
 err_out_ent:
 	kfree(probe_ent);
 err_out_regions:
-	if (legacy_mode & ATA_PORT_PRIMARY)
-		release_region(ATA_PRIMARY_CMD, 8);
-	if (legacy_mode & ATA_PORT_SECONDARY)
-		release_region(ATA_SECONDARY_CMD, 8);
-	pci_release_regions(pdev);
+	/* All this conditional stuff is needed for the combined mode hack
+	   until 2.6.21 when it can go */
+	if (legacy_mode) {
+		pci_release_region(pdev, 4);
+		if (legacy_mode & ATA_PORT_PRIMARY) {
+			release_region(ATA_PRIMARY_CMD, 8);
+			pci_release_region(pdev, 1);
+		}
+		if (legacy_mode & ATA_PORT_SECONDARY) {
+			release_region(ATA_SECONDARY_CMD, 8);
+			pci_release_region(pdev, 3);
+		}
+	} else
+		pci_release_regions(pdev);
 err_out:
 	if (disable_dev_on_err)
 		pci_disable_device(pdev);

  parent reply	other threads:[~2007-01-02 11:48 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-01  1:19 Happy New Year (and v2.6.20-rc3 released) Linus Torvalds
2007-01-01  1:39 ` Gene Heskett
2007-01-01  2:40 ` Alexey Dobriyan
2007-01-01  7:22 ` Cyrill V. Gorcnov
     [not found]   ` <4598BC0F.6070003@vc.cvut.cz>
2007-01-01  9:41     ` Cyrill V. Gorcnov
2007-01-02  2:19   ` H. Peter Anvin
2007-01-01 11:29 ` Arkadiusz Miskiewicz
2007-01-01 13:28 ` Alessandro Suardi
2007-01-01 20:13   ` Linus Torvalds
2007-01-01 20:49     ` Jeff Garzik
2007-01-01 21:31       ` Alan
2007-01-01 23:34         ` Linus Torvalds
2007-01-02  2:32           ` Theodore Tso
2007-01-02 11:58       ` Alan [this message]
2007-01-02 12:07         ` [PATCH] libata: fix combined mode (was Re: Happy New Year (and v2.6.20-rc3 released)) Alessandro Suardi
2007-01-02 14:00           ` Alan
2007-01-02 16:12         ` Theodore Tso
2007-01-02 21:00         ` Jeff Garzik
2007-01-02 21:27           ` Alan
2007-01-02 21:29             ` Jeff Garzik
2007-01-02 21:32               ` Jeff Garzik
2007-01-02 22:48                 ` Alan
2007-01-02 22:45               ` Alan
2007-01-02 23:01                 ` Jeff Garzik
2007-01-02 23:27                   ` Alan
2007-01-02 23:43                     ` Jeff Garzik
2007-01-03  0:36                       ` Alan
2007-01-03  1:02                         ` Jeff Garzik
2007-01-02 23:54                     ` Jeff Garzik
2007-01-03  0:39                       ` Alan
2007-01-02 23:04                 ` Jeff Garzik
2007-01-03 19:59         ` Steve Wise
2007-01-01 21:26     ` Happy New Year (and v2.6.20-rc3 released) Alan
2007-01-02 16:09       ` Linus Torvalds
2007-01-01 15:52 ` Olaf Hering
2007-01-02 19:16 ` 2.6.20-rc3: known unfixed regressions Adrian Bunk
2007-01-03 18:15   ` Steve Youngs
2007-01-03 20:03     ` Adrian Bunk
2007-01-02 19:24 ` 2.6.20-rc3: known regressions with patches available (part 1) Adrian Bunk
2007-01-02 19:26   ` Jens Axboe
2007-01-02 19:34     ` Adrian Bunk
2007-01-02 20:45       ` Rene Herman
2007-01-02 20:51         ` Jens Axboe
2007-01-02 19:30 ` 2.6.20-rc3: known regressions with patches available (part 2) Adrian Bunk
2007-01-03 19:06 ` [2.6.20-rc3] INFO: possible recursive locking detected (was: Happy New Year (and v2.6.20-rc3 released)) Tilman Schmidt
2007-01-03 20:59 ` 2.6.20-rc3: known unfixed regressions (v2) Adrian Bunk
2007-01-04 13:23   ` Horst H. von Brand
2007-01-03 21:04 ` 2.6.20-rc3: known regressions with patches (v2) Adrian Bunk
2007-01-03 21:30   ` Jiri Kosina
2007-01-03 21:32     ` Jiri Kosina
2007-01-04 17:46 ` 2.6.20-rc3: known unfixed regressions (v3) Adrian Bunk
2007-01-04 18:13   ` Matthew Wilcox
2007-01-05  0:25   ` Horst H. von Brand
2007-01-06 21:04 ` 2.6.20-rc3: known unfixed regressions (v4) Adrian Bunk
2007-01-06 22:06   ` Brice Goglin
2007-01-07 23:49     ` Adrian Bunk

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=20070102115834.1e7644b2@localhost.localdomain \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=alessandro.suardi@gmail.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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