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