From owner-cvs-src@FreeBSD.ORG Thu Dec 11 14:34:48 2003 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D43A716A4CE; Thu, 11 Dec 2003 14:34:47 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 478F643E74; Thu, 11 Dec 2003 14:34:38 -0800 (PST) (envelope-from wpaul@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id hBBMYbXJ051608; Thu, 11 Dec 2003 14:34:38 -0800 (PST) (envelope-from wpaul@repoman.freebsd.org) Received: (from wpaul@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id hBBMYbvn051607; Thu, 11 Dec 2003 14:34:37 -0800 (PST) (envelope-from wpaul) Message-Id: <200312112234.hBBMYbvn051607@repoman.freebsd.org> From: Bill Paul Date: Thu, 11 Dec 2003 14:34:37 -0800 (PST) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/usr.sbin Makefile src/sys/modules Makefile src/sys/modules/if_ndis Makefile src/sys/modules/ndis Makefile src/sys/conf files.i386 src/sys/compat/ndis cfg_var.h hal_var.h kern_ndis.c ndis_var.h ntoskrnl_var.h pe_var.h resource_var.h ... X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2003 22:34:48 -0000 wpaul 2003/12/11 14:34:37 PST FreeBSD src repository Modified files: usr.sbin Makefile sys/modules Makefile sys/conf files.i386 share/man/man4/man4.i386 Makefile Added files: sys/modules/if_ndis Makefile sys/modules/ndis Makefile sys/compat/ndis cfg_var.h hal_var.h kern_ndis.c ndis_var.h ntoskrnl_var.h pe_var.h resource_var.h subr_hal.c subr_ndis.c subr_ntoskrnl.c subr_pe.c sys/dev/if_ndis if_ndis.c if_ndisvar.h share/man/man4/man4.i386 ndis.4 Log: Commit the first cut of Project Evil, also known as the NDISulator. Yes, it's what you think it is. Yes, you should run away now. This is a special compatibility module for allowing Windows NDIS miniport network drivers to be used with FreeBSD/x86. This provides _binary_ NDIS compatibility (not source): you can run NDIS driver code, but you can't build it. There are three main parts: sys/compat/ndis: the NDIS compat API, which provides binary compatibility functions for many routines in NDIS.SYS, HAL.dll and ntoskrnl.exe in Windows (these are the three modules that most NDIS miniport drivers use). The compat module also contains a small PE relocator/dynalinker which relocates the Windows .SYS image and then patches in our native routines. sys/dev/if_ndis: the if_ndis driver wrapper. This module makes use of the ndis compat API and can be compiled with a specially prepared binary image file (ndis_driver_data.h) containing the Windows .SYS image and registry key information parsed out of the accompanying .INF file. Once if_ndis.ko is built, it can be loaded and unloaded just like a native FreeBSD kenrel module. usr.sbin/ndiscvt: a special utility that converts foo.sys and foo.inf into an ndis_driver_data.h file that can be compiled into if_ndis.o. Contains an .inf file parser graciously provided by Matt Dodd (and mercilessly hacked upon by me) that strips out device ID info and registry key info from a .INF file and packages it up with a binary image array. The ndiscvt(8) utility also does some manipulation of the segments within the .sys file to make life easier for the kernel loader. (Doing the manipulation here saves the kernel code from having to move things around later, which would waste memory.) ndiscvt is only built for the i386 arch. Only files.i386 has been updated, and none of this is turned on in GENERIC. It should probably work on pc98. I have no idea about amd64 or ia64 at this point. This is still a work in progress. I estimate it's about %85 done, but I want it under CVS control so I can track subsequent changes. It has been tested with exactly three drivers: the LinkSys LNE100TX v4 driver (Lne100v4.sys), the sample Intel 82559 driver from the Windows DDK (e100bex.sys) and the Broadcom BCM43xx wireless driver (bcmwl5.sys). It still needs to have a net80211 stuff added to it. To use it, you would do something like this: # cd /sys/modules/ndis # make; make load # cd /sys/modules/if_ndis # ndiscvt -i /path/to/foo.inf -s /path/to/foo.sys -o ndis_driver_data.h # make; make load # sysctl -a | grep ndis All registry keys are mapped to sysctl nodes. Sometimes drivers refer to registry keys that aren't mentioned in foo.inf. If this happens, the NDIS API module creates sysctl nodes for these keys on the fly so you can tweak them. An example usage of the Broadcom wireless driver would be: # sysctl hw.ndis0.EnableAutoConnect=1 # sysctl hw.ndis0.SSID="MY_SSID" # sysctl hw.ndis0.NetworkType=0 (0 for bss, 1 for adhoc) # ifconfig ndis0 netmask 0xffffff00 up Things to be done: - get rid of debug messages - add in ndis80211 support - defer transmissions until after a status update with NDIS_STATUS_CONNECTED occurs - Create smarter lookaside list support - Split off if_ndis_pci.c and if_ndis_pccard.c attachments - Make sure PCMCIA support works - Fix ndiscvt to properly parse PCMCIA device IDs from INF files - write ndisapi.9 man page Revision Changes Path 1.153 +1 -1 src/share/man/man4/man4.i386/Makefile 1.1 +124 -0 src/share/man/man4/man4.i386/ndis.4 (new) 1.1 +46 -0 src/sys/compat/ndis/cfg_var.h (new) 1.1 +40 -0 src/sys/compat/ndis/hal_var.h (new) 1.1 +1049 -0 src/sys/compat/ndis/kern_ndis.c (new) 1.1 +1174 -0 src/sys/compat/ndis/ndis_var.h (new) 1.1 +105 -0 src/sys/compat/ndis/ntoskrnl_var.h (new) 1.1 +330 -0 src/sys/compat/ndis/pe_var.h (new) 1.1 +160 -0 src/sys/compat/ndis/resource_var.h (new) 1.1 +152 -0 src/sys/compat/ndis/subr_hal.c (new) 1.1 +1930 -0 src/sys/compat/ndis/subr_ndis.c (new) 1.1 +497 -0 src/sys/compat/ndis/subr_ntoskrnl.c (new) 1.1 +537 -0 src/sys/compat/ndis/subr_pe.c (new) 1.460 +6 -0 src/sys/conf/files.i386 1.1 +961 -0 src/sys/dev/if_ndis/if_ndis.c (new) 1.1 +121 -0 src/sys/dev/if_ndis/if_ndisvar.h (new) 1.359 +2 -0 src/sys/modules/Makefile 1.1 +9 -0 src/sys/modules/if_ndis/Makefile (new) 1.1 +9 -0 src/sys/modules/ndis/Makefile (new) 1.282 +1 -0 src/usr.sbin/Makefile