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

2015-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug  8 15:36:39 UTC 2015

Modified Files:
src/sys/arch/arm/amlogic: amlogic_sdhc.c

Log Message:
Add support for UHS-I / MMC HS200 tuning process


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/amlogic/amlogic_sdhc.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/amlogic/amlogic_sdhc.c
diff -u src/sys/arch/arm/amlogic/amlogic_sdhc.c:1.10 src/sys/arch/arm/amlogic/amlogic_sdhc.c:1.11
--- src/sys/arch/arm/amlogic/amlogic_sdhc.c:1.10	Sat Aug  8 14:48:41 2015
+++ src/sys/arch/arm/amlogic/amlogic_sdhc.c	Sat Aug  8 15:36:39 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: amlogic_sdhc.c,v 1.10 2015/08/08 14:48:41 jmcneill Exp $ */
+/* $NetBSD: amlogic_sdhc.c,v 1.11 2015/08/08 15:36:39 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill jmcne...@invisible.ca
@@ -29,7 +29,7 @@
 #include locators.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: amlogic_sdhc.c,v 1.10 2015/08/08 14:48:41 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: amlogic_sdhc.c,v 1.11 2015/08/08 15:36:39 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -90,7 +90,9 @@ static void	amlogic_sdhc_exec_command(sd
 static void	amlogic_sdhc_card_enable_intr(sdmmc_chipset_handle_t, int);
 static void	amlogic_sdhc_card_intr_ack(sdmmc_chipset_handle_t);
 static int	amlogic_sdhc_signal_voltage(sdmmc_chipset_handle_t, int);
+static int	amlogic_sdhc_execute_tuning(sdmmc_chipset_handle_t, int);
 
+static int	amlogic_sdhc_default_rx_phase(struct amlogic_sdhc_softc *);
 static int	amlogic_sdhc_set_clock(struct amlogic_sdhc_softc *, u_int);
 static int	amlogic_sdhc_wait_idle(struct amlogic_sdhc_softc *);
 static int	amlogic_sdhc_wait_ista(struct amlogic_sdhc_softc *, uint32_t, int);
@@ -111,12 +113,15 @@ static struct sdmmc_chip_functions amlog
 	.card_enable_intr = amlogic_sdhc_card_enable_intr,
 	.card_intr_ack = amlogic_sdhc_card_intr_ack,
 	.signal_voltage = amlogic_sdhc_signal_voltage,
+	.execute_tuning = amlogic_sdhc_execute_tuning,
 };
 
 #define SDHC_WRITE(sc, reg, val) \
 	bus_space_write_4((sc)-sc_bst, (sc)-sc_bsh, (reg), (val))
 #define SDHC_READ(sc, reg) \
 	bus_space_read_4((sc)-sc_bst, (sc)-sc_bsh, (reg))
+#define SDHC_SET_CLEAR(sc, reg, set, clr) \
+	amlogic_reg_set_clear((sc)-sc_bst, (sc)-sc_bsh, (reg), (set), (clr))
 
 static int
 amlogic_sdhc_match(device_t parent, cfdata_t cf, void *aux)
@@ -265,6 +270,33 @@ amlogic_sdhc_dmainit(struct amlogic_sdhc
 }
 
 static int
+amlogic_sdhc_default_rx_phase(struct amlogic_sdhc_softc *sc)
+{
+	const u_int pll_freq = amlogic_get_rate_fixed() / 1000 / 3;
+	const u_int clkc = SDHC_READ(sc, SD_CLKC_REG);
+	const u_int clk_div = __SHIFTOUT(clkc, SD_CLKC_CLK_DIV);
+	const u_int act_freq = pll_freq / clk_div;
+
+	if (act_freq  9) {
+		return 1;
+	} else if (act_freq  45000) {
+		if (sc-sc_signal_voltage == SDMMC_SIGNAL_VOLTAGE_330) {
+			return 15;
+		} else {
+			return 11;
+		}
+	} else if (act_freq = 25000) {
+		return 15;
+	} else if (act_freq  5000) {
+		return 23;
+	} else if (act_freq  1000) {
+		return 55;
+	} else {
+		return 1061;
+	}
+}
+
+static int
 amlogic_sdhc_set_clock(struct amlogic_sdhc_softc *sc, u_int freq)
 {
 	uint32_t clkc;
@@ -308,25 +340,8 @@ amlogic_sdhc_set_clock(struct amlogic_sd
 	clk2 = ~SD_CLK2_SD_CLK_PHASE;
 	clk2 |= __SHIFTIN(1, SD_CLK2_SD_CLK_PHASE);
 	clk2 = ~SD_CLK2_RX_CLK_PHASE;
-
-	const u_int act_freq = pll_freq / clk_div;
-	if (act_freq  9) {
-		clk2 |= __SHIFTIN(1, SD_CLK2_RX_CLK_PHASE);
-	} else if (act_freq  45000) {
-		if (sc-sc_signal_voltage == SDMMC_SIGNAL_VOLTAGE_330) {
-			clk2 |= __SHIFTIN(15, SD_CLK2_RX_CLK_PHASE);
-		} else {
-			clk2 |= __SHIFTIN(11, SD_CLK2_RX_CLK_PHASE);
-		}
-	} else if (act_freq = 25000) {
-		clk2 |= __SHIFTIN(15, SD_CLK2_RX_CLK_PHASE);
-	} else if (act_freq  5000) {
-		clk2 |= __SHIFTIN(23, SD_CLK2_RX_CLK_PHASE);
-	} else if (act_freq  1000) {
-		clk2 |= __SHIFTIN(55, SD_CLK2_RX_CLK_PHASE);
-	} else {
-		clk2 |= __SHIFTIN(1061, SD_CLK2_RX_CLK_PHASE);
-	}
+	clk2 |= __SHIFTIN(amlogic_sdhc_default_rx_phase(sc),
+			  SD_CLK2_RX_CLK_PHASE);
 	SDHC_WRITE(sc, SD_CLK2_REG, clk2);
 
 	return 0;
@@ -720,3 +735,127 @@ amlogic_sdhc_signal_voltage(sdmmc_chipse
 	sc-sc_signal_voltage = signal_voltage;
 	return 0;
 }
+
+static int
+amlogic_sdhc_execute_tuning(sdmmc_chipset_handle_t sch, int timing)
+{
+	static const uint8_t tuning_blk_8bit[] = {
+		0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00,
+		0xff, 0xff, 0xcc, 0xcc, 0xcc, 0x33, 0xcc, 0xcc,
+		0xcc, 0x33, 0x33, 0xcc, 0xcc, 0xcc, 0xff, 0xff,
+		0xff, 0xee, 0xff, 0xff, 0xff, 0xee, 0xee, 0xff,
+		0xff, 0xff, 0xdd, 0xff, 0xff, 0xff, 0xdd, 0xdd,  
+		0xff, 0xff, 0xff, 0xbb, 0xff, 0xff, 0xff, 0xbb,
+		0xbb, 0xff, 0xff, 0xff, 0x77, 0xff, 0xff, 0xff,
+		0x77, 0x77, 0xff, 0x77, 0xbb, 0xdd, 0xee, 0xff,
+		0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00,
+		0x00, 0xff, 0xff, 

CVS commit: [netbsd-7] src/sys/compat/netbsd32

2015-08-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug  8 15:41:54 UTC 2015

Modified Files:
src/sys/compat/netbsd32 [netbsd-7]: netbsd32_socket.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #941):
sys/compat/netbsd32/netbsd32_socket.c: revision 1.42
Memory leak, triggerable from an unprivileged user.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.41.14.1 src/sys/compat/netbsd32/netbsd32_socket.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/compat/netbsd32/netbsd32_socket.c
diff -u src/sys/compat/netbsd32/netbsd32_socket.c:1.41 src/sys/compat/netbsd32/netbsd32_socket.c:1.41.14.1
--- src/sys/compat/netbsd32/netbsd32_socket.c:1.41	Sat Aug 18 15:25:15 2012
+++ src/sys/compat/netbsd32/netbsd32_socket.c	Sat Aug  8 15:41:54 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_socket.c,v 1.41 2012/08/18 15:25:15 martin Exp $	*/
+/*	$NetBSD: netbsd32_socket.c,v 1.41.14.1 2015/08/08 15:41:54 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: netbsd32_socket.c,v 1.41 2012/08/18 15:25:15 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: netbsd32_socket.c,v 1.41.14.1 2015/08/08 15:41:54 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -331,7 +331,7 @@ netbsd32_sendmsg(struct lwp *l, const st
 	} */
 	struct msghdr msg;
 	struct netbsd32_msghdr msg32;
-	struct iovec aiov[UIO_SMALLIOV], *iov;
+	struct iovec aiov[UIO_SMALLIOV], *iov = aiov;
 	struct netbsd32_iovec *iov32;
 	size_t iovsz;
 	int error;
@@ -346,6 +346,7 @@ netbsd32_sendmsg(struct lwp *l, const st
 		error = copyin32_msg_control(l, msg);
 		if (error)
 			return (error);
+		/* From here on, msg.msg_control is allocated */
 	} else {
 		msg.msg_control = NULL;
 		msg.msg_controllen = 0;
@@ -353,23 +354,32 @@ netbsd32_sendmsg(struct lwp *l, const st
 
 	iovsz = msg.msg_iovlen * sizeof(struct iovec);
 	if ((u_int)msg.msg_iovlen  UIO_SMALLIOV) {
-		if ((u_int)msg.msg_iovlen  IOV_MAX)
-			return (EMSGSIZE);
+		if ((u_int)msg.msg_iovlen  IOV_MAX) {
+			error = EMSGSIZE;
+			goto out;
+		}
 		iov = kmem_alloc(iovsz, KM_SLEEP);
-	} else
-		iov = aiov;
+	}
 
 	iov32 = NETBSD32PTR64(msg32.msg_iov);
 	error = netbsd32_to_iovecin(iov32, iov, msg.msg_iovlen);
 	if (error)
-		goto done;
+		goto out;
 	msg.msg_iov = iov;
 
 	error = do_sys_sendmsg(l, SCARG(uap, s), msg, SCARG(uap, flags), retval);
-done:
+	/* msg.msg_control freed by do_sys_sendmsg() */
+
 	if (iov != aiov)
 		kmem_free(iov, iovsz);
 	return (error);
+
+out:
+	if (iov != aiov)
+		kmem_free(iov, iovsz);
+	if (msg.msg_control)
+		m_free(msg.msg_control);
+	return error;
 }
 
 int



CVS commit: [netbsd-7] src/doc

2015-08-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug  8 15:43:01 UTC 2015

Modified Files:
src/doc [netbsd-7]: CHANGES-7.0

Log Message:
Ticket #941


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.360 -r1.1.2.361 src/doc/CHANGES-7.0

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-7.0
diff -u src/doc/CHANGES-7.0:1.1.2.360 src/doc/CHANGES-7.0:1.1.2.361
--- src/doc/CHANGES-7.0:1.1.2.360	Sat Aug  8 10:11:52 2015
+++ src/doc/CHANGES-7.0	Sat Aug  8 15:43:00 2015
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0,v 1.1.2.360 2015/08/08 10:11:52 martin Exp $
+# $NetBSD: CHANGES-7.0,v 1.1.2.361 2015/08/08 15:43:00 martin Exp $
 
 A complete list of changes from the initial NetBSD 7.0 branch on 11 Aug 2014
 until the 7.0 release:
