* [BUG] ATAPI command TEST_UNIT_READY never succeeds!
@ 2007-03-07 12:09 Conke Hu
2007-03-07 12:23 ` Conke Hu
0 siblings, 1 reply; 5+ messages in thread
From: Conke Hu @ 2007-03-07 12:09 UTC (permalink / raw)
To: Jeff Garzik, Alan, Tejun Heo, Linux Kernel Mailing List
Hi,
Do you ever noticed that the ATAPI command TEST_UNIT_READY always
fails to execute !?
I debugged in the following environments:
piix + Intel ICH6/ICH7 PATA
atiixp + ATI SB600 PATA
libata + ata_piix + Intel ICH6/ICH7 PATA
libata + sata_sil24 + Silicon Image 3132
libata + ahci + ATI SB600 SATA
libata + ahci + Intel AHCI
but none of them can execute TEST_UNIT_READY command successfully.
For example, in ahci driver, ahci_interrupt() reads port status as
0x4000_0000, which indicates an taskfile error.
Conke
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [BUG] ATAPI command TEST_UNIT_READY never succeeds! 2007-03-07 12:09 [BUG] ATAPI command TEST_UNIT_READY never succeeds! Conke Hu @ 2007-03-07 12:23 ` Conke Hu 2007-03-07 12:27 ` Tejun Heo 0 siblings, 1 reply; 5+ messages in thread From: Conke Hu @ 2007-03-07 12:23 UTC (permalink / raw) To: Jeff Garzik, Alan, Tejun Heo, Linux Kernel Mailing List On 3/7/07, Conke Hu <conke.hu@gmail.com> wrote: > Hi, > Do you ever noticed that the ATAPI command TEST_UNIT_READY always > fails to execute !? > I debugged in the following environments: > piix + Intel ICH6/ICH7 PATA > atiixp + ATI SB600 PATA > libata + ata_piix + Intel ICH6/ICH7 PATA > libata + sata_sil24 + Silicon Image 3132 > libata + ahci + ATI SB600 SATA > libata + ahci + Intel AHCI > but none of them can execute TEST_UNIT_READY command successfully. > For example, in ahci driver, ahci_interrupt() reads port status as > 0x4000_0000, which indicates an taskfile error. ~~~~~~~~~~~~~~~~~~ 0x4000_0001, not 0x4000_0000, sorry. more precisely speaking, ahci_host_intr() reads PORT_IRQ_STAT as 0x4000_0001, not the expected 0x0000_0001. Conke ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [BUG] ATAPI command TEST_UNIT_READY never succeeds! 2007-03-07 12:23 ` Conke Hu @ 2007-03-07 12:27 ` Tejun Heo 2007-03-09 12:21 ` Conke Hu 0 siblings, 1 reply; 5+ messages in thread From: Tejun Heo @ 2007-03-07 12:27 UTC (permalink / raw) To: Conke Hu; +Cc: Jeff Garzik, Alan, Linux Kernel Mailing List Conke Hu wrote: > On 3/7/07, Conke Hu <conke.hu@gmail.com> wrote: >> Hi, >> Do you ever noticed that the ATAPI command TEST_UNIT_READY always >> fails to execute !? >> I debugged in the following environments: >> piix + Intel ICH6/ICH7 PATA >> atiixp + ATI SB600 PATA >> libata + ata_piix + Intel ICH6/ICH7 PATA >> libata + sata_sil24 + Silicon Image 3132 >> libata + ahci + ATI SB600 SATA >> libata + ahci + Intel AHCI >> but none of them can execute TEST_UNIT_READY command successfully. >> For example, in ahci driver, ahci_interrupt() reads port status as >> 0x4000_0000, which indicates an taskfile error. > ~~~~~~~~~~~~~~~~~~ > > 0x4000_0001, not 0x4000_0000, sorry. > > more precisely speaking, ahci_host_intr() reads PORT_IRQ_STAT as > 0x4000_0001, not the expected 0x0000_0001. I've read your last posting about this, but forgot to follow up. TUR is supposed to fail if ATAPI device doesn't have media loaded. TUR fails and sense data returns device not ready - media not present. That's the normal operation. Does TUR fail even with media loaded or is sense data not properly fetched? -- tejun ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [BUG] ATAPI command TEST_UNIT_READY never succeeds! 2007-03-07 12:27 ` Tejun Heo @ 2007-03-09 12:21 ` Conke Hu 2007-03-09 12:59 ` Tejun Heo 0 siblings, 1 reply; 5+ messages in thread From: Conke Hu @ 2007-03-09 12:21 UTC (permalink / raw) To: Tejun Heo; +Cc: Jeff Garzik, Alan, Linux Kernel Mailing List On 3/7/07, Tejun Heo <htejun@gmail.com> wrote: > (snip) > I've read your last posting about this, but forgot to follow up. TUR is > supposed to fail if ATAPI device doesn't have media loaded. TUR fails > and sense data returns device not ready - media not present. That's the > normal operation. Does TUR fail even with media loaded or is sense data > not properly fetched? > Thank you, Tejun! I did forget to load any media :( When I load media and retry, TUR succeeds but there is still a problem: when using ahci driver, TUR will not succeed unless it runs twice, and the following loop always runs till retries==2 -------------------- code in sr.c, get_capabilities() ------------------------- retries = 0; do { memset((void *)cmd, 0, MAX_COMMAND_SIZE); cmd[0] = TEST_UNIT_READY; the_result = scsi_execute_req (cd->device, cmd, DMA_NONE, NULL, 0, &sshdr, SR_TIMEOUT, MAX_RETRIES); retries++; } while (retries < 5 && (!scsi_status_is_good(the_result) || (scsi_sense_valid(&sshdr) && sshdr.sense_key == UNIT_ATTENTION))); ------------------------------------- end code ------------------------------------- this issue only occurs in ahci driver, and libata + pata driver is OK. Conke ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [BUG] ATAPI command TEST_UNIT_READY never succeeds! 2007-03-09 12:21 ` Conke Hu @ 2007-03-09 12:59 ` Tejun Heo 0 siblings, 0 replies; 5+ messages in thread From: Tejun Heo @ 2007-03-09 12:59 UTC (permalink / raw) To: Conke Hu; +Cc: Jeff Garzik, Alan, Linux Kernel Mailing List Conke Hu wrote: > On 3/7/07, Tejun Heo <htejun@gmail.com> wrote: >> (snip) >> I've read your last posting about this, but forgot to follow up. TUR is >> supposed to fail if ATAPI device doesn't have media loaded. TUR fails >> and sense data returns device not ready - media not present. That's the >> normal operation. Does TUR fail even with media loaded or is sense data >> not properly fetched? >> > > Thank you, Tejun! I did forget to load any media :( > When I load media and retry, TUR succeeds but there is still a > problem: when using ahci driver, TUR will not succeed unless it runs > twice, and the following loop always runs till retries==2 > -------------------- code in sr.c, get_capabilities() > ------------------------- > retries = 0; > do { > memset((void *)cmd, 0, MAX_COMMAND_SIZE); > cmd[0] = TEST_UNIT_READY; > > the_result = scsi_execute_req (cd->device, cmd, DMA_NONE, NULL, > 0, &sshdr, SR_TIMEOUT, > MAX_RETRIES); > > retries++; > } while (retries < 5 && > (!scsi_status_is_good(the_result) || > (scsi_sense_valid(&sshdr) && > sshdr.sense_key == UNIT_ATTENTION))); > ------------------------------------- end code > ------------------------------------- > > this issue only occurs in ahci driver, and libata + pata driver is OK. After media is loaded, it takes some time for the device to get ready, and it's supposed to raise UNIT_ATTENTION to tell the driver that media has changed. TUR fails with UA and sense data reports media exchanged and the next TUR succeeds. In SATA, you might also see unit reset UA due to the probing sequence. Those are why TUR is tried several times in the first place. So, there's nothing wrong with failing TURs, it's perfectly normal that they fail first one or two tries. -- tejun ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-03-09 12:59 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-03-07 12:09 [BUG] ATAPI command TEST_UNIT_READY never succeeds! Conke Hu 2007-03-07 12:23 ` Conke Hu 2007-03-07 12:27 ` Tejun Heo 2007-03-09 12:21 ` Conke Hu 2007-03-09 12:59 ` Tejun Heo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox