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
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


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:
Currently I am developing the ATA hard disk driver (hasn't been uploaded yet) with PIO according to this page:
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 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)
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:
and hd.asm uses ata.asm:

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


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


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

Adrian Gates
Sr. Developer - Apps4Rent

Post Reply