-
- interruptSources = nub->_interruptSources;
- vectorData = interruptSources[source].vectorData;
- vectorNumber = *(long *)vectorData->getBytesNoCopy();
- vector = &vectors[vectorNumber];
-
- // Get the lock for this vector.
- IOTakeLock(vector->interruptLock);
-
- // Return success if it is not already registered
- if (!vector->interruptRegistered) {
- IOUnlock(vector->interruptLock);
- return kIOReturnSuccess;
+
+ for (vectorNumber = 0; vectorNumber < kIOSharedInterruptControllerDefaultVectors; vectorNumber++) {
+ vector = &vectors[vectorNumber];
+
+ // Get the lock for this vector.
+ IOLockLock(vector->interruptLock);
+
+ // Return success if it is not already registered
+ if (!vector->interruptRegistered
+ || (vector->nub != nub) || (vector->source != source)) {
+ IOLockUnlock(vector->interruptLock);
+ continue;
+ }
+
+ // Soft disable the source and the controller too.
+ disableInterrupt(nub, source);
+
+ // Clear all the storage for the vector except for interruptLock.
+ vector->interruptActive = 0;
+ vector->interruptDisabledSoft = 0;
+ vector->interruptDisabledHard = 0;
+ vector->interruptRegistered = 0;
+ vector->nub = 0;
+ vector->source = 0;
+ vector->handler = 0;
+ vector->target = 0;
+ vector->refCon = 0;
+
+ interruptState = IOSimpleLockLockDisableInterrupt(controllerLock);
+ vectorsRegistered--;
+ IOSimpleLockUnlockEnableInterrupt(controllerLock, interruptState);
+
+ // Move along to the next one.
+ IOLockUnlock(vector->interruptLock);