CVS commit: src/sys/arch/next68k/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb  4 07:07:41 UTC 2023

Modified Files:
src/sys/arch/next68k/next68k: locore.s

Log Message:
Remove #ifdef'ed out hp300 specific stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/next68k/next68k/locore.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/next68k/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb  4 07:07:41 UTC 2023

Modified Files:
src/sys/arch/next68k/next68k: locore.s

Log Message:
Remove #ifdef'ed out hp300 specific stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/next68k/next68k/locore.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/next68k/next68k/locore.s
diff -u src/sys/arch/next68k/next68k/locore.s:1.69 src/sys/arch/next68k/next68k/locore.s:1.70
--- src/sys/arch/next68k/next68k/locore.s:1.69	Fri Feb  3 23:13:01 2023
+++ src/sys/arch/next68k/next68k/locore.s	Sat Feb  4 07:07:41 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.69 2023/02/03 23:13:01 tsutsui Exp $	*/
+/*	$NetBSD: locore.s,v 1.70 2023/02/04 07:07:41 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1998 Darrin B. Jewell
@@ -229,10 +229,6 @@ Lnot68030:
 	movl	#CPU_68040,%a0@		| and a 68040 CPU
 	RELOC(fputype, %a0)
 	movl	#FPU_68040,%a0@		| ...and FPU
-#if defined(ENABLE_HP_CODE)
-	RELOC(ectype, %a0)
-	movl	#EC_NONE,%a0@		| and no cache (for now XXX)
-#endif
 	RELOC(machineid, %a0)
 	movl	#40,%a0@		| @@@ useless
 	jra	Lstart1
@@ -334,10 +330,6 @@ Lstart3:
 	movl	%a0@,%d1		| read value (a PA)
 
 	RELOC(mmutype, %a0)
-#if defined(ENABLE_HP_CODE)
-	tstl	%a0@			| HP MMU?
-	jeq	Lhpmmu2			| yes, skip
-#endif
 	cmpl	#MMU_68040,%a0@		| 68040?
 	jne	Lmotommu1		| no, skip
 	.long	0x4e7b1807		| movc %d1,%srp
@@ -349,31 +341,7 @@ Lmotommu1:
 	pmove	%a0@,%srp		| load the supervisor root pointer
 	movl	#0x8002,%a0@	| reinit upper half for CRP loads
 
-#if defined(ENABLE_HP_CODE)
-	jra	Lstploaddone		| done
-Lhpmmu2:
-	moveq	#PGSHIFT,%d2
-	lsrl	%d2,%d1			| convert to page frame
-	movl	%d1,INTIOBASE+MMUBASE+MMUSSTP | load in sysseg table register
-#endif
 Lstploaddone:
-#if defined(ENABLE_MAXADDR_TRAMPOLINE)
-	lea	MAXADDR,%a2		| PA of last RAM page
-	ASRELOC(Lhighcode, %a1)		| addr of high code
-	ASRELOC(Lehighcode, %a3)	| end addr
-Lcodecopy:
-	movw	%a1@+,%a2@+		| copy a word
-	cmpl	%a3,%a1			| done yet?
-	jcs	Lcodecopy		| no, keep going
-	jmp	MAXADDR			| go for it!
-	/*
-	 * BEGIN MMU TRAMPOLINE.  This section of code is not
-	 * executed in-place.  It's copied to the last page
-	 * of RAM (mapped va == pa) and executed there.
-	 */
-
-Lhighcode:
-#endif /* ENABLE_MAXADDR_TRAMPOLINE */
 
 	/*
 	 * Set up the vector table, and race to get the MMU
@@ -387,17 +355,8 @@ Lhighcode:
 	movc	%d0,%vbr
 
 	RELOC(mmutype, %a0)
-#if defined(ENABLE_HP_CODE)
-	tstl	%a0@			| HP MMU?
-	jeq	Lhpmmu3			| yes, skip
-#endif
 	cmpl	#MMU_68040,%a0@		| 68040?
 	jne	Lmotommu2		| no, skip
-#if defined(ENABLE_HP_CODE)
-	movw	#0,INTIOBASE+MMUBASE+MMUCMD+2
-	movw	#MMU_IEN+MMU_CEN+MMU_FPE,INTIOBASE+MMUBASE+MMUCMD+2
-	| enable FPU and caches
-#endif
 
 	| This is a hack to get PA=KVA when turning on MMU
 	| it will only work on 68040's.  We should fix something
@@ -425,28 +384,11 @@ Lturnoffttr:
 	.long	0x4e7b0007		| movc %d0,%dtt1
 	jmp	Lenab1
 Lmotommu2:
-#if defined(ENABLE_HP_CODE)
-	movl	#MMU_IEN+MMU_FPE,INTIOBASE+MMUBASE+MMUCMD
-	| enable 68881 and i-cache
-#endif
 	pflusha
 	RELOC(prototc, %a2)
 	movl	#0x82c0aa00,%a2@	| value to load TC with
 	pmove	%a2@,%tc		| load it
 	jmp	Lenab1:l		| force absolute (not pc-relative) jmp
-#if defined(ENABLE_HP_CODE)
-Lhpmmu3:
-	movl	#0,INTIOBASE+MMUBASE+MMUCMD	| clear external cache
-	movl	#MMU_ENAB,INTIOBASE+MMUBASE+MMUCMD | turn on MMU
-	jmp	Lenab1:l			| jmp to mapped code
-#endif
-#if defined(ENABLE_MAXADDR_TRAMPOLINE)
-Lehighcode:
-
-	/*
-	 * END MMU TRAMPOLINE.  Address register %a5 is now free.
-	 */
-#endif
 
 /*
  * Should be running mapped from this point on
@@ -941,24 +883,6 @@ Lsldone:
 	rts
 #endif
 
-#if defined(ENABLE_HP_CODE)
-ENTRY(ecacheon)
-	tstl	_C_LABEL(ectype)
-	jeq	Lnocache7
-	MMUADDR(%a0)
-	orl	#MMU_CEN,%a0@(MMUCMD)
-Lnocache7:
-	rts
-
-ENTRY(ecacheoff)
-	tstl	_C_LABEL(ectype)
-	jeq	Lnocache8
-	MMUADDR(%a0)
-	andl	#~MMU_CEN,%a0@(MMUCMD)
-Lnocache8:
-	rts
-#endif
-
 /*
  * Load a new user segment table pointer.
  */
@@ -1137,11 +1061,6 @@ GLOBAL(mmutype)
 GLOBAL(cputype)
 	.long	0xdeadbeef	| default to 68020 CPU
 
-#if defined(ENABLE_HP_CODE)
-GLOBAL(ectype)
-	.long	EC_NONE		| external cache type, default to none
-#endif
-
 GLOBAL(fputype)
 	.long	0xdeadbeef	| default to 68882 FPU
 
@@ -1175,20 +1094,6 @@ ASLOCAL(save_vbr)		| VBR from ROM
 GLOBAL(monbootflag)
 	.long 0
 
-#if defined(ENABLE_HP_CODE)
-GLOBAL(extiobase)
-	.long	0		| KVA of base of external IO space
-
-GLOBAL(CLKbase)
-	.long	0		| KVA of base of clock registers
-
-GLOBAL(MMUbase)
-	.long	0		| KVA of base of HP MMU registers
-
-GLOBAL(pagezero)
-	.long	0		| PA of first page of kernel text
-#endif
-
 #ifdef USELEDS
 ASLOCAL(heartbeat)
 	.long	0		| clock ticks since last pulse of heartbeat



CVS commit: src/sys/arch/next68k/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb  4 02:08:03 UTC 2023

Modified Files:
src/sys/arch/next68k/next68k: disksubr.c

Log Message:
Misc KNF and cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/next68k/next68k/disksubr.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/next68k/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb  4 02:08:03 UTC 2023

Modified Files:
src/sys/arch/next68k/next68k: disksubr.c

