CVS commit: src/sys/dev/i2c

2020-01-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 15 06:09:37 UTC 2020

Modified Files:
src/sys/dev/i2c: at24cxx.c

Log Message:
tsleep -> kpause


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/i2c/at24cxx.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/i2c/at24cxx.c
diff -u src/sys/dev/i2c/at24cxx.c:1.35 src/sys/dev/i2c/at24cxx.c:1.36
--- src/sys/dev/i2c/at24cxx.c:1.35	Mon Dec 23 15:51:50 2019
+++ src/sys/dev/i2c/at24cxx.c	Wed Jan 15 06:09:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: at24cxx.c,v 1.35 2019/12/23 15:51:50 thorpej Exp $	*/
+/*	$NetBSD: at24cxx.c,v 1.36 2020/01/15 06:09:36 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: at24cxx.c,v 1.35 2019/12/23 15:51:50 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at24cxx.c,v 1.36 2020/01/15 06:09:36 thorpej Exp $");
 
 #include 
 #include 
@@ -392,8 +392,8 @@ seeprom_wait_idle(struct seeprom_softc *
 		if (error == 0)
 			break;
 
-		rv = tsleep(sc, PRIBIO | PCATCH, "seepromwr", timeout);
-		if (rv != EWOULDBLOCK)
+		rv = kpause("seepromwr", true, timeout, NULL);
+		if (rv != EWOULDBLOCK && rv != 0)
 			return (rv);
 	}
 



CVS commit: src/sys/dev/i2c

2020-01-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 15 05:56:57 UTC 2020

Modified Files:
src/sys/dev/i2c: tsl256x.c

Log Message:
tsleep -> kpause


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/i2c/tsl256x.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/i2c/tsl256x.c
diff -u src/sys/dev/i2c/tsl256x.c:1.7 src/sys/dev/i2c/tsl256x.c:1.8
--- src/sys/dev/i2c/tsl256x.c:1.7	Thu Jul 25 04:25:40 2019
+++ src/sys/dev/i2c/tsl256x.c	Wed Jan 15 05:56:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: tsl256x.c,v 1.7 2019/07/25 04:25:40 thorpej Exp $ */
+/* $NetBSD: tsl256x.c,v 1.8 2020/01/15 05:56:57 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2018 Jason R. Thorpe
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tsl256x.c,v 1.7 2019/07/25 04:25:40 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tsl256x.c,v 1.8 2020/01/15 05:56:57 thorpej Exp $");
 
 #include 
 #include 
@@ -652,8 +652,7 @@ tsllux_wait_for_adcs(struct tsllux_softc
 		delay(ms * 1000);
 	} else {
 		/* Round up one tick for the case where we sleep. */
-		(void) tsleep(tsllux_wait_for_adcs, PWAIT, "tslluxwait",
-			  mstohz(ms) + 1);
+		(void) kpause("tslluxwait", false, mstohz(ms) + 1, NULL);
 	}
 
 	return (0);



CVS commit: src/doc

2020-01-14 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jan 15 01:11:06 UTC 2020

Modified Files:
src/doc: CHANGES

Log Message:
evbarm: Add support for NXP i.MX 8M family SoCs.


To generate a diff of this commit:
cvs rdiff -u -r1.2632 -r1.2633 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2632 src/doc/CHANGES:1.2633
--- src/doc/CHANGES:1.2632	Mon Jan  6 21:04:58 2020
+++ src/doc/CHANGES	Wed Jan 15 01:11:05 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2632 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2633 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -94,3 +94,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	aq(4): Add Aquantia 10G network adapter driver [ryo 20200101]
 	dhcpcd(8): Import dhcpcd-8.1.5 [roy 20200103]
 	tmux(1): Imported 3.0a. [christos 20200106]
+	evbarm: Add support for NXP i.MX 8M family SoCs. [jmcneill 20200114]



CVS commit: src/sys

2020-01-14 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jan 15 01:09:57 UTC 2020

Modified Files:
src/sys/arch/arm/imx: if_enet.c if_enet_imx6.c if_enet_imx7.c
if_enetvar.h imx6_board.c imx6_pcie.c imx6_usdhc.c imx7_usdhc.c
imxgpio.c imxgpiovar.h imxuart.c
src/sys/arch/arm/imx/fdt: files.imx6 if_enet_imx.c imx6_com.c
imx6_gpio.c imx6_iomux.c imx6_sdhc.c
src/sys/arch/evbarm/conf: GENERIC64 files.generic64
src/sys/dev/fdt: dwc3_fdt.c
Added Files:
src/sys/arch/arm/imx/fdt: imx7_gpc.c imx8mq_ccm.c imx8mq_ccm.h
imx8mq_usbphy.c imx_ccm.c imx_ccm.h imx_ccm_composite.c
imx_ccm_extclk.c imx_ccm_fixed.c imx_ccm_fixed_factor.c
imx_ccm_gate.c

Log Message:
Add support for NXP i.MX 8M Dual/8M QuadLite/8M Quad family SoCs.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/arm/imx/if_enet.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/imx/if_enet_imx6.c \
src/sys/arch/arm/imx/imx6_usdhc.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/if_enet_imx7.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/if_enetvar.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/imx/imx6_board.c \
src/sys/arch/arm/imx/imx6_pcie.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/imx7_usdhc.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/imx/imxgpio.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imxgpiovar.h
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/imx/imxuart.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/imx/fdt/files.imx6
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/imx/fdt/if_enet_imx.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/fdt/imx6_com.c \
src/sys/arch/arm/imx/fdt/imx6_iomux.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/fdt/imx6_gpio.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/fdt/imx6_sdhc.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/imx/fdt/imx7_gpc.c \
src/sys/arch/arm/imx/fdt/imx8mq_ccm.c \
src/sys/arch/arm/imx/fdt/imx8mq_ccm.h \
src/sys/arch/arm/imx/fdt/imx8mq_usbphy.c \
src/sys/arch/arm/imx/fdt/imx_ccm.c src/sys/arch/arm/imx/fdt/imx_ccm.h \
src/sys/arch/arm/imx/fdt/imx_ccm_composite.c \
src/sys/arch/arm/imx/fdt/imx_ccm_extclk.c \
src/sys/arch/arm/imx/fdt/imx_ccm_fixed.c \
src/sys/arch/arm/imx/fdt/imx_ccm_fixed_factor.c \
src/sys/arch/arm/imx/fdt/imx_ccm_gate.c
cvs rdiff -u -r1.131 -r1.132 src/sys/arch/evbarm/conf/GENERIC64
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbarm/conf/files.generic64
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/fdt/dwc3_fdt.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/imx/if_enet.c
diff -u src/sys/arch/arm/imx/if_enet.c:1.29 src/sys/arch/arm/imx/if_enet.c:1.30
--- src/sys/arch/arm/imx/if_enet.c:1.29	Fri Nov 29 17:20:30 2019
+++ src/sys/arch/arm/imx/if_enet.c	Wed Jan 15 01:09:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet.c,v 1.29 2019/11/29 17:20:30 ryo Exp $	*/
+/*	$NetBSD: if_enet.c,v 1.30 2020/01/15 01:09:56 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.29 2019/11/29 17:20:30 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.30 2020/01/15 01:09:56 jmcneill Exp $");
 
 #include "vlan.h"
 
@@ -247,7 +247,7 @@ enet_attach_common(device_t self)
 	ifmedia_init(>mii_media, 0, ether_mediachange, enet_mediastatus);
 
 	/* try to attach PHY */