@@ -33866,3 +33866,8 @@ sys/external/bsd/ipf/netinet/ip_nat6.c		
 	Avoid panic in SIOCGNATL dereferencing a NULL softc.
 	[prlw1, ticket #939]
 
+sys/compat/netbsd32/netbsd32_socket.c		1.42
+
+	Memory leak, triggerable from an unprivileged user.
+	[maxv, ticket #941]
+



CVS commit: src/sys/arch

2015-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug  8 14:01:44 UTC 2015

Modified Files:
src/sys/arch/arm/amlogic: amlogic_io.c amlogic_sdhc.c amlogic_sdio.c
src/sys/arch/evbarm/conf: ODROID-C1

Log Message:
We have two SD controllers with different capabilities. Use the fast SDHC
controller for the card that the bootloader marked as the boot device,
and the slower SDIO controller for the other card if present.

The controller to slot mappings can be wired down in the kernel config
with the port locator if necessary.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/amlogic/amlogic_io.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/amlogic/amlogic_sdhc.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/amlogic/amlogic_sdio.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/evbarm/conf/ODROID-C1

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/amlogic/amlogic_io.c
diff -u src/sys/arch/arm/amlogic/amlogic_io.c:1.11 src/sys/arch/arm/amlogic/amlogic_io.c:1.12
--- src/sys/arch/arm/amlogic/amlogic_io.c:1.11	Sat Apr 25 14:41:33 2015
+++ src/sys/arch/arm/amlogic/amlogic_io.c	Sat Aug  8 14:01:44 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: amlogic_io.c,v 1.11 2015/04/25 14:41:33 jmcneill Exp $ */
+/* $NetBSD: amlogic_io.c,v 1.12 2015/08/08 14:01:44 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill jmcne...@invisible.ca
@@ -29,7 +29,7 @@
 #include opt_amlogic.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: amlogic_io.c,v 1.11 2015/04/25 14:41:33 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: amlogic_io.c,v 1.12 2015/08/08 14:01:44 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -76,13 +76,9 @@ static const struct amlogic_locators aml
   { awge,
 AMLOGIC_GMAC_OFFSET, AMLOGIC_GMAC_SIZE, NOPORT, AMLOGIC_INTR_GMAC },
   { amlogicsdio,
-AMLOGIC_SDIO_OFFSET, AMLOGIC_SDIO_SIZE, 1, AMLOGIC_INTR_SDIO },
-  { amlogicsdio,
-AMLOGIC_SDIO_OFFSET, AMLOGIC_SDIO_SIZE, 2, AMLOGIC_INTR_SDIO },
-  { amlogicsdhc,
-AMLOGIC_SDHC_OFFSET, AMLOGIC_SDHC_SIZE, 1, AMLOGIC_INTR_SDHC },
+AMLOGIC_SDIO_OFFSET, AMLOGIC_SDIO_SIZE, NOPORT, AMLOGIC_INTR_SDIO },
   { amlogicsdhc,
-AMLOGIC_SDHC_OFFSET, AMLOGIC_SDHC_SIZE, 2, AMLOGIC_INTR_SDHC },
+AMLOGIC_SDHC_OFFSET, AMLOGIC_SDHC_SIZE, NOPORT, AMLOGIC_INTR_SDHC },
   { amlogicrtc,
 AMLOGIC_RTC_OFFSET, AMLOGIC_RTC_SIZE, NOPORT, AMLOGIC_INTR_RTC },
 };

Index: src/sys/arch/arm/amlogic/amlogic_sdhc.c
diff -u src/sys/arch/arm/amlogic/amlogic_sdhc.c:1.8 src/sys/arch/arm/amlogic/amlogic_sdhc.c:1.9
--- src/sys/arch/arm/amlogic/amlogic_sdhc.c:1.8	Sat Aug  8 10:51:50 2015
+++ src/sys/arch/arm/amlogic/amlogic_sdhc.c	Sat Aug  8 14:01:44 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: amlogic_sdhc.c,v 1.8 2015/08/08 10:51:50 jmcneill Exp $ */
+/* $NetBSD: amlogic_sdhc.c,v 1.9 2015/08/08 14:01:44 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill jmcne...@invisible.ca
@@ -29,7 +29,7 @@
 #include locators.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: amlogic_sdhc.c,v 1.8 2015/08/08 10:51:50 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: amlogic_sdhc.c,v 1.9 2015/08/08 14:01:44 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -69,7 +69,7 @@ struct amlogic_sdhc_softc {
 	bus_dma_segment_t	sc_segs[1];
 	void			*sc_bbuf;
 
-	u_int			sc_port;
+	int			sc_port;
 	int			sc_signal_voltage;
 };
 
@@ -121,12 +121,6 @@ static struct sdmmc_chip_functions amlog
 static int
 amlogic_sdhc_match(device_t parent, cfdata_t cf, void *aux)
 {
-	struct amlogicio_attach_args * const aio = aux;
-	const struct amlogic_locators * const loc = aio-aio_loc;
-
-	if (loc-loc_port == AMLOGICIOCF_PORT_DEFAULT)
-		return 0;
-
 	return 1;
 }
 
@@ -136,6 +130,8 @@ amlogic_sdhc_attach(device_t parent, dev
 	struct amlogic_sdhc_softc * const sc = device_private(self);
 	struct amlogicio_attach_args * const aio = aux;
 	const struct amlogic_locators * const loc = aio-aio_loc;
+	prop_dictionary_t cfg = device_properties(self);
+	uint32_t boot_id;
 
 	sc-sc_dev = self;
 	sc-sc_bst = aio-aio_core_bst;
@@ -147,14 +143,27 @@ amlogic_sdhc_attach(device_t parent, dev
 	sc-sc_port = loc-loc_port;
 	sc-sc_signal_voltage = SDMMC_SIGNAL_VOLTAGE_330;
 
+	if (sc-sc_port == AMLOGICIOCF_PORT_DEFAULT) {
+		if (!prop_dictionary_get_uint32(cfg, boot_id, boot_id)) {
+			aprint_error(: no port selected\n);
+			return;
+		}
+		/* Booted device goes on SDHC controller */
+		if (boot_id == 0) {
+			sc-sc_port = AMLOGIC_SDHC_PORT_C;	/* eMMC */
+		} else {
+			sc-sc_port = AMLOGIC_SDHC_PORT_B;	/* SD card */
+		}
+	}
+
 	amlogic_sdhc_init();
-	if (amlogic_sdhc_select_port(loc-loc_port) != 0) {
-		aprint_error(: couldn't select port %d\n, loc-loc_port);
+	if (amlogic_sdhc_select_port(sc-sc_port) != 0) {
+		aprint_error(: couldn't select port %d\n, sc-sc_port);
 		return;
 	}
 
 	aprint_naive(\n);
-	aprint_normal(: SDHC controller\n);
+	aprint_normal(: SDHC 

CVS commit: src/crypto/external/bsd/libsaslc/dist/src

2015-08-08 Thread Mateusz Kocielski
Module Name:src
Committed By:   shm
Date:   Sat Aug  8 10:38:35 UTC 2015

Modified Files:
src/crypto/external/bsd/libsaslc/dist/src: xsess.c

Log Message:
Fix various minor memory leaks on errors


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/crypto/external/bsd/libsaslc/dist/src/xsess.c

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/libsaslc/dist/src/xsess.c
diff -u src/crypto/external/bsd/libsaslc/dist/src/xsess.c:1.7 src/crypto/external/bsd/libsaslc/dist/src/xsess.c:1.8
--- src/crypto/external/bsd/libsaslc/dist/src/xsess.c:1.7	Fri Jun 28 15:04:35 2013
+++ src/crypto/external/bsd/libsaslc/dist/src/xsess.c	Sat Aug  8 10:38:35 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: xsess.c,v 1.7 2013/06/28 15:04:35 joerg Exp $ */
+/* $NetBSD: xsess.c,v 1.8 2015/08/08 10:38:35 shm Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: xsess.c,v 1.7 2013/06/28 15:04:35 joerg Exp $);
+__RCSID($NetBSD: xsess.c,v 1.8 2015/08/08 10:38:35 shm Exp $);
 
 #include assert.h
 #include saslc.h
@@ -556,8 +556,10 @@ saslc__sess_xxcode(saslc_sess_t *sess, s
 	ate = 0;
 	do {
 		len = xxcode(sess, in, inlen, pkt, pktlen);
-		if (len == -1)  /* error */
+		if (len == -1) {
+			free(buf);
 			return -1;
+		}
 
 		ate += len;
 		in = (const char *)in + len;
@@ -570,7 +572,10 @@ saslc__sess_xxcode(saslc_sess_t *sess, s
 			continue;
 
 		buflen += pktlen;
+		p = buf;
 		if ((buf = realloc(buf, buflen)) == NULL) {
+			/* we should free memory if realloc(2) failed */
+			free(p);
 			saslc__error_set_errno(ERR(sess), ERROR_NOMEM);
 			return -1;
 		}



CVS commit: src/sys/dev/sdmmc

2015-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug  8 10:50:55 UTC 2015

Modified Files:
src/sys/dev/sdmmc: sdmmc_mem.c sdmmcreg.h

Log Message:
eMMC fixes


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/sdmmc/sdmmc_mem.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/sdmmc/sdmmcreg.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/sdmmc/sdmmc_mem.c
diff -u src/sys/dev/sdmmc/sdmmc_mem.c:1.45 src/sys/dev/sdmmc/sdmmc_mem.c:1.46
--- src/sys/dev/sdmmc/sdmmc_mem.c:1.45	Wed Aug  5 10:29:37 2015
+++ src/sys/dev/sdmmc/sdmmc_mem.c	Sat Aug  8 10:50:55 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdmmc_mem.c,v 1.45 2015/08/05 10:29:37 jmcneill Exp $	*/
+/*	$NetBSD: sdmmc_mem.c,v 1.46 2015/08/08 10:50:55 jmcneill Exp $	*/
 /*	$OpenBSD: sdmmc_mem.c,v 1.10 2009/01/09 10:55:22 jsg Exp $	*/
 
 /*
@@ -45,7 +45,7 @@
 /* Routines for SD/MMC memory cards. */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sdmmc_mem.c,v 1.45 2015/08/05 10:29:37 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: sdmmc_mem.c,v 1.46 2015/08/08 10:50:55 jmcneill Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_sdmmc.h
@@ -204,13 +204,17 @@ mmc_mode:
 
 	host_ocr = card_ocr; /* only allow the common voltages */
 	if (!ISSET(sc-sc_caps, SMC_CAPS_SPI_MODE)) {
-		/* Check SD Ver.2 */
-		error = sdmmc_mem_send_if_cond(sc, 0x1aa, card_ocr);
-		if (error == 0  card_ocr == 0x1aa)
-			SET(ocr, MMC_OCR_HCS);
+		if (ISSET(sc-sc_flags, SMF_SD_MODE)) {
+			/* Check SD Ver.2 */
+			error = sdmmc_mem_send_if_cond(sc, 0x1aa, card_ocr);
+			if (error == 0  card_ocr == 0x1aa)
+SET(ocr, MMC_OCR_HCS);
 
-		if (sdmmc_chip_host_ocr(sc-sc_sct, sc-sc_sch)  MMC_OCR_S18A)
-			SET(ocr, MMC_OCR_S18A);
+			if (sdmmc_chip_host_ocr(sc-sc_sct, sc-sc_sch)  MMC_OCR_S18A)
+SET(ocr, MMC_OCR_S18A);
+		} else {
+			SET(ocr, MMC_OCR_ACCESS_MODE_SECTOR);
+		}
 	}
 	host_ocr |= ocr;
 
@@ -221,7 +225,7 @@ mmc_mode:
 		goto out;
 	}
 
-	if (ISSET(new_ocr, MMC_OCR_S18A)  sc-sc_sct-signal_voltage) {
+	if (ISSET(sc-sc_flags, SMF_SD_MODE)  ISSET(new_ocr, MMC_OCR_S18A)) {
 		/*
 		 * Card and host support low voltage mode, begin switch
 		 * sequence.
@@ -946,13 +950,6 @@ sdmmc_mem_mmc_init(struct sdmmc_softc *s
 			return ENOTSUP;
 		}
 
-		if (hs_timing == 2) {
-			error = sdmmc_chip_signal_voltage(sc-sc_sct,
-			sc-sc_sch, SDMMC_SIGNAL_VOLTAGE_180);
-			if (error)
-hs_timing = 1;
-		}
-
 		if (ISSET(sc-sc_caps, SMC_CAPS_8BIT_MODE)) {
 			width = 8;
 			value = EXT_CSD_BUS_WIDTH_8;
@@ -977,6 +974,7 @@ sdmmc_mem_mmc_init(struct sdmmc_softc *s
 			}
 
 			/* : need bus test? (using by CMD14  CMD19) */
+			delay(1);
 		}
 		sf-width = width;
 
@@ -989,7 +987,8 @@ sdmmc_mem_mmc_init(struct sdmmc_softc *s
 			EXT_CSD_HS_TIMING, hs_timing);
 			if (error) {
 aprint_error_dev(sc-sc_dev,
-can't change high speed\n);
+can't change high speed %d, error %d\n,
+hs_timing, error);
 return error;
 			}
 		}

Index: src/sys/dev/sdmmc/sdmmcreg.h
diff -u src/sys/dev/sdmmc/sdmmcreg.h:1.19 src/sys/dev/sdmmc/sdmmcreg.h:1.20
--- src/sys/dev/sdmmc/sdmmcreg.h:1.19	Wed Aug  5 10:29:37 2015
+++ src/sys/dev/sdmmc/sdmmcreg.h	Sat Aug  8 10:50:55 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdmmcreg.h,v 1.19 2015/08/05 10:29:37 jmcneill Exp $	*/
+/*	$NetBSD: sdmmcreg.h,v 1.20 2015/08/08 10:50:55 jmcneill Exp $	*/
 /*	$OpenBSD: sdmmcreg.h,v 1.4 2009/01/09 10:55:22 jsg Exp $	*/
 
 /*
@@ -70,7 +70,10 @@
 
 /* OCR bits */
 #define MMC_OCR_MEM_READY		(1U31)/* memory power-up status bit */
-#define MMC_OCR_HCS			(130)
+#define MMC_OCR_HCS			(130)	/* SD only */
+#define MMC_OCR_ACCESS_MODE_MASK	(329)	/* MMC only */
+#define MMC_OCR_ACCESS_MODE_BYTE	(029)	/* MMC only */
+#define MMC_OCR_ACCESS_MODE_SECTOR	(229)	/* MMC only */
 #define MMC_OCR_S18A			(124)
 #define MMC_OCR_3_5V_3_6V		(123)
 #define MMC_OCR_3_4V_3_5V		(122)



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

2015-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug  8 10:51:40 UTC 2015

Modified Files:
src/sys/arch/arm/amlogic: amlogic_board.c

Log Message:
don't rely on u-boot to setup CARD and BOOT pins


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/amlogic/amlogic_board.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/amlogic/amlogic_board.c
diff -u src/sys/arch/arm/amlogic/amlogic_board.c:1.13 src/sys/arch/arm/amlogic/amlogic_board.c:1.14
--- src/sys/arch/arm/amlogic/amlogic_board.c:1.13	Tue Aug  4 01:23:07 2015
+++ src/sys/arch/arm/amlogic/amlogic_board.c	Sat Aug  8 10:51:40 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: amlogic_board.c,v 1.13 2015/08/04 01:23:07 jmcneill Exp $ */
+/* $NetBSD: amlogic_board.c,v 1.14 2015/08/08 10:51:40 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill jmcne...@invisible.ca
@@ -29,7 +29,7 @@
 #include opt_amlogic.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: amlogic_board.c,v 1.13 2015/08/04 01:23:07 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: amlogic_board.c,v 1.14 2015/08/08 10:51:40 jmcneill Exp $);
 
 #define	_ARM32_BUS_DMA_PRIVATE
 #include sys/param.h
@@ -235,6 +235,11 @@ amlogic_sdhc_select_port(int port)
 {
 	switch (port) {
 	case AMLOGIC_SDHC_PORT_B:
+		/* Set CARD 0-5 to input */
+		CBUS_SET_CLEAR(PAD_PULL_UP_2_REG, 0x03f0, 0);
+		CBUS_SET_CLEAR(PAD_PULL_UP_EN_2_REG, 0x03f0, 0);
+		CBUS_SET_CLEAR(PREG_PAD_GPIO0_EN_N_REG, 0x0fc0, 0);
+
 		/* CARD - SDHC pin mux settings */
 		CBUS_SET_CLEAR(PERIPHS_PIN_MUX_5_REG, 0, 0x7c00);
 		CBUS_SET_CLEAR(PERIPHS_PIN_MUX_4_REG, 0, 0x7c00);
@@ -248,6 +253,11 @@ amlogic_sdhc_select_port(int port)
 		CBUS_SET_CLEAR(PREG_PAD_GPIO5_EN_N_REG, 0, 0x8000);
 		break;
 	case AMLOGIC_SDHC_PORT_C:
+		/* Set BOOT 0-8,10 to input */
+		CBUS_SET_CLEAR(PAD_PULL_UP_2_REG, 0x05ff, 0);
+		CBUS_SET_CLEAR(PAD_PULL_UP_EN_2_REG, 0x05ff, 0);
+		CBUS_SET_CLEAR(PREG_PAD_GPIO3_EN_N_REG, 0x05ff, 0);
+
 		/* BOOT - SDHC pin mux settings */
 		CBUS_SET_CLEAR(PERIPHS_PIN_MUX_2_REG, 0, 0x04c000f0);
 		CBUS_SET_CLEAR(PERIPHS_PIN_MUX_5_REG, 0, 0x7c00);
@@ -348,6 +358,11 @@ amlogic_sdio_select_port(int port)
 {
 	switch (port) {
 	case AMLOGIC_SDIO_PORT_B:
+		/* Set CARD 0-5 to input */
+		CBUS_SET_CLEAR(PAD_PULL_UP_2_REG, 0x03f0, 0);
+		CBUS_SET_CLEAR(PAD_PULL_UP_EN_2_REG, 0x03f0, 0);
+		CBUS_SET_CLEAR(PREG_PAD_GPIO0_EN_N_REG, 0x0fc0, 0);
+
 		/* CARD - SDIO pin mux settings */
 		CBUS_SET_CLEAR(PERIPHS_PIN_MUX_6_REG, 0, 0x3f00);
 		CBUS_SET_CLEAR(PERIPHS_PIN_MUX_8_REG, 0, 0x063f);
@@ -360,6 +375,13 @@ amlogic_sdio_select_port(int port)
 		CBUS_SET_CLEAR(PREG_PAD_GPIO5_EN_N_REG, 0, 0x8000);
 		break;
 	case AMLOGIC_SDIO_PORT_C:
+		delay(100);
+
+		/* Set BOOT 0-8,10 to input */
+		CBUS_SET_CLEAR(PAD_PULL_UP_2_REG, 0x050f, 0);
+		CBUS_SET_CLEAR(PAD_PULL_UP_EN_2_REG, 0x050f, 0);
+		CBUS_SET_CLEAR(PREG_PAD_GPIO3_EN_N_REG, 0x050f, 0);
+
 		/* BOOT - SDIO pin mux settings */
 		CBUS_SET_CLEAR(PERIPHS_PIN_MUX_2_REG, 0, 0x06c2fc00);
 		CBUS_SET_CLEAR(PERIPHS_PIN_MUX_8_REG, 0, 0x003f);



CVS commit: src/usr.bin/config

2015-08-08 Thread Mateusz Kocielski
Module Name:src
Committed By:   shm
Date:   Sat Aug  8 15:52:41 UTC 2015

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

Log Message:
Add missed munmap(2) in extract_config


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/usr.bin/config/main.c

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

Modified files:

Index: src/usr.bin/config/main.c
diff -u src/usr.bin/config/main.c:1.75 src/usr.bin/config/main.c:1.76
--- src/usr.bin/config/main.c:1.75	Tue Jun 16 21:12:19 2015
+++ src/usr.bin/config/main.c	Sat Aug  8 15:52:41 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.75 2015/06/16 21:12:19 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.76 2015/08/08 15:52:41 shm Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include sys/cdefs.h
-__RCSID($NetBSD: main.c,v 1.75 2015/06/16 21:12:19 christos Exp $);
+__RCSID($NetBSD: main.c,v 1.76 2015/08/08 15:52:41 shm Exp $);
 
 #ifndef MAKE_BOOTSTRAP
 #include sys/cdefs.h
@@ -1582,6 +1582,7 @@ static int
 extract_config(const char *kname, const char *cname, int cfd)
 {
 	char *ptr;
+	void *base;
 	int found, kfd;
 	struct stat st;
 	off_t i;
@@ -1594,10 +1595,11 @@ extract_config(const char *kname, const 
 		err(EXIT_FAILURE, cannot open %s, kname);
 	if (fstat(kfd, st) == -1)
 		err(EXIT_FAILURE, cannot stat %s, kname);
-	ptr = mmap(0, (size_t)st.st_size, PROT_READ, MAP_FILE | MAP_SHARED,
+	base = mmap(0, (size_t)st.st_size, PROT_READ, MAP_FILE | MAP_SHARED,
 	kfd, 0);
-	if (ptr == MAP_FAILED)
+	if (base == MAP_FAILED)
 		err(EXIT_FAILURE, cannot mmap %s, kname);
+	ptr = base;
 
 	/* Scan mmap(2)'ed region, extracting kernel configuration */
 	for (i = 0; i  st.st_size; i++) {
@@ -1629,7 +1631,8 @@ extract_config(const char *kname, const 
 	}
 
 	(void)close(kfd);
-
+	(void)munmap(base, (size_t)st.st_size);
+		
 	return found;
 }
 



CVS commit: src/doc

2015-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug  8 16:11:15 UTC 2015

Modified Files:
src/doc: CHANGES

Log Message:
note UHS-I and MMC HS200 support


To generate a diff of this commit:
cvs rdiff -u -r1.2088 -r1.2089 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.2088 src/doc/CHANGES:1.2089
--- src/doc/CHANGES:1.2088	Fri Aug  7 15:53:24 2015
+++ src/doc/CHANGES	Sat Aug  8 16:11:15 2015
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.2088 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.2089 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -176,3 +176,9 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 	bind: Import version 9.10.2-P3. [christos 20150728]
 	kernel: Several bug fixes and improvements in the PaX subsystem.
 		[maxv 20150804]
+	sdmmc(4): Add support for UHS-I and MMC HS200 transfer modes.
+		[jmcneill 20150808]
+	sdhc(4): Add support for UHS-I and MMC HS200 transfer modes.
+		[jmcneill 20150808]
+	amlogicsdhc(4): Add support for UHS-I and MMC HS200 transfer modes.
+		[jmcneill 20150808]



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

2015-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug  8 17:21:19 UTC 2015

Modified Files:
src/sys/arch/arm/allwinner: awin_mmc.c

Log Message:
don't need a full reset to recover from errors, only DMA and FIFO resets


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/allwinner/awin_mmc.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/allwinner/awin_mmc.c
diff -u src/sys/arch/arm/allwinner/awin_mmc.c:1.20 src/sys/arch/arm/allwinner/awin_mmc.c:1.21
--- src/sys/arch/arm/allwinner/awin_mmc.c:1.20	Sun Dec  7 20:10:59 2014
+++ src/sys/arch/arm/allwinner/awin_mmc.c	Sat Aug  8 17:21:19 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_mmc.c,v 1.20 2014/12/07 20:10:59 jmcneill Exp $ */
+/* $NetBSD: awin_mmc.c,v 1.21 2015/08/08 17:21:19 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill jmcne...@invisible.ca
@@ -29,7 +29,7 @@
 #include locators.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: awin_mmc.c,v 1.20 2014/12/07 20:10:59 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: awin_mmc.c,v 1.21 2015/08/08 17:21:19 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -976,7 +976,14 @@ done:
 #ifdef AWIN_MMC_DEBUG
 		aprint_error_dev(sc-sc_dev, i/o error %d\n, cmd-c_error);
 #endif
-		awin_mmc_host_reset(sc);
+		MMC_WRITE(sc, AWIN_MMC_GCTRL,
+		MMC_READ(sc, AWIN_MMC_GCTRL) |
+		  AWIN_MMC_GCTRL_DMARESET | AWIN_MMC_GCTRL_FIFORESET);
+		for (int retry = 0; retry  1000; retry++) {
+			if (!(MMC_READ(sc, AWIN_MMC_GCTRL)  AWIN_MMC_GCTRL_RESET))
+break;
+			delay(10);
+		}
 		awin_mmc_update_clock(sc);
 	}
 



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

2015-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug  8 10:56:55 UTC 2015

Modified Files:
src/sys/arch/evbarm/conf: ODROID-C1

Log Message:
Enable eMMC on the SDIO controller.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/evbarm/conf/ODROID-C1

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/ODROID-C1
diff -u src/sys/arch/evbarm/conf/ODROID-C1:1.18 src/sys/arch/evbarm/conf/ODROID-C1:1.19
--- src/sys/arch/evbarm/conf/ODROID-C1:1.18	Sat Apr 25 14:41:33 2015
+++ src/sys/arch/evbarm/conf/ODROID-C1	Sat Aug  8 10:56:55 2015
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: ODROID-C1,v 1.18 2015/04/25 14:41:33 jmcneill Exp $
+#	$NetBSD: ODROID-C1,v 1.19 2015/08/08 10:56:55 jmcneill Exp $
 #
 #	Hardkernel ODROID-C1 (Amlogic S805) based SBC (Single Board Computer)
 #
@@ -65,6 +65,8 @@ amlogicrtc0	at amlogicio0
 # SDHC controller
 amlogicsdhc0	at amlogicio0 port 1
 sdmmc*		at amlogicsdhc?
+amlogicsdio0	at amlogicio0 port 2
+sdmmc*		at amlogicsdio?
 ld*		at sdmmc?
 
 # Gigabit ethernet



CVS commit: src/sys/compat/osf1

2015-08-08 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Aug  8 12:02:35 UTC 2015

Modified Files:
src/sys/compat/osf1: osf1_socket.c

Log Message:
easy kmem_alloc(0)

ok shm@


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/compat/osf1/osf1_socket.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/compat/osf1/osf1_socket.c
diff -u src/sys/compat/osf1/osf1_socket.c:1.20 src/sys/compat/osf1/osf1_socket.c:1.21
--- src/sys/compat/osf1/osf1_socket.c:1.20	Fri Apr 23 15:19:21 2010
+++ src/sys/compat/osf1/osf1_socket.c	Sat Aug  8 12:02:35 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_socket.c,v 1.20 2010/04/23 15:19:21 rmind Exp $ */
+/* $NetBSD: osf1_socket.c,v 1.21 2015/08/08 12:02:35 maxv Exp $ */
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: osf1_socket.c,v 1.20 2010/04/23 15:19:21 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: osf1_socket.c,v 1.21 2015/08/08 12:02:35 maxv Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -116,7 +116,7 @@ osf1_sys_sendmsg_xopen(struct lwp *l, co
 		return (EINVAL);
 
 	iov_len = bsd_msghdr.msg_iovlen;
-	if (iov_len  IOV_MAX)
+	if ((iov_len  IOV_MAX) || (iov_len == 0))
 		return EMSGSIZE;
 	bsd_iovec = kmem_alloc(iov_len * sizeof(struct iovec), KM_SLEEP);
 	bsd_msghdr.msg_iov = bsd_iovec;



CVS commit: src/sys/dev/marvell

2015-08-08 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Aug  8 14:35:06 UTC 2015

Modified Files:
src/sys/dev/marvell: mvpexreg.h

Log Message:
Fix calculate to address for window register.
  Thanks knakahara@.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/marvell/mvpexreg.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/marvell/mvpexreg.h
diff -u src/sys/dev/marvell/mvpexreg.h:1.1 src/sys/dev/marvell/mvpexreg.h:1.2
--- src/sys/dev/marvell/mvpexreg.h:1.1	Tue Jul 13 11:16:02 2010
+++ src/sys/dev/marvell/mvpexreg.h	Sat Aug  8 14:35:06 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvpexreg.h,v 1.1 2010/07/13 11:16:02 kiyohara Exp $	*/
+/*	$NetBSD: mvpexreg.h,v 1.2 2015/08/08 14:35:06 kiyohara Exp $	*/
 /*
  * Copyright (c) 2008, 2009 KIYOHARA Takashi
  * All rights reserved.
@@ -72,8 +72,8 @@
 #define MVPEX_I_PEXLINKFAIL		(1  23)	/* Link Failure */
 #define MVPEX_I_PIN(p)		(1  (((p) - 1) + 24))
 /* PCI Express Address Window Control Registers */
-#define MVPEX_NWINDOW	6
-#define MVPEX_W_OFFSET(w)	((w  4) ? ((w)  4) : ((w - 4)  5) + 0x60)
+#define MVPEX_NWINDOW	6	/* Window 4 and 5 has Remap (High) Register */
+#define MVPEX_W_OFFSET(w)	((w  4) ? ((w)  4) : ((w - 4)  5) + 0x40)
 #define MVPEX_WC(x)		(0x1820 + MVPEX_W_OFFSET(x))	/* Win Ctrl */
 #define MVPEX_WC_WINEN		(1  0)
 #define MVPEX_WC_BARMAP_BAR1		(0  1)



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

2015-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug  8 14:48:41 UTC 2015

Modified Files:
src/sys/arch/arm/amlogic: amlogic_sdhc.c amlogic_sdio.c

Log Message:
hook up card detect gpio


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/amlogic/amlogic_sdhc.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/amlogic/amlogic_sdio.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/amlogic/amlogic_sdhc.c
diff -u src/sys/arch/arm/amlogic/amlogic_sdhc.c:1.9 src/sys/arch/arm/amlogic/amlogic_sdhc.c:1.10
--- src/sys/arch/arm/amlogic/amlogic_sdhc.c:1.9	Sat Aug  8 14:01:44 2015
+++ src/sys/arch/arm/amlogic/amlogic_sdhc.c	Sat Aug  8 14:48:41 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: amlogic_sdhc.c,v 1.9 2015/08/08 14:01:44 jmcneill Exp $ */
+/* $NetBSD: amlogic_sdhc.c,v 1.10 2015/08/08 14:48:41 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill jmcne...@invisible.ca
@@ -29,7 +29,7 @@
 #include locators.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: amlogic_sdhc.c,v 1.9 2015/08/08 14:01:44 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: amlogic_sdhc.c,v 1.10 2015/08/08 14:48:41 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -443,7 +443,9 @@ amlogic_sdhc_host_maxblklen(sdmmc_chipse
 static int
 amlogic_sdhc_card_detect(sdmmc_chipset_handle_t sch)
 {
-	return 1;
+	struct amlogic_sdhc_softc *sc = sch;
+
+	return amlogic_sdhc_is_card_present(sc-sc_port);
 }
 
 static int

Index: src/sys/arch/arm/amlogic/amlogic_sdio.c
diff -u src/sys/arch/arm/amlogic/amlogic_sdio.c:1.4 src/sys/arch/arm/amlogic/amlogic_sdio.c:1.5
--- src/sys/arch/arm/amlogic/amlogic_sdio.c:1.4	Sat Aug  8 14:01:44 2015
+++ src/sys/arch/arm/amlogic/amlogic_sdio.c	Sat Aug  8 14:48:41 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: amlogic_sdio.c,v 1.4 2015/08/08 14:01:44 jmcneill Exp $ */
+/* $NetBSD: amlogic_sdio.c,v 1.5 2015/08/08 14:48:41 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill jmcne...@invisible.ca
@@ -29,7 +29,7 @@
 #include locators.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: amlogic_sdio.c,v 1.4 2015/08/08 14:01:44 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: amlogic_sdio.c,v 1.5 2015/08/08 14:48:41 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -331,7 +331,9 @@ amlogic_sdio_host_maxblklen(sdmmc_chipse
 static int
 amlogic_sdio_card_detect(sdmmc_chipset_handle_t sch)
 {
-	return 1;
+	struct amlogic_sdio_softc *sc = sch;
+
+	return amlogic_sdhc_is_card_present(sc-sc_cur_port);
 }
 
 static int



CVS commit: [netbsd-7] src/sys/kern

2015-08-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug  8 15:45:47 UTC 2015

Modified Files:
src/sys/kern [netbsd-7]: uipc_syscalls.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #942):
sys/kern/uipc_syscalls.c: revision 1.179
Memory leak. Triggerable from an unprivileged user via COMPAT_43.


To generate a diff of this commit:
cvs rdiff -u -r1.172 -r1.172.2.1 src/sys/kern/uipc_syscalls.c

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

Modified files:

Index: src/sys/kern/uipc_syscalls.c
diff -u src/sys/kern/uipc_syscalls.c:1.172 src/sys/kern/uipc_syscalls.c:1.172.2.1
--- src/sys/kern/uipc_syscalls.c:1.172	Sat Aug  9 05:33:00 2014
+++ src/sys/kern/uipc_syscalls.c	Sat Aug  8 15:45:47 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_syscalls.c,v 1.172 2014/08/09 05:33:00 rtr Exp $	*/
+/*	$NetBSD: uipc_syscalls.c,v 1.172.2.1 2015/08/08 15:45:47 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uipc_syscalls.c,v 1.172 2014/08/09 05:33:00 rtr Exp $);
+__KERNEL_RCSID(0, $NetBSD: uipc_syscalls.c,v 1.172.2.1 2015/08/08 15:45:47 martin Exp $);
 
 #include opt_pipe.h
 
@@ -665,9 +665,16 @@ do_sys_sendmsg(struct lwp *l, int s, str
 	struct socket	*so;
 	file_t		*fp;
 
-	if ((error = fd_getsock1(s, so, fp)) != 0)
+	if ((error = fd_getsock1(s, so, fp)) != 0) {
+		/* We have to free msg_name and msg_control ourselves */
+		if (mp-msg_flags  MSG_NAMEMBUF)
+			m_freem(mp-msg_name);
+		if (mp-msg_flags  MSG_CONTROLMBUF)
+			m_freem(mp-msg_control);
 		return error;
+	}
 	error = do_sys_sendmsg_so(l, s, so, fp, mp, flags, retsize);
+	/* msg_name and msg_control freed */
 	fd_putfile(s);
 	return error;
 }



CVS commit: [netbsd-7] src/doc

2015-08-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug  8 15:46:48 UTC 2015

Modified Files:
src/doc [netbsd-7]: CHANGES-7.0

Log Message:
Ticket #942


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.361 -r1.1.2.362 src/doc/CHANGES-7.0

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-7.0
diff -u src/doc/CHANGES-7.0:1.1.2.361 src/doc/CHANGES-7.0:1.1.2.362
--- src/doc/CHANGES-7.0:1.1.2.361	Sat Aug  8 15:43:00 2015
+++ src/doc/CHANGES-7.0	Sat Aug  8 15:46:48 2015
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0,v 1.1.2.361 2015/08/08 15:43:00 martin Exp $
+# $NetBSD: CHANGES-7.0,v 1.1.2.362 2015/08/08 15:46:48 martin Exp $
 
 A complete list of changes from the initial NetBSD 7.0 branch on 11 Aug 2014
 until the 7.0 release:
@@ -33871,3 +33871,8 @@ sys/compat/netbsd32/netbsd32_socket.c		1
 	Memory leak, triggerable from an unprivileged user.
 	[maxv, ticket #941]
 
+sys/kern/uipc_syscalls.c			1.179
+
+	Memory leak. Triggerable from an unprivileged user via COMPAT_43.
+	[maxv, ticket #942]
+



CVS commit: src/external/mit/xorg

2015-08-08 Thread Aymeric Vincent
Module Name:src
Committed By:   aymeric
Date:   Sat Aug  8 22:26:59 UTC 2015

Modified Files:
src/external/mit/xorg: xorg-pkg-ver.mk

Log Message:
Fix bracket expressions by moving '-' to the end of them. GNU awk choked.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/mit/xorg/xorg-pkg-ver.mk

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

Modified files:

Index: src/external/mit/xorg/xorg-pkg-ver.mk
diff -u src/external/mit/xorg/xorg-pkg-ver.mk:1.5 src/external/mit/xorg/xorg-pkg-ver.mk:1.6
--- src/external/mit/xorg/xorg-pkg-ver.mk:1.5	Wed Jul 22 07:58:00 2015
+++ src/external/mit/xorg/xorg-pkg-ver.mk	Sat Aug  8 22:26:59 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: xorg-pkg-ver.mk,v 1.5 2015/07/22 07:58:00 mrg Exp $
+#	$NetBSD: xorg-pkg-ver.mk,v 1.6 2015/08/08 22:26:59 aymeric Exp $
 
 # when including this make sure PROG is set so that $X11SRCDIR.$PROG
 # is a valid setting.  set XORG_PKG_VER_PROG if PROG is wrong.
@@ -24,7 +24,7 @@ CPPFLAGS+=	-DVERSION=\${XORG_PKG_PACKAG
 
 XORG_PKG_PACKAGE_STRING!= \
 	awk -F= '/^PACKAGE_STRING=/ {\
-	 match($$2, [a-zA-Z-_]+[ 	]+([0-9]+\\.)+[0-9]+);	\
+	 match($$2, [a-zA-Z_-]+[ 	]+([0-9]+\\.)+[0-9]+);	\
 	 string = substr($$2, RSTART, RLENGTH);		\
 	 print string;	\
 	 exit 0;		\
@@ -35,7 +35,7 @@ CPPFLAGS+=	-DPACKAGE_STRING=\${XORG_PKG
 
 XORG_PKG_PACKAGE_NAME!= \
 	awk -F= '/^PACKAGE_NAME=/ {\
-	 match($$2, '''[a-zA-Z-_0-9]+''');		\
+	 match($$2, '''[a-zA-Z0-9_-]+''');		\
 	 name = substr($$2, RSTART, RLENGTH);		\
 	 print name;	\
 	 exit 0;		\



CVS commit: src/external/mit/xorg

2015-08-08 Thread Aymeric Vincent
Module Name:src
Committed By:   aymeric
Date:   Sat Aug  8 23:06:36 UTC 2015

Modified Files:
src/external/mit/xorg: xorg-pkg-ver.mk

Log Message:
Move dashes to the front of bracket expressions. Suggested by dholland@.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/mit/xorg/xorg-pkg-ver.mk

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

Modified files:

Index: src/external/mit/xorg/xorg-pkg-ver.mk
diff -u src/external/mit/xorg/xorg-pkg-ver.mk:1.6 src/external/mit/xorg/xorg-pkg-ver.mk:1.7
--- src/external/mit/xorg/xorg-pkg-ver.mk:1.6	Sat Aug  8 22:26:59 2015
+++ src/external/mit/xorg/xorg-pkg-ver.mk	Sat Aug  8 23:06:36 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: xorg-pkg-ver.mk,v 1.6 2015/08/08 22:26:59 aymeric Exp $
+#	$NetBSD: xorg-pkg-ver.mk,v 1.7 2015/08/08 23:06:36 aymeric Exp $
 
 # when including this make sure PROG is set so that $X11SRCDIR.$PROG
 # is a valid setting.  set XORG_PKG_VER_PROG if PROG is wrong.
@@ -24,7 +24,7 @@ CPPFLAGS+=	-DVERSION=\${XORG_PKG_PACKAG
 
 XORG_PKG_PACKAGE_STRING!= \
 	awk -F= '/^PACKAGE_STRING=/ {\
-	 match($$2, [a-zA-Z_-]+[ 	]+([0-9]+\\.)+[0-9]+);	\
+	 match($$2, [-_a-zA-Z]+[ 	]+([0-9]+\\.)+[0-9]+);	\
 	 string = substr($$2, RSTART, RLENGTH);		\
 	 print string;	\
 	 exit 0;		\
@@ -35,7 +35,7 @@ CPPFLAGS+=	-DPACKAGE_STRING=\${XORG_PKG
 
 XORG_PKG_PACKAGE_NAME!= \
 	awk -F= '/^PACKAGE_NAME=/ {\
-	 match($$2, '''[a-zA-Z0-9_-]+''');		\
+	 match($$2, '''[-_a-zA-Z0-9]+''');		\
 	 name = substr($$2, RSTART, RLENGTH);		\
 	 print name;	\
 	 exit 0;		\



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

2015-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug  8 10:51:50 UTC 2015

Modified Files:
src/sys/arch/arm/amlogic: amlogic_sdhc.c

Log Message:
advertise HS200 support


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/amlogic/amlogic_sdhc.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/amlogic/amlogic_sdhc.c
diff -u src/sys/arch/arm/amlogic/amlogic_sdhc.c:1.7 src/sys/arch/arm/amlogic/amlogic_sdhc.c:1.8
--- src/sys/arch/arm/amlogic/amlogic_sdhc.c:1.7	Tue Aug  4 01:23:07 2015
+++ src/sys/arch/arm/amlogic/amlogic_sdhc.c	Sat Aug  8 10:51:50 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: amlogic_sdhc.c,v 1.7 2015/08/04 01:23:07 jmcneill Exp $ */
+/* $NetBSD: amlogic_sdhc.c,v 1.8 2015/08/08 10:51:50 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill jmcne...@invisible.ca
@@ -29,7 +29,7 @@
 #include locators.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: amlogic_sdhc.c,v 1.7 2015/08/04 01:23:07 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: amlogic_sdhc.c,v 1.8 2015/08/08 10:51:50 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -196,6 +196,7 @@ amlogic_sdhc_attach_i(device_t self)
 		   SMC_CAPS_MMC_HIGHSPEED|
 		   SMC_CAPS_UHS_SDR50|
 		   SMC_CAPS_UHS_SDR104|
+		   SMC_CAPS_MMC_HS200|
 		   SMC_CAPS_AUTO_STOP;
 
 	sc-sc_sdmmc_dev = config_found(self, saa, NULL);



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

2015-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug  8 10:55:14 UTC 2015

Modified Files:
src/sys/arch/arm/amlogic: amlogic_sdio.c

Log Message:
set max clock to ref freq


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/amlogic/amlogic_sdio.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/amlogic/amlogic_sdio.c
diff -u src/sys/arch/arm/amlogic/amlogic_sdio.c:1.2 src/sys/arch/arm/amlogic/amlogic_sdio.c:1.3
--- src/sys/arch/arm/amlogic/amlogic_sdio.c:1.2	Sun Apr 19 23:12:21 2015
+++ src/sys/arch/arm/amlogic/amlogic_sdio.c	Sat Aug  8 10:55:14 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: amlogic_sdio.c,v 1.2 2015/04/19 23:12:21 jmcneill Exp $ */
+/* $NetBSD: amlogic_sdio.c,v 1.3 2015/08/08 10:55:14 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill jmcne...@invisible.ca
@@ -29,7 +29,7 @@
 #include locators.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: amlogic_sdio.c,v 1.2 2015/04/19 23:12:21 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: amlogic_sdio.c,v 1.3 2015/08/08 10:55:14 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -186,7 +186,7 @@ amlogic_sdio_attach_i(device_t self)
 	saa.saa_dmat = sc-sc_dmat;
 	saa.saa_sch = sc;
 	saa.saa_clkmin = 400;
-	saa.saa_clkmax = 5;
+	saa.saa_clkmax = sc-sc_bus_freq;
 	/* Do not advertise DMA capabilities, we handle DMA ourselves */
 	saa.saa_caps = SMC_CAPS_4BIT_MODE|
 		   SMC_CAPS_SD_HIGHSPEED|



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

2015-08-08 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Aug  8 23:30:16 UTC 2015

Modified Files:
src/sys/arch/arm/allwinner: awin_com.c awin_reg.h

Log Message:
fix attachment of non-console UARTs and ensure the UART clock is running


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/allwinner/awin_com.c
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/arm/allwinner/awin_reg.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/allwinner/awin_com.c
diff -u src/sys/arch/arm/allwinner/awin_com.c:1.9 src/sys/arch/arm/allwinner/awin_com.c:1.10
--- src/sys/arch/arm/allwinner/awin_com.c:1.9	Sun Dec  7 12:44:24 2014
+++ src/sys/arch/arm/allwinner/awin_com.c	Sat Aug  8 23:30:16 2015
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: awin_com.c,v 1.9 2014/12/07 12:44:24 jmcneill Exp $);
+__KERNEL_RCSID(1, $NetBSD: awin_com.c,v 1.10 2015/08/08 23:30:16 tnn Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -130,7 +130,28 @@ awin_com_match(device_t parent, cfdata_t
 	awin_gpio_pinset_acquire(pinset);
 
 	bus_space_subregion(iot, aio-aio_core_bsh,
-	loc-loc_offset, loc-loc_size, bsh);
+	loc-loc_offset / 4, loc-loc_size, bsh);
+
+	/*
+	 * Clock gating, soft reset
+	 */
+	if (awin_chip_id() == AWIN_CHIP_ID_A80) {
+		awin_reg_set_clear(aio-aio_core_bst, aio-aio_ccm_bsh,
+		AWIN_A80_CCU_SCLK_BUS_CLK_GATING4_REG,
+		AWIN_A80_CCU_SCLK_BUS_CLK_GATING4_UART0  loc-loc_port, 0);
+		awin_reg_set_clear(aio-aio_core_bst, aio-aio_ccm_bsh,
+		AWIN_A80_CCU_SCLK_BUS_SOFT_RST4_REG,
+		AWIN_A80_CCU_SCLK_BUS_SOFT_RST4_UART0  loc-loc_port, 0);
+	} else {
+		awin_reg_set_clear(aio-aio_core_bst, aio-aio_ccm_bsh,
+		   AWIN_APB1_GATING_REG,
+		   AWIN_APB_GATING1_UART0  loc-loc_port, 0);
+		if (awin_chip_id() == AWIN_CHIP_ID_A31) {
+			awin_reg_set_clear(aio-aio_core_bst, aio-aio_ccm_bsh,
+			AWIN_A31_APB2_RESET_REG,
+			AWIN_A31_APB2_RESET_UART0_RST  loc-loc_port, 0);
+		}
+	}
 
 	const int rv = comprobe1(iot, bsh);
 

Index: src/sys/arch/arm/allwinner/awin_reg.h
diff -u src/sys/arch/arm/allwinner/awin_reg.h:1.78 src/sys/arch/arm/allwinner/awin_reg.h:1.79
--- src/sys/arch/arm/allwinner/awin_reg.h:1.78	Wed Jun  3 12:22:41 2015
+++ src/sys/arch/arm/allwinner/awin_reg.h	Sat Aug  8 23:30:16 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_reg.h,v 1.78 2015/06/03 12:22:41 skrll Exp $ */
+/* $NetBSD: awin_reg.h,v 1.79 2015/08/08 23:30:16 tnn Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -2416,6 +2416,13 @@ struct awin_mmc_idma_descriptor {
 #define AWIN_A31_APB1_RESET_DIGITAL_MIC_RST	__BIT(4)
 #define AWIN_A31_APB1_RESET_CODEC_RST		__BIT(0)
 
+#define AWIN_A31_APB2_RESET_UART5_RST		__BIT(21)
+#define AWIN_A31_APB2_RESET_UART4_RST		__BIT(20)
+#define AWIN_A31_APB2_RESET_UART3_RST		__BIT(19)
+#define AWIN_A31_APB2_RESET_UART2_RST		__BIT(18)
+#define AWIN_A31_APB2_RESET_UART1_RST		__BIT(17)
+#define AWIN_A31_APB2_RESET_UART0_RST		__BIT(16)
+
 #define AWIN_A31_APB2_RESET_TWI3_RST		__BIT(3)
 #define AWIN_A31_APB2_RESET_TWI2_RST		__BIT(2)
 #define AWIN_A31_APB2_RESET_TWI1_RST		__BIT(1)
@@ -2786,6 +2793,13 @@ struct awin_a31_dma_desc {
 #define AWIN_A80_CCU_SCLK_BUS_CLK_GATING1_GMAC	__BIT(17)
 #define AWIN_A80_CCU_SCLK_BUS_CLK_GATING1_USB_HOST __BIT(1)
 
+#define AWIN_A80_CCU_SCLK_BUS_CLK_GATING4_UART5	__BIT(21)
+#define AWIN_A80_CCU_SCLK_BUS_CLK_GATING4_UART4	__BIT(20)
+#define AWIN_A80_CCU_SCLK_BUS_CLK_GATING4_UART3	__BIT(19)
+#define AWIN_A80_CCU_SCLK_BUS_CLK_GATING4_UART2	__BIT(18)
+#define AWIN_A80_CCU_SCLK_BUS_CLK_GATING4_UART1	__BIT(17)
+#define AWIN_A80_CCU_SCLK_BUS_CLK_GATING4_UART0	__BIT(16)
+
 #define AWIN_A80_CCU_SCLK_BUS_CLK_GATING4_TWI4	__BIT(4)
 #define AWIN_A80_CCU_SCLK_BUS_CLK_GATING4_TWI2	__BIT(3)
 #define AWIN_A80_CCU_SCLK_BUS_CLK_GATING4_TWI3	__BIT(2)
@@ -2798,6 +2812,13 @@ struct awin_a31_dma_desc {
 #define AWIN_A80_CCU_SCLK_BUS_SOFT_RST1_GMAC	__BIT(17)
 #define AWIN_A80_CCU_SCLK_BUS_SOFT_RST1_USB_DRD	__BIT(1)
 
+#define AWIN_A80_CCU_SCLK_BUS_SOFT_RST4_UART5	__BIT(21)
+#define AWIN_A80_CCU_SCLK_BUS_SOFT_RST4_UART4	__BIT(20)
+#define AWIN_A80_CCU_SCLK_BUS_SOFT_RST4_UART3	__BIT(19)
+#define AWIN_A80_CCU_SCLK_BUS_SOFT_RST4_UART2	__BIT(18)
+#define AWIN_A80_CCU_SCLK_BUS_SOFT_RST4_UART1	__BIT(17)
+#define AWIN_A80_CCU_SCLK_BUS_SOFT_RST4_UART0	__BIT(16)
+
 #define AWIN_A80_CCU_SCLK_BUS_SOFT_RST4_TWI4	__BIT(4)
 #define AWIN_A80_CCU_SCLK_BUS_SOFT_RST4_TWI3	__BIT(3)
 #define AWIN_A80_CCU_SCLK_BUS_SOFT_RST4_TWI2	__BIT(2)



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

2015-08-08 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Aug  8 23:32:22 UTC 2015

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

Log Message:
add commented out entries for com ports that are physically routed


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbarm/conf/BPI

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/BPI
diff -u src/sys/arch/evbarm/conf/BPI:1.14 src/sys/arch/evbarm/conf/BPI:1.15
--- src/sys/arch/evbarm/conf/BPI:1.14	Tue Apr 21 04:24:51 2015
+++ src/sys/arch/evbarm/conf/BPI	Sat Aug  8 23:32:22 2015
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: BPI,v 1.14 2015/04/21 04:24:51 matt Exp $
+#	$NetBSD: BPI,v 1.15 2015/08/08 23:32:22 tnn Exp $
 #
 #	BPI -- Banana Pi - an Allwinner A20 Eval Board Kernel
 #
@@ -234,6 +234,8 @@ iic*		at awiniic?
 # On-board 16550 UARTs
 com0		at awinio? port 0			# UART0 (console)
 options 	CONADDR=0x01c28000, CONSPEED=115200
+#com1		at awinio? port 3	# CON3: rx = pin 10, tx = pin 8
+#com2		at awinio? port 7	#  J12: rx = pin  4, tx = pin 6
 
 # Consumer IR
 awinir0		at awinio?



CVS commit: src/doc

2015-08-08 Thread Ryosuke Moro
Module Name:src
Committed By:   szptvlfn
Date:   Sun Aug  9 05:45:42 UTC 2015

Modified Files:
src/doc: 3RDPARTY

Log Message:
typo


To generate a diff of this commit:
cvs rdiff -u -r1.1240 -r1.1241 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1240 src/doc/3RDPARTY:1.1241
--- src/doc/3RDPARTY:1.1240	Thu Aug  6 10:22:34 2015
+++ src/doc/3RDPARTY	Sun Aug  9 05:45:42 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1240 2015/08/06 10:22:34 wiz Exp $
+#	$NetBSD: 3RDPARTY,v 1.1241 2015/08/09 05:45:42 szptvlfn Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1256,7 +1256,7 @@ Responsible:	joerg
 License:	Public domain
 Location:	external/public-domain/sqlite/dist
 Notes:
-Run cleantags before inporting because sqlite3.c has an RCSID
+Run cleantags before importing because sqlite3.c has an RCSID
 
 Package:	tcpdump
 Version:	4.7.3



CVS commit: src/sys/kern

2015-08-08 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Aug  8 06:24:40 UTC 2015

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

Log Message:
revert; but still fix the comment


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/kern/exec_elf.c

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

Modified files:

Index: src/sys/kern/exec_elf.c
diff -u src/sys/kern/exec_elf.c:1.75 src/sys/kern/exec_elf.c:1.76
--- src/sys/kern/exec_elf.c:1.75	Wed Aug  5 15:58:01 2015
+++ src/sys/kern/exec_elf.c	Sat Aug  8 06:24:40 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_elf.c,v 1.75 2015/08/05 15:58:01 maxv Exp $	*/
+/*	$NetBSD: exec_elf.c,v 1.76 2015/08/08 06:24:40 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1994, 2000, 2005 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(1, $NetBSD: exec_elf.c,v 1.75 2015/08/05 15:58:01 maxv Exp $);
+__KERNEL_RCSID(1, $NetBSD: exec_elf.c,v 1.76 2015/08/08 06:24:40 maxv Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_pax.h
@@ -646,7 +646,7 @@ exec_elf_makecmds(struct lwp *l, struct 
 		return error;
 
 	if (eh-e_type == ET_DYN)
-		/* PIE */
+		/* PIE, and some libs have an entry point */
 		is_dyn = true;
 	else if (eh-e_type != ET_EXEC)
 		return ENOEXEC;
@@ -692,12 +692,6 @@ exec_elf_makecmds(struct lwp *l, struct 
 		}
 	}
 
-	if (is_dyn  (interp == NULL)) {
-		/* PIEs must have an interpreter */
-		error = ENOEXEC;
-		goto bad;
-	}
-
 	/*
 	 * On the same architecture, we may be emulating different systems.
 	 * See which one will accept this executable.



CVS commit: src/sys/arch

2015-08-08 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Aug  8 06:36:26 UTC 2015

Modified Files:
src/sys/arch/alpha/conf: GENERIC
src/sys/arch/amd64/conf: ALL GENERIC XEN3_DOM0
src/sys/arch/arc/conf: GENERIC
src/sys/arch/bebox/conf: GENERIC
src/sys/arch/cats/conf: GENERIC INSTALL
src/sys/arch/cobalt/conf: GENERIC
src/sys/arch/evbarm/conf: CUBOX-I GUMSTIX HPT5325
src/sys/arch/hp300/conf: GENERIC
src/sys/arch/hpcsh/conf: GENERIC
src/sys/arch/landisk/conf: GENERIC
src/sys/arch/mac68k/conf: GENERIC
src/sys/arch/netwinder/conf: GENERIC
src/sys/arch/news68k/conf: GENERIC
src/sys/arch/next68k/conf: GENERIC
src/sys/arch/rs6000/conf: GENERIC
src/sys/arch/sgimips/conf: GENERIC32_IP12
src/sys/arch/shark/conf: GENERIC
src/sys/arch/vax/conf: GENERIC VAX780
src/sys/arch/x68k/conf: GENERIC

Log Message:
Remove KMEMSTATS.


To generate a diff of this commit:
cvs rdiff -u -r1.364 -r1.365 src/sys/arch/alpha/conf/GENERIC
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.413 -r1.414 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.184 -r1.185 src/sys/arch/arc/conf/GENERIC
cvs rdiff -u -r1.145 -r1.146 src/sys/arch/bebox/conf/GENERIC
cvs rdiff -u -r1.155 -r1.156 src/sys/arch/cats/conf/GENERIC
cvs rdiff -u -r1.94 -r1.95 src/sys/arch/cats/conf/INSTALL
cvs rdiff -u -r1.147 -r1.148 src/sys/arch/cobalt/conf/GENERIC
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/CUBOX-I
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/evbarm/conf/GUMSTIX
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/evbarm/conf/HPT5325
cvs rdiff -u -r1.190 -r1.191 src/sys/arch/hp300/conf/GENERIC
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/hpcsh/conf/GENERIC
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/landisk/conf/GENERIC
cvs rdiff -u -r1.220 -r1.221 src/sys/arch/mac68k/conf/GENERIC
cvs rdiff -u -r1.126 -r1.127 src/sys/arch/netwinder/conf/GENERIC
cvs rdiff -u -r1.125 -r1.126 src/sys/arch/news68k/conf/GENERIC
cvs rdiff -u -r1.139 -r1.140 src/sys/arch/next68k/conf/GENERIC
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/rs6000/conf/GENERIC
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/sgimips/conf/GENERIC32_IP12
cvs rdiff -u -r1.121 -r1.122 src/sys/arch/shark/conf/GENERIC
cvs rdiff -u -r1.195 -r1.196 src/sys/arch/vax/conf/GENERIC
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/vax/conf/VAX780
cvs rdiff -u -r1.179 -r1.180 src/sys/arch/x68k/conf/GENERIC

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

Modified files:

Index: src/sys/arch/alpha/conf/GENERIC
diff -u src/sys/arch/alpha/conf/GENERIC:1.364 src/sys/arch/alpha/conf/GENERIC:1.365
--- src/sys/arch/alpha/conf/GENERIC:1.364	Tue Jan  6 17:50:24 2015
+++ src/sys/arch/alpha/conf/GENERIC	Sat Aug  8 06:36:24 2015
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.364 2015/01/06 17:50:24 macallan Exp $
+# $NetBSD: GENERIC,v 1.365 2015/08/08 06:36:24 maxv Exp $
 #
 # This machine description file is used to generate the default NetBSD
 # kernel.
@@ -19,7 +19,7 @@ include 	arch/alpha/conf/std.alpha
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-ident		GENERIC-$Revision: 1.364 $
+ident		GENERIC-$Revision: 1.365 $
 
 maxusers 32
 
@@ -56,7 +56,6 @@ options 	NTP			# kernel PLL for NTP
 # Diagnostic/debugging support options
 #options 	DIAGNOSTIC		# Cheap kernel consistency checks
 #options 	DEBUG			# Expensive debugging checks/support
-#options 	KMEMSTATS		# Collect kmem usage statistics
 options 	DDB			# kernel debugger
 options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB
 #makeoptions	DEBUG=-g

Index: src/sys/arch/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.29 src/sys/arch/amd64/conf/ALL:1.30
--- src/sys/arch/amd64/conf/ALL:1.29	Sun May  3 02:52:50 2015
+++ src/sys/arch/amd64/conf/ALL	Sat Aug  8 06:36:24 2015
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.29 2015/05/03 02:52:50 pgoyette Exp $
+# $NetBSD: ALL,v 1.30 2015/08/08 06:36:24 maxv Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	arch/amd64/conf/std.amd64
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		ALL-$Revision: 1.29 $
+#ident 		ALL-$Revision: 1.30 $
 
 maxusers	64		# estimated number of users
 
@@ -112,7 +112,6 @@ options 	BUFQ_PRIOCSCAN
 options 	DIAGNOSTIC	# inexpensive kernel consistency checks
 options 	DEBUG		# expensive debugging checks/support
 options 	LOCKDEBUG	# expensive locking checks/support
-options 	KMEMSTATS	# kernel memory statistics (vmstat -m)
 options 	DDB		# in-kernel debugger
 options 	DDB_ONPANIC=1	# see also sysctl(7): `ddb.onpanic'
 options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.413 src/sys/arch/amd64/conf/GENERIC:1.414
--- 

CVS commit: src/sbin/drvctl

2015-08-08 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Aug  8 07:52:52 UTC 2015

Modified Files:
src/sbin/drvctl: drvctl.8

Log Message:
add an example for rescanning ATA busses.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sbin/drvctl/drvctl.8

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

Modified files:

Index: src/sbin/drvctl/drvctl.8
diff -u src/sbin/drvctl/drvctl.8:1.16 src/sbin/drvctl/drvctl.8:1.17
--- src/sbin/drvctl/drvctl.8:1.16	Wed May 13 07:28:49 2015
+++ src/sbin/drvctl/drvctl.8	Sat Aug  8 07:52:52 2015
@@ -1,4 +1,4 @@
-.\ $NetBSD: drvctl.8,v 1.16 2015/05/13 07:28:49 mlelstv Exp $
+.\ $NetBSD: drvctl.8,v 1.17 2015/08/08 07:52:52 mrg Exp $
 .\
 .\ Copyright (c) 2004
 .\ 	Matthias Drochner.  All rights reserved.
@@ -24,7 +24,7 @@
 .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\ SUCH DAMAGE.
 .\
-.Dd February 25, 2015
+.Dd August 8, 2015
 .Dt DRVCTL 8
 .Os
 .Sh NAME
@@ -148,6 +148,15 @@ output.
 .El
 .Sh FILES
 .Pa /dev/drvctl
+.Sh EXAMPLES
+To scan for IDE/SATA/eSATA disks on
+.Pa atabus1 ,
+which need to use the
+.Qq ata_hl
+attribute:
+.Bd -literal -offset indent
+# drvctl -r -a ata_hl atabus1
+.Ed
 .Sh SEE ALSO
 .Xr proplib 3 ,
 .Xr drvctl 4 ,



CVS commit: src/sys/kern

2015-08-08 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Aug  8 07:53:51 UTC 2015

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

Log Message:
KASSERT that magic pointers NOCRED and FSCRED are not dereferenced.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/kern/kern_auth.c

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

Modified files:

Index: src/sys/kern/kern_auth.c
diff -u src/sys/kern/kern_auth.c:1.73 src/sys/kern/kern_auth.c:1.74
--- src/sys/kern/kern_auth.c:1.73	Mon Mar 18 19:35:42 2013
+++ src/sys/kern/kern_auth.c	Sat Aug  8 07:53:51 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_auth.c,v 1.73 2013/03/18 19:35:42 plunky Exp $ */
+/* $NetBSD: kern_auth.c,v 1.74 2015/08/08 07:53:51 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Elad Efrat e...@netbsd.org
@@ -28,7 +28,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_auth.c,v 1.73 2013/03/18 19:35:42 plunky Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_auth.c,v 1.74 2015/08/08 07:53:51 mlelstv Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -154,6 +154,8 @@ void
 kauth_cred_hold(kauth_cred_t cred)
 {
 	KASSERT(cred != NULL);
+	KASSERT(cred != NOCRED);
+	KASSERT(cred != FSCRED);
 	KASSERT(cred-cr_refcnt  0);
 
 	atomic_inc_uint(cred-cr_refcnt);
@@ -165,6 +167,8 @@ kauth_cred_free(kauth_cred_t cred)
 {
 
 	KASSERT(cred != NULL);
+	KASSERT(cred != NOCRED);
+	KASSERT(cred != FSCRED);
 	KASSERT(cred-cr_refcnt  0);
 	ASSERT_SLEEPABLE();
 
@@ -180,7 +184,11 @@ static void
 kauth_cred_clone1(kauth_cred_t from, kauth_cred_t to, bool copy_groups)
 {
 	KASSERT(from != NULL);
+	KASSERT(from != NOCRED);
+	KASSERT(from != FSCRED);
 	KASSERT(to != NULL);
+	KASSERT(to != NOCRED);
+	KASSERT(to != FSCRED);
 	KASSERT(from-cr_refcnt  0);
 
 	to-cr_uid = from-cr_uid;
@@ -212,6 +220,8 @@ kauth_cred_dup(kauth_cred_t cred)
 	kauth_cred_t new_cred;
 
 	KASSERT(cred != NULL);
+	KASSERT(cred != NOCRED);
+	KASSERT(cred != FSCRED);
 	KASSERT(cred-cr_refcnt  0);
 
 	new_cred = kauth_cred_alloc();
@@ -231,6 +241,8 @@ kauth_cred_copy(kauth_cred_t cred)
 	kauth_cred_t new_cred;
 
 	KASSERT(cred != NULL);
+	KASSERT(cred != NOCRED);
+	KASSERT(cred != FSCRED);
 	KASSERT(cred-cr_refcnt  0);
 
 	/* If the provided credentials already have one reference, use them. */
@@ -270,6 +282,8 @@ uid_t
 kauth_cred_getuid(kauth_cred_t cred)
 {
 	KASSERT(cred != NULL);
+	KASSERT(cred != NOCRED);
+	KASSERT(cred != FSCRED);
 
 	return (cred-cr_uid);
 }
@@ -278,6 +292,8 @@ uid_t
 kauth_cred_geteuid(kauth_cred_t cred)
 {
 	KASSERT(cred != NULL);
+	KASSERT(cred != NOCRED);
+	KASSERT(cred != FSCRED);
 
 	return (cred-cr_euid);
 }
@@ -286,6 +302,8 @@ uid_t
 kauth_cred_getsvuid(kauth_cred_t cred)
 {
 	KASSERT(cred != NULL);
+	KASSERT(cred != NOCRED);
+	KASSERT(cred != FSCRED);
 
 	return (cred-cr_svuid);
 }
@@ -294,6 +312,8 @@ gid_t
 kauth_cred_getgid(kauth_cred_t cred)
 {
 	KASSERT(cred != NULL);
+	KASSERT(cred != NOCRED);
+	KASSERT(cred != FSCRED);
 
 	return (cred-cr_gid);
 }
@@ -302,6 +322,8 @@ gid_t
 kauth_cred_getegid(kauth_cred_t cred)
 {
 	KASSERT(cred != NULL);
+	KASSERT(cred != NOCRED);
+	KASSERT(cred != FSCRED);
 
 	return (cred-cr_egid);
 }
@@ -310,6 +332,8 @@ gid_t
 kauth_cred_getsvgid(kauth_cred_t cred)
 {
 	KASSERT(cred != NULL);
+	KASSERT(cred != NOCRED);
+	KASSERT(cred != FSCRED);
 
 	return (cred-cr_svgid);
 }
@@ -318,6 +342,8 @@ void
 kauth_cred_setuid(kauth_cred_t cred, uid_t uid)
 {
 	KASSERT(cred != NULL);
+	KASSERT(cred != NOCRED);
+	KASSERT(cred != FSCRED);
 	KASSERT(cred-cr_refcnt == 1);
 
 	cred-cr_uid = uid;
@@ -327,6 +353,8 @@ void
 kauth_cred_seteuid(kauth_cred_t cred, uid_t uid)
 {
 	KASSERT(cred != NULL);
+	KASSERT(cred != NOCRED);
+	KASSERT(cred != FSCRED);
 	KASSERT(cred-cr_refcnt == 1);
 
 	cred-cr_euid = uid;
@@ -336,6 +364,8 @@ void
 kauth_cred_setsvuid(kauth_cred_t cred, uid_t uid)
 {
 	KASSERT(cred != NULL);
+	KASSERT(cred != NOCRED);
+	KASSERT(cred != FSCRED);
 	KASSERT(cred-cr_refcnt == 1);
 
 	cred-cr_svuid = uid;
@@ -345,6 +375,8 @@ void
 kauth_cred_setgid(kauth_cred_t cred, gid_t gid)
 {
 	KASSERT(cred != NULL);
+	KASSERT(cred != NOCRED);
+	KASSERT(cred != FSCRED);
 	KASSERT(cred-cr_refcnt == 1);
 
 	cred-cr_gid = gid;
@@ -354,6 +386,8 @@ void
 kauth_cred_setegid(kauth_cred_t cred, gid_t gid)
 {
 	KASSERT(cred != NULL);
+	KASSERT(cred != NOCRED);
+	KASSERT(cred != FSCRED);
 	KASSERT(cred-cr_refcnt == 1);
 
 	cred-cr_egid = gid;
@@ -363,6 +397,8 @@ void
 kauth_cred_setsvgid(kauth_cred_t cred, gid_t gid)
 {
 	KASSERT(cred != NULL);
+	KASSERT(cred != NOCRED);
+	KASSERT(cred != FSCRED);
 	KASSERT(cred-cr_refcnt == 1);
 
 	cred-cr_svgid = gid;
@@ -375,6 +411,8 @@ kauth_cred_ismember_gid(kauth_cred_t cre
 	uint32_t i;
 
 	KASSERT(cred != NULL);
+	KASSERT(cred != NOCRED);
+	KASSERT(cred != FSCRED);
 	KASSERT(resultp != NULL);
 
 	*resultp = 0;
@@ -392,6 +430,8 @@ u_int
 kauth_cred_ngroups(kauth_cred_t cred)
 {
 	KASSERT(cred != NULL);
+	KASSERT(cred != 

CVS commit: src/sys/ufs/ffs

2015-08-08 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Aug  8 08:18:52 UTC 2015

Modified Files:
src/sys/ufs/ffs: ffs_alloc.c

Log Message:
don't crash when printing error messages when there are no credentials.
don't abuse the printed uid to log the inode number.

The printing/logging of error messages should be simplified.


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/ufs/ffs/ffs_alloc.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/ffs/ffs_alloc.c
diff -u src/sys/ufs/ffs/ffs_alloc.c:1.149 src/sys/ufs/ffs/ffs_alloc.c:1.150
--- src/sys/ufs/ffs/ffs_alloc.c:1.149	Sat Mar 28 19:24:04 2015
+++ src/sys/ufs/ffs/ffs_alloc.c	Sat Aug  8 08:18:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_alloc.c,v 1.149 2015/03/28 19:24:04 maxv Exp $	*/
+/*	$NetBSD: ffs_alloc.c,v 1.150 2015/08/08 08:18:52 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ffs_alloc.c,v 1.149 2015/03/28 19:24:04 maxv Exp $);
+__KERNEL_RCSID(0, $NetBSD: ffs_alloc.c,v 1.150 2015/08/08 08:18:52 mlelstv Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_ffs.h
@@ -111,7 +111,7 @@ static daddr_t ffs_alloccg(struct inode 
 static daddr_t ffs_alloccgblk(struct inode *, struct buf *, daddr_t, int);
 static ino_t ffs_dirpref(struct inode *);
 static daddr_t ffs_fragextend(struct inode *, int, daddr_t, int, int);
-static void ffs_fserr(struct fs *, u_int, const char *);
+static void ffs_fserr(struct fs *, kauth_cred_t, const char *);
 static daddr_t ffs_hashalloc(struct inode *, int, daddr_t, int, int,
 daddr_t (*)(struct inode *, int, daddr_t, int, int));
 static daddr_t ffs_nodealloccg(struct inode *, int, daddr_t, int, int);
@@ -145,7 +145,7 @@ ffs_check_bad_allocation(const char *fun
 	if (bno = fs-fs_size) {
 		printf(bad block % PRId64 , ino %llu\n, bno,
 		(unsigned long long)inum);
-		ffs_fserr(fs, inum, bad block);
+		ffs_fserr(fs, NOCRED, bad block);
 		return EINVAL;
 	}
 	return 0;
@@ -286,7 +286,7 @@ ffs_alloc(struct inode *ip, daddr_t lbn,
 	}
 nospace:
 	mutex_exit(ump-um_lock);
-	ffs_fserr(fs, kauth_cred_geteuid(cred), file system full);
+	ffs_fserr(fs, cred, file system full);
 	uprintf(\n%s: write failed, file system is full\n, fs-fs_fsmnt);
 	return (ENOSPC);
 }
@@ -532,7 +532,7 @@ nospace:
 	/*
 	 * no space available
 	 */
-	ffs_fserr(fs, kauth_cred_geteuid(cred), file system full);
+	ffs_fserr(fs, cred, file system full);
 	uprintf(\n%s: write failed, file system is full\n, fs-fs_fsmnt);
 	return (ENOSPC);
 }
@@ -605,7 +605,7 @@ ffs_valloc(struct vnode *pvp, int mode, 
 noinodes:
 	mutex_exit(ump-um_lock);
 	UFS_WAPBL_END(pvp-v_mount);
-	ffs_fserr(fs, kauth_cred_geteuid(cred), out of inodes);
+	ffs_fserr(fs, cred, out of inodes);
 	uprintf(\n%s: create/symlink failed, no inodes free\n, fs-fs_fsmnt);
 	return ENOSPC;
 }
@@ -2159,9 +2159,17 @@ ffs_mapsearch(struct fs *fs, struct cg *
  *	fs: error message
  */
 static void
-ffs_fserr(struct fs *fs, u_int uid, const char *cp)
+ffs_fserr(struct fs *fs, kauth_cred_t cred, const char *cp)
 {
+	KASSERT(cred != NULL);
 
-	log(LOG_ERR, uid %d, pid %d, command %s, on %s: %s\n,
-	uid, curproc-p_pid, curproc-p_comm, fs-fs_fsmnt, cp);
+	if (cred == NOCRED || cred == FSCRED) {
+		log(LOG_ERR, pid %d, command %s, on %s: %s\n,
+		curproc-p_pid, curproc-p_comm,
+		fs-fs_fsmnt, cp);
+	} else {
+		log(LOG_ERR, uid %d, pid %d, command %s, on %s: %s\n,
+		kauth_cred_getuid(cred), curproc-p_pid, curproc-p_comm,
+		fs-fs_fsmnt, cp);
+	}
 }



CVS commit: [netbsd-7] src/sys/external/bsd/ipf/netinet

2015-08-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug  8 10:09:57 UTC 2015

Modified Files:
src/sys/external/bsd/ipf/netinet [netbsd-7]: ip_nat.c ip_nat.h
ip_nat6.c

Log Message:
Pull up following revision(s) (requested by prlw1 in ticket #939):
sys/external/bsd/ipf/netinet/ip_nat.h: revision 1.7
sys/external/bsd/ipf/netinet/ip_nat.c: revision 1.14
sys/external/bsd/ipf/netinet/ip_nat6.c: revision 1.8
Avoid panic in SIOCGNATL dereferencing a NULL softc.
Solution suggestion from Martin Husemann.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.2.1 src/sys/external/bsd/ipf/netinet/ip_nat.c
cvs rdiff -u -r1.6 -r1.6.12.1 src/sys/external/bsd/ipf/netinet/ip_nat.h
cvs rdiff -u -r1.7 -r1.7.4.1 src/sys/external/bsd/ipf/netinet/ip_nat6.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/external/bsd/ipf/netinet/ip_nat.c
diff -u src/sys/external/bsd/ipf/netinet/ip_nat.c:1.13 src/sys/external/bsd/ipf/netinet/ip_nat.c:1.13.2.1
--- src/sys/external/bsd/ipf/netinet/ip_nat.c:1.13	Sat Jul 12 14:54:32 2014
+++ src/sys/external/bsd/ipf/netinet/ip_nat.c	Sat Aug  8 10:09:57 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_nat.c,v 1.13 2014/07/12 14:54:32 darrenr Exp $	*/
+/*	$NetBSD: ip_nat.c,v 1.13.2.1 2015/08/08 10:09:57 martin Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -113,7 +113,7 @@ extern struct ifnet vpnif;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ip_nat.c,v 1.13 2014/07/12 14:54:32 darrenr Exp $);
+__KERNEL_RCSID(0, $NetBSD: ip_nat.c,v 1.13.2.1 2015/08/08 10:09:57 martin Exp $);
 #else
 static const char sccsid[] = @(#)ip_nat.c	1.11 6/5/96 (C) 1995 Darren Reed;
 static const char rcsid[] = @(#)Id: ip_nat.c,v 1.1.1.2 2012/07/22 13:45:27 darrenr Exp;
@@ -1227,11 +1227,11 @@ ipf_nat_ioctl(ipf_main_softc_t *softc, v
 			switch (nl.nl_v)
 			{
 			case 4 :
-ptr = ipf_nat_lookupredir(nl);
+ptr = ipf_nat_lookupredir(softc, nl);
 break;
 #ifdef USE_INET6
 			case 6 :
-ptr = ipf_nat6_lookupredir(nl);
+ptr = ipf_nat6_lookupredir(softc, nl);
 break;
 #endif
 			default:
@@ -4574,12 +4574,13 @@ find_out_wild_ports:
 /* nl_out* = destination information (translated)   */
 /*  */
 nat_t *
-ipf_nat_lookupredir(natlookup_t *np)
+ipf_nat_lookupredir(ipf_main_softc_t *softc, natlookup_t *np)
 {
 	fr_info_t fi;
 	nat_t *nat;
 
 	bzero((char *)fi, sizeof(fi));
+	fi.fin_main_soft = softc;
 	if (np-nl_flags  IPN_IN) {
 		fi.fin_data[0] = ntohs(np-nl_realport);
 		fi.fin_data[1] = ntohs(np-nl_outport);

Index: src/sys/external/bsd/ipf/netinet/ip_nat.h
diff -u src/sys/external/bsd/ipf/netinet/ip_nat.h:1.6 src/sys/external/bsd/ipf/netinet/ip_nat.h:1.6.12.1
--- src/sys/external/bsd/ipf/netinet/ip_nat.h:1.6	Wed Jan  9 13:23:20 2013
+++ src/sys/external/bsd/ipf/netinet/ip_nat.h	Sat Aug  8 10:09:57 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_nat.h,v 1.6 2013/01/09 13:23:20 christos Exp $	*/
+/*	$NetBSD: ip_nat.h,v 1.6.12.1 2015/08/08 10:09:57 martin Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -721,7 +721,7 @@ extern	int	ipf_nat_ioctl(ipf_main_softc_
    int, int, void *);
 extern	void	ipf_nat_log(ipf_main_softc_t *, ipf_nat_softc_t *,
  struct nat *, u_int);
-extern	nat_t	*ipf_nat_lookupredir(natlookup_t *);
+extern	nat_t	*ipf_nat_lookupredir(ipf_main_softc_t *, natlookup_t *);
 extern	nat_t	*ipf_nat_maplookup(void *, u_int, struct in_addr,
 struct in_addr);
 extern	nat_t	*ipf_nat_add(fr_info_t *, ipnat_t *, nat_t **,
@@ -780,7 +780,7 @@ extern	nat_t	*ipf_nat6_inlookup(fr_info_
 extern	u_32_t	ipf_nat6_ip6subtract(i6addr_t *, i6addr_t *);
 extern	frentry_t *ipf_nat6_ipfin(fr_info_t *, u_32_t *);
 extern	frentry_t *ipf_nat6_ipfout(fr_info_t *, u_32_t *);
-extern	nat_t	*ipf_nat6_lookupredir(natlookup_t *);
+extern	nat_t	*ipf_nat6_lookupredir(ipf_main_softc_t *, natlookup_t *);
 extern	int	ipf_nat6_newmap(fr_info_t *, nat_t *, natinfo_t *);
 extern	int	ipf_nat6_newrdr(fr_info_t *, nat_t *, natinfo_t *);
 extern	nat_t	*ipf_nat6_outlookup(fr_info_t *, u_int, u_int,

Index: src/sys/external/bsd/ipf/netinet/ip_nat6.c
diff -u src/sys/external/bsd/ipf/netinet/ip_nat6.c:1.7 src/sys/external/bsd/ipf/netinet/ip_nat6.c:1.7.4.1
--- src/sys/external/bsd/ipf/netinet/ip_nat6.c:1.7	Tue Apr  1 15:19:29 2014
+++ src/sys/external/bsd/ipf/netinet/ip_nat6.c	Sat Aug  8 10:09:57 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_nat6.c,v 1.7 2014/04/01 15:19:29 christos Exp $	*/
+/*	$NetBSD: ip_nat6.c,v 1.7.4.1 2015/08/08 10:09:57 martin Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -2414,12 +2414,13 @@ find_out_wild_ports:
 /* nl_out* = destination information (translated)   */
 /*  */
 nat_t *

CVS commit: [netbsd-7] src/doc

2015-08-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug  8 10:11:52 UTC 2015

Modified Files:
src/doc [netbsd-7]: CHANGES-7.0

Log Message:
Ticket #939


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.359 -r1.1.2.360 src/doc/CHANGES-7.0

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-7.0
diff -u src/doc/CHANGES-7.0:1.1.2.359 src/doc/CHANGES-7.0:1.1.2.360
--- src/doc/CHANGES-7.0:1.1.2.359	Fri Aug  7 13:45:33 2015
+++ src/doc/CHANGES-7.0	Sat Aug  8 10:11:52 2015
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0,v 1.1.2.359 2015/08/07 13:45:33 martin Exp $
+# $NetBSD: CHANGES-7.0,v 1.1.2.360 2015/08/08 10:11:52 martin Exp $
 
 A complete list of changes from the initial NetBSD 7.0 branch on 11 Aug 2014
 until the 7.0 release:
@@ -33859,3 +33859,10 @@ distrib/utils/embedded/conf/armv7.conf		
 	Turn resize on
 	[skrll, ticket #938]
 
+sys/external/bsd/ipf/netinet/ip_nat.c		1.14
+sys/external/bsd/ipf/netinet/ip_nat.h		1.7
+sys/external/bsd/ipf/netinet/ip_nat6.c		1.8
+
+	Avoid panic in SIOCGNATL dereferencing a NULL softc.
+	[prlw1, ticket #939]
+