CVS commit: src/sys/arch/sparc64/dev

2023-12-08 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec  8 17:19:11 UTC 2023

Modified Files:
src/sys/arch/sparc64/dev: iommu.c

Log Message:
Change one vmem_free() in an error path that should be vmem_xfree().


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/sparc64/dev/iommu.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/sparc64/dev/iommu.c
diff -u src/sys/arch/sparc64/dev/iommu.c:1.117 src/sys/arch/sparc64/dev/iommu.c:1.118
--- src/sys/arch/sparc64/dev/iommu.c:1.117	Fri Dec  1 06:47:59 2023
+++ src/sys/arch/sparc64/dev/iommu.c	Fri Dec  8 17:19:11 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: iommu.c,v 1.117 2023/12/01 06:47:59 thorpej Exp $	*/
+/*	$NetBSD: iommu.c,v 1.118 2023/12/08 17:19:11 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: iommu.c,v 1.117 2023/12/01 06:47:59 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iommu.c,v 1.118 2023/12/08 17:19:11 thorpej Exp $");
 
 #include "opt_ddb.h"
 
@@ -1073,7 +1073,7 @@ iommu_dvmamap_load_raw(bus_dma_tag_t t, 
 	return (0);
 
 fail:
-	vmem_free(is->is_dvmamap, map->_dm_dvmastart, sgsize);
+	vmem_xfree(is->is_dvmamap, map->_dm_dvmastart, sgsize);
 	map->_dm_dvmastart = 0;
 	map->_dm_dvmasize = 0;
 	return (EFBIG);



CVS commit: src/sys/arch/sparc64/dev

2023-12-08 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec  8 17:19:11 UTC 2023

Modified Files:
src/sys/arch/sparc64/dev: iommu.c

Log Message:
Change one vmem_free() in an error path that should be vmem_xfree().


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/sparc64/dev/iommu.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/i386/stand/bootxx

2023-12-08 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Dec  8 16:29:04 UTC 2023

Modified Files:
src/sys/arch/i386/stand/bootxx: pbr.S

Log Message:
Replace several magic numbers with macro to describe GPT's hybrid MBR boot.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/i386/stand/bootxx/pbr.S

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/i386/stand/bootxx/pbr.S
diff -u src/sys/arch/i386/stand/bootxx/pbr.S:1.23 src/sys/arch/i386/stand/bootxx/pbr.S:1.24
--- src/sys/arch/i386/stand/bootxx/pbr.S:1.23	Wed May 11 14:58:00 2022
+++ src/sys/arch/i386/stand/bootxx/pbr.S	Fri Dec  8 16:29:04 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pbr.S,v 1.23 2022/05/11 14:58:00 andvar Exp $	*/
+/*	$NetBSD: pbr.S,v 1.24 2023/12/08 16:29:04 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2003,2004 The NetBSD Foundation, Inc.
@@ -71,6 +71,10 @@
 #define MBR_AFTERBPB	62		/* BPB size in floppy master BR */
 #endif
 
+#define GPT_MAGIC	0x54504721	/* '!GPT' magic on hybrid MBR boot */
+#define GPT_ENTRY_OFF	20		/* GPT part entry in handover struct */
+#define GPT_ENT_LBA_OFF	32		/* ent_lba_start in struct gpt_ent */
+
 #ifdef TERSE_ERROR
 /*
  * Error codes. Done this way to save space.
@@ -127,7 +131,7 @@ start0:
 	mov	%cx, %sp
 	mov	%cx, %es
 #ifndef BOOT_FROM_FAT
-	cmpl	$0x54504721, %eax	/* did a GPT hybrid MBR start us? */
+	cmpl	$GPT_MAGIC, %eax	/* did a GPT hybrid MBR start us? */
 	je	boot_gpt
 #endif
 	mov	%cx, %ds
@@ -366,8 +370,9 @@ chs_read:
 
 #ifndef BOOT_FROM_FAT
 boot_gpt:
-	movl	(20+32+0)(%si), %ebp
-	movl	(20+32+4)(%si), %edi
+	/* DS:SI has a pointer to the hybrid MBR handover structure */
+	movl	(GPT_ENTRY_OFF+GPT_ENT_LBA_OFF+0)(%si), %ebp
+	movl	(GPT_ENTRY_OFF+GPT_ENT_LBA_OFF+4)(%si), %edi
 	movw	%cx, %ds
 	movl	%ebp, lba_sector + 0
 	movl	%edi, lba_sector + 4



CVS commit: src/sys/arch/i386/stand/bootxx

2023-12-08 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Dec  8 16:29:04 UTC 2023

Modified Files:
src/sys/arch/i386/stand/bootxx: pbr.S

Log Message:
Replace several magic numbers with macro to describe GPT's hybrid MBR boot.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/i386/stand/bootxx/pbr.S

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



CVS commit: src/sys/arch/mipsco

2023-12-07 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec  8 01:38:20 UTC 2023

Modified Files:
src/sys/arch/mipsco/include: bus.h
src/sys/arch/mipsco/mipsco: bus_space.c

Log Message:
Excise extent(9) from the mipsco bus_space -- it was completely unused,
so let's make the code smaller.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/mipsco/include/bus.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mipsco/mipsco/bus_space.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/mipsco/include/bus.h
diff -u src/sys/arch/mipsco/include/bus.h:1.24 src/sys/arch/mipsco/include/bus.h:1.25
--- src/sys/arch/mipsco/include/bus.h:1.24	Sun Oct  8 22:10:49 2023
+++ src/sys/arch/mipsco/include/bus.h	Fri Dec  8 01:38:20 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.h,v 1.24 2023/10/08 22:10:49 andvar Exp $	*/
+/*	$NetBSD: bus.h,v 1.25 2023/12/08 01:38:20 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -115,7 +115,7 @@ typedef struct mipsco_bus_space *bus_spa
 
 struct mipsco_bus_space {
 	const char	*bs_name;
-	struct extent	*bs_extent;
+	void		*bs_spare;	/* (was previously unused extent map) */
 	bus_addr_t	bs_start;
 	bus_size_t	bs_size;
 