-	mii_attach(self, mii, 0x, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+	mii_attach(self, mii, 0x, sc->sc_phyid, MII_OFFSET_ANY, 0);
 	if (LIST_FIRST(>mii_phys) == NULL) {
 		ifmedia_add(>mii_media, IFM_ETHER | IFM_MANUAL, 0, NULL);
 		ifmedia_set(>mii_media, IFM_ETHER | IFM_MANUAL);

Index: src/sys/arch/arm/imx/if_enet_imx6.c
diff -u src/sys/arch/arm/imx/if_enet_imx6.c:1.8 src/sys/arch/arm/imx/if_enet_imx6.c:1.9
--- src/sys/arch/arm/imx/if_enet_imx6.c:1.8	Mon Nov 25 00:54:47 2019
+++ src/sys/arch/arm/imx/if_enet_imx6.c	Wed Jan 15 01:09:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet_imx6.c,v 1.8 2019/11/25 00:54:47 hkenken Exp $	*/
+/*	$NetBSD: if_enet_imx6.c,v 1.9 2020/01/15 01:09:56 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet_imx6.c,v 1.8 2019/11/25 00:54:47 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet_imx6.c,v 1.9 2020/01/15 01:09:56 jmcneill Exp $");
 
 #include "locators.h"
 #include "imxccm.h"
@@ -88,6 +88,7 @@ enet_attach(device_t parent, device_t se
 	sc->sc_dmat = aa->aa_dmat;
 
 	sc->sc_imxtype = 6;	/* i.MX6 */
+	sc->sc_phyid = MII_PHY_ANY;
 	if (IMX6_CHIPID_MAJOR(imx6_chip_id()) == CHIPID_MAJOR_IMX6UL)
 		sc->sc_rgmii = 0;
 	else
Index: src/sys/arch/arm/imx/imx6_usdhc.c
diff -u src/sys/arch/arm/imx/imx6_usdhc.c:1.8 src/sys/arch/arm/imx/imx6_usdhc.c:1.9
--- src/sys/arch/arm/imx/imx6_usdhc.c:1.8	Wed Jul 24 12:33:18 2019
+++ src/sys/arch/arm/imx/imx6_usdhc.c	Wed Jan 15 01:09:56 2020
@@ 

CVS commit: src/sbin/rndctl

2020-01-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 14 23:13:36 UTC 2020

Modified Files:
src/sbin/rndctl: Makefile

Log Message:
.include bsd.own.mk for ${NETBSDSRCDIR}


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sbin/rndctl/Makefile

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

Modified files:

Index: src/sbin/rndctl/Makefile
diff -u src/sbin/rndctl/Makefile:1.4 src/sbin/rndctl/Makefile:1.5
--- src/sbin/rndctl/Makefile:1.4	Fri Dec  6 09:43:18 2019
+++ src/sbin/rndctl/Makefile	Tue Jan 14 18:13:36 2020
@@ -1,4 +1,6 @@
-#	$NetBSD: Makefile,v 1.4 2019/12/06 14:43:18 riastradh Exp $
+#	$NetBSD: Makefile,v 1.5 2020/01/14 23:13:36 christos Exp $
+
+.include 
 
 PROG=	rndctl
 MAN=	rndctl.8



CVS commit: src/sys/dev/pci

2020-01-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jan 14 22:55:27 UTC 2020

Modified Files:
src/sys/dev/pci: piixpmreg.h

Log Message:
 Add AMDFCH41_SMBUS_PORTMASK.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/piixpmreg.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/pci/piixpmreg.h
diff -u src/sys/dev/pci/piixpmreg.h:1.11 src/sys/dev/pci/piixpmreg.h:1.12
--- src/sys/dev/pci/piixpmreg.h:1.11	Thu Jan  9 12:49:12 2020
+++ src/sys/dev/pci/piixpmreg.h	Tue Jan 14 22:55:27 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: piixpmreg.h,v 1.11 2020/01/09 12:49:12 msaitoh Exp $ */
+/* $NetBSD: piixpmreg.h,v 1.12 2020/01/14 22:55:27 msaitoh Exp $ */
 /*	$OpenBSD: piixreg.h,v 1.3 2006/01/03 22:39:03 grange Exp $	*/
 
 /*-
@@ -149,6 +149,7 @@
 #define		AMDFCH41_WDT_EN		0x80
 #define AMDFCH41_PM_DECODE_EN1		0x01
 #define AMDFCH41_PM_PORT_INDEX		0x02
+#define 	AMDFCH41_SMBUS_PORTMASK	0x18
 #define	AMDFCH41_PM_DECODE_EN3		0x03
 #define		AMDFCH41_WDT_RES_MASK	0x03
 #define		AMDFCH41_WDT_RES_32US	0x00



CVS commit: src/sys/dev/ata

2020-01-14 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Jan 14 21:08:06 UTC 2020

Modified Files:
src/sys/dev/ata: wd.c

Log Message:
enable the BAD_NCQ quirk for all 860 EVO drives

XXX work-in-progress, it's not clear whether this is driver or controller
XXX problem


To generate a diff of this commit:
cvs rdiff -u -r1.454 -r1.455 src/sys/dev/ata/wd.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/ata/wd.c
diff -u src/sys/dev/ata/wd.c:1.454 src/sys/dev/ata/wd.c:1.455
--- src/sys/dev/ata/wd.c:1.454	Mon Jan 13 21:20:17 2020
+++ src/sys/dev/ata/wd.c	Tue Jan 14 21:08:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: wd.c,v 1.454 2020/01/13 21:20:17 jdolecek Exp $ */
+/*	$NetBSD: wd.c,v 1.455 2020/01/14 21:08:06 jdolecek Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.454 2020/01/13 21:20:17 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.455 2020/01/14 21:08:06 jdolecek Exp $");
 
 #include "opt_ata.h"
 #include "opt_wd.h"
@@ -263,8 +263,7 @@ static const struct wd_quirk {
 	{ "ST3120023AS", WD_QUIRK_SPLIT_MOD15_WRITE },
 	{ "ST380023AS", WD_QUIRK_SPLIT_MOD15_WRITE },
 	{ "ST360015AS", WD_QUIRK_SPLIT_MOD15_WRITE },
-	{ "Samsung SSD 860 EVO 1TB", WD_QUIRK_BAD_NCQ },
-	{ "Samsung SSD 860 EVO 500GB", WD_QUIRK_BAD_NCQ },
+	{ "Samsung SSD 860 EVO *", WD_QUIRK_BAD_NCQ },
 	{ NULL, 0 }
 };
 



CVS commit: src/external/bsd/libarchive/dist/libarchive

2020-01-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 14 19:29:45 UTC 2020

Modified Files:
src/external/bsd/libarchive/dist/libarchive: archive_write_disk_posix.c

Log Message:
In the extract atomic case, remove the destination hard link first
since it did not get removed before for us. If we wanted to do this
right, we would do the mk*temp() file generation and trying to link
instead of open, and finally when we got the link to succeed, we
would rename the temp link to the final destination name, making
hard link creation atomic. For now we just remove first.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c

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

Modified files:

Index: src/external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c
diff -u src/external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c:1.3 src/external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c:1.4
--- src/external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c:1.3	Sun Jan 12 11:10:48 2020
+++ src/external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c	Tue Jan 14 14:29:45 2020
@@ -2301,6 +2301,8 @@ create_filesystem_object(struct archive_
 		}
 		free(linkname_copy);
 		archive_string_free(_string);
+		if (a->flags & ARCHIVE_EXTRACT_ATOMIC)
+			unlink(a->name);
 		r = link(linkname, a->name) ? errno : 0;
 		/*
 		 * New cpio and pax formats allow hardlink entries



CVS commit: src/usr.sbin/sysinst

2020-01-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 14 19:28:32 UTC 2020

Modified Files:
src/usr.sbin/sysinst: mbr.c

Log Message:
PR install/54787: when trying to derive proper alignement and first offset
from exisiting partitions, use the first partition offset if it is already
closer to the start of the disk than the prefered alignment - we can not
move existing partitions around.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/sysinst/mbr.c

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

Modified files:

Index: src/usr.sbin/sysinst/mbr.c
diff -u src/usr.sbin/sysinst/mbr.c:1.25 src/usr.sbin/sysinst/mbr.c:1.26
--- src/usr.sbin/sysinst/mbr.c:1.25	Thu Jan  9 19:51:49 2020
+++ src/usr.sbin/sysinst/mbr.c	Tue Jan 14 19:28:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbr.c,v 1.25 2020/01/09 19:51:49 martin Exp $ */
+/*	$NetBSD: mbr.c,v 1.26 2020/01/14 19:28:31 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -982,9 +982,16 @@ mbr_change_disk_geom(struct disk_partiti
 		if (!(ptn_0_limit & 2047)) {
 			/* Partition ends on a 1MB boundary, align to 1MB */
 			parts->ptn_alignment = 2048;
-			if (ptn_0_base <= 2048
-			&& !(ptn_0_base & (ptn_0_base - 1))) {
-/* ptn_base is a power of 2, use it */
+			if ((ptn_0_base <= 2048
+			&& !(ptn_0_base & (ptn_0_base - 1)))
+			|| (ptn_0_base < parts->ptn_0_offset)) {
+/*
+ * If ptn_base is a power of 2, use it.
+ * Also use it if the first partition
+ * already is close to the begining
+ * of the disk and we can't enforce
+ * better alignment.
+ */
 parts->ptn_0_offset = ptn_0_base;
 			}
 		}



CVS commit: src/lib/libc/thread-stub

2020-01-14 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jan 14 18:18:59 UTC 2020

Modified Files:
src/lib/libc/thread-stub: thread-stub.c

Log Message:
Adjust the error return value of pthread_sigmask for !libpthread usage

Instead of returning -1, return errno on error.

Catch up after the fix in libpthread by Andrew Doran in 2008
in lib/libpthread/pthread_misc.c r.1.9.

It's an open question whether this function shall be used without linked
in the POSIX thread library.

Detected by Bruno Haible (GNU) and documented in gnulib in commit
"pthread_sigmask: Avoid test failure on NetBSD 8.0. " r. 4d16a83b0c1fcb6c.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/lib/libc/thread-stub/thread-stub.c

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

Modified files:

Index: src/lib/libc/thread-stub/thread-stub.c
diff -u src/lib/libc/thread-stub/thread-stub.c:1.29 src/lib/libc/thread-stub/thread-stub.c:1.30
--- src/lib/libc/thread-stub/thread-stub.c:1.29	Tue Mar  5 01:35:52 2019
+++ src/lib/libc/thread-stub/thread-stub.c	Tue Jan 14 18:18:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: thread-stub.c,v 1.29 2019/03/05 01:35:52 christos Exp $	*/
+/*	$NetBSD: thread-stub.c,v 1.30 2020/01/14 18:18:59 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: thread-stub.c,v 1.29 2019/03/05 01:35:52 christos Exp $");
+__RCSID("$NetBSD: thread-stub.c,v 1.30 2020/01/14 18:18:59 kamil Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 /*
@@ -382,7 +382,9 @@ __libc_thr_sigsetmask_stub(int h, const 
 
 	CHECK_NOT_THREADED();
 
-	return sigprocmask(h, s, o);
+	if (sigprocmask(h, s, o))
+		return errno;
+	return 0;
 }
 
 thr_t



CVS commit: src/share/mk

2020-01-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 14 16:48:18 UTC 2020

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Back to pax as tar until I figure out how I broke libarchive (hard link
extraction creates 0 length files for existing hard-links).


To generate a diff of this commit:
cvs rdiff -u -r1.1170 -r1.1171 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1170 src/share/mk/bsd.own.mk:1.1171
--- src/share/mk/bsd.own.mk:1.1170	Sun Jan 12 11:11:51 2020
+++ src/share/mk/bsd.own.mk	Tue Jan 14 11:48:18 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1170 2020/01/12 16:11:51 christos Exp $
+#	$NetBSD: bsd.own.mk,v 1.1171 2020/01/14 16:48:18 christos Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -1082,7 +1082,6 @@ MKSTATICPIE?=	no
 _MKVARS.yes= \
 	MKATF \
 	MKBINUTILS \
-	MKBSDTAR \
 	MKCOMPLEX MKCVS MKCXX \
 	MKDOC MKDTC \
 	MKDYNAMICROOT \
@@ -1206,6 +1205,7 @@ _MKVARS.no= \
 	MKARGON2 \
 	MKARZERO \
 	MKBSDGREP \
+	MKBSDTAR \
 	MKCATPAGES MKCOMPATTESTS MKCOMPATX11 MKCTF \
 	MKDEBUG MKDEBUGLIB MKDTRACE \
 	MKEXTSRC \



CVS commit: src/sys/arch/ia64/stand/ia64/ski

2020-01-14 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Tue Jan 14 16:23:08 UTC 2020

Modified Files:
src/sys/arch/ia64/stand/ia64/ski: ssc.c

Log Message:
add noinline attribute


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/ia64/stand/ia64/ski/ssc.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/ia64/stand/ia64/ski/ssc.c
diff -u src/sys/arch/ia64/stand/ia64/ski/ssc.c:1.3 src/sys/arch/ia64/stand/ia64/ski/ssc.c:1.4
--- src/sys/arch/ia64/stand/ia64/ski/ssc.c:1.3	Mon Jul 20 04:59:04 2009
+++ src/sys/arch/ia64/stand/ia64/ski/ssc.c	Tue Jan 14 16:23:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ssc.c,v 1.3 2009/07/20 04:59:04 kiyohara Exp $	*/
+/*	$NetBSD: ssc.c,v 1.4 2020/01/14 16:23:07 scole Exp $	*/
 
 /*-
  * Copyright (c) 2001 Doug Rabson
@@ -41,6 +41,8 @@
  * PSR.dt across the SSC call. We do this by saving and restoring psr.l
  * completely.
  */
+
+__attribute__((__noinline__))
 u_int64_t
 ssc(u_int64_t in0, u_int64_t in1, u_int64_t in2, u_int64_t in3, int which)
 {



CVS commit: src/share/man/man4

2020-01-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jan 14 15:43:19 UTC 2020

Modified Files:
src/share/man/man4: piixpm.4

Log Message:
 Update for AMD FCHs (HUDSON, BOLTON and KERNCZ).


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/share/man/man4/piixpm.4

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

Modified files:

Index: src/share/man/man4/piixpm.4
diff -u src/share/man/man4/piixpm.4:1.7 src/share/man/man4/piixpm.4:1.8
--- src/share/man/man4/piixpm.4:1.7	Sun Jul 10 04:44:47 2016
+++ src/share/man/man4/piixpm.4	Tue Jan 14 15:43:19 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: piixpm.4,v 1.7 2016/07/10 04:44:47 pgoyette Exp $
+.\" $NetBSD: piixpm.4,v 1.8 2020/01/14 15:43:19 msaitoh Exp $
 .\"	$OpenBSD: piixpm.4,v 1.9 2006/01/18 03:06:33 brad Exp $
 .\"
 .\" Copyright (c) 2004, 2005 Alexander Yurchenko 
@@ -15,7 +15,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd July 10, 2016
+.Dd January 14, 2020
 .Dt PIIXPM 4
 .Os
 .Sh NAME
@@ -43,7 +43,7 @@ Intel 82371AB (PIIX4), 82440MX
 .It
 Serverworks OSB4, OSB5, OSB6, HT1000SB
 .It
-AMD HUDSON
+AMD FCHs (HUDSON, BOLTON and KERNCZ)
 .El
 .Sh SEE ALSO
 .Xr iic 4 ,



CVS commit: src/sys/dev/pci

2020-01-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jan 14 15:42:03 UTC 2020

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

Log Message:
Save/restore port number before selecting port. Linux driver says it must
be required on some systems.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/pci/piixpm.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/piixpm.c
diff -u src/sys/dev/pci/piixpm.c:1.62 src/sys/dev/pci/piixpm.c:1.63
--- src/sys/dev/pci/piixpm.c:1.62	Tue Jan 14 15:36:54 2020
+++ src/sys/dev/pci/piixpm.c	Tue Jan 14 15:42:03 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: piixpm.c,v 1.62 2020/01/14 15:36:54 msaitoh Exp $ */
+/* $NetBSD: piixpm.c,v 1.63 2020/01/14 15:42:03 msaitoh Exp $ */
 /*	$OpenBSD: piixpm.c,v 1.39 2013/10/01 20:06:02 sf Exp $	*/
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.62 2020/01/14 15:36:54 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.63 2020/01/14 15:42:03 msaitoh Exp $");
 
 #include 
 #include 
@@ -75,6 +75,7 @@ __KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1
 
 struct piixpm_smbus {
 	int			sda;
+	int			sda_save;
 	struct			piixpm_softc *softc;
 };
 
@@ -498,7 +499,7 @@ piixpm_i2c_sb800_acquire_bus(void *cooki
 {
 	struct piixpm_smbus *smbus = cookie;
 	struct piixpm_softc *sc = smbus->softc;
-	uint8_t sctl;
+	uint8_t sctl, old_sda, index, mask, reg;
 	int i;
 
 	sctl = bus_space_read_1(sc->sc_smb_iot, sc->sc_smb_ioh, PIIX_SMB_SC);
@@ -521,29 +522,34 @@ piixpm_i2c_sb800_acquire_bus(void *cooki
 		return -1;
 	}
 
-	if (PIIXPM_IS_KERNCZ(sc)) {
-		bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
-		SB800_INDIRECTIO_INDEX, AMDFCH41_PM_PORT_INDEX);
-		bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
-		SB800_INDIRECTIO_DATA, smbus->sda << 3);
+	if (PIIXPM_IS_KERNCZ(sc) ||
+	(PIIXPM_IS_HUDSON(sc) && (sc->sc_rev >= 0x1f))) {
+		index = AMDFCH41_PM_PORT_INDEX;
+		mask = AMDFCH41_SMBUS_PORTMASK;
 	} else if (sc->sc_sb800_selen) {
-		bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
-		SB800_INDIRECTIO_INDEX, SB800_PM_SMBUS0SEL);
-		bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
-		SB800_INDIRECTIO_DATA,
-		__SHIFTIN(smbus->sda, SB800_PM_SMBUS0_MASK_E));
+		index = SB800_PM_SMBUS0SEL;
+		mask = SB800_PM_SMBUS0_MASK_E;
 	} else {
-		uint8_t data;
+		index = SB800_PM_SMBUS0EN_LO;
+		mask = SB800_PM_SMBUS0_MASK_C;
+	}
 
+	bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
+	SB800_INDIRECTIO_INDEX, index);
+	reg = bus_space_read_1(sc->sc_iot, sc->sc_sb800_ioh,
+	SB800_INDIRECTIO_DATA);
+
+	old_sda = __SHIFTOUT(reg, mask);
+	if (smbus->sda != old_sda) {
+		reg &= ~mask;
+		reg |= __SHIFTIN(smbus->sda, mask);
 		bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
-		SB800_INDIRECTIO_INDEX, SB800_PM_SMBUS0EN_LO);
-		data = bus_space_read_1(sc->sc_iot, sc->sc_sb800_ioh,
-		SB800_INDIRECTIO_DATA) & ~SB800_PM_SMBUS0_MASK_C;
-		data |= __SHIFTIN(smbus->sda, SB800_PM_SMBUS0_MASK_C);
-		bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
-		SB800_INDIRECTIO_DATA, data);
+		SB800_INDIRECTIO_DATA, reg);
 	}
 
