Help me simulate PATA hard disk in PIO mode 0

A

aleksa

I want to simulate a PATA hard disk, in PIO mode 0.

Basically, I want to respond to two commands:
Identify Drive (0ECh), and Read Sector (20h, 21h, 0C4h).

I use two motherboards to test my hardware,
one from 1997 and one from 2005.

This is how the old motherboard behaves:
BIOS recognizes the 'disk' as PIO mode 0.
BIOS loads the IdentifyDrive data in mode 0.
BIOS loads the ReadSector data in mode 0.

This is how the new motherboard behaves:
BIOS recognizes the 'disk' as PIO mode 0.
BIOS loads the IdentifyDrive data in mode 0.
*BUT*, BIOS loads the ReadSector data in mode 1.

Currently, my hardware cannot support
modes other than PIO mode 0.

Is the BIOS on my new motherboard buggy (who has a disk so old,
right?)
or is my IdentifyDrive data wrong?

This is what I return on Identify Drive command:

PATA_IDsector word 00C5Ah ;0
word 685 ;1
word 0 ;2
word 16 ;3
word 24662 ;4
word 649 ;5
word 38 ;6
word 00030h ;7
word 0000Ah ;8
word 00000h ;9
word " " ;10
word " " ;11
word " " ;12
word " " ;13
word " " ;14
word " " ;15
word " " ;16
word " " ;17
word " " ;18
word " " ;19
word 3 ;20
word 64 ;21
word 4 ;22
word " " ;23
word " " ;24
word " " ;25
word " " ;26
word "PA" ;27
word "TA" ;28
word " T" ;29
word "ES" ;30
word "T " ;31
word " " ;32
word " " ;33
word " " ;34
word " " ;35
word " " ;36
word " " ;37
word " " ;38
word " " ;39
word " " ;40
word " " ;41
word " " ;42
word " " ;43
word " " ;44
word " " ;45
word " " ;46
word 08001h ;47
word 0 ;48
word 00401h ;49
word 0 ;50
word 0 ;51
word 0 ;52
word 2 ;53
word 685 ;54
word 16 ;55
word 38 ;56
word 6 ;57
word 23264 ;58
word 00101h ;59
word 00000h ;60
word 00000h ;61
word 00000h ;62
word 0 ;63
word 0 ;64
word 0 ;65
word 0 ;66
word 600 ;67
word 600 ;68
word 00000h ;69
word 00000h ;70

Words 71-255 are zeros.

Anyone knows what am I doing wrong here?

BTW, the original data for the Identintify Drive command were
taken from old Conner ~230MB and then changed to support only
PIO mode 0, no DMA, etc..
 
P

Paul

aleksa said:
I want to simulate a PATA hard disk, in PIO mode 0.

Basically, I want to respond to two commands:
Identify Drive (0ECh), and Read Sector (20h, 21h, 0C4h).

I use two motherboards to test my hardware,
one from 1997 and one from 2005.

This is how the old motherboard behaves:
BIOS recognizes the 'disk' as PIO mode 0.
BIOS loads the IdentifyDrive data in mode 0.
BIOS loads the ReadSector data in mode 0.

This is how the new motherboard behaves:
BIOS recognizes the 'disk' as PIO mode 0.
BIOS loads the IdentifyDrive data in mode 0.
*BUT*, BIOS loads the ReadSector data in mode 1.

Currently, my hardware cannot support
modes other than PIO mode 0.

Is the BIOS on my new motherboard buggy (who has a disk so old,
right?)
or is my IdentifyDrive data wrong?

This is what I return on Identify Drive command:

PATA_IDsector word 00C5Ah ;0
word 685 ;1
word 0 ;2
word 16 ;3
word 24662 ;4
word 649 ;5
word 38 ;6
word 00030h ;7
word 0000Ah ;8
word 00000h ;9
word " " ;10
word " " ;11
word " " ;12
word " " ;13
word " " ;14
word " " ;15
word " " ;16
word " " ;17
word " " ;18
word " " ;19
word 3 ;20
word 64 ;21
word 4 ;22
word " " ;23
word " " ;24
word " " ;25
word " " ;26
word "PA" ;27
word "TA" ;28
word " T" ;29
word "ES" ;30
word "T " ;31
word " " ;32
word " " ;33
word " " ;34
word " " ;35
word " " ;36
word " " ;37
word " " ;38
word " " ;39
word " " ;40
word " " ;41
word " " ;42
word " " ;43
word " " ;44
word " " ;45
word " " ;46
word 08001h ;47
word 0 ;48
word 00401h ;49
word 0 ;50
word 0 ;51
word 0 ;52
word 2 ;53
word 685 ;54
word 16 ;55
word 38 ;56
word 6 ;57
word 23264 ;58
word 00101h ;59
word 00000h ;60
word 00000h ;61
word 00000h ;62
word 0 ;63
word 0 ;64
word 0 ;65
word 0 ;66
word 600 ;67
word 600 ;68
word 00000h ;69
word 00000h ;70

