Loading...
iokit/Kernel/IOInterruptController.cpp xnu-344.32 xnu-124.7
--- xnu/xnu-344.32/iokit/Kernel/IOInterruptController.cpp
+++ xnu/xnu-124.7/iokit/Kernel/IOInterruptController.cpp
@@ -244,17 +244,7 @@
   
   if (vector->interruptDisabledSoft) {
     vector->interruptDisabledSoft = 0;
-#if __ppc__
-    sync();
-    isync();
-#endif
-    
-    if (!getPlatform()->atInterruptLevel()) {
-      while (vector->interruptActive);
-#if __ppc__
-      isync();
-#endif
-    }
+    
     if (vector->interruptDisabledHard) {
       vector->interruptDisabledHard = 0;
       
@@ -556,26 +546,24 @@
   long              vectorNumber;
   IOInterruptVector *vector;
   OSData            *vectorData;
-  IOInterruptState  interruptState;
-  
-  interruptSources = nub->_interruptSources;
-  vectorData = interruptSources[source].vectorData;
-  vectorNumber = *(long *)vectorData->getBytesNoCopy();
-  vector = &vectors[vectorNumber];
-  
-  interruptState = IOSimpleLockLockDisableInterrupt(controllerLock);
-  if (!vector->interruptDisabledSoft) {
+  IOInterruptState  interruptState;;
+  
+  interruptSources = nub->_interruptSources;
+  vectorData = interruptSources[source].vectorData;
+  vectorNumber = *(long *)vectorData->getBytesNoCopy();
+  vector = &vectors[vectorNumber];
+  
+  if (vector->interruptDisabledSoft) {
+    vector->interruptDisabledSoft = 0;
+    
+    interruptState = IOSimpleLockLockDisableInterrupt(controllerLock);
+    vectorsEnabled++;
     IOSimpleLockUnlockEnableInterrupt(controllerLock, interruptState);
-    return kIOReturnSuccess;
-  }
-  
-  vector->interruptDisabledSoft = 0;
-  vectorsEnabled++;
-  IOSimpleLockUnlockEnableInterrupt(controllerLock, interruptState);
-  
-  if (controllerDisabled && (vectorsEnabled == vectorsRegistered)) {
-    controllerDisabled = 0;
-    provider->enableInterrupt(0);
+    
+    if (controllerDisabled && (vectorsEnabled == vectorsRegistered)) {
+      controllerDisabled = 0;
+      provider->enableInterrupt(0);
+    }
   }
   
   return kIOReturnSuccess;
@@ -588,23 +576,24 @@
   long              vectorNumber;
   IOInterruptVector *vector;
   OSData            *vectorData;
-  IOInterruptState  interruptState;
-  
-  interruptSources = nub->_interruptSources;
-  vectorData = interruptSources[source].vectorData;
-  vectorNumber = *(long *)vectorData->getBytesNoCopy();
-  vector = &vectors[vectorNumber];
-  
-  interruptState = IOSimpleLockLockDisableInterrupt(controllerLock); 
+  IOInterruptState  interruptState;;
+  
+  interruptSources = nub->_interruptSources;
+  vectorData = interruptSources[source].vectorData;
+  vectorNumber = *(long *)vectorData->getBytesNoCopy();
+  vector = &vectors[vectorNumber];
+  
   if (!vector->interruptDisabledSoft) {
     vector->interruptDisabledSoft = 1;
 #if __ppc__
     sync();
     isync();
 #endif
+    
+    interruptState = IOSimpleLockLockDisableInterrupt(controllerLock); 
     vectorsEnabled--;
-  }
-  IOSimpleLockUnlockEnableInterrupt(controllerLock, interruptState);
+    IOSimpleLockUnlockEnableInterrupt(controllerLock, interruptState);
+  }
   
   if (!getPlatform()->atInterruptLevel()) {
     while (vector->interruptActive);