Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Sep 2004 09:56:14 +0200
From:      Stijn Hoop <stijn@win.tue.nl>
To:        freebsd-hackers@freebsd.org
Subject:   ndis/if_ndis kernel configuration patch
Message-ID:  <20040901075614.GI65336@pcwin002.win.tue.nl>

next in thread | raw e-mail | index | archive | help

--rCb8EA+9TsBVtA92
Content-Type: multipart/mixed; boundary="AqCDj3hiknadvR6t"
Content-Disposition: inline


--AqCDj3hiknadvR6t
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi,

after I got frustrated by forgetting to manually make the if_ndis module af=
ter
an upgrade to -CURRENT, and subsequently having to fix /boot/loader.conf
again, I was motivated enough to try and think of a way to integrate
ndis/if_ndis into the build system.

Attached is my first try at this. Since most of the stuff has been copy &
pasted there's bound to be something wrong here, but I have verified that
having

NDIS_INF=3D/path/to/ndis.inf
NDIS_SYS=3D/path/to/ndis.sys

in /etc/make.conf makes the if_ndis module build, and I also compiled
a static kernel with

device		ndisapi
device		ndis
options		NDIS_INF
makeoptions	NDIS_INF=3D/path/to/ndis.inf
options		NDIS_SYS
makeoptions	NDIS_SYS=3D/path/to/ndis.sys

which booted & detected my Dell Truemobile 1300 card fine.

I did ran into 2 build errors when statically compiling ndisapi/ndis -- may=
be
the kernel build has stricter CFLAGS? Also attached is a patch to fix those
warnings.

Any comments most welcome.

--Stijn

--=20
I have great faith in fools -- self confidence my friends call it.
		-- Edgar Allan Poe

--AqCDj3hiknadvR6t
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="if_ndis.patch"
Content-Transfer-Encoding: quoted-printable

Index: conf/files.i386
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /freebsd/cvsroot/src/sys/conf/files.i386,v
retrieving revision 1.504
diff -u -u -r1.504 files.i386
--- conf/files.i386	16 Aug 2004 12:25:47 -0000	1.504
+++ conf/files.i386	1 Sep 2004 07:42:35 -0000
@@ -56,6 +56,11 @@
 	compile-with	"uudecode < $S/contrib/dev/ath/freebsd/i386-elf.hal.o.uu" \
 	no-implicit-rule
 #
+ndis_driver_data.h		optional	ndis ndis_inf ndis_sys	\
+	compile-with	"ndiscvt -i ${NDIS_INF} -s ${NDIS_SYS} > ${.TARGET}" \
+	no-obj no-implicit-rule before-depend				\
+	clean		"ndis_driver_data.h"
+#
 #
 compat/linux/linux_file.c	optional	compat_linux
 compat/linux/linux_getcwd.c	optional	compat_linux
Index: conf/options.i386
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /freebsd/cvsroot/src/sys/conf/options.i386,v
retrieving revision 1.215
diff -u -u -r1.215 options.i386
--- conf/options.i386	19 Aug 2004 20:58:23 -0000	1.215
+++ conf/options.i386	1 Sep 2004 07:49:30 -0000
@@ -162,3 +162,6 @@
 # Device options
 DEV_APIC		opt_apic.h
 DEV_NPX			opt_npx.h
+
+NDIS_INF		opt_dontuse.h
+NDIS_SYS		opt_dontuse.h
Index: i386/conf/NOTES
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /freebsd/cvsroot/src/sys/i386/conf/NOTES,v
retrieving revision 1.1172
diff -u -u -r1.1172 NOTES
--- i386/conf/NOTES	30 Aug 2004 23:03:57 -0000	1.1172
+++ i386/conf/NOTES	1 Sep 2004 07:47:24 -0000
@@ -511,6 +511,7 @@
 #       Intel EtherExpress
 # lnc:  Lance/PCnet cards (Isolan, Novell NE2100, NE32-VL, AMD Am7990 and
 #       Am79C960)
+# ndis: NDISulator, support for using Windows(R) drivers using a wrapper
 # oltr: Olicom ISA token-ring adapters OC-3115, OC-3117, OC-3118 and OC-31=
33.
 #       Olicom PCI token-ring adapters OC-3136, OC-3137, OC-3139, OC-3140,
 #       OC-3141, OC-3540 and OC-3250.
@@ -583,6 +584,13 @@
 device		ath_hal		# Atheros HAL (includes binary component)
 #device		wlan		# 802.11 layer
