Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Jan 2004 14:00:37 -0800 (PST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 45293 for review
Message-ID:  <200401132200.i0DM0bam057626@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=45293

Change 45293 by jhb@jhb_slimer on 2004/01/13 13:59:53

	IFC @45291.

Affected files ...

.. //depot/projects/smpng/sys/alpha/alpha/mp_machdep.c#26 integrate
.. //depot/projects/smpng/sys/alpha/include/sysarch.h#3 integrate
.. //depot/projects/smpng/sys/amd64/include/profile.h#3 integrate
.. //depot/projects/smpng/sys/amd64/include/sysarch.h#4 integrate
.. //depot/projects/smpng/sys/boot/forth/beastie.4th#6 integrate
.. //depot/projects/smpng/sys/boot/i386/cdboot/cdboot.s#3 integrate
.. //depot/projects/smpng/sys/compat/linprocfs/linprocfs.c#36 integrate
.. //depot/projects/smpng/sys/compat/ndis/kern_ndis.c#5 integrate
.. //depot/projects/smpng/sys/compat/ndis/ndis_var.h#5 integrate
.. //depot/projects/smpng/sys/compat/ndis/subr_hal.c#3 integrate
.. //depot/projects/smpng/sys/compat/ndis/subr_ndis.c#5 integrate
.. //depot/projects/smpng/sys/compat/ndis/subr_ntoskrnl.c#5 integrate
.. //depot/projects/smpng/sys/conf/files#99 integrate
.. //depot/projects/smpng/sys/conf/files.alpha#26 integrate
.. //depot/projects/smpng/sys/conf/files.i386#51 integrate
.. //depot/projects/smpng/sys/conf/files.ia64#37 integrate
.. //depot/projects/smpng/sys/conf/files.powerpc#15 integrate
.. //depot/projects/smpng/sys/conf/files.sparc64#34 integrate
.. //depot/projects/smpng/sys/conf/kern.post.mk#31 integrate
.. //depot/projects/smpng/sys/conf/majors#33 integrate
.. //depot/projects/smpng/sys/conf/newvers.sh#10 integrate
.. //depot/projects/smpng/sys/conf/options.i386#39 integrate
.. //depot/projects/smpng/sys/contrib/dev/acpica/exstore.c#17 integrate
.. //depot/projects/smpng/sys/dev/acpica/Osd/OsdTable.c#4 integrate
.. //depot/projects/smpng/sys/dev/acpica/acpi.c#56 integrate
.. //depot/projects/smpng/sys/dev/acpica/acpi_thermal.c#21 integrate
.. //depot/projects/smpng/sys/dev/acpica/acpivar.h#34 integrate
.. //depot/projects/smpng/sys/dev/an/if_an.c#36 integrate
.. //depot/projects/smpng/sys/dev/ata/ata-all.c#44 integrate
.. //depot/projects/smpng/sys/dev/ata/ata-all.h#21 integrate
.. //depot/projects/smpng/sys/dev/ata/ata-card.c#16 integrate
.. //depot/projects/smpng/sys/dev/ata/ata-cbus.c#7 integrate
.. //depot/projects/smpng/sys/dev/ata/ata-chipset.c#27 integrate
.. //depot/projects/smpng/sys/dev/ata/ata-disk.c#35 integrate
.. //depot/projects/smpng/sys/dev/ata/ata-dma.c#34 integrate
.. //depot/projects/smpng/sys/dev/ata/ata-isa.c#14 integrate
.. //depot/projects/smpng/sys/dev/ata/ata-lowlevel.c#7 integrate
.. //depot/projects/smpng/sys/dev/ata/ata-pci.c#38 integrate
.. //depot/projects/smpng/sys/dev/ata/ata-queue.c#5 integrate
.. //depot/projects/smpng/sys/dev/ata/ata-raid.c#26 integrate
.. //depot/projects/smpng/sys/dev/ata/atapi-cam.c#17 integrate
.. //depot/projects/smpng/sys/dev/ata/atapi-cd.c#45 integrate
.. //depot/projects/smpng/sys/dev/ata/atapi-fd.c#20 integrate
.. //depot/projects/smpng/sys/dev/ata/atapi-tape.c#23 integrate
.. //depot/projects/smpng/sys/dev/ath/if_ath.c#14 integrate
.. //depot/projects/smpng/sys/dev/bge/if_bge.c#39 integrate
.. //depot/projects/smpng/sys/dev/bge/if_bgereg.h#22 integrate
.. //depot/projects/smpng/sys/dev/firewire/firewire.c#29 integrate
.. //depot/projects/smpng/sys/dev/firewire/fwohci.c#28 integrate
.. //depot/projects/smpng/sys/dev/firewire/if_fwe.c#20 integrate
.. //depot/projects/smpng/sys/dev/firewire/sbp.c#31 integrate
.. //depot/projects/smpng/sys/dev/ida/ida.c#13 integrate
.. //depot/projects/smpng/sys/dev/ida/ida_disk.c#11 integrate
.. //depot/projects/smpng/sys/dev/ida/ida_eisa.c#7 integrate
.. //depot/projects/smpng/sys/dev/ida/ida_pci.c#8 integrate
.. //depot/projects/smpng/sys/dev/ida/idareg.h#3 integrate
.. //depot/projects/smpng/sys/dev/ida/idavar.h#3 integrate
.. //depot/projects/smpng/sys/dev/if_ndis/if_ndis.c#5 integrate
.. //depot/projects/smpng/sys/dev/if_ndis/if_ndisvar.h#3 integrate
.. //depot/projects/smpng/sys/dev/md/md.c#44 integrate
.. //depot/projects/smpng/sys/dev/pci/pci_pci.c#18 integrate
.. //depot/projects/smpng/sys/dev/pci/pci_user.c#11 integrate
.. //depot/projects/smpng/sys/dev/pci/pcib_private.h#6 integrate
.. //depot/projects/smpng/sys/dev/pdq/pdqvar.h#6 integrate
.. //depot/projects/smpng/sys/dev/sound/pci/emu10k1.c#15 integrate
.. //depot/projects/smpng/sys/dev/trm/trm.c#13 integrate
.. //depot/projects/smpng/sys/dev/usb/uhci.c#29 integrate
.. //depot/projects/smpng/sys/dev/usb/uhci_pci.c#8 integrate
.. //depot/projects/smpng/sys/dev/usb/usb_quirks.c#7 integrate
.. //depot/projects/smpng/sys/dev/usb/usbdevs#44 integrate
.. //depot/projects/smpng/sys/dev/usb/usbdevs.h#44 integrate
.. //depot/projects/smpng/sys/dev/usb/usbdevs_data.h#44 integrate
.. //depot/projects/smpng/sys/fs/nullfs/null_vnops.c#14 integrate
.. //depot/projects/smpng/sys/fs/procfs/procfs.c#10 integrate
.. //depot/projects/smpng/sys/fs/smbfs/smbfs_smb.c#10 integrate
.. //depot/projects/smpng/sys/fs/smbfs/smbfs_vnops.c#23 integrate
.. //depot/projects/smpng/sys/geom/geom_subr.c#34 integrate
.. //depot/projects/smpng/sys/gnu/dev/sound/pci/emu10k1-ac97.h#2 integrate
.. //depot/projects/smpng/sys/gnu/dev/sound/pci/emu10k1-alsa.h#2 integrate
.. //depot/projects/smpng/sys/gnu/dev/sound/pci/emu10k1.h#3 integrate
.. //depot/projects/smpng/sys/i386/acpica/acpi_toshiba.c#1 branch
.. //depot/projects/smpng/sys/i386/conf/NOTES#73 integrate
.. //depot/projects/smpng/sys/i386/i386/pmap.c#55 integrate
.. //depot/projects/smpng/sys/i386/include/sysarch.h#6 integrate
.. //depot/projects/smpng/sys/i386/isa/pcvt/pcvt_ext.c#11 integrate
.. //depot/projects/smpng/sys/ia64/include/cpufunc.h#19 integrate
.. //depot/projects/smpng/sys/ia64/include/sysarch.h#4 integrate
.. //depot/projects/smpng/sys/kern/kern_descrip.c#54 integrate
.. //depot/projects/smpng/sys/kern/kern_fork.c#69 integrate
.. //depot/projects/smpng/sys/kern/kern_sig.c#81 integrate
.. //depot/projects/smpng/sys/kern/kern_thread.c#49 integrate
.. //depot/projects/smpng/sys/kern/sys_pipe.c#39 integrate
.. //depot/projects/smpng/sys/kern/tty.c#38 integrate
.. //depot/projects/smpng/sys/kern/uipc_syscalls.c#43 integrate
.. //depot/projects/smpng/sys/kern/uipc_usrreq.c#30 integrate
.. //depot/projects/smpng/sys/kern/vfs_syscalls.c#66 integrate
.. //depot/projects/smpng/sys/libkern/ffs.c#4 integrate
.. //depot/projects/smpng/sys/libkern/ffsl.c#1 branch
.. //depot/projects/smpng/sys/libkern/fls.c#1 branch
.. //depot/projects/smpng/sys/libkern/flsl.c#1 branch
.. //depot/projects/smpng/sys/modules/Makefile#68 integrate
.. //depot/projects/smpng/sys/modules/acpi/Makefile#19 integrate
.. //depot/projects/smpng/sys/modules/acpi/Makefile.inc#1 branch
.. //depot/projects/smpng/sys/modules/acpi/acpi/Makefile#2 integrate
.. //depot/projects/smpng/sys/modules/acpi/acpi_toshiba/Makefile#1 branch
.. //depot/projects/smpng/sys/modules/cx/Makefile#2 integrate
.. //depot/projects/smpng/sys/modules/drm/mga/Makefile#4 integrate
.. //depot/projects/smpng/sys/modules/drm/r128/Makefile#4 integrate
.. //depot/projects/smpng/sys/modules/drm/radeon/Makefile#4 integrate
.. //depot/projects/smpng/sys/modules/drm/sis/Makefile#2 integrate
.. //depot/projects/smpng/sys/modules/drm/tdfx/Makefile#2 integrate
.. //depot/projects/smpng/sys/modules/ida/Makefile#1 branch
.. //depot/projects/smpng/sys/modules/ndis/Makefile#2 integrate
.. //depot/projects/smpng/sys/modules/netgraph/bluetooth/bluetooth/Makefile#4 integrate
.. //depot/projects/smpng/sys/modules/netgraph/bluetooth/bt3c/Makefile#4 integrate
.. //depot/projects/smpng/sys/modules/netgraph/bluetooth/h4/Makefile#4 integrate
.. //depot/projects/smpng/sys/modules/netgraph/bluetooth/hci/Makefile#4 integrate
.. //depot/projects/smpng/sys/modules/netgraph/bluetooth/l2cap/Makefile#4 integrate
.. //depot/projects/smpng/sys/modules/netgraph/bluetooth/socket/Makefile#4 integrate
.. //depot/projects/smpng/sys/modules/netgraph/bluetooth/ubt/Makefile#4 integrate
.. //depot/projects/smpng/sys/modules/netgraph/bluetooth/ubtbcmfw/Makefile#3 integrate
.. //depot/projects/smpng/sys/modules/netgraph/fec/Makefile#3 integrate
.. //depot/projects/smpng/sys/modules/sound/driver/emu10k1/Makefile#3 integrate
.. //depot/projects/smpng/sys/modules/ubsa/Makefile#2 integrate
.. //depot/projects/smpng/sys/modules/ucom/Makefile#2 integrate
.. //depot/projects/smpng/sys/modules/udf/Makefile#4 integrate
.. //depot/projects/smpng/sys/modules/ufm/Makefile#2 integrate
.. //depot/projects/smpng/sys/modules/uftdi/Makefile#2 integrate
.. //depot/projects/smpng/sys/modules/umct/Makefile#2 integrate
.. //depot/projects/smpng/sys/modules/uplcom/Makefile#3 integrate
.. //depot/projects/smpng/sys/modules/uvisor/Makefile#2 integrate
.. //depot/projects/smpng/sys/modules/uvscom/Makefile#3 integrate
.. //depot/projects/smpng/sys/net/if_atmsubr.c#15 integrate
.. //depot/projects/smpng/sys/net/route.c#18 integrate
.. //depot/projects/smpng/sys/net80211/ieee80211.h#3 integrate
.. //depot/projects/smpng/sys/net80211/ieee80211_ioctl.c#8 integrate
.. //depot/projects/smpng/sys/netgraph/ng_ether.c#12 integrate
.. //depot/projects/smpng/sys/netinet/in_pcb.c#41 integrate
.. //depot/projects/smpng/sys/netinet/ip_icmp.c#23 integrate
.. //depot/projects/smpng/sys/netinet/ip_output.c#48 integrate
.. //depot/projects/smpng/sys/netinet/tcp.h#3 integrate
.. //depot/projects/smpng/sys/netinet/tcp_input.c#44 integrate
.. //depot/projects/smpng/sys/netinet/tcp_subr.c#41 integrate
.. //depot/projects/smpng/sys/netinet/tcp_usrreq.c#24 integrate
.. //depot/projects/smpng/sys/netinet/tcp_var.h#18 integrate
.. //depot/projects/smpng/sys/netinet6/in6.c#17 integrate
.. //depot/projects/smpng/sys/netinet6/in6_ifattach.c#9 integrate
.. //depot/projects/smpng/sys/netinet6/in6_pcb.c#26 integrate
.. //depot/projects/smpng/sys/netinet6/ipsec.c#13 integrate
.. //depot/projects/smpng/sys/pc98/conf/NOTES#19 integrate
.. //depot/projects/smpng/sys/pc98/i386/machdep.c#64 integrate
.. //depot/projects/smpng/sys/pci/if_dc.c#51 integrate
.. //depot/projects/smpng/sys/pci/if_dcreg.h#21 integrate
.. //depot/projects/smpng/sys/pci/ncr.c#13 integrate
.. //depot/projects/smpng/sys/powerpc/include/nexusvar.h#3 integrate
.. //depot/projects/smpng/sys/powerpc/include/openpicvar.h#3 integrate
.. //depot/projects/smpng/sys/powerpc/powermac/ata_macio.c#7 integrate
.. //depot/projects/smpng/sys/powerpc/powermac/hrowpic.c#3 integrate
.. //depot/projects/smpng/sys/powerpc/powermac/openpic_macio.c#1 branch
.. //depot/projects/smpng/sys/powerpc/powerpc/nexus.c#5 integrate
.. //depot/projects/smpng/sys/powerpc/powerpc/openpic.c#5 integrate
.. //depot/projects/smpng/sys/powerpc/psim/ata_iobus.c#5 integrate
.. //depot/projects/smpng/sys/powerpc/psim/openpic_iobus.c#1 branch
.. //depot/projects/smpng/sys/rpc/rpcclnt.c#2 integrate
.. //depot/projects/smpng/sys/sparc64/include/ofw_machdep.h#4 integrate
.. //depot/projects/smpng/sys/sparc64/include/sysarch.h#3 integrate
.. //depot/projects/smpng/sys/sparc64/sparc64/ofw_machdep.c#6 integrate
.. //depot/projects/smpng/sys/sys/filedesc.h#19 integrate
.. //depot/projects/smpng/sys/sys/libkern.h#11 integrate
.. //depot/projects/smpng/sys/vm/vm_contig.c#19 integrate
.. //depot/projects/smpng/sys/vm/vm_extern.h#18 integrate
.. //depot/projects/smpng/sys/vm/vm_kern.c#24 integrate
.. //depot/projects/smpng/sys/vm/vm_page.c#46 integrate

Differences ...

==== //depot/projects/smpng/sys/alpha/alpha/mp_machdep.c#26 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/alpha/alpha/mp_machdep.c,v 1.51 2003/12/03 14:57:25 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/alpha/alpha/mp_machdep.c,v 1.52 2004/01/07 23:00:20 jhb Exp $");
 
 #include "opt_kstack_pages.h"
 
@@ -351,7 +351,7 @@
 	boot_cpu_id = PCPU_GET(cpuid);
 	KASSERT(boot_cpu_id == hwrpb->rpb_primary_cpu_id,
 	    ("cpu_mp_probe() called on non-primary CPU"));
-	all_cpus = 1 << boot_cpu_id;
+	all_cpus = PCPU_GET(cpumask);
 
 	mp_ncpus = 1;
 
@@ -413,12 +413,12 @@
 		all_cpus |= (1 << i);
 		mp_ncpus++;
 	}
