CVS commit: src/sys/arch/evbarm/marvell

2010-10-03 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Oct  3 06:03:10 UTC 2010

Added Files:
src/sys/arch/evbarm/marvell: marvell_machdep.c marvell_start.S
marvellreg.h marvellvar.h

Log Message:
Add support Marvell Sheevaplug.
Add some NAS on Marvell SoC.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/marvell/marvell_machdep.c \
src/sys/arch/evbarm/marvell/marvell_start.S \
src/sys/arch/evbarm/marvell/marvellreg.h \
src/sys/arch/evbarm/marvell/marvellvar.h

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

Added files:

Index: src/sys/arch/evbarm/marvell/marvell_machdep.c
diff -u /dev/null src/sys/arch/evbarm/marvell/marvell_machdep.c:1.1
--- /dev/null	Sun Oct  3 06:03:10 2010
+++ src/sys/arch/evbarm/marvell/marvell_machdep.c	Sun Oct  3 06:03:10 2010
@@ -0,0 +1,1001 @@
+/*	$NetBSD: marvell_machdep.c,v 1.1 2010/10/03 06:03:10 kiyohara Exp $ */
+/*
+ * Copyright (c) 2007, 2008, 2010 KIYOHARA Takashi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include sys/cdefs.h
+__KERNEL_RCSID(0, $NetBSD: marvell_machdep.c,v 1.1 2010/10/03 06:03:10 kiyohara Exp $);
+
+#include opt_evbarm_boardtype.h
+#include opt_ddb.h
+#include opt_pci.h
+#include opt_mvsoc.h
+#include com.h
+#include gtpci.h
+#include mvpex.h
+
+#include sys/param.h
+#include sys/kernel.h
+#include sys/reboot.h
+#include sys/systm.h
+#include sys/termios.h
+
+#include prop/proplib.h
+
+#include dev/cons.h
+#include dev/md.h
+
+#include dev/marvell/marvellreg.h
+#include dev/marvell/marvellvar.h
+#include dev/pci/pcireg.h
+#include dev/pci/pcivar.h
+
+#include machine/autoconf.h
+#include machine/bootconfig.h
+#include machine/pci_machdep.h
+
+#include uvm/uvm_extern.h
+
+#include arm/db_machdep.h
+#include arm/undefined.h
+#include arm/arm32/machdep.h
+
+#include arm/marvell/mvsocreg.h
+#include arm/marvell/mvsocvar.h
+#include arm/marvell/orionreg.h
+#include arm/marvell/kirkwoodreg.h
+#include arm/marvell/mvsocgppvar.h
+
+#include evbarm/marvell/marvellreg.h
+#include evbarm/marvell/marvellvar.h
+
+#include ddb/db_extern.h
+#include ddb/db_sym.h
+
+#include ksyms.h
+
+
+/* Kernel text starts 2MB in from the bottom of the kernel address space. */
+#define KERNEL_TEXT_BASE	(KERNEL_BASE + 0x)
+#define KERNEL_VM_BASE		(KERNEL_BASE + 0x0100)
+
+/*
+ * The range 0xc100 - 0xccff is available for kernel VM space
+ * Core-logic registers and I/O mappings occupy 0xfd00 - 0x
+ */
+#define KERNEL_VM_SIZE		0x0c00
+
+/*
+ * Address to call from cpu_reset() to reset the machine.
+ * This is machine architecture dependant as it varies depending
+ * on where the ROM appears when you turn the MMU off.
+ */
+
+u_int cpu_reset_address = 0x;
+
+/* Define various stack sizes in pages */
+#define IRQ_STACK_SIZE	1
+#define ABT_STACK_SIZE	1
+#ifdef IPKDB
+#define UND_STACK_SIZE	2
+#else
+#define UND_STACK_SIZE	1
+#endif
+
+BootConfig bootconfig;		/* Boot config storage */
+char *boot_args = NULL;
+
+vm_offset_t physical_start;
+vm_offset_t physical_freestart;
+vm_offset_t physical_freeend;
+vm_offset_t physical_end;
+u_int free_pages;
+int physmem = 0;
+
+/* Physical and virtual addresses for some global pages */
+pv_addr_t systempage;
+pv_addr_t irqstack;
+pv_addr_t undstack;
+pv_addr_t abtstack;
+pv_addr_t kernelstack;
+
+vm_offset_t msgbufphys;
+
+extern u_int data_abort_handler_address;
+extern u_int prefetch_abort_handler_address;
+extern u_int undefined_handler_address;
+
+extern char _end[];
+
+#define KERNEL_PT_SYS		0   /* Page table for mapping proc0 zero page */
+#define KERNEL_PT_KERNEL	1	/* Page table for mapping kernel */
+#define 

