CVS commit: [jdolecek-ncq] src/sys/dev/usb

2017-07-16 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Jul 16 21:41:47 UTC 2017

Modified Files:
src/sys/dev/usb [jdolecek-ncq]: umass_isdata.c

Log Message:
fix comment


To generate a diff of this commit:
cvs rdiff -u -r1.33.4.6 -r1.33.4.7 src/sys/dev/usb/umass_isdata.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/umass_isdata.c
diff -u src/sys/dev/usb/umass_isdata.c:1.33.4.6 src/sys/dev/usb/umass_isdata.c:1.33.4.7
--- src/sys/dev/usb/umass_isdata.c:1.33.4.6	Sat Jun 24 00:23:39 2017
+++ src/sys/dev/usb/umass_isdata.c	Sun Jul 16 21:41:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass_isdata.c,v 1.33.4.6 2017/06/24 00:23:39 jdolecek Exp $	*/
+/*	$NetBSD: umass_isdata.c,v 1.33.4.7 2017/07/16 21:41:47 jdolecek Exp $	*/
 
 /*
  * TODO:
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umass_isdata.c,v 1.33.4.6 2017/06/24 00:23:39 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass_isdata.c,v 1.33.4.7 2017/07/16 21:41:47 jdolecek Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -556,7 +556,7 @@ uisdata_get_params(struct ata_drive_data
 	xfer->c_ata_c.data = tb;
 	xfer->c_ata_c.bcount = DEV_BSIZE;
 	if (uisdata_exec_command(drvp, xfer) != ATACMD_COMPLETE) {
-		DPRINTF(("uisdata_get_parms: wdc_exec_command failed\n"));
+		DPRINTF(("uisdata_get_parms: uisdata_exec_command failed\n"));
 		rv = CMD_AGAIN;
 		goto out;
 	}



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

2017-07-16 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul 16 21:40:28 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: std.vexpress

Log Message:
enable initrd support


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/conf/std.vexpress

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/std.vexpress
diff -u src/sys/arch/evbarm/conf/std.vexpress:1.6 src/sys/arch/evbarm/conf/std.vexpress:1.7
--- src/sys/arch/evbarm/conf/std.vexpress:1.6	Wed Jul  5 01:08:44 2017
+++ src/sys/arch/evbarm/conf/std.vexpress	Sun Jul 16 21:40:28 2017
@@ -1,4 +1,4 @@
-#   $NetBSD: std.vexpress,v 1.6 2017/07/05 01:08:44 jmcneill Exp $
+#   $NetBSD: std.vexpress,v 1.7 2017/07/16 21:40:28 jmcneill Exp $
 #
 # standard NetBSD/evbarm for VEXPRESS options
 
@@ -30,3 +30,7 @@ makeoptions CPUFLAGS="-mcpu=cortex-a
 options ARM_INTR_IMPL=""
 options ARM_GENERIC_TODR
 
+# initrd support
+options MEMORY_DISK_HOOKS
+options MEMORY_DISK_DYNAMIC
+pseudo-device   md



CVS commit: src/usr.sbin/inetd

2017-07-16 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Jul 16 21:19:38 UTC 2017

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
New sentence, new line.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/inetd/inetd.8

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/inetd/inetd.8
diff -u src/usr.sbin/inetd/inetd.8:1.58 src/usr.sbin/inetd/inetd.8:1.59
--- src/usr.sbin/inetd/inetd.8:1.58	Sun Jul 16 21:05:19 2017
+++ src/usr.sbin/inetd/inetd.8	Sun Jul 16 21:19:38 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: inetd.8,v 1.58 2017/07/16 21:05:19 christos Exp $
+.\"	$NetBSD: inetd.8,v 1.59 2017/07/16 21:19:38 wiz Exp $
 .\"
 .\" Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -153,7 +153,8 @@ server program arguments
 .Pp
 For Internet services, the first field of the line may also have a host
 address specifier prefixed to it, separated from the service name or port
-number by a colon. If this is done, the string before the colon in the
+number by a colon.
+If this is done, the string before the colon in the
 first field indicates what local address
 .Nm
 should use when listening for that service, or the single character
@@ -179,7 +180,8 @@ The
 entry is the name of a valid service in
 the file
 .Pa /etc/services .
-Or an alternate port number. For
+Or an alternate port number.
+For
 .Dq internal
 services (discussed below), the service
 name



CVS commit: src/usr.sbin/inetd

2017-07-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul 16 21:05:19 UTC 2017

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
PR/52412: Edgar Pettijohn: Describe the service/port syntax.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/inetd/inetd.8

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/inetd/inetd.8
diff -u src/usr.sbin/inetd/inetd.8:1.57 src/usr.sbin/inetd/inetd.8:1.58
--- src/usr.sbin/inetd/inetd.8:1.57	Mon Apr 25 18:12:05 2011
+++ src/usr.sbin/inetd/inetd.8	Sun Jul 16 17:05:19 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: inetd.8,v 1.57 2011/04/25 22:12:05 wiz Exp $
+.\"	$NetBSD: inetd.8,v 1.58 2017/07/16 21:05:19 christos Exp $
 .\"
 .\" Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -57,7 +57,7 @@
 .\"
 .\" from: @(#)inetd.8   8.4 (Berkeley) 6/1/94
 .\"
-.Dd August 27, 2008
+.Dd July 16, 2017
 .Dt INETD 8
 .Os
 .Sh NAME
@@ -115,7 +115,7 @@ special case, described below).
 The fields of the configuration file are as follows:
 .Pp
 .Bd -unfilled -offset indent -compact
-[addr:]service-name
+[addr:]service-name/port-number
 socket-type[:accept_filter]
 protocol[,sndbuf=size][,rcvbuf=size]
 wait/nowait[:max]
@@ -152,9 +152,9 @@ server program arguments
 .Ed
 .Pp
 For Internet services, the first field of the line may also have a host
-address specifier prefixed to it, separated from the service name by a colon.
-If this is done, the string before the colon in the first field
-indicates what local address
+address specifier prefixed to it, separated from the service name or port
+number by a colon. If this is done, the string before the colon in the
+first field indicates what local address
 .Nm
 should use when listening for that service, or the single character
 .Dq \&*
@@ -175,11 +175,11 @@ interpreted in the traditional manner, w
 on all local addresses.
 .Pp
 The
-.Em service-name
+.Em service-name/port-number
 entry is the name of a valid service in
 the file
 .Pa /etc/services .
-For
+Or an alternate port number. For
 .Dq internal
 services (discussed below), the service
 name



CVS commit: src/sys/arch/pmax/pmax

2017-07-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul 16 17:35:20 UTC 2017

Modified Files:
src/sys/arch/pmax/pmax: bus.c

Log Message:
fix printf formats.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/pmax/pmax/bus.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/pmax/pmax/bus.c
diff -u src/sys/arch/pmax/pmax/bus.c:1.2 src/sys/arch/pmax/pmax/bus.c:1.3
--- src/sys/arch/pmax/pmax/bus.c:1.2	Thu May 18 12:34:56 2017
+++ src/sys/arch/pmax/pmax/bus.c	Sun Jul 16 13:35:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.c,v 1.2 2017/05/18 16:34:56 christos Exp $	*/
+/*	$NetBSD: bus.c,v 1.3 2017/07/16 17:35:20 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.2 2017/05/18 16:34:56 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.3 2017/07/16 17:35:20 christos Exp $");
 
 #include "opt_cputype.h"
 
@@ -117,10 +117,10 @@ _bus_dmamap_sync_r3k(bus_dma_tag_t t, bu
 
 #ifdef DIAGNOSTIC
 	if (offset >= map->dm_mapsize)
-		panic("_bus_dmamap_sync_r3k: bad offset %lu (map size is %lu)",
-		  offset, map->dm_mapsize);
+		panic("%s: bad offset %ju (map size is %ju)", __func__,
+		  (uintmax_t)offset, (uintmax_t)map->dm_mapsize);
 	if (len == 0 || (offset + len) > map->dm_mapsize)
-		panic("_bus_dmamap_sync_r3k: bad length");
+		panic("%s: bad length", __func__);
 #endif
 
 	/*
@@ -222,10 +222,10 @@ _bus_dmamap_sync_r4k(bus_dma_tag_t t, bu
 
 #ifdef DIAGNOSTIC
 	if (offset >= map->dm_mapsize)
-		panic("_bus_dmamap_sync_r4k: bad offset %lu (map size is %lu)",
-		  offset, map->dm_mapsize);
+		panic("%s: bad offset %ju (map size is %ju)", __func__,
+		  (uintmax_t)offset, (uintmax_t)map->dm_mapsize);
 	if (len == 0 || (offset + len) > map->dm_mapsize)
-		panic("_bus_dmamap_sync_r4k: bad length");
+		panic("%s: bad length", __func__);
 #endif
 
 	/*



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

2017-07-16 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul 16 17:12:18 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: sunxi_mmc.c

Log Message:
Add SMC_CAPS_POLLING support.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sunxi/sunxi_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/sunxi/sunxi_mmc.c
diff -u src/sys/arch/arm/sunxi/sunxi_mmc.c:1.1 src/sys/arch/arm/sunxi/sunxi_mmc.c:1.2
--- src/sys/arch/arm/sunxi/sunxi_mmc.c:1.1	Thu Jun 29 09:26:06 2017
+++ src/sys/arch/arm/sunxi/sunxi_mmc.c	Sun Jul 16 17:12:18 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_mmc.c,v 1.1 2017/06/29 09:26:06 jmcneill Exp $ */
+/* $NetBSD: sunxi_mmc.c,v 1.2 2017/07/16 17:12:18 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.1 2017/06/29 09:26:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.2 2017/07/16 17:12:18 jmcneill Exp $");
 
 #include 
 #include 
@@ -317,7 +317,8 @@ sunxi_mmc_attach_i(device_t self)
 		   SMC_CAPS_MULTI_SEG_DMA |
 		   SMC_CAPS_AUTO_STOP |
 		   SMC_CAPS_SD_HIGHSPEED |
-		   SMC_CAPS_MMC_HIGHSPEED;
+		   SMC_CAPS_MMC_HIGHSPEED |
+		   SMC_CAPS_POLLING;
 	if (width == 4)
 		saa.saa_caps |= SMC_CAPS_4BIT_MODE;
 	if (width == 8)
@@ -368,7 +369,8 @@ sunxi_mmc_intr(void *priv)
 }
 
 static int
-sunxi_mmc_wait_rint(struct sunxi_mmc_softc *sc, uint32_t mask, int timeout)
+sunxi_mmc_wait_rint(struct sunxi_mmc_softc *sc, uint32_t mask,
+int timeout, bool poll)
 {
 	int retry;
 	int error;
@@ -378,15 +380,24 @@ sunxi_mmc_wait_rint(struct sunxi_mmc_sof
 	if (sc->sc_intr_rint & mask)
 		return 0;
 
-	retry = timeout / hz;
+	if (poll)
+		retry = timeout / hz * 1000;
+	else
+		retry = timeout / hz;
 
 	while (retry > 0) {
-		error = cv_timedwait(>sc_intr_cv,
-		>sc_intr_lock, hz);
-		if (error && error != EWOULDBLOCK)
-			return error;
+		if (poll) {
+			sc->sc_intr_rint |= MMC_READ(sc, SUNXI_MMC_RINT);
+		} else {
+			error = cv_timedwait(>sc_intr_cv,
+			>sc_intr_lock, hz);
+			if (error && error != EWOULDBLOCK)
+return error;
+		}
 		if (sc->sc_intr_rint & mask)
 			return 0;
+		if (poll)
+			delay(1000);	
 		--retry;
 	}
 
@@ -420,7 +431,6 @@ sunxi_mmc_host_reset(sdmmc_chipset_handl
 	MMC_WRITE(sc, SUNXI_MMC_GCTRL,
 	MMC_READ(sc, SUNXI_MMC_GCTRL) | SUNXI_MMC_GCTRL_INTEN);
 
-
 	return 0;
 }
 
@@ -680,13 +690,14 @@ sunxi_mmc_exec_command(sdmmc_chipset_han
 {
 	struct sunxi_mmc_softc *sc = sch;
 	uint32_t cmdval = SUNXI_MMC_CMD_START;
+	const bool poll = (cmd->c_flags & SCF_POLL) != 0;
 	int retry;
 
 #ifdef SUNXI_MMC_DEBUG
 	aprint_normal_dev(sc->sc_dev,
-	"opcode %d flags 0x%x data %p datalen %d blklen %d\n",
+	"opcode %d flags 0x%x data %p datalen %d blklen %d poll %d\n",
 	cmd->c_opcode, cmd->c_flags, cmd->c_data, cmd->c_datalen,
-	cmd->c_blklen);
+	cmd->c_blklen, poll);
 #endif
 
 	mutex_enter(>sc_intr_lock);
@@ -766,7 +777,7 @@ sunxi_mmc_exec_command(sdmmc_chipset_han
 	}
 
 	cmd->c_error = sunxi_mmc_wait_rint(sc,
-	SUNXI_MMC_INT_ERROR|SUNXI_MMC_INT_CMD_DONE, hz * 10);
+	SUNXI_MMC_INT_ERROR|SUNXI_MMC_INT_CMD_DONE, hz * 10, poll);
 	if (cmd->c_error == 0 && (sc->sc_intr_rint & SUNXI_MMC_INT_ERROR)) {
 		if (sc->sc_intr_rint & SUNXI_MMC_INT_RESP_TIMEOUT) {
 			cmd->c_error = ETIMEDOUT;
@@ -787,7 +798,7 @@ sunxi_mmc_exec_command(sdmmc_chipset_han
 		SUNXI_MMC_INT_ERROR|
 		SUNXI_MMC_INT_AUTO_CMD_DONE|
 		SUNXI_MMC_INT_DATA_OVER,
-		hz*10);
+		hz*10, poll);
 		if (cmd->c_error == 0 &&
 		(sc->sc_intr_rint & SUNXI_MMC_INT_ERROR)) {
 			cmd->c_error = ETIMEDOUT;



CVS commit: src/sys/dev/sdmmc

2017-07-16 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul 16 17:11:46 UTC 2017

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

Log Message:
Add support for eMMC 4.5's optional cache feature. If a cache is present,
and the host controller reports the SMC_CAPS_POLLING capability (needed
to flush cache at shutdown), it will be automatically enabled and used.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/sdmmc/ld_sdmmc.c
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/sdmmc/sdmmc_mem.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/sdmmc/sdmmcreg.h
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/sdmmc/sdmmcvar.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/ld_sdmmc.c
diff -u src/sys/dev/sdmmc/ld_sdmmc.c:1.30 src/sys/dev/sdmmc/ld_sdmmc.c:1.31
--- src/sys/dev/sdmmc/ld_sdmmc.c:1.30	Mon Jul 10 10:35:07 2017
+++ src/sys/dev/sdmmc/ld_sdmmc.c	Sun Jul 16 17:11:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_sdmmc.c,v 1.30 2017/07/10 10:35:07 mlelstv Exp $	*/
+/*	$NetBSD: ld_sdmmc.c,v 1.31 2017/07/16 17:11:46 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.30 2017/07/10 10:35:07 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.31 2017/07/16 17:11:46 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -94,6 +94,7 @@ static int ld_sdmmc_dump(struct ld_softc
 static int ld_sdmmc_start(struct ld_softc *, struct buf *);
 static void ld_sdmmc_restart(void *);
 static int ld_sdmmc_discard(struct ld_softc *, off_t, off_t);
+static int ld_sdmmc_ioctl(struct ld_softc *, u_long, void *, int32_t, bool);
 
 static void ld_sdmmc_doattach(void *);
 static void ld_sdmmc_dobio(void *);
@@ -151,6 +152,7 @@ ld_sdmmc_attach(device_t parent, device_
 	ld->sc_dump = ld_sdmmc_dump;
 	ld->sc_start = ld_sdmmc_start;
 	ld->sc_discard = ld_sdmmc_discard;
+	ld->sc_ioctl = ld_sdmmc_ioctl;
 
 	/*
 	 * Defer attachment of ld + disk subsystem to a thread.
@@ -174,11 +176,19 @@ ld_sdmmc_doattach(void *arg)
 	struct ld_sdmmc_softc *sc = (struct ld_sdmmc_softc *)arg;
 	struct ld_softc *ld = >sc_ld;
 	struct sdmmc_softc *ssc = device_private(device_parent(ld->sc_dv));
+	const u_int cache_size = sc->sc_sf->ext_csd.cache_size;
+	char buf[sizeof(" KB")];
 
 	ldattach(ld, BUFQ_DISK_DEFAULT_STRAT);
 	aprint_normal_dev(ld->sc_dv, "%d-bit width,", sc->sc_sf->width);
 	if (ssc->sc_transfer_mode != NULL)
 		aprint_normal(" %s,", ssc->sc_transfer_mode);
+	if (cache_size > 0) {
+		format_bytes(buf, sizeof(buf), cache_size);
+		aprint_normal(" %s cache%s,", buf,
+		ISSET(sc->sc_sf->flags, SFF_CACHE_ENABLED) ? "" :
+		" (disabled)");
+	}
 	if ((ssc->sc_busclk / 1000) != 0)
 		aprint_normal(" %u.%03u MHz\n",
 		ssc->sc_busclk / 1000, ssc->sc_busclk % 1000);
@@ -312,6 +322,20 @@ ld_sdmmc_discard(struct ld_softc *ld, of
 	return sdmmc_mem_discard(sc->sc_sf, pos, len);
 }
 
+static int
+ld_sdmmc_ioctl(struct ld_softc *ld, u_long cmd, void *addr, int32_t flag,
+bool poll)
+{
+	struct ld_sdmmc_softc *sc = device_private(ld->sc_dv);
+
+	switch (cmd) {
+	case DIOCCACHESYNC:
+		return sdmmc_mem_flush_cache(sc->sc_sf, poll);
+	default:
+		return EPASSTHROUGH;
+	}
+}
+
 MODULE(MODULE_CLASS_DRIVER, ld_sdmmc, "ld");
 
 #ifdef _MODULE

Index: src/sys/dev/sdmmc/sdmmc_mem.c
diff -u src/sys/dev/sdmmc/sdmmc_mem.c:1.60 src/sys/dev/sdmmc/sdmmc_mem.c:1.61
--- src/sys/dev/sdmmc/sdmmc_mem.c:1.60	Sat Jun 24 23:25:01 2017
+++ src/sys/dev/sdmmc/sdmmc_mem.c	Sun Jul 16 17:11:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdmmc_mem.c,v 1.60 2017/06/24 23:25:01 jmcneill Exp $	*/
+/*	$NetBSD: sdmmc_mem.c,v 1.61 2017/07/16 17:11:46 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 
-__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.60 2017/06/24 23:25:01 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.61 2017/07/16 17:11:46 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -87,7 +87,7 @@ static int sdmmc_mem_send_cxd_data(struc
 static int sdmmc_set_bus_width(struct sdmmc_function *, int);
 static int sdmmc_mem_sd_switch(struct sdmmc_function *, int, int, int, sdmmc_bitfield512_t *);
 static int sdmmc_mem_mmc_switch(struct sdmmc_function *, uint8_t, uint8_t,
-uint8_t);
+uint8_t, bool);
 static int sdmmc_mem_signal_voltage(struct sdmmc_softc *, int);
 static int sdmmc_mem_spi_read_ocr(struct sdmmc_softc *, uint32_t, uint32_t *);
 static int sdmmc_mem_single_read_block(struct sdmmc_function *, uint32_t,
@@ -981,7 +981,7 @@ sdmmc_mem_mmc_init(struct sdmmc_softc *s
 
 		if (width != 1) {
 			error = sdmmc_mem_mmc_switch(sf, EXT_CSD_CMD_SET_NORMAL,
-			EXT_CSD_BUS_WIDTH, value);
+			EXT_CSD_BUS_WIDTH, value, false);
 			if (error == 0)
 error = 

CVS commit: src/distrib/pmax/ramdisk

2017-07-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul 16 14:24:30 UTC 2017

Modified Files:
src/distrib/pmax/ramdisk: Makefile

Log Message:
Give us a little room, too much potato chips.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/distrib/pmax/ramdisk/Makefile

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

Modified files:

Index: src/distrib/pmax/ramdisk/Makefile
diff -u src/distrib/pmax/ramdisk/Makefile:1.47 src/distrib/pmax/ramdisk/Makefile:1.48
--- src/distrib/pmax/ramdisk/Makefile:1.47	Tue Jan 24 13:04:04 2017
+++ src/distrib/pmax/ramdisk/Makefile	Sun Jul 16 10:24:29 2017
@@ -1,11 +1,11 @@
-#	$NetBSD: Makefile,v 1.47 2017/01/24 18:04:04 christos Exp $
+#	$NetBSD: Makefile,v 1.48 2017/07/16 14:24:29 christos Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
 
 IMAGE=		ramdisk.fs
 IMAGETAR=	diskimage.tgz
-IMAGESIZE=	3400k
+IMAGESIZE=	3500k
 MAKEFS_FLAGS+=	-f 15
 
 WARNS=		1



CVS commit: src/sys/arch

2017-07-16 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sun Jul 16 14:02:48 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64: genassym.cf vector.S
src/sys/arch/i386/i386: genassym.cf vector.S
src/sys/arch/x86/include: cpu.h intr.h
src/sys/arch/xen/conf: files.xen
src/sys/arch/xen/include: intr.h
src/sys/arch/xen/xen: evtchn.c pci_intr_machdep.c xenevt.c
Removed Files:
src/sys/arch/xen/xen: isa_machdep.c

Log Message:
Unify the xen and native x86/ interrupt setup functions and
spl traversal data structures.

This is towards PVHVM.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/amd64/amd64/vector.S
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/i386/i386/genassym.cf
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/i386/i386/vector.S
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/x86/include/intr.h
cvs rdiff -u -r1.148 -r1.149 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/xen/include/intr.h
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/xen/xen/evtchn.c
cvs rdiff -u -r1.27 -r0 src/sys/arch/xen/xen/isa_machdep.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/xen/xen/pci_intr_machdep.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/xen/xen/xenevt.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/amd64/amd64/genassym.cf
diff -u src/sys/arch/amd64/amd64/genassym.cf:1.60 src/sys/arch/amd64/amd64/genassym.cf:1.61
--- src/sys/arch/amd64/amd64/genassym.cf:1.60	Fri Nov 20 11:58:00 2015
+++ src/sys/arch/amd64/amd64/genassym.cf	Sun Jul 16 14:02:48 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.60 2015/11/20 11:58:00 maxv Exp $
+#	$NetBSD: genassym.cf,v 1.61 2017/07/16 14:02:48 cherry Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -278,11 +278,7 @@ endif
 define	IH_FUN			offsetof(struct intrhand, ih_fun)
 define	IH_ARG			offsetof(struct intrhand, ih_arg)
 define  IH_LEVEL		offsetof(struct intrhand, ih_level)
-ifdef XEN
-define IH_IPL_NEXT		offsetof(struct intrhand, ih_ipl_next)
-else
 define	IH_NEXT			offsetof(struct intrhand, ih_next)
-endif
 
 ifdef COMPAT_NETBSD32
 define	SC_FS32			offsetof(struct netbsd32_sigcontext, sc_fs)
@@ -299,13 +295,6 @@ define  LINUX32_SYS_sigreturn		LINUX32_S
 define  LINUX32_SYS_exit		LINUX32_SYS_exit
 endif
 
-ifdef XEN
-define	SIZEOF_IPLSOURCE	sizeof(struct iplsource)
-define	IS_RECURSE  offsetof(struct iplsource, ipl_recurse)
-define	IS_RESUME   offsetof(struct iplsource, ipl_resume)
-define	IS_HANDLERS offsetof(struct iplsource, ipl_handlers)
-define	EV_EVCNTL	offsetof(struct evcnt, ev_count)
-else
 define	IS_RECURSE	offsetof(struct intrsource, is_recurse)
 define	IS_RESUME	offsetof(struct intrsource, is_resume)
 define	IS_EVCNT	offsetof(struct intrsource, is_evcnt.ev_count)
@@ -316,7 +305,6 @@ define	IS_PIN		offsetof(struct intrsourc
 define	IS_TYPE		offsetof(struct intrsource, is_type)
 define	IS_MAXLEVEL	offsetof(struct intrsource, is_maxlevel)
 define	IS_LWP			offsetof(struct intrsource, is_lwp)
-endif
 
 define	IPL_NONE		IPL_NONE
 define	IPL_PREEMPT		IPL_PREEMPT

Index: src/sys/arch/amd64/amd64/vector.S
diff -u src/sys/arch/amd64/amd64/vector.S:1.49 src/sys/arch/amd64/amd64/vector.S:1.50
--- src/sys/arch/amd64/amd64/vector.S:1.49	Tue May 23 08:54:38 2017
+++ src/sys/arch/amd64/amd64/vector.S	Sun Jul 16 14:02:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.49 2017/05/23 08:54:38 nonaka Exp $	*/
+/*	$NetBSD: vector.S,v 1.50 2017/07/16 14:02:48 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -829,7 +829,9 @@ LABEL(x2apic_level_stubs)
 END(x2apic_level_stubs)
 #endif
 
-#else	/* !XEN */
+#endif /* !defined(XEN) */
+
+#if defined(XEN)
 /* Resume/recurse procedures for spl() */
 #define	XENINTRSTUB(name, num, early_ack, late_ack, mask, unmask, level_mask) \
 IDTVEC(recurse_ ## name ## num)		;\
@@ -851,7 +853,7 @@ IDTVEC(resume_ ## name ## num)		\
 	movq	IH_ARG(%rbx),%rdi	;\
 	movq	%rsp,%rsi		;\
 	call	*IH_FUN(%rbx)		/* call it */			;\
-	movq	IH_IPL_NEXT(%rbx),%rbx	/* next handler in chain */	;\
+	movq	IH_NEXT(%rbx),%rbx	/* next handler in chain */	;\
 	testq	%rbx,%rbx		;\
 	jnz	6b			;\
 5:	\

Index: src/sys/arch/i386/i386/genassym.cf
diff -u src/sys/arch/i386/i386/genassym.cf:1.99 src/sys/arch/i386/i386/genassym.cf:1.100
--- src/sys/arch/i386/i386/genassym.cf:1.99	Wed Aug 26 03:00:53 2015
+++ src/sys/arch/i386/i386/genassym.cf	Sun Jul 16 14:02:48 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.99 2015/08/26 03:00:53 uebayasi Exp $
+#	$NetBSD: genassym.cf,v 1.100 2017/07/16 14:02:48 cherry Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -250,11 +250,7 @@ endif
 define	IH_FUN			offsetof(struct intrhand, ih_fun)
 define	IH_ARG			

CVS commit: src/sys/netipsec

2017-07-16 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Sun Jul 16 10:46:45 UTC 2017

Modified Files:
src/sys/netipsec: key.c

Log Message:
Make sure to sort the list when changing the state by key_sa_chgstate


To generate a diff of this commit:
cvs rdiff -u -r1.186 -r1.187 src/sys/netipsec/key.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/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.186 src/sys/netipsec/key.c:1.187
--- src/sys/netipsec/key.c:1.186	Sun Jul 16 10:36:52 2017
+++ src/sys/netipsec/key.c	Sun Jul 16 10:46:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.186 2017/07/16 10:36:52 ozaki-r Exp $	*/
+/*	$NetBSD: key.c,v 1.187 2017/07/16 10:46:45 ozaki-r Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.186 2017/07/16 10:36:52 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.187 2017/07/16 10:46:45 ozaki-r Exp $");
 
 /*
  * This code is referd to RFC 2367
@@ -7805,6 +7805,7 @@ key_sa_routechange(struct sockaddr *dst)
 static void
 key_sa_chgstate(struct secasvar *sav, u_int8_t state)
 {
+	struct secasvar *_sav;
 
 	KASSERT(sav != NULL);
 
@@ -7815,9 +7816,27 @@ key_sa_chgstate(struct secasvar *sav, u_
 	LIST_REMOVE(sav, chain);
 
 	sav->state = state;
-	LIST_INSERT_HEAD(>sah->savtree[state], sav, chain);
-	if (SADB_SASTATE_USABLE_P(sav))
-		key_validate_savlist(sav->sah, state);
+	if (!SADB_SASTATE_USABLE_P(sav)) {
+		/* We don't need to care about the order */
+		LIST_INSERT_HEAD(>sah->savtree[state], sav, chain);
+		return;
+	}
+	/*
+	 * Sort the list by lft_c->sadb_lifetime_addtime
+	 * in ascending order.
+	 */
+	LIST_FOREACH(_sav, >sah->savtree[state], chain) {
+		if (_sav->lft_c->sadb_lifetime_addtime >
+		sav->lft_c->sadb_lifetime_addtime) {
+			LIST_INSERT_BEFORE(_sav, sav, chain);
+			break;
+		}
+	}
+	if (_sav == NULL) {
+		LIST_INSERT_TAIL(>sah->savtree[state], sav, secasvar,
+		chain);
+	}
+	key_validate_savlist(sav->sah, state);
 }
 
 /* XXX too much? */