-	PCPU_SET(other_cpus, all_cpus & ~(1 << boot_cpu_id));
+	PCPU_SET(other_cpus, all_cpus & ~PCPU_GET(cpumask));
 
 	for (i = 0; i < hwrpb->rpb_pcs_cnt; i++) {
 		if (i == boot_cpu_id)
 			continue;
-		if (all_cpus & (1 << i))
+		if (!CPU_ABSENT(i))
 			smp_start_secondary(i);
 	}
 }
@@ -476,7 +476,7 @@
 void
 ipi_self(u_int64_t ipi)
 {
-	ipi_selected(1 << PCPU_GET(cpuid), ipi);
+	ipi_selected(PCPU_GET(cpumask), ipi);
 }
 
 /*
@@ -489,7 +489,7 @@
 	u_int64_t ipi;
 	int cpumask;
 
-	cpumask = 1 << PCPU_GET(cpuid);
+	cpumask = PCPU_GET(cpumask);
 
 	CTR1(KTR_SMP, "smp_handle_ipi(), ipis=%lx", ipis);
 	while (ipis) {

==== //depot/projects/smpng/sys/alpha/include/sysarch.h#3 (text+ko) ====

@@ -30,7 +30,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/alpha/include/sysarch.h,v 1.6 2002/03/20 18:58:45 obrien Exp $
+ * $FreeBSD: src/sys/alpha/include/sysarch.h,v 1.7 2004/01/09 16:52:08 nectar Exp $
  */
 
 /*
@@ -52,6 +52,7 @@
 
 __BEGIN_DECLS
 int		alpha_sethae(u_int64_t);
+int		sysarch(int, void *);
 __END_DECLS
 #endif
 

==== //depot/projects/smpng/sys/amd64/include/profile.h#3 (text+ko) ====

@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)profile.h	8.1 (Berkeley) 6/11/93
- * $FreeBSD: src/sys/amd64/include/profile.h,v 1.32 2003/06/02 00:28:39 obrien Exp $
+ * $FreeBSD: src/sys/amd64/include/profile.h,v 1.33 2004/01/06 20:36:21 nectar Exp $
  */
 
 #ifndef _MACHINE_PROFILE_H_
