Correct the API for Windows interupt handling a little. The prototype

for a Windows ISR is 'BOOLEAN isrfunc(KINTERRUPT *, void *)' meaning
the ISR get a pointer to the interrupt object and a context pointer,
and returns TRUE if the ISR determines the interrupt was really generated
by the associated device, or FALSE if not.

I had mistakenly used 'void isrfunc(void *)' instead. It happens the
only thing this affects is the internal ndis_intr() ISR in subr_ndis.c,
but it should be fixed just in case we ever need to register a real
Windows ISR vi IoConnectInterrupt().

For NDIS miniports that provide a MiniportISR() method, the 'is_our_intr'
value returned by the method serves as the return value from ndis_isr(),
and 'call_isr' is used to decide whether or not to schedule the interrupt
handler via DPC. For drivers that only supply MiniportEnableInterrupt()
and MiniportDisableInterrupt() methods, call_isr is always TRUE and
is_our_intr is always FALSE.

In the end, there should be no functional changes, except that now
ntoskrnl_intr() can terminate early once it finds the ISR that wants
to service the interrupt.
This commit is contained in:
Bill Paul 2005-11-20 01:29:29 +00:00
parent 3d19fd3190
commit 78edd540cf
2 changed files with 13 additions and 11 deletions

View File

@ -275,7 +275,7 @@ static uint8_t NdisSystemProcessorCount(void);
static void NdisMIndicateStatusComplete(ndis_handle);
static void NdisMIndicateStatus(ndis_handle, ndis_status,
void *, uint32_t);
static void ndis_intr(void *);
static uint8_t ndis_intr(kinterrupt *, void *);
static void ndis_intrhand(kdpc *, ndis_miniport_interrupt *, void *, void *);
static funcptr ndis_findwrap(funcptr);
static void NdisCopyFromPacketToPacket(ndis_packet *,
@ -2326,22 +2326,21 @@ NdisMPciAssignResources(adapter, slot, list)
return (NDIS_STATUS_SUCCESS);
}
static void
ndis_intr(arg)
static uint8_t
ndis_intr(iobj, arg)
kinterrupt *iobj;
void *arg;
{
struct ndis_softc *sc;
struct ifnet *ifp;
int is_our_intr = 0;
uint8_t is_our_intr = FALSE;
int call_isr = 0;
ndis_miniport_interrupt *intr;
sc = arg;
ifp = sc->ifp;
intr = sc->ndis_block->nmb_interrupt;
if (intr == NULL || sc->ndis_block->nmb_miniportadapterctx == NULL)
return;
return(FALSE);
if (sc->ndis_block->nmb_interrupt->ni_isrreq == TRUE)
MSCALL3(intr->ni_isrfunc, &is_our_intr, &call_isr,
@ -2352,10 +2351,10 @@ ndis_intr(arg)
call_isr = 1;
}
if ((is_our_intr || call_isr))
if (call_isr)
IoRequestDpc(sc->ndis_block->nmb_deviceobj, NULL, sc);
return;
return(is_our_intr);
}
static void
@ -3517,7 +3516,7 @@ image_patch_table ndis_functbl[] = {
IMPORT_SFUNC(NdisMRegisterUnloadHandler, 2),
IMPORT_SFUNC(ndis_timercall, 4),
IMPORT_SFUNC(ndis_asyncmem_complete, 2),
IMPORT_SFUNC(ndis_intr, 1),
IMPORT_SFUNC(ndis_intr, 2),
IMPORT_SFUNC(ndis_intrhand, 4),
/*

View File

@ -1204,13 +1204,16 @@ ntoskrnl_intr(arg)
{
kinterrupt *iobj;
uint8_t irql;
uint8_t claimed;
list_entry *l;
KeAcquireSpinLock(&ntoskrnl_intlock, &irql);
l = ntoskrnl_intlist.nle_flink;
while (l != &ntoskrnl_intlist) {
iobj = CONTAINING_RECORD(l, kinterrupt, ki_list);
MSCALL1(iobj->ki_svcfunc, iobj->ki_svcctx);
claimed = MSCALL2(iobj->ki_svcfunc, iobj, iobj->ki_svcctx);
if (claimed == TRUE)
break;
l = l->nle_flink;
}
KeReleaseSpinLock(&ntoskrnl_intlock, irql);