Loading...
--- xnu/xnu-2422.100.13/iokit/Kernel/IOInterruptEventSource.cpp
+++ xnu/xnu-1504.15.3/iokit/Kernel/IOInterruptEventSource.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2010 Apple Inc. All rights reserved.
+ * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
@@ -25,7 +25,13 @@
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
-
+/*
+Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
+
+HISTORY
+ 1998-7-13 Godfrey van der Linden(gvdl)
+ Created.
+*/
#include <IOKit/IOInterruptEventSource.h>
#include <IOKit/IOKitDebug.h>
#include <IOKit/IOLib.h>
@@ -33,31 +39,6 @@
#include <IOKit/IOInterrupts.h>
#include <IOKit/IOTimeStamp.h>
#include <IOKit/IOWorkLoop.h>
-
-#if IOKITSTATS
-
-#define IOStatisticsInitializeCounter() \
-do { \
- IOStatistics::setCounterType(IOEventSource::reserved->counter, kIOStatisticsInterruptEventSourceCounter); \
-} while (0)
-
-#define IOStatisticsCheckForWork() \
-do { \
- IOStatistics::countInterruptCheckForWork(IOEventSource::reserved->counter); \
-} while (0)
-
-#define IOStatisticsInterrupt() \
-do { \
- IOStatistics::countInterrupt(IOEventSource::reserved->counter); \
-} while (0)
-
-#else
-
-#define IOStatisticsInitializeCounter()
-#define IOStatisticsCheckForWork()
-#define IOStatisticsInterrupt()
-
-#endif // IOKITSTATS
#define super IOEventSource
@@ -93,8 +74,6 @@
intIndex = inIntIndex;
}
- IOStatisticsInitializeCounter();
-
return res;
}
@@ -167,20 +146,19 @@
void IOInterruptEventSource::setWorkLoop(IOWorkLoop *inWorkLoop)
{
- if (inWorkLoop) super::setWorkLoop(inWorkLoop);
-
- if (provider) {
- if (!inWorkLoop) {
- if (intIndex >= 0) {
- provider->unregisterInterrupt(intIndex);
- intIndex = ~intIndex;
- }
- } else if ((intIndex < 0) && (kIOReturnSuccess == registerInterruptHandler(provider, ~intIndex))) {
+ super::setWorkLoop(inWorkLoop);
+
+ if (!provider)
+ return;
+
+ if ( !inWorkLoop ) {
+ if (intIndex >= 0) {
+ provider->unregisterInterrupt(intIndex);
intIndex = ~intIndex;
}
- }
-
- if (!inWorkLoop) super::setWorkLoop(inWorkLoop);
+ } else if ((intIndex < 0) && (kIOReturnSuccess == registerInterruptHandler(provider, ~intIndex))) {
+ intIndex = ~intIndex;
+ }
}
const IOService *IOInterruptEventSource::getProvider() const
@@ -204,45 +182,43 @@
int numInts = cacheProdCount - consumerCount;
IOInterruptEventAction intAction = (IOInterruptEventAction) action;
bool trace = (gIOKitTrace & kIOTraceIntEventSource) ? true : false;
-
- IOStatisticsCheckForWork();
-
+
if ( numInts > 0 )
{
if (trace)
IOTimeStampStartConstant(IODBG_INTES(IOINTES_ACTION),
- VM_KERNEL_UNSLIDE(intAction), (uintptr_t) owner, (uintptr_t) this, (uintptr_t) workLoop);
+ (uintptr_t) intAction, (uintptr_t) owner, (uintptr_t) this, (uintptr_t) workLoop);
+
+ // Call the handler
+ (*intAction)(owner, this, numInts);
- // Call the handler
- (*intAction)(owner, this, numInts);
-
if (trace)
IOTimeStampEndConstant(IODBG_INTES(IOINTES_ACTION),
- VM_KERNEL_UNSLIDE(intAction), (uintptr_t) owner, (uintptr_t) this, (uintptr_t) workLoop);
-
- consumerCount = cacheProdCount;
- if (autoDisable && !explicitDisable)
- enable();
- }
+ (uintptr_t) intAction, (uintptr_t) owner, (uintptr_t) this, (uintptr_t) workLoop);
+
+ consumerCount = cacheProdCount;
+ if (autoDisable && !explicitDisable)
+ enable();
+ }
else if ( numInts < 0 )
{
if (trace)
IOTimeStampStartConstant(IODBG_INTES(IOINTES_ACTION),
- VM_KERNEL_UNSLIDE(intAction), (uintptr_t) owner, (uintptr_t) this, (uintptr_t) workLoop);
+ (uintptr_t) intAction, (uintptr_t) owner, (uintptr_t) this, (uintptr_t) workLoop);
// Call the handler
- (*intAction)(owner, this, -numInts);
+ (*intAction)(owner, this, -numInts);
if (trace)
IOTimeStampEndConstant(IODBG_INTES(IOINTES_ACTION),
- VM_KERNEL_UNSLIDE(intAction), (uintptr_t) owner, (uintptr_t) this, (uintptr_t) workLoop);
-
- consumerCount = cacheProdCount;
- if (autoDisable && !explicitDisable)
- enable();
- }
-
+ (uintptr_t) intAction, (uintptr_t) owner, (uintptr_t) this, (uintptr_t) workLoop);
+
+ consumerCount = cacheProdCount;
+ if (autoDisable && !explicitDisable)
+ enable();
+ }
+
return false;
}
@@ -250,15 +226,14 @@
(void */*refcon*/, IOService */*prov*/, int /*source*/)
{
bool trace = (gIOKitTrace & kIOTraceIntEventSource) ? true : false;
-
- IOStatisticsInterrupt();
+
producerCount++;
-
+
if (trace)
IOTimeStampStartConstant(IODBG_INTES(IOINTES_SEMA), (uintptr_t) this, (uintptr_t) owner);
signalWorkAvailable();
-
+
if (trace)
IOTimeStampEndConstant(IODBG_INTES(IOINTES_SEMA), (uintptr_t) this, (uintptr_t) owner);
}
@@ -267,17 +242,16 @@
(void */*refcon*/, IOService *prov, int source)
{
bool trace = (gIOKitTrace & kIOTraceIntEventSource) ? true : false;
-
+
prov->disableInterrupt(source); /* disable the interrupt */
-
- IOStatisticsInterrupt();
+
producerCount++;
-
+
if (trace)
IOTimeStampStartConstant(IODBG_INTES(IOINTES_SEMA), (uintptr_t) this, (uintptr_t) owner);
signalWorkAvailable();
-
+
if (trace)
IOTimeStampEndConstant(IODBG_INTES(IOINTES_SEMA), (uintptr_t) this, (uintptr_t) owner);
}
@@ -290,10 +264,3 @@
else
normalInterruptOccurred(refcon, prov, source);
}
-
-IOReturn IOInterruptEventSource::warmCPU
- (uint64_t abstime)
-{
-
- return ml_interrupt_prewarm(abstime);
-}