CVS commit: src/share/man/man4

2010-10-03 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Oct  3 06:36:49 UTC 2010

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

Log Message:
New sentence, new line.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/share/man/man4/agp.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/agp.4
diff -u src/share/man/man4/agp.4:1.15 src/share/man/man4/agp.4:1.16
--- src/share/man/man4/agp.4:1.15	Sat Oct  2 22:51:49 2010
+++ src/share/man/man4/agp.4	Sun Oct  3 06:36:49 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: agp.4,v 1.15 2010/10/02 22:51:49 jym Exp $
+.\ $NetBSD: agp.4,v 1.16 2010/10/03 06:36:49 wiz 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 October 03, 2010
+.Dd October 3, 2010
 .Dt AGP 4
 .Os
 .Sh NAME
@@ -39,16 +39,17 @@
 The
 .Nm
 driver provides machine-independent support for the accelerated
-graphics port (AGP) found on many PC-based and PCI systems.  The AGP
-specification was designed by Intel.
+graphics port (AGP) found on many PC-based and PCI systems.
+The AGP specification was designed by Intel.
 .Pp
 The AGP chipset is positioned between the PCI-Host bridge and the
 graphics accelerator to provide a high-performance dedicated graphics
 bus for moving large amounts of data directly from host memory to the
-graphics accelerator.  The specification currently supports a peak
-bandwidth of 528 MB/s.  AGP uses a Graphics Address Remapping Table
-(GART) to provide a physically-contiguous view of scattered pages in
-host memory for DMA transfers.
+graphics accelerator.
+The specification currently supports a peak bandwidth of 528 MB/s.
+AGP uses a Graphics Address Remapping Table (GART) to provide a
+physically-contiguous view of scattered pages in host memory for
+DMA transfers.
 .Pp
 The
 .Nm
@@ -70,10 +71,11 @@
 The
 .Nm
 driver also provides an interface to user processes for use by X
-servers.  A user process communicates to the device initially by means
-of
+servers.
+A user process communicates to the device initially by means of
 .Xr ioctl 2
-calls.  The calls supported are:
+calls.
+The calls supported are:
 .Bl -tag -width indent
 .It Dv AGPIOC_INFO
 Get AGP information, setting the members in the



CVS commit: src/sys/dev/marvell

2010-10-03 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Oct  3 07:14:34 UTC 2010

Modified Files:
src/sys/dev/marvell: gttwsi.c

Log Message:
Fix ack/no-ack.  Last data sends with stop-bit without ack.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/gttwsi.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/marvell/gttwsi.c
diff -u src/sys/dev/marvell/gttwsi.c:1.3 src/sys/dev/marvell/gttwsi.c:1.4
--- src/sys/dev/marvell/gttwsi.c:1.3	Sun Aug  1 06:57:06 2010
+++ src/sys/dev/marvell/gttwsi.c	Sun Oct  3 07:14:33 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: gttwsi.c,v 1.3 2010/08/01 06:57:06 kiyohara Exp $	*/
+/*	$NetBSD: gttwsi.c,v 1.4 2010/10/03 07:14:33 kiyohara Exp $	*/
 /*
  * Copyright (c) 2008 Eiji Kawauchi.
  * All rights reserved.
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: gttwsi.c,v 1.3 2010/08/01 06:57:06 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: gttwsi.c,v 1.4 2010/10/03 07:14:33 kiyohara Exp $);
 #include locators.h
 
 #include sys/param.h
@@ -335,7 +335,10 @@
 	struct gttwsi_softc *sc = v;
 	int error;
 
-	error = gttwsi_wait(sc, CONTROL_ACK, STAT_MRRD_AT, flags);
+	if (flags  I2C_F_STOP)
+		error = gttwsi_wait(sc, 0, STAT_MRRD_ANT, flags);
+	else
+		error = gttwsi_wait(sc, CONTROL_ACK, STAT_MRRD_AT, flags);
 	if (!error)
 		*valp = RREG(sc, TWSI_DATA);
 	if (flags  I2C_F_LAST)



CVS commit: src/bin/date

2010-10-03 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sun Oct  3 08:21:28 UTC 2010

Modified Files:
src/bin/date: date.c

Log Message:
Simplify by using setenv() instead of putenv().


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/bin/date/date.c

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

Modified files:

Index: src/bin/date/date.c
diff -u src/bin/date/date.c:1.54 src/bin/date/date.c:1.55
--- src/bin/date/date.c:1.54	Sat Oct  2 08:26:09 2010
+++ src/bin/date/date.c	Sun Oct  3 08:21:27 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: date.c,v 1.54 2010/10/02 08:26:09 gson Exp $ */
+/* $NetBSD: date.c,v 1.55 2010/10/03 08:21:27 gson Exp $ */
 
 /*
  * Copyright (c) 1985, 1987, 1988, 1993
@@ -40,7 +40,7 @@
 #if 0
 static char sccsid[] = @(#)date.c	8.2 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: date.c,v 1.54 2010/10/02 08:26:09 gson Exp $);
+__RCSID($NetBSD: date.c,v 1.55 2010/10/03 08:21:27 gson Exp $);
 #endif
 #endif /* not lint */
 
