1 /* $OpenBSD: vga_isa.c,v 1.9 2010/08/28 12:48:14 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 #include <dev/ic/vgavar.h> 43 #include <dev/isa/vga_isavar.h> 44 45 #include <dev/wscons/wsconsio.h> 46 #include <dev/wscons/wsdisplayvar.h> 47 48 struct vga_isa_softc { 49 struct device sc_dev; 50 #if 0 51 struct vga_config *sc_vc; /* VGA configuration */ 52 #endif 53 }; 54 55 int vga_isa_match(struct device *, void *, void *); 56 void vga_isa_attach(struct device *, struct device *, void *); 57 58 struct cfattach vga_isa_ca = { 59 sizeof(struct vga_isa_softc), vga_isa_match, vga_isa_attach, 60 }; 61 62 int 63 vga_isa_match(struct device *parent, void *match, void *aux) 64 { 65 struct isa_attach_args *ia = aux; 66 67 /* If values are hardwired to something that they can't be, punt. */ 68 if ((ia->ia_iobase != IOBASEUNK && ia->ia_iobase != 0x3b0) || 69 /* ia->ia_iosize != 0 || XXX isa.c */ 70 (ia->ia_maddr != MADDRUNK && ia->ia_maddr != 0xa0000) || 71 (ia->ia_msize != 0 && ia->ia_msize != 0x20000) || 72 ia->ia_irq != IRQUNK || ia->ia_drq != DRQUNK) 73 return (0); 74 75 if (!vga_is_console(ia->ia_iot, WSDISPLAY_TYPE_ISAVGA) && 76 !vga_common_probe(ia->ia_iot, ia->ia_memt)) 77 return (0); 78 79 ia->ia_iobase = 0x3b0; /* XXX mono 0x3b0 color 0x3c0 */ 80 ia->ia_iosize = 0x30; /* XXX 0x20 */ 81 ia->ia_maddr = 0xa0000; 82 ia->ia_msize = 0x20000; 83 return (2); /* more than generic pcdisplay */ 84 } 85 86 void 87 vga_isa_attach(struct device *parent, struct device *self, void *aux) 88 { 89 struct isa_attach_args *ia = aux; 90 #if 0 91 struct vga_isa_softc *sc = (struct vga_isa_softc *)self; 92 #endif 93 94 printf("\n"); 95 96 vga_common_attach(self, ia->ia_iot, ia->ia_memt, 97 WSDISPLAY_TYPE_ISAVGA); 98 } 99 100 int 101 vga_isa_cnattach(bus_space_tag_t iot, bus_space_tag_t memt) 102 { 103 return (vga_cnattach(iot, memt, WSDISPLAY_TYPE_ISAVGA, 1)); 104 } 105