sata_vsc build fix
[sfrench/cifs-2.6.git] / drivers / scsi / sata_vsc.c
index 2e2c3b7acb0c9a5704b359c2db0719879644e866..5845758e9a6919712135e3e6ff45e9f314df244b 100644 (file)
 /* Port stride */
 #define VSC_SATA_PORT_OFFSET           0x200
 
+/* Error interrupt status bit offsets */
+#define VSC_SATA_INT_ERROR_E_OFFSET    2
+#define VSC_SATA_INT_ERROR_P_OFFSET    4
+#define VSC_SATA_INT_ERROR_T_OFFSET    5
+#define VSC_SATA_INT_ERROR_M_OFFSET    1
+#define is_vsc_sata_int_err(port_idx, int_status) \
+        (int_status & ((1 << (VSC_SATA_INT_ERROR_E_OFFSET + (8 * port_idx))) | \
+                       (1 << (VSC_SATA_INT_ERROR_P_OFFSET + (8 * port_idx))) | \
+                       (1 << (VSC_SATA_INT_ERROR_T_OFFSET + (8 * port_idx))) | \
+                       (1 << (VSC_SATA_INT_ERROR_M_OFFSET + (8 * port_idx)))   \
+                      )\
+        )
+
 
 static u32 vsc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg)
 {
@@ -201,13 +214,27 @@ static irqreturn_t vsc_sata_interrupt (int irq, void *dev_instance,
                        struct ata_port *ap;
 
                        ap = host_set->ports[i];
-                       if (ap && !(ap->flags &
-                                   (ATA_FLAG_PORT_DISABLED|ATA_FLAG_NOINTR))) {
+
+                       if (is_vsc_sata_int_err(i, int_status)) {
+                               u32 err_status;
+                               printk(KERN_DEBUG "%s: ignoring interrupt(s)\n", __FUNCTION__);
+                               err_status = ap ? vsc_sata_scr_read(ap, SCR_ERROR) : 0;
+                               vsc_sata_scr_write(ap, SCR_ERROR, err_status);
+                               handled++;
+                       }
+
+                       if (ap && !(ap->flags & ATA_FLAG_PORT_DISABLED)) {
                                struct ata_queued_cmd *qc;
 
                                qc = ata_qc_from_tag(ap, ap->active_tag);
-                               if (qc && (!(qc->tf.ctl & ATA_NIEN)))
+                               if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)))
                                        handled += ata_host_intr(ap, qc);
+                               else {
+                                       printk(KERN_DEBUG "%s: ignoring interrupt(s)\n", __FUNCTION__);
+                                       ata_chk_status(ap);
+                                       handled++;
+                               }
+
                        }
                }
        }
@@ -223,11 +250,11 @@ static struct scsi_host_template vsc_sata_sht = {
        .name                   = DRV_NAME,
        .ioctl                  = ata_scsi_ioctl,
        .queuecommand           = ata_scsi_queuecmd,
+       .eh_timed_out           = ata_scsi_timed_out,
        .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,