@@ -79,7 +79,6 @@
 	size_t bufsiz;
 	const char *format;
 	int ch;
-	static char tz_utc0[] = TZ=UTC0;
 
 	setprogname(argv[0]);
 	(void)setlocale(LC_ALL, );
@@ -107,7 +106,7 @@
 			tval = strtoll(optarg, NULL, 0);
 			break;
 		case 'u':		/* do everything in UTC */
-			(void)putenv(tz_utc0);
+			(void)setenv(TZ, UTC0, 1);
 			break;
 		default:
 			usage();



CVS commit: src/sys/net/npf

2010-10-03 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Oct  3 19:30:23 UTC 2010

Modified Files:
src/sys/net/npf: npf_mbuf.c

Log Message:
nbuf_advfetch: fix bug and change behaviour on error case.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/net/npf/npf_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/net/npf/npf_mbuf.c
diff -u src/sys/net/npf/npf_mbuf.c:1.3 src/sys/net/npf/npf_mbuf.c:1.4
--- src/sys/net/npf/npf_mbuf.c:1.3	Sat Sep 25 00:25:31 2010
+++ src/sys/net/npf/npf_mbuf.c	Sun Oct  3 19:30:22 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_mbuf.c,v 1.3 2010/09/25 00:25:31 rmind Exp $	*/
+/*	$NetBSD: npf_mbuf.c,v 1.4 2010/10/03 19:30:22 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2009-2010 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #ifdef _KERNEL
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: npf_mbuf.c,v 1.3 2010/09/25 00:25:31 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: npf_mbuf.c,v 1.4 2010/10/03 19:30:22 rmind Exp $);
 #endif
 
 #include sys/param.h
@@ -189,17 +189,25 @@
 
 /*
  * nbuf_advfetch: advance and fetch the datum.
- * WARNING: Values of nbuf and n_ptr are undefined on error.
  */
 int
 nbuf_advfetch(nbuf_t **nbuf, void **n_ptr, u_int n, size_t len, void *buf)
 {
+	nbuf_t *orig_nbuf = *nbuf;
+	void *orig_nptr = *n_ptr;
+	int error;
 
 	*n_ptr = nbuf_advance(nbuf, *n_ptr, n);
-	if (__predict_false(*n_ptr == NULL)) {
-		return EINVAL;
+	if (__predict_false(*n_ptr != NULL)) {
+		error = nbuf_fetch_datum(*nbuf, *n_ptr, len, buf);
+	} else {
+		error = EINVAL;
+	}
+	if (__predict_false(error)) {
+		*nbuf = orig_nbuf;
+		*n_ptr = orig_nptr;
 	}
-	return nbuf_fetch_datum(*nbuf, n_ptr, len, buf);
+	return error;
 }
 
 /*



CVS commit: src/sys/net/npf

2010-10-03 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Oct  3 19:36:39 UTC 2010

Modified Files:
src/sys/net/npf: npf_session.c

Log Message:
- npf_session_gc: fix for previous RB-tree conversion.
- npf_session_free: rename (to singular).


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/net/npf/npf_session.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/net/npf/npf_session.c
diff -u src/sys/net/npf/npf_session.c:1.3 src/sys/net/npf/npf_session.c:1.4
--- src/sys/net/npf/npf_session.c:1.3	Fri Sep 24 22:51:50 2010
+++ src/sys/net/npf/npf_session.c	Sun Oct  3 19:36:38 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_session.c,v 1.3 2010/09/24 22:51:50 rmind Exp $	*/
+/*	$NetBSD: npf_session.c,v 1.4 2010/10/03 19:36:38 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -85,7 +85,7 @@
 
 #ifdef _KERNEL
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: npf_session.c,v 1.3 2010/09/24 22:51:50 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: npf_session.c,v 1.4 2010/10/03 19:36:38 rmind Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -743,6 +743,7 @@
 			/* Get item, pre-iterate, skip if not expired. */
 			nse = rb_tree_iterate(sh-sh_tree, se, RB_DIR_RIGHT);
 			if (!npf_session_expired(se, tsnow)  !flushall) {
+se = nse;
 continue;
 			}
 
@@ -767,11 +768,11 @@
 }
 
 /*
- * npf_sessions_free: destroy all sessions in the G/C list, which
+ * npf_session_free: destroy all sessions in the G/C list, which
  * have no references.  Return true, if list is empty.
  */
 static void
