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