I am currently working on a hobby operating system, in particular the ATA driver. I'm having some problems with interrupt PIO I / O commands. I am trying to execute the READ MULTIPLE command to read multiple sectors from disk, block by block, with interrupt for each block.
If I request reading 4 blocks (1 sector per block). I expect to get 4 interrupts, one for each data block. After receiving the fourth interrupt, I can determine that I transferred all the data and accordingly updated the structure of the request. However, in VirtualBox, I found that after transferring the last data block, I received another interrupt (STATUS = 0x50, READY, OVERLAPPED MODE SERVER REQ). I can just read the STATUS register to clear it, but I don't think that I ever get the 5th interrupt according to the specifications.
So, what is the correct way to acknowledge an interrupt issued by an ATA?
In this example, I issue the READ MULTIPLE command, and then my ISR does the following:
- disables processor interrupts, sets nIEN
- Read one block of data (not a sector!) In the DATA register,
- If all data has been read, read the STATUS register to clear the "extra" interrupt
- Exit by clearing the nIEN and sending the EOI to both the master and slave PIC
The ATA specifications for the PIO data entry protocol do not indicate that you need to read the status register. From this, I suggested that when I get an interrupt, all I have to do is follow the protocol and end by sending the EOI to the PIC. As for installing / cleaning nIEN, when working with VirtualBox, I found that if I do not, I do not receive any interruptions after the first. Therefore, I install nIEN when I enter the ISR, and then clean it before I leave. I would think that this would not have any effect, but it should be related to reading / writing this particular register.
source share