-npf_sessions_free(struct npf_sesslist *gc_list)
+npf_session_free(struct npf_sesslist *gc_list)
 {
 	npf_session_t *se, *nse;
 
@@ -815,14 +816,14 @@
 
 		/* Flush all if session tracking got disabled. */
 		npf_session_gc(gc_list, flushreq);
-		npf_sessions_free(gc_list);
+		npf_session_free(gc_list);
 
 	} while (sess_tracking);
 
 	/* Wait for any referenced sessions to be released. */
 	while (!LIST_EMPTY(gc_list)) {
 		kpause(npfgcfr, false, 1, NULL);
-		npf_sessions_free(gc_list);
+		npf_session_free(gc_list);
 	}
 
 	/* Notify that we are done. */



CVS commit: src/regress/sys/net/frag

2010-10-03 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Oct  3 19:41:25 UTC 2010

Modified Files:
src/regress/sys/net/frag: ip4_frag_1.c

Log Message:
Don't overrun the buffer, when writing some payload.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/regress/sys/net/frag/ip4_frag_1.c

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

Modified files:

Index: src/regress/sys/net/frag/ip4_frag_1.c
diff -u src/regress/sys/net/frag/ip4_frag_1.c:1.1 src/regress/sys/net/frag/ip4_frag_1.c:1.2
--- src/regress/sys/net/frag/ip4_frag_1.c:1.1	Tue Jul 13 22:13:18 2010
+++ src/regress/sys/net/frag/ip4_frag_1.c	Sun Oct  3 19:41:25 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip4_frag_1.c,v 1.1 2010/07/13 22:13:18 rmind Exp $	*/
+/*	$NetBSD: ip4_frag_1.c,v 1.2 2010/10/03 19:41:25 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -126,7 +126,8 @@
 		n = 0;
 	}
 	for (data += n; n  addlen; n++) {
-		data[n] = (0xf  n);
+		*data = (0xf  n);
+		data++;
 	}
 	return (void *)ip;
 }



CVS commit: src/sys/netinet

2010-10-03 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Oct  3 19:44:47 UTC 2010

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

Log Message:
Re-structure IPv4 reassembly code to make it more MP-friendly and simplify
some code fragments while here.  Also, use pool_cache(9) and mutex(9).

IPv4 reassembly mechanism is MP-safe now.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/netinet/ip_reass.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/ip_reass.c
diff -u src/sys/netinet/ip_reass.c:1.3 src/sys/netinet/ip_reass.c:1.4
--- src/sys/netinet/ip_reass.c:1.3	Wed Aug 25 00:05:14 2010
+++ src/sys/netinet/ip_reass.c	Sun Oct  3 19:44:47 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_reass.c,v 1.3 2010/08/25 00:05:14 rmind Exp $	*/
+/*	$NetBSD: ip_reass.c,v 1.4 2010/10/03 19:44:47 rmind Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1988, 1993
@@ -46,13 +46,14 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ip_reass.c,v 1.3 2010/08/25 00:05:14 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: ip_reass.c,v 1.4 2010/10/03 19:44:47 rmind Exp $);
 
 #include sys/param.h
 #include sys/types.h
 
 #include sys/malloc.h
 #include sys/mbuf.h
+#include sys/mutex.h
 #include sys/domain.h
 #include sys/protosw.h
 #include sys/pool.h
@@ -107,8 +108,8 @@
 	(x)  0xf) | x)  8)  0xf)  4)) ^ (y))  IPREASS_HASH_MASK)
 
 static LIST_HEAD(, ipfr_queue)	ip_frags[IPREASS_HASH_SIZE];
-static struct pool	ipqent_pool;
-static int		ipq_locked;
+static pool_cache_t	ipfren_cache;
+static kmutex_t		ipfr_lock;
 
 /* Number of packets in reassembly queue and total number of fragments. */
 static int		ip_nfragpackets;
@@ -129,6 +130,8 @@
  */
 static u_int		fragttl_histo[IPFRAGTTL + 1];
 
+static struct sysctllog *ip_reass_sysctllog;
+
 void			sysctl_ip_reass_setup(void);
 static void		ip_nmbclusters_changed(void);
 
