public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: luugi.marsan@amd.com (Luugi Marsan)
To: linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] Workaround for SB600 SATA ODD issue
Date: Fri,  3 Nov 2006 14:00:04 -0500 (EST)	[thread overview]
Message-ID: <20061103190004.9ED8DCBD48@localhost.localdomain> (raw)

From: conke.hu@amd.com

There was an ASIC bug in the SB600 SATA controller of low revision (<=13) and CD burning may hang (only SATA ODD has this issue, and SATA HDD works well). The patch provides a workaround for this issue.

Signed-off-by:  Luugi Marsan <luugi.marsan@amd.com>

--- linux-2.6.19-rc4-git5/drivers/ata/ahci.c.orig       2006-11-04 03:56:22.000000000 +0800
+++ linux-2.6.19-rc4-git5/drivers/ata/ahci.c    2006-11-04 04:20:36.000000000 +0800
@@ -189,6 +189,7 @@ struct ahci_host_priv {
        unsigned long           flags;
        u32                     cap;    /* cache of HOST_CAP register */
        u32                     port_map; /* cache of HOST_PORTS_IMPL reg */
+       u8                      rev;    /* PCI Revision ID */
 };
 
 struct ahci_port_priv {
@@ -220,6 +221,7 @@ static int ahci_port_resume(struct ata_p
 static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
 static int ahci_pci_device_resume(struct pci_dev *pdev);
 static void ahci_remove_one (struct pci_dev *pdev);
+static int ahci_check_atapi_dma(struct ata_queued_cmd *qc);
 
 static struct scsi_host_template ahci_sht = {
        .module                 = THIS_MODULE,
@@ -251,6 +253,8 @@ static const struct ata_port_operations
 
        .tf_read                = ahci_tf_read,
 
+       .check_atapi_dma        = ahci_check_atapi_dma,
+
        .qc_prep                = ahci_qc_prep,
        .qc_issue               = ahci_qc_issue,
 
@@ -906,6 +910,28 @@ static unsigned int ahci_fill_sg(struct
        return n_sg;
 }
 
+static int ahci_check_atapi_dma(struct ata_queued_cmd *qc)
+{
+       struct pci_dev *pdev = to_pci_dev(qc->ap->host->dev);
+      
+       /* walkaround for SB600 SATA ODD isuue */
+       if (0x1002 == pdev->vendor && 0x4380 == pdev->device)
+       {
+               struct ahci_host_priv *priv = qc->ap->host->private_data;
+               u32 rq_len, low_8k;
+
+               if ( 13 < priv->rev )
+                       return 0;
+
+               rq_len = qc->scsicmd->request_bufflen;
+               low_8k = rq_len & 0x1fff;
+
+               if ( (rq_len & 0xffffe000) && low_8k && (512 > low_8k) )
+                       return 1;
+       }
+       return 0;
+}
+
 static void ahci_qc_prep(struct ata_queued_cmd *qc)
 {
        struct ata_port *ap = qc->ap;
@@ -1366,6 +1392,7 @@ static int ahci_host_init(struct ata_pro
 
        hpriv->cap = readl(mmio + HOST_CAP);
        hpriv->port_map = readl(mmio + HOST_PORTS_IMPL);
+       pci_read_config_byte(pdev, PCI_REVISION_ID, &hpriv->rev);
        probe_ent->n_ports = (hpriv->cap & 0x1f) + 1;
 
        VPRINTK("cap 0x%x  port_map 0x%x  n_ports %d\n", 


             reply	other threads:[~2006-11-03 19:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-03 19:00 Luugi Marsan [this message]
2006-11-04 12:52 ` [PATCH 2/2] Workaround for SB600 SATA ODD issue Christoph Hellwig
2006-11-04 17:36 ` Arjan van de Ven
2006-11-04 18:35   ` Christoph Hellwig
2006-11-05 12:45   ` Conke Hu
2006-11-06 12:14 ` Tejun Heo
2006-11-08 13:30 ` Jeff Garzik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061103190004.9ED8DCBD48@localhost.localdomain \
    --to=luugi.marsan@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox