diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1997-11-06 02:53:49 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1997-11-06 02:53:49 +0000 |
commit | b872f9fa4575b98787eaced8af9fca0c99928134 (patch) | |
tree | 68a4d2700ecd21acf8a1dffb9f47e7f46be2c554 /sys | |
parent | 2febeae79750eda8ec1f12e36eadeafb7f85fede (diff) |
We need an MI vga driver. The alpha one was most MI. Not entirely yet though.
Some files were move behind CVS back.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/alpha/conf/files.alpha | 17 | ||||
-rw-r--r-- | sys/arch/alpha/dev/vga.c | 379 | ||||
-rw-r--r-- | sys/arch/alpha/dev/vgavar.h | 59 | ||||
-rw-r--r-- | sys/arch/alpha/isa/vga_isa.c | 177 | ||||
-rw-r--r-- | sys/arch/alpha/isa/vga_isavar.h | 31 | ||||
-rw-r--r-- | sys/arch/alpha/pci/vga_pci.c | 186 | ||||
-rw-r--r-- | sys/arch/alpha/pci/vga_pcivar.h | 37 | ||||
-rw-r--r-- | sys/conf/files | 22 | ||||
-rw-r--r-- | sys/dev/ic/vga.c | 6 | ||||
-rw-r--r-- | sys/dev/isa/files.isa | 6 | ||||
-rw-r--r-- | sys/dev/isa/vga_isa.c | 5 | ||||
-rw-r--r-- | sys/dev/pci/files.pci | 6 | ||||
-rw-r--r-- | sys/dev/pci/vga_pci.c | 4 |
13 files changed, 39 insertions, 896 deletions
diff --git a/sys/arch/alpha/conf/files.alpha b/sys/arch/alpha/conf/files.alpha index ac89135f9b9..c8d41a7b4d9 100644 --- a/sys/arch/alpha/conf/files.alpha +++ b/sys/arch/alpha/conf/files.alpha @@ -1,4 +1,4 @@ -# $OpenBSD: files.alpha,v 1.14 1997/07/09 02:58:32 deraadt Exp $ +# $OpenBSD: files.alpha,v 1.15 1997/11/06 02:53:44 niklas Exp $ # $NetBSD: files.alpha,v 1.32 1996/11/25 04:03:21 cgd Exp $ # # alpha-specific configuration info @@ -8,18 +8,11 @@ maxpartitions 16 maxusers 2 8 64 -# a wscons output device; used later, but needs to be near the top for -# common file (e.g. vga) definitions. -define wsconsdev {[console = -1]} - # this loses, but there's no way to define attributes which have attributes define alpha_shared_intr file arch/alpha/dev/shared_intr.c alpha_shared_intr | dec_eb164 | dec_kn20aa -device vga: wsconsdev -file arch/alpha/dev/vga.c vga - # # Bus-independent devices # @@ -165,9 +158,6 @@ device pms attach pms at pcppi file arch/alpha/isa/pms.c pms -attach vga at isa with vga_isa -file arch/alpha/isa/vga_isa.c vga_isa needs-flag - # National Semiconductor DS8390/WD83C690-based boards # (WD/SMC 80x3 family, SMC Ultra [8216], 3Com 3C503, NE[12]000, and clones) # XXX conflicts with other ports; can't be in files.isa @@ -238,11 +228,6 @@ file arch/alpha/pci/tga_conf.c tga file arch/alpha/pci/tga_bt463.c tga file arch/alpha/pci/tga_bt485.c tga - -attach vga at pci with vga_pci -file arch/alpha/pci/vga_pci.c vga_pci needs-flag - - # # Devices that can live on multiple busses # diff --git a/sys/arch/alpha/dev/vga.c b/sys/arch/alpha/dev/vga.c deleted file mode 100644 index 1891f8a18f4..00000000000 --- a/sys/arch/alpha/dev/vga.c +++ /dev/null @@ -1,379 +0,0 @@ -/* $OpenBSD: vga.c,v 1.8 1997/08/25 08:26:43 deraadt Exp $ */ -/* $NetBSD: vga.c,v 1.3 1996/12/02 22:24:54 cgd Exp $ */ - -/* - * Copyright (c) 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/device.h> -#include <machine/bus.h> - -#include <alpha/wscons/wsconsvar.h> -#include <alpha/dev/vgavar.h> - -#define VGA_IO_D_6845_ADDR 0x4 -#define VGA_IO_D_6845_DATA 0x5 - -struct cfdriver vga_cd = { - NULL, "vga", DV_DULL, -}; - -void vga_cursor __P((void *, int, int, int)); -void vga_putstr __P((void *, int, int, char *, int)); -void vga_copycols __P((void *, int, int, int, int)); -void vga_erasecols __P((void *, int, int, int)); -void vga_copyrows __P((void *, int, int, int)); -void vga_eraserows __P((void *, int, int)); -void vga_set_attr __P((void *, int)); - -struct wscons_emulfuncs vga_emulfuncs = { - vga_cursor, - vga_putstr, - vga_copycols, - vga_erasecols, - vga_copyrows, - vga_eraserows, - vga_set_attr, -}; - -int vgaprint __P((void *, const char *)); - -/* - * The following functions implement back-end configuration grabbing - * and attachment. - */ -int -vga_common_probe(iot, memt) - bus_space_tag_t iot, memt; -{ - bus_space_handle_t ioh_b, ioh_c, ioh_d, memh; - u_int16_t vgadata; - int gotio_b, gotio_c, gotio_d, gotmem, rv; - - gotio_b = gotio_c = gotio_d = gotmem = rv = 0; - - if (bus_space_map(iot, 0x3b0, 0xc, 0, &ioh_b)) - goto bad; - gotio_b = 1; - if (bus_space_map(iot, 0x3c0, 0x10, 0, &ioh_c)) - goto bad; - gotio_c = 1; - if (bus_space_map(iot, 0x3d0, 0x10, 0, &ioh_d)) - goto bad; - gotio_d = 1; - if (bus_space_map(memt, 0xb8000, 0x8000, 0, &memh)) - goto bad; - gotmem = 1; - - vgadata = bus_space_read_2(memt, memh, 0); - bus_space_write_2(memt, memh, 0, 0xa55a); - rv = (bus_space_read_2(memt, memh, 0) == 0xa55a); - bus_space_write_2(memt, memh, 0, vgadata); - -bad: - if (gotio_b) - bus_space_unmap(iot, ioh_b, 0xc); - if (gotio_c) - bus_space_unmap(iot, ioh_c, 0x10); - if (gotio_d) - bus_space_unmap(iot, ioh_d, 0x10); - if (gotmem) - bus_space_unmap(memt, memh, 0x8000); - - return (rv); -} - -void -vga_common_setup(iot, memt, vc) - bus_space_tag_t iot, memt; - struct vga_config *vc; -{ - int cpos; - - vc->vc_iot = iot; - vc->vc_memt = memt; - - if (bus_space_map(vc->vc_iot, 0x3b0, 0xc, 0, &vc->vc_ioh_b)) - panic("vga_common_setup: couldn't map io b"); - if (bus_space_map(vc->vc_iot, 0x3c0, 0x10, 0, &vc->vc_ioh_c)) - panic("vga_common_setup: couldn't map io c"); - if (bus_space_map(vc->vc_iot, 0x3d0, 0x10, 0, &vc->vc_ioh_d)) - panic("vga_common_setup: couldn't map io d"); - if (bus_space_map(vc->vc_memt, 0xb8000, 0x8000, 0, &vc->vc_memh)) - panic("vga_common_setup: couldn't map memory"); - - vc->vc_nrow = 25; - vc->vc_ncol = 80; - - bus_space_write_1(iot, vc->vc_ioh_d, VGA_IO_D_6845_ADDR, 14); - cpos = bus_space_read_1(iot, vc->vc_ioh_d, VGA_IO_D_6845_DATA) << 8; - bus_space_write_1(iot, vc->vc_ioh_d, VGA_IO_D_6845_ADDR, 15); - cpos |= bus_space_read_1(iot, vc->vc_ioh_d, VGA_IO_D_6845_DATA); - vc->vc_crow = cpos / vc->vc_ncol; - vc->vc_ccol = cpos % vc->vc_ncol; - - vc->vc_so = 0; -#if 0 - vc->vc_at = 0x00 | 0xf; /* black bg|white fg */ - vc->vc_so_at = 0x00 | 0xf | 0x80; /* black bg|white fg|blink */ - - /* clear screen, frob cursor, etc.? */ - pcivga_eraserows(vc, 0, vc->vc_nrow); -#endif - /* - * XXX DEC HAS SWITCHED THE CODES FOR BLUE AND RED!!! - * XXX Therefore, though the comments say "blue bg", the code uses - * XXX the value for a red background! - */ - vc->vc_at = 0x40 | 0x0f; /* blue bg|white fg */ - vc->vc_so_at = 0x40 | 0x0f | 0x80; /* blue bg|white fg|blink */ -} - -void -vga_wscons_attach(parent, vc, console) - struct device *parent; - struct vga_config *vc; - int console; -{ - struct wscons_attach_args waa; - struct wscons_odev_spec *wo; - - waa.waa_isconsole = console; - wo = &waa.waa_odev_spec; - - wo->wo_emulfuncs = &vga_emulfuncs; - wo->wo_emulfuncs_cookie = vc; - - wo->wo_ioctl = vc->vc_ioctl; - wo->wo_mmap = vc->vc_mmap; - wo->wo_miscfuncs_cookie = vc; - - wo->wo_nrows = vc->vc_nrow; - wo->wo_ncols = vc->vc_ncol; - wo->wo_crow = vc->vc_crow; - wo->wo_ccol = vc->vc_ccol; - - config_found(parent, &waa, vgaprint); -} - -void -vga_wscons_console(vc) - struct vga_config *vc; -{ - struct wscons_odev_spec wo; - - wo.wo_emulfuncs = &vga_emulfuncs; - wo.wo_emulfuncs_cookie = vc; - - /* ioctl and mmap are unused until real attachment. */ - - wo.wo_nrows = vc->vc_nrow; - wo.wo_ncols = vc->vc_ncol; - wo.wo_crow = vc->vc_crow; - wo.wo_ccol = vc->vc_ccol; - - wscons_attach_console(&wo); -} - -int -vgaprint(aux, pnp) - void *aux; - const char *pnp; -{ - - if (pnp) - printf("wscons at %s", pnp); - return (UNCONF); -} - -int -vgaioctl(v, cmd, data, flag, p) - void *v; - u_long cmd; - caddr_t data; - int flag; - struct proc *p; -{ - /*struct vga_config *vc = v;*/ - - /* XXX */ - return -1; -} - -int -vgammap(v, offset, prot) - void *v; - off_t offset; - int prot; -{ - struct vga_config *vc = v; - bus_space_handle_t h; - u_int32_t *port; - - if (offset >= 0x00000 && offset < 0x100000) /* 1MB of mem */ - h = vc->vc_memh + offset; - else if (offset >= 0x10000 && offset < 0x140000) /* 256KB of iohb */ - h = vc->vc_ioh_b; - else if (offset >= 0x140000 && offset < 0x180000) /* 256KB of iohc */ - h = vc->vc_ioh_c; - else if (offset >= 0x180000 && offset < 0x1c0000) /* 256KB of iohd */ - h = vc->vc_ioh_d; - else - return (-1); - - port = (u_int32_t *)(h << 5); - return alpha_btop(port); -} - -/* - * The following functions implement the MI ANSI terminal emulation on - * a VGA display. - */ -void -vga_cursor(id, on, row, col) - void *id; - int on, row, col; -{ - struct vga_config *vc = id; - bus_space_tag_t iot = vc->vc_iot; - bus_space_handle_t ioh_d = vc->vc_ioh_d; - int pos; - -#if 0 - printf("vga_cursor: %d %d\n", row, col); -#endif - /* turn the cursor off */ - if (!on) { - /* XXX disable cursor how??? */ - vc->vc_crow = vc->vc_ccol = -1; - } else { - vc->vc_crow = row; - vc->vc_ccol = col; - } - - pos = row * vc->vc_ncol + col; - - bus_space_write_1(iot, ioh_d, VGA_IO_D_6845_ADDR, 14); - bus_space_write_1(iot, ioh_d, VGA_IO_D_6845_DATA, pos >> 8); - bus_space_write_1(iot, ioh_d, VGA_IO_D_6845_ADDR, 15); - bus_space_write_1(iot, ioh_d, VGA_IO_D_6845_DATA, pos); -} - -void -vga_putstr(id, row, col, cp, len) - void *id; - int row, col; - char *cp; - int len; -{ - struct vga_config *vc = id; - bus_space_tag_t memt = vc->vc_memt; - bus_space_handle_t memh = vc->vc_memh; - int i, off; - - off = (row * vc->vc_ncol + col) * 2; - for (i = 0; i < len; i++, cp++, off += 2) { - bus_space_write_1(memt, memh, off, *cp); - bus_space_write_1(memt, memh, off + 1, - vc->vc_so ? vc->vc_so_at : vc->vc_at); - } -} - -void -vga_copycols(id, row, srccol, dstcol, ncols) - void *id; - int row, srccol, dstcol, ncols; -{ - struct vga_config *vc = id; - bus_size_t srcoff, dstoff; - - srcoff = (row * vc->vc_ncol + srccol) * 2; - dstoff = (row * vc->vc_ncol + dstcol) * 2; - - bus_space_copy_2(vc->vc_memt, vc->vc_memh, srcoff, vc->vc_memh, dstoff, - ncols); -} - -void -vga_erasecols(id, row, startcol, ncols) - void *id; - int row, startcol, ncols; -{ - struct vga_config *vc = id; - bus_size_t off; - u_int16_t val; - - off = (row * vc->vc_ncol + startcol) * 2; - - val = (vc->vc_at << 8) | ' '; - - bus_space_set_region_2(vc->vc_memt, vc->vc_memh, off, val, ncols); -} - -void -vga_copyrows(id, srcrow, dstrow, nrows) - void *id; - int srcrow, dstrow, nrows; -{ - struct vga_config *vc = id; - bus_size_t srcoff, dstoff; - - srcoff = (srcrow * vc->vc_ncol + 0) * 2; - dstoff = (dstrow * vc->vc_ncol + 0) * 2; - - bus_space_copy_2(vc->vc_memt, vc->vc_memh, srcoff, vc->vc_memh, dstoff, - nrows * vc->vc_ncol); -} - -void -vga_eraserows(id, startrow, nrows) - void *id; - int startrow, nrows; -{ - struct vga_config *vc = id; - bus_size_t off, count; - u_int16_t val; - - off = (startrow * vc->vc_ncol + 0) * 2; - count = nrows * vc->vc_ncol; - - val = (vc->vc_at << 8) | ' '; - - bus_space_set_region_2(vc->vc_memt, vc->vc_memh, off, val, count); -} - -void -vga_set_attr(id, val) - void *id; - int val; -{ - struct vga_config *vc = id; - - vc->vc_so = val; -} diff --git a/sys/arch/alpha/dev/vgavar.h b/sys/arch/alpha/dev/vgavar.h deleted file mode 100644 index 93ac39220f9..00000000000 --- a/sys/arch/alpha/dev/vgavar.h +++ /dev/null @@ -1,59 +0,0 @@ -/* $NetBSD: vgavar.h,v 1.2 1996/11/23 06:06:43 cgd Exp $ */ - -/* - * Copyright (c) 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -struct vga_config { - /* - * Filled in by front-ends. - */ - bus_space_tag_t vc_iot, vc_memt; - bus_space_handle_t vc_ioh_b, vc_ioh_c, vc_ioh_d, vc_memh; - - /* - * Private to back-end. - */ - int vc_ncol, vc_nrow; /* screen width & height */ - int vc_ccol, vc_crow; /* current cursor position */ - - char vc_so; /* in standout mode? */ - char vc_at; /* normal attributes */ - char vc_so_at; /* standout attributes */ - - int (*vc_ioctl) __P((void *, u_long, - caddr_t, int, struct proc *)); - int (*vc_mmap) __P((void *, off_t, int)); - -}; - -int vga_common_probe __P((bus_space_tag_t, bus_space_tag_t)); -void vga_common_setup __P((bus_space_tag_t, bus_space_tag_t, - struct vga_config *)); -void vga_wscons_attach __P((struct device *, struct vga_config *, int)); -void vga_wscons_console __P((struct vga_config *)); -int vgaioctl __P((void *, u_long, caddr_t, int, struct proc *)); -int vgammap __P((void *, off_t, int)); diff --git a/sys/arch/alpha/isa/vga_isa.c b/sys/arch/alpha/isa/vga_isa.c deleted file mode 100644 index 0c16194a3d6..00000000000 --- a/sys/arch/alpha/isa/vga_isa.c +++ /dev/null @@ -1,177 +0,0 @@ -/* $NetBSD: vga_isa.c,v 1.4 1996/12/05 01:39:32 cgd Exp $ */ - -/* - * Copyright (c) 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/device.h> -#include <sys/malloc.h> - -#include <machine/autoconf.h> -#include <machine/pte.h> - -#include <dev/isa/isavar.h> - -#include <alpha/dev/vgavar.h> -#include <alpha/isa/vga_isavar.h> - -struct vga_isa_softc { - struct device sc_dev; - - struct vga_config *sc_vc; /* VGA configuration */ -}; - -#ifdef __BROKEN_INDIRECT_CONFIG -int vga_isa_match __P((struct device *, void *, void *)); -#else -int vga_isa_match __P((struct device *, struct cfdata *, void *)); -#endif -void vga_isa_attach __P((struct device *, struct device *, void *)); - -int vgaisammap __P((void *, off_t, int)); -int vgaisaioctl __P((void *, u_long, caddr_t, int, struct proc *)); - -struct cfattach vga_isa_ca = { - sizeof(struct vga_isa_softc), vga_isa_match, vga_isa_attach, -}; - -int vga_isa_console_tag; /* really just a boolean. */ -struct vga_config vga_isa_console_vc; - -int -vga_isa_match(parent, match, aux) - struct device *parent; -#ifdef __BROKEN_INDIRECT_CONFIG - void *match; -#else - struct cfdata *match; -#endif - void *aux; -{ - struct isa_attach_args *ia = aux; - int rv; - static int matched; - - /* There can be only one. */ - if (matched) - return (0); - - /* If values are hardwired to something that they can't be, punt. */ - if (ia->ia_iobase != IOBASEUNK || /* ia->ia_iosize != 0 || XXX isa.c */ - (ia->ia_maddr != MADDRUNK && ia->ia_maddr != 0xb8000) || - (ia->ia_msize != 0 && ia->ia_msize != 0x8000) || - ia->ia_irq != IRQUNK || ia->ia_drq != DRQUNK) - return (0); - - rv = vga_isa_console_tag || vga_common_probe(ia->ia_iot, ia->ia_memt); - - if (rv) { - ia->ia_iobase = 0x3b0; - ia->ia_iosize = 0x30; - ia->ia_maddr = 0xb8000; - ia->ia_msize = 0x8000; - matched = 1; - } - return (rv); -} - -void -vga_isa_attach(parent, self, aux) - struct device *parent, *self; - void *aux; -{ - struct isa_attach_args *ia = aux; - struct vga_isa_softc *sc = (struct vga_isa_softc *)self; - struct vga_config *vc; - int console; - - console = vga_isa_console_tag; - if (console) - vc = sc->sc_vc = &vga_isa_console_vc; - else { - vc = sc->sc_vc = (struct vga_config *) - malloc(sizeof(struct vga_config), M_DEVBUF, M_WAITOK); - - /* set up bus-independent VGA configuration */ - vga_common_setup(ia->ia_iot, ia->ia_memt, vc); - } - vc->vc_mmap = vgaisammap; - vc->vc_ioctl = vgaisaioctl; - - printf("\n"); - - vga_wscons_attach(self, vc, console); -} - -int -vga_isa_console_match(iot, memt) - bus_space_tag_t iot, memt; -{ - - return (vga_common_probe(iot, memt)); -} - -void -vga_isa_console_attach(iot, memt) - bus_space_tag_t iot, memt; -{ - struct vga_config *vc = &vga_isa_console_vc; - - /* for later recognition */ - vga_isa_console_tag = 1; - - /* set up bus-independent VGA configuration */ - vga_common_setup(iot, memt, vc); - - vga_wscons_console(vc); -} - -int -vgaisaioctl(v, cmd, data, flag, p) - void *v; - u_long cmd; - caddr_t data; - int flag; - struct proc *p; -{ - struct vga_isa_softc *sc = v; - - return (vgaioctl(sc->sc_vc, cmd, data, flag, p)); -} - -int -vgaisammap(v, offset, prot) - void *v; - off_t offset; - int prot; -{ - struct vga_isa_softc *sc = v; - - return (vgammap(sc->sc_vc, offset, prot)); -} diff --git a/sys/arch/alpha/isa/vga_isavar.h b/sys/arch/alpha/isa/vga_isavar.h deleted file mode 100644 index 618eb26b51b..00000000000 --- a/sys/arch/alpha/isa/vga_isavar.h +++ /dev/null @@ -1,31 +0,0 @@ -/* $NetBSD: vga_isavar.h,v 1.2 1996/11/23 06:06:45 cgd Exp $ */ - -/* - * Copyright (c) 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -int vga_isa_console_match __P((bus_space_tag_t, bus_space_tag_t)); -void vga_isa_console_attach __P((bus_space_tag_t, bus_space_tag_t)); diff --git a/sys/arch/alpha/pci/vga_pci.c b/sys/arch/alpha/pci/vga_pci.c deleted file mode 100644 index 270751d482e..00000000000 --- a/sys/arch/alpha/pci/vga_pci.c +++ /dev/null @@ -1,186 +0,0 @@ -/* $NetBSD: vga_pci.c,v 1.4 1996/12/05 01:39:38 cgd Exp $ */ - -/* - * Copyright (c) 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/device.h> -#include <sys/malloc.h> - -#ifndef i386 -#include <machine/autoconf.h> -#endif -#include <machine/pte.h> - -#include <dev/pci/pcireg.h> -#include <dev/pci/pcivar.h> -#include <dev/pci/pcidevs.h> - -#include <alpha/dev/vgavar.h> -#include <alpha/pci/vga_pcivar.h> - -struct vga_pci_softc { - struct device sc_dev; - - pcitag_t sc_pcitag; /* PCI tag, in case we need it. */ - struct vga_config *sc_vc; /* VGA configuration */ -}; - -#ifdef __BROKEN_INDIRECT_CONFIG -int vga_pci_match __P((struct device *, void *, void *)); -#else -int vga_pci_match __P((struct device *, struct cfdata *, void *)); -#endif -void vga_pci_attach __P((struct device *, struct device *, void *)); - -int vgapcimmap __P((void *, off_t, int)); -int vgapciioctl __P((void *, u_long, caddr_t, int, struct proc *)); - -struct cfattach vga_pci_ca = { - sizeof(struct vga_pci_softc), (cfmatch_t)vga_pci_match, vga_pci_attach, -}; - -pcitag_t vga_pci_console_tag; -struct vga_config vga_pci_console_vc; - -int -vga_pci_match(parent, match, aux) - struct device *parent; -#ifdef __BROKEN_INDIRECT_CONFIG - void *match; -#else - struct cfdata *match; -#endif - void *aux; -{ - struct pci_attach_args *pa = aux; - int potential; - - potential = 0; - - /* - * If it's prehistoric/vga or display/vga, we might match. - * For the console device, this is jut a sanity check. - */ - if (PCI_CLASS(pa->pa_class) == PCI_CLASS_PREHISTORIC && - PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_PREHISTORIC_VGA) - potential = 1; - if (PCI_CLASS(pa->pa_class) == PCI_CLASS_DISPLAY && - PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_DISPLAY_VGA) - potential = 1; - - if (!potential) - return (0); - - /* If it's the console, we have a winner! */ - if (!bcmp(&pa->pa_tag, &vga_pci_console_tag, sizeof(pa->pa_tag))) - return (1); - - /* - * If we might match, make sure that the card actually looks OK. - */ - if (!vga_common_probe(pa->pa_iot, pa->pa_memt)) - return (0); - - return (1); -} - -void -vga_pci_attach(parent, self, aux) - struct device *parent, *self; - void *aux; -{ - struct pci_attach_args *pa = aux; - struct vga_pci_softc *sc = (struct vga_pci_softc *)self; - struct vga_config *vc; - char devinfo[256]; - int console; - - console = (!bcmp(&pa->pa_tag, &vga_pci_console_tag, sizeof(pa->pa_tag))); - if (console) - vc = sc->sc_vc = &vga_pci_console_vc; - else { - vc = sc->sc_vc = (struct vga_config *) - malloc(sizeof(struct vga_config), M_DEVBUF, M_WAITOK); - - /* set up bus-independent VGA configuration */ - vga_common_setup(pa->pa_iot, pa->pa_memt, vc); - } - vc->vc_mmap = vgapcimmap; - vc->vc_ioctl = vgapciioctl; - - sc->sc_pcitag = pa->pa_tag; - - pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo); - printf(": %s (rev. 0x%02x)\n", devinfo, - PCI_REVISION(pa->pa_class)); - - vga_wscons_attach(self, vc, console); -} - -void -vga_pci_console(iot, memt, pc, bus, device, function) - bus_space_tag_t iot, memt; - pci_chipset_tag_t pc; - int bus, device, function; -{ - struct vga_config *vc = &vga_pci_console_vc; - - /* for later recognition */ - vga_pci_console_tag = pci_make_tag(pc, bus, device, function); - - /* set up bus-independent VGA configuration */ - vga_common_setup(iot, memt, vc); - - vga_wscons_console(vc); -} - -int -vgapciioctl(v, cmd, data, flag, p) - void *v; - u_long cmd; - caddr_t data; - int flag; - struct proc *p; -{ - struct vga_pci_softc *sc = v; - - return (vgaioctl(sc->sc_vc, cmd, data, flag, p)); -} - -int -vgapcimmap(v, offset, prot) - void *v; - off_t offset; - int prot; -{ - struct vga_pci_softc *sc = v; - - return (vgammap(sc->sc_vc, offset, prot)); -} diff --git a/sys/arch/alpha/pci/vga_pcivar.h b/sys/arch/alpha/pci/vga_pcivar.h deleted file mode 100644 index 29e258c862d..00000000000 --- a/sys/arch/alpha/pci/vga_pcivar.h +++ /dev/null @@ -1,37 +0,0 @@ -/* $NetBSD: vga_pcivar.h,v 1.1 1996/11/19 04:38:36 cgd Exp $ */ - -/* - * Copyright (c) 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#define DEVICE_IS_VGA_PCI(class, id) \ - (((PCI_CLASS(class) == PCI_CLASS_DISPLAY && \ - PCI_SUBCLASS(class) == PCI_SUBCLASS_DISPLAY_VGA) || \ - (PCI_CLASS(class) == PCI_CLASS_PREHISTORIC && \ - PCI_SUBCLASS(class) == PCI_SUBCLASS_PREHISTORIC_VGA)) ? 1 : 0) - -void vga_pci_console __P((bus_space_tag_t, bus_space_tag_t, - pci_chipset_tag_t, int, int, int)); diff --git a/sys/conf/files b/sys/conf/files index b595021ec57..fd9466427cf 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,4 +1,4 @@ -# $OpenBSD: files,v 1.66 1997/11/04 09:10:50 provos Exp $ +# $OpenBSD: files,v 1.67 1997/11/06 02:53:48 niklas Exp $ # $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 @@ -28,6 +28,10 @@ define ncr5380sbc # NCR 5380 SCSI Bus Controller define ncr53c9x # NCR 53c9x or Emulex ESP SCSI Controller define pdq # DEC FDDI chipset +# a wscons output device; used later, but needs to be near the top for +# common file (e.g. vga) definitions. +define wsconsdev {[console = -1]} + # "Chipset" drivers. These are the bus-independent routines which # contain the cfdrivers. Attachments are provided by files.<bus> @@ -66,6 +70,22 @@ file dev/ic/cy.c cy & (cy_isa | cy_pci) needs-flag device lpt file dev/ic/lpt.c lpt & (lpt_isa | lpt_pica | lpt_algor) needs-flag +# VGA +device vga: wsconsdev +file dev/ic/vga.c vga & (vga_isa | vga_pci) + +# +# "Workstation Console" glue; attaches frame buffer to emulator & kbd. +# +#device wscons +#attach wscons at wsconsdev +#file dev/wscons/wscons.c wscons needs-flag +#file dev/wscons/wscons_emul.c wscons + +#file dev/wscons/event.c wscons +#file dev/wscons/kbd.c wscons +#file dev/wscons/ms.c wscons + # Attributes which machine-independent bus support can be attached to. # These should be defined here, because some of these busses can have # devices which provide these attributes, and we'd like to avoid hairy diff --git a/sys/dev/ic/vga.c b/sys/dev/ic/vga.c index 1891f8a18f4..b9bc16a5353 100644 --- a/sys/dev/ic/vga.c +++ b/sys/dev/ic/vga.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vga.c,v 1.8 1997/08/25 08:26:43 deraadt Exp $ */ +/* $OpenBSD: vga.c,v 1.9 1997/11/06 02:53:41 niklas Exp $ */ /* $NetBSD: vga.c,v 1.3 1996/12/02 22:24:54 cgd Exp $ */ /* @@ -35,7 +35,7 @@ #include <machine/bus.h> #include <alpha/wscons/wsconsvar.h> -#include <alpha/dev/vgavar.h> +#include <dev/ic/vgavar.h> #define VGA_IO_D_6845_ADDR 0x4 #define VGA_IO_D_6845_DATA 0x5 @@ -248,7 +248,7 @@ vgammap(v, offset, prot) return (-1); port = (u_int32_t *)(h << 5); - return alpha_btop(port); + return alpha_btop(port); /* XXX */ } /* diff --git a/sys/dev/isa/files.isa b/sys/dev/isa/files.isa index 9a80ce6adb6..b3a2a64f75d 100644 --- a/sys/dev/isa/files.isa +++ b/sys/dev/isa/files.isa @@ -1,4 +1,4 @@ -# $OpenBSD: files.isa,v 1.34 1997/09/11 21:30:48 gene Exp $ +# $OpenBSD: files.isa,v 1.35 1997/11/06 02:53:42 niklas Exp $ # $NetBSD: files.isa,v 1.21 1996/05/16 03:45:55 mycroft Exp $ # # Config.new file and device description for machine-independent ISA code. @@ -68,6 +68,10 @@ file dev/isa/cy_isa.c cy_isa attach lpt at isa with lpt_isa file dev/isa/lpt_isa.c lpt_isa needs-flag +# Generic VGA +attach vga at isa with vga_isa +file dev/isa/vga_isa.c vga_isa needs-flag + # # SCSI host adapters # diff --git a/sys/dev/isa/vga_isa.c b/sys/dev/isa/vga_isa.c index 0c16194a3d6..19890274ef7 100644 --- a/sys/dev/isa/vga_isa.c +++ b/sys/dev/isa/vga_isa.c @@ -37,9 +37,8 @@ #include <machine/pte.h> #include <dev/isa/isavar.h> - -#include <alpha/dev/vgavar.h> -#include <alpha/isa/vga_isavar.h> +#include <dev/ic/vgavar.h> +#include <dev/isa/vga_isavar.h> struct vga_isa_softc { struct device sc_dev; diff --git a/sys/dev/pci/files.pci b/sys/dev/pci/files.pci index cd7478d2c7e..16c07abb977 100644 --- a/sys/dev/pci/files.pci +++ b/sys/dev/pci/files.pci @@ -1,4 +1,4 @@ -# $OpenBSD: files.pci,v 1.11 1997/07/03 07:22:54 deraadt Exp $ +# $OpenBSD: files.pci,v 1.12 1997/11/06 02:53:43 niklas Exp $ # $NetBSD: files.pci,v 1.20 1996/09/24 17:47:15 christos Exp $ # # Config.new file and device description for machine-independent PCI code. @@ -10,6 +10,10 @@ attach pci at pcibus file dev/pci/pci.c pci needs-flag file dev/pci/pci_subr.c pci +# Generic VGA +attach vga at pci with vga_pci +file dev/pci/vga_pci.c vga_pci needs-flag + # Adaptec 3940, 2940, and aic78[5678]0 SCSI controllers # device declaration in sys/conf/files attach ahc at pci with ahc_pci diff --git a/sys/dev/pci/vga_pci.c b/sys/dev/pci/vga_pci.c index 270751d482e..1b6c0be351d 100644 --- a/sys/dev/pci/vga_pci.c +++ b/sys/dev/pci/vga_pci.c @@ -42,8 +42,8 @@ #include <dev/pci/pcivar.h> #include <dev/pci/pcidevs.h> -#include <alpha/dev/vgavar.h> -#include <alpha/pci/vga_pcivar.h> +#include <dev/ic/vgavar.h> +#include <dev/pci/vga_pcivar.h> struct vga_pci_softc { struct device sc_dev; |