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

2019-04-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Apr  9 05:59:24 UTC 2019

Modified Files:
src/sys/arch/arm/samsung: exynos_dwcmmc.c

Log Message:
Fix softc size in CFATTACH_DECL_NEW


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/samsung/exynos_dwcmmc.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/samsung/exynos_dwcmmc.c
diff -u src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.7 src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.8
--- src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.7	Mon Jul  2 23:52:53 2018
+++ src/sys/arch/arm/samsung/exynos_dwcmmc.c	Tue Apr  9 05:59:24 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_dwcmmc.c,v 1.7 2018/07/02 23:52:53 jmcneill Exp $ */
+/* $NetBSD: exynos_dwcmmc.c,v 1.8 2019/04/09 05:59:24 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_dwcmmc.c,v 1.7 2018/07/02 23:52:53 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_dwcmmc.c,v 1.8 2019/04/09 05:59:24 skrll Exp $");
 
 #include 
 #include 
@@ -65,7 +65,7 @@ struct exynos_dwcmmc_softc {
 	u_int			sc_ciu_div;
 };
 
-CFATTACH_DECL_NEW(exynos_dwcmmc, sizeof(struct dwc_mmc_softc),
+CFATTACH_DECL_NEW(exynos_dwcmmc, sizeof(struct exynos_dwcmmc_softc),
 	exynos_dwcmmc_match, exynos_dwcmmc_attach, NULL, NULL);
 
 static const char * const exynos_dwcmmc_compat[] = {



CVS commit: src/sys/dev/isa

2019-04-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Apr  9 05:59:15 UTC 2019

Modified Files:
src/sys/dev/isa: if_ef.c

Log Message:
- Use the correct function name for the panic message.
- KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/isa/if_ef.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/isa/if_ef.c
diff -u src/sys/dev/isa/if_ef.c:1.31 src/sys/dev/isa/if_ef.c:1.32
--- src/sys/dev/isa/if_ef.c:1.31	Fri Jun  3 16:28:40 2011
+++ src/sys/dev/isa/if_ef.c	Tue Apr  9 05:59:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ef.c,v 1.31 2011/06/03 16:28:40 tsutsui Exp $	*/
+/*	$NetBSD: if_ef.c,v 1.32 2019/04/09 05:59:14 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ef.c,v 1.31 2011/06/03 16:28:40 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ef.c,v 1.32 2019/04/09 05:59:14 msaitoh Exp $");
 
 #include 
 #include 
@@ -72,17 +72,17 @@ struct ef_softc {
 
 	void* sc_ih;			/* interrupt handle */
 
-	u_int8_t card_rev;		/* hardware revision */
-	u_int8_t card_type;		/* card model -- AUI/BNC or TP */
+	uint8_t card_rev;		/* hardware revision */
+	uint8_t card_type;		/* card model -- AUI/BNC or TP */
 };
 