@@ -148,7 +148,6 @@
 #ifdef __GNUC__
 void	mcount(void) __asm(".mcount");
 #endif
-static void	_mcount(uintfptr_t frompc, uintfptr_t selfpc);
 __END_DECLS
 
 #endif /* _KERNEL */

==== //depot/projects/smpng/sys/amd64/include/sysarch.h#4 (text+ko) ====

@@ -30,7 +30,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/amd64/include/sysarch.h,v 1.21 2003/10/23 06:06:14 peter Exp $
+ * $FreeBSD: src/sys/amd64/include/sysarch.h,v 1.22 2004/01/09 16:52:08 nectar Exp $
  */
 
 /*
@@ -50,9 +50,10 @@
 
 __BEGIN_DECLS
 int amd64_get_fsbase(void **);
+int amd64_get_gsbase(void **);
 int amd64_set_fsbase(void *);
-int amd64_get_gsbase(void **);
 int amd64_set_gsbase(void *);
+int sysarch(int, void *);
 __END_DECLS
 #endif
 

==== //depot/projects/smpng/sys/boot/forth/beastie.4th#6 (text+ko) ====

@@ -23,7 +23,7 @@
 \ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 \ SUCH DAMAGE.
 \
-\ $FreeBSD: src/sys/boot/forth/beastie.4th,v 1.7 2003/10/28 17:18:42 scottl Exp $
+\ $FreeBSD: src/sys/boot/forth/beastie.4th,v 1.8 2004/01/09 19:20:47 scottl Exp $
 
 marker task-beastie.4th
 
@@ -228,6 +228,7 @@
 				s" acpi_load" unsetenv
 				s" 1" s" hint.acpi.0.disabled" setenv
 				s" 1" s" loader.acpi_disabled_by_user" setenv
+				s" 1" s" hint.apic.0.disabled" setenv
 			then
 			s" 0" s" hw.ata.ata_dma" setenv
 			s" 0" s" hw.ata.atapi_dma" setenv

==== //depot/projects/smpng/sys/boot/i386/cdboot/cdboot.s#3 (text+ko) ====

@@ -13,7 +13,7 @@
 # purpose.
 #
 
-# $FreeBSD: src/sys/boot/i386/cdboot/cdboot.s,v 1.10 2003/12/11 22:42:50 jhb Exp $
+# $FreeBSD: src/sys/boot/i386/cdboot/cdboot.s,v 1.11 2004/01/12 20:34:42 jhb Exp $
 
 #
 # This program is a freestanding boot program to load an a.out binary
@@ -165,7 +165,7 @@
 #
 		mov DIR_SIZE(%bx),%eax		# Read file length
 		add $SECTOR_SIZE-1,%eax		# Convert length to sectors
-		shr $11,%eax
+		shr $SECTOR_SHIFT,%eax
 		cmp $BUFFER_LEN,%eax
 		jbe load_sizeok
 		mov $msg_load2big,%si		# Error message
@@ -400,6 +400,7 @@
 # Trashes: EAX
 #
 read:		push %si			# Save
+		push %cx			# Save since some BIOSs trash
 		mov %eax,edd_lba		# LBA to read from
 		mov %ebx,%eax			# Convert address
 		shr $4,%eax			#  to segment
@@ -413,7 +414,8 @@
 		int $0x13			# Call BIOS
 		pop %dx				# Restore
 		jc read.fail			# Worked?
-		pop %si				# Restore
+		pop %cx				# Restore
+		pop %si
 		ret				# Return
 read.fail:	cmp $ERROR_TIMEOUT,%ah		# Timeout?
 		je read.retry			# Yes, Retry.
@@ -460,6 +462,7 @@
 		mov twiddle_chars,%bx		# Address table
 		inc %al				# Next
 		and $3,%al			#  char
+		mov %al,twiddle_index		# Save index for next call
 		xlat				# Get char
 		call putc			# Output it
 		mov $8,%al			# Backspace

==== //depot/projects/smpng/sys/compat/linprocfs/linprocfs.c#36 (text+ko) ====

@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linprocfs/linprocfs.c,v 1.80 2004/01/02 19:29:31 alc Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linprocfs/linprocfs.c,v 1.81 2004/01/12 03:14:37 rwatson Exp $");
 
 #include <sys/param.h>
 #include <sys/queue.h>
@@ -352,7 +352,7 @@
 	/* resolve symlinks etc. in the emulation tree prefix */
 	NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path, td);
 	flep = NULL;