@@ -147,8 +150,9 @@
 {
 	int i;
 
-	pool_init(ipqent_pool, sizeof(ipfr_qent_t), 0, 0, 0, ipqepl,
-	NULL, IPL_VM);
+	ipfren_cache = pool_cache_init(sizeof(ipfr_qent_t), coherency_unit,
+	0, 0, ipfrenpl, NULL, IPL_NET, NULL, NULL, NULL);
+	mutex_init(ipfr_lock, MUTEX_DEFAULT, IPL_SOFTNET);
 
 	for (i = 0; i  IPREASS_HASH_SIZE; i++) {
 		LIST_INIT(ip_frags[i]);
@@ -160,8 +164,6 @@
 	sysctl_ip_reass_setup();
 }
 
-static struct sysctllog *ip_reass_sysctllog;
-
 void
 sysctl_ip_reass_setup(void)
 {
@@ -209,60 +211,6 @@
 	ip_nmbclusters = nmbclusters;
 }
 
-static inline int	ipq_lock_try(void);
-static inline void	ipq_unlock(void);
-
-static inline int
-ipq_lock_try(void)
-{
-	int s;
-
-	/*
-	 * Use splvm() -- we're blocking things that would cause
-	 * mbuf allocation.
-	 */
-	s = splvm();
-	if (ipq_locked) {
-		splx(s);
-		return (0);
-	}
-	ipq_locked = 1;
-	splx(s);
-	return (1);
-}
-
-static inline void
-ipq_unlock(void)
-{
-	int s;
-
-	s = splvm();
-	ipq_locked = 0;
-	splx(s);
-}
-
-#ifdef DIAGNOSTIC
-#define	IPQ_LOCK()			\
-do {	\
-	if (ipq_lock_try() == 0) {	\
-		printf(%s:%d: ipq already locked\n, __FILE__, __LINE__); \
-		panic(ipq_lock);	\
-	}\
-} while (/*CONSTCOND*/ 0)
-#define	IPQ_LOCK_CHECK()		\
-do {	\
-	if (ipq_locked == 0) {		\
-		printf(%s:%d: ipq lock not held\n, __FILE__, __LINE__); \
-		panic(ipq lock check);\
-	}\
-} while (/*CONSTCOND*/ 0)
-#else
-#define	IPQ_LOCK()		(void) ipq_lock_try()
-#define	IPQ_LOCK_CHECK()	/* nothing */
-#endif
-
-#define	IPQ_UNLOCK()		ipq_unlock()
-
 /*
  * ip_reass:
  *
@@ -277,9 +225,9 @@
 	struct mbuf *m = ipqe-ipqe_m, *t;
 	ipfr_qent_t *nq, *p, *q;
 	struct ip *ip;
-	int i, next, s;
+	int i, next;
 
-	IPQ_LOCK_CHECK();
+	KASSERT(mutex_owned(ipfr_lock));
 
 	/*
 	 * Presence of header sizes in mbufs would confuse code below.
@@ -385,9 +333,7 @@
 		nq = TAILQ_NEXT(q, ipqe_q);
 		m_freem(q-ipqe_m);
 		TAILQ_REMOVE(fp-ipq_fragq, q, ipqe_q);
-		s = splvm();
-		pool_put(ipqent_pool, q);
-		splx(s);
+		pool_cache_put(ipfren_cache, q);
 		fp-ipq_nfrags--;
 		ip_nfrags--;
 	}
@@ -405,44 +351,46 @@
 	for (p = NULL, q = TAILQ_FIRST(fp-ipq_fragq); q != NULL;
 	p = q, q = TAILQ_NEXT(q, ipqe_q)) {
 		if (ntohs(q-ipqe_ip-ip_off) != next) {
-			IPQ_UNLOCK();
+			mutex_exit(ipfr_lock);
 			return NULL;
 		}
 		next += ntohs(q-ipqe_ip-ip_len);
 	}
 	if (p-ipqe_mff) {
-		IPQ_UNLOCK();
+		mutex_exit(ipfr_lock);
 		return NULL;
 	}
 	/*
-	 * Reassembly is complete.  Check for a bogus message size and
-	 * concatenate fragments.
+	 * Reassembly is complete.  Check for a bogus message size.
 	 */
 	q = TAILQ_FIRST(fp-ipq_fragq);
 	ip = q-ipqe_ip;
 	if ((next + (ip-ip_hl  2))  IP_MAXPACKET) {
 		IP_STATINC(IP_STAT_TOOLONG);
 		ip_freef(fp);
-		IPQ_UNLOCK();
+		mutex_exit(ipfr_lock);
 		return NULL;
 	}
+	LIST_REMOVE(fp, ipq_q);
+	ip_nfrags -= fp-ipq_nfrags;
+	ip_nfragpackets--;
+	mutex_exit(ipfr_lock);
+
+	/* Concatenate all fragments. */
 	m = q-ipqe_m;
 	t = m-m_next;
 	m-m_next = NULL;
 	m_cat(m, t);
 	

CVS commit: src/sys/arch/x86/x86

2010-10-03 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Oct  3 19:46:35 UTC 2010

Modified Files:
src/sys/arch/x86/x86: vga_post.c

Log Message:
vga_post_init: fix a bug and memleak in error path.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/x86/vga_post.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/x86/x86/vga_post.c
diff -u src/sys/arch/x86/x86/vga_post.c:1.15 src/sys/arch/x86/x86/vga_post.c:1.16
--- src/sys/arch/x86/x86/vga_post.c:1.15	Mon Jun 28 00:39:47 2010
+++ src/sys/arch/x86/x86/vga_post.c	Sun Oct  3 19:46:35 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: vga_post.c,v 1.15 2010/06/28 00:39:47 rmind Exp $ */
+/* $NetBSD: vga_post.c,v 1.16 2010/10/03 19:46:35 rmind Exp $ */
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger jo...@netbsd.org.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vga_post.c,v 1.15 2010/06/28 00:39:47 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: vga_post.c,v 1.16 2010/10/03 19:46:35 rmind Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -143,30 +143,30 @@
 	vaddr_t sys_image, sys_bios_data;
 	int err;
 
-	sys_bios_data = uvm_km_alloc(kernel_map, PAGE_SIZE, 0, UVM_KMF_VAONLY);
-	if (sys_bios_data == 0)
-		return NULL;
-
 	sys_image = uvm_km_alloc(kernel_map, 1024 * 1024, 0, UVM_KMF_VAONLY);
 	if (sys_image == 0) {
-		uvm_km_free(kernel_map, sys_bios_data, PAGE_SIZE,
-UVM_KMF_VAONLY);
 		return NULL;
 	}
 	sc = kmem_alloc(sizeof(*sc), KM_SLEEP);
+	sc-sys_image = sys_image;
+	sc-emu.sys_private = sc;
 
 	err = uvm_pglistalloc(BASE_MEMORY, 0, (paddr_t)-1, 0, 0,
 	sc-ram_backing, BASE_MEMORY/PAGE_SIZE, 1);
 	if (err) {
-		uvm_km_free(kernel_map, sc-sys_image, 1024 * 1024,
-UVM_KMF_VAONLY);
+		uvm_km_free(kernel_map, sc-sys_image,
+		1024 * 1024, UVM_KMF_VAONLY);
 		kmem_free(sc, sizeof(*sc));
 		return NULL;
 	}
 
-	sc-sys_image = sys_image;
-	sc-emu.sys_private = sc;
-
+	/*
+	 * Map and copy BIOS data.
+	 */
+	sys_bios_data = uvm_km_alloc(kernel_map, PAGE_SIZE, 0, UVM_KMF_VAONLY);
+	if (sys_bios_data == 0) {
+		return NULL;
+	}
 	pmap_kenter_pa(sys_bios_data, 0, VM_PROT_READ, 0);
 	pmap_update(pmap_kernel());
 
@@ -176,17 +176,21 @@
 	pmap_update(pmap_kernel());
 	uvm_km_free(kernel_map, sys_bios_data, PAGE_SIZE, UVM_KMF_VAONLY);
 
+	/*
+	 * Map 0 .. 64KB and 640KB .. 1MB ranges.
+	 */
 	iter = 0;
 	TAILQ_FOREACH(pg, sc-ram_backing, pageq.queue) {
 		pmap_kenter_pa(sc-sys_image + iter, VM_PAGE_TO_PHYS(pg),
-VM_PROT_READ | VM_PROT_WRITE, 0);
+		VM_PROT_READ | VM_PROT_WRITE, 0);
 		iter += PAGE_SIZE;
 	}