CVS commit: src/sys/netipsec

2017-07-16 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Sun Jul 16 10:36:52 UTC 2017

Modified Files:
src/sys/netipsec: key.c

Log Message:
Don't validate sav lists of LARVAL or DEAD states

We don't sort the lists so the validation will always fail.

Fix PR kern/52405


To generate a diff of this commit:
cvs rdiff -u -r1.185 -r1.186 src/sys/netipsec/key.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/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.185 src/sys/netipsec/key.c:1.186
--- src/sys/netipsec/key.c:1.185	Sat Jul 15 22:48:32 2017
+++ src/sys/netipsec/key.c	Sun Jul 16 10:36:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.185 2017/07/15 22:48:32 christos Exp $	*/
+/*	$NetBSD: key.c,v 1.186 2017/07/16 10:36:52 ozaki-r Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.185 2017/07/15 22:48:32 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.186 2017/07/16 10:36:52 ozaki-r Exp $");
 
 /*
  * This code is referd to RFC 2367
@@ -7816,7 +7816,8 @@ key_sa_chgstate(struct secasvar *sav, u_
 
 	sav->state = state;
 	LIST_INSERT_HEAD(>sah->savtree[state], sav, chain);
-	key_validate_savlist(sav->sah, state);
+	if (SADB_SASTATE_USABLE_P(sav))
+		key_validate_savlist(sav->sah, state);
 }
 
 /* XXX too much? */



