summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2000-02-21 14:51:21 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2000-02-21 14:51:21 +0000
commit5f6031695a3a910c40463216052124a1e176ea3e (patch)
treebafae266744f88a8a1becbfb9837d6d8de40858e /sys
parent15199e0a7dec5f8b3cb65b34ea5b26d4fc1a6b9b (diff)
When mapping something into iommu space hypersparc requires us to align it
so that cache_alias_bits match in the kernel mapping and the iommu mapping. (see code for better explaination).
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/sparc/sparc/cache.c6
-rw-r--r--sys/arch/sparc/sparc/vm_machdep.c22
2 files changed, 15 insertions, 13 deletions
diff --git a/sys/arch/sparc/sparc/cache.c b/sys/arch/sparc/sparc/cache.c
index 46cac44e73b..7ebfb4cebda 100644
--- a/sys/arch/sparc/sparc/cache.c
+++ b/sys/arch/sparc/sparc/cache.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cache.c,v 1.11 2000/02/21 14:43:35 art Exp $ */
+/* $OpenBSD: cache.c,v 1.12 2000/02/21 14:51:20 art Exp $ */
/* $NetBSD: cache.c,v 1.34 1997/09/26 22:17:23 pk Exp $ */
/*
@@ -180,9 +180,7 @@ hypersparc_cache_enable()
{
int i, ls, ts;
u_int pcr, v;
-#ifdef notyet
extern u_long dvma_cachealign;
-#endif
ls = CACHEINFO.c_linesize;
ts = CACHEINFO.c_totalsize;
@@ -194,9 +192,7 @@ hypersparc_cache_enable()
*/
cache_alias_dist = CACHEINFO.c_totalsize;
cache_alias_bits = (cache_alias_dist - 1) & ~PGOFSET;
-#ifdef notyet
dvma_cachealign = cache_alias_dist;
-#endif
/* Now reset cache tag memory if cache not yet enabled */
if ((pcr & HYPERSPARC_PCR_CE) == 0)
diff --git a/sys/arch/sparc/sparc/vm_machdep.c b/sys/arch/sparc/sparc/vm_machdep.c
index bd296ac66d0..57911e0b364 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.15 2000/02/18 17:40:04 art Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.16 2000/02/21 14:51:20 art Exp $ */
/* $NetBSD: vm_machdep.c,v 1.30 1997/03/10 23:55:40 pk Exp $ */
/*
@@ -164,6 +164,8 @@ dvma_free(dva, len, kaddr)
free((void *)kva, M_DEVBUF);
}
+u_long dvma_cachealign = 0;
+
/*
* Map a range [va, va+len] of wired virtual addresses in the given map
* to a kernel address in DVMA space.
@@ -177,22 +179,26 @@ dvma_mapin(map, va, len, canwait)
vaddr_t kva, tva;
int npf, s;
paddr_t pa;
- long off;
- vaddr_t ova;
- int olen;
+ vaddr_t off;
+ vaddr_t ova;
+ int olen;
int error;
+ if (dvma_cachealign == 0)
+ dvma_cachealign = PAGE_SIZE;
+
ova = va;
olen = len;
- off = (int)va & PGOFSET;
- va -= off;
+ off = va & PAGE_MASK;
+ va &= ~PAGE_MASK;
len = round_page(len + off);
npf = btoc(len);
s = splhigh();
- error = extent_alloc(dvmamap_extent, len, PAGE_SIZE, 0,
- canwait ? EX_WAITSPACE : 0, &tva);
+ error = extent_alloc1(dvmamap_extent, len, dvma_cachealign,
+ va & (dvma_cachealign - 1), 0,
+ canwait ? EX_WAITSPACE : 0, &tva);
splx(s);
if (error)
return NULL;