]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Merge branch 'upstream'
authorJeff Garzik <jeff@garzik.org>
Sun, 2 Apr 2006 14:30:40 +0000 (10:30 -0400)
committerJeff Garzik <jeff@garzik.org>
Sun, 2 Apr 2006 14:30:40 +0000 (10:30 -0400)
Conflicts:

drivers/scsi/libata-core.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_sx4.c
drivers/scsi/sata_vsc.c
include/linux/libata.h

1  2 
drivers/scsi/libata-core.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_sx4.c
drivers/scsi/sata_vsc.c
include/linux/libata.h

index 597e9e8bcd2ca5813e7ac41500afef146405210e,8beba3cd9a56ea1ec123311fbdbe052d4f3edcb2..9de48dd4234a05d0ed55781c2f97e300b6818859
@@@ -3785,94 -3923,23 +4033,94 @@@ fsm_start
                break;
  
        case HSM_ST_LAST:
 -              qc_completed = ata_pio_complete(qc);
 -              break;
 +              if (unlikely(!ata_ok(status))) {
 +                      qc->err_mask |= __ac_err_mask(status);
 +                      ap->hsm_task_state = HSM_ST_ERR;
 +                      goto fsm_start;
 +              }
 +
 +              /* no more data to transfer */
 +              DPRINTK("ata%u: command complete, drv_stat 0x%x\n",
 +                      ap->id, status);
 +
 +              WARN_ON(qc->err_mask);
  
 -      case HSM_ST_POLL:
 -      case HSM_ST_LAST_POLL:
 -              timeout = ata_pio_poll(qc);
 +              ap->hsm_task_state = HSM_ST_IDLE;
 +
 +              /* complete taskfile transaction */
 +              if (in_wq)
 +                      ata_poll_qc_complete(qc);
 +              else
 +                      ata_qc_complete(qc);
 +
 +              poll_next = 0;
                break;
  
 -      case HSM_ST_TMOUT:
        case HSM_ST_ERR:
 -              ata_pio_error(qc);
 -              return;
 +              if (qc->tf.command != ATA_CMD_PACKET)
 +                      printk(KERN_ERR "ata%u: command error, drv_stat 0x%x\n",
 +                             ap->id, status);
 +
 +              /* make sure qc->err_mask is available to
 +               * know what's wrong and recover
 +               */
 +              WARN_ON(qc->err_mask == 0);
 +
 +              ap->hsm_task_state = HSM_ST_IDLE;
 +
 +              /* complete taskfile transaction */
 +              if (in_wq)
 +                      ata_poll_qc_complete(qc);
 +              else
 +                      ata_qc_complete(qc);
 +
 +              poll_next = 0;
 +              break;
 +      default:
 +              poll_next = 0;
 +              BUG();
        }
  
 -      if (timeout)
 -              ata_port_queue_task(ap, ata_pio_task, qc, timeout);
 -      else if (!qc_completed)
 +      return poll_next;
 +}
 +
 +static void ata_pio_task(void *_data)
 +{
-       struct ata_port *ap = _data;
-       struct ata_queued_cmd *qc;
++      struct ata_queued_cmd *qc = _data;
++      struct ata_port *ap = qc->ap;
 +      u8 status;
 +      int poll_next;
 +
 +fsm_start:
 +      WARN_ON(ap->hsm_task_state == HSM_ST_IDLE);
 +
 +      qc = ata_qc_from_tag(ap, ap->active_tag);
 +      WARN_ON(qc == NULL);
 +
 +      /*
 +       * This is purely heuristic.  This is a fast path.
 +       * Sometimes when we enter, BSY will be cleared in
 +       * a chk-status or two.  If not, the drive is probably seeking
 +       * or something.  Snooze for a couple msecs, then
 +       * chk-status again.  If still busy, queue delayed work.
 +       */
 +      status = ata_busy_wait(ap, ATA_BUSY, 5);
 +      if (status & ATA_BUSY) {
 +              msleep(2);
 +              status = ata_busy_wait(ap, ATA_BUSY, 10);
 +              if (status & ATA_BUSY) {
 +                      ata_port_queue_task(ap, ata_pio_task, ap, ATA_SHORT_PAUSE);
 +                      return;
 +              }
 +      }
 +
 +      /* move the HSM */
 +      poll_next = ata_hsm_move(ap, qc, status, 1);
 +
 +      /* another command or interrupt handler
 +       * may be running at this point.
 +       */
 +      if (poll_next)
                goto fsm_start;
  }
  
