CINXE.COM
LKML: Jeff Garzik: [PATCH] Re: LIBATA AHCI engine timeout hang with ATAPI devices
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>LKML: Jeff Garzik: [PATCH] Re: LIBATA AHCI engine timeout hang with ATAPI devices</title><link href="/css/message.css" rel="stylesheet" type="text/css" /><link href="/css/wrap.css" rel="alternate stylesheet" type="text/css" title="wrap" /><link href="/css/nowrap.css" rel="stylesheet" type="text/css" title="nowrap" /><link href="/favicon.ico" rel="shortcut icon" /><script src="/js/simple-calendar.js" type="text/javascript"></script><script src="/js/styleswitcher.js" type="text/javascript"></script><link rel="alternate" type="application/rss+xml" title="lkml.org : last 100 messages" href="/rss.php" /><link rel="alternate" type="application/rss+xml" title="lkml.org : last messages by Jeff Garzik" href="/groupie.php?aid=46" /><!--Matomo--><script> var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ _paq.push(["setDoNotTrack", true]); _paq.push(["disableCookies"]); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="//m.lkml.org/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', '1']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); </script><!--End Matomo Code--></head><body onload="es.jasper.simpleCalendar.init();" itemscope="itemscope" itemtype="http://schema.org/BlogPosting"><table border="0" cellpadding="0" cellspacing="0"><tr><td width="180" align="center"><a href="/"><img style="border:0;width:135px;height:32px" src="/images/toprowlk.gif" alt="lkml.org" /></a></td><td width="32">聽</td><td class="nb"><div><a class="nb" href="/lkml"> [lkml]</a> 聽 <a class="nb" href="/lkml/2005"> [2005]</a> 聽 <a class="nb" href="/lkml/2005/4"> [Apr]</a> 聽 <a class="nb" href="/lkml/2005/4/8"> [8]</a> 聽 <a class="nb" href="/lkml/last100"> [last100]</a> 聽 <a href="/rss.php"><img src="/images/rss-or.gif" border="0" alt="RSS Feed" /></a></div><div>Views: <a href="#" class="nowrap" onclick="setActiveStyleSheet('wrap');return false;">[wrap]</a><a href="#" class="wrap" onclick="setActiveStyleSheet('nowrap');return false;">[no wrap]</a> 聽 <a class="nb" href="/lkml/mheaders/2005/4/8/238" onclick="this.href='/lkml/headers'+'/2005/4/8/238';">[headers]</a>聽 <a href="/lkml/bounce/2005/4/8/238">[forward]</a>聽 </div></td><td width="32">聽</td></tr><tr><td valign="top"><div class="es-jasper-simpleCalendar" baseurl="/lkml/"></div><div class="threadlist">Messages in this thread</div><ul class="threadlist"><li class="root"><a href="/lkml/2005/4/8/238">First message in thread</a></li><li class="origin"><a href="/lkml/2005/4/8/293">Jeff Garzik</a><ul><li><a href="/lkml/2005/4/8/293">"Eric A. Cottrell"</a></li></ul></li></ul><div class="threadlist">Patch in this message</div><ul class="threadlist"><li><a href="/lkml/diff/2005/4/8/238/1">Get diff 1</a></li></ul></td><td width="32" rowspan="2" class="c" valign="top"><img src="/images/icornerl.gif" width="32" height="32" alt="/" /></td><td class="c" rowspan="2" valign="top" style="padding-top: 1em"><table><tr><td><table><tr><td class="lp">Date</td><td class="rp" itemprop="datePublished">Fri, 08 Apr 2005 15:13:14 -0400</td></tr><tr><td class="lp">From</td><td class="rp" itemprop="author">Jeff Garzik <></td></tr><tr><td class="lp">Subject</td><td class="rp" itemprop="name">[PATCH] Re: LIBATA AHCI engine timeout hang with ATAPI devices</td></tr></table></td><td></td></tr></table><pre itemprop="articleBody">Eric A. Cottrell wrote:<br />> Hello,<br />> <br />> I made the mistake of getting the Plextor SATA DVD Recorder with my new <br />> system not realizing that SATA support is just coming online. I want to <br />> turn this into an opportunity to make the Plextor work. Thanks to the <br />> IDE information pages I got a good start.<br />> <br />> I have success using the ata_piix and ahci drivers with SATA Hard <br />> Drives. I noticed that the Plextor works with the ata_piix driver but <br />> not with the AHCI driver. The AHCI driver hangs after the INQUIRY is <br />> printed.<br /><br />You need something like the attached patch.<br /><br />In general, ATAPI is still very much experimental at this point. One <br />known bug that affects libata is that ATAPI DMA is not aligned to a <br />4-byte boundary.<br /><br /> Jeff<br /><br /><br /># This is a BitKeeper generated diff -Nru style patch.<br />#<br /># ChangeSet<br /># 2005/02/17 04:43:52-05:00 jgarzik@pobox.com <br /># [libata ahci] finish ATAPI support<br /># <br /># drivers/scsi/ahci.c<br /># 2005/02/17 04:42:57-05:00 jgarzik@pobox.com +9 -13<br /># [libata ahci] finish ATAPI support<br /># <br />diff -Nru a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c<br />--- a/drivers/scsi/ahci.c 2005-04-08 15:10:54 -04:00<br />+++ b/drivers/scsi/ahci.c 2005-04-08 15:10:54 -04:00<br />@@ -38,7 +38,7 @@<br /> #include <asm/io.h><br /> <br /> #define DRV_NAME "ahci"<br />-#define DRV_VERSION "1.00"<br />+#define DRV_VERSION "1.10"<br /> <br /> <br /> enum {<br />@@ -49,6 +49,7 @@<br /> AHCI_CMD_SLOT_SZ = 32 * 32,<br /> AHCI_RX_FIS_SZ = 256,<br /> AHCI_CMD_TBL_HDR = 0x80,<br />+ AHCI_CMD_TBL_CDB = 0x40,<br /> AHCI_CMD_TBL_SZ = AHCI_CMD_TBL_HDR + (AHCI_MAX_SG * 16),<br /> AHCI_PORT_PRIV_DMA_SZ = AHCI_CMD_SLOT_SZ + AHCI_CMD_TBL_SZ +<br /> AHCI_RX_FIS_SZ,<br />@@ -477,7 +478,8 @@<br /> <br /> static void ahci_qc_prep(struct ata_queued_cmd *qc)<br /> {<br />- struct ahci_port_priv *pp = qc->ap->private_data;<br />+ struct ata_port *ap = qc->ap;<br />+ struct ahci_port_priv *pp = ap->private_data;<br /> u32 opts;<br /> const u32 cmd_fis_len = 5; /* five dwords */<br /> <br />@@ -489,18 +491,8 @@<br /> opts = (qc->n_elem << 16) | cmd_fis_len;<br /> if (qc->tf.flags & ATA_TFLAG_WRITE)<br /> opts |= AHCI_CMD_WRITE;<br />-<br />- switch (qc->tf.protocol) {<br />- case ATA_PROT_ATAPI:<br />- case ATA_PROT_ATAPI_NODATA:<br />- case ATA_PROT_ATAPI_DMA:<br />+ if (is_atapi_taskfile(&qc->tf))<br /> opts |= AHCI_CMD_ATAPI;<br />- break;<br />-<br />- default:<br />- /* do nothing */<br />- break;<br />- }<br /> <br /> pp->cmd_slot[0].opts = cpu_to_le32(opts);<br /> pp->cmd_slot[0].status = 0;<br />@@ -512,6 +504,10 @@<br /> * a SATA Register - Host to Device command FIS.<br /> */<br /> ata_tf_to_fis(&qc->tf, pp->cmd_tbl, 0);<br />+ if (opts & AHCI_CMD_ATAPI) {<br />+ memset(pp->cmd_tbl + AHCI_CMD_TBL_CDB, 0, 32);<br />+ memcpy(pp->cmd_tbl + AHCI_CMD_TBL_CDB, qc->cdb, ap->cdb_len);<br />+ }<br /> <br /> if (!(qc->flags & ATA_QCFLAG_DMAMAP))<br /> return;</pre></td><td width="32" rowspan="2" class="c" valign="top"><img src="/images/icornerr.gif" width="32" height="32" alt="\" /></td></tr><tr><td align="right" valign="bottom"> 聽 </td></tr><tr><td align="right" valign="bottom">聽</td><td class="c" valign="bottom" style="padding-bottom: 0px"><img src="/images/bcornerl.gif" width="32" height="32" alt="\" /></td><td class="c">聽</td><td class="c" valign="bottom" style="padding-bottom: 0px"><img src="/images/bcornerr.gif" width="32" height="32" alt="/" /></td></tr><tr><td align="right" valign="top" colspan="2"> 聽 </td><td class="lm">Last update: 2005-04-08 21:23 聽聽 [from the cache]<br />漏2003-2020 <a href="http://blog.jasper.es/"><span itemprop="editor">Jasper Spaans</span></a>|hosted at <a href="https://www.digitalocean.com/?refcode=9a8e99d24cf9">Digital Ocean</a> and my Meterkast|<a href="http://blog.jasper.es/categories.html#lkml-ref">Read the blog</a></td><td>聽</td></tr></table><script language="javascript" src="/js/styleswitcher.js" type="text/javascript"></script></body></html>