Merge /spare/repo/linux-2.6/
authorJeff Garzik <jgarzik@pobox.com>
Fri, 23 Sep 2005 23:03:21 +0000 (19:03 -0400)
committerJeff Garzik <jgarzik@pobox.com>
Fri, 23 Sep 2005 23:03:21 +0000 (19:03 -0400)
1  2 
drivers/scsi/libata-core.c
include/linux/pci_ids.h

index 72bdc91e148c418e1b929f3a19f320a0f685a560,d92273cbe0de279cdb5e9351c33a45b63fc8b397..e5b01997117a9965249cb734b7c00f43b7d9bbd8
@@@ -2465,9 -2465,12 +2465,12 @@@ static unsigned long ata_pio_poll(struc
   *
   *    LOCKING:
   *    None.  (executing in kernel thread context)
+  *
+  *    RETURNS:
+  *    Non-zero if qc completed, zero otherwise.
   */
  
- static void ata_pio_complete (struct ata_port *ap)
+ static int ata_pio_complete (struct ata_port *ap)
  {
        struct ata_queued_cmd *qc;
        u8 drv_stat;
                if (drv_stat & (ATA_BUSY | ATA_DRQ)) {
                        ap->pio_task_state = PIO_ST_LAST_POLL;
                        ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO;
-                       return;
+                       return 0;
                }
        }
  
        drv_stat = ata_wait_idle(ap);
        if (!ata_ok(drv_stat)) {
                ap->pio_task_state = PIO_ST_ERR;
-               return;
+               return 0;
        }
  
        qc = ata_qc_from_tag(ap, ap->active_tag);
        ap->pio_task_state = PIO_ST_IDLE;
  
        ata_poll_qc_complete(qc, drv_stat);
+       /* another command may start at this point */
+       return 1;
  }
  
  
@@@ -2709,7 -2716,7 +2716,7 @@@ static void __atapi_pio_bytes(struct at
  
  next_sg:
        if (unlikely(qc->cursg >= qc->n_elem)) {
-               /* 
+               /*
                 * The end of qc->sg is reached and the device expects
                 * more data to transfer. In order not to overrun qc->sg
                 * and fulfill length specified in the byte count register,
                unsigned int i;
  
                if (words) /* warning if bytes > 1 */
-                       printk(KERN_WARNING "ata%u: %u bytes trailing data\n", 
+                       printk(KERN_WARNING "ata%u: %u bytes trailing data\n",
                               ap->id, bytes);
  
                for (i = 0; i < words; i++)
@@@ -2849,9 -2856,7 +2856,7 @@@ static void ata_pio_block(struct ata_po
        if (is_atapi_taskfile(&qc->tf)) {
                /* no more data to transfer or unsupported ATAPI command */
                if ((status & ATA_DRQ) == 0) {
-                       ap->pio_task_state = PIO_ST_IDLE;
-                       ata_poll_qc_complete(qc, status);
+                       ap->pio_task_state = PIO_ST_LAST;
                        return;
                }
  
@@@ -2887,7 -2892,12 +2892,12 @@@ static void ata_pio_error(struct ata_po
  static void ata_pio_task(void *_data)
  {
        struct ata_port *ap = _data;
-       unsigned long timeout = 0;
+       unsigned long timeout;
+       int qc_completed;
+ fsm_start:
+       timeout = 0;
+       qc_completed = 0;
  
        switch (ap->pio_task_state) {
        case PIO_ST_IDLE:
                break;
  
        case PIO_ST_LAST:
-               ata_pio_complete(ap);
+               qc_completed = ata_pio_complete(ap);
                break;
  
        case PIO_ST_POLL:
        }
  
        if (timeout)
-               queue_delayed_work(ata_wq, &ap->pio_task,
-                                  timeout);
-       else
-               queue_work(ata_wq, &ap->pio_task);
+               queue_delayed_work(ata_wq, &ap->pio_task, timeout);
+       else if (!qc_completed)
+               goto fsm_start;
  }
  
  static void atapi_request_sense(struct ata_port *ap, struct ata_device *dev,
@@@ -4122,53 -4131,6 +4131,53 @@@ err_out
        return 0;
  }
  
 +/**
 + *    ata_host_set_remove - PCI layer callback for device removal
 + *    @host_set: ATA host set that was removed
 + *
 + *    Unregister all objects associated with this host set. Free those 
 + *    objects.
 + *
 + *    LOCKING:
 + *    Inherited from calling layer (may sleep).
 + */
 +
 +
 +void ata_host_set_remove(struct ata_host_set *host_set)
 +{
 +      struct ata_port *ap;
 +      unsigned int i;
 +
 +      for (i = 0; i < host_set->n_ports; i++) {
 +              ap = host_set->ports[i];
 +              scsi_remove_host(ap->host);
 +      }
 +
 +      free_irq(host_set->irq, host_set);
 +
 +      for (i = 0; i < host_set->n_ports; i++) {
 +              ap = host_set->ports[i];
 +
 +              ata_scsi_release(ap->host);
 +
 +              if ((ap->flags & ATA_FLAG_NO_LEGACY) == 0) {
 +                      struct ata_ioports *ioaddr = &ap->ioaddr;
 +
 +                      if (ioaddr->cmd_addr == 0x1f0)
 +                              release_region(0x1f0, 8);
 +                      else if (ioaddr->cmd_addr == 0x170)
 +                              release_region(0x170, 8);
 +              }
 +
 +              scsi_host_put(ap->host);
 +      }
 +
 +      if (host_set->ops->host_stop)
 +              host_set->ops->host_stop(host_set);
 +
 +      kfree(host_set);
 +}
 +
  /**
   *    ata_scsi_release - SCSI layer callback hook for host unload
   *    @host: libata host to be unloaded
@@@ -4509,8 -4471,39 +4518,8 @@@ void ata_pci_remove_one (struct pci_de
  {
        struct device *dev = pci_dev_to_dev(pdev);
        struct ata_host_set *host_set = dev_get_drvdata(dev);
 -      struct ata_port *ap;
 -      unsigned int i;
 -
 -      for (i = 0; i < host_set->n_ports; i++) {
 -              ap = host_set->ports[i];
 -
 -              scsi_remove_host(ap->host);
 -      }
 -
 -      free_irq(host_set->irq, host_set);
 -
 -      for (i = 0; i < host_set->n_ports; i++) {
 -              ap = host_set->ports[i];
 -
 -              ata_scsi_release(ap->host);
 -
 -              if ((ap->flags & ATA_FLAG_NO_LEGACY) == 0) {
 -                      struct ata_ioports *ioaddr = &ap->ioaddr;
 -
 -                      if (ioaddr->cmd_addr == 0x1f0)
 -                              release_region(0x1f0, 8);
 -                      else if (ioaddr->cmd_addr == 0x170)
 -                              release_region(0x170, 8);
 -              }
 -
 -              scsi_host_put(ap->host);
 -      }
 -
 -      if (host_set->ops->host_stop)
 -              host_set->ops->host_stop(host_set);
 -
 -      kfree(host_set);
  
 +      ata_host_set_remove(host_set);
        pci_release_regions(pdev);
        pci_disable_device(pdev);
        dev_set_drvdata(dev, NULL);
@@@ -4580,7 -4573,6 +4589,7 @@@ module_exit(ata_exit)
  EXPORT_SYMBOL_GPL(ata_std_bios_param);
  EXPORT_SYMBOL_GPL(ata_std_ports);
  EXPORT_SYMBOL_GPL(ata_device_add);
 +EXPORT_SYMBOL_GPL(ata_host_set_remove);
  EXPORT_SYMBOL_GPL(ata_sg_init);
  EXPORT_SYMBOL_GPL(ata_sg_init_one);
  EXPORT_SYMBOL_GPL(ata_qc_complete);
diff --combined include/linux/pci_ids.h
index cb414ea42f02ea899f814327c83177f63188b29f,c49d28eca561852803437ecc3555cec52bad8413..b86a4b77007ef05108637f959695cd52eaa304e0
  #define PCI_DEVICE_ID_AMI_MEGARAID2   0x9060
  
  #define PCI_VENDOR_ID_AMD             0x1022
+ #define PCI_DEVICE_ID_AMD_K8_NB               0x1100
  #define PCI_DEVICE_ID_AMD_LANCE               0x2000
  #define PCI_DEVICE_ID_AMD_LANCE_HOME  0x2001
  #define PCI_DEVICE_ID_AMD_SCSI                0x2020
  #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA        0x0266
  #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2       0x0267
  #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE 0x036E
 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA        0x036F
 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA        0x037E
 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2       0x037F
  #define PCI_DEVICE_ID_NVIDIA_NVENET_12                0x0268
  #define PCI_DEVICE_ID_NVIDIA_NVENET_13                0x0269
  #define PCI_DEVICE_ID_NVIDIA_MCP51_AUDIO      0x026B
  #define PCI_DEVICE_ID_RME_DIGI96      0x3fc0
  #define PCI_DEVICE_ID_RME_DIGI96_8    0x3fc1
  #define PCI_DEVICE_ID_RME_DIGI96_8_PRO        0x3fc2
- #define PCI_DEVICE_IDRME__DIGI96_8_PAD_OR_PST 0x3fc3
+ #define PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST 0x3fc3
  #define PCI_DEVICE_ID_XILINX_HAMMERFALL       0x3fc4
  #define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP 0x3fc5
  #define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP_MADI 0x3fc6
  
  #define PCI_VENDOR_ID_INFINICON               0x1820
  
+ #define PCI_VENDOR_ID_SITECOM         0x182d
+ #define PCI_DEVICE_ID_SITECOM_DC105V2 0x3069
  #define PCI_VENDOR_ID_TOPSPIN         0x1867
  
  #define PCI_VENDOR_ID_TDI               0x192E