lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-id: <46515983.6030206@shaw.ca>
Date:	Mon, 21 May 2007 02:34:11 -0600
From:	Robert Hancock <hancockr@...w.ca>
To:	Tejun Heo <htejun@...il.com>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	ide <linux-ide@...r.kernel.org>
Cc:	l.genoni@...relinux.com, Alan Cox <alan@...rguk.ukuu.org.uk>
Subject: Re: something strange in libata-core.c for kernel 2.6.22-rc3

Tejun Heo wrote:
> l.genoni@...relinux.com wrote:
>> Mybe I am wrong, but if you are detecting 40-wire cable to set them to
>> DMA/33, why the check includes also 80-wire cables configuring them to
>> DMA/33 too?
>>
>> With this patch my nvidia4 IDE controllers detects correctly and
>> configure correctly DMA/100 for my HD and DMA/33 for my DVD (the first
>> uses a 80-wire cable, the second a 40-wire cable).
>>
>> Am I wrong somewhere?
> 
> That's the drive side verification of 80c cable check, so if the
> condition triggers we downgrade 80c or unknown to 40c.  Cable detection
> on nvidia PATA is a disaster.  You're supposed to do some ACPI dancing
> and drive side detection is completely bogus.  Eeeek....
> 
> Alan, did you have a chance to test the ACPI cable detection?  It just
> didn't work when I tried it.  It always returned 80c on my machine.

On a whim I started poking around in the disassembled ACPI DSDT code for 
my Asus A8N-SLI Deluxe board, which is one of these chipsets. The 
original thought was that the STM/GTM trick on these chipsets is 
supposed to allow us to determine what modes we should use based on what 
modes it sets up appropriately. Unfortunately, unless I'm missing 
something in the AML (which is possible) it doesn't seem like there is 
any validation being done on the settings passed in. The settings appear 
to essentially just get programmed into the controller when STM is 
called and read back on GTM. The only complication is some logic on the 
_PTS method (Prepare to Sleep) which stores the current settings into 
some variables, and in STM, if a flag was set by the _PTS method, the 
previous settings for all registers are stored back first before writing 
the requested values into the correct places.

So in this case, obviously the approach used by pata_acpi, etc. won't 
work for cable detection. Whatever magic register on the chipset 
contains the cable detect value, the AML doesn't seem to be accessing 
it. The ACPI spec doesn't really give any guarantee that the "try STM on 
all possible modes" trick will work either, since there seems to be no 
mention of the AML being required to validate the mode and the STM 
function has no return value to indicate failure.

I guess this means that what we have to do is trust that the BIOS set up 
a reasonable mode and base the cable detect on that (either by reading 
back the boot-up controller registers, or by calling GTM). I imagine 
this is what the Windows default IDE driver is doing (just using the 
boot-up mode and feeding it back using GTM/STM on suspend/resume cycles).

-- 
Robert Hancock      Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@...pamshaw.ca
Home Page: http://www.roberthancock.com/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