-	if (namei(&nd) != 0 || vn_fullpath(td, nd.ni_vp, &dlep, &flep) == -1)
+	if (namei(&nd) != 0 || vn_fullpath(td, nd.ni_vp, &dlep, &flep) != 0)
 		lep = linux_emul_path;
 	else
 		lep = dlep;

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

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.22 2004/01/06 07:09:26 wpaul Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.28 2004/01/12 21:40:05 wpaul Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -151,7 +151,8 @@
 	ndis_miniport_block	*block;
 	block = adapter;
 
-	device_printf (block->nmb_dev, "status: %x\n", status);
+	if (block->nmb_ifp->if_flags & IFF_DEBUG)
+		device_printf (block->nmb_dev, "status: %x\n", status);
 	return;
 }
 
@@ -162,7 +163,8 @@
 	ndis_miniport_block	*block;
 	block = adapter;
 	
-	device_printf (block->nmb_dev, "status complete\n");
+	if (block->nmb_ifp->if_flags & IFF_DEBUG)
+		device_printf (block->nmb_dev, "status complete\n");
 	return;
 }
 
@@ -201,7 +203,8 @@
 	ndis_miniport_block	*block;
 	block = adapter;
 
-	device_printf (block->nmb_dev, "reset done...\n");
+	if (block->nmb_ifp->if_flags & IFF_DEBUG)
+		device_printf (block->nmb_dev, "reset done...\n");
 	return;
 }
 
