linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / scsi / sata_sil.c
index d0a8507..9face3c 100644 (file)
 #include <linux/libata.h>
 
 #define DRV_NAME       "sata_sil"
-#define DRV_VERSION    "2.0"
+#define DRV_VERSION    "0.9"
 
 enum {
-       /*
-        * host flags
-        */
-       SIL_FLAG_NO_SATA_IRQ    = (1 << 28),
        SIL_FLAG_RERR_ON_DMA_ACT = (1 << 29),
        SIL_FLAG_MOD15WRITE     = (1 << 30),
 
-       SIL_DFL_HOST_FLAGS      = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
-                                 ATA_FLAG_MMIO | ATA_FLAG_HRST_TO_RESUME,
-
-       /*
-        * Controller IDs
-        */
        sil_3112                = 0,
-       sil_3112_no_sata_irq    = 1,
+       sil_3112_m15w           = 1,
        sil_3512                = 2,
        sil_3114                = 3,
 
-       /*
-        * Register offsets
-        */
-       SIL_SYSCFG              = 0x48,
+       SIL_FIFO_R0             = 0x40,
+       SIL_FIFO_W0             = 0x41,
+       SIL_FIFO_R1             = 0x44,
+       SIL_FIFO_W1             = 0x45,
+       SIL_FIFO_R2             = 0x240,
+       SIL_FIFO_W2             = 0x241,
+       SIL_FIFO_R3             = 0x244,
+       SIL_FIFO_W3             = 0x245,
 
-       /*
-        * Register bits
-        */
-       /* SYSCFG */
+       SIL_SYSCFG              = 0x48,
        SIL_MASK_IDE0_INT       = (1 << 22),
        SIL_MASK_IDE1_INT       = (1 << 23),
        SIL_MASK_IDE2_INT       = (1 << 24),
@@ -84,50 +75,28 @@ enum {
        SIL_MASK_4PORT          = SIL_MASK_2PORT |
                                  SIL_MASK_IDE2_INT | SIL_MASK_IDE3_INT,
 
-       /* BMDMA/BMDMA2 */
-       SIL_INTR_STEERING       = (1 << 1),
-
-       SIL_DMA_ENABLE          = (1 << 0),  /* DMA run switch */
-       SIL_DMA_RDWR            = (1 << 3),  /* DMA Rd-Wr */
-       SIL_DMA_SATA_IRQ        = (1 << 4),  /* OR of all SATA IRQs */
-       SIL_DMA_ACTIVE          = (1 << 16), /* DMA running */
-       SIL_DMA_ERROR           = (1 << 17), /* PCI bus error */
-       SIL_DMA_COMPLETE        = (1 << 18), /* cmd complete / IRQ pending */
-       SIL_DMA_N_SATA_IRQ      = (1 << 6),  /* SATA_IRQ for the next channel */
-       SIL_DMA_N_ACTIVE        = (1 << 24), /* ACTIVE for the next channel */
-       SIL_DMA_N_ERROR         = (1 << 25), /* ERROR for the next channel */
-       SIL_DMA_N_COMPLETE      = (1 << 26), /* COMPLETE for the next channel */
+       SIL_IDE2_BMDMA          = 0x200,
 
-       /* SIEN */
-       SIL_SIEN_N              = (1 << 16), /* triggered by SError.N */
-
-       /*
-        * Others
-        */
+       SIL_INTR_STEERING       = (1 << 1),
        SIL_QUIRK_MOD15WRITE    = (1 << 0),
        SIL_QUIRK_UDMA5MAX      = (1 << 1),
 };
 
 static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);
-static int sil_pci_device_resume(struct pci_dev *pdev);
 static void sil_dev_config(struct ata_port *ap, struct ata_device *dev);
 static u32 sil_scr_read (struct ata_port *ap, unsigned int sc_reg);
 static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
 static void sil_post_set_mode (struct ata_port *ap);
