freebsd-dev/sys/dev/if_ndis
Bill Paul 450a94af7a Deal with a few bootstrap issues:
We can't call KeFlushQueuedDpcs() during bootstrap (cold == 1), since
the flush operation sleeps to wait for completion, and we can't sleep
here (clowns will eat us).

On an i386 SMP system, if we're loaded/probed/attached during bootstrap,
smp_rendezvous() won't run us anywhere except CPU 0 (since the other CPUs
aren't launched until later), which means we won't be able to set up
the GDTs anywhere except CPU 0. To deal with this case, ctxsw_utow()
now checks to see if the TID for the current processor has been properly
initialized and sets up the GTD for the current CPU if not.

Lastly, in if_ndis.c:ndis_shutdown(), do an ndis_stop() to insure we
really halt the NIC and stop interrupts from happening.

Note that loading a driver during bootstrap is, unfortunately, kind of
a hit or miss sort of proposition. In Windows, the expectation is that
by the time a given driver's MiniportInitialize() method is called,
the system is already in 'multiuser' state, i.e. it's up and running
enough to support all the stuff specified in the NDIS API, which includes
the underlying OS-supplied facilities it implicitly depends on, such as
having all CPUs running, having the DPC queues initialized, WorkItem
threads running, etc. But in UNIX, a lot of that stuff won't work during
bootstrap. This causes a problem since we need to call MiniportInitialize()
at least once during ndis_attach() in order to find out what kind of NIC
we have and learn its station address.

What this means is that some cards just plain won't work right if
you try to pre-load the driver along with the kernel: they'll only be
probed/attach correctly if the driver is kldloaded _after_ the system
has reached multiuser. I can't really think of a way around this that
would still preserve the ability to use an NDIS device for diskless
booting.
2005-05-20 04:00:50 +00:00
..
if_ndis_pccard.c More fixes for multibus drivers. When calling out to the match 2005-05-08 23:19:20 +00:00
if_ndis_pci.c More fixes for multibus drivers. When calling out to the match 2005-05-08 23:19:20 +00:00
if_ndis_usb.c Throw the switch on the new driver generation/loading mechanism. From 2005-04-24 20:21:22 +00:00
if_ndis.c Deal with a few bootstrap issues: 2005-05-20 04:00:50 +00:00
if_ndisvar.h Add support for NdisMEthIndicateReceive() and MiniportTransferData(). 2005-05-15 04:27:59 +00:00