@@ -305,17 +308,17 @@
 	    "NDIS API Version", "0x00050001", CTLFLAG_RD);
 
 	/* Bus type (PCI, PCMCIA, etc...) */
-	sprintf(buf, "%d\n", (int)sc->ndis_iftype);
+	sprintf(buf, "%d", (int)sc->ndis_iftype);
 	ndis_add_sysctl(sc, "BusType", "Bus Type", buf, CTLFLAG_RD);
 
 	if (sc->ndis_res_io != NULL) {
-		sprintf(buf, "0x%lx\n", rman_get_start(sc->ndis_res_io));
+		sprintf(buf, "0x%lx", rman_get_start(sc->ndis_res_io));
 		ndis_add_sysctl(sc, "IOBaseAddress",
 		    "Base I/O Address", buf, CTLFLAG_RD);
 	}
 
 	if (sc->ndis_irq != NULL) {
-		sprintf(buf, "%lu\n", rman_get_start(sc->ndis_irq));
+		sprintf(buf, "%lu", rman_get_start(sc->ndis_irq));
 		ndis_add_sysctl(sc, "InterruptNumber",
 		    "Interrupt Number", buf, CTLFLAG_RD);
 	}
@@ -600,6 +603,7 @@
 	priv = &(*p)->np_private;
 	priv->npp_totlen = m0->m_pkthdr.len;
         priv->npp_packetooboffset = offsetof(ndis_packet, np_oob);
+	priv->npp_ndispktflags = NDIS_PACKET_ALLOCATED_BY_NDIS;
 
 	for (m = m0; m != NULL; m = m->m_next) {
 		if (m->m_len == 0)
@@ -704,6 +708,8 @@
 	return(0);
 }
 
+typedef void (*ndis_senddone_func)(ndis_handle, ndis_packet *, ndis_status);
+
 int
 ndis_send_packets(arg, packets, cnt)
 	void			*arg;
@@ -713,14 +719,14 @@
 	struct ndis_softc	*sc;
 	ndis_handle		adapter;
 	__stdcall ndis_sendmulti_handler	sendfunc;
-	int			i, idx;
-	struct ifnet		*ifp;
-	struct mbuf		*m;
+	__stdcall ndis_senddone_func		senddonefunc;
+	int			i;
 	ndis_packet		*p;
 
 	sc = arg;
 	adapter = sc->ndis_block.nmb_miniportadapterctx;
 	sendfunc = sc->ndis_chars.nmc_sendmulti_func;
+	senddonefunc = sc->ndis_block.nmb_senddone_func;
 	sendfunc(adapter, packets, cnt);
 
 	for (i = 0; i < cnt; i++) {
@@ -733,21 +739,7 @@
 		 */
 		if (p == NULL || p->np_oob.npo_status == NDIS_STATUS_PENDING)
 			continue;
-		idx = p->np_txidx;
-		m = p->np_m0;
-		ifp = &sc->arpcom.ac_if;
-		if (sc->ndis_sc)
-			bus_dmamap_unload(sc->ndis_ttag, sc->ndis_tmaps[idx]);
-		sc->ndis_txarray[idx] = NULL;
-		sc->ndis_txpending++;
-		m_freem(m);
-		ndis_free_packet(p);
-		if (p->np_oob.npo_status == NDIS_STATUS_SUCCESS)
-			ifp->if_opackets++;
-		else
-			ifp->if_oerrors++;
-		ifp->if_timer = 0;
-		ifp->if_flags &= ~IFF_OACTIVE;
+		senddonefunc(&sc->ndis_block, p, p->np_oob.npo_status);
 	}
 
 	return(0);
@@ -1092,6 +1084,8 @@
 	return(0);
 }
 
+#define NDIS_LOADED		0x42534F44
+
 int
 ndis_load_driver(img, arg)
 	vm_offset_t		img;
@@ -1110,22 +1104,34 @@
 
 	sc = arg;
 
-	/* Perform text relocation */
-	if (pe_relocate(img))
-		return(ENOEXEC);
+	/*
+	 * Only perform the relocation/linking phase once
+	 * since the binary image may be shared among multiple
+	 * device instances.
+	 */
 
-        /* Dynamically link the NDIS.SYS routines -- required. */
-	if (pe_patch_imports(img, "NDIS", ndis_functbl))
-		return(ENOEXEC);
+	ptr = (uint32_t *)(img + 8);
+	if (*ptr != NDIS_LOADED) {
+		/* Perform text relocation */
+		if (pe_relocate(img))
+			return(ENOEXEC);
 
-	/* Dynamically link the HAL.dll routines -- also required. */
-	if (pe_patch_imports(img, "HAL", hal_functbl))
-		return(ENOEXEC);
+		/* Dynamically link the NDIS.SYS routines -- required. */
+		if (pe_patch_imports(img, "NDIS", ndis_functbl))
+			return(ENOEXEC);
 
-	/* Dynamically link ntoskrnl.exe -- optional. */
-	if (pe_get_import_descriptor(img, &imp_desc, "ntoskrnl") == 0) {
-		if (pe_patch_imports(img, "ntoskrnl", ntoskrnl_functbl))
+		/* Dynamically link the HAL.dll routines -- also required. */
+		if (pe_patch_imports(img, "HAL", hal_functbl))
 			return(ENOEXEC);
+
+		/* Dynamically link ntoskrnl.exe -- optional. */
+		if (pe_get_import_descriptor(img,
+		    &imp_desc, "ntoskrnl") == 0) {
+			if (pe_patch_imports(img,
+			    "ntoskrnl", ntoskrnl_functbl))
+				return(ENOEXEC);
+		}
+		*ptr = NDIS_LOADED;
 	}
 
         /* Locate the driver entry point */

==== //depot/projects/smpng/sys/compat/ndis/ndis_var.h#5 (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.12 2004/01/06 07:09:26 wpaul Exp $
+ * $FreeBSD: src/sys/compat/ndis/ndis_var.h,v 1.15 2004/01/12 03:49:20 wpaul Exp $
  */
 
 #ifndef _NDIS_VAR_H_
@@ -443,7 +443,7 @@
 
 struct ndis_80211_bssid_list_ex {
 	uint32_t		nblx_items;
-	ndis_wlan_bssid		nblx_bssid[1];
+	ndis_wlan_bssid_ex	nblx_bssid[1];
 };
 
 typedef struct ndis_80211_bssid_list_ex ndis_80211_bssid_list_ex;
@@ -808,7 +808,7 @@
  */
 struct ndis_miniport_interrupt {
 	void			*ni_introbj;
-	ndis_spin_lock		ni_dpccountlock;
+	ndis_kspin_lock		ni_dpccountlock;
 	void			*ni_rsvd;
 	void			*ni_isrfunc;
 	void			*ni_dpcfunc;
@@ -919,6 +919,10 @@
 #define NDIS_FLAGS_SENT_AT_DPC                  0x00001000
 #define NDIS_FLAGS_USES_SG_BUFFER_LIST          0x00002000
 
+#define NDIS_PACKET_WRAPPER_RESERVED			0x3F
+#define NDIS_PACKET_CONTAINS_MEDIA_SPECIFIC_INFO	0x40
+#define NDIS_PACKET_ALLOCATED_BY_NDIS			0x80
+
 #define NDIS_PROTOCOL_ID_DEFAULT        0x00
 #define NDIS_PROTOCOL_ID_TCP_IP         0x02
 #define NDIS_PROTOCOL_ID_IPX            0x06
@@ -1157,6 +1161,14 @@
 
 TAILQ_HEAD(nte_head, ndis_timer_entry);
 
+struct ndis_fh {
+	void			*nf_vp;
+	void			*nf_map;
+	uint32_t		nf_maplen; 
+};
+
+typedef struct ndis_fh ndis_fh;
+
 /*
  * The miniport block is basically the internal NDIS handle. We need
  * to define this because, unfortunately, it is not entirely opaque

==== //depot/projects/smpng/sys/compat/ndis/subr_hal.c#3 (text+ko) ====

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_hal.c,v 1.3 2004/01/03 09:20:48 wpaul Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_hal.c,v 1.4 2004/01/12 03:49:20 wpaul Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -82,6 +82,8 @@
 __stdcall static uint8_t hal_irql(void);
 __stdcall static void dummy (void);
 
+extern struct mtx_pool *ndis_mtxpool;
+
 __stdcall static void
 hal_stall_exec_cpu(usecs)
 	uint32_t		usecs;
@@ -211,7 +213,7 @@
 
 	__asm__ __volatile__ ("" : "=c" (lock));
 
-	mtx_lock((struct mtx *)*lock);
+	mtx_pool_lock(ndis_mtxpool, (struct mtx *)*lock);
 	return(0);
 }
 
@@ -223,7 +225,7 @@
 
 	__asm__ __volatile__ ("" : "=c" (lock), "=d" (newiqrl));
 
-	mtx_unlock((struct mtx *)*lock);
+	mtx_pool_unlock(ndis_mtxpool, (struct mtx *)*lock);
 	return;
 }
 

==== //depot/projects/smpng/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.27 2004/01/06 18:06:54 wpaul Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ndis.c,v 1.34 2004/01/13 01:12:28 wpaul Exp $");
 
 /*
  * This file implements a translation layer between the BSD networking
@@ -65,6 +65,10 @@
 #include <sys/smp.h>
 #include <sys/queue.h>
 #include <sys/taskqueue.h>
+#include <sys/proc.h>
+#include <sys/namei.h>
+#include <sys/fcntl.h>
+#include <sys/vnode.h>
 
 #include <net/if.h>
 #include <net/if_arp.h>
@@ -72,6 +76,7 @@
 #include <net/if_dl.h>
 #include <net/if_media.h>
 
+#include <machine/atomic.h>
 #include <machine/bus_memio.h>
 #include <machine/bus_pio.h>
 #include <machine/bus.h>
@@ -98,7 +103,12 @@
 #define __stdcall __attribute__((__stdcall__))
 #define FUNC void(*)(void)
 
-static struct mtx ndis_interlock;
+static struct mtx *ndis_interlock;
+static char ndis_filepath[MAXPATHLEN];
+struct mtx_pool *ndis_mtxpool;
+
+SYSCTL_STRING(_hw, OID_AUTO, ndis_filepath, CTLFLAG_RW, ndis_filepath,
+        MAXPATHLEN, "Path used by NdisOpenFile() to search for files");
 
 __stdcall static void ndis_initwrap(ndis_handle,
 	ndis_driver_object *, void *, void *);
@@ -269,16 +279,17 @@
 int
 ndis_libinit()
 {
-	mtx_init(&ndis_interlock, "ndislock", MTX_NETWORK_LOCK,
-	    MTX_DEF | MTX_RECURSE | MTX_DUPOK);
-
+	strcpy(ndis_filepath, "/compat/ndis");
+	ndis_mtxpool = mtx_pool_create("ndis mutex pool",
+	    1024, MTX_DEF | MTX_RECURSE | MTX_DUPOK);;
+	ndis_interlock = mtx_pool_alloc(ndis_mtxpool);
 	return(0);
 }
 
 int
 ndis_libfini()
 {
-	mtx_destroy(&ndis_interlock);
+	mtx_pool_destroy(&ndis_mtxpool);
 	return(0);
 }
 
@@ -668,15 +679,7 @@
 ndis_create_lock(lock)
 	ndis_spin_lock		*lock;
 {
-	struct mtx		*mtx;
-
-	mtx = malloc(sizeof(struct mtx), M_DEVBUF, M_NOWAIT|M_ZERO);
-	if (mtx == NULL)
-		return;
-	mtx_init(mtx, "ndislock", "ndis spin lock",
-	    MTX_DEF | MTX_RECURSE | MTX_DUPOK);
-	lock->nsl_spinlock = (ndis_kspin_lock)mtx;
-
+	lock->nsl_spinlock = (ndis_kspin_lock)mtx_pool_alloc(ndis_mtxpool);
 	return;
 }
 
@@ -684,13 +687,7 @@
 ndis_destroy_lock(lock)
 	ndis_spin_lock		*lock;
 {
-	struct mtx		*ndis_mtx;
-
-	ndis_mtx = (struct mtx *)lock->nsl_spinlock;
-	mtx_destroy(ndis_mtx);
-	free(ndis_mtx, M_DEVBUF);
-	lock->nsl_spinlock = 0xdeadf00d; /* XXX */
-
+	/* We use a mutex pool, so this is a no-op. */
 	return;
 }
 
@@ -698,32 +695,7 @@
 ndis_lock(lock)
 	ndis_spin_lock		*lock;
 {
-	if (lock == NULL)
-		return;
-	/*
-	 * Workaround for certain broken NDIS drivers. I have
-	 * encountered one case where a driver creates a spinlock
-	 * within its DriverEntry() routine, which is then destroyed
-	 * in its MiniportHalt() routine. This is a bug, because
-	 * MiniportHalt() is meant to only destroy what MiniportInit()
-	 * creates. This leads to the following problem:
-	 *     DriverEntry() <- spinlock created
-	 *     MiniportInit() <- NIC initialized
-	 *     MiniportHalt() <- NIC halted, spinlock destroyed
-	 *     MiniportInit() <- NIC initialized, spinlock not recreated
-	 *     NdisAcquireSpinLock(boguslock) <- panic
-	 * To work around this, we poison the spinlock on destroy, and
-	 * if we try to re-acquire the poison pill^Wspinlock, we init
-	 * it again so subsequent calls will work.
-	 *
-	 * Drivers that behave in this way are likely not officially
-	 * certified by Microsoft, since their I would expect the
-	 * Microsoft NDIS test tool to catch mistakes like this.
-	 */
-	if (lock->nsl_spinlock == 0xdeadf00d)
-		ndis_create_lock(lock);
-	mtx_lock((struct mtx *)lock->nsl_spinlock);
-
+	mtx_pool_lock(ndis_mtxpool, (struct mtx *)lock->nsl_spinlock);
 	return;
 }
 
@@ -731,10 +703,7 @@
 ndis_unlock(lock)
 	ndis_spin_lock		*lock;
 {
-	if (lock == NULL)
-		return;
-	mtx_unlock((struct mtx *)lock->nsl_spinlock);
-
+	mtx_pool_unlock(ndis_mtxpool, (struct mtx *)lock->nsl_spinlock);
 	return;
 }
 
@@ -789,6 +758,7 @@
  * The errorlog routine uses a variable argument list, so we
  * have to declare it this way.
  */
+#define ERRMSGLEN 512
 static void
 ndis_syslog(ndis_handle adapter, ndis_error_code code,
 	uint32_t numerrors, ...)
@@ -798,12 +768,15 @@
 	int			i, error;
 	char			*str = NULL, *ustr = NULL;
 	uint16_t		flags;
+	char			msgbuf[ERRMSGLEN];
 
 	block = (ndis_miniport_block *)adapter;
 
 	error = pe_get_message(block->nmb_img, code, &str, &i, &flags);
 	if (error == 0 && flags & MESSAGE_RESOURCE_UNICODE) {
-		ndis_unicode_to_ascii((uint16_t *)str, i, &ustr);
+		ustr = msgbuf;
+		ndis_unicode_to_ascii((uint16_t *)str,
+		    ((i / 2)) > (ERRMSGLEN - 1) ? ERRMSGLEN : i, &ustr);
 		str = ustr;
 	}
 	device_printf (block->nmb_dev, "NDIS ERROR: %x (%s)\n", code,
@@ -816,8 +789,6 @@
 		    va_arg(ap, void *));
 	va_end(ap);
 
-	if (ustr != NULL)
-		free(ustr, M_DEVBUF);
 	return;
 }
 
@@ -1098,7 +1069,8 @@
 	if (sc->ndis_res_io == NULL)
 		return(NDIS_STATUS_FAILURE);
 
-	if (rman_get_size(sc->ndis_res_io) != numports)
+	/* Don't let the device map more ports than we have. */
+	if (rman_get_size(sc->ndis_res_io) < numports)
 		return(NDIS_STATUS_INVALID_LENGTH);
 
 	*offset = (void *)rman_get_start(sc->ndis_res_io);
@@ -1536,6 +1508,13 @@
 	pkt->np_private.npp_packetooboffset =
 	    offsetof(ndis_packet, np_oob);
 
+	/*
+	 * We must initialize the packet flags correctly in order
+	 * for the NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO() and
+	 * NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO() to work correctly.
+	 */
+	pkt->np_private.npp_ndispktflags = NDIS_PACKET_ALLOCATED_BY_NDIS;
+
 	*packet = pkt;
 
 	head->np_private.npp_count++;
@@ -1780,9 +1759,7 @@
 ndis_interlock_inc(addend)
 	uint32_t		*addend;
 {
-	mtx_lock(&ndis_interlock);
-	*addend++;
-	mtx_unlock(&ndis_interlock);
+	atomic_add_long((u_long *)addend, 1);
 	return(*addend);
 }
 
