freebsd-dev/sys/modules
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
..
3dfx
aac Only compile aac_linux.ko for i386 2004-08-30 03:35:17 +00:00
accf_data
accf_http
acpi Hook acpi_throttle(4) up to the build. It's currently part of acpi_perf.ko 2005-02-06 21:13:41 +00:00
agp The tinderbox seems to have a different set of compiler options 2005-01-26 21:18:58 +00:00
aha
ahb Add the ahb module for old Adaptec 1742 drivers now that eisa bus 2004-06-29 20:50:24 +00:00
aic Move to generating pccarddevs.h on the fly, both for the kernel and 2004-05-26 00:53:10 +00:00
aic7xxx Add WERRROR= to work around the warnings 2005-01-26 16:29:07 +00:00
aio
amd
amr
an Move to generating pccarddevs.h on the fly, both for the kernel and 2004-05-26 00:53:10 +00:00
aout
apm
ar Convert Netgraph to use mbuf tags to pass its meta information around. 2004-06-25 19:22:05 +00:00
arcnet
arl Generate opt_inet.h. 2004-03-18 09:45:17 +00:00
asr Fix the build. opt_asr.h is gone. 2004-04-22 02:22:18 +00:00
ath module for Atheros 802.11 driver 2003-06-23 17:02:43 +00:00
ath_hal Fix building for non-i386 platforms. 2005-01-18 03:28:08 +00:00
ath_rate_amrr Update/new modules for net80211 and ath changes. 2004-12-08 17:38:38 +00:00
ath_rate_onoe Update/new modules for net80211 and ath changes. 2004-12-08 17:38:38 +00:00
aue Add usbdevs.h and pccarddevs.h to the build list, as appropriate. This is needed to build as part of world or in src/sys/modules. 2004-06-27 12:33:20 +00:00
auxio Port NetBSD auxio driver. The driver was modified to use led(4) and can 2004-10-09 07:31:03 +00:00
awi Move to generating pccarddevs.h on the fly, both for the kernel and 2004-05-26 00:53:10 +00:00
axe Add usbdevs.h and pccarddevs.h to the build list, as appropriate. This is needed to build as part of world or in src/sys/modules. 2004-06-27 12:33:20 +00:00
bfe Add a device driver for the Broadcom BCM4401 ethernet controller, 2003-09-09 18:17:23 +00:00
bge
bios Add WERRROR= to work around the warnings 2005-01-26 16:29:07 +00:00
bktr We don't need to generate vnode_if.h anymore 2004-12-29 08:50:35 +00:00
bridge opt_pfil_hooks.h is no longer required. 2004-08-27 19:57:33 +00:00
cam Remove the HW_WDOG option; it serves no purpose. 2004-08-29 11:10:09 +00:00
canbepm
canbus
cardbus
cbb And isa_if.h 2004-08-16 15:24:03 +00:00
cd9660 - Support for multibyte charsets in LIBICONV. 2003-09-26 20:26:25 +00:00
cd9660_iconv - Support for multibyte charsets in LIBICONV. 2003-09-26 20:26:25 +00:00
ciss
cm
coda bsd.kmod.mk knows how to clean up opt_*.h files automatically, 2004-09-01 06:51:43 +00:00
coda5 bsd.kmod.mk knows how to clean up opt_*.h files automatically, 2004-09-01 06:51:43 +00:00
coff
cp Start the dreaded NOFOO -> NO_FOO conversion. 2004-12-21 08:47:35 +00:00
cpufreq Hook up the cpufreq framework, acpi_perf(4), and cpufreq(4) drivers. 2005-02-04 05:49:36 +00:00
crypto Push m_apply() and m_getptr() up into the colleciton of standard mbuf 2003-12-15 21:49:41 +00:00
cryptodev
cs Sort files alphabetically 2004-09-04 03:32:15 +00:00
ctau Mechanically tidy up the contents of CLEANFILES:M*.h: kmod.mk 2004-09-01 07:12:24 +00:00
cue Add usbdevs.h and pccarddevs.h to the build list, as appropriate. This is needed to build as part of world or in src/sys/modules. 2004-06-27 12:33:20 +00:00
cx Mechanically tidy up the contents of CLEANFILES:M*.h: kmod.mk 2004-09-01 07:12:24 +00:00
dc
dcons Add dcons_os.{c,h}. 2004-10-13 05:41:09 +00:00
dcons_crom Add dcons_os.{c,h}. 2004-10-13 05:41:09 +00:00
de Document compile-time switches here as I'm going to yank them from 2004-07-09 02:38:25 +00:00
digi
dpt
drm bsd.kmod.mk does not deal with manpages anymore. 2004-01-13 11:28:51 +00:00
dummynet
ed Move to generating pccarddevs.h on the fly, both for the kernel and 2004-05-26 00:53:10 +00:00
el
elink
em style.Makefile(5) 2004-06-09 08:27:05 +00:00
en When compiling the module with INVARIANTS we also need INVARIANT_SUPPORT. 2003-08-06 16:01:32 +00:00
ep Add usbdevs.h and pccarddevs.h to the build list, as appropriate. This is needed to build as part of world or in src/sys/modules. 2004-06-27 12:33:20 +00:00
esp Fix paths after repocopies done by scottl 2004-11-10 14:09:52 +00:00
ex Move to generating pccarddevs.h on the fly, both for the kernel and 2004-05-26 00:53:10 +00:00
exca Move to generating pccarddevs.h on the fly, both for the kernel and 2004-05-26 00:53:10 +00:00
ext2fs
fatm Removed -g from CFLAGS. There is a better way to build debugging 2004-02-13 10:11:01 +00:00
fdc Let kmod.mk touch opt_*.h files as needed. 2004-09-04 06:37:58 +00:00
fdescfs
fe Move to generating pccarddevs.h on the fly, both for the kernel and 2004-05-26 00:53:10 +00:00
firewire Add fwip module. 2004-07-12 13:13:17 +00:00
fxp
gem
geom Connect SHSEC GEOM class to the build. 2005-01-11 18:18:40 +00:00
harp Removed -g from CFLAGS. There is a better way to build debugging 2004-02-13 10:11:01 +00:00
hatm Removed -g from CFLAGS. There is a better way to build debugging 2004-02-13 10:11:01 +00:00
hfa
hifn
hme Now that hme(4) is MI build its module on all platforms. 2004-08-14 22:40:16 +00:00
hpfs
hptmv Clean up some messy Makefile stuff so that this can be built into the 2004-10-24 08:38:29 +00:00
i2c Kill bogus isa compat opt file. 2004-03-15 11:27:39 +00:00
ibcs2
ichwd Add a driver for the watchdog timer function present on the LPC interface 2004-05-11 18:21:38 +00:00
ida ida(4) module. PCI only for now. 2004-01-11 07:01:30 +00:00
idt
ie Add WERRROR= to work around the warnings 2005-01-26 16:29:07 +00:00
if_disc
if_ef Removed custom "load" and "unload" targets. 2004-01-19 14:00:26 +00:00
if_faith
if_gif NOINET6 -> NO_INET6 2004-12-21 10:49:29 +00:00
if_gre Fix a bug whereby the physical endpoints of a gre(4) tunnel would not 2003-11-14 20:58:00 +00:00
if_ndis Move to generating pccarddevs.h on the fly, both for the kernel and 2004-05-26 00:53:10 +00:00
if_ppp We don't need to generate vnode_if.h anymore 2004-12-29 08:50:35 +00:00
if_sl
if_stf
if_tap Mechanically tidy up the contents of CLEANFILES:M*.h: kmod.mk 2004-09-01 07:12:24 +00:00
if_tun We don't need to generate vnode_if.h anymore 2004-12-29 08:50:35 +00:00
if_vlan
iir
io No need to generate vnode_if.h anymore 2004-12-29 08:44:30 +00:00
ip6fw
ip_mroute_mod Get rid of the RANDOM_IP_ID option and make it a sysctl. NetBSD 2004-08-14 15:32:40 +00:00
ipdivert Convert IPDIVERT into a loadable module. This makes use of the dynamic loadability 2004-10-19 21:14:57 +00:00
ipfilter Don't define PFIL_HOOKS. It's no longer required in RELENG_5 or HEAD. 2004-12-25 00:23:36 +00:00
ipfw IPDIVERT is a module now and tell the other parts of the kernel about it. 2004-10-25 20:02:34 +00:00
ips
isp - Introduce an ofw_bus kobj-interface for retrieving the OFW node and a 2004-08-12 17:41:33 +00:00
ispfw
ixgb style.Makefile(5) 2004-06-09 08:27:05 +00:00
joy Move to generating pccarddevs.h on the fly, both for the kernel and 2004-05-26 00:53:10 +00:00
kue Add usbdevs.h and pccarddevs.h to the build list, as appropriate. This is needed to build as part of world or in src/sys/modules. 2004-06-27 12:33:20 +00:00
lge
libiconv - Support for multibyte charsets in LIBICONV. 2003-09-26 20:26:25 +00:00
libmbpool Add a facility for devices, specifically network interfaces, that require 2003-07-15 08:59:38 +00:00
libmchain
linprocfs Let kmod.mk touch opt_*.h files as needed. 2004-09-04 06:37:58 +00:00
linux o Remove @- from the ln and change it to a -sf. This was bogus, and 2003-11-19 05:08:27 +00:00
lnc Removed -g from CFLAGS. There is a better way to build debugging 2004-02-13 10:11:01 +00:00
lpt
mac_biba
mac_bsdextended
mac_ifoff
mac_lomac
mac_mls
mac_none
mac_partition
mac_portacl mac_portacl.c no longer references vnode_if.h. 2004-12-30 13:49:01 +00:00
mac_seeotheruids
mac_stub Following the repo-copy from src/sys/modules/mac_none/Makefile, 2003-11-11 21:23:54 +00:00
mac_test
mcd
md change the name of the md module, to g_md, introduce a define with the 2004-08-09 06:45:20 +00:00
mem No need to generate vnode_if.h anymore 2004-12-29 08:44:30 +00:00
mii Add a PHY driver to support the built-in gigE PHY in the 8169S/8110S 2003-09-11 03:53:46 +00:00
mlx
mly
mpt
msdosfs Let kmod.mk touch opt_*.h files as needed. 2004-09-04 06:37:58 +00:00
msdosfs_iconv - Support for multibyte charsets in LIBICONV. 2003-09-26 20:26:25 +00:00
mse Separate mse driver into a core driver and a bus attachments. Separate out 2004-12-12 20:05:50 +00:00
my
ncp Removed custom "load" and "unload" targets. 2004-01-19 14:00:26 +00:00
ncv Move to generating pccarddevs.h on the fly, both for the kernel and 2004-05-26 00:53:10 +00:00
ndis Next step on the road to IRPs: create and use an imitation of the 2005-02-08 17:23:25 +00:00
netgraph Add ng_ipfw to kernel module build. 2005-02-05 12:09:38 +00:00
nfs4client Let kmod.mk touch opt_*.h files as needed. 2004-09-04 06:37:58 +00:00
nfsclient Let kmod.mk touch opt_*.h files as needed. 2004-09-04 06:37:58 +00:00
nfsserver
nge
nmdm
nsp Move to generating pccarddevs.h on the fly, both for the kernel and 2004-05-26 00:53:10 +00:00
ntfs - Support for multibyte charsets in LIBICONV. 2003-09-26 20:26:25 +00:00
ntfs_iconv - Support for multibyte charsets in LIBICONV. 2003-09-26 20:26:25 +00:00
nullfs
nwfs Removed custom "load" and "unload" targets. 2004-01-19 14:00:26 +00:00
oldcard Move to generating pccarddevs.h on the fly, both for the kernel and 2004-05-26 00:53:10 +00:00
oltr - Split out PCI support. 2005-02-03 23:01:01 +00:00
osf1 Removed -g from CFLAGS. There is a better way to build debugging 2004-02-13 10:11:01 +00:00
owi Let kmod.mk touch opt_*.h files as needed. 2004-09-04 06:37:58 +00:00
patm Removed -g from CFLAGS. There is a better way to build debugging 2004-02-13 10:11:01 +00:00
pccard Move to generating pccarddevs.h on the fly, both for the kernel and 2004-05-26 00:53:10 +00:00
pcfclock
pcn
pecoff Removed -g from CFLAGS. There is a better way to build debugging 2004-02-13 10:11:01 +00:00
pf NOINET6 -> NO_INET6 2004-12-21 10:49:29 +00:00
plip
pmc
portalfs
ppbus o Remove @- from the ln and change it to a -sf. This was bogus, and 2003-11-19 05:08:27 +00:00
ppi o Remove @- from the ln and change it to a -sf. This was bogus, and 2003-11-19 05:08:27 +00:00
pps o Remove @- from the ln and change it to a -sf. This was bogus, and 2003-11-19 05:08:27 +00:00
procfs
pseudofs
pst Add pst as a module 2003-08-30 08:01:05 +00:00
random Include nehemiah.c only on i386, as is done for the non-modules 2004-04-11 15:40:18 +00:00
ray Move to generating pccarddevs.h on the fly, both for the kernel and 2004-05-26 00:53:10 +00:00
rc
rc4
re Fix PATH: directive in sys/modules/re/Makefile, and add the re(4) driver to 2003-09-08 03:24:29 +00:00
rl
rndtest
rp
rue Add usbdevs.h and pccarddevs.h to the build list, as appropriate. This is needed to build as part of world or in src/sys/modules. 2004-06-27 12:33:20 +00:00
s3
safe SafeNet crypto driver 2003-07-21 21:47:47 +00:00
sbni
sbsh
scd
scsi_low
sem
sf
sio o Remove opt_ddb.h from SRCS. 2004-11-20 23:04:32 +00:00
sis
sk
smbfs For variables that are only checked with defined(), don't provide 2004-10-24 15:33:08 +00:00
sn Move to generating pccarddevs.h on the fly, both for the kernel and 2004-05-26 00:53:10 +00:00
snc
snp We don't need to generate vnode_if.h anymore 2004-12-29 08:50:35 +00:00
sound Add WERRROR= to work around the warnings 2005-01-26 16:29:07 +00:00
speaker
splash Move the source code for these two modules out of src/sys/modules. 2004-08-06 20:37:08 +00:00
sppp Add FR support to sppp (MFCronyx). 2004-12-28 00:07:57 +00:00
sr Convert Netgraph to use mbuf tags to pass its meta information around. 2004-06-25 19:22:05 +00:00
ste
stg Move to generating pccarddevs.h on the fly, both for the kernel and 2004-05-26 00:53:10 +00:00
streams o Remove @- from the ln and change it to a -sf. This was bogus, and 2003-11-19 05:08:27 +00:00
svr4
sym
syscons Normalize SUBDIR. 2004-01-19 12:36:08 +00:00
sysvipc
ti Remove vnode_if.h for rev 1.14. 2004-12-29 21:50:44 +00:00
tl
trm
twa Changed comments following changes to not bundle firmware by default. 2004-04-10 02:41:22 +00:00
twe
tx
txp
uart Stop building uart_dev_i8251.c. It was copied from uart_dev_ns8250.c 2004-11-20 23:38:48 +00:00
ubsa We don't need to generate vnode_if.h anymore 2004-12-29 08:50:35 +00:00
ubsec
ubser We don't need to generate vnode_if.h anymore 2004-12-29 08:50:35 +00:00
ucom We don't need to generate vnode_if.h anymore 2004-12-29 08:50:35 +00:00
ucycom We don't need to generate vnode_if.h anymore 2004-12-29 08:50:35 +00:00
udav Add usbdevs.h and pccarddevs.h to the build list, as appropriate. This is needed to build as part of world or in src/sys/modules. 2004-06-27 12:33:20 +00:00
udbp Add usbdevs.h and pccarddevs.h to the build list, as appropriate. This is needed to build as part of world or in src/sys/modules. 2004-06-27 12:33:20 +00:00
udf bsd.kmod.mk does not deal with manpages anymore. 2004-01-13 11:28:51 +00:00
udf_iconv Add the Makefile glue for the udf_iconv module. 2003-11-07 09:38:05 +00:00
ufm Add usbdevs.h and pccarddevs.h to the build list, as appropriate. This is needed to build as part of world or in src/sys/modules. 2004-06-27 12:33:20 +00:00
ufs Add a few missing opt_ files to make this module compile again. 2003-06-23 19:41:00 +00:00
uftdi We don't need to generate vnode_if.h anymore 2004-12-29 08:50:35 +00:00
ugen We don't need to generate vnode_if.h anymore 2004-12-29 08:50:35 +00:00
uhid We don't need to generate vnode_if.h anymore 2004-12-29 08:50:35 +00:00
ukbd We don't need to generate vnode_if.h anymore 2004-12-29 08:50:35 +00:00
ulpt We don't need to generate vnode_if.h anymore 2004-12-29 08:50:35 +00:00
umapfs
umass Add usbdevs.h and pccarddevs.h to the build list, as appropriate. This is needed to build as part of world or in src/sys/modules. 2004-06-27 12:33:20 +00:00
umct We don't need to generate vnode_if.h anymore 2004-12-29 08:50:35 +00:00
umodem We don't need to generate vnode_if.h anymore 2004-12-29 08:50:35 +00:00
ums We don't need to generate vnode_if.h anymore 2004-12-29 08:50:35 +00:00
unionfs
uplcom We don't need to generate vnode_if.h anymore 2004-12-29 08:50:35 +00:00
urio We don't need to generate vnode_if.h anymore 2004-12-29 08:50:35 +00:00
usb Add usbdevs_data.h to the SRCS list since usb_subr.c needs it. This forces 2004-12-31 16:05:07 +00:00
uscanner We don't need to generate vnode_if.h anymore 2004-12-29 08:50:35 +00:00
utopia
uvisor We don't need to generate vnode_if.h anymore 2004-12-29 08:50:35 +00:00
uvscom We don't need to generate vnode_if.h anymore 2004-12-29 08:50:35 +00:00
vesa
vge Add device driver support for the VIA Networking Technologies 2004-09-10 20:57:46 +00:00
vkbd No need to generate vnode_if.h anymore 2004-12-29 08:44:30 +00:00
vpo
vr
vx Add eisa_if.h 2004-06-09 21:52:12 +00:00
wb
wi Move to generating pccarddevs.h on the fly, both for the kernel and 2004-05-26 00:53:10 +00:00
wlan Update/new modules for net80211 and ath changes. 2004-12-08 17:38:38 +00:00
wlan_acl Update/new modules for net80211 and ath changes. 2004-12-08 17:38:38 +00:00
wlan_ccmp fix typo to resolve undefined symbol 2004-12-16 01:10:48 +00:00
wlan_tkip Update/new modules for net80211 and ath changes. 2004-12-08 17:38:38 +00:00
wlan_wep Update/new modules for net80211 and ath changes. 2004-12-08 17:38:38 +00:00
wlan_xauth Update/new modules for net80211 and ath changes. 2004-12-08 17:38:38 +00:00
xe Move to generating pccarddevs.h on the fly, both for the kernel and 2004-05-26 00:53:10 +00:00
xl
zlib Give zlib the ability to be a module that can be depended on, 2004-06-20 17:42:35 +00:00
Makefile Only compile the cpufreq driver on i386 and amd64. 2005-02-05 08:01:10 +00:00
Makefile.inc