From: Tejun Heo <htejun@gmail.com>
To: Luugi Marsan <luugi.marsan@amd.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] Workaround for SB600 SATA ODD issue
Date: Mon, 06 Nov 2006 21:14:00 +0900 [thread overview]
Message-ID: <454F2708.2090705@gmail.com> (raw)
In-Reply-To: <20061103190004.9ED8DCBD48@localhost.localdomain>
Hello,
Luugi Marsan wrote:
> 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>
As others have pointed out, code style seems a bit odd.
> --- 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,
>
Please make a separate port ops for broken controllers and use it only
for broken controllers. Say, ahci_old_sb600_ops?
> @@ -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 */
s/walkaround/workaround/
> + 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;
> +}
And you won't need vendor/device/rev check...
> @@ -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",
if you use ahci_old_sb600_ops only for controller which have the
problem. e.g. Do something like the following in ahci_host_init()
/* probe_ent initialization from port_info */
if (vendor, device and rev match)
probe_ent->port_ops = ahci_old_sb600_ops;
--
tejun
next prev parent reply other threads:[~2006-11-06 12:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-03 19:00 [PATCH 2/2] Workaround for SB600 SATA ODD issue Luugi Marsan
2006-11-04 12:52 ` 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 [this message]
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=454F2708.2090705@gmail.com \
--to=htejun@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luugi.marsan@amd.com \
/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