aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ata/libata-core.c66
-rw-r--r--drivers/ata/libata-scsi.c3
-rw-r--r--drivers/ata/libata-sff.c10
-rw-r--r--drivers/ata/pata_bf54x.c16
-rw-r--r--drivers/ata/pata_octeon_cf.c9
-rw-r--r--drivers/ata/pdc_adma.c66
-rw-r--r--drivers/ata/sata_inic162x.c17
-rw-r--r--drivers/ata/sata_mv.c18
-rw-r--r--drivers/ata/sata_nv.c236
-rw-r--r--drivers/ata/sata_promise.c6
-rw-r--r--drivers/ata/sata_qstor.c79
-rw-r--r--drivers/ata/sata_sil.c3
-rw-r--r--drivers/ata/sata_sil24.c9
-rw-r--r--drivers/ata/sata_sx4.c3
-rw-r--r--drivers/ata/sata_vsc.c10
-rw-r--r--drivers/scsi/ipr.c6
-rw-r--r--drivers/scsi/libsas/sas_scsi_host.c2
-rw-r--r--include/linux/libata.h8
18 files changed, 209 insertions, 358 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 86f405b4831..3d8b62f7441 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1907,22 +1907,6 @@ unsigned ata_exec_internal_sg(struct ata_device *dev,
1907 ap->qc_active = preempted_qc_active; 1907 ap->qc_active = preempted_qc_active;
1908 ap->nr_active_links = preempted_nr_active_links; 1908 ap->nr_active_links = preempted_nr_active_links;
1909 1909
1910 /* XXX - Some LLDDs (sata_mv) disable port on command failure.
1911 * Until those drivers are fixed, we detect the condition
1912 * here, fail the command with AC_ERR_SYSTEM and reenable the
1913 * port.
1914 *
1915 * Note that this doesn't change any behavior as internal
1916 * command failure results in disabling the device in the
1917 * higher layer for LLDDs without new reset/EH callbacks.
1918 *
1919 * Kill the following code as soon as those drivers are fixed.
1920 */
1921 if (ap->flags & ATA_FLAG_DISABLED) {
1922 err_mask |= AC_ERR_SYSTEM;
1923 ata_port_probe(ap);
1924 }
1925
1926 spin_unlock_irqrestore(ap->lock, flags); 1910 spin_unlock_irqrestore(ap->lock, flags);
1927 1911
1928 if ((err_mask & AC_ERR_TIMEOUT) && auto_timeout) 1912 if ((err_mask & AC_ERR_TIMEOUT) && auto_timeout)
@@ -2768,8 +2752,6 @@ int ata_bus_probe(struct ata_port *ap)
2768 int rc; 2752 int rc;
2769 struct ata_device *dev; 2753 struct ata_device *dev;
2770 2754
2771 ata_port_probe(ap);
2772
2773 ata_for_each_dev(dev, &ap->link, ALL) 2755 ata_for_each_dev(dev, &ap->link, ALL)
2774 tries[dev->devno] = ATA_PROBE_MAX_TRIES; 2756 tries[dev->devno] = ATA_PROBE_MAX_TRIES;
2775 2757
@@ -2797,8 +2779,7 @@ int ata_bus_probe(struct ata_port *ap)
2797 ap->ops->phy_reset(ap); 2779 ap->ops->phy_reset(ap);
2798 2780
2799 ata_for_each_dev(dev, &ap->link, ALL) { 2781 ata_for_each_dev(dev, &ap->link, ALL) {
2800 if (!(ap->flags & ATA_FLAG_DISABLED) && 2782 if (dev->class != ATA_DEV_UNKNOWN)
2801 dev->class != ATA_DEV_UNKNOWN)
2802 classes[dev->devno] = dev->class; 2783 classes[dev->devno] = dev->class;
2803 else 2784 else
2804 classes[dev->devno] = ATA_DEV_NONE; 2785 classes[dev->devno] = ATA_DEV_NONE;
@@ -2806,8 +2787,6 @@ int ata_bus_probe(struct ata_port *ap)
2806 dev->class = ATA_DEV_UNKNOWN; 2787 dev->class = ATA_DEV_UNKNOWN;
2807 } 2788 }
2808 2789
2809 ata_port_probe(ap);
2810
2811 /* read IDENTIFY page and configure devices. We have to do the identify 2790 /* read IDENTIFY page and configure devices. We have to do the identify
2812 specific sequence bass-ackwards so that PDIAG- is released by 2791 specific sequence bass-ackwards so that PDIAG- is released by
2813 the slave device */ 2792 the slave device */
@@ -2857,8 +2836,6 @@ int ata_bus_probe(struct ata_port *ap)
2857 ata_for_each_dev(dev, &ap->link, ENABLED) 2836 ata_for_each_dev(dev, &ap->link, ENABLED)
2858 return 0; 2837 return 0;
2859 2838
2860 /* no device present, disable port */
2861 ata_port_disable(ap);
2862 return -ENODEV; 2839 return -ENODEV;
2863 2840
2864 fail: 2841 fail:
@@ -2890,22 +2867,6 @@ int ata_bus_probe(struct ata_port *ap)
2890} 2867}
2891 2868
2892/** 2869/**
2893 * ata_port_probe - Mark port as enabled
2894 * @ap: Port for which we indicate enablement
2895 *
2896 * Modify @ap data structure such that the system
2897 * thinks that the entire port is enabled.
2898 *
2899 * LOCKING: host lock, or some other form of
2900 * serialization.
2901 */
2902
2903void ata_port_probe(struct ata_port *ap)
2904{
2905 ap->flags &= ~ATA_FLAG_DISABLED;
2906}
2907
2908/**
2909 * sata_print_link_status - Print SATA link status 2870 * sata_print_link_status - Print SATA link status
2910 * @link: SATA link to printk link status about 2871 * @link: SATA link to printk link status about
2911 * 2872 *
@@ -2952,26 +2913,6 @@ struct ata_device *ata_dev_pair(struct ata_device *adev)
2952} 2913}
2953 2914
2954/** 2915/**
2955 * ata_port_disable - Disable port.
2956 * @ap: Port to be disabled.
2957 *
2958 * Modify @ap data structure such that the system
2959 * thinks that the entire port is disabled, and should
2960 * never attempt to probe or communicate with devices
2961 * on this port.
2962 *
2963 * LOCKING: host lock, or some other form of
2964 * serialization.
2965 */
2966
2967void ata_port_disable(struct ata_port *ap)
2968{
2969 ap->link.device[0].class = ATA_DEV_NONE;
2970 ap->link.device[1].class = ATA_DEV_NONE;
2971 ap->flags |= ATA_FLAG_DISABLED;
2972}
2973
2974/**
2975 * sata_down_spd_limit - adjust SATA spd limit downward 2916 * sata_down_spd_limit - adjust SATA spd limit downward
2976 * @link: Link to adjust SATA spd limit for 2917 * @link: Link to adjust SATA spd limit for
2977 * @spd_limit: Additional limit 2918 * @spd_limit: Additional limit
@@ -5716,7 +5657,6 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
5716 5657
5717 ap->pflags |= ATA_PFLAG_INITIALIZING; 5658 ap->pflags |= ATA_PFLAG_INITIALIZING;
5718 ap->lock = &host->lock; 5659 ap->lock = &host->lock;
5719 ap->flags = ATA_FLAG_DISABLED;
5720 ap->print_id = -1; 5660 ap->print_id = -1;
5721 ap->ctl = ATA_DEVCTL_OBS; 5661 ap->ctl = ATA_DEVCTL_OBS;
5722 ap->host = host; 5662 ap->host = host;
@@ -6145,8 +6085,6 @@ static void async_port_probe(void *data, async_cookie_t cookie)
6145 struct ata_eh_info *ehi = &ap->link.eh_info; 6085 struct ata_eh_info *ehi = &ap->link.eh_info;
6146 unsigned long flags; 6086 unsigned long flags;
6147 6087
6148 ata_port_probe(ap);
6149
6150 /* kick EH for boot probing */ 6088 /* kick EH for boot probing */
6151 spin_lock_irqsave(ap->lock, flags); 6089 spin_lock_irqsave(ap->lock, flags);
6152 6090
@@ -6823,7 +6761,6 @@ EXPORT_SYMBOL_GPL(ata_port_start);
6823EXPORT_SYMBOL_GPL(ata_do_set_mode); 6761EXPORT_SYMBOL_GPL(ata_do_set_mode);
6824EXPORT_SYMBOL_GPL(ata_std_qc_defer); 6762EXPORT_SYMBOL_GPL(ata_std_qc_defer);
6825EXPORT_SYMBOL_GPL(ata_noop_qc_prep); 6763EXPORT_SYMBOL_GPL(ata_noop_qc_prep);
6826EXPORT_SYMBOL_GPL(ata_port_probe);
6827EXPORT_SYMBOL_GPL(ata_dev_disable); 6764EXPORT_SYMBOL_GPL(ata_dev_disable);
6828EXPORT_SYMBOL_GPL(sata_set_spd); 6765EXPORT_SYMBOL_GPL(sata_set_spd);
6829EXPORT_SYMBOL_GPL(ata_wait_after_reset); 6766EXPORT_SYMBOL_GPL(ata_wait_after_reset);
@@ -6835,7 +6772,6 @@ EXPORT_SYMBOL_GPL(sata_std_hardreset);
6835EXPORT_SYMBOL_GPL(ata_std_postreset); 6772EXPORT_SYMBOL_GPL(ata_std_postreset);
6836EXPORT_SYMBOL_GPL(ata_dev_classify); 6773EXPORT_SYMBOL_GPL(ata_dev_classify);
6837EXPORT_SYMBOL_GPL(ata_dev_pair); 6774EXPORT_SYMBOL_GPL(ata_dev_pair);
6838EXPORT_SYMBOL_GPL(ata_port_disable);
6839EXPORT_SYMBOL_GPL(ata_ratelimit); 6775EXPORT_SYMBOL_GPL(ata_ratelimit);
6840EXPORT_SYMBOL_GPL(ata_wait_register); 6776EXPORT_SYMBOL_GPL(ata_wait_register);
6841EXPORT_SYMBOL_GPL(ata_scsi_queuecmd); 6777EXPORT_SYMBOL_GPL(ata_scsi_queuecmd);
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 0088cdeb0b1..cfa9dd3d725 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3345,9 +3345,6 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync)
3345 struct ata_link *link; 3345 struct ata_link *link;
3346 struct ata_device *dev; 3346 struct ata_device *dev;
3347 3347
3348 if (ap->flags & ATA_FLAG_DISABLED)
3349 return;
3350
3351 repeat: 3348 repeat:
3352 ata_for_each_link(link, ap, EDGE) { 3349 ata_for_each_link(link, ap, EDGE) {
3353 ata_for_each_dev(dev, link, ENABLED) { 3350 ata_for_each_dev(dev, link, ENABLED) {
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index d5dd88d6dea..0e2c972292c 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -1807,9 +1807,6 @@ retry:
1807 struct ata_port *ap = host->ports[i]; 1807 struct ata_port *ap = host->ports[i];
1808 struct ata_queued_cmd *qc; 1808 struct ata_queued_cmd *qc;
1809 1809
1810 if (unlikely(ap->flags & ATA_FLAG_DISABLED))
1811 continue;
1812
1813 qc = ata_qc_from_tag(ap, ap->link.active_tag); 1810 qc = ata_qc_from_tag(ap, ap->link.active_tag);
1814 if (qc) { 1811 if (qc) {
1815 if (!(qc->tf.flags & ATA_TFLAG_POLLING)) 1812 if (!(qc->tf.flags & ATA_TFLAG_POLLING))
@@ -1884,11 +1881,8 @@ void ata_sff_lost_interrupt(struct ata_port *ap)
1884 1881
1885 /* Only one outstanding command per SFF channel */ 1882 /* Only one outstanding command per SFF channel */
1886 qc = ata_qc_from_tag(ap, ap->link.active_tag); 1883 qc = ata_qc_from_tag(ap, ap->link.active_tag);
1887 /* Check we have a live one.. */ 1884 /* We cannot lose an interrupt on a non-existent or polled command */
1888 if (qc == NULL || !(qc->flags & ATA_QCFLAG_ACTIVE)) 1885 if (!qc || qc->tf.flags & ATA_TFLAG_POLLING)
1889 return;
1890 /* We cannot lose an interrupt on a polled command */
1891 if (qc->tf.flags & ATA_TFLAG_POLLING)
1892 return; 1886 return;
1893 /* See if the controller thinks it is still busy - if so the command 1887 /* See if the controller thinks it is still busy - if so the command
1894 isn't a lost IRQ but is still in progress */ 1888 isn't a lost IRQ but is still in progress */
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c
index 07c110470e2..e9bf44cf414 100644
--- a/drivers/ata/pata_bf54x.c
+++ b/drivers/ata/pata_bf54x.c
@@ -1400,18 +1400,12 @@ static irqreturn_t bfin_ata_interrupt(int irq, void *dev_instance)
1400 spin_lock_irqsave(&host->lock, flags); 1400 spin_lock_irqsave(&host->lock, flags);
1401 1401
1402 for (i = 0; i < host->n_ports; i++) { 1402 for (i = 0; i < host->n_ports; i++) {
1403 struct ata_port *ap; 1403 struct ata_port *ap = host->ports[i];
1404 struct ata_queued_cmd *qc;
1404 1405
1405 ap = host->ports[i]; 1406 qc = ata_qc_from_tag(ap, ap->link.active_tag);
1406 if (ap && 1407 if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)))
1407 !(ap->flags & ATA_FLAG_DISABLED)) { 1408 handled |= bfin_ata_host_intr(ap, qc);
1408 struct ata_queued_cmd *qc;
1409
1410 qc = ata_qc_from_tag(ap, ap->link.active_tag);
1411 if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) &&
1412 (qc->flags & ATA_QCFLAG_ACTIVE))
1413 handled |= bfin_ata_host_intr(ap, qc);
1414 }
1415 } 1409 }
1416 1410
1417 spin_unlock_irqrestore(&host->lock, flags); 1411 spin_unlock_irqrestore(&host->lock, flags);
diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
index 303ca7e8240..3001109352e 100644
--- a/drivers/ata/pata_octeon_cf.c
+++ b/drivers/ata/pata_octeon_cf.c
@@ -654,9 +654,6 @@ static irqreturn_t octeon_cf_interrupt(int irq, void *dev_instance)
654 ap = host->ports[i]; 654 ap = host->ports[i];
655 ocd = ap->dev->platform_data; 655 ocd = ap->dev->platform_data;
656 656
657 if (ap->flags & ATA_FLAG_DISABLED)
658 continue;
659
660 ocd = ap->dev->platform_data; 657 ocd = ap->dev->platform_data;
661 cf_port = ap->private_data; 658 cf_port = ap->private_data;
662 dma_int.u64 = 659 dma_int.u64 =
@@ -666,8 +663,7 @@ static irqreturn_t octeon_cf_interrupt(int irq, void *dev_instance)
666 663
667 qc = ata_qc_from_tag(ap, ap->link.active_tag); 664 qc = ata_qc_from_tag(ap, ap->link.active_tag);
668 665
669 if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) && 666 if (qc && !(qc->tf.flags & ATA_TFLAG_POLLING)) {
670 (qc->flags & ATA_QCFLAG_ACTIVE)) {
671 if (dma_int.s.done && !dma_cfg.s.en) { 667 if (dma_int.s.done && !dma_cfg.s.en) {
672 if (!sg_is_last(qc->cursg)) { 668 if (!sg_is_last(qc->cursg)) {
673 qc->cursg = sg_next(qc->cursg); 669 qc->cursg = sg_next(qc->cursg);
@@ -737,8 +733,7 @@ static void octeon_cf_delayed_finish(struct work_struct *work)
737 goto out; 733 goto out;
738 } 734 }
739 qc = ata_qc_from_tag(ap, ap->link.active_tag); 735 qc = ata_qc_from_tag(ap, ap->link.active_tag);
740 if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) && 736 if (qc && !(qc->tf.flags & ATA_TFLAG_POLLING))
741 (qc->flags & ATA_QCFLAG_ACTIVE))
742 octeon_cf_dma_finished(ap, qc); 737 octeon_cf_dma_finished(ap, qc);
743out: 738out:
744 spin_unlock_irqrestore(&host->lock, flags); 739 spin_unlock_irqrestore(&host->lock, flags);
diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c
index 5904cfdb8db..ed18d8b42c5 100644
--- a/drivers/ata/pdc_adma.c
+++ b/drivers/ata/pdc_adma.c
@@ -442,8 +442,6 @@ static inline unsigned int adma_intr_pkt(struct ata_host *host)
442 continue; 442 continue;
443 handled = 1; 443 handled = 1;
444 adma_enter_reg_mode(ap); 444 adma_enter_reg_mode(ap);
445 if (ap->flags & ATA_FLAG_DISABLED)
446 continue;
447 pp = ap->private_data; 445 pp = ap->private_data;
448 if (!pp || pp->state != adma_state_pkt) 446 if (!pp || pp->state != adma_state_pkt)
449 continue; 447 continue;
@@ -484,42 +482,38 @@ static inline unsigned int adma_intr_mmio(struct ata_host *host)
484 unsigned int handled = 0, port_no; 482 unsigned int handled = 0, port_no;
485 483
486 for (port_no = 0; port_no < host->n_ports; ++port_no) { 484 for (port_no = 0; port_no < host->n_ports; ++port_no) {
487 struct ata_port *ap; 485 struct ata_port *ap = host->ports[port_no];
488 ap = host->ports[port_no]; 486 struct adma_port_priv *pp = ap->private_data;
489 if (ap && (!(ap->flags & ATA_FLAG_DISABLED))) { 487 struct ata_queued_cmd *qc;
490 struct ata_queued_cmd *qc; 488
491 struct adma_port_priv *pp = ap->private_data; 489 if (!pp || pp->state != adma_state_mmio)
492 if (!pp || pp->state != adma_state_mmio) 490 continue;
491 qc = ata_qc_from_tag(ap, ap->link.active_tag);
492 if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) {
493
494 /* check main status, clearing INTRQ */
495 u8 status = ata_sff_check_status(ap);
496 if ((status & ATA_BUSY))
493 continue; 497 continue;
494 qc = ata_qc_from_tag(ap, ap->link.active_tag); 498 DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n",
495 if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) { 499 ap->print_id, qc->tf.protocol, status);
496 500
497 /* check main status, clearing INTRQ */ 501 /* complete taskfile transaction */
498 u8 status = ata_sff_check_status(ap); 502 pp->state = adma_state_idle;
499 if ((status & ATA_BUSY)) 503 qc->err_mask |= ac_err_mask(status);
500 continue; 504 if (!qc->err_mask)
501 DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n", 505 ata_qc_complete(qc);
502 ap->print_id, qc->tf.protocol, status); 506 else {
503 507 struct ata_eh_info *ehi = &ap->link.eh_info;
504 /* complete taskfile transaction */ 508 ata_ehi_clear_desc(ehi);
505 pp->state = adma_state_idle; 509 ata_ehi_push_desc(ehi, "status 0x%02X", status);
506 qc->err_mask |= ac_err_mask(status); 510
507 if (!qc->err_mask) 511 if (qc->err_mask == AC_ERR_DEV)
508 ata_qc_complete(qc); 512 ata_port_abort(ap);
509 else { 513 else
510 struct ata_eh_info *ehi = 514 ata_port_freeze(ap);
511 &ap->link.eh_info;
512 ata_ehi_clear_desc(ehi);
513 ata_ehi_push_desc(ehi,
514 "status 0x%02X", status);
515
516 if (qc->err_mask == AC_ERR_DEV)
517 ata_port_abort(ap);
518 else
519 ata_port_freeze(ap);
520 }
521 handled = 1;
522 } 515 }
516 handled = 1;
523 } 517 }
524 } 518 }
525 return handled; 519 return handled;
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c
index 27dc6c86a4c..0ac6cdd9d1e 100644
--- a/drivers/ata/sata_inic162x.c
+++ b/drivers/ata/sata_inic162x.c
@@ -415,22 +415,11 @@ static irqreturn_t inic_interrupt(int irq, void *dev_instance)
415 415
416 spin_lock(&host->lock); 416 spin_lock(&host->lock);
417 417
418 for (i = 0; i < NR_PORTS; i++) { 418 for (i = 0; i < NR_PORTS; i++)
419 struct ata_port *ap = host->ports[i]; 419 if (host_irq_stat & (HIRQ_PORT0 << i)) {
420 420 inic_host_intr(host->ports[i]);
421 if (!(host_irq_stat & (HIRQ_PORT0 << i)))
422 continue;
423
424 if (likely(ap && !(ap->flags & ATA_FLAG_DISABLED))) {
425 inic_host_intr(ap);
426 handled++; 421 handled++;
427 } else {
428 if (ata_ratelimit())
429 dev_printk(KERN_ERR, host->dev, "interrupt "
430 "from disabled port %d (0x%x)\n",
431 i, host_irq_stat);
432 } 422 }
433 }
434 423
435 spin_unlock(&host->lock); 424 spin_unlock(&host->lock);
436 425
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index bd486462951..318862e8a8a 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -2355,13 +2355,9 @@ static struct ata_queued_cmd *mv_get_active_qc(struct ata_port *ap)
2355 if (pp->pp_flags & MV_PP_FLAG_NCQ_EN) 2355 if (pp->pp_flags & MV_PP_FLAG_NCQ_EN)
2356 return NULL; 2356 return NULL;
2357 qc = ata_qc_from_tag(ap, ap->link.active_tag); 2357 qc = ata_qc_from_tag(ap, ap->link.active_tag);
2358 if (qc) { 2358 if (qc && !(qc->tf.flags & ATA_TFLAG_POLLING))
2359 if (qc->tf.flags & ATA_TFLAG_POLLING) 2359 return qc;
2360 qc = NULL; 2360 return NULL;
2361 else if (!(qc->flags & ATA_QCFLAG_ACTIVE))
2362 qc = NULL;
2363 }
2364 return qc;
2365} 2361}
2366 2362
2367static void mv_pmp_error_handler(struct ata_port *ap) 2363static void mv_pmp_error_handler(struct ata_port *ap)
@@ -2546,9 +2542,7 @@ static void mv_unexpected_intr(struct ata_port *ap, int edma_was_enabled)
2546 char *when = "idle"; 2542 char *when = "idle";
2547 2543
2548 ata_ehi_clear_desc(ehi); 2544 ata_ehi_clear_desc(ehi);
2549 if (ap->flags & ATA_FLAG_DISABLED) { 2545 if (edma_was_enabled) {
2550 when = "disabled";
2551 } else if (edma_was_enabled) {
2552 when = "EDMA enabled"; 2546 when = "EDMA enabled";
2553 } else { 2547 } else {
2554 struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->link.active_tag); 2548 struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->link.active_tag);
@@ -2782,10 +2776,6 @@ static void mv_port_intr(struct ata_port *ap, u32 port_cause)
2782 struct mv_port_priv *pp; 2776 struct mv_port_priv *pp;
2783 int edma_was_enabled; 2777 int edma_was_enabled;
2784 2778
2785 if (ap->flags & ATA_FLAG_DISABLED) {
2786 mv_unexpected_intr(ap, 0);
2787 return;
2788 }
2789 /* 2779 /*
2790 * Grab a snapshot of the EDMA_EN flag setting, 2780 * Grab a snapshot of the EDMA_EN flag setting,
2791 * so that we have a consistent view for this port, 2781 * so that we have a consistent view for this port,
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 9d3dbc8a118..20cc510595d 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -933,107 +933,108 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance)
933 933
934 for (i = 0; i < host->n_ports; i++) { 934 for (i = 0; i < host->n_ports; i++) {
935 struct ata_port *ap = host->ports[i]; 935 struct ata_port *ap = host->ports[i];
936 struct nv_adma_port_priv *pp = ap->private_data;
937 void __iomem *mmio = pp->ctl_block;
938 u16 status;
939 u32 gen_ctl;
940 u32 notifier, notifier_error;
941
936 notifier_clears[i] = 0; 942 notifier_clears[i] = 0;
937 943
938 if (ap && !(ap->flags & ATA_FLAG_DISABLED)) { 944 /* if ADMA is disabled, use standard ata interrupt handler */
939 struct nv_adma_port_priv *pp = ap->private_data; 945 if (pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) {
940 void __iomem *mmio = pp->ctl_block; 946 u8 irq_stat = readb(host->iomap[NV_MMIO_BAR] + NV_INT_STATUS_CK804)
941 u16 status; 947 >> (NV_INT_PORT_SHIFT * i);
942 u32 gen_ctl; 948 handled += nv_host_intr(ap, irq_stat);
943 u32 notifier, notifier_error; 949 continue;
944 950 }
945 /* if ADMA is disabled, use standard ata interrupt handler */
946 if (pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) {
947 u8 irq_stat = readb(host->iomap[NV_MMIO_BAR] + NV_INT_STATUS_CK804)
948 >> (NV_INT_PORT_SHIFT * i);
949 handled += nv_host_intr(ap, irq_stat);
950 continue;
951 }
952 951
953 /* if in ATA register mode, check for standard interrupts */ 952 /* if in ATA register mode, check for standard interrupts */
954 if (pp->flags & NV_ADMA_PORT_REGISTER_MODE) { 953 if (pp->flags & NV_ADMA_PORT_REGISTER_MODE) {
955 u8 irq_stat = readb(host->iomap[NV_MMIO_BAR] + NV_INT_STATUS_CK804) 954 u8 irq_stat = readb(host->iomap[NV_MMIO_BAR] + NV_INT_STATUS_CK804)
956 >> (NV_INT_PORT_SHIFT * i); 955 >> (NV_INT_PORT_SHIFT * i);
957 if (ata_tag_valid(ap->link.active_tag)) 956 if (ata_tag_valid(ap->link.active_tag))
958 /** NV_INT_DEV indication seems unreliable at times 957 /** NV_INT_DEV indication seems unreliable
959 at least in ADMA mode. Force it on always when a 958 at times at least in ADMA mode. Force it
960 command is active, to prevent losing interrupts. */ 959 on always when a command is active, to
961 irq_stat |= NV_INT_DEV; 960 prevent losing interrupts. */
962 handled += nv_host_intr(ap, irq_stat); 961 irq_stat |= NV_INT_DEV;
963 } 962 handled += nv_host_intr(ap, irq_stat);
963 }
964
965 notifier = readl(mmio + NV_ADMA_NOTIFIER);
966 notifier_error = readl(mmio + NV_ADMA_NOTIFIER_ERROR);
967 notifier_clears[i] = notifier | notifier_error;
968
969 gen_ctl = readl(pp->gen_block + NV_ADMA_GEN_CTL);
970
971 if (!NV_ADMA_CHECK_INTR(gen_ctl, ap->port_no) && !notifier &&
972 !notifier_error)
973 /* Nothing to do */
974 continue;
975
976 status = readw(mmio + NV_ADMA_STAT);
977
978 /*
979 * Clear status. Ensure the controller sees the
980 * clearing before we start looking at any of the CPB
981 * statuses, so that any CPB completions after this
982 * point in the handler will raise another interrupt.
983 */
984 writew(status, mmio + NV_ADMA_STAT);
985 readw(mmio + NV_ADMA_STAT); /* flush posted write */
986 rmb();
987
988 handled++; /* irq handled if we got here */
964 989
965 notifier = readl(mmio + NV_ADMA_NOTIFIER); 990 /* freeze if hotplugged or controller error */
966 notifier_error = readl(mmio + NV_ADMA_NOTIFIER_ERROR); 991 if (unlikely(status & (NV_ADMA_STAT_HOTPLUG |
967 notifier_clears[i] = notifier | notifier_error; 992 NV_ADMA_STAT_HOTUNPLUG |
968 993 NV_ADMA_STAT_TIMEOUT |
969 gen_ctl = readl(pp->gen_block + NV_ADMA_GEN_CTL); 994 NV_ADMA_STAT_SERROR))) {
970 995 struct ata_eh_info *ehi = &ap->link.eh_info;
971 if (!NV_ADMA_CHECK_INTR(gen_ctl, ap->port_no) && !notifier && 996
972 !notifier_error) 997 ata_ehi_clear_desc(ehi);
973 /* Nothing to do */ 998 __ata_ehi_push_desc(ehi, "ADMA status 0x%08x: ", status);
974 continue; 999 if (status & NV_ADMA_STAT_TIMEOUT) {
975 1000 ehi->err_mask |= AC_ERR_SYSTEM;
976 status = readw(mmio + NV_ADMA_STAT); 1001 ata_ehi_push_desc(ehi, "timeout");
977 1002 } else if (status & NV_ADMA_STAT_HOTPLUG) {
978 /* Clear status. Ensure the controller sees the clearing before we start 1003 ata_ehi_hotplugged(ehi);
979 looking at any of the CPB statuses, so that any CPB completions after 1004 ata_ehi_push_desc(ehi, "hotplug");
980 this point in the handler will raise another interrupt. */ 1005 } else if (status & NV_ADMA_STAT_HOTUNPLUG) {
981 writew(status, mmio + NV_ADMA_STAT); 1006 ata_ehi_hotplugged(ehi);
982 readw(mmio + NV_ADMA_STAT); /* flush posted write */ 1007 ata_ehi_push_desc(ehi, "hot unplug");
983 rmb(); 1008 } else if (status & NV_ADMA_STAT_SERROR) {
984 1009 /* let EH analyze SError and figure out cause */
985 handled++; /* irq handled if we got here */ 1010 ata_ehi_push_desc(ehi, "SError");
986 1011 } else
987 /* freeze if hotplugged or controller error */ 1012 ata_ehi_push_desc(ehi, "unknown");
988 if (unlikely(status & (NV_ADMA_STAT_HOTPLUG | 1013 ata_port_freeze(ap);
989 NV_ADMA_STAT_HOTUNPLUG | 1014 continue;
990 NV_ADMA_STAT_TIMEOUT | 1015 }
991 NV_ADMA_STAT_SERROR))) { 1016
992 struct ata_eh_info *ehi = &ap->link.eh_info; 1017 if (status & (NV_ADMA_STAT_DONE |
993 1018 NV_ADMA_STAT_CPBERR |
994 ata_ehi_clear_desc(ehi); 1019 NV_ADMA_STAT_CMD_COMPLETE)) {
995 __ata_ehi_push_desc(ehi, "ADMA status 0x%08x: ", status); 1020 u32 check_commands = notifier_clears[i];
996 if (status & NV_ADMA_STAT_TIMEOUT) { 1021 int pos, error = 0;
997 ehi->err_mask |= AC_ERR_SYSTEM; 1022
998 ata_ehi_push_desc(ehi, "timeout"); 1023 if (status & NV_ADMA_STAT_CPBERR) {
999 } else if (status & NV_ADMA_STAT_HOTPLUG) { 1024 /* check all active commands */
1000 ata_ehi_hotplugged(ehi); 1025 if (ata_tag_valid(ap->link.active_tag))
1001 ata_ehi_push_desc(ehi, "hotplug"); 1026 check_commands = 1 <<
1002 } else if (status & NV_ADMA_STAT_HOTUNPLUG) { 1027 ap->link.active_tag;
1003 ata_ehi_hotplugged(ehi); 1028 else
1004 ata_ehi_push_desc(ehi, "hot unplug"); 1029 check_commands = ap->link.sactive;
1005 } else if (status & NV_ADMA_STAT_SERROR) {
1006 /* let libata analyze SError and figure out the cause */
1007 ata_ehi_push_desc(ehi, "SError");
1008 } else
1009 ata_ehi_push_desc(ehi, "unknown");
1010 ata_port_freeze(ap);
1011 continue;
1012 } 1030 }
1013 1031
1014 if (status & (NV_ADMA_STAT_DONE | 1032 /* check CPBs for completed commands */
1015 NV_ADMA_STAT_CPBERR | 1033 while ((pos = ffs(check_commands)) && !error) {
1016 NV_ADMA_STAT_CMD_COMPLETE)) { 1034 pos--;
1017 u32 check_commands = notifier_clears[i]; 1035 error = nv_adma_check_cpb(ap, pos,
1018 int pos, error = 0;
1019
1020 if (status & NV_ADMA_STAT_CPBERR) {
1021 /* Check all active commands */
1022 if (ata_tag_valid(ap->link.active_tag))
1023 check_commands = 1 <<
1024 ap->link.active_tag;
1025 else
1026 check_commands = ap->
1027 link.sactive;
1028 }
1029
1030 /** Check CPBs for completed commands */
1031 while ((pos = ffs(check_commands)) && !error) {
1032 pos--;
1033 error = nv_adma_check_cpb(ap, pos,
1034 notifier_error & (1 << pos)); 1036 notifier_error & (1 << pos));
1035 check_commands &= ~(1 << pos); 1037 check_commands &= ~(1 << pos);
1036 }
1037 } 1038 }
1038 } 1039 }
1039 } 1040 }
@@ -1498,22 +1499,19 @@ static irqreturn_t nv_generic_interrupt(int irq, void *dev_instance)
1498 spin_lock_irqsave(&host->lock, flags); 1499 spin_lock_irqsave(&host->lock, flags);
1499 1500
1500 for (i = 0; i < host->n_ports; i++) { 1501 for (i = 0; i < host->n_ports; i++) {
1501 struct ata_port *ap; 1502 struct ata_port *ap = host->ports[i];
1502 1503 struct ata_queued_cmd *qc;
1503 ap = host->ports[i];
1504 if (ap &&
1505 !(ap->flags & ATA_FLAG_DISABLED)) {
1506 struct ata_queued_cmd *qc;
1507 1504
1508 qc = ata_qc_from_tag(ap, ap->link.active_tag); 1505 qc = ata_qc_from_tag(ap, ap->link.active_tag);
1509 if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) 1506 if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) {
1510 handled += ata_sff_host_intr(ap, qc); 1507 handled += ata_sff_host_intr(ap, qc);
1511 else 1508 } else {
1512 // No request pending? Clear interrupt status 1509 /*
1513 // anyway, in case there's one pending. 1510 * No request pending? Clear interrupt status
1514 ap->ops->sff_check_status(ap); 1511 * anyway, in case there's one pending.
1512 */
1513 ap->ops->sff_check_status(ap);
1515 } 1514 }
1516
1517 } 1515 }
1518 1516
1519 spin_unlock_irqrestore(&host->lock, flags); 1517 spin_unlock_irqrestore(&host->lock, flags);
@@ -1526,11 +1524,7 @@ static irqreturn_t nv_do_interrupt(struct ata_host *host, u8 irq_stat)
1526 int i, handled = 0; 1524 int i, handled = 0;
1527 1525
1528 for (i = 0; i < host->n_ports; i++) { 1526 for (i = 0; i < host->n_ports; i++) {
1529 struct ata_port *ap = host->ports[i]; 1527 handled += nv_host_intr(host->ports[i], irq_stat);
1530
1531 if (ap && !(ap->flags & ATA_FLAG_DISABLED))
1532 handled += nv_host_intr(ap, irq_stat);
1533
1534 irq_stat >>= NV_INT_PORT_SHIFT; 1528 irq_stat >>= NV_INT_PORT_SHIFT;
1535 } 1529 }
1536 1530
@@ -2380,16 +2374,14 @@ static irqreturn_t nv_swncq_interrupt(int irq, void *dev_instance)
2380 for (i = 0; i < host->n_ports; i++) { 2374 for (i = 0; i < host->n_ports; i++) {
2381 struct ata_port *ap = host->ports[i]; 2375 struct ata_port *ap = host->ports[i];
2382 2376
2383 if (ap && !(ap->flags & ATA_FLAG_DISABLED)) { 2377 if (ap->link.sactive) {
2384 if (ap->link.sactive) { 2378 nv_swncq_host_interrupt(ap, (u16)irq_stat);
2385 nv_swncq_host_interrupt(ap, (u16)irq_stat); 2379 handled = 1;
2386 handled = 1; 2380 } else {
2387 } else { 2381 if (irq_stat) /* reserve Hotplug */
2388 if (irq_stat) /* reserve Hotplug */ 2382 nv_swncq_irq_clear(ap, 0xfff0);
2389 nv_swncq_irq_clear(ap, 0xfff0);
2390 2383
2391 handled += nv_host_intr(ap, (u8)irq_stat); 2384 handled += nv_host_intr(ap, (u8)irq_stat);
2392 }
2393 } 2385 }
2394 irq_stat >>= NV_INT_PORT_SHIFT_MCP55; 2386 irq_stat >>= NV_INT_PORT_SHIFT_MCP55;
2395 } 2387 }
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index 5356ec00d2b..2c029ea12c5 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -984,8 +984,7 @@ static irqreturn_t pdc_interrupt(int irq, void *dev_instance)
984 /* check for a plug or unplug event */ 984 /* check for a plug or unplug event */
985 ata_no = pdc_port_no_to_ata_no(i, is_sataii_tx4); 985 ata_no = pdc_port_no_to_ata_no(i, is_sataii_tx4);
986 tmp = hotplug_status & (0x11 << ata_no); 986 tmp = hotplug_status & (0x11 << ata_no);
987 if (tmp && ap && 987 if (tmp) {
988 !(ap->flags & ATA_FLAG_DISABLED)) {
989 struct ata_eh_info *ehi = &ap->link.eh_info; 988 struct ata_eh_info *ehi = &ap->link.eh_info;
990 ata_ehi_clear_desc(ehi); 989 ata_ehi_clear_desc(ehi);
991 ata_ehi_hotplugged(ehi); 990 ata_ehi_hotplugged(ehi);
@@ -997,8 +996,7 @@ static irqreturn_t pdc_interrupt(int irq, void *dev_instance)
997 996
998 /* check for a packet interrupt */ 997 /* check for a packet interrupt */
999 tmp = mask & (1 << (i + 1)); 998 tmp = mask & (1 << (i + 1));
1000 if (tmp && ap && 999 if (tmp) {
1001 !(ap->flags & ATA_FLAG_DISABLED)) {
1002 struct ata_queued_cmd *qc; 1000 struct ata_queued_cmd *qc;
1003 1001
1004 qc = ata_qc_from_tag(ap, ap->link.active_tag); 1002 qc = ata_qc_from_tag(ap, ap->link.active_tag);
diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c
index 92ba45e6689..febc6e74842 100644
--- a/drivers/ata/sata_qstor.c
+++ b/drivers/ata/sata_qstor.c
@@ -404,26 +404,24 @@ static inline unsigned int qs_intr_pkt(struct ata_host *host)
404 u8 sHST = sff1 & 0x3f; /* host status */ 404 u8 sHST = sff1 & 0x3f; /* host status */
405 unsigned int port_no = (sff1 >> 8) & 0x03; 405 unsigned int port_no = (sff1 >> 8) & 0x03;
406 struct ata_port *ap = host->ports[port_no]; 406 struct ata_port *ap = host->ports[port_no];
407 struct qs_port_priv *pp = ap->private_data;
408 struct ata_queued_cmd *qc;
407 409
408 DPRINTK("SFF=%08x%08x: sCHAN=%u sHST=%d sDST=%02x\n", 410 DPRINTK("SFF=%08x%08x: sCHAN=%u sHST=%d sDST=%02x\n",
409 sff1, sff0, port_no, sHST, sDST); 411 sff1, sff0, port_no, sHST, sDST);
410 handled = 1; 412 handled = 1;
411 if (ap && !(ap->flags & ATA_FLAG_DISABLED)) { 413 if (!pp || pp->state != qs_state_pkt)
412 struct ata_queued_cmd *qc; 414 continue;
413 struct qs_port_priv *pp = ap->private_data; 415 qc = ata_qc_from_tag(ap, ap->link.active_tag);
414 if (!pp || pp->state != qs_state_pkt) 416 if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) {
415 continue; 417 switch (sHST) {
416 qc = ata_qc_from_tag(ap, ap->link.active_tag); 418 case 0: /* successful CPB */
417 if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) { 419 case 3: /* device error */
418 switch (sHST) { 420 qs_enter_reg_mode(qc->ap);
419 case 0: /* successful CPB */ 421 qs_do_or_die(qc, sDST);
420 case 3: /* device error */ 422 break;
421 qs_enter_reg_mode(qc->ap); 423 default:
422 qs_do_or_die(qc, sDST); 424 break;
423 break;
424 default:
425 break;
426 }
427 } 425 }
428 } 426 }
429 } 427 }
@@ -436,33 +434,30 @@ static inline unsigned int qs_intr_mmio(struct ata_host *host)
436 unsigned int handled = 0, port_no; 434 unsigned int handled = 0, port_no;
437 435
438 for (port_no = 0; port_no < host->n_ports; ++port_no) { 436 for (port_no = 0; port_no < host->n_ports; ++port_no) {
439 struct ata_port *ap; 437 struct ata_port *ap = host->ports[port_no];
440 ap = host->ports[port_no]; 438 struct qs_port_priv *pp = ap->private_data;
441 if (ap && 439 struct ata_queued_cmd *qc;
442 !(ap->flags & ATA_FLAG_DISABLED)) { 440
443 struct ata_queued_cmd *qc; 441 qc = ata_qc_from_tag(ap, ap->link.active_tag);
444 struct qs_port_priv *pp; 442 if (!qc) {
445 qc = ata_qc_from_tag(ap, ap->link.active_tag); 443 /*
446 if (!qc || !(qc->flags & ATA_QCFLAG_ACTIVE)) { 444 * The qstor hardware generates spurious
447 /* 445 * interrupts from time to time when switching
448 * The qstor hardware generates spurious 446 * in and out of packet mode. There's no
449 * interrupts from time to time when switching 447 * obvious way to know if we're here now due
450 * in and out of packet mode. 448 * to that, so just ack the irq and pretend we
451 * There's no obvious way to know if we're 449 * knew it was ours.. (ugh). This does not
452 * here now due to that, so just ack the irq 450 * affect packet mode.
453 * and pretend we knew it was ours.. (ugh). 451 */
454 * This does not affect packet mode. 452 ata_sff_check_status(ap);
455 */ 453 handled = 1;
456 ata_sff_check_status(ap); 454 continue;
457 handled = 1;
458 continue;
459 }
460 pp = ap->private_data;
461 if (!pp || pp->state != qs_state_mmio)
462 continue;
463 if (!(qc->tf.flags & ATA_TFLAG_POLLING))
464 handled |= ata_sff_host_intr(ap, qc);
465 } 455 }
456
457 if (!pp || pp->state != qs_state_mmio)
458 continue;
459 if (!(qc->tf.flags & ATA_TFLAG_POLLING))
460 handled |= ata_sff_host_intr(ap, qc);
466 } 461 }
467 return handled; 462 return handled;
468} 463}
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index 3cb69d5fb81..9c367f71c62 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -532,9 +532,6 @@ static irqreturn_t sil_interrupt(int irq, void *dev_instance)
532 struct ata_port *ap = host->ports[i]; 532 struct ata_port *ap = host->ports[i];
533 u32 bmdma2 = readl(mmio_base + sil_port[ap->port_no].bmdma2); 533 u32 bmdma2 = readl(mmio_base + sil_port[ap->port_no].bmdma2);
534 534
535 if (unlikely(ap->flags & ATA_FLAG_DISABLED))
536 continue;
537
538 /* turn off SATA_IRQ if not supported */ 535 /* turn off SATA_IRQ if not supported */
539 if (ap->flags & SIL_FLAG_NO_SATA_IRQ) 536 if (ap->flags & SIL_FLAG_NO_SATA_IRQ)
540 bmdma2 &= ~SIL_DMA_SATA_IRQ; 537 bmdma2 &= ~SIL_DMA_SATA_IRQ;
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 433b6b89c79..e9250514734 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -1160,13 +1160,8 @@ static irqreturn_t sil24_interrupt(int irq, void *dev_instance)
1160 1160
1161 for (i = 0; i < host->n_ports; i++) 1161 for (i = 0; i < host->n_ports; i++)
1162 if (status & (1 << i)) { 1162 if (status & (1 << i)) {
1163 struct ata_port *ap = host->ports[i]; 1163 sil24_host_intr(host->ports[i]);
1164 if (ap && !(ap->flags & ATA_FLAG_DISABLED)) { 1164 handled++;
1165 sil24_host_intr(ap);
1166 handled++;
1167 } else
1168 printk(KERN_ERR DRV_NAME
1169 ": interrupt from disabled port %d\n", i);
1170 } 1165 }
1171 1166
1172 spin_unlock(&host->lock); 1167 spin_unlock(&host->lock);
diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c
index 232468f2ea9..7e3a25ec93b 100644
--- a/drivers/ata/sata_sx4.c
+++ b/drivers/ata/sata_sx4.c
@@ -840,8 +840,7 @@ static irqreturn_t pdc20621_interrupt(int irq, void *dev_instance)
840 ap = host->ports[port_no]; 840 ap = host->ports[port_no];
841 tmp = mask & (1 << i); 841 tmp = mask & (1 << i);
842 VPRINTK("seq %u, port_no %u, ap %p, tmp %x\n", i, port_no, ap, tmp); 842 VPRINTK("seq %u, port_no %u, ap %p, tmp %x\n", i, port_no, ap, tmp);
843 if (tmp && ap && 843 if (tmp && ap) {
844 !(ap->flags & ATA_FLAG_DISABLED)) {
845 struct ata_queued_cmd *qc; 844 struct ata_queued_cmd *qc;
846 845
847 qc = ata_qc_from_tag(ap, ap->link.active_tag); 846 qc = ata_qc_from_tag(ap, ap->link.active_tag);
diff --git a/drivers/ata/sata_vsc.c b/drivers/ata/sata_vsc.c
index 8b2a278b254..2107952ebff 100644
--- a/drivers/ata/sata_vsc.c
+++ b/drivers/ata/sata_vsc.c
@@ -284,14 +284,8 @@ static irqreturn_t vsc_sata_interrupt(int irq, void *dev_instance)
284 for (i = 0; i < host->n_ports; i++) { 284 for (i = 0; i < host->n_ports; i++) {
285 u8 port_status = (status >> (8 * i)) & 0xff; 285 u8 port_status = (status >> (8 * i)) & 0xff;
286 if (port_status) { 286 if (port_status) {
287 struct ata_port *ap = host->ports[i]; 287 vsc_port_intr(port_status, host->ports[i]);
288 288 handled++;
289 if (ap && !(ap->flags & ATA_FLAG_DISABLED)) {
290 vsc_port_intr(port_status, ap);
291 handled++;
292 } else
293 dev_printk(KERN_ERR, host->dev,
294 "interrupt from disabled port %d\n", i);
295 } 289 }
296 } 290 }
297 291
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 520461b9bc0..b90c118119d 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -4295,7 +4295,7 @@ static void ipr_slave_destroy(struct scsi_device *sdev)
4295 res = (struct ipr_resource_entry *) sdev->hostdata; 4295 res = (struct ipr_resource_entry *) sdev->hostdata;
4296 if (res) { 4296 if (res) {
4297 if (res->sata_port) 4297 if (res->sata_port)
4298 ata_port_disable(res->sata_port->ap); 4298 res->sata_port->ap->link.device[0].class = ATA_DEV_NONE;
4299 sdev->hostdata = NULL; 4299 sdev->hostdata = NULL;
4300 res->sdev = NULL; 4300 res->sdev = NULL;
4301 res->sata_port = NULL; 4301 res->sata_port = NULL;
@@ -5751,13 +5751,13 @@ static void ipr_ata_phy_reset(struct ata_port *ap)
5751 rc = ipr_device_reset(ioa_cfg, res); 5751 rc = ipr_device_reset(ioa_cfg, res);
5752 5752
5753 if (rc) { 5753 if (rc) {
5754 ata_port_disable(ap); 5754 ap->link.device[0].class = ATA_DEV_NONE;
5755 goto out_unlock; 5755 goto out_unlock;
5756 } 5756 }
5757 5757
5758 ap->link.device[0].class = res->ata_class; 5758 ap->link.device[0].class = res->ata_class;
5759 if (ap->link.device[0].class == ATA_DEV_UNKNOWN) 5759 if (ap->link.device[0].class == ATA_DEV_UNKNOWN)
5760 ata_port_disable(ap); 5760 ap->link.device[0].class = ATA_DEV_NONE;
5761 5761
5762out_unlock: 5762out_unlock:
5763 spin_unlock_irqrestore(ioa_cfg->host->host_lock, flags); 5763 spin_unlock_irqrestore(ioa_cfg->host->host_lock, flags);
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 822835055ce..b71b6d41baa 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -818,7 +818,7 @@ void sas_slave_destroy(struct scsi_device *scsi_dev)
818 struct domain_device *dev = sdev_to_domain_dev(scsi_dev); 818 struct domain_device *dev = sdev_to_domain_dev(scsi_dev);
819 819
820 if (dev_is_sata(dev)) 820 if (dev_is_sata(dev))
821 ata_port_disable(dev->sata_dev.ap); 821 dev->sata_dev.ap->link.device[0].class = ATA_DEV_NONE;
822} 822}
823 823
824int sas_change_queue_depth(struct scsi_device *scsi_dev, int new_depth, 824int sas_change_queue_depth(struct scsi_device *scsi_dev, int new_depth,
diff --git a/include/linux/libata.h b/include/linux/libata.h
index af700923a39..bd1b2b49e12 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -202,12 +202,6 @@ enum {
202 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity 202 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity
203 * led */ 203 * led */
204 204
205 /* The following flag belongs to ap->pflags but is kept in
206 * ap->flags because it's referenced in many LLDs and will be
207 * removed in not-too-distant future.
208 */
209 ATA_FLAG_DISABLED = (1 << 23), /* port is disabled, ignore it */
210
211 /* bits 24:31 of ap->flags are reserved for LLD specific flags */ 205 /* bits 24:31 of ap->flags are reserved for LLD specific flags */
212 206
213 207
@@ -937,7 +931,6 @@ static inline int ata_port_is_dummy(struct ata_port *ap)
937 return ap->ops == &ata_dummy_port_ops; 931 return ap->ops == &ata_dummy_port_ops;
938} 932}
939 933
940extern void ata_port_probe(struct ata_port *);
941extern int sata_set_spd(struct ata_link *link); 934extern int sata_set_spd(struct ata_link *link);
942extern int ata_std_prereset(struct ata_link *link, unsigned long deadline); 935extern int ata_std_prereset(struct ata_link *link, unsigned long deadline);
943extern int ata_wait_after_reset(struct ata_link *link, unsigned long deadline, 936extern int ata_wait_after_reset(struct ata_link *link, unsigned long deadline,
@@ -952,7 +945,6 @@ extern int sata_link_hardreset(struct ata_link *link,
952extern int sata_std_hardreset(struct ata_link *link, unsigned int *class, 945extern int sata_std_hardreset(struct ata_link *link, unsigned int *class,
953 unsigned long deadline); 946 unsigned long deadline);
954extern void ata_std_postreset(struct ata_link *link, unsigned int *classes); 947extern void ata_std_postreset(struct ata_link *link, unsigned int *classes);
955extern void ata_port_disable(struct ata_port *);
956 948
957extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); 949extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports);
958extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, 950extern struct ata_host *ata_host_alloc_pinfo(struct device *dev,