+	/* Save the old port number */
+	smbus->sda_save = old_sda;
+
 	return 0;
 }
 
@@ -552,32 +558,30 @@ piixpm_i2c_sb800_release_bus(void *cooki
 {
 	struct piixpm_smbus *smbus = cookie;
 	struct piixpm_softc *sc = smbus->softc;
-	uint8_t sctl;
+	uint8_t sctl, index, mask, reg;
 
-	if (PIIXPM_IS_KERNCZ(sc)) {
-		bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
-		SB800_INDIRECTIO_INDEX, AMDFCH41_PM_PORT_INDEX);
-		/* Set to port 0 */
-		bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
-		SB800_INDIRECTIO_DATA, 0);
+	if (PIIXPM_IS_KERNCZ(sc) ||
+	(PIIXPM_IS_HUDSON(sc) && (sc->sc_rev >= 0x1f))) {
+		index = AMDFCH41_PM_PORT_INDEX;
+		mask = AMDFCH41_SMBUS_PORTMASK;
 	} else if (sc->sc_sb800_selen) {
-		bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
-		SB800_INDIRECTIO_INDEX, SB800_PM_SMBUS0SEL);
-
-		/* Set to port 0 */
-		bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
-		SB800_INDIRECTIO_DATA, 0);
+		index = SB800_PM_SMBUS0SEL;
+		mask = SB800_PM_SMBUS0_MASK_E;
 	} else {
-		uint8_t data;
-
-		bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
-		SB800_INDIRECTIO_INDEX, SB800_PM_SMBUS0EN_LO);
+		index = SB800_PM_SMBUS0EN_LO;
+		mask = SB800_PM_SMBUS0_MASK_C;
+	}
 