@@ -1790,9 +1767,7 @@
 ndis_interlock_dec(addend)
 	uint32_t		*addend;
 {
-	mtx_lock(&ndis_interlock);
-	*addend--;
-	mtx_unlock(&ndis_interlock);
+	atomic_subtract_long((u_long *)addend, 1);
 	return(*addend);
 }
 
@@ -2087,13 +2062,13 @@
 {
 	ndis_list_entry		*flink;
 
-	mtx_lock_spin((struct mtx *)lock->nsl_spinlock);
+	mtx_pool_lock(ndis_mtxpool, (struct mtx *)lock->nsl_spinlock);
 	flink = head->nle_flink;
 	entry->nle_flink = flink;
 	entry->nle_blink = head;
 	flink->nle_blink = entry;
 	head->nle_flink = entry;
-	mtx_unlock_spin((struct mtx *)lock->nsl_spinlock);
+	mtx_pool_unlock(ndis_mtxpool, (struct mtx *)lock->nsl_spinlock);
 
 	return(flink);
 }
@@ -2106,12 +2081,12 @@
 	ndis_list_entry		*flink;
 	ndis_list_entry		*entry;
 
-	mtx_lock_spin((struct mtx *)lock->nsl_spinlock);
+	mtx_pool_lock(ndis_mtxpool, (struct mtx *)lock->nsl_spinlock);
 	entry = head->nle_flink;
 	flink = entry->nle_flink;
 	head->nle_flink = flink;
 	flink->nle_blink = head;
-	mtx_unlock_spin((struct mtx *)lock->nsl_spinlock);
+	mtx_pool_unlock(ndis_mtxpool, (struct mtx *)lock->nsl_spinlock);
 
 	return(entry);
 }
@@ -2124,13 +2099,13 @@
 {
 	ndis_list_entry		*blink;
 
-	mtx_lock_spin((struct mtx *)lock->nsl_spinlock);
+	mtx_pool_lock(ndis_mtxpool, (struct mtx *)lock->nsl_spinlock);
 	blink = head->nle_blink;
 	entry->nle_flink = head;
 	entry->nle_blink = blink;
 	blink->nle_flink = entry;
 	head->nle_blink = entry;
-	mtx_unlock_spin((struct mtx *)lock->nsl_spinlock);
+	mtx_pool_unlock(ndis_mtxpool, (struct mtx *)lock->nsl_spinlock);
 
 	return(blink);
 }
@@ -2150,9 +2125,9 @@
 
 	sc = (struct ndis_softc *)intr->ni_block->nmb_ifp;
 	sync = syncfunc;
-	mtx_lock(&sc->ndis_intrmtx);
+	mtx_pool_lock(ndis_mtxpool, sc->ndis_intrmtx);
 	rval = sync(syncctx);
-	mtx_unlock(&sc->ndis_intrmtx);
+	mtx_pool_unlock(ndis_mtxpool, sc->ndis_intrmtx);
 
 	return(rval);
 }
@@ -2324,12 +2299,50 @@
 	ndis_physaddr		highestaddr;
 {
 	char			*afilename = NULL;
+	struct thread		*td = curthread;
+	struct nameidata	nd;
+	int			flags, error;
+	struct vattr		vat;
+	struct vattr		*vap = &vat;
+	ndis_fh			*fh;
+	char			path[MAXPATHLEN];
 
-	ndis_unicode_to_ascii(filename->nus_buf, filename->nus_len, &afilename);
-	printf("ndis_open_file(\"%s\", %ju)\n", afilename,
-	    highestaddr.np_quad);
+	ndis_unicode_to_ascii(filename->nus_buf,
+	    filename->nus_len, &afilename);
+
+	sprintf(path, "%s/%s", ndis_filepath, afilename);
 	free(afilename, M_DEVBUF);
-	*status = NDIS_STATUS_FILE_NOT_FOUND;
+
+	fh = malloc(sizeof(ndis_fh), M_TEMP, M_NOWAIT);
+	if (fh == NULL) {
+		*status = NDIS_STATUS_RESOURCES;
+		return;
+	}
+
+	mtx_lock(&Giant);
+	NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, path, td);
+
+	flags = FREAD;
+	error = vn_open(&nd, &flags, 0, -1);
+	if (error) {
+		mtx_unlock(&Giant);
+		*status = NDIS_STATUS_FILE_NOT_FOUND;
+		free(fh, M_TEMP);
+		return;
+	}
+
+	NDFREE(&nd, NDF_ONLY_PNBUF);
+
+	/* Get the file size. */
+	VOP_GETATTR(nd.ni_vp, vap, NOCRED, td);
+	VOP_UNLOCK(nd.ni_vp, 0, td);
+	mtx_unlock(&Giant);
+
+	fh->nf_vp = nd.ni_vp;
+	fh->nf_map = NULL;
+	*filehandle = fh;
+	*filelength = fh->nf_maplen = vap->va_size & 0xFFFFFFFF;
+	*status = NDIS_STATUS_SUCCESS;
 	return;
 }
 
@@ -2339,8 +2352,46 @@
 	void			**mappedbuffer;

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



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