Words 71-255 are zeros.

Anyone knows what am I doing wrong here?

BTW, the original data for the Identintify Drive command were
taken from old Conner ~230MB and then changed to support only
PIO mode 0, no DMA, etc..

What you need to do, is get more than one version of the
ATA/ATAPI spec on your desk, and compare them. I have a
copy of revision 4 and revision 7 here (for no particular
reason other than to answer questions in the past - the
revision is whatever was sitting on the server at the time).

In revision 4 -

8.12.24 Word 51: PIO data transfer mode number

The PIO transfer timing for each device falls into modes that
have unique parametric timing specifications that are specified
in 10.2.2. The value returned in Bits 15-8 shall be 00h for
mode 0, 01h for mode 1, or 02h for mode 2. Values 03h through
FFh are reserved.

8.12.25 Word 52: Retired

In revision 7 - Here, the contents of word 51:52 are ignored.

6.16.25 Words (52:51): Obsolete

Word 64 has a consistent definition in both standards,
but covers PIO mode 3 and 4.

I guess at this point, standards don't help, because they
don't provide an interpretation of what has happened. If words
51:52 are obsolete, maybe that means any device is required to
support PIO 0,1,2 ?

*******

The standards are available via FTP and HTTP.

Go to this page, to get the username/password of the FTP site.
When you enter the FTP site, a dialog will pop up for the
username and password.

http://www.t13.org/FTPSite/Default.aspx

They filed their docs by year here. You should need the username
and password to get in. The reason for going with the FTP option,
is the HTTP version of the first document is corrupted. This one,
at 1744KB, is OK.

ftp://ftp.t13.org/docs2002/d1532v1r1a-ATA-ATAPI-7.pdf (PDF pg 99) 1744KB
ftp://ftp.t13.org/docs2002/d1532v2r1a-ATA-ATAPI-7.pdf 2330KB

I can't find the ATAPI4 document on the FTP server, but it does
seem to be available via HTTP. Good thing I know the file name,
to ask the server for it. (PDF pg 132)

http://www.t13.org/Documents/UploadedDocuments/project/d1153r18-ATA-ATAPI-4.pdf

Good luck,
Paul
 
A

aleksa

What you need to do, is get more than one version of the
ATA/ATAPI spec on your desk, and compare them. I have a
copy of revision 4 and revision 7 here (for no particular
reason other than to answer questions in the past - the
revision is whatever was sitting on the server at the time).

I already have several versions: 3, 5, 7 and 8.

In revision 4 -

    8.12.24 Word 51: PIO data transfer mode number

    The PIO transfer timing for each device falls into modes that
    have unique parametric timing specifications that are specified
    in 10.2.2. The value returned in Bits 15-8 shall be 00h for
    mode 0, 01h for mode 1, or 02h for mode 2. Values 03h through
    FFh are reserved.

    8.12.25 Word 52: Retired

In revision 7 - Here, the contents of word 51:52 are ignored.

    6.16.25 Words (52:51): Obsolete

Word 64 has a consistent definition in both standards,
but covers PIO mode 3 and 4.

I've set word 51 to 0, that should do it, but..
I guess at this point, standards don't help, because they
don't provide an interpretation of what has happened. If words
51:52 are obsolete, maybe that means any device is required to
support PIO 0,1,2 ?

I hope not, but you are probably right. My old Conner does not work
with my new motherboard, although I haven't tried it that much.

I don't know why do they have to boot (load one sector) in UDMA5...

*******

The standards are available via FTP and HTTP.

Go to this page, to get the username/password of the FTP site.
When you enter the FTP site, a dialog will pop up for the
username and password.

http://www.t13.org/FTPSite/Default.aspx

They filed their docs by year here. You should need the username
and password to get in. The reason for going with the FTP option,
is the HTTP version of the first document is corrupted. This one,
at 1744KB, is OK.

ftp://ftp.t13.org/docs2002/d1532v1r1a-ATA-ATAPI-7.pdf (PDF pg 99) 1744KBftp://ftp.t13.org/docs2002/d1532v2r1a-ATA-ATAPI-7.pdf 2330KB

I can't find the ATAPI4 document on the FTP server, but it does
seem to be available via HTTP. Good thing I know the file name,
to ask the server for it. (PDF pg 132)

