1 /* $NetBSD: nextcons.c,v 1.15 2023/12/20 00:40:44 thorpej 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.15 2023/12/20 00:40:44 thorpej 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/errno.h> 37 #include <sys/queue.h> 38 #include <sys/bus.h> 39 #include <sys/cpu.h> 40 #include <sys/intr.h> 41 42 #include <machine/autoconf.h> 43 44 #include <dev/cons.h> 45 #include <dev/wscons/wskbdvar.h> 46 #include <dev/wscons/wsdisplayvar.h> 47 48 #include <next68k/dev/intiovar.h> 49 #include <next68k/dev/nextdisplayvar.h> 50 #include <next68k/dev/nextkbdvar.h> 51 52 #include <next68k/next68k/nextrom.h> 53 54 void nextcnprobe(struct consdev *); 55 void nextcninit(struct consdev *); 56 int nextcngetc(dev_t); 57 void nextcnputc(dev_t, int); 58 void nextcnpollc(dev_t, int); 59 60 61 void 62 nextcnprobe(struct consdev *cp) 63 { 64 65 if (rom_machine_type == NeXT_WARP9 || 66 rom_machine_type == NeXT_X15 || 67 rom_machine_type == NeXT_WARP9C || 68 rom_machine_type == NeXT_TURBO_MONO || 69 rom_machine_type == NeXT_TURBO_COLOR || 70 rom_machine_type == NeXT_CUBE_TURBO) 71 cp->cn_pri = CN_INTERNAL; 72 else 73 cp->cn_pri = CN_DEAD; 74 75 cp->cn_dev = NODEV; 76 } 77 78 void 79 nextcninit(struct consdev *cp) 80 { 81 82 nextkbd_cnattach(NEXT68K_INTIO_BUS_SPACE); 83 nextdisplay_cnattach(); 84 } 85 86 int 87 nextcngetc (dev_t dev) 88 { 89 90 return wskbd_cngetc(dev); 91 } 92 93 void 94 nextcnputc(dev_t dev, int c) 95 { 96 97 wsdisplay_cnputc(dev,c); 98 } 99 100 void 101 nextcnpollc(dev_t dev, int on) 102 { 103 104 wskbd_cnpollc(dev,on); 105 } 106