diff options
author | Bill Paul <wpaul@FreeBSD.org> | 2004-04-05 08:26:52 +0000 |
---|---|---|
committer | Bill Paul <wpaul@FreeBSD.org> | 2004-04-05 08:26:52 +0000 |
commit | 6a502855161c4c80c138c9f54a9750a9a91ce2bf (patch) | |
tree | 057a33cfd484ecc40f229d22b45423b1a969419f /sys/dev/if_ndis | |
parent | 42d122e1251ea547b43af6306bb079d307549f43 (diff) | |
download | src-6a502855161c4c80c138c9f54a9750a9a91ce2bf.tar.gz src-6a502855161c4c80c138c9f54a9750a9a91ce2bf.zip |
- The MiniportReset() function can return NDIS_STATUS_PENDING, in which
case we should wait for the resetdone handler to be called before
returning.
- When providing resources via ndis_query_resources(), uses the
computed rsclen when using bcopy() to copy out the resource data
rather than the caller-supplied buffer length.
- Avoid using ndis_reset_nic() in if_ndis.c unless we really need
to reset the NIC because of a problem.
- Allow interrupts to be fielded during ndis_attach(), at least
as far as allowing ndis_isr() and ndis_intrhand() to run.
- Use ndis_80211_rates_ex when probing for supported rates. Technically,
this isn't supposed to work since, although Microsoft added the extended
rate structure with the NDIS 5.1 update, the spec still says that
the OID_802_11_SUPPORTED_RATES OID uses ndis_80211_rates. In spite of
this, it appears some drivers use it anyway.
- When adding in our guessed rates, check to see if they already exist
so that we avoid any duplicates.
- Add a printf() to ndis_open_file() that alerts the user when a
driver attempts to open a file under /compat/ndis.
With these changes, I can get the driver for the SMC 2802W 54g PCI
card to load and run. This board uses a Prism54G chip. Note that in
order for this driver to work, you must place the supplied smc2802w.arm
firmware image under /compat/ndis. (The firmware is not resident on
the device.)
Note that this should also allow the 3Com 3CRWE154G72 card to work
as well; as far as I can tell, these cards also use a Prism54G chip.
Notes
Notes:
svn path=/head/; revision=127887
Diffstat (limited to 'sys/dev/if_ndis')
-rw-r--r-- | sys/dev/if_ndis/if_ndis.c | 73 |
1 files changed, 37 insertions, 36 deletions
diff --git a/sys/dev/if_ndis/if_ndis.c b/sys/dev/if_ndis/if_ndis.c index ddb7c50cae68..901b3134b6a0 100644 --- a/sys/dev/if_ndis/if_ndis.c +++ b/sys/dev/if_ndis/if_ndis.c @@ -425,9 +425,6 @@ ndis_attach(dev) if (!(sc->ndis_block.nmb_flags & NDIS_ATTRIBUTE_DESERIALIZE)) sc->ndis_block.nmb_pktind_func = ndis_rxeof_serial; - /* Reset the adapter. */ - ndis_reset_nic(sc); - /* * Get station address from the driver. */ @@ -496,7 +493,7 @@ ndis_attach(dev) if (sc->ndis_80211) { struct ieee80211com *ic = (void *)ifp; ndis_80211_config config; - ndis_80211_rates rates; + ndis_80211_rates_ex rates; struct ndis_80211_nettype_list *ntl; uint32_t arg; int r; @@ -550,6 +547,20 @@ nonettypes: * if this is not 802.11b we're just going to be faking it * all up to heck. */ + +#define TESTSETRATE(x, y) \ + do { \ + int i; \ + for (i = 0; i < ic->ic_sup_rates[x].rs_nrates; i++) { \ + if (ic->ic_sup_rates[x].rs_rates[i] == (y)) \ + break; \ + } \ + if (i == ic->ic_sup_rates[x].rs_nrates) { \ + ic->ic_sup_rates[x].rs_rates[i] = (y); \ + ic->ic_sup_rates[x].rs_nrates++; \ + } \ + } while (0) + #define SETRATE(x, y) \ ic->ic_sup_rates[x].rs_rates[ic->ic_sup_rates[x].rs_nrates] = (y) #define INCRATE(x) \ @@ -601,24 +612,16 @@ nonettypes: * we detect turbo modes, though? */ if (ic->ic_modecaps & (1<<IEEE80211_MODE_11G)) { - SETRATE(IEEE80211_MODE_11G, 47); - INCRATE(IEEE80211_MODE_11G); - SETRATE(IEEE80211_MODE_11G, 72); - INCRATE(IEEE80211_MODE_11G); - SETRATE(IEEE80211_MODE_11G, 96); - INCRATE(IEEE80211_MODE_11G); - SETRATE(IEEE80211_MODE_11G, 108); - INCRATE(IEEE80211_MODE_11G); + TESTSETRATE(IEEE80211_MODE_11G, 47); + TESTSETRATE(IEEE80211_MODE_11G, 72); + TESTSETRATE(IEEE80211_MODE_11G, 96); + TESTSETRATE(IEEE80211_MODE_11G, 108); } if (ic->ic_modecaps & (1<<IEEE80211_MODE_11A)) { - SETRATE(IEEE80211_MODE_11A, 47); - INCRATE(IEEE80211_MODE_11A); - SETRATE(IEEE80211_MODE_11A, 72); - INCRATE(IEEE80211_MODE_11A); - SETRATE(IEEE80211_MODE_11A, 96); - INCRATE(IEEE80211_MODE_11A); - SETRATE(IEEE80211_MODE_11A, 108); - INCRATE(IEEE80211_MODE_11A); + TESTSETRATE(IEEE80211_MODE_11A, 47); + TESTSETRATE(IEEE80211_MODE_11A, 72); + TESTSETRATE(IEEE80211_MODE_11A, 96); + TESTSETRATE(IEEE80211_MODE_11A, 108); } #undef SETRATE #undef INCRATE @@ -648,6 +651,7 @@ nonettypes: if (r == 0) ic->ic_caps |= IEEE80211_C_PMGT; i = sizeof(config); + bzero((char *)&config, sizeof(config)); config.nc_length = i; config.nc_fhconfig.ncf_length = sizeof(ndis_80211_config_fh); r = ndis_get_info(sc, OID_802_11_CONFIGURATION, &config, &i); @@ -687,12 +691,9 @@ nonettypes: fail: if (error) ndis_detach(dev); - else { + 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); } @@ -1114,8 +1115,7 @@ ndis_intr(arg) sc = arg; ifp = &sc->arpcom.ac_if; - if (!(ifp->if_flags & IFF_UP) || - sc->ndis_block.nmb_miniportadapterctx == NULL) + if (sc->ndis_block.nmb_miniportadapterctx == NULL) return; mtx_pool_lock(ndis_mtxpool, sc->ndis_intrmtx); @@ -1127,7 +1127,7 @@ ndis_intr(arg) } mtx_pool_unlock(ndis_mtxpool, sc->ndis_intrmtx); - if ((is_our_intr || call_isr) && (ifp->if_flags & IFF_UP)) + if ((is_our_intr || call_isr)) ndis_sched(ndis_intrtask, ifp, NDIS_SWI); return; @@ -1158,6 +1158,16 @@ ndis_ticktask(xsc) sc = xsc; + hangfunc = sc->ndis_chars.nmc_checkhang_func; + + if (hangfunc != NULL) { + rval = hangfunc(sc->ndis_block.nmb_miniportadapterctx); + if (rval == TRUE) { + ndis_reset_nic(sc); + return; + } + } + len = sizeof(linkstate); error = ndis_get_info(sc, OID_GEN_MEDIA_CONNECT_STATUS, (void *)&linkstate, &len); @@ -1180,14 +1190,6 @@ ndis_ticktask(xsc) NDIS_UNLOCK(sc); - hangfunc = sc->ndis_chars.nmc_checkhang_func; - - if (hangfunc != NULL) { - rval = hangfunc(sc->ndis_block.nmb_miniportadapterctx); - if (rval == TRUE) - ndis_reset_nic(sc); - } - return; } @@ -1378,7 +1380,6 @@ ndis_init(xsc) /* * Cancel pending I/O and free all RX/TX buffers. */ - ndis_reset_nic(sc); ndis_stop(sc); if (ndis_init_nic(sc)) return; |