diff --git a/src/add-ons/kernel/generic/ata_adapter/ata_adapter.c b/src/add-ons/kernel/generic/ata_adapter/ata_adapter.c index b780fdf3f0..3a72c0a997 100644 --- a/src/add-ons/kernel/generic/ata_adapter/ata_adapter.c +++ b/src/add-ons/kernel/generic/ata_adapter/ata_adapter.c @@ -23,6 +23,15 @@ #define TRACE dprintf +#define INTERRUPT_TRACING 0 +#if INTERRUPT_TRACING + #include + #define TRACE_INT(a...) ktrace_printf(a) +#else + #define TRACE_INT(a...) +#endif + + static ata_for_controller_interface *sATA; static device_manager_info *sDeviceManager; @@ -184,9 +193,12 @@ ata_adapter_inthand(void *arg) pci_device *device = channel->device; uint8 statusATA, statusBM; + TRACE_INT("ata_adapter_inthand\n"); + if (!channel->dmaing) { // this could be a spurious interrupt, so read status // register unconditionally to acknowledge those + TRACE_INT("ata_adapter_inthand: not DMA\n"); pci->read_io_8(device, channel->command_block_base + 7); return B_UNHANDLED_INTERRUPT; } @@ -195,11 +207,13 @@ ata_adapter_inthand(void *arg) // will clear the interrupt status bit once ATA status is read statusBM = pci->read_io_8(device, channel->bus_master_base + ATA_BM_STATUS_REG); + TRACE_INT("ata_adapter_inthand: BM-status 0x%02x\n", statusBM); // test if the interrupt was really generated by our controller if (statusBM & ATA_BM_STATUS_INTERRUPT) { // read ATA status register to acknowledge interrupt statusATA = pci->read_io_8(device, channel->command_block_base + 7); + TRACE_INT("ata_adapter_inthand: ATA-status 0x%02x\n", statusATA); // clear pending PCI bus master DMA interrupt, for those // controllers who don't clear it themselves @@ -209,6 +223,7 @@ ata_adapter_inthand(void *arg) // signal interrupt to ATA stack return sATA->interrupt_handler(channel->ataChannel, statusATA); } else { + TRACE_INT("ata_adapter_inthand: not BM\n"); return B_UNHANDLED_INTERRUPT; } }