[PATCH] pata_amd: Check enable bits on Nvidia
authorAlan Cox <alan@lxorguk.ukuu.org.uk>
Tue, 12 Sep 2006 16:14:03 +0000 (17:14 +0100)
committerJeff Garzik <jeff@garzik.org>
Tue, 12 Sep 2006 16:01:46 +0000 (12:01 -0400)
A couple of people reported long delays on probe with the newer kernels
and Nvidia PATA. This turned out to be because the Nvidia path forgot to
check the enable bits so probed empty ports.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/ata/pata_amd.c

index b3f60fdb02d041270a3ac9015309db3e25c58cf8..3293cf9a7eb53e104c6d433a34b5ce5b7b2c795f 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/libata.h>
 
 #define DRV_NAME "pata_amd"
-#define DRV_VERSION "0.2.2"
+#define DRV_VERSION "0.2.3"
 
 /**
  *     timing_setup            -       shared timing computation and load
@@ -253,11 +253,22 @@ static void amd133_set_dmamode(struct ata_port *ap, struct ata_device *adev)
 
 static int nv_pre_reset(struct ata_port *ap) {
        static const u8 bitmask[2] = {0x03, 0xC0};
+       static const struct pci_bits nv_enable_bits[] = {
+               { 0x50, 1, 0x02, 0x02 },
+               { 0x50, 1, 0x01, 0x01 }
+       };
 
        struct pci_dev *pdev = to_pci_dev(ap->host->dev);
        u8 ata66;
        u16 udma;
 
+       if (!pci_test_config_bits(pdev, &nv_enable_bits[ap->port_no])) {
+               ata_port_disable(ap);
+               printk(KERN_INFO "ata%u: port disabled. ignoring.\n", ap->id);
+               return 0;
+       }
+
+
        pci_read_config_byte(pdev, 0x52, &ata66);
        if (ata66 & bitmask[ap->port_no])
                ap->cbl = ATA_CBL_PATA80;