freebsd-nq/sys
Bill Paul 58a6edd121 When you call MiniportInitialize() for an 802.11 driver, it will
at some point result in a status event being triggered (it should
be a link down event: the Microsoft driver design guide says you
should generate one when the NIC is initialized). Some drivers
generate the event during MiniportInitialize(), such that by the
time MiniportInitialize() completes, the NIC is ready to go. But
some drivers, in particular the ones for Atheros wireless NICs,
don't generate the event until after a device interrupt occurs
at some point after MiniportInitialize() has completed.

The gotcha is that you have to wait until the link status event
occurs one way or the other before you try to fiddle with any
settings (ssid, channel, etc...). For the drivers that set the
event sycnhronously this isn't a problem, but for the others
we have to pause after calling ndis_init_nic() and wait for the event
to arrive before continuing. Failing to wait can cause big trouble:
on my SMP system, calling ndis_setstate_80211() after ndis_init_nic()
completes, but _before_ the link event arrives, will lock up or
reset the system.

What we do now is check to see if a link event arrived while
ndis_init_nic() was running, and if it didn't we msleep() until
it does.

Along the way, I discovered a few other problems:

- Defered procedure calls run at PASSIVE_LEVEL, not DISPATCH_LEVEL.
  ntoskrnl_run_dpc() has been fixed accordingly. (I read the documentation
  wrong.)

- Similarly, the NDIS interrupt handler, which is essentially a
  DPC, also doesn't need to run at DISPATCH_LEVEL. ndis_intrtask()
  has been fixed accordingly.

- MiniportQueryInformation() and MiniportSetInformation() run at
  DISPATCH_LEVEL, and each request must complete before another
  can be submitted. ndis_get_info() and ndis_set_info() have been
  fixed accordingly.

- Turned the sleep lock that guards the NDIS thread job list into
  a spin lock. We never do anything with this lock held except manage
  the job list (no other locks are held), so it's safe to do this,
  and it's possible that ndis_sched() and ndis_unsched() can be
  called from DISPATCH_LEVEL, so using a sleep lock here is
  semantically incorrect. Also updated subr_witness.c to add the
  lock to the order list.
2005-03-07 03:05:31 +00:00
..
alpha Remove dead code. 2005-03-07 02:18:52 +00:00
amd64 Remove dead code. 2005-03-07 02:18:52 +00:00
arm Fix typo. 2005-03-07 00:24:52 +00:00
boot Fix typos in a comment. 2005-03-06 13:53:05 +00:00
bsm
cam
coda
compat When you call MiniportInitialize() for an 802.11 driver, it will 2005-03-07 03:05:31 +00:00
conf Correct indentation style: 2005-03-07 02:20:14 +00:00
contrib
crypto
ddb
dev When you call MiniportInitialize() for an 802.11 driver, it will 2005-03-07 03:05:31 +00:00
doc
fs
gdb
geom Don't allow to synchronize a plex that is already sychronizing. 2005-03-04 16:43:40 +00:00
gnu
i4b
i386 Remove dead code. 2005-03-07 02:18:52 +00:00
ia64 Remove dead code. 2005-03-07 02:18:52 +00:00
isa
isofs/cd9660
kern When you call MiniportInitialize() for an 802.11 driver, it will 2005-03-07 03:05:31 +00:00
libkern
modules
net When neither of supported frame type is enabled via kernel options enable 2005-03-06 23:03:58 +00:00
net80211
netatalk
netatm
netgraph
netinet
netinet6
netipsec
netipx
netkey
netnatm
netncp
netsmb
nfs
nfs4client
nfsclient
nfsserver
opencrypto
pc98 MFi386: revisions 1.609 and 1.610. 2005-03-06 12:59:59 +00:00
pccard
pci
posix4
powerpc physmem is a much better indicator for 'real' memory on PPC than Maxmem 2005-03-07 01:52:24 +00:00
rpc
security
sparc64 Declare as volatile the memory location referenced by a pointer rather than 2005-03-06 20:57:08 +00:00
sys The m_ext reference counts are potentially shared and modified 2005-03-06 20:09:00 +00:00
tools
ufs
vm
Makefile Add targets to build cscope name files and TAGS file for etags. 2005-03-05 00:56:15 +00:00