http://www.t13.org/Documents/UploadedDocuments/project/d1153r18-ATA-A...

Good luck,
    Paul- Hide quoted text -

- Show quoted text -


Does anyone have a working PIO mode 0 hard drive?
I could than get the IdentifyDrive data that the disk sends to the
host.
 
F

Franc Zabkar

I want to simulate a PATA hard disk, in PIO mode 0.

Basically, I want to respond to two commands:
Identify Drive (0ECh), and Read Sector (20h, 21h, 0C4h).

I use two motherboards to test my hardware,
one from 1997 and one from 2005.

This is how the old motherboard behaves:
BIOS recognizes the 'disk' as PIO mode 0.
BIOS loads the IdentifyDrive data in mode 0.
BIOS loads the ReadSector data in mode 0.

This is how the new motherboard behaves:
BIOS recognizes the 'disk' as PIO mode 0.
BIOS loads the IdentifyDrive data in mode 0.
*BUT*, BIOS loads the ReadSector data in mode 1.

Currently, my hardware cannot support
modes other than PIO mode 0.

Is the BIOS on my new motherboard buggy (who has a disk so old,
right?)
or is my IdentifyDrive data wrong?

This is what I return on Identify Drive command:

PATA_IDsector word 00C5Ah ;0
word 685 ;1
word 0 ;2
word 16 ;3
word 24662 ;4
word 649 ;5
word 38 ;6
word 00030h ;7
word 0000Ah ;8
word 00000h ;9
word " " ;10
word " " ;11
word " " ;12
word " " ;13
word " " ;14
word " " ;15
word " " ;16
word " " ;17
word " " ;18
word " " ;19
word 3 ;20
word 64 ;21
word 4 ;22
word " " ;23
word " " ;24
word " " ;25
word " " ;26
word "PA" ;27
word "TA" ;28
word " T" ;29
word "ES" ;30
word "T " ;31
word " " ;32
word " " ;33
word " " ;34
word " " ;35
word " " ;36
word " " ;37
word " " ;38
word " " ;39
word " " ;40
word " " ;41
word " " ;42
word " " ;43
word " " ;44
word " " ;45
word " " ;46
word 08001h ;47
word 0 ;48
word 00401h ;49
word 0 ;50
word 0 ;51
word 0 ;52
word 2 ;53
word 685 ;54
word 16 ;55
word 38 ;56
word 6 ;57
word 23264 ;58
word 00101h ;59
word 00000h ;60
word 00000h ;61
word 00000h ;62
word 0 ;63
word 0 ;64
word 0 ;65
word 0 ;66
word 600 ;67
word 600 ;68
word 00000h ;69
word 00000h ;70

Words 71-255 are zeros.

Anyone knows what am I doing wrong here?

BTW, the original data for the Identintify Drive command were
taken from old Conner ~230MB and then changed to support only
PIO mode 0, no DMA, etc..

The above data block is for an ATAPI device, eg optical drive, not for
an ATA device, eg hard disc. The Identify Drive command (ECh) is used
for ATA devices, whereas the Identify Packet Device command (A1h) is
used for ATAPI devices. Among other things, words 49 and word 0 are
interpreted differently. Bits 15 and 14 of word 0 determine whether
the device is ATA or ATAPI, or something else.

I have some .bin and .ata example files here:
http://www.users.on.net/~fzabkar/IDE-identify/

To complicate matters further, IIRC Conner drives were problematic in
that they reported their physical CHS geometry but used their
translated geometry. Microsoft recognised that some early Conner
drives needed special treatment, hence the tell-tale "conner" text
strings in the ESDI_506.PDR driver.

See http://www.users.on.net/~fzabkar/esdi_506.txt

See this old post for Identify Drive data for a CP3046 (40MB) drive:
http://groups.google.com/group/comp.sys.ibm.pc.hardware.storage/msg/cfc5d101fb934a4f?dmode=source

- Franc Zabkar
 
A

aleksa

The above data block is for an ATAPI device, eg optical drive, not for
an ATA device, eg hard disc. The Identify Drive command (ECh) is used
for ATA devices, whereas the Identify Packet Device command (A1h) is
used for ATAPI devices. Among other things, words 49 and word 0 are
interpreted differently. Bits 15 and 14 of word 0 determine whether
the device is ATA or ATAPI, or something else.

No, you have misinterpreted the bits.
The first word is 0C5A, bit 15 is clear.
I have some .bin and .ata example files here:
 http://www.users.on.net/~fzabkar/IDE-identify/

To complicate matters further, IIRC Conner drives were problematic in
that they reported their physical CHS geometry but used their
translated geometry. Microsoft recognised that some early Conner
drives needed special treatment, hence the tell-tale "conner" text
strings in the ESDI_506.PDR driver.

