Fix ancient bug. footbridge_mem_bs_mmap should return a page number.diff -r1.15 -r1.16 src/sys/arch/arm/footbridge/footbridge_io.c
(skrll)
--- src/sys/arch/arm/footbridge/footbridge_io.c 2009/03/14 21:04:05 1.15
+++ src/sys/arch/arm/footbridge/footbridge_io.c 2009/12/15 21:38:20 1.16
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: footbridge_io.c,v 1.15 2009/03/14 21:04:05 dsl Exp $ */ | 1 | /* $NetBSD: footbridge_io.c,v 1.16 2009/12/15 21:38:20 skrll Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1997 Causality Limited | 4 | * Copyright (c) 1997 Causality Limited | |
5 | * Copyright (c) 1997 Mark Brinicombe. | 5 | * Copyright (c) 1997 Mark Brinicombe. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -29,27 +29,27 @@ | @@ -29,27 +29,27 @@ | |||
29 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 29 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
31 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 31 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
34 | * SUCH DAMAGE. | 34 | * SUCH DAMAGE. | |
35 | */ | 35 | */ | |
36 | 36 | |||
37 | /* | 37 | /* | |
38 | * bus_space I/O functions for footbridge | 38 | * bus_space I/O functions for footbridge | |
39 | */ | 39 | */ | |
40 | 40 | |||
41 | #include <sys/cdefs.h> | 41 | #include <sys/cdefs.h> | |
42 | __KERNEL_RCSID(0, "$NetBSD: footbridge_io.c,v 1.15 2009/03/14 21:04:05 dsl Exp $"); | 42 | __KERNEL_RCSID(0, "$NetBSD: footbridge_io.c,v 1.16 2009/12/15 21:38:20 skrll Exp $"); | |
43 | 43 | |||
44 | #include <sys/param.h> | 44 | #include <sys/param.h> | |
45 | #include <sys/systm.h> | 45 | #include <sys/systm.h> | |
46 | #include <machine/bus.h> | 46 | #include <machine/bus.h> | |
47 | #include <arm/footbridge/footbridge.h> | 47 | #include <arm/footbridge/footbridge.h> | |
48 | #include <arm/footbridge/dc21285mem.h> | 48 | #include <arm/footbridge/dc21285mem.h> | |
49 | #include <uvm/uvm_extern.h> | 49 | #include <uvm/uvm_extern.h> | |
50 | 50 | |||
51 | /* Proto types for all the bus_space structure functions */ | 51 | /* Proto types for all the bus_space structure functions */ | |
52 | 52 | |||
53 | bs_protos(footbridge); | 53 | bs_protos(footbridge); | |
54 | bs_protos(generic); | 54 | bs_protos(generic); | |
55 | bs_protos(generic_armv4); | 55 | bs_protos(generic_armv4); | |
@@ -308,15 +308,15 @@ paddr_t | @@ -308,15 +308,15 @@ paddr_t | |||
308 | footbridge_mem_bs_mmap(void *t, bus_addr_t addr, off_t offset, | 308 | footbridge_mem_bs_mmap(void *t, bus_addr_t addr, off_t offset, | |
309 | int prot, int flags) | 309 | int prot, int flags) | |
310 | { | 310 | { | |
311 | paddr_t pa; | 311 | paddr_t pa; | |
312 | 312 | |||
313 | if (addr >= DC21285_PCI_MEM_SIZE | 313 | if (addr >= DC21285_PCI_MEM_SIZE | |
314 | || offset < 0 | 314 | || offset < 0 | |
315 | || offset >= DC21285_PCI_MEM_SIZE | 315 | || offset >= DC21285_PCI_MEM_SIZE | |
316 | || addr >= DC21285_PCI_MEM_SIZE - offset) | 316 | || addr >= DC21285_PCI_MEM_SIZE - offset) | |
317 | return -1; | 317 | return -1; | |
318 | 318 | |||
319 | pa = DC21285_PCI_MEM_BASE + addr + offset; | 319 | pa = DC21285_PCI_MEM_BASE + addr + offset; | |
320 | 320 | |||
321 | return arm_ptob(pa); | 321 | return arm_btop(pa); | |
322 | } | 322 | } |