freebsd-nq/sys/conf
Bill Paul b545a3b822 Next step on the road to IRPs: create and use an imitation of the
Windows DRIVER_OBJECT and DEVICE_OBJECT mechanism so that we can
simulate driver stacking.

In Windows, each loaded driver image is attached to a DRIVER_OBJECT
structure. Windows uses the registry to match up a given vendor/device
ID combination with a corresponding DRIVER_OBJECT. When a driver image
is first loaded, its DriverEntry() routine is invoked, which sets up
the AddDevice() function pointer in the DRIVER_OBJECT and creates
a dispatch table (based on IRP major codes). When a Windows bus driver
detects a new device, it creates a Physical Device Object (PDO) for
it. This is a DEVICE_OBJECT structure, with semantics analagous to
that of a device_t in FreeBSD. The Windows PNP manager will invoke
the driver's AddDevice() function and pass it pointers to the DRIVER_OBJECT
and the PDO.

The AddDevice() function then creates a new DRIVER_OBJECT structure of
its own. This is known as the Functional Device Object (FDO) and
corresponds roughly to a private softc instance. The driver uses
IoAttachDeviceToDeviceStack() to add this device object to the
driver stack for this PDO. Subsequent drivers (called filter drivers
in Windows-speak) can be loaded which add themselves to the stack.
When someone issues an IRP to a device, it travel along the stack
passing through several possible filter drivers until it reaches
the functional driver (which actually knows how to talk to the hardware)
at which point it will be completed. This is how Windows achieves
driver layering.

