summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2001-01-15 23:23:59 +0000
committerJason Wright <jason@cvs.openbsd.org>2001-01-15 23:23:59 +0000
commit9b9c0d634967c42e5b81e9c9b46ba809557df246 (patch)
treeeb57c95b01b3e1b1bfdc1025f0111271563950c1
parent454375a7daad282cb21678b6667087b4b6fc078d (diff)
- increase the amount of space mapped for dvma on sun4m
- use a flag to specify allocations for 24 bit devices - compatibility macros to deal with the 32 bit devices This fixes the 'le at sbus' on sun4m problem (with the extent fixes earlier), and allows the Artecon ethernet cards to work in sun4m machines.
-rw-r--r--sys/arch/sparc/dev/if_le.c10
-rw-r--r--sys/arch/sparc/include/param.h5
-rw-r--r--sys/arch/sparc/include/vmparam.h5
-rw-r--r--sys/arch/sparc/sparc/vaddrs.h10
-rw-r--r--sys/arch/sparc/sparc/vm_machdep.c22
5 files changed, 34 insertions, 18 deletions
diff --git a/sys/arch/sparc/dev/if_le.c b/sys/arch/sparc/dev/if_le.c
index fe937ede779..24c5b4bfe9e 100644
--- a/sys/arch/sparc/dev/if_le.c
+++ b/sys/arch/sparc/dev/if_le.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_le.c,v 1.16 1999/02/28 19:12:34 jason Exp $ */
+/* $OpenBSD: if_le.c,v 1.17 2001/01/15 23:23:57 jason Exp $ */
/* $NetBSD: if_le.c,v 1.50 1997/09/09 20:54:48 pk Exp $ */
/*-
@@ -477,7 +477,13 @@ leattach(parent, self, aux)
#endif
{
u_long laddr;
- laddr = (u_long)dvma_malloc(MEMSIZE, &sc->sc_mem, M_NOWAIT);
+
+ if (sbuschild && CPU_ISSUN4M)
+ laddr = (u_long)dvma_malloc_space(MEMSIZE,
+ &sc->sc_mem, M_NOWAIT, M_SPACE_D24);
+ else
+ laddr = (u_long)dvma_malloc(MEMSIZE,
+ &sc->sc_mem, M_NOWAIT);
#if defined (SUN4M)
if ((laddr & 0xffffff) >= (laddr & 0xffffff) + MEMSIZE)
panic("if_le: Lance buffer crosses 16MB boundary");
diff --git a/sys/arch/sparc/include/param.h b/sys/arch/sparc/include/param.h
index 08894b43793..f0f3ff99afa 100644
--- a/sys/arch/sparc/include/param.h
+++ b/sys/arch/sparc/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.15 2000/03/08 22:13:23 deraadt Exp $ */
+/* $OpenBSD: param.h,v 1.16 2001/01/15 23:23:58 jason Exp $ */
/* $NetBSD: param.h,v 1.29 1997/03/10 22:50:37 pk Exp $ */
/*
@@ -180,8 +180,9 @@ extern vaddr_t dvma_end;
extern struct extent *dvmamap_extent;
extern caddr_t kdvma_mapin __P((caddr_t, int, int));
-extern caddr_t dvma_malloc __P((size_t, void *, int));
+extern caddr_t dvma_malloc_space __P((size_t, void *, int, int));
extern void dvma_free __P((caddr_t, size_t, void *));
+#define dvma_malloc(len,kaddr,flags) dvma_malloc_space(len,kaddr,flags,0)
extern void delay __P((unsigned int));
#define DELAY(n) delay(n)
diff --git a/sys/arch/sparc/include/vmparam.h b/sys/arch/sparc/include/vmparam.h
index 09505dfb8b0..02eb31cb076 100644
--- a/sys/arch/sparc/include/vmparam.h
+++ b/sys/arch/sparc/include/vmparam.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmparam.h,v 1.14 1999/12/01 22:49:10 deraadt Exp $ */
+/* $OpenBSD: vmparam.h,v 1.15 2001/01/15 23:23:58 jason Exp $ */
/* $NetBSD: vmparam.h,v 1.13 1997/07/12 16:20:03 perry Exp $ */
/*
@@ -164,7 +164,8 @@ struct pmap_physseg {
#if defined (_KERNEL) && !defined(_LOCORE)
struct vm_map;
-vaddr_t dvma_mapin __P((struct vm_map *, vaddr_t, int, int));
+#define dvma_mapin(map,va,len,canwait) dvma_mapin_space(map,va,len,canwait,0)
+vaddr_t dvma_mapin_space __P((struct vm_map *, vaddr_t, int, int, int));
void dvma_mapout __P((vaddr_t, vaddr_t, int));
#endif
diff --git a/sys/arch/sparc/sparc/vaddrs.h b/sys/arch/sparc/sparc/vaddrs.h
index 66ebb45b094..88382deba85 100644
--- a/sys/arch/sparc/sparc/vaddrs.h
+++ b/sys/arch/sparc/sparc/vaddrs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vaddrs.h,v 1.4 1997/08/08 08:27:47 downsj Exp $ */
+/* $OpenBSD: vaddrs.h,v 1.5 2001/01/15 23:23:58 jason Exp $ */
/* $NetBSD: vaddrs.h,v 1.8 1997/03/10 23:54:41 pk Exp $ */
/*
@@ -113,9 +113,11 @@
* in both processor and IOMMU space.
*/
#define DVMA4M_BASE 0xfc000000 /* can change subject to above rule */
-#define DVMA4M_TOP 0xffffffff /* do not modify */
-#define DVMA4M_START 0xfd000000 /* 16M of DVMA */
-#define DVMA4M_END 0xfe000000 /* XXX is this enough? */
+#define DVMA4M_END 0xfffff000 /* XXX is this enough? */
+#define DVMA_D24_BASE 0xff000000
+#define DVMA_D24_END 0xfffff000
+
+#define M_SPACE_D24 0x0001
/*
* Virtual address of the per cpu `cpu_softc' structure.
diff --git a/sys/arch/sparc/sparc/vm_machdep.c b/sys/arch/sparc/sparc/vm_machdep.c
index 0012bbca904..e8946bb25c8 100644
--- a/sys/arch/sparc/sparc/vm_machdep.c
+++ b/sys/arch/sparc/sparc/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.21 2000/06/08 22:25:22 niklas Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.22 2001/01/15 23:23:58 jason Exp $ */
/* $NetBSD: vm_machdep.c,v 1.30 1997/03/10 23:55:40 pk Exp $ */
/*
@@ -115,7 +115,7 @@ extern int has_iocache;
#endif
caddr_t
-dvma_malloc(len, kaddr, flags)
+dvma_malloc_space(len, kaddr, flags, space)
size_t len;
void *kaddr;
int flags;
@@ -134,7 +134,7 @@ dvma_malloc(len, kaddr, flags)
kvm_uncache((caddr_t)kva, atop(len));
*(vaddr_t *)kaddr = kva;
- dva = dvma_mapin(kernel_map, kva, len, (flags & M_NOWAIT) ? 0 : 1);
+ dva = dvma_mapin_space(kernel_map, kva, len, (flags & M_NOWAIT) ? 0 : 1, space);
if (dva == NULL) {
free((void *)kva, M_DEVBUF);
return (NULL);
@@ -172,10 +172,10 @@ u_long dvma_cachealign = 0;
* to a kernel address in DVMA space.
*/
vaddr_t
-dvma_mapin(map, va, len, canwait)
+dvma_mapin_space(map, va, len, canwait, space)
struct vm_map *map;
vaddr_t va;
- int len, canwait;
+ int len, canwait, space;
{
vaddr_t kva, tva;
int npf, s;
@@ -197,9 +197,15 @@ dvma_mapin(map, va, len, canwait)
npf = btoc(len);
s = splhigh();
- error = extent_alloc1(dvmamap_extent, len, dvma_cachealign,
- va & (dvma_cachealign - 1), 0,
- canwait ? EX_WAITSPACE : 0, &tva);
+ if (space & M_SPACE_D24)
+ error = extent_alloc_subregion1(dvmamap_extent,
+ DVMA_D24_BASE, DVMA_D24_END, len, dvma_cachealign,
+ va & (dvma_cachealign - 1), 0,
+ canwait ? EX_WAITSPACE : EX_WAITOK, &tva);
+ else
+ error = extent_alloc1(dvmamap_extent, len, dvma_cachealign,
+ va & (dvma_cachealign - 1), 0,
+ canwait ? EX_WAITSPACE : EX_WAITOK, &tva);
splx(s);
if (error)
return NULL;