Seehttp://www.users.on.net/~fzabkar/esdi_506.txt

See this old post for Identify Drive data for a CP3046 (40MB) drive:http://groups.google.com/group/comp.sys.ibm.pc.hardware.storage/msg/c...

- Franc Zabkar

Thank you very much for the files! I will
look at them more closely tommorow.

That find-ata.exe looks very interesting.

Anyway, I'm thinking to abandon PIO mode 0 and
start using mode 4 with IORDY on every DIOR/DIOW.

Cheers!
 
A

aleksa

Given my data block, find-ata.exe said what I've expected:
PIO mode 0 only, 600ns etc..

Since the new motherboard BIOS do not see it that way,
all I can says that it is buggy.

I try that IORDY in mode 4
 
F

Franc Zabkar

Given my data block, find-ata.exe said what I've expected:
PIO mode 0 only, 600ns etc..

Since the new motherboard BIOS do not see it that way,
all I can says that it is buggy.

I try that IORDY in mode 4

I should mention that Find-ata is a very old Seagate utility. Although
in your case its report appears to be accurate, I wouldn't normally
trust its interpretation of the Identify Drive output for modern
devices. Instead I would use it to (D)ump the raw data from, say, the
(P)rimary (M)aster as follows:

find-ata p m d

It seems to me that word 51 bits 15-8 (PIO data transfer cycle timing
mode) determines the default PIO mode, at least for older BIOSes.
Maybe you could play with those numbers ??? Or maybe you could enable
words 67 and 68 for modern BIOSes (word 51 is obsolete in the ATAPI-5
spec) and hope that the bug doesn't show up there ???

FYI, here are links to the various standards:

http://www.t10.org/t13/project/d1321r3-ATA-ATAPI-5.pdf
http://www.t10.org/t13/project/d1153r18-ATA-ATAPI-4.pdf
http://www.t10.org/t13/project/d2008r7b-ATA-3.pdf
http://www.t10.org/t13/project/d0948r4c-ATA-2.pdf
ftp://ftp.t10.org/t13/project/d0791r4c-ATA-1.pdf
http://en.wikipedia.org/wiki/Atapi

BTW, comp.sys.ibm.pc.hardware.storage may be a better newsgroup for
this type of question.

- Franc Zabkar
 
A

aleksa

I should mention that Find-ata is a very old Seagate utility. Although
in your case its report appears to be accurate, I wouldn't normally
trust its interpretation of the Identify Drive output for modern
devices. Instead I would use it to (D)ump the raw data from, say, the
(P)rimary (M)aster as follows:

 find-ata p m d

It seems to me that word 51 bits 15-8 (PIO data transfer cycle timing
mode) determines the default PIO mode, at least for older BIOSes.
Maybe you could play with those numbers ??? Or maybe you could enable
words 67 and 68 for modern BIOSes (word 51 is obsolete in the ATAPI-5
spec) and hope that the bug doesn't show up there ???

FYI, here are links to the various standards:

 http://www.t10.org/t13/project/d1321r3-ATA-ATAPI-5.pdf
 http://www.t10.org/t13/project/d1153r18-ATA-ATAPI-4.pdf
 http://www.t10.org/t13/project/d2008r7b-ATA-3.pdf
 http://www.t10.org/t13/project/d0948r4c-ATA-2.pdf
 ftp://ftp.t10.org/t13/project/d0791r4c-ATA-1.pdf
 http://en.wikipedia.org/wiki/Atapi

BTW, comp.sys.ibm.pc.hardware.storage may be a better newsgroup for
this type of question.

- Franc Zabkar

Thanks for the links and the correct newsgroup!
 
A

aleksa

I should mention that Find-ata is a very old Seagate utility. Although
in your case its report appears to be accurate, I wouldn't normally
trust its interpretation of the Identify Drive output for modern
devices. Instead I would use it to (D)ump the raw data from, say, the
(P)rimary (M)aster as follows:

 find-ata p m d

It seems to me that word 51 bits 15-8 (PIO data transfer cycle timing
mode) determines the default PIO mode, at least for older BIOSes.
Maybe you could play with those numbers ??? Or maybe you could enable
words 67 and 68 for modern BIOSes (word 51 is obsolete in the ATAPI-5
spec) and hope that the bug doesn't show up there ???

I think I already did my best on these words..

Thanks, now I have ATA 1-5 and 7-8, only 6 is missing
BTW, comp.sys.ibm.pc.hardware.storage may be a better newsgroup for
this type of question.

I've posted a message to that group, lets see what guys over there
have to say!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top