IOReturn AppleI386CPUInterruptController::handleInterrupt(void *refCon, IOService *nub, int source) {
    // Override the implementation in IOCPUInterruptController to
    // dispatch interrupts the old way. The source argument is ignored;
    // the first IOCPUInterruptController in the vector array is always used.

    IOInterruptVector *vector = &vectors[0];
    if (!vector->interruptRegistered) return kIOReturnInvalid;

    vector->handler(vector->target, refCon, vector->nub, source);
    return kIOReturnSuccess;
}
IOReturn IOSharedInterruptController::handleInterrupt(void * /*refCon*/,
						      IOService * nub,
						      int /*source*/)
{
  IOInterruptVectorNumber vectorNumber;
  IOInterruptVector *vector;
  
  for (vectorNumber = 0; vectorNumber < numVectors; vectorNumber++) {
    vector = &vectors[vectorNumber];
    
    vector->interruptActive = 1;
#if !defined(__i386__) && !defined(__x86_64__)
    OSMemoryBarrier();
#endif

    if (!vector->interruptDisabledSoft) {

      // Call the handler if it exists.
      if (vector->interruptRegistered) {

        bool trace = (gIOKitTrace & kIOTraceInterrupts) ? true : false;

        if (trace)
          timeStampInterruptHandlerStart(vectorNumber, vector);

        // Call handler.
        vector->handler(vector->target, vector->refCon, vector->nub, vector->source);

        if (trace)
          timeStampInterruptHandlerEnd(vectorNumber, vector);
      }
    }
    
    vector->interruptActive = 0;
  }
  
  // if any of the vectors are dissabled, then dissable this controller.
  IOSimpleLockLock(controllerLock);
  if (vectorsEnabled != vectorsRegistered) {
    nub->disableInterrupt(0);
    controllerDisabled = 1;
  }
  IOSimpleLockUnlock(controllerLock);
  
  return kIOReturnSuccess;
}
Example #3
0
IOReturn IOSharedInterruptController::handleInterrupt(void * /*refCon*/,
						      IOService * nub,
						      int /*source*/)
{
  IOInterruptVectorNumber vectorNumber;
  IOInterruptVector *vector;
  
  for (vectorNumber = 0; vectorNumber < numVectors; vectorNumber++) {
    vector = &vectors[vectorNumber];
    
    vector->interruptActive = 1;
	if (!vector->interruptDisabledSoft) {
	  
	  // Call the handler if it exists.
	  if (vector->interruptRegistered) {
		  
		  bool	trace = (gIOKitTrace & kIOTraceInterrupts) ? true : false;
		  
		  if (trace)
			  IOTimeStampStartConstant(IODBG_INTC(IOINTC_HANDLER),
									   (uintptr_t) vectorNumber, (uintptr_t) vector->handler, (uintptr_t)vector->target);
		  
		  // Call handler.
		  vector->handler(vector->target, vector->refCon, vector->nub, vector->source);
		  
		  if (trace)
			  IOTimeStampEndConstant(IODBG_INTC(IOINTC_HANDLER),
									 (uintptr_t) vectorNumber, (uintptr_t) vector->handler, (uintptr_t)vector->target);
		  
		}
	}
    
    vector->interruptActive = 0;
  }
  
  // if any of the vectors are dissabled, then dissable this controller.
  IOSimpleLockLock(controllerLock);
  if (vectorsEnabled != vectorsRegistered) {
    nub->disableInterrupt(0);
    controllerDisabled = 1;
  }
  IOSimpleLockUnlock(controllerLock);
  
  return kIOReturnSuccess;
}
// Handle all current interrupts.
IOReturn GenericInterruptController::handleInterrupt(void * refCon,
						     IOService * nub,
						     int source)
{
  IOInterruptVector *vector;
  int               vectorNumber;
  
  while (1) {
    // Get vectorNumber from hardware some how and clear the event.
    
    // Break if there are no more vectors to handle.
    if (vectorNumber == 0/*kNoVector*/) break;
    
    // Get the vector's date from the controller's array.
    vector = &vectors[vectorNumber];
    
    // Set the vector as active. This store must compleat before
    // moving on to prevent the disableInterrupt fuction from
    // geting out of sync.
    vector->interruptActive = 1;
    //sync();
    //isync();
    
    // If the vector is not disabled soft, handle it.
    if (!vector->interruptDisabledSoft) {
      // Prevent speculative exacution as needed on your processor.
      //isync();
      
      // Call the handler if it exists.
      if (vector->interruptRegistered) {
	vector->handler(vector->target, vector->refCon,
			vector->nub, vector->source);
      }
    } else {
      // Hard disable the vector if is was only soft disabled.
      vector->interruptDisabledHard = 1;
      disableVectorHard(vectorNumber, vector);
    }
    
    // Done with this vector so, set it back to inactive.
    vector->interruptActive = 0;
  }
  
  return kIOReturnSuccess;
}
IOReturn IOSharedInterruptController::handleInterrupt(void * /*refCon*/,
						      IOService * nub,
						      int /*source*/)
{
  long              vectorNumber;
  IOInterruptVector *vector;
  
  for (vectorNumber = 0; vectorNumber < numVectors; vectorNumber++) {
    vector = &vectors[vectorNumber];
    
    vector->interruptActive = 1;
#if __ppc__
    sync();
    isync();
#endif
    if (!vector->interruptDisabledSoft) {
#if __ppc__
      isync();
#endif
      
      // Call the handler if it exists.
      if (vector->interruptRegistered) {
	vector->handler(vector->target, vector->refCon,
			vector->nub, vector->source);
      }
    }
    
    vector->interruptActive = 0;
  }
  
  // if any of the vectors are dissabled, then dissable this controller.
  IOSimpleLockLock(controllerLock);
  if (vectorsEnabled != vectorsRegistered) {
    nub->disableInterrupt(0);
    controllerDisabled = 1;
  }
  IOSimpleLockUnlock(controllerLock);
  
  return kIOReturnSuccess;
}
Example #6
0
IOReturn AppleI386CPUInterruptController::handleInterrupt(void * state,
                                                          IOService * /*nub*/,
                                                          int source)
{
    IOInterruptVector * vector;

    // Override the implementation in IOCPUInterruptController to
    // dispatch interrupts the old way.
    //
    // source argument is ignored, use the first IOCPUInterruptController
    // in the vector array.
    //
     vector = &vectors[0];

    if (!vector->interruptRegistered)
        return kIOReturnInvalid;
  
    vector->handler(vector->target,
                    state,
                    vector->nub,
                    source);

    return kIOReturnSuccess;
}