| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: dvma.c,v 1.37 2012/01/27 18:53:03 para Exp $ */ | | 1 | /* $NetBSD: dvma.c,v 1.38 2012/01/29 16:24:01 para Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1996 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1996 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Gordon W. Ross. | | 8 | * by Gordon W. Ross. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -20,27 +20,27 @@ | | | @@ -20,27 +20,27 @@ |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #include <sys/cdefs.h> | | 32 | #include <sys/cdefs.h> |
33 | __KERNEL_RCSID(0, "$NetBSD: dvma.c,v 1.37 2012/01/27 18:53:03 para Exp $"); | | 33 | __KERNEL_RCSID(0, "$NetBSD: dvma.c,v 1.38 2012/01/29 16:24:01 para Exp $"); |
34 | | | 34 | |
35 | #include <sys/param.h> | | 35 | #include <sys/param.h> |
36 | #include <sys/systm.h> | | 36 | #include <sys/systm.h> |
37 | #include <sys/device.h> | | 37 | #include <sys/device.h> |
38 | #include <sys/proc.h> | | 38 | #include <sys/proc.h> |
39 | #include <sys/malloc.h> | | 39 | #include <sys/malloc.h> |
40 | #include <sys/extent.h> | | 40 | #include <sys/extent.h> |
41 | #include <sys/buf.h> | | 41 | #include <sys/buf.h> |
42 | #include <sys/vnode.h> | | 42 | #include <sys/vnode.h> |
43 | #include <sys/core.h> | | 43 | #include <sys/core.h> |
44 | #include <sys/exec.h> | | 44 | #include <sys/exec.h> |
45 | | | 45 | |
46 | #include <uvm/uvm.h> /* XXX: not _extern ... need uvm_map_create */ | | 46 | #include <uvm/uvm.h> /* XXX: not _extern ... need uvm_map_create */ |
| @@ -72,31 +72,33 @@ void | | | @@ -72,31 +72,33 @@ void |
72 | dvma_init(void) | | 72 | dvma_init(void) |
73 | { | | 73 | { |
74 | vaddr_t segmap_addr; | | 74 | vaddr_t segmap_addr; |
75 | | | 75 | |
76 | /* | | 76 | /* |
77 | * Create phys_map covering the entire DVMA space, | | 77 | * Create phys_map covering the entire DVMA space, |
78 | * then allocate the segment pool from that. The | | 78 | * then allocate the segment pool from that. The |
79 | * remainder will be used as the DVMA page pool. | | 79 | * remainder will be used as the DVMA page pool. |
80 | * | | 80 | * |
81 | * Note that no INTRSAFE is needed here because the | | 81 | * Note that no INTRSAFE is needed here because the |
82 | * dvma_extent manages things handled in interrupt | | 82 | * dvma_extent manages things handled in interrupt |
83 | * context. | | 83 | * context. |
84 | */ | | 84 | */ |
85 | phys_map = uvm_map_create(pmap_kernel(), | | 85 | phys_map = kmem_alloc(sizeof(struct vm_map), KM_SLEEP); |
86 | DVMA_MAP_BASE, DVMA_MAP_END, 0); | | | |
87 | if (phys_map == NULL) | | 86 | if (phys_map == NULL) |
88 | panic("unable to create DVMA map"); | | 87 | panic("unable to create DVMA map"); |
89 | | | 88 | |
| | | 89 | uvm_map_setup(phys_map, DVMA_MAP_BASE, DVMA_MAP_END, 0); |
| | | 90 | phys_map->pmap = pmap_kernel(); |
| | | 91 | |
90 | /* | | 92 | /* |
91 | * Reserve the DVMA space used for segment remapping. | | 93 | * Reserve the DVMA space used for segment remapping. |
92 | * The remainder of phys_map is used for DVMA scratch | | 94 | * The remainder of phys_map is used for DVMA scratch |
93 | * memory pages (i.e. driver control blocks, etc.) | | 95 | * memory pages (i.e. driver control blocks, etc.) |
94 | */ | | 96 | */ |
95 | segmap_addr = uvm_km_alloc(phys_map, dvma_segmap_size, 0, | | 97 | segmap_addr = uvm_km_alloc(phys_map, dvma_segmap_size, 0, |
96 | UVM_KMF_VAONLY | UVM_KMF_WAITVA); | | 98 | UVM_KMF_VAONLY | UVM_KMF_WAITVA); |
97 | if (segmap_addr != DVMA_MAP_BASE) | | 99 | if (segmap_addr != DVMA_MAP_BASE) |
98 | panic("dvma_init: unable to allocate DVMA segments"); | | 100 | panic("dvma_init: unable to allocate DVMA segments"); |
99 | | | 101 | |
100 | /* | | 102 | /* |
101 | * Create the VM pool used for mapping whole segments | | 103 | * Create the VM pool used for mapping whole segments |
102 | * into DVMA space for the purpose of data transfer. | | 104 | * into DVMA space for the purpose of data transfer. |