From 7452e76589c3544aeda69ca97dfcbd139dc08c09 Mon Sep 17 00:00:00 2001 From: wpaul Date: Tue, 6 Jan 2004 07:09:26 +0000 Subject: - Add pe_get_message() and pe_get_messagetable() for processing the RT_MESSAGETABLE resources that some driver binaries have. This allows us to print error messages in ndis_syslog(). - Correct the implementation of InterlockedIncrement() and InterlockedDecrement() -- they return uint32_t, not void. - Correct the declarations of the 64-bit arithmetic shift routines in subr_ntoskrnl.c (_allshr, allshl, etc...). These do not follow the _stdcall convention: instead, they appear to be __attribute__((regparm(3)). - Change the implementation of KeInitializeSpinLock(). There is no complementary KeFreeSpinLock() function, so creating a new mutex on each call to KeInitializeSpinLock() leaks resources when a driver is unloaded. For now, KeInitializeSpinLock() returns a handle to the ntoskrnl interlock mutex. - Use a driver's MiniportDisableInterrupt() and MiniportEnableInterrupt() routines if they exist. I'm not sure if I'm doing this right yet, but at the very least this shouldn't break any currently working drivers, and it makes the Intel PRO/1000 driver work. - In ndis_register_intr(), save some state that might be needed later, and save a pointer to the driver's interrupt structure in the ndis_miniport_block. - Save a pointer to the driver image for use by ndis_syslog() when it calls pe_get_message(). --- sys/dev/if_ndis/if_ndis.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/if_ndis/if_ndis.c b/sys/dev/if_ndis/if_ndis.c index e4436d3..2870b4d 100644 --- a/sys/dev/if_ndis/if_ndis.c +++ b/sys/dev/if_ndis/if_ndis.c @@ -597,11 +597,12 @@ ndis_attach(dev) fail: if (error) ndis_detach(dev); - - /* We're done talking to the NIC for now; halt it. */ - ifp->if_flags |= IFF_UP; - ndis_halt_nic(sc); - ifp->if_flags &= ~IFF_UP; + else { + /* We're done talking to the NIC for now; halt it. */ + ifp->if_flags |= IFF_UP; + ndis_halt_nic(sc); + ifp->if_flags &= ~IFF_UP; + } return(error); } @@ -841,6 +842,9 @@ ndis_intrtask(arg, pending) ifp = &sc->arpcom.ac_if; ndis_intrhand(sc); + mtx_lock(&sc->ndis_intrmtx); + ndis_enable_intr(sc); + mtx_unlock(&sc->ndis_intrmtx); if (ifp->if_snd.ifq_head != NULL) ndis_start(ifp); @@ -864,7 +868,12 @@ ndis_intr(arg) return; mtx_lock(&sc->ndis_intrmtx); - ndis_isr(sc, &is_our_intr, &call_isr); + if (sc->ndis_block.nmb_interrupt->ni_isrreq == TRUE) + ndis_isr(sc, &is_our_intr, &call_isr); + else { + ndis_disable_intr(sc); + call_isr = 1; + } mtx_unlock(&sc->ndis_intrmtx); if (is_our_intr || call_isr) @@ -1098,12 +1107,22 @@ ndis_init(xsc) sc->ndis_txpending = sc->ndis_maxpkts; sc->ndis_link = 0; + ndis_enable_intr(sc); + if (sc->ndis_80211) ndis_setstate_80211(sc); ifp->if_flags |= IFF_RUNNING; ifp->if_flags &= ~IFF_OACTIVE; + /* + * Some drivers don't set this value. The NDIS spec says + * the default checkforhang timeout is approximately 2 + * seconds. + */ + if (sc->ndis_block.nmb_checkforhangsecs == 0) + sc->ndis_block.nmb_checkforhangsecs = 2; + if (sc->ndis_chars.nmc_checkhang_func != NULL) sc->ndis_stat_ch = timeout(ndis_tick, sc, hz * sc->ndis_block.nmb_checkforhangsecs); -- cgit v1.1