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

2011-12-30 Thread Martin Husemann
On Thu, Dec 29, 2011 at 08:14:40PM +, Michael Lorenz wrote:
 Module Name:  src
 Committed By: macallan
 Date: Thu Dec 29 20:14:40 UTC 2011
 
 Modified Files:
   src/sys/dev/pci: radeonfb.c
 
 Log Message:
 rework putchar():
 - get rid of engine stalls when using the blitter to draw characters
 - add a wrapper for non-accelerated putchar() so we only wait for the
   engine when we actually want to scribble into video memory
 - rework accelerated putchar(), should work on R3xx now but needs testing

Did you forget to commit some associated header changes? This does not
compile for me...


Martin


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

2011-12-30 Thread Christos Zoulas
In article 20111230110002.c960817...@cvs.netbsd.org,
Reinoud Zandijk source-changes-d@NetBSD.org wrote:
-=-=-=-=-=-

Module Name:   src
Committed By:  reinoud
Date:  Fri Dec 30 11:00:02 UTC 2011

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

Log Message:
Use a wrapper around the send() to make sure it will transmit EVERYTHING and
not just a part of the data


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 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.57
src/sys/arch/usermode/usermode/thunk.c:1.58
--- src/sys/arch/usermode/usermode/thunk.c:1.57Fri Dec 30 09:36:02 2011
+++ src/sys/arch/usermode/usermode/thunk.c Fri Dec 30 11:00:01 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.57 2011/12/30 09:36:02 jmcneill Exp $ */
+/* $NetBSD: thunk.c,v 1.58 2011/12/30 11:00:01 reinoud 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.57 2011/12/30 09:36:02 jmcneill Exp $);
+__RCSID($NetBSD: thunk.c,v 1.58 2011/12/30 11:00:01 reinoud Exp $);
 #endif
 
 #include sys/types.h
@@ -896,6 +896,25 @@ thunk_rfb_open(thunk_rfb_t *rfb, uint16_
 }
 
 static int
+safe_send(int s, const void *msg, size_t len)
+{
+  const uint8_t *p;
+  int sent_len;
+
+  p = msg;
+  while (len) {
+  assert(len = 0);
+  sent_len = send(s, p, len, MSG_NOSIGNAL);
+  if (sent_len  0) 
+  return -1;
+  
+  p   += sent_len;
+  len -= sent_len;
+  }
+  return 0;
+}

- Send returns ssize_t not int
- you should handle EAGAIN/EINTR.

christos



Re: CVS commit: src/sys/arch

2011-12-30 Thread Cherry G. Mathew
On 8 November 2011 05:50, Jean-Yves Migeon jeanyves.mig...@free.fr wrote:
 On 06.11.2011 16:18, Cherry G. Mathew wrote:
 Module Name:  src
 Committed By: cherry
 Date:         Sun Nov  6 15:18:19 UTC 2011

 Modified Files:
       src/sys/arch/amd64/include: pmap.h
       src/sys/arch/i386/include: pmap.h
       src/sys/arch/x86/include: cpu.h
       src/sys/arch/x86/x86: pmap.c
       src/sys/arch/xen/x86: cpu.c x86_xpmap.c

 Log Message:
 [merging from cherry-xenmp] make pmap_kernel() shadow PMD per-cpu and MP
 aware.

 Some comments.

 -#ifdef PAE
 -/* Address of the static kernel's L2 page */
 -pd_entry_t *pmap_kl2pd;
 -paddr_t pmap_kl2paddr;
 -#endif
 -
 -
 [snip]
   #ifdef PAE
 -     uint32_t        ci_pae_l3_pdirpa; /* PA of L3 PD */
 +     paddr_t ci_pae_l3_pdirpa; /* PA of L3 PD */
       pd_entry_t *    ci_pae_l3_pdir; /* VA pointer to L3 PD */
   #endif

 [snip]
 +
 +#if defined(PAE)
 +     ci-ci_pae_l3_pdir = (paddr_t *)uvm_km_alloc(kernel_map, PAGE_SIZE,
 0,
 +         UVM_KMF_WIRED | UVM_KMF_ZERO | UVM_KMF_NOWAIT);
 +
 +     if (ci-ci_pae_l3_pdir == NULL) {
 +             panic(%s: failed to allocate L3 per-cpu PD for CPU %d\n,
 +                   __func__, cpu_index(ci));
 +     }

 Please keep ci_pae_l3_pdir to a uint32_t and back out its paddr_t type.


Done.

Forgot to attribute your suggestion + this thread in the commit log. I
hope this makes up for it :-)
-- 
~Cherry


Re: CVS commit: src/sys/dev/bluetooth

2011-12-30 Thread Iain Hibbert
On Sat, 31 Dec 2011, Radoslaw Kujawa wrote:

 Module Name:  src
 Committed By: rkujawa
 Date: Sat Dec 31 01:16:09 UTC 2011

 Modified Files:
   src/sys/dev/bluetooth: bthidev.c btkbd.c

 Log Message:
 Fix panic triggered by pressing the caps lock key:
 http://c0ff33.net/drop/bt_caps_panic.jpg

this does not seem right - I've never had such a panic, and btkbd should
really be Bluetooth agnostic since its the same as ukbd (except that
ukbd is tied too closely to the USB stack)

btkbd_set_leds() may be called from wskbd directly (by pressing caps lock
on your built-in keyboard for instance)

probably it should be that bt_lock is released in bthidev_input() before
calling the hid_output function..

regards,
iain



CVS commit: src/sys/dev/wscons

2011-12-30 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Dec 30 08:20:50 UTC 2011

Modified Files:
src/sys/dev/wscons: wsconsio.h

