CVS commit: src/sys/dev/acpi

2010-04-15 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Apr 15 07:02:24 UTC 2010

Modified Files:
src/sys/dev/acpi: acpi.c acpi_acad.c acpi_bat.c acpi_button.c
acpi_lid.c acpi_tz.c acpivar.h asus_acpi.c dalb_acpi.c smbus_acpi.c
sony_acpi.c thinkpad_acpi.c vald_acpi.c valz_acpi.c
src/sys/dev/acpi/wmi: wmi_acpi.c

Log Message:
As discussed with jmcneill@, install a global bus notification handler
that receives all notifications and deliver notifications to drivers via it.

Besides making the code more compact, this has several benefits:

  * Minimizes the direct interaction with ACPICA and provides a
central place that easier to audit.

  * Drivers do not need to wonder what type of notification handler
(ACPI_SYSTEM_NOTIFY or ACPI_DEVICE_NOTIFY) is appropriate.

  * As the bus handles the events, individual drivers do not need to guess
that EBUSY is the right thing to do when removal of the notify handler
fails upon detach.

  * This catches also bus-specific events. While these remain to be
unhandled, these are required for things like PCI hotplug and docking.

  * Drivers can not go and claim handles they do not own.

  * This makes it easier to catch unhandled events.


To generate a diff of this commit:
cvs rdiff -u -r1.174 -r1.175 src/sys/dev/acpi/acpi.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/acpi/acpi_acad.c
cvs rdiff -u -r1.99 -r1.100 src/sys/dev/acpi/acpi_bat.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/acpi/acpi_button.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/acpi/acpi_lid.c
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/acpi/acpi_tz.c
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/acpi/acpivar.h
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/acpi/asus_acpi.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/acpi/dalb_acpi.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/acpi/smbus_acpi.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/acpi/sony_acpi.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/acpi/thinkpad_acpi.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/acpi/vald_acpi.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/acpi/valz_acpi.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/acpi/wmi/wmi_acpi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpi.c
diff -u src/sys/dev/acpi/acpi.c:1.174 src/sys/dev/acpi/acpi.c:1.175
--- src/sys/dev/acpi/acpi.c:1.174	Thu Apr 15 04:03:38 2010
+++ src/sys/dev/acpi/acpi.c	Thu Apr 15 07:02:24 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi.c,v 1.174 2010/04/15 04:03:38 jruoho Exp $	*/
+/*	$NetBSD: acpi.c,v 1.175 2010/04/15 07:02:24 jruoho Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: acpi.c,v 1.174 2010/04/15 04:03:38 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: acpi.c,v 1.175 2010/04/15 07:02:24 jruoho Exp $);
 
 #include opt_acpi.h
 #include opt_pcifixup.h
@@ -175,6 +175,8 @@
 static void		acpi_rescan_capabilities(struct acpi_softc *);
 static int		acpi_print(void *aux, const char *);
 
+static void		acpi_notify_handler(ACPI_HANDLE, uint32_t, void *);
+
 static void		acpi_register_fixed_button(struct acpi_softc *, int);
 static void		acpi_deregister_fixed_button(struct acpi_softc *, int);
 static uint32_t		acpi_fixed_button_handler(void *);
@@ -449,6 +451,21 @@
 	if (ACPI_FAILURE(rv))
 		goto fail;
 
+	/*
+	 * Install global notify handlers.
+	 */
+	rv = AcpiInstallNotifyHandler(ACPI_ROOT_OBJECT,
+	ACPI_SYSTEM_NOTIFY, acpi_notify_handler, NULL);
+
+	if (ACPI_FAILURE(rv))
+		goto fail;
+
+	rv = AcpiInstallNotifyHandler(ACPI_ROOT_OBJECT,
+	ACPI_DEVICE_NOTIFY, acpi_notify_handler, NULL);
+
+	if (ACPI_FAILURE(rv))
+		goto fail;
+
 	acpi_active = 1;
 
 	/* Our current state is awake. */
