| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: xmd_machdep.c,v 1.1.2.1 2010/08/19 12:36:58 uebayasi Exp $ */ | | 1 | /* $NetBSD: xmd_machdep.c,v 1.1.2.2 2010/08/25 14:32:54 uebayasi Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2010 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2010 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -16,54 +16,61 @@ | | | @@ -16,54 +16,61 @@ |
16 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | | 16 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
26 | * POSSIBILITY OF SUCH DAMAGE. | | 26 | * POSSIBILITY OF SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
| | | 29 | #include <sys/cdefs.h> |
| | | 30 | __KERNEL_RCSID(0, "$NetBSD: xmd_machdep.c,v 1.1.2.2 2010/08/25 14:32:54 uebayasi Exp $"); |
| | | 31 | |
29 | #include "opt_xip.h" | | 32 | #include "opt_xip.h" |
30 | | | 33 | |
| | | 34 | #ifndef XIP |
| | | 35 | #error xmd(4) needs options XIP |
| | | 36 | #endif |
| | | 37 | |
31 | #include <sys/param.h> | | 38 | #include <sys/param.h> |
32 | #include <sys/mman.h> | | 39 | #include <sys/mman.h> |
33 | | | 40 | |
34 | #include <uvm/uvm_page.h> | | 41 | #include <uvm/uvm_page.h> |
35 | | | 42 | |
36 | #include <dev/xmdvar.h> | | 43 | #include <dev/xmdvar.h> |
37 | | | 44 | |
38 | paddr_t | | 45 | paddr_t |
39 | xmd_machdep_mmap(vaddr_t addr, off_t off, int prot) | | 46 | xmd_machdep_mmap(vaddr_t addr, off_t off, int prot) |
40 | { | | 47 | { |
41 | | | 48 | |
42 | /* addr is in PA == VA RAM area. */ | | 49 | /* addr is in PA == VA RAM area. */ |
43 | KASSERT(addr >= 0x00000000); | | 50 | KASSERT(addr >= 0x00000000); |
44 | KASSERT(addr < 0x80000000); | | 51 | KASSERT(addr < 0x80000000); |
45 | | | 52 | |
46 | return addr; | | 53 | return addr; |
47 | } | | 54 | } |
48 | | | 55 | |
49 | void * | | 56 | void * |
50 | xmd_machdep_physload(vaddr_t addr, size_t size) | | 57 | xmd_machdep_physload(vaddr_t addr, size_t size) |
51 | { | | 58 | { |
52 | paddr_t s, e, as, ae; | | 59 | paddr_t start, end; |
53 | | | 60 | |
54 | /* addr is in PA == VA RAM area. */ | | 61 | /* addr is in PA == VA RAM area. */ |
55 | KASSERT(addr >= 0x00000000); | | 62 | KASSERT(addr >= 0x00000000); |
56 | KASSERT(addr < 0x80000000); | | 63 | KASSERT(addr < 0x80000000); |
57 | | | 64 | |
58 | s = as = (addr) >> PAGE_SHIFT; | | 65 | start = (addr) >> PAGE_SHIFT; |
59 | e = ae = (addr + size) >> PAGE_SHIFT; | | 66 | end = (addr + size) >> PAGE_SHIFT; |
60 | | | 67 | |
61 | return uvm_page_physload_device(s, e, as, ae, PROT_READ, 0); | | 68 | return uvm_page_physload_device(start, end, start, end, PROT_READ, 0); |
62 | } | | 69 | } |
63 | | | 70 | |
64 | void | | 71 | void |
65 | xmd_machdep_physunload(void *phys) | | 72 | xmd_machdep_physunload(void *phys) |
66 | { | | 73 | { |
67 | | | 74 | |
68 | uvm_page_physunload_device(phys); | | 75 | uvm_page_physunload_device(phys); |
69 | } | | 76 | } |