PERFORCE change 106596 for review

Alex Lyashkov als at FreeBSD.org
Sun Sep 24 05:18:55 PDT 2006


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

Change 106596 by als at als_head on 2006/09/24 12:18:28

	merge HEAD

Affected files ...

.. //depot/projects/jail2/sys/amd64/conf/NOTES#4 integrate
.. //depot/projects/jail2/sys/amd64/ia32/ia32_sigtramp.S#2 integrate
.. //depot/projects/jail2/sys/compat/freebsd32/freebsd32_proto.h#6 integrate
.. //depot/projects/jail2/sys/compat/freebsd32/freebsd32_syscall.h#6 integrate
.. //depot/projects/jail2/sys/compat/freebsd32/freebsd32_syscalls.c#6 integrate
.. //depot/projects/jail2/sys/compat/freebsd32/freebsd32_sysent.c#6 integrate
.. //depot/projects/jail2/sys/compat/freebsd32/syscalls.master#6 integrate
.. //depot/projects/jail2/sys/compat/linux/linux_file.c#4 integrate
.. //depot/projects/jail2/sys/compat/linux/linux_socket.c#3 integrate
.. //depot/projects/jail2/sys/conf/files.amd64#5 integrate
.. //depot/projects/jail2/sys/conf/files.i386#4 integrate
.. //depot/projects/jail2/sys/dev/acpica/Osd/OsdHardware.c#2 integrate
.. //depot/projects/jail2/sys/dev/bge/if_bge.c#6 integrate
.. //depot/projects/jail2/sys/dev/exca/exca.c#2 integrate
.. //depot/projects/jail2/sys/dev/ipmi/ipmi.c#2 integrate
.. //depot/projects/jail2/sys/dev/ipmi/ipmi_acpi.c#1 branch
.. //depot/projects/jail2/sys/dev/ipmi/ipmi_isa.c#1 branch
.. //depot/projects/jail2/sys/dev/ipmi/ipmi_kcs.c#1 branch
.. //depot/projects/jail2/sys/dev/ipmi/ipmi_pci.c#2 integrate
.. //depot/projects/jail2/sys/dev/ipmi/ipmi_smbios.c#2 integrate
.. //depot/projects/jail2/sys/dev/ipmi/ipmi_smbus.c#1 branch
.. //depot/projects/jail2/sys/dev/ipmi/ipmi_smic.c#1 branch
.. //depot/projects/jail2/sys/dev/ipmi/ipmi_ssif.c#1 branch
.. //depot/projects/jail2/sys/dev/ipmi/ipmivars.h#2 integrate
.. //depot/projects/jail2/sys/dev/sound/pcm/buffer.c#3 integrate
.. //depot/projects/jail2/sys/dev/sound/pcm/buffer.h#3 integrate
.. //depot/projects/jail2/sys/dev/sound/pcm/channel.c#2 integrate
.. //depot/projects/jail2/sys/dev/sound/pcm/channel.h#2 integrate
.. //depot/projects/jail2/sys/dev/sound/pcm/channel_if.m#2 integrate
.. //depot/projects/jail2/sys/dev/sound/pcm/dsp.c#2 integrate
.. //depot/projects/jail2/sys/dev/sound/pcm/dsp.h#2 integrate
.. //depot/projects/jail2/sys/dev/sound/pcm/mixer.c#2 integrate
.. //depot/projects/jail2/sys/dev/sound/pcm/mixer.h#3 integrate
.. //depot/projects/jail2/sys/dev/sound/pcm/sound.c#4 integrate
.. //depot/projects/jail2/sys/dev/sound/pcm/sound.h#3 integrate
.. //depot/projects/jail2/sys/i386/conf/NOTES#5 integrate
.. //depot/projects/jail2/sys/kern/kern_descrip.c#8 integrate
.. //depot/projects/jail2/sys/kern/kern_event.c#2 integrate
.. //depot/projects/jail2/sys/kern/kern_proc.c#4 integrate
.. //depot/projects/jail2/sys/kern/tty.c#4 integrate
.. //depot/projects/jail2/sys/kern/tty_pty.c#2 integrate
.. //depot/projects/jail2/sys/kern/tty_tty.c#2 integrate
.. //depot/projects/jail2/sys/kern/vfs_aio.c#4 integrate
.. //depot/projects/jail2/sys/modules/ipmi/Makefile#2 integrate
.. //depot/projects/jail2/sys/net/if_bridge.c#6 integrate
.. //depot/projects/jail2/sys/netinet/if_ether.c#3 integrate
.. //depot/projects/jail2/sys/netinet/tcp_input.c#5 integrate
.. //depot/projects/jail2/sys/sys/event.h#2 integrate
.. //depot/projects/jail2/sys/sys/ipmi.h#2 integrate
.. //depot/projects/jail2/sys/sys/mbuf.h#4 integrate
.. //depot/projects/jail2/sys/sys/param.h#4 integrate
.. //depot/projects/jail2/sys/sys/soundcard.h#2 integrate

Differences ...

==== //depot/projects/jail2/sys/amd64/conf/NOTES#4 (text+ko) ====

@@ -4,7 +4,7 @@
 # This file contains machine dependent kernel configuration notes.  For
 # machine independent notes, look in /sys/conf/NOTES.
 #