@@@ -4392,7 -4355,7 +4640,7 @@@ irqreturn_t ata_interrupt (int irq, voi
  
                ap = host_set->ports[i];
                if (ap &&
-                   !(ap->flags & ATA_FLAG_PORT_DISABLED)) {
 -                  !(ap->flags & (ATA_FLAG_DISABLED | ATA_FLAG_NOINTR))) {
++                  !(ap->flags & ATA_FLAG_DISABLED)) {
                        struct ata_queued_cmd *qc;
  
                        qc = ata_qc_from_tag(ap, ap->active_tag);
index ff4fec96271b7d907526e4654333ecd80e0942e2,d64073dd028fb2eaca88240dda1e7eae996986e2..a4dcb4352206077e3d616e5b2c3a2058f680ae98
@@@ -456,7 -456,7 +456,7 @@@ static inline unsigned int adma_intr_pk
                        continue;
                handled = 1;
                adma_enter_reg_mode(ap);
-               if (ap->flags & ATA_FLAG_PORT_DISABLED)
 -              if (ap->flags & (ATA_FLAG_DISABLED | ATA_FLAG_NOINTR))
++              if (ap->flags & ATA_FLAG_DISABLED)
                        continue;
                pp = ap->private_data;
                if (!pp || pp->state != adma_state_pkt)
@@@ -481,7 -481,7 +481,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))) {
 -              if (ap && (!(ap->flags & (ATA_FLAG_DISABLED | ATA_FLAG_NOINTR)))) {
++              if (ap && (!(ap->flags & ATA_FLAG_DISABLED))) {
                        struct ata_queued_cmd *qc;
                        struct adma_port_priv *pp = ap->private_data;
                        if (!pp || pp->state != adma_state_mmio)
index dc54f294fac8d287e3d0542bded48821eb9ce6a2,e9152f850003de2f143648f0c722d4bc283c1bac..fd9f2173f0622e3485ddf1aba7f4aded4820c8da
@@@ -1397,7 -1397,7 +1397,7 @@@ static void mv_host_intr(struct ata_hos
                        }
                }
  
-               if (ap && (ap->flags & ATA_FLAG_PORT_DISABLED))
 -              if (ap->flags & (ATA_FLAG_DISABLED | ATA_FLAG_NOINTR))
++              if (ap && (ap->flags & ATA_FLAG_DISABLED))
                        continue;
  
                err_mask = ac_err_mask(ata_status);
index 8a99c3827426ba19d0d482647a21a5b20874f5eb,72721ac482d8d7d74edc1decfce9e6337c529af2..be38f328a4796c6d39e606017f4b7b743d45a5e9
@@@ -280,7 -280,7 +280,7 @@@ static irqreturn_t nv_interrupt (int ir
  
                ap = host_set->ports[i];
                if (ap &&
-                   !(ap->flags & ATA_FLAG_PORT_DISABLED)) {
 -                  !(ap->flags & (ATA_FLAG_DISABLED | ATA_FLAG_NOINTR))) {
++                  !(ap->flags & ATA_FLAG_DISABLED)) {
                        struct ata_queued_cmd *qc;
  
                        qc = ata_qc_from_tag(ap, ap->active_tag);
index cf0eeba47eb6c5cb73743d4cab4eae539caa8de0,9557c7aa45e053b3d2178be94ff6d339f0d81c9a..322525d84907071001f2fc865bcbabcaeddb0a26
@@@ -535,7 -534,7 +535,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)) {
 -                  !(ap->flags & (ATA_FLAG_DISABLED | ATA_FLAG_NOINTR))) {
++                  !(ap->flags & ATA_FLAG_DISABLED)) {
                        struct ata_queued_cmd *qc;
  
                        qc = ata_qc_from_tag(ap, ap->active_tag);
index a547c1272a5ec99667379f2dff6ed25a4d866cda,8ef042a09448623dfb85c590bacfbc4ac993128f..f86858962fbed4e7688b57a375ffbe693d05d72b
@@@ -395,7 -395,8 +395,7 @@@ static inline unsigned int qs_intr_pkt(
                        DPRINTK("SFF=%08x%08x: sCHAN=%u sHST=%d sDST=%02x\n",
                                        sff1, sff0, port_no, sHST, sDST);
                        handled = 1;
-                       if (ap && !(ap->flags & ATA_FLAG_PORT_DISABLED)) {
 -                      if (ap && !(ap->flags &
 -                                  (ATA_FLAG_DISABLED|ATA_FLAG_NOINTR))) {
++                      if (ap && !(ap->flags & ATA_FLAG_DISABLED)) {
                                struct ata_queued_cmd *qc;
                                struct qs_port_priv *pp = ap->private_data;
                                if (!pp || pp->state != qs_state_pkt)
@@@ -428,7 -429,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)) {
 -                  !(ap->flags & (ATA_FLAG_DISABLED | ATA_FLAG_NOINTR))) {
++                  !(ap->flags & ATA_FLAG_DISABLED)) {
                        struct ata_queued_cmd *qc;
                        struct qs_port_priv *pp = ap->private_data;
                        if (!pp || pp->state != qs_state_mmio)
index 2d6b091a9eaf2efa4d229489d0b0d8c5029c540e,3af28ef76fd979be5730c9453da45292349c46d9..45c78c399bfd272317a68881f7db2197f16390a4
@@@ -834,7 -834,7 +834,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)) {
 -                  !(ap->flags & (ATA_FLAG_DISABLED | ATA_FLAG_NOINTR))) {
++                  !(ap->flags & ATA_FLAG_DISABLED)) {
                        struct ata_queued_cmd *qc;
  
                        qc = ata_qc_from_tag(ap, ap->active_tag);
index 5af6d5f9f4bd43e8ffdfb016cac92581b75f30e2,cecc1f76256baf2736145a72d9576b279647291b..b7d6a31628c21e25276b7c93672d8b241ac78eaf
@@@ -221,15 -221,8 +221,15 @@@ static irqreturn_t vsc_sata_interrupt (
  
                        ap = host_set->ports[i];
  
 -                      if (ap && !(ap->flags &
 -                                  (ATA_FLAG_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)) {
++                      if (ap && !(ap->flags & ATA_FLAG_DISABLED)) {
                                struct ata_queued_cmd *qc;
  
                                qc = ata_qc_from_tag(ap, ap->active_tag);
index b0171e9accc4c7ef912e57a953a9625fb749ac59,75bdee09c30766318ab96a62396d650b87122d97..cc6cc08e80100abc7a2bd880ee1c8269febbcc89
@@@ -120,10 -120,11 +120,12 @@@ 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_CDB_INTR      = (1 << 3), /* device asserts INTRQ when ready for CDB */
+       ATA_DFLAG_LBA           = (1 << 0), /* device supports LBA */
+       ATA_DFLAG_LBA48         = (1 << 1), /* device supports LBA48 */
++      ATA_DFLAG_CDB_INTR      = (1 << 2), /* device asserts INTRQ when ready for CDB */
+       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_PIO_POLLING    = (1 << 9), /* use polling PIO if LLD
-                                            * doesn't handle PIO interrupts */
-       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_PIO_POLLING    = (1 << 10), /* use polling PIO if LLD
++                                            * doesn't handle PIO interrupts */
 -      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 */