CVS commit: src/sys/arch/mvme68k/mvme68k

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 17:59:13 UTC 2020

Modified Files:
src/sys/arch/mvme68k/mvme68k: bus_dma.c isr.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/mvme68k/mvme68k/bus_dma.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/mvme68k/mvme68k/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/mvme68k/mvme68k/bus_dma.c
diff -u src/sys/arch/mvme68k/mvme68k/bus_dma.c:1.37 src/sys/arch/mvme68k/mvme68k/bus_dma.c:1.38
--- src/sys/arch/mvme68k/mvme68k/bus_dma.c:1.37	Fri Nov 12 13:18:58 2010
+++ src/sys/arch/mvme68k/mvme68k/bus_dma.c	Sat Nov 21 17:59:13 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.37 2010/11/12 13:18:58 uebayasi Exp $	*/
+/* $NetBSD: bus_dma.c,v 1.38 2020/11/21 17:59:13 thorpej Exp $	*/
 
 /*
  * This file was taken from from next68k/dev/bus_dma.c, which was originally
@@ -39,13 +39,13 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.37 2010/11/12 13:18:58 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.38 2020/11/21 17:59:13 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -64,6 +64,14 @@ int	_bus_dmamap_load_buffer_direct_commo
 	bus_dmamap_t, void *, bus_size_t, struct vmspace *, int,
 	paddr_t *, int *, int);
 
+static size_t
+_bus_dmamap_mapsize(int const nsegments)
+{
+	KASSERT(nsegments > 0);
+	return sizeof(struct mvme68k_bus_dmamap) +
+	   (sizeof(bus_dma_segment_t) * (nsegments - 1));
+}
+
 /*
  * Common function for DMA map creation.  May be called by bus-specific
  * DMA map creation functions.
@@ -74,7 +82,6 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 {
 	struct mvme68k_bus_dmamap *map;
 	void *mapstore;
-	size_t mapsize;
 
 	/*
 	 * Allocate and initialize the DMA map.  The end of the map
@@ -88,13 +95,10 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 	 * The bus_dmamap_t includes one bus_dma_segment_t, hence
 	 * the (nsegments - 1).
 	 */
