CVS commit: src/sys/ufs/ufs

2012-10-14 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Oct 14 23:57:32 UTC 2012

Modified Files:
src/sys/ufs/ufs: ufs_lookup.c

Log Message:
Add an XXX comment about a broken error case in ufs_dirremove.
(this was in one of my old rename patches)


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/ufs/ufs/ufs_lookup.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/ufs/ufs/ufs_lookup.c
diff -u src/sys/ufs/ufs/ufs_lookup.c:1.117 src/sys/ufs/ufs/ufs_lookup.c:1.118
--- src/sys/ufs/ufs/ufs_lookup.c:1.117	Sun Jul 22 00:53:22 2012
+++ src/sys/ufs/ufs/ufs_lookup.c	Sun Oct 14 23:57:32 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_lookup.c,v 1.117 2012/07/22 00:53:22 rmind Exp $	*/
+/*	$NetBSD: ufs_lookup.c,v 1.118 2012/10/14 23:57:32 dholland Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.117 2012/07/22 00:53:22 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.118 2012/10/14 23:57:32 dholland Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ffs.h"
@@ -1115,6 +1115,13 @@ out:
 		ip->i_flag |= IN_CHANGE;
 		UFS_WAPBL_UPDATE(ITOV(ip), NULL, NULL, 0);
 	}
+	/*
+	 * XXX did it ever occur to anyone that it might be a good
+	 * idea to restore ip->i_nlink if this fails? Or something?
+	 * Currently on error return from this function the state of
+	 * ip->i_nlink depends on what happened, and callers
+	 * definitely do not take this into account.
+	 */
 	error = VOP_BWRITE(bp->b_vp, bp);
 	dp->i_flag |= IN_CHANGE | IN_UPDATE;
 	/*



CVS commit: src/sys

2012-10-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 14 20:56:55 UTC 2012

Modified Files:
src/sys/kern: kern_exec.c
src/sys/sys: sysctl.h

Log Message:
remove KERN_USRSTACK


To generate a diff of this commit:
cvs rdiff -u -r1.356 -r1.357 src/sys/kern/kern_exec.c
cvs rdiff -u -r1.202 -r1.203 src/sys/sys/sysctl.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/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.356 src/sys/kern/kern_exec.c:1.357
--- src/sys/kern/kern_exec.c:1.356	Sat Oct 13 11:35:55 2012
+++ src/sys/kern/kern_exec.c	Sun Oct 14 16:56:55 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.356 2012/10/13 15:35:55 christos Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.357 2012/10/14 20:56:55 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.356 2012/10/13 15:35:55 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.357 2012/10/14 20:56:55 christos Exp $");
 
 #include "opt_exec.h"
 #include "opt_ktrace.h"
@@ -104,7 +104,6 @@ __KERNEL_RCSID(0, "$NetBSD: kern_exec.c,
 #include 
 #include 
 #include 
-#include 
 
 #include 
 
@@ -1618,30 +1617,6 @@ exec_remove(struct execsw *esp, int coun
 	return 0;
 }
 
-static int
-sysctl_kern_usrstack(SYSCTLFN_ARGS)
-{  
-	u_long ptr;
-	struct sysctlnode node = *rnode;
-	node.sysctl_data = &ptr;
-	ptr = l->l_proc->p_stackbase;
-	return sysctl_lookup(SYSCTLFN_CALL(&node));
-}
-
-static void
-sysctl_kern_usrstack_setup(void)
-{
-	struct sysctllog *kern_usrstack_sysctllog;
-
-	kern_usrstack_sysctllog = NULL;
-	sysctl_createv(&kern_usrstack_sysctllog, 0, NULL, NULL,
-	CTLFLAG_PERMANENT|CTLFLAG_READONLY,
-	CTLTYPE_LONG, "usrstack", 
-	SYSCTL_DESCR("User process stack base"),
-	sysctl_kern_usrstack, 0, NULL, 0,
-	CTL_KERN, KERN_USRSTACK, CTL_EOL);
-}
-
 /*
  * Initialize exec structures. If init_boot is true, also does necessary
  * one-time initialization (it's called from main() that way).
@@ -1665,7 +1640,6 @@ exec_init(int init_boot)
 		pool_init(&exec_pool, NCARGS, 0, 0, PR_NOALIGN|PR_NOTOUCH,
 		"execargs", &exec_palloc, IPL_NONE);
 		pool_sethardlimit(&exec_pool, maxexec, "should not happen", 0);
-		sysctl_kern_usrstack_setup();
 	} else {
 		KASSERT(rw_write_held(&exec_lock));
 	}

Index: src/sys/sys/sysctl.h
diff -u src/sys/sys/sysctl.h:1.202 src/sys/sys/sysctl.h:1.203
--- src/sys/sys/sysctl.h:1.202	Sat Oct 13 11:35:56 2012
+++ src/sys/sys/sysctl.h	Sun Oct 14 16:56:55 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysctl.h,v 1.202 2012/10/13 15:35:56 christos Exp $	*/
+/*	$NetBSD: sysctl.h,v 1.203 2012/10/14 20:56:55 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -273,8 +273,7 @@ struct ctlname {
 #define	KERN_SYSVIPC		82	/* node: SysV IPC parameters */
 #define	KERN_BOOTTIME		83	/* struct: time kernel was booted */
 #define	KERN_EVCNT		84	/* struct: evcnts */
-#define	KERN_USRSTACK		85	/* long: user stack base */
-#define	KERN_MAXID		86	/* number of valid kern ids */
+#define	KERN_MAXID		85	/* number of valid kern ids */
 
 
 #define	CTL_KERN_NAMES { \
