+ // Check if the interrupt source can/should be shared.
+ canBeShared = vectorCanBeShared(vectorNumber, vector);
+ IODTGetInterruptOptions(nub, source, &options);
+#if defined(__i386__) || defined(__x86_64__)
+ int interruptType;
+ if (OSDynamicCast(IOPlatformDevice, getProvider()) &&
+ (getInterruptType(nub, source, &interruptType) == kIOReturnSuccess) &&
+ (kIOInterruptTypeLevel & interruptType))
+ {
+ options |= kIODTInterruptShared;
+ }
+#endif
+ shouldBeShared = canBeShared && (options & kIODTInterruptShared);
+ wasAlreadyRegisterd = vector->interruptRegistered;
+
+ // If the vector is registered and can not be shared return error.
+ if (wasAlreadyRegisterd && !canBeShared) {
+ IOUnlock(vector->interruptLock);
+ return kIOReturnNoResources;
+ }
+
+ // If this vector is already in use, and can be shared (implied),
+ // or it is not registered and should be shared,