CVS commit: src/sys/arch/emips/emips

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

Modified Files:
src/sys/arch/emips/emips: bus_dma.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/emips/emips/bus_dma.c

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

Modified files:

Index: src/sys/arch/emips/emips/bus_dma.c
diff -u src/sys/arch/emips/emips/bus_dma.c:1.4 src/sys/arch/emips/emips/bus_dma.c:1.5
--- src/sys/arch/emips/emips/bus_dma.c:1.4	Thu Jun 11 08:22:08 2015
+++ src/sys/arch/emips/emips/bus_dma.c	Sat Nov 21 19:24:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.4 2015/06/11 08:22:08 matt Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.5 2020/11/21 19:24:17 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.4 2015/06/11 08:22:08 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.5 2020/11/21 19:24:17 thorpej Exp $");
 
 #include "opt_cputype.h"
 
@@ -39,6 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -87,6 +88,14 @@ emips_bus_dma_init(void)
 #endif
 }
 
+static size_t 
+_bus_dmamap_mapsize(int const nsegments)
+{   
+	KASSERT(nsegments > 0);
+	return sizeof(struct emips_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.
@@ -97,7 +106,6 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 {
 	struct emips_bus_dmamap *map;
 	void *mapstore;
-	size_t mapsize;
 
 	/*
 	 * Allocate and initialize the DMA map.  The end of the map
@@ -111,13 +119,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 emips_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 emips_bus_dmamap *)mapstore;
 	map->_dm_size = size;
 	map->_dm_segcnt = nsegments;
@@ -141,7 +146,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));
 }
 
 /*



CVS commit: src/sys/arch/emips/emips

2020-01-12 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jan 12 13:15:10 UTC 2020

Modified Files:
src/sys/arch/emips/emips: locore_machdep.S machdep.c

Log Message:
KNF and misc whitespace cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/emips/emips/locore_machdep.S
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/emips/emips/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/emips/emips/locore_machdep.S
diff -u src/sys/arch/emips/emips/locore_machdep.S:1.1 src/sys/arch/emips/emips/locore_machdep.S:1.2
--- src/sys/arch/emips/emips/locore_machdep.S:1.1	Wed Jan 26 01:18:50 2011
+++ src/sys/arch/emips/emips/locore_machdep.S	Sun Jan 12 13:15:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore_machdep.S,v 1.1 2011/01/26 01:18:50 pooka Exp $	*/
+/*	$NetBSD: locore_machdep.S,v 1.2 2020/01/12 13:15:10 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -47,52 +47,72 @@
 /*
  * Extension control register bits, definitions and semantics
  */
-/* The Opcode field holds the opcode assigned to the given Extension slot (Z).
- * When this field is written to, the CAM used for decoding the Extension Instructions is updated
- * (in CAM Decoding mode).  The value can be one of the eight Extension Opcodes, or any other opcode
- * iff the Extension has priority and is meant to mask an existing instruction.
+/*
+ * The Opcode field holds the opcode assigned to the given Extension slot (Z).
+ * When this field is written to, the CAM used for decoding the Extension
+ * Instructions is updated (in CAM Decoding mode).  The value can be one
+ * of the eight Extension Opcodes, or any other opcode iff the Extension
+ * has priority and is meant to mask an existing instruction.
  */
 #define EXTCTL_OP   0xfc00
-/* The Kernel/User flag denotes that Extension Z is a Kernel[0] or User[1] mode Extension.
+/*
+ * The Kernel/User flag denotes that Extension Z is a Kernel[0] or User[1]
+ * mode Extension.
  */
 #define EXTCTL_KU   0x0200
-/* The Scope flag denotes that Extension Z is a Local[0] (per process) or Global[1] (shared) Extension.
+/*
+ * The Scope flag denotes that Extension Z is a Local[0] (per process) or
+ * Global[1] (shared) Extension.
  */
 #define EXTCTL_SC   0x0100
-/* The Peripheral flag denotes that Extension Z is a Peripheral Extension.
+/*
+ * The Peripheral flag denotes that Extension Z is a Peripheral Extension.
  */
 #define EXTCTL_PER  0x0008
-/* The Interrupt flag denotes that Extension Z has an interrupt.
+/*
+ * The Interrupt flag denotes that Extension Z has an interrupt.
  */
 #define EXTCTL_INT  0x0004
-/* The Virtual/Physical flag denotes that Extension Z uses Virtual[0] or Physical[0] addresses 
- * when accessing the memory bus.
+/*
+ * The Virtual/Physical flag denotes that Extension Z uses Virtual[0] or
+ * Physical[0] addresses when accessing the memory bus.
  */
 #define EXTCTL_VP   0x0002
-/* The State field denotes the state of Extension Z.  (Loaded, Config, Running, Suspend, etc)
+/*
+ * The State field denotes the state of Extension Z.  (Loaded, Config,
+ * Running, Suspend, etc)
  */
 #define EXTCTL_ST   0xf000
-/* The Priority field denotes the execution priority for Extension Z during arbitration.
+/*
+ * The Priority field denotes the execution priority for Extension Z
+ * during arbitration.
  */
 #define EXTCTL_PR   0x0f00
-/* The Privileged flag denotes that Extension Z has access to security sensitive system resources.
+/*
+ * The Privileged flag denotes that Extension Z has access to security
+ * sensitive system resources.
  */
 #define EXTCTL_PRV  0x0080
-/* The Trap flag denotes whether an RI exception will be generated for an Extension Z's instruction 
- * if Extension Z is disabled.
+/*
+ * The Trap flag denotes whether an RI exception will be generated for
+ * an Extension Z's instruction if Extension Z is disabled.
  */
 #define EXTCTL_TR   0x0010
-/* The Trapped flag denotes that a trap occurred during Extension Z's last execution and it was unable
- * to complete.
+/*
+ * The Trapped flag denotes that a trap occurred during Extension Z's
+ * last execution and it was unable to complete.
  */
 #define EXTCTL_TD   0x0008
-/* The Clock Enable flag denotes that the clock for Extension Z is active.
+/*
+ * The Clock Enable flag denotes that the clock for Extension Z is active.
  */
 #define EXTCTL_CE   0x0004
-/* The Enable flag denotes that Extension Z is enabled for execution.
+/*
+ * The Enable flag denotes that Extension Z is enabled for execution.
  */
 #define EXTCTL_EN   0x0002
-/* The Loaded flag denotes that Extension Z has been loaded
+/*
+ * The Loaded flag denotes that Extension Z has been loaded
  */
 #define EXTCTL_LD   0x0001
 
@@ -103,61 +123,62 @@
  * nb: clears the counter too
  */
 

CVS commit: src/sys/arch/emips/emips

2019-12-11 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Dec 11 16:16:13 UTC 2019

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

Log Message:
Fix a longstanding "freeze right after enabling interrupt" problem.

With this fix, finally NetBSD/emips on Giano is fully functional.
See PR/45080 for more details.

Should be pulled up to netbsd-9.


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

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

Modified files:

Index: src/sys/arch/emips/emips/interrupt.c
diff -u src/sys/arch/emips/emips/interrupt.c:1.7 src/sys/arch/emips/emips/interrupt.c:1.8
--- src/sys/arch/emips/emips/interrupt.c:1.7	Mon Dec  9 16:19:11 2019
+++ src/sys/arch/emips/emips/interrupt.c	Wed Dec 11 16:16:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: interrupt.c,v 1.7 2019/12/09 16:19:11 tsutsui Exp $	*/
+/*	$NetBSD: interrupt.c,v 1.8 2019/12/11 16:16:13 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.7 2019/12/09 16:19:11 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.8 2019/12/11 16:16:13 tsutsui Exp $");
 
 #include 
 #include 
@@ -102,6 +102,19 @@ cpu_intr(int ppl, vaddr_t pc, uint32_t s
 
 	curcpu()->ci_data.cpu_nintr++;
 
+#if 0
+	/*
+	 * According to Giano simulator sources (Cpus/mips_cpu.cpp),
+	 * interrupt register bits in CAUSE register are updated
+	 * only when the exception is triggered. This means checking
+	 * CAUSE register via splintr() in a while loop in this
+	 * interrupt handler doesn't work as expected on Giano.
+	 *
+	 * I don't know whether the real FPGA eMIPS has the same
+	 * design as the Giano simulator, but for now I'd like to
+	 * choose 'call only one handler per each interrupt' strategy,
+	 * as the original NetBSD/emips implementation.
+	 */
 	while (ppl < (ipl = splintr())) {
 		splx(ipl);
 		/* device interrupts */
@@ -110,6 +123,14 @@ cpu_intr(int ppl, vaddr_t pc, uint32_t s
 		}
 		(void)splhigh();
 	}
+#else
+	ipl = splintr();
+	__USE(ipl);
+	/* device interrupts */
+	if (ipending & MIPS_INT_MASK_5) {
+		(*platform.iointr)(status, pc, ipending);
+	}
+#endif
 }
 
 /*



CVS commit: src/sys/arch/emips/emips

2019-12-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Dec  9 16:19:11 UTC 2019

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

Log Message:
Fix incorrect argument order of cpu_intr(), slipped in rev 1.2.

Pointed out by maya@ in PR/45080.

Should be pulled up to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/emips/emips/interrupt.c

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

Modified files:

Index: src/sys/arch/emips/emips/interrupt.c
diff -u src/sys/arch/emips/emips/interrupt.c:1.6 src/sys/arch/emips/emips/interrupt.c:1.7
--- src/sys/arch/emips/emips/interrupt.c:1.6	Mon Jul 11 16:18:56 2016
+++ src/sys/arch/emips/emips/interrupt.c	Mon Dec  9 16:19:11 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: interrupt.c,v 1.6 2016/07/11 16:18:56 matt Exp $	*/
+/*	$NetBSD: interrupt.c,v 1.7 2019/12/09 16:19:11 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.6 2016/07/11 16:18:56 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.7 2019/12/09 16:19:11 tsutsui Exp $");
 
 #include 
 #include 
@@ -95,7 +95,7 @@ intr_init(void)
  * emips uses one line for all I/O interrupts (0x8000).
  */
 void
-cpu_intr(int ppl, uint32_t status, vaddr_t pc)
+cpu_intr(int ppl, vaddr_t pc, uint32_t status)
 {
 	uint32_t ipending;
 	int ipl;



CVS commit: src/sys/arch/emips/emips

2017-07-30 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Sun Jul 30 11:38:57 UTC 2017

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

Log Message:
Initialize iospace_size instead of iospace (will be overwritten) to 64k.
Brings boot of emips on giano a bit closer, but now it's stuck (hangs).


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/emips/emips/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/emips/emips/machdep.c
diff -u src/sys/arch/emips/emips/machdep.c:1.12 src/sys/arch/emips/emips/machdep.c:1.13
--- src/sys/arch/emips/emips/machdep.c:1.12	Thu Dec 22 14:47:54 2016
+++ src/sys/arch/emips/emips/machdep.c	Sun Jul 30 11:38:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.12 2016/12/22 14:47:54 cherry Exp $	*/
+/*	$NetBSD: machdep.c,v 1.13 2017/07/30 11:38:57 he Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.12 2016/12/22 14:47:54 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.13 2017/07/30 11:38:57 he Exp $");
 
 #include "opt_ddb.h"
 
@@ -82,8 +82,8 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 #include 
 #endif
 
-vaddr_t iospace = 64 * 1024; /* BUGBUG make it an option? */
-vsize_t iospace_size;
+vaddr_t iospace;
+vsize_t iospace_size = 64 * 1024; /* BUGBUG make it an option? */
 
 #include "ksyms.h"
 



CVS commit: src/sys/arch/emips/emips

2015-06-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jun  9 22:48:54 UTC 2015

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

Log Message:
#include sys/cpu.h


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/emips/emips/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/emips/emips/cpu.c
diff -u src/sys/arch/emips/emips/cpu.c:1.2 src/sys/arch/emips/emips/cpu.c:1.3
--- src/sys/arch/emips/emips/cpu.c:1.2	Tue Feb 22 08:20:20 2011
+++ src/sys/arch/emips/emips/cpu.c	Tue Jun  9 22:48:54 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.2 2011/02/22 08:20:20 matt Exp $ */
+/* $NetBSD: cpu.c,v 1.3 2015/06/09 22:48:54 matt Exp $ */
 
 /*
  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -28,11 +28,12 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.2 2011/02/22 08:20:20 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.3 2015/06/09 22:48:54 matt Exp $);
 
 #include ioconf.h
 
 #include sys/param.h
+#include sys/cpu.h
 #include sys/device.h
 #include sys/systm.h
 



CVS commit: src/sys/arch/emips/emips

2011-06-12 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jun 12 13:40:14 UTC 2011

Modified Files:
src/sys/arch/emips/emips: promcall.c

Log Message:
Some KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/emips/emips/promcall.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/emips/emips/promcall.c
diff -u src/sys/arch/emips/emips/promcall.c:1.2 src/sys/arch/emips/emips/promcall.c:1.3
--- src/sys/arch/emips/emips/promcall.c:1.2	Tue Feb  8 20:20:11 2011
+++ src/sys/arch/emips/emips/promcall.c	Sun Jun 12 13:40:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: promcall.c,v 1.2 2011/02/08 20:20:11 rmind Exp $	*/
+/*	$NetBSD: promcall.c,v 1.3 2011/06/12 13:40:14 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: promcall.c,v 1.2 2011/02/08 20:20:11 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: promcall.c,v 1.3 2011/06/12 13:40:14 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -60,16 +60,19 @@
 static int  nogetsysid(void);
 static void nohalt(int *, int);
 
-/* Callback vector. We keep this fall-back copy jic the bootloader is broken.
+/*
+ * Callback vector. We keep this fall-back copy jic the bootloader is broken.
  */
 static void *nope(void)
 {
-return NULL;
+
+	return NULL;
 }
 
 static int  nogetchar(void)
 {
-return -1;
+
+	return -1;
 }
 
 static void noprintf(const char *fmt, ...)
@@ -78,56 +81,58 @@
 
 static int  nogetsysid(void)
 {
-/* say its an eMIPS, ML board */
-return MAKESYSID(1,1,XS_ML40x,MIPS_eMIPS);
+
+	/* say its an eMIPS, ML board */
+	return MAKESYSID(1, 1, XS_ML40x, MIPS_eMIPS);
 }
 
 static void nohalt(int *unused, int howto)
 {
-	while(1) ;	/* fool gcc */
+
+	while (1);	/* fool gcc */
 	/*NOTREACHED*/
 }
 
 const struct callback callvec = {
-nope,
-nope,
-nope,
-nope,
-nope,
-nope,
-nope,
-nope,
-nope,
+	nope,
+	nope,
+	nope,
+	nope,
+	nope,
+	nope,
+	nope,
+	nope,
+	nope,
 	nogetchar,
-nope,
-nope,
+	nope,
+	nope,
 	noprintf,
-nope,
-nope,
-nope,
-nope,
-nope,
-nope,
-nope,
-nope,
-nope,
-nope,
-nope,
-nope,
-nope,
-nope,
-nope,
-nope,
-nope,
-nope,
-nope,
-nogetsysid,
-nope,
-nope,
-nope,
-nope,
-nope,
-nope,
+	nope,
+	nope,
+	nope,
+	nope,
+	nope,
+	nope,
+	nope,
+	nope,
+	nope,
+	nope,
+	nope,
+	nope,
+	nope,
+	nope,
+	nope,
+	nope,
+	nope,
+	nope,
+	nope,
+	nogetsysid,
+	nope,
+	nope,
+	nope,
+	nope,
+	nope,
+	nope,
 	nohalt
 };
 
@@ -166,8 +171,7 @@
  * Print a character on PROM console.
  */
 static void
-romputc(dev_t dev,
-int c)
+romputc(dev_t dev, int c)
 {
 	int s;
 
@@ -186,7 +190,8 @@
 int
 prom_systype(void)
 {
-return (*callv-_getsysid)();
+
+	return (*callv-_getsysid)();
 }
 
 /*
@@ -195,8 +200,8 @@
 void __attribute__((__noreturn__))
 prom_halt(int howto)
 {
+
 	(*callv-_halt)((int *)0, howto);
 	while(1) ;	/* fool gcc */
 	/*NOTREACHED*/
 }
-



CVS commit: src/sys/arch/emips/emips

2011-06-11 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jun 12 03:14:03 UTC 2011

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

Log Message:
- misc KNF
- use device_xname(), device_unit(), and device_class()


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/emips/emips/autoconf.c

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

Modified files:

Index: src/sys/arch/emips/emips/autoconf.c
diff -u src/sys/arch/emips/emips/autoconf.c:1.3 src/sys/arch/emips/emips/autoconf.c:1.4
--- src/sys/arch/emips/emips/autoconf.c:1.3	Tue Feb 22 08:20:20 2011
+++ src/sys/arch/emips/emips/autoconf.c	Sun Jun 12 03:14:03 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.3 2011/02/22 08:20:20 matt Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.4 2011/06/12 03:14:03 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.3 2011/02/22 08:20:20 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.4 2011/06/12 03:14:03 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -60,6 +60,7 @@
 void
 cpu_configure(void)
 {
+
 	/* Kick off autoconfiguration. */
 	(void)splhigh();
 
@@ -80,56 +81,63 @@
 /*
  * Look at the string 'cp' and decode the boot device.
  * Boot names are something like '0/ace(0,0)/netbsd' or 'tftp()/nfsnetbsd'
- * meaning: [BusNumber/]ControllerName([DiskNumber,PartitionNumber])/kernelname
+ * meaning:
+ *  [BusNumber/]ControllerName([DiskNumber,PartitionNumber])/kernelname
  */
 void
 makebootdev(char *cp)
 {
-int i;
-static char booted_controller_name[8];
+	int i;
+	static char booted_controller_name[8];
 
 	booted_device = NULL;
 	booted_bus = booted_unit = booted_partition = 0;
 	booted_controller = NULL;
 
-if (*cp = '0'  *cp = '9') {
-booted_bus = *cp++ - '0';
-if (*cp == '/') cp++;
-}
+	if (*cp = '0'  *cp = '9') {
+	booted_bus = *cp++ - '0';
+		if (*cp == '/')
+			cp++;
+	}
 
 	if (strncmp(cp, tftp(, 5) == 0) {
 		booted_controller = BOOTP;
 		goto out;
 	}
 
-/* Stash away the controller name and use it later
- */
-for (i = 0; i  7  *cp  *cp != '('; i++)
-booted_controller_name[i] = *cp++;
-booted_controller_name[7] = 0; /* sanity */
-
-if (*cp == '(') cp++;
-if (*cp = '0'  *cp = '9') 
-booted_unit = *cp++ - '0';
-
-if (*cp == ',') cp++;
-if (*cp = '0'  *cp = '9')
-booted_partition = *cp - '0';
-booted_controller = booted_controller_name;
+	/*
+	 * Stash away the controller name and use it later
+	 */
+	for (i = 0; i  7  *cp  *cp != '('; i++)
+		booted_controller_name[i] = *cp++;
+	booted_controller_name[7] = 0; /* sanity */
+
+	if (*cp == '(')
+		cp++;
+	if (*cp = '0'  *cp = '9') 
+		booted_unit = *cp++ - '0';
+
+	if (*cp == ',')
+		cp++;
+	if (*cp = '0'  *cp = '9')
+		booted_partition = *cp - '0';
+	booted_controller = booted_controller_name;
 
  out:
 #if DEBUG
-printf(bootdev: %d/%s(%d,%d)\n,booted_bus,booted_controller,booted_unit,booted_partition);
+	printf(bootdev: %d/%s(%d,%d)\n,
+	booted_bus, booted_controller, booted_unit, booted_partition);
 #endif
-return;
+	return;
 }
 
 void
 cpu_rootconf(void)
 {
+
 	printf(boot device: %s part%d\n,
-	booted_device ? booted_device-dv_xname : unknown,
-   booted_partition);
+	booted_device ? device_xname(booted_device) : unknown,
+	booted_partition);
 
 	setroot(booted_device, booted_partition);
 }
@@ -138,18 +146,18 @@
  * Try to determine the boot device.
  */
 void
-device_register(struct device *dev,
-void *aux)
+device_register(device_t dev, void *aux)
 {
 	static int found, initted, netboot;
-	static struct device *ebusdev;
-	struct device *parent = device_parent(dev);
+	static device_t ebusdev;
+	device_t parent = device_parent(dev);
 
 	if (found)
 		return;
 
 #if 0
-printf(\n[device_register(%s,%d) class %d]\n, dev-dv_xname, dev-dv_unit, dev-dv_class);
+	printf(\n[device_register(%s,%d) class %d]\n,
+	device_xname(dev), device_unit(dev), device_class(dev));
 #endif
 
 	if (!initted) {
@@ -161,7 +169,7 @@
 	 * Remember the EBUS
 	 */
 	if (device_is_a(dev, ebus)) {
-ebusdev = dev;
+		ebusdev = dev;
 		return;
 	}
 
@@ -170,9 +178,9 @@
 	 */
 	if (netboot) {
 
-/* Only one Ethernet interface (on ebus). */
-		if ((parent == ebusdev)
-		 device_is_a(dev, enic)) {
+		/* Only one Ethernet interface (on ebus). */
+		if ((parent == ebusdev) 
+		device_is_a(dev, enic)) {
 			booted_device = dev;
 			found = 1;
 			return;
@@ -186,15 +194,15 @@
 			return;
 		}
 
-/* The NIC might be found after the disk, so bail out here */
-return;
+		/* The NIC might be found after the disk, so bail out here */
+		return;
 	}
 
-/* BUGBUG How would I get to the bus */
-if (device_is_a(dev,booted_controller)  (dev-dv_unit == booted_unit)) {
-booted_device 

CVS commit: src/sys/arch/emips/emips

2011-03-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Mar 10 17:22:51 UTC 2011

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

Log Message:
Set correct struct clockframe .intr value for hardclock(9).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/emips/emips/interrupt.c

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

Modified files:

Index: src/sys/arch/emips/emips/interrupt.c
diff -u src/sys/arch/emips/emips/interrupt.c:1.2 src/sys/arch/emips/emips/interrupt.c:1.3
--- src/sys/arch/emips/emips/interrupt.c:1.2	Tue Feb 22 08:20:20 2011
+++ src/sys/arch/emips/emips/interrupt.c	Thu Mar 10 17:22:51 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: interrupt.c,v 1.2 2011/02/22 08:20:20 matt Exp $	*/
+/*	$NetBSD: interrupt.c,v 1.3 2011/03/10 17:22:51 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: interrupt.c,v 1.2 2011/02/22 08:20:20 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: interrupt.c,v 1.3 2011/03/10 17:22:51 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -127,6 +127,7 @@
 
 	cf.pc = pc;
 	cf.sr = status;
+	cf.intr = (curcpu()-ci_idepth  1);
 
 	ipending = TheAic-IrqStatus;
 



CVS commit: src/sys/arch/emips/emips

2011-02-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Feb 20 08:01:10 UTC 2011

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

Log Message:
Deal with mips_vector_init changes


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/emips/emips/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/emips/emips/machdep.c
diff -u src/sys/arch/emips/emips/machdep.c:1.2 src/sys/arch/emips/emips/machdep.c:1.3
--- src/sys/arch/emips/emips/machdep.c:1.2	Tue Feb  8 20:20:11 2011
+++ src/sys/arch/emips/emips/machdep.c	Sun Feb 20 08:01:10 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.2 2011/02/08 20:20:11 rmind Exp $	*/
+/*	$NetBSD: machdep.c,v 1.3 2011/02/20 08:01:10 matt Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.2 2011/02/08 20:20:11 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.3 2011/02/20 08:01:10 matt Exp $);
 
 #include opt_ddb.h
 
@@ -254,7 +254,7 @@
 	 * Initialize locore-function vector.
 	 * Clear out the I and D caches.
 	 */
-	mips_vector_init();
+	mips_vector_init(NULL, false);
 
 	/*
 	 * We know the CPU type now.  Initialize our DMA tags (might