PERFORCE change 49428 for review

Robert Watson rwatson at FreeBSD.org
Sat Mar 20 20:18:47 PST 2004


http://perforce.freebsd.org/chv.cgi?CH=49428

Change 49428 by rwatson at rwatson_paprika on 2004/03/20 20:18:38

	Integrate:
	
	- Add cpu_mask_t.
	- rtld magic to improve 32-bit emulation on 64-bit platforms.
	- NDIS timer rewrite and other extensive NDIS evil.
	- uart driver speaks hints.
	- USB attach/detach event improvements.
	- Loop back at_control, ddp_output, ddp_pcb "(struct foo *)0"->"NULL".
	- if_xl checksum in hardware disabled by default for XL905B.
	- Add uiomove_fromphys().

Affected files ...

.. //depot/projects/netperf_socket/sys/alpha/alpha/uio_machdep.c#1 branch
.. //depot/projects/netperf_socket/sys/alpha/include/_types.h#2 integrate
.. //depot/projects/netperf_socket/sys/amd64/amd64/uio_machdep.c#1 branch
.. //depot/projects/netperf_socket/sys/amd64/include/_types.h#2 integrate
.. //depot/projects/netperf_socket/sys/arm/include/_types.h#2 integrate
.. //depot/projects/netperf_socket/sys/compat/ia32/ia32_sysvec.c#3 integrate
.. //depot/projects/netperf_socket/sys/compat/ndis/kern_ndis.c#6 integrate
.. //depot/projects/netperf_socket/sys/compat/ndis/ndis_var.h#3 integrate
.. //depot/projects/netperf_socket/sys/compat/ndis/ntoskrnl_var.h#4 integrate
.. //depot/projects/netperf_socket/sys/compat/ndis/subr_ndis.c#5 integrate
.. //depot/projects/netperf_socket/sys/compat/ndis/subr_ntoskrnl.c#7 integrate
.. //depot/projects/netperf_socket/sys/conf/files#11 integrate
.. //depot/projects/netperf_socket/sys/conf/files.alpha#2 integrate
.. //depot/projects/netperf_socket/sys/conf/files.amd64#4 integrate
.. //depot/projects/netperf_socket/sys/conf/files.ia64#2 integrate
.. //depot/projects/netperf_socket/sys/conf/kern.post.mk#3 integrate
.. //depot/projects/netperf_socket/sys/conf/kern.pre.mk#6 integrate
.. //depot/projects/netperf_socket/sys/dev/aac/aac_pci.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/acpica/acpi_pcib.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/ath/if_ath.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/awi/awi.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/gem/if_gem.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/hme/if_hme.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/if_ndis/if_ndis.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/iir/iir.h#4 integrate
.. //depot/projects/netperf_socket/sys/dev/ips/ips.h#3 integrate
.. //depot/projects/netperf_socket/sys/dev/ips/ips_pci.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/md/md.c#9 integrate
.. //depot/projects/netperf_socket/sys/dev/sound/pci/vibes.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/uart/uart_cpu.h#2 integrate
.. //depot/projects/netperf_socket/sys/dev/uart/uart_cpu_alpha.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/uart/uart_cpu_amd64.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/uart/uart_cpu_i386.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/uart/uart_cpu_ia64.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/uart/uart_cpu_pc98.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/uart/uart_cpu_sparc64.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/uart/uart_subr.c#1 branch
.. //depot/projects/netperf_socket/sys/dev/usb/usb_subr.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/vinum/vinumobj.h#2 integrate
.. //depot/projects/netperf_socket/sys/dev/vinum/vinumrequest.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/vinum/vinumvar.h#3 integrate
.. //depot/projects/netperf_socket/sys/dev/wi/if_wi.c#3 integrate
.. //depot/projects/netperf_socket/sys/i386/include/_types.h#3 integrate
.. //depot/projects/netperf_socket/sys/ia64/conf/GENERIC.hints#2 integrate
.. //depot/projects/netperf_socket/sys/ia64/ia64/uio_machdep.c#1 branch
.. //depot/projects/netperf_socket/sys/ia64/include/_types.h#2 integrate
.. //depot/projects/netperf_socket/sys/ia64/include/cpufunc.h#2 integrate
.. //depot/projects/netperf_socket/sys/ia64/include/reg.h#2 integrate
.. //depot/projects/netperf_socket/sys/modules/uart/Makefile#2 integrate
.. //depot/projects/netperf_socket/sys/netatalk/at_control.c#2 integrate
.. //depot/projects/netperf_socket/sys/netatalk/ddp_input.c#2 integrate
.. //depot/projects/netperf_socket/sys/netatalk/ddp_output.c#2 integrate
.. //depot/projects/netperf_socket/sys/netatalk/ddp_pcb.c#2 integrate
.. //depot/projects/netperf_socket/sys/pci/if_xl.c#5 integrate
.. //depot/projects/netperf_socket/sys/powerpc/include/_types.h#2 integrate
.. //depot/projects/netperf_socket/sys/sparc64/include/_types.h#3 integrate
.. //depot/projects/netperf_socket/sys/sys/tree.h#2 integrate
.. //depot/projects/netperf_socket/sys/sys/types.h#2 integrate
.. //depot/projects/netperf_socket/sys/sys/uio.h#3 integrate

Differences ...

==== //depot/projects/netperf_socket/sys/alpha/include/_types.h#2 (text+ko) ====

@@ -33,7 +33,7 @@
  *
  *	From: @(#)ansi.h	8.2 (Berkeley) 1/4/94
  *	From: @(#)types.h	8.3 (Berkeley) 1/5/94
- * $FreeBSD: src/sys/alpha/include/_types.h,v 1.4 2003/03/25 00:07:00 jake Exp $
+ * $FreeBSD: src/sys/alpha/include/_types.h,v 1.5 2004/03/20 20:41:39 marcel Exp $
  */
 
 #ifndef _MACHINE__TYPES_H_
@@ -55,6 +55,7 @@
  * Standard type definitions.
  */
 typedef	__int32_t	__clock_t;		/* clock()... */
+typedef	unsigned int	__cpumask_t;
 typedef	__int64_t	__critical_t;
 typedef	double		__double_t;
 typedef	float		__float_t;

==== //depot/projects/netperf_socket/sys/amd64/include/_types.h#2 (text+ko) ====

@@ -33,7 +33,7 @@
  *
  *	From: @(#)ansi.h	8.2 (Berkeley) 1/4/94
  *	From: @(#)types.h	8.3 (Berkeley) 1/5/94
- * $FreeBSD: src/sys/amd64/include/_types.h,v 1.5 2003/05/10 00:55:15 peter Exp $
+ * $FreeBSD: src/sys/amd64/include/_types.h,v 1.6 2004/03/20 20:41:39 marcel Exp $
  */
 
 #ifndef _MACHINE__TYPES_H_
@@ -55,6 +55,7 @@
  * Standard type definitions.
  */
 typedef	__int32_t	__clock_t;		/* clock()... */
+typedef	unsigned int	__cpumask_t;
 typedef	__int64_t	__critical_t;
 typedef	double		__double_t;
 typedef	double		__float_t;

==== //depot/projects/netperf_socket/sys/arm/include/_types.h#2 (text+ko) ====

@@ -33,7 +33,7 @@
  *
  *	From: @(#)ansi.h	8.2 (Berkeley) 1/4/94
  *	From: @(#)types.h	8.3 (Berkeley) 1/5/94
- * $FreeBSD: src/sys/arm/include/_types.h,v 1.3 2003/03/25 00:07:00 jake Exp $
+ * $FreeBSD: src/sys/arm/include/_types.h,v 1.4 2004/03/20 20:41:39 marcel Exp $
  */
 
 #ifndef _MACHINE__TYPES_H_
@@ -63,6 +63,7 @@
  * Standard type definitions.
  */
 typedef	__uint32_t	__clock_t;		/* clock()... */
+typedef	unsigned int	__cpumask_t;
 typedef	__int32_t	__critical_t;
 typedef	__int32_t	__intfptr_t;
 typedef	__int64_t	__intmax_t;

==== //depot/projects/netperf_socket/sys/compat/ia32/ia32_sysvec.c#3 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/ia32/ia32_sysvec.c,v 1.16 2004/02/04 21:52:52 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/ia32/ia32_sysvec.c,v 1.17 2004/03/21 01:22:24 peter Exp $");
 
 #include "opt_compat.h"
 
@@ -136,7 +136,7 @@
 						NULL,
 						"/libexec/ld-elf.so.1",
 						&ia32_freebsd_sysvec,
-						"/libexec/ld-elf-32.so.1",
+						"/libexec/ld-elf32.so.1",
 					  };
 
 SYSINIT(ia32, SI_SUB_EXEC, SI_ORDER_ANY,
@@ -150,7 +150,7 @@
 						NULL,
 						"/usr/libexec/ld-elf.so.1",
 						&ia32_freebsd_sysvec,
-						"/usr/libexec/ld-elf-32.so.1",
+						"/usr/libexec/ld-elf32.so.1",
 					  };
 
 SYSINIT(oia32, SI_SUB_EXEC, SI_ORDER_ANY,

==== //depot/projects/netperf_socket/sys/compat/ndis/kern_ndis.c#6 (text+ko) ====

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.42 2004/03/11 09:50:00 wpaul Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.43 2004/03/20 23:39:43 wpaul Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1152,7 +1152,6 @@
 	ndis_handle		adapter;
 	__stdcall ndis_halt_handler	haltfunc;
 	struct ifnet		*ifp;
-	struct ndis_timer_entry	*ne;
 
 	sc = arg;
 	ifp = &sc->arpcom.ac_if;
@@ -1178,14 +1177,6 @@
 	NDIS_LOCK(sc);
 	sc->ndis_block.nmb_miniportadapterctx = NULL;
 	NDIS_UNLOCK(sc);
-	/* Clobber all the timers in case the driver left one running. */
-
-	while (!TAILQ_EMPTY(&sc->ndis_block.nmb_timerlist)) {
-		ne = TAILQ_FIRST(&sc->ndis_block.nmb_timerlist);
-		TAILQ_REMOVE(&sc->ndis_block.nmb_timerlist, ne, link);
-		callout_stop(&ne->nte_ch);
-		free(ne, M_DEVBUF);
-	}
 
 	return(0);
 }

==== //depot/projects/netperf_socket/sys/compat/ndis/ndis_var.h#3 (text+ko) ====

@@ -29,7 +29,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/compat/ndis/ndis_var.h,v 1.21 2004/02/14 20:57:32 wpaul Exp $
+ * $FreeBSD: src/sys/compat/ndis/ndis_var.h,v 1.22 2004/03/20 23:39:43 wpaul Exp $
  */
 
 #ifndef _NDIS_VAR_H_
@@ -835,7 +835,7 @@
 };
 
 struct ndis_event {
-	struct ndis_kevent	ne_event;
+	struct nt_kevent	ne_event;
 };
 
 typedef struct ndis_event ndis_event;
@@ -858,8 +858,8 @@
 };
 
 struct ndis_timer {
-	struct ndis_ktimer	nt_timer;
-	struct ndis_kdpc	nt_dpc;
+	struct ktimer		nt_ktimer;
+	struct kdpc		nt_kdpc;
 };
 
 typedef struct ndis_timer ndis_timer;
@@ -867,10 +867,11 @@
 typedef void (*ndis_timer_function)(void *, void *, void *, void *);
 
 struct ndis_miniport_timer {
-	struct ndis_ktimer	nmt_ktimer;
-	struct ndis_kdpc	nmt_dpc;
+	struct ktimer		nmt_ktimer;
+	struct kdpc		nmt_kdpc;
 	ndis_timer_function	nmt_timerfunc;
 	void			*nmt_timerctx;
+	ndis_miniport_block	*nmt_block;
 	struct ndis_miniport_timer	*nmt_nexttimer;
 };
 

==== //depot/projects/netperf_socket/sys/compat/ndis/ntoskrnl_var.h#4 (text+ko) ====

@@ -29,7 +29,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/compat/ndis/ntoskrnl_var.h,v 1.9 2004/03/04 23:04:02 wpaul Exp $
+ * $FreeBSD: src/sys/compat/ndis/ntoskrnl_var.h,v 1.10 2004/03/20 23:39:43 wpaul Exp $
  */
 
 #ifndef _NTOSKRNL_VAR_H_
@@ -472,7 +472,21 @@
 __BEGIN_DECLS
 extern int ntoskrnl_libinit(void);
 extern int ntoskrnl_libfini(void);
-extern void ntoskrnl_wakeup(void *);
+__stdcall extern void ntoskrnl_init_dpc(kdpc *, void *, void *);
+__stdcall extern void ntoskrnl_init_timer(ktimer *);
+__stdcall extern void ntoskrnl_init_timer_ex(ktimer *, uint32_t);
+__stdcall extern uint8_t ntoskrnl_set_timer(ktimer *, int64_t, kdpc *);  
+__stdcall extern uint8_t ntoskrnl_set_timer_ex(ktimer *, int64_t,
+	uint32_t, kdpc *);
+__stdcall extern uint8_t ntoskrnl_cancel_timer(ktimer *);
+__stdcall extern uint8_t ntoskrnl_read_timer(ktimer *);
+__stdcall uint32_t ntoskrnl_waitforobj(nt_dispatch_header *, uint32_t,
+	uint32_t, uint8_t, int64_t *);
+__stdcall void ntoskrnl_init_event(nt_kevent *, uint32_t, uint8_t);
+__stdcall void ntoskrnl_clear_event(nt_kevent *);
+__stdcall uint32_t ntoskrnl_read_event(nt_kevent *);
+__stdcall uint32_t ntoskrnl_set_event(nt_kevent *, uint32_t, uint8_t);
+__stdcall uint32_t ntoskrnl_reset_event(nt_kevent *);
 __END_DECLS
 
 #endif /* _NTOSKRNL_VAR_H_ */

==== //depot/projects/netperf_socket/sys/compat/ndis/subr_ndis.c#5 (text+ko) ====

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ndis.c,v 1.51 2004/03/11 09:40:00 wpaul Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ndis.c,v 1.52 2004/03/20 23:39:43 wpaul Exp $");
 
 /*
  * This file implements a translation layer between the BSD networking
@@ -148,15 +148,13 @@
 __stdcall static void ndis_vtophys_load(ndis_handle, ndis_buffer *,
 	uint32_t, uint8_t, ndis_paddr_unit *, uint32_t *);
 __stdcall static void ndis_vtophys_unload(ndis_handle, ndis_buffer *, uint32_t);
-__stdcall static void ndis_create_timer(ndis_miniport_timer *, ndis_handle *,
+__stdcall static void ndis_create_timer(ndis_miniport_timer *, ndis_handle,
 	ndis_timer_function, void *);
 __stdcall static void ndis_init_timer(ndis_timer *,
 	ndis_timer_function, void *);
-static void ndis_timercall(void *);
-__stdcall static void ndis_set_timer(ndis_miniport_timer *, uint32_t);
-static void ndis_tick(void *);
+__stdcall static void ndis_set_timer(ndis_timer *, uint32_t);
 __stdcall static void ndis_set_periodic_timer(ndis_miniport_timer *, uint32_t);
-__stdcall static void ndis_cancel_timer(ndis_miniport_timer *, uint8_t *);
+__stdcall static void ndis_cancel_timer(ndis_timer *, uint8_t *);
 __stdcall static void ndis_query_resources(ndis_status *, ndis_handle,
 	ndis_resource_list *, uint32_t *);
 __stdcall static ndis_status ndis_register_ioport(void **,
@@ -521,6 +519,7 @@
 {
 	uint16_t		*unicode;
 	ndis_unicode_string	*ustr;
+	int			base = 0;
 
 	unicode = (uint16_t *)&block->nmb_dummybuf;
 
@@ -533,14 +532,22 @@
 		ustr->nus_buf = unicode;
 		break;
 	case ndis_parm_int:
+		if (strncmp((char *)oid->oid_arg1, "0x", 2) == 0)
+			base = 16;
+		else
+			base = 10;
 		(*parm)->ncp_type = ndis_parm_int;
 		(*parm)->ncp_parmdata.ncp_intdata =
-		    strtol((char *)oid->oid_arg1, NULL, 10);
+		    strtol((char *)oid->oid_arg1, NULL, base);
 		break;
 	case ndis_parm_hexint:
+		if (strncmp((char *)oid->oid_arg1, "0x", 2) == 0)
+			base = 16;
+		else
+			base = 10;
 		(*parm)->ncp_type = ndis_parm_hexint;
 		(*parm)->ncp_parmdata.ncp_intdata =
-		    strtoul((char *)oid->oid_arg1, NULL, 16);
+		    strtoul((char *)oid->oid_arg1, NULL, base);
 		break;
 	default:
 		return(NDIS_STATUS_FAILURE);
@@ -936,166 +943,74 @@
 	ndis_timer_function	func;
 	void			*ctx;
 {
-	struct ndis_timer_entry	*ne = NULL;
-	ndis_miniport_block	*block = NULL;
+	ntoskrnl_init_timer(&timer->nt_ktimer);
+	ntoskrnl_init_dpc(&timer->nt_kdpc, func, ctx);
 
-	TAILQ_FOREACH(block, &ndis_devhead, link) {
-		if (block->nmb_miniportadapterctx == ctx)
-			break;
-	}
-
-	if (block->nmb_miniportadapterctx != ctx)
-		panic("NDIS driver timer context didn't "
-		    "match any adapter contexts");
-
-	ne = malloc(sizeof(struct ndis_timer_entry), M_DEVBUF, M_NOWAIT);
-	callout_init(&ne->nte_ch, CALLOUT_MPSAFE);
-	TAILQ_INSERT_TAIL(&block->nmb_timerlist, ne, link);
-	ne->nte_timer = (ndis_miniport_timer *)timer;
-
-	INIT_LIST_HEAD((&timer->nt_timer.nk_header.dh_waitlisthead));
-	timer->nt_timer.nk_header.dh_sigstate = FALSE;
-	timer->nt_timer.nk_header.dh_type = EVENT_TYPE_NOTIFY;
-	timer->nt_timer.nk_header.dh_size = OTYPE_TIMER;
-	timer->nt_dpc.nk_sysarg1 = &ne->nte_ch;
-	timer->nt_dpc.nk_deferedfunc = (ndis_kdpc_func)func;
-	timer->nt_dpc.nk_deferredctx = ctx;
-
 	return;
 }
 
 __stdcall static void
 ndis_create_timer(timer, handle, func, ctx)
 	ndis_miniport_timer	*timer;
-	ndis_handle		*handle;
+	ndis_handle		handle;
 	ndis_timer_function	func;
 	void			*ctx;
 {
-	struct ndis_timer_entry	*ne = NULL;
-	ndis_miniport_block	*block;
-	block = (ndis_miniport_block *)handle;
+	/* Save the funcptr and context */
 
-	ne = malloc(sizeof(struct ndis_timer_entry), M_DEVBUF, M_NOWAIT);
-	callout_init(&ne->nte_ch, CALLOUT_MPSAFE);
-	TAILQ_INSERT_TAIL(&block->nmb_timerlist, ne, link);
-	ne->nte_timer = timer;
+	timer->nmt_timerfunc = func;
+	timer->nmt_timerctx = ctx;
+	timer->nmt_block = handle;
 
-	INIT_LIST_HEAD((&timer->nmt_ktimer.nk_header.dh_waitlisthead));
-	timer->nmt_ktimer.nk_header.dh_sigstate = FALSE;
-	timer->nmt_ktimer.nk_header.dh_type = EVENT_TYPE_NOTIFY;
-	timer->nmt_ktimer.nk_header.dh_size = OTYPE_TIMER;
-	timer->nmt_dpc.nk_sysarg1 = &ne->nte_ch;
-	timer->nmt_dpc.nk_deferedfunc = (ndis_kdpc_func)func;
-	timer->nmt_dpc.nk_deferredctx = ctx;
+	ntoskrnl_init_timer(&timer->nmt_ktimer);
+	ntoskrnl_init_dpc(&timer->nmt_kdpc, func, ctx);
 
 	return;
 }
 
 /*
- * The driver's timer callout is __stdcall function, so we need this
- * intermediate step.
- */
-
-static void
-ndis_timercall(arg)
-	void		*arg;
-{
-	ndis_miniport_timer	*timer;
-	__stdcall ndis_timer_function	timerfunc;
-
-	timer = arg;
-
-	timerfunc = (ndis_timer_function)timer->nmt_dpc.nk_deferedfunc;
-	timerfunc(NULL, timer->nmt_dpc.nk_deferredctx, NULL, NULL);
-	ntoskrnl_wakeup(&timer->nmt_ktimer.nk_header);
-
-	return;
-}
-
-/*
- * Windows specifies timeouts in milliseconds. We specify timeouts
- * in hz, so some conversion is required.
+ * In Windows, there's both an NdisMSetTimer() and an NdisSetTimer(),
+ * but the former is just a macro wrapper around the latter.
  */
 __stdcall static void
 ndis_set_timer(timer, msecs)
-	ndis_miniport_timer	*timer;
+	ndis_timer		*timer;
 	uint32_t		msecs;
 {
-	struct callout		*ch;
-	struct timeval		tv;
-
-	tv.tv_sec = 0;
-	tv.tv_usec = msecs * 1000;
-
-	ch = timer->nmt_dpc.nk_sysarg1;
-	timer->nmt_dpc.nk_sysarg2 = ndis_timercall;
-	timer->nmt_ktimer.nk_header.dh_sigstate = FALSE;
-	callout_reset(ch, tvtohz(&tv), timer->nmt_dpc.nk_sysarg2, timer);
+	/*
+	 * KeSetTimer() wants the period in
+	 * hundred nanosecond intervals.
+	 */
+	ntoskrnl_set_timer(&timer->nt_ktimer,
+	    ((int64_t)msecs * -10000), &timer->nt_kdpc);
 
 	return;
 }
 
-static void
-ndis_tick(arg)
-	void			*arg;
-{
-	ndis_miniport_timer	*timer;
-	struct callout		*ch;
-	__stdcall ndis_timer_function	timerfunc;
-	struct timeval		tv;
-
-	timer = arg;
-
-	/* Automatically reload timer. */
-
-	tv.tv_sec = 0;
-	tv.tv_usec = timer->nmt_ktimer.nk_period * 1000;
-	ch = timer->nmt_dpc.nk_sysarg1;
-	timer->nmt_ktimer.nk_header.dh_sigstate = FALSE;
-	timer->nmt_dpc.nk_sysarg2 = ndis_tick;
-	callout_reset(ch, tvtohz(&tv), timer->nmt_dpc.nk_sysarg2, timer);
-
-	timerfunc = (ndis_timer_function)timer->nmt_dpc.nk_deferedfunc;
-	timerfunc(NULL, timer->nmt_dpc.nk_deferredctx, NULL, NULL);
-	ntoskrnl_wakeup(&timer->nmt_ktimer.nk_header);
-
-	return;
-}
-
 __stdcall static void
 ndis_set_periodic_timer(timer, msecs)
 	ndis_miniport_timer	*timer;
 	uint32_t		msecs;
 {
-	struct callout		*ch;
-	struct timeval		tv;
-
-	tv.tv_sec = 0;
-	tv.tv_usec = msecs * 1000;
-
-	timer->nmt_ktimer.nk_period = msecs;
-	ch = timer->nmt_dpc.nk_sysarg1;
-	timer->nmt_dpc.nk_sysarg2 = ndis_tick;
-	timer->nmt_ktimer.nk_header.dh_sigstate = FALSE;
-	callout_reset(ch, tvtohz(&tv), timer->nmt_dpc.nk_sysarg2, timer);
+	ntoskrnl_set_timer_ex(&timer->nmt_ktimer,
+	    ((int64_t)msecs * -10000), msecs, &timer->nmt_kdpc);
 
 	return;
 }
 
+/*
+ * Technically, this is really NdisCancelTimer(), but we also
+ * (ab)use it for NdisMCancelTimer(), since in our implementation
+ * we don't need the extra info in the ndis_miniport_timer
+ * structure.
+ */
+
 __stdcall static void
 ndis_cancel_timer(timer, cancelled)
-	ndis_miniport_timer	*timer;
+	ndis_timer		*timer;
 	uint8_t			*cancelled;
 {
-	struct callout		*ch;
-
-	if (timer == NULL)
-		return;
-	ch = timer->nmt_dpc.nk_sysarg1;
-	if (ch == NULL)
-		return;
-	callout_stop(ch);
-	*cancelled = timer->nmt_ktimer.nk_header.dh_sigstate;
+	*cancelled = ntoskrnl_cancel_timer(&timer->nt_ktimer);
 
 	return;
 }
@@ -1990,10 +1905,13 @@
 ndis_init_event(event)
 	ndis_event		*event;
 {
-	event->ne_event.nk_header.dh_sigstate = FALSE;
-	event->ne_event.nk_header.dh_size = OTYPE_EVENT;
-	event->ne_event.nk_header.dh_type = EVENT_TYPE_NOTIFY;
-	INIT_LIST_HEAD((&event->ne_event.nk_header.dh_waitlisthead));
+	/*
+	 * NDIS events are always synchronization
+	 * events, and should be initialized to the
+	 * not signaled state.
+	 */
+ 
+	ntoskrnl_init_event(&event->ne_event, EVENT_TYPE_SYNC, FALSE);
 	return;
 }
 
@@ -2001,7 +1919,7 @@
 ndis_set_event(event)
 	ndis_event		*event;
 {
-	ntoskrnl_wakeup(event);
+	ntoskrnl_set_event(&event->ne_event, 0, 0);
 	return;
 }
 
@@ -2009,56 +1927,27 @@
 ndis_reset_event(event)
 	ndis_event		*event;
 {
-	event->ne_event.nk_header.dh_sigstate = FALSE;
+	ntoskrnl_reset_event(&event->ne_event);
 	return;
 }
 
-/*
- * This is a stripped-down version of KeWaitForSingleObject().
- * Maybe it ought to just call ntoskrnl_waitforobj() to reduce
- * code duplication.
- */
-
 __stdcall static uint8_t
 ndis_wait_event(event, msecs)
 	ndis_event		*event;
 	uint32_t		msecs;
 {
-	int			error;
-	struct timeval		tv;
-	wait_block		w;
-	struct thread		*td = curthread;
+	int64_t			duetime;
+	uint32_t		rval;
 
-	mtx_pool_lock(ndis_mtxpool, ntoskrnl_dispatchlock);
+	duetime = ((int64_t)msecs * -10000);
 
-	if (event->ne_event.nk_header.dh_sigstate == TRUE) {
-		mtx_pool_unlock(ndis_mtxpool, ntoskrnl_dispatchlock);
-		return(TRUE);
-	}
+	rval = ntoskrnl_waitforobj((nt_dispatch_header *)event,
+	    0, 0, TRUE, msecs ? &duetime : NULL);
 
-	INSERT_LIST_TAIL((&event->ne_event.nk_header.dh_waitlisthead),
-	    (&w.wb_waitlist));
+	if (rval == STATUS_TIMEOUT)
+		return(FALSE);
 
-	tv.tv_sec = 0;
-	tv.tv_usec = msecs * 1000;
-
-	w.wb_kthread = td;
-	w.wb_object = &event->ne_event.nk_header;
-
-	mtx_pool_unlock(ndis_mtxpool, ntoskrnl_dispatchlock);
-
-	if (td->td_proc->p_flag & P_KTHREAD)
-		error = kthread_suspend(td->td_proc, tvtohz(&tv));
-	else
-		error = tsleep(td, PPAUSE|PCATCH, "ndiswe", tvtohz(&tv));
-
-	mtx_pool_lock(ndis_mtxpool, ntoskrnl_dispatchlock);
-
-	REMOVE_LIST_ENTRY((&w.wb_waitlist));
-
-	mtx_pool_unlock(ndis_mtxpool, ntoskrnl_dispatchlock);
-
-	return(event->ne_event.nk_header.dh_sigstate);
+	return(TRUE);
 }
 
 __stdcall static ndis_status

==== //depot/projects/netperf_socket/sys/compat/ndis/subr_ntoskrnl.c#7 (text+ko) ====

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ntoskrnl.c,v 1.28 2004/03/15 16:39:03 wpaul Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ntoskrnl.c,v 1.29 2004/03/20 23:39:43 wpaul Exp $");
 
 #include <sys/ctype.h>
 #include <sys/unistd.h>
@@ -80,25 +80,11 @@
 	void *, uint32_t, uint32_t *, void *, void *);
 __stdcall static uint32_t ntoskrnl_iofcalldriver(/*void *, void * */ void);
 __stdcall static void ntoskrnl_iofcompletereq(/*void *, uint8_t*/ void);
-__stdcall static uint32_t ntoskrnl_waitforobj(nt_dispatch_header *, uint32_t,
-	uint32_t, uint8_t, int64_t *);
 __stdcall static uint32_t ntoskrnl_waitforobjs(uint32_t,
 	nt_dispatch_header **, uint32_t, uint32_t, uint32_t, uint8_t,
 	int64_t *, wait_block *);
-__stdcall static void ntoskrnl_init_event(nt_kevent *, uint32_t, uint8_t);
-__stdcall static void ntoskrnl_clear_event(nt_kevent *);
-__stdcall static uint32_t ntoskrnl_read_event(nt_kevent *);
-__stdcall static uint32_t ntoskrnl_set_event(nt_kevent *, uint32_t, uint8_t);
-__stdcall static uint32_t ntoskrnl_reset_event(nt_kevent *);
+static void ntoskrnl_wakeup(void *);
 static void ntoskrnl_timercall(void *);
-__stdcall static void ntoskrnl_init_dpc(kdpc *, void *, void *);
-__stdcall static void ntoskrnl_init_timer(ktimer *);
-__stdcall static void ntoskrnl_init_timer_ex(ktimer *, uint32_t);
-__stdcall static uint8_t ntoskrnl_set_timer(ktimer *, int64_t, kdpc *);
-__stdcall static uint8_t ntoskrnl_set_timer_ex(ktimer *, int64_t,
-	uint32_t, kdpc *);
-__stdcall static uint8_t ntoskrnl_cancel_timer(ktimer *);
-__stdcall static uint8_t ntoskrnl_read_timer(ktimer *);
 __stdcall static void ntoskrnl_writereg_ushort(uint16_t *, uint16_t);
 __stdcall static uint16_t ntoskrnl_readreg_ushort(uint16_t *);
 __stdcall static void ntoskrnl_writereg_ulong(uint32_t *, uint32_t);
@@ -325,7 +311,7 @@
 	return;
 }
 
