1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00
freebsd/usr.sbin
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
..
ac Sort sections. 2005-01-18 20:02:45 +00:00
accton
acpi Sort sections. 2005-01-18 20:02:45 +00:00
adduser In fullpath_from_shell(), move the nologin detection before the cat | while 2004-09-23 13:09:42 +00:00
amd Add knob NO_NIS (fka NO_YP_LIBC) and make world compileable when set. 2004-11-13 20:40:32 +00:00
ancontrol Sort sections. 2005-01-18 20:02:45 +00:00
apm Sort sections. 2005-01-18 20:02:45 +00:00
apmd Fixed formatting in the AUTHORS section. 2005-01-18 20:04:14 +00:00
arlcontrol Remove unnecessary SRCS= where could be guessed directly by our 2005-01-27 14:52:47 +00:00
arp o Reorganize the previous delta to make it more style(9) compliant. 2005-01-24 17:01:48 +00:00
asf Sort sections. 2005-01-18 20:02:45 +00:00
atm Sort sections. 2005-01-18 20:02:45 +00:00
authpf
bluetooth Let bsd.prog.mk set SRCS and MAN to their default values. 2005-01-28 16:08:11 +00:00
boot0cfg Sort sections. 2005-01-18 20:02:45 +00:00
boot98cfg Sort sections. 2005-01-18 20:02:45 +00:00
bootparamd Sort sections. 2005-01-18 20:02:45 +00:00
bsnmpd Let bsd.prog.mk set SRCS and MAN to their default values. 2005-01-28 16:08:11 +00:00
btxld Sort sections. 2005-01-18 20:02:45 +00:00
burncd Sort sections. 2005-01-18 20:02:45 +00:00
cdcontrol Sort sections. 2005-01-18 20:02:45 +00:00
chkgrp Sort sections. 2005-01-18 20:02:45 +00:00
chown Sort sections. 2005-01-18 20:02:45 +00:00
chroot
ckdist Sort sections. 2005-01-18 20:02:45 +00:00
config Sort sections. 2005-01-18 20:02:45 +00:00
cron Sort sections. 2005-01-18 20:02:45 +00:00
crunch In crunchgen(1), when calling make(1), don't redirect stderr to stdout, 2005-01-20 10:49:03 +00:00
ctm Let bsd.prog.mk set SRCS and MAN to their default values. 2005-01-28 16:08:11 +00:00
daemon Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
dconschat Remove unnecessary SRCS= where could be guessed directly by our 2005-01-27 14:52:47 +00:00
devinfo
digictl Sort sections. 2005-01-18 20:02:45 +00:00
diskinfo Sort sections. 2005-01-18 20:02:45 +00:00
dnssec-keygen Don't expose BIND libraries and their headers to the public by default, 2004-09-24 13:42:00 +00:00
dnssec-signzone Don't expose BIND libraries and their headers to the public by default, 2004-09-24 13:42:00 +00:00
editmap
edquota Sort sections. 2005-01-18 20:02:45 +00:00
eeprom Scheduled mdoc(7) sweep. 2005-01-11 11:47:22 +00:00
elf2exe Sort sections. 2005-01-18 20:02:45 +00:00
extattr
extattrctl
faithd Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
fdcontrol Cleanup usr.sbin/fd* so they can compile under WARNS=6. 2005-01-08 15:46:06 +00:00
fdformat One of the DIAGNOSTICS sections should be EXIT STATUS. 2005-01-18 09:17:49 +00:00
fdread Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
fdwrite Cleanup usr.sbin/fd* so they can compile under WARNS=6. 2005-01-08 15:46:06 +00:00
flowctl Remove code, inherited from ipacctctl, which sets socket to non-blocking 2005-02-06 14:00:57 +00:00
fwcontrol Sort sections. 2005-01-18 20:02:45 +00:00
getfmac Remove unnecessary SRCS= where could be guessed directly by our 2005-01-27 14:52:47 +00:00
getpmac Remove unnecessary SRCS= where could be guessed directly by our 2005-01-27 14:52:47 +00:00
gstat Remove unnecessary SRCS= where could be guessed directly by our 2005-01-27 14:52:47 +00:00
i4b Fixed xrefs. 2005-01-21 10:35:40 +00:00
ifmcstat Remove unused variable and clamp down with WARNS=2 2004-09-13 08:14:55 +00:00
inetd Prefer C99's __func__ over GCC's __FUNCTION__. 2004-09-26 13:47:25 +00:00
iostat Sort sections. 2005-01-18 20:02:45 +00:00
ip6addrctl Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
ipftest
ipresend
ipsend
iptest
IPXrouted
jail Fixed punctuation in xrefs. 2005-01-21 20:48:00 +00:00
jexec
jls
kbdcontrol Sort sections. 2005-01-18 20:02:45 +00:00
kbdmap Let bsd.prog.mk set SRCS and MAN to their default values. 2005-01-28 16:08:11 +00:00
kernbb
keyserv
kgmon Sort sections. 2005-01-18 20:02:45 +00:00
kgzip Sort sections. 2005-01-18 20:02:45 +00:00
kldxref Explicitly pass in the relocation base and data offset into ef_reloc() 2004-08-28 19:31:10 +00:00
lastlogin
lpr Fixed .Xr call. 2005-01-21 09:07:47 +00:00
lptcontrol Remove useless mode argument to open(). 2005-01-25 14:25:18 +00:00
mailstats
mailwrapper Replaced afterinstall: with FILES. 2004-10-18 17:20:29 +00:00
makemap
manctl
memcontrol WARNS=6 cleanup. This includes: 2005-01-07 12:06:30 +00:00
mergemaster Sort sections. 2005-01-18 20:02:45 +00:00
mixer
mld6query
mlxcontrol Sort sections. 2005-01-18 20:02:45 +00:00
mount_nwfs Sort sections. 2005-01-18 20:02:45 +00:00
mount_portalfs
mount_smbfs NOSHARED -> NO_SHARED 2004-12-21 09:59:45 +00:00
mountd Sort sections. 2005-01-18 20:02:45 +00:00
moused Sort sections. 2005-01-18 20:02:45 +00:00
mptable Remove the useless "version" number output. 2005-02-06 12:54:54 +00:00
mrouted Let bsd.prog.mk set SRCS and MAN to their default values. 2005-01-28 16:08:11 +00:00
mtest
mtree Sort sections. 2005-01-18 20:02:45 +00:00
named Previously I thought I was seeing a failure to install the .5 man pages 2004-09-27 03:55:03 +00:00
named-checkconf Fix up the man file installation for the new BIND 9 sources: 2004-09-26 06:36:11 +00:00
named-checkzone Don't expose BIND libraries and their headers to the public by default, 2004-09-24 13:42:00 +00:00
named.reload Switch from BIND 8 to BIND 9. 2004-09-21 19:01:48 +00:00
ndiscvt Next step on the road to IRPs: create and use an imitation of the 2005-02-08 17:23:25 +00:00
ndp Fixed xref. 2005-01-21 10:48:35 +00:00
newsyslog Fixed xrefs. 2005-01-21 10:35:40 +00:00
nfsd Bump the default maximum on nfsd processes from 20 to 256. Real-world 2005-01-23 21:34:00 +00:00
ngctl Backout rev. 1.17 per ru@ request: there are net.graph.recvspace and 2005-02-04 20:09:11 +00:00
nghook Sort sections. 2005-01-18 20:02:45 +00:00
nologin Use __unused macro instead of a bare void for main(). 2005-01-04 20:07:12 +00:00
ntp Let bsd.prog.mk set SRCS and MAN to their default values. 2005-01-28 16:08:11 +00:00
ofwdump
pccard Sort sections. 2005-01-18 20:02:45 +00:00
pciconf
pcvt Utilize bsd.files.mk. 2005-01-28 16:22:46 +00:00
periodic Sort sections. 2005-01-18 20:02:45 +00:00
pkg_install Sort sections. 2005-01-18 20:02:45 +00:00
pnpinfo Remove unnecessary SRCS= where could be guessed directly by our 2005-01-27 14:52:47 +00:00
ppp Use the correct length when copying trailing data!! 2005-02-08 10:38:24 +00:00
pppctl Sort sections. 2005-01-18 20:02:45 +00:00
pppd NOCRYPT -> NO_CRYPT 2004-12-21 10:16:04 +00:00
pppstats
praliases
procctl
pstat Sort sections. 2005-01-18 20:02:45 +00:00
pw Sort sections. 2005-01-18 20:02:45 +00:00
pwd_mkdb Sort sections. 2005-01-18 20:02:45 +00:00
quot Sort sections. 2005-01-18 20:02:45 +00:00
quotaon
rarpd
raycontrol
repquota Sort sections. 2005-01-18 20:02:45 +00:00
rip6query
rmt Sort sections. 2005-01-18 20:02:45 +00:00
rndc Previously I thought I was seeing a failure to install the .5 man pages 2004-09-27 03:55:03 +00:00
rndc-confgen Fix up the man file installation for the new BIND 9 sources: 2004-09-26 06:36:11 +00:00
route6d
rpc.lockd - Use svc_getrpccaller() rather than svc_getcaller() for using 2005-02-03 22:21:19 +00:00
rpc.statd Sort sections. 2005-01-18 20:02:45 +00:00
rpc.umntall Sort sections. 2005-01-18 20:02:45 +00:00
rpc.yppasswdd Sort sections. 2005-01-18 20:02:45 +00:00
rpc.ypupdated Start the dreaded NOFOO -> NO_FOO conversion. 2004-12-21 08:47:35 +00:00
rpc.ypxfrd Sort sections. 2005-01-18 20:02:45 +00:00
rpcbind Sort sections. 2005-01-18 20:02:45 +00:00
rrenumd Prefer C99's __func__ over GCC's __FUNCTION__. 2004-10-02 16:42:33 +00:00
rtadvd removed compilation warning 2004-10-22 07:31:12 +00:00
rtprio Sort sections. 2005-01-18 20:02:45 +00:00
rtsold
rwhod Sort sections. 2005-01-18 20:02:45 +00:00
sa Sort sections. 2005-01-18 20:02:45 +00:00
sade Remove /stand when we are done with it. 2005-02-07 04:25:34 +00:00
sendmail NOINET6 -> NO_INET6 2004-12-21 10:49:29 +00:00
setfmac Remove unnecessary SRCS= where could be guessed directly by our 2005-01-27 14:52:47 +00:00
setkey Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
setpmac Remove unnecessary SRCS= where could be guessed directly by our 2005-01-27 14:52:47 +00:00
sicontrol Get debugging macros from sivar.h 2004-10-02 18:51:37 +00:00
sliplogin Sort sections. 2005-01-18 20:02:45 +00:00
slstat
smbmsg Sort sections. 2005-01-18 20:02:45 +00:00
spkrtest
spray
sysinstall Remove /stand when we are done with it. 2005-02-07 04:25:34 +00:00
syslogd Sort sections. 2005-01-18 20:02:45 +00:00
tcpdchk NOINET6 -> NO_INET6 2004-12-21 10:49:29 +00:00
tcpdmatch NOINET6 -> NO_INET6 2004-12-21 10:49:29 +00:00
tcpdrop o Implement net.inet.tcp.drop sysctl and userland part, tcpdrop(8) 2005-02-06 10:47:12 +00:00
tcpdump NOINET6 -> NO_INET6 2004-12-21 10:49:29 +00:00
timed Sort sections. 2005-01-18 20:02:45 +00:00
traceroute NOIPSEC -> TRACEROUTE_NO_IPSEC 2004-12-21 12:44:20 +00:00
traceroute6
trpt Sort sections. 2005-01-18 20:02:45 +00:00
tzsetup Sort sections. 2005-01-18 20:02:45 +00:00
ugidfw Add prototypes and remove unused variables for WARNS=6 compliance. Add 2005-01-16 10:49:48 +00:00
usbd Sort sections. 2005-01-18 20:02:45 +00:00
usbdevs
vidcontrol WANRS=6 cleanup for vidcontrol(1): 2005-01-13 03:59:44 +00:00
vipw
vnconfig Start the dreaded NOFOO -> NO_FOO conversion. 2004-12-21 08:47:35 +00:00
watch Sort sections. 2005-01-18 20:02:45 +00:00
watchdogd Sort sections. 2005-01-18 20:02:45 +00:00
wicontrol Sort sections. 2005-01-18 20:02:45 +00:00
wlconfig
yp_mkdb
ypbind Remove definition of struct dom_binding, it's non-standard C code and 2004-10-17 19:33:33 +00:00
yppoll
yppush Sort sections. 2005-01-18 20:02:45 +00:00
ypserv Sort sections. 2005-01-18 20:02:45 +00:00
ypset Remove definition of struct dom_binding, it's non-standard C code and 2004-10-17 19:33:33 +00:00
zic Eliminate macro calls inside literal displays. 2005-01-15 12:28:01 +00:00
zzz
Makefile o Implement net.inet.tcp.drop sysctl and userland part, tcpdrop(8) 2005-02-06 10:47:12 +00:00
Makefile.inc