Log Message:
Misc KNF and cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/next68k/next68k/disksubr.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/next68k/next68k/disksubr.c
diff -u src/sys/arch/next68k/next68k/disksubr.c:1.31 src/sys/arch/next68k/next68k/disksubr.c:1.32
--- src/sys/arch/next68k/next68k/disksubr.c:1.31	Fri Feb  3 23:13:01 2023
+++ src/sys/arch/next68k/next68k/disksubr.c	Sat Feb  4 02:08:03 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: disksubr.c,v 1.31 2023/02/03 23:13:01 tsutsui Exp $	*/
+/*	$NetBSD: disksubr.c,v 1.32 2023/02/04 02:08:03 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1988, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.31 2023/02/03 23:13:01 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.32 2023/02/04 02:08:03 tsutsui Exp $");
 
 #include 
 #include 
@@ -76,23 +76,23 @@ parse_nextstep_label(struct next68k_disk
 struct cpu_disklabel *osdep)
 {
 	int i, t, nbp;
-	unsigned short *checksum;
+	uint16_t *checksum;
 
 	if (ondisk->cd_version == NEXT68K_LABEL_CD_V3) {
 		checksum = >NEXT68K_LABEL_cd_v3_checksum;
 	} else {
 		checksum = >NEXT68K_LABEL_cd_checksum;
 	}
-	if (nextstep_checksum ((unsigned char *)ondisk,
-			   (unsigned char *)checksum) != *checksum) {
-		return ("disk label corrupted");
+	if (nextstep_checksum((uint8_t *)ondisk, (uint8_t *)checksum) !=
+	*checksum) {
+		return "disk label corrupted";
 	}
 
 	osdep->od_version = ondisk->cd_version;
 	lp->d_magic = lp->d_magic2 = DISKMAGIC;
 	lp->d_type = DKTYPE_SCSI;
 	lp->d_subtype = 0;
-	if (sizeof (lp->d_typename) > sizeof(ondisk->cd_name))
+	if (sizeof(lp->d_typename) > sizeof(ondisk->cd_name))
 		lp->d_typename[sizeof (ondisk->cd_name)] = '\0';
 	memcpy(lp->d_typename, ondisk->cd_name,
 	uimin(sizeof (lp->d_typename), sizeof(ondisk->cd_name)));
@@ -171,7 +171,6 @@ build_nextstep_label(struct next68k_disk
 	int front_porch = NEXT68K_LABEL_DEFAULTFRONTPORCH;
 	uint16_t *checksum;
 
-
 	memset(ondisk, 0, sizeof(*ondisk));
 
 	ondisk->cd_version = NEXT68K_LABEL_CD_V3;
@@ -213,7 +212,7 @@ build_nextstep_label(struct next68k_disk
 
 	/*
 	 * figure out front porch
-	 * try to map partitions which were moved 
+	 * try to map partitions which were moved
 	 */
 	for (nbp = 0; nbp < lp->d_npartitions; nbp++) {
 		if (nbp != RAW_PART && lp->d_partitions[nbp].p_offset > 0 &&
@@ -230,12 +229,12 @@ build_nextstep_label(struct next68k_disk
 			 (ondisk->cd_secsize / lp->d_secsize)) &&
 			((lp->d_partitions[nbp].p_fstype == FS_OTHER) ||
 			 (!strncmp (ondisk->cd_partitions[t].cp_type,
- fstypenames[lp->d_partitions[nbp].p_fstype], 
+ fstypenames[lp->d_partitions[nbp].p_fstype],
  NEXT68K_LABEL_MAXFSTLEN {
 struct next68k_partition tmp;
-memcpy(, >cd_partitions[t], 
+memcpy(, >cd_partitions[t],
 sizeof(tmp));
-memcpy(>cd_partitions[t], 
+memcpy(>cd_partitions[t],
 >cd_partitions[nbp > RAW_PART ?
 nbp - 1 : nbp],
 sizeof (tmp));
@@ -247,7 +246,7 @@ build_nextstep_label(struct next68k_disk
 	}
 	front_porch /= (ondisk->cd_secsize / lp->d_secsize);
 
-	/* 
+	/*
 	 * update partitions
 	 */
 	nbp = 0;
@@ -279,7 +278,7 @@ build_nextstep_label(struct next68k_disk
 			p->cp_offset = -1;
 			p->cp_bsize = -1;
 			p->cp_fsize = -1;
-			p->cp_density = -1; 
+			p->cp_density = -1;
 			p->cp_minfree = -1;
 		}
 		nbp++;
@@ -422,7 +421,7 @@ writedisklabel(dev_t dev, void (*strat)(
 	 * We always write a NeXT v3 disklabel, and a NetBSD disklabel in
 	 * the last sector of the NeXT label area.
 	 */
-  
+
 	bp = geteblk(NEXT68K_LABEL_SIZE);
 	bp->b_dev = MAKEDISKDEV(major(dev), DISKUNIT(dev), labelpart);
 	bp->b_blkno = NEXT68K_LABEL_SECTOR;



CVS commit: src/sys/arch/next68k/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:22:34 UTC 2023

Modified Files:
src/sys/arch/next68k/next68k: mainbus.c

Log Message:
Misc KNF and cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/next68k/next68k/mainbus.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/next68k/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:22:34 UTC 2023

Modified Files:
src/sys/arch/next68k/next68k: mainbus.c

Log Message:
Misc KNF and cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/next68k/next68k/mainbus.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/next68k/next68k/mainbus.c
diff -u src/sys/arch/next68k/next68k/mainbus.c:1.13 src/sys/arch/next68k/next68k/mainbus.c:1.14
--- src/sys/arch/next68k/next68k/mainbus.c:1.13	Sat Aug  7 16:19:01 2021
+++ src/sys/arch/next68k/next68k/mainbus.c	Fri Feb  3 23:22:34 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.13 2021/08/07 16:19:01 thorpej Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.14 2023/02/03 23:22:34 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.13 2021/08/07 16:19:01 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.14 2023/02/03 23:22:34 tsutsui Exp $");
 
 #include 
 #include 
@@ -73,9 +73,10 @@ static int mainbus_attached = 0;
 static int
 mainbus_match(device_t parent, cfdata_t cf, void *aux)
 {
+
 	/* Allow only one instance. */
 	if (mainbus_attached)
-		return (0);
+		return 0;
 
 	return 1;
 }
@@ -83,7 +84,7 @@ mainbus_match(device_t parent, cfdata_t 
 static void
 mainbus_attach(device_t parent, device_t self, void *aux)
 {
-	struct mainbus_attach_args	mba;
+	struct mainbus_attach_args mba;
 
 	printf("\n");
 
@@ -97,9 +98,9 @@ mainbus_attach(device_t parent, device_t
 }
 
 static int
-mainbus_search(device_t parent, cfdata_t cf,
-	   const int *ldesc, void *aux)
+mainbus_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
 {
+
 	if (config_probe(parent, cf, aux))
 		config_attach(parent, cf, aux, NULL, CFARGS_NONE);
 	return 0;



CVS commit: src/sys/arch/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:21:18 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: nextdisplay.c
src/sys/arch/next68k/include: bus_space.h
src/sys/arch/next68k/next68k: machdep.c

Log Message:
Use proper C99 int types.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/next68k/dev/nextdisplay.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/next68k/include/bus_space.h
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/next68k/next68k/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/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:21:18 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: nextdisplay.c
src/sys/arch/next68k/include: bus_space.h
src/sys/arch/next68k/next68k: machdep.c

Log Message:
Use proper C99 int types.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/next68k/dev/nextdisplay.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/next68k/include/bus_space.h
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/next68k/next68k/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/next68k/dev/nextdisplay.c
diff -u src/sys/arch/next68k/dev/nextdisplay.c:1.26 src/sys/arch/next68k/dev/nextdisplay.c:1.27
--- src/sys/arch/next68k/dev/nextdisplay.c:1.26	Fri Feb  3 23:13:00 2023
+++ src/sys/arch/next68k/dev/nextdisplay.c	Fri Feb  3 23:21:17 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: nextdisplay.c,v 1.26 2023/02/03 23:13:00 tsutsui Exp $ */
+/* $NetBSD: nextdisplay.c,v 1.27 2023/02/03 23:21:17 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1998 Matt DeBergalis
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.26 2023/02/03 23:13:00 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.27 2023/02/03 23:21:17 tsutsui Exp $");
 
 #include 			/* RCS ID & Copyright macro defns */
 
@@ -197,7 +197,7 @@ nextdisplay_init(struct nextdisplay_conf
 #endif
 
 	/* clear the screen */
-	for (i = 0; i < dc->dc_ht * dc->dc_rowbytes; i += sizeof(u_int32_t))
+	for (i = 0; i < dc->dc_ht * dc->dc_rowbytes; i += sizeof(uint32_t))
 		*(uint32_t *)(dc->dc_videobase + i) =
 		color ? 0x0 : 0x;
 
@@ -205,7 +205,7 @@ nextdisplay_init(struct nextdisplay_conf
 	rap->width = dc->dc_wid;
 	rap->height = dc->dc_ht;
 	rap->depth = color ? 16 : 2;
-	rap->linelongs = dc->dc_rowbytes / sizeof(u_int32_t);
+	rap->linelongs = dc->dc_rowbytes / sizeof(uint32_t);
 	rap->pixels = (uint32_t *)dc->dc_videobase;
 
 	/* initialize the raster console blitter */

Index: src/sys/arch/next68k/include/bus_space.h
diff -u src/sys/arch/next68k/include/bus_space.h:1.21 src/sys/arch/next68k/include/bus_space.h:1.22
--- src/sys/arch/next68k/include/bus_space.h:1.21	Fri Feb  3 23:13:01 2023
+++ src/sys/arch/next68k/include/bus_space.h	Fri Feb  3 23:21:18 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space.h,v 1.21 2023/02/03 23:13:01 tsutsui Exp $	*/
+/*	$NetBSD: bus_space.h,v 1.22 2023/02/03 23:21:18 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -131,7 +131,7 @@ typedef u_long	bus_space_handle_t;
 		m68k_btop((t)+((a)-COLORBASE)) : (-1
 
 /*
- *	u_intN_t bus_space_read_N(bus_space_tag_t tag,
+ *	uintN_t bus_space_read_N(bus_space_tag_t tag,
  *	bus_space_handle_t bsh, bus_size_t offset);
  *
  * Read a 1, 2, 4, or 8 byte quantity from bus space
@@ -139,18 +139,18 @@ typedef u_long	bus_space_handle_t;
  */
 
 #define	bus_space_read_1(t, h, o)	\
-((void) t, (*(volatile u_int8_t *)((h) + (o
+((void) t, (*(volatile uint8_t *)((h) + (o
 
 #define	bus_space_read_2(t, h, o)	\
-((void) t, (*(volatile u_int16_t *)((h) + (o
+((void) t, (*(volatile uint16_t *)((h) + (o
 
 #define	bus_space_read_4(t, h, o)	\
-((void) t, (*(volatile u_int32_t *)((h) + (o
+((void) t, (*(volatile uint32_t *)((h) + (o
 
 /*
  *	void bus_space_read_multi_N(bus_space_tag_t tag,
  *	bus_space_handle_t bsh, bus_size_t offset,
- *	u_intN_t *addr, size_t count);
+ *	uintN_t *addr, size_t count);
  *
  * Read `count' 1, 2, 4, or 8 byte quantities from bus space
  * described by tag/handle/offset and copy into buffer provided.
@@ -201,7 +201,7 @@ typedef u_long	bus_space_handle_t;
 /*
  *	void bus_space_read_region_N(bus_space_tag_t tag,
  *	bus_space_handle_t bsh, bus_size_t offset,
- *	u_intN_t *addr, size_t count);
+ *	uintN_t *addr, size_t count);
  *
  * Read `count' 1, 2, 4, or 8 byte quantities from bus space
  * described by tag/handle and starting at `offset' and copy into
@@ -253,25 +253,25 @@ typedef u_long	bus_space_handle_t;
 /*
  *	void bus_space_write_N(bus_space_tag_t tag,
  *	bus_space_handle_t bsh, bus_size_t offset,
- *	u_intN_t value);
+ *	uintN_t value);
  *
  * Write the 1, 2, 4, or 8 byte value `value' to bus space
  * described by tag/handle/offset.
  */
 
 #define	bus_space_write_1(t, h, o, v)	\
-((void) t, ((void)(*(volatile u_int8_t *)((h) + (o)) = (v
+((void) t, ((void)(*(volatile uint8_t *)((h) + (o)) = (v
 
 #define	bus_space_write_2(t, h, o, v)	\
-((void) t, ((void)(*(volatile u_int16_t *)((h) + (o)) = (v
+((void) t, ((void)(*(volatile uint16_t *)((h) + (o)) = (v
 
 #define	bus_space_write_4(t, h, o, v)	\
-((void) t, ((void)(*(volatile u_int32_t *)((h) + (o)) = (v
+((void) t, ((void)(*(volatile uint32_t *)((h) + (o)) = (v
 
 /*
  *	void 

CVS commit: src/sys/arch/next68k/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:19:03 UTC 2023

Modified Files:
src/sys/arch/next68k/next68k: isr.c

Log Message:
Use proper LIST(3) macro.


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

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:19:03 UTC 2023

Modified Files:
src/sys/arch/next68k/next68k: isr.c

Log Message:
Use proper LIST(3) macro.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/next68k/next68k/isr.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/next68k/next68k/isr.c
diff -u src/sys/arch/next68k/next68k/isr.c:1.32 src/sys/arch/next68k/next68k/isr.c:1.33
--- src/sys/arch/next68k/next68k/isr.c:1.32	Fri Apr  2 12:11:41 2021
+++ src/sys/arch/next68k/next68k/isr.c	Fri Feb  3 23:19:03 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: isr.c,v 1.32 2021/04/02 12:11:41 rin Exp $ */
+/*	$NetBSD: isr.c,v 1.33 2023/02/03 23:19:03 tsutsui Exp $ */
 
 /*
  * This file was taken from mvme68k/mvme68k/isr.c
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.32 2021/04/02 12:11:41 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.33 2023/02/03 23:19:03 tsutsui Exp $");
 
 #include 
 #include 
@@ -146,7 +146,7 @@ isrlink_autovec(int (*func)(void *), voi
 	 * at the head of the list.
 	 */
 	list = _autovec[ipl];
-	if (list->lh_first == NULL) {
+	if (LIST_FIRST(list) == NULL) {
 		LIST_INSERT_HEAD(list, newisr, isr_link);
 		return;
 	}
@@ -156,8 +156,8 @@ isrlink_autovec(int (*func)(void *), voi
 	 * and place ourselves after any ISRs with our current (or
 	 * higher) priority.
 	 */
-	for (curisr = list->lh_first; curisr->isr_link.le_next != NULL;
-	curisr = curisr->isr_link.le_next) {
+	for (curisr = LIST_FIRST(list); LIST_NEXT(curisr, isr_link) != NULL;
+	curisr = LIST_NEXT(curisr, isr_link)) {
 		if (newisr->isr_priority > curisr->isr_priority) {
 			LIST_INSERT_BEFORE(curisr, newisr, isr_link);
 			return;
@@ -281,7 +281,7 @@ isrdispatch_autovec(struct clockframe *f
 #endif
 
 	list = _autovec[ipl];
-	if (list->lh_first == NULL) {
+	if (LIST_FIRST(list) == NULL) {
 		printf("isrdispatch_autovec: ipl %d unexpected\n", ipl);
 		if (++unexpected > 10)
 			panic("too many unexpected interrupts");
@@ -291,7 +291,8 @@ isrdispatch_autovec(struct clockframe *f
 
 	/* Give all the handlers a chance. */
 	handled = 0;
-	for (isr = list->lh_first ; isr != NULL; isr = isr->isr_link.le_next) {
+	for (isr = LIST_FIRST(list); isr != NULL;
+	isr = LIST_NEXT(isr, isr_link)) {
 		arg = isr->isr_arg ? isr->isr_arg : frame;
 		if ((*isr->isr_func)(arg) != 0) {
 			if (isr->isr_evcnt)



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

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:17:49 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: esp.c

Log Message:
Make local functions static.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/next68k/dev/esp.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/next68k/dev

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:17:49 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: esp.c

Log Message:
Make local functions static.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/next68k/dev/esp.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/next68k/dev/esp.c
diff -u src/sys/arch/next68k/dev/esp.c:1.66 src/sys/arch/next68k/dev/esp.c:1.67
--- src/sys/arch/next68k/dev/esp.c:1.66	Fri Feb  3 23:16:07 2023
+++ src/sys/arch/next68k/dev/esp.c	Fri Feb  3 23:17:49 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: esp.c,v 1.66 2023/02/03 23:16:07 tsutsui Exp $	*/
+/*	$NetBSD: esp.c,v 1.67 2023/02/03 23:17:49 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.66 2023/02/03 23:16:07 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.67 2023/02/03 23:17:49 tsutsui Exp $");
 
 #include 
 #include 
@@ -126,13 +126,13 @@ int esp_debug = 0;
 #define PRINTF(x) printf x;
 
 
-int	espmatch_intio(device_t, cfdata_t, void *);
-void	espattach_intio(device_t, device_t, void *);
+static int espmatch_intio(device_t, cfdata_t, void *);
+static void espattach_intio(device_t, device_t, void *);
 
 /* DMA callbacks */
-bus_dmamap_t esp_dmacb_continue(void *);
-void esp_dmacb_completed(bus_dmamap_t, void *);
-void esp_dmacb_shutdown(void *);
+static bus_dmamap_t esp_dmacb_continue(void *);
+static void esp_dmacb_completed(bus_dmamap_t, void *);
+static void esp_dmacb_shutdown(void *);
 
 static void findchannel_defer(device_t);
 
@@ -155,18 +155,20 @@ static int attached = 0;
 /*
  * Functions and the switch for the MI code.
  */
-uint8_t	esp_read_reg(struct ncr53c9x_softc *, int);
-void	esp_write_reg(struct ncr53c9x_softc *, int, uint8_t);
-int	esp_dma_isintr(struct ncr53c9x_softc *);
-void	esp_dma_reset(struct ncr53c9x_softc *);
-int	esp_dma_intr(struct ncr53c9x_softc *);
-int	esp_dma_setup(struct ncr53c9x_softc *, uint8_t **, size_t *, int,
-	size_t *);
-void	esp_dma_go(struct ncr53c9x_softc *);
-void	esp_dma_stop(struct ncr53c9x_softc *);
-int	esp_dma_isactive(struct ncr53c9x_softc *);
+static uint8_t esp_read_reg(struct ncr53c9x_softc *, int);
+static void esp_write_reg(struct ncr53c9x_softc *, int, uint8_t);
+static int esp_dma_isintr(struct ncr53c9x_softc *);
+static void esp_dma_reset(struct ncr53c9x_softc *);
+static int esp_dma_intr(struct ncr53c9x_softc *);
+static int esp_dma_setup(struct ncr53c9x_softc *, uint8_t **, size_t *, int,
+size_t *);
+static void esp_dma_go(struct ncr53c9x_softc *);
+static void esp_dma_stop(struct ncr53c9x_softc *);
+static int esp_dma_isactive(struct ncr53c9x_softc *);
 
-struct ncr53c9x_glue esp_glue = {
+static int doze(volatile int);
+
+static struct ncr53c9x_glue esp_glue = {
 	.gl_read_reg = esp_read_reg,
 	.gl_write_reg = esp_write_reg,
 	.gl_dma_isintr = esp_dma_isintr,
@@ -215,7 +217,7 @@ esp_hex_dump(unsigned char *pkt, size_t 
 }
 #endif
 
-int
+static int
 espmatch_intio(device_t parent, cfdata_t cf, void *aux)
 {
 	struct intio_attach_args *ia = aux;
@@ -286,7 +288,7 @@ findchannel_defer(device_t self)
 	device_xname(esc->sc_dma->sc_dev));
 }
 
-void
+static void
 espattach_intio(device_t parent, device_t self, void *aux)
 {
 	struct esp_softc *esc = device_private(self);
@@ -417,7 +419,7 @@ espattach_intio(device_t parent, device_
  * Glue functions.
  */
 
-uint8_t
+static uint8_t
 esp_read_reg(struct ncr53c9x_softc *sc, int reg)
 {
 	struct esp_softc *esc = (struct esp_softc *)sc;
@@ -425,7 +427,7 @@ esp_read_reg(struct ncr53c9x_softc *sc, 
 	return bus_space_read_1(esc->sc_bst, esc->sc_bsh, reg);
 }
 
-void
+static void
 esp_write_reg(struct ncr53c9x_softc *sc, int reg, uint8_t val)
 {
 	struct esp_softc *esc = (struct esp_softc *)sc;
@@ -436,8 +438,7 @@ esp_write_reg(struct ncr53c9x_softc *sc,
 volatile uint32_t save1;
 
 #define xADDR 0x0211a000
-int doze(volatile int);
-int
+static int
 doze(volatile int c)
 {
 #if 0
@@ -464,7 +465,7 @@ doze(volatile int c)
 	return 0;
 }
 
-int
+static int
 esp_dma_isintr(struct ncr53c9x_softc *sc)
 {
 	struct esp_softc *esc = (struct esp_softc *)sc;
@@ -480,7 +481,7 @@ esp_dma_isintr(struct ncr53c9x_softc *sc
 	}
 }
 
-int
+static int
 esp_dma_intr(struct ncr53c9x_softc *sc)
 {
 	struct esp_softc *esc = (struct esp_softc *)sc;
@@ -746,7 +747,7 @@ esp_dma_intr(struct ncr53c9x_softc *sc)
 	return r;
 }
 
-void
+static void
 esp_dma_reset(struct ncr53c9x_softc *sc)
 {
 	struct esp_softc *esc = (struct esp_softc *)sc;
@@ -808,7 +809,7 @@ esp_dma_reset(struct ncr53c9x_softc *sc)
  * (len may be > maxxfer)
  */
 
-int
+static int
 esp_dma_setup(struct ncr53c9x_softc *sc, uint8_t **addr, size_t *len,
 int datain, size_t *dmasize)
 {
@@ -1277,7 +1278,7 @@ esp_dma_print(struct ncr53c9x_softc *sc)
 }
 #endif
 
-void
+static void
 esp_dma_go(struct 

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

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:16:07 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: esp.c espreg.h espvar.h

Log Message:
Misc cleanup.

- use C99 designated initializer
- misc KNF
- TAB/space cleanup


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/next68k/dev/esp.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/next68k/dev/espreg.h
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/next68k/dev/espvar.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/next68k/dev/esp.c
diff -u src/sys/arch/next68k/dev/esp.c:1.65 src/sys/arch/next68k/dev/esp.c:1.66
--- src/sys/arch/next68k/dev/esp.c:1.65	Fri Jan 27 15:31:05 2023
+++ src/sys/arch/next68k/dev/esp.c	Fri Feb  3 23:16:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: esp.c,v 1.65 2023/01/27 15:31:05 tsutsui Exp $	*/
+/*	$NetBSD: esp.c,v 1.66 2023/02/03 23:16:07 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.65 2023/01/27 15:31:05 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.66 2023/02/03 23:16:07 tsutsui Exp $");
 
 #include 
 #include 
@@ -134,7 +134,7 @@ bus_dmamap_t esp_dmacb_continue(void *);
 void esp_dmacb_completed(bus_dmamap_t, void *);
 void esp_dmacb_shutdown(void *);
 
-static void	findchannel_defer(device_t);
+static void findchannel_defer(device_t);
 
 #ifdef ESP_DEBUG
 char esp_dma_dump[5*1024] = "";
@@ -167,18 +167,23 @@ void	esp_dma_stop(struct ncr53c9x_softc 
 int	esp_dma_isactive(struct ncr53c9x_softc *);
 
 struct ncr53c9x_glue esp_glue = {
-	esp_read_reg,
-	esp_write_reg,
-	esp_dma_isintr,
-	esp_dma_reset,
-	esp_dma_intr,
-	esp_dma_setup,
-	esp_dma_go,
-	esp_dma_stop,
-	esp_dma_isactive,
-	NULL,			/* gl_clear_latched_intr */
+	.gl_read_reg = esp_read_reg,
+	.gl_write_reg = esp_write_reg,
+	.gl_dma_isintr = esp_dma_isintr,
+	.gl_dma_reset = esp_dma_reset,
+	.gl_dma_intr = esp_dma_intr,
+	.gl_dma_setup = esp_dma_setup,
+	.gl_dma_go = esp_dma_go,
+	.gl_dma_stop = esp_dma_stop,
+	.gl_dma_isactive = esp_dma_isactive,
+	.gl_clear_latched_intr = NULL
 };
 
+#define nd_bsr4(reg) \
+	bus_space_read_4(nsc->sc_bst, nsc->sc_bsh, (reg))
+#define nd_bsw4(reg, val) \
+	bus_space_write_4(nsc->sc_bst, nsc->sc_bsh, (reg), (val))
+
 #ifdef ESP_DEBUG
 #define XCHR(x) hexdigits[(x) & 0xf]
 static void
@@ -188,18 +193,22 @@ esp_hex_dump(unsigned char *pkt, size_t 
 
 	printf("  ");
 	for(i = 0; i < len; i++) {
-		printf("%c%c ", XCHR(pkt[i]>>4), XCHR(pkt[i]));
+		printf("%c%c ", XCHR(pkt[i] >> 4), XCHR(pkt[i]));
 		if ((i + 1) % 16 == 8) {
 			printf(" ");
 		}
 		if ((i + 1) % 16 == 0) {
 			printf(" %c", '|');
 			for(j = 0; j < 16; j++) {
-printf("%c", pkt[i-15+j]>=32 && pkt[i-15+j]<127?pkt[i-15+j]:'.');
+printf("%c", pkt[i - 15 + j] >= 32 &&
+pkt[i - 15 + j] < 127 ?
+pkt[i - 15 + j] : '.');
 			}
-			printf("%c\n%c%c%c%c%c%c%c%c  ", '|', 
-	XCHR((i+1)>>28),XCHR((i+1)>>24),XCHR((i+1)>>20),XCHR((i+1)>>16),
-	XCHR((i+1)>>12), XCHR((i+1)>>8), XCHR((i+1)>>4), XCHR(i+1));
+			printf("%c\n%c%c%c%c%c%c%c%c  ", '|',
+			XCHR((i + 1) >> 28), XCHR((i + 1) >> 24),
+			XCHR((i + 1) >> 20), XCHR((i + 1) >> 16),
+			XCHR((i + 1) >> 12), XCHR((i + 1) >>  8),
+			XCHR((i + 1) >>  4), XCHR(i + 1));
 		}
 	}
 	printf("\n");
@@ -226,10 +235,10 @@ findchannel_defer(device_t self)
 	struct ncr53c9x_softc *sc = >sc_ncr53c9x;
 	int error;
 
-	if (!esc->sc_dma) {
+	if (esc->sc_dma == NULL) {
 		aprint_normal("%s", device_xname(sc->sc_dev));
 		esc->sc_dma = nextdma_findchannel("scsi");
-		if (!esc->sc_dma)
+		if (esc->sc_dma == NULL)
 			panic("%s: can't find DMA channel",
 			   device_xname(sc->sc_dev));
 	}
@@ -240,23 +249,21 @@ findchannel_defer(device_t self)
 	nextdma_setconf(esc->sc_dma, cb_arg, sc);
 
 	error = bus_dmamap_create(esc->sc_dma->sc_dmat,
-  sc->sc_maxxfer,
-  sc->sc_maxxfer / PAGE_SIZE + 1,
-  sc->sc_maxxfer,
-  0, BUS_DMA_ALLOCNOW, >sc_main_dmamap);
-	if (error) {
+	sc->sc_maxxfer, sc->sc_maxxfer / PAGE_SIZE + 1, sc->sc_maxxfer,
+	0, BUS_DMA_ALLOCNOW, >sc_main_dmamap);
+	if (error != 0) {
 		panic("%s: can't create main i/o DMA map, error = %d",
-		  device_xname(sc->sc_dev), error);
+		device_xname(sc->sc_dev), error);
 	}
 
 	error = bus_dmamap_create(esc->sc_dma->sc_dmat,
-  ESP_DMA_TAILBUFSIZE, 1, ESP_DMA_TAILBUFSIZE,
-  0, BUS_DMA_ALLOCNOW, >sc_tail_dmamap);
-	if (error) {
+	ESP_DMA_TAILBUFSIZE, 1, ESP_DMA_TAILBUFSIZE,
+	0, BUS_DMA_ALLOCNOW, >sc_tail_dmamap);
+	if (error != 0) {
 		panic("%s: can't create tail i/o DMA map, error = %d",
-		  device_xname(sc->sc_dev), error);
+		device_xname(sc->sc_dev), error);
 	}
-	
+
 #if 0
 	/* Turn on target selection using the `DMA' method */
 	sc->sc_features |= NCR_F_DMASELECT;
@@ -273,7 +280,7 @@ findchannel_defer(device_t self)
 
 	

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

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:16:07 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: esp.c espreg.h espvar.h

Log Message:
Misc cleanup.

- use C99 designated initializer
- misc KNF
- TAB/space cleanup


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/next68k/dev/esp.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/next68k/dev/espreg.h
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/next68k/dev/espvar.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/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:13:01 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: intio.c nextcons.c nextdisplay.c
nextdisplayvar.h nextkbd.c
src/sys/arch/next68k/include: bus_space.h
src/sys/arch/next68k/next68k: autoconf.c clock.c disksubr.c locore.s
rtc.c trap.c vectors.s

Log Message:
Misc KNF and cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/next68k/dev/intio.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/next68k/dev/nextcons.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/next68k/dev/nextdisplay.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/next68k/dev/nextdisplayvar.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/next68k/dev/nextkbd.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/next68k/include/bus_space.h
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/next68k/next68k/autoconf.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/next68k/next68k/clock.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/next68k/next68k/disksubr.c
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/next68k/next68k/locore.s
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/next68k/next68k/rtc.c
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/next68k/next68k/trap.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/next68k/next68k/vectors.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/next68k/dev/intio.c
diff -u src/sys/arch/next68k/dev/intio.c:1.16 src/sys/arch/next68k/dev/intio.c:1.17
--- src/sys/arch/next68k/dev/intio.c:1.16	Sat Aug  7 16:19:01 2021
+++ src/sys/arch/next68k/dev/intio.c	Fri Feb  3 23:13:00 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: intio.c,v 1.16 2021/08/07 16:19:01 thorpej Exp $	*/
+/*	$NetBSD: intio.c,v 1.17 2023/02/03 23:13:00 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.16 2021/08/07 16:19:01 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.17 2023/02/03 23:13:00 tsutsui Exp $");
 
 #include 
 #include 
@@ -53,12 +53,6 @@ int	intiosearch(device_t, cfdata_t, cons
 CFATTACH_DECL_NEW(intio, 0,
 intiomatch, intioattach, NULL, NULL);
 
-#if 0
-struct cfdriver intio_cd = {
-	NULL, "intio", DV_DULL
-};
-#endif
-
 static bool intio_attached;
 
 int
@@ -66,9 +60,9 @@ intiomatch(device_t parent, cfdata_t mat
 {
 	/* Allow only one instance. */
 	if (intio_attached)
-		return (0);
+		return 0;
 
-	return (1);
+	return 1;
 }
 
 void
@@ -92,24 +86,24 @@ intioprint(void *aux, const char *pnp)
 	if (ia->ia_addr)
 		aprint_normal(" addr %p", ia->ia_addr);
 
-	return (UNCONF);
+	return UNCONF;
 }
 
 int
 intiosearch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
 {
-	struct mainbus_attach_args *mba = (struct mainbus_attach_args *) aux;
+	struct mainbus_attach_args *mba = aux;
 	struct intio_attach_args ia;
 
 	do {
 		ia.ia_addr = NULL;
 		ia.ia_bst = NEXT68K_INTIO_BUS_SPACE;
 		ia.ia_dmat = mba->mba_dmat;
-		
+
 		if (!config_probe(parent, cf, ))
 			break;
 		config_attach(parent, cf, , intioprint, CFARGS_NONE);
 	} while (cf->cf_fstate == FSTATE_STAR);
 
-	return (0);
+	return 0;
 }

Index: src/sys/arch/next68k/dev/nextcons.c
diff -u src/sys/arch/next68k/dev/nextcons.c:1.11 src/sys/arch/next68k/dev/nextcons.c:1.12
--- src/sys/arch/next68k/dev/nextcons.c:1.11	Sat Apr 24 19:58:13 2010
+++ src/sys/arch/next68k/dev/nextcons.c	Fri Feb  3 23:13:00 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: nextcons.c,v 1.11 2010/04/24 19:58:13 dbj Exp $	*/
+/*	$NetBSD: nextcons.c,v 1.12 2023/02/03 23:13:00 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1999 Darrin B. Jewell
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nextcons.c,v 1.11 2010/04/24 19:58:13 dbj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nextcons.c,v 1.12 2023/02/03 23:13:00 tsutsui Exp $");
 
 #include 
 #include 
@@ -63,11 +63,11 @@ void
 nextcnprobe(struct consdev *cp)
 {
 
-	if ((rom_machine_type == NeXT_WARP9)
-	|| (rom_machine_type == NeXT_X15)
-	|| (rom_machine_type == NeXT_WARP9C)
-	|| (rom_machine_type == NeXT_TURBO_MONO)
-	|| (rom_machine_type == NeXT_TURBO_COLOR))
+	if (rom_machine_type == NeXT_WARP9 ||
+	rom_machine_type == NeXT_X15 ||
+	rom_machine_type == NeXT_WARP9C ||
+	rom_machine_type == NeXT_TURBO_MONO ||
+	rom_machine_type == NeXT_TURBO_COLOR)
 		cp->cn_pri = CN_INTERNAL;
 	else 
 		cp->cn_pri = CN_DEAD;
@@ -78,6 +78,7 @@ nextcnprobe(struct consdev *cp)
 void
 nextcninit(struct consdev *cp)
 {
+
 	nextkbd_cnattach(NEXT68K_INTIO_BUS_SPACE);
 	nextdisplay_cnattach();
 }
@@ -85,17 +86,20 @@ nextcninit(struct consdev *cp)
 int
 nextcngetc (dev_t dev)
 {
+
 	return wskbd_cngetc(dev);
 }
 
 void
 nextcnputc(dev_t dev, int c)
 {
-	wsdisplay_cnputc(dev,c);	
+
+	wsdisplay_cnputc(dev,c);
 }
 
 void
 nextcnpollc(dev_t dev, int on)
 {
+
 	wskbd_cnpollc(dev,on);
 }

Index: src/sys/arch/next68k/dev/nextdisplay.c
diff -u src/sys/arch/next68k/dev/nextdisplay.c:1.25 

CVS commit: src/sys/arch/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:13:01 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: intio.c nextcons.c nextdisplay.c
nextdisplayvar.h nextkbd.c
src/sys/arch/next68k/include: bus_space.h
src/sys/arch/next68k/next68k: autoconf.c clock.c disksubr.c locore.s
rtc.c trap.c vectors.s

Log Message:
Misc KNF and cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/next68k/dev/intio.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/next68k/dev/nextcons.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/next68k/dev/nextdisplay.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/next68k/dev/nextdisplayvar.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/next68k/dev/nextkbd.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/next68k/include/bus_space.h
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/next68k/next68k/autoconf.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/next68k/next68k/clock.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/next68k/next68k/disksubr.c
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/next68k/next68k/locore.s
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/next68k/next68k/rtc.c
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/next68k/next68k/trap.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/next68k/next68k/vectors.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/next68k/conf

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:07:47 UTC 2023

Modified Files:
src/sys/arch/next68k/conf: GENERIC SLAB

Log Message:
Remove trailing TABs.


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/arch/next68k/conf/GENERIC
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/next68k/conf/SLAB

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/next68k/conf/GENERIC
diff -u src/sys/arch/next68k/conf/GENERIC:1.155 src/sys/arch/next68k/conf/GENERIC:1.156
--- src/sys/arch/next68k/conf/GENERIC:1.155	Fri Jan 27 15:36:58 2023
+++ src/sys/arch/next68k/conf/GENERIC	Fri Feb  3 23:07:47 2023
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.155 2023/01/27 15:36:58 tsutsui Exp $
+# $NetBSD: GENERIC,v 1.156 2023/02/03 23:07:47 tsutsui Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/next68k/conf/std.next68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.155 $"
+#ident 		"GENERIC-$Revision: 1.156 $"
 
 makeoptions	COPTS="-O2 -fno-reorder-blocks -fno-unwind-tables -fno-omit-frame-pointer"
 	# See share/mk/sys.mk. -fno-omit-frame-pointer is necessary for
@@ -213,7 +213,7 @@ uk*	at scsibus? target ? lun ?	# SCSI un
 
 
 # Memory-disk drivers
-pseudo-device	md		
+pseudo-device	md
 
 #
 # accept filters

Index: src/sys/arch/next68k/conf/SLAB
diff -u src/sys/arch/next68k/conf/SLAB:1.61 src/sys/arch/next68k/conf/SLAB:1.62
--- src/sys/arch/next68k/conf/SLAB:1.61	Thu Dec 22 11:05:55 2022
+++ src/sys/arch/next68k/conf/SLAB	Fri Feb  3 23:07:47 2023
@@ -1,4 +1,4 @@
-# $NetBSD: SLAB,v 1.61 2022/12/22 11:05:55 nat Exp $
+# $NetBSD: SLAB,v 1.62 2023/02/03 23:07:47 tsutsui Exp $
 #
 # deberg's development machine
 #
@@ -165,7 +165,7 @@ scsibus* at scsi?
 
 
 # Memory-disk drivers
-pseudo-device	md		
+pseudo-device	md
 
 # Misc.
 pseudo-device	loop			# network loopback



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

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:07:47 UTC 2023

Modified Files:
src/sys/arch/next68k/conf: GENERIC SLAB

Log Message:
Remove trailing TABs.


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/arch/next68k/conf/GENERIC
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/next68k/conf/SLAB

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



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

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:06:42 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: nextdma.c nextdmareg.h nextdmavar.h

Log Message:
Misc KNF and cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/next68k/dev/nextdma.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/next68k/dev/nextdmareg.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/next68k/dev/nextdmavar.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/next68k/dev/nextdma.c
diff -u src/sys/arch/next68k/dev/nextdma.c:1.50 src/sys/arch/next68k/dev/nextdma.c:1.51
--- src/sys/arch/next68k/dev/nextdma.c:1.50	Fri Mar 31 08:38:13 2017
+++ src/sys/arch/next68k/dev/nextdma.c	Fri Feb  3 23:06:42 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: nextdma.c,v 1.50 2017/03/31 08:38:13 msaitoh Exp $	*/
+/*	$NetBSD: nextdma.c,v 1.51 2023/02/03 23:06:42 tsutsui Exp $	*/
 /*
  * Copyright (c) 1998 Darrin B. Jewell
  * All rights reserved.
@@ -25,11 +25,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nextdma.c,v 1.50 2017/03/31 08:38:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nextdma.c,v 1.51 2023/02/03 23:06:42 tsutsui Exp $");
 
 #include 
 #include 
-#include  
+#include 
 #include 
 #include 
 #include 
@@ -168,14 +168,32 @@ CFATTACH_DECL_NEW(nextdma, sizeof(struct
 
 static struct nextdma_channel nextdma_channel[] = {
 #if NESP > 0
-	{ "scsi", NEXT_P_SCSI_CSR, DD_SIZE, NEXT_I_SCSI_DMA, _esp_intr },
+	{
+		"scsi",
+		NEXT_P_SCSI_CSR,
+		DD_SIZE,
+		NEXT_I_SCSI_DMA,
+		_esp_intr
+	},
 #endif
 #if NXE > 0
-	{ "enetx", NEXT_P_ENETX_CSR, DD_SIZE, NEXT_I_ENETX_DMA, _enet_intr },
-	{ "enetr", NEXT_P_ENETR_CSR, DD_SIZE, NEXT_I_ENETR_DMA, _enet_intr },
+	{
+		"enetx",
+		NEXT_P_ENETX_CSR,
+		DD_SIZE,
+		NEXT_I_ENETX_DMA,
+		_enet_intr
+	},
+	{
+		"enetr",
+		NEXT_P_ENETR_CSR,
+		DD_SIZE,
+		NEXT_I_ENETR_DMA,
+		_enet_intr
+	},
 #endif
 };
-static int nnextdma_channels = (sizeof(nextdma_channel)/sizeof(nextdma_channel[0]));
+static int nnextdma_channels = __arraycount(nextdma_channel);
 
 static int attached = 0;
 
@@ -206,11 +224,11 @@ nextdma_match(device_t parent, cfdata_t 
 	struct intio_attach_args *ia = (struct intio_attach_args *)aux;
 
 	if (attached >= nnextdma_channels)
-		return (0);
+		return 0;
 
 	ia->ia_addr = (void *)nextdma_channel[attached].nd_base;
 
-	return (1);
+	return 1;
 }
 
 void
@@ -229,22 +247,20 @@ nextdma_attach(device_t parent, device_t
 	nsc->sc_bst = ia->ia_bst;
 
 	if (bus_space_map(nsc->sc_bst, nsc->sc_chan->nd_base,
-			  nsc->sc_chan->nd_size, 0, >sc_bsh)) {
+	nsc->sc_chan->nd_size, 0, >sc_bsh)) {
 		panic("%s: can't map DMA registers for channel %s",
-		  device_xname(self), nsc->sc_chan->nd_name);
+		device_xname(self), nsc->sc_chan->nd_name);
 	}
 
-	nextdma_init (nsc);
+	nextdma_init(nsc);
 
 	isrlink_autovec(nsc->sc_chan->nd_intrfunc, nsc,
-			NEXT_I_IPL(nsc->sc_chan->nd_intr), 10, NULL);
+	NEXT_I_IPL(nsc->sc_chan->nd_intr), 10, NULL);
 	INTR_ENABLE(nsc->sc_chan->nd_intr);
 
-	printf (": channel %d (%s)\n", attached, 
+	printf(": channel %d (%s)\n", attached,
 		nsc->sc_chan->nd_name);
 	attached++;
-
-	return;
 }
 
 void
@@ -257,7 +273,7 @@ nextdma_init(struct nextdma_softc *nsc)
 		snprintb(sbuf, sizeof(sbuf), NEXT_INTR_BITS,
 		NEXT_I_BIT(nsc->sc_chan->nd_intr));
 		printf("DMA init ipl (%ld) intr(%s)\n",
-			NEXT_I_IPL(nsc->sc_chan->nd_intr), sbuf);
+		NEXT_I_IPL(nsc->sc_chan->nd_intr), sbuf);
 	}
 #endif
 
@@ -267,8 +283,8 @@ nextdma_init(struct nextdma_softc *nsc)
 	nsc->sc_stat.nd_idx_cont = 0;
 	nsc->sc_stat.nd_exception = 0;
 
-	nd_bsw4 (DD_CSR, DMACSR_RESET | DMACSR_CLRCOMPLETE);
-	nd_bsw4 (DD_CSR, 0);
+	nd_bsw4(DD_CSR, DMACSR_RESET | DMACSR_CLRCOMPLETE);
+	nd_bsw4(DD_CSR, 0);
 
 #if 01
 	nextdma_setup_curr_regs(nsc);
@@ -287,10 +303,10 @@ nextdma_init(struct nextdma_softc *nsc)
 		 */
 		state &= (DMACSR_COMPLETE | DMACSR_SUPDATE | DMACSR_ENABLE);
 #else
-		state &= (DMACSR_BUSEXC | DMACSR_COMPLETE | 
+		state &= (DMACSR_BUSEXC | DMACSR_COMPLETE |
 			  DMACSR_SUPDATE | DMACSR_ENABLE);
 #endif
-		if (state) {
+		if (state != 0) {
 			nextdma_print(nsc);
 			panic("DMA did not reset");
 		}
@@ -309,17 +325,19 @@ nextdma_reset(struct nextdma_softc *nsc)
 	DPRINTF(("DMA reset\n"));
 
 #if (defined(ND_DEBUG))
-	if (NEXTDMA_DEBUG > 1) nextdma_print(nsc);
+	if (NEXTDMA_DEBUG > 1)
+		nextdma_print(nsc);
 #endif
 
-	nd_bsw4 (DD_CSR, DMACSR_CLRCOMPLETE | DMACSR_RESET);
+	nd_bsw4(DD_CSR, DMACSR_CLRCOMPLETE | DMACSR_RESET);
 	if ((stat->nd_map) || (stat->nd_map_cont)) {
 		if (stat->nd_map_cont) {
-			DPRINTF(("DMA: resetting with non null continue map\n"));
-			if (nsc->sc_conf.nd_completed_cb) 
-(*nsc->sc_conf.nd_completed_cb)
-	(stat->nd_map_cont, nsc->sc_conf.nd_cb_arg);
-			
+			DPRINTF(
+			("DMA: resetting with non null continue map\n"));
+			if (nsc->sc_conf.nd_completed_cb)
+(*nsc->sc_conf.nd_completed_cb)(
+

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

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:06:42 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: nextdma.c nextdmareg.h nextdmavar.h

Log Message:
Misc KNF and cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/next68k/dev/nextdma.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/next68k/dev/nextdmareg.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/next68k/dev/nextdmavar.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/next68k/dev

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:04:36 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: mb8795var.h

Log Message:
Use proper C99 int types.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/next68k/dev/mb8795var.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/next68k/dev/mb8795var.h
diff -u src/sys/arch/next68k/dev/mb8795var.h:1.15 src/sys/arch/next68k/dev/mb8795var.h:1.16
--- src/sys/arch/next68k/dev/mb8795var.h:1.15	Mon Apr 13 21:18:42 2015
+++ src/sys/arch/next68k/dev/mb8795var.h	Fri Feb  3 23:04:35 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mb8795var.h,v 1.15 2015/04/13 21:18:42 riastradh Exp $	*/
+/*	$NetBSD: mb8795var.h,v 1.16 2023/02/03 23:04:35 tsutsui Exp $	*/
 /*
  * Copyright (c) 1998 Darrin B. Jewell
  * All rights reserved.
@@ -62,7 +62,7 @@ struct mb8795_softc {
 
 	bus_space_handle_t sc_bmap_bsh; /* bus space handle */
 
-	u_int8_t sc_enaddr[6];
+	uint8_t sc_enaddr[6];
 
 	struct ifaltq sc_tx_snd;
 



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

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:04:36 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: mb8795var.h

Log Message:
Use proper C99 int types.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/next68k/dev/mb8795var.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/next68k/dev

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:02:56 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: if_xe.c

Log Message:
TAB/space cleanup.


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

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:02:56 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: if_xe.c

Log Message:
TAB/space cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/next68k/dev/if_xe.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/next68k/dev/if_xe.c
diff -u src/sys/arch/next68k/dev/if_xe.c:1.27 src/sys/arch/next68k/dev/if_xe.c:1.28
--- src/sys/arch/next68k/dev/if_xe.c:1.27	Sat Nov 21 17:49:20 2020
+++ src/sys/arch/next68k/dev/if_xe.c	Fri Feb  3 23:02:56 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_xe.c,v 1.27 2020/11/21 17:49:20 thorpej Exp $	*/
+/*	$NetBSD: if_xe.c,v 1.28 2023/02/03 23:02:56 tsutsui Exp $	*/
 /*
  * Copyright (c) 1998 Darrin B. Jewell
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xe.c,v 1.27 2020/11/21 17:49:20 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xe.c,v 1.28 2023/02/03 23:02:56 tsutsui Exp $");
 
 #include "opt_inet.h"
 
@@ -202,16 +202,17 @@ findchannel_defer(device_t self)
 	xsc->sc_rx_completed_idx = 0;
 	xsc->sc_rx_handled_idx = 0;
 
-	/* @@@ more next hacks 
+	/*
+	 * @@@ more next hacks
 	 * the  2000 covers at least a 1500 mtu + headers
 	 * + DMA_BEGINALIGNMENT+ DMA_ENDALIGNMENT
 	 */
 	xsc->sc_txbuf = kmem_alloc(2000, KM_SLEEP);
 	xsc->sc_tx_mb_head = NULL;
 	xsc->sc_tx_loaded = 0;
-	
+
 	mb8795_config(sc, xe_dma_medias, nxe_dma_medias, xe_dma_medias[0]);
-	
+
 	isrlink_autovec(xe_tint, sc, NEXT_I_IPL(NEXT_I_ENETX), 1, NULL);
 	INTR_ENABLE(NEXT_I_ENETX);
 	isrlink_autovec(xe_rint, sc, NEXT_I_IPL(NEXT_I_ENETR), 1, NULL);
@@ -312,7 +313,7 @@ xe_dma_reset(struct mb8795_softc *sc)
 	int i;
 
 	DPRINTF(("xe DMA reset\n"));
-	
+
 	nextdma_reset(xsc->sc_rxdma);
 	nextdma_reset(xsc->sc_txdma);
 
@@ -346,7 +347,7 @@ xe_dma_rx_setup(struct mb8795_softc *sc)
 	DPRINTF(("xe DMA rx setup\n"));
 
 	for(i = 0; i < MB8795_NRXBUFS; i++)
-		xsc->sc_rx_mb_head[i] = 
+		xsc->sc_rx_mb_head[i] =
 			xe_dma_rxmap_load(sc, xsc->sc_rx_dmamap[i]);
 
 	xsc->sc_rx_loaded_idx = 0;
@@ -380,17 +381,17 @@ xe_dma_rx_mbuf(struct mb8795_softc *sc)
 
 		map = xsc->sc_rx_dmamap[xsc->sc_rx_handled_idx];
 		m = xsc->sc_rx_mb_head[xsc->sc_rx_handled_idx];
-		
+
 		m->m_len = map->dm_xfer_len;
 
 		bus_dmamap_sync(xsc->sc_rxdma->sc_dmat, map,
 0, map->dm_mapsize, BUS_DMASYNC_POSTREAD);
-		
+
 		bus_dmamap_unload(xsc->sc_rxdma->sc_dmat, map);
-		
+
 		/* Install a fresh mbuf for next packet */
-		
-		xsc->sc_rx_mb_head[xsc->sc_rx_handled_idx] = 
+
+		xsc->sc_rx_mb_head[xsc->sc_rx_handled_idx] =
 			xe_dma_rxmap_load(sc,map);
 
 		/* Punt runt packets
@@ -467,7 +468,7 @@ xe_dma_tx_mbuf(struct mb8795_softc *sc, 
 buflen = ETHER_MIN_LEN - ETHER_CRC_LEN;
 			}
 		}
-		
+
 		error = bus_dmamap_load(xsc->sc_txdma->sc_dmat,
 		xsc->sc_tx_dmamap, buf, buflen, NULL, BUS_DMA_NOWAIT);
 	}
@@ -503,7 +504,7 @@ xe_dma_tx_isactive(struct mb8795_softc *
 
 //
 
-void 
+void
 xe_dma_tx_completed(bus_dmamap_t map, void *arg)
 {
 #if defined (XE_DEBUG) || defined (DIAGNOSTIC)
@@ -527,7 +528,7 @@ xe_dma_tx_completed(bus_dmamap_t map, vo
 #endif
 }
 
-void 
+void
 xe_dma_tx_shutdown(void *arg)
 {
 	struct mb8795_softc *sc = arg;
@@ -550,7 +551,7 @@ xe_dma_tx_shutdown(void *arg)
 		bus_dmamap_unload(xsc->sc_txdma->sc_dmat, xsc->sc_tx_dmamap);
 		m_freem(xsc->sc_tx_mb_head);
 		xsc->sc_tx_mb_head = NULL;
-		
+
 		xsc->sc_tx_loaded--;
 	}
 
@@ -571,14 +572,14 @@ xe_dma_tx_shutdown(void *arg)
 
 #if 0
 	/* Enable ready interrupt */
-	MB_WRITE_REG(sc, MB8795_TXMASK, 
+	MB_WRITE_REG(sc, MB8795_TXMASK,
 		 MB_READ_REG(sc, MB8795_TXMASK)
 		 | MB8795_TXMASK_TXRXIE/* READYIE */);
 #endif
 }
 
 
-void 
+void
 xe_dma_rx_completed(bus_dmamap_t map, void *arg)
 {
 	struct mb8795_softc *sc = arg;
@@ -588,11 +589,11 @@ xe_dma_rx_completed(bus_dmamap_t map, vo
 	if (ifp->if_flags & IFF_RUNNING) {
 		xsc->sc_rx_completed_idx++;
 		xsc->sc_rx_completed_idx %= MB8795_NRXBUFS;
-		
+
 		DPRINTF(("%s: xe_dma_rx_completed(), "
 			"sc->sc_rx_completed_idx = %d\n",
 			 device_xname(sc->sc_dev), xsc->sc_rx_completed_idx));
-		
+
 #if (defined(DIAGNOSTIC))
 		if (map != xsc->sc_rx_dmamap[xsc->sc_rx_completed_idx])
 			panic("%s: Unexpected rx dmamap completed",
@@ -606,7 +607,7 @@ xe_dma_rx_completed(bus_dmamap_t map, vo
 #endif
 }
 
-void 
+void
 xe_dma_rx_shutdown(void *arg)
 {
 	struct mb8795_softc *sc = arg;
@@ -616,7 +617,7 @@ xe_dma_rx_shutdown(void *arg)
 	if (ifp->if_flags & IFF_RUNNING) {
 		DPRINTF(("%s: xe_dma_rx_shutdown(), restarting.\n",
 			 device_xname(sc->sc_dev)));
-		
+
 		nextdma_start(xsc->sc_rxdma, DMACSR_SETREAD);
 		if (turbo)
 			MB_WRITE_REG(sc, MB8795_RXMODE,
@@ -659,7 +660,7 @@ xe_dma_rxmap_load(struct mb8795_softc *s
 
 	/*
 	 * Align buffer, @@@ next specific.
-	 * perhaps should be using M_ALIGN here 

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

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:00:33 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: mb8795.c

Log Message:
Add proper rnd_add_uint32(9) calls to next68k xe(4) driver.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/next68k/dev/mb8795.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/next68k/dev

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:00:33 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: mb8795.c

Log Message:
Add proper rnd_add_uint32(9) calls to next68k xe(4) driver.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/next68k/dev/mb8795.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/next68k/dev/mb8795.c
diff -u src/sys/arch/next68k/dev/mb8795.c:1.69 src/sys/arch/next68k/dev/mb8795.c:1.70
--- src/sys/arch/next68k/dev/mb8795.c:1.69	Sun Sep 18 13:00:18 2022
+++ src/sys/arch/next68k/dev/mb8795.c	Fri Feb  3 23:00:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mb8795.c,v 1.69 2022/09/18 13:00:18 thorpej Exp $	*/
+/*	$NetBSD: mb8795.c,v 1.70 2023/02/03 23:00:33 tsutsui Exp $	*/
 /*
  * Copyright (c) 1998 Darrin B. Jewell
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.69 2022/09/18 13:00:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.70 2023/02/03 23:00:33 tsutsui Exp $");
 
 #include "opt_inet.h"
 
@@ -348,6 +348,7 @@ mb8795_rint(struct mb8795_softc *sc)
 		printf("rxmode = %s\n", sbuf);
 	}
 #endif
+	rnd_add_uint32(>rnd_source, rxstat);
 
 	return;
 }
@@ -380,7 +381,7 @@ mb8795_tint(struct mb8795_softc *sc)
 			/* printf ("Z"); */
 			mb8795_start_dma(sc);
 		}
-		return;
+		goto out;
 	}
 
 	if (txstat & MB8795_TXSTAT_SHORTED) {
@@ -414,6 +415,8 @@ mb8795_tint(struct mb8795_softc *sc)
 		txmask & ~MB8795_TXMASK_READYIE);
 	}
 #endif
+ out:
+	rnd_add_uint32(>rnd_source, txstat);
 
 	return;
 }



CVS commit: src/sys/arch/next68k/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 22:57:05 UTC 2023

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

Log Message:
Use explicit CPU strings and remove hp300 derived stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/next68k/next68k/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/next68k/next68k/machdep.c
diff -u src/sys/arch/next68k/next68k/machdep.c:1.117 src/sys/arch/next68k/next68k/machdep.c:1.118
--- src/sys/arch/next68k/next68k/machdep.c:1.117	Fri Jan 27 15:21:52 2023
+++ src/sys/arch/next68k/next68k/machdep.c	Fri Feb  3 22:57:05 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.117 2023/01/27 15:21:52 tsutsui Exp $	*/
+/*	$NetBSD: machdep.c,v 1.118 2023/02/03 22:57:05 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1998 Darrin B. Jewell
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.117 2023/01/27 15:21:52 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.118 2023/02/03 22:57:05 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -321,7 +321,7 @@ cpu_startup(void)
 void
 identifycpu(void)
 {
-	const char *mc, *mmu_str, *fpu_str, *cache_str;
+	const char *cpu_str, *mmu_str, *fpu_str, *cache_str;
 	extern int turbo;
 
 	/*
@@ -329,21 +329,23 @@ identifycpu(void)
 	 */
 	switch (cputype) {
 	case CPU_68040:
-		mc = "40";
+		cpu_str = "MC68040";
 		cpuspeed = turbo ? 33 : 25;
 		delay_divisor = 759 / cpuspeed;
 		break;
 	case CPU_68030:
-		mc = "30";
+		cpu_str = "MC68030";
 		cpuspeed = 25;
 		delay_divisor = 2048 / cpuspeed;
 		break;
+#if 0
 	case CPU_68020:
-		mc = "20";
+		cpu_str = "MC68020";
 		break;
+#endif
 	default:
 		printf("\nunknown cputype %d\n", cputype);
-		goto lose;
+		panic("startup");
 	}
 
 	/*
@@ -354,14 +356,13 @@ identifycpu(void)
 	case MMU_68030:
 		mmu_str = "+MMU";
 		break;
+#if 0
 	case MMU_68851:
 		mmu_str = ", MC68851 MMU";
 		break;
-	case MMU_HP:
-		mmu_str = ", HP MMU";
-		break;
+#endif
 	default:
-		printf("MC680%s: unknown MMU type %d\n", mc, mmutype);
+		printf("%s: unknown MMU type %d\n", cpu_str, mmutype);
 		panic("startup");
 	}
 
@@ -376,7 +377,7 @@ identifycpu(void)
 		fpu_str = ", MC68882 FPU";
 		break;
 	case FPU_68881:
-		fpu_str = ", MHz MC68881 FPU";
+		fpu_str = ", MC68881 FPU";
 		break;
 	default:
 		fpu_str = ", unknown FPU";
@@ -387,30 +388,11 @@ identifycpu(void)
 	 */
 	if (cputype == CPU_68040)
 		cache_str = ", 4k on-chip physical I/D caches";
-	else {
-#if defined(ENABLE_HP_CODE)
-		switch (ectype) {
-		case EC_VIRT:
-			cache_str = ", virtual-address cache";
-			break;
-		case EC_PHYS:
-			cache_str = ", physical-address cache";
-			break;
-		default:
-			cache_str = "";
-			break;
-		}
-#else
+	else
 		cache_str = "";
-#endif
-	}
 
-	cpu_setmodel("NeXT/MC680%s CPU%s%s%s", mc, mmu_str, fpu_str, cache_str);
+	cpu_setmodel("NeXT/%s CPU%s%s%s", cpu_str, mmu_str, fpu_str, cache_str);
 	printf("%s\n", cpu_getmodel());
-
-	return;
- lose:
-	panic("startup");
 }
 
 /*



CVS commit: src/sys/arch/next68k/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 22:57:05 UTC 2023

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

Log Message:
Use explicit CPU strings and remove hp300 derived stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/next68k/next68k/machdep.c

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



CVS commit: src/lib/libedit

2023-02-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb  3 22:01:43 UTC 2023

Modified Files:
src/lib/libedit: filecomplete.c histedit.h

Log Message:
Add a entry point for the complete function for FreeBSD compatibility with sh.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/lib/libedit/filecomplete.c
cvs rdiff -u -r1.61 -r1.62 src/lib/libedit/histedit.h

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



CVS commit: src/lib/libedit

2023-02-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb  3 22:01:43 UTC 2023

Modified Files:
src/lib/libedit: filecomplete.c histedit.h

Log Message:
Add a entry point for the complete function for FreeBSD compatibility with sh.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/lib/libedit/filecomplete.c
cvs rdiff -u -r1.61 -r1.62 src/lib/libedit/histedit.h

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

Modified files:

Index: src/lib/libedit/filecomplete.c
diff -u src/lib/libedit/filecomplete.c:1.71 src/lib/libedit/filecomplete.c:1.72
--- src/lib/libedit/filecomplete.c:1.71	Sun Oct 30 15:11:31 2022
+++ src/lib/libedit/filecomplete.c	Fri Feb  3 17:01:42 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: filecomplete.c,v 1.71 2022/10/30 19:11:31 christos Exp $	*/
+/*	$NetBSD: filecomplete.c,v 1.72 2023/02/03 22:01:42 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: filecomplete.c,v 1.71 2022/10/30 19:11:31 christos Exp $");
+__RCSID("$NetBSD: filecomplete.c,v 1.72 2023/02/03 22:01:42 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include 
@@ -851,3 +851,13 @@ _el_fn_complete(EditLine *el, int ch __a
 	break_chars, NULL, NULL, (size_t)100,
 	NULL, NULL, NULL, NULL);
 }
+
+/*
+ * el-compatible wrapper around rl_complete; needed for key binding
+ */
+/* ARGSUSED */
+unsigned char
+_el_fn_sh_complete(EditLine *el, int ch)
+{
+	return _el_fn_complete(el, ch);
+}

Index: src/lib/libedit/histedit.h
diff -u src/lib/libedit/histedit.h:1.61 src/lib/libedit/histedit.h:1.62
--- src/lib/libedit/histedit.h:1.61	Tue Feb  8 16:13:22 2022
+++ src/lib/libedit/histedit.h	Fri Feb  3 17:01:42 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: histedit.h,v 1.61 2022/02/08 21:13:22 rillig Exp $	*/
+/*	$NetBSD: histedit.h,v 1.62 2023/02/03 22:01:42 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -113,6 +113,7 @@ int		 el_parse(EditLine *, int, const ch
 int		 el_set(EditLine *, int, ...);
 int		 el_get(EditLine *, int, ...);
 unsigned char	_el_fn_complete(EditLine *, int);
+unsigned char	_el_fn_sh_complete(EditLine *, int);
 
 /*
  * el_set/el_get parameters



CVS commit: src/etc/iscsi

2023-02-03 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Feb  3 20:16:03 UTC 2023

Added Files:
src/etc/iscsi: volumes

Log Message:
Add missing template file for iscsid_volumes.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/etc/iscsi/volumes

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



CVS commit: src/etc/iscsi

2023-02-03 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Feb  3 20:16:03 UTC 2023

Added Files:
src/etc/iscsi: volumes

Log Message:
Add missing template file for iscsid_volumes.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/etc/iscsi/volumes

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

Added files:

Index: src/etc/iscsi/volumes
diff -u /dev/null src/etc/iscsi/volumes:1.1
--- /dev/null	Fri Feb  3 20:16:03 2023
+++ src/etc/iscsi/volumes	Fri Feb  3 20:16:03 2023
@@ -0,0 +1,17 @@
+# $NetBSD: volumes,v 1.1 2023/02/03 20:16:03 mlelstv Exp $
+#
+# Each line has 5 or 6 fields separated by white space
+# Comment lines start with #
+#
+# Host - the iSCSI server name, optionally followed by :port number
+# Target - the iSCSI IQN target name
+# Digest - '-' (none), 'd' (data CRC), 'h' (header CRC), 'dh' (both)
+# Auth - '-' (none), 'c' (CHAP), 'C' (mutual CHAP)
+# User - name of user from /etc/iscsi/auths
+# Alias - optional, another name for the target
+#
+# for mutual CHAP, the target name is used to lookup the secret from
+# /etc/iscsi/auths
+#
+#
+# Host   Target Digest Auth User   Alias



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

2023-02-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb  3 20:07:35 UTC 2023

Removed Files:
src/external/bsd/file/dist: configure~

Log Message:
remove trash (pointed out by des @ freebsd)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r0 src/external/bsd/file/dist/configure~

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



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

2023-02-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb  3 20:07:35 UTC 2023

Removed Files:
src/external/bsd/file/dist: configure~

Log Message:
remove trash (pointed out by des @ freebsd)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r0 src/external/bsd/file/dist/configure~

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



CVS commit: src/lib/libedit

2023-02-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb  3 19:47:39 UTC 2023

Modified Files:
src/lib/libedit: sig.c

Log Message:
Don't clear the handle to el "sel" and set it earlier to prevent handling
a signal before the handle is set. (From: des at FreeBSD)


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/lib/libedit/sig.c

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

Modified files:

Index: src/lib/libedit/sig.c
diff -u src/lib/libedit/sig.c:1.26 src/lib/libedit/sig.c:1.27
--- src/lib/libedit/sig.c:1.26	Mon May  9 17:46:56 2016
+++ src/lib/libedit/sig.c	Fri Feb  3 14:47:38 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: sig.c,v 1.26 2016/05/09 21:46:56 christos Exp $	*/
+/*	$NetBSD: sig.c,v 1.27 2023/02/03 19:47:38 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)sig.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: sig.c,v 1.26 2016/05/09 21:46:56 christos Exp $");
+__RCSID("$NetBSD: sig.c,v 1.27 2023/02/03 19:47:38 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -170,6 +170,7 @@ sig_set(EditLine *el)
 	nsa.sa_flags = 0;
 	sigemptyset(_mask);
 
+	sel = el;
 	(void) sigprocmask(SIG_BLOCK, >el_signal->sig_set, );
 
 	for (i = 0; sighdl[i] != -1; i++) {
@@ -178,7 +179,6 @@ sig_set(EditLine *el)
 		osa.sa_handler != sig_handler)
 			el->el_signal->sig_action[i] = osa;
 	}
-	sel = el;
 	(void) sigprocmask(SIG_SETMASK, , NULL);
 }
 
@@ -199,7 +199,5 @@ sig_clr(EditLine *el)
 			(void)sigaction(sighdl[i],
 			>el_signal->sig_action[i], NULL);
 
-	sel = NULL;		/* we are going to die if the handler is
- * called */
 	(void)sigprocmask(SIG_SETMASK, , NULL);
 }



CVS commit: src/lib/libedit

2023-02-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb  3 19:47:39 UTC 2023

Modified Files:
src/lib/libedit: sig.c

Log Message:
Don't clear the handle to el "sel" and set it earlier to prevent handling
a signal before the handle is set. (From: des at FreeBSD)


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/lib/libedit/sig.c

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



CVS commit: src/sys/external/bsd/ipf/netinet

2023-02-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb  3 19:01:08 UTC 2023

Modified Files:
src/sys/external/bsd/ipf/netinet: fil.c

Log Message:
Fix use after free on packet with broken lengths

Under the scenario with a packet with length of 67 bytes, a header length
using the default of 20 bytes and a TCP data offset (th_off) of 48 will
cause m_pullup() to fail to make sure bytes are arranged contiguously.
m_pullup() will free the mbuf chain and return a null. ipfilter stores
the resultant mbuf address (or the resulting NULL) in its fr_info_t
structure. Unfortunately the erroneous packet is not flagged for drop.
>From FreeBSD via CY Schubert; originally reported by: Robert Morris



To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/external/bsd/ipf/netinet/fil.c

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

Modified files:

Index: src/sys/external/bsd/ipf/netinet/fil.c
diff -u src/sys/external/bsd/ipf/netinet/fil.c:1.35 src/sys/external/bsd/ipf/netinet/fil.c:1.36
--- src/sys/external/bsd/ipf/netinet/fil.c:1.35	Sun Dec  5 02:28:20 2021
+++ src/sys/external/bsd/ipf/netinet/fil.c	Fri Feb  3 14:01:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: fil.c,v 1.35 2021/12/05 07:28:20 msaitoh Exp $	*/
+/*	$NetBSD: fil.c,v 1.36 2023/02/03 19:01:08 christos Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -141,7 +141,7 @@ extern struct timeout ipf_slowtimer_ch;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.35 2021/12/05 07:28:20 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.36 2023/02/03 19:01:08 christos Exp $");
 #else
 static const char sccsid[] = "@(#)fil.c	1.36 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: fil.c,v 1.1.1.2 2012/07/22 13:45:07 darrenr Exp $";
@@ -1142,8 +1142,10 @@ ipf_pr_pullup(fr_info_t *fin, int plen)
 		if (M_LEN(fin->fin_m) < plen + fin->fin_ipoff) {
 #if defined(_KERNEL)
 			if (ipf_pullup(fin->fin_m, fin, plen) == NULL) {
-DT(ipf_pullup_fail);
+DT1(ipf_pullup_fail, fr_info_t *, fin);
 LBUMP(ipf_stats[fin->fin_out].fr_pull[1]);
+fin->fin_reason = FRB_PULLUP;
+fin->fin_flx |= FI_BAD;
 return -1;
 			}
 			LBUMP(ipf_stats[fin->fin_out].fr_pull[0]);
@@ -1156,6 +1158,7 @@ ipf_pr_pullup(fr_info_t *fin, int plen)
 			*fin->fin_mp = NULL;
 			fin->fin_m = NULL;
 			fin->fin_ip = NULL;
+			fin->fin_flx |= FI_BAD;
 			return -1;
 #endif
 		}
@@ -3214,6 +3217,13 @@ finished:
 
 	SPL_X(s);
 
+	if (fin->fin_m == NULL && fin->fin_flx & FI_BAD &&
+	fin->fin_reason == FRB_PULLUP) {
+		/* m_pullup() has freed the mbuf */
+		LBUMP(ipf_stats[out].fr_blocked[fin->fin_reason]);
+		return (-1);
+	}
+
 #ifdef _KERNEL
 	if (FR_ISPASS(pass))
 		return 0;



CVS commit: src/sys/external/bsd/ipf/netinet

2023-02-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb  3 19:01:08 UTC 2023

Modified Files:
src/sys/external/bsd/ipf/netinet: fil.c

Log Message:
Fix use after free on packet with broken lengths

Under the scenario with a packet with length of 67 bytes, a header length
using the default of 20 bytes and a TCP data offset (th_off) of 48 will
cause m_pullup() to fail to make sure bytes are arranged contiguously.
m_pullup() will free the mbuf chain and return a null. ipfilter stores
the resultant mbuf address (or the resulting NULL) in its fr_info_t
structure. Unfortunately the erroneous packet is not flagged for drop.
>From FreeBSD via CY Schubert; originally reported by: Robert Morris



To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/external/bsd/ipf/netinet/fil.c

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



CVS commit: src/etc/iscsi

2023-02-03 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Feb  3 15:59:04 UTC 2023

Modified Files:
src/etc/iscsi: Makefile

Log Message:
missed commit for iscsid_volumes


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/etc/iscsi/Makefile

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

Modified files:

Index: src/etc/iscsi/Makefile
diff -u src/etc/iscsi/Makefile:1.4 src/etc/iscsi/Makefile:1.5
--- src/etc/iscsi/Makefile:1.4	Tue Aug 30 13:40:37 2022
+++ src/etc/iscsi/Makefile	Fri Feb  3 15:59:04 2023
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.4 2022/08/30 13:40:37 riastradh Exp $
+#	$NetBSD: Makefile,v 1.5 2023/02/03 15:59:04 mlelstv Exp $
 
 .include 
 
 .if ${MKISCSI} != "no"
 
-CONFIGFILES=	auths targets
+CONFIGFILES=	auths targets volumes
 FILESDIR=   	/etc/iscsi
 FILESMODE_auths=	0600
 FILESMODE_targets=	0644



CVS commit: src/etc/iscsi

2023-02-03 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Feb  3 15:59:04 UTC 2023

Modified Files:
src/etc/iscsi: Makefile

Log Message:
missed commit for iscsid_volumes


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/etc/iscsi/Makefile

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



CVS commit: src

2023-02-03 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Feb  3 13:53:40 UTC 2023

Modified Files:
src/distrib/sets/lists/etc: mi
src/etc/defaults: rc.conf
src/etc/rc.d: Makefile
Added Files:
src/etc/rc.d: iscsid_volumes

Log Message:
Add start script to attach iscsi volumes at boot.

The default is to execute the script (iscsid_volumes=YES), so if you have
any volumes defined, you should also start iscsid (iscsid=YES) to avoid
error messages.


To generate a diff of this commit:
cvs rdiff -u -r1.270 -r1.271 src/distrib/sets/lists/etc/mi
cvs rdiff -u -r1.162 -r1.163 src/etc/defaults/rc.conf
cvs rdiff -u -r1.116 -r1.117 src/etc/rc.d/Makefile
cvs rdiff -u -r0 -r1.1 src/etc/rc.d/iscsid_volumes

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



CVS commit: src

2023-02-03 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Feb  3 13:53:40 UTC 2023

Modified Files:
src/distrib/sets/lists/etc: mi
src/etc/defaults: rc.conf
src/etc/rc.d: Makefile
Added Files:
src/etc/rc.d: iscsid_volumes

Log Message:
Add start script to attach iscsi volumes at boot.

The default is to execute the script (iscsid_volumes=YES), so if you have
any volumes defined, you should also start iscsid (iscsid=YES) to avoid
error messages.


To generate a diff of this commit:
cvs rdiff -u -r1.270 -r1.271 src/distrib/sets/lists/etc/mi
cvs rdiff -u -r1.162 -r1.163 src/etc/defaults/rc.conf
cvs rdiff -u -r1.116 -r1.117 src/etc/rc.d/Makefile
cvs rdiff -u -r0 -r1.1 src/etc/rc.d/iscsid_volumes

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

Modified files:

Index: src/distrib/sets/lists/etc/mi
diff -u src/distrib/sets/lists/etc/mi:1.270 src/distrib/sets/lists/etc/mi:1.271
--- src/distrib/sets/lists/etc/mi:1.270	Mon Jun  6 10:56:27 2022
+++ src/distrib/sets/lists/etc/mi	Fri Feb  3 13:53:40 2023
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.270 2022/06/06 10:56:27 nia Exp $
+# $NetBSD: mi,v 1.271 2023/02/03 13:53:40 mlelstv Exp $
 #
 # Note: end-user configuration files that are moved to another location
 #	should not be marked "obsolete"; they should just be removed from
@@ -83,6 +83,7 @@
 ./etc/inetd.confetc-netutil-etc
 ./etc/iscsi/authsetc-iscsi-etc		iscsi
 ./etc/iscsi/targetsetc-iscsi-etc		iscsi
+./etc/iscsi/volumesetc-iscsi-etc
 ./etc/kyua/kyua.confetc-kyua-etc		kyua
 ./etc/lkm.conf	etc-obsolete		obsolete
 ./etc/localtime	etc-sys-etc
@@ -238,6 +239,7 @@
 ./etc/rc.d/irdaattachetc-sys-rc
 ./etc/rc.d/iscsi_targetetc-iscsi-rc
 ./etc/rc.d/iscsidetc-iscsi-rc
+./etc/rc.d/iscsid_volumes			etc-iscsi-rc
 ./etc/rc.d/isdndetc-obsolete		obsolete
 ./etc/rc.d/isibootdetc-bootserver-rc
 ./etc/rc.d/kdc	etc-krb5-rc

Index: src/etc/defaults/rc.conf
diff -u src/etc/defaults/rc.conf:1.162 src/etc/defaults/rc.conf:1.163
--- src/etc/defaults/rc.conf:1.162	Sun Feb 20 14:42:07 2022
+++ src/etc/defaults/rc.conf	Fri Feb  3 13:53:40 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: rc.conf,v 1.162 2022/02/20 14:42:07 alnsn Exp $
+#	$NetBSD: rc.conf,v 1.163 2023/02/03 13:53:40 mlelstv Exp $
 #
 # /etc/defaults/rc.conf --
 #	default configuration of /etc/rc.conf
@@ -317,6 +317,8 @@ kdc=NO			kdc_flags="--detach"
 iscsi_target=NO		iscsi_target_flags=""
 # iSCSI kernel initiator
 iscsid=NO
+# iSCSI attach from /etc/iscsi/volumes
+iscsid_volumes=YES
 
 # WPA daemons.
 hostapd=NO		hostapd_flags="-Bs /etc/hostapd.conf"

Index: src/etc/rc.d/Makefile
diff -u src/etc/rc.d/Makefile:1.116 src/etc/rc.d/Makefile:1.117
--- src/etc/rc.d/Makefile:1.116	Mon Jun  6 10:56:28 2022
+++ src/etc/rc.d/Makefile	Fri Feb  3 13:53:40 2023
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.116 2022/06/06 10:56:28 nia Exp $
+# $NetBSD: Makefile,v 1.117 2023/02/03 13:53:40 mlelstv Exp $
 
 .include 
 
@@ -25,7 +25,7 @@ CONFIGFILES=\
 		gpio \
 		hostapd httpd \
 		identd ifwatchd inetd ip6addrctl ipfilter ipfs ipmon ipnat \
-		ipsec irdaattach iscsi_target iscsid isibootd \
+		ipsec irdaattach iscsi_target iscsid iscsid_volumes isibootd \
 		kdc \
 		ldconfig ldpd lvmlockdir local lpd lvm \
 		makemandb mdnsd mixerctl modules mopd motd mountall \

Added files:

Index: src/etc/rc.d/iscsid_volumes
diff -u /dev/null src/etc/rc.d/iscsid_volumes:1.1
--- /dev/null	Fri Feb  3 13:53:40 2023
+++ src/etc/rc.d/iscsid_volumes	Fri Feb  3 13:53:40 2023
@@ -0,0 +1,110 @@
+#!/bin/sh
+#
+# $NetBSD: iscsid_volumes,v 1.1 2023/02/03 13:53:40 mlelstv Exp $
+#
+
+# PROVIDE: iscsid_volumes
+# REQUIRE: iscsid
+# BEFORE:  securelevel mountcritremote
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="iscsid_volumes"
+rcvar=$name
+start_cmd="iscsid_volumes_start"
+stop_cmd="iscsid_volumes_stop"
+
+iscsid_volumes_start()
+{
+	test -f /etc/iscsi/volumes || return
+
+	while read host target digest auth user alias; do
+		case $host in
+		\#*) ;;
+		*)
+			topts=''
+			case $digest in
+			*d*) topts="$topts -d";;
+			esac
+			case $digest in
+			*h*) topts="$topts -h";;
+			esac
+
+			pass="-"
+			mpass="-"
+
+			while read entry dummy; do
+case $entry in
+\#*) ;;
+"$user":*) pass=${entry#*:} ;;
+"$target":*) mpass=${entry#*:} ;;
+esac
+			done < /etc/iscsi/auths
+
+			case $host in
+			*:*)
+port=${host#*:}
+host=${host%%:*}
+;;
+			*)
+port=3260
+;;
+			esac
+
+			echo "Add target ${alias:-$target}"
+
+			out=$(/sbin/iscsictl add_target$topts \
+-a "$host" \
+-p "$port" \
+-n "$target" \
+-t "$auth" \
+-u "$user" \
+-s "$pass" \
+-S "$mpass" \
+-N "${alias:--}")
+			echo "$out"
+
+			case $out in
+			Added\ Target\ [1-9]*,\ Portal\ [1-9]*\ )
+out=${out% }
+portal=${out##* }
+echo "Login $target via Portal $portal"
+/sbin/iscsictl login -P "$portal"
+;;
+			esac
+		esac
+	done < 

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

2023-02-03 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Feb  3 09:21:58 UTC 2023

Modified Files:
src/sys/arch/i386/i386: locore.S

Log Message:
Make multiboot1 continue with common boot code and not skip CPU type
detection.

Fixes PR 57017 and PR 56935.


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/sys/arch/i386/i386/locore.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/i386/i386

2023-02-03 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Feb  3 09:21:58 UTC 2023

Modified Files:
src/sys/arch/i386/i386: locore.S

Log Message:
Make multiboot1 continue with common boot code and not skip CPU type
detection.

Fixes PR 57017 and PR 56935.


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/sys/arch/i386/i386/locore.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/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.190 src/sys/arch/i386/i386/locore.S:1.191
--- src/sys/arch/i386/i386/locore.S:1.190	Wed Sep  7 00:40:18 2022
+++ src/sys/arch/i386/i386/locore.S	Fri Feb  3 09:21:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.190 2022/09/07 00:40:18 knakahara Exp $	*/
+/*	$NetBSD: locore.S,v 1.191 2023/02/03 09:21:58 mlelstv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.190 2022/09/07 00:40:18 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.191 2023/02/03 09:21:58 mlelstv Exp $");
 
 #include "opt_copy_symtab.h"
 #include "opt_ddb.h"
@@ -415,7 +415,7 @@ multiboot1_loader:
 	pushl	%ebx		/* Address of Multiboot information */
 	call	_C_LABEL(multiboot1_pre_reloc)
 	addl	$4,%esp
-	jmp	2f
+	jmp	.Lstart_common
 
 efi_multiboot2_loader:
 	/*



CVS commit: src/usr.sbin/cpuctl/arch

2023-02-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb  3 08:08:33 UTC 2023

Modified Files:
src/usr.sbin/cpuctl/arch: aarch64.c

Log Message:
MPIDR is 64bits. Without this AFF3 would always be zero.

Spotted by Cyprien.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/cpuctl/arch/aarch64.c

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

Modified files:

Index: src/usr.sbin/cpuctl/arch/aarch64.c
diff -u src/usr.sbin/cpuctl/arch/aarch64.c:1.21 src/usr.sbin/cpuctl/arch/aarch64.c:1.22
--- src/usr.sbin/cpuctl/arch/aarch64.c:1.21	Sat Apr 30 14:06:10 2022
+++ src/usr.sbin/cpuctl/arch/aarch64.c	Fri Feb  3 08:08:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: aarch64.c,v 1.21 2022/04/30 14:06:10 ryo Exp $	*/
+/*	$NetBSD: aarch64.c,v 1.22 2023/02/03 08:08:33 skrll Exp $	*/
 
 /*
  * Copyright (c) 2018 Ryo Shimizu 
@@ -29,7 +29,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: aarch64.c,v 1.21 2022/04/30 14:06:10 ryo Exp $");
+__RCSID("$NetBSD: aarch64.c,v 1.22 2023/02/03 08:08:33 skrll Exp $");
 #endif /* no lint */
 
 #include 
@@ -1073,7 +1073,7 @@ identify_revidr(const char *cpuname, uin
 
 /* MPIDR_EL1 - Multiprocessor Affinity Register */
 static void
-identify_mpidr(const char *cpuname, uint32_t mpidr)
+identify_mpidr(const char *cpuname, uint64_t mpidr)
 {
 	const char *setname = "multiprocessor affinity";
 



CVS commit: src/usr.sbin/cpuctl/arch

2023-02-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb  3 08:08:33 UTC 2023

Modified Files:
src/usr.sbin/cpuctl/arch: aarch64.c

Log Message:
MPIDR is 64bits. Without this AFF3 would always be zero.

Spotted by Cyprien.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/cpuctl/arch/aarch64.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/aarch64/aarch64

2023-02-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb  3 08:05:27 UTC 2023

Modified Files:
src/sys/arch/aarch64/aarch64: cpu.c

Log Message:
Remove useless/harmful casts in debug messages. MPIDR AFF3 would not
be printed before.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/aarch64/aarch64/cpu.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/aarch64/aarch64/cpu.c
diff -u src/sys/arch/aarch64/aarch64/cpu.c:1.72 src/sys/arch/aarch64/aarch64/cpu.c:1.73
--- src/sys/arch/aarch64/aarch64/cpu.c:1.72	Thu Dec 22 06:58:47 2022
+++ src/sys/arch/aarch64/aarch64/cpu.c	Fri Feb  3 08:05:27 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.72 2022/12/22 06:58:47 ryo Exp $ */
+/* $NetBSD: cpu.c,v 1.73 2023/02/03 08:05:27 skrll Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.72 2022/12/22 06:58:47 ryo Exp $");
+__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.73 2023/02/03 08:05:27 skrll Exp $");
 
 #include "locators.h"
 #include "opt_arm_debug.h"
@@ -329,8 +329,8 @@ cpu_identify2(device_t self, struct cpu_
 {
 	struct aarch64_sysctl_cpu_id * const id = >ci_id;
 
-	aprint_debug_dev(self, "midr=0x%" PRIx32 " mpidr=0x%" PRIx32 "\n",
-	(uint32_t)id->ac_midr, (uint32_t)id->ac_mpidr);
+	aprint_debug_dev(self, "midr=0x%" PRIx64 " mpidr=0x%" PRIx64 "\n",
+	id->ac_midr, id->ac_mpidr);
 	aprint_verbose_dev(self, "revID=0x%" PRIx64, id->ac_revidr);
 
 	/* ID_AA64DFR0_EL1 */



CVS commit: src/sys/arch/aarch64/aarch64

2023-02-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb  3 08:05:27 UTC 2023

Modified Files:
src/sys/arch/aarch64/aarch64: cpu.c

Log Message:
Remove useless/harmful casts in debug messages. MPIDR AFF3 would not
be printed before.


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

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