-		/* Set to port 0 */
-		data = bus_space_read_1(sc->sc_iot, sc->sc_sb800_ioh,
-		SB800_INDIRECTIO_DATA) & ~SB800_PM_SMBUS0_MASK_C;
+	bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
+	SB800_INDIRECTIO_INDEX, index);
+	if (smbus->sda != smbus->sda_save) {
+		/* Restore the port number */
+		reg = bus_space_read_1(sc->sc_iot, sc->sc_sb800_ioh,
+		SB800_INDIRECTIO_DATA);
+		reg &= ~mask;
+		reg |= __SHIFTIN(smbus->sda_save, mask);
 		bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
-		SB800_INDIRECTIO_DATA, data);
+		SB800_INDIRECTIO_DATA, reg);
 	}
 
 	/* Relase the host semaphore */

CVS commit: src/sys/dev/pci

2020-01-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jan 14 15:36:54 UTC 2020

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

Log Message:
 Simplify. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/pci/piixpm.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/piixpm.c
diff -u src/sys/dev/pci/piixpm.c:1.61 src/sys/dev/pci/piixpm.c:1.62
--- src/sys/dev/pci/piixpm.c:1.61	Thu Jan  9 12:49:12 2020
+++ src/sys/dev/pci/piixpm.c	Tue Jan 14 15:36:54 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: piixpm.c,v 1.61 2020/01/09 12:49:12 msaitoh Exp $ */
+/* $NetBSD: piixpm.c,v 1.62 2020/01/14 15:36:54 msaitoh Exp $ */
 /*	$OpenBSD: piixpm.c,v 1.39 2013/10/01 20:06:02 sf Exp $	*/
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.61 2020/01/09 12:49:12 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.62 2020/01/14 15:36:54 msaitoh Exp $");
 
 #include 
 #include 
