* When encountering an unrecoverable error at least turn off interrupts until

we properly handle this case (cancel everything and reset the controller) to
  avoid flooding the system with interrupts.
* Also only check for enabled interrupts to not steal potentially shared
  interrupts.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25823 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2008-06-06 11:45:10 +00:00
parent 856c49e614
commit b1385bc32d
3 changed files with 11 additions and 5 deletions
+10 -4
View File
@@ -287,6 +287,7 @@ UHCI::UHCI(pci_info *info, Stack *stack)
: BusManager(stack),
fPCIInfo(info),
fStack(stack),
fEnabledInterrupts(0),
fFrameArea(-1),
fFrameList(NULL),
fFrameBandwidth(NULL),
@@ -453,8 +454,10 @@ UHCI::UHCI(pci_info *info, Stack *stack)
InterruptHandler, (void *)this, 0);
// Enable interrupts
WriteReg16(UHCI_USBINTR, UHCI_USBINTR_CRC | UHCI_USBINTR_RESUME
| UHCI_USBINTR_IOC | UHCI_USBINTR_SHORT);
fEnabledInterrupts = UHCI_USBSTS_USBINT | UHCI_USBSTS_ERRINT
| UHCI_USBSTS_HOSTERR | UHCI_USBSTS_HCPRERR | UHCI_USBSTS_HCHALT;
WriteReg16(UHCI_USBINTR, UHCI_USBINTR_CRC | UHCI_USBINTR_IOC
| UHCI_USBINTR_SHORT);
TRACE(("usb_uhci: UHCI Host Controller Driver constructed\n"));
fInitOK = true;
@@ -1536,7 +1539,7 @@ UHCI::Interrupt()
// Check if we really had an interrupt
uint16 status = ReadReg16(UHCI_USBSTS);
if ((status & UHCI_INTERRUPT_MASK) == 0) {
if ((status & fEnabledInterrupts) == 0) {
release_spinlock(&lock);
return B_UNHANDLED_INTERRUPT;
}
@@ -1575,7 +1578,10 @@ UHCI::Interrupt()
}
if (status & UHCI_USBSTS_HCHALT) {
TRACE(("usb_uhci: host controller halted\n"));
TRACE_ERROR(("usb_uhci: host controller halted\n"));
// at least disable interrupts so we do not flood the system
WriteReg16(UHCI_USBINTR, 0);
fEnabledInterrupts = 0;
// ToDo: cancel all transfers and reset the host controller
// acknowledge not needed
}
+1
View File
@@ -194,6 +194,7 @@ static pci_module_info *sPCIModule;
uint32 fRegisterBase;
pci_info *fPCIInfo;
Stack *fStack;
uint32 fEnabledInterrupts;
// Frame list memory
area_id fFrameArea;
@@ -50,7 +50,6 @@
#define UHCI_USBSTS_HOSTERR 0x08 // Host System Error
#define UHCI_USBSTS_HCPRERR 0x10 // Host Controller Process error
#define UHCI_USBSTS_HCHALT 0x20 // HCHalted
#define UHCI_INTERRUPT_MASK 0x3f // Mask for all the interrupts
//USBINTR
#define UHCI_USBINTR_CRC 0x01 // Timeout/ CRC interrupt enable