From mboxrd@z Thu Jan 1 00:00:00 1970 From: Douglas Gilbert Date: Fri, 02 Apr 2010 16:39:11 +0000 Subject: Re: System hangs when using USB 3.0 HD with on Ubuntu Message-Id: <4BB61DAF.7090709@interlog.com> List-Id: References: <4BB61237.5030000@ru.mvista.com> <4BB61975.1070406@interlog.com> In-Reply-To: <4BB61975.1070406@interlog.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: dgilbert@interlog.com Cc: Sergei Shtylyov , Alan Stern , James Bottomley , Jonas Schwertfeger , Kay Sievers , David Zeuthen , linux-hotplug@vger.kernel.org, Sarah Sharp , linux-usb@vger.kernel.org, USB Storage List , Matthew Dharm , linux-scsi@vger.kernel.org, Lennart Poettering , mlord@pobox.com Douglas Gilbert wrote: > Sergei Shtylyov wrote: >> Hello. >> >> Alan Stern wrote: >> >>>>> Best guess (and it's a guess only) would be that the USB bridge SAT >>>>> layer doesn't implement ATA_16 and so fails in interesting ways >>>>> when it >>>>> comes in. Does the ATA_12 version of IDENTIFY DEVICE succeed? >>>>> >>>> It does. And in between the two is an ATA_16 SET FEATURES command >>>> which also (apparently) succeeds. That is, there is no error >>>> indication from the device -- but goodness knows if it actually carries >>>> out the command. >>>> >>> >>> Incidentally, there's a discussion of this problem with input from an >>> engineer at the company that makes the bridge chip here: >>> >>> https://bugs.launchpad.net/ubuntu/+source/linux-fsl-imx51/+bug/431963 >>> >>> See comment #25 and later. He claims that the ATA pass-through command >>> contains a SECTOR COUNT field of 0 even though it asks for 512 bytes of >>> IDENTIFY data. This invalid parameter combination causes the bridge >>> chip to get confused, and instead of failing gracefully, it messes up >>> the USB protocol. >>> >> >> IDENTIFY DEVICE command always returns 512 bytes of data, regardless >> of any value in the sector count register. >> >>> Does anybody know where to find out why hdparm is sending an IDENTIFY >>> command with invalid parameters? >>> >> >> IDENTIFY DEVICE command has *no* parameters. > > Confirming that, what is put in the ATA_16 sector > count field is what the ATA command (IDENTIFY DEVICE) > expects in its count field. And according to ACS-2 (rev 2) > for IDENTIFY DEVICE that is "N/A" which I would > interpret as zero. Ouch. Reviewing that "N/A" in the ATA spec: it means that neither the host nor device should check that field. So it could be any value, in this case 1. At the SCSI ATA pass-through commands need sector_count to calculate the data transfer length (sat2r09.pdf tables 109, 111 and 112) as James said. Clear as mud, better check my code ... Doug Gilbert