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

2021-02-09 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Tue Feb  9 12:39:28 UTC 2021

Modified Files:
src/sys/arch/dreamcast/dev/g2: aica.c

Log Message:
Update function name in a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/dreamcast/dev/g2/aica.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/dreamcast/dev/g2/aica.c
diff -u src/sys/arch/dreamcast/dev/g2/aica.c:1.29 src/sys/arch/dreamcast/dev/g2/aica.c:1.30
--- src/sys/arch/dreamcast/dev/g2/aica.c:1.29	Sat Feb  6 09:14:03 2021
+++ src/sys/arch/dreamcast/dev/g2/aica.c	Tue Feb  9 12:39:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: aica.c,v 1.29 2021/02/06 09:14:03 isaki Exp $	*/
+/*	$NetBSD: aica.c,v 1.30 2021/02/09 12:39:28 isaki Exp $	*/
 
 /*
  * Copyright (c) 2003 SHIMIZU Ryo 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.29 2021/02/06 09:14:03 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.30 2021/02/09 12:39:28 isaki Exp $");
 
 #include 
 #include 
@@ -530,7 +530,7 @@ aica_intr(void *arg)
 
 	aica_fillbuffer(sc);
 
-	/* call audio interrupt handler (audio_pint()) */
+	/* call audio interrupt handler (audio_pintr()) */
 	if (sc->sc_intr != NULL) {
 		(*(sc->sc_intr))(sc->sc_intr_arg);
 	}



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

2021-02-06 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb  6 09:14:03 UTC 2021

Modified Files:
src/sys/arch/dreamcast/dev/g2: aica.c

Log Message:
Remove sc_open flag.
Counting {open,close} is done by the MI audio layer.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/dreamcast/dev/g2/aica.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/dreamcast/dev/g2/aica.c
diff -u src/sys/arch/dreamcast/dev/g2/aica.c:1.28 src/sys/arch/dreamcast/dev/g2/aica.c:1.29
--- src/sys/arch/dreamcast/dev/g2/aica.c:1.28	Sun Feb 23 04:02:45 2020
+++ src/sys/arch/dreamcast/dev/g2/aica.c	Sat Feb  6 09:14:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: aica.c,v 1.28 2020/02/23 04:02:45 isaki Exp $	*/
+/*	$NetBSD: aica.c,v 1.29 2021/02/06 09:14:03 isaki Exp $	*/
 
 /*
  * Copyright (c) 2003 SHIMIZU Ryo 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.28 2020/02/23 04:02:45 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.29 2021/02/06 09:14:03 isaki Exp $");
 
 #include 
 #include 
@@ -63,7 +63,6 @@ struct aica_softc {
 	bus_space_handle_t	sc_aica_memh;
 
 	/* audio property */
-	int			sc_open;
 	int			sc_precision;
 	int			sc_channels;
 	int			sc_rate;
