2005-12-11 15:16:03 +03:00
|
|
|
/* $NetBSD: vga_isa.c,v 1.18 2005/12/11 12:22:03 christos Exp $ */
|
1998-03-22 18:14:35 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Author: Chris G. Demetriou
|
2005-02-27 03:26:58 +03:00
|
|
|
*
|
1998-03-22 18:14:35 +03:00
|
|
|
* 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.
|
2005-02-27 03:26:58 +03:00
|
|
|
*
|
|
|
|
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
|
|
|
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
|
1998-03-22 18:14:35 +03:00
|
|
|
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
2005-02-27 03:26:58 +03:00
|
|
|
*
|
1998-03-22 18:14:35 +03:00
|
|
|
* 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>
|
2005-12-11 15:16:03 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: vga_isa.c,v 1.18 2005/12/11 12:22:03 christos 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>
|
|
|
|
|
1998-05-28 20:48:40 +04:00
|
|
|
#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
|
|
|
|
2002-10-02 07:10:45 +04: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;
|
|
|
|
|
2002-01-08 00:46:56 +03:00
|
|
|
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. */
|
2002-01-08 00:46:56 +03:00
|
|
|
if (ia->ia_nio < 1 ||
|
2004-09-15 00:20:46 +04:00
|
|
|
(ia->ia_io[0].ir_addr != ISA_UNKNOWN_PORT &&
|
2002-01-08 00:46:56 +03:00
|
|
|
ia->ia_io[0].ir_addr != 0x3b0))
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
if (ia->ia_niomem < 1 ||
|
2004-09-15 00:20:46 +04:00
|
|
|
(ia->ia_iomem[0].ir_addr != ISA_UNKNOWN_IOMEM &&
|
2002-01-08 00:46:56 +03:00
|
|
|
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 &&
|
2004-09-15 00:20:46 +04:00
|
|
|
ia->ia_irq[0].ir_irq != ISA_UNKNOWN_IRQ)
|
2002-01-08 00:46:56 +03:00
|
|
|
return (0);
|
|
|
|
|
|
|
|
if (ia->ia_ndrq > 0 &&
|
2004-09-15 00:20:46 +04:00
|
|
|
ia->ia_drq[0].ir_drq != ISA_UNKNOWN_DRQ)
|
1998-03-22 18:14:35 +03:00
|
|
|
return (0);
|
|
|
|
|
1998-06-12 22:45:48 +04:00
|
|
|
if (!vga_is_console(ia->ia_iot, WSDISPLAY_TYPE_ISAVGA) &&
|
|
|
|
!vga_common_probe(ia->ia_iot, ia->ia_memt))
|
|
|
|
return (0);
|
|
|
|
|
2002-01-08 00:46:56 +03:00
|
|
|
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;
|
|
|
|
|
1998-06-12 22:45:48 +04:00
|
|
|
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
|
|
|
{
|
2001-09-14 05:10:11 +04:00
|
|
|
struct vga_softc *sc = (void *) self;
|
1998-03-22 18:14:35 +03:00
|
|
|
struct isa_attach_args *ia = aux;
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
|
2001-09-14 05:10:11 +04:00
|
|
|
vga_common_attach(sc, ia->ia_iot, ia->ia_memt, WSDISPLAY_TYPE_ISAVGA,
|
2002-06-29 02:24:11 +04:00
|
|
|
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));
|
|
|
|
}
|