vserver 1.9.5.x5
[linux-2.6.git] / drivers / scsi / sata_vsc.c
index 880f7f1..a51aa34 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/libata.h>
 
 #define DRV_NAME       "sata_vsc"
-#define DRV_VERSION    "0.01"
+#define DRV_VERSION    "1.0"
 
 /* Interrupt register offsets (from chip base address) */
 #define VSC_SATA_INT_STAT_OFFSET       0x00
@@ -217,6 +217,8 @@ static struct ata_port_operations vsc_sata_ops = {
        .phy_reset              = sata_phy_reset,
        .bmdma_setup            = ata_bmdma_setup,
        .bmdma_start            = ata_bmdma_start,
+       .bmdma_stop             = ata_bmdma_stop,
+       .bmdma_status           = ata_bmdma_status,
        .qc_prep                = ata_qc_prep,
        .qc_issue               = ata_qc_issue_prot,
        .eng_timeout            = ata_eng_timeout,
@@ -255,6 +257,7 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d
        static int printed_version;
        struct ata_probe_ent *probe_ent = NULL;
        unsigned long base;
+       int pci_dev_busy = 0;
        void *mmio_base;
        int rc;
 
@@ -274,8 +277,10 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d
        }
 
        rc = pci_request_regions(pdev, DRV_NAME);
-       if (rc)
+       if (rc) {
+               pci_dev_busy = 1;
                goto err_out;
+       }
 
        /*
         * Use 32 bit DMA mask, because 64 bit address support is poor.
@@ -293,7 +298,7 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d
                goto err_out_regions;
        }
        memset(probe_ent, 0, sizeof(*probe_ent));
-       probe_ent->pdev = pdev;
+       probe_ent->dev = pci_dev_to_dev(pdev);
        INIT_LIST_HEAD(&probe_ent->node);
 
        mmio_base = ioremap(pci_resource_start(pdev, 0),
@@ -333,6 +338,14 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d
 
        pci_set_master(pdev);
 
+       /* 
+        * Config offset 0x98 is "Extended Control and Status Register 0"
+        * Default value is (1 << 28).  All bits except bit 28 are reserved in
+        * DPA mode.  If bit 28 is set, LED 0 reflects all ports' activity.
+        * If bit 28 is clear, each port has its own LED.
+        */
+       pci_write_config_dword(pdev, 0x98, 0);
+
        /* FIXME: check ata_device_add return value */
        ata_device_add(probe_ent);
        kfree(probe_ent);
@@ -344,7 +357,8 @@ err_out_free_ent:
 err_out_regions:
        pci_release_regions(pdev);
 err_out:
-       pci_disable_device(pdev);
+       if (!pci_dev_busy)
+               pci_disable_device(pdev);
        return rc;
 }
 
@@ -385,6 +399,7 @@ MODULE_AUTHOR("Jeremy Higdon");
 MODULE_DESCRIPTION("low-level driver for Vitesse VSC7174 SATA controller");
 MODULE_LICENSE("GPL");
 MODULE_DEVICE_TABLE(pci, vsc_sata_pci_tbl);
+MODULE_VERSION(DRV_VERSION);
 
 module_init(vsc_sata_init);
 module_exit(vsc_sata_exit);