]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/sata_sis.c
[libata] eliminate use of drivers/scsi/scsi.h compatibility header/defines
[linux-2.6-omap-h63xx.git] / drivers / scsi / sata_sis.c
index 7d1aaa99aaae0d502eaf838c5766779b36a42ed9..42d7c4e925014d2a382f4ee81117a9d62917e318 100644 (file)
@@ -38,7 +38,7 @@
 #include <linux/blkdev.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
-#include "scsi.h"
+#include <linux/device.h>
 #include <scsi/scsi_host.h>
 #include <linux/libata.h>
 
@@ -55,7 +55,7 @@ enum {
        SIS180_SATA1_OFS        = 0x10, /* offset from sata0->sata1 phy regs */
        SIS182_SATA1_OFS        = 0x20, /* offset from sata0->sata1 phy regs */
        SIS_PMR                 = 0x90, /* port mapping register */
-       SIS_PMR_COMBINED        = 0x30, 
+       SIS_PMR_COMBINED        = 0x30,
 
        /* random bits */
        SIS_FLAG_CFGSCR         = (1 << 30), /* host flag: SCRs via PCI cfg */
@@ -82,7 +82,7 @@ static struct pci_driver sis_pci_driver = {
        .remove                 = ata_pci_remove_one,
 };
 
-static Scsi_Host_Template sis_sht = {
+static struct scsi_host_template sis_sht = {
        .module                 = THIS_MODULE,
        .name                   = DRV_NAME,
        .ioctl                  = ata_scsi_ioctl,
@@ -102,7 +102,7 @@ static Scsi_Host_Template sis_sht = {
        .ordered_flush          = 1,
 };
 
-static struct ata_port_operations sis_ops = {
+static const struct ata_port_operations sis_ops = {
        .port_disable           = ata_port_disable,
        .tf_load                = ata_tf_load,
        .tf_read                = ata_tf_read,
@@ -147,11 +147,13 @@ static unsigned int get_scr_cfg_addr(unsigned int port_no, unsigned int sc_reg,
 {
        unsigned int addr = SIS_SCR_BASE + (4 * sc_reg);
 
-       if (port_no) 
+       if (port_no)  {
                if (device == 0x182)
                        addr += SIS182_SATA1_OFS;
                else
                        addr += SIS180_SATA1_OFS;
+       }
+
        return addr;
 }
 
@@ -159,17 +161,17 @@ static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg)
 {
        struct pci_dev *pdev = to_pci_dev(ap->host_set->dev);
        unsigned int cfg_addr = get_scr_cfg_addr(ap->port_no, sc_reg, pdev->device);
-       u32 val, val2;
+       u32 val, val2 = 0;
        u8 pmr;
 
        if (sc_reg == SCR_ERROR) /* doesn't exist in PCI cfg space */
                return 0xffffffff;
 
        pci_read_config_byte(pdev, SIS_PMR, &pmr);
-       
+
        pci_read_config_dword(pdev, cfg_addr, &val);
 
-       if ((pdev->device == 0x182) || (pmr & SIS_PMR_COMBINED)) 
+       if ((pdev->device == 0x182) || (pmr & SIS_PMR_COMBINED))
                pci_read_config_dword(pdev, cfg_addr+0x10, &val2);
 
        return val|val2;
@@ -185,7 +187,7 @@ static void sis_scr_cfg_write (struct ata_port *ap, unsigned int scr, u32 val)
                return;
 
        pci_read_config_byte(pdev, SIS_PMR, &pmr);
-       
+
        pci_write_config_dword(pdev, cfg_addr, val);
 
        if ((pdev->device == 0x182) || (pmr & SIS_PMR_COMBINED))
@@ -195,7 +197,7 @@ static void sis_scr_cfg_write (struct ata_port *ap, unsigned int scr, u32 val)
 static u32 sis_scr_read (struct ata_port *ap, unsigned int sc_reg)
 {
        struct pci_dev *pdev = to_pci_dev(ap->host_set->dev);
-       u32 val,val2;
+       u32 val, val2 = 0;
        u8 pmr;
 
        if (sc_reg > SCR_CONTROL)
@@ -209,9 +211,9 @@ static u32 sis_scr_read (struct ata_port *ap, unsigned int sc_reg)
        val = inl(ap->ioaddr.scr_addr + (sc_reg * 4));
 
        if ((pdev->device == 0x182) || (pmr & SIS_PMR_COMBINED))
-               val2 = inl(ap->ioaddr.scr_addr + (sc_reg * 4)+0x10);
+               val2 = inl(ap->ioaddr.scr_addr + (sc_reg * 4) + 0x10);
 
-       return val|val2;
+       return val | val2;
 }
 
 static void sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
@@ -223,7 +225,7 @@ static void sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
                return;
 
        pci_read_config_byte(pdev, SIS_PMR, &pmr);
-       
+
        if (ap->flags & SIS_FLAG_CFGSCR)
                sis_scr_cfg_write(ap, sc_reg, val);
        else {
@@ -233,20 +235,9 @@ static void sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
        }
 }
 
-/* move to PCI layer, integrate w/ MSI stuff */
-static void pci_enable_intx(struct pci_dev *pdev)
-{
-       u16 pci_command;
-
-       pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
-       if (pci_command & PCI_COMMAND_INTX_DISABLE) {
-               pci_command &= ~PCI_COMMAND_INTX_DISABLE;
-               pci_write_config_word(pdev, PCI_COMMAND, pci_command);
-       }
-}
-
 static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 {
+       static int printed_version;
        struct ata_probe_ent *probe_ent = NULL;
        int rc;
        u32 genctl;
@@ -255,6 +246,9 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        u8 pmr;
        u8 port2_start;
 
+       if (!printed_version++)
+               dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n");
+
        rc = pci_enable_device(pdev);
        if (rc)
                return rc;
@@ -273,7 +267,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
                goto err_out_regions;
 
        ppi = &sis_port_info;
-       probe_ent = ata_pci_init_native_mode(pdev, &ppi);
+       probe_ent = ata_pci_init_native_mode(pdev, &ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY);
        if (!probe_ent) {
                rc = -ENOMEM;
                goto err_out_regions;
@@ -298,16 +292,18 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        pci_read_config_byte(pdev, SIS_PMR, &pmr);
        if (ent->device != 0x182) {
                if ((pmr & SIS_PMR_COMBINED) == 0) {
-                       printk(KERN_INFO "sata_sis: Detected SiS 180/181 chipset in SATA mode\n");
-                       port2_start=0x64;
+                       dev_printk(KERN_INFO, &pdev->dev,
+                                  "Detected SiS 180/181 chipset in SATA mode\n");
+                       port2_start = 64;
                }
                else {
-                       printk(KERN_INFO "sata_sis: Detected SiS 180/181 chipset in combined mode\n");
+                       dev_printk(KERN_INFO, &pdev->dev,
+                                  "Detected SiS 180/181 chipset in combined mode\n");
                        port2_start=0;
                }
        }
        else {
-               printk(KERN_INFO "sata_sis: Detected SiS 182 chipset\n");
+               dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 182 chipset\n");
                port2_start = 0x20;
        }
 
@@ -319,7 +315,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        }
 
        pci_set_master(pdev);
-       pci_enable_intx(pdev);
+       pci_intx(pdev, 1);
 
        /* FIXME: check ata_device_add return value */
        ata_device_add(probe_ent);