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

2021-01-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan 29 07:58:57 UTC 2021

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

Log Message:
the last_fault_code DEBUG variable is not MP safe, so don't compile it in.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/arm/arm32/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/arch/arm/arm32/fault.c
diff -u src/sys/arch/arm/arm32/fault.c:1.114 src/sys/arch/arm/arm32/fault.c:1.115
--- src/sys/arch/arm/arm32/fault.c:1.114	Fri Jan 29 06:22:05 2021
+++ src/sys/arch/arm/arm32/fault.c	Fri Jan 29 07:58:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fault.c,v 1.114 2021/01/29 06:22:05 skrll Exp $	*/
+/*	$NetBSD: fault.c,v 1.115 2021/01/29 07:58:57 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -79,9 +79,10 @@
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
+#include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.114 2021/01/29 06:22:05 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.115 2021/01/29 07:58:57 skrll Exp $");
 
 #include 
 
@@ -114,7 +115,7 @@ __KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.
 #include 
 #include 
 
-#ifdef DEBUG
+#if defined(DEBUG) && !defined(MULTIPROCESSOR)
 int last_fault_code;	/* For the benefit of pmap_fault_fixup() */
 #endif
 
@@ -451,7 +452,7 @@ data_abort_handler(trapframe_t *tf)
 	 * See if the fault is as a result of ref/mod emulation,
 	 * or domain mismatch.
 	 */