@@ -526,24 +526,22 @@ piixpm_i2c_sb800_acquire_bus(void *cooki
 		SB800_INDIRECTIO_INDEX, AMDFCH41_PM_PORT_INDEX);
 		bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
 		SB800_INDIRECTIO_DATA, smbus->sda << 3);
+	} else if (sc->sc_sb800_selen) {
+		bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
+		SB800_INDIRECTIO_INDEX, SB800_PM_SMBUS0SEL);
+		bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
+		SB800_INDIRECTIO_DATA,
+		__SHIFTIN(smbus->sda, SB800_PM_SMBUS0_MASK_E));
 	} else {
-		if (sc->sc_sb800_selen) {
-			bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
-			SB800_INDIRECTIO_INDEX, SB800_PM_SMBUS0SEL);
-			bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
-			SB800_INDIRECTIO_DATA,
-			__SHIFTIN(smbus->sda, SB800_PM_SMBUS0_MASK_E));
-		} else {
-			uint8_t data;
+		uint8_t data;
 
-			bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
-			SB800_INDIRECTIO_INDEX, SB800_PM_SMBUS0EN_LO);
-			data = bus_space_read_1(sc->sc_iot, sc->sc_sb800_ioh,
-			SB800_INDIRECTIO_DATA) & ~SB800_PM_SMBUS0_MASK_C;
-			data |= __SHIFTIN(smbus->sda, SB800_PM_SMBUS0_MASK_C);
-			bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
-			SB800_INDIRECTIO_DATA, data);
-		}
+		bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
+		SB800_INDIRECTIO_INDEX, SB800_PM_SMBUS0EN_LO);
+		data = bus_space_read_1(sc->sc_iot, sc->sc_sb800_ioh,
+		SB800_INDIRECTIO_DATA) & ~SB800_PM_SMBUS0_MASK_C;
+		data |= __SHIFTIN(smbus->sda, SB800_PM_SMBUS0_MASK_C);
+		bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
+		SB800_INDIRECTIO_DATA, data);
 	}
 
 	return 0;
@@ -562,26 +560,24 @@ piixpm_i2c_sb800_release_bus(void *cooki
 		/* Set to port 0 */
 		bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
 		SB800_INDIRECTIO_DATA, 0);
+	} else if (sc->sc_sb800_selen) {
+		bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
+		SB800_INDIRECTIO_INDEX, SB800_PM_SMBUS0SEL);
+
+		/* Set to port 0 */
+		bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
+		SB800_INDIRECTIO_DATA, 0);
 	} else {
-		if (sc->sc_sb800_selen) {
-			bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
-			SB800_INDIRECTIO_INDEX, SB800_PM_SMBUS0SEL);
-
-			/* Set to port 0 */
-			bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
-			SB800_INDIRECTIO_DATA, 0);
-		} else {
-			uint8_t data;
+		uint8_t data;
 
-			bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
-			SB800_INDIRECTIO_INDEX, SB800_PM_SMBUS0EN_LO);
+		bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
+		SB800_INDIRECTIO_INDEX, SB800_PM_SMBUS0EN_LO);
 
-			/* Set to port 0 */
-			data = bus_space_read_1(sc->sc_iot, sc->sc_sb800_ioh,
-			SB800_INDIRECTIO_DATA) & ~SB800_PM_SMBUS0_MASK_C;
-			bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
-			SB800_INDIRECTIO_DATA, data);
-		}
+		/* Set to port 0 */
+		data = bus_space_read_1(sc->sc_iot, sc->sc_sb800_ioh,
+		SB800_INDIRECTIO_DATA) & ~SB800_PM_SMBUS0_MASK_C;
+		bus_space_write_1(sc->sc_iot, sc->sc_sb800_ioh,
+		SB800_INDIRECTIO_DATA, data);
 	}
 
 	/* Relase the host semaphore */