Project Evil now simulates most of this. if_ndis now has a modevent
handler which will use MOD_LOAD and MOD_UNLOAD events to drive the
creation and destruction of DRIVER_OBJECTs. (The load event also
does the relocation/dynalinking of the image.) We don't have a registry,
so the DRIVER_OBJECTS are stored in a linked list for now. Eventually,
the list entry will contain the vendor/device ID list extracted from
the .INF file. When ndis_probe() is called and detectes a supported
device, it will create a PDO for the device instance and attach it
to the DRIVER_OBJECT just as in Windows. ndis_attach() will then call
our NdisAddDevice() handler to create the FDO. The NDIS miniport block
is now a device extension hung off the FDO, just as it is in Windows.
The miniport characteristics table is now an extension hung off the
DRIVER_OBJECT as well (the characteristics are the same for all devices
handled by a given driver, so they don't need to be per-instance.)
We also do an IoAttachDeviceToDeviceStack() to put the FDO on the
stack for the PDO. There are a couple of fake bus drivers created
for the PCI and pccard buses. Eventually, there will be one for USB,
which will actually accept USB IRP.s

Things should still work just as before, only now we do things in
the proper order and maintain the correct framework to support passing
IRPs between drivers.

Various changes:

- corrected the comments about IRQL handling in subr_hal.c to more
  accurately reflect reality
- update ndiscvt to make the drv_data symbol in ndis_driver_data.h a
  global so that if_ndis_pci.o and/or if_ndis_pccard.o can see it.
- Obtain the softc pointer from the miniport block by referencing
  the PDO rather than a private pointer of our own (nmb_ifp is no
  longer used)
- implement IoAttachDeviceToDeviceStack(), IoDetachDevice(),
  IoGetAttachedDevice(), IoAllocateDriverObjectExtension(),
  IoGetDriverObjectExtension(), IoCreateDevice(), IoDeleteDevice(),
  IoAllocateIrp(), IoReuseIrp(), IoMakeAssociatedIrp(), IoFreeIrp(),
  IoInitializeIrp()
- fix a few mistakes in the driver_object and device_object definitions
- add a new module, kern_windrv.c, to handle the driver registration
  and relocation/dynalinkign duties (which don't really belong in
  kern_ndis.c).
- made ndis_block and ndis_chars in the ndis_softc stucture pointers
  and modified all references to it
- fixed NdisMRegisterMiniport() and NdisInitializeWrapper() so they
  work correctly with the new driver_object mechanism
- changed ndis_attach() to call NdisAddDevice() instead of ndis_load_driver()
  (which is now deprecated)
- used ExAllocatePoolWithTag()/ExFreePool() in lookaside list routines
  instead of kludged up alloc/free routines
- added kern_windrv.c to sys/modules/ndis/Makefile and files.i386.
2005-02-08 17:23:25 +00:00
..
defines
files Hook acpi_throttle(4) up to the build. It's currently part of acpi_perf.ko 2005-02-06 21:13:41 +00:00
files.alpha It appears that 'kbd' device has never been used and isn't needed. 2004-11-23 00:00:43 +00:00
files.amd64 Protect the NM expansion. 2004-12-21 02:08:14 +00:00
files.arm Add arm/mem.c. 2004-11-22 22:20:50 +00:00
files.i386 Next step on the road to IRPs: create and use an imitation of the 2005-02-08 17:23:25 +00:00
files.ia64 It appears that 'kbd' device has never been used and isn't needed. 2004-11-23 00:00:43 +00:00
files.pc98 cosmetic changes. 2005-02-04 15:34:52 +00:00
files.powerpc Add /dev/mem and /dev/kmem to powerpc. 2004-08-16 13:07:40 +00:00
files.sparc64 Add a front-end for the `rtc' device which is a MC146818 compatible 2004-11-17 16:41:42 +00:00
kern.mk Define INLINE_LIMIT for arm. 2004-05-14 13:35:46 +00:00
kern.post.mk Back when VOP_* was introduced, we did not have new-style struct 2004-12-01 23:16:38 +00:00
kern.pre.mk Embellish rev 1.61. If we're not building a debug kernel, use -O2 as before. 2005-01-22 00:58:34 +00:00
kmod_syms.awk
kmod.mk Hook up the cpufreq framework, acpi_perf(4), and cpufreq(4) drivers. 2005-02-04 05:49:36 +00:00
ldscript.alpha Have the linker provide the btext symbol when referenced. This is needed 2004-08-27 19:13:35 +00:00
ldscript.amd64 Provide the _start_ctors and _stop_ctors symbols. As on i386, the addresses 2004-05-29 01:09:00 +00:00
ldscript.arm Use the address provided in the conf file, instead of hardcode 0xc0000000. 2004-09-23 22:52:55 +00:00
ldscript.i386 Align the .ctors section correctly. 2003-12-03 07:40:03 +00:00
ldscript.ia64 Have the linker provide btext. It's used for profiling. 2004-08-25 07:43:28 +00:00
ldscript.powerpc
ldscript.sparc64 Use the same SEARCH_DIR as other platforms. 2003-06-07 18:23:50 +00:00
majors nos->now typo reported by njl 2004-12-27 18:58:57 +00:00
majors.awk Add necessary awk magic to create a table of major numbers allocated 2003-02-27 08:52:11 +00:00
Makefile.alpha Kill count device support from config. I've changed the last few 2004-08-30 23:03:58 +00:00
Makefile.amd64 Kill count device support from config. I've changed the last few 2004-08-30 23:03:58 +00:00
Makefile.arm Add a new make option, ARM_BIG_ENDIAN, to compile big endian kernels. 2005-01-19 16:43:43 +00:00
Makefile.i386 Kill count device support from config. I've changed the last few 2004-08-30 23:03:58 +00:00
Makefile.ia64 Kill count device support from config. I've changed the last few 2004-08-30 23:03:58 +00:00
Makefile.pc98 Kill count device support from config. I've changed the last few 2004-08-30 23:03:58 +00:00
Makefile.powerpc - remove NO_MODULES since they've been working for some time 2005-02-03 06:28:17 +00:00
Makefile.sparc64 Kill count device support from config. I've changed the last few 2004-08-30 23:03:58 +00:00
makeLINT.mk Implemented "nooption" and "nomakeoption" config(8) tokens. 2003-02-26 23:36:59 +00:00
makeLINT.sed Implemented "nooption" and "nomakeoption" config(8) tokens. 2003-02-26 23:36:59 +00:00
newvers.sh If USER of HOSTNAME is set to an empty value, use the fallback value. 2005-01-15 13:25:41 +00:00
NOTES Fix sloppy use of "manpage", bump .Dd where applicable and rename RED to 2005-02-07 23:20:12 +00:00
options Hook up ng_ipfw to kernel build. 2005-02-05 12:15:56 +00:00
options.alpha Update for the KDB framework. Sanitize the alpha console code now that 2004-07-10 22:29:41 +00:00
options.amd64 Add the mp_watchdog hooks, although it locks up my SMP test box. It might 2004-08-30 23:33:33 +00:00
options.arm Add a new option, ARM32_NEW_VM_LAYOUT. When set, we try to put up to 4 2004-11-10 22:08:27 +00:00
options.i386 Initiate deorbit burn sequence for 80386 support in FreeBSD: Remove 2004-11-16 20:42:32 +00:00
options.ia64 Catch up with the drive-by renaming of IA32 to COMPAT_IA32. It must 2004-08-16 18:54:23 +00:00
options.pc98 The bs and wdc drivers are gone. 2005-02-04 15:29:54 +00:00
options.powerpc Catch up with sparc64 OFWCONS_POLL_HZ change 2004-06-25 13:44:34 +00:00
options.sparc64 Better OFW console support on Sun Ultra2 machines. 2004-06-24 02:57:11 +00:00
systags.sh Remove advertising clause from University of California Regent's 2004-04-07 20:46:16 +00:00