diff options
author | Jason Wright <jason@cvs.openbsd.org> | 2002-02-05 18:34:40 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 2002-02-05 18:34:40 +0000 |
commit | 80807a820863acbe9e7a8e97d90a122154c92174 (patch) | |
tree | ddb4617cf52b9f6355ac4e519266ce184e523d64 /sys/arch/sparc64/dev | |
parent | 7d84752ac322dea0df5c2f3dc674aef52daea8a7 (diff) |
Implement vgafb_mmap() fully
From NetBSD: change bus_space_mmap() prototype to standard one
Diffstat (limited to 'sys/arch/sparc64/dev')
-rw-r--r-- | sys/arch/sparc64/dev/ebus.c | 16 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/psycho.c | 21 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/sbus.c | 9 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/vgafb.c | 22 |
4 files changed, 37 insertions, 31 deletions
diff --git a/sys/arch/sparc64/dev/ebus.c b/sys/arch/sparc64/dev/ebus.c index a00e9839518..76e01f7816c 100644 --- a/sys/arch/sparc64/dev/ebus.c +++ b/sys/arch/sparc64/dev/ebus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ebus.c,v 1.6 2001/12/14 14:53:48 jason Exp $ */ +/* $OpenBSD: ebus.c,v 1.7 2002/02/05 18:34:39 jason Exp $ */ /* $NetBSD: ebus.c,v 1.24 2001/07/25 03:49:54 eeh Exp $ */ /* @@ -99,8 +99,7 @@ int ebus_find_node __P((struct pci_attach_args *)); /* * here are our bus space and bus dma routines. */ -static int ebus_bus_mmap __P((bus_space_tag_t, bus_type_t, bus_addr_t, - int, bus_space_handle_t *)); +static paddr_t ebus_bus_mmap __P((bus_space_tag_t, bus_addr_t, off_t, int, int)); static int _ebus_bus_map __P((bus_space_tag_t, bus_type_t, bus_addr_t, bus_size_t, int, vaddr_t, bus_space_handle_t *)); @@ -502,13 +501,13 @@ _ebus_bus_map(t, btype, offset, size, flags, vaddr, hp) return (EINVAL); } -static int -ebus_bus_mmap(t, btype, paddr, flags, hp) +static paddr_t +ebus_bus_mmap(t, paddr, off, prot, flags) bus_space_tag_t t; - bus_type_t btype; bus_addr_t paddr; + off_t off; + int prot; int flags; - bus_space_handle_t *hp; { bus_addr_t offset = paddr; struct ebus_softc *sc = t->cookie; @@ -523,8 +522,7 @@ ebus_bus_mmap(t, btype, paddr, flags, hp) DPRINTF(EDB_BUSMAP, ("\n_ebus_bus_mmap: mapping paddr %qx\n", (unsigned long long)paddr)); - return (bus_space_mmap(sc->sc_memtag, 0, paddr, - flags, hp)); + return (bus_space_mmap(sc->sc_memtag, paddr, off, prot, flags)); } return (-1); diff --git a/sys/arch/sparc64/dev/psycho.c b/sys/arch/sparc64/dev/psycho.c index 4de00164ffd..e5f53ca081d 100644 --- a/sys/arch/sparc64/dev/psycho.c +++ b/sys/arch/sparc64/dev/psycho.c @@ -1,4 +1,4 @@ -/* $OpenBSD: psycho.c,v 1.13 2002/01/31 18:27:26 jason Exp $ */ +/* $OpenBSD: psycho.c,v 1.14 2002/02/05 18:34:39 jason Exp $ */ /* $NetBSD: psycho.c,v 1.39 2001/10/07 20:30:41 eeh Exp $ */ /* @@ -93,8 +93,7 @@ void psycho_iommu_init __P((struct psycho_softc *, int)); * bus space and bus dma support for UltraSPARC `psycho'. note that most * of the bus dma support is provided by the iommu dvma controller. */ -int psycho_bus_mmap __P((bus_space_tag_t, bus_type_t, bus_addr_t, - int, bus_space_handle_t *)); +paddr_t psycho_bus_mmap __P((bus_space_tag_t, bus_addr_t, off_t, int, int)); int _psycho_bus_map __P((bus_space_tag_t, bus_type_t, bus_addr_t, bus_size_t, int, vaddr_t, bus_space_handle_t *)); void *psycho_intr_establish __P((bus_space_tag_t, int, int, int, @@ -906,13 +905,13 @@ _psycho_bus_map(t, btype, offset, size, flags, vaddr, hp) return (EINVAL); } -int -psycho_bus_mmap(t, btype, paddr, flags, hp) +paddr_t +psycho_bus_mmap(t, paddr, off, prot, flags) bus_space_tag_t t; - bus_type_t btype; bus_addr_t paddr; + off_t off; + int prot; int flags; - bus_space_handle_t *hp; { bus_addr_t offset = paddr; struct psycho_pbm *pp = t->cookie; @@ -921,7 +920,8 @@ psycho_bus_mmap(t, btype, paddr, flags, hp) ss = psycho_get_childspace(t->type); - DPRINTF(PDB_BUSMAP, ("_psycho_bus_mmap: type %d flags %d pa %qx\n", btype, flags, (unsigned long long)paddr)); + DPRINTF(PDB_BUSMAP, ("_psycho_bus_mmap: prot %d flags %d pa %qx\n", + prot, flags, (unsigned long long)paddr)); for (i = 0; i < pp->pp_nrange; i++) { bus_addr_t paddr; @@ -931,10 +931,11 @@ psycho_bus_mmap(t, btype, paddr, flags, hp) paddr = pp->pp_range[i].phys_lo + offset; paddr |= ((bus_addr_t)pp->pp_range[i].phys_hi<<32); - DPRINTF(PDB_BUSMAP, ("\n_psycho_bus_mmap: mapping paddr space %lx offset %lx paddr %qx\n", + DPRINTF(PDB_BUSMAP, ("\n_psycho_bus_mmap: mapping paddr " + "space %lx offset %lx paddr %qx\n", (long)ss, (long)offset, (unsigned long long)paddr)); - return (bus_space_mmap(sc->sc_bustag, 0, paddr, flags, hp)); + return (bus_space_mmap(sc->sc_bustag, paddr, off, prot, flags)); } return (-1); diff --git a/sys/arch/sparc64/dev/sbus.c b/sys/arch/sparc64/dev/sbus.c index c9c776f0d84..374c61134f5 100644 --- a/sys/arch/sparc64/dev/sbus.c +++ b/sys/arch/sparc64/dev/sbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sbus.c,v 1.9 2002/01/10 00:06:17 nordin Exp $ */ +/* $OpenBSD: sbus.c,v 1.10 2002/02/05 18:34:39 jason Exp $ */ /* $NetBSD: sbus.c,v 1.46 2001/10/07 20:30:41 eeh Exp $ */ /*- @@ -123,6 +123,8 @@ #include <sparc64/dev/sbusreg.h> #include <dev/sbus/sbusvar.h> +#include <uvm/uvm_extern.h> + #include <machine/autoconf.h> #include <machine/cpu.h> #include <machine/sparc64.h> @@ -513,10 +515,11 @@ sbus_bus_mmap(t, btype, paddr, flags, hp) paddr = sc->sc_range[i].poffset + offset; paddr |= ((bus_addr_t)sc->sc_range[i].pspace<<32); - return (bus_space_mmap(sc->sc_bustag, 0, paddr, flags, hp)); + *hp = bus_space_mmap(sc->sc_bustag, paddr, 0, + VM_PROT_READ|VM_PROT_WRITE, flags); } - return (-1); + return (*hp == -1 ? -1 : 0); } bus_addr_t diff --git a/sys/arch/sparc64/dev/vgafb.c b/sys/arch/sparc64/dev/vgafb.c index 8d8bf2d10c9..566a2223b9c 100644 --- a/sys/arch/sparc64/dev/vgafb.c +++ b/sys/arch/sparc64/dev/vgafb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vgafb.c,v 1.3 2002/01/03 16:26:27 jason Exp $ */ +/* $OpenBSD: vgafb.c,v 1.4 2002/02/05 18:34:39 jason Exp $ */ /* * Copyright (c) 2001 Jason L. Wright (jason@thought.net) @@ -61,6 +61,7 @@ struct vgafb_softc { int sc_node, sc_ofhandle; bus_space_tag_t sc_bt; bus_space_handle_t sc_bh; + bus_addr_t sc_paddr; struct rcons sc_rcons; struct raster sc_raster; int sc_console; @@ -164,7 +165,6 @@ vgafbattach(parent, self, aux) struct wsemuldisplaydev_attach_args waa; bus_size_t memsize; long defattr; - bus_addr_t membase; sc->sc_node = PCITAG_NODE(pa->pa_tag); @@ -187,12 +187,12 @@ vgafbattach(parent, self, aux) sc->sc_console = vgafb_is_console(sc->sc_node); if (pci_mem_find(pa->pa_pc, pa->pa_tag, 0x10, - &membase, &memsize, NULL)) { + &sc->sc_paddr, &memsize, NULL)) { printf(": can't find mem space\n"); goto fail; } if (bus_space_map2(pa->pa_memt, SBUS_BUS_SPACE, - membase, memsize, 0, NULL, &sc->sc_bh)) { + sc->sc_paddr, memsize, 0, NULL, &sc->sc_bh)) { printf(": can't map mem space\n"); goto fail; } @@ -406,17 +406,21 @@ vgafb_show_screen(v, cookie, waitok, cb, cbarg) } paddr_t -vgafb_mmap(v, offset, prot) +vgafb_mmap(v, off, prot) void *v; - off_t offset; + off_t off; int prot; { -#if 0 struct vgafb_softc *sc = v; -#endif - if (offset & PGOFSET) + if (off & PGOFSET) return (-1); + + if (off >= 0 && off < 0x800000) { + return (bus_space_mmap(sc->sc_bt, sc->sc_paddr, off, prot, + BUS_SPACE_MAP_LINEAR)); + } + return (-1); } |