CVS commit: src/usr.bin/ktruss

2020-01-14 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jan 14 11:28:35 UTC 2020

Modified Files:
src/usr.bin/ktruss: dump.c

Log Message:
Catch up in ktruss(1) with ptrace descriptive operation names

Switch to dynamic string lists PT_STRINGS and PT_MACHDEP_STRINGS.

Reuse the code and approach from kdump(1).


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/usr.bin/ktruss/dump.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/ktruss/dump.c
diff -u src/usr.bin/ktruss/dump.c:1.46 src/usr.bin/ktruss/dump.c:1.47
--- src/usr.bin/ktruss/dump.c:1.46	Sat Jan  4 22:22:34 2020
+++ src/usr.bin/ktruss/dump.c	Tue Jan 14 11:28:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dump.c,v 1.46 2020/01/04 22:22:34 mlelstv Exp $	*/
+/*	$NetBSD: dump.c,v 1.47 2020/01/14 11:28:35 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #endif
-__RCSID("$NetBSD: dump.c,v 1.46 2020/01/04 22:22:34 mlelstv Exp $");
+__RCSID("$NetBSD: dump.c,v 1.47 2020/01/14 11:28:35 kamil Exp $");
 #endif /* not lint */
 
 #include 
@@ -74,11 +74,13 @@ int width;			/* Keep track of current co
 #include 
 
 static const char *const ptrace_ops[] = {
-	"PT_TRACE_ME",	"PT_READ_I",	"PT_READ_D",	"PT_READ_U",
-	"PT_WRITE_I",	"PT_WRITE_D",	"PT_WRITE_U",	"PT_CONTINUE",
-	"PT_KILL",	"PT_ATTACH",	"PT_DETACH",
+	PT_STRINGS
 };
 
+#ifdef PT_MACHDEP_STRINGS
+static const char * const ptrace_machdep_ops[] = { PT_MACHDEP_STRINGS };
+#endif
+
 struct ktr_entry {
 	TAILQ_ENTRY(ktr_entry) kte_list;
 	struct ktr_header kte_kth;
@@ -578,8 +580,14 @@ syscallprint(struct ktr_header *kth)
 
 	case SYS_ptrace :
 		if ((long)*ap >= 0 &&
-		*ap < (register_t)(sizeof(ptrace_ops) / sizeof(ptrace_ops[0])))
+		*ap < (register_t)__arraycount(ptrace_ops))
 			xwprintf("(%s", ptrace_ops[*ap]);
+#ifdef PT_MACHDEP_STRINGS
+		else if (*ap >= PT_FIRSTMACH &&
+		*ap - PT_FIRSTMACH < (register_t)
+		__arraycount(ptrace_machdep_ops))
+			xwprintf("(%s", ptrace_machdep_ops[*ap - PT_FIRSTMACH]);
+#endif
 		else
 			xwprintf("(%ld", (long)*ap);
 		ap++;



CVS commit: [ad-namecache] src/sys

2020-01-14 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Jan 14 11:07:40 UTC 2020

Modified Files:
src/sys/kern [ad-namecache]: vfs_cache.c
src/sys/sys [ad-namecache]: namei.src vnode_impl.h

Log Message:
namecache:

This is working better than expected.  It seems to cut system time for
build.sh by ~10% on my test machine and joerg@ is seeing better results with
pbulk.  Improve it a bit more without changing the basic idea:

- Split cache_list_lock into a per-vnode rwlock for reverse lookup, and a
  lightly contended global lock on LRU state (cache_lru_lock),

- For LRU replacement, imitate the VM system's page replacement algorithm.
  This eliminates the writebacks to struct namecache (to track time of last
  hit).

- Dynamically allocate the per-directory lock, preparing the way for having
  a "struct nchdir" or similar which could contain stuff like different
  structures for lookup, cached info to do the equivalent of VOP_ACCESS() in
  cache, and so on.


To generate a diff of this commit:
cvs rdiff -u -r1.126.2.4 -r1.126.2.5 src/sys/kern/vfs_cache.c
cvs rdiff -u -r1.47.2.2 -r1.47.2.3 src/sys/sys/namei.src
cvs rdiff -u -r1.19.2.2 -r1.19.2.3 src/sys/sys/vnode_impl.h

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

Modified files:

Index: src/sys/kern/vfs_cache.c
diff -u src/sys/kern/vfs_cache.c:1.126.2.4 src/sys/kern/vfs_cache.c:1.126.2.5
--- src/sys/kern/vfs_cache.c:1.126.2.4	Mon Jan 13 08:51:07 2020
+++ src/sys/kern/vfs_cache.c	Tue Jan 14 11:07:40 2020
@@ -1,7 +1,7 @@
-/*	$NetBSD: vfs_cache.c,v 1.126.2.4 2020/01/13 08:51:07 ad Exp $	*/
+/*	$NetBSD: vfs_cache.c,v 1.126.2.5 2020/01/14 11:07:40 ad Exp $	*/
 
 /*-
- * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc.
+ * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -71,6 +71,10 @@
  *	DELETE, or NOCACHE is set (rewrite), and name is located in the
  *	cache, it will be dropped.
  *
+ * Background:
+ *
+ *	XXX add a bit of history
+ *
  * Data structures:
  *
  *	The original BSD implementation used a global hash table, which
@@ -86,24 +90,16 @@
  *	utimately make use of some other data structure, perhaps a Robin
  *	Hood hash.  Insert blurb here when that happens.
  *
- * Concurrency:
+ * Replacement:
  *
- *	There are two locks that are of particular interest:
+ *	XXX LRU blurb.
  *
- *	nc_dvp->vi_nclock: a per-directory lock.  This is taken mainly
- *	during lookups.
+ * Concurrency:
  *
- *	cache_list_lock: a global lock for all lists, including per-vnode
- *	lists and the LRU queue.  This is taken mainly during insertion and
- *	removal, and when operating in the list -> tree direction.
- *
- *	vp->v_interlock: per vnode interlock taken when acquiring a ref.
- *
- *	Most all modifications are made holding both cache_list_lock and the
- *	directory lock write locked.  nc_hittime does not have any kind of
- *	serialization appliet to it - updates are racy, but since it's only
- *	used for pseudo-LRU replacement it doesn't matter.  See definition
- *	of "struct namecache" in src/sys/namei.src for the particulars.
+ *	XXX need new blurb here
+ *
+ *	See definition of "struct namecache" in src/sys/namei.src for the
+ *	particulars.
  *
  *	Per-CPU statistics, and "numcache" are read unlocked, since an
  *	approximate value is OK.  We maintain uintptr_t sized per-CPU
@@ -112,12 +108,14 @@
  *
  * Lock order:
  *
- *	1) nc_dvp->vi_nclock
+ *	1) nc_dvp->vi_ncdlock
  *	2) cache_list_lock
  *	3) vp->v_interlock
  *
  * Ugly ASCII diagram:
  *
+ *	XXX replace tabs with spaces, make less ugly
+ *
  *  ...
  *	 |
  *	-o-
@@ -150,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.4 2020/01/13 08:51:07 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.5 2020/01/14 11:07:40 ad Exp $");
 
 #define __NAMECACHE_PRIVATE
 #ifdef _KERNEL_OPT
@@ -176,13 +174,22 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,
 /* Per-CPU counters. */
 struct nchstats_percpu _NAMEI_CACHE_STATS(uintptr_t);
 
