NetBSD/sys/dev/isa/vga_isa.c

122 lines
3.3 KiB
C
Raw Normal View History

/* $NetBSD: vga_isa.c,v 1.15 2002/10/02 03:10:50 thorpej Exp $ */
1998-03-22 18:14:35 +03:00
/*
* 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.
*/
2001-11-13 11:01:09 +03:00
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vga_isa.c,v 1.15 2002/10/02 03:10:50 thorpej Exp $");
2001-11-13 11:01:09 +03:00
1998-03-22 18:14:35 +03:00
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/device.h>
#include <sys/malloc.h>
#include <dev/isa/isavar.h>
#include <dev/ic/mc6845reg.h>
#include <dev/ic/pcdisplayvar.h>
1998-03-22 18:14:35 +03:00
#include <dev/ic/vgareg.h>
#include <dev/ic/vgavar.h>
#include <dev/isa/vga_isavar.h>
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsdisplayvar.h>
2002-07-09 10:55:09 +04:00
int vga_isa_match(struct device *, struct cfdata *, void *);
void vga_isa_attach(struct device *, struct device *, void *);
1998-03-22 18:14:35 +03:00
CFATTACH_DECL(vga_isa, sizeof(struct vga_softc),
vga_isa_match, vga_isa_attach, NULL, NULL);
1998-03-22 18:14:35 +03:00
int
2002-07-09 10:55:09 +04:00
vga_isa_match(struct device *parent, struct cfdata *match, void *aux)
1998-03-22 18:14:35 +03:00
{
struct isa_attach_args *ia = aux;
if (ISA_DIRECT_CONFIG(ia))
return (0);
1998-03-22 18:14:35 +03:00
/* If values are hardwired to something that they can't be, punt. */
if (ia->ia_nio < 1 ||
(ia->ia_io[0].ir_addr != ISACF_PORT_DEFAULT &&
ia->ia_io[0].ir_addr != 0x3b0))
return (0);
if (ia->ia_niomem < 1 ||
(ia->ia_iomem[0].ir_addr != ISACF_IOMEM_DEFAULT &&
ia->ia_iomem[0].ir_addr != 0xa0000))
return (0);
if (ia->ia_iomem[0].ir_size != 0 &&
ia->ia_iomem[0].ir_size != 0x20000)
return (0);
if (ia->ia_nirq > 0 &&
ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT)
return (0);
if (ia->ia_ndrq > 0 &&
ia->ia_drq[0].ir_drq != ISACF_DRQ_DEFAULT)
1998-03-22 18:14:35 +03:00
return (0);
if (!vga_is_console(ia->ia_iot, WSDISPLAY_TYPE_ISAVGA) &&
!vga_common_probe(ia->ia_iot, ia->ia_memt))
return (0);
ia->ia_nio = 1;
ia->ia_io[0].ir_addr = 0x3b0; /* XXX mono 0x3b0 color 0x3c0 */
ia->ia_io[0].ir_size = 0x30; /* XXX 0x20 */
ia->ia_niomem = 1;
ia->ia_iomem[0].ir_addr = 0xa0000;
ia->ia_iomem[0].ir_size = 0x20000;
ia->ia_nirq = 0;
ia->ia_ndrq = 0;
return (2); /* more than generic pcdisplay */
1998-03-22 18:14:35 +03:00
}
void
2002-07-09 10:55:09 +04:00
vga_isa_attach(struct device *parent, struct device *self, void *aux)
1998-03-22 18:14:35 +03:00
{
struct vga_softc *sc = (void *) self;
1998-03-22 18:14:35 +03:00
struct isa_attach_args *ia = aux;
printf("\n");
vga_common_attach(sc, ia->ia_iot, ia->ia_memt, WSDISPLAY_TYPE_ISAVGA,
0, NULL);
1998-03-22 18:14:35 +03:00
}
int
2002-07-09 10:55:09 +04:00
vga_isa_cnattach(bus_space_tag_t iot, bus_space_tag_t memt)
1998-03-22 18:14:35 +03:00
{
2002-06-26 13:38:37 +04:00
1998-03-22 18:14:35 +03:00
return (vga_cnattach(iot, memt, WSDISPLAY_TYPE_ISAVGA, 1));
}