-static irqreturn_t sil_interrupt(int irq, void *dev_instance,
-                                struct pt_regs *regs);
-static void sil_freeze(struct ata_port *ap);
-static void sil_thaw(struct ata_port *ap);
 
 
 static const struct pci_device_id sil_pci_tbl[] = {
-       { 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 },
-       { 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 },
+       { 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w },
+       { 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w },
        { 0x1095, 0x3512, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3512 },
        { 0x1095, 0x3114, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3114 },
-       { 0x1002, 0x436e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 },
-       { 0x1002, 0x4379, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_no_sata_irq },
-       { 0x1002, 0x437a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_no_sata_irq },
+       { 0x1002, 0x436e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w },
+       { 0x1002, 0x4379, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w },
+       { 0x1002, 0x437a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w },
        { }     /* terminate list */
 };
 
@@ -161,8 +130,6 @@ static struct pci_driver sil_pci_driver = {
        .id_table               = sil_pci_tbl,
        .probe                  = sil_init_one,
        .remove                 = ata_pci_remove_one,
-       .suspend                = ata_pci_device_suspend,
-       .resume                 = sil_pci_device_resume,
 };
 
 static struct scsi_host_template sil_sht = {
@@ -170,19 +137,18 @@ static struct scsi_host_template sil_sht = {
        .name                   = DRV_NAME,
        .ioctl                  = ata_scsi_ioctl,
        .queuecommand           = ata_scsi_queuecmd,
+       .eh_strategy_handler    = ata_scsi_error,
        .can_queue              = ATA_DEF_QUEUE,
        .this_id                = ATA_SHT_THIS_ID,
        .sg_tablesize           = LIBATA_MAX_PRD,
+       .max_sectors            = ATA_MAX_SECTORS,
        .cmd_per_lun            = ATA_SHT_CMD_PER_LUN,
        .emulated               = ATA_SHT_EMULATED,
        .use_clustering         = ATA_SHT_USE_CLUSTERING,
        .proc_name              = DRV_NAME,
        .dma_boundary           = ATA_DMA_BOUNDARY,
        .slave_configure        = ata_scsi_slave_config,
-       .slave_destroy          = ata_scsi_slave_destroy,
        .bios_param             = ata_std_bios_param,
-       .suspend                = ata_scsi_device_suspend,
-       .resume                 = ata_scsi_device_resume,
 };
 
 static const struct ata_port_operations sil_ops = {
@@ -193,6 +159,7 @@ static const struct ata_port_operations sil_ops = {
        .check_status           = ata_check_status,
        .exec_command           = ata_exec_command,
        .dev_select             = ata_std_dev_select,
+       .phy_reset              = sata_phy_reset,
        .post_set_mode          = sil_post_set_mode,
        .bmdma_setup            = ata_bmdma_setup,
        .bmdma_start            = ata_bmdma_start,
@@ -200,12 +167,8 @@ static const struct ata_port_operations sil_ops = {
        .bmdma_status           = ata_bmdma_status,
        .qc_prep                = ata_qc_prep,
        .qc_issue               = ata_qc_issue_prot,
-       .data_xfer              = ata_mmio_data_xfer,
-       .freeze                 = sil_freeze,
-       .thaw                   = sil_thaw,
-       .error_handler          = ata_bmdma_error_handler,
-       .post_internal_cmd      = ata_bmdma_post_internal_cmd,
-       .irq_handler            = sil_interrupt,
+       .eng_timeout            = ata_eng_timeout,
+       .irq_handler            = ata_interrupt,
        .irq_clear              = ata_bmdma_irq_clear,
        .scr_read               = sil_scr_read,
        .scr_write              = sil_scr_write,
@@ -218,17 +181,19 @@ static const struct ata_port_info sil_port_info[] = {
        /* sil_3112 */
        {
                .sht            = &sil_sht,
-               .host_flags     = SIL_DFL_HOST_FLAGS | SIL_FLAG_MOD15WRITE,
+               .host_flags     = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
+                                 ATA_FLAG_SRST | ATA_FLAG_MMIO,
                .pio_mask       = 0x1f,                 /* pio0-4 */
                .mwdma_mask     = 0x07,                 /* mwdma0-2 */
                .udma_mask      = 0x3f,                 /* udma0-5 */
                .port_ops       = &sil_ops,
        },
-       /* sil_3112_no_sata_irq */
+       /* sil_3112_15w - keep it sync'd w/ sil_3112 */
        {
                .sht            = &sil_sht,
-               .host_flags     = SIL_DFL_HOST_FLAGS | SIL_FLAG_MOD15WRITE |
-                                 SIL_FLAG_NO_SATA_IRQ,
+               .host_flags     = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
+                                 ATA_FLAG_SRST | ATA_FLAG_MMIO |
+                                 SIL_FLAG_MOD15WRITE,
                .pio_mask       = 0x1f,                 /* pio0-4 */
                .mwdma_mask     = 0x07,                 /* mwdma0-2 */
                .udma_mask      = 0x3f,                 /* udma0-5 */
@@ -237,7 +202,9 @@ static const struct ata_port_info sil_port_info[] = {
        /* sil_3512 */
        {
                .sht            = &sil_sht,
-               .host_flags     = SIL_DFL_HOST_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT,
+               .host_flags     = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
+                                 ATA_FLAG_SRST | ATA_FLAG_MMIO |
+                                 SIL_FLAG_RERR_ON_DMA_ACT,
                .pio_mask       = 0x1f,                 /* pio0-4 */
                .mwdma_mask     = 0x07,                 /* mwdma0-2 */
                .udma_mask      = 0x3f,                 /* udma0-5 */
@@ -246,7 +213,9 @@ static const struct ata_port_info sil_port_info[] = {
        /* sil_3114 */
        {
                .sht            = &sil_sht,
-               .host_flags     = SIL_DFL_HOST_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT,
+               .host_flags     = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
+                                 ATA_FLAG_SRST | ATA_FLAG_MMIO |
+                                 SIL_FLAG_RERR_ON_DMA_ACT,
                .pio_mask       = 0x1f,                 /* pio0-4 */
                .mwdma_mask     = 0x07,                 /* mwdma0-2 */
                .udma_mask      = 0x3f,                 /* udma0-5 */
@@ -260,18 +229,16 @@ static const struct {
        unsigned long tf;       /* ATA taskfile register block */
        unsigned long ctl;      /* ATA control/altstatus register block */
        unsigned long bmdma;    /* DMA register block */
-       unsigned long bmdma2;   /* DMA register block #2 */
-       unsigned long fifo_cfg; /* FIFO Valid Byte Count and Control */
        unsigned long scr;      /* SATA control register block */
        unsigned long sien;     /* SATA Interrupt Enable register */
        unsigned long xfer_mode;/* data transfer mode register */
        unsigned long sfis_cfg; /* SATA FIS reception config register */
 } sil_port[] = {
        /* port 0 ... */
-       { 0x80, 0x8A, 0x00, 0x10, 0x40, 0x100, 0x148, 0xb4, 0x14c },
-       { 0xC0, 0xCA, 0x08, 0x18, 0x44, 0x180, 0x1c8, 0xf4, 0x1cc },
-       { 0x280, 0x28A, 0x200, 0x210, 0x240, 0x300, 0x348, 0x2b4, 0x34c },
-       { 0x2C0, 0x2CA, 0x208, 0x218, 0x244, 0x380, 0x3c8, 0x2f4, 0x3cc },
+       { 0x80, 0x8A, 0x00, 0x100, 0x148, 0xb4, 0x14c },
+       { 0xC0, 0xCA, 0x08, 0x180, 0x1c8, 0xf4, 0x1cc },
+       { 0x280, 0x28A, 0x200, 0x300, 0x348, 0x2b4, 0x34c },
+       { 0x2C0, 0x2CA, 0x208, 0x380, 0x3c8, 0x2f4, 0x3cc },
        /* ... port 3 */
 };
 
@@ -304,7 +271,7 @@ static void sil_post_set_mode (struct ata_port *ap)
 
        for (i = 0; i < 2; i++) {
                dev = &ap->device[i];
-               if (!ata_dev_enabled(dev))
+               if (!ata_dev_present(dev))
                        dev_mode[i] = 0;        /* PIO0/1/2 */
                else if (dev->flags & ATA_DFLAG_PIO)
                        dev_mode[i] = 1;        /* PIO3/4 */
@@ -355,156 +322,6 @@ static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
                writel(val, mmio);
 }
 
-static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
-{
-       struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->active_tag);
-       u8 status;
-
-       if (unlikely(bmdma2 & SIL_DMA_SATA_IRQ)) {
-               u32 serror;
-
-               /* SIEN doesn't mask SATA IRQs on some 3112s.  Those
-                * controllers continue to assert IRQ as long as
-                * SError bits are pending.  Clear SError immediately.
-                */
-               serror = sil_scr_read(ap, SCR_ERROR);
-               sil_scr_write(ap, SCR_ERROR, serror);
-
-               /* Trigger hotplug and accumulate SError only if the
-                * port isn't already frozen.  Otherwise, PHY events
-                * during hardreset makes controllers with broken SIEN
-                * repeat probing needlessly.
-                */
-               if (!(ap->pflags & ATA_PFLAG_FROZEN)) {
-                       ata_ehi_hotplugged(&ap->eh_info);
-                       ap->eh_info.serror |= serror;
-               }
-
-               goto freeze;
-       }
-
-       if (unlikely(!qc || qc->tf.ctl & ATA_NIEN))
-               goto freeze;
-
-       /* Check whether we are expecting interrupt in this state */
-       switch (ap->hsm_task_state) {
-       case HSM_ST_FIRST:
-               /* Some pre-ATAPI-4 devices assert INTRQ
-                * at this state when ready to receive CDB.
-                */
-
-               /* Check the ATA_DFLAG_CDB_INTR flag is enough here.
-                * The flag was turned on only for atapi devices.
-                * No need to check is_atapi_taskfile(&qc->tf) again.
-                */
-               if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR))
-                       goto err_hsm;
-               break;
-       case HSM_ST_LAST:
-               if (qc->tf.protocol == ATA_PROT_DMA ||
-                   qc->tf.protocol == ATA_PROT_ATAPI_DMA) {
-                       /* clear DMA-Start bit */
-                       ap->ops->bmdma_stop(qc);
-
-                       if (bmdma2 & SIL_DMA_ERROR) {
-                               qc->err_mask |= AC_ERR_HOST_BUS;
-                               ap->hsm_task_state = HSM_ST_ERR;
-                       }
-               }
-               break;
-       case HSM_ST:
-               break;
-       default:
-               goto err_hsm;
-       }
-
-       /* check main status, clearing INTRQ */
-       status = ata_chk_status(ap);
-       if (unlikely(status & ATA_BUSY))
-               goto err_hsm;
-
-       /* ack bmdma irq events */
-       ata_bmdma_irq_clear(ap);
-
-       /* kick HSM in the ass */
-       ata_hsm_move(ap, qc, status, 0);
-
-       return;
-
- err_hsm:
-       qc->err_mask |= AC_ERR_HSM;
- freeze:
-       ata_port_freeze(ap);
-}
-
-static irqreturn_t sil_interrupt(int irq, void *dev_instance,
-                                struct pt_regs *regs)
-{
-       struct ata_host_set *host_set = dev_instance;
-       void __iomem *mmio_base = host_set->mmio_base;
-       int handled = 0;
-       int i;
-
-       spin_lock(&host_set->lock);
-
-       for (i = 0; i < host_set->n_ports; i++) {
-               struct ata_port *ap = host_set->ports[i];
-               u32 bmdma2 = readl(mmio_base + sil_port[ap->port_no].bmdma2);
-
-               if (unlikely(!ap || ap->flags & ATA_FLAG_DISABLED))
-                       continue;
-
-               /* turn off SATA_IRQ if not supported */
-               if (ap->flags & SIL_FLAG_NO_SATA_IRQ)
-                       bmdma2 &= ~SIL_DMA_SATA_IRQ;
-
-               if (bmdma2 == 0xffffffff ||
-                   !(bmdma2 & (SIL_DMA_COMPLETE | SIL_DMA_SATA_IRQ)))
-                       continue;
-
-               sil_host_intr(ap, bmdma2);
-               handled = 1;
-       }
-
-       spin_unlock(&host_set->lock);
-
-       return IRQ_RETVAL(handled);
-}
-
-static void sil_freeze(struct ata_port *ap)
-{
-       void __iomem *mmio_base = ap->host_set->mmio_base;
-       u32 tmp;
-
-       /* global IRQ mask doesn't block SATA IRQ, turn off explicitly */
-       writel(0, mmio_base + sil_port[ap->port_no].sien);
-
-       /* plug IRQ */
-       tmp = readl(mmio_base + SIL_SYSCFG);
-       tmp |= SIL_MASK_IDE0_INT << ap->port_no;
-       writel(tmp, mmio_base + SIL_SYSCFG);
-       readl(mmio_base + SIL_SYSCFG);  /* flush */
-}
-
-static void sil_thaw(struct ata_port *ap)
-{
-       void __iomem *mmio_base = ap->host_set->mmio_base;
-       u32 tmp;
-
-       /* clear IRQ */
-       ata_chk_status(ap);
-       ata_bmdma_irq_clear(ap);
-
-       /* turn on SATA IRQ if supported */
-       if (!(ap->flags & SIL_FLAG_NO_SATA_IRQ))
-               writel(SIL_SIEN_N, mmio_base + sil_port[ap->port_no].sien);
-
-       /* turn on IRQ */
-       tmp = readl(mmio_base + SIL_SYSCFG);
-       tmp &= ~(SIL_MASK_IDE0_INT << ap->port_no);
-       writel(tmp, mmio_base + SIL_SYSCFG);
-}
-
 /**
  *     sil_dev_config - Apply device/host-specific errata fixups
  *     @ap: Port containing device to be examined
@@ -537,12 +354,22 @@ static void sil_thaw(struct ata_port *ap)
 static void sil_dev_config(struct ata_port *ap, struct ata_device *dev)
 {
        unsigned int n, quirks = 0;
-       unsigned char model_num[41];
+       unsigned char model_num[40];
+       const char *s;
+       unsigned int len;
 
-       ata_id_c_string(dev->id, model_num, ATA_ID_PROD_OFS, sizeof(model_num));
+       ata_dev_id_string(dev->id, model_num, ATA_ID_PROD_OFS,
+                         sizeof(model_num));
+       s = &model_num[0];
+       len = strnlen(s, sizeof(model_num));
+
+       /* ATAPI specifies that empty space is blank-filled; remove blanks */
+       while ((len > 0) && (s[len - 1] == ' '))
+               len--;
 
        for (n = 0; sil_blacklist[n].product; n++)
-               if (!strcmp(sil_blacklist[n].product, model_num)) {
+               if (!memcmp(sil_blacklist[n].product, s,
+                           strlen(sil_blacklist[n].product))) {
                        quirks = sil_blacklist[n].quirk;
                        break;
                }
@@ -551,67 +378,23 @@ static void sil_dev_config(struct ata_port *ap, struct ata_device *dev)
        if (slow_down ||
            ((ap->flags & SIL_FLAG_MOD15WRITE) &&
             (quirks & SIL_QUIRK_MOD15WRITE))) {
-               ata_dev_printk(dev, KERN_INFO, "applying Seagate errata fix "
-                              "(mod15write workaround)\n");
-               dev->max_sectors = 15;
+               printk(KERN_INFO "ata%u(%u): applying Seagate errata fix (mod15write workaround)\n",
+                      ap->id, dev->devno);
+               ap->host->max_sectors = 15;
+               ap->host->hostt->max_sectors = 15;
+               dev->flags |= ATA_DFLAG_LOCK_SECTORS;
                return;
        }
 
        /* limit to udma5 */
        if (quirks & SIL_QUIRK_UDMA5MAX) {
-               ata_dev_printk(dev, KERN_INFO,
-                              "applying Maxtor errata fix %s\n", model_num);
-               dev->udma_mask &= ATA_UDMA5;
+               printk(KERN_INFO "ata%u(%u): applying Maxtor errata fix %s\n",
+                      ap->id, dev->devno, s);
+               ap->udma_mask &= ATA_UDMA5;
                return;
        }
 }
 
-static void sil_init_controller(struct pci_dev *pdev,
-                               int n_ports, unsigned long host_flags,
-                               void __iomem *mmio_base)
-{
-       u8 cls;
-       u32 tmp;
-       int i;
-
-       /* Initialize FIFO PCI bus arbitration */
-       cls = sil_get_device_cache_line(pdev);
-       if (cls) {
-               cls >>= 3;
-               cls++;  /* cls = (line_size/8)+1 */
-               for (i = 0; i < n_ports; i++)
-                       writew(cls << 8 | cls,
-                              mmio_base + sil_port[i].fifo_cfg);
-       } else
-               dev_printk(KERN_WARNING, &pdev->dev,
-                          "cache line size not set.  Driver may not function\n");
-
-       /* Apply R_ERR on DMA activate FIS errata workaround */
-       if (host_flags & SIL_FLAG_RERR_ON_DMA_ACT) {
-               int cnt;
-
-               for (i = 0, cnt = 0; i < n_ports; i++) {
-                       tmp = readl(mmio_base + sil_port[i].sfis_cfg);
-                       if ((tmp & 0x3) != 0x01)
-                               continue;
-                       if (!cnt)
-                               dev_printk(KERN_INFO, &pdev->dev,
-                                          "Applying R_ERR on DMA activate "
-                                          "FIS errata fix\n");
-                       writel(tmp & ~0x3, mmio_base + sil_port[i].sfis_cfg);
-                       cnt++;
-               }
-       }
-
-       if (n_ports == 4) {
-               /* flip the magic "make 4 ports work" bit */
-               tmp = readl(mmio_base + sil_port[2].bmdma);
-               if ((tmp & SIL_INTR_STEERING) == 0)
-                       writel(tmp | SIL_INTR_STEERING,
-                              mmio_base + sil_port[2].bmdma);
-       }
-}
-
 static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 {
        static int printed_version;
@@ -621,10 +404,16 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        int rc;
        unsigned int i;
        int pci_dev_busy = 0;
+       u32 tmp, irq_mask;
+       u8 cls;
 
        if (!printed_version++)
                dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
 
+       /*
+        * If this driver happens to only be useful on Apple's K2, then
+        * we should check that here as it has a normal Serverworks ID
+        */
        rc = pci_enable_device(pdev);
        if (rc)
                return rc;
@@ -642,12 +431,13 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        if (rc)
                goto err_out_regions;
 
-       probe_ent = kzalloc(sizeof(*probe_ent), GFP_KERNEL);
+       probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL);
        if (probe_ent == NULL) {
                rc = -ENOMEM;
                goto err_out_regions;
        }
 
+       memset(probe_ent, 0, sizeof(*probe_ent));
        INIT_LIST_HEAD(&probe_ent->node);
        probe_ent->dev = pci_dev_to_dev(pdev);
        probe_ent->port_ops = sil_port_info[ent->driver_data].port_ops;
@@ -657,7 +447,7 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        probe_ent->mwdma_mask = sil_port_info[ent->driver_data].mwdma_mask;
        probe_ent->udma_mask = sil_port_info[ent->driver_data].udma_mask;
                probe_ent->irq = pdev->irq;
-               probe_ent->irq_flags = IRQF_SHARED;
+               probe_ent->irq_flags = SA_SHIRQ;
        probe_ent->host_flags = sil_port_info[ent->driver_data].host_flags;
 
        mmio_base = pci_iomap(pdev, 5, 0);
@@ -679,8 +469,67 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
                ata_std_ports(&probe_ent->port[i]);
        }
 
-       sil_init_controller(pdev, probe_ent->n_ports, probe_ent->host_flags,
-                           mmio_base);
+       /* Initialize FIFO PCI bus arbitration */
+       cls = sil_get_device_cache_line(pdev);
+       if (cls) {
+               cls >>= 3;
+               cls++;  /* cls = (line_size/8)+1 */
+               writeb(cls, mmio_base + SIL_FIFO_R0);
+               writeb(cls, mmio_base + SIL_FIFO_W0);
+               writeb(cls, mmio_base + SIL_FIFO_R1);
+               writeb(cls, mmio_base + SIL_FIFO_W1);
+               if (ent->driver_data == sil_3114) {
+                       writeb(cls, mmio_base + SIL_FIFO_R2);
+                       writeb(cls, mmio_base + SIL_FIFO_W2);
+                       writeb(cls, mmio_base + SIL_FIFO_R3);
+                       writeb(cls, mmio_base + SIL_FIFO_W3);
+               }
+       } else
+               dev_printk(KERN_WARNING, &pdev->dev,
+                        "cache line size not set.  Driver may not function\n");
+
+       /* Apply R_ERR on DMA activate FIS errata workaround */
+       if (probe_ent->host_flags & SIL_FLAG_RERR_ON_DMA_ACT) {
+               int cnt;
+
+               for (i = 0, cnt = 0; i < probe_ent->n_ports; i++) {
+                       tmp = readl(mmio_base + sil_port[i].sfis_cfg);
+                       if ((tmp & 0x3) != 0x01)
+                               continue;
+                       if (!cnt)
+                               dev_printk(KERN_INFO, &pdev->dev,
+                                          "Applying R_ERR on DMA activate "
+                                          "FIS errata fix\n");
+                       writel(tmp & ~0x3, mmio_base + sil_port[i].sfis_cfg);
+                       cnt++;
+               }
+       }
+
+       if (ent->driver_data == sil_3114) {
+               irq_mask = SIL_MASK_4PORT;
+
+               /* flip the magic "make 4 ports work" bit */
+               tmp = readl(mmio_base + SIL_IDE2_BMDMA);
+               if ((tmp & SIL_INTR_STEERING) == 0)
+                       writel(tmp | SIL_INTR_STEERING,
+                              mmio_base + SIL_IDE2_BMDMA);
+
+       } else {
+               irq_mask = SIL_MASK_2PORT;
+       }
+
+       /* make sure IDE0/1/2/3 interrupts are not masked */
+       tmp = readl(mmio_base + SIL_SYSCFG);
+       if (tmp & irq_mask) {
+               tmp &= ~irq_mask;
+               writel(tmp, mmio_base + SIL_SYSCFG);
+               readl(mmio_base + SIL_SYSCFG);  /* flush */
+       }
+
+       /* mask all SATA phy-related interrupts */
+       /* TODO: unmask bit 6 (SError N bit) for hotplug */
+       for (i = 0; i < probe_ent->n_ports; i++)
+               writel(0, mmio_base + sil_port[i].sien);
 
        pci_set_master(pdev);
 
@@ -700,18 +549,6 @@ err_out:
        return rc;
 }
 
-static int sil_pci_device_resume(struct pci_dev *pdev)
-{
-       struct ata_host_set *host_set = dev_get_drvdata(&pdev->dev);
-
-       ata_pci_device_do_resume(pdev);
-       sil_init_controller(pdev, host_set->n_ports, host_set->ports[0]->flags,
-                           host_set->mmio_base);
-       ata_host_set_resume(host_set);
-
-       return 0;
-}
-
 static int __init sil_init(void)
 {
        return pci_module_init(&sil_pci_driver);