Log Message:
Add the Usermode vnc framebuffer and (vnc) remote keyboard types.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/dev/wscons/wsconsio.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/wscons/wsconsio.h
diff -u src/sys/dev/wscons/wsconsio.h:1.101 src/sys/dev/wscons/wsconsio.h:1.102
--- src/sys/dev/wscons/wsconsio.h:1.101	Thu Dec 15 14:25:13 2011
+++ src/sys/dev/wscons/wsconsio.h	Fri Dec 30 08:20:50 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: wsconsio.h,v 1.101 2011/12/15 14:25:13 phx Exp $ */
+/* $NetBSD: wsconsio.h,v 1.102 2011/12/30 08:20:50 reinoud Exp $ */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -106,6 +106,7 @@ struct wscons_event {
 #define	WSKBD_TYPE_BLUETOOTH	21	/* Bluetooth keyboard */
 #define	WSKBD_TYPE_ZAURUS	22	/* Sharp Zaurus keyboard */
 #define	WSKBD_TYPE_LUNA		23	/* OMRON SX-9100 LUNA */
+#define	WSKBD_TYPE_RFB		24	/* Usermode vnc remote keyboard */
 
 /* Manipulate the keyboard bell. */
 struct wskbd_bell_data {
@@ -325,6 +326,7 @@ struct wsmouse_repeat {
 #define WSDISPLAY_TYPE_XVR1000	50	/* Sun XVR-1000 */
 #define WSDISPLAY_TYPE_LUNA	51	/* OMRON SX-9100 LUNA */
 #define WSDISPLAY_TYPE_GRF	52	/* wsdisplay on top of grf(4) */
+#define WSDISPLAY_TYPE_VNC	53	/* Usermode vnc framebuffer */
 
 /* Basic display information.  Not applicable to all display types. */
 struct wsdisplay_fbinfo {



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

2011-12-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Dec 30 08:33:49 UTC 2011

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

Log Message:
Add PA8700.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/hp700/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/hp700/conf/GENERIC
diff -u src/sys/arch/hp700/conf/GENERIC:1.109 src/sys/arch/hp700/conf/GENERIC:1.110
--- src/sys/arch/hp700/conf/GENERIC:1.109	Sun Dec 18 05:49:27 2011
+++ src/sys/arch/hp700/conf/GENERIC	Fri Dec 30 08:33:49 2011
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.109 2011/12/18 05:49:27 dholland Exp $
+# $NetBSD: GENERIC,v 1.110 2011/12/30 08:33:49 skrll Exp $
 #
 # GENERIC machine description file
 #
@@ -23,7 +23,7 @@ include 	arch/hp700/conf/std.hp700
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
 
-#ident 		GENERIC-$Revision: 1.109 $
+#ident 		GENERIC-$Revision: 1.110 $
 
 maxusers	32		# estimated number of users
 
@@ -37,6 +37,7 @@ options 	HP8000_CPU		# PCX-U  (in 32bit 
 options 	HP8200_CPU		# PCX-V/U+ (in 32bit mode)
 options 	HP8500_CPU		# PCX-W  (in 32bit mode)
 options 	HP8600_CPU		# PCX-W+ (in 32bit mode)
+options 	HP8700_CPU		# PCX-W2 (in 32bit mode)
 
 # CPU-related options.
 options 	FPEMUL		# floating point emulation XXX DO NOT REMOVE



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

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

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

Log Message:
send framebuffer updates for cursor changes too


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 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.1 src/sys/arch/usermode/dev/vncfb.c:1.2
--- src/sys/arch/usermode/dev/vncfb.c:1.1	Thu Dec 29 21:22:49 2011
+++ src/sys/arch/usermode/dev/vncfb.c	Fri Dec 30 08:49:53 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: vncfb.c,v 1.1 2011/12/29 21:22:49 jmcneill Exp $ */
+/* $NetBSD: vncfb.c,v 1.2 2011/12/30 08:49:53 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.1 2011/12/29 21:22:49 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.2 2011/12/30 08:49:53 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -63,6 +63,7 @@ struct vncfb_fbops {
 	void	(*copyrows)(void *, int, int, int);
 	void	(*eraserows)(void *, int, int, long);
 	void	(*putchar)(void *, int, int, u_int, long);
+	void	(*cursor)(void *, int, int, int);
 };
 
 struct vncfb_softc {
@@ -94,6 +95,7 @@ static void	vncfb_copycols(void *, int, 
 static void	vncfb_erasecols(void *, int, int, int, long);
 static void	vncfb_copyrows(void *, int, int, int);
 static void	vncfb_eraserows(void *, int, int, long);
+static void	vncfb_cursor(void *, int, int, int);
 
 static int	vncfb_ioctl(void *, void *, u_long, void *, int, lwp_t *);
 static paddr_t	vncfb_mmap(void *, void *, off_t, int);
@@ -269,12 +271,14 @@ vncfb_init_screen(void *priv, struct vco
 	ops-eraserows = ri-ri_ops.eraserows;
 	ops-copycols = ri-ri_ops.copycols;
 	ops-erasecols = ri-ri_ops.erasecols;
+	ops-cursor = ri-ri_ops.cursor;
 
 	ri-ri_ops.copyrows = vncfb_copyrows;
 	ri-ri_ops.copycols = vncfb_copycols;
 	ri-ri_ops.eraserows = vncfb_eraserows;
 	ri-ri_ops.erasecols = vncfb_erasecols;
 	ri-ri_ops.putchar = vncfb_putchar;
+	ri-ri_ops.cursor = vncfb_cursor;
 }
 
 static void
@@ -383,6 +387,30 @@ vncfb_eraserows(void *priv, int row, int
 	vncfb_update(sc, x, y, w, h);
 }
 
+static void
+vncfb_cursor(void *priv, int on, int row, int col)
+{
+	struct rasops_info *ri = priv;
+	struct vcons_screen *scr = ri-ri_hw;
+	struct vncfb_softc *sc = scr-scr_cookie;
+	struct vncfb_fbops *ops = sc-sc_ops;
+	int ox, oy, x, y, w, h;
+
+	w = ri-ri_font-fontwidth;
+	h = ri-ri_font-fontheight;
+
+	ox = ri-ri_ccol * w + ri-ri_xorigin;
+	oy = ri-ri_crow * h + ri-ri_yorigin;
+
+	ops-cursor(ri, on, row, col);
+
+	x = ri-ri_ccol * w + ri-ri_xorigin;
+	y = ri-ri_crow * h + ri-ri_yorigin;
+
+	vncfb_update(sc, ox, oy, w, h);
+	vncfb_update(sc, x, y, w, h);
+}
+
 static int
 vncfb_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, lwp_t *l)
 {



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

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

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

Log Message:
take nrows into account when calculating the update rectangle in vncfb_copyrows


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 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.2 src/sys/arch/usermode/dev/vncfb.c:1.3
--- src/sys/arch/usermode/dev/vncfb.c:1.2	Fri Dec 30 08:49:53 2011
+++ src/sys/arch/usermode/dev/vncfb.c	Fri Dec 30 09:31:44 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: vncfb.c,v 1.2 2011/12/30 08:49:53 jmcneill Exp $ */
+/* $NetBSD: vncfb.c,v 1.3 2011/12/30 09:31:44 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.2 2011/12/30 08:49:53 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.3 2011/12/30 09:31:44 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -359,10 +359,10 @@ vncfb_copyrows(void *priv, int srcrow, i
 	w = ri-ri_width;
 	if (srcrow  dstrow) {
 		y = ri-ri_yorigin + (srcrow * ri-ri_font-fontheight);
-		h = (dstrow - srcrow) * ri-ri_font-fontheight;
+		h = (nrows + (dstrow - srcrow)) * ri-ri_font-fontheight;
 	} else {
 		y = ri-ri_yorigin + (dstrow * ri-ri_font-fontheight);
-		h = (srcrow - dstrow) * ri-ri_font-fontheight;
+		h = (nrows + (srcrow - dstrow)) * ri-ri_font-fontheight;
 	}
 
 	vncfb_update(sc, x, y, w, h);



CVS commit: src/sys/arch/usermode

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

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

Log Message:
optimize rfb updates by allowing queueing of multiple update messages,
dropping duplicates, and transmitting them in batches


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.56 -r1.57 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.47 src/sys/arch/usermode/include/thunk.h:1.48
--- src/sys/arch/usermode/include/thunk.h:1.47	Thu Dec 29 21:22:49 2011
+++ src/sys/arch/usermode/include/thunk.h	Fri Dec 30 09:36:01 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.47 2011/12/29 21:22:49 jmcneill Exp $ */
+/* $NetBSD: thunk.h,v 1.48 2011/12/30 09:36:01 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -191,10 +191,11 @@ typedef struct {
 } thunk_rfb_event_t;
 
 typedef struct {
-	bool			pending;
 	uint16_t		x, y, w, h;
 } thunk_rfb_update_t;
 
+#define THUNK_RFB_QUEUELEN	128
+
 typedef struct {
 	int			sockfd;
 	int			clientfd;
@@ -207,7 +208,8 @@ typedef struct {
 	uint8_t			depth;
 	char			name[64];
 	uint8_t			*framebuf;
-	thunk_rfb_update_t	update;
+	thunk_rfb_update_t	update[THUNK_RFB_QUEUELEN];
+	unsigned int		nupdates;
 } thunk_rfb_t;
 
 int	thunk_rfb_open(thunk_rfb_t *, uint16_t);

Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.56 src/sys/arch/usermode/usermode/thunk.c:1.57
--- src/sys/arch/usermode/usermode/thunk.c:1.56	Thu Dec 29 21:22:49 2011
+++ src/sys/arch/usermode/usermode/thunk.c	Fri Dec 30 09:36:02 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.56 2011/12/29 21:22:49 jmcneill Exp $ */
+/* $NetBSD: thunk.c,v 1.57 2011/12/30 09:36:02 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.56 2011/12/29 21:22:49 jmcneill Exp $);
+__RCSID($NetBSD: thunk.c,v 1.57 2011/12/30 09:36:02 jmcneill Exp $);
 #endif
 
 #include sys/types.h
@@ -970,44 +970,68 @@ thunk_rfb_handshake(thunk_rfb_t *rfb)
 static void
 thunk_rfb_send_pending(thunk_rfb_t *rfb)
 {
+	thunk_rfb_update_t *update;
 	uint8_t rfb_update[16];
-	uint8_t *p = rfb_update;
-	uint16_t x, y, w, h;
+	uint8_t *p;
+	unsigned int n;
 	ssize_t len;
 
-	if (rfb-connected == false || rfb-update.pending == false)
+	if (rfb-connected == false || rfb-nupdates == 0)
 		return;
 
-	x = rfb-update.x;
-	y = rfb-update.y;
-	w = rfb-update.w;
-	h = rfb-update.h;
-	rfb-update.pending = false;
+	/* If we have too many updates queued, just send a single update */
+	if (rfb-nupdates = __arraycount(rfb-update)) {
+		rfb-nupdates = 1;
+		rfb-update[0].x = 0;
+		rfb-update[0].y = 0;
+		rfb-update[0].w = rfb-width;
+		rfb-update[0].h = rfb-height;
+	}
+
+#ifdef RFB_DEBUG
+	fprintf(stdout, rfb: sending %d updates\n, rfb-nupdates);
+#endif
 
+	p = rfb_update;
 	*(uint8_t *)p = 0;		p += 1;		/* FramebufferUpdate */
 	*(uint8_t *)p = 0;		p += 1;		/* padding */
-	*(uint16_t *)p = htons(1);	p += 2;		/* # rects */
-	*(uint16_t *)p = htons(x);	p += 2;
-	*(uint16_t *)p = htons(y);	p += 2;
-	*(uint16_t *)p = htons(w);	p += 2;
-	*(uint16_t *)p = htons(h);	p += 2;
-	*(uint32_t *)p = htonl(0);	p += 4;		/* Raw encoding */
+	*(uint16_t *)p = htons(rfb-nupdates);	p += 2;	/* # rects */
 
-	len = send(rfb-clientfd, rfb_update, sizeof(rfb_update),
-	MSG_NOSIGNAL);
+	len = send(rfb-clientfd, rfb_update, 4, MSG_NOSIGNAL);
 	if (len = 0)
 		goto disco;
 
-	p = rfb-framebuf + (y * rfb-width * (rfb-depth / 8)) +
-	(x * (rfb-depth / 8));
-	while (h--  0) {
-		len = send(rfb-clientfd, p, w * (rfb-depth / 8),
-		MSG_NOSIGNAL);
+	for (n = 0; n  rfb-nupdates; n++) {
+		p = rfb_update;
+		update = rfb-update[n];
+		*(uint16_t *)p = htons(update-x);	p += 2;
+		*(uint16_t *)p = htons(update-y);	p += 2;
+		*(uint16_t *)p = htons(update-w);	p += 2;
+		*(uint16_t *)p = htons(update-h);	p += 2;
+		*(uint32_t *)p = htonl(0);		p += 4;	/* Raw enc */
+
+#ifdef RFB_DEBUG
+		fprintf(stdout, rfb:   [%u] x=%d y=%d w=%d h=%d\n,
+		n, update-x, update-y, update-w, update-h);
+#endif
+
+		len = send(rfb-clientfd, rfb_update, 12, MSG_NOSIGNAL);
 		if (len = 0)
 			goto disco;
-		p += rfb-width * (rfb-depth / 8);
+
+		p = rfb-framebuf + (update-y * rfb-width * (rfb-depth / 8))
+		+ (update-x * (rfb-depth / 8));
+		while (update-h--  0) {
+			len = send(rfb-clientfd, p,
+			update-w * (rfb-depth / 8), MSG_NOSIGNAL);
+			if (len = 0)
+goto disco;
+			p += rfb-width * (rfb-depth / 8);
+		}
 	}
 
+	rfb-nupdates = 0;
+
 	return;
 
 disco:
@@ -1059,6 +1083,7 @@ thunk_rfb_poll(thunk_rfb_t *rfb, thunk_r
 		}
 

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

2011-12-30 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Dec 30 11:00:02 UTC 2011

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

Log Message:
Use a wrapper around the send() to make sure it will transmit EVERYTHING and
not just a part of the data


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 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.57 src/sys/arch/usermode/usermode/thunk.c:1.58
--- src/sys/arch/usermode/usermode/thunk.c:1.57	Fri Dec 30 09:36:02 2011
+++ src/sys/arch/usermode/usermode/thunk.c	Fri Dec 30 11:00:01 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.57 2011/12/30 09:36:02 jmcneill Exp $ */
+/* $NetBSD: thunk.c,v 1.58 2011/12/30 11:00:01 reinoud 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.57 2011/12/30 09:36:02 jmcneill Exp $);
+__RCSID($NetBSD: thunk.c,v 1.58 2011/12/30 11:00:01 reinoud Exp $);
 #endif
 
 #include sys/types.h
@@ -896,6 +896,25 @@ thunk_rfb_open(thunk_rfb_t *rfb, uint16_
 }
 
 static int
+safe_send(int s, const void *msg, size_t len)
+{
+	const uint8_t *p;
+	int sent_len;
+
+	p = msg;
+	while (len) {
+		assert(len = 0);
+		sent_len = send(s, p, len, MSG_NOSIGNAL);
+		if (sent_len  0) 
+			return -1;
+	
+		p   += sent_len;
+		len -= sent_len;
+	}
+	return 0;
+}
+
+static int
 thunk_rfb_server_init(thunk_rfb_t *rfb)
 {
 	char msgbuf[80];
@@ -920,7 +939,7 @@ thunk_rfb_server_init(thunk_rfb_t *rfb)
 	*(uint32_t *)p = htonl(namelen);	p += 4;	/* name length */
 	memcpy(p, rfb-name, namelen);		p += namelen;
 
-	return send(rfb-clientfd, msgbuf, p - msgbuf, MSG_NOSIGNAL);
+	return safe_send(rfb-clientfd, msgbuf, p - msgbuf);
 }
 
 static int
@@ -933,14 +952,14 @@ thunk_rfb_handshake(thunk_rfb_t *rfb)
 	char dummy;
 
 	/* send server protocol version */
-	len = send(rfb-clientfd, protover, strlen(protover), MSG_NOSIGNAL);
-	if (len == -1)
+	len = safe_send(rfb-clientfd, protover, strlen(protover));
+	if (len  0)
 		return errno;
 
 	/* receive client protocol version */
 	do {
 		len = recv(rfb-clientfd, dummy, sizeof(dummy), MSG_NOSIGNAL);
-		if (len == -1)
+		if (len  0)
 			return errno;
 		if (len == 0)
 			return EIO;
@@ -948,20 +967,19 @@ thunk_rfb_handshake(thunk_rfb_t *rfb)
 
 	/* send security capabilities */
 	security_type = htonl(1);	/* no security */
-	len = send(rfb-clientfd, security_type, sizeof(security_type),
-	MSG_NOSIGNAL);
-	if (len == -1)
+	len = safe_send(rfb-clientfd, security_type, sizeof(security_type));
+	if (len  0)
 		return errno;
 
 	/* receive client init message */
 	len = recv(rfb-clientfd, shared_flag, sizeof(shared_flag),
-	MSG_NOSIGNAL);
-	if (len == -1)
+		MSG_NOSIGNAL);
+	if (len = 0)
 		return errno;
 
 	/* send server init message */
 	len = thunk_rfb_server_init(rfb);
-	if (len == -1)
+	if (len  0)
 		return errno;
 
 	return 0;
@@ -974,7 +992,8 @@ thunk_rfb_send_pending(thunk_rfb_t *rfb)
 	uint8_t rfb_update[16];
 	uint8_t *p;
 	unsigned int n;
-	ssize_t len;
+	unsigned int Bpp;
+	ssize_t stride, line_len, len;
 
 	if (rfb-connected == false || rfb-nupdates == 0)
 		return;
@@ -997,10 +1016,12 @@ thunk_rfb_send_pending(thunk_rfb_t *rfb)
 	*(uint8_t *)p = 0;		p += 1;		/* padding */
 	*(uint16_t *)p = htons(rfb-nupdates);	p += 2;	/* # rects */
 
-	len = send(rfb-clientfd, rfb_update, 4, MSG_NOSIGNAL);
-	if (len = 0)
+	len = safe_send(rfb-clientfd, rfb_update, 4);
+	if (len  0)
 		goto disco;
 
+	Bpp = rfb-depth / 8;
+	stride = rfb-width * Bpp;
 	for (n = 0; n  rfb-nupdates; n++) {
 		p = rfb_update;
 		update = rfb-update[n];
@@ -1015,18 +1036,17 @@ thunk_rfb_send_pending(thunk_rfb_t *rfb)
 		n, update-x, update-y, update-w, update-h);
 #endif
 
-		len = send(rfb-clientfd, rfb_update, 12, MSG_NOSIGNAL);
-		if (len = 0)
+		len = safe_send(rfb-clientfd, rfb_update, 12);
+		if (len  0)
 			goto disco;
 
-		p = rfb-framebuf + (update-y * rfb-width * (rfb-depth / 8))
-		+ (update-x * (rfb-depth / 8));
+		p = rfb-framebuf + (update-y * stride) + (update-x * Bpp);
+		line_len = update-w * Bpp;
 		while (update-h--  0) {
-			len = send(rfb-clientfd, p,
-			update-w * (rfb-depth / 8), MSG_NOSIGNAL);
-			if (len = 0)
+			len = safe_send(rfb-clientfd, p, line_len);
+			if (len  0)
 goto disco;
-			p += rfb-width * (rfb-depth / 8);
+			p += stride;
 		}
 	}
 



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

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

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

Log Message:
double SIGIO_MAX_HANDLERS


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 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.11 src/sys/arch/usermode/usermode/intr.c:1.12
--- src/sys/arch/usermode/usermode/intr.c:1.11	Mon Dec 26 22:04:35 2011
+++ src/sys/arch/usermode/usermode/intr.c	Fri Dec 30 11:04:50 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.c,v 1.11 2011/12/26 22:04:35 jmcneill Exp $ */
+/* $NetBSD: intr.c,v 1.12 2011/12/30 11:04:50 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.11 2011/12/26 22:04:35 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.12 2011/12/30 11:04:50 jmcneill Exp $);
 
 #include sys/types.h
 
@@ -39,7 +39,7 @@ struct intr_handler {
 	void *arg;
 };
 
-#define SIGIO_MAX_HANDLERS	2
+#define SIGIO_MAX_HANDLERS	4
 
 static struct intr_handler sigio_intr_handler[SIGIO_MAX_HANDLERS];
 



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

2011-12-30 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Dec 30 11:05:07 UTC 2011

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

Log Message:
Rename variable Bpp to bytes_per_pixel


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 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.58 src/sys/arch/usermode/usermode/thunk.c:1.59
--- src/sys/arch/usermode/usermode/thunk.c:1.58	Fri Dec 30 11:00:01 2011
+++ src/sys/arch/usermode/usermode/thunk.c	Fri Dec 30 11:05:07 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.58 2011/12/30 11:00:01 reinoud Exp $ */
+/* $NetBSD: thunk.c,v 1.59 2011/12/30 11:05:07 reinoud 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.58 2011/12/30 11:00:01 reinoud Exp $);
+__RCSID($NetBSD: thunk.c,v 1.59 2011/12/30 11:05:07 reinoud Exp $);
 #endif
 
 #include sys/types.h
@@ -992,7 +992,7 @@ thunk_rfb_send_pending(thunk_rfb_t *rfb)
 	uint8_t rfb_update[16];
 	uint8_t *p;
 	unsigned int n;
-	unsigned int Bpp;
+	unsigned int bytes_per_pixel;
 	ssize_t stride, line_len, len;
 
 	if (rfb-connected == false || rfb-nupdates == 0)
@@ -1020,8 +1020,8 @@ thunk_rfb_send_pending(thunk_rfb_t *rfb)
 	if (len  0)
 		goto disco;
 
-	Bpp = rfb-depth / 8;
-	stride = rfb-width * Bpp;
+	bytes_per_pixel = rfb-depth / 8;
+	stride = rfb-width * bytes_per_pixel;
 	for (n = 0; n  rfb-nupdates; n++) {
 		p = rfb_update;
 		update = rfb-update[n];
@@ -1040,8 +1040,8 @@ thunk_rfb_send_pending(thunk_rfb_t *rfb)
 		if (len  0)
 			goto disco;
 
-		p = rfb-framebuf + (update-y * stride) + (update-x * Bpp);
-		line_len = update-w * Bpp;
+		p = rfb-framebuf + (update-y * stride) + (update-x * bytes_per_pixel);
+		line_len = update-w * bytes_per_pixel;
 		while (update-h--  0) {
 			len = safe_send(rfb-clientfd, p, line_len);
 			if (len  0)



CVS commit: src/sys/arch/usermode

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

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

Log Message:
use O_ASYNC + SIGIO instead of polling for input


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/usermode/dev/vncfb.c
cvs rdiff -u -r1.59 -r1.60 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.3 src/sys/arch/usermode/dev/vncfb.c:1.4
--- src/sys/arch/usermode/dev/vncfb.c:1.3	Fri Dec 30 09:31:44 2011
+++ src/sys/arch/usermode/dev/vncfb.c	Fri Dec 30 11:06:18 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: vncfb.c,v 1.3 2011/12/30 09:31:44 jmcneill Exp $ */
+/* $NetBSD: vncfb.c,v 1.4 2011/12/30 11:06:18 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.3 2011/12/30 09:31:44 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.4 2011/12/30 11:06:18 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -80,7 +80,7 @@ struct vncfb_softc {
 
 	int			sc_kbd_enable;
 
-	callout_t		sc_callout;
+	void			*sc_ih;
 	void			*sc_sih;
 };
 
@@ -103,7 +103,7 @@ 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_poll(void *);
+static int	vncfb_intr(void *);
 static void	vncfb_softintr(void *);
 
 static int	vncfb_kbd_enable(void *, int);
@@ -188,9 +188,6 @@ vncfb_attach(device_t parent, device_t s
 	(sc-sc_depth / 8), KM_SLEEP);
 	KASSERT(sc-sc_framebuf != NULL);
 
-	callout_init(sc-sc_callout, 0);
-	callout_setfunc(sc-sc_callout, vncfb_poll, sc);
-
 	aprint_naive(\n);
 	aprint_normal(: %ux%u %ubpp (port %u)\n,
 	sc-sc_width, sc-sc_height, sc-sc_depth, taa-u.vnc.port);
@@ -208,7 +205,7 @@ vncfb_attach(device_t parent, device_t s
 		panic(couldn't open rfb server);
 
 	sc-sc_sih = softint_establish(SOFTINT_SERIAL, vncfb_softintr, sc);
-	callout_schedule(sc-sc_callout, 1);
+	sc-sc_ih = sigio_intr_establish(vncfb_intr, sc);
 
 	vcons_init(sc-sc_vd, sc, vncfb_defaultscreen, vncfb_accessops);
 	sc-sc_vd.init_screen = vncfb_init_screen;
@@ -455,14 +452,17 @@ static void
 vncfb_update(struct vncfb_softc *sc, int x, int y, int w, int h)
 {
 	thunk_rfb_update(sc-sc_rfb, x, y, w, h);
+	softint_schedule(sc-sc_sih);
 }
 
-static void
-vncfb_poll(void *priv)
+static int
+vncfb_intr(void *priv)
 {
 	struct vncfb_softc *sc = priv;
 
 	softint_schedule(sc-sc_sih);
+
+	return 0;
 }
 
 static void
@@ -486,8 +486,6 @@ vncfb_softintr(void *priv)
 			break;
 		}
 	}
-
-	callout_schedule(sc-sc_callout, 1);
 }
 
 static int

Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.59 src/sys/arch/usermode/usermode/thunk.c:1.60
--- src/sys/arch/usermode/usermode/thunk.c:1.59	Fri Dec 30 11:05:07 2011
+++ src/sys/arch/usermode/usermode/thunk.c	Fri Dec 30 11:06:18 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.59 2011/12/30 11:05:07 reinoud Exp $ */
+/* $NetBSD: thunk.c,v 1.60 2011/12/30 11:06:18 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.59 2011/12/30 11:05:07 reinoud Exp $);
+__RCSID($NetBSD: thunk.c,v 1.60 2011/12/30 11:06:18 jmcneill Exp $);
 #endif
 
 #include sys/types.h
@@ -1077,6 +1077,7 @@ thunk_rfb_poll(thunk_rfb_t *rfb, thunk_r
 		struct sockaddr_in sin;
 		struct pollfd fds[1];
 		socklen_t sinlen;
+		int flags;
 
 		/* poll for connections */
 		fds[0].fd = rfb-sockfd;
@@ -1103,6 +1104,19 @@ thunk_rfb_poll(thunk_rfb_t *rfb, thunk_r
 		}
 
 		rfb-connected = true;
+
+		/* enable sigio on input */
+		flags = fcntl(rfb-clientfd, F_GETFL, 0);
+		fcntl(rfb-clientfd, F_SETFL, flags | O_ASYNC);
+		error = fcntl(rfb-clientfd, F_SETOWN, getpid());
+		if (error) {
+			fprintf(stdout, rfb: setown failed: %s\n,
+			strerror(errno));
+			close(rfb-clientfd);
+			rfb-clientfd = -1;
+			return -1;
+		}
+
 		rfb-nupdates = 0;
 		thunk_rfb_update(rfb, 0, 0, rfb-width, rfb-height);
 	}



CVS commit: src/sys/arch/usermode

2011-12-30 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Dec 30 11:32:57 UTC 2011

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

Log Message:
Add RFB type flag to indicate what kind of request is waiting


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.60 -r1.61 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.48 src/sys/arch/usermode/include/thunk.h:1.49
--- src/sys/arch/usermode/include/thunk.h:1.48	Fri Dec 30 09:36:01 2011
+++ src/sys/arch/usermode/include/thunk.h	Fri Dec 30 11:32:57 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.48 2011/12/30 09:36:01 jmcneill Exp $ */
+/* $NetBSD: thunk.h,v 1.49 2011/12/30 11:32:57 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -190,9 +190,15 @@ typedef struct {
 	} data;
 } thunk_rfb_event_t;
 
+
 typedef struct {
+	uint8_t			type;
 	uint16_t		x, y, w, h;
+	uint32_t		colour;		/* for RRE clear */
 } thunk_rfb_update_t;
+#define THUNK_RFB_TYPE_UPDATE	0
+#define THUNK_RFB_TYPE_COPYRECT	1
+#define THUNK_RFB_TYPE_RRE	2		/* rectangle fill */
 
 #define THUNK_RFB_QUEUELEN	128
 
@@ -208,8 +214,10 @@ typedef struct {
 	uint8_t			depth;
 	char			name[64];
 	uint8_t			*framebuf;
-	thunk_rfb_update_t	update[THUNK_RFB_QUEUELEN];
+
 	unsigned int		nupdates;
+	unsigned int		first_mergable;
+	thunk_rfb_update_t	update[THUNK_RFB_QUEUELEN];
 } thunk_rfb_t;
 
 int	thunk_rfb_open(thunk_rfb_t *, uint16_t);

Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.60 src/sys/arch/usermode/usermode/thunk.c:1.61
--- src/sys/arch/usermode/usermode/thunk.c:1.60	Fri Dec 30 11:06:18 2011
+++ src/sys/arch/usermode/usermode/thunk.c	Fri Dec 30 11:32:57 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.60 2011/12/30 11:06:18 jmcneill Exp $ */
+/* $NetBSD: thunk.c,v 1.61 2011/12/30 11:32:57 reinoud 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.60 2011/12/30 11:06:18 jmcneill Exp $);
+__RCSID($NetBSD: thunk.c,v 1.61 2011/12/30 11:32:57 reinoud Exp $);
 #endif
 
 #include sys/types.h
@@ -76,6 +76,8 @@ __RCSID($NetBSD: thunk.c,v 1.60 2011/12
 #define MAP_ANON MAP_ANONYMOUS
 #endif
 
+#define RFB_DEBUG
+
 extern int boothowto;
 
 void
@@ -1051,6 +1053,7 @@ thunk_rfb_send_pending(thunk_rfb_t *rfb)
 	}
 
 	rfb-nupdates = 0;
+	rfb-first_mergable = 0;
 
 	return;
 
@@ -1118,6 +1121,7 @@ thunk_rfb_poll(thunk_rfb_t *rfb, thunk_r
 		}
 
 		rfb-nupdates = 0;
+		rfb-first_mergable = 0;
 		thunk_rfb_update(rfb, 0, 0, rfb-width, rfb-height);
 	}
 
@@ -1191,7 +1195,7 @@ thunk_rfb_update(thunk_rfb_t *rfb, int x
 		return;
 
 	/* no sense in queueing duplicate updates */
-	for (n = 0; n  rfb-nupdates; n++) {
+	for (n = rfb-first_mergable; n  rfb-nupdates; n++) {
 		if (rfb-update[n].x == x  rfb-update[n].y == y 
 		rfb-update[n].w == w  rfb-update[n].h == h)
 			return;
@@ -1204,6 +1208,7 @@ thunk_rfb_update(thunk_rfb_t *rfb, int x
 
 	/* add the update request to the queue */
 	update = rfb-update[rfb-nupdates++];
+	update-type = THUNK_RFB_TYPE_UPDATE;
 	update-x = x;
 	update-y = y;
 	update-w = w;



CVS commit: src/sys/arch/usermode

2011-12-30 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Dec 30 12:07:34 UTC 2011

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

Log Message:
Use the encoding values of the VNC spec and add a copyrect (not used yet)


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.61 -r1.62 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.49 src/sys/arch/usermode/include/thunk.h:1.50
--- src/sys/arch/usermode/include/thunk.h:1.49	Fri Dec 30 11:32:57 2011
+++ src/sys/arch/usermode/include/thunk.h	Fri Dec 30 12:07:33 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.49 2011/12/30 11:32:57 reinoud Exp $ */
+/* $NetBSD: thunk.h,v 1.50 2011/12/30 12:07:33 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -192,11 +192,12 @@ typedef struct {
 
 
 typedef struct {
-	uint8_t			type;
+	uint8_t			enc;
 	uint16_t		x, y, w, h;
+	uint16_t		srcx, srcy;
 	uint32_t		colour;		/* for RRE clear */
 } thunk_rfb_update_t;
-#define THUNK_RFB_TYPE_UPDATE	0
+#define THUNK_RFB_TYPE_RAW	0
 #define THUNK_RFB_TYPE_COPYRECT	1
 #define THUNK_RFB_TYPE_RRE	2		/* rectangle fill */
 
@@ -223,5 +224,6 @@ 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_update(thunk_rfb_t *, int, int, int, int);
+void	thunk_rfb_copyrect(thunk_rfb_t *, int, int, int, int, int, int);
 
 #endif /* !_ARCH_USERMODE_INCLUDE_THUNK_H */

Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.61 src/sys/arch/usermode/usermode/thunk.c:1.62
--- src/sys/arch/usermode/usermode/thunk.c:1.61	Fri Dec 30 11:32:57 2011
+++ src/sys/arch/usermode/usermode/thunk.c	Fri Dec 30 12:07:33 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.61 2011/12/30 11:32:57 reinoud Exp $ */
+/* $NetBSD: thunk.c,v 1.62 2011/12/30 12:07:33 reinoud 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.61 2011/12/30 11:32:57 reinoud Exp $);
+__RCSID($NetBSD: thunk.c,v 1.62 2011/12/30 12:07:33 reinoud Exp $);
 #endif
 
 #include sys/types.h
@@ -1031,11 +1031,15 @@ thunk_rfb_send_pending(thunk_rfb_t *rfb)
 		*(uint16_t *)p = htons(update-y);	p += 2;
 		*(uint16_t *)p = htons(update-w);	p += 2;
 		*(uint16_t *)p = htons(update-h);	p += 2;
-		*(uint32_t *)p = htonl(0);		p += 4;	/* Raw enc */
+		*(uint32_t *)p = htonl(update-enc);	p += 4;	/* Raw enc */
 
 #ifdef RFB_DEBUG
-		fprintf(stdout, rfb:   [%u] x=%d y=%d w=%d h=%d\n,
-		n, update-x, update-y, update-w, update-h);
+		fprintf(stdout, rfb: [%u] enc %d, [%d, %d] - [%d, %d),
+		n, update-enc, update-x, update-y, update-w, update-h);
+		if (update-enc == THUNK_RFB_TYPE_COPYRECT)
+			fprintf(stdout,  from [%d, %d],
+			update-srcx, update-srcy);
+		fprintf(stdout, \n);
 #endif
 
 		len = safe_send(rfb-clientfd, rfb_update, 12);
@@ -1202,15 +1206,43 @@ thunk_rfb_update(thunk_rfb_t *rfb, int x
 	}
 
 #ifdef RFB_DEBUG
-	fprintf(stdout, rfb: queue slot %d, x=%d y=%d w=%d h=%d\n,
+	fprintf(stdout, rfb: update queue slot %d, x=%d y=%d w=%d h=%d\n,
 	rfb-nupdates, x, y, w, h);
 #endif
 
 	/* add the update request to the queue */
 	update = rfb-update[rfb-nupdates++];
-	update-type = THUNK_RFB_TYPE_UPDATE;
+	update-enc = THUNK_RFB_TYPE_RAW;
 	update-x = x;
 	update-y = y;
 	update-w = w;
 	update-h = h;
 }
+
+void
+thunk_rfb_copyrect(thunk_rfb_t *rfb, int x, int y, int w, int h,
+	int srcx, int srcy)
+{
+	thunk_rfb_update_t *update = NULL;
+
+	/* if the queue is full, just return */
+	if (rfb-nupdates = __arraycount(rfb-update))
+		return;
+
+#ifdef RFB_DEBUG
+	fprintf(stdout, rfb: copyrect queue slot %d, x=%d y=%d w=%d h=%d\n,
+	rfb-nupdates, x, y, w, h);
+#endif
+
+	/* add the update request to the queue */
+	update = rfb-update[rfb-nupdates++];
+	update-enc = THUNK_RFB_TYPE_COPYRECT;
+	update-x = x;
+	update-y = y;
+	update-w = w;
+	update-h = h;
+	update-srcx = srcx;
+	update-srcy = srcy;
+
+	rfb-first_mergable = rfb-nupdates+1;
+}



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

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

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

Log Message:
print key event info if RFB_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 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.62 src/sys/arch/usermode/usermode/thunk.c:1.63
--- src/sys/arch/usermode/usermode/thunk.c:1.62	Fri Dec 30 12:07:33 2011
+++ src/sys/arch/usermode/usermode/thunk.c	Fri Dec 30 12:13:31 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.62 2011/12/30 12:07:33 reinoud Exp $ */
+/* $NetBSD: thunk.c,v 1.63 2011/12/30 12:13:31 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.62 2011/12/30 12:07:33 reinoud Exp $);
+__RCSID($NetBSD: thunk.c,v 1.63 2011/12/30 12:13:31 jmcneill Exp $);
 #endif
 
 #include sys/types.h
@@ -1163,6 +1163,11 @@ thunk_rfb_poll(thunk_rfb_t *rfb, thunk_r
 		event-data.key_event.down_flag = key_event[0];
 		event-data.key_event.keysym =
 		ntohl(*(uint32_t *)key_event[3]);
+#ifdef RFB_DEBUG
+		fprintf(stdout, rfb: key %04x %s\n,
+		event-data.key_event.keysym,
+		event-data.key_event.down_flag ? pressed : released);
+#endif
 		msg_len = 0;
 		break;
 	case THUNK_RFB_POINTER_EVENT:



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/xen/x86

2011-12-30 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Fri Dec 30 12:16:19 UTC 2011

Modified Files:
src/sys/arch/xen/x86: xen_ipi.c

Log Message:
Remove spurious (debug) printf()


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/xen/x86/xen_ipi.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/xen/x86/xen_ipi.c
diff -u src/sys/arch/xen/x86/xen_ipi.c:1.8 src/sys/arch/xen/x86/xen_ipi.c:1.9
--- src/sys/arch/xen/x86/xen_ipi.c:1.8	Wed Dec 28 18:59:21 2011
+++ src/sys/arch/xen/x86/xen_ipi.c	Fri Dec 30 12:16:19 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: xen_ipi.c,v 1.8 2011/12/28 18:59:21 cherry Exp $ */
+/* $NetBSD: xen_ipi.c,v 1.9 2011/12/30 12:16:19 cherry Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -33,10 +33,10 @@
 
 /* 
  * Based on: x86/ipi.c
- * __KERNEL_RCSID(0, $NetBSD: xen_ipi.c,v 1.8 2011/12/28 18:59:21 cherry Exp $); 
+ * __KERNEL_RCSID(0, $NetBSD: xen_ipi.c,v 1.9 2011/12/30 12:16:19 cherry Exp $); 
  */
 
-__KERNEL_RCSID(0, $NetBSD: xen_ipi.c,v 1.8 2011/12/28 18:59:21 cherry Exp $);
+__KERNEL_RCSID(0, $NetBSD: xen_ipi.c,v 1.9 2011/12/30 12:16:19 cherry Exp $);
 
 #include sys/types.h
 
@@ -289,7 +289,6 @@ xc_send_ipi(struct cpu_info *ci)
 
 	KASSERT(kpreempt_disabled());
 	KASSERT(curcpu() != ci);
-	printf(xc_send_ipi called \n);
 	if (ci) {
 		if (0 != xen_send_ipi(ci, XEN_IPI_XCALL)) {
 			panic(xen_send_ipi(XEN_IPI_XCALL) failed\n);



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

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

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

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


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

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

Modified files:

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



CVS commit: src/sys/arch/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 Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Dec 30 13:08:30 UTC 2011

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

Log Message:
Implement VNC's copyrect sending and let the copyrows use the new
vncfb_copyrecs()


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/usermode/dev/vncfb.c
cvs rdiff -u -r1.64 -r1.65 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.5 src/sys/arch/usermode/dev/vncfb.c:1.6
--- src/sys/arch/usermode/dev/vncfb.c:1.5	Fri Dec 30 12:54:41 2011
+++ src/sys/arch/usermode/dev/vncfb.c	Fri Dec 30 13:08:30 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: vncfb.c,v 1.5 2011/12/30 12:54:41 jmcneill Exp $ */
+/* $NetBSD: vncfb.c,v 1.6 2011/12/30 13:08:30 reinoud 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.5 2011/12/30 12:54:41 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.6 2011/12/30 13:08:30 reinoud Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -103,6 +103,7 @@ 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 int	vncfb_intr(void *);
 static void	vncfb_softintr(void *);
 
@@ -349,21 +350,21 @@ vncfb_copyrows(void *priv, int srcrow, i
 	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, srcx, srcy;
+	int fontheight;
 
 	ops-copyrows(ri, srcrow, dstrow, nrows);
 
+	fontheight = ri-ri_font-fontheight;
 	x = ri-ri_xorigin;
+	y = ri-ri_yorigin + dstrow * fontheight;
 	w = ri-ri_width;
-	if (srcrow  dstrow) {
-		y = ri-ri_yorigin + (srcrow * ri-ri_font-fontheight);
-		h = (nrows + (dstrow - srcrow)) * ri-ri_font-fontheight;
-	} else {
-		y = ri-ri_yorigin + (dstrow * ri-ri_font-fontheight);
-		h = (nrows + (srcrow - dstrow)) * ri-ri_font-fontheight;
-	}
+	h = nrows * fontheight;
 
-	vncfb_update(sc, x, y, w, h);
+	srcx = ri-ri_xorigin;
+	srcy = ri-ri_yorigin + srcrow * fontheight;
+
+	vncfb_copyrect(sc, x, y, w, h, srcx, srcy);
 }
 
 static void
@@ -456,6 +457,14 @@ vncfb_update(struct vncfb_softc *sc, int
 	softint_schedule(sc-sc_sih);
 }
 
+static void
+vncfb_copyrect(struct vncfb_softc *sc, int x, int y, int w, int h,
+	int srcx, int srcy)
+{
+	thunk_rfb_copyrect(sc-sc_rfb, x, y, w, h, srcx, srcy);
+	softint_schedule(sc-sc_sih);
+}
+
 static int
 vncfb_intr(void *priv)
 {

Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.64 src/sys/arch/usermode/usermode/thunk.c:1.65
--- src/sys/arch/usermode/usermode/thunk.c:1.64	Fri Dec 30 12:54:42 2011
+++ src/sys/arch/usermode/usermode/thunk.c	Fri Dec 30 13:08:30 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.64 2011/12/30 12:54:42 jmcneill Exp $ */
+/* $NetBSD: thunk.c,v 1.65 2011/12/30 13:08:30 reinoud 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.64 2011/12/30 12:54:42 jmcneill Exp $);
+__RCSID($NetBSD: thunk.c,v 1.65 2011/12/30 13:08:30 reinoud Exp $);
 #endif
 
 #include sys/types.h
@@ -76,6 +76,8 @@ __RCSID($NetBSD: thunk.c,v 1.64 2011/12
 #define MAP_ANON MAP_ANONYMOUS
 #endif
 
+//#define RFB_DEBUG
+
 extern int boothowto;
 
 void
@@ -989,7 +991,7 @@ static void
 thunk_rfb_send_pending(thunk_rfb_t *rfb)
 {
 	thunk_rfb_update_t *update;
-	uint8_t rfb_update[16];
+	uint8_t buf[32];
 	uint8_t *p;
 	unsigned int n;
 	unsigned int bytes_per_pixel;
@@ -1011,28 +1013,28 @@ thunk_rfb_send_pending(thunk_rfb_t *rfb)
 	fprintf(stdout, rfb: sending %d updates\n, rfb-nupdates);
 #endif
 
-	p = rfb_update;
+	p = buf;
 	*(uint8_t *)p = 0;		p += 1;		/* FramebufferUpdate */
 	*(uint8_t *)p = 0;		p += 1;		/* padding */
 	*(uint16_t *)p = htons(rfb-nupdates);	p += 2;	/* # rects */
 
-	len = safe_send(rfb-clientfd, rfb_update, 4);
+	len = safe_send(rfb-clientfd, buf, 4);
 	if (len  0)
 		goto disco;
 
 	bytes_per_pixel = rfb-depth / 8;
 	stride = rfb-width * bytes_per_pixel;
 	for (n = 0; n  rfb-nupdates; n++) {
-		p = rfb_update;
+		p = buf;
 		update = rfb-update[n];
 		*(uint16_t *)p = htons(update-x);	p += 2;
 		*(uint16_t *)p = htons(update-y);	p += 2;
 		*(uint16_t *)p = htons(update-w);	p += 2;
 		*(uint16_t *)p = htons(update-h);	p += 2;
-		*(uint32_t *)p = htonl(update-enc);	p += 4;	/* Raw enc */
+		*(uint32_t *)p = htonl(update-enc);	p += 4;	/* encoding */
 
 #ifdef RFB_DEBUG
-		fprintf(stdout, rfb: [%u] enc %d, [%d, %d] 

CVS commit: src/share/man/man4

2011-12-30 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Fri Dec 30 14:12:15 UTC 2011

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

Log Message:
Document that overflow in P[X+k:n] terminates a filter program.
Based on a discussion with Christos on source-changes-d.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/share/man/man4/bpf.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/bpf.4
diff -u src/share/man/man4/bpf.4:1.48 src/share/man/man4/bpf.4:1.49
--- src/share/man/man4/bpf.4:1.48	Tue Dec 27 21:47:04 2011
+++ src/share/man/man4/bpf.4	Fri Dec 30 14:12:15 2011
@@ -1,6 +1,6 @@
 .\ -*- nroff -*-
 .\
-.\	$NetBSD: bpf.4,v 1.48 2011/12/27 21:47:04 wiz Exp $
+.\	$NetBSD: bpf.4,v 1.49 2011/12/30 14:12:15 alnsn Exp $
 .\
 .\ Copyright (c) 1990, 1991, 1992, 1993, 1994
 .\	The Regents of the University of California.  All rights reserved.
@@ -515,6 +515,8 @@ halfword
 .Sy ( BPF_H ) ,
 or byte
 .Sy ( BPF_B ) .
+Arithmetic overflow when calculating a variable offset terminates
+the filter program and the packet is ignored.
 The semantics of all the recognized BPF_LD instructions follow.
 .Bl -column BPF_LD_BPF_W_BPF_ABS A \*[Lt]- P[k:4] -offset indent
 .It Sy BPF_LD+BPF_W+BPF_ABS Ta A \*[Lt]- P[k:4]



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
--- 

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/dev/pci

2011-12-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Dec 30 14:32:31 UTC 2011

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

Log Message:
this should have been committed along with the previous changes in
radeonfb.c


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/radeonfbvar.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/radeonfbvar.h
diff -u src/sys/dev/pci/radeonfbvar.h:1.11 src/sys/dev/pci/radeonfbvar.h:1.12
--- src/sys/dev/pci/radeonfbvar.h:1.11	Sun Feb  6 23:25:17 2011
+++ src/sys/dev/pci/radeonfbvar.h	Fri Dec 30 14:32:31 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: radeonfbvar.h,v 1.11 2011/02/06 23:25:17 jmcneill Exp $ */
+/* $NetBSD: radeonfbvar.h,v 1.12 2011/12/30 14:32:31 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -209,7 +209,7 @@ struct radeon_tmds_pll {
 };
 
 struct radeonfb_softc {
-	struct device		sc_dev;
+	device_t		sc_dev;
 	uint16_t		sc_family;
 	uint16_t		sc_flags;
 	pcireg_t		sc_id;
@@ -343,7 +343,7 @@ struct radeonfb_softc {
 #define	GETBIOS32(sc, r)	\
 	((GETBIOS16(sc, (r) + 2)  16) | GETBIOS16(sc, (r)))
 
-#define	XNAME(sc)	device_xname(sc-sc_dev)
+#define	XNAME(sc)	device_xname(sc-sc_dev)
 
 #define	DIVIDE(x,y)	(((x) + (y / 2)) / (y))
 



CVS commit: xsrc/xfree/xc/programs/Xserver

2011-12-30 Thread Ignatios Souvatzis
Module Name:xsrc
Committed By:   is
Date:   Fri Dec 30 16:48:04 UTC 2011

Modified Files:
xsrc/xfree/xc/programs/Xserver/fb: fbpict.c
xsrc/xfree/xc/programs/Xserver/mi: miarc.c misprite.c

Log Message:
This fix is taken from xorg-server 1.9.2.

mod(a,b) used to be defined with a - in front of naked a, such that uses
of mod with certain arithmetic expressions as a led to surprising results,
namely the one in Xrender praised in CVE-2010-1166.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 xsrc/xfree/xc/programs/Xserver/fb/fbpict.c
cvs rdiff -u -r1.1.1.5 -r1.2 xsrc/xfree/xc/programs/Xserver/mi/miarc.c \
xsrc/xfree/xc/programs/Xserver/mi/misprite.c

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

Modified files:

Index: xsrc/xfree/xc/programs/Xserver/fb/fbpict.c
diff -u xsrc/xfree/xc/programs/Xserver/fb/fbpict.c:1.4 xsrc/xfree/xc/programs/Xserver/fb/fbpict.c:1.5
--- xsrc/xfree/xc/programs/Xserver/fb/fbpict.c:1.4	Sat Apr 19 19:00:39 2008
+++ xsrc/xfree/xc/programs/Xserver/fb/fbpict.c	Fri Dec 30 16:48:04 2011
@@ -908,7 +908,7 @@ fbCompositeSolidMask_nx1xn (CARD8  o
 	  0x0);
 }
 
-# define mod(a,b)	((b) == 1 ? 0 : (a) = 0 ? (a) % (b) : (b) - (-a) % (b))
+# define mod(a,b)	((b) == 1 ? 0 : (a) = 0 ? (a) % (b) : (b) - (-(a)) % (b))
 
 void
 fbComposite (CARD8  op,

Index: xsrc/xfree/xc/programs/Xserver/mi/miarc.c
diff -u xsrc/xfree/xc/programs/Xserver/mi/miarc.c:1.1.1.5 xsrc/xfree/xc/programs/Xserver/mi/miarc.c:1.2
--- xsrc/xfree/xc/programs/Xserver/mi/miarc.c:1.1.1.5	Fri Mar  5 14:29:39 2004
+++ xsrc/xfree/xc/programs/Xserver/mi/miarc.c	Fri Dec 30 16:48:04 2011
@@ -1554,7 +1554,7 @@ miRoundCap(
 
 # define Dsin(d)	((d) == 0.0 ? 0.0 : ((d) == 90.0 ? 1.0 : sin(d*M_PI/180.0)))
 # define Dcos(d)	((d) == 0.0 ? 1.0 : ((d) == 90.0 ? 0.0 : cos(d*M_PI/180.0)))
-# define mod(a,b)	((a) = 0 ? (a) % (b) : (b) - (-a) % (b))
+# define mod(a,b)	((a) = 0 ? (a) % (b) : (b) - (-(a)) % (b))
 
 static double
 miDcos (double a)
Index: xsrc/xfree/xc/programs/Xserver/mi/misprite.c
diff -u xsrc/xfree/xc/programs/Xserver/mi/misprite.c:1.1.1.5 xsrc/xfree/xc/programs/Xserver/mi/misprite.c:1.2
--- xsrc/xfree/xc/programs/Xserver/mi/misprite.c:1.1.1.5	Fri Feb 28 13:20:27 2003
+++ xsrc/xfree/xc/programs/Xserver/mi/misprite.c	Fri Dec 30 16:48:04 2011
@@ -1978,7 +1978,7 @@ miSpriteLineHelper()
 
 #ifdef RENDER
 
-# define mod(a,b)	((b) == 1 ? 0 : (a) = 0 ? (a) % (b) : (b) - (-a) % (b))
+# define mod(a,b)	((b) == 1 ? 0 : (a) = 0 ? (a) % (b) : (b) - (-(a)) % (b))
 
 static void
 miSpritePictureOverlap (PicturePtr  pPict,



CVS commit: src/sys/arch

2011-12-30 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Fri Dec 30 16:55:21 UTC 2011

Modified Files:
src/sys/arch/x86/x86: pmap.c
src/sys/arch/xen/include: xenpmap.h
src/sys/arch/xen/x86: cpu.c xen_pmap.c

Log Message:
per-cpu shadow directory pages should be updated locally via cross-calls. Do 
this.


To generate a diff of this commit:
cvs rdiff -u -r1.147 -r1.148 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/xen/include/xenpmap.h
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/xen/x86/cpu.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/xen/x86/xen_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/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.147 src/sys/arch/x86/x86/pmap.c:1.148
--- src/sys/arch/x86/x86/pmap.c:1.147	Fri Dec  9 17:32:51 2011
+++ src/sys/arch/x86/x86/pmap.c	Fri Dec 30 16:55:21 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.147 2011/12/09 17:32:51 chs Exp $	*/
+/*	$NetBSD: pmap.c,v 1.148 2011/12/30 16:55:21 cherry Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.147 2011/12/09 17:32:51 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.148 2011/12/30 16:55:21 cherry Exp $);
 
 #include opt_user_ldt.h
 #include opt_lockdebug.h
@@ -1915,16 +1915,7 @@ pmap_free_ptp(struct pmap *pmap, struct 
 			 * Update the per-cpu PD on all cpus the current
 			 * pmap is active on 
 			 */ 
-			CPU_INFO_ITERATOR cii;
-			struct cpu_info *ci;
-			for (CPU_INFO_FOREACH(cii, ci)) {
-if (ci == NULL) {
-	continue;
-}
-if (ci-ci_cpumask  pmap-pm_cpus) {
-	pmap_pte_set(ci-ci_kpm_pdir[index], 0);
-}
-			}
+			xen_kpm_sync(pmap, index);
 		}
 #  endif /*__x86_64__ */
 		invaladdr = level == 1 ? (vaddr_t)ptes :
@@ -2029,17 +2020,7 @@ pmap_get_ptp(struct pmap *pmap, vaddr_t 
 			 * Update the per-cpu PD on all cpus the current
 			 * pmap is active on 
 			 */ 
-			CPU_INFO_ITERATOR cii;
-			struct cpu_info *ci;
-			for (CPU_INFO_FOREACH(cii, ci)) {
-if (ci == NULL) {
-	continue;
-}
-if (ci-ci_cpumask  pmap-pm_cpus) {
-	pmap_pte_set(ci-ci_kpm_pdir[index],
-		 (pd_entry_t) (pmap_pa2pte(pa) | PG_u | PG_RW | PG_V));
-}
-			}
+			xen_kpm_sync(pmap, index);
 		}
 #endif /* XEN  __x86_64__ */
 		pmap_pte_flush();
@@ -4247,33 +4228,14 @@ pmap_alloc_level(pd_entry_t * const *pde
 			pmap_get_physpage(va, level - 1, pa);
 			pte = pmap_pa2pte(pa) | PG_k | PG_V | PG_RW;
 #ifdef XEN
-			switch (level) {
-			case PTP_LEVELS: 
+			xpq_queue_pte_update(xpmap_ptetomach(pdep[i]), pte);
+			if (level == PTP_LEVELS) {
 #if defined(PAE) || defined(__x86_64__)
 if (i = PDIR_SLOT_KERN) {
 	/* update per-cpu PMDs on all cpus */
-	CPU_INFO_ITERATOR cii;
-	struct cpu_info *ci;
-	for (CPU_INFO_FOREACH(cii, ci)) {
-		if (ci == NULL) {
-			continue;
-		}
-#ifdef PAE
-		xpq_queue_pte_update(
-			xpmap_ptetomach(ci-ci_kpm_pdir[l2tol2(i)]), pte);
-#elif defined(__x86_64__)
-		xpq_queue_pte_update(
-			xpmap_ptetomach(ci-ci_kpm_pdir[i]), pte);
-#endif /* PAE */
-	}
+	xen_kpm_sync(pmap_kernel(), i);
 }
 #endif /* PAE || __x86_64__ */
-/* FALLTHROUGH */
-
-			default: /* All other levels */
-xpq_queue_pte_update(
-	xpmap_ptetomach(pdep[i]), 
-	pte);
 			}
 #else /* XEN */
 			pdep[i] = pte;

Index: src/sys/arch/xen/include/xenpmap.h
diff -u src/sys/arch/xen/include/xenpmap.h:1.32 src/sys/arch/xen/include/xenpmap.h:1.33
--- src/sys/arch/xen/include/xenpmap.h:1.32	Wed Nov 23 00:56:56 2011
+++ src/sys/arch/xen/include/xenpmap.h	Fri Dec 30 16:55:21 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: xenpmap.h,v 1.32 2011/11/23 00:56:56 jym Exp $	*/
+/*	$NetBSD: xenpmap.h,v 1.33 2011/12/30 16:55:21 cherry Exp $	*/
 
 /*
  *
@@ -61,6 +61,10 @@ void	pmap_map_recursive_entries(void);
 void	pmap_unmap_recursive_entries(void);
 #endif /* PAE */
 
+#if defined(PAE) || defined(__x86_64__)
+void xen_kpm_sync(struct pmap *, int);
+#endif /* PAE || __x86_64__ */
+
 #define xpq_queue_pin_l1_table(pa)	\
 	xpq_queue_pin_table(pa, MMUEXT_PIN_L1_TABLE)
 #define xpq_queue_pin_l2_table(pa)	\

Index: src/sys/arch/xen/x86/cpu.c
diff -u src/sys/arch/xen/x86/cpu.c:1.71 src/sys/arch/xen/x86/cpu.c:1.72
--- src/sys/arch/xen/x86/cpu.c:1.71	Wed Dec  7 15:47:43 2011
+++ src/sys/arch/xen/x86/cpu.c	Fri Dec 30 16:55:21 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.71 2011/12/07 15:47:43 cegger Exp $	*/
+/*	$NetBSD: cpu.c,v 1.72 2011/12/30 16:55:21 cherry Exp $	*/
 /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp  */
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.71 2011/12/07 15:47:43 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.72 2011/12/30 16:55:21 cherry Exp $);
 
 #include opt_ddb.h
 #include opt_multiprocessor.h
@@ -1102,6 +1102,7 @@ static struct 

CVS commit: src/sys/arch

2011-12-30 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Fri Dec 30 17:57:49 UTC 2011

Modified Files:
src/sys/arch/i386/i386: machdep.c
src/sys/arch/i386/include: cpu.h
src/sys/arch/x86/include: cpu.h
src/sys/arch/x86/x86: pmap.c

Log Message:
Move the per-cpu l3 page allocation code to a separate MD function. Avoids code 
duplication for xen PAE


To generate a diff of this commit:
cvs rdiff -u -r1.714 -r1.715 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.177 -r1.178 src/sys/arch/i386/include/cpu.h
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.148 -r1.149 src/sys/arch/x86/x86/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/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.714 src/sys/arch/i386/i386/machdep.c:1.715
--- src/sys/arch/i386/i386/machdep.c:1.714	Tue Nov 29 11:12:26 2011
+++ src/sys/arch/i386/i386/machdep.c	Fri Dec 30 17:57:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.714 2011/11/29 11:12:26 martin Exp $	*/
+/*	$NetBSD: machdep.c,v 1.715 2011/12/30 17:57:49 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.714 2011/11/29 11:12:26 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.715 2011/12/30 17:57:49 cherry Exp $);
 
 #include opt_beep.h
 #include opt_compat_ibcs2.h
@@ -1917,3 +1917,38 @@ mm_md_open(dev_t dev, int flag, int mode
 	}
 	return 0;
 }
+
+#ifdef PAE
+void
+cpu_alloc_l3_page(struct cpu_info *ci)
+{
+	int ret;
+	struct pglist pg;
+	struct vm_page *vmap;
+
+	KASSERT(ci != NULL);
+	/*
+	 * Allocate a page for the per-CPU L3 PD. cr3 being 32 bits, PA musts
+	 * resides below the 4GB boundary.
+	 */
+	ret = uvm_pglistalloc(PAGE_SIZE, 0, 0x1ULL, 32, 0, pg, 1, 0);
+	vmap = TAILQ_FIRST(pg);
+
+	if (ret != 0 || vmap == NULL)
+		panic(%s: failed to allocate L3 pglist for CPU %d (ret %d)\n,
+			__func__, cpu_index(ci), ret);
+
+	ci-ci_pae_l3_pdirpa = vmap-phys_addr;
+
+	ci-ci_pae_l3_pdir = (paddr_t *)uvm_km_alloc(kernel_map, PAGE_SIZE, 0,
+		UVM_KMF_VAONLY | UVM_KMF_NOWAIT);
+	if (ci-ci_pae_l3_pdir == NULL)
+		panic(%s: failed to allocate L3 PD for CPU %d\n,
+			__func__, cpu_index(ci));
+
+	pmap_kenter_pa((vaddr_t)ci-ci_pae_l3_pdir, ci-ci_pae_l3_pdirpa,
+		VM_PROT_READ | VM_PROT_WRITE, 0);
+
+	pmap_update(pmap_kernel());
+}
+#endif /* PAE */

Index: src/sys/arch/i386/include/cpu.h
diff -u src/sys/arch/i386/include/cpu.h:1.177 src/sys/arch/i386/include/cpu.h:1.178
--- src/sys/arch/i386/include/cpu.h:1.177	Tue Jul 26 12:56:39 2011
+++ src/sys/arch/i386/include/cpu.h	Fri Dec 30 17:57:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.177 2011/07/26 12:56:39 yamt Exp $	*/
+/*	$NetBSD: cpu.h,v 1.178 2011/12/30 17:57:49 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -86,6 +86,10 @@ cpu_set_curpri(int pri)
 #define	CLKF_INTR(frame)	(curcpu()-ci_idepth  0)
 #define	LWP_PC(l)		((l)-l_md.md_regs-tf_eip)
 
+#ifdef PAE
+void cpu_alloc_l3_page(struct cpu_info *);
+#endif /* PAE */
+
 #endif	/* _KERNEL */
 
 #endif /* !_I386_CPU_H_ */

Index: src/sys/arch/x86/include/cpu.h
diff -u src/sys/arch/x86/include/cpu.h:1.44 src/sys/arch/x86/include/cpu.h:1.45
--- src/sys/arch/x86/include/cpu.h:1.44	Wed Dec  7 15:47:42 2011
+++ src/sys/arch/x86/include/cpu.h	Fri Dec 30 17:57:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.44 2011/12/07 15:47:42 cegger Exp $	*/
+/*	$NetBSD: cpu.h,v 1.45 2011/12/30 17:57:49 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -177,7 +177,7 @@ struct cpu_info {
 #endif
 
 #ifdef PAE
-	paddr_t	ci_pae_l3_pdirpa; /* PA of L3 PD */
+	uint32_t	ci_pae_l3_pdirpa; /* PA of L3 PD */
 	pd_entry_t *	ci_pae_l3_pdir; /* VA pointer to L3 PD */
 #endif
 

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.148 src/sys/arch/x86/x86/pmap.c:1.149
--- src/sys/arch/x86/x86/pmap.c:1.148	Fri Dec 30 16:55:21 2011
+++ src/sys/arch/x86/x86/pmap.c	Fri Dec 30 17:57:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.148 2011/12/30 16:55:21 cherry Exp $	*/
+/*	$NetBSD: pmap.c,v 1.149 2011/12/30 17:57:49 cherry Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.148 2011/12/30 16:55:21 cherry Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.149 2011/12/30 17:57:49 cherry Exp $);
 
 #include opt_user_ldt.h
 #include opt_lockdebug.h
@@ -1663,33 +1663,7 @@ pmap_cpu_init_late(struct cpu_info *ci)
 		return;
 
 #ifdef PAE
-	int ret;
-	struct pglist pg;
-	struct vm_page *vmap;
-
-	/*
-	 * Allocate a page for the per-CPU L3 PD. cr3 being 32 bits, PA musts
-	 * resides below the 4GB boundary.
-	 */
-	ret = uvm_pglistalloc(PAGE_SIZE, 0, 0x1ULL, 32, 0, pg, 1, 0);
-	vmap = 

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

2011-12-30 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Fri Dec 30 18:01:20 UTC 2011

Modified Files:
src/sys/arch/xen/x86: cpu.c

Log Message:
Force pae l3 page allocation for new vcpus to be  4G, so they fit in 32bits


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

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

Modified files:

Index: src/sys/arch/xen/x86/cpu.c
diff -u src/sys/arch/xen/x86/cpu.c:1.72 src/sys/arch/xen/x86/cpu.c:1.73
--- src/sys/arch/xen/x86/cpu.c:1.72	Fri Dec 30 16:55:21 2011
+++ src/sys/arch/xen/x86/cpu.c	Fri Dec 30 18:01:20 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.72 2011/12/30 16:55:21 cherry Exp $	*/
+/*	$NetBSD: cpu.c,v 1.73 2011/12/30 18:01:20 cherry Exp $	*/
 /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp  */
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.72 2011/12/30 16:55:21 cherry Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.73 2011/12/30 18:01:20 cherry Exp $);
 
 #include opt_ddb.h
 #include opt_multiprocessor.h
@@ -1271,23 +1271,15 @@ pmap_cpu_init_late(struct cpu_info *ci)
 	KASSERT(ci != NULL);
 
 #if defined(PAE)
-	ci-ci_pae_l3_pdir = (paddr_t *)uvm_km_alloc(kernel_map, PAGE_SIZE, 0,
-	UVM_KMF_WIRED | UVM_KMF_ZERO | UVM_KMF_NOWAIT);
-
-	if (ci-ci_pae_l3_pdir == NULL) {
-		panic(%s: failed to allocate L3 per-cpu PD for CPU %d\n,
-		  __func__, cpu_index(ci));
-	}
-	ci-ci_pae_l3_pdirpa = vtophys((vaddr_t) ci-ci_pae_l3_pdir);
+	cpu_alloc_l3_page(ci);
 	KASSERT(ci-ci_pae_l3_pdirpa != 0);
 
 	/* Initialise L2 entries 0 - 2: Point them to pmap_kernel() */
-	ci-ci_pae_l3_pdir[0] =
-	xpmap_ptom_masked(pmap_kernel()-pm_pdirpa[0]) | PG_V;
-	ci-ci_pae_l3_pdir[1] =
-	xpmap_ptom_masked(pmap_kernel()-pm_pdirpa[1]) | PG_V;
-	ci-ci_pae_l3_pdir[2] =
-	xpmap_ptom_masked(pmap_kernel()-pm_pdirpa[2]) | PG_V;
+	int i;
+	for (i = 0; i  PTP_LEVELS - 1; i++ ) {
+		ci-ci_pae_l3_pdir[i] =
+		xpmap_ptom_masked(pmap_kernel()-pm_pdirpa[i]) | PG_V;
+	}
 #endif /* PAE */
 
 	ci-ci_kpm_pdir = (pd_entry_t *)uvm_km_alloc(kernel_map, PAGE_SIZE, 0,



CVS commit: src/sys/dev/pci

2011-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 30 18:20:46 UTC 2011

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

Log Message:
PR/45760: Henning Petersen: Add Adaptec29329LPE to ahd_pci.c


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/pci/ahd_pci.c

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

Modified files:

Index: src/sys/dev/pci/ahd_pci.c
diff -u src/sys/dev/pci/ahd_pci.c:1.32 src/sys/dev/pci/ahd_pci.c:1.33
--- src/sys/dev/pci/ahd_pci.c:1.32	Wed Apr 21 17:38:47 2010
+++ src/sys/dev/pci/ahd_pci.c	Fri Dec 30 13:20:46 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahd_pci.c,v 1.32 2010/04/21 21:38:47 dyoung Exp $	*/
+/*	$NetBSD: ahd_pci.c,v 1.33 2011/12/30 18:20:46 christos Exp $	*/
 
 /*
  * Product specific probe and attach routines for:
@@ -50,7 +50,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ahd_pci.c,v 1.32 2010/04/21 21:38:47 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: ahd_pci.c,v 1.33 2011/12/30 18:20:46 christos Exp $);
 
 #define AHD_PCI_IOADDR	PCI_MAPREG_START	/* I/O Address */
 #define AHD_PCI_MEMADDR	(PCI_MAPREG_START + 4)	/* Mem I/O Address */
@@ -80,6 +80,7 @@ ahd_compose_id(u_int device, u_int vendo
 #define ID_AIC7901			0x800F90059005ull
 #define ID_AHA_29320A			0x8000900500609005ull
 #define ID_AHA_29320ALP			0x8017900500449005ull
+#define ID_AHA_29320LPE			0x8017900500459005ull
 
 #define ID_AIC7901A			0x801E90059005ull
 #define ID_AHA_29320LP			0x8014900500449005ull
@@ -143,6 +144,12 @@ static struct ahd_pci_identity ahd_pci_i
 		Adaptec 29320ALP Ultra320 SCSI adapter,
 		ahd_aic7901_setup
 	},
+	{
+		ID_AHA_29320LPE,
+		ID_ALL_MASK,
+		Adaptec 29320LPE Ultra320 SCSI adapter,
+		ahd_aic7901_setup
+	},
 	/* aic7901A based controllers */
 	{
 		ID_AHA_29320LP,



CVS commit: src/sys/uvm

2011-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 30 19:01:07 UTC 2011

Modified Files:
src/sys/uvm: uvm_meter.c

Log Message:
prevent kernel from writing more than userland passed.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/uvm/uvm_meter.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/uvm/uvm_meter.c
diff -u src/sys/uvm/uvm_meter.c:1.57 src/sys/uvm/uvm_meter.c:1.58
--- src/sys/uvm/uvm_meter.c:1.57	Sat Nov 12 21:10:40 2011
+++ src/sys/uvm/uvm_meter.c	Fri Dec 30 14:01:07 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_meter.c,v 1.57 2011/11/13 02:10:40 christos Exp $	*/
+/*	$NetBSD: uvm_meter.c,v 1.58 2011/12/30 19:01:07 christos Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_meter.c,v 1.57 2011/11/13 02:10:40 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_meter.c,v 1.58 2011/12/30 19:01:07 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -180,6 +180,8 @@ sysctl_vm_uvmexp2(SYSCTLFN_ARGS)
 	node = *rnode;
 	node.sysctl_data = u;
 	node.sysctl_size = sizeof(u);
+	if (oldlenp)
+		node.sysctl_size = min(*oldlenp, node.sysctl_size);
 	return (sysctl_lookup(SYSCTLFN_CALL(node)));
 }
 



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

2011-12-30 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Fri Dec 30 19:18:35 UTC 2011

Modified Files:
src/sys/arch/xen/x86: cpu.c

Log Message:
Never cut-paste code from email!
Use the right count (0 - 2) of l3 unshared userland entries for per-cpu 
initialisation.


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

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

Modified files:

Index: src/sys/arch/xen/x86/cpu.c
diff -u src/sys/arch/xen/x86/cpu.c:1.73 src/sys/arch/xen/x86/cpu.c:1.74
--- src/sys/arch/xen/x86/cpu.c:1.73	Fri Dec 30 18:01:20 2011
+++ src/sys/arch/xen/x86/cpu.c	Fri Dec 30 19:18:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.73 2011/12/30 18:01:20 cherry Exp $	*/
+/*	$NetBSD: cpu.c,v 1.74 2011/12/30 19:18:35 cherry Exp $	*/
 /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp  */
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.73 2011/12/30 18:01:20 cherry Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.74 2011/12/30 19:18:35 cherry Exp $);
 
 #include opt_ddb.h
 #include opt_multiprocessor.h
@@ -1276,7 +1276,7 @@ pmap_cpu_init_late(struct cpu_info *ci)
 
 	/* Initialise L2 entries 0 - 2: Point them to pmap_kernel() */
 	int i;
-	for (i = 0; i  PTP_LEVELS - 1; i++ ) {
+	for (i = 0; i  3; i++ ) {
 		ci-ci_pae_l3_pdir[i] =
 		xpmap_ptom_masked(pmap_kernel()-pm_pdirpa[i]) | PG_V;
 	}



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/dev/pci

2011-12-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Dec 30 20:11:23 UTC 2011

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

Log Message:
add some register definitions


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/radeonfbreg.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/radeonfbreg.h
diff -u src/sys/dev/pci/radeonfbreg.h:1.3 src/sys/dev/pci/radeonfbreg.h:1.4
--- src/sys/dev/pci/radeonfbreg.h:1.3	Wed Jan  3 19:47:17 2007
+++ src/sys/dev/pci/radeonfbreg.h	Fri Dec 30 20:11:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeonfbreg.h,v 1.3 2007/01/03 19:47:17 macallan Exp $	*/
+/*	$NetBSD: radeonfbreg.h,v 1.4 2011/12/30 20:11:23 macallan Exp $	*/
 
 /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v 1.31 2003/11/10 18:41:23 tsi Exp $ */
 /*
@@ -1123,6 +1123,17 @@
 #   define RADEON_RB2D_DC_FREE  (3  2)
 #   define RADEON_RB2D_DC_FLUSH_ALL 0xf
 #   define RADEON_RB2D_DC_BUSY  (1  31)
+#define RADEON_RB3D_DSTCACHE_CTLSTAT	0x325C
+#	define RADEON_RB3D_DC_FLUSH	(3  0)
+#	define RADEON_RB3D_DC_FREE	(3  2)
+#	define RADEON_RB3D_DC_FLUSH_ALL	0xf
+#	define RADEON_RB3D_DC_BUSY	(1  31)
+#define R300_DSTCACHE_CTLSTAT		0x1714
+#	define R300_DC_FLUSH_2D		(1  0)
+#	define R300_DC_FREE_2D		(1  2)
+#	define R300_RB2D_DC_FLUSH_ALL	(R300_DC_FLUSH_2D | R300_DC_FREE_2D)
+#	define R300_RB2D_DC_BUSY	(1  31)
+
 #define RADEON_RB2D_DSTCACHE_MODE   0x3428
 #define RADEON_REG_BASE 0x0f18 /* PCI */
 #define RADEON_REGPROG_INF  0x0f09 /* PCI */



CVS commit: src/sys/kern

2011-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 30 20:33:04 UTC 2011

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

Log Message:
Avoid panic on DIAGNOSTIC kernels with ktrace -p not-existing-process
The old logic was:

error = ktrace_common(, fp);
if (fp)
if (error)
fd_abort(, fp, );
else
fd_abort(, NULL, );

The 'if (fp)' portion really means if the op is not KTROP_CLEAR,
since the logic above always sets up fp otherwise, so change the
code to test this directly.

ktrace_common() can return an error both on the kernel thread
creation failure, which means that we should be calling fd_abort()
with fp, since nobody used the file yet and we should clear it now.
But it can also return an error because later, after the thread
creation if the process or process group was not found. In this
second case, we should be calling fd_abort with NULL, since the fp
is now used by the thread and it is going to clean it later. So
instead of checking the error from ktrace_common() to decide if we
are going to call fd_abort() with a NULL fp or not, let krace_common()
decide for us.  So the new logic becomes:

error = ktrace_common(, fp);
if (op != KTROP_CLEAR)
fd_abort(, fp, );

Since I am here, fix a freed memory access, by setting ktd to FALSE.


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.160 src/sys/kern/kern_ktrace.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/kern_ktrace.c
diff -u src/sys/kern/kern_ktrace.c:1.159 src/sys/kern/kern_ktrace.c:1.160
--- src/sys/kern/kern_ktrace.c:1.159	Wed Nov 30 05:27:46 2011
+++ src/sys/kern/kern_ktrace.c	Fri Dec 30 15:33:04 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_ktrace.c,v 1.159 2011/11/30 10:27:46 mbalmer Exp $	*/
+/*	$NetBSD: kern_ktrace.c,v 1.160 2011/12/30 20:33:04 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_ktrace.c,v 1.159 2011/11/30 10:27:46 mbalmer Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_ktrace.c,v 1.160 2011/12/30 20:33:04 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -132,7 +132,7 @@ struct ktr_desc {
 static int	ktealloc(struct ktrace_entry **, void **, lwp_t *, int,
 			 size_t);
 static void	ktrwrite(struct ktr_desc *, struct ktrace_entry *);
-static int	ktrace_common(lwp_t *, int, int, int, file_t *);
+static int	ktrace_common(lwp_t *, int, int, int, file_t **);
 static int	ktrops(lwp_t *, struct proc *, int, int,
 		struct ktr_desc *);
 static int	ktrsetchildren(lwp_t *, struct proc *, int, int,
@@ -1045,12 +1045,13 @@ ktr_mib(const int *name, u_int namelen)
 /* Interface and common routines */
 
 int
-ktrace_common(lwp_t *curl, int ops, int facs, int pid, file_t *fp)
+ktrace_common(lwp_t *curl, int ops, int facs, int pid, file_t **fpp)
 {
 	struct proc *curp;
 	struct proc *p;
 	struct pgrp *pg;
 	struct ktr_desc *ktd = NULL;
+	file_t *fp = *fpp;
 	int ret = 0;
 	int error = 0;
 	int descend;
@@ -1112,6 +1113,7 @@ ktrace_common(lwp_t *curl, int ops, int 
 			ktrace_thread, ktd, ktd-ktd_lwp, ktrace);
 			if (error != 0) {
 kmem_free(ktd, sizeof(*ktd));
+ktd = NULL;
 mutex_enter(fp-f_lock);
 fp-f_count--;
 mutex_exit(fp-f_lock);
@@ -1141,6 +1143,7 @@ ktrace_common(lwp_t *curl, int ops, int 
 	 */
 	if (!facs) {
 		error = EINVAL;
+		*fpp = NULL;
 		goto done;
 	}
 
@@ -1181,6 +1184,7 @@ ktrace_common(lwp_t *curl, int ops, int 
 	mutex_exit(proc_lock);
 	if (error == 0  !ret)
 		error = EPERM;
+	*fpp = NULL;
 done:
 	if (ktd != NULL) {
 		mutex_enter(ktrace_lock);
@@ -1222,7 +1226,7 @@ sys_fktrace(struct lwp *l, const struct 
 		error = EBADF;
 	else
 		error = ktrace_common(l, SCARG(uap, ops),
-		SCARG(uap, facs), SCARG(uap, pid), fp);
+		SCARG(uap, facs), SCARG(uap, pid), fp);
 	fd_putfile(fd);
 	return error;
 }
@@ -1290,16 +1294,9 @@ sys_ktrace(struct lwp *l, const struct s
 		vp = NULL;
 	}
 	error = ktrace_common(l, SCARG(uap, ops), SCARG(uap, facs),
-	SCARG(uap, pid), fp);
-	if (fp != NULL) {
-		if (error != 0) {
-			/* File unused. */
-			fd_abort(curproc, fp, fd);
-		} else {
-			/* File was used. */
-			fd_abort(curproc, NULL, fd);
-		}
-	}
+	SCARG(uap, pid), fp);
+	if (KTROP(SCARG(uap, ops)) != KTROP_CLEAR)
+		fd_abort(curproc, fp, fd);
 	return (error);
 }
 



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

2011-12-30 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Dec 30 21:14:58 UTC 2011

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

Log Message:
Add template code for a client driven display update request. This is
currently not possible since its event parameter is not allways passed.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 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.67 src/sys/arch/usermode/usermode/thunk.c:1.68
--- src/sys/arch/usermode/usermode/thunk.c:1.67	Fri Dec 30 20:08:00 2011
+++ src/sys/arch/usermode/usermode/thunk.c	Fri Dec 30 21:14:58 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.67 2011/12/30 20:08:00 jmcneill Exp $ */
+/* $NetBSD: thunk.c,v 1.68 2011/12/30 21:14:58 reinoud 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.67 2011/12/30 20:08:00 jmcneill Exp $);
+__RCSID($NetBSD: thunk.c,v 1.68 2011/12/30 21:14:58 reinoud Exp $);
 #endif
 
 #include sys/types.h
@@ -1165,10 +1165,11 @@ thunk_rfb_poll(thunk_rfb_t *rfb, thunk_r
 		thunk_rfb_update(rfb, 0, 0, rfb-width, rfb-height);
 	}
 
-	thunk_rfb_send_pending(rfb);
 	if (rfb-clientfd == -1)
 		return -1;
 
+	thunk_rfb_send_pending(rfb);
+
 	if (event == NULL)
 		return 0;
 
@@ -1201,7 +1202,17 @@ thunk_rfb_poll(thunk_rfb_t *rfb, thunk_r
 		msg_len = 4 * ntohs(*(uint16_t *)set_encodings[1]);
 		break;
 	case THUNK_RFB_FRAMEBUFFER_UPDATE_REQUEST:
-		msg_len = sizeof(framebuffer_update_request);
+		recv(rfb-clientfd, framebuffer_update_request,
+			sizeof(framebuffer_update_request), MSG_NOSIGNAL);
+#if 0
+		if (framebuffer_update_request[0] == 0) {
+fprintf(stdout, complete update request\n);
+			/* complete redraw request - buffer full */
+			rfb-nupdates = __arraycount(rfb-update);
+		}
+		thunk_rfb_send_pending(rfb);
+#endif
+		msg_len = 0;
 		break;
 	case THUNK_RFB_KEY_EVENT:
 		recv(rfb-clientfd, key_event, sizeof(key_event), MSG_NOSIGNAL);



CVS commit: src/sys/dev/usb

2011-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Dec 31 00:08:48 UTC 2011

Modified Files:
src/sys/dev/usb: files.usb usbdevs
Added Files:
src/sys/dev/usb: uipad.c

Log Message:
Add a tiny driver that sends the magic command to an ipad instructing it
to charge.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/usb/files.usb
cvs rdiff -u -r0 -r1.1 src/sys/dev/usb/uipad.c
cvs rdiff -u -r1.602 -r1.603 src/sys/dev/usb/usbdevs

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/files.usb
diff -u src/sys/dev/usb/files.usb:1.116 src/sys/dev/usb/files.usb:1.117
--- src/sys/dev/usb/files.usb:1.116	Wed Nov  2 22:41:29 2011
+++ src/sys/dev/usb/files.usb	Fri Dec 30 19:08:48 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: files.usb,v 1.116 2011/11/03 02:41:29 macallan Exp $
+#	$NetBSD: files.usb,v 1.117 2011/12/31 00:08:48 christos Exp $
 #
 # Config file and device description for machine-independent USB code.
 # Included by ports that need it.  Ports that use it must provide
@@ -189,6 +189,11 @@ device	urio
 attach	urio at usbdevif
 file	dev/usb/urio.c			urio			needs-flag
 
+# Apple iPad
+device	uipad
+attach	uipad at usbdevif
+file	dev/usb/uipad.cuipad
+
 # BlackBerries
 device	uberry
 attach	uberry at usbdevif

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.602 src/sys/dev/usb/usbdevs:1.603
--- src/sys/dev/usb/usbdevs:1.602	Sat Nov 26 13:34:17 2011
+++ src/sys/dev/usb/usbdevs	Fri Dec 30 19:08:48 2011
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.602 2011/11/26 18:34:17 nonaka Exp $
+$NetBSD: usbdevs,v 1.603 2011/12/31 00:08:48 christos Exp $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -796,6 +796,7 @@ product APPLE IPHONE		0x1290	iPhone
 product APPLE IPOD_TOUCH	0x1291	iPod Touch
 product APPLE IPHONE_3G		0x1292	iPhone 3G
 product APPLE IPHONE_3GS	0x1294	iPhone 3GS
+product APPLE IPAD		0x129a	Apple iPad
 product APPLE ETHERNET		0x1402	Apple USB to Ethernet
 
 /* ArkMicroChips products */

Added files:

Index: src/sys/dev/usb/uipad.c
diff -u /dev/null src/sys/dev/usb/uipad.c:1.1
--- /dev/null	Fri Dec 30 19:08:48 2011
+++ src/sys/dev/usb/uipad.c	Fri Dec 30 19:08:48 2011
@@ -0,0 +1,175 @@
+/*	$NetBSD: uipad.c,v 1.1 2011/12/31 00:08:48 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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 the NetBSD
+ *Foundation, Inc. and its contributors.
+ * 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 pipadr 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.
+ */
+
+#include sys/cdefs.h
+__KERNEL_RCSID(0, $NetBSD: uipad.c,v 1.1 2011/12/31 00:08:48 christos Exp $);
+
+#include sys/param.h
+#include sys/systm.h
+#include sys/kernel.h
+#include sys/malloc.h
+#include sys/device.h
+#include sys/ioctl.h
+#include sys/conf.h
+#include sys/file.h
+#include sys/select.h
+#include sys/proc.h
+#include sys/vnode.h
+#include sys/poll.h
+#include sys/bus.h
+
+#include dev/usb/usb.h
+#include dev/usb/usbdi.h
+#include dev/usb/usbdi_util.h
+#include dev/usb/usbdivar.h
+
+#include dev/usb/usbdevs.h
+
+#ifdef UIPAD_DEBUG
+#define DPRINTF(x)	if (uipaddebug) printf x
+#define DPRINTFN(n, x)	if (uipaddebug  n) printf x
+int	

CVS commit: src/sys/dev/usb

2011-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Dec 31 00:09:11 UTC 2011

Modified Files:
src/sys/dev/usb: usbdevs.h usbdevs_data.h

Log Message:
Regen


To generate a diff of this commit:
cvs rdiff -u -r1.595 -r1.596 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.596 -r1.597 src/sys/dev/usb/usbdevs_data.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/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.595 src/sys/dev/usb/usbdevs.h:1.596
--- src/sys/dev/usb/usbdevs.h:1.595	Sat Nov 26 13:35:30 2011
+++ src/sys/dev/usb/usbdevs.h	Fri Dec 30 19:09:11 2011
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.595 2011/11/26 18:35:30 nonaka Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.596 2011/12/31 00:09:11 christos Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.602 2011/11/26 18:34:17 nonaka Exp
+ *	NetBSD: usbdevs,v 1.603 2011/12/31 00:08:48 christos Exp
  */
 
 /*
@@ -803,6 +803,7 @@
 #define	USB_PRODUCT_APPLE_IPOD_TOUCH	0x1291		/* iPod Touch */
 #define	USB_PRODUCT_APPLE_IPHONE_3G	0x1292		/* iPhone 3G */
 #define	USB_PRODUCT_APPLE_IPHONE_3GS	0x1294		/* iPhone 3GS */
+#define	USB_PRODUCT_APPLE_IPAD	0x129a		/* Apple iPad */
 #define	USB_PRODUCT_APPLE_ETHERNET	0x1402		/* Apple USB to Ethernet */
 
 /* ArkMicroChips products */

Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.596 src/sys/dev/usb/usbdevs_data.h:1.597
--- src/sys/dev/usb/usbdevs_data.h:1.596	Sat Nov 26 13:35:30 2011
+++ src/sys/dev/usb/usbdevs_data.h	Fri Dec 30 19:09:11 2011
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs_data.h,v 1.596 2011/11/26 18:35:30 nonaka Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.597 2011/12/31 00:09:11 christos Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.602 2011/11/26 18:34:17 nonaka Exp
+ *	NetBSD: usbdevs,v 1.603 2011/12/31 00:08:48 christos Exp
  */
 
 /*
@@ -2683,6 +2683,10 @@ const struct usb_product usb_products[] 
 	iPhone 3GS,
 	},
 	{
+	USB_VENDOR_APPLE, USB_PRODUCT_APPLE_IPAD,
+	Apple iPad,
+	},
+	{
 	USB_VENDOR_APPLE, USB_PRODUCT_APPLE_ETHERNET,
 	Apple USB to Ethernet,
 	},
@@ -8579,4 +8583,4 @@ const struct usb_product usb_products[] 
 	Prestige,
 	},
 };
-const int usb_nproducts = 1637;
+const int usb_nproducts = 1638;



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

2011-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Dec 31 00:10:06 UTC 2011

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

Log Message:
Add an ipad


To generate a diff of this commit:
cvs rdiff -u -r1.341 -r1.342 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.341 src/sys/arch/amd64/conf/GENERIC:1.342
--- src/sys/arch/amd64/conf/GENERIC:1.341	Sun Dec 18 00:49:23 2011
+++ src/sys/arch/amd64/conf/GENERIC	Fri Dec 30 19:10:06 2011
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.341 2011/12/18 05:49:23 dholland Exp $
+# $NetBSD: GENERIC,v 1.342 2011/12/31 00:10:06 christos Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include	arch/amd64/conf/std.amd64
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.341 $
+#ident 		GENERIC-$Revision: 1.342 $
 
 maxusers	64		# estimated number of users
 
@@ -921,6 +921,9 @@ ucom*	at uvscom? portno ?
 # RIM BlackBerry
 uberry* at uhub? port ?
 
+# Apple iPad
+uipad* at uhub? port ?
+
 # Diamond Multimedia Rio 500
 urio*	at uhub? port ?
 



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

2011-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Dec 31 00:11:21 UTC 2011

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

Log Message:
add uipad


To generate a diff of this commit:
cvs rdiff -u -r1.328 -r1.329 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1060 -r1.1061 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/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.328 src/sys/arch/i386/conf/ALL:1.329
--- src/sys/arch/i386/conf/ALL:1.328	Sun Dec 18 00:49:28 2011
+++ src/sys/arch/i386/conf/ALL	Fri Dec 30 19:11:20 2011
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.328 2011/12/18 05:49:28 dholland Exp $
+# $NetBSD: ALL,v 1.329 2011/12/31 00:11:20 christos Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	arch/i386/conf/std.i386
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		ALL-$Revision: 1.328 $
+#ident 		ALL-$Revision: 1.329 $
 
 maxusers	64		# estimated number of users
 
@@ -1305,6 +1305,9 @@ ucom*	at uhmodem? portno ?
 # RIM BlackBerry
 uberry* at uhub? port ?
 
+# Apple iPad
+uipad* at uhub? port ?
+
 # Diamond Multimedia Rio 500
 urio*	at uhub? port ?
 

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1060 src/sys/arch/i386/conf/GENERIC:1.1061
--- src/sys/arch/i386/conf/GENERIC:1.1060	Sun Dec 18 00:49:28 2011
+++ src/sys/arch/i386/conf/GENERIC	Fri Dec 30 19:11:21 2011
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1060 2011/12/18 05:49:28 dholland Exp $
+# $NetBSD: GENERIC,v 1.1061 2011/12/31 00:11:21 christos Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	arch/i386/conf/std.i386
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.1060 $
+#ident 		GENERIC-$Revision: 1.1061 $
 
 maxusers	64		# estimated number of users
 
@@ -1255,6 +1255,9 @@ ucom*	at uvscom? portno ?
 # RIM BlackBerry
 uberry* at uhub? port ?
 
+# Apple iPad
+uipad* at uhub? port ?
+
 # Diamond Multimedia Rio 500
 urio*	at uhub? port ?
 



CVS commit: src/sys/dev/bluetooth

2011-12-30 Thread Radoslaw Kujawa
Module Name:src
Committed By:   rkujawa
Date:   Sat Dec 31 01:16:09 UTC 2011

Modified Files:
src/sys/dev/bluetooth: bthidev.c btkbd.c

Log Message:
Fix panic triggered by pressing the caps lock key:
http://c0ff33.net/drop/bt_caps_panic.jpg

OK'd mrg.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/bluetooth/bthidev.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/bluetooth/btkbd.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/bluetooth/bthidev.c
diff -u src/sys/dev/bluetooth/bthidev.c:1.19 src/sys/dev/bluetooth/bthidev.c:1.20
--- src/sys/dev/bluetooth/bthidev.c:1.19	Wed Apr 28 06:13:51 2010
+++ src/sys/dev/bluetooth/bthidev.c	Sat Dec 31 01:16:09 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bthidev.c,v 1.19 2010/04/28 06:13:51 plunky Exp $	*/
+/*	$NetBSD: bthidev.c,v 1.20 2011/12/31 01:16:09 rkujawa Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bthidev.c,v 1.19 2010/04/28 06:13:51 plunky Exp $);
+__KERNEL_RCSID(0, $NetBSD: bthidev.c,v 1.20 2011/12/31 01:16:09 rkujawa Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -919,9 +919,8 @@ bthidev_output(struct bthidev *hidev, ui
 	memcpy(mtod(m, uint8_t *) + 2, report, rlen);
 	m-m_pkthdr.len = m-m_len = rlen + 2;
 
-	mutex_enter(bt_lock);
+	KASSERT(mutex_owned(bt_lock));
 	err = l2cap_send(sc-sc_int, m);
-	mutex_exit(bt_lock);
 
 	return err;
 }

Index: src/sys/dev/bluetooth/btkbd.c
diff -u src/sys/dev/bluetooth/btkbd.c:1.11 src/sys/dev/bluetooth/btkbd.c:1.12
--- src/sys/dev/bluetooth/btkbd.c:1.11	Tue May 12 12:10:46 2009
+++ src/sys/dev/bluetooth/btkbd.c	Sat Dec 31 01:16:09 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: btkbd.c,v 1.11 2009/05/12 12:10:46 cegger Exp $	*/
+/*	$NetBSD: btkbd.c,v 1.12 2011/12/31 01:16:09 rkujawa Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: btkbd.c,v 1.11 2009/05/12 12:10:46 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: btkbd.c,v 1.12 2011/12/31 01:16:09 rkujawa Exp $);
 
 #include sys/param.h
 #include sys/callout.h
@@ -378,7 +378,9 @@ btkbd_ioctl(void *self, unsigned long cm
 		break;
 
 	case WSKBDIO_SETLEDS:
+		mutex_enter(bt_lock);
 		btkbd_set_leds(sc, *(int *)data);
+		mutex_exit(bt_lock);
 		break;
 
 	case WSKBDIO_GETLEDS:



CVS commit: [matt-nb5-mips64] src/sys/dev/pci

2011-12-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 31 02:25:43 UTC 2011

Modified Files:
src/sys/dev/pci [matt-nb5-mips64]: pcidevs

Log Message:
Add XLP RXE and SRIO product ids.


To generate a diff of this commit:
cvs rdiff -u -r1.962.4.1.4.5 -r1.962.4.1.4.6 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.962.4.1.4.5 src/sys/dev/pci/pcidevs:1.962.4.1.4.6
--- src/sys/dev/pci/pcidevs:1.962.4.1.4.5	Sat Dec 24 01:22:44 2011
+++ src/sys/dev/pci/pcidevs	Sat Dec 31 02:25:42 2011
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.962.4.1.4.5 2011/12/24 01:22:44 matt Exp $
+$NetBSD: pcidevs,v 1.962.4.1.4.6 2011/12/31 02:25:42 matt Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -2930,7 +2930,9 @@ product NETLOGIC XLP_NOR	0x1015	XLP NOR 
 product NETLOGIC XLP_NAND	0x1016	XLP NAND flash controller
 product NETLOGIC XLP_SPI	0x1017	XLP SPI controller
 product NETLOGIC XLP_SDHC	0x1018	XLP eMMC/SD/SDIO controller
+product NETLOGIC XLP_RXE	0x1019	XLP Regular Expression accelerator
 product NETLOGIC XLP_AHCISATA	0x101a	XLP AHCI SATA controller
+product NETLOGIC XLP_SRIO	0x101b	XLP SRIO (Serial Rapid IO) controller
 
 /* NetVin products - XXX better descriptions */
 product NETVIN 5000	0x5000	5000 Ethernet



CVS commit: [matt-nb5-mips64] src/sys/dev/pci

2011-12-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 31 02:26:41 UTC 2011

Modified Files:
src/sys/dev/pci [matt-nb5-mips64]: pcidevs.h pcidevs_data.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.963.4.1.4.5 -r1.963.4.1.4.6 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.962.4.1.4.5 -r1.962.4.1.4.6 src/sys/dev/pci/pcidevs_data.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/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.963.4.1.4.5 src/sys/dev/pci/pcidevs.h:1.963.4.1.4.6
--- src/sys/dev/pci/pcidevs.h:1.963.4.1.4.5	Sat Dec 24 01:23:12 2011
+++ src/sys/dev/pci/pcidevs.h	Sat Dec 31 02:26:21 2011
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs.h,v 1.963.4.1.4.5 2011/12/24 01:23:12 matt Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.963.4.1.4.6 2011/12/31 02:26:21 matt Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.962.4.1.4.5 2011/12/24 01:22:44 matt Exp
+ *	NetBSD: pcidevs,v 1.962.4.1.4.6 2011/12/31 02:25:42 matt Exp
  */
 
 /*
@@ -2937,7 +2937,9 @@
 #define	PCI_PRODUCT_NETLOGIC_XLP_NAND	0x1016		/* XLP NAND flash controller */
 #define	PCI_PRODUCT_NETLOGIC_XLP_SPI	0x1017		/* XLP SPI controller */
 #define	PCI_PRODUCT_NETLOGIC_XLP_SDHC	0x1018		/* XLP eMMC/SD/SDIO controller */
+#define	PCI_PRODUCT_NETLOGIC_XLP_RXE	0x1019		/* XLP Regular Expression accelerator */
 #define	PCI_PRODUCT_NETLOGIC_XLP_AHCISATA	0x101a		/* XLP AHCI SATA controller */
+#define	PCI_PRODUCT_NETLOGIC_XLP_SRIO	0x101b		/* XLP SRIO (Serial Rapid IO) controller */
 
 /* NetVin products - XXX better descriptions */
 #define	PCI_PRODUCT_NETVIN_5000	0x5000		/* 5000 Ethernet */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.962.4.1.4.5 src/sys/dev/pci/pcidevs_data.h:1.962.4.1.4.6
--- src/sys/dev/pci/pcidevs_data.h:1.962.4.1.4.5	Sat Dec 24 01:23:13 2011
+++ src/sys/dev/pci/pcidevs_data.h	Sat Dec 31 02:26:21 2011
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs_data.h,v 1.962.4.1.4.5 2011/12/24 01:23:13 matt Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.962.4.1.4.6 2011/12/31 02:26:21 matt Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.962.4.1.4.5 2011/12/24 01:22:44 matt Exp
+ *	NetBSD: pcidevs,v 1.962.4.1.4.6 2011/12/31 02:25:42 matt Exp
  */
 
 /*
@@ -10296,10 +10296,18 @@ static const struct pci_product pci_prod
 	XLP eMMC/SD/SDIO controller,
 	},
 	{
+	PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_RXE,
+	XLP Regular Expression accelerator,
+	},
+	{
 	PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_AHCISATA,
 	XLP AHCI SATA controller,
 	},
 	{
+	PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_SRIO,
+	XLP SRIO (Serial Rapid IO) controller,
+	},
+	{
 	PCI_VENDOR_NETVIN, PCI_PRODUCT_NETVIN_5000,
 	5000 Ethernet,
 	},
@@ -14948,4 +14956,4 @@ static const struct pci_product pci_prod
 	Video Controller,
 	},
 };
-const int pci_nproducts = 3134;
+const int pci_nproducts = 3136;



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2011-12-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 31 03:33:13 UTC 2011

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_gpio_pci.c

Log Message:
Fix xlgpio_pin_ctl inversion problem.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/mips/rmi/rmixl_gpio_pci.c

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

Modified files:

Index: src/sys/arch/mips/rmi/rmixl_gpio_pci.c
diff -u src/sys/arch/mips/rmi/rmixl_gpio_pci.c:1.1.2.1 src/sys/arch/mips/rmi/rmixl_gpio_pci.c:1.1.2.2
--- src/sys/arch/mips/rmi/rmixl_gpio_pci.c:1.1.2.1	Fri Dec 30 06:48:55 2011
+++ src/sys/arch/mips/rmi/rmixl_gpio_pci.c	Sat Dec 31 03:33:13 2011
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: rmixl_gpio_pci.c,v 1.1.2.1 2011/12/30 06:48:55 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: rmixl_gpio_pci.c,v 1.1.2.2 2011/12/31 03:33:13 matt Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -100,7 +100,7 @@ struct xlgpio_intrpin {
 #define	PINGROUP	(PINMASK+1)
 #define	PIN_GROUP(pin)	((pin) / PINGROUP)
 #define	PIN_SELECT(pin)	((pin)  PINMASK)
-#define	PIN_MASK(pin)	(1  ((pin)  PINMASK))
+#define	PIN_MASK(pin)	(1  PIN_SELECT(pin))
 
 struct xlgpio_softc {
 	device_t sc_dev;
@@ -493,7 +493,7 @@ xlgpio_pin_write(void *arg, int pin, int
 {
 	struct xlgpio_softc * const sc = arg;
 	struct xlgpio_group * const gg = sc-sc_groups[PIN_GROUP(pin)];
-	const uint32_t mask = 1  (pin  PINMASK);
+	const uint32_t mask = PIN_MASK(pin);
 
 	mutex_enter(sc-sc_pin_lock);
 
@@ -515,23 +515,25 @@ static void
 xlgpio_pin_ctl(void *arg, int pin, int flags)
 {
 	struct xlgpio_softc * const sc = arg;
-	const bus_size_t r_padoe = RMIXLP_GPIO_PADOE(pin / PINGROUP);
-	const uint32_t mask = 1  (pin  PINMASK);
+	struct xlgpio_group * const gg = sc-sc_groups[PIN_GROUP(pin)];
+	const uint32_t mask = PIN_MASK(pin);
 
 	mutex_enter(sc-sc_pin_lock);
 
 	KASSERT(pin  sc-sc_pincnt);
 
-	const uint32_t old = xlgpio_read_4(sc, r_padoe);
-	uint32_t new;
+	uint32_t new_padoe;
 
 	switch (flags  (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) {
-	case GPIO_PIN_INPUT:	new = old | mask; break;
-	case GPIO_PIN_OUTPUT:	new = old  ~mask; break;
-	default:		new = old;
+	case GPIO_PIN_OUTPUT:	new_padoe = gg-gg_padoe | mask; break;
+	case GPIO_PIN_INPUT:	new_padoe = gg-gg_padoe  ~mask; break;
+	default:		new_padoe = gg-gg_padoe;
+	}
+
+	if (gg-gg_padoe != new_padoe) {
+		gg-gg_padoe = new_padoe;
+		xlgpio_write_4(sc, gg-gg_r_padoe, gg-gg_padoe);
 	}
-	if (old != new)
-		xlgpio_write_4(sc, r_padoe, new);
 
 	mutex_exit(sc-sc_pin_lock);
 }



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2011-12-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 31 04:30:53 UTC 2011

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_gpio_pci.c rmixlreg.h

Log Message:
Deal with the movement of some GPIO registers on the XPL3xx.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/mips/rmi/rmixl_gpio_pci.c
cvs rdiff -u -r1.1.2.16 -r1.1.2.17 src/sys/arch/mips/rmi/rmixlreg.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/mips/rmi/rmixl_gpio_pci.c
diff -u src/sys/arch/mips/rmi/rmixl_gpio_pci.c:1.1.2.2 src/sys/arch/mips/rmi/rmixl_gpio_pci.c:1.1.2.3
--- src/sys/arch/mips/rmi/rmixl_gpio_pci.c:1.1.2.2	Sat Dec 31 03:33:13 2011
+++ src/sys/arch/mips/rmi/rmixl_gpio_pci.c	Sat Dec 31 04:30:52 2011
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: rmixl_gpio_pci.c,v 1.1.2.2 2011/12/31 03:33:13 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: rmixl_gpio_pci.c,v 1.1.2.3 2011/12/31 04:30:52 matt Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -151,9 +151,9 @@ static struct xlgpio_softc xlgpio_sc = {
 [2] = RMIXLP_GPIO_INTEN(2, 0),
 [3] = RMIXLP_GPIO_INTEN(3, 0),
 			},
-			.gg_r_intpol = RMIXLP_GPIO_INTPOL(0),
-			.gg_r_inttype = RMIXLP_GPIO_INTTYPE(0),
-			.gg_r_intstat = RMIXLP_GPIO_INTSTAT(0),
+			.gg_r_intpol = RMIXLP_GPIO_8XX_INTPOL(0),
+			.gg_r_inttype = RMIXLP_GPIO_8XX_INTTYPE(0),
+			.gg_r_intstat = RMIXLP_GPIO_8XX_INTSTAT(0),
 		},
 		[1] = {
 			.gg_pins = xlgpio_sc.sc_pins + PINGROUP,
@@ -166,9 +166,9 @@ static struct xlgpio_softc xlgpio_sc = {
 [2] = RMIXLP_GPIO_INTEN(2, 1),
 [3] = RMIXLP_GPIO_INTEN(3, 1),
 			},
-			.gg_r_intpol = RMIXLP_GPIO_INTPOL(1),
-			.gg_r_inttype = RMIXLP_GPIO_INTTYPE(1),
-			.gg_r_intstat = RMIXLP_GPIO_INTSTAT(1),
+			.gg_r_intpol = RMIXLP_GPIO_8XX_INTPOL(1),
+			.gg_r_inttype = RMIXLP_GPIO_8XX_INTTYPE(1),
+			.gg_r_intstat = RMIXLP_GPIO_8XX_INTSTAT(1),
 		},
 	},
 	.sc_gpio_chipset = {
@@ -266,10 +266,18 @@ xlgpio_pci_attach(device_t parent, devic
 		KASSERT(gg-gg_inttype == 0);
 
 		/*
+		 * These are at different offsets on the 3xx than the 8xx/4xx.
+		 */
+		if (rmixl_xlp_variant = RMIXLP_3XX) {
+			gg-gg_r_intpol = RMIXLP_GPIO_3XX_INTPOL(group);
+			gg-gg_r_inttype = RMIXLP_GPIO_3XX_INTTYPE(group);
+			gg-gg_r_intstat = RMIXLP_GPIO_3XX_INTSTAT(group);
+		}
+
+		/*
 		 * Disable all interrupts for group.
 		 * Get shadow copy of registers.
 		 */
-
 		gg-gg_padoe = xlgpio_read_4(sc, gg-gg_r_padoe);
 		gg-gg_paddrv = xlgpio_read_4(sc, gg-gg_r_paddrv);
 		xlgpio_write_4(sc, gg-gg_r_intpol, gg-gg_intpol);
@@ -283,6 +291,7 @@ xlgpio_pci_attach(device_t parent, devic
 
 	/*
 	 * GPIO has 4 interrupts which map 1:1 on IPL_VM to IPL_HIGH
+	 * (12 on 3xx but we only use 4).
 	 */
 	const pcireg_t irtinfo = xlgpio_read_4(sc, PCI_RMIXLP_IRTINFO);
 
@@ -291,8 +300,9 @@ xlgpio_pci_attach(device_t parent, devic
 
 	KASSERT(irtcount = IPL_HIGH - IPL_VM + 1);
 
-	for (size_t irt = 0; irt  irtcount; irt++) {
-		if (rmixl_intr_establish(irtstart + irt, IPL_VM + irt,
+	for (size_t ipl = IPL_VM; ipl = IPL_HIGH ; ipl++) {
+		const size_t irt = ipl - IPL_VM;
+		if (rmixl_intr_establish(irtstart + irt, ipl,
 		RMIXL_TRIG_LEVEL, RMIXL_POLR_HIGH,
 		xlgpio_intrs[irt], sc, true) == NULL)
 			panic(%s: failed to establish interrupt %zu,
@@ -469,7 +479,7 @@ gpio_intr_disestablish(void *v)
 
 	*inten_p = ~mask;
 	xlgpio_write_4(sc, gg-gg_r_inten[gip-gip_ipl - IPL_VM], *inten_p);
-	xlgpio_write_4(sc, RMIXLP_GPIO_INTSTAT(group), mask); /* ACK it */
+	xlgpio_write_4(sc, gg-gg_r_intstat, mask);	/* ACK it */
 
 	gip-gip_ipl = IPL_NONE;
 	gip-gip_ist = IST_NONE;

Index: src/sys/arch/mips/rmi/rmixlreg.h
diff -u src/sys/arch/mips/rmi/rmixlreg.h:1.1.2.16 src/sys/arch/mips/rmi/rmixlreg.h:1.1.2.17
--- src/sys/arch/mips/rmi/rmixlreg.h:1.1.2.16	Fri Dec 30 06:48:56 2011
+++ src/sys/arch/mips/rmi/rmixlreg.h	Sat Dec 31 04:30:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixlreg.h,v 1.1.2.16 2011/12/30 06:48:56 matt Exp $	*/
+/*	$NetBSD: rmixlreg.h,v 1.1.2.17 2011/12/31 04:30:52 matt Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -912,23 +912,12 @@
 #define RMIXLP_GPIO_INTEN(n,g) _RMIXL_OFFSET(0x46+2*(n)+(g)) // Interrupt 0 Enable Register 0
 #define RMIXLP_GPIO_INTEN0(n) _RMIXL_OFFSET(0x46+2*(n)) // Interrupt 0 Enable Register 0
 #define RMIXLP_GPIO_INTEN1(n) _RMIXL_OFFSET(0x47+2*(n)) // Interrupt 0 Enable Register 0
-#define RMIXLP_GPIO_INTEN00 _RMIXL_OFFSET(0x46) // Interrupt 0 Enable Register 0
-#define RMIXLP_GPIO_INTEN01 _RMIXL_OFFSET(0x47) // Interrupt 0 Enable Register 1
-#define RMIXLP_GPIO_INTEN10 _RMIXL_OFFSET(0x48) // Interrupt 1 Enable Register 0
-#define RMIXLP_GPIO_INTEN11 _RMIXL_OFFSET(0x49) // Interrupt 1 Enable Register 1
-#define RMIXLP_GPIO_INTEN20 _RMIXL_OFFSET(0x4A) // Interrupt 2 Enable Register 0
-#define RMIXLP_GPIO_INTEN21 _RMIXL_OFFSET(0x4B) // Interrupt 2 Enable Register 1

CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2011-12-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 31 04:54:28 UTC 2011

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_i2creg.h rmixl_naereg.h
rmixlp_pcie.c rmixlreg.h

Log Message:
Consolidate and complete PCITAGs.
Print/Set BARs for AHCI and SRIO.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/mips/rmi/rmixl_i2creg.h \
src/sys/arch/mips/rmi/rmixl_naereg.h
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/arch/mips/rmi/rmixlp_pcie.c
cvs rdiff -u -r1.1.2.17 -r1.1.2.18 src/sys/arch/mips/rmi/rmixlreg.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/mips/rmi/rmixl_i2creg.h
diff -u src/sys/arch/mips/rmi/rmixl_i2creg.h:1.1.2.1 src/sys/arch/mips/rmi/rmixl_i2creg.h:1.1.2.2
--- src/sys/arch/mips/rmi/rmixl_i2creg.h:1.1.2.1	Sat Dec 24 01:57:54 2011
+++ src/sys/arch/mips/rmi/rmixl_i2creg.h	Sat Dec 31 04:54:28 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_i2creg.h,v 1.1.2.1 2011/12/24 01:57:54 matt Exp $	*/
+/*	$NetBSD: rmixl_i2creg.h,v 1.1.2.2 2011/12/31 04:54:28 matt Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -38,8 +38,8 @@
  * XLP I2C Controller defintions
  */
 
-#define	RMIXLP_I2C0_PCITAG		_RMIXL_PCITAG(0,6,2)
-#define	RMIXLP_I2C1_PCITAG		_RMIXL_PCITAG(0,6,3)
+#define	RMIXLP_I2C1_PCITAG		_RMIXL_PCITAG(0,6,2)
+#define	RMIXLP_I2C2_PCITAG		_RMIXL_PCITAG(0,6,3)
 #define	RMIXLP_I2C_CFG_OFFSET		_RMIXL_OFFSET(0x40)
 #define	RMIXLP_I2C_IOSIZE		_RMIXL_OFFSET(0x40)
 
Index: src/sys/arch/mips/rmi/rmixl_naereg.h
diff -u src/sys/arch/mips/rmi/rmixl_naereg.h:1.1.2.1 src/sys/arch/mips/rmi/rmixl_naereg.h:1.1.2.2
--- src/sys/arch/mips/rmi/rmixl_naereg.h:1.1.2.1	Sat Dec 24 01:57:54 2011
+++ src/sys/arch/mips/rmi/rmixl_naereg.h	Sat Dec 31 04:54:28 2011
@@ -31,17 +31,38 @@
 #define _MIPS_RMI_RMIXL_NAEREG_H
 
 /*
- * RX P2P Descriptor
+ * RX P2P Descriptor (slightly different betewen XLS/XLR and XLP).
  */
-#define	RMIXL_NEA_RXD_CONTEXT			__BITS(63,54)
+#define	RMIXLS_NEA_RXD_EOP			__BIT(63)
+#define	RMIXLS_NEA_RXD_STATUS			__BITS(62,56)
+#define	RMIXLS_NEA_RXD_CLASSID			__BITS(55,54)
+#define	RMIXLP_NEA_RXD_CONTEXT			__BITS(59,54)
 #define	RMIXL_NEA_RXD_LENGTH			__BITS(53,40)
-#define	RMIXL_NEA_RXD_ADDRESS			__BITS(39,6)
-#define	RMIXL_NEA_RXD_UP			__BIT(5)
-#define	RMIXL_NEA_RXD_ERR			__BIT(4)
-#define	RMIXL_NEA_RXD_IC			__BIT(3)
-#define	RMIXL_NEA_RXD_TC			__BIT(2)
-#define	RMIXL_NEA_RXD_PP			__BIT(1)
-#define	RMIXL_NEA_RXD_P2P			__BIT(0)
+/*
+ * L2 cacheline aligned address
+ */
+#define	RMIXL_NEA_RXD_ADDRESS			__BITS(39,5)
+#define	RMIXLP_NEA_RXD_UP			__BIT(5)
+#define	RMIXLP_NEA_RXD_ERR			__BIT(4)
+#define	RMIXLS_NEA_RXD_UP			__BIT(4)
+#define	RMIXLS_NEA_RXD_PORTID			__BIT(3,0)
+#define	RMIXLP_NEA_RXD_IC			__BIT(3) // IP CSUM valid
+#define	RMIXLP_NEA_RXD_TC			__BIT(2) // TCP CSUM valid
+#define	RMIXLP_NEA_RXD_PP			__BIT(1) // Prepad present
+#define	RMIXLP_NEA_RXD_P2P			__BIT(0)
+
+/*
+ * RXD Status field for XLS/XLR.
+ */
+#define	RMIXLS_RXD_STATUS_ERROR			__BIT(6)
+#define	RMIXLS_RXD_STATUS_OK_BROADCAST		__BIT(5)
+#define	RMIXLS_RXD_STATUS_OK_MULTICAST		__BIT(4)
+#define	RMIXLS_RXD_STATUS_OK_UNICAST		__BIT(3)
+#define	RMIXLS_RXD_STATUS_ERROR_CODE		__BIT(2)
+#define	RMIXLS_RXD_STATUS_ERROR_CRC		__BIT(1)
+#define	RMIXLS_RXD_STATUS_OK_MACADDR		__BITS(2,1)
+#define	RMIXLS_RXD_STATUS_ERROR_LENGTH		__BIT(0)
+#define	RMIXLS_RXD_STATUS_OK_VLAN		__BIT(0)
 
 #define	RMIXL_NEA_TXD_TYPE			__BITS(63,62)
 #define	RMIXL_NEA_TXD_RDEX			__BIT(61)
@@ -88,13 +109,19 @@
 #define	RMIXL_NEA_MSCD2_CRC_INS_OFFS		__BITS(15,0)
 
 #define	RMIXL_NEA_TXFBD_TYPE			__BITS(63,62)
-#define	RMIXL_NEA_TXFBD_RDX			__BIT(61)
-#define	RMIXL_NEA_TXFBD__RSRVD0			__BITS(60,58)
-#define	RMIXL_NEA_TXFBD_TS_VALID		__BIT(57)
-#define	RMIXL_NEA_TXFBD_TX_DONE			__BIT(56)
-#define	RMIXL_NEA_TXFBD_MAX_COLL_LATE_ABORT	__BIT(55)
-#define	RMIXL_NEA_TXFBD_UNDERRUN		__BIT(54)
-#define	RMIXL_NEA_TXFBD__RSRVD1			__BITS(53,50)
+#define	RMIXLP_NEA_TXFBD_RDX			__BIT(61)
+#define	RMIXLP_NEA_TXFBD__RSRVD0		__BITS(60,58)
+#define	RMIXLS_NEA_TXFBD_COLLISION		__BIT(61)
+#define	RMIXLS_NEA_TXFBD_BUS_ERROR		__BIT(60)
+#define	RMIXLS_NEA_TXFBD_UNDERRUN		__BIT(59)
+#define	RMIXLS_NEA_TXFBD_ABORT			__BIT(58)
+#define	RMIXLP_NEA_TXFBD_TS_VALID		__BIT(57)
+#define	RMIXLP_NEA_TXFBD_TX_DONE		__BIT(56)
+#define	RMIXLP_NEA_TXFBD_MAX_COLL_LATE_ABORT	__BIT(55)
+#define	RMIXLP_NEA_TXFBD_UNDERRUN		__BIT(54)
+#define	RMIXLS_NEA_TXFBD_PORT_ID		__BITS(57,54)
+#define	RMIXLP_NEA_TXFBD__RSRVD1		__BITS(53,50)
+#define	RMIXLS_NEA_TXFBD_LENGTH			__BITS(53,40) // always 0
 #define	RMIXL_NEA_TXFBD_CONTEXT			__BITS(49,40)
 #define	RMIXL_NEA_TXFBD_ADDRESS			__BITS(39,0)
 
@@ -102,6 +129,16 @@
 #define	RMIXL_NEA_RXFID_ADDRESS			__BITS(39,6)
 #define	RMIXL_NEA_RXFID__RSRVD1			__BITS(5,0)
 
+#define	RMIXL_NAE_GMAC0_BASE(n)			(0x + 0x2000*(n))
+#define	RMIXL_NAE_GMAC1_BASE(n)			(0x0200 + 

CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2011-12-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 31 07:53:13 UTC 2011

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_intr.c

Log Message:
XLP8xx and XLP3xx have different IRT layouts.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.31 -r1.1.2.32 src/sys/arch/mips/rmi/rmixl_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/mips/rmi/rmixl_intr.c
diff -u src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.31 src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.32
--- src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.31	Sat Dec 24 01:57:54 2011
+++ src/sys/arch/mips/rmi/rmixl_intr.c	Sat Dec 31 07:53:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_intr.c,v 1.1.2.31 2011/12/24 01:57:54 matt Exp $	*/
+/*	$NetBSD: rmixl_intr.c,v 1.1.2.32 2011/12/31 07:53:12 matt Exp $	*/
 
 /*-
  * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
@@ -64,7 +64,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixl_intr.c,v 1.1.2.31 2011/12/24 01:57:54 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixl_intr.c,v 1.1.2.32 2011/12/31 07:53:12 matt Exp $);
 
 #include opt_ddb.h
 #include opt_multiprocessor.h
@@ -111,9 +111,9 @@ int iointr_debug = IOINTR_DEBUG;
 
 /* XXX this will need to deal with node */
 #define RMIXLP_PICREG_READ(off) \
-	rmixlp_read_8(RMIXL_PIC_PCITAG, (off))
+	rmixlp_read_8(RMIXLP_PIC_PCITAG, (off))
 #define	RMIXLP_PICREG_WRITE(off, val) \
-	rmixlp_write_8(RMIXL_PIC_PCITAG, (off), (val));
+	rmixlp_write_8(RMIXLP_PIC_PCITAG, (off), (val));
 
 /*
  * do not clear these when acking EIRR
@@ -128,6 +128,7 @@ int iointr_debug = IOINTR_DEBUG;
  * use the right display string table for the CPU that's running.
  */
 
+#ifdef MIPS64_XLR
 /*
  * rmixl_irtnames_xlrxxx
  * - use for XLRxxx
@@ -156,7 +157,7 @@ static const char * const rmixl_irtnames
 	pic int 20 (gmac3),		/* 20 */
 	pic int 21 (xgs0),		/* 21 */
 	pic int 22 (xgs1),		/* 22 */
-	pic int 23 (irq23),		/* 23 */
+	pic int 23 (?),		/* 23 */
 	pic int 24 (hyper_fatal),	/* 24 */
 	pic int 25 (bridge_aerr),	/* 25 */
 	pic int 26 (bridge_berr),	/* 26 */
@@ -166,7 +167,9 @@ static const char * const rmixl_irtnames
 	pic int 30 (gpio_fatal),	/* 30 */
 	pic int 31 (reserved),	/* 31 */
 };
+#endif /* MIPS64_XLR */
 
+#ifdef MIPS64_XLS
 /*
  * rmixl_irtnames_xls2xx
  * - use for XLS2xx
@@ -187,20 +190,20 @@ static const char * const rmixl_irtnames
 	pic int 12 (i2c1),		/* 12 */
 	pic int 13 (pcmcia),		/* 13 */
 	pic int 14 (gpio_a),		/* 14 */
-	pic int 15 (irq15),		/* 15 */
+	pic int 15 (?),		/* 15 */
 	pic int 16 (bridge_tb),	/* 16 */
 	pic int 17 (gmac0),		/* 17 */
 	pic int 18 (gmac1),		/* 18 */
 	pic int 19 (gmac2),		/* 19 */
 	pic int 20 (gmac3),		/* 20 */
-	pic int 21 (irq21),		/* 21 */
-	pic int 22 (irq22),		/* 22 */
+	pic int 21 (?),		/* 21 */
+	pic int 22 (?),		/* 22 */
 	pic int 23 (pcie_link2),	/* 23 */
 	pic int 24 (pcie_link3),	/* 24 */
 	pic int 25 (bridge_err),	/* 25 */
 	pic int 26 (pcie_link0),	/* 26 */
 	pic int 27 (pcie_link1),	/* 27 */
-	pic int 28 (irq28),		/* 28 */
+	pic int 28 (?),		/* 28 */
 	pic int 29 (pcie_err),	/* 29 */
 	pic int 30 (gpio_b),		/* 30 */
 	pic int 31 (usb),		/* 31 */
@@ -226,20 +229,20 @@ static const char * const rmixl_irtnames
 	pic int 12 (i2c1),		/* 12 */
 	pic int 13 (pcmcia),		/* 13 */
 	pic int 14 (gpio_a),		/* 14 */
-	pic int 15 (irq15),		/* 15 */
+	pic int 15 (?),		/* 15 */
 	pic int 16 (bridge_tb),	/* 16 */
 	pic int 17 (gmac0),		/* 17 */
 	pic int 18 (gmac1),		/* 18 */
 	pic int 19 (gmac2),		/* 19 */
 	pic int 20 (gmac3),		/* 20 */
-	pic int 21 (irq21),		/* 21 */
-	pic int 22 (irq22),		/* 22 */
-	pic int 23 (irq23),		/* 23 */
-	pic int 24 (irq24),		/* 24 */
+	pic int 21 (?),		/* 21 */
+	pic int 22 (?),		/* 22 */
+	pic int 23 (?),		/* 23 */
+	pic int 24 (?),		/* 24 */
 	pic int 25 (bridge_err),	/* 25 */
 	pic int 26 (pcie_link0),	/* 26 */
 	pic int 27 (pcie_link1),	/* 27 */
-	pic int 28 (irq28),		/* 28 */
+	pic int 28 (?),		/* 28 */
 	pic int 29 (pcie_err),	/* 29 */
 	pic int 30 (gpio_b),		/* 30 */
 	pic int 31 (usb),		/* 31 */
@@ -265,16 +268,16 @@ static const char * const rmixl_irtnames
 	pic int 12 (i2c1),		/* 12 */
 	pic int 13 (pcmcia),		/* 13 */
 	pic int 14 (gpio_a),		/* 14 */
-	pic int 15 (irq15),		/* 15 */
+	pic int 15 (?),		/* 15 */
 	pic int 16 (bridge_tb),	/* 16 */
 	pic int 17 (gmac0),		/* 17 */
 	pic int 18 (gmac1),		/* 18 */
 	pic int 19 (gmac2),		/* 19 */
 	pic int 20 (gmac3),		/* 20 */
-	pic int 21 (irq21),		/* 21 */
-	pic int 22 (irq22),		/* 22 */
-	pic int 23 (irq23),		/* 23 */
-	pic int 24 (irq24),		/* 24 */
+	pic int 21 (?),		/* 21 */
+	pic int 22 (?),		/* 22 */
+	pic int 23 (?),		/* 23 */
+	pic int 24 (?),		/* 24 */
 	pic int 25 (bridge_err),	/* 25 */
 	pic int 26 (pcie_link0),	/* 26 */
 	pic int 27 (pcie_link1),	/* 27 */
@@ -283,12 +286,14 @@ static const char * const rmixl_irtnames
 	pic int 30 (gpio_b),		/* 30 */
 	pic int 31 (usb),		/* 31 */
 };
+#endif /* 

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

2011-12-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Dec 30 08:33:49 UTC 2011

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

Log Message:
Add PA8700.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/hp700/conf/GENERIC

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



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

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

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

Log Message:
send framebuffer updates for cursor changes too


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 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.



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

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

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

Log Message:
take nrows into account when calculating the update rectangle in vncfb_copyrows


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 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.



CVS commit: src/sys/arch/usermode

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

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

Log Message:
optimize rfb updates by allowing queueing of multiple update messages,
dropping duplicates, and transmitting them in batches


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.56 -r1.57 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.



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

2011-12-30 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Dec 30 11:00:02 UTC 2011

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

Log Message:
Use a wrapper around the send() to make sure it will transmit EVERYTHING and
not just a part of the data


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 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.



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

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

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

Log Message:
double SIGIO_MAX_HANDLERS


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 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.



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

2011-12-30 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Dec 30 11:05:07 UTC 2011

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

Log Message:
Rename variable Bpp to bytes_per_pixel


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 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.



CVS commit: src/sys/arch/usermode

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

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

Log Message:
use O_ASYNC + SIGIO instead of polling for input


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/usermode/dev/vncfb.c
cvs rdiff -u -r1.59 -r1.60 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.



CVS commit: src/sys/arch/usermode

2011-12-30 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Dec 30 11:32:57 UTC 2011

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

Log Message:
Add RFB type flag to indicate what kind of request is waiting


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.60 -r1.61 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.



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

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

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

Log Message:
print key event info if RFB_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 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.



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.



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.



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

2011-12-30 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Fri Dec 30 12:16:19 UTC 2011

Modified Files:
src/sys/arch/xen/x86: xen_ipi.c

Log Message:
Remove spurious (debug) printf()


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/xen/x86/xen_ipi.c

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



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

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

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

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


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

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



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.



CVS commit: src/sys/arch/usermode

2011-12-30 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Dec 30 13:08:30 UTC 2011

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

Log Message:
Implement VNC's copyrect sending and let the copyrows use the new
vncfb_copyrecs()


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/usermode/dev/vncfb.c
cvs rdiff -u -r1.64 -r1.65 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.



CVS commit: src/share/man/man4

2011-12-30 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Fri Dec 30 14:12:15 UTC 2011

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

Log Message:
Document that overflow in P[X+k:n] terminates a filter program.
Based on a discussion with Christos on source-changes-d.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/share/man/man4/bpf.4

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



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.



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.



CVS commit: src/sys/dev/pci

2011-12-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Dec 30 14:32:31 UTC 2011

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

Log Message:
this should have been committed along with the previous changes in
radeonfb.c


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/radeonfbvar.h

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



CVS commit: xsrc/xfree/xc/programs/Xserver

2011-12-30 Thread Ignatios Souvatzis
Module Name:xsrc
Committed By:   is
Date:   Fri Dec 30 16:48:04 UTC 2011

Modified Files:
xsrc/xfree/xc/programs/Xserver/fb: fbpict.c
xsrc/xfree/xc/programs/Xserver/mi: miarc.c misprite.c

Log Message:
This fix is taken from xorg-server 1.9.2.

mod(a,b) used to be defined with a - in front of naked a, such that uses
of mod with certain arithmetic expressions as a led to surprising results,
namely the one in Xrender praised in CVE-2010-1166.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 xsrc/xfree/xc/programs/Xserver/fb/fbpict.c
cvs rdiff -u -r1.1.1.5 -r1.2 xsrc/xfree/xc/programs/Xserver/mi/miarc.c \
xsrc/xfree/xc/programs/Xserver/mi/misprite.c

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



CVS commit: src/sys/arch

2011-12-30 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Fri Dec 30 16:55:21 UTC 2011

Modified Files:
src/sys/arch/x86/x86: pmap.c
src/sys/arch/xen/include: xenpmap.h
src/sys/arch/xen/x86: cpu.c xen_pmap.c

Log Message:
per-cpu shadow directory pages should be updated locally via cross-calls. Do 
this.


To generate a diff of this commit:
cvs rdiff -u -r1.147 -r1.148 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/xen/include/xenpmap.h
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/xen/x86/cpu.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/xen/x86/xen_pmap.c

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



CVS commit: src/sys/arch

2011-12-30 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Fri Dec 30 17:57:49 UTC 2011

Modified Files:
src/sys/arch/i386/i386: machdep.c
src/sys/arch/i386/include: cpu.h
src/sys/arch/x86/include: cpu.h
src/sys/arch/x86/x86: pmap.c

Log Message:
Move the per-cpu l3 page allocation code to a separate MD function. Avoids code 
duplication for xen PAE


To generate a diff of this commit:
cvs rdiff -u -r1.714 -r1.715 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.177 -r1.178 src/sys/arch/i386/include/cpu.h
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.148 -r1.149 src/sys/arch/x86/x86/pmap.c

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



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

2011-12-30 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Fri Dec 30 18:01:20 UTC 2011

Modified Files:
src/sys/arch/xen/x86: cpu.c

Log Message:
Force pae l3 page allocation for new vcpus to be  4G, so they fit in 32bits


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

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



CVS commit: src/sys/dev/pci

2011-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 30 18:20:46 UTC 2011

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

Log Message:
PR/45760: Henning Petersen: Add Adaptec29329LPE to ahd_pci.c


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/pci/ahd_pci.c

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



CVS commit: src/sys/uvm

2011-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 30 19:01:07 UTC 2011

Modified Files:
src/sys/uvm: uvm_meter.c

Log Message:
prevent kernel from writing more than userland passed.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/uvm/uvm_meter.c

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



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

2011-12-30 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Fri Dec 30 19:18:35 UTC 2011

Modified Files:
src/sys/arch/xen/x86: cpu.c

Log Message:
Never cut-paste code from email!
Use the right count (0 - 2) of l3 unshared userland entries for per-cpu 
initialisation.


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

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



CVS commit: src/sys/arch/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.



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.



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.



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.



CVS commit: src/sys/dev/pci

2011-12-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Dec 30 20:11:23 UTC 2011

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

Log Message:
add some register definitions


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/radeonfbreg.h

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



CVS commit: src/sys/kern

2011-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 30 20:33:04 UTC 2011

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

Log Message:
Avoid panic on DIAGNOSTIC kernels with ktrace -p not-existing-process
The old logic was:

error = ktrace_common(, fp);
if (fp)
if (error)
fd_abort(, fp, );
else
fd_abort(, NULL, );

The 'if (fp)' portion really means if the op is not KTROP_CLEAR,
since the logic above always sets up fp otherwise, so change the
code to test this directly.

ktrace_common() can return an error both on the kernel thread
creation failure, which means that we should be calling fd_abort()
with fp, since nobody used the file yet and we should clear it now.
But it can also return an error because later, after the thread
creation if the process or process group was not found. In this
second case, we should be calling fd_abort with NULL, since the fp
is now used by the thread and it is going to clean it later. So
instead of checking the error from ktrace_common() to decide if we
are going to call fd_abort() with a NULL fp or not, let krace_common()
decide for us.  So the new logic becomes:

error = ktrace_common(, fp);
if (op != KTROP_CLEAR)
fd_abort(, fp, );

Since I am here, fix a freed memory access, by setting ktd to FALSE.


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.160 src/sys/kern/kern_ktrace.c

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



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

2011-12-30 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Dec 30 21:14:58 UTC 2011

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

Log Message:
Add template code for a client driven display update request. This is
currently not possible since its event parameter is not allways passed.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 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.



CVS commit: src/sys/dev/usb

2011-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Dec 31 00:08:48 UTC 2011

Modified Files:
src/sys/dev/usb: files.usb usbdevs
Added Files:
src/sys/dev/usb: uipad.c

Log Message:
Add a tiny driver that sends the magic command to an ipad instructing it
to charge.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/usb/files.usb
cvs rdiff -u -r0 -r1.1 src/sys/dev/usb/uipad.c
cvs rdiff -u -r1.602 -r1.603 src/sys/dev/usb/usbdevs

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



CVS commit: src/sys/dev/usb

2011-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Dec 31 00:09:11 UTC 2011

Modified Files:
src/sys/dev/usb: usbdevs.h usbdevs_data.h

Log Message:
Regen


To generate a diff of this commit:
cvs rdiff -u -r1.595 -r1.596 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.596 -r1.597 src/sys/dev/usb/usbdevs_data.h

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



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

2011-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Dec 31 00:10:06 UTC 2011

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

Log Message:
Add an ipad


To generate a diff of this commit:
cvs rdiff -u -r1.341 -r1.342 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.



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

2011-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Dec 31 00:11:21 UTC 2011

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

Log Message:
add uipad


To generate a diff of this commit:
cvs rdiff -u -r1.328 -r1.329 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1060 -r1.1061 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.



CVS commit: src/sys/dev/bluetooth

2011-12-30 Thread Radoslaw Kujawa
Module Name:src
Committed By:   rkujawa
Date:   Sat Dec 31 01:16:09 UTC 2011

Modified Files:
src/sys/dev/bluetooth: bthidev.c btkbd.c

Log Message:
Fix panic triggered by pressing the caps lock key:
http://c0ff33.net/drop/bt_caps_panic.jpg

OK'd mrg.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/bluetooth/bthidev.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/bluetooth/btkbd.c

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



CVS commit: [matt-nb5-mips64] src/sys/dev/pci

2011-12-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 31 02:25:43 UTC 2011

Modified Files:
src/sys/dev/pci [matt-nb5-mips64]: pcidevs

Log Message:
Add XLP RXE and SRIO product ids.


To generate a diff of this commit:
cvs rdiff -u -r1.962.4.1.4.5 -r1.962.4.1.4.6 src/sys/dev/pci/pcidevs

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



CVS commit: [matt-nb5-mips64] src/sys/dev/pci

2011-12-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 31 02:26:41 UTC 2011

Modified Files:
src/sys/dev/pci [matt-nb5-mips64]: pcidevs.h pcidevs_data.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.963.4.1.4.5 -r1.963.4.1.4.6 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.962.4.1.4.5 -r1.962.4.1.4.6 src/sys/dev/pci/pcidevs_data.h

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2011-12-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 31 03:33:13 UTC 2011

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_gpio_pci.c

Log Message:
Fix xlgpio_pin_ctl inversion problem.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/mips/rmi/rmixl_gpio_pci.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2011-12-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 31 04:30:53 UTC 2011

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_gpio_pci.c rmixlreg.h

Log Message:
Deal with the movement of some GPIO registers on the XPL3xx.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/mips/rmi/rmixl_gpio_pci.c
cvs rdiff -u -r1.1.2.16 -r1.1.2.17 src/sys/arch/mips/rmi/rmixlreg.h

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2011-12-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 31 04:54:28 UTC 2011

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_i2creg.h rmixl_naereg.h
rmixlp_pcie.c rmixlreg.h

Log Message:
Consolidate and complete PCITAGs.
Print/Set BARs for AHCI and SRIO.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/mips/rmi/rmixl_i2creg.h \
src/sys/arch/mips/rmi/rmixl_naereg.h
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/arch/mips/rmi/rmixlp_pcie.c
cvs rdiff -u -r1.1.2.17 -r1.1.2.18 src/sys/arch/mips/rmi/rmixlreg.h

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2011-12-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 31 07:53:13 UTC 2011

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_intr.c

Log Message:
XLP8xx and XLP3xx have different IRT layouts.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.31 -r1.1.2.32 src/sys/arch/mips/rmi/rmixl_intr.c

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