-	KASSERT(iter == 65536);
+	KASSERT(iter == BASE_MEMORY);
 
-	for (iter = 640 * 1024; iter  1024 * 1024; iter += PAGE_SIZE)
+	for (iter = 640 * 1024; iter  1024 * 1024; iter += PAGE_SIZE) {
 		pmap_kenter_pa(sc-sys_image + iter, iter,
-VM_PROT_READ | VM_PROT_WRITE, 0);
+		VM_PROT_READ | VM_PROT_WRITE, 0);
+	}
 	pmap_update(pmap_kernel());
 
 	memset(sc-emu, 0, sizeof(sc-emu));



CVS commit: src/external/mit/xorg/bin/xterm

2010-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct  3 22:06:43 UTC 2010

Modified Files:
src/external/mit/xorg/bin/xterm: Makefile

Log Message:
added commented out trace build.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/mit/xorg/bin/xterm/Makefile

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

Modified files:

Index: src/external/mit/xorg/bin/xterm/Makefile
diff -u src/external/mit/xorg/bin/xterm/Makefile:1.7 src/external/mit/xorg/bin/xterm/Makefile:1.8
--- src/external/mit/xorg/bin/xterm/Makefile:1.7	Wed Jun 30 00:58:42 2010
+++ src/external/mit/xorg/bin/xterm/Makefile	Sun Oct  3 18:06:43 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.7 2010/06/30 04:58:42 mrg Exp $
+#	$NetBSD: Makefile,v 1.8 2010/10/03 22:06:43 christos Exp $
 
 .include bsd.own.mk
 