@@ -363,7 +362,6 @@ struct ctlname {
 	{ "sysvipc", CTLTYPE_STRUCT }, \
 	{ "boottime", CTLTYPE_STRUCT }, \
 	{ "evcnt", CTLTYPE_STRUCT }, \
-	{ "usrstack", CTLTYPE_LONG }, \
 }
 
 /*



CVS commit: src/sys/arch/amiga

2012-10-14 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Oct 14 20:33:18 UTC 2012

Modified Files:
src/sys/arch/amiga/conf: files.amiga
src/sys/arch/amiga/dev: grf_cv3d.c

Log Message:
CV3DONZORRO2 option is no longer needed.
grf_cv3d.c was successfully tested running in a Zorro2 slot.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/arch/amiga/conf/files.amiga
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/amiga/dev/grf_cv3d.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/amiga/conf/files.amiga
diff -u src/sys/arch/amiga/conf/files.amiga:1.161 src/sys/arch/amiga/conf/files.amiga:1.162
--- src/sys/arch/amiga/conf/files.amiga:1.161	Sun Oct 14 13:36:07 2012
+++ src/sys/arch/amiga/conf/files.amiga	Sun Oct 14 20:33:17 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files.amiga,v 1.161 2012/10/14 13:36:07 phx Exp $
+#	$NetBSD: files.amiga,v 1.162 2012/10/14 20:33:17 phx Exp $
 
 # maxpartitions must be first item in files.${ARCH}.newconf
 maxpartitions 16			# NOTE THAT AMIGA IS SPECIAL!
@@ -18,7 +18,6 @@ defflag	opt_amigaccgrf.h	USE_C_BFOPS
 
 defflag	opt_amigacons.h		RETINACONSOLE ULOWELLCONSOLE CL5426CONSOLE
 defflag	opt_amigacons.h		CV64CONSOLE CV3DCONSOLE TSENGCONSOLE
-defflag	opt_amigacons.h		CV3DONZORRO2
 defflag	opt_amigacons.h		SERCONSOLE
 
 defflag	opt_kfont.h		KFONT_CONS_ISO8859_1

Index: src/sys/arch/amiga/dev/grf_cv3d.c
diff -u src/sys/arch/amiga/dev/grf_cv3d.c:1.26 src/sys/arch/amiga/dev/grf_cv3d.c:1.27
--- src/sys/arch/amiga/dev/grf_cv3d.c:1.26	Thu Dec 15 14:25:13 2011
+++ src/sys/arch/amiga/dev/grf_cv3d.c	Sun Oct 14 20:33:17 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf_cv3d.c,v 1.26 2011/12/15 14:25:13 phx Exp $ */
+/*	$NetBSD: grf_cv3d.c,v 1.27 2012/10/14 20:33:17 phx Exp $ */
 
 /*
  * Copyright (c) 1995 Michael Teske
@@ -33,7 +33,7 @@
 #include "opt_amigacons.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: grf_cv3d.c,v 1.26 2011/12/15 14:25:13 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf_cv3d.c,v 1.27 2012/10/14 20:33:17 phx Exp $");
 
 #include "ite.h"
 #include "wsdisplay.h"
@@ -406,12 +406,6 @@ grfcv3dmatch(struct device *pdp, struct 
 	if (zap->manid != 8512 || zap->prodid != 67)
 		return (0);
 
-#ifndef CV3DONZORRO2
-	if (!cv3d_zorroIII) {
-		return (0);
-	}
-#endif
-
 	cv3d_boardaddr = zap->va;
 
 #ifdef CV3DCONSOLE



CVS commit: src/sys/dev/marvell

2012-10-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Oct 14 19:17:08 UTC 2012

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

Log Message:
Add Interrupt Coalescing setting by Robert Swindells.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/marvell/if_mvgbe.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/if_mvgbe.c
diff -u src/sys/dev/marvell/if_mvgbe.c:1.23 src/sys/dev/marvell/if_mvgbe.c:1.24
--- src/sys/dev/marvell/if_mvgbe.c:1.23	Fri Oct 12 10:38:06 2012
+++ src/sys/dev/marvell/if_mvgbe.c	Sun Oct 14 19:17:08 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvgbe.c,v 1.23 2012/10/12 10:38:06 msaitoh Exp $	*/
+/*	$NetBSD: if_mvgbe.c,v 1.24 2012/10/14 19:17:08 msaitoh Exp $	*/
 /*
  * Copyright (c) 2007, 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.23 2012/10/12 10:38:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.24 2012/10/14 19:17:08 msaitoh Exp $");
 
 #include 
 #include 
@@ -206,6 +206,7 @@ struct mvgbe_softc {
 	struct mvgbe_ring_data *sc_rdata;
 	bus_dmamap_t sc_ring_map;
 	int sc_if_flags;
+	int sc_ipg_rx;
 	int sc_wdogsoft;
 
 	LIST_HEAD(__mvgbe_jfreehead, mvgbe_jpool_entry) sc_jfree_listhead;
@@ -263,6 +264,7 @@ static void mvgbe_filter_setup(struct mv
 #ifdef MVGBE_DEBUG
 static void mvgbe_dump_txdesc(struct mvgbe_tx_desc *, int);
 #endif
+static uint32_t mvgbe_ipg_rx(struct mvgbec_softc *, struct mvgbe_softc *);
 
 CFATTACH_DECL_NEW(mvgbec_gt, sizeof(struct mvgbec_softc),
 mvgbec_match, mvgbec_attach, NULL, NULL);
@@ -282,6 +284,8 @@ struct mvgbe_port {
 	int flags;
 #define FLAGS_FIX_TQTB	(1 << 0)
 #define FLAGS_FIX_MTU	(1 << 1)
+#define	FLAGS_IPG1	(1 << 2)
+#define	FLAGS_IPG2	(1 << 3)
 } mvgbe_ports[] = {
 	{ MARVELL_DISCOVERY_II,		0, 3, { 32, 33, 34 }, 0 },
 	{ MARVELL_DISCOVERY_III,	0, 3, { 32, 33, 34 }, 0 },
@@ -292,26 +296,26 @@ struct mvgbe_port {
 #endif
 	{ MARVELL_ORION_1_88F5082,	0, 1, { 21 }, FLAGS_FIX_MTU },
 	{ MARVELL_ORION_1_88F5180N,	0, 1, { 21 }, FLAGS_FIX_MTU },
-	{ MARVELL_ORION_1_88F5181,	0, 1, { 21 }, FLAGS_FIX_MTU },
-	{ MARVELL_ORION_1_88F5182,	0, 1, { 21 }, FLAGS_FIX_MTU },
-	{ MARVELL_ORION_2_88F5281,	0, 1, { 21 }, FLAGS_FIX_MTU },
+	{ MARVELL_ORION_1_88F5181,	0, 1, { 21 }, FLAGS_FIX_MTU | FLAGS_IPG1 },
+	{ MARVELL_ORION_1_88F5182,	0, 1, { 21 }, FLAGS_FIX_MTU | FLAGS_IPG1 },
+	{ MARVELL_ORION_2_88F5281,	0, 1, { 21 }, FLAGS_FIX_MTU | FLAGS_IPG1 },
 	{ MARVELL_ORION_1_88F6082,	0, 1, { 21 }, FLAGS_FIX_MTU },
 	{ MARVELL_ORION_1_88W8660,	0, 1, { 21 }, FLAGS_FIX_MTU },
 
-	{ MARVELL_KIRKWOOD_88F6180,	0, 1, { 11 }, FLAGS_FIX_TQTB },
-	{ MARVELL_KIRKWOOD_88F6192,	0, 1, { 11 }, FLAGS_FIX_TQTB },
-	{ MARVELL_KIRKWOOD_88F6192,	1, 1, { 15 }, FLAGS_FIX_TQTB },
-	{ MARVELL_KIRKWOOD_88F6281,	0, 1, { 11 }, FLAGS_FIX_TQTB },
-	{ MARVELL_KIRKWOOD_88F6281,	1, 1, { 15 }, FLAGS_FIX_TQTB },
-	{ MARVELL_KIRKWOOD_88F6282,	0, 1, { 11 }, FLAGS_FIX_TQTB },
-	{ MARVELL_KIRKWOOD_88F6282,	1, 1, { 15 }, FLAGS_FIX_TQTB },
-
-	{ MARVELL_MV78XX0_MV78100,	0, 1, { 40 }, FLAGS_FIX_TQTB },
-	{ MARVELL_MV78XX0_MV78100,	1, 1, { 44 }, FLAGS_FIX_TQTB },
-	{ MARVELL_MV78XX0_MV78200,	0, 1, { 40 }, FLAGS_FIX_TQTB },
-	{ MARVELL_MV78XX0_MV78200,	1, 1, { 44 }, FLAGS_FIX_TQTB },
-	{ MARVELL_MV78XX0_MV78200,	2, 1, { 48 }, FLAGS_FIX_TQTB },
-	{ MARVELL_MV78XX0_MV78200,	3, 1, { 52 }, FLAGS_FIX_TQTB },
+	{ MARVELL_KIRKWOOD_88F6180,	0, 1, { 11 }, FLAGS_FIX_TQTB | FLAGS_IPG2 },
+	{ MARVELL_KIRKWOOD_88F6192,	0, 1, { 11 }, FLAGS_FIX_TQTB | FLAGS_IPG2 },
+	{ MARVELL_KIRKWOOD_88F6192,	1, 1, { 15 }, FLAGS_FIX_TQTB | FLAGS_IPG2 },
+	{ MARVELL_KIRKWOOD_88F6281,	0, 1, { 11 }, FLAGS_FIX_TQTB | FLAGS_IPG2 },
+	{ MARVELL_KIRKWOOD_88F6281,	1, 1, { 15 }, FLAGS_FIX_TQTB | FLAGS_IPG2 },
+	{ MARVELL_KIRKWOOD_88F6282,	0, 1, { 11 }, FLAGS_FIX_TQTB | FLAGS_IPG2 },
+	{ MARVELL_KIRKWOOD_88F6282,	1, 1, { 15 }, FLAGS_FIX_TQTB | FLAGS_IPG2 },
+
+	{ MARVELL_MV78XX0_MV78100,	0, 1, { 40 }, FLAGS_FIX_TQTB | FLAGS_IPG2 },
+	{ MARVELL_MV78XX0_MV78100,	1, 1, { 44 }, FLAGS_FIX_TQTB | FLAGS_IPG2 },
+	{ MARVELL_MV78XX0_MV78200,	0, 1, { 40 }, FLAGS_FIX_TQTB | FLAGS_IPG2 },
+	{ MARVELL_MV78XX0_MV78200,	1, 1, { 44 }, FLAGS_FIX_TQTB | FLAGS_IPG2 },
+	{ MARVELL_MV78XX0_MV78200,	2, 1, { 48 }, FLAGS_FIX_TQTB | FLAGS_IPG2 },
+	{ MARVELL_MV78XX0_MV78200,	3, 1, { 52 }, FLAGS_FIX_TQTB | FLAGS_IPG2 },
 };
 
 
@@ -801,6 +805,18 @@ fail1:
 	return;
 }
 
+static uint32_t
+mvgbe_ipg_rx(struct mvgbec_softc *csc, struct mvgbe_softc *sc)
+{
+
+	if (csc->sc_flags & FLAGS_IPG2)
+		return (((sc->sc_ipg_rx & 0x8000) << 10) |
+			((sc->sc_ipg_rx & 0x7fff) << 7));
+	else if (csc->sc_flags & FLAGS_IPG1)
+		return ((sc->sc_ipg_rx & 0x3fff) << 8);
+	else
+		return 0;
+}
 
 static int
 mvgbe_intr(void *arg)
@@ -974,6 +990,8 @@ mvgbe_init(struct ifnet *ifp)
 		return ENOBUFS;
 	}
 
+	if ((csc->sc_flags & FL

CVS commit: src/sys/dev/pci

2012-10-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Oct 14 19:10:41 UTC 2012

Modified Files:
src/sys/dev/pci: if_mskvar.h

Log Message:
struct device * -> device_t change.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/if_mskvar.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/dev/pci/if_mskvar.h
diff -u src/sys/dev/pci/if_mskvar.h:1.10 src/sys/dev/pci/if_mskvar.h:1.11
--- src/sys/dev/pci/if_mskvar.h:1.10	Thu Feb  2 19:43:05 2012
+++ src/sys/dev/pci/if_mskvar.h	Sun Oct 14 19:10:41 2012
@@ -1,5 +1,5 @@
 /*	$OpenBSD: if_mskvar.h,v 1.3 2006/12/28 16:34:42 kettenis Exp $	*/