@@ -125,8 +124,6 @@ void aica_fillbuffer(struct aica_softc *
 int aica_intr(void *);
 
 /* for audio */
-int aica_open(void *, int);
-void aica_close(void *);
 int aica_query_format(void *, audio_format_query_t *);
 int aica_set_format(void *, int,
 const audio_params_t *, const audio_params_t *,
@@ -145,8 +142,6 @@ int aica_get_props(void *);
 void aica_get_locks(void *, kmutex_t **, kmutex_t **);
 
 const struct audio_hw_if aica_hw_if = {
-	.open			= aica_open,
-	.close			= aica_close,
 	.query_format		= aica_query_format,
 	.set_format		= aica_set_format,
 	.round_blocksize	= aica_round_blocksize,
@@ -389,31 +384,6 @@ aica_ch2p8write(struct aica_softc *sc, b
 }
 
 int
-aica_open(void *addr, int flags)
-{
-	struct aica_softc *sc;
-
-	sc = addr;
-	if (sc->sc_open)
-		return EBUSY;
-
-	sc->sc_intr = NULL;
-	sc->sc_open = 1;
-
-	return 0;
-}
-
-void
-aica_close(void *addr)
-{
-	struct aica_softc *sc;
-
-	sc = addr;
-	sc->sc_open = 0;
-	sc->sc_intr = NULL;
-}
-
-int
 aica_query_format(void *addr, audio_format_query_t *afp)
 {
 
@@ -561,7 +531,7 @@ aica_intr(void *arg)
 	aica_fillbuffer(sc);
 
 	/* call audio interrupt handler (audio_pint()) */
-	if (sc->sc_open && sc->sc_intr != NULL) {
+	if (sc->sc_intr != NULL) {
 		(*(sc->sc_intr))(sc->sc_intr_arg);
 	}
 
@@ -610,6 +580,7 @@ aica_halt_output(void *addr)
 
 	sc = addr;
 	aica_command(sc, AICA_COMMAND_STOP);
+	sc->sc_intr = NULL;
 	return 0;
 }
 



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

2020-11-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Nov 25 15:31:15 UTC 2020

Modified Files:
src/sys/arch/dreamcast/conf: majors.dreamcast

Log Message:
Reserve device-major for ld(4) on possible sdmmc(4) at scimci.

 https://mail-index.netbsd.org/port-dreamcast/2014/10/25/msg000263.html
 https://mail-index.netbsd.org/port-dreamcast/2014/10/30/msg000265.html


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/dreamcast/conf/majors.dreamcast

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

Modified files:

Index: src/sys/arch/dreamcast/conf/majors.dreamcast
diff -u src/sys/arch/dreamcast/conf/majors.dreamcast:1.25 src/sys/arch/dreamcast/conf/majors.dreamcast:1.26
--- src/sys/arch/dreamcast/conf/majors.dreamcast:1.25	Sat Apr  4 16:06:12 2020
+++ src/sys/arch/dreamcast/conf/majors.dreamcast	Wed Nov 25 15:31:15 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: majors.dreamcast,v 1.25 2020/04/04 16:06:12 jdolecek Exp $
+#	$NetBSD: majors.dreamcast,v 1.26 2020/11/25 15:31:15 tsutsui Exp $
 #
 # Device majors for dreamcast
 #
@@ -58,6 +58,7 @@ device-major	mlcd		char 63			mlcd
 device-major	ksyms		char 64			ksyms
 device-major	wsfont		char 65			wsfont
 #device-major	obsolete	char 66			obsolete (opencrypto)
+device-major	ld		char 67  block 22	ld
 
 #device-major	obsolete	char 98			obsolete (nsmb)
 



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

2019-05-06 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Mon May  6 17:16:41 UTC 2019

Modified Files:
src/sys/arch/dreamcast/dev/maple: maple.c

Log Message:
cv_init() must be done before calling maple_scanbus().
ok tsutsui@


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/dreamcast/dev/maple/maple.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/dreamcast/dev/maple/maple.c
diff -u src/sys/arch/dreamcast/dev/maple/maple.c:1.52 src/sys/arch/dreamcast/dev/maple/maple.c:1.53
--- src/sys/arch/dreamcast/dev/maple/maple.c:1.52	Sun Dec  6 02:04:10 2015
+++ src/sys/arch/dreamcast/dev/maple/maple.c	Mon May  6 17:16:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: maple.c,v 1.52 2015/12/06 02:04:10 tsutsui Exp $	*/
+/*	$NetBSD: maple.c,v 1.53 2019/05/06 17:16:41 ryo Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: maple.c,v 1.52 2015/12/06 02:04:10 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: maple.c,v 1.53 2019/05/06 17:16:41 ryo Exp $");
 
 #include 
 #include 
@@ -246,14 +246,14 @@ mapleattach(device_t parent, device_t se
 
 	MAPLE_ENABLE = 1;
 
-	maple_polling = 1;
-	maple_scanbus(sc);
-
 	mutex_init(>sc_dma_lock, MUTEX_DEFAULT, IPL_MAPLE);
 	cv_init(>sc_dma_cv, device_xname(self));
 	mutex_init(>sc_event_lock, MUTEX_DEFAULT, IPL_SOFTCLOCK);
 	cv_init(>sc_event_cv, device_xname(self));
 
+	maple_polling = 1;
+	maple_scanbus(sc);
+
 	callout_init(>maple_callout_ch, 0);
 
 	sc->sc_intrhand = sysasic_intr_establish(SYSASIC_EVENT_MAPLE_DMADONE,



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

2019-05-06 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Mon May  6 17:12:50 UTC 2019

Modified Files:
src/sys/arch/dreamcast/dev/g2: aica.c
src/sys/arch/dreamcast/dev/microcode: Makefile aica_arm.c
aica_arm_locore.S aica_armcode.h

Log Message:
don't use tsleep() in interrupt context.
when the audio starts playing, initialization is performed on the aica arm 
driver side.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/dreamcast/dev/g2/aica.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/dreamcast/dev/microcode/Makefile
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/dreamcast/dev/microcode/aica_arm.c
cvs rdiff -u -r1.2 -r1.3 \
src/sys/arch/dreamcast/dev/microcode/aica_arm_locore.S
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/dreamcast/dev/microcode/aica_armcode.h

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

Modified files:

Index: src/sys/arch/dreamcast/dev/g2/aica.c
diff -u src/sys/arch/dreamcast/dev/g2/aica.c:1.25 src/sys/arch/dreamcast/dev/g2/aica.c:1.26
--- src/sys/arch/dreamcast/dev/g2/aica.c:1.25	Sat Mar 16 12:09:56 2019
+++ src/sys/arch/dreamcast/dev/g2/aica.c	Mon May  6 17:12:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: aica.c,v 1.25 2019/03/16 12:09:56 isaki Exp $	*/
+/*	$NetBSD: aica.c,v 1.26 2019/05/06 17:12:50 ryo Exp $	*/
 
 /*
  * Copyright (c) 2003 SHIMIZU Ryo 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.25 2019/03/16 12:09:56 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.26 2019/05/06 17:12:50 ryo Exp $");
 
 #include 
 #include 
@@ -616,8 +616,6 @@ aica_trigger_output(void *addr, void *st
 	struct aica_softc *sc;
 
 	sc = addr;
-	aica_command(sc, AICA_COMMAND_INIT);
-	tsleep(aica_trigger_output, PWAIT, "aicawait", hz / 20);
 
 	sc->sc_buffer_start = sc->sc_buffer = start;
 	sc->sc_buffer_end = end;
@@ -627,9 +625,12 @@ aica_trigger_output(void *addr, void *st
 	sc->sc_intr = intr;
 	sc->sc_intr_arg = arg;
 
-	/* fill buffers in advance */
-	aica_intr(sc);
-	aica_intr(sc);
+	/*
+	 * The aica arm side driver uses a double buffer to play sounds.
+	 * we need to fill two buffers before playing.
+	 */
+	aica_fillbuffer(sc);
+	aica_fillbuffer(sc);
 
 	/* ...and start playing */
 	aica_play(sc, blksize / sc->sc_channels, sc->sc_channels, sc->sc_rate,

Index: src/sys/arch/dreamcast/dev/microcode/Makefile
diff -u src/sys/arch/dreamcast/dev/microcode/Makefile:1.4 src/sys/arch/dreamcast/dev/microcode/Makefile:1.5
--- src/sys/arch/dreamcast/dev/microcode/Makefile:1.4	Sat Mar  4 02:00:16 2006
+++ src/sys/arch/dreamcast/dev/microcode/Makefile	Mon May  6 17:12:50 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2006/03/04 02:00:16 uwe Exp $
+#	$NetBSD: Makefile,v 1.5 2019/05/06 17:12:50 ryo Exp $
 
 S	= ${.CURDIR}/../../../..
 
@@ -6,7 +6,7 @@ CC	= ${TOOLDIR}/bin/arm--netbsdelf-gcc
 OBJCOPY	= ${TOOLDIR}/bin/arm--netbsdelf-objcopy
 
 CFLAGS	= -W -Wall -mlittle-endian
-CFLAGS	+= -O3 -mcpu=arm7tdmi
+CFLAGS	+= -O3 -mcpu=arm7
 CFLAGS	+= -fomit-frame-pointer -funroll-loops -finline-functions
 CFLAGS	+= -I${S}
 #AFLAGS	= -mcpu=arm7tdmi -mthumb -mthumb-interwork -mapcs-32

Index: src/sys/arch/dreamcast/dev/microcode/aica_arm.c
diff -u src/sys/arch/dreamcast/dev/microcode/aica_arm.c:1.5 src/sys/arch/dreamcast/dev/microcode/aica_arm.c:1.6
--- src/sys/arch/dreamcast/dev/microcode/aica_arm.c:1.5	Wed Mar 18 10:22:27 2009
+++ src/sys/arch/dreamcast/dev/microcode/aica_arm.c	Mon May  6 17:12:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: aica_arm.c,v 1.5 2009/03/18 10:22:27 cegger Exp $	*/
+/*	$NetBSD: aica_arm.c,v 1.6 2019/05/06 17:12:50 ryo Exp $	*/
 
 /*
  * Copyright (c) 2003 SHIMIZU Ryo 
@@ -267,8 +267,13 @@ aica_main(void)
 			break;
 
 		case AICA_COMMAND_PLAY:
+			aica_stop();
+			play_state = 0;
+
 			blksize = aicacmd->blocksize;
 
+			REG_WRITE_4(0x28b4, 0x0020);	/* INT Enable to SH4 */
+
 			CH_WRITE_4(0, 0x00, 0x8000);
 			CH_WRITE_4(1, 0x00, 0x8000);
 

Index: src/sys/arch/dreamcast/dev/microcode/aica_arm_locore.S
diff -u src/sys/arch/dreamcast/dev/microcode/aica_arm_locore.S:1.2 src/sys/arch/dreamcast/dev/microcode/aica_arm_locore.S:1.3
--- src/sys/arch/dreamcast/dev/microcode/aica_arm_locore.S:1.2	Sun Dec 11 12:17:06 2005
+++ src/sys/arch/dreamcast/dev/microcode/aica_arm_locore.S	Mon May  6 17:12:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: aica_arm_locore.S,v 1.2 2005/12/11 12:17:06 christos Exp $	*/
+/*	$NetBSD: aica_arm_locore.S,v 1.3 2019/05/06 17:12:50 ryo Exp $	*/
 
 /*
  * Copyright (c) 2003 SHIMIZU Ryo 
@@ -29,7 +29,6 @@
  */
 
 	.text
-	.globl
 
 	b	exp_reset
 	b	exp_undef

Index: src/sys/arch/dreamcast/dev/microcode/aica_armcode.h
diff -u src/sys/arch/dreamcast/dev/microcode/aica_armcode.h:1.3 src/sys/arch/dreamcast/dev/microcode/aica_armcode.h:1.4
--- src/sys/arch/dreamcast/dev/microcode/aica_armcode.h:1.3	Sun Dec 11 12:17:06 2005
+++ src/sys/arch/dreamcast/dev/microcode/aica_armcode.h	Mon May  6 17:12:50 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: aica_armcode.h,v 1.3 2005/12/11 

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

2018-03-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar  3 23:27:51 UTC 2018

Modified Files:
src/sys/arch/dreamcast/dev/g2: aica.c

Log Message:
this ain't python, thanks gcc6.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/dreamcast/dev/g2/aica.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/dreamcast/dev/g2/aica.c
diff -u src/sys/arch/dreamcast/dev/g2/aica.c:1.23 src/sys/arch/dreamcast/dev/g2/aica.c:1.24
--- src/sys/arch/dreamcast/dev/g2/aica.c:1.23	Tue Jul 25 19:18:04 2017
+++ src/sys/arch/dreamcast/dev/g2/aica.c	Sat Mar  3 18:27:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: aica.c,v 1.23 2017/07/25 23:18:04 nat Exp $	*/
+/*	$NetBSD: aica.c,v 1.24 2018/03/03 23:27:51 christos Exp $	*/
 
 /*
  * Copyright (c) 2003 SHIMIZU Ryo 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.23 2017/07/25 23:18:04 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.24 2018/03/03 23:27:51 christos Exp $");
 
 #include 
 #include 
@@ -414,8 +414,9 @@ aica_ch2p8write(struct aica_softc *sc, b
 
 	if (len) {
 		p = (uint8_t *)buf;
-		for (i = 0; i < len; i++)
+		for (i = 0; i < len; i++) {
 			*p++ = *src++; src++;
+		}
 
 		aica_g2fifo_wait();
 		bus_space_write_region_4(sc->sc_memt, sc->sc_aica_memh,



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

2017-07-25 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Jul 25 23:20:57 UTC 2017

Modified Files:
src/sys/arch/dreamcast/conf: G1IDE GENERIC

Log Message:
Use the correct attachment for dreamcast audio.

Found and tested by Bjorn Johannesson on port-dreamcast.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/dreamcast/conf/G1IDE
cvs rdiff -u -r1.125 -r1.126 src/sys/arch/dreamcast/conf/GENERIC

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

Modified files:

Index: src/sys/arch/dreamcast/conf/G1IDE
diff -u src/sys/arch/dreamcast/conf/G1IDE:1.1 src/sys/arch/dreamcast/conf/G1IDE:1.2
--- src/sys/arch/dreamcast/conf/G1IDE:1.1	Thu Dec 29 11:49:05 2016
+++ src/sys/arch/dreamcast/conf/G1IDE	Tue Jul 25 23:20:57 2017
@@ -1,4 +1,4 @@
-# $NetBSD: G1IDE,v 1.1 2016/12/29 11:49:05 tsutsui Exp $
+# $NetBSD: G1IDE,v 1.2 2017/07/25 23:20:57 nat Exp $
 
 include 	"arch/dreamcast/conf/std.dreamcast"
 
@@ -190,7 +190,7 @@ rlphy*		at mii? phy ?
 mbe*		at g2bus?			# SEGA LAN Adapter
 
 #aica*		at g2bus?			# AICA Sound Processing Unit
-#audio*		at aica?
+#audio*		at audiobus?
 
 #spkr*		at audio?		# PC speaker (synthesized)
 

Index: src/sys/arch/dreamcast/conf/GENERIC
diff -u src/sys/arch/dreamcast/conf/GENERIC:1.125 src/sys/arch/dreamcast/conf/GENERIC:1.126
--- src/sys/arch/dreamcast/conf/GENERIC:1.125	Tue Dec 13 20:42:17 2016
+++ src/sys/arch/dreamcast/conf/GENERIC	Tue Jul 25 23:20:57 2017
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.125 2016/12/13 20:42:17 christos Exp $
+# $NetBSD: GENERIC,v 1.126 2017/07/25 23:20:57 nat Exp $
 #
 # GENERIC machine description file
 # 
@@ -191,7 +191,7 @@ rlphy*		at mii? phy ?
 mbe*		at g2bus?			# SEGA LAN Adapter
 
 aica*		at g2bus?			# AICA Sound Processing Unit
-audio*		at aica?
+audio*		at audiobus?
 
 spkr*		at audio?		# PC speaker (synthesized)
 



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

2017-07-25 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Jul 25 23:18:04 UTC 2017

Modified Files:
src/sys/arch/dreamcast/dev/g2: aica.c

Log Message:
Dreamcast audio only supports playback so set it in the props.
This makes dreamcast audio work again.

Tested by Bjorn Johannesson.
cvs: --


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/dreamcast/dev/g2/aica.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/dreamcast/dev/g2/aica.c
diff -u src/sys/arch/dreamcast/dev/g2/aica.c:1.22 src/sys/arch/dreamcast/dev/g2/aica.c:1.23
--- src/sys/arch/dreamcast/dev/g2/aica.c:1.22	Wed Nov 23 23:07:29 2011
+++ src/sys/arch/dreamcast/dev/g2/aica.c	Tue Jul 25 23:18:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: aica.c,v 1.22 2011/11/23 23:07:29 jmcneill Exp $	*/
+/*	$NetBSD: aica.c,v 1.23 2017/07/25 23:18:04 nat Exp $	*/
 
 /*
  * Copyright (c) 2003 SHIMIZU Ryo 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.22 2011/11/23 23:07:29 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.23 2017/07/25 23:18:04 nat Exp $");
 
 #include 
 #include 
@@ -774,7 +774,7 @@ int
 aica_get_props(void *addr)
 {
 
-	return 0;
+	return AUDIO_PROP_PLAYBACK;
 }
 
 void



CVS commit: src/sys/arch/dreamcast

2016-12-29 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Dec 29 11:49:05 UTC 2016

Modified Files:
src/sys/arch/dreamcast/conf: files.dreamcast
Added Files:
src/sys/arch/dreamcast/conf: G1IDE
src/sys/arch/dreamcast/dev/g1: g1bus.c g1bus_bus_mem.c g1busvar.h
gdrom.c wdc_g1.c

Log Message:
WIP "G1-ATA" IDE HDD support.  Not enabled by default.

Demonstrated on NetBSD booth at Open Source Conference 2016 Tokyo Fall
and Kansai Open Source 2016:
 http://mail-index.netbsd.org/netbsd-advocacy/2016/11/09/msg000721.html
 http://mail-index.netbsd.org/netbsd-advocacy/2016/11/16/msg000722.html

See my port-dreamcast@ post for more details:
 http://mail-index.netbsd.org/port-dreamcast/2016/12/18/msg000295.html


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/dreamcast/conf/G1IDE
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/dreamcast/conf/files.dreamcast
cvs rdiff -u -r0 -r1.1 src/sys/arch/dreamcast/dev/g1/g1bus.c \
src/sys/arch/dreamcast/dev/g1/g1bus_bus_mem.c \
src/sys/arch/dreamcast/dev/g1/g1busvar.h \
src/sys/arch/dreamcast/dev/g1/gdrom.c \
src/sys/arch/dreamcast/dev/g1/wdc_g1.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/dreamcast/conf/files.dreamcast
diff -u src/sys/arch/dreamcast/conf/files.dreamcast:1.30 src/sys/arch/dreamcast/conf/files.dreamcast:1.31
--- src/sys/arch/dreamcast/conf/files.dreamcast:1.30	Wed Feb 20 21:43:33 2008
+++ src/sys/arch/dreamcast/conf/files.dreamcast	Thu Dec 29 11:49:05 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: files.dreamcast,v 1.30 2008/02/20 21:43:33 drochner Exp $
+#	$NetBSD: files.dreamcast,v 1.31 2016/12/29 11:49:05 tsutsui Exp $
 
 # maxpartitions must be first item in files.${MACHINE}
 maxpartitions 16
@@ -77,9 +77,19 @@ device	pvr: wsemuldisplaydev, rasops16
 attach	pvr at shb
 file	arch/dreamcast/dev/pvr.c			pvr	needs-flag
 
+device	g1bus { }
+attach	g1bus at shb
+file	arch/dreamcast/dev/g1/g1bus.c			g1bus
+file	arch/dreamcast/dev/g1/g1bus_bus_mem.c		g1bus
+
+attach	wdc at g1bus with wdc_g1bus
+file	arch/dreamcast/dev/g1/wdc_g1.c			wdc_g1bus
+
 device	gdrom: disk
 attach	gdrom at shb
 file	arch/dreamcast/dev/gdrom.c			gdrom	needs-flag
+#attach	gdrom at atapibus
+#file	arch/dreamcast/dev/g1/gdrom.c			gdrom	needs-flag
 
 device	g2bus { }
 attach	g2bus at shb

Added files:

Index: src/sys/arch/dreamcast/conf/G1IDE
diff -u /dev/null src/sys/arch/dreamcast/conf/G1IDE:1.1
--- /dev/null	Thu Dec 29 11:49:05 2016
+++ src/sys/arch/dreamcast/conf/G1IDE	Thu Dec 29 11:49:05 2016
@@ -0,0 +1,248 @@
+# $NetBSD: G1IDE,v 1.1 2016/12/29 11:49:05 tsutsui Exp $
+
+include 	"arch/dreamcast/conf/std.dreamcast"
+
+options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
+
+maxusers	16		# estimated number of users
+
+# Standard system options
+#options 	INSECURE	# disable kernel security levels
+
+#options 	RTC_OFFSET=-540
+options 	HZ=100		# clock interrupt generates every 1/HZ sec
+options 	NTP		# NTP phase/frequency locked loop
+
+options 	KTRACE		# system call tracing via ktrace(1)
+
+options 	USERCONF	# userconf(4) support
+#options 	PIPE_SOCKETPAIR	# smaller, but slower pipe(2)
+options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
+
+options 	SYSVMSG		# System V-like message queues
+options 	SYSVSEM		# System V-like semaphores
+options 	SYSVSHM		# System V-like memory sharing
+
+#options 	MODULAR		# new style module(7) framework
+#options 	MODULAR_DEFAULT_AUTOLOAD
+
+# Alternate buffer queue strategies for better responsiveness under high
+# disk I/O load.
+#options 	BUFQ_READPRIO
+options 	BUFQ_PRIOCSCAN
+
+# Diagnostic/debugging support options
+options 	DIAGNOSTIC	# cheap kernel consistency checks
+#options 	DEBUG		# expensive debugging checks/support
+options 	DDB		# in-kernel debugger
+#options 	KGDB			# remote debugger
+#options 	"KGDB_DEVNAME=\"scif\"",KGDB_DEVRATE=57600
+#makeoptions	DEBUG="-g"	# compile full symbol table
+makeoptions	COPY_SYMTAB=1
+#options 	SYSCALL_DEBUG
+#options 	UVMHIST
+#options 	UVMHIST_PRINT
+
+# Compatibility options
+options 	COMPAT_16	# NetBSD 1.6,
+options 	COMPAT_20	# NetBSD 2.0,
+options 	COMPAT_30	# NetBSD 3.0,
+options 	COMPAT_40	# NetBSD 4.0,
+options 	COMPAT_50	# NetBSD 5.0,
+options 	COMPAT_60	# NetBSD 6.0, and
+options 	COMPAT_70	# NetBSD 7.0 binary compatibility.
+options 	COMPAT_43	# and 4.3BSD
+#options 	TCP_COMPAT_42	# 4.2BSD TCP/IP bug compat. Not recommended.
+options 	COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.
+
+# Executable format options
+options 	EXEC_COFF	# COFF executables
+
+# File systems
+file-system 	FFS		# UFS
+#file-system	EXT2FS		# second extended file system (linux)
+#file-system	LFS		# log-structured file system
+file-system 	MFS		# memory file system
+file-system 	NFS		# Network File System client
+file-system	CD9660		# CD-ROM file system
+file-system	MSDOSFS		# MS-DOS file system
+file-system	FDESC		# /dev/fd
+file-system 	KERNFS		# 

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

2016-10-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct  9 14:41:47 UTC 2016

Modified Files:
src/sys/arch/dreamcast/dev/g2: g2rtc.c

Log Message:
PR/51540: Henning Petersen: replace , with ;


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/dreamcast/dev/g2/g2rtc.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/dreamcast/dev/g2/g2rtc.c
diff -u src/sys/arch/dreamcast/dev/g2/g2rtc.c:1.7 src/sys/arch/dreamcast/dev/g2/g2rtc.c:1.8
--- src/sys/arch/dreamcast/dev/g2/g2rtc.c:1.7	Sun Nov 16 21:15:48 2014
+++ src/sys/arch/dreamcast/dev/g2/g2rtc.c	Sun Oct  9 10:41:47 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: g2rtc.c,v 1.7 2014/11/17 02:15:48 christos Exp $ */
+/* $NetBSD: g2rtc.c,v 1.8 2016/10/09 14:41:47 christos Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: g2rtc.c,v 1.7 2014/11/17 02:15:48 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: g2rtc.c,v 1.8 2016/10/09 14:41:47 christos Exp $");
 
 #include 
 #include 
@@ -99,8 +99,8 @@ g2rtc_attach(device_t parent, device_t s
 
 	tch = >sc_tch;
 	tch->cookie = sc;
-	tch->todr_gettime = g2rtc_todr_gettime,
-	tch->todr_settime = g2rtc_todr_settime,
+	tch->todr_gettime = g2rtc_todr_gettime;
+	tch->todr_settime = g2rtc_todr_settime;
 	todr_attach(tch);
 }
 



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

2016-03-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 13 17:59:20 UTC 2016

Modified Files:
src/sys/arch/dreamcast/dev: gdrom.c

Log Message:
PR/50964: David Binderman: Avoid signed overflow warning


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/dreamcast/dev/gdrom.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/dreamcast/dev/gdrom.c
diff -u src/sys/arch/dreamcast/dev/gdrom.c:1.41 src/sys/arch/dreamcast/dev/gdrom.c:1.42
--- src/sys/arch/dreamcast/dev/gdrom.c:1.41	Sun Apr 26 11:15:19 2015
+++ src/sys/arch/dreamcast/dev/gdrom.c	Sun Mar 13 13:59:20 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdrom.c,v 1.41 2015/04/26 15:15:19 mlelstv Exp $	*/
+/*	$NetBSD: gdrom.c,v 1.42 2016/03/13 17:59:20 christos Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt
@@ -33,7 +33,7 @@
  */
 
 #include 			/* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: gdrom.c,v 1.41 2015/04/26 15:15:19 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gdrom.c,v 1.42 2016/03/13 17:59:20 christos Exp $");
 
 #include 
 #include 
@@ -132,7 +132,7 @@ struct gd_toc {
 #define TOC_CTRL(n)	(((n) & 0xf0) >> 4)
 #define TOC_TRACK(n)	(((n) & 0xff00) >> 8)
 
-#define GDROM(o)	(*(volatile uint8_t *)(0xa05f7000 + (o)))
+#define GDROM(o)	(*(volatile uint8_t *)(0xa05f7000U + (o)))
 
 #define GDSTATSTAT(n)	((n) & 0xf)
 #define GDSTATDISK(n)	(((n) >> 4) & 0xf)



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

2016-03-11 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Mar 11 13:16:55 UTC 2016

Modified Files:
src/sys/arch/dreamcast/dev: pvr.c

Log Message:
Properly zero out struct fb_devconfig, including rasops_info.

Fix panic after wsconscfg(8) from serial console, caused by
a junk function pointer.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/dreamcast/dev/pvr.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/dreamcast/dev/pvr.c
diff -u src/sys/arch/dreamcast/dev/pvr.c:1.35 src/sys/arch/dreamcast/dev/pvr.c:1.36
--- src/sys/arch/dreamcast/dev/pvr.c:1.35	Wed Mar 26 16:08:45 2014
+++ src/sys/arch/dreamcast/dev/pvr.c	Fri Mar 11 13:16:55 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pvr.c,v 1.35 2014/03/26 16:08:45 christos Exp $	*/
+/*	$NetBSD: pvr.c,v 1.36 2016/03/11 13:16:55 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt.
@@ -35,7 +35,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pvr.c,v 1.35 2014/03/26 16:08:45 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pvr.c,v 1.36 2016/03/11 13:16:55 tsutsui Exp $");
 
 #include 
 #include 
@@ -281,7 +281,7 @@ pvr_attach(device_t parent, device_t sel
 		sc->sc_nscreens = 1;
 	} else {
 		sc->sc_dc = malloc(sizeof(struct fb_devconfig), M_DEVBUF,
-		M_WAITOK);
+		M_WAITOK | M_ZERO);
 		pvr_getdevconfig(sc->sc_dc);
 	}
 	printf(": %d x %d, %dbpp, %s, %s\n", sc->sc_dc->dc_wid,



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

2015-12-06 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Dec  6 02:04:10 UTC 2015

Modified Files:
src/sys/arch/dreamcast/dev/maple: maple.c maplevar.h

Log Message:
Convert tsleep(9)/wakeup(9) pairs to condvar(9) with mutex(9).

Briefly tested with mkbd(4).


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/dreamcast/dev/maple/maple.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/dreamcast/dev/maple/maplevar.h

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

Modified files:

Index: src/sys/arch/dreamcast/dev/maple/maple.c
diff -u src/sys/arch/dreamcast/dev/maple/maple.c:1.51 src/sys/arch/dreamcast/dev/maple/maple.c:1.52
--- src/sys/arch/dreamcast/dev/maple/maple.c:1.51	Fri Jul 25 08:10:32 2014
+++ src/sys/arch/dreamcast/dev/maple/maple.c	Sun Dec  6 02:04:10 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: maple.c,v 1.51 2014/07/25 08:10:32 dholland Exp $	*/
+/*	$NetBSD: maple.c,v 1.52 2015/12/06 02:04:10 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: maple.c,v 1.51 2014/07/25 08:10:32 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: maple.c,v 1.52 2015/12/06 02:04:10 tsutsui Exp $");
 
 #include 
 #include 
@@ -76,6 +76,8 @@ __KERNEL_RCSID(0, "$NetBSD: maple.c,v 1.
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 
@@ -247,6 +249,11 @@ mapleattach(device_t parent, device_t se
 	maple_polling = 1;
 	maple_scanbus(sc);
 
+	mutex_init(>sc_dma_lock, MUTEX_DEFAULT, IPL_MAPLE);
+	cv_init(>sc_dma_cv, device_xname(self));
+	mutex_init(>sc_event_lock, MUTEX_DEFAULT, IPL_SOFTCLOCK);
+	cv_init(>sc_event_cv, device_xname(self));
+
 	callout_init(>maple_callout_ch, 0);
 
 	sc->sc_intrhand = sysasic_intr_establish(SYSASIC_EVENT_MAPLE_DMADONE,
@@ -835,13 +842,12 @@ maple_command(device_t dev, struct maple
 {
 	struct maple_softc *sc = device_private(dev);
 	struct maple_func *fn;
-	int s;
 
 	KASSERT(func >= 0 && func < 32);
 	KASSERT(command);
 	KASSERT((flags & ~MAPLE_FLAG_CMD_PERIODIC_TIMING) == 0);
 
-	s = splsoftclock();
+	mutex_enter(>sc_event_lock);
 
 	fn = >u_func[func];
 #if 1 /*def DIAGNOSTIC*/
@@ -860,9 +866,9 @@ maple_command(device_t dev, struct maple
 	} else {
 		fn->f_cmdstat = MAPLE_CMDSTAT_ASYNC;
 		TAILQ_INSERT_TAIL(>sc_acmdq, fn, f_cmdq);
-		wakeup(>sc_event);	/* wake for async event */
+		cv_broadcast(>sc_event_cv);	/* wake for async event */
 	}
-	splx(s);
+	mutex_exit(>sc_event_lock);
 }
 
 static void
@@ -1422,7 +1428,6 @@ maple_event_thread(void *arg)
 {
 	struct maple_softc *sc = arg;
 	unsigned cnt = 1;	/* timing counter */
-	int s;
 #if defined(MAPLE_DEBUG) && MAPLE_DEBUG > 1
 	int noreq = 0;
 #endif
@@ -1485,19 +1490,19 @@ maple_event_thread(void *arg)
 			/*
 			 * start DMA
 			 */
-			s = splmaple();
+			mutex_enter(>sc_dma_lock);
 			maple_start(sc);
 
 			/*
 			 * wait until DMA done
 			 */
-			if (tsleep(>sc_dmadone, PWAIT, "mdma", hz)
+			if (cv_timedwait(>sc_dma_cv, >sc_dma_lock, hz)
 			== EWOULDBLOCK) {
 /* was DDB active? */
 printf("%s: timed out\n",
 device_xname(sc->sc_dev));
 			}
-			splx(s);
+			mutex_exit(>sc_dma_lock);
 
 			/*
 			 * call handlers
@@ -1522,17 +1527,17 @@ maple_event_thread(void *arg)
 		/*
 		 * wait for an event
 		 */
-		s = splsoftclock();
+		mutex_enter(>sc_event_lock);
 		if (TAILQ_EMPTY(>sc_acmdq) && sc->sc_event == 0 &&
 		TAILQ_EMPTY(>sc_periodicdeferq)) {
-			if (tsleep(>sc_event, PWAIT, "mslp", hz)
-			== EWOULDBLOCK) {
+			if (cv_timedwait(>sc_event_cv, >sc_event_lock,
+			hz) == EWOULDBLOCK) {
 printf("%s: event timed out\n",
 device_xname(sc->sc_dev));
 			}
 
 		}
-		splx(s);
+		mutex_exit(>sc_event_lock);
 
 	}
 
@@ -1547,7 +1552,9 @@ maple_intr(void *arg)
 {
 	struct maple_softc *sc = arg;
 
-	wakeup(>sc_dmadone);
+	mutex_enter(>sc_dma_lock);
+	cv_broadcast(>sc_dma_cv);
+	mutex_exit(>sc_dma_lock);
 
 	return 1;
 }
@@ -1557,8 +1564,10 @@ maple_callout(void *ctx)
 {
 	struct maple_softc *sc = ctx;
 
+	mutex_enter(>sc_event_lock);
 	sc->sc_event = 1;	/* mark as periodic event */
-	wakeup(>sc_event);
+	cv_broadcast(>sc_event_cv);
+	mutex_exit(>sc_event_lock);
 }
 
 /*

Index: src/sys/arch/dreamcast/dev/maple/maplevar.h
diff -u src/sys/arch/dreamcast/dev/maple/maplevar.h:1.14 src/sys/arch/dreamcast/dev/maple/maplevar.h:1.15
--- src/sys/arch/dreamcast/dev/maple/maplevar.h:1.14	Sat Oct 27 17:17:45 2012
+++ src/sys/arch/dreamcast/dev/maple/maplevar.h	Sun Dec  6 02:04:10 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: maplevar.h,v 1.14 2012/10/27 17:17:45 chs Exp $	*/
+/*	$NetBSD: maplevar.h,v 1.15 2015/12/06 02:04:10 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -184,9 +184,13 @@ struct maple_softc {
 	uint32_t sc_txbuf_phys;	/* 29-bit physical address */
 
 	void	*sc_intrhand;
-	int	sc_dmadone;		/* wchan */
 
-	int	sc_event;		/* periodic event is active / wchan */
+	kmutex_t sc_dma_lock;
+	

CVS commit: src/sys/arch/dreamcast

2015-10-23 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Oct 23 08:40:08 UTC 2015

Modified Files:
src/sys/arch/dreamcast/dev/g2: gapspci_pci.c
src/sys/arch/dreamcast/include: pci_machdep.h

Log Message:
fix build failure on dreamcast.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/dreamcast/dev/g2/gapspci_pci.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/dreamcast/include/pci_machdep.h

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

Modified files:

Index: src/sys/arch/dreamcast/dev/g2/gapspci_pci.c
diff -u src/sys/arch/dreamcast/dev/g2/gapspci_pci.c:1.16 src/sys/arch/dreamcast/dev/g2/gapspci_pci.c:1.17
--- src/sys/arch/dreamcast/dev/g2/gapspci_pci.c:1.16	Fri Oct  2 05:22:50 2015
+++ src/sys/arch/dreamcast/dev/g2/gapspci_pci.c	Fri Oct 23 08:40:08 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: gapspci_pci.c,v 1.16 2015/10/02 05:22:50 msaitoh Exp $	*/
+/*	$NetBSD: gapspci_pci.c,v 1.17 2015/10/23 08:40:08 knakahara Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt.
@@ -38,7 +38,7 @@
  */
 
 #include 			/* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: gapspci_pci.c,v 1.16 2015/10/02 05:22:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gapspci_pci.c,v 1.17 2015/10/23 08:40:08 knakahara Exp $");
 
 #include 
 #include 
@@ -62,7 +62,7 @@ void		gaps_decompose_tag(void *, pcitag_
 pcireg_t	gaps_conf_read(void *, pcitag_t, int);
 void		gaps_conf_write(void *, pcitag_t, int, pcireg_t);
 
-int		gaps_intr_map(struct pci_attach_args *, pci_intr_handle_t *);
+int		gaps_intr_map(const struct pci_attach_args *, pci_intr_handle_t *);
 const char	*gaps_intr_string(void *, pci_intr_handle_t,
 		char *buf, size_t len);
 void		*gaps_intr_establish(void *, pci_intr_handle_t,
@@ -195,7 +195,7 @@ gaps_conf_write(void *v, pcitag_t tag, i
 }
 
 int
-gaps_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp)
+gaps_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
 {
 
 	*ihp = SYSASIC_EVENT_EXT;

Index: src/sys/arch/dreamcast/include/pci_machdep.h
diff -u src/sys/arch/dreamcast/include/pci_machdep.h:1.8 src/sys/arch/dreamcast/include/pci_machdep.h:1.9
--- src/sys/arch/dreamcast/include/pci_machdep.h:1.8	Sat Mar 29 19:28:27 2014
+++ src/sys/arch/dreamcast/include/pci_machdep.h	Fri Oct 23 08:40:08 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.h,v 1.8 2014/03/29 19:28:27 christos Exp $	*/
+/*	$NetBSD: pci_machdep.h,v 1.9 2015/10/23 08:40:08 knakahara Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt
@@ -65,7 +65,7 @@ struct dreamcast_pci_chipset {
 
 	void		*pc_intr_v;
 
-  	int		(*pc_intr_map)(struct pci_attach_args *,
+  	int		(*pc_intr_map)(const struct pci_attach_args *,
 			pci_intr_handle_t *);
 	const char	*(*pc_intr_string)(void *, pci_intr_handle_t,
 			char *, size_t);



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

2015-06-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jun 11 15:08:28 UTC 2015

Modified Files:
src/sys/arch/dreamcast/include: kloader.h

Log Message:
Add avail_start, avail_end declarations.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/dreamcast/include/kloader.h

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

Modified files:

Index: src/sys/arch/dreamcast/include/kloader.h
diff -u src/sys/arch/dreamcast/include/kloader.h:1.4 src/sys/arch/dreamcast/include/kloader.h:1.5
--- src/sys/arch/dreamcast/include/kloader.h:1.4	Mon Apr 28 20:23:16 2008
+++ src/sys/arch/dreamcast/include/kloader.h	Thu Jun 11 15:08:27 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: kloader.h,v 1.4 2008/04/28 20:23:16 martin Exp $ */
+/* $NetBSD: kloader.h,v 1.5 2015/06/11 15:08:27 matt Exp $ */
 
 /*-
  * Copyright (c) 2002, 2004 The NetBSD Foundation, Inc.
@@ -30,3 +30,4 @@
 #define	KLOADER_NO_BOOTINFO
 #define PG_VADDR(pg)	SH3_PHYS_TO_P1SEG(VM_PAGE_TO_PHYS(pg))
 #include dev/kloader.h
+extern paddr_t avail_start, avail_end;



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

2014-03-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 31 12:38:41 UTC 2014

Modified Files:
src/sys/arch/dreamcast/dev/g2: gapspci_pci.c

Log Message:
Adapt intr_string signature


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/dreamcast/dev/g2/gapspci_pci.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/dreamcast/dev/g2/gapspci_pci.c
diff -u src/sys/arch/dreamcast/dev/g2/gapspci_pci.c:1.13 src/sys/arch/dreamcast/dev/g2/gapspci_pci.c:1.14
--- src/sys/arch/dreamcast/dev/g2/gapspci_pci.c:1.13	Tue Jul 19 15:52:30 2011
+++ src/sys/arch/dreamcast/dev/g2/gapspci_pci.c	Mon Mar 31 12:38:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: gapspci_pci.c,v 1.13 2011/07/19 15:52:30 dyoung Exp $	*/
+/*	$NetBSD: gapspci_pci.c,v 1.14 2014/03/31 12:38:40 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt.
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
-__KERNEL_RCSID(0, $NetBSD: gapspci_pci.c,v 1.13 2011/07/19 15:52:30 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: gapspci_pci.c,v 1.14 2014/03/31 12:38:40 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -63,7 +63,8 @@ pcireg_t	gaps_conf_read(void *, pcitag_t
 void		gaps_conf_write(void *, pcitag_t, int, pcireg_t);
 
 int		gaps_intr_map(struct pci_attach_args *, pci_intr_handle_t *);
-const char	*gaps_intr_string(void *, pci_intr_handle_t);
+const char	*gaps_intr_string(void *, pci_intr_handle_t,
+		char *buf, size_t len);
 void		*gaps_intr_establish(void *, pci_intr_handle_t,
 		int, int (*)(void *), void *);
 void		gaps_intr_disestablish(void *, void *);
@@ -196,7 +197,8 @@ gaps_intr_map(struct pci_attach_args *pa
 }
 
 const char *
-gaps_intr_string(void *v, pci_intr_handle_t ih)
+gaps_intr_string(void *v, pci_intr_handle_t ih,
+char *buf, size_t len)
 {
 
 	return sysasic_intr_string(SYSASIC_IRL11);



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

2014-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 31 13:12:55 UTC 2014

Modified Files:
src/sys/arch/dreamcast/dev/g2: gapspci_pci.c

Log Message:
make a copy of the interrupt string in buf.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/dreamcast/dev/g2/gapspci_pci.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/dreamcast/dev/g2/gapspci_pci.c
diff -u src/sys/arch/dreamcast/dev/g2/gapspci_pci.c:1.14 src/sys/arch/dreamcast/dev/g2/gapspci_pci.c:1.15
--- src/sys/arch/dreamcast/dev/g2/gapspci_pci.c:1.14	Mon Mar 31 08:38:40 2014
+++ src/sys/arch/dreamcast/dev/g2/gapspci_pci.c	Mon Mar 31 09:12:55 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: gapspci_pci.c,v 1.14 2014/03/31 12:38:40 martin Exp $	*/
+/*	$NetBSD: gapspci_pci.c,v 1.15 2014/03/31 13:12:55 christos Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt.
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
-__KERNEL_RCSID(0, $NetBSD: gapspci_pci.c,v 1.14 2014/03/31 12:38:40 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: gapspci_pci.c,v 1.15 2014/03/31 13:12:55 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -201,7 +201,8 @@ gaps_intr_string(void *v, pci_intr_handl
 char *buf, size_t len)
 {
 
-	return sysasic_intr_string(SYSASIC_IRL11);
+	strlcpy(buf, sysasic_intr_string(SYSASIC_IRL11), len);
+	return buf;
 }
 
 void *



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

2014-03-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 18 08:08:55 UTC 2014

Modified Files:
src/sys/arch/dreamcast/dev: gdrom.c

Log Message:
Fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/dreamcast/dev/gdrom.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/dreamcast/dev/gdrom.c
diff -u src/sys/arch/dreamcast/dev/gdrom.c:1.37 src/sys/arch/dreamcast/dev/gdrom.c:1.38
--- src/sys/arch/dreamcast/dev/gdrom.c:1.37	Sun Mar 16 05:20:23 2014
+++ src/sys/arch/dreamcast/dev/gdrom.c	Tue Mar 18 08:08:55 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdrom.c,v 1.37 2014/03/16 05:20:23 dholland Exp $	*/
+/*	$NetBSD: gdrom.c,v 1.38 2014/03/18 08:08:55 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
-__KERNEL_RCSID(0, $NetBSD: gdrom.c,v 1.37 2014/03/16 05:20:23 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: gdrom.c,v 1.38 2014/03/18 08:08:55 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -66,7 +66,7 @@ dev_type_strategy(gdromstrategy);
 const struct bdevsw gdrom_bdevsw = {
 	.d_open = gdromopen,
 	.d_close = gdromclose,
-	.d_strateegy = gdromstrategy,
+	.d_strategy = gdromstrategy,
 	.d_ioctl = gdromioctl,
 	.d_dump = nodump,
 	.d_psize = nosize,



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

2014-03-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 14 08:51:06 UTC 2014

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

Log Message:
Remove an unused variable


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/dreamcast/dreamcast/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/dreamcast/dreamcast/machdep.c
diff -u src/sys/arch/dreamcast/dreamcast/machdep.c:1.43 src/sys/arch/dreamcast/dreamcast/machdep.c:1.44
--- src/sys/arch/dreamcast/dreamcast/machdep.c:1.43	Mon Jun 11 16:27:08 2012
+++ src/sys/arch/dreamcast/dreamcast/machdep.c	Fri Mar 14 08:51:06 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.43 2012/06/11 16:27:08 tsutsui Exp $	*/
+/*	$NetBSD: machdep.c,v 1.44 2014/03/14 08:51:06 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2002 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.43 2012/06/11 16:27:08 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.44 2014/03/14 08:51:06 martin Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -270,7 +270,7 @@ void
 intc_intr(int ssr, int spc, int ssp)
 {
 	struct intc_intrhand *ih;
-	int s, evtcode;
+	int evtcode;
 
 	curcpu()-ci_data.cpu_nintr++;
 
@@ -282,7 +282,7 @@ intc_intr(int ssr, int spc, int ssp)
 	 * On entry, all interrrupts are disabled, and exception is enabled.
 	 * Enable higher level interrupt here.
 	 */
-	s = _cpu_intr_resume(ih-ih_level);
+	_cpu_intr_resume(ih-ih_level);
 
 	if (evtcode == SH_INTEVT_TMU0_TUNI0) {	/* hardclock */
 		struct clockframe cf;



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

2014-03-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 14 08:55:41 UTC 2014

Modified Files:
src/sys/arch/dreamcast/dev/maple: maple.c mlcd.c

Log Message:
Remove unused variables


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/dreamcast/dev/maple/maple.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/dreamcast/dev/maple/mlcd.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/dreamcast/dev/maple/maple.c
diff -u src/sys/arch/dreamcast/dev/maple/maple.c:1.46 src/sys/arch/dreamcast/dev/maple/maple.c:1.47
--- src/sys/arch/dreamcast/dev/maple/maple.c:1.46	Sun Oct 13 06:55:34 2013
+++ src/sys/arch/dreamcast/dev/maple/maple.c	Fri Mar 14 08:55:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: maple.c,v 1.46 2013/10/13 06:55:34 riz Exp $	*/
+/*	$NetBSD: maple.c,v 1.47 2014/03/14 08:55:40 martin Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: maple.c,v 1.46 2013/10/13 06:55:34 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: maple.c,v 1.47 2014/03/14 08:55:40 martin Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -554,10 +554,7 @@ static void
 maple_check_unit_change(struct maple_softc *sc, struct maple_unit *u)
 {
 	struct maple_devinfo *newinfo = (void *) (u-u_rxbuf + 1);
-	int port, subunit;
 
-	port = u-port;
-	subunit = u-subunit;
 	if (memcmp(u-devinfo, newinfo, sizeof(struct maple_devinfo)) == 0)
 		goto out;	/* no change */
 

Index: src/sys/arch/dreamcast/dev/maple/mlcd.c
diff -u src/sys/arch/dreamcast/dev/maple/mlcd.c:1.14 src/sys/arch/dreamcast/dev/maple/mlcd.c:1.15
--- src/sys/arch/dreamcast/dev/maple/mlcd.c:1.14	Sun Oct 17 14:17:49 2010
+++ src/sys/arch/dreamcast/dev/maple/mlcd.c	Fri Mar 14 08:55:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mlcd.c,v 1.14 2010/10/17 14:17:49 tsutsui Exp $	*/
+/*	$NetBSD: mlcd.c,v 1.15 2014/03/14 08:55:40 martin Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mlcd.c,v 1.14 2010/10/17 14:17:49 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: mlcd.c,v 1.15 2014/03/14 08:55:40 martin Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -526,10 +526,8 @@ static void
 mlcdstart_bp(struct mlcd_softc *sc)
 {
 	struct mlcd_buf *bp;
-	struct mlcd_pt *pt;
 
 	bp = sc-sc_bp;
-	pt = sc-sc_pt[bp-lb_partno];
 
 	/* handle retry */
 	if (sc-sc_retry++  MLCD_MAXRETRY) {
@@ -720,14 +718,11 @@ mlcdwrite(dev_t dev, struct uio *uio, in
 int
 mlcdioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
 {
-	int unit, part;
+	int unit;
 	struct mlcd_softc *sc;
-	struct mlcd_pt *pt;
 
 	unit = MLCD_UNIT(dev);
-	part = MLCD_PART(dev);
 	sc = device_lookup_private(mlcd_cd, unit);
-	pt = sc-sc_pt[part];
 
 	switch (cmd) {
 



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

2012-07-27 Thread David Brownlee
Module Name:src
Committed By:   abs
Date:   Fri Jul 27 07:42:27 UTC 2012

Modified Files:
src/sys/arch/dreamcast/dev: gdrom.c

Log Message:
- Adjust the TOC parsing to reject an TOC with invalid (zero) track ids.
  Avoids dereferencing off the start of the TOC track array.
- Add #ifdef GDROMDEBUGTOC for dumping out the gdrom TOC values


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/dreamcast/dev/gdrom.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/dreamcast/dev/gdrom.c
diff -u src/sys/arch/dreamcast/dev/gdrom.c:1.34 src/sys/arch/dreamcast/dev/gdrom.c:1.35
--- src/sys/arch/dreamcast/dev/gdrom.c:1.34	Wed Sep  1 16:48:00 2010
+++ src/sys/arch/dreamcast/dev/gdrom.c	Fri Jul 27 07:42:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdrom.c,v 1.34 2010/09/01 16:48:00 tsutsui Exp $	*/
+/*	$NetBSD: gdrom.c,v 1.35 2012/07/27 07:42:26 abs Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
-__KERNEL_RCSID(0, $NetBSD: gdrom.c,v 1.34 2010/09/01 16:48:00 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: gdrom.c,v 1.35 2012/07/27 07:42:26 abs Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -586,15 +586,35 @@ gdromioctl(dev_t dev, u_long cmd, void *
 
 		if (error != 0)
 			return error;
-
+#ifdef GDROMDEBUGTOC 
+		{ /* Dump the GDROM TOC */
+		unsigned char *ptr = (unsigned char *)toc;
+		int i;
+
+		printf(gdrom: TOC\n);
+		for(i = 0; i  sizeof(toc); ++i) {
+			printf(%02x, *ptr++);
+			if( i%32 == 31)
+printf(\n);
+			else if( i%4 == 3)
+printf(,);
+		}
+		printf(\n);
+		}
+#endif
 		for (track = TOC_TRACK(toc.last);
 		track = TOC_TRACK(toc.first);
-		--track)
+		--track) {
+			if (track  1 || track  100)
+return ENXIO;
 			if (TOC_CTRL(toc.entry[track - 1]))
 break;
+		}
 
-		if (track  TOC_TRACK(toc.first) || track  100)
-			return ENXIO;
+#ifdef GDROMDEBUGTOC 
+		printf(gdrom: Using track %d, LBA %u\n, track,
+		TOC_LBA(toc.entry[track - 1]));
+#endif
 
 		*(int *)addr = htonl(TOC_LBA(toc.entry[track - 1])) -
 		sc-openpart_start;



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

2012-07-17 Thread David Brownlee
Module Name:src
Committed By:   abs
Date:   Tue Jul 17 08:05:18 UTC 2012

Modified Files:
src/sys/arch/dreamcast/conf: GENERIC

Log Message:
On a system with no default writable local media, the union file system can be 
handy


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/dreamcast/conf/GENERIC

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

Modified files:

Index: src/sys/arch/dreamcast/conf/GENERIC
diff -u src/sys/arch/dreamcast/conf/GENERIC:1.106 src/sys/arch/dreamcast/conf/GENERIC:1.107
--- src/sys/arch/dreamcast/conf/GENERIC:1.106	Sat Mar 10 21:51:50 2012
+++ src/sys/arch/dreamcast/conf/GENERIC	Tue Jul 17 08:05:17 2012
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.106 2012/03/10 21:51:50 joerg Exp $
+# $NetBSD: GENERIC,v 1.107 2012/07/17 08:05:17 abs Exp $
 #
 # GENERIC machine description file
 # 
@@ -83,7 +83,7 @@ file-system 	PROCFS		# /proc
 #file-system 	NULLFS		# loopback file system
 #file-system	OVERLAY		# overlay file system
 #file-system 	UMAPFS		# NULLFS + uid and gid remapping
-#file-system	UNION		# union file system
+file-system	UNION		# union file system
 file-system	PTYFS		# /dev/pts/N support
 file-system	TMPFS		# Efficient memory file-system
 #file-system	UDF		# experimental - OSTA UDF CD/DVD file-system



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

2012-06-11 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Jun 11 16:27:08 UTC 2012

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

Log Message:
Explicitly include machine/pcb.h for struct pcb.
Fixes build error on GENERIC + no options DDB, reported by Yasushi Oshima.

Should be pulled up to netbsd-6.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/dreamcast/dreamcast/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/dreamcast/dreamcast/machdep.c
diff -u src/sys/arch/dreamcast/dreamcast/machdep.c:1.42 src/sys/arch/dreamcast/dreamcast/machdep.c:1.43
--- src/sys/arch/dreamcast/dreamcast/machdep.c:1.42	Mon Dec 20 00:25:31 2010
+++ src/sys/arch/dreamcast/dreamcast/machdep.c	Mon Jun 11 16:27:08 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.42 2010/12/20 00:25:31 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.43 2012/06/11 16:27:08 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2002 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.42 2010/12/20 00:25:31 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.43 2012/06/11 16:27:08 tsutsui Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -98,6 +98,7 @@ __KERNEL_RCSID(0, $NetBSD: machdep.c,v 
 #include sh3/bscreg.h
 #include machine/intr.h
 #include machine/kloader.h
+#include machine/pcb.h
 
 #include dev/cons.h
 



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

2011-12-30 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Fri Dec 30 12:47:37 UTC 2011

Modified Files:
src/sys/arch/dreamcast/conf: GENERIC

Log Message:
Bump SYMTAB_SPACE so that the contents fits again.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/dreamcast/conf/GENERIC

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

Modified files:

Index: src/sys/arch/dreamcast/conf/GENERIC
diff -u src/sys/arch/dreamcast/conf/GENERIC:1.104 src/sys/arch/dreamcast/conf/GENERIC:1.105
--- src/sys/arch/dreamcast/conf/GENERIC:1.104	Sun Dec 18 05:49:25 2011
+++ src/sys/arch/dreamcast/conf/GENERIC	Fri Dec 30 12:47:37 2011
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.104 2011/12/18 05:49:25 dholland Exp $
+# $NetBSD: GENERIC,v 1.105 2011/12/30 12:47:37 he Exp $
 #
 # GENERIC machine description file
 # 
@@ -52,7 +52,7 @@ options 	DDB		# in-kernel debugger
 #options 	KGDB			# remote debugger
 #options 	KGDB_DEVNAME=\scif\,KGDB_DEVRATE=57600
 #makeoptions	DEBUG=-g	# compile full symbol table
-options 	SYMTAB_SPACE=32
+options 	SYMTAB_SPACE=33
 #options 	SYSCALL_DEBUG
 #options 	UVMHIST
 #options 	UVMHIST_PRINT



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

2011-05-21 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat May 21 12:00:18 UTC 2011

Modified Files:
src/sys/arch/dreamcast/dev: pvr.c

Log Message:
Move several static wsdisplay variables into proper device specific structures
to resolve XXX comments.  Tested on GXemul.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/dreamcast/dev/pvr.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/dreamcast/dev/pvr.c
diff -u src/sys/arch/dreamcast/dev/pvr.c:1.31 src/sys/arch/dreamcast/dev/pvr.c:1.32
--- src/sys/arch/dreamcast/dev/pvr.c:1.31	Wed Jan 26 13:14:07 2011
+++ src/sys/arch/dreamcast/dev/pvr.c	Sat May 21 12:00:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pvr.c,v 1.31 2011/01/26 13:14:07 tsutsui Exp $	*/
+/*	$NetBSD: pvr.c,v 1.32 2011/05/21 12:00:18 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt.
@@ -35,7 +35,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: pvr.c,v 1.31 2011/01/26 13:14:07 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: pvr.c,v 1.32 2011/05/21 12:00:18 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -144,6 +144,9 @@
 	int	dc_tvsystem;		/* TV broadcast system */
 
 	struct rasops_info dc_rinfo;
+
+	char dc_wsscrname[32];
+	struct wsscreen_descr dc_wsscrdescr;
 };
 
 #define	PVR_RGBMODE	0x01		/* RGB or composite */
@@ -153,6 +156,8 @@
 	device_t sc_dev;
 	struct fb_devconfig *sc_dc;	/* device configuration */
 	int sc_nscreens;
+	const struct wsscreen_descr *sc_scrdescs[1];
+	struct wsscreen_list sc_scrlist;
 };
 
 static int	pvr_match(device_t, cfdata_t, void *);
@@ -165,23 +170,6 @@
 
 static struct fb_devconfig pvr_console_dc;
 
-static char pvr_stdscreen_textgeom[32] = { std };	/* XXX yuck */
-
-static struct wsscreen_descr pvr_stdscreen = {
-	pvr_stdscreen_textgeom, 0, 0,
-	0, /* textops */
-	0, 0,
-	WSSCREEN_WSCOLORS,
-};
-
-static const struct wsscreen_descr *_pvr_scrlist[] = {
-	pvr_stdscreen,
-};
-
-static const struct wsscreen_list pvr_screenlist = {
-	sizeof(_pvr_scrlist) / sizeof(struct wsscreen_descr *), _pvr_scrlist
-};
-
 static int	pvrioctl(void *, void *, u_long, void *, int, struct lwp *);
 static paddr_t	pvrmmap(void *, void *, off_t, int);
 
@@ -266,15 +254,14 @@
 
 	rasops_init(dc-dc_rinfo, 500, 500);
 
-	/* XXX shouldn't be global */
-	pvr_stdscreen.nrows = dc-dc_rinfo.ri_rows;
-	pvr_stdscreen.ncols = dc-dc_rinfo.ri_cols;
-	pvr_stdscreen.textops = dc-dc_rinfo.ri_ops;
-	pvr_stdscreen.capabilities = dc-dc_rinfo.ri_caps;
-
-	/* XXX yuck */
-	sprintf(pvr_stdscreen_textgeom, %dx%d, pvr_stdscreen.ncols,
-	pvr_stdscreen.nrows);
+	dc-dc_wsscrdescr.name = dc-dc_wsscrname;
+	dc-dc_wsscrdescr.ncols = dc-dc_rinfo.ri_cols;
+	dc-dc_wsscrdescr.nrows = dc-dc_rinfo.ri_rows;
+	dc-dc_wsscrdescr.textops = dc-dc_rinfo.ri_ops;
+	dc-dc_wsscrdescr.capabilities = dc-dc_rinfo.ri_caps;
+
+	sprintf(dc-dc_wsscrname, %dx%d,
+	dc-dc_wsscrdescr.ncols, dc-dc_wsscrdescr.nrows);
 }
 
 void
@@ -305,8 +292,12 @@
 
 	/* XXX Colormap initialization? */
 
+	sc-sc_scrdescs[0] = sc-sc_dc-dc_wsscrdescr;
+	sc-sc_scrlist.nscreens = 1;
+	sc-sc_scrlist.screens = sc-sc_scrdescs;
+
 	waa.console = console;
-	waa.scrdata = pvr_screenlist;
+	waa.scrdata = sc-sc_scrlist;
 	waa.accessops = pvr_accessops;
 	waa.accesscookie = sc;
 
@@ -588,7 +579,7 @@
 
 	pvr_getdevconfig(dcp);
 	(*dcp-dc_rinfo.ri_ops.allocattr)(dcp-dc_rinfo, 0, 0, 0, defattr);
-	wsdisplay_cnattach(pvr_stdscreen, dcp-dc_rinfo, 0, 0, defattr);
+	wsdisplay_cnattach(dcp-dc_wsscrdescr, dcp-dc_rinfo, 0, 0, defattr);
 
 	pvr_is_console = 1;
 



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

2011-01-26 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Jan 26 13:14:07 UTC 2011

Modified Files:
src/sys/arch/dreamcast/dev: pvr.c

Log Message:
Add proper prefix to structures.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/dreamcast/dev/pvr.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/dreamcast/dev/pvr.c
diff -u src/sys/arch/dreamcast/dev/pvr.c:1.30 src/sys/arch/dreamcast/dev/pvr.c:1.31
--- src/sys/arch/dreamcast/dev/pvr.c:1.30	Sun Oct 24 13:34:27 2010
+++ src/sys/arch/dreamcast/dev/pvr.c	Wed Jan 26 13:14:07 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pvr.c,v 1.30 2010/10/24 13:34:27 tsutsui Exp $	*/
+/*	$NetBSD: pvr.c,v 1.31 2011/01/26 13:14:07 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt.
@@ -35,7 +35,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: pvr.c,v 1.30 2010/10/24 13:34:27 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: pvr.c,v 1.31 2011/01/26 13:14:07 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -143,7 +143,7 @@
 	int	dc_dispflags;		/* display flags */
 	int	dc_tvsystem;		/* TV broadcast system */
 
-	struct rasops_info rinfo;
+	struct rasops_info dc_rinfo;
 };
 
 #define	PVR_RGBMODE	0x01		/* RGB or composite */
@@ -152,7 +152,7 @@
 struct pvr_softc {
 	device_t sc_dev;
 	struct fb_devconfig *sc_dc;	/* device configuration */
-	int nscreens;
+	int sc_nscreens;
 };
 
 static int	pvr_match(device_t, cfdata_t, void *);
@@ -237,14 +237,14 @@
 	/* Initialize the device. */
 	pvrinit(dc);
 
-	dc-rinfo.ri_flg = 0;
+	dc-dc_rinfo.ri_flg = 0;
 	if (dc == pvr_console_dc)
-		dc-rinfo.ri_flg |= RI_NO_AUTO;
-	dc-rinfo.ri_depth = dc-dc_depth;
-	dc-rinfo.ri_bits = (void *) dc-dc_videobase;
-	dc-rinfo.ri_width = dc-dc_wid;
-	dc-rinfo.ri_height = dc-dc_ht;
-	dc-rinfo.ri_stride = dc-dc_rowbytes;
+		dc-dc_rinfo.ri_flg |= RI_NO_AUTO;
+	dc-dc_rinfo.ri_depth = dc-dc_depth;
+	dc-dc_rinfo.ri_bits = (void *) dc-dc_videobase;
+	dc-dc_rinfo.ri_width = dc-dc_wid;
+	dc-dc_rinfo.ri_height = dc-dc_ht;
+	dc-dc_rinfo.ri_stride = dc-dc_rowbytes;
 
 	wsfont_init();
 	/* prefer 8 pixel wide font */
@@ -258,19 +258,19 @@
 		return;
 	}
 
-	if (wsfont_lock(cookie, dc-rinfo.ri_font)) {
+	if (wsfont_lock(cookie, dc-dc_rinfo.ri_font)) {
 		printf(pvr: unable to lock font\n);
 		return;
 	}
-	dc-rinfo.ri_wsfcookie = cookie;
+	dc-dc_rinfo.ri_wsfcookie = cookie;
 
-	rasops_init(dc-rinfo, 500, 500);
+	rasops_init(dc-dc_rinfo, 500, 500);
 
 	/* XXX shouldn't be global */
-	pvr_stdscreen.nrows = dc-rinfo.ri_rows;
-	pvr_stdscreen.ncols = dc-rinfo.ri_cols;
-	pvr_stdscreen.textops = dc-rinfo.ri_ops;
-	pvr_stdscreen.capabilities = dc-rinfo.ri_caps;
+	pvr_stdscreen.nrows = dc-dc_rinfo.ri_rows;
+	pvr_stdscreen.ncols = dc-dc_rinfo.ri_cols;
+	pvr_stdscreen.textops = dc-dc_rinfo.ri_ops;
+	pvr_stdscreen.capabilities = dc-dc_rinfo.ri_caps;
 
 	/* XXX yuck */
 	sprintf(pvr_stdscreen_textgeom, %dx%d, pvr_stdscreen.ncols,
@@ -290,8 +290,8 @@
 	console = pvr_is_console;
 	if (console) {
 		sc-sc_dc = pvr_console_dc;
-		sc-sc_dc-rinfo.ri_flg = ~RI_NO_AUTO;
-		sc-nscreens = 1;
+		sc-sc_dc-dc_rinfo.ri_flg = ~RI_NO_AUTO;
+		sc-sc_nscreens = 1;
 	} else {
 		sc-sc_dc = malloc(sizeof(struct fb_devconfig), M_DEVBUF,
 		M_WAITOK);
@@ -334,7 +334,7 @@
 		return 0;
 
 	case WSDISPLAYIO_LINEBYTES:
-		*(u_int *)data = sc-sc_dc-rinfo.ri_stride;
+		*(u_int *)data = sc-sc_dc-dc_rinfo.ri_stride;
 		return 0;
 
 	case WSDISPLAYIO_GETCMAP:
@@ -409,16 +409,16 @@
 	struct pvr_softc *sc = v;
 	long defattr;
 
-	if (sc-nscreens  0)
+	if (sc-sc_nscreens  0)
 		return ENOMEM;
 
-	*cookiep = sc-sc_dc-rinfo; /* one and only for now */
+	*cookiep = sc-sc_dc-dc_rinfo; /* one and only for now */
 	*curxp = 0;
 	*curyp = 0;
-	(*sc-sc_dc-rinfo.ri_ops.allocattr)(sc-sc_dc-rinfo, 0, 0, 0,
+	(*sc-sc_dc-dc_rinfo.ri_ops.allocattr)(sc-sc_dc-dc_rinfo, 0, 0, 0,
 	defattr);
 	*attrp = defattr;
-	sc-nscreens++;
+	sc-sc_nscreens++;
 	return 0;
 }
 
@@ -430,7 +430,7 @@
 	if (sc-sc_dc == pvr_console_dc)
 		panic(pvr_free_screen: console);
 
-	sc-nscreens--;
+	sc-sc_nscreens--;
 }
 
 int
@@ -587,8 +587,8 @@
 	long defattr;
 
 	pvr_getdevconfig(dcp);
-	(*dcp-rinfo.ri_ops.allocattr)(dcp-rinfo, 0, 0, 0, defattr);
-	wsdisplay_cnattach(pvr_stdscreen, dcp-rinfo, 0, 0, defattr);
+	(*dcp-dc_rinfo.ri_ops.allocattr)(dcp-dc_rinfo, 0, 0, 0, defattr);
+	wsdisplay_cnattach(pvr_stdscreen, dcp-dc_rinfo, 0, 0, defattr);
 
 	pvr_is_console = 1;
 



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

2010-11-21 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Nov 21 16:11:32 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev/g2: aica.c g2bus.c g2busvar.h gapspci.c
gapspci_pci.c gapspcivar.h

Log Message:
Split softc/device_t.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/dreamcast/dev/g2/aica.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/dreamcast/dev/g2/g2bus.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/dreamcast/dev/g2/g2busvar.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/dreamcast/dev/g2/gapspci.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/dreamcast/dev/g2/gapspci_pci.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/dreamcast/dev/g2/gapspcivar.h

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

Modified files:

Index: src/sys/arch/dreamcast/dev/g2/aica.c
diff -u src/sys/arch/dreamcast/dev/g2/aica.c:1.19 src/sys/arch/dreamcast/dev/g2/aica.c:1.20
--- src/sys/arch/dreamcast/dev/g2/aica.c:1.19	Sat Nov 20 16:12:23 2010
+++ src/sys/arch/dreamcast/dev/g2/aica.c	Sun Nov 21 16:11:32 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: aica.c,v 1.19 2010/11/20 16:12:23 tsutsui Exp $	*/
+/*	$NetBSD: aica.c,v 1.20 2010/11/21 16:11:32 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2003 SHIMIZU Ryo r...@misakimix.org
@@ -29,7 +29,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: aica.c,v 1.19 2010/11/20 16:12:23 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: aica.c,v 1.20 2010/11/21 16:11:32 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -56,7 +56,7 @@
 #define	AICA_TIMEOUT	0x1800
 
 struct aica_softc {
-	struct device		sc_dev;		/* base device */
+	device_t		sc_dev;		/* base device */
 	bus_space_tag_t		sc_memt;
 	bus_space_handle_t	sc_aica_regh;
 	bus_space_handle_t	sc_aica_memh;
@@ -113,11 +113,11 @@
 	 2, AUFMT_STEREO, 0, {1, 65536}},
 };
 
-int aica_match(struct device *, struct cfdata *, void *);
-void aica_attach(struct device *, struct device *, void *);
+int aica_match(device_t, cfdata_t, void *);
+void aica_attach(device_t, device_t, void *);
 int aica_print(void *, const char *);
 
-CFATTACH_DECL(aica, sizeof(struct aica_softc), aica_match, aica_attach,
+CFATTACH_DECL_NEW(aica, sizeof(struct aica_softc), aica_match, aica_attach,
 NULL, NULL);
 
 const struct audio_device aica_device = {
@@ -194,7 +194,7 @@
 };
 
 int
-aica_match(struct device *parent, struct cfdata *cf, void *aux)
+aica_match(device_t parent, cfdata_t cf, void *aux)
 {
 	static int aica_matched = 0;
 
@@ -206,29 +206,30 @@
 }
 
 void
-aica_attach(struct device *parent, struct device *self, void *aux)
+aica_attach(device_t parent, device_t self, void *aux)
 {
 	struct aica_softc *sc;
 	struct g2bus_attach_args *ga;
 	int i;
 
-	sc = (struct aica_softc *)self;
+	sc = device_private(self);
 	ga = aux;
+	sc-sc_dev = self;
 	sc-sc_memt = ga-ga_memt;
 
 	if (bus_space_map(sc-sc_memt, AICA_REG_ADDR, 0x3000, 0,
 	sc-sc_aica_regh) != 0) {
-		printf(: can't map AICA register space\n);
+		aprint_error(: can't map AICA register space\n);
 		return;
 	}
 
 	if (bus_space_map(sc-sc_memt, AICA_RAM_START, AICA_RAM_SIZE, 0,
 	sc-sc_aica_memh) != 0) {
-		printf(: can't map AICA memory space\n);
+		aprint_error(: can't map AICA memory space\n);
 		return;
 	}
 
-	printf(: ARM7 Sound Processing Unit\n);
+	aprint_normal(: ARM7 Sound Processing Unit\n);
 
 	aica_disable(sc);
 
@@ -245,12 +246,12 @@
 
 	aica_enable(sc);
 
-	printf(%s: interrupting at %s\n, sc-sc_dev.dv_xname,
+	aprint_normal_dev(self, interrupting at %s\n,
 	sysasic_intr_string(SYSASIC_IRL9));
 	sysasic_intr_establish(SYSASIC_EVENT_AICA, IPL_BIO, SYSASIC_IRL9,
 	aica_intr, sc);
 
-	audio_attach_mi(aica_hw_if, sc, sc-sc_dev);
+	audio_attach_mi(aica_hw_if, sc, self);
 
 	/* init parameters */
 	sc-sc_output_master = 255;

Index: src/sys/arch/dreamcast/dev/g2/g2bus.c
diff -u src/sys/arch/dreamcast/dev/g2/g2bus.c:1.13 src/sys/arch/dreamcast/dev/g2/g2bus.c:1.14
--- src/sys/arch/dreamcast/dev/g2/g2bus.c:1.13	Mon Aug  7 17:36:53 2006
+++ src/sys/arch/dreamcast/dev/g2/g2bus.c	Sun Nov 21 16:11:32 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: g2bus.c,v 1.13 2006/08/07 17:36:53 tsutsui Exp $	*/
+/*	$NetBSD: g2bus.c,v 1.14 2010/11/21 16:11:32 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt
@@ -34,7 +34,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: g2bus.c,v 1.13 2006/08/07 17:36:53 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: g2bus.c,v 1.14 2010/11/21 16:11:32 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -46,29 +46,29 @@
 
 #include dreamcast/dev/g2/g2busvar.h
 
-int	g2busmatch(struct device *, struct cfdata *, void *);
-void	g2busattach(struct device *, struct device *, void *);
+int	g2busmatch(device_t, cfdata_t, void *);
+void	g2busattach(device_t, device_t, void *);
 int	g2busprint(void *, const char *);
 
-CFATTACH_DECL(g2bus, sizeof(struct g2bus_softc),
+CFATTACH_DECL_NEW(g2bus, sizeof(struct g2bus_softc),
 g2busmatch, g2busattach, NULL, 

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

2010-11-21 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Nov 21 17:59:36 UTC 2010

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

Log Message:
Use CFATTACH_DECL_NEW() (no softc).


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/dreamcast/dreamcast/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/dreamcast/dreamcast/mainbus.c
diff -u src/sys/arch/dreamcast/dreamcast/mainbus.c:1.9 src/sys/arch/dreamcast/dreamcast/mainbus.c:1.10
--- src/sys/arch/dreamcast/dreamcast/mainbus.c:1.9	Mon Apr 28 20:23:16 2008
+++ src/sys/arch/dreamcast/dreamcast/mainbus.c	Sun Nov 21 17:59:36 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.9 2008/04/28 20:23:16 martin Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.10 2010/11/21 17:59:36 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -27,15 +27,15 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.9 2008/04/28 20:23:16 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.10 2010/11/21 17:59:36 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
 #include sys/device.h
 #include machine/autoconf.h
 
-int mainbus_match(struct device *, struct cfdata *, void *);
-void mainbus_attach(struct device *, struct device *, void *);
+int mainbus_match(device_t, cfdata_t, void *);
+void mainbus_attach(device_t, device_t, void *);
 int mainbus_print(void *, const char *);
 
 struct mainbus_attach_args mainbusdevs[] = {
@@ -44,22 +44,22 @@
 	{ NULL }	/* terminator */
 };
 
-CFATTACH_DECL(mainbus, sizeof(struct device),
+CFATTACH_DECL_NEW(mainbus, 0,
 mainbus_match, mainbus_attach, NULL, NULL);
 
 int
-mainbus_match(struct device *parent, struct cfdata *cf, void *aux)
+mainbus_match(device_t parent, cfdata_t cf, void *aux)
 {
 
 	return 1;
 }
 
 void
-mainbus_attach(struct device *parent, struct device *self, void *aux)
+mainbus_attach(device_t parent, device_t self, void *aux)
 {
 	struct mainbus_attach_args *ma;
 
-	printf(\n);
+	aprint_normal(\n);
 
 	for (ma = mainbusdevs; ma-ma_name != NULL; ma++)
 		config_found(self, ma, mainbus_print);



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

2010-11-21 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Nov 21 18:53:57 UTC 2010

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

Log Message:
Make local functions/variable static.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/dreamcast/dreamcast/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/dreamcast/dreamcast/mainbus.c
diff -u src/sys/arch/dreamcast/dreamcast/mainbus.c:1.10 src/sys/arch/dreamcast/dreamcast/mainbus.c:1.11
--- src/sys/arch/dreamcast/dreamcast/mainbus.c:1.10	Sun Nov 21 17:59:36 2010
+++ src/sys/arch/dreamcast/dreamcast/mainbus.c	Sun Nov 21 18:53:56 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.10 2010/11/21 17:59:36 tsutsui Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.11 2010/11/21 18:53:56 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -27,18 +27,18 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.10 2010/11/21 17:59:36 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.11 2010/11/21 18:53:56 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
 #include sys/device.h
 #include machine/autoconf.h
 
-int mainbus_match(device_t, cfdata_t, void *);
-void mainbus_attach(device_t, device_t, void *);
-int mainbus_print(void *, const char *);
+static int mainbus_match(device_t, cfdata_t, void *);
+static void mainbus_attach(device_t, device_t, void *);
+static int mainbus_print(void *, const char *);
 
-struct mainbus_attach_args mainbusdevs[] = {
+static struct mainbus_attach_args mainbusdevs[] = {
 	{ cpu },
 	{ shb },
 	{ NULL }	/* terminator */



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

2010-11-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Nov 20 16:12:24 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev/g2: aica.c

Log Message:
Make aica_round_blocksize() always return a fixed buffer size.

I'm not sure if this is correct, but audio playback doesn't work
on dreamcast without this workaround. (since kent-audio1 merge?)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/dreamcast/dev/g2/aica.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/dreamcast/dev/g2/aica.c
diff -u src/sys/arch/dreamcast/dev/g2/aica.c:1.18 src/sys/arch/dreamcast/dev/g2/aica.c:1.19
--- src/sys/arch/dreamcast/dev/g2/aica.c:1.18	Fri Aug  1 20:19:49 2008
+++ src/sys/arch/dreamcast/dev/g2/aica.c	Sat Nov 20 16:12:23 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: aica.c,v 1.18 2008/08/01 20:19:49 marcus Exp $	*/
+/*	$NetBSD: aica.c,v 1.19 2010/11/20 16:12:23 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2003 SHIMIZU Ryo r...@misakimix.org
@@ -29,7 +29,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: aica.c,v 1.18 2008/08/01 20:19:49 marcus Exp $);
+__KERNEL_RCSID(0, $NetBSD: aica.c,v 1.19 2010/11/20 16:12:23 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -479,6 +479,7 @@
 int
 aica_round_blocksize(void *addr, int blk, int mode, const audio_params_t *param)
 {
+#if 0	/* XXX this has not worked since kent-audio1 merge? */
 	struct aica_softc *sc;
 
 	sc = addr;
@@ -505,6 +506,7 @@
 		break;
 	}
 
+#endif
 	return AICA_DMABUF_SIZE / 4;
 }
 



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

2010-10-24 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Oct 24 13:34:27 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev: pvr.c pvrvar.h

Log Message:
- make local functions/variables static
- export more cons(9) functions in pvrvar.h


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/dreamcast/dev/pvr.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/dreamcast/dev/pvrvar.h

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

Modified files:

Index: src/sys/arch/dreamcast/dev/pvr.c
diff -u src/sys/arch/dreamcast/dev/pvr.c:1.29 src/sys/arch/dreamcast/dev/pvr.c:1.30
--- src/sys/arch/dreamcast/dev/pvr.c:1.29	Wed Oct 20 13:00:06 2010
+++ src/sys/arch/dreamcast/dev/pvr.c	Sun Oct 24 13:34:27 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pvr.c,v 1.29 2010/10/20 13:00:06 tsutsui Exp $	*/
+/*	$NetBSD: pvr.c,v 1.30 2010/10/24 13:34:27 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt.
@@ -35,7 +35,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: pvr.c,v 1.29 2010/10/20 13:00:06 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: pvr.c,v 1.30 2010/10/24 13:34:27 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -155,43 +155,43 @@
 	int nscreens;
 };
 
-int	pvr_match(device_t, cfdata_t, void *);
-void	pvr_attach(device_t, device_t, void *);
+static int	pvr_match(device_t, cfdata_t, void *);
+static void	pvr_attach(device_t, device_t, void *);
 
 CFATTACH_DECL_NEW(pvr, sizeof(struct pvr_softc),
 pvr_match, pvr_attach, NULL, NULL);
 
-void	pvr_getdevconfig(struct fb_devconfig *);
+static void	pvr_getdevconfig(struct fb_devconfig *);
 
-struct fb_devconfig pvr_console_dc;
+static struct fb_devconfig pvr_console_dc;
 
-char pvr_stdscreen_textgeom[32] = { std };	/* XXX yuck */
+static char pvr_stdscreen_textgeom[32] = { std };	/* XXX yuck */
 
-struct wsscreen_descr pvr_stdscreen = {
+static struct wsscreen_descr pvr_stdscreen = {
 	pvr_stdscreen_textgeom, 0, 0,
 	0, /* textops */
 	0, 0,
 	WSSCREEN_WSCOLORS,
 };
 
-const struct wsscreen_descr *_pvr_scrlist[] = {
+static const struct wsscreen_descr *_pvr_scrlist[] = {
 	pvr_stdscreen,
 };
 
-const struct wsscreen_list pvr_screenlist = {
+static const struct wsscreen_list pvr_screenlist = {
 	sizeof(_pvr_scrlist) / sizeof(struct wsscreen_descr *), _pvr_scrlist
 };
 
-int	pvrioctl(void *, void *, u_long, void *, int, struct lwp *);
-paddr_t	pvrmmap(void *, void *, off_t, int);
+static int	pvrioctl(void *, void *, u_long, void *, int, struct lwp *);
+static paddr_t	pvrmmap(void *, void *, off_t, int);
 
-int	pvr_alloc_screen(void *, const struct wsscreen_descr *,
-	void **, int *, int *, long *);
-void	pvr_free_screen(void *, void *);
-int	pvr_show_screen(void *, void *, int,
-	void (*)(void *, int, int), void *);
+static int	pvr_alloc_screen(void *, const struct wsscreen_descr *,
+		void **, int *, int *, long *);
+static void	pvr_free_screen(void *, void *);
+static int	pvr_show_screen(void *, void *, int,
+		void (*)(void *, int, int), void *);
 
-const struct wsdisplay_accessops pvr_accessops = {
+static const struct wsdisplay_accessops pvr_accessops = {
 	pvrioctl,
 	pvrmmap,
 	pvr_alloc_screen,
@@ -200,7 +200,7 @@
 	NULL, /* load_font */
 };
 
-void	pvrinit(struct fb_devconfig *);
+static void	pvrinit(struct fb_devconfig *);
 
 int	pvr_is_console;
 
@@ -580,9 +580,6 @@
 
 /* Console support. */
 
-void	pvrcnprobe(struct consdev *);
-void	pvrcninit(struct consdev *);
-
 void
 pvrcninit(struct consdev *cndev)
 {

Index: src/sys/arch/dreamcast/dev/pvrvar.h
diff -u src/sys/arch/dreamcast/dev/pvrvar.h:1.3 src/sys/arch/dreamcast/dev/pvrvar.h:1.4
--- src/sys/arch/dreamcast/dev/pvrvar.h:1.3	Thu Feb  1 01:25:56 2001
+++ src/sys/arch/dreamcast/dev/pvrvar.h	Sun Oct 24 13:34:27 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: pvrvar.h,v 1.3 2001/02/01 01:25:56 thorpej Exp $ */
+/* $NetBSD: pvrvar.h,v 1.4 2010/10/24 13:34:27 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt
@@ -32,4 +32,6 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+void	pvrcnprobe(struct consdev *);
+void	pvrcninit(struct consdev *);
 int	pvr_cnattach(void);



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

2010-10-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Oct 20 13:00:06 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev: pvr.c

Log Message:
Split device_t/softc.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/dreamcast/dev/pvr.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/dreamcast/dev/pvr.c
diff -u src/sys/arch/dreamcast/dev/pvr.c:1.28 src/sys/arch/dreamcast/dev/pvr.c:1.29
--- src/sys/arch/dreamcast/dev/pvr.c:1.28	Sat Jun 19 08:42:48 2010
+++ src/sys/arch/dreamcast/dev/pvr.c	Wed Oct 20 13:00:06 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pvr.c,v 1.28 2010/06/19 08:42:48 tsutsui Exp $	*/
+/*	$NetBSD: pvr.c,v 1.29 2010/10/20 13:00:06 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt.
@@ -35,7 +35,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: pvr.c,v 1.28 2010/06/19 08:42:48 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: pvr.c,v 1.29 2010/10/20 13:00:06 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -150,15 +150,15 @@
 #define	PVR_VGAMODE	0x02		/* VGA */
 
 struct pvr_softc {
-	struct device sc_dev;
+	device_t sc_dev;
 	struct fb_devconfig *sc_dc;	/* device configuration */
 	int nscreens;
 };
 
-int	pvr_match(struct device *, struct cfdata *, void *);
-void	pvr_attach(struct device *, struct device *, void *);
+int	pvr_match(device_t, cfdata_t, void *);
+void	pvr_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(pvr, sizeof(struct pvr_softc),
+CFATTACH_DECL_NEW(pvr, sizeof(struct pvr_softc),
 pvr_match, pvr_attach, NULL, NULL);
 
 void	pvr_getdevconfig(struct fb_devconfig *);
@@ -205,7 +205,7 @@
 int	pvr_is_console;
 
 int
-pvr_match(struct device *parent, struct cfdata *match, void *aux)
+pvr_match(device_t parent, cfdata_t cf, void *aux)
 {
 
 	return 1;
@@ -278,14 +278,15 @@
 }
 
 void
-pvr_attach(struct device *parent, struct device *self, void *aux)
+pvr_attach(device_t parent, device_t self, void *aux)
 {
-	struct pvr_softc *sc = (void *) self;
+	struct pvr_softc *sc = device_private(self);
 	struct wsemuldisplaydev_attach_args waa;
 	int console;
 	static const char *tvsystem_name[4] =
 		{ NTSC, PAL, PAL-M, PAL-N };
 
+	sc-sc_dev = self;
 	console = pvr_is_console;
 	if (console) {
 		sc-sc_dc = pvr_console_dc;



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

2010-10-17 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Oct 17 14:13:44 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev/maple: maple.c maple.h maplevar.h mkbd.c
mkbdvar.h mlcd.c mmemcard.c mms.c

Log Message:
Split device_t/softc.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/dreamcast/dev/maple/maple.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/dreamcast/dev/maple/maple.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/dreamcast/dev/maple/maplevar.h \
src/sys/arch/dreamcast/dev/maple/mlcd.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/dreamcast/dev/maple/mkbd.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/dreamcast/dev/maple/mkbdvar.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/dreamcast/dev/maple/mmemcard.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/dreamcast/dev/maple/mms.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/dreamcast/dev/maple/maple.c
diff -u src/sys/arch/dreamcast/dev/maple/maple.c:1.40 src/sys/arch/dreamcast/dev/maple/maple.c:1.41
--- src/sys/arch/dreamcast/dev/maple/maple.c:1.40	Sun Oct 19 14:05:49 2008
+++ src/sys/arch/dreamcast/dev/maple/maple.c	Sun Oct 17 14:13:44 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: maple.c,v 1.40 2008/10/19 14:05:49 mjf Exp $	*/
+/*	$NetBSD: maple.c,v 1.41 2010/10/17 14:13:44 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: maple.c,v 1.40 2008/10/19 14:05:49 mjf Exp $);
+__KERNEL_RCSID(0, $NetBSD: maple.c,v 1.41 2010/10/17 14:13:44 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -107,8 +107,8 @@
 /*
  * Function declarations.
  */
-static int	maplematch(struct device *, struct cfdata *, void *);
-static void	mapleattach(struct device *, struct device *, void *);
+static int	maplematch(device_t, cfdata_t, void *);
+static void	mapleattach(device_t, device_t, void *);
 static void	maple_scanbus(struct maple_softc *);
 static char *	maple_unit_name(char *, int port, int subunit);
 static void	maple_begin_txbuf(struct maple_softc *);
@@ -157,7 +157,7 @@
  */
 int	maple_polling;		/* Are we polling?  (Debugger mode) */
 
-CFATTACH_DECL(maple, sizeof(struct maple_softc),
+CFATTACH_DECL_NEW(maple, sizeof(struct maple_softc),
 maplematch, mapleattach, NULL, NULL);
 
 extern struct cfdriver maple_cd;
@@ -172,14 +172,14 @@
 };
 
 static int
-maplematch(struct device *parent, struct cfdata *cf, void *aux)
+maplematch(device_t parent, cfdata_t cf, void *aux)
 {
 
 	return 1;
 }
 
 static void
-mapleattach(struct device *parent, struct device *self, void *aux)
+mapleattach(device_t parent, device_t self, void *aux)
 {
 	struct maple_softc *sc;
 	struct maple_unit *u;
@@ -188,13 +188,14 @@
 	uint32_t *p;
 	int port, subunit, f;
 
-	sc = (struct maple_softc *)self;
+	sc = device_private(self);
+	sc-sc_dev = self;
 
 	printf(: %s\n, sysasic_intr_string(IRL_MAPLE));
 
 	if (maple_alloc_dma(MAPLE_DMABUF_SIZE, dmabuffer, dmabuffer_phys)) {
 		printf(%s: unable to allocate DMA buffers.\n,
-		sc-sc_dev.dv_xname);
+		device_xname(self));
 		return;
 	}
 
@@ -246,10 +247,10 @@
 	config_pending_incr();	/* create thread before mounting root */
 
 	if (kthread_create(PRI_NONE, 0, NULL, maple_event_thread, sc,
-	sc-event_thread, %s, sc-sc_dev.dv_xname) == 0)
+	sc-event_thread, %s, device_xname(self)) == 0)
 		return;
 
-	panic(%s: unable to create event thread, sc-sc_dev.dv_xname);
+	panic(%s: unable to create event thread, device_xname(self));
 }
 
 /*
@@ -304,13 +305,13 @@
 }
 
 void
-maple_run_polling(struct device *dev)
+maple_run_polling(device_t dev)
 {
 	struct maple_softc *sc;
 	int port, subunit;
 	int i;
 
-	sc = (struct maple_softc *)dev;
+	sc = device_private(dev);
 
 	/*
 	 * first, make sure polling works
@@ -672,10 +673,10 @@
 	ma.ma_basedevinfo = sc-sc_unit[u-port][0].devinfo;
 	func = be32toh(ma.ma_devinfo-di_func);
 
-	maple_print_unit(ma, sc-sc_dev.dv_xname);
+	maple_print_unit(ma, device_xname(sc-sc_dev));
 	printf(\n);
-	strcpy(oldxname, sc-sc_dev.dv_xname);
-	maple_unit_name(sc-sc_dev.dv_xname, u-port, u-subunit);
+	strcpy(oldxname, device_xname(sc-sc_dev));
+	maple_unit_name(sc-sc_dev-dv_xname, u-port, u-subunit);
 
 	for (f = 0; f  MAPLE_NFUNC; f++) {
 		u-u_func[f].f_callback = NULL;
@@ -684,7 +685,7 @@
 		u-u_func[f].f_dev = NULL;
 		if (func  MAPLE_FUNC(f)) {
 			ma.ma_function = f;
-			u-u_func[f].f_dev = config_found_sm_loc(sc-sc_dev,
+			u-u_func[f].f_dev = config_found_sm_loc(sc-sc_dev,
 			maple, NULL, ma, mapleprint, maplesubmatch);
 			u-u_ping_func = f;	/* XXX using largest func */
 		}
@@ -702,7 +703,7 @@
 		u-u_ping_stat = MAPLE_PING_NORMAL;
 	}
 #endif
-	strcpy(sc-sc_dev.dv_xname, oldxname);
+	strcpy(sc-sc_dev-dv_xname, oldxname);
 
 	sc-sc_port_units[u-port] |= 1  u-subunit;
 }
@@ -760,11 +761,11 @@
 			if ((error = config_detach(fn-f_dev, DETACH_FORCE))) {
 printf(%s: 

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

2010-10-17 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Oct 17 14:16:22 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev/maple: mms.c

Log Message:
Make local functions static.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/dreamcast/dev/maple/mms.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/dreamcast/dev/maple/mms.c
diff -u src/sys/arch/dreamcast/dev/maple/mms.c:1.15 src/sys/arch/dreamcast/dev/maple/mms.c:1.16
--- src/sys/arch/dreamcast/dev/maple/mms.c:1.15	Sun Oct 17 14:13:44 2010
+++ src/sys/arch/dreamcast/dev/maple/mms.c	Sun Oct 17 14:16:21 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mms.c,v 1.15 2010/10/17 14:13:44 tsutsui Exp $	*/
+/*	$NetBSD: mms.c,v 1.16 2010/10/17 14:16:21 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mms.c,v 1.15 2010/10/17 14:13:44 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: mms.c,v 1.16 2010/10/17 14:16:21 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -91,16 +91,16 @@
 	struct device *sc_wsmousedev;
 };
 
-int	mms_match(device_t, cfdata_t, void *);
-void	mms_attach(device_t, device_t, void *);
-int	mms_detach(device_t, int);
+static int	mms_match(device_t, cfdata_t, void *);
+static void	mms_attach(device_t, device_t, void *);
+static int	mms_detach(device_t, int);
 
 CFATTACH_DECL_NEW(mms, sizeof(struct mms_softc),
 mms_match, mms_attach, mms_detach, NULL);
 
-int	mms_enable(void *);
-int	mms_ioctl(void *, u_long, void *, int, struct lwp *);
-void	mms_disable(void *);
+static int	mms_enable(void *);
+static int	mms_ioctl(void *, u_long, void *, int, struct lwp *);
+static void	mms_disable(void *);
 
 const struct wsmouse_accessops mms_accessops = {
 	mms_enable,
@@ -108,9 +108,9 @@
 	mms_disable,
 };
 
-void	mms_intr(void *, struct maple_response *, int, int);
+static void	mms_intr(void *, struct maple_response *, int, int);
 
-int
+static int
 mms_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct maple_attach_args *ma = aux;
@@ -118,7 +118,7 @@
 	return ma-ma_function == MAPLE_FN_MOUSE ? MAPLE_MATCH_FUNC : 0;
 }
 
-void
+static void
 mms_attach(device_t parent, device_t self, void *aux)
 {
 	struct mms_softc *sc = device_private(self);
@@ -163,7 +163,7 @@
 	maple_set_callback(parent, sc-sc_unit, MAPLE_FN_MOUSE, mms_intr, sc);
 }
 
-int
+static int
 mms_detach(device_t self, int flags)
 {
 	struct mms_softc *sc = device_private(self);
@@ -175,7 +175,7 @@
 	return rv;
 }
 
-int
+static int
 mms_enable(void *v)
 {
 	struct mms_softc *sc = v;
@@ -184,7 +184,7 @@
 	return 0;
 }
 
-void
+static void
 mms_disable(void *v)
 {
 	struct mms_softc *sc = v;
@@ -192,7 +192,7 @@
 	maple_enable_periodic(sc-sc_parent, sc-sc_unit, MAPLE_FN_MOUSE, 0);
 }
 
-int
+static int
 mms_ioctl(void *v, u_long cmd, void *data, int flag, struct lwp *l)
 {
 
@@ -212,7 +212,7 @@
 	return 0;
 }
 
-void
+static void
 mms_intr(void *arg, struct maple_response *response, int size, int flags)
 {
 	struct mms_softc *sc = arg;



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

2010-10-17 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Oct 17 14:17:49 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev/maple: maple.c mlcd.c mmemcard.c

Log Message:
Include ioconf.h for struct cfdriver.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/dreamcast/dev/maple/maple.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/dreamcast/dev/maple/mlcd.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/dreamcast/dev/maple/mmemcard.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/dreamcast/dev/maple/maple.c
diff -u src/sys/arch/dreamcast/dev/maple/maple.c:1.41 src/sys/arch/dreamcast/dev/maple/maple.c:1.42
--- src/sys/arch/dreamcast/dev/maple/maple.c:1.41	Sun Oct 17 14:13:44 2010
+++ src/sys/arch/dreamcast/dev/maple/maple.c	Sun Oct 17 14:17:49 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: maple.c,v 1.41 2010/10/17 14:13:44 tsutsui Exp $	*/
+/*	$NetBSD: maple.c,v 1.42 2010/10/17 14:17:49 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: maple.c,v 1.41 2010/10/17 14:13:44 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: maple.c,v 1.42 2010/10/17 14:17:49 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -89,6 +89,7 @@
 #include dreamcast/dev/maple/maplereg.h
 #include dreamcast/dev/maple/mapleio.h
 
+#include ioconf.h
 #include locators.h
 
 /* Internal macros, functions, and variables. */
@@ -160,8 +161,6 @@
 CFATTACH_DECL_NEW(maple, sizeof(struct maple_softc),
 maplematch, mapleattach, NULL, NULL);
 
-extern struct cfdriver maple_cd;
-
 dev_type_open(mapleopen);
 dev_type_close(mapleclose);
 dev_type_ioctl(mapleioctl);

Index: src/sys/arch/dreamcast/dev/maple/mlcd.c
diff -u src/sys/arch/dreamcast/dev/maple/mlcd.c:1.13 src/sys/arch/dreamcast/dev/maple/mlcd.c:1.14
--- src/sys/arch/dreamcast/dev/maple/mlcd.c:1.13	Sun Oct 17 14:13:44 2010
+++ src/sys/arch/dreamcast/dev/maple/mlcd.c	Sun Oct 17 14:17:49 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mlcd.c,v 1.13 2010/10/17 14:13:44 tsutsui Exp $	*/
+/*	$NetBSD: mlcd.c,v 1.14 2010/10/17 14:17:49 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mlcd.c,v 1.13 2010/10/17 14:13:44 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: mlcd.c,v 1.14 2010/10/17 14:17:49 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -44,6 +44,8 @@
 #include dreamcast/dev/maple/maple.h
 #include dreamcast/dev/maple/mapleconf.h
 
+#include ioconf.h
+
 #define MLCD_MAXACCSIZE	1012	/* (255*4) - 8  =  253*32 / 8 */
 
 struct mlcd_funcdef {	/* XXX assuming little-endian structure packing */
@@ -174,8 +176,6 @@
 CFATTACH_DECL_NEW(mlcd, sizeof(struct mlcd_softc),
 mlcdmatch, mlcdattach, mlcddetach, NULL);
 
-extern struct cfdriver mlcd_cd;
-
 /* initial image NetBSD dreamcast */
 static const char initimg48x32[192] = {
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

Index: src/sys/arch/dreamcast/dev/maple/mmemcard.c
diff -u src/sys/arch/dreamcast/dev/maple/mmemcard.c:1.19 src/sys/arch/dreamcast/dev/maple/mmemcard.c:1.20
--- src/sys/arch/dreamcast/dev/maple/mmemcard.c:1.19	Sun Oct 17 14:13:44 2010
+++ src/sys/arch/dreamcast/dev/maple/mmemcard.c	Sun Oct 17 14:17:49 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mmemcard.c,v 1.19 2010/10/17 14:13:44 tsutsui Exp $	*/
+/*	$NetBSD: mmemcard.c,v 1.20 2010/10/17 14:17:49 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mmemcard.c,v 1.19 2010/10/17 14:13:44 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: mmemcard.c,v 1.20 2010/10/17 14:17:49 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/buf.h
@@ -49,6 +49,8 @@
 #include dreamcast/dev/maple/maple.h
 #include dreamcast/dev/maple/mapleconf.h
 
+#include ioconf.h
+
 #define MMEM_MAXACCSIZE	1012	/* (255*4) - 8  =  253*32 / 8 */
 
 struct mmem_funcdef {	/* XXX assuming little-endian structure packing */
@@ -199,8 +201,6 @@
 CFATTACH_DECL_NEW(mmem, sizeof(struct mmem_softc),
 mmemmatch, mmemattach, mmemdetach, NULL);
 
-extern struct cfdriver mmem_cd;
-
 struct dkdriver mmemdkdriver = { mmemstrategy };
 
 static int



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

2010-10-13 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Oct 13 10:56:56 UTC 2010

Modified Files:
src/sys/arch/dreamcast/conf: GENERIC std.dreamcast

Log Message:
Include std.sh3 to pull options CPU_IN_CKSUM.  Noted by Ryo SHIMIZU.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/dreamcast/conf/GENERIC
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/dreamcast/conf/std.dreamcast

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

Modified files:

Index: src/sys/arch/dreamcast/conf/GENERIC
diff -u src/sys/arch/dreamcast/conf/GENERIC:1.96 src/sys/arch/dreamcast/conf/GENERIC:1.97
--- src/sys/arch/dreamcast/conf/GENERIC:1.96	Wed Sep  1 16:13:32 2010
+++ src/sys/arch/dreamcast/conf/GENERIC	Wed Oct 13 10:56:56 2010
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.96 2010/09/01 16:13:32 he Exp $
+# $NetBSD: GENERIC,v 1.97 2010/10/13 10:56:56 tsutsui Exp $
 #
 # GENERIC machine description file
 # 
@@ -67,7 +67,6 @@
 
 # Executable format options
 options 	EXEC_COFF	# COFF executables
-options 	EXEC_ELF32	# 32-bit ELF executables
 
 # File systems
 file-system 	FFS		# UFS

Index: src/sys/arch/dreamcast/conf/std.dreamcast
diff -u src/sys/arch/dreamcast/conf/std.dreamcast:1.8 src/sys/arch/dreamcast/conf/std.dreamcast:1.9
--- src/sys/arch/dreamcast/conf/std.dreamcast:1.8	Fri Mar 17 16:06:51 2006
+++ src/sys/arch/dreamcast/conf/std.dreamcast	Wed Oct 13 10:56:56 2010
@@ -1,11 +1,10 @@
-# $NetBSD: std.dreamcast,v 1.8 2006/03/17 16:06:51 uebayasi Exp $
+# $NetBSD: std.dreamcast,v 1.9 2010/10/13 10:56:56 tsutsui Exp $
 #
 # standard, required NetBSD/dreamcast 'options'
 
 machine dreamcast sh3
-include		conf/std	# MI standard options
-
-options 	EXEC_SCRIPT	# exec #! scripts
+include		conf/std			# MI standard options
+include		arch/sh3/conf/std.sh3		# arch standard options
 
 # CPU support
 options 	SH4



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

2010-10-13 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Oct 13 14:13:33 UTC 2010

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

Log Message:
Prepare empty module_init_md() for options MODULAR.
It just works on dreamcast even with root on gdrom environment.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/dreamcast/dreamcast/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/dreamcast/dreamcast/machdep.c
diff -u src/sys/arch/dreamcast/dreamcast/machdep.c:1.40 src/sys/arch/dreamcast/dreamcast/machdep.c:1.41
--- src/sys/arch/dreamcast/dreamcast/machdep.c:1.40	Fri Nov 27 03:23:06 2009
+++ src/sys/arch/dreamcast/dreamcast/machdep.c	Wed Oct 13 14:13:32 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.40 2009/11/27 03:23:06 rmind Exp $	*/
+/*	$NetBSD: machdep.c,v 1.41 2010/10/13 14:13:32 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2002 The NetBSD Foundation, Inc.
@@ -65,13 +65,14 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.40 2009/11/27 03:23:06 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.41 2010/10/13 14:13:32 tsutsui Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
 #include opt_memsize.h
 #include scif.h
 #include opt_kloader.h
+#include opt_modular.h
 
 #include sys/param.h
 #include sys/systm.h
@@ -81,6 +82,7 @@
 #include sys/sysctl.h
 #include sys/ksyms.h
 #include sys/device.h
+#include sys/module.h
 
 #ifdef KGDB
 #include sys/kgdb.h
@@ -289,3 +291,13 @@
 		(*ih-ih_func)(ih-ih_arg);
 	}
 }
+
+#ifdef MODULAR
+/*
+ * Push any modules loaded by the bootloader etc.
+ */
+void
+module_init_md(void)
+{
+}
+#endif



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

2010-10-13 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Oct 13 14:34:27 UTC 2010

Modified Files:
src/sys/arch/dreamcast/conf: GENERIC

Log Message:
Add commented out options MODULAR.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/arch/dreamcast/conf/GENERIC

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

Modified files:

Index: src/sys/arch/dreamcast/conf/GENERIC
diff -u src/sys/arch/dreamcast/conf/GENERIC:1.97 src/sys/arch/dreamcast/conf/GENERIC:1.98
--- src/sys/arch/dreamcast/conf/GENERIC:1.97	Wed Oct 13 10:56:56 2010
+++ src/sys/arch/dreamcast/conf/GENERIC	Wed Oct 13 14:34:27 2010
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.97 2010/10/13 10:56:56 tsutsui Exp $
+# $NetBSD: GENERIC,v 1.98 2010/10/13 14:34:27 tsutsui Exp $
 #
 # GENERIC machine description file
 # 
@@ -42,6 +42,8 @@
 options 	SYSVSHM		# System V-like memory sharing
 options 	P1003_1B_SEMAPHORE # p1003.1b semaphore support
 
+#options 	MODULAR		# new style module framework
+
 # Diagnostic/debugging support options
 #options 	DIAGNOSTIC	# cheap kernel consistency checks
 #options 	DEBUG		# expensive debugging checks/support



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

2010-09-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Sep  1 15:08:22 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev: gdrom.c

Log Message:
- use bufq(9)
- account busy counter of disk(9)


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/dreamcast/dev/gdrom.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/dreamcast/dev/gdrom.c
diff -u src/sys/arch/dreamcast/dev/gdrom.c:1.29 src/sys/arch/dreamcast/dev/gdrom.c:1.30
--- src/sys/arch/dreamcast/dev/gdrom.c:1.29	Wed Sep  1 12:25:27 2010
+++ src/sys/arch/dreamcast/dev/gdrom.c	Wed Sep  1 15:08:22 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdrom.c,v 1.29 2010/09/01 12:25:27 tsutsui Exp $	*/
+/*	$NetBSD: gdrom.c,v 1.30 2010/09/01 15:08:22 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt
@@ -33,13 +33,14 @@
  */
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
-__KERNEL_RCSID(0, $NetBSD: gdrom.c,v 1.29 2010/09/01 12:25:27 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: gdrom.c,v 1.30 2010/09/01 15:08:22 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
 #include sys/device.h
 
 #include sys/buf.h
+#include sys/bufq.h
 #include sys/ioctl.h
 #include sys/fcntl.h
 #include sys/disklabel.h
@@ -74,10 +75,12 @@
 
 struct gdrom_softc {
 	device_t sc_dev;	/* generic device info */
-	struct disk dkdev;	/* generic disk info */
+	struct disk sc_dk;	/* generic disk info */
+	struct bufq_state *sc_bufq;	/* device buffer queue */
 	struct buf curbuf;	/* state of current I/O operation */
 
 	int is_open, is_busy;
+	bool is_active;
 	int openpart_start;	/* start sector of currently open partition */
 
 	int cmd_active;
@@ -126,6 +129,7 @@
 int	gdrom_read_sectors(struct gdrom_softc *, void *, int, int, int *);
 int	gdrom_mount_disk(struct gdrom_softc *);
 int	gdrom_intr(void *);
+void	gdrom_start(struct gdrom_softc *);
 
 int gdrom_getstat(void)
 {
@@ -389,11 +393,13 @@
 	sc = device_private(self);
 	sc-sc_dev = self;
 
+	bufq_alloc(sc-sc_bufq, disksort, BUFQ_SORT_RAWBLOCK);
+
 	/*
 	 * Initialize and attach the disk structure.
 	 */
-	disk_init(sc-dkdev, device_xname(self), gdromdkdriver);
-	disk_attach(sc-dkdev);
+	disk_init(sc-sc_dk, device_xname(self), gdromdkdriver);
+	disk_attach(sc-sc_dk);
 
 	/*
 	 * reenable disabled drive
@@ -475,7 +481,7 @@
 gdromstrategy(struct buf *bp)
 {
 	struct gdrom_softc *sc;
-	int s, unit, error, resid;
+	int s, unit;
 #ifdef GDROMDEBUG
 	printf(GDROM: strategy\n);
 #endif
@@ -494,19 +500,10 @@
 	bp-b_bcount11, bp-b_bcount);
 #endif
 	s = splbio();
-	while (sc-is_busy)
-		tsleep(sc-is_busy, PRIBIO, gdbusy, 0);
-	sc-is_busy = 1;
+	bufq_put(sc-sc_bufq, bp);
 	splx(s);
-
-	if ((error = gdrom_read_sectors(sc, bp-b_data, bp-b_rawblkno,
-	bp-b_bcount  11, resid)))
-		bp-b_error = error;
-
-	sc-is_busy = 0;
-	wakeup(sc-is_busy);
-	bp-b_resid = resid;
-	biodone(bp);
+	if (!sc-is_active)
+		gdrom_start(sc);
 	return;
 
  done:
@@ -514,6 +511,48 @@
 	biodone(bp);
 }
 
+void
+gdrom_start(struct gdrom_softc *sc)
+{
+	struct buf *bp;
+	int error, resid, s;
+
+	sc-is_active = true;
+
+	for (;;) {
+		s = splbio();
+		bp = bufq_get(sc-sc_bufq);
+		if (bp == NULL) {
+			splx(s);
+			break;
+		}
+
+		while (sc-is_busy)
+			tsleep(sc-is_busy, PRIBIO, gdbusy, 0);
+		sc-is_busy = 1;
+		disk_busy(sc-sc_dk);
+		splx(s);
+
+		error = gdrom_read_sectors(sc, bp-b_data, bp-b_rawblkno,
+		bp-b_bcount  11, resid);
+		bp-b_error = error;
+		bp-b_resid = resid;
+		if (error != 0)
+			bp-b_resid = bp-b_bcount;
+
+		sc-is_busy = 0;
+		wakeup(sc-is_busy);
+		
+		s = splbio();
+		disk_unbusy(sc-sc_dk, bp-b_bcount - bp-b_resid,
+		(bp-b_flags  B_READ) != 0);
+		splx(s);
+		biodone(bp);
+	}
+
+	sc-is_active = false;
+}
+
 int
 gdromioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
 {



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

2010-09-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Sep  1 15:20:12 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev: gdrom.c

Log Message:
Replace an empty for() loop (which would be optimized out) with DELAY(1).
No visible performance difference.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/dreamcast/dev/gdrom.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/dreamcast/dev/gdrom.c
diff -u src/sys/arch/dreamcast/dev/gdrom.c:1.30 src/sys/arch/dreamcast/dev/gdrom.c:1.31
--- src/sys/arch/dreamcast/dev/gdrom.c:1.30	Wed Sep  1 15:08:22 2010
+++ src/sys/arch/dreamcast/dev/gdrom.c	Wed Sep  1 15:20:12 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdrom.c,v 1.30 2010/09/01 15:08:22 tsutsui Exp $	*/
+/*	$NetBSD: gdrom.c,v 1.31 2010/09/01 15:20:12 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
-__KERNEL_RCSID(0, $NetBSD: gdrom.c,v 1.30 2010/09/01 15:08:22 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: gdrom.c,v 1.31 2010/09/01 15:20:12 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -227,8 +227,7 @@
 		return -1;
 	
 	GDROM_COND = 0xa0;
-	for (i = 0; i  64; i++)
-		;
+	DELAY(1);
 	while ((GDROM_BUSY  0x88) != 8)
 		;
 



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

2010-09-01 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Wed Sep  1 16:13:33 UTC 2010

Modified Files:
src/sys/arch/dreamcast/conf: GENERIC

Log Message:
Bump SYMTAB_SPACE so that it fits again.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/dreamcast/conf/GENERIC

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

Modified files:

Index: src/sys/arch/dreamcast/conf/GENERIC
diff -u src/sys/arch/dreamcast/conf/GENERIC:1.95 src/sys/arch/dreamcast/conf/GENERIC:1.96
--- src/sys/arch/dreamcast/conf/GENERIC:1.95	Wed Jun 30 06:57:13 2010
+++ src/sys/arch/dreamcast/conf/GENERIC	Wed Sep  1 16:13:32 2010
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.95 2010/06/30 06:57:13 he Exp $
+# $NetBSD: GENERIC,v 1.96 2010/09/01 16:13:32 he Exp $
 #
 # GENERIC machine description file
 # 
@@ -50,7 +50,7 @@
 #options 	KGDB			# remote debugger
 #options 	KGDB_DEVNAME=\scif\,KGDB_DEVRATE=57600
 #makeoptions	DEBUG=-g	# compile full symbol table
-options 	SYMTAB_SPACE=308000
+options 	SYMTAB_SPACE=31
 #options 	SYSCALL_DEBUG
 #options 	UVMHIST
 #options 	UVMHIST_PRINT



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

2010-09-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Sep  1 16:23:15 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev: gdrom.c

Log Message:
Make local functions static, and comment out an unused function.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/dreamcast/dev/gdrom.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/dreamcast/dev/gdrom.c
diff -u src/sys/arch/dreamcast/dev/gdrom.c:1.32 src/sys/arch/dreamcast/dev/gdrom.c:1.33
--- src/sys/arch/dreamcast/dev/gdrom.c:1.32	Wed Sep  1 15:40:06 2010
+++ src/sys/arch/dreamcast/dev/gdrom.c	Wed Sep  1 16:23:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdrom.c,v 1.32 2010/09/01 15:40:06 tsutsui Exp $	*/
+/*	$NetBSD: gdrom.c,v 1.33 2010/09/01 16:23:15 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
-__KERNEL_RCSID(0, $NetBSD: gdrom.c,v 1.32 2010/09/01 15:40:06 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: gdrom.c,v 1.33 2010/09/01 16:23:15 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -53,8 +53,8 @@
 
 #include ioconf.h
 
-int	gdrommatch(device_t, cfdata_t, void *);
-void	gdromattach(device_t, device_t, void *);
+static int  gdrommatch(device_t, cfdata_t, void *);
+static void gdromattach(device_t, device_t, void *);
 
 dev_type_open(gdromopen);
 dev_type_close(gdromclose);
@@ -121,18 +121,23 @@
 #define GDROM_CNTHI	GDROM(0x94)
 #define GDROM_COND	GDROM(0x9c)
 
-int	gdrom_getstat(void);
-int	gdrom_do_command(struct gdrom_softc *, void *, void *, unsigned int,
-	int *);
-int	gdrom_command_sense(struct gdrom_softc *, void *, void *, unsigned int,
-	int *);
-int	gdrom_read_toc(struct gdrom_softc *, struct gd_toc *);
-int	gdrom_read_sectors(struct gdrom_softc *, void *, int, int, int *);
-int	gdrom_mount_disk(struct gdrom_softc *);
-int	gdrom_intr(void *);
-void	gdrom_start(struct gdrom_softc *);
+#if 0
+static int gdrom_getstat(void);
+#endif
+static int gdrom_do_command(struct gdrom_softc *, void *, void *,
+unsigned int, int *);
+static int gdrom_command_sense(struct gdrom_softc *, void *, void *,
+unsigned int, int *);
+static int gdrom_read_toc(struct gdrom_softc *, struct gd_toc *);
+static int gdrom_read_sectors(struct gdrom_softc *, void *, int, int,
+int *);
+static int gdrom_mount_disk(struct gdrom_softc *);
+static int gdrom_intr(void *);
+static void gdrom_start(struct gdrom_softc *);
 
-int gdrom_getstat(void)
+#if 0
+int
+gdrom_getstat(void)
 {
 	uint8_t s1, s2, s3;
 
@@ -150,6 +155,7 @@
 	else
 		return -1;
 }
+#endif
 
 int
 gdrom_intr(void *arg)



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

2010-09-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Sep  1 16:48:00 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev: gdrom.c

Log Message:
- misc KNF and cosmetics
- use DPRINTF() style debug printf macro


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/dreamcast/dev/gdrom.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/dreamcast/dev/gdrom.c
diff -u src/sys/arch/dreamcast/dev/gdrom.c:1.33 src/sys/arch/dreamcast/dev/gdrom.c:1.34
--- src/sys/arch/dreamcast/dev/gdrom.c:1.33	Wed Sep  1 16:23:15 2010
+++ src/sys/arch/dreamcast/dev/gdrom.c	Wed Sep  1 16:48:00 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdrom.c,v 1.33 2010/09/01 16:23:15 tsutsui Exp $	*/
+/*	$NetBSD: gdrom.c,v 1.34 2010/09/01 16:48:00 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
-__KERNEL_RCSID(0, $NetBSD: gdrom.c,v 1.33 2010/09/01 16:23:15 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: gdrom.c,v 1.34 2010/09/01 16:48:00 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -103,6 +103,12 @@
 	unsigned int leadout;
 };
 
+#ifdef GDROMDEBUG
+#define DPRINTF(x)	printf x
+#else
+#define DPRINTF(x)	/**/
+#endif
+
 #define TOC_LBA(n)	((n)  0xff00)
 #define TOC_ADR(n)	((n)  0x0f)
 #define TOC_CTRL(n)	(((n)  0xf0)  4)
@@ -166,22 +172,16 @@
 
 	s = splbio();
 	cond = GDROM_COND;
-#ifdef GDROMDEBUG
-	printf(GDROM: cond = %x\n, cond);
-#endif
+	DPRINTF((GDROM: cond = %x\n, cond));
 	if (!sc-cmd_active) {
-#ifdef GDROMDEBUG
-		printf(GDROM: inactive IRQ!?\n);
-#endif
+		DPRINTF((GDROM: inactive IRQ!?\n));
 		splx(s);
 		return 0;
 	}
 
-	if ((cond  8)) {
+	if ((cond  0x08) != 0) {
 		int cnt = (GDROM_CNTHI  8) | GDROM_CNTLO;
-#ifdef GDROMDEBUG
-		printf(GDROM: cnt = %d\n, cnt);
-#endif
+		DPRINTF((GDROM: cnt = %d\n, cnt));
 		sc-cmd_actual += cnt;
 		if (cnt  0  sc-cmd_result_size  0) {
 			int subcnt = (cnt  sc-cmd_result_size ?
@@ -201,9 +201,9 @@
 			cnt -= 2;
 		}
 	}
-	while (GDROM_BUSY  0x80);
+	while ((GDROM_BUSY  0x80) != 0);
 	
-	if ((cond  8) == 0) {
+	if ((cond  0x08) == 0) {
 		sc-cmd_cond = cond;
 		sc-cmd_active = 0;
 		wakeup(sc-cmd_active);
@@ -214,7 +214,8 @@
 }
 
 
-int gdrom_do_command(struct gdrom_softc *sc, void *req, void *buf,
+int
+gdrom_do_command(struct gdrom_softc *sc, void *req, void *buf,
 unsigned int nbyt, int *resid)
 {
 	int i, s;
@@ -230,12 +231,12 @@
 	sc-cmd_result_buf = buf;
 	sc-cmd_result_size = nbyt;
 
-	if (GDSTATSTAT(GDROM_STAT) == 6)
+	if (GDSTATSTAT(GDROM_STAT) == 0x06)
 		return -1;
 	
 	GDROM_COND = 0xa0;
 	DELAY(1);
-	while ((GDROM_BUSY  0x88) != 8)
+	while ((GDROM_BUSY  0x88) != 0x08)
 		;
 
 	s = splbio();
@@ -243,7 +244,7 @@
 	sc-cmd_actual = 0;
 	sc-cmd_active = 1;
 
-	for (i = 0; i 6; i++)
+	for (i = 0; i  6; i++)
 		GDROM_DATA = ptr[i];
 	
 	while (sc-cmd_active)
@@ -261,30 +262,28 @@
 int gdrom_command_sense(struct gdrom_softc *sc, void *req, void *buf,
 unsigned int nbyt, int *resid)
 {
-	/* 76543210 76543210
-	   0   0x13  -
-	   2-  bufsz(hi)
-	   4 bufsz(lo)   -
-	   6--
-	   8--
-	   10--*/
+	/*
+	 *  76543210 76543210
+	 *  0   0x13  -
+	 *  2-  bufsz(hi)
+	 *  4 bufsz(lo)   -
+	 *  6--
+	 *  8--
+	 * 10--
+	 */
 	uint16_t sense_data[5];
 	uint8_t cmd[12];
-	int sense_key, sense_specific;
+	int cond, sense_key, sense_specific;
 
-	int cond = gdrom_do_command(sc, req, buf, nbyt, resid);
+	cond = gdrom_do_command(sc, req, buf, nbyt, resid);
 
 	if (cond  0) {
-#ifdef GDROMDEBUG
-		printf(GDROM: not ready (2:58)\n);
-#endif
+		DPRINTF((GDROM: not ready (2:58)\n));
 		return EIO;
 	}
 	
 	if ((cond  1) == 0) {
-#ifdef GDROMDEBUG
-		printf(GDROM: no sense.  0:0\n);
-#endif
+		DPRINTF((GDROM: no sense.  0:0\n));
 		return 0;
 	}
 	
@@ -298,29 +297,27 @@
 	sense_key = sense_data[1]  0xf;
 	sense_specific = sense_data[4];
 	if (sense_key == 11  sense_specific == 0) {
-#ifdef GDROMDEBUG
-		printf(GDROM: aborted (ignored).  0:0\n);
-#endif
+		DPRINTF((GDROM: aborted (ignored).  0:0\n));
 		return 0;
 	}
 	
-#ifdef GDROMDEBUG
-	printf(GDROM: SENSE %d:, sense_key);
-	printf(GDROM: %d\n, sense_specific);
-#endif
+	DPRINTF((GDROM: SENSE %d:, sense_key));
+	DPRINTF((GDROM: %d\n, sense_specific));
 	
 	return sense_key == 0 ? 0 : EIO;
 }
 
 int gdrom_read_toc(struct gdrom_softc *sc, struct gd_toc *toc)
 {
-	/* 76543210 76543210
-	   0   0x14  -
-	   2-  bufsz(hi)
-	   4 bufsz(lo)   -
-	   6--
-	   8--
-	   10--*/
+	/*
+	 *  76543210 76543210
+	 *  0   0x14  -
+	 *  2-  bufsz(hi)
+	 *  4 bufsz(lo)   -
+	 *  6--
+	 *  8--
+	 * 10--
+	 */
 	uint8_t cmd[12];
 
 	memset(cmd, 0, sizeof(cmd));
@@ -335,24 +332,26 @@
 int gdrom_read_sectors(struct 

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

2010-09-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Sep  1 17:06:00 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev/g2: g2rtc.c

Log Message:
- split device_t/softc
- allocate struct todr_chip_handle in per-device softc
- some cosmetics


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/dreamcast/dev/g2/g2rtc.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/dreamcast/dev/g2/g2rtc.c
diff -u src/sys/arch/dreamcast/dev/g2/g2rtc.c:1.4 src/sys/arch/dreamcast/dev/g2/g2rtc.c:1.5
--- src/sys/arch/dreamcast/dev/g2/g2rtc.c:1.4	Sat Dec 12 14:44:09 2009
+++ src/sys/arch/dreamcast/dev/g2/g2rtc.c	Wed Sep  1 17:06:00 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: g2rtc.c,v 1.4 2009/12/12 14:44:09 tsutsui Exp $ */
+/* $NetBSD: g2rtc.c,v 1.5 2010/09/01 17:06:00 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: g2rtc.c,v 1.4 2009/12/12 14:44:09 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: g2rtc.c,v 1.5 2010/09/01 17:06:00 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -46,36 +46,30 @@
 #define G2RTC_OFFSET	(20 * SECYR + 5 * SECDAY)
 
 struct g2rtc_softc {
-	struct device sc_dev;
+	device_t sc_dev;
 
 	bus_space_tag_t sc_bt;
 	bus_space_handle_t sc_bh;
+	struct todr_chip_handle sc_tch;
 };
 
 /* autoconf glue */
-static int g2rtc_match(struct device *, struct cfdata *, void *);
-static void g2rtc_attach(struct device *, struct device *, void *);
+static int g2rtc_match(device_t, cfdata_t, void *);
+static void g2rtc_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(g2rtc, sizeof(struct g2rtc_softc),
-	  g2rtc_match, g2rtc_attach, NULL, NULL);
+CFATTACH_DECL_NEW(g2rtc, sizeof(struct g2rtc_softc),
+g2rtc_match, g2rtc_attach, NULL, NULL);
 
 
 /* todr(9) methods */
 static int g2rtc_todr_gettime(todr_chip_handle_t, struct timeval *);
 static int g2rtc_todr_settime(todr_chip_handle_t, struct timeval *);
 
-static struct todr_chip_handle g2rtc_todr_handle = {
-	.cookie   = NULL,	/* set on attach */
-	.todr_gettime = g2rtc_todr_gettime,
-	.todr_settime = g2rtc_todr_settime,
-};
-
-
 static inline uint32_t g2rtc_read(bus_space_tag_t, bus_space_handle_t);
 
 
 static int
-g2rtc_match(struct device *parent, struct cfdata *cf, void *aux)
+g2rtc_match(device_t parent, cfdata_t cf, void *aux)
 {
 	static int g2rtc_matched = 0;
 
@@ -88,22 +82,26 @@
 
 
 static void
-g2rtc_attach(struct device *parent, struct device *self, void *aux)
+g2rtc_attach(device_t parent, device_t self, void *aux)
 {
-	struct g2rtc_softc *sc = (void *)self;
+	struct g2rtc_softc *sc = device_private(self);
 	struct g2bus_attach_args *ga = aux;
+	todr_chip_handle_t tch;
 
+	sc-sc_dev = self;
 	sc-sc_bt = ga-ga_memt;
 	if (bus_space_map(sc-sc_bt, G2RTC_REG_BASE, G2RTC_REG_SIZE, 0,
-			  sc-sc_bh) != 0)
-	{
+	sc-sc_bh) != 0) {
 		printf(: unable to map registers\n);
 		return;
 	}
 	printf(: time-of-day clock\n);
 
-	g2rtc_todr_handle.cookie = sc;
-	todr_attach(g2rtc_todr_handle);
+	tch = sc-sc_tch;
+	tch-cookie = sc;
+	tch-todr_gettime = g2rtc_todr_gettime,
+	tch-todr_settime = g2rtc_todr_settime,
+	todr_attach(tch);
 }
 
 
@@ -112,7 +110,7 @@
 {
 	
 	return ((bus_space_read_4(bt, bh, 0)  0x)  16)
-		| (bus_space_read_4(bt, bh, 4)  0x);
+	| (bus_space_read_4(bt, bh, 4)  0x);
 }
 
 
@@ -173,5 +171,4 @@
 	}
 
 	return EIO;
-
 }



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

2010-08-31 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Aug 31 12:12:48 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev: gdrom.c

Log Message:
Set bp-b_resid properly after data transfer is complete.
Fixes unexpected Bad address errors on file read ops since January 2006.

The problem is reported and tracked by Yasushi Oshima.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/dreamcast/dev/gdrom.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/dreamcast/dev/gdrom.c
diff -u src/sys/arch/dreamcast/dev/gdrom.c:1.26 src/sys/arch/dreamcast/dev/gdrom.c:1.27
--- src/sys/arch/dreamcast/dev/gdrom.c:1.26	Fri Aug  1 20:19:49 2008
+++ src/sys/arch/dreamcast/dev/gdrom.c	Tue Aug 31 12:12:48 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdrom.c,v 1.26 2008/08/01 20:19:49 marcus Exp $	*/
+/*	$NetBSD: gdrom.c,v 1.27 2010/08/31 12:12:48 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
-__KERNEL_RCSID(0, $NetBSD: gdrom.c,v 1.26 2008/08/01 20:19:49 marcus Exp $);
+__KERNEL_RCSID(0, $NetBSD: gdrom.c,v 1.27 2010/08/31 12:12:48 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -118,10 +118,12 @@
 #define GDROM_COND	GDROM(0x9c)
 
 int	gdrom_getstat(void);
-int	gdrom_do_command(struct gdrom_softc *, void *, void *, unsigned int);
-int	gdrom_command_sense(struct gdrom_softc *, void *, void *, unsigned int);
+int	gdrom_do_command(struct gdrom_softc *, void *, void *, unsigned int,
+	int *);
+int	gdrom_command_sense(struct gdrom_softc *, void *, void *, unsigned int,
+	int *);
 int	gdrom_read_toc(struct gdrom_softc *, struct gd_toc *);
-int	gdrom_read_sectors(struct gdrom_softc *, void *, int, int);
+int	gdrom_read_sectors(struct gdrom_softc *, void *, int, int, int *);
 int	gdrom_mount_disk(struct gdrom_softc *);
 int	gdrom_intr(void *);
 
@@ -202,7 +204,7 @@
 
 
 int gdrom_do_command(struct gdrom_softc *sc, void *req, void *buf,
-unsigned int nbyt)
+unsigned int nbyt, int *resid)
 {
 	int i, s;
 	short *ptr = req;
@@ -239,12 +241,15 @@
 
 	splx(s);
 
+	if (resid != NULL)
+		*resid = sc-cmd_result_size;
+
 	return sc-cmd_cond;
 }
 
 
 int gdrom_command_sense(struct gdrom_softc *sc, void *req, void *buf,
-unsigned int nbyt)
+unsigned int nbyt, int *resid)
 {
 	/* 76543210 76543210
 	   0   0x13  -
@@ -257,7 +262,7 @@
 	unsigned char cmd[12];
 	int sense_key, sense_specific;
 
-	int cond = gdrom_do_command(sc, req, buf, nbyt);
+	int cond = gdrom_do_command(sc, req, buf, nbyt, resid);
 
 	if (cond  0) {
 #ifdef GDROMDEBUG
@@ -278,7 +283,7 @@
 	cmd[0] = 0x13;
 	cmd[4] = sizeof(sense_data);
 	
-	gdrom_do_command(sc, cmd, sense_data, sizeof(sense_data));
+	gdrom_do_command(sc, cmd, sense_data, sizeof(sense_data), NULL);
 	
 	sense_key = sense_data[1]  0xf;
 	sense_specific = sense_data[4];
@@ -314,10 +319,11 @@
 	cmd[3] = sizeof(struct gd_toc)  8;
 	cmd[4] = sizeof(struct gd_toc)  0xff;
 	
-	return gdrom_command_sense(sc, cmd, toc, sizeof(struct gd_toc));
+	return gdrom_command_sense(sc, cmd, toc, sizeof(struct gd_toc), NULL);
 }
 
-int gdrom_read_sectors(struct gdrom_softc *sc, void *buf, int sector, int cnt)
+int gdrom_read_sectors(struct gdrom_softc *sc, void *buf, int sector, int cnt,
+int *resid)
 {
 	/* 76543210 76543210
 	   0   0x30datafmt
@@ -339,7 +345,7 @@
 	cmd[9] = cnt8;
 	cmd[10] = cnt;
 
-	return gdrom_command_sense(sc, cmd, buf, cnt  11);
+	return gdrom_command_sense(sc, cmd, buf, cnt  11, resid);
 }
 
 int gdrom_mount_disk(struct gdrom_softc *sc)
@@ -358,7 +364,7 @@
 	cmd[0] = 0x70;
 	cmd[1] = 0x1f;
 	
-	return gdrom_command_sense(sc, cmd, NULL, 0);
+	return gdrom_command_sense(sc, cmd, NULL, 0, NULL);
 }
 
 int
@@ -468,7 +474,7 @@
 gdromstrategy(struct buf *bp)
 {
 	struct gdrom_softc *sc;
-	int s, unit, error;
+	int s, unit, error, resid;
 #ifdef GDROMDEBUG
 	printf(GDROM: strategy\n);
 #endif
@@ -493,11 +499,14 @@
 	splx(s);
 
 	if ((error = gdrom_read_sectors(sc, bp-b_data, bp-b_rawblkno,
-	bp-b_bcount  11)))
+	bp-b_bcount  11, resid)))
 		bp-b_error = error;
 
 	sc-is_busy = 0;
 	wakeup(sc-is_busy);
+	bp-b_resid = resid;
+	biodone(bp);
+	return;
 
  done:
 	bp-b_resid = bp-b_bcount;



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

2010-08-31 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Aug 31 15:17:20 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev: gdrom.c

Log Message:
- split device_t/softc
- include ioconf.h for struct cfdriver


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/dreamcast/dev/gdrom.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/dreamcast/dev/gdrom.c
diff -u src/sys/arch/dreamcast/dev/gdrom.c:1.27 src/sys/arch/dreamcast/dev/gdrom.c:1.28
--- src/sys/arch/dreamcast/dev/gdrom.c:1.27	Tue Aug 31 12:12:48 2010
+++ src/sys/arch/dreamcast/dev/gdrom.c	Tue Aug 31 15:17:20 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdrom.c,v 1.27 2010/08/31 12:12:48 tsutsui Exp $	*/
+/*	$NetBSD: gdrom.c,v 1.28 2010/08/31 15:17:20 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
-__KERNEL_RCSID(0, $NetBSD: gdrom.c,v 1.27 2010/08/31 12:12:48 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: gdrom.c,v 1.28 2010/08/31 15:17:20 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -50,8 +50,10 @@
 
 #include machine/sysasicvar.h
 
-int	gdrommatch(struct device *, struct cfdata *, void *);
-void	gdromattach(struct device *, struct device *, void *);
+#include ioconf.h
+
+int	gdrommatch(device_t, cfdata_t, void *);
+void	gdromattach(device_t, device_t, void *);
 
 dev_type_open(gdromopen);
 dev_type_close(gdromclose);
@@ -71,7 +73,7 @@
 };
 
 struct gdrom_softc {
-	struct device sc_dv;	/* generic device info; must come first */
+	device_t sc_dev;	/* generic device info */
 	struct disk dkdev;	/* generic disk info */
 	struct buf curbuf;	/* state of current I/O operation */
 
@@ -85,13 +87,11 @@
 	int cmd_cond;		/* resulting condition of command */
 };
 
-CFATTACH_DECL(gdrom, sizeof(struct gdrom_softc),
+CFATTACH_DECL_NEW(gdrom, sizeof(struct gdrom_softc),
 gdrommatch, gdromattach, NULL, NULL);
 
 struct dkdriver gdromdkdriver = { gdromstrategy };
 
-extern struct cfdriver gdrom_cd;
-
 
 struct gd_toc {
 	unsigned int entry[99];
@@ -368,7 +368,7 @@
 }
 
 int
-gdrommatch(struct device *parent, struct cfdata *cf, void *aux)
+gdrommatch(device_t parent, cfdata_t cf, void *aux)
 {
 	static int gdrom_matched = 0;
 
@@ -381,17 +381,18 @@
 }
 
 void
-gdromattach(struct device *parent, struct device *self, void *aux)
+gdromattach(device_t parent, device_t self, void *aux)
 {
 	struct gdrom_softc *sc;
 	uint32_t p, x;
 
-	sc = (struct gdrom_softc *)self;
+	sc = device_private(self);
+	sc-sc_dev = self;
 
 	/*
 	 * Initialize and attach the disk structure.
 	 */
-	disk_init(sc-dkdev, sc-sc_dv.dv_xname, gdromdkdriver);
+	disk_init(sc-dkdev, device_xname(self), gdromdkdriver);
 	disk_attach(sc-dkdev);
 
 	/*



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

2010-08-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Aug  1 12:42:46 UTC 2010

Modified Files:
src/sys/arch/dreamcast/include: pci_machdep.h

Log Message:
Fix typo in pci_intr_disestablish(9) macro.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/dreamcast/include/pci_machdep.h

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

Modified files:

Index: src/sys/arch/dreamcast/include/pci_machdep.h
diff -u src/sys/arch/dreamcast/include/pci_machdep.h:1.5 src/sys/arch/dreamcast/include/pci_machdep.h:1.6
--- src/sys/arch/dreamcast/include/pci_machdep.h:1.5	Sun Dec 11 12:17:06 2005
+++ src/sys/arch/dreamcast/include/pci_machdep.h	Sun Aug  1 12:42:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.h,v 1.5 2005/12/11 12:17:06 christos Exp $	*/
+/*	$NetBSD: pci_machdep.h,v 1.6 2010/08/01 12:42:45 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt
@@ -93,4 +93,4 @@
 #define	pci_intr_establish(c, ih, l, h, a)\
 (*(c)-pc_intr_establish)((c)-pc_intr_v, (ih), (l), (h), (a))
 #define	pci_intr_disestablish(c, ih)	\
-(*(c)-pc_intr_disestablish)((v)-pc_intr_v, (ih))
+(*(c)-pc_intr_disestablish)((c)-pc_intr_v, (ih))



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

2010-06-19 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jun 19 08:42:48 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev: pvr.c

Log Message:
Add WSDISPLAYIO_LINEBYTES, required by Xorg wsfb server.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/dreamcast/dev/pvr.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/dreamcast/dev/pvr.c
diff -u src/sys/arch/dreamcast/dev/pvr.c:1.27 src/sys/arch/dreamcast/dev/pvr.c:1.28
--- src/sys/arch/dreamcast/dev/pvr.c:1.27	Sat May 15 08:53:27 2010
+++ src/sys/arch/dreamcast/dev/pvr.c	Sat Jun 19 08:42:48 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pvr.c,v 1.27 2010/05/15 08:53:27 tsutsui Exp $	*/
+/*	$NetBSD: pvr.c,v 1.28 2010/06/19 08:42:48 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt.
@@ -35,7 +35,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: pvr.c,v 1.27 2010/05/15 08:53:27 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: pvr.c,v 1.28 2010/06/19 08:42:48 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -332,6 +332,10 @@
 #undef wsd_fbip
 		return 0;
 
+	case WSDISPLAYIO_LINEBYTES:
+		*(u_int *)data = sc-sc_dc-rinfo.ri_stride;
+		return 0;
+
 	case WSDISPLAYIO_GETCMAP:
 	case WSDISPLAYIO_PUTCMAP:
 		return EPASSTHROUGH;	/* XXX Colormap */



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

2010-05-15 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat May 15 06:48:23 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev: pvr.c

Log Message:
Set RI_NO_AUTO in ri_flg if pvr_getdevconfig() is invoked from cninit.
Tested on gxemul.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/dreamcast/dev/pvr.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/dreamcast/dev/pvr.c
diff -u src/sys/arch/dreamcast/dev/pvr.c:1.25 src/sys/arch/dreamcast/dev/pvr.c:1.26
--- src/sys/arch/dreamcast/dev/pvr.c:1.25	Mon May 26 10:31:22 2008
+++ src/sys/arch/dreamcast/dev/pvr.c	Sat May 15 06:48:22 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pvr.c,v 1.25 2008/05/26 10:31:22 nisimura Exp $	*/
+/*	$NetBSD: pvr.c,v 1.26 2010/05/15 06:48:22 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt.
@@ -35,7 +35,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: pvr.c,v 1.25 2008/05/26 10:31:22 nisimura Exp $);
+__KERNEL_RCSID(0, $NetBSD: pvr.c,v 1.26 2010/05/15 06:48:22 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -238,6 +238,8 @@
 	pvrinit(dc);
 
 	dc-rinfo.ri_flg = 0;
+	if (dc == pvr_console_dc)
+		dc-rinfo.ri_flg |= RI_NO_AUTO;
 	dc-rinfo.ri_depth = dc-dc_depth;
 	dc-rinfo.ri_bits = (void *) dc-dc_videobase;
 	dc-rinfo.ri_width = dc-dc_wid;



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

2010-02-24 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Feb 24 22:58:45 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev/maple: mlcd.c

Log Message:
Use device_t, device_private().


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/dreamcast/dev/maple/mlcd.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/dreamcast/dev/maple/mlcd.c
diff -u src/sys/arch/dreamcast/dev/maple/mlcd.c:1.11 src/sys/arch/dreamcast/dev/maple/mlcd.c:1.12
--- src/sys/arch/dreamcast/dev/maple/mlcd.c:1.11	Wed Jun 11 14:55:30 2008
+++ src/sys/arch/dreamcast/dev/maple/mlcd.c	Wed Feb 24 22:58:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mlcd.c,v 1.11 2008/06/11 14:55:30 tsutsui Exp $	*/
+/*	$NetBSD: mlcd.c,v 1.12 2010/02/24 22:58:45 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mlcd.c,v 1.11 2008/06/11 14:55:30 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: mlcd.c,v 1.12 2010/02/24 22:58:45 dyoung Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -93,7 +93,7 @@
 struct mlcd_softc {
 	struct device	sc_dev;
 
-	struct device	*sc_parent;
+	device_t sc_parent;
 	struct maple_unit *sc_unit;
 	int		sc_direction;
 	enum mlcd_stat {
@@ -148,9 +148,9 @@
 #define MLCD_UNIT(dev)		(minor(dev)  8)
 #define MLCD_MINOR(unit, part)	(((unit)  8) | (part))
 
-static int	mlcdmatch(struct device *, struct cfdata *, void *);
-static void	mlcdattach(struct device *, struct device *, void *);
-static int	mlcddetach(struct device *, int);
+static int	mlcdmatch(device_t, struct cfdata *, void *);
+static void	mlcdattach(device_t, device_t, void *);
+static int	mlcddetach(device_t, int);
 static void	mlcd_intr(void *, struct maple_response *, int, int);
 static void	mlcd_printerror(const char *, uint32_t);
 static struct mlcd_buf *mlcd_buf_alloc(int /*dev*/, int /*flags*/);
@@ -198,7 +198,7 @@
 
 /* ARGSUSED */
 static int
-mlcdmatch(struct device *parent, struct cfdata *cf, void *aux)
+mlcdmatch(device_t parent, struct cfdata *cf, void *aux)
 {
 	struct maple_attach_args *ma = aux;
 
@@ -206,9 +206,9 @@
 }
 
 static void
-mlcdattach(struct device *parent, struct device *self, void *aux)
+mlcdattach(device_t parent, device_t self, void *aux)
 {
-	struct mlcd_softc *sc = (void *) self;
+	struct mlcd_softc *sc = device_private(self);
 	struct maple_attach_args *ma = aux;
 	int i;
 	union {
@@ -282,9 +282,9 @@
 
 /* ARGSUSED1 */
 static int
-mlcddetach(struct device *self, int flags)
+mlcddetach(device_t self, int flags)
 {
-	struct mlcd_softc *sc = (struct mlcd_softc *) self;
+	struct mlcd_softc *sc = device_private(self);
 	struct mlcd_buf *bp;
 	int minor_l, minor_h;
 



CVS commit: src/sys/arch/dreamcast

2009-08-23 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Aug 23 14:28:09 UTC 2009

Modified Files:
src/sys/arch/dreamcast/dev/g2: g2bus_bus_mem.c
src/sys/arch/dreamcast/include: bus.h

Log Message:
Add an empty bus_space_mmap(9) function as temporary workaround
for MI pci(4) mmap function in sys/dev/pci/pci_usrreq.c.

XXX: no bus_space_subregion(9) for g2bus.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/dreamcast/dev/g2/g2bus_bus_mem.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/dreamcast/include/bus.h

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

Modified files:

Index: src/sys/arch/dreamcast/dev/g2/g2bus_bus_mem.c
diff -u src/sys/arch/dreamcast/dev/g2/g2bus_bus_mem.c:1.14 src/sys/arch/dreamcast/dev/g2/g2bus_bus_mem.c:1.15
--- src/sys/arch/dreamcast/dev/g2/g2bus_bus_mem.c:1.14	Mon Apr 28 20:23:16 2008
+++ src/sys/arch/dreamcast/dev/g2/g2bus_bus_mem.c	Sun Aug 23 14:28:09 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: g2bus_bus_mem.c,v 1.14 2008/04/28 20:23:16 martin Exp $	*/
+/*	$NetBSD: g2bus_bus_mem.c,v 1.15 2009/08/23 14:28:09 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
-__KERNEL_RCSID(0, $NetBSD: g2bus_bus_mem.c,v 1.14 2008/04/28 20:23:16 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: g2bus_bus_mem.c,v 1.15 2009/08/23 14:28:09 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -53,6 +53,7 @@
 int	g2bus_bus_mem_map(void *, bus_addr_t, bus_size_t, int,
 	bus_space_handle_t *);
 void	g2bus_bus_mem_unmap(void *, bus_space_handle_t, bus_size_t);
+paddr_t	g2bus_bus_mem_mmap(void *, bus_addr_t, off_t, int, int);
 
 uint8_t g2bus_bus_mem_read_1(void *, bus_space_handle_t, bus_size_t);
 uint16_t g2bus_bus_mem_read_2(void *, bus_space_handle_t, bus_size_t);
@@ -114,6 +115,7 @@
 
 	t-dbs_map = g2bus_bus_mem_map;
 	t-dbs_unmap = g2bus_bus_mem_unmap;
+	t-dbs_mmap = g2bus_bus_mem_mmap;
 
 	t-dbs_r_1 = g2bus_bus_mem_read_1;
 	t-dbs_r_2 = g2bus_bus_mem_read_2;
@@ -153,6 +155,14 @@
 	/* Nothing to do. */
 }
 
+paddr_t
+g2bus_bus_mem_mmap(void *v, bus_addr_t addr, off_t offset, int prot, int flags)
+{
+
+	/* XXX not implemented */
+	return -1;
+}
+
 /*
  * G2 bus cycles must not be interrupted by IRQs or G2 DMA.
  * The following paired macros will take the necessary precautions.

Index: src/sys/arch/dreamcast/include/bus.h
diff -u src/sys/arch/dreamcast/include/bus.h:1.14 src/sys/arch/dreamcast/include/bus.h:1.15
--- src/sys/arch/dreamcast/include/bus.h:1.14	Mon Apr 28 20:23:16 2008
+++ src/sys/arch/dreamcast/include/bus.h	Sun Aug 23 14:28:09 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.h,v 1.14 2008/04/28 20:23:16 martin Exp $	*/
+/*	$NetBSD: bus.h,v 1.15 2009/08/23 14:28:09 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -121,6 +121,7 @@
 			bus_size_t);
 	int		(*dbs_subregion)(void *, bus_space_handle_t,
 			bus_size_t, bus_size_t, bus_space_handle_t *);
+	paddr_t		(*dbs_mmap)(void *, bus_addr_t, off_t, int, int);
 
 	/* allocation/deallocation */
 	int		(*dbs_alloc)(void *, bus_addr_t, bus_addr_t,
@@ -270,6 +271,8 @@
 	(*(t)-dbs_unmap)((t)-dbs_cookie, (h), (s))
 #define	bus_space_subregion(t, h, o, s, hp)\
 	(*(t)-dbs_subregion)((t)-dbs_cookie, (h), (o), (s), (hp))
+#define	bus_space_mmap(t, a, o, p, f)\
+	(*(t)-dbs_mmap)((t)-dbs_cookie, (a), (o), (p), (f))
 
 #endif /* _KERNEL */
 



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

2009-08-23 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Aug 23 14:38:44 UTC 2009

Modified Files:
src/sys/arch/dreamcast/conf: GENERIC

Log Message:
Use rlphy(4) instead of ukphy(4) for BbA.
---
rtk0 at pci0 dev 0 function 0: SEGA Broadband Adapter (rev. 0x10)
rtk0: interrupting at SH4 IRL 11
rtk0: Ethernet address 00:d0:f1:03:69:68
rlphy0 at rtk0 phy 7: Realtek internal PHY
rlphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/sys/arch/dreamcast/conf/GENERIC

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

Modified files:

Index: src/sys/arch/dreamcast/conf/GENERIC
diff -u src/sys/arch/dreamcast/conf/GENERIC:1.90 src/sys/arch/dreamcast/conf/GENERIC:1.91
--- src/sys/arch/dreamcast/conf/GENERIC:1.90	Sat Jan 24 05:06:05 2009
+++ src/sys/arch/dreamcast/conf/GENERIC	Sun Aug 23 14:38:43 2009
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.90 2009/01/24 05:06:05 mrg Exp $
+# $NetBSD: GENERIC,v 1.91 2009/08/23 14:38:43 tsutsui Exp $
 #
 # GENERIC machine description file
 # 
@@ -187,7 +187,7 @@
 gapspci*	at g2bus?			# GAPS PCI bridge
 pci*		at gapspci?
 rtk*		at pci? dev ? function ?	# SEGA Broadband Adapter
-ukphy*		at mii? phy ?
+rlphy*		at mii? phy ?
 
 mbe*		at g2bus?			# SEGA LAN Adapter