@@ -175,19 +175,14 @@ struct mipsco_bus_space {
 #define MIPSCO_BUS_SPACE_UNMAPPED	((vaddr_t)0)
 
 /* machine dependent utility function for bus_space users */
-void	mipsco_bus_space_malloc_set_safe(void);
 void	mipsco_bus_space_init(bus_space_tag_t, const char *,
 	paddr_t, vaddr_t, bus_addr_t, bus_size_t);
-void	mipsco_bus_space_init_extent(bus_space_tag_t, void *, size_t);
 void	mipsco_bus_space_set_aligned_stride(bus_space_tag_t, unsigned int);
 void	mipsco_sparse_bus_space_init(bus_space_tag_t, const char *,
 	paddr_t, bus_addr_t, bus_size_t);
 void	mipsco_large_bus_space_init(bus_space_tag_t, const char *,
 	paddr_t, bus_addr_t, bus_size_t);
 
-/* machine dependent utility function for bus_space implementations */
-int	mipsco_bus_space_extent_malloc_flag(void);
-
 /* these are provided for subclasses which override base bus_space. */
 
 int	mipsco_bus_space_compose_handle(bus_space_tag_t,

Index: src/sys/arch/mipsco/mipsco/bus_space.c
diff -u src/sys/arch/mipsco/mipsco/bus_space.c:1.12 src/sys/arch/mipsco/mipsco/bus_space.c:1.13
--- src/sys/arch/mipsco/mipsco/bus_space.c:1.12	Fri Jan 27 18:52:59 2012
+++ src/sys/arch/mipsco/mipsco/bus_space.c	Fri Dec  8 01:38:20 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space.c,v 1.12 2012/01/27 18:52:59 para Exp $ 	*/
+/*	$NetBSD: bus_space.c,v 1.13 2023/12/08 01:38:20 thorpej Exp $ 	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,12 +31,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_space.c,v 1.12 2012/01/27 18:52:59 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_space.c,v 1.13 2023/12/08 01:38:20 thorpej Exp $");
 
 #include 
 #include 
 #include 
-#include 
 
 #include 
 
@@ -46,7 +45,7 @@ void
 mipsco_bus_space_init(bus_space_tag_t bst, const char *name, paddr_t paddr, vaddr_t vaddr, bus_addr_t start, bus_size_t size)
 {
 	bst->bs_name = name;
-	bst->bs_extent = NULL;
+	bst->bs_spare = NULL;
 	bst->bs_start = start;
 	bst->bs_size = size;
 	bst->bs_pbase = paddr;
@@ -66,17 +65,6 @@ mipsco_bus_space_init(bus_space_tag_t bs
 }
 
 void
-mipsco_bus_space_init_extent(bus_space_tag_t bst, void *storage, size_t storagesize)
-{
-	bst->bs_extent = extent_create(bst->bs_name,
-	bst->bs_start, bst->bs_start + bst->bs_size,
-	storage, storagesize, EX_NOWAIT);
-	if (bst->bs_extent == NULL)
-	panic("mipsco_bus_space_init_extent: cannot create extent map %s",
-		  bst->bs_name);
-}
-
-void
 mipsco_bus_space_set_aligned_stride(bus_space_tag_t bst, unsigned int shift)
 	/* shift:		 log2(alignment) */
 {
@@ -93,20 +81,6 @@ mipsco_bus_space_set_aligned_stride(bus_
 	bst->bs_offset_8 = 0;
 }
 
-static int malloc_safe = 0;
-
-void
-mipsco_bus_space_malloc_set_safe(void)
-{
-	malloc_safe = EX_MALLOCOK;
-}
-
-int
-mipsco_bus_space_extent_malloc_flag(void)
-{
-	return (malloc_safe);
-}
-
 int
 mipsco_bus_space_compose_handle(bus_space_tag_t bst, bus_addr_t addr, bus_size_t size, int flags, bus_space_handle_t *bshp)
 {
@@ -171,38 +145,16 @@ mipsco_bus_space_paddr(bus_space_tag_t b
 int
 mipsco_bus_space_map(bus_space_tag_t bst, bus_addr_t addr, bus_size_t size, int flags, bus_space_handle_t *bshp)
 {
-	int err;
 
 	if (addr < bst->bs_start || addr + size > bst->bs_start + bst->bs_size)
 		return (EINVAL);
 
-	if (bst->bs_extent != NULL) {
-		err = extent_alloc_region(bst->bs_extent, addr, size,
-		EX_NOWAIT | malloc_safe);
-		if (err)
-			return (err);
-	}
-
 	return (bus_space_compose_handle(bst, addr, size, flags, bshp));
 }
 
 void
 mipsco_bus_space_unmap(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t size)
 {
-	if (bst->bs_extent != NULL) {
-		paddr_t pa;
-		bus_addr_t addr;
-		int err;
-
-		/* 

CVS commit: src/sys/arch/mipsco

2023-12-07 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec  8 01:38:20 UTC 2023

Modified Files:
src/sys/arch/mipsco/include: bus.h
src/sys/arch/mipsco/mipsco: bus_space.c

Log Message:
Excise extent(9) from the mipsco bus_space -- it was completely unused,
so let's make the code smaller.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/mipsco/include/bus.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mipsco/mipsco/bus_space.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/atari

2023-12-07 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Dec  7 16:56:09 UTC 2023

Modified Files:
src/sys/arch/atari/atari: atari_init.c bus.c machdep.c
src/sys/arch/atari/include: bus_funcs.h

Log Message:
extent(9) -> vmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/arch/atari/atari/atari_init.c
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/atari/atari/bus.c
cvs rdiff -u -r1.188 -r1.189 src/sys/arch/atari/atari/machdep.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/atari/include/bus_funcs.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/atari/atari/atari_init.c
diff -u src/sys/arch/atari/atari/atari_init.c:1.107 src/sys/arch/atari/atari/atari_init.c:1.108
--- src/sys/arch/atari/atari/atari_init.c:1.107	Fri Jan  6 10:28:27 2023
+++ src/sys/arch/atari/atari/atari_init.c	Thu Dec  7 16:56:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: atari_init.c,v 1.107 2023/01/06 10:28:27 tsutsui Exp $	*/
+/*	$NetBSD: atari_init.c,v 1.108 2023/12/07 16:56:09 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.107 2023/01/06 10:28:27 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.108 2023/12/07 16:56:09 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mbtype.h"
@@ -671,10 +671,10 @@ start_c(int id, u_int ttphystart, u_int 
 	init_stmem();
 
 	/*
-	 * Initialize the iomem extent for bus_space(9) to manage address
+	 * Initialize the iomem arena for bus_space(9) to manage address
 	 * spaces and allocate the physical RAM from the extent map.
 	 */
-	atari_bus_space_extent_init(0x0, 0x);
+	atari_bus_space_arena_init(0x0, 0x);
 	for (i = 0; i < NMEM_SEGS && boot_segs[i].end != 0; i++) {
 		if (atari_bus_space_alloc_physmem(boot_segs[i].start,
 		boot_segs[i].end)) {

Index: src/sys/arch/atari/atari/bus.c
diff -u src/sys/arch/atari/atari/bus.c:1.68 src/sys/arch/atari/atari/bus.c:1.69
--- src/sys/arch/atari/atari/bus.c:1.68	Fri Jan  6 10:28:27 2023
+++ src/sys/arch/atari/atari/bus.c	Thu Dec  7 16:56:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.c,v 1.68 2023/01/06 10:28:27 tsutsui Exp $	*/
+/*	$NetBSD: bus.c,v 1.69 2023/12/07 16:56:09 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #include "opt_m68k_arch.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.68 2023/01/06 10:28:27 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.69 2023/12/07 16:56:09 thorpej Exp $");
 
 #include 
 #include 
@@ -41,6 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.68
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -50,16 +51,16 @@ __KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.68
 #include 
 
 /*
- * Extent maps to manage all memory space, including I/O ranges.  Allocate
- * storage for 16 regions in each, initially.  Later, iomem_malloc_safe
- * will indicate that it's safe to use malloc() to dynamically allocate
- * region descriptors.
+ * Vmem arena to manage all memory space, including I/O ranges.  Allocate
+ * storage for 16 regions in each, initially.
+ *
  * This means that the fixed static storage is only used for registrating
  * the found memory regions and the bus-mapping of the console.
  */
-static long iomem_ex_storage[EXTENT_FIXED_STORAGE_SIZE(16) / sizeof(long)];
-static struct extent *iomem_ex;
-static int iomem_malloc_safe = 0;
+#define	IOMEM_BTAG_COUNT	VMEM_EST_BTCOUNT(1, 16)
+static struct vmem iomem_arena_store;
+static struct vmem_btag iomem_btag_store[IOMEM_BTAG_COUNT];
+static vmem_t *iomem_arena;
 
 static int  _bus_dmamap_load_buffer(bus_dma_tag_t tag, bus_dmamap_t,
 		void *, bus_size_t, struct vmspace *, int, paddr_t *,
@@ -80,9 +81,12 @@ extern paddr_t avail_end;
  * very early stage of the system configuration.
  */
 static pt_entry_t	*bootm_ptep;
-static long		bootm_ex_storage[EXTENT_FIXED_STORAGE_SIZE(32) /
-sizeof(long)];
-static struct extent	*bootm_ex;
+static vaddr_t		 bootm_start;
+static vaddr_t		 bootm_end;		/* inclusive */
+#define	BOOTM_BTAG_COUNT	VMEM_EST_BTCOUNT(1, 32)
+static struct vmem	 bootm_arena_store;
+static struct vmem_btag	 bootm_btag_store[BOOTM_BTAG_COUNT];
+static vmem_t *		 bootm_arena;
 
 static vaddr_t	bootm_alloc(paddr_t pa, u_long size, int flags);
 static int	bootm_free(vaddr_t va, u_long size);
@@ -91,10 +95,24 @@ void
 bootm_init(vaddr_t va, void *ptep, vsize_t size)
 {
 
-	bootm_ex = extent_create("bootmem", va, va + size,
-	(void *)bootm_ex_storage, sizeof(bootm_ex_storage),
-	EX_NOCOALESCE|EX_NOWAIT);
+	bootm_start = va;
+	bootm_end = va + size - 1;
 	bootm_ptep = (pt_entry_t *)ptep;
+
+	bootm_arena = vmem_init(_arena_store,
+"bootmem",		/* name */
+0,			/* addr */
+0,			/* size */
+PAGE_SIZE,		/* quantum */
+NULL,			/* importfn */
+NULL,			/* releasefn */
+NULL,			/* source */
+0,			/* qcache_max */
+

CVS commit: src/sys/arch/atari

2023-12-07 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Dec  7 16:56:09 UTC 2023

Modified Files:
src/sys/arch/atari/atari: atari_init.c bus.c machdep.c
src/sys/arch/atari/include: bus_funcs.h

Log Message:
extent(9) -> vmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/arch/atari/atari/atari_init.c
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/atari/atari/bus.c
cvs rdiff -u -r1.188 -r1.189 src/sys/arch/atari/atari/machdep.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/atari/include/bus_funcs.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/arc

2023-12-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Dec  7 03:46:10 UTC 2023

Modified Files:
src/sys/arch/arc/arc: bus_space.c machdep.c wired_map_machdep.c
src/sys/arch/arc/include: bus_defs.h bus_funcs.h
src/sys/arch/arc/isa: isabus.c
src/sys/arch/arc/pci: necpb.c

Log Message:
extent(9) -> vmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arc/arc/bus_space.c
cvs rdiff -u -r1.131 -r1.132 src/sys/arch/arc/arc/machdep.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arc/arc/wired_map_machdep.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arc/include/bus_defs.h \
src/sys/arch/arc/include/bus_funcs.h
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/arc/isa/isabus.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/arc/pci/necpb.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/arc

2023-12-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Dec  7 03:46:10 UTC 2023

Modified Files:
src/sys/arch/arc/arc: bus_space.c machdep.c wired_map_machdep.c
src/sys/arch/arc/include: bus_defs.h bus_funcs.h
src/sys/arch/arc/isa: isabus.c
src/sys/arch/arc/pci: necpb.c

Log Message:
extent(9) -> vmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arc/arc/bus_space.c
cvs rdiff -u -r1.131 -r1.132 src/sys/arch/arc/arc/machdep.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arc/arc/wired_map_machdep.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arc/include/bus_defs.h \
src/sys/arch/arc/include/bus_funcs.h
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/arc/isa/isabus.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/arc/pci/necpb.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/arc/arc/bus_space.c
diff -u src/sys/arch/arc/arc/bus_space.c:1.12 src/sys/arch/arc/arc/bus_space.c:1.13
--- src/sys/arch/arc/arc/bus_space.c:1.12	Fri Jan 27 18:52:49 2012
+++ src/sys/arch/arc/arc/bus_space.c	Thu Dec  7 03:46:10 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space.c,v 1.12 2012/01/27 18:52:49 para Exp $	*/
+/*	$NetBSD: bus_space.c,v 1.13 2023/12/07 03:46:10 thorpej Exp $	*/
 /*	NetBSD: bus_machdep.c,v 1.1 2000/01/26 18:48:00 drochner Exp 	*/
 
 /*-
@@ -32,12 +32,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_space.c,v 1.12 2012/01/27 18:52:49 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_space.c,v 1.13 2023/12/07 03:46:10 thorpej Exp $");
 
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 
@@ -316,7 +316,7 @@ arc_bus_space_init(bus_space_tag_t bst, 
 {
 
 	bst->bs_name = name;
-	bst->bs_extent = NULL;
+	bst->bs_arena = NULL;
 	bst->bs_start = start;
 	bst->bs_size = size;
 	bst->bs_pbase = paddr;
@@ -338,16 +338,28 @@ arc_bus_space_init(bus_space_tag_t bst, 
 }
 
 void
-arc_bus_space_init_extent(bus_space_tag_t bst, void *storage,
-size_t storagesize)
+arc_bus_space_init_arena(bus_space_tag_t bst, struct vmem *arena_store,
+struct vmem_btag *btag_store, unsigned int btag_count)
 {
+	int error __diagused;
 
-	bst->bs_extent = extent_create(bst->bs_name,
-	bst->bs_start, bst->bs_start + bst->bs_size,
-	storage, storagesize, EX_NOWAIT);
-	if (bst->bs_extent == NULL)
-		panic("arc_bus_space_init_extent: cannot create extent map %s",
-		bst->bs_name);
+	bst->bs_arena = vmem_init(arena_store,
+  bst->bs_name,		/* name */
+  0,			/* addr */
+  0,			/* size */
+  1,			/* quantum */
+  NULL,			/* importfn */
+  NULL,			/* releasefn */
+  NULL,			/* source */
+  0,			/* qcache_max */
+  VM_NOSLEEP | VM_PRIVTAGS,
+  IPL_NONE);
+	KASSERT(bst->bs_arena != NULL);
+
+	vmem_add_bts(bst->bs_arena, btag_store, btag_count);
+	error = vmem_add(bst->bs_arena, bst->bs_start, bst->bs_size,
+	VM_NOSLEEP);
+	KASSERT(error == 0);
 }
 
 void
@@ -367,22 +379,6 @@ arc_bus_space_set_aligned_stride(bus_spa
 	bst->bs_stride_8 = alignment_shift;
 }
 
-static int malloc_safe = 0;
-
-void
-arc_bus_space_malloc_set_safe(void)
-{
-
-	malloc_safe = EX_MALLOCOK;
-}
-
-int
-arc_bus_space_extent_malloc_flag(void)
-{
-
-	return malloc_safe;
-}
-
 int
 arc_bus_space_compose_handle(bus_space_tag_t bst, bus_addr_t addr,
 bus_size_t size, int flags, bus_space_handle_t *bshp)
@@ -457,9 +453,8 @@ arc_bus_space_map(bus_space_tag_t bst, b
 	if (addr < bst->bs_start || addr + size > bst->bs_start + bst->bs_size)
 		return EINVAL;
 
-	if (bst->bs_extent != NULL) {
-		err = extent_alloc_region(bst->bs_extent, addr, size,
-		EX_NOWAIT | malloc_safe);
+	if (bst->bs_arena != NULL) {
+		err = vmem_xalloc_addr(bst->bs_arena, addr, size, VM_NOSLEEP);
 		if (err)
 			return err;
 	}
@@ -472,7 +467,7 @@ arc_bus_space_unmap(bus_space_tag_t bst,
 bus_size_t size)
 {
 
-	if (bst->bs_extent != NULL) {
+	if (bst->bs_arena != NULL) {
 		paddr_t pa;
 		bus_addr_t addr;
 		int err;
@@ -483,8 +478,7 @@ arc_bus_space_unmap(bus_space_tag_t bst,
 			panic("arc_bus_space_unmap: %s va 0x%qx: error %d",
 			bst->bs_name, (unsigned long long) bsh, err);
 		addr = (bus_size_t)(pa - bst->bs_pbase) + bst->bs_start;
-		extent_free(bst->bs_extent, addr, size,
-		EX_NOWAIT | malloc_safe);
+		vmem_xfree(bst->bs_arena, addr, size);
 	}
 	bus_space_dispose_handle(bst, bsh, size);
 }
@@ -520,19 +514,25 @@ arc_bus_space_alloc(bus_space_tag_t bst,
 bus_size_t size, bus_size_t align, bus_size_t boundary, int flags,
 bus_addr_t *addrp, bus_space_handle_t *bshp)
 {
-	u_long addr;
+	vmem_addr_t addr;
 	int err;
 
-	if (bst->bs_extent == NULL)
-		panic("arc_bus_space_alloc: extent map %s not available",
+	if (bst->bs_arena == NULL)
+		panic("arc_bus_space_alloc: vmem arena %s not available",
 		bst->bs_name);
 
 	if (start < bst->bs_start ||
 	start + size > bst->bs_start + bst->bs_size)
 		return EINVAL;
 
-	err = 

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

2023-12-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec  6 01:46:34 UTC 2023

Modified Files:
src/sys/arch/alpha/pci: pci_bwx_bus_io_chipdep.c
pci_bwx_bus_mem_chipdep.c pci_swiz_bus_io_chipdep.c

Log Message:
bus_space_alloc() -- vmem(9) requires an allocation stragegy flag, so
make sure to pass one.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.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/pci_bwx_bus_io_chipdep.c
diff -u src/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c:1.23 src/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c:1.24
--- src/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c:1.23	Mon Dec  4 00:32:10 2023
+++ src/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c	Wed Dec  6 01:46:34 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_bwx_bus_io_chipdep.c,v 1.23 2023/12/04 00:32:10 thorpej Exp $ */
+/* $NetBSD: pci_bwx_bus_io_chipdep.c,v 1.24 2023/12/06 01:46:34 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: pci_bwx_bus_io_chipdep.c,v 1.23 2023/12/04 00:32:10 thorpej Exp $");
+__KERNEL_RCSID(1, "$NetBSD: pci_bwx_bus_io_chipdep.c,v 1.24 2023/12/06 01:46:34 thorpej Exp $");
 
 #include 
 
@@ -486,7 +486,7 @@ __C(CHIP,_io_alloc)(
 			boundary,		/* nocross */
 			rstart,		/* minaddr */
 			rend,		/* maxaddr */
-			VM_NOSLEEP,
+			VM_BESTFIT | VM_NOSLEEP,
 			);
 	if (error) {
 #ifdef EXTENT_DEBUG

Index: src/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c
diff -u src/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c:1.29 src/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c:1.30
--- src/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c:1.29	Mon Dec  4 00:32:10 2023
+++ src/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c	Wed Dec  6 01:46:34 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_bwx_bus_mem_chipdep.c,v 1.29 2023/12/04 00:32:10 thorpej Exp $ */
+/* $NetBSD: pci_bwx_bus_mem_chipdep.c,v 1.30 2023/12/06 01:46:34 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: pci_bwx_bus_mem_chipdep.c,v 1.29 2023/12/04 00:32:10 thorpej Exp $");
+__KERNEL_RCSID(1, "$NetBSD: pci_bwx_bus_mem_chipdep.c,v 1.30 2023/12/06 01:46:34 thorpej Exp $");
 
 #include 
 
@@ -467,7 +467,7 @@ __C(CHIP,_mem_alloc)(
 			boundary,		/* nocross */
 			rstart,		/* minaddr */
 			rend,		/* maxaddr */
-			VM_NOSLEEP,
+			VM_BESTFIT | VM_NOSLEEP,
 			);
 	if (error) {
 #ifdef EXTENT_DEBUG

Index: src/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c
diff -u src/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c:1.44 src/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c:1.45
--- src/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c:1.44	Mon Dec  4 00:32:10 2023
+++ src/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c	Wed Dec  6 01:46:34 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_swiz_bus_io_chipdep.c,v 1.44 2023/12/04 00:32:10 thorpej Exp $ */
+/* $NetBSD: pci_swiz_bus_io_chipdep.c,v 1.45 2023/12/06 01:46:34 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: pci_swiz_bus_io_chipdep.c,v 1.44 2023/12/04 00:32:10 thorpej Exp $");
+__KERNEL_RCSID(1, "$NetBSD: pci_swiz_bus_io_chipdep.c,v 1.45 2023/12/06 01:46:34 thorpej Exp $");
 
 #include 
 
@@ -573,7 +573,7 @@ __C(CHIP,_io_alloc)(void *v, bus_addr_t 
 			boundary,		/* nocross */
 			rstart,		/* minaddr */
 			rend,		/* maxaddr */
-			VM_NOSLEEP,
+			VM_BESTFIT | VM_NOSLEEP,
 			);
 	if (error) {
 #ifdef EXTENT_DEBUG



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

2023-12-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec  6 01:46:34 UTC 2023

Modified Files:
src/sys/arch/alpha/pci: pci_bwx_bus_io_chipdep.c
pci_bwx_bus_mem_chipdep.c pci_swiz_bus_io_chipdep.c

Log Message:
bus_space_alloc() -- vmem(9) requires an allocation stragegy flag, so
make sure to pass one.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.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/x68k/dev

2023-12-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Dec  5 22:24:40 UTC 2023

Modified Files:
src/sys/arch/x68k/dev: mha.c

Log Message:
s/pregress/progress/ in panic message.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/x68k/dev/mha.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/x68k/dev/mha.c
diff -u src/sys/arch/x68k/dev/mha.c:1.58 src/sys/arch/x68k/dev/mha.c:1.59
--- src/sys/arch/x68k/dev/mha.c:1.58	Thu May 26 14:33:29 2022
+++ src/sys/arch/x68k/dev/mha.c	Tue Dec  5 22:24:40 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mha.c,v 1.58 2022/05/26 14:33:29 tsutsui Exp $	*/
+/*	$NetBSD: mha.c,v 1.59 2023/12/05 22:24:40 andvar Exp $	*/
 
 /*-
  * Copyright (c) 1996-1999 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mha.c,v 1.58 2022/05/26 14:33:29 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mha.c,v 1.59 2023/12/05 22:24:40 andvar Exp $");
 
 #include "opt_ddb.h"
 
@@ -1566,7 +1566,7 @@ mha_dataio_dma(int dw, int cw, struct mh
 	if (n > MAXBSIZE)
 		panic("transfer size exceeds MAXBSIZE");
 	if (sc->sc_dmasize > 0)
-		panic("DMA request while another DMA transfer is in pregress");
+		panic("DMA request while another DMA transfer is in progress");
 
 	if (cw == CMD_SEND_FROM_DMA) {
 		memcpy(sc->sc_dmabuf, p, n);



CVS commit: src/sys/arch/x68k/dev

2023-12-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Dec  5 22:24:40 UTC 2023

Modified Files:
src/sys/arch/x68k/dev: mha.c

Log Message:
s/pregress/progress/ in panic message.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/x68k/dev/mha.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/sgimips/hpc

2023-12-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Dec  5 21:54:53 UTC 2023

Modified Files:
src/sys/arch/sgimips/hpc: if_sq.c

Log Message:
add explicit braces around SQ_DPRINTF() to fix dangling else compiler error.

fixes build with SQ_DEBUG option enabled for sgimips.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/sgimips/hpc/if_sq.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/sgimips/hpc/if_sq.c
diff -u src/sys/arch/sgimips/hpc/if_sq.c:1.55 src/sys/arch/sgimips/hpc/if_sq.c:1.56
--- src/sys/arch/sgimips/hpc/if_sq.c:1.55	Sun Sep 18 13:23:53 2022
+++ src/sys/arch/sgimips/hpc/if_sq.c	Tue Dec  5 21:54:53 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sq.c,v 1.55 2022/09/18 13:23:53 thorpej Exp $	*/
+/*	$NetBSD: if_sq.c,v 1.56 2023/12/05 21:54:53 andvar Exp $	*/
 
 /*
  * Copyright (c) 2001 Rafal K. Boni
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sq.c,v 1.55 2022/09/18 13:23:53 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sq.c,v 1.56 2023/12/05 21:54:53 andvar Exp $");
 
 
 #include 
@@ -896,10 +896,10 @@ sq_intr(void *arg)
 
 	stat = sq_hpc_read(sc, sc->hpc_regs->enetr_reset);
 
-	if ((stat & 2) == 0)
+	if ((stat & 2) == 0) {
 		SQ_DPRINTF(("%s: Unexpected interrupt!\n",
 		device_xname(sc->sc_dev)));
-	else
+	} else
 		sq_hpc_write(sc, sc->hpc_regs->enetr_reset, (stat | 2));
 
 	/*



CVS commit: src/sys/arch/sgimips/hpc

2023-12-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Dec  5 21:54:53 UTC 2023

Modified Files:
src/sys/arch/sgimips/hpc: if_sq.c

Log Message:
add explicit braces around SQ_DPRINTF() to fix dangling else compiler error.

fixes build with SQ_DEBUG option enabled for sgimips.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/sgimips/hpc/if_sq.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/sbmips/sbmips

2023-12-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Dec  5 19:19:26 UTC 2023

Modified Files:
src/sys/arch/sbmips/sbmips: cpu.c machdep.c sb1250_icu.c

Log Message:
use kcpuset_isset() and pass second (NULL) argument to mips_fixup_exceptions()
to fix build for GENERIC(64).MP kernel configs.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/sbmips/sbmips/cpu.c
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/sbmips/sbmips/machdep.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sbmips/sbmips/sb1250_icu.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/sbmips/sbmips/cpu.c
diff -u src/sys/arch/sbmips/sbmips/cpu.c:1.23 src/sys/arch/sbmips/sbmips/cpu.c:1.24
--- src/sys/arch/sbmips/sbmips/cpu.c:1.23	Thu Jul 21 17:02:15 2016
+++ src/sys/arch/sbmips/sbmips/cpu.c	Tue Dec  5 19:19:26 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.23 2016/07/21 17:02:15 christos Exp $ */
+/* $NetBSD: cpu.c,v 1.24 2023/12/05 19:19:26 andvar Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.23 2016/07/21 17:02:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.24 2023/12/05 19:19:26 andvar Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -150,13 +150,12 @@ cpu_attach(device_t parent, device_t sel
 			aprint_error(": CFE call to start failed: %d\n",
 			status);
 		}
-		const u_long cpu_mask = 1L << cpu_index(ci);
 		for (size_t i = 0; i < 1; i++) {
-			if (cpus_hatched & cpu_mask)
+			if (kcpuset_isset(cpus_hatched, cpu_index(ci)))
  break;
 			DELAY(100);
 		}
-		if ((cpus_hatched & cpu_mask) == 0) {
+		if (!kcpuset_isset(cpus_hatched, cpu_index(ci))) {
 			aprint_error(": failed to hatch!\n");
 			return;
 		}

Index: src/sys/arch/sbmips/sbmips/machdep.c
diff -u src/sys/arch/sbmips/sbmips/machdep.c:1.55 src/sys/arch/sbmips/sbmips/machdep.c:1.56
--- src/sys/arch/sbmips/sbmips/machdep.c:1.55	Mon Nov  6 03:47:48 2017
+++ src/sys/arch/sbmips/sbmips/machdep.c	Tue Dec  5 19:19:26 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.55 2017/11/06 03:47:48 christos Exp $ */
+/* $NetBSD: machdep.c,v 1.56 2023/12/05 19:19:26 andvar Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.55 2017/11/06 03:47:48 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.56 2023/12/05 19:19:26 andvar Exp $");
 
 #include "opt_ddb.h"
 #include "opt_execfmt.h"
@@ -319,7 +319,7 @@ mach_init(long fwhandle, long magic, lon
 	}
 
 #ifdef MULTIPROCESSOR
-	mips_fixup_exceptions(mips_fixup_zero_relative);
+	mips_fixup_exceptions(mips_fixup_zero_relative, NULL);
 #endif
 }
 

Index: src/sys/arch/sbmips/sbmips/sb1250_icu.c
diff -u src/sys/arch/sbmips/sbmips/sb1250_icu.c:1.14 src/sys/arch/sbmips/sbmips/sb1250_icu.c:1.15
--- src/sys/arch/sbmips/sbmips/sb1250_icu.c:1.14	Thu Jul 21 17:02:15 2016
+++ src/sys/arch/sbmips/sbmips/sb1250_icu.c	Tue Dec  5 19:19:26 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: sb1250_icu.c,v 1.14 2016/07/21 17:02:15 christos Exp $ */
+/* $NetBSD: sb1250_icu.c,v 1.15 2023/12/05 19:19:26 andvar Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sb1250_icu.c,v 1.14 2016/07/21 17:02:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sb1250_icu.c,v 1.15 2023/12/05 19:19:26 andvar Exp $");
 
 #define	__INTR_PRIVATE
 
@@ -179,7 +179,7 @@ sb1250_lsw_send_ipi(struct cpu_info *ci,
 	struct cpu_softc * const cpu = ci->ci_softc;
 	const uint64_t mbox_mask = 1LLU << tag;
 
-	if (cpus_running & (1 << cpu_index(ci)))
+	if (kcpuset_isset(cpus_running, cpu_index(ci)))
 		WRITE_REG(cpu->sb1cpu_imr_base + R_IMR_MAILBOX_SET_CPU, mbox_mask);
 
 	return 0;



CVS commit: src/sys/arch/sbmips/sbmips

2023-12-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Dec  5 19:19:26 UTC 2023

Modified Files:
src/sys/arch/sbmips/sbmips: cpu.c machdep.c sb1250_icu.c

Log Message:
use kcpuset_isset() and pass second (NULL) argument to mips_fixup_exceptions()
to fix build for GENERIC(64).MP kernel configs.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/sbmips/sbmips/cpu.c
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/sbmips/sbmips/machdep.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sbmips/sbmips/sb1250_icu.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/evbmips/sbmips

2023-12-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Dec  5 19:16:49 UTC 2023

Modified Files:
src/sys/arch/evbmips/sbmips: cpu.c machdep.c sb1250_icu.c

Log Message:
use kcpuset_isset() and pass second (NULL) argument to mips_fixup_exceptions()
to fix build for SBMIPS(64).MP kernel configs.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbmips/sbmips/cpu.c \
src/sys/arch/evbmips/sbmips/sb1250_icu.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbmips/sbmips/machdep.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/evbmips/sbmips/cpu.c
diff -u src/sys/arch/evbmips/sbmips/cpu.c:1.3 src/sys/arch/evbmips/sbmips/cpu.c:1.4
--- src/sys/arch/evbmips/sbmips/cpu.c:1.3	Wed Aug  2 12:23:43 2017
+++ src/sys/arch/evbmips/sbmips/cpu.c	Tue Dec  5 19:16:48 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.3 2017/08/02 12:23:43 simonb Exp $ */
+/* $NetBSD: cpu.c,v 1.4 2023/12/05 19:16:48 andvar Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.3 2017/08/02 12:23:43 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.4 2023/12/05 19:16:48 andvar Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -151,13 +151,12 @@ cpu_attach(device_t parent, device_t sel
 			aprint_error(": CFE call to start failed: %d\n",
 			status);
 		}
-		const u_long cpu_mask = 1L << cpu_index(ci);
 		for (size_t i = 0; i < 1; i++) {
-			if (cpus_hatched & cpu_mask)
+			if (kcpuset_isset(cpus_hatched, cpu_index(ci)))
  break;
 			DELAY(100);
 		}
-		if ((cpus_hatched & cpu_mask) == 0) {
+		if (!kcpuset_isset(cpus_hatched, cpu_index(ci))) {
 			aprint_error(": failed to hatch!\n");
 			return;
 		}
Index: src/sys/arch/evbmips/sbmips/sb1250_icu.c
diff -u src/sys/arch/evbmips/sbmips/sb1250_icu.c:1.3 src/sys/arch/evbmips/sbmips/sb1250_icu.c:1.4
--- src/sys/arch/evbmips/sbmips/sb1250_icu.c:1.3	Thu Apr 11 01:53:41 2019
+++ src/sys/arch/evbmips/sbmips/sb1250_icu.c	Tue Dec  5 19:16:48 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: sb1250_icu.c,v 1.3 2019/04/11 01:53:41 simonb Exp $ */
+/* $NetBSD: sb1250_icu.c,v 1.4 2023/12/05 19:16:48 andvar Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sb1250_icu.c,v 1.3 2019/04/11 01:53:41 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sb1250_icu.c,v 1.4 2023/12/05 19:16:48 andvar Exp $");
 
 #define	__INTR_PRIVATE
 
@@ -179,7 +179,7 @@ sb1250_lsw_send_ipi(struct cpu_info *ci,
 	struct cpu_softc * const cpu = ci->ci_softc;
 	const uint64_t mbox_mask = 1LLU << tag;
 
-	if (cpus_running & (1 << cpu_index(ci)))
+	if (kcpuset_isset(cpus_running, cpu_index(ci)))
 		WRITE_REG(cpu->sb1cpu_imr_base + R_IMR_MAILBOX_SET_CPU, mbox_mask);
 
 	return 0;

Index: src/sys/arch/evbmips/sbmips/machdep.c
diff -u src/sys/arch/evbmips/sbmips/machdep.c:1.5 src/sys/arch/evbmips/sbmips/machdep.c:1.6
--- src/sys/arch/evbmips/sbmips/machdep.c:1.5	Mon Apr  1 06:33:57 2019
+++ src/sys/arch/evbmips/sbmips/machdep.c	Tue Dec  5 19:16:48 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.5 2019/04/01 06:33:57 simonb Exp $ */
+/* $NetBSD: machdep.c,v 1.6 2023/12/05 19:16:48 andvar Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.5 2019/04/01 06:33:57 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.6 2023/12/05 19:16:48 andvar Exp $");
 
 #include "opt_ddb.h"
 #include "opt_execfmt.h"
@@ -334,7 +334,7 @@ mach_init(long fwhandle, long magic, lon
 	}
 
 #ifdef MULTIPROCESSOR
-	mips_fixup_exceptions(mips_fixup_zero_relative);
+	mips_fixup_exceptions(mips_fixup_zero_relative, NULL);
 #endif
 }
 



CVS commit: src/sys/arch/evbmips/sbmips

2023-12-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Dec  5 19:16:49 UTC 2023

Modified Files:
src/sys/arch/evbmips/sbmips: cpu.c machdep.c sb1250_icu.c

Log Message:
use kcpuset_isset() and pass second (NULL) argument to mips_fixup_exceptions()
to fix build for SBMIPS(64).MP kernel configs.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbmips/sbmips/cpu.c \
src/sys/arch/evbmips/sbmips/sb1250_icu.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbmips/sbmips/machdep.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/mips/mips

2023-12-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Dec  5 17:38:40 UTC 2023

Modified Files:
src/sys/arch/mips/mips: lock_stubs_llsc.S

Log Message:
Add missing PTR_WORD command in front of 0.

Likely accidentally missed in the commit, since rev 1.9.

In theory needs pull-ups for netbsd-9, -10, but nobody noticed for 4 years...


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/mips/mips/lock_stubs_llsc.S

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/mips/mips/lock_stubs_llsc.S
diff -u src/sys/arch/mips/mips/lock_stubs_llsc.S:1.17 src/sys/arch/mips/mips/lock_stubs_llsc.S:1.18
--- src/sys/arch/mips/mips/lock_stubs_llsc.S:1.17	Sun Feb 27 19:22:29 2022
+++ src/sys/arch/mips/mips/lock_stubs_llsc.S	Tue Dec  5 17:38:40 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs_llsc.S,v 1.17 2022/02/27 19:22:29 riastradh Exp $	*/
+/*	$NetBSD: lock_stubs_llsc.S,v 1.18 2023/12/05 17:38:40 andvar Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 
 #include 
 
-RCSID("$NetBSD: lock_stubs_llsc.S,v 1.17 2022/02/27 19:22:29 riastradh Exp $")
+RCSID("$NetBSD: lock_stubs_llsc.S,v 1.18 2023/12/05 17:38:40 andvar Exp $")
 
 #include "assym.h"
 
@@ -362,7 +362,7 @@ EXPORT_OBJECT(mips_llsc_locore_atomicvec
 #ifdef _LP64
 	PTR_WORD	llsc_ucas_64
 #else
-			0
+	PTR_WORD	0
 #endif /* _LP64 */
 #ifdef LOCKDEBUG
 	PTR_WORD	mutex_vector_enter



CVS commit: src/sys/arch/mips/mips

2023-12-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Dec  5 17:38:40 UTC 2023

Modified Files:
src/sys/arch/mips/mips: lock_stubs_llsc.S

Log Message:
Add missing PTR_WORD command in front of 0.

Likely accidentally missed in the commit, since rev 1.9.

In theory needs pull-ups for netbsd-9, -10, but nobody noticed for 4 years...


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/mips/mips/lock_stubs_llsc.S

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



CVS commit: src/sys/arch

2023-12-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Dec  5 16:32:38 UTC 2023

Modified Files:
src/sys/arch/amd64/conf: ALL files.amd64
src/sys/arch/i386/conf: ALL

Log Message:
Add btvmei + btvmeii and vme to ALL.


To generate a diff of this commit:
cvs rdiff -u -r1.181 -r1.182 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.121 -r1.122 src/sys/arch/amd64/conf/files.amd64
cvs rdiff -u -r1.512 -r1.513 src/sys/arch/i386/conf/ALL

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/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.181 src/sys/arch/amd64/conf/ALL:1.182
--- src/sys/arch/amd64/conf/ALL:1.181	Wed Oct  4 07:48:55 2023
+++ src/sys/arch/amd64/conf/ALL	Tue Dec  5 16:32:38 2023
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.181 2023/10/04 07:48:55 rin Exp $
+# $NetBSD: ALL,v 1.182 2023/12/05 16:32:38 thorpej Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.181 $"
+#ident		"ALL-$Revision: 1.182 $"
 
 maxusers	64		# estimated number of users
 
@@ -489,6 +489,13 @@ cardslot*	at cbb?
 cardbus*	at cardslot?
 pcmcia* 	at cardslot?
 
+# VME bridge support
+btvmei*		at pci? dev ? function ?
+btvmeii*	at pci? dev ? function ?
+
+# VME bus support
+vme*		at vmebus?
+
 # Coprocessor Support
 
 # Console Devices

Index: src/sys/arch/amd64/conf/files.amd64
diff -u src/sys/arch/amd64/conf/files.amd64:1.121 src/sys/arch/amd64/conf/files.amd64:1.122
--- src/sys/arch/amd64/conf/files.amd64:1.121	Fri May  5 00:34:41 2023
+++ src/sys/arch/amd64/conf/files.amd64	Tue Dec  5 16:32:38 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: files.amd64,v 1.121 2023/05/05 00:34:41 manu Exp $
+#	$NetBSD: files.amd64,v 1.122 2023/12/05 16:32:38 thorpej Exp $
 #
 # new style config file for amd64 architecture
 #
@@ -197,4 +197,7 @@ include "dev/hyperv/files.hyperv"
 attach	vmbus at acpinodebus with vmbus_acpi
 file	dev/acpi/vmbus_acpi.c			vmbus_acpi
 
+# VMEbus support
+include "dev/vme/files.vme"
+
 include	"arch/amd64/conf/majors.amd64"

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.512 src/sys/arch/i386/conf/ALL:1.513
--- src/sys/arch/i386/conf/ALL:1.512	Sat Sep  2 07:15:30 2023
+++ src/sys/arch/i386/conf/ALL	Tue Dec  5 16:32:38 2023
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.512 2023/09/02 07:15:30 andvar Exp $
+# $NetBSD: ALL,v 1.513 2023/12/05 16:32:38 thorpej Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.512 $"
+#ident		"ALL-$Revision: 1.513 $"
 
 maxusers	64		# estimated number of users
 
@@ -568,6 +568,13 @@ cardslot*	at cbb?
 cardbus*	at cardslot?
 pcmcia* 	at cardslot?
 
+# VME bridge support
+btvmei*		at pci? dev ? function ?
+btvmeii*	at pci? dev ? function ?
+
+# VME bus support
+vme*		at vmebus?
+
 # Console Devices
 
 # wscons



CVS commit: src/sys/arch

2023-12-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Dec  5 16:32:38 UTC 2023

Modified Files:
src/sys/arch/amd64/conf: ALL files.amd64
src/sys/arch/i386/conf: ALL

Log Message:
Add btvmei + btvmeii and vme to ALL.


To generate a diff of this commit:
cvs rdiff -u -r1.181 -r1.182 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.121 -r1.122 src/sys/arch/amd64/conf/files.amd64
cvs rdiff -u -r1.512 -r1.513 src/sys/arch/i386/conf/ALL

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



CVS commit: src/sys/arch/alpha

2023-12-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Dec  4 00:32:10 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: api_up1000.c dec_1000a.c dec_2000_300.c
dec_2100_a50.c dec_2100_a500.c dec_550.c dec_6600.c
dec_alphabook1.c dec_axppci_33.c dec_eb164.c dec_eb64plus.c
dec_eb66.c dec_kn20aa.c
src/sys/arch/alpha/jensenio: jensenio.c jensenio_bus_intio.c
jensenio_bus_io.c jensenio_bus_mem.c jenseniovar.h
src/sys/arch/alpha/pci: apecs.c apecs_bus_io.c apecs_bus_mem.c
apecsvar.h cia.c cia_bwx_bus_io.c cia_bwx_bus_mem.c
cia_swiz_bus_io.c cia_swiz_bus_mem.c ciavar.h dwlpx_bus_io.c
dwlpx_bus_mem.c dwlpxvar.h irongate.c irongate_bus_io.c
irongate_bus_mem.c irongatevar.h lca.c lca_bus_io.c lca_bus_mem.c
lcavar.h mcpcia.c mcpcia_bus_io.c mcpcia_bus_mem.c mcpciavar.h
pci_bwx_bus_io_chipdep.c pci_bwx_bus_mem_chipdep.c
pci_swiz_bus_io_chipdep.c pci_swiz_bus_mem_chipdep.c tsc.c
tsp_bus_io.c tsp_bus_mem.c tsvar.h ttwoga.c ttwoga_bus_io.c
ttwoga_bus_mem.c ttwogavar.h

Log Message:
Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/alpha/alpha/api_up1000.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/alpha/alpha/dec_1000a.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/alpha/alpha/dec_2000_300.c
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/alpha/alpha/dec_2100_a50.c \
src/sys/arch/alpha/alpha/dec_axppci_33.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/alpha/alpha/dec_2100_a500.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/alpha/alpha/dec_550.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/alpha/dec_6600.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/alpha/alpha/dec_alphabook1.c
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/alpha/alpha/dec_eb164.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/alpha/alpha/dec_eb64plus.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/alpha/dec_eb66.c
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/alpha/alpha/dec_kn20aa.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/jensenio/jensenio.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/alpha/jensenio/jensenio_bus_intio.c \
src/sys/arch/alpha/jensenio/jenseniovar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/alpha/jensenio/jensenio_bus_io.c \
src/sys/arch/alpha/jensenio/jensenio_bus_mem.c
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/alpha/pci/apecs.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/alpha/pci/apecs_bus_io.c \
src/sys/arch/alpha/pci/apecs_bus_mem.c \
src/sys/arch/alpha/pci/irongate_bus_mem.c \
src/sys/arch/alpha/pci/lca_bus_io.c src/sys/arch/alpha/pci/lca_bus_mem.c \
src/sys/arch/alpha/pci/lcavar.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/alpha/pci/apecsvar.h \
src/sys/arch/alpha/pci/dwlpxvar.h
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/alpha/pci/cia.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/alpha/pci/cia_bwx_bus_io.c \
src/sys/arch/alpha/pci/cia_bwx_bus_mem.c \
src/sys/arch/alpha/pci/mcpcia_bus_io.c \
src/sys/arch/alpha/pci/mcpcia_bus_mem.c \
src/sys/arch/alpha/pci/mcpciavar.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/alpha/pci/cia_swiz_bus_io.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/alpha/pci/cia_swiz_bus_mem.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/pci/ciavar.h \
src/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/alpha/pci/dwlpx_bus_io.c \
src/sys/arch/alpha/pci/dwlpx_bus_mem.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/pci/irongate.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/alpha/pci/irongate_bus_io.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/alpha/pci/irongatevar.h \
src/sys/arch/alpha/pci/ttwogavar.h
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/alpha/pci/lca.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/pci/mcpcia.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/alpha/pci/pci_swiz_bus_mem_chipdep.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/pci/tsc.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/alpha/pci/tsp_bus_io.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/alpha/pci/tsp_bus_mem.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/alpha/pci/tsvar.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/alpha/pci/ttwoga.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/alpha/pci/ttwoga_bus_io.c \
src/sys/arch/alpha/pci/ttwoga_bus_mem.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/alpha/api_up1000.c
diff -u src/sys/arch/alpha/alpha/api_up1000.c:1.31 

CVS commit: src/sys/arch/alpha

2023-12-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Dec  4 00:32:10 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: api_up1000.c dec_1000a.c dec_2000_300.c
dec_2100_a50.c dec_2100_a500.c dec_550.c dec_6600.c
dec_alphabook1.c dec_axppci_33.c dec_eb164.c dec_eb64plus.c
dec_eb66.c dec_kn20aa.c
src/sys/arch/alpha/jensenio: jensenio.c jensenio_bus_intio.c
jensenio_bus_io.c jensenio_bus_mem.c jenseniovar.h
src/sys/arch/alpha/pci: apecs.c apecs_bus_io.c apecs_bus_mem.c
apecsvar.h cia.c cia_bwx_bus_io.c cia_bwx_bus_mem.c
cia_swiz_bus_io.c cia_swiz_bus_mem.c ciavar.h dwlpx_bus_io.c
dwlpx_bus_mem.c dwlpxvar.h irongate.c irongate_bus_io.c
irongate_bus_mem.c irongatevar.h lca.c lca_bus_io.c lca_bus_mem.c
lcavar.h mcpcia.c mcpcia_bus_io.c mcpcia_bus_mem.c mcpciavar.h
pci_bwx_bus_io_chipdep.c pci_bwx_bus_mem_chipdep.c
pci_swiz_bus_io_chipdep.c pci_swiz_bus_mem_chipdep.c tsc.c
tsp_bus_io.c tsp_bus_mem.c tsvar.h ttwoga.c ttwoga_bus_io.c
ttwoga_bus_mem.c ttwogavar.h

Log Message:
Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/alpha/alpha/api_up1000.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/alpha/alpha/dec_1000a.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/alpha/alpha/dec_2000_300.c
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/alpha/alpha/dec_2100_a50.c \
src/sys/arch/alpha/alpha/dec_axppci_33.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/alpha/alpha/dec_2100_a500.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/alpha/alpha/dec_550.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/alpha/dec_6600.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/alpha/alpha/dec_alphabook1.c
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/alpha/alpha/dec_eb164.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/alpha/alpha/dec_eb64plus.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/alpha/dec_eb66.c
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/alpha/alpha/dec_kn20aa.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/jensenio/jensenio.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/alpha/jensenio/jensenio_bus_intio.c \
src/sys/arch/alpha/jensenio/jenseniovar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/alpha/jensenio/jensenio_bus_io.c \
src/sys/arch/alpha/jensenio/jensenio_bus_mem.c
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/alpha/pci/apecs.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/alpha/pci/apecs_bus_io.c \
src/sys/arch/alpha/pci/apecs_bus_mem.c \
src/sys/arch/alpha/pci/irongate_bus_mem.c \
src/sys/arch/alpha/pci/lca_bus_io.c src/sys/arch/alpha/pci/lca_bus_mem.c \
src/sys/arch/alpha/pci/lcavar.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/alpha/pci/apecsvar.h \
src/sys/arch/alpha/pci/dwlpxvar.h
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/alpha/pci/cia.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/alpha/pci/cia_bwx_bus_io.c \
src/sys/arch/alpha/pci/cia_bwx_bus_mem.c \
src/sys/arch/alpha/pci/mcpcia_bus_io.c \
src/sys/arch/alpha/pci/mcpcia_bus_mem.c \
src/sys/arch/alpha/pci/mcpciavar.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/alpha/pci/cia_swiz_bus_io.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/alpha/pci/cia_swiz_bus_mem.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/pci/ciavar.h \
src/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/alpha/pci/dwlpx_bus_io.c \
src/sys/arch/alpha/pci/dwlpx_bus_mem.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/pci/irongate.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/alpha/pci/irongate_bus_io.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/alpha/pci/irongatevar.h \
src/sys/arch/alpha/pci/ttwogavar.h
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/alpha/pci/lca.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/pci/mcpcia.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/alpha/pci/pci_swiz_bus_mem_chipdep.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/pci/tsc.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/alpha/pci/tsp_bus_io.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/alpha/pci/tsp_bus_mem.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/alpha/pci/tsvar.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/alpha/pci/ttwoga.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/alpha/pci/ttwoga_bus_io.c \
src/sys/arch/alpha/pci/ttwoga_bus_mem.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/hppa/dev

2023-12-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Dec  3 02:17:06 UTC 2023

Modified Files:
src/sys/arch/hppa/dev: uturn.c

Log Message:
Use vmem(9) rather than extent(9) to manage IOMMU mappings.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/hppa/dev/uturn.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/hppa/dev/uturn.c
diff -u src/sys/arch/hppa/dev/uturn.c:1.6 src/sys/arch/hppa/dev/uturn.c:1.7
--- src/sys/arch/hppa/dev/uturn.c:1.6	Thu Sep 29 06:42:14 2022
+++ src/sys/arch/hppa/dev/uturn.c	Sun Dec  3 02:17:06 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: uturn.c,v 1.6 2022/09/29 06:42:14 skrll Exp $	*/
+/*	$NetBSD: uturn.c,v 1.7 2023/12/03 02:17:06 thorpej Exp $	*/
 
 /*	$OpenBSD: uturn.c,v 1.6 2007/12/29 01:26:14 kettenis Exp $	*/
 
@@ -85,7 +85,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -178,7 +178,7 @@ struct uturn_softc {
 	uint32_t sc_chainid_shift;
 
 	char sc_mapname[20];
-	struct extent *sc_map;
+	vmem_t *sc_map;
 
 	struct hppa_bus_dma_tag sc_dmatag;
 };
@@ -357,8 +357,17 @@ uturnattach(device_t parent, device_t se
 
 	snprintf(sc->sc_mapname, sizeof(sc->sc_mapname), "%s_map",
 	device_xname(sc->sc_dv));
-	sc->sc_map = extent_create(sc->sc_mapname, 0, (1 << iova_bits),
-	0, 0, EX_WAITOK);
+	sc->sc_map = vmem_create(sc->sc_mapname,
+ 0,			/* base */
+ (1 << iova_bits),	/* size */
+ PAGE_SIZE,		/* quantum */
+ NULL,			/* allocfn */
+ NULL,			/* freefn */
+ NULL,			/* source */
+ 0,			/* qcache_max */
+ VM_SLEEP,
+ IPL_VM);
+	KASSERT(sc->sc_map != NULL);
 
 	sc->sc_dmatag = uturn_dmat;
 	sc->sc_dmatag._cookie = sc;
@@ -539,18 +548,18 @@ uturn_iomap_load_map(struct uturn_softc 
 	struct uturn_map_state *ums = map->_dm_cookie;
 	struct uturn_page_map *upm = >ums_map;
 	struct uturn_page_entry *e;
-	int err, seg, s;
+	int err, seg;
 	paddr_t pa, paend;
 	vaddr_t va;
 	bus_size_t sgsize;
 	bus_size_t align, boundary;
-	u_long iovaddr;
+	vmem_addr_t iovaddr;
 	bus_addr_t iova;
 	int i;
 
 	/* XXX */
 	boundary = map->_dm_boundary;
-	align = PAGE_SIZE;
+	align = 0;	/* align to quantum */
 
 	uturn_iomap_clear_pages(ums);
 
@@ -570,12 +579,18 @@ uturn_iomap_load_map(struct uturn_softc 
 		}
 	}
 
+	const vm_flag_t vmflags = VM_BESTFIT |
+	((flags & BUS_DMA_NOWAIT) ? VM_NOSLEEP : VM_SLEEP);
+
 	sgsize = ums->ums_map.upm_pagecnt * PAGE_SIZE;
-	/* XXXNH */
-	s = splhigh();
-	err = extent_alloc(sc->sc_map, sgsize, align, boundary,
-	EX_NOWAIT | EX_BOUNDZERO, );
-	splx(s);
+	err = vmem_xalloc(sc->sc_map, sgsize,
+			  align,		/* align */
+			  0,			/* phase */
+			  boundary,		/* nocross */
+			  VMEM_ADDR_MIN,	/* minaddr */
+			  VMEM_ADDR_MAX,	/* maxaddr */
+			  vmflags,
+			  );
 	if (err)
 		return (err);
 
@@ -653,7 +668,7 @@ uturn_dmamap_unload(void *v, bus_dmamap_
 	struct uturn_map_state *ums = map->_dm_cookie;
 	struct uturn_page_map *upm = >ums_map;
 	struct uturn_page_entry *e;
-	int err, i, s;
+	int i;
 
 	/* Remove the IOMMU entries. */
 	for (i = 0, e = upm->upm_map; i < upm->upm_pagecnt; ++i, ++e)
@@ -664,14 +679,9 @@ uturn_dmamap_unload(void *v, bus_dmamap_
 
 	bus_dmamap_unload(sc->sc_dmat, map);
 
-	s = splhigh();
-	err = extent_free(sc->sc_map, ums->ums_iovastart,
-	ums->ums_iovasize, EX_NOWAIT);
+	vmem_xfree(sc->sc_map, ums->ums_iovastart, ums->ums_iovasize);
 	ums->ums_iovastart = 0;
 	ums->ums_iovasize = 0;
-	splx(s);
-	if (err)
-		printf("warning: %ld of IOVA space lost\n", ums->ums_iovasize);
 }
 
 void



CVS commit: src/sys/arch/hppa/dev

2023-12-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Dec  3 02:17:06 UTC 2023

Modified Files:
src/sys/arch/hppa/dev: uturn.c

Log Message:
Use vmem(9) rather than extent(9) to manage IOMMU mappings.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/hppa/dev/uturn.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/hppa/dev

2023-12-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Dec  3 02:03:18 UTC 2023

Modified Files:
src/sys/arch/hppa/dev: astro.c

Log Message:
Use vmem(9) rather than extent(9) to manage IOMMU mappings.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hppa/dev/astro.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/hppa/dev/astro.c
diff -u src/sys/arch/hppa/dev/astro.c:1.5 src/sys/arch/hppa/dev/astro.c:1.6
--- src/sys/arch/hppa/dev/astro.c:1.5	Thu Sep 29 06:42:14 2022
+++ src/sys/arch/hppa/dev/astro.c	Sun Dec  3 02:03:18 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: astro.c,v 1.5 2022/09/29 06:42:14 skrll Exp $	*/
+/*	$NetBSD: astro.c,v 1.6 2023/12/03 02:03:18 thorpej Exp $	*/
 
 /*	$OpenBSD: astro.c,v 1.8 2007/10/06 23:50:54 krw Exp $	*/
 
@@ -22,7 +22,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -124,7 +124,7 @@ struct astro_softc {
 	uint64_t *sc_pdir;
 
 	char sc_dvmamapname[20];
-	struct extent *sc_dvmamap;
+	vmem_t *sc_dvmamap;
 	struct hppa_bus_dma_tag sc_dmatag;
 };
 
@@ -328,8 +328,17 @@ astro_attach(device_t parent, device_t s
 	 */
 	snprintf(sc->sc_dvmamapname, sizeof(sc->sc_dvmamapname),
 	"%s_dvma", device_xname(sc->sc_dv));
-	sc->sc_dvmamap = extent_create(sc->sc_dvmamapname, 0, (1 << iova_bits),
-	0, 0, EX_WAITOK);
+	sc->sc_dvmamap = vmem_create(sc->sc_dvmamapname,
+ 0,			/* base */
+ (1 << iova_bits),	/* size */
+ PAGE_SIZE,		/* quantum */
+ NULL,		/* allocfn */
+ NULL,		/* freefn */
+ NULL,		/* source */
+ 0,			/* qcache_max */
+ VM_SLEEP,
+ IPL_VM);
+	KASSERT(sc->sc_dvmamap != NULL);
 
 	sc->sc_dmatag = astro_dmat;
 	sc->sc_dmatag._cookie = sc;
@@ -401,18 +410,18 @@ iommu_iomap_load_map(struct astro_softc 
 	struct iommu_map_state *ims = map->_dm_cookie;
 	struct iommu_page_map *ipm = >ims_map;
 	struct iommu_page_entry *e;
-	int err, seg, s;
+	int err, seg;
 	paddr_t pa, paend;
 	vaddr_t va;
 	bus_size_t sgsize;
 	bus_size_t align, boundary;
-	u_long dvmaddr;
+	vmem_addr_t dvmaddr;
 	bus_addr_t dva;
 	int i;
 
 	/* XXX */
 	boundary = map->_dm_boundary;
-	align = PAGE_SIZE;
+	align = 0;	/* align to quantum */
 
 	iommu_iomap_clear_pages(ims);
 
@@ -432,12 +441,18 @@ iommu_iomap_load_map(struct astro_softc 
 		}
 	}
 
+	const vm_flag_t vmflags = VM_BESTFIT |
+	((flags & BUS_DMA_NOWAIT) ? VM_NOSLEEP : VM_SLEEP);
+
 	sgsize = ims->ims_map.ipm_pagecnt * PAGE_SIZE;
-	/* XXXNH */
-	s = splhigh();
-	err = extent_alloc(sc->sc_dvmamap, sgsize, align, boundary,
-	EX_NOWAIT | EX_BOUNDZERO, );
-	splx(s);
+	err = vmem_xalloc(sc->sc_dvmamap, sgsize,
+			  align,		/* align */
+			  0,			/* phase */
+			  boundary,		/* nocross */
+			  VMEM_ADDR_MIN,	/* minaddr */
+			  VMEM_ADDR_MAX,	/* maxaddr */
+			  vmflags,
+			  );
 	if (err)
 		return (err);
 
@@ -514,7 +529,7 @@ iommu_dvmamap_unload(void *v, bus_dmamap
 	struct iommu_map_state *ims = map->_dm_cookie;
 	struct iommu_page_map *ipm = >ims_map;
 	struct iommu_page_entry *e;
-	int err, i, s;
+	int i;
 
 	/* Remove the IOMMU entries. */
 	for (i = 0, e = ipm->ipm_map; i < ipm->ipm_pagecnt; ++i, ++e)
@@ -525,14 +540,9 @@ iommu_dvmamap_unload(void *v, bus_dmamap
 
 	bus_dmamap_unload(sc->sc_dmat, map);
 
-	s = splhigh();
-	err = extent_free(sc->sc_dvmamap, ims->ims_dvmastart,
-	ims->ims_dvmasize, EX_NOWAIT);
+	vmem_xfree(sc->sc_dvmamap, ims->ims_dvmastart, ims->ims_dvmasize);
 	ims->ims_dvmastart = 0;
 	ims->ims_dvmasize = 0;
-	splx(s);
-	if (err)
-		printf("warning: %ld of DVMA space lost\n", ims->ims_dvmasize);
 }
 
 void
@@ -736,7 +746,7 @@ iommu_enter(struct astro_softc *sc, bus_
 	if (tte & IOTTE_V) {
 		printf("Overwriting valid tte entry (dva %lx pa %lx "
 		" %p tte %llx)\n", dva, pa, tte_ptr, tte);
-		extent_print(sc->sc_dvmamap);
+		/* vmem_print(sc->sc_dvmamap);		XXX */
 		panic("IOMMU overwrite");
 	}
 #endif
@@ -773,7 +783,7 @@ iommu_remove(struct astro_softc *sc, bus
 	if ((tte & IOTTE_V) == 0) {
 		printf("Removing invalid tte entry (dva %lx  %p "
 		"tte %llx)\n", dva, tte_ptr, tte);
-		extent_print(sc->sc_dvmamap);
+		/* vmem_print(sc->sc_dvmamap);		XXX */
 		panic("IOMMU remove overwrite");
 	}
 #endif



CVS commit: src/sys/arch/hppa/dev

2023-12-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Dec  3 02:03:18 UTC 2023

Modified Files:
src/sys/arch/hppa/dev: astro.c

Log Message:
Use vmem(9) rather than extent(9) to manage IOMMU mappings.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hppa/dev/astro.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/vax

2023-12-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Dec  3 00:49:46 UTC 2023

Modified Files:
src/sys/arch/vax/include: sgmap.h
src/sys/arch/vax/vax: sgmap.c

Log Message:
Use vmem(9) rather than extent(9) to manage SGMAP space.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/vax/include/sgmap.h
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/vax/vax/sgmap.c

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

Modified files:

Index: src/sys/arch/vax/include/sgmap.h
diff -u src/sys/arch/vax/include/sgmap.h:1.7 src/sys/arch/vax/include/sgmap.h:1.8
--- src/sys/arch/vax/include/sgmap.h:1.7	Sun Jul  5 02:03:36 2015
+++ src/sys/arch/vax/include/sgmap.h	Sun Dec  3 00:49:46 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: sgmap.h,v 1.7 2015/07/05 02:03:36 matt Exp $ */
+/* $NetBSD: sgmap.h,v 1.8 2023/12/03 00:49:46 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -33,21 +33,21 @@
 #ifndef	_VAX_SGMAP_H
 #define	_VAX_SGMAP_H
 
-#include 
+#include 
 #include 
 #include 
 
 /*
  * A VAX SGMAP's state information.  Nothing in the sgmap requires
- * locking[*], with the exception of the extent map.  Locking of the
- * extent map is handled within the extent manager itself.
+ * locking[*], with the exception of the vmem arena, which takes care
+ * of it on its own.
  *
  * [*] While the page table is a `global' resource, access to it is
- * controlled by the extent map; once a region has been allocated from
- * the map, that region is effectively `locked'.
+ * controlled by the arena; once a region has been allocated from
+ * the arena, that region is effectively `locked'.
  */
 struct vax_sgmap {
-	struct extent *aps_ex;		/* extent map to manage sgva space */
+	vmem_t *aps_arena;		/* arena to manage sgva space */
 	struct pte *aps_pt;		/* page table */
 	bus_addr_t aps_sgvabase;	/* base of the sgva space */
 	bus_size_t aps_sgvasize;	/* size of the sgva space */

Index: src/sys/arch/vax/vax/sgmap.c
diff -u src/sys/arch/vax/vax/sgmap.c:1.19 src/sys/arch/vax/vax/sgmap.c:1.20
--- src/sys/arch/vax/vax/sgmap.c:1.19	Thu Jul  7 06:55:39 2016
+++ src/sys/arch/vax/vax/sgmap.c	Sun Dec  3 00:49:46 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: sgmap.c,v 1.19 2016/07/07 06:55:39 msaitoh Exp $ */
+/* $NetBSD: sgmap.c,v 1.20 2023/12/03 00:49:46 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sgmap.c,v 1.19 2016/07/07 06:55:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sgmap.c,v 1.20 2023/12/03 00:49:46 thorpej Exp $");
 
 #include 
 #include 
@@ -89,16 +89,18 @@ vax_sgmap_init(bus_dma_tag_t t, struct v
 	}
 
 	/*
-	 * Create the extent map used to manage the virtual address
+	 * Create the arena used to manage the virtual address
 	 * space.
 	 */
-	sgmap->aps_ex = extent_create(name, sgvabase, sgvasize - 1,
-	NULL, 0, EX_NOWAIT|EX_NOCOALESCE);
-	if (sgmap->aps_ex == NULL) {
-		printf("unable to create extent map for sgmap `%s'\n", name);
-		goto die;
-	}
-
+	sgmap->aps_arena = vmem_create(name, sgvabase, sgvasize,
+   VAX_NBPG,	/* quantum */
+   NULL,		/* importfn */
+   NULL,		/* releasefn */
+   NULL,		/* source */
+   0,		/* qcache_max */
+   VM_SLEEP,
+   IPL_VM);
+	KASSERT(sgmap->aps_arena != NULL);
 	return;
  die:
 	panic("vax_sgmap_init");
@@ -131,9 +133,18 @@ vax_sgmap_alloc(bus_dmamap_t map, bus_si
 	(unsigned int)origlen, (unsigned int)len, (unsigned int)map->_dm_sgvalen, (unsigned int)map->_dm_boundary, 1);
 #endif
 
-	error = extent_alloc(sgmap->aps_ex, map->_dm_sgvalen, VAX_NBPG,
-	0, (flags & BUS_DMA_NOWAIT) ? EX_NOWAIT : EX_WAITOK,
-	>_dm_sgva);
+	const vm_flag_t vmflags = VM_BESTFIT |
+	((flags & BUS_DMA_NOWAIT) ? VM_NOSLEEP : VM_SLEEP);
+
+	error = vmem_xalloc(sgmap->aps_arena, map->_dm_sgvalen,
+			0,			/* alignment */
+			0,			/* phase */
+			map->_dm_boundary,	/* nocross */
+			VMEM_ADDR_MIN,	/* minaddr */
+			VMEM_ADDR_MAX,	/* maxaddr */
+			vmflags,
+			>_dm_sgva);
+
 #if DEBUG_SGMAP
 	printf("error %d _dm_sgva %lx\n", error, map->_dm_sgva);
 #endif
@@ -155,9 +166,7 @@ vax_sgmap_free(bus_dmamap_t map, struct 
 		panic("vax_sgmap_free: no sgva space to free");
 #endif
 
-	if (extent_free(sgmap->aps_ex, map->_dm_sgva, map->_dm_sgvalen,
-	EX_NOWAIT))
-		panic("vax_sgmap_free");
+	vmem_xfree(sgmap->aps_arena, map->_dm_sgva, map->_dm_sgvalen);
 
 	map->_dm_flags &= ~DMAMAP_HAS_SGMAP;
 }
@@ -165,7 +174,7 @@ vax_sgmap_free(bus_dmamap_t map, struct 
 int
 vax_sgmap_reserve(bus_addr_t ba, bus_size_t len, struct vax_sgmap *sgmap)
 {
-	return extent_alloc_region(sgmap->aps_ex, ba, len, EX_NOWAIT);
+	return vmem_xalloc_addr(sgmap->aps_arena, ba, len, VM_NOSLEEP);
 }
 
 int



CVS commit: src/sys/arch/vax

2023-12-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Dec  3 00:49:46 UTC 2023

Modified Files:
src/sys/arch/vax/include: sgmap.h
src/sys/arch/vax/vax: sgmap.c

Log Message:
Use vmem(9) rather than extent(9) to manage SGMAP space.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/vax/include/sgmap.h
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/vax/vax/sgmap.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/dreamcast/dev/g2

2023-12-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec  2 22:42:02 UTC 2023

Modified Files:
src/sys/arch/dreamcast/dev/g2: gapspci_dma.c gapspcivar.h

Log Message:
Use vmem(9) rather than extent(9) to manage the GAPS PCI DMA buffer.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/dreamcast/dev/g2/gapspci_dma.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/dreamcast/dev/g2/gapspcivar.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/dreamcast/dev/g2/gapspci_dma.c
diff -u src/sys/arch/dreamcast/dev/g2/gapspci_dma.c:1.20 src/sys/arch/dreamcast/dev/g2/gapspci_dma.c:1.21
--- src/sys/arch/dreamcast/dev/g2/gapspci_dma.c:1.20	Fri Jan 27 18:52:53 2012
+++ src/sys/arch/dreamcast/dev/g2/gapspci_dma.c	Sat Dec  2 22:42:02 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: gapspci_dma.c,v 1.20 2012/01/27 18:52:53 para Exp $	*/
+/*	$NetBSD: gapspci_dma.c,v 1.21 2023/12/02 22:42:02 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -32,20 +32,20 @@
 /*
  * Bus DMA implementation for the SEGA GAPS PCI bridge.
  *
- * NOTE: We only implement a small subset of what the bus_space(9)
+ * NOTE: We only implement a small subset of what the bus_dma(9)
  * API specifies.  Right now, the GAPS PCI bridge is only used for
  * the Dreamcast Broadband Adatper, so we only provide what the
  * pci(4) and rtk(4) drivers need.
  */
 
 #include 			/* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: gapspci_dma.c,v 1.20 2012/01/27 18:52:53 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gapspci_dma.c,v 1.21 2023/12/02 22:42:02 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -105,11 +105,18 @@ gaps_dma_init(struct gaps_softc *sc)
 
 	/*
 	 * The GAPS PCI bridge has 32k of DMA memory.  We manage it
-	 * with an extent map.
+	 * with a vmem arena.
 	 */
-	sc->sc_dma_ex = extent_create("gaps dma",
-	sc->sc_dmabase, sc->sc_dmabase + (sc->sc_dmasize - 1),
-	NULL, 0, EX_WAITOK | EXF_NOCOALESCE);
+	sc->sc_dma_arena = vmem_create("gaps dma",
+   sc->sc_dmabase,
+   sc->sc_dmasize,
+   1024 /* XXX */,	/* quantum */
+   NULL,		/* allocfn */
+   NULL,		/* freefn */
+   NULL,		/* arg */
+   0,		/* qcache_max */
+   VM_SLEEP,
+   IPL_VM);
 
 	if (bus_space_map(sc->sc_memt, sc->sc_dmabase, sc->sc_dmasize,
 	0, >sc_dma_memh) != 0)
@@ -169,12 +176,20 @@ gaps_dmamap_create(bus_dma_tag_t t, bus_
 	map->dm_maxsegsz = maxsegsz;
 
 	if (flags & BUS_DMA_ALLOCNOW) {
-		u_long res;
+		vmem_addr_t res;
 		int error;
 
-		error = extent_alloc(sc->sc_dma_ex, size, 1024 /* XXX */,
-		map->_dm_boundary,
-		(flags & BUS_DMA_NOWAIT) ? EX_NOWAIT : EX_WAITOK, );
+		const vm_flag_t vmflags = VM_BESTFIT |
+		((flags & BUS_DMA_NOWAIT) ? VM_NOSLEEP : VM_SLEEP);
+
+		error = vmem_xalloc(sc->sc_dma_arena, size,
+0,			/* alignment */
+0,			/* phase */
+0,			/* nocross */
+VMEM_ADDR_MIN,	/* minaddr */
+VMEM_ADDR_MAX,	/* maxaddr */
+vmflags,
+);
 		if (error) {
 			free(gmap, M_DEVBUF);
 			return error;
@@ -201,9 +216,8 @@ gaps_dmamap_destroy(bus_dma_tag_t t, bus
 	struct gaps_softc *sc = t->_cookie;
 
 	if (map->_dm_flags & BUS_DMA_ALLOCNOW) {
-		(void) extent_free(sc->sc_dma_ex,
-		map->dm_segs[0].ds_addr,
-		map->dm_mapsize, EX_NOWAIT);
+		vmem_xfree(sc->sc_dma_arena, map->dm_segs[0].ds_addr,
+		map->dm_mapsize);
 	}
 	free(map, M_DMAMAP);
 }
@@ -214,7 +228,7 @@ gaps_dmamap_load(bus_dma_tag_t t, bus_dm
 {
 	struct gaps_softc *sc = t->_cookie;
 	struct gaps_dmamap *gmap = (void *) map;
-	u_long res;
+	vmem_addr_t res;
 	int error;
 
 	if ((map->_dm_flags & BUS_DMA_ALLOCNOW) == 0) {
@@ -234,9 +248,17 @@ gaps_dmamap_load(bus_dma_tag_t t, bus_dm
 	if (size > map->_dm_size)
 		return EINVAL;
 
-	error = extent_alloc(sc->sc_dma_ex, size, 1024 /* XXX */,
-	map->_dm_boundary,
-	(flags & BUS_DMA_NOWAIT) ? EX_NOWAIT : EX_WAITOK, );
+	const vm_flag_t vmflags = VM_BESTFIT |
+	((flags & BUS_DMA_NOWAIT) ? VM_NOSLEEP : VM_SLEEP);
+
+	error = vmem_xalloc(sc->sc_dma_arena, size,
+			0,			/* alignment */
+			0,			/* phase */
+			map->_dm_boundary,	/* nocross */
+			VMEM_ADDR_MIN,	/* minaddr */
+			VMEM_ADDR_MAX,	/* maxaddr */
+			vmflags,
+			);
 	if (error)
 		return error;
 
@@ -258,7 +280,7 @@ gaps_dmamap_load_mbuf(bus_dma_tag_t t, b
 {
 	struct gaps_softc *sc = t->_cookie;
 	struct gaps_dmamap *gmap = (void *) map;
-	u_long res;
+	vmem_addr_t res;
 	int error;
 
 	if ((map->_dm_flags & BUS_DMA_ALLOCNOW) == 0) {
@@ -279,9 +301,17 @@ gaps_dmamap_load_mbuf(bus_dma_tag_t t, b
 	if (m0->m_pkthdr.len > map->_dm_size)
 		return EINVAL;
 
-	error = extent_alloc(sc->sc_dma_ex, m0->m_pkthdr.len, 1024 /* XXX */,
-	map->_dm_boundary,
-	(flags & BUS_DMA_NOWAIT) ? EX_NOWAIT 

CVS commit: src/sys/arch/dreamcast/dev/g2

2023-12-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec  2 22:42:02 UTC 2023

Modified Files:
src/sys/arch/dreamcast/dev/g2: gapspci_dma.c gapspcivar.h

Log Message:
Use vmem(9) rather than extent(9) to manage the GAPS PCI DMA buffer.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/dreamcast/dev/g2/gapspci_dma.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/dreamcast/dev/g2/gapspcivar.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/sparc64/dev

2023-12-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec  2 21:02:53 UTC 2023

Modified Files:
src/sys/arch/sparc64/dev: sbus.c

Log Message:
Use vmem_xalloc_addr() to reserve the first Sbus DVMA page.


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/sparc64/dev/sbus.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/sparc64/dev/sbus.c
diff -u src/sys/arch/sparc64/dev/sbus.c:1.105 src/sys/arch/sparc64/dev/sbus.c:1.106
--- src/sys/arch/sparc64/dev/sbus.c:1.105	Fri Dec  1 06:47:59 2023
+++ src/sys/arch/sparc64/dev/sbus.c	Sat Dec  2 21:02:53 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: sbus.c,v 1.105 2023/12/01 06:47:59 thorpej Exp $ */
+/*	$NetBSD: sbus.c,v 1.106 2023/12/02 21:02:53 thorpej Exp $ */
 
 /*
  * Copyright (c) 1999-2002 Eduardo Horvath
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sbus.c,v 1.105 2023/12/01 06:47:59 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbus.c,v 1.106 2023/12/02 21:02:53 thorpej Exp $");
 
 #include "opt_ddb.h"
 
@@ -268,19 +268,9 @@ sbus_attach(device_t parent, device_t se
 	 * NULL DMA pointer will be translated by the first page of the IOTSB.
 	 * To avoid bugs we'll alloc and ignore the first entry in the IOTSB.
 	 */
-	{
-		vmem_addr_t dummy;
-
-		if (vmem_xalloc(sc->sc_is.is_dvmamap, PAGE_SIZE,
-0,		/* alignment */
-0,		/* phase */
-0,		/* nocross */
-sc->sc_is.is_dvmabase,
-sc->sc_is.is_dvmabase + PAGE_SIZE - 1,
-VM_BESTFIT | VM_NOSLEEP,
-) != 0) {
-			panic("sbus iommu: can't toss first dvma page");
-		}
+	if (vmem_xalloc_addr(sc->sc_is.is_dvmamap, sc->sc_is.is_dvmabase,
+			PAGE_SIZE, VM_NOSLEEP) != 0) {
+		panic("sbus iommu: can't toss first dvma page");
 	}
 
 	/*



CVS commit: src/sys/arch/sparc64/dev

2023-12-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec  2 21:02:53 UTC 2023

Modified Files:
src/sys/arch/sparc64/dev: sbus.c

Log Message:
Use vmem_xalloc_addr() to reserve the first Sbus DVMA page.


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/sparc64/dev/sbus.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/sun2/sun2

2023-12-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec  2 15:50:57 UTC 2023

Modified Files:
src/sys/arch/sun2/sun2: machdep.c

Log Message:
Use vmem(9) rather than extent(9) to manage DVMA mappings.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/sun2/sun2/machdep.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/sun2/sun2/machdep.c
diff -u src/sys/arch/sun2/sun2/machdep.c:1.84 src/sys/arch/sun2/sun2/machdep.c:1.85
--- src/sys/arch/sun2/sun2/machdep.c:1.84	Tue Aug 17 22:00:31 2021
+++ src/sys/arch/sun2/sun2/machdep.c	Sat Dec  2 15:50:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.84 2021/08/17 22:00:31 andvar Exp $	*/
+/*	$NetBSD: machdep.c,v 1.85 2023/12/02 15:50:57 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -149,7 +149,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.84 2021/08/17 22:00:31 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.85 2023/12/02 15:50:57 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_fpu_emulate.h"
@@ -164,7 +164,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 #include 
 #include 
 #include 		/* for MID_* */
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -253,7 +253,7 @@ label_t *nofault;
 /*
  * dvmamap is used to manage DVMA memory.
  */
-static struct extent *dvmamap;
+vmem_t *dvma_arena;
 
 /* Our private scratch page for dumping the MMU. */
 static vaddr_t dumppage;
@@ -351,10 +351,15 @@ cpu_startup(void)
 	/*
 	 * Allocate DMA map for devices on the bus.
 	 */
-	dvmamap = extent_create("dvmamap",
-	DVMA_MAP_BASE, DVMA_MAP_BASE + DVMA_MAP_AVAIL,
-	0, 0, EX_NOWAIT);
-	if (dvmamap == NULL)
+	dvma_arena = vmem_create("dvmamap", DVMA_MAP_BASE, DVMA_MAP_AVAIL,
+ PAGE_SIZE,		/* quantum */
+ NULL,			/* importfn */
+ NULL,			/* releasefn */
+ NULL,			/* source */
+ 0,			/* qcache_max */
+ VM_SLEEP,
+ IPL_VM);
+	if (dvma_arena == NULL)
 		panic("unable to allocate DVMA map");
 
 	/*
@@ -801,7 +806,7 @@ _bus_dmamap_load_raw(bus_dma_tag_t t, bu
 {
 	struct vm_page *m;
 	paddr_t pa;
-	bus_addr_t dva;
+	vmem_addr_t dva;
 	bus_size_t sgsize;
 	struct pglist *mlist;
 	int pagesz = PAGE_SIZE;
@@ -831,11 +836,17 @@ _bus_dmamap_load_raw(bus_dma_tag_t t, bu
 	 * Otherwise, we need virtual addresses in DVMA space.
 	 */
 	else {
-		error = extent_alloc(dvmamap, sgsize, pagesz,
-	map->_dm_boundary,
-	(flags & BUS_DMA_NOWAIT) == 0
-		? EX_WAITOK : EX_NOWAIT,
-	(u_long *));
+		const vm_flag_t vmflags = VM_BESTFIT |
+		((flags & BUS_DMA_NOWAIT) ? VM_NOSLEEP : VM_SLEEP);
+
+		error = vmem_xalloc(dvma_arena, sgsize,
+0,			/* alignment */
+0,			/* phase */
+map->_dm_boundary,	/* nocross */
+VMEM_ADDR_MIN,	/* minaddr */
+VMEM_ADDR_MAX,	/* maxaddr */
+vmflags,
+);
 		if (error)
 			return (error);
 	}
@@ -878,7 +889,7 @@ _bus_dmamap_load(bus_dma_tag_t t, bus_dm
 	bus_size_t sgsize;
 	vaddr_t va = (vaddr_t)buf;
 	int pagesz = PAGE_SIZE;
-	bus_addr_t dva;
+	vmem_addr_t dva;
 	pmap_t pmap;
 	int rv __diagused;
 
@@ -915,9 +926,17 @@ _bus_dmamap_load(bus_dma_tag_t t, bus_dm
 	 */
 	sgsize = m68k_round_page(buflen + (va & (pagesz - 1)));
 
-	if (extent_alloc(dvmamap, sgsize, pagesz, map->_dm_boundary,
-			 (flags & BUS_DMA_NOWAIT) == 0 ? EX_WAITOK : EX_NOWAIT,
-			 (u_long *)) != 0) {
+	const vm_flag_t vmflags = VM_BESTFIT |
+	((flags & BUS_DMA_NOWAIT) ? VM_NOSLEEP : VM_SLEEP);
+
+	if (vmem_xalloc(dvma_arena, sgsize,
+			0,			/* alignment */
+			0,			/* phase */
+			map->_dm_boundary,	/* nocross */
+			VMEM_ADDR_MIN,		/* minaddr */
+			VMEM_ADDR_MAX,		/* maxaddr */
+			vmflags,
+			) != 0) {
 		return (ENOMEM);
 	}
 
@@ -982,7 +1001,6 @@ _bus_dmamap_unload(bus_dma_tag_t t, bus_
 	int flags = map->_dm_flags;
 	bus_addr_t dva;
 	bus_size_t len;
-	int s, error;
 
 	if (nsegs != 1)
 		panic("_bus_dmamem_unload: nsegs = %d", nsegs);
@@ -1024,11 +1042,7 @@ _bus_dmamap_unload(bus_dma_tag_t t, bus_
 			 * This map was loaded using _bus_dmamap_load or
 			 * _bus_dmamap_load_raw for a non-24-bit device.
 			 */
-			s = splhigh();
-			error = extent_free(dvmamap, dva, len, EX_NOWAIT);
-			splx(s);
-			if (error != 0)
-printf("warning: %ld of DVMA space lost\n", len);
+			vmem_xfree(dvma_arena, dva, len);
 		}
 	}
 



CVS commit: src/sys/arch/sun2/sun2

2023-12-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec  2 15:50:57 UTC 2023

Modified Files:
src/sys/arch/sun2/sun2: machdep.c

Log Message:
Use vmem(9) rather than extent(9) to manage DVMA mappings.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/sun2/sun2/machdep.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/sun3

2023-12-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec  1 23:56:30 UTC 2023

Modified Files:
src/sys/arch/sun3/sun3: dvma.c
src/sys/arch/sun3/sun3x: dvma.c

Log Message:
Use vmem(9) rather than extent(9) to manage DVMA mappings.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/sun3/sun3/dvma.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/sun3/sun3x/dvma.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/sun3/sun3/dvma.c
diff -u src/sys/arch/sun3/sun3/dvma.c:1.41 src/sys/arch/sun3/sun3/dvma.c:1.42
--- src/sys/arch/sun3/sun3/dvma.c:1.41	Thu Jun  1 02:45:07 2017
+++ src/sys/arch/sun3/sun3/dvma.c	Fri Dec  1 23:56:30 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: dvma.c,v 1.41 2017/06/01 02:45:07 chs Exp $	*/
+/*	$NetBSD: dvma.c,v 1.42 2023/12/01 23:56:30 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -30,14 +30,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dvma.c,v 1.41 2017/06/01 02:45:07 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dvma.c,v 1.42 2023/12/01 23:56:30 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -60,7 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: dvma.c,v 1.4
 #define DVMA_MAP_END	(DVMA_MAP_BASE + DVMA_MAP_AVAIL)
 
 /* Extent map used by dvma_mapin/dvma_mapout */
-struct extent *dvma_extent;
+vmem_t *dvma_arena;
 
 /* XXX: Might need to tune this... */
 vsize_t dvma_segmap_size = 6 * NBSG;
@@ -97,12 +97,17 @@ dvma_init(void)
 		panic("dvma_init: unable to allocate DVMA segments");
 
 	/*
-	 * Create the VM pool used for mapping whole segments
+	 * Create the vmem arena used for mapping whole segments
 	 * into DVMA space for the purpose of data transfer.
 	 */
-	dvma_extent = extent_create("dvma", segmap_addr,
-	segmap_addr + (dvma_segmap_size - 1),
-	NULL, 0, EX_NOCOALESCE|EX_NOWAIT);
+	dvma_arena = vmem_create("dvma", segmap_addr, dvma_segmap_size,
+ PAGE_SIZE,		/* quantum */
+ NULL,			/* importfn */
+ NULL,			/* releasefn */
+ NULL,			/* source */
+ 0,			/* qcache_max */
+ VM_SLEEP,
+ IPL_VM);
 }
 
 /*
@@ -172,10 +177,11 @@ dvma_kvtopa(void *kva, int bustype)
 void *
 dvma_mapin(void *kva, int len, int canwait /* ignored */)
 {
-	vaddr_t seg_kva, seg_dma;
+	vaddr_t seg_kva;
 	vsize_t seg_len, seg_off;
 	vaddr_t v, x;
 	int s, sme, error;
+	vmem_addr_t seg_dma;
 
 	/* Get seg-aligned address and length. */
 	seg_kva = (vaddr_t)kva;
@@ -184,31 +190,32 @@ dvma_mapin(void *kva, int len, int canwa
 	seg_kva -= seg_off;
 	seg_len = sun3_round_seg(seg_len + seg_off);
 
-	s = splvm();
-
 	/* Allocate the DVMA segment(s) */
 
-	error = extent_alloc(dvma_extent, seg_len, NBSG, 0,
-	EX_FAST | EX_NOWAIT | EX_MALLOCOK, _dma);
-	if (error) {
-		splx(s);
+	const vm_flag_t vmflags = VM_INSTANTFIT |
+	(/* canwait ? VM_SLEEP : */ VM_NOSLEEP);
+
+	error = vmem_xalloc(dvma_arena, seg_len,
+			NBSG,		/* alignment */
+			0,			/* phase */
+			0,			/* nocross */
+			VMEM_ADDR_MIN,	/* minaddr */
+			VMEM_ADDR_MAX,	/* maxaddr */
+			vmflags,
+			_dma);
+	if (error)
 		return NULL;
-	}
 
-#ifdef	DIAGNOSTIC
-	if (seg_dma & SEGOFSET)
-		panic("dvma_mapin: seg not aligned");
-#endif
+	KASSERT((seg_dma & SEGOFSET) == 0);
+
+	s = splvm();
 
 	/* Duplicate the mappings into DMA space. */
 	v = seg_kva;
 	x = seg_dma;
 	while (seg_len > 0) {
 		sme = get_segmap(v);
-#ifdef	DIAGNOSTIC
-		if (sme == SEGINV)
-			panic("dvma_mapin: seg not mapped");
-#endif
+		KASSERT(sme != SEGINV);
 #ifdef	HAVECACHE
 		/* flush write-back on old mappings */
 		if (cache_size)
@@ -253,10 +260,7 @@ dvma_mapout(void *dma, int len)
 	x = v + seg_len;
 	while (v < x) {
 		sme = get_segmap(v);
-#ifdef	DIAGNOSTIC
-		if (sme == SEGINV)
-			panic("dvma_mapout: seg not mapped");
-#endif
+		KASSERT(sme != SEGINV);
 #ifdef	HAVECACHE
 		/* flush write-back on the DVMA mappings */
 		if (cache_size)
@@ -266,11 +270,9 @@ dvma_mapout(void *dma, int len)
 		v += NBSG;
 	}
 
-	if (extent_free(dvma_extent, seg_dma, seg_len,
-	EX_NOWAIT | EX_MALLOCOK))
-		panic("dvma_mapout: unable to free 0x%lx,0x%lx",
-		seg_dma, seg_len);
 	splx(s);
+
+	vmem_xfree(dvma_arena, seg_dma, seg_len);
 }
 
 int
@@ -285,11 +287,12 @@ int
 _bus_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
 bus_size_t buflen, struct proc *p, int flags)
 {
-	vaddr_t kva, dva;
+	vaddr_t kva;
+	vmem_addr_t dva;
 	vsize_t off, sgsize;
 	paddr_t pa;
 	pmap_t pmap;
-	int error, rv __diagused, s;
+	int error, rv __diagused;
 
 	/*
 	 * Make sure that on error condition we return "no valid mappings".
@@ -305,11 +308,18 @@ _bus_dmamap_load(bus_dma_tag_t t, bus_dm
 	sgsize = round_page(off + buflen);
 
 	/* Try to allocate DVMA space. */
-	s = splvm();
-	error = extent_alloc(dvma_extent, sgsize, PAGE_SIZE, 0,
-	EX_FAST | ((flags & BUS_DMA_NOWAIT) == 0 ? EX_WAITOK : 

CVS commit: src/sys/arch/sun3

2023-12-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec  1 23:56:30 UTC 2023

Modified Files:
src/sys/arch/sun3/sun3: dvma.c
src/sys/arch/sun3/sun3x: dvma.c

Log Message:
Use vmem(9) rather than extent(9) to manage DVMA mappings.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/sun3/sun3/dvma.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/sun3/sun3x/dvma.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/sparc64/dev

2023-11-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec  1 06:47:59 UTC 2023

Modified Files:
src/sys/arch/sparc64/dev: iommu.c iommuvar.h sbus.c

Log Message:
Use vmem(9) rather than extent(9) to manage DVMA mappings.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/arch/sparc64/dev/iommu.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/sparc64/dev/iommuvar.h
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/sparc64/dev/sbus.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/sparc64/dev/iommu.c
diff -u src/sys/arch/sparc64/dev/iommu.c:1.116 src/sys/arch/sparc64/dev/iommu.c:1.117
--- src/sys/arch/sparc64/dev/iommu.c:1.116	Mon Apr 26 07:18:01 2021
+++ src/sys/arch/sparc64/dev/iommu.c	Fri Dec  1 06:47:59 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: iommu.c,v 1.116 2021/04/26 07:18:01 mrg Exp $	*/
+/*	$NetBSD: iommu.c,v 1.117 2023/12/01 06:47:59 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: iommu.c,v 1.116 2021/04/26 07:18:01 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iommu.c,v 1.117 2023/12/01 06:47:59 thorpej Exp $");
 
 #include "opt_ddb.h"
 
@@ -212,13 +212,17 @@ iommu_init(char *name, struct iommu_stat
 	aprint_debug("IOTSB: %llx to %llx\n",
 		(unsigned long long)is->is_ptsb,
 		(unsigned long long)(is->is_ptsb + size - 1));
-	is->is_dvmamap = extent_create(name,
-	is->is_dvmabase, is->is_dvmaend,
-	0, 0, EX_NOWAIT);
-	if (!is->is_dvmamap)
-		panic("iommu_init: extent_create() failed");
-	  
-	mutex_init(>is_lock, MUTEX_DEFAULT, IPL_HIGH);
+	is->is_dvmamap = vmem_create(name,
+ is->is_dvmabase,
+ (is->is_dvmaend + 1) - is->is_dvmabase,
+ PAGE_SIZE,		/* quantum */
+ NULL,		/* importfn */
+ NULL,		/* releasefn */
+ NULL,		/* source */
+ 0,			/* qcache_max */
+ VM_SLEEP,
+ IPL_VM);
+	KASSERT(is->is_dvmamap != NULL);
 
 	/*
 	 * Set the TSB size.  The relevant bits were moved to the TSB
@@ -554,7 +558,8 @@ iommu_dvmamap_load(bus_dma_tag_t t, bus_
 	int err, needsflush;
 	bus_size_t sgsize;
 	paddr_t curaddr;
-	u_long dvmaddr, sgstart, sgend, bmask;
+	u_long sgstart, sgend, bmask;
+	vmem_addr_t dvmaddr;
 	bus_size_t align, boundary, len;
 	vaddr_t vaddr = (vaddr_t)buf;
 	int seg;
@@ -596,12 +601,15 @@ iommu_dvmamap_load(bus_dma_tag_t t, bus_
 	 * If our segment size is larger than the boundary we need to
 	 * split the transfer up int little pieces ourselves.
 	 */
-	KASSERT(is->is_dvmamap);
-	mutex_enter(>is_lock);
-	err = extent_alloc(is->is_dvmamap, sgsize, align,
-	(sgsize > boundary) ? 0 : boundary,
-	EX_NOWAIT|EX_BOUNDZERO, );
-	mutex_exit(>is_lock);
+	KASSERT(is->is_dvmamap != NULL);
+	err = vmem_xalloc(is->is_dvmamap, sgsize,
+			  align,		/* alignment */
+			  0,			/* phase */
+			  (sgsize > boundary) ? 0 : boundary,
+			  VMEM_ADDR_MIN,	/* minaddr */
+			  VMEM_ADDR_MAX,	/* maxaddr */
+			  VM_NOSLEEP | VM_BESTFIT,
+			  );
 
 #ifdef DEBUG
 	if (err || (dvmaddr == (u_long)-1)) {
@@ -649,15 +657,9 @@ iommu_dvmamap_load(bus_dma_tag_t t, bus_
 			/* Too many segments.  Fail the operation. */
 			DPRINTF(IDB_INFO, ("iommu_dvmamap_load: "
 			"too many segments %d\n", seg));
-			mutex_enter(>is_lock);
-			err = extent_free(is->is_dvmamap,
-			dvmaddr, sgsize, EX_NOWAIT);
+			vmem_xfree(is->is_dvmamap, dvmaddr, sgsize);
 			map->_dm_dvmastart = 0;
 			map->_dm_dvmasize = 0;
-			mutex_exit(>is_lock);
-			if (err != 0)
-printf("warning: %s: %" PRId64
-" of DVMA space lost\n", __func__, sgsize);
 			return (EFBIG);
 		}
 		sgstart += len;
@@ -741,8 +743,6 @@ iommu_dvmamap_unload(bus_dma_tag_t t, bu
 {
 	struct strbuf_ctl *sb = (struct strbuf_ctl *)map->_dm_cookie;
 	struct iommu_state *is = sb->sb_is;
-	int error;
-	bus_size_t sgsize = map->_dm_dvmasize;
 
 	/* Flush the iommu */
 	if (!map->_dm_dvmastart)
@@ -763,15 +763,9 @@ iommu_dvmamap_unload(bus_dma_tag_t t, bu
 		bus_dmamap_unload(t->_parent, map);
 	}
 
-	mutex_enter(>is_lock);
-	error = extent_free(is->is_dvmamap, map->_dm_dvmastart,
-		map->_dm_dvmasize, EX_NOWAIT);
+	vmem_xfree(is->is_dvmamap, map->_dm_dvmastart, map->_dm_dvmasize);
 	map->_dm_dvmastart = 0;
 	map->_dm_dvmasize = 0;
-	mutex_exit(>is_lock);
-	if (error != 0)
-		printf("warning: %s: %" PRId64 " of DVMA space lost\n",
-		__func__, sgsize);
 
 	/* Clear the map */
 }
@@ -833,17 +827,21 @@ iommu_dvmamap_load_raw(bus_dma_tag_t t, 
 	}
 	sgsize = round_page(sgsize);
 
-	mutex_enter(>is_lock);
 	/*
 	 * If our segment size is larger than the boundary we need to
 	 * split the transfer up into little pieces ourselves.
 	 */
-	err = extent_alloc(is->is_dvmamap, sgsize, align,
-		(sgsize > boundary) ? 0 : boundary,
-		((flags & BUS_DMA_NOWAIT) == 0 ? EX_WAITOK : EX_NOWAIT) |
-		EX_BOUNDZERO, );
-	mutex_exit(>is_lock);
+	const vm_flag_t vmflags = VM_BESTFIT |
+	((flags & 

CVS commit: src/sys/arch/sparc64/dev

2023-11-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec  1 06:47:59 UTC 2023

Modified Files:
src/sys/arch/sparc64/dev: iommu.c iommuvar.h sbus.c

Log Message:
Use vmem(9) rather than extent(9) to manage DVMA mappings.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/arch/sparc64/dev/iommu.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/sparc64/dev/iommuvar.h
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/sparc64/dev/sbus.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/sparc

2023-11-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec  1 05:22:02 UTC 2023

Modified Files:
src/sys/arch/sparc/dev: vme_machdep.c
src/sys/arch/sparc/sparc: iommu.c machdep.c

Log Message:
Use vmem(9) rather than extent(9) to manage DVMA mappings.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/sparc/dev/vme_machdep.c
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/sparc/sparc/iommu.c
cvs rdiff -u -r1.339 -r1.340 src/sys/arch/sparc/sparc/machdep.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/sparc/dev/vme_machdep.c
diff -u src/sys/arch/sparc/dev/vme_machdep.c:1.76 src/sys/arch/sparc/dev/vme_machdep.c:1.77
--- src/sys/arch/sparc/dev/vme_machdep.c:1.76	Fri Jan 21 19:22:56 2022
+++ src/sys/arch/sparc/dev/vme_machdep.c	Fri Dec  1 05:22:01 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: vme_machdep.c,v 1.76 2022/01/21 19:22:56 thorpej Exp $	*/
+/*	$NetBSD: vme_machdep.c,v 1.77 2023/12/01 05:22:01 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -30,14 +30,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vme_machdep.c,v 1.76 2022/01/21 19:22:56 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vme_machdep.c,v 1.77 2023/12/01 05:22:01 thorpej Exp $");
 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -190,7 +190,7 @@ struct rom_range vmebus_translations[] =
  * for DVMA space allocations. The DMA addresses returned by
  * bus_dmamap_load*() must be relocated by -VME4_DVMA_BASE.
  */
-struct extent *vme_dvmamap;
+vmem_t *vme_dvmamap;
 
 /*
  * The VME hardware on the sun4m IOMMU maps the first 8MB of 32-bit
@@ -314,8 +314,16 @@ vmeattach_mainbus(device_t parent, devic
 	sc->sc_nrange =
 		sizeof(vmebus_translations)/sizeof(vmebus_translations[0]);
 
-	vme_dvmamap = extent_create("vmedvma", VME4_DVMA_BASE, VME4_DVMA_END,
-0, 0, EX_WAITOK);
+	vme_dvmamap = vmem_create("vmedvma",
+  VME4_DVMA_BASE,
+  VME4_DVMA_END - VME4_DVMA_BASE,
+  PAGE_SIZE,		/* quantum */
+  NULL,			/* importfn */
+  NULL,			/* releasefn */
+  NULL,			/* source */
+  0,			/* qcache_max */
+  VM_SLEEP,
+  IPL_VM);
 
 	printf("\n");
 	(void)config_found(self, , 0, CFARGS_NONE);
@@ -828,7 +836,7 @@ sparc_vme4_dmamap_load(bus_dma_tag_t t, 
 {
 	bus_addr_t dva;
 	bus_size_t sgsize;
-	u_long ldva;
+	vmem_addr_t ldva;
 	vaddr_t va, voff;
 	pmap_t pmap;
 	int pagesz = PAGE_SIZE;
@@ -845,12 +853,18 @@ sparc_vme4_dmamap_load(bus_dma_tag_t t, 
 	 * covering the passed buffer.
 	 */
 	sgsize = (buflen + voff + pagesz - 1) & -pagesz;
-	error = extent_alloc(vme_dvmamap, sgsize, pagesz,
-			 map->_dm_boundary,
-			 (flags & BUS_DMA_NOWAIT) == 0
-	? EX_WAITOK
-	: EX_NOWAIT,
-			 );
+
+	const vm_flag_t vmflags = VM_BESTFIT |
+	((flags & BUS_DMA_NOWAIT) ? VM_NOSLEEP : VM_SLEEP);
+
+	error = vmem_xalloc(vme_dvmamap, sgsize,
+			0,			/* alignment */
+			0,			/* phase */
+			map->_dm_boundary,	/* nocross */
+			VMEM_ADDR_MIN,	/* minaddr */
+			VMEM_ADDR_MAX,	/* maxaddr */
+			vmflags,
+			);
 	if (error != 0)
 		return (error);
 	dva = (bus_addr_t)ldva;
@@ -895,7 +909,7 @@ sparc_vme4_dmamap_unload(bus_dma_tag_t t
 	int nsegs = map->dm_nsegs;
 	bus_addr_t dva;
 	bus_size_t len;
-	int i, s, error;
+	int i;
 
 	for (i = 0; i < nsegs; i++) {
 		/* Go from VME to CPU view */
@@ -907,11 +921,7 @@ sparc_vme4_dmamap_unload(bus_dma_tag_t t
 		pmap_remove(pmap_kernel(), dva, dva + len);
 
 		/* Release DVMA space */
-		s = splhigh();
-		error = extent_free(vme_dvmamap, dva, len, EX_NOWAIT);
-		splx(s);
-		if (error != 0)
-			printf("warning: %ld of DVMA space lost\n", len);
+		vmem_xfree(vme_dvmamap, dva, len);
 	}
 	pmap_update(pmap_kernel());
 

Index: src/sys/arch/sparc/sparc/iommu.c
diff -u src/sys/arch/sparc/sparc/iommu.c:1.101 src/sys/arch/sparc/sparc/iommu.c:1.102
--- src/sys/arch/sparc/sparc/iommu.c:1.101	Sat Jan 22 11:49:16 2022
+++ src/sys/arch/sparc/sparc/iommu.c	Fri Dec  1 05:22:01 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: iommu.c,v 1.101 2022/01/22 11:49:16 thorpej Exp $ */
+/*	$NetBSD: iommu.c,v 1.102 2023/12/01 05:22:01 thorpej Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -37,17 +37,17 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: iommu.c,v 1.101 2022/01/22 11:49:16 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iommu.c,v 1.102 2023/12/01 05:22:01 thorpej Exp $");
 
 #include "opt_sparc_arch.h"
 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -74,7 +74,7 @@ struct iommu_softc {
  * our clients will run.
  */
 	struct sparc_bus_dma_tag sc_dmatag;
-	struct extent *sc_dvmamap;
+	vmem_t *sc_dvmamap;
 };
 
 /* autoconfiguration driver */
@@ -274,9 +274,16 @@ iommu_attach(device_t parent, device_t s
 		sc->sc_pagesize,
 		sc->sc_range >> 20);
 
-	sc->sc_dvmamap = extent_create("iommudvma",
-		

CVS commit: src/sys/arch/sparc

2023-11-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec  1 05:22:02 UTC 2023

Modified Files:
src/sys/arch/sparc/dev: vme_machdep.c
src/sys/arch/sparc/sparc: iommu.c machdep.c

Log Message:
Use vmem(9) rather than extent(9) to manage DVMA mappings.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/sparc/dev/vme_machdep.c
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/sparc/sparc/iommu.c
cvs rdiff -u -r1.339 -r1.340 src/sys/arch/sparc/sparc/machdep.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/x86/x86

2023-11-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Nov 29 11:40:37 UTC 2023

Modified Files:
src/sys/arch/x86/x86: intr.c

Log Message:
Fix use-after-free (source->is_type) when detecting unsharable
interrupts. Doesn't solve the interrupt conflict itself, but
avoids a panic.


To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.166 src/sys/arch/x86/x86/intr.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/acpi

2023-11-25 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 25 20:17:52 UTC 2023

Modified Files:
src/sys/arch/arm/acpi: gic_acpi.c

Log Message:
gicv2: Fix truncation of GICC / GICD base addresses above 4GB.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/acpi/gic_acpi.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/acpi

2023-11-25 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 25 20:17:52 UTC 2023

Modified Files:
src/sys/arch/arm/acpi: gic_acpi.c

Log Message:
gicv2: Fix truncation of GICC / GICD base addresses above 4GB.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/acpi/gic_acpi.c

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

Modified files:

Index: src/sys/arch/arm/acpi/gic_acpi.c
diff -u src/sys/arch/arm/acpi/gic_acpi.c:1.7 src/sys/arch/arm/acpi/gic_acpi.c:1.8
--- src/sys/arch/arm/acpi/gic_acpi.c:1.7	Sat Aug  7 16:18:42 2021
+++ src/sys/arch/arm/acpi/gic_acpi.c	Sat Nov 25 20:17:52 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: gic_acpi.c,v 1.7 2021/08/07 16:18:42 thorpej Exp $ */
+/* $NetBSD: gic_acpi.c,v 1.8 2023/11/25 20:17:52 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "pci.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gic_acpi.c,v 1.7 2021/08/07 16:18:42 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic_acpi.c,v 1.8 2023/11/25 20:17:52 jmcneill Exp $");
 
 #include 
 #include 
@@ -102,8 +102,8 @@ gic_acpi_attach(device_t parent, device_
 		return;
 	}
 
-	const bus_addr_t addr = uimin(gicd->BaseAddress, gicc->BaseAddress);
-	const bus_size_t end = uimax(gicd->BaseAddress + GICD_SIZE, gicc->BaseAddress + GICC_SIZE);
+	const bus_addr_t addr = ulmin(gicd->BaseAddress, gicc->BaseAddress);
+	const bus_size_t end = ulmax(gicd->BaseAddress + GICD_SIZE, gicc->BaseAddress + GICC_SIZE);
 	const bus_size_t size = end - addr;
 
 	error = bus_space_map(_generic_bs_tag, addr, size, 0, );



CVS commit: src/sys/arch/prep/prep

2023-11-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 24 16:49:59 UTC 2023

Modified Files:
src/sys/arch/prep/prep: residual.c

Log Message:
Make this compile again with options RESIDUAL_DATA_DUMP (Andrius V)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/prep/prep/residual.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/prep/prep/residual.c
diff -u src/sys/arch/prep/prep/residual.c:1.18 src/sys/arch/prep/prep/residual.c:1.19
--- src/sys/arch/prep/prep/residual.c:1.18	Thu Mar 27 14:22:56 2014
+++ src/sys/arch/prep/prep/residual.c	Fri Nov 24 11:49:59 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: residual.c,v 1.18 2014/03/27 18:22:56 christos Exp $ */
+/*  $NetBSD: residual.c,v 1.19 2023/11/24 16:49:59 christos Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: residual.c,v 1.18 2014/03/27 18:22:56 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: residual.c,v 1.19 2023/11/24 16:49:59 christos Exp $");
 
 #include 
 #include 
@@ -935,6 +935,7 @@ large_vendor_pcibridge_subr(struct _L4_P
 	printf("PCI Bridge Slot Data\n");
 	for (i = 0; i < numslots; i++) {
 		int j, first, l;
+		char *t;
 
 		if (pi->map[i].slotnum)
 			printf("  PCI Slot %d", pi->map[i].slotnum);



CVS commit: src/sys/arch/prep/prep

2023-11-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 24 16:49:59 UTC 2023

Modified Files:
src/sys/arch/prep/prep: residual.c

Log Message:
Make this compile again with options RESIDUAL_DATA_DUMP (Andrius V)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/prep/prep/residual.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/playstation2

2023-11-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Nov 23 20:40:08 UTC 2023

Modified Files:
src/sys/arch/playstation2/ee: timer.c
src/sys/arch/playstation2/playstation2: bus_dma.c machdep.c

Log Message:
Few more changes for playstation2 specific code to adapt to interface or method
declaration changes. Still long way before port code can be built though...

reviewed by martin.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/playstation2/ee/timer.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/playstation2/playstation2/bus_dma.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/playstation2/playstation2/machdep.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/playstation2/ee/timer.c
diff -u src/sys/arch/playstation2/ee/timer.c:1.9 src/sys/arch/playstation2/ee/timer.c:1.10
--- src/sys/arch/playstation2/ee/timer.c:1.9	Sat Jun  5 21:38:37 2021
+++ src/sys/arch/playstation2/ee/timer.c	Thu Nov 23 20:40:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: timer.c,v 1.9 2021/06/05 21:38:37 christos Exp $	*/
+/*	$NetBSD: timer.c,v 1.10 2023/11/23 20:40:08 andvar Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,10 +30,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.9 2021/06/05 21:38:37 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.10 2023/11/23 20:40:08 andvar Exp $");
 
 #include "debug_playstation2.h"
 
+#include 
 #include 
 #include 
 

Index: src/sys/arch/playstation2/playstation2/bus_dma.c
diff -u src/sys/arch/playstation2/playstation2/bus_dma.c:1.26 src/sys/arch/playstation2/playstation2/bus_dma.c:1.27
--- src/sys/arch/playstation2/playstation2/bus_dma.c:1.26	Tue Jul 26 20:08:56 2022
+++ src/sys/arch/playstation2/playstation2/bus_dma.c	Thu Nov 23 20:40:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.26 2022/07/26 20:08:56 andvar Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.27 2023/11/23 20:40:08 andvar Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,12 +31,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.26 2022/07/26 20:08:56 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.27 2023/11/23 20:40:08 andvar Exp $");
 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -483,12 +484,10 @@ _bus_dmamem_alloc(bus_dma_tag_t t, bus_s
 bus_size_t boundary, bus_dma_segment_t *segs, int nsegs, int *rsegs,
 int flags)
 {
-	extern paddr_t avail_start, avail_end;
-
 	return (_bus_dmamem_alloc_range_common(t, size, alignment, boundary,
 	   segs, nsegs, rsegs, flags,
-	   avail_start /*low*/,
-	   avail_end - 1 /*high*/));
+	   pmap_limits.avail_start /*low*/,
+	   pmap_limits.avail_end - 1 /*high*/));
 }
 
 /*

Index: src/sys/arch/playstation2/playstation2/machdep.c
diff -u src/sys/arch/playstation2/playstation2/machdep.c:1.34 src/sys/arch/playstation2/playstation2/machdep.c:1.35
--- src/sys/arch/playstation2/playstation2/machdep.c:1.34	Tue Nov 16 05:16:47 2021
+++ src/sys/arch/playstation2/playstation2/machdep.c	Thu Nov 23 20:40:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.34 2021/11/16 05:16:47 msaitoh Exp $	*/
+/*	$NetBSD: machdep.c,v 1.35 2023/11/23 20:40:08 andvar Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.34 2021/11/16 05:16:47 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.35 2023/11/23 20:40:08 andvar Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kloader.h"
@@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 #include 
 #include 
 
+#include 
 #include 
 
 #ifdef DDB
@@ -54,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 
 #include 	/* cntab access (cpu_reboot) */
 #include 
+#include 
 #include 
 #include /* hardintr_init */
 #include 
@@ -84,7 +86,7 @@ void
 mach_init(void)
 {
 	extern char kernel_text[], edata[], end[];
-	void *kernend;
+	char *kernend;
 	struct pcb *pcb0;
 	vaddr_t v;
 	paddr_t start;
@@ -118,7 +120,7 @@ mach_init(void)
 	 * Initialize locore-function vector.
 	 * Clear out the I and D caches.
 	 */
-	mips_vector_init();
+	mips_vector_init(NULL, false);
 
 	/*
 	 * Load the rest of the available pages into the VM system.
@@ -134,12 +136,10 @@ mach_init(void)
 	mem_clusters[1].start = start;
 	mem_clusters[1].size = size;
 	/* load */
-	printf("load memory %#lx, %#x\n", start, size);
+	printf("load memory %#x, %#lx\n", start, size);
 	uvm_page_physload(atop(start), atop(start + size),
 	atop(start), atop(start + size), VM_FREELIST_DEFAULT);
 
-	strcpy(cpu_model, "SONY PlayStation 2");
-
 	/*
 	 * Initialize error message buffer (at end of core).
 	 */
@@ -153,12 +153,12 @@ mach_init(void)
 	v = uvm_pageboot_alloc(USPACE);
 
 	pcb0 = lwp_getpcb();
-	pcb0->pcb_context[11] = PSL_LOWIPL;	/* SR */
+	pcb0->pcb_context.val[_L_SR] = PSL_LOWIPL;	/* SR */
 #ifdef 

CVS commit: src/sys/arch/playstation2

2023-11-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Nov 23 20:40:08 UTC 2023

Modified Files:
src/sys/arch/playstation2/ee: timer.c
src/sys/arch/playstation2/playstation2: bus_dma.c machdep.c

Log Message:
Few more changes for playstation2 specific code to adapt to interface or method
declaration changes. Still long way before port code can be built though...

reviewed by martin.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/playstation2/ee/timer.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/playstation2/playstation2/bus_dma.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/playstation2/playstation2/machdep.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/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Nov 22 01:58:02 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_interface.c
src/sys/arch/alpha/include: db_machdep.h

Log Message:
Changes to let the Alpha DDB code build in user-space for crash(8).


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/alpha/alpha/db_interface.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/include/db_machdep.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/alpha/db_interface.c
diff -u src/sys/arch/alpha/alpha/db_interface.c:1.41 src/sys/arch/alpha/alpha/db_interface.c:1.42
--- src/sys/arch/alpha/alpha/db_interface.c:1.41	Tue Nov 21 22:19:12 2023
+++ src/sys/arch/alpha/alpha/db_interface.c	Wed Nov 22 01:58:02 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.41 2023/11/21 22:19:12 thorpej Exp $ */
+/* $NetBSD: db_interface.c,v 1.42 2023/11/22 01:58:02 thorpej Exp $ */
 
 /*
  * Mach Operating System
@@ -54,7 +54,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.41 2023/11/21 22:19:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.42 2023/11/22 01:58:02 thorpej Exp $");
 
 #include 
 #include 
@@ -70,6 +70,7 @@ __KERNEL_RCSID(0, "$NetBSD: db_interface
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -79,7 +80,6 @@ __KERNEL_RCSID(0, "$NetBSD: db_interface
 #include 
 #include 
 
-
 #if 0
 extern char *trap_type[];
 extern int trap_types;
@@ -159,10 +159,13 @@ db_alpha_regop(const struct db_variable 
 	unsigned long zeroval = 0;
 	struct trapframe *f = NULL;
 
+#ifdef _KERNEL			/* XXX ?? */
 	if (vp->modif != NULL && *vp->modif == 'u') {
 		if (curlwp != NULL)
 			f = curlwp->l_md.md_tf;
-	} else	f = DDB_REGS;
+	} else
+#endif /* _KERNEL */
+		f = DDB_REGS;
 	tfaddr = f == NULL ?  : >tf_regs[(u_long)vp->valuep];
 	switch (opcode) {
 	case DB_VAR_GET:
@@ -174,12 +177,16 @@ db_alpha_regop(const struct db_variable 
 		break;
 
 	default:
+#ifdef _KERNEL
 		panic("db_alpha_regop: unknown op %d", opcode);
+#endif
+		break;
 	}
 
 	return (0);
 }
 
+#ifdef _KERNEL
 /*
  * ddb_trap - field a kernel trap
  */
@@ -269,6 +276,7 @@ cpu_Debugger(void)
 
 	__asm volatile("call_pal 0x81");		/* bugchk */
 }
+#endif /* _KERNEL */
 
 /*
  * Alpha-specific ddb commands:
@@ -372,6 +380,7 @@ db_register_value(db_regs_t *regs, int r
 	return (regs->tf_regs[reg_to_frame[regno]]);
 }
 
+#ifdef _KERNEL
 /*
  * Support functions for software single-step.
  */
@@ -576,6 +585,7 @@ db_branch_taken(int ins, db_addr_t pc, d
 
 	return (newpc);
 }
+#endif /* _KERNEL */
 
 unsigned long
 db_alpha_read_saved_reg(unsigned long *regp)
@@ -605,6 +615,9 @@ db_alpha_nlist db_alpha_nl[] = {
 	DB_ALPHA_SYM(SYM_XentRestart, XentRestart),
 	DB_ALPHA_SYM(SYM_exception_return, exception_return),
 	DB_ALPHA_SYM(SYM_alpha_kthread_backstop, alpha_kthread_backstop),
+#ifndef _KERNEL
+	DB_ALPHA_SYM(SYM_dumppcb, dumppcb),
+#endif /* _KERNEL */
 	DB_ALPHA_SYM_EOL
 };
 

Index: src/sys/arch/alpha/include/db_machdep.h
diff -u src/sys/arch/alpha/include/db_machdep.h:1.22 src/sys/arch/alpha/include/db_machdep.h:1.23
--- src/sys/arch/alpha/include/db_machdep.h:1.22	Tue Nov 21 21:23:56 2023
+++ src/sys/arch/alpha/include/db_machdep.h	Wed Nov 22 01:58:02 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.h,v 1.22 2023/11/21 21:23:56 thorpej Exp $ */
+/* $NetBSD: db_machdep.h,v 1.23 2023/11/22 01:58:02 thorpej Exp $ */
 
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
@@ -38,6 +38,8 @@
 #include 
 #include 
 
+#include 
+
 typedef	vaddr_t		db_addr_t;	/* address - unsigned */
 #define	DDB_EXPR_FMT	"l"		/* expression is long */
 typedef	long		db_expr_t;	/* expression - signed */
@@ -195,8 +197,14 @@ typedef long		kgdb_reg_t;
 #define	SYM_XentRestart			6
 #define	SYM_exception_return		7
 #define	SYM_alpha_kthread_backstop	8
+#ifdef _KERNEL
 #define	SYM___eol			(SYM_alpha_kthread_backstop + 1)
+#else
+#define	SYM_dumppcb			9
+#define	SYM___eol			(SYM_dumppcb + 1)
+#endif /* _KERNEL */
 
+#ifdef _KERNEL
 struct db_alpha_nlist {
 	vaddr_t		n_value;
 };
@@ -205,6 +213,14 @@ typedef struct db_alpha_nlist db_alpha_n
 
 #define	DB_ALPHA_SYM(i, x)	[(i)] = { .n_value = (vaddr_t)&(x) }
 #define	DB_ALPHA_SYM_EOL	[SYM___eol] = { .n_value = 0 }
+#else
+#include 
+
+typedef struct nlist db_alpha_nlist;
+
+#define	DB_ALPHA_SYM(i, x)	[(i)] = { .n_name = __STRING(x) }
+#define	DB_ALPHA_SYM_EOL	[SYM___eol] = { .n_name = NULL }
+#endif /* _KERNEL */
 
 bool		db_alpha_sym_is_trap(db_addr_t);
 bool		db_alpha_sym_is_backstop(db_addr_t);



CVS commit: src/sys/arch/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Nov 22 01:58:02 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_interface.c
src/sys/arch/alpha/include: db_machdep.h

Log Message:
Changes to let the Alpha DDB code build in user-space for crash(8).


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/alpha/alpha/db_interface.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/include/db_machdep.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/alpha/include

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Nov 22 01:56:14 UTC 2023

Modified Files:
src/sys/arch/alpha/include: cpu.h

Log Message:
If not _KERNEL, include  to make sure we have offsetof().


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/alpha/include/cpu.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/alpha/include

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Nov 22 01:56:14 UTC 2023

Modified Files:
src/sys/arch/alpha/include: cpu.h

Log Message:
If not _KERNEL, include  to make sure we have offsetof().


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/alpha/include/cpu.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/include/cpu.h
diff -u src/sys/arch/alpha/include/cpu.h:1.104 src/sys/arch/alpha/include/cpu.h:1.105
--- src/sys/arch/alpha/include/cpu.h:1.104	Sat Aug 14 17:51:18 2021
+++ src/sys/arch/alpha/include/cpu.h	Wed Nov 22 01:56:14 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.104 2021/08/14 17:51:18 ryo Exp $ */
+/* $NetBSD: cpu.h,v 1.105 2023/11/22 01:56:14 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -89,6 +89,10 @@
 #include 
 #include 
 
+#ifndef _KERNEL
+#include 
+#endif /* ! _KERNEL */
+
 /*
  * Machine check information.
  */



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

2023-11-21 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue Nov 21 23:22:23 UTC 2023

Modified Files:
src/sys/arch/x86/pci: pci_machdep.c pci_msi_machdep.c

Log Message:
pci_machdep.c & pci_msi_machdep.c: comment fixes

Correct spelling and grammar in some comments.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/arch/x86/pci/pci_machdep.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/x86/pci/pci_msi_machdep.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/x86/pci/pci_machdep.c
diff -u src/sys/arch/x86/pci/pci_machdep.c:1.97 src/sys/arch/x86/pci/pci_machdep.c:1.98
--- src/sys/arch/x86/pci/pci_machdep.c:1.97	Tue Oct 17 12:07:42 2023
+++ src/sys/arch/x86/pci/pci_machdep.c	Tue Nov 21 23:22:23 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.97 2023/10/17 12:07:42 bouyer Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.98 2023/11/21 23:22:23 gutteridge Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.97 2023/10/17 12:07:42 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.98 2023/11/21 23:22:23 gutteridge Exp $");
 
 #include 
 #include 
@@ -228,7 +228,7 @@ const struct {
 
 /* arch/xen does not support MSI/MSI-X yet. */
 #ifdef __HAVE_PCI_MSI_MSIX
-#define PCI_QUIRK_DISABLE_MSI	1 /* Neigher MSI nor MSI-X work */
+#define PCI_QUIRK_DISABLE_MSI	1 /* Neither MSI nor MSI-X work */
 #define PCI_QUIRK_DISABLE_MSIX	2 /* MSI-X does not work */
 #define PCI_QUIRK_ENABLE_MSI_VM	3 /* Older chipset in VM where MSI and MSI-X works */
 
@@ -507,7 +507,7 @@ pci_attach_hook(device_t parent, device_
 	 * support it than the other way around, so be conservative
 	 * here.  So we don't enable MSI if we don't find a host
 	 * bridge there.  We also deliberately don't enable MSI on
-	 * chipsets from low-end manifacturers like VIA and SiS.
+	 * chipsets from low-end manufacturers like VIA and SiS.
 	 */
 	for (i = 0; i <= 7; i++) {
 		tag = pci_make_tag(pc, 0, 0, i);

Index: src/sys/arch/x86/pci/pci_msi_machdep.c
diff -u src/sys/arch/x86/pci/pci_msi_machdep.c:1.18 src/sys/arch/x86/pci/pci_msi_machdep.c:1.19
--- src/sys/arch/x86/pci/pci_msi_machdep.c:1.18	Sat May 13 11:27:10 2023
+++ src/sys/arch/x86/pci/pci_msi_machdep.c	Tue Nov 21 23:22:23 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_msi_machdep.c,v 1.18 2023/05/13 11:27:10 andvar Exp $	*/
+/*	$NetBSD: pci_msi_machdep.c,v 1.19 2023/11/21 23:22:23 gutteridge Exp $	*/
 
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_msi_machdep.c,v 1.18 2023/05/13 11:27:10 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_msi_machdep.c,v 1.19 2023/11/21 23:22:23 gutteridge Exp $");
 
 #include "opt_intrdebug.h"
 #include "ioapic.h"
@@ -397,7 +397,7 @@ x86_pci_msix_release_internal(pci_intr_h
  */
 
 /*
- * Return intrid for a MSI/MSI-X device.
+ * Return intrid for an MSI/MSI-X device.
  * "buf" must be allocated by caller.
  */
 const char *
@@ -432,9 +432,9 @@ x86_pci_msi_release(pci_chipset_tag_t pc
 }
 
 /*
- * Establish a MSI handle.
- * If multiple MSI handle is required to establish, device driver must call
- * this function for each handle.
+ * Establish an MSI handle.
+ * If multiple MSI handles are required to be established, a device driver
+ * must call this function for each handle.
  */
 void *
 x86_pci_msi_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih,
@@ -452,9 +452,9 @@ x86_pci_msi_establish(pci_chipset_tag_t 
 }
 
 /*
- * Disestablish a MSI handle.
- * If multiple MSI handle is required to disestablish, device driver must call
- * this function for each handle.
+ * Disestablish an MSI handle.
+ * If multiple MSI handles are required to be disestablished, a device driver
+ * must call this function for each handle.
  */
 void
 x86_pci_msi_disestablish(pci_chipset_tag_t pc, void *cookie)
@@ -477,9 +477,9 @@ x86_pci_msix_release(pci_chipset_tag_t p
 }
 
 /*
- * Establish a MSI-X handle.
- * If multiple MSI-X handle is required to establish, device driver must call
- * this function for each handle.
+ * Establish an MSI-X handle.
+ * If multiple MSI-X handles are required to be established, a device driver
+ * must call this function for each handle.
  */
 void *
 x86_pci_msix_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih,
@@ -497,9 +497,9 @@ x86_pci_msix_establish(pci_chipset_tag_t
 }
 
 /*
- * Disestablish a MSI-X handle.
- * If multiple MSI-X handle is required to disestablish, device driver must call
- * this function for each handle.
+ * Disestablish an MSI-X handle.
+ * If multiple MSI-X handles are required to be disestablished, a device driver
+ * must call this function for each handle.
  */
 void
 x86_pci_msix_disestablish(pci_chipset_tag_t pc, void *cookie)
@@ -577,7 +577,7 @@ pci_msi_alloc_exact(const struct pci_att
 /*
  * This function is 

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

2023-11-21 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue Nov 21 23:22:23 UTC 2023

Modified Files:
src/sys/arch/x86/pci: pci_machdep.c pci_msi_machdep.c

Log Message:
pci_machdep.c & pci_msi_machdep.c: comment fixes

Correct spelling and grammar in some comments.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/arch/x86/pci/pci_machdep.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/x86/pci/pci_msi_machdep.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/alpha/include

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 22:27:41 UTC 2023

Modified Files:
src/sys/arch/alpha/include: alpha_instruction.h

Log Message:
Expose alpha_print_instruction_context to not-_KERNEL.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/alpha/include/alpha_instruction.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/include/alpha_instruction.h
diff -u src/sys/arch/alpha/include/alpha_instruction.h:1.1 src/sys/arch/alpha/include/alpha_instruction.h:1.2
--- src/sys/arch/alpha/include/alpha_instruction.h:1.1	Tue Nov 21 22:19:12 2023
+++ src/sys/arch/alpha/include/alpha_instruction.h	Tue Nov 21 22:27:41 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: alpha_instruction.h,v 1.1 2023/11/21 22:19:12 thorpej Exp $ */
+/* $NetBSD: alpha_instruction.h,v 1.2 2023/11/21 22:27:41 thorpej Exp $ */
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -746,7 +746,6 @@ typedef union {
 #define	op_cvtgd_su	0x5ad
 #define	op_cvtgqg_sv	0x5af
 
-#ifdef _KERNEL
 struct alpha_print_instruction_context {
 	unsigned long pc;	/* address of insn */
 	alpha_instruction insn;	/* instruction bits */
@@ -755,6 +754,7 @@ struct alpha_print_instruction_context {
 	size_t	cursor;		/* current next output location */
 };
 
+#ifdef _KERNEL
 int	alpha_print_instruction(struct alpha_print_instruction_context *);
 #endif /* _KERNEL */
 



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

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 22:27:41 UTC 2023

Modified Files:
src/sys/arch/alpha/include: alpha_instruction.h

Log Message:
Expose alpha_print_instruction_context to not-_KERNEL.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/alpha/include/alpha_instruction.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/alpha/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 22:25:16 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_disasm.c

Log Message:
pal_opname(): Make the static buffer for unknown PALcode ops large enough
to hold all possible values.
alpha_print_instruction(): Make this private if not-_KERNEL.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/alpha/alpha/db_disasm.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/alpha/db_disasm.c
diff -u src/sys/arch/alpha/alpha/db_disasm.c:1.19 src/sys/arch/alpha/alpha/db_disasm.c:1.20
--- src/sys/arch/alpha/alpha/db_disasm.c:1.19	Tue Nov 21 22:19:12 2023
+++ src/sys/arch/alpha/alpha/db_disasm.c	Tue Nov 21 22:25:16 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_disasm.c,v 1.19 2023/11/21 22:19:12 thorpej Exp $ */
+/* $NetBSD: db_disasm.c,v 1.20 2023/11/21 22:25:16 thorpej Exp $ */
 
 /*
  * Mach Operating System
@@ -48,7 +48,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.19 2023/11/21 22:19:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.20 2023/11/21 22:25:16 thorpej Exp $");
 
 #include 
 #include 
@@ -191,7 +191,7 @@ static const struct tbl pal_op_tbl[] = {
 static const char *
 pal_opname(int op)
 {
-	static char unk[8];
+	static char unk[11];
 	int i;
 
 	for (i = 0; pal_op_tbl[i].name != NULL; i++) {
@@ -199,7 +199,7 @@ pal_opname(int op)
 			return (pal_op_tbl[i].name);
 	}
 
-	snprintf(unk, sizeof(unk), "0x%x", op);
+	snprintf(unk, sizeof(unk), "0x%08x", op);
 	return (unk);
 }
 
@@ -813,6 +813,9 @@ insn_printf(struct alpha_print_instructi
  * next instruction.
  */
 
+#ifndef _KERNEL
+static
+#endif
 int
 alpha_print_instruction(struct alpha_print_instruction_context *ctx)
 {



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

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 22:25:16 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_disasm.c

Log Message:
pal_opname(): Make the static buffer for unknown PALcode ops large enough
to hold all possible values.
alpha_print_instruction(): Make this private if not-_KERNEL.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/alpha/alpha/db_disasm.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/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 22:19:13 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_disasm.c db_interface.c db_trace.c
fp_complete.c patch.c trap.c
Added Files:
src/sys/arch/alpha/include: alpha_instruction.h
Removed Files:
src/sys/arch/alpha/alpha: db_instruction.h

Log Message:
Move alpha/alpha/db_instruction.h -> alpha/include/alpha_instruction.h


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/alpha/alpha/db_disasm.c
cvs rdiff -u -r1.13 -r0 src/sys/arch/alpha/alpha/db_instruction.h
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/alpha/alpha/db_interface.c
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/alpha/alpha/db_trace.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/alpha/alpha/fp_complete.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/alpha/alpha/patch.c
cvs rdiff -u -r1.139 -r1.140 src/sys/arch/alpha/alpha/trap.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/alpha/include/alpha_instruction.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/alpha/db_disasm.c
diff -u src/sys/arch/alpha/alpha/db_disasm.c:1.18 src/sys/arch/alpha/alpha/db_disasm.c:1.19
--- src/sys/arch/alpha/alpha/db_disasm.c:1.18	Mon Jun 21 02:10:46 2021
+++ src/sys/arch/alpha/alpha/db_disasm.c	Tue Nov 21 22:19:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_disasm.c,v 1.18 2021/06/21 02:10:46 thorpej Exp $ */
+/* $NetBSD: db_disasm.c,v 1.19 2023/11/21 22:19:12 thorpej Exp $ */
 
 /*
  * Mach Operating System
@@ -48,13 +48,13 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.18 2021/06/21 02:10:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.19 2023/11/21 22:19:12 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 

Index: src/sys/arch/alpha/alpha/db_interface.c
diff -u src/sys/arch/alpha/alpha/db_interface.c:1.40 src/sys/arch/alpha/alpha/db_interface.c:1.41
--- src/sys/arch/alpha/alpha/db_interface.c:1.40	Tue Nov 21 21:53:06 2023
+++ src/sys/arch/alpha/alpha/db_interface.c	Tue Nov 21 22:19:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.40 2023/11/21 21:53:06 thorpej Exp $ */
+/* $NetBSD: db_interface.c,v 1.41 2023/11/21 22:19:12 thorpej Exp $ */
 
 /*
  * Mach Operating System
@@ -54,7 +54,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.40 2023/11/21 21:53:06 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.41 2023/11/21 22:19:12 thorpej Exp $");
 
 #include 
 #include 
@@ -68,7 +68,7 @@ __KERNEL_RCSID(0, "$NetBSD: db_interface
 #include 
 #include 
 
-#include 
+#include 
 
 #include 
 #include 

Index: src/sys/arch/alpha/alpha/db_trace.c
diff -u src/sys/arch/alpha/alpha/db_trace.c:1.38 src/sys/arch/alpha/alpha/db_trace.c:1.39
--- src/sys/arch/alpha/alpha/db_trace.c:1.38	Tue Nov 21 21:23:56 2023
+++ src/sys/arch/alpha/alpha/db_trace.c	Tue Nov 21 22:19:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.38 2023/11/21 21:23:56 thorpej Exp $ */
+/* $NetBSD: db_trace.c,v 1.39 2023/11/21 22:19:12 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.38 2023/11/21 21:23:56 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.39 2023/11/21 22:19:12 thorpej Exp $");
 
 #include 
 #include 
@@ -44,7 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: db_trace.c,v
 #include 
 #include 
 
-#include 
+#include 
 
 #include 
 #include 

Index: src/sys/arch/alpha/alpha/fp_complete.c
diff -u src/sys/arch/alpha/alpha/fp_complete.c:1.30 src/sys/arch/alpha/alpha/fp_complete.c:1.31
--- src/sys/arch/alpha/alpha/fp_complete.c:1.30	Sun May 22 11:27:33 2022
+++ src/sys/arch/alpha/alpha/fp_complete.c	Tue Nov 21 22:19:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: fp_complete.c,v 1.30 2022/05/22 11:27:33 andvar Exp $ */
+/* $NetBSD: fp_complete.c,v 1.31 2023/11/21 22:19:12 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2001 Ross Harvey
@@ -37,7 +37,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: fp_complete.c,v 1.30 2022/05/22 11:27:33 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fp_complete.c,v 1.31 2023/11/21 22:19:12 thorpej Exp $");
 
 #include 
 #include 
@@ -49,7 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: fp_complete.
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 

Index: src/sys/arch/alpha/alpha/patch.c
diff -u src/sys/arch/alpha/alpha/patch.c:1.7 src/sys/arch/alpha/alpha/patch.c:1.8
--- src/sys/arch/alpha/alpha/patch.c:1.7	Tue Jul 13 01:59:10 2021
+++ src/sys/arch/alpha/alpha/patch.c	Tue Nov 21 22:19:12 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: patch.c,v 1.7 2021/07/13 01:59:10 thorpej Exp $	*/
+/*	$NetBSD: patch.c,v 1.8 2023/11/21 22:19:12 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2021 The NetBSD Foundation, 

CVS commit: src/sys/arch/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 22:19:13 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_disasm.c db_interface.c db_trace.c
fp_complete.c patch.c trap.c
Added Files:
src/sys/arch/alpha/include: alpha_instruction.h
Removed Files:
src/sys/arch/alpha/alpha: db_instruction.h

Log Message:
Move alpha/alpha/db_instruction.h -> alpha/include/alpha_instruction.h


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/alpha/alpha/db_disasm.c
cvs rdiff -u -r1.13 -r0 src/sys/arch/alpha/alpha/db_instruction.h
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/alpha/alpha/db_interface.c
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/alpha/alpha/db_trace.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/alpha/alpha/fp_complete.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/alpha/alpha/patch.c
cvs rdiff -u -r1.139 -r1.140 src/sys/arch/alpha/alpha/trap.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/alpha/include/alpha_instruction.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/alpha/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 21:53:06 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_interface.c

Log Message:
Ensure that all fields of db_regs[] are initialized.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/alpha/alpha/db_interface.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/alpha/db_interface.c
diff -u src/sys/arch/alpha/alpha/db_interface.c:1.39 src/sys/arch/alpha/alpha/db_interface.c:1.40
--- src/sys/arch/alpha/alpha/db_interface.c:1.39	Tue Nov 21 21:23:56 2023
+++ src/sys/arch/alpha/alpha/db_interface.c	Tue Nov 21 21:53:06 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.39 2023/11/21 21:23:56 thorpej Exp $ */
+/* $NetBSD: db_interface.c,v 1.40 2023/11/21 21:53:06 thorpej Exp $ */
 
 /*
  * Mach Operating System
@@ -54,7 +54,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.39 2023/11/21 21:23:56 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.40 2023/11/21 21:53:06 thorpej Exp $");
 
 #include 
 #include 
@@ -105,45 +105,53 @@ static int db_alpha_regop(const struct d
 
 #define	dbreg(xx)	((long *)(xx))
 
+#define	DBREG(n, r)		\
+	{	.name = __STRING(n),\
+		.valuep = ((long *)(r)),			\
+		.fcn = db_alpha_regop,\
+		.modif = NULL, }
+
 const struct db_variable db_regs[] = {
-	{	"v0",	dbreg(FRAME_V0),	db_alpha_regop	},
-	{	"t0",	dbreg(FRAME_T0),	db_alpha_regop	},
-	{	"t1",	dbreg(FRAME_T1),	db_alpha_regop	},
-	{	"t2",	dbreg(FRAME_T2),	db_alpha_regop	},
-	{	"t3",	dbreg(FRAME_T3),	db_alpha_regop	},
-	{	"t4",	dbreg(FRAME_T4),	db_alpha_regop	},
-	{	"t5",	dbreg(FRAME_T5),	db_alpha_regop	},
-	{	"t6",	dbreg(FRAME_T6),	db_alpha_regop	},
-	{	"t7",	dbreg(FRAME_T7),	db_alpha_regop	},
-	{	"s0",	dbreg(FRAME_S0),	db_alpha_regop	},
-	{	"s1",	dbreg(FRAME_S1),	db_alpha_regop	},
-	{	"s2",	dbreg(FRAME_S2),	db_alpha_regop	},
-	{	"s3",	dbreg(FRAME_S3),	db_alpha_regop	},
-	{	"s4",	dbreg(FRAME_S4),	db_alpha_regop	},
-	{	"s5",	dbreg(FRAME_S5),	db_alpha_regop	},
-	{	"s6",	dbreg(FRAME_S6),	db_alpha_regop	},
-	{	"a0",	dbreg(FRAME_A0),	db_alpha_regop	},
-	{	"a1",	dbreg(FRAME_A1),	db_alpha_regop	},
-	{	"a2",	dbreg(FRAME_A2),	db_alpha_regop	},
-	{	"a3",	dbreg(FRAME_A3),	db_alpha_regop	},
-	{	"a4",	dbreg(FRAME_A4),	db_alpha_regop	},
-	{	"a5",	dbreg(FRAME_A5),	db_alpha_regop	},
-	{	"t8",	dbreg(FRAME_T8),	db_alpha_regop	},
-	{	"t9",	dbreg(FRAME_T9),	db_alpha_regop	},
-	{	"t10",	dbreg(FRAME_T10),	db_alpha_regop	},
-	{	"t11",	dbreg(FRAME_T11),	db_alpha_regop	},
-	{	"ra",	dbreg(FRAME_RA),	db_alpha_regop	},
-	{	"t12",	dbreg(FRAME_T12),	db_alpha_regop	},
-	{	"at",	dbreg(FRAME_AT),	db_alpha_regop	},
-	{	"gp",	dbreg(FRAME_GP),	db_alpha_regop	},
-	{	"sp",	dbreg(FRAME_SP),	db_alpha_regop	},
-	{	"pc",	dbreg(FRAME_PC),	db_alpha_regop	},
-	{	"ps",	dbreg(FRAME_PS),	db_alpha_regop	},
-	{	"ai",	dbreg(FRAME_T11),	db_alpha_regop	},
-	{	"pv",	dbreg(FRAME_T12),	db_alpha_regop	},
+	DBREG(v0,	FRAME_V0),
+	DBREG(t0,	FRAME_T0),
+	DBREG(t1,	FRAME_T1),
+	DBREG(t2,	FRAME_T2),
+	DBREG(t3,	FRAME_T3),
+	DBREG(t4,	FRAME_T4),
+	DBREG(t5,	FRAME_T5),
+	DBREG(t6,	FRAME_T6),
+	DBREG(t7,	FRAME_T7),
+	DBREG(s0,	FRAME_S0),
+	DBREG(s1,	FRAME_S1),
+	DBREG(s2,	FRAME_S2),
+	DBREG(s3,	FRAME_S3),
+	DBREG(s4,	FRAME_S4),
+	DBREG(s5,	FRAME_S5),
+	DBREG(s6,	FRAME_S6),
+	DBREG(a0,	FRAME_A0),
+	DBREG(a1,	FRAME_A1),
+	DBREG(a2,	FRAME_A2),
+	DBREG(a3,	FRAME_A3),
+	DBREG(a4,	FRAME_A4),
+	DBREG(a5,	FRAME_A5),
+	DBREG(t8,	FRAME_T8),
+	DBREG(t9,	FRAME_T9),
+	DBREG(t10,	FRAME_T10),
+	DBREG(t11,	FRAME_T11),
+	DBREG(ra,	FRAME_RA),
+	DBREG(t12,	FRAME_T12),
+	DBREG(at,	FRAME_AT),
+	DBREG(gp,	FRAME_GP),
+	DBREG(sp,	FRAME_SP),
+	DBREG(pc,	FRAME_PC),
+	DBREG(ps,	FRAME_PS),
+	DBREG(ai,	FRAME_T11),
+	DBREG(pv,	FRAME_T12),
 };
 const struct db_variable * const db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
 
+#undef DBREG
+
 static int
 db_alpha_regop(const struct db_variable *vp, db_expr_t *val, int opcode)
 {



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

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 21:53:06 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_interface.c

Log Message:
Ensure that all fields of db_regs[] are initialized.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/alpha/alpha/db_interface.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/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 21:23:56 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_interface.c db_trace.c
src/sys/arch/alpha/include: db_machdep.h

Log Message:
Adjust proc/lwp access for user-space (crash(8)).


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/alpha/alpha/db_interface.c
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/alpha/alpha/db_trace.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/include/db_machdep.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/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 21:23:56 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_interface.c db_trace.c
src/sys/arch/alpha/include: db_machdep.h

Log Message:
Adjust proc/lwp access for user-space (crash(8)).


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/alpha/alpha/db_interface.c
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/alpha/alpha/db_trace.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/include/db_machdep.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/alpha/db_interface.c
diff -u src/sys/arch/alpha/alpha/db_interface.c:1.38 src/sys/arch/alpha/alpha/db_interface.c:1.39
--- src/sys/arch/alpha/alpha/db_interface.c:1.38	Tue Nov 21 19:59:07 2023
+++ src/sys/arch/alpha/alpha/db_interface.c	Tue Nov 21 21:23:56 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.38 2023/11/21 19:59:07 thorpej Exp $ */
+/* $NetBSD: db_interface.c,v 1.39 2023/11/21 21:23:56 thorpej Exp $ */
 
 /*
  * Mach Operating System
@@ -54,7 +54,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.38 2023/11/21 19:59:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.39 2023/11/21 21:23:56 thorpej Exp $");
 
 #include 
 #include 
@@ -569,6 +569,21 @@ db_branch_taken(int ins, db_addr_t pc, d
 	return (newpc);
 }
 
+unsigned long
+db_alpha_read_saved_reg(unsigned long *regp)
+{
+	unsigned long reg;
+
+	db_read_bytes((db_addr_t)regp, sizeof(reg), (char *));
+	return reg;
+}
+
+unsigned long
+db_alpha_tf_reg(struct trapframe *tf, unsigned int regno)
+{
+	return db_alpha_read_saved_reg(>tf_regs[regno]);
+}
+
 /*
  * Alpha special symbol handling.
  */

Index: src/sys/arch/alpha/alpha/db_trace.c
diff -u src/sys/arch/alpha/alpha/db_trace.c:1.37 src/sys/arch/alpha/alpha/db_trace.c:1.38
--- src/sys/arch/alpha/alpha/db_trace.c:1.37	Tue Nov 21 20:40:24 2023
+++ src/sys/arch/alpha/alpha/db_trace.c	Tue Nov 21 21:23:56 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.37 2023/11/21 20:40:24 thorpej Exp $ */
+/* $NetBSD: db_trace.c,v 1.38 2023/11/21 21:23:56 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.37 2023/11/21 20:40:24 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.38 2023/11/21 21:23:56 thorpej Exp $");
 
 #include 
 #include 
@@ -138,16 +138,6 @@ decode_syscall(int number, void (*pr)(co
 	(*pr)(" (%d)", number);
 }
 
-static unsigned long
-db_alpha_tf_reg(struct trapframe *tf, unsigned int regno)
-{
-	unsigned long reg;
-
-	db_read_bytes((db_addr_t)>tf_regs[regno], sizeof(reg),
-	(char *));
-	return reg;
-}
-
 void
 db_stack_trace_print(db_expr_t addr, bool have_addr, db_expr_t count,
 const char *modif, void (*pr)(const char *, ...))
@@ -191,15 +181,27 @@ db_stack_trace_print_ra(db_expr_t ra, bo
 		frame = (db_addr_t)tf + FRAME_SIZE * 8;
 		ra_from_tf = true;
 	} else {
+#ifdef _KERNEL
 		struct proc *p = NULL;
 		struct lwp *l = NULL;
+#else
+		struct proc pstore, *p = 
+		struct lwp lstore, *l = 
+#endif /* _KERNEL */
 
 		if (trace_thread) {
 			if (lwpaddr) {
+#ifdef _KERNEL
 l = (struct lwp *)addr;
 p = l->l_proc;
+#else
+db_read_bytes(addr, sizeof(*l), (char *)l);
+db_read_bytes((db_addr_t)l->l_proc,
+sizeof(*p), (char *)p);
+#endif /* _KERNEL */
 (*pr)("trace: pid %d ", p->p_pid);
 			} else {
+#ifdef _KERNEL
 (*pr)("trace: pid %d ", (int)addr);
 p = proc_find_raw(addr);
 if (p == NULL) {
@@ -208,11 +210,15 @@ db_stack_trace_print_ra(db_expr_t ra, bo
 }
 l = LIST_FIRST(>p_lwps);
 KASSERT(l != NULL);
+#else
+(*pr)("no proc_find_raw() in crash\n");
+return;
+#endif /* _KERNEL */
 			}
 			(*pr)("lid %d ", l->l_lid);
 			pcbp = lwp_getpcb(l);
-			addr = (db_expr_t)pcbp->pcb_hw.apcb_ksp;
-			callpc = pcbp->pcb_context[7];
+			addr = db_alpha_read_saved_reg(>pcb_hw.apcb_ksp);
+			callpc = db_alpha_read_saved_reg(>pcb_context[7]);
 			(*pr)("at 0x%lx\n", addr);
 		} else if (have_ra) {
 			callpc = ra;

Index: src/sys/arch/alpha/include/db_machdep.h
diff -u src/sys/arch/alpha/include/db_machdep.h:1.21 src/sys/arch/alpha/include/db_machdep.h:1.22
--- src/sys/arch/alpha/include/db_machdep.h:1.21	Tue Nov 21 19:59:07 2023
+++ src/sys/arch/alpha/include/db_machdep.h	Tue Nov 21 21:23:56 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.h,v 1.21 2023/11/21 19:59:07 thorpej Exp $ */
+/* $NetBSD: db_machdep.h,v 1.22 2023/11/21 21:23:56 thorpej Exp $ */
 
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
@@ -211,6 +211,9 @@ bool		db_alpha_sym_is_backstop(db_addr_t
 bool		db_alpha_sym_is_syscall(db_addr_t);
 const char *	db_alpha_trapsym_description(db_addr_t);
 
+unsigned long	db_alpha_read_saved_reg(unsigned long *);
+unsigned long	db_alpha_tf_reg(struct 

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

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 20:40:24 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_trace.c

Log Message:
Reduce db_trace.c's exposure to proc/lwp.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/alpha/alpha/db_trace.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/alpha/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 20:40:24 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_trace.c

Log Message:
Reduce db_trace.c's exposure to proc/lwp.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/alpha/alpha/db_trace.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/alpha/db_trace.c
diff -u src/sys/arch/alpha/alpha/db_trace.c:1.36 src/sys/arch/alpha/alpha/db_trace.c:1.37
--- src/sys/arch/alpha/alpha/db_trace.c:1.36	Tue Nov 21 20:29:47 2023
+++ src/sys/arch/alpha/alpha/db_trace.c	Tue Nov 21 20:40:24 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.36 2023/11/21 20:29:47 thorpej Exp $ */
+/* $NetBSD: db_trace.c,v 1.37 2023/11/21 20:40:24 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.36 2023/11/21 20:29:47 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.37 2023/11/21 20:40:24 thorpej Exp $");
 
 #include 
 #include 
@@ -133,9 +133,8 @@ do {	\
 }
 
 static void
-decode_syscall(int number, struct proc *p, void (*pr)(const char *, ...))
+decode_syscall(int number, void (*pr)(const char *, ...))
 {
-
 	(*pr)(" (%d)", number);
 }
 
@@ -175,8 +174,6 @@ db_stack_trace_print_ra(db_expr_t ra, bo
 	struct trapframe *tf;
 	bool ra_from_tf;
 	u_long last_ipl = ~0L;
-	struct proc *p = NULL;
-	struct lwp *l = NULL;
 	char c;
 	bool trace_thread = false;
 	bool lwpaddr = false;
@@ -188,13 +185,15 @@ db_stack_trace_print_ra(db_expr_t ra, bo
 	}
 
 	if (!have_addr) {
-		p = curproc;
 		addr = DDB_REGS->tf_regs[FRAME_SP] - FRAME_SIZE * 8;
 		tf = (struct trapframe *)addr;
 		callpc = db_alpha_tf_reg(tf, FRAME_PC);
 		frame = (db_addr_t)tf + FRAME_SIZE * 8;
 		ra_from_tf = true;
 	} else {
+		struct proc *p = NULL;
+		struct lwp *l = NULL;
+
 		if (trace_thread) {
 			if (lwpaddr) {
 l = (struct lwp *)addr;
@@ -293,7 +292,7 @@ db_stack_trace_print_ra(db_expr_t ra, bo
 			tfps = db_alpha_tf_reg(tf, FRAME_PS);
 			if (db_alpha_sym_is_syscall(symval)) {
 decode_syscall(db_alpha_tf_reg(tf, FRAME_V0),
-p, pr);
+pr);
 			}
 			if ((tfps & ALPHA_PSL_IPL_MASK) != last_ipl) {
 last_ipl = tfps & ALPHA_PSL_IPL_MASK;



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

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 20:29:47 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_trace.c

Log Message:
decode_prologue(): Make pc a db_addr_t, not a db_expr_t.
db_stack_trace_print_ra(): Missed one direct reference to XentSys; fix.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/alpha/db_trace.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/alpha/db_trace.c
diff -u src/sys/arch/alpha/alpha/db_trace.c:1.35 src/sys/arch/alpha/alpha/db_trace.c:1.36
--- src/sys/arch/alpha/alpha/db_trace.c:1.35	Tue Nov 21 19:59:07 2023
+++ src/sys/arch/alpha/alpha/db_trace.c	Tue Nov 21 20:29:47 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.35 2023/11/21 19:59:07 thorpej Exp $ */
+/* $NetBSD: db_trace.c,v 1.36 2023/11/21 20:29:47 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.35 2023/11/21 19:59:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.36 2023/11/21 20:29:47 thorpej Exp $");
 
 #include 
 #include 
@@ -71,7 +71,7 @@ decode_prologue(db_addr_t callpc, db_add
 {
 	long signed_immediate;
 	alpha_instruction ins;
-	db_expr_t pc;
+	db_addr_t pc;
 
 	pi->pi_regmask = 0;
 	pi->pi_frame_size = 0;
@@ -297,8 +297,9 @@ db_stack_trace_print_ra(db_expr_t ra, bo
 			}
 			if ((tfps & ALPHA_PSL_IPL_MASK) != last_ipl) {
 last_ipl = tfps & ALPHA_PSL_IPL_MASK;
-if (symval != (vaddr_t))
+if (! db_alpha_sym_is_syscall(symval)) {
 	(*pr)(" (from ipl %ld)", last_ipl);
+}
 			}
 			(*pr)(" ---\n");
 			if (tfps & ALPHA_PSL_USERMODE) {



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

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 20:29:47 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_trace.c

Log Message:
decode_prologue(): Make pc a db_addr_t, not a db_expr_t.
db_stack_trace_print_ra(): Missed one direct reference to XentSys; fix.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/alpha/db_trace.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/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 19:59:07 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_interface.c db_trace.c
src/sys/arch/alpha/include: db_machdep.h

Log Message:
Refactor the special symbol handling out of db_trace.c into
db_interface.c, and abstract it away from having to read kernel
symbols directly.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/alpha/alpha/db_interface.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/alpha/alpha/db_trace.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/alpha/include/db_machdep.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/alpha/db_interface.c
diff -u src/sys/arch/alpha/alpha/db_interface.c:1.37 src/sys/arch/alpha/alpha/db_interface.c:1.38
--- src/sys/arch/alpha/alpha/db_interface.c:1.37	Wed Oct 26 23:38:05 2022
+++ src/sys/arch/alpha/alpha/db_interface.c	Tue Nov 21 19:59:07 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.37 2022/10/26 23:38:05 riastradh Exp $ */
+/* $NetBSD: db_interface.c,v 1.38 2023/11/21 19:59:07 thorpej Exp $ */
 
 /*
  * Mach Operating System
@@ -47,12 +47,14 @@
  *	NASA Ames Research Center
  */
 
+#ifdef _KERNEL_OPT
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
+#endif
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.37 2022/10/26 23:38:05 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.38 2023/11/21 19:59:07 thorpej Exp $");
 
 #include 
 #include 
@@ -566,3 +568,72 @@ db_branch_taken(int ins, db_addr_t pc, d
 
 	return (newpc);
 }
+
+/*
+ * Alpha special symbol handling.
+ */
+db_alpha_nlist db_alpha_nl[] = {
+	DB_ALPHA_SYM(SYM_XentArith, XentArith),
+	DB_ALPHA_SYM(SYM_XentIF, XentIF),
+	DB_ALPHA_SYM(SYM_XentInt, XentInt),
+	DB_ALPHA_SYM(SYM_XentMM, XentMM),
+	DB_ALPHA_SYM(SYM_XentSys, XentSys),
+	DB_ALPHA_SYM(SYM_XentUna, XentUna),
+	DB_ALPHA_SYM(SYM_XentRestart, XentRestart),
+	DB_ALPHA_SYM(SYM_exception_return, exception_return),
+	DB_ALPHA_SYM(SYM_alpha_kthread_backstop, alpha_kthread_backstop),
+	DB_ALPHA_SYM_EOL
+};
+
+static int
+db_alpha_nlist_lookup(db_addr_t addr)
+{
+	int i;
+
+	for (i = 0; i < SYM___eol; i++) {
+		if (db_alpha_nl[i].n_value == addr) {
+			return i;
+		}
+	}
+	return -1;
+}
+
+bool
+db_alpha_sym_is_trap(db_addr_t addr)
+{
+	int i = db_alpha_nlist_lookup(addr);
+	return i >= SYM_XentArith && i <= SYM_exception_return;
+}
+
+bool
+db_alpha_sym_is_backstop(db_addr_t addr)
+{
+	return db_alpha_nlist_lookup(addr) == SYM_alpha_kthread_backstop;
+}
+
+bool
+db_alpha_sym_is_syscall(db_addr_t addr)
+{
+	return db_alpha_nlist_lookup(addr) == SYM_XentSys;
+}
+
+const char *
+db_alpha_trapsym_description(db_addr_t addr)
+{
+	static const char * const trap_descriptions[] = {
+	[SYM_XentArith]		=	"arithmetic trap",
+	[SYM_XentIF]		=	"instruction fault",
+	[SYM_XentInt]		=	"interrupt",
+	[SYM_XentMM]		=	"memory management fault",
+	[SYM_XentSys]		=	"syscall",
+	[SYM_XentUna]		=	"unaligned access fault",
+	[SYM_XentRestart]	=	"console restart",
+	[SYM_exception_return]	=	"(exception return)",
+	};
+
+	int i = db_alpha_nlist_lookup(addr);
+	if (i >= SYM_XentArith && i <= SYM_exception_return) {
+		return trap_descriptions[i];
+	}
+	return "??? trap ???";
+}

Index: src/sys/arch/alpha/alpha/db_trace.c
diff -u src/sys/arch/alpha/alpha/db_trace.c:1.34 src/sys/arch/alpha/alpha/db_trace.c:1.35
--- src/sys/arch/alpha/alpha/db_trace.c:1.34	Tue Nov 21 18:57:29 2023
+++ src/sys/arch/alpha/alpha/db_trace.c	Tue Nov 21 19:59:07 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.34 2023/11/21 18:57:29 thorpej Exp $ */
+/* $NetBSD: db_trace.c,v 1.35 2023/11/21 19:59:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.34 2023/11/21 18:57:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.35 2023/11/21 19:59:07 thorpej Exp $");
 
 #include 
 #include 
@@ -62,39 +62,6 @@ struct prologue_info {
 };
 
 /*
- * We use several symbols to take special action:
- *
- *	Trap vectors, which use a different (fixed-size) stack frame:
- *
- *		XentArith
- *		XentIF
- *		XentInt
- *		XentMM
- *		XentSys
- *		XentUna
- */
-
-static struct special_symbol {
-	vaddr_t ss_val;
-	const char *ss_note;
-} special_symbols[] = {
-	{ (vaddr_t),		"arithmetic trap" },
-	{ (vaddr_t),		"instruction fault" },
-	{ (vaddr_t),		"interrupt" },
-	{ (vaddr_t),		"memory management fault" },
-	{ (vaddr_t),		"syscall" },
-	{ (vaddr_t),		"unaligned access fault" },
-	{ (vaddr_t),	"console restart" },
-
-	/*
-	 * We'll not know what trap we took, but we'll find the
-	 * trap frame, at least...
-	 */
-	{ (vaddr_t)_return,	"(exception return)" },
-	{ 0 }
-};
-
-/*
  * Decode the function prologue for the function we're in, and note
  * which registers are stored 

CVS commit: src/sys/arch/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 19:59:07 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_interface.c db_trace.c
src/sys/arch/alpha/include: db_machdep.h

Log Message:
Refactor the special symbol handling out of db_trace.c into
db_interface.c, and abstract it away from having to read kernel
symbols directly.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/alpha/alpha/db_interface.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/alpha/alpha/db_trace.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/alpha/include/db_machdep.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/alpha/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 18:57:29 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_trace.c

Log Message:
Don't access insns or frame values directly; use db_read_bytes().


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/alpha/alpha/db_trace.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/alpha/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 18:57:29 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_trace.c

Log Message:
Don't access insns or frame values directly; use db_read_bytes().


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/alpha/alpha/db_trace.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/alpha/db_trace.c
diff -u src/sys/arch/alpha/alpha/db_trace.c:1.33 src/sys/arch/alpha/alpha/db_trace.c:1.34
--- src/sys/arch/alpha/alpha/db_trace.c:1.33	Tue Nov 21 14:35:01 2023
+++ src/sys/arch/alpha/alpha/db_trace.c	Tue Nov 21 18:57:29 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.33 2023/11/21 14:35:01 riastradh Exp $ */
+/* $NetBSD: db_trace.c,v 1.34 2023/11/21 18:57:29 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.33 2023/11/21 14:35:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.34 2023/11/21 18:57:29 thorpej Exp $");
 
 #include 
 #include 
@@ -117,7 +117,7 @@ do {	\
 } while (0)
 
 	for (pc = func; pc < callpc; pc += sizeof(alpha_instruction)) {
-		ins.bits = *(unsigned int *)pc;
+		db_read_bytes(pc, sizeof(ins.bits), (char *));
 
 		if (ins.mem_format.opcode == op_lda &&
 		ins.mem_format.ra == 30 &&
@@ -199,6 +199,16 @@ db_alpha_trap_is_syscall(vaddr_t v)
 	return v == (vaddr_t)
 }
 
+static unsigned long
+db_alpha_tf_reg(struct trapframe *tf, unsigned int regno)
+{
+	unsigned long reg;
+
+	db_read_bytes((db_addr_t)>tf_regs[regno], sizeof(reg),
+	(char *));
+	return reg;
+}
+
 static void
 decode_syscall(int number, struct proc *p, void (*pr)(const char *, ...))
 {
@@ -248,7 +258,7 @@ db_stack_trace_print_ra(db_expr_t ra, bo
 		p = curproc;
 		addr = DDB_REGS->tf_regs[FRAME_SP] - FRAME_SIZE * 8;
 		tf = (struct trapframe *)addr;
-		callpc = tf->tf_regs[FRAME_PC];
+		callpc = db_alpha_tf_reg(tf, FRAME_PC);
 		frame = (db_addr_t)tf + FRAME_SIZE * 8;
 		ra_from_tf = true;
 	} else {
@@ -347,9 +357,11 @@ db_stack_trace_print_ra(db_expr_t ra, bo
 
 			(*pr)("--- %s", db_alpha_trap_description(symval));
 
-			tfps = tf->tf_regs[FRAME_PS];
-			if (db_alpha_trap_is_syscall(symval))
-decode_syscall(tf->tf_regs[FRAME_V0], p, pr);
+			tfps = db_alpha_tf_reg(tf, FRAME_PS);
+			if (db_alpha_trap_is_syscall(symval)) {
+decode_syscall(db_alpha_tf_reg(tf, FRAME_V0),
+p, pr);
+			}
 			if ((tfps & ALPHA_PSL_IPL_MASK) != last_ipl) {
 last_ipl = tfps & ALPHA_PSL_IPL_MASK;
 if (symval != (vaddr_t))
@@ -360,7 +372,7 @@ db_stack_trace_print_ra(db_expr_t ra, bo
 (*pr)("--- user mode ---\n");
 break;	/* Terminate search.  */
 			}
-			callpc = tf->tf_regs[FRAME_PC];
+			callpc = db_alpha_tf_reg(tf, FRAME_PC);
 			frame = (db_addr_t)tf + FRAME_SIZE * 8;
 			ra_from_tf = true;
 			continue;
@@ -380,14 +392,19 @@ db_stack_trace_print_ra(db_expr_t ra, bo
 			 * in a leaf call).  If not, we've found the
 			 * root of the call graph.
 			 */
-			if (ra_from_tf)
-callpc = tf->tf_regs[FRAME_RA];
-			else {
+			if (ra_from_tf) {
+callpc = db_alpha_tf_reg(tf, FRAME_RA);
+			} else {
 (*pr)("--- root of call graph ---\n");
 break;
 			}
-		} else
-			callpc = *(u_long *)(frame + pi.pi_reg_offset[26]);
+		} else {
+			unsigned long reg;
+
+			db_read_bytes(frame + pi.pi_reg_offset[26],
+			sizeof(reg), (char *));
+			callpc = reg;
+		}
 		frame += pi.pi_frame_size;
 		ra_from_tf = false;
 	}



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

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 17:52:51 UTC 2023

Modified Files:
src/sys/arch/alpha/common: shared_intr.c

Log Message:
Don't open-code tailq access.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/common/shared_intr.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/shared_intr.c
diff -u src/sys/arch/alpha/common/shared_intr.c:1.29 src/sys/arch/alpha/common/shared_intr.c:1.30
--- src/sys/arch/alpha/common/shared_intr.c:1.29	Sun Jul  4 22:36:43 2021
+++ src/sys/arch/alpha/common/shared_intr.c	Tue Nov 21 17:52:51 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: shared_intr.c,v 1.29 2021/07/04 22:36:43 thorpej Exp $ */
+/* $NetBSD: shared_intr.c,v 1.30 2023/11/21 17:52:51 thorpej Exp $ */
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: shared_intr.c,v 1.29 2021/07/04 22:36:43 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: shared_intr.c,v 1.30 2023/11/21 17:52:51 thorpej Exp $");
 
 #include 
 #include 
@@ -122,14 +122,11 @@ int
 alpha_shared_intr_dispatch(struct alpha_shared_intr *intr, unsigned int num)
 {
 	struct alpha_shared_intrhand *ih;
-	int rv, handled;
+	int rv = 0;
 
 	atomic_add_long([num].intr_evcnt.ev_count, 1);
 
-	ih = intr[num].intr_q.tqh_first;
-	handled = 0;
-	while (ih != NULL) {
-
+	TAILQ_FOREACH(ih, [num].intr_q, ih_q) {
 		/*
 		 * The handler returns one of three values:
 		 *   0:	This interrupt wasn't for me.
@@ -137,14 +134,10 @@ alpha_shared_intr_dispatch(struct alpha_
 		 *  -1: This interrupt might have been for me, but I can't say
 		 *  for sure.
 		 */
-
-		rv = (*ih->ih_fn)(ih->ih_arg);
-
-		handled = handled || (rv != 0);
-		ih = ih->ih_q.tqe_next;
+		rv |= (*ih->ih_fn)(ih->ih_arg);
 	}
 
-	return (handled);
+	return (rv ? 1 : 0);
 }
 
 static int
@@ -246,7 +239,7 @@ alpha_shared_intr_link(struct alpha_shar
 			break;
 	case IST_PULSE:
 		if (type != IST_NONE) {
-			if (intr[num].intr_q.tqh_first == NULL) {
+			if (TAILQ_FIRST([num].intr_q) == NULL) {
 printf("alpha_shared_intr_establish: %s irq %d: warning: using %s on %s\n",
 basename, num, intr_typename(type),
 intr_typename(intr[num].intr_sharetype));
@@ -321,15 +314,16 @@ int
 alpha_shared_intr_isactive(struct alpha_shared_intr *intr, unsigned int num)
 {
 
-	return (intr[num].intr_q.tqh_first != NULL);
+	return TAILQ_FIRST([num].intr_q) != NULL;
 }
 
 int
 alpha_shared_intr_firstactive(struct alpha_shared_intr *intr, unsigned int num)
 {
+	struct alpha_shared_intrhand *ih;
 
-	return (intr[num].intr_q.tqh_first != NULL &&
-		intr[num].intr_q.tqh_first->ih_q.tqe_next == NULL);
+	return (ih = TAILQ_FIRST([num].intr_q)) != NULL &&
+	   TAILQ_NEXT(ih, ih_q) == NULL;
 }
 
 void



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

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 17:52:51 UTC 2023

Modified Files:
src/sys/arch/alpha/common: shared_intr.c

Log Message:
Don't open-code tailq access.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/common/shared_intr.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

2023-11-19 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Nov 20 03:05:48 UTC 2023

Modified Files:
src/sys/arch/amd64/amd64: process_machdep.c
src/sys/arch/amd64/include: ptrace.h
src/sys/arch/i386/i386: process_machdep.c
src/sys/arch/i386/include: ptrace.h

Log Message:
Note some large xstate stack objects what Somebody(tm) should look at
when they find some round tuits.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/amd64/amd64/process_machdep.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/amd64/include/ptrace.h
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/i386/i386/process_machdep.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/i386/include/ptrace.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

2023-11-19 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Nov 20 03:05:48 UTC 2023

Modified Files:
src/sys/arch/amd64/amd64: process_machdep.c
src/sys/arch/amd64/include: ptrace.h
src/sys/arch/i386/i386: process_machdep.c
src/sys/arch/i386/include: ptrace.h

Log Message:
Note some large xstate stack objects what Somebody(tm) should look at
when they find some round tuits.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/amd64/amd64/process_machdep.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/amd64/include/ptrace.h
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/i386/i386/process_machdep.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/i386/include/ptrace.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/amd64/amd64/process_machdep.c
diff -u src/sys/arch/amd64/amd64/process_machdep.c:1.49 src/sys/arch/amd64/amd64/process_machdep.c:1.50
--- src/sys/arch/amd64/amd64/process_machdep.c:1.49	Mon Oct 19 17:47:37 2020
+++ src/sys/arch/amd64/amd64/process_machdep.c	Mon Nov 20 03:05:48 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: process_machdep.c,v 1.49 2020/10/19 17:47:37 christos Exp $	*/
+/*	$NetBSD: process_machdep.c,v 1.50 2023/11/20 03:05:48 simonb Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.49 2020/10/19 17:47:37 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.50 2023/11/20 03:05:48 simonb Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_xen.h"
@@ -396,7 +396,7 @@ process_machdep_doxstate(struct lwp *cur
 	/* l:			 traced */
 {
 	int error;
-	struct xstate r;
+	struct xstate r;	/* XXX FIXME big stack object */
 	char *kv;
 	ssize_t kl;
 

Index: src/sys/arch/amd64/include/ptrace.h
diff -u src/sys/arch/amd64/include/ptrace.h:1.22 src/sys/arch/amd64/include/ptrace.h:1.23
--- src/sys/arch/amd64/include/ptrace.h:1.22	Sat May 30 08:41:22 2020
+++ src/sys/arch/amd64/include/ptrace.h	Mon Nov 20 03:05:48 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.22 2020/05/30 08:41:22 maxv Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.23 2023/11/20 03:05:48 simonb Exp $	*/
 
 /*
  * Copyright (c) 1993 Christopher G. Demetriou
@@ -117,7 +117,7 @@ MODULE_HOOK(netbsd32_process_doxmmregs_h
 #define PT64_GETXSTATE		PT_GETXSTATE
 #define COREDUMP_MACHDEP_LWP_NOTES(l, ns, name)\
 {	\
-	struct xstate xstate;		\
+	struct xstate xstate;	/* XXX FIXME big stack object */	\
 	memset(, 0, sizeof(xstate));\
 	if (!process_read_xstate(l, ))\
 	{\

Index: src/sys/arch/i386/i386/process_machdep.c
diff -u src/sys/arch/i386/i386/process_machdep.c:1.96 src/sys/arch/i386/i386/process_machdep.c:1.97
--- src/sys/arch/i386/i386/process_machdep.c:1.96	Mon Oct 19 17:47:37 2020
+++ src/sys/arch/i386/i386/process_machdep.c	Mon Nov 20 03:05:48 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: process_machdep.c,v 1.96 2020/10/19 17:47:37 christos Exp $	*/
+/*	$NetBSD: process_machdep.c,v 1.97 2023/11/20 03:05:48 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.96 2020/10/19 17:47:37 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.97 2023/11/20 03:05:48 simonb Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -408,7 +408,7 @@ process_machdep_doxstate(struct lwp *cur
 	/* l:			 traced */
 {
 	int error;
-	struct xstate r;
+	struct xstate r;	/* XXX FIXME big stack object */
 	char *kv;
 	ssize_t kl;
 

Index: src/sys/arch/i386/include/ptrace.h
diff -u src/sys/arch/i386/include/ptrace.h:1.26 src/sys/arch/i386/include/ptrace.h:1.27
--- src/sys/arch/i386/include/ptrace.h:1.26	Sat May 30 08:41:23 2020
+++ src/sys/arch/i386/include/ptrace.h	Mon Nov 20 03:05:48 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.26 2020/05/30 08:41:23 maxv Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.27 2023/11/20 03:05:48 simonb Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -162,7 +162,7 @@
 #define PT32_GETXSTATE		PT_GETXSTATE
 #define COREDUMP_MACHDEP_LWP_NOTES(l, ns, name)\
 {	\
-	struct xstate xstate;		\
+	struct xstate xstate;	/* XXX FIXME big stack object */	\
 	memset(, 0, sizeof(xstate));\
 	if (!process_read_xstate(l, ))\
 	{\



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

2023-11-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Nov 19 20:01:48 UTC 2023

Modified Files:
src/sys/arch/alpha/conf: GENERIC.QEMU

Log Message:
Add some VirtIO devies.  virtio-scsi and virtio-rng are tested a bit,
virtio-blk does not work, virtio-net not yet tested.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/alpha/conf/GENERIC.QEMU

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/conf/GENERIC.QEMU
diff -u src/sys/arch/alpha/conf/GENERIC.QEMU:1.1 src/sys/arch/alpha/conf/GENERIC.QEMU:1.2
--- src/sys/arch/alpha/conf/GENERIC.QEMU:1.1	Sun May 23 01:34:17 2021
+++ src/sys/arch/alpha/conf/GENERIC.QEMU	Sun Nov 19 20:01:48 2023
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC.QEMU,v 1.1 2021/05/23 01:34:17 thorpej Exp $
+# $NetBSD: GENERIC.QEMU,v 1.2 2023/11/19 20:01:48 thorpej Exp $
 #
 # Generic Alpha kernel specifically configured for Qemu.
 
@@ -8,3 +8,12 @@ include	"arch/alpha/conf/GENERIC"
 # because Qemu does not load the symbol table when loading the
 # kernel.
 makeoptions	COPY_SYMTAB=1
+
+# Virtio devices
+virtio*	at pci? dev ? function ?	# Virtio PCI device
+#viomb*	at virtio?			# Virtio memory balloon device
+ld*	at virtio?			# Virtio disk device
+vioif*	at virtio?			# Virtio network device
+viornd*	at virtio?			# Virtio entropy device
+vioscsi* at virtio?			# Virtio SCSI device
+#vio9p*	at virtio?			# Virtio 9P device



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

2023-11-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Nov 19 20:01:48 UTC 2023

Modified Files:
src/sys/arch/alpha/conf: GENERIC.QEMU

Log Message:
Add some VirtIO devies.  virtio-scsi and virtio-rng are tested a bit,
virtio-blk does not work, virtio-net not yet tested.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/alpha/conf/GENERIC.QEMU

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



CVS commit: src/sys/arch/m68k/fpe

2023-11-18 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Nov 19 03:58:15 UTC 2023

Modified Files:
src/sys/arch/m68k/fpe: fpu_rem.c

Log Message:
m68k: Remove an unused variable since rev 1.1.
Detected by clang15 (nono emulator has imported and used this FPE).


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/m68k/fpe/fpu_rem.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/m68k/fpe

2023-11-18 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Nov 19 03:58:15 UTC 2023

Modified Files:
src/sys/arch/m68k/fpe: fpu_rem.c

Log Message:
m68k: Remove an unused variable since rev 1.1.
Detected by clang15 (nono emulator has imported and used this FPE).


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/m68k/fpe/fpu_rem.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/m68k/fpe/fpu_rem.c
diff -u src/sys/arch/m68k/fpe/fpu_rem.c:1.17 src/sys/arch/m68k/fpe/fpu_rem.c:1.18
--- src/sys/arch/m68k/fpe/fpu_rem.c:1.17	Thu Feb  5 12:22:06 2015
+++ src/sys/arch/m68k/fpe/fpu_rem.c	Sun Nov 19 03:58:15 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_rem.c,v 1.17 2015/02/05 12:22:06 isaki Exp $	*/
+/*	$NetBSD: fpu_rem.c,v 1.18 2023/11/19 03:58:15 isaki Exp $	*/
 
 /*
  * Copyright (c) 1995  Ken Nakata
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_rem.c,v 1.17 2015/02/05 12:22:06 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_rem.c,v 1.18 2023/11/19 03:58:15 isaki Exp $");
 
 #include 
 #include 
@@ -48,7 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: fpu_rem.c,v 
  *signQ := signX EOR signY. Record whether MOD or REM
  *is requested.
  *
- *   Step 2.  Set L := expo(X)-expo(Y), k := 0, Q := 0.
+ *   Step 2.  Set L := expo(X)-expo(Y), Q := 0.
  *If (L < 0) then
  *   R := X, go to Step 4.
  *else
@@ -59,8 +59,7 @@ __KERNEL_RCSID(0, "$NetBSD: fpu_rem.c,v 
  *3.1 If R = Y, then { Q := Q + 1, R := 0, go to Step 7. }
  *3.2 If R > Y, then { R := R - Y, Q := Q + 1}
  *3.3 If j = 0, go to Step 4.
- *3.4 k := k + 1, j := j - 1, Q := 2Q, R := 2R. Go to
- *Step 3.1.
+ *3.4 j := j - 1, Q := 2Q, R := 2R. Go to Step 3.1.
  *
  *   Step 4.  R := signX*R.
  *
@@ -105,7 +104,7 @@ __fpu_modrem(struct fpemu *fe, int is_mo
 	static struct fpn X, Y;
 	struct fpn *x, *y, *r;
 	uint32_t signX, signY, signQ;
-	int j, k, l, q;
+	int j, l, q;
 	int cmp;
 
 	if (ISNAN(>fe_f1) || ISNAN(>fe_f2))
@@ -138,7 +137,6 @@ __fpu_modrem(struct fpemu *fe, int is_mo
 	 * Step 2
 	 */
 	l = x->fp_exp - y->fp_exp;
-	k = 0;
 	CPYFPN(r, x);
 	if (l >= 0) {
 		r->fp_exp -= l;
@@ -168,7 +166,6 @@ __fpu_modrem(struct fpemu *fe, int is_mo
 goto Step4;
 
 			/* Step 3.4 */
-			k++;
 			j--;
 			q += q;
 			r->fp_exp++;



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/arch/playstation2/conf

2023-11-07 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Nov  7 21:39:30 UTC 2023

Modified Files:
src/sys/arch/playstation2/conf: AGATE DEBUG std.playstation2

Log Message:
Remove ksyms from AGATE/DEBUG configs, it is defined in included default config.
Remove unneeded "channel ?" for atapibus* in DEBUG config.
Add "midi* at midibus?" needed for umidi to compile in DEBUG config.
Change SOFTFLOAT to FPEMUL in std.playstation2 (property was renamed).

playstation2 code was likely never fully restored/fixed and doesn't build, but
these changes would be needed in case someone will.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/playstation2/conf/AGATE
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/playstation2/conf/DEBUG
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/playstation2/conf/std.playstation2

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/playstation2/conf/AGATE
diff -u src/sys/arch/playstation2/conf/AGATE:1.13 src/sys/arch/playstation2/conf/AGATE:1.14
--- src/sys/arch/playstation2/conf/AGATE:1.13	Fri Aug 21 01:52:08 2015
+++ src/sys/arch/playstation2/conf/AGATE	Tue Nov  7 21:39:30 2023
@@ -1,7 +1,7 @@
 #
 # -- SCPH-18000 used by u...@netbsd.org
 #
-# 	$NetBSD: AGATE,v 1.13 2015/08/21 01:52:08 uebayasi Exp $
+# 	$NetBSD: AGATE,v 1.14 2023/11/07 21:39:30 andvar Exp $
 #
 
 include 	"arch/playstation2/conf/std.playstation2"
@@ -19,7 +19,6 @@ options 	KLOADER_KERNEL_PATH="\"/netbsd\
 options 	KLOADER
 
 options 	DDB			# in-kernel debugger
-pseudo-device	ksyms
 
 options 	NMBCLUSTERS=4096 # Max. number of mbuf clusters
 

Index: src/sys/arch/playstation2/conf/DEBUG
diff -u src/sys/arch/playstation2/conf/DEBUG:1.28 src/sys/arch/playstation2/conf/DEBUG:1.29
--- src/sys/arch/playstation2/conf/DEBUG:1.28	Tue Jun 29 10:22:36 2021
+++ src/sys/arch/playstation2/conf/DEBUG	Tue Nov  7 21:39:30 2023
@@ -1,7 +1,7 @@
 #
 # kernel config file for debugging.
 #
-# 	$NetBSD: DEBUG,v 1.28 2021/06/29 10:22:36 nia Exp $
+# 	$NetBSD: DEBUG,v 1.29 2023/11/07 21:39:30 andvar Exp $
 #
 
 include 	"arch/playstation2/conf/std.playstation2"
@@ -28,7 +28,6 @@ options 	NFSSERVER	# Network File System
 #options 	DIAGNOSTIC	# expensive kernel consistency checks
 options 	DEBUG			# extra kernel debugging support
 options 	DDB			# in-kernel debugger
-pseudo-device	ksyms
 options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB
 options 	KTRACE			# system call tracing support
 options 	MSGBUFSIZE=8192		# dmesg buffer size
@@ -59,11 +58,12 @@ ucom*	at umodem?
 
 # USB Mass Storage
 umass*	at uhub? port ? configuration ? interface ?
-atapibus* at umass? channel ?
+atapibus* at umass?
 scsibus* at umass? channel ?
 
 # USB audio
 uaudio*	at uhub? port ? configuration ?
+midi*	at midibus?
 
 # USB MIDI
 umidi* at uhub? port ? configuration ?

Index: src/sys/arch/playstation2/conf/std.playstation2
diff -u src/sys/arch/playstation2/conf/std.playstation2:1.12 src/sys/arch/playstation2/conf/std.playstation2:1.13
--- src/sys/arch/playstation2/conf/std.playstation2:1.12	Fri Jun  4 10:46:11 2021
+++ src/sys/arch/playstation2/conf/std.playstation2	Tue Nov  7 21:39:30 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: std.playstation2,v 1.12 2021/06/04 10:46:11 martin Exp $
+#	$NetBSD: std.playstation2,v 1.13 2023/11/07 21:39:30 andvar Exp $
 
 machine playstation2 mips
 include		"conf/std"	# MI standard options
@@ -10,7 +10,7 @@ options 	MIPS3_5900
 options 	IPL_ICU_MASK
 
 options 	NOFPU		# Don't use FPU (R5900 FPU is single float only)
-options 	SOFTFLOAT	# emulate FPU insn
+options 	FPEMUL		# emulate FPU insn
 
 options 	EXEC_ELF32	# exec ELF32 binaries
 options 	EXEC_SCRIPT	# exec #! scripts



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

2023-11-07 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Nov  7 21:39:30 UTC 2023

Modified Files:
src/sys/arch/playstation2/conf: AGATE DEBUG std.playstation2

Log Message:
Remove ksyms from AGATE/DEBUG configs, it is defined in included default config.
Remove unneeded "channel ?" for atapibus* in DEBUG config.
Add "midi* at midibus?" needed for umidi to compile in DEBUG config.
Change SOFTFLOAT to FPEMUL in std.playstation2 (property was renamed).

playstation2 code was likely never fully restored/fixed and doesn't build, but
these changes would be needed in case someone will.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/playstation2/conf/AGATE
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/playstation2/conf/DEBUG
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/playstation2/conf/std.playstation2

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



CVS commit: src/sys/arch/playstation2/playstation2

2023-11-07 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Nov  7 21:19:04 UTC 2023

Modified Files:
src/sys/arch/playstation2/playstation2: kloader_machdep.c

Log Message:
add explicit void in function declaration to fix old-style function declaration.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/sys/arch/playstation2/playstation2/kloader_machdep.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/playstation2/playstation2/kloader_machdep.c
diff -u src/sys/arch/playstation2/playstation2/kloader_machdep.c:1.5 src/sys/arch/playstation2/playstation2/kloader_machdep.c:1.6
--- src/sys/arch/playstation2/playstation2/kloader_machdep.c:1.5	Mon Mar 31 11:25:49 2014
+++ src/sys/arch/playstation2/playstation2/kloader_machdep.c	Tue Nov  7 21:19:04 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: kloader_machdep.c,v 1.5 2014/03/31 11:25:49 martin Exp $	*/
+/*	$NetBSD: kloader_machdep.c,v 1.6 2023/11/07 21:19:04 andvar Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2004 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kloader_machdep.c,v 1.5 2014/03/31 11:25:49 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kloader_machdep.c,v 1.6 2023/11/07 21:19:04 andvar Exp $");
 
 #include "debug_kloader.h"
 
@@ -66,7 +66,7 @@ kloader_playstation2_jump(kloader_bootfu
 }
 
 void
-kloader_playstation2_reset()
+kloader_playstation2_reset(void)
 {
 
 	((void (*)(void))0xbfc0)();



CVS commit: src/sys/arch/playstation2/playstation2

2023-11-07 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Nov  7 21:19:04 UTC 2023

Modified Files:
src/sys/arch/playstation2/playstation2: kloader_machdep.c

Log Message:
add explicit void in function declaration to fix old-style function declaration.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/sys/arch/playstation2/playstation2/kloader_machdep.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/arm

2023-11-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Nov  7 13:31:26 UTC 2023

Modified Files:
src/sys/arch/arm/arm: smccc.c

Log Message:
smccc: Adjust SMCCC_ARCH_ATTRIBUTE for clang/arm

Conditionally use

(1) __attribute__ ((target("arch=armv7ve")))
(2) __attribute__ ((target("armv7ve")))

for gcc and clang, respectively.

While gcc does not accept (2), clang accepts (1) but silently ignores it :(


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/arm/smccc.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/arm/smccc.c
diff -u src/sys/arch/arm/arm/smccc.c:1.3 src/sys/arch/arm/arm/smccc.c:1.4
--- src/sys/arch/arm/arm/smccc.c:1.3	Sun Aug  8 13:43:09 2021
+++ src/sys/arch/arm/arm/smccc.c	Tue Nov  7 13:31:26 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: smccc.c,v 1.3 2021/08/08 13:43:09 jmcneill Exp $ */
+/* $NetBSD: smccc.c,v 1.4 2023/11/07 13:31:26 rin Exp $ */
 
 /*-
  * Copyright (c) 2021 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: smccc.c,v 1.3 2021/08/08 13:43:09 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smccc.c,v 1.4 2023/11/07 13:31:26 rin Exp $");
 
 #include 
 #include 
@@ -36,7 +36,11 @@ __KERNEL_RCSID(0, "$NetBSD: smccc.c,v 1.
 #include 
 
 #if defined(__arm__)
+#  if defined(__clang__)
+#define	SMCCC_ARCH_ATTRIBUTE  __attribute__ ((target("armv7ve")))
+#  else /* gcc */
 #define	SMCCC_ARCH_ATTRIBUTE  __attribute__ ((target("arch=armv7ve")))
+#  endif
 #else
 #define	SMCCC_ARCH_ATTRIBUTE
 #endif



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

2023-11-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Nov  7 13:31:26 UTC 2023

Modified Files:
src/sys/arch/arm/arm: smccc.c

Log Message:
smccc: Adjust SMCCC_ARCH_ATTRIBUTE for clang/arm

Conditionally use

(1) __attribute__ ((target("arch=armv7ve")))
(2) __attribute__ ((target("armv7ve")))

for gcc and clang, respectively.

While gcc does not accept (2), clang accepts (1) but silently ignores it :(


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/arm/smccc.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/xen/x86

2023-11-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Nov  6 17:01:07 UTC 2023

Modified Files:
src/sys/arch/xen/x86: xen_ipi.c

Log Message:
xen_ipi: valid_ipimask: Sprinkle __diagused to fix clang !DIAGNOSTIC build


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/xen/x86/xen_ipi.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/xen/x86

2023-11-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Nov  6 17:01:07 UTC 2023

Modified Files:
src/sys/arch/xen/x86: xen_ipi.c

Log Message:
xen_ipi: valid_ipimask: Sprinkle __diagused to fix clang !DIAGNOSTIC build


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/xen/x86/xen_ipi.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/xen/x86/xen_ipi.c
diff -u src/sys/arch/xen/x86/xen_ipi.c:1.41 src/sys/arch/xen/x86/xen_ipi.c:1.42
--- src/sys/arch/xen/x86/xen_ipi.c:1.41	Sun Aug  6 16:07:53 2023
+++ src/sys/arch/xen/x86/xen_ipi.c	Mon Nov  6 17:01:07 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: xen_ipi.c,v 1.41 2023/08/06 16:07:53 riastradh Exp $ */
+/* $NetBSD: xen_ipi.c,v 1.42 2023/11/06 17:01:07 rin Exp $ */
 
 /*-
  * Copyright (c) 2011, 2019 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  * Based on: x86/ipi.c
  */
 
-__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.41 2023/08/06 16:07:53 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.42 2023/11/06 17:01:07 rin Exp $");
 
 #include "opt_ddb.h"
 
@@ -149,7 +149,7 @@ xen_ipi_init(void)
 	hypervisor_unmask_event(evtchn);
 }
 
-static inline bool /* helper */
+static inline bool __diagused
 valid_ipimask(uint32_t ipimask)
 {
 	uint32_t masks = XEN_IPI_GENERIC | XEN_IPI_HVCB | XEN_IPI_XCALL |



CVS commit: src/sys/arch/i386/stand/dosboot

2023-11-05 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Nov  6 07:09:08 UTC 2023

Modified Files:
src/sys/arch/i386/stand/dosboot: Makefile

Log Message:
x86/dosboot: Drop no-longer-available -DSLOW for libz

It should be lost during merge from upstream.

We may introduce a similar hack again, if it is *really* required;
inflate_fast() may be dropped by using slow path unconditionally.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/i386/stand/dosboot/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/arch/i386/stand/dosboot/Makefile
diff -u src/sys/arch/i386/stand/dosboot/Makefile:1.35 src/sys/arch/i386/stand/dosboot/Makefile:1.36
--- src/sys/arch/i386/stand/dosboot/Makefile:1.35	Mon Nov  6 07:02:17 2023
+++ src/sys/arch/i386/stand/dosboot/Makefile	Mon Nov  6 07:09:08 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.35 2023/11/06 07:02:17 rin Exp $
+#	$NetBSD: Makefile,v 1.36 2023/11/06 07:09:08 rin Exp $
 
 S=	${.CURDIR}/../../../..
 
@@ -10,7 +10,7 @@ RELOC=		0x100
 
 SRCS= main.c devopen.c exec.c exec_multiboot1.c exec_multiboot2.c
 
-CPPFLAGS+= -DSLOW	# for libz
+#CPPFLAGS+= -DSLOW	# for libz; no longer available
 CPPFLAGS+= -DCOMPAT_386BSD_MBRPART
 CPPFLAGS+= -DXMS
 CPPFLAGS+= -DLIBSA_ENABLE_LS_OP



CVS commit: src/sys/arch/i386/stand/dosboot

2023-11-05 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Nov  6 07:09:08 UTC 2023

Modified Files:
src/sys/arch/i386/stand/dosboot: Makefile

Log Message:
x86/dosboot: Drop no-longer-available -DSLOW for libz

It should be lost during merge from upstream.

We may introduce a similar hack again, if it is *really* required;
inflate_fast() may be dropped by using slow path unconditionally.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/i386/stand/dosboot/Makefile

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



CVS commit: src/sys/arch/i386/stand/dosboot

2023-11-05 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Nov  6 07:02:17 UTC 2023

Modified Files:
src/sys/arch/i386/stand/dosboot: Makefile

Log Message:
x86/dosboot: Do not page-align data segment

4K alignment is too heavy burden for COM executable with 64K limit :)

Fix binary size overflow for clang/amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/i386/stand/dosboot/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/arch/i386/stand/dosboot/Makefile
diff -u src/sys/arch/i386/stand/dosboot/Makefile:1.34 src/sys/arch/i386/stand/dosboot/Makefile:1.35
--- src/sys/arch/i386/stand/dosboot/Makefile:1.34	Mon Nov  6 06:53:52 2023
+++ src/sys/arch/i386/stand/dosboot/Makefile	Mon Nov  6 07:02:17 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.34 2023/11/06 06:53:52 rin Exp $
+#	$NetBSD: Makefile,v 1.35 2023/11/06 07:02:17 rin Exp $
 
 S=	${.CURDIR}/../../../..
 
@@ -34,6 +34,9 @@ I386MISCMAKEFLAGS= I386_INCLUDE_DOS=yes
 # DOS command line arguments are located at 0x.
 COPTS.doscommain.c+= -fno-delete-null-pointer-checks
 
+# Do not page-align data segment.
+LDFLAGS+= -Wl,-N
+
 VERSIONFILE= ${.CURDIR}/version
 
 .include 



CVS commit: src/sys/arch/i386/stand/dosboot

2023-11-05 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Nov  6 07:02:17 UTC 2023

Modified Files:
src/sys/arch/i386/stand/dosboot: Makefile

Log Message:
x86/dosboot: Do not page-align data segment

4K alignment is too heavy burden for COM executable with 64K limit :)

Fix binary size overflow for clang/amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/i386/stand/dosboot/Makefile

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



CVS commit: src/sys/arch/i386/stand/dosboot

2023-11-05 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Nov  6 06:53:52 UTC 2023

Modified Files:
src/sys/arch/i386/stand/dosboot: Makefile

Log Message:
x86/dosboot: Allow NULL dereference to fetch command line arguments

DOS command line arguments are provided as struct psp at 0x;
see doscommain.c.

Recent versions of gcc and clang are clever enough to optimize code
block involving NULL dereference into ud2 insn.

Sprinkle -fno-delete-null-pointer-checks to doscommain.c to
prevent this behavior.

Note that dosboot.com for netbsd-9 and later was broken due to
this ``over optimization''. gcc 5.5.0 and clang 4.0.0 in netbsd-8
generate correct codes without this workaround.

XXX
Are there still use cases for dosboot.com? Does anyone want to
boot NetBSD from real-mode DOS in 2023?


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/i386/stand/dosboot/Makefile

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



CVS commit: src/sys/arch/i386/stand/dosboot

2023-11-05 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Nov  6 06:53:52 UTC 2023

Modified Files:
src/sys/arch/i386/stand/dosboot: Makefile

Log Message:
x86/dosboot: Allow NULL dereference to fetch command line arguments

DOS command line arguments are provided as struct psp at 0x;
see doscommain.c.

Recent versions of gcc and clang are clever enough to optimize code
block involving NULL dereference into ud2 insn.

Sprinkle -fno-delete-null-pointer-checks to doscommain.c to
prevent this behavior.

Note that dosboot.com for netbsd-9 and later was broken due to
this ``over optimization''. gcc 5.5.0 and clang 4.0.0 in netbsd-8
generate correct codes without this workaround.

XXX
Are there still use cases for dosboot.com? Does anyone want to
boot NetBSD from real-mode DOS in 2023?


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/i386/stand/dosboot/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/arch/i386/stand/dosboot/Makefile
diff -u src/sys/arch/i386/stand/dosboot/Makefile:1.33 src/sys/arch/i386/stand/dosboot/Makefile:1.34
--- src/sys/arch/i386/stand/dosboot/Makefile:1.33	Mon Sep 23 13:42:36 2019
+++ src/sys/arch/i386/stand/dosboot/Makefile	Mon Nov  6 06:53:52 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.33 2019/09/23 13:42:36 christos Exp $
+#	$NetBSD: Makefile,v 1.34 2023/11/06 06:53:52 rin Exp $
 
 S=	${.CURDIR}/../../../..
 
@@ -31,6 +31,9 @@ SAMISCCPPFLAGS+= -DHEAP_START=0x2 -D
 SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_INCLUDE_NET=no SA_ENABLE_LS_OP=yes
 I386MISCMAKEFLAGS= I386_INCLUDE_DOS=yes
 
+# DOS command line arguments are located at 0x.
+COPTS.doscommain.c+= -fno-delete-null-pointer-checks
+
 VERSIONFILE= ${.CURDIR}/version
 
 .include 



CVS commit: src/sys/arch/playstation2/playstation2

2023-11-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Nov  5 22:05:07 UTC 2023

Modified Files:
src/sys/arch/playstation2/playstation2: interrupt.c

Log Message:
Return missing debug message text and remove obsolete sched_whichqs param.

Allows INTR_DEBUG code to compile.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/playstation2/playstation2/interrupt.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/playstation2/playstation2/interrupt.c
diff -u src/sys/arch/playstation2/playstation2/interrupt.c:1.18 src/sys/arch/playstation2/playstation2/interrupt.c:1.19
--- src/sys/arch/playstation2/playstation2/interrupt.c:1.18	Wed Oct  6 20:36:58 2021
+++ src/sys/arch/playstation2/playstation2/interrupt.c	Sun Nov  5 22:05:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: interrupt.c,v 1.18 2021/10/06 20:36:58 andvar Exp $	*/
+/*	$NetBSD: interrupt.c,v 1.19 2023/11/05 22:05:07 andvar Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.18 2021/10/06 20:36:58 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.19 2023/11/05 22:05:07 andvar Exp $");
 
 #include "debug_playstation2.h"
 #if defined INTR_DEBUG && !defined GSFB_DEBUG_MONITOR
@@ -271,7 +271,7 @@ _debug_print_intr(const char *ident)
 
 	__gsfb_print(0,
 	"CLOCK %-5lld SBUS %-5lld DMAC %-5lld "
-
+	"SR=%08x PC=%08x cpl=%08x intc=%08x dmac=%08x\n",
 	_playstation2_evcnt.clock.ev_count,
 	_playstation2_evcnt.sbus.ev_count,
 	_playstation2_evcnt.dmac.ev_count,
@@ -279,7 +279,7 @@ _debug_print_intr(const char *ident)
 	md_imask,
 	(_reg_read_4(I_MASK_REG) << 16) |
 	(_reg_read_4(I_STAT_REG) & 0x),
-	_reg_read_4(D_STAT_REG), sched_whichqs);
+	_reg_read_4(D_STAT_REG));
 }
 #endif /* INTR_DEBUG */
 



<    6   7   8   9   10   11   12   13   14   15   >