RESOLVED:
Well, this site has been a great resource. Being a newbie to device programming the task of completing a hard disk driver in just a few short weeks was quite a daunting task. I apparently had a few problems, the main of which was that I did indeed keep reading the status register instead of the alternate status register. I now am getting interrupts and my disk driver is finally starting to take shape.
---
Hello all!
Well, in school we are developing a small operating system, and I am working on a hard disk driver. This is my first time working with a device this complex (last quarter we programmed a serial IO device). Anyway, so far I have found my IDE controller in the PCI bus and my next step is to get interrupts going for the hard disk so that I can test my service routines.
Now, I am hoping someone can quickly go through the usual steps needed for an operating system to initialize an ATA hard disk for use. For example, I believe this initialization will involve either a software or hardware reset. I will go into more detail about my project if required, but I was hoping that someone with experience in this area could point me in the right direction.
Also, I should mention that I was able to get interrupts for the secondary IDE device, which is a CDROM by setting the SRST bit in the device control register. However, my goal is to work with the hard disk on the primary IDE channel.
Thanks for looking!
Enabling interrupts for an ATA hard disk?
Enabling interrupts for an ATA hard disk?
Last edited by tomos on Fri May 15, 2009 8:16 pm, edited 1 time in total.
Developing tomos, Tom's x86 Operating System.
Re: Enabling interrupts for an ATA hard disk?
I did look at most of those pages and am still confused how I initially get the interrupts to start firing. At this point I already have a handler installed for the correct vector, I am just not seeing any interrupts.
If what I am looking for is explained in those pages, can you please tell me where. I see sections for handling interrupts, but not configuring the device so that it actually starts interrupting.
If what I am looking for is explained in those pages, can you please tell me where. I see sections for handling interrupts, but not configuring the device so that it actually starts interrupting.
Developing tomos, Tom's x86 Operating System.
Re: Enabling interrupts for an ATA hard disk?
That's your problem, you didn't read the pages, you just looked. At some of them.TURBOxSPOOL wrote:I did look at most of those pages...
The very first link you were pointed to has a nice big section on handling interrupts. It even says what you need to do to make sure you are getting interrupts.
So assuming you have remapped your PIC, installed the handler to the proper place, unmasked that IRQ, and enabled interrupts, the ATA drives should be sending you interrupts already.
Reasons you may not be getting an interrupt:
- You're reading from the status register and not the alternate status register.
- You have the control register's nien bit set for the drive.
- The command errored out. Commands that terminate with an error do not send an IRQ.
- You have not sent EOI to the PICs.
Re: Enabling interrupts for an ATA hard disk?
I'm sorry, I should have been more specific when I replied. When you did post that link, I did actually take note that I was was reading from the actual Status register and not the Alternate Status. However, I thought that I had attempted booted without reading the register at all.
Anyway, the problem is that I need to be more detailed. Another problem is that I need to be physically present in our lab to test my code. So I will reply back or update my post with a checklist that corresponds to the linked wiki pages. I am going to verify that I am not missing any steps, however, most of it looks familiar.
Again, I apologize for the confusion, I didn't want to start off with such a bad post.
Anyway, the problem is that I need to be more detailed. Another problem is that I need to be physically present in our lab to test my code. So I will reply back or update my post with a checklist that corresponds to the linked wiki pages. I am going to verify that I am not missing any steps, however, most of it looks familiar.
Again, I apologize for the confusion, I didn't want to start off with such a bad post.
Developing tomos, Tom's x86 Operating System.
Re: Enabling interrupts for an ATA hard disk?
Finally got it working, I was reading the status register and not alternate status which was blocking interrupts. Now the driver is finally starting to take shape.
My professor at least made me feel better by saying that our struggles were not out of the ordinary for this sort of thing. Three kids in my class have sound drivers which make no sound; at least I am now much more confident that I will get a simple interrupt driven PIO driver working in time.
My professor at least made me feel better by saying that our struggles were not out of the ordinary for this sort of thing. Three kids in my class have sound drivers which make no sound; at least I am now much more confident that I will get a simple interrupt driven PIO driver working in time.
Developing tomos, Tom's x86 Operating System.