@@ -502,8 +519,21 @@
 acpi_detach(device_t self, int flags)
 {
 	struct acpi_softc *sc = device_private(self);
+	ACPI_STATUS rv;
 	int rc;
 
+	rv = AcpiRemoveNotifyHandler(ACPI_ROOT_OBJECT,
+	ACPI_SYSTEM_NOTIFY, acpi_notify_handler);
+
+	if (ACPI_FAILURE(rv))
+		return EBUSY;
+
+	rv = AcpiRemoveNotifyHandler(ACPI_ROOT_OBJECT,
+	ACPI_DEVICE_NOTIFY, acpi_notify_handler);
+
+	if (ACPI_FAILURE(rv))
+		return EBUSY;
+
 	if ((rc = config_detach_children(self, flags)) != 0)
 		return rc;
 
@@ -609,10 +639,12 @@
 		if (ad == NULL)
 			return AE_NO_MEMORY;
 
+		ad-ad_device = NULL;
 		ad-ad_parent = sc-sc_dev;
-		ad-ad_devinfo = devinfo;
-		ad-ad_handle = handle;
+
 		ad-ad_type = type;
+		ad-ad_handle = handle;
+		ad-ad_devinfo = devinfo;
 
 		anu = (ACPI_NAME_UNION *)devinfo-Name;
 		ad-ad_name[4] = '\0';
@@ -1049,6 +1081,104 @@
 }
 
 /*
+ * Notify.
+ */
+static void
+acpi_notify_handler(ACPI_HANDLE handle, uint32_t event, void *aux)
+{
+	struct acpi_softc *sc = acpi_softc;
+	struct acpi_devnode *ad;
+
+	KASSERT(sc != NULL);
+	KASSERT(aux == NULL);
+	KASSERT(acpi_active != 0);
+
+	if (acpi_suspended != 0)
+		return;
+
+	/*
+	 *  System: 0x00 - 0x7F.
+	 *  Device: 0x80 - 0xFF.
+	 */
+	switch (event) {

CVS commit: src/share/man/man4

2010-04-15 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Apr 15 08:28:41 UTC 2010

Modified Files:
src/share/man/man4: cgd.4

Log Message:
Small markup changes.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/share/man/man4/cgd.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man4/cgd.4
diff -u src/share/man/man4/cgd.4:1.14 src/share/man/man4/cgd.4:1.15
--- src/share/man/man4/cgd.4:1.14	Wed Apr 14 13:06:45 2010
+++ src/share/man/man4/cgd.4	Thu Apr 15 08:28:41 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: cgd.4,v 1.14 2010/04/14 13:06:45 wiz Exp $
+.\ $NetBSD: cgd.4,v 1.15 2010/04/15 08:28:41 jruoho Exp $
 .\
 .\ Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd April 14, 2010
+.Dd April 15, 2010
 .Dt CGD 4
 .Os
 .Sh NAME
@@ -51,24 +51,35 @@
 .Ed
 .Pp
 The count argument defines how many
-.Nm Ns 's
-may be configured at a time.
+.Nm Ns
+devices may be configured at a time.
 .Ss Encryption Algorithms
 Currently the following cryptographic algorithms are supported:
 .Bl -tag -width indentxxx
-.It aes-cbc
-AES in CBC mode.
-AES uses a 128 bit blocksize and can accept keys of
-length 128, 192, or 256.
+.It Ic aes-cbc
+.Tn AES
+in
+.Tn CBC
+mode.
+.Tn AES
+uses a 128 bit blocksize and can accept keys of length 128, 192, or 256.
 The default key length is 128.
-.It 3des-cbc
-Triple DES in CBC mode.
-Triple DES uses a 64 bit blocksize and is
-performed in EDE3 mode with a 168 bit key.
-The key passed to the kernel
-is 192 bits but the parity bits are ignored.
-.It blowfish-cbc
-Blowfish in CBC mode.
+.It Ic 3des-cbc
+Triple
+.Tn DES
+in
+.Tn CBC
+mode.
+Triple
+.Tn DES
+uses a 64 bit blocksize and is performed in
+.Tn EDE3
+mode with a 168 bit key.
+The key passed to the kernel is 192 bits but the parity bits are ignored.
+.It Ic blowfish-cbc
+Blowfish in
+.Tn CBC
+mode.
 Blowfish uses a 64 bit blocksize and can accept keys between 40 and
 448 bits in multiples of 8.
 It is strongly encouraged that keys be at least 128 bits long.
@@ -76,24 +87,42 @@
 The default key length is 128 bits.
 .El
 .Ss IV Methods
-Currently, the following IV Methods are supported:
+Currently, the following
+.Tn IV
+Methods are supported:
 .Bl -tag -width encblkno1
-.It encblkno1
+.It Ic encblkno1
 This method  encrypts the block number of the physical disk block once with
-the cipher and key provided and uses the result as the IV for CBC mode.
-This method should ensure that each block has a different IV and that the IV
+the cipher and key provided and uses the result as the
+.Tn IV
+for
+.Tn CBC
+mode.
+This method should ensure that each block has a different
+.Tn IV
+and that the
+.Tn IV
 is reasonably unpredictable.
 This is the default method used by
 .Xr cgdconfig 8
-when configuring new
-.Nm Ns 's .
-.It encblkno8
-This is the original IV method used by
+when configuring a new
+.Nm Ns .
+.It Ic encblkno8
+This is the original
+.Tn IV
+method used by
 .Nm
 and provided for backward compatibility.
 It repeatedly encrypts the block number of the physical disk block
-eight times and uses the result as the IV for CBC mode.
-This method should ensure that each block has a different IV and that the IV
+eight times and uses the result as the
+.Tn IV
+for
+.Tn CBC
+mode.
+This method should ensure that each block has a different
+.Tn IV
+and that the
+.Tn IV
 is reasonably unpredictable.
 The eightfold encryption was not intended and causes a notable
 performance loss with little (if any) increase in security over a
@@ -107,24 +136,25 @@
 calls defined in
 .Xr sd 4 ,
 and also defines the following:
-.Bl -tag -width CGDIOCSET
-.It CGDIOCSET
-configure the
+.Bl -tag -width CGDIOCSET -offset indent
+.It Dv CGDIOCSET
+Configure the
 .Nm .
 This
 .Xr ioctl 2
 sets up the encryption parameters and points the
 .Nm
 at the underlying disk.
-.It CGDIOCCLR
-unconfigures the
+.It Dv CGDIOCCLR
+Unconfigure the
 .Nm .
 .El
 .Pp
 These
 .Xr ioctl 2 Ns 's
 and their associated data structures are defined in
-.Pa /usr/include/dev/cgdvar.h .
+.In dev/cgdvar.h
+header.
 .Sh WARNINGS
 It goes without saying that if you forget the passphrase that you used
 to configure a



CVS commit: src/share/man/man9

2010-04-15 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Apr 15 08:40:46 UTC 2010

Modified Files:
src/share/man/man9: cardbus.9 intro.9 pcmcia.9

Log Message:
Remove references to the deprecated powerhook_establish(9).


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/share/man/man9/cardbus.9
cvs rdiff -u -r1.12 -r1.13 src/share/man/man9/intro.9
cvs rdiff -u -r1.17 -r1.18 src/share/man/man9/pcmcia.9

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man9/cardbus.9
diff -u src/share/man/man9/cardbus.9:1.14 src/share/man/man9/cardbus.9:1.15
--- src/share/man/man9/cardbus.9:1.14	Thu Feb 25 00:50:52 2010
+++ src/share/man/man9/cardbus.9	Thu Apr 15 08:40:46 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: cardbus.9,v 1.14 2010/02/25 00:50:52 dyoung Exp $
+.\ $NetBSD: cardbus.9,v 1.15 2010/04/15 08:40:46 jruoho Exp $
 .\
 .\ Copyright (c) 2001 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd February 24, 2010
+.Dd April 15, 2010
 .Dt CARDBUS 9
 .Os
 .Sh NAME
@@ -294,7 +294,8 @@
 .Pp
 Since CardBus devices support dynamic configuration, drivers should
 make use of
-.Fn powerhook_establish 9 .
+.Fn pmf 9
+framework.
 Power can be applied and the interrupt handler should be established
 through this interface.
 .Sh DMA SUPPORT

Index: src/share/man/man9/intro.9
diff -u src/share/man/man9/intro.9:1.12 src/share/man/man9/intro.9:1.13
--- src/share/man/man9/intro.9:1.12	Thu Feb 11 18:23:32 2010
+++ src/share/man/man9/intro.9	Thu Apr 15 08:40:46 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: intro.9,v 1.12 2010/02/11 18:23:32 dyoung Exp $
+.\ $NetBSD: intro.9,v 1.13 2010/04/15 08:40:46 jruoho Exp $
 .\
 .\ Copyright (c) 1997, 2007 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd February 11, 2010
+.Dd April 15, 2010
 .Dt INTRO 9
 .Os
 .Sh NAME
@@ -112,9 +112,9 @@
 See
 .Xr cpu_need_resched 9 .
 .Pp
-Process scheduling subsystem.
+Common scheduler framework.
 See
-.Xr scheduler 9 .
+.Xr csf 9 .
 .Pp
 Software signal facilities.
 See
@@ -593,9 +593,9 @@
 See
 .Xr panic 9 .
 .Sh MISC
-Run all power hooks.
+Power management and inter-driver messaging.
 See
-.Xr dopowerhooks 9 .
+.Xr pmf 9 .
 .Pp
 Run all shutdown hooks.
 See
@@ -630,10 +630,6 @@
 See
 .Xr pmc 9 .
 .Pp
-Add or remove a power change hook.
-See
-.Xr powerhook_establish 9 .
-.Pp
 Add or remove a shutdown hook.
 See
 .Xr pmf 9 .

Index: src/share/man/man9/pcmcia.9
diff -u src/share/man/man9/pcmcia.9:1.17 src/share/man/man9/pcmcia.9:1.18
--- src/share/man/man9/pcmcia.9:1.17	Thu Mar 12 12:49:36 2009
+++ src/share/man/man9/pcmcia.9	Thu Apr 15 08:40:46 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: pcmcia.9,v 1.17 2009/03/12 12:49:36 joerg Exp $
+.\ $NetBSD: pcmcia.9,v 1.18 2010/04/15 08:40:46 jruoho Exp $
 .\
 .\ Copyright (c) 2001 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd November 2, 2005
+.Dd April 15, 2010
 .Dt PCMCIA 9
 .Os
 .Sh NAME
@@ -397,7 +397,8 @@
 .Pp
 Since PCMCIA devices support dynamic configuration, drivers should
 make use of
-.Fn powerhook_establish 9 .
+.Xr pmf 9
+framework.
 Power can be applied and the interrupt handler should be established
 through this interface.
 .Sh DMA SUPPORT



CVS commit: src/share/man/man4

2010-04-15 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Apr 15 09:56:56 UTC 2010

Modified Files:
src/share/man/man4: cgd.4

Log Message:
Leave space as usual after Nm.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/share/man/man4/cgd.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man4/cgd.4
diff -u src/share/man/man4/cgd.4:1.15 src/share/man/man4/cgd.4:1.16
--- src/share/man/man4/cgd.4:1.15	Thu Apr 15 08:28:41 2010
+++ src/share/man/man4/cgd.4	Thu Apr 15 09:56:56 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: cgd.4,v 1.15 2010/04/15 08:28:41 jruoho Exp $
+.\ $NetBSD: cgd.4,v 1.16 2010/04/15 09:56:56 wiz Exp $
 .\
 .\ Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -51,7 +51,7 @@
 .Ed
 .Pp
 The count argument defines how many
-.Nm Ns
+.Nm
 devices may be configured at a time.
 .Ss Encryption Algorithms
 Currently the following cryptographic algorithms are supported:
@@ -106,7 +106,7 @@
 This is the default method used by
 .Xr cgdconfig 8
 when configuring a new
-.Nm Ns .
+.Nm .
 .It Ic encblkno8
 This is the original
 .Tn IV



CVS commit: src/usr.bin/config

2010-04-15 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Apr 15 12:35:57 UTC 2010

Modified Files:
src/usr.bin/config: mkdevsw.c

Log Message:
output __arraycount instead of homegrown macro


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/config/mkdevsw.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/config/mkdevsw.c
diff -u src/usr.bin/config/mkdevsw.c:1.7 src/usr.bin/config/mkdevsw.c:1.8
--- src/usr.bin/config/mkdevsw.c:1.7	Tue Jan 20 18:20:48 2009
+++ src/usr.bin/config/mkdevsw.c	Thu Apr 15 12:35:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkdevsw.c,v 1.7 2009/01/20 18:20:48 drochner Exp $	*/
+/*	$NetBSD: mkdevsw.c,v 1.8 2010/04/15 12:35:57 pooka Exp $	*/
 
 /*
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -83,9 +83,7 @@
 	autogen_comment(fp, devsw.c);
 
 	fputs(#include sys/param.h\n
-		  #include sys/conf.h\n
-		  \n#define\tDEVSW_ARRAY_SIZE(x)\t
-		  (sizeof((x))/sizeof((x)[0]))\n, fp);
+		  #include sys/conf.h\n, fp);
 }
 
 /*
@@ -122,8 +120,8 @@
 
 	fputs(};\n\nconst struct bdevsw **bdevsw = bdevsw0;\n, fp);
 
-	fputs(const int sys_bdevsws = DEVSW_ARRAY_SIZE(bdevsw0);\n
-		  int max_bdevsws = DEVSW_ARRAY_SIZE(bdevsw0);\n, fp);
+	fputs(const int sys_bdevsws = __arraycount(bdevsw0);\n
+		  int max_bdevsws = __arraycount(bdevsw0);\n, fp);
 
 	fputs(\n/* device switch table for character device */\n, fp);
 
@@ -149,8 +147,8 @@
 
 	fputs(};\n\nconst struct cdevsw **cdevsw = cdevsw0;\n, fp);
 