-/* Global lock, lists and pool. */
-static kmutex_t cache_list_lock __cacheline_aligned;
-static pool_cache_t namecache_cache __read_mostly;
-static TAILQ_HEAD(, namecache) nclruhead __cacheline_aligned;
+/* Global pool cache. */
+static pool_cache_t cache_pool __read_mostly;
+
+/* LRU replacement state. */
+enum cache_lru_id {
+	LRU_ACTIVE,
+	LRU_INACTIVE,
+	LRU_COUNT
+};
+
+static struct {
+	TAILQ_HEAD(, namecache)	list[LRU_COUNT];
+	u_int			count[LRU_COUNT];
+} cache_lru __cacheline_aligned;
 
-/* Number of cache entries allocated. */
-static u_int	numcache __cacheline_aligned;
+static kmutex_t cache_lru_lock __cacheline_aligned;
 
 /* Cache effectiveness statistics.  This holds total from per-cpu stats */
 struct nchstats	nchstats __cacheline_aligned;
@@ -195,14 +202,12 @@ struct nchstats	nchstats __cacheline_ali
 } while 

CVS commit: [ad-namecache] src/sys

2020-01-14 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Jan 14 11:08:01 UTC 2020

Modified Files:
src/sys/rump/include/rump [ad-namecache]: rump_namei.h
src/sys/sys [ad-namecache]: namei.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.37.2.1 -r1.37.2.2 src/sys/rump/include/rump/rump_namei.h
cvs rdiff -u -r1.103.2.1 -r1.103.2.2 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.37.2.1 src/sys/rump/include/rump/rump_namei.h:1.37.2.2
--- src/sys/rump/include/rump/rump_namei.h:1.37.2.1	Wed Jan  8 11:02:35 2020
+++ src/sys/rump/include/rump/rump_namei.h	Tue Jan 14 11:08:01 2020
@@ -1,11 +1,11 @@
-/*	$NetBSD: rump_namei.h,v 1.37.2.1 2020/01/08 11:02:35 ad Exp $	*/
+/*	$NetBSD: rump_namei.h,v 1.37.2.2 2020/01/14 11:08:01 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.47.2.1 2020/01/08 11:02:16 ad Exp 
+ *   from: NetBSD: namei.src,v 1.47.2.3 2020/01/14 11:07:40 ad Exp 
  */
 
 #ifndef _RUMP_RUMP_NAMEI_H_

