Hard Drive Driver

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
Omega
Member
Member
Posts: 250
Joined: Sun May 25, 2008 2:04 am
Location: United States
Contact:

Hard Drive Driver

Post by Omega »

Hi. I just finished my LBA/PIO driven Hard Drive Driver part II (was DMA) and lo and behold the dang thing still errors on real hardware. It works brilliantly in VPC, even returns the bootsig (0x55 0xAA), but on real hardware it blows with error 51. So, I have been thinking and I think that the reason is due to my setup; I set my hdd up in the SATA fashion, not IDE. So my question is, do I need to do something special with my driver considering what I have just told you? thanks
Free energy is indeed evil for it absorbs the light.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: Hard Drive Driver

Post by JamesM »

I set my hdd up in the SATA fashion, not IDE
Come on man, give us the right information! is your HDD SATA or IDE?!
User avatar
Omega
Member
Member
Posts: 250
Joined: Sun May 25, 2008 2:04 am
Location: United States
Contact:

Re: Hard Drive Driver

Post by Omega »

What are you talking about? I just told you it is SATA. lol
Free energy is indeed evil for it absorbs the light.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: Hard Drive Driver

Post by JamesM »

Hi. I just finished my LBA/PIO driven Hard Drive Driver part II (was DMA) and lo and behold the dang thing still errors on real hardware. It works brilliantly in VPC, even returns the bootsig (0x55 0xAA), but on real hardware it blows with error 51. So, I have been thinking and I think that the reason is due to my setup; I set my hdd up in the SATA fashion, not IDE. So my question is, do I need to do something special with my driver considering what I have just told you? thanks
I see SATA mentioned once and once only.
I set my hdd up in the SATA fashion, not IDE.
That means your set your hard disk up in the SATA fashion - i.e. you sent commands to it assuming it's SATA, not IDE.

Assuming that you meant what you didn't say, and that your HDD is indeed SATA, then you of course cannot communicate with it via the IDE controller. Your SATA controller will not only have a different command set but is not resident on the ISA bus, so you'll have to probe the PCI bus to obtain access to it.
User avatar
Omega
Member
Member
Posts: 250
Joined: Sun May 25, 2008 2:04 am
Location: United States
Contact:

Re: Hard Drive Driver

Post by Omega »

Got it. Much obliged sir. :)

EDIT: Oh, I see your confusion, you thought I meant HDD as in HARD DRIVE DRIVER when I meant HARD DISK DRIVE. My fault.
Free energy is indeed evil for it absorbs the light.
User avatar
Omega
Member
Member
Posts: 250
Joined: Sun May 25, 2008 2:04 am
Location: United States
Contact:

Re: Hard Drive Driver

Post by Omega »

One last question about this: Is there a standard way to ask the machine if the hard disk is SATA or IDE? I guess I could try to read the MBR and if it returns zero then it wouldn't be IDE I suppose, but I assume there is possibly a more standard way than that. Thanks.
Free energy is indeed evil for it absorbs the light.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: Hard Drive Driver

Post by JamesM »

Omega wrote:One last question about this: Is there a standard way to ask the machine if the hard disk is SATA or IDE? I guess I could try to read the MBR and if it returns zero then it wouldn't be IDE I suppose, but I assume there is possibly a more standard way than that. Thanks.
Yes - you won't be able to get a SATA drive to IDENTIFY. If you're using standard PIO you have access to four possible (IDE) disks - primary master, primary slave, secondary master, secondary slave. Those four are accessed by two ranges of ports corresponding to the two IDE controllers - primary and secondary.

You should be sending the ATA IDENTIFY command to each of these disks and seeing if they respond. Only IDE disks will be able to be enumerated like this. Your SATA disk is on a different bus under a different controller and won't respond.
User avatar
Omega
Member
Member
Posts: 250
Joined: Sun May 25, 2008 2:04 am
Location: United States
Contact:

Re: Hard Drive Driver

Post by Omega »

OK, I'll start doing some research, thank you.
Free energy is indeed evil for it absorbs the light.
User avatar
Omega
Member
Member
Posts: 250
Joined: Sun May 25, 2008 2:04 am
Location: United States
Contact:

Re: Hard Drive Driver

Post by Omega »

Hi JamesM. I have searched around and found the pci example geezer has on his site (which is back up temporarily right now) and I started playing with it and I successfully incorporated it into my kernel. I started testing it in my kernel and it works, but I am not sure what to do next. You said that I needed to probe the PCI controller to gain access to the SATA controller and in his example he does enumerate the available controllers. How from this can one gain access to the SATA controller? Thanks.
Free energy is indeed evil for it absorbs the light.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: Hard Drive Driver

Post by JamesM »

You should read PCI. Once you have found the PCI config space entry for the SATA controller you will need to set up its BARs (if the BIOS hasn't done it for you), then read the SATA specification as to what to do next!
User avatar
Omega
Member
Member
Posts: 250
Joined: Sun May 25, 2008 2:04 am
Location: United States
Contact:

Re: Hard Drive Driver

Post by Omega »

JamesM: This may be considered pirating or whatever but do you happen to have a copy of the SATA specs as they aren't free and I couldn't find them posted anywhere. Thanks
Free energy is indeed evil for it absorbs the light.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: Hard Drive Driver

Post by JamesM »

I'm afraid I don't. I haven't implemented SATA as yet (my main test PC has both an IDE and a SATA drive, so I just use the IDE one).

I personally would never call distributing pay-per-view specifications piracy. (Obviously software is different).
User avatar
Omega
Member
Member
Posts: 250
Joined: Sun May 25, 2008 2:04 am
Location: United States
Contact:

Re: Hard Drive Driver

Post by Omega »

Just a suggestion. Maybe we could all (those interested) could pitch in to buy it and post it in the WIKI. I'd toss in a few bucks to help out. Otherwise, I'll keep looking, I bet it is lurking on the internet somewhere. If I find it I'll post a link. Thanks.
Free energy is indeed evil for it absorbs the light.
User avatar
Omega
Member
Member
Posts: 250
Joined: Sun May 25, 2008 2:04 am
Location: United States
Contact:

Re: Hard Drive Driver

Post by Omega »

Found it: http://stuff.mit.edu/afs/sipb/user/fustflum/etcetera/

Look for:

serialata10a.ZIP

and

serialata10a.pdf

It is the old one spec 1.0. I haven't even looked at it yet but it was published in 2001 and II was published in 2002, so I hope it still has relevance.
Free energy is indeed evil for it absorbs the light.
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Re: Hard Drive Driver

Post by bewing »

:lol:

If you had read SATA, then you would know that even now there is not a relevant standard for SATA. There are three conflicting standards -- and you would have learned that info in less than one minute.

(And you can't post copyrighted material to the wiki.)
Post Reply