=20
+device		ndisapi		# NDISulator API wrapper
+#device		ndis		# NDIS driver wrapper interface
+#options	NDIS_INF
+#makeoptions	NDIS_INF=3Dbcmwl5.inf
+#options	NDIS_SYS
+#makeoptions	NDIS_SYS=3Dbcmwl5.sys
+
 #
 # ATA raid adapters
 #
Index: modules/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /freebsd/cvsroot/src/sys/modules/Makefile,v
retrieving revision 1.397
diff -u -u -r1.397 Makefile
--- modules/Makefile	30 Aug 2004 03:37:36 -0000	1.397
+++ modules/Makefile	1 Sep 2004 06:14:16 -0000
@@ -94,6 +94,7 @@
 	if_faith \
 	if_gif \
 	if_gre \
+	${_if_ndis} \
 	if_ppp \
 	if_sl \
 	if_stf \
@@ -301,6 +302,9 @@
 _i2c=3D		i2c
 _ibcs2=3D		ibcs2
 _ie=3D		ie
+.if defined(NDIS_INF) && defined(NDIS_SYS)
+_if_ndis=3D	if_ndis
+.endif
 _io=3D		io
 _linprocfs=3D	linprocfs
 _linux=3D		linux
Index: modules/if_ndis/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /freebsd/cvsroot/src/sys/modules/if_ndis/Makefile,v
retrieving revision 1.4
diff -u -u -r1.4 Makefile
--- modules/if_ndis/Makefile	26 May 2004 00:53:04 -0000	1.4
+++ modules/if_ndis/Makefile	1 Sep 2004 06:13:34 -0000
@@ -6,4 +6,11 @@
 SRCS=3D	if_ndis.c if_ndis_pci.c if_ndis_pccard.c
 SRCS+=3D	opt_bdg.h device_if.h bus_if.h pci_if.h card_if.h pccarddevs.h
=20
+.if defined(NDIS_INF) && defined(NDIS_SYS)
+SRCS+=3D	ndis_driver_data.h
+
+ndis_driver_data.h: ${NDIS_INF} ${NDIS_SYS}
+	ndiscvt -i ${NDIS_INF} -s ${NDIS_SYS} -o ${.OBJDIR}/ndis_driver_data.h
+.endif
+
 .include <bsd.kmod.mk>

--AqCDj3hiknadvR6t
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="ndis-casts.patch"
Content-Transfer-Encoding: quoted-printable

Index: compat/ndis/subr_ndis.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /freebsd/cvsroot/src/sys/compat/ndis/subr_ndis.c,v
retrieving revision 1.67
diff -u -u -r1.67 subr_ndis.c
--- compat/ndis/subr_ndis.c	16 Aug 2004 19:25:27 -0000	1.67
+++ compat/ndis/subr_ndis.c	1 Sep 2004 08:18:22 -0000
@@ -2875,7 +2875,7 @@
 	__stdcall ndis_proc	workfunc;
=20
 	work =3D ctx;
-	workfunc =3D work->nwi_func;
+	workfunc =3D (__stdcall ndis_proc)work->nwi_func;
 	workfunc(work, work->nwi_ctx);
 	return;
 }
Index: compat/ndis/subr_ntoskrnl.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /freebsd/cvsroot/src/sys/compat/ndis/subr_ntoskrnl.c,v
retrieving revision 1.43
diff -u -u -r1.43 subr_ntoskrnl.c
--- compat/ndis/subr_ntoskrnl.c	16 Aug 2004 18:52:37 -0000	1.43
+++ compat/ndis/subr_ntoskrnl.c	1 Sep 2004 08:18:41 -0000
@@ -1694,7 +1694,7 @@
 	uint8_t			irql;
=20
 	dpc =3D arg;
-	dpcfunc =3D (kdpc_func)dpc->k_deferedfunc;
+	dpcfunc =3D (__stdcall kdpc_func)dpc->k_deferedfunc;
 	irql =3D ntoskrnl_raise_irql(DISPATCH_LEVEL);
 	dpcfunc(dpc, dpc->k_deferredctx, dpc->k_sysarg1, dpc->k_sysarg2);
 	ntoskrnl_lower_irql(irql);

--AqCDj3hiknadvR6t--

--rCb8EA+9TsBVtA92
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQFBNYCdY3r/tLQmfWcRAqewAJ9ewqnJ4zoy3vYvOc2d6LiKzNqv/gCeOa41
Jf7B4J6r92BgBIUKCPpnCTc=
=huDO
-----END PGP SIGNATURE-----

--rCb8EA+9TsBVtA92--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040901075614.GI65336>