-	mapsize = sizeof(struct mvme68k_bus_dmamap) +
-	(sizeof(bus_dma_segment_t) * (nsegments - 1));
-	if ((mapstore = malloc(mapsize, M_DMAMAP,
-	(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL)
+	if ((mapstore = kmem_zalloc(_bus_dmamap_mapsize(nsegments),
+	(flags & BUS_DMA_NOWAIT) ? KM_NOSLEEP : KM_SLEEP)) == NULL)
 		return ENOMEM;
 
-	memset(mapstore, 0, mapsize);
 	map = (struct mvme68k_bus_dmamap *)mapstore;
 	map->_dm_size = size;
 	map->_dm_segcnt = nsegments;
@@ -117,7 +121,7 @@ void
 _bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
 {
 
-	free(map, M_DMAMAP);
+	kmem_free(map, _bus_dmamap_mapsize(map->_dm_segcnt));
 }
 
 /*

Index: src/sys/arch/mvme68k/mvme68k/isr.c
diff -u src/sys/arch/mvme68k/mvme68k/isr.c:1.34 src/sys/arch/mvme68k/mvme68k/isr.c:1.35
--- src/sys/arch/mvme68k/mvme68k/isr.c:1.34	Sun Nov 10 21:16:30 2019
+++ src/sys/arch/mvme68k/mvme68k/isr.c	Sat Nov 21 17:59:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: isr.c,v 1.34 2019/11/10 21:16:30 chs Exp $	*/
+/*	$NetBSD: isr.c,v 1.35 2020/11/21 17:59:13 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -34,11 +34,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.34 2019/11/10 21:16:30 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.35 2020/11/21 17:59:13 thorpej Exp $");
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -105,7 +105,7 @@ isrlink_autovec(int (*func)(void *), voi
 		panic("%s: bad ipl %d", __func__, ipl);
 #endif
 
-	newisr = malloc(sizeof(struct isr_autovec), M_DEVBUF, M_WAITOK);
+	newisr = kmem_alloc(sizeof(*newisr), KM_SLEEP);
 	newisr->isr_func = func;
 	newisr->isr_arg = arg;
 	newisr->isr_ipl = ipl;



CVS commit: src/sys/arch/mvme68k/mvme68k

2016-05-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue May 31 03:25:46 UTC 2016

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

Log Message:
PR 50792 David Binderman: make sure we don't divide by zero.

The loop that picks delay_divisor might conceivably reject all values,
particularly if the hardware is sulking for some reason; in that case
it'll be left zero. Use 1 instead of 0 so we don't then crash.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/arch/mvme68k/mvme68k/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/mvme68k/mvme68k/machdep.c
diff -u src/sys/arch/mvme68k/mvme68k/machdep.c:1.153 src/sys/arch/mvme68k/mvme68k/machdep.c:1.154
--- src/sys/arch/mvme68k/mvme68k/machdep.c:1.153	Mon Mar 24 19:52:27 2014
+++ src/sys/arch/mvme68k/mvme68k/machdep.c	Tue May 31 03:25:46 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.153 2014/03/24 19:52:27 christos Exp $	*/
+/*	$NetBSD: machdep.c,v 1.154 2016/05/31 03:25:46 dholland Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.153 2014/03/24 19:52:27 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.154 2016/05/31 03:25:46 dholland Exp $");
 
 #include "opt_ddb.h"
 #include "opt_m060sp.h"
@@ -309,6 +309,10 @@ mvme147_init(void)
 		bus_space_write_1(bt, bh, PCCREG_TMR1_CONTROL, PCC_TIMERCLEAR);
 		/* retry! */
 	}
+	/* just in case */
+	if (delay_divisor == 0) {
+		delay_divisor = 1;
+	}
 
 	bus_space_unmap(bt, bh, PCCREG_SIZE);
 



CVS commit: src/sys/arch/mvme68k/mvme68k

2014-03-15 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Mar 15 12:02:28 UTC 2014

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

Log Message:
Remove duplicated INTERRUPT_SAVEREG and INTERRUPT_RESTOREREG macro.

They are in m68k/asm.h and now using different register format.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/mvme68k/mvme68k/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/mvme68k/mvme68k/locore.s
diff -u src/sys/arch/mvme68k/mvme68k/locore.s:1.112 src/sys/arch/mvme68k/mvme68k/locore.s:1.113
--- src/sys/arch/mvme68k/mvme68k/locore.s:1.112	Sun Mar  9 14:53:52 2014
+++ src/sys/arch/mvme68k/mvme68k/locore.s	Sat Mar 15 12:02:28 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.112 2014/03/09 14:53:52 tsutsui Exp $	*/
+/*	$NetBSD: locore.s,v 1.113 2014/03/15 12:02:28 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -1114,9 +1114,6 @@ Lbrkpt3:
  * intrhand_vectored is the entry point for vectored interrupts.
  */
 
-#define INTERRUPT_SAVEREG	moveml  #0xC0C0,%sp@-
-#define INTERRUPT_RESTOREREG	moveml  %sp@+,#0x0303
-
 ENTRY_NOPROFILE(intrhand_autovec)
 	addql	#1,_C_LABEL(interrupt_depth)
 	INTERRUPT_SAVEREG



CVS commit: src/sys/arch/mvme68k/mvme68k

2014-03-15 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Mar 15 12:04:22 UTC 2014

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

Log Message:
Use common m68k/busaddrerr.s for bus error and address error handlers.

No binary changes on GENERIC.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/mvme68k/mvme68k/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/mvme68k/mvme68k/locore.s
diff -u src/sys/arch/mvme68k/mvme68k/locore.s:1.113 src/sys/arch/mvme68k/mvme68k/locore.s:1.114
--- src/sys/arch/mvme68k/mvme68k/locore.s:1.113	Sat Mar 15 12:02:28 2014
+++ src/sys/arch/mvme68k/mvme68k/locore.s	Sat Mar 15 12:04:22 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.113 2014/03/15 12:02:28 tsutsui Exp $	*/
+/*	$NetBSD: locore.s,v 1.114 2014/03/15 12:04:22 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -709,174 +709,10 @@ Lmemc040berr:
  */
 #include m68k/m68k/trap_subr.s
 
-#if defined(M68040) || defined(M68060)
-ENTRY_NOPROFILE(addrerr4060)
-	clrl	%sp@-			| stack adjust count
-	moveml	#0x,%sp@-		| save user registers
-	movl	%usp,%a0		| save the user SP
-	movl	%a0,%sp@(FR_SP)		|   in the savearea
-	movl	%sp@(FR_HW+8),%sp@-
-	clrl	%sp@-			| dummy code
-	movl	#T_ADDRERR,%sp@-	| mark address error
-	jra	_ASM_LABEL(faultstkadj)	| and deal with it
-#endif
-
-#if defined(M68060)
-ENTRY_NOPROFILE(buserr60)
-	clrl	%sp@-			| stack adjust count
-	moveml	#0x,%sp@-		| save user registers
-	movl	%usp,%a0		| save the user SP
-	movl	%a0,%sp@(FR_SP)		|   in the savearea
-	movel	%sp@(FR_HW+12),%d0	| FSLW
-	btst	#2,%d0			| branch prediction error?
-	jeq	Lnobpe
-	movc	%cacr,%d2
-	orl	#IC60_CABC,%d2		| clear all branch cache entries
-	movc	%d2,%cacr
-	movl	%d0,%d1
-	andl	#0x7ffd,%d1
-	jeq	_ASM_LABEL(faultstkadjnotrap2)
-Lnobpe:
-| we need to adjust for misaligned addresses
-	movl	%sp@(FR_HW+8),%d1	| grab VA
-	btst	#27,%d0			| check for mis-aligned access
-	jeq	Lberr3			| no, skip
-	addl	#28,%d1			| yes, get into next page
-	| operand case: 3,
-	| instruction case: 4+12+12
-	andl	#PG_FRAME,%d1		| and truncate
-Lberr3:
-	movl	%d1,%sp@-
-	movl	%d0,%sp@-		| code is FSLW now.
-	andw	#0x1f80,%d0
-	jeq	Lberr60			| it is a bus error
-	movl	#T_MMUFLT,%sp@-		| show that we are an MMU fault
-	jra	_ASM_LABEL(faultstkadj)	| and deal with it
-Lberr60:
-	tstl	_C_LABEL(nofault)	| catch bus error?
-	jeq	Lisberr			| no, handle as usual
-	movl	_C_LABEL(nofault),%sp@-	| yes,
-	jbsr	_C_LABEL(longjmp)	|  longjmp(nofault)
-	/* NOTREACHED */
-#endif
-#if defined(M68040)
-ENTRY_NOPROFILE(buserr40)
-	clrl	%sp@-			| stack adjust count
-	moveml	#0x,%sp@-		| save user registers
-	movl	%usp,%a0		| save the user SP
-	movl	%a0,%sp@(FR_SP)		|   in the savearea
-	movl	%sp@(FR_HW+20),%d1	| get fault address
-	moveq	#0,%d0
-	movw	%sp@(FR_HW+12),%d0	| get SSW
-	btst	#11,%d0			| check for mis-aligned
-	jeq	Lbe1stpg		| no skip
-	addl	#3,%d1			| get into next page
-	andl	#PG_FRAME,%d1		| and truncate
-Lbe1stpg:
-	movl	%d1,%sp@-		| pass fault address.
-	movl	%d0,%sp@-		| pass SSW as code
-	btst	#10,%d0			| test ATC
-	jeq	Lberr40			| it is a bus error
-	movl	#T_MMUFLT,%sp@-		| show that we are an MMU fault
-	jra	_ASM_LABEL(faultstkadj)	| and deal with it
-Lberr40:
-	tstl	_C_LABEL(nofault)	| catch bus error?
-	jeq	Lisberr			| no, handle as usual
-	movl	_C_LABEL(nofault),%sp@-	| yes,
-	jbsr	_C_LABEL(longjmp)	|  longjmp(nofault)
-	/* NOTREACHED */
-#endif
-
-#if defined(M68020) || defined(M68030)
-ENTRY_NOPROFILE(busaddrerr2030)
-	clrl	%sp@-			| stack adjust count
-	moveml	#0x,%sp@-		| save user registers
-	movl	%usp,%a0		| save the user SP
-	movl	%a0,%sp@(FR_SP)		|   in the savearea
-	moveq	#0,%d0
-	movw	%sp@(FR_HW+10),%d0	| grab SSW for fault processing
-	btst	#12,%d0			| RB set?
-	jeq	LbeX0			| no, test RC
-	bset	#14,%d0			| yes, must set FB
-	movw	%d0,%sp@(FR_HW+10)	| for hardware too
-LbeX0:
-	btst	#13,%d0			| RC set?
-	jeq	LbeX1			| no, skip
-	bset	#15,%d0			| yes, must set FC
-	movw	%d0,%sp@(FR_HW+10)	| for hardware too
-LbeX1:
-	btst	#8,%d0			| data fault?
-	jeq	Lbe0			| no, check for hard cases
-	movl	%sp@(FR_HW+16),%d1	| fault address is as given in frame
-	jra	Lbe10			| thats it
-Lbe0:
-	btst	#4,%sp@(FR_HW+6)	| long (type B) stack frame?
-	jne	Lbe4			| yes, go handle
-	movl	%sp@(FR_HW+2),%d1	| no, can use save PC
-	btst	#14,%d0			| FB set?
-	jeq	Lbe3			| no, try FC
-	addql	#4,%d1			| yes, adjust address
-	jra	Lbe10			| done
-Lbe3:
-	btst	#15,%d0			| FC set?
-	jeq	Lbe10			| no, done
-	addql	#2,%d1			| yes, adjust address
-	jra	Lbe10			| done
-Lbe4:
-	movl	%sp@(FR_HW+36),%d1	| long format, use stage B address
-	btst	#15,%d0			| FC set?
-	jeq	Lbe10			| no, all done
-	subql	#2,%d1			| yes, adjust address
-Lbe10:
-	movl	%d1,%sp@-		| push fault VA
-	movl	%d0,%sp@-		| and padded SSW
-	movw	%sp@(FR_HW+8+6),%d0	| get frame format/vector offset
-	andw	#0x0FFF,%d0		| clear 

CVS commit: src/sys/arch/mvme68k/mvme68k

2014-03-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Mar  9 14:53:52 UTC 2014

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

Log Message:
Remove trailing spaces and tabs.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/mvme68k/mvme68k/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/mvme68k/mvme68k/locore.s
diff -u src/sys/arch/mvme68k/mvme68k/locore.s:1.111 src/sys/arch/mvme68k/mvme68k/locore.s:1.112
--- src/sys/arch/mvme68k/mvme68k/locore.s:1.111	Fri Jan 31 18:49:35 2014
+++ src/sys/arch/mvme68k/mvme68k/locore.s	Sun Mar  9 14:53:52 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.111 2014/01/31 18:49:35 tsutsui Exp $	*/
+/*	$NetBSD: locore.s,v 1.112 2014/03/09 14:53:52 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -706,7 +706,7 @@ Lmemc040berr:
 
 /*
  * Trap/interrupt vector routines
- */ 
+ */
 #include m68k/m68k/trap_subr.s
 
 #if defined(M68040) || defined(M68060)
@@ -729,7 +729,7 @@ ENTRY_NOPROFILE(buserr60)
 	movl	%a0,%sp@(FR_SP)		|   in the savearea
 	movel	%sp@(FR_HW+12),%d0	| FSLW
 	btst	#2,%d0			| branch prediction error?
-	jeq	Lnobpe			
+	jeq	Lnobpe
 	movc	%cacr,%d2
 	orl	#IC60_CABC,%d2		| clear all branch cache entries
 	movc	%d2,%cacr
@@ -748,7 +748,7 @@ Lnobpe:
 Lberr3:
 	movl	%d1,%sp@-
 	movl	%d0,%sp@-		| code is FSLW now.
-	andw	#0x1f80,%d0 
+	andw	#0x1f80,%d0
 	jeq	Lberr60			| it is a bus error
 	movl	#T_MMUFLT,%sp@-		| show that we are an MMU fault
 	jra	_ASM_LABEL(faultstkadj)	| and deal with it
@@ -1205,7 +1205,7 @@ Laststkadj:
 
 /*
  * Primitives
- */ 
+ */
 
 /*
  * Use common m68k support routines.



CVS commit: src/sys/arch/mvme68k/mvme68k

2013-09-19 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Sep 19 12:04:36 UTC 2013

Modified Files:
src/sys/arch/mvme68k/mvme68k: pmap_bootstrap.c

Log Message:
Move physmem calculations before nptpage initialization.

Fixes mvme68k specific part of PR port-m68k/45915
(panic: pmap_enter_ptpage: can't get KPT page).
Reported and confirmed by Andrew Gillham on his MVME177:
http://mail-index.NetBSD.org/port-mvme68k/2013/09/17/msg82.html

Should be pulled up to all netbsd-6 branches.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.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/mvme68k/mvme68k/pmap_bootstrap.c
diff -u src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.51 src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.52
--- src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.51	Fri Feb 10 06:28:39 2012
+++ src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c	Thu Sep 19 12:04:36 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.51 2012/02/10 06:28:39 mhitch Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.52 2013/09/19 12:04:36 tsutsui Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap_bootstrap.c,v 1.51 2012/02/10 06:28:39 mhitch Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap_bootstrap.c,v 1.52 2013/09/19 12:04:36 tsutsui Exp $);
 
 #include opt_m68k_arch.h
 
@@ -100,6 +100,42 @@ pmap_bootstrap(paddr_t nextpa, paddr_t f
 #endif
 
 	/*
+	 * Initialize the mem_clusters[] array for the crash dump
+	 * code.  While we're at it, compute the total amount of
+	 * physical memory in the system.
+	 */
+	for (i = 0; i  VM_PHYSSEG_MAX; i++) {
+		if (RELOC(phys_seg_list[i].ps_start, paddr_t) ==
+		RELOC(phys_seg_list[i].ps_end, paddr_t)) {
+			/*
+			 * No more memory.
+			 */
+			break;
+		}
+
+		/*
+		 * Make sure these are properly rounded.
+		 */
+		RELOC(phys_seg_list[i].ps_start, paddr_t) =
+		m68k_round_page(RELOC(phys_seg_list[i].ps_start,
+	  paddr_t));
+		RELOC(phys_seg_list[i].ps_end, paddr_t) =
+		m68k_trunc_page(RELOC(phys_seg_list[i].ps_end,
+	  paddr_t));
+
+		size = RELOC(phys_seg_list[i].ps_end, paddr_t) -
+		RELOC(phys_seg_list[i].ps_start, paddr_t);
+
+		RELOC(mem_clusters[i].start, u_quad_t) =
+		RELOC(phys_seg_list[i].ps_start, paddr_t);
+		RELOC(mem_clusters[i].size, u_quad_t) = size;
+
+		RELOC(physmem, int) += size  PGSHIFT;
+
+		RELOC(mem_cluster_cnt, int) += 1;
+	}
+
+	/*
 	 * Calculate important physical addresses:
 	 *
 	 *	lwp0upa		lwp0 u-area		UPAGES pages
@@ -409,42 +445,6 @@ pmap_bootstrap(paddr_t nextpa, paddr_t f
 	RELOC(lwp0uarea, vaddr_t) = lwp0upa - firstpa;
 
 	/*
-	 * Initialize the mem_clusters[] array for the crash dump
-	 * code.  While we're at it, compute the total amount of
-	 * physical memory in the system.
-	 */
-	for (i = 0; i  VM_PHYSSEG_MAX; i++) {
-		if (RELOC(phys_seg_list[i].ps_start, paddr_t) ==
-		RELOC(phys_seg_list[i].ps_end, paddr_t)) {
-			/*
-			 * No more memory.
-			 */
-			break;
-		}
-
-		/*
-		 * Make sure these are properly rounded.
-		 */
-		RELOC(phys_seg_list[i].ps_start, paddr_t) =
-		m68k_round_page(RELOC(phys_seg_list[i].ps_start,
-	  paddr_t));
-		RELOC(phys_seg_list[i].ps_end, paddr_t) =
-		m68k_trunc_page(RELOC(phys_seg_list[i].ps_end,
-	  paddr_t));
-
-		size = RELOC(phys_seg_list[i].ps_end, paddr_t) -
-		RELOC(phys_seg_list[i].ps_start, paddr_t);
-
-		RELOC(mem_clusters[i].start, u_quad_t) =
-		RELOC(phys_seg_list[i].ps_start, paddr_t);
-		RELOC(mem_clusters[i].size, u_quad_t) = size;
-
-		RELOC(physmem, int) += size  PGSHIFT;
-
-		RELOC(mem_cluster_cnt, int) += 1;
-	}
-
-	/*
 	 * Scoot the start of available on-board RAM forward to
 	 * account for:
 	 *



CVS commit: src/sys/arch/mvme68k/mvme68k

2011-01-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jan  2 06:25:23 UTC 2011

Modified Files:
src/sys/arch/mvme68k/mvme68k: pmap_bootstrap.c

Log Message:
Some cosmetics to reduce diffs from other m68k ports.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.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/mvme68k/mvme68k/pmap_bootstrap.c
diff -u src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.45 src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.46
--- src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.45	Sun Jan  2 06:15:04 2011
+++ src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c	Sun Jan  2 06:25:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.45 2011/01/02 06:15:04 tsutsui Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.46 2011/01/02 06:25:23 tsutsui Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -38,7 +38,7 @@
 #include opt_m68k_arch.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap_bootstrap.c,v 1.45 2011/01/02 06:15:04 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap_bootstrap.c,v 1.46 2011/01/02 06:25:23 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/kcore.h
@@ -53,7 +53,7 @@
 
 #define RELOC(v, t)	*((t*)((uintptr_t)(v) + firstpa))
 
-extern char *kernel_text, *etext;
+extern char *etext;
 
 extern int maxmem, physmem;
 extern paddr_t avail_start, avail_end;
@@ -120,12 +120,11 @@
 	 * The KVA corresponding to any of these PAs is:
 	 *	(PA - firstpa + KERNBASE).
 	 */
-	lwp0upa = nextpa;
-	nextpa += USPACE;
-
 	iiomappages = m68k_btop(RELOC(intiotop_phys, u_int) -
 	RELOC(intiobase_phys, u_int));
 
+	lwp0upa = nextpa;
+	nextpa += USPACE;
 #if defined(M68040) || defined(M68060)
 	if (RELOC(mmutype, int) == MMU_68040)
 		kstsize = MAXKL2SIZE / (NPTEPG/SG4_LEV2SIZE);
@@ -321,7 +320,7 @@
 	while (pte  epte)
 		*pte++ = PG_NV;
 	/*
-	 * Validate PTEs for kernel text (RO)
+	 * Validate PTEs for kernel text (RO).
 	 */
 	pte = (pt_entry_t *)kptpa;
 	pte = pte[m68k_btop(KERNBASE)];
@@ -349,7 +348,7 @@
 		protopte += PAGE_SIZE;
 	}
 	/*
-	 * map the kernel segment table cache invalidated for 
+	 * map the kernel segment table cache invalidated for
 	 * these machines (for the 68040 not strictly necessary, but
 	 * recommended by Motorola; for the 68060 mandatory)
 	 */
@@ -373,8 +372,8 @@
 
 	protopte = RELOC(intiobase_phys, u_int) | PG_RW | PG_CI | PG_U | PG_V;
 	epte = pte[iiomappages];
-	RELOC(intiobase, char *) = (char *)PTE2VA(pte);
-	RELOC(intiolimit, char *) = (char *)PTE2VA(epte);
+	RELOC(intiobase, uint8_t *) = (uint8_t *)PTE2VA(pte);
+	RELOC(intiolimit, uint8_t *) = (uint8_t *)PTE2VA(epte);
 	while (pte  epte) {
 		*pte++ = protopte;
 		protopte += PAGE_SIZE;



CVS commit: src/sys/arch/mvme68k/mvme68k

2010-12-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Dec 25 15:29:34 UTC 2010

Modified Files:
src/sys/arch/mvme68k/mvme68k: pmap_bootstrap.c

Log Message:
Fix harmless pasto and tweak some comments.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.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/mvme68k/mvme68k/pmap_bootstrap.c
diff -u src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.42 src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.43
--- src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.42	Sat Dec 25 14:43:00 2010
+++ src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c	Sat Dec 25 15:29:34 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.42 2010/12/25 14:43:00 tsutsui Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.43 2010/12/25 15:29:34 tsutsui Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -38,7 +38,7 @@
 #include opt_m68k_arch.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap_bootstrap.c,v 1.42 2010/12/25 14:43:00 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap_bootstrap.c,v 1.43 2010/12/25 15:29:34 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/kcore.h
@@ -103,7 +103,7 @@
 	/*
 	 * Calculate important physical addresses:
 	 *
-	 *	lwp0upa		lwp0 0 u-area		UPAGES pages
+	 *	lwp0upa		lwp0 u-area		UPAGES pages
 	 *
 	 *	kstpa		kernel segment table	1 page (!040)
 	 *		N pages (040)
@@ -212,7 +212,7 @@
 		}
 		/*
 		 * Initialize level 1 descriptors.  We need:
-		 *	roundup(nl2desc, SG4_LEV2SIZE) / SG4_LEV2SIZE
+		 *	howmany(nl2desc, SG4_LEV2SIZE)
 		 * level 1 descriptors to map the `nl2desc' level 2's.
 		 */
 		nl1desc = howmany(nl2desc, SG4_LEV2SIZE);
@@ -302,7 +302,7 @@
 		 * and the software Sysptmap.
 		 */
 		ste = (st_entry_t *)kstpa;
-		pte = (st_entry_t *)kptmpa;
+		pte = (pt_entry_t *)kptmpa;
 		epte = pte[nptpages];
 		protoste = kptpa | SG_RW | SG_V;
 		protopte = kptpa | PG_RW | PG_CI | PG_V;
@@ -319,7 +319,7 @@
 		este = este[TIA_SIZE];
 		while (ste  este)
 			*ste++ = SG_NV;
-		epte = (st_entry_t *)kptmpa;
+		epte = (pt_entry_t *)kptmpa;
 		epte = epte[TIB_SIZE];
 		while (pte  epte)
 			*pte++ = PG_NV;



CVS commit: src/sys/arch/mvme68k/mvme68k

2010-12-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Dec 25 16:14:44 UTC 2010

Modified Files:
src/sys/arch/mvme68k/mvme68k: pmap_bootstrap.c

Log Message:
Put somehow missed code part in rev 1.36:
 Allocate lwp0upa (PA of lwp0 uarea) right after kernel rather than
 between other page tables to use different mappings for ste/pte pages
 as well as amiga and atari.  Should resolve XXX comments in next68k and x68k.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.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/mvme68k/mvme68k/pmap_bootstrap.c
diff -u src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.43 src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.44
--- src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.43	Sat Dec 25 15:29:34 2010
+++ src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c	Sat Dec 25 16:14:44 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.43 2010/12/25 15:29:34 tsutsui Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.44 2010/12/25 16:14:44 tsutsui Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -38,7 +38,7 @@
 #include opt_m68k_arch.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap_bootstrap.c,v 1.43 2010/12/25 15:29:34 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap_bootstrap.c,v 1.44 2010/12/25 16:14:44 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/kcore.h
@@ -122,6 +122,9 @@
 	 * The KVA corresponding to any of these PAs is:
 	 *	(PA - firstpa + KERNBASE).
 	 */
+	lwp0upa = nextpa;
+	nextpa += USPACE;
+
 	iiomappages = m68k_btop(RELOC(intiotop_phys, u_int) -
 	RELOC(intiobase_phys, u_int));
 
@@ -137,8 +140,6 @@
 	nextpa += PAGE_SIZE;
 	lkptpa = nextpa;
 	nextpa += PAGE_SIZE;
-	lwp0upa = nextpa;
-	nextpa += USPACE;
 	kptpa = nextpa;
 	nptpages = RELOC(Sysptsize, int) + (iiomappages + NPTEPG - 1) / NPTEPG;
 	nextpa += nptpages * PAGE_SIZE;



CVS commit: src/sys/arch/mvme68k/mvme68k

2009-12-04 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Dec  4 18:11:14 UTC 2009

Modified Files:
src/sys/arch/mvme68k/mvme68k: pmap_bootstrap.c

Log Message:
Update one more comment.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.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/mvme68k/mvme68k/pmap_bootstrap.c
diff -u src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.33 src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.34
--- src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.33	Fri Dec  4 18:06:28 2009
+++ src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c	Fri Dec  4 18:11:14 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.33 2009/12/04 18:06:28 tsutsui Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.34 2009/12/04 18:11:14 tsutsui Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap_bootstrap.c,v 1.33 2009/12/04 18:06:28 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap_bootstrap.c,v 1.34 2009/12/04 18:11:14 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/kcore.h
@@ -406,7 +406,8 @@
 	while (pte  epte)
 		*pte++ = 0;
 	/*
-	 * Store the u-area into lwp0.
+	 * Remember the u-area address so it can be loaded in the lwp0
+	 * via uvm_lwp_setuarea() later in pmap_bootstrap_finalize().
 	 */
 	RELOC(lwp0uarea, vaddr_t) = lwp0upa - firstpa;
 



CVS commit: src/sys/arch/mvme68k/mvme68k

2009-10-22 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Oct 23 03:28:09 UTC 2009

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

Log Message:
Follow revision 1.28 in OpenBSD: remove ad clause.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/mvme68k/mvme68k/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/mvme68k/mvme68k/disksubr.c
diff -u src/sys/arch/mvme68k/mvme68k/disksubr.c:1.34 src/sys/arch/mvme68k/mvme68k/disksubr.c:1.35
--- src/sys/arch/mvme68k/mvme68k/disksubr.c:1.34	Sat Apr 11 11:04:41 2009
+++ src/sys/arch/mvme68k/mvme68k/disksubr.c	Fri Oct 23 03:28:09 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: disksubr.c,v 1.34 2009/04/11 11:04:41 scw Exp $	*/
+/*	$NetBSD: disksubr.c,v 1.35 2009/10/23 03:28:09 snj Exp $	*/
 
 /*
  * Copyright (c) 1995 Dale Rahn.
@@ -12,10 +12,7 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- *   This product includes software developed by Dale Rahn.
- * 4. The name of the author may not be used to endorse or promote products
+ * 3. The name of the author may not be used to endorse or promote products
  *derived from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
@@ -31,7 +28,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: disksubr.c,v 1.34 2009/04/11 11:04:41 scw Exp $);
+__KERNEL_RCSID(0, $NetBSD: disksubr.c,v 1.35 2009/10/23 03:28:09 snj Exp $);
 
 #include sys/param.h
 #include sys/systm.h



CVS commit: src/sys/arch/mvme68k/mvme68k

2009-08-15 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 15 19:16:45 UTC 2009

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

Log Message:
Fix a 13 year old buffer overrun.  From Henning Petersen in
PR port-mvme68k/41857.


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/sys/arch/mvme68k/mvme68k/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/mvme68k/mvme68k/machdep.c
diff -u src/sys/arch/mvme68k/mvme68k/machdep.c:1.137 src/sys/arch/mvme68k/mvme68k/machdep.c:1.138
--- src/sys/arch/mvme68k/mvme68k/machdep.c:1.137	Fri Feb 13 22:41:02 2009
+++ src/sys/arch/mvme68k/mvme68k/machdep.c	Sat Aug 15 19:16:45 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.137 2009/02/13 22:41:02 apb Exp $	*/
+/*	$NetBSD: machdep.c,v 1.138 2009/08/15 19:16:45 snj Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -77,7 +77,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.137 2009/02/13 22:41:02 apb Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.138 2009/08/15 19:16:45 snj Exp $);
 
 #include opt_ddb.h
 #include opt_m060sp.h
@@ -579,7 +579,7 @@
 	memset(board_str, 0, sizeof(board_str));
 	memset(cpu_str, 0, sizeof(cpu_str));
 	memset(mmu_str, 0, sizeof(mmu_str));
-	memset(fpu_str, 0, sizeof(cpu_str));
+	memset(fpu_str, 0, sizeof(fpu_str));
 
 	/* Fill in the CPU string. */
 	switch (cputype) {