CVS commit: src/sys/dev/ic

2020-03-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Mar 24 04:12:13 UTC 2020

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

Log Message:
 Fix unused area size found by pgoyette@.


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

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

Modified files:

Index: src/sys/dev/ic/spdmemvar.h
diff -u src/sys/dev/ic/spdmemvar.h:1.15 src/sys/dev/ic/spdmemvar.h:1.16
--- src/sys/dev/ic/spdmemvar.h:1.15	Tue Mar 24 03:45:25 2020
+++ src/sys/dev/ic/spdmemvar.h	Tue Mar 24 04:12:13 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmemvar.h,v 1.15 2020/03/24 03:45:25 msaitoh Exp $ */
+/* $NetBSD: spdmemvar.h,v 1.16 2020/03/24 04:12:13 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2007 Paul Goyette
@@ -509,7 +509,7 @@ struct spdmem_ddr3 {/* Dual Data Rat
 	uint8_t ddr3_tRCmin_ftb;
 	uint8_t	ddr3_unused4[2];
 	uint8_t	ddr3_MAC;
-	uint8_t	ddr3_unused4a[17];
+	uint8_t	ddr3_unused4a[18];
 	uint8_t	ddr3_mod_height;
 	uint8_t	ddr3_mod_thickness;
 	uint8_t	ddr3_ref_card;



CVS commit: src/sys/dev/pci

2020-03-23 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Tue Mar 24 04:00:26 UTC 2020

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

Log Message:
nuke  and reorder #include


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/pci/if_kse.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/if_kse.c
diff -u src/sys/dev/pci/if_kse.c:1.50 src/sys/dev/pci/if_kse.c:1.51
--- src/sys/dev/pci/if_kse.c:1.50	Mon Mar  2 19:16:02 2020
+++ src/sys/dev/pci/if_kse.c	Tue Mar 24 04:00:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_kse.c,v 1.50 2020/03/02 19:16:02 nisimura Exp $	*/
+/*	$NetBSD: if_kse.c,v 1.51 2020/03/24 04:00:26 nisimura Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -34,22 +34,19 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_kse.c,v 1.50 2020/03/02 19:16:02 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_kse.c,v 1.51 2020/03/24 04:00:26 nisimura Exp $");
 
 #include 
-#include 
+#include 
+#include 
+#include 
 #include 
-#include 
-#include 
-#include 
 #include 
+#include 
+#include 
 #include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
+#include 
+#include 
 
 #include 
 #include 



CVS commit: src/sys/dev/ic

2020-03-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Mar 24 03:47:39 UTC 2020

Modified Files:
src/sys/dev/ic: spdmem.c

Log Message:
Calculate DDR3's tRAS correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/ic/spdmem.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/ic/spdmem.c
diff -u src/sys/dev/ic/spdmem.c:1.34 src/sys/dev/ic/spdmem.c:1.35
--- src/sys/dev/ic/spdmem.c:1.34	Tue Mar 24 03:45:25 2020
+++ src/sys/dev/ic/spdmem.c	Tue Mar 24 03:47:39 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmem.c,v 1.34 2020/03/24 03:45:25 msaitoh Exp $ */
+/* $NetBSD: spdmem.c,v 1.35 2020/03/24 03:47:39 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2007 Nicolas Joly
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.34 2020/03/24 03:45:25 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.35 2020/03/24 03:47:39 msaitoh Exp $");
 
 #include 
 #include 
@@ -830,8 +830,9 @@ decode_ddr3(const struct sysctlnode *nod
 	__DDR3_CYCLES(__DDR3_VALUE_PICO(s, tAAmin)),
 	__DDR3_CYCLES(__DDR3_VALUE_PICO(s, tRCDmin)),
 	__DDR3_CYCLES(__DDR3_VALUE_PICO(s, tRPmin)),
-		(s->sm_ddr3.ddr3_tRAS_msb * 256 + s->sm_ddr3.ddr3_tRAS_lsb) /
-		s->sm_ddr3.ddr3_tCKmin_mtb);
+	__DDR3_CYCLES((s->sm_ddr3.ddr3_tRAS_msb * 256
+		+ s->sm_ddr3.ddr3_tRAS_lsb) * s->sm_ddr3.ddr3_mtb_dividend
+		/ s->sm_ddr3.ddr3_mtb_divisor * 1000));
 
 #undef	__DDR3_CYCLES
 



CVS commit: src/sys/dev/ic

2020-03-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Mar 24 03:45:26 UTC 2020

Modified Files:
src/sys/dev/ic: spdmem.c spdmemvar.h

Log Message:
- Define some new parameters of DDR3 SPD ROM.
- Use fine timebase parameters for time calculation on DDR3. This change
  makes PC3- vaule more correctly on newer DDR3.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/ic/spdmem.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ic/spdmemvar.h

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

Modified files:

Index: src/sys/dev/ic/spdmem.c
diff -u src/sys/dev/ic/spdmem.c:1.33 src/sys/dev/ic/spdmem.c:1.34
--- src/sys/dev/ic/spdmem.c:1.33	Tue Mar 24 03:35:25 2020
+++ src/sys/dev/ic/spdmem.c	Tue Mar 24 03:45:25 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmem.c,v 1.33 2020/03/24 03:35:25 msaitoh Exp $ */
+/* $NetBSD: spdmem.c,v 1.34 2020/03/24 03:45:25 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2007 Nicolas Joly
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.33 2020/03/24 03:35:25 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.34 2020/03/24 03:45:25 msaitoh Exp $");
 
 #include 
 #include 
@@ -756,6 +756,30 @@ print_part(const char *part, size_t pnsi
 	aprint_normal(": %.*s\n", (int)(p - part), part);
 }
 
+static u_int
+ddr3_value_pico(struct spdmem *s, uint8_t txx_mtb, uint8_t txx_ftb)
+{
+	u_int mtb, ftb; /* in picoseconds */
+	intmax_t signed_txx_ftb;
+	u_int val;
+
+	mtb = (u_int)s->sm_ddr3.ddr3_mtb_dividend * 1000 /
+	s->sm_ddr3.ddr3_mtb_divisor;
+	ftb = (u_int)s->sm_ddr3.ddr3_ftb_dividend * 1000 /
+	s->sm_ddr3.ddr3_ftb_divisor;
+
+	/* tXX_ftb is signed value */
+	signed_txx_ftb = (int8_t)txx_ftb;
+	val = txx_mtb * mtb +
+	((txx_ftb > 127) ? signed_txx_ftb : txx_ftb) * ftb / 1000;
+
+	return val;
+}
+
+#define __DDR3_VALUE_PICO(s, field)\
+	ddr3_value_pico(s, s->sm_ddr3.ddr3_##field##_mtb,	\
+	s->sm_ddr3.ddr3_##field##_ftb)
+
 static void
 decode_ddr3(const struct sysctlnode *node, device_t self, struct spdmem *s)
 {
@@ -786,10 +810,7 @@ decode_ddr3(const struct sysctlnode *nod
 		(s->sm_ddr3.ddr3_chipwidth + 2);
 	dimm_size = (1 << dimm_size) * (s->sm_ddr3.ddr3_physbanks + 1);
 
-	cycle_time = (1000 * s->sm_ddr3.ddr3_mtb_dividend +
-			(s->sm_ddr3.ddr3_mtb_divisor / 2)) /
-		 s->sm_ddr3.ddr3_mtb_divisor;
-	cycle_time *= s->sm_ddr3.ddr3_tCKmin;
+	cycle_time = __DDR3_VALUE_PICO(s, tCKmin);
 	bits = 1 << (s->sm_ddr3.ddr3_datawidth + 3);
 	decode_size_speed(self, node, dimm_size, cycle_time, 2, bits, FALSE,
 			  "PC3", 0);
@@ -802,12 +823,15 @@ decode_ddr3(const struct sysctlnode *nod
 	s->sm_ddr3.ddr3_physbanks + 1,
 	cycle_time/1000, cycle_time % 1000);
 
-#define	__DDR3_CYCLES(field) (s->sm_ddr3.field / s->sm_ddr3.ddr3_tCKmin)
+#define	__DDR3_CYCLES(val)		\
+	((val / cycle_time) + ((val % cycle_time) ? 1 : 0))
 
-	aprint_verbose_dev(self, LATENCY, __DDR3_CYCLES(ddr3_tAAmin),
-		__DDR3_CYCLES(ddr3_tRCDmin), __DDR3_CYCLES(ddr3_tRPmin), 
+	aprint_verbose_dev(self, LATENCY,
+	__DDR3_CYCLES(__DDR3_VALUE_PICO(s, tAAmin)),
+	__DDR3_CYCLES(__DDR3_VALUE_PICO(s, tRCDmin)),
+	__DDR3_CYCLES(__DDR3_VALUE_PICO(s, tRPmin)),
 		(s->sm_ddr3.ddr3_tRAS_msb * 256 + s->sm_ddr3.ddr3_tRAS_lsb) /
-		s->sm_ddr3.ddr3_tCKmin);
+		s->sm_ddr3.ddr3_tCKmin_mtb);
 
 #undef	__DDR3_CYCLES
 

Index: src/sys/dev/ic/spdmemvar.h
diff -u src/sys/dev/ic/spdmemvar.h:1.14 src/sys/dev/ic/spdmemvar.h:1.15
--- src/sys/dev/ic/spdmemvar.h:1.14	Thu Dec 27 02:54:00 2018
+++ src/sys/dev/ic/spdmemvar.h	Tue Mar 24 03:45:25 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmemvar.h,v 1.14 2018/12/27 02:54:00 msaitoh Exp $ */
+/* $NetBSD: spdmemvar.h,v 1.15 2020/03/24 03:45:25 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2007 Paul Goyette
@@ -463,20 +463,20 @@ struct spdmem_ddr3 {/* Dual Data Rat
 	);
 	uint8_t ddr3_mtb_dividend;	/* 0x0108 = 0.1250ns */
 	uint8_t	ddr3_mtb_divisor;	/* 0x010f = 0.0625ns */
-	uint8_t	ddr3_tCKmin;		/* in terms of mtb */
+	uint8_t	ddr3_tCKmin_mtb;
 	uint8_t	ddr3_unused3;
 	uint16_t ddr3_CAS_sup;		/* Bit 0 ==> CAS 4 cycles */
-	uint8_t	ddr3_tAAmin;		/* in terms of mtb */
+	uint8_t	ddr3_tAAmin_mtb;
 	uint8_t	ddr3_tWRmin;
-	uint8_t	ddr3_tRCDmin;
+	uint8_t	ddr3_tRCDmin_mtb;
 	uint8_t	ddr3_tRRDmin;
-	uint8_t	ddr3_tRPmin;
+	uint8_t	ddr3_tRPmin_mtb;
 	SPD_BITFIELD(\
 		uint8_t	ddr3_tRAS_msb:4,	\
-		uint8_t	ddr3_tRC_msb:4, ,	\
+		uint8_t	ddr3_tRCmin_mtb_msb:4, , \
 	);
 	uint8_t	ddr3_tRAS_lsb;
-	uint8_t	ddr3_tRC_lsb;
+	uint8_t	ddr3_tRCmin_mtb_lsb;
 	uint8_t	ddr3_tRFCmin_lsb;
 	uint8_t	ddr3_tRFCmin_msb;
 	uint8_t	ddr3_tWTRmin;
@@ -502,7 +502,14 @@ struct spdmem_ddr3 {/* Dual Data Rat
 		uint8_t ddr3_non_std_devtype:7,	\
 		uint8_t ddr3_std_device:1, ,	\
 	);
-	uint8_t	ddr3_unused4[26];
+	uint8_t ddr3_tCKmin_ftb;
+	uint8_t ddr3_tAAmin_ftb;
+	uint8_t ddr3_tRCDmin_ftb;
+	uint8_t ddr3_tRPmin_ftb;
+	uint8_t ddr3_tRCmin_ftb;
+	uint8_t	ddr3_unused4[2];
+	

CVS commit: src/sys/dev/ic

2020-03-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Mar 24 03:35:25 UTC 2020

Modified Files:
src/sys/dev/ic: spdmem.c

Log Message:
KNF. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ic/spdmem.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/ic/spdmem.c
diff -u src/sys/dev/ic/spdmem.c:1.32 src/sys/dev/ic/spdmem.c:1.33
--- src/sys/dev/ic/spdmem.c:1.32	Fri Mar 20 07:44:10 2020
+++ src/sys/dev/ic/spdmem.c	Tue Mar 24 03:35:25 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmem.c,v 1.32 2020/03/20 07:44:10 msaitoh Exp $ */
+/* $NetBSD: spdmem.c,v 1.33 2020/03/24 03:35:25 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2007 Nicolas Joly
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.32 2020/03/20 07:44:10 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.33 2020/03/24 03:35:25 msaitoh Exp $");
 
 #include 
 #include 
@@ -340,12 +340,12 @@ spdmem_common_attach(struct spdmem_softc
 	device_xname(self), NULL, NULL, 0, NULL, 0,
 	CTL_HW, CTL_CREATE, CTL_EOL);
 	if (node != NULL && spd_len != 0)
-sysctl_createv(>sc_sysctl_log, 0, NULL, NULL,
-0,
-CTLTYPE_STRUCT, "spd_data",
+		sysctl_createv(>sc_sysctl_log, 0, NULL, NULL,
+		0,
+		CTLTYPE_STRUCT, "spd_data",
 		SYSCTL_DESCR("raw spd data"), NULL,
-0, s, spd_len,
-CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL);
+		0, s, spd_len,
+		CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL);
 
 	/*
 	 * Decode and print key SPD contents
@@ -411,7 +411,7 @@ spdmem_common_attach(struct spdmem_softc
 			strlcat(sc->sc_type, " NVDIMM hybrid",
 			SPDMEM_TYPE_MAXLEN);
 	}
-	
+
 	if (node != NULL)
 		sysctl_createv(>sc_sysctl_log, 0, NULL, NULL,
 		0,
@@ -615,7 +615,7 @@ decode_sdram(const struct sysctlnode *no
 		freq = 0;
 	switch (freq) {
 		/*
-		 * Must check cycle time since some PC-133 DIMMs 
+		 * Must check cycle time since some PC-133 DIMMs
 		 * actually report PC-100
 		 */
 	case 100:
@@ -786,7 +786,7 @@ decode_ddr3(const struct sysctlnode *nod
 		(s->sm_ddr3.ddr3_chipwidth + 2);
 	dimm_size = (1 << dimm_size) * (s->sm_ddr3.ddr3_physbanks + 1);
 
-	cycle_time = (1000 * s->sm_ddr3.ddr3_mtb_dividend + 
+	cycle_time = (1000 * s->sm_ddr3.ddr3_mtb_dividend +
 			(s->sm_ddr3.ddr3_mtb_divisor / 2)) /
 		 s->sm_ddr3.ddr3_mtb_divisor;
 	cycle_time *= s->sm_ddr3.ddr3_tCKmin;
@@ -857,9 +857,9 @@ decode_fbdimm(const struct sysctlnode *n
 #define	__FBDIMM_CYCLES(field) (s->sm_fbd.field / s->sm_fbd.fbdimm_tCKmin)
 
 	aprint_verbose_dev(self, LATENCY, __FBDIMM_CYCLES(fbdimm_tAAmin),
-		__FBDIMM_CYCLES(fbdimm_tRCDmin), __FBDIMM_CYCLES(fbdimm_tRPmin), 
-		(s->sm_fbd.fbdimm_tRAS_msb * 256 + s->sm_fbd.fbdimm_tRAS_lsb) /
-		s->sm_fbd.fbdimm_tCKmin);
+	__FBDIMM_CYCLES(fbdimm_tRCDmin), __FBDIMM_CYCLES(fbdimm_tRPmin),
+	(s->sm_fbd.fbdimm_tRAS_msb * 256 + s->sm_fbd.fbdimm_tRAS_lsb) /
+	s->sm_fbd.fbdimm_tCKmin);
 
 #undef	__FBDIMM_CYCLES
 
@@ -870,14 +870,14 @@ static void
 decode_ddr4(const struct sysctlnode *node, device_t self, struct spdmem *s)
 {
 	int dimm_size, cycle_time, ranks;
-	int tAA_clocks, tRCD_clocks,tRP_clocks, tRAS_clocks;
+	int tAA_clocks, tRCD_clocks, tRP_clocks, tRAS_clocks;
 
 	aprint_naive("\n");
 	print_part(s->sm_ddr4.ddr4_part_number,
 	sizeof(s->sm_ddr4.ddr4_part_number));
 	aprint_normal_dev(self, "%s", spdmem_basic_types[s->sm_type]);
 	if (s->sm_ddr4.ddr4_mod_type < __arraycount(spdmem_ddr4_module_types))
-		aprint_normal(" (%s)", 
+		aprint_normal(" (%s)",
 		spdmem_ddr4_module_types[s->sm_ddr4.ddr4_mod_type]);
 	aprint_normal(", %sECC, %stemp-sensor, ",
 		(s->sm_ddr4.ddr4_bus_width_extension) ? "" : "no ",
@@ -912,7 +912,7 @@ decode_ddr4(const struct sysctlnode *nod
 	default:
 		dimm_size = -1;		/* flag invalid value */
 	}
-	if (dimm_size >= 0) {
+	if (dimm_size >= 0) {
 		dimm_size = (1 << dimm_size) *
 		(s->sm_ddr4.ddr4_package_ranks + 1); /* log.ranks/DIMM */
 		if (s->sm_ddr4.ddr4_signal_loading == 2) {
@@ -928,7 +928,7 @@ decode_ddr4(const struct sysctlnode *nod
 			 s->sm_ddr4.ddr4_##field##_ftb) - 		\
 			((s->sm_ddr4.ddr4_##field##_ftb > 127)?256:0))
 	/*
-	 * For now, the only value for mtb is 0 = 125ps, and ftb = 1ps 
+	 * For now, the only value for mtb is 0 = 125ps, and ftb = 1ps
 	 * so we don't need to figure out the time-base units - just
 	 * hard-code them for now.
 	 */



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

2020-03-23 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Tue Mar 24 03:08:02 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: if_ave.c

Log Message:
correct inverted logic to determine RMII/MII


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/sociox/if_ave.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/sociox/if_ave.c
diff -u src/sys/arch/arm/sociox/if_ave.c:1.14 src/sys/arch/arm/sociox/if_ave.c:1.15
--- src/sys/arch/arm/sociox/if_ave.c:1.14	Mon Mar 23 10:26:07 2020
+++ src/sys/arch/arm/sociox/if_ave.c	Tue Mar 24 03:08:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ave.c,v 1.14 2020/03/23 10:26:07 nisimura Exp $	*/
+/*	$NetBSD: if_ave.c,v 1.15 2020/03/24 03:08:02 nisimura Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.14 2020/03/23 10:26:07 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.15 2020/03/24 03:08:02 nisimura Exp $");
 
 #include 
 #include 
@@ -396,7 +396,7 @@ ave_fdt_attach(device_t parent, device_t
 	sc->sc_model, hwver >> 8, hwver & 0xff, phy_mode);
 	aprint_normal_dev(self, "interrupt on %s\n", intrstr);
 
-	sc->sc_100mii = (strcmp(phy_mode, "rgmii") == 0) ? CFG_MII : 0;
+	sc->sc_100mii = (strcmp(phy_mode, "rgmii") != 0);
 	sc->sc_desops = (sc->sc_model == 64) ?  : 
 
 	CSR_WRITE(sc, AVEGR, GR_GRST | GR_PHYRST);
@@ -522,7 +522,7 @@ ave_reset(struct ave_softc *sc)
 
 	CSR_WRITE(sc, AVERXC, 0);	/* stop Rx first */
 	CSR_WRITE(sc, AVEDESCC, 0);	/* stop Tx/Rx descriptor engine */
-	if (sc->sc_100mii & CFG_MII) {
+	if (sc->sc_100mii) {
 		csr = CSR_READ(sc, AVERMIIC);
 		CSR_WRITE(sc, AVERMIIC, csr &~ RMIIC_RST);
 		DELAY(10);



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

2020-03-23 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Tue Mar 24 02:31:59 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
add some more findings about SC2A11 GbE. do some code steamline practice.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/sociox/if_scx.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/sociox/if_scx.c
diff -u src/sys/arch/arm/sociox/if_scx.c:1.6 src/sys/arch/arm/sociox/if_scx.c:1.7
--- src/sys/arch/arm/sociox/if_scx.c:1.6	Mon Mar 23 07:42:00 2020
+++ src/sys/arch/arm/sociox/if_scx.c	Tue Mar 24 02:31:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_scx.c,v 1.6 2020/03/23 07:42:00 nisimura Exp $	*/
+/*	$NetBSD: if_scx.c,v 1.7 2020/03/24 02:31:59 nisimura Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -47,10 +47,15 @@
  *   for use. Good to catch multicast. Byte-wise selective match available.
  *   Use to catch { 0x01, 0x00, 0x00 } and/or { 0x33, 0x33 }.
  * - The size of multicast hash filter store is unknown. Might be 256 bit.
+ * - Socionext/Linaro "NetSec" code makes many cut shorts. Some constants
+ *   are left unexplained. The values should be handled via external
+ *   controls like FDT descriptions. Fortunately, Intel/Altera CycloneV PDFs
+ *   describe every detail of "such the instance of" DW EMAC IP and
+ *   most of them are likely applicable to SC2A11 GbE.
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.6 2020/03/23 07:42:00 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.7 2020/03/24 02:31:59 nisimura Exp $");
 
 #include 
 #include 
@@ -188,7 +193,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1
 #define  OMR_TXE	(1U<<13)	/* start Tx DMA engine, 0 to stop */
 #define  OMR_RXE	(1U<<1)		/* start Rx DMA engine, 0 to stop */
 
-static int get_garclk(uint32_t);
+static int get_mdioclk(uint32_t);
 
 /* descriptor format definition */
 struct tdes {
@@ -292,7 +297,7 @@ struct scx_softc {
 	void *sc_ih;			/* interrupt cookie */
 	int sc_phy_id;			/* PHY address */
 	int sc_flowflags;		/* 802.3x PAUSE flow control */
-	uint32_t sc_gar;		/* GAR 5:2 clock selection */
+	uint32_t sc_mdclk;		/* GAR 5:2 clock selection */
 	uint32_t sc_t0coso;		/* T0_CSUM | T0_SGOL to run */
 	int sc_ucodeloaded;		/* ucode for H2M/M2H/PKT */
 	int sc_100mii;			/* 1<<15 RMII/MII, 0 for RGMII */
@@ -577,7 +582,7 @@ scx_attach_i(struct scx_softc *sc)
 
 	phyfreq = 0;
 	sc->sc_phy_id = MII_PHY_ANY;
-	sc->sc_gar = get_garclk(phyfreq) << GAR_CTL; /* 5:2 gar control */
+	sc->sc_mdclk = get_mdioclk(phyfreq); /* 5:2 clk control */
 
 	sc->sc_flowflags = 0;
 
@@ -1044,11 +1049,11 @@ static int
 mii_readreg(device_t self, int phy, int reg, uint16_t *val)
 {
 	struct scx_softc *sc = device_private(self);
-	uint32_t gar;
+	uint32_t miia;
 	int error;
 
-	gar = (phy << GAR_PHY) | (reg << GAR_REG) | sc->sc_gar;
-	mac_write(sc, GMACGAR, gar | GAR_BUSY);
+	miia = (phy << GAR_PHY) | (reg << GAR_REG) | sc->sc_mdclk;
+	mac_write(sc, GMACGAR, miia | GAR_BUSY);
 	error = spin_waitfor(sc, GMACGAR, GAR_BUSY);
 	if (error)
 		return error;
@@ -1060,13 +1065,13 @@ static int
 mii_writereg(device_t self, int phy, int reg, uint16_t val)
 {
 	struct scx_softc *sc = device_private(self);
-	uint32_t gar;
+	uint32_t miia;
 	uint16_t dummy;
 	int error;
 
-	gar = (phy << GAR_PHY) | (reg << GAR_REG) | sc->sc_gar;
+	miia = (phy << GAR_PHY) | (reg << GAR_REG) | sc->sc_mdclk;
 	mac_write(sc, GMACGDR, val);
-	mac_write(sc, GMACGAR, gar | GAR_IOWR | GAR_BUSY);
+	mac_write(sc, GMACGAR, miia | GAR_IOWR | GAR_BUSY);
 	error = spin_waitfor(sc, GMACGAR, GAR_BUSY);
 	if (error)
 		return error;
@@ -1390,12 +1395,12 @@ mac_write(struct scx_softc *sc, int reg,
 }
 
 static int
-get_garclk(uint32_t freq)
+get_mdioclk(uint32_t freq)
 {
 
 	const struct {
 		uint16_t freq, bit; /* GAR 5:2 MDIO frequency selection */
-	} garclk[] = {
+	} mdioclk[] = {
 		{ 35,	2 },	/* 25-35 MHz */
 		{ 60,	3 },	/* 35-60 MHz */
 		{ 100,	0 },	/* 60-100 MHz */
@@ -1406,13 +1411,13 @@ get_garclk(uint32_t freq)
 	int i;
 
 	/* convert MDIO clk to a divisor value */
-	if (freq < garclk[0].freq)
-		return garclk[0].bit;
-	for (i = 1; i < __arraycount(garclk); i++) {
-		if (freq < garclk[i].freq)
-			return garclk[i-1].bit;
+	if (freq < mdioclk[0].freq)
+		return mdioclk[0].bit;
+	for (i = 1; i < __arraycount(mdioclk); i++) {
+		if (freq < mdioclk[i].freq)
+			return mdioclk[i-1].bit;
 	}
-	return garclk[__arraycount(garclk) - 1].bit;
+	return mdioclk[__arraycount(mdioclk) - 1].bit << GAR_CTL;
 }
 
 static void



CVS commit: src/lib/librumpuser

2020-03-23 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Mar 24 01:56:56 UTC 2020

Modified Files:
src/lib/librumpuser: rumpuser_sp.c

Log Message:
Avoid buffer overflow

Detected with ASan + RUMPKERNEL.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/lib/librumpuser/rumpuser_sp.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/librumpuser/rumpuser_sp.c
diff -u src/lib/librumpuser/rumpuser_sp.c:1.72 src/lib/librumpuser/rumpuser_sp.c:1.73
--- src/lib/librumpuser/rumpuser_sp.c:1.72	Tue Sep  6 07:45:41 2016
+++ src/lib/librumpuser/rumpuser_sp.c	Tue Mar 24 01:56:56 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: rumpuser_sp.c,v 1.72 2016/09/06 07:45:41 martin Exp $	*/
+/*  $NetBSD: rumpuser_sp.c,v 1.73 2020/03/24 01:56:56 kamil Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -37,7 +37,7 @@
 #include "rumpuser_port.h"
 
 #if !defined(lint)
-__RCSID("$NetBSD: rumpuser_sp.c,v 1.72 2016/09/06 07:45:41 martin Exp $");
+__RCSID("$NetBSD: rumpuser_sp.c,v 1.73 2020/03/24 01:56:56 kamil Exp $");
 #endif /* !lint */
 
 #include 
@@ -717,7 +717,7 @@ serv_handleexec(struct spclient *spc, st
 
 	/* ensure comm is 0-terminated */
 	/* TODO: make sure it contains sensible chars? */
-	comm[commlen] = '\0';
+	comm[commlen - 1] = '\0';
 
 	lwproc_switch(spc->spc_mainlwp);
 	lwproc_execnotify(comm);
@@ -981,7 +981,7 @@ handlereq(struct spclient *spc)
 
 			/* ensure it's 0-terminated */
 			/* XXX make sure it contains sensible chars? */
-			comm[commlen] = '\0';
+			comm[commlen - 1] = '\0';
 
 			/* make sure we fork off of proc1 */
 			_DIAGASSERT(lwproc_curlwp() == NULL);



CVS commit: src/lib/librumpuser

2020-03-23 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Mar 24 01:13:41 UTC 2020

Modified Files:
src/lib/librumpuser: sp_common.c

Log Message:
Fix off-by-one

Before accessing array member, check whether it is not out of valid range.

Detected with ASan + RUMPKERNEL.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/lib/librumpuser/sp_common.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/librumpuser/sp_common.c
diff -u src/lib/librumpuser/sp_common.c:1.39 src/lib/librumpuser/sp_common.c:1.40
--- src/lib/librumpuser/sp_common.c:1.39	Mon Sep  5 20:41:59 2016
+++ src/lib/librumpuser/sp_common.c	Tue Mar 24 01:13:41 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: sp_common.c,v 1.39 2016/09/05 20:41:59 dholland Exp $	*/
+/*  $NetBSD: sp_common.c,v 1.40 2020/03/24 01:13:41 kamil Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -342,7 +342,7 @@ dosend(struct spclient *spc, struct iove
 		}
 
 		/* ok, need to adjust iovec for potential next round */
-		while (n >= (ssize_t)iov[0].iov_len && iovlen) {
+		while (iovlen && n >= (ssize_t)iov[0].iov_len) {
 			n -= iov[0].iov_len;
 			iov++;
 			iovlen--;



CVS commit: src/sys

2020-03-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Mon Mar 23 23:28:47 UTC 2020

Modified Files:
src/sys/rump/include/rump: rump_namei.h
src/sys/sys: namei.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/rump/include/rump/rump_namei.h
cvs rdiff -u -r1.106 -r1.107 src/sys/sys/namei.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/rump/include/rump/rump_namei.h
diff -u src/sys/rump/include/rump/rump_namei.h:1.40 src/sys/rump/include/rump/rump_namei.h:1.41
--- src/sys/rump/include/rump/rump_namei.h:1.40	Mon Mar 23 18:43:48 2020
+++ src/sys/rump/include/rump/rump_namei.h	Mon Mar 23 23:28:47 2020
@@ -1,11 +1,11 @@
-/*	$NetBSD: rump_namei.h,v 1.40 2020/03/23 18:43:48 ad Exp $	*/
+/*	$NetBSD: rump_namei.h,v 1.41 2020/03/23 23:28:47 ad Exp $	*/
 
 
 /*
  * WARNING: GENERATED FILE.  DO NOT EDIT
  * (edit namei.src and run make namei in src/sys/sys)
  *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
- *   from: NetBSD: namei.src,v 1.51 2020/03/23 18:41:40 ad Exp 
+ *   from: NetBSD: namei.src,v 1.52 2020/03/23 23:28:11 ad Exp 
  */
 
 #ifndef _RUMP_RUMP_NAMEI_H_

Index: src/sys/sys/namei.h
diff -u src/sys/sys/namei.h:1.106 src/sys/sys/namei.h:1.107
--- src/sys/sys/namei.h:1.106	Mon Mar 23 18:43:48 2020
+++ src/sys/sys/namei.h	Mon Mar 23 23:28:47 2020
@@ -1,11 +1,11 @@
-/*	$NetBSD: namei.h,v 1.106 2020/03/23 18:43:48 ad Exp $	*/
+/*	$NetBSD: namei.h,v 1.107 2020/03/23 23:28:47 ad Exp $	*/
 
 
 /*
  * WARNING: GENERATED FILE.  DO NOT EDIT
  * (edit namei.src and run make namei in src/sys/sys)
  *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
- *   from: NetBSD: namei.src,v 1.51 2020/03/23 18:41:40 ad Exp 
+ *   from: NetBSD: namei.src,v 1.52 2020/03/23 23:28:11 ad Exp 
  */
 
 /*
@@ -216,16 +216,15 @@ struct nameidata {
  * Field markings and their corresponding locks:
  *
  * -  stable throught the lifetime of the namecache entry
- * d  protected by nc_dvp->vi_ncdlock
- * v  protected by nc_dvp->vi_ncvlock
+ * d  protected by nc_dvp->vi_nc_lock
+ * v  protected by nc_vp->vi_nc_listlock
  * l  protected by cache_lru_lock
- * u  accesses are unlocked, no serialization applied
  */
 struct nchnode;
 struct namecache {
 	struct	rb_node nc_tree;	/* d  red-black tree, must be first */
-	uint64_t nc_key;		/* -  hash key */
-	TAILQ_ENTRY(namecache) nc_list;	/* v  vp's list of cache entries */
+	uint64_t nc_key;		/* -  hashed key value */
+	TAILQ_ENTRY(namecache) nc_list;	/* v  nc_vp's list of cache entries */
 	TAILQ_ENTRY(namecache) nc_lru;	/* l  pseudo-lru chain */
 	struct	vnode *nc_dvp;		/* -  vnode of parent of name */
 	struct	vnode *nc_vp;		/* -  vnode the name refers to */



CVS commit: src/sys/sys

2020-03-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Mon Mar 23 23:28:11 UTC 2020

Modified Files:
src/sys/sys: namei.src

Log Message:
Update comments


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/sys/namei.src

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/namei.src
diff -u src/sys/sys/namei.src:1.51 src/sys/sys/namei.src:1.52
--- src/sys/sys/namei.src:1.51	Mon Mar 23 18:41:40 2020
+++ src/sys/sys/namei.src	Mon Mar 23 23:28:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: namei.src,v 1.51 2020/03/23 18:41:40 ad Exp $	*/
+/*	$NetBSD: namei.src,v 1.52 2020/03/23 23:28:11 ad Exp $	*/
 
 /*
  * Copyright (c) 1985, 1989, 1991, 1993
@@ -208,16 +208,15 @@ NAMEIFL	PARAMASK	0x02ee300	/* mask of pa
  * Field markings and their corresponding locks:
  *
  * -  stable throught the lifetime of the namecache entry
- * d  protected by nc_dvp->vi_ncdlock
- * v  protected by nc_dvp->vi_ncvlock
+ * d  protected by nc_dvp->vi_nc_lock
+ * v  protected by nc_vp->vi_nc_listlock
  * l  protected by cache_lru_lock
- * u  accesses are unlocked, no serialization applied
  */
 struct nchnode;
 struct namecache {
 	struct	rb_node nc_tree;	/* d  red-black tree, must be first */
-	uint64_t nc_key;		/* -  hash key */
-	TAILQ_ENTRY(namecache) nc_list;	/* v  vp's list of cache entries */
+	uint64_t nc_key;		/* -  hashed key value */
+	TAILQ_ENTRY(namecache) nc_list;	/* v  nc_vp's list of cache entries */
 	TAILQ_ENTRY(namecache) nc_lru;	/* l  pseudo-lru chain */
 	struct	vnode *nc_dvp;		/* -  vnode of parent of name */
 	struct	vnode *nc_vp;		/* -  vnode the name refers to */



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

2020-03-23 Thread Patrick Welche
Module Name:src
Committed By:   prlw1
Date:   Mon Mar 23 22:29:23 UTC 2020

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

Log Message:
The image size increased.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/evbarm/conf/RPI_INSTALL

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

Modified files:

Index: src/sys/arch/evbarm/conf/RPI_INSTALL
diff -u src/sys/arch/evbarm/conf/RPI_INSTALL:1.12 src/sys/arch/evbarm/conf/RPI_INSTALL:1.13
--- src/sys/arch/evbarm/conf/RPI_INSTALL:1.12	Fri Jan 24 06:34:19 2020
+++ src/sys/arch/evbarm/conf/RPI_INSTALL	Mon Mar 23 22:29:23 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: RPI_INSTALL,v 1.12 2020/01/24 06:34:19 mlelstv Exp $
+#	$NetBSD: RPI_INSTALL,v 1.13 2020/03/23 22:29:23 prlw1 Exp $
 #
 #	RPI_INSTALL -- RPI kernel with installation-sized
 #	ramdisk
@@ -8,7 +8,7 @@ include "arch/evbarm/conf/RPI"
 include "arch/evbarm/conf/INSTALL"
 
 no options	MEMORY_DISK_ROOT_SIZE
-options 	MEMORY_DISK_ROOT_SIZE=66000
+options 	MEMORY_DISK_ROOT_SIZE=86000
 
 makeoptions	RAMDISKNAME=sshramdisk
 no makeoptions	DEBUG



CVS commit: src/crypto/external/bsd/openssl/dist/test/testutil

2020-03-23 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Mar 23 22:21:34 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/dist/test/testutil: format_output.c
main.c output.h tests.c

Log Message:
Fix format string usage.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/openssl/dist/test/testutil/format_output.c \
src/crypto/external/bsd/openssl/dist/test/testutil/main.c \
src/crypto/external/bsd/openssl/dist/test/testutil/tests.c
cvs rdiff -u -r1.3 -r1.4 \
src/crypto/external/bsd/openssl/dist/test/testutil/output.h

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

Modified files:

Index: src/crypto/external/bsd/openssl/dist/test/testutil/format_output.c
diff -u src/crypto/external/bsd/openssl/dist/test/testutil/format_output.c:1.4 src/crypto/external/bsd/openssl/dist/test/testutil/format_output.c:1.5
--- src/crypto/external/bsd/openssl/dist/test/testutil/format_output.c:1.4	Sun Mar 22 00:53:11 2020
+++ src/crypto/external/bsd/openssl/dist/test/testutil/format_output.c	Mon Mar 23 22:21:34 2020
@@ -31,9 +31,9 @@ static void test_diff_header(const char 
 static void test_string_null_empty(const char *m, char c)
 {
 if (m == NULL)
-test_printf_stderr("% 4s %c NULL\n", "", c);
+test_printf_stderr("%4s %c NULL\n", "", c);
 else
-test_printf_stderr("% 4u:%c ''\n", 0u, c);
+test_printf_stderr("%4u:%c ''\n", 0u, c);
 }
 
 static void test_fail_string_common(const char *prefix, const char *file,
@@ -94,18 +94,18 @@ static void test_fail_string_common(cons
 bdiff[i] = '\0';
 }
 if (n1 == n2 && !diff) {
-test_printf_stderr("% 4u:  '%s'\n", cnt, n2 > n1 ? b2 : b1);
+test_printf_stderr("%4u:  '%s'\n", cnt, n2 > n1 ? b2 : b1);
 } else {
 if (cnt == 0 && (m1 == NULL || *m1 == '\0'))
 test_string_null_empty(m1, '-');
 else if (n1 > 0)
-test_printf_stderr("% 4u:- '%s'\n", cnt, b1);
+test_printf_stderr("%4u:- '%s'\n", cnt, b1);
 if (cnt == 0 && (m2 == NULL || *m2 == '\0'))
test_string_null_empty(m2, '+');
 else if (n2 > 0)
-test_printf_stderr("% 4u:+ '%s'\n", cnt, b2);
+test_printf_stderr("%4u:+ '%s'\n", cnt, b2);
 if (diff && i > 0)
-test_printf_stderr("% 4s%s\n", "", bdiff);
+test_printf_stderr("%4s%s\n", "", bdiff);
 }
 m1 += n1;
 m2 += n2;
@@ -410,7 +410,7 @@ void test_output_bignum(const char *name
 static void test_memory_null_empty(const unsigned char *m, char c)
 {
 if (m == NULL)
-test_printf_stderr("% 4s %c%s\n", "", c, "NULL");
+test_printf_stderr("%4s %c%s\n", "", c, "NULL");
 else
 test_printf_stderr("%04x %c%s\n", 0u, c, "empty");
 }
@@ -494,7 +494,7 @@ static void test_fail_memory_common(cons
 else if (n2 > 0)
 test_printf_stderr("%04x:+%s\n", cnt, b2);
 if (diff && i > 0)
-test_printf_stderr("% 4s  %s\n", "", bdiff);
+test_printf_stderr("%4s  %s\n", "", bdiff);
 }
 m1 += n1;
 m2 += n2;
Index: src/crypto/external/bsd/openssl/dist/test/testutil/main.c
diff -u src/crypto/external/bsd/openssl/dist/test/testutil/main.c:1.4 src/crypto/external/bsd/openssl/dist/test/testutil/main.c:1.5
--- src/crypto/external/bsd/openssl/dist/test/testutil/main.c:1.4	Sun Mar 22 00:53:11 2020
+++ src/crypto/external/bsd/openssl/dist/test/testutil/main.c	Mon Mar 23 22:21:34 2020
@@ -25,7 +25,7 @@ static void check_arg_usage(void)
 
 for (i = 0; i < n; i++)
 if (!arg_used[i+1])
-test_printf_stderr("Warning ignored command-line argument %d: %s\n",
+test_printf_stderr("Warning ignored command-line argument %zu: %s\n",
i, args[i+1]);
 if (i < arg_count)
 test_printf_stderr("Warning arguments %zu and later unchecked\n", i);
Index: src/crypto/external/bsd/openssl/dist/test/testutil/tests.c
diff -u src/crypto/external/bsd/openssl/dist/test/testutil/tests.c:1.4 src/crypto/external/bsd/openssl/dist/test/testutil/tests.c:1.5
--- src/crypto/external/bsd/openssl/dist/test/testutil/tests.c:1.4	Sun Mar 22 00:53:11 2020
+++ src/crypto/external/bsd/openssl/dist/test/testutil/tests.c	Mon Mar 23 22:21:34 2020
@@ -72,6 +72,7 @@ static void test_fail_message(const char
   const char *fmt, ...)
 PRINTF_FORMAT(8, 9);
 
+PRINTF_FORMAT(8, 0)
 static void test_fail_message_va(const char *prefix, const char *file,
  int line, const char *type,
  const char *left, const char *right,

Index: src/crypto/external/bsd/openssl/dist/test/testutil/output.h
diff -u 

CVS commit: src/sys/kern

2020-03-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Mon Mar 23 20:02:14 UTC 2020

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

Log Message:
cache_remove(): remove from the vnode list first, so cache_revlookup()
doesn't try to re-activate an entry no longer on the LRU list.


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sys/kern/vfs_cache.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/vfs_cache.c
diff -u src/sys/kern/vfs_cache.c:1.133 src/sys/kern/vfs_cache.c:1.134
--- src/sys/kern/vfs_cache.c:1.133	Mon Mar 23 19:45:11 2020
+++ src/sys/kern/vfs_cache.c	Mon Mar 23 20:02:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_cache.c,v 1.133 2020/03/23 19:45:11 ad Exp $	*/
+/*	$NetBSD: vfs_cache.c,v 1.134 2020/03/23 20:02:13 ad Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -172,7 +172,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.133 2020/03/23 19:45:11 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.134 2020/03/23 20:02:13 ad Exp $");
 
 #define __NAMECACHE_PRIVATE
 #ifdef _KERNEL_OPT
@@ -357,16 +357,10 @@ cache_remove(struct namecache *ncp, cons
 	SDT_PROBE(vfs, namecache, invalidate, done, ncp,
 	0, 0, 0, 0);
 
-	/* First remove from the directory's rbtree. */
-	rb_tree_remove_node(>vi_nc_tree, ncp);
-
-	/* Then remove from the LRU lists. */
-	mutex_enter(_lru_lock);
-	TAILQ_REMOVE(_lru.list[ncp->nc_lrulist], ncp, nc_lru);
-	cache_lru.count[ncp->nc_lrulist]--;
-	mutex_exit(_lru_lock);
-
-	/* Then remove from the node's list. */
+	/*
+	 * Remove from the vnode's list.  This excludes cache_revlookup(),
+	 * and then it's safe to remove from the LRU lists.
+	 */
 	if ((vp = ncp->nc_vp) != NULL) {
 		vnode_impl_t *vi = VNODE_TO_VIMPL(vp);
 		if (__predict_true(dir2node)) {
@@ -378,6 +372,15 @@ cache_remove(struct namecache *ncp, cons
 		}
 	}
 
+	/* Remove from the directory's rbtree. */
+	rb_tree_remove_node(>vi_nc_tree, ncp);
+
+	/* Remove from the LRU lists. */
+	mutex_enter(_lru_lock);
+	TAILQ_REMOVE(_lru.list[ncp->nc_lrulist], ncp, nc_lru);
+	cache_lru.count[ncp->nc_lrulist]--;
+	mutex_exit(_lru_lock);
+
 	/* Finally, free it. */
 	if (ncp->nc_nlen > NCHNAMLEN) {
 		size_t sz = offsetof(struct namecache, nc_name[ncp->nc_nlen]);



CVS commit: src/sys/kern

2020-03-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Mon Mar 23 19:45:11 UTC 2020

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

Log Message:
Oops. Fix merge error.


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/kern/vfs_cache.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/vfs_cache.c
diff -u src/sys/kern/vfs_cache.c:1.132 src/sys/kern/vfs_cache.c:1.133
--- src/sys/kern/vfs_cache.c:1.132	Mon Mar 23 18:56:14 2020
+++ src/sys/kern/vfs_cache.c	Mon Mar 23 19:45:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_cache.c,v 1.132 2020/03/23 18:56:14 ad Exp $	*/
+/*	$NetBSD: vfs_cache.c,v 1.133 2020/03/23 19:45:11 ad Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -172,7 +172,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.132 2020/03/23 18:56:14 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.133 2020/03/23 19:45:11 ad Exp $");
 
 #define __NAMECACHE_PRIVATE
 #ifdef _KERNEL_OPT
@@ -621,6 +621,7 @@ cache_lookup_raw(struct vnode *dvp, cons
  * names in the cache.  The node locks are chained along the way: a parent's
  * lock is not dropped until the child's is acquired.
  */
+#ifdef notyet
 bool
 cache_lookup_linked(struct vnode *dvp, const char *name, size_t namelen,
 		struct vnode **vn_ret, krwlock_t **plock,
@@ -717,6 +718,7 @@ cache_lookup_linked(struct vnode *dvp, c
 	*vn_ret = ncp->nc_vp;
 	return true;
 }
+#endif	/* notyet */
 
 /*
  * Scan cache looking for name of directory entry pointing at vp.
@@ -957,6 +959,7 @@ cache_enter_id(struct vnode *vp, mode_t 
  * information, missing some updates, so always check the mount flag
  * instead of looking for !VNOVAL.
  */
+#ifdef notyet
 bool
 cache_have_id(struct vnode *vp)
 {
@@ -971,6 +974,7 @@ cache_have_id(struct vnode *vp)
 		return false;
 	}
 }
+#endif	/* notyet */
 
 /*
  * Name cache initialization, from vfs_init() when the system is booting.



CVS commit: src/sys/sys

2020-03-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Mon Mar 23 19:14:06 UTC 2020

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

Log Message:
Cosmetic tweak


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/sys/syncobj.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/syncobj.h
diff -u src/sys/sys/syncobj.h:1.11 src/sys/sys/syncobj.h:1.12
--- src/sys/sys/syncobj.h:1.11	Sun Feb 23 16:27:09 2020
+++ src/sys/sys/syncobj.h	Mon Mar 23 19:14:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: syncobj.h,v 1.11 2020/02/23 16:27:09 ad Exp $	*/
+/*	$NetBSD: syncobj.h,v 1.12 2020/03/23 19:14:06 ad Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2020 The NetBSD Foundation, Inc.
@@ -57,9 +57,9 @@ struct lwp *syncobj_noowner(wchan_t);
 #define	SOBJ_SLEEPQ_NULL	0x08
 
 extern syncobj_t	cv_syncobj;
+extern syncobj_t	kpause_syncobj;
 extern syncobj_t	lwp_park_syncobj;
 extern syncobj_t	mutex_syncobj;
-extern syncobj_t	kpause_syncobj;
 extern syncobj_t	rw_syncobj;
 extern syncobj_t	sched_syncobj;
 extern syncobj_t	select_syncobj;



CVS commit: src/sys/kern

2020-03-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Mon Mar 23 18:56:15 UTC 2020

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

Log Message:
Correct an assertion.


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/kern/vfs_cache.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/vfs_cache.c
diff -u src/sys/kern/vfs_cache.c:1.131 src/sys/kern/vfs_cache.c:1.132
--- src/sys/kern/vfs_cache.c:1.131	Mon Mar 23 18:41:40 2020
+++ src/sys/kern/vfs_cache.c	Mon Mar 23 18:56:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_cache.c,v 1.131 2020/03/23 18:41:40 ad Exp $	*/
+/*	$NetBSD: vfs_cache.c,v 1.132 2020/03/23 18:56:14 ad Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -172,7 +172,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.131 2020/03/23 18:41:40 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.132 2020/03/23 18:56:14 ad Exp $");
 
 #define __NAMECACHE_PRIVATE
 #ifdef _KERNEL_OPT
@@ -352,7 +352,7 @@ cache_remove(struct namecache *ncp, cons
 
 	KASSERT(rw_write_held(>vi_nc_lock));
 	KASSERT(cache_key(ncp->nc_name, ncp->nc_nlen) == ncp->nc_key);
-	KASSERT(rb_tree_find_node(>vi_nc_tree, >nc_key) == ncp);
+	KASSERT(rb_tree_find_node(>vi_nc_tree, ncp) == ncp);
 
 	SDT_PROBE(vfs, namecache, invalidate, done, ncp,
 	0, 0, 0, 0);
@@ -621,7 +621,6 @@ cache_lookup_raw(struct vnode *dvp, cons
  * names in the cache.  The node locks are chained along the way: a parent's
  * lock is not dropped until the child's is acquired.
  */
-#ifdef notyet
 bool
 cache_lookup_linked(struct vnode *dvp, const char *name, size_t namelen,
 		struct vnode **vn_ret, krwlock_t **plock,
@@ -718,7 +717,6 @@ cache_lookup_linked(struct vnode *dvp, c
 	*vn_ret = ncp->nc_vp;
 	return true;
 }
-#endif /* notyet */
 
 /*
  * Scan cache looking for name of directory entry pointing at vp.
@@ -959,7 +957,6 @@ cache_enter_id(struct vnode *vp, mode_t 
  * information, missing some updates, so always check the mount flag
  * instead of looking for !VNOVAL.
  */
-#ifdef notyet
 bool
 cache_have_id(struct vnode *vp)
 {
@@ -974,7 +971,6 @@ cache_have_id(struct vnode *vp)
 		return false;
 	}
 }
-#endif /* notyet */
 
 /*
  * Name cache initialization, from vfs_init() when the system is booting.



CVS commit: src/usr.bin/vmstat

2020-03-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Mon Mar 23 18:44:18 UTC 2020

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
ncs_collisions is gone.


To generate a diff of this commit:
cvs rdiff -u -r1.238 -r1.239 src/usr.bin/vmstat/vmstat.c

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

Modified files:

Index: src/usr.bin/vmstat/vmstat.c
diff -u src/usr.bin/vmstat/vmstat.c:1.238 src/usr.bin/vmstat/vmstat.c:1.239
--- src/usr.bin/vmstat/vmstat.c:1.238	Sun Mar 22 18:32:42 2020
+++ src/usr.bin/vmstat/vmstat.c	Mon Mar 23 18:44:17 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.238 2020/03/22 18:32:42 ad Exp $ */
+/* $NetBSD: vmstat.c,v 1.239 2020/03/23 18:44:17 ad Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007, 2019, 2020
@@ -71,7 +71,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)vmstat.c	8.2 (Berkeley) 3/1/95";
 #else
-__RCSID("$NetBSD: vmstat.c,v 1.238 2020/03/22 18:32:42 ad Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.239 2020/03/23 18:44:17 ad Exp $");
 #endif
 #endif /* not lint */
 
@@ -1124,7 +1124,6 @@ dosum(void)
 	(void)printf("%9" PRIu64 " 2passes\n", nch_stats.ncs_2passes);
 	(void)printf("%9" PRIu64 " reverse hits\n", nch_stats.ncs_revhits);
 	(void)printf("%9" PRIu64 " reverse miss\n", nch_stats.ncs_revmiss);
-	(void)printf("%9" PRIu64 " hash collisions\n", nch_stats.ncs_collisions);
 	(void)printf("%9" PRIu64 " access denied\n", nch_stats.ncs_denied);
 	(void)printf(
 	"%9s cache hits (%d%% pos + %d%% neg) system %d%% per-process\n",



CVS commit: src/sys

2020-03-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Mon Mar 23 18:43:48 UTC 2020

Modified Files:
src/sys/rump/include/rump: rump_namei.h
src/sys/sys: namei.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/rump/include/rump/rump_namei.h
cvs rdiff -u -r1.105 -r1.106 src/sys/sys/namei.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/rump/include/rump/rump_namei.h
diff -u src/sys/rump/include/rump/rump_namei.h:1.39 src/sys/rump/include/rump/rump_namei.h:1.40
--- src/sys/rump/include/rump/rump_namei.h:1.39	Sun Mar 22 14:39:03 2020
+++ src/sys/rump/include/rump/rump_namei.h	Mon Mar 23 18:43:48 2020
@@ -1,11 +1,11 @@
-/*	$NetBSD: rump_namei.h,v 1.39 2020/03/22 14:39:03 ad Exp $	*/
+/*	$NetBSD: rump_namei.h,v 1.40 2020/03/23 18:43:48 ad Exp $	*/
 
 
 /*
  * WARNING: GENERATED FILE.  DO NOT EDIT
  * (edit namei.src and run make namei in src/sys/sys)
  *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
- *   from: NetBSD: namei.src,v 1.49 2020/03/22 14:38:37 ad Exp 
+ *   from: NetBSD: namei.src,v 1.51 2020/03/23 18:41:40 ad Exp 
  */
 
 #ifndef _RUMP_RUMP_NAMEI_H_

Index: src/sys/sys/namei.h
diff -u src/sys/sys/namei.h:1.105 src/sys/sys/namei.h:1.106
--- src/sys/sys/namei.h:1.105	Sun Mar 22 14:39:03 2020
+++ src/sys/sys/namei.h	Mon Mar 23 18:43:48 2020
@@ -1,11 +1,11 @@
-/*	$NetBSD: namei.h,v 1.105 2020/03/22 14:39:03 ad Exp $	*/
+/*	$NetBSD: namei.h,v 1.106 2020/03/23 18:43:48 ad Exp $	*/
 
 
 /*
  * WARNING: GENERATED FILE.  DO NOT EDIT
  * (edit namei.src and run make namei in src/sys/sys)
  *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
- *   from: NetBSD: namei.src,v 1.49 2020/03/22 14:38:37 ad Exp 
+ *   from: NetBSD: namei.src,v 1.51 2020/03/23 18:41:40 ad Exp 
  */
 
 /*
@@ -224,13 +224,13 @@ struct nameidata {
 struct nchnode;
 struct namecache {
 	struct	rb_node nc_tree;	/* d  red-black tree, must be first */
-	int64_t	nc_key;			/* -  hash key */
+	uint64_t nc_key;		/* -  hash key */
 	TAILQ_ENTRY(namecache) nc_list;	/* v  vp's list of cache entries */
 	TAILQ_ENTRY(namecache) nc_lru;	/* l  pseudo-lru chain */
 	struct	vnode *nc_dvp;		/* -  vnode of parent of name */
 	struct	vnode *nc_vp;		/* -  vnode the name refers to */
 	int	nc_lrulist;		/* l  which LRU list its on */
-	short	nc_nlen;		/* -  length of the name */
+	u_short	nc_nlen;		/* -  length of the name */
 	char	nc_whiteout;		/* -  true if a whiteout */
 	char	nc_name[41];		/* -  segment name */
 };
@@ -336,7 +336,6 @@ void	namecache_print(struct vnode *, voi
 	type	ncs_2passes;	/* number of times we attempt it (U) */	\
 	type	ncs_revhits;	/* reverse-cache hits */		\
 	type	ncs_revmiss;	/* reverse-cache misses */		\
-	type	ncs_collisions;	/* hash value collisions */		\
 	type	ncs_denied;	/* access denied */			\
 }
 



CVS commit: src/sys

2020-03-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Mon Mar 23 18:41:40 UTC 2020

Modified Files:
src/sys/kern: vfs_cache.c
src/sys/sys: namei.src

Log Message:
- Deal with (rare) hash collisions by using memcmp() to partition further.
- Adjust some comments.


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/sys/kern/vfs_cache.c
cvs rdiff -u -r1.50 -r1.51 src/sys/sys/namei.src

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/vfs_cache.c
diff -u src/sys/kern/vfs_cache.c:1.130 src/sys/kern/vfs_cache.c:1.131
--- src/sys/kern/vfs_cache.c:1.130	Mon Mar 23 18:37:30 2020
+++ src/sys/kern/vfs_cache.c	Mon Mar 23 18:41:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_cache.c,v 1.130 2020/03/23 18:37:30 ad Exp $	*/
+/*	$NetBSD: vfs_cache.c,v 1.131 2020/03/23 18:41:40 ad Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -172,7 +172,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.130 2020/03/23 18:37:30 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.131 2020/03/23 18:41:40 ad Exp $");
 
 #define __NAMECACHE_PRIVATE
 #ifdef _KERNEL_OPT
@@ -203,16 +203,19 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,
 
 static void	cache_activate(struct namecache *);
 static void	cache_update_stats(void *);
-static int	cache_compare_key(void *, const void *, const void *);
 static int	cache_compare_nodes(void *, const void *, const void *);
 static void	cache_deactivate(void);
 static void	cache_reclaim(void);
 static int	cache_stat_sysctl(SYSCTLFN_ARGS);
 
-/* Global pool cache. */
+/*
+ * Global pool cache.
+ */
 static pool_cache_t cache_pool __read_mostly;
 
-/* LRU replacement. */
+/*
+ * LRU replacement.
+ */
 enum cache_lru_id {
 	LRU_ACTIVE,
 	LRU_INACTIVE,
@@ -226,7 +229,9 @@ static struct {
 
 static kmutex_t cache_lru_lock __cacheline_aligned;
 
-/* Cache effectiveness statistics.  nchstats holds system-wide total. */
+/*
+ * Cache effectiveness statistics.  nchstats holds system-wide total.
+ */
 struct nchstats	nchstats;
 struct nchstats_percpu _NAMEI_CACHE_STATS(uint32_t);
 struct nchcpu {
@@ -258,18 +263,24 @@ int cache_lru_maxscan __read_mostly = 64
 int cache_maxlen __read_mostly = USHRT_MAX;	/* max name length to cache */
 int cache_stat_interval __read_mostly = 300;	/* in seconds */
 
-/* sysctl */
+/*
+ * sysctl stuff.
+ */
 static struct	sysctllog *cache_sysctllog;
 
-/* Read-black tree */
+/*
+ * Red-black tree stuff.
+ */
 static const rb_tree_ops_t cache_rbtree_ops = {
 	.rbto_compare_nodes = cache_compare_nodes,
-	.rbto_compare_key = cache_compare_key,
+	.rbto_compare_key = cache_compare_nodes,
 	.rbto_node_offset = offsetof(struct namecache, nc_tree),
 	.rbto_context = NULL
 };
 
-/* dtrace hooks */
+/*
+ * dtrace probes.
+ */
 SDT_PROVIDER_DEFINE(vfs);
 
 SDT_PROBE_DEFINE1(vfs, namecache, invalidate, done, "struct vnode *");
@@ -308,25 +319,8 @@ cache_compare_nodes(void *context, const
 	if (nc1->nc_key > nc2->nc_key) {
 		return 1;
 	}
-	return 0;
-}
-
-/*
- * rbtree: compare a node and a key.
- */
-static int
-cache_compare_key(void *context, const void *n, const void *k)
-{
-	const struct namecache *ncp = n;
-	const uint64_t key = *(const uint64_t *)k;
-
-	if (ncp->nc_key < key) {
-		return -1;
-	}
-	if (ncp->nc_key > key) {
-		return 1;
-	}
-	return 0;
+	KASSERT(nc1->nc_nlen == nc2->nc_nlen);
+	return memcmp(nc1->nc_name, nc2->nc_name, nc1->nc_nlen);
 }
 
 /*
@@ -346,26 +340,6 @@ cache_key(const char *name, size_t nlen)
 }
 
 /*
- * Like bcmp() but tuned for the use case here which is:
- *
- * - always of equal length both sides
- * - almost always the same string both sides
- * - small strings
- */
-static inline int
-cache_namecmp(struct namecache *ncp, const char *name, size_t namelen)
-{
-	size_t i;
-	int d;
-
-	KASSERT(ncp->nc_nlen == namelen);
-	for (d = 0, i = 0; i < namelen; i++) {
-		d |= (ncp->nc_name[i] ^ name[i]);
-	}
-	return d;
-}
-
-/*
  * Remove an entry from the cache.  vi_nc_lock must be held, and if dir2node
  * is true, then we're locking in the conventional direction and the list
  * lock will be acquired when removing the entry from the vnode list.
@@ -423,7 +397,7 @@ cache_lookup_entry(struct vnode *dvp, co
 	vnode_impl_t *dvi = VNODE_TO_VIMPL(dvp);
 	struct rb_node *node = dvi->vi_nc_tree.rbt_root;
 	struct namecache *ncp;
-	int lrulist;
+	int lrulist, diff;
 
 	KASSERT(rw_lock_held(>vi_nc_lock));
 
@@ -431,6 +405,10 @@ cache_lookup_entry(struct vnode *dvp, co
 	 * Search the RB tree for the key.  This is an inlined lookup
 	 * tailored for exactly what's needed here (64-bit key and so on)
 	 * that is quite a bit faster than using rb_tree_find_node(). 
+	 *
+	 * In the fast path memcmp() needs to be called at least once to
+	 * confirm that the correct name has been found.  If there has been
+	 * a hash value collision (very rare) the search will continue on.
 	 */
 	for (;;) {
 		if 

CVS commit: src/sys/kern

2020-03-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Mon Mar 23 18:37:31 UTC 2020

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

Log Message:
Fix a race between cache_enter() and cache_lookup().  Make sure the cache
entry is fully constructed before it appears on a vnode list.


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/sys/kern/vfs_cache.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/vfs_cache.c
diff -u src/sys/kern/vfs_cache.c:1.129 src/sys/kern/vfs_cache.c:1.130
--- src/sys/kern/vfs_cache.c:1.129	Mon Mar 23 18:33:43 2020
+++ src/sys/kern/vfs_cache.c	Mon Mar 23 18:37:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_cache.c,v 1.129 2020/03/23 18:33:43 ad Exp $	*/
+/*	$NetBSD: vfs_cache.c,v 1.130 2020/03/23 18:37:30 ad Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -172,7 +172,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.129 2020/03/23 18:33:43 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.130 2020/03/23 18:37:30 ad Exp $");
 
 #define __NAMECACHE_PRIVATE
 #ifdef _KERNEL_OPT
@@ -896,16 +896,20 @@ cache_enter(struct vnode *dvp, struct vn
 		ncp = kmem_alloc(sz, KM_SLEEP);
 	}
 
-	/* Fill in cache info. */
+	/*
+	 * Fill in cache info.  For negative hits, save the ISWHITEOUT flag
+	 * so we can restore it later when the cache entry is used again.
+	 */
+	ncp->nc_vp = vp;
 	ncp->nc_dvp = dvp;
 	ncp->nc_key = cache_key(name, namelen);
 	ncp->nc_nlen = namelen;
+	ncp->nc_whiteout = ((cnflags & ISWHITEOUT) != 0);
 	memcpy(ncp->nc_name, name, namelen);
 
 	/*
-	 * Insert to the directory.  Concurrent lookups in the same
-	 * directory may race for a cache entry.  There can also be hash
-	 * value collisions.  If there's a entry there already, purge it.
+	 * Insert to the directory.  Concurrent lookups may race for a cache
+	 * entry.  If there's a entry there already, purge it.
 	 */
 	rw_enter(>vi_nc_lock, RW_WRITER);
 	oncp = rb_tree_insert_node(>vi_nc_tree, ncp);
@@ -920,16 +924,23 @@ cache_enter(struct vnode *dvp, struct vn
 		KASSERT(oncp == ncp);
 	}
 
-	/* Then insert to the vnode. */
-	if (vp == NULL) {
-		/*
-		 * For negative hits, save the ISWHITEOUT flag so we can
-		 * restore it later when the cache entry is used again.
-		 */
-		ncp->nc_vp = NULL;
-		ncp->nc_whiteout = ((cnflags & ISWHITEOUT) != 0);
-	} else {
-		/* Partially sort the per-vnode list: dots go to back. */
+	/*
+	 * With the directory lock still held, insert to the tail of the
+	 * ACTIVE LRU list (new) and with the LRU lock held take the to
+	 * opportunity to incrementally balance the lists.
+	 */
+	mutex_enter(_lru_lock);
+	ncp->nc_lrulist = LRU_ACTIVE;
+	cache_lru.count[LRU_ACTIVE]++;
+	TAILQ_INSERT_TAIL(_lru.list[LRU_ACTIVE], ncp, nc_lru);
+	cache_deactivate();
+	mutex_exit(_lru_lock);
+
+	/*
+	 * Finally, insert to the vnode, and unlock.  Partially sort the
+	 * per-vnode list: dots go to back.
+	 */
+	if (vp != NULL) {
 		vnode_impl_t *vi = VNODE_TO_VIMPL(vp);
 		rw_enter(>vi_nc_listlock, RW_WRITER);
 		if ((namelen == 1 && name[0] == '.') ||
@@ -939,21 +950,7 @@ cache_enter(struct vnode *dvp, struct vn
 			TAILQ_INSERT_HEAD(>vi_nc_list, ncp, nc_list);
 		}
 		rw_exit(>vi_nc_listlock);
-		ncp->nc_vp = vp;
-		ncp->nc_whiteout = false;
 	}
-
-	/*
-	 * Finally, insert to the tail of the ACTIVE LRU list (new) and
-	 * with the LRU lock held take the to opportunity to incrementally
-	 * balance the lists.
-	 */
-	mutex_enter(_lru_lock);
-	ncp->nc_lrulist = LRU_ACTIVE;
-	cache_lru.count[LRU_ACTIVE]++;
-	TAILQ_INSERT_TAIL(_lru.list[LRU_ACTIVE], ncp, nc_lru);
-	cache_deactivate();
-	mutex_exit(_lru_lock);
 	rw_exit(>vi_nc_lock);
 }
 



CVS commit: src/sys

2020-03-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Mon Mar 23 18:33:43 UTC 2020

Modified Files:
src/sys/kern: vfs_cache.c
src/sys/sys: namei.src

Log Message:
Pacify a syzbot complaint about bit shifting.

Reported-by: syzbot+dd5df915b2cd2f3f3...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/sys/kern/vfs_cache.c
cvs rdiff -u -r1.49 -r1.50 src/sys/sys/namei.src

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/vfs_cache.c
diff -u src/sys/kern/vfs_cache.c:1.128 src/sys/kern/vfs_cache.c:1.129
--- src/sys/kern/vfs_cache.c:1.128	Sun Mar 22 14:38:37 2020
+++ src/sys/kern/vfs_cache.c	Mon Mar 23 18:33:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_cache.c,v 1.128 2020/03/22 14:38:37 ad Exp $	*/
+/*	$NetBSD: vfs_cache.c,v 1.129 2020/03/23 18:33:43 ad Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -172,7 +172,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.128 2020/03/22 14:38:37 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.129 2020/03/23 18:33:43 ad Exp $");
 
 #define __NAMECACHE_PRIVATE
 #ifdef _KERNEL_OPT
@@ -318,7 +318,7 @@ static int
 cache_compare_key(void *context, const void *n, const void *k)
 {
 	const struct namecache *ncp = n;
-	const int64_t key = *(const int64_t *)k;
+	const uint64_t key = *(const uint64_t *)k;
 
 	if (ncp->nc_key < key) {
 		return -1;
@@ -334,10 +334,10 @@ cache_compare_key(void *context, const v
  * the key value to try and improve uniqueness, and so that length doesn't
  * need to be compared separately for string comparisons.
  */
-static inline int64_t
+static inline uint64_t
 cache_key(const char *name, size_t nlen)
 {
-	int64_t key;
+	uint64_t key;
 
 	KASSERT(nlen <= USHRT_MAX);
 
@@ -418,7 +418,7 @@ cache_remove(struct namecache *ncp, cons
  */
 static struct namecache * __noinline
 cache_lookup_entry(struct vnode *dvp, const char *name, size_t namelen,
-int64_t key)
+uint64_t key)
 {
 	vnode_impl_t *dvi = VNODE_TO_VIMPL(dvp);
 	struct rb_node *node = dvi->vi_nc_tree.rbt_root;
@@ -520,7 +520,7 @@ cache_lookup(struct vnode *dvp, const ch
 	vnode_impl_t *dvi = VNODE_TO_VIMPL(dvp);
 	struct namecache *ncp;
 	struct vnode *vp;
-	int64_t key;
+	uint64_t key;
 	int error;
 	bool hit;
 	krw_t op;
@@ -650,7 +650,7 @@ cache_lookup_linked(struct vnode *dvp, c
 {
 	vnode_impl_t *dvi = VNODE_TO_VIMPL(dvp);
 	struct namecache *ncp;
-	int64_t key;
+	uint64_t key;
 	int error;
 
 	/* Establish default results. */
@@ -1169,7 +1169,7 @@ cache_purge_name(struct vnode *dvp, cons
 {
 	vnode_impl_t *dvi = VNODE_TO_VIMPL(dvp);
 	struct namecache *ncp;
-	int64_t key;
+	uint64_t key;
 
 	SDT_PROBE(vfs, namecache, purge, name, name, namelen, 0, 0, 0);
 

Index: src/sys/sys/namei.src
diff -u src/sys/sys/namei.src:1.49 src/sys/sys/namei.src:1.50
--- src/sys/sys/namei.src:1.49	Sun Mar 22 14:38:37 2020
+++ src/sys/sys/namei.src	Mon Mar 23 18:33:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: namei.src,v 1.49 2020/03/22 14:38:37 ad Exp $	*/
+/*	$NetBSD: namei.src,v 1.50 2020/03/23 18:33:43 ad Exp $	*/
 
 /*
  * Copyright (c) 1985, 1989, 1991, 1993
@@ -216,13 +216,13 @@ NAMEIFL	PARAMASK	0x02ee300	/* mask of pa
 struct nchnode;
 struct namecache {
 	struct	rb_node nc_tree;	/* d  red-black tree, must be first */
-	int64_t	nc_key;			/* -  hash key */
+	uint64_t nc_key;		/* -  hash key */
 	TAILQ_ENTRY(namecache) nc_list;	/* v  vp's list of cache entries */
 	TAILQ_ENTRY(namecache) nc_lru;	/* l  pseudo-lru chain */
 	struct	vnode *nc_dvp;		/* -  vnode of parent of name */
 	struct	vnode *nc_vp;		/* -  vnode the name refers to */
 	int	nc_lrulist;		/* l  which LRU list its on */
-	short	nc_nlen;		/* -  length of the name */
+	u_short	nc_nlen;		/* -  length of the name */
 	char	nc_whiteout;		/* -  true if a whiteout */
 	char	nc_name[41];		/* -  segment name */
 };



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

2020-03-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Mar 23 16:38:29 UTC 2020

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

Log Message:
Reduce #ifdefs


To generate a diff of this commit:
cvs rdiff -u -r1.399 -r1.400 src/sys/arch/arm/arm32/pmap.c

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

Modified files:

Index: src/sys/arch/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.399 src/sys/arch/arm/arm32/pmap.c:1.400
--- src/sys/arch/arm/arm32/pmap.c:1.399	Sat Mar 14 14:05:42 2020
+++ src/sys/arch/arm/arm32/pmap.c	Mon Mar 23 16:38:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.399 2020/03/14 14:05:42 ad Exp $	*/
+/*	$NetBSD: pmap.c,v 1.400 2020/03/23 16:38:29 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -198,7 +198,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.399 2020/03/14 14:05:42 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.400 2020/03/23 16:38:29 skrll Exp $");
 
 #include 
 #include 
@@ -3398,9 +3398,7 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_
 }
 			}
 		}
-#endif /* !ARM_MMU_EXTENDED */
 
-#ifndef ARM_MMU_EXTENDED
 		UVMHIST_LOG(maphist, "  is_cached %jd cs 0x%08jx",
 		is_cached, pm->pm_cstate.cs_all, 0, 0);
 



CVS commit: src/lib/libcurses

2020-03-23 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Mar 23 16:14:20 UTC 2020

Modified Files:
src/lib/libcurses: curses_mouse.3

Log Message:
Fix synopsis, use more markup.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libcurses/curses_mouse.3

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

Modified files:

Index: src/lib/libcurses/curses_mouse.3
diff -u src/lib/libcurses/curses_mouse.3:1.1 src/lib/libcurses/curses_mouse.3:1.2
--- src/lib/libcurses/curses_mouse.3:1.1	Mon Mar 23 15:32:56 2020
+++ src/lib/libcurses/curses_mouse.3	Mon Mar 23 16:14:20 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: curses_mouse.3,v 1.1 2020/03/23 15:32:56 roy Exp $
+.\"	$NetBSD: curses_mouse.3,v 1.2 2020/03/23 16:14:20 wiz Exp $
 .\"
 .\" Copyright (c) 2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -52,18 +52,20 @@
 .Ft int
 .Fn ungetmouse "MEVENT *event"
 .Ft mmask_t
-.Fn mousemask "mmask_t newmask, mmask_t *oldmask"
+.Fn mousemask "mmask_t newmask" "mmask_t *oldmask"
 .Ft bool
-.Fn wenclose "const WINDOW *win, int y, int x"
+.Fn wenclose "const WINDOW *win" "int y" "int x"
 .Ft bool
-.Fn mouse_trafo "int *y, int *x, bool"
+.Fn mouse_trafo "int *y" "int *x" "bool to_screen"
 .Ft bool
-.Fn wmouse_trafo "const WINDOW *win, int *y, int *x, bool to_screen"
+.Fn wmouse_trafo "const WINDOW *win" "int *y" "int *x" "bool to_screen"
 .Ft int
 .Fn mouseinterval "int erval"
 .Sh DESCRIPTION
 This is the curses interface to mouse events.
-Mouse events are reported via the KEY_MOUSE value in the
+Mouse events are reported via the
+.Dv KEY_MOUSE
+value in the
 .Xr wgetch 3
 input stream.
 .Pp
@@ -116,8 +118,7 @@ depending on the value of
 .Fa to_screen .
 If the co-ordinates are not enclosed by the window
 .Fa win
-then false is returned,
-otherwise the
+then false is returned, otherwise the
 .Fa x
 and
 .Fa y



CVS commit: src/lib/libcurses

2020-03-23 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Mar 23 15:32:56 UTC 2020

Added Files:
src/lib/libcurses: curses_mouse.3

Log Message:
Add missing man page for curses mouse functions.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/lib/libcurses/curses_mouse.3

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

Added files:

Index: src/lib/libcurses/curses_mouse.3
diff -u /dev/null src/lib/libcurses/curses_mouse.3:1.1
--- /dev/null	Mon Mar 23 15:32:56 2020
+++ src/lib/libcurses/curses_mouse.3	Mon Mar 23 15:32:56 2020
@@ -0,0 +1,161 @@
+.\"	$NetBSD: curses_mouse.3,v 1.1 2020/03/23 15:32:56 roy Exp $
+.\"
+.\" Copyright (c) 2020 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Roy Marples.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\"
+.Dd March 22, 2020
+.Dt CURSES_MOUSE 3
+.Os
+.Sh NAME
+.Nm has_mouse ,
+.Nm getmouse ,
+.Nm ungetmouse ,
+.Nm mousemask ,
+.Nm wenclose ,
+.Nm mouse_trafo ,
+.Nm wmouse_trafo ,
+.Nm mouseinterval
+.Nd Curses mouse interface
+.Sh LIBRARY
+.Lb libcurses
+.Sh SYNOPSIS
+.In curses.h
+.Ft bool
+.Fn has_mouse "void"
+.Ft int
+.Fn getmouse "MEVENT *event"
+.Ft int
+.Fn ungetmouse "MEVENT *event"
+.Ft mmask_t
+.Fn mousemask "mmask_t newmask, mmask_t *oldmask"
+.Ft bool
+.Fn wenclose "const WINDOW *win, int y, int x"
+.Ft bool
+.Fn mouse_trafo "int *y, int *x, bool"
+.Ft bool
+.Fn wmouse_trafo "const WINDOW *win, int *y, int *x, bool to_screen"
+.Ft int
+.Fn mouseinterval "int erval"
+.Sh DESCRIPTION
+This is the curses interface to mouse events.
+Mouse events are reported via the KEY_MOUSE value in the
+.Xr wgetch 3
+input stream.
+.Pp
+The
+.Fn has_mouse
+function returns true if the mouse support has been initialised for the
+terminal, otherwise false.
+.Pp
+The
+.Fn getmouse
+function reads a mouse event.
+The
+.Fa x
+and
+.Fa y
+values are screen relative and the state mask will have exactly one bit set
+to represent the event type.
+The
+.Fn ungetmouse
+function behave like
+.Xr ungetch 3
+and pushes the mouse event into the input stream.
+.Pp
+The
+.Fn mousemask
+function sets the mouse events to be reported.
+By default, there are no mouse events reported.
+It returns a mask indicating which of the specified mouse events can be
+reported, zero indicating a failure.
+If oldmask is given, it is filled with the previous mouse event mask.
+.Pp
+The
+.Fn wenclose
+function returns true if the screen relative
+.Fa x
+and
+.Fa y
+co-ordinates are enclosed by the window
+.Fa win ,
+otherwise false.
+.Pp
+The
+.Fn wmouse_trafo
+function transforms the
+.Fa x
+and
+.Fa y
+co-ordinates from screen relative to window relative or vice versa
+depending on the value of
+.Fa to_screen .
+If the co-ordinates are not enclosed by the window
+.Fa win
+then false is returned,
+otherwise the
+.Fa x
+and
+.Fa y
+values are transformed and true is returned.
+The
+.Fn mouse_trainfo
+function calls
+.Fn wmouse_trainfo
+using
+.Va stdscr
+for
+.Fa win .
+.Pp
+The
+.Fn mouseinterval
+function sets the maximum time that can elapse between press and release
+events, which determins a click.
+The value is in thousands of seconds.
+The default value is one fifth of a second.
+The returned value is the old value.
+.Sh RETURN VALUES
+Unless otherwise noted, the functions that return an int will return one of
+the following values:
+.Pp
+.Bl -tag -width ERR -compact
+.It Er OK
+The function completed successfully.
+.It Er ERR
+An error occurred in the function.
+.El
+.Sh SEE ALSO
+.Xr wsmouse 4
+.Sh STANDARDS
+These functions are 

CVS commit: src/sys/rump/librump/rumpkern

2020-03-23 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Mar 23 14:49:50 UTC 2020

Modified Files:
src/sys/rump/librump/rumpkern: rump.c

Log Message:
Don't attempt to detach an evcnt before attaching it.  If its not
already attached, we will panic.

It turns out that this check wasn't really needed anyway, it was
simply paranoia on my part.

Thanks to hannken@ for bringing this to my attention.


To generate a diff of this commit:
cvs rdiff -u -r1.343 -r1.344 src/sys/rump/librump/rumpkern/rump.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/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.343 src/sys/rump/librump/rumpkern/rump.c:1.344
--- src/sys/rump/librump/rumpkern/rump.c:1.343	Sun Mar 22 13:30:10 2020
+++ src/sys/rump/librump/rumpkern/rump.c	Mon Mar 23 14:49:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.343 2020/03/22 13:30:10 pgoyette Exp $	*/
+/*	$NetBSD: rump.c,v 1.344 2020/03/23 14:49:50 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.343 2020/03/22 13:30:10 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.344 2020/03/23 14:49:50 pgoyette Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -647,14 +647,12 @@ add_linkedin_modules(const struct modinf
 }
 
 /*
- * Add an evcnt.  Just in case it might already have been added, remove
- * it first.
+ * Add an evcnt.
  */
 static void
 add_static_evcnt(struct evcnt *ev)
 {
 
-	evcnt_detach(ev);
 	evcnt_attach_static(ev);
 }
 



CVS commit: src/share/locale

2020-03-23 Thread Kimmo Suominen
Module Name:src
Committed By:   kim
Date:   Mon Mar 23 13:56:12 UTC 2020

Modified Files:
src/share/locale: Makefile.common
src/share/locale/monetary/converted: fi_FI.ISO8859-1.src

Log Message:
Fix the currency symbol for fi_FI.ISO8859-1

In the Finnish language, the recommended symbol for euro is the euro sign
where it is available, and the lowercase letter e otherwise.

The use of the ISO currency code EUR is not an abbreviation of the word
euro in the Finnish language, just like FIM is not an abbreviation of
the word markka.

Reference:
https://www.kielikello.fi/-/euro-
Euro
Kielikello 3/1998
Kotimaisten kielten keskus
Institute for the Languages of Finland
[Last retrieved 2020-03-23]


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/locale/Makefile.common
cvs rdiff -u -r1.1 -r1.2 \
src/share/locale/monetary/converted/fi_FI.ISO8859-1.src

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

Modified files:

Index: src/share/locale/Makefile.common
diff -u src/share/locale/Makefile.common:1.1 src/share/locale/Makefile.common:1.2
--- src/share/locale/Makefile.common:1.1	Sun Aug 11 22:09:40 2013
+++ src/share/locale/Makefile.common	Mon Mar 23 13:56:12 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.common,v 1.1 2013/08/11 22:09:40 joerg Exp $
+# $NetBSD: Makefile.common,v 1.2 2020/03/23 13:56:12 kim Exp $
 
 all:		${LOCALES:S/$/.out/g}
 realall:	${LOCALES:S/$/.out/g}
@@ -37,6 +37,7 @@ update-converted:
 	@echo Generating character set ${charset} of ${locale_name}...
 	@rm -f ${.CURDIR}/converted/${locale}.src
 	@set -e; cat < ${.CURDIR}/${locale_name}.UTF-8.src \
+	| (case ${locale}  in fi_FI.ISO8859-1) sed 's,€,e,g';; *) cat ;; esac) \
 	| (case ${charset} in ISO8859-[125]) sed 's,€,EUR,g';; *) cat ;; esac) \
 	| (case ${charset} in ISO8859-9) sed 's,₺,L,g';; *) cat ;; esac) \
 	| (case ${charset} in ISO8859*) sed 's,−,-,g';; *) cat ;; esac) \

Index: src/share/locale/monetary/converted/fi_FI.ISO8859-1.src
diff -u src/share/locale/monetary/converted/fi_FI.ISO8859-1.src:1.1 src/share/locale/monetary/converted/fi_FI.ISO8859-1.src:1.2
--- src/share/locale/monetary/converted/fi_FI.ISO8859-1.src:1.1	Sun Aug 11 22:09:41 2013
+++ src/share/locale/monetary/converted/fi_FI.ISO8859-1.src	Mon Mar 23 13:56:12 2020
@@ -1,4 +1,4 @@
-# $NetBSD: fi_FI.ISO8859-1.src,v 1.1 2013/08/11 22:09:41 joerg Exp $
+# $NetBSD: fi_FI.ISO8859-1.src,v 1.2 2020/03/23 13:56:12 kim Exp $
 #
 # Locale: fi_FI
 # Character set: ISO8859-1
@@ -33,7 +33,7 @@ EUR 
 #
 # Currency Symbol (currency_symbol)
 #
-EUR
+e
 #
 # Monetary Decimal Point (mon_decimal_point)
 #



CVS commit: src

2020-03-23 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Mar 23 13:37:37 UTC 2020

Modified Files:
src/distrib/sets/lists/comp: mi
src/lib/libcurses: Makefile curses.h
Added Files:
src/lib/libcurses: mouse.c

Log Message:
curses: Add stubs for mouse functions

No mouse support actually included.
But that doesn't matter because most terms don't actually support a mouse.

We should look into hooking these into wsmouse(4) and xterm mouse
in the future.

Compatable with nCurses mouse API version 2.


To generate a diff of this commit:
cvs rdiff -u -r1.2313 -r1.2314 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.93 -r1.94 src/lib/libcurses/Makefile
cvs rdiff -u -r1.128 -r1.129 src/lib/libcurses/curses.h
cvs rdiff -u -r0 -r1.1 src/lib/libcurses/mouse.c

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2313 src/distrib/sets/lists/comp/mi:1.2314
--- src/distrib/sets/lists/comp/mi:1.2313	Sun Mar 22 14:27:33 2020
+++ src/distrib/sets/lists/comp/mi	Mon Mar 23 13:37:37 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2313 2020/03/22 14:27:33 ad Exp $
+#	$NetBSD: mi,v 1.2314 2020/03/23 13:37:37 roy Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -6402,6 +6402,7 @@
 ./usr/share/man/cat3/curses_insertln.0		comp-c-catman		.cat
 ./usr/share/man/cat3/curses_keyname.0		comp-c-catman		.cat
 ./usr/share/man/cat3/curses_line.0		comp-c-catman		.cat
+./usr/share/man/cat3/curses_mouse.0		comp-c-catman		.cat
 ./usr/share/man/cat3/curses_pad.0		comp-c-catman		.cat
 ./usr/share/man/cat3/curses_print.0		comp-c-catman		.cat
 ./usr/share/man/cat3/curses_refresh.0		comp-c-catman		.cat
@@ -7308,6 +7309,7 @@
 ./usr/share/man/cat3/getmntopts.0		comp-c-catman		.cat
 ./usr/share/man/cat3/getmntoptstr.0		comp-c-catman		.cat
 ./usr/share/man/cat3/getmode.0			comp-c-catman		.cat
+./usr/share/man/cat3/getmouse.0			comp-c-catman		.cat
 ./usr/share/man/cat3/getnameinfo.0		comp-c-catman		.cat
 ./usr/share/man/cat3/getnetbyaddr.0		comp-c-catman		.cat
 ./usr/share/man/cat3/getnetbyname.0		comp-c-catman		.cat
@@ -7428,6 +7430,7 @@
 ./usr/share/man/cat3/has_ic.0			comp-c-catman		.cat
 ./usr/share/man/cat3/has_il.0			comp-c-catman		.cat
 ./usr/share/man/cat3/has_key.0			comp-c-catman		.cat
+./usr/share/man/cat3/has_mouse.0		comp-c-catman		.cat
 ./usr/share/man/cat3/hash.0			comp-c-catman		.cat
 ./usr/share/man/cat3/hcreate.0			comp-c-catman		.cat
 ./usr/share/man/cat3/hcreate_r.0		comp-c-catman		.cat
@@ -8542,6 +8545,8 @@
 ./usr/share/man/cat3/modfl.0			comp-c-catman		.cat
 ./usr/share/man/cat3/moncontrol.0		comp-c-catman		.cat
 ./usr/share/man/cat3/monstartup.0		comp-c-catman		.cat
+./usr/share/man/cat3/mouse_trafo.0		comp-c-catman		.cat
+./usr/share/man/cat3/mouseinterval.0		comp-c-catman		.cat
 ./usr/share/man/cat3/move.0			comp-c-catman		.cat
 ./usr/share/man/cat3/move_field.0		comp-c-catman		.cat
 ./usr/share/man/cat3/move_panel.0		comp-c-catman		.cat
@@ -10277,6 +10282,7 @@
 ./usr/share/man/cat3/underscore.0		comp-c-catman		.cat
 ./usr/share/man/cat3/ungetc.0			comp-c-catman		.cat
 ./usr/share/man/cat3/ungetch.0			comp-c-catman		.cat
+./usr/share/man/cat3/ungetmouse.0		comp-c-catman		.cat
 ./usr/share/man/cat3/ungetwc.0			comp-c-catman		.cat
 ./usr/share/man/cat3/unistd.0			comp-c-catman		.cat
 ./usr/share/man/cat3/unlockpt.0			comp-c-catman		.cat
@@ -10424,6 +10430,7 @@
 ./usr/share/man/cat3/wdelch.0			comp-c-catman		.cat
 ./usr/share/man/cat3/wdeleteln.0		comp-c-catman		.cat
 ./usr/share/man/cat3/wechochar.0		comp-c-catman		.cat
+./usr/share/man/cat3/wenclose.0			comp-c-catman		.cat
 ./usr/share/man/cat3/werase.0			comp-c-catman		.cat
 ./usr/share/man/cat3/wgetch.0			comp-c-catman		.cat
 ./usr/share/man/cat3/wgetnstr.0			comp-c-catman		.cat
@@ -10442,6 +10449,7 @@
 ./usr/share/man/cat3/wmemcpy.0			comp-c-catman		.cat
 ./usr/share/man/cat3/wmemmove.0			comp-c-catman		.cat
 ./usr/share/man/cat3/wmemset.0			comp-c-catman		.cat
+./usr/share/man/cat3/wmouse_trafo.0		comp-c-catman		.cat
 ./usr/share/man/cat3/wmove.0			comp-c-catman		.cat
 ./usr/share/man/cat3/wnoutrefresh.0		comp-c-catman		.cat
 ./usr/share/man/cat3/wordexp.0			comp-c-catman		.cat
@@ -14426,6 +14434,7 @@
 ./usr/share/man/html3/curses_insertln.html	comp-c-htmlman		html
 ./usr/share/man/html3/curses_keyname.html	comp-c-htmlman		html
 ./usr/share/man/html3/curses_line.html		comp-c-htmlman		html
+./usr/share/man/html3/curses_mouse.html		comp-c-htmlman		html
 ./usr/share/man/html3/curses_pad.html		comp-c-htmlman		html
 ./usr/share/man/html3/curses_print.html		comp-c-htmlman		html
 ./usr/share/man/html3/curses_refresh.html	comp-c-htmlman		html
@@ -15339,6 +15348,7 @@
 ./usr/share/man/html3/getmntopts.html		comp-c-htmlman		html
 ./usr/share/man/html3/getmntoptstr.html		comp-c-htmlman		html
 ./usr/share/man/html3/getmode.html		comp-c-htmlman	

CVS commit: src/distrib/evbarm/instkernel/sshramdisk

2020-03-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 23 11:45:00 UTC 2020

Modified Files:
src/distrib/evbarm/instkernel/sshramdisk: Makefile

Log Message:
Bump image size - new firmware files need more space


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/distrib/evbarm/instkernel/sshramdisk/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/evbarm/instkernel/sshramdisk/Makefile
diff -u src/distrib/evbarm/instkernel/sshramdisk/Makefile:1.23 src/distrib/evbarm/instkernel/sshramdisk/Makefile:1.24
--- src/distrib/evbarm/instkernel/sshramdisk/Makefile:1.23	Sun Mar  1 20:59:54 2020
+++ src/distrib/evbarm/instkernel/sshramdisk/Makefile	Mon Mar 23 11:45:00 2020
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.23 2020/03/01 20:59:54 christos Exp $
+#	$NetBSD: Makefile,v 1.24 2020/03/23 11:45:00 martin Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
 
 IMAGE=		sshramdisk.fs
-IMAGESIZE=	33000k
+IMAGESIZE=	43000k
 MAKEFS_FLAGS+=	-f 15
 
 .if ${MKREPRO_TIMESTAMP:Uno} != "no"



CVS commit: src/sys/uvm

2020-03-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Mar 23 10:35:56 UTC 2020

Modified Files:
src/sys/uvm: uvm_fault.c

Log Message:
Fix UVMHIST build


To generate a diff of this commit:
cvs rdiff -u -r1.223 -r1.224 src/sys/uvm/uvm_fault.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/uvm/uvm_fault.c
diff -u src/sys/uvm/uvm_fault.c:1.223 src/sys/uvm/uvm_fault.c:1.224
--- src/sys/uvm/uvm_fault.c:1.223	Mon Mar 23 10:35:08 2020
+++ src/sys/uvm/uvm_fault.c	Mon Mar 23 10:35:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_fault.c,v 1.223 2020/03/23 10:35:08 skrll Exp $	*/
+/*	$NetBSD: uvm_fault.c,v 1.224 2020/03/23 10:35:56 skrll Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.223 2020/03/23 10:35:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.224 2020/03/23 10:35:56 skrll Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -1219,6 +1219,7 @@ static inline int
 uvm_fault_upper_upgrade(struct uvm_faultinfo *ufi, struct uvm_faultctx *flt,
 struct vm_amap *amap, struct uvm_object *uobj)
 {
+	UVMHIST_FUNC(__func__); UVMHIST_CALLED(maphist);
 
 	KASSERT(amap != NULL);
 	KASSERT(flt->upper_lock_type == rw_lock_op(amap->am_lock));
@@ -1788,6 +1789,8 @@ uvm_fault_lower_upgrade(struct uvm_fault
 struct vm_amap *amap, struct uvm_object *uobj, struct vm_page *uobjpage)
 {
 
+	UVMHIST_FUNC(__func__); UVMHIST_CALLED(maphist);
+
 	KASSERT(uobj != NULL);
 	KASSERT(flt->lower_lock_type == rw_lock_op(uobj->vmobjlock));
 



CVS commit: src/sys/uvm

2020-03-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Mar 23 10:35:08 UTC 2020

Modified Files:
src/sys/uvm: uvm_fault.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.222 -r1.223 src/sys/uvm/uvm_fault.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/uvm/uvm_fault.c
diff -u src/sys/uvm/uvm_fault.c:1.222 src/sys/uvm/uvm_fault.c:1.223
--- src/sys/uvm/uvm_fault.c:1.222	Sun Mar 22 18:32:42 2020
+++ src/sys/uvm/uvm_fault.c	Mon Mar 23 10:35:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_fault.c,v 1.222 2020/03/22 18:32:42 ad Exp $	*/
+/*	$NetBSD: uvm_fault.c,v 1.223 2020/03/23 10:35:08 skrll Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.222 2020/03/22 18:32:42 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.223 2020/03/23 10:35:08 skrll Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -1226,7 +1226,7 @@ uvm_fault_upper_upgrade(struct uvm_fault
 	/*
 	 * fast path.
 	 */
-	
+
 	if (__predict_true(flt->upper_lock_type == RW_WRITER)) {
 		return 0;
 	}
@@ -1794,7 +1794,7 @@ uvm_fault_lower_upgrade(struct uvm_fault
 	/*
 	 * fast path.
 	 */
-	
+
 	if (__predict_true(flt->lower_lock_type == RW_WRITER)) {
 		KASSERT(uobjpage == NULL || (uobjpage->flags & PG_BUSY) != 0);
 		return 0;
@@ -2074,7 +2074,7 @@ uvm_fault_lower_neighbor(
 
 	/*
 	 * in the read-locked case, it's not possible for this to be a new
-	 * page.  it must be cached with the object and enqueued already. 
+	 * page.  it must be cached with the object and enqueued already.
 	 * there wasn't a direct fault on the page, so avoid the cost of
 	 * re-enqueuing it.
 	 */
@@ -2116,10 +2116,10 @@ uvm_fault_lower_neighbor(
 	}
 	KASSERT(rw_lock_op(pg->uobject->vmobjlock) == flt->lower_lock_type);
 
-	const vm_prot_t mapprot = 
+	const vm_prot_t mapprot =
 	readonly ? (flt->enter_prot & ~VM_PROT_WRITE) :
 	flt->enter_prot & MASK(ufi->entry);
-	const u_int mapflags = 
+	const u_int mapflags =
 	PMAP_CANFAIL | (flt->wire_mapping ? (mapprot | PMAP_WIRED) : 0);
 	(void) pmap_enter(ufi->orig_map->pmap, currva,
 	VM_PAGE_TO_PHYS(pg), mapprot, mapflags);



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

2020-03-23 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Mar 23 10:26:07 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: if_ave.c

Log Message:
adapt dual descriptor design both for AVE64 and AVE32


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/sociox/if_ave.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/sociox/if_ave.c
diff -u src/sys/arch/arm/sociox/if_ave.c:1.13 src/sys/arch/arm/sociox/if_ave.c:1.14
--- src/sys/arch/arm/sociox/if_ave.c:1.13	Mon Mar 23 07:42:00 2020
+++ src/sys/arch/arm/sociox/if_ave.c	Mon Mar 23 10:26:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ave.c,v 1.13 2020/03/23 07:42:00 nisimura Exp $	*/
+/*	$NetBSD: if_ave.c,v 1.14 2020/03/23 10:26:07 nisimura Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.13 2020/03/23 07:42:00 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.14 2020/03/23 10:26:07 nisimura Exp $");
 
 #include 
 #include 
@@ -182,29 +182,6 @@ struct rdes32 { uint32_t r0, r1; };
 #define MD_NRXDESC_MASK	(MD_NRXDESC - 1)
 #define MD_NEXTRX(x)		(((x) + 1) & MD_NRXDESC_MASK)
 
-#define AVE_INIT_RXDESC(sc, x)		\
-do {	\
-	struct ave_rxsoft *__rxs = &(sc)->sc_rxsoft[(x)];		\
-	struct rdes *__rxd = &(sc)->sc_rxdescs[(x)];			\
-	struct mbuf *__m = __rxs->rxs_mbuf;\
-	bus_addr_t __paddr =__rxs->rxs_dmamap->dm_segs[0].ds_addr;	\
-	__m->m_data = __m->m_ext.ext_buf;\
-	__rxd->r2 = htole32(BUS_ADDR_HI32(__paddr));			\
-	__rxd->r1 = htole32(BUS_ADDR_LO32(__paddr));			\
-	__rxd->r0 = R0_OWN | R0_FL_MASK;\
-} while (/*CONSTCOND*/0)
-
-#define AVE32_INIT_RXDESC(sc, x)	\
-do {	\
-	struct ave_rxsoft *__rxs = &(sc)->sc_rxsoft[(x)];		\
-	struct rdes32 *__rxd = &(sc)->sc_rxd32[(x)];			\
-	struct mbuf *__m = __rxs->rxs_mbuf;\
-	bus_addr_t __paddr =__rxs->rxs_dmamap->dm_segs[0].ds_addr;	\
-	__m->m_data = __m->m_ext.ext_buf;\
-	__rxd->r1 = htole32(__paddr);	\
-	__rxd->r0 = R0_OWN | R0_FL_MASK;\
-} while (/*CONSTCOND*/0)
-
 struct ave_txsoft {
 	struct mbuf *txs_mbuf;		/* head of our mbuf chain */
 	bus_dmamap_t txs_dmamap;	/* our DMA map */
@@ -218,6 +195,8 @@ struct ave_rxsoft {
 	bus_dmamap_t rxs_dmamap;	/* our DMA map */
 };
 
+struct desops;
+
 struct ave_softc {
 	device_t sc_dev;		/* generic device information */
 	bus_space_tag_t sc_st;		/* bus space tag */
@@ -241,6 +220,7 @@ struct ave_softc {
 	struct rdes *sc_rxdescs;	/* PTR to rdes [NRXDESC] store */
 	struct tdes32 *sc_txd32;
 	struct rdes32 *sc_rxd32;
+	struct desops *sc_desops;	/* descriptor management */
 
 	struct ave_txsoft sc_txsoft[MD_TXQUEUELEN];
 	struct ave_rxsoft sc_rxsoft[MD_NRXDESC];
@@ -286,8 +266,62 @@ static int add_rxbuf(struct ave_softc *,
 #define CSR_WRITE(sc, off, val) \
 	bus_space_write_4((sc)->sc_st, (sc)->sc_sh, (off), (val))
 
+struct desops {
+	void (*make_tdes)(void *, int, int, int);
+	void (*mark_txfs)(void *, int);
+	void (*mark_txls)(void *, int);
+	void (*mark_txic)(void *, int);
+	int  (*read_tdes0)(void *, int);
+	int  (*read_rdes0)(void *, int);
+	int  (*read_rlen)(void *, int);
+	void (*init_rdes)(void *, int);
+};
+#define MAKE_TDES(sc,x,s,o) (*(sc)->sc_desops->make_tdes)((sc),(x),(s),(o))
+#define MARK_TXFS(sc,x) (*(sc)->sc_desops->mark_txfs)((sc),(x))
+#define MARK_TXLS(sc,x) (*(sc)->sc_desops->mark_txls)((sc),(x))
+#define MARK_TXIC(sc,x) (*(sc)->sc_desops->mark_txic)((sc),(x))
+#define READ_TDES0(sc,x) (*(sc)->sc_desops->read_tdes0)((sc),(x))
+#define READ_RDES0(sc,x) (*(sc)->sc_desops->read_rdes0)((sc),(x))
+#define INIT_RDES(sc,x) (*(sc)->sc_desops->init_rdes)((sc),(x))
+/* received frame length is stored in RDES0 10:0 */
+
+static void make_tdes(void *, int, int, int);
+static void mark_txfs(void *, int);
+static void mark_txls(void *, int);
+static void mark_txic(void *, int);
+static int read_tdes0(void *, int);
+static int read_rdes0(void *, int);
+static void init_rdes(void *, int);
+struct desops ave64ops = {
+	make_tdes,
+	mark_txfs,
+	mark_txls,
+	mark_txic,
+	read_tdes0,
+	read_rdes0,
+	NULL,
+	init_rdes,
+};
+static void omake_tdes(void *, int, int, int);
+static void omark_txfs(void *, int);
+static void omark_txls(void *, int);
+static void omark_txic(void *, int);
+static int oread_tdes0(void *, int);
+static int oread_rdes0(void *, int);
+static void oinit_rdes(void *, int);
+struct desops ave32ops = {
+	omake_tdes,
+	omark_txfs,
+	omark_txls,
+	omark_txic,
+	oread_tdes0,
+	oread_rdes0,
+	NULL,
+	oinit_rdes,
+};
+
 static const struct of_compat_data compat_data[] = {
-	{ "socionext,unifier-ld20-ave4", 64 },	/* XXX only this for now */
+	{ "socionext,unifier-ld20-ave4", 64 },
 	{ "socionext,unifier-pro4-ave4", 32 },
 	{ "socionext,unifier-pxs2-ave4", 32 },
 	{ "socionext,unifier-ld11-ave4", 32 },
@@ -357,12 +391,13 @@ ave_fdt_attach(device_t parent, device_t
 
 	

CVS commit: [netbsd-8] src/doc

2020-03-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 23 10:17:07 UTC 2020

Modified Files:
src/doc [netbsd-8]: CHANGES-8.2

Log Message:
Tickets #1522 and #1523


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.108 -r1.1.2.109 src/doc/CHANGES-8.2

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

Modified files:

Index: src/doc/CHANGES-8.2
diff -u src/doc/CHANGES-8.2:1.1.2.108 src/doc/CHANGES-8.2:1.1.2.109
--- src/doc/CHANGES-8.2:1.1.2.108	Mon Mar 16 12:23:05 2020
+++ src/doc/CHANGES-8.2	Mon Mar 23 10:17:07 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.2,v 1.1.2.108 2020/03/16 12:23:05 sborrill Exp $
+# $NetBSD: CHANGES-8.2,v 1.1.2.109 2020/03/23 10:17:07 martin Exp $
 
 A complete list of changes from the NetBSD 8.1 release to the NetBSD 8.2
 release:
@@ -2148,3 +2148,15 @@ sys/arch/xen/xen/xennet_checksum.c		1.4
 	on same physical host as it seems Windows does some padding.
 	[jdolecek, ticket #1521]
 
+etc/etc.amiga/Makefile.inc			1.29-1.31
+
+	Provide both miniroot.fs (for people wanting to install NetBSD
+	without more 3rdparty software than what's provided on our ISO)
+	and .fs.tz (for people downloading over slow links).
+	[is, ticket #1522]
+
+sys/external/bsd/drm2/dist/drm/radeon/radeon_vce.c 1.4
+
+	Fix loading TAHITI VCE firmware.
+	[mrg, ticket #1523]
+



CVS commit: [netbsd-8] src/sys/external/bsd/drm2/dist/drm/radeon

2020-03-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 23 10:16:01 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/dist/drm/radeon [netbsd-8]: radeon_vce.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1523):

sys/external/bsd/drm2/dist/drm/radeon/radeon_vce.c: revision 1.4

Fix loading TAHITI VCE firmware.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.24.1 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_vce.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/radeon/radeon_vce.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_vce.c:1.2 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_vce.c:1.2.24.1
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_vce.c:1.2	Wed Jul 16 20:59:57 2014
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_vce.c	Mon Mar 23 10:16:01 2020
@@ -46,34 +46,38 @@ static void radeon_vce_idle_work_handler
 
 #ifdef __NetBSD__		/* XXX Ugh!  */
 static bool
-scan_2dec_u8(const char **sp, char delim, uint8_t *u8p)
+scan_2dec_uint(const char **sp, char delim, unsigned int *uintp)
 {
-	char c0, c1;
+	u_int val = 0, n;
+	char c;
 
-	if (!isdigit((unsigned char)(c0 = *(*sp)++)))
-		return false;
-	if (!isdigit((unsigned char)(c1 = *(*sp)++)))
-		return false;
-	if (*(*sp)++ != delim)
+	for (n = 0; n < 2; n++) {
+		c = *(*sp)++;
+		if (!isdigit((unsigned char)c))
+			return false;
+		if (n != 0)
+			val *= 10;
+		val += (c - '0');
+		if (*(*sp) == delim)
+			break;
+	}
+	if (*(*sp) != delim)
 		return false;
 
-	*u8p = ((c0 - '0') * 10) + (c1 - '0');
+	(*sp)++;
+	*uintp = val;
 	return true;
 }
 
 static bool
-scan_2dec_uint(const char **sp, char delim, unsigned int *uintp)
+scan_2dec_u8(const char **sp, char delim, uint8_t *u8p)
 {
-	char c0, c1;
+	unsigned int val;
 
-	if (!isdigit((unsigned char)(c0 = *(*sp)++)))
-		return false;
-	if (!isdigit((unsigned char)(c1 = *(*sp)++)))
-		return false;
-	if (*(*sp)++ != delim)
+	if (!scan_2dec_uint(sp, delim, ))
 		return false;
 
-	*uintp = ((c0 - '0') * 10) + (c1 - '0');
+	*u8p = (uint8_t)val;
 	return true;
 }
 #endif



CVS commit: [netbsd-8] src/etc/etc.amiga

2020-03-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 23 10:13:21 UTC 2020

Modified Files:
src/etc/etc.amiga [netbsd-8]: Makefile.inc

Log Message:
Pull up following revision(s) (requested by is in ticket #1522):

etc/etc.amiga/Makefile.inc: revision 1.30
etc/etc.amiga/Makefile.inc: revision 1.31
etc/etc.amiga/Makefile.inc: revision 1.29

Provide the (small) miniroot uncompressed, so that it can be used from
an AmigaOS without additional software to install NetBSD.

Closes PR port-amiga/45443

 -

provide both miniroot.fs (for people wanting to install NetBSD without
more 3rdparty software than what's provided on our ISO) and .fs.tz (for
people downloading over slow links).

 -

Fix build; add -f flag to "rm miniroot.fs" in case of its absence.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.27.26.1 src/etc/etc.amiga/Makefile.inc

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

Modified files:

Index: src/etc/etc.amiga/Makefile.inc
diff -u src/etc/etc.amiga/Makefile.inc:1.27 src/etc/etc.amiga/Makefile.inc:1.27.26.1
--- src/etc/etc.amiga/Makefile.inc:1.27	Mon Jul  9 18:12:11 2012
+++ src/etc/etc.amiga/Makefile.inc	Mon Mar 23 10:13:21 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.27 2012/07/09 18:12:11 rkujawa Exp $
+#	$NetBSD: Makefile.inc,v 1.27.26.1 2020/03/23 10:13:21 martin Exp $
 #
 #	etc.amiga/Makefile.inc -- amiga-specific etc Makefile targets
 #
@@ -15,4 +15,7 @@ INSTALLATION_DIRS+=	installation/miniroo
 
 snap_md_post:
 	${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/misc '*'
-#	${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/miniroot '*.gz'
+	rm -f		${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/miniroot/miniroot.fs
+	${TOOL_GZIP} -cd ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/miniroot/miniroot.fs.gz > \
+			${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/miniroot/miniroot.fs
+	${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/miniroot '*.fs*'



CVS commit: [netbsd-9] src/doc

2020-03-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 23 10:07:20 UTC 2020

Modified Files:
src/doc [netbsd-9]: CHANGES-9.1

Log Message:
Tickets #801 and #802


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.22 -r1.1.2.23 src/doc/CHANGES-9.1

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

Modified files:

Index: src/doc/CHANGES-9.1
diff -u src/doc/CHANGES-9.1:1.1.2.22 src/doc/CHANGES-9.1:1.1.2.23
--- src/doc/CHANGES-9.1:1.1.2.22	Sat Mar 21 20:25:42 2020
+++ src/doc/CHANGES-9.1	Mon Mar 23 10:07:20 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.1,v 1.1.2.22 2020/03/21 20:25:42 martin Exp $
+# $NetBSD: CHANGES-9.1,v 1.1.2.23 2020/03/23 10:07:20 martin Exp $
 
 A complete list of changes from the NetBSD 9.0 release to the NetBSD 9.1
 release:
@@ -707,3 +707,15 @@ sys/dev/ic/dwc_mmc_var.h			1.14
 	Fix dwc_mmc.
 	[skrll, ticket #800]
 
+etc/etc.amiga/Makefile.inc			1.29-1.31
+
+	Provide both miniroot.fs (for people wanting to install NetBSD
+	without more 3rdparty software than what's provided on our ISO and
+	.fs.tz (for people downloading over slow links).
+	[is, ticket #801]
+
+sys/arch/vax/vsa/ncr.c1.50
+
+	Do not expect a struct buf to be present if doing DMA to kernel space.
+	[ragge, ticket #802]
+



CVS commit: [netbsd-9] src/sys/arch/vax/vsa

2020-03-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 23 10:06:26 UTC 2020

Modified Files:
src/sys/arch/vax/vsa [netbsd-9]: ncr.c

Log Message:
Pull up following revision(s) (requested by ragge in ticket #802):

sys/arch/vax/vsa/ncr.c: revision 1.50

Do not expect a struct buf to be present if doing DMA to kernel space.
Fixes bug reported by sadness on port-vax.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.49.4.1 src/sys/arch/vax/vsa/ncr.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/ncr.c
diff -u src/sys/arch/vax/vsa/ncr.c:1.49 src/sys/arch/vax/vsa/ncr.c:1.49.4.1
--- src/sys/arch/vax/vsa/ncr.c:1.49	Mon Sep  3 16:29:28 2018
+++ src/sys/arch/vax/vsa/ncr.c	Mon Mar 23 10:06:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ncr.c,v 1.49 2018/09/03 16:29:28 riastradh Exp $	*/
+/*	$NetBSD: ncr.c,v 1.49.4.1 2020/03/23 10:06:26 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ncr.c,v 1.49 2018/09/03 16:29:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ncr.c,v 1.49.4.1 2020/03/23 10:06:26 martin Exp $");
 
 #include 
 #include 
@@ -275,7 +275,11 @@ found:
 	dh->dh_flags = SIDH_BUSY;
 	dh->dh_addr = ncr_sc->sc_dataptr;
 	dh->dh_len = xlen;
-	dh->dh_proc = xs->bp->b_proc;
+	if (((vaddr_t)ncr_sc->sc_dataptr & KERNBASE) == 0) {
+		if (xs->bp == NULL)
+			panic("si_dma_alloc");
+		dh->dh_proc = xs->bp->b_proc;
+	}
 
 	/* Remember dest buffer parameters */
 	if (xs->xs_control & XS_CTL_DATA_OUT)



CVS commit: [netbsd-9] src/etc/etc.amiga

2020-03-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 23 10:03:28 UTC 2020

Modified Files:
src/etc/etc.amiga [netbsd-9]: Makefile.inc

Log Message:
Pull up following revision(s) (requested by is in ticket #801):

etc/etc.amiga/Makefile.inc: revision 1.30
etc/etc.amiga/Makefile.inc: revision 1.31
etc/etc.amiga/Makefile.inc: revision 1.29

Provide the (small) miniroot uncompressed, so that it can be used from
an AmigaOS without additional software to install NetBSD.

Closes PR port-amiga/45443

 -

provide both miniroot.fs (for people wanting to install NetBSD without
more 3rdparty software than what's provided on our ISO) and .fs.tz (for
people downloading over slow links).

 -

Fix build; add -f flag to "rm miniroot.fs" in case of its absence.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.28.2.1 src/etc/etc.amiga/Makefile.inc

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

Modified files:

Index: src/etc/etc.amiga/Makefile.inc
diff -u src/etc/etc.amiga/Makefile.inc:1.28 src/etc/etc.amiga/Makefile.inc:1.28.2.1
--- src/etc/etc.amiga/Makefile.inc:1.28	Sun Sep 23 06:39:23 2018
+++ src/etc/etc.amiga/Makefile.inc	Mon Mar 23 10:03:28 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.28 2018/09/23 06:39:23 rin Exp $
+#	$NetBSD: Makefile.inc,v 1.28.2.1 2020/03/23 10:03:28 martin Exp $
 #
 #	etc.amiga/Makefile.inc -- amiga-specific etc Makefile targets
 #
@@ -15,4 +15,7 @@ INSTALLATION_DIRS+=	installation/miniroo
 
 snap_md_post:
 	${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/misc '*'
-#	${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/miniroot '*.gz'
+	rm -f		${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/miniroot/miniroot.fs
+	${TOOL_GZIP} -cd ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/miniroot/miniroot.fs.gz > \
+			${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/miniroot/miniroot.fs
+	${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/miniroot '*.fs*'



CVS commit: src/share/locale

2020-03-23 Thread Kimmo Suominen
Module Name:src
Committed By:   kim
Date:   Mon Mar 23 08:44:10 UTC 2020

Modified Files:
src/share/locale: locale.alias

Log Message:
Add C.UTF-8


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/share/locale/locale.alias

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

Modified files:

Index: src/share/locale/locale.alias
diff -u src/share/locale/locale.alias:1.12 src/share/locale/locale.alias:1.13
--- src/share/locale/locale.alias:1.12	Sun Aug 11 22:09:40 2013
+++ src/share/locale/locale.alias	Mon Mar 23 08:44:10 2020
@@ -1,9 +1,13 @@
-# $NetBSD: locale.alias,v 1.12 2013/08/11 22:09:40 joerg Exp $
+# $NetBSD: locale.alias,v 1.13 2020/03/23 08:44:10 kim Exp $
 
 #
 # Locale aliases
 #
 
+# C.UTF-8
+C.UTF-8/LC_CTYPE		en_US.UTF-8
+C.UTF-8C
+
 # Pig locale
 Pig/LC_MESSAGES			/FORCE
 



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

2020-03-23 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Mar 23 07:42:00 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: if_ave.c if_scx.c

Log Message:
replace some macro names for descriptor management


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/sociox/if_ave.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/sociox/if_scx.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/sociox/if_ave.c
diff -u src/sys/arch/arm/sociox/if_ave.c:1.12 src/sys/arch/arm/sociox/if_ave.c:1.13
--- src/sys/arch/arm/sociox/if_ave.c:1.12	Mon Mar 23 05:24:28 2020
+++ src/sys/arch/arm/sociox/if_ave.c	Mon Mar 23 07:42:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ave.c,v 1.12 2020/03/23 05:24:28 nisimura Exp $	*/
+/*	$NetBSD: if_ave.c,v 1.13 2020/03/23 07:42:00 nisimura Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.12 2020/03/23 05:24:28 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.13 2020/03/23 07:42:00 nisimura Exp $");
 
 #include 
 #include 
@@ -169,18 +169,18 @@ struct rdes32 { uint32_t r0, r1; };
 /* R1 frame address 31:0 */
 /* R2 frame address 63:32 */
 
-#define AVE_NTXSEGS		16
-#define AVE_TXQUEUELEN		(AVE_NTXDESC / AVE_NTXSEGS)
-#define AVE_TXQUEUELEN_MASK	(AVE_TXQUEUELEN - 1)
-#define AVE_TXQUEUE_GC		(AVE_TXQUEUELEN / 4)
-#define AVE_NTXDESC		256			/* HW limit */
-#define AVE_NTXDESC_MASK	(AVE_NTXDESC - 1)
-#define AVE_NEXTTX(x)		(((x) + 1) & AVE_NTXDESC_MASK)
-#define AVE_NEXTTXS(x)		(((x) + 1) & AVE_TXQUEUELEN_MASK)
-
-#define AVE_NRXDESC		256
-#define AVE_NRXDESC_MASK	(AVE_NRXDESC - 1)
-#define AVE_NEXTRX(x)		(((x) + 1) & AVE_NRXDESC_MASK)
+#define MD_NTXSEGS		16		/* fixed */
+#define MD_TXQUEUELEN		(MD_NTXDESC / MD_NTXSEGS)
+#define MD_TXQUEUELEN_MASK	(MD_TXQUEUELEN - 1)
+#define MD_TXQUEUE_GC		(MD_TXQUEUELEN / 4)
+#define MD_NTXDESC		256		/* this is max HW limit */
+#define MD_NTXDESC_MASK	(MD_NTXDESC - 1)
+#define MD_NEXTTX(x)		(((x) + 1) & MD_NTXDESC_MASK)
+#define MD_NEXTTXS(x)		(((x) + 1) & MD_TXQUEUELEN_MASK)
+
+#define MD_NRXDESC		256		/* tunable */
+#define MD_NRXDESC_MASK	(MD_NRXDESC - 1)
+#define MD_NEXTRX(x)		(((x) + 1) & MD_NRXDESC_MASK)
 
 #define AVE_INIT_RXDESC(sc, x)		\
 do {	\
@@ -242,8 +242,8 @@ struct ave_softc {
 	struct tdes32 *sc_txd32;
 	struct rdes32 *sc_rxd32;
 
-	struct ave_txsoft sc_txsoft[AVE_TXQUEUELEN];
-	struct ave_rxsoft sc_rxsoft[AVE_NRXDESC];
+	struct ave_txsoft sc_txsoft[MD_TXQUEUELEN];
+	struct ave_rxsoft sc_rxsoft[MD_NRXDESC];
 	int sc_txfree;			/* number of free Tx descriptors */
 	int sc_txnext;			/* next ready Tx descriptor */
 	int sc_txsfree;			/* number of free Tx jobs */
@@ -429,9 +429,9 @@ ave_fdt_attach(device_t parent, device_t
 	 * so no need to build Tx/Rx descriptor control_data.
 	 * go straight to make dmamap to hold Tx segments and Rx frames.
 	 */
-	for (i = 0; i < AVE_TXQUEUELEN; i++) {
+	for (i = 0; i < MD_TXQUEUELEN; i++) {
 		if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES,
-		AVE_NTXSEGS, MCLBYTES, 0, 0,
+		MD_NTXSEGS, MCLBYTES, 0, 0,
 		>sc_txsoft[i].txs_dmamap)) != 0) {
 			aprint_error_dev(self,
 			"unable to create tx DMA map %d, error = %d\n",
@@ -439,7 +439,7 @@ ave_fdt_attach(device_t parent, device_t
 			goto fail_4;
 		}
 	}
-	for (i = 0; i < AVE_NRXDESC; i++) {
+	for (i = 0; i < MD_NRXDESC; i++) {
 		if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES,
 		1, MCLBYTES, 0, 0, >sc_rxsoft[i].rxs_dmamap)) != 0) {
 			aprint_error_dev(self,
@@ -462,13 +462,13 @@ ave_fdt_attach(device_t parent, device_t
 	return;
 
   fail_5:
-	for (i = 0; i < AVE_NRXDESC; i++) {
+	for (i = 0; i < MD_NRXDESC; i++) {
 		if (sc->sc_rxsoft[i].rxs_dmamap != NULL)
 			bus_dmamap_destroy(sc->sc_dmat,
 			sc->sc_rxsoft[i].rxs_dmamap);
 	}
   fail_4:
-	for (i = 0; i < AVE_TXQUEUELEN; i++) {
+	for (i = 0; i < MD_TXQUEUELEN; i++) {
 		if (sc->sc_txsoft[i].txs_dmamap != NULL)
 			bus_dmamap_destroy(sc->sc_dmat,
 			sc->sc_txsoft[i].txs_dmamap);
@@ -519,8 +519,8 @@ ave_init(struct ifnet *ifp)
 	CSR_WRITE(sc, AVECFG, CFG_FLE | sc->sc_100mii);
 
 	/* set Tx/Rx descriptor ring base addr offset and total size */
-	CSR_WRITE(sc, AVETXDES,	 0U|(sizeof(struct tdes)*AVE_NTXDESC) << 16);
-	CSR_WRITE(sc, AVERXDES0, 0U|(sizeof(struct rdes)*AVE_NRXDESC) << 16);
+	CSR_WRITE(sc, AVETXDES,	 0U|(sizeof(struct tdes)*MD_NTXDESC) << 16);
+	CSR_WRITE(sc, AVERXDES0, 0U|(sizeof(struct rdes)*MD_NRXDESC) << 16);
 
 	/* set ptr to Tx/Rx descriptor store */
 	sc->sc_txdescs = (void *)((uintptr_t)sc->sc_sh + AVETDB);
@@ -529,12 +529,12 @@ ave_init(struct ifnet *ifp)
 	sc->sc_rxd32 =   (void *)((uintptr_t)sc->sc_sh + AVE32RDB);
 
 	/* build sane Tx and load Rx descriptors with mbuf */
-	for (i = 0; i < AVE_NTXDESC; i++) {
+	for (i = 0; i < MD_NTXDESC; i++) {
 		struct tdes *tdes = >sc_txdescs[i];
 		tdes->t2