0

I have been writing some ata stuff recently. On real hardware the ata controller uses IRQ_11. To get the driver to work I had to mask IRQ_11 because it would constantly fire after issuing the identify command. Down here is some simplified code which will cause the problem.

  mov si, 45056 ;Real hardware port

  mov dx, si
  add dx, 6
  mov al, 0xA0
  out dx, al ;Select drive (master in this test)
  
  
  push 10 ;Give controller a bit more time
  call wait_milliseconds
    
  ;These things should be set to 0
    
  mov dx, si
  add dx, 3
  mov al, 0
  out dx, al ;Set to 0
    
  mov dx, si
  add dx, 4
  mov al, 0
  out dx, al ;Set to 0
    
  mov dx, si
  add dx, 5
  mov al, 0
  out dx, al ;Set to 0
  
  ;Send identify command
  mov dx, si
  add dx, 7
  mov al, 0xEC
  out dx, al

I have made sure my handler sends a EOI. I am also sure that my Pic is remapped. I have also tried reading the status port after, as well as in the handler. I really have no idea why this thing will constantly fire and filling the screen with the message I put in my handler.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
  • The `0xEC` command is `IDENTIFY DEVICE` which, if the device is not an ATAPI device, will return 256 words of data. If you set up the ATA controller to fire interrupts, it will. If you count the interrupts instead of printing a message, will this count stop? Also make sure to follow the ATA/ATAPI spec regarding the correct handling of the control and status bit. The interrupt reason register may give some hint about the source of the interrupts. – Margaret Bloom Dec 22 '22 at 08:26
  • I know I can read the data, this is just a minimal example. And no the interrupts will never stop firing, I am literally getting thousands. – Lprogrammer20 Dec 23 '22 at 16:18

0 Answers0