Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/shaggy...
[pandora-kernel.git] / drivers / ata / sata_sil24.c
index 96fd526..864c1c1 100644 (file)
@@ -301,7 +301,7 @@ static struct sil24_cerr_info {
        [PORT_CERR_PKT_PROT]    = { AC_ERR_HSM, ATA_EH_SOFTRESET,
                                    "invalid data directon for ATAPI CDB" },
        [PORT_CERR_SGT_BOUNDARY] = { AC_ERR_SYSTEM, ATA_EH_SOFTRESET,
-                                    "SGT no on qword boundary" },
+                                    "SGT not on qword boundary" },
        [PORT_CERR_SGT_TGTABRT] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET,
                                    "PCI target abort while fetching SGT" },
        [PORT_CERR_SGT_MSTABRT] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET,
@@ -832,16 +832,31 @@ static int sil24_qc_defer(struct ata_queued_cmd *qc)
        struct ata_link *link = qc->dev->link;
        struct ata_port *ap = link->ap;
        u8 prot = qc->tf.protocol;
-       int is_atapi = (prot == ATA_PROT_ATAPI ||
-                       prot == ATA_PROT_ATAPI_NODATA ||
-                       prot == ATA_PROT_ATAPI_DMA);
-
-       /* ATAPI commands completing with CHECK_SENSE cause various
-        * weird problems if other commands are active.  PMP DMA CS
-        * errata doesn't cover all and HSM violation occurs even with
-        * only one other device active.  Always run an ATAPI command
-        * by itself.
-        */
+
+       /*
+        * There is a bug in the chip:
+        * Port LRAM Causes the PRB/SGT Data to be Corrupted
+        * If the host issues a read request for LRAM and SActive registers
+        * while active commands are available in the port, PRB/SGT data in
+        * the LRAM can become corrupted. This issue applies only when
+        * reading from, but not writing to, the LRAM.
+        *
+        * Therefore, reading LRAM when there is no particular error [and
+        * other commands may be outstanding] is prohibited.
+        *
+        * To avoid this bug there are two situations where a command must run
+        * exclusive of any other commands on the port:
+        *
+        * - ATAPI commands which check the sense data
+        * - Passthrough ATA commands which always have ATA_QCFLAG_RESULT_TF
+        *   set.
+        *
+        */
+       int is_excl = (prot == ATA_PROT_ATAPI ||
+                      prot == ATA_PROT_ATAPI_NODATA ||
+                      prot == ATA_PROT_ATAPI_DMA ||
+                      (qc->flags & ATA_QCFLAG_RESULT_TF));
+
        if (unlikely(ap->excl_link)) {
                if (link == ap->excl_link) {
                        if (ap->nr_active_links)
@@ -849,7 +864,7 @@ static int sil24_qc_defer(struct ata_queued_cmd *qc)
                        qc->flags |= ATA_QCFLAG_CLEAR_EXCL;
                } else
                        return ATA_DEFER_PORT;
-       } else if (unlikely(is_atapi)) {
+       } else if (unlikely(is_excl)) {
                ap->excl_link = link;
                if (ap->nr_active_links)
                        return ATA_DEFER_PORT;
@@ -1079,10 +1094,13 @@ static void sil24_error_intr(struct ata_port *ap)
                if (ci && ci->desc) {
                        err_mask |= ci->err_mask;
                        action |= ci->action;
+                       if (action & ATA_EH_RESET_MASK)
+                               freeze = 1;
                        ata_ehi_push_desc(ehi, "%s", ci->desc);
                } else {
                        err_mask |= AC_ERR_OTHER;
                        action |= ATA_EH_SOFTRESET;
+                       freeze = 1;
                        ata_ehi_push_desc(ehi, "unknown command error %d",
                                          cerr);
                }