Prevent vga from attaching if vesafb is the console. Accessing VGA

registers after switching to a VESA linear framebuffer mode is not
guaranteed to work. This should fix the majority of the problems people
have been experiencing with vesafb.

XXX: Still doesn't fix the assertion in wscons with options DIAGNOSTIC.
This commit is contained in:
jmcneill 2006-02-19 15:16:53 +00:00
parent bb78dd00aa
commit b74d978f79
2 changed files with 36 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: vga.c,v 1.83 2005/12/11 12:21:29 christos Exp $ */
/* $NetBSD: vga.c,v 1.84 2006/02/19 15:16:53 jmcneill Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -35,7 +35,7 @@
#include "opt_wsmsgattrs.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.83 2005/12/11 12:21:29 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.84 2006/02/19 15:16:53 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -58,6 +58,10 @@ __KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.83 2005/12/11 12:21:29 christos Exp $");
#include <dev/ic/pcdisplay.h>
#ifdef __i386__
#include <arch/i386/bios/vesafbvar.h>
#endif
int vga_no_builtinfont = 0;
static struct wsdisplay_font _vga_builtinfont = {
@ -720,6 +724,17 @@ vga_cnattach(bus_space_tag_t iot, bus_space_tag_t memt, int type, int check)
int
vga_is_console(bus_space_tag_t iot, int type)
{
#ifdef __i386__
struct device *dv;
struct vesafb_softc *vesafb;
for (dv = alldevs.tqh_first; dv; dv=dv->dv_list.tqe_next)
if (strncmp(dv->dv_xname, "vesafb", 6) == 0) {
vesafb = (struct vesafb_softc *)dv;
if (vesafb->sc_isconsole)
return (0);
}
#endif
if (vgaconsole &&
!vga_console_attached &&
iot == vga_console_vc.hdl.vh_iot &&

View File

@ -1,4 +1,4 @@
/* $NetBSD: vga_common.c,v 1.6 2005/12/11 12:21:29 christos Exp $ */
/* $NetBSD: vga_common.c,v 1.7 2006/02/19 15:16:53 jmcneill Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vga_common.c,v 1.6 2005/12/11 12:21:29 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: vga_common.c,v 1.7 2006/02/19 15:16:53 jmcneill Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -39,6 +39,10 @@ __KERNEL_RCSID(0, "$NetBSD: vga_common.c,v 1.6 2005/12/11 12:21:29 christos Exp
#include <dev/ic/vgareg.h>
#include <dev/ic/vgavar.h>
#ifdef __i386__
#include <arch/i386/bios/vesafbvar.h>
#endif
/*
* The following functions implement back-end configuration grabbing
* and attachment.
@ -51,9 +55,22 @@ vga_common_probe(bus_space_tag_t iot, bus_space_tag_t memt)
u_int16_t vgadata;
int gotio_vga, gotio_6845, gotmem, mono, rv;
int dispoffset;
#ifdef __i386__
struct device *dv;
struct vesafb_softc *vesafb;
#endif
gotio_vga = gotio_6845 = gotmem = rv = 0;
#ifdef __i386__
for (dv = alldevs.tqh_first; dv; dv=dv->dv_list.tqe_next)
if (strncmp(dv->dv_xname, "vesafb", 6) == 0) {
vesafb = (struct vesafb_softc *)dv;
if (vesafb->sc_isconsole)
goto bad;
}
#endif
if (bus_space_map(iot, 0x3c0, 0x10, 0, &ioh_vga))
goto bad;
gotio_vga = 1;