xref: /netbsd-src/sys/arch/next68k/dev/nextcons.c (revision 4724848cf0da353df257f730694b7882798e5daf)
1 /*	$NetBSD: nextcons.c,v 1.14 2023/02/11 02:33:27 tsutsui Exp $	*/
2 
3 /*
4  * Copyright (c) 1999 Darrin B. Jewell
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #include <sys/cdefs.h>
29 __KERNEL_RCSID(0, "$NetBSD: nextcons.c,v 1.14 2023/02/11 02:33:27 tsutsui Exp $");
30 
31 #include <sys/param.h>
32 #include <sys/systm.h>
33 #include <sys/kernel.h>
34 #include <sys/proc.h>
35 #include <sys/device.h>
36 #include <sys/malloc.h>
37 #include <sys/errno.h>
38 #include <sys/queue.h>
39 #include <sys/bus.h>
40 #include <sys/cpu.h>
41 #include <sys/intr.h>
42 
43 #include <machine/autoconf.h>
44 
45 #include <dev/cons.h>
46 #include <dev/wscons/wskbdvar.h>
47 #include <dev/wscons/wsdisplayvar.h>
48 
49 #include <next68k/dev/intiovar.h>
50 #include <next68k/dev/nextdisplayvar.h>
51 #include <next68k/dev/nextkbdvar.h>
52 
53 #include <next68k/next68k/nextrom.h>
54 
55 void nextcnprobe(struct consdev *);
56 void nextcninit(struct consdev *);
57 int nextcngetc(dev_t);
58 void nextcnputc(dev_t, int);
59 void nextcnpollc(dev_t, int);
60 
61 
62 void
63 nextcnprobe(struct consdev *cp)
64 {
65 
66 	if (rom_machine_type == NeXT_WARP9 ||
67 	    rom_machine_type == NeXT_X15 ||
68 	    rom_machine_type == NeXT_WARP9C ||
69 	    rom_machine_type == NeXT_TURBO_MONO ||
70 	    rom_machine_type == NeXT_TURBO_COLOR ||
71 	    rom_machine_type == NeXT_CUBE_TURBO)
72 		cp->cn_pri = CN_INTERNAL;
73 	else
74 		cp->cn_pri = CN_DEAD;
75 
76 	cp->cn_dev = NODEV;
77 }
78 
79 void
80 nextcninit(struct consdev *cp)
81 {
82 
83 	nextkbd_cnattach(NEXT68K_INTIO_BUS_SPACE);
84 	nextdisplay_cnattach();
85 }
86 
87 int
88 nextcngetc (dev_t dev)
89 {
90 
91 	return wskbd_cngetc(dev);
92 }
93 
94 void
95 nextcnputc(dev_t dev, int c)
96 {
97 
98 	wsdisplay_cnputc(dev,c);
99 }
100 
101 void
102 nextcnpollc(dev_t dev, int on)
103 {
104 
105 	wskbd_cnpollc(dev,on);
106 }
107