Index: src/sys/sys/namei.h
diff -u src/sys/sys/namei.h:1.103.2.1 src/sys/sys/namei.h:1.103.2.2
--- src/sys/sys/namei.h:1.103.2.1	Wed Jan  8 11:02:35 2020
+++ src/sys/sys/namei.h	Tue Jan 14 11:08:01 2020
@@ -1,11 +1,11 @@
-/*	$NetBSD: namei.h,v 1.103.2.1 2020/01/08 11:02:35 ad Exp $	*/
+/*	$NetBSD: namei.h,v 1.103.2.2 2020/01/14 11:08:01 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.47.2.1 2020/01/08 11:02:16 ad Exp 
+ *   from: NetBSD: namei.src,v 1.47.2.3 2020/01/14 11:07:40 ad Exp 
  */
 
 /*
@@ -214,16 +214,18 @@ struct nameidata {
  * Field markings and their corresponding locks:
  *
  * -  stable throught the lifetime of the namecache entry
- * d  protected by nc_dvp->vi_nclock
- * l  protected by cache_list_lock
+ * d  protected by nc_dvp->vi_ncdlock
+ * v  protected by nc_dvp->vi_ncvlock
+ * l  protected by cache_lru_lock
+ * u  accesses are unlocked, no serialization applied
  */
 struct namecache {
 	struct rb_node nc_node;		/* d  red-black tree node */
 	TAILQ_ENTRY(namecache) nc_lru;	/* l  pseudo-lru chain */
-	TAILQ_ENTRY(namecache) nc_vlist;/* l  vp's list of cache entries */
+	TAILQ_ENTRY(namecache) nc_vlist;/* v  vp's list of cache entries */
 	struct	vnode *nc_dvp;		/* -  vnode of parent of name */
 	struct	vnode *nc_vp;		/* -  vnode the name refers to */
-	int	nc_hittime;		/* d  approx time of last hit */
+	int	nc_lrulist;		/* l  which LRU list its on */
 	u_short	nc_nlen;		/* -  length of name */
 	bool	nc_whiteout;		/* -  true if a whiteout */
 	char	nc_name[49];		/* -  segment name */



CVS commit: src/sys/dev

2020-01-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jan 14 09:49:26 UTC 2020

Modified Files:
src/sys/dev/mii: ipgphy.c
src/sys/dev/pci: if_stge.c if_stgereg.h

Log Message:
No functional change:

- Move some definitions from if_stgereg.h to if_stge.c again because those are
  not chip (registers or descriptors) definitions.
- Use proplib to pass information that loading DSP code is required when
  PHY reset.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/mii/ipgphy.c
cvs rdiff -u -r1.76 -r1.77 src/sys/dev/pci/if_stge.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/if_stgereg.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/mii/ipgphy.c
diff -u src/sys/dev/mii/ipgphy.c:1.8 src/sys/dev/mii/ipgphy.c:1.9
--- src/sys/dev/mii/ipgphy.c:1.8	Wed Nov 27 10:19:20 2019
+++ src/sys/dev/mii/ipgphy.c	Tue Jan 14 09:49:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipgphy.c,v 1.8 2019/11/27 10:19:20 msaitoh Exp $ */
+/*	$NetBSD: ipgphy.c,v 1.9 2020/01/14 09:49:26 msaitoh Exp $ */
 /*	$OpenBSD: ipgphy.c,v 1.19 2015/07/19 06:28:12 yuo Exp $	*/
 
 /*-
@@ -33,7 +33,7 @@
  * Driver for the IC Plus IP1000A/IP1001 10/100/1000 PHY.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipgphy.c,v 1.8 2019/11/27 10:19:20 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipgphy.c,v 1.9 2020/01/14 09:49:26 msaitoh Exp $");
 
 #include 
 #include 
@@ -41,6 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: ipgphy.c,v 1
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -51,12 +52,15 @@ __KERNEL_RCSID(0, "$NetBSD: ipgphy.c,v 1
 
 #include 
 
-#include 
-
 static int ipgphy_match(device_t, cfdata_t, void *);
 static void ipgphy_attach(device_t, device_t, void *);
 
-CFATTACH_DECL_NEW(ipgphy, sizeof(struct mii_softc),
+struct ipgphy_softc {
+	struct mii_softc sc_mii;
+	bool need_loaddspcode;
+};
+
+CFATTACH_DECL_NEW(ipgphy, sizeof(struct ipgphy_softc),
 ipgphy_match, ipgphy_attach, mii_phy_detach, mii_phy_activate);
 
 static int	ipgphy_service(struct mii_softc *, struct mii_data *, int);
@@ -89,10 +93,12 @@ ipgphy_match(device_t parent, cfdata_t m
 static void
 ipgphy_attach(device_t parent, device_t self, void *aux)
 {
-	struct mii_softc *sc = device_private(self);
+	struct ipgphy_softc *isc = device_private(self);
+	struct mii_softc *sc = >sc_mii;
 	struct mii_attach_args *ma = aux;
 	struct mii_data *mii = ma->mii_data;
 	const struct mii_phydesc *mpd;
+	prop_dictionary_t dict;
 
 	mpd = mii_phy_match(ma, ipgphys);
 	aprint_naive(": Media interface\n");
@@ -107,9 +113,14 @@ ipgphy_attach(device_t parent, device_t 
 	sc->mii_funcs = _funcs;
 	sc->mii_pdata = mii;
 	sc->mii_flags = ma->mii_flags;
-
 	sc->mii_flags |= MIIF_NOISOLATE;
 
+	if (device_is_a(parent, "stge")) {
+		dict = device_properties(parent);
+		prop_dictionary_get_bool(dict, "need_loaddspcode",
+		>need_loaddspcode);
+	}
+
 	PHY_RESET(sc);
 
 	PHY_READ(sc, MII_BMSR, >mii_capabilities);
@@ -342,6 +353,7 @@ ipgphy_mii_phy_auto(struct mii_softc *sc
 static void
 ipgphy_load_dspcode(struct mii_softc *sc)
 {
+
 	PHY_WRITE(sc, 31, 0x0001);
 	PHY_WRITE(sc, 27, 0x01e0);
 	PHY_WRITE(sc, 31, 0x0002);
@@ -356,7 +368,7 @@ ipgphy_load_dspcode(struct mii_softc *sc
 static void
 ipgphy_reset(struct mii_softc *sc)
 {
-	struct ifnet *ifp = sc->mii_pdata->mii_ifp;
+	struct ipgphy_softc *isc = device_private(sc->mii_dev);
 	uint16_t reg;
 
 	mii_phy_reset(sc);
@@ -366,10 +378,6 @@ ipgphy_reset(struct mii_softc *sc)
 	reg &= ~(BMCR_AUTOEN | BMCR_FDX);
 	PHY_WRITE(sc, MII_BMCR, reg);
 
-	if (sc->mii_mpd_model == MII_MODEL_xxICPLUS_IP1000A &&
-	strcmp(ifp->if_xname, "stge") == 0) {
-		struct stge_softc *stge_sc = ifp->if_softc;
-		if (stge_sc->sc_rev >= 0x40 && stge_sc->sc_rev <= 0x4e)
-			ipgphy_load_dspcode(sc);
-	}
+	if (isc->need_loaddspcode)
+		ipgphy_load_dspcode(sc);
 }

Index: src/sys/dev/pci/if_stge.c
diff -u src/sys/dev/pci/if_stge.c:1.76 src/sys/dev/pci/if_stge.c:1.77
--- src/sys/dev/pci/if_stge.c:1.76	Thu Jan  9 10:54:16 2020
+++ src/sys/dev/pci/if_stge.c	Tue Jan 14 09:49:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_stge.c,v 1.76 2020/01/09 10:54:16 msaitoh Exp $	*/
+/*	$NetBSD: if_stge.c,v 1.77 2020/01/14 09:49:26 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_stge.c,v 1.76 2020/01/09 10:54:16 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_stge.c,v 1.77 2020/01/14 09:49:26 msaitoh Exp $");
 
 
 #include 
@@ -76,6 +76,167 @@ __KERNEL_RCSID(0, "$NetBSD: if_stge.c,v 
 #define	STGE_VLAN_UNTAG			1
 /* #define	STGE_VLAN_CFI		1 */
 
+/*
+ * Transmit descriptor list size.
+ */
+#define	STGE_NTXDESC		256
+#define	STGE_NTXDESC_MASK	(STGE_NTXDESC - 1)
+#define	STGE_NEXTTX(x)		(((x) + 1) & STGE_NTXDESC_MASK)
+
+/*
+ * Receive descriptor list size.
+ */
+#define	STGE_NRXDESC		256
+#define	STGE_NRXDESC_MASK	(STGE_NRXDESC - 1)
+#define	STGE_NEXTRX(x)		(((x) 

CVS commit: src/share/man/man4

2020-01-14 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Jan 14 09:30:34 UTC 2020

Modified Files:
src/share/man/man4: wd.4

Log Message:
New sentence, new line.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/share/man/man4/wd.4

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

Modified files:

Index: src/share/man/man4/wd.4
diff -u src/share/man/man4/wd.4:1.22 src/share/man/man4/wd.4:1.23
--- src/share/man/man4/wd.4:1.22	Mon Jan 13 21:43:38 2020
+++ src/share/man/man4/wd.4	Tue Jan 14 09:30:34 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: wd.4,v 1.22 2020/01/13 21:43:38 jdolecek Exp $
+.\"	$NetBSD: wd.4,v 1.23 2020/01/14 09:30:34 wiz Exp $
 .\"
 .\"
 .\" Copyright (c) 1994 James A. Jegers
@@ -70,11 +70,14 @@ The following
 variables control behavior of disks attached using this driver:
 .Bl -tag -width 8n
 .It Dv hw.wdX.use_ncq
-Whether to use NCQ ATA commands for the disk. Only effective when the disk
-hardware actually claims to support NCQ. Default to true.
+Whether to use NCQ ATA commands for the disk.
+Only effective when the disk hardware actually claims to support
+NCQ.
+Default to true.
 .It Dv hw.wdX.use_ncq_prio
-Use optional NCQ priority for high-priority I/O like meta-data. Intended
-only for experimental use right now, might negatively affect performance.
+Use optional NCQ priority for high-priority I/O like meta-data.
+Intended only for experimental use right now, might negatively
+affect performance.
 This setting only has effect if
 .Dv hw.wdX.use_ncq
 is also true.
@@ -85,8 +88,8 @@ Certain
 .Tn Samsung
 .Tn 860 EVO
 SSD drives have firmware bug which causes interface CRC errors when NCQ
-ATA commands are used. For this reason NCQ is disabled for these drives
-by default.
+ATA commands are used.
+For this reason NCQ is disabled for these drives by default.
 Affected drives include, but are not limited to:
 .Pp
 .Bl -tag -width Ds -offset indent -compact