@@ -21,6 +21,9 @@
 
 BUILDSYMLINKS=	XTerm-col.ad XTerm-color.ad
 
+#CPPFLAGS+=-DOPT_TRACE
+#SRCS+=trace.c
+
 LDADD+=	-lXft -lfontconfig -lfreetype -lexpat -lXrender
 DPADD+=	${LIBXFT} ${LIBFONTCONFIG} ${LIBFREETYPE} ${LIBEXPAT} ${LIBXRENDER}
 LDADD+=	-lXaw -lXmu -lXt -lSM -lICE -lXpm -lXext -lX11 -lcurses -lterminfo -lutil



CVS commit: xsrc/external/mit/libX11/dist/modules/lc/gen

2010-10-03 Thread Christos Zoulas
Module Name:xsrc
Committed By:   christos
Date:   Sun Oct  3 22:10:48 UTC 2010

Modified Files:
xsrc/external/mit/libX11/dist/modules/lc/gen: lcGenConv.c

Log Message:
ifdef out code that truncates the source length to the destination length
if it is larger. Seems useless to do that since the code tests for both
source length and destination to be non-zero. This fixes cut-n-paste problem
in xterm where the paste length was limited to 1024 (BUFSIZ) in button.c


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.4 -r1.2 \
xsrc/external/mit/libX11/dist/modules/lc/gen/lcGenConv.c

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

Modified files:

Index: xsrc/external/mit/libX11/dist/modules/lc/gen/lcGenConv.c
diff -u xsrc/external/mit/libX11/dist/modules/lc/gen/lcGenConv.c:1.1.1.4 xsrc/external/mit/libX11/dist/modules/lc/gen/lcGenConv.c:1.2
--- xsrc/external/mit/libX11/dist/modules/lc/gen/lcGenConv.c:1.1.1.4	Fri May 21 21:22:19 2010
+++ xsrc/external/mit/libX11/dist/modules/lc/gen/lcGenConv.c	Sun Oct  3 18:10:48 2010
@@ -764,8 +764,10 @@
 return( 0 );
 }
 
+#ifdef notdef
 if (*from_left  *to_left)
 *from_left = *to_left;
