Page 1 of 1

PS2ATAD

Posted: Sat Jun 25, 2005 2:26 am
by R0
I managed to find a suspicious code in PS2ATAD module. There is a function ata_device_probe() in the file ps2atad.c with possible bug in it. I think following code is incorrect:

Code: Select all

	if ((nsector != 1) || (nsector != 1))
		return;
It seems one of variables was left unchecked.

Posted: Sat Jun 25, 2005 2:39 am
by ooPo
That looks like the C equivalent of double-checking your work.

Posted: Sat Jun 25, 2005 4:50 am
by pixel
Checking into sony's atad.irx should help. Somebody have it somewhere ? I don't think I do, apart of my bios, no ?

Re: PS2ATAD

Posted: Sat Jun 25, 2005 6:06 am
by mrbrown
R0 wrote:I managed to find a suspicious code in PS2ATAD module. There is a function ata_device_probe() in the file ps2atad.c with possible bug in it. I think following code is incorrect:

Code: Select all

	if ((nsector != 1) || (nsector != 1))
		return;
It seems one of variables was left unchecked.
The second check should be "sector" instead of "nsector". The ATA spec should have more info.

Posted: Sat Jun 25, 2005 6:16 am
by dlanor
pixel wrote:Checking into sony's atad.irx should help. Somebody have it somewhere ? I don't think I do, apart of my bios, no ?
Is our ps2atad really so closely related to the Sony atad module, that we can expect code snippets like this to even exist in similar form ?

I had the impression that ps2atad was more independently written, which also seemed the only reasonable explanation why we use a different module name for it. ("atad_driver" as opposed to the simple "atad" used in modules I've seen with commercial games.)

I understood (or thought I did) that our modules (ps2dev9, ps2atad, ps2hdd) perform the same basic purpose as corresponding Sony modules (dev9, atad, hdd) but were independently developed. So while each group of modules work well together, individual modules are NOT direct replacements for those in the other group, which was the motivation for having different internal module names. (adding our "_driver" string to the corresponding names used by Sony)

Are you now saying that this understanding is wrong ?
If that is true, then we must reevaluate our position on some issues, and should also definitely change our module naming scheme.

I'm rather confused now, so I hope you can straighten this out for me.

Best regards: dlanor

Posted: Sat Jun 25, 2005 6:28 am
by pixel
mrbrown: okay, posting a fix if you don't.
dlanor: half of the hdd stuff was disassembled, and the other half was rewritten from various "common knowledge" specs.

Posted: Sat Jun 25, 2005 8:08 am
by R0
Is our ps2atad really so closely related to the Sony atad module, that we can expect code snippets like this to even exist in similar form ?
Both ps2dev9 and ps2atad are very close to SCE's modules. ps2dev9 differs from dev9 in some functions: dma transfer (sema vs polling), initialization (ps2dev9 has no some smap-initialization code), exports (dev9 has two additional functions). ps2atad also differs from atad in some cases - exports (last function), initialization (no check for SCE genuine hdd) and few other minor differences.