Tue Oct 30 09:56:41 2018 UTC ()
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.


(sborrill)
diff -r1.30.12.2 -r1.30.12.3 src/sys/dev/hpc/hpckbd.c

cvs diff -r1.30.12.2 -r1.30.12.3 src/sys/dev/hpc/hpckbd.c (expand / switch to unified diff)

--- src/sys/dev/hpc/hpckbd.c 2017/08/09 06:48:57 1.30.12.2
+++ src/sys/dev/hpc/hpckbd.c 2018/10/30 09:56:41 1.30.12.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: hpckbd.c,v 1.30.12.2 2017/08/09 06:48:57 snj Exp $ */ 1/* $NetBSD: hpckbd.c,v 1.30.12.3 2018/10/30 09:56:41 sborrill Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1999-2001 The NetBSD Foundation, Inc. 4 * Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by UCHIYAMA Yasushi. 8 * by UCHIYAMA Yasushi.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.30.12.2 2017/08/09 06:48:57 snj Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.30.12.3 2018/10/30 09:56:41 sborrill Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/systm.h> 36#include <sys/systm.h>
37#include <sys/device.h> 37#include <sys/device.h>
38#include <sys/malloc.h> 38#include <sys/malloc.h>
39 39
40#include <sys/tty.h> 40#include <sys/tty.h>
41 41
42#include <sys/bus.h> 42#include <sys/bus.h>
43#include <sys/intr.h> 43#include <sys/intr.h>
44 44
45#include <machine/config_hook.h> 45#include <machine/config_hook.h>
46#include <machine/platid.h> 46#include <machine/platid.h>
@@ -251,45 +251,47 @@ hpckbd_getevent(struct hpckbd_core* hc,  @@ -251,45 +251,47 @@ hpckbd_getevent(struct hpckbd_core* hc,
251 } 251 }
252 252
253 *type = hc->hc_head->hq_type; 253 *type = hc->hc_head->hq_type;
254 *data = hc->hc_head->hq_data; 254 *data = hc->hc_head->hq_data;
255 hc->hc_nevents--; 255 hc->hc_nevents--;
256 if (&hc->hc_eventq[NEVENTQ] <= ++hc->hc_head) 256 if (&hc->hc_eventq[NEVENTQ] <= ++hc->hc_head)
257 hc->hc_head = hc->hc_eventq; 257 hc->hc_head = hc->hc_eventq;
258 splx(s); 258 splx(s);
259 259
260 return (1); 260 return (1);
261} 261}
262 262
263 263
264#ifdef hpcsh 264#if defined(hpcsh) || defined(hpcmips)
265/* 265/*
266 * XXX: Use the old wrong code for now as hpcsh attaches console very 266 * XXX: Use the old wrong code for now as hpcsh and hpcmips attach
267 * early and it's convenient to be able to do early DDB on wscons. 267 * console very early when malloc(9) is not yet available. It is
 268 * convenient to be able to do early DDB on wscons.
268 */ 269 */
269void 270void
270hpckbd_keymap_setup(struct hpckbd_core *hc, 271hpckbd_keymap_setup(struct hpckbd_core *hc,
271 const keysym_t *map, int mapsize) 272 const keysym_t *map, int mapsize)
272{ 273{
273 int i; 274 int i;
274 struct wscons_keydesc *desc; 275 struct wscons_keydesc *desc;
275 276
276 /* fix keydesc table */ 277 /* fix keydesc table */
277 /*  278 /*
278 * XXX The way this is done is really wrong. The __UNCONST() 279 * XXX The way this is done is really wrong. The __UNCONST()
279 * is a hint as to what is wrong. This actually ends up modifying 280 * is a hint as to what is wrong. This actually ends up modifying
280 * initialized data which is marked "const". 281 * initialized data which is marked "const".
281 * The reason we get away with it here is that on sh3 kernel 282 *
282 * is directly mapped. 283 * The reason we get away with it here is that on sh3 and mips
 284 * the kernel is directly mapped.
283 */ 285 */
284 desc = (struct wscons_keydesc *)__UNCONST(hpckbd_keymapdata.keydesc); 286 desc = (struct wscons_keydesc *)__UNCONST(hpckbd_keymapdata.keydesc);
285 for (i = 0; desc[i].name != 0; i++) { 287 for (i = 0; desc[i].name != 0; i++) {
286 if ((desc[i].name & KB_MACHDEP) && desc[i].map == NULL) { 288 if ((desc[i].name & KB_MACHDEP) && desc[i].map == NULL) {
287 desc[i].map = map; 289 desc[i].map = map;
288 desc[i].map_size = mapsize; 290 desc[i].map_size = mapsize;
289 } 291 }
290 } 292 }
291 293
292 return; 294 return;
293} 295}
294 296
295#else 297#else