diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2007-07-22 21:33:05 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2007-07-22 21:33:05 +0000 |
commit | b4375cec7e9617f93861387f019e62e5ebaf3c00 (patch) | |
tree | eb80c25d477a21b16f3ac62084ad9c7f583a3b5b | |
parent | 56cd6f62076cff63abae6ddc1d64623cc63c5565 (diff) |
Get rid of the fixe VA range for device mappings; use uvm_km_valloc() instead.
This allows mappings of more than 256MB, needed by some frame buffers.
"looks good", miod@
-rw-r--r-- | sys/arch/sparc64/include/param.h | 6 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/machdep.c | 43 |
2 files changed, 13 insertions, 36 deletions
diff --git a/sys/arch/sparc64/include/param.h b/sys/arch/sparc64/include/param.h index de4d7c0f8d1..f3d6f12458c 100644 --- a/sys/arch/sparc64/include/param.h +++ b/sys/arch/sparc64/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.25 2007/05/28 21:02:49 thib Exp $ */ +/* $OpenBSD: param.h,v 1.26 2007/07/22 21:33:04 kettenis Exp $ */ /* $NetBSD: param.h,v 1.25 2001/05/30 12:28:51 mrg Exp $ */ /* @@ -149,8 +149,6 @@ extern int nbpg, pgofset, pgshift; * KERNEND+0x010000: 64K locked TTE -- different for each CPU * Contains interrupt stack, cpu_info structure, * and 32KB kernel TSB. - * KERNEND+0x020000: IODEV_BASE -- begin mapping IO devices here. - * 0x00000000fe000000: IODEV_END -- end of device mapping space. * */ #define KERNBASE 0x001000000 /* start of kernel virtual space */ @@ -168,8 +166,6 @@ extern int nbpg, pgofset, pgshift; #define INTSTACK ( KERNEND + 8*_MAXNBPG)/* 64K after kernel end */ #define EINTSTACK ( INTSTACK + 2*USPACE) /* 32KB */ #define CPUINFO_VA ( EINTSTACK) -#define IODEV_BASE ( CPUINFO_VA + 8*_MAXNBPG)/* 64K long */ -#define IODEV_END 0x0f0000000UL /* 16 MB of iospace */ /* * Constants related to network buffer management. diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c index 8eb3ef580aa..c410ef0bc20 100644 --- a/sys/arch/sparc64/sparc64/machdep.c +++ b/sys/arch/sparc64/sparc64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.91 2007/06/06 17:15:13 deraadt Exp $ */ +/* $OpenBSD: machdep.c,v 1.92 2007/07/22 21:33:04 kettenis Exp $ */ /* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */ /*- @@ -1584,14 +1584,11 @@ int sparc_bus_alloc(bus_space_tag_t, bus_space_tag_t, bus_addr_t, bus_addr_t, void sparc_bus_free(bus_space_tag_t, bus_space_tag_t, bus_space_handle_t, bus_size_t); -vaddr_t iobase = IODEV_BASE; -struct extent *io_space = NULL; - int sparc_bus_map(bus_space_tag_t t, bus_space_tag_t t0, bus_addr_t addr, bus_size_t size, int flags, bus_space_handle_t *hp) { - vaddr_t v; + vaddr_t va; u_int64_t pa; paddr_t pm_flags = 0; vm_prot_t pm_prot = VM_PROT_READ; @@ -1601,16 +1598,6 @@ sparc_bus_map(bus_space_tag_t t, bus_space_tag_t t0, bus_addr_t addr, return (0); } - if (iobase == NULL) - iobase = IODEV_BASE; - if (io_space == NULL) - /* - * And set up IOSPACE extents. - */ - io_space = extent_create("IOSPACE", - (u_long)IODEV_BASE, (u_long)IODEV_END, M_DEVBUF, 0, 0, - EX_NOWAIT); - if (size == 0) { char buf[80]; bus_space_render_tag(t0, buf, sizeof buf); @@ -1656,18 +1643,14 @@ sparc_bus_map(bus_space_tag_t t, bus_space_tag_t t0, bus_addr_t addr, if ((flags & BUS_SPACE_MAP_CACHEABLE) == 0) pm_flags |= PMAP_NC; - { /* scope */ - int err = extent_alloc(io_space, size, NBPG, 0, 0, - EX_NOWAIT | EX_BOUNDZERO, (u_long *)&v); - if (err) - panic("sparc_bus_map: cannot allocate io_space: %d", - err); - } + va = uvm_km_valloc(kernel_map, size); + if (va == 0) + return (ENOMEM); /* note: preserve page offset */ - hp->bh_ptr = v | ((u_long)addr & PGOFSET); + hp->bh_ptr = va | (addr & PGOFSET); - pa = addr & ~PAGE_MASK; /* = trunc_page(addr); Will drop high bits */ + pa = trunc_page(addr); if ((flags & BUS_SPACE_MAP_READONLY) == 0) pm_prot |= VM_PROT_WRITE; @@ -1687,9 +1670,9 @@ sparc_bus_map(bus_space_tag_t t, bus_space_tag_t t0, bus_addr_t addr, BUS_SPACE_PRINTF(BSDB_MAPDETAIL, ("\nsparc_bus_map: phys %llx " "virt %p hp->bh_ptr %llx", (unsigned long long)pa, (char *)v, (unsigned long long)hp->bh_ptr)); - pmap_enter(pmap_kernel(), v, pa | pm_flags, pm_prot, + pmap_enter(pmap_kernel(), va, pa | pm_flags, pm_prot, pm_prot|PMAP_WIRED); - v += PAGE_SIZE; + va += PAGE_SIZE; pa += PAGE_SIZE; } while ((size -= PAGE_SIZE) > 0); pmap_update(pmap_kernel()); @@ -1767,16 +1750,14 @@ sparc_bus_unmap(bus_space_tag_t t, bus_space_tag_t t0, bus_space_handle_t bh, { vaddr_t va = trunc_page((vaddr_t)bh.bh_ptr); vaddr_t endva = va + round_page(size); - int error; if (PHYS_ASI(t0->asi)) return (0); - error = extent_free(io_space, va, size, EX_NOWAIT); - if (error) - printf("\nsparc_bus_unmap: extent free says %d", error); - pmap_remove(pmap_kernel(), va, endva); + pmap_update(pmap_kernel()); + uvm_km_free(kernel_map, va, endva - va); + return (0); } |