-#ifdef DEBUG
+#if defined(DEBUG) && !defined(MULTIPROCESSOR)
 	last_fault_code = fsr;
 #endif
 	if (pmap_fault_fixup(map->pmap, va, ftype, user)) {
@@ -886,7 +887,7 @@ prefetch_abort_handler(trapframe_t *tf)
 	/*
 	 * See if the pmap can handle this fault on its own...
 	 */
-#ifdef DEBUG
+#if defined(DEBUG) && !defined(MULTIPROCESSOR)
 	last_fault_code = -1;
 #endif
 	if (pmap_fault_fixup(map->pmap, va, VM_PROT_READ|VM_PROT_EXECUTE, 1)) {



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

2021-01-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan 29 07:00:28 UTC 2021

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

Log Message:
More debug


To generate a diff of this commit:
cvs rdiff -u -r1.423 -r1.424 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.423 src/sys/arch/arm/arm32/pmap.c:1.424
--- src/sys/arch/arm/arm32/pmap.c:1.423	Sun Jan 24 14:51:01 2021
+++ src/sys/arch/arm/arm32/pmap.c	Fri Jan 29 07:00:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.423 2021/01/24 14:51:01 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.424 2021/01/29 07:00:28 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -192,7 +192,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.423 2021/01/24 14:51:01 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.424 2021/01/29 07:00:28 skrll Exp $");
 
 #include 
 #include 
@@ -4423,8 +4423,8 @@ pmap_fault_fixup(pmap_t pm, vaddr_t va, 
 	pt_entry_t * const ptep = >l2b_kva[l2pte_index(va)];
 	pt_entry_t const opte = *ptep;
 	if (opte == 0 || (opte & L2_TYPE_MASK) == L2_TYPE_L) {
-		UVMHIST_LOG(maphist, " <-- done (empty pde for l1slot %#jx)",
-		l1slot, 0, 0, 0);
+		UVMHIST_LOG(maphist, " <-- done (empty pte)",
+		0, 0, 0, 0);
 		goto out;
 	}
 
@@ -4439,6 +4439,7 @@ pmap_fault_fixup(pmap_t pm, vaddr_t va, 
 #endif
 
 	pa = l2pte_pa(opte);
+	UVMHIST_LOG(maphist, " pa %#jx opte %#jx ", pa, opte, 0, 0);
 
 	if ((ftype & VM_PROT_WRITE) && !l2pte_writable_p(opte)) {
 		/*
@@ -4474,6 +4475,7 @@ pmap_fault_fixup(pmap_t pm, vaddr_t va, 
 		 */
 		if ((pv->pv_flags & PVF_WRITE) == 0) {
 			pmap_release_page_lock(md);
+			UVMHIST_LOG(maphist, " <-- done (write fault)", 0, 0, 0, 0);
 			goto out;
 		}
 



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

2021-01-28 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Jan 29 06:24:19 UTC 2021

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

Log Message:
Fix previous; sunxidrm(4) couldn't be probed on Allwinner A64 due to
trailing whitespace in compat string.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/sunxi/sunxi_drm.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_drm.c
diff -u src/sys/arch/arm/sunxi/sunxi_drm.c:1.12 src/sys/arch/arm/sunxi/sunxi_drm.c:1.13
--- src/sys/arch/arm/sunxi/sunxi_drm.c:1.12	Wed Jan 27 03:10:20 2021
+++ src/sys/arch/arm/sunxi/sunxi_drm.c	Fri Jan 29 06:24:18 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_drm.c,v 1.12 2021/01/27 03:10:20 thorpej Exp $ */
+/* $NetBSD: sunxi_drm.c,v 1.13 2021/01/29 06:24:18 rin Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_drm.c,v 1.12 2021/01/27 03:10:20 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_drm.c,v 1.13 2021/01/29 06:24:18 rin Exp $");
 
 #include 
 #include 
@@ -66,7 +66,7 @@ static TAILQ_HEAD(, sunxi_drm_endpoint) 
 
 static const struct device_compatible_entry compat_data[] = {
 	{ .compat = "allwinner,sun8i-h3-display-engine" },
-	{ .compat = "allwinner,sun50i-a64-display-engine " },
+	{ .compat = "allwinner,sun50i-a64-display-engine" },
 	DEVICE_COMPAT_EOL
 };
 



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

2021-01-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan 29 06:22:05 UTC 2021

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

Log Message:
Typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/arm/arm32/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/arch/arm/arm32/fault.c
diff -u src/sys/arch/arm/arm32/fault.c:1.113 src/sys/arch/arm/arm32/fault.c:1.114
--- src/sys/arch/arm/arm32/fault.c:1.113	Sat Jun 20 15:45:22 2020
+++ src/sys/arch/arm/arm32/fault.c	Fri Jan 29 06:22:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fault.c,v 1.113 2020/06/20 15:45:22 skrll Exp $	*/
+/*	$NetBSD: fault.c,v 1.114 2021/01/29 06:22:05 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -81,7 +81,7 @@
 #include "opt_kgdb.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.113 2020/06/20 15:45:22 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.114 2021/01/29 06:22:05 skrll Exp $");
 
 #include 
 
@@ -799,7 +799,7 @@ prefetch_abort_fixup(trapframe_t *tf)
  * If the address is invalid and we were in SVC mode then panic as
  * the kernel should never prefetch abort.
  * If the address is invalid and the page is mapped then the user process
- * does no have read permission so send it a signal.
+ * does not have read permission so send it a signal.
  * Otherwise fault the page in and try again.
  */
 void



CVS commit: src/sys/dev/pci

2021-01-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan 29 06:00:08 UTC 2021

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

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 src/sys/dev/pci/pci.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/pci.c
diff -u src/sys/dev/pci/pci.c:1.157 src/sys/dev/pci/pci.c:1.158
--- src/sys/dev/pci/pci.c:1.157	Sun Feb  2 16:30:31 2020
+++ src/sys/dev/pci/pci.c	Fri Jan 29 06:00:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci.c,v 1.157 2020/02/02 16:30:31 jmcneill Exp $	*/
+/*	$NetBSD: pci.c,v 1.158 2021/01/29 06:00:08 skrll Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1997, 1998
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.157 2020/02/02 16:30:31 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.158 2021/01/29 06:00:08 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -935,7 +935,7 @@ pci_conf_capture(pci_chipset_tag_t pc, p
 	/* For MSI */
 	if (pci_get_capability(pc, tag, PCI_CAP_MSI, , NULL) != 0) {
 		bool bit64, pvmask;
-		
+
 		pcs->msi_ctl = pci_conf_read(pc, tag, off + PCI_MSI_CTL);
 
 		bit64 = pcs->msi_ctl & PCI_MSI_CTL_64BIT_ADDR;



CVS commit: src/sys/dev/hyperv

2021-01-28 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Jan 29 04:38:49 UTC 2021

Modified Files:
src/sys/dev/hyperv: if_hvn.c

Log Message:
hvn(4): Don't wait forever.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/hyperv/if_hvn.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/hyperv/if_hvn.c
diff -u src/sys/dev/hyperv/if_hvn.c:1.19 src/sys/dev/hyperv/if_hvn.c:1.20
--- src/sys/dev/hyperv/if_hvn.c:1.19	Fri Dec 11 08:13:08 2020
+++ src/sys/dev/hyperv/if_hvn.c	Fri Jan 29 04:38:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hvn.c,v 1.19 2020/12/11 08:13:08 nonaka Exp $	*/
+/*	$NetBSD: if_hvn.c,v 1.20 2021/01/29 04:38:49 nonaka Exp $	*/
 /*	$OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.19 2020/12/11 08:13:08 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.20 2021/01/29 04:38:49 nonaka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1070,7 +1070,8 @@ hvn_nvs_cmd(struct hvn_softc *sc, void *
 			if (cold)
 delay(1000);
 			else
-tsleep(cmd, PRIBIO, "nvsout", mstohz(1));
+tsleep(cmd, PRIBIO, "nvsout",
+uimax(1, mstohz(1)));
 		} else if (rv) {
 			DPRINTF("%s: NVSP operation %u send error %d\n",
 			device_xname(sc->sc_dev), hdr->nvs_type, rv);
@@ -1095,7 +1096,7 @@ hvn_nvs_cmd(struct hvn_softc *sc, void *
 			splx(s);
 		} else
 			tsleep(sc->sc_nvsrsp, PRIBIO | PCATCH, "nvscmd",
-			mstohz(1));
+			uimax(1, mstohz(1)));
 	} while (--timo > 0 && sc->sc_nvsdone != 1);
 
 	if (timo == 0 && sc->sc_nvsdone != 1) {
@@ -1393,7 +1394,8 @@ hvn_rndis_cmd(struct hvn_softc *sc, stru
 			if (cold)
 delay(1000);
 			else
-tsleep(rc, PRIBIO, "rndisout", mstohz(1));
+tsleep(rc, PRIBIO, "rndisout",
+uimax(1, mstohz(1)));
 		} else if (rv) {
 			DPRINTF("%s: RNDIS operation %u send error %d\n",
 			device_xname(sc->sc_dev), hdr->rm_type, rv);
@@ -1422,7 +1424,8 @@ hvn_rndis_cmd(struct hvn_softc *sc, stru
 			hvn_nvs_intr(sc);
 			splx(s);
 		} else
-			tsleep(rc, PRIBIO | PCATCH, "rndiscmd", mstohz(1));
+			tsleep(rc, PRIBIO | PCATCH, "rndiscmd",
+			uimax(1, mstohz(1)));
 	} while (--timo > 0 && rc->rc_done != 1);
 
 	bus_dmamap_sync(sc->sc_dmat, rc->rc_dmap, 0, PAGE_SIZE,



CVS commit: src/sys/dev/hyperv

2021-01-28 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Jan 29 04:38:34 UTC 2021

Modified Files:
src/sys/dev/hyperv: vmbus.c

Log Message:
vmbus(4): Don't wait forever.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/hyperv/vmbus.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/hyperv/vmbus.c
diff -u src/sys/dev/hyperv/vmbus.c:1.11 src/sys/dev/hyperv/vmbus.c:1.12
--- src/sys/dev/hyperv/vmbus.c:1.11	Tue May 26 16:08:55 2020
+++ src/sys/dev/hyperv/vmbus.c	Fri Jan 29 04:38:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmbus.c,v 1.11 2020/05/26 16:08:55 nonaka Exp $	*/
+/*	$NetBSD: vmbus.c,v 1.12 2021/01/29 04:38:34 nonaka Exp $	*/
 /*	$OpenBSD: hyperv.c,v 1.43 2017/06/27 13:56:15 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.11 2020/05/26 16:08:55 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.12 2021/01/29 04:38:34 nonaka Exp $");
 
 #include 
 #include 
@@ -608,7 +608,8 @@ vmbus_start(struct vmbus_softc *sc, stru
 			hyperv_intr();
 			splx(s);
 		} else
-			tsleep(wchan, PRIBIO, wchan, mstohz(delays[i]));
+			tsleep(wchan, PRIBIO, wchan,
+			uimax(1, mstohz(delays[i] / 1000)));
 	}
 	if (status != HYPERCALL_STATUS_SUCCESS) {
 		device_printf(sc->sc_dev,



CVS commit: src/sys/dev/hyperv

2021-01-28 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Jan 29 04:38:18 UTC 2021

Modified Files:
src/sys/dev/hyperv: hvkbd.c

Log Message:
hvkbd(4): Don't wait forever.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/hyperv/hvkbd.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/hyperv/hvkbd.c
diff -u src/sys/dev/hyperv/hvkbd.c:1.6 src/sys/dev/hyperv/hvkbd.c:1.7
--- src/sys/dev/hyperv/hvkbd.c:1.6	Fri Nov 22 12:40:07 2019
+++ src/sys/dev/hyperv/hvkbd.c	Fri Jan 29 04:38:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hvkbd.c,v 1.6 2019/11/22 12:40:07 nonaka Exp $	*/
+/*	$NetBSD: hvkbd.c,v 1.7 2021/01/29 04:38:18 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2017 Microsoft Corp.
@@ -36,7 +36,7 @@
 #endif /* _KERNEL_OPT */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.6 2019/11/22 12:40:07 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.7 2021/01/29 04:38:18 nonaka Exp $");
 
 #include 
 #include 
@@ -350,7 +350,8 @@ hvkbd_connect(struct hvkbd_softc *sc)
 			hvkbd_intr(sc);
 			splx(s);
 		} else
-			tsleep(sc, PRIBIO | PCATCH, "hvkbdcon", mstohz(1));
+			tsleep(sc, PRIBIO | PCATCH, "hvkbdcon",
+			uimax(1, mstohz(1)));
 	} while (--timo > 0 && sc->sc_connected == 0);
 
 	if (timo == 0 && sc->sc_connected == 0) {



CVS commit: src/sys/dev/acpi

2021-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 29 02:26:58 UTC 2021

Modified Files:
src/sys/dev/acpi: nxpiic_acpi.c

Log Message:
Use acpi_compatible_match().


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/acpi/nxpiic_acpi.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/acpi/nxpiic_acpi.c
diff -u src/sys/dev/acpi/nxpiic_acpi.c:1.3 src/sys/dev/acpi/nxpiic_acpi.c:1.4
--- src/sys/dev/acpi/nxpiic_acpi.c:1.3	Tue Jan 26 00:19:53 2021
+++ src/sys/dev/acpi/nxpiic_acpi.c	Fri Jan 29 02:26:58 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: nxpiic_acpi.c,v 1.3 2021/01/26 00:19:53 jmcneill Exp $ */
+/* $NetBSD: nxpiic_acpi.c,v 1.4 2021/01/29 02:26:58 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nxpiic_acpi.c,v 1.3 2021/01/26 00:19:53 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nxpiic_acpi.c,v 1.4 2021/01/29 02:26:58 thorpej Exp $");
 
 #include 
 #include 
@@ -82,9 +82,9 @@ static void	nxpiic_acpi_iowr(struct moto
 CFATTACH_DECL_NEW(nxpiic_acpi, sizeof(struct nxpiic_softc),
 nxpiic_acpi_match, nxpiic_acpi_attach, NULL, NULL);
 
-static const char * const compatible[] = {
-	"NXP0001",
-	NULL
+static const struct device_compatible_entry compat_data[] = {
+	{ .compat = "NXP0001" },
+	DEVICE_COMPAT_EOL
 };
 
 static int
@@ -92,10 +92,7 @@ nxpiic_acpi_match(device_t parent, cfdat
 {
 	struct acpi_attach_args *aa = aux;
 
-	if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE)
-		return 0;
-
-	return acpi_match_hid(aa->aa_node->ad_devinfo, compatible);
+	return acpi_compatible_match(aa, compat_data);
 }
 
 static void



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

2021-01-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jan 28 19:46:54 UTC 2021

Modified Files:
src/external/bsd/libarchive/dist/tar: write.c

Log Message:
Don't try print an error message when there is none.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libarchive/dist/tar/write.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/tar/write.c
diff -u src/external/bsd/libarchive/dist/tar/write.c:1.2 src/external/bsd/libarchive/dist/tar/write.c:1.3
--- src/external/bsd/libarchive/dist/tar/write.c:1.2	Thu Jan 28 14:42:27 2021
+++ src/external/bsd/libarchive/dist/tar/write.c	Thu Jan 28 14:46:54 2021
@@ -798,7 +798,9 @@ copy_file_data_block(struct bsdtar *bsdt
 		progress += bytes_written;
 	}
 	if (r < ARCHIVE_WARN) {
-		lafe_warnc(archive_errno(a), "%s", archive_error_string(a));
+		const char *s = archive_error_string(a);
+		if (s)
+			lafe_warnc(archive_errno(a), "%s", s);
 		return (-1);
 	}
 	return (0);



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

2021-01-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jan 28 19:42:27 UTC 2021

Modified Files:
src/external/bsd/libarchive/dist/tar: write.c

Log Message:
PR/55962: Andreas Gustafsson: Some tar(1) error messages lack file name and
newline


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.5 -r1.2 src/external/bsd/libarchive/dist/tar/write.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/tar/write.c
diff -u src/external/bsd/libarchive/dist/tar/write.c:1.1.1.5 src/external/bsd/libarchive/dist/tar/write.c:1.2
--- src/external/bsd/libarchive/dist/tar/write.c:1.1.1.5	Wed Jul 24 09:50:41 2019
+++ src/external/bsd/libarchive/dist/tar/write.c	Thu Jan 28 14:42:27 2021
@@ -971,16 +971,15 @@ write_entry(struct bsdtar *bsdtar, struc
 
 	e = archive_write_header(a, entry);
 	if (e != ARCHIVE_OK) {
-		if (bsdtar->verbose > 1) {
+		if (bsdtar->verbose > 0) {
 			safe_fprintf(stderr, "a ");
 			list_item_verbose(bsdtar, stderr, entry);
 			lafe_warnc(0, ": %s", archive_error_string(a));
-		} else if (bsdtar->verbose > 0) {
+		} else {
 			lafe_warnc(0, "%s: %s",
 			archive_entry_pathname(entry),
 			archive_error_string(a));
-		} else
-			fprintf(stderr, ": %s", archive_error_string(a));
+		}
 	}
 
 	if (e == ARCHIVE_FATAL)



CVS commit: src/usr.bin/nbperf

2021-01-28 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jan 28 18:52:43 UTC 2021

Modified Files:
src/usr.bin/nbperf: graph2.c

Log Message:
Fix sanity check to match the fixed off-by-one logic in the sizing
logic.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/nbperf/graph2.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/nbperf/graph2.c
diff -u src/usr.bin/nbperf/graph2.c:1.5 src/usr.bin/nbperf/graph2.c:1.6
--- src/usr.bin/nbperf/graph2.c:1.5	Thu Jan  7 16:03:08 2021
+++ src/usr.bin/nbperf/graph2.c	Thu Jan 28 18:52:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: graph2.c,v 1.5 2021/01/07 16:03:08 joerg Exp $	*/
+/*	$NetBSD: graph2.c,v 1.6 2021/01/28 18:52:43 joerg Exp $	*/
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -36,7 +36,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: graph2.c,v 1.5 2021/01/07 16:03:08 joerg Exp $");
+__RCSID("$NetBSD: graph2.c,v 1.6 2021/01/28 18:52:43 joerg Exp $");
 
 #include 
 #include 
@@ -180,11 +180,11 @@ SIZED2(_hash)(struct nbperf *nbperf, str
 	size_t i, j;
 
 #if GRAPH_SIZE == 2
-	if (nbperf->allow_hash_fudging && (graph->v & 1) != 1)
-		errx(1, "vertex count must have lowest bit set");
+	if (nbperf->allow_hash_fudging && (graph->v & 1) != 0)
+		errx(1, "vertex count must have lowest bit clear");
 #else
-	if (nbperf->allow_hash_fudging && (graph->v & 3) != 3)
-		errx(1, "vertex count must have lowest 2 bits set");
+	if (nbperf->allow_hash_fudging && (graph->v & 3) != 0)
+		errx(1, "vertex count must have lowest 2 bits clear");
 #endif
 
 



CVS commit: src/sys/dev/wscons

2021-01-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jan 28 17:40:00 UTC 2021

Modified Files:
src/sys/dev/wscons: wsdisplay_vcons.c

Log Message:
fix logic botch from previous - if we're asked to draw the cursor somewhere
else and it's still visible we need to clear it


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/wscons/wsdisplay_vcons.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/wscons/wsdisplay_vcons.c
diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.50 src/sys/dev/wscons/wsdisplay_vcons.c:1.51
--- src/sys/dev/wscons/wsdisplay_vcons.c:1.50	Tue Jan 26 16:24:17 2021
+++ src/sys/dev/wscons/wsdisplay_vcons.c	Thu Jan 28 17:40:00 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_vcons.c,v 1.50 2021/01/26 16:24:17 macallan Exp $ */
+/*	$NetBSD: wsdisplay_vcons.c,v 1.51 2021/01/28 17:40:00 macallan Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.50 2021/01/26 16:24:17 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.51 2021/01/28 17:40:00 macallan Exp $");
 
 #include 
 #include 
@@ -1334,7 +1334,7 @@ vcons_cursor_noread(void *cookie, int on
 #endif
 	ofs = offset + ri->ri_crow * ri->ri_cols + ri->ri_ccol;
 	if ((ri->ri_flg & RI_CURSOR) && 
-	   ((scr->scr_flags & VCONS_DONT_READ) != VCONS_DONT_READ)) {
+	   (((scr->scr_flags & VCONS_DONT_READ) != VCONS_DONT_READ) || on)) {
 		scr->putchar(cookie, ri->ri_crow, ri->ri_ccol,
 		scr->scr_chars[ofs], scr->scr_attrs[ofs]);
 		ri->ri_flg &= ~RI_CURSOR;



CVS commit: src/sys/kern

2021-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 28 15:53:46 UTC 2021

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

Log Message:
In device_is_a(), handle dev or dev->dv_cfdriver being NULL.  This
makes the calling pattern:

device_is_a(device_parent(dev), "whatever")

safe.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/kern/subr_device.c

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

Modified files:

Index: src/sys/kern/subr_device.c
diff -u src/sys/kern/subr_device.c:1.3 src/sys/kern/subr_device.c:1.4
--- src/sys/kern/subr_device.c:1.3	Mon Mar  9 15:35:11 2015
+++ src/sys/kern/subr_device.c	Thu Jan 28 15:53:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_device.c,v 1.3 2015/03/09 15:35:11 pooka Exp $	*/
+/*	$NetBSD: subr_device.c,v 1.4 2021/01/28 15:53:46 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_device.c,v 1.3 2015/03/09 15:35:11 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_device.c,v 1.4 2021/01/28 15:53:46 thorpej Exp $");
 
 #include 
 #include 
@@ -176,6 +176,9 @@ device_properties(device_t dev)
 bool
 device_is_a(device_t dev, const char *dname)
 {
+	if (dev == NULL || dev->dv_cfdriver == NULL) {
+		return false;
+	}
 
 	return strcmp(dev->dv_cfdriver->cd_name, dname) == 0;
 }



CVS commit: src/sys/dev

2021-01-28 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Jan 28 15:43:13 UTC 2021

Modified Files:
src/sys/dev/pci: virtio.c virtio_pci.c virtiovar.h
src/sys/dev/virtio: virtio_mmio.c

Log Message:
Rewrite and streamline virtio device config read/write and explicitly cater
for the Aarch64-eb bus problem with Qemu. This removes lots of bus_space
`magic' and cleans up the code.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/pci/virtio.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/pci/virtio_pci.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/pci/virtiovar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/virtio/virtio_mmio.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/virtio.c
diff -u src/sys/dev/pci/virtio.c:1.44 src/sys/dev/pci/virtio.c:1.45
--- src/sys/dev/pci/virtio.c:1.44	Wed Jan 20 21:59:48 2021
+++ src/sys/dev/pci/virtio.c	Thu Jan 28 15:43:12 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtio.c,v 1.44 2021/01/20 21:59:48 reinoud Exp $	*/
+/*	$NetBSD: virtio.c,v 1.45 2021/01/28 15:43:12 reinoud Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.44 2021/01/20 21:59:48 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.45 2021/01/28 15:43:12 reinoud Exp $");
 
 #include 
 #include 
@@ -146,135 +146,245 @@ virtio_negotiate_features(struct virtio_
 	for (int i = 0; i < num; i++) \
 		printf("%02x ", bus_space_read_1(sc->sc_devcfg_iot, sc->sc_devcfg_ioh, index+i)); \
 	printf(") -> "); printf(fmt, val); printf("\n");
+#define DPRINTFR2(n, fmt, val_s, val_n) \
+	printf("%s ", n); \
+	printf("\nstream "); printf(fmt, val_s); printf(" norm "); printf(fmt, val_n); printf("\n");
 #else
 #define DPRINTFR(n, fmt, val, index, num)
+#define DPRINTFR2(n, fmt, val_s, val_n)
 #endif
 
+
 uint8_t
 virtio_read_device_config_1(struct virtio_softc *sc, int index) {
+	bus_space_tag_t	   iot = sc->sc_devcfg_iot;
+	bus_space_handle_t ioh = sc->sc_devcfg_ioh;
 	uint8_t val;
-	val = sc->sc_ops->read_dev_cfg_1(sc, index);
+
+	val = bus_space_read_1(iot, ioh, index);
+
 	DPRINTFR("read_1", "%02x", val, index, 1);
 	return val;
 }
 
 uint16_t
 virtio_read_device_config_2(struct virtio_softc *sc, int index) {
+	bus_space_tag_t	   iot = sc->sc_devcfg_iot;
+	bus_space_handle_t ioh = sc->sc_devcfg_ioh;
 	uint16_t val;
-	val = sc->sc_ops->read_dev_cfg_2(sc, index);
+
+	val = bus_space_read_2(iot, ioh, index);
+	if (BYTE_ORDER != sc->sc_bus_endian)
+		val = bswap16(val);
+
 	DPRINTFR("read_2", "%04x", val, index, 2);
+	DPRINTFR2("read_2", "%04x",
+		bus_space_read_stream_2(sc->sc_devcfg_iot, sc->sc_devcfg_ioh, index),
+		bus_space_read_2(sc->sc_devcfg_iot, sc->sc_devcfg_ioh, index));
 	return val;
 }
 
 uint32_t
 virtio_read_device_config_4(struct virtio_softc *sc, int index) {
+	bus_space_tag_t	   iot = sc->sc_devcfg_iot;
+	bus_space_handle_t ioh = sc->sc_devcfg_ioh;
 	uint32_t val;
-	val = sc->sc_ops->read_dev_cfg_4(sc, index);
+
+	val = bus_space_read_4(iot, ioh, index);
+	if (BYTE_ORDER != sc->sc_bus_endian)
+		val = bswap32(val);
+
 	DPRINTFR("read_4", "%08x", val, index, 4);
+	DPRINTFR2("read_4", "%08x",
+		bus_space_read_stream_4(sc->sc_devcfg_iot, sc->sc_devcfg_ioh, index),
+		bus_space_read_4(sc->sc_devcfg_iot, sc->sc_devcfg_ioh, index));
 	return val;
 }
 
 uint64_t
 virtio_read_device_config_8(struct virtio_softc *sc, int index) {
-	uint64_t val;
-	val = sc->sc_ops->read_dev_cfg_8(sc, index);
+	bus_space_tag_t	   iot = sc->sc_devcfg_iot;
+	bus_space_handle_t ioh = sc->sc_devcfg_ioh;
+	uint64_t val, val_0, val_1, val_l, val_h;
+
+	val_0 = bus_space_read_4(iot, ioh, index);
+	val_1 = bus_space_read_4(iot, ioh, index + 4);
+	if (BYTE_ORDER != sc->sc_bus_endian) {
+		val_l = bswap32(val_1);
+		val_h = bswap32(val_0);
+	} else {
+		val_l = val_0;
+		val_h = val_1;
+	}
+
+#ifdef AARCH64EB_PROBLEM
+	/* XXX see comment at virtio_pci.c */
+	if (sc->sc_aarch64eb_bus_problem) {
+		val_l = val_1;
+		val_h = val_0;
+	}
+#endif
+
+	val = val_h << 32;
+	val |= val_l;
+
 	DPRINTFR("read_8", "%08lx", val, index, 8);
+	DPRINTFR2("read_8 low ", "%08x",
+		bus_space_read_stream_4(sc->sc_devcfg_iot, sc->sc_devcfg_ioh, index),
+		bus_space_read_4(sc->sc_devcfg_iot, sc->sc_devcfg_ioh, index));
+	DPRINTFR2("read_8 high ", "%08x",
+		bus_space_read_stream_4(sc->sc_devcfg_iot, sc->sc_devcfg_ioh, index + 4),
+		bus_space_read_4(sc->sc_devcfg_iot, sc->sc_devcfg_ioh, index + 4));
 	return val;
 }
 
 /*
  * In the older virtio spec, device config registers are host endian. On newer
- * they are little endian. The normal logic will cater for this. However some
- * devices however explicitly state that its fields are always little endian
- * and will still need to be swapped.
+ * they are little endian. Some newer devices however explicitly specify their
+ * register to always be little endian. These fuctions cater for 

CVS commit: src/sys/dev/i2c

2021-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 28 14:57:43 UTC 2021

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

Log Message:
No need to consult ia->ia_ncompat before calling iic_compatible_lookup().


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 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.40 src/sys/dev/i2c/at24cxx.c:1.41
--- src/sys/dev/i2c/at24cxx.c:1.40	Wed Jan 27 02:29:48 2021
+++ src/sys/dev/i2c/at24cxx.c	Thu Jan 28 14:57:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: at24cxx.c,v 1.40 2021/01/27 02:29:48 thorpej Exp $	*/
+/*	$NetBSD: at24cxx.c,v 1.41 2021/01/28 14:57:43 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: at24cxx.c,v 1.40 2021/01/27 02:29:48 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at24cxx.c,v 1.41 2021/01/28 14:57:43 thorpej Exp $");
 
 #include 
 #include 
@@ -180,7 +180,7 @@ seeprom_attach(device_t parent, device_t
 	if (device_cfdata(self)->cf_flags)
 		sc->sc_size = (device_cfdata(self)->cf_flags << 7);
 
-	if (sc->sc_size <= 0 && ia->ia_ncompat > 0) {
+	if (sc->sc_size <= 0) {
 		if ((dce = iic_compatible_lookup(ia, compat_data)) != NULL)
 			sc->sc_size = dce->value;
 	}



CVS commit: src/sys/dev/i2c

2021-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 28 14:42:45 UTC 2021

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

Log Message:
Use iic_compatible_lookup() in ssdfb_i2c_attach().


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/i2c/ssdfb_i2c.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/ssdfb_i2c.c
diff -u src/sys/dev/i2c/ssdfb_i2c.c:1.8 src/sys/dev/i2c/ssdfb_i2c.c:1.9
--- src/sys/dev/i2c/ssdfb_i2c.c:1.8	Wed Jan 27 02:29:48 2021
+++ src/sys/dev/i2c/ssdfb_i2c.c	Thu Jan 28 14:42:45 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb_i2c.c,v 1.8 2021/01/27 02:29:48 thorpej Exp $ */
+/* $NetBSD: ssdfb_i2c.c,v 1.9 2021/01/28 14:42:45 thorpej Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb_i2c.c,v 1.8 2021/01/27 02:29:48 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb_i2c.c,v 1.9 2021/01/28 14:42:45 thorpej Exp $");
 
 #include 
 #include 
@@ -67,8 +67,12 @@ CFATTACH_DECL_NEW(ssdfb_iic, sizeof(stru
 ssdfb_i2c_match, ssdfb_i2c_attach, ssdfb_i2c_detach, NULL);
 
 static const struct device_compatible_entry compat_data[] = {
-	{ .compat = "solomon,ssd1306fb-i2c" },
-	{ .compat = "sino,sh1106fb-i2c" },
+	{ .compat = "solomon,ssd1306fb-i2c",
+	  .value = SSDFB_PRODUCT_SSD1306_GENERIC },
+
+	{ .compat = "sino,sh1106fb-i2c",
+	  .value = SSDFB_PRODUCT_SH1106_GENERIC },
+
 	DEVICE_COMPAT_EOL
 };
 
@@ -97,20 +101,12 @@ ssdfb_i2c_attach(device_t parent, device
 	struct cfdata *cf = device_cfdata(self);
 	struct i2c_attach_args *ia = aux;
 	int flags = cf->cf_flags;
-	int i;
 
 	if ((flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK) == SSDFB_PRODUCT_UNKNOWN) {
-		for (i = 0; i < ia->ia_ncompat; i++) {
-			if (strncmp("solomon,ssd1306", ia->ia_compat[i], 15)
-			== 0) {
-flags |= SSDFB_PRODUCT_SSD1306_GENERIC;
-break;
-			}
-			else if (strncmp("sino,sh1106", ia->ia_compat[i], 11)
-			== 0) {
-flags |= SSDFB_PRODUCT_SH1106_GENERIC;
-break;
-			}
+		const struct device_compatible_entry *dce =
+		iic_compatible_lookup(ia, compat_data);
+		if (dce != NULL) {
+			flags |= (int)dce->value;
 		}
 	}
 	if ((flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK) == SSDFB_PRODUCT_UNKNOWN)



CVS commit: src/sys/dev/i2c

2021-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 28 14:35:11 UTC 2021

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

Log Message:
Use iic_compatible_lookup() in admtemp_setflags().


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/i2c/adm1021.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/adm1021.c
diff -u src/sys/dev/i2c/adm1021.c:1.25 src/sys/dev/i2c/adm1021.c:1.26
--- src/sys/dev/i2c/adm1021.c:1.25	Wed Jan 27 02:29:48 2021
+++ src/sys/dev/i2c/adm1021.c	Thu Jan 28 14:35:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: adm1021.c,v 1.25 2021/01/27 02:29:48 thorpej Exp $ */
+/*	$NetBSD: adm1021.c,v 1.26 2021/01/28 14:35:11 thorpej Exp $ */
 /*	$OpenBSD: adm1021.c,v 1.27 2007/06/24 05:34:35 dlg Exp $	*/
 
 /*
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adm1021.c,v 1.25 2021/01/27 02:29:48 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adm1021.c,v 1.26 2021/01/28 14:35:11 thorpej Exp $");
 
 #include 
 #include 
@@ -143,11 +143,42 @@ void	admtemp_setlim_1032(struct sysmon_e
 CFATTACH_DECL_NEW(admtemp, sizeof(struct admtemp_softc),
 	admtemp_match, admtemp_attach, NULL, NULL);
 
-/* XXX: add flags for compats to admtemp_setflags() */
+struct admtemp_params {
+	const char *name;
+	int	noneg;
+	int	nolow;
+	int	ext11;
+	int	therm;
+};
+
+static const struct admtemp_params admtemp_params_max1617 = {
+	.name = "MAX1617A",
+	.noneg = 0,
+	.nolow = 0,
+	.ext11 = 0,
+	.therm = 0,
+};
+
+static const struct admtemp_params admtemp_params_max6642 = {
+	.name = "MAX6642",
+	.noneg = 0,
+	.nolow = 1,
+	.ext11 = 0,
+	.therm = 0,
+};
+
+static const struct admtemp_params admtemp_params_max6690 = {
+	.name = "MAX6690",
+	.noneg = 0,
+	.nolow = 0,
+	.ext11 = 1,
+	.therm = 0,
+};
+
 static const struct device_compatible_entry compat_data[] = {
-	{ .compat = "i2c-max1617" },
-	{ .compat = "max6642" },
-	{ .compat = "max6690" },
+	{ .compat = "i2c-max1617",	.data = _params_max1617 },
+	{ .compat = "max6642",		.data = _params_max6642 },
+	{ .compat = "max6690",		.data = _params_max6690 },
 	DEVICE_COMPAT_EOL
 };
 
@@ -203,7 +234,6 @@ admtemp_setflags(struct admtemp_softc *s
 uint8_t* comp, uint8_t *rev, char* name)
 {
 	uint8_t cmd, data, tmp;
-	int i;
 
 	*comp = 0;
 	*rev = 0;
@@ -220,24 +250,17 @@ admtemp_setflags(struct admtemp_softc *s
 	sc->sc_therm = 0;
 
 	/* Direct config */
-	for (i = 0; i < ia->ia_ncompat; i++) {
-		if (strcmp("i2c-max1617", ia->ia_compat[i]) == 0) {
-			sc->sc_noneg = 0;
-			strlcpy(name, "MAX1617A", ADMTEMP_NAMELEN);
-			return;
-		}
-		if (strcmp("max6642", ia->ia_compat[i]) == 0) {
-			sc->sc_noneg = 0;
-			sc->sc_nolow = 1;
-			strlcpy(name, "MAX6642", ADMTEMP_NAMELEN);
-			return;
-		}
-		if (strcmp("max6690", ia->ia_compat[i]) == 0) {
-			sc->sc_noneg = 0;
-			sc->sc_ext11 = 1;
-			strlcpy(name, "MAX6690", ADMTEMP_NAMELEN);
-			return;
-		}
+	const struct device_compatible_entry *dce =
+	iic_compatible_lookup(ia, compat_data);
+	if (dce != NULL) {
+		const struct admtemp_params *params = dce->data;
+
+		sc->sc_noneg = params->noneg;
+		sc->sc_nolow = params->nolow;
+		sc->sc_ext11 = params->ext11;
+		sc->sc_therm = params->therm;
+		strlcpy(name, params->name, ADMTEMP_NAMELEN);
+		return;
 	}
 
 	/* Indirect config */



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

2021-01-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jan 28 11:45:31 UTC 2021

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

Log Message:
port-arm/55957: Odroid C2 can not access eMMC card

A few changes to clock setup:
 - Disable clock while changing dividers
 - Set / clear DDR flag before changing clock
 - Adjust TX/RX/core phases


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/amlogic/mesongx_mmc.c

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

Modified files:

Index: src/sys/arch/arm/amlogic/mesongx_mmc.c
diff -u src/sys/arch/arm/amlogic/mesongx_mmc.c:1.13 src/sys/arch/arm/amlogic/mesongx_mmc.c:1.14
--- src/sys/arch/arm/amlogic/mesongx_mmc.c:1.13	Wed Jan 27 03:10:18 2021
+++ src/sys/arch/arm/amlogic/mesongx_mmc.c	Thu Jan 28 11:45:31 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: mesongx_mmc.c,v 1.13 2021/01/27 03:10:18 thorpej Exp $ */
+/* $NetBSD: mesongx_mmc.c,v 1.14 2021/01/28 11:45:31 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mesongx_mmc.c,v 1.13 2021/01/27 03:10:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mesongx_mmc.c,v 1.14 2021/01/28 11:45:31 jmcneill Exp $");
 
 #include 
 #include 
@@ -496,6 +496,17 @@ mesongx_mmc_set_clock(struct mesongx_mmc
 	if (best_diff == INT_MAX)
 		return ERANGE;
 
+	val = MMC_READ(sc, SD_EMMC_CFG);
+	val |= CFG_STOP_CLK;
+	MMC_WRITE(sc, SD_EMMC_CFG, val);
+
+	val = MMC_READ(sc, SD_EMMC_CFG);
+	if (ddr)
+		val |= CFG_DDR;
+	else
+		val &= ~CFG_DDR;
+	MMC_WRITE(sc, SD_EMMC_CFG, val);
+
 	val = MMC_READ(sc, SD_EMMC_CLOCK);
 	if (sc->sc_hwtype == MESONGX_MMC_V3)
 		val |= CLOCK_CFG_V3_ALWAYS_ON;
@@ -504,15 +515,19 @@ mesongx_mmc_set_clock(struct mesongx_mmc
 	val &= ~CLOCK_CFG_RX_PHASE;
 	val |= __SHIFTIN(0, CLOCK_CFG_RX_PHASE);
 	val &= ~CLOCK_CFG_TX_PHASE;
-	val |= __SHIFTIN(2, CLOCK_CFG_TX_PHASE);
+	val |= __SHIFTIN(0, CLOCK_CFG_TX_PHASE);
 	val &= ~CLOCK_CFG_CO_PHASE;
-	val |= __SHIFTIN(3, CLOCK_CFG_CO_PHASE);
+	val |= __SHIFTIN(2, CLOCK_CFG_CO_PHASE);
 	val &= ~CLOCK_CFG_SRC;
 	val |= __SHIFTIN(best_sel, CLOCK_CFG_SRC);
 	val &= ~CLOCK_CFG_DIV;
 	val |= __SHIFTIN(best_div, CLOCK_CFG_DIV);
 	MMC_WRITE(sc, SD_EMMC_CLOCK, val);
 
+	val = MMC_READ(sc, SD_EMMC_CFG);
+	val &= ~CFG_STOP_CLK;
+	MMC_WRITE(sc, SD_EMMC_CFG, val);
+
 	return 0;
 }
 
@@ -733,21 +748,8 @@ static int
 mesongx_mmc_bus_clock(sdmmc_chipset_handle_t sch, int freq, bool ddr)
 {
 	struct mesongx_mmc_softc * const sc = sch;
-	uint32_t val;
-	int error;
-
-	error = mesongx_mmc_set_clock(sc, freq, ddr);
-	if (error != 0)
-		return error;
-
-	val = MMC_READ(sc, SD_EMMC_CFG);
-	if (ddr)
-		val |= CFG_DDR; 
-	else
-		val &= ~CFG_DDR;
-	MMC_WRITE(sc, SD_EMMC_CFG, val);
 
-	return 0;
+	return mesongx_mmc_set_clock(sc, freq, ddr);
 }
 
 static int



CVS commit: src

2021-01-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jan 28 10:36:27 UTC 2021

Modified Files:
src: build.sh

Log Message:
Modify the generated make wrapper to avoid complaints about
non-writable OBJDIR from make (which happen a lot when cross-building
kernels re-using a makewrapper build for some other user).


To generate a diff of this commit:
cvs rdiff -u -r1.345 -r1.346 src/build.sh

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

Modified files:

Index: src/build.sh
diff -u src/build.sh:1.345 src/build.sh:1.346
--- src/build.sh:1.345	Sun Sep 20 10:29:05 2020
+++ src/build.sh	Thu Jan 28 10:36:27 2021
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#	$NetBSD: build.sh,v 1.345 2020/09/20 10:29:05 mrg Exp $
+#	$NetBSD: build.sh,v 1.346 2021/01/28 10:36:27 martin Exp $
 #
 # Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1464,6 +1464,7 @@ parseoptions()
 	export MAKEFLAGS MACHINE MACHINE_ARCH
 	setmakeenv USETOOLS "yes"
 	setmakeenv MAKEWRAPPERMACHINE "${makewrappermachine:-${MACHINE}}"
+	setmakeenv MAKE_OBJDIR_CHECK_WRITABLE no
 }
 
 # sanitycheck --
@@ -1970,7 +1971,7 @@ createmakewrapper()
 	eval cat <