CVS commit: src/sys/arch

2017-07-16 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sun Jul 16 06:14:24 UTC 2017

Modified Files:
src/sys/arch/x86/isa: isa_machdep.c
src/sys/arch/xen/include: intr.h pci_machdep.h
src/sys/arch/xen/x86: intr.c
src/sys/arch/xen/xen: isa_machdep.c pci_intr_machdep.c pciback.c
pciide_machdep.c

Log Message:
Remove the xen specific interrupt type for the x86 intr_handle_t
For this to work, we use the evtchn.c:get_pirq_to_evtchn() glue
function to make things easier.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/x86/isa/isa_machdep.c
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/xen/include/intr.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/xen/include/pci_machdep.h
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/xen/x86/intr.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/xen/xen/isa_machdep.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/xen/xen/pci_intr_machdep.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/xen/xen/pciback.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/xen/xen/pciide_machdep.c

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

Modified files:

Index: src/sys/arch/x86/isa/isa_machdep.c
diff -u src/sys/arch/x86/isa/isa_machdep.c:1.34 src/sys/arch/x86/isa/isa_machdep.c:1.35
--- src/sys/arch/x86/isa/isa_machdep.c:1.34	Sat Oct 15 16:46:14 2016
+++ src/sys/arch/x86/isa/isa_machdep.c	Sun Jul 16 06:14:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: isa_machdep.c,v 1.34 2016/10/15 16:46:14 jdolecek Exp $	*/
+/*	$NetBSD: isa_machdep.c,v 1.35 2017/07/16 06:14:23 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.34 2016/10/15 16:46:14 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.35 2017/07/16 06:14:23 cherry Exp $");
 
 #include 
 #include 
@@ -212,7 +212,7 @@ isa_intr_establish_xname(isa_chipset_tag
 	int pin;
 #if NIOAPIC > 0
 	intr_handle_t mpih;
-	struct ioapic_softc *ioapic;
+	struct ioapic_softc *ioapic = NULL;
 #endif
 
 	pin = irq;
@@ -237,20 +237,48 @@ isa_intr_establish_xname(isa_chipset_tag
 			printf("isa_intr_establish: no MP mapping found\n");
 	}
 #endif
+#if defined(XEN)
+	KASSERT(APIC_IRQ_ISLEGACY(irq));
+
+	int evtch;
+	char evname[16];
+
+	mpih |= APIC_IRQ_LEGACY_IRQ(irq);
+
+	evtch = xen_intr_map((int *), type); /* XXX: legacy - xen just tosses irq back at us */
+	if (evtch == -1)
+		return NULL;
+#if NIOAPIC > 0
+	if (ioapic)
+		snprintf(evname, sizeof(evname), "%s pin %d",
+		device_xname(ioapic->sc_dev), pin);
+	else
+#endif
+		snprintf(evname, sizeof(evname), "irq%d", irq);
+
+	aprint_debug("irq: %d requested on pic: %s.\n", irq, pic->pic_name);
+
+	return (void *)pirq_establish(irq, evtch, ih_fun, ih_arg, level,
+	evname);
+#else /* defined(XEN) */
 	return intr_establish_xname(irq, pic, pin, type, level, ih_fun, ih_arg,
 	false, xname);
