Merge branch 'master'
authorJeff Garzik <jeff@garzik.org>
Tue, 11 Apr 2006 16:51:40 +0000 (12:51 -0400)
committerJeff Garzik <jeff@garzik.org>
Tue, 11 Apr 2006 16:51:40 +0000 (12:51 -0400)
Conflicts:

drivers/scsi/libata-scsi.c
include/linux/libata.h

17 files changed:
1  2 
drivers/scsi/ahci.c
drivers/scsi/ata_piix.c
drivers/scsi/libata-scsi.c
drivers/scsi/pdc_adma.c
drivers/scsi/sata_mv.c
drivers/scsi/sata_nv.c
drivers/scsi/sata_promise.c
drivers/scsi/sata_qstor.c
drivers/scsi/sata_sil.c
drivers/scsi/sata_sil24.c
drivers/scsi/sata_sis.c
drivers/scsi/sata_svw.c
drivers/scsi/sata_sx4.c
drivers/scsi/sata_uli.c
drivers/scsi/sata_via.c
drivers/scsi/sata_vsc.c
include/linux/libata.h

diff --combined drivers/scsi/ahci.c
index ff48066d4c4f93c656b5472288691b3ff2ed0793,b4f8fb1d628b9d95ec70a28ffb81008eefb8f4d0..20fc0846e0bec26b2c824892797a08f8f7ccb4c2
@@@ -48,7 -48,7 +48,7 @@@
  #include <asm/io.h>
  
  #define DRV_NAME      "ahci"
 -#define DRV_VERSION   "1.2"
 +#define DRV_VERSION   "1.3"
  
  
  enum {
@@@ -207,7 -207,6 +207,6 @@@ static struct scsi_host_template ahci_s
        .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           = AHCI_MAX_SG,
@@@ -549,12 -548,6 +548,12 @@@ static int ahci_softreset(struct ata_po
  
        DPRINTK("ENTER\n");
  
 +      if (!sata_dev_present(ap)) {
 +              DPRINTK("PHY reports no device\n");
 +              *class = ATA_DEV_NONE;
 +              return 0;
 +      }
 +
        /* prepare for SRST (AHCI-1.1 10.4.1) */
        rc = ahci_stop_engine(ap);
        if (rc) {
diff --combined drivers/scsi/ata_piix.c
index 83839706f5e0fcaa29d408174accb8080e95c1aa,6dc88149f9f1537e0e20b708696a2949f053bac2..62dabf74188e5b7bbfd6c2d8c99698381ad2e7ee
@@@ -93,7 -93,7 +93,7 @@@
  #include <linux/libata.h>
  
  #define DRV_NAME      "ata_piix"
 -#define DRV_VERSION   "1.05"
 +#define DRV_VERSION   "1.10"
  
  enum {
        PIIX_IOCFG              = 0x54, /* IDE I/O configuration register */
@@@ -209,7 -209,6 +209,6 @@@ static struct scsi_host_template piix_s
        .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,
index c9c001490293ead278b2eb802091cb6e5c59785a,a0289ec3e283bd532c802c05c5cba0958305828a..5ae7613bc15728ed4a278b266ee1508c48816648
@@@ -53,6 -53,8 +53,6 @@@
  typedef unsigned int (*ata_xlat_func_t)(struct ata_queued_cmd *qc, const u8 *scsicmd);
  static struct ata_device *
  ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev);
 -static void ata_scsi_error(struct Scsi_Host *host);
 -enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd);
  
  #define RW_RECOVERY_MPAGE 0x1
  #define RW_RECOVERY_MPAGE_LEN 12
@@@ -98,6 -100,7 +98,7 @@@ static const u8 def_control_mpage[CONTR
   * It just needs the eh_timed_out hook.
   */
  struct scsi_transport_template ata_scsi_transport_template = {
+       .eh_strategy_handler    = ata_scsi_error,
        .eh_timed_out           = ata_scsi_timed_out,
  };
  
@@@ -544,12 -547,17 +545,12 @@@ void ata_gen_ata_desc_sense(struct ata_
  
        cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
  
 -      /*
 -       * Read the controller registers.
 -       */
 -      WARN_ON(qc->ap->ops->tf_read == NULL);
 -      qc->ap->ops->tf_read(qc->ap, tf);
 -
        /*
         * Use ata_to_sense_error() to map status register bits
         * onto sense key, asc & ascq.
         */
 -      if (tf->command & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) {
 +      if (qc->err_mask ||
 +          tf->command & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) {
                ata_to_sense_error(qc->ap->id, tf->command, tf->feature,
                                   &sb[1], &sb[2], &sb[3]);
                sb[1] &= 0x0f;
@@@ -614,12 -622,17 +615,12 @@@ void ata_gen_fixed_sense(struct ata_que
  
        cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
  
 -      /*
 -       * Read the controller registers.
 -       */
 -      WARN_ON(qc->ap->ops->tf_read == NULL);
 -      qc->ap->ops->tf_read(qc->ap, tf);
 -
        /*
         * Use ata_to_sense_error() to map status register bits
         * onto sense key, asc & ascq.
         */
 -      if (tf->command & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) {
 +      if (qc->err_mask ||
 +          tf->command & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) {
                ata_to_sense_error(qc->ap->id, tf->command, tf->feature,
                                   &sb[2], &sb[12], &sb[13]);
                sb[2] &= 0x0f;
@@@ -712,6 -725,137 +713,6 @@@ int ata_scsi_slave_config(struct scsi_d
        return 0;       /* scsi layer doesn't check return value, sigh */
  }
  
 -/**
 - *    ata_scsi_timed_out - SCSI layer time out callback
 - *    @cmd: timed out SCSI command
 - *
 - *    Handles SCSI layer timeout.  We race with normal completion of
 - *    the qc for @cmd.  If the qc is already gone, we lose and let
 - *    the scsi command finish (EH_HANDLED).  Otherwise, the qc has
 - *    timed out and EH should be invoked.  Prevent ata_qc_complete()
 - *    from finishing it by setting EH_SCHEDULED and return
 - *    EH_NOT_HANDLED.
 - *
 - *    LOCKING:
 - *    Called from timer context
 - *
 - *    RETURNS:
 - *    EH_HANDLED or EH_NOT_HANDLED
 - */
 -enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd)
 -{
 -      struct Scsi_Host *host = cmd->device->host;
 -      struct ata_port *ap = (struct ata_port *) &host->hostdata[0];
 -      unsigned long flags;
 -      struct ata_queued_cmd *qc;
 -      enum scsi_eh_timer_return ret = EH_HANDLED;
 -
 -      DPRINTK("ENTER\n");
 -
 -      spin_lock_irqsave(&ap->host_set->lock, flags);
 -      qc = ata_qc_from_tag(ap, ap->active_tag);
 -      if (qc) {
 -              WARN_ON(qc->scsicmd != cmd);
 -              qc->flags |= ATA_QCFLAG_EH_SCHEDULED;
 -              qc->err_mask |= AC_ERR_TIMEOUT;
 -              ret = EH_NOT_HANDLED;
 -      }
 -      spin_unlock_irqrestore(&ap->host_set->lock, flags);
 -
 -      DPRINTK("EXIT, ret=%d\n", ret);
 -      return ret;
 -}
 -
 -/**
 - *    ata_scsi_error - SCSI layer error handler callback
 - *    @host: SCSI host on which error occurred
 - *
 - *    Handles SCSI-layer-thrown error events.
 - *
 - *    LOCKING:
 - *    Inherited from SCSI layer (none, can sleep)
 - */
 -
 -static void ata_scsi_error(struct Scsi_Host *host)
 -{
 -      struct ata_port *ap;
 -      unsigned long flags;
 -
 -      DPRINTK("ENTER\n");
 -
 -      ap = (struct ata_port *) &host->hostdata[0];
 -
 -      spin_lock_irqsave(&ap->host_set->lock, flags);
 -      WARN_ON(ap->flags & ATA_FLAG_IN_EH);
 -      ap->flags |= ATA_FLAG_IN_EH;
 -      WARN_ON(ata_qc_from_tag(ap, ap->active_tag) == NULL);
 -      spin_unlock_irqrestore(&ap->host_set->lock, flags);
 -
 -      ata_port_flush_task(ap);
 -
 -      ap->ops->eng_timeout(ap);
 -
 -      WARN_ON(host->host_failed || !list_empty(&host->eh_cmd_q));
 -
 -      scsi_eh_flush_done_q(&ap->eh_done_q);
 -
 -      spin_lock_irqsave(&ap->host_set->lock, flags);
 -      ap->flags &= ~ATA_FLAG_IN_EH;
 -      spin_unlock_irqrestore(&ap->host_set->lock, flags);
 -
 -      DPRINTK("EXIT\n");
 -}
 -
 -static void ata_eh_scsidone(struct scsi_cmnd *scmd)
 -{
 -      /* nada */
 -}
 -
 -static void __ata_eh_qc_complete(struct ata_queued_cmd *qc)
 -{
 -      struct ata_port *ap = qc->ap;
 -      struct scsi_cmnd *scmd = qc->scsicmd;
 -      unsigned long flags;
 -
 -      spin_lock_irqsave(&ap->host_set->lock, flags);
 -      qc->scsidone = ata_eh_scsidone;
 -      __ata_qc_complete(qc);
 -      WARN_ON(ata_tag_valid(qc->tag));
 -      spin_unlock_irqrestore(&ap->host_set->lock, flags);
 -
 -      scsi_eh_finish_cmd(scmd, &ap->eh_done_q);
 -}
 -
 -/**
 - *    ata_eh_qc_complete - Complete an active ATA command from EH
 - *    @qc: Command to complete
 - *
 - *    Indicate to the mid and upper layers that an ATA command has
 - *    completed.  To be used from EH.
 - */
 -void ata_eh_qc_complete(struct ata_queued_cmd *qc)
 -{
 -      struct scsi_cmnd *scmd = qc->scsicmd;
 -      scmd->retries = scmd->allowed;
 -      __ata_eh_qc_complete(qc);
 -}
 -
 -/**
 - *    ata_eh_qc_retry - Tell midlayer to retry an ATA command after EH
 - *    @qc: Command to retry
 - *
 - *    Indicate to the mid and upper layers that an ATA command
 - *    should be retried.  To be used from EH.
 - *
 - *    SCSI midlayer limits the number of retries to scmd->allowed.
 - *    This function might need to adjust scmd->retries for commands
 - *    which get retried due to unrelated NCQ failures.
 - */
 -void ata_eh_qc_retry(struct ata_queued_cmd *qc)
 -{
 -      __ata_eh_qc_complete(qc);
 -}
 -
  /**
   *    ata_scsi_start_stop_xlat - Translate SCSI START STOP UNIT command
   *    @qc: Storage for translated ATA taskfile
@@@ -1051,7 -1195,6 +1052,7 @@@ static unsigned int ata_scsi_rw_xlat(st
        u64 block;
        u32 n_block;
  
 +      qc->flags |= ATA_QCFLAG_IO;
        tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
  
        if (scsicmd[0] == WRITE_10 || scsicmd[0] == WRITE_6 ||
@@@ -1198,14 -1341,11 +1199,14 @@@ static void ata_scsi_qc_complete(struc
         */
        if (((cdb[0] == ATA_16) || (cdb[0] == ATA_12)) &&
            ((cdb[2] & 0x20) || need_sense)) {
 +              qc->ap->ops->tf_read(qc->ap, &qc->tf);
                ata_gen_ata_desc_sense(qc);
        } else {
                if (!need_sense) {
                        cmd->result = SAM_STAT_GOOD;
                } else {
 +                      qc->ap->ops->tf_read(qc->ap, &qc->tf);
 +
                        /* TODO: decide which descriptor format to use
                         * for 48b LBA devices and call that here
                         * instead of the fixed desc, which is only
@@@ -1997,15 -2137,13 +1998,15 @@@ void ata_scsi_badcmd(struct scsi_cmnd *
  
  static void atapi_sense_complete(struct ata_queued_cmd *qc)
  {
 -      if (qc->err_mask && ((qc->err_mask & AC_ERR_DEV) == 0))
 +      if (qc->err_mask && ((qc->err_mask & AC_ERR_DEV) == 0)) {
                /* FIXME: not quite right; we don't want the
                 * translation of taskfile registers into
                 * a sense descriptors, since that's only
                 * correct for ATA, not ATAPI
                 */
 +              qc->ap->ops->tf_read(qc->ap, &qc->tf);
                ata_gen_ata_desc_sense(qc);
 +      }
  
        qc->scsidone(qc->scsicmd);
        ata_qc_free(qc);
@@@ -2073,15 -2211,17 +2074,15 @@@ static void atapi_qc_complete(struct at
                cmd->result = SAM_STAT_CHECK_CONDITION;
                atapi_request_sense(qc);
                return;
 -      }
 -
 -      else if (unlikely(err_mask))
 +      } else if (unlikely(err_mask)) {
                /* FIXME: not quite right; we don't want the
                 * translation of taskfile registers into
                 * a sense descriptors, since that's only
                 * correct for ATA, not ATAPI
                 */
 +              qc->ap->ops->tf_read(qc->ap, &qc->tf);
                ata_gen_ata_desc_sense(qc);
 -
 -      else {
 +      } else {
                u8 *scsicmd = cmd->cmnd;
  
                if ((scsicmd[0] == INQUIRY) && ((scsicmd[1] & 0x03) == 0)) {
@@@ -2163,9 -2303,11 +2164,9 @@@ static unsigned int atapi_xlat(struct a
                qc->tf.protocol = ATA_PROT_ATAPI_DMA;
                qc->tf.feature |= ATAPI_PKT_DMA;
  
 -#ifdef ATAPI_ENABLE_DMADIR
 -              /* some SATA bridges need us to indicate data xfer direction */
 -              if (cmd->sc_data_direction != DMA_TO_DEVICE)
 +              if (atapi_dmadir && (cmd->sc_data_direction != DMA_TO_DEVICE))
 +                      /* some SATA bridges need us to indicate data xfer direction */
                        qc->tf.feature |= ATAPI_DMADIR;
 -#endif
        }
  
        qc->nbytes = cmd->bufflen;
@@@ -2205,7 -2347,7 +2206,7 @@@ ata_scsi_find_dev(struct ata_port *ap, 
                     (scsidev->lun != 0)))
                return NULL;
  
 -      if (unlikely(!ata_dev_present(dev)))
 +      if (unlikely(!ata_dev_enabled(dev)))
                return NULL;
  
        if (!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) {
@@@ -2593,13 -2735,13 +2594,13 @@@ void ata_scsi_scan_host(struct ata_por
        struct ata_device *dev;
        unsigned int i;
  
 -      if (ap->flags & ATA_FLAG_PORT_DISABLED)
 +      if (ap->flags & ATA_FLAG_DISABLED)
                return;
  
        for (i = 0; i < ATA_MAX_DEVICES; i++) {
                dev = &ap->device[i];
  
 -              if (ata_dev_present(dev))
 +              if (ata_dev_enabled(dev))
                        scsi_scan_target(&ap->host->shost_gendev, 0, i, 0, 0);
        }
  }
diff --combined drivers/scsi/pdc_adma.c
index 1364b1da9e2ad3d75a7a80e3b54f85c12244fa09,5cda16cfacb030be42d043761ba16d076e145e3d..b9a3c566f8334de06563a13d6e59b59f4d5b904b
@@@ -46,7 -46,7 +46,7 @@@
  #include <linux/libata.h>
  
  #define DRV_NAME      "pdc_adma"
 -#define DRV_VERSION   "0.03"
 +#define DRV_VERSION   "0.04"
  
  /* macro to calculate base address for ATA regs */
  #define ADMA_ATA_REGS(base,port_no)   ((base) + ((port_no) * 0x40))
@@@ -143,7 -143,6 +143,6 @@@ static struct scsi_host_template adma_a
        .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,
@@@ -456,7 -455,7 +455,7 @@@ static inline unsigned int adma_intr_pk
                        continue;
                handled = 1;
                adma_enter_reg_mode(ap);
 -              if (ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))
 +              if (ap->flags & (ATA_FLAG_DISABLED | ATA_FLAG_NOINTR))
                        continue;
                pp = ap->private_data;
                if (!pp || pp->state != adma_state_pkt)
@@@ -481,7 -480,7 +480,7 @@@ static inline unsigned int adma_intr_mm
        for (port_no = 0; port_no < host_set->n_ports; ++port_no) {
                struct ata_port *ap;
                ap = host_set->ports[port_no];
 -              if (ap && (!(ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR)))) {
 +              if (ap && (!(ap->flags & (ATA_FLAG_DISABLED | ATA_FLAG_NOINTR)))) {
                        struct ata_queued_cmd *qc;
                        struct adma_port_priv *pp = ap->private_data;
                        if (!pp || pp->state != adma_state_mmio)
diff --combined drivers/scsi/sata_mv.c
index e9152f850003de2f143648f0c722d4bc283c1bac,b64b077573c2d675c8e891a56886bfe4c9691549..4aabc759fcec2a4775a7345eb60abf3cae2cd8b4
@@@ -378,7 -378,6 +378,6 @@@ static struct scsi_host_template mv_sh
        .name                   = DRV_NAME,
        .ioctl                  = ata_scsi_ioctl,
        .queuecommand           = ata_scsi_queuecmd,
-       .eh_strategy_handler    = ata_scsi_error,
        .can_queue              = MV_USE_Q_DEPTH,
        .this_id                = ATA_SHT_THIS_ID,
        .sg_tablesize           = MV_MAX_SG_CT / 2,
@@@ -1397,7 -1396,7 +1396,7 @@@ static void mv_host_intr(struct ata_hos
                        }
                }
  
 -              if (ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))
 +              if (ap->flags & (ATA_FLAG_DISABLED | ATA_FLAG_NOINTR))
                        continue;
  
                err_mask = ac_err_mask(ata_status);
@@@ -1991,7 -1990,7 +1990,7 @@@ comreset_retry
        tf.nsect = readb((void __iomem *) ap->ioaddr.nsect_addr);
  
        dev->class = ata_dev_classify(&tf);
 -      if (!ata_dev_present(dev)) {
 +      if (!ata_dev_enabled(dev)) {
                VPRINTK("Port disabled post-sig: No device present.\n");
                ata_port_disable(ap);
        }
diff --combined drivers/scsi/sata_nv.c
index c92fbd0989bd4802ffdc8a452b9fc080d243b715,9f553081b5e832525c8fde6fd33cea2c9058004e..3a70875be8bade59877d5efec5102db360e02dbe
@@@ -44,7 -44,7 +44,7 @@@
  #include <linux/libata.h>
  
  #define DRV_NAME                      "sata_nv"
 -#define DRV_VERSION                   "0.8"
 +#define DRV_VERSION                   "0.9"
  
  enum {
        NV_PORTS                        = 2,
@@@ -201,7 -201,6 +201,6 @@@ static struct scsi_host_template nv_sh
        .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,
@@@ -280,7 -279,7 +279,7 @@@ static irqreturn_t nv_interrupt (int ir
  
                ap = host_set->ports[i];
                if (ap &&
 -                  !(ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))) {
 +                  !(ap->flags & (ATA_FLAG_DISABLED | ATA_FLAG_NOINTR))) {
                        struct ata_queued_cmd *qc;
  
                        qc = ata_qc_from_tag(ap, ap->active_tag);
index 000844a4129fac540da133420b5dc8a1380832ac,7eb67a6bdc64ca4a08f3fb3739e63b0b4c6d706d..ddbc0c6dd9fe3887a2e2e0461c08168f002600b6
@@@ -111,7 -111,6 +111,6 @@@ static struct scsi_host_template pdc_at
        .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,
@@@ -534,7 -533,7 +533,7 @@@ static irqreturn_t pdc_interrupt (int i
                ap = host_set->ports[i];
                tmp = mask & (1 << (i + 1));
                if (tmp && ap &&
 -                  !(ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))) {
 +                  !(ap->flags & (ATA_FLAG_DISABLED | ATA_FLAG_NOINTR))) {
                        struct ata_queued_cmd *qc;
  
                        qc = ata_qc_from_tag(ap, ap->active_tag);
@@@ -677,6 -676,10 +676,6 @@@ static int pdc_ata_init_one (struct pci
        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;
index 0b5446ada5ca7efed25c43af8cdd67fb53259e38,886f3447dd48b25c669c8d0d99e13181c14e16b1..259c2dec4e21f6f26ec30654b8d235a52dd01a3c
@@@ -41,7 -41,7 +41,7 @@@
  #include <linux/libata.h>
  
  #define DRV_NAME      "sata_qstor"
 -#define DRV_VERSION   "0.05"
 +#define DRV_VERSION   "0.06"
  
  enum {
        QS_PORTS                = 4,
@@@ -132,7 -132,6 +132,6 @@@ static struct scsi_host_template qs_ata
        .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           = QS_MAX_PRD,
@@@ -396,7 -395,7 +395,7 @@@ static inline unsigned int qs_intr_pkt(
                                        sff1, sff0, port_no, sHST, sDST);
                        handled = 1;
                        if (ap && !(ap->flags &
 -                                  (ATA_FLAG_PORT_DISABLED|ATA_FLAG_NOINTR))) {
 +                                  (ATA_FLAG_DISABLED|ATA_FLAG_NOINTR))) {
                                struct ata_queued_cmd *qc;
                                struct qs_port_priv *pp = ap->private_data;
                                if (!pp || pp->state != qs_state_pkt)
@@@ -429,7 -428,7 +428,7 @@@ static inline unsigned int qs_intr_mmio
                struct ata_port *ap;
                ap = host_set->ports[port_no];
                if (ap &&
 -                  !(ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))) {
 +                  !(ap->flags & (ATA_FLAG_DISABLED | ATA_FLAG_NOINTR))) {
                        struct ata_queued_cmd *qc;
                        struct qs_port_priv *pp = ap->private_data;
                        if (!pp || pp->state != qs_state_mmio)
diff --combined drivers/scsi/sata_sil.c
index f29c3e733a00bac38e9ffd81e926138098f98805,106627299d55f002530bf12ef9e6105614c99175..c9333577330ed97989b22f1d737ec9874f282513
@@@ -46,7 -46,7 +46,7 @@@
  #include <linux/libata.h>
  
  #define DRV_NAME      "sata_sil"
 -#define DRV_VERSION   "0.9"
 +#define DRV_VERSION   "1.0"
  
  enum {
        /*
@@@ -146,7 -146,6 +146,6 @@@ static struct scsi_host_template sil_sh
        .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,
@@@ -264,7 -263,7 +263,7 @@@ static void sil_post_set_mode (struct a
  
        for (i = 0; i < 2; i++) {
                dev = &ap->device[i];
 -              if (!ata_dev_present(dev))
 +              if (!ata_dev_enabled(dev))
                        dev_mode[i] = 0;        /* PIO0/1/2 */
                else if (dev->flags & ATA_DFLAG_PIO)
                        dev_mode[i] = 1;        /* PIO3/4 */
@@@ -391,6 -390,10 +390,6 @@@ static int sil_init_one (struct pci_de
        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;
index 646756abb10e7e319079bd33a12facde400815cd,f7264fd611c2226bc71e6d8e552478a8eaaf2748..9aa7493ea146cba5245ed6f54af10aa9387de13f
@@@ -31,7 -31,7 +31,7 @@@
  #include <asm/io.h>
  
  #define DRV_NAME      "sata_sil24"
 -#define DRV_VERSION   "0.23"
 +#define DRV_VERSION   "0.24"
  
  /*
   * Port request block (PRB) 32 bytes
@@@ -281,7 -281,6 +281,6 @@@ static struct scsi_host_template sil24_
        .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,
@@@ -770,7 -769,7 +769,7 @@@ static irqreturn_t sil24_interrupt(int 
        for (i = 0; i < host_set->n_ports; i++)
                if (status & (1 << i)) {
                        struct ata_port *ap = host_set->ports[i];
 -                      if (ap && !(ap->flags & ATA_FLAG_PORT_DISABLED)) {
 +                      if (ap && !(ap->flags & ATA_FLAG_DISABLED)) {
                                sil24_host_intr(host_set->ports[i]);
                                handled++;
                        } else
diff --combined drivers/scsi/sata_sis.c
index eb3cf5b534dc5b359e476d0e28a4f43c3173c068,728530df2e0751d3f498a2a96c49b1cd6d3a2cb6..3097821688dc18e5a6928c7b2663aeda9d0b102e
@@@ -43,7 -43,7 +43,7 @@@
  #include <linux/libata.h>
  
  #define DRV_NAME      "sata_sis"
 -#define DRV_VERSION   "0.5"
 +#define DRV_VERSION   "0.6"
  
  enum {
        sis_180                 = 0,
@@@ -87,7 -87,6 +87,6 @@@ static struct scsi_host_template sis_sh
        .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           = ATA_MAX_PRD,
diff --combined drivers/scsi/sata_svw.c
index a20bc81547533f6b189db9e5cab27dcc9175f2d4,53b0d5c0a61f45b4c25f78326c7aad38ff441c42..e15c693e05390eb1a7d6601e50d3e3f6193285bb
@@@ -54,7 -54,7 +54,7 @@@
  #endif /* CONFIG_PPC_OF */
  
  #define DRV_NAME      "sata_svw"
 -#define DRV_VERSION   "1.07"
 +#define DRV_VERSION   "1.8"
  
  enum {
        /* Taskfile registers offsets */
@@@ -290,7 -290,6 +290,6 @@@ static struct scsi_host_template k2_sat
        .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,
diff --combined drivers/scsi/sata_sx4.c
index 801ac3787d5d40402e8a985a746a087ed282ca33,4139ad4b1df065fb00d51510207c9e13dfe41332..a669d0589889576719b960131ea0b3af6308d8b7
@@@ -46,7 -46,7 +46,7 @@@
  #include "sata_promise.h"
  
  #define DRV_NAME      "sata_sx4"
 -#define DRV_VERSION   "0.8"
 +#define DRV_VERSION   "0.9"
  
  
  enum {
@@@ -182,7 -182,6 +182,6 @@@ static struct scsi_host_template pdc_sa
        .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,
@@@ -834,7 -833,7 +833,7 @@@ static irqreturn_t pdc20621_interrupt (
                tmp = mask & (1 << i);
                VPRINTK("seq %u, port_no %u, ap %p, tmp %x\n", i, port_no, ap, tmp);
                if (tmp && ap &&
 -                  !(ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))) {
 +                  !(ap->flags & (ATA_FLAG_DISABLED | ATA_FLAG_NOINTR))) {
                        struct ata_queued_cmd *qc;
  
                        qc = ata_qc_from_tag(ap, ap->active_tag);
@@@ -1376,6 -1375,10 +1375,6 @@@ static int pdc_sata_init_one (struct pc
        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;
diff --combined drivers/scsi/sata_uli.c
index 513dd78ea6fedf8d709b056ceab89cbe047352d3,38b52bd3fa3f1d5772ca83a8cb3341c9fad24862..15f81bfc30f0e5cdd76ce392e88c0fee9ac2349a
@@@ -37,7 -37,7 +37,7 @@@
  #include <linux/libata.h>
  
  #define DRV_NAME      "sata_uli"
 -#define DRV_VERSION   "0.5"
 +#define DRV_VERSION   "0.6"
  
  enum {
        uli_5289                = 0,
@@@ -81,7 -81,6 +81,6 @@@ static struct scsi_host_template uli_sh
        .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,
diff --combined drivers/scsi/sata_via.c
index de4e0eb224bb64cea652c3c1477ff38a7baa0f9b,9e7ae4e0db324535b3f34fbe648173abe7dd83de..17aefab5f42fb1ec3ee292255c3877bbf030e3d6
@@@ -47,7 -47,7 +47,7 @@@
  #include <asm/io.h>
  
  #define DRV_NAME      "sata_via"
 -#define DRV_VERSION   "1.1"
 +#define DRV_VERSION   "1.2"
  
  enum board_ids_enum {
        vt6420,
@@@ -94,7 -94,6 +94,6 @@@ static struct scsi_host_template svia_s
        .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,
diff --combined drivers/scsi/sata_vsc.c
index cecc1f76256baf2736145a72d9576b279647291b,8a29ce340b472019b914e32ebfbebaa7f9463dc9..9646c39321293f35e8de1250568ab0f1e44323e1
@@@ -222,7 -222,7 +222,7 @@@ static irqreturn_t vsc_sata_interrupt (
                        ap = host_set->ports[i];
  
                        if (ap && !(ap->flags &
 -                                  (ATA_FLAG_PORT_DISABLED|ATA_FLAG_NOINTR))) {
 +                                  (ATA_FLAG_DISABLED|ATA_FLAG_NOINTR))) {
                                struct ata_queued_cmd *qc;
  
                                qc = ata_qc_from_tag(ap, ap->active_tag);
@@@ -263,7 -263,6 +263,6 @@@ static struct scsi_host_template vsc_sa
        .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,
diff --combined include/linux/libata.h
index 03231cb6b406479fe8cfed6c46e4e4a3338b0a85,b80d2e7fa6d25ba608c11d5bd0ca790c0653dfe1..a7161d42d18f07ac79b398a7544d1a5afd7c7f4e
@@@ -44,6 -44,7 +44,6 @@@
  #undef ATA_NDEBUG             /* define to disable quick runtime checks */
  #undef ATA_ENABLE_PATA                /* define to enable PATA support in some
                                 * low-level drivers */
 -#undef ATAPI_ENABLE_DMADIR    /* enables ATAPI DMADIR bridge support */
  
  
  /* note: prints function name for you */
@@@ -119,11 -120,9 +119,11 @@@ enum 
        ATA_SHT_USE_CLUSTERING  = 1,
  
        /* struct ata_device stuff */
 -      ATA_DFLAG_LBA48         = (1 << 0), /* device supports LBA48 */
 -      ATA_DFLAG_PIO           = (1 << 1), /* device currently in PIO mode */
 -      ATA_DFLAG_LBA           = (1 << 2), /* device supports LBA */
 +      ATA_DFLAG_LBA           = (1 << 0), /* device supports LBA */
 +      ATA_DFLAG_LBA48         = (1 << 1), /* device supports LBA48 */
 +      ATA_DFLAG_CFG_MASK      = (1 << 8) - 1,
 +
 +      ATA_DFLAG_PIO           = (1 << 8), /* device currently in PIO mode */
  
        ATA_DEV_UNKNOWN         = 0,    /* unknown device */
        ATA_DEV_ATA             = 1,    /* ATA device */
        ATA_DEV_NONE            = 5,    /* no device */
  
        /* struct ata_port flags */
 -      ATA_FLAG_SLAVE_POSS     = (1 << 1), /* host supports slave dev */
 +      ATA_FLAG_SLAVE_POSS     = (1 << 0), /* host supports slave dev */
                                            /* (doesn't imply presence) */
 -      ATA_FLAG_PORT_DISABLED  = (1 << 2), /* port is disabled, ignore it */
 -      ATA_FLAG_SATA           = (1 << 3),
 -      ATA_FLAG_NO_LEGACY      = (1 << 4), /* no legacy mode check */
 -      ATA_FLAG_SRST           = (1 << 5), /* (obsolete) use ATA SRST, not E.D.D. */
 -      ATA_FLAG_MMIO           = (1 << 6), /* use MMIO, not PIO */
 -      ATA_FLAG_SATA_RESET     = (1 << 7), /* (obsolete) use COMRESET */
 -      ATA_FLAG_PIO_DMA        = (1 << 8), /* PIO cmds via DMA */
 -      ATA_FLAG_NOINTR         = (1 << 9), /* FIXME: Remove this once
 -                                           * proper HSM is in place. */
 -      ATA_FLAG_DEBUGMSG       = (1 << 10),
 -      ATA_FLAG_NO_ATAPI       = (1 << 11), /* No ATAPI support */
 -
 -      ATA_FLAG_SUSPENDED      = (1 << 12), /* port is suspended */
 -
 -      ATA_FLAG_PIO_LBA48      = (1 << 13), /* Host DMA engine is LBA28 only */
 -      ATA_FLAG_IRQ_MASK       = (1 << 14), /* Mask IRQ in PIO xfers */
 -
 -      ATA_FLAG_FLUSH_PORT_TASK = (1 << 15), /* Flush port task */
 -      ATA_FLAG_IN_EH          = (1 << 16), /* EH in progress */
 -
 -      ATA_QCFLAG_ACTIVE       = (1 << 1), /* cmd not yet ack'd to scsi lyer */
 -      ATA_QCFLAG_SG           = (1 << 3), /* have s/g table? */
 -      ATA_QCFLAG_SINGLE       = (1 << 4), /* no s/g, just a single buffer */
 +      ATA_FLAG_SATA           = (1 << 1),
 +      ATA_FLAG_NO_LEGACY      = (1 << 2), /* no legacy mode check */
 +      ATA_FLAG_MMIO           = (1 << 3), /* use MMIO, not PIO */
 +      ATA_FLAG_SRST           = (1 << 4), /* (obsolete) use ATA SRST, not E.D.D. */
 +      ATA_FLAG_SATA_RESET     = (1 << 5), /* (obsolete) use COMRESET */
 +      ATA_FLAG_NO_ATAPI       = (1 << 6), /* No ATAPI support */
 +      ATA_FLAG_PIO_DMA        = (1 << 7), /* PIO cmds via DMA */
 +      ATA_FLAG_PIO_LBA48      = (1 << 8), /* Host DMA engine is LBA28 only */
 +      ATA_FLAG_IRQ_MASK       = (1 << 9), /* Mask IRQ in PIO xfers */
 +
 +      ATA_FLAG_NOINTR         = (1 << 16), /* FIXME: Remove this once
 +                                            * proper HSM is in place. */
 +      ATA_FLAG_DEBUGMSG       = (1 << 17),
 +      ATA_FLAG_FLUSH_PORT_TASK = (1 << 18), /* flush port task */
 +
 +      ATA_FLAG_DISABLED       = (1 << 19), /* port is disabled, ignore it */
 +      ATA_FLAG_SUSPENDED      = (1 << 20), /* port is suspended */
 +
 +      /* bits 24:31 of ap->flags are reserved for LLDD specific flags */
 +
 +      /* struct ata_queued_cmd flags */
 +      ATA_QCFLAG_ACTIVE       = (1 << 0), /* cmd not yet ack'd to scsi lyer */
 +      ATA_QCFLAG_SG           = (1 << 1), /* have s/g table? */
 +      ATA_QCFLAG_SINGLE       = (1 << 2), /* no s/g, just a single buffer */
        ATA_QCFLAG_DMAMAP       = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE,
 -      ATA_QCFLAG_EH_SCHEDULED = (1 << 5), /* EH scheduled */
 +      ATA_QCFLAG_IO           = (1 << 3), /* standard IO command */
 +      ATA_QCFLAG_EH_SCHEDULED = (1 << 4), /* EH scheduled */
  
        /* host set flags */
        ATA_HOST_SIMPLEX        = (1 << 0),     /* Host is simplex, one DMA channel per host_set only */
        /* size of buffer to pad xfers ending on unaligned boundaries */
        ATA_DMA_PAD_SZ          = 4,
        ATA_DMA_PAD_BUF_SZ      = ATA_DMA_PAD_SZ * ATA_MAX_QUEUE,
 -      
 -      /* Masks for port functions */
 +
 +      /* masks for port functions */
        ATA_PORT_PRIMARY        = (1 << 0),
        ATA_PORT_SECONDARY      = (1 << 1),
 +
 +      /* how hard are we gonna try to probe/recover devices */
 +      ATA_PROBE_MAX_TRIES     = 3,
  };
  
  enum hsm_task_states {
@@@ -403,7 -397,6 +403,7 @@@ struct ata_port 
        unsigned int            mwdma_mask;
        unsigned int            udma_mask;
        unsigned int            cbl;    /* cable type; ATA_CBL_xxx */
 +      unsigned int            sata_spd_limit; /* SATA PHY speed limit */
  
        struct ata_device       device[ATA_MAX_DEVICES];
  
@@@ -530,6 -523,8 +530,8 @@@ extern void ata_host_set_remove(struct 
  extern int ata_scsi_detect(struct scsi_host_template *sht);
  extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
  extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *));
+ extern void ata_eh_qc_complete(struct ata_queued_cmd *qc);
+ extern void ata_eh_qc_retry(struct ata_queued_cmd *qc);
  extern int ata_scsi_release(struct Scsi_Host *host);
  extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
  extern int ata_scsi_device_resume(struct scsi_device *);
@@@ -578,6 -573,7 +580,6 @@@ extern void ata_bmdma_stop(struct ata_q
  extern u8   ata_bmdma_status(struct ata_port *ap);
  extern void ata_bmdma_irq_clear(struct ata_port *ap);
  extern void __ata_qc_complete(struct ata_queued_cmd *qc);
 -extern void ata_eng_timeout(struct ata_port *ap);
  extern void ata_scsi_simulate(struct ata_port *ap, struct ata_device *dev,
                              struct scsi_cmnd *cmd,
                              void (*done)(struct scsi_cmnd *));
@@@ -632,14 -628,6 +634,14 @@@ extern int pci_test_config_bits(struct 
  extern unsigned long ata_pci_default_filter(const struct ata_port *, struct ata_device *, unsigned long);
  #endif /* CONFIG_PCI */
  
 +/*
 + * EH
 + */
 +extern int ata_scsi_error(struct Scsi_Host *host);
 +extern void ata_eng_timeout(struct ata_port *ap);
 +extern void ata_eh_qc_complete(struct ata_queued_cmd *qc);
 +extern void ata_eh_qc_retry(struct ata_queued_cmd *qc);
 +
  
  static inline int
  ata_sg_is_last(struct scatterlist *sg, struct ata_queued_cmd *qc)
@@@ -683,34 -671,14 +685,34 @@@ static inline unsigned int ata_tag_vali
        return (tag < ATA_MAX_QUEUE) ? 1 : 0;
  }
  
 -static inline unsigned int ata_class_present(unsigned int class)
 +static inline unsigned int ata_class_enabled(unsigned int class)
  {
        return class == ATA_DEV_ATA || class == ATA_DEV_ATAPI;
  }
  
 -static inline unsigned int ata_dev_present(const struct ata_device *dev)
 +static inline unsigned int ata_class_disabled(unsigned int class)
 +{
 +      return class == ATA_DEV_ATA_UNSUP || class == ATA_DEV_ATAPI_UNSUP;
 +}
 +
 +static inline unsigned int ata_class_absent(unsigned int class)
 +{
 +      return !ata_class_enabled(class) && !ata_class_disabled(class);
 +}
 +
 +static inline unsigned int ata_dev_enabled(const struct ata_device *dev)
 +{
 +      return ata_class_enabled(dev->class);
 +}
 +
 +static inline unsigned int ata_dev_disabled(const struct ata_device *dev)
 +{
 +      return ata_class_disabled(dev->class);
 +}
 +
 +static inline unsigned int ata_dev_absent(const struct ata_device *dev)
  {
 -      return ata_class_present(dev->class);
 +      return ata_class_absent(dev->class);
  }
  
  static inline u8 ata_chk_status(struct ata_port *ap)