-/*	$NetBSD: if_mskvar.h,v 1.10 2012/02/02 19:43:05 tls Exp $	*/
+/*	$NetBSD: if_mskvar.h,v 1.11 2012/10/14 19:10:41 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -184,7 +184,7 @@ struct sk_if_softc;
 
 /* Softc for the Yukon-II controller. */
 struct sk_softc {
-	struct device		*sk_dev;	/* generic device */
+	device_t		sk_dev;
 	bus_space_handle_t	sk_bhandle;	/* bus space handle */
 	bus_space_tag_t		sk_btag;	/* bus space tag */
 	void			*sk_intrhand;	/* irq handler handle */
@@ -210,7 +210,7 @@ struct sk_softc {
 
 /* Softc for each logical interface */
 struct sk_if_softc {
-	struct device		*sk_dev;	/* generic device */
+	device_t		sk_dev;
 	struct ethercom		sk_ethercom;	/* interface info */
 	struct mii_data		sk_mii;
 	u_int8_t		sk_enaddr[ETHER_ADDR_LEN]; /* station addr */



CVS commit: src/sys/arch/x68k/dev

2012-10-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Oct 14 19:06:26 UTC 2012

Modified Files:
src/sys/arch/x68k/dev: fd.c

Log Message:
KNF and space nits


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/x68k/dev/fd.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/x68k/dev/fd.c
diff -u src/sys/arch/x68k/dev/fd.c:1.104 src/sys/arch/x68k/dev/fd.c:1.105
--- src/sys/arch/x68k/dev/fd.c:1.104	Sun Oct 14 18:38:32 2012
+++ src/sys/arch/x68k/dev/fd.c	Sun Oct 14 19:06:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.104 2012/10/14 18:38:32 tsutsui Exp $	*/
+/*	$NetBSD: fd.c,v 1.105 2012/10/14 19:06:25 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.104 2012/10/14 18:38:32 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.105 2012/10/14 19:06:25 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_m68k_arch.h"
@@ -713,7 +713,7 @@ fdstrategy(struct buf *bp)
 
 	DPRINTF(("fdstrategy: %s b_blkno %" PRId64 " b_bcount %d cylin %d\n",
 	bp->b_flags & B_READ ? "read" : "write",
-		 bp->b_blkno, bp->b_bcount, bp->b_cylinder));
+	bp->b_blkno, bp->b_bcount, bp->b_cylinder));
 	/* Queue transfer on drive, activate drive and controller if idle. */
 	s = splbio();
 	bufq_put(fd->sc_q, bp);
@@ -818,7 +818,7 @@ void
 fd_motor_off(void *arg)
 {
 	struct fd_softc *fd = arg;
- 	struct fdc_softc *fdc = device_private(device_parent(fd->sc_dev));
+	struct fdc_softc *fdc = device_private(device_parent(fd->sc_dev));
 	int s;
 
 	DPRINTF(("fd_motor_off:\n"));
@@ -975,8 +975,10 @@ fdcstart(struct fdc_softc *fdc)
 {
 
 #ifdef DIAGNOSTIC
-	/* only got here if controller's drive queue was inactive; should
-	   be in idle state */
+	/*
+	 * only got here if controller's drive queue was inactive; should
+	 * be in idle state
+	 */
 	if (fdc->sc_state != DEVIDLE) {
 		printf("fdcstart: not idle\n");
 		return;



CVS commit: src/doc

2012-10-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Oct 14 18:42:22 UTC 2012

Modified Files:
src/doc: CHANGES

Log Message:
Note x68k formatting floppy support.


To generate a diff of this commit:
cvs rdiff -u -r1.1748 -r1.1749 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1748 src/doc/CHANGES:1.1749
--- src/doc/CHANGES:1.1748	Fri Oct 12 20:21:43 2012
+++ src/doc/CHANGES	Sun Oct 14 18:42:22 2012
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.1748 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.1749 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -126,3 +126,4 @@ Changes from NetBSD 6.0 to NetBSD 7.0:
 	wpa:	New wpa_supplicant(8) and hostapd(8) 1.0 [christos 20121007]
 	x68k: Add network bootloader for Neptune-X and Nereid Ethernet.
 		[tsutsui,isaki 20121012]
+	x68k: Add support for formatting floppy. [tsutsui 20121014]



CVS commit: src/sys/arch/x68k/dev

2012-10-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Oct 14 18:38:32 UTC 2012

Modified Files:
src/sys/arch/x68k/dev: fd.c fdreg.h

Log Message:
Add floppy format support.  Mostly taken from sys/dev/isa/fd.c.

Tested both fdNa (1232KB, 1024bytes/sector, 8sectors/track) and
fdNc (1200KB, 512bytes/sector, 15sectors/track) format on X68030
using fdformat(1).

Finally we can prepare NetBSD/x68k install floppies without Human68k
(except actual initial bootstrap).


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/x68k/dev/fd.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x68k/dev/fdreg.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/x68k/dev/fd.c
diff -u src/sys/arch/x68k/dev/fd.c:1.103 src/sys/arch/x68k/dev/fd.c:1.104
--- src/sys/arch/x68k/dev/fd.c:1.103	Sun Oct 14 17:25:59 2012
+++ src/sys/arch/x68k/dev/fd.c	Sun Oct 14 18:38:32 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.103 2012/10/14 17:25:59 tsutsui Exp $	*/
+/*	$NetBSD: fd.c,v 1.104 2012/10/14 18:38:32 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.103 2012/10/14 17:25:59 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.104 2012/10/14 18:38:32 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_m68k_arch.h"
@@ -87,6 +87,7 @@ __KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.103
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -112,6 +113,9 @@ int fddebug = 0;
 #define FDUNIT(dev)	(minor(dev) / 8)
 #define FDTYPE(dev)	(minor(dev) % 8)
 
+/* (mis)use device use flag to identify format operation */
+#define B_FORMAT B_DEVPRIVATE
+
 enum fdc_state {
 	DEVIDLE = 0,
 	MOTORWAIT,
@@ -184,19 +188,29 @@ struct fd_type {
 	int	size;		/* size of disk in sectors */
 	int	step;		/* steps per cylinder */
 	int	rate;		/* transfer speed code */
+	uint8_t	fillbyte;	/* format fill byte */
+	uint8_t	interleave;	/* interleave factor (formatting) */
 	const char *name;
 };
 
 /* The order of entries in the following table is important -- BEWARE! */
 struct fd_type fd_types[] = {
-{  8,2,16,3,0xff,0xdf,0x35,0x74,77,1232,1,FDC_500KBPS, "1.2MB/[1024bytes/sector]"}, /* 1.2 MB japanese format */
-{ 18,2,36,2,0xff,0xcf,0x1b,0x6c,80,2880,1,FDC_500KBPS,"1.44MB"}, /* 1.44MB diskette */
-{ 15,2,30,2,0xff,0xdf,0x1b,0x54,80,2400,1,FDC_500KBPS, "1.2MB"}, /* 1.2 MB AT-diskettes */
-{  9,2,18,2,0xff,0xdf,0x23,0x50,40, 720,2,FDC_300KBPS, "360KB/AT" }, /* 360kB in 1.2MB drive */
-{  9,2,18,2,0xff,0xdf,0x2a,0x50,40, 720,1,FDC_250KBPS, "360KB/PC" }, /* 360kB PC diskettes */
-{  9,2,18,2,0xff,0xdf,0x2a,0x50,80,1440,1,FDC_250KBPS, "720KB"}, /* 3.5" 720kB diskette */
-{  9,2,18,2,0xff,0xdf,0x23,0x50,80,1440,1,FDC_300KBPS, "720KB/x"  }, /* 720kB in 1.2MB drive */
-{  9,2,18,2,0xff,0xdf,0x2a,0x50,40, 720,2,FDC_250KBPS, "360KB/x"  }, /* 360kB in 720kB drive */
+	{  8,2,16,3,0xff,0xdf,0x35,0x74,77,1232,1,FDC_500KBPS, 0xf6, 1,
+	"1.2MB/[1024bytes/sector]"}, /* 1.2 MB japanese format */
+	{ 18,2,36,2,0xff,0xcf,0x1b,0x6c,80,2880,1,FDC_500KBPS, 0xf6, 1,
+	"1.44MB"}, /* 1.44MB diskette */
+	{ 15,2,30,2,0xff,0xdf,0x1b,0x54,80,2400,1,FDC_500KBPS, 0xf6, 1,
+	"1.2MB"}, /* 1.2 MB AT-diskettes */
+	{  9,2,18,2,0xff,0xdf,0x23,0x50,40, 720,2,FDC_300KBPS, 0xf6, 1,
+	"360KB/AT" }, /* 360kB in 1.2MB drive */
+	{  9,2,18,2,0xff,0xdf,0x2a,0x50,40, 720,1,FDC_250KBPS, 0xf6, 1,
+	"360KB/PC" }, /* 360kB PC diskettes */
+	{  9,2,18,2,0xff,0xdf,0x2a,0x50,80,1440,1,FDC_250KBPS, 0xf6, 1,
+	"720KB"}, /* 3.5" 720kB diskette */
+	{  9,2,18,2,0xff,0xdf,0x23,0x50,80,1440,1,FDC_300KBPS, 0xf6, 1,
+	"720KB/x"  }, /* 720kB in 1.2MB drive */
+	{  9,2,18,2,0xff,0xdf,0x2a,0x50,40, 720,2,FDC_250KBPS, 0xf6, 1,
+	"360KB/x"  }, /* 360kB in 720kB drive */
 };
 
 /* software state, per disk (with up to 4 disks per ctlr) */
@@ -283,6 +297,7 @@ void fdcpseudointr(void *);
 void fdcretry(struct fdc_softc *);
 void fdfinish(struct fd_softc *, struct buf *);
 inline struct fd_type *fd_dev_to_type(struct fd_softc *, dev_t);
+int fdformat(dev_t, struct ne7_fd_formb *, struct lwp *);
 static int fdcpoll(struct fdc_softc *);
 static int fdgetdisklabel(struct fd_softc *, dev_t);
 static void fd_do_eject(struct fdc_softc *, int);
@@ -659,7 +674,8 @@ fdstrategy(struct buf *bp)
 	}
 
 	if (bp->b_blkno < 0 ||
-	(bp->b_bcount % FDC_BSIZE) != 0) {
+	((bp->b_bcount % FDC_BSIZE) != 0 &&
+	 (bp->b_flags & B_FORMAT) == 0)) {
 		DPRINTF(("fdstrategy: unit=%d, blkno=%" PRId64 ", "
 		"bcount=%d\n", unit,
 		bp->b_blkno, bp->b_bcount));
@@ -943,6 +959,9 @@ fdclose(dev_t dev, int flags, int mode, 
 		break;
 	}
 
+	/* clear flags */
+	fd->sc_opts &= ~(FDOPT_NORETRY | FDOPT_SILENT);
+
 	if ((fd->sc_flags & FD_OPEN) == 0) {
 		bus_space_write_1(fdc->sc_iot, fdc-

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

2012-10-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Oct 14 18:37:55 UTC 2012

Modified Files:
src/sys/arch/evbarm/iq80310: i80312_mainbus.c

Log Message:
struct device * -> device_t change.
Not tested though.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/evbarm/iq80310/i80312_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/evbarm/iq80310/i80312_mainbus.c
diff -u src/sys/arch/evbarm/iq80310/i80312_mainbus.c:1.15 src/sys/arch/evbarm/iq80310/i80312_mainbus.c:1.16
--- src/sys/arch/evbarm/iq80310/i80312_mainbus.c:1.15	Wed Oct  3 16:51:44 2012
+++ src/sys/arch/evbarm/iq80310/i80312_mainbus.c	Sun Oct 14 18:37:55 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: i80312_mainbus.c,v 1.15 2012/10/03 16:51:44 chs Exp $	*/
+/*	$NetBSD: i80312_mainbus.c,v 1.16 2012/10/14 18:37:55 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i80312_mainbus.c,v 1.15 2012/10/03 16:51:44 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i80312_mainbus.c,v 1.16 2012/10/14 18:37:55 msaitoh Exp $");
 
 #include 
 #include 
@@ -60,17 +60,17 @@ __KERNEL_RCSID(0, "$NetBSD: i80312_mainb
 #include 
 #include 
 
-int	i80312_mainbus_match(struct device *, struct cfdata *, void *);
-void	i80312_mainbus_attach(struct device *, struct device *, void *);
+int	i80312_mainbus_match(device_t, cfdata_t, void *);
+void	i80312_mainbus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(iopxs_mainbus, sizeof(struct i80312_softc),
+CFATTACH_DECL_NEW(iopxs_mainbus, sizeof(struct i80312_softc),
 i80312_mainbus_match, i80312_mainbus_attach, NULL, NULL);
 
 /* There can be only one. */
 int	i80312_mainbus_found;
 
 int
-i80312_mainbus_match(struct device *parent, struct cfdata *cf, void *aux)
+i80312_mainbus_match(device_t parent, cfdata_t cf, void *aux)
 {
 #if 0
 	struct mainbus_attach_args *ma = aux;
@@ -91,13 +91,14 @@ i80312_mainbus_match(struct device *pare
 }
 
 void
-i80312_mainbus_attach(struct device *parent, struct device *self, void *aux)
+i80312_mainbus_attach(device_t parent, device_t self, void *aux)
 {
-	struct i80312_softc *sc = (void *) self;
+	struct i80312_softc *sc = device_private(self);
 	paddr_t memstart;
 	psize_t memsize;
 
 	i80312_mainbus_found = 1;
+	sc->sc_dev = self;
 	iq80310_intr_evcnt_attach();
 
 	/*
@@ -116,7 +117,7 @@ i80312_mainbus_attach(struct device *par
 	if (bus_space_subregion(sc->sc_st, sc->sc_sh, I80312_MEM_BASE,
 	I80312_MEM_SIZE, &sc->sc_mem_sh))
 		panic("%s: unable to subregion MEM registers",
-		sc->sc_dev.dv_xname);
+		device_xname(self));
 
 	/*
 	 * We have mapped the PCI I/O windows in the early bootstrap phase.



CVS commit: src/share/man/man4

2012-10-14 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Oct 14 17:52:55 UTC 2012

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

Log Message:
Fix path to firmware. From ISIHARA Takanori in PR 47076.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/share/man/man4/wpi.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/wpi.4
diff -u src/share/man/man4/wpi.4:1.13 src/share/man/man4/wpi.4:1.14
--- src/share/man/man4/wpi.4:1.13	Fri Jan 15 19:24:49 2010
+++ src/share/man/man4/wpi.4	Sun Oct 14 17:52:55 2012
@@ -1,4 +1,4 @@
-.\" $NetBSD: wpi.4,v 1.13 2010/01/15 19:24:49 joerg Exp $
+.\" $NetBSD: wpi.4,v 1.14 2012/10/14 17:52:55 wiz Exp $
 .\"
 .\" Copyright (c) 2006
 .\"	Damien Bergamini . All rights reserved.
@@ -25,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd February 4, 2009
+.Dd October 14, 2012
 .Dt WPI 4
 .Os
 .Sh NAME
@@ -172,7 +172,7 @@ The driver needs at least version 2.14.4
 which is loaded when an interface is brought up:
 .Pp
 .Bl -tag -width Ds -offset indent -compact
-.It Pa /libdata/if_wpi/iwlwifi-3945.ucode
+.It Pa /libdata/firmware/if_wpi/iwlwifi-3945.ucode
 .El
 .Sh EXAMPLES
 .Bd -literal -offset indent



CVS commit: src/sys/arch/x68k/dev

2012-10-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Oct 14 17:25:59 UTC 2012

Modified Files:
src/sys/arch/x68k/dev: fd.c

Log Message:
Terminate DMAC and call bus_dmamap_unload(9) properly in all FDC xfer
error paths, as sys/dev/isa/fd.c does.  Fixes unexpected DMAC errors
(and possible VM panic due to un-unloaded dmamap) on the first floppy
access after read/write errors.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/arch/x68k/dev/fd.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/x68k/dev/fd.c
diff -u src/sys/arch/x68k/dev/fd.c:1.102 src/sys/arch/x68k/dev/fd.c:1.103
--- src/sys/arch/x68k/dev/fd.c:1.102	Sun Oct 14 17:20:18 2012
+++ src/sys/arch/x68k/dev/fd.c	Sun Oct 14 17:25:59 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.102 2012/10/14 17:20:18 tsutsui Exp $	*/
+/*	$NetBSD: fd.c,v 1.103 2012/10/14 17:25:59 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.102 2012/10/14 17:20:18 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.103 2012/10/14 17:25:59 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_m68k_arch.h"
@@ -291,6 +291,7 @@ void fd_mountroot_hook(device_t);
 
 /* DMA transfer routines */
 inline static void fdc_dmastart(struct fdc_softc *, int, void *, vsize_t);
+inline static void fdc_dmaabort(struct fdc_softc *);
 static int fdcdmaintr(void *);
 static int fdcdmaerrintr(void *);
 
@@ -333,6 +334,14 @@ fdc_dmastart(struct fdc_softc *fdc, int 
 	dmac_start_xfer(fdc->sc_dmachan->ch_softc, fdc->sc_xfer);
 }
 
+inline static void
+fdc_dmaabort(struct fdc_softc *fdc)
+{
+
+	dmac_abort_xfer(fdc->sc_dmachan->ch_softc, fdc->sc_xfer);
+	bus_dmamap_unload(fdc->sc_dmat, fdc->sc_dmamap);
+}
+
 static int
 fdcdmaintr(void *arg)
 {
@@ -1346,9 +1355,7 @@ fdcintr(void *arg)
 		goto doio;
 
 	case IOTIMEDOUT:
-#if 0
-		isa_dmaabort(fdc->sc_drq);
-#endif
+		fdc_dmaabort(fdc);
 	case SEEKTIMEDOUT:
 	case RECALTIMEDOUT:
 	case RESETTIMEDOUT:
@@ -1359,9 +1366,7 @@ fdcintr(void *arg)
 		callout_stop(&fdc->sc_timo_ch);
 		DPRINTF(("fdcintr: in IOCOMPLETE\n"));
 		if ((tmp = fdcresult(fdc)) != 7 || (st0 & 0xf8) != 0) {
-#if 0
-			isa_dmaabort(fdc->sc_drq);
-#endif
+			fdc_dmaabort(fdc);
 			fdcstatus(fd->sc_dev, tmp, bp->b_flags & B_READ ?
 			"read failed" : "write failed");
 			printf("blkno %" PRId64 " nblks %d\n",
@@ -1369,10 +1374,6 @@ fdcintr(void *arg)
 			fdcretry(fdc);
 			goto loop;
 		}
-#if 0
-		isa_dmadone(bp->b_flags & B_READ, bp->b_data + fd->sc_skip,
-		nblks * FDC_BSIZE, fdc->sc_drq);
-#endif
 	iocomplete2:
 		if (fdc->sc_errors) {
 			diskerr(bp, "fd", "soft error (corrected)", LOG_PRINTF,
@@ -1398,9 +1399,7 @@ fdcintr(void *arg)
 		callout_stop(&fdc->sc_timo_ch);
 		if ((tmp = fdcresult(fdc)) != 7 || (st0 & 0xf8) != 0) {
 			printf("fdcintr: resnum=%d, st0=%x\n", tmp, st0);
-#if 0
-			isa_dmaabort(fdc->sc_drq);
-#endif
+			fdc_dmaabort(fdc);
 			fdcstatus(fd->sc_dev, 7, bp->b_flags & B_READ ?
 			"read failed" : "write failed");
 			printf("blkno %" PRId64 " nblks %d\n",



CVS commit: src/sys/arch/x68k/dev

2012-10-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Oct 14 17:20:18 UTC 2012

Modified Files:
src/sys/arch/x68k/dev: fd.c

Log Message:
Before probing floppy drives, call NE7CMD_SENSEI and fdcresult()
to drain possible pending FDC interrupts.  Taken from sys/dev/isa/fd.c.
Hopefully might fix occasional fd drive probe failure (but not confirmed).


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/x68k/dev/fd.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/x68k/dev/fd.c
diff -u src/sys/arch/x68k/dev/fd.c:1.101 src/sys/arch/x68k/dev/fd.c:1.102
--- src/sys/arch/x68k/dev/fd.c:1.101	Tue May 15 12:17:33 2012
+++ src/sys/arch/x68k/dev/fd.c	Sun Oct 14 17:20:18 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.101 2012/05/15 12:17:33 tsutsui Exp $	*/
+/*	$NetBSD: fd.c,v 1.102 2012/10/14 17:20:18 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.101 2012/05/15 12:17:33 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.102 2012/10/14 17:20:18 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_m68k_arch.h"
@@ -516,6 +516,11 @@ fdprobe(device_t parent, cfdata_t cf, vo
 
 	type = &fd_types[0];	/* XXX 1.2MB */
 
+	/* toss any interrupt status */
+	for (n = 0; n < 4; n++) {
+		out_fdc(iot, ioh, NE7CMD_SENSEI);
+		(void)fdcresult(fdc);
+	}
 	intio_disable_intr(SICILIAN_INTR_FDC);
 
 	/* select drive and turn on motor */



CVS commit: src/sys/arch/x68k/dev

2012-10-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Oct 14 16:36:32 UTC 2012

Modified Files:
src/sys/arch/x68k/dev: intio_dmac.c

Log Message:
To abort DMA in dmac_abort_xfer(), set DMAC_CCR_SAB (software abort)
rather than DMAC_CCR_HLT (halt operation).

DMAC_CCR_HLT doesn't abort DMA xfers but only suspends DMA ops
(i.e. clearing HLT bit will resume DMA xfers), so previously
DMAC error always occurs on the next DMA xfer ops after
dmac_abort_xfer() is called.

Also suppress DMAC error messages in dmac_error() if it's caused
by software abort command because it can happen during normal
audio play/record DMA ops in vs(4) driver.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/x68k/dev/intio_dmac.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/x68k/dev/intio_dmac.c
diff -u src/sys/arch/x68k/dev/intio_dmac.c:1.33 src/sys/arch/x68k/dev/intio_dmac.c:1.34
--- src/sys/arch/x68k/dev/intio_dmac.c:1.33	Sun Jun  6 04:50:08 2010
+++ src/sys/arch/x68k/dev/intio_dmac.c	Sun Oct 14 16:36:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: intio_dmac.c,v 1.33 2010/06/06 04:50:08 mrg Exp $	*/
+/*	$NetBSD: intio_dmac.c,v 1.34 2012/10/14 16:36:31 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_m68k_arch.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intio_dmac.c,v 1.33 2010/06/06 04:50:08 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intio_dmac.c,v 1.34 2012/10/14 16:36:31 tsutsui Exp $");
 
 #include 
 #include 
@@ -530,10 +530,18 @@ dmac_error(void *arg)
 {
 	struct dmac_channel_stat *chan = arg;
 	struct dmac_softc *sc = chan->ch_softc;
+	uint8_t csr, cer;
 
-	printf("DMAC transfer error CSR=%02x, CER=%02x\n",
-		bus_space_read_1(sc->sc_bst, chan->ch_bht, DMAC_REG_CSR),
-		bus_space_read_1(sc->sc_bst, chan->ch_bht, DMAC_REG_CER));
+	csr = bus_space_read_1(sc->sc_bst, chan->ch_bht, DMAC_REG_CSR);
+	cer = bus_space_read_1(sc->sc_bst, chan->ch_bht, DMAC_REG_CER);
+
+#ifndef DMAC_DEBUG
+	/* Software abort (CER=0x11) could happen on normal xfer termination */
+	if (cer != 0x11)
+#endif
+	{
+		printf("DMAC transfer error CSR=%02x, CER=%02x\n", csr, cer);
+	}
 	DDUMPREGS(3, ("registers were:\n"));
 
 	/* Clear the status bits */
@@ -552,7 +560,7 @@ dmac_abort_xfer(struct dmac_softc *dmac,
 	struct dmac_channel_stat *chan = xf->dx_channel;
 
 	bus_space_write_1(dmac->sc_bst, chan->ch_bht, DMAC_REG_CCR,
-			  DMAC_CCR_INT | DMAC_CCR_HLT);
+			  DMAC_CCR_INT | DMAC_CCR_SAB);
 	bus_space_write_1(dmac->sc_bst, chan->ch_bht, DMAC_REG_CSR, 0xff);
 	xf->dx_nextoff = xf->dx_nextsize = -1;
 



CVS commit: src/sys/arch/x68k/stand/installboot

2012-10-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Oct 14 16:20:04 UTC 2012

Modified Files:
src/sys/arch/x68k/stand/installboot: installboot.c

Log Message:
Check lp->d_npartitions before calling dkcksum()
(which is in src/sbin/disklabel/dkcksum.c) because
it doesn't check range and could cause coredump during
installboot against floppy that includes garbage in LABELSECTOR.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x68k/stand/installboot/installboot.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/x68k/stand/installboot/installboot.c
diff -u src/sys/arch/x68k/stand/installboot/installboot.c:1.5 src/sys/arch/x68k/stand/installboot/installboot.c:1.6
--- src/sys/arch/x68k/stand/installboot/installboot.c:1.5	Sat Sep 23 20:10:14 2006
+++ src/sys/arch/x68k/stand/installboot/installboot.c	Sun Oct 14 16:20:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: installboot.c,v 1.5 2006/09/23 20:10:14 pavel Exp $	*/
+/*	$NetBSD: installboot.c,v 1.6 2012/10/14 16:20:04 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2001 Minoura Makoto
@@ -159,7 +159,8 @@ checkparttype(const char *name, int forc
 
 		lp = (struct disklabel *) &bootblock[LABELBYTEOFFSET];
 		memcpy(&label, lp, sizeof(struct disklabel));
-		if (dkcksum(lp) != 0)
+		if (lp->d_npartitions > MAXPARTITIONS ||
+		dkcksum(lp) != 0)
 			/* there is no valid label */
 			memset(&label, 0, sizeof(struct disklabel));
 	}



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

2012-10-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 14 16:16:52 UTC 2012

Modified Files:
src/sys/arch/evbarm/rpi: rpi_machdep.c
Added Files:
src/sys/arch/evbarm/rpi: vcio.h vcprop.h

Log Message:
Add the Raspberry PI firmware VC mailbox channel numbers.

Add some VC property tag definitions and use them to get ARM/VC memory
split.

Grab a few others things in the process, but don't do anything other than
display them when VERBOSE_INIT_ARM is defined.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/evbarm/rpi/rpi_machdep.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/rpi/vcio.h \
src/sys/arch/evbarm/rpi/vcprop.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/evbarm/rpi/rpi_machdep.c
diff -u src/sys/arch/evbarm/rpi/rpi_machdep.c:1.12 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.13
--- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.12	Sat Oct 13 14:22:12 2012
+++ src/sys/arch/evbarm/rpi/rpi_machdep.c	Sun Oct 14 16:16:52 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpi_machdep.c,v 1.12 2012/10/13 14:22:12 skrll Exp $	*/
+/*	$NetBSD: rpi_machdep.c,v 1.13 2012/10/14 16:16:52 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.12 2012/10/13 14:22:12 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.13 2012/10/14 16:16:52 skrll Exp $");
 
 #include "opt_evbarm_boardtype.h"
 
@@ -49,8 +49,13 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_machdep.
 #include 
 #include 
 
+#include 
 #include 
 #include 
+#include 
+
+#include 
+#include 
 
 #include 
 
@@ -66,11 +71,16 @@ BootConfig bootconfig;		/* Boot config s
 static char bootargs[MAX_BOOT_STRING];
 char *boot_args = NULL;
 
+void rpi_bootparams(void);
+
 /*
  * Macros to translate between physical and virtual for a subset of the
  * kernel address space.  *Not* for general use.
  */
-#define KERNEL_BASE_PHYS (paddr_t)0
+#define	KERNEL_BASE_PHYS (paddr_t)0
+
+#define KERN_VTOPHYS(va) \
+	((paddr_t)((vaddr_t)va - KERNEL_BASE + KERNEL_BASE_PHYS))
 #define KERN_PHYSTOV(pa) \
 	((vaddr_t)((paddr_t)pa - KERNEL_BASE_PHYS + KERNEL_BASE))
 
@@ -103,7 +113,137 @@ int plcomcnmode = PLCONMODE;
 #endif
 
 /* Smallest amount of RAM start.elf could give us. */
-#define RPI_MINIMUM_ARM_RAM_SPLIT (128U * 1024 * 1024)
+#define RPI_MINIMUM_SPLIT (128U * 1024 * 1024)
+
+static struct {
+	struct vcprop_buffer_hdr	vb_hdr;
+	struct vcprop_tag_fwrev		vbt_fwrev;
+	struct vcprop_tag_boardmodel	vbt_boardmodel;
+	struct vcprop_tag_boardrev	vbt_boardrev;
+	struct vcprop_tag_macaddr	vbt_macaddr;
+	struct vcprop_tag_memory	vbt_memory;
+	struct vcprop_tag_boardserial	vbt_serial;
+	struct vcprop_tag_cmdline	vbt_cmdline;
+	struct vcprop_tag end;
+} vb __packed __aligned(16) =
+{
+	.vb_hdr = {
+		.vpb_len = sizeof(vb),
+		.vpb_rcode = VCPROP_PROCESS_REQUEST,
+	},
+	.vbt_fwrev = {
+		.tag = {
+			.vpt_tag = VCPROPTAG_GET_FIRMWAREREV,
+			.vpt_len = VCPROPTAG_LEN(vb.vbt_fwrev),
+			.vpt_rcode = VCPROPTAG_REQUEST
+		},
+	},
+	.vbt_boardmodel = {
+		.tag = {
+			.vpt_tag = VCPROPTAG_GET_BOARDMODEL,
+			.vpt_len = VCPROPTAG_LEN(vb.vbt_boardmodel),
+			.vpt_rcode = VCPROPTAG_REQUEST
+		},
+	},
+	.vbt_boardrev = {
+		.tag = {
+			.vpt_tag = VCPROPTAG_GET_BOARDREVISION,
+			.vpt_len = VCPROPTAG_LEN(vb.vbt_boardrev),
+			.vpt_rcode = VCPROPTAG_REQUEST
+		},
+	},
+	.vbt_macaddr = {
+		.tag = {
+			.vpt_tag = VCPROPTAG_GET_MACADDRESS,
+			.vpt_len = VCPROPTAG_LEN(vb.vbt_macaddr),
+			.vpt_rcode = VCPROPTAG_REQUEST
+		},
+	},
+	.vbt_memory = {
+		.tag = {
+			.vpt_tag = VCPROPTAG_GET_ARMMEMORY,
+			.vpt_len = VCPROPTAG_LEN(vb.vbt_memory),
+			.vpt_rcode = VCPROPTAG_REQUEST
+		},
+	},
+	.vbt_serial = {
+		.tag = {
+			.vpt_tag = VCPROPTAG_GET_BOARDSERIAL,
+			.vpt_len = VCPROPTAG_LEN(vb.vbt_serial),
+			.vpt_rcode = VCPROPTAG_REQUEST
+		},
+	},
+	.vbt_cmdline = {
+		.tag = {
+			.vpt_tag = VCPROPTAG_GET_CMDLINE,
+			.vpt_len = VCPROPTAG_LEN(vb.vbt_cmdline),
+			.vpt_rcode = VCPROPTAG_REQUEST
+		},
+	},
+	.end = {
+		.vpt_tag = VCPROPTAG_NULL
+	}
+};
+
+void
+rpi_bootparams(void)
+{
+	bus_space_tag_t iot = &bcm2835_bs_tag;
+	bus_space_handle_t ioh = BCM2835_IOPHYSTOVIRT(BCM2835_ARMMBOX_BASE);
+	uint32_t res;
+
+	bcm2835_mbox_write(iot, ioh, BCMMBOX_CHANARM2VC, KERN_VTOPHYS(&vb));
+
+	bcm2835_mbox_read(iot, ioh, BCMMBOX_CHANARM2VC, &res);
+
+	/*
+	 * No need to invalid the cache as the memory has never been referenced
+	 * by the ARM.
+	 * 
+	 * cpu_dcache_inv_range((vaddr_t)&vb, sizeof(vb));
+	 * 
+	 */
+
+	if (!vcprop_buffer_success_p(&vb.vb_hdr)) {
+		bootconfig.dramblocks = 1;
+		bootconfig.dram[0].address = 0x0;
+		bootconfig.dram[0].pages = atop(RPI_MINIMUM_SPLIT);
+		return;
+	} 
+
+	struct vcprop_tag_memory *vptp_mem = &vb.vbt_memory;
+	
+	if (vcprop_tag_success_p(&vptp_mem->tag)) {
+		size_t n = vcprop_tag_resplen(&vptp_mem->tag) /
+		sizeof(struct vcprop_m

CVS commit: [tls-maxphys] src/sys/ufs/ufs

2012-10-14 Thread Thor Lancelot Simon
Module Name:src
Committed By:   tls
Date:   Sun Oct 14 14:33:32 UTC 2012

Modified Files:
src/sys/ufs/ufs [tls-maxphys]: ufs_readwrite.c

Log Message:
In the FFS writebehind code (ufs_readwrite.c:WRITE()), use division
and multiplication instead of shifts, to accomodate devices with
MAXPHYS that is a multiple of the page size, but not a power of 2.

MegaRAID neatly writes out 192k chunks now.

An open question: is is really a good idea to always writebehind
at the largest size supported by the device?  Likely not, as this
could have a major impact on I/O fairness.  OS X and Solaris both
seem to limit transfers to 128k likely for this reason (the same
problem exists with the readahead code but since it is adaptive,
it will not *always* do huge transfers).

However, simply imposing a smallish limit like 128k here seems
like a bad idea because then we cannot accomodate greedy devices
like RAID, for which you want something like 128k * number of
data components.  Hmm.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.104.2.1 src/sys/ufs/ufs/ufs_readwrite.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/ufs/ufs/ufs_readwrite.c
diff -u src/sys/ufs/ufs/ufs_readwrite.c:1.104 src/sys/ufs/ufs/ufs_readwrite.c:1.104.2.1
--- src/sys/ufs/ufs/ufs_readwrite.c:1.104	Sun Apr 29 22:54:01 2012
+++ src/sys/ufs/ufs/ufs_readwrite.c	Sun Oct 14 14:33:32 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_readwrite.c,v 1.104 2012/04/29 22:54:01 chs Exp $	*/
+/*	$NetBSD: ufs_readwrite.c,v 1.104.2.1 2012/10/14 14:33:32 tls Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.104 2012/04/29 22:54:01 chs Exp $");
+__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.104.2.1 2012/10/14 14:33:32 tls Exp $");
 
 #ifdef LFS_READWRITE
 #define	FS			struct lfs
@@ -414,13 +414,22 @@ WRITE(void *v)
 		 */
 
 #ifndef LFS_READWRITE
-		if (!async && oldoff >> 16 != uio->uio_offset >> 16) {
-			mutex_enter(vp->v_interlock);
-			error = VOP_PUTPAGES(vp, (oldoff >> 16) << 16,
-			(uio->uio_offset >> 16) << 16,
-			PGO_CLEANIT | PGO_JOURNALLOCKED | PGO_LAZY);
-			if (error)
-break;
+		{
+			int maximum = vp->v_mount->mnt_maxphys;
+			off_t oldchunk, newchunk;
+
+			oldchunk = (oldoff / maximum) * maximum;
+			newchunk = (uio->uio_offset / maximum) * maximum;
+
+			if (!async && oldchunk != newchunk) {
+mutex_enter(vp->v_interlock);
+error = VOP_PUTPAGES(vp, oldchunk, newchunk,
+		 PGO_CLEANIT |
+		 PGO_JOURNALLOCKED |
+		 PGO_LAZY);
+if (error)
+	break;
+			}
 		}
 #endif
 	}



CVS commit: src/sys/arch

2012-10-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Oct 14 14:20:58 UTC 2012

Modified Files:
src/sys/arch/arm/xscale: becc.c becc_pci.c beccvar.h i80312.c
i80312_pci.c i80312var.h i80321_pci.c ixp425.c ixp425_ixme.c
ixp425_npe.c ixp425_npevar.h ixp425_pci.c ixp425_sip.c
ixp425_sipvar.h ixp425_timer.c ixp425_wdog.c ixp425var.h
src/sys/arch/evbarm/ixdp425: ixdp425_led.c ixdp425_mainbus.c
src/sys/arch/evbarm/nslu2: nslu2_buttons.c nslu2_iic.c nslu2_leds.c
nslu2_mainbus.c

Log Message:
struct device * -> device_t for IXP4xx (and nslu2).
Tested with my NSLU2.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/xscale/becc.c \
src/sys/arch/arm/xscale/ixp425.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/xscale/becc_pci.c \
src/sys/arch/arm/xscale/i80312_pci.c src/sys/arch/arm/xscale/ixp425_sip.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/xscale/beccvar.h \
src/sys/arch/arm/xscale/ixp425_npevar.h \
src/sys/arch/arm/xscale/ixp425_wdog.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/xscale/i80312.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/xscale/i80312var.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/xscale/i80321_pci.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/xscale/ixp425_ixme.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/xscale/ixp425_npe.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/xscale/ixp425_pci.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/xscale/ixp425_sipvar.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/xscale/ixp425_timer.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/xscale/ixp425var.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/ixdp425/ixdp425_led.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/ixdp425/ixdp425_mainbus.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/nslu2/nslu2_buttons.c \
src/sys/arch/evbarm/nslu2/nslu2_mainbus.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/nslu2/nslu2_iic.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/nslu2/nslu2_leds.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/arm/xscale/becc.c
diff -u src/sys/arch/arm/xscale/becc.c:1.15 src/sys/arch/arm/xscale/becc.c:1.16
--- src/sys/arch/arm/xscale/becc.c:1.15	Tue Sep 18 05:47:28 2012
+++ src/sys/arch/arm/xscale/becc.c	Sun Oct 14 14:20:57 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: becc.c,v 1.15 2012/09/18 05:47:28 matt Exp $	*/
+/*	$NetBSD: becc.c,v 1.16 2012/10/14 14:20:57 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: becc.c,v 1.15 2012/09/18 05:47:28 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: becc.c,v 1.16 2012/10/14 14:20:57 msaitoh Exp $");
 
 #include 
 #include 
@@ -77,8 +77,7 @@ const char *becc_revisions[] = {
  */
 struct becc_softc *becc_softc;
 
-static int becc_search(struct device *, struct cfdata *,
-		   const int *, void *);
+static int becc_search(device_t, cfdata_t, const int *, void *);
 static int becc_print(void *, const char *);
 
 static void becc_pci_dma_init(struct becc_softc *);
@@ -194,7 +193,7 @@ becc_attach(struct becc_softc *sc)
 	 * the BECC is a soft-core with a variety of peripherals, depending
 	 * on configuration.
 	 */
-	config_search_ia(becc_search, &sc->sc_dev, "becc", NULL);
+	config_search_ia(becc_search, sc->sc_dev, "becc", NULL);
 
 	/*
 	 * Attach the PCI bus.
@@ -210,7 +209,7 @@ becc_attach(struct becc_softc *sc)
 	pba.pba_intrtag = 0;
 	pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY |
 	PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | PCI_FLAGS_MWI_OKAY;
-	(void) config_found_ia(&sc->sc_dev, "pcibus", &pba, pcibusprint);
+	(void) config_found_ia(sc->sc_dev, "pcibus", &pba, pcibusprint);
 }
 
 /*
@@ -219,10 +218,9 @@ becc_attach(struct becc_softc *sc)
  *	Indirect autoconfiguration glue for BECC.
  */
 static int
-becc_search(struct device *parent, struct cfdata *cf,
-	const int *ldesc, void *aux)
+becc_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
 {
-	struct becc_softc *sc = (void *) parent;
+	struct becc_softc *sc = device_private(parent);
 	struct becc_attach_args ba;
 
 	ba.ba_dmat = &sc->sc_local_dmat;
Index: src/sys/arch/arm/xscale/ixp425.c
diff -u src/sys/arch/arm/xscale/ixp425.c:1.15 src/sys/arch/arm/xscale/ixp425.c:1.16
--- src/sys/arch/arm/xscale/ixp425.c:1.15	Fri Jul  1 20:32:51 2011
+++ src/sys/arch/arm/xscale/ixp425.c	Sun Oct 14 14:20:57 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ixp425.c,v 1.15 2011/07/01 20:32:51 dyoung Exp $ */
+/*	$NetBSD: ixp425.c,v 1.16 2012/10/14 14:20:57 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2003
@@ -30,7 +30,7 @@
 #include "pci.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixp425.c,v 1.15 2011/07/01 20:32:51 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixp425.c,v 1.16 2012/10/14 14:20:57 msaitoh Exp $");
 
 #include 
 #include 
@@ -45,12 +45,14 @@ __KERNEL_RCSID(0, "$NetBSD: ixp425.c,v 1
 struct	ixp425_softc 

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

2012-10-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Oct 14 13:54:39 UTC 2012

Modified Files:
src/sys/arch/evbarm/conf: NSLU2

Log Message:
Add PTYFS


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/evbarm/conf/NSLU2

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/evbarm/conf/NSLU2
diff -u src/sys/arch/evbarm/conf/NSLU2:1.27 src/sys/arch/evbarm/conf/NSLU2:1.28
--- src/sys/arch/evbarm/conf/NSLU2:1.27	Tue Sep 11 19:43:10 2012
+++ src/sys/arch/evbarm/conf/NSLU2	Sun Oct 14 13:54:39 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: NSLU2,v 1.27 2012/09/11 19:43:10 msaitoh Exp $
+#	$NetBSD: NSLU2,v 1.28 2012/10/14 13:54:39 msaitoh Exp $
 #
 #	Linksys NSLU2 "Slug" NAS Device
 #
@@ -46,6 +46,7 @@ file-system	NFS		# Network file system
 #file-system	KERNFS		# /kern
 #file-system	NULLFS		# loopback file system
 #file-system	PROCFS		# /proc
+file-system 	PTYFS		# /dev/ptm support
 #file-system	PUFFS		# Userspace file systems (e.g. ntfs-3g & sshfs)
 #file-system	UMAPFS		# NULLFS + uid and gid remapping
 #file-system	UNION		# union file system



CVS commit: src/sys/dev/ic

2012-10-14 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Oct 14 13:38:13 UTC 2012

Modified Files:
src/sys/dev/ic: dp8390reg.h

Log Message:
ed_ring structure is no longer needed for compatibility, as the last
device driver using it (amiga/ed(4)) has been converted now.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/dp8390reg.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/dev/ic/dp8390reg.h
diff -u src/sys/dev/ic/dp8390reg.h:1.8 src/sys/dev/ic/dp8390reg.h:1.9
--- src/sys/dev/ic/dp8390reg.h:1.8	Sun Dec 11 12:21:26 2005
+++ src/sys/dev/ic/dp8390reg.h	Sun Oct 14 13:38:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: dp8390reg.h,v 1.8 2005/12/11 12:21:26 christos Exp $	*/
+/*	$NetBSD: dp8390reg.h,v 1.9 2012/10/14 13:38:13 phx Exp $	*/
 
 /*
  * National Semiconductor DS8390 NIC register definitions.
@@ -542,21 +542,6 @@ struct dp8390_ring	{
 };
 
 /*
- * XXX For compatibility only!  This needs to die when all drivers have
- * been converted to be front ends to the MI driver.
- */
-struct ed_ring	{
-#if BYTE_ORDER == BIG_ENDIAN
-	u_char	next_packet;		/* pointer to next packet */
-	u_char	rsr;			/* receiver status */
-#else
-	u_char	rsr;			/* receiver status */
-	u_char	next_packet;		/* pointer to next packet */
-#endif
-	u_short	count;			/* bytes in packet (length + 4) */
-};
-
-/*
  * Common constants
  */
 #define ED_PAGE_SIZE		256	/* Size of RAM pages in bytes */



CVS commit: src/sys/arch/amiga

2012-10-14 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Oct 14 13:36:07 UTC 2012

Modified Files:
src/sys/arch/amiga/conf: files.amiga
Added Files:
src/sys/arch/amiga/dev: if_ed_zbus.c
Removed Files:
src/sys/arch/amiga/dev: if_ed.c if_edreg.h

Log Message:
New ed(4) device driver for Hydra and ASDG Zorro2 bus network cards.
This driver is based on the MI dp8390 backend.


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/sys/arch/amiga/conf/files.amiga
cvs rdiff -u -r1.62 -r0 src/sys/arch/amiga/dev/if_ed.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/amiga/dev/if_ed_zbus.c
cvs rdiff -u -r1.4 -r0 src/sys/arch/amiga/dev/if_edreg.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/amiga/conf/files.amiga
diff -u src/sys/arch/amiga/conf/files.amiga:1.160 src/sys/arch/amiga/conf/files.amiga:1.161
--- src/sys/arch/amiga/conf/files.amiga:1.160	Wed Jul 11 17:13:31 2012
+++ src/sys/arch/amiga/conf/files.amiga	Sun Oct 14 13:36:07 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files.amiga,v 1.160 2012/07/11 17:13:31 rkujawa Exp $
+#	$NetBSD: files.amiga,v 1.161 2012/10/14 13:36:07 phx Exp $
 
 # maxpartitions must be first item in files.${ARCH}.newconf
 maxpartitions 16			# NOTE THAT AMIGA IS SPECIAL!
@@ -235,8 +235,8 @@ file	arch/amiga/dev/if_ne_xsurf.c	ne_xsu
 
 # Hydra ethernet card
 device	ed: ifnet, ether, arp
-attach	ed at zbus with ed_zbus
-file	arch/amiga/dev/if_ed.c		ed_zbus needs-flag
+attach	ed at zbus with ed_zbus: dp8390nic
+file	arch/amiga/dev/if_ed_zbus.c	ed_zbus needs-flag
 
 # C=/Ameristar A2060 / 560
 attach	bah at zbus with bah_zbus

Added files:

Index: src/sys/arch/amiga/dev/if_ed_zbus.c
diff -u /dev/null src/sys/arch/amiga/dev/if_ed_zbus.c:1.1
--- /dev/null	Sun Oct 14 13:36:07 2012
+++ src/sys/arch/amiga/dev/if_ed_zbus.c	Sun Oct 14 13:36:07 2012
@@ -0,0 +1,330 @@
+/*	$NetBSD: if_ed_zbus.c,v 1.1 2012/10/14 13:36:07 phx Exp $ */
+
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Frank Wille.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+/*
+ * Device driver for the Hydra Systems and ASDG ethernet cards.
+ * Based on the National Semiconductor DS8390/WD83C690.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: if_ed_zbus.c,v 1.1 2012/10/14 13:36:07 phx Exp $");
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define ETHER_PAD_LEN	(ETHER_MIN_LEN - ETHER_CRC_LEN)
+
+/* Hydra Systems AmigaNet */
+#define HYDRA_MANID	2121
+#define HYDRA_PRODID	1
+#define HYDRA_REGADDR	0xffe1
+#define	HYDRA_MEMADDR	0
+#define HYDRA_PROMADDR	0xffc0
+
+/* ASDG LANRover */
+#define ASDG_MANID	1023
+#define ASDG_PRODID	254
+#define ASDG_REGADDR	0x1
+#define ASDG_MEMADDR	0x8000
+#define ASDG_PROMADDR	0x100
+
+/* Buffer size is always 16k */
+#define ED_ZBUS_MEMSIZE	0x4000
+
+int	ed_zbus_match(device_t, cfdata_t , void *);
+void	ed_zbus_attach(device_t, device_t, void *);
+int	ed_zbus_test_mem(struct dp8390_softc *);
+void	ed_zbus_read_hdr(struct dp8390_softc *, int, struct dp8390_ring *);
+int	ed_zbus_ring_copy(struct dp8390_softc *, int, void *, u_short);
+int	ed_zbus_write_mbuf(struct dp8390_softc *, struct mbuf *, int);
+
+struct ed_zbus_softc {
+	struct dp8390_softc	sc_dp8390;
+	struct bus_space_tag	sc_bst;
+	struct isr		sc_isr;
+};
+
+CFATTACH_DECL_NEW(ed_zbus, sizeof(struct ed_zbus_softc),
+ed_zbus_match, ed_zbus_attach, NULL, NULL);
+
+
+int
+ed_zbus_match(device_t parent, cfdata_t cf, void *aux)
+{
+	struct zbus_args *zap = aux;
+
+

CVS commit: src/distrib/sets/lists

2012-10-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Oct 14 12:36:58 UTC 2012

Modified Files:
src/distrib/sets/lists/base: md.evbarm.armeb
src/distrib/sets/lists/comp: ad.armeb

Log Message:
Add some files to complete "make release" for big endian.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/distrib/sets/lists/base/md.evbarm.armeb
cvs rdiff -u -r1.7 -r1.8 src/distrib/sets/lists/comp/ad.armeb

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/md.evbarm.armeb
diff -u src/distrib/sets/lists/base/md.evbarm.armeb:1.3 src/distrib/sets/lists/base/md.evbarm.armeb:1.4
--- src/distrib/sets/lists/base/md.evbarm.armeb:1.3	Sat Nov 29 17:57:33 2008
+++ src/distrib/sets/lists/base/md.evbarm.armeb	Sun Oct 14 12:36:57 2012
@@ -1,2 +1,3 @@
-# $NetBSD: md.evbarm.armeb,v 1.3 2008/11/29 17:57:33 tsutsui Exp $
+# $NetBSD: md.evbarm.armeb,v 1.4 2012/10/14 12:36:57 msaitoh Exp $
 ./usr/mdec/gzboot_ADI_BRH_0x0014.bin	base-sysutil-bin
+./usr/mdec/bootmini2440base-sysutil-bin

Index: src/distrib/sets/lists/comp/ad.armeb
diff -u src/distrib/sets/lists/comp/ad.armeb:1.7 src/distrib/sets/lists/comp/ad.armeb:1.8
--- src/distrib/sets/lists/comp/ad.armeb:1.7	Wed Aug 15 20:38:50 2012
+++ src/distrib/sets/lists/comp/ad.armeb	Sun Oct 14 12:36:58 2012
@@ -1,4 +1,4 @@
-# $NetBSD: ad.armeb,v 1.7 2012/08/15 20:38:50 matt Exp $
+# $NetBSD: ad.armeb,v 1.8 2012/10/14 12:36:58 msaitoh Exp $
 #
 # The armeb MACHINE_ARCH never existed in NetBSD as a.out, so we
 #	skip the old a.out compatibility tools.
@@ -32,6 +32,7 @@
 ./usr/include/arm/byte_swap.h			comp-c-include
 ./usr/include/arm/cdefs.h			comp-c-include
 ./usr/include/arm/cpu.hcomp-c-include
+./usr/include/arm/cpuconf.h			comp-c-include
 ./usr/include/arm/db_machdep.h			comp-obsolete		obsolete
 ./usr/include/arm/disklabel.h			comp-c-include
 ./usr/include/arm/disklabel_acorn.h		comp-obsolete		obsolete



CVS commit: src/share/man/man4

2012-10-14 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Sun Oct 14 10:05:55 UTC 2012

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

Log Message:
Add a width argument to tag list, otherwise mandoc output is just
unreadable.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/share/man/man4/icp.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/icp.4
diff -u src/share/man/man4/icp.4:1.5 src/share/man/man4/icp.4:1.6
--- src/share/man/man4/icp.4:1.5	Mon Nov 13 16:33:57 2006
+++ src/share/man/man4/icp.4	Sun Oct 14 10:05:55 2012
@@ -1,4 +1,4 @@
-.\" $NetBSD: icp.4,v 1.5 2006/11/13 16:33:57 ad Exp $
+.\" $NetBSD: icp.4,v 1.6 2012/10/14 10:05:55 njoly Exp $
 .\"
 .\" from OpenBSD: gdt.4,v 1.14 2001/10/05 14:45:53 mpech Exp
 .\"
@@ -31,7 +31,7 @@ The
 driver provides direct access to other SCSI devices attached to the
 controller, such as tape or CD-ROM drives.
 .Sh DIAGNOSTICS
-.Bl -tag
+.Bl -tag -width indent
 .It "pci_mem_find: expected mem type , found 0002"
 This message may be displayed during autoconfiguration if the controller's
 memory is mapped below 1MB in physical address space.



CVS commit: src/share/man/man4

2012-10-14 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Sun Oct 14 10:03:47 UTC 2012

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

Log Message:
Quote .Cd argument.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/share/man/man4/ses.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/ses.4
diff -u src/share/man/man4/ses.4:1.9 src/share/man/man4/ses.4:1.10
--- src/share/man/man4/ses.4:1.9	Mon Mar 22 18:58:31 2010
+++ src/share/man/man4/ses.4	Sun Oct 14 10:03:47 2012
@@ -1,4 +1,4 @@
-.\" $NetBSD: ses.4,v 1.9 2010/03/22 18:58:31 joerg Exp $
+.\" $NetBSD: ses.4,v 1.10 2012/10/14 10:03:47 njoly Exp $
 .\" Copyright (c) 2001 The NetBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
@@ -34,7 +34,7 @@
 .Nm ses
 .Nd SCSI Environmental Services Driver
 .Sh SYNOPSIS
-.Cd ses* at scsibus? target ? lun ?
+.Cd "ses* at scsibus? target ? lun ?"
 .Sh DESCRIPTION
 The
 .Nm ses



CVS commit: src/lib/libc/sys

2012-10-14 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Oct 14 08:49:28 UTC 2012

Modified Files:
src/lib/libc/sys: sigaction.2

Log Message:
typo


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/lib/libc/sys/sigaction.2

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

Modified files:

Index: src/lib/libc/sys/sigaction.2
diff -u src/lib/libc/sys/sigaction.2:1.43 src/lib/libc/sys/sigaction.2:1.44
--- src/lib/libc/sys/sigaction.2:1.43	Sat Jun  3 18:23:52 2006
+++ src/lib/libc/sys/sigaction.2	Sun Oct 14 08:49:28 2012
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sigaction.2,v 1.43 2006/06/03 18:23:52 christos Exp $
+.\"	$NetBSD: sigaction.2,v 1.44 2012/10/14 08:49:28 dholland Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -288,7 +288,7 @@ flag in
 .El
 .Pp
 Only functions that are async-signal-safe can safely be used in signal
-handlers, see
+handlers; see
 .Xr signal 7
 for a complete list.
 .Sh NOTES



CVS commit: src/usr.sbin/btpand

2012-10-14 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Sun Oct 14 08:35:45 UTC 2012

Modified Files:
src/usr.sbin/btpand: btpand.h

Log Message:
no trailing comma on enum


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/btpand/btpand.h

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

Modified files:

Index: src/usr.sbin/btpand/btpand.h
diff -u src/usr.sbin/btpand/btpand.h:1.3 src/usr.sbin/btpand/btpand.h:1.4
--- src/usr.sbin/btpand/btpand.h:1.3	Tue May 12 21:50:38 2009
+++ src/usr.sbin/btpand/btpand.h	Sun Oct 14 08:35:45 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: btpand.h,v 1.3 2009/05/12 21:50:38 plunky Exp $	*/
+/*	$NetBSD: btpand.h,v 1.4 2012/10/14 08:35:45 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2008-2009 Iain Hibbert
@@ -56,7 +56,7 @@ enum channel_state {
 	CHANNEL_CLOSED,
 	CHANNEL_WAIT_CONNECT_REQ,
 	CHANNEL_WAIT_CONNECT_RSP,
-	CHANNEL_OPEN,
+	CHANNEL_OPEN
 };
 
 #define CHANNEL_MAXQLEN		128



CVS commit: src/usr.sbin/btpand

2012-10-14 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Sun Oct 14 08:31:35 UTC 2012

Modified Files:
src/usr.sbin/btpand: client.c server.c

Log Message:
add code to ensure that SO_SNDBUF is large enough on client connections,
as was previously done for server mode


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/btpand/client.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/btpand/server.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.sbin/btpand/client.c
diff -u src/usr.sbin/btpand/client.c:1.6 src/usr.sbin/btpand/client.c:1.7
--- src/usr.sbin/btpand/client.c:1.6	Mon Aug 29 20:38:55 2011
+++ src/usr.sbin/btpand/client.c	Sun Oct 14 08:31:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: client.c,v 1.6 2011/08/29 20:38:55 joerg Exp $	*/
+/*	$NetBSD: client.c,v 1.7 2012/10/14 08:31:35 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2008-2009 Iain Hibbert
@@ -26,7 +26,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: client.c,v 1.6 2011/08/29 20:38:55 joerg Exp $");
+__RCSID("$NetBSD: client.c,v 1.7 2012/10/14 08:31:35 plunky Exp $");
 
 #include 
 #include 
@@ -45,7 +45,7 @@ client_init(void)
 	struct sockaddr_bt sa;
 	channel_t *chan;
 	socklen_t len;
-	int fd, bufsize;
+	int fd, n;
 	uint16_t mru, mtu;
 
 	if (bdaddr_any(&remote_bdaddr))
@@ -102,17 +102,15 @@ client_init(void)
 		exit(EXIT_FAILURE);
 	}
 
-	len = sizeof(bufsize);
-	if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &bufsize, &len) == -1) {
+	len = sizeof(n);
+	if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &n, &len) == -1) {
 		log_err("Could not read SO_RCVBUF");
 		exit(EXIT_FAILURE);
 	}
-	if (bufsize < 10 * mru) {
-		bufsize = 10 * mru;
-		if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &bufsize,
-		sizeof(bufsize)) == -1)
-			log_info("Could not increase SO_RCVBUF (from %d)",
-			bufsize);
+	if (n < 10 * mru) {
+		n = 10 * mru;
+		if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &n, sizeof(n)) == -1)
+			log_info("Could not increase SO_RCVBUF (to %d)", n);
 	}
 
 	len = sizeof(mtu);
@@ -125,6 +123,27 @@ client_init(void)
 		exit(EXIT_FAILURE);
 	}
 
+	len = sizeof(n);
+	if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &n, &len) == -1) {
+		log_err("Could not get socket send buffer size: %m");
+		close(fd);
+		return;
+	}
+	if (n < (mtu * 2)) {
+		n = mtu * 2;
+		if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &n, sizeof(n)) == -1) {
+			log_err("Could not set socket send buffer size (%d): %m", n);
+			close(fd);
+			return;
+		}
+	}
+	n = mtu;
+	if (setsockopt(fd, SOL_SOCKET, SO_SNDLOWAT, &n, sizeof(n)) == -1) {
+		log_err("Could not set socket low water mark (%d): %m", n);
+		close(fd);
+		return;
+	}
+
 	chan = channel_alloc();
 	if (chan == NULL)
 		exit(EXIT_FAILURE);

Index: src/usr.sbin/btpand/server.c
diff -u src/usr.sbin/btpand/server.c:1.7 src/usr.sbin/btpand/server.c:1.8
--- src/usr.sbin/btpand/server.c:1.7	Tue Feb  8 21:59:50 2011
+++ src/usr.sbin/btpand/server.c	Sun Oct 14 08:31:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: server.c,v 1.7 2011/02/08 21:59:50 plunky Exp $	*/
+/*	$NetBSD: server.c,v 1.8 2012/10/14 08:31:35 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2008-2009 Iain Hibbert
@@ -26,7 +26,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: server.c,v 1.7 2011/02/08 21:59:50 plunky Exp $");
+__RCSID("$NetBSD: server.c,v 1.8 2012/10/14 08:31:35 plunky Exp $");
 
 #include 
 
@@ -134,7 +134,7 @@ server_read(int s, short ev, void *arg)
 	struct sockaddr_bt ra, la;
 	channel_t *chan;
 	socklen_t len;
-	int fd, n, bufsize;
+	int fd, n;
 	uint16_t mru, mtu;
 
 	assert(server_count < server_limit);
@@ -163,18 +163,16 @@ server_read(int s, short ev, void *arg)
 		return;
 	}
 
-	len = sizeof(bufsize);
-	if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &bufsize, &len) == -1) {
+	len = sizeof(n);
+	if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &n, &len) == -1) {
 		log_err("Could not read SO_RCVBUF");
 		close(fd);
 		return;
 	}
-	if (bufsize < 10 * mru) {
-		bufsize = 10 * mru;
-		if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &bufsize,
-		sizeof(bufsize)) == -1)
-			log_info("Could not increase SO_RCVBUF (from %d)",
-			bufsize);
+	if (n < 10 * mru) {
+		n = 10 * mru;
+		if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &n, sizeof(n)) == -1)
+			log_info("Could not increase SO_RCVBUF (to %d)", n);
 	}
 
 	len = sizeof(mtu);
@@ -195,7 +193,6 @@ server_read(int s, short ev, void *arg)
 		close(fd);
 		return;
 	}
-
 	if (n < (mtu * 2)) {
 		n = mtu * 2;
 		if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &n, sizeof(n)) == -1) {
@@ -204,7 +201,6 @@ server_read(int s, short ev, void *arg)
 			return;
 		}
 	}
-
 	n = mtu;
 	if (setsockopt(fd, SOL_SOCKET, SO_SNDLOWAT, &n, sizeof(n)) == -1) {
 		log_err("Could not set socket low water mark (%d): %m", n);