Home | History | Annotate | Line # | Download | only in isa
vga_isa.c revision 1.4.2.1
      1  1.4.2.1   nathanw /* $NetBSD: vga_isa.c,v 1.4.2.1 2001/09/21 22:35:46 nathanw Exp $ */
      2      1.1  drochner 
      3      1.1  drochner /*
      4      1.1  drochner  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
      5      1.1  drochner  * All rights reserved.
      6      1.1  drochner  *
      7      1.1  drochner  * Author: Chris G. Demetriou
      8      1.1  drochner  *
      9      1.1  drochner  * Permission to use, copy, modify and distribute this software and
     10      1.1  drochner  * its documentation is hereby granted, provided that both the copyright
     11      1.1  drochner  * notice and this permission notice appear in all copies of the
     12      1.1  drochner  * software, derivative works or modified versions, and any portions
     13      1.1  drochner  * thereof, and that both notices appear in supporting documentation.
     14      1.1  drochner  *
     15      1.1  drochner  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     16      1.1  drochner  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     17      1.1  drochner  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     18      1.1  drochner  *
     19      1.1  drochner  * Carnegie Mellon requests users of this software to return to
     20      1.1  drochner  *
     21      1.1  drochner  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     22      1.1  drochner  *  School of Computer Science
     23      1.1  drochner  *  Carnegie Mellon University
     24      1.1  drochner  *  Pittsburgh PA 15213-3890
     25      1.1  drochner  *
     26      1.1  drochner  * any improvements or extensions that they make and grant Carnegie the
     27      1.1  drochner  * rights to redistribute these changes.
     28      1.1  drochner  */
     29      1.1  drochner 
     30      1.1  drochner #include <sys/param.h>
     31      1.1  drochner #include <sys/systm.h>
     32      1.1  drochner #include <sys/kernel.h>
     33      1.1  drochner #include <sys/device.h>
     34      1.1  drochner #include <sys/malloc.h>
     35      1.1  drochner 
     36      1.1  drochner #include <dev/isa/isavar.h>
     37      1.1  drochner 
     38      1.2  drochner #include <dev/ic/mc6845reg.h>
     39      1.2  drochner #include <dev/ic/pcdisplayvar.h>
     40      1.1  drochner #include <dev/ic/vgareg.h>
     41      1.1  drochner #include <dev/ic/vgavar.h>
     42      1.1  drochner #include <dev/isa/vga_isavar.h>
     43      1.1  drochner 
     44      1.1  drochner #include <dev/wscons/wsconsio.h>
     45      1.1  drochner #include <dev/wscons/wsdisplayvar.h>
     46      1.1  drochner 
     47      1.1  drochner int	vga_isa_match __P((struct device *, struct cfdata *, void *));
     48      1.1  drochner void	vga_isa_attach __P((struct device *, struct device *, void *));
     49      1.1  drochner 
     50      1.1  drochner struct cfattach vga_isa_ca = {
     51  1.4.2.1   nathanw 	sizeof(struct vga_softc), vga_isa_match, vga_isa_attach,
     52      1.1  drochner };
     53      1.1  drochner 
     54      1.1  drochner int
     55      1.1  drochner vga_isa_match(parent, match, aux)
     56      1.1  drochner 	struct device *parent;
     57      1.1  drochner 	struct cfdata *match;
     58      1.1  drochner 	void *aux;
     59      1.1  drochner {
     60      1.1  drochner 	struct isa_attach_args *ia = aux;
     61      1.1  drochner 
     62      1.1  drochner 	/* If values are hardwired to something that they can't be, punt. */
     63      1.3  drochner 	if ((ia->ia_iobase != IOBASEUNK && ia->ia_iobase != 0x3b0) ||
     64      1.3  drochner 	    /* ia->ia_iosize != 0 || XXX isa.c */
     65      1.3  drochner 	    (ia->ia_maddr != MADDRUNK && ia->ia_maddr != 0xa0000) ||
     66      1.3  drochner 	    (ia->ia_msize != 0 && ia->ia_msize != 0x20000) ||
     67      1.1  drochner 	    ia->ia_irq != IRQUNK || ia->ia_drq != DRQUNK)
     68      1.1  drochner 		return (0);
     69      1.1  drochner 
     70      1.3  drochner 	if (!vga_is_console(ia->ia_iot, WSDISPLAY_TYPE_ISAVGA) &&
     71      1.3  drochner 	    !vga_common_probe(ia->ia_iot, ia->ia_memt))
     72      1.3  drochner 		return (0);
     73      1.3  drochner 
     74      1.3  drochner 	ia->ia_iobase = 0x3b0;	/* XXX mono 0x3b0 color 0x3c0 */
     75      1.3  drochner 	ia->ia_iosize = 0x30;	/* XXX 0x20 */
     76      1.3  drochner 	ia->ia_maddr = 0xa0000;
     77      1.3  drochner 	ia->ia_msize = 0x20000;
     78      1.3  drochner 	return (2);	/* more than generic pcdisplay */
     79      1.1  drochner }
     80      1.1  drochner 
     81      1.1  drochner void
     82      1.1  drochner vga_isa_attach(parent, self, aux)
     83      1.1  drochner 	struct device *parent, *self;
     84      1.1  drochner 	void *aux;
     85      1.1  drochner {
     86  1.4.2.1   nathanw 	struct vga_softc *sc = (void *) self;
     87      1.1  drochner 	struct isa_attach_args *ia = aux;
     88      1.1  drochner 
     89      1.1  drochner 	printf("\n");
     90      1.1  drochner 
     91  1.4.2.1   nathanw 	vga_common_attach(sc, ia->ia_iot, ia->ia_memt, WSDISPLAY_TYPE_ISAVGA,
     92  1.4.2.1   nathanw 	    NULL);
     93      1.1  drochner }
     94      1.1  drochner 
     95      1.1  drochner int
     96      1.1  drochner vga_isa_cnattach(iot, memt)
     97      1.1  drochner 	bus_space_tag_t iot, memt;
     98      1.1  drochner {
     99      1.1  drochner 	return (vga_cnattach(iot, memt, WSDISPLAY_TYPE_ISAVGA, 1));
    100      1.1  drochner }
    101