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

2021-07-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jul 18 05:09:47 UTC 2021

Modified Files:
src/sys/arch/alpha/pci: cia_dma.c tsp_dma.c

Log Message:
Oops, pass the correct bus_dma_tag_t to the "hi" sgmap init function.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/pci/cia_dma.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/alpha/pci/tsp_dma.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/alpha/pci/cia_dma.c
diff -u src/sys/arch/alpha/pci/cia_dma.c:1.35 src/sys/arch/alpha/pci/cia_dma.c:1.36
--- src/sys/arch/alpha/pci/cia_dma.c:1.35	Sat Jul 17 00:30:39 2021
+++ src/sys/arch/alpha/pci/cia_dma.c	Sun Jul 18 05:09:47 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cia_dma.c,v 1.35 2021/07/17 00:30:39 thorpej Exp $ */
+/* $NetBSD: cia_dma.c,v 1.36 2021/07/18 05:09:47 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: cia_dma.c,v 1.35 2021/07/17 00:30:39 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cia_dma.c,v 1.36 2021/07/18 05:09:47 thorpej Exp $");
 
 #include 
 #include 
@@ -202,14 +202,14 @@ cia_dma_init(struct cia_config *ccp)
 	 */
 
 	/*
-	 * Initialize the SGMAP(s).  Must align page table to 32k
+	 * Initialize the SGMAP(s).  Must align page table to at least 32k
 	 * (hardware bug?).
 	 */
 	alpha_sgmap_init(t, >cc_sgmap_lo, "cia_sgmap_lo",
 	CIA_SGMAP_MAPPED_LO_BASE, 0, CIA_SGMAP_MAPPED_LO_SIZE,
 	sizeof(uint64_t), NULL, (32*1024));
 	if (t_sg_hi != NULL) {
-		alpha_sgmap_init(t, >cc_sgmap_hi, "cia_sgmap_hi",
+		alpha_sgmap_init(t_sg_hi, >cc_sgmap_hi, "cia_sgmap_hi",
 		CIA_SGMAP_MAPPED_HI_BASE, 0, CIA_SGMAP_MAPPED_HI_SIZE,
 		sizeof(uint64_t), NULL, (32*1024));
 	}

Index: src/sys/arch/alpha/pci/tsp_dma.c
diff -u src/sys/arch/alpha/pci/tsp_dma.c:1.19 src/sys/arch/alpha/pci/tsp_dma.c:1.20
--- src/sys/arch/alpha/pci/tsp_dma.c:1.19	Sun Jul 18 00:01:20 2021
+++ src/sys/arch/alpha/pci/tsp_dma.c	Sun Jul 18 05:09:47 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: tsp_dma.c,v 1.19 2021/07/18 00:01:20 thorpej Exp $ */
+/* $NetBSD: tsp_dma.c,v 1.20 2021/07/18 05:09:47 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998, 2021 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tsp_dma.c,v 1.19 2021/07/18 00:01:20 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tsp_dma.c,v 1.20 2021/07/18 05:09:47 thorpej Exp $");
 
 #include 
 #include 
@@ -292,7 +292,7 @@ tsp_dma_init(struct tsp_config *pcp)
 	TSP_SGMAP_MAPPED_LO_BASE, 0, TSP_SGMAP_MAPPED_LO_SIZE,
 	sizeof(uint64_t), NULL, (32*1024));
 	if (t_sg_hi != NULL) {
-		alpha_sgmap_init(t, >pc_sgmap_hi, "tsp_sgmap_hi",
+		alpha_sgmap_init(t_sg_hi, >pc_sgmap_hi, "tsp_sgmap_hi",
 		TSP_SGMAP_MAPPED_HI_BASE, 0, TSP_SGMAP_MAPPED_HI_SIZE,
 		sizeof(uint64_t), NULL, (32*1024));
 	}



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

2021-07-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jul 18 00:01:21 UTC 2021

Modified Files:
src/sys/arch/alpha/pci: tsp_dma.c tsvar.h

Log Message:
- Don't bother issuing a warning if we program the WBASE / WSM register
  to different values than the firmware.
- Reduce the differences in how we initialize the DMA tags vis a vis the
  other Alpha implementations.
- Use Window 2 to provide a 1G @ 3G PCI SGMAP window on systems with more
  than 1G of RAM, rather than falling back on the ISA DMA window which is
  small and could get starved by PCI devices.
- Make sure we set TBASE to 0 for direct-mapped windows.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/alpha/pci/tsp_dma.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/alpha/pci/tsvar.h

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

Modified files:

Index: src/sys/arch/alpha/pci/tsp_dma.c
diff -u src/sys/arch/alpha/pci/tsp_dma.c:1.18 src/sys/arch/alpha/pci/tsp_dma.c:1.19
--- src/sys/arch/alpha/pci/tsp_dma.c:1.18	Sun Jul  4 22:42:36 2021
+++ src/sys/arch/alpha/pci/tsp_dma.c	Sun Jul 18 00:01:20 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: tsp_dma.c,v 1.18 2021/07/04 22:42:36 thorpej Exp $ */
+/* $NetBSD: tsp_dma.c,v 1.19 2021/07/18 00:01:20 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998, 2021 The NetBSD Foundation, Inc.
@@ -61,13 +61,15 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tsp_dma.c,v 1.18 2021/07/04 22:42:36 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tsp_dma.c,v 1.19 2021/07/18 00:01:20 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
 
+#include 
+
 #include 
 #define _ALPHA_BUS_DMA_PRIVATE
 #include 
@@ -80,8 +82,6 @@ __KERNEL_RCSID(0, "$NetBSD: tsp_dma.c,v 
 
 #define tsp_dma() { Generate ctags(1) key. }
 
-#define	EDIFF(a, b) (((a) | WSBA_ENA | WSBA_SG)	!= ((b) | WSBA_ENA | WSBA_SG))
-
 static bus_dma_tag_t tsp_dma_get_tag(bus_dma_tag_t, alpha_bus_t);
 
 static int	tsp_bus_dmamap_load_sgmap(bus_dma_tag_t, bus_dmamap_t, void *,
@@ -126,53 +126,93 @@ static void	tsp_tlb_invalidate(struct ts
  * 64-bit DMA tag.  This leaves us possibly having to fall back on SGMAP
  * DMA on a Titan system (those support up to 64GB of RAM), and we may have
  * to address that with an additional large SGMAP DAC window at another
- * time.
+ * time.  XXX Does the Titan Monster Window support the extra bit?
  */
 #define	TSP_MONSTER_DMA_WINDOW_BASE	0x100##UL
 #define	TSP_MONSTER_DMA_WINDOW_SIZE	0x008##UL
 
+/*
+ * Basic 24-bit ISA DMA window is 8MB @ 8MB.  The firmware will
+ * have set this up in Window 0.
+ */
+#define	TSP_SGMAP_MAPPED_LO_BASE	(8UL * 1024 * 1024)
+#define	TSP_SGMAP_MAPPED_LO_SIZE	(8UL * 1024 * 1024)
+
+/*
+ * Basic 32-bit PCI DMA window is 1GB @ 2GB.  The firmware will
+ * have set this up in Window 1.
+ */
+#define	TSP_DIRECT_MAPPED_BASE		(2UL * 1024 * 1024 * 1024)
+#define	TSP_DIRECT_MAPPED_SIZE		(1UL * 1024 * 1024 * 1024)
+
+/*
+ * For systems that have > 1GB of RAM, but PCI devices that don't
+ * support dual-address cycle, we will also set up an additional
+ * SGMAP DMA window 1GB @ 3GB.  We will use Window 2 for this purpose.
+ */
+#define	TSP_SGMAP_MAPPED_HI_BASE	(3UL * 1024 * 1024 * 1024)
+#define	TSP_SGMAP_MAPPED_HI_SIZE	(1UL * 1024 * 1024 * 1024)
+
+/*
+ * Window 3 is still available for use in the future.  Window 3 supports
+ * dual address cycle.
+ */
+
 void
 tsp_dma_init(struct tsp_config *pcp)
 {
-	int i;
 	bus_dma_tag_t t;
+	bus_dma_tag_t t_sg_hi = NULL;
 	struct ts_pchip *pccsr = pcp->pc_csr;
-	bus_addr_t dwbase, dwlen, sgwbase, sgwlen, tbase;
-	static struct map_expected {
-		uint32_t base, mask, enables;
-	} premap[4] = {
-		{ 0x0080, 0x0070, WSBA_ENA | WSBA_SG },
-		{ 0x8000, 0x3ff0, WSBA_ENA   },
-		{ 0, 0, 0 },
-		{ 0, 0, 0 }
-	};
-
-	alpha_mb();
-	for(i = 0; i < 4; ++i) {
-		if (EDIFF(pccsr->tsp_wsba[i].tsg_r, premap[i].base) ||
-		EDIFF(pccsr->tsp_wsm[i].tsg_r, premap[i].mask))
-			printf("tsp%d: window %d: %lx/base %lx/mask %lx"
-			" reinitialized\n",
-			pcp->pc_pslot, i,
-			pccsr->tsp_wsba[i].tsg_r,
-			pccsr->tsp_wsm[i].tsg_r,
-			pccsr->tsp_tba[i].tsg_r);
-		pccsr->tsp_wsba[i].tsg_r = premap[i].base | premap[i].enables;
-		pccsr->tsp_wsm[i].tsg_r = premap[i].mask;
-	}
+	bus_addr_t tbase;
 
 	/* Ensure the Monster Window is enabled. */
+	alpha_mb();
 	pccsr->tsp_pctl.tsg_r |= PCTL_MWIN;
 	alpha_mb();
 
 	/*
+	 * If we have more than 1GB of RAM, then set up an sgmap-mapped
+	 * DMA window for non-DAC PCI.  This is better than using the ISA
+	 * window, which is pretty small and PCI devices could starve it.
+	 *
+	 * N.B. avail_end is "last-usable PFN + 1".
+	 */
+	if (uvm_physseg_get_avail_end(uvm_physseg_get_last()) >
+	atop(TSP_DIRECT_MAPPED_SIZE)) {
+		t = t_sg_hi = >pc_dmat_sgmap_hi;
+		t->_cookie = pcp;
+		t->_wbase = TSP_SGMAP_MAPPED_HI_BASE;
+		t->_wsize = TSP_SGMAP_MAPPED_HI_SIZE;
+		t->_next_window = NULL;
+		

CVS commit: src/sys/arch/alpha

2021-07-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jul 18 05:12:27 UTC 2021

Modified Files:
src/sys/arch/alpha/common: sgmap_common.c sgmap_typedep.c
src/sys/arch/alpha/include: bus_defs.h
src/sys/arch/alpha/tc: tc_dma.c tc_dma_3000_500.c

Log Message:
Allow for the SGMAP implementation to specify a minimum alignment for
SGMAP DMA segments.  If not specified, PAGE_SIZE will be used, as before.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/alpha/common/sgmap_common.c
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/alpha/common/sgmap_typedep.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/alpha/include/bus_defs.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/alpha/tc/tc_dma.c
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/alpha/tc/tc_dma_3000_500.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/alpha/common/sgmap_common.c
diff -u src/sys/arch/alpha/common/sgmap_common.c:1.28 src/sys/arch/alpha/common/sgmap_common.c:1.29
--- src/sys/arch/alpha/common/sgmap_common.c:1.28	Sun Jul  4 22:42:35 2021
+++ src/sys/arch/alpha/common/sgmap_common.c	Sun Jul 18 05:12:27 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sgmap_common.c,v 1.28 2021/07/04 22:42:35 thorpej Exp $ */
+/* $NetBSD: sgmap_common.c,v 1.29 2021/07/18 05:12:27 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: sgmap_common.c,v 1.28 2021/07/04 22:42:35 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sgmap_common.c,v 1.29 2021/07/18 05:12:27 thorpej Exp $");
 
 #include 
 #include 
@@ -68,6 +68,14 @@ alpha_sgmap_init(bus_dma_tag_t t, struct
 		goto die;
 	}
 
+	/*
+	 * If we don't yet have a minimum SGVA alignment, default
+	 * to the system page size.
+	 */
+	if (t->_sgmap_minalign < PAGE_SIZE) {
+		t->_sgmap_minalign = PAGE_SIZE;
+	}
+
 	sgmap->aps_wbase = wbase;
 	sgmap->aps_sgvabase = sgvabase;
 	sgmap->aps_sgvasize = sgvasize;

Index: src/sys/arch/alpha/common/sgmap_typedep.c
diff -u src/sys/arch/alpha/common/sgmap_typedep.c:1.42 src/sys/arch/alpha/common/sgmap_typedep.c:1.43
--- src/sys/arch/alpha/common/sgmap_typedep.c:1.42	Thu Jun 24 16:41:16 2021
+++ src/sys/arch/alpha/common/sgmap_typedep.c	Sun Jul 18 05:12:27 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sgmap_typedep.c,v 1.42 2021/06/24 16:41:16 thorpej Exp $ */
+/* $NetBSD: sgmap_typedep.c,v 1.43 2021/07/18 05:12:27 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: sgmap_typedep.c,v 1.42 2021/06/24 16:41:16 thorpej Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sgmap_typedep.c,v 1.43 2021/07/18 05:12:27 thorpej Exp $");
 
 #include "opt_ddb.h"
 
@@ -130,7 +130,8 @@ __C(SGMAP_TYPE,_load_buffer)(bus_dma_tag
 	const vm_flag_t vmflags = VM_INSTANTFIT |
 	((flags & BUS_DMA_NOWAIT) ? VM_NOSLEEP : VM_SLEEP);
 
-	alignment = PAGE_SIZE;
+	KASSERT(t->_sgmap_minalign != 0);
+	alignment = t->_sgmap_minalign;
 	sgvalen = (endva - va);
 
 	SGMAP_PTE_TYPE spill_pte_v = __C(SGMAP_TYPE,_prefetch_spill_page_pte);
@@ -193,13 +194,16 @@ __C(SGMAP_TYPE,_load_buffer)(bus_dma_tag
 		 * ARGH!  If the addition of the spill page bumped us
 		 * over our boundary, we have to 2x the boundary limit.
 		 * To compensate (and enforce the original boundary
-		 * constraint), we force our alignment to be the previous
-		 * boundary, thus ensuring that the only boundary violation
-		 * is the pre-fetch that the SGMAP controller performs that
-		 * necessitates the spill page in the first place.
+		 * constraint), we force our alignment to be at least the
+		 * previous boundary, thus ensuring that the only boundary
+		 * violation is the pre-fetch that the SGMAP controller
+		 * performs that necessitates the spill page in the first
+		 * place.
 		 */
 		if (boundary && boundary < sgvalen) {
-			alignment = boundary;
+			if (alignment < boundary) {
+alignment = boundary;
+			}
 			do {
 boundary <<= 1;
 			} while (boundary < sgvalen);

Index: src/sys/arch/alpha/include/bus_defs.h
diff -u src/sys/arch/alpha/include/bus_defs.h:1.5 src/sys/arch/alpha/include/bus_defs.h:1.6
--- src/sys/arch/alpha/include/bus_defs.h:1.5	Mon Sep 23 16:17:54 2019
+++ src/sys/arch/alpha/include/bus_defs.h	Sun Jul 18 05:12:27 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_defs.h,v 1.5 2019/09/23 16:17:54 skrll Exp $ */
+/* $NetBSD: bus_defs.h,v 1.6 2021/07/18 05:12:27 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -364,6 +364,12 @@ struct alpha_bus_dma_tag {
 	struct alpha_sgmap *_sgmap;
 
 	/*
+	 * Some chipsets may want to enforce a minimum alignment
+	 * constraint for SGMAP DMA addresses.
+	 */
+	bus_size_t _sgmap_minalign;
+
+	/*
 	 * The SGMAP MMU implements a prefetch FIFO to keep data
 	 * moving down the pipe, when doing host->bus DMA writes.
 	 * 

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

2021-07-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jul 17 23:53:02 UTC 2021

Modified Files:
src/sys/arch/alpha/pci: tsreg.h

Log Message:
- Define the DAC enable bit that's present in WSBA3.
- Define symbolic constants for the valid WSM values.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/alpha/pci/tsreg.h

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

Modified files:

Index: src/sys/arch/alpha/pci/tsreg.h
diff -u src/sys/arch/alpha/pci/tsreg.h:1.9 src/sys/arch/alpha/pci/tsreg.h:1.10
--- src/sys/arch/alpha/pci/tsreg.h:1.9	Thu May 27 22:11:31 2021
+++ src/sys/arch/alpha/pci/tsreg.h	Sat Jul 17 23:53:02 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: tsreg.h,v 1.9 2021/05/27 22:11:31 thorpej Exp $ */
+/* $NetBSD: tsreg.h,v 1.10 2021/07/17 23:53:02 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 by Ross Harvey.  All rights reserved.
@@ -150,14 +150,29 @@
 #define P_WSBA3		0x00c0
 
 #	define	WSBA_ADDR(r) (TSFIELDBB((r), 31, 20) << 20)
-#	define	WSBA_SG	 2
-#	define	WSBA_ENA 1
+#	define	WSBA3_DAC__BIT(39)
+#	define	WSBA_SG	 __BIT(1)
+#	define	WSBA_ENA __BIT(0)
 
 #define P_WSM0		0x0100
 #define P_WSM1		0x0140
 #define P_WSM2		0x0180
 #define P_WSM3		0x01c0
 
+#	define	WSM_1MB  (0x000UL << 20)
+#	define	WSM_2MB  (0x001UL << 20)
+#	define	WSM_4MB  (0x003UL << 20)
+#	define	WSM_8MB  (0x007UL << 20)
+#	define	WSM_16MB (0x00fUL << 20)
+#	define	WSM_32MB (0x01fUL << 20)
+#	define	WSM_64MB (0x03fUL << 20)
+#	define	WSM_128MB(0x07fUL << 20)
+#	define	WSM_256MB(0x0ffUL << 20)
+#	define	WSM_512MB(0x1ffUL << 20)
+#	define	WSM_1GB  (0x3ffUL << 20)
+#	define	WSM_2GB  (0x7ffUL << 20)
+/*#	define	WSM_4GB  N/A		monster window / DAC only */
+
 #	define	WSM_AM(r)TSFIELDBB((r), 31, 20)
 #	define	WSM_LEN(r)   ((WSM_AM(r) + 1) << 20)
 



CVS commit: src/usr.sbin/sysinst

2021-07-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jul 17 19:27:23 UTC 2021

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

Log Message:
Use strlcpy() to copy the wedge device name (the code still assumes
the string is short enough and 0 terminated, but now gcc is happy).


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

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

Modified files:

Index: src/usr.sbin/sysinst/gpt.c
diff -u src/usr.sbin/sysinst/gpt.c:1.25 src/usr.sbin/sysinst/gpt.c:1.26
--- src/usr.sbin/sysinst/gpt.c:1.25	Sat Jul 17 18:07:22 2021
+++ src/usr.sbin/sysinst/gpt.c	Sat Jul 17 19:27:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gpt.c,v 1.25 2021/07/17 18:07:22 martin Exp $	*/
+/*	$NetBSD: gpt.c,v 1.26 2021/07/17 19:27:22 martin Exp $	*/
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -1380,7 +1380,7 @@ gpt_sanitize(int diskfd, const struct gp
 		if (found)
 			continue;
 		memset(, 0, sizeof(delw));
-		strncpy(delw.dkw_devname, devname, sizeof(delw.dkw_devname));
+		strlcpy(delw.dkw_devname, devname, sizeof(delw.dkw_devname));
 		(void)ioctl(diskfd, DIOCDWEDGE, );
 	}
 



CVS commit: src/sys/dev/pci

2021-07-17 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Jul 17 07:11:36 UTC 2021

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

Log Message:
add current generation NVIDIA graphics cards (3050-3090 etc.)


To generate a diff of this commit:
cvs rdiff -u -r1.1427 -r1.1428 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.1427 src/sys/dev/pci/pcidevs:1.1428
--- src/sys/dev/pci/pcidevs:1.1427	Mon Jul 12 12:58:57 2021
+++ src/sys/dev/pci/pcidevs	Sat Jul 17 07:11:35 2021
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1427 2021/07/12 12:58:57 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1428 2021/07/17 07:11:35 mrg Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -7182,6 +7182,44 @@ product NVIDIA	TESLA_V100PCI16	0x1db4 	T
 product NVIDIA	TESLA_V100SXM32	0x1db5 	Tesla V100 SXM2 32GB
 product NVIDIA 	TESLA_V100PCI32	0x1db6 	Tesla V100 PCIe 32GB
 product NVIDIA	QUADRO_GV100	0x1dba 	Quadro GV100
+product NVIDIA	TITAN_RTX	0x1e02 	TITAN RTX
+product NVIDIA	GF_GTX2080_Ti	0x1e04 	GeForce GTX 2080 Ti
+product NVIDIA	GF_GTX2080_Ti_2	0x1e07 	GeForce GTX 2080 Ti
+product NVIDIA	QUADRO_RTX_8000	0x1e30 	Quadro RTX 8000 / 6000
+product NVIDIA	QUADRO_RTX_6000	0x1e3c 	Quadro RTX 6000
+product NVIDIA	GF_GTX2080	0x1e82 	GeForce GTX 2080
+product NVIDIA	GF_GTX2080_2	0x1e87 	GeForce GTX 2080
+product NVIDIA	GF_GTX2060	0x1e89 	GeForce GTX 2060
+product NVIDIA	GF_GTX2080_M	0x1e90 	GeForce GTX 2080 Mobile
+product NVIDIA	QUADRO_RTX_5000	0x1eb0 	Quadro RTX 5000
+product NVIDIA	QUADRO_RTX_4000	0x1eb1 	Quadro RTX 4000
+product NVIDIA	GF_GTX2080_M2	0x1ed0 	GeForce GTX 2080 Mobile
+product NVIDIA	GF_GTX2070	0x1f02 	GeForce GTX 2070
+product NVIDIA	GF_GTX2070_2	0x1f07 	GeForce GTX 2070
+product NVIDIA	GF_GTX2060_2	0x1f08 	GeForce GTX 2060
+product NVIDIA	GF_GTX2070_M	0x1f10 	GeForce GTX 2070 Mobile
+product NVIDIA	GF_GTX2060_M	0x1f11 	GeForce GTX 2060 Mobile
+product NVIDIA	GF_GTX2070_M2	0x1f50 	GeForce GTX 2070 Mobile
+product NVIDIA	GF_GTX2060_M2	0x1f51 	GeForce GTX 2060 Mobile
+product NVIDIA	GF_GTX1650	0x1f82 	GeForce GTX 1650
+product NVIDIA	GF_GTX1650_M	0x1f91 	GeForce GTX 1650 Mobile
+product NVIDIA	GF_GTX1660_Ti	0x2182 	GeForce GTX 1660 Ti
+product NVIDIA	GF_GTX1660	0x2184 	GeForce GTX 1660
+product NVIDIA	GF_GTX3090	0x2204 	GeForce GTX 3090
+product NVIDIA	GF_GTX3080_Ti	0x2205 	GeForce GTX 3080 Ti
+product NVIDIA	GF_GTX3080	0x2206 	GeForce GTX 3080
+product NVIDIA	RTX_A6000	0x2230 	RTX A6000
+product NVIDIA	RTX_A40		0x2235 	RTX A40
+product NVIDIA	GF_RTX3090_Ti	0x2482 	GeForce RTX 3070 Ti
+product NVIDIA	GF_RTX3070	0x2484 	GeForce RTX 3070
+product NVIDIA	GF_RTX3060_Ti	0x2486 	GeForce RTX 3060 Ti
+product NVIDIA	GF_RTX3070_MM	0x249c 	GeForce RTX 3070 Mobile / Max-Q
+product NVIDIA	GF_RTX3070_MM2	0x249d 	GeForce RTX 3070 Mobile / Max-Q
+product NVIDIA	GF_RTX3070_M	0x24dc 	GeForce RTX 3070 Mobile
+product NVIDIA	GF_RTX3070_MM3	0x24dd 	GeForce RTX 3070 Mobile / Max-Q
+product NVIDIA	GF_RTX3060	0x2501 	GeForce RTX 3060
+product NVIDIA	GF_RTX3060_MM	0x2520 	GeForce RTX 3060 Mobile / Max-Q
+product NVIDIA	GF_RTX3050	0x2283 	GeForce RTX 3050
 
 
 /* Nvidia & SGS-Thomson Microelectronics */



CVS commit: src/sys/dev/pci

2021-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 17 10:45:58 UTC 2021

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

Log Message:
puc(4): Add Intel Core 5G (mobile) KT.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/dev/pci/pucdata.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/pucdata.c
diff -u src/sys/dev/pci/pucdata.c:1.109 src/sys/dev/pci/pucdata.c:1.110
--- src/sys/dev/pci/pucdata.c:1.109	Tue Feb  2 16:11:43 2021
+++ src/sys/dev/pci/pucdata.c	Sat Jul 17 10:45:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pucdata.c,v 1.109 2021/02/02 16:11:43 bouyer Exp $	*/
+/*	$NetBSD: pucdata.c,v 1.110 2021/07/17 10:45:58 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1998, 1999 Christopher G. Demetriou.  All rights reserved.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.109 2021/02/02 16:11:43 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.110 2021/07/17 10:45:58 riastradh Exp $");
 
 #include 
 #include 
@@ -2046,6 +2046,15 @@ const struct puc_device_description puc_
 	},
 	},
 
+	/* Intel Core 5G (mobile) KT */
+	{   "Intel Core 5G (mobile) KT",
+	{	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_KT, 0, 0 },
+	{	0x,	0x,	0,	0	},
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x00, COM_FREQ },
+	},
+	},
+
 	/* Intel EG20T UART */
 	{   "Intel EG20T UART #0",
 	{	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_UART_0, 0, 0 },



CVS commit: src/usr.sbin/sysinst

2021-07-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jul 17 11:32:50 UTC 2021

Modified Files:
src/usr.sbin/sysinst: gpt.c partman.c

Log Message:
PR 56310: avoid assert() failures (or crashes) when the runtime addition
of a wedge fails (for whatever reasons).


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/sysinst/gpt.c
cvs rdiff -u -r1.51 -r1.52 src/usr.sbin/sysinst/partman.c

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

Modified files:

Index: src/usr.sbin/sysinst/gpt.c
diff -u src/usr.sbin/sysinst/gpt.c:1.23 src/usr.sbin/sysinst/gpt.c:1.24
--- src/usr.sbin/sysinst/gpt.c:1.23	Sun Jan 31 22:45:46 2021
+++ src/usr.sbin/sysinst/gpt.c	Sat Jul 17 11:32:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gpt.c,v 1.23 2021/01/31 22:45:46 rillig Exp $	*/
+/*	$NetBSD: gpt.c,v 1.24 2021/07/17 11:32:50 martin Exp $	*/
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -1404,8 +1404,11 @@ gpt_get_part_device(const struct disk_pa
 		usage = plain_name;
 	if (usage == plain_name || usage == raw_dev_name)
 		life = true;
-	if (!(p->gp_flags & GPEF_WEDGE) && life)
-		gpt_add_wedge(arg->disk, p);
+	if (!(p->gp_flags & GPEF_WEDGE) && life &&
+	!gpt_add_wedge(arg->disk, p)) {
+		devname[0] = 0;
+		return false;
+	}
 
 	switch (usage) {
 	case logical_name:

Index: src/usr.sbin/sysinst/partman.c
diff -u src/usr.sbin/sysinst/partman.c:1.51 src/usr.sbin/sysinst/partman.c:1.52
--- src/usr.sbin/sysinst/partman.c:1.51	Sun Jan 31 22:45:46 2021
+++ src/usr.sbin/sysinst/partman.c	Sat Jul 17 11:32:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: partman.c,v 1.51 2021/01/31 22:45:46 rillig Exp $ */
+/*	$NetBSD: partman.c,v 1.52 2021/07/17 11:32:50 martin Exp $ */
 
 /*
  * Copyright 2012 Eugene Lozovoy
@@ -2847,13 +2847,13 @@ pm_menufmt(menudesc *m, int opt, void *a
 dev_status);
 			break;
 		case PM_PART:
-			if (parts->pscheme->get_part_device != NULL)
-parts->pscheme->get_part_device(
-parts,  part_num,
-dev, sizeof dev, NULL, plain_name, false,
-true);
-			else
-strcpy(dev, "-");
+			if (parts->pscheme->get_part_device == NULL ||
+			!parts->pscheme->get_part_device(
+parts,  part_num,
+dev, sizeof dev, NULL, plain_name, false,
+true))
+	strcpy(dev, "-");
+
 			parts->pscheme->get_part_info(parts,
 			part_num, );
 			if (pm_cur->mounted != NULL &&



CVS commit: src/tests/lib/libc/sys

2021-07-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jul 17 14:03:36 UTC 2021

Modified Files:
src/tests/lib/libc/sys: t_wait.c

Log Message:
PR 56313: fix eroneous = that was meant to be ==


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/lib/libc/sys/t_wait.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_wait.c
diff -u src/tests/lib/libc/sys/t_wait.c:1.9 src/tests/lib/libc/sys/t_wait.c:1.10
--- src/tests/lib/libc/sys/t_wait.c:1.9	Mon Feb  4 09:35:11 2019
+++ src/tests/lib/libc/sys/t_wait.c	Sat Jul 17 14:03:35 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: t_wait.c,v 1.9 2019/02/04 09:35:11 mrg Exp $ */
+/* $NetBSD: t_wait.c,v 1.10 2021/07/17 14:03:35 martin Exp $ */
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_wait.c,v 1.9 2019/02/04 09:35:11 mrg Exp $");
+__RCSID("$NetBSD: t_wait.c,v 1.10 2021/07/17 14:03:35 martin Exp $");
 
 #include 
 #include 
@@ -85,7 +85,7 @@ ATF_TC_BODY(wait6_exited, tc)
 	default:
 		ATF_REQUIRE(wait6(P_PID, pid, , WEXITED, , ) == pid);
 		ATF_REQUIRE(WIFEXITED(st) && WEXITSTATUS(st) == 0x5a);
-		ATF_REQUIRE(si.si_status = 0x5a5a5a5a);
+		ATF_REQUIRE(si.si_status == 0x5a5a5a5a);
 		ATF_REQUIRE(si.si_pid == pid);
 		ATF_REQUIRE(si.si_uid == getuid());
 		ATF_REQUIRE(si.si_code == CLD_EXITED);



CVS commit: src/external/gpl3/gcc/dist/gcc/ginclude

2021-07-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jul 17 16:31:51 UTC 2021

Modified Files:
src/external/gpl3/gcc/dist/gcc/ginclude: stddef.h

Log Message:
provide an equivalent alignment for __float128 for clang and i386 that
does not have it. Idea from mrg@


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/gpl3/gcc/dist/gcc/ginclude/stddef.h

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/ginclude/stddef.h
diff -u src/external/gpl3/gcc/dist/gcc/ginclude/stddef.h:1.10 src/external/gpl3/gcc/dist/gcc/ginclude/stddef.h:1.11
--- src/external/gpl3/gcc/dist/gcc/ginclude/stddef.h:1.10	Wed Jul 14 09:24:58 2021
+++ src/external/gpl3/gcc/dist/gcc/ginclude/stddef.h	Sat Jul 17 12:31:51 2021
@@ -420,9 +420,14 @@ typedef struct {
  use __float128 here; that is only available on some
  architectures, but only on i386 is extra alignment needed for
  __float128.  */
-#if defined(__i386__) && !defined(__clang__)
+#if defined(__i386__)
+#ifdef __clang__
+  // 16 is the gcc alignment for __float128
+  long long __max_align_128 __attribute__((__aligned__(16)));
+#else
   __float128 __max_align_f128 __attribute__((__aligned__(__alignof(__float128;
 #endif
+#endif
 } max_align_t;
 #endif
 #endif /* C11 or C++11.  */



CVS commit: src/sys/net

2021-07-17 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Jul 17 15:37:04 UTC 2021

Modified Files:
src/sys/net: if_vlan.c

Log Message:
Mark vlan_safe_ifpromisc_locked() as "__unused" to appease LLVM.

Maybe completely remove this short helper?


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/sys/net/if_vlan.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/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.160 src/sys/net/if_vlan.c:1.161
--- src/sys/net/if_vlan.c:1.160	Thu Jul 15 04:05:47 2021
+++ src/sys/net/if_vlan.c	Sat Jul 17 15:37:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.160 2021/07/15 04:05:47 yamaguchi Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.161 2021/07/17 15:37:04 hannken Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.160 2021/07/15 04:05:47 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.161 2021/07/17 15:37:04 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -246,7 +246,7 @@ vlan_safe_ifpromisc(struct ifnet *ifp, i
 	return e;
 }
 
-static inline int
+__unused static inline int
 vlan_safe_ifpromisc_locked(struct ifnet *ifp, int pswitch)
 {
 	int e;



CVS commit: src/usr.sbin/sysinst

2021-07-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jul 17 18:07:23 UTC 2021

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

Log Message:
PR 56310: if we fail to create a wedge this either means there is
a bug here (and we requested something nonsensial), or there are pre-
existing "foreign" wedges which disturb our work.
So remove all wedges on this disk that we do not know about and retry
to add our new wedge.


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

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

Modified files:

Index: src/usr.sbin/sysinst/gpt.c
diff -u src/usr.sbin/sysinst/gpt.c:1.24 src/usr.sbin/sysinst/gpt.c:1.25
--- src/usr.sbin/sysinst/gpt.c:1.24	Sat Jul 17 11:32:50 2021
+++ src/usr.sbin/sysinst/gpt.c	Sat Jul 17 18:07:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gpt.c,v 1.24 2021/07/17 11:32:50 martin Exp $	*/
+/*	$NetBSD: gpt.c,v 1.25 2021/07/17 18:07:22 martin Exp $	*/
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -32,6 +32,7 @@
 #include "md.h"
 #include "gpt_uuid.h"
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1325,8 +1326,71 @@ bsdlabel_fstype_to_str(uint8_t fstype)
 	return (str);
 }
 
+/*
+ * diskfd is an open file descriptor for a disk we had trouble with
+ * creating some new wedges.
+ * Go through all wedges actually on that disk, check if we have a
+ * record for them and remove all others.
+ * This should sync our internal model of partitions with the real state.
+ */
+static void
+gpt_sanitize(int diskfd, const struct gpt_disk_partitions *parts,
+struct gpt_part_entry *ignore)
+{
+	struct dkwedge_info *dkw, delw;
+	struct dkwedge_list dkwl;
+	size_t bufsize;
+	u_int i;
+
+	dkw = NULL;
+	dkwl.dkwl_buf = dkw;
+	dkwl.dkwl_bufsize = 0;
+
+	/* get a list of all wedges */
+	for (;;) {
+		if (ioctl(diskfd, DIOCLWEDGES, ) == -1)
+			return;
+		if (dkwl.dkwl_nwedges == dkwl.dkwl_ncopied)
+			break;
+		bufsize = dkwl.dkwl_nwedges * sizeof(*dkw);
+		if (dkwl.dkwl_bufsize < bufsize) {
+			dkw = realloc(dkwl.dkwl_buf, bufsize);
+			if (dkw == NULL)
+return;
+			dkwl.dkwl_buf = dkw;
+			dkwl.dkwl_bufsize = bufsize;
+		}
+	}
+
+	/* try to remove all the ones we do not know about */
+	for (i = 0; i < dkwl.dkwl_nwedges; i++) {
+		bool found = false;
+		const char *devname = dkw[i].dkw_devname;
+
+		for (struct gpt_part_entry *pe = parts->partitions;
+		pe != NULL; pe = pe->gp_next) {
+			if (pe == ignore)
+continue;
+			if ((pe->gp_flags & GPEF_WEDGE) &&
+			strcmp(pe->gp_dev_name, devname) == 0) {
+found = true;
+break;
+			}
+		}
+		if (found)
+			continue;
+		memset(, 0, sizeof(delw));
+		strncpy(delw.dkw_devname, devname, sizeof(delw.dkw_devname));
+		(void)ioctl(diskfd, DIOCDWEDGE, );
+	}
+
+	/* cleanup */
+	free(dkw);
+}
+
 static bool
-gpt_add_wedge(const char *disk, struct gpt_part_entry *p)
+gpt_add_wedge(const char *disk, struct gpt_part_entry *p,
+const struct gpt_disk_partitions *parts)
 {
 	struct dkwedge_info dkw;
 	const char *tname;
@@ -1355,9 +1419,16 @@ gpt_add_wedge(const char *disk, struct g
 	if (fd < 0)
 		return false;
 	if (ioctl(fd, DIOCAWEDGE, ) == -1) {
+		if (errno == EINVAL) {
+			/* sanitize existing wedges and try again */
+			gpt_sanitize(fd, parts, p);
+			if (ioctl(fd, DIOCAWEDGE, ) == 0)
+goto ok;
+		}
 		close(fd);
 		return false;
 	}
+ok:
 	close(fd);
 
 	strlcpy(p->gp_dev_name, dkw.dkw_devname, sizeof(p->gp_dev_name));
@@ -1405,10 +1476,8 @@ gpt_get_part_device(const struct disk_pa
 	if (usage == plain_name || usage == raw_dev_name)
 		life = true;
 	if (!(p->gp_flags & GPEF_WEDGE) && life &&
-	!gpt_add_wedge(arg->disk, p)) {
-		devname[0] = 0;
+	!gpt_add_wedge(arg->disk, p, parts))
 		return false;
-	}
 
 	switch (usage) {
 	case logical_name: