CVS commit: src/sys/arch/atari/atari

2024-01-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan 15 03:14:31 UTC 2024

Modified Files:
src/sys/arch/atari/atari: atari_init.c

Log Message:
Guard references to protorp with M68030.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/atari/atari/atari_init.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/atari

2024-01-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan 15 03:14:31 UTC 2024

Modified Files:
src/sys/arch/atari/atari: atari_init.c

Log Message:
Guard references to protorp with M68030.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/atari/atari/atari_init.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/atari/atari/atari_init.c
diff -u src/sys/arch/atari/atari/atari_init.c:1.110 src/sys/arch/atari/atari/atari_init.c:1.111
--- src/sys/arch/atari/atari/atari_init.c:1.110	Tue Jan  9 07:28:25 2024
+++ src/sys/arch/atari/atari/atari_init.c	Mon Jan 15 03:14:31 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: atari_init.c,v 1.110 2024/01/09 07:28:25 thorpej Exp $	*/
+/*	$NetBSD: atari_init.c,v 1.111 2024/01/15 03:14:31 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.110 2024/01/09 07:28:25 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.111 2024/01/15 03:14:31 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mbtype.h"
@@ -211,7 +211,7 @@ start_c(int id, u_int ttphystart, u_int 
 	psize_t		ptsize;
 	u_int		ptextra;
 	vaddr_t		kva;
-	u_int		tc, i;
+	u_int		i;
 	pt_entry_t	*pg, *epg;
 	pt_entry_t	pg_proto;
 	vaddr_t		end_loaded;
@@ -601,7 +601,6 @@ start_c(int id, u_int ttphystart, u_int 
 	 * Prepare to enable the MMU.
 	 * Setup and load SRP (see pmap.h)
 	 */
-	protorp[1] = Sysseg_pa;			/* + segtable address */
 
 	cpu_init_kcorehdr(kbase, Sysseg_pa);
 
@@ -642,15 +641,18 @@ start_c(int id, u_int ttphystart, u_int 
 	} else
 #endif
 	{
+#if defined(M68030)
+		protorp[1] = Sysseg_pa;		/* + segtable address */
 		__asm volatile ("pmove %0@,%%srp" : : "a" (&protorp[0]));
 		/*
 		 * setup and load TC register.
 		 * enable_cpr, enable_srp, pagesize=8k,
 		 * A = 8 bits, B = 11 bits
 		 */
-		tc = MMU51_TCR_BITS;
+		u_int tc = MMU51_TCR_BITS;
 		__asm volatile ("pflusha" : : );
 		__asm volatile ("pmove %0@,%%tc" : : "a" (&tc));
+#endif /* M68030 */
 	}
 
 	/*



CVS commit: src/sys/arch/atari/atari

2023-01-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Jan 24 07:57:20 UTC 2023

Modified Files:
src/sys/arch/atari/atari: stalloc.c

Log Message:
whitespace, no code change.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/atari/atari/stalloc.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/atari/atari/stalloc.c
diff -u src/sys/arch/atari/atari/stalloc.c:1.19 src/sys/arch/atari/atari/stalloc.c:1.20
--- src/sys/arch/atari/atari/stalloc.c:1.19	Fri Jan  6 10:28:27 2023
+++ src/sys/arch/atari/atari/stalloc.c	Tue Jan 24 07:57:20 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: stalloc.c,v 1.19 2023/01/06 10:28:27 tsutsui Exp $	*/
+/*	$NetBSD: stalloc.c,v 1.20 2023/01/24 07:57:20 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman (Atari modifications)
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: stalloc.c,v 1.19 2023/01/06 10:28:27 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: stalloc.c,v 1.20 2023/01/24 07:57:20 mlelstv Exp $");
 
 #include 
 #include 
@@ -219,7 +219,7 @@ free_stmem(void *mem)
 			} else {
 TAILQ_INSERT_HEAD(&free_list,mn,free_link);
 			}
-mn->type = MNODE_FREE;
+			mn->type = MNODE_FREE;
 		}
 		stmem_total += mn->size;/* add our helpings to the pool. */
 	}



CVS commit: src/sys/arch/atari/atari

2023-01-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Jan 24 07:57:20 UTC 2023

Modified Files:
src/sys/arch/atari/atari: stalloc.c

Log Message:
whitespace, no code change.


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

2022-07-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jul  3 16:48:03 UTC 2022

Modified Files:
src/sys/arch/atari/atari: bus.c

Log Message:
Use __func__ to print function names.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/atari/atari/bus.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/atari/atari/bus.c
diff -u src/sys/arch/atari/atari/bus.c:1.65 src/sys/arch/atari/atari/bus.c:1.66
--- src/sys/arch/atari/atari/bus.c:1.65	Sun Jul  3 16:40:29 2022
+++ src/sys/arch/atari/atari/bus.c	Sun Jul  3 16:48:03 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.c,v 1.65 2022/07/03 16:40:29 tsutsui Exp $	*/
+/*	$NetBSD: bus.c,v 1.66 2022/07/03 16:48:03 tsutsui 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.65 2022/07/03 16:40:29 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.66 2022/07/03 16:48:03 tsutsui Exp $");
 
 #include 
 #include 
@@ -203,9 +203,9 @@ bus_space_map(bus_space_tag_t t, bus_add
 	if (error != 0) {
 		if (extent_free(iomem_ex, bpa + t->base, size,
 		EX_NOWAIT | iomem_malloc_safe)) {
-			printf("bus_space_map: pa 0x%lx, size 0x%lx\n",
-			bpa, size);
-			printf("bus_space_map: can't free region\n");
+			printf("%s: pa 0x%lx, size 0x%lx\n",
+			__func__, bpa, size);
+			printf("%s: can't free region\n", __func__);
 		}
 	}
 	return error;
@@ -227,7 +227,7 @@ bus_space_alloc(bus_space_tag_t t, bus_a
 	 */
 	if ((rstart + t->base) < iomem_ex->ex_start ||
 	(rend + t->base) > iomem_ex->ex_end)
-		panic("bus_space_alloc: bad region start/end");
+		panic("%s: bad region start/end", __func__);
 #endif /* DIAGNOSTIC */
 
 	/*
@@ -247,9 +247,9 @@ bus_space_alloc(bus_space_tag_t t, bus_a
 	if (error != 0) {
 		if (extent_free(iomem_ex, bpa, size,
 		EX_NOWAIT | iomem_malloc_safe) != 0) {
-			printf("bus_space_alloc: pa 0x%lx, size 0x%lx\n",
-			bpa, size);
-			printf("bus_space_alloc: can't free region\n");
+			printf("%s: pa 0x%lx, size 0x%lx\n",
+			__func__, bpa, size);
+			printf("%s: can't free region\n", __func__);
 		}
 	}
 
@@ -270,7 +270,7 @@ bus_mem_add_mapping(bus_space_tag_t t, b
 
 #ifdef DIAGNOSTIC
 	if (endpa <= pa)
-		panic("bus_mem_add_mapping: overflow");
+		panic("%s: overflow", __func__);
 #endif
 
 	if (kernel_map == NULL) {
@@ -323,7 +323,7 @@ bus_space_unmap(bus_space_tag_t t, bus_s
 	endva = m68k_round_page(((char *)bsh + size) - 1);
 #ifdef DIAGNOSTIC
 	if (endva < va)
-		panic("unmap_iospace: overflow");
+		panic("%s: overflow", __func__);
 #endif
 
 	(void)pmap_extract(pmap_kernel(), va, &bpa);
@@ -343,8 +343,8 @@ bus_space_unmap(bus_space_tag_t t, bus_s
 	 */
 	if (extent_free(iomem_ex, bpa, size, EX_NOWAIT | iomem_malloc_safe)
 	!= 0) {
-		printf("bus_space_unmap: pa 0x%lx, size 0x%lx\n", bpa, size);
-		printf("bus_space_unmap: can't free region\n");
+		printf("%s: pa 0x%lx, size 0x%lx\n", __func__, bpa, size);
+		printf("%s: can't free region\n", __func__);
 	}
 }
 
