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

2011-12-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Dec 30 12:14:04 UTC 2011

Modified Files:
src/sys/arch/usermode/conf: GENERIC.common

Log Message:
add WSDISPLAY_COMPAT_USL to make 'wsconscfg -s' work


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/usermode/conf/GENERIC.common

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/usermode/conf/GENERIC.common
diff -u src/sys/arch/usermode/conf/GENERIC.common:1.7 src/sys/arch/usermode/conf/GENERIC.common:1.8
--- src/sys/arch/usermode/conf/GENERIC.common:1.7	Thu Dec 29 21:22:49 2011
+++ src/sys/arch/usermode/conf/GENERIC.common	Fri Dec 30 12:14:04 2011
@@ -1,9 +1,9 @@
-# $NetBSD: GENERIC.common,v 1.7 2011/12/29 21:22:49 jmcneill Exp $
+# $NetBSD: GENERIC.common,v 1.8 2011/12/30 12:14:04 jmcneill Exp $
 
 include arch/usermode/conf/std.usermode
 
 options 	INCLUDE_CONFIG_FILE
-#ident 		GENERIC-$Revision: 1.7 $
+#ident 		GENERIC-$Revision: 1.8 $
 maxusers 	32
 
 makeoptions	DEBUG=-O1 -g3
@@ -61,8 +61,9 @@ wsdisplay0	at vncfb?
 wskbd0		at vncfb?
 options 	WSEMUL_VT100
 options 	WS_KERNEL_FG=WSCOL_GREEN
-options		WSKBD_DEFAULT_KEYREPEAT_DEL1=1000
-options		WSKBD_DEFAULT_KEYREPEAT_DELN=200
+options 	WSKBD_DEFAULT_KEYREPEAT_DEL1=1000
+options 	WSKBD_DEFAULT_KEYREPEAT_DELN=200
+options 	WSDISPLAY_COMPAT_USL
 
 pseudo-device	loop
 pseudo-device	pty



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

2011-12-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Dec 30 12:14:44 UTC 2011

Modified Files:
src/sys/arch/usermode/dev: vnckbdmap.c

Log Message:
map Fn keys, make vt switching work


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/dev/vnckbdmap.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/usermode/dev/vnckbdmap.c
diff -u src/sys/arch/usermode/dev/vnckbdmap.c:1.1 src/sys/arch/usermode/dev/vnckbdmap.c:1.2
--- src/sys/arch/usermode/dev/vnckbdmap.c:1.1	Thu Dec 29 21:22:49 2011
+++ src/sys/arch/usermode/dev/vnckbdmap.c	Fri Dec 30 12:14:44 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: vnckbdmap.c,v 1.1 2011/12/29 21:22:49 jmcneill Exp $ */
+/* $NetBSD: vnckbdmap.c,v 1.2 2011/12/30 12:14:44 jmcneill Exp $ */
 
 /*
  * Copyright (c) 1999,2001,2011 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vnckbdmap.c,v 1.1 2011/12/29 21:22:49 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: vnckbdmap.c,v 1.2 2011/12/30 12:14:44 jmcneill Exp $);
 
 #include sys/types.h
 #include dev/wscons/wsksymdef.h
@@ -51,7 +51,7 @@ static const keysym_t vnckbd_keydesc_us[
 KC(0xf13),			KS_Pause,
 KC(0xf14),			KS_Hold_Screen,
 //  KC(0xf15),			KS_SysReq,
-KC(0xf1b),			KS_Escape,
+KC(0xf1b),	KS_Cmd_Debugger, KS_Escape,
 KC(0xfff),			KS_Delete,
 
 /* X11 cursor control  motion */
@@ -60,8 +60,8 @@ static const keysym_t vnckbd_keydesc_us[
 KC(0xf52),			KS_Up,
 KC(0xf53),			KS_Right,
 KC(0xf54),			KS_Down,
-KC(0xf55),			KS_Prior,
-KC(0xf56),			KS_Next,
+KC(0xf55),	KS_Cmd_ScrollFastUp, KS_Prior,
+KC(0xf56),	KS_Cmd_ScrollFastDown, KS_Next,
 KC(0xf57),			KS_End,
 //  KC(0xf58),			KS_Begin,
 
@@ -84,16 +84,36 @@ static const keysym_t vnckbd_keydesc_us[
 /* ... */
 
 /* X11 auxiliary functions */
-/* ... */
+KC(0xfbe),	KS_Cmd_Screen0,	KS_F1,
+KC(0xfbf),	KS_Cmd_Screen1,	KS_F2,
+KC(0xfc0),	KS_Cmd_Screen2,	KS_F3,
+KC(0xfc1),	KS_Cmd_Screen3,	KS_F4,
+KC(0xfc2),	KS_Cmd_Screen4,	KS_F5,
+KC(0xfc3),	KS_Cmd_Screen5,	KS_F6,
+KC(0xfc4),	KS_Cmd_Screen6,	KS_F7,
+KC(0xfc5),	KS_Cmd_Screen7,	KS_F8,
+KC(0xfc6),	KS_Cmd_Screen8,	KS_F9,
+KC(0xfc7),	KS_Cmd_Screen9,	KS_F10,
+KC(0xfc8),			KS_F11,
+KC(0xfc9),			KS_F12,
+KC(0xfca),			KS_F13,
+KC(0xfcb),			KS_F14,
+KC(0xfcc),			KS_F15,
+KC(0xfcd),			KS_F16,
+KC(0xfce),			KS_F17,
+KC(0xfcf),			KS_F18,
+KC(0xfd0),			KS_F19,
+KC(0xfd1),			KS_F20,
+/* ... F21 - F35 */
 
 /* X11 modifiers */
 KC(0xfe1),			KS_Shift_L,
 KC(0xfe2),			KS_Shift_R,
-KC(0xfe3),			KS_Control_L,
+KC(0xfe3),	KS_Cmd1,	KS_Control_L,
 KC(0xfe4),			KS_Control_R,
 KC(0xfe5),			KS_Caps_Lock,
 KC(0xfe6),			KS_Shift_Lock,
-KC(0xfe7),			KS_Meta_L,
+KC(0xfe7),	KS_Cmd2,	KS_Meta_L,
 KC(0xfe8),			KS_Meta_R,
 KC(0xfe9),			KS_Alt_L,
 KC(0xfea),			KS_Alt_R,



CVS commit: src/sys/arch/usermode

2011-12-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Dec 30 12:54:42 UTC 2011

Modified Files:
src/sys/arch/usermode/dev: vncfb.c
src/sys/arch/usermode/include: thunk.h
src/sys/arch/usermode/usermode: thunk.c

Log Message:
support wskbd bell


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/usermode/dev/vncfb.c
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/usermode/usermode/thunk.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/usermode/dev/vncfb.c
diff -u src/sys/arch/usermode/dev/vncfb.c:1.4 src/sys/arch/usermode/dev/vncfb.c:1.5
--- src/sys/arch/usermode/dev/vncfb.c:1.4	Fri Dec 30 11:06:18 2011
+++ src/sys/arch/usermode/dev/vncfb.c	Fri Dec 30 12:54:41 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: vncfb.c,v 1.4 2011/12/30 11:06:18 jmcneill Exp $ */
+/* $NetBSD: vncfb.c,v 1.5 2011/12/30 12:54:41 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -35,7 +35,7 @@
 #include opt_wsemul.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.4 2011/12/30 11:06:18 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.5 2011/12/30 12:54:41 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -112,6 +112,7 @@ static int	vncfb_kbd_ioctl(void *, u_lon
 
 static void	vncfb_kbd_cngetc(void *, u_int *, int *);
 static void	vncfb_kbd_cnpollc(void *, int);
+static void	vncfb_kbd_bell(void *, u_int, u_int, u_int);
 
 static struct vcons_screen vncfb_console_screen;
 
@@ -152,7 +153,7 @@ static struct wskbd_accessops vncfb_kbd_
 static const struct wskbd_consops vncfb_kbd_consops = {
 	vncfb_kbd_cngetc,
 	vncfb_kbd_cnpollc,
-	NULL, /* bell */
+	vncfb_kbd_bell,
 };
 
 static int
@@ -506,10 +507,16 @@ vncfb_kbd_set_leds(void *priv, int leds)
 static int
 vncfb_kbd_ioctl(void *priv, u_long cmd, void *data, int flag, lwp_t *l)
 {
+	struct wskbd_bell_data *bd;
+
 	switch (cmd) {
 	case WSKBDIO_GTYPE:
 		*(int *)data = WSKBD_TYPE_RFB;
 		return 0;
+	case WSKBDIO_COMPLEXBELL:
+		bd = data;
+		vncfb_kbd_bell(priv, bd-pitch, bd-period, bd-volume);
+		return 0;
 	default:
 		return EPASSTHROUGH;
 	}
@@ -524,3 +531,12 @@ static void
 vncfb_kbd_cnpollc(void *priv, int on)
 {
 }
+
+static void
+vncfb_kbd_bell(void *priv, u_int pitch, u_int period, u_int volume)
+{
+	struct vncfb_softc *sc = priv;
+
+	thunk_rfb_bell(sc-sc_rfb);
+	softint_schedule(sc-sc_sih);
+}

Index: src/sys/arch/usermode/include/thunk.h
diff -u src/sys/arch/usermode/include/thunk.h:1.50 src/sys/arch/usermode/include/thunk.h:1.51
--- src/sys/arch/usermode/include/thunk.h:1.50	Fri Dec 30 12:07:33 2011
+++ src/sys/arch/usermode/include/thunk.h	Fri Dec 30 12:54:41 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.50 2011/12/30 12:07:33 reinoud Exp $ */
+/* $NetBSD: thunk.h,v 1.51 2011/12/30 12:54:41 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -216,6 +216,7 @@ typedef struct {
 	char			name[64];
 	uint8_t			*framebuf;
 
+	bool			schedule_bell;
 	unsigned int		nupdates;
 	unsigned int		first_mergable;
 	thunk_rfb_update_t	update[THUNK_RFB_QUEUELEN];
@@ -223,6 +224,7 @@ typedef struct {
 
 int	thunk_rfb_open(thunk_rfb_t *, uint16_t);
 int	thunk_rfb_poll(thunk_rfb_t *, thunk_rfb_event_t *);
+void	thunk_rfb_bell(thunk_rfb_t *);
 void	thunk_rfb_update(thunk_rfb_t *, int, int, int, int);
 void	thunk_rfb_copyrect(thunk_rfb_t *, int, int, int, int, int, int);
 

Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.63 src/sys/arch/usermode/usermode/thunk.c:1.64
--- src/sys/arch/usermode/usermode/thunk.c:1.63	Fri Dec 30 12:13:31 2011
+++ src/sys/arch/usermode/usermode/thunk.c	Fri Dec 30 12:54:42 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.63 2011/12/30 12:13:31 jmcneill Exp $ */
+/* $NetBSD: thunk.c,v 1.64 2011/12/30 12:54:42 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 #ifdef __NetBSD__
-__RCSID($NetBSD: thunk.c,v 1.63 2011/12/30 12:13:31 jmcneill Exp $);
+__RCSID($NetBSD: thunk.c,v 1.64 2011/12/30 12:54:42 jmcneill Exp $);
 #endif
 
 #include sys/types.h
@@ -76,8 +76,6 @@ __RCSID($NetBSD: thunk.c,v 1.63 2011/12
 #define MAP_ANON MAP_ANONYMOUS
 #endif
 
-#define RFB_DEBUG
-
 extern int boothowto;
 
 void
@@ -1124,6 +1122,7 @@ thunk_rfb_poll(thunk_rfb_t *rfb, thunk_r
 			return -1;
 		}
 
+		rfb-schedule_bell = false;
 		rfb-nupdates = 0;
 		rfb-first_mergable = 0;
 		thunk_rfb_update(rfb, 0, 0, rfb-width, rfb-height);
@@ -1133,6 +1132,12 @@ thunk_rfb_poll(thunk_rfb_t *rfb, thunk_r
 	if (rfb-clientfd == -1)
 		return -1;
 
+	if (rfb-schedule_bell) {
+		uint8_t msg_type = 2;	/* bell */
+		safe_send(rfb-clientfd, msg_type, sizeof(msg_type));
+		rfb-schedule_bell = false;
+	}
+
 	error = ioctl(rfb-clientfd, FIONREAD, len);
 	if (error

CVS commit: src/sys/arch/usermode

2011-12-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Dec 30 14:20:34 UTC 2011

Modified Files:
src/sys/arch/usermode/dev: vncfb.c
src/sys/arch/usermode/include: thunk.h
src/sys/arch/usermode/usermode: thunk.c

Log Message:
add a barrier before copyrows(), and add an RRE based fillrect functino,
use it for eraserows and erasecols


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/usermode/dev/vncfb.c
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/usermode/usermode/thunk.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/usermode/dev/vncfb.c
diff -u src/sys/arch/usermode/dev/vncfb.c:1.6 src/sys/arch/usermode/dev/vncfb.c:1.7
--- src/sys/arch/usermode/dev/vncfb.c:1.6	Fri Dec 30 13:08:30 2011
+++ src/sys/arch/usermode/dev/vncfb.c	Fri Dec 30 14:20:33 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: vncfb.c,v 1.6 2011/12/30 13:08:30 reinoud Exp $ */
+/* $NetBSD: vncfb.c,v 1.7 2011/12/30 14:20:33 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -35,7 +35,7 @@
 #include opt_wsemul.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.6 2011/12/30 13:08:30 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.7 2011/12/30 14:20:33 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -103,7 +103,8 @@ static paddr_t	vncfb_mmap(void *, void *
 static void	vncfb_init_screen(void *, struct vcons_screen *, int, long *);
 
 static void	vncfb_update(struct vncfb_softc *, int, int, int, int);
-static void	vncfb_copyrect(struct vncfb_softc *sc, int, int, int, int, int, int);
+static void	vncfb_copyrect(struct vncfb_softc *, int, int, int, int, int, int);
+static void	vncfb_fillrect(struct vncfb_softc *, int, int, int, int, uint32_t);
 static int	vncfb_intr(void *);
 static void	vncfb_softintr(void *);
 
@@ -331,7 +332,7 @@ vncfb_erasecols(void *priv, int row, int
 	struct vcons_screen *scr = ri-ri_hw;
 	struct vncfb_softc *sc = scr-scr_cookie;
 	struct vncfb_fbops *ops = sc-sc_ops;
-	int x, y, w, h;
+	int x, y, w, h, c;
 
 	ops-erasecols(ri, row, startcol, ncols, fillattr);
 
@@ -339,8 +340,9 @@ vncfb_erasecols(void *priv, int row, int
 	h = ri-ri_font-fontheight;
 	x = ri-ri_xorigin + (startcol * ri-ri_font-fontwidth);
 	w = ncols * ri-ri_font-fontwidth;
+	c = ri-ri_devcmap[(fillattr  16)  0xf]  0xff;
 
-	vncfb_update(sc, x, y, w, h);
+	vncfb_fillrect(sc, x, y, w, h, c);
 }
 
 static void
@@ -353,6 +355,10 @@ vncfb_copyrows(void *priv, int srcrow, i
 	int x, y, w, h, srcx, srcy;
 	int fontheight;
 
+	/* barrier */
+	while (sc-sc_rfb.nupdates  0)
+		thunk_rfb_poll(sc-sc_rfb, NULL);
+
 	ops-copyrows(ri, srcrow, dstrow, nrows);
 
 	fontheight = ri-ri_font-fontheight;
@@ -374,7 +380,7 @@ vncfb_eraserows(void *priv, int row, int
 	struct vcons_screen *scr = ri-ri_hw;
 	struct vncfb_softc *sc = scr-scr_cookie;
 	struct vncfb_fbops *ops = sc-sc_ops;
-	int x, y, w, h;
+	int x, y, w, h, c;
 
 	ops-eraserows(ri, row, nrows, fillattr);
 
@@ -382,8 +388,9 @@ vncfb_eraserows(void *priv, int row, int
 	h = nrows * ri-ri_font-fontheight;
 	x = ri-ri_xorigin;
 	w = ri-ri_width;
+	c = ri-ri_devcmap[(fillattr  16)  0xf]  0xff;
 
-	vncfb_update(sc, x, y, w, h);
+	vncfb_fillrect(sc, x, y, w, h, c);
 }
 
 static void
@@ -465,6 +472,14 @@ vncfb_copyrect(struct vncfb_softc *sc, i
 	softint_schedule(sc-sc_sih);
 }
 
+static void
+vncfb_fillrect(struct vncfb_softc *sc, int x, int y, int w, int h, uint32_t c)
+{
+
+	thunk_rfb_fillrect(sc-sc_rfb, x, y, w, h, (uint8_t *)c);
+	softint_schedule(sc-sc_sih);
+}
+
 static int
 vncfb_intr(void *priv)
 {

Index: src/sys/arch/usermode/include/thunk.h
diff -u src/sys/arch/usermode/include/thunk.h:1.51 src/sys/arch/usermode/include/thunk.h:1.52
--- src/sys/arch/usermode/include/thunk.h:1.51	Fri Dec 30 12:54:41 2011
+++ src/sys/arch/usermode/include/thunk.h	Fri Dec 30 14:20:34 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.51 2011/12/30 12:54:41 jmcneill Exp $ */
+/* $NetBSD: thunk.h,v 1.52 2011/12/30 14:20:34 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -195,7 +195,7 @@ typedef struct {
 	uint8_t			enc;
 	uint16_t		x, y, w, h;
 	uint16_t		srcx, srcy;
-	uint32_t		colour;		/* for RRE clear */
+	uint8_t			pixel[4];
 } thunk_rfb_update_t;
 #define THUNK_RFB_TYPE_RAW	0
 #define THUNK_RFB_TYPE_COPYRECT	1
@@ -227,5 +227,6 @@ int	thunk_rfb_poll(thunk_rfb_t *, thunk_
 void	thunk_rfb_bell(thunk_rfb_t *);
 void	thunk_rfb_update(thunk_rfb_t *, int, int, int, int);
 void	thunk_rfb_copyrect(thunk_rfb_t *, int, int, int, int, int, int);
+void	thunk_rfb_fillrect(thunk_rfb_t *, int, int, int, int, uint8_t *);
 
 #endif /* !_ARCH_USERMODE_INCLUDE_THUNK_H */

Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.65 src/sys/arch/usermode/usermode/thunk.c:1.66
--- src/sys

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

2011-12-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Dec 30 14:22:41 UTC 2011

Modified Files:
src/sys/arch/usermode/dev: vncfb.c

Log Message:
no need to poll for pending drawing ops if no client is connected


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/usermode/dev/vncfb.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/usermode/dev/vncfb.c
diff -u src/sys/arch/usermode/dev/vncfb.c:1.7 src/sys/arch/usermode/dev/vncfb.c:1.8
--- src/sys/arch/usermode/dev/vncfb.c:1.7	Fri Dec 30 14:20:33 2011
+++ src/sys/arch/usermode/dev/vncfb.c	Fri Dec 30 14:22:41 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: vncfb.c,v 1.7 2011/12/30 14:20:33 jmcneill Exp $ */
+/* $NetBSD: vncfb.c,v 1.8 2011/12/30 14:22:41 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -35,7 +35,7 @@
 #include opt_wsemul.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.7 2011/12/30 14:20:33 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.8 2011/12/30 14:22:41 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -357,7 +357,8 @@ vncfb_copyrows(void *priv, int srcrow, i
 
 	/* barrier */
 	while (sc-sc_rfb.nupdates  0)
-		thunk_rfb_poll(sc-sc_rfb, NULL);
+		if (thunk_rfb_poll(sc-sc_rfb, NULL) == -1)
+			break;
 
 	ops-copyrows(ri, srcrow, dstrow, nrows);
 



CVS commit: src/sys/arch/usermode/usermode

2011-12-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Dec 30 19:30:59 UTC 2011

Modified Files:
src/sys/arch/usermode/usermode: pmap.c

Log Message:
provide pmap_phys_address


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/usermode/usermode/pmap.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/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.84 src/sys/arch/usermode/usermode/pmap.c:1.85
--- src/sys/arch/usermode/usermode/pmap.c:1.84	Fri Dec 30 06:59:54 2011
+++ src/sys/arch/usermode/usermode/pmap.c	Fri Dec 30 19:30:59 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.84 2011/12/30 06:59:54 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.85 2011/12/30 19:30:59 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.84 2011/12/30 06:59:54 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.85 2011/12/30 19:30:59 jmcneill Exp $);
 
 #include opt_memsize.h
 #include opt_kmempages.h
@@ -1219,7 +1219,6 @@ pmap_is_referenced(struct vm_page *page)
 paddr_t
 pmap_phys_address(paddr_t cookie)
 {
-	panic(pmap_phys_address not implemented\n);
 	return ptoa(cookie);
 }
 



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

2011-12-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Dec 30 19:32:32 UTC 2011

Modified Files:
src/sys/arch/usermode/dev: vncfb.c

Log Message:
add mmap support


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/usermode/dev/vncfb.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/usermode/dev/vncfb.c
diff -u src/sys/arch/usermode/dev/vncfb.c:1.8 src/sys/arch/usermode/dev/vncfb.c:1.9
--- src/sys/arch/usermode/dev/vncfb.c:1.8	Fri Dec 30 14:22:41 2011
+++ src/sys/arch/usermode/dev/vncfb.c	Fri Dec 30 19:32:32 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: vncfb.c,v 1.8 2011/12/30 14:22:41 jmcneill Exp $ */
+/* $NetBSD: vncfb.c,v 1.9 2011/12/30 19:32:32 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -35,7 +35,7 @@
 #include opt_wsemul.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.8 2011/12/30 14:22:41 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.9 2011/12/30 19:32:32 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -43,6 +43,8 @@ __KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.
 #include sys/device.h
 #include sys/kmem.h
 
+#include uvm/uvm_extern.h
+
 #include dev/wscons/wsconsio.h
 
 #include dev/wscons/wsdisplayvar.h
@@ -57,6 +59,8 @@ __KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.
 #include machine/mainbus.h
 #include machine/thunk.h
 
+#define VNCFB_REFRESH_INTERVAL	33	/* fb refresh interval when mapped */
+
 struct vncfb_fbops {
 	void	(*copycols)(void *, int, int, int, int);
 	void	(*erasecols)(void *, int, int, int, long);
@@ -74,7 +78,10 @@ struct vncfb_softc {
 	unsigned int		sc_height;
 	unsigned int		sc_depth;
 	int			sc_mode;
+	uint8_t *		sc_mem;
+	size_t			sc_memsize;
 	uint8_t *		sc_framebuf;
+	size_t			sc_framebufsize;
 	struct vcons_data	sc_vd;
 	struct vncfb_fbops	sc_ops;
 
@@ -82,6 +89,9 @@ struct vncfb_softc {
 
 	void			*sc_ih;
 	void			*sc_sih;
+
+	callout_t		sc_callout;
+	void			*sc_refresh_sih;
 };
 
 static int	vncfb_match(device_t, cfdata_t, void *);
@@ -107,6 +117,8 @@ static void	vncfb_copyrect(struct vncfb_
 static void	vncfb_fillrect(struct vncfb_softc *, int, int, int, int, uint32_t);
 static int	vncfb_intr(void *);
 static void	vncfb_softintr(void *);
+static void	vncfb_refresh(void *);
+static void	vncfb_softrefresh(void *);
 
 static int	vncfb_kbd_enable(void *, int);
 static void	vncfb_kbd_set_leds(void *, int);
@@ -187,13 +199,17 @@ vncfb_attach(device_t parent, device_t s
 		panic(couldn't open VNC socket);
 #endif
 
-	sc-sc_framebuf = kmem_zalloc(sc-sc_width * sc-sc_height *
-	(sc-sc_depth / 8), KM_SLEEP);
-	KASSERT(sc-sc_framebuf != NULL);
+	sc-sc_framebufsize = sc-sc_width * sc-sc_height * (sc-sc_depth / 8);
+	sc-sc_memsize = sc-sc_framebufsize + PAGE_SIZE;
+
+	sc-sc_mem = kmem_zalloc(sc-sc_memsize, KM_SLEEP);
+	sc-sc_framebuf = (void *)round_page((vaddr_t)sc-sc_mem);
 
 	aprint_naive(\n);
 	aprint_normal(: %ux%u %ubpp (port %u)\n,
 	sc-sc_width, sc-sc_height, sc-sc_depth, taa-u.vnc.port);
+	aprint_normal_dev(self, mem @ %p\n, sc-sc_mem);
+	aprint_normal_dev(self, fb  @ %p\n, sc-sc_framebuf);
 
 	sc-sc_rfb.width = sc-sc_width;
 	sc-sc_rfb.height = sc-sc_height;
@@ -210,6 +226,12 @@ vncfb_attach(device_t parent, device_t s
 	sc-sc_sih = softint_establish(SOFTINT_SERIAL, vncfb_softintr, sc);
 	sc-sc_ih = sigio_intr_establish(vncfb_intr, sc);
 
+	sc-sc_refresh_sih = softint_establish(SOFTINT_SERIAL,
+	vncfb_softrefresh, sc);
+
+	callout_init(sc-sc_callout, 0);
+	callout_setfunc(sc-sc_callout, vncfb_refresh, sc);
+
 	vcons_init(sc-sc_vd, sc, vncfb_defaultscreen, vncfb_accessops);
 	sc-sc_vd.init_screen = vncfb_init_screen;
 
@@ -438,12 +460,19 @@ vncfb_ioctl(void *v, void *vs, u_long cm
 		wdf-depth = ms-scr_ri.ri_depth;
 		wdf-cmsize = 256;
 		return 0;
+	case WSDISPLAYIO_LINEBYTES:
+		*(u_int *)data = sc-sc_width * (sc-sc_depth / 8);
+		return 0;
 	case WSDISPLAYIO_SMODE:
 		new_mode = *(int *)data;
 		if (sc-sc_mode != new_mode) {
 			sc-sc_mode = new_mode;
-			if (new_mode == WSDISPLAYIO_MODE_EMUL)
+			if (new_mode == WSDISPLAYIO_MODE_EMUL) {
+callout_halt(sc-sc_callout, NULL);
 vcons_redraw_screen(ms);
+			} else {
+callout_schedule(sc-sc_callout, 1);
+			}
 		}
 		return 0;
 	default:
@@ -454,8 +483,26 @@ vncfb_ioctl(void *v, void *vs, u_long cm
 static paddr_t
 vncfb_mmap(void *v, void *vs, off_t offset, int prot)
 {
-	/* TODO */
-	return -1;
+	struct vcons_data *vd = v;
+	struct vncfb_softc *sc = vd-cookie;
+	paddr_t pa;
+	vaddr_t va;
+
+	if (offset  0 || offset + PAGE_SIZE  sc-sc_framebufsize) {
+		device_printf(sc-sc_dev, mmap: offset 0x%x, fbsize 0x%x
+		 out of range!\n,
+		(unsigned int)offset, (unsigned int)sc-sc_framebufsize);
+		return -1;
+	}
+
+	va = trunc_page((vaddr_t)sc-sc_framebuf + offset);
+
+	if (pmap_extract(pmap_kernel(), va, pa) == false) {
+		device_printf(sc-sc_dev, mmap: pmap_extract failed!\n);
+		return -1

CVS commit: src/sys/arch/usermode

2011-12-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Dec 30 20:08:00 UTC 2011

Modified Files:
src/sys/arch/usermode/include: thunk.h
src/sys/arch/usermode/usermode: thunk.c

Log Message:
report rfb pointer events


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/usermode/usermode/thunk.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/usermode/include/thunk.h
diff -u src/sys/arch/usermode/include/thunk.h:1.52 src/sys/arch/usermode/include/thunk.h:1.53
--- src/sys/arch/usermode/include/thunk.h:1.52	Fri Dec 30 14:20:34 2011
+++ src/sys/arch/usermode/include/thunk.h	Fri Dec 30 20:08:00 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.52 2011/12/30 14:20:34 jmcneill Exp $ */
+/* $NetBSD: thunk.h,v 1.53 2011/12/30 20:08:00 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -187,6 +187,11 @@ typedef struct {
 			uint8_t		down_flag;
 			uint32_t	keysym;
 		} key_event;
+		struct {
+			uint8_t		button_mask;
+			uint16_t	absx;
+			uint16_t	absy;
+		} pointer_event;
 	} data;
 } thunk_rfb_event_t;
 

Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.66 src/sys/arch/usermode/usermode/thunk.c:1.67
--- src/sys/arch/usermode/usermode/thunk.c:1.66	Fri Dec 30 14:20:34 2011
+++ src/sys/arch/usermode/usermode/thunk.c	Fri Dec 30 20:08:00 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.66 2011/12/30 14:20:34 jmcneill Exp $ */
+/* $NetBSD: thunk.c,v 1.67 2011/12/30 20:08:00 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 #ifdef __NetBSD__
-__RCSID($NetBSD: thunk.c,v 1.66 2011/12/30 14:20:34 jmcneill Exp $);
+__RCSID($NetBSD: thunk.c,v 1.67 2011/12/30 20:08:00 jmcneill Exp $);
 #endif
 
 #include sys/types.h
@@ -1216,7 +1216,20 @@ thunk_rfb_poll(thunk_rfb_t *rfb, thunk_r
 		msg_len = 0;
 		break;
 	case THUNK_RFB_POINTER_EVENT:
-		msg_len = sizeof(pointer_event);
+		recv(rfb-clientfd, pointer_event, sizeof(pointer_event),
+		MSG_NOSIGNAL);
+		event-data.pointer_event.button_mask = pointer_event[0];
+		event-data.pointer_event.absx =
+		ntohs(*(uint16_t *)pointer_event[1]);
+		event-data.pointer_event.absy =
+		ntohs(*(uint16_t *)pointer_event[3]);
+#ifdef RFB_DEBUG
+		fprintf(stdout, rfb: pointer mask %02x abs %dx%d\n,
+		event-data.pointer_event.button_mask,
+		event-data.pointer_event.absx,
+		event-data.pointer_event.absy);
+#endif
+		msg_len = 0;
 		break;
 	case THUNK_RFB_CLIENT_CUT_TEXT:
 		recv(rfb-clientfd, client_cut_text, sizeof(client_cut_text),



CVS commit: src/sys/arch/usermode

2011-12-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Dec 30 20:08:36 UTC 2011

Modified Files:
src/sys/arch/usermode/conf: GENERIC.common files.usermode
src/sys/arch/usermode/dev: vncfb.c

Log Message:
add wsmouse support


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/usermode/conf/GENERIC.common
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/usermode/conf/files.usermode
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/usermode/dev/vncfb.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/usermode/conf/GENERIC.common
diff -u src/sys/arch/usermode/conf/GENERIC.common:1.8 src/sys/arch/usermode/conf/GENERIC.common:1.9
--- src/sys/arch/usermode/conf/GENERIC.common:1.8	Fri Dec 30 12:14:04 2011
+++ src/sys/arch/usermode/conf/GENERIC.common	Fri Dec 30 20:08:36 2011
@@ -1,9 +1,9 @@
-# $NetBSD: GENERIC.common,v 1.8 2011/12/30 12:14:04 jmcneill Exp $
+# $NetBSD: GENERIC.common,v 1.9 2011/12/30 20:08:36 jmcneill Exp $
 
 include arch/usermode/conf/std.usermode
 
 options 	INCLUDE_CONFIG_FILE
-#ident 		GENERIC-$Revision: 1.8 $
+#ident 		GENERIC-$Revision: 1.9 $
 maxusers 	32
 
 makeoptions	DEBUG=-O1 -g3
@@ -59,6 +59,7 @@ audio0		at vaudio0
 vncfb0		at thunkbus?
 wsdisplay0	at vncfb?
 wskbd0		at vncfb?
+wsmouse0	at vncfb? mux 0
 options 	WSEMUL_VT100
 options 	WS_KERNEL_FG=WSCOL_GREEN
 options 	WSKBD_DEFAULT_KEYREPEAT_DEL1=1000
@@ -70,6 +71,7 @@ pseudo-device	pty
 pseudo-device	bpfilter
 pseudo-device	drvctl
 pseudo-device	ksyms
+pseudo-device	wsmux
 
 # Pull in optional local configuration
 cinclude arch/usermode/conf/GENERIC.local

Index: src/sys/arch/usermode/conf/files.usermode
diff -u src/sys/arch/usermode/conf/files.usermode:1.15 src/sys/arch/usermode/conf/files.usermode:1.16
--- src/sys/arch/usermode/conf/files.usermode:1.15	Thu Dec 29 21:22:49 2011
+++ src/sys/arch/usermode/conf/files.usermode	Fri Dec 30 20:08:36 2011
@@ -1,4 +1,4 @@
-# $NetBSD: files.usermode,v 1.15 2011/12/29 21:22:49 jmcneill Exp $
+# $NetBSD: files.usermode,v 1.16 2011/12/30 20:08:36 jmcneill Exp $
 
 maxpartitions 8
 maxusers 8 16 64
@@ -37,7 +37,7 @@ file	arch/usermode/dev/vaudio.c		vaudio
 attach	ld at thunkbus with ld_thunkbus
 file	arch/usermode/dev/ld_thunkbus.c		ld_thunkbus
 
-device	vncfb { } : wsemuldisplaydev, rasops32, vcons, wskbddev
+device	vncfb { } : wsemuldisplaydev, rasops32, vcons, wskbddev, wsmousedev
 attach	vncfb at thunkbus
 file	arch/usermode/dev/vncfb.c		vncfb
 file	arch/usermode/dev/vnckbdmap.c		vncfb

Index: src/sys/arch/usermode/dev/vncfb.c
diff -u src/sys/arch/usermode/dev/vncfb.c:1.9 src/sys/arch/usermode/dev/vncfb.c:1.10
--- src/sys/arch/usermode/dev/vncfb.c:1.9	Fri Dec 30 19:32:32 2011
+++ src/sys/arch/usermode/dev/vncfb.c	Fri Dec 30 20:08:36 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: vncfb.c,v 1.9 2011/12/30 19:32:32 jmcneill Exp $ */
+/* $NetBSD: vncfb.c,v 1.10 2011/12/30 20:08:36 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -35,7 +35,7 @@
 #include opt_wsemul.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.9 2011/12/30 19:32:32 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.10 2011/12/30 20:08:36 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -56,6 +56,8 @@ __KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.
 #include dev/wscons/wsksymdef.h
 #include dev/wscons/wsksymvar.h
 
+#include dev/wscons/wsmousevar.h
+
 #include machine/mainbus.h
 #include machine/thunk.h
 
@@ -73,6 +75,7 @@ struct vncfb_fbops {
 struct vncfb_softc {
 	device_t		sc_dev;
 	device_t		sc_wskbddev;
+	device_t		sc_wsmousedev;
 	thunk_rfb_t		sc_rfb;
 	unsigned int		sc_width;
 	unsigned int		sc_height;
@@ -86,6 +89,7 @@ struct vncfb_softc {
 	struct vncfb_fbops	sc_ops;
 
 	int			sc_kbd_enable;
+	int			sc_mouse_enable;
 
 	void			*sc_ih;
 	void			*sc_sih;
@@ -128,6 +132,10 @@ static void	vncfb_kbd_cngetc(void *, u_i
 static void	vncfb_kbd_cnpollc(void *, int);
 static void	vncfb_kbd_bell(void *, u_int, u_int, u_int);
 
+static int	vncfb_mouse_enable(void *);
+static int	vncfb_mouse_ioctl(void *, u_long, void *, int, lwp_t *);
+static void	vncfb_mouse_disable(void *);
+
 static struct vcons_screen vncfb_console_screen;
 
 static struct wsscreen_descr vncfb_defaultscreen = {
@@ -170,6 +178,12 @@ static const struct wskbd_consops vncfb_
 	vncfb_kbd_bell,
 };
 
+static const struct wsmouse_accessops vncfb_mouse_accessops = {
+	vncfb_mouse_enable,
+	vncfb_mouse_ioctl,
+	vncfb_mouse_disable,
+};
+
 static int
 vncfb_match(device_t parent, cfdata_t match, void *priv)
 {
@@ -185,6 +199,7 @@ vncfb_attach(device_t parent, device_t s
 	struct thunkbus_attach_args *taa = priv;
 	struct wsemuldisplaydev_attach_args waa;
 	struct wskbddev_attach_args kaa;
+	struct wsmousedev_attach_args maa;
 	struct rasops_info *ri;
 	unsigned long defattr;
 
@@ -208,8 +223,6 @@ vncfb_attach(device_t parent, device_t s
 	aprint_naive(\n);
 	aprint_normal(: %ux%u

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

2012-01-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jan  2 00:20:30 UTC 2012

Modified Files:
src/sys/arch/usermode/dev: vncfb.c

Log Message:
fix range check for mmap


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/usermode/dev/vncfb.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/usermode/dev/vncfb.c
diff -u src/sys/arch/usermode/dev/vncfb.c:1.10 src/sys/arch/usermode/dev/vncfb.c:1.11
--- src/sys/arch/usermode/dev/vncfb.c:1.10	Fri Dec 30 20:08:36 2011
+++ src/sys/arch/usermode/dev/vncfb.c	Mon Jan  2 00:20:30 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: vncfb.c,v 1.10 2011/12/30 20:08:36 jmcneill Exp $ */
+/* $NetBSD: vncfb.c,v 1.11 2012/01/02 00:20:30 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -35,7 +35,7 @@
 #include opt_wsemul.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.10 2011/12/30 20:08:36 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.11 2012/01/02 00:20:30 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -507,7 +507,7 @@ vncfb_mmap(void *v, void *vs, off_t offs
 	paddr_t pa;
 	vaddr_t va;
 
-	if (offset  0 || offset + PAGE_SIZE  sc-sc_framebufsize) {
+	if (offset  0 || offset = sc-sc_framebufsize) {
 		device_printf(sc-sc_dev, mmap: offset 0x%x, fbsize 0x%x
 		 out of range!\n,
 		(unsigned int)offset, (unsigned int)sc-sc_framebufsize);



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

2012-01-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jan  4 14:04:12 UTC 2012

Modified Files:
src/sys/arch/usermode/conf: GENERIC.common

Log Message:
add options NTP  pseudo-device clockctl


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/usermode/conf/GENERIC.common

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/usermode/conf/GENERIC.common
diff -u src/sys/arch/usermode/conf/GENERIC.common:1.10 src/sys/arch/usermode/conf/GENERIC.common:1.11
--- src/sys/arch/usermode/conf/GENERIC.common:1.10	Mon Jan  2 21:48:14 2012
+++ src/sys/arch/usermode/conf/GENERIC.common	Wed Jan  4 14:04:12 2012
@@ -1,9 +1,9 @@
-# $NetBSD: GENERIC.common,v 1.10 2012/01/02 21:48:14 reinoud Exp $
+# $NetBSD: GENERIC.common,v 1.11 2012/01/04 14:04:12 jmcneill Exp $
 
 include arch/usermode/conf/std.usermode
 
 options 	INCLUDE_CONFIG_FILE
-#ident 		GENERIC-$Revision: 1.10 $
+#ident 		GENERIC-$Revision: 1.11 $
 maxusers 	32
 
 makeoptions	DEBUG=-O1 -g3
@@ -11,6 +11,7 @@ makeoptions	DEBUG=-O1 -g3
 options 	SYMTAB_SPACE=35
 
 options 	RTC_OFFSET=0
+options 	NTP
 options 	KTRACE
 #options 	USERCONF
 
@@ -72,6 +73,7 @@ options 	WSDISPLAY_COMPAT_USL
 pseudo-device	loop
 pseudo-device	pty
 pseudo-device	bpfilter
+pseudo-device	clockctl
 pseudo-device	drvctl
 pseudo-device	ksyms
 pseudo-device	wsmux



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

2012-01-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jan  4 14:53:58 UTC 2012

Modified Files:
src/sys/arch/usermode/dev: vncfb.c

Log Message:
implement cngetc and cnpollc


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/usermode/dev/vncfb.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/usermode/dev/vncfb.c
diff -u src/sys/arch/usermode/dev/vncfb.c:1.11 src/sys/arch/usermode/dev/vncfb.c:1.12
--- src/sys/arch/usermode/dev/vncfb.c:1.11	Mon Jan  2 00:20:30 2012
+++ src/sys/arch/usermode/dev/vncfb.c	Wed Jan  4 14:53:57 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: vncfb.c,v 1.11 2012/01/02 00:20:30 jmcneill Exp $ */
+/* $NetBSD: vncfb.c,v 1.12 2012/01/04 14:53:57 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -35,7 +35,7 @@
 #include opt_wsemul.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.11 2012/01/02 00:20:30 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.12 2012/01/04 14:53:57 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -651,11 +651,29 @@ vncfb_kbd_ioctl(void *priv, u_long cmd, 
 static void
 vncfb_kbd_cngetc(void *priv, u_int *type, int *data)
 {
+	struct vncfb_softc *sc = priv;
+	thunk_rfb_event_t event;
+
+	for (;;) {
+		if (thunk_rfb_poll(sc-sc_rfb, event)  0) {
+			if (event.message_type == THUNK_RFB_KEY_EVENT) {
+*type = event.data.key_event.down_flag ?
+WSCONS_EVENT_KEY_DOWN : WSCONS_EVENT_KEY_UP;
+*data = event.data.key_event.keysym  0xfff;
+return;
+			}
+		}
+	}
 }
 
 static void
 vncfb_kbd_cnpollc(void *priv, int on)
 {
+	struct vncfb_softc *sc = priv;
+
+	if (!on) {
+		vncfb_intr(sc);
+	}
 }
 
 static void



CVS commit: src/sys/arch/usermode

2012-01-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jan  5 12:12:58 UTC 2012

Modified Files:
src/sys/arch/usermode/conf: Makefile.usermode
src/sys/arch/usermode/include: thunk.h
src/sys/arch/usermode/usermode: pmap.c thunk.c

Log Message:
Get rid of MAP_NOSYSCALLS usage; now this relies on a separate kmod that
you can get here: http://www.netbsd.org/~jmcneill/syscallemu.tar


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/usermode/conf/Makefile.usermode
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/usermode/usermode/pmap.c
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/usermode/usermode/thunk.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/usermode/conf/Makefile.usermode
diff -u src/sys/arch/usermode/conf/Makefile.usermode:1.27 src/sys/arch/usermode/conf/Makefile.usermode:1.28
--- src/sys/arch/usermode/conf/Makefile.usermode:1.27	Sat Dec 31 21:24:07 2011
+++ src/sys/arch/usermode/conf/Makefile.usermode	Thu Jan  5 12:12:58 2012
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.usermode,v 1.27 2011/12/31 21:24:07 christos Exp $
+# $NetBSD: Makefile.usermode,v 1.28 2012/01/05 12:12:58 jmcneill Exp $
 
 OPT_CPU_HOST=			%CPU_HOST%
 .if !empty(OPT_CPU_HOST)
@@ -35,6 +35,7 @@ CPPFLAGS+=-D__NetBSD__ -Wno-unused-but-s
 
 DEFCOPTS=	-fno-omit-frame-pointer
 CPPFLAGS+=	-Dusermode
+CPPFLAGS+=	-Dsyscall=kernel_syscall
 CPPFLAGS.init_main.c+=	-Dmain=kernmain
 
 CPPFLAGS.thunk.c+=	${USERMODE_CPPFLAGS}

Index: src/sys/arch/usermode/include/thunk.h
diff -u src/sys/arch/usermode/include/thunk.h:1.55 src/sys/arch/usermode/include/thunk.h:1.56
--- src/sys/arch/usermode/include/thunk.h:1.55	Tue Jan  3 12:05:01 2012
+++ src/sys/arch/usermode/include/thunk.h	Thu Jan  5 12:12:58 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.55 2012/01/03 12:05:01 reinoud Exp $ */
+/* $NetBSD: thunk.h,v 1.56 2012/01/05 12:12:58 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -61,7 +61,6 @@ struct thunk_termios {
 #define THUNK_MAP_FILE		0x0004
 #define THUNK_MAP_SHARED	0x0010
 #define THUNK_MAP_PRIVATE	0x0020
-#define THUNK_MAP_NOSYSCALLS	0x0040
 
 #define THUNK_PROT_NONE		0x00
 #define THUNK_PROT_READ		0x01
@@ -73,6 +72,8 @@ struct aiocb;
 void	thunk_printf_debug(const char *fmt, ...) __attribute__((__format__(__printf__, 1, 2)));
 void	thunk_printf(const char *fmt, ...) __attribute__((__format__(__printf__, 1, 2)));
 
+int	thunk_syscallemu_init(void *, void *);
+
 int	thunk_setitimer(int, const struct thunk_itimerval *, struct thunk_itimerval *);
 int	thunk_gettimeofday(struct thunk_timeval *, void *);
 unsigned int thunk_getcounter(void);

Index: src/sys/arch/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.96 src/sys/arch/usermode/usermode/pmap.c:1.97
--- src/sys/arch/usermode/usermode/pmap.c:1.96	Wed Jan  4 16:20:41 2012
+++ src/sys/arch/usermode/usermode/pmap.c	Thu Jan  5 12:12:58 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.96 2012/01/04 16:20:41 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.97 2012/01/05 12:12:58 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.96 2012/01/04 16:20:41 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.97 2012/01/05 12:12:58 jmcneill Exp $);
 
 #include opt_memsize.h
 #include opt_kmempages.h
@@ -399,6 +399,11 @@ pmap_bootstrap(void)
 	atop(free_end), 
 	VM_FREELIST_DEFAULT);
 
+	/* setup syscall emulation */
+	if (thunk_syscallemu_init((void *)VM_MIN_ADDRESS,
+	(void *)VM_MAXUSER_ADDRESS) != 0)
+		panic(couldn't enable syscall emulation);
+
 	aprint_verbose(leaving pmap_bootstrap:\n);
 	aprint_verbose(\t%PRIu64 MB of physical pages left\n,
 		(uint64_t) (free_end - (free_start + fpos))/1024/1024);
@@ -735,8 +740,6 @@ pmap_page_activate(struct pv_entry *pv)
 	void *addr;
 
 	map_flags = THUNK_MAP_FILE | THUNK_MAP_FIXED | THUNK_MAP_SHARED;
-	if ((va = VM_MIN_ADDRESS)  (va  VM_MAXUSER_ADDRESS)) 
-		map_flags |= THUNK_MAP_NOSYSCALLS;
 
 	addr = thunk_mmap((void *) va, PAGE_SIZE, pv-pv_mmap_ppl,
 		map_flags, mem_fh, pa);

Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.73 src/sys/arch/usermode/usermode/thunk.c:1.74
--- src/sys/arch/usermode/usermode/thunk.c:1.73	Wed Jan  4 13:31:30 2012
+++ src/sys/arch/usermode/usermode/thunk.c	Thu Jan  5 12:12:58 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.73 2012/01/04 13:31:30 reinoud Exp $ */
+/* $NetBSD: thunk.c,v 1.74 2012/01/05 12:12:58 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 #ifdef __NetBSD__
-__RCSID($NetBSD: thunk.c,v 1.73 2012/01/04 13:31:30 reinoud Exp $);
+__RCSID($NetBSD: thunk.c,v 1.74 2012/01/05 12:12:58 jmcneill Exp

CVS commit: src/sys/arch/usermode/modules/syscallemu

2012-01-06 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jan  6 13:16:20 UTC 2012

Modified Files:
src/sys/arch/usermode/modules/syscallemu: Makefile
Added Files:
src/sys/arch/usermode/modules/syscallemu: syscallemu_x86.c
Removed Files:
src/sys/arch/usermode/modules/syscallemu: syscallemu_i386.c

Log Message:
i386 and x86_64 versions of this code are the same, rename to syscallemu_x86.c


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/modules/syscallemu/Makefile
cvs rdiff -u -r1.1 -r0 \
src/sys/arch/usermode/modules/syscallemu/syscallemu_i386.c
cvs rdiff -u -r0 -r1.1 \
src/sys/arch/usermode/modules/syscallemu/syscallemu_x86.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/usermode/modules/syscallemu/Makefile
diff -u src/sys/arch/usermode/modules/syscallemu/Makefile:1.1 src/sys/arch/usermode/modules/syscallemu/Makefile:1.2
--- src/sys/arch/usermode/modules/syscallemu/Makefile:1.1	Thu Jan  5 13:26:51 2012
+++ src/sys/arch/usermode/modules/syscallemu/Makefile	Fri Jan  6 13:16:20 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1 2012/01/05 13:26:51 jmcneill Exp $
+#	$NetBSD: Makefile,v 1.2 2012/01/06 13:16:20 jmcneill Exp $
 
 NETBSDSRCDIR?=	../../../../..
 
@@ -11,6 +11,10 @@ M?=	${S}/modules
 KMOD=	syscallemu
 
 SRCS=	syscallemu.c
-SRCS+=	syscallemu_${MACHINE_ARCH}.c
+.if ${MACHINE_ARCH} == i386 || ${MACHINE_ARCH} == x86_64
+SRCS+=	syscallemu_x86.c
+.else
+.error ${MACHINE_ARCH} not implemented
+.endif
 
 .include bsd.kmodule.mk

Added files:

Index: src/sys/arch/usermode/modules/syscallemu/syscallemu_x86.c
diff -u /dev/null src/sys/arch/usermode/modules/syscallemu/syscallemu_x86.c:1.1
--- /dev/null	Fri Jan  6 13:16:20 2012
+++ src/sys/arch/usermode/modules/syscallemu/syscallemu_x86.c	Fri Jan  6 13:16:20 2012
@@ -0,0 +1,107 @@
+/* $NetBSD: syscallemu_x86.c,v 1.1 2012/01/06 13:16:20 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
+ * Copyright (c) 2012 Jared D. McNeill jmcne...@invisible.ca
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__KERNEL_RCSID(0, $NetBSD: syscallemu_x86.c,v 1.1 2012/01/06 13:16:20 jmcneill Exp $);
+
+#include sys/param.h
+#include sys/proc.h
+#include sys/systm.h
+
+#include machine/userret.h
+
+#include syscallemu.h
+
+/*
+ * If syscallemu specific data is present for the process, verify that the
+ * caller is allowed to execute system calls. If not, deliver a SIGILL to
+ * the process. When syscallemu specific data is not present, simply defer
+ * to the original syscall handler.
+ */
+static void
+x86_syscall_emu(struct trapframe *frame)
+{
+	void (*md_syscall)(struct trapframe *) = NULL;
+	struct syscallemu_data *sce;
+	register_t rip_call;
+	struct proc *p;
+	ksiginfo_t ksi;
+	lwp_t *l;
+
+	l = curlwp;
+	p = l-l_proc;
+
+	rip_call = X86_TF_RIP(frame) - frame-tf_err;
+
+	/* Determine if we need to emulate the system call */
+	sce = syscallemu_getsce(p);
+	if (sce) {
+		if ((rip_call = sce-sce_user_start 
+		 rip_call  sce-sce_user_end) ||
+		(rip_call + frame-tf_err = sce-sce_user_start 
+		 rip_call + frame-tf_err  sce-sce_user_end)) {
+			md_syscall = NULL;
+		} else {
+			md_syscall = sce-sce_md_syscall;
+		}
+	} else {
+		md_syscall = p-p_md.md_syscall;
+	}
+
+	if (md_syscall == NULL) {
+		/* If emulating, deliver SIGILL to process */
+		X86_TF_RIP(frame) = rip_call;
+		KSI_INIT_TRAP(ksi);
+		ksi.ksi_signo = SIGILL;
+		ksi.ksi_code = ILL_ILLTRP;
+		ksi.ksi_addr = (void *)X86_TF_RIP(frame);
+		ksi.ksi_trap = 0;
+		trapsignal(l, ksi);
+		userret(l

CVS commit: src/sys/arch/usermode

2012-01-06 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jan  6 14:11:55 UTC 2012

Modified Files:
src/sys/arch/usermode/dev: ld_thunkbus.c
src/sys/arch/usermode/include: thunk.h
src/sys/arch/usermode/usermode: thunk.c

Log Message:
support disk images = 2GB


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/usermode/dev/ld_thunkbus.c
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/usermode/usermode/thunk.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/usermode/dev/ld_thunkbus.c
diff -u src/sys/arch/usermode/dev/ld_thunkbus.c:1.25 src/sys/arch/usermode/dev/ld_thunkbus.c:1.26
--- src/sys/arch/usermode/dev/ld_thunkbus.c:1.25	Tue Jan  3 12:05:01 2012
+++ src/sys/arch/usermode/dev/ld_thunkbus.c	Fri Jan  6 14:11:55 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ld_thunkbus.c,v 1.25 2012/01/03 12:05:01 reinoud Exp $ */
+/* $NetBSD: ld_thunkbus.c,v 1.26 2012/01/06 14:11:55 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.25 2012/01/03 12:05:01 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.26 2012/01/06 14:11:55 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -90,7 +90,8 @@ ld_thunkbus_attach(device_t parent, devi
 	struct ld_softc *ld = sc-sc_ld;
 	struct thunkbus_attach_args *taa = opaque;
 	const char *path = taa-u.diskimage.path;
-	ssize_t size, blksize;
+	ssize_t blksize;
+	off_t size;
 
 	ld-sc_dv = self;
 

Index: src/sys/arch/usermode/include/thunk.h
diff -u src/sys/arch/usermode/include/thunk.h:1.56 src/sys/arch/usermode/include/thunk.h:1.57
--- src/sys/arch/usermode/include/thunk.h:1.56	Thu Jan  5 12:12:58 2012
+++ src/sys/arch/usermode/include/thunk.h	Fri Jan  6 14:11:55 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.56 2012/01/05 12:12:58 jmcneill Exp $ */
+/* $NetBSD: thunk.h,v 1.57 2012/01/06 14:11:55 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -107,7 +107,7 @@ void	thunk_putchar(int);
 int	thunk_execv(const char *, char * const []);
 
 int	thunk_open(const char *, int, mode_t);
-int	thunk_fstat_getsize(int, ssize_t *, ssize_t *);
+int	thunk_fstat_getsize(int, off_t *, ssize_t *);
 ssize_t	thunk_pread(int, void *, size_t, off_t);
 ssize_t	thunk_pwrite(int, const void *, size_t, off_t);
 ssize_t	thunk_read(int, void *, size_t);

Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.74 src/sys/arch/usermode/usermode/thunk.c:1.75
--- src/sys/arch/usermode/usermode/thunk.c:1.74	Thu Jan  5 12:12:58 2012
+++ src/sys/arch/usermode/usermode/thunk.c	Fri Jan  6 14:11:55 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.74 2012/01/05 12:12:58 jmcneill Exp $ */
+/* $NetBSD: thunk.c,v 1.75 2012/01/06 14:11:55 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 #ifdef __NetBSD__
-__RCSID($NetBSD: thunk.c,v 1.74 2012/01/05 12:12:58 jmcneill Exp $);
+__RCSID($NetBSD: thunk.c,v 1.75 2012/01/06 14:11:55 jmcneill Exp $);
 #endif
 
 #include sys/types.h
@@ -461,7 +461,7 @@ thunk_open(const char *path, int flags, 
 }
 
 int
-thunk_fstat_getsize(int fd, ssize_t *size, ssize_t *blksize)
+thunk_fstat_getsize(int fd, off_t *size, ssize_t *blksize)
 {
 	struct stat st;
 	int error;



CVS commit: src/sys/dev/pckbport

2012-01-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan  7 10:27:59 UTC 2012

Modified Files:
src/sys/dev/pckbport: elantech.c elantechvar.h

Log Message:
add support for elantech (v2) touchpads that report input pressure


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pckbport/elantech.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pckbport/elantechvar.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/dev/pckbport/elantech.c
diff -u src/sys/dev/pckbport/elantech.c:1.4 src/sys/dev/pckbport/elantech.c:1.5
--- src/sys/dev/pckbport/elantech.c:1.4	Fri Sep  9 14:29:47 2011
+++ src/sys/dev/pckbport/elantech.c	Sat Jan  7 10:27:58 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: elantech.c,v 1.4 2011/09/09 14:29:47 jakllsch Exp $ */
+/* $NetBSD: elantech.c,v 1.5 2012/01/07 10:27:58 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2008 Jared D. McNeill jmcne...@invisible.ca
@@ -29,7 +29,7 @@
 #include opt_pms.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: elantech.c,v 1.4 2011/09/09 14:29:47 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: elantech.c,v 1.5 2012/01/07 10:27:58 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -220,11 +220,20 @@ pms_elantech_input(void *opaque, int dat
 	if (!psc-sc_enabled)
 		return;
 
-	if ((psc-inputstate == 0  (data  0x0c) != 0x0c) ||
-	(psc-inputstate == 3  (data  0x0f) != 0x08)) {
-		aprint_debug_dev(psc-sc_dev, waiting for sync..\n);
-		psc-inputstate = 0;
-		return;
+	if (sc-version = 0x020800) {
+		if ((psc-inputstate == 0  (data  0x0c) != 0x04) ||
+		(psc-inputstate == 3  (data  0x0f) != 0x02)) {
+			aprint_debug_dev(psc-sc_dev, waiting for sync..\n);
+			psc-inputstate = 0;
+			return;
+		}
+	} else {
+		if ((psc-inputstate == 0  (data  0x0c) != 0x0c) ||
+		(psc-inputstate == 3  (data  0x0e) != 0x08)) {
+			aprint_debug_dev(psc-sc_dev, waiting for sync..\n);
+			psc-inputstate = 0;
+			return;
+		}
 	}
 
 	psc-packet[psc-inputstate++] = data  0xff;
@@ -245,8 +254,8 @@ pms_elantech_input(void *opaque, int dat
 	case 0:
 		/* FALLTHROUGH */
 	case 1:
-		ep.ep_x = ((int16_t)psc-packet[1]  8) | psc-packet[2];
-		ep.ep_y = ((int16_t)psc-packet[4]  8) | psc-packet[5];
+		ep.ep_x = ((int16_t)(psc-packet[1]  0xf)  8) | psc-packet[2];
+		ep.ep_y = ((int16_t)(psc-packet[4]  0xf)  8) | psc-packet[5];
 
 		aprint_debug_dev(psc-sc_dev,
 		%d finger detected in elantech mode:\n, ep.ep_nfingers);
@@ -365,9 +374,9 @@ pms_elantech_probe_init(void *opaque)
 		resp[0], resp[2], resp[0], resp[1], resp[2]);
 		goto doreset;
 	}
-	sc-version = fwversion;
-	aprint_normal_dev(psc-sc_dev, Elantech touchpad version %d.%d\n,
-	resp[0], resp[2]);
+	sc-version = (resp[0]  16) | (resp[1]  8) | resp[2];
+	aprint_normal_dev(psc-sc_dev, Elantech touchpad version %d.%d (%06x)\n,
+	resp[0], resp[2], sc-version);
 
 	res = pms_elantech_init(psc);
 	if (res) {

Index: src/sys/dev/pckbport/elantechvar.h
diff -u src/sys/dev/pckbport/elantechvar.h:1.1 src/sys/dev/pckbport/elantechvar.h:1.2
--- src/sys/dev/pckbport/elantechvar.h:1.1	Sun Dec 14 00:42:33 2008
+++ src/sys/dev/pckbport/elantechvar.h	Sat Jan  7 10:27:58 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: elantechvar.h,v 1.1 2008/12/14 00:42:33 jmcneill Exp $ */
+/* $NetBSD: elantechvar.h,v 1.2 2012/01/07 10:27:58 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2008 Jared D. McNeill jmcne...@invisible.ca
@@ -30,7 +30,7 @@
 #define _DEV_PCKBCPORT_ELANTECHVAR_H
 
 struct elantech_softc {
-	uint16_t	version;
+	uint32_t	version;
 
 	bool		initializing;
 	int16_t		last_x, last_y, last_z;



CVS commit: src/sys/arch/usermode/usermode

2012-01-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan  7 18:07:57 UTC 2012

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

Log Message:
increase the max # of sigio handlers


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/usermode/usermode/intr.c

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

Modified files:

Index: src/sys/arch/usermode/usermode/intr.c
diff -u src/sys/arch/usermode/usermode/intr.c:1.12 src/sys/arch/usermode/usermode/intr.c:1.13
--- src/sys/arch/usermode/usermode/intr.c:1.12	Fri Dec 30 11:04:50 2011
+++ src/sys/arch/usermode/usermode/intr.c	Sat Jan  7 18:07:57 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.c,v 1.12 2011/12/30 11:04:50 jmcneill Exp $ */
+/* $NetBSD: intr.c,v 1.13 2012/01/07 18:07:57 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.12 2011/12/30 11:04:50 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.13 2012/01/07 18:07:57 jmcneill Exp $);
 
 #include sys/types.h
 
@@ -39,7 +39,7 @@ struct intr_handler {
 	void *arg;
 };
 
-#define SIGIO_MAX_HANDLERS	4
+#define SIGIO_MAX_HANDLERS	8
 
 static struct intr_handler sigio_intr_handler[SIGIO_MAX_HANDLERS];
 



CVS commit: src/sys/arch/usermode

2012-01-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan  7 18:10:18 UTC 2012

Modified Files:
src/sys/arch/usermode/conf: GENERIC.common
src/sys/arch/usermode/dev: mainbus.c
src/sys/arch/usermode/usermode: machdep.c

Log Message:
support multiple disk images (pass multiple disk=path parameters on the
command-line). while changing command-line params, rename tap= option to
net=


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/usermode/conf/GENERIC.common
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/usermode/dev/mainbus.c
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/usermode/usermode/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/usermode/conf/GENERIC.common
diff -u src/sys/arch/usermode/conf/GENERIC.common:1.11 src/sys/arch/usermode/conf/GENERIC.common:1.12
--- src/sys/arch/usermode/conf/GENERIC.common:1.11	Wed Jan  4 14:04:12 2012
+++ src/sys/arch/usermode/conf/GENERIC.common	Sat Jan  7 18:10:18 2012
@@ -1,9 +1,9 @@
-# $NetBSD: GENERIC.common,v 1.11 2012/01/04 14:04:12 jmcneill Exp $
+# $NetBSD: GENERIC.common,v 1.12 2012/01/07 18:10:18 jmcneill Exp $
 
 include arch/usermode/conf/std.usermode
 
 options 	INCLUDE_CONFIG_FILE
-#ident 		GENERIC-$Revision: 1.11 $
+#ident 		GENERIC-$Revision: 1.12 $
 maxusers 	32
 
 makeoptions	DEBUG=-O1 -g3
@@ -55,7 +55,7 @@ mainbus0	at root
 cpu0		at mainbus?
 clock0		at mainbus?
 ttycons0	at mainbus?
-ld0		at mainbus?
+ld*		at mainbus?
 veth0		at mainbus?
 vaudio0		at mainbus?
 audio0		at vaudio0

Index: src/sys/arch/usermode/dev/mainbus.c
diff -u src/sys/arch/usermode/dev/mainbus.c:1.8 src/sys/arch/usermode/dev/mainbus.c:1.9
--- src/sys/arch/usermode/dev/mainbus.c:1.8	Thu Dec 29 21:22:49 2011
+++ src/sys/arch/usermode/dev/mainbus.c	Sat Jan  7 18:10:18 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.8 2011/12/29 21:22:49 jmcneill Exp $ */
+/* $NetBSD: mainbus.c,v 1.9 2012/01/07 18:10:18 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.8 2011/12/29 21:22:49 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.9 2012/01/07 18:10:18 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -50,7 +50,8 @@ typedef struct mainbus_softc {
 CFATTACH_DECL_NEW(mainbus, sizeof(mainbus_softc_t),
 mainbus_match, mainbus_attach, NULL, NULL);
 
-extern char *usermode_root_image_path;
+extern char *usermode_disk_image_path[];
+extern int usermode_disk_image_path_count;
 extern char *usermode_tap_device;
 extern char *usermode_tap_eaddr;
 extern char *usermode_audio_device;
@@ -68,6 +69,7 @@ mainbus_attach(device_t parent, device_t
 {
 	mainbus_softc_t *sc = device_private(self);
 	struct thunkbus_attach_args taa;
+	int i;
 
 	aprint_naive(\n);
 	aprint_normal(\n);
@@ -104,9 +106,9 @@ mainbus_attach(device_t parent, device_t
 		config_found_ia(self, thunkbus, taa, mainbus_print);
 	}
 
-	if (usermode_root_image_path) {
+	for (i = 0; i  usermode_disk_image_path_count; i++) {
 		taa.taa_type = THUNKBUS_TYPE_DISKIMAGE;
-		taa.u.diskimage.path = usermode_root_image_path;
+		taa.u.diskimage.path = usermode_disk_image_path[i];
 		config_found_ia(self, thunkbus, taa, mainbus_print);
 	}
 }

Index: src/sys/arch/usermode/usermode/machdep.c
diff -u src/sys/arch/usermode/usermode/machdep.c:1.49 src/sys/arch/usermode/usermode/machdep.c:1.50
--- src/sys/arch/usermode/usermode/machdep.c:1.49	Fri Jan  6 20:44:57 2012
+++ src/sys/arch/usermode/usermode/machdep.c	Sat Jan  7 18:10:18 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.49 2012/01/06 20:44:57 reinoud Exp $ */
+/* $NetBSD: machdep.c,v 1.50 2012/01/07 18:10:18 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -37,7 +37,7 @@
 #include opt_memsize.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.49 2012/01/06 20:44:57 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.50 2012/01/07 18:10:18 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/systm.h
@@ -58,6 +58,10 @@ __KERNEL_RCSID(0, $NetBSD: machdep.c,v 
 #include machine/machdep.h
 #include machine/thunk.h
 
+#ifndef MAX_DISK_IMAGES
+#define MAX_DISK_IMAGES	4
+#endif
+
 char machine[_SYS_NMLN] = ;
 char machine_arch[_SYS_NMLN] = ;
 char module_machine_usermode[_SYS_NMLN] = ;
@@ -65,7 +69,10 @@ char module_machine_usermode[_SYS_NMLN] 
 struct vm_map *phys_map = NULL;
 
 static char **saved_argv;
-char *usermode_root_image_path = NULL;
+
+char *usermode_disk_image_path[MAX_DISK_IMAGES];
+int usermode_disk_image_path_count = 0;
+
 static char usermode_tap_devicebuf[PATH_MAX] = ;
 char *usermode_tap_device = NULL;
 char *usermode_tap_eaddr = NULL;
@@ -82,16 +89,16 @@ static void
 usage(const char *pn)
 {
 	printf(usage: %s [-acdqsvxz]
-	 [tap=dev,eaddr]
-	 [audio=dev]
-	 [vnc=widthxheight,port]
-	 [fsimg]\n

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

2012-01-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jan  8 18:05:03 UTC 2012

Modified Files:
src/sys/arch/usermode/include: genheaders.sh

Log Message:
disklabel.h: handle __HAVE_OLD_DISKLABEL. while here, I noticed someone changed 
param.h without updating genheaders.h, so catch up.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/usermode/include/genheaders.sh

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/usermode/include/genheaders.sh
diff -u src/sys/arch/usermode/include/genheaders.sh:1.2 src/sys/arch/usermode/include/genheaders.sh:1.3
--- src/sys/arch/usermode/include/genheaders.sh:1.2	Thu Sep  8 10:49:41 2011
+++ src/sys/arch/usermode/include/genheaders.sh	Sun Jan  8 18:05:02 2012
@@ -45,15 +45,20 @@ EOF
 
 	# header specific quirks
 	if [ $hdr = disklabel.h ]; then
+		echo #include machine/types.h  ${hdr}
+		echo #ifndef __HAVE_OLD_DISKLABEL  ${hdr}
 		echo #undef DISKUNIT  ${hdr}
 		echo #undef DISKPART  ${hdr}
 		echo #undef DISKMINOR  ${hdr}
+		echo #endif  ${hdr}
 	elif [ $hdr = ptrace.h ]; then
 		echo #undef __HAVE_PTRACE_MACHDEP  ${hdr}
 		echo #undef __HAVE_PROCFS_MACHDEP  ${hdr}
 	elif [ $hdr = param.h ]; then
+		echo #undef UPAGES  ${hdr}
+		echo #define UPAGES 6  ${hdr}
 		echo #undef USPACE  ${hdr}
-		echo #define USPACE (PAGE_SIZE*4)  ${hdr}
+		echo #define USPACE (PAGE_SIZE*UPAGES)  ${hdr}
 	fi
 
 	echo ${hdr}



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

2012-01-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jan  8 18:05:43 UTC 2012

Modified Files:
src/sys/arch/usermode/include: asm.h bswap.h byte_swap.h disklabel.h
elf_machdep.h endian.h endian_machdep.h int_const.h int_fmtio.h
int_limits.h int_mwgwtypes.h int_types.h limits.h
netbsd32_machdep.h param.h ptrace.h wchar_limits.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/usermode/include/asm.h \
src/sys/arch/usermode/include/bswap.h \
src/sys/arch/usermode/include/byte_swap.h \
src/sys/arch/usermode/include/elf_machdep.h \
src/sys/arch/usermode/include/endian.h \
src/sys/arch/usermode/include/endian_machdep.h \
src/sys/arch/usermode/include/int_const.h \
src/sys/arch/usermode/include/int_fmtio.h \
src/sys/arch/usermode/include/int_limits.h \
src/sys/arch/usermode/include/int_mwgwtypes.h \
src/sys/arch/usermode/include/int_types.h \
src/sys/arch/usermode/include/limits.h \
src/sys/arch/usermode/include/netbsd32_machdep.h \
src/sys/arch/usermode/include/wchar_limits.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/usermode/include/disklabel.h \
src/sys/arch/usermode/include/ptrace.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/usermode/include/param.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/usermode/include/asm.h
diff -u src/sys/arch/usermode/include/asm.h:1.4 src/sys/arch/usermode/include/asm.h:1.5
--- src/sys/arch/usermode/include/asm.h:1.4	Thu Sep  8 10:49:56 2011
+++ src/sys/arch/usermode/include/asm.h	Sun Jan  8 18:05:43 2012
@@ -1,7 +1,7 @@
-/* $NetBSD: asm.h,v 1.4 2011/09/08 10:49:56 jmcneill Exp $ */
+/* $NetBSD: asm.h,v 1.5 2012/01/08 18:05:43 jmcneill Exp $ */
 
 /*
- * Automatically generated by genheaders.sh on Thu Sep  8 06:50:17 EDT 2011
+ * Automatically generated by genheaders.sh on Sat Jan  7 19:13:27 EST 2012
  * Do not modify directly!
  */
 #ifndef _USERMODE_ASM_H
Index: src/sys/arch/usermode/include/bswap.h
diff -u src/sys/arch/usermode/include/bswap.h:1.4 src/sys/arch/usermode/include/bswap.h:1.5
--- src/sys/arch/usermode/include/bswap.h:1.4	Thu Sep  8 10:49:56 2011
+++ src/sys/arch/usermode/include/bswap.h	Sun Jan  8 18:05:43 2012
@@ -1,7 +1,7 @@
-/* $NetBSD: bswap.h,v 1.4 2011/09/08 10:49:56 jmcneill Exp $ */
+/* $NetBSD: bswap.h,v 1.5 2012/01/08 18:05:43 jmcneill Exp $ */
 
 /*
- * Automatically generated by genheaders.sh on Thu Sep  8 06:50:17 EDT 2011
+ * Automatically generated by genheaders.sh on Sat Jan  7 19:13:27 EST 2012
  * Do not modify directly!
  */
 #ifndef _USERMODE_BSWAP_H
Index: src/sys/arch/usermode/include/byte_swap.h
diff -u src/sys/arch/usermode/include/byte_swap.h:1.4 src/sys/arch/usermode/include/byte_swap.h:1.5
--- src/sys/arch/usermode/include/byte_swap.h:1.4	Thu Sep  8 10:49:56 2011
+++ src/sys/arch/usermode/include/byte_swap.h	Sun Jan  8 18:05:43 2012
@@ -1,7 +1,7 @@
-/* $NetBSD: byte_swap.h,v 1.4 2011/09/08 10:49:56 jmcneill Exp $ */
+/* $NetBSD: byte_swap.h,v 1.5 2012/01/08 18:05:43 jmcneill Exp $ */
 
 /*
- * Automatically generated by genheaders.sh on Thu Sep  8 06:50:17 EDT 2011
+ * Automatically generated by genheaders.sh on Sat Jan  7 19:13:27 EST 2012
  * Do not modify directly!
  */
 #ifndef _USERMODE_BYTE_SWAP_H
Index: src/sys/arch/usermode/include/elf_machdep.h
diff -u src/sys/arch/usermode/include/elf_machdep.h:1.4 src/sys/arch/usermode/include/elf_machdep.h:1.5
--- src/sys/arch/usermode/include/elf_machdep.h:1.4	Thu Sep  8 10:49:56 2011
+++ src/sys/arch/usermode/include/elf_machdep.h	Sun Jan  8 18:05:43 2012
@@ -1,7 +1,7 @@
-/* $NetBSD: elf_machdep.h,v 1.4 2011/09/08 10:49:56 jmcneill Exp $ */
+/* $NetBSD: elf_machdep.h,v 1.5 2012/01/08 18:05:43 jmcneill Exp $ */
 
 /*
- * Automatically generated by genheaders.sh on Thu Sep  8 06:50:17 EDT 2011
+ * Automatically generated by genheaders.sh on Sat Jan  7 19:13:27 EST 2012
  * Do not modify directly!
  */
 #ifndef _USERMODE_ELF_MACHDEP_H
Index: src/sys/arch/usermode/include/endian.h
diff -u src/sys/arch/usermode/include/endian.h:1.4 src/sys/arch/usermode/include/endian.h:1.5
--- src/sys/arch/usermode/include/endian.h:1.4	Thu Sep  8 10:49:56 2011
+++ src/sys/arch/usermode/include/endian.h	Sun Jan  8 18:05:43 2012
@@ -1,7 +1,7 @@
-/* $NetBSD: endian.h,v 1.4 2011/09/08 10:49:56 jmcneill Exp $ */
+/* $NetBSD: endian.h,v 1.5 2012/01/08 18:05:43 jmcneill Exp $ */
 
 /*
- * Automatically generated by genheaders.sh on Thu Sep  8 06:50:17 EDT 2011
+ * Automatically generated by genheaders.sh on Sat Jan  7 19:13:27 EST 2012
  * Do not modify directly!
  */
 #ifndef _USERMODE_ENDIAN_H
Index: src/sys/arch/usermode/include/endian_machdep.h
diff -u src/sys/arch/usermode/include/endian_machdep.h:1.4 src/sys/arch/usermode/include/endian_machdep.h:1.5
--- src/sys/arch/usermode/include/endian_machdep.h:1.4	Thu Sep  8 10:49:56 2011
+++ 

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

2012-01-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jan  8 18:06:00 UTC 2012

Modified Files:
src/sys/arch/usermode/include: types.h

Log Message:
define __HAVE_OLD_DISKLABEL on i386


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/usermode/include/types.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/usermode/include/types.h
diff -u src/sys/arch/usermode/include/types.h:1.6 src/sys/arch/usermode/include/types.h:1.7
--- src/sys/arch/usermode/include/types.h:1.6	Fri Dec 11 05:52:04 2009
+++ src/sys/arch/usermode/include/types.h	Sun Jan  8 18:06:00 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: types.h,v 1.6 2009/12/11 05:52:04 matt Exp $ */
+/* $NetBSD: types.h,v 1.7 2012/01/08 18:06:00 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -58,4 +58,8 @@ typedef volatile unsigned char	__cpu_sim
 #define __SIMPLELOCK_LOCKED	1
 #define __SIMPLELOCK_UNLOCKED	0
 
+#if defined(__i386__)
+#define __HAVE_OLD_DISKLABEL
+#endif
+
 #endif /* !_ARCH_USERMODE_INCLUDE_TYPES_H */



CVS commit: src/sys/dev/usb

2012-01-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jan  9 10:57:35 UTC 2012

Modified Files:
src/sys/dev/usb: auvitek.c auvitek_dtv.c

Log Message:
make sure kernel lock is held when calling into usb stack


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/usb/auvitek.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/usb/auvitek_dtv.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/dev/usb/auvitek.c
diff -u src/sys/dev/usb/auvitek.c:1.7 src/sys/dev/usb/auvitek.c:1.8
--- src/sys/dev/usb/auvitek.c:1.7	Sun Oct  2 19:15:39 2011
+++ src/sys/dev/usb/auvitek.c	Mon Jan  9 10:57:34 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: auvitek.c,v 1.7 2011/10/02 19:15:39 jmcneill Exp $ */
+/* $NetBSD: auvitek.c,v 1.8 2012/01/09 10:57:34 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill jmcne...@invisible.ca
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: auvitek.c,v 1.7 2011/10/02 19:15:39 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: auvitek.c,v 1.8 2012/01/09 10:57:34 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -359,8 +359,11 @@ auvitek_read_1(struct auvitek_softc *sc,
 	USETW(req.wIndex, reg);
 	USETW(req.wLength, sizeof(data));
 
+	KERNEL_LOCK(1, curlwp);
 	err = usbd_do_request_flags(sc-sc_udev, req, data, 0,
 	actlen, USBD_DEFAULT_TIMEOUT);
+	KERNEL_UNLOCK_ONE(curlwp);
+
 	if (err)
 		printf(%s: read failed: %s\n, device_xname(sc-sc_dev),
 		usbd_errstr(err));
@@ -381,8 +384,11 @@ auvitek_write_1(struct auvitek_softc *sc
 	USETW(req.wIndex, reg);
 	USETW(req.wLength, 0);
 
+	KERNEL_LOCK(1, curlwp);
 	err = usbd_do_request_flags(sc-sc_udev, req, NULL, 0,
 	actlen, USBD_DEFAULT_TIMEOUT);
+	KERNEL_UNLOCK_ONE(curlwp);
+
 	if (err)
 		printf(%s: write failed: %s\n, device_xname(sc-sc_dev),
 		usbd_errstr(err));

Index: src/sys/dev/usb/auvitek_dtv.c
diff -u src/sys/dev/usb/auvitek_dtv.c:1.4 src/sys/dev/usb/auvitek_dtv.c:1.5
--- src/sys/dev/usb/auvitek_dtv.c:1.4	Sun Oct  2 19:15:40 2011
+++ src/sys/dev/usb/auvitek_dtv.c	Mon Jan  9 10:57:34 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: auvitek_dtv.c,v 1.4 2011/10/02 19:15:40 jmcneill Exp $ */
+/* $NetBSD: auvitek_dtv.c,v 1.5 2012/01/09 10:57:34 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: auvitek_dtv.c,v 1.4 2011/10/02 19:15:40 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: auvitek_dtv.c,v 1.5 2012/01/09 10:57:34 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -257,8 +257,11 @@ auvitek_dtv_init_pipes(struct auvitek_so
 {
 	usbd_status err;
 
+	KERNEL_LOCK(1, curlwp);
 	err = usbd_open_pipe(sc-sc_bulk_iface, sc-sc_ab.ab_endpt,
 	USBD_EXCLUSIVE_USE, sc-sc_ab.ab_pipe);
+	KERNEL_UNLOCK_ONE(curlwp);
+
 	if (err) {
 		aprint_error_dev(sc-sc_dev, couldn't open bulk-in pipe: %s\n,
 		usbd_errstr(err));
@@ -272,8 +275,10 @@ static int
 auvitek_dtv_close_pipes(struct auvitek_softc *sc)
 {
 	if (sc-sc_ab.ab_pipe != NULL) {
+		KERNEL_LOCK(1, curlwp);
 		usbd_abort_pipe(sc-sc_ab.ab_pipe);
 		usbd_close_pipe(sc-sc_ab.ab_pipe);
+		KERNEL_UNLOCK_ONE(curlwp);
 		sc-sc_ab.ab_pipe = NULL;
 	}
 
@@ -348,7 +353,11 @@ auvitek_dtv_bulk_start1(struct auvitek_b
 	//USBD_SHORT_XFER_OK|USBD_NO_COPY, USBD_NO_TIMEOUT,
 	USBD_NO_COPY, 100,
 	auvitek_dtv_bulk_cb);
+
+	KERNEL_LOCK(1, curlwp);
 	err = usbd_transfer(bx-bx_xfer);
+	KERNEL_UNLOCK_ONE(curlwp);
+
 	if (err != USBD_IN_PROGRESS) {
 		aprint_error_dev(sc-sc_dev, USB error: %s\n,
 		usbd_errstr(err));



CVS commit: src/sys/dev/usb

2012-01-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jan  9 11:02:19 UTC 2012

Modified Files:
src/sys/dev/usb: emdtv.c emdtv_dtv.c

Log Message:
make sure kernel lock is held when calling into usb stack


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/usb/emdtv.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/usb/emdtv_dtv.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/dev/usb/emdtv.c
diff -u src/sys/dev/usb/emdtv.c:1.6 src/sys/dev/usb/emdtv.c:1.7
--- src/sys/dev/usb/emdtv.c:1.6	Fri Dec 23 00:51:43 2011
+++ src/sys/dev/usb/emdtv.c	Mon Jan  9 11:02:18 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: emdtv.c,v 1.6 2011/12/23 00:51:43 jakllsch Exp $ */
+/* $NetBSD: emdtv.c,v 1.7 2012/01/09 11:02:18 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2008, 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: emdtv.c,v 1.6 2011/12/23 00:51:43 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: emdtv.c,v 1.7 2012/01/09 11:02:18 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -319,7 +319,10 @@ emdtv_read_multi_1(struct emdtv_softc *s
 	USETW(request.wIndex, index);
 	USETW(request.wLength, count);
 
+	KERNEL_LOCK(1, curlwp);
 	status = usbd_do_request(sc-sc_udev, request, datap);
+	KERNEL_UNLOCK_ONE(curlwp);
+
 	if (status != USBD_NORMAL_COMPLETION)
 		aprint_error_dev(sc-sc_dev, couldn't read %x/%x: %s\n,
 		req, index, usbd_errstr(status));
@@ -347,7 +350,10 @@ emdtv_write_multi_1(struct emdtv_softc *
 	USETW(request.wIndex, index);
 	USETW(request.wLength, count);
 
+	KERNEL_LOCK(1, curlwp);
 	status = usbd_do_request(sc-sc_udev, request, __UNCONST(datap));
+	KERNEL_UNLOCK_ONE(curlwp);
+
 	if (status != USBD_NORMAL_COMPLETION)
 		aprint_error_dev(sc-sc_dev, couldn't read %x/%x: %s\n,
 		req, index, usbd_errstr(status));

Index: src/sys/dev/usb/emdtv_dtv.c
diff -u src/sys/dev/usb/emdtv_dtv.c:1.7 src/sys/dev/usb/emdtv_dtv.c:1.8
--- src/sys/dev/usb/emdtv_dtv.c:1.7	Fri Dec 23 00:51:43 2011
+++ src/sys/dev/usb/emdtv_dtv.c	Mon Jan  9 11:02:18 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: emdtv_dtv.c,v 1.7 2011/12/23 00:51:43 jakllsch Exp $ */
+/* $NetBSD: emdtv_dtv.c,v 1.8 2012/01/09 11:02:18 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2008, 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: emdtv_dtv.c,v 1.7 2011/12/23 00:51:43 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: emdtv_dtv.c,v 1.8 2012/01/09 11:02:18 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -306,6 +306,7 @@ emdtv_dtv_start_transfer(void *priv,
 	aprint_debug_dev(sc-sc_dev, allocating isoc xfers (pktsz %d)\n,
 	sc-sc_isoc_maxpacketsize);
 
+	KERNEL_LOCK(1, curlwp);
 	for (i = 0; i  EMDTV_NXFERS; i++) {
 		sc-sc_ix[i].ix_xfer = usbd_alloc_xfer(sc-sc_udev);
 		sc-sc_ix[i].ix_buf = usbd_alloc_buffer(sc-sc_ix[i].ix_xfer,
@@ -313,6 +314,7 @@ emdtv_dtv_start_transfer(void *priv,
 		aprint_debug_dev(sc-sc_dev,   ix[%d] xfer %p buf %p\n,
 		i, sc-sc_ix[i].ix_xfer, sc-sc_ix[i].ix_buf);
 	}
+	KERNEL_UNLOCK_ONE(curlwp);
 
 	aprint_debug_dev(sc-sc_dev, starting isoc transactions\n);
 
@@ -332,6 +334,7 @@ emdtv_dtv_stop_transfer(void *priv)
 
 	sc-sc_streaming = false;
 
+	KERNEL_LOCK(1, curlwp);
 	if (sc-sc_isoc_pipe != NULL)
 		usbd_abort_pipe(sc-sc_isoc_pipe);
 
@@ -341,6 +344,7 @@ emdtv_dtv_stop_transfer(void *priv)
 			sc-sc_ix[i].ix_xfer = NULL;
 			sc-sc_ix[i].ix_buf = NULL;
 		}
+	KERNEL_UNLOCK_ONE(curlwp);
 
 	sc-sc_dtvsubmitcb = NULL;
 	sc-sc_dtvsubmitarg = NULL;
@@ -378,7 +382,10 @@ emdtv_dtv_isoc_start(struct emdtv_softc 
 			 EMDTV_NFRAMES,
 			 USBD_NO_COPY | USBD_SHORT_XFER_OK,
 			 emdtv_dtv_isoc);
+
+	KERNEL_LOCK(1, curlwp);
 	usbd_transfer(ix-ix_xfer);
+	KERNEL_UNLOCK_ONE(curlwp);
 
 	return 0;
 }



CVS commit: src/usr.bin/audiocfg

2010-09-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Sep  1 09:04:16 UTC 2010

Modified Files:
src/usr.bin/audiocfg: Makefile audiodev.c audiodev.h main.c
Added Files:
src/usr.bin/audiocfg: dtmf.c dtmf.h

Log Message:
add support for testing audio devices. the usage of audiocfg changes:

  audiocfg list
  audiocfg default [index]
  audiocfg test [index]

'list' shows the available audio devices, 'default' sets the default
audio device, and 'test' will play a tone for 2 seconds on each
channel. example:

  $ ./audiocfg list
  0: [*] audio0: ICH2 AC97 (2 playback channels)
  1: [ ] audio1: Pseudo Audio (2 playback channels)
  $ ./audiocfg test 0
  testing channel 0...
  testing channel 1...
  $


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/audiocfg/Makefile
cvs rdiff -u -r1.1.1.1 -r1.2 src/usr.bin/audiocfg/audiodev.c \
src/usr.bin/audiocfg/audiodev.h src/usr.bin/audiocfg/main.c
cvs rdiff -u -r0 -r1.1 src/usr.bin/audiocfg/dtmf.c \
src/usr.bin/audiocfg/dtmf.h

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

Modified files:

Index: src/usr.bin/audiocfg/Makefile
diff -u src/usr.bin/audiocfg/Makefile:1.2 src/usr.bin/audiocfg/Makefile:1.3
--- src/usr.bin/audiocfg/Makefile:1.2	Tue Aug 31 14:57:26 2010
+++ src/usr.bin/audiocfg/Makefile	Wed Sep  1 09:04:16 2010
@@ -1,9 +1,11 @@
+# $NetBSD: Makefile,v 1.3 2010/09/01 09:04:16 jmcneill Exp $
+
 PROG=	audiocfg
-SRCS=	audiodev.c drvctl.c
+SRCS=	audiodev.c drvctl.c dtmf.c
 SRCS+=	main.c
 WARNS=	3
 
-LDADD+=	-lprop
-DPADD+=	$(LIBPROP)
+LDADD+=	-lprop -lm
+DPADD+=	$(LIBPROP) $(LIBM)
 
 .include bsd.prog.mk

Index: src/usr.bin/audiocfg/audiodev.c
diff -u src/usr.bin/audiocfg/audiodev.c:1.1.1.1 src/usr.bin/audiocfg/audiodev.c:1.2
--- src/usr.bin/audiocfg/audiodev.c:1.1.1.1	Mon Aug 30 02:19:47 2010
+++ src/usr.bin/audiocfg/audiodev.c	Wed Sep  1 09:04:16 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: audiodev.c,v 1.1.1.1 2010/08/30 02:19:47 mrg Exp $ */
+/* $NetBSD: audiodev.c,v 1.2 2010/09/01 09:04:16 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2010 Jared D. McNeill jmcne...@invisible.ca
@@ -40,10 +40,42 @@
 
 #include audiodev.h
 #include drvctl.h
+#include dtmf.h
 
 static TAILQ_HEAD(audiodevhead, audiodev) audiodevlist =
 TAILQ_HEAD_INITIALIZER(audiodevlist);
 
+#define AUDIODEV_SAMPLE_RATE	44100
+
+static unsigned int
+audiodev_probe_pchans(struct audiodev *adev)
+{
+	audio_info_t info;
+	unsigned int nchans = 0, n;
+	int error;
+
+	AUDIO_INITINFO(info);
+	info.play.sample_rate = AUDIODEV_SAMPLE_RATE;
+	info.play.precision = 16;
+	info.play.encoding = AUDIO_ENCODING_SLINEAR_LE;
+	info.play.channels = 1;
+	info.mode = AUMODE_PLAY;
+	error = ioctl(adev-fd, AUDIO_SETINFO, info);
+	if (error == -1)
+		return 0;
+	nchans = 1;
+
+	for (n = 2; n = 16; n += 2) {
+		info.play.channels = n;
+		error = ioctl(adev-fd, AUDIO_SETINFO, info);
+		if (error == -1)
+			break;
+		nchans = info.play.channels;
+	}
+
+	return nchans;
+}
+
 static int
 audiodev_getinfo(struct audiodev *adev)
 {
@@ -64,6 +96,8 @@
 		return -1;
 	}
 
+	adev-pchan = audiodev_probe_pchans(adev);
+
 	return 0;
 }
 
@@ -107,7 +141,7 @@
 	struct audiodev *adev;
 	int fd, error;
 
-	fd = open(DRVCTLDEV, O_RDWR);
+	fd = open(DRVCTLDEV, O_RDONLY);
 	if (fd == -1) {
 		perror(open  DRVCTLDEV);
 		return -1;
@@ -202,3 +236,49 @@
 
 	return 0;
 }
+
+int
+audiodev_test(struct audiodev *adev, unsigned int chanmask)
+{
+	audio_info_t info;
+	int16_t *buf;
+	size_t buflen;
+	off_t off;
+
+	AUDIO_INITINFO(info);
+	info.play.sample_rate = AUDIODEV_SAMPLE_RATE;
+	info.play.channels = adev-pchan;
+	info.play.precision = 16;
+	info.play.encoding = AUDIO_ENCODING_SLINEAR_LE;
+	info.mode = AUMODE_PLAY;
+	if (ioctl(adev-fd, AUDIO_SETINFO, info) == -1) {
+		perror(ioctl AUDIO_SETINFO);
+		return -1;
+	}
+	if (ioctl(adev-fd, AUDIO_GETINFO, info) == -1) {
+		perror(ioctl AUDIO_GETINFO);
+		return -1;
+	}
+
+	dtmf_new(buf, buflen, info.play.sample_rate, 2,
+	adev-pchan, chanmask, 350.0, 440.0);
+	if (buf == NULL)
+		return -1;
+
+	off = 0;
+	while (buflen  0) {
+		size_t wlen = info.play.buffer_size;
+		if (wlen  buflen)
+			wlen = buflen;
+		write(adev-fd, (char *)buf + off, wlen);
+		off += wlen;
+		buflen -= wlen;
+	}
+
+	if (ioctl(adev-fd, AUDIO_DRAIN) == -1)
+		perror(ioctl AUDIO_DRAIN);
+
+	free(buf);
+
+	return 0;
+}
Index: src/usr.bin/audiocfg/audiodev.h
diff -u src/usr.bin/audiocfg/audiodev.h:1.1.1.1 src/usr.bin/audiocfg/audiodev.h:1.2
--- src/usr.bin/audiocfg/audiodev.h:1.1.1.1	Mon Aug 30 02:19:47 2010
+++ src/usr.bin/audiocfg/audiodev.h	Wed Sep  1 09:04:16 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: audiodev.h,v 1.1.1.1 2010/08/30 02:19:47 mrg Exp $ */
+/* $NetBSD: audiodev.h,v 1.2 2010/09/01 09:04:16 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2010 Jared D. McNeill jmcne...@invisible.ca
@@ -44,6 +44,8 @@
 	dev_t dev;
 	bool defaultdev;
 
+	int pchan;
+
 	audio_device_t audio_device;
 
 	TAILQ_ENTRY(audiodev) next

CVS commit: src/usr.bin/audiocfg

2010-09-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Sep  1 21:54:00 UTC 2010

Modified Files:
src/usr.bin/audiocfg: dtmf.c

Log Message:
use htole16 to ensure that the pcm stream is slinear16_le on big endian hosts


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/audiocfg/dtmf.c

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

Modified files:

Index: src/usr.bin/audiocfg/dtmf.c
diff -u src/usr.bin/audiocfg/dtmf.c:1.1 src/usr.bin/audiocfg/dtmf.c:1.2
--- src/usr.bin/audiocfg/dtmf.c:1.1	Wed Sep  1 09:04:16 2010
+++ src/usr.bin/audiocfg/dtmf.c	Wed Sep  1 21:54:00 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: dtmf.c,v 1.1 2010/09/01 09:04:16 jmcneill Exp $ */
+/* $NetBSD: dtmf.c,v 1.2 2010/09/01 21:54:00 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2010 Jared D. McNeill jmcne...@invisible.ca
@@ -26,6 +26,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include sys/endian.h
+
 #include fcntl.h
 #include math.h
 #include stdio.h
@@ -50,9 +52,10 @@
 		for (c = 0; c  channels; c++) {
 			if ((chanmask  (1  c)) == 0)
 continue;
-			buf[c] = 
+			buf[c] = htole16(
 			(sin(i * PI2 * (freq1 / sample_rate)) +
-			 sin(i * PI2 * (freq2 / sample_rate))) * 16383;
+			 sin(i * PI2 * (freq2 / sample_rate))) * 16383
+	);
 		}
 		buf += channels;
 	}



CVS commit: src/sys/dev/pci/hdaudio

2010-09-01 Thread Jared D. McNeill
-sc_vendor);
-	prop_dictionary_get_uint16(args, product-id, sc-sc_product);
 
 	sc-sc_nid = nid;
 	sc-sc_fg = (struct hdaudio_function_group *)(vaddr_t)fgptr;
@@ -3448,7 +3449,16 @@
 static int
 hdaudio_afg_getdev(void *opaque, struct audio_device *audiodev)
 {
-	*audiodev = hdaudio_afg_audio_device;
+	struct hdaudio_audiodev *ad = opaque;
+	struct hdaudio_afg_softc *sc = ad-ad_sc;
+
+	hdaudio_id2name(sc-sc_vendor, HDA_PRODUCT_ANY,
+	audiodev-name, sizeof(audiodev-name));
+	hdaudio_id2name(sc-sc_vendor, sc-sc_product,
+	audiodev-version, sizeof(audiodev-version));
+	snprintf(audiodev-config, sizeof(audiodev-config) - 1,
+	%02Xh, sc-sc_nid);
+
 	return 0;
 }
 

Added files:

Index: src/sys/dev/pci/hdaudio/hdaudio_ids.c
diff -u /dev/null src/sys/dev/pci/hdaudio/hdaudio_ids.c:1.1
--- /dev/null	Thu Sep  2 01:55:31 2010
+++ src/sys/dev/pci/hdaudio/hdaudio_ids.c	Thu Sep  2 01:55:31 2010
@@ -0,0 +1,259 @@
+/* $NetBSD: hdaudio_ids.c,v 1.1 2010/09/02 01:55:31 jmcneill Exp $ */
+
+/*
+ * Copyright (c) 2010 Jared D. McNeill jmcne...@invisible.ca
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Precedence Technologies Ltd
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote products
+ *derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__KERNEL_RCSID(0, $NetBSD: hdaudio_ids.c,v 1.1 2010/09/02 01:55:31 jmcneill Exp $);
+
+#include sys/types.h
+#include sys/param.h
+#include sys/systm.h
+#include sys/conf.h
+
+#include dev/pci/hdaudio/hdaudio_ids.h
+
+static const struct hdaudio_id {
+	uint16_t vendor;
+	uint16_t product;
+	const char *name;
+} hdaudio_ids[] = {
+	/* ATI */
+	{ HDA_VENDOR_ATI, 0x7919, RS600 HDMI },
+	{ HDA_VENDOR_ATI, 0x793c, RS600 HDMI },
+	{ HDA_VENDOR_ATI, 0x791a, RS690/780 HDMI },
+	{ HDA_VENDOR_ATI, 0xaa01, RS600 HDMI },
+	{ HDA_VENDOR_ATI, HDA_PRODUCT_ANY, ATI },
+	/* NVIDIA */
+	{ HDA_VENDOR_NVIDIA, 0x0002, MCP77/78 HDMI },
+	{ HDA_VENDOR_NVIDIA, 0x0003, MCP77/78 HDMI },
+	{ HDA_VENDOR_NVIDIA, 0x0005, MCP77/78 HDMI },
+	{ HDA_VENDOR_NVIDIA, 0x0006, MCP77/78 HDMI },
+	{ HDA_VENDOR_NVIDIA, 0x0007, MCP79/7A HDMI },
+	{ HDA_VENDOR_NVIDIA, 0x000a, GT220 HDMI },
+	{ HDA_VENDOR_NVIDIA, 0x000b, GT21x HDMI },
+	{ HDA_VENDOR_NVIDIA, 0x000c, MCP89 HDMI },
+	{ HDA_VENDOR_NVIDIA, 0x000d, GT240 HDMI },
+	{ HDA_VENDOR_NVIDIA, 0x0067, MCP67 HDMI },
+	{ HDA_VENDOR_NVIDIA, 0x8001, MCP73 HDMI },
+	{ HDA_VENDOR_NVIDIA, HDA_PRODUCT_ANY, NVIDIA },
+	/* Realtek */
+	{ HDA_VENDOR_REALTEK, 0x0260, ALC260 },
+	{ HDA_VENDOR_REALTEK, 0x0262, ALC262 },
+	{ HDA_VENDOR_REALTEK, 0x0267, ALC267 },
+	{ HDA_VENDOR_REALTEK, 0x0268, ALC268 },
+	{ HDA_VENDOR_REALTEK, 0x0269, ALC269 },
+	{ HDA_VENDOR_REALTEK, 0x0270, ALC270 },
+	{ HDA_VENDOR_REALTEK, 0x0272, ALC272 },
+	{ HDA_VENDOR_REALTEK, 0x0275, ALC275 },
+	{ HDA_VENDOR_REALTEK, 0x0660, ALC660-VD },
+	{ HDA_VENDOR_REALTEK, 0x0662, ALC662 },
+	{ HDA_VENDOR_REALTEK, 0x0663, ALC663 },
+	{ HDA_VENDOR_REALTEK, 0x0670, ALC670 },
+	{ HDA_VENDOR_REALTEK, 0x0861, ALC861 },
+	{ HDA_VENDOR_REALTEK, 0x0862, ALC861-VD },
+	{ HDA_VENDOR_REALTEK, 0x0880, ALC880 },
+	{ HDA_VENDOR_REALTEK, 0x0882, ALC882 },
+	{ HDA_VENDOR_REALTEK, 0x0883, ALC883 },
+	{ HDA_VENDOR_REALTEK, 0x0885, ALC885 },
+	{ HDA_VENDOR_REALTEK, 0x0887, ALC887 },
+	{ HDA_VENDOR_REALTEK, 0x0888, ALC888 },
+	{ HDA_VENDOR_REALTEK, 0x0889, ALC889 },
+	{ HDA_VENDOR_REALTEK, 0x0892, ALC892 },
+	{ HDA_VENDOR_REALTEK, HDA_PRODUCT_ANY, Realtek },
+	/* VIA */
+	{ HDA_VENDOR_VIA, 0x1708, VT1708 },
+	{ HDA_VENDOR_VIA, 0x1709, VT1708 },
+	{ HDA_VENDOR_VIA, 0x170a, VT1708 },
+	{ HDA_VENDOR_VIA, 0x170b, VT1708 },
+	{ HDA_VENDOR_VIA, 0xe710, VT1709 10ch },
+	{ HDA_VENDOR_VIA, 0xe711, VT1709 10ch },
+	{ HDA_VENDOR_VIA, 0xe712, VT1709 10ch },
+	{ HDA_VENDOR_VIA, 0xe713, VT1709 10ch },
+	{ HDA_VENDOR_VIA, 0xe714, VT1709 6ch },
+	{ HDA_VENDOR_VIA, 0xe715, VT1709 6ch

CVS commit: src/usr.bin/audiocfg

2010-09-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Sep  2 02:08:30 UTC 2010

Modified Files:
src/usr.bin/audiocfg: main.c

Log Message:
print the version field from AUDIO_GETDEV if present


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/audiocfg/main.c

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

Modified files:

Index: src/usr.bin/audiocfg/main.c
diff -u src/usr.bin/audiocfg/main.c:1.3 src/usr.bin/audiocfg/main.c:1.4
--- src/usr.bin/audiocfg/main.c:1.3	Wed Sep  1 09:18:03 2010
+++ src/usr.bin/audiocfg/main.c	Thu Sep  2 02:08:30 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.3 2010/09/01 09:18:03 wiz Exp $ */
+/* $NetBSD: main.c,v 1.4 2010/09/02 02:08:30 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2010 Jared D. McNeill jmcne...@invisible.ca
@@ -62,9 +62,12 @@
 		n = audiodev_count();
 		for (i = 0; i  n; i++) {
 			adev = audiodev_get(i);
-			printf(%u: [%c] %s: %s (%u playback channel%s)\n,
-			i, adev-defaultdev ? '*' : ' ',
-			adev-xname, adev-audio_device.name,
+			printf(%u: [%c] %s: ,
+			i, adev-defaultdev ? '*' : ' ', adev-xname);
+			printf(%s, adev-audio_device.name);
+			if (strlen(adev-audio_device.version)  0)
+printf( %s, adev-audio_device.version);
+			printf(, %u playback channel%s\n,
 			adev-pchan, adev-pchan == 1 ?  : s);
 		}
 	} else if (strcmp(argv[1], default) == 0  argc == 3) {



CVS commit: src/sys/dev/pad

2010-09-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Sep  3 19:19:49 UTC 2010

Modified Files:
src/sys/dev/pad: pad.c

Log Message:
- return EIO if audio data is received and /dev/pad isn't open
- give a better description for AUDIO_GETDEV


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pad/pad.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/dev/pad/pad.c
diff -u src/sys/dev/pad/pad.c:1.15 src/sys/dev/pad/pad.c:1.16
--- src/sys/dev/pad/pad.c:1.15	Mon Jun 28 17:45:08 2010
+++ src/sys/dev/pad/pad.c	Fri Sep  3 19:19:48 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.15 2010/06/28 17:45:08 pooka Exp $ */
+/* $NetBSD: pad.c,v 1.16 2010/09/03 19:19:48 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pad.c,v 1.15 2010/06/28 17:45:08 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: pad.c,v 1.16 2010/09/03 19:19:48 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -54,12 +54,6 @@
 
 extern struct cfdriver pad_cd;
 
-static struct audio_device pad_device = {
-	Pseudo Audio,
-	1.0,
-	pad,
-};
-
 typedef struct pad_block {
 	uint8_t		*pb_ptr;
 	int		pb_len;
@@ -181,6 +175,9 @@
 {
 	int l;
 
+	if (sc-sc_open == 0)
+		return EIO;
+
 	if (sc-sc_buflen + blksize  PAD_BUFSIZE)
 		return ENOBUFS;
 
@@ -476,8 +473,9 @@
 static int
 pad_getdev(void *opaque, struct audio_device *ret)
 {
-
-	*ret = pad_device;
+	strlcpy(ret-name, Virtual Audio, sizeof(ret-name));
+	strlcpy(ret-version, osrelease, sizeof(ret-version));
+	strlcpy(ret-config, pad, sizeof(ret-config));
 
 	return 0;
 }



CVS commit: src/usr.bin/audiocfg

2010-09-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Sep  3 19:20:37 UTC 2010

Modified Files:
src/usr.bin/audiocfg: audiodev.c main.c

Log Message:
return an error if testing fails, and dump the device info before running tests


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/audiocfg/audiodev.c
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/audiocfg/main.c

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

Modified files:

Index: src/usr.bin/audiocfg/audiodev.c
diff -u src/usr.bin/audiocfg/audiodev.c:1.3 src/usr.bin/audiocfg/audiodev.c:1.4
--- src/usr.bin/audiocfg/audiodev.c:1.3	Thu Sep  2 02:17:35 2010
+++ src/usr.bin/audiocfg/audiodev.c	Fri Sep  3 19:20:37 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: audiodev.c,v 1.3 2010/09/02 02:17:35 jmcneill Exp $ */
+/* $NetBSD: audiodev.c,v 1.4 2010/09/03 19:20:37 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2010 Jared D. McNeill jmcne...@invisible.ca
@@ -245,6 +245,7 @@
 	int16_t *buf;
 	size_t buflen;
 	off_t off;
+	int rv = 0;
 
 	AUDIO_INITINFO(info);
 	info.play.sample_rate = AUDIODEV_SAMPLE_RATE;
@@ -271,7 +272,12 @@
 		size_t wlen = info.play.buffer_size;
 		if (wlen  buflen)
 			wlen = buflen;
-		write(adev-fd, (char *)buf + off, wlen);
+		wlen = write(adev-fd, (char *)buf + off, wlen);
+		if (wlen == -1) {
+			perror(write);
+			rv = -1;
+			goto done;
+		}
 		off += wlen;
 		buflen -= wlen;
 	}
@@ -279,7 +285,8 @@
 	if (ioctl(adev-fd, AUDIO_DRAIN) == -1)
 		perror(ioctl AUDIO_DRAIN);
 
+done:
 	free(buf);
 
-	return 0;
+	return rv;
 }

Index: src/usr.bin/audiocfg/main.c
diff -u src/usr.bin/audiocfg/main.c:1.5 src/usr.bin/audiocfg/main.c:1.6
--- src/usr.bin/audiocfg/main.c:1.5	Thu Sep  2 02:17:35 2010
+++ src/usr.bin/audiocfg/main.c	Fri Sep  3 19:20:37 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.5 2010/09/02 02:17:35 jmcneill Exp $ */
+/* $NetBSD: main.c,v 1.6 2010/09/03 19:20:37 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2010 Jared D. McNeill jmcne...@invisible.ca
@@ -26,6 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include assert.h
 #include errno.h
 #include fcntl.h
 #include limits.h
@@ -45,6 +46,21 @@
 	exit(EXIT_FAILURE);
 }
 
+static void
+print_audiodev(struct audiodev *adev, int i)
+{
+	assert(adev != NULL);
+
+	printf(%u: [%c] %s @ %s: ,
+	i, adev-defaultdev ? '*' : ' ',
+	adev-xname, adev-pxname);
+	printf(%s, adev-audio_device.name);
+	if (strlen(adev-audio_device.version)  0)
+		printf( %s, adev-audio_device.version);
+	printf(, %u playback channel%s\n,
+	adev-pchan, adev-pchan == 1 ?  : s);
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -60,17 +76,8 @@
 
 	if (strcmp(argv[1], list) == 0) {
 		n = audiodev_count();
-		for (i = 0; i  n; i++) {
-			adev = audiodev_get(i);
-			printf(%u: [%c] %s @ %s: ,
-			i, adev-defaultdev ? '*' : ' ',
-			adev-xname, adev-pxname);
-			printf(%s, adev-audio_device.name);
-			if (strlen(adev-audio_device.version)  0)
-printf( %s, adev-audio_device.version);
-			printf(, %u playback channel%s\n,
-			adev-pchan, adev-pchan == 1 ?  : s);
-		}
+		for (i = 0; i  n; i++)
+			print_audiodev(audiodev_get(i), i);
 	} else if (strcmp(argv[1], default) == 0  argc == 3) {
 		if (*argv[2]  '0' || *argv[2]  '9')
 			usage(argv[0]);
@@ -104,9 +111,13 @@
 			fprintf(stderr, no such device\n);
 			return EXIT_FAILURE;
 		}
+		print_audiodev(adev, i);
 		for (i = 0; i  adev-pchan; i++) {
-			printf(testing channel %d...\n, i);
-			audiodev_test(adev, 1  i);
+			printf(  testing channel %d..., i);
+			fflush(stdout);
+			if (audiodev_test(adev, 1  i) == -1)
+return EXIT_FAILURE;
+			printf( done\n);
 		}
 	} else
 		usage(argv[0]);



CVS commit: src/share/man/man4

2010-09-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Sep  4 11:10:17 UTC 2010

Modified Files:
src/share/man/man4: acpi.4

Log Message:
Add a reference to Len Brown's 'ACPI in Linux - Myths vs. Reality' paper


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/share/man/man4/acpi.4

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

Modified files:

Index: src/share/man/man4/acpi.4
diff -u src/share/man/man4/acpi.4:1.56 src/share/man/man4/acpi.4:1.57
--- src/share/man/man4/acpi.4:1.56	Sun Aug  8 05:02:59 2010
+++ src/share/man/man4/acpi.4	Sat Sep  4 11:10:16 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: acpi.4,v 1.56 2010/08/08 05:02:59 jruoho Exp $
+.\ $NetBSD: acpi.4,v 1.57 2010/09/04 11:10:16 jmcneill Exp $
 .\
 .\ Copyright (c) 2002, 2004, 2010 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -563,6 +563,12 @@
 .%U http://www.acpica.org/download/acpica-reference.pdf
 .Re
 .Rs
+.%A Len Brown
+.%T ACPI in Linux - Myths vs. Reality
+.%D June 27-30, 2007
+.%U http://www.linuxsymposium.org/archives/OLS/Reprints-2007/brown_1-Reprint.pdf
+.Re
+.Rs
 .%A Joerg Sonnenberger
 .%A Jared D. McNeill
 .%T Sleeping Beauty - NetBSD on Modern Laptops



CVS commit: src/sys

2010-09-06 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Sep  6 15:54:27 UTC 2010

Modified Files:
src/sys/arch/x86/x86: platform.c
src/sys/dev/acpi: acpi.c acpi_quirks.c acpivar.h files.acpi

Log Message:
Add support for blacklisting ACPI BIOS implementations by year. By default,
don't use ACPI on BIOS which advertise release years = 2000. This
can be changed by setting option ACPI_BLACKLIST_YEAR=0 or by setting
acpi_force_load=1.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/x86/x86/platform.c
cvs rdiff -u -r1.218 -r1.219 src/sys/dev/acpi/acpi.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/acpi/acpi_quirks.c
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/acpi/acpivar.h
cvs rdiff -u -r1.79 -r1.80 src/sys/dev/acpi/files.acpi

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/x86/x86/platform.c
diff -u src/sys/arch/x86/x86/platform.c:1.8 src/sys/arch/x86/x86/platform.c:1.9
--- src/sys/arch/x86/x86/platform.c:1.8	Tue Feb 17 21:15:19 2009
+++ src/sys/arch/x86/x86/platform.c	Mon Sep  6 15:54:27 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: platform.c,v 1.8 2009/02/17 21:15:19 ad Exp $ */
+/* $NetBSD: platform.c,v 1.9 2010/09/06 15:54:27 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -29,7 +29,7 @@
 #include isa.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: platform.c,v 1.8 2009/02/17 21:15:19 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: platform.c,v 1.9 2010/09/06 15:54:27 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -42,6 +42,7 @@
 
 void		platform_init(void);	/* XXX */
 static void	platform_add(struct smbtable *, const char *, int);
+static void	platform_add_date(struct smbtable *, const char *, int);
 static void	platform_print(void);
 
 void
@@ -49,6 +50,7 @@
 {
 	struct smbtable smbios;
 	struct smbios_sys *psys;
+	struct smbios_struct_bios *pbios;
 	struct smbios_slot *pslot;
 	int nisa, nother;
 
@@ -63,6 +65,15 @@
 	}
 
 	smbios.cookie = 0;
+	if (smbios_find_table(SMBIOS_TYPE_BIOS, smbios)) {
+		pbios = smbios.tblhdr;
+
+		platform_add(smbios, firmware-vendor, pbios-vendor);
+		platform_add(smbios, firmware-version, pbios-version);
+		platform_add_date(smbios, firmware-date, pbios-release);
+	}
+
+	smbios.cookie = 0;
 	nisa = 0;
 	nother = 0;
 	while (smbios_find_table(SMBIOS_TYPE_SLOTS, smbios)) {
@@ -118,3 +129,46 @@
 	if (smbios_get_string(tbl, idx, tmpbuf, 128) != NULL)
 		pmf_set_platform(key, tmpbuf);
 }
+
+static int
+platform_scan_date(char *buf, unsigned int *month, unsigned int *day,
+unsigned int *year)
+{
+	char *p, *s;
+
+	s = buf;
+	p = strchr(s, '/');
+	if (p) *p = '\0';
+	*month = strtoul(s, NULL, 10);
+	if (!p) return 1;
+
+	s = p + 1;
+	p = strchr(s, '/');
+	if (p) *p = '\0';
+	*day = strtoul(s, NULL, 10);
+	if (!p) return 2;
+
+	s = p + 1;
+	*year = strtoul(s, NULL, 10);
+	return 3;
+}
+
+static void
+platform_add_date(struct smbtable *tbl, const char *key, int idx)
+{
+	unsigned int month, day, year;
+	char tmpbuf[128], datestr[9];
+
+	if (smbios_get_string(tbl, idx, tmpbuf, 128) == NULL)
+		return;
+	if (platform_scan_date(tmpbuf, month, day, year) != 3)
+		return;
+	if (month == 0 || month  12 || day == 0 || day  31)
+		return;
+	if (year  100)
+		year += 1900;
+	if (year  )
+		return;
+	sprintf(datestr, %04u%02u%02u, year, month, day);
+	pmf_set_platform(key, datestr);
+}

Index: src/sys/dev/acpi/acpi.c
diff -u src/sys/dev/acpi/acpi.c:1.218 src/sys/dev/acpi/acpi.c:1.219
--- src/sys/dev/acpi/acpi.c:1.218	Tue Aug 24 04:36:02 2010
+++ src/sys/dev/acpi/acpi.c	Mon Sep  6 15:54:26 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi.c,v 1.218 2010/08/24 04:36:02 pgoyette Exp $	*/
+/*	$NetBSD: acpi.c,v 1.219 2010/09/06 15:54:26 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: acpi.c,v 1.218 2010/08/24 04:36:02 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: acpi.c,v 1.219 2010/09/06 15:54:26 jmcneill Exp $);
 
 #include opt_acpi.h
 #include opt_pcifixup.h
@@ -333,6 +333,13 @@
 		AcpiTerminate();
 		return 0;
 	}
+	if (acpi_force_load == 0  (acpi_find_quirks()  ACPI_QUIRK_OLDBIOS)) {
+		aprint_normal(ACPI: BIOS is too old (%s). Set acpi_force_load to use.\n,
+		pmf_get_platform(firmware-date));
+		acpi_unmap_rsdt(rsdt);
+		AcpiTerminate();
+		return 0;
+	}
 
 	acpi_unmap_rsdt(rsdt);
 

Index: src/sys/dev/acpi/acpi_quirks.c
diff -u src/sys/dev/acpi/acpi_quirks.c:1.17 src/sys/dev/acpi/acpi_quirks.c:1.18
--- src/sys/dev/acpi/acpi_quirks.c:1.17	Mon Sep  6 14:09:54 2010
+++ src/sys/dev/acpi/acpi_quirks.c	Mon Sep  6 15:54:27 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_quirks.c,v 1.17 2010/09/06 14:09:54 jakllsch Exp $	*/
+/*	$NetBSD: acpi_quirks.c,v 1.18 2010/09/06 15:54:27 jmcneill Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -37,7 +37,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD

CVS commit: src/share/man/man4

2010-09-06 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Sep  6 16:01:25 UTC 2010

Modified Files:
src/share/man/man4: acpi.4

Log Message:
document ACPI_BLACKLIST_YEAR


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/share/man/man4/acpi.4

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

Modified files:

Index: src/share/man/man4/acpi.4
diff -u src/share/man/man4/acpi.4:1.57 src/share/man/man4/acpi.4:1.58
--- src/share/man/man4/acpi.4:1.57	Sat Sep  4 11:10:16 2010
+++ src/share/man/man4/acpi.4	Mon Sep  6 16:01:25 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: acpi.4,v 1.57 2010/09/04 11:10:16 jmcneill Exp $
+.\ $NetBSD: acpi.4,v 1.58 2010/09/06 16:01:25 jmcneill Exp $
 .\
 .\ Copyright (c) 2002, 2004, 2010 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -24,7 +24,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd August 8, 2010
+.Dd September 6, 2010
 .Dt ACPI 4
 .Os
 .Sh NAME
@@ -38,6 +38,7 @@
 .Cd options	ACPI_ACTIVATE_DEV
 .Cd options	ACPI_DSDT_OVERRIDE
 .Cd options	ACPI_DSDT_FILE=\*[q]\*[q]
+.Cd options	ACPI_BLACKLIST_YEAR=2000
 .Sh DESCRIPTION
 .Nx
 provides machine-independent bus support for
@@ -94,6 +95,8 @@
 is not specified, default to
 .Dq dsdt.hex
 in the build directory.
+.It Dv ACPI_BLACKLIST_YEAR=2000
+Do not use ACPI with any BIOS made on or before the specified year.
 .El
 .Sh SYSCTL SUPPORT
 Few



CVS commit: src/doc

2010-09-06 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Sep  6 16:03:56 UTC 2010

Modified Files:
src/doc: CHANGES

Log Message:
acpi(4): The ACPI driver will no longer attach if the BIOS release
year is 2000 or older. To override this behaviour, set
acpi_force_load=1 or add options ACPI_BLACKLIST_YEAR=0 to your
kernel config. [jmcneill 20100906]


To generate a diff of this commit:
cvs rdiff -u -r1.1434 -r1.1435 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1434 src/doc/CHANGES:1.1435
--- src/doc/CHANGES:1.1434	Tue Aug 31 19:08:50 2010
+++ src/doc/CHANGES	Mon Sep  6 16:03:56 2010
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1434 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1435 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -715,3 +715,7 @@
 		[kardel 20100827]
 	omapfb: a simple driver for OMAP 3xxx on-chip video, especially the
 		Beagleboard [macallan 20100831]
+	acpi(4): The ACPI driver will no longer attach if the BIOS release
+		year is 2000 or older. To override this behaviour, set
+		acpi_force_load=1 or add options ACPI_BLACKLIST_YEAR=0 to your
+		kernel config. [jmcneill 20100906]



CVS commit: src/sys/dev/ic

2010-10-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Oct 19 22:27:19 UTC 2010

Modified Files:
src/sys/dev/ic: pcdisplay_subr.c

Log Message:
When disabling the hardware cursor, use the 'cursor disable' bit in the
cursor start register. I think this only accidentally worked for the past
11 years because the start and end scanlines were both set to 0x10.

See also http://www.osdever.net/FreeVGA/vga/crtcreg.htm#0A


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/ic/pcdisplay_subr.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/dev/ic/pcdisplay_subr.c
diff -u src/sys/dev/ic/pcdisplay_subr.c:1.34 src/sys/dev/ic/pcdisplay_subr.c:1.35
--- src/sys/dev/ic/pcdisplay_subr.c:1.34	Fri Oct 19 11:59:58 2007
+++ src/sys/dev/ic/pcdisplay_subr.c	Tue Oct 19 22:27:19 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: pcdisplay_subr.c,v 1.34 2007/10/19 11:59:58 ad Exp $ */
+/* $NetBSD: pcdisplay_subr.c,v 1.35 2010/10/19 22:27:19 jmcneill Exp $ */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pcdisplay_subr.c,v 1.34 2007/10/19 11:59:58 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: pcdisplay_subr.c,v 1.35 2010/10/19 22:27:19 jmcneill Exp $);
 
 #include opt_wsmsgattrs.h /* for WSDISPLAY_CUSTOM_OUTPUT */
 
@@ -51,8 +51,9 @@
 	bus_space_handle_t memh;
 	int off;
 
-	pcdisplay_6845_write(scr-hdl, curstart, 0x10);
-	pcdisplay_6845_write(scr-hdl, curend, 0x10);
+	/* Disable the hardware cursor */
+	pcdisplay_6845_write(scr-hdl, curstart, 0x20);
+	pcdisplay_6845_write(scr-hdl, curend, 0x00);
 
 	if (existing) {
 		/*



CVS commit: src/sys/dev/ic

2010-10-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Oct 19 22:27:54 UTC 2010

Modified Files:
src/sys/dev/ic: vga.c

Log Message:
If PCDISPLAY_SOFTCURSOR is defined, disable the hardware cursor on resume.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/dev/ic/vga.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/dev/ic/vga.c
diff -u src/sys/dev/ic/vga.c:1.104 src/sys/dev/ic/vga.c:1.105
--- src/sys/dev/ic/vga.c:1.104	Mon Apr 19 18:24:26 2010
+++ src/sys/dev/ic/vga.c	Tue Oct 19 22:27:54 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: vga.c,v 1.104 2010/04/19 18:24:26 dyoung Exp $ */
+/* $NetBSD: vga.c,v 1.105 2010/10/19 22:27:54 jmcneill Exp $ */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vga.c,v 1.104 2010/04/19 18:24:26 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: vga.c,v 1.105 2010/10/19 22:27:54 jmcneill Exp $);
 
 /* for WSCONS_SUPPORT_PCVTFONTS */
 #include opt_wsdisplay_compat.h
@@ -1480,4 +1480,9 @@
 #ifdef VGA_RESET_ON_RESUME
 	vga_initregs(sc-sc_vc-hdl);
 #endif
+#ifdef PCDISPLAY_SOFTCURSOR
+	/* Disable the hardware cursor */
+	vga_6845_write(sc-sc_vc-hdl, curstart, 0x20);
+	vga_6845_write(sc-sc_vc-hdl, curend, 0x00);
+#endif
 }



CVS commit: src/sys/dev

2010-10-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Oct 21 01:02:35 UTC 2010

Modified Files:
src/sys/dev: firmload.c

Log Message:
perform pathname lookup with NOCHROOT flag


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/firmload.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/dev/firmload.c
diff -u src/sys/dev/firmload.c:1.12 src/sys/dev/firmload.c:1.13
--- src/sys/dev/firmload.c:1.12	Thu Jun 24 13:03:08 2010
+++ src/sys/dev/firmload.c	Thu Oct 21 01:02:34 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: firmload.c,v 1.12 2010/06/24 13:03:08 hannken Exp $	*/
+/*	$NetBSD: firmload.c,v 1.13 2010/10/21 01:02:34 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: firmload.c,v 1.12 2010/06/24 13:03:08 hannken Exp $);
+__KERNEL_RCSID(0, $NetBSD: firmload.c,v 1.13 2010/10/21 01:02:34 jmcneill Exp $);
 
 /*
  * The firmload API provides an interface for device drivers to access
@@ -244,7 +244,7 @@
 	for (path = firmware_path_first(drvname, imgname, pnbuf, prefix);
 	 path != NULL;
 	 path = firmware_path_next(drvname, imgname, pnbuf, prefix)) {
-		NDINIT(nd, LOOKUP, FOLLOW, UIO_SYSSPACE, path);
+		NDINIT(nd, LOOKUP, FOLLOW | NOCHROOT, UIO_SYSSPACE, path);
 		error = vn_open(nd, FREAD, 0);
 		if (error == ENOENT)
 			continue;



CVS commit: src/sys/dev/acpi/wmi

2010-10-24 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 24 15:07:20 UTC 2010

Modified Files:
src/sys/dev/acpi/wmi: wmi_acpi.c

Log Message:
add rescan support


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/acpi/wmi/wmi_acpi.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/dev/acpi/wmi/wmi_acpi.c
diff -u src/sys/dev/acpi/wmi/wmi_acpi.c:1.7 src/sys/dev/acpi/wmi/wmi_acpi.c:1.8
--- src/sys/dev/acpi/wmi/wmi_acpi.c:1.7	Fri Aug  6 22:45:00 2010
+++ src/sys/dev/acpi/wmi/wmi_acpi.c	Sun Oct 24 15:07:20 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: wmi_acpi.c,v 1.7 2010/08/06 22:45:00 jruoho Exp $	*/
+/*	$NetBSD: wmi_acpi.c,v 1.8 2010/10/24 15:07:20 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2009, 2010 Jukka Ruohonen jruoho...@iki.fi
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wmi_acpi.c,v 1.7 2010/08/06 22:45:00 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: wmi_acpi.c,v 1.8 2010/10/24 15:07:20 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -54,6 +54,8 @@
 static int acpi_wmi_match(device_t, cfdata_t, void *);
 static voidacpi_wmi_attach(device_t, device_t, void *);
 static int acpi_wmi_detach(device_t, int);
+static int acpi_wmi_rescan(device_t, const char *, const int *);
+static voidacpi_wmi_childdet(device_t, device_t);
 static int acpi_wmi_print(void *, const char *);
 static boolacpi_wmi_init(struct acpi_wmi_softc *);
 static boolacpi_wmi_add(struct acpi_wmi_softc *, ACPI_OBJECT *);
@@ -76,8 +78,9 @@
 	NULL
 };
 
-CFATTACH_DECL_NEW(acpiwmi, sizeof(struct acpi_wmi_softc),
-acpi_wmi_match, acpi_wmi_attach, acpi_wmi_detach, NULL);
+CFATTACH_DECL2_NEW(acpiwmi, sizeof(struct acpi_wmi_softc),
+acpi_wmi_match, acpi_wmi_attach, acpi_wmi_detach, NULL,
+acpi_wmi_rescan, acpi_wmi_childdet);
 
 static int
 acpi_wmi_match(device_t parent, cfdata_t match, void *aux)
@@ -111,8 +114,7 @@
 	acpi_wmi_dump(sc);
 	acpi_wmi_event_add(sc);
 
-	sc-sc_child = config_found_ia(self, acpiwmibus,
-	NULL, acpi_wmi_print);
+	acpi_wmi_rescan(self, NULL, NULL);
 
 	(void)pmf_device_register(self, acpi_wmi_suspend, acpi_wmi_resume);
 }
@@ -134,6 +136,27 @@
 }
 
 static int
+acpi_wmi_rescan(device_t self, const char *ifattr, const int *locators)
+{
+	struct acpi_wmi_softc *sc = device_private(self);
+
+	if (ifattr_match(ifattr, acpiwmibus)  sc-sc_child == NULL)
+		sc-sc_child = config_found_ia(self, acpiwmibus,
+		NULL, acpi_wmi_print);
+
+	return 0;
+}
+
+static void
+acpi_wmi_childdet(device_t self, device_t child)
+{
+	struct acpi_wmi_softc *sc = device_private(self);
+
+	if (sc-sc_child == child)
+		sc-sc_child = NULL;
+}
+
+static int
 acpi_wmi_print(void *aux, const char *pnp)
 {
 



CVS commit: src/sys/dev/acpi/wmi

2010-10-24 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 24 16:25:31 UTC 2010

Modified Files:
src/sys/dev/acpi/wmi: wmi_dell.c wmi_hp.c wmi_msi.c

Log Message:
add support for building as modules


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/acpi/wmi/wmi_dell.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/acpi/wmi/wmi_hp.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/acpi/wmi/wmi_msi.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/dev/acpi/wmi/wmi_dell.c
diff -u src/sys/dev/acpi/wmi/wmi_dell.c:1.4 src/sys/dev/acpi/wmi/wmi_dell.c:1.5
--- src/sys/dev/acpi/wmi/wmi_dell.c:1.4	Wed Jun 30 07:58:11 2010
+++ src/sys/dev/acpi/wmi/wmi_dell.c	Sun Oct 24 16:25:31 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: wmi_dell.c,v 1.4 2010/06/30 07:58:11 jruoho Exp $ */
+/*	$NetBSD: wmi_dell.c,v 1.5 2010/10/24 16:25:31 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -31,10 +31,11 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wmi_dell.c,v 1.4 2010/06/30 07:58:11 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: wmi_dell.c,v 1.5 2010/10/24 16:25:31 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/device.h
+#include sys/module.h
 
 #include dev/acpi/acpireg.h
 #include dev/acpi/acpivar.h
@@ -231,3 +232,79 @@
 		aprint_error_dev(sc-sc_dev, failed to get data for 
 		event 0x%02X: %s\n, evt, AcpiFormatException(rv));
 }
+
+#ifdef _MODULE
+
+MODULE(MODULE_CLASS_DRIVER, wmidell, NULL);
+CFDRIVER_DECL(wmidell, DV_DULL, NULL);
+
+static int wmidellloc[] = { -1 };
+extern struct cfattach wmidell_ca;
+
+static struct cfparent wmiparent = {
+	acpiwmibus, NULL, DVUNIT_ANY
+};
+
+static struct cfdata wmidell_cfdata[] = {
+	{
+		.cf_name = wmidell,
+		.cf_atname = wmidell,
+		.cf_unit = 0,
+		.cf_fstate = FSTATE_STAR,
+		.cf_loc = wmidellloc,
+		.cf_flags = 0,
+		.cf_pspec = wmiparent,
+	},
+
+	{ NULL }
+};
+
+static int
+wmidell_modcmd(modcmd_t cmd, void *opaque)
+{
+	int err;
+
+	switch (cmd) {
+
+	case MODULE_CMD_INIT:
+
+		err = config_cfdriver_attach(wmidell_cd);
+
+		if (err != 0)
+			return err;
+
+		err = config_cfattach_attach(wmidell, wmidell_ca);
+
+		if (err != 0) {
+			config_cfdriver_detach(wmidell_cd);
+			return err;
+		}
+
+		err = config_cfdata_attach(wmidell_cfdata, 1);
+
+		if (err != 0) {
+			config_cfattach_detach(wmidell, wmidell_ca);
+			config_cfdriver_detach(wmidell_cd);
+			return err;
+		}
+
+		return 0;
+
+	case MODULE_CMD_FINI:
+
+		err = config_cfdata_detach(wmidell_cfdata);
+
+		if (err != 0)
+			return err;
+
+		config_cfattach_detach(wmidell, wmidell_ca);
+		config_cfdriver_detach(wmidell_cd);
+
+		return 0;
+
+	default:
+		return ENOTTY;
+	}
+}
+
+#endif	/* _MODULE */

Index: src/sys/dev/acpi/wmi/wmi_hp.c
diff -u src/sys/dev/acpi/wmi/wmi_hp.c:1.2 src/sys/dev/acpi/wmi/wmi_hp.c:1.3
--- src/sys/dev/acpi/wmi/wmi_hp.c:1.2	Wed Jun 30 07:58:11 2010
+++ src/sys/dev/acpi/wmi/wmi_hp.c	Sun Oct 24 16:25:31 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: wmi_hp.c,v 1.2 2010/06/30 07:58:11 jruoho Exp $ */
+/*	$NetBSD: wmi_hp.c,v 1.3 2010/10/24 16:25:31 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -57,11 +57,12 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wmi_hp.c,v 1.2 2010/06/30 07:58:11 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: wmi_hp.c,v 1.3 2010/10/24 16:25:31 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/device.h
 #include sys/kmem.h
+#include sys/module.h
 
 #include dev/acpi/acpireg.h
 #include dev/acpi/acpivar.h
@@ -529,3 +530,79 @@
 		sc-sc_sensor[WMI_HP_SENSOR_WWAN].state = ENVSYS_SVALID;
 	}
 }
+
+#ifdef _MODULE
+
+MODULE(MODULE_CLASS_DRIVER, wmihp, NULL);
+CFDRIVER_DECL(wmihp, DV_DULL, NULL);
+
+static int wmihploc[] = { -1 };
+extern struct cfattach wmihp_ca;
+
+static struct cfparent wmiparent = {
+	acpiwmibus, NULL, DVUNIT_ANY
+};
+
+static struct cfdata wmihp_cfdata[] = {
+	{
+		.cf_name = wmihp,
+		.cf_atname = wmihp,
+		.cf_unit = 0,
+		.cf_fstate = FSTATE_STAR,
+		.cf_loc = wmihploc,
+		.cf_flags = 0,
+		.cf_pspec = wmiparent,
+	},
+
+	{ NULL }
+};
+
+static int
+wmihp_modcmd(modcmd_t cmd, void *opaque)
+{
+	int err;
+
+	switch (cmd) {
+
+	case MODULE_CMD_INIT:
+
+		err = config_cfdriver_attach(wmihp_cd);
+
+		if (err != 0)
+			return err;
+
+		err = config_cfattach_attach(wmihp, wmihp_ca);
+
+		if (err != 0) {
+			config_cfdriver_detach(wmihp_cd);
+			return err;
+		}
+
+		err = config_cfdata_attach(wmihp_cfdata, 1);
+
+		if (err != 0) {
+			config_cfattach_detach(wmihp, wmihp_ca);
+			config_cfdriver_detach(wmihp_cd);
+			return err;
+		}
+
+		return 0;
+
+	case MODULE_CMD_FINI:
+
+		err = config_cfdata_detach(wmihp_cfdata);
+
+		if (err != 0)
+			return err;
+
+		config_cfattach_detach(wmihp, wmihp_ca);
+		config_cfdriver_detach(wmihp_cd);
+
+		return 0;
+
+	default:
+		return ENOTTY;
+	}
+}
+
+#endif	/* _MODULE */

Index: src/sys/dev/acpi/wmi/wmi_msi.c
diff -u 

CVS commit: src

2010-10-24 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 24 16:31:36 UTC 2010

Modified Files:
src/distrib/sets/lists/modules: md.amd64 md.i386
src/sys/modules: Makefile
Added Files:
src/sys/modules/wmidell: Makefile
src/sys/modules/wmihp: Makefile
src/sys/modules/wmimsi: Makefile

Log Message:
build wmi drivers as modules on x86


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/distrib/sets/lists/modules/md.amd64
cvs rdiff -u -r1.4 -r1.5 src/distrib/sets/lists/modules/md.i386
cvs rdiff -u -r1.49 -r1.50 src/sys/modules/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/wmidell/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/wmihp/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/wmimsi/Makefile

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

Modified files:

Index: src/distrib/sets/lists/modules/md.amd64
diff -u src/distrib/sets/lists/modules/md.amd64:1.3 src/distrib/sets/lists/modules/md.amd64:1.4
--- src/distrib/sets/lists/modules/md.amd64:1.3	Mon May 31 20:32:28 2010
+++ src/distrib/sets/lists/modules/md.amd64	Sun Oct 24 16:31:35 2010
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.3 2010/05/31 20:32:28 pgoyette Exp $
+# $NetBSD: md.amd64,v 1.4 2010/10/24 16:31:35 jmcneill Exp $
 ./@MODULEDIR@/acpiverbose			base-kernel-modules	kmod
 ./@MODULEDIR@/acpiverbose/acpiverbose.kmod	base-kernel-modules	kmod
 ./@MODULEDIR@/azaliabase-kernel-modules	kmod
@@ -21,3 +21,9 @@
 ./@MODULEDIR@/pad/pad.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/tprof_pmibase-kernel-modules	kmod
 ./@MODULEDIR@/tprof_pmi/tprof_pmi.kmod		base-kernel-modules	kmod
+./@MODULEDIR@/wmidellbase-kernel-modules	kmod
+./@MODULEDIR@/wmidell/wmidell.kmod		base-kernel-modules	kmod
+./@MODULEDIR@/wmihpbase-kernel-modules	kmod
+./@MODULEDIR@/wmihp/wmihp.kmod			base-kernel-modules	kmod
+./@MODULEDIR@/wmimsibase-kernel-modules	kmod
+./@MODULEDIR@/wmimsi/wmimsi.kmod		base-kernel-modules	kmod

Index: src/distrib/sets/lists/modules/md.i386
diff -u src/distrib/sets/lists/modules/md.i386:1.4 src/distrib/sets/lists/modules/md.i386:1.5
--- src/distrib/sets/lists/modules/md.i386:1.4	Mon May 31 20:32:28 2010
+++ src/distrib/sets/lists/modules/md.i386	Sun Oct 24 16:31:35 2010
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.4 2010/05/31 20:32:28 pgoyette Exp $
+# $NetBSD: md.i386,v 1.5 2010/10/24 16:31:35 jmcneill Exp $
 ./@MODULEDIR@/acpiverbose			base-kernel-modules	kmod
 ./@MODULEDIR@/acpiverbose/acpiverbose.kmod	base-kernel-modules	kmod
 ./@MODULEDIR@/azaliabase-kernel-modules	kmod
@@ -27,3 +27,9 @@
 ./@MODULEDIR@/tprof_pmi/tprof_pmi.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/viadrmbase-kernel-modules	kmod
 ./@MODULEDIR@/viadrm/viadrm.kmod		base-kernel-modules	kmod
+./@MODULEDIR@/wmidellbase-kernel-modules	kmod
+./@MODULEDIR@/wmidell/wmidell.kmod		base-kernel-modules	kmod
+./@MODULEDIR@/wmihpbase-kernel-modules	kmod
+./@MODULEDIR@/wmihp/wmihp.kmod			base-kernel-modules	kmod
+./@MODULEDIR@/wmimsibase-kernel-modules	kmod
+./@MODULEDIR@/wmimsi/wmimsi.kmod		base-kernel-modules	kmod

Index: src/sys/modules/Makefile
diff -u src/sys/modules/Makefile:1.49 src/sys/modules/Makefile:1.50
--- src/sys/modules/Makefile:1.49	Wed Oct 20 14:50:22 2010
+++ src/sys/modules/Makefile	Sun Oct 24 16:31:35 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.49 2010/10/20 14:50:22 tsutsui Exp $
+#	$NetBSD: Makefile,v 1.50 2010/10/24 16:31:35 jmcneill Exp $
 
 .include bsd.own.mk
 
@@ -95,6 +95,13 @@
 SUBDIR+=	acpiverbose
 .endif
 
+.if ${MACHINE_ARCH} == i386 || \
+${MACHINE_ARCH} == x86_64
+SUBDIR+=	wmidell
+SUBDIR+=	wmihp
+SUBDIR+=	wmimsi
+.endif
+
 .if ${MACHINE_ARCH} == x86_64
 SUBDIR+=	azalia
 SUBDIR+=	compat_linux

Added files:

Index: src/sys/modules/wmidell/Makefile
diff -u /dev/null src/sys/modules/wmidell/Makefile:1.1
--- /dev/null	Sun Oct 24 16:31:36 2010
+++ src/sys/modules/wmidell/Makefile	Sun Oct 24 16:31:36 2010
@@ -0,0 +1,10 @@
+# $NetBSD: Makefile,v 1.1 2010/10/24 16:31:36 jmcneill Exp $
+
+.include ../Makefile.inc
+
+.PATH:	${S}/dev/acpi/wmi
+
+KMOD=   wmidell
+SRCS=	wmi_dell.c
+
+.include bsd.kmodule.mk

Index: src/sys/modules/wmihp/Makefile
diff -u /dev/null src/sys/modules/wmihp/Makefile:1.1
--- /dev/null	Sun Oct 24 16:31:36 2010
+++ src/sys/modules/wmihp/Makefile	Sun Oct 24 16:31:36 2010
@@ -0,0 +1,10 @@
+# $NetBSD: Makefile,v 1.1 2010/10/24 16:31:36 jmcneill Exp $
+
+.include ../Makefile.inc
+
+.PATH:	${S}/dev/acpi/wmi
+
+KMOD=   wmihp
+SRCS=	wmi_hp.c
+
+.include bsd.kmodule.mk

Index: src/sys/modules/wmimsi/Makefile
diff -u /dev/null src/sys/modules/wmimsi/Makefile:1.1
--- /dev/null	Sun Oct 24 16:31:36 2010
+++ src/sys/modules/wmimsi/Makefile	Sun Oct 24 16:31:36 2010
@@ -0,0 +1,10 @@
+# $NetBSD: Makefile,v 1.1 2010/10/24 16:31:36 jmcneill Exp $
+
+.include ../Makefile.inc
+
+.PATH:	${S}/dev/acpi/wmi
+
+KMOD=   wmimsi
+SRCS=	wmi_msi.c
+
+.include bsd.kmodule.mk



CVS commit: src/sys/dev/acpi/wmi

2010-10-24 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 24 18:26:29 UTC 2010

Modified Files:
src/sys/dev/acpi/wmi: wmi_acpi.c

Log Message:
add support for building as a module


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/acpi/wmi/wmi_acpi.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/dev/acpi/wmi/wmi_acpi.c
diff -u src/sys/dev/acpi/wmi/wmi_acpi.c:1.8 src/sys/dev/acpi/wmi/wmi_acpi.c:1.9
--- src/sys/dev/acpi/wmi/wmi_acpi.c:1.8	Sun Oct 24 15:07:20 2010
+++ src/sys/dev/acpi/wmi/wmi_acpi.c	Sun Oct 24 18:26:29 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: wmi_acpi.c,v 1.8 2010/10/24 15:07:20 jmcneill Exp $	*/
+/*	$NetBSD: wmi_acpi.c,v 1.9 2010/10/24 18:26:29 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2009, 2010 Jukka Ruohonen jruoho...@iki.fi
@@ -27,13 +27,14 @@
  * SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wmi_acpi.c,v 1.8 2010/10/24 15:07:20 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: wmi_acpi.c,v 1.9 2010/10/24 18:26:29 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/device.h
 #include sys/endian.h
 #include sys/kmem.h
 #include sys/systm.h
+#include sys/module.h
 
 #include dev/acpi/acpireg.h
 #include dev/acpi/acpivar.h
@@ -726,3 +727,79 @@
 
 	return AcpiEvaluateObject(sc-sc_node-ad_handle, path, arg, obuf);
 }
+
+#ifdef _MODULE
+
+MODULE(MODULE_CLASS_DRIVER, acpiwmi, NULL);
+CFDRIVER_DECL(acpiwmi, DV_DULL, NULL);
+
+static int acpiwmiloc[] = { -1 };
+extern struct cfattach acpiwmi_ca;
+
+static struct cfparent acpiparent = {
+	acpinodebus, NULL, DVUNIT_ANY
+};
+
+static struct cfdata acpiwmi_cfdata[] = {
+	{
+		.cf_name = acpiwmi,
+		.cf_atname = acpiwmi,
+		.cf_unit = 0,
+		.cf_fstate = FSTATE_STAR,
+		.cf_loc = acpiwmiloc,
+		.cf_flags = 0,
+		.cf_pspec = acpiparent,
+	},
+
+	{ NULL }
+};
+
+static int
+acpiwmi_modcmd(modcmd_t cmd, void *opaque)
+{
+	int err;
+
+	switch (cmd) {
+
+	case MODULE_CMD_INIT:
+
+		err = config_cfdriver_attach(acpiwmi_cd);
+
+		if (err != 0)
+			return err;
+
+		err = config_cfattach_attach(acpiwmi, acpiwmi_ca);
+
+		if (err != 0) {
+			config_cfdriver_detach(acpiwmi_cd);
+			return err;
+		}
+
+		err = config_cfdata_attach(acpiwmi_cfdata, 1);
+
+		if (err != 0) {
+			config_cfattach_detach(acpiwmi, acpiwmi_ca);
+			config_cfdriver_detach(acpiwmi_cd);
+			return err;
+		}
+
+		return 0;
+
+	case MODULE_CMD_FINI:
+
+		err = config_cfdata_detach(acpiwmi_cfdata);
+
+		if (err != 0)
+			return err;
+
+		config_cfattach_detach(acpiwmi, acpiwmi_ca);
+		config_cfdriver_detach(acpiwmi_cd);
+
+		return 0;
+
+	default:
+		return ENOTTY;
+	}
+}
+
+#endif	/* _MODULE */



CVS commit: src

2010-10-24 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 24 18:29:34 UTC 2010

Modified Files:
src/distrib/sets/lists/modules: md.amd64 md.i386
src/sys/modules: Makefile
Added Files:
src/sys/modules/acpiwmi: Makefile

Log Message:
build acpiwmi as a module on x86


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/distrib/sets/lists/modules/md.amd64
cvs rdiff -u -r1.5 -r1.6 src/distrib/sets/lists/modules/md.i386
cvs rdiff -u -r1.50 -r1.51 src/sys/modules/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/acpiwmi/Makefile

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

Modified files:

Index: src/distrib/sets/lists/modules/md.amd64
diff -u src/distrib/sets/lists/modules/md.amd64:1.4 src/distrib/sets/lists/modules/md.amd64:1.5
--- src/distrib/sets/lists/modules/md.amd64:1.4	Sun Oct 24 16:31:35 2010
+++ src/distrib/sets/lists/modules/md.amd64	Sun Oct 24 18:29:33 2010
@@ -1,6 +1,8 @@
-# $NetBSD: md.amd64,v 1.4 2010/10/24 16:31:35 jmcneill Exp $
+# $NetBSD: md.amd64,v 1.5 2010/10/24 18:29:33 jmcneill Exp $
 ./@MODULEDIR@/acpiverbose			base-kernel-modules	kmod
 ./@MODULEDIR@/acpiverbose/acpiverbose.kmod	base-kernel-modules	kmod
+./@MODULEDIR@/acpiwmibase-kernel-modules	kmod
+./@MODULEDIR@/acpiwmi/acpiwmi.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/azaliabase-kernel-modules	kmod
 ./@MODULEDIR@/azalia/azalia.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/compat_linux			base-kernel-modules	kmod

Index: src/distrib/sets/lists/modules/md.i386
diff -u src/distrib/sets/lists/modules/md.i386:1.5 src/distrib/sets/lists/modules/md.i386:1.6
--- src/distrib/sets/lists/modules/md.i386:1.5	Sun Oct 24 16:31:35 2010
+++ src/distrib/sets/lists/modules/md.i386	Sun Oct 24 18:29:33 2010
@@ -1,6 +1,8 @@
-# $NetBSD: md.i386,v 1.5 2010/10/24 16:31:35 jmcneill Exp $
+# $NetBSD: md.i386,v 1.6 2010/10/24 18:29:33 jmcneill Exp $
 ./@MODULEDIR@/acpiverbose			base-kernel-modules	kmod
 ./@MODULEDIR@/acpiverbose/acpiverbose.kmod	base-kernel-modules	kmod
+./@MODULEDIR@/acpiwmibase-kernel-modules	kmod
+./@MODULEDIR@/acpiwmi/acpiwmi.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/azaliabase-kernel-modules	kmod
 ./@MODULEDIR@/azalia/azalia.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/compat_freebsd			base-kernel-modules	kmod

Index: src/sys/modules/Makefile
diff -u src/sys/modules/Makefile:1.50 src/sys/modules/Makefile:1.51
--- src/sys/modules/Makefile:1.50	Sun Oct 24 16:31:35 2010
+++ src/sys/modules/Makefile	Sun Oct 24 18:29:33 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.50 2010/10/24 16:31:35 jmcneill Exp $
+#	$NetBSD: Makefile,v 1.51 2010/10/24 18:29:33 jmcneill Exp $
 
 .include bsd.own.mk
 
@@ -97,6 +97,7 @@
 
 .if ${MACHINE_ARCH} == i386 || \
 ${MACHINE_ARCH} == x86_64
+SUBDIR+=	acpiwmi
 SUBDIR+=	wmidell
 SUBDIR+=	wmihp
 SUBDIR+=	wmimsi

Added files:

Index: src/sys/modules/acpiwmi/Makefile
diff -u /dev/null src/sys/modules/acpiwmi/Makefile:1.1
--- /dev/null	Sun Oct 24 18:29:34 2010
+++ src/sys/modules/acpiwmi/Makefile	Sun Oct 24 18:29:33 2010
@@ -0,0 +1,10 @@
+# $NetBSD: Makefile,v 1.1 2010/10/24 18:29:33 jmcneill Exp $
+
+.include ../Makefile.inc
+
+.PATH:	${S}/dev/acpi/wmi
+
+KMOD=   acpiwmi
+SRCS=	wmi_acpi.c
+
+.include bsd.kmodule.mk



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

2009-10-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Oct 20 14:47:33 UTC 2009

Modified Files:
src/sys/arch/i386/stand/lib: vbe.c

Log Message:
trim some fat


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/stand/lib/vbe.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/i386/stand/lib/vbe.c
diff -u src/sys/arch/i386/stand/lib/vbe.c:1.4 src/sys/arch/i386/stand/lib/vbe.c:1.5
--- src/sys/arch/i386/stand/lib/vbe.c:1.4	Mon Sep 14 11:56:27 2009
+++ src/sys/arch/i386/stand/lib/vbe.c	Tue Oct 20 14:47:33 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: vbe.c,v 1.4 2009/09/14 11:56:27 jmcneill Exp $ */
+/* $NetBSD: vbe.c,v 1.5 2009/10/20 14:47:33 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill jmcne...@invisible.ca
@@ -38,25 +38,11 @@
 
 extern const uint8_t rasops_cmap[];
 
-static int vbeverbose = 1;
-
 static struct _vbestate {
 	int		available;
 	int		modenum;
 } vbestate;
 
-static void
-vbe_dump(struct vbeinfoblock *vbe)
-{
-	int mem = (int)vbe-TotalMemory * 64;
-
-	if (!vbeverbose)
-		return;
-
-	printf( VESA VBE Version %d.%d %d k\n,
-	vbe-VbeVersion  8, vbe-VbeVersion  0xff, mem);
-}
-
 static int
 vbe_mode_is_supported(struct modeinfoblock *mi)
 {
@@ -74,6 +60,16 @@
 	return 1;
 }
 
+static bool
+vbe_check(void)
+{
+	if (!vbestate.available) {
+		printf(VBE not available\n);
+		return false;
+	}
+	return true;
+}
+
 void
 vbe_init(void)
 {
@@ -83,14 +79,9 @@
 	memcpy(vbe.VbeSignature, VBE2, 4);
 	if (biosvbe_info(vbe) != 0x004f)
 		return;
-	if (memcmp(vbe.VbeSignature, VESA, 4) != 0) {
-		printf(VESA VBE: bad signature %c%c%c%c\n,
-		vbe.VbeSignature[0], vbe.VbeSignature[1],
-		vbe.VbeSignature[2], vbe.VbeSignature[3]);
+	if (memcmp(vbe.VbeSignature, VESA, 4) != 0)
 		return;
-	}
 
-	vbe_dump(vbe);
 	vbestate.available = 1;
 	vbestate.modenum = 0;
 }
@@ -107,10 +98,8 @@
 	struct paletteentry pe;
 	int ret;
 
-	if (!vbestate.available) {
-		printf(VESA BIOS extensions not available\n);
+	if (!vbe_check())
 		return 1;
-	}
 
 	pe.Blue = cmap[2]  2;
 	pe.Green = cmap[1]  2;
@@ -129,25 +118,23 @@
 	struct btinfo_framebuffer fb;
 	int ret, i;
 
-	if (!vbestate.available) {
-		printf(VESA BIOS extensions not available\n);
+	if (!vbe_check())
 		return 1;
-	}
 
 	ret = biosvbe_get_mode_info(modenum, mi);
 	if (ret != 0x004f) {
-		printf(VESA VBE mode 0x%x is invalid.\n, modenum);
+		printf(mode 0x%x invalid\n, modenum);
 		return 1;
 	}
 
 	if (!vbe_mode_is_supported(mi)) {
-		printf(VESA VBE mode 0x%x is not supported.\n, modenum);
+		printf(mode 0x%x not supported\n, modenum);
 		return 1;
 	}
 
 	ret = biosvbe_set_mode(modenum);
 	if (ret != 0x004f) {
-		printf(VESA VBE mode 0x%x could not be set.\n, modenum);
+		printf(mode 0x%x could not be set\n, modenum);
 		return 1;
 	}
 
@@ -183,7 +170,7 @@
 	if (vbestate.modenum  0) {
 		ret = vbe_set_mode(vbestate.modenum);
 		if (ret) {
-			printf(WARNING: failed to set VESA VBE mode 0x%x\n,
+			printf(WARNING: failed to set VBE mode 0x%x\n,
 			vbestate.modenum);
 			delay(500);
 		}
@@ -266,7 +253,6 @@
 			return mode;
 	}
 
-	printf(VESA VBE BIOS does not support %s\n, str);
 	return 0;
 }
 
@@ -286,10 +272,8 @@
 	uint16_t mode;
 	int nmodes = 0, safety = 0;
 
-	if (!vbestate.available) {
-		printf(VESA BIOS extensions not available\n);
+	if (!vbe_check())
 		return;
-	}
 
 	printf(Modes: );
 	memset(vbe, 0, sizeof(vbe));
@@ -306,7 +290,7 @@
 		safety++;
 		farptr += 2;
 		if (safety == 100) {
-			printf([garbage] );
+			printf([?] );
 			break;
 		}
 		if (biosvbe_get_mode_info(mode, mi) != 0x004f)
@@ -335,10 +319,8 @@
 	char arg[20];
 	int modenum;
 
-	if (!vbe_available()) {
-		printf(VESA VBE not available\n);
+	if (!vbe_check())
 		return;
-	}
 
 	strlcpy(arg, cmd, sizeof(arg));
 
@@ -370,6 +352,6 @@
 		return;
 	}
 
-	printf(invalid flag, must be 'enabled', 'disabled', 
-	a display mode, or a valid VESA VBE mode number.\n);
+	printf(invalid flag, must be 'on', 'off', 
+	a display mode, or a VBE mode number\n);
 }



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

2009-10-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Oct 20 14:49:03 UTC 2009

Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c

Log Message:
trim some fat, don't scan disklabels on non-HD disks


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/i386/stand/lib/biosdisk.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/i386/stand/lib/biosdisk.c
diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.29 src/sys/arch/i386/stand/lib/biosdisk.c:1.30
--- src/sys/arch/i386/stand/lib/biosdisk.c:1.29	Sun Sep 13 22:45:27 2009
+++ src/sys/arch/i386/stand/lib/biosdisk.c	Tue Oct 20 14:49:03 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosdisk.c,v 1.29 2009/09/13 22:45:27 jmcneill Exp $	*/
+/*	$NetBSD: biosdisk.c,v 1.30 2009/10/20 14:49:03 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998
@@ -319,17 +319,17 @@
 			d.ll.dev = 0x80 + i;			/* hd/cd */
 		if (set_geometry(d.ll, ed))
 			continue;
+		printf(disk );
 		switch (d.ll.type) {
 		case BIOSDISK_TYPE_CD:
-			printf(disk cd0\n);
-			printf(  cd0a(unknown)\n);
+			printf(cd0\n  cd0a\n);
 			break;
 		case BIOSDISK_TYPE_FD:
-			printf(disk fd%d\n, d.ll.dev  0x7f);
-			printf(  fd%da(unknown)\n, d.ll.dev  0x7f);
+			printf(fd%d\n, d.ll.dev  0x7f);
+			printf(  fd%da\n, d.ll.dev  0x7f);
 			break;
 		case BIOSDISK_TYPE_HD:
-			printf(disk hd%d, d.ll.dev  0x7f);
+			printf(hd%d, d.ll.dev  0x7f);
 			if (d.ll.flags  BIOSDISK_INT13EXT) {
 printf( size );
 size = ed.totsec * ed.sbytes;
@@ -344,6 +344,8 @@
 			break;
 		}
 #ifndef NO_DISKLABEL
+		if (d.ll.type != BIOSDISK_TYPE_HD)
+			continue;
 		if (read_label(d) == -1)
 			break;
 		lp = (struct disklabel *)(d.buf + LABELOFFSET);



CVS commit: src/sys/arch/arm/arm32

2013-11-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov  9 17:28:58 UTC 2013

Modified Files:
src/sys/arch/arm/arm32: genassym.cf

Log Message:
wrap opt_* includes with if defined(_KERNEL_OPT)


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/arm/arm32/genassym.cf

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/arm/arm32/genassym.cf
diff -u src/sys/arch/arm/arm32/genassym.cf:1.65 src/sys/arch/arm/arm32/genassym.cf:1.66
--- src/sys/arch/arm/arm32/genassym.cf:1.65	Sun Aug 18 07:55:28 2013
+++ src/sys/arch/arm/arm32/genassym.cf	Sat Nov  9 17:28:58 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.65 2013/08/18 07:55:28 matt Exp $
+#	$NetBSD: genassym.cf,v 1.66 2013/11/09 17:28:58 jmcneill Exp $
 
 # Copyright (c) 1982, 1990 The Regents of the University of California.
 # All rights reserved.
@@ -54,9 +54,11 @@ include machine/pmap.h
 include machine/pcb.h
 include machine/vmparam.h
 
+if defined(_KERNEL_OPT)
 include opt_multiprocessor.h
 include opt_compat_netbsd.h
 include opt_execfmt.h
+endif
 
 define	__PROG32		1
 ifdef __ARM_FIQ_INDIRECT



CVS commit: src/sys/modules

2013-11-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov  9 17:30:46 UTC 2013

Modified Files:
src/sys/modules: Makefile.assym

Log Message:
set GENASSYM_DIR for arm and earm


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/modules/Makefile.assym

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

Modified files:

Index: src/sys/modules/Makefile.assym
diff -u src/sys/modules/Makefile.assym:1.2 src/sys/modules/Makefile.assym:1.3
--- src/sys/modules/Makefile.assym:1.2	Sun Mar 25 06:55:20 2012
+++ src/sys/modules/Makefile.assym	Sat Nov  9 17:30:46 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.assym,v 1.2 2012/03/25 06:55:20 joerg Exp $
+#	$NetBSD: Makefile.assym,v 1.3 2013/11/09 17:30:46 jmcneill Exp $
 
 DPSRCS+=	assym.h
 CLEANFILES+=	assym.h
@@ -11,6 +11,10 @@ CPPFLAGS+=	-DPPC_OEA
 .endif
 .endif
 
+.if (!empty(MACHINE_ARCH:Mearm*) || !empty(MACHINE_ARCH:Marm*))
+GENASSYM_DIR= $S/arch/arm/arm32
+.endif
+
 .if exists($S/arch/${MACHINE}/${MACHINE}/genassym.cf)
 GENASSYM_DIR?= $S/arch/${MACHINE}/${MACHINE}
 .elif exists($S/arch/${MACHINE_CPU}/${MACHINE_CPU}/genassym.cf)



CVS commit: src/share/mk

2013-11-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov  9 22:40:15 UTC 2013

Modified Files:
src/share/mk: bsd.kmodule.mk

Log Message:
use -fno-unwind-tables when building arm modules


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/share/mk/bsd.kmodule.mk

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

Modified files:

Index: src/share/mk/bsd.kmodule.mk
diff -u src/share/mk/bsd.kmodule.mk:1.40 src/share/mk/bsd.kmodule.mk:1.41
--- src/share/mk/bsd.kmodule.mk:1.40	Wed Sep 18 09:25:20 2013
+++ src/share/mk/bsd.kmodule.mk	Sat Nov  9 22:40:15 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.kmodule.mk,v 1.40 2013/09/18 09:25:20 martin Exp $
+#	$NetBSD: bsd.kmodule.mk,v 1.41 2013/11/09 22:40:15 jmcneill Exp $
 
 # We are not building this with PIE
 MKPIE=no
@@ -27,7 +27,7 @@ CFLAGS+=	-fno-strict-aliasing -Wno-point
 # relocations inside the loader and removing this workaround, as the
 # resulting code would be much faster.
 .if ${MACHINE_CPU} == arm
-CFLAGS+=	-fno-common
+CFLAGS+=	-fno-common -fno-unwind-tables
 .elif ${MACHINE_CPU} == hppa
 CFLAGS+=	-mlong-calls
 .elif ${MACHINE_CPU} == powerpc



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

2013-11-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Nov 10 19:49:49 UTC 2013

Modified Files:
src/sys/arch/usermode/conf: Makefile.usermode

Log Message:
use MACHINE_CPU instead of uname -p; create symlink for arm headers


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/usermode/conf/Makefile.usermode

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/usermode/conf/Makefile.usermode
diff -u src/sys/arch/usermode/conf/Makefile.usermode:1.33 src/sys/arch/usermode/conf/Makefile.usermode:1.34
--- src/sys/arch/usermode/conf/Makefile.usermode:1.33	Wed Mar  6 11:36:21 2013
+++ src/sys/arch/usermode/conf/Makefile.usermode	Sun Nov 10 19:49:49 2013
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.usermode,v 1.33 2013/03/06 11:36:21 yamt Exp $
+# $NetBSD: Makefile.usermode,v 1.34 2013/11/10 19:49:49 jmcneill Exp $
 
 USETOOLS?=			no
 NEED_OWN_INSTALL_TARGET?=	no
@@ -59,8 +59,8 @@ MD_OBJS=	thunk.o
 MD_CFILES=	${USERMODE}/usermode/thunk.c
 MD_SFILES=
 
-MD_OBJS+=	cpu_${MACHINE_ARCH}.o
-MD_CFILES+=	${USERMODE}/target/${MACHINE_ARCH}/cpu_${MACHINE_ARCH}.c
+MD_OBJS+=	cpu_${MACHINE_CPU}.o
+MD_CFILES+=	${USERMODE}/target/${MACHINE_CPU}/cpu_${MACHINE_CPU}.c
 
 ##
 ## (5) link settings
@@ -88,6 +88,8 @@ NVFLAGS=	-n
 		ln -s $S/arch/i386/include i386
 	@rm -f amd64  \
 		ln -s $S/arch/amd64/include amd64
+	@rm -f arm  \
+		ln -s $S/arch/arm/include arm
 .endif
 
 thunk.d: ${USERMODE}/usermode/thunk.c
@@ -97,7 +99,7 @@ thunk.d: ${USERMODE}/usermode/thunk.c
 thunk.o: ${USERMODE}/usermode/thunk.c
 	${CC} ${COPTS} ${CPPFLAGS.thunk.c} -c -o $@ ${USERMODE}/usermode/thunk.c
 
-cpu_${MACHINE_ARCH}.o:	${USERMODE}/target/${MACHINE_ARCH}/cpu_${MACHINE_ARCH}.c
+cpu_${MACHINE_CPU}.o:	${USERMODE}/target/${MACHINE_CPU}/cpu_${MACHINE_CPU}.c
 
 ##
 ## (7) misc settings



CVS commit: src/sys/arch/usermode/usermode

2013-11-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Nov 10 19:51:00 UTC 2013

Modified Files:
src/sys/arch/usermode/usermode: thunk.c

Log Message:
define _KMEMUSER before including machine/vmparam.h


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/usermode/usermode/thunk.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/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.83 src/sys/arch/usermode/usermode/thunk.c:1.84
--- src/sys/arch/usermode/usermode/thunk.c:1.83	Wed May 22 13:34:31 2013
+++ src/sys/arch/usermode/usermode/thunk.c	Sun Nov 10 19:51:00 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.83 2013/05/22 13:34:31 reinoud Exp $ */
+/* $NetBSD: thunk.c,v 1.84 2013/11/10 19:51:00 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 #ifdef __NetBSD__
-__RCSID($NetBSD: thunk.c,v 1.83 2013/05/22 13:34:31 reinoud Exp $);
+__RCSID($NetBSD: thunk.c,v 1.84 2013/11/10 19:51:00 jmcneill Exp $);
 #endif
 
 #include sys/types.h
@@ -41,6 +41,8 @@ __RCSID($NetBSD: thunk.c,v 1.83 2013/05
 #include sys/audioio.h
 #include sys/shm.h
 #include sys/ioctl.h
+
+#define _KMEMUSER
 #include machine/vmparam.h
 
 #include net/if.h



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

2013-11-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Nov 10 19:52:01 UTC 2013

Modified Files:
src/sys/arch/usermode/include: ansi.h asm.h bswap.h byte_swap.h cdefs.h
disklabel.h elf_machdep.h endian.h endian_machdep.h genheaders.sh
int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h
limits.h netbsd32_machdep.h param.h psl.h ptrace.h vmparam.h
wchar_limits.h

Log Message:
support building on arm


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/usermode/include/ansi.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/usermode/include/asm.h \
src/sys/arch/usermode/include/bswap.h \
src/sys/arch/usermode/include/byte_swap.h \
src/sys/arch/usermode/include/elf_machdep.h \
src/sys/arch/usermode/include/endian.h \
src/sys/arch/usermode/include/endian_machdep.h \
src/sys/arch/usermode/include/int_const.h \
src/sys/arch/usermode/include/int_fmtio.h \
src/sys/arch/usermode/include/int_limits.h \
src/sys/arch/usermode/include/int_mwgwtypes.h \
src/sys/arch/usermode/include/int_types.h \
src/sys/arch/usermode/include/limits.h \
src/sys/arch/usermode/include/netbsd32_machdep.h \
src/sys/arch/usermode/include/wchar_limits.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/usermode/include/cdefs.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/usermode/include/disklabel.h \
src/sys/arch/usermode/include/ptrace.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/usermode/include/genheaders.sh
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/usermode/include/param.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/include/psl.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/usermode/include/vmparam.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/usermode/include/ansi.h
diff -u src/sys/arch/usermode/include/ansi.h:1.3 src/sys/arch/usermode/include/ansi.h:1.4
--- src/sys/arch/usermode/include/ansi.h:1.3	Mon Aug 22 21:45:38 2011
+++ src/sys/arch/usermode/include/ansi.h	Sun Nov 10 19:52:01 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: ansi.h,v 1.3 2011/08/22 21:45:38 jmcneill Exp $ */
+/* $NetBSD: ansi.h,v 1.4 2013/11/10 19:52:01 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -50,6 +50,11 @@
 #define _BSD_PTRDIFF_T_		long
 #define _BSD_SIZE_T_		unsigned long
 #define _BSD_SSIZE_T_		long
+#elif defined(__arm__)
+#define _BSD_CLOCK_T_		unsigned int
+#define _BSD_PTRDIFF_T_		long int
+#define _BSD_SIZE_T_		unsigned long int
+#define _BSD_SSIZE_T_		long int
 #else
 #error platform not supported
 #endif

Index: src/sys/arch/usermode/include/asm.h
diff -u src/sys/arch/usermode/include/asm.h:1.10 src/sys/arch/usermode/include/asm.h:1.11
--- src/sys/arch/usermode/include/asm.h:1.10	Sun Feb  5 17:40:08 2012
+++ src/sys/arch/usermode/include/asm.h	Sun Nov 10 19:52:01 2013
@@ -1,7 +1,7 @@
-/* $NetBSD: asm.h,v 1.10 2012/02/05 17:40:08 reinoud Exp $ */
+/* $NetBSD: asm.h,v 1.11 2013/11/10 19:52:01 jmcneill Exp $ */
 
 /*
- * Automatically generated by genheaders.sh on Sun Feb  5 18:39:33 CET 2012
+ * Automatically generated by genheaders.sh on Sun Nov 10 15:47:57 AST 2013
  * Do not modify directly!
  */
 #ifndef _USERMODE_ASM_H
@@ -11,6 +11,8 @@
 #include ../../i386/include/asm.h
 #elif defined(__x86_64__)
 #include ../../amd64/include/asm.h
+#elif defined(__arm__)
+#include ../../arm/include/asm.h
 #else
 #error port me
 #endif
Index: src/sys/arch/usermode/include/bswap.h
diff -u src/sys/arch/usermode/include/bswap.h:1.10 src/sys/arch/usermode/include/bswap.h:1.11
--- src/sys/arch/usermode/include/bswap.h:1.10	Sun Feb  5 17:40:08 2012
+++ src/sys/arch/usermode/include/bswap.h	Sun Nov 10 19:52:01 2013
@@ -1,7 +1,7 @@
-/* $NetBSD: bswap.h,v 1.10 2012/02/05 17:40:08 reinoud Exp $ */
+/* $NetBSD: bswap.h,v 1.11 2013/11/10 19:52:01 jmcneill Exp $ */
 
 /*
- * Automatically generated by genheaders.sh on Sun Feb  5 18:39:34 CET 2012
+ * Automatically generated by genheaders.sh on Sun Nov 10 15:47:57 AST 2013
  * Do not modify directly!
  */
 #ifndef _USERMODE_BSWAP_H
@@ -11,6 +11,8 @@
 #include ../../i386/include/bswap.h
 #elif defined(__x86_64__)
 #include ../../amd64/include/bswap.h
+#elif defined(__arm__)
+#include ../../arm/include/bswap.h
 #else
 #error port me
 #endif
Index: src/sys/arch/usermode/include/byte_swap.h
diff -u src/sys/arch/usermode/include/byte_swap.h:1.10 src/sys/arch/usermode/include/byte_swap.h:1.11
--- src/sys/arch/usermode/include/byte_swap.h:1.10	Sun Feb  5 17:40:08 2012
+++ src/sys/arch/usermode/include/byte_swap.h	Sun Nov 10 19:52:01 2013
@@ -1,7 +1,7 @@
-/* $NetBSD: byte_swap.h,v 1.10 2012/02/05 17:40:08 reinoud Exp $ */
+/* $NetBSD: byte_swap.h,v 1.11 2013/11/10 19:52:01 jmcneill Exp $ */
 
 /*
- * Automatically generated by genheaders.sh on Sun Feb  5 18:39:34 CET 2012
+ * Automatically generated by genheaders.sh on Sun Nov 10 15:47:57 AST 2013
  * Do not modify directly

CVS commit: src/sys/arch/usermode/modules/syscallemu

2013-11-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Nov 10 19:58:38 UTC 2013

Modified Files:
src/sys/arch/usermode/modules/syscallemu: Makefile
Added Files:
src/sys/arch/usermode/modules/syscallemu: syscallemu_arm.c

Log Message:
arm support for syscallemu, not tested


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/usermode/modules/syscallemu/Makefile
cvs rdiff -u -r0 -r1.1 \
src/sys/arch/usermode/modules/syscallemu/syscallemu_arm.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/usermode/modules/syscallemu/Makefile
diff -u src/sys/arch/usermode/modules/syscallemu/Makefile:1.3 src/sys/arch/usermode/modules/syscallemu/Makefile:1.4
--- src/sys/arch/usermode/modules/syscallemu/Makefile:1.3	Tue Jul  3 21:07:41 2012
+++ src/sys/arch/usermode/modules/syscallemu/Makefile	Sun Nov 10 19:58:38 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.3 2012/07/03 21:07:41 christos Exp $
+#	$NetBSD: Makefile,v 1.4 2013/11/10 19:58:38 jmcneill Exp $
 
 .include bsd.own.mk
 
@@ -13,6 +13,8 @@ KMOD=	syscallemu
 SRCS=	syscallemu.c
 .if ${MACHINE_ARCH} == i386 || ${MACHINE_ARCH} == x86_64
 SRCS+=	syscallemu_x86.c
+.elif ${MACHINE_ARCH} == arm || ${MACHINE_ARCH} == earm
+SRCS+=	syscallemu_arm.c
 .else
 .error ${MACHINE_ARCH} not implemented
 .endif

Added files:

Index: src/sys/arch/usermode/modules/syscallemu/syscallemu_arm.c
diff -u /dev/null src/sys/arch/usermode/modules/syscallemu/syscallemu_arm.c:1.1
--- /dev/null	Sun Nov 10 19:58:38 2013
+++ src/sys/arch/usermode/modules/syscallemu/syscallemu_arm.c	Sun Nov 10 19:58:38 2013
@@ -0,0 +1,107 @@
+/* $NetBSD: syscallemu_arm.c,v 1.1 2013/11/10 19:58:38 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
+ * Copyright (c) 2012-2013 Jared D. McNeill jmcne...@invisible.ca
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__KERNEL_RCSID(0, $NetBSD: syscallemu_arm.c,v 1.1 2013/11/10 19:58:38 jmcneill Exp $);
+
+#include sys/param.h
+#include sys/proc.h
+#include sys/systm.h
+
+#include arch/arm/include/locore.h
+
+#include syscallemu.h
+
+#define ARM_TF_PC(frame)	((frame)-tf_pc)
+
+/*
+ * If syscallemu specific data is present for the process, verify that the
+ * caller is allowed to execute system calls. If not, deliver a SIGILL to
+ * the process. When syscallemu specific data is not present, simply defer
+ * to the original syscall handler.
+ */
+static void
+arm_syscall_emu(struct trapframe *frame, struct lwp *l, uint32_t insn)
+{
+	void (*md_syscall)(struct trapframe *, struct lwp *, uint32_t) = NULL;
+	struct syscallemu_data *sce;
+	register_t pc_call;
+	struct proc *p;
+	ksiginfo_t ksi;
+
+	p = l-l_proc;
+
+	pc_call = ARM_TF_PC(frame) - INSN_SIZE;
+
+	/* Determine if we need to emulate the system call */
+	sce = syscallemu_getsce(p);
+	if (sce) {
+		if ((pc_call = sce-sce_user_start 
+		 pc_call  sce-sce_user_end) ||
+		(pc_call + INSN_SIZE = sce-sce_user_start 
+		 pc_call + INSN_SIZE  sce-sce_user_end)) {
+			md_syscall = NULL;
+		} else {
+			md_syscall = sce-sce_md_syscall;
+		}
+	} else {
+		md_syscall = p-p_md.md_syscall;
+	}
+
+	if (md_syscall == NULL) {
+		/* If emulating, deliver SIGILL to process */
+		ARM_TF_PC(frame) = pc_call;
+		KSI_INIT_TRAP(ksi);
+		ksi.ksi_signo = SIGILL;
+		ksi.ksi_code = ILL_ILLTRP;
+		ksi.ksi_addr = (void *)ARM_TF_PC(frame);
+		ksi.ksi_trap = 0;
+		trapsignal(l, ksi);
+		userret(l);
+	} else {
+		/* Not emulating, so treat as a normal syscall */
+		KASSERT(md_syscall != NULL);
+		md_syscall(frame, l, insn);
+	}
+}
+
+/*
+ * Set

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

2013-11-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Nov 10 20:01:55 UTC 2013

Added Files:
src/sys/arch/evbarm/conf: GENERIC_USERMODE

Log Message:
add usermode kernel config


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/conf/GENERIC_USERMODE

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

Added files:

Index: src/sys/arch/evbarm/conf/GENERIC_USERMODE
diff -u /dev/null src/sys/arch/evbarm/conf/GENERIC_USERMODE:1.1
--- /dev/null	Sun Nov 10 20:01:55 2013
+++ src/sys/arch/evbarm/conf/GENERIC_USERMODE	Sun Nov 10 20:01:55 2013
@@ -0,0 +1,17 @@
+# $NetBSD: GENERIC_USERMODE,v 1.1 2013/11/10 20:01:55 jmcneill Exp $
+
+machine usermode
+include arch/usermode/conf/GENERIC.common
+include arch/arm/conf/majors.arm32
+
+no options EXEC_ELF64
+
+options 	INSECURE		# required by sysinst
+
+options		TEXTADDR=0x2000	# 1 Gb `phys ram' / total space
+options		KVMSIZE= 0x1000	# KVM space reserved in VM map, 256 Mb
+options		NKMEMPAGES_MAX=32768	# 128 Mb max
+
+#options 	INCLUDE_CONFIG_FILE
+#ident 		GENERIC_USERMODE-$Revision: 1.1 $
+



CVS commit: src/sys/arch/usermode/target/arm

2013-11-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Nov 10 20:03:46 UTC 2013

Added Files:
src/sys/arch/usermode/target/arm: cpu_arm.c

Log Message:
usermode arm md stub


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/usermode/target/arm/cpu_arm.c

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

Added files:

Index: src/sys/arch/usermode/target/arm/cpu_arm.c
diff -u /dev/null src/sys/arch/usermode/target/arm/cpu_arm.c:1.1
--- /dev/null	Sun Nov 10 20:03:46 2013
+++ src/sys/arch/usermode/target/arm/cpu_arm.c	Sun Nov 10 20:03:46 2013
@@ -0,0 +1,137 @@
+/* $NetBSD: cpu_arm.c,v 1.1 2013/11/10 20:03:46 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
+ * Copyright (c) 2007, 2013 Jared D. McNeill jmcne...@invisible.ca
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Note that this machdep.c uses the `dummy' mcontext_t defined for usermode.
+ * This is basicly a blob of PAGE_SIZE big. We might want to switch over to
+ * non-generic mcontext_t's one day, but will this break non-NetBSD hosts?
+ */
+
+#include sys/cdefs.h
+__KERNEL_RCSID(0, $NetBSD: cpu_arm.c,v 1.1 2013/11/10 20:03:46 jmcneill Exp $);
+
+#include sys/types.h
+#include sys/systm.h
+#include sys/param.h
+#include sys/time.h
+#include sys/exec.h
+#include sys/buf.h
+#include sys/boot_flag.h
+#include sys/ucontext.h
+#include sys/utsname.h
+#include machine/pcb.h
+#include machine/psl.h
+
+#include uvm/uvm_extern.h
+#include uvm/uvm_page.h
+
+#include dev/mm.h
+#include machine/machdep.h
+#include machine/thunk.h
+
+#include opt_exec.h
+
+/* from sys/arch/arm/include/frame.h : KEEP IN SYNC */
+struct sigframe_siginfo {
+	siginfo_t	sf_si;		/* actual saved siginfo */
+	ucontext_t	sf_uc;		/* actual saved ucontext */
+};
+
+void
+sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
+{
+	panic(sendsig_siginfo not implemented);
+}
+
+void
+setregs(struct lwp *l, struct exec_package *pack, vaddr_t stack)
+{
+	panic(sendsig_siginfo not implemented);
+}
+
+void
+md_syscall_get_syscallnumber(ucontext_t *ucp, uint32_t *code)
+{
+	panic(md_syscall_get_syscallnumber not implemented);
+}
+
+int
+md_syscall_getargs(lwp_t *l, ucontext_t *ucp, int nargs, int argsize,
+	register_t *args)
+{
+	panic(md_syscall_getargs not implemented);
+	return 0;
+}
+
+void
+md_syscall_set_returnargs(lwp_t *l, ucontext_t *ucp,
+	int error, register_t *rval)
+{
+	panic(md_syscall_set_returnargs not implemented);
+}
+
+register_t
+md_get_pc(ucontext_t *ucp)
+{
+	panic(md_get_pc not implemented);
+	return 0;
+}
+
+register_t
+md_get_sp(ucontext_t *ucp)
+{
+	panic(md_get_sp not implemented);
+	return 0;
+}
+
+int
+md_syscall_check_opcode(ucontext_t *ucp)
+{
+	panic(md_syscall_check_opcode not implemented);
+	return 0;
+}
+
+void
+md_syscall_get_opcode(ucontext_t *ucp, uint32_t *opcode)
+{
+	panic(md_syscall_get_opcode not implemented);
+}
+
+void
+md_syscall_inc_pc(ucontext_t *ucp, uint32_t opcode)
+{
+	panic(md_syscall_inc_pc not implemented);
+}
+
+void
+md_syscall_dec_pc(ucontext_t *ucp, uint32_t opcode)
+{
+	panic(md_syscall_dec_pc not implemented);
+}
+



CVS commit: src/sys/arch/usermode/modules/syscallemu

2013-11-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Nov 10 22:08:58 UTC 2013

Modified Files:
src/sys/arch/usermode/modules/syscallemu: Makefile

Log Message:
use MACHINE_CPU instead of MACHINE_ARCH


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/usermode/modules/syscallemu/Makefile

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/usermode/modules/syscallemu/Makefile
diff -u src/sys/arch/usermode/modules/syscallemu/Makefile:1.4 src/sys/arch/usermode/modules/syscallemu/Makefile:1.5
--- src/sys/arch/usermode/modules/syscallemu/Makefile:1.4	Sun Nov 10 19:58:38 2013
+++ src/sys/arch/usermode/modules/syscallemu/Makefile	Sun Nov 10 22:08:58 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2013/11/10 19:58:38 jmcneill Exp $
+#	$NetBSD: Makefile,v 1.5 2013/11/10 22:08:58 jmcneill Exp $
 
 .include bsd.own.mk
 
@@ -11,12 +11,12 @@ M?=	${S}/modules
 KMOD=	syscallemu
 
 SRCS=	syscallemu.c
-.if ${MACHINE_ARCH} == i386 || ${MACHINE_ARCH} == x86_64
+.if ${MACHINE_CPU} == i386 || ${MACHINE_CPU} == x86_64
 SRCS+=	syscallemu_x86.c
-.elif ${MACHINE_ARCH} == arm || ${MACHINE_ARCH} == earm
+.elif ${MACHINE_CPU} == arm
 SRCS+=	syscallemu_arm.c
 .else
-.error ${MACHINE_ARCH} not implemented
+.error ${MACHINE_CPU} not implemented
 .endif
 
 .include bsd.kmodule.mk



CVS commit: src/sys/arch/usermode/target/arm

2013-11-11 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Nov 11 13:52:04 UTC 2013

Modified Files:
src/sys/arch/usermode/target/arm: cpu_arm.c

Log Message:
implement md_get_pc and md_set_pc


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/target/arm/cpu_arm.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/usermode/target/arm/cpu_arm.c
diff -u src/sys/arch/usermode/target/arm/cpu_arm.c:1.1 src/sys/arch/usermode/target/arm/cpu_arm.c:1.2
--- src/sys/arch/usermode/target/arm/cpu_arm.c:1.1	Sun Nov 10 20:03:46 2013
+++ src/sys/arch/usermode/target/arm/cpu_arm.c	Mon Nov 11 13:52:04 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_arm.c,v 1.1 2013/11/10 20:03:46 jmcneill Exp $ */
+/* $NetBSD: cpu_arm.c,v 1.2 2013/11/11 13:52:04 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu_arm.c,v 1.1 2013/11/10 20:03:46 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu_arm.c,v 1.2 2013/11/11 13:52:04 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/systm.h
@@ -99,15 +99,15 @@ md_syscall_set_returnargs(lwp_t *l, ucon
 register_t
 md_get_pc(ucontext_t *ucp)
 {
-	panic(md_get_pc not implemented);
-	return 0;
+	unsigned int *reg = (unsigned int *)ucp-uc_mcontext;
+	return reg[15];
 }
 
 register_t
 md_get_sp(ucontext_t *ucp)
 {
-	panic(md_get_sp not implemented);
-	return 0;
+	unsigned int *reg = (unsigned int *)ucp-uc_mcontext;
+	return reg[13];
 }
 
 int



CVS commit: src/sys/kern

2011-08-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug  2 21:23:25 UTC 2011

Modified Files:
src/sys/kern: subr_autoconf.c

Log Message:
Re-add include of drvctl.h, as its removal a year and a half ago broke
drvctl DRVGETEVENT.


To generate a diff of this commit:
cvs rdiff -u -r1.216 -r1.217 src/sys/kern/subr_autoconf.c

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

Modified files:

Index: src/sys/kern/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.216 src/sys/kern/subr_autoconf.c:1.217
--- src/sys/kern/subr_autoconf.c:1.216	Wed Jun  1 02:43:33 2011
+++ src/sys/kern/subr_autoconf.c	Tue Aug  2 21:23:24 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.216 2011/06/01 02:43:33 christos Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.217 2011/08/02 21:23:24 jmcneill Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,10 +77,11 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_autoconf.c,v 1.216 2011/06/01 02:43:33 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_autoconf.c,v 1.217 2011/08/02 21:23:24 jmcneill Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_ddb.h
+#include drvctl.h
 #endif
 
 #include sys/param.h



CVS commit: othersrc/external/bsd/udevfsd

2011-08-02 Thread Jared D. McNeill
Module Name:othersrc
Committed By:   jmcneill
Date:   Tue Aug  2 23:19:26 UTC 2011

Update of /cvsroot/othersrc/external/bsd/udevfsd
In directory ivanova.netbsd.org:/tmp/cvs-serv8300

Log Message:
Initial import of udevfsd, a simple daemon that listens for drvctl events
and processes them with hooks scripts. A hook is included that creates /dev
entries if they do not already exist (requires a patched MAKEDEV).

Status:

Vendor Tag: JMCNEILL
Release Tags:   udevfsd-base

N othersrc/external/bsd/udevfsd/Makefile
N othersrc/external/bsd/udevfsd/udevfsd.c
N othersrc/external/bsd/udevfsd/udevfsd-run-hooks.in
N othersrc/external/bsd/udevfsd/hooks/01-makedev

No conflicts created by this import



CVS commit: othersrc/external/bsd/udevfsd

2011-08-02 Thread Jared D. McNeill
Module Name:othersrc
Committed By:   jmcneill
Date:   Wed Aug  3 00:06:00 UTC 2011

Modified Files:
othersrc/external/bsd/udevfsd: udevfsd.c

Log Message:
Scan already attached devices at startup and post 'device-attach' events for
them to the hooks scripts.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/udevfsd/udevfsd.c

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

Modified files:

Index: othersrc/external/bsd/udevfsd/udevfsd.c
diff -u othersrc/external/bsd/udevfsd/udevfsd.c:1.1.1.1 othersrc/external/bsd/udevfsd/udevfsd.c:1.2
--- othersrc/external/bsd/udevfsd/udevfsd.c:1.1.1.1	Tue Aug  2 23:19:26 2011
+++ othersrc/external/bsd/udevfsd/udevfsd.c	Wed Aug  3 00:06:00 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: udevfsd.c,v 1.1.1.1 2011/08/02 23:19:26 jmcneill Exp $ */
+/* $NetBSD: udevfsd.c,v 1.2 2011/08/03 00:06:00 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -35,7 +35,7 @@
 #include sys/cdefs.h
 __COPYRIGHT(@(#) Copyright (c) 2011\
 Jared D. McNeill jmcne...@invisible.ca. All rights reserved.);
-__RCSID($NetBSD: udevfsd.c,v 1.1.1.1 2011/08/02 23:19:26 jmcneill Exp $);
+__RCSID($NetBSD: udevfsd.c,v 1.2 2011/08/03 00:06:00 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/ioctl.h
@@ -56,6 +56,9 @@
 static int drvctl_fd = -1;
 static const char *udevfsd_script = UDEVFSD_RUN_HOOKS;
 
+#define	UDEVFSD_ATTACH_EVENT	device-attach
+#define	UDEVFSD_DETACH_EVENT	device-detach
+
 static void
 udevfsd_exec(const char *path, const char *event, const char *device)
 {
@@ -129,6 +132,69 @@
 }
 
 static void
+udevfsd_probe(const char *device)
+{
+	struct devlistargs laa;
+	size_t len, children, n;
+	void *p;
+	int error;
+
+	assert(drvctl_fd != -1);
+
+	memset(laa, 0, sizeof(laa));
+	if (device)
+		strlcpy(laa.l_devname, device, sizeof(laa.l_devname));
+
+	/* Get the child device count for this device */
+	error = ioctl(drvctl_fd, DRVLISTDEV, laa);
+	if (error) {
+		syslog(LOG_ERR, DRVLISTDEV failed: %m);
+		return;
+	}
+
+child_count_changed:
+	/* If this device has no children, return */
+	if (laa.l_children == 0)
+		return;
+
+	/* Allocate a buffer large enough to hold the child device names */
+	p = laa.l_childname;
+	children = laa.l_children;
+
+	len = children * sizeof(laa.l_childname[0]);
+	laa.l_childname = realloc(laa.l_childname, len);
+	if (laa.l_childname == NULL) {
+		syslog(LOG_ERR, couldn't allocate %zu bytes, len);
+		laa.l_childname = p;
+		goto done;
+	}
+
+	/* Get a list of child devices */
+	error = ioctl(drvctl_fd, DRVLISTDEV, laa);
+	if (error) {
+		syslog(LOG_ERR, DRVLISTDEV failed: %m);
+		goto done;
+	}
+
+	/* If the child count changed between DRVLISTDEV calls, retry */
+	if (children != laa.l_children)
+		goto child_count_changed;
+
+	/*
+	 * For each child device, first post an attach event and
+	 * then scan each one for additional devices.
+	 */
+	for (n = 0; n  laa.l_children; n++)
+		udevfsd_eventhandler(UDEVFSD_ATTACH_EVENT, laa.l_childname[n]);
+	for (n = 0; n  laa.l_children; n++)
+		udevfsd_probe(laa.l_childname[n]);
+
+done:
+	free(laa.l_childname);
+	return;
+}
+
+static void
 usage(void)
 {
 	fprintf(stderr, usage: %s [-f]\n, getprogname());
@@ -170,6 +236,10 @@
 			err(EXIT_FAILURE, couldn't fork);
 		}
 	}
+
+	/* Look for devices that are already present */
+	udevfsd_probe(NULL);
+
 	udevfsd_eventloop();
 
 	return EXIT_SUCCESS;



CVS commit: src/sys/dev/i2c

2011-08-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Aug  4 22:24:29 UTC 2011

Modified Files:
src/sys/dev/i2c: mt2131.c

Log Message:
modularize mt2131


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/i2c/mt2131.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/dev/i2c/mt2131.c
diff -u src/sys/dev/i2c/mt2131.c:1.1 src/sys/dev/i2c/mt2131.c:1.2
--- src/sys/dev/i2c/mt2131.c:1.1	Thu Aug  4 01:45:37 2011
+++ src/sys/dev/i2c/mt2131.c	Thu Aug  4 22:24:29 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: mt2131.c,v 1.1 2011/08/04 01:45:37 jakllsch Exp $ */
+/* $NetBSD: mt2131.c,v 1.2 2011/08/04 22:24:29 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2008, 2011 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mt2131.c,v 1.1 2011/08/04 01:45:37 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: mt2131.c,v 1.2 2011/08/04 22:24:29 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -35,6 +35,7 @@
 #include sys/kmem.h
 #include sys/syslog.h
 #include sys/proc.h
+#include sys/module.h
 
 #include dev/i2c/mt2131var.h
 
@@ -264,3 +265,13 @@
 
 	return ret;
 }
+
+MODULE(MODULE_CLASS_DRIVER, mt2131, NULL);
+
+static int
+mt2131_modcmd(modcmd_t cmd, void *priv)
+{
+	if (cmd == MODULE_CMD_INIT || cmd == MODULE_CMD_FINI)
+		return 0;
+	return ENOTTY;
+}



CVS commit: src/sys/dev/i2c

2011-08-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Aug  4 22:24:45 UTC 2011

Modified Files:
src/sys/dev/i2c: cx24227.c

Log Message:
modularize cx24227


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/i2c/cx24227.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/dev/i2c/cx24227.c
diff -u src/sys/dev/i2c/cx24227.c:1.1 src/sys/dev/i2c/cx24227.c:1.2
--- src/sys/dev/i2c/cx24227.c:1.1	Thu Aug  4 01:48:34 2011
+++ src/sys/dev/i2c/cx24227.c	Thu Aug  4 22:24:45 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cx24227.c,v 1.1 2011/08/04 01:48:34 jakllsch Exp $ */
+/* $NetBSD: cx24227.c,v 1.2 2011/08/04 22:24:45 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2008, 2011 Jonathan A. Kollasch
@@ -27,12 +27,13 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cx24227.c,v 1.1 2011/08/04 01:48:34 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: cx24227.c,v 1.2 2011/08/04 22:24:45 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
 #include sys/device.h
 #include sys/kmem.h
+#include sys/module.h
 
 #include dev/i2c/cx24227var.h
 
@@ -264,7 +265,7 @@
 static int
 cx24227_init(struct cx24227 *sc)
 {
-	int i;
+	unsigned int i;
 	uint16_t reg;
 
 	cx24227_sleepreset(sc);
@@ -305,3 +306,13 @@
 
 	return 0;
 }
+
+MODULE(MODULE_CLASS_DRIVER, cx24227, NULL);
+
+static int
+cx24227_modcmd(modcmd_t cmd, void *priv)
+{
+	if (cmd == MODULE_CMD_INIT || cmd == MODULE_CMD_FINI)
+		return 0;
+	return ENOTTY;
+}



CVS commit: src/sys/dev/pci

2011-08-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Aug  4 22:25:08 UTC 2011

Modified Files:
src/sys/dev/pci: coram.c coramvar.h

Log Message:
modularize coram and add detach + childdet methods


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/coram.c src/sys/dev/pci/coramvar.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/dev/pci/coram.c
diff -u src/sys/dev/pci/coram.c:1.1 src/sys/dev/pci/coram.c:1.2
--- src/sys/dev/pci/coram.c:1.1	Thu Aug  4 14:43:55 2011
+++ src/sys/dev/pci/coram.c	Thu Aug  4 22:25:08 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: coram.c,v 1.1 2011/08/04 14:43:55 jakllsch Exp $ */
+/* $NetBSD: coram.c,v 1.2 2011/08/04 22:25:08 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2008, 2011 Jonathan A. Kollasch
@@ -27,14 +27,14 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coram.c,v 1.1 2011/08/04 14:43:55 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: coram.c,v 1.2 2011/08/04 22:25:08 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
 #include sys/device.h
 #include sys/kmem.h
 #include sys/mutex.h
-
+#include sys/module.h
 #include sys/bus.h
 
 #include dev/dtv/dtvif.h
@@ -53,6 +53,8 @@
 
 static int coram_match(device_t, cfdata_t, void *);
 static void coram_attach(device_t, device_t, void *);
+static int coram_detach(device_t, int);
+static void coram_childdet(device_t, device_t);
 static bool coram_resume(device_t, const pmf_qual_t *);
 static int coram_intr(void *);
 
@@ -76,6 +78,7 @@
 static int coram_dtv_stop_transfer(void *);
 
 static int coram_mpeg_attach(struct coram_softc *);
+static int coram_mpeg_detach(struct coram_softc *, int);
 static int coram_mpeg_reset(struct coram_softc *);
 static void * coram_mpeg_malloc(struct coram_softc *, size_t);
 static int coram_allocmem(struct coram_softc *, size_t, size_t, struct coram_dma *);
@@ -88,8 +91,8 @@
 static int coram_sram_ch_setup(struct coram_softc *, struct coram_sram_ch *, uint32_t);
 static int coram_mpeg_intr(struct coram_softc *);
 
-CFATTACH_DECL_NEW(coram, sizeof(struct coram_softc),
-coram_match, coram_attach, NULL, NULL);
+CFATTACH_DECL2_NEW(coram, sizeof(struct coram_softc),
+coram_match, coram_attach, coram_detach, NULL, NULL, coram_childdet);
 
 #define CORAM_SRAM_CH6 0
 
@@ -179,6 +182,7 @@
 	}
 
 	sc-sc_dmat = pa-pa_dmat;
+	sc-sc_pc = pa-pa_pc;
 
 	if (pci_intr_map(pa, ih)) {
 		aprint_error_dev(self, couldn't map interrupt\n);
@@ -222,7 +226,8 @@
 		memset(iba, 0, sizeof(iba));
 		iba.iba_tag = cic-cic_i2c;
 		iba.iba_type = I2C_TYPE_SMBUS;
-		config_found_ia(self, i2cbus, iba, iicbus_print);
+		cic-cic_i2cdev = config_found_ia(self, i2cbus,
+		iba, iicbus_print);
 #endif
 	}
 
@@ -263,12 +268,11 @@
 #endif
 
 	sc-sc_demod = cx24227_open(sc-sc_dev, sc-sc_iic[0].cic_i2c, 0x19);
-	if ( sc-sc_demod == NULL )
-		panic(no demod);
-
+	if (sc-sc_demod == NULL)
+		aprint_error_dev(self, couldn't open cx24227\n);
 	sc-sc_tuner = mt2131_open(sc-sc_dev, sc-sc_iic[0].cic_i2c, 0x61);
-	if ( sc-sc_tuner == NULL )
-		panic(no tuner);
+	if (sc-sc_tuner == NULL)
+		aprint_error_dev(self, couldn't open mt2131\n);
 
 	coram_mpeg_attach(sc);
 
@@ -279,6 +283,55 @@
 }
 
 static int
+coram_detach(device_t self, int flags)
+{
+	struct coram_softc *sc = device_private(self);
+	struct coram_iic_softc *cic;
+	unsigned int i;
+	int error;
+
+	error = coram_mpeg_detach(sc, flags);
+	if (error)
+		return error;
+
+	if (sc-sc_tuner)
+		mt2131_close(sc-sc_tuner);
+	if (sc-sc_demod)
+		cx24227_close(sc-sc_demod);
+	for (i = 0; i  I2C_NUM; i++) {
+		cic = sc-sc_iic[i];
+		if (cic-cic_i2cdev)
+			config_detach(cic-cic_i2cdev, flags);
+		mutex_destroy(cic-cic_busmutex);
+	}
+	pmf_device_deregister(self);
+
+	if (sc-sc_mems)
+		bus_space_unmap(sc-sc_memt, sc-sc_memh, sc-sc_mems);
+	if (sc-sc_ih)
+		pci_intr_disestablish(sc-sc_pc, sc-sc_ih);
+
+	return 0;
+}
+
+static void
+coram_childdet(device_t self, device_t child)
+{
+	struct coram_softc *sc = device_private(self);
+	struct coram_iic_softc *cic;
+	unsigned int i;
+
+	if (sc-sc_dtvdev == child)
+		sc-sc_dtvdev = NULL;
+
+	for (i = 0; i  I2C_NUM; i++) {
+		cic = sc-sc_iic[i];
+		if (cic-cic_i2cdev == child)
+			cic-cic_i2cdev = NULL;
+	}
+}
+
+static int
 coram_intr(void *v)
 {
 	device_t self = v;
@@ -541,6 +594,23 @@
 	return (sc-sc_dtvdev != NULL);
 }
 
+static int
+coram_mpeg_detach(struct coram_softc *sc, int flags)
+{
+	struct coram_sram_ch *ch = coram_sram_chs[CORAM_SRAM_CH6];
+	int error;
+
+	if (sc-sc_dtvdev) {
+		error = config_detach(sc-sc_dtvdev, flags);
+		if (error)
+			return error;
+	}
+	if (sc-sc_riscbuf) {
+		kmem_free(sc-sc_riscbuf, ch-csc_riscsz);
+	}
+
+	return 0;
+}
 
 static void
 coram_dtv_get_devinfo(void *cookie, struct dvb_frontend_info *info)
@@ -563,6 +633,9 @@
 
 	//KASSERT(sc-sc_tsbuf == NULL);
 
+	if (sc-sc_tuner == NULL || sc-sc_demod == NULL)
+		return ENXIO;
+
 	coram_mpeg_reset(sc);
 
 	/* 

CVS commit: src/sys/modules

2011-08-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Aug  4 22:26:07 UTC 2011

Added Files:
src/sys/modules/coram: Makefile coram.ioconf
src/sys/modules/cx24227: Makefile
src/sys/modules/mt2131: Makefile

Log Message:
add mt2131, cx24227, and coram module glue


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/modules/coram/Makefile \
src/sys/modules/coram/coram.ioconf
cvs rdiff -u -r0 -r1.1 src/sys/modules/cx24227/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/mt2131/Makefile

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

Added files:

Index: src/sys/modules/coram/Makefile
diff -u /dev/null src/sys/modules/coram/Makefile:1.1
--- /dev/null	Thu Aug  4 22:26:07 2011
+++ src/sys/modules/coram/Makefile	Thu Aug  4 22:26:07 2011
@@ -0,0 +1,13 @@
+#	$NetBSD: Makefile,v 1.1 2011/08/04 22:26:07 jmcneill Exp $
+
+.include ../Makefile.inc
+
+.PATH:	${S}/dev/pci
+
+KMOD=	coram
+IOCONF=	coram.ioconf
+SRCS=	coram.c
+
+WARNS=	3
+
+.include bsd.kmodule.mk
Index: src/sys/modules/coram/coram.ioconf
diff -u /dev/null src/sys/modules/coram/coram.ioconf:1.1
--- /dev/null	Thu Aug  4 22:26:07 2011
+++ src/sys/modules/coram/coram.ioconf	Thu Aug  4 22:26:07 2011
@@ -0,0 +1,10 @@
+#	$NetBSD: coram.ioconf,v 1.1 2011/08/04 22:26:07 jmcneill Exp $
+
+ioconf coram
+
+include conf/files
+include dev/pci/files.pci
+
+pseudo-root pci*
+
+coram* at pci? dev ? function ?

Index: src/sys/modules/cx24227/Makefile
diff -u /dev/null src/sys/modules/cx24227/Makefile:1.1
--- /dev/null	Thu Aug  4 22:26:07 2011
+++ src/sys/modules/cx24227/Makefile	Thu Aug  4 22:26:07 2011
@@ -0,0 +1,12 @@
+#	$NetBSD: Makefile,v 1.1 2011/08/04 22:26:07 jmcneill Exp $
+
+.include ../Makefile.inc
+
+.PATH:	${S}/dev/i2c
+
+KMOD=	cx24227
+SRCS=	cx24227.c
+
+WARNS=	4
+
+.include bsd.kmodule.mk

Index: src/sys/modules/mt2131/Makefile
diff -u /dev/null src/sys/modules/mt2131/Makefile:1.1
--- /dev/null	Thu Aug  4 22:26:07 2011
+++ src/sys/modules/mt2131/Makefile	Thu Aug  4 22:26:07 2011
@@ -0,0 +1,12 @@
+#	$NetBSD: Makefile,v 1.1 2011/08/04 22:26:07 jmcneill Exp $
+
+.include ../Makefile.inc
+
+.PATH:	${S}/dev/i2c
+
+KMOD=	mt2131
+SRCS=	mt2131.c
+
+WARNS=	4
+
+.include bsd.kmodule.mk



CVS commit: src/sys/dev/acpi

2011-08-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Aug  4 23:22:30 UTC 2011

Modified Files:
src/sys/dev/acpi: acpi_cpu_cstate.c

Log Message:
Don't treat C2 states as C1 if the _CST package doesn't have an entry
for C1. ACPI mandates C1 so if it's not present in the _CST package use
the HLT method. Fixes all sorts of performance regressions on AMD CPUs.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/acpi/acpi_cpu_cstate.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/dev/acpi/acpi_cpu_cstate.c
diff -u src/sys/dev/acpi/acpi_cpu_cstate.c:1.54 src/sys/dev/acpi/acpi_cpu_cstate.c:1.55
--- src/sys/dev/acpi/acpi_cpu_cstate.c:1.54	Wed Jul 13 07:34:55 2011
+++ src/sys/dev/acpi/acpi_cpu_cstate.c	Thu Aug  4 23:22:30 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_cstate.c,v 1.54 2011/07/13 07:34:55 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_cstate.c,v 1.55 2011/08/04 23:22:30 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2010, 2011 Jukka Ruohonen jruoho...@iki.fi
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: acpi_cpu_cstate.c,v 1.54 2011/07/13 07:34:55 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: acpi_cpu_cstate.c,v 1.55 2011/08/04 23:22:30 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/cpu.h
@@ -48,7 +48,7 @@
 
 static ACPI_STATUS	 acpicpu_cstate_cst(struct acpicpu_softc *);
 static ACPI_STATUS	 acpicpu_cstate_cst_add(struct acpicpu_softc *,
-		ACPI_OBJECT *, int );
+		ACPI_OBJECT *);
 static void		 acpicpu_cstate_cst_bios(void);
 static void		 acpicpu_cstate_memset(struct acpicpu_softc *);
 static ACPI_STATUS	 acpicpu_cstate_dep(struct acpicpu_softc *);
@@ -160,6 +160,7 @@
 static ACPI_STATUS
 acpicpu_cstate_cst(struct acpicpu_softc *sc)
 {
+	struct acpicpu_cstate *cs = sc-sc_cstate;
 	ACPI_OBJECT *elm, *obj;
 	ACPI_BUFFER buf;
 	ACPI_STATUS rv;
@@ -204,13 +205,18 @@
 
 	acpicpu_cstate_memset(sc);
 
+	/*
+	 * All x86 processors should support C1 (a.k.a. HALT).
+	 */
+	cs[ACPI_STATE_C1].cs_method = ACPICPU_C_STATE_HALT;
+
 	CTASSERT(ACPI_STATE_C0 == 0  ACPI_STATE_C1 == 1);
 	CTASSERT(ACPI_STATE_C2 == 2  ACPI_STATE_C3 == 3);
 
 	for (count = 0, i = 1; i = n; i++) {
 
 		elm = obj-Package.Elements[i];
-		rv = acpicpu_cstate_cst_add(sc, elm, i);
+		rv = acpicpu_cstate_cst_add(sc, elm);
 
 		if (ACPI_SUCCESS(rv))
 			count++;
@@ -226,7 +232,7 @@
 }
 
 static ACPI_STATUS
-acpicpu_cstate_cst_add(struct acpicpu_softc *sc, ACPI_OBJECT *elm, int i)
+acpicpu_cstate_cst_add(struct acpicpu_softc *sc, ACPI_OBJECT *elm)
 {
 	struct acpicpu_cstate *cs = sc-sc_cstate;
 	struct acpicpu_cstate state;
@@ -371,30 +377,13 @@
 		goto out;
 	}
 
-	/*
-	 * As some systems define the type arbitrarily,
-	 * we use a sequential counter instead of the
-	 * BIOS data. For instance, AMD family 14h is
-	 * instructed to only use the value 2; see
-	 *
-	 *	Advanced Micro Devices: BIOS and Kernel
-	 *	Developer's Guide (BKDG) for AMD Family
-	 *	14h Models 00h-0Fh Processors. Revision
-	 *	3.00, January 4, 2011.
-	 */
-	if (i != (int)type) {
-
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-			C%d != C%u from BIOS, i, type));
-	}
-
-	KASSERT(cs[i].cs_method == 0);
-
-	cs[i].cs_addr = state.cs_addr;
-	cs[i].cs_power = state.cs_power;
-	cs[i].cs_flags = state.cs_flags;
-	cs[i].cs_method = state.cs_method;
-	cs[i].cs_latency = state.cs_latency;
+	KASSERT(cs[type].cs_method == 0);
+
+	cs[type].cs_addr = state.cs_addr;
+	cs[type].cs_power = state.cs_power;
+	cs[type].cs_flags = state.cs_flags;
+	cs[type].cs_method = state.cs_method;
+	cs[type].cs_latency = state.cs_latency;
 
 out:
 	if (ACPI_FAILURE(rv))



CVS commit: src/sys/dev/i2c

2011-08-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Aug  5 20:32:22 UTC 2011

Modified Files:
src/sys/dev/i2c: cx24227.c

Log Message:
add QAM64/256 support


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/i2c/cx24227.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/dev/i2c/cx24227.c
diff -u src/sys/dev/i2c/cx24227.c:1.2 src/sys/dev/i2c/cx24227.c:1.3
--- src/sys/dev/i2c/cx24227.c:1.2	Thu Aug  4 22:24:45 2011
+++ src/sys/dev/i2c/cx24227.c	Fri Aug  5 20:32:22 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cx24227.c,v 1.2 2011/08/04 22:24:45 jmcneill Exp $ */
+/* $NetBSD: cx24227.c,v 1.3 2011/08/05 20:32:22 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2008, 2011 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cx24227.c,v 1.2 2011/08/04 22:24:45 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: cx24227.c,v 1.3 2011/08/05 20:32:22 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -173,12 +173,31 @@
 {
 	printf(%s\n, __func__);
 
+	switch (modulation) {
+	case VSB_8:
+	case QAM_64:
+	case QAM_256:
+	case QAM_AUTO:
+		break;
+	default:
+		return EINVAL;
+	}
+
 	/* soft reset */
 	cx24227_writereg(sc, 0xf5, 0x);
 	cx24227_writereg(sc, 0xf5, 0x0001);
 
-	/* 8 VSB */
-	cx24227_writereg(sc, 0xf4, 0x);
+	switch (modulation) {
+	case VSB_8:
+		/* VSB8 */
+		cx24227_writereg(sc, 0xf4, 0x);
+		break;
+	default:
+		/* QAM */
+		cx24227_writereg(sc, 0xf4, 0x0001);
+		cx24227_writereg(sc, 0x85, 0x0110);
+		break;
+	}
 
 	/* soft reset */
 	cx24227_writereg(sc, 0xf5, 0x);



CVS commit: src/sys/dev/pci

2011-08-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Aug  5 20:33:17 UTC 2011

Modified Files:
src/sys/dev/pci: coram.c

Log Message:
return status from demod instead of 0, and don't ignore errors when setting
demod parameters


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/coram.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/dev/pci/coram.c
diff -u src/sys/dev/pci/coram.c:1.2 src/sys/dev/pci/coram.c:1.3
--- src/sys/dev/pci/coram.c:1.2	Thu Aug  4 22:25:08 2011
+++ src/sys/dev/pci/coram.c	Fri Aug  5 20:33:17 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: coram.c,v 1.2 2011/08/04 22:25:08 jmcneill Exp $ */
+/* $NetBSD: coram.c,v 1.3 2011/08/05 20:33:17 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2008, 2011 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coram.c,v 1.2 2011/08/04 22:25:08 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: coram.c,v 1.3 2011/08/05 20:33:17 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -670,15 +670,18 @@
 	KASSERT(sc-sc_tuner != NULL);
 	mt2131_tune_dtv(sc-sc_tuner, params);
 	KASSERT(sc-sc_demod != NULL);
-	cx24227_set_modulation(sc-sc_demod, params-u.vsb.modulation);
-
-	return 0; /* XXX */
+	return cx24227_set_modulation(sc-sc_demod, params-u.vsb.modulation);
 }
 
 static fe_status_t
 coram_dtv_get_status(void *cookie)
 {
-	return 0;
+	struct coram_softc *sc = cookie;
+
+	if (sc-sc_demod == NULL)
+		return ENXIO;
+
+	return cx24227_get_dtv_status(sc-sc_demod);;
 }
 
 static uint16_t



CVS commit: src/sys/dev/i2c

2011-08-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Aug  5 21:19:23 UTC 2011

Modified Files:
src/sys/dev/i2c: cx24227.c

Log Message:
hide debug messages under CX24227_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/i2c/cx24227.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/dev/i2c/cx24227.c
diff -u src/sys/dev/i2c/cx24227.c:1.3 src/sys/dev/i2c/cx24227.c:1.4
--- src/sys/dev/i2c/cx24227.c:1.3	Fri Aug  5 20:32:22 2011
+++ src/sys/dev/i2c/cx24227.c	Fri Aug  5 21:19:23 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cx24227.c,v 1.3 2011/08/05 20:32:22 jmcneill Exp $ */
+/* $NetBSD: cx24227.c,v 1.4 2011/08/05 21:19:23 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2008, 2011 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cx24227.c,v 1.3 2011/08/05 20:32:22 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: cx24227.c,v 1.4 2011/08/05 21:19:23 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -37,6 +37,8 @@
 
 #include dev/i2c/cx24227var.h
 
+/* #define CX24227_DEBUG */
+
 struct cx24227 {
 	device_tparent;
 	i2c_tag_t   tag;
@@ -171,8 +173,6 @@
 int
 cx24227_set_modulation(struct cx24227 *sc, fe_modulation_t modulation)
 {
-	printf(%s\n, __func__);
-
 	switch (modulation) {
 	case VSB_8:
 	case QAM_64:
@@ -244,19 +244,21 @@
 	/* read chip ids */
 	value = 0;
 	e = cx24227_readreg(sc, 0x04, value);
-	printf(%s chipid %04x\n, __func__, value);
-
 	if (e) {
-		printf(%s read failed %d\n, __func__, e);
+		device_printf(parent, cx24227: read failed: %d\n, e);
 		kmem_free(sc, sizeof(*sc));
 		return NULL;
 	}
+#ifdef CX24227_DEBUG
+	device_printf(parent, cx24227: chipid %04x\n, value);
+#endif
+
 
 	value = 0x0001; /* open the i2c gate */
 	e = cx24227_writereg(sc, 0xf3, value);
 #if 0
 	if (e) {
-		printf(%s write failed %d\n, __func__, e);
+		device_printf(parent, cx24227: write failed: %d\n, e);
 		kmem_free(sc, sizeof(*sc));
 		return NULL;
 	}



CVS commit: src/sys/dev/pci

2011-08-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Aug  5 21:20:27 UTC 2011

Modified Files:
src/sys/dev/pci: coram.c

Log Message:
hide debug messages under CORAM_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/coram.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/dev/pci/coram.c
diff -u src/sys/dev/pci/coram.c:1.3 src/sys/dev/pci/coram.c:1.4
--- src/sys/dev/pci/coram.c:1.3	Fri Aug  5 20:33:17 2011
+++ src/sys/dev/pci/coram.c	Fri Aug  5 21:20:27 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: coram.c,v 1.3 2011/08/05 20:33:17 jmcneill Exp $ */
+/* $NetBSD: coram.c,v 1.4 2011/08/05 21:20:27 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2008, 2011 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coram.c,v 1.3 2011/08/05 20:33:17 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: coram.c,v 1.4 2011/08/05 21:20:27 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -51,6 +51,8 @@
 #include dev/i2c/cx24227var.h
 #include dev/i2c/mt2131var.h
 
+/* #define CORAM_DEBUG */
+
 static int coram_match(device_t, cfdata_t, void *);
 static void coram_attach(device_t, device_t, void *);
 static int coram_detach(device_t, int);
@@ -415,8 +417,6 @@
 	struct coram_softc *sc;
 	sc = device_private(dv);
 
-	device_printf(sc-sc_dev, %s\n, __func__);
-
 	return true;
 }
 
@@ -629,7 +629,9 @@
 {
 	struct coram_softc *sc = cookie;
 
+#ifdef CORAM_DEBUG
 	device_printf(sc-sc_dev, %s\n, __func__);
+#endif
 
 	//KASSERT(sc-sc_tsbuf == NULL);
 
@@ -652,7 +654,9 @@
 {
 	struct coram_softc *sc = cookie;
 
+#ifdef CORAM_DEBUG
 	device_printf(sc-sc_dev, %s\n, __func__);
+#endif
 
 	coram_mpeg_halt(sc);
 
@@ -701,7 +705,9 @@
 {
 	struct coram_softc *sc = cookie;
 
+#ifdef CORAM_DEBUG
 	device_printf(sc-sc_dev, %s\n, __func__);
+#endif
 
 	coram_mpeg_trigger(sc, sc-sc_tsbuf);
 
@@ -713,7 +719,9 @@
 {
 	struct coram_softc *sc = cookie;
 
+#ifdef CORAM_DEBUG
 	device_printf(sc-sc_dev, %s\n, __func__);
+#endif
 
 	coram_mpeg_halt(sc);
 	bus_space_write_4(sc-sc_memt, sc-sc_memh, PCI_INT_MSK, 0);
@@ -808,7 +816,9 @@
 {
 	uint32_t v;
 
+#ifdef CORAM_DEBUG
 	device_printf(sc-sc_dev, %s\n, __func__);
+#endif
 
 	bus_space_write_4(sc-sc_memt, sc-sc_memh, VID_C_DMA_CTL, 0);
 
@@ -909,14 +919,22 @@
 	bus_space_write_4(sc-sc_memt, sc-sc_memh, PCI_INT_MSK, v);
 
 	v = bus_space_read_4(sc-sc_memt, sc-sc_memh, VID_C_GEN_CTL);
+#ifdef CORAM_DEBUG
 	printf(%s, %06x %08x\n, __func__, VID_C_GEN_CTL, v);
+#endif
 	v = bus_space_read_4(sc-sc_memt, sc-sc_memh, VID_C_SOP_STATUS);
+#ifdef CORAM_DEBUG
 	printf(%s, %06x %08x\n, __func__, VID_C_SOP_STATUS, v);
+#endif
 	delay(100*1000);
 	v = bus_space_read_4(sc-sc_memt, sc-sc_memh, VID_C_GEN_CTL);
+#ifdef CORAM_DEBUG
 	printf(%s, %06x %08x\n, __func__, VID_C_GEN_CTL, v);
+#endif
 	v = bus_space_read_4(sc-sc_memt, sc-sc_memh, VID_C_SOP_STATUS);
+#ifdef CORAM_DEBUG
 	printf(%s, %06x %08x\n, __func__, VID_C_SOP_STATUS, v);
+#endif
 
 	return 0;
 }
@@ -988,11 +1006,13 @@
 	bpl = (bpl + 7)  ~7;
 	cdt = csc-csc_cdt;
 	lines = csc-csc_fifosz / bpl;
+#ifdef CORAM_DEBUG
 	printf(%s %d lines\n, __func__, lines);
+#endif
 
 	/* fill in CDT */
 	for (i = 0; i  lines; i++) {
-#if 1
+#ifdef CORAM_DEBUG
 		printf(CDT ent %08x, %08x\n, cdt + (16 * i),
 		csc-csc_fifo + (bpl * i));
 #endif



CVS commit: src/sys/dev/pci

2011-08-06 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug  6 11:37:56 UTC 2011

Modified Files:
src/sys/dev/pci: coram.c

Log Message:
don't attach iic@coram unless CORAM_ATTACH_I2C is defined


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/coram.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/dev/pci/coram.c
diff -u src/sys/dev/pci/coram.c:1.4 src/sys/dev/pci/coram.c:1.5
--- src/sys/dev/pci/coram.c:1.4	Fri Aug  5 21:20:27 2011
+++ src/sys/dev/pci/coram.c	Sat Aug  6 11:37:56 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: coram.c,v 1.4 2011/08/05 21:20:27 jmcneill Exp $ */
+/* $NetBSD: coram.c,v 1.5 2011/08/06 11:37:56 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2008, 2011 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coram.c,v 1.4 2011/08/05 21:20:27 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: coram.c,v 1.5 2011/08/06 11:37:56 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -52,6 +52,7 @@
 #include dev/i2c/mt2131var.h
 
 /* #define CORAM_DEBUG */
+/* #define CORAM_ATTACH_I2C */
 
 static int coram_match(device_t, cfdata_t, void *);
 static void coram_attach(device_t, device_t, void *);
@@ -160,8 +161,11 @@
 	const char *intrstr;
 	char devinfo[76];
 	struct coram_iic_softc *cic;
-	struct i2cbus_attach_args iba;
 	uint32_t value;
+	int i;
+#ifdef CORAM_ATTACH_I2C
+	struct i2cbus_attach_args iba;
+#endif
 
 	sc = device_private(self);
 
@@ -207,8 +211,6 @@
 	reg |= PCI_COMMAND_MASTER_ENABLE;
 	pci_conf_write(pa-pa_pc, pa-pa_tag, PCI_COMMAND_STATUS_REG, reg);
 
-	int i;
-
 	/* I2C */
 	for(i = 0; i  I2C_NUM; i++) {
 		cic = sc-sc_iic[i];
@@ -223,7 +225,7 @@
 		cic-cic_i2c.ic_release_bus = coram_iic_release_bus;
 		cic-cic_i2c.ic_exec = coram_iic_exec;
 
-#if 1
+#ifdef CORAM_ATTACH_I2C
 		/* attach iic(4) */
 		memset(iba, 0, sizeof(iba));
 		iba.iba_tag = cic-cic_i2c;



CVS commit: src/sys/dev/pci

2011-08-06 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug  6 11:51:11 UTC 2011

Modified Files:
src/sys/dev/pci: coram.c

Log Message:
print devname not subdevname on attach, and report the board name to dtv
subsystem instead of generic CX23885


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/coram.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/dev/pci/coram.c
diff -u src/sys/dev/pci/coram.c:1.5 src/sys/dev/pci/coram.c:1.6
--- src/sys/dev/pci/coram.c:1.5	Sat Aug  6 11:37:56 2011
+++ src/sys/dev/pci/coram.c	Sat Aug  6 11:51:11 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: coram.c,v 1.5 2011/08/06 11:37:56 jmcneill Exp $ */
+/* $NetBSD: coram.c,v 1.6 2011/08/06 11:51:11 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2008, 2011 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coram.c,v 1.5 2011/08/06 11:37:56 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: coram.c,v 1.6 2011/08/06 11:51:11 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -54,12 +54,21 @@
 /* #define CORAM_DEBUG */
 /* #define CORAM_ATTACH_I2C */
 
+static const struct coram_board {
+	uint16_t vendor;
+	uint16_t product;
+	const char *name;
+} coram_boards[] = {
+	{ PCI_VENDOR_HAUPPAUGE, 0x7911, Hauppauge HVR-1250 },
+};
+
 static int coram_match(device_t, cfdata_t, void *);
 static void coram_attach(device_t, device_t, void *);
 static int coram_detach(device_t, int);
 static void coram_childdet(device_t, device_t);
 static bool coram_resume(device_t, const pmf_qual_t *);
 static int coram_intr(void *);
+static const struct coram_board * coram_board_lookup(uint16_t, uint16_t);
 
 static int coram_iic_exec(void *, i2c_op_t, i2c_addr_t,
 const void *, size_t, void *, size_t, int);
@@ -119,8 +128,6 @@
 	},
 };
 
-//#define PCI_PRODUCT_CONEXANT_CX23885 0x8852
-
 static const struct dtv_hw_if coram_dtv_if = {
 	.get_devinfo = coram_dtv_get_devinfo,
 	.open = coram_dtv_open,
@@ -137,29 +144,29 @@
 coram_match(device_t parent, cfdata_t match, void *v)
 {
 	const struct pci_attach_args *pa = v;
+	pcireg_t subid;
 
 	if (PCI_VENDOR(pa-pa_id) != PCI_VENDOR_CONEXANT)
 		return 0;
+	if (PCI_PRODUCT(pa-pa_id) != PCI_PRODUCT_CONEXANT_CX23885)
+		return 0;
 
-	switch (PCI_PRODUCT(pa-pa_id)) {
-	case PCI_PRODUCT_CONEXANT_CX23885:
-		return 1;
-	}
-
-	/* XXX only match supported boards */
+	subid = pci_conf_read(pa-pa_pc, pa-pa_tag, PCI_SUBSYS_ID_REG);
+	if (coram_board_lookup(PCI_VENDOR(subid), PCI_PRODUCT(subid)) == NULL)
+		return 0;
 
-	return 0;
+	return 1;
 }
 
 static void
 coram_attach(device_t parent, device_t self, void *v)
 {
-	struct coram_softc *sc;
+	struct coram_softc *sc = device_private(self);
 	const struct pci_attach_args *pa = v;
 	pci_intr_handle_t ih;
 	pcireg_t reg;
+	char devinfo[256];
 	const char *intrstr;
-	char devinfo[76];
 	struct coram_iic_softc *cic;
 	uint32_t value;
 	int i;
@@ -167,19 +174,15 @@
 	struct i2cbus_attach_args iba;
 #endif
 
-	sc = device_private(self);
-
 	sc-sc_dev = self;
 
 	aprint_naive(\n);
+	pci_devinfo(pa-pa_id, pa-pa_class, 0, devinfo, sizeof(devinfo));
+	aprint_normal(: %s (rev. 0x%02x)\n, devinfo, PCI_REVISION(pa-pa_class));
 
 	reg = pci_conf_read(pa-pa_pc, pa-pa_tag, PCI_SUBSYS_ID_REG);
-
-	sc-sc_vendor = PCI_VENDOR(reg);
-	sc-sc_product = PCI_PRODUCT(reg);
-
-	pci_devinfo(reg, pa-pa_class, 0, devinfo, sizeof(devinfo));
-	aprint_normal(: %s (rev. 0x%02x)\n, devinfo, PCI_REVISION(pa-pa_class));
+	sc-sc_board = coram_board_lookup(PCI_VENDOR(reg), PCI_PRODUCT(reg));
+	KASSERT(sc-sc_board != NULL);
 
 	if (pci_mapreg_map(pa, CX23885_MMBASE, PCI_MAPREG_TYPE_MEM, 0,
 			   sc-sc_memt, sc-sc_memh, NULL, sc-sc_mems)) {
@@ -360,6 +363,21 @@
 	return 1;
 }
 
+static const struct coram_board *
+coram_board_lookup(uint16_t vendor, uint16_t product)
+{
+	unsigned int i;
+
+	for (i = 0; i  __arraycount(coram_boards); i++) {
+		if (coram_boards[i].vendor == vendor 
+		coram_boards[i].product == product) {
+			return coram_boards[i];
+		}
+	}
+
+	return NULL;
+}
+
 #define CXDTV_TS_RISCI2  (1  4)
 #define CXDTV_TS_RISCI1  (1  0)
 
@@ -617,8 +635,10 @@
 static void
 coram_dtv_get_devinfo(void *cookie, struct dvb_frontend_info *info)
 {
+	struct coram_softc *sc = cookie;
+
 	memset(info, 0, sizeof(*info));
-	strlcpy(info-name, CX23885, sizeof(info-name));
+	strlcpy(info-name, sc-sc_board-name, sizeof(info-name));
 	info-type = FE_ATSC;
 	info-frequency_min = 5400;
 	info-frequency_max = 85800;



CVS commit: src/etc

2011-08-06 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug  6 12:29:39 UTC 2011

Modified Files:
src/etc: MAKEDEV.tmpl

Log Message:
add -u flag that causes the MAKEDEV script to only create a device node if it
doesn't exist


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/etc/MAKEDEV.tmpl

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

Modified files:

Index: src/etc/MAKEDEV.tmpl
diff -u src/etc/MAKEDEV.tmpl:1.139 src/etc/MAKEDEV.tmpl:1.140
--- src/etc/MAKEDEV.tmpl:1.139	Sat Jul  9 14:49:28 2011
+++ src/etc/MAKEDEV.tmpl	Sat Aug  6 12:29:39 2011
@@ -1,5 +1,5 @@
 #!/bin/sh -
-#	$NetBSD: MAKEDEV.tmpl,v 1.139 2011/07/09 14:49:28 jmcneill Exp $
+#	$NetBSD: MAKEDEV.tmpl,v 1.140 2011/08/06 12:29:39 jmcneill Exp $
 #
 # Copyright (c) 2003,2007,2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -310,7 +310,7 @@
 usage()
 {
 	cat 12  _USAGE_
-Usage: ${0##*/} [-fMs] [-m mknod] [-p pax] [-t mtree] special [...]
+Usage: ${0##*/} [-fMsu] [-m mknod] [-p pax] [-t mtree] special [...]
 	Create listed special devices.  Options:
 	-f		Force permissions to be updated on existing devices.
 	-M		Create memory file system.
@@ -318,6 +318,7 @@
 	-p pax  	Name of pax(1) program.  [\$TOOL_PAX or pax]
 	-s		Generate mtree(8) specfile instead of creating devices.
 	-t mtree	Name of mtree(8) program.  [\$TOOL_MTREE or mtree]
+	-u		Don't re-create devices that already exist.
 
 _USAGE_
 	exit 1
@@ -425,8 +426,9 @@
 	do_mtree=false
 	do_redirect=false
 	do_specfile=false
+	do_update=false
 	opts=
-	while getopts Mfm:p:st: ch; do
+	while getopts Mfm:p:st:u ch; do
 		# Note that $opts is only for options pased through to
 		# MAKEDEV.local, not for all options.
 		case ${ch} in
@@ -468,6 +470,10 @@
 do_mknod=true
 			fi
 			;;
+		u)
+			do_update=true
+			opts=${opts} -u
+			;;
 		*)	usage ;;
 		esac
 	done
@@ -524,6 +530,11 @@
 		do_mknod=true
 	fi
 
+	# do_force and do_update do not work together
+	if $do_force  $do_update; then
+		die -f and -u options do not work together
+	fi
+
 	# If no explicit method was specified on the command line or
 	# forced above, then use one of mtree, pax, or mknod, in that
 	# order of preference.
@@ -663,6 +674,9 @@
 		count_nodes=$((count_nodes + 1))
 		return
 	fi
+	if $do_update  test -e $1; then
+		return
+	fi
 	if $do_specfile; then
 		case $2 in
 		b)	type=block ;;
@@ -680,6 +694,9 @@
 		count_nodes=$((count_nodes + 1))
 		return
 	fi
+	if $do_update  test -e $2; then
+		return
+	fi
 	if $do_specfile; then
 		echo ./$2 type=link link=$1 mode=0700 gid=$g_wheel uid=$u_root
 	else
@@ -693,6 +710,9 @@
 		count_nodes=$((count_nodes + 1))
 		return
 	fi
+	if $do_update  test -e $1; then
+		return
+	fi
 	if $do_specfile; then
 		echo ./$1 type=dir mode=$2 gid=$g_wheel uid=$u_root
 	else



CVS commit: src/share/man/man8

2011-08-06 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug  6 12:32:29 UTC 2011

Modified Files:
src/share/man/man8: MAKEDEV.8.template MAKEDEV.local.8

Log Message:
add -u flag


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/share/man/man8/MAKEDEV.8.template
cvs rdiff -u -r1.7 -r1.8 src/share/man/man8/MAKEDEV.local.8

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

Modified files:

Index: src/share/man/man8/MAKEDEV.8.template
diff -u src/share/man/man8/MAKEDEV.8.template:1.19 src/share/man/man8/MAKEDEV.8.template:1.20
--- src/share/man/man8/MAKEDEV.8.template:1.19	Mon May 18 09:24:47 2009
+++ src/share/man/man8/MAKEDEV.8.template	Sat Aug  6 12:32:29 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: MAKEDEV.8.template,v 1.19 2009/05/18 09:24:47 wiz Exp $
+.\ $NetBSD: MAKEDEV.8.template,v 1.20 2011/08/06 12:32:29 jmcneill Exp $
 .\
 .\ Copyright (c) 2001, 2003, 2007, 2008 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -36,7 +36,7 @@
 .Sh SYNOPSIS
 .\ Please keep this in sync with MAKEDEV.local.8
 .Nm
-.Op Fl fMs
+.Op Fl fMsu
 .Op Fl m Ar mknod
 .Op Fl p Ar pax
 .Op Fl t Ar mtree
@@ -127,6 +127,8 @@
 .Xr mtree 8
 program.
 [Usually, $TOOL_MTREE or mtree.]
+.It Fl u
+Don't re-create devices that already exist.
 .El
 .Pp
 .Nm

Index: src/share/man/man8/MAKEDEV.local.8
diff -u src/share/man/man8/MAKEDEV.local.8:1.7 src/share/man/man8/MAKEDEV.local.8:1.8
--- src/share/man/man8/MAKEDEV.local.8:1.7	Wed Apr 30 13:10:57 2008
+++ src/share/man/man8/MAKEDEV.local.8	Sat Aug  6 12:32:29 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: MAKEDEV.local.8,v 1.7 2008/04/30 13:10:57 martin Exp $
+.\ $NetBSD: MAKEDEV.local.8,v 1.8 2011/08/06 12:32:29 jmcneill Exp $
 .\
 .\ Copyright (c) 2007 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -24,7 +24,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd April 9, 2008
+.Dd August 6, 2011
 .Dt MAKEDEV.LOCAL 8
 .Os
 .Sh NAME
@@ -32,7 +32,7 @@
 .Nd create site-specific device special files
 .Sh SYNOPSIS
 .Nm
-.Op Fl fMs
+.Op Fl fMsu
 .Op Fl m Ar mknod
 .Op Fl p Ar pax
 .Op Fl t Ar mtree



CVS commit: src/sys/dev/pci

2011-08-06 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug  6 19:21:27 UTC 2011

Modified Files:
src/sys/dev/pci: coram.c coramvar.h

Log Message:
build fix: forgot to add sc_board to softc


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/coram.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/coramvar.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/dev/pci/coram.c
diff -u src/sys/dev/pci/coram.c:1.6 src/sys/dev/pci/coram.c:1.7
--- src/sys/dev/pci/coram.c:1.6	Sat Aug  6 11:51:11 2011
+++ src/sys/dev/pci/coram.c	Sat Aug  6 19:21:27 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: coram.c,v 1.6 2011/08/06 11:51:11 jmcneill Exp $ */
+/* $NetBSD: coram.c,v 1.7 2011/08/06 19:21:27 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2008, 2011 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coram.c,v 1.6 2011/08/06 11:51:11 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: coram.c,v 1.7 2011/08/06 19:21:27 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -54,11 +54,7 @@
 /* #define CORAM_DEBUG */
 /* #define CORAM_ATTACH_I2C */
 
-static const struct coram_board {
-	uint16_t vendor;
-	uint16_t product;
-	const char *name;
-} coram_boards[] = {
+static const struct coram_board coram_boards[] = {
 	{ PCI_VENDOR_HAUPPAUGE, 0x7911, Hauppauge HVR-1250 },
 };
 

Index: src/sys/dev/pci/coramvar.h
diff -u src/sys/dev/pci/coramvar.h:1.2 src/sys/dev/pci/coramvar.h:1.3
--- src/sys/dev/pci/coramvar.h:1.2	Thu Aug  4 22:25:08 2011
+++ src/sys/dev/pci/coramvar.h	Sat Aug  6 19:21:27 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: coramvar.h,v 1.2 2011/08/04 22:25:08 jmcneill Exp $ */
+/* $NetBSD: coramvar.h,v 1.3 2011/08/06 19:21:27 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2008, 2011 Jonathan A. Kollasch
@@ -38,6 +38,12 @@
 #define KERNADDR(p)	((void *)((p)-addr))
 #define DMAADDR(p)	((p)-map-dm_segs[0].ds_addr)
 
+struct coram_board {
+	uint16_t vendor;
+	uint16_t product;
+	const char *name;
+};
+
 struct coram_sram_ch {
 	uint32_t	csc_cmds;
 	uint32_t	csc_iq;
@@ -94,8 +100,7 @@
 	void			*sc_tuner;
 	void			*sc_demod;
 
-	pci_vendor_id_t		sc_vendor;
-	pci_product_id_t	sc_product;
+	const struct coram_board *sc_board;
 };
 
 #endif /* !_DEV_PCI_CORAMVAR_H */



CVS commit: src/common/lib/libprop

2011-08-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Aug  7 11:33:03 UTC 2011

Modified Files:
src/common/lib/libprop: prop_dictionary_util.3

Log Message:
prop_dictionary_get_dict: last argument is prop_dictionary_t *, not bool *


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/common/lib/libprop/prop_dictionary_util.3

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

Modified files:

Index: src/common/lib/libprop/prop_dictionary_util.3
diff -u src/common/lib/libprop/prop_dictionary_util.3:1.6 src/common/lib/libprop/prop_dictionary_util.3:1.7
--- src/common/lib/libprop/prop_dictionary_util.3:1.6	Sun Mar 27 22:45:30 2011
+++ src/common/lib/libprop/prop_dictionary_util.3	Sun Aug  7 11:33:03 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: prop_dictionary_util.3,v 1.6 2011/03/27 22:45:30 wiz Exp $
+.\	$NetBSD: prop_dictionary_util.3,v 1.7 2011/08/07 11:33:03 jmcneill Exp $
 .\
 .\ Copyright (c) 2006 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd March 12, 2011
+.Dd August 7, 2011
 .Dt PROP_DICTIONARY_UTIL 3
 .Os
 .Sh NAME
@@ -63,7 +63,7 @@
 .\
 .Ft bool
 .Fn prop_dictionary_get_dict prop_dictionary_t dict const char *key \
-bool *dictp
+prop_dictionary_t *dictp
 .Ft bool
 .Fn prop_dictionary_get_bool prop_dictionary_t dict const char *key \
 bool *valp



CVS commit: src/sbin/drvctl

2011-08-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Aug  7 12:00:11 UTC 2011

Modified Files:
src/sbin/drvctl: drvctl.8 drvctl.c

Log Message:
add an optional argument to the -p flag that lets you extract specific
property values from the command-line:

  $ drvctl -p wd0 disk-info/geometry/cylinders-per-unit
  620181
  $ drvctl -p wd0 device-driver device-unit
  wd
  0
  $ drvctl -p wd0 nonexistent || echo not found
  not found


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sbin/drvctl/drvctl.8 src/sbin/drvctl/drvctl.c

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

Modified files:

Index: src/sbin/drvctl/drvctl.8
diff -u src/sbin/drvctl/drvctl.8:1.10 src/sbin/drvctl/drvctl.8:1.11
--- src/sbin/drvctl/drvctl.8:1.10	Mon Apr 20 22:07:23 2009
+++ src/sbin/drvctl/drvctl.8	Sun Aug  7 12:00:11 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: drvctl.8,v 1.10 2009/04/20 22:07:23 wiz Exp $
+.\ $NetBSD: drvctl.8,v 1.11 2011/08/07 12:00:11 jmcneill Exp $
 .\
 .\ Copyright (c) 2004
 .\ 	Matthias Drochner.  All rights reserved.
@@ -24,7 +24,7 @@
 .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\ SUCH DAMAGE.
 .\
-.Dd April 20, 2009
+.Dd August 7, 2011
 .Dt DRVCTL 8
 .Os
 .Sh NAME
@@ -46,6 +46,7 @@
 .Nm
 .Fl p
 .Ar device
+.Op Ar property ...
 .Nm
 .Fl Q
 .Ar device
@@ -96,10 +97,13 @@
 .Fl l
 output.
 .It Fl p
-Get the properties for the device specified by the
+Get properties for the device specified by the
 .Ar device
 argument.
-The properties are displayed as an XML property list.
+If
+.Ar property
+is specified, the value of that property is printed, otherwise
+the properties are displayed as an XML property list.
 .It Fl Q
 Resume the ancestors of
 .Ar device ,
Index: src/sbin/drvctl/drvctl.c
diff -u src/sbin/drvctl/drvctl.c:1.10 src/sbin/drvctl/drvctl.c:1.11
--- src/sbin/drvctl/drvctl.c:1.10	Mon Apr 20 21:41:50 2009
+++ src/sbin/drvctl/drvctl.c	Sun Aug  7 12:00:11 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: drvctl.c,v 1.10 2009/04/20 21:41:50 dyoung Exp $ */
+/* $NetBSD: drvctl.c,v 1.11 2011/08/07 12:00:11 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2004
@@ -26,6 +26,7 @@
  * SUCH DAMAGE.
  */
 
+#include inttypes.h
 #include stdbool.h
 #include stdio.h
 #include stdlib.h
@@ -43,6 +44,7 @@
 	  : O_RDONLY)
 
 static void usage(void);
+static void extract_property(prop_dictionary_t, const char *);
 
 static void
 usage(void)
@@ -51,7 +53,7 @@
 	fprintf(stderr, Usage: %s -r [-a attribute] busdevice [locator ...]\n
 	   %s -d device\n
 	   %s [-n] -l [device]\n
-	   %s -p device\n
+	   %s -p device [prop]\n
 	   %s -Q device\n
 	   %s -R device\n
 	   %s -S device\n,
@@ -219,12 +221,17 @@
 			errx(3, get-properties: failed to return result data);
 		}
 
-		xml = prop_dictionary_externalize(data_dict);
-		prop_object_release(results_dict);
+		if (argc == 1) {
+			xml = prop_dictionary_externalize(data_dict);
+			printf(Properties for device `%s':\n%s,
+			   argv[0], xml);
+			free(xml);
+		} else {
+			for (i = 1; i  argc; i++)
+extract_property(data_dict, argv[i]);
+		}
 
-		printf(Properties for device `%s':\n%s,
-		   argv[0], xml);
-		free(xml);
+		prop_object_release(results_dict);
 		break;
 	default:
 		errx(4, unknown command);
@@ -232,3 +239,50 @@
 
 	return (0);
 }
+
+static void
+extract_property(prop_dictionary_t dict, const char *prop)
+{
+	char *s, *p, *cur, *ep = NULL, *xml;
+	prop_object_t obj;
+
+	s = strdup(prop);
+	p = strtok_r(s, /, ep);
+	while (p) {
+		cur = p;
+		p = strtok_r(NULL, /, ep);
+		if (p) {
+			if (prop_dictionary_get_dict(dict, cur, dict) == false)
+exit(EXIT_FAILURE);
+		} else {
+			obj = prop_dictionary_get(dict, cur);
+			if (obj == NULL)
+exit(EXIT_FAILURE);
+			switch (prop_object_type(obj)) {
+			case PROP_TYPE_BOOL:
+printf(%s\n,
+prop_bool_true(obj) ? true : false);
+break;
+			case PROP_TYPE_NUMBER:
+printf(% PRId64 \n,
+prop_number_integer_value(obj));
+break;
+			case PROP_TYPE_STRING:
+printf(%s\n,
+prop_string_cstring_nocopy(obj));
+break;
+			case PROP_TYPE_DICTIONARY:
+xml = prop_dictionary_externalize(obj);
+printf(%s, xml);
+free(xml);
+break;
+			default:
+fprintf(stderr, unhandled type %d\n,
+prop_object_type(obj));
+exit(EXIT_FAILURE);
+			}
+		}
+	}
+
+	free(s);
+}



CVS commit: src/sbin/drvctl

2011-08-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Aug  7 13:00:35 UTC 2011

Modified Files:
src/sbin/drvctl: drvctl.8 drvctl.c

Log Message:
add the -t option that modifies -l behaviour to recursively scan for
child devices and print them in tree format:

$ drvctl -lt usb0
uhub0
  uhub6
uhidev0
  ukbd0
wskbd1
uhidev1
  ums0
wsmouse1
  uhid0
ubt0


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sbin/drvctl/drvctl.8 src/sbin/drvctl/drvctl.c

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

Modified files:

Index: src/sbin/drvctl/drvctl.8
diff -u src/sbin/drvctl/drvctl.8:1.11 src/sbin/drvctl/drvctl.8:1.12
--- src/sbin/drvctl/drvctl.8:1.11	Sun Aug  7 12:00:11 2011
+++ src/sbin/drvctl/drvctl.8	Sun Aug  7 13:00:35 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: drvctl.8,v 1.11 2011/08/07 12:00:11 jmcneill Exp $
+.\ $NetBSD: drvctl.8,v 1.12 2011/08/07 13:00:35 jmcneill Exp $
 .\
 .\ Copyright (c) 2004
 .\ 	Matthias Drochner.  All rights reserved.
@@ -40,7 +40,7 @@
 .Fl d
 .Ar device
 .Nm
-.Op Fl n
+.Op Fl nt
 .Fl l
 .Op Ar device
 .Nm
@@ -128,6 +128,10 @@
 and
 .Ar device
 itself.
+.It Fl t
+Print a tree of devices in
+.Fl l
+output.
 .El
 .Sh FILES
 .Pa /dev/drvctl
Index: src/sbin/drvctl/drvctl.c
diff -u src/sbin/drvctl/drvctl.c:1.11 src/sbin/drvctl/drvctl.c:1.12
--- src/sbin/drvctl/drvctl.c:1.11	Sun Aug  7 12:00:11 2011
+++ src/sbin/drvctl/drvctl.c	Sun Aug  7 13:00:35 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: drvctl.c,v 1.11 2011/08/07 12:00:11 jmcneill Exp $ */
+/* $NetBSD: drvctl.c,v 1.12 2011/08/07 13:00:35 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2004
@@ -37,7 +37,7 @@
 #include sys/ioctl.h
 #include sys/drvctlio.h
 
-#define OPTS QRSa:dlnpr
+#define OPTS QRSa:dlnprt
 
 #define	OPEN_MODE(mode)			\
 	(((mode) == 'd' || (mode) == 'r') ? O_RDWR			\
@@ -45,6 +45,7 @@
 
 static void usage(void);
 static void extract_property(prop_dictionary_t, const char *);
+static void list_children(int, char *, bool, bool, int);
 
 static void
 usage(void)
@@ -52,7 +53,7 @@
 
 	fprintf(stderr, Usage: %s -r [-a attribute] busdevice [locator ...]\n
 	   %s -d device\n
-	   %s [-n] -l [device]\n
+	   %s [-nt] -l [device]\n
 	   %s -p device [prop]\n
 	   %s -Q device\n
 	   %s -R device\n
@@ -65,16 +66,13 @@
 int
 main(int argc, char **argv)
 {
-	bool nflag = false;
+	bool nflag = false, tflag = false;
 	int c, mode;
 	char *attr = 0;
 	extern char *optarg;
 	extern int optind;
 	int fd, res;
-	size_t children;
 	struct devpmargs paa = {.devname = , .flags = 0};
-	struct devlistargs laa = {.l_devname = , .l_childname = NULL,
-  .l_children = 0};
 	struct devdetachargs daa;
 	struct devrescanargs raa;
 	int *locs, i;
@@ -102,6 +100,9 @@
 		case 'n':
 			nflag = true;
 			break;
+		case 't':
+			tflag = nflag = true;
+			break;
 		case '?':
 		default:
 			usage();
@@ -141,31 +142,7 @@
 			err(3, DRVDETACHDEV);
 		break;
 	case 'l':
-		if (argc == 0)
-			*laa.l_devname = '\0';
-		else
-			strlcpy(laa.l_devname, argv[0], sizeof(laa.l_devname));
-
-		if (ioctl(fd, DRVLISTDEV, laa) == -1)
-			err(3, DRVLISTDEV);
-
-		children = laa.l_children;
-
-		laa.l_childname = malloc(children * sizeof(laa.l_childname[0]));
-		if (laa.l_childname == NULL)
-			err(5, DRVLISTDEV);
-		if (ioctl(fd, DRVLISTDEV, laa) == -1)
-			err(3, DRVLISTDEV);
-		if (laa.l_children  children)
-			err(6, DRVLISTDEV: number of children grew);
-
-		for (i = 0; i  (int)laa.l_children; i++) {
-			if (!nflag) {
-printf(%s ,
-(argc == 0) ? root : laa.l_devname);
-			}
-			printf(%s\n, laa.l_childname[i]);
-		}
+		list_children(fd, argc ? argv[0] : NULL, nflag, tflag, 0);
 		break;
 	case 'r':
 		memset(raa, 0, sizeof(raa));
@@ -286,3 +263,49 @@
 
 	free(s);
 }
+
+static void
+list_children(int fd, char *dvname, bool nflag, bool tflag, int depth)
+{
+	struct devlistargs laa = {.l_devname = , .l_childname = NULL,
+  .l_children = 0};
+	size_t children;
+	int i, n;
+
+	if (dvname == NULL) {
+		if (depth  0)
+			return;
+		*laa.l_devname = '\0';
+	} else {
+		strlcpy(laa.l_devname, dvname, sizeof(laa.l_devname));
+	}
+
+	if (ioctl(fd, DRVLISTDEV, laa) == -1)
+		err(3, DRVLISTDEV);
+
+	children = laa.l_children;
+
+	laa.l_childname = malloc(children * sizeof(laa.l_childname[0]));
+	if (laa.l_childname == NULL)
+		err(5, DRVLISTDEV);
+	if (ioctl(fd, DRVLISTDEV, laa) == -1)
+		err(3, DRVLISTDEV);
+	if (laa.l_children  children)
+		err(6, DRVLISTDEV: number of children grew);
+
+	for (i = 0; i  (int)laa.l_children; i++) {
+		for (n = 0; n  depth; n++)
+			printf(  );
+		if (!nflag) {
+			printf(%s ,
+			(dvname == NULL) ? root : laa.l_devname);
+		}
+		printf(%s\n, laa.l_childname[i]);
+		if (tflag) {
+			list_children(fd, laa.l_childname[i], nflag,
+			tflag, depth + 1);
+		}
+	}
+
+	free(laa.l_childname);
+}



CVS commit: src/sys/dev/usb

2011-08-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Aug  7 13:45:46 UTC 2011

Modified Files:
src/sys/dev/usb: ohci.c

Log Message:
PR# kern/30398: panic in ohci_softintr

If the host controller has a TD that the driver doesn't know about, ignore it
instead of calling panic. Patch from Karl Janmar.


To generate a diff of this commit:
cvs rdiff -u -r1.217 -r1.218 src/sys/dev/usb/ohci.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/dev/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.217 src/sys/dev/usb/ohci.c:1.218
--- src/sys/dev/usb/ohci.c:1.217	Sat Jul 30 20:05:36 2011
+++ src/sys/dev/usb/ohci.c	Sun Aug  7 13:45:46 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.217 2011/07/30 20:05:36 jmcneill Exp $	*/
+/*	$NetBSD: ohci.c,v 1.218 2011/08/07 13:45:46 jmcneill Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $	*/
 
 /*
@@ -41,7 +41,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ohci.c,v 1.217 2011/07/30 20:05:36 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: ohci.c,v 1.218 2011/08/07 13:45:46 jmcneill Exp $);
 
 #include opt_usb.h
 
@@ -1293,7 +1293,9 @@
 			DPRINTFN(5,(add ITD %p\n, sitd));
 			continue;
 		}
-		panic(ohci_softintr: addr 0x%08lx not found, (u_long)done);
+		device_printf(sc-sc_dev, WARNING: addr 0x%08lx not found\n,
+		(u_long)done);
+		break;
 	}
 
 	DPRINTFN(10,(ohci_softintr: sdone=%p sidone=%p\n, sdone, sidone));



CVS commit: src/sys/arch/x86/x86

2011-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Aug  8 11:18:34 UTC 2011

Modified Files:
src/sys/arch/x86/x86: tsc.c

Log Message:
If the USE_PLATFORM_CLOCK flag is set in the FADT, it indicates that OSPM
should use a platform provided timer (either HPET or the PM timer). A
platform may set this flag if internal processor clock(s) cannot provide
consistent monotonically non-decreasing counters. Set TSC quality to -100
if this flag is set.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/x86/x86/tsc.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/x86/x86/tsc.c
diff -u src/sys/arch/x86/x86/tsc.c:1.28 src/sys/arch/x86/x86/tsc.c:1.29
--- src/sys/arch/x86/x86/tsc.c:1.28	Wed Feb  2 12:26:42 2011
+++ src/sys/arch/x86/x86/tsc.c	Mon Aug  8 11:18:34 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: tsc.c,v 1.28 2011/02/02 12:26:42 bouyer Exp $	*/
+/*	$NetBSD: tsc.c,v 1.29 2011/08/08 11:18:34 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tsc.c,v 1.28 2011/02/02 12:26:42 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: tsc.c,v 1.29 2011/08/08 11:18:34 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -45,6 +45,11 @@
 #include machine/cputypes.h
 
 #include tsc.h
+#include acpica.h
+
+#if NACPICA  0
+#include dev/acpi/acpivar.h
+#endif
 
 u_int	tsc_get_timecount(struct timecounter *);
 
@@ -143,6 +148,21 @@
 		safe = false;
 	}
 
+#if NACPICA  0
+	/*
+	 * If the USE_PLATFORM_CLOCK flag is set in the FADT, it indicates
+	 * that OSPM should use a platform provided timer (either HPET or
+	 * the PM timer). A platform may set this flag if internal
+	 * processor clock(s) cannot provide consistent monotonically
+	 * non-decreasing counters.
+	 */
+	if (acpi_active  (AcpiGbl_FADT.Flags  ACPI_FADT_PLATFORM_CLOCK)) {
+		aprint_debug(TSC: ACPI requested platform-provided timer\n);
+		tsc_timecounter.tc_quality = -100;
+		safe = false;
+	}
+#endif
+
 	if (tsc_freq != 0) {
 		tsc_timecounter.tc_frequency = tsc_freq;
 		tc_init(tsc_timecounter);



CVS commit: src/sys/dev/acpi

2011-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Aug  8 11:27:44 UTC 2011

Modified Files:
src/sys/dev/acpi: acpi_timer.c

Log Message:
The absence of USE_PLATFORM_CLOCK does not imply that the PM Timer is
unreliable; in fact, the PM Timer has to be reliable by definition! Remove
the incorrect warning message that was added in r1.19


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/acpi/acpi_timer.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/dev/acpi/acpi_timer.c
diff -u src/sys/dev/acpi/acpi_timer.c:1.20 src/sys/dev/acpi/acpi_timer.c:1.21
--- src/sys/dev/acpi/acpi_timer.c:1.20	Tue Jan  4 04:28:48 2011
+++ src/sys/dev/acpi/acpi_timer.c	Mon Aug  8 11:27:44 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_timer.c,v 1.20 2011/01/04 04:28:48 jruoho Exp $ */
+/* $NetBSD: acpi_timer.c,v 1.21 2011/08/08 11:27:44 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2006 Matthias Drochner droch...@netbsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: acpi_timer.c,v 1.20 2011/01/04 04:28:48 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: acpi_timer.c,v 1.21 2011/08/08 11:27:44 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/systm.h
@@ -55,7 +55,6 @@
 int
 acpitimer_init(struct acpi_softc *sc)
 {
-	const uint32_t flags = AcpiGbl_FADT.Flags;
 	ACPI_STATUS rv;
 	uint32_t bits;
 	int i, j;
@@ -82,10 +81,6 @@
 	aprint_debug_dev(sc-sc_dev, %s %d-bit timer\n,
 	acpi_timecounter.tc_name, bits);
 
-	if ((flags  ACPI_FADT_PLATFORM_CLOCK) == 0)
-		aprint_debug_dev(sc-sc_dev,
-		warning: timer may be unreliable\n);
-
 	return 0;
 }
 



CVS commit: src/sys/arch/x86/x86

2011-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Aug  8 17:00:23 UTC 2011

Modified Files:
src/sys/arch/x86/x86: tsc.c

Log Message:
revert previous


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/x86/x86/tsc.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/x86/x86/tsc.c
diff -u src/sys/arch/x86/x86/tsc.c:1.29 src/sys/arch/x86/x86/tsc.c:1.30
--- src/sys/arch/x86/x86/tsc.c:1.29	Mon Aug  8 11:18:34 2011
+++ src/sys/arch/x86/x86/tsc.c	Mon Aug  8 17:00:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: tsc.c,v 1.29 2011/08/08 11:18:34 jmcneill Exp $	*/
+/*	$NetBSD: tsc.c,v 1.30 2011/08/08 17:00:23 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tsc.c,v 1.29 2011/08/08 11:18:34 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: tsc.c,v 1.30 2011/08/08 17:00:23 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -45,11 +45,6 @@
 #include machine/cputypes.h
 
 #include tsc.h
-#include acpica.h
-
-#if NACPICA  0
-#include dev/acpi/acpivar.h
-#endif
 
 u_int	tsc_get_timecount(struct timecounter *);
 
@@ -148,21 +143,6 @@
 		safe = false;
 	}
 
-#if NACPICA  0
-	/*
-	 * If the USE_PLATFORM_CLOCK flag is set in the FADT, it indicates
-	 * that OSPM should use a platform provided timer (either HPET or
-	 * the PM timer). A platform may set this flag if internal
-	 * processor clock(s) cannot provide consistent monotonically
-	 * non-decreasing counters.
-	 */
-	if (acpi_active  (AcpiGbl_FADT.Flags  ACPI_FADT_PLATFORM_CLOCK)) {
-		aprint_debug(TSC: ACPI requested platform-provided timer\n);
-		tsc_timecounter.tc_quality = -100;
-		safe = false;
-	}
-#endif
-
 	if (tsc_freq != 0) {
 		tsc_timecounter.tc_frequency = tsc_freq;
 		tc_init(tsc_timecounter);



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

2011-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Aug  8 18:57:59 UTC 2011

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

Log Message:
remove dtv (available as a module)


To generate a diff of this commit:
cvs rdiff -u -r1.330 -r1.331 src/sys/arch/amd64/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/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.330 src/sys/arch/amd64/conf/GENERIC:1.331
--- src/sys/arch/amd64/conf/GENERIC:1.330	Mon Aug  8 16:27:46 2011
+++ src/sys/arch/amd64/conf/GENERIC	Mon Aug  8 18:57:58 2011
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.330 2011/08/08 16:27:46 jakllsch Exp $
+# $NetBSD: GENERIC,v 1.331 2011/08/08 18:57:58 jmcneill Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.330 $
+#ident 		GENERIC-$Revision: 1.331 $
 
 maxusers	64		# estimated number of users
 
@@ -1025,7 +1025,7 @@
 pseye* at uhub?		# Sony PLAYSTATION(R) Eye webcam
 uvideo* at uhub?	# USB Video Class capture devices
 video* at videobus?
-dtv* at dtvbus?
+#dtv* at dtvbus?
 
 
 # TV cards
@@ -1035,7 +1035,7 @@
 radio* at bktr?
 
 # Conexant CX2388[0-3]-based DTV cards
-cxdtv* at pci? dev ? function ?
+#cxdtv* at pci? dev ? function ?
 #iic* at cxdtv?
 
 



CVS commit: src

2011-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Aug  8 22:15:42 UTC 2011

Modified Files:
src: Makefile build.sh

Log Message:
add an installmodules=dir command to build.sh


To generate a diff of this commit:
cvs rdiff -u -r1.286 -r1.287 src/Makefile
cvs rdiff -u -r1.244 -r1.245 src/build.sh

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

Modified files:

Index: src/Makefile
diff -u src/Makefile:1.286 src/Makefile:1.287
--- src/Makefile:1.286	Wed Jun 29 02:05:24 2011
+++ src/Makefile	Mon Aug  8 22:15:42 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.286 2011/06/29 02:05:24 mrg Exp $
+#	$NetBSD: Makefile,v 1.287 2011/08/08 22:15:42 jmcneill Exp $
 
 #
 # This is the top-level makefile for building NetBSD. For an outline of
@@ -342,6 +342,29 @@
 	@printf make ${.TARGET} finished at:   date
 
 #
+# Install modules from $DESTDIR to $INSTALLMODULESDIR
+#
+installmodules: .PHONY .MAKE
+.if (!defined(DESTDIR) || ${DESTDIR} ==  || ${DESTDIR} == /)
+	@echo Can't make ${.TARGET} to DESTDIR=/
+	@false
+.endif
+.if !defined(INSTALLMODULESDIR) || \
+${INSTALLMODULESDIR} ==  || ${INSTALLMODULESDIR} == /
+.if (${HOST_UNAME_S} != NetBSD)
+	@echo Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLMODULESDIR=/
+	@false
+.endif
+.if (${HOST_UNAME_M} != ${MACHINE})
+	@echo Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLMODULESDIR=/
+	@false
+.endif
+.endif
+	${MAKEDIRTARGET} sys/modules install DESTDIR=${INSTALLMODULESDIR:*/}
+	@echo   make ${.TARGET} started at:  ${START_TIME}
+	@printf make ${.TARGET} finished at:   date
+
+#
 # Create sets from $DESTDIR or $NETBSDSRCDIR into $RELEASEDIR
 #
 

Index: src/build.sh
diff -u src/build.sh:1.244 src/build.sh:1.245
--- src/build.sh:1.244	Wed Jan 26 01:18:43 2011
+++ src/build.sh	Mon Aug  8 22:15:42 2011
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#	$NetBSD: build.sh,v 1.244 2011/01/26 01:18:43 pooka Exp $
+#	$NetBSD: build.sh,v 1.245 2011/08/08 22:15:42 jmcneill Exp $
 #
 # Copyright (c) 2001-2009 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -258,6 +258,7 @@
 	do_kernel=false
 	do_releasekernel=false
 	do_modules=false
+	do_installmodules=false
 	do_install=false
 	do_sets=false
 	do_sourcesets=false
@@ -618,6 +619,8 @@
 except \`etc'.  Useful after distribution or release
 kernel=conf Build kernel with config file \`conf'
 releasekernel=conf  Install kernel built by kernel=conf to RELEASEDIR.
+installmodules=idir Run make installmodules to \`idir' to install all
+kernel modules.
 modules Build kernel modules.
 rumptestDo a linktest for rump (for developers).
 setsCreate binary sets in
@@ -910,7 +913,7 @@
 			op=modules
 			;;
 
-		install=*)
+		install=*|installmodules=*)
 			arg=${op#*=}
 			op=${op%%=*}
 			[ -n ${arg} ] ||
@@ -1384,7 +1387,7 @@
 	eval cat EOF ${makewrapout}
 #! ${HOST_SH}
 # Set proper variables to allow easy make building of a NetBSD subtree.
-# Generated from:  \$NetBSD: build.sh,v 1.244 2011/01/26 01:18:43 pooka Exp $
+# Generated from:  \$NetBSD: build.sh,v 1.245 2011/08/08 22:15:42 jmcneill Exp $
 # with these arguments: ${_args}
 #
 
@@ -1547,6 +1550,14 @@
 	statusmsg Successful build of kernel modules for NetBSD/${MACHINE} ${DISTRIBVER}
 }
 
+installmodules()
+{
+	dir=$1
+	${runcmd} ${makewrapper} INSTALLMODULESDIR=${dir} installmodules ||
+	bomb Failed to make installmodules to ${dir}
+	statusmsg Successful installmodules to ${dir}
+}
+
 installworld()
 {
 	dir=$1
@@ -1718,6 +1729,16 @@
 			buildmodules
 			;;
 
+		installmodules=*)
+			arg=${op#*=}
+			if [ ${arg} = / ]  \
+			(	[ ${uname_s} != NetBSD ] || \
+[ ${uname_m} != ${MACHINE} ] ); then
+bomb '${op}' must != / for cross builds.
+			fi
+			installmodules ${arg}
+			;;
+
 		install=*)
 			arg=${op#*=}
 			if [ ${arg} = / ]  \



CVS commit: src

2011-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Aug  8 23:18:36 UTC 2011

Modified Files:
src: Makefile

Log Message:
Fix typo that prevented installmodules from working with -U


To generate a diff of this commit:
cvs rdiff -u -r1.287 -r1.288 src/Makefile

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

Modified files:

Index: src/Makefile
diff -u src/Makefile:1.287 src/Makefile:1.288
--- src/Makefile:1.287	Mon Aug  8 22:15:42 2011
+++ src/Makefile	Mon Aug  8 23:18:36 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.287 2011/08/08 22:15:42 jmcneill Exp $
+#	$NetBSD: Makefile,v 1.288 2011/08/08 23:18:36 jmcneill Exp $
 
 #
 # This is the top-level makefile for building NetBSD. For an outline of
@@ -360,7 +360,7 @@
 	@false
 .endif
 .endif
-	${MAKEDIRTARGET} sys/modules install DESTDIR=${INSTALLMODULESDIR:*/}
+	${MAKEDIRTARGET} sys/modules install DESTDIR=${INSTALLMODULESDIR:U/}
 	@echo   make ${.TARGET} started at:  ${START_TIME}
 	@printf make ${.TARGET} finished at:   date
 



CVS commit: src/sys

2011-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug  9 01:42:25 UTC 2011

Modified Files:
src/sys/conf: files
src/sys/dev/dtv: dtv_buffer.c dtv_device.c dtv_math.c dtvif.h dtvvar.h
files.dtv
src/sys/dev/i2c: files.i2c xc3028.c
src/sys/dev/pci: coram.c coramvar.h cxdtv.c cxdtvvar.h
src/sys/dev/usb: auvitek.c auvitek_dtv.c auvitek_video.c auvitekvar.h
emdtv.c emdtv_dtv.c emdtvvar.h
src/sys/modules: Makefile
src/sys/modules/dtv: Makefile
Added Files:
src/sys/modules/dtv_math: Makefile

Log Message:
modify the dtv device api so hardware drivers can be loaded independently
of the dtv module


To generate a diff of this commit:
cvs rdiff -u -r1.1023 -r1.1024 src/sys/conf/files
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/dtv/dtv_buffer.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/dtv/dtv_device.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/dtv/dtv_math.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/dtv/dtvif.h
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/dtv/dtvvar.h
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/dtv/files.dtv
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/i2c/files.i2c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/i2c/xc3028.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/coram.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/coramvar.h \
src/sys/dev/pci/cxdtvvar.h
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/cxdtv.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/usb/auvitek.c \
src/sys/dev/usb/auvitek_video.c src/sys/dev/usb/emdtv_dtv.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/usb/auvitek_dtv.c \
src/sys/dev/usb/emdtvvar.h
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/usb/auvitekvar.h src/sys/dev/usb/emdtv.c
cvs rdiff -u -r1.81 -r1.82 src/sys/modules/Makefile
cvs rdiff -u -r1.3 -r1.4 src/sys/modules/dtv/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/dtv_math/Makefile

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

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.1023 src/sys/conf/files:1.1024
--- src/sys/conf/files:1.1023	Sun Aug  7 13:33:01 2011
+++ src/sys/conf/files	Tue Aug  9 01:42:24 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1023 2011/08/07 13:33:01 rmind Exp $
+#	$NetBSD: files,v 1.1024 2011/08/09 01:42:24 jmcneill Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20100430
@@ -327,6 +327,10 @@
 device	video
 attach	video at videobus
 
+# DTV subsystem
+#
+include dev/dtv/files.dtv
+
 # National Semiconductor LM7[89]
 #
 # (included here so files.i2c can define an attachment)
@@ -1729,8 +1733,3 @@
 # NOR subsytem
 #
 include dev/nor/files.nor
-
-#
-# DTV subsystem
-#
-include dev/dtv/files.dtv

Index: src/sys/dev/dtv/dtv_buffer.c
diff -u src/sys/dev/dtv/dtv_buffer.c:1.6 src/sys/dev/dtv/dtv_buffer.c:1.7
--- src/sys/dev/dtv/dtv_buffer.c:1.6	Sat Jul 16 12:20:01 2011
+++ src/sys/dev/dtv/dtv_buffer.c	Tue Aug  9 01:42:24 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: dtv_buffer.c,v 1.6 2011/07/16 12:20:01 jmcneill Exp $ */
+/* $NetBSD: dtv_buffer.c,v 1.7 2011/08/09 01:42:24 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dtv_buffer.c,v 1.6 2011/07/16 12:20:01 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: dtv_buffer.c,v 1.7 2011/08/09 01:42:24 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -96,9 +96,9 @@
 }
 
 void
-dtv_submit_payload(device_t self, const struct dtv_payload *payload)
+dtv_buffer_submit(void *priv, const struct dtv_payload *payload)
 {
-	struct dtv_softc *sc = device_private(self);
+	struct dtv_softc *sc = priv;
 	struct dtv_ts *ts = sc-sc_ts;
 	const uint8_t *tspkt;
 	unsigned int npkts, i;

Index: src/sys/dev/dtv/dtv_device.c
diff -u src/sys/dev/dtv/dtv_device.c:1.7 src/sys/dev/dtv/dtv_device.c:1.8
--- src/sys/dev/dtv/dtv_device.c:1.7	Sat Jul 16 12:20:01 2011
+++ src/sys/dev/dtv/dtv_device.c	Tue Aug  9 01:42:24 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: dtv_device.c,v 1.7 2011/07/16 12:20:01 jmcneill Exp $ */
+/* $NetBSD: dtv_device.c,v 1.8 2011/08/09 01:42:24 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dtv_device.c,v 1.7 2011/07/16 12:20:01 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: dtv_device.c,v 1.8 2011/08/09 01:42:24 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/conf.h
@@ -301,12 +301,3 @@
 	}
 	mutex_exit(sc-sc_lock);
 }
-
-int
-dtv_print(void *arg, const char *pnp)
-{
-	if (pnp)
-		aprint_normal(dtv at %s, pnp);
-
-	return UNCONF;
-}

Index: src/sys/dev/dtv/dtv_math.c
diff -u src/sys/dev/dtv/dtv_math.c:1.4 src/sys/dev/dtv/dtv_math.c:1.5
--- src/sys/dev/dtv/dtv_math.c:1.4	Sat Jul 16 22:41:59 2011
+++ src/sys/dev/dtv/dtv_math.c	Tue Aug  9 01:42:24 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: dtv_math.c,v 1.4 2011/07/16 22:41:59 apb Exp $ */
+/* $NetBSD: dtv_math.c,v 1.5 2011/08/09 01:42:24 jmcneill Exp $ */
 
 /*-
  * Copyright (c

CVS commit: src/distrib/sets/lists/modules

2011-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug  9 01:42:57 UTC 2011

Modified Files:
src/distrib/sets/lists/modules: md.evbppc mi

Log Message:
add dtv_math module


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/distrib/sets/lists/modules/md.evbppc
cvs rdiff -u -r1.25 -r1.26 src/distrib/sets/lists/modules/mi

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

Modified files:

Index: src/distrib/sets/lists/modules/md.evbppc
diff -u src/distrib/sets/lists/modules/md.evbppc:1.5 src/distrib/sets/lists/modules/md.evbppc:1.6
--- src/distrib/sets/lists/modules/md.evbppc:1.5	Wed Aug  3 01:32:16 2011
+++ src/distrib/sets/lists/modules/md.evbppc	Tue Aug  9 01:42:57 2011
@@ -1,4 +1,4 @@
-# $NetBSD: md.evbppc,v 1.5 2011/08/03 01:32:16 he Exp $
+# $NetBSD: md.evbppc,v 1.6 2011/08/09 01:42:57 jmcneill Exp $
 ./stand/powerpc-4xx		base-kernel-modules	kmod
 ./stand/powerpc-4xx/@OSRELEASE@	base-kernel-modules	kmod
 ./stand/powerpc-4xx/@OSRELEASE@/modules	base-kernel-modules	kmod
@@ -32,6 +32,8 @@
 ./stand/powerpc-4xx/@OSRELEASE@/modules/dtrace/dtrace.kmod		base-kernel-modules	kmod,dtrace
 ./stand/powerpc-4xx/@OSRELEASE@/modules/dtvbase-kernel-modules	kmod
 ./stand/powerpc-4xx/@OSRELEASE@/modules/dtv/dtv.kmod			base-kernel-modules	kmod
+./stand/powerpc-4xx/@OSRELEASE@/modules/dtv_math			base-kernel-modules	kmod
+./stand/powerpc-4xx/@OSRELEASE@/modules/dtv_math/dtv_math.kmod		base-kernel-modules	kmod
 ./stand/powerpc-4xx/@OSRELEASE@/modules/efsbase-kernel-modules	kmod
 ./stand/powerpc-4xx/@OSRELEASE@/modules/efs/efs.kmod			base-kernel-modules	kmod
 ./stand/powerpc-4xx/@OSRELEASE@/modules/exec_script			base-kernel-modules	kmod
@@ -179,6 +181,8 @@
 ./stand/powerpc-booke/@OSRELEASE@/modules/dtrace/dtrace.kmod		base-kernel-modules	kmod,dtrace
 ./stand/powerpc-booke/@OSRELEASE@/modules/dtvbase-kernel-modules	kmod
 ./stand/powerpc-booke/@OSRELEASE@/modules/dtv/dtv.kmod			base-kernel-modules	kmod
+./stand/powerpc-booke/@OSRELEASE@/modules/dtv_math			base-kernel-modules	kmod
+./stand/powerpc-booke/@OSRELEASE@/modules/dtv_math/dtv_math.kmod	base-kernel-modules	kmod
 ./stand/powerpc-booke/@OSRELEASE@/modules/efsbase-kernel-modules	kmod
 ./stand/powerpc-booke/@OSRELEASE@/modules/efs/efs.kmod			base-kernel-modules	kmod
 ./stand/powerpc-booke/@OSRELEASE@/modules/exec_script			base-kernel-modules	kmod

Index: src/distrib/sets/lists/modules/mi
diff -u src/distrib/sets/lists/modules/mi:1.25 src/distrib/sets/lists/modules/mi:1.26
--- src/distrib/sets/lists/modules/mi:1.25	Mon Aug  1 03:56:23 2011
+++ src/distrib/sets/lists/modules/mi	Tue Aug  9 01:42:57 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.25 2011/08/01 03:56:23 pgoyette Exp $
+# $NetBSD: mi,v 1.26 2011/08/09 01:42:57 jmcneill Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -36,6 +36,8 @@
 ./@MODULEDIR@/dtrace/dtrace.kmod		base-kernel-modules	kmod,dtrace
 ./@MODULEDIR@/dtvbase-kernel-modules	kmod
 ./@MODULEDIR@/dtv/dtv.kmod			base-kernel-modules	kmod
+./@MODULEDIR@/dtv_mathbase-kernel-modules	kmod
+./@MODULEDIR@/dtv_math/dtv_math.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/efsbase-kernel-modules	kmod
 ./@MODULEDIR@/efs/efs.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/exec_script			base-kernel-modules	kmod



CVS commit: src/sys/arch

2011-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug  9 02:52:29 UTC 2011

Modified Files:
src/sys/arch/amd64/conf: GENERIC
src/sys/arch/i386/conf: GENERIC

Log Message:
remove commented out entries for emdtv, auvitek, and dtv


To generate a diff of this commit:
cvs rdiff -u -r1.331 -r1.332 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.1045 -r1.1046 src/sys/arch/i386/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/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.331 src/sys/arch/amd64/conf/GENERIC:1.332
--- src/sys/arch/amd64/conf/GENERIC:1.331	Mon Aug  8 18:57:58 2011
+++ src/sys/arch/amd64/conf/GENERIC	Tue Aug  9 02:52:29 2011
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.331 2011/08/08 18:57:58 jmcneill Exp $
+# $NetBSD: GENERIC,v 1.332 2011/08/09 02:52:29 jmcneill Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.331 $
+#ident 		GENERIC-$Revision: 1.332 $
 
 maxusers	64		# estimated number of users
 
@@ -1025,7 +1025,6 @@
 pseye* at uhub?		# Sony PLAYSTATION(R) Eye webcam
 uvideo* at uhub?	# USB Video Class capture devices
 video* at videobus?
-#dtv* at dtvbus?
 
 
 # TV cards

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1045 src/sys/arch/i386/conf/GENERIC:1.1046
--- src/sys/arch/i386/conf/GENERIC:1.1045	Mon Aug  8 18:58:18 2011
+++ src/sys/arch/i386/conf/GENERIC	Tue Aug  9 02:52:29 2011
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1045 2011/08/08 18:58:18 jmcneill Exp $
+# $NetBSD: GENERIC,v 1.1046 2011/08/09 02:52:29 jmcneill Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.1045 $
+#ident 		GENERIC-$Revision: 1.1046 $
 
 maxusers	64		# estimated number of users
 
@@ -1421,10 +1421,7 @@
 
 pseye*	at uhub?		# Sony PLAYSTATION(R) Eye webcam
 uvideo* at uhub?		# USB Video Class capture devices
-#auvitek* at uhub?		# Auvitek AU0828 video capture devices
-#emdtv*	at uhub?		# Empia EM28xx video capture devices
 video* at videobus?
-#dtv* at dtvbus?
 
 
 # TV cards



CVS commit: src/sys/dev

2011-08-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug  9 10:53:10 UTC 2011

Modified Files:
src/sys/dev/i2c: lg3303.c
Added Files:
src/sys/dev/dtv: dtv_math.h

Log Message:
add dtv_math.h


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/dtv/dtv_math.h
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/i2c/lg3303.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/dev/i2c/lg3303.c
diff -u src/sys/dev/i2c/lg3303.c:1.5 src/sys/dev/i2c/lg3303.c:1.6
--- src/sys/dev/i2c/lg3303.c:1.5	Fri Jul 15 20:28:38 2011
+++ src/sys/dev/i2c/lg3303.c	Tue Aug  9 10:53:09 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: lg3303.c,v 1.5 2011/07/15 20:28:38 jmcneill Exp $ */
+/* $NetBSD: lg3303.c,v 1.6 2011/08/09 10:53:09 jmcneill Exp $ */
 
 /*-
  * Copyright 2007 Jason Harmening
@@ -28,7 +28,7 @@
  */
 
 #include sys/param.h
-__KERNEL_RCSID(0, $NetBSD: lg3303.c,v 1.5 2011/07/15 20:28:38 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: lg3303.c,v 1.6 2011/08/09 10:53:09 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/kmem.h
@@ -38,6 +38,7 @@
 #include dev/i2c/i2cvar.h
 #include dev/i2c/lg3303var.h
 #include dev/dtv/dtvif.h
+#include dev/dtv/dtv_math.h
 
 #define REG_TOP_CONTROL 0x00
 #define REG_IRQ_MASK0x01

Added files:

Index: src/sys/dev/dtv/dtv_math.h
diff -u /dev/null src/sys/dev/dtv/dtv_math.h:1.1
--- /dev/null	Tue Aug  9 10:53:10 2011
+++ src/sys/dev/dtv/dtv_math.h	Tue Aug  9 10:53:10 2011
@@ -0,0 +1,40 @@
+/* $NetBSD: dtv_math.h,v 1.1 2011/08/09 10:53:10 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *must display the following acknowledgement:
+ *This product includes software developed by Jared D. McNeill.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *contributors may be used to endorse or promote products derived
+ *from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _DEV_DTV_DTV_MATH_H
+#define _DEV_DTV_DTV_MATH_H
+
+uint32_t	dtv_intlog10(uint32_t);
+
+#endif /* !_DEV_DTV_DTV_MATH_H */



CVS commit: src/sys/dev/i2c

2011-08-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug  9 10:54:22 UTC 2011

Modified Files:
src/sys/dev/i2c: lg3303.c xc3028.c

Log Message:
lg3303 should depend on dtv_math, not xc3028


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/i2c/lg3303.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/i2c/xc3028.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/dev/i2c/lg3303.c
diff -u src/sys/dev/i2c/lg3303.c:1.6 src/sys/dev/i2c/lg3303.c:1.7
--- src/sys/dev/i2c/lg3303.c:1.6	Tue Aug  9 10:53:09 2011
+++ src/sys/dev/i2c/lg3303.c	Tue Aug  9 10:54:22 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: lg3303.c,v 1.6 2011/08/09 10:53:09 jmcneill Exp $ */
+/* $NetBSD: lg3303.c,v 1.7 2011/08/09 10:54:22 jmcneill Exp $ */
 
 /*-
  * Copyright 2007 Jason Harmening
@@ -28,7 +28,7 @@
  */
 
 #include sys/param.h
-__KERNEL_RCSID(0, $NetBSD: lg3303.c,v 1.6 2011/08/09 10:53:09 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: lg3303.c,v 1.7 2011/08/09 10:54:22 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/kmem.h
@@ -351,7 +351,7 @@
 	return (buffer[0]  8) | buffer[1];
 }
 
-MODULE(MODULE_CLASS_DRIVER, lg3303, NULL);
+MODULE(MODULE_CLASS_DRIVER, lg3303, dtv_math);
 
 static int
 lg3303_modcmd(modcmd_t cmd, void *opaque)

Index: src/sys/dev/i2c/xc3028.c
diff -u src/sys/dev/i2c/xc3028.c:1.3 src/sys/dev/i2c/xc3028.c:1.4
--- src/sys/dev/i2c/xc3028.c:1.3	Tue Aug  9 01:42:24 2011
+++ src/sys/dev/i2c/xc3028.c	Tue Aug  9 10:54:22 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: xc3028.c,v 1.3 2011/08/09 01:42:24 jmcneill Exp $ */
+/* $NetBSD: xc3028.c,v 1.4 2011/08/09 10:54:22 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xc3028.c,v 1.3 2011/08/09 01:42:24 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: xc3028.c,v 1.4 2011/08/09 10:54:22 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -564,7 +564,7 @@
 	return 0;
 }
 
-MODULE(MODULE_CLASS_DRIVER, xc3028, dtv_math);
+MODULE(MODULE_CLASS_DRIVER, xc3028, NULL);
 
 static int
 xc3028_modcmd(modcmd_t cmd, void *opaque)



CVS commit: src

2011-08-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug  9 11:12:02 UTC 2011

Modified Files:
src/distrib/sets/lists/modules: md.amd64 md.i386
src/sys/modules: Makefile

Log Message:
include cx24227, lg3303, mt2131, nxt2k, tvpll, xc3028, coram, cxdtv, and emdtv
modules in x86 build


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/distrib/sets/lists/modules/md.amd64
cvs rdiff -u -r1.30 -r1.31 src/distrib/sets/lists/modules/md.i386
cvs rdiff -u -r1.83 -r1.84 src/sys/modules/Makefile

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

Modified files:

Index: src/distrib/sets/lists/modules/md.amd64
diff -u src/distrib/sets/lists/modules/md.amd64:1.26 src/distrib/sets/lists/modules/md.amd64:1.27
--- src/distrib/sets/lists/modules/md.amd64:1.26	Tue Aug  9 08:36:05 2011
+++ src/distrib/sets/lists/modules/md.amd64	Tue Aug  9 11:12:02 2011
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.26 2011/08/09 08:36:05 jruoho Exp $
+# $NetBSD: md.amd64,v 1.27 2011/08/09 11:12:02 jmcneill Exp $
 ./@MODULEDIR@/acpiacadbase-kernel-modules	kmod
 ./@MODULEDIR@/acpiacad/acpiacad.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/acpibatbase-kernel-modules	kmod
@@ -45,8 +45,16 @@
 ./@MODULEDIR@/compat_netbsd32/compat_netbsd32.kmod	base-kernel-modules	kmod
 ./@MODULEDIR@/coretempbase-kernel-modules	kmod
 ./@MODULEDIR@/coretemp/coretemp.kmod		base-kernel-modules	kmod
+./@MODULEDIR@/corambase-kernel-modules	kmod
+./@MODULEDIR@/coram/coram.kmod			base-kernel-modules	kmod
+./@MODULEDIR@/cx24227base-kernel-modules	kmod
+./@MODULEDIR@/cx24227/cx24227.kmod		base-kernel-modules	kmod
+./@MODULEDIR@/cxdtvbase-kernel-modules	kmod
+./@MODULEDIR@/cxdtv/cxdtv.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/drmbase-kernel-modules	kmod
 ./@MODULEDIR@/drm/drm.kmod			base-kernel-modules	kmod
+./@MODULEDIR@/emdtvbase-kernel-modules	kmod
+./@MODULEDIR@/emdtv/emdtv.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/estbase-kernel-modules	kmod
 ./@MODULEDIR@/est/est.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/exec_elf32			base-kernel-modules	kmod
@@ -69,6 +77,12 @@
 ./@MODULEDIR@/i915drm/i915drm.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/itesiobase-kernel-modules	kmod
 ./@MODULEDIR@/itesio/itesio.kmod		base-kernel-modules	kmod
+./@MODULEDIR@/lg3303base-kernel-modules	kmod
+./@MODULEDIR@/lg3303/lg3303.kmod		base-kernel-modules	kmod
+./@MODULEDIR@/mt2131base-kernel-modules	kmod
+./@MODULEDIR@/mt2131/mt2131.kmod		base-kernel-modules	kmod
+./@MODULEDIR@/nxt2kbase-kernel-modules	kmod
+./@MODULEDIR@/nxt2k/nxt2k.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/odcmbase-kernel-modules	kmod
 ./@MODULEDIR@/odcm/odcm.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/padbase-kernel-modules	kmod
@@ -81,6 +95,8 @@
 ./@MODULEDIR@/tprof_amdpmi/tprof_amdpmi.kmod	base-kernel-modules	kmod
 ./@MODULEDIR@/tprof_pmibase-kernel-modules	kmod
 ./@MODULEDIR@/tprof_pmi/tprof_pmi.kmod		base-kernel-modules	kmod
+./@MODULEDIR@/tvpllbase-kernel-modules	kmod
+./@MODULEDIR@/tvpll/tvpll.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/wmidellbase-kernel-modules	kmod
 ./@MODULEDIR@/wmidell/wmidell.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/wmieeepcbase-kernel-modules	kmod
@@ -89,5 +105,7 @@
 ./@MODULEDIR@/wmihp/wmihp.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/wmimsibase-kernel-modules	kmod
 ./@MODULEDIR@/wmimsi/wmimsi.kmod		base-kernel-modules	kmod
+./@MODULEDIR@/xc3028base-kernel-modules	kmod
+./@MODULEDIR@/xc3028/xc3028.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/xc5kbase-kernel-modules	kmod
 ./@MODULEDIR@/xc5k/xc5k.kmod			base-kernel-modules	kmod

Index: src/distrib/sets/lists/modules/md.i386
diff -u src/distrib/sets/lists/modules/md.i386:1.30 src/distrib/sets/lists/modules/md.i386:1.31
--- src/distrib/sets/lists/modules/md.i386:1.30	Sun Jul 31 17:55:41 2011
+++ src/distrib/sets/lists/modules/md.i386	Tue Aug  9 11:12:02 2011
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.30 2011/07/31 17:55:41 jmcneill Exp $
+# $NetBSD: md.i386,v 1.31 2011/08/09 11:12:02 jmcneill Exp $
 ./@MODULEDIR@/acpiacadbase-kernel-modules	kmod
 ./@MODULEDIR@/acpiacad/acpiacad.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/acpibatbase-kernel-modules	kmod
@@ -45,10 +45,18 @@
 ./@MODULEDIR@/compat_linux/compat_linux.kmod	base-kernel-modules	kmod
 ./@MODULEDIR@/compat_svr4			base-kernel-modules	kmod
 ./@MODULEDIR@/compat_svr4/compat_svr4.kmod	base-kernel-modules	kmod
+./@MODULEDIR@/corambase-kernel-modules	kmod
+./@MODULEDIR@/coram/coram.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/coretempbase-kernel-modules	kmod
 ./@MODULEDIR@/coretemp/coretemp.kmod		base-kernel-modules	kmod
+./@MODULEDIR@/cx24227base-kernel-modules	kmod
+./@MODULEDIR@/cx24227/cx24227.kmod		base-kernel-modules	kmod
+./@MODULEDIR@/cxdtvbase-kernel-modules	kmod
+./@MODULEDIR@/cxdtv/cxdtv.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/drm

CVS commit: src/sys/dev/pci

2011-08-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug  9 11:26:40 UTC 2011

Modified Files:
src/sys/dev/pci: cx23885reg.h

Log Message:
add CLK_DELAY


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/cx23885reg.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/dev/pci/cx23885reg.h
diff -u src/sys/dev/pci/cx23885reg.h:1.1 src/sys/dev/pci/cx23885reg.h:1.2
--- src/sys/dev/pci/cx23885reg.h:1.1	Thu Aug  4 14:43:55 2011
+++ src/sys/dev/pci/cx23885reg.h	Tue Aug  9 11:26:40 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cx23885reg.h,v 1.1 2011/08/04 14:43:55 jakllsch Exp $ */
+/* $NetBSD: cx23885reg.h,v 1.2 2011/08/09 11:26:40 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2008, 2011 Jonathan A. Kollasch
@@ -55,6 +55,7 @@
 #define GPIO_ISM		0x110014
 #define SOFT_RESET		0x11001c
 
+#define CLK_DELAY		0x110048
 #define PAD_CTRL		0x11004c
 
 /* Video C Interface */



CVS commit: src/distrib/sets

2011-08-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug  9 15:02:30 UTC 2011

Modified Files:
src/distrib/sets: Makefile

Log Message:
when sorting the metalog for unpriv builds, first run it through sort so
mtree doesn't fail with:
  nbmtree: .: missing directory in specification
  nbmtree: failed at line 1 of the specification


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/distrib/sets/Makefile

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

Modified files:

Index: src/distrib/sets/Makefile
diff -u src/distrib/sets/Makefile:1.83 src/distrib/sets/Makefile:1.84
--- src/distrib/sets/Makefile:1.83	Wed Feb 16 06:14:01 2011
+++ src/distrib/sets/Makefile	Tue Aug  9 15:02:30 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.83 2011/02/16 06:14:01 uebayasi Exp $
+#	$NetBSD: Makefile,v 1.84 2011/08/09 15:02:30 jmcneill Exp $
 
 # Experimental RCS METALOG versioning
 # (Needs host's rcs(1) commands)
@@ -124,7 +124,8 @@
 METALOG.unpriv= -M ${METALOG}.sanitised
 sanitise_METALOG: .PHONY ${METALOG}.sanitised
 ${METALOG}.sanitised: ${METALOG}
-	${TOOL_MTREE} -CSM -k all -N ${NETBSDSRCDIR}/etc ${METALOG} \
+	sort ${METALOG} | \
+	${TOOL_MTREE} -CSM -k all -N ${NETBSDSRCDIR}/etc \
 	${METALOG}.new
 	mv ${METALOG}.new ${METALOG}.sanitised
 .if defined(RCSMETALOG)



CVS commit: src/sys/arch/usermode

2011-08-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Aug 10 01:32:44 UTC 2011

Modified Files:
src/sys/arch/usermode/conf: GENERIC Makefile.usermode
src/sys/arch/usermode/dev: clock.c cpu.c
src/sys/arch/usermode/include: bus.h
src/sys/arch/usermode/usermode: machdep.c pmap.c vm_machdep.c

Log Message:
fix build


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/usermode/conf/GENERIC
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/usermode/conf/Makefile.usermode
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/usermode/dev/clock.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/usermode/dev/cpu.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/include/bus.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/usermode/usermode/machdep.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/usermode/usermode/pmap.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/usermode/usermode/vm_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/usermode/conf/GENERIC
diff -u src/sys/arch/usermode/conf/GENERIC:1.5 src/sys/arch/usermode/conf/GENERIC:1.6
--- src/sys/arch/usermode/conf/GENERIC:1.5	Tue Nov 23 11:14:07 2010
+++ src/sys/arch/usermode/conf/GENERIC	Wed Aug 10 01:32:43 2011
@@ -1,9 +1,9 @@
-# $NetBSD: GENERIC,v 1.5 2010/11/23 11:14:07 hannken Exp $
+# $NetBSD: GENERIC,v 1.6 2011/08/10 01:32:43 jmcneill Exp $
 
 include arch/usermode/conf/std.usermode
 
 options 	INCLUDE_CONFIG_FILE
-#ident 		GENERIC-$Revision: 1.5 $
+#ident 		GENERIC-$Revision: 1.6 $
 maxusers 	32
 makeoptions	DEBUG=-g3
 makeoptions	COPTS=-O2 -fno-omit-frame-pointer
@@ -43,15 +43,3 @@
 ttycons0	at mainbus?
 
 pseudo-device	loop
-pseudo-device	md	
-
-#
-# accept filters
-pseudo-device   accf_data		# dataready accept filter
-pseudo-device   accf_http		# httpready accept filter
-
-options		MEMORY_DISK_HOOKS
-options		MEMORY_DISK_IS_ROOT
-options		MEMORY_DISK_SERVER=0
-options		MEMORY_DISK_ROOT_SIZE=1
-options		MEMORY_DISK_RBFLAGS=RB_SINGLE	# boot in single-user mode

Index: src/sys/arch/usermode/conf/Makefile.usermode
diff -u src/sys/arch/usermode/conf/Makefile.usermode:1.4 src/sys/arch/usermode/conf/Makefile.usermode:1.5
--- src/sys/arch/usermode/conf/Makefile.usermode:1.4	Fri Jan 21 15:59:09 2011
+++ src/sys/arch/usermode/conf/Makefile.usermode	Wed Aug 10 01:32:43 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.usermode,v 1.4 2011/01/21 15:59:09 joerg Exp $
+# $NetBSD: Makefile.usermode,v 1.5 2011/08/10 01:32:43 jmcneill Exp $
 
 MACHINE_ARCH=			usermode
 USETOOLS?=			no
@@ -17,7 +17,7 @@
 ## (2) compile settings
 ##
 DEFCOPTS=	-O2
-CPPFLAGS+=	-Dusermode -Dmalloc=kernmalloc -Dfree=kernfree
+CPPFLAGS+=	-Dusermode
 CPPFLAGS.init_main.c+=	-Dmain=kernmain
 AFLAGS+=	-x assembler-with-cpp
 

Index: src/sys/arch/usermode/dev/clock.c
diff -u src/sys/arch/usermode/dev/clock.c:1.4 src/sys/arch/usermode/dev/clock.c:1.5
--- src/sys/arch/usermode/dev/clock.c:1.4	Fri Nov 27 03:23:14 2009
+++ src/sys/arch/usermode/dev/clock.c	Wed Aug 10 01:32:44 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.4 2009/11/27 03:23:14 rmind Exp $ */
+/* $NetBSD: clock.c,v 1.5 2011/08/10 01:32:44 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,13 +27,14 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.4 2009/11/27 03:23:14 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.5 2011/08/10 01:32:44 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/proc.h
 #include sys/systm.h
 #include sys/device.h
 #include sys/timetc.h
+#include sys/time.h
 
 #include machine/mainbus.h
 

Index: src/sys/arch/usermode/dev/cpu.c
diff -u src/sys/arch/usermode/dev/cpu.c:1.7 src/sys/arch/usermode/dev/cpu.c:1.8
--- src/sys/arch/usermode/dev/cpu.c:1.7	Mon Feb  8 19:02:32 2010
+++ src/sys/arch/usermode/dev/cpu.c	Wed Aug 10 01:32:44 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.7 2010/02/08 19:02:32 joerg Exp $ */
+/* $NetBSD: cpu.c,v 1.8 2011/08/10 01:32:44 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.7 2010/02/08 19:02:32 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.8 2011/08/10 01:32:44 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -43,6 +43,7 @@
 
 #include machine/cpu.h
 #include machine/mainbus.h
+#include machine/pcb.h
 
 #include uvm/uvm_extern.h
 #include uvm/uvm_page.h

Index: src/sys/arch/usermode/include/bus.h
diff -u src/sys/arch/usermode/include/bus.h:1.1 src/sys/arch/usermode/include/bus.h:1.2
--- src/sys/arch/usermode/include/bus.h:1.1	Tue Jan 18 23:03:29 2011
+++ src/sys/arch/usermode/include/bus.h	Wed Aug 10 01:32:44 2011
@@ -0,0 +1,37 @@
+/* $NetBSD: bus.h,v 1.2 2011/08/10 01:32:44 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without

CVS commit: src/sys/compat/common

2011-08-11 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Aug 11 21:23:09 UTC 2011

Modified Files:
src/sys/compat/common: Makefile

Log Message:
add libcompat.o/.po targets for COMPAT_AS=obj


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/compat/common/Makefile

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

Modified files:

Index: src/sys/compat/common/Makefile
diff -u src/sys/compat/common/Makefile:1.46 src/sys/compat/common/Makefile:1.47
--- src/sys/compat/common/Makefile:1.46	Mon Jan 17 15:57:04 2011
+++ src/sys/compat/common/Makefile	Thu Aug 11 21:23:09 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.46 2011/01/17 15:57:04 pooka Exp $
+#	$NetBSD: Makefile,v 1.47 2011/08/11 21:23:09 jmcneill Exp $
 
 LIB=		compat
 NOPIC=		# defined
@@ -57,5 +57,15 @@
 .undef DESTDIR
 .include bsd.lib.mk
 
+lib${LIB}.o:: ${OBJS}
+	@echo building standard ${LIB} library
+	@rm -f lib${LIB}.o
+	@${LD} -r -o lib${LIB}.o `NM=${NM} ${LORDER} ${OBJS} | ${TSORT}`
+
+lib${LIB}.po:: ${POBJS}
+	@echo building profiled ${LIB} library
+	@rm -f lib${LIB}.po
+	@${LD} -r -o lib${LIB}.po `NM=${NM} ${LORDER} ${POBJS} | ${TSORT}`
+
 showsources: ${SRCS}
 	@echo ${.ALLSRC}



CVS commit: src/sys/arch/usermode/usermode

2011-08-11 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Aug 11 22:26:19 UTC 2011

Modified Files:
src/sys/arch/usermode/usermode: pmap.c

Log Message:
pmap_memory isn't a static array anymore so sizeof doesn't work on it


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/usermode/usermode/pmap.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/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.6 src/sys/arch/usermode/usermode/pmap.c:1.7
--- src/sys/arch/usermode/usermode/pmap.c:1.6	Wed Aug 10 01:32:44 2011
+++ src/sys/arch/usermode/usermode/pmap.c	Thu Aug 11 22:26:18 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.6 2011/08/10 01:32:44 jmcneill Exp $ */
+/* $NetBSD: pmap.c,v 1.7 2011/08/11 22:26:18 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.6 2011/08/10 01:32:44 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.7 2011/08/11 22:26:18 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -45,6 +45,7 @@
 struct pmap * const	kernel_pmap_ptr = pmap_kernel_store;
 
 static uint8_t	*pmap_memory;
+static vsize_t	pmap_memory_size = 1024 * MEMSIZE;
 static vaddr_t	virtual_avail, virtual_end;
 static vaddr_t	pmap_maxkvaddr;
 
@@ -53,12 +54,12 @@
 void
 pmap_bootstrap(void)
 {
-	pmap_memory = calloc(1, 1024 * MEMSIZE);
+	pmap_memory = calloc(1, pmap_memory_size);
 	if (pmap_memory == NULL)
 		panic(pmap_bootstrap: no memory);
 
 	virtual_avail = (vaddr_t)pmap_memory;
-	virtual_end = virtual_avail + sizeof(pmap_memory);
+	virtual_end = virtual_avail + pmap_memory_size;
 
 	uvm_page_physload(atop(virtual_avail),
 	atop(virtual_end),



CVS commit: src/sys/conf

2011-08-11 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Aug 11 22:37:57 UTC 2011

Modified Files:
src/sys/conf: Makefile.kern.inc

Log Message:
let md makefile add newvers.sh flags by setting NVFLAGS


To generate a diff of this commit:
cvs rdiff -u -r1.144 -r1.145 src/sys/conf/Makefile.kern.inc

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

Modified files:

Index: src/sys/conf/Makefile.kern.inc
diff -u src/sys/conf/Makefile.kern.inc:1.144 src/sys/conf/Makefile.kern.inc:1.145
--- src/sys/conf/Makefile.kern.inc:1.144	Tue Aug  9 13:02:53 2011
+++ src/sys/conf/Makefile.kern.inc	Thu Aug 11 22:37:57 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.kern.inc,v 1.144 2011/08/09 13:02:53 joerg Exp $
+#	$NetBSD: Makefile.kern.inc,v 1.145 2011/08/11 22:37:57 jmcneill Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -281,9 +281,9 @@
 MKREPRO?=no
 
 .if ${MKREPRO} == yes
-_NVFLAGS=-r
+_NVFLAGS=${NVFLAGS} -r
 .else
-_NVFLAGS=
+_NVFLAGS=${NVFLAGS}
 .endif
 
 .if !target(vers.o)



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

2011-08-11 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Aug 11 22:38:25 UTC 2011

Modified Files:
src/sys/arch/usermode/conf: Makefile.usermode

Log Message:
Instead of trying to override vers.o target, set NVFLAGS=-n


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/usermode/conf/Makefile.usermode

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/usermode/conf/Makefile.usermode
diff -u src/sys/arch/usermode/conf/Makefile.usermode:1.6 src/sys/arch/usermode/conf/Makefile.usermode:1.7
--- src/sys/arch/usermode/conf/Makefile.usermode:1.6	Thu Aug 11 22:30:41 2011
+++ src/sys/arch/usermode/conf/Makefile.usermode	Thu Aug 11 22:38:25 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.usermode,v 1.6 2011/08/11 22:30:41 jmcneill Exp $
+# $NetBSD: Makefile.usermode,v 1.7 2011/08/11 22:38:25 jmcneill Exp $
 
 MACHINE_ARCH=			usermode
 USETOOLS?=			no
@@ -38,13 +38,7 @@
 		${_MKSHECHO}\
 		${CC} ${COPTS} -Wl,-Map,$@.map -o $@ '$${SYSTEM_OBJ}' '$${EXTRA_OBJ}' vers.o; \
 		${CC} ${COPTS} -Wl,-Map,$@.map -o $@ ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
-
-newvers: vers.o
-vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} $S/conf/newvers.sh $S/conf/osrelease.sh
-	${_MKMSG_CREATE} vers.c
-	${HOST_SH} $S/conf/newvers.sh -n ${_NVFLAGS}
-	${_MKTARGET_COMPILE}
-	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
+NVFLAGS=	-n
 
 ##
 ## (6) port specific target dependencies



CVS commit: src/sys/arch/usermode

2011-08-11 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Aug 11 23:04:44 UTC 2011

Modified Files:
src/sys/arch/usermode/conf: GENERIC
src/sys/arch/usermode/dev: cpu.c
src/sys/arch/usermode/include: cpu.h

Log Message:
initialize lwp0 l_addr so we can switch back to it


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/usermode/conf/GENERIC
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/usermode/dev/cpu.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/usermode/include/cpu.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/usermode/conf/GENERIC
diff -u src/sys/arch/usermode/conf/GENERIC:1.7 src/sys/arch/usermode/conf/GENERIC:1.8
--- src/sys/arch/usermode/conf/GENERIC:1.7	Thu Aug 11 22:30:41 2011
+++ src/sys/arch/usermode/conf/GENERIC	Thu Aug 11 23:04:43 2011
@@ -1,11 +1,13 @@
-# $NetBSD: GENERIC,v 1.7 2011/08/11 22:30:41 jmcneill Exp $
+# $NetBSD: GENERIC,v 1.8 2011/08/11 23:04:43 jmcneill Exp $
 
 include arch/usermode/conf/std.usermode
 
 options 	INCLUDE_CONFIG_FILE
-#ident 		GENERIC-$Revision: 1.7 $
+#ident 		GENERIC-$Revision: 1.8 $
 maxusers 	32
 
+makeoptions	DEBUG=-g3
+
 #options 	MEMSIZE=65536	# amount of memory to allocate (in KB)
 options 	MEMSIZE=131072
 
@@ -23,9 +25,6 @@
 
 options		NKMEMPAGES=256
 
-#options 	DDB
-#options 	DDB_HISTORY_SIZE=512
-
 options 	COMPAT_BSDPTY
 options 	COMPAT_50
 

Index: src/sys/arch/usermode/dev/cpu.c
diff -u src/sys/arch/usermode/dev/cpu.c:1.8 src/sys/arch/usermode/dev/cpu.c:1.9
--- src/sys/arch/usermode/dev/cpu.c:1.8	Wed Aug 10 01:32:44 2011
+++ src/sys/arch/usermode/dev/cpu.c	Thu Aug 11 23:04:44 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.8 2011/08/10 01:32:44 jmcneill Exp $ */
+/* $NetBSD: cpu.c,v 1.9 2011/08/11 23:04:44 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.8 2011/08/10 01:32:44 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.9 2011/08/11 23:04:44 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -61,6 +61,8 @@
 	struct cpu_info	*sc_ci;
 } cpu_softc_t;
 
+static ucontext_t lwp0pcb;
+
 CFATTACH_DECL_NEW(cpu, sizeof(cpu_softc_t), cpu_match, cpu_attach, NULL, NULL);
 
 static int
@@ -86,9 +88,11 @@
 	sc-sc_ci = cpu_info_primary;
 	sc-sc_ci-ci_dev = 0;
 	sc-sc_ci-ci_self = cpu_info_primary;
-#if notyet
 	sc-sc_ci-ci_curlwp = lwp0;
-#endif
+
+	if (getcontext(lwp0pcb))
+		panic(getcontext failed);
+	uvm_lwp_setuarea(lwp0, (vaddr_t)lwp0pcb);
 }
 
 void
@@ -133,7 +137,7 @@
 void
 cpu_need_resched(struct cpu_info *ci, int flags)
 {
-	ci-ci_want_resched = 1;
+	ci-ci_want_resched |= flags;
 }
 
 void

Index: src/sys/arch/usermode/include/cpu.h
diff -u src/sys/arch/usermode/include/cpu.h:1.3 src/sys/arch/usermode/include/cpu.h:1.4
--- src/sys/arch/usermode/include/cpu.h:1.3	Wed Oct 21 21:12:04 2009
+++ src/sys/arch/usermode/include/cpu.h	Thu Aug 11 23:04:44 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.3 2009/10/21 21:12:04 rmind Exp $ */
+/* $NetBSD: cpu.h,v 1.4 2011/08/11 23:04:44 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -46,9 +46,7 @@
 	int		ci_want_resched;
 	volatile int	ci_mtx_count;
 	volatile int	ci_mtx_oldspl;
-#if notyet
 	lwp_t		*ci_curlwp;
-#endif
 	lwp_t		*ci_stash;
 };
 



CVS commit: src/sys/arch/usermode

2011-08-11 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Aug 12 00:57:25 UTC 2011

Modified Files:
src/sys/arch/usermode/conf: Makefile.usermode
src/sys/arch/usermode/dev: clock.c cpu.c ttycons.c
src/sys/arch/usermode/include: cpu.h pcb.h
Added Files:
src/sys/arch/usermode/include: thunk.h
src/sys/arch/usermode/usermode: thunk.c

Log Message:
Clean up extern mess by adding an API for kernel components to call libc
functions. thunk.c is built with special cflags that makes it compile
against standard system headers instead of kernel ones.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/usermode/conf/Makefile.usermode
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/usermode/dev/clock.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/usermode/dev/cpu.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/usermode/dev/ttycons.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/usermode/include/cpu.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/usermode/include/pcb.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/usermode/usermode/thunk.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/usermode/conf/Makefile.usermode
diff -u src/sys/arch/usermode/conf/Makefile.usermode:1.7 src/sys/arch/usermode/conf/Makefile.usermode:1.8
--- src/sys/arch/usermode/conf/Makefile.usermode:1.7	Thu Aug 11 22:38:25 2011
+++ src/sys/arch/usermode/conf/Makefile.usermode	Fri Aug 12 00:57:23 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.usermode,v 1.7 2011/08/11 22:38:25 jmcneill Exp $
+# $NetBSD: Makefile.usermode,v 1.8 2011/08/12 00:57:23 jmcneill Exp $
 
 MACHINE_ARCH=			usermode
 USETOOLS?=			no
@@ -18,6 +18,8 @@
 CPPFLAGS+=	-Dusermode
 CPPFLAGS.init_main.c+=	-Dmain=kernmain
 
+CPPFLAGS.thunk.c+=	-U_KERNEL -I/usr/include
+
 ##
 ## (3) libkern and compat
 ##
@@ -27,14 +29,14 @@
 ##
 ## (4) local objects, compile rules, and dependencies
 ##
-MD_OBJS=
-MD_CFILES=
+MD_OBJS=	thunk.o
+MD_CFILES=	${USERMODE}/usermode/thunk.c
 MD_SFILES=
 
 ##
 ## (5) link settings
 ##
-SYSTEM_LD=	@${_MKSHMSG}link  ${.CUTDIR:T}/${.TARGET}; \
+SYSTEM_LD=	@${_MKSHMSG}link  ${.CURDIR:T}/${.TARGET}; \
 		${_MKSHECHO}\
 		${CC} ${COPTS} -Wl,-Map,$@.map -o $@ '$${SYSTEM_OBJ}' '$${EXTRA_OBJ}' vers.o; \
 		${CC} ${COPTS} -Wl,-Map,$@.map -o $@ ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
@@ -44,6 +46,9 @@
 ## (6) port specific target dependencies
 ##
 
+thunk.o: ${USERMODE}/usermode/thunk.c
+	${CC} ${COPTS} -I${.CURDIR} -c -o $@ ${USERMODE}/usermode/thunk.c
+
 ##
 ## (7) misc settings
 ##

Index: src/sys/arch/usermode/dev/clock.c
diff -u src/sys/arch/usermode/dev/clock.c:1.5 src/sys/arch/usermode/dev/clock.c:1.6
--- src/sys/arch/usermode/dev/clock.c:1.5	Wed Aug 10 01:32:44 2011
+++ src/sys/arch/usermode/dev/clock.c	Fri Aug 12 00:57:24 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.5 2011/08/10 01:32:44 jmcneill Exp $ */
+/* $NetBSD: clock.c,v 1.6 2011/08/12 00:57:24 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.5 2011/08/10 01:32:44 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.6 2011/08/12 00:57:24 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -37,6 +37,7 @@
 #include sys/time.h
 
 #include machine/mainbus.h
+#include machine/thunk.h
 
 static int	clock_match(device_t, cfdata_t, void *);
 static void	clock_attach(device_t, device_t, void *);
@@ -48,8 +49,6 @@
 	device_t	sc_dev;
 } clock_softc_t;
 
-extern int	setitimer(int, const struct itimerval *, struct itimerval *);
-
 static struct timecounter clock_timecounter = {
 	clock_getcounter,	/* get_timecount */
 	0,			/* no poll_pps */
@@ -91,7 +90,7 @@
 	itimer.it_interval.tv_sec = 0;
 	itimer.it_interval.tv_usec = 1;
 	itimer.it_value = itimer.it_interval;
-	(void)setitimer(ITIMER_REAL, itimer, NULL);
+	thunk_setitimer(ITIMER_REAL, itimer, NULL);
 
 	tc_init(clock_timecounter);
 }
@@ -114,9 +113,8 @@
 static u_int
 clock_getcounter(struct timecounter *tc)
 {
-	extern int gettimeofday(struct timeval *, void *);
 	struct timeval tv;
 
-	gettimeofday(tv, NULL);
+	thunk_gettimeofday(tv, NULL);
 	return tv.tv_sec * 100 + tv.tv_usec;
 }

Index: src/sys/arch/usermode/dev/cpu.c
diff -u src/sys/arch/usermode/dev/cpu.c:1.9 src/sys/arch/usermode/dev/cpu.c:1.10
--- src/sys/arch/usermode/dev/cpu.c:1.9	Thu Aug 11 23:04:44 2011
+++ src/sys/arch/usermode/dev/cpu.c	Fri Aug 12 00:57:24 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.9 2011/08/11 23:04:44 jmcneill Exp $ */
+/* $NetBSD: cpu.c,v 1.10 2011/08/12 00:57:24 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.9 2011/08/11 23:04:44 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.10 2011/08/12 00:57:24 jmcneill Exp

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

2011-08-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Aug 12 11:22:12 UTC 2011

Modified Files:
src/sys/arch/usermode/conf: GENERIC32 Makefile.usermode

Log Message:
Make GENERIC32 build on amd64


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/conf/GENERIC32
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/usermode/conf/Makefile.usermode

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/usermode/conf/GENERIC32
diff -u src/sys/arch/usermode/conf/GENERIC32:1.1 src/sys/arch/usermode/conf/GENERIC32:1.2
--- src/sys/arch/usermode/conf/GENERIC32:1.1	Sat Dec 29 20:22:25 2007
+++ src/sys/arch/usermode/conf/GENERIC32	Fri Aug 12 11:22:11 2011
@@ -1,9 +1,12 @@
-# $NetBSD: GENERIC32,v 1.1 2007/12/29 20:22:25 reinoud Exp $
+# $NetBSD: GENERIC32,v 1.2 2011/08/12 11:22:11 jmcneill Exp $
 
 include arch/usermode/conf/GENERIC
 
 no options EXEC_ELF64
 
+makeoptions	COPTS+=-m32
+makeoptions	LD=ld -melf_i386
+
 #options 	INCLUDE_CONFIG_FILE
-#ident 		GENERIC32-$Revision: 1.1 $
+#ident 		GENERIC32-$Revision: 1.2 $
 

Index: src/sys/arch/usermode/conf/Makefile.usermode
diff -u src/sys/arch/usermode/conf/Makefile.usermode:1.8 src/sys/arch/usermode/conf/Makefile.usermode:1.9
--- src/sys/arch/usermode/conf/Makefile.usermode:1.8	Fri Aug 12 00:57:23 2011
+++ src/sys/arch/usermode/conf/Makefile.usermode	Fri Aug 12 11:22:11 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.usermode,v 1.8 2011/08/12 00:57:23 jmcneill Exp $
+# $NetBSD: Makefile.usermode,v 1.9 2011/08/12 11:22:11 jmcneill Exp $
 
 MACHINE_ARCH=			usermode
 USETOOLS?=			no
@@ -46,6 +46,12 @@
 ## (6) port specific target dependencies
 ##
 
+.if !make(obj)  !make(clean)  !make(cleandir)
+.BEGIN:
+	@rm -f i386  \
+		ln -s $S/arch/i386/include i386
+.endif
+
 thunk.o: ${USERMODE}/usermode/thunk.c
 	${CC} ${COPTS} -I${.CURDIR} -c -o $@ ${USERMODE}/usermode/thunk.c
 



CVS commit: src/sys/arch/usermode

2011-08-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Aug 12 11:37:05 UTC 2011

Modified Files:
src/sys/arch/usermode/dev: cpu.c
src/sys/arch/usermode/include: thunk.h
src/sys/arch/usermode/usermode: machdep.c thunk.c

Log Message:
implement reboot using execv


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/usermode/dev/cpu.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/usermode/usermode/machdep.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/usermode/thunk.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/usermode/dev/cpu.c
diff -u src/sys/arch/usermode/dev/cpu.c:1.10 src/sys/arch/usermode/dev/cpu.c:1.11
--- src/sys/arch/usermode/dev/cpu.c:1.10	Fri Aug 12 00:57:24 2011
+++ src/sys/arch/usermode/dev/cpu.c	Fri Aug 12 11:37:04 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.10 2011/08/12 00:57:24 jmcneill Exp $ */
+/* $NetBSD: cpu.c,v 1.11 2011/08/12 11:37:04 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.10 2011/08/12 00:57:24 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.11 2011/08/12 11:37:04 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -108,6 +108,8 @@
 void
 cpu_reboot(int howto, char *bootstr)
 {
+	extern void usermode_reboot(void);
+
 	splhigh();
 
 	if ((howto  RB_POWERDOWN) == RB_POWERDOWN)
@@ -124,10 +126,7 @@
 
 	printf(rebooting...\n);
 
-	/*
-	 * XXXJDM If we've panic'd, make sure we dump a core
-	 */
-	thunk_abort();
+	usermode_reboot();
 
 	/* NOTREACHED */
 }

Index: src/sys/arch/usermode/include/thunk.h
diff -u src/sys/arch/usermode/include/thunk.h:1.1 src/sys/arch/usermode/include/thunk.h:1.2
--- src/sys/arch/usermode/include/thunk.h:1.1	Fri Aug 12 00:57:24 2011
+++ src/sys/arch/usermode/include/thunk.h	Fri Aug 12 11:37:04 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.1 2011/08/12 00:57:24 jmcneill Exp $ */
+/* $NetBSD: thunk.h,v 1.2 2011/08/12 11:37:04 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -48,4 +48,6 @@
 int	thunk_getchar(void);
 void	thunk_putchar(int);
 
+int	thunk_execv(const char *, char * const []);
+
 #endif /* !_ARCH_USERMODE_INCLUDE_THUNK_H */

Index: src/sys/arch/usermode/usermode/machdep.c
diff -u src/sys/arch/usermode/usermode/machdep.c:1.10 src/sys/arch/usermode/usermode/machdep.c:1.11
--- src/sys/arch/usermode/usermode/machdep.c:1.10	Wed Aug 10 01:32:44 2011
+++ src/sys/arch/usermode/usermode/machdep.c	Fri Aug 12 11:37:04 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.10 2011/08/10 01:32:44 jmcneill Exp $ */
+/* $NetBSD: machdep.c,v 1.11 2011/08/12 11:37:04 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.10 2011/08/10 01:32:44 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.11 2011/08/12 11:37:04 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -41,6 +41,8 @@
 
 #include dev/mm.h
 
+#include machine/thunk.h
+
 #include opt_memsize.h
 
 char machine[] = usermode;
@@ -50,7 +52,10 @@
 /* XXX */
 int		physmem = MEMSIZE * 1024 / PAGE_SIZE;
 
+static char **saved_argv;
+
 void	main(int argc, char *argv[]);
+void	usermode_reboot(void);
 
 void
 main(int argc, char *argv[])
@@ -60,6 +65,8 @@
 	extern void kernmain(void);
 	int i, j, r, tmpopt = 0;
 
+	saved_argv = argv;
+
 	ttycons_consinit();
 
 	for (i = 1; i  argc; i++) {
@@ -86,6 +93,20 @@
 }
 
 void
+usermode_reboot(void)
+{
+	struct itimerval itimer;
+
+	/* make sure the timer is turned off */
+	memset(itimer, 0, sizeof(itimer));
+	thunk_setitimer(ITIMER_REAL, itimer, NULL);
+
+	if (thunk_execv(saved_argv[0], saved_argv) == -1)
+		thunk_abort();
+	/* NOTREACHED */
+}
+
+void
 setstatclockrate(int arg)
 {
 }

Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.1 src/sys/arch/usermode/usermode/thunk.c:1.2
--- src/sys/arch/usermode/usermode/thunk.c:1.1	Fri Aug 12 00:57:24 2011
+++ src/sys/arch/usermode/usermode/thunk.c	Fri Aug 12 11:37:05 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.1 2011/08/12 00:57:24 jmcneill Exp $ */
+/* $NetBSD: thunk.c,v 1.2 2011/08/12 11:37:05 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: thunk.c,v 1.1 2011/08/12 00:57:24 jmcneill Exp $);
+__RCSID($NetBSD: thunk.c,v 1.2 2011/08/12 11:37:05 jmcneill Exp $);
 
 #include machine/thunk.h
 
@@ -37,6 +37,7 @@
 #include stdlib.h
 #include time.h
 #include ucontext.h
+#include unistd.h
 
 int
 thunk_setitimer(int which, const struct itimerval *value,
@@ -108,3 +109,10 @@
 	putchar(c);
 	fflush(stdout);
 }
+
+int
+thunk_execv(const char *path

CVS commit: src/sys/arch/usermode

2011-08-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Aug 12 12:59:13 UTC 2011

Modified Files:
src/sys/arch/usermode/conf: GENERIC files.usermode majors.usermode
src/sys/arch/usermode/dev: cpu.c mainbus.c
src/sys/arch/usermode/include: mainbus.h thunk.h
src/sys/arch/usermode/usermode: machdep.c thunk.c
Added Files:
src/sys/arch/usermode/dev: ld_thunkbus.c

Log Message:
add a simple disk driver, pass the path to the disk image on the kernel command 
line:

soundwave$ ./netbsd /tmp/test.fs
NetBSD/usermode startup
[...]
ld0 at mainbus0: /tmp/test.fs (33554432)
ld0: 32768 KB, 8322 cyl, 64 head, 63 sec, 1 bytes/sect x 33554432 sectors
boot device: ld0
root on ld0a dumps on ld0b


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/usermode/conf/GENERIC
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/usermode/conf/files.usermode
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/conf/majors.usermode
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/usermode/dev/cpu.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/usermode/dev/ld_thunkbus.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/usermode/dev/mainbus.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/usermode/include/mainbus.h \
src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/usermode/usermode/machdep.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/usermode/usermode/thunk.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/usermode/conf/GENERIC
diff -u src/sys/arch/usermode/conf/GENERIC:1.8 src/sys/arch/usermode/conf/GENERIC:1.9
--- src/sys/arch/usermode/conf/GENERIC:1.8	Thu Aug 11 23:04:43 2011
+++ src/sys/arch/usermode/conf/GENERIC	Fri Aug 12 12:59:13 2011
@@ -1,9 +1,9 @@
-# $NetBSD: GENERIC,v 1.8 2011/08/11 23:04:43 jmcneill Exp $
+# $NetBSD: GENERIC,v 1.9 2011/08/12 12:59:13 jmcneill Exp $
 
 include arch/usermode/conf/std.usermode
 
 options 	INCLUDE_CONFIG_FILE
-#ident 		GENERIC-$Revision: 1.8 $
+#ident 		GENERIC-$Revision: 1.9 $
 maxusers 	32
 
 makeoptions	DEBUG=-g3
@@ -43,5 +43,6 @@
 cpu0		at mainbus?
 clock0		at mainbus?
 ttycons0	at mainbus?
+ld0		at mainbus?
 
 pseudo-device	loop

Index: src/sys/arch/usermode/conf/files.usermode
diff -u src/sys/arch/usermode/conf/files.usermode:1.3 src/sys/arch/usermode/conf/files.usermode:1.4
--- src/sys/arch/usermode/conf/files.usermode:1.3	Sun Jun 12 03:35:48 2011
+++ src/sys/arch/usermode/conf/files.usermode	Fri Aug 12 12:59:13 2011
@@ -1,4 +1,4 @@
-# $NetBSD: files.usermode,v 1.3 2011/06/12 03:35:48 rmind Exp $
+# $NetBSD: files.usermode,v 1.4 2011/08/12 12:59:13 jmcneill Exp $
 
 maxpartitions 8
 maxusers 8 16 64
@@ -23,6 +23,9 @@
 attach	ttycons at thunkbus
 file	arch/usermode/dev/ttycons.c		ttycons
 
+attach	ld at thunkbus with ld_thunkbus
+file	arch/usermode/dev/ld_thunkbus.c		ld_thunkbus
+
 file	arch/usermode/usermode/copy.c
 file	arch/usermode/usermode/machdep.c
 file	arch/usermode/usermode/pmap.c
@@ -33,5 +36,6 @@
 file	arch/usermode/usermode/vm_machdep.c
 file	dev/cons.c
 file	dev/md_root.cmemory_disk_hooks
+file	kern/subr_disk_mbr.c			disk
 
 include arch/usermode/conf/majors.usermode

Index: src/sys/arch/usermode/conf/majors.usermode
diff -u src/sys/arch/usermode/conf/majors.usermode:1.1 src/sys/arch/usermode/conf/majors.usermode:1.2
--- src/sys/arch/usermode/conf/majors.usermode:1.1	Sat Dec 29 14:38:30 2007
+++ src/sys/arch/usermode/conf/majors.usermode	Fri Aug 12 12:59:13 2011
@@ -1,4 +1,4 @@
-# $NetBSD: majors.usermode,v 1.1 2007/12/29 14:38:30 jmcneill Exp $
+# $NetBSD: majors.usermode,v 1.2 2011/08/12 12:59:13 jmcneill Exp $
 
 device-major	cons		char 0
 device-major	ctty		char 1
@@ -10,3 +10,4 @@
 device-major	log		char 7
 device-major	com		char 8			com
 device-major	md		char 24	block 17	md
+device-major	ld		char 69 block 19	ld

Index: src/sys/arch/usermode/dev/cpu.c
diff -u src/sys/arch/usermode/dev/cpu.c:1.11 src/sys/arch/usermode/dev/cpu.c:1.12
--- src/sys/arch/usermode/dev/cpu.c:1.11	Fri Aug 12 11:37:04 2011
+++ src/sys/arch/usermode/dev/cpu.c	Fri Aug 12 12:59:13 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.11 2011/08/12 11:37:04 jmcneill Exp $ */
+/* $NetBSD: cpu.c,v 1.12 2011/08/12 12:59:13 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.11 2011/08/12 11:37:04 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.12 2011/08/12 12:59:13 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -323,8 +323,12 @@
 {
 	device_t rdev;
 
-	rdev = device_find_by_xname(md0);
+	rdev = device_find_by_xname(ld0);
+	if (rdev == NULL)
+		rdev = device_find_by_xname(md0);
 
+	aprint_normal(boot device: %s\n,
+	rdev ? device_xname(rdev) : unknown);
 	setroot(rdev, 0);
 }
 

Index: src/sys/arch/usermode/dev/mainbus.c
diff -u src/sys/arch/usermode/dev/mainbus.c:1.3 src/sys/arch/usermode/dev/mainbus.c:1.4
--- src/sys/arch

CVS commit: src/sys/arch/usermode

2011-08-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 13 10:31:24 UTC 2011

Modified Files:
src/sys/arch/usermode/dev: clock.c cpu.c
src/sys/arch/usermode/include: cpu.h lock.h
src/sys/arch/usermode/usermode: machdep.c pmap.c

Log Message:
- initialize cpu_info_primary early, before cpu0 attaches
- track idepth in cpu_info struct and use it in cpu_intr_p
- for debug and diagnostic kernels, abort when rebooting
- fill in __cpu_simple_lock_* stubs
- splraise(IPL_HIGH) before calling kernmain
- pmap_extract: only return phys addr if pap is not NULL


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/usermode/dev/clock.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/usermode/dev/cpu.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/usermode/include/cpu.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/usermode/include/lock.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/usermode/usermode/machdep.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/usermode/usermode/pmap.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/usermode/dev/clock.c
diff -u src/sys/arch/usermode/dev/clock.c:1.6 src/sys/arch/usermode/dev/clock.c:1.7
--- src/sys/arch/usermode/dev/clock.c:1.6	Fri Aug 12 00:57:24 2011
+++ src/sys/arch/usermode/dev/clock.c	Sat Aug 13 10:31:24 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.6 2011/08/12 00:57:24 jmcneill Exp $ */
+/* $NetBSD: clock.c,v 1.7 2011/08/13 10:31:24 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.6 2011/08/12 00:57:24 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.7 2011/08/13 10:31:24 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -101,13 +101,11 @@
 	extern int usermode_x;
 	struct clockframe cf;
 
-#if notyet
-	/* XXXJDM */
-	if (usermode_x  IPL_SOFTCLOCK)
-		return;
-#endif
+	curcpu()-ci_idepth++;
 
 	hardclock(cf);
+
+	curcpu()-ci_idepth--;
 }
 
 static u_int

Index: src/sys/arch/usermode/dev/cpu.c
diff -u src/sys/arch/usermode/dev/cpu.c:1.12 src/sys/arch/usermode/dev/cpu.c:1.13
--- src/sys/arch/usermode/dev/cpu.c:1.12	Fri Aug 12 12:59:13 2011
+++ src/sys/arch/usermode/dev/cpu.c	Sat Aug 13 10:31:24 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.12 2011/08/12 12:59:13 jmcneill Exp $ */
+/* $NetBSD: cpu.c,v 1.13 2011/08/13 10:31:24 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.12 2011/08/12 12:59:13 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.13 2011/08/13 10:31:24 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -54,7 +54,13 @@
 static int	cpu_match(device_t, cfdata_t, void *);
 static void	cpu_attach(device_t, device_t, void *);
 
-struct cpu_info cpu_info_primary;
+struct cpu_info cpu_info_primary = {
+	.ci_dev = 0,
+	.ci_self = cpu_info_primary,
+	.ci_idepth = -1,
+	.ci_curlwp = lwp0,
+};
+
 char cpu_model[48] = virtual processor;
 
 typedef struct cpu_softc {
@@ -87,9 +93,6 @@
 
 	sc-sc_dev = self;
 	sc-sc_ci = cpu_info_primary;
-	sc-sc_ci-ci_dev = 0;
-	sc-sc_ci-ci_self = cpu_info_primary;
-	sc-sc_ci-ci_curlwp = lwp0;
 
 	if (thunk_getcontext(lwp0pcb))
 		panic(getcontext failed);
@@ -126,6 +129,10 @@
 
 	printf(rebooting...\n);
 
+#if defined(DIAGNOSTIC) || defined(DEBUG)
+	thunk_abort();
+#endif
+
 	usermode_reboot();
 
 	/* NOTREACHED */
@@ -310,6 +317,8 @@
 {
 	char pbuf[9];
 
+	banner();
+
 	printf(%s%s, copyright, version);
 	format_bytes(pbuf, sizeof(pbuf), ptoa(physmem));
 	printf(total memory = %s\n, pbuf);
@@ -335,6 +344,11 @@
 bool
 cpu_intr_p(void)
 {
-	printf(cpu_intr_p\n);
-	return false;
+	int idepth;
+
+	kpreempt_disable();
+	idepth = curcpu()-ci_idepth;
+	kpreempt_enable();
+
+	return (idepth = 0);
 }

Index: src/sys/arch/usermode/include/cpu.h
diff -u src/sys/arch/usermode/include/cpu.h:1.5 src/sys/arch/usermode/include/cpu.h:1.6
--- src/sys/arch/usermode/include/cpu.h:1.5	Fri Aug 12 00:57:24 2011
+++ src/sys/arch/usermode/include/cpu.h	Sat Aug 13 10:31:24 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.5 2011/08/12 00:57:24 jmcneill Exp $ */
+/* $NetBSD: cpu.h,v 1.6 2011/08/13 10:31:24 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -33,7 +33,6 @@
 #include sys/cpu_data.h
 
 #include machine/intrdefs.h
-#include machine/thunk.h
 
 extern void	cpu_signotify(struct lwp *);
 extern void	cpu_need_proftick(struct lwp *);
@@ -45,6 +44,7 @@
 	struct cpu_data	ci_data;
 	u_int		ci_cpuid;
 	int		ci_want_resched;
+	int		ci_idepth;
 	volatile int	ci_mtx_count;
 	volatile int	ci_mtx_oldspl;
 	lwp_t		*ci_curlwp;
@@ -62,6 +62,7 @@
 __inline static void
 usermode_delay(unsigned int ms)
 {
+	extern int thunk_usleep(unsigned int);
 	thunk_usleep(ms);
 }
 

Index: src/sys/arch/usermode/include/lock.h
diff -u src/sys/arch

<    3   4   5   6   7   8   9   10   11   12   >