diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-12-18 18:49:47 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-12-18 18:49:47 +0000 |
commit | 60e531ccc44c1f6b6c262b1ebcf318f811473334 (patch) | |
tree | 546ec3a101f3dc2fbf327365aeeaaa5947bf0309 /sys/arch | |
parent | 6f3bc04a7af39ba09492555e576d3a0bb2ccf400 (diff) |
Allow bus_space mappings to span more than one 8MB segment; ok mickey@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/hppa/dev/dino.c | 54 |
1 files changed, 38 insertions, 16 deletions
diff --git a/sys/arch/hppa/dev/dino.c b/sys/arch/hppa/dev/dino.c index 75c64ae6598..9bbbea7eba9 100644 --- a/sys/arch/hppa/dev/dino.c +++ b/sys/arch/hppa/dev/dino.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dino.c,v 1.18 2006/12/14 17:36:12 kettenis Exp $ */ +/* $OpenBSD: dino.c,v 1.19 2006/12/18 18:49:46 miod Exp $ */ /* * Copyright (c) 2003-2005 Michael Shalayeff @@ -305,29 +305,51 @@ dino_memmap(void *v, bus_addr_t bpa, bus_size_t size, { struct dino_softc *sc = v; volatile struct dino_regs *r = sc->sc_regs; + bus_addr_t sbpa; u_int32_t reg; + int first = 1; int error; - reg = r->io_addr_en; - reg |= 1 << ((bpa >> 23) & 0x1f); + while (size != 0) { + sbpa = bpa & 0xff800000; + reg = r->io_addr_en; + reg |= 1 << ((bpa >> 23) & 0x1f); #ifdef DEBUG - if (reg & 0x80000001) - panic("mapping outside the mem extent range"); + if (reg & 0x80000001) + panic("mapping outside the mem extent range"); #endif - /* map into the upper bus space, if not yet mapped this 8M */ - if (reg != r->io_addr_en) { - bus_addr_t sbpa = bpa & 0xff800000; + /* map into the upper bus space, if not yet mapped this 8M */ + if (reg != r->io_addr_en) { - if ((error = bus_space_map(sc->sc_bt, sbpa, DINO_MEM_CHUNK, - flags, bshp))) { - return (error); + if ((error = bus_space_map(sc->sc_bt, sbpa, + DINO_MEM_CHUNK, flags, bshp))) { + return (error); + } + r->io_addr_en = reg; + + if (first) { + if (bshp) + *bshp += (bpa - sbpa); + } + } else { + if (first) { + if (bshp) + *bshp = bpa; + } } - r->io_addr_en = reg; - if (bshp) - *bshp += (bpa - sbpa); - } else if (bshp) - *bshp = bpa; + if (first) { + size += (bpa - sbpa); + first = 0; + } + + if (size < DINO_MEM_CHUNK) + size = 0; + else { + size -= DINO_MEM_CHUNK; + bpa = sbpa + DINO_MEM_CHUNK; + } + } return (0); } |