+#endif
+
 }
 
 /* Deregister an interrupt handler. */
 void
 isa_intr_disestablish(isa_chipset_tag_t ic, void *arg)
 {
+#if !defined(XEN)
 	struct intrhand *ih = arg;
 
 	if (!LEGAL_IRQ(ih->ih_pin))
 		panic("intr_disestablish: bogus irq");
 
 	intr_disestablish(ih);
+#endif	
 }
 
 void

Index: src/sys/arch/xen/include/intr.h
diff -u src/sys/arch/xen/include/intr.h:1.40 src/sys/arch/xen/include/intr.h:1.41
--- src/sys/arch/xen/include/intr.h:1.40	Tue May 23 08:54:39 2017
+++ src/sys/arch/xen/include/intr.h	Sun Jul 16 06:14:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.40 2017/05/23 08:54:39 nonaka Exp $	*/
+/*	$NetBSD: intr.h,v 1.41 2017/07/16 06:14:24 cherry Exp $	*/
 /*	NetBSD intr.h,v 1.15 2004/10/31 10:39:34 yamt Exp	*/
 
 /*-
@@ -175,7 +175,7 @@ int xen_intr_map(int *, int);
 #ifdef INTRDEBUG
 void intr_printconfig(void);
 #endif
-int intr_find_mpmapping(int, int, struct xen_intr_handle *);
+int intr_find_mpmapping(int, int, intr_handle_t *);
 struct pic *intr_findpic(int);
 void intr_add_pcibus(struct pcibus_attach_args *);
 

Index: src/sys/arch/xen/include/pci_machdep.h
diff -u src/sys/arch/xen/include/pci_machdep.h:1.18 src/sys/arch/xen/include/pci_machdep.h:1.19
--- src/sys/arch/xen/include/pci_machdep.h:1.18	Mon Apr  4 20:37:55 2011
+++ src/sys/arch/xen/include/pci_machdep.h	Sun Jul 16 06:14:24 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.h,v 1.18 2011/04/04 20:37:55 dyoung Exp $ */
+/* $NetBSD: pci_machdep.h,v 1.19 2017/07/16 06:14:24 cherry Exp $ */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -60,7 +60,7 @@
 /*
  * Types provided to machine-independent PCI code
  */
-typedef struct xen_intr_handle pci_intr_handle_t;
+typedef intr_handle_t pci_intr_handle_t;
 
 #include 
 

Index: src/sys/arch/xen/x86/intr.c
diff -u src/sys/arch/xen/x86/intr.c:1.31 src/sys/arch/xen/x86/intr.c:1.32
--- src/sys/arch/xen/x86/intr.c:1.31	Tue May 23 08:54:39 2017
+++ src/sys/arch/xen/x86/intr.c	Sun Jul 16 06:14:24 2017
@@ -103,7 +103,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.31