How to disable IRQ on primary and secondary bus

If you are new to OS Development, plan on spending some time here first before going into the other forums.

Moderator:Moderators

Post Reply
bigbob
Posts:1
Joined:Fri Sep 20, 2013 9:10 am
How to disable IRQ on primary and secondary bus

Post by bigbob » Mon Sep 30, 2013 7:36 pm

Hi,

This is my first time on this forum, so I'd like to greet everybody now and say thanks for the OS development tutorials.
I am developing an OS based on the BrokenThorn tutorials:
https://sites.google.com/site/forthoperatingsystem/
Currently I am developing the ATA hard disk driver (hasn't been uploaded yet) with PIO according to this page:
http://wiki.osdev.org/ATA_PIO_Mode
My OS is a single task one, so I use polling instead of DMA (IRQ).
The problem is that I can read/write sectors from/to the winchester in emulators (Bochs and QEMU) but on real hardware there is always an IRQ.
According to the osdev.org article (link above) the nIEN bit needs to be set in 0x3F6 (primary bus crtl-register) and 0x376 (secondary bus ctrl-register).
Pseudo code:

Code: Select all

outb(0x3F6, 2)
outb(0x376, 2)
I did this before sending any commands like IDENTIFY to the winchester (which is a Primary Master, IDE, 40GB; there is also a secondary slave DVD in the computer)
but the IRQ kept comming.
I also tried to select the device(it's "Detecting Device Types" in the PIO artile above) and only then set the nIEN bit:

Code: Select all

out(0x1F6, 0xA0)
inb(0x3F6)
inb(0x3F6)
inb(0x3F6)
inb(0x3F6)
outb(0x3F6, 2)
The winchester is a primary master, so no need to set the slave bit.
Unfortunately the IRQ still came.

Maybe I should disable the nIEN-bit on all possible busses (ctrl-ports: 0x3F6, 0x170, 0x0x3E6, 0x366)?
How could I prevent the winchester from firing an IRQ?

The kernel calls hd_detect in hd.asm:
http://pastebin.com/5pCiqW7E
and hd.asm uses ata.asm:
http://pastebin.com/mCK2c8d4

Maybe also delays are missing from the code, but it works with Bochs because it is much slower than real hw.
I have wasted so many CDs so far so I decided to ask this question.

EDIT: I also asked it on osdev.org:
http://forum.osdev.org/viewtopic.php?f=1&t=27206

Regards,
Rob

AdrianG001
Posts:1
Joined:Fri Mar 30, 2018 1:21 pm

Re: How to disable IRQ on primary and secondary bus

Post by AdrianG001 » Fri Mar 30, 2018 1:32 pm

Hey,

Refer the below article if you need a detailed answer to your question

tomshardware.com/forum/id-1681119/installing-idt-high-definition-drivers.html

Adrian Gates
Sr. Developer - Apps4Rent

Post Reply