linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Tejun Heo <htejun@gmail.com>
Cc: jgarzik@pobox.com, axboe@suse.de, albertcc@tw.ibm.com,
	linux-ide@vger.kernel.org
Subject: Re: how it's broken....
Date: Tue, 12 Jul 2005 15:26:56 +0900	[thread overview]
Message-ID: <42D362B0.4090505@gmail.com> (raw)
In-Reply-To: <20050707133058.GA16044@htj.dyndns.org>

Tejun Heo wrote:
> On Thu, Jul 07, 2005 at 10:10:04PM +0900, Tejun Heo wrote:
> 
>>10_libata_ahci-atapi.patch
>>
>>	This patch adds ATAPI support to ahci driver.  This currently
>>	doesn't work.  I'll write a reply to this thread to tell more
>>	about this.  However, it at least shows that NCQ ATAPI error
>>	handling works.
>>
> 
> 
>  Hello again, guys.
> 
>  Well, I just added memcpy'ing cdb to ACMD area with this patch and
> thought it should work, but it didn't.  Well, it kind of worked but
> not really.
> 
>  With this patch applied, inquiry succeeds and the device is
> identified and attached with no problem.  Things start to go weird
> with the first TURs (test unit ready) during initialization.
> 
>  When attached to sil, with the same drive and cd inside it, the first
> TUR succeeds and initialization just goes on.  But when attached to
> ahci, it fails all five attempts of TURs with NOT READY, IN PROCESS OF
> BECOMING READY (asc 0x04, ascq 0x01).  This is maybe due to how BIOS
> initializes ATAPI devices during POST.  After five attempts, sr seems
> to give up and just attaches the drive.
> 
>  After boot process is completed, when a read command is issued to
> the drive, the drive works fine on sil, but on ahci, the following
> things happen.
> 
>  * First TUR is failed with MEDIUM CHANGE (asc 0x28 ascq 0x00), which
>    seems reasonable.
>  * Second TUR succeeds.
>  * sr for some reason sends another TUR.  This TUR gets stuck and
>    times out.
>  * Recovery kicks in and resets the device.
>  * sr gives up, unlocks the drive, which the drive fails with RESET
>    occurred.
>  * read fails.
> 
>  The thing is that after a TUR succeeds, the drive completely locks
> up.  If I skip the second TUR, whtatever commands come next gets
> stuck.  If I don't reset after timeout, all following commands are
> timed out.
> 
>  When the same controller is put in legacy mode such that it's
> attached to ata_piix.  The drive works fine just as with sil
> controller.  Any ideas?
> 
>  Log follows.  Log is generated with #11 debug patch applied.  The
> first part is with sil and the second with ahci.

  Okay, I tinkered with it more for past few days.  Here are things I've
found out.

  * Windows XP fails to recognize the drive on boot.  Boot process is
delayed for considerable time (30 secs maybe?) if the drive is attached
on AHCI controller.  After boot, if the drive is unplugged and plugged
again, hotplugging works and the drive gets recognized, and works perfectly.

  * So, I thought maybe AHCI BIOS is doing something weird and somehow
messed up the drive, and, consequently, BIOS wouldn't be able to boot
from the drive.  But it happily loads Gnoppix. ;-(

  * Again out of suspicion that it's caused by BIOS, after Linux boots,
I  unplugged and replugged (including power cable) the drive causing
cold power-cycle.  NCQ recovery kicks in and resets, but the same
result.  After successful TUR, the drive locks up.

  * I thought maybe just interrupt was lost somehow, as the drive is 
reporting status value 0x50 after timing out.  So, I made EH to complete 
commands successfully if ata_ok(stat) on timeout.  But the commands 
weren't properly processed.  The buffers contained garbage values...

  * Then, I just tried everything I could think of, including...
	- limiting interface speed to SATA-I
	- doing SRST
	- doing ATA DEVICE RESET
	- STU
    No matter what I do, the drive locks up eventually.  It's very
weird.  INQUIRY works so command is reaching the device okay and data
transfer from the drive works too.  STU works - if I give LoEJ, it
correctly operates the tray.  And TUR works, it correctly succeeds or
fails (with appropriate sense data) except that the drive locks up after
a successful TUR.

  If you have AHCI and SATA ATAPI device, please try this patch and let
me know how it works.  Now I almost wanna stomp on my DVD writer. ;-(

  PS. Jeff, can you please let me know what you think about this 
patchset?  If it's far from what you have in mind / can accept, I'll be 
happy to redo it.

-- 
tejun


  reply	other threads:[~2005-07-12  6:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-07 13:09 [PATCH libata-dev-2.6:ncq 00/11] libata: new error handling & NCQ generic helpers (review only) Tejun Heo
2005-07-07 13:09 ` [PATCH libata-dev-2.6:ncq 01/11] libata: implement ata_qc_exec_special() Tejun Heo
2005-07-07 13:09 ` [PATCH libata-dev-2.6:ncq 02/11] libata: implement new EH framework and convert non-ncq EH Tejun Heo
2005-07-07 13:09 ` [PATCH libata-dev-2.6:ncq 03/11] libata: convert sata_sil and ata_piix to use new EH Tejun Heo
2005-07-07 13:09 ` [PATCH libata-dev-2.6:ncq 04/11] libata: implement ap->sactive Tejun Heo
2005-07-07 13:09 ` [PATCH libata-dev-2.6:ncq 05/11] libata: add drv_err argument to ata_to_sense_error() Tejun Heo
2005-07-07 13:09 ` [PATCH libata-dev-2.6:ncq 06/11] libata: implement generic NCQ helpers Tejun Heo
2005-07-07 13:09 ` [PATCH libata-dev-2.6:ncq 07/11] libata: convert ahci driver to use new " Tejun Heo
2005-07-07 13:09 ` [PATCH libata-dev-2.6:ncq 08/11] libata: stop dma before reset Tejun Heo
2005-07-07 13:09 ` [PATCH libata-dev-2.6:ncq 09/11] libata: remove unused functions Tejun Heo
2005-07-07 13:10 ` [PATCH libata-dev-2.6:ncq 10/11] libata: add ATAPI support to ahci Tejun Heo
2005-07-07 13:30   ` how it's broken Tejun Heo
2005-07-12  6:26     ` Tejun Heo [this message]
2005-07-07 13:10 ` [PATCH libata-dev-2.6:ncq 11/11] libata: debug stuff Tejun Heo
2005-08-20  6:08 ` [PATCH libata-dev-2.6:ncq 00/11] libata: new error handling & NCQ generic helpers (review only) 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=42D362B0.4090505@gmail.com \
    --to=htejun@gmail.com \
    --cc=albertcc@tw.ibm.com \
    --cc=axboe@suse.de \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@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;
as well as URLs for NNTP newsgroup(s).