CVS commit: src/sys/dev/usb

2013-02-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  1 12:53:47 UTC 2013

Modified Files:
src/sys/dev/usb: ehci.c uhci.c

Log Message:
Call usb_syncmem() against descriptors more strictly.
(not sure if the previous ones were fatal though)


To generate a diff of this commit:
cvs rdiff -u -r1.204 -r1.205 src/sys/dev/usb/ehci.c
cvs rdiff -u -r1.255 -r1.256 src/sys/dev/usb/uhci.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/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.204 src/sys/dev/usb/ehci.c:1.205
--- src/sys/dev/usb/ehci.c:1.204	Tue Jan 29 00:00:15 2013
+++ src/sys/dev/usb/ehci.c	Fri Feb  1 12:53:47 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.204 2013/01/29 00:00:15 christos Exp $ */
+/*	$NetBSD: ehci.c,v 1.205 2013/02/01 12:53:47 tsutsui Exp $ */
 
 /*
  * Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ehci.c,v 1.204 2013/01/29 00:00:15 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: ehci.c,v 1.205 2013/02/01 12:53:47 tsutsui Exp $);
 
 #include ohci.h
 #include uhci.h
@@ -816,7 +816,11 @@ ehci_check_qh_intr(ehci_softc_t *sc, str
 	lsqtd-offs + offsetof(ehci_qtd_t, qtd_status),
 	sizeof(lsqtd-qtd.qtd_status),
 	BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD);
-	if (le32toh(lsqtd-qtd.qtd_status)  EHCI_QTD_ACTIVE) {
+	status = le32toh(lsqtd-qtd.qtd_status);
+	usb_syncmem(lsqtd-dma,
+	lsqtd-offs + offsetof(ehci_qtd_t, qtd_status),
+	sizeof(lsqtd-qtd.qtd_status), BUS_DMASYNC_PREREAD);
+	if (status  EHCI_QTD_ACTIVE) {
 		DPRINTFN(12, (ehci_check_intr: active ex=%p\n, ex));
 		for (sqtd = ex-sqtdstart; sqtd != lsqtd; sqtd=sqtd-nextqtd) {
 			usb_syncmem(sqtd-dma,
@@ -839,9 +843,6 @@ ehci_check_qh_intr(ehci_softc_t *sc, str
 		}
 		DPRINTFN(12, (ehci_check_intr: ex=%p std=%p still active\n,
 			  ex, ex-sqtdstart));
-		usb_syncmem(lsqtd-dma,
-		lsqtd-offs + offsetof(ehci_qtd_t, qtd_status),
-		sizeof(lsqtd-qtd.qtd_status), BUS_DMASYNC_PREREAD);
 		return;
 	}
  done:

Index: src/sys/dev/usb/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.255 src/sys/dev/usb/uhci.c:1.256
--- src/sys/dev/usb/uhci.c:1.255	Wed Jan 30 16:01:45 2013
+++ src/sys/dev/usb/uhci.c	Fri Feb  1 12:53:47 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhci.c,v 1.255 2013/01/30 16:01:45 tsutsui Exp $	*/
+/*	$NetBSD: uhci.c,v 1.256 2013/02/01 12:53:47 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uhci.c,v 1.255 2013/01/30 16:01:45 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: uhci.c,v 1.256 2013/02/01 12:53:47 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1099,6 +1099,7 @@ void
 uhci_remove_hs_ctrl(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
 {
 	uhci_soft_qh_t *pqh;
+	uint32_t elink;
 
 	KASSERT(mutex_owned(sc-sc_lock));
 
@@ -1122,7 +1123,10 @@ uhci_remove_hs_ctrl(uhci_softc_t *sc, uh
 	usb_syncmem(sqh-dma, sqh-offs + offsetof(uhci_qh_t, qh_elink),
 	sizeof(sqh-qh.qh_elink),
 	BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD);
-	if (!(sqh-qh.qh_elink  htole32(UHCI_PTR_T))) {
+	elink = le32toh(sqh-qh.qh_elink);
+	usb_syncmem(sqh-dma, sqh-offs + offsetof(uhci_qh_t, qh_elink),
+	sizeof(sqh-qh.qh_elink), BUS_DMASYNC_PREREAD);
+	if (!(elink  UHCI_PTR_T)) {
 		sqh-qh.qh_elink = htole32(UHCI_PTR_T);
 		usb_syncmem(sqh-dma,
 		sqh-offs + offsetof(uhci_qh_t, qh_elink),
@@ -1172,6 +1176,7 @@ void
 uhci_remove_ls_ctrl(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
 {
 	uhci_soft_qh_t *pqh;
+	uint32_t elink;
 
 	KASSERT(mutex_owned(sc-sc_lock));
 
@@ -1180,7 +1185,10 @@ uhci_remove_ls_ctrl(uhci_softc_t *sc, uh
 	usb_syncmem(sqh-dma, sqh-offs + offsetof(uhci_qh_t, qh_elink),
 	sizeof(sqh-qh.qh_elink),
 	BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD);
-	if (!(sqh-qh.qh_elink  htole32(UHCI_PTR_T))) {
+	elink = le32toh(sqh-qh.qh_elink);
+	usb_syncmem(sqh-dma, sqh-offs + offsetof(uhci_qh_t, qh_elink),
+	sizeof(sqh-qh.qh_elink), BUS_DMASYNC_PREREAD);
+	if (!(elink  UHCI_PTR_T)) {
 		sqh-qh.qh_elink = htole32(UHCI_PTR_T);
 		usb_syncmem(sqh-dma,
 		sqh-offs + offsetof(uhci_qh_t, qh_elink),
@@ -1431,7 +1439,12 @@ uhci_check_intr(uhci_softc_t *sc, uhci_i
 	lstd-offs + offsetof(uhci_td_t, td_status),
 	sizeof(lstd-td.td_status),
 	BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD);
-	if (le32toh(lstd-td.td_status)  UHCI_TD_ACTIVE) {
+	status = le32toh(lstd-td.td_status);
+	usb_syncmem(lstd-dma,
+	lstd-offs + offsetof(uhci_td_t, td_status),
+	sizeof(lstd-td.td_status),
+	BUS_DMASYNC_PREREAD);
+	if (status  UHCI_TD_ACTIVE) {
 		DPRINTFN(12, (uhci_check_intr: active ii=%p\n, ii));
 		for (std = ii-stdstart; std != lstd; std = std-link.std) {
 			usb_syncmem(std-dma,
@@ -1460,10 +1473,6 @@ uhci_check_intr(uhci_softc_t *sc, uhci_i
 		}
 		DPRINTFN(12, (uhci_check_intr: ii=%p std=%p still 

CVS commit: src/etc/rc.d

2013-02-01 Thread Matthias Scheler
Module Name:src
Committed By:   tron
Date:   Fri Feb  1 13:29:33 UTC 2013

Modified Files:
src/etc/rc.d: wpa_supplicant

Log Message:
Make custom reload target work. Before this fix it would have tried
to send a HUP signal to wpa_supplicant instead.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/etc/rc.d/wpa_supplicant

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

Modified files:

Index: src/etc/rc.d/wpa_supplicant
diff -u src/etc/rc.d/wpa_supplicant:1.3 src/etc/rc.d/wpa_supplicant:1.4
--- src/etc/rc.d/wpa_supplicant:1.3	Wed Sep 30 18:17:22 2009
+++ src/etc/rc.d/wpa_supplicant	Fri Feb  1 13:29:33 2013
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: wpa_supplicant,v 1.3 2009/09/30 18:17:22 apb Exp $
+# $NetBSD: wpa_supplicant,v 1.4 2013/02/01 13:29:33 tron Exp $
 #
 
 # PROVIDE: wpa_supplicant
@@ -20,7 +20,7 @@ $_rc_subr_loaded . /etc/rc.subr
 name=wpa_supplicant
 rcvar=$name
 command=/usr/sbin/wpa_supplicant
-reload_command=/usr/sbin/wpa_cli reconfigure
+reload_cmd=/usr/sbin/wpa_cli reconfigure
 extra_commands=reload
 
 load_rc_config $name



CVS commit: src/usr.sbin/makefs

2013-02-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb  1 14:00:33 UTC 2013

Modified Files:
src/usr.sbin/makefs: makefs.c

Log Message:
while it is studly to play with token pasting, passing directly the type
is a lot more readable.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.sbin/makefs/makefs.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/makefs/makefs.c
diff -u src/usr.sbin/makefs/makefs.c:1.45 src/usr.sbin/makefs/makefs.c:1.46
--- src/usr.sbin/makefs/makefs.c:1.45	Tue Jan 29 21:53:54 2013
+++ src/usr.sbin/makefs/makefs.c	Fri Feb  1 09:00:33 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: makefs.c,v 1.45 2013/01/30 02:53:54 christos Exp $	*/
+/*	$NetBSD: makefs.c,v 1.46 2013/02/01 14:00:33 christos Exp $	*/
 
 /*
  * Copyright (c) 2001-2003 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
 
 #include sys/cdefs.h
 #if defined(__RCSID)  !defined(__lint)
-__RCSID($NetBSD: makefs.c,v 1.45 2013/01/30 02:53:54 christos Exp $);
+__RCSID($NetBSD: makefs.c,v 1.46 2013/02/01 14:00:33 christos Exp $);
 #endif	/* !__lint */
 
 #include assert.h