-	fputs(const int sys_cdevsws = DEVSW_ARRAY_SIZE(cdevsw0);\n
-		  int max_cdevsws = DEVSW_ARRAY_SIZE(cdevsw0);\n, fp);
+	fputs(const int sys_cdevsws = __arraycount(cdevsw0);\n
+		  int max_cdevsws = __arraycount(cdevsw0);\n, fp);
 }
 
 /*
@@ -169,7 +167,7 @@
 	}
 	fputs(};\n\n
 		  struct devsw_conv *devsw_conv = devsw_conv0;\n
-		  int max_devsw_convs = DEVSW_ARRAY_SIZE(devsw_conv0);\n,
+		  int max_devsw_convs = __arraycount(devsw_conv0);\n,
 		  fp);
 }
 



CVS commit: src/sys/arch/alpha/pci

2010-04-15 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Apr 15 13:02:13 UTC 2010

Modified Files:
src/sys/arch/alpha/pci: apecs.c apecsvar.h

Log Message:
Share some attention with apecs(4).
 - Convert to CFATTACH_DECL_NEW().
 - Sprinkle static on functions.
 - Recycle now-empty-and/or-unused softc structures.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/alpha/pci/apecs.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/alpha/pci/apecsvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/alpha/pci/apecs.c
diff -u src/sys/arch/alpha/pci/apecs.c:1.49 src/sys/arch/alpha/pci/apecs.c:1.50
--- src/sys/arch/alpha/pci/apecs.c:1.49	Sat Mar 14 21:04:02 2009
+++ src/sys/arch/alpha/pci/apecs.c	Thu Apr 15 13:02:13 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: apecs.c,v 1.49 2009/03/14 21:04:02 dsl Exp $ */
+/* $NetBSD: apecs.c,v 1.50 2010/04/15 13:02:13 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: apecs.c,v 1.49 2009/03/14 21:04:02 dsl Exp $);
+__KERNEL_RCSID(0, $NetBSD: apecs.c,v 1.50 2010/04/15 13:02:13 jakllsch Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -97,23 +97,22 @@
 #include alpha/pci/pci_1000.h
 #endif
 
-int	apecsmatch(struct device *, struct cfdata *, void *);
-void	apecsattach(struct device *, struct device *, void *);
+static int apecsmatch(device_t, cfdata_t, void *);
+static void apecsattach(device_t, device_t, void *);
 
-CFATTACH_DECL(apecs, sizeof(struct apecs_softc),
-apecsmatch, apecsattach, NULL, NULL);
+CFATTACH_DECL_NEW(apecs, 0, apecsmatch, apecsattach, NULL, NULL);
 
 extern struct cfdriver apecs_cd;
 
-int	apecs_bus_get_window(int, int,
-	struct alpha_bus_space_translation *);
+static int apecs_bus_get_window(int, int,
+struct alpha_bus_space_translation *);
 
 /* There can be only one. */
 int apecsfound;
 struct apecs_config apecs_configuration;
 
-int
-apecsmatch(struct device *parent, struct cfdata *match, void *aux)
+static int
+apecsmatch(device_t parent, cfdata_t match, void *aux)
 {
 	struct mainbus_attach_args *ma = aux;
 
@@ -163,10 +162,9 @@
 	acp-ac_initted = 1;
 }
 
-void
-apecsattach(struct device *parent, struct device *self, void *aux)
+static void
+apecsattach(device_t parent, device_t self, void *aux)
 {
-	struct apecs_softc *sc = (struct apecs_softc *)self;
 	struct apecs_config *acp;
 	struct pcibus_attach_args pba;
 
@@ -177,7 +175,7 @@
 	 * set up the chipset's info; done once at console init time
 	 * (maybe), but doesn't hurt to do twice.
 	 */
-	acp = sc-sc_acp = apecs_configuration;
+	acp = apecs_configuration;
 	apecs_init(acp, 1);
 
 	apecs_dma_init(acp);
@@ -237,7 +235,7 @@
 	config_found_ia(self, pcibus, pba, pcibusprint);
 }
 
-int
+static int
 apecs_bus_get_window(int type, int window, struct alpha_bus_space_translation *abst)
 {
 	struct apecs_config *acp = apecs_configuration;

Index: src/sys/arch/alpha/pci/apecsvar.h
diff -u src/sys/arch/alpha/pci/apecsvar.h:1.9 src/sys/arch/alpha/pci/apecsvar.h:1.10
--- src/sys/arch/alpha/pci/apecsvar.h:1.9	Sat Mar 14 14:45:53 2009
+++ src/sys/arch/alpha/pci/apecsvar.h	Thu Apr 15 13:02:13 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: apecsvar.h,v 1.9 2009/03/14 14:45:53 dsl Exp $ */
+/* $NetBSD: apecsvar.h,v 1.10 2010/04/15 13:02:13 jakllsch Exp $ */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -58,12 +58,6 @@
 	int	ac_mallocsafe;
 };
 
-struct apecs_softc {
-	struct	device sc_dev;
-
-	struct	apecs_config *sc_acp;
-};
-
 void	apecs_init(struct apecs_config *, int);
 void	apecs_pci_init(pci_chipset_tag_t, void *);
 void	apecs_dma_init(struct apecs_config *);



CVS commit: src/sys/arch/ia64/conf

2010-04-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Thu Apr 15 13:13:57 UTC 2010

Modified Files:
src/sys/arch/ia64/conf: GENERIC

Log Message:
Add acpitz.
Enable MFS.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/ia64/conf/GENERIC

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/ia64/conf/GENERIC
diff -u src/sys/arch/ia64/conf/GENERIC:1.1 src/sys/arch/ia64/conf/GENERIC:1.2
--- src/sys/arch/ia64/conf/GENERIC:1.1	Mon Jul 20 04:41:36 2009
+++ src/sys/arch/ia64/conf/GENERIC	Thu Apr 15 13:13:57 2010
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1 2009/07/20 04:41:36 kiyohara Exp $
+# $NetBSD: GENERIC,v 1.2 2010/04/15 13:13:57 kiyohara Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.1 $
+#ident 		GENERIC-$Revision: 1.2 $
 
 maxusers	32		# estimated number of users
 
@@ -51,7 +51,7 @@
 
 # File systems
 file-system	FFS		# UFS
-#file-system 	MFS		# memory file system
+file-system 	MFS		# memory file system
 
 # These options enable verbose messages for several subsystems.
 # Warning, these may compile large string tables into the kernel!
@@ -74,6 +74,7 @@
 acpi0		at mainbus0
 
 # ACPI devices
+acpitz*		at acpi?		# ACPI Thermal Zone
 com*		at acpi?		# Serial communications interface
 
 # PCI bus support



CVS commit: src/sys/arch/hp700/hp700

2010-04-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Apr 15 14:33:22 UTC 2010

Modified Files:
src/sys/arch/hp700/hp700: mainbus.c

Log Message:
printf - aprint_normal


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/hp700/hp700/mainbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/hp700/hp700/mainbus.c
diff -u src/sys/arch/hp700/hp700/mainbus.c:1.64 src/sys/arch/hp700/hp700/mainbus.c:1.65
--- src/sys/arch/hp700/hp700/mainbus.c:1.64	Fri Apr  2 15:24:18 2010
+++ src/sys/arch/hp700/hp700/mainbus.c	Thu Apr 15 14:33:22 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.64 2010/04/02 15:24:18 skrll Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.65 2010/04/15 14:33:22 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.64 2010/04/02 15:24:18 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.65 2010/04/15 14:33:22 skrll Exp $);
 
 #include locators.h
 #include power.h
