CVS commit: src/sys/uvm

2024-01-14 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Jan 14 10:38:47 UTC 2024

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

Log Message:
fix DEBUG build


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/uvm/uvm_pglist.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_pglist.c
diff -u src/sys/uvm/uvm_pglist.c:1.91 src/sys/uvm/uvm_pglist.c:1.92
--- src/sys/uvm/uvm_pglist.c:1.91	Sat Jan 13 09:44:42 2024
+++ src/sys/uvm/uvm_pglist.c	Sun Jan 14 10:38:47 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pglist.c,v 1.91 2024/01/13 09:44:42 tnn Exp $	*/
+/*	$NetBSD: uvm_pglist.c,v 1.92 2024/01/14 10:38:47 tnn Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2019 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.91 2024/01/13 09:44:42 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.92 2024/01/14 10:38:47 tnn Exp $");
 
 #include 
 #include 
@@ -577,7 +577,7 @@ again:
 			 candidate, bank, psi);
 			KDASSERTMSG(cidx == candidate - uvm_physseg_get_start(psi),
 			"uvm_physseg_find(%#lx): %#"PRIxPADDR" != off %"PRIxPADDR,
-			 candidate, cidx, candidate - uvm_physseg_get_start(psi));
+			 candidate, cidx, (paddr_t)candidate - uvm_physseg_get_start(psi));
 		}
 #endif
 		if (VM_PAGE_IS_FREE(pg) == 0)



CVS commit: src/sys/uvm

2024-01-14 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Jan 14 10:38:47 UTC 2024

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

Log Message:
fix DEBUG build


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/uvm/uvm_pglist.c

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



CVS commit: src/sys/uvm

2024-01-13 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Jan 13 09:44:42 UTC 2024

Modified Files:
src/sys/uvm: uvm_pglist.c uvm_physseg.c uvm_physseg.h

Log Message:
uvm: change type of uvm_physseg.start_hint from u_int to u_long

Avoids assertion failure in uvm_pglistalloc_s_ps() with large paddrs.
PR kern/57683.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/sys/uvm/uvm_pglist.c
cvs rdiff -u -r1.19 -r1.20 src/sys/uvm/uvm_physseg.c
cvs rdiff -u -r1.8 -r1.9 src/sys/uvm/uvm_physseg.h

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



CVS commit: src/sys/uvm

2024-01-13 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Jan 13 09:44:42 UTC 2024

Modified Files:
src/sys/uvm: uvm_pglist.c uvm_physseg.c uvm_physseg.h

Log Message:
uvm: change type of uvm_physseg.start_hint from u_int to u_long

Avoids assertion failure in uvm_pglistalloc_s_ps() with large paddrs.
PR kern/57683.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/sys/uvm/uvm_pglist.c
cvs rdiff -u -r1.19 -r1.20 src/sys/uvm/uvm_physseg.c
cvs rdiff -u -r1.8 -r1.9 src/sys/uvm/uvm_physseg.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/uvm/uvm_pglist.c
diff -u src/sys/uvm/uvm_pglist.c:1.90 src/sys/uvm/uvm_pglist.c:1.91
--- src/sys/uvm/uvm_pglist.c:1.90	Tue Dec 21 08:27:49 2021
+++ src/sys/uvm/uvm_pglist.c	Sat Jan 13 09:44:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pglist.c,v 1.90 2021/12/21 08:27:49 skrll Exp $	*/
+/*	$NetBSD: uvm_pglist.c,v 1.91 2024/01/13 09:44:42 tnn Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2019 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.90 2021/12/21 08:27:49 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.91 2024/01/13 09:44:42 tnn Exp $");
 
 #include 
 #include 
@@ -112,8 +112,9 @@ static int
 uvm_pglistalloc_c_ps(uvm_physseg_t psi, int num, paddr_t low, paddr_t high,
 paddr_t alignment, paddr_t boundary, struct pglist *rlist)
 {
-	signed int candidate, limit, candidateidx, end, idx, skip;
-	int pagemask;
+	long candidate, limit, candidateidx, end, idx;
+	int skip;
+	long pagemask;
 	bool second_pass;
 #ifdef DEBUG
 	paddr_t idxpa, lastidxpa;
@@ -138,9 +139,9 @@ uvm_pglistalloc_c_ps(uvm_physseg_t psi, 
 	 * succeeded.
 	 */
 	alignment = atop(alignment);
