From 0fbcabef5ce906c093fbcc63a759fe4ff9e8721b Mon Sep 17 00:00:00 2001 From: uwe Date: Wed, 18 Jul 2007 09:47:49 +0000 Subject: [PATCH] Implement footbridge_mem_bs_mmap. Needed for mmaping igsfb(4) framebuffer on netwinder. --- sys/arch/arm/footbridge/footbridge_io.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/sys/arch/arm/footbridge/footbridge_io.c b/sys/arch/arm/footbridge/footbridge_io.c index a6c4604fcb29..157cc0308e0e 100644 --- a/sys/arch/arm/footbridge/footbridge_io.c +++ b/sys/arch/arm/footbridge/footbridge_io.c @@ -1,4 +1,4 @@ -/* $NetBSD: footbridge_io.c,v 1.12 2005/11/24 13:08:32 yamt Exp $ */ +/* $NetBSD: footbridge_io.c,v 1.13 2007/07/18 09:47:49 uwe Exp $ */ /* * Copyright (c) 1997 Causality Limited @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: footbridge_io.c,v 1.12 2005/11/24 13:08:32 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: footbridge_io.c,v 1.13 2007/07/18 09:47:49 uwe Exp $"); #include #include @@ -56,6 +56,7 @@ bs_protos(generic_armv4); bs_protos(bs_notimpl); bs_map_proto(footbridge_mem); bs_unmap_proto(footbridge_mem); +bs_mmap_proto(footbridge_mem); /* Declare the footbridge bus space tag */ @@ -151,6 +152,7 @@ void footbridge_create_mem_bs_tag(t, cookie) *t = footbridge_bs_tag; t->bs_map = footbridge_mem_bs_map; t->bs_unmap = footbridge_mem_bs_unmap; + t->bs_mmap = footbridge_mem_bs_mmap; t->bs_cookie = cookie; } @@ -329,3 +331,21 @@ footbridge_bs_barrier(t, bsh, offset, len, flags) int flags; { } + + +paddr_t +footbridge_mem_bs_mmap(void *t, bus_addr_t addr, off_t offset, + int prot, int flags) +{ + paddr_t pa; + + if (addr >= DC21285_PCI_MEM_SIZE + || offset < 0 + || offset >= DC21285_PCI_MEM_SIZE + || addr >= DC21285_PCI_MEM_SIZE - offset) + return -1; + + pa = DC21285_PCI_MEM_BASE + addr + offset; + + return arm_ptob(pa); +}