diff options
author | Aaron Campbell <aaron@cvs.openbsd.org> | 2001-02-25 23:24:20 +0000 |
---|---|---|
committer | Aaron Campbell <aaron@cvs.openbsd.org> | 2001-02-25 23:24:20 +0000 |
commit | 0639ac759ad5e1cd9081faeeeb4c8ce479183208 (patch) | |
tree | 4bbb07995c6c89178a2c7f3f048a583eee56b038 /sys/arch | |
parent | 6e3ea1b9db192c1f5d53614e1df7644d0eae2008 (diff) |
Add wscons_machdep.c which is a constab-style wrapper driver for wscons on
i386. This fixes serial console. millert@, mickey@ ok
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/i386/conf/files.i386 | 3 | ||||
-rw-r--r-- | sys/arch/i386/i386/conf.c | 6 | ||||
-rw-r--r-- | sys/arch/i386/i386/machdep.c | 53 | ||||
-rw-r--r-- | sys/arch/i386/i386/wscons_machdep.c | 158 |
4 files changed, 166 insertions, 54 deletions
diff --git a/sys/arch/i386/conf/files.i386 b/sys/arch/i386/conf/files.i386 index 4d081bd35de..176815735c9 100644 --- a/sys/arch/i386/conf/files.i386 +++ b/sys/arch/i386/conf/files.i386 @@ -1,4 +1,4 @@ -# $OpenBSD: files.i386,v 1.75 2001/02/21 20:40:02 jbm Exp $ +# $OpenBSD: files.i386,v 1.76 2001/02/25 23:24:18 aaron Exp $ # $NetBSD: files.i386,v 1.73 1996/05/07 00:58:36 thorpej Exp $ # # new style config file for i386 architecture @@ -40,6 +40,7 @@ file arch/i386/i386/dkcsum.c bios file lib/libz/adler32.c !ppp_deflate file dev/cons.c file dev/cninit.c +file arch/i386/i386/wscons_machdep.c major {vnd = 14} # diff --git a/sys/arch/i386/i386/conf.c b/sys/arch/i386/i386/conf.c index 06876d3835b..afc0dcc9e09 100644 --- a/sys/arch/i386/i386/conf.c +++ b/sys/arch/i386/i386/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.64 2001/02/20 23:53:26 jbm Exp $ */ +/* $OpenBSD: conf.c,v 1.65 2001/02/25 23:24:18 aaron Exp $ */ /* $NetBSD: conf.c,v 1.75 1996/05/03 19:40:20 christos Exp $ */ /* @@ -505,8 +505,12 @@ dev_rawpart(dv) cons_decl(pc); cons_decl(com); +cons_decl(ws); struct consdev constab[] = { +#if NWSDISPLAY > 0 + cons_init(ws), +#endif #if NPC + NVT > 0 cons_init(pc), #endif diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 5e5c9d02c14..f5432280775 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.148 2001/02/04 17:28:17 aaron Exp $ */ +/* $OpenBSD: machdep.c,v 1.149 2001/02/25 23:24:18 aaron Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -172,32 +172,6 @@ extern struct proc *npxproc; #endif -#include "vga.h" -#include "ega.h" -#include "pcdisplay.h" -#if (NVGA > 0) || (NEGA > 0) || (NPCDISPLAY > 0) -#include <dev/ic/mc6845reg.h> -#include <dev/ic/pcdisplayvar.h> -#if (NVGA > 0) -#include <dev/ic/vgareg.h> -#include <dev/ic/vgavar.h> -#endif -#if (NEGA > 0) -#include <dev/isa/egavar.h> -#endif -#if (NPCDISPLAY > 0) -#include <dev/isa/pcdisplayvar.h> -#endif -#endif - -#include "pckbc.h" -#if (NPCKBC > 0) -#include <dev/isa/isareg.h> -#include <dev/ic/i8042reg.h> -#include <dev/ic/pckbcvar.h> -#endif -#include "pckbd.h" /* for pckbc_machdep_cnattach */ - #include "pc.h" #if (NPC > 0) #include <machine/pccons.h> @@ -2390,32 +2364,7 @@ consinit() if (initted) return; initted = 1; -#if 0 cninit(); -#endif - -#if (NPC > 0) || (NVGA > 0) || (NEGA > 0) || (NPCDISPLAY > 0) -#if (NVGA > 0) - if (!vga_cnattach(I386_BUS_SPACE_IO, I386_BUS_SPACE_MEM, -1, 1)) - goto dokbd; -#endif -#if (NEGA > 0) - if (!ega_cnattach(I386_BUS_SPACE_IO, I386_BUS_SPACE_MEM)) - goto dokbd; -#endif -#if (NPCDISPLAY > 0) - if (!pcdisplay_cnattach(I386_BUS_SPACE_IO, I386_BUS_SPACE_MEM)) - goto dokbd; -#endif -#if (NPC > 0) - pccnattach(); -#endif - if (0) goto dokbd; /* XXX stupid gcc */ -dokbd: -#if (NPCKBC > 0) - pckbc_cnattach(I386_BUS_SPACE_IO, IO_KBD, KBCMDP, PCKBC_KBD_SLOT); -#endif -#endif /* PC | VGA | EGA | PCDISPLAY */ } #if (NPCKBC > 0) && (NPCKBD == 0) diff --git a/sys/arch/i386/i386/wscons_machdep.c b/sys/arch/i386/i386/wscons_machdep.c new file mode 100644 index 00000000000..90b1094cb26 --- /dev/null +++ b/sys/arch/i386/i386/wscons_machdep.c @@ -0,0 +1,158 @@ +/* $OpenBSD: wscons_machdep.c,v 1.1 2001/02/25 23:24:18 aaron Exp $ */ + +/* + * Copyright (c) 2001 Aaron Campbell + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Michael Shalayeff. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/kernel.h> +#include <sys/conf.h> +#include <sys/device.h> +#include <sys/extent.h> + +#include <machine/bus.h> + +#include <dev/cons.h> + +#include "vga.h" +#include "ega.h" +#include "pcdisplay.h" +#if (NVGA > 0) || (NEGA > 0) || (NPCDISPLAY > 0) +#include <dev/ic/mc6845reg.h> +#include <dev/ic/pcdisplayvar.h> +#if (NVGA > 0) +#include <dev/ic/vgareg.h> +#include <dev/ic/vgavar.h> +#endif +#if (NEGA > 0) +#include <dev/isa/egavar.h> +#endif +#if (NPCDISPLAY > 0) +#include <dev/isa/pcdisplayvar.h> +#endif +#endif + +#include "wsdisplay.h" +#if NWSDISPLAY > 0 +#include <dev/wscons/wsdisplayvar.h> +#endif + +#include "pckbc.h" +#if (NPCKBC > 0) +#include <dev/isa/isareg.h> +#include <dev/ic/i8042reg.h> +#include <dev/ic/pckbcvar.h> +#endif +#include "pckbd.h" /* for pckbc_machdep_cnattach */ +#if (NPCKBD > 0) +#include <dev/wscons/wskbdvar.h> +#endif + +#include "pc.h" +#if (NPC > 0) +#include <machine/pccons.h> +#endif + +void wscnprobe __P((struct consdev *)); +void wscninit __P((struct consdev *)); +void wscnputc __P((dev_t, char)); +int wscngetc __P((dev_t)); +void wscnpollc __P((dev_t, int)); + +void +wscnprobe(cp) + struct consdev *cp; +{ + int maj; + + /* locate the major number */ + for (maj = 0; maj < nchrdev; maj++) { + if (cdevsw[maj].d_open == wsdisplayopen) + break; + } + + if (maj == nchrdev) { + /* we are not in cdevsw[], give up */ + panic("wsdisplay is not in cdevsw[]"); + } + + cp->cn_dev = makedev(maj, 0); + cp->cn_pri = CN_INTERNAL; +} + +void +wscninit(cp) + struct consdev *cp; +{ +#if (NVGA > 0) || (NEGA > 0) || (NPCDISPLAY > 0) +#if (NVGA > 0) + if (!vga_cnattach(I386_BUS_SPACE_IO, I386_BUS_SPACE_MEM, -1, 1)) + goto dokbd; +#endif +#if (NEGA > 0) + if (!ega_cnattach(I386_BUS_SPACE_IO, I386_BUS_SPACE_MEM)) + goto dokbd; +#endif +#if (NPCDISPLAY > 0) + if (!pcdisplay_cnattach(I386_BUS_SPACE_IO, I386_BUS_SPACE_MEM)) + goto dokbd; +#endif + if (0) goto dokbd; /* XXX stupid gcc */ +dokbd: +#if (NPCKBC > 0) + pckbc_cnattach(I386_BUS_SPACE_IO, IO_KBD, KBCMDP, PCKBC_KBD_SLOT); +#endif +#endif /* VGA | EGA | PCDISPLAY */ + return; +} + +void +wscnputc(dev, i) + dev_t dev; + char i; +{ + wsdisplay_cnputc(dev, (int)i); +} + +int +wscngetc(dev) + dev_t dev; +{ + return (wskbd_cngetc(dev)); +} + +void +wscnpollc(dev, on) + dev_t dev; + int on; +{ + wskbd_cnpollc(dev, on); +} |