-	candidate = roundup2(uimax(low, uvm_physseg_get_avail_start(psi) +
+	candidate = roundup2(ulmax(low, uvm_physseg_get_avail_start(psi) +
 		uvm_physseg_get_start_hint(psi)), alignment);
-	limit = uimin(high, uvm_physseg_get_avail_end(psi));
+	limit = ulmin(high, uvm_physseg_get_avail_end(psi));
 	pagemask = ~((boundary >> PAGE_SHIFT) - 1);
 	skip = 0;
 	second_pass = false;
@@ -162,8 +163,8 @@ uvm_pglistalloc_c_ps(uvm_physseg_t psi, 
 			 * is were we started.
 			 */
 			second_pass = true;
-			candidate = roundup2(uimax(low, uvm_physseg_get_avail_start(psi)), alignment);
-			limit = uimin(limit, uvm_physseg_get_avail_start(psi) +
+			candidate = roundup2(ulmax(low, uvm_physseg_get_avail_start(psi)), alignment);
+			limit = ulmin(limit, uvm_physseg_get_avail_start(psi) +
 			uvm_physseg_get_start_hint(psi));
 			skip = 0;
 			continue;
@@ -200,7 +201,7 @@ uvm_pglistalloc_c_ps(uvm_physseg_t psi, 
 		 * Found a suitable starting page.  See if the range is free.
 		 */
 #ifdef PGALLOC_VERBOSE
-		printf("%s: psi=%d candidate=%#x end=%#x skip=%#x, align=%#"PRIxPADDR,
+		printf("%s: psi=%d candidate=%#lx end=%#lx skip=%#x, align=%#"PRIxPADDR,
 		__func__, psi, candidateidx, end, skip, alignment);
 #endif
 		/*
@@ -283,7 +284,7 @@ uvm_pglistalloc_c_ps(uvm_physseg_t psi, 
 	uvm_physseg_get_avail_start(psi));
 	KASSERTMSG(uvm_physseg_get_start_hint(psi) <=
 	uvm_physseg_get_avail_end(psi) - uvm_physseg_get_avail_start(psi),
-	"%x %u (%#x) <= %#"PRIxPADDR" - %#"PRIxPADDR" (%#"PRIxPADDR")",
+	"%lx %lu (%#lx) <= %#"PRIxPADDR" - %#"PRIxPADDR" (%#"PRIxPADDR")",
 	candidate + num,
 	uvm_physseg_get_start_hint(psi), uvm_physseg_get_start_hint(psi),
 	uvm_physseg_get_avail_end(psi), uvm_physseg_get_avail_start(psi),
@@ -523,7 +524,8 @@ static int
 uvm_pglistalloc_s_ps(uvm_physseg_t psi, int num, paddr_t low, paddr_t high,
 struct pglist *rlist)
 {
-	int todo, limit, candidate;
+	int todo;
+	long limit, candidate;
 	struct vm_page *pg;
 	bool second_pass;
 #ifdef PGALLOC_VERBOSE
@@ -546,9 +548,9 @@ uvm_pglistalloc_s_ps(uvm_physseg_t psi, 
 		return -1;
 
 	todo = num;
-	candidate = uimax(low, uvm_physseg_get_avail_start(psi) +
+	candidate = ulmax(low, uvm_physseg_get_avail_start(psi) +
 	uvm_physseg_get_start_hint(psi));
-	limit = uimin(high, uvm_physseg_get_avail_end(psi));
+	limit = ulmin(high, uvm_physseg_get_avail_end(psi));
 	pg = uvm_physseg_get_pg(psi, candidate - uvm_physseg_get_start(psi));
 	second_pass = false;
 
@@ -560,8 +562,8 @@ again:
 break;
 			}
 			second_pass = true;
-			candidate = uimax(low, uvm_physseg_get_avail_start(psi));
-			limit = uimin(limit, uvm_physseg_get_avail_start(psi) +
+			candidate = ulmax(low, uvm_physseg_get_avail_start(psi));
+			limit = ulmin(limit, uvm_physseg_get_avail_start(psi) +
 			uvm_physseg_get_start_hint(psi));
 			pg = uvm_physseg_get_pg(psi, candidate - uvm_physseg_get_start(psi));
 			goto again;
@@ -571,10 +573,10 @@ again:
 			paddr_t cidx = 0;
 			const uvm_physseg_t bank = uvm_physseg_find(candidate, );
 			KDASSERTMSG(bank == psi,
-			"uvm_physseg_find(%#x) (%"PRIxPHYSSEG ") != psi %"PRIxPHYSSEG,
+			"uvm_physseg_find(%#lx) 

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

2023-11-11 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Nov 11 17:35:45 UTC 2023

Modified Files:
src/sys/arch/arm/cortex: gicv3_its.c

Log Message:
gicv3_its: assorted minor improvements

- KASSERT that the command queue is not stalled due to async error
  before issuing more commands.
- implement gits_command_int under #if 0 (useful for troubleshooting)
- protect command queue with its_lock consistently
- KASSERT for 32-bit MSI that upper bits are 0
- KASSERT return value of gicv3_its_msi_alloc_lpi
- KASSERT that safe conditions for writing to CBASER are met
- move CWRITER initialization to before CBASER
- fix alignment of tables for the 16KB page size case


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/cortex/gicv3_its.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/cortex/gicv3_its.c
diff -u src/sys/arch/arm/cortex/gicv3_its.c:1.34 src/sys/arch/arm/cortex/gicv3_its.c:1.35
--- src/sys/arch/arm/cortex/gicv3_its.c:1.34	Sun Oct 31 17:24:11 2021
+++ src/sys/arch/arm/cortex/gicv3_its.c	Sat Nov 11 17:35:45 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3_its.c,v 1.34 2021/10/31 17:24:11 skrll Exp $ */
+/* $NetBSD: gicv3_its.c,v 1.35 2023/11/11 17:35:45 tnn Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #define _INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gicv3_its.c,v 1.34 2021/10/31 17:24:11 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3_its.c,v 1.35 2023/11/11 17:35:45 tnn Exp $");
 
 #include 
 #include 
@@ -117,6 +117,11 @@ gits_command(struct gicv3_its *its, cons
 
 	cwriter = gits_read_8(its, GITS_CWRITER);
 	woff = cwriter & GITS_CWRITER_Offset;
+#ifdef DIAGNOSTIC
+	uint64_t creadr = gits_read_8(its, GITS_CREADR);
+	KASSERT(!ISSET(creadr, GITS_CREADR_Stalled));
+	KASSERT(((woff + sizeof(cmd->dw)) & (its->its_cmd.len - 1)) != (creadr & GITS_CREADR_Offset));
+#endif
 
 	uint64_t *dw = (uint64_t *)(its->its_cmd.base + woff);
 	for (int i = 0; i < __arraycount(cmd->dw); i++)
@@ -256,6 +261,26 @@ gits_command_sync(struct gicv3_its *its,
 	gits_command(its, );
 }
 
+#if 0
+static inline void
+gits_command_int(struct gicv3_its *its, uint32_t deviceid, uint32_t eventid)
+{
+	struct gicv3_its_command cmd;
+
+	/*
+	 * Translate the deviceid and eventid into an icid and pintid through
+	 * the device table and ITT. Mark the pintid as pending
+	 * on the redistributor.
+	 * If the interrupt is not configured the command queue stalls.
+	 */
+	memset(, 0, sizeof(cmd));
+	cmd.dw[0] = GITS_CMD_INT | ((uint64_t)deviceid << 32);
+	cmd.dw[1] = eventid;
+
+	gits_command(its, );
+}
+#endif
+
 static inline int
 gits_wait(struct gicv3_its *its)
 {
@@ -358,8 +383,10 @@ gicv3_its_device_map(struct gicv3_its *i
 	 * Map the device to the ITT
 	 */
 	const u_int id_bits = __SHIFTOUT(typer, GITS_TYPER_ID_bits) + 1;
+	mutex_enter(its->its_lock);
 	gits_command_mapd(its, devid, dev->dev_itt.segs[0].ds_addr, id_bits - 1, true);
 	gits_wait(its);
+	mutex_exit(its->its_lock);
 
 	return 0;
 }
@@ -391,6 +418,7 @@ gicv3_its_msi_enable(struct gicv3_its *i
 		pci_conf_write(pc, tag, off + PCI_MSI_MDATA64,
 		lpi - its->its_pic->pic_irqbase);
 	} else {
+		KASSERT((addr >> 32) == 0);
 		pci_conf_write(pc, tag, off + PCI_MSI_MADDR,
 		addr & 0x);
 		pci_conf_write(pc, tag, off + PCI_MSI_MDATA,
@@ -485,8 +513,10 @@ gicv3_its_msi_alloc(struct arm_pci_msi *
 		return NULL;
 
 	vectors = kmem_alloc(sizeof(*vectors) * *count, KM_SLEEP);
+	mutex_enter(its->its_lock);
 	for (n = 0; n < *count; n++) {
 		const int lpi = gicv3_its_msi_alloc_lpi(its, pa);
+		KASSERT(lpi >= 0);
 		vectors[n] = ARM_PCI_INTR_MSI |
 		__SHIFTIN(lpi, ARM_PCI_INTR_IRQ) |
 		__SHIFTIN(n, ARM_PCI_INTR_MSI_VEC) |
@@ -508,6 +538,7 @@ gicv3_its_msi_alloc(struct arm_pci_msi *
 		gits_command_sync(its, its->its_rdbase[cpu_index(ci)]);
 	}
 	gits_wait(its);
+	mutex_exit(its->its_lock);
 
 	return vectors;
 }
@@ -555,8 +586,10 @@ gicv3_its_msix_alloc(struct arm_pci_msi 
 	}
 
 	vectors = kmem_alloc(sizeof(*vectors) * *count, KM_SLEEP);
+	mutex_enter(its->its_lock);
 	for (n = 0; n < *count; n++) {
 		const int lpi = gicv3_its_msi_alloc_lpi(its, pa);
+		KASSERT(lpi >= 0);
 		const int msix_vec = table_indexes ? table_indexes[n] : n;
 		vectors[msix_vec] = ARM_PCI_INTR_MSIX |
 		__SHIFTIN(lpi, ARM_PCI_INTR_IRQ) |
@@ -578,6 +611,7 @@ gicv3_its_msix_alloc(struct arm_pci_msi 
 		gits_command_sync(its, its->its_rdbase[cpu_index(ci)]);
 	}
 	gits_wait(its);
+	mutex_exit(its->its_lock);
 
 	bus_space_unmap(bst, bsh, bsz);
 
@@ -638,14 +672,17 @@ gicv3_its_command_init(struct gicv3_soft
 
 	gicv3_dma_alloc(sc, >its_cmd, GITS_COMMANDS_SIZE, GITS_COMMANDS_ALIGN);
 
+	KASSERT((gits_read_4(its, GITS_CTLR) & GITS_CTLR_Enabled) == 0);
+	KASSERT((gits_read_4(its, GITS_CTLR) & GITS_CTLR_Quiescent) != 0);
+
 	cbaser = its->its_cmd.segs[0].ds_addr;
 	cbaser |= 

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

2023-11-11 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Nov 11 17:35:45 UTC 2023

Modified Files:
src/sys/arch/arm/cortex: gicv3_its.c

Log Message:
gicv3_its: assorted minor improvements

- KASSERT that the command queue is not stalled due to async error
  before issuing more commands.
- implement gits_command_int under #if 0 (useful for troubleshooting)
- protect command queue with its_lock consistently
- KASSERT for 32-bit MSI that upper bits are 0
- KASSERT return value of gicv3_its_msi_alloc_lpi
- KASSERT that safe conditions for writing to CBASER are met
- move CWRITER initialization to before CBASER
- fix alignment of tables for the 16KB page size case


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/cortex/gicv3_its.c

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



CVS commit: src/sys/external/bsd/drm2/dist/drm/radeon

2023-11-06 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Nov  6 14:33:51 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/dist/drm/radeon: radeon_bios.c

Log Message:
radeon: fix and enable ACPI methods for getting ROM BIOS

The hacky way of getting the BIOS mapped only works on x86. ACPI
should be preferred if available. Makes BIOS reading though VFCT
work on aarch64 with EDK2. (But only if EDK2 has POSTed the GPU.)

XXX amdgpu should get the same treatment.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.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_bios.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c:1.12 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c:1.13
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c:1.12	Sat May 28 01:07:47 2022
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c	Mon Nov  6 14:33:51 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeon_bios.c,v 1.12 2022/05/28 01:07:47 manu Exp $	*/
+/*	$NetBSD: radeon_bios.c,v 1.13 2023/11/06 14:33:51 tnn Exp $	*/
 
 /*
  * Copyright 2008 Advanced Micro Devices, Inc.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeon_bios.c,v 1.12 2022/05/28 01:07:47 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_bios.c,v 1.13 2023/11/06 14:33:51 tnn Exp $");
 
 #include 
 #include 
@@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: radeon_bios.
 #include "radeon_reg.h"
 
 #if defined(__NetBSD__) && NACPICA > 0
+#define CONFIG_ACPI
 #include 
 #define	_COMPONENT	ACPI_DISPLAY_COMPONENT
 ACPI_MODULE_NAME("radeon_acpi")
@@ -252,10 +253,15 @@ static bool radeon_atrm_get_bios(struct 
 	if (rdev->flags & RADEON_IS_IGP)
 		return false;
 
-	while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
 #ifdef __NetBSD__
+	pdev = rdev->pdev;
+	while (pdev != NULL) {
 		dhandle = (pdev->pd_ad ? pdev->pd_ad->ad_handle : NULL);
+		pdev = NULL;
+		if (rdev->pdev->class != PCI_CLASS_DISPLAY_VGA)
+			continue;
 #else
+	while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
 		dhandle = ACPI_HANDLE(>dev);
 #endif
 		if (!dhandle)
@@ -269,11 +275,16 @@ static bool radeon_atrm_get_bios(struct 
 	}
 
 	if (!found) {
-		while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
 #ifdef __NetBSD__
+		pdev = rdev->pdev;
+		while (pdev != NULL) {
 			dhandle = (pdev->pd_ad ? pdev->pd_ad->ad_handle
 			: NULL);
+			pdev = NULL;
+			if (rdev->pdev->class != PCI_CLASS_DISPLAY_OTHER)
+continue;
 #else
+		while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
 			dhandle = ACPI_HANDLE(>dev);
 #endif
 			if (!dhandle)



CVS commit: src/sys/external/bsd/drm2/dist/drm/radeon

2023-11-06 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Nov  6 14:33:51 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/dist/drm/radeon: radeon_bios.c

Log Message:
radeon: fix and enable ACPI methods for getting ROM BIOS

The hacky way of getting the BIOS mapped only works on x86. ACPI
should be preferred if available. Makes BIOS reading though VFCT
work on aarch64 with EDK2. (But only if EDK2 has POSTed the GPU.)

XXX amdgpu should get the same treatment.


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

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



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

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 19:13:05 UTC 2023

Modified Files:
src/sys/arch/arm/rockchip: rk3588_cru.c

Log Message:
rk3588_cru: fix clock id for BIGCORE1


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/rockchip/rk3588_cru.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/rockchip/rk3588_cru.c
diff -u src/sys/arch/arm/rockchip/rk3588_cru.c:1.1 src/sys/arch/arm/rockchip/rk3588_cru.c:1.2
--- src/sys/arch/arm/rockchip/rk3588_cru.c:1.1	Tue Aug 23 05:39:06 2022
+++ src/sys/arch/arm/rockchip/rk3588_cru.c	Tue Oct 17 19:13:05 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rk3588_cru.c,v 1.1 2022/08/23 05:39:06 ryo Exp $	*/
+/*	$NetBSD: rk3588_cru.c,v 1.2 2023/10/17 19:13:05 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2022 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk3588_cru.c,v 1.1 2022/08/23 05:39:06 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk3588_cru.c,v 1.2 2023/10/17 19:13:05 tnn Exp $");
 
 #include 
 #include 
@@ -636,7 +636,7 @@ static struct rk_cru_clk rk3588_cru_clks
 	CLKSEL_CON(BIGCORE0, 1),	/* div1_reg */
 	__BITS(4,0),		/* div1_mask */
 	armclk_b01_rates),
-	RK_CPU_CORE2(RK3588_ARMCLK_B01, "armclk_b23", mux_armclkb23_parents,
+	RK_CPU_CORE2(RK3588_ARMCLK_B23, "armclk_b23", mux_armclkb23_parents,
 	CLKSEL_CON(BIGCORE1, 0),	/* reg */
 	__BITS(7,6), 2, 1,		/* mux_mask, mux_main, mux_alt */
 	CLKSEL_CON(BIGCORE1, 0),	/* div0_reg */
@@ -673,7 +673,6 @@ static struct rk_cru_clk rk3588_cru_clks
 	"armclk_b23",
 	CLKGATE_CON(BIGCORE1, 0), 13),
 
-
 	RK_COMPOSITE(RK3588_CLK_50M_SRC, "clk_50m_src",
 	gpll_cpll_parents,
 	CLKSEL_CON(0, 0), __BITS(5,5), __BITS(4,0),



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

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 19:13:05 UTC 2023

Modified Files:
src/sys/arch/arm/rockchip: rk3588_cru.c

Log Message:
rk3588_cru: fix clock id for BIGCORE1


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/rockchip/rk3588_cru.c

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



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

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 18:23:55 UTC 2023

Modified Files:
src/sys/arch/arm/rockchip: rk3588_cru.h

Log Message:
rk3588_cru: sync clock id numbers with mainline Linux

The previous constants came from the Rockchip board support package,
but we want to be compatible with upstream device tree.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/rockchip/rk3588_cru.h

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

Modified files:

Index: src/sys/arch/arm/rockchip/rk3588_cru.h
diff -u src/sys/arch/arm/rockchip/rk3588_cru.h:1.1 src/sys/arch/arm/rockchip/rk3588_cru.h:1.2
--- src/sys/arch/arm/rockchip/rk3588_cru.h:1.1	Tue Aug 23 05:39:06 2022
+++ src/sys/arch/arm/rockchip/rk3588_cru.h	Tue Oct 17 18:23:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rk3588_cru.h,v 1.1 2022/08/23 05:39:06 ryo Exp $	*/
+/*	$NetBSD: rk3588_cru.h,v 1.2 2023/10/17 18:23:55 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2022 Ryo Shimizu 
@@ -28,727 +28,726 @@
 #ifndef _RK3588_CRU_H_
 #define _RK3588_CRU_H_
 
-#define RK3588_PLL_B0PLL			1
-#define RK3588_PLL_B1PLL			2
-#define RK3588_PLL_LPLL3
-#define RK3588_PLL_V0PLL			4
-#define RK3588_PLL_AUPLL			5
-#define RK3588_PLL_CPLL6
-#define RK3588_PLL_GPLL7
-#define RK3588_PLL_NPLL8
-#define RK3588_PLL_PPLL9
-#define RK3588_ARMCLK_L10
-#define RK3588_ARMCLK_B01			11
-#define RK3588_ARMCLK_B23			12
-/* 13 */
-/* 14 */
-/* 15 */
-/* 16 */
-/* 17 */
-/* 18 */
-/* 19 */
-#define RK3588_PCLK_BIGCORE0_ROOT		20
-#define RK3588_PCLK_BIGCORE0_PVTM		21
-#define RK3588_PCLK_BIGCORE1_ROOT		22
-#define RK3588_PCLK_BIGCORE1_PVTM		23
-#define RK3588_PCLK_DSU_S_ROOT			24
-#define RK3588_PCLK_DSU_ROOT			25
-#define RK3588_PCLK_DSU_NS_ROOT			26
-#define RK3588_PCLK_LITCORE_PVTM		27
-#define RK3588_PCLK_DBG28
-#define RK3588_PCLK_DSU29
-#define RK3588_PCLK_S_DAPLITE			30
-#define RK3588_PCLK_M_DAPLITE			31
-#define RK3588_MBIST_MCLK_PDM1			32
-#define RK3588_MBIST_CLK_ACDCDIG		33
-#define RK3588_HCLK_I2S2_2CH			34
-#define RK3588_HCLK_I2S3_2CH			35
-#define RK3588_CLK_I2S2_2CH_SRC			36
-#define RK3588_CLK_I2S2_2CH_FRAC		37
-#define RK3588_CLK_I2S2_2CH			38
-#define RK3588_MCLK_I2S2_2CH			39
-#define RK3588_I2S2_2CH_MCLKOUT			40
-#define RK3588_CLK_DAC_ACDCDIG			41
-#define RK3588_CLK_I2S3_2CH_SRC			42
-#define RK3588_CLK_I2S3_2CH_FRAC		43
-#define RK3588_CLK_I2S3_2CH			44
-#define RK3588_MCLK_I2S3_2CH			45
-#define RK3588_I2S3_2CH_MCLKOUT			46
-#define RK3588_PCLK_ACDCDIG			47
-#define RK3588_HCLK_I2S0_8CH			48
-#define RK3588_CLK_I2S0_8CH_TX_SRC		49
-#define RK3588_CLK_I2S0_8CH_TX_FRAC		50
-#define RK3588_MCLK_I2S0_8CH_TX			51
-#define RK3588_CLK_I2S0_8CH_TX			52
-#define RK3588_CLK_I2S0_8CH_RX_SRC		53
-#define RK3588_CLK_I2S0_8CH_RX_FRAC		54
-#define RK3588_MCLK_I2S0_8CH_RX			55
-#define RK3588_CLK_I2S0_8CH_RX			56
-#define RK3588_I2S0_8CH_MCLKOUT			57
-#define RK3588_HCLK_PDM1			58
-#define RK3588_MCLK_PDM1			59
-#define RK3588_HCLK_AUDIO_ROOT			60
-#define RK3588_PCLK_AUDIO_ROOT			61
-#define RK3588_HCLK_SPDIF0			62
-#define RK3588_CLK_SPDIF0_SRC			63
-#define RK3588_CLK_SPDIF0_FRAC			64
-#define RK3588_MCLK_SPDIF0			65
-#define RK3588_CLK_SPDIF0			66
-#define RK3588_CLK_SPDIF1			67
-#define RK3588_HCLK_SPDIF1			68
-#define RK3588_CLK_SPDIF1_SRC			69
-#define RK3588_CLK_SPDIF1_FRAC			70
-#define RK3588_MCLK_SPDIF1			71
-#define RK3588_ACLK_AV1_ROOT			72
-#define RK3588_ACLK_AV173
-#define RK3588_PCLK_AV1_ROOT			74
-#define RK3588_PCLK_AV175
-#define RK3588_PCLK_MAILBOX0			76
-#define RK3588_PCLK_MAILBOX1			77
-#define RK3588_PCLK_MAILBOX2			78
-#define RK3588_PCLK_PMU2			79
-#define RK3588_PCLK_PMUCM0_INTMUX		80
-#define RK3588_PCLK_DDRCM0_INTMUX		81
-#define RK3588_PCLK_TOP82
-#define RK3588_PCLK_PWM1			83
-#define RK3588_CLK_PWM184
-#define RK3588_CLK_PWM1_CAPTURE			85
-#define RK3588_PCLK_PWM2			86
-#define RK3588_CLK_PWM287
-#define RK3588_CLK_PWM2_CAPTURE			88
-#define RK3588_PCLK_PWM3			89
-#define RK3588_CLK_PWM390
-#define RK3588_CLK_PWM3_CAPTURE			91
-#define RK3588_PCLK_BUSTIMER0			92
-#define RK3588_PCLK_BUSTIMER1			93
-#define RK3588_CLK_BUS_TIMER_ROOT		94
-#define RK3588_CLK_BUSTIMER0			95
-#define RK3588_CLK_BUSTIMER1			96
-#define RK3588_CLK_BUSTIMER2			97
-#define RK3588_CLK_BUSTIMER3			98
-#define RK3588_CLK_BUSTIMER4			99
-#define RK3588_CLK_BUSTIMER5			100
-#define RK3588_CLK_BUSTIMER6			101
-#define RK3588_CLK_BUSTIMER7			102
-#define RK3588_CLK_BUSTIMER8			103
-#define RK3588_CLK_BUSTIMER9			104
-#define RK3588_CLK_BUSTIMER10			105
-#define RK3588_CLK_BUSTIMER11			106
-#define RK3588_PCLK_WDT0			107
-#define RK3588_TCLK_WDT0			108
-/* 109 */
-/* 110 */
-#define RK3588_PCLK_CAN0			111
-#define RK3588_CLK_CAN0112
-#define RK3588_PCLK_CAN1			113
-#define RK3588_CLK_CAN1114
-#define RK3588_PCLK_CAN2			115
-#define RK3588_CLK_CAN2116
-#define RK3588_ACLK_DECOM			117
-#define RK3588_PCLK_DECOM			118

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

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 18:23:55 UTC 2023

Modified Files:
src/sys/arch/arm/rockchip: rk3588_cru.h

Log Message:
rk3588_cru: sync clock id numbers with mainline Linux

The previous constants came from the Rockchip board support package,
but we want to be compatible with upstream device tree.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/rockchip/rk3588_cru.h

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



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

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 17:31:12 UTC 2023

Modified Files:
src/sys/arch/arm/rockchip: rk_gpio.c

Log Message:
rk_gpio: add support for version 2 controller

Based on PR 57597 from Johann Rudloff.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/rockchip/rk_gpio.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/rockchip/rk_gpio.c
diff -u src/sys/arch/arm/rockchip/rk_gpio.c:1.6 src/sys/arch/arm/rockchip/rk_gpio.c:1.7
--- src/sys/arch/arm/rockchip/rk_gpio.c:1.6	Tue Oct 17 15:09:18 2023
+++ src/sys/arch/arm/rockchip/rk_gpio.c	Tue Oct 17 17:31:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_gpio.c,v 1.6 2023/10/17 15:09:18 tnn Exp $ */
+/* $NetBSD: rk_gpio.c,v 1.7 2023/10/17 17:31:12 tnn Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk_gpio.c,v 1.6 2023/10/17 15:09:18 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_gpio.c,v 1.7 2023/10/17 17:31:12 tnn Exp $");
 
 #include 
 #include 
@@ -55,6 +55,26 @@ __KERNEL_RCSID(0, "$NetBSD: rk_gpio.c,v 
 #define	GPIO_PORTA_EOI_REG		0x004c
 #define	GPIO_EXT_PORTA_REG		0x0050
 #define	GPIO_LS_SYNC_REG		0x0060
+#define	GPIO_VER_ID_REG			0x0078
+#define	GPIO_VER_ID_GPIOV2		0x0101157c
+
+/*
+ * In "version 2" GPIO controllers, half of each register is used by the
+ * write_enable mask, so the 32 pins are spread over two registers.
+ *
+ * pins  0 - 15 go into the GPIO_SWPORT_*_L register
+ * pins 16 - 31 go into the GPIO_SWPORT_*_H register
+ */
+#define GPIOV2_SWPORT_DR_BASE		0x
+#define GPIOV2_SWPORT_DR_REG(pin)	\
+	(GPIOV2_SWPORT_DR_BASE + GPIOV2_REG_OFFSET(pin))
+#define	GPIOV2_SWPORT_DDR_BASE		0x0008
+#define	GPIOV2_SWPORT_DDR_REG(pin)	\
+	(GPIOV2_SWPORT_DDR_BASE + GPIOV2_REG_OFFSET(pin))
+#define	GPIOV2_EXT_PORT_REG		0x0070
+#define	GPIOV2_REG_OFFSET(pin)		(((pin) >> 4) << 2)
+#define	GPIOV2_DATA_MASK(pin)		(__BIT((pin) & 0xF))
+#define	GPIOV2_WRITE_MASK(pin)		(__BIT(((pin) & 0xF) | 0x10))
 
 static const struct device_compatible_entry compat_data[] = {
 	{ .compat = "rockchip,gpio-bank" },
@@ -223,18 +243,58 @@ rk_gpio_pin_ctl(void *priv, int pin, int
 	mutex_exit(>sc_lock);
 }
 
+static int
+rk_gpio_v2_pin_read(void *priv, int pin)
+{
+	struct rk_gpio_softc * const sc = priv;
+	uint32_t data;
+	int val;
+
+	KASSERT(pin < __arraycount(sc->sc_pins));
+
+	const uint32_t data_mask = __BIT(pin);
+
+	/* No lock required for reads */
+	data = RD4(sc, GPIOV2_EXT_PORT_REG);
+	val = __SHIFTOUT(data, data_mask);
+
+	return val;
+}
+
+static void
+rk_gpio_v2_pin_write(void *priv, int pin, int val)
+{
+	struct rk_gpio_softc * const sc = priv;
+	uint32_t data;
+
+	KASSERT(pin < __arraycount(sc->sc_pins));
+
+	const uint32_t write_mask = GPIOV2_WRITE_MASK(pin);
+
+	/* No lock required for writes on v2 controllers  */
+	data = val ? GPIOV2_DATA_MASK(pin) : 0;
+	WR4(sc, GPIOV2_SWPORT_DR_REG(pin), write_mask | data);
+}
+
+static void
+rk_gpio_v2_pin_ctl(void *priv, int pin, int flags)
+{
+	struct rk_gpio_softc * const sc = priv;
+	uint32_t ddr;
+
+	KASSERT(pin < __arraycount(sc->sc_pins));
+
+	/* No lock required for writes on v2 controllers  */
+	ddr = (flags & GPIO_PIN_OUTPUT) ? GPIOV2_DATA_MASK(pin) : 0;
+	WR4(sc, GPIOV2_SWPORT_DDR_REG(pin), GPIOV2_WRITE_MASK(pin) | ddr);
+}
+
 static void
 rk_gpio_attach_ports(struct rk_gpio_softc *sc)
 {
-	struct gpio_chipset_tag *gp = >sc_gp;
 	struct gpiobus_attach_args gba;
 	u_int pin;
 
-	gp->gp_cookie = sc;
-	gp->gp_pin_read = rk_gpio_pin_read;
-	gp->gp_pin_write = rk_gpio_pin_write;
-	gp->gp_pin_ctl = rk_gpio_pin_ctl;
-
 	for (pin = 0; pin < __arraycount(sc->sc_pins); pin++) {
 		sc->sc_pins[pin].pin_num = pin;
 		sc->sc_pins[pin].pin_caps = GPIO_PIN_INPUT | GPIO_PIN_OUTPUT;
@@ -242,7 +302,7 @@ rk_gpio_attach_ports(struct rk_gpio_soft
 	}
 
 	memset(, 0, sizeof(gba));
-	gba.gba_gc = gp;
+	gba.gba_gc = >sc_gp;
 	gba.gba_pins = sc->sc_pins;
 	gba.gba_npins = __arraycount(sc->sc_pins);
 	sc->sc_gpiodev = config_found(sc->sc_dev, , NULL, CFARGS_NONE);
@@ -260,11 +320,14 @@ static void
 rk_gpio_attach(device_t parent, device_t self, void *aux)
 {
 	struct rk_gpio_softc * const sc = device_private(self);
+	struct gpio_chipset_tag * const gp = >sc_gp;
 	struct fdt_attach_args * const faa = aux;
 	const int phandle = faa->faa_phandle;
 	struct clk *clk;
 	bus_addr_t addr;
 	bus_size_t size;
+	uint32_t ver_id;
+	int ver;
 
 	if (fdtbus_get_reg(phandle, 0, , ) != 0) {
 		aprint_error(": couldn't get registers\n");
@@ -282,10 +345,31 @@ rk_gpio_attach(device_t parent, device_t
 		aprint_error(": couldn't map registers\n");
 		return;
 	}
+
+	gp->gp_cookie = sc;
+	ver_id = RD4(sc, GPIO_VER_ID_REG);
+	switch (ver_id) {
+	case 0: /* VER_ID not implemented in v1 but reads back as 0 */
+		ver = 1;
+		gp->gp_pin_read = rk_gpio_pin_read;
+		gp->gp_pin_write = rk_gpio_pin_write;
+		gp->gp_pin_ctl = 

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

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 17:31:12 UTC 2023

Modified Files:
src/sys/arch/arm/rockchip: rk_gpio.c

Log Message:
rk_gpio: add support for version 2 controller

Based on PR 57597 from Johann Rudloff.


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

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



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

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 15:09:18 UTC 2023

Modified Files:
src/sys/arch/arm/rockchip: rk_gpio.c

Log Message:
rk_gpio: de-duplicate some code from the fdtbus accessors

Make fdtbus accessors implementation agnostic and use the chipset tag
to call into implementation code. This makes it easy to populate the
chipset tag with alternate implementation needed for v2 controllers.


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

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



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

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 15:09:18 UTC 2023

Modified Files:
src/sys/arch/arm/rockchip: rk_gpio.c

Log Message:
rk_gpio: de-duplicate some code from the fdtbus accessors

Make fdtbus accessors implementation agnostic and use the chipset tag
to call into implementation code. This makes it easy to populate the
chipset tag with alternate implementation needed for v2 controllers.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/rockchip/rk_gpio.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/rockchip/rk_gpio.c
diff -u src/sys/arch/arm/rockchip/rk_gpio.c:1.5 src/sys/arch/arm/rockchip/rk_gpio.c:1.6
--- src/sys/arch/arm/rockchip/rk_gpio.c:1.5	Sat Aug  7 16:18:45 2021
+++ src/sys/arch/arm/rockchip/rk_gpio.c	Tue Oct 17 15:09:18 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_gpio.c,v 1.5 2021/08/07 16:18:45 thorpej Exp $ */
+/* $NetBSD: rk_gpio.c,v 1.6 2023/10/17 15:09:18 tnn Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk_gpio.c,v 1.5 2021/08/07 16:18:45 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_gpio.c,v 1.6 2023/10/17 15:09:18 tnn Exp $");
 
 #include 
 #include 
@@ -90,30 +90,12 @@ static void	rk_gpio_attach(device_t, dev
 CFATTACH_DECL_NEW(rk_gpio, sizeof(struct rk_gpio_softc),
 	rk_gpio_match, rk_gpio_attach, NULL, NULL);
 
-static int
-rk_gpio_ctl(struct rk_gpio_softc *sc, u_int pin, int flags)
-{
-	uint32_t ddr;
-
-	KASSERT(mutex_owned(>sc_lock));
-
-	ddr = RD4(sc, GPIO_SWPORTA_DDR_REG);
-	if (flags & GPIO_PIN_INPUT)
-		ddr &= ~__BIT(pin);
-	else if (flags & GPIO_PIN_OUTPUT)
-		ddr |= __BIT(pin);
-	WR4(sc, GPIO_SWPORTA_DDR_REG, ddr);
-
-	return 0;
-}
-
 static void *
 rk_gpio_acquire(device_t dev, const void *data, size_t len, int flags)
 {
 	struct rk_gpio_softc * const sc = device_private(dev);
 	struct rk_gpio_pin *gpin;
 	const u_int *gpio = data;
-	int error;
 
 	if (len != 12)
 		return NULL;
@@ -124,12 +106,7 @@ rk_gpio_acquire(device_t dev, const void
 	if (pin >= __arraycount(sc->sc_pins))
 		return NULL;
 
-	mutex_enter(>sc_lock);
-	error = rk_gpio_ctl(sc, pin, flags);
-	mutex_exit(>sc_lock);
-
-	if (error != 0)
-		return NULL;
+	sc->sc_gp.gp_pin_ctl(sc, pin, flags);
 
 	gpin = kmem_zalloc(sizeof(*gpin), KM_SLEEP);
 	gpin->pin_sc = sc;
@@ -146,9 +123,9 @@ rk_gpio_release(device_t dev, void *priv
 	struct rk_gpio_softc * const sc = device_private(dev);
 	struct rk_gpio_pin *pin = priv;
 
-	mutex_enter(>sc_lock);
-	rk_gpio_ctl(pin->pin_sc, pin->pin_nr, GPIO_PIN_INPUT);
-	mutex_exit(>sc_lock);
+	KASSERT(sc == pin->pin_sc);
+
+	sc->sc_gp.gp_pin_ctl(sc, pin->pin_nr, GPIO_PIN_INPUT);
 
 	kmem_free(pin, sizeof(*pin));
 }
@@ -158,16 +135,11 @@ rk_gpio_read(device_t dev, void *priv, b
 {
 	struct rk_gpio_softc * const sc = device_private(dev);
 	struct rk_gpio_pin *pin = priv;
-	uint32_t data;
 	int val;
 
 	KASSERT(sc == pin->pin_sc);
 
-	const uint32_t data_mask = __BIT(pin->pin_nr);
-
-	/* No lock required for reads */
-	data = RD4(sc, GPIO_EXT_PORTA_REG);
-	val = __SHIFTOUT(data, data_mask);
+	val = sc->sc_gp.gp_pin_read(sc, pin->pin_nr);
 	if (!raw && pin->pin_actlo)
 		val = !val;
 
@@ -179,23 +151,13 @@ rk_gpio_write(device_t dev, void *priv, 
 {
 	struct rk_gpio_softc * const sc = device_private(dev);
 	struct rk_gpio_pin *pin = priv;
-	uint32_t data;
 
 	KASSERT(sc == pin->pin_sc);
 
-	const uint32_t data_mask = __BIT(pin->pin_nr);
-
 	if (!raw && pin->pin_actlo)
 		val = !val;
 
-	mutex_enter(>sc_lock);
-	data = RD4(sc, GPIO_SWPORTA_DR_REG);
-	if (val)
-		data |= data_mask;
-	else
-		data &= ~data_mask;
-	WR4(sc, GPIO_SWPORTA_DR_REG, data);
-	mutex_exit(>sc_lock);
+	sc->sc_gp.gp_pin_write(sc, pin->pin_nr, val);
 }
 
 static struct fdtbus_gpio_controller_func rk_gpio_funcs = {
@@ -247,11 +209,17 @@ static void
 rk_gpio_pin_ctl(void *priv, int pin, int flags)
 {
 	struct rk_gpio_softc * const sc = priv;
+	uint32_t ddr;
 
 	KASSERT(pin < __arraycount(sc->sc_pins));
 
 	mutex_enter(>sc_lock);
-	rk_gpio_ctl(sc, pin, flags);
+	ddr = RD4(sc, GPIO_SWPORTA_DDR_REG);
+	if (flags & GPIO_PIN_INPUT)
+		ddr &= ~__BIT(pin);
+	else if (flags & GPIO_PIN_OUTPUT)
+		ddr |= __BIT(pin);
+	WR4(sc, GPIO_SWPORTA_DDR_REG, ddr);
 	mutex_exit(>sc_lock);
 }
 



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

2023-09-03 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Sep  3 11:36:52 UTC 2023

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_spi.c

Log Message:
bcm2835_spi: guard against too large clock divider and clamp if necessary


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/broadcom/bcm2835_spi.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/broadcom/bcm2835_spi.c
diff -u src/sys/arch/arm/broadcom/bcm2835_spi.c:1.12 src/sys/arch/arm/broadcom/bcm2835_spi.c:1.13
--- src/sys/arch/arm/broadcom/bcm2835_spi.c:1.12	Sat May  7 07:26:27 2022
+++ src/sys/arch/arm/broadcom/bcm2835_spi.c	Sun Sep  3 11:36:52 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_spi.c,v 1.12 2022/05/07 07:26:27 skrll Exp $	*/
+/*	$NetBSD: bcm2835_spi.c,v 1.13 2023/09/03 11:36:52 tnn Exp $	*/
 
 /*
  * Copyright (c) 2012 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_spi.c,v 1.12 2022/05/07 07:26:27 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_spi.c,v 1.13 2023/09/03 11:36:52 tnn Exp $");
 
 #include 
 #include 
@@ -182,6 +182,8 @@ bcmspi_configure(void *cookie, int slave
 	clk = 2 * 25000 / speed; /* XXX 250MHz */
 	clk = (clk / 2) + (clk & 1);
 	clk = roundup(clk, 2);
+	if (clk >= 0xfffe)
+		clk = 0xfffe;
 	clk = __SHIFTIN(clk, SPI_CLK_CDIV);
 	bus_space_write_4(sc->sc_iot, sc->sc_ioh, SPI_CLK, clk);
 



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

2023-09-03 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Sep  3 11:36:52 UTC 2023

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_spi.c

Log Message:
bcm2835_spi: guard against too large clock divider and clamp if necessary


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

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



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

2023-08-18 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Aug 18 14:26:50 UTC 2023

Modified Files:
src/usr.sbin/npf/npfctl: npf_build.c

Log Message:
npfctl: adapt to new libpcap API


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/usr.sbin/npf/npfctl/npf_build.c

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



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

2023-08-18 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Aug 18 14:26:50 UTC 2023

Modified Files:
src/usr.sbin/npf/npfctl: npf_build.c

Log Message:
npfctl: adapt to new libpcap API


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/usr.sbin/npf/npfctl/npf_build.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/npf/npfctl/npf_build.c
diff -u src/usr.sbin/npf/npfctl/npf_build.c:1.55 src/usr.sbin/npf/npfctl/npf_build.c:1.56
--- src/usr.sbin/npf/npfctl/npf_build.c:1.55	Sat May 30 14:16:56 2020
+++ src/usr.sbin/npf/npfctl/npf_build.c	Fri Aug 18 14:26:50 2023
@@ -32,7 +32,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: npf_build.c,v 1.55 2020/05/30 14:16:56 rmind Exp $");
+__RCSID("$NetBSD: npf_build.c,v 1.56 2023/08/18 14:26:50 tnn Exp $");
 
 #include 
 #define	__FAVOR_BSD
@@ -530,8 +530,14 @@ npfctl_build_pcap(nl_rule_t *rl, const c
 	const size_t maxsnaplen = 64 * 1024;
 	struct bpf_program bf;
 	size_t len;
+	pcap_t *pd;
 
-	if (pcap_compile_nopcap(maxsnaplen, DLT_RAW, ,
+	pd = pcap_open_dead(DLT_RAW, maxsnaplen);
+	if (pd == NULL) {
+		err(EXIT_FAILURE, "pcap_open_dead");
+	}
+
+	if (pcap_compile(pd, ,
 	filter, 1, PCAP_NETMASK_UNKNOWN) == -1) {
 		yyerror("invalid pcap-filter(7) syntax");
 	}
@@ -542,6 +548,7 @@ npfctl_build_pcap(nl_rule_t *rl, const c
 	}
 	npfctl_dump_bpf();
 	pcap_freecode();
+	pcap_close(pd);
 }
 
 static void



CVS commit: src/usr.sbin/ndp

2023-08-18 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Aug 18 13:07:38 UTC 2023

Modified Files:
src/usr.sbin/ndp: Makefile ndp.c

Log Message:
ndp: add gmt2local() from external/bsd/tcpdump instead of reachover

It is no longer shipped with the tcpdump distribution.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/ndp/Makefile
cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/ndp/ndp.c

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



CVS commit: src/usr.sbin/ndp

2023-08-18 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Aug 18 13:07:38 UTC 2023

Modified Files:
src/usr.sbin/ndp: Makefile ndp.c

Log Message:
ndp: add gmt2local() from external/bsd/tcpdump instead of reachover

It is no longer shipped with the tcpdump distribution.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/ndp/Makefile
cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/ndp/ndp.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/ndp/Makefile
diff -u src/usr.sbin/ndp/Makefile:1.13 src/usr.sbin/ndp/Makefile:1.14
--- src/usr.sbin/ndp/Makefile:1.13	Tue Oct 10 19:30:41 2017
+++ src/usr.sbin/ndp/Makefile	Fri Aug 18 13:07:38 2023
@@ -1,18 +1,15 @@
-# $NetBSD: Makefile,v 1.13 2017/10/10 19:30:41 christos Exp $
+# $NetBSD: Makefile,v 1.14 2023/08/18 13:07:38 tnn Exp $
 
 .include 
 
 USE_FORT?=	yes	# network client
 
-TCPDUMP=	${NETBSDSRCDIR}/external/bsd/tcpdump/dist
-.PATH:		${TCPDUMP}
-
 RUMPPRG=	ndp
-SRCS=		ndp.c gmt2local.c
+SRCS=		ndp.c
 MAN=		ndp.8
 
 CPPFLAGS+=	-DINET6
-CPPFLAGS+=	-I. -I${TCPDUMP}
+CPPFLAGS+=	-I.
 
 .if (${MKRUMP} != "no")
 CPPFLAGS+= 	-DRUMP_ACTION

Index: src/usr.sbin/ndp/ndp.c
diff -u src/usr.sbin/ndp/ndp.c:1.59 src/usr.sbin/ndp/ndp.c:1.60
--- src/usr.sbin/ndp/ndp.c:1.59	Sat Nov 27 22:30:25 2021
+++ src/usr.sbin/ndp/ndp.c	Fri Aug 18 13:07:38 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ndp.c,v 1.59 2021/11/27 22:30:25 rillig Exp $	*/
+/*	$NetBSD: ndp.c,v 1.60 2023/08/18 13:07:38 tnn Exp $	*/
 /*	$KAME: ndp.c,v 1.121 2005/07/13 11:30:13 keiichi Exp $	*/
 
 /*
@@ -62,6 +62,27 @@
  */
 
 /*
+ * Copyright (c) 1997
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code distributions
+ * retain the above copyright notice and this paragraph in its entirety, (2)
+ * distributions including binary code include the above copyright notice and
+ * this paragraph in its entirety in the documentation or other materials
+ * provided with the distribution, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+/*
  * Based on:
  * "@(#) Copyright (c) 1984, 1993\n\
  *	The Regents of the University of California.  All rights reserved.\n";
@@ -105,7 +126,6 @@
 #include 
 #include 
 
-#include "gmt2local.h"
 #include "prog_ops.h"
 
 static pid_t pid;
@@ -134,6 +154,7 @@ static void ifinfo(char *, int, char **)
 static const char *sec2str(time_t);
 static char *ether_str(struct sockaddr_dl *);
 static void ts_print(const struct timeval *);
+static int32_t gmt2local(time_t t);
 
 #define NDP_F_CLEAR	1
 #define NDP_F_DELETE	2
@@ -953,3 +974,35 @@ ts_print(const struct timeval *tvp)
 	(void)printf("%02d:%02d:%02d.%06u ",
 	s / 3600, (s % 3600) / 60, s % 60, (u_int32_t)tvp->tv_usec);
 }
+
+/*
+ * Returns the difference between gmt and local time in seconds.
+ * Use gmtime() and localtime() to keep things simple.
+ */
+static int32_t
+gmt2local(time_t t)
+{
+	int dt, dir;
+	struct tm *gmt, *loc;
+	struct tm sgmt;
+
+	if (t == 0)
+		t = time(NULL);
+	gmt = 
+	*gmt = *gmtime();
+	loc = localtime();
+	dt = (loc->tm_hour - gmt->tm_hour) * 60 * 60 +
+	(loc->tm_min - gmt->tm_min) * 60;
+
+	/*
+	 * If the year or julian day is different, we span 00:00 GMT
+	 * and must add or subtract a day. Check the year first to
+	 * avoid problems when the julian day wraps.
+	 */
+	dir = loc->tm_year - gmt->tm_year;
+	if (dir == 0)
+		dir = loc->tm_yday - gmt->tm_yday;
+	dt += dir * 24 * 60 * 60;
+
+	return (dt);
+}



CVS commit: src/external/bsd/tcpdump/bin

2023-08-18 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Aug 18 12:55:50 UTC 2023

Modified Files:
src/external/bsd/tcpdump/bin: Makefile

Log Message:
tcpdump: print-medsa.c is gone


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/external/bsd/tcpdump/bin/Makefile

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/tcpdump/bin/Makefile
diff -u src/external/bsd/tcpdump/bin/Makefile:1.26 src/external/bsd/tcpdump/bin/Makefile:1.27
--- src/external/bsd/tcpdump/bin/Makefile:1.26	Thu Aug 17 20:19:39 2023
+++ src/external/bsd/tcpdump/bin/Makefile	Fri Aug 18 12:55:50 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.26 2023/08/17 20:19:39 christos Exp $	
+#	$NetBSD: Makefile,v 1.27 2023/08/18 12:55:50 tnn Exp $	
 
 WARNS?=	1	# XXX: need to cleanup later
 
@@ -101,7 +101,6 @@ print-lwapp.c \
 print-lwres.c \
 print-m3ua.c \
 print-macsec.c \
-print-medsa.c \
 print-mobile.c \
 print-mobility.c \
 print-mpcp.c \



CVS commit: src/external/bsd/tcpdump/bin

2023-08-18 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Aug 18 12:55:50 UTC 2023

Modified Files:
src/external/bsd/tcpdump/bin: Makefile

Log Message:
tcpdump: print-medsa.c is gone


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/external/bsd/tcpdump/bin/Makefile

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



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

2023-08-18 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Aug 18 12:53:04 UTC 2023

Added Files:
src/external/bsd/tcpdump/dist: ntp.h

Log Message:
tcpdump: fix mismerge (revive ntp.h)


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.3 src/external/bsd/tcpdump/dist/ntp.h

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



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

2023-08-18 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Aug 18 12:53:04 UTC 2023

Added Files:
src/external/bsd/tcpdump/dist: ntp.h

Log Message:
tcpdump: fix mismerge (revive ntp.h)


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.3 src/external/bsd/tcpdump/dist/ntp.h

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

Added files:

Index: src/external/bsd/tcpdump/dist/ntp.h
diff -u /dev/null src/external/bsd/tcpdump/dist/ntp.h:1.3
--- /dev/null	Fri Aug 18 12:53:04 2023
+++ src/external/bsd/tcpdump/dist/ntp.h	Fri Aug 18 12:53:03 2023
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code distributions
+ * retain the above copyright notice and this paragraph in its entirety, (2)
+ * distributions including binary code include the above copyright notice and
+ * this paragraph in its entirety in the documentation or other materials
+ * provided with the distribution, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#include "netdissect-stdinc.h"
+
+#include "netdissect.h"
+
+/*
+ * Structure definitions for NTP fixed point values
+ *
+ *0			  1		  2			  3
+ *0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *   |			   Integer Part			 |
+ *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *   |			   Fraction Part			 |
+ *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *
+ *0			  1		  2			  3
+ *0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *   |		  Integer Part	 |	   Fraction Part	 |
+ *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+*/
+struct l_fixedpt {
+	nd_uint32_t int_part;
+	nd_uint32_t fraction;
+};
+
+struct s_fixedpt {
+	nd_uint16_t int_part;
+	nd_uint16_t fraction;
+};
+
+void p_ntp_time(netdissect_options *, const struct l_fixedpt *);



Re: CVS commit: src/share/mk

2023-08-07 Thread Tobias Nygren
On Thu, 3 Aug 2023 23:30:31 +0900
Rin Okuyama  wrote:

> On 2023/08/03 23:23, Valery Ushakov wrote:
> > On Thu, Aug 03, 2023 at 13:33:27 +, Rin Okuyama wrote:
> > 
> >> -Wuse-after-free for GCC 12 is premature. It fires on a common idiom:
> >>
> >>newbuf = realloc(buf, size);
> >>p = newbuf + (p - buf);
> >>
> >> Let shut this up for GCC 12 (with hoping it gets improved for 13!).
> > 
> > C99 says
> > 
> > J.2  Undefined behavior
> > 
> > [#1]   The   behavior   is   undefined   in   the  following
> > circumstances:
> > [...]
> >   -- The  value of a pointer to an object whose lifetime has
> >  ended is used (6.2.4).
> > 
> > 
> > Yes, for the "obvious" implementation of pointers as addresses the
> > above idiom happens to work, but it doesn't make that idiom any less
> > UB.
> 
> Ah, I only thought about "obvious" impl. Thank you for kind
> explanation! I will revert them for now.

Hi,

Is this sort of fix acceptable for the above cases?

-Tobias

RCS file: /cvsroot/src/usr.bin/sort/files.c,v
retrieving revision 1.42
diff -p -u -r1.42 files.c
--- files.c 5 Aug 2015 07:10:03 -   1.42
+++ files.c 7 Aug 2023 21:53:45 -
@@ -199,13 +199,14 @@ seq(FILE *fp, u_char **line)
/* Long line - double size of buffer */
/* XXX: Check here for stupidly long lines */
buf_size *= 2;
+   ptrdiff_t offset = pos - buf;
new_buf = realloc(buf, buf_size);
if (!new_buf)
err(2, "realloc of linebuf to %zu bytes failed",
buf_size);
-   
+
end = new_buf + buf_size;
-   pos = new_buf + (pos - buf);
+   pos = new_buf + offset;
buf = new_buf;
}
}


CVS commit: src/usr.bin/rpcgen

2023-08-07 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  7 21:12:02 UTC 2023

Modified Files:
src/usr.bin/rpcgen: rpc_cout.c

Log Message:
rpcgen: don't pass length of source to string copy operation

Altough the prior code can't fail, GCC complains about the practice.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/rpcgen/rpc_cout.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/rpcgen/rpc_cout.c
diff -u src/usr.bin/rpcgen/rpc_cout.c:1.38 src/usr.bin/rpcgen/rpc_cout.c:1.39
--- src/usr.bin/rpcgen/rpc_cout.c:1.38	Sat Jan 23 02:33:09 2016
+++ src/usr.bin/rpcgen/rpc_cout.c	Mon Aug  7 21:12:02 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpc_cout.c,v 1.38 2016/01/23 02:33:09 dholland Exp $	*/
+/*	$NetBSD: rpc_cout.c,v 1.39 2023/08/07 21:12:02 tnn Exp $	*/
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)rpc_cout.c 1.13 89/02/22 (C) 1987 SMI";
 #else
-__RCSID("$NetBSD: rpc_cout.c,v 1.38 2016/01/23 02:33:09 dholland Exp $");
+__RCSID("$NetBSD: rpc_cout.c,v 1.39 2023/08/07 21:12:02 tnn Exp $");
 #endif
 #endif
 
@@ -186,7 +186,9 @@ print_ifopen(int indent, const char *nam
 	if (!strcmp(name, "rpcprog_t") || !strcmp(name, "rpcvers_t") ||
 	!strcmp(name, "rpcproc_t") || !strcmp(name, "rpcprot_t") ||
 	!strcmp(name, "rpcport_t") || !strcmp(name, "rpcpinline_t")) {
-		strncpy(_t_kludge, name, strlen(name) - 2);
+		strlcpy(_t_kludge, name, sizeof(_t_kludge));
+		char *underscore = strchr(_t_kludge, '_');
+		*underscore = 0;
 		name = _t_kludge;
 	}
 	tabify(fout, indent);



CVS commit: src/usr.bin/rpcgen

2023-08-07 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  7 21:12:02 UTC 2023

Modified Files:
src/usr.bin/rpcgen: rpc_cout.c

Log Message:
rpcgen: don't pass length of source to string copy operation

Altough the prior code can't fail, GCC complains about the practice.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/rpcgen/rpc_cout.c

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



CVS commit: src/usr.sbin/makemandb

2023-08-07 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  7 20:35:21 UTC 2023

Modified Files:
src/usr.sbin/makemandb: custom_apropos_tokenizer.c

Log Message:
makemakedb: don't return uninitialized token length if stemming fails


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/makemandb/custom_apropos_tokenizer.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/makemandb/custom_apropos_tokenizer.c
diff -u src/usr.sbin/makemandb/custom_apropos_tokenizer.c:1.5 src/usr.sbin/makemandb/custom_apropos_tokenizer.c:1.6
--- src/usr.sbin/makemandb/custom_apropos_tokenizer.c:1.5	Thu Aug  3 07:49:23 2023
+++ src/usr.sbin/makemandb/custom_apropos_tokenizer.c	Mon Aug  7 20:35:21 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: custom_apropos_tokenizer.c,v 1.5 2023/08/03 07:49:23 rin Exp $	*/
+/*	$NetBSD: custom_apropos_tokenizer.c,v 1.6 2023/08/07 20:35:21 tnn Exp $	*/
 /*
 ** 2006 September 30
 **
@@ -719,9 +719,9 @@ aproposPorterNext(
 
 			size_t temp;
 			int stemStatus = do_stem([iStartOffset], n, c->zToken, );
-			*pnBytes = temp;
 			if (stemStatus != SQLITE_OK)
 return stemStatus;
+			*pnBytes = temp;
 
 			*pzToken = c->zToken;
 			*piStartOffset = iStartOffset;



CVS commit: src/usr.sbin/makemandb

2023-08-07 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  7 20:35:21 UTC 2023

Modified Files:
src/usr.sbin/makemandb: custom_apropos_tokenizer.c

Log Message:
makemakedb: don't return uninitialized token length if stemming fails


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/makemandb/custom_apropos_tokenizer.c

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



CVS commit: src/usr.sbin/services_mkdb

2023-08-07 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  7 20:21:08 UTC 2023

Modified Files:
src/usr.sbin/services_mkdb: output_cdb.c

Log Message:
services_mkdb: pad argument to cdbw_output(3) to match it's prototype


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/services_mkdb/output_cdb.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/services_mkdb/output_cdb.c
diff -u src/usr.sbin/services_mkdb/output_cdb.c:1.1 src/usr.sbin/services_mkdb/output_cdb.c:1.2
--- src/usr.sbin/services_mkdb/output_cdb.c:1.1	Sun Apr 25 00:54:46 2010
+++ src/usr.sbin/services_mkdb/output_cdb.c	Mon Aug  7 20:21:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: output_cdb.c,v 1.1 2010/04/25 00:54:46 joerg Exp $	*/
+/*	$NetBSD: output_cdb.c,v 1.2 2023/08/07 20:21:08 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -143,7 +143,7 @@ cdb_close(void)
 	rv = 0;
 	serrno = errno;
 
-	if (cdbw_output(cdbw, cdbw_fd, "services(5)", NULL)) {
+	if (cdbw_output(cdbw, cdbw_fd, "services(5)\0\0\0\0", NULL)) {
 		rv = -1;
 		serrno = errno;
 	}



CVS commit: src/usr.sbin/services_mkdb

2023-08-07 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  7 20:21:08 UTC 2023

Modified Files:
src/usr.sbin/services_mkdb: output_cdb.c

Log Message:
services_mkdb: pad argument to cdbw_output(3) to match it's prototype


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/services_mkdb/output_cdb.c

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



CVS commit: src/usr.bin/tail

2023-08-07 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  7 19:11:25 UTC 2023

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

Log Message:
tail: adjust misleading indentation in macro. NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/tail/tail.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/tail/tail.c
diff -u src/usr.bin/tail/tail.c:1.20 src/usr.bin/tail/tail.c:1.21
--- src/usr.bin/tail/tail.c:1.20	Tue Mar  6 03:33:26 2018
+++ src/usr.bin/tail/tail.c	Mon Aug  7 19:11:25 2023
@@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 19
 #if 0
 static char sccsid[] = "@(#)tail.c	8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: tail.c,v 1.20 2018/03/06 03:33:26 eadler Exp $");
+__RCSID("$NetBSD: tail.c,v 1.21 2023/08/07 19:11:25 tnn Exp $");
 #endif /* not lint */
 
 #include 
@@ -94,7 +94,7 @@ main(int argc, char *argv[])
 	case '+':			\
 		if (off)		\
 			off -= (units);	\
-			style = (forward);\
+		style = (forward);	\
 		break;			\
 	case '-':			\
 		off = -off;		\



CVS commit: src/usr.bin/tail

2023-08-07 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  7 19:11:25 UTC 2023

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

Log Message:
tail: adjust misleading indentation in macro. NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/tail/tail.c

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



CVS commit: src/sys/dev/pci

2023-07-31 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Jul 31 11:24:33 UTC 2023

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

Log Message:
ahcisata: ASM106x needs EXTRA_DELAY quirk


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/pci/ahcisata_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/ahcisata_pci.c
diff -u src/sys/dev/pci/ahcisata_pci.c:1.68 src/sys/dev/pci/ahcisata_pci.c:1.69
--- src/sys/dev/pci/ahcisata_pci.c:1.68	Wed Oct 12 12:50:02 2022
+++ src/sys/dev/pci/ahcisata_pci.c	Mon Jul 31 11:24:32 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_pci.c,v 1.68 2022/10/12 12:50:02 macallan Exp $	*/
+/*	$NetBSD: ahcisata_pci.c,v 1.69 2023/07/31 11:24:32 tnn Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.68 2022/10/12 12:50:02 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.69 2023/07/31 11:24:32 tnn Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ahcisata_pci.h"
@@ -217,6 +217,8 @@ static const struct ahci_pci_quirk ahci_
 	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_SATA_AHCI,
 	AHCI_QUIRK_EXTRA_DELAY },
 	{ PCI_VENDOR_AMD, PCI_PRODUCT_AMD_FCH_SATA_D, AHCI_QUIRK_EXTRA_DELAY },
+	{ PCI_VENDOR_ASMEDIA, PCI_PRODUCT_ASMEDIA_ASM106X,
+	AHCI_QUIRK_EXTRA_DELAY },
 
 #if 0
 	/*



CVS commit: src/sys/dev/pci

2023-07-31 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Jul 31 11:24:33 UTC 2023

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

Log Message:
ahcisata: ASM106x needs EXTRA_DELAY quirk


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/pci/ahcisata_pci.c

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



CVS commit: src/sys/dev/pci

2023-07-31 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Jul 31 11:20:33 UTC 2023

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
pcidevs: regen


To generate a diff of this commit:
cvs rdiff -u -r1.1465 -r1.1466 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1464 -r1.1465 src/sys/dev/pci/pcidevs_data.h

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



CVS commit: src/sys/dev/pci

2023-07-31 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Jul 31 11:20:33 UTC 2023

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
pcidevs: regen


To generate a diff of this commit:
cvs rdiff -u -r1.1465 -r1.1466 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1464 -r1.1465 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


CVS commit: src/sys/dev/pci

2023-07-31 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Jul 31 11:18:20 UTC 2023

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
pcidevs: add ASMedia ASM106x


To generate a diff of this commit:
cvs rdiff -u -r1.1483 -r1.1484 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1483 src/sys/dev/pci/pcidevs:1.1484
--- src/sys/dev/pci/pcidevs:1.1483	Fri Jul 28 02:26:58 2023
+++ src/sys/dev/pci/pcidevs	Mon Jul 31 11:18:20 2023
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1483 2023/07/28 02:26:58 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1484 2023/07/31 11:18:20 tnn Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -1510,6 +1510,7 @@ product ASMEDIA ASM1061_01	0x0601	ASM106
 product ASMEDIA ASM1061_02	0x0602	ASM1061 AHCI SATA III Controller
 product ASMEDIA ASM1061_11	0x0611	ASM1061 AHCI SATA III Controller
 product ASMEDIA ASM1061_12	0x0612	ASM1061 AHCI SATA III Controller
+product ASMEDIA ASM106X		0x0625	ASM106x AHCI SATA III Controller
 product	ASMEDIA	ASM1042		0x1042	ASM1042 USB 3.0 Host Controller
 product ASMEDIA ASM1083		0x1080	ASM1083/1085 PCIe-PCI Bridge
 product	ASMEDIA	ASM1042A	0x1142	ASM1042A USB 3.0 Host Controller



CVS commit: src/sys/dev/pci

2023-07-31 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Jul 31 11:18:20 UTC 2023

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
pcidevs: add ASMedia ASM106x


To generate a diff of this commit:
cvs rdiff -u -r1.1483 -r1.1484 src/sys/dev/pci/pcidevs

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



Re: CVS commit: src

2023-07-30 Thread Tobias Nygren
On Fri, 28 Jul 2023 14:19:02 -0400
"Christos Zoulas"  wrote:

> Log Message:
> Add epoll(2) from Theodore Preduta as part of GSoC 2023

The manual page mentions EPOLL_CLOEXEC is supported, but this
flag is not defined in any header nor used in any code.
So is it really supported?

Absence of this flag makes devel/libevent from pkgsrc fail to build --
but should it really use epoll in the first place or should
we change it to prefer kqueue when both are available?


CVS commit: src/external/mpl/dhcp/dist/common

2023-07-27 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Jul 27 10:32:25 UTC 2023

Modified Files:
src/external/mpl/dhcp/dist/common: dispatch.c

Log Message:
dhcpd: move isc_event_free() before isc_timer_destroy() in timer cb

isc_timerevent_destroy() called by isc_event_free() expects to be able to
hold the timer lock, so must run before the timer is destroyed.
PR misc/57491.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/mpl/dhcp/dist/common/dispatch.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/mpl/dhcp/dist/common/dispatch.c
diff -u src/external/mpl/dhcp/dist/common/dispatch.c:1.4 src/external/mpl/dhcp/dist/common/dispatch.c:1.5
--- src/external/mpl/dhcp/dist/common/dispatch.c:1.4	Tue Jun 27 09:10:25 2023
+++ src/external/mpl/dhcp/dist/common/dispatch.c	Thu Jul 27 10:32:25 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: dispatch.c,v 1.4 2023/06/27 09:10:25 martin Exp $	*/
+/*	$NetBSD: dispatch.c,v 1.5 2023/07/27 10:32:25 tnn Exp $	*/
 
 /* dispatch.c
 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: dispatch.c,v 1.4 2023/06/27 09:10:25 martin Exp $");
+__RCSID("$NetBSD: dispatch.c,v 1.5 2023/07/27 10:32:25 tnn Exp $");
 
 #include "dhcpd.h"
 
@@ -183,6 +183,7 @@ isclib_timer_callback(isc_task_t  *taskp
 			(*q->unref) (>what, MDL);
 		}
 		q->next = free_timeouts;
+		isc_event_free();
 		isc_timer_destroy(>isc_timeout);
 		free_timeouts = q;
 	} else {
@@ -192,9 +193,9 @@ isclib_timer_callback(isc_task_t  *taskp
 		 * don't try to - may change this to a log_fatal
 		 */
 		log_error("Error finding timer structure");
+		isc_event_free();
 	}
 
-	isc_event_free();
 	return;
 }
 



CVS commit: src/external/mpl/dhcp/dist/common

2023-07-27 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Jul 27 10:32:25 UTC 2023

Modified Files:
src/external/mpl/dhcp/dist/common: dispatch.c

Log Message:
dhcpd: move isc_event_free() before isc_timer_destroy() in timer cb

isc_timerevent_destroy() called by isc_event_free() expects to be able to
hold the timer lock, so must run before the timer is destroyed.
PR misc/57491.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/mpl/dhcp/dist/common/dispatch.c

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



Re: CVS commit: xsrc/external/mit/xorg-cf-files/dist

2023-01-18 Thread Tobias Nygren
On Tue, 17 Jan 2023 17:37:01 +0300
Valery Ushakov  wrote:

> On Tue, Jan 17, 2023 at 05:37:05 +, matthew green wrote:
> 
> > Module Name:xsrc
> > Committed By:   mrg
> > Date:   Tue Jan 17 05:37:05 UTC 2023
> > 
> > Modified Files:
> > xsrc/external/mit/xorg-cf-files/dist: Imake.tmpl
> > 
> > Log Message:
> > pull over fix from pkgsrc xorg-cf-files and avoid ar's "l" flag.
> 
> That doesn't seem to handle all the cases where "l" flag is used
> (ArAddCmd, ArExtCmd).
> 
> Might be easier to either define HasLargeTmp which seems to be *the*
> knob to control "l" flag to ar to begin with, or to factor out the
> test for "supports l flag" so that the unwieldy 
> 
>   SystemV4 || LinuxBinUtilsMajorVersion || defined(NetBSDArchitecture)
> 
> is not repeated multiple times.

In interest of reducing the diff to upstream I would suggest to use
their fix and if that is not sufficient we should talk to them.

https://gitlab.freedesktop.org/xorg/util/cf/-/commit/90b66dc73deb9ef303690370395cf831425547c7


CVS commit: src/sys/modules/amdgpu

2022-07-29 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Jul 30 03:29:52 UTC 2022

Modified Files:
src/sys/modules/amdgpu: Makefile

Log Message:
COPTS -> CWARNFLAGS


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/modules/amdgpu/Makefile

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

Modified files:

Index: src/sys/modules/amdgpu/Makefile
diff -u src/sys/modules/amdgpu/Makefile:1.4 src/sys/modules/amdgpu/Makefile:1.5
--- src/sys/modules/amdgpu/Makefile:1.4	Sat Jul 30 03:26:45 2022
+++ src/sys/modules/amdgpu/Makefile	Sat Jul 30 03:29:52 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2022/07/30 03:26:45 tnn Exp $
+# $NetBSD: Makefile,v 1.5 2022/07/30 03:29:52 tnn Exp $
 
 .include "../Makefile.inc"
 .include "../drmkms/Makefile.inc"
@@ -57,8 +57,8 @@ CWARNFLAGS.amdgpu_process_pptables_v1_0.
 CWARNFLAGS.amdgpu_rn_clk_mgr.c+=	-Wno-type-limits
 CWARNFLAGS.amdgpu_vega10_reg_init.c+=	-Wno-cast-qual
 CWARNFLAGS.amdgpu_vega20_reg_init.c+=	-Wno-cast-qual
-COPTS.amdgpu_uvd.c+=	-Wno-format
-COPTS.amdgpu_vcn.c+=	-Wno-format
+CWARNFLAGS.amdgpu_uvd.c+=	-Wno-format
+CWARNFLAGS.amdgpu_vcn.c+=	-Wno-format
 COPTS.amdgpu_dcn10_resource.c+=	${COPTS.amdgpu_float}
 COPTS.amdgpu_dcn20_resource.c+=	${COPTS.amdgpu_float}
 COPTS.amdgpu_dcn21_resource.c+=	${COPTS.amdgpu_float}



CVS commit: src/sys/modules/amdgpu

2022-07-29 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Jul 30 03:29:52 UTC 2022

Modified Files:
src/sys/modules/amdgpu: Makefile

Log Message:
COPTS -> CWARNFLAGS


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/modules/amdgpu/Makefile

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



CVS commit: src/sys/modules/amdgpu

2022-07-29 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Jul 30 03:26:45 UTC 2022

Modified Files:
src/sys/modules/amdgpu: Makefile

Log Message:
amdgpu: add some more CWARNFLAGS to appease clang

XXX backport this change to files.amdgpu


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/modules/amdgpu/Makefile

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

Modified files:

Index: src/sys/modules/amdgpu/Makefile
diff -u src/sys/modules/amdgpu/Makefile:1.3 src/sys/modules/amdgpu/Makefile:1.4
--- src/sys/modules/amdgpu/Makefile:1.3	Sat Jul 30 03:12:00 2022
+++ src/sys/modules/amdgpu/Makefile	Sat Jul 30 03:26:45 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2022/07/30 03:12:00 tnn Exp $
+# $NetBSD: Makefile,v 1.4 2022/07/30 03:26:45 tnn Exp $
 
 .include "../Makefile.inc"
 .include "../drmkms/Makefile.inc"
@@ -46,14 +46,19 @@ CWARNFLAGS+=	-Wno-override-init
 
 # sed -ne 's,^makeoptions	amdgpu	"\([^"]*\.c\)"+="\(.*\)",\1+=	\2,gp' 

CVS commit: src/sys/modules/amdgpu

2022-07-29 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Jul 30 03:26:45 UTC 2022

Modified Files:
src/sys/modules/amdgpu: Makefile

Log Message:
amdgpu: add some more CWARNFLAGS to appease clang

XXX backport this change to files.amdgpu


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/modules/amdgpu/Makefile

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



CVS commit: src/sys/modules/amdgpu

2022-07-29 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Jul 30 03:12:00 UTC 2022

Modified Files:
src/sys/modules/amdgpu: Makefile

Log Message:
amdgpu: don't set -mhard-float for clang

clang complains that the option has no effect and it generates hard
float instructions without the option. soft-float not really supported
on x86_64 with clang from what I can tell.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/modules/amdgpu/Makefile

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

Modified files:

Index: src/sys/modules/amdgpu/Makefile
diff -u src/sys/modules/amdgpu/Makefile:1.2 src/sys/modules/amdgpu/Makefile:1.3
--- src/sys/modules/amdgpu/Makefile:1.2	Sun Jul 24 20:05:00 2022
+++ src/sys/modules/amdgpu/Makefile	Sat Jul 30 03:12:00 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2022/07/24 20:05:00 riastradh Exp $
+# $NetBSD: Makefile,v 1.3 2022/07/30 03:12:00 tnn Exp $
 
 .include "../Makefile.inc"
 .include "../drmkms/Makefile.inc"
@@ -10,7 +10,7 @@ MKLDSCRIPT=yes
 WARNS=	3
 
 .if ${MACHINE_ARCH} == "x86_64"
-COPTS.amdgpu_float+=	-mhard-float -msse -msse2
+COPTS.amdgpu_float+=	${${ACTIVE_CC} == "gcc" :? -mhard-float :} -msse -msse2
 .elif !empty(MACHINE_ARCH:Maarch64*)
 COPTS.amdgpu_float+=	-march=armv8-a
 .endif



CVS commit: src/sys/modules/amdgpu

2022-07-29 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Jul 30 03:12:00 UTC 2022

Modified Files:
src/sys/modules/amdgpu: Makefile

Log Message:
amdgpu: don't set -mhard-float for clang

clang complains that the option has no effect and it generates hard
float instructions without the option. soft-float not really supported
on x86_64 with clang from what I can tell.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/modules/amdgpu/Makefile

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



CVS commit: src/sys/external/bsd/drm2/drm

2022-05-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun May 22 00:10:56 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/drm: files.drmkms

Log Message:
rename CONFIG_AARCH64 to CONFIG_ARM64 which is what upstream code expects


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/external/bsd/drm2/drm/files.drmkms

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



CVS commit: src/sys/external/bsd/drm2/drm

2022-05-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun May 22 00:10:56 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/drm: files.drmkms

Log Message:
rename CONFIG_AARCH64 to CONFIG_ARM64 which is what upstream code expects


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/external/bsd/drm2/drm/files.drmkms

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/drm/files.drmkms
diff -u src/sys/external/bsd/drm2/drm/files.drmkms:1.72 src/sys/external/bsd/drm2/drm/files.drmkms:1.73
--- src/sys/external/bsd/drm2/drm/files.drmkms:1.72	Tue Dec 21 12:55:23 2021
+++ src/sys/external/bsd/drm2/drm/files.drmkms	Sun May 22 00:10:56 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: files.drmkms,v 1.72 2021/12/21 12:55:23 tnn Exp $
+#	$NetBSD: files.drmkms,v 1.73 2022/05/22 00:10:56 tnn Exp $
 
 version	20180827
 
@@ -39,7 +39,7 @@ makeoptions	drmkms	CPPFLAGS+="-DCONFIG_X
 elifdef arm
 makeoptions	drmkms	CPPFLAGS+="-DCONFIG_ARM"
 elifdef aarch64
-makeoptions	drmkms	CPPFLAGS+="-DCONFIG_AARCH64"
+makeoptions	drmkms	CPPFLAGS+="-DCONFIG_ARM64"
 endif
 
 makeoptions	drmkms	CPPFLAGS+="-DCONFIG_BACKLIGHT_CLASS_DEVICE=0"



CVS commit: src/sys/external/bsd/drm2/dist/include/drm

2022-05-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat May 21 23:42:13 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/include/drm: drm_cache.h

Log Message:
drm_cache.h: fix a merge error

this reverts revision 1.3 which should have been reverted when it got
introduced by upstream through revision 1.5.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/sys/external/bsd/drm2/dist/include/drm/drm_cache.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/external/bsd/drm2/dist/include/drm/drm_cache.h
diff -u src/sys/external/bsd/drm2/dist/include/drm/drm_cache.h:1.10 src/sys/external/bsd/drm2/dist/include/drm/drm_cache.h:1.11
--- src/sys/external/bsd/drm2/dist/include/drm/drm_cache.h:1.10	Sun Dec 19 11:33:30 2021
+++ src/sys/external/bsd/drm2/dist/include/drm/drm_cache.h	Sat May 21 23:42:13 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_cache.h,v 1.10 2021/12/19 11:33:30 riastradh Exp $	*/
+/*	$NetBSD: drm_cache.h,v 1.11 2022/05/21 23:42:13 tnn Exp $	*/
 
 /**
  *
@@ -69,8 +69,6 @@ static inline bool drm_arch_can_wc_memor
 	 * optimization entirely for ARM and arm64.
 	 */
 	return false;
-#elif defined(CONFIG_ARM) || defined(CONFIG_ARM64)
-	return false;
 #else
 	return true;
 #endif



CVS commit: src/sys/external/bsd/drm2/dist/include/drm

2022-05-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat May 21 23:42:13 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/include/drm: drm_cache.h

Log Message:
drm_cache.h: fix a merge error

this reverts revision 1.3 which should have been reverted when it got
introduced by upstream through revision 1.5.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/sys/external/bsd/drm2/dist/include/drm/drm_cache.h

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



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

2022-05-13 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri May 13 19:34:47 UTC 2022

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

Log Message:
nvmm_x86_vmx.c: remove an #ifdef DIAGNOSTIC, it is wrong since r1.66


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/dev/nvmm/x86/nvmm_x86_vmx.c

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

Modified files:

Index: src/sys/dev/nvmm/x86/nvmm_x86_vmx.c
diff -u src/sys/dev/nvmm/x86/nvmm_x86_vmx.c:1.82 src/sys/dev/nvmm/x86/nvmm_x86_vmx.c:1.83
--- src/sys/dev/nvmm/x86/nvmm_x86_vmx.c:1.82	Fri Mar 26 15:59:53 2021
+++ src/sys/dev/nvmm/x86/nvmm_x86_vmx.c	Fri May 13 19:34:47 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86_vmx.c,v 1.82 2021/03/26 15:59:53 reinoud Exp $	*/
+/*	$NetBSD: nvmm_x86_vmx.c,v 1.83 2022/05/13 19:34:47 tnn Exp $	*/
 
 /*
  * Copyright (c) 2018-2020 Maxime Villard, m00nbsd.net
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.82 2021/03/26 15:59:53 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.83 2022/05/13 19:34:47 tnn Exp $");
 
 #include 
 #include 
@@ -134,7 +134,6 @@ vmx_vmwrite(uint64_t field, uint64_t val
 	);
 }
 
-#ifdef DIAGNOSTIC
 static inline paddr_t
 vmx_vmptrst(void)
 {
@@ -149,7 +148,6 @@ vmx_vmptrst(void)
 
 	return pa;
 }
-#endif
 
 static inline void
 vmx_vmptrld(paddr_t *pa)



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

2022-05-13 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri May 13 19:34:47 UTC 2022

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

Log Message:
nvmm_x86_vmx.c: remove an #ifdef DIAGNOSTIC, it is wrong since r1.66


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/dev/nvmm/x86/nvmm_x86_vmx.c

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



CVS commit: src/lib/libedit

2022-04-11 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Apr 11 19:37:20 UTC 2022

Modified Files:
src/lib/libedit: chartype.h

Log Message:
libedit/chartype.h: portability fix for OSF/1


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/lib/libedit/chartype.h

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

Modified files:

Index: src/lib/libedit/chartype.h
diff -u src/lib/libedit/chartype.h:1.36 src/lib/libedit/chartype.h:1.37
--- src/lib/libedit/chartype.h:1.36	Sun Sep 15 21:09:11 2019
+++ src/lib/libedit/chartype.h	Mon Apr 11 19:37:20 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: chartype.h,v 1.36 2019/09/15 21:09:11 christos Exp $	*/
+/*	$NetBSD: chartype.h,v 1.37 2022/04/11 19:37:20 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -35,6 +35,7 @@
  * been around since 2001... */
 #if	!defined(__NetBSD__) && \
 	!defined(__sun) && \
+	!defined(__osf__) && \
 	!(defined(__APPLE__) && defined(__MACH__)) && \
 	!defined(__OpenBSD__) && \
 	!defined(__FreeBSD__) && \



CVS commit: src/lib/libedit

2022-04-11 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Apr 11 19:37:20 UTC 2022

Modified Files:
src/lib/libedit: chartype.h

Log Message:
libedit/chartype.h: portability fix for OSF/1


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/lib/libedit/chartype.h

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



Re: CVS commit: src/lib/libc/time

2022-03-25 Thread Tobias Nygren
On Sat, 26 Mar 2022 00:31:45 +0100
Roland Illig  wrote:

> >> localtime.c: add back storage class 'register'
> >>
> >> This reduces the differences to the upstream code.
> >
> > I don't know why you did that. It is as simple to sed -e 's/register //g'
> > in upstream when you diff. Adding register is useless; these days it is
> > mostly ignored by compilers, except you can't &...
> 
> I thought that having a small diff to the upstream code was more
> important than a few saved keywords.  If I was wrong, I can of course
> revert it.

Can we keep it as-is, but #define register to empty at the top of the file?



CVS commit: src/sys/dev/ic

2022-03-25 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Mar 25 23:16:04 UTC 2022

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

Log Message:
dwhdmi: properly initialize connector atomic helper funcs (PR port-evbarm/56766)


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/dw_hdmi.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/dw_hdmi.c
diff -u src/sys/dev/ic/dw_hdmi.c:1.9 src/sys/dev/ic/dw_hdmi.c:1.10
--- src/sys/dev/ic/dw_hdmi.c:1.9	Sun Dec 19 11:01:11 2021
+++ src/sys/dev/ic/dw_hdmi.c	Fri Mar 25 23:16:04 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: dw_hdmi.c,v 1.9 2021/12/19 11:01:11 riastradh Exp $ */
+/* $NetBSD: dw_hdmi.c,v 1.10 2022/03/25 23:16:04 tnn Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dw_hdmi.c,v 1.9 2021/12/19 11:01:11 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dw_hdmi.c,v 1.10 2022/03/25 23:16:04 tnn Exp $");
 
 #include 
 #include 
@@ -47,6 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: dw_hdmi.c,v 
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -570,6 +571,9 @@ static const struct drm_connector_funcs 
 	.detect = dwhdmi_connector_detect,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = dwhdmi_connector_destroy,
+	.reset = drm_atomic_helper_connector_reset,
+	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static int



CVS commit: src/sys/dev/ic

2022-03-25 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Mar 25 23:16:04 UTC 2022

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

Log Message:
dwhdmi: properly initialize connector atomic helper funcs (PR port-evbarm/56766)


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/dw_hdmi.c

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



Re: CVS commit: src/lib/libc/time

2022-03-23 Thread Tobias Nygren
On Tue, 22 Mar 2022 13:48:39 -0400
Christos Zoulas  wrote:

> Modified Files:
>   src/lib/libc/time: CONTRIBUTING Makefile NEWS localtime.c private.h
>   theory.html tz-link.html tzselect.8 tzselect.ksh version zdump.c
>   zic.c
> 
> Log Message:
> welcome to tzcode-2022a

Hi,

I think this commit broke something.
date(1) no longer reports a time zone and is stuck at GMT time:

$ ls -l /etc/localtime
lrwxr-xr-x  1 root  wheel  36 Mar 22 08:47 /etc/localtime -> 
/usr/share/zoneinfo/Europe/Stockholm
$ date
Wed Mar 23 12:57:40  2022
$ TZ=CET date
Wed Mar 23 12:57:44  2022
$ TZ=foo date
Wed Mar 23 12:57:48 GMT 2022

Kind regards,
-Tobias


Re: CVS commit: src/lib/libc/stdlib

2022-03-12 Thread Tobias Nygren
On Sat, 12 Mar 2022 08:26:01 +
Nia Alarie  wrote:

> Module Name:  src
> Committed By: nia
> Date: Sat Mar 12 08:26:01 UTC 2022
> 
> Modified Files:
>   src/lib/libc/stdlib: hcreate.c
> 
> Log Message:
> hcreate(3): use reallocarr instead of malloc(x * y)

Caution: malloc(0) and reallocarr(, 0, s) have different semantics
for the returned pointer value.



CVS commit: src/sys/kern

2022-02-06 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Feb  6 19:29:52 UTC 2022

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

Log Message:
move attribute before function declarator


To generate a diff of this commit:
cvs rdiff -u -r1.294 -r1.295 src/sys/kern/subr_autoconf.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_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.294 src/sys/kern/subr_autoconf.c:1.295
--- src/sys/kern/subr_autoconf.c:1.294	Sun Feb  6 11:56:00 2022
+++ src/sys/kern/subr_autoconf.c	Sun Feb  6 19:29:52 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.294 2022/02/06 11:56:00 martin Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.295 2022/02/06 19:29:52 tnn Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.294 2022/02/06 11:56:00 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.295 2022/02/06 19:29:52 tnn Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -838,8 +838,8 @@ cfdriver_get_iattr(const struct cfdriver
 	return 0;
 }
 
-static int
-cfdriver_iattr_count(const struct cfdriver *cd) __diagused
+static int __diagused
+cfdriver_iattr_count(const struct cfdriver *cd)
 {
 	const struct cfiattrdata * const *cpp;
 	int i;



CVS commit: src/sys/kern

2022-02-06 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Feb  6 19:29:52 UTC 2022

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

Log Message:
move attribute before function declarator


To generate a diff of this commit:
cvs rdiff -u -r1.294 -r1.295 src/sys/kern/subr_autoconf.c

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



Re: CVS commit: src/sys/kern

2022-02-05 Thread Tobias Nygren
On Sat, 5 Feb 2022 15:17:40 +
Martin Husemann  wrote:

> Modified Files:
>   src/sys/kern: subr_autoconf.c
> 
> Log Message:
> cfdriver_iattr_count() is only used in a KASSERT, so #ifdef DIAGNOSTIC it.

This doesn't seem to work as intended.
In a kernel with "no options DIAGNOSTIC" I now get:

/work/src/sys/kern/subr_autoconf.c: In function 'config_search_internal':
/work/src/sys/kern/subr_autoconf.c:1149:3: error: implicit declaration of 
function 'cfdriver_iattr_count' [-Werror=implicit-function-declaration]
 1149 |   cfdriver_iattr_count(parent->dv_cfdriver) < 2);
  |   ^~~~
/work/src/sys/lib/libkern/libkern.h:279:42: note: in definition of macro 
'KASSERT'
  279 | #define KASSERT(e)  ((void)sizeof((long)(e)))


CVS commit: src/lib/librefuse

2022-01-28 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Jan 29 00:03:42 UTC 2022

Modified Files:
src/lib/librefuse: refuse_log.c

Log Message:
librefuse: default_log_func is __printflike


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/librefuse/refuse_log.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/librefuse/refuse_log.c
diff -u src/lib/librefuse/refuse_log.c:1.1 src/lib/librefuse/refuse_log.c:1.2
--- src/lib/librefuse/refuse_log.c:1.1	Sat Jan 22 07:39:22 2022
+++ src/lib/librefuse/refuse_log.c	Sat Jan 29 00:03:41 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: refuse_log.c,v 1.1 2022/01/22 07:39:22 pho Exp $ */
+/* $NetBSD: refuse_log.c,v 1.2 2022/01/29 00:03:41 tnn Exp $ */
 
 /*
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if !defined(lint)
-__RCSID("$NetBSD: refuse_log.c,v 1.1 2022/01/22 07:39:22 pho Exp $");
+__RCSID("$NetBSD: refuse_log.c,v 1.2 2022/01/29 00:03:41 tnn Exp $");
 #endif /* !lint */
 
 #include 
@@ -41,7 +41,7 @@ __RCSID("$NetBSD: refuse_log.c,v 1.1 202
 #endif
 #include 
 
-static void
+static void  __printflike(2, 0)
 default_log_func(enum fuse_log_level level __attribute__((__unused__)),
  const char *fmt, va_list ap) {
 /* This function needs to be thread-safe. Calling vfprintf(3)



CVS commit: src/lib/librefuse

2022-01-28 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Jan 29 00:03:42 UTC 2022

Modified Files:
src/lib/librefuse: refuse_log.c

Log Message:
librefuse: default_log_func is __printflike


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/librefuse/refuse_log.c

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



CVS commit: src/lib/libedit/readline

2022-01-14 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Jan 14 12:48:31 UTC 2022

Modified Files:
src/lib/libedit/readline: readline.h

Log Message:
libedit: rl_message: annotate __printflike


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/lib/libedit/readline/readline.h

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



CVS commit: src/lib/libedit/readline

2022-01-14 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Jan 14 12:48:31 UTC 2022

Modified Files:
src/lib/libedit/readline: readline.h

Log Message:
libedit: rl_message: annotate __printflike


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/lib/libedit/readline/readline.h

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

Modified files:

Index: src/lib/libedit/readline/readline.h
diff -u src/lib/libedit/readline/readline.h:1.48 src/lib/libedit/readline/readline.h:1.49
--- src/lib/libedit/readline/readline.h:1.48	Tue Jan 11 18:30:15 2022
+++ src/lib/libedit/readline/readline.h	Fri Jan 14 12:48:30 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: readline.h,v 1.48 2022/01/11 18:30:15 christos Exp $	*/
+/*	$NetBSD: readline.h,v 1.49 2022/01/14 12:48:30 tnn Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -229,7 +229,7 @@ int		 rl_crlf(void);
 int		 rl_ding(void);
 char 		*rl_copy_text(int, int);
 void		 rl_replace_line(const char *, int);
-void 		 rl_message(const char *format, ...);
+void 		 rl_message(const char *format, ...) __printflike(1, 2);
 void		 rl_save_prompt(void);
 void		 rl_restore_prompt(void);
 



CVS commit: src/sys/dev/pci

2022-01-08 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Jan  8 12:59:34 UTC 2022

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

Log Message:
place additional parens around multiline string constant to appease clang


To generate a diff of this commit:
cvs rdiff -u -r1.238 -r1.239 src/sys/dev/pci/pci_subr.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_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.238 src/sys/dev/pci/pci_subr.c:1.239
--- src/sys/dev/pci/pci_subr.c:1.238	Fri Jan  7 06:57:57 2022
+++ src/sys/dev/pci/pci_subr.c	Sat Jan  8 12:59:34 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.238 2022/01/07 06:57:57 msaitoh Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.239 2022/01/08 12:59:34 tnn Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.238 2022/01/07 06:57:57 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.239 2022/01/08 12:59:34 tnn Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -4369,8 +4369,8 @@ pci_conf_print_pl16g_cap(const pcireg_t 
 }
 
 static const char * const pcie_receive_number_dp[] = {
-	[0] = "Broadcast "
-	"(Downstream Port Receiver and all Retimer Pseudo Port Receiver)",
+	[0] = ("Broadcast "
+	"(Downstream Port Receiver and all Retimer Pseudo Port Receiver)"),
 	[1] =  "Rx(A) (Downstream Port Receiver)",
 	[2] = "Rx(B) (Retimer X or Z Upstream Pseudo Port Receiver)",
 	[3] = "Rx(C) (Retimer X or Z Downstream Pseudo Port Receiver)",



CVS commit: src/sys/dev/pci

2022-01-08 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Jan  8 12:59:34 UTC 2022

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

Log Message:
place additional parens around multiline string constant to appease clang


To generate a diff of this commit:
cvs rdiff -u -r1.238 -r1.239 src/sys/dev/pci/pci_subr.c

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



Re: CVS commit: src

2021-12-30 Thread Tobias Nygren
On Fri, 31 Dec 2021 01:44:19 +0900
Ryo ONODERA  wrote:

> #  link  LOCKDEBUG/netbsd
> /usr/world/9.99/amd64/tools/bin/x86_64--netbsd-ld -Map netbsd.map --cref -T 
> netbsd.ldscript -Ttext 0x8020 -e start -z max-page-size=0x20 
> -X -o netbsd ${SYSTEM_OBJ:[@]:Nswapnetbsd.o} ${EXTRA_OBJ} vers.o swapnetbsd.o
> NetBSD 9.99.93 (LOCKDEBUG) #0: Fri Dec 31 01:31:35 JST 2021
>textdata bss dec hex filename
> 21646842 728976 1368064 2374388216a4d8a netbsd
> + mv -f netbsd netbsd.gdb
> + /usr/world/9.99/amd64/tools/bin/x86_64--netbsd-objcopy --only-keep-debug 
> netbsd.gdb netbsd-/usr/src/sys/arch/amd64/conf/LOCKDEBUG.debug
> /usr/world/9.99/amd64/tools/bin/x86_64--netbsd-objcopy: 
> netbsd-/usr/src/sys/arch/amd64/conf/LOCKDEBUG.debug: No such file or directory

Hi,

Changing ${KERNEL_BUILD} to ${KERNEL_BUILD:T} mostly fixes the
above problem. But this change is still incompatible with MKUNPRIVED:

aarch64--netbsd-install: 
/work/src/../obj/destdir.evbarm/usr/libdata/debug/netbsd-GENERIC.lx2k.debug.inst.xOfGh2:
 chown/chgrp: Operation not permitted

Additionally, it produces new noisy output that does not respect
MAKEVERBOSE level 0 or 1 in the final link stage.

-Tobias





CVS commit: src/sys/external/bsd/drm2/radeon

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 13:56:58 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/radeon: files.radeon

Log Message:
files.radeon: add clang -Wno-format for radeon_uvd.c

int vs. short mismatch in UVD firmware version printf.
Also change some makeoptions conditional copypasta i915drmkms -> radeon.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/external/bsd/drm2/radeon/files.radeon

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/radeon/files.radeon
diff -u src/sys/external/bsd/drm2/radeon/files.radeon:1.35 src/sys/external/bsd/drm2/radeon/files.radeon:1.36
--- src/sys/external/bsd/drm2/radeon/files.radeon:1.35	Sun Dec 19 10:55:37 2021
+++ src/sys/external/bsd/drm2/radeon/files.radeon	Tue Dec 21 13:56:58 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.radeon,v 1.35 2021/12/19 10:55:37 riastradh Exp $
+#	$NetBSD: files.radeon,v 1.36 2021/12/21 13:56:58 tnn Exp $
 
 version	20180827
 
@@ -34,10 +34,11 @@ makeoptions	radeon	"CWARNFLAGS.radeon"+=
 
 makeoptions	radeon	"CWARNFLAGS.radeon"+="${${ACTIVE_CC} == gcc:? -Wno-maybe-uninitialized :}"
 
-#makeoptions 	i915drmkms 	"CWARNFLAGS.radeon_cs.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}"
-makeoptions 	i915drmkms 	"CWARNFLAGS.radeon_evergreen_cs.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}"
-makeoptions 	i915drmkms 	"CWARNFLAGS.radeon_r300.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}"
-makeoptions 	i915drmkms 	"CWARNFLAGS.radeon_r420.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}"
+#makeoptions 	radeon 	"CWARNFLAGS.radeon_cs.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}"
+makeoptions 	radeon 	"CWARNFLAGS.radeon_evergreen_cs.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}"
+makeoptions 	radeon 	"CWARNFLAGS.radeon_r300.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}"
+makeoptions 	radeon 	"CWARNFLAGS.radeon_r420.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}"
+makeoptions	radeon	"CWARNFLAGS.radeon_uvd.c"+="${${ACTIVE_CC} == clang:? -Wno-format :}"
 
 file	external/bsd/drm2/radeon/radeon_module.c		radeon
 file	external/bsd/drm2/radeon/radeon_pci.c			radeon



CVS commit: src/sys/external/bsd/drm2/radeon

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 13:56:58 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/radeon: files.radeon

Log Message:
files.radeon: add clang -Wno-format for radeon_uvd.c

int vs. short mismatch in UVD firmware version printf.
Also change some makeoptions conditional copypasta i915drmkms -> radeon.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/external/bsd/drm2/radeon/files.radeon

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



CVS commit: src/sys/external/bsd/drm2

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 12:55:24 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/drm: files.drmkms
src/sys/external/bsd/drm2/i915drm: files.i915drmkms
src/sys/external/bsd/drm2/nouveau: files.nouveau

Log Message:
drm: sprinkle some -Wno-unused-function for clang

915_sw_fence.c: for debug_fence_init_onstack
drm_mm.c: for rb_hole_size_to_node
intel_hdmi.c: for intel_hdmi_hdcp2_protocol
intel_guc_submission.c: for rq_prio
nouveau_nvkm_subdev_instmem_base.c: for fake_ioread32_native
nouveau_nvkm_subdev_mmu_vmmnv04.c: for nv04_vmm_pgt_pte


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/external/bsd/drm2/drm/files.drmkms
cvs rdiff -u -r1.84 -r1.85 src/sys/external/bsd/drm2/i915drm/files.i915drmkms
cvs rdiff -u -r1.36 -r1.37 src/sys/external/bsd/drm2/nouveau/files.nouveau

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



CVS commit: src/sys/external/bsd/drm2

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 12:55:24 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/drm: files.drmkms
src/sys/external/bsd/drm2/i915drm: files.i915drmkms
src/sys/external/bsd/drm2/nouveau: files.nouveau

Log Message:
drm: sprinkle some -Wno-unused-function for clang

915_sw_fence.c: for debug_fence_init_onstack
drm_mm.c: for rb_hole_size_to_node
intel_hdmi.c: for intel_hdmi_hdcp2_protocol
intel_guc_submission.c: for rq_prio
nouveau_nvkm_subdev_instmem_base.c: for fake_ioread32_native
nouveau_nvkm_subdev_mmu_vmmnv04.c: for nv04_vmm_pgt_pte


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/external/bsd/drm2/drm/files.drmkms
cvs rdiff -u -r1.84 -r1.85 src/sys/external/bsd/drm2/i915drm/files.i915drmkms
cvs rdiff -u -r1.36 -r1.37 src/sys/external/bsd/drm2/nouveau/files.nouveau

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/drm/files.drmkms
diff -u src/sys/external/bsd/drm2/drm/files.drmkms:1.71 src/sys/external/bsd/drm2/drm/files.drmkms:1.72
--- src/sys/external/bsd/drm2/drm/files.drmkms:1.71	Sun Dec 19 12:39:48 2021
+++ src/sys/external/bsd/drm2/drm/files.drmkms	Tue Dec 21 12:55:23 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.drmkms,v 1.71 2021/12/19 12:39:48 riastradh Exp $
+#	$NetBSD: files.drmkms,v 1.72 2021/12/21 12:55:23 tnn Exp $
 
 version	20180827
 
@@ -79,6 +79,7 @@ makeoptions 	drmkms 	"CWARNFLAGS.drm_dp_
 makeoptions 	drmkms 	"CWARNFLAGS.drm_fb_helper.c"+="-Wno-shadow"
 makeoptions 	drmkms 	"CWARNFLAGS.drm_edid.c"+="-Wno-shadow"
 makeoptions 	drmkms 	"CWARNFLAGS.drm_ioctl.c"+="-Wno-shadow"
+makeoptions	drmkms	"CWARNFLAGS.drm_mm.c"+="${${ACTIVE_CC} == clang :? -Wno-unused-function :}"
 makeoptions 	drmkms 	"CWARNFLAGS.drm_modes.c"+="-Wno-shadow"
 
 # Legacy user-mode setting

Index: src/sys/external/bsd/drm2/i915drm/files.i915drmkms
diff -u src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.84 src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.85
--- src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.84	Sun Dec 19 11:57:42 2021
+++ src/sys/external/bsd/drm2/i915drm/files.i915drmkms	Tue Dec 21 12:55:23 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i915drmkms,v 1.84 2021/12/19 11:57:42 riastradh Exp $
+#	$NetBSD: files.i915drmkms,v 1.85 2021/12/21 12:55:23 tnn Exp $
 
 version	20180827
 
@@ -45,11 +45,14 @@ makeoptions	i915drmkms	"CWARNFLAGS.i915d
 
 makeoptions 	i915drmkms 	"CWARNFLAGS.i915_pci.c"+="${${ACTIVE_CC} == gcc:? -Wno-override-init :}"
 makeoptions 	i915drmkms 	"CWARNFLAGS.i915_pci.c"+="${${ACTIVE_CC} == clang:? -Wno-initializer-overrides :}"
+makeoptions	i915drmkms	"CWARNFLAGS.i915_sw_fence.c"+="${${ACTIVE_CC} == clang :? -Wno-unused-function :}"
 
 makeoptions 	i915drmkms 	"CWARNFLAGS.intel_sprite.c"+="${${ACTIVE_CC} == gcc:? -Wno-maybe-uninitialized :}"
 
 makeoptions 	i915drmkms 	"CWARNFLAGS.intel_ddi.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 10:? -Wno-maybe-uninitialized :} ${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-implicit-fallthrough :}"
 makeoptions 	i915drmkms 	"CWARNFLAGS.intel_display.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-implicit-fallthrough :}"
+makeoptions	i915drmkms	"CWARNFLAGS.intel_guc_submission.c"+="${${ACTIVE_CC} == clang :? -Wno-unused-function :}"
+makeoptions	i915drmkms	"CWARNFLAGS.intel_hdmi.c"+="${${ACTIVE_CC} == clang :? -Wno-unused-function :}"
 makeoptions 	i915drmkms 	"CWARNFLAGS.intel_sdvo.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-implicit-fallthrough :}"
 
 makeoptions	intelfb		"CPPFLAGS.intelfb"+="${CPPFLAGS.i915drmkms}"

Index: src/sys/external/bsd/drm2/nouveau/files.nouveau
diff -u src/sys/external/bsd/drm2/nouveau/files.nouveau:1.36 src/sys/external/bsd/drm2/nouveau/files.nouveau:1.37
--- src/sys/external/bsd/drm2/nouveau/files.nouveau:1.36	Sun Dec 19 10:55:37 2021
+++ src/sys/external/bsd/drm2/nouveau/files.nouveau	Tue Dec 21 12:55:24 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.nouveau,v 1.36 2021/12/19 10:55:37 riastradh Exp $
+#	$NetBSD: files.nouveau,v 1.37 2021/12/21 12:55:24 tnn Exp $
 
 version	20180827
 
@@ -37,6 +37,8 @@ makeoptions	nouveau	"CWARNFLAGS.nouveau"
 makeoptions	nouveau	"CWARNFLAGS.nouveau"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}"
 makeoptions	nouveau	"CWARNFLAGS.nouveau_nvkm_subdev_bios_timing.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=int-in-bool-context :}"
 makeoptions	nouveau	"CWARNFLAGS.nouveau_nvkm_subdev_clk_gt215.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=int-in-bool-context :}"
+makeoptions	nouveau	"CWARNFLAGS.nouveau_nvkm_subdev_instmem_base.c"+="${${ACTIVE_CC} == clang :? -Wno-unused-function :}"
+makeoptions	nouveau	"CWARNFLAGS.nouveau_nvkm_subdev_mmu_vmmnv04.c"+="${${ACTIVE_CC} == clang :? -Wno-unused-function :}"
 
 file	external/bsd/drm2/nouveau/nouveau_module.c	nouveau
 



CVS commit: src/sys/external/bsd/drm2/dist/include/drm

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 12:28:34 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/include/drm: drm_device.h

Log Message:
drm_device.h: don't redefine vmem_t


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/sys/external/bsd/drm2/dist/include/drm/drm_device.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/external/bsd/drm2/dist/include/drm/drm_device.h
diff -u src/sys/external/bsd/drm2/dist/include/drm/drm_device.h:1.8 src/sys/external/bsd/drm2/dist/include/drm/drm_device.h:1.9
--- src/sys/external/bsd/drm2/dist/include/drm/drm_device.h:1.8	Sun Dec 19 12:05:09 2021
+++ src/sys/external/bsd/drm2/dist/include/drm/drm_device.h	Tue Dec 21 12:28:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_device.h,v 1.8 2021/12/19 12:05:09 riastradh Exp $	*/
+/*	$NetBSD: drm_device.h,v 1.9 2021/12/21 12:28:34 tnn Exp $	*/
 
 #ifndef _DRM_DEVICE_H_
 #define _DRM_DEVICE_H_
@@ -29,7 +29,11 @@ struct drm_fb_helper;
 struct pci_dev;
 struct pci_controller;
 
+#if defined(__NetBSD__)
+#include 
+#else
 typedef struct vmem vmem_t;
+#endif
 
 /**
  * enum drm_switch_power - power state of drm device



CVS commit: src/sys/external/bsd/drm2/dist/include/drm

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 12:28:34 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/include/drm: drm_device.h

Log Message:
drm_device.h: don't redefine vmem_t


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/sys/external/bsd/drm2/dist/include/drm/drm_device.h

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



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 12:06:30 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_scheduler.c

Log Message:
i915_scheduler.c: node_to_request: duplicate 'const' declaration specifier


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.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/i915/i915_scheduler.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.c:1.7 src/sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.c:1.8
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.c:1.7	Sun Dec 19 12:12:47 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.c	Tue Dec 21 12:06:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_scheduler.c,v 1.7 2021/12/19 12:12:47 riastradh Exp $	*/
+/*	$NetBSD: i915_scheduler.c,v 1.8 2021/12/21 12:06:29 tnn Exp $	*/
 
 /*
  * SPDX-License-Identifier: MIT
@@ -7,7 +7,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_scheduler.c,v 1.7 2021/12/19 12:12:47 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_scheduler.c,v 1.8 2021/12/21 12:06:29 tnn Exp $");
 
 #include 
 
@@ -34,7 +34,7 @@ static DEFINE_SPINLOCK(schedule_lock);
 static const struct i915_request *
 node_to_request(const struct i915_sched_node *node)
 {
-	return const_container_of(node, const struct i915_request, sched);
+	return const_container_of(node, struct i915_request, sched);
 }
 
 static inline bool node_started(const struct i915_sched_node *node)



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 12:06:30 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_scheduler.c

Log Message:
i915_scheduler.c: node_to_request: duplicate 'const' declaration specifier


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.c

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



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915/gem

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 12:00:40 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem: i915_gem_shmem.c

Log Message:
i915_gem_shmem.c: shmem_get_pages: fix uninitialize use of "noreclaim"


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_shmem.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/i915/gem/i915_gem_shmem.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_shmem.c:1.10 src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_shmem.c:1.11
--- src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_shmem.c:1.10	Sun Dec 19 12:25:56 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_shmem.c	Tue Dec 21 12:00:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_gem_shmem.c,v 1.10 2021/12/19 12:25:56 riastradh Exp $	*/
+/*	$NetBSD: i915_gem_shmem.c,v 1.11 2021/12/21 12:00:40 tnn Exp $	*/
 
 /*
  * SPDX-License-Identifier: MIT
@@ -7,7 +7,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_shmem.c,v 1.10 2021/12/19 12:25:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_shmem.c,v 1.11 2021/12/21 12:00:40 tnn Exp $");
 
 #include 
 #include 
@@ -89,12 +89,13 @@ rebuild_st:
 	 */
 #ifdef __NetBSD__
 	mapping = obj->base.filp;
+	noreclaim = GFP_KERNEL;
 #else
 	mapping = obj->base.filp->f_mapping;
 	mapping_set_unevictable(mapping);
 	noreclaim = mapping_gfp_constraint(mapping, ~__GFP_RECLAIM);
-	noreclaim |= __GFP_NORETRY | __GFP_NOWARN;
 #endif
+	noreclaim |= __GFP_NORETRY | __GFP_NOWARN;
 
 	sg = st->sgl;
 	st->nents = 0;



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915/gem

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 12:00:40 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem: i915_gem_shmem.c

Log Message:
i915_gem_shmem.c: shmem_get_pages: fix uninitialize use of "noreclaim"


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_shmem.c

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



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 11:44:18 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_drv.c

Log Message:
i915_drm_resume_early: initialize ret

clang -Wsometimes-uninitialized says uninitialized use
on line 2043 when if statement on line 2037 is false


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.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/i915/i915_drv.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c:1.46 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c:1.47
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c:1.46	Sun Dec 19 12:40:43 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c	Tue Dec 21 11:44:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_drv.c,v 1.46 2021/12/19 12:40:43 riastradh Exp $	*/
+/*	$NetBSD: i915_drv.c,v 1.47 2021/12/21 11:44:18 tnn Exp $	*/
 
 /* i915_drv.c -- i830,i845,i855,i865,i915 driver -*- linux-c -*-
  */
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_drv.c,v 1.46 2021/12/19 12:40:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_drv.c,v 1.47 2021/12/21 11:44:18 tnn Exp $");
 
 #include 
 #include 
@@ -1983,7 +1983,7 @@ int i915_drm_resume_early(struct drm_dev
 #ifndef __NetBSD__
 	struct pci_dev *pdev = dev_priv->drm.pdev;
 #endif
-	int ret;
+	int ret = 0;
 
 	/*
 	 * We have a resume ordering issue with the snd-hda driver also



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 11:44:18 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_drv.c

Log Message:
i915_drm_resume_early: initialize ret

clang -Wsometimes-uninitialized says uninitialized use
on line 2043 when if statement on line 2037 is false


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c

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



Re: CVS commit: src/sys/net

2021-12-03 Thread Tobias Nygren
On Mon, 15 Nov 2021 07:07:06 +
Shoichi YAMAGUCHI  wrote:

> Date: Mon Nov 15 07:07:06 UTC 2021
> 
> Modified Files:
>   src/sys/net: if_ether.h if_ethersubr.c if_vlan.c
>   src/sys/net/lagg: if_lagg.c
> 
> Log Message:
> introduced APIs to configure VLAN TAG to ethernet devices

Hello,

This change seems to have broke something MTU related when
more than two VLANs are configured on the same NIC.
The first VLAN inherits the parent's MTU but the subsequent
ones have 4 byte too small MTU causing network problems.

Kernel from 2021-11-15:

# ifconfig |grep mtu
wm0: flags=0x8843 mtu 1500
vlan100: flags=0x8843 mtu 1500
vlan101: flags=0x8843 mtu 1500
vlan102: flags=0x8843 mtu 1500
vlan103: flags=0x8843 mtu 1500
vlan104: flags=0x8843 mtu 1500
vlan105: flags=0x8843 mtu 1500
vlan106: flags=0x8843 mtu 1500

Kernel from 2021-11-16:

wm0: flags=0x8843 mtu 1500
vlan100: flags=0x8843 mtu 1500
vlan101: flags=0x8843 mtu 1496
vlan102: flags=0x8843 mtu 1496
vlan103: flags=0x8843 mtu 1496
vlan104: flags=0x8843 mtu 1496
vlan105: flags=0x8843 mtu 1496
vlan106: flags=0x8843 mtu 1496

I could not force increase the MTU either:

root@tinfoilhat-b:log> ifconfig vlan100 mtu 1500
root@tinfoilhat-b:log> ifconfig vlan101 mtu 1500
ifconfig: SIOCSIFMTU: Invalid argument

Kind regards,
-Tobias


Re: CVS commit: src/sys/arch

2021-10-31 Thread Tobias Nygren
On Sun, 31 Oct 2021 16:23:48 +
Nick Hudson  wrote:

> Modified Files:
>   src/sys/arch/aarch64/include: cpu.h cpufunc.h db_machdep.h
...
> Log Message:
> Rework Arm (32bit and 64bit) AP startup so that cpu_hatch doesn't sleep.

Hi,

I'm afraid this broke the userland build.
I think db_machdep_init(...) should move to the ifdef _KERNEL block?

   compile  crash/db_autoconf.o
In file included from /usr/src/../obj/usr.sbin/crash/machine/db_machdep.h:4,
 from /usr/src/usr.sbin/crash/../../sys/ddb/ddb.h:35,
 from /usr/src/usr.sbin/crash/../../sys/ddb/db_autoconf.c:39:
/usr/src/../obj/usr.sbin/crash/aarch64/db_machdep.h:231:29: error: 'struct 
cpu_info' declared inside parameter list will not be visible outside of this 
definition or declaration [-Werror]
  231 | void db_machdep_init(struct cpu_info * const);

-Tobias


Re: CVS commit: src/usr.sbin/inetd

2021-08-31 Thread Tobias Nygren
On Mon, 30 Aug 2021 18:21:11 +
Roland Illig  wrote:

> Module Name:  src
> Committed By: rillig
> Date: Mon Aug 30 18:21:11 UTC 2021
> 
> Modified Files:
>   src/usr.sbin/inetd: Makefile inetd.c parse_v2.c
> 
> Log Message:
> inetd: raise WARNS from 5 to 6

clang complains:

/work/src/usr.sbin/inetd/inetd.c:763:18: error: implicit conversion changes 
signedness: 'service_type' (aka 'enum service_type') to 'int' 
[-Werror,-Wsign-conversion]
SWAP(int, cp->se_type, sep->se_type);
~~^~

Works for me:

--- inetd.c 30 Aug 2021 18:21:11 -  1.131
+++ inetd.c 31 Aug 2021 16:26:45 -
@@ -760,7 +760,7 @@ config(void)
 #ifdef IPSEC
SWAP(char *, sep->se_policy, cp->se_policy);
 #endif
-   SWAP(int, cp->se_type, sep->se_type);
+   SWAP(enum service_type, cp->se_type, sep->se_type);
SWAP(size_t, cp->se_service_max, sep->se_service_max);
SWAP(size_t, cp->se_ip_max, sep->se_ip_max);


CVS commit: src/sys/dev/ic

2021-08-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Aug 21 17:50:02 UTC 2021

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

Log Message:
ssdfb: add missing break in switch. Unbreaks contrast setting for SSD1353

spotted by hannken@


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/ic/ssdfb.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/ssdfb.c
diff -u src/sys/dev/ic/ssdfb.c:1.21 src/sys/dev/ic/ssdfb.c:1.22
--- src/sys/dev/ic/ssdfb.c:1.21	Sat Aug  7 16:19:12 2021
+++ src/sys/dev/ic/ssdfb.c	Sat Aug 21 17:50:02 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb.c,v 1.21 2021/08/07 16:19:12 thorpej Exp $ */
+/* $NetBSD: ssdfb.c,v 1.22 2021/08/21 17:50:02 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.21 2021/08/07 16:19:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.22 2021/08/21 17:50:02 tnn Exp $");
 
 #include "opt_ddb.h"
 
@@ -1060,8 +1060,10 @@ ssdfb_set_contrast(struct ssdfb_softc *s
 		if (error)
 			return error;
 		cmd[0] = SSD1353_CMD_SET_CONTRAST_CONTROL_C;
+		break;
 	default:
 		cmd[0] = SSDFB_CMD_SET_CONTRAST_CONTROL;
+		break;
 	}
 
 	return sc->sc_cmd(sc->sc_cookie, cmd, sizeof(cmd), usepoll);



CVS commit: src/sys/dev/ic

2021-08-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Aug 21 17:50:02 UTC 2021

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

Log Message:
ssdfb: add missing break in switch. Unbreaks contrast setting for SSD1353

spotted by hannken@


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/ic/ssdfb.c

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



CVS commit: src/sys/dev/spi

2021-08-19 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Aug 19 17:50:18 UTC 2021

Modified Files:
src/sys/dev/spi: ssdfb_spi.c

Log Message:
ssdfb: add support for SSD1306 and SH1106 at spi attachment

Only support the 4-wire mode for now. Support for 3-wire mode is
theoretically possible but most (all?) modules in circulation have the
BS0 / IM0 3-wire config pin internally grounded within the flat-flex
assembly so it is not easy to enable & test.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/spi/ssdfb_spi.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/spi/ssdfb_spi.c
diff -u src/sys/dev/spi/ssdfb_spi.c:1.10 src/sys/dev/spi/ssdfb_spi.c:1.11
--- src/sys/dev/spi/ssdfb_spi.c:1.10	Thu Aug 19 11:04:21 2021
+++ src/sys/dev/spi/ssdfb_spi.c	Thu Aug 19 17:50:18 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb_spi.c,v 1.10 2021/08/19 11:04:21 tnn Exp $ */
+/* $NetBSD: ssdfb_spi.c,v 1.11 2021/08/19 17:50:18 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.10 2021/08/19 11:04:21 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.11 2021/08/19 17:50:18 tnn Exp $");
 
 #include 
 #include 
@@ -70,6 +70,10 @@ static int	ssdfb_spi_xfer_rect_3wire_ssd
 		uint8_t, uint8_t, uint8_t *, size_t, bool);
 
 static int	ssdfb_spi_cmd_4wire(void *, uint8_t *, size_t, bool);
+static int	ssdfb_spi_xfer_rect_4wire_sh1106(void *, uint8_t, uint8_t,
+		uint8_t, uint8_t, uint8_t *, size_t, bool);
+static int	ssdfb_spi_xfer_rect_4wire_ssd1306(void *, uint8_t, uint8_t,
+		uint8_t, uint8_t, uint8_t *, size_t, bool);
 static int	ssdfb_spi_xfer_rect_4wire_ssd1322(void *, uint8_t, uint8_t,
 		uint8_t, uint8_t, uint8_t *, size_t, bool);
 static int	ssdfb_spi_xfer_rect_4wire_ssd1353(void *, uint8_t, uint8_t,
@@ -87,6 +91,7 @@ CFATTACH_DECL_NEW(ssdfb_spi, sizeof(stru
 
 static const struct device_compatible_entry compat_data[] = {
 	{ .compat = "solomon,ssd1306",	.value = SSDFB_PRODUCT_SSD1306_GENERIC },
+	{ .compat = "sino,sh1106",	.value = SSDFB_PRODUCT_SH1106_GENERIC },
 	{ .compat = "solomon,ssd1322",	.value = SSDFB_PRODUCT_SSD1322_GENERIC },
 	{ .compat = "solomon,ssd1353",	.value = SSDFB_PRODUCT_SSD1353_GENERIC },
 	{ .compat = "dep160128a",	.value = SSDFB_PRODUCT_DEP_160128A_RGB },
@@ -165,6 +170,20 @@ ssdfb_spi_attach(device_t parent, device
 	: ssdfb_spi_cmd_4wire;
 
 	switch (flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK) {
+	case SSDFB_PRODUCT_SH1106_GENERIC:
+		sc->sc.sc_transfer_rect = sc->sc_3wiremode
+		? NULL
+		: ssdfb_spi_xfer_rect_4wire_sh1106;
+		sc->sc_padding_cmd = SSDFB_CMD_NOP;
+		sc->sc_late_dc_deassert = true;
+		break;
+	case SSDFB_PRODUCT_SSD1306_GENERIC:
+		sc->sc.sc_transfer_rect = sc->sc_3wiremode
+		? NULL
+		: ssdfb_spi_xfer_rect_4wire_ssd1306;
+		sc->sc_padding_cmd = SSDFB_CMD_NOP;
+		sc->sc_late_dc_deassert = true;
+		break;
 	case SSDFB_PRODUCT_SSD1322_GENERIC:
 		sc->sc.sc_transfer_rect = sc->sc_3wiremode
 		? ssdfb_spi_xfer_rect_3wire_ssd1322
@@ -215,7 +234,6 @@ ssdfb_spi_xfer_rect_3wire_ssd1322(void *
 	struct ssdfb_spi_softc *sc = (struct ssdfb_spi_softc *)cookie;
 	uint8_t bitstream[128 * 9 / 8];
 	struct bs_state s;
-	uint8_t row;
 	size_t rlen = (tocol + 1 - fromcol) * 2;
 	int error;
 
@@ -239,13 +257,14 @@ ssdfb_spi_xfer_rect_3wire_ssd1322(void *
 		return error;
 
 	KASSERT(rlen <= 128);
-	for (row = fromrow; row <= torow; row++) {
+	while (fromrow <= torow) {
 		ssdfb_bitstream_init(, bitstream);
 		ssdfb_bitstream_append_data(, p, rlen);
 		ssdfb_bitstream_final(, sc->sc_padding_cmd);
 		error = spi_send(sc->sc_sh, s.cur - s.base, bitstream);
 		if (error)
 			return error;
+		fromrow++;
 		p += stride;
 	}
 
@@ -334,19 +353,86 @@ ssdfb_spi_cmd_4wire(void *cookie, uint8_
 }
 
 static int
+ssdfb_spi_xfer_rect_4wire_sh1106(void *cookie, uint8_t fromcol, uint8_t tocol,
+uint8_t frompage, uint8_t topage, uint8_t *p, size_t stride, bool usepoll)
+{
+	struct ssdfb_spi_softc *sc = (struct ssdfb_spi_softc *)cookie;
+	size_t rlen = tocol + 1 - fromcol;
+	int error;
+	uint8_t cmd[] = {
+		SSDFB_CMD_SET_PAGE_START_ADDRESS_BASE + frompage,
+		SSDFB_CMD_SET_HIGHER_COLUMN_START_ADDRESS_BASE + (fromcol >> 4),
+		SSDFB_CMD_SET_LOWER_COLUMN_START_ADDRESS_BASE + (fromcol & 0xf)
+	};
+
+	if (usepoll && !cold)
+		return 0;
+
+	while (frompage <= topage) {
+		cmd[0] = SSDFB_CMD_SET_PAGE_START_ADDRESS_BASE + frompage;
+		ssdfb_spi_4wire_set_dc(sc, 0);
+		error = spi_send(sc->sc_sh, sizeof(cmd), cmd);
+		if (error)
+			return error;
+		ssdfb_spi_4wire_set_dc(sc, 1);
+		error = spi_send(sc->sc_sh, rlen, p);
+		if (error)
+			return error;
+		frompage++;
+		p += stride;
+	}
+
+	return 0;
+}
+
+static int
+ssdfb_spi_xfer_rect_4wire_ssd1306(void *cookie, uint8_t fromcol, uint8_t tocol,
+uint8_t frompage, uint8_t topage, uint8_t *p, size_t 

CVS commit: src/sys/dev/spi

2021-08-19 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Aug 19 17:50:18 UTC 2021

Modified Files:
src/sys/dev/spi: ssdfb_spi.c

Log Message:
ssdfb: add support for SSD1306 and SH1106 at spi attachment

Only support the 4-wire mode for now. Support for 3-wire mode is
theoretically possible but most (all?) modules in circulation have the
BS0 / IM0 3-wire config pin internally grounded within the flat-flex
assembly so it is not easy to enable & test.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/spi/ssdfb_spi.c

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



CVS commit: src/sys/dev/spi

2021-08-19 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Aug 19 11:04:21 UTC 2021

Modified Files:
src/sys/dev/spi: ssdfb_spi.c

Log Message:
ssdfb_spi: fix issues with command xfers needed for SSD1306 & SH1106

These controllers require D/C# to be deasserted for the entire duration
of the command, contrary to docs and how newer controllers like SSD1353
behave. Probably this is needed for all controllers that do not have the
WRITE_RAM (0x5c) command. Also support using alternate padding commands
for 3-wire mode when WRITE_RAM is not available.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/spi/ssdfb_spi.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/spi/ssdfb_spi.c
diff -u src/sys/dev/spi/ssdfb_spi.c:1.9 src/sys/dev/spi/ssdfb_spi.c:1.10
--- src/sys/dev/spi/ssdfb_spi.c:1.9	Thu Aug  5 19:17:22 2021
+++ src/sys/dev/spi/ssdfb_spi.c	Thu Aug 19 11:04:21 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb_spi.c,v 1.9 2021/08/05 19:17:22 tnn Exp $ */
+/* $NetBSD: ssdfb_spi.c,v 1.10 2021/08/19 11:04:21 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.9 2021/08/05 19:17:22 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.10 2021/08/19 11:04:21 tnn Exp $");
 
 #include 
 #include 
@@ -58,6 +58,8 @@ struct ssdfb_spi_softc {
 	struct fdtbus_gpio_pin	*sc_gpio_res;
 #endif
 	bool			sc_3wiremode;
+	bool			sc_late_dc_deassert;
+	uint8_t			sc_padding_cmd;
 };
 
 static int	ssdfb_spi_match(device_t, cfdata_t, void *);
@@ -78,7 +80,7 @@ static void	ssdfb_bitstream_append(struc
 static void	ssdfb_bitstream_append_cmd(struct bs_state *, uint8_t);
 static void	ssdfb_bitstream_append_data(struct bs_state *, uint8_t *,
 		size_t);
-static void	ssdfb_bitstream_final(struct bs_state *);
+static void	ssdfb_bitstream_final(struct bs_state *, uint8_t);
 
 CFATTACH_DECL_NEW(ssdfb_spi, sizeof(struct ssdfb_spi_softc),
 ssdfb_spi_match, ssdfb_spi_attach, NULL, NULL);
@@ -167,6 +169,7 @@ ssdfb_spi_attach(device_t parent, device
 		sc->sc.sc_transfer_rect = sc->sc_3wiremode
 		? ssdfb_spi_xfer_rect_3wire_ssd1322
 		: ssdfb_spi_xfer_rect_4wire_ssd1322;
+		sc->sc_padding_cmd = SSD1322_CMD_WRITE_RAM;
 		break;
 	case SSDFB_PRODUCT_SSD1353_GENERIC:
 	case SSDFB_PRODUCT_DEP_160128A_RGB:
@@ -200,7 +203,7 @@ ssdfb_spi_cmd_3wire(void *cookie, uint8_
 	cmd++;
 	len--;
 	ssdfb_bitstream_append_data(, cmd, len);
-	ssdfb_bitstream_final();
+	ssdfb_bitstream_final(, sc->sc_padding_cmd);
 
 	return spi_send(sc->sc_sh, s.cur - s.base, bitstream);
 }
@@ -230,7 +233,7 @@ ssdfb_spi_xfer_rect_3wire_ssd1322(void *
 	ssdfb_bitstream_append_data(, , 1);
 	ssdfb_bitstream_append_data(, , 1);
 	ssdfb_bitstream_append_cmd(, SSD1322_CMD_WRITE_RAM);
-	ssdfb_bitstream_final();
+	ssdfb_bitstream_final(, sc->sc_padding_cmd);
 	error = spi_send(sc->sc_sh, s.cur - s.base, bitstream);
 	if (error)
 		return error;
@@ -239,7 +242,7 @@ ssdfb_spi_xfer_rect_3wire_ssd1322(void *
 	for (row = fromrow; row <= torow; row++) {
 		ssdfb_bitstream_init(, bitstream);
 		ssdfb_bitstream_append_data(, p, rlen);
-		ssdfb_bitstream_final();
+		ssdfb_bitstream_final(, sc->sc_padding_cmd);
 		error = spi_send(sc->sc_sh, s.cur - s.base, bitstream);
 		if (error)
 			return error;
@@ -290,11 +293,8 @@ ssdfb_bitstream_append_data(struct bs_st
 }
 
 static void
-ssdfb_bitstream_final(struct bs_state *s)
+ssdfb_bitstream_final(struct bs_state *s, uint8_t padding_cmd)
 {
-	uint8_t padding_cmd = SSD1322_CMD_WRITE_RAM;
-	/* padding_cmd = SSDFB_NOP_CMD; */
-
 	while (s->mask != 0x80) {
 		ssdfb_bitstream_append_cmd(s, padding_cmd);
 	}
@@ -321,7 +321,8 @@ ssdfb_spi_cmd_4wire(void *cookie, uint8_
 	if (error)
 		return error;
 	if (len > 1) {
-		ssdfb_spi_4wire_set_dc(sc, 1);
+		if (!sc->sc_late_dc_deassert)
+			ssdfb_spi_4wire_set_dc(sc, 1);
 		len--;
 		cmd++;
 		error = spi_send(sc->sc_sh, len, cmd);



CVS commit: src/sys/dev/spi

2021-08-19 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Aug 19 11:04:21 UTC 2021

Modified Files:
src/sys/dev/spi: ssdfb_spi.c

Log Message:
ssdfb_spi: fix issues with command xfers needed for SSD1306 & SH1106

These controllers require D/C# to be deasserted for the entire duration
of the command, contrary to docs and how newer controllers like SSD1353
behave. Probably this is needed for all controllers that do not have the
WRITE_RAM (0x5c) command. Also support using alternate padding commands
for 3-wire mode when WRITE_RAM is not available.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/spi/ssdfb_spi.c

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



CVS commit: src/sys/dev/pci

2021-08-08 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Aug  8 12:17:37 UTC 2021

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

Log Message:
radeonfb: use BUS_SPACE_MAP_PREFETCHABLE for the framebuffer mapping

Makes the driver work on cia(4) based alpha machines, which can only
do dense access to linear mappings with prefetch. ok macallan@


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/pci/radeonfb.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/radeonfb.c
diff -u src/sys/dev/pci/radeonfb.c:1.116 src/sys/dev/pci/radeonfb.c:1.117
--- src/sys/dev/pci/radeonfb.c:1.116	Sat Aug  7 16:19:14 2021
+++ src/sys/dev/pci/radeonfb.c	Sun Aug  8 12:17:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeonfb.c,v 1.116 2021/08/07 16:19:14 thorpej Exp $ */
+/*	$NetBSD: radeonfb.c,v 1.117 2021/08/08 12:17:37 tnn Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.116 2021/08/07 16:19:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.117 2021/08/08 12:17:37 tnn Exp $");
 
 #include 
 #include 
@@ -799,7 +799,8 @@ radeonfb_attach(device_t parent, device_
 
 	sc->sc_memt = pa->pa_memt;
 	if (bus_space_map(sc->sc_memt, sc->sc_memaddr, sc->sc_memsz,
-		BUS_SPACE_MAP_LINEAR, >sc_memh) != 0) {
+		BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE,
+		>sc_memh) != 0) {
 		sc->sc_memsz = 0;
 		aprint_error("%s: Unable to map frame buffer\n", XNAME(sc));
 		goto error;
@@ -1098,7 +1099,8 @@ radeonfb_map(struct radeonfb_softc *sc)
 			return;
 		}
 		if (bus_space_map(sc->sc_memt, sc->sc_memaddr, sc->sc_memsz,
-		BUS_SPACE_MAP_LINEAR, >sc_memh) != 0) {
+		BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE,
+		>sc_memh) != 0) {
 			sc->sc_memsz = 0;
 			aprint_error_dev(sc->sc_dev,
 			"Unable to map frame buffer\n");



CVS commit: src/sys/dev/pci

2021-08-08 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Aug  8 12:17:37 UTC 2021

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

Log Message:
radeonfb: use BUS_SPACE_MAP_PREFETCHABLE for the framebuffer mapping

Makes the driver work on cia(4) based alpha machines, which can only
do dense access to linear mappings with prefetch. ok macallan@


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/pci/radeonfb.c

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



CVS commit: src/sys/dev/ic

2021-08-06 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Aug  6 18:15:48 UTC 2021

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

Log Message:
conditionally put back the include of 

This is a kludge to fix the build on some ports. According to pmap(9),
including  should be sufficient to use
"bool pmap_is_modified(struct vm_page *pg)". However, on several ports,
the function is implemented as a macro and depends on implementation
details of "struct vm_page *", which is normally an incomplete forward
declaration only. XXX revert when all ports are fixed.


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

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



CVS commit: src/sys/dev/ic

2021-08-06 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Aug  6 18:15:48 UTC 2021

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

Log Message:
conditionally put back the include of 

This is a kludge to fix the build on some ports. According to pmap(9),
including  should be sufficient to use
"bool pmap_is_modified(struct vm_page *pg)". However, on several ports,
the function is implemented as a macro and depends on implementation
details of "struct vm_page *", which is normally an incomplete forward
declaration only. XXX revert when all ports are fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ic/ssdfb.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/ssdfb.c
diff -u src/sys/dev/ic/ssdfb.c:1.19 src/sys/dev/ic/ssdfb.c:1.20
--- src/sys/dev/ic/ssdfb.c:1.19	Thu Aug  5 22:31:20 2021
+++ src/sys/dev/ic/ssdfb.c	Fri Aug  6 18:15:48 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb.c,v 1.19 2021/08/05 22:31:20 tnn Exp $ */
+/* $NetBSD: ssdfb.c,v 1.20 2021/08/06 18:15:48 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.19 2021/08/05 22:31:20 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.20 2021/08/06 18:15:48 tnn Exp $");
 
 #include "opt_ddb.h"
 
@@ -43,6 +43,9 @@ __KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.
 
 #include 
 #include 
+#ifdef pmap_is_modified
+#include 
+#endif
 
 #include 
 #include 



CVS commit: src/sys/dev

2021-08-05 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Aug  5 22:31:20 UTC 2021

Modified Files:
src/sys/dev/i2c: ssdfb_i2c.c
src/sys/dev/ic: ssdfb.c ssdfbvar.h

Log Message:
ssdfb: revert rev 1.14

Can't run the worker thread MPSAFE with spi(4) yet because most controller
drivers still lack MP safety. Cause issues when using multiple displays.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/i2c/ssdfb_i2c.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/ssdfb.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/ssdfbvar.h

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



  1   2   3   4   5   >