Fri Apr 21 14:57:52 2023 UTC ()
Trailing whitespace


(skrll)
diff -r1.7 -r1.8 src/sys/arch/iyonix/iyonix/obio_space.c

cvs diff -r1.7 -r1.8 src/sys/arch/iyonix/iyonix/obio_space.c (expand / switch to unified diff)

--- src/sys/arch/iyonix/iyonix/obio_space.c 2018/03/16 17:56:33 1.7
+++ src/sys/arch/iyonix/iyonix/obio_space.c 2023/04/21 14:57:52 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: obio_space.c,v 1.7 2018/03/16 17:56:33 ryo Exp $ */ 1/* $NetBSD: obio_space.c,v 1.8 2023/04/21 14:57:52 skrll Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001, 2002, 2003 Wasabi Systems, Inc. 4 * Copyright (c) 2001, 2002, 2003 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 7 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -30,27 +30,27 @@ @@ -30,27 +30,27 @@
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE. 35 * POSSIBILITY OF SUCH DAMAGE.
36 */ 36 */
37 37
38/* 38/*
39 * bus_space functions for Tungsten on-board devices 39 * bus_space functions for Tungsten on-board devices
40 */ 40 */
41 41
42#include <sys/cdefs.h> 42#include <sys/cdefs.h>
43__KERNEL_RCSID(0, "$NetBSD: obio_space.c,v 1.7 2018/03/16 17:56:33 ryo Exp $"); 43__KERNEL_RCSID(0, "$NetBSD: obio_space.c,v 1.8 2023/04/21 14:57:52 skrll Exp $");
44 44
45#include <sys/param.h> 45#include <sys/param.h>
46#include <sys/systm.h> 46#include <sys/systm.h>
47 47
48#include <uvm/uvm_extern.h> 48#include <uvm/uvm_extern.h>
49 49
50#include <sys/bus.h> 50#include <sys/bus.h>
51 51
52/* Prototypes for all the bus_space structure functions */ 52/* Prototypes for all the bus_space structure functions */
53bs_protos(obio); 53bs_protos(obio);
54bs_protos(generic); 54bs_protos(generic);
55bs_protos(generic_armv4); 55bs_protos(generic_armv4);
56bs_protos(bs_notimpl); 56bs_protos(bs_notimpl);
@@ -143,27 +143,27 @@ obio_bs_map(void *t, bus_addr_t bpa, bus @@ -143,27 +143,27 @@ obio_bs_map(void *t, bus_addr_t bpa, bus
143 const struct pmap_devmap *pd; 143 const struct pmap_devmap *pd;
144 paddr_t startpa, endpa, pa, offset; 144 paddr_t startpa, endpa, pa, offset;
145 vaddr_t va; 145 vaddr_t va;
146 146
147 if ((pd = pmap_devmap_find_pa(bpa, size)) != NULL) { 147 if ((pd = pmap_devmap_find_pa(bpa, size)) != NULL) {
148 /* Device was statically mapped. */ 148 /* Device was statically mapped. */
149 *bshp = pd->pd_va + (bpa - pd->pd_pa); 149 *bshp = pd->pd_va + (bpa - pd->pd_pa);
150 return (0); 150 return (0);
151 } 151 }
152 152
153 endpa = round_page(bpa + size); 153 endpa = round_page(bpa + size);
154 offset = bpa & PAGE_MASK; 154 offset = bpa & PAGE_MASK;
155 startpa = trunc_page(bpa); 155 startpa = trunc_page(bpa);
156  156
157 va = uvm_km_alloc(kernel_map, endpa - startpa, 0, 157 va = uvm_km_alloc(kernel_map, endpa - startpa, 0,
158 UVM_KMF_VAONLY | UVM_KMF_NOWAIT); 158 UVM_KMF_VAONLY | UVM_KMF_NOWAIT);
159 if (va == 0) 159 if (va == 0)
160 return (ENOMEM); 160 return (ENOMEM);
161 161
162 *bshp = va + offset; 162 *bshp = va + offset;
163 163
164 const int pmapflags = 164 const int pmapflags =
165 (flag & (BUS_SPACE_MAP_CACHEABLE|BUS_SPACE_MAP_PREFETCHABLE)) 165 (flag & (BUS_SPACE_MAP_CACHEABLE|BUS_SPACE_MAP_PREFETCHABLE))
166 ? 0 166 ? 0
167 : PMAP_NOCACHE; 167 : PMAP_NOCACHE;
168 168
169 for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) { 169 for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
@@ -191,27 +191,27 @@ obio_bs_unmap(void *t, bus_space_handle_ @@ -191,27 +191,27 @@ obio_bs_unmap(void *t, bus_space_handle_
191 191
192 if (pmap_devmap_find_va(bsh, size) != NULL) { 192 if (pmap_devmap_find_va(bsh, size) != NULL) {
193 /* Device was statically mapped; nothing to do. */ 193 /* Device was statically mapped; nothing to do. */
194 return; 194 return;
195 } 195 }
196 196
197 endva = round_page(bsh + size); 197 endva = round_page(bsh + size);
198 va = trunc_page(bsh); 198 va = trunc_page(bsh);
199 199
200 pmap_kremove(va, endva - va); 200 pmap_kremove(va, endva - va);
201 uvm_km_free(kernel_map, va, endva - va, UVM_KMF_VAONLY); 201 uvm_km_free(kernel_map, va, endva - va, UVM_KMF_VAONLY);
202} 202}
203 203
204void  204void
205obio_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size) 205obio_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size)
206{ 206{
207 207
208 panic("obio_bs_free(): not implemented"); 208 panic("obio_bs_free(): not implemented");
209} 209}
210 210
211int 211int
212obio_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset, 212obio_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset,
213 bus_size_t size, bus_space_handle_t *nbshp) 213 bus_size_t size, bus_space_handle_t *nbshp)
214{ 214{
215 215
216 *nbshp = bsh + offset; 216 *nbshp = bsh + offset;
217 return (0); 217 return (0);