-int ef_media[] = {
+static int ef_media[] = {
 	IFM_ETHER | IFM_10_5,
 	IFM_ETHER | IFM_10_2,
 };
 #define NEF_MEDIA   (sizeof(ef_media) / sizeof(ef_media[0]))
 
-int eftp_media[] = {
+static int eftp_media[] = {
 	IFM_ETHER | IFM_10_T,
 };
 #define NEFTP_MEDIA   (sizeof(eftp_media) / sizeof(eftp_media[0]))
@@ -96,8 +96,8 @@ static int 	ef_intrhook(struct ie_softc 
 static void	ef_copyin(struct ie_softc *, void *, int, size_t);
 static void	ef_copyout(struct ie_softc *, const void *, int, size_t);
 
-static u_int16_t ef_read_16(struct ie_softc *, int);
-static void	ef_write_16(struct ie_softc *, int, u_int16_t);
+static uint16_t ef_read_16(struct ie_softc *, int);
+static void	ef_write_16(struct ie_softc *, int, uint16_t);
 static void	ef_write_24(struct ie_softc *, int, int);
 
 static void	ef_mediastatus(struct ie_softc *, struct ifmediareq *);
@@ -105,8 +105,8 @@ static void	ef_mediastatus(struct ie_sof
 /* Local routines */
 static int 	ef_port_check(bus_space_tag_t, bus_space_handle_t);
 
-int ef_match(device_t, cfdata_t, void *);
-void ef_attach(device_t, device_t, void *);
+static int	ef_match(device_t, cfdata_t, void *);
+static void	ef_attach(device_t, device_t, void *);
 
 /*
  * This keeps track of which ISAs have been through an ie probe sequence.
@@ -117,7 +117,7 @@ void ef_attach(device_t, device_t, void 
  * which will unique per ISA bus.
  */
 
-#define MAXCARDS_PER_ISABUS 8   /* if you have more than 8, you lose */
+#define MAXCARDS_PER_ISABUS 8   /* If you have more than 8, you lose */
 
 struct ef_isabus {
 	LIST_ENTRY(ef_isabus) isa_link;
@@ -138,12 +138,8 @@ static LIST_HEAD(, ef_isabus) ef_isa_bus
 static int ef_isa_buses_inited;
 
 static void
-ef_card_add(
-struct ef_isabus *bus,
-bus_addr_t iobase,
-bus_addr_t maddr,
-bus_size_t msiz,
-int irq)
+ef_card_add(struct ef_isabus *bus, bus_addr_t iobase, bus_addr_t maddr,
+bus_size_t msiz, int irq)
 {
 	int idx;
 
@@ -168,11 +164,11 @@ ef_card_add(
 static void
 ef_reset(struct ie_softc *sc, int why)
 {
-	struct ef_softc* esc = (struct ef_softc *) sc;
+	struct ef_softc *esc = (struct ef_softc *)sc;
 
 	switch (why) {
 	case CHIP_PROBE:
-		/* reset to chip to see if it responds */
+		/* Reset to chip to see if it responds */
 		bus_space_write_1(esc->sc_regt, esc->sc_regh,
   EF_CTRL, EF_CTRL_RESET);
 		DELAY(100);
@@ -183,7 +179,7 @@ ef_reset(struct ie_softc *sc, int why)
 
 	case CARD_RESET:
 		/*
-		 * this takes around 10sec, and we can get
+		 * This takes around 10sec, and we can get
 		 * by quite well w/out it...
 		 */
 		break;
@@ -193,14 +189,16 @@ ef_reset(struct ie_softc *sc, int why)
 static void
 ef_atten(struct ie_softc *sc, int why)
 {
-	struct ef_softc* esc = (struct ef_softc *) sc;
+	struct ef_softc *esc = (struct ef_softc *)sc;
+
 	bus_space_write_1(esc->sc_regt, esc->sc_regh, EF_ATTN, 1);
 }
 
 static void
 ef_hwinit(struct ie_softc *sc)
 {
-	struct ef_softc* esc = (struct ef_softc *) sc;
+	struct ef_softc *esc = (struct ef_softc *)sc;
+
 	bus_space_write_1(esc->sc_regt, esc->sc_regh, EF_ICTRL, 1);
 }
 
@@ -208,26 +206,26 @@ static int
 ef_intrhook(struct ie_softc *sc, int where)
 {
 	unsigned char cr;
-	struct ef_softc* esc = (struct ef_softc *) sc;
+	struct ef_softc *esc = (struct ef_softc *)sc;
 
 	switch (where) {
 	case INTR_ENTER:
-		/* entering ISR: disable, ack card interrupts */
+		/* Entering ISR: disable, ack card interrupts */
 		cr = bus_space_read_1(esc->sc_regt, esc->sc_regh, EF_CTRL);
 		bus_space_write_1(esc->sc_regt, esc->sc_regh, EF_CTRL,
-  cr & ~EF_CTRL_IEN);
+		cr & ~EF_CTRL_IEN);
 		

CVS commit: src/sys/dev/isa

2019-04-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Apr  9 05:59:15 UTC 2019

Modified Files:
src/sys/dev/isa: if_ef.c

Log Message:
- Use the correct function name for the panic message.
- KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/isa/if_ef.c

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



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

2019-04-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Apr  9 05:59:24 UTC 2019

Modified Files:
src/sys/arch/arm/samsung: exynos_dwcmmc.c

Log Message:
Fix softc size in CFATTACH_DECL_NEW


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/samsung/exynos_dwcmmc.c

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



CVS commit: src/sys/dev/isa

2019-04-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Apr  9 05:25:14 UTC 2019

Modified Files:
src/sys/dev/isa: if_ai.c

Log Message:
 Make it compilable with AI_DEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/isa/if_ai.c

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



CVS commit: src/sys/dev/isa

2019-04-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Apr  9 05:25:14 UTC 2019

Modified Files:
src/sys/dev/isa: if_ai.c

Log Message:
 Make it compilable with AI_DEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/isa/if_ai.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/isa/if_ai.c
diff -u src/sys/dev/isa/if_ai.c:1.34 src/sys/dev/isa/if_ai.c:1.35
--- src/sys/dev/isa/if_ai.c:1.34	Tue Apr  9 05:24:07 2019
+++ src/sys/dev/isa/if_ai.c	Tue Apr  9 05:25:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ai.c,v 1.34 2019/04/09 05:24:07 msaitoh Exp $	*/
+/*	$NetBSD: if_ai.c,v 1.35 2019/04/09 05:25:14 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ai.c,v 1.34 2019/04/09 05:24:07 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ai.c,v 1.35 2019/04/09 05:25:14 msaitoh Exp $");
 
 #include 
 #include 
@@ -249,7 +249,7 @@ ai_match(device_t parent, cfdata_t cf, v
 			  AI_IOSIZE, 0, ) != 0) {
 
 		DPRINTF(("ai_match: cannot map %d IO ports @ 0x%x\n",
-			 AI_IOSIZE, ia->ia_iobase));
+			 AI_IOSIZE, ia->ia_io[0].ir_addr));
 		return 0;
 	}
 
@@ -259,7 +259,7 @@ ai_match(device_t parent, cfdata_t cf, v
 	if (type != SL10_BOARD && type != EN100_BOARD &&
 	type != SLFIBER_BOARD) {
 		DPRINTF(("ai_match: unknown board code 0x%02x @ 0x%x\n",
-			 type, ia->ia_iobase));
+			 type, ia->ia_io[0].ir_addr));
 		goto out;
 	}
 
@@ -282,7 +282,7 @@ ai_match(device_t parent, cfdata_t cf, v
 	ia->ia_iomem[0].ir_size != memsize) {
 		DPRINTF((
 		   "ai_match: memsize of board @ 0x%x doesn't match config\n",
-		   ia->ia_iobase));
+		   ia->ia_io[0].ir_addr));
 		goto out;
 	}
 
@@ -298,7 +298,7 @@ ai_match(device_t parent, cfdata_t cf, v
 
 	ia->ia_ndrq = 0;
 
-	DPRINTF(("ai_match: found board @ 0x%x\n", ia->ia_iobase));
+	DPRINTF(("ai_match: found board @ 0x%x\n", ia->ia_io[0].ir_addr));
 
 out:
 	bus_space_unmap(iot, ioh, AI_IOSIZE);



CVS commit: src/sys/dev/isa

2019-04-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Apr  9 05:24:07 UTC 2019

Modified Files:
src/sys/dev/isa: if_ai.c

Log Message:
 KNF. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/isa/if_ai.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/isa/if_ai.c
diff -u src/sys/dev/isa/if_ai.c:1.33 src/sys/dev/isa/if_ai.c:1.34
--- src/sys/dev/isa/if_ai.c:1.33	Fri Jun  3 16:28:40 2011
+++ src/sys/dev/isa/if_ai.c	Tue Apr  9 05:24:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ai.c,v 1.33 2011/06/03 16:28:40 tsutsui Exp $	*/
+/*	$NetBSD: if_ai.c,v 1.34 2019/04/09 05:24:07 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ai.c,v 1.33 2011/06/03 16:28:40 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ai.c,v 1.34 2019/04/09 05:24:07 msaitoh Exp $");
 
 #include 
 #include 
@@ -69,13 +69,13 @@ struct ai_softc {
 	bus_space_tag_t sc_regt;	/* space tag for registers */
 	bus_space_handle_t sc_regh;	/* space handle for registers */
 
-	u_int8_t	card_rev;
-	u_int8_t	card_type;
+	uint8_t	card_rev;
+	uint8_t	card_type;
 
 	void		*sc_ih;		/* interrupt handle */
 };
 
-const char *ai_names[] = {
+static const char *ai_names[] = {
 "StarLAN 10",
 "EN100",
 "StarLAN Fiber",
@@ -88,8 +88,8 @@ static void 	ai_atten(struct ie_softc *,
 static void	ai_copyin(struct ie_softc *, void *, int, size_t);
 static void	ai_copyout(struct ie_softc *, const void *, int, size_t);
 
-static u_int16_t ai_read_16(struct ie_softc *, int);
-static void	ai_write_16(struct ie_softc *, int, u_int16_t);
+static uint16_t ai_read_16(struct ie_softc *, int);
+static void	ai_write_16(struct ie_softc *, int, uint16_t);
 static void	ai_write_24(struct ie_softc *, int, int);
 
 /* Local support functions */
@@ -98,8 +98,8 @@ static int 	check_ie_present(struct ie_s
 static int	ai_find_mem_size(struct ai_softc*, bus_space_tag_t,
 	bus_size_t);
 
-int ai_match(device_t, cfdata_t, void *);
-void ai_attach(device_t, device_t, void *);
+static int	ai_match(device_t, cfdata_t, void *);
+static void	ai_attach(device_t, device_t, void *);
 
 /*
  * AT StarLan support routines
@@ -107,18 +107,18 @@ void ai_attach(device_t, device_t, void 
 static void
 ai_reset(struct ie_softc *sc, int why)
 {
-	struct ai_softc* asc = (struct ai_softc *) sc;
+	struct ai_softc *asc = (struct ai_softc *)sc;
 
 	switch (why) {
 	case CHIP_PROBE:
-		/* reset to chip to see if it responds */
+		/* Reset to chip to see if it responds */
 		bus_space_write_1(asc->sc_regt, asc->sc_regh, AI_RESET, 0);
 		DELAY(100);
 		break;
 
 	case CARD_RESET:
 		/*
-		 * this takes around 10sec, and we can get
+		 * This takes around 10sec, and we can get
 		 * by quite well w/out it...
 		 */
 		break;
@@ -128,18 +128,19 @@ ai_reset(struct ie_softc *sc, int why)
 static void
 ai_atten(struct ie_softc *sc, int why)
 {
-struct ai_softc* asc = (struct ai_softc *) sc;
-bus_space_write_1(asc->sc_regt, asc->sc_regh, AI_ATTN, 0);
+	struct ai_softc *asc = (struct ai_softc *)sc;
+
+	bus_space_write_1(asc->sc_regt, asc->sc_regh, AI_ATTN, 0);
 }
 
 static void
-ai_copyin (struct ie_softc *sc, void *dst, int offset, size_t size)
+ai_copyin(struct ie_softc *sc, void *dst, int offset, size_t size)
 {
 	int dribble;
-	u_int8_t* bptr = dst;
+	uint8_t *bptr = dst;
 
 	bus_space_barrier(sc->bt, sc->bh, offset, size,
-			  BUS_SPACE_BARRIER_READ);
+	BUS_SPACE_BARRIER_READ);
 
 	if (offset % 2) {
 		*bptr = bus_space_read_1(sc->bt, sc->bh, offset);
@@ -147,8 +148,8 @@ ai_copyin (struct ie_softc *sc, void *ds
 	}
 
 	dribble = size % 2;
-	bus_space_read_region_2(sc->bt, sc->bh, offset, (u_int16_t *) bptr,
-size >> 1);
+	bus_space_read_region_2(sc->bt, sc->bh, offset, (uint16_t *)bptr,
+	size >> 1);
 
 	if (dribble) {
 		bptr += size - 1;
@@ -158,12 +159,12 @@ ai_copyin (struct ie_softc *sc, void *ds
 }
 
 static void
-ai_copyout (struct ie_softc *sc, const void *src, int offset, size_t size)
+ai_copyout(struct ie_softc *sc, const void *src, int offset, size_t size)
 {
 	int dribble;
 	int osize = size;
 	int ooffset = offset;
-	const u_int8_t* bptr = src;
+	const uint8_t *bptr = src;
 
 	if (offset % 2) {
 		bus_space_write_1(sc->bt, sc->bh, offset, *bptr);
@@ -172,7 +173,7 @@ ai_copyout (struct ie_softc *sc, const v
 
 	dribble = size % 2;
 	bus_space_write_region_2(sc->bt, sc->bh, offset,
-	(const u_int16_t *)bptr, size >> 1);
+	(const uint16_t *)bptr, size >> 1);
 	if (dribble) {
 		bptr += size - 1;
 		offset += size - 1;
@@ -180,28 +181,31 @@ ai_copyout (struct ie_softc *sc, const v
 	}
 
 	bus_space_barrier(sc->bt, sc->bh, ooffset, osize,
-			  BUS_SPACE_BARRIER_WRITE);
+	BUS_SPACE_BARRIER_WRITE);
 }
 
-static u_int16_t
-ai_read_16 (struct ie_softc *sc, int offset)
+static uint16_t
+ai_read_16(struct 

CVS commit: src/sys/dev/isa

2019-04-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Apr  9 05:24:07 UTC 2019

Modified Files:
src/sys/dev/isa: if_ai.c

Log Message:
 KNF. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/isa/if_ai.c

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



CVS commit: src/sys/dev/mca

2019-04-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Apr  9 04:04:04 UTC 2019

Modified Files:
src/sys/dev/mca: if_le_mca.c

Log Message:
 Fix a bug that the supported media can't passed correctly. Not tested.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/mca/if_le_mca.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/mca/if_le_mca.c
diff -u src/sys/dev/mca/if_le_mca.c:1.20 src/sys/dev/mca/if_le_mca.c:1.21
--- src/sys/dev/mca/if_le_mca.c:1.20	Tue Apr  9 03:56:08 2019
+++ src/sys/dev/mca/if_le_mca.c	Tue Apr  9 04:04:04 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_le_mca.c,v 1.20 2019/04/09 03:56:08 msaitoh Exp $	*/
+/*	$NetBSD: if_le_mca.c,v 1.21 2019/04/09 04:04:04 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_le_mca.c,v 1.20 2019/04/09 03:56:08 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_le_mca.c,v 1.21 2019/04/09 04:04:04 msaitoh Exp $");
 
 #include 
 #include 
@@ -104,7 +104,7 @@ CFATTACH_DECL_NEW(le_mca, sizeof(struct 
 static const uint8_t sknet_mcp_irq[] = {
 	3, 5, 10, 11
 };
-static const uint8_t sknet_mcp_media[] = {
+static const int sknet_mcp_media[] = {
 	IFM_ETHER | IFM_10_2,
 	IFM_ETHER | IFM_10_T,
 	IFM_ETHER | IFM_10_5,
@@ -131,7 +131,8 @@ le_mca_attach(device_t parent, device_t 
 	struct le_mca_softc *lesc = device_private(self);
 	struct lance_softc *sc = >sc_am7990.lsc;
 	struct mca_attach_args *ma = aux;
-	int i, pos2, pos3, pos4, irq, membase, supmedia=0;
+	int i, pos2, pos3, pos4, irq, membase;
+	const int *supmedia = NULL;
 	const char *typestr;
 
 	sc->sc_dev = self;
@@ -205,7 +206,7 @@ le_mca_attach(device_t parent, device_t 
 		membase = 0xc + ((pos3 & 0x0f) * 0x4000);
 
 		/* Get configured media type */
-		supmedia = sknet_mcp_media[(pos4 & 0xc0) >> 6];
+		supmedia = _mcp_media[(pos4 & 0xc0) >> 6];
 		break;
 	default:
 		aprint_error(": unknown product %d\n", ma->ma_id);
@@ -250,10 +251,10 @@ le_mca_attach(device_t parent, device_t 
 	 * This is merely cosmetic since it's not possible to switch
 	 * the media anyway, even for MC2+.
 	 */
-	if (supmedia != 0) {
-		sc->sc_supmedia = 
+	if (supmedia != NULL) {
+		sc->sc_supmedia = supmedia;
 		sc->sc_nsupmedia = 1;
-		sc->sc_defaultmedia = supmedia;
+		sc->sc_defaultmedia = *supmedia;
 	}
 
 	lesc->sc_ih = mca_intr_establish(ma->ma_mc, irq, IPL_NET,



CVS commit: src/sys/dev/mca

2019-04-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Apr  9 04:04:04 UTC 2019

Modified Files:
src/sys/dev/mca: if_le_mca.c

Log Message:
 Fix a bug that the supported media can't passed correctly. Not tested.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/mca/if_le_mca.c

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



CVS commit: src/sys/dev/mca

2019-04-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Apr  9 03:56:08 UTC 2019

Modified Files:
src/sys/dev/mca: if_le_mca.c

Log Message:
 KNF. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/mca/if_le_mca.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/mca/if_le_mca.c
diff -u src/sys/dev/mca/if_le_mca.c:1.19 src/sys/dev/mca/if_le_mca.c:1.20
--- src/sys/dev/mca/if_le_mca.c:1.19	Sat Nov 13 13:52:04 2010
+++ src/sys/dev/mca/if_le_mca.c	Tue Apr  9 03:56:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_le_mca.c,v 1.19 2010/11/13 13:52:04 uebayasi Exp $	*/
+/*	$NetBSD: if_le_mca.c,v 1.20 2019/04/09 03:56:08 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_le_mca.c,v 1.19 2010/11/13 13:52:04 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_le_mca.c,v 1.20 2019/04/09 03:56:08 msaitoh Exp $");
 
 #include 
 #include 
@@ -73,9 +73,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_le_mca.c,
 
 #include 
 
-int 	le_mca_match(device_t, cfdata_t, void *);
-void	le_mca_attach(device_t, device_t, void *);
-
 struct le_mca_softc {
 	struct	am7990_softc sc_am7990;	/* glue to MI code */
 
@@ -84,10 +81,13 @@ struct le_mca_softc {
 	bus_space_handle_t sc_memh;
 };
 
-static void le_mca_wrcsr(struct lance_softc *, uint16_t, uint16_t);
-static uint16_t le_mca_rdcsr(struct lance_softc *, uint16_t);
-static void le_mca_hwreset(struct lance_softc *);
-static int le_mca_intredge(void *);
+static int 	le_mca_match(device_t, cfdata_t, void *);
+static void	le_mca_attach(device_t, device_t, void *);
+
+static void	le_mca_wrcsr(struct lance_softc *, uint16_t, uint16_t);
+static uint16_t	le_mca_rdcsr(struct lance_softc *, uint16_t);
+static void	le_mca_hwreset(struct lance_softc *);
+static int	le_mca_intredge(void *);
 
 static void	le_mca_copytobuf(struct lance_softc *, void *, int, int);
 static void	le_mca_copyfrombuf(struct lance_softc *, void *, int, int);
@@ -101,13 +101,13 @@ CFATTACH_DECL_NEW(le_mca, sizeof(struct 
 le_mca_match, le_mca_attach, NULL, NULL);
 
 /* SKNET MC+ POS mapping */
-static const u_int8_t sknet_mcp_irq[] = {
+static const uint8_t sknet_mcp_irq[] = {
 	3, 5, 10, 11
 };
-static const u_int8_t sknet_mcp_media[] = {
-	IFM_ETHER|IFM_10_2,
-	IFM_ETHER|IFM_10_T,
-	IFM_ETHER|IFM_10_5,
+static const uint8_t sknet_mcp_media[] = {
+	IFM_ETHER | IFM_10_2,
+	IFM_ETHER | IFM_10_T,
+	IFM_ETHER | IFM_10_5,
 	0
 };
 
@@ -119,10 +119,10 @@ le_mca_match(device_t parent, cfdata_t c
 	switch(ma->ma_id) {
 	case MCA_PRODUCT_SKNETPER:
 	case MCA_PRODUCT_SKNETG:
-		return (1);
+		return 1;
 	}
 
-	return (0);
+	return 0;
 }
 
 void
@@ -281,10 +281,10 @@ le_mca_intredge(void *arg)
 	 */
 
 	if (am7990_intr(arg) == 0)
-		return (0);
+		return 0;
 	for(;;)
 		if (am7990_intr(arg) == 0)
-			return (1);
+			return 1;
 }
 
 /*
@@ -348,8 +348,7 @@ le_mca_copytobuf(struct lance_softc *sc,
 {
 	struct le_mca_softc *lsc = (struct le_mca_softc *)sc;
 
-	bus_space_write_region_1(lsc->sc_memt, lsc->sc_memh, boff,
-	from, len);
+	bus_space_write_region_1(lsc->sc_memt, lsc->sc_memh, boff, from, len);
 }
 
 static void
@@ -357,8 +356,7 @@ le_mca_copyfrombuf(struct lance_softc *s
 {
 	struct le_mca_softc *lsc = (struct le_mca_softc *)sc;
 
-	bus_space_read_region_1(lsc->sc_memt, lsc->sc_memh, boff,
-	to, len);
+	bus_space_read_region_1(lsc->sc_memt, lsc->sc_memh, boff, to, len);
 }
 
 static void
@@ -366,6 +364,5 @@ le_mca_zerobuf(struct lance_softc *sc, i
 {
 	struct le_mca_softc *lsc = (struct le_mca_softc *)sc;
 
-	bus_space_set_region_1(lsc->sc_memt, lsc->sc_memh, boff,
-	0x00, len);
+	bus_space_set_region_1(lsc->sc_memt, lsc->sc_memh, boff, 0x00, len);
 }



CVS commit: src/sys/dev/mca

2019-04-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Apr  9 03:56:08 UTC 2019

Modified Files:
src/sys/dev/mca: if_le_mca.c

Log Message:
 KNF. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/mca/if_le_mca.c

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



CVS commit: src/sys/arch/sh3/sh3

2019-04-08 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Apr  9 00:36:55 UTC 2019

Modified Files:
src/sys/arch/sh3/sh3: kobj_machdep.c

Log Message:
Fix previous.  P is the final (relocated) address not just the offset.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sh3/sh3/kobj_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/sh3/sh3/kobj_machdep.c
diff -u src/sys/arch/sh3/sh3/kobj_machdep.c:1.6 src/sys/arch/sh3/sh3/kobj_machdep.c:1.7
--- src/sys/arch/sh3/sh3/kobj_machdep.c:1.6	Tue Apr  9 00:16:30 2019
+++ src/sys/arch/sh3/sh3/kobj_machdep.c	Tue Apr  9 00:36:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kobj_machdep.c,v 1.6 2019/04/09 00:16:30 uwe Exp $	*/
+/*	$NetBSD: kobj_machdep.c,v 1.7 2019/04/09 00:36:55 uwe Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.6 2019/04/09 00:16:30 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.7 2019/04/09 00:36:55 uwe Exp $");
 
 #define	ELFSIZE		ARCH_ELFSIZE
 
@@ -71,7 +71,7 @@ kobj_reloc(kobj_t ko, uintptr_t relocbas
 
 		tmp = (Elf_Addr)(addr + *where + rela->r_addend);
 		if (rtype == R_TYPE(REL32))
-			tmp -= rela->r_offset;
+			tmp -= (uintptr_t)where;
 		*where = tmp;
 		break;
 



CVS commit: src/sys/arch/sh3/sh3

2019-04-08 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Apr  9 00:36:55 UTC 2019

Modified Files:
src/sys/arch/sh3/sh3: kobj_machdep.c

Log Message:
Fix previous.  P is the final (relocated) address not just the offset.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sh3/sh3/kobj_machdep.c

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



CVS commit: src/sys/arch/sh3/sh3

2019-04-08 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Apr  9 00:16:30 UTC 2019

Modified Files:
src/sys/arch/sh3/sh3: kobj_machdep.c

Log Message:
Support R_SH_REL32 (encountered in .eh_frame).


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sh3/sh3/kobj_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/sh3/sh3/kobj_machdep.c
diff -u src/sys/arch/sh3/sh3/kobj_machdep.c:1.5 src/sys/arch/sh3/sh3/kobj_machdep.c:1.6
--- src/sys/arch/sh3/sh3/kobj_machdep.c:1.5	Fri Nov  3 09:59:08 2017
+++ src/sys/arch/sh3/sh3/kobj_machdep.c	Tue Apr  9 00:16:30 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kobj_machdep.c,v 1.5 2017/11/03 09:59:08 maxv Exp $	*/
+/*	$NetBSD: kobj_machdep.c,v 1.6 2019/04/09 00:16:30 uwe Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.5 2017/11/03 09:59:08 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.6 2019/04/09 00:16:30 uwe Exp $");
 
 #define	ELFSIZE		ARCH_ELFSIZE
 
@@ -64,11 +64,14 @@ kobj_reloc(kobj_t ko, uintptr_t relocbas
 		break;
 
 	case R_TYPE(DIR32):
+	case R_TYPE(REL32):
 		error = kobj_sym_lookup(ko, symidx, );
 		if (error)
 			return -1;
 
 		tmp = (Elf_Addr)(addr + *where + rela->r_addend);
+		if (rtype == R_TYPE(REL32))
+			tmp -= rela->r_offset;
 		*where = tmp;
 		break;
 



CVS commit: src/sys/arch/sh3/sh3

2019-04-08 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Apr  9 00:16:30 UTC 2019

Modified Files:
src/sys/arch/sh3/sh3: kobj_machdep.c

Log Message:
Support R_SH_REL32 (encountered in .eh_frame).


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sh3/sh3/kobj_machdep.c

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



CVS commit: src/sys/arch/aarch64

2019-04-08 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Mon Apr  8 21:18:22 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: pmap.c
src/sys/arch/aarch64/include: asan.h pmap.h

Log Message:
- free empty page tables pages if reach a certain usage.
- need to lock at removing an old pg (_pmap_remove_pv) in _pmap_enter()


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/aarch64/aarch64/pmap.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/aarch64/include/asan.h
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/aarch64/include/pmap.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/aarch64/aarch64/pmap.c
diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.39 src/sys/arch/aarch64/aarch64/pmap.c:1.40
--- src/sys/arch/aarch64/aarch64/pmap.c:1.39	Sat Apr  6 18:30:20 2019
+++ src/sys/arch/aarch64/aarch64/pmap.c	Mon Apr  8 21:18:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.39 2019/04/06 18:30:20 ryo Exp $	*/
+/*	$NetBSD: pmap.c,v 1.40 2019/04/08 21:18:22 ryo Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.39 2019/04/06 18:30:20 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.40 2019/04/08 21:18:22 ryo Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -194,6 +194,7 @@ struct pv_entry {
 #define pv_next	pv_link.tqe_next
 
 #define L3INDEXMASK	(L3_SIZE * Ln_ENTRIES - 1)
+#define PDPSWEEP_TRIGGER	512
 
 void atomic_add_16(volatile uint16_t *, int16_t);
 uint16_t atomic_add_16_nv(volatile uint16_t *, int16_t);
@@ -439,6 +440,7 @@ pmap_bootstrap(vaddr_t vstart, vaddr_t v
 	kpm = pmap_kernel();
 	kpm->pm_asid = 0;
 	kpm->pm_refcnt = 1;
+	kpm->pm_idlepdp = 0;
 	kpm->pm_l0table = l0;
 	kpm->pm_l0table_pa = l0pa;
 	kpm->pm_activated = true;
@@ -564,7 +566,7 @@ pmap_reference(struct pmap *pm)
 }
 
 paddr_t
-pmap_alloc_pdp(struct pmap *pm, struct vm_page **pgp, bool waitok)
+pmap_alloc_pdp(struct pmap *pm, struct vm_page **pgp, int flags, bool waitok)
 {
 	paddr_t pa;
 	struct vm_page *pg;
@@ -573,9 +575,10 @@ pmap_alloc_pdp(struct pmap *pm, struct v
 	UVMHIST_CALLED(pmaphist);
 
 	if (uvm.page_init_done) {
+		int aflags = ((flags & PMAP_CANFAIL) ? 0 : UVM_PGA_USERESERVE) |
+		UVM_PGA_ZERO;
  retry:
-		pg = uvm_pagealloc(NULL, 0, NULL,
-		UVM_PGA_USERESERVE | UVM_PGA_ZERO);
+		pg = uvm_pagealloc(NULL, 0, NULL, aflags);
 		if (pg == NULL) {
 			if (waitok) {
 uvm_wait("pmap_alloc_pdp");
@@ -620,6 +623,61 @@ pmap_free_pdp(struct pmap *pm, struct vm
 	PMAP_COUNT(pdp_free);
 }
 
+/* free empty page table pages */
+static int
+_pmap_sweep_pdp(struct pmap *pm)
+{
+	struct vm_page *pg, *tmp;
+	pd_entry_t *ptep_in_parent, opte;
+	paddr_t pa, pdppa;
+	int nsweep;
+	uint16_t wirecount;
+
+	nsweep = 0;
+	TAILQ_FOREACH_SAFE(pg, >pm_vmlist, mdpage.mdpg_vmlist, tmp) {
+		if (pg->wire_count != 1)
+			continue;
+
+		pa = VM_PAGE_TO_PHYS(pg);
+		if (pa == pm->pm_l0table_pa)
+			continue;
+
+		ptep_in_parent = VM_PAGE_TO_MD(pg)->mdpg_ptep_parent;
+		if (ptep_in_parent == NULL) {
+			/* no parent */
+			pmap_free_pdp(pm, pg);
+			nsweep++;
+			continue;
+		}
+
+		/* unlink from parent */
+		opte = atomic_swap_64(ptep_in_parent, 0);
+		KASSERT(lxpde_valid(opte));
+		wirecount = atomic_add_16_nv(>wire_count, -1); /* 1 -> 0 */
+		KASSERT(wirecount == 0);
+		pmap_free_pdp(pm, pg);
+		nsweep++;
+
+		/* L3->L2->L1. no need for L0 */
+		pdppa = AARCH64_KVA_TO_PA(trunc_page((vaddr_t)ptep_in_parent));
+		if (pdppa == pm->pm_l0table_pa)
+			continue;
+
+		pg = PHYS_TO_VM_PAGE(pdppa);
+		KASSERT(pg != NULL);
+		KASSERTMSG(pg->wire_count >= 1,
+		"wire_count=%d", pg->wire_count);
+		/* decrement wire_count of parent */
+		wirecount = atomic_add_16_nv(>wire_count, -1);
+		KASSERTMSG(pg->wire_count <= (Ln_ENTRIES + 1),
+		"pm=%p[%d], pg=%p, wire_count=%d",
+		pm, pm->pm_asid, pg, pg->wire_count);
+	}
+	atomic_swap_uint(>pm_idlepdp, 0);
+
+	return nsweep;
+}
+
 static void
 _pmap_free_pdp_all(struct pmap *pm)
 {
@@ -1270,11 +1328,12 @@ pmap_create(void)
 	pm = pool_cache_get(&_pmap_cache, PR_WAITOK);
 	memset(pm, 0, sizeof(*pm));
 	pm->pm_refcnt = 1;
+	pm->pm_idlepdp = 0;
 	pm->pm_asid = -1;
 	TAILQ_INIT(>pm_vmlist);
 	mutex_init(>pm_lock, MUTEX_DEFAULT, IPL_VM);
 
-	pm->pm_l0table_pa = pmap_alloc_pdp(pm, NULL, true);
+	pm->pm_l0table_pa = pmap_alloc_pdp(pm, NULL, 0, true);
 	KASSERT(pm->pm_l0table_pa != POOL_PADDR_INVALID);
 	pm->pm_l0table = (pd_entry_t *)AARCH64_PA_TO_KVA(pm->pm_l0table_pa);
 	KASSERT(((vaddr_t)pm->pm_l0table & (PAGE_SIZE - 1)) == 0);
@@ -1379,14 +1438,21 @@ _pmap_pdp_delref(struct pmap *pm, paddr_
 
 	wirecount = atomic_add_16_nv(>wire_count, -1);
 
-	if (!do_free_pdp)
+	if (!do_free_pdp) {
+		/*
+		 * pm_idlepdp is counted by only pmap_page_protect() with
+		 * VM_PROT_NONE. it is not correct because without considering
+		 * pmap_enter(), but useful hint to just sweep.
+		 */
+		if (wirecount 

CVS commit: src/sys/arch/aarch64

2019-04-08 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Mon Apr  8 21:18:22 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: pmap.c
src/sys/arch/aarch64/include: asan.h pmap.h

Log Message:
- free empty page tables pages if reach a certain usage.
- need to lock at removing an old pg (_pmap_remove_pv) in _pmap_enter()


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/aarch64/aarch64/pmap.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/aarch64/include/asan.h
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/aarch64/include/pmap.h

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



CVS commit: src/usr.sbin/screenblank

2019-04-08 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Mon Apr  8 20:18:15 UTC 2019

Modified Files:
src/usr.sbin/screenblank: screenblank.1

Log Message:
Offer a potential workaround to the caveat.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/screenblank/screenblank.1

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/screenblank/screenblank.1
diff -u src/usr.sbin/screenblank/screenblank.1:1.17 src/usr.sbin/screenblank/screenblank.1:1.18
--- src/usr.sbin/screenblank/screenblank.1:1.17	Sat Dec 29 18:34:59 2018
+++ src/usr.sbin/screenblank/screenblank.1	Mon Apr  8 20:18:14 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: screenblank.1,v 1.17 2018/12/29 18:34:59 wiz Exp $
+.\"	$NetBSD: screenblank.1,v 1.18 2019/04/08 20:18:14 sevan Exp $
 .\"
 .\" Copyright (c) 1996-2002 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd December 28, 2018
+.Dd April 8, 2019
 .Dt SCREENBLANK 1
 .Os
 .Sh NAME
@@ -125,3 +125,9 @@ If the devices are on a file system moun
 and/or
 .Cm nodevmtime
 options, it will not function as expected.
+A possible workaround is to use a script as such:
+.Bd -literal -offset indent
+#!/bin/sh
+/usr/sbin/screenblank -d 0 -e 0 && read
+/usr/bin/pkill screenblank
+.Ed



CVS commit: src/usr.sbin/screenblank

2019-04-08 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Mon Apr  8 20:18:15 UTC 2019

Modified Files:
src/usr.sbin/screenblank: screenblank.1

Log Message:
Offer a potential workaround to the caveat.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/screenblank/screenblank.1

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



CVS commit: src/lib/libc/time

2019-04-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr  8 18:50:52 UTC 2019

Modified Files:
src/lib/libc/time: localtime.c

Log Message:
The typecnt refers the to ttis array and the timecnt refers to the type array.
The types array can have 0 elements (i.e. timecnt == 0), but the ttis array
needs to have one element (typecnt >= 1). Need to revisit and take into
account the types array.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/lib/libc/time/localtime.c

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

Modified files:

Index: src/lib/libc/time/localtime.c
diff -u src/lib/libc/time/localtime.c:1.119 src/lib/libc/time/localtime.c:1.120
--- src/lib/libc/time/localtime.c:1.119	Sun Apr  7 10:58:25 2019
+++ src/lib/libc/time/localtime.c	Mon Apr  8 14:50:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.119 2019/04/07 14:58:25 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.120 2019/04/08 18:50:52 christos Exp $	*/
 
 /* Convert timestamp from time_t to struct tm.  */
 
@@ -12,7 +12,7 @@
 #if 0
 static char	elsieid[] = "@(#)localtime.c	8.17";
 #else
-__RCSID("$NetBSD: localtime.c,v 1.119 2019/04/07 14:58:25 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.120 2019/04/08 18:50:52 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -289,7 +289,7 @@ tzgetname(const timezone_t sp, int isdst
 {
 	int i;
 	for (i = 0; i < sp->typecnt; ++i) {
-		const struct ttinfo *const ttisp = >ttis[sp->types[i]];
+		const struct ttinfo *const ttisp = >ttis[i];
 		if (ttisp->tt_isdst == isdst)
 			return >chars[ttisp->tt_abbrind];
 	}
@@ -303,12 +303,10 @@ tzgetgmtoff(const timezone_t sp, int isd
 	int i;
 	long l = -1;
 	for (i = 0; i < sp->typecnt; ++i) {
-		const struct ttinfo *const ttisp = >ttis[sp->types[i]];
+		const struct ttinfo *const ttisp = >ttis[i];
 
 		if (ttisp->tt_isdst == isdst) {
 			l = ttisp->tt_gmtoff;
-			if (sp->types[i] != 0)
-return l;
 		}
 	}
 	if (l == -1)
@@ -1394,7 +1392,6 @@ zoneinit(struct state *sp, char const *n
 		sp->typecnt = 1;
 		sp->charcnt = 0;
 		sp->goback = sp->goahead = false;
-		sp->types[0] = 0;
 		init_ttinfo(>ttis[0], 0, false, 0);
 		strcpy(sp->chars, gmt);
 		sp->defaulttype = 0;



CVS commit: src/lib/libc/time

2019-04-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr  8 18:50:52 UTC 2019

Modified Files:
src/lib/libc/time: localtime.c

Log Message:
The typecnt refers the to ttis array and the timecnt refers to the type array.
The types array can have 0 elements (i.e. timecnt == 0), but the ttis array
needs to have one element (typecnt >= 1). Need to revisit and take into
account the types array.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/lib/libc/time/localtime.c

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



CVS commit: src/sys/kern

2019-04-08 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Apr  8 18:38:45 UTC 2019

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

Log Message:
Reset so_cred to NULL after freeing it, because close() may leave the PCB
in pcblist, and we don't want a future lookup (via eg netstat) to read
freed data.

Detected by KASAN, reported by Alexander Nasonov.


To generate a diff of this commit:
cvs rdiff -u -r1.272 -r1.273 src/sys/kern/uipc_socket.c

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



CVS commit: src/sys/kern

2019-04-08 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Apr  8 18:38:45 UTC 2019

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

Log Message:
Reset so_cred to NULL after freeing it, because close() may leave the PCB
in pcblist, and we don't want a future lookup (via eg netstat) to read
freed data.

Detected by KASAN, reported by Alexander Nasonov.


To generate a diff of this commit:
cvs rdiff -u -r1.272 -r1.273 src/sys/kern/uipc_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/kern/uipc_socket.c
diff -u src/sys/kern/uipc_socket.c:1.272 src/sys/kern/uipc_socket.c:1.273
--- src/sys/kern/uipc_socket.c:1.272	Sun Mar 31 19:54:36 2019
+++ src/sys/kern/uipc_socket.c	Mon Apr  8 18:38:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_socket.c,v 1.272 2019/03/31 19:54:36 maxv Exp $	*/
+/*	$NetBSD: uipc_socket.c,v 1.273 2019/04/08 18:38:45 maxv Exp $	*/
 
 /*
  * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.272 2019/03/31 19:54:36 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.273 2019/04/08 18:38:45 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -749,6 +749,7 @@ soclose(struct socket *so)
  discard:
 	KASSERT((so->so_state & SS_NOFDREF) == 0);
 	kauth_cred_free(so->so_cred);
+	so->so_cred = NULL;
 	so->so_state |= SS_NOFDREF;
 	sofree(so);
 	return error;



Re: CVS commit: src/sys/dev/nvmm

2019-04-08 Thread Maxime Villard

Le 08/04/2019 à 09:57, Paul Goyette a écrit :

On Mon, 8 Apr 2019, Maxime Villard wrote:


The reason I use MODULE_CLASS_ANY in both NVMM and KCOV is because this
class is invoked late in the boot process (init_main.c). Eg NVMM will use
allocators/xcalls which are not yet initialized in MODULE_CLASS_DRIVER,
but are in MODULE_CLASS_ANY.


No, at that late point in the boot process we load/activate all remaining 
modules without looking at their class at all!  Please see
the MODULE_CALSS_MATCH() macro at

 https://nxr.netbsd.org/xref/src/sys/kern/kern_module.c#130

Also please note that the module(9) man page explicitly lists the
valid entries for the MODULE(class, ...) macro, and MODULE_CLASS_ANY is _not_ 
listed.

We're not loading "modules whose class is MODULE_CLASS_ANY" we are
loading "all remaining modules".

Please update your module to use MODULE_CLASS_MISC (or let me know
and I can do it).


Fixed, indeed it should have been _MISC and not _ANY. However autoloading
still doesn't work, because it expects _DRIVER, and NVMM can't work with
_DRIVER.


CVS commit: src/sys/dev/nvmm

2019-04-08 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Apr  8 18:30:55 UTC 2019

Modified Files:
src/sys/dev/nvmm: nvmm.c

Log Message:
Switch to MODULE_CLASS_MISC, from pgoyette@.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/nvmm/nvmm.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/nvmm/nvmm.c
diff -u src/sys/dev/nvmm/nvmm.c:1.15 src/sys/dev/nvmm/nvmm.c:1.16
--- src/sys/dev/nvmm/nvmm.c:1.15	Mon Apr  8 18:23:46 2019
+++ src/sys/dev/nvmm/nvmm.c	Mon Apr  8 18:30:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm.c,v 1.15 2019/04/08 18:23:46 maxv Exp $	*/
+/*	$NetBSD: nvmm.c,v 1.16 2019/04/08 18:30:54 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.15 2019/04/08 18:23:46 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.16 2019/04/08 18:30:54 maxv Exp $");
 
 #include 
 #include 
@@ -978,7 +978,7 @@ nvmmattach(int nunits)
 	/* nothing */
 }
 
-MODULE(MODULE_CLASS_ANY, nvmm, NULL);
+MODULE(MODULE_CLASS_MISC, nvmm, NULL);
 
 static int
 nvmm_modcmd(modcmd_t cmd, void *arg)



CVS commit: src/sys/dev/nvmm

2019-04-08 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Apr  8 18:30:55 UTC 2019

Modified Files:
src/sys/dev/nvmm: nvmm.c

Log Message:
Switch to MODULE_CLASS_MISC, from pgoyette@.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/nvmm/nvmm.c

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



CVS commit: src/sys/dev/nvmm

2019-04-08 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Apr  8 18:23:47 UTC 2019

Modified Files:
src/sys/dev/nvmm: nvmm.c

Log Message:
Don't forget to call (*machine_destroy) when killing VMs.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/nvmm/nvmm.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/nvmm/nvmm.c
diff -u src/sys/dev/nvmm/nvmm.c:1.14 src/sys/dev/nvmm/nvmm.c:1.15
--- src/sys/dev/nvmm/nvmm.c:1.14	Mon Apr  8 18:21:42 2019
+++ src/sys/dev/nvmm/nvmm.c	Mon Apr  8 18:23:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm.c,v 1.14 2019/04/08 18:21:42 maxv Exp $	*/
+/*	$NetBSD: nvmm.c,v 1.15 2019/04/08 18:23:46 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.14 2019/04/08 18:21:42 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.15 2019/04/08 18:23:46 maxv Exp $");
 
 #include 
 #include 
@@ -222,6 +222,7 @@ nvmm_kill_machines(struct nvmm_owner *ow
 			nvmm_vcpu_free(mach, vcpu);
 			nvmm_vcpu_put(vcpu);
 		}
+		(*nvmm_impl->machine_destroy)(mach);
 		uvmspace_free(mach->vm);
 
 		/* Drop the kernel UOBJ refs. */



CVS commit: src/sys/dev/nvmm

2019-04-08 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Apr  8 18:23:47 UTC 2019

Modified Files:
src/sys/dev/nvmm: nvmm.c

Log Message:
Don't forget to call (*machine_destroy) when killing VMs.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/nvmm/nvmm.c

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



CVS commit: src/sys/dev/nvmm

2019-04-08 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Apr  8 18:21:42 UTC 2019

Modified Files:
src/sys/dev/nvmm: nvmm.c nvmm_internal.h

Log Message:
Use the fd_clone approach, to avoid losing references to the registered
VMs during fork(). We attach an nvmm_owner struct to the fd, reference it
in each VM, and identify the process' VMs by just comparing the pointer.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/nvmm/nvmm.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/nvmm/nvmm_internal.h

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



CVS commit: src/sys/dev/nvmm

2019-04-08 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Apr  8 18:21:42 UTC 2019

Modified Files:
src/sys/dev/nvmm: nvmm.c nvmm_internal.h

Log Message:
Use the fd_clone approach, to avoid losing references to the registered
VMs during fork(). We attach an nvmm_owner struct to the fd, reference it
in each VM, and identify the process' VMs by just comparing the pointer.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/nvmm/nvmm.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/nvmm/nvmm_internal.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/nvmm/nvmm.c
diff -u src/sys/dev/nvmm/nvmm.c:1.13 src/sys/dev/nvmm/nvmm.c:1.14
--- src/sys/dev/nvmm/nvmm.c:1.13	Sun Apr  7 14:05:15 2019
+++ src/sys/dev/nvmm/nvmm.c	Mon Apr  8 18:21:42 2019
@@ -1,7 +1,7 @@
-/*	$NetBSD: nvmm.c,v 1.13 2019/04/07 14:05:15 maxv Exp $	*/
+/*	$NetBSD: nvmm.c,v 1.14 2019/04/08 18:21:42 maxv Exp $	*/
 
 /*
- * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.13 2019/04/07 14:05:15 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.14 2019/04/08 18:21:42 maxv Exp $");
 
 #include 
 #include 
@@ -42,6 +42,8 @@ __KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.1
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -98,7 +100,8 @@ nvmm_machine_free(struct nvmm_machine *m
 }
 
 static int
-nvmm_machine_get(nvmm_machid_t machid, struct nvmm_machine **ret, bool writer)
+nvmm_machine_get(struct nvmm_owner *owner, nvmm_machid_t machid,
+struct nvmm_machine **ret, bool writer)
 {
 	struct nvmm_machine *mach;
 	krw_t op = writer ? RW_WRITER : RW_READER;
@@ -113,7 +116,7 @@ nvmm_machine_get(nvmm_machid_t machid, s
 		rw_exit(>lock);
 		return ENOENT;
 	}
-	if (mach->procid != curproc->p_pid) {
+	if (mach->owner != owner) {
 		rw_exit(>lock);
 		return EPERM;
 	}
@@ -194,7 +197,7 @@ nvmm_vcpu_put(struct nvmm_cpu *vcpu)
 /* -- */
 
 static void
-nvmm_kill_machines(pid_t pid)
+nvmm_kill_machines(struct nvmm_owner *owner)
 {
 	struct nvmm_machine *mach;
 	struct nvmm_cpu *vcpu;
@@ -205,7 +208,7 @@ nvmm_kill_machines(pid_t pid)
 		mach = [i];
 
 		rw_enter(>lock, RW_WRITER);
-		if (!mach->present || mach->procid != pid) {
+		if (!mach->present || mach->owner != owner) {
 			rw_exit(>lock);
 			continue;
 		}
@@ -237,7 +240,7 @@ nvmm_kill_machines(pid_t pid)
 /* -- */
 
 static int
-nvmm_capability(struct nvmm_ioc_capability *args)
+nvmm_capability(struct nvmm_owner *owner, struct nvmm_ioc_capability *args)
 {
 	args->cap.version = NVMM_CAPABILITY_VERSION;
 	args->cap.state_size = nvmm_impl->state_size;
@@ -251,7 +254,8 @@ nvmm_capability(struct nvmm_ioc_capabili
 }
 
 static int
-nvmm_machine_create(struct nvmm_ioc_machine_create *args)
+nvmm_machine_create(struct nvmm_owner *owner,
+struct nvmm_ioc_machine_create *args)
 {
 	struct nvmm_machine *mach;
 	int error;
@@ -261,7 +265,7 @@ nvmm_machine_create(struct nvmm_ioc_mach
 		return error;
 
 	/* Curproc owns the machine. */
-	mach->procid = curproc->p_pid;
+	mach->owner = owner;
 
 	/* Zero out the host mappings. */
 	memset(>hmap, 0, sizeof(mach->hmap));
@@ -280,14 +284,15 @@ nvmm_machine_create(struct nvmm_ioc_mach
 }
 
 static int
-nvmm_machine_destroy(struct nvmm_ioc_machine_destroy *args)
+nvmm_machine_destroy(struct nvmm_owner *owner,
+struct nvmm_ioc_machine_destroy *args)
 {
 	struct nvmm_machine *mach;
 	struct nvmm_cpu *vcpu;
 	int error;
 	size_t i;
 
-	error = nvmm_machine_get(args->machid, , true);
+	error = nvmm_machine_get(owner, args->machid, , true);
 	if (error)
 		return error;
 
@@ -320,7 +325,8 @@ nvmm_machine_destroy(struct nvmm_ioc_mac
 }
 
 static int
-nvmm_machine_configure(struct nvmm_ioc_machine_configure *args)
+nvmm_machine_configure(struct nvmm_owner *owner,
+struct nvmm_ioc_machine_configure *args)
 {
 	struct nvmm_machine *mach;
 	size_t allocsz;
@@ -334,7 +340,7 @@ nvmm_machine_configure(struct nvmm_ioc_m
 	allocsz = nvmm_impl->conf_sizes[args->op];
 	data = kmem_alloc(allocsz, KM_SLEEP);
 
-	error = nvmm_machine_get(args->machid, , true);
+	error = nvmm_machine_get(owner, args->machid, , true);
 	if (error) {
 		kmem_free(data, allocsz);
 		return error;
@@ -354,13 +360,13 @@ out:
 }
 
 static int
-nvmm_vcpu_create(struct nvmm_ioc_vcpu_create *args)
+nvmm_vcpu_create(struct nvmm_owner *owner, struct nvmm_ioc_vcpu_create *args)
 {
 	struct nvmm_machine *mach;
 	struct nvmm_cpu *vcpu;
 	int error;
 
-	error = nvmm_machine_get(args->machid, , false);
+	error = nvmm_machine_get(owner, args->machid, , false);
 	if (error)
 		return error;
 

CVS commit: src/sys/dev/pci

2019-04-08 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Mon Apr  8 15:35:57 UTC 2019

Modified Files:
src/sys/dev/pci: yds.c

Log Message:
Fix minor bugs.
- sc_lock should use an adaptive lock.
- yds_round_blocksize: fix typo.
- yds_trigger_output: fix typo. SlotControlData is pbankoff.
   ptbloff points to ControlData.
- yds_halt_input: fix wrong and extra sc_rec.intr.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/pci/yds.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/pci/yds.c
diff -u src/sys/dev/pci/yds.c:1.60 src/sys/dev/pci/yds.c:1.61
--- src/sys/dev/pci/yds.c:1.60	Sun Dec  9 11:14:02 2018
+++ src/sys/dev/pci/yds.c	Mon Apr  8 15:35:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: yds.c,v 1.60 2018/12/09 11:14:02 jdolecek Exp $	*/
+/*	$NetBSD: yds.c,v 1.61 2019/04/08 15:35:57 isaki Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001 Kazuki Sakamoto and Minoura Makoto.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: yds.c,v 1.60 2018/12/09 11:14:02 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: yds.c,v 1.61 2019/04/08 15:35:57 isaki Exp $");
 
 #include "mpu.h"
 
@@ -771,7 +771,7 @@ yds_attach(device_t parent, device_t sel
 		return;
 	}
 
-	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_AUDIO); /* XXX IPL_NONE? */
+	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(>sc_intr_lock, MUTEX_DEFAULT, IPL_AUDIO);
 
 	intrstr = pci_intr_string(pc, ih, intrbuf, sizeof(intrbuf));
@@ -1284,7 +1284,7 @@ yds_round_blocksize(void *addr, int blk,
 	if (blk < 1024)
 		blk = 1024;
 
-	return blk & ~4;
+	return blk & ~3;
 }
 
 static uint32_t
@@ -1455,7 +1455,7 @@ yds_trigger_output(void *addr, void *sta
 	/* Now the play slot for the next frame is set up!! */
 	/* Sync play slot control data for both directions */
 	bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map,
-			sc->ptbloff,
+			sc->pbankoff,
 			sizeof(struct play_slot_ctrl_bank) *
 			channels * N_PLAY_SLOT_CTRL_BANK,
 			BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD);
@@ -1613,11 +1613,10 @@ yds_halt_input(void *addr)
 
 	DPRINTF(("yds: yds_halt_input\n"));
 	sc = addr;
-	sc->sc_rec.intr = NULL;
 	if (sc->sc_rec.intr) {
+		sc->sc_rec.intr = NULL;
 		/* Stop the rec slot operation */
 		YWRITE4(sc, YDS_MAPOF_REC, 0);
-		sc->sc_rec.intr = 0;
 		/* Sync rec slot control data */
 		bus_dmamap_sync(sc->sc_dmatag, sc->sc_ctrldata.map,
 sc->rbankoff,



CVS commit: src/sys/dev/pci

2019-04-08 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Mon Apr  8 15:35:57 UTC 2019

Modified Files:
src/sys/dev/pci: yds.c

Log Message:
Fix minor bugs.
- sc_lock should use an adaptive lock.
- yds_round_blocksize: fix typo.
- yds_trigger_output: fix typo. SlotControlData is pbankoff.
   ptbloff points to ControlData.
- yds_halt_input: fix wrong and extra sc_rec.intr.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/pci/yds.c

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



CVS commit: src/sys/arch/vax/vsa

2019-04-08 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Mon Apr  8 14:48:33 UTC 2019

Modified Files:
src/sys/arch/vax/vsa: vsaudio.c

Log Message:
White space -> TAB, fix indent, and add RCS Id.
No functional changes intended.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/vax/vsa/vsaudio.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/vax/vsa/vsaudio.c
diff -u src/sys/arch/vax/vsa/vsaudio.c:1.3 src/sys/arch/vax/vsa/vsaudio.c:1.4
--- src/sys/arch/vax/vsa/vsaudio.c:1.3	Sat Mar 16 12:09:57 2019
+++ src/sys/arch/vax/vsa/vsaudio.c	Mon Apr  8 14:48:33 2019
@@ -1,3 +1,4 @@
+/*	$NetBSD: vsaudio.c,v 1.4 2019/04/08 14:48:33 isaki Exp $	*/
 /*	$OpenBSD: vsaudio.c,v 1.4 2013/05/15 21:21:11 ratchov Exp $	*/
 
 /*
@@ -83,56 +84,56 @@
 #include 
 
 #ifdef AUDIO_DEBUG
-#define DPRINTF(x)  if (am7930debug) printf x
-#define DPRINTFN(n,x)   if (am7930debug>(n)) printf x
+#define DPRINTF(x)	if (am7930debug) printf x
+#define DPRINTFN(n,x)	if (am7930debug>(n)) printf x
 #else
 #define DPRINTF(x)
 #define DPRINTFN(n,x)
 #endif  /* AUDIO_DEBUG */
 
 /* physical addresses of the AM79C30 chip */
-#define VSAUDIO_CSR 0x200d
-#define VSAUDIO_CSR_KA490x2680
+#define VSAUDIO_CSR			0x200d
+#define VSAUDIO_CSR_KA49		0x2680
 
 /* pdma state */
 struct auio {
-bus_space_tag_t au_bt;  /* bus tag */
-bus_space_handle_t  au_bh;  /* handle to chip registers */
+	bus_space_tag_t		au_bt;	/* bus tag */
+	bus_space_handle_t	au_bh;	/* handle to chip registers */
 
-uint8_t *au_rdata;  /* record data */
-uint8_t *au_rend;   /* end of record data */
-uint8_t *au_pdata;  /* play data */
-uint8_t *au_pend;   /* end of play data */
-struct evcntau_intrcnt; /* statistics */
+	uint8_t		*au_rdata;	/* record data */
+	uint8_t		*au_rend;	/* end of record data */
+	uint8_t		*au_pdata;	/* play data */
+	uint8_t		*au_pend;	/* end of play data */
+	struct evcnt	au_intrcnt;	/* statistics */
 };
 
 struct am7930_intrhand {
-int (*ih_fun)(void *);
-void*ih_arg;
+	int	(*ih_fun)(void *);
+	void	*ih_arg;
 };
 
 
 struct vsaudio_softc {
-	struct am7930_softc sc_am7930;  /* glue to MI code */
-	bus_space_tag_t sc_bt;  /* bus cookie */
-	bus_space_handle_t sc_bh;   /* device registers */
-
-struct am7930_intrhand  sc_ih;  /* interrupt vector (hw or sw)  */
-void(*sc_rintr)(void*); /* input completion intr handler */
-void*sc_rarg;   /* arg for sc_rintr() */
-void(*sc_pintr)(void*); /* output completion intr handler */
-void*sc_parg;   /* arg for sc_pintr() */
-
-uint8_t *sc_rdata;  /* record data */
-uint8_t *sc_rend;   /* end of record data */
-uint8_t *sc_pdata;  /* play data */
-uint8_t *sc_pend;   /* end of play data */
-
-	struct  auio sc_au; /* recv and xmit buffers, etc */
-#define sc_intrcnt  sc_au.au_intrcnt/* statistics */
-void*sc_sicookie;   /* softintr(9) cookie */
-int sc_cvec;
-kmutex_tsc_lock;
+	struct am7930_softc sc_am7930;	/* glue to MI code */
+	bus_space_tag_t sc_bt;		/* bus cookie */
+	bus_space_handle_t sc_bh;	/* device registers */
+
+	struct am7930_intrhand	sc_ih;	/* interrupt vector (hw or sw)  */
+	void	(*sc_rintr)(void*);	/* input completion intr handler */
+	void	*sc_rarg;		/* arg for sc_rintr() */
+	void	(*sc_pintr)(void*);	/* output completion intr handler */
+	void	*sc_parg;		/* arg for sc_pintr() */
+
+	uint8_t	*sc_rdata;		/* record data */
+	uint8_t	*sc_rend;		/* end of record data */
+	uint8_t	*sc_pdata;		/* play data */
+	uint8_t	*sc_pend;		/* end of play data */
+
+	struct	auio sc_au;		/* recv and xmit buffers, etc */
+#define sc_intrcnt sc_au.au_intrcnt	/* statistics */
+	void	*sc_sicookie;		/* softintr(9) cookie */
+	int	sc_cvec;
+	kmutex_t sc_lock;
 };
 
 static int vsaudio_match(struct device *parent, struct cfdata *match, void *);
@@ -144,14 +145,14 @@ CFATTACH_DECL_NEW(vsaudio, sizeof(struct
 /*
  * Hardware access routines for the MI code
  */
-uint8_t vsaudio_codec_iread(struct am7930_softc *, int);
-uint16_tvsaudio_codec_iread16(struct am7930_softc *, int);
-uint8_t vsaudio_codec_dread(struct vsaudio_softc *, int);
-voidvsaudio_codec_iwrite(struct am7930_softc *, int, uint8_t);
-voidvsaudio_codec_iwrite16(struct am7930_softc *, int, uint16_t);
-voidvsaudio_codec_dwrite(struct vsaudio_softc *, int, uint8_t);
-voidvsaudio_onopen(struct am7930_softc *);
-voidvsaudio_onclose(struct am7930_softc *);
+uint8_t	vsaudio_codec_iread(struct am7930_softc *, int);
+uint16_t	vsaudio_codec_iread16(struct am7930_softc *, 

CVS commit: src/sys/arch/vax/vsa

2019-04-08 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Mon Apr  8 14:48:33 UTC 2019

Modified Files:
src/sys/arch/vax/vsa: vsaudio.c

Log Message:
White space -> TAB, fix indent, and add RCS Id.
No functional changes intended.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/vax/vsa/vsaudio.c

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



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

2019-04-08 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Apr  8 14:08:16 UTC 2019

Modified Files:
src/sys/arch/alpha/include: elf_machdep.h

Log Message:
Add the R_ALPHA_BRSGP relocation type.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/alpha/include/elf_machdep.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/alpha/include/elf_machdep.h
diff -u src/sys/arch/alpha/include/elf_machdep.h:1.13 src/sys/arch/alpha/include/elf_machdep.h:1.14
--- src/sys/arch/alpha/include/elf_machdep.h:1.13	Mon Nov  6 03:47:45 2017
+++ src/sys/arch/alpha/include/elf_machdep.h	Mon Apr  8 14:08:16 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: elf_machdep.h,v 1.13 2017/11/06 03:47:45 christos Exp $ */
+/* $NetBSD: elf_machdep.h,v 1.14 2019/04/08 14:08:16 thorpej Exp $ */
 
 #ifndef	_ALPHA_ELF_MACHDEP_H_
 #define	_ALPHA_ELF_MACHDEP_H_
@@ -55,6 +55,7 @@
 #define	R_ALPHA_GLOB_DAT	25	/* Create GOT entry */
 #define	R_ALPHA_JMP_SLOT	26	/* Create PLT entry */
 #define	R_ALPHA_RELATIVE	27	/* Adjust by program base */
+#define	R_ALPHA_BRSGP		28
 
 /* TLS relocations */
 #define	R_ALPHA_TLS_GD		29



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

2019-04-08 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Apr  8 14:08:16 UTC 2019

Modified Files:
src/sys/arch/alpha/include: elf_machdep.h

Log Message:
Add the R_ALPHA_BRSGP relocation type.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/alpha/include/elf_machdep.h

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



CVS commit: src/share/man/man9

2019-04-08 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Apr  8 13:30:46 UTC 2019

Modified Files:
src/share/man/man9: filedesc.9

Log Message:
Remove superfluous comma. Try improving a sentence. Remove duplicate sentence.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/share/man/man9/filedesc.9

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

Modified files:

Index: src/share/man/man9/filedesc.9
diff -u src/share/man/man9/filedesc.9:1.17 src/share/man/man9/filedesc.9:1.18
--- src/share/man/man9/filedesc.9:1.17	Mon Apr  8 13:04:54 2019
+++ src/share/man/man9/filedesc.9	Mon Apr  8 13:30:46 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: filedesc.9,v 1.17 2019/04/08 13:04:54 maya Exp $
+.\" $NetBSD: filedesc.9,v 1.18 2019/04/08 13:30:46 wiz Exp $
 .\"
 .\" Copyright (c) 2002, 2005, 2006 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -44,7 +44,7 @@
 .Nm fd_init ,
 .Nm fd_getfile ,
 .Nm fd_share ,
-.Nm fd_tryexpand ,
+.Nm fd_tryexpand
 .Nd file descriptor tables and operations
 .Sh SYNOPSIS
 .In sys/file.h
@@ -129,10 +129,9 @@ allocate a file descriptor for the proce
 .Fa p .
 The credential on the file entry are inherited from process
 .Fa p .
-The caller to the
+Calling the
 .Fn fd_alloc
-function is responsible for expanding the file descriptor table when
-necessary.
+function expands the file descriptor table when necessary.
 .Pp
 The index of the file entry is returned in
 .Fa *result .
@@ -190,7 +189,6 @@ fills
 with the given parameters.
 It always returns the in-kernel errno
 .Er EMOVEFD .
-This special value is meant to be returned from the device open routine;
 This special return value is interpreted by the caller of the device
 open routine.
 .It Fn fd_closeexec "void"



CVS commit: src/share/man/man9

2019-04-08 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Apr  8 13:30:46 UTC 2019

Modified Files:
src/share/man/man9: filedesc.9

Log Message:
Remove superfluous comma. Try improving a sentence. Remove duplicate sentence.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/share/man/man9/filedesc.9

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



CVS commit: src/sys/kern

2019-04-08 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Apr  8 13:05:23 UTC 2019

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

Log Message:
Update comment to match existing function name.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/kern/subr_exec_fd.c

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

Modified files:

Index: src/sys/kern/subr_exec_fd.c
diff -u src/sys/kern/subr_exec_fd.c:1.7 src/sys/kern/subr_exec_fd.c:1.8
--- src/sys/kern/subr_exec_fd.c:1.7	Fri Sep  5 09:20:59 2014
+++ src/sys/kern/subr_exec_fd.c	Mon Apr  8 13:05:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_exec_fd.c,v 1.7 2014/09/05 09:20:59 matt Exp $	*/
+/*	$NetBSD: subr_exec_fd.c,v 1.8 2019/04/08 13:05:23 maya Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_exec_fd.c,v 1.7 2014/09/05 09:20:59 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_exec_fd.c,v 1.8 2019/04/08 13:05:23 maya Exp $");
 
 #include 
 #include 
@@ -69,7 +69,7 @@ fd_ktrexecfd(void)
 /*
  * It is unsafe for set[ug]id processes to be started with file
  * descriptors 0..2 closed, as these descriptors are given implicit
- * significance in the Standard C library.  fdcheckstd() will create a
+ * significance in the Standard C library.  fd_checkstd() will create a
  * descriptor referencing /dev/null for each of stdin, stdout, and
  * stderr that is not already open.
  */



CVS commit: src/share/man/man9

2019-04-08 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Apr  8 13:04:54 UTC 2019

Modified Files:
src/share/man/man9: filedesc.9

Log Message:
Update to reference the newer (committed long ago) API.

With comments from Rocky Hotas on netbsd-docs, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/share/man/man9/filedesc.9

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



CVS commit: src/sys/kern

2019-04-08 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Apr  8 13:05:23 UTC 2019

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

Log Message:
Update comment to match existing function name.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/kern/subr_exec_fd.c

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



CVS commit: src/share/man/man9

2019-04-08 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Apr  8 13:04:54 UTC 2019

Modified Files:
src/share/man/man9: filedesc.9

Log Message:
Update to reference the newer (committed long ago) API.

With comments from Rocky Hotas on netbsd-docs, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/share/man/man9/filedesc.9

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

Modified files:

Index: src/share/man/man9/filedesc.9
diff -u src/share/man/man9/filedesc.9:1.16 src/share/man/man9/filedesc.9:1.17
--- src/share/man/man9/filedesc.9:1.16	Thu Dec  2 12:54:13 2010
+++ src/share/man/man9/filedesc.9	Mon Apr  8 13:04:54 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: filedesc.9,v 1.16 2010/12/02 12:54:13 wiz Exp $
+.\" $NetBSD: filedesc.9,v 1.17 2019/04/08 13:04:54 maya Exp $
 .\"
 .\" Copyright (c) 2002, 2005, 2006 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,63 +27,54 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd July 24, 2006
+.Dd April 8, 2019
 .Dt FILEDESC 9
 .Os
 .Sh NAME
 .Nm filedesc ,
-.Nm dupfdopen ,
-.Nm falloc ,
+.Nm fd_alloc ,
+.Nm fd_checkstd ,
+.Nm fd_clone ,
+.Nm fd_closeexec ,
+.Nm fd_copy ,
+.Nm fd_dup ,
+.Nm fd_dup2 ,
+.Nm fd_dupopen ,
+.Nm fd_free ,
+.Nm fd_init ,
 .Nm fd_getfile ,
-.Nm fdalloc ,
-.Nm fdcheckstd ,
-.Nm fdclear ,
-.Nm fdclone ,
-.Nm fdcloseexec ,
-.Nm fdcopy ,
-.Nm fdexpand ,
-.Nm fdfree ,
-.Nm fdinit ,
-.Nm fdrelease ,
-.Nm fdremove ,
-.Nm fdshare ,
-.Nm fdunshare
+.Nm fd_share ,
+.Nm fd_tryexpand ,
 .Nd file descriptor tables and operations
 .Sh SYNOPSIS
 .In sys/file.h
 .In sys/filedesc.h
 .Ft int
-.Fn falloc "struct lwp *l" "struct file **resultfp" "int *resultfd"
-.Ft struct file *
-.Fn fd_getfile "struct filedesc *fdp" "int fd"
+.Fn fd_alloc "proc_t *p" "int want" "int *result"
 .Ft int
-.Fn dupfdopen "struct lwp *l" "int indx" "int dfd" "int mode" "int error"
+.Fn fd_checkstd "void"
 .Ft int
-.Fn fdalloc "struct proc *p" "int want" "int *result"
-.Ft int
-.Fn fdcheckstd "struct lwp *l"
+.Fn fd_clone "file_t *fp" "int fd" "int flag" "const struct fileops *fops" "void *data"
+.Ft filedesc_t *
+.Fn fd_copy "void"
 .Ft void
-.Fn fdclear "struct lwp *l"
+.Fn fd_closeexec "void"
 .Ft int
-.Fn fdclone "struct lwp *l" "struct file *fp" "int fd" "int flag" "const struct fileops *fops" "void *data"
-.Ft void
-.Fn fdcloseexec "struct lwp *l"
-.Ft struct filedesc *
-.Fn fdcopy "struct proc *p"
-.Ft void
-.Fn fdexpand "struct proc *p"
-.Ft void
-.Fn fdfree "struct lwp *l"
-.Ft struct filedesc *
-.Fn fdinit "struct proc *p"
+.Fn fd_dup "file_t *fp" "int minfd" "int *newp" "bool exclose"
 .Ft int
-.Fn fdrelease "struct lwp *l" "int fd"
+.Fn fd_dup2 "file_t *fp" "unsigned newfd" "int flags"
+.Ft int
+.Fn fd_dupopen "int old" "int *newp" "int error"
 .Ft void
-.Fn fdremove "struct filedesc *fdp" "int fd"
+.Fn fd_free "void"
+.Ft filedesc_t *
+.Fn fd_init "filedesc_t *fdp"
+.Ft file_t *
+.Fn fd_getfile "unsigned fd"
 .Ft void
-.Fn fdshare "struct proc *p1" "struct proc *p2"
+.Fn fd_share "proc_t *p"
 .Ft void
-.Fn fdunshare "struct lwp *l"
+.Fn fd_tryexpand "proc_t *p"
 .Sh DESCRIPTION
 For user processes, all I/O is done through file descriptors.
 These file descriptors represent underlying objects supported by the kernel
@@ -97,7 +88,7 @@ The kernel maintains a descriptor table 
 to translate the external representation of a file descriptor into an
 internal representation.
 The file descriptor is merely an index into this table.
-The file descriptor table maintains the following information:
+The table maintains the following information:
 .Pp
 .Bl -bullet -compact
 .It
@@ -114,67 +105,72 @@ On creation of the file descriptor table
 entries are created.
 It is the responsibility of the file descriptor operations to expand the
 available number of entries if more are required.
-Each file entry in the descriptor table contains the information necessary
+Each file entry in the descriptor table contains the information needed
 to access the underlying object and to maintain common information.
 See
 .Xr file 9
 for details of operations on the file entries.
 .Pp
 New file descriptors are generally allocated by
-.Fn falloc
+.Fn fd_alloc
 and freed by
-.Fn fdrelease .
+.Fn fd_free .
 File entries are extracted from the file descriptor table by
 .Fn fd_getfile .
-Most of the remaining functions in the interface are purpose specific
+Most of the remaining functions in the interface are purpose-specific
 and perform lower-level file descriptor operations.
 .Sh FUNCTIONS
 The following functions are high-level interface routines to access
 the file descriptor table for a process and its file entries.
-.Pp
 .Bl -tag -width compact
-.It Fn falloc "p" "*resultfp" "*resultfd"
-Create a new open file entry and allocate a file descriptor for
-process
+.It Fn fd_alloc "p" "want" "*result"
+Create a new open 

CVS commit: src/sys

2019-04-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Apr  8 11:32:49 UTC 2019

Modified Files:
src/sys/kern: kern_module.c
src/sys/sys: module.h

Log Message:
Improve kernel module validation.  First, set a limit on how much of the
module name field to check when validation name's length.  Second, check
the module's mi_class to ensure it is valid.

Update the commenet in sys/module.h to indicate that the module classes
are now being validated.


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sys/kern/kern_module.c
cvs rdiff -u -r1.45 -r1.46 src/sys/sys/module.h

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

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.133 src/sys/kern/kern_module.c:1.134
--- src/sys/kern/kern_module.c:1.133	Sun Jan 27 02:08:43 2019
+++ src/sys/kern/kern_module.c	Mon Apr  8 11:32:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.133 2019/01/27 02:08:43 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.134 2019/04/08 11:32:49 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.133 2019/01/27 02:08:43 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.134 2019/04/08 11:32:49 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -1090,12 +1090,19 @@ module_do_load(const char *name, bool is
 	 * Check compatibility.
 	 */
 	mi = mod->mod_info;
-	if (strlen(mi->mi_name) >= MAXMODNAME) {
+	if (strnlen(mi->mi_name, MAXMODNAME) >= MAXMODNAME) {
 		error = EINVAL;
 		module_error("module name `%s' longer than %d", mi->mi_name,
 		MAXMODNAME);
 		goto fail;
 	}
+	if (mi->mi_class <= MODULE_CLASS_ANY ||
+	mi->mi_class >= MODULE_CLASS_MAX) {
+		error = EINVAL;
+		module_error("module `%s' has invalid class %d",
+		mi->mi_name, mi->mi_class);
+		goto fail;
+	}
 	if (!module_compatible(mi->mi_version, __NetBSD_Version__)) {
 		module_error("module `%s' built for `%d', system `%d'",
 		mi->mi_name, mi->mi_version, __NetBSD_Version__);

Index: src/sys/sys/module.h
diff -u src/sys/sys/module.h:1.45 src/sys/sys/module.h:1.46
--- src/sys/sys/module.h:1.45	Mon Apr  8 11:02:58 2019
+++ src/sys/sys/module.h	Mon Apr  8 11:32:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: module.h,v 1.45 2019/04/08 11:02:58 pgoyette Exp $	*/
+/*	$NetBSD: module.h,v 1.46 2019/04/08 11:32:49 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 #define	MAXMODNAME	32
 #define	MAXMODDEPS	10
 
-/* Module classes, provided only for system boot and cosmetic purposes. */
+/* Module classes, provided only for system boot and module validation. */
 typedef enum modclass {
 	MODULE_CLASS_ANY,
 	MODULE_CLASS_MISC,



CVS commit: src/sys

2019-04-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Apr  8 11:32:49 UTC 2019

Modified Files:
src/sys/kern: kern_module.c
src/sys/sys: module.h

Log Message:
Improve kernel module validation.  First, set a limit on how much of the
module name field to check when validation name's length.  Second, check
the module's mi_class to ensure it is valid.

Update the commenet in sys/module.h to indicate that the module classes
are now being validated.


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sys/kern/kern_module.c
cvs rdiff -u -r1.45 -r1.46 src/sys/sys/module.h

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



CVS commit: src/sys/sys

2019-04-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Apr  8 11:02:58 UTC 2019

Modified Files:
src/sys/sys: module.h

Log Message:
Add a MODULE_CLASS_MAX value to the enum


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/sys/module.h

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



CVS commit: src/sys/sys

2019-04-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Apr  8 11:02:58 UTC 2019

Modified Files:
src/sys/sys: module.h

Log Message:
Add a MODULE_CLASS_MAX value to the enum


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/sys/module.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/sys/module.h
diff -u src/sys/sys/module.h:1.44 src/sys/sys/module.h:1.45
--- src/sys/sys/module.h:1.44	Sun Jan 27 18:29:10 2019
+++ src/sys/sys/module.h	Mon Apr  8 11:02:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: module.h,v 1.44 2019/01/27 18:29:10 christos Exp $	*/
+/*	$NetBSD: module.h,v 1.45 2019/04/08 11:02:58 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -45,7 +45,8 @@ typedef enum modclass {
 	MODULE_CLASS_DRIVER,
 	MODULE_CLASS_EXEC,
 	MODULE_CLASS_SECMODEL,
-	MODULE_CLASS_BUFQ
+	MODULE_CLASS_BUFQ,
+	MODULE_CLASS_MAX
 } modclass_t;
 
 /* Module sources: where did it come from? */



CVS commit: src/lib/libc/sys

2019-04-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Apr  8 10:47:16 UTC 2019

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

Log Message:
Split the description for EINVAL into two pieces, one for each operation
that can generate the error.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/sys/modctl.2

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



CVS commit: src/lib/libc/sys

2019-04-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Apr  8 10:47:16 UTC 2019

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

Log Message:
Split the description for EINVAL into two pieces, one for each operation
that can generate the error.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/sys/modctl.2

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

Modified files:

Index: src/lib/libc/sys/modctl.2
diff -u src/lib/libc/sys/modctl.2:1.14 src/lib/libc/sys/modctl.2:1.15
--- src/lib/libc/sys/modctl.2:1.14	Sun Jan 27 02:08:35 2019
+++ src/lib/libc/sys/modctl.2	Mon Apr  8 10:47:16 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: modctl.2,v 1.14 2019/01/27 02:08:35 pgoyette Exp $
+.\"	$NetBSD: modctl.2,v 1.15 2019/04/08 10:47:16 pgoyette Exp $
 .\"
 .\" Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd November 4, 2015
+.Dd April 8, 2019
 .Dt MODCTL 2
 .Os
 .Sh NAME
@@ -275,6 +275,7 @@ The argument
 is
 .Dv MODCTL_LOAD
 and the module or a dependency can't be found.
+.Pp
 The argument
 .Fa operation
 is



CVS commit: src/usr.sbin/npf/npfctl

2019-04-08 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Apr  8 07:58:45 UTC 2019

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5

Log Message:
Improve wording.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/usr.sbin/npf/npfctl/npf.conf.5

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



CVS commit: src/usr.sbin/npf/npfctl

2019-04-08 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Apr  8 07:58:45 UTC 2019

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5

Log Message:
Improve wording.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/usr.sbin/npf/npfctl/npf.conf.5

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/npf/npfctl/npf.conf.5
diff -u src/usr.sbin/npf/npfctl/npf.conf.5:1.85 src/usr.sbin/npf/npfctl/npf.conf.5:1.86
--- src/usr.sbin/npf/npfctl/npf.conf.5:1.85	Sun Apr  7 22:23:40 2019
+++ src/usr.sbin/npf/npfctl/npf.conf.5	Mon Apr  8 07:58:45 2019
@@ -1,4 +1,4 @@
-.\"$NetBSD: npf.conf.5,v 1.85 2019/04/07 22:23:40 rmind Exp $
+.\"$NetBSD: npf.conf.5,v 1.86 2019/04/08 07:58:45 wiz Exp $
 .\"
 .\" Copyright (c) 2009-2018 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -355,7 +355,7 @@ redirecting the public port 9022 to the 
 .Dl map $ext_if dynamic proto tcp 10.1.1.2 port 22 <- $ext_if port 9022
 .Pp
 The translation address can also by dynamic, based on the interface.
-The following would select IPv4 address currently assigned to the interface:
+The following would select the IPv4 address(es) currently assigned to the interface:
 .Pp
 .Dl map $ext_if dynamic 10.1.1.0/24 -> ifaddrs($ext_if)
 .Pp



Re: CVS commit: src/sys/dev/nvmm

2019-04-08 Thread Paul Goyette

On Mon, 8 Apr 2019, Maxime Villard wrote:


The reason I use MODULE_CLASS_ANY in both NVMM and KCOV is because this
class is invoked late in the boot process (init_main.c). Eg NVMM will use
allocators/xcalls which are not yet initialized in MODULE_CLASS_DRIVER,
but are in MODULE_CLASS_ANY.


No, at that late point in the boot process we load/activate all 
remaining modules without looking at their class at all!  Please see

the MODULE_CALSS_MATCH() macro at

https://nxr.netbsd.org/xref/src/sys/kern/kern_module.c#130

Also please note that the module(9) man page explicitly lists the
valid entries for the MODULE(class, ...) macro, and MODULE_CLASS_ANY 
is _not_ listed.


We're not loading "modules whose class is MODULE_CLASS_ANY" we are
loading "all remaining modules".

Please update your module to use MODULE_CLASS_MISC (or let me know
and I can do it).


++--+---+
| Paul Goyette   | PGP Key fingerprint: | E-mail addresses: |
| (Retired)  | FA29 0E3B 35AF E8AE 6651 | p...@whooppee.com |
| Software Developer | 0786 F758 55DE 53BA 7731 | pgoye...@netbsd.org   |
++--+---+


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

2019-04-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Apr  8 07:35:32 UTC 2019

Modified Files:
src/sys/arch/arm/arm: armv6_start.S

Log Message:
Fix a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/arm/armv6_start.S

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



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

2019-04-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Apr  8 07:35:32 UTC 2019

Modified Files:
src/sys/arch/arm/arm: armv6_start.S

Log Message:
Fix a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/arm/armv6_start.S

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/arm/armv6_start.S
diff -u src/sys/arch/arm/arm/armv6_start.S:1.11 src/sys/arch/arm/arm/armv6_start.S:1.12
--- src/sys/arch/arm/arm/armv6_start.S:1.11	Thu Apr  4 14:24:20 2019
+++ src/sys/arch/arm/arm/armv6_start.S	Mon Apr  8 07:35:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: armv6_start.S,v 1.11 2019/04/04 14:24:20 skrll Exp $	*/
+/*	$NetBSD: armv6_start.S,v 1.12 2019/04/08 07:35:32 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2012, 2017, 2018 The NetBSD Foundation, Inc.
@@ -854,7 +854,10 @@ armv7_mpcontinuation:
 	mov	r0, R_INDEX			// index into cpu_mpidr[] or cpu_number if not found
 	bl	cpu_init_secondary_processor
 
-	/* Wait for cpu_boot_secondary_processors the when cpu_info is allocated, etc */
+	/*
+	 * Wait for cpu_boot_secondary_processors when cpu_info has
+	 * been allocated, etc
+	 */
 
 	movw	r6, #:lower16:arm_cpu_mbox
 	movt	r6, #:upper16:arm_cpu_mbox