diff --git a/sys/conf/files b/sys/conf/files index 213ef3ec7ee2..72e408d23687 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,4 +1,4 @@ -# $NetBSD: files,v 1.536 2002/06/24 08:06:20 itojun Exp $ +# $NetBSD: files,v 1.537 2002/06/27 06:26:51 junyoung Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 @@ -764,6 +764,7 @@ file dev/ic/pcdisplay_subr.c pcdisplayops file dev/ic/pcdisplay_chars.c pcdisplayops # VGA graphics # +defflag opt_vga.h VGA_CONSOLE_ATI_BROKEN_FONTSEL device vga: wsemuldisplaydev, pcdisplayops file dev/ic/vga.c vga needs-flag file dev/ic/vga_subr.c vga diff --git a/sys/dev/ic/vga.c b/sys/dev/ic/vga.c index 1d83fd55834e..b7e018328bcc 100644 --- a/sys/dev/ic/vga.c +++ b/sys/dev/ic/vga.c @@ -1,4 +1,4 @@ -/* $NetBSD: vga.c,v 1.53 2002/06/26 23:05:33 christos Exp $ */ +/* $NetBSD: vga.c,v 1.54 2002/06/27 06:26:53 junyoung Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.53 2002/06/26 23:05:33 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.54 2002/06/27 06:26:53 junyoung Exp $"); #include #include @@ -597,8 +597,7 @@ vga_init(struct vga_config *vc, bus_space_tag_t iot, bus_space_tag_t memt) void vga_common_attach(struct vga_softc *sc, bus_space_tag_t iot, - bus_space_tag_t memt, int type, int quirks, - const struct vga_funcs *vf) + bus_space_tag_t memt, int type, const struct vga_funcs *vf) { int console; struct vga_config *vc; @@ -615,7 +614,7 @@ vga_common_attach(struct vga_softc *sc, bus_space_tag_t iot, } vc->vc_type = type; - vc->vc_nfontslots = (quirks & VGA_QUIRK_ONEFONT) ? 1 : 8; + vc->vc_nfontslots = 8; vc->vc_funcs = vf; sc->sc_vc = vc; @@ -648,7 +647,6 @@ vga_cnattach(bus_space_tag_t iot, bus_space_tag_t memt, int type, int check) #else scr = vga_console_vc.currenttype; #endif - vga_console_vc.vc_nfontslots = 1; /* for now assume buggy adapter */ vga_init_screen(&vga_console_vc, &vga_console_screen, scr, 1, &defattr); wsdisplay_cnattach(scr, &vga_console_screen, @@ -846,17 +844,18 @@ vga_usefont(struct vga_config *vc, struct egavga_font *f) goto loadit; } } - - /* - * This should only happen if there is only 1 font slot - * which is occupied by the builtin font. - * Last resort: kick out the builtin font. - */ - KASSERT(vc->vc_fonts[0] == &vga_builtinfont); - TAILQ_REMOVE(&vc->vc_fontlist, &vga_builtinfont, next); - slot = 0; + panic("vga_usefont"); loadit: +#ifdef VGA_CONSOLE_ATI_BROKEN_FONTSEL + if (slot == 1) { + /* Load the builtin font to slot 1. */ + vga_loadchars(&vc->hdl, slot, 0, 256, f->wsfont->fontheight, + NULL); + vc->vc_fonts[slot] = &vga_builtinfont; + slot++; + } +#endif vga_loadchars(&vc->hdl, slot, f->wsfont->firstchar, f->wsfont->numchars, f->wsfont->fontheight, f->wsfont->data); diff --git a/sys/dev/ic/vga_subr.c b/sys/dev/ic/vga_subr.c index bbe49e7a4c17..c0489d68a4be 100644 --- a/sys/dev/ic/vga_subr.c +++ b/sys/dev/ic/vga_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: vga_subr.c,v 1.8 2001/12/13 08:34:55 junyoung Exp $ */ +/* $NetBSD: vga_subr.c,v 1.9 2002/06/27 06:26:54 junyoung Exp $ */ /* * Copyright (c) 1998 @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vga_subr.c,v 1.8 2001/12/13 08:34:55 junyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vga_subr.c,v 1.9 2002/06/27 06:26:54 junyoung Exp $"); #include #include @@ -98,11 +98,17 @@ vga_loadchars(struct vga_handle *vh, int fontset, int first, int num, int lpc, s = splhigh(); fontram(vh); - for (i = 0; i < num; i++) - for (j = 0; j < lpc; j++) - bus_space_write_1(vh->vh_memt, vh->vh_allmemh, - offset + (i << 5) + j, - data[i * lpc + j]); +#ifdef VGA_CONSOLE_ATI_BROKEN_FONTSEL + if (fontset == 1) + bus_space_copy_region_1(vh->vh_memt, vh->vh_allmemh, 0, + vh->vh_allmemh, offset, 8192); + else +#endif + for (i = 0; i < num; i++) + for (j = 0; j < lpc; j++) + bus_space_write_1(vh->vh_memt, vh->vh_allmemh, + offset + (i << 5) + j, + data[i * lpc + j]); textram(vh); splx(s); @@ -111,6 +117,22 @@ vga_loadchars(struct vga_handle *vh, int fontset, int first, int num, int lpc, void vga_setfontset(struct vga_handle *vh, int fontset1, int fontset2) { +#ifdef VGA_CONSOLE_ATI_BROKEN_FONTSEL + /* XXXBJY: 512 character mode is still broken. */ + + int s; + + s = splhigh(); + fontram(vh); + + if (fontset1 == 0) + fontset1++; + bus_space_copy_region_1(vh->vh_memt, vh->vh_allmemh, fontset1 << 13, + vh->vh_allmemh, 0, 8192); + + textram(vh); + splx(s); +#else u_int8_t cmap; static u_int8_t cmaptaba[] = { 0x00, 0x10, 0x01, 0x11, @@ -125,6 +147,7 @@ vga_setfontset(struct vga_handle *vh, int fontset1, int fontset2) cmap = cmaptaba[fontset1] | cmaptabb[fontset2]; vga_ts_write(vh, fontsel, cmap); +#endif /* VGA_CONSOLE_ATI_BROKEN_FONTSEL */ } void diff --git a/sys/dev/ic/vgavar.h b/sys/dev/ic/vgavar.h index 0e76eaa0a2e8..7577ad45d06d 100644 --- a/sys/dev/ic/vgavar.h +++ b/sys/dev/ic/vgavar.h @@ -1,4 +1,4 @@ -/* $NetBSD: vgavar.h,v 1.11 2002/06/25 21:07:42 drochner Exp $ */ +/* $NetBSD: vgavar.h,v 1.12 2002/06/27 06:26:54 junyoung Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -29,6 +29,8 @@ #include +#include "opt_vga.h" + struct vga_handle { struct pcdisplay_handle vh_ph; bus_space_handle_t vh_ioh_vga, vh_allmemh; @@ -184,10 +186,7 @@ _vga_crtc_write(struct vga_handle *vh, int reg, u_int8_t val) int vga_common_probe(bus_space_tag_t, bus_space_tag_t); void vga_common_attach(struct vga_softc *, bus_space_tag_t, - bus_space_tag_t, int, int, - const struct vga_funcs *); -#define VGA_QUIRK_ONEFONT 0x01 -#define VGA_QUIRK_NOFASTSCROLL 0x02 + bus_space_tag_t, int, const struct vga_funcs *); int vga_is_console(bus_space_tag_t, int); int vga_cnattach(bus_space_tag_t, bus_space_tag_t, int, int); diff --git a/sys/dev/isa/vga_isa.c b/sys/dev/isa/vga_isa.c index a42c14c71c9e..eede517418ff 100644 --- a/sys/dev/isa/vga_isa.c +++ b/sys/dev/isa/vga_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: vga_isa.c,v 1.9 2002/06/26 09:38:37 simonb Exp $ */ +/* $NetBSD: vga_isa.c,v 1.10 2002/06/27 06:26:54 junyoung Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vga_isa.c,v 1.9 2002/06/26 09:38:37 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vga_isa.c,v 1.10 2002/06/27 06:26:54 junyoung Exp $"); #include #include @@ -116,7 +116,7 @@ vga_isa_attach(parent, self, aux) printf("\n"); vga_common_attach(sc, ia->ia_iot, ia->ia_memt, WSDISPLAY_TYPE_ISAVGA, - 0, NULL); + NULL); } int diff --git a/sys/dev/pci/vga_pci.c b/sys/dev/pci/vga_pci.c index cf545ee1541c..c4565935d8d9 100644 --- a/sys/dev/pci/vga_pci.c +++ b/sys/dev/pci/vga_pci.c @@ -1,4 +1,4 @@ -/* $NetBSD: vga_pci.c,v 1.12 2002/06/25 21:07:43 drochner Exp $ */ +/* $NetBSD: vga_pci.c,v 1.13 2002/06/27 06:26:55 junyoung Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vga_pci.c,v 1.12 2002/06/25 21:07:43 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vga_pci.c,v 1.13 2002/06/27 06:26:55 junyoung Exp $"); #include #include @@ -73,7 +73,6 @@ struct vga_pci_softc { int vga_pci_match(struct device *, struct cfdata *, void *); void vga_pci_attach(struct device *, struct device *, void *); -static int vga_pci_lookup_quirks(struct pci_attach_args *); struct cfattach vga_pci_ca = { sizeof(struct vga_pci_softc), @@ -89,28 +88,6 @@ const struct vga_funcs vga_pci_funcs = { vga_pci_mmap, }; -static const struct { - int id; - int quirks; -} vga_pci_quirks[] = { - {PCI_ID_CODE(PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGE_XL_AGP), - VGA_QUIRK_ONEFONT}, -}; - -static int -vga_pci_lookup_quirks(pa) - struct pci_attach_args *pa; -{ - int i; - - for (i = 0; i < sizeof(vga_pci_quirks) / sizeof (vga_pci_quirks[0]); - i++) { - if (vga_pci_quirks[i].id == pa->pa_id) - return (vga_pci_quirks[i].quirks); - } - return (0); -} - int vga_pci_match(struct device *parent, struct cfdata *match, void *aux) { @@ -204,7 +181,7 @@ vga_pci_attach(struct device *parent, struct device *self, void *aux) /* XXX Expansion ROM? */ vga_common_attach(sc, pa->pa_iot, pa->pa_memt, WSDISPLAY_TYPE_PCIVGA, - vga_pci_lookup_quirks(pa), &vga_pci_funcs); + &vga_pci_funcs); } int