CVS commit: src/common/lib/libprop

2011-09-27 Thread Jean-Yves Migeon
Module Name:src
Committed By:   jym
Date:   Tue Sep 27 11:12:49 UTC 2011

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

Log Message:
Indicate type of return variable for prop_dictionary_sendrecv_ioctl.


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

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

Modified files:

Index: src/common/lib/libprop/prop_send_ioctl.3
diff -u src/common/lib/libprop/prop_send_ioctl.3:1.7 src/common/lib/libprop/prop_send_ioctl.3:1.8
--- src/common/lib/libprop/prop_send_ioctl.3:1.7	Thu Jan 20 10:45:10 2011
+++ src/common/lib/libprop/prop_send_ioctl.3	Tue Sep 27 11:12:49 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: prop_send_ioctl.3,v 1.7 2011/01/20 10:45:10 wiz Exp $
+.\	$NetBSD: prop_send_ioctl.3,v 1.8 2011/09/27 11:12:49 jym Exp $
 .\
 .\ Copyright (c) 2006 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -49,6 +49,7 @@
 .Ft int
 .Fn prop_dictionary_recv_ioctl int fd unsigned long cmd \
 prop_dictionary_t *dictp
+.Ft int
 .Fn prop_dictionary_sendrecv_ioctl prop_dictionary_t dict int fd \
 unsigned long cmd prop_dictionary_t *dictp
 .Sh DESCRIPTION



CVS commit: src

2011-09-27 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Tue Sep 27 11:24:21 UTC 2011

Modified Files:
src/include: paths.h
src/tests/include: t_paths.c
src/usr.sbin/cpuctl: cpuctl.c

Log Message:
Define _PATH_CPUCTL.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/include/paths.h
cvs rdiff -u -r1.8 -r1.9 src/tests/include/t_paths.c
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/cpuctl/cpuctl.c

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

Modified files:

Index: src/include/paths.h
diff -u src/include/paths.h:1.39 src/include/paths.h:1.40
--- src/include/paths.h:1.39	Wed Dec 29 15:53:57 2010
+++ src/include/paths.h	Tue Sep 27 11:24:20 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: paths.h,v 1.39 2010/12/29 15:53:57 pooka Exp $	*/
+/*	$NetBSD: paths.h,v 1.40 2011/09/27 11:24:20 jruoho Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -61,6 +61,7 @@
 #define	_PATH_CLOCKCTL	/dev/clockctl
 #define	_PATH_CONSOLE	/dev/console
 #define	_PATH_CONSTTY	/dev/constty
+#define _PATH_CPUCTL	/dev/cpuctl
 #define	_PATH_CSMAPPER	/usr/share/i18n/csmapper
 #define	_PATH_DEFTAPE	/dev/nrst0
 #define	_PATH_DEVDB	/var/run/dev.db

Index: src/tests/include/t_paths.c
diff -u src/tests/include/t_paths.c:1.8 src/tests/include/t_paths.c:1.9
--- src/tests/include/t_paths.c:1.8	Fri Aug 12 03:59:44 2011
+++ src/tests/include/t_paths.c	Tue Sep 27 11:24:21 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_paths.c,v 1.8 2011/08/12 03:59:44 riastradh Exp $ */
+/*	$NetBSD: t_paths.c,v 1.9 2011/09/27 11:24:21 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_paths.c,v 1.8 2011/08/12 03:59:44 riastradh Exp $);
+__RCSID($NetBSD: t_paths.c,v 1.9 2011/09/27 11:24:21 jruoho Exp $);
 
 #include sys/param.h
 #include sys/stat.h
@@ -59,6 +59,7 @@ static const struct {
 	{ _PATH_CLOCKCTL,	PATH_DEV | PATH_ROOT	},
 	{ _PATH_CONSOLE,	PATH_DEV | PATH_ROOT	},
 	{ _PATH_CONSTTY,	PATH_DEV | PATH_ROOT	},
+	{ _PATH_CPUCTL,		PATH_DEV		},
 	{ _PATH_CSMAPPER,	PATH_DIR		},
 	{ _PATH_DEFTAPE,	PATH_DEV | PATH_ROOT	},
 	{ _PATH_DEVDB,		PATH_FILE		},
@@ -91,7 +92,7 @@ static const struct {
 	{ _PATH_SOUND0,		PATH_DEV		},
 	{ _PATH_SYSMON,		PATH_DEV		},
 	{ _PATH_TTY,		PATH_DEV		},
-	{ _PATH_UNIX,		PATH_FILE		},
+	{ _PATH_UNIX,		PATH_FILE | PATH_ROOT	},
 	{ _PATH_URANDOM,	PATH_DEV		},
 	{ _PATH_VIDEO,		PATH_DEV		},
 	{ _PATH_VIDEO0,		PATH_DEV		},

Index: src/usr.sbin/cpuctl/cpuctl.c
diff -u src/usr.sbin/cpuctl/cpuctl.c:1.18 src/usr.sbin/cpuctl/cpuctl.c:1.19
--- src/usr.sbin/cpuctl/cpuctl.c:1.18	Mon Sep 26 06:51:57 2011
+++ src/usr.sbin/cpuctl/cpuctl.c	Tue Sep 27 11:24:21 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuctl.c,v 1.18 2011/09/26 06:51:57 jruoho Exp $	*/
+/*	$NetBSD: cpuctl.c,v 1.19 2011/09/27 11:24:21 jruoho Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #ifndef lint
 #include sys/cdefs.h
-__RCSID($NetBSD: cpuctl.c,v 1.18 2011/09/26 06:51:57 jruoho Exp $);
+__RCSID($NetBSD: cpuctl.c,v 1.19 2011/09/27 11:24:21 jruoho Exp $);
 #endif /* not lint */
 
 #include sys/param.h
@@ -42,6 +42,7 @@ __RCSID($NetBSD: cpuctl.c,v 1.18 2011/0
 #include err.h
 #include errno.h
 #include fcntl.h
+#include paths.h
 #include stdio.h
 #include stdlib.h
 #include stdarg.h
@@ -87,8 +88,8 @@ main(int argc, char **argv)
 	if (argc  2)
 		usage();
 
-	if ((fd = open(/dev/cpuctl, O_RDWR))  0)
-		err(EXIT_FAILURE, /dev/cpuctl);
+	if ((fd = open(_PATH_CPUCTL, O_RDWR))  0)
+		err(EXIT_FAILURE, _PATH_CPUCTL);
 
 	for (ct = cpu_cmdtab; ct-label != NULL; ct++) {
 		if (strcmp(argv[1], ct-label) == 0) {



CVS commit: src/sys/rump/librump/rumpvfs

2011-09-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Sep 27 13:53:27 UTC 2011

Modified Files:
src/sys/rump/librump/rumpvfs: rumpfs.c

Log Message:
fix confusion between MAXPATHLEN and MAXNAMLEN


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/rump/librump/rumpvfs/rumpfs.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/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.101 src/sys/rump/librump/rumpvfs/rumpfs.c:1.102
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.101	Mon Sep 26 21:45:04 2011
+++ src/sys/rump/librump/rumpvfs/rumpfs.c	Tue Sep 27 09:53:26 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfs.c,v 1.101 2011/09/27 01:45:04 christos Exp $	*/
+/*	$NetBSD: rumpfs.c,v 1.102 2011/09/27 13:53:26 christos Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rumpfs.c,v 1.101 2011/09/27 01:45:04 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: rumpfs.c,v 1.102 2011/09/27 13:53:26 christos Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -229,7 +229,7 @@ static struct rumpfs_node *makeprivate(e
  */
 
 struct etfs {
-	char et_key[RUMPFS_MAXPATHLEN];
+	char et_key[MAXPATHLEN];
 	size_t et_keylen;
 	bool et_prefixkey;
 	bool et_removing;
@@ -1076,7 +1076,7 @@ rump_vop_symlink(void *v)
 	int rv;
 
 	linklen = strlen(target);
-	KASSERT(linklen  RUMPFS_MAXPATHLEN);
+	KASSERT(linklen  MAXPATHLEN);
 	rn = makeprivate(VLNK, NODEV, linklen, false);
 	if ((cnp-cn_flags  ISWHITEOUT) != 0)
 		rn-rn_va.va_flags |= UF_OPAQUE;
@@ -1086,7 +1086,7 @@ rump_vop_symlink(void *v)
 
 	makedir(rnd, cnp, rn);
 
-	KASSERT(linklen  RUMPFS_MAXPATHLEN);
+	KASSERT(linklen  MAXPATHLEN);
 	rn-rn_linktarg = PNBUF_GET();
 	rn-rn_linklen = linklen;
 	strcpy(rn-rn_linktarg, target);
@@ -1500,7 +1500,7 @@ rump_vop_pathconf(void *v)
 		*retval = 43; /* this one goes to 11 */
 		return 0;
 	case _PC_SYMLINK_MAX:
-		*retval = RUMPFS_MAXPATHLEN;
+		*retval =_MAXPATHLEN;
 		return 0;
 	case _PC_2_SYMLINKS:
 		*retval = 1;



CVS commit: src/sys/rump/librump/rumpvfs

2011-09-27 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Tue Sep 27 14:24:52 UTC 2011

Modified Files:
src/sys/rump/librump/rumpvfs: rumpfs.c

Log Message:
Underscores are sometimes overrated.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/rump/librump/rumpvfs/rumpfs.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/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.102 src/sys/rump/librump/rumpvfs/rumpfs.c:1.103
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.102	Tue Sep 27 13:53:26 2011
+++ src/sys/rump/librump/rumpvfs/rumpfs.c	Tue Sep 27 14:24:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfs.c,v 1.102 2011/09/27 13:53:26 christos Exp $	*/
+/*	$NetBSD: rumpfs.c,v 1.103 2011/09/27 14:24:52 mbalmer Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rumpfs.c,v 1.102 2011/09/27 13:53:26 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: rumpfs.c,v 1.103 2011/09/27 14:24:52 mbalmer Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -1500,7 +1500,7 @@ rump_vop_pathconf(void *v)
 		*retval = 43; /* this one goes to 11 */
 		return 0;
 	case _PC_SYMLINK_MAX:
-		*retval =_MAXPATHLEN;
+		*retval = MAXPATHLEN;
 		return 0;
 	case _PC_2_SYMLINKS:
 		*retval = 1;



CVS commit: src/external/gpl3/gdb/dist/gdb

2011-09-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Sep 27 15:04:19 UTC 2011

Modified Files:
src/external/gpl3/gdb/dist/gdb: i386nbsd-tdep.c

Log Message:
disable kernel trap frame crawling on i386 until it is fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/gpl3/gdb/dist/gdb/i386nbsd-tdep.c

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

Modified files:

Index: src/external/gpl3/gdb/dist/gdb/i386nbsd-tdep.c
diff -u src/external/gpl3/gdb/dist/gdb/i386nbsd-tdep.c:1.2 src/external/gpl3/gdb/dist/gdb/i386nbsd-tdep.c:1.3
--- src/external/gpl3/gdb/dist/gdb/i386nbsd-tdep.c:1.2	Sun Sep 25 12:30:25 2011
+++ src/external/gpl3/gdb/dist/gdb/i386nbsd-tdep.c	Tue Sep 27 11:04:19 2011
@@ -40,7 +40,7 @@
 #include elf-bfd.h		/* for header hack */
 #include trad-frame.h		/* signal trampoline/kernel frame support */
 #include frame-unwind.h	/* kernel frame support */
-#include tramp-frame.h	/* signal trampoline/kernel frame support
+#include tramp-frame.h	/* signal trampoline/kernel frame support */
 
 /* From machine/reg.h.  */
 static int i386nbsd_r_reg_offset[] =
@@ -304,6 +304,7 @@ i386nbsd_trapframe_cache(struct frame_in
   ULONGEST cs;
   char *name;
   int i;
+  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
 
   if (*this_cache)
 return *this_cache;
@@ -311,14 +312,14 @@ i386nbsd_trapframe_cache(struct frame_in
   cache = trad_frame_cache_zalloc (next_frame);
   *this_cache = cache;
 
-  func = frame_func_unwind (next_frame);
+  func = get_frame_func (next_frame);
   sp = frame_unwind_register_unsigned (next_frame, I386_ESP_REGNUM);
 
   find_pc_partial_function (func, name, NULL, NULL);
   if (name  strncmp (name, Xintr, 5) == 0)
 {
   /* It's an interrupt frame. */
-  tmp = read_memory_unsigned_integer (sp + 4, 4);
+  tmp = read_memory_unsigned_integer (sp + 4, 4, byte_order);
   if (tmp  15)
 {
   /* Reasonable value for 'ppl': already on interrupt stack. */
@@ -342,7 +343,7 @@ i386nbsd_trapframe_cache(struct frame_in
 
   /* Read %cs from trap frame.  */
   addr += i386nbsd_tf_reg_offset[I386_CS_REGNUM];
-  cs = read_memory_unsigned_integer (addr, 4); 
+  cs = read_memory_unsigned_integer (addr, 4, byte_order); 
   if ((cs  I386_SEL_RPL) == I386_SEL_UPL)
 {
   /* Trap from user space; terminate backtrace.  */
@@ -367,18 +368,14 @@ i386nbsd_trapframe_this_id (struct frame
   trad_frame_get_id (cache, this_id);
 }
 
-static void
+static struct value *
 i386nbsd_trapframe_prev_register (struct frame_info *next_frame,
-  void **this_cache, int regnum,
-  int *optimizedp, enum lval_type *lvalp,
-  CORE_ADDR *addrp, int *realnump,
-  gdb_byte *valuep)
+  void **this_cache, int regnum)
 {
   struct trad_frame_cache *cache =
 i386nbsd_trapframe_cache (next_frame, this_cache);
 
-  trad_frame_get_register (cache, next_frame, regnum,
-			   optimizedp, lvalp, addrp, realnump, valuep);
+  return trad_frame_get_register (cache, next_frame, regnum);
 }
 
 static int
@@ -396,7 +393,7 @@ i386nbsd_trapframe_sniffer (const struct
 return 0;
 
 
-  find_pc_partial_function (frame_pc_unwind (next_frame), name, NULL, NULL);
+  find_pc_partial_function (get_frame_pc (next_frame), name, NULL, NULL);
   return (name  ((strcmp (name, alltraps) == 0)
 		   || (strcmp (name, calltrap) == 0)
 		   || (strncmp (name, Xtrap, 5) == 0)
@@ -415,6 +412,7 @@ const struct frame_unwind i386nbsd_trapf
  frame, but SIGTRAMP_FRAME would print signal handler called,
  which really is not what we want here.  */
   NORMAL_FRAME,
+  default_frame_unwind_stop_reason,
   i386nbsd_trapframe_this_id,
   i386nbsd_trapframe_prev_register,
   NULL,
@@ -450,9 +448,10 @@ i386nbsd_init_abi (struct gdbarch_info i
   tramp_frame_prepend_unwinder (gdbarch, i386nbsd_sigtramp_si2);
   tramp_frame_prepend_unwinder (gdbarch, i386nbsd_sigtramp_si31);
   tramp_frame_prepend_unwinder (gdbarch, i386nbsd_sigtramp_si4);
-
+#ifdef notyet
   /* Unwind kernel trap frames correctly.  */
   frame_unwind_prepend_unwinder (gdbarch, i386nbsd_trapframe_unwind);
+#endif
 }
 
 /* NetBSD ELF.  */



CVS commit: src/sys/sys

2011-09-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Sep 27 23:04:18 UTC 2011

Modified Files:
src/sys/sys: param.h

Log Message:
Welcome to .56; NAME_MAX bump.


To generate a diff of this commit:
cvs rdiff -u -r1.394 -r1.395 src/sys/sys/param.h

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

Modified files:

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.394 src/sys/sys/param.h:1.395
--- src/sys/sys/param.h:1.394	Mon Sep 26 21:40:32 2011
+++ src/sys/sys/param.h	Tue Sep 27 19:04:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.394 2011/09/27 01:40:32 christos Exp $	*/
+/*	$NetBSD: param.h,v 1.395 2011/09/27 23:04:18 christos Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -63,7 +63,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	599005500	/* NetBSD 5.99.55 */
+#define	__NetBSD_Version__	599005600	/* NetBSD 5.99.56 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) = __NetBSD_Version__)



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

2011-09-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Sep 27 23:25:55 UTC 2011

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

Log Message:
Make the 'size' argument of _bus_dmamap_load_busaddr() a bus_size_t for
consistency's sake.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/x86/x86/bus_dma.c

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

Modified files:

Index: src/sys/arch/x86/x86/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.60 src/sys/arch/x86/x86/bus_dma.c:1.61
--- src/sys/arch/x86/x86/bus_dma.c:1.60	Tue Sep 13 17:59:46 2011
+++ src/sys/arch/x86/x86/bus_dma.c	Tue Sep 27 23:25:55 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.60 2011/09/13 17:59:46 dyoung Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.61 2011/09/27 23:25:55 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.60 2011/09/13 17:59:46 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.61 2011/09/27 23:25:55 dyoung Exp $);
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -168,7 +168,7 @@ static void _bus_dma_free_bouncebuf(bus_
 static int _bus_dmamap_load_buffer(bus_dma_tag_t t, bus_dmamap_t map,
 	void *buf, bus_size_t buflen, struct vmspace *vm, int flags);
 static inline int _bus_dmamap_load_busaddr(bus_dma_tag_t, bus_dmamap_t,
-bus_addr_t, int);
+bus_addr_t, bus_size_t);
 
 #ifndef _BUS_DMAMEM_ALLOC_RANGE
 static int	_bus_dmamem_alloc_range(bus_dma_tag_t tag, bus_size_t size,
@@ -436,7 +436,7 @@ _bus_dmamap_load(bus_dma_tag_t t, bus_dm
 
 static inline int
 _bus_dmamap_load_busaddr(bus_dma_tag_t t, bus_dmamap_t map,
-bus_addr_t addr, int size)
+bus_addr_t addr, bus_size_t size)
 {
 	bus_dma_segment_t * const segs = map-dm_segs;
 	int nseg = map-dm_nsegs;



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

2011-09-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Sep 27 23:33:35 UTC 2011

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

Log Message:
In _bus_dmamap_load_busaddr(), change sgsize from an int to a bus_size_t.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/x86/x86/bus_dma.c

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

Modified files:

Index: src/sys/arch/x86/x86/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.61 src/sys/arch/x86/x86/bus_dma.c:1.62
--- src/sys/arch/x86/x86/bus_dma.c:1.61	Tue Sep 27 23:25:55 2011
+++ src/sys/arch/x86/x86/bus_dma.c	Tue Sep 27 23:33:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.61 2011/09/27 23:25:55 dyoung Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.62 2011/09/27 23:33:35 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.61 2011/09/27 23:25:55 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.62 2011/09/27 23:33:35 dyoung Exp $);
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -442,7 +442,7 @@ _bus_dmamap_load_busaddr(bus_dma_tag_t t
 	int nseg = map-dm_nsegs;
 	bus_addr_t bmask = ~(map-_dm_boundary - 1);
 	bus_addr_t lastaddr = 0xdead; /* XXX gcc */
-	int sgsize;
+	bus_size_t sgsize;
 
 	if (nseg  0)
 		lastaddr = segs[nseg-1].ds_addr + segs[nseg-1].ds_len;



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

2011-09-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Sep 27 23:44:18 UTC 2011

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

Log Message:
Instead of declaring _bus_dmamap_load_busaddr() static inline, make
it static and let the compiler decide about inlining.  This reduces
the code size on both amd64 and i386, and the smaller code is probably
faster code.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/x86/x86/bus_dma.c

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

Modified files:

Index: src/sys/arch/x86/x86/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.62 src/sys/arch/x86/x86/bus_dma.c:1.63
--- src/sys/arch/x86/x86/bus_dma.c:1.62	Tue Sep 27 23:33:35 2011
+++ src/sys/arch/x86/x86/bus_dma.c	Tue Sep 27 23:44:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.62 2011/09/27 23:33:35 dyoung Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.63 2011/09/27 23:44:18 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.62 2011/09/27 23:33:35 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.63 2011/09/27 23:44:18 dyoung Exp $);
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -167,7 +167,7 @@ static int _bus_dma_alloc_bouncebuf(bus_
 static void _bus_dma_free_bouncebuf(bus_dma_tag_t t, bus_dmamap_t map);
 static int _bus_dmamap_load_buffer(bus_dma_tag_t t, bus_dmamap_t map,
 	void *buf, bus_size_t buflen, struct vmspace *vm, int flags);
-static inline int _bus_dmamap_load_busaddr(bus_dma_tag_t, bus_dmamap_t,
+static int _bus_dmamap_load_busaddr(bus_dma_tag_t, bus_dmamap_t,
 bus_addr_t, bus_size_t);
 
 #ifndef _BUS_DMAMEM_ALLOC_RANGE
@@ -434,7 +434,7 @@ _bus_dmamap_load(bus_dma_tag_t t, bus_dm
 	return (0);
 }
 
-static inline int
+static int
 _bus_dmamap_load_busaddr(bus_dma_tag_t t, bus_dmamap_t map,
 bus_addr_t addr, bus_size_t size)
 {



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

2011-09-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Sep 28 01:33:26 UTC 2011

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

Log Message:
Add an untested implementation of bus_dmamap_load_raw(9).


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/x86/x86/bus_dma.c

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

Modified files:

Index: src/sys/arch/x86/x86/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.63 src/sys/arch/x86/x86/bus_dma.c:1.64
--- src/sys/arch/x86/x86/bus_dma.c:1.63	Tue Sep 27 23:44:18 2011
+++ src/sys/arch/x86/x86/bus_dma.c	Wed Sep 28 01:33:26 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.63 2011/09/27 23:44:18 dyoung Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.64 2011/09/28 01:33:26 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.63 2011/09/27 23:44:18 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.64 2011/09/28 01:33:26 dyoung Exp $);
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -716,11 +716,44 @@ _bus_dmamap_load_uio(bus_dma_tag_t t, bu
  */
 static int
 _bus_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map,
-bus_dma_segment_t *segs, int nsegs,
-bus_size_t size, int flags)
+bus_dma_segment_t *segs, int nsegs, bus_size_t size0, int flags)
 {
+	bus_size_t size;
+	int i, error = 0;
+
+	/*
+	 * Make sure that on error condition we return no valid mappings.
+	 */
+	map-dm_mapsize = 0;
+	map-dm_nsegs = 0;
+	KASSERT(map-dm_maxsegsz = map-_dm_maxmaxsegsz);
+
+	if (size0  map-_dm_size)
+		return EINVAL;
+
+	for (i = 0, size = size0; i  nsegs  size  0; i++) {
+		bus_dma_segment_t *ds = segs[i];
+		bus_size_t sgsize;
 
-	panic(_bus_dmamap_load_raw: not implemented);
+		sgsize = MIN(ds-ds_len, size);
+		if (sgsize == 0)
+			continue;
+		error = _bus_dmamap_load_busaddr(t, map, ds-ds_addr, sgsize);
+		if (error != 0)
+			break;
+		size -= sgsize;
+	}
+
+	if (error != 0) {
+		map-dm_mapsize = 0;
+		map-dm_nsegs = 0;
+		return error;
+	}
+
+	/* XXX TBD bounce */
+
+	map-dm_mapsize = size0;
+	return 0;
 }
 
 /*



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

2011-09-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Sep 28 01:35:58 UTC 2011

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

Log Message:
In bus_dma_tag_create(9), copy important properties (e.g., bounce
parameters) from the parent tag.

In bus_dma_tag_create(), increase the reference count on a parent
bus_dma_tag_t (if applicable), and decrease the reference count in
bus_dma_tag_destroy().

Don't let bus_dmatag_destroy(9) destroy an overridden bus_dma_tag_t.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/x86/x86/bus_dma.c

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

Modified files:

Index: src/sys/arch/x86/x86/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.64 src/sys/arch/x86/x86/bus_dma.c:1.65
--- src/sys/arch/x86/x86/bus_dma.c:1.64	Wed Sep 28 01:33:26 2011
+++ src/sys/arch/x86/x86/bus_dma.c	Wed Sep 28 01:35:58 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.64 2011/09/28 01:33:26 dyoung Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.65 2011/09/28 01:35:58 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.64 2011/09/28 01:33:26 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.65 2011/09/28 01:35:58 dyoung Exp $);
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -1623,6 +1623,8 @@ bit_to_function_pointer(const struct bus
 void
 bus_dma_tag_destroy(bus_dma_tag_t bdt)
 {
+	if (bdt-bdt_super != NULL)
+		bus_dmatag_destroy(bdt-bdt_super);
 	kmem_free(bdt, sizeof(struct x86_bus_dma_tag));
 }
 
@@ -1642,6 +1644,10 @@ bus_dma_tag_create(bus_dma_tag_t obdt, c
 	if (bdt == NULL)
 		return ENOMEM;
 
+	*bdt = *obdt;
+	/* don't let bus_dmatag_destroy free these */
+	bdt-_tag_needs_free = 0;
+
 	bdt-bdt_super = obdt;
 
 	for (bits = present; bits != 0; bits = nbits) {
@@ -1661,6 +1667,8 @@ bus_dma_tag_create(bus_dma_tag_t obdt, c
 	bdt-bdt_ctx = ctx;
 
 	*bdtp = bdt;
+	if (obdt-_tag_needs_free)
+		obdt-_tag_needs_free++;
 
 	return 0;
 einval:



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

2011-09-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Sep 28 01:38:19 UTC 2011

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

Log Message:
After bouncing in bus_dmamap_load{,_mbuf,_uio}, call bus_dmamap_load(9)
instead of _bus_dmamap_load() so that a bus_dmamap_load(9) override has
a shot at loading the map.

XXX Perhaps bounce buffers should be rewritten in terms of bus_dma(9)
XXX overrides.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/x86/x86/bus_dma.c

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

Modified files:

Index: src/sys/arch/x86/x86/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.65 src/sys/arch/x86/x86/bus_dma.c:1.66
--- src/sys/arch/x86/x86/bus_dma.c:1.65	Wed Sep 28 01:35:58 2011
+++ src/sys/arch/x86/x86/bus_dma.c	Wed Sep 28 01:38:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.65 2011/09/28 01:35:58 dyoung Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.66 2011/09/28 01:38:19 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.65 2011/09/28 01:35:58 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.66 2011/09/28 01:38:19 dyoung Exp $);
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -424,7 +424,7 @@ _bus_dmamap_load(bus_dma_tag_t t, bus_dm
 	cookie-id_origbuflen = buflen;
 	cookie-id_buftype = X86_DMA_BUFTYPE_LINEAR;
 	map-dm_nsegs = 0;
-	error = _bus_dmamap_load(t, map, cookie-id_bouncebuf, buflen,
+	error = bus_dmamap_load(t, map, cookie-id_bouncebuf, buflen,
 	p, flags);
 	if (error)
 		return (error);
@@ -620,7 +620,7 @@ _bus_dmamap_load_mbuf(bus_dma_tag_t t, b
 	cookie-id_origbuf = m0;
 	cookie-id_origbuflen = m0-m_pkthdr.len;	/* not really used */
 	cookie-id_buftype = X86_DMA_BUFTYPE_MBUF;
-	error = _bus_dmamap_load(t, map, cookie-id_bouncebuf,
+	error = bus_dmamap_load(t, map, cookie-id_bouncebuf,
 	m0-m_pkthdr.len, NULL, flags);
 	if (error)
 		return (error);
@@ -700,7 +700,7 @@ _bus_dmamap_load_uio(bus_dma_tag_t t, bu
 	cookie-id_origbuf = uio;
 	cookie-id_origbuflen = uio-uio_resid;
 	cookie-id_buftype = X86_DMA_BUFTYPE_UIO;
-	error = _bus_dmamap_load(t, map, cookie-id_bouncebuf,
+	error = bus_dmamap_load(t, map, cookie-id_bouncebuf,
 	uio-uio_resid, NULL, flags);
 	if (error)
 		return (error);



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

2011-09-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Sep 28 01:45:49 UTC 2011

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

Log Message:
Cosmetic: join some if-statements, remove superfluous parentheses.  No
change in the generated assembly.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/x86/x86/bus_dma.c

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

Modified files:

Index: src/sys/arch/x86/x86/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.66 src/sys/arch/x86/x86/bus_dma.c:1.67
--- src/sys/arch/x86/x86/bus_dma.c:1.66	Wed Sep 28 01:38:19 2011
+++ src/sys/arch/x86/x86/bus_dma.c	Wed Sep 28 01:45:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.66 2011/09/28 01:38:19 dyoung Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.67 2011/09/28 01:45:49 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.66 2011/09/28 01:38:19 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.67 2011/09/28 01:45:49 dyoung Exp $);
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -395,12 +395,10 @@ _bus_dmamap_load(bus_dma_tag_t t, bus_dm
 		return 0;
 	}
 
-	if (cookie == NULL)
-		return error;
-	if ((cookie-id_flags  X86_DMA_MIGHT_NEED_BOUNCE) == 0)
+	if (cookie == NULL ||
+	(cookie-id_flags  X86_DMA_MIGHT_NEED_BOUNCE) == 0)
 		return error;
 
-
 	/*
 	 * First attempt failed; bounce it.
 	 */
@@ -594,7 +592,7 @@ _bus_dmamap_load_mbuf(bus_dma_tag_t t, b
 	map-dm_nsegs = 0;
 
 	if (cookie == NULL ||
-	((cookie-id_flags  X86_DMA_MIGHT_NEED_BOUNCE) == 0))
+	(cookie-id_flags  X86_DMA_MIGHT_NEED_BOUNCE) == 0)
 		return error;
 
 	/*
@@ -678,7 +676,7 @@ _bus_dmamap_load_uio(bus_dma_tag_t t, bu
 	map-dm_nsegs = 0;
 
 	if (cookie == NULL ||
-	((cookie-id_flags  X86_DMA_MIGHT_NEED_BOUNCE) == 0))
+	(cookie-id_flags  X86_DMA_MIGHT_NEED_BOUNCE) == 0)
 		return error;
 
 	STAT_INCR(bounces);



CVS commit: src/sys/compat/netbsd32

2011-09-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Sep 28 01:46:39 UTC 2011

Modified Files:
src/sys/compat/netbsd32: netbsd32_ioctl.c netbsd32_ioctl.h

Log Message:
support WSDISPLAYIO_GCURSOR and WSDISPLAYIO_SCURSOR


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/compat/netbsd32/netbsd32_ioctl.c
cvs rdiff -u -r1.40 -r1.41 src/sys/compat/netbsd32/netbsd32_ioctl.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/compat/netbsd32/netbsd32_ioctl.c
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.61 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.62
--- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.61	Wed Sep  7 02:35:00 2011
+++ src/sys/compat/netbsd32/netbsd32_ioctl.c	Wed Sep 28 01:46:39 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.c,v 1.61 2011/09/07 02:35:00 macallan Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.c,v 1.62 2011/09/28 01:46:39 macallan Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: netbsd32_ioctl.c,v 1.61 2011/09/07 02:35:00 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: netbsd32_ioctl.c,v 1.62 2011/09/28 01:46:39 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -339,6 +339,28 @@ netbsd32_to_ieee80211_nwkey(struct netbs
 	}
 }
 
+static inline void
+netbsd32_to_wsdisplay_cursor(struct netbsd32_wsdisplay_cursor *c32,
+	   struct wsdisplay_cursor *c,
+	   u_long cmd)
+{
+	c-which = c32-which;
+	c-enable = c32-enable;
+	c-pos.x = c32-pos.x;
+	c-pos.y = c32-pos.y;
+	c-hot.x = c32-hot.x;
+	c-hot.y = c32-hot.y;
+	c-size.x = c32-size.x;
+	c-size.y = c32-size.y;
+	c-cmap.index = c32-cmap.index;
+	c-cmap.count = c32-cmap.count;
+	c-cmap.red = NETBSD32PTR64(c32-cmap.red);
+	c-cmap.green = NETBSD32PTR64(c32-cmap.green);
+	c-cmap.blue = NETBSD32PTR64(c32-cmap.blue);
+	c-image = NETBSD32PTR64(c32-image);
+	c-mask = NETBSD32PTR64(c32-mask);
+}
+
 /*
  * handle ioctl conversions from 64-bit kernel - netbsd32
  */
@@ -515,6 +537,28 @@ netbsd32_from_wsdisplay_addscreendata(st
 }
 
 static inline void
+netbsd32_from_wsdisplay_cursor(struct wsdisplay_cursor *c,
+	   struct netbsd32_wsdisplay_cursor *c32,
+	   u_long cmd)
+{
+	c32-which = c-which;
+	c32-enable = c-enable;
+	c32-pos.x = c-pos.x;
+	c32-pos.y = c-pos.y;
+	c32-hot.x = c-hot.x;
+	c32-hot.y = c-hot.y;
+	c32-size.x = c-size.x;
+	c32-size.y = c-size.y;
+	c32-cmap.index = c-cmap.index;
+	c32-cmap.count = c-cmap.count;
+	NETBSD32PTR32(c32-cmap.red, c-cmap.red);
+	NETBSD32PTR32(c32-cmap.green, c-cmap.green);
+	NETBSD32PTR32(c32-cmap.blue, c-cmap.blue);
+	NETBSD32PTR32(c32-image, c-image);
+	NETBSD32PTR32(c32-mask, c-mask);
+}
+
+static inline void
 netbsd32_from_ieee80211_nwkey(struct ieee80211_nwkey *nwk,
 struct netbsd32_ieee80211_nwkey *nwk32,
 u_long cmd)
@@ -870,6 +914,11 @@ netbsd32_ioctl(struct lwp *l, const stru
 	case WSDISPLAYIO_ADDSCREEN32:
 		IOCTL_STRUCT_CONV_TO(WSDISPLAYIO_ADDSCREEN, wsdisplay_addscreendata);
 
+	case WSDISPLAYIO_GCURSOR32:
+		IOCTL_STRUCT_CONV_TO(WSDISPLAYIO_GCURSOR, wsdisplay_cursor);
+	case WSDISPLAYIO_SCURSOR32:
+		IOCTL_STRUCT_CONV_TO(WSDISPLAYIO_SCURSOR, wsdisplay_cursor);
+
 	case SIOCS80211NWKEY32:
 		IOCTL_STRUCT_CONV_TO(SIOCG80211NWKEY, ieee80211_nwkey);
 

Index: src/sys/compat/netbsd32/netbsd32_ioctl.h
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.h:1.40 src/sys/compat/netbsd32/netbsd32_ioctl.h:1.41
--- src/sys/compat/netbsd32/netbsd32_ioctl.h:1.40	Wed Sep  7 02:35:00 2011
+++ src/sys/compat/netbsd32/netbsd32_ioctl.h	Wed Sep 28 01:46:39 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.h,v 1.40 2011/09/07 02:35:00 macallan Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.h,v 1.41 2011/09/28 01:46:39 macallan Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -130,6 +130,33 @@ struct netbsd32_ieee80211_nwkey {
 /* for powerd */
 #define POWER_EVENT_RECVDICT32	_IOWR('P', 1, struct netbsd32_plistref)
 
+/* Colormap operations.  Not applicable to all display types. */
+struct netbsd32_wsdisplay_cmap {
+	u_int	index;/* first element (0 origin) */
+	u_int	count;/* number of elements */
+	netbsd32_charp red;			/* red color map elements */
+	netbsd32_charp green;			/* green color map elements */
+	netbsd32_charp blue;			/* blue color map elements */
+};
+
+#define	WSDISPLAYIO_GETCMAP32	_IOW('W', 66, struct netbsd32_wsdisplay_cmap)
+#define	WSDISPLAYIO_PUTCMAP32	_IOW('W', 67, struct netbsd32_wsdisplay_cmap)
+
+struct netbsd32_wsdisplay_cursor {
+	u_int	which;/* values to get/set */
+	u_int	enable;/* enable/disable */
+	struct wsdisplay_curpos pos;		/* position */
+	struct wsdisplay_curpos hot;		/* hot spot */
+	struct netbsd32_wsdisplay_cmap cmap;	/* color map info */
+	struct wsdisplay_curpos size;		/* bit map size */
+	netbsd32_charp image;			/* image data */
+	netbsd32_charp mask;			/* mask data */
+};
+
+/* Cursor control: get/set 

CVS commit: src/sys/dev/ic

2011-09-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Sep 28 02:33:20 UTC 2011

Modified Files:
src/sys/dev/ic: sm502reg.h

Log Message:
add a couple more registers


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/sm502reg.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/ic/sm502reg.h
diff -u src/sys/dev/ic/sm502reg.h:1.2 src/sys/dev/ic/sm502reg.h:1.3
--- src/sys/dev/ic/sm502reg.h:1.2	Wed Aug 31 16:45:07 2011
+++ src/sys/dev/ic/sm502reg.h	Wed Sep 28 02:33:20 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sm502reg.h,v 1.2 2011/08/31 16:45:07 macallan Exp $	*/
+/*	$NetBSD: sm502reg.h,v 1.3 2011/09/28 02:33:20 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009 Michael Lorenz
@@ -128,6 +128,24 @@
 #define SM502_GPIO_INTR_SETUP		0x00010010
 #define SM502_GPIO_INTR_STATUS		0x00010014	/* read */
 #define SM502_GPIO_INTR_CLEAR		0x00010014	/* write */
+
+/* PWM - Pulse Width Modulation */
+#define SM502_PWM0			0x00010020
+#define SM502_PWM1			0x00010024
+#define SM502_PWM2			0x00010028
+#define		SM502_PWM_ENABLE		0x0001
+#define		SM502_PWM_ENABLE_INTR		0x0004
+#define		SM502_PWM_INTR_PENDING		0x0008 /* write 1 to clear */
+/* 96MHz divided by 1  n */
+#define		SM502_PWM_CLOCK_DIV_MASK	0x00f0
+#define		SM502_PWM_CLOCK_DIV_SHIFT	4
+/* output remains low for n+1 cycles */
+#define		SM502_PWM_CLOCK_LOW_MASK	0x000fff00
+#define		SM502_PWM_CLOCK_LOW_SHIFT	8
+/* output remains high for n+1 cycles */
+#define		SM502_PWM_CLOCK_HIGH_MASK	0xfff0
+#define		SM502_PWM_CLOCK_HIGH_SHIFT	20
+
 /* Video Controller Registers */
 #define SM502_PANEL_DISP_CRTL			0x08
 #define		SM502_PDC_8BIT			0x
@@ -211,6 +229,20 @@
 #define 	SM502_VT_VDISPE_MASK		0x0fff
 #define 	SM502_VT_VTOTAL_MASK		0x0fff
 #define SM502_PANEL_VSYNC	0x080030
+#define SM502_PANEL_CRSR_ADDR	0x0800f0
+#define		SM502_CRSR_ENABLE	0x8000
+#define		SM502_CRSR_SYSTEM_MEM	0x0800
+#define		SM502_CRSR_SYSMEM_CS1	0x0400
+#define		SM502_CRSR_ADDRESS_M	0x03f0
+#define SM502_PANEL_CRSR_XY	0x0800f4
+#define		SM502_CRSR_X_MASK	0x0fff
+#define		SM502_CRSR_Y_MASK	0x0fff
+#define SM502_PANEL_CRSR_COL12	0x0800f8
+#define		SM502_CRSR_COLOR_1_MASK	0x
+#define		SM502_CRSR_COLOR_2_MASK	0x
+#define SM502_PANEL_CRSR_COL3	0x0800fc
+#define		SM502_CRSR_COLOR_3_MASK	0x
+
 
 #define SM502_PALETTE_PANEL	0x080400
 #define SM502_PALETTE_VIDEO	0x080800



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

2011-09-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Sep 28 02:36:37 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
support a hardware cursor - now X with wsfb on gdium is a little less annoying


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/voyager/voyagerfb.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/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.5 src/sys/dev/pci/voyager/voyagerfb.c:1.6
--- src/sys/dev/pci/voyager/voyagerfb.c:1.5	Thu Sep 22 06:16:13 2011
+++ src/sys/dev/pci/voyager/voyagerfb.c	Wed Sep 28 02:36:37 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.5 2011/09/22 06:16:13 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.6 2011/09/28 02:36:37 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.5 2011/09/22 06:16:13 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.6 2011/09/28 02:36:37 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -59,6 +59,12 @@ __KERNEL_RCSID(0, $NetBSD: voyagerfb.c,
 #include dev/i2c/i2cvar.h
 #include dev/pci/voyagervar.h
 
+#ifdef VOYAGERFB_DEBUG
+#define DPRINTF aprint_error
+#else
+#define DPRINTF while (0) printf
+#endif
+
 /* there are probably gdium-specific */
 #define GPIO_BACKLIGHT	0x2000
 
@@ -86,6 +92,16 @@ struct voyagerfb_softc {
 	int sc_mode;
 	int sc_bl_on, sc_bl_level;
 	void *sc_gpio_cookie;
+
+	/* cursor stuff */
+	int sc_cur_x;
+	int sc_cur_y;
+	int sc_hot_x;
+	int sc_hot_y;
+	uint32_t sc_cursor_addr;
+	uint32_t *sc_cursor;
+ 
+	/* colour map */
 	u_char sc_cmap_red[256];
 	u_char sc_cmap_green[256];
 	u_char sc_cmap_blue[256];
@@ -127,6 +143,10 @@ static void	voyagerfb_erasecols(void *, 
 static void	voyagerfb_copyrows(void *, int, int, int);
 static void	voyagerfb_eraserows(void *, int, int, long);
 
+static int	voyagerfb_set_curpos(struct voyagerfb_softc *, int, int);
+static int	voyagerfb_gcursor(struct voyagerfb_softc *, struct wsdisplay_cursor *);
+static int	voyagerfb_scursor(struct voyagerfb_softc *, struct wsdisplay_cursor *);
+
 struct wsdisplay_accessops voyagerfb_accessops = {
 	voyagerfb_ioctl,
 	voyagerfb_mmap,
@@ -410,6 +430,51 @@ voyagerfb_ioctl(void *v, void *vs, u_lon
 			return 0;
 		}
 		return EPASSTHROUGH;
+
+	case WSDISPLAYIO_GCURPOS:
+		{
+			struct wsdisplay_curpos *pos;
+
+			pos = (struct wsdisplay_curpos *)data;
+			pos-x = sc-sc_cur_x;
+			pos-y = sc-sc_cur_y;
+		}
+		return 0;
+
+	case WSDISPLAYIO_SCURPOS:
+		{
+			struct wsdisplay_curpos *pos;
+
+			pos = (struct wsdisplay_curpos *)data;
+			voyagerfb_set_curpos(sc, pos-x, pos-y);
+		}
+		return 0;
+
+	case WSDISPLAYIO_GCURMAX:
+		{
+			struct wsdisplay_curpos *pos;
+
+			pos = (struct wsdisplay_curpos *)data;
+			pos-x = 64;
+			pos-y = 64;
+		}
+		return 0;
+
+	case WSDISPLAYIO_GCURSOR:
+		{
+			struct wsdisplay_cursor *cu;
+
+			cu = (struct wsdisplay_cursor *)data;
+			return voyagerfb_gcursor(sc, cu);
+		}
+
+	case WSDISPLAYIO_SCURSOR:
+		{
+			struct wsdisplay_cursor *cu;
+
+			cu = (struct wsdisplay_cursor *)data;
+			return voyagerfb_scursor(sc, cu);
+		}
 	}
 	return EPASSTHROUGH;
 }
@@ -612,6 +677,29 @@ voyagerfb_init(struct voyagerfb_softc *s
 			SM502_STRETCH, SM502_STRETCH_32BIT);
 			break;
 	}
+	/* put the cursor at the end of video memory */
+	sc-sc_cursor_addr = 16 * 1024 * 1024 - 16 * 64;	/* XXX */
+	DPRINTF(%s: %08x\n, __func__, sc-sc_cursor_addr); 
+	sc-sc_cursor = (uint32_t *)((uint8_t *)bus_space_vaddr(sc-sc_memt, sc-sc_fbh)
+			 + sc-sc_cursor_addr);
+#ifdef VOYAGERFB_DEBUG
+	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_CRSR_XY, 0x00100010);
+	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_CRSR_COL12, 0x);
+	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_CRSR_COL3, 0xf800);
+	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_CRSR_ADDR,
+	SM502_CRSR_ENABLE | sc-sc_cursor_addr);
+	sc-sc_cursor[0] = 0x;
+	sc-sc_cursor[1] = 0x;
+	sc-sc_cursor[2] = 0x;
+	sc-sc_cursor[3] = 0x;
+	sc-sc_cursor[4] = 0x;
+	sc-sc_cursor[5] = 0x;
+	sc-sc_cursor[6] = 0x;
+	sc-sc_cursor[7] = 0x;
+#else
+	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_CRSR_ADDR,
+	sc-sc_cursor_addr);
+#endif
 }
 
 static void
@@ -930,3 +1018,115 @@ voyagerfb_brightness_down(device_t dev)
 
 	voyagerfb_set_backlight(sc, sc-sc_bl_level - 8);
 }
+
+static int
+voyagerfb_set_curpos(struct voyagerfb_softc *sc, int x, int y)
+{
+	uint32_t val;
+	int xx, yy;
+
+	sc-sc_cur_x = x;
+	sc-sc_cur_y = y;
+
+	xx = x - sc-sc_hot_x;
+	yy = y - sc-sc_hot_y;
+	
+	if (xx  0) xx = abs(xx) | 0x800;
+	if (yy  0) yy = abs(yy) | 0x800;
+	
+	val = (xx  0x) | (yy  16);
+	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_CRSR_XY, val);
+
+	return 0;
+}
+