-void
+static void
 ntoskrnl_wakeup(arg)
 	void			*arg;
 {
@@ -430,7 +416,7 @@
  * EINVAL, we need to use tsleep() instead.
  */
 
-__stdcall static uint32_t
+__stdcall uint32_t
 ntoskrnl_waitforobj(obj, reason, mode, alertable, duetime)
 	nt_dispatch_header	*obj;
 	uint32_t		reason;
@@ -1448,7 +1434,7 @@
 	return(kmutex->km_header.dh_sigstate);
 }
 
-__stdcall static void
+__stdcall void
 ntoskrnl_init_event(kevent, type, state)
 	nt_kevent		*kevent;
 	uint32_t		type;
@@ -1461,7 +1447,7 @@
 	return;
 }
 
-__stdcall static uint32_t
+__stdcall uint32_t
 ntoskrnl_reset_event(kevent)
 	nt_kevent		*kevent;
 {
@@ -1475,7 +1461,7 @@
 	return(prevstate);
 }
 
-__stdcall static uint32_t
+__stdcall uint32_t
 ntoskrnl_set_event(kevent, increment, kwait)
 	nt_kevent		*kevent;
 	uint32_t		increment;
@@ -1489,7 +1475,7 @@
 	return(prevstate);
 }
 
-__stdcall static void
+__stdcall void
 ntoskrnl_clear_event(kevent)
 	nt_kevent		*kevent;
 {
@@ -1497,7 +1483,7 @@
 	return;
 }
 
-__stdcall static uint32_t
+__stdcall uint32_t
 ntoskrnl_read_event(kevent)
 	nt_kevent		*kevent;
 {
@@ -1669,7 +1655,11 @@
 
 	/*
 	 * If this is a periodic timer, re-arm it
-	 * so it will fire again.
+	 * so it will fire again. We do this before
+	 * calling any deferred procedure calls because
+	 * it's possible the DPC might cancel the timer,
+	 * in which case it would be wrong for us to
+	 * re-arm it again afterwards.
 	 */
 
 	if (timer->k_period) {
@@ -1690,7 +1680,7 @@
 	return;
 }
 
-__stdcall static void
+__stdcall void
 ntoskrnl_init_timer(timer)
 	ktimer			*timer;
 {
@@ -1706,7 +1696,7 @@
 	return;
 }
 
-__stdcall static void
+__stdcall void
 ntoskrnl_init_timer_ex(timer, type)
 	ktimer			*timer;
 	uint32_t		type;
@@ -1723,7 +1713,7 @@
 	return;
 }
 
-__stdcall static void
+__stdcall void
 ntoskrnl_init_dpc(dpc, dpcfunc, dpcctx)
 	kdpc			*dpc;
 	void			*dpcfunc;
@@ -1738,7 +1728,7 @@
 	return;
 }
 
-__stdcall static uint8_t
+__stdcall uint8_t
 ntoskrnl_set_timer_ex(timer, duetime, period, dpc)
 	ktimer			*timer;
 	int64_t			duetime;
@@ -1784,7 +1774,7 @@
 	return(pending);
 }
 
-__stdcall static uint8_t
+__stdcall uint8_t
 ntoskrnl_set_timer(timer, duetime, dpc)
 	ktimer			*timer;
 	int64_t			duetime;
@@ -1793,7 +1783,7 @@
 	return (ntoskrnl_set_timer_ex(timer, duetime, 0, dpc));
 }
 
-__stdcall static uint8_t
+__stdcall uint8_t
 ntoskrnl_cancel_timer(timer)
 	ktimer			*timer;
 {
@@ -1813,7 +1803,7 @@
 	return(pending);
 }
 
-__stdcall static uint8_t
+__stdcall uint8_t
 ntoskrnl_read_timer(timer)
 	ktimer			*timer;
 {

==== //depot/projects/netperf_socket/sys/conf/files#11 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.876 2004/03/19 07:21:22 rwatson Exp $
+# $FreeBSD: src/sys/conf/files,v 1.877 2004/03/20 02:14:02 marcel Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -748,6 +748,7 @@
 dev/uart/uart_dev_ns8250.c	optional	uart
 dev/uart/uart_dev_sab82532.c	optional	uart
 dev/uart/uart_dev_z8530.c	optional	uart
+dev/uart/uart_subr.c		optional	uart
 dev/uart/uart_tty.c		optional	uart
 dev/ubsec/ubsec.c	optional ubsec
 #

==== //depot/projects/netperf_socket/sys/conf/files.alpha#2 (text+ko) ====

@@ -1,7 +1,7 @@
 # This file tells config what files go into building a kernel,
 # files marked standard are always included.
 #
-# $FreeBSD: src/sys/conf/files.alpha,v 1.108 2004/01/13 18:05:49 des Exp $
+# $FreeBSD: src/sys/conf/files.alpha,v 1.109 2004/03/20 21:06:20 alc Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -82,6 +82,7 @@
 alpha/alpha/swtch.s		standard
 alpha/alpha/sys_machdep.c	standard
 alpha/alpha/trap.c		standard
+alpha/alpha/uio_machdep.c	standard
 alpha/alpha/vm_machdep.c	standard
 alpha/isa/isa.c			optional	isa
 alpha/isa/isa_dma.c		optional	isa

==== //depot/projects/netperf_socket/sys/conf/files.amd64#4 (text+ko) ====

@@ -1,7 +1,7 @@
 # This file tells config what files go into building a kernel,
 # files marked standard are always included.
 #
-# $FreeBSD: src/sys/conf/files.amd64,v 1.29 2004/03/03 09:37:44 obrien Exp $
+# $FreeBSD: src/sys/conf/files.amd64,v 1.30 2004/03/20 19:36:29 alc Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -75,6 +75,7 @@
 amd64/amd64/sys_machdep.c	standard
 amd64/amd64/trap.c		standard
 amd64/amd64/tsc.c		standard
+amd64/amd64/uio_machdep.c	standard
 amd64/amd64/uma_machdep.c	standard
 amd64/amd64/vm_machdep.c	standard
 amd64/isa/atpic.c		optional	atpic isa

==== //depot/projects/netperf_socket/sys/conf/files.ia64#2 (text+ko) ====

@@ -1,7 +1,7 @@
 # This file tells config what files go into building a kernel,
 # files marked standard are always included.
 #
-# $FreeBSD: src/sys/conf/files.ia64,v 1.64 2004/01/13 15:37:23 des Exp $
+# $FreeBSD: src/sys/conf/files.ia64,v 1.65 2004/03/20 21:06:20 alc Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -123,6 +123,7 @@
 ia64/ia64/sys_machdep.c		standard
 ia64/ia64/syscall.S		standard
 ia64/ia64/trap.c		standard
+ia64/ia64/uio_machdep.c		standard
 ia64/ia64/uma_machdep.c		standard
 ia64/ia64/unaligned.c		standard
 ia64/ia64/unwind.c		standard

==== //depot/projects/netperf_socket/sys/conf/kern.post.mk#3 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/kern.post.mk,v 1.62 2004/02/13 13:21:41 ru Exp $
+# $FreeBSD: src/sys/conf/kern.post.mk,v 1.63 2004/03/20 22:47:30 marcel Exp $
 
 # Part of a unified Makefile for building kernels.  This part includes all
 # the definitions that need to be after all the % directives except %RULES
@@ -165,8 +165,9 @@
 	rm -f tags1
 	sed -e 's,      ../,    ,' tags > tags1
 
-kernel-install:
+.if ${MACHINE_ARCH} != "ia64"
 .if exists(${DESTDIR}/boot)
+kernel-install-check:
 	@if [ ! -f ${DESTDIR}/boot/device.hints ] ; then \
 		echo "You must set up a ${DESTDIR}/boot/device.hints file first." ; \
 		exit 1 ; \
@@ -175,7 +176,12 @@
 		echo "You must activate /boot/device.hints in loader.conf." ; \
 		exit 1 ; \
 	fi
+
+kernel-install: kernel-install-check
+.endif
 .endif
+
+kernel-install:
 	@if [ ! -f ${FULLKERNEL} ] ; then \
 		echo "You must build a kernel first." ; \
 		exit 1 ; \

==== //depot/projects/netperf_socket/sys/conf/kern.pre.mk#6 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/kern.pre.mk,v 1.45 2004/03/18 18:05:08 obrien Exp $
+# $FreeBSD: src/sys/conf/kern.pre.mk,v 1.47 2004/03/19 17:40:45 obrien Exp $
 
 # Part of a unified Makefile for building kernels.  This part contains all
 # of the definitions that need to be before %BEFORE_DEPEND.
@@ -18,10 +18,12 @@
 
 .if ${CC} == "icc"
 COPTFLAGS?=-O
-.elif ${MACHINE_ARCH} == "amd64"
-COPTFLAGS?=-O2 -fno-strict-aliasing -frename-registers -pipe
 .else
+. if ${MACHINE_ARCH} == "amd64"
+COPTFLAGS?=-O2 -frename-registers -pipe
+. else
 COPTFLAGS?=-O -pipe
+. endif
 . if ${COPTFLAGS:M-O[23s]} != ""
 COPTFLAGS+= -fno-strict-aliasing
 . endif

==== //depot/projects/netperf_socket/sys/dev/aac/aac_pci.c#4 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/aac/aac_pci.c,v 1.43 2004/03/17 17:50:23 njl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/aac/aac_pci.c,v 1.44 2004/03/20 21:07:36 scottl Exp $");
 
 /*
  * PCI bus interface and resource allocation.
@@ -127,6 +127,10 @@
 	 AAC_FLAGS_256FIBS, "Adaptec SCSI RAID 2120S"},
 	{0x9005, 0x0285, 0x9005, 0x0290, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB,
 	 "Adaptec SCSI RAID 2410SA"},
+	{0x9005, 0x0285, 0x1028, 0x0291, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB,
+	 "Dell CERC SATA RAID 2"},
+	{0x9005, 0x0285, 0x9005, 0x0292, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB,
+	 "Adaptec SCSI RAID 2810SA"},
 	{0, 0, 0, 0, 0, 0, 0}
 };
 

==== //depot/projects/netperf_socket/sys/dev/acpica/acpi_pcib.c#3 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_pcib.c,v 1.37 2004/03/18 02:33:58 njl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_pcib.c,v 1.38 2004/03/20 20:47:08 njl Exp $");
 
 #include "opt_acpi.h"
 #include <sys/param.h>
@@ -281,10 +281,11 @@
     
     /* 
      * There isn't an interrupt, so we have to look at _PRS to get one.
-     * Get the set of allowed interrupts from the _PRS resource indexed by SourceIndex.
+     * Get the set of allowed interrupts from the _PRS resource indexed
+     * by SourceIndex.
      */
     if (prsbuf.Pointer == NULL) {
-	device_printf(pcib, "device has no routed interrupt and no _PRS on PCI interrupt link device\n");
+	device_printf(pcib, "no routed irq and no _PRS on irq link device\n");
 	goto out;
     }
 
@@ -294,16 +295,23 @@
      * future, we might use these for priority but this is good enough for
      * now until BIOS vendors actually mean something by using them.
      */

>>> TRUNCATED FOR MAIL (1000 lines) <<<


More information about the p4-projects mailing list