diff options
author | Jason Wright <jason@cvs.openbsd.org> | 2002-03-31 17:34:16 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 2002-03-31 17:34:16 +0000 |
commit | cf3885a7e2cad8f88ec46d49abf29cf90926ca49 (patch) | |
tree | 752c8c89c49ef53b5d75230ffd6811ae01a967ab /sys/arch/sparc64/dev/vgafb.c | |
parent | 2dba0c0f5d8a7bf90d6d659b8566c1ffe32ef68f (diff) |
add a new mode to wsdisplay, WSDISPLAYIO_MODE_DUMBFB. This mode is
functionally equivalent what used to be WSDISPLAYIO_MODE_MAPPED, which now
means a "native" mapping.
vgafb_mmap() returns pci relative mappings in WSDISPLAYIO_MODE_MAPPED and
linear framebuffer mappings in WSDISPLAYIO_MODE_DUMBFB
Diffstat (limited to 'sys/arch/sparc64/dev/vgafb.c')
-rw-r--r-- | sys/arch/sparc64/dev/vgafb.c | 74 |
1 files changed, 38 insertions, 36 deletions
diff --git a/sys/arch/sparc64/dev/vgafb.c b/sys/arch/sparc64/dev/vgafb.c index 5bd27ef6686..ce3f036e334 100644 --- a/sys/arch/sparc64/dev/vgafb.c +++ b/sys/arch/sparc64/dev/vgafb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vgafb.c,v 1.13 2002/03/30 00:08:14 jason Exp $ */ +/* $OpenBSD: vgafb.c,v 1.14 2002/03/31 17:34:15 jason Exp $ */ /* * Copyright (c) 2001 Jason L. Wright (jason@thought.net) @@ -74,6 +74,7 @@ struct vgafb_softc { struct rcons sc_rcons; struct raster sc_raster; int sc_console; + u_int sc_mode; u_int8_t sc_cmap_red[256]; u_int8_t sc_cmap_green[256]; u_int8_t sc_cmap_blue[256]; @@ -269,6 +270,9 @@ vgafb_ioctl(v, cmd, data, flags, p) case WSDISPLAYIO_GTYPE: *(u_int *)data = WSDISPLAY_TYPE_UNKNOWN; break; + case WSDISPLAYIO_SMODE: + sc->sc_mode = *(u_int *)data; + break; case WSDISPLAYIO_GINFO: wdf = (void *)data; wdf->height = sc->sc_height; @@ -417,50 +421,48 @@ vgafb_mmap(v, off, prot) int prot; { struct vgafb_softc *sc = v; -#ifdef VGAFB_ALLOW_NATIVE bus_addr_t ba; bus_size_t bs; -#endif + paddr_t pa; + vaddr_t va; if (off & PGOFSET) return (-1); -#ifdef VGAFB_ALLOW_NATIVE - /* See if this is a native mapping of pixel memory */ - if ((pci_mem_find(sc->sc_pci_chip, sc->sc_pci_tag, sc->sc_mem_cf, - &ba, &bs, NULL) == 0) && - (off >= ba) && (off < (ba + bs))) { - return (bus_space_mmap(sc->sc_mem_t, ba, off - ba, prot, - BUS_SPACE_MAP_LINEAR)); - } - - /* See if this is a native mapping of memory mapped i/o */ - if ((pci_mem_find(sc->sc_pci_chip, sc->sc_pci_tag, sc->sc_mmio_cf, - &ba, &bs, NULL) == 0) && - (off >= ba) && (off < (ba + bs))) { - return (bus_space_mmap(sc->sc_mem_t, ba, off - ba, prot, - BUS_SPACE_MAP_LINEAR)); - } -#endif + switch (sc->sc_mode) { + case WSDISPLAYIO_MODE_MAPPED: + if ((pci_mem_find(sc->sc_pci_chip, sc->sc_pci_tag, + sc->sc_mem_cf, &ba, &bs, NULL) == 0) && + (off >= ba) && (off < (ba + bs))) + return (bus_space_mmap(sc->sc_mem_t, ba, off - ba, + prot, BUS_SPACE_MAP_LINEAR)); + + if ((pci_mem_find(sc->sc_pci_chip, sc->sc_pci_tag, + sc->sc_mmio_cf, &ba, &bs, NULL) == 0) && + (off >= ba) && (off < (ba + bs))) + return (bus_space_mmap(sc->sc_mem_t, ba, off - ba, + prot, BUS_SPACE_MAP_LINEAR)); + + if (sc->sc_rom_ptr != NULL && + off >= sc->sc_rom_addr && + off < sc->sc_rom_addr + sc->sc_rom_size) { + off -= sc->sc_rom_addr; + va = ((vaddr_t)sc->sc_rom_ptr) + off; + if (pmap_extract(pmap_kernel(), va, &pa) == FALSE) + return (-1); + return (pa); + } + return (-1); - /* Lastly, this might be a request for a "dumb" framebuffer map */ - if (off >= 0 && off < sc->sc_mem_size) { - return (bus_space_mmap(sc->sc_mem_t, sc->sc_mem_addr, off, prot, - BUS_SPACE_MAP_LINEAR)); - } + case WSDISPLAYIO_MODE_DUMBFB: + if (off >= 0 && off < sc->sc_mem_size) + return (bus_space_mmap(sc->sc_mem_t, sc->sc_mem_addr, + off, prot, BUS_SPACE_MAP_LINEAR)); + return (-1); -#ifdef VGAFB_ALLOW_NATIVE - /* Don't allow mapping of the shadow rom right now... needs work */ - if (sc->sc_rom_ptr != NULL && - off >= sc->sc_rom_addr && - off < sc->sc_rom_addr + sc->sc_rom_size) { - off -= sc->sc_rom_addr; - va = ((vaddr_t)sc->sc_rom_ptr) + off; - if (pmap_extract(pmap_kernel(), va, &pa) == FALSE) - return (-1); - return (pa); + default: + return (-1); } -#endif return (-1); } |