@@ -1594,7 +1594,7 @@
 		aprint_normal( hpa 0x%lx path , ca-ca_hpa);
 		for (n = 0 ; n  6 ; n++) {
 			if ( ca-ca_dp.dp_bc[n] = 0)
-printf( %d/, ca-ca_dp.dp_bc[n]);
+aprint_normal( %d/, ca-ca_dp.dp_bc[n]);
 		}
 		aprint_normal( %d, ca-ca_dp.dp_mod);
 		if (!pnp  ca-ca_irq = 0) {



CVS commit: src/sys/arch/hp700/hp700

2010-04-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Apr 15 14:34:25 UTC 2010

Modified Files:
src/sys/arch/hp700/hp700: mainbus.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/hp700/hp700/mainbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/hp700/hp700/mainbus.c
diff -u src/sys/arch/hp700/hp700/mainbus.c:1.65 src/sys/arch/hp700/hp700/mainbus.c:1.66
--- src/sys/arch/hp700/hp700/mainbus.c:1.65	Thu Apr 15 14:33:22 2010
+++ src/sys/arch/hp700/hp700/mainbus.c	Thu Apr 15 14:34:25 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.65 2010/04/15 14:33:22 skrll Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.66 2010/04/15 14:34:25 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.65 2010/04/15 14:33:22 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.66 2010/04/15 14:34:25 skrll Exp $);
 
 #include locators.h
 #include power.h