-# $FreeBSD: src/sys/amd64/conf/NOTES,v 1.58 2006/07/29 18:38:53 marcel Exp $
+# $FreeBSD: src/sys/amd64/conf/NOTES,v 1.59 2006/09/22 22:11:28 jhb Exp $
 #
 
 #
@@ -346,6 +346,7 @@
 #
 # Miscellaneous hardware:
 #
+# ipmi: Intelligent Platform Management Interface
 # smbios: DMI/SMBIOS entry point
 # vpd: Vital Product Data kernel interface
 # cy: Cyclades serial driver
@@ -368,6 +369,7 @@
 device		digi_Xe
 device		digi_Xem
 device		digi_Xr
+device		ipmi
 # Parallel (8255 PPI) basic I/O (mode 0) port (e.g. Advantech PCL-724)
 device		pbio
 hint.pbio.0.at="isa"

==== //depot/projects/jail2/sys/amd64/ia32/ia32_sigtramp.S#2 (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/amd64/ia32/ia32_sigtramp.S,v 1.2 2003/08/22 23:19:02 peter Exp $
+ * $FreeBSD: src/sys/amd64/ia32/ia32_sigtramp.S,v 1.3 2006/09/23 13:42:09 davidxu Exp $
  */
 
 #include "opt_compat.h"
@@ -45,8 +45,6 @@
 	calll	*IA32_SIGF_HANDLER(%esp)
 	leal	IA32_SIGF_UC(%esp),%eax	/* get ucontext */
 	pushl	%eax
-	movl	IA32_UC_GS(%eax),%gs	/* restore %gs */
-	movl	IA32_UC_FS(%eax),%fs	/* restore %fs */
 	movl	IA32_UC_ES(%eax),%es	/* restore %es */
 	movl	IA32_UC_DS(%eax),%ds	/* restore %ds */
 	movl	$SYS_sigreturn,%eax
@@ -62,8 +60,6 @@
 	calll	*IA32_SIGF_HANDLER(%esp)
 	leal	IA32_SIGF_UC4(%esp),%eax/* get ucontext */
 	pushl	%eax
-	movl	IA32_UC4_GS(%eax),%gs	/* restore %gs */
-	movl	IA32_UC4_FS(%eax),%fs	/* restore %fs */
 	movl	IA32_UC4_ES(%eax),%es	/* restore %es */
 	movl	IA32_UC4_DS(%eax),%ds	/* restore %ds */
 	movl	$344,%eax		/* 4.x SYS_sigreturn */

==== //depot/projects/jail2/sys/compat/freebsd32/freebsd32_proto.h#6 (text+ko) ====

@@ -2,8 +2,8 @@
  * System call prototypes.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/compat/freebsd32/freebsd32_proto.h,v 1.65 2006/09/22 15:05:33 davidxu Exp $
- * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.78 2006/09/22 15:04:28 davidxu Exp 
+ * $FreeBSD: src/sys/compat/freebsd32/freebsd32_proto.h,v 1.66 2006/09/23 00:27:53 davidxu Exp $
+ * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.79 2006/09/23 00:27:11 davidxu Exp 
  */
 
 #ifndef _FREEBSD32_SYSPROTO_H_

==== //depot/projects/jail2/sys/compat/freebsd32/freebsd32_syscall.h#6 (text+ko) ====

@@ -2,8 +2,8 @@
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscall.h,v 1.63 2006/09/22 15:05:33 davidxu Exp $
- * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.78 2006/09/22 15:04:28 davidxu Exp 
+ * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscall.h,v 1.64 2006/09/23 00:27:53 davidxu Exp $
+ * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.79 2006/09/23 00:27:11 davidxu Exp 
  */
 
 #define	FREEBSD32_SYS_syscall	0
@@ -300,6 +300,7 @@
 #define	FREEBSD32_SYS_freebsd32_getcontext	421
 #define	FREEBSD32_SYS_freebsd32_setcontext	422
 #define	FREEBSD32_SYS_freebsd32_swapcontext	423
+#define	FREEBSD32_SYS_sigwait	429
 #define	FREEBSD32_SYS_thr_exit	431
 #define	FREEBSD32_SYS_thr_self	432
 #define	FREEBSD32_SYS_thr_kill	433

==== //depot/projects/jail2/sys/compat/freebsd32/freebsd32_syscalls.c#6 (text+ko) ====

@@ -2,8 +2,8 @@
  * System call names.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscalls.c,v 1.54 2006/09/22 15:05:33 davidxu Exp $
- * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.78 2006/09/22 15:04:28 davidxu Exp 
+ * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscalls.c,v 1.55 2006/09/23 00:27:53 davidxu Exp $
+ * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.79 2006/09/23 00:27:11 davidxu Exp 
  */
 
 const char *freebsd32_syscallnames[] = {
@@ -436,7 +436,7 @@
 	"#426",			/* 426 = __acl_set_link */
 	"#427",			/* 427 = __acl_delete_link */
 	"#428",			/* 428 = __acl_aclcheck_link */
-	"#429",			/* 429 = sigwait */
+	"sigwait",			/* 429 = sigwait */
 	"#430",			/* 430 = thr_create; */
 	"thr_exit",			/* 431 = thr_exit */
 	"thr_self",			/* 432 = thr_self */

==== //depot/projects/jail2/sys/compat/freebsd32/freebsd32_sysent.c#6 (text+ko) ====

@@ -2,8 +2,8 @@
  * System call switch table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/compat/freebsd32/freebsd32_sysent.c,v 1.64 2006/09/22 15:05:34 davidxu Exp $
- * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.78 2006/09/22 15:04:28 davidxu Exp 
+ * $FreeBSD: src/sys/compat/freebsd32/freebsd32_sysent.c,v 1.65 2006/09/23 00:27:53 davidxu Exp $
+ * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.79 2006/09/23 00:27:11 davidxu Exp 
  */
 
 #include "opt_compat.h"
@@ -461,7 +461,7 @@
 	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 426 = __acl_set_link */
 	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 427 = __acl_delete_link */
 	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 428 = __acl_aclcheck_link */
-	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 429 = sigwait */
+	{ AS(sigwait_args), (sy_call_t *)sigwait, AUE_SIGWAIT, NULL, 0, 0 },	/* 429 = sigwait */
 	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 430 = thr_create; */
 	{ AS(thr_exit_args), (sy_call_t *)thr_exit, AUE_NULL, NULL, 0, 0 },	/* 431 = thr_exit */
 	{ AS(thr_self_args), (sy_call_t *)thr_self, AUE_NULL, NULL, 0, 0 },	/* 432 = thr_self */

==== //depot/projects/jail2/sys/compat/freebsd32/syscalls.master#6 (text+ko) ====

@@ -1,4 +1,4 @@
- $FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.78 2006/09/22 15:04:28 davidxu Exp $
+ $FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.79 2006/09/23 00:27:11 davidxu Exp $
 ;	from: @(#)syscalls.master	8.2 (Berkeley) 1/13/94
 ;	from: src/sys/kern/syscalls.master 1.107
 ;
@@ -714,7 +714,8 @@
 427	AUE_NULL	UNIMPL	__acl_delete_link
 428	AUE_NULL	UNIMPL	__acl_aclcheck_link
 ; XXX implement
-429	AUE_SIGWAIT	UNIMPL	sigwait
+429	AUE_SIGWAIT	NOPROTO	{ int sigwait(const sigset_t *set, \
+				    int *sig); }
 430	AUE_NULL	UNIMPL	thr_create;
 431	AUE_NULL	NOPROTO	{ void thr_exit(long *state); }
 432	AUE_NULL	NOPROTO	{ int thr_self(long *id); }

==== //depot/projects/jail2/sys/compat/linux/linux_file.c#4 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_file.c,v 1.97 2006/09/10 13:47:56 netchild Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_file.c,v 1.98 2006/09/23 19:06:54 netchild Exp $");
 
 #include "opt_compat.h"
 #include "opt_mac.h"
@@ -49,6 +49,7 @@
 #include <sys/syscallsubr.h>
 #include <sys/sysproto.h>
 #include <sys/tty.h>
+#include <sys/unistd.h>
 #include <sys/vnode.h>
 
 #include <ufs/ufs/extattr.h>
@@ -480,6 +481,10 @@
 	char *path;
 	int error;
 
+	/* linux convention */
+	if (args->flags & ~(F_OK | X_OK | W_OK | R_OK))
+		return (EINVAL);
+
 	LCONVPATHEXIST(td, args->path, &path);
 
 #ifdef DEBUG
@@ -488,6 +493,7 @@
 #endif
 	error = kern_access(td, path, UIO_SYSSPACE, args->flags);
 	LFREEPATH(path);
+
 	return (error);
 }
 
@@ -724,12 +730,28 @@
 	struct linux_pread_args *uap;
 {
 	struct pread_args bsd;
+	struct vnode *vp;
+	int error;
 
 	bsd.fd = uap->fd;
 	bsd.buf = uap->buf;
 	bsd.nbyte = uap->nbyte;
 	bsd.offset = uap->offset;
-	return pread(td, &bsd);
+
+	error = pread(td, &bsd);
+
+	if (error == 0) {
+   	   	/* This seems to violate POSIX but linux does it */
+   	   	if ((error = fgetvp(td, uap->fd, &vp)) != 0)
+   		   	return (error);
+		if (vp->v_type == VDIR) {
+   		   	vrele(vp);
+			return (EISDIR);
+		}
+		vrele(vp);
+	}
+
+	return (error);
 }
 
 int

==== //depot/projects/jail2/sys/compat/linux/linux_socket.c#3 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_socket.c,v 1.70 2006/07/19 18:28:52 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_socket.c,v 1.71 2006/09/23 19:06:54 netchild Exp $");
 
 /* XXX we use functions that might not exist. */
 #include "opt_compat.h"
@@ -611,6 +611,8 @@
 
 	error = kern_bind(td, linux_args.s, sa);
 	free(sa, M_SONAME);
+	if (error == EADDRNOTAVAIL && linux_args.namelen != sizeof(struct sockaddr_in))
+	   	return (EINVAL);
 	return (error);
 }
 
@@ -719,8 +721,11 @@
 	bsd_args.anamelen = PTRIN(linux_args.namelen);/* XXX */
 	error = accept(td, &bsd_args);
 	bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.name);
-	if (error)
+	if (error) {
+	   	if (error == EFAULT && linux_args.namelen != sizeof(struct sockaddr_in))
+		   	return (EINVAL);
 		return (error);
+	}
 	if (linux_args.addr) {
 		error = linux_sa_put(PTRIN(linux_args.addr));
 		if (error) {
@@ -1135,7 +1140,7 @@
 		break;
 	}
 	if (name == -1)
-		return (EINVAL);
+		return (ENOPROTOOPT);
 
 	bsd_args.name = name;
 	bsd_args.val = PTRIN(linux_args.optval);

==== //depot/projects/jail2/sys/conf/files.amd64#5 (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.93 2006/09/05 16:55:12 anholt Exp $
+# $FreeBSD: src/sys/conf/files.amd64,v 1.94 2006/09/22 22:11:28 jhb Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -161,7 +161,13 @@
 dev/if_ndis/if_ndis_usb.c	optional	ndis usb
 dev/io/iodev.c			optional	io
 dev/ipmi/ipmi.c			optional	ipmi
-dev/ipmi/ipmi_smbios.c		optional	ipmi isa
+dev/ipmi/ipmi_acpi.c		optional	ipmi acpi
+dev/ipmi/ipmi_isa.c		optional	ipmi isa
+dev/ipmi/ipmi_kcs.c		optional	ipmi
+dev/ipmi/ipmi_smic.c		optional	ipmi
+dev/ipmi/ipmi_smbus.c		optional	ipmi smbus
+dev/ipmi/ipmi_smbios.c		optional	ipmi
+dev/ipmi/ipmi_ssif.c		optional	ipmi smbus
 dev/ipmi/ipmi_pci.c		optional	ipmi pci
 dev/fdc/fdc.c			optional	fdc
 dev/fdc/fdc_acpi.c		optional	fdc

==== //depot/projects/jail2/sys/conf/files.i386#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.i386,v 1.565 2006/08/15 12:54:28 netchild Exp $
+# $FreeBSD: src/sys/conf/files.i386,v 1.566 2006/09/22 22:11:28 jhb Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -196,7 +196,13 @@
 dev/if_ndis/if_ndis_usb.c	optional ndis usb
 dev/io/iodev.c			optional io
 dev/ipmi/ipmi.c			optional ipmi
-dev/ipmi/ipmi_smbios.c		optional ipmi isa
+dev/ipmi/ipmi_acpi.c		optional ipmi acpi
+dev/ipmi/ipmi_isa.c		optional ipmi isa
+dev/ipmi/ipmi_kcs.c		optional ipmi
+dev/ipmi/ipmi_smic.c		optional ipmi
+dev/ipmi/ipmi_smbus.c		optional ipmi smbus
+dev/ipmi/ipmi_smbios.c		optional ipmi
+dev/ipmi/ipmi_ssif.c		optional ipmi smbus
 dev/ipmi/ipmi_pci.c		optional ipmi pci
 dev/kbd/kbd.c			optional atkbd | sc | ukbd | vt
 dev/le/if_le_isa.c		optional le isa

==== //depot/projects/jail2/sys/dev/acpica/Osd/OsdHardware.c#2 (text+ko) ====

@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/Osd/OsdHardware.c,v 1.20 2006/04/04 02:22:38 njl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/Osd/OsdHardware.c,v 1.21 2006/09/24 09:39:17 hrs Exp $");
 
 #include <contrib/dev/acpica/acpi.h>
 
@@ -126,7 +126,9 @@
 
     error = acpi_os_check_port(InPort, Width);
     if (error != 0) {
-	printf("acpi: bad read from port 0x%03x (%d)\n", (int)InPort, Width);
+	if (bootverbose)
+		printf("acpi: bad read from port 0x%03x (%d)\n",
+			(int)InPort, Width);
 	if (error == -1)
 	    return (AE_BAD_PARAMETER);
     }
@@ -159,8 +161,9 @@
 
     error = acpi_os_check_port(OutPort, Width);
     if (error != 0) {
-	printf("acpi: bad write to port 0x%03x (%d), val %#x\n", (int)OutPort,
-	    Width, Value);
+	if (bootverbose)
+		printf("acpi: bad write to port 0x%03x (%d), val %#x\n",
+			(int)OutPort, Width, Value);
 	if (error == -1)
 	    return (AE_BAD_PARAMETER);
     }

==== //depot/projects/jail2/sys/dev/bge/if_bge.c#6 (text+ko) ====

@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.148 2006/09/18 22:18:21 jkim Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.149 2006/09/23 18:55:49 scottl Exp $");
 
 /*
  * Broadcom BCM570x family gigabit ethernet driver for FreeBSD.
@@ -79,6 +79,7 @@
 #include <sys/kernel.h>
 #include <sys/module.h>
 #include <sys/socket.h>
+#include <sys/sysctl.h>
 
 #include <net/if.h>
 #include <net/if_arp.h>
@@ -419,7 +420,16 @@
 DRIVER_MODULE(miibus, bge, miibus_driver, miibus_devclass, 0, 0);
 
 static int bge_fake_autoneg = 0;
+static int bge_allow_asf = 1;
+
 TUNABLE_INT("hw.bge.fake_autoneg", &bge_fake_autoneg);
+TUNABLE_INT("hw.bge.allow_asf", &bge_allow_asf);
+
+SYSCTL_NODE(_hw, OID_AUTO, bge, CTLFLAG_RD, 0, "BGE driver parameters");
+SYSCTL_INT(_hw_bge, OID_AUTO, fake_autoneg, CTLFLAG_RD, &bge_fake_autoneg, 0,
+	"Enable fake autonegotiation for certain blade systems");
+SYSCTL_INT(_hw_bge, OID_AUTO, allow_asf, CTLFLAG_RD, &bge_allow_asf, 0,
+	"Allow ASF mode if available");
 
 static uint32_t
 bge_readmem_ind(struct bge_softc *sc, int off)
@@ -2179,8 +2189,8 @@
 	}
 
 	sc->bge_asf_mode = 0;
-	if (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_SIG)
-	    == BGE_MAGIC_NUMBER) {
+	if (bge_allow_asf && (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_SIG)
+	    == BGE_MAGIC_NUMBER)) {
 		if (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_NICCFG)
 		    & BGE_HWCFG_ASF) {
 			sc->bge_asf_mode |= ASF_ENABLE;

==== //depot/projects/jail2/sys/dev/exca/exca.c#2 (text+ko) ====

@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/exca/exca.c,v 1.24 2006/03/09 16:28:24 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/exca/exca.c,v 1.25 2006/09/24 00:26:33 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -179,11 +179,7 @@
 	struct mem_map_index_st *map;
 	struct pccard_mem_handle *mem;
 	uint32_t offset;
-#if 0
-	int mem8 = (mem->kind == PCCARD_A_MEM_ATTR);
-#else
-	int mem8 = 1;
-#endif
+	int mem8 = 1 /* mem->kind == PCCARD_A_MEM_ATTR */;
 	
 	map = &mem_map_index[win];
 	mem = &sc->mem[win];

==== //depot/projects/jail2/sys/dev/ipmi/ipmi.c#2 (text) ====

@@ -25,24 +25,21 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ipmi/ipmi.c,v 1.3 2006/05/16 14:36:26 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ipmi/ipmi.c,v 1.4 2006/09/22 22:11:29 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/condvar.h>
+#include <sys/conf.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>
+#include <sys/module.h>
 #include <sys/poll.h>
+#include <sys/rman.h>
 #include <sys/selinfo.h>
-
-#include <sys/disk.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/rman.h>
+#include <sys/sysctl.h>
 #include <sys/watchdog.h>
-#include <sys/sysctl.h>
 
 #ifdef LOCAL_MODULE
 #include <ipmi.h>
@@ -52,29 +49,7 @@
 #include <dev/ipmi/ipmivars.h>
 #endif
 
-struct ipmi_done_list {
-	u_char		*data;
-	int		channel;
-	int		msgid;
-	int		len;
-	TAILQ_ENTRY(ipmi_done_list) list;
-};
-
-#define MAX_TIMEOUT 3 * hz
-
-static int ipmi_wait_for_ibf(device_t, int);
-static int ipmi_wait_for_obf(device_t, int);
-static void ipmi_clear_obf(device_t, int);
-static void ipmi_error(device_t);
-static void ipmi_check_read(device_t);
-static int ipmi_write(device_t, u_char *, int);
-static void ipmi_wait_for_tx_okay(device_t);
-static void ipmi_wait_for_rx_okay(device_t);
-static void ipmi_wait_for_not_busy(device_t);
-static void ipmi_set_busy(device_t);
-static int ipmi_ready_to_read(device_t);
 #ifdef IPMB
-static int ipmi_handle_attn(device_t dev);
 static int ipmi_ipmb_checksum(u_char, int);
 static int ipmi_ipmb_send_message(device_t, u_char, u_char, u_char,
      u_char, u_char, int)
@@ -92,11 +67,10 @@
 static int on = 1;
 SYSCTL_NODE(_hw, OID_AUTO, ipmi, CTLFLAG_RD, 0, "IPMI driver parameters");
 SYSCTL_INT(_hw_ipmi, OID_AUTO, on, CTLFLAG_RW,
-        &on, 0, "");
+	&on, 0, "");
 
 static struct cdevsw ipmi_cdevsw = {
 	.d_version =    D_VERSION,
-	.d_flags =      D_NEEDGIANT,
 	.d_open =	ipmi_open,
 	.d_close =	ipmi_close,
 	.d_ioctl =	ipmi_ioctl,
@@ -106,60 +80,126 @@
 
 MALLOC_DEFINE(M_IPMI, "ipmi", "ipmi");
 
-static	int
-ipmi_open(struct cdev *dev, int flags, int fmt, struct thread *td)
+static int
+ipmi_open(struct cdev *cdev, int flags, int fmt, struct thread *td)
 {
+	struct ipmi_device *dev;
 	struct ipmi_softc *sc;
 
 	if (!on)
-		return ENOENT;
+		return (ENOENT);
 
-	sc = dev->si_drv1;
-	if (sc->ipmi_refcnt) {
-		return EBUSY;
+	dev = cdev->si_drv1;
+	sc = dev->ipmi_softc;
+	IPMI_LOCK(sc);
+	if (dev->ipmi_open) {
+		IPMI_UNLOCK(sc);
+		return (EBUSY);
 	}
-	sc->ipmi_refcnt = 1;
+	dev->ipmi_open = 1;
+	IPMI_UNLOCK(sc);
 
-	return 0;
+	return (0);
 }
 
-static	int
-ipmi_poll(struct cdev *dev, int poll_events, struct thread *td)
+static int
+ipmi_poll(struct cdev *cdev, int poll_events, struct thread *td)
 {
+	struct ipmi_device *dev;
 	struct ipmi_softc *sc;
 	int revents = 0;
 
-	sc = dev->si_drv1;
+	dev = cdev->si_drv1;
+	sc = dev->ipmi_softc;
 
-	ipmi_check_read(sc->ipmi_dev);
-
+	IPMI_LOCK(sc);
 	if (poll_events & (POLLIN | POLLRDNORM)) {
-		if (!TAILQ_EMPTY(&sc->ipmi_done))
+		if (!TAILQ_EMPTY(&dev->ipmi_completed_requests))
 		    revents |= poll_events & (POLLIN | POLLRDNORM);
-		if (TAILQ_EMPTY(&sc->ipmi_done) && sc->ipmi_requests == 0) {
+		if (dev->ipmi_requests == 0)
 		    revents |= POLLERR;
-		}
 	}
 
 	if (revents == 0) {
 		if (poll_events & (POLLIN | POLLRDNORM))
-			selrecord(td, &sc->ipmi_select);
+			selrecord(td, &dev->ipmi_select);
 	}
+	IPMI_UNLOCK(sc);
+
+	return (revents);
+}
+
+static void
+ipmi_purge_completed_requests(struct ipmi_device *dev)
+{
+	struct ipmi_request *req;
 
-	return revents;
+	while (!TAILQ_EMPTY(&dev->ipmi_completed_requests)) {
+		req = TAILQ_FIRST(&dev->ipmi_completed_requests);
+		TAILQ_REMOVE(&dev->ipmi_completed_requests, req, ir_link);
+		dev->ipmi_requests--;
+		ipmi_free_request(req);
+	}
 }
 
-static	int
-ipmi_close(struct cdev *dev, int flags, int fmt, struct thread *td)
+static int
+ipmi_close(struct cdev *cdev, int flags, int fmt, struct thread *td)
 {
+	struct ipmi_request *req, *nreq;
+	struct ipmi_device *dev;
 	struct ipmi_softc *sc;
-	int error = 0;
+#ifdef CLONING
+	int bit;
+#endif
+
+	dev = cdev->si_drv1;
+	sc = dev->ipmi_softc;
+
+	IPMI_LOCK(sc);
+	if (dev->ipmi_requests) {
+		/* Throw away any pending requests for this device. */
+		TAILQ_FOREACH_SAFE(req, &sc->ipmi_pending_requests, ir_link,
+		    nreq) {
+			if (req->ir_owner == dev) {
+				TAILQ_REMOVE(&sc->ipmi_pending_requests, req,
+				    ir_link);
+				dev->ipmi_requests--;
+				ipmi_free_request(req);
+			}
+		}
+
+		/* Throw away any pending completed requests for this device. */
+		ipmi_purge_completed_requests(dev);
+
+		/*
+		 * If we still have outstanding requests, they must be stuck
+		 * in an interface driver, so wait for those to drain.
+		 */
+		dev->ipmi_closing = 1;
+		while (dev->ipmi_requests > 0) {
+			msleep(&dev->ipmi_requests, &sc->ipmi_lock, PWAIT,
+			    "ipmidrain", 0);
+			ipmi_purge_completed_requests(dev);
+		}
+	}
 
-	sc = dev->si_drv1;
+#ifdef CLONING
+	/* Detach this sub-device from the main driver. */
+	bit = minor(cdev) % 32;
+	sc->ipmi_cdev_mask &= ~(1 << bit);
+	TAILQ_REMOVE(&sc->ipmi_cdevs, dev, ipmi_link);
+	IPMI_UNLOCK(sc);
 
-	sc->ipmi_refcnt = 0;
+	/* Cleanup. */
+	cdev->si_drv1 = NULL;
+	free(dev, M_IPMI);
+	destroy_dev(cdev);
+#else
+	dev->ipmi_open = 0;
+	IPMI_UNLOCK(sc);
+#endif
 
-	return error;
+	return (0);
 }
 
 #ifdef IPMB
@@ -171,707 +211,384 @@
 	for (; len; len--) {
 		sum += *data++;
 	}
-	return -sum;
+	return (-sum);
 }
 
+/* XXX: Needs work */
 static int
 ipmi_ipmb_send_message(device_t dev, u_char channel, u_char netfn,
     u_char command, u_char seq, u_char *data, int data_len)
 {
-	u_char *temp;
 	struct ipmi_softc *sc = device_get_softc(dev);
+	struct ipmi_request *req;
+	u_char slave_addr = 0x52;
 	int error;
-	u_char slave_addr = 0x52;
 
-	temp = malloc(data_len + 10, M_IPMI, M_WAITOK);
-	bzero(temp, data_len + 10);
-	temp[0] = IPMI_APP_REQUEST << 2;
-	temp[1] = IPMI_SEND_MSG;
-	temp[2] = channel;
-	temp[3] = slave_addr;
-	temp[4] = netfn << 2;
-	temp[5] = ipmi_ipmb_check_sum(&temp[3], 2);
-	temp[6] = sc->ipmi_address;
-	temp[7] = seq << 2 | sc->ipmi_lun;
-	temp[8] = command;
+	req = ipmi_alloc_driver_request(IPMI_ADDR(IPMI_APP_REQUEST, 0),
+	    IPMI_SEND_MSG, data_len + 8, 0);
+	req->ir_request[0] = channel;
+	req->ir_request[1] = slave_addr;
+	req->ir_request[2] = IPMI_ADDR(netfn, 0);
+	req->ir_request[3] = ipmi_ipmb_checksum(&req->ir_request[1], 2);
+	req->ir_request[4] = sc->ipmi_address;
+	req->ir_request[5] = IPMI_ADDR(seq, sc->ipmi_lun);
+	req->ir_request[6] = command;
 
-	bcopy(data, &temp[9], data_len);
-	temp[data_len + 9] = ipmi_ipmb_check(&temp[6], data_len + 3);
-	ipmi_write(sc->ipmi_dev, temp, data_len + 9);
-	free(temp, M_IPMI);
+	bcopy(data, &req->ir_request[7], data_len);
+	temp[data_len + 7] = ipmi_ipmb_checksum(&req->ir_request[4],
+	    data_len + 3);
 
-	while (!ipmi_ready_to_read(dev))
-		DELAY(1000);
-	temp = malloc(IPMI_MAX_RX, M_IPMI, M_WAITOK);
-	bzero(temp, IPMI_MAX_RX);
-	error = ipmi_read(dev, temp, IPMI_MAX_RX);
-	free(temp, M_IPMI);
+	ipmi_submit_driver_request(sc, req);
+	error = req->ir_error;
+	ipmi_free_request(req);
 
-	return error;
+	return (error);
 }
 
 static int
-ipmi_handle_attn(device_t dev)
+ipmi_handle_attn(struct ipmi_softc *sc)
 {
-	u_char temp[IPMI_MAX_RX];
-	struct ipmi_softc *sc = device_get_softc(dev);
+	struct ipmi_request *req;
 	int error;
 
 	device_printf(sc->ipmi_dev, "BMC has a message\n");
-	temp[0] = IPMI_APP_REQUEST << 2;
-	temp[1] = IPMI_GET_MSG_FLAGS;
-	ipmi_write(sc->ipmi_dev, temp, 2);
-	while (!ipmi_ready_to_read(dev))
-		DELAY(1000);
-	bzero(temp, IPMI_MAX_RX);
-	error = ipmi_read(dev, temp, IPMI_MAX_RX);
+	req = ipmi_alloc_driver_request(IPMI_ADDR(IPMI_APP_REQUEST, 0),
+	    IPMI_GET_MSG_FLAGS, 0, 1);
+
+	ipmi_submit_driver_request(sc, req);
 
-	if (temp[2] == 0) {
-		if (temp[3] & IPMI_MSG_BUFFER_FULL) {
+	if (req->ir_error == 0 && req->ir_compcode == 0) {
+		if (req->ir_reply[0] & IPMI_MSG_BUFFER_FULL) {
 			device_printf(sc->ipmi_dev, "message buffer full");
 		}
-		if (temp[3] & IPMI_WDT_PRE_TIMEOUT) {
+		if (req->ir_reply[0] & IPMI_WDT_PRE_TIMEOUT) {
 			device_printf(sc->ipmi_dev,
 			    "watchdog about to go off");
 		}
-		if (temp[3] & IPMI_MSG_AVAILABLE) {
-			temp[0] = IPMI_APP_REQUEST << 2;
-			temp[1] = IPMI_GET_MSG;
-			ipmi_write(sc->ipmi_dev, temp, 2);
-			while (!ipmi_ready_to_read(dev))
-				DELAY(1000);
-			bzero(temp, IPMI_MAX_RX);
-			error = ipmi_read(dev, temp, IPMI_MAX_RX);
+		if (req->ir_reply[0] & IPMI_MSG_AVAILABLE) {
+			ipmi_free_request(req);
+
+			req = ipmi_alloc_driver_request(
+			    IPMI_ADDR(IPMI_APP_REQUEST, 0), IPMI_GET_MSG, 0,
+			    16);
 
 			device_printf(sc->ipmi_dev, "throw out message ");
 			dump_buf(temp, 16);
 		}
-	} else
-		return -1;
-	return error;
+	}
+	error = req->ir_error;
+	ipmi_free_request(req);
+
+	return (error);
 }
 #endif
 
-static int
-ipmi_ready_to_read(device_t dev)
-{
-	struct ipmi_softc *sc = device_get_softc(dev);
-	int status, flags;
-
-	if (sc->ipmi_bios_info.smic_mode) {
-		flags = INB(sc, sc->ipmi_smic_flags);
-#ifdef IPMB
-		if (flags & SMIC_STATUS_SMS_ATN) {
-			ipmi_handle_attn(dev);
-			return 0;
-		}
-#endif
-		if (flags & SMIC_STATUS_RX_RDY)
-			 return 1;
-	} else if (sc->ipmi_bios_info.kcs_mode) {
-		status = INB(sc, sc->ipmi_kcs_status_reg);
-#ifdef IPMB
-		if (status & KCS_STATUS_SMS_ATN) {
-			ipmi_handle_attn(dev);
-			return 0;
-		}
+#ifdef IPMICTL_SEND_COMMAND_32
+#define	PTRIN(p)	((void *)(uintptr_t)(p))
+#define	PTROUT(p)	((uintptr_t)(p))
 #endif
-		if (status & KCS_STATUS_OBF)
-			 return 1;
-	} else {
-		device_printf(dev,"Unsupported mode\n");
-	}
-
-	return 0;
-}
 
-void
-ipmi_intr(void *arg) {
-	device_t  dev = arg;
-
-	ipmi_check_read(dev);
-}
-
-static void
-ipmi_check_read(device_t dev){
-	struct ipmi_softc *sc = device_get_softc(dev);
-	struct ipmi_done_list *item;
-	int status;
-	u_char *temp;
-
-	if (!sc->ipmi_requests)
-		return;
-
-	untimeout((timeout_t *)ipmi_check_read, dev, sc->ipmi_timeout_handle);
-
-	if(ipmi_ready_to_read(dev)) {
-		sc->ipmi_requests--;
-		temp = malloc(IPMI_MAX_RX, M_IPMI, M_WAITOK);
-		bzero(temp, IPMI_MAX_RX);
-		status = ipmi_read(dev, temp, IPMI_MAX_RX);
-		item = malloc(sizeof(struct ipmi_done_list), M_IPMI, M_WAITOK);
-		bzero(item, sizeof(struct ipmi_done_list));
-		item->data = temp;
-		item->len  = status;
-		if (ticks - sc->ipmi_timestamp > MAX_TIMEOUT) {
-			device_printf(dev, "read timeout when ready\n");
-			TAILQ_INSERT_TAIL(&sc->ipmi_done, item, list);
-			selwakeup(&sc->ipmi_select);
-		} else if (status) {
-			TAILQ_INSERT_TAIL(&sc->ipmi_done, item, list);
-			selwakeup(&sc->ipmi_select);
-		}
-	} else {
-		if (ticks - sc->ipmi_timestamp > MAX_TIMEOUT) {
-			sc->ipmi_requests--;
-			device_printf(dev, "read timeout when not ready\n");
-			temp = malloc(IPMI_MAX_RX, M_IPMI, M_WAITOK);
-			bzero(temp, IPMI_MAX_RX);
-			sc->ipmi_busy = 0;
-			wakeup(&sc->ipmi_busy);
-			status = -1;
-			item = malloc(sizeof(struct ipmi_done_list),
-			    M_IPMI, M_WAITOK);
-			bzero(item, sizeof(struct ipmi_done_list));
-			item->data = temp;
-			item->len  = status;
-			TAILQ_INSERT_TAIL(&sc->ipmi_done, item, list);
-			selwakeup(&sc->ipmi_select);
-		}
-	}
-	if (sc->ipmi_requests)
-		sc->ipmi_timeout_handle
-			= timeout((timeout_t *)ipmi_check_read, dev, hz/30);
-}
-
 static int
-ipmi_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t data,
+ipmi_ioctl(struct cdev *cdev, u_long cmd, caddr_t data,
     int flags, struct thread *td)
 {
 	struct ipmi_softc *sc;
+	struct ipmi_device *dev;
+	struct ipmi_request *kreq;
 	struct ipmi_req *req = (struct ipmi_req *)data;
 	struct ipmi_recv *recv = (struct ipmi_recv *)data;
 	struct ipmi_addr addr;
-	struct ipmi_done_list *item;
-	u_char *temp;
+#ifdef IPMICTL_SEND_COMMAND_32
+	struct ipmi_req32 *req32 = (struct ipmi_req32 *)data;
+	struct ipmi_recv32 *recv32 = (struct ipmi_recv32 *)data;
+	union {
+		struct ipmi_req req;
+		struct ipmi_recv recv;
+	} thunk32;
+#endif
 	int error, len;
 
-	sc = dev->si_drv1;
+	dev = cdev->si_drv1;
+	sc = dev->ipmi_softc;
+
+#ifdef IPMICTL_SEND_COMMAND_32
+	/* Convert 32-bit structures to native. */
+	switch (cmd) {
+	case IPMICTL_SEND_COMMAND_32:
+		req = &thunk32.req;
+		req->addr = PTRIN(req32->addr);
+		req->addr_len = req32->addr_len;
+		req->msgid = req32->msgid;
+		req->msg.netfn = req32->msg.netfn;
+		req->msg.cmd = req32->msg.cmd;
+		req->msg.data_len = req32->msg.data_len;
+		req->msg.data = PTRIN(req32->msg.data);
+		break;
+	case IPMICTL_RECEIVE_MSG_TRUNC_32:
+	case IPMICTL_RECEIVE_MSG_32:
+		recv = &thunk32.recv;
+		recv->addr = PTRIN(recv32->addr);
+		recv->addr_len = recv32->addr_len;
+		recv->msg.data_len = recv32->msg.data_len;
+		recv->msg.data = PTRIN(recv32->msg.data);
+		break;
+	}
+#endif
 
 	switch (cmd) {
+#ifdef IPMICTL_SEND_COMMAND_32
+	case IPMICTL_SEND_COMMAND_32:
+#endif
 	case IPMICTL_SEND_COMMAND:
+		/*
+		 * XXX: Need to add proper handling of this.

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


More information about the p4-projects mailing list