Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/hpc XXX: On hpcsh only - bring back old incorrect hp...



details:   https://anonhg.NetBSD.org/src/rev/5d43f86bc429
branches:  trunk
changeset: 355641:5d43f86bc429
user:      uwe <uwe%NetBSD.org@localhost>
date:      Mon Aug 07 23:57:40 2017 +0000

description:
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.

diffstat:

 sys/dev/hpc/hpckbd.c |  39 +++++++++++++++++++++++++++++++++++++--
 1 files changed, 37 insertions(+), 2 deletions(-)

diffs (67 lines):

diff -r 990bedbebcc0 -r 5d43f86bc429 sys/dev/hpc/hpckbd.c
--- a/sys/dev/hpc/hpckbd.c      Mon Aug 07 23:42:11 2017 +0000
+++ b/sys/dev/hpc/hpckbd.c      Mon Aug 07 23:57:40 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hpckbd.c,v 1.31 2017/06/12 09:23:39 manu Exp $ */
+/*     $NetBSD: hpckbd.c,v 1.32 2017/08/07 23:57:40 uwe Exp $ */
 
 /*-
  * Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.31 2017/06/12 09:23:39 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.32 2017/08/07 23:57:40 uwe Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -260,6 +260,40 @@
        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 @@
 
        return;
 }
+#endif
 
 void
 hpckbd_keymap_lookup(struct hpckbd_core *hc)



Home | Main Index | Thread Index | Old Index