Page 1 of 1
ide devices
Posted: Wed May 05, 2004 11:00 pm
by bluecode
hi everybody,
I want to know, what's the best way to determinate which IDE Devices are present and which aren't. I want to do it the hard way by using ports. I'm not new to this, because I've already read sectors & device id information via ports, but now it would be nice if my os could find the existing ide devices.
I hope you can help me!
Thanks!
(I'm sorry for my bad English, but I hope you can understand what I would like to know)
RE:ide devices
Posted: Wed May 05, 2004 11:00 pm
by ASHLEY4
First you would do this.
mov byte [command],0ECh
lable1:
mov word [Port],1F0h
mov byte [Drive],0
call IdentifyDrive ; this is your proc for 12byte command's
mov byte [Drive],10h
call IdentifyDrive
mov word [Port],170h
mov byte [Drive],0
call IdentifyDrive
mov byte [Drive],10h
cmp byte[command],0A1h
je endofprogram
mov byte [command],0A1h
jmp lable1
endofprogram:
At the end of the "IdentifyDrive" proc you test the comnand number if its "0ECh" its a harddrive,if its 0A1h it's a cd/dvd drive,if there is nothing on the port etc it should have a time out error and return.
This code has not been tested so may need moding.
ASHLEY4.
RE:ide devices
Posted: Tue May 11, 2004 11:00 pm
by orb2000
I recently did this for my thesis project. Depending on how in depth you want it to be, you can scan the pci bus looking for ide controllers. Once you have a list of these you may probe them with a degree of confidence. If you just probe the standard ide ports 0x1f0h and 0x170 you only have access to the 4 drives that connect to it, not possible additional ata addon cards eg a promise expansion card.
Working with the standard interface will work however it doesn't allow you to enable advanced features like UDMA33/66/100/XXX. For these you must code a specific driver however their function are basically the same, with a few hardware differences.
I have found that it is easier to talk to the disk using PIO than DMA however, if you os is multi-tasking then DMA is really the only way to go, thats just my opinion though.
cheers
orb
RE:ide devices
Posted: Thu May 13, 2004 11:00 pm
by bluecode
hi everybody,
Thank you for your great help!
But I've another problem right now: My os boots up and detect all connected ide devices correctly. But after that the status port (0x1F7) contains the value 0x00 (without emulator) and some usefull value (ready&seek complete) with VMware. I think I've to initialize my harddisk & controller first, but I don't know how.
I hope you can help me again