@@ -327,13 +327,12 @@ set_option_var(const option_t *options, 
 	char *s;
 	size_t i;
 
-#define NUM(width) \
+#define NUM(type) \
 	if (!*val) { \
-		*(uint ## width ## _t *)options[i].value = 1; \
+		*(type *)options[i].value = 1; \
 		break; \
 	} \
-	*(uint ## width ## _t *)options[i].value = \
-	(uint ## width ## _t)strsuftoll(options[i].desc, val, \
+	*(type *)options[i].value = (type)strsuftoll(options[i].desc, val, \
 	options[i].minimum, options[i].maximum); break
 
 	for (i = 0; options[i].name != NULL; i++) {
@@ -361,13 +360,13 @@ set_option_var(const option_t *options, 
 			strlcpy(buf, val, len);
 			break;
 		case OPT_INT64:
-			NUM(64);
+			NUM(uint64_t);
 		case OPT_INT32:
-			NUM(32);
+			NUM(uint32_t);
 		case OPT_INT16:
-			NUM(16);
+			NUM(uint16_t);
 		case OPT_INT8:
-			NUM(8);
+			NUM(uint8_t);
 		default:
 			warnx(Unknown type %d in option %s, options[i].type,
 			val);



CVS commit: src/usr.sbin/makefs

2013-02-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb  1 14:02:17 UTC 2013

Modified Files:
src/usr.sbin/makefs: makefs.c

Log Message:
remove bogus err.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/usr.sbin/makefs/makefs.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/makefs/makefs.c
diff -u src/usr.sbin/makefs/makefs.c:1.46 src/usr.sbin/makefs/makefs.c:1.47
--- src/usr.sbin/makefs/makefs.c:1.46	Fri Feb  1 09:00:33 2013
+++ src/usr.sbin/makefs/makefs.c	Fri Feb  1 09:02:17 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: makefs.c,v 1.46 2013/02/01 14:00:33 christos Exp $	*/
+/*	$NetBSD: makefs.c,v 1.47 2013/02/01 14:02:17 christos Exp $	*/
 
 /*
  * Copyright (c) 2001-2003 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
 
 #include sys/cdefs.h
 #if defined(__RCSID)  !defined(__lint)
-__RCSID($NetBSD: makefs.c,v 1.46 2013/02/01 14:00:33 christos Exp $);
+__RCSID($NetBSD: makefs.c,v 1.47 2013/02/01 14:02:17 christos Exp $);
 #endif	/* !__lint */
 
 #include assert.h
@@ -351,7 +351,6 @@ set_option_var(const option_t *options, 
 			break;
 		case OPT_STRPTR:
 			s = estrdup(val);
-err(1, NULL);
 			*(char **)options[i].value = s;
 			break;
 		case OPT_STRBUF:



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

2013-02-01 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Fri Feb  1 14:48:16 UTC 2013

Modified Files:
src/sys/arch/amiga/conf: DRACO GENERIC GENERIC.in INSTALL

Log Message:
Include two MII PHY drivers, as needed by certain PCMCIA network cards.
More PHY drivers should be added when needed.


To generate a diff of this commit:
cvs rdiff -u -r1.164 -r1.165 src/sys/arch/amiga/conf/DRACO
cvs rdiff -u -r1.296 -r1.297 src/sys/arch/amiga/conf/GENERIC
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/amiga/conf/GENERIC.in
cvs rdiff -u -r1.115 -r1.116 src/sys/arch/amiga/conf/INSTALL

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/DRACO
diff -u src/sys/arch/amiga/conf/DRACO:1.164 src/sys/arch/amiga/conf/DRACO:1.165
--- src/sys/arch/amiga/conf/DRACO:1.164	Tue Jan 29 21:06:15 2013
+++ src/sys/arch/amiga/conf/DRACO	Fri Feb  1 14:48:15 2013
@@ -1,4 +1,4 @@
-# $NetBSD: DRACO,v 1.164 2013/01/29 21:06:15 rkujawa Exp $
+# $NetBSD: DRACO,v 1.165 2013/02/01 14:48:15 phx Exp $
 #
 # This file was automatically created.
 # Changes will be lost when make is run in this directory.
@@ -29,7 +29,7 @@ include arch/amiga/conf/std.amiga
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.164 $
+#ident 		GENERIC-$Revision: 1.165 $
 
 
 maxusers	8

Index: src/sys/arch/amiga/conf/GENERIC
diff -u src/sys/arch/amiga/conf/GENERIC:1.296 src/sys/arch/amiga/conf/GENERIC:1.297
--- src/sys/arch/amiga/conf/GENERIC:1.296	Tue Jan 29 21:06:16 2013
+++ src/sys/arch/amiga/conf/GENERIC	Fri Feb  1 14:48:15 2013
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.296 2013/01/29 21:06:16 rkujawa Exp $
+# $NetBSD: GENERIC,v 1.297 2013/02/01 14:48:15 phx Exp $
 #
 # This file was automatically created.
 # Changes will be lost when make is run in this directory.
@@ -29,7 +29,7 @@ include arch/amiga/conf/std.amiga
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.296 $
+#ident 		GENERIC-$Revision: 1.297 $
 
 
 maxusers	8
@@ -456,19 +456,21 @@ sd*		at atapibus? drive ?	# ATAPI disk d
 
 pccard0		at mainbus0
 pcmcia*		at pccard0
-com*		at pcmcia? function ?		# Modems and serial cards
-pcmcom*		at pcmcia? function ?		# PCMCIA multi-port serial cards
-aic*		at pcmcia? function ?		# Adaptec APA-1460 SCSI
+com*		at pcmcia? function ?	# Modems and serial cards
+pcmcom*		at pcmcia? function ?	# PCMCIA multi-port serial cards
+aic*		at pcmcia? function ?	# Adaptec APA-1460 SCSI
 wdc*		at pcmcia? function ?
-awi*		at pcmcia? function ?		# BayStack 650 (802.11FH)
-ep*		at pcmcia? function ?		# 3Com 3c589 and 3c562 Ethernet
-mbe*		at pcmcia? function ?		# MB8696x based Ethernet
-ne*		at pcmcia? function ?		# NE2000-compatible Ethernet
-sm*		at pcmcia? function ?		# Megahertz Ethernet
+awi*		at pcmcia? function ?	# BayStack 650 (802.11FH)
+ep*		at pcmcia? function ?	# 3Com 3c589 and 3c562 Ethernet
+mbe*		at pcmcia? function ?	# MB8696x based Ethernet
+ne*		at pcmcia? function ?	# NE2000-compatible Ethernet
+sm*		at pcmcia? function ?	# Megahertz Ethernet
 mhzc*		at pcmcia? function ?	# Megahertz Ethernet/Modem combo cards
 com*		at mhzc?
 sm*		at mhzc?
 
+nsphyter*	at mii? phy ?		# NS83843 PHYs
+ukphy*		at mii? phy ?		# generic unknown PHYs
 
 drsc0		at mainbus0		# DraCo scsi
 scsibus*	at drsc0

Index: src/sys/arch/amiga/conf/GENERIC.in
diff -u src/sys/arch/amiga/conf/GENERIC.in:1.110 src/sys/arch/amiga/conf/GENERIC.in:1.111
--- src/sys/arch/amiga/conf/GENERIC.in:1.110	Tue Jan 29 21:04:55 2013
+++ src/sys/arch/amiga/conf/GENERIC.in	Fri Feb  1 14:48:15 2013
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC.in,v 1.110 2013/01/29 21:04:55 rkujawa Exp $
+# $NetBSD: GENERIC.in,v 1.111 2013/02/01 14:48:15 phx Exp $
 #
 ##
 # GENERIC machine description file
@@ -52,7 +52,7 @@ include arch/amiga/conf/std.amiga
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.110 $
+#ident 		GENERIC-$Revision: 1.111 $
 
 m4_ifdef(`INSTALL_CONFIGURATION', `m4_dnl
 makeoptions	COPTS=-Os
@@ -537,19 +537,21 @@ sd*		at atapibus? drive ?	# ATAPI disk d
 
 pccard0		at mainbus0
 pcmcia*		at pccard0
-com*		at pcmcia? function ?		# Modems and serial cards
-pcmcom*		at pcmcia? function ?		# PCMCIA multi-port serial cards
-aic*		at pcmcia? function ?		# Adaptec APA-1460 SCSI
+com*		at pcmcia? function ?	# Modems and serial cards
+pcmcom*		at pcmcia? function ?	# PCMCIA multi-port serial cards
+aic*		at pcmcia? function ?	# Adaptec APA-1460 SCSI
 wdc*		at pcmcia? function ?
-awi*		at pcmcia? function ?		# BayStack 650 (802.11FH)
-ep*		at pcmcia? function ?		# 3Com 3c589 and 3c562 Ethernet
-mbe*		at pcmcia? function ?		# MB8696x based Ethernet
-ne*		at pcmcia? function ?		# NE2000-compatible Ethernet
-sm*		at pcmcia? function ?		# Megahertz Ethernet
+awi*		at pcmcia? function ?	# BayStack 650 (802.11FH)
+ep*		at pcmcia? function ?	# 3Com 3c589 and 3c562 Ethernet
+mbe*		at 

CVS commit: src/sys/arch/arm/arm32

2013-02-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb  1 15:02:32 UTC 2013

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
cleanup PVF_WRITE  pvh_attrs interaction.


To generate a diff of this commit:
cvs rdiff -u -r1.250 -r1.251 src/sys/arch/arm/arm32/pmap.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/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.250 src/sys/arch/arm/arm32/pmap.c:1.251
--- src/sys/arch/arm/arm32/pmap.c:1.250	Thu Jan 31 22:01:49 2013
+++ src/sys/arch/arm/arm32/pmap.c	Fri Feb  1 15:02:31 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.250 2013/01/31 22:01:49 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.251 2013/02/01 15:02:31 matt Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -212,7 +212,7 @@
 #include arm/cpuconf.h
 #include arm/arm32/katelib.h
 
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.250 2013/01/31 22:01:49 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.251 2013/02/01 15:02:31 matt Exp $);
 
 #ifdef PMAP_DEBUG
 
@@ -693,6 +693,12 @@ pmap_debug(int level)
 }
 #endif	/* PMAP_DEBUG */
 
+#ifdef PMAP_CACHE_VIPT
+#define PMAP_VALIDATE_MD_PAGE(md)	\
+	KASSERTMSG(arm_cache_prefer_mask == 0 || (((md)-pvh_attrs  PVF_WRITE) == 0) == ((md)-urw_mappings + (md)-krw_mappings == 0), \
+	(md) %p: attrs=%#x urw=%u krw=%u, (md), \
+	(md)-pvh_attrs, (md)-urw_mappings, (md)-krw_mappings);
+#endif /* PMAP_CACHE_VIPT */
 /*
  * A bunch of routines to conditionally flush the caches/TLB depending
  * on whether the specified pmap actually needs to be flushed at any
@@ -890,6 +896,13 @@ pmap_enter_pv(struct vm_page_md *md, pad
 
 #ifdef PMAP_CACHE_VIPT
 	/*
+	 * Even though pmap_vac_me_harder will set PVF_WRITE for us,
+	 * do it here as well to keep the mappings  KVF_WRITE consistent.
+	 */
+	if (arm_cache_prefer_mask != 0  (flags  PVF_WRITE) != 0) {
+		md-pvh_attrs |= PVF_WRITE;
+	}
+	/*
 	 * If this is an exec mapping and its the first exec mapping
 	 * for this page, make sure to sync the I-cache.
 	 */
@@ -1008,8 +1021,11 @@ pmap_remove_pv(struct vm_page_md *md, pa
 	 * mappings (ignoring KMPAGE), clear the WRITE flag and writeback
 	 * the contents to memory.
 	 */
-	if (md-krw_mappings + md-urw_mappings == 0)
-		md-pvh_attrs = ~PVF_WRITE;
+	if (arm_cache_prefer_mask != 0) {
+		if (md-krw_mappings + md-urw_mappings == 0)
+			md-pvh_attrs = ~PVF_WRITE;
+		PMAP_VALIDATE_MD_PAGE(md);
+	}
 	KASSERT((md-pvh_attrs  PVF_DMOD) == 0 || (md-pvh_attrs  (PVF_DIRTY|PVF_NC)));
 #endif /* PMAP_CACHE_VIPT */
 
@@ -1087,10 +1103,12 @@ pmap_modify_pv(struct vm_page_md *md, pa
 		}
 	}
 #ifdef PMAP_CACHE_VIPT
-	if (md-urw_mappings + md-krw_mappings == 0) {
-		md-pvh_attrs = ~PVF_WRITE;
-	} else {
-		md-pvh_attrs |= PVF_WRITE;
+	if (arm_cache_prefer_mask != 0) {
+		if (md-urw_mappings + md-krw_mappings == 0) {
+			md-pvh_attrs = ~PVF_WRITE;
+		} else {
+			md-pvh_attrs |= PVF_WRITE;
+		}
 	}
 	/*
 	 * We have two cases here: the first is from enter_pv (new exec
@@ -1847,7 +1865,7 @@ pmap_vac_me_harder(struct vm_page_md *md
 		 * Only check for a bad alias if we have writable mappings.
 		 */
 		tst_mask = arm_cache_prefer_mask;
-		if (rw_mappings  0  arm_cache_prefer_mask) {
+		if (rw_mappings  0) {
 			for (; pv  !bad_alias; pv = SLIST_NEXT(pv, pv_link)) {
 /* if there's a bad alias, stop checking. */
 if (tst_mask != (pv-pv_va  arm_cache_prefer_mask))
@@ -1903,7 +1921,7 @@ pmap_vac_me_harder(struct vm_page_md *md
 		KASSERT((md-pvh_attrs  PVF_DMOD) == 0 || (md-pvh_attrs  (PVF_DIRTY|PVF_NC)));
 		KASSERT((rw_mappings == 0) == !(md-pvh_attrs  PVF_WRITE));
 	} else if (!va) {
-		KASSERT(arm_cache_prefer_mask == 0 || pmap_is_page_colored_p(md));
+		KASSERT(pmap_is_page_colored_p(md));
 		KASSERT(!(md-pvh_attrs  PVF_WRITE)
 		|| (md-pvh_attrs  PVF_DIRTY));
 		if (rw_mappings == 0) {
@@ -2227,10 +2245,12 @@ pmap_clearbit(struct vm_page_md *md, pad
 	md-uro_mappings++;
 }
 #ifdef PMAP_CACHE_VIPT
-if (md-urw_mappings + md-krw_mappings == 0) {
-	md-pvh_attrs = ~PVF_WRITE;
-} else {
-	KASSERT(md-pvh_attrs  PVF_WRITE);
+if (arm_cache_prefer_mask != 0) {
+	if (md-urw_mappings + md-krw_mappings == 0) {
+		md-pvh_attrs = ~PVF_WRITE;
+	} else {
+		PMAP_VALIDATE_MD_PAGE(md);
+	}
 }
 if (want_syncicache)
 	need_syncicache = true;
@@ -2564,7 +2584,7 @@ pmap_page_remove(struct vm_page_md *md, 
 		if (PV_IS_EXEC_P(md-pvh_attrs))
 			PMAPCOUNT(exec_discarded_page_protect);
 		md-pvh_attrs = ~PVF_EXEC;
-		KASSERT((md-urw_mappings + md-krw_mappings == 0) == !(md-pvh_attrs  PVF_WRITE));
+		PMAP_VALIDATE_MD_PAGE(md);
 #endif
 		return;
 	}
@@ -2663,9 +2683,11 @@ pmap_page_remove(struct vm_page_md *md, 
 	md-pvh_attrs = ~PVF_EXEC;
 	KASSERT(md-urw_mappings == 0);
 	KASSERT(md-uro_mappings == 0);
-	if (md-krw_mappings == 0)
-		md-pvh_attrs = ~PVF_WRITE;
-	KASSERT((md-urw_mappings + md-krw_mappings == 0) == 

CVS commit: src/sys/arch/arm/include

2013-02-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb  1 15:23:11 UTC 2013

Modified Files:
src/sys/arch/arm/include: sysarch.h

Log Message:
include stdbool.h if !_KERNEL


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/include/sysarch.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/arm/include/sysarch.h
diff -u src/sys/arch/arm/include/sysarch.h:1.9 src/sys/arch/arm/include/sysarch.h:1.10
--- src/sys/arch/arm/include/sysarch.h:1.9	Thu Jan 31 14:58:51 2013
+++ src/sys/arch/arm/include/sysarch.h	Fri Feb  1 15:23:11 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysarch.h,v 1.9 2013/01/31 14:58:51 matt Exp $	*/
+/*	$NetBSD: sysarch.h,v 1.10 2013/02/01 15:23:11 matt Exp $	*/
 
 /*
  * Copyright (c) 1996-1997 Mark Brinicombe.
@@ -41,6 +41,9 @@
  * Pickup definition of uintptr_t
  */
 #include sys/stdint.h
+#ifndef _KERNEL
+#include stdbool.h
+#endif
 
 /*
  * Architecture specific syscalls (arm)



CVS commit: src/sys/arch/arm/broadcom

2013-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb  1 16:10:16 UTC 2013

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_rng.c

Log Message:
Use bus_space_read_multi_4 and fix copyright year. From Jared.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/broadcom/bcm2835_rng.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/broadcom/bcm2835_rng.c
diff -u src/sys/arch/arm/broadcom/bcm2835_rng.c:1.2 src/sys/arch/arm/broadcom/bcm2835_rng.c:1.3
--- src/sys/arch/arm/broadcom/bcm2835_rng.c:1.2	Wed Jan 30 11:52:54 2013
+++ src/sys/arch/arm/broadcom/bcm2835_rng.c	Fri Feb  1 16:10:16 2013
@@ -1,7 +1,7 @@
-/*	$NetBSD: bcm2835_rng.c,v 1.2 2013/01/30 11:52:54 jmcneill Exp $ */
+/*	$NetBSD: bcm2835_rng.c,v 1.3 2013/02/01 16:10:16 skrll Exp $ */
 
 /*-
- * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bcm2835_rng.c,v 1.2 2013/01/30 11:52:54 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: bcm2835_rng.c,v 1.3 2013/02/01 16:10:16 skrll Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -126,15 +126,13 @@ bcmrng_tick(void *priv)
 {
 	struct bcm2835rng_softc *sc = priv;
 	uint32_t status;
-	int cnt, i;
+	int cnt;
 
 	status = bus_space_read_4(sc-sc_iot, sc-sc_ioh, RNG_STATUS);
 	cnt = (status  RNG_STATUS_CNT_MASK)  RNG_STATUS_CNT_SHIFT;
-	for (i = 0; i  cnt; i++) {
-		sc-sc_data[i] = bus_space_read_4(sc-sc_iot, sc-sc_ioh,
-		RNG_DATA);
-	}
 	if (cnt  0) {
+		bus_space_read_multi_4(sc-sc_iot, sc-sc_ioh, RNG_DATA,
+		sc-sc_data, cnt);
 		rnd_add_data(sc-sc_rnd, sc-sc_data,
 		cnt * 4, cnt * 4 * NBBY);
 	}



CVS commit: src/sys/arch/arm/broadcom

2013-02-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb  1 19:27:48 UTC 2013

Modified Files:
src/sys/arch/arm/broadcom: bcm53xx_rng.c

Log Message:
Use bus_space_read_multi_4 to drain the RNG's FIFO.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/broadcom/bcm53xx_rng.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/broadcom/bcm53xx_rng.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_rng.c:1.3 src/sys/arch/arm/broadcom/bcm53xx_rng.c:1.4
--- src/sys/arch/arm/broadcom/bcm53xx_rng.c:1.3	Sat Oct 27 17:24:37 2012
+++ src/sys/arch/arm/broadcom/bcm53xx_rng.c	Fri Feb  1 19:27:47 2013
@@ -33,7 +33,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: bcm53xx_rng.c,v 1.3 2012/10/27 17:24:37 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: bcm53xx_rng.c,v 1.4 2013/02/01 19:27:47 matt Exp $);
 
 #include sys/bus.h
 #include sys/callout.h
@@ -91,6 +91,13 @@ bcmrng_read_4(struct bcmrng_softc *sc, b
 }
 
 static inline void
+bcmrng_read_multi_4(struct bcmrng_softc *sc, bus_size_t o, uint32_t *p,
+size_t c)
+{
+	return bus_space_read_multi_4(sc-sc_bst, sc-sc_bsh, o, p, c);
+}
+
+static inline void
 bcmrng_write_4(struct bcmrng_softc *sc, bus_size_t o, uint32_t v)
 {
 	bus_space_write_4(sc-sc_bst, sc-sc_bsh, o, v);
@@ -162,16 +169,13 @@ bcmrng_empty(struct bcmrng_softc *sc)
 	}
 
 	uint32_t data[nwords];
-	while (nwords--  0) {
-		/*
-		 * It's random data, who cares what order we load it in?
-		 */
-		data[nwords] = bcmrng_read_4(sc, RNG_DATA);
-	}
+
+	bcmrng_read_multi_4(sc, RNG_DATA, data, nwords);
+
 	rnd_add_data(sc-sc_rnd_source, data, sizeof(data), sizeof(data) * 8);
 	mutex_exit(sc-sc_lock);
-	//aprint_debug_dev(sc-sc_dev, added %zu words\n, __arraycount(data));
-	return __arraycount(data);
+	//aprint_debug_dev(sc-sc_dev, added %zu words\n, nwords);
+	return nwords;
 }
 
 void



CVS commit: src/crypto/external/bsd/openssl

2013-02-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb  1 21:02:48 UTC 2013

Modified Files:
src/crypto/external/bsd/openssl: mkpc pkgconfig.mk

Log Message:
use the version in the source tree, instead of the build host


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/crypto/external/bsd/openssl/mkpc
cvs rdiff -u -r1.3 -r1.4 src/crypto/external/bsd/openssl/pkgconfig.mk

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

Modified files:

Index: src/crypto/external/bsd/openssl/mkpc
diff -u src/crypto/external/bsd/openssl/mkpc:1.2 src/crypto/external/bsd/openssl/mkpc:1.3
--- src/crypto/external/bsd/openssl/mkpc:1.2	Tue Jan 22 08:51:45 2013
+++ src/crypto/external/bsd/openssl/mkpc	Fri Feb  1 16:02:48 2013
@@ -1,15 +1,15 @@
 #!/bin/sh
-#	$NetBSD: mkpc,v 1.2 2013/01/22 13:51:45 christos Exp $
+#	$NetBSD: mkpc,v 1.3 2013/02/01 21:02:48 christos Exp $
 
 getversion() {
-	(echo '#include openssl/opensslv.h'; echo OPENSSL_VERSION_TEXT) |
-	cpp | grep OpenSSL | cut -d ' ' -f 2
+	(echo '#include opensslv.h'; echo OPENSSL_VERSION_TEXT) |
+	cpp -I$1 | grep OpenSSL | cut -d ' ' -f 2
 }
-VERSION=$(getversion)
+VERSION=$(getversion $1)
 
-sed -e s/@VERSION@/${VERSION}/g  $1
+sed -e s/@VERSION@/${VERSION}/g  $2
 
-case $1 in
+case $2 in
 libcrypto.pc)
 	NAME=OpenSSL-libcrypto
 	LIBS=-lcrypto
@@ -26,13 +26,13 @@ openssl.pc)
 	DESCRIPTION=Sockets Layer and cryptography libraries and tools
 	;;
 *)
-	echo $0: I don't know about $1 12
+	echo $0: I don't know about $2 12
 	exit 1
 	;;
 esac
 
-cat  EOF  $1
-# \$NetBSD: mkpc,v 1.2 2013/01/22 13:51:45 christos Exp $
+cat  EOF  $2
+# \$NetBSD: mkpc,v 1.3 2013/02/01 21:02:48 christos Exp $
 prefix=/usr
 exec_prefix=/usr
 libdir=/usr/lib

Index: src/crypto/external/bsd/openssl/pkgconfig.mk
diff -u src/crypto/external/bsd/openssl/pkgconfig.mk:1.3 src/crypto/external/bsd/openssl/pkgconfig.mk:1.4
--- src/crypto/external/bsd/openssl/pkgconfig.mk:1.3	Sat Jan 19 16:57:55 2013
+++ src/crypto/external/bsd/openssl/pkgconfig.mk	Fri Feb  1 16:02:48 2013
@@ -1,4 +1,4 @@
-# $NetBSD: pkgconfig.mk,v 1.3 2013/01/19 21:57:55 apb Exp $
+# $NetBSD: pkgconfig.mk,v 1.4 2013/02/01 21:02:48 christos Exp $
 
 FILESDIR=/usr/lib/pkgconfig
 .for pkg in ${PKGCONFIG}
@@ -6,5 +6,5 @@ FILES+=${pkg}.pc
 FILESBUILD_${pkg}.pc=yes
 
 ${pkg}.pc: ${.CURDIR}/../../mkpc
-	${.ALLSRC} ${.TARGET}  ${.TARGET}
+	${.ALLSRC} ${OPENSSLSRC}/crypto ${.TARGET}  ${.TARGET}
 .endfor



CVS commit: src

2013-02-01 Thread Hubert Feyrer
Module Name:src
Committed By:   hubertf
Date:   Sat Feb  2 02:08:37 UTC 2013

Modified Files:
src: build.sh

Log Message:
If the initial build of nbmake fails, make the configure logfile
available (and tell where it is).


To generate a diff of this commit:
cvs rdiff -u -r1.261 -r1.262 src/build.sh

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

Modified files:

Index: src/build.sh
diff -u src/build.sh:1.261 src/build.sh:1.262
--- src/build.sh:1.261	Mon Jan 14 13:02:59 2013
+++ src/build.sh	Sat Feb  2 02:08:37 2013
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#	$NetBSD: build.sh,v 1.261 2013/01/14 13:02:59 pooka Exp $
+#	$NetBSD: build.sh,v 1.262 2013/02/02 02:08:37 hubertf Exp $
 #
 # Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1455,7 +1455,8 @@ rebuildmake()
 		${runcmd} env CC=${HOST_CC-cc} CPPFLAGS=${HOST_CPPFLAGS} \
 			CFLAGS=${HOST_CFLAGS--O} LDFLAGS=${HOST_LDFLAGS} \
 			${HOST_SH} ${TOP}/tools/make/configure ||
-		bomb Configure of ${toolprefix}make failed
+		( cp ${tmpdir}/config.log ${tmpdir}-config.log
+		  bomb Configure of ${toolprefix}make failed, see ${tmpdir}-config.log for details )
 		${runcmd} ${HOST_SH} buildmake.sh ||
 		bomb Build of ${toolprefix}make failed
 		make=${tmpdir}/${toolprefix}make
@@ -1716,7 +1717,7 @@ createmakewrapper()
 	eval cat EOF ${makewrapout}
 #! ${HOST_SH}
 # Set proper variables to allow easy make building of a NetBSD subtree.
-# Generated from:  \$NetBSD: build.sh,v 1.261 2013/01/14 13:02:59 pooka Exp $
+# Generated from:  \$NetBSD: build.sh,v 1.262 2013/02/02 02:08:37 hubertf Exp $
 # with these arguments: ${_args}
 #
 



CVS commit: src/external/gpl3/gcc/dist/gcc/config/arm

2013-02-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Feb  2 05:04:26 UTC 2013

Modified Files:
src/external/gpl3/gcc/dist/gcc/config/arm: netbsd-elf.h

Log Message:
Can't use TARGET_AAPCS_BASED since it's not setup by the time
SUBTARGET_CPU_DEFAULT is invoked so use ARM_DEFAULT_ABI instead).


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/gpl3/gcc/dist/gcc/config/arm/netbsd-elf.h

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config/arm/netbsd-elf.h
diff -u src/external/gpl3/gcc/dist/gcc/config/arm/netbsd-elf.h:1.3 src/external/gpl3/gcc/dist/gcc/config/arm/netbsd-elf.h:1.4
--- src/external/gpl3/gcc/dist/gcc/config/arm/netbsd-elf.h:1.3	Fri Jan 11 13:58:40 2013
+++ src/external/gpl3/gcc/dist/gcc/config/arm/netbsd-elf.h	Sat Feb  2 05:04:25 2013
@@ -29,7 +29,8 @@
SUBTARGET_CPU_DEFAULT to achieve this.  */
 
 #define SUBTARGET_CPU_DEFAULT \
-	(TARGET_AAPCS_BASED ? TARGET_CPU_arm926ejs : TARGET_CPU_arm6)
+	(ARM_DEFAULT_ABI != ARM_ABI_APCS  ARM_DEFAULT_ABI != ARM_ABI_ATPCS \
+	? TARGET_CPU_arm926ejs : TARGET_CPU_arm6)
 
 /* This defaults us to little-endian.  */
 #ifndef TARGET_ENDIAN_DEFAULT



CVS commit: src/sys/netinet

2013-02-01 Thread Mihai Chelaru
Module Name:src
Committed By:   kefren
Date:   Sat Feb  2 07:00:42 UTC 2013

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

Log Message:
get rid of ip_len local variable. Use ntohs(ip-ip_len) like the rest
of the code in the two places this variable was used


To generate a diff of this commit:
cvs rdiff -u -r1.217 -r1.218 src/sys/netinet/ip_output.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_output.c
diff -u src/sys/netinet/ip_output.c:1.217 src/sys/netinet/ip_output.c:1.218
--- src/sys/netinet/ip_output.c:1.217	Mon Jun 25 15:28:39 2012
+++ src/sys/netinet/ip_output.c	Sat Feb  2 07:00:40 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_output.c,v 1.217 2012/06/25 15:28:39 christos Exp $	*/
+/*	$NetBSD: ip_output.c,v 1.218 2013/02/02 07:00:40 kefren Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ip_output.c,v 1.217 2012/06/25 15:28:39 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: ip_output.c,v 1.218 2013/02/02 07:00:40 kefren Exp $);
 
 #include opt_pfil_hooks.h
 #include opt_inet.h
@@ -187,7 +187,6 @@ ip_output(struct mbuf *m0, ...)
 	struct secpolicy *sp = NULL;
 	int s;
 #endif
-	u_int16_t ip_len;
 	union {
 		struct sockaddr		dst;
 		struct sockaddr_in	dst4;
@@ -492,9 +491,6 @@ sendit:
 	(rt-rt_rmx.rmx_locks  RTV_MTU) == 0)
 		ip-ip_off |= htons(IP_DF);
 
-	/* Remember the current ip_len */
-	ip_len = ntohs(ip-ip_len);
-
 #ifdef FAST_IPSEC
 	/*
 	 * Check the security policy (SP) for the packet and, if
@@ -598,7 +594,6 @@ spd_done:
 
 	ip = mtod(m, struct ip *);
 	hlen = ip-ip_hl  2;
-	ip_len = ntohs(ip-ip_len);
 #endif /* PFIL_HOOKS */
 
 	m-m_pkthdr.csum_data |= hlen  16;
@@ -620,11 +615,11 @@ spd_done:
 	 * If small enough for mtu of path, or if using TCP segmentation
 	 * offload, can just send directly.
 	 */
-	if (ip_len = mtu ||
+	if (ntohs(ip-ip_len) = mtu ||
 	(m-m_pkthdr.csum_flags  M_CSUM_TSOv4) != 0) {
 #if IFA_STATS
 		if (ia)
-			ia-ia_ifa.ifa_data.ifad_outbytes += ip_len;
+			ia-ia_ifa.ifa_data.ifad_outbytes += ntohs(ip-ip_len);
 #endif
 		/*
 		 * Always initialize the sum to 0!  Some HW assisted