@@ -494,7 +494,7 @@ _bus_dmamap_load_mbuf(bus_dma_tag_t t, b
 
 #ifdef DIAGNOSTIC
 	if ((m0->m_flags & M_PKTHDR) == 0)
-		panic("_bus_dmamap_load_mbuf: no packet header");
+		panic("%s: no packet header", __func__);
 #endif
 
 	if (m0->m_pkthdr.len > map->_dm_size)
@@ -573,7 +573,7 @@ _bus_dmamap_load_raw(bus_dma_tag_t t, bu
 bus_dma_segment_t *segs, int nsegs, bus_size_t size, int flags)
 {
 
-	panic("bus_dmamap_load_raw: not implemented");
+	panic("%s: not implemented", __func__);
 }
 
 /*
@@ -871,7 +871,7 @@ bus_dmamem_map(bus_dma_tag_t t, bus_dma_
 		addr < (segs[curseg].ds_addr + segs[curseg].ds_len);
 		addr += PAGE_SIZE, va += PAGE_SIZE, size -= PAGE_SIZE) {
 			if (size == 0)
-panic("_bus_dmamem_map: size botch");
+panic("%s: size botch", __func__);
 			pmap_enter(pmap_kernel(), va, addr - offset,
 			VM_PROT_READ | VM_PROT_WRITE,
 			VM_PROT_READ | VM_PROT_WRITE);
@@ -892,7 +892,7 @@ bus_dmamem_unmap(bus_dma_tag_t t, void *
 
 #ifdef DIAGNOSTIC
 	if ((vaddr_t)kva & PGOFSET)
-		panic("_bus_dmamem_unmap");
+		panic("%s", __func__);
 #endif
 
 	size = round_page(size);
@@ -917,12 +917,12 @@ bus_dmamem_mmap(bus_dma_tag_t t, bus_dma
 	for (i = 0; i < nsegs; i++) {
 #ifdef DIAGNOSTIC
 		if ((off & PGOFSET) != 0)
-			panic("_bus_dmamem_mmap: offset unaligned");
+			panic("%s: offset unaligned", __func__);
 		if ((segs[i].ds_addr & PGOFSET) != 0)
-			panic("_bus_dmamem_mmap: segment unaligned");
+			panic("%s: segment unaligned", __func__);
 		if ((segs[i].ds_len & PGOFSET) != 0)
-			panic("_bus_dmamem_mmap: segment size not multiple"
-			" of page size");
+			panic("%s: segment size not multiple of page size",
+			__func__);
 #endif
 		if (off >= segs[i].ds_len) {
 			off -= segs[i].ds_len;
@@ -1071,7 +1071,7 @@ bus_dmamem_alloc_range(bus_dma_tag_t t, 
 		if (curaddr < low || curaddr >

CVS commit: src/sys/arch/atari/atari

2022-07-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jul  3 16:48:03 UTC 2022

Modified Files:
src/sys/arch/atari/atari: bus.c

Log Message:
Use __func__ to print function names.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/atari/atari/bus.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/atari

2022-07-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jul  3 16:40:29 UTC 2022

Modified Files:
src/sys/arch/atari/atari: bus.c

Log Message:
Use proper TAILQ(3) macro as other bus_dma(9) implementation.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/atari/atari/bus.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/atari

2022-07-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jul  3 16:40:29 UTC 2022

Modified Files:
src/sys/arch/atari/atari: bus.c

Log Message:
Use proper TAILQ(3) macro as other bus_dma(9) implementation.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/atari/atari/bus.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/atari/atari/bus.c
diff -u src/sys/arch/atari/atari/bus.c:1.64 src/sys/arch/atari/atari/bus.c:1.65
--- src/sys/arch/atari/atari/bus.c:1.64	Sun Jul  3 16:33:31 2022
+++ src/sys/arch/atari/atari/bus.c	Sun Jul  3 16:40:29 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.c,v 1.64 2022/07/03 16:33:31 tsutsui Exp $	*/
+/*	$NetBSD: bus.c,v 1.65 2022/07/03 16:40:29 tsutsui 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.64 2022/07/03 16:33:31 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.65 2022/07/03 16:40:29 tsutsui Exp $");
 
 #include 
 #include 
@@ -1058,14 +1058,14 @@ bus_dmamem_alloc_range(bus_dma_tag_t t, 
 	 * Compute the location, size, and number of segments actually
 	 * returned by the VM code.
 	 */
-	m = mlist.tqh_first;
+	m = TAILQ_FIRST(&mlist);
 	curseg = 0;
 	lastaddr = VM_PAGE_TO_PHYS(m);
 	segs[curseg].ds_addr = lastaddr + offset;
 	segs[curseg].ds_len = PAGE_SIZE;
-	m = m->pageq.queue.tqe_next;
+	m = TAILQ_NEXT(m, pageq.queue);
 
-	for (; m != NULL; m = m->pageq.queue.tqe_next) {
+	for (; m != NULL; m = TAILQ_NEXT(m, pageq.queue)) {
 		curaddr = VM_PAGE_TO_PHYS(m);
 #ifdef DIAGNOSTIC
 		if (curaddr < low || curaddr >= high) {



CVS commit: src/sys/arch/atari/atari

2022-07-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jul  3 16:33:31 UTC 2022

Modified Files:
src/sys/arch/atari/atari: bus.c

Log Message:
Misc KNF.  No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/atari/atari/bus.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/atari

2022-07-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jul  3 16:33:31 UTC 2022

Modified Files:
src/sys/arch/atari/atari: bus.c

Log Message:
Misc KNF.  No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/atari/atari/bus.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/atari/atari/bus.c
diff -u src/sys/arch/atari/atari/bus.c:1.63 src/sys/arch/atari/atari/bus.c:1.64
--- src/sys/arch/atari/atari/bus.c:1.63	Sun Jul  3 16:03:08 2022
+++ src/sys/arch/atari/atari/bus.c	Sun Jul  3 16:33:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.c,v 1.63 2022/07/03 16:03:08 tsutsui Exp $	*/
+/*	$NetBSD: bus.c,v 1.64 2022/07/03 16:33:31 tsutsui 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.63 2022/07/03 16:03:08 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.64 2022/07/03 16:33:31 tsutsui Exp $");
 
 #include 
 #include 
@@ -61,10 +61,6 @@ static long iomem_ex_storage[EXTENT_FIXE
 static struct extent *iomem_ex;
 static int iomem_malloc_safe = 0;
 
-int  bus_dmamem_alloc_range(bus_dma_tag_t tag, bus_size_t size,
-		bus_size_t alignment, bus_size_t boundary,
-		bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags,
-		paddr_t low, paddr_t high);
 static int  _bus_dmamap_load_buffer(bus_dma_tag_t tag, bus_dmamap_t,
 		void *, bus_size_t, struct vmspace *, int, paddr_t *,
 		int *, int);
@@ -94,6 +90,7 @@ static int	bootm_free(vaddr_t va, u_long
 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);
@@ -107,7 +104,7 @@ bootm_alloc(paddr_t pa, u_long size, int
 	pt_entry_t	pg_proto;
 	vaddr_t		va, rva;
 
-	if (extent_alloc(bootm_ex, size, PAGE_SIZE, 0, EX_NOWAIT, &rva)) {
+	if (extent_alloc(bootm_ex, size, PAGE_SIZE, 0, EX_NOWAIT, &rva) != 0) {
 		printf("bootm_alloc fails! Not enough fixed extents?\n");
 		printf("Requested extent: pa=%lx, size=%lx\n",
 		(u_long)pa, size);
@@ -118,7 +115,7 @@ bootm_alloc(paddr_t pa, u_long size, int
 	epg = &pg[btoc(size)];
 	va  = rva;
 	pg_proto = pa | PG_RW | PG_V;
-	if (!(flags & BUS_SPACE_MAP_CACHEABLE))
+	if ((flags & BUS_SPACE_MAP_CACHEABLE) == 0)
 		pg_proto |= PG_CI;
 	while (pg < epg) {
 		*pg++ = pg_proto;
@@ -199,11 +196,11 @@ bus_space_map(bus_space_tag_t t, bus_add
 	error = extent_alloc_region(iomem_ex, bpa + t->base, size,
 			EX_NOWAIT | iomem_malloc_safe);
 
-	if (error)
+	if (error != 0)
 		return error;
 
 	error = bus_mem_add_mapping(t, bpa, size, flags, mhp);
-	if (error) {
+	if (error != 0) {
 		if (extent_free(iomem_ex, bpa + t->base, size,
 		EX_NOWAIT | iomem_malloc_safe)) {
 			printf("bus_space_map: pa 0x%lx, size 0x%lx\n",
@@ -240,16 +237,16 @@ bus_space_alloc(bus_space_tag_t t, bus_a
 	rend + t->base, size, alignment, boundary,
 	EX_FAST | EX_NOWAIT | iomem_malloc_safe, &bpa);
 
-	if (error)
+	if (error != 0)
 		return error;
 
 	/*
 	 * Map the bus physical address to a kernel virtual address.
 	 */
 	error = bus_mem_add_mapping(t, bpa, size, flags, bshp);
-	if (error) {
+	if (error != 0) {
 		if (extent_free(iomem_ex, bpa, size,
-		EX_NOWAIT | iomem_malloc_safe)) {
+		EX_NOWAIT | iomem_malloc_safe) != 0) {
 			printf("bus_space_alloc: pa 0x%lx, size 0x%lx\n",
 			bpa, size);
 			printf("bus_space_alloc: can't free region\n");
@@ -296,7 +293,7 @@ bus_mem_add_mapping(bus_space_tag_t t, b
 	*bshp = va + (bpa & PGOFSET);
 
 	for (; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
-		u_int	*ptep, npte;
+		pt_entry_t *ptep, npte;
 
 		pmap_enter(pmap_kernel(), (vaddr_t)va, pa,
 		VM_PROT_READ|VM_PROT_WRITE, VM_PROT_READ|VM_PROT_WRITE);
@@ -330,7 +327,7 @@ bus_space_unmap(bus_space_tag_t t, bus_s
 #endif
 
 	(void)pmap_extract(pmap_kernel(), va, &bpa);
-	bpa += ((u_long)bsh & PGOFSET);
+	bpa += ((paddr_t)bsh & PGOFSET);
 
 	/*
 	 * Free the kernel virtual mapping.
@@ -344,7 +341,8 @@ bus_space_unmap(bus_space_tag_t t, bus_s
 	/*
 	 * Mark as free in the extent map.
 	 */
-	if (extent_free(iomem_ex, bpa, size, EX_NOWAIT | iomem_malloc_safe)) {
+	if (extent_free(iomem_ex, bpa, size, EX_NOWAIT | iomem_malloc_safe)
+	!= 0) {
 		printf("bus_space_unmap: pa 0x%lx, size 0x%lx\n", bpa, size);
 		printf("bus_space_unmap: can't free region\n");
 	}
@@ -380,6 +378,7 @@ bus_space_mmap(bus_space_tag_t t, bus_ad
 static size_t
 _bus_dmamap_mapsize(int const nsegments)
 {
+
 	KASSERT(nsegments > 0); 
 	return sizeof(struct atari_bus_dmamap) +
 	(sizeof(bus_dma_segment_t) * (nsegments - 1));
@@ -409,7 +408,7 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 	 * the (nsegments - 1).
 	 */
 	if ((mapstore = kmem_zalloc(_bus_dmamap_mapsize(nsegments),
-	(flags & BUS_DMA_NOWAIT) ? KM_NOSLEEP : KM_SLEEP)) == NULL)
+	   

CVS commit: src/sys/arch/atari/atari

2022-07-02 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jul  2 13:47:53 UTC 2022

Modified Files:
src/sys/arch/atari/atari: autoconf.c

Log Message:
Use aprint_normal(9) for attach messages.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/atari/atari/autoconf.c

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

Modified files:

Index: src/sys/arch/atari/atari/autoconf.c
diff -u src/sys/arch/atari/atari/autoconf.c:1.72 src/sys/arch/atari/atari/autoconf.c:1.73
--- src/sys/arch/atari/atari/autoconf.c:1.72	Mon Mar 28 12:38:57 2022
+++ src/sys/arch/atari/atari/autoconf.c	Sat Jul  2 13:47:53 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.72 2022/03/28 12:38:57 riastradh Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.73 2022/07/02 13:47:53 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.72 2022/03/28 12:38:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.73 2022/07/02 13:47:53 tsutsui Exp $");
 
 #include "opt_md.h"
 
@@ -319,7 +319,7 @@ mbattach(device_t parent, device_t self,
 
 	mb_attached = 1;
 
-	printf ("\n");
+	aprint_normal("\n");
 	config_found(self, __UNCONST("clock")   , simple_devprint, CFARGS_NONE);
 	config_found(self, __UNCONST("grfbus")  , simple_devprint, CFARGS_NONE);
 	config_found(self, __UNCONST("kbd") , simple_devprint, CFARGS_NONE);



CVS commit: src/sys/arch/atari/atari

2022-07-02 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jul  2 13:47:53 UTC 2022

Modified Files:
src/sys/arch/atari/atari: autoconf.c

Log Message:
Use aprint_normal(9) for attach messages.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/atari/atari/autoconf.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/atari

2022-07-02 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jul  2 08:43:28 UTC 2022

Modified Files:
src/sys/arch/atari/atari: stalloc.c

Log Message:
Misc KNF. No binary change.


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

2022-07-02 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jul  2 08:43:28 UTC 2022

Modified Files:
src/sys/arch/atari/atari: stalloc.c

Log Message:
Misc KNF. No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/atari/atari/stalloc.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/atari/atari/stalloc.c
diff -u src/sys/arch/atari/atari/stalloc.c:1.17 src/sys/arch/atari/atari/stalloc.c:1.18
--- src/sys/arch/atari/atari/stalloc.c:1.17	Tue May 31 15:24:59 2022
+++ src/sys/arch/atari/atari/stalloc.c	Sat Jul  2 08:43:28 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: stalloc.c,v 1.17 2022/05/31 15:24:59 tsutsui Exp $	*/
+/*	$NetBSD: stalloc.c,v 1.18 2022/07/02 08:43:28 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman (Atari modifications)
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: stalloc.c,v 1.17 2022/05/31 15:24:59 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: stalloc.c,v 1.18 2022/07/02 08:43:28 tsutsui Exp $");
 
 #include 
 #include 
@@ -60,9 +60,10 @@ u_long   stmem_total;		/* total free.		*
 void
 init_stmem(void)
 {
-	int s = splhigh ();
+	int s;
 	struct mem_node *mem;
 
+	s = splhigh();
 	stmem_total = st_pool_size - sizeof(*mem);
 
 	mem = (struct mem_node *)st_pool_virt;
@@ -80,14 +81,14 @@ void *
 alloc_stmem(u_long size, void **phys_addr)
 {
 	struct mem_node *mn, *new, *bfit;
-	int		s;
+	int s;
 
 	if (size == 0)
 		return NULL;
 
 	s = splhigh();
 
-	if (size & ~(ST_BLOCKMASK)) 
+	if ((size & ~(ST_BLOCKMASK)) != 0) 
 		size = (size & ST_BLOCKMASK) + ST_BLOCKSIZE;
 
 	/*
@@ -111,7 +112,7 @@ alloc_stmem(u_long size, void **phys_add
 		return NULL;
 	}
 
-	if ((mn->size - size) <= sizeof (*mn)) {
+	if ((mn->size - size) <= sizeof(*mn)) {
 		/*
 		 * our allocation would not leave room 
 		 * for a new node in between.
@@ -122,14 +123,14 @@ alloc_stmem(u_long size, void **phys_add
 		stmem_total -= mn->size;
 		splx(s);
 		*phys_addr = (void*)PHYS_ADDR(&mn[1]);
-		return ((void *)&mn[1]);
+		return (void *)&mn[1];
 	}
 
 	/*
 	 * split the node's memory.
 	 */
 	new = mn;
-	new->size -= size + sizeof(struct mem_node);
+	new->size -= size + sizeof(*mn);
 	mn = (struct mem_node *)(MNODES_MEM(new) + new->size);
 	mn->size = size;
 
@@ -140,10 +141,10 @@ alloc_stmem(u_long size, void **phys_add
 	TAILQ_INSERT_AFTER(&st_list, new, mn, link);
 	mn->type = MNODE_USED;
 
-	stmem_total -= size + sizeof(struct mem_node);
+	stmem_total -= size + sizeof(*mn);
 	splx(s);
 	*phys_addr = (void*)PHYS_ADDR(&mn[1]);
-	return ((void *)&mn[1]);
+	return (void *)&mn[1];
 }
 
 void
@@ -171,23 +172,23 @@ free_stmem(void *mem)
 		mn->type = MNODE_FREE;
 		TAILQ_REMOVE(&st_list, next, link);
 		TAILQ_REMOVE(&free_list, next, free_link);
-		stmem_total += mn->size + sizeof(struct mem_node);
-		mn->size += next->size + sizeof(struct mem_node);
+		stmem_total += mn->size + sizeof(*mn);
+		mn->size += next->size + sizeof(*mn);
 	}
 	if (prev != NULL && prev->type == MNODE_FREE) {
 		/*
 		 * if prev is: a valid node and a free node. ==> merge
 		 */
 		if (mn->type != MNODE_FREE)
-			stmem_total += mn->size + sizeof(struct mem_node);
+			stmem_total += mn->size + sizeof(*mn);
 		else {
 			/* already on free list */
 			TAILQ_REMOVE(&free_list, mn, free_link);
 			mn->type = MNODE_USED;
-			stmem_total += sizeof(struct mem_node);
+			stmem_total += sizeof(*mn);
 		}
 		TAILQ_REMOVE(&st_list, mn, link);
-		prev->size += mn->size + sizeof(struct mem_node);
+		prev->size += mn->size + sizeof(*mn);
 	} else if (mn->type != MNODE_FREE) {
 		/*
 		 * we still are not on free list and we need to be.



CVS commit: src/sys/arch/atari/atari

2022-07-02 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jul  2 08:35:50 UTC 2022

Modified Files:
src/sys/arch/atari/atari: fpu_machdep.c machdep.c

Log Message:
Use and print consistent CPU/MMU/FPU names.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/atari/atari/fpu_machdep.c
cvs rdiff -u -r1.186 -r1.187 src/sys/arch/atari/atari/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/atari/atari/fpu_machdep.c
diff -u src/sys/arch/atari/atari/fpu_machdep.c:1.1 src/sys/arch/atari/atari/fpu_machdep.c:1.2
--- src/sys/arch/atari/atari/fpu_machdep.c:1.1	Tue Nov 15 12:23:21 2011
+++ src/sys/arch/atari/atari/fpu_machdep.c	Sat Jul  2 08:35:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_machdep.c,v 1.1 2011/11/15 12:23:21 tsutsui Exp $	*/
+/*	$NetBSD: fpu_machdep.c,v 1.2 2022/07/02 08:35:49 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_machdep.c,v 1.1 2011/11/15 12:23:21 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_machdep.c,v 1.2 2022/07/02 08:35:49 tsutsui Exp $");
 
 #include "opt_fpu_emulate.h"
 
@@ -57,8 +57,8 @@ static const char *fpu_descr[] = {
 #else
 	[FPU_NONE] = " no ",
 #endif
-	[FPU_68881] = " mc68881 ",
-	[FPU_68882] = " mc68882 ",
+	[FPU_68881] = " MC68881 ",
+	[FPU_68882] = " MC68882 ",
 	[FPU_68040] = "/",
 	[FPU_68060] = "/",
 	[FPU_UNKNOWN] = "??? "

Index: src/sys/arch/atari/atari/machdep.c
diff -u src/sys/arch/atari/atari/machdep.c:1.186 src/sys/arch/atari/atari/machdep.c:1.187
--- src/sys/arch/atari/atari/machdep.c:1.186	Sun Mar 13 17:50:55 2022
+++ src/sys/arch/atari/atari/machdep.c	Sat Jul  2 08:35:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.186 2022/03/13 17:50:55 andvar Exp $	*/
+/*	$NetBSD: machdep.c,v 1.187 2022/07/02 08:35:49 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.186 2022/03/13 17:50:55 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.187 2022/07/02 08:35:49 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -256,22 +256,22 @@ identifycpu(void)
 	case CPU_68060:
 		__asm(".word 0x4e7a,0x0808;"
 		"movl %%d0,%0" : "=d"(pcr) : : "d0");
-		snprintf(cputxt, sizeof(cputxt), "68%s060 rev.%d",
+		snprintf(cputxt, sizeof(cputxt), "MC68%s060 rev.%d",
 		pcr & 0x1 ? "LC/EC" : "", (pcr >> 8) & 0xff);
 		cpu = cputxt;
 		mmu = "/MMU";
 		break;
 	case CPU_68040:
-		cpu = "m68040";
+		cpu = "MC68040";
 		mmu = "/MMU";
 		break;
 	case CPU_68030:
-		cpu = "m68030";
+		cpu = "MC68030";
 		mmu = "/MMU";
 		break;
 	default: /* XXX */
-		cpu = "m68020";
-		mmu = " m68851 MMU";
+		cpu = "MC68020";
+		mmu = " MC68851 MMU";
 	}
 	cpu_setmodel("%s (%s CPU%s%sFPU)", mach, cpu, mmu, fpu);
 	printf("%s\n", cpu_getmodel());



CVS commit: src/sys/arch/atari/atari

2022-07-02 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jul  2 08:35:50 UTC 2022

Modified Files:
src/sys/arch/atari/atari: fpu_machdep.c machdep.c

Log Message:
Use and print consistent CPU/MMU/FPU names.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/atari/atari/fpu_machdep.c
cvs rdiff -u -r1.186 -r1.187 src/sys/arch/atari/atari/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/atari/atari

2022-07-02 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jul  2 08:25:21 UTC 2022

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

Log Message:
Misc cleanup.

- make local variables static
- use __func__ to print function names
- KNF


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/atari/atari/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/atari/atari/intr.c
diff -u src/sys/arch/atari/atari/intr.c:1.29 src/sys/arch/atari/atari/intr.c:1.30
--- src/sys/arch/atari/atari/intr.c:1.29	Sat Jul  2 08:11:47 2022
+++ src/sys/arch/atari/atari/intr.c	Sat Jul  2 08:25:21 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.29 2022/07/02 08:11:47 tsutsui Exp $	*/
+/*	$NetBSD: intr.c,v 1.30 2022/07/02 08:25:21 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.29 2022/07/02 08:11:47 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.30 2022/07/02 08:25:21 tsutsui Exp $");
 
 #include 
 #include 
@@ -51,8 +51,8 @@ __KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.2
 #define	UVEC_LOC	64
 
 typedef LIST_HEAD(, intrhand) ih_list_t;
-ih_list_t autovec_list[AVEC_MAX - AVEC_MIN + 1];
-ih_list_t uservec_list[UVEC_MAX - UVEC_MIN + 1];
+static ih_list_t autovec_list[AVEC_MAX - AVEC_MIN + 1];
+static ih_list_t uservec_list[UVEC_MAX - UVEC_MIN + 1];
 int idepth;
 volatile int ssir;
 
@@ -129,9 +129,9 @@ intr_establish(int vector, int type, int
 			kmem_free(ih, sizeof(*ih));
 			return NULL;
 		}
-		vec_list = &autovec_list[vector-1];
-		hard_vec = &autovects[vector-1];
-		ih->ih_intrcnt = &intrcnt_auto[vector-1];
+		vec_list = &autovec_list[vector - 1];
+		hard_vec = &autovects[vector - 1];
+		ih->ih_intrcnt = &intrcnt_auto[vector - 1];
 		break;
 	case USER_VEC:
 		if (vector < UVEC_MIN || vector > UVEC_MAX) {
@@ -156,7 +156,7 @@ intr_establish(int vector, int type, int
 
 		s = splhigh();
 		LIST_INSERT_HEAD(vec_list, ih, ih_link);
-		if (type & FAST_VEC)
+		if ((type & FAST_VEC) != 0)
 			*hard_vec = (u_long)ih->ih_fun;
 		else if (*hard_vec != (u_long)intr_glue) {
 			/*
@@ -181,7 +181,7 @@ intr_establish(int vector, int type, int
 	cur_vec = LIST_FIRST(vec_list);
 	if (cur_vec->ih_type & FAST_VEC) {
 		kmem_free(ih, sizeof(*ih));
-		printf("intr_establish: vector cannot be shared\n");
+		printf("%s: vector cannot be shared\n", __func__);
 		return NULL;
 	}
 
@@ -226,8 +226,8 @@ intr_disestablish(struct intrhand *ih)
 	case AUTO_VEC:
 		if (vector < AVEC_MIN || vector > AVEC_MAX)
 			return 0;
-		vec_list = &autovec_list[vector-1];
-		hard_vec = &autovects[vector-1];
+		vec_list = &autovec_list[vector - 1];
+		hard_vec = &autovects[vector - 1];
 		break;
 	case USER_VEC:
 		if (vector < UVEC_MIN || vector > UVEC_MAX)
@@ -236,7 +236,7 @@ intr_disestablish(struct intrhand *ih)
 		hard_vec = &uservects[vector];
 		break;
 	default:
-		printf("intr_disestablish: bogus vector type\n");
+		printf("%s: bogus vector type\n", __func__);
 		return 0;
 	}
 
@@ -250,13 +250,13 @@ intr_disestablish(struct intrhand *ih)
 			break;
 	}
 	if (ih != cur_vec) {
-		printf("intr_disestablish: 'ih' has inconsistent data\n");
+		printf("%s: 'ih' has inconsistent data\n", __func__);
 		return 0;
 	}
 
 	s = splhigh();
 	LIST_REMOVE(ih, ih_link);
-	if (LIST_EMPTY(vec_list) && (ih->ih_type & FAST_VEC))
+	if (LIST_EMPTY(vec_list) && (ih->ih_type & FAST_VEC) != 0)
 		*hard_vec = (u_long)intr_glue;
 	splx(s);
 
@@ -279,17 +279,17 @@ intr_dispatch(struct clockframe frame)
 
 	curcpu()->ci_data.cpu_nintr++;
 	vector = (frame.cf_vo & 0xfff) >> 2;
-	if (vector < (AVEC_LOC+AVEC_MAX) && vector >= AVEC_LOC)
+	if (vector < (AVEC_LOC + AVEC_MAX) && vector >= AVEC_LOC)
 		vec_list = &autovec_list[vector - AVEC_LOC];
-	else if (vector <= (UVEC_LOC+UVEC_MAX) && vector >= UVEC_LOC)
+	else if (vector <= (UVEC_LOC + UVEC_MAX) && vector >= UVEC_LOC)
 		vec_list = &uservec_list[vector - UVEC_LOC];
 	else
-		panic("intr_dispatch: Bogus vector %d", vector);
+		panic("%s: Bogus vector %d", __func__, vector);
 
 	if ((ih = LIST_FIRST(vec_list)) == NULL) {
-		printf("intr_dispatch: vector %d unexpected\n", vector);
+		printf("%s: vector %d unexpected\n", __func__, vector);
 		if (++unexpected > 10)
-			panic("intr_dispatch: too many unexpected interrupts");
+			panic("%s: too many unexpected interrupts", __func__);
 		return;
 	}
 	ih->ih_intrcnt[0]++;
@@ -302,9 +302,9 @@ intr_dispatch(struct clockframe frame)
 	if (handled)
 		straycount = 0;
 	else if (++straycount > 50)
-		panic("intr_dispatch: too many stray interrupts");
+		panic("%s: too many stray interrupts", __func__);
 	else
-		printf("intr_dispatch: stray level %d interrupt\n", vector);
+		printf("%s: stray level %d interrupt\n", __func__, vector);
 }
 
 bool



CVS commit: src/sys/arch/atari/atari

2022-07-02 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jul  2 08:25:21 UTC 2022

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

Log Message:
Misc cleanup.

- make local variables static
- use __func__ to print function names
- KNF


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

2022-07-02 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jul  2 08:11:47 UTC 2022

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

Log Message:
Use queue(3) macro as hp300 etc.  No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/atari/atari/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/atari/atari/intr.c
diff -u src/sys/arch/atari/atari/intr.c:1.28 src/sys/arch/atari/atari/intr.c:1.29
--- src/sys/arch/atari/atari/intr.c:1.28	Sun Jan  3 17:42:10 2021
+++ src/sys/arch/atari/atari/intr.c	Sat Jul  2 08:11:47 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.28 2021/01/03 17:42:10 thorpej Exp $	*/
+/*	$NetBSD: intr.c,v 1.29 2022/07/02 08:11:47 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.28 2021/01/03 17:42:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.29 2022/07/02 08:11:47 tsutsui Exp $");
 
 #include 
 #include 
@@ -152,7 +152,7 @@ intr_establish(int vector, int type, int
 	 * If the vec_list is empty, we insert ourselves at the head of the
 	 * list and we re-route the 'hard-vector' to the appropriate handler.
 	 */
-	if (vec_list->lh_first == NULL) {
+	if (LIST_EMPTY(vec_list)) {
 
 		s = splhigh();
 		LIST_INSERT_HEAD(vec_list, ih, ih_link);
@@ -178,7 +178,7 @@ intr_establish(int vector, int type, int
 	/*
 	 * Check for FAST_VEC botches
 	 */
-	cur_vec = vec_list->lh_first;
+	cur_vec = LIST_FIRST(vec_list);
 	if (cur_vec->ih_type & FAST_VEC) {
 		kmem_free(ih, sizeof(*ih));
 		printf("intr_establish: vector cannot be shared\n");
@@ -189,8 +189,9 @@ intr_establish(int vector, int type, int
 	 * We traverse the list and place ourselves after any handlers with
 	 * our current (or higher) priority level.
 	 */
-	for (cur_vec = vec_list->lh_first; cur_vec->ih_link.le_next != NULL;
-	cur_vec = cur_vec->ih_link.le_next) {
+	for (cur_vec = LIST_FIRST(vec_list);
+	LIST_NEXT(cur_vec, ih_link) != NULL;
+	cur_vec = LIST_NEXT(cur_vec, ih_link)) {
 		if (ih->ih_pri > cur_vec->ih_pri) {
 
 			s = splhigh();
@@ -242,8 +243,9 @@ intr_disestablish(struct intrhand *ih)
 	/*
 	 * Check if the vector is really in the list we think it's in
 	 */
-	for (cur_vec = vec_list->lh_first; cur_vec->ih_link.le_next != NULL;
-	cur_vec = cur_vec->ih_link.le_next) {
+	for (cur_vec = LIST_FIRST(vec_list);
+	LIST_NEXT(cur_vec, ih_link) != NULL;
+	cur_vec = LIST_NEXT(cur_vec, ih_link)) {
 		if (ih == cur_vec)
 			break;
 	}
@@ -254,7 +256,7 @@ intr_disestablish(struct intrhand *ih)
 
 	s = splhigh();
 	LIST_REMOVE(ih, ih_link);
-	if ((vec_list->lh_first == NULL) && (ih->ih_type & FAST_VEC))
+	if (LIST_EMPTY(vec_list) && (ih->ih_type & FAST_VEC))
 		*hard_vec = (u_long)intr_glue;
 	splx(s);
 
@@ -284,7 +286,7 @@ intr_dispatch(struct clockframe frame)
 	else
 		panic("intr_dispatch: Bogus vector %d", vector);
 
-	if ((ih = vec_list->lh_first) == NULL) {
+	if ((ih = LIST_FIRST(vec_list)) == NULL) {
 		printf("intr_dispatch: vector %d unexpected\n", vector);
 		if (++unexpected > 10)
 			panic("intr_dispatch: too many unexpected interrupts");
@@ -293,7 +295,7 @@ intr_dispatch(struct clockframe frame)
 	ih->ih_intrcnt[0]++;
 
 	/* Give all the handlers a chance. */
-	for (; ih != NULL; ih = ih->ih_link.le_next)
+	for (; ih != NULL; ih = LIST_NEXT(ih, ih_link))
 		handled |= (*ih->ih_fun)((ih->ih_type & ARG_CLOCKFRAME) ?
 		&frame : ih->ih_arg, frame.cf_sr);
 



CVS commit: src/sys/arch/atari/atari

2022-07-02 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jul  2 08:11:47 UTC 2022

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

Log Message:
Use queue(3) macro as hp300 etc.  No binary change.


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

2022-05-31 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue May 31 15:24:59 UTC 2022

Modified Files:
src/sys/arch/atari/atari: stalloc.c

Log Message:
Restore NULL pointer checks lost in rev 1.16.

Fixes PR port-atari/56859, ok'ed mlelstv@, and confirmed on TT030.
Should be pulled up to netbsd-9 and netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/atari/atari/stalloc.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/atari/atari/stalloc.c
diff -u src/sys/arch/atari/atari/stalloc.c:1.16 src/sys/arch/atari/atari/stalloc.c:1.17
--- src/sys/arch/atari/atari/stalloc.c:1.16	Fri Jan  3 07:14:20 2014
+++ src/sys/arch/atari/atari/stalloc.c	Tue May 31 15:24:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: stalloc.c,v 1.16 2014/01/03 07:14:20 mlelstv Exp $	*/
+/*	$NetBSD: stalloc.c,v 1.17 2022/05/31 15:24:59 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman (Atari modifications)
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: stalloc.c,v 1.16 2014/01/03 07:14:20 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: stalloc.c,v 1.17 2022/05/31 15:24:59 tsutsui Exp $");
 
 #include 
 #include 
@@ -163,7 +163,7 @@ free_stmem(void *mem)
 	/*
 	 * check ahead of us.
 	 */
-	if (next->type == MNODE_FREE) {
+	if (next != NULL && next->type == MNODE_FREE) {
 		/*
 		 * if next is: a valid node and a free node. ==> merge
 		 */
@@ -174,7 +174,7 @@ free_stmem(void *mem)
 		stmem_total += mn->size + sizeof(struct mem_node);
 		mn->size += next->size + sizeof(struct mem_node);
 	}
-	if (prev->type == MNODE_FREE) {
+	if (prev != NULL && prev->type == MNODE_FREE) {
 		/*
 		 * if prev is: a valid node and a free node. ==> merge
 		 */



CVS commit: src/sys/arch/atari/atari

2022-05-31 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue May 31 15:24:59 UTC 2022

Modified Files:
src/sys/arch/atari/atari: stalloc.c

Log Message:
Restore NULL pointer checks lost in rev 1.16.

Fixes PR port-atari/56859, ok'ed mlelstv@, and confirmed on TT030.
Should be pulled up to netbsd-9 and netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/atari/atari/stalloc.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/atari

2019-06-28 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jun 29 03:22:53 UTC 2019

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

Log Message:
Remove obsolete stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/arch/atari/atari/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/atari/atari/machdep.c
diff -u src/sys/arch/atari/atari/machdep.c:1.179 src/sys/arch/atari/atari/machdep.c:1.180
--- src/sys/arch/atari/atari/machdep.c:1.179	Sat Jun 29 03:19:49 2019
+++ src/sys/arch/atari/atari/machdep.c	Sat Jun 29 03:22:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.179 2019/06/29 03:19:49 tsutsui Exp $	*/
+/*	$NetBSD: machdep.c,v 1.180 2019/06/29 03:22:52 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.179 2019/06/29 03:19:49 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.180 2019/06/29 03:22:52 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -70,13 +70,8 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 #include 
 #include 
 #include 
-#if defined(DDB) && defined(__ELF__)
 #include 
-#endif
-
-#undef PS	/* XXX netccitt/pk.h conflict with machine/reg.h? */
 
-#define	MAXMEM	64*1024	/* XXX - from cmap.h */
 #include 
 
 #include 
@@ -163,12 +158,8 @@ consinit(void)
 		extern int end;
 		extern int *esym;
 
-#ifndef __ELF__
-		ksyms_addsyms_elf(*(int *)&end, ((int *)&end) + 1, esym);
-#else
 		ksyms_addsyms_elf((int)esym - (int)&end - sizeof(Elf32_Ehdr),
 		(void *)&end, esym);
-#endif
 	}
 #endif
 #if defined (DDB)



CVS commit: src/sys/arch/atari/atari

2019-06-28 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jun 29 03:22:53 UTC 2019

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

Log Message:
Remove obsolete stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/arch/atari/atari/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/atari/atari

2019-06-28 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jun 29 03:19:49 UTC 2019

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

Log Message:
Fix PR/54325 (use of dangling pointer).


To generate a diff of this commit:
cvs rdiff -u -r1.178 -r1.179 src/sys/arch/atari/atari/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/atari/atari/machdep.c
diff -u src/sys/arch/atari/atari/machdep.c:1.178 src/sys/arch/atari/atari/machdep.c:1.179
--- src/sys/arch/atari/atari/machdep.c:1.178	Sat Jun 29 03:10:51 2019
+++ src/sys/arch/atari/atari/machdep.c	Sat Jun 29 03:19:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.178 2019/06/29 03:10:51 tsutsui Exp $	*/
+/*	$NetBSD: machdep.c,v 1.179 2019/06/29 03:19:49 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.178 2019/06/29 03:10:51 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.179 2019/06/29 03:19:49 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -236,6 +236,8 @@ static void
 identifycpu(void)
 {
 	const char *mach, *mmu, *fpu, *cpu;
+	uint32_t pcr;
+	char cputxt[30];
 
 	switch (machineid & ATARI_ANYMACH) {
 	case ATARI_TT:
@@ -261,17 +263,12 @@ identifycpu(void)
 
 	switch (cputype) {
 	case CPU_68060:
-		{
-			uint32_t	pcr;
-			char		cputxt[30];
-
-			__asm(".word 0x4e7a,0x0808;"
-			"movl %%d0,%0" : "=d"(pcr) : : "d0");
-			snprintf(cputxt, sizeof(cputxt), "68%s060 rev.%d",
-			pcr & 0x1 ? "LC/EC" : "", (pcr >> 8) & 0xff);
-			cpu = cputxt;
-			mmu = "/MMU";
-		}
+		__asm(".word 0x4e7a,0x0808;"
+		"movl %%d0,%0" : "=d"(pcr) : : "d0");
+		snprintf(cputxt, sizeof(cputxt), "68%s060 rev.%d",
+		pcr & 0x1 ? "LC/EC" : "", (pcr >> 8) & 0xff);
+		cpu = cputxt;
+		mmu = "/MMU";
 		break;
 	case CPU_68040:
 		cpu = "m68040";



CVS commit: src/sys/arch/atari/atari

2019-06-28 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jun 29 03:19:49 UTC 2019

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

Log Message:
Fix PR/54325 (use of dangling pointer).


To generate a diff of this commit:
cvs rdiff -u -r1.178 -r1.179 src/sys/arch/atari/atari/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/atari/atari

2019-06-28 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jun 29 03:10:51 UTC 2019

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

Log Message:
TAB/space cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.177 -r1.178 src/sys/arch/atari/atari/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/atari/atari/machdep.c
diff -u src/sys/arch/atari/atari/machdep.c:1.177 src/sys/arch/atari/atari/machdep.c:1.178
--- src/sys/arch/atari/atari/machdep.c:1.177	Wed Mar 26 18:04:33 2014
+++ src/sys/arch/atari/atari/machdep.c	Sat Jun 29 03:10:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.177 2014/03/26 18:04:33 christos Exp $	*/
+/*	$NetBSD: machdep.c,v 1.178 2019/06/29 03:10:51 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.177 2014/03/26 18:04:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.178 2019/06/29 03:10:51 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -172,8 +172,8 @@ consinit(void)
 	}
 #endif
 #if defined (DDB)
-if (boothowto & RB_KDB)
-Debugger();
+	if (boothowto & RB_KDB)
+		Debugger();
 #endif
 }
 
@@ -235,7 +235,7 @@ cpu_startup(void)
 static void
 identifycpu(void)
 {
-   const char *mach, *mmu, *fpu, *cpu;
+	const char *mach, *mmu, *fpu, *cpu;
 
 	switch (machineid & ATARI_ANYMACH) {
 	case ATARI_TT:
@@ -260,7 +260,6 @@ identifycpu(void)
 	fpu = fpu_describe(fputype);
 
 	switch (cputype) {
- 
 	case CPU_68060:
 		{
 			uint32_t	pcr;
@@ -597,7 +596,7 @@ badbaddr(void *addr, int size)
 /*
  * this is a handy package to have asynchronously executed
  * function calls executed at very low interrupt priority.
- * Example for use is keyboard repeat, where the repeat 
+ * Example for use is keyboard repeat, where the repeat
  * handler running at splclock() triggers such a (hardware
  * aided) software interrupt.
  * Note: the installed functions are currently called in a



CVS commit: src/sys/arch/atari/atari

2019-06-28 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jun 29 03:10:51 UTC 2019

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

Log Message:
TAB/space cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.177 -r1.178 src/sys/arch/atari/atari/machdep.c

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



Re: CVS commit: src/sys/arch/atari/atari

2014-09-26 Thread Maxime Villard
Le 21/09/2014 17:49, Christos Zoulas a écrit :
> 
> Module Name:  src
> Committed By: christos
> Date: Sun Sep 21 15:49:21 UTC 2014
> 
> Modified Files:
>   src/sys/arch/atari/atari: intr.c
> 
> Log Message:
> fix leak.
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.23 -r1.24 src/sys/arch/atari/atari/intr.c
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
> 
> 

My scanner forgets variables as soon as a bug is detected with them.
Which means that only the first leak is reported.

In this file there's another leak below (not tested):

Index: atari/intr.c
===
RCS file: /cvsroot/src/sys/arch/atari/atari/intr.c,v
retrieving revision 1.24
diff -u -r1.24 intr.c
--- atari/intr.c21 Sep 2014 15:49:21 -  1.24
+++ atari/intr.c26 Sep 2014 15:53:18 -
@@ -141,8 +141,10 @@
ih->ih_intrcnt = &intrcnt_auto[vector-1];
break;
case USER_VEC:
-   if (vector < UVEC_MIN || vector > UVEC_MAX)
+   if (vector < UVEC_MIN || vector > UVEC_MAX) {
+   free(ih, M_DEVBUF);
return NULL;
+   }
vec_list = &uservec_list[vector];
hard_vec = &uservects[vector];
ih->ih_intrcnt = &intrcnt_user[vector];



Re: CVS commit: src/sys/arch/atari/atari

2014-09-26 Thread Christos Zoulas
On Sep 26,  6:00pm, m...@m00nbsd.net (Maxime Villard) wrote:
-- Subject: Re: CVS commit: src/sys/arch/atari/atari

| My scanner forgets variables as soon as a bug is detected with them.
| Which means that only the first leak is reported.
| 
| In this file there's another leak below (not tested):

Applied.

christos