Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=dc3c3377f03634d351fafdfe35b237b283586c04
Commit:     dc3c3377f03634d351fafdfe35b237b283586c04
Parent:     e22a9a8b703d05f13366c3f2e7e1aa0550bb5ca6
Author:     Alan <[EMAIL PROTECTED]>
AuthorDate: Tue Jan 2 11:58:34 2007 +0000
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue Jan 2 08:20:51 2007 -0800

    [PATCH] libata: fix combined mode
    
    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 <[EMAIL PROTECTED]>
    Cc: Jeff Garzik <[EMAIL PROTECTED]>
    Acked-by: Alessandro Suardi <[EMAIL PROTECTED]>
    Acked-by: Theodore Tso <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/ata/libata-sff.c |   42 ++++++++++++++++++++++++++++++------------
 1 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 10ee22a..623cec9 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -1027,13 +1027,15 @@ int ata_pci_init_one (struct pci_dev *pdev, struct 
ata_port_info **port_info,
 #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 @@ int ata_pci_init_one (struct pci_dev *pdev, struct 
ata_port_info **port_info,
                        }
                } 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 @@ int ata_pci_init_one (struct pci_dev *pdev, struct 
ata_port_info **port_info,
 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);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to