interrupt debugging instrumentation for bug hunting.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33010 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Marcus Overhagen 2009-09-08 21:27:04 +00:00
parent b21ffe25a0
commit ed20dd306d

View File

@ -23,6 +23,15 @@
#define TRACE dprintf
#define INTERRUPT_TRACING 0
#if INTERRUPT_TRACING
#include <tracing.h>
#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;
}
}