opnsense-src/sys/dev
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
..
aac Fix whitespace 2005-01-23 16:13:10 +00:00
acpi_support Unify ACPI_DEBUG support for all OEM drivers under ACPI_OEM. Since more than 2004-12-13 23:31:46 +00:00
acpica Remove handling _PSS notifies from acpi_cpu and let acpi_perf handle them. 2005-02-07 04:03:06 +00:00
adlink Commit the new version of the adlink driver which can do non-cyclic 2004-09-19 21:52:15 +00:00
advansys Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
agp /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
aha Simplify aha resource management, and fix a few bugs in unwinding 2005-01-19 06:54:10 +00:00
ahb Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
aic Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
aic7xxx Make this compile from the last commit 2005-01-06 05:30:44 +00:00
amd Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
amr Add support for the LSI 320-2E PCI-Express controller. Fix a couple of bugs 2005-01-23 23:25:41 +00:00
an Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ar Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
arl Since if_arl doesn't contain locking or run with INTR_MPSAFE, mark 2004-08-13 22:54:19 +00:00
asr Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ata Avoid using tsleep() in the resume path as it may result in the 2005-02-07 17:14:42 +00:00
ath Fixup radiotap handling of FCS and QoS frames per discussion with David Young: 2005-01-24 20:31:24 +00:00
atkbdc Make life for owners of Synaptics Touchpads more pleasant :-) 2005-01-10 13:05:58 +00:00
auxio Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
awi Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
bfe correct direction for bus_dma sync of rx buffer 2005-01-09 19:57:55 +00:00
bge Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
bktr Fix a few printf problems on ia64 (and other 64-bit platforms). 2005-01-27 01:40:12 +00:00
buslogic Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
cardbus Move resource allocation routines from cardbus_cis.c to cardbus.c. 2005-02-06 21:03:13 +00:00
ciss Remove 6422, V100 and add the P600. 2005-01-20 22:51:38 +00:00
cm Since if_cm doesn't contain locking or run with INTR_MPSAFE, mark 2004-08-13 22:57:44 +00:00
cnw Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
cp Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
cpufreq Use intr_disable/restore() instead of disable_intr() since the latter is 2005-02-05 16:31:58 +00:00
cs Fix the worst offenders of style(9) with a small style sweep. 2005-01-28 06:50:59 +00:00
ct Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ctau Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
cx Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
cy Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
dc /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
dcons Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
de Hide link up/down/media printfs behind bootverbose 2004-11-08 19:21:57 +00:00
dec Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
digi Add new function ttyinitmode() which sets our systemwide default 2004-10-18 21:51:27 +00:00
dpt Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
drm Fix typo from previous commit. 2005-01-07 07:08:33 +00:00
ed Use ANSI function definitions, tweak a couple of prototypes to match (since 2005-02-08 06:12:44 +00:00
eisa Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
em Call if_link_state_change() when link status changes. 2005-02-04 18:36:04 +00:00
en Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ep Don't print 'unknown id' in the ep_pccard_identify routine. It is 2005-01-20 20:36:59 +00:00
esp Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ex Include necessary declarations 2005-01-20 20:06:44 +00:00
exca Properly calculate the offset in mapping the memory of pccards. This 2005-01-11 00:32:43 +00:00
fatm Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
fb Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
fdc Mask off the upper bits of the resource before using it as an index 2005-01-20 17:27:37 +00:00
fe we don't need the offset in the attr memory to get the ethernet 2005-01-21 19:51:23 +00:00
firewire Clear PCIM_CMD_SERRESPEN and PCIM_CMD_PERRESPEN for broken hardware. 2005-01-06 07:40:34 +00:00
fxp Disable ethernet flow control in if_fxp by default, in order to prevent 2005-01-29 23:13:20 +00:00
gem Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
gfb Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
harp Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
hatm Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
hfa Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
hifn Update support for 795x parts: 2005-01-19 17:03:35 +00:00
hme Fix "Duplicate mbuf free panic". 2005-02-02 08:35:11 +00:00
hptmv Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ic Since we are quite unlikely to ever face another platform which 2005-02-06 13:46:39 +00:00
ichsmb Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ichwd Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ida Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
idt Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ie Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ieee488 Allocate more space for softc. Amazing my machine survived this. 2005-02-06 22:45:12 +00:00
if_ndis Next step on the road to IRPs: create and use an imitation of the 2005-02-08 17:23:25 +00:00
iicbus Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
iir Remove a dead vtophys() reference. 2005-01-31 01:26:22 +00:00
io Add module versions. 2004-08-02 20:42:28 +00:00
ips Add crashdump support to the ips driver. It only works for the more modern 2005-01-30 17:45:45 +00:00
isp Provide a needed argument to AT_MAKE_TAGID. 2005-01-23 22:33:59 +00:00
ispfw Roll firmware to the latest version. There are a bunch of features 2005-01-29 01:12:37 +00:00
ixgb Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
joy Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
kbd #include fcntl.h not vnode.h. Check O_NONBLOCK not IO_NDELAY. 2004-12-22 17:29:02 +00:00
led Better locking. 2005-01-29 16:33:51 +00:00
lge Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
lnc Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
mc146818 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
mca Use __FBSDID(). 2003-08-24 17:55:58 +00:00
mcd o Fix a typo. 2005-01-30 16:42:23 +00:00
md Use MAXMINOR 2005-01-29 16:50:04 +00:00
mem Fix module builds for i386 and amd64. 2004-08-04 18:30:31 +00:00
mii Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
mk48txx o Sync with the NetBSD mk48txx driver (the result simplyfies some changes 2004-11-17 12:54:12 +00:00
mlx Don't use PAGE_SIZE to calculate controller-specific attributes. 2004-11-25 12:15:49 +00:00
mly Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
mpt Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
mse Use the standard FreeBSD license 2005-01-11 06:24:40 +00:00
musycc Add -1 to this non-existent use of m_print in the source tree so LINT 2004-09-28 20:14:51 +00:00
my Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ncv takawata tells me that KXLC0003 also works with this driver, so add it 2005-02-03 23:39:29 +00:00
nge Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
nmdm If CDSR_OFLOW (stty dsrflow) is enabled on one or both sides of a 2005-01-26 23:42:18 +00:00
nsp Minor style nits 2005-02-04 02:32:43 +00:00
null Go back to the historical minor numbers. Add a module version while 2004-08-02 19:59:41 +00:00
ofw Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
owi MF dev/wi: merge the pccard lists. 2005-02-03 00:40:35 +00:00
patm Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
pbio Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
pccard Sort PANASONIC products numerically 2005-02-03 23:45:20 +00:00
pccbb Use the standard FreeBSD license for these files. 2005-01-13 19:05:25 +00:00
pcf - Introduce an ofw_bus kobj-interface for retrieving the OFW node and a 2004-08-12 17:41:33 +00:00
pci Enable interrupt routing as first choice on alpha. 2005-02-07 00:43:14 +00:00
pdq Prefer C99's __func__ over GCC's __FUNCTION__. 2004-09-22 17:16:04 +00:00
ppbus Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ppc Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
pst Use the correct type for iop_attach(). 2004-10-03 16:06:46 +00:00
puc Revert rev. 1.5. 2005-01-31 04:25:48 +00:00
random Check that we have at least a 586-class CPU before calling do_cpuid(). 2005-02-06 16:55:52 +00:00
ray Move the $NetBSD$ tag to the top of the file, per standard NetBSD 2005-02-06 21:15:19 +00:00
rc Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
re Bring in support for SUGOI LAN GIGA NIC made by System TALKS, Inc from 2005-01-22 22:40:53 +00:00
rndtest Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
rp Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
sab Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
safe Add missing <sys/module.h> includes 2004-05-30 20:08:47 +00:00
sbni Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
sbsh Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
scd Boot away another stackgap (one of the lest ones in linuxlator/i386) by 2005-01-30 08:12:37 +00:00
sf /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
si Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
sio When entering siocnputc() with (kdb_active), don't acquire (or 2005-02-03 10:35:05 +00:00
sk Cleanup debugging code and put it under bootverbose 2005-01-29 19:26:53 +00:00
smbus Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
sn Only attach to network functions. I'm not aware of any multifunction 2005-01-20 19:59:31 +00:00
snc Remove now-stale comment 2005-01-20 20:32:56 +00:00
snp Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
sound BUS_SPACE_UNRESTRICTED shouldn't be used with the bus_alloc_resource 2005-02-01 07:43:34 +00:00
speaker /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-06 22:18:23 +00:00
sr Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
stg Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
streams Use kern_open() directly rather than a stackgap detour via open(). 2005-02-07 18:22:20 +00:00
sx Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
sym Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
syscons Remove the last vestiges of the userconfig option. None of this actually 2004-12-01 04:59:33 +00:00
tdfx Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
tga Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
ti /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
trm Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
twa Changes corresponding to the 9.1.5.2 release of twa on the 3ware website. 2005-01-05 19:04:28 +00:00
twe Fix crashdumps on twe. The twe_immediate_request() path was not only 2005-02-08 03:43:02 +00:00
tx Since if_tx doesn't contain locking or run with INTR_MPSAFE, mark 2004-08-13 23:52:33 +00:00
txp Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
uart Add the keyboard system device before we probe for the keyboard. 2005-01-31 04:31:22 +00:00
ubsec Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
usb Fix problem with some logitec usb wireless mice. 2005-02-06 12:41:00 +00:00
utopia Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
vge Use if_link_state_change() instead of rt_ifmsg(). Remove include net/route.h. 2005-02-07 19:39:29 +00:00
vkbd Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
vr /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
vx Fix up assignment of negative number to char. Char's are unsigned by 2005-02-03 02:35:28 +00:00
watchdog Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
wds Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
wi The two PLANEX cards listed in pccarddevs, identified only by their 2005-02-01 18:28:09 +00:00
wl Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
xe u_intXX_t -> uintXX_t 2005-01-20 19:32:37 +00:00
zs Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00