+#endif
 
 while (*from_left  *to_left) {
 
@@ -921,8 +923,10 @@
 int defstr_len = strlen(default_string);
 
 
+#ifdef notdef
 if (*from_left  *to_left)
 *from_left = *to_left;
+#endif
 
 while (*from_left  *to_left) {
 
@@ -1080,8 +1084,10 @@
 int from_size = *from_left;
 char *ext_seg_len = NULL;
 
+#ifdef notdef
 if (*from_left  *to_left)
 *from_left = *to_left;
+#endif
 
 while (*from_left  *to_left) {
 
@@ -1272,8 +1278,10 @@
 return( 0 );
 }
 
+#ifdef notdef
 if (*from_left  *to_left)
 *from_left = *to_left;
+#endif
 
 while (*from_left  *to_left) {
 
@@ -1666,8 +1674,10 @@
 return( 0 );
 }
 
+#ifdef notdef
 if (*from_left  *to_left)
 *from_left = *to_left;
+#endif
 
 while (*from_left  *to_left) {
 
@@ -1784,8 +1794,10 @@
 return( 0 );
 }
 
+#ifdef notdef
 if (*from_left  *to_left)
 *from_left = *to_left;
+#endif
 
 while (*from_left  *to_left) {
 
@@ -1960,8 +1972,10 @@
 int defstr_len = strlen(default_string);
 
 
+#ifdef notdef
 if (*from_left  *to_left)
 *from_left = *to_left;
+#endif
 
 while (*from_left  *to_left) {
 
@@ -2117,8 +2131,10 @@
 char *outbufptr = *to;
 int from_size = *from_left;
 
+#ifdef notdef
 if (*from_left  *to_left)
 *from_left = *to_left;
+#endif
 
 if (*from_left  *to_left) {
 
@@ -2430,8 +2446,10 @@
 char *outbufptr = *to;
 int from_size = *from_left;
 
+#ifdef notdef
 if (*from_left  *to_left)
 *from_left = *to_left;
+#endif
 
 while (*from_left  *to_left) {
 
@@ -2540,8 +2558,10 @@
 wchar_t *outbufptr = (wchar_t *)*to;
 int from_size = *from_left;
 
+#ifdef notdef
 if (*from_left  *to_left)
 *from_left = *to_left;
+#endif
 
 while (*from_left  *to_left) {
 



CVS commit: src/lib/libperfuse

2010-10-03 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Mon Oct  4 03:56:24 UTC 2010

Modified Files:
src/lib/libperfuse: ops.c

Log Message:
- delete an obsoelte comment about inactive
- remove a test for getattr return field that was never filled
- correctly send filehandle and filehandle flags for getaattr


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/lib/libperfuse/ops.c

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

Modified files:

Index: src/lib/libperfuse/ops.c
diff -u src/lib/libperfuse/ops.c:1.19 src/lib/libperfuse/ops.c:1.20
--- src/lib/libperfuse/ops.c:1.19	Sun Oct  3 05:46:47 2010
+++ src/lib/libperfuse/ops.c	Mon Oct  4 03:56:24 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.19 2010/10/03 05:46:47 manu Exp $ */
+/*  $NetBSD: ops.c,v 1.20 2010/10/04 03:56:24 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -1192,10 +1192,7 @@
 
 	/*
 	 * Do not open twice, and do not reopen for reading
-	 * if we already have write handle. Just ask for
-	 * inactive, in case the node was open by a create
-	 * operation (we are not allowed to call puffs_setback
-	 * at create time, puffs interface forbids it)
+	 * if we already have write handle.
 	 */
 	if (((mode  FREAD)  (pnd-pnd_flags  PND_RFH)) ||
 	((mode  FREAD)  (pnd-pnd_flags  PND_WFH)) ||
@@ -1319,7 +1316,12 @@
 		fgi = GET_INPAYLOAD(ps, pm, fuse_getattr_in);
 		fgi-getattr_flags = 0; 
 		fgi-dummy = 0;
-		fgi-fh = perfuse_get_fh(opc, FREAD);
+		fgi-fh = 0;
+
+		if (PERFUSE_NODE_DATA(opc)-pnd_flags  PND_OPEN) {
+			fgi-fh = perfuse_get_fh(opc, FREAD);
+			fgi-getattr_flags |= FUSE_GETATTR_FH; 
+		}
 
 #ifdef PERFUSE_DEBUG
 		if (perfuse_diagflags  PDF_FH)
@@ -1335,12 +1337,6 @@
 
 		fao = GET_OUTPAYLOAD(ps, pm, fuse_attr_out);
 
-#ifdef PERFUSE_DEBUG
-		if (!(fao-attr_valid  (FUSE_FATTR_SIZE|FUSE_FATTR_MODE|
-	 FUSE_FATTR_UID|FUSE_FATTR_GID)))
-			DERRX(EX_SOFTWARE, %s: fao-attr_valid = 0x%PRId64,
-			  __func__, fao-attr_valid);
-#endif
 		error = puffs_access(VREG, fao-attr.mode, fao-attr.uid,
  fao-attr.gid, (mode_t)mode, pcr); 
 
@@ -1392,10 +1388,12 @@
 	fgi = GET_INPAYLOAD(ps, pm, fuse_getattr_in);
 	fgi-getattr_flags = 0; 
 	fgi-dummy = 0;
-	fgi-fh = perfuse_get_fh(opc, FREAD);
+	fgi-fh = 0;
 
-	if (PERFUSE_NODE_DATA(opc)-pnd_flags  PND_OPEN)
+	if (PERFUSE_NODE_DATA(opc)-pnd_flags  PND_OPEN) {
+		fgi-fh = perfuse_get_fh(opc, FREAD);
 		fgi-getattr_flags |= FUSE_GETATTR_FH;
+	}
 
 	if ((error = xchg_msg(pu, opc, pm, sizeof(*fao), wait_reply)) != 0)
 		goto out;
@@ -2760,7 +2758,7 @@
 			pm = ps-ps_new_msg(pu, opc, FUSE_GETATTR, 
 	sizeof(*fgi), NULL);
 			fgi = GET_INPAYLOAD(ps, pm, fuse_getattr_in);
-			fgi-getattr_flags = 0; 
+			fgi-getattr_flags = FUSE_GETATTR_FH; 
 			fgi-dummy = 0;
 			fgi-fh = perfuse_get_fh(opc, FWRITE);