diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2000-09-05 05:06:59 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2000-09-05 05:06:59 +0000 |
commit | 534c5d8f534ddf5a7b8ecae81fda376cfc73a2d3 (patch) | |
tree | f51ea4e15a3d667b6077316ab833188d1b4532cb | |
parent | 31ea36fc4017fdcbfe3b95b6c90ec1c1ee01fa0e (diff) |
Use 32 pages instead of 4 in mem_alloc. This is needed by cnw, and useful
w/ other drivers as well. The iomem change has changed long ago to keep
using 4 pages; From NetBSD.
-rw-r--r-- | sys/dev/ic/i82365.c | 33 | ||||
-rw-r--r-- | sys/dev/ic/i82365var.h | 3 |
2 files changed, 18 insertions, 18 deletions
diff --git a/sys/dev/ic/i82365.c b/sys/dev/ic/i82365.c index b62f4be23c1..3ee14413af3 100644 --- a/sys/dev/ic/i82365.c +++ b/sys/dev/ic/i82365.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i82365.c,v 1.16 2000/06/30 22:33:07 aaron Exp $ */ +/* $OpenBSD: i82365.c,v 1.17 2000/09/05 05:06:58 fgsch Exp $ */ /* $NetBSD: i82365.c,v 1.10 1998/06/09 07:36:55 thorpej Exp $ */ /* @@ -868,13 +868,15 @@ pcic_chip_mem_alloc(pch, size, pcmhp) /* convert size to PCIC pages */ sizepg = (size + (PCIC_MEM_ALIGN - 1)) / PCIC_MEM_ALIGN; + if (sizepg > PCIC_MAX_MEM_PAGES) + return (1); mask = (1 << sizepg) - 1; addr = 0; /* XXX gcc -Wuninitialized */ mhandle = 0; /* XXX gcc -Wuninitialized */ - for (i = 0; i < (PCIC_MEM_PAGES + 1 - sizepg); i++) { + for (i = 0; i <= PCIC_MAX_MEM_PAGES - sizepg; i++) { if ((sc->subregionmask & (mask << i)) == (mask << i)) { if (bus_space_subregion(sc->memt, sc->memh, i * PCIC_MEM_PAGESIZE, @@ -883,24 +885,21 @@ pcic_chip_mem_alloc(pch, size, pcmhp) mhandle = mask << i; addr = sc->membase + (i * PCIC_MEM_PAGESIZE); sc->subregionmask &= ~(mhandle); - break; + pcmhp->memt = sc->memt; + pcmhp->memh = memh; + pcmhp->addr = addr; + pcmhp->size = size; + pcmhp->mhandle = mhandle; + pcmhp->realsize = sizepg * PCIC_MEM_PAGESIZE; + + DPRINTF(("pcic_chip_mem_alloc bus addr 0x%lx+0x%lx\n", + (u_long) addr, (u_long) size)); + + return (0); } } - if (i == (PCIC_MEM_PAGES + 1 - size)) - return (1); - - DPRINTF(("pcic_chip_mem_alloc bus addr 0x%lx+0x%lx\n", (u_long) addr, - (u_long) size)); - - pcmhp->memt = sc->memt; - pcmhp->memh = memh; - pcmhp->addr = addr; - pcmhp->size = size; - pcmhp->mhandle = mhandle; - pcmhp->realsize = sizepg * PCIC_MEM_PAGESIZE; - - return (0); + return (1); } void diff --git a/sys/dev/ic/i82365var.h b/sys/dev/ic/i82365var.h index dab9934bcf3..802d1be49f7 100644 --- a/sys/dev/ic/i82365var.h +++ b/sys/dev/ic/i82365var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i82365var.h,v 1.9 2000/06/28 17:48:10 aaron Exp $ */ +/* $OpenBSD: i82365var.h,v 1.10 2000/09/05 05:06:58 fgsch Exp $ */ /* $NetBSD: i82365var.h,v 1.4 1998/05/23 18:32:29 matt Exp $ */ /* @@ -123,6 +123,7 @@ struct pcic_softc { /* this needs to be large enough to hold PCIC_MEM_PAGES bits */ int subregionmask; +#define PCIC_MAX_MEM_PAGES (8 * sizeof(int)) /* used by memory window mapping functions */ bus_addr_t membase; |