@@ -1592,11 +1592,11 @@
 		pnp, ca-ca_type.iodc_type, ca-ca_type.iodc_sv_model);
 	if (ca-ca_hpa) {
 		aprint_normal( hpa 0x%lx path , ca-ca_hpa);
-		for (n = 0 ; n  6 ; n++) {
-			if ( ca-ca_dp.dp_bc[n] = 0)
-aprint_normal( %d/, ca-ca_dp.dp_bc[n]);
+		for (n = 0; n  6; n++) {
+			if (ca-ca_dp.dp_bc[n] = 0)
+aprint_normal(%d/, ca-ca_dp.dp_bc[n]);
 		}
-		aprint_normal( %d, ca-ca_dp.dp_mod);
+		aprint_normal(%d, ca-ca_dp.dp_mod);
 		if (!pnp  ca-ca_irq = 0) {
 			aprint_normal( irq %d, ca-ca_irq);
 			if (ca-ca_type.iodc_type != HPPA_TYPE_BHA)



CVS commit: src/sys/dev/raidframe

2010-04-15 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Thu Apr 15 15:49:00 UTC 2010

Modified Files:
src/sys/dev/raidframe: rf_raid1.c

Log Message:
Fill in param[3] for succedents for bad disk 'i' rather than '0'.  Fortunately, 
nbad is never  1, so this bug never showed up anywhere.  Bug spotted by Jed 
Davis.  Thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/raidframe/rf_raid1.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/raidframe/rf_raid1.c
diff -u src/sys/dev/raidframe/rf_raid1.c:1.31 src/sys/dev/raidframe/rf_raid1.c:1.32
--- src/sys/dev/raidframe/rf_raid1.c:1.31	Sun Apr 20 20:42:32 2008
+++ src/sys/dev/raidframe/rf_raid1.c	Thu Apr 15 15:49:00 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_raid1.c,v 1.31 2008/04/20 20:42:32 oster Exp $	*/
+/*	$NetBSD: rf_raid1.c,v 1.32 2010/04/15 15:49:00 oster Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rf_raid1.c,v 1.31 2008/04/20 20:42:32 oster Exp $);
+__KERNEL_RCSID(0, $NetBSD: rf_raid1.c,v 1.32 2010/04/15 15:49:00 oster Exp $);
 
 #include rf_raid.h
 #include rf_raid1.h
@@ -485,7 +485,7 @@
 			wrBlock-succedents[i]-params[0].p = pda;
 			wrBlock-succedents[i]-params[1].p = pda-bufPtr;
 			wrBlock-succedents[i]-params[2].v = psID;
-			wrBlock-succedents[0]-params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY, which_ru);
+			wrBlock-succedents[i]-params[3].v = RF_CREATE_PARAM3(RF_IO_NORMAL_PRIORITY, which_ru);
 		}
 #if RF_ACC_TRACE  0
 		memset((char *) tracerec, 0, sizeof(tracerec));



CVS commit: src/external/bsd/iscsi

2010-04-15 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Thu Apr 15 18:21:29 UTC 2010

Added Files:
src/external/bsd/iscsi: mkdist

Log Message:
Add mkdist to build a distribution tarball based on the one in netpgp


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/external/bsd/iscsi/mkdist

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/external/bsd/iscsi/mkdist
diff -u /dev/null src/external/bsd/iscsi/mkdist:1.1
--- /dev/null	Thu Apr 15 18:21:29 2010
+++ src/external/bsd/iscsi/mkdist	Thu Apr 15 18:21:29 2010
@@ -0,0 +1,27 @@
+#! /bin/sh
+# $NetBSD: mkdist,v 1.1 2010/04/15 18:21:29 sborrill Exp $
+
+case $# in
+0)
+	t=$(date +%Y%m%d)
+	;;
+*)
+	t=$1
+	;;
+esac
+ac=ac.$$
+awk -F, -v t=$t '/AC_INIT/ {
+	printf(%s,[%s],%s\n, $1, t, $3)
+	next
+}
+{
+	print
+}' dist/configure.ac  $ac  mv $ac dist/configure.ac
+(cd dist  autoconf  autoheader)
+mv dist netbsd-iscsi-$t
+tar --exclude CVS --exclude .libs \
+--exclude autom4te.cache --exclude \*.lo \
+--exclude \*.o --exclude \*.la \
+--exclude \*~ \
+-cvzf netbsd-iscsi-$t.tar.gz netbsd-iscsi-$t
+mv netbsd-iscsi-$t dist



CVS commit: src/sys/kern

2010-04-15 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Apr 15 20:46:08 UTC 2010

Modified Files:
src/sys/kern: kern_syscall.c

Log Message:
will it include, that is the question

(to everyone's disappointment on some archs it didn't)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/kern/kern_syscall.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_syscall.c
diff -u src/sys/kern/kern_syscall.c:1.3 src/sys/kern/kern_syscall.c:1.4
--- src/sys/kern/kern_syscall.c:1.3	Wed Apr 14 15:15:37 2010
+++ src/sys/kern/kern_syscall.c	Thu Apr 15 20:46:08 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_syscall.c,v 1.3 2010/04/14 15:15:37 pooka Exp $	*/
+/*	$NetBSD: kern_syscall.c,v 1.4 2010/04/15 20:46:08 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_syscall.c,v 1.3 2010/04/14 15:15:37 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_syscall.c,v 1.4 2010/04/15 20:46:08 pooka Exp $);
 
 #include opt_modular.h
 
@@ -41,6 +41,7 @@
 
 #include sys/param.h
 #include sys/module.h
+#include sys/sched.h
 #include sys/syscall.h
 #include sys/syscallargs.h
 #include sys/syscallvar.h



CVS commit: src/external/bsd/iscsi

2010-04-15 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Thu Apr 15 20:56:32 UTC 2010

Modified Files:
src/external/bsd/iscsi/dist/src/lib: Makefile.am Makefile.in
src/external/bsd/iscsi/lib: shlib_version

Log Message:
Add --version-info libtool flag so that libiscsi.so major/minor can be kept
in sync with that in shlib_version.
Add a note in shlib_version as a reminder to update lib/Makefile.am (and
from there lib/Makefile.in).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/iscsi/dist/src/lib/Makefile.am \
src/external/bsd/iscsi/dist/src/lib/Makefile.in
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/iscsi/lib/shlib_version

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/iscsi/dist/src/lib/Makefile.am
diff -u src/external/bsd/iscsi/dist/src/lib/Makefile.am:1.2 src/external/bsd/iscsi/dist/src/lib/Makefile.am:1.3
--- src/external/bsd/iscsi/dist/src/lib/Makefile.am:1.2	Tue Jun 30 02:44:52 2009
+++ src/external/bsd/iscsi/dist/src/lib/Makefile.am	Thu Apr 15 20:56:32 2010
@@ -1,7 +1,9 @@
-## $NetBSD: Makefile.am,v 1.2 2009/06/30 02:44:52 agc Exp $
+## $NetBSD: Makefile.am,v 1.3 2010/04/15 20:56:32 sborrill Exp $
 
 AM_CFLAGS		= $(WARNCFLAGS)
 
+AM_LDFLAGS		= -version-info 0:2:0
+
 lib_LTLIBRARIES		= libiscsi.la
 
 libiscsi_la_CPPFLAGS	= -I$(top_srcdir)/include
Index: src/external/bsd/iscsi/dist/src/lib/Makefile.in
diff -u src/external/bsd/iscsi/dist/src/lib/Makefile.in:1.2 src/external/bsd/iscsi/dist/src/lib/Makefile.in:1.3
--- src/external/bsd/iscsi/dist/src/lib/Makefile.in:1.2	Wed Apr 14 19:52:20 2010
+++ src/external/bsd/iscsi/dist/src/lib/Makefile.in	Thu Apr 15 20:56:32 2010
@@ -190,6 +190,7 @@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 AM_CFLAGS = $(WARNCFLAGS)
+AM_LDFLAGS = -version-info 0:2:0
 lib_LTLIBRARIES = libiscsi.la
 libiscsi_la_CPPFLAGS = -I$(top_srcdir)/include
 libiscsi_la_SOURCES = \
@@ -209,6 +210,8 @@
 	util.c \
 	uuid.c
 
+libiscsi_la_LDFLAGS = -no-undefined -version-info 0:2:0
+
 man3_MANS = libiscsi.3
 dist_man_MANS = libiscsi.3
 all: all-am

Index: src/external/bsd/iscsi/lib/shlib_version
diff -u src/external/bsd/iscsi/lib/shlib_version:1.2 src/external/bsd/iscsi/lib/shlib_version:1.3
--- src/external/bsd/iscsi/lib/shlib_version:1.2	Thu Jun 25 13:47:12 2009
+++ src/external/bsd/iscsi/lib/shlib_version	Thu Apr 15 20:56:32 2010
@@ -1,5 +1,8 @@
-#   $NetBSD: shlib_version,v 1.2 2009/06/25 13:47:12 agc Exp $
+#   $NetBSD: shlib_version,v 1.3 2010/04/15 20:56:32 sborrill Exp $
 #   Remember to update distrib/sets/lists/base/shl.* when changing
 #
+#	Also update dist/src/lib/Makefile.am with the correct version number
+#	and regenerate dist/src/lib/Makefile.in
+
 major=2
 minor=0



CVS commit: src/distrib/utils/sysinst

2010-04-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 15 22:55:15 UTC 2010

Modified Files:
src/distrib/utils/sysinst: mbr.c

Log Message:
The 16bit bootmenu valid magic is slightly week, collisions have been
seen in the wild. So, before accepting arbitrary strings from there,
validate at least slightly and ignore if the entries are not properly
0 terminated or contain controll characters.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/distrib/utils/sysinst/mbr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/utils/sysinst/mbr.c
diff -u src/distrib/utils/sysinst/mbr.c:1.82 src/distrib/utils/sysinst/mbr.c:1.83
--- src/distrib/utils/sysinst/mbr.c:1.82	Sat Jan  2 21:16:46 2010
+++ src/distrib/utils/sysinst/mbr.c	Thu Apr 15 22:55:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbr.c,v 1.82 2010/01/02 21:16:46 dsl Exp $ */
+/*	$NetBSD: mbr.c,v 1.83 2010/04/15 22:55:15 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1394,6 +1394,45 @@
 	return unknown;
 }
 
+#ifdef BOOTSEL
+static int
+validate_and_set_names(mbr_info_t *mbri, const struct mbr_bootsel *src,
+uint32_t ext_base)
+{
+	size_t i, l;
+	const unsigned char *p;
+
+	/*
+	 * The 16 bit magic used to detect wether mbr_bootsel is valid
+	 * or not is pretty week - collisions have been seen in the wild;
+	 * but maybe it is just foreign tools corruption reminiscents
+	 * of NetBSD MBRs. Anyway, before accepting a boot menu definition,
+	 * make sure it is kinda sane.
+	 */
+
+	for (i = 0; i  MBR_PART_COUNT; i++) {
+		/*
+		 * Make sure the name does not contain controll chars
+		 * (not using iscntrl due to minimalistic locale support
+		 * in miniroot environments) and is properly 0-terminated.
+		 */
+		for (l = 0, p = (const unsigned char *)src-mbrbs_nametab[i];
+		*p != 0; l++, p++) {
+			if (l 	MBR_BS_PARTNAMESIZE)
+return 0;
+			if (*p  ' ')	/* hacky 'iscntrl' */
+return 0;
+		}
+	}
+
+	memcpy(mbri-mbrb, src, sizeof(*src));
+
+	if (ext_base == 0)
+		return mbri-mbrb.mbrbs_defkey - SCAN_1;
+	return 0;
+}
+#endif
+
 int
 read_mbr(const char *disk, mbr_info_t *mbri)
 {
@@ -1451,15 +1490,14 @@
 #if BOOTSEL
 		if (mbrs-mbr_bootsel_magic == htole16(MBR_MAGIC)) {
 			/* old bootsel, grab bootsel info */
-			mbri-mbrb = *(struct mbr_bootsel *)
-((uint8_t *)mbrs + MBR_BS_OLD_OFFSET);
-			if (ext_base == 0)
-bootkey = mbri-mbrb.mbrbs_defkey - SCAN_1;
+			bootkey = validate_and_set_names(mbri, 
+(struct mbr_bootsel *)
+((uint8_t *)mbrs + MBR_BS_OLD_OFFSET),
+ext_base);
 		} else if (mbrs-mbr_bootsel_magic == htole16(MBR_BS_MAGIC)) {
 			/* new location */
-			mbri-mbrb = mbrs-mbr_bootsel;
-			if (ext_base == 0)
-bootkey = mbri-mbrb.mbrbs_defkey - SCAN_1;
+			bootkey = validate_and_set_names(mbri,
+			mbrs-mbr_bootsel, ext_base);
 		}
 		/* Save original flags for mbr code update tests */
 		mbri-oflags = mbri-mbrb.mbrbs_flags;



CVS commit: src/external/intel-fw-public

2010-04-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 16 01:43:08 UTC 2010

Modified Files:
src/external/intel-fw-public: Makefile
src/external/intel-fw-public/iwl4965: Makefile
src/external/intel-fw-public/iwl5000: Makefile
src/external/intel-fw-public/iwl5000/dist: LICENSE.iwlwifi-5000-ucode
README.iwlwifi-5000-ucode
Added Files:
src/external/intel-fw-public/iwl4965/dist: iwlwifi-4965-2.ucode
src/external/intel-fw-public/iwl5000/dist: iwlwifi-5000-2.ucode
src/external/intel-fw-public/iwl5150: Makefile
src/external/intel-fw-public/iwl5150/dist: LICENSE.iwlwifi-5150-ucode
README.iwlwifi-5150-ucode iwlwifi-5150-2.ucode
Removed Files:
src/external/intel-fw-public/iwl4965/dist: iwlwifi-4965-1.ucode
src/external/intel-fw-public/iwl5000/dist: iwlwifi-5000-1.ucode

Log Message:
Update to the latest firmware.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/intel-fw-public/Makefile
cvs rdiff -u -r1.1 -r1.2 src/external/intel-fw-public/iwl4965/Makefile
cvs rdiff -u -r1.2 -r0 \
src/external/intel-fw-public/iwl4965/dist/iwlwifi-4965-1.ucode
cvs rdiff -u -r0 -r1.1 \
src/external/intel-fw-public/iwl4965/dist/iwlwifi-4965-2.ucode
cvs rdiff -u -r1.2 -r1.3 src/external/intel-fw-public/iwl5000/Makefile
cvs rdiff -u -r1.1 -r1.2 \
src/external/intel-fw-public/iwl5000/dist/LICENSE.iwlwifi-5000-ucode \
src/external/intel-fw-public/iwl5000/dist/README.iwlwifi-5000-ucode
cvs rdiff -u -r1.1 -r0 \
src/external/intel-fw-public/iwl5000/dist/iwlwifi-5000-1.ucode
cvs rdiff -u -r0 -r1.1 \
src/external/intel-fw-public/iwl5000/dist/iwlwifi-5000-2.ucode
cvs rdiff -u -r0 -r1.1 src/external/intel-fw-public/iwl5150/Makefile
cvs rdiff -u -r0 -r1.1 \
src/external/intel-fw-public/iwl5150/dist/LICENSE.iwlwifi-5150-ucode \
src/external/intel-fw-public/iwl5150/dist/README.iwlwifi-5150-ucode \
src/external/intel-fw-public/iwl5150/dist/iwlwifi-5150-2.ucode

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/intel-fw-public/Makefile
diff -u src/external/intel-fw-public/Makefile:1.2 src/external/intel-fw-public/Makefile:1.3
--- src/external/intel-fw-public/Makefile:1.2	Sat Mar 28 12:16:02 2009
+++ src/external/intel-fw-public/Makefile	Thu Apr 15 21:43:07 2010
@@ -1,5 +1,5 @@
-# $NetBSD: Makefile,v 1.2 2009/03/28 16:16:02 christos Exp $
+# $NetBSD: Makefile,v 1.3 2010/04/16 01:43:07 christos Exp $
 
-SUBDIR+=	ipw3945 iwl4965 iwl5000
+SUBDIR+=	ipw3945 iwl4965 iwl5000 iwl5150
 
 .include bsd.subdir.mk

Index: src/external/intel-fw-public/iwl4965/Makefile
diff -u src/external/intel-fw-public/iwl4965/Makefile:1.1 src/external/intel-fw-public/iwl4965/Makefile:1.2
--- src/external/intel-fw-public/iwl4965/Makefile:1.1	Wed Oct 29 20:27:32 2008
+++ src/external/intel-fw-public/iwl4965/Makefile	Thu Apr 15 21:43:08 2010
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.1 2008/10/30 00:27:32 joerg Exp $
+# $NetBSD: Makefile,v 1.2 2010/04/16 01:43:08 christos Exp $
 
 NOMAN=	# define
 
 FILES=	dist/LICENSE.iwlwifi-4965-ucode dist/README.iwlwifi-4965-ucode \
-	dist/iwlwifi-4965-1.ucode
+	dist/iwlwifi-4965-2.ucode
 
 FILESDIR=	/libdata/firmware/if_iwn
 

Index: src/external/intel-fw-public/iwl5000/Makefile
diff -u src/external/intel-fw-public/iwl5000/Makefile:1.2 src/external/intel-fw-public/iwl5000/Makefile:1.3
--- src/external/intel-fw-public/iwl5000/Makefile:1.2	Sun Mar 29 10:22:24 2009
+++ src/external/intel-fw-public/iwl5000/Makefile	Thu Apr 15 21:43:08 2010
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.2 2009/03/29 14:22:24 christos Exp $
+# $NetBSD: Makefile,v 1.3 2010/04/16 01:43:08 christos Exp $
 
 NOMAN=	# define
 
 FILES=	dist/LICENSE.iwlwifi-5000-ucode dist/README.iwlwifi-5000-ucode \
-	dist/iwlwifi-5000-1.ucode
+	dist/iwlwifi-5000-2.ucode
 
 FILESDIR=	/libdata/firmware/if_iwn
 

Index: src/external/intel-fw-public/iwl5000/dist/LICENSE.iwlwifi-5000-ucode
diff -u src/external/intel-fw-public/iwl5000/dist/LICENSE.iwlwifi-5000-ucode:1.1 src/external/intel-fw-public/iwl5000/dist/LICENSE.iwlwifi-5000-ucode:1.2
--- src/external/intel-fw-public/iwl5000/dist/LICENSE.iwlwifi-5000-ucode:1.1	Sat Mar 28 12:16:03 2009
+++ src/external/intel-fw-public/iwl5000/dist/LICENSE.iwlwifi-5000-ucode	Thu Apr 15 21:43:08 2010
@@ -1,4 +1,4 @@
-Copyright (c) 2006-2008, Intel Corporation.
+Copyright (c) 2006-2009, Intel Corporation.
 All rights reserved.
 
 Redistribution.  Redistribution and use in binary form, without 
Index: src/external/intel-fw-public/iwl5000/dist/README.iwlwifi-5000-ucode
diff -u src/external/intel-fw-public/iwl5000/dist/README.iwlwifi-5000-ucode:1.1 src/external/intel-fw-public/iwl5000/dist/README.iwlwifi-5000-ucode:1.2
--- src/external/intel-fw-public/iwl5000/dist/README.iwlwifi-5000-ucode:1.1	Sat Mar 28 12:16:03 2009
+++ src/external/intel-fw-public/iwl5000/dist/README.iwlwifi-5000-ucode	Thu 

CVS commit: src/distrib/sets/lists/base

2010-04-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 16 01:45:33 UTC 2010

Modified Files:
src/distrib/sets/lists/base: mi

Log Message:
new if_iwn firmware.


To generate a diff of this commit:
cvs rdiff -u -r1.860 -r1.861 src/distrib/sets/lists/base/mi

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.860 src/distrib/sets/lists/base/mi:1.861
--- src/distrib/sets/lists/base/mi:1.860	Mon Mar  8 01:40:06 2010
+++ src/distrib/sets/lists/base/mi	Thu Apr 15 21:45:33 2010
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.860 2010/03/08 06:40:06 lukem Exp $
+# $NetBSD: mi,v 1.861 2010/04/16 01:45:33 christos Exp $
 #
 # Note:	Don't delete entries from here - mark them as obsolete instead,
 #	unless otherwise stated below.
@@ -135,10 +135,15 @@
 ./libdata/firmware/if_iwn			base-firmware-root
 ./libdata/firmware/if_iwn/LICENSE.iwlwifi-4965-ucode	base-firmware-root
 ./libdata/firmware/if_iwn/README.iwlwifi-4965-ucode	base-firmware-root
-./libdata/firmware/if_iwn/iwlwifi-4965-1.ucode	base-firmware-root
+./libdata/firmware/if_iwn/iwlwifi-4965-1.ucode	base-obsolete		obsolete
+./libdata/firmware/if_iwn/iwlwifi-4965-2.ucode	base-firmware-root
 ./libdata/firmware/if_iwn/LICENSE.iwlwifi-5000-ucode	base-firmware-root
 ./libdata/firmware/if_iwn/README.iwlwifi-5000-ucode	base-firmware-root
-./libdata/firmware/if_iwn/iwlwifi-5000-1.ucode	base-firmware-root
+./libdata/firmware/if_iwn/iwlwifi-5000-1.ucode	base-obsolete		obsolete
+./libdata/firmware/if_iwn/iwlwifi-5000-2.ucode	base-firmware-root
+./libdata/firmware/if_iwn/LICENSE.iwlwifi-5150-ucode	base-firmware-root
+./libdata/firmware/if_iwn/README.iwlwifi-5150-ucode	base-firmware-root
+./libdata/firmware/if_iwn/iwlwifi-5150-2.ucode	base-firmware-root
 ./libdata/firmware/if_wpi			base-firmware-root
 ./libdata/firmware/if_wpi/LICENSE.ipw3945-ucode	base-obsolete	obsolete
 ./libdata/firmware/if_wpi/README.ipw3945-ucode	base-obsolete	obsolete



CVS commit: src/sys/dev/acpi

2010-04-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 16 01:52:54 UTC 2010

Modified Files:
src/sys/dev/acpi: acpi_bat.c acpi_tz.c

Log Message:
fix dmesg printing.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/dev/acpi/acpi_bat.c
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/acpi/acpi_tz.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpi_bat.c
diff -u src/sys/dev/acpi/acpi_bat.c:1.100 src/sys/dev/acpi/acpi_bat.c:1.101
--- src/sys/dev/acpi/acpi_bat.c:1.100	Thu Apr 15 03:02:24 2010
+++ src/sys/dev/acpi/acpi_bat.c	Thu Apr 15 21:52:54 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_bat.c,v 1.100 2010/04/15 07:02:24 jruoho Exp $	*/
+/*	$NetBSD: acpi_bat.c,v 1.101 2010/04/16 01:52:54 christos Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: acpi_bat.c,v 1.100 2010/04/15 07:02:24 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: acpi_bat.c,v 1.101 2010/04/16 01:52:54 christos Exp $);
 
 #include sys/param.h
 #include sys/condvar.h
@@ -424,7 +424,7 @@
 static void
 acpibat_print_info(device_t dv, ACPI_OBJECT *elm)
 {
-	const char *tech, *unit = Wh;
+	const char *tech, *unit;
 	int i;
 
 	for (i = ACPIBAT_BIF_OEM; i  ACPIBAT_BIF_GRANULARITY2; i--) {
@@ -437,18 +437,30 @@
 	}
 
 	tech = (elm[ACPIBAT_BIF_TECHNOLOGY].Integer.Value != 0) ?
-	secondary (rechargeable) : primary (non-rechargeable);
+	rechargeable : non-rechargeable;
 
-	if ((elm[ACPIBAT_BIF_UNIT].Integer.Value  ACPIBAT_PWRUNIT_MA) != 0)
-		unit = Ah;
-
-	aprint_normal_dev(dv, %s %s %s battery\n, tech,
+	aprint_normal_dev(dv, %s %s %s battery\n,
 	elm[ACPIBAT_BIF_OEM].String.Pointer,
-	elm[ACPIBAT_BIF_TYPE].String.Pointer);
+	elm[ACPIBAT_BIF_TYPE].String.Pointer, tech);
 
-	aprint_verbose_dev(dv, serial number %s, model number %s\n,
-	elm[ACPIBAT_BIF_SERIAL].String.Pointer,
-	elm[ACPIBAT_BIF_MODEL].String.Pointer);
+	if (elm[ACPIBAT_BIF_SERIAL].String.Pointer[0] ||
+	elm[ACPIBAT_BIF_MODEL].String.Pointer[0]) {
+		int comma;
+		aprint_verbose_dev(dv, );
+
+		if (elm[ACPIBAT_BIF_SERIAL].String.Pointer[0]) {
+			aprint_verbose(serial number %s,
+			elm[ACPIBAT_BIF_SERIAL].String.Pointer);
+			comma = 1;
+		} else
+			comma = 0;
+
+		if (elm[ACPIBAT_BIF_MODEL].String.Pointer[0])
+			aprint_verbose(%smodel number %s,
+			comma ? ,  : ,
+			elm[ACPIBAT_BIF_MODEL].String.Pointer);
+		aprint_verbose(\n);
+	}
 
 #define SCALE(x) (((int)x) / 100), int)x) % 100) / 1000)
 
@@ -463,8 +475,12 @@
 	 * Granularity 2.	Battery capacity granularity between warning
 	 *			 and full in [mAh] or [mWh]. [...]
 	 */
-	aprint_verbose_dev(dv,
-	granularity 1. %d.%03d %s, granularity 2. %d.%03d %s\n,
+	if ((elm[ACPIBAT_BIF_UNIT].Integer.Value  ACPIBAT_PWRUNIT_MA) != 0)
+		unit = Ah;
+	else
+		unit = Wh;
+	aprint_verbose_dev(dv, low-warn granularity: %d.%03d%s, 
+	warn-full granularity: %d.%03d%s\n,
 	SCALE(elm[ACPIBAT_BIF_GRANULARITY1].Integer.Value * 1000), unit,
 	SCALE(elm[ACPIBAT_BIF_GRANULARITY2].Integer.Value * 1000), unit);
 }

Index: src/sys/dev/acpi/acpi_tz.c
diff -u src/sys/dev/acpi/acpi_tz.c:1.65 src/sys/dev/acpi/acpi_tz.c:1.66
--- src/sys/dev/acpi/acpi_tz.c:1.65	Thu Apr 15 03:02:24 2010
+++ src/sys/dev/acpi/acpi_tz.c	Thu Apr 15 21:52:54 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_tz.c,v 1.65 2010/04/15 07:02:24 jruoho Exp $ */
+/* $NetBSD: acpi_tz.c,v 1.66 2010/04/16 01:52:54 christos Exp $ */
 
 /*
  * Copyright (c) 2003 Jared D. McNeill jmcne...@invisible.ca
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: acpi_tz.c,v 1.65 2010/04/15 07:02:24 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: acpi_tz.c,v 1.66 2010/04/16 01:52:54 christos Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -509,30 +509,38 @@
 	acpitz_sane_temp(sc-sc_zone.psv);
 
 	if (verbose != 0) {
+		int comma = 0;
+
 		aprint_verbose_dev(dv, );
 
-		if (sc-sc_zone.crt != ATZ_TMP_INVALID)
+		if (sc-sc_zone.crt != ATZ_TMP_INVALID) {
 			aprint_verbose(critical %s C,
 			acpitz_celcius_string(sc-sc_zone.crt));
+			comma = 1;
+		}
 
-		if (sc-sc_zone.hot != ATZ_TMP_INVALID)
-			aprint_verbose( hot %s C,
+		if (sc-sc_zone.hot != ATZ_TMP_INVALID) {
+			aprint_verbose(%shot %s C, comma ? ,  : ,
 			acpitz_celcius_string(sc-sc_zone.hot));
+			comma = 1;
+		}
 
-		if (sc-sc_zone.psv != ATZ_TMP_INVALID)
-			aprint_normal( passive %s C,
+		if (sc-sc_zone.psv != ATZ_TMP_INVALID) {
+			aprint_normal(%spassive %s C, comma ? ,  : ,
 			acpitz_celcius_string(sc-sc_zone.psv));
-	}
+			comma = 1;
+		}
 
-	if (valid_levels == 0) {
-		sc-sc_flags |= ATZ_F_PASSIVEONLY;
+		if (valid_levels == 0) {
+			sc-sc_flags |= ATZ_F_PASSIVEONLY;
 
-		if (sc-sc_first)
-			aprint_verbose(, passive cooling);
-	}
+			if (sc-sc_first)
+aprint_verbose(%spassive cooling, comma ?
+,  : );
+		}
 
-	

CVS commit: src/sys/kern

2010-04-15 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Fri Apr 16 02:57:15 UTC 2010

Modified Files:
src/sys/kern: uipc_mbuf.c

Log Message:
Remove mclpool_allocator, which is unnecessary since mb_map removal.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/kern/uipc_mbuf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.134 src/sys/kern/uipc_mbuf.c:1.135
--- src/sys/kern/uipc_mbuf.c:1.134	Mon Feb  8 22:55:36 2010
+++ src/sys/kern/uipc_mbuf.c	Fri Apr 16 02:57:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.134 2010/02/08 22:55:36 joerg Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.135 2010/04/16 02:57:15 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uipc_mbuf.c,v 1.134 2010/02/08 22:55:36 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: uipc_mbuf.c,v 1.135 2010/04/16 02:57:15 rmind Exp $);
 
 #include opt_mbuftrace.h
 #include opt_nmbclusters.h
@@ -100,18 +100,10 @@
 
 static int mb_ctor(void *, void *, int);
 
-static void	*mclpool_alloc(struct pool *, int);
-static void	mclpool_release(struct pool *, void *);
-
 static void	sysctl_kern_mbuf_setup(void);
 
 static struct sysctllog *mbuf_sysctllog;
 
-static struct pool_allocator mclpool_allocator = {
-	.pa_alloc = mclpool_alloc,
-	.pa_free = mclpool_release,
-};
-
 static struct mbuf *m_copym0(struct mbuf *, int, int, int, int);
 static struct mbuf *m_split0(struct mbuf *, int, int, int);
 static int m_copyback0(struct mbuf **, int, int, const void *, int, int);
@@ -192,14 +184,12 @@
 
 	sysctl_kern_mbuf_setup();
 
-	mclpool_allocator.pa_backingmap = kmem_map;
-
 	mb_cache = pool_cache_init(msize, 0, 0, 0, mbpl,
 	NULL, IPL_VM, mb_ctor, NULL, NULL);
 	KASSERT(mb_cache != NULL);
 
-	mcl_cache = pool_cache_init(mclbytes, 0, 0, 0, mclpl,
-	mclpool_allocator, IPL_VM, NULL, NULL, NULL);
+	mcl_cache = pool_cache_init(mclbytes, 0, 0, 0, mclpl, NULL,
+	IPL_VM, NULL, NULL, NULL);
 	KASSERT(mcl_cache != NULL);
 
 	pool_cache_set_drain_hook(mb_cache, m_reclaim, NULL);
@@ -459,22 +449,6 @@
 #endif /* MBUFTRACE */
 }
 
-static void *
-mclpool_alloc(struct pool *pp, int flags)
-{
-	bool waitok = (flags  PR_WAITOK) ? true : false;
-
-	return ((void *)uvm_km_alloc_poolpage(kmem_map, waitok));
-}
-
-static void
-mclpool_release(struct pool *pp, void *v)
-{
-
-	uvm_km_free_poolpage(kmem_map, (vaddr_t)v);
-}
-
-/*ARGSUSED*/
 static int
 mb_ctor(void *arg, void *object, int flags)
 {



CVS commit: src/sys/netinet

2010-04-15 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Fri Apr 16 03:13:03 UTC 2010

Modified Files:
src/sys/netinet: tcp_input.c

Log Message:
tcp_input: set ECE flag even if CWR flag is active.
Submitted by Richard Scheffenegger in PR/43150.


To generate a diff of this commit:
cvs rdiff -u -r1.302 -r1.303 src/sys/netinet/tcp_input.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.302 src/sys/netinet/tcp_input.c:1.303
--- src/sys/netinet/tcp_input.c:1.302	Thu Apr  1 14:31:51 2010
+++ src/sys/netinet/tcp_input.c	Fri Apr 16 03:13:03 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.302 2010/04/01 14:31:51 tls Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.303 2010/04/16 03:13:03 rmind Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -145,7 +145,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tcp_input.c,v 1.302 2010/04/01 14:31:51 tls Exp $);
+__KERNEL_RCSID(0, $NetBSD: tcp_input.c,v 1.303 2010/04/16 03:13:03 rmind Exp $);
 
 #include opt_inet.h
 #include opt_ipsec.h
@@ -1657,6 +1657,9 @@
 	}
 
 	if (TCP_ECN_ALLOWED(tp)) {
+		if (tiflags  TH_CWR) {
+			tp-t_flags = ~TF_ECN_SND_ECE;
+		}
 		switch (iptos  IPTOS_ECN_MASK) {
 		case IPTOS_ECN_CE:
 			tp-t_flags |= TF_ECN_SND_ECE;
@@ -1669,10 +1672,6 @@
 			/* XXX: ignore for now -- rpaulo */
 			break;
 		}
-
-		if (tiflags  TH_CWR)
-			tp-t_flags = ~TF_ECN_SND_ECE;
-
 		/*
 		 * Congestion experienced.
 		 * Ignore if we are already trying to recover.



CVS commit: src/sys

2010-04-15 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Fri Apr 16 03:21:49 UTC 2010

Modified Files:
src/sys/kern: kern_synch.c
src/sys/sys: sched.h
src/sys/uvm: uvm_extern.h uvm_glue.c uvm_meter.c

Log Message:
- Merge sched_pstats() and uvm_meter()/uvm_loadav().  Avoids double loop
  through all LWPs and duplicate locking overhead.

- Move sched_pstats() from soft-interrupt context to process 0 main loop.
  Avoids blocking effect on real-time threads.  Mostly fixes PR/38792.

Note: it might be worth to move the loop above PRI_PGDAEMON.  Also,
sched_pstats() might be cleaned-up slightly.


To generate a diff of this commit:
cvs rdiff -u -r1.280 -r1.281 src/sys/kern/kern_synch.c
cvs rdiff -u -r1.71 -r1.72 src/sys/sys/sched.h
cvs rdiff -u -r1.162 -r1.163 src/sys/uvm/uvm_extern.h
cvs rdiff -u -r1.144 -r1.145 src/sys/uvm/uvm_glue.c
cvs rdiff -u -r1.51 -r1.52 src/sys/uvm/uvm_meter.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_synch.c
diff -u src/sys/kern/kern_synch.c:1.280 src/sys/kern/kern_synch.c:1.281
--- src/sys/kern/kern_synch.c:1.280	Wed Mar  3 00:47:31 2010
+++ src/sys/kern/kern_synch.c	Fri Apr 16 03:21:49 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_synch.c,v 1.280 2010/03/03 00:47:31 yamt Exp $	*/
+/*	$NetBSD: kern_synch.c,v 1.281 2010/04/16 03:21:49 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009
@@ -69,7 +69,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_synch.c,v 1.280 2010/03/03 00:47:31 yamt Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_synch.c,v 1.281 2010/04/16 03:21:49 rmind Exp $);
 
 #include opt_kstack.h
 #include opt_perfctrs.h
@@ -128,7 +128,6 @@
 	syncobj_noowner,
 };
 
-callout_t 	sched_pstats_ch;
 unsigned	sched_pstats_ticks;
 kcondvar_t	lbolt;			/* once a second sleep address */
 
@@ -152,8 +151,6 @@
 {
 
 	cv_init(lbolt, lbolt);
-	callout_init(sched_pstats_ch, CALLOUT_MPSAFE);
-	callout_setfunc(sched_pstats_ch, sched_pstats, NULL);
 
 	evcnt_attach_dynamic(kpreempt_ev_crit, EVCNT_TYPE_MISC, NULL,
 	   kpreempt, defer: critical section);
@@ -161,8 +158,6 @@
 	   kpreempt, defer: kernel_lock);
 	evcnt_attach_dynamic(kpreempt_ev_immed, EVCNT_TYPE_MISC, NULL,
 	   kpreempt, immediate);
-
-	sched_pstats(NULL);
 }
 
 /*
@@ -1148,36 +1143,55 @@
 }
 
 /* Decay 95% of proc::p_pctcpu in 60 seconds, ccpu = exp(-1/20) */
-const fixpt_t	ccpu = 0.95122942450071400909 * FSCALE;
+const fixpt_t ccpu = 0.95122942450071400909 * FSCALE;
+
+/*
+ * Constants for averages over 1, 5 and 15 minutes when sampling at
+ * 5 second intervals.
+ */
+static const fixpt_t cexp[ ] = {
+	0.9200444146293232 * FSCALE,	/* exp(-1/12) */
+	0.9834714538216174 * FSCALE,	/* exp(-1/60) */
+	0.9944598480048967 * FSCALE,	/* exp(-1/180) */
+};
 
 /*
  * sched_pstats:
  *
- * Update process statistics and check CPU resource allocation.
- * Call scheduler-specific hook to eventually adjust process/LWP
- * priorities.
+ * = Update process statistics and check CPU resource allocation.
+ * = Call scheduler-specific hook to eventually adjust LWP priorities.
+ * = Compute load average of a quantity on 1, 5 and 15 minute intervals.
  */
 void
-sched_pstats(void *arg)
+sched_pstats(void)
 {
+	extern struct loadavg averunnable;
+	struct loadavg *avg = averunnable;
 	const int clkhz = (stathz != 0 ? stathz : hz);
-	static bool backwards;
-	struct rlimit *rlim;
-	struct lwp *l;
+	static bool backwards = false;
+	static u_int lavg_count = 0;
 	struct proc *p;
-	long runtm;
-	fixpt_t lpctcpu;
-	u_int lcpticks;
-	int sig;
+	int nrun;
 
 	sched_pstats_ticks++;
-
+	if (++lavg_count = 5) {
+		lavg_count = 0;
+		nrun = 0;
+	}
 	mutex_enter(proc_lock);
 	PROCLIST_FOREACH(p, allproc) {
+		struct lwp *l;
+		struct rlimit *rlim;
+		long runtm;
+		int sig;
+
 		/* Increment sleep time (if sleeping), ignore overflow. */
 		mutex_enter(p-p_lock);
 		runtm = p-p_rtime.sec;
 		LIST_FOREACH(l, p-p_lwps, l_sibling) {
+			fixpt_t lpctcpu;
+			u_int lcpticks;
+
 			if (__predict_false((l-l_flag  LW_IDLE) != 0))
 continue;
 			lwp_lock(l);
@@ -1195,6 +1209,20 @@
 			lpctcpu += ((FSCALE - ccpu) *
 			(lcpticks * FSCALE / clkhz))  FSHIFT;
 			l-l_pctcpu = lpctcpu;
+
+			/* For load average calculation. */
+			if (__predict_false(lavg_count == 0)) {
+switch (l-l_stat) {
+case LSSLEEP:
+	if (l-l_slptime  1) {
+		break;
+	}
+case LSRUN:
+case LSONPROC:
+case LSIDL:
+	nrun++;
+}
+			}
 		}
 		/* Calculating p_pctcpu only for ps(1) */
 		p-p_pctcpu = (p-p_pctcpu * ccpu)  FSHIFT;
@@ -1227,7 +1255,16 @@
 		}
 	}
 	mutex_exit(proc_lock);
-	uvm_meter();
+
+	/* Load average calculation. */
+	if (__predict_false(lavg_count == 0)) {
+		int i;
+		for (i = 0; i  __arraycount(cexp); i++) {
+			avg-ldavg[i] = (cexp[i] * avg-ldavg[i] +
+			nrun * FSCALE * (FSCALE - cexp[i]))  FSHIFT;
+		}
+	}
+
+	/* Lightning bolt. */
 	cv_broadcast(lbolt);
-