CVS commit: [netbsd-7] src/sys/dev/hpc

2018-10-30 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Tue Oct 30 09:56:41 UTC 2018

Modified Files:
src/sys/dev/hpc [netbsd-7]: hpckbd.c

Log Message:
Pull up the following revisions(s) (requested by rin in ticket #1638):
sys/dev/hpc/hpckbd.c:   revision 1.33-1.35

Fix kernel crash on hpcmips when console is attached.


To generate a diff of this commit:
cvs rdiff -u -r1.30.12.2 -r1.30.12.3 src/sys/dev/hpc/hpckbd.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/hpc/hpckbd.c
diff -u src/sys/dev/hpc/hpckbd.c:1.30.12.2 src/sys/dev/hpc/hpckbd.c:1.30.12.3
--- src/sys/dev/hpc/hpckbd.c:1.30.12.2	Wed Aug  9 06:48:57 2017
+++ src/sys/dev/hpc/hpckbd.c	Tue Oct 30 09:56:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpckbd.c,v 1.30.12.2 2017/08/09 06:48:57 snj Exp $ */
+/*	$NetBSD: hpckbd.c,v 1.30.12.3 2018/10/30 09:56:41 sborrill Exp $ */
 
 /*-
  * Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.30.12.2 2017/08/09 06:48:57 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.30.12.3 2018/10/30 09:56:41 sborrill Exp $");
 
 #include 
 #include 
@@ -261,10 +261,11 @@ hpckbd_getevent(struct hpckbd_core* hc, 
 }
 
 
-#ifdef hpcsh
+#if defined(hpcsh) || defined(hpcmips)
 /*
- * XXX: Use the old wrong code for now as hpcsh attaches console very
- * early and it's convenient to be able to do early DDB on wscons.
+ * XXX: Use the old wrong code for now as hpcsh and hpcmips attach
+ * console very early when malloc(9) is not yet available.  It is
+ * convenient to be able to do early DDB on wscons.
  */
 void
 hpckbd_keymap_setup(struct hpckbd_core *hc,
@@ -278,8 +279,9 @@ hpckbd_keymap_setup(struct hpckbd_core *
 	 * XXX The way this is done is really wrong.  The __UNCONST()
 	 * is a hint as to what is wrong.  This actually ends up modifying
 	 * initialized data which is marked "const".
-	 * The reason we get away with it here is that on sh3 kernel
-	 * is directly mapped.
+	 *
+	 * The reason we get away with it here is that on sh3 and mips
+	 * the kernel is directly mapped.
 	 */
 	desc = (struct wscons_keydesc *)__UNCONST(hpckbd_keymapdata.keydesc);
 	for (i = 0; desc[i].name != 0; i++) {



CVS commit: [netbsd-7] src/sys/dev/hpc

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 06:48:57 UTC 2017

Modified Files:
src/sys/dev/hpc [netbsd-7]: hpckbd.c

Log Message:
Pull up following revision(s) (requested by uwe in ticket #1465):
sys/dev/hpc/hpckbd.c: revision 1.32
XXX: On hpcsh only - bring back old incorrect hpckbd_keymap_setup()
fixed in 1.31.  The old one with UNCONST does work on hpcsh b/c the
kernel is directly mapped.  The new one does not work on hpcsh b/c it
calls consinit() very early when malloc() is not yet available.
The real fix for this is to fix the constness of wscons keymap
structures that is self-contradictory.


To generate a diff of this commit:
cvs rdiff -u -r1.30.12.1 -r1.30.12.2 src/sys/dev/hpc/hpckbd.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/hpc/hpckbd.c
diff -u src/sys/dev/hpc/hpckbd.c:1.30.12.1 src/sys/dev/hpc/hpckbd.c:1.30.12.2
--- src/sys/dev/hpc/hpckbd.c:1.30.12.1	Sun Jul 23 06:05:36 2017
+++ src/sys/dev/hpc/hpckbd.c	Wed Aug  9 06:48:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpckbd.c,v 1.30.12.1 2017/07/23 06:05:36 snj Exp $ */
+/*	$NetBSD: hpckbd.c,v 1.30.12.2 2017/08/09 06:48:57 snj Exp $ */
 
 /*-
  * Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.30.12.1 2017/07/23 06:05:36 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.30.12.2 2017/08/09 06:48:57 snj Exp $");
 
 #include 
 #include 
@@ -260,6 +260,40 @@ hpckbd_getevent(struct hpckbd_core* hc, 
 	return (1);
 }
 
+
+#ifdef hpcsh
+/*
+ * XXX: Use the old wrong code for now as hpcsh attaches console very
+ * early and it's convenient to be able to do early DDB on wscons.
+ */
+void
+hpckbd_keymap_setup(struct hpckbd_core *hc,
+		const keysym_t *map, int mapsize)
+{
+	int i;
+	struct wscons_keydesc *desc;
+
+	/* fix keydesc table */
+	/* 
+	 * XXX The way this is done is really wrong.  The __UNCONST()
+	 * is a hint as to what is wrong.  This actually ends up modifying
+	 * initialized data which is marked "const".
+	 * The reason we get away with it here is that on sh3 kernel
+	 * is directly mapped.
+	 */
+	desc = (struct wscons_keydesc *)__UNCONST(hpckbd_keymapdata.keydesc);
+	for (i = 0; desc[i].name != 0; i++) {
+		if ((desc[i].name & KB_MACHDEP) && desc[i].map == NULL) {
+			desc[i].map = map;
+			desc[i].map_size = mapsize;
+		}
+	}
+
+	return;
+}
+
+#else
+
 void
 hpckbd_keymap_setup(struct hpckbd_core *hc,
 		const keysym_t *map, int mapsize)
@@ -294,6 +328,7 @@ hpckbd_keymap_setup(struct hpckbd_core *
 
 	return;
 }
+#endif
 
 void
 hpckbd_keymap_lookup(struct hpckbd_core *hc)



CVS commit: [netbsd-7] src/sys/dev/hpc

2017-07-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Jul 23 06:05:36 UTC 2017

Modified Files:
src/sys/dev/hpc [netbsd-7]: hpckbd.c

Log Message:
Pull up following revision(s) (requested by manu in ticket #1438):
sys/dev/hpc/hpckbd.c: revision 1.31
Restore wscons keymaps feature on hpcarm
hpc ports need to alter keydesc data at runtime in order to load
alternate keymaps. But since keydesc is const initialized data, it
is mapped read only and the operation should fail.
It seems older compiler failed to enforce the read-only mapping and
this is why it used to work, but on recent NetBSD releases, the
feature is broken.
We fix it by duplicating the keydesc data once into a malloc'ed area
that can be modified.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.30.12.1 src/sys/dev/hpc/hpckbd.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/hpc/hpckbd.c
diff -u src/sys/dev/hpc/hpckbd.c:1.30 src/sys/dev/hpc/hpckbd.c:1.30.12.1
--- src/sys/dev/hpc/hpckbd.c:1.30	Sat Oct 27 17:18:17 2012
+++ src/sys/dev/hpc/hpckbd.c	Sun Jul 23 06:05:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpckbd.c,v 1.30 2012/10/27 17:18:17 chs Exp $ */
+/*	$NetBSD: hpckbd.c,v 1.30.12.1 2017/07/23 06:05:36 snj Exp $ */
 
 /*-
  * Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
@@ -30,11 +30,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.30 2012/10/27 17:18:17 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.30.12.1 2017/07/23 06:05:36 snj Exp $");
 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -264,22 +265,30 @@ hpckbd_keymap_setup(struct hpckbd_core *
 		const keysym_t *map, int mapsize)
 {
 	int i;
-	struct wscons_keydesc *desc;
+	const struct wscons_keydesc *desc;
+	static struct wscons_keydesc *ndesc = NULL;
 
-	/* fix keydesc table */
 	/* 
-	 * XXX The way this is done is really wrong.  The __UNCONST()
-	 * is a hint as to what is wrong.  This actually ends up modifying
-	 * initialized data which is marked "const".
-	 * The reason we get away with it here is apparently that text
-	 * and read-only data gets mapped read/write on the platforms
-	 * using this code.
+	 * fix keydesc table. Since it is const data, we must 
+	 * copy it once before changingg it.
 	 */
-	desc = (struct wscons_keydesc *)__UNCONST(hpckbd_keymapdata.keydesc);
+
+	if (ndesc == NULL) {
+		size_t sz;
+
+		for (sz = 0; hpckbd_keymapdata.keydesc[sz].name != 0; sz++);
+
+		ndesc = malloc(sz * sizeof(*ndesc), M_DEVBUF, M_WAITOK);
+		memcpy(ndesc, hpckbd_keymapdata.keydesc, sz * sizeof(*ndesc));
+
+		hpckbd_keymapdata.keydesc = ndesc;
+	}
+
+	desc = hpckbd_keymapdata.keydesc;
 	for (i = 0; desc[i].name != 0; i++) {
 		if ((desc[i].name & KB_MACHDEP) && desc[i].map == NULL) {
-			desc[i].map = map;
-			desc[i].map_size = mapsize;
+			ndesc[i].map = map;
+			ndesc[i].map_size = mapsize;
 		}
 	}
 



CVS commit: [netbsd-7] src/sys/dev/hpc

2015-05-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May 18 01:56:40 UTC 2015

Modified Files:
src/sys/dev/hpc [netbsd-7]: hpcfb.c

Log Message:
 Add missing semicolon. Fix build break in last commit.


To generate a diff of this commit:
cvs rdiff -u -r1.58.34.1 -r1.58.34.2 src/sys/dev/hpc/hpcfb.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/hpc/hpcfb.c
diff -u src/sys/dev/hpc/hpcfb.c:1.58.34.1 src/sys/dev/hpc/hpcfb.c:1.58.34.2
--- src/sys/dev/hpc/hpcfb.c:1.58.34.1	Sat May 16 04:06:04 2015
+++ src/sys/dev/hpc/hpcfb.c	Mon May 18 01:56:40 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpcfb.c,v 1.58.34.1 2015/05/16 04:06:04 snj Exp $	*/
+/*	$NetBSD: hpcfb.c,v 1.58.34.2 2015/05/18 01:56:40 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1999
@@ -43,7 +43,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hpcfb.c,v 1.58.34.1 2015/05/16 04:06:04 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: hpcfb.c,v 1.58.34.2 2015/05/18 01:56:40 msaitoh Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_hpcfb.h
@@ -472,7 +472,7 @@ hpcfb_init(struct hpcfb_fbconf *fbconf,	
 	}
 
 	if (rasops_init(ri, HPCFB_MAX_ROW, HPCFB_MAX_COLUMN)) {
-		aprint_error_dev(dc-dc_sc-sc_dev, rasops_init() failed!)
+		aprint_error_dev(dc-dc_sc-sc_dev, rasops_init() failed!);
 		return -1;
 	}