1 1.13 skrll /* $NetBSD: armv7_generic_space.c,v 1.13 2020/10/30 18:54:36 skrll Exp $ */ 2 1.1 jmcneill 3 1.1 jmcneill /*- 4 1.1 jmcneill * Copyright (c) 2012 The NetBSD Foundation, Inc. 5 1.1 jmcneill * All rights reserved. 6 1.1 jmcneill * 7 1.1 jmcneill * This code is derived from software contributed to The NetBSD Foundation 8 1.1 jmcneill * by Nick Hudson 9 1.1 jmcneill * 10 1.1 jmcneill * Redistribution and use in source and binary forms, with or without 11 1.1 jmcneill * modification, are permitted provided that the following conditions 12 1.1 jmcneill * are met: 13 1.1 jmcneill * 1. Redistributions of source code must retain the above copyright 14 1.1 jmcneill * notice, this list of conditions and the following disclaimer. 15 1.1 jmcneill * 2. Redistributions in binary form must reproduce the above copyright 16 1.1 jmcneill * notice, this list of conditions and the following disclaimer in the 17 1.1 jmcneill * documentation and/or other materials provided with the distribution. 18 1.1 jmcneill * 19 1.1 jmcneill * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20 1.1 jmcneill * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 1.1 jmcneill * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 1.1 jmcneill * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23 1.1 jmcneill * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 1.1 jmcneill * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 1.1 jmcneill * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 1.1 jmcneill * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 1.1 jmcneill * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 1.1 jmcneill * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 1.1 jmcneill * POSSIBILITY OF SUCH DAMAGE. 30 1.1 jmcneill */ 31 1.1 jmcneill 32 1.1 jmcneill 33 1.1 jmcneill #include <sys/cdefs.h> 34 1.13 skrll __KERNEL_RCSID(0, "$NetBSD: armv7_generic_space.c,v 1.13 2020/10/30 18:54:36 skrll Exp $"); 35 1.1 jmcneill 36 1.1 jmcneill #include <sys/param.h> 37 1.12 skrll 38 1.12 skrll #include <sys/bus.h> 39 1.1 jmcneill #include <sys/systm.h> 40 1.1 jmcneill 41 1.1 jmcneill #include <uvm/uvm_extern.h> 42 1.1 jmcneill 43 1.1 jmcneill /* Prototypes for all the bus_space structure functions */ 44 1.1 jmcneill bs_protos(armv7_generic); 45 1.1 jmcneill bs_protos(armv7_generic_a4x); 46 1.1 jmcneill bs_protos(a4x); 47 1.1 jmcneill bs_protos(bs_notimpl); 48 1.1 jmcneill bs_protos(generic); 49 1.1 jmcneill bs_protos(generic_armv4); 50 1.1 jmcneill 51 1.1 jmcneill #if __ARMEB__ 52 1.1 jmcneill #define NSWAP(n) n ## _swap 53 1.1 jmcneill #else 54 1.1 jmcneill #define NSWAP(n) n 55 1.1 jmcneill #endif 56 1.1 jmcneill 57 1.8 ryo __strong_alias(arm_generic_bs_tag,armv7_generic_bs_tag); 58 1.8 ryo __strong_alias(arm_generic_a4x_bs_tag,armv7_generic_a4x_bs_tag); 59 1.8 ryo 60 1.1 jmcneill struct bus_space armv7_generic_bs_tag = { 61 1.1 jmcneill /* cookie */ 62 1.7 ryo .bs_cookie = (void *) 0, 63 1.1 jmcneill 64 1.1 jmcneill /* mapping/unmapping */ 65 1.7 ryo .bs_map = armv7_generic_bs_map, 66 1.7 ryo .bs_unmap = armv7_generic_bs_unmap, 67 1.7 ryo .bs_subregion = armv7_generic_bs_subregion, 68 1.1 jmcneill 69 1.1 jmcneill /* allocation/deallocation */ 70 1.7 ryo .bs_alloc = armv7_generic_bs_alloc, /* not implemented */ 71 1.7 ryo .bs_free = armv7_generic_bs_free, /* not implemented */ 72 1.1 jmcneill 73 1.1 jmcneill /* get kernel virtual address */ 74 1.7 ryo .bs_vaddr = armv7_generic_bs_vaddr, 75 1.1 jmcneill 76 1.1 jmcneill /* mmap */ 77 1.7 ryo .bs_mmap = armv7_generic_bs_mmap, 78 1.1 jmcneill 79 1.1 jmcneill /* barrier */ 80 1.7 ryo .bs_barrier = armv7_generic_bs_barrier, 81 1.1 jmcneill 82 1.1 jmcneill /* read (single) */ 83 1.7 ryo .bs_r_1 = generic_bs_r_1, 84 1.7 ryo .bs_r_2 = NSWAP(generic_armv4_bs_r_2), 85 1.7 ryo .bs_r_4 = NSWAP(generic_bs_r_4), 86 1.7 ryo .bs_r_8 = bs_notimpl_bs_r_8, 87 1.1 jmcneill 88 1.1 jmcneill /* read multiple */ 89 1.7 ryo .bs_rm_1 = generic_bs_rm_1, 90 1.7 ryo .bs_rm_2 = NSWAP(generic_armv4_bs_rm_2), 91 1.7 ryo .bs_rm_4 = NSWAP(generic_bs_rm_4), 92 1.7 ryo .bs_rm_8 = bs_notimpl_bs_rm_8, 93 1.1 jmcneill 94 1.1 jmcneill /* read region */ 95 1.7 ryo .bs_rr_1 = generic_bs_rr_1, 96 1.7 ryo .bs_rr_2 = NSWAP(generic_armv4_bs_rr_2), 97 1.7 ryo .bs_rr_4 = NSWAP(generic_bs_rr_4), 98 1.7 ryo .bs_rr_8 = bs_notimpl_bs_rr_8, 99 1.1 jmcneill 100 1.1 jmcneill /* write (single) */ 101 1.7 ryo .bs_w_1 = generic_bs_w_1, 102 1.7 ryo .bs_w_2 = NSWAP(generic_armv4_bs_w_2), 103 1.7 ryo .bs_w_4 = NSWAP(generic_bs_w_4), 104 1.7 ryo .bs_w_8 = bs_notimpl_bs_w_8, 105 1.1 jmcneill 106 1.1 jmcneill /* write multiple */ 107 1.7 ryo .bs_wm_1 = generic_bs_wm_1, 108 1.7 ryo .bs_wm_2 = NSWAP(generic_armv4_bs_wm_2), 109 1.7 ryo .bs_wm_4 = NSWAP(generic_bs_wm_4), 110 1.7 ryo .bs_wm_8 = bs_notimpl_bs_wm_8, 111 1.1 jmcneill 112 1.1 jmcneill /* write region */ 113 1.7 ryo .bs_wr_1 = generic_bs_wr_1, 114 1.7 ryo .bs_wr_2 = NSWAP(generic_armv4_bs_wr_2), 115 1.7 ryo .bs_wr_4 = NSWAP(generic_bs_wr_4), 116 1.7 ryo .bs_wr_8 = bs_notimpl_bs_wr_8, 117 1.1 jmcneill 118 1.1 jmcneill /* set multiple */ 119 1.7 ryo .bs_sm_1 = bs_notimpl_bs_sm_1, 120 1.7 ryo .bs_sm_2 = bs_notimpl_bs_sm_2, 121 1.7 ryo .bs_sm_4 = bs_notimpl_bs_sm_4, 122 1.7 ryo .bs_sm_8 = bs_notimpl_bs_sm_8, 123 1.1 jmcneill 124 1.1 jmcneill /* set region */ 125 1.7 ryo .bs_sr_1 = generic_bs_sr_1, 126 1.7 ryo .bs_sr_2 = NSWAP(generic_armv4_bs_sr_2), 127 1.7 ryo .bs_sr_4 = NSWAP(generic_bs_sr_4), 128 1.7 ryo .bs_sr_8 = bs_notimpl_bs_sr_8, 129 1.1 jmcneill 130 1.1 jmcneill /* copy */ 131 1.7 ryo .bs_c_1 = bs_notimpl_bs_c_1, 132 1.7 ryo .bs_c_2 = generic_armv4_bs_c_2, 133 1.7 ryo .bs_c_4 = bs_notimpl_bs_c_4, 134 1.7 ryo .bs_c_8 = bs_notimpl_bs_c_8, 135 1.1 jmcneill 136 1.1 jmcneill #ifdef __BUS_SPACE_HAS_STREAM_METHODS 137 1.1 jmcneill /* read (single) */ 138 1.7 ryo .bs_r_1_s = generic_bs_r_1, 139 1.7 ryo .bs_r_2_s = NSWAP(generic_armv4_bs_r_2), 140 1.7 ryo .bs_r_4_s = NSWAP(generic_bs_r_4), 141 1.7 ryo .bs_r_8_s = bs_notimpl_bs_r_8, 142 1.1 jmcneill 143 1.1 jmcneill /* read multiple */ 144 1.7 ryo .bs_rm_1_s = generic_bs_rm_1, 145 1.7 ryo .bs_rm_2_s = NSWAP(generic_armv4_bs_rm_2), 146 1.7 ryo .bs_rm_4_s = NSWAP(generic_bs_rm_4), 147 1.7 ryo .bs_rm_8_s = bs_notimpl_bs_rm_8, 148 1.1 jmcneill 149 1.1 jmcneill /* read region */ 150 1.7 ryo .bs_rr_1_s = generic_bs_rr_1, 151 1.7 ryo .bs_rr_2_s = NSWAP(generic_armv4_bs_rr_2), 152 1.7 ryo .bs_rr_4_s = NSWAP(generic_bs_rr_4), 153 1.7 ryo .bs_rr_8_s = bs_notimpl_bs_rr_8, 154 1.1 jmcneill 155 1.1 jmcneill /* write (single) */ 156 1.7 ryo .bs_w_1_s = generic_bs_w_1, 157 1.7 ryo .bs_w_2_s = NSWAP(generic_armv4_bs_w_2), 158 1.7 ryo .bs_w_4_s = NSWAP(generic_bs_w_4), 159 1.7 ryo .bs_w_8_s = bs_notimpl_bs_w_8, 160 1.1 jmcneill 161 1.1 jmcneill /* write multiple */ 162 1.7 ryo .bs_wm_1_s = generic_bs_wm_1, 163 1.7 ryo .bs_wm_2_s = NSWAP(generic_armv4_bs_wm_2), 164 1.7 ryo .bs_wm_4_s = NSWAP(generic_bs_wm_4), 165 1.7 ryo .bs_wm_8_s = bs_notimpl_bs_wm_8, 166 1.1 jmcneill 167 1.1 jmcneill /* write region */ 168 1.7 ryo .bs_wr_1_s = generic_bs_wr_1, 169 1.7 ryo .bs_wr_2_s = NSWAP(generic_armv4_bs_wr_2), 170 1.7 ryo .bs_wr_4_s = NSWAP(generic_bs_wr_4), 171 1.7 ryo .bs_wr_8_s = bs_notimpl_bs_wr_8, 172 1.1 jmcneill #endif 173 1.1 jmcneill }; 174 1.1 jmcneill 175 1.1 jmcneill struct bus_space armv7_generic_a4x_bs_tag = { 176 1.1 jmcneill /* cookie */ 177 1.7 ryo .bs_cookie = (void *) 0, 178 1.1 jmcneill 179 1.1 jmcneill /* mapping/unmapping */ 180 1.7 ryo .bs_map = armv7_generic_bs_map, 181 1.7 ryo .bs_unmap = armv7_generic_bs_unmap, 182 1.7 ryo .bs_subregion = armv7_generic_a4x_bs_subregion, 183 1.1 jmcneill 184 1.1 jmcneill /* allocation/deallocation */ 185 1.7 ryo .bs_alloc = armv7_generic_bs_alloc, /* not implemented */ 186 1.7 ryo .bs_free = armv7_generic_bs_free, /* not implemented */ 187 1.1 jmcneill 188 1.1 jmcneill /* get kernel virtual address */ 189 1.7 ryo .bs_vaddr = armv7_generic_bs_vaddr, 190 1.1 jmcneill 191 1.1 jmcneill /* mmap */ 192 1.7 ryo .bs_mmap = armv7_generic_a4x_bs_mmap, 193 1.1 jmcneill 194 1.1 jmcneill /* barrier */ 195 1.7 ryo .bs_barrier = armv7_generic_bs_barrier, 196 1.1 jmcneill 197 1.1 jmcneill /* read (single) */ 198 1.7 ryo .bs_r_1 = a4x_bs_r_1, 199 1.7 ryo .bs_r_2 = NSWAP(a4x_bs_r_2), 200 1.7 ryo .bs_r_4 = NSWAP(a4x_bs_r_4), 201 1.7 ryo .bs_r_8 = bs_notimpl_bs_r_8, 202 1.1 jmcneill 203 1.1 jmcneill /* read multiple */ 204 1.7 ryo .bs_rm_1 = a4x_bs_rm_1, 205 1.7 ryo .bs_rm_2 = NSWAP(a4x_bs_rm_2), 206 1.7 ryo .bs_rm_4 = NSWAP(a4x_bs_rm_4), 207 1.7 ryo .bs_rm_8 = bs_notimpl_bs_rm_8, 208 1.1 jmcneill 209 1.1 jmcneill /* read region */ 210 1.7 ryo .bs_rr_1 = bs_notimpl_bs_rr_1, 211 1.7 ryo .bs_rr_2 = bs_notimpl_bs_rr_2, 212 1.7 ryo .bs_rr_4 = bs_notimpl_bs_rr_4, 213 1.7 ryo .bs_rr_8 = bs_notimpl_bs_rr_8, 214 1.1 jmcneill 215 1.1 jmcneill /* write (single) */ 216 1.7 ryo .bs_w_1 = a4x_bs_w_1, 217 1.7 ryo .bs_w_2 = NSWAP(a4x_bs_w_2), 218 1.7 ryo .bs_w_4 = NSWAP(a4x_bs_w_4), 219 1.7 ryo .bs_w_8 = bs_notimpl_bs_w_8, 220 1.1 jmcneill 221 1.1 jmcneill /* write multiple */ 222 1.7 ryo .bs_wm_1 = a4x_bs_wm_1, 223 1.7 ryo .bs_wm_2 = NSWAP(a4x_bs_wm_2), 224 1.7 ryo .bs_wm_4 = NSWAP(a4x_bs_wm_4), 225 1.7 ryo .bs_wm_8 = bs_notimpl_bs_wm_8, 226 1.1 jmcneill 227 1.1 jmcneill /* write region */ 228 1.7 ryo .bs_wr_1 = bs_notimpl_bs_wr_1, 229 1.7 ryo .bs_wr_2 = bs_notimpl_bs_wr_2, 230 1.7 ryo .bs_wr_4 = bs_notimpl_bs_wr_4, 231 1.7 ryo .bs_wr_8 = bs_notimpl_bs_wr_8, 232 1.1 jmcneill 233 1.1 jmcneill /* set multiple */ 234 1.7 ryo .bs_sm_1 = bs_notimpl_bs_sm_1, 235 1.7 ryo .bs_sm_2 = bs_notimpl_bs_sm_2, 236 1.7 ryo .bs_sm_4 = bs_notimpl_bs_sm_4, 237 1.7 ryo .bs_sm_8 = bs_notimpl_bs_sm_8, 238 1.1 jmcneill 239 1.1 jmcneill /* set region */ 240 1.7 ryo .bs_sr_1 = bs_notimpl_bs_sr_1, 241 1.7 ryo .bs_sr_2 = bs_notimpl_bs_sr_2, 242 1.7 ryo .bs_sr_4 = bs_notimpl_bs_sr_4, 243 1.7 ryo .bs_sr_8 = bs_notimpl_bs_sr_8, 244 1.1 jmcneill 245 1.1 jmcneill /* copy */ 246 1.7 ryo .bs_c_1 = bs_notimpl_bs_c_1, 247 1.7 ryo .bs_c_2 = bs_notimpl_bs_c_2, 248 1.7 ryo .bs_c_4 = bs_notimpl_bs_c_4, 249 1.7 ryo .bs_c_8 = bs_notimpl_bs_c_8, 250 1.1 jmcneill 251 1.1 jmcneill #ifdef __BUS_SPACE_HAS_STREAM_METHODS 252 1.1 jmcneill /* read (single) */ 253 1.7 ryo .bs_r_1_s = a4x_bs_r_1, 254 1.7 ryo .bs_r_2_s = NSWAP(a4x_bs_r_2), 255 1.7 ryo .bs_r_4_s = NSWAP(a4x_bs_r_4), 256 1.7 ryo .bs_r_8_s = bs_notimpl_bs_r_8, 257 1.1 jmcneill 258 1.1 jmcneill /* read multiple */ 259 1.7 ryo .bs_rm_1_s = a4x_bs_rm_1, 260 1.7 ryo .bs_rm_2_s = NSWAP(a4x_bs_rm_2), 261 1.7 ryo .bs_rm_4_s = NSWAP(a4x_bs_rm_4), 262 1.7 ryo .bs_rm_8_s = bs_notimpl_bs_rm_8, 263 1.1 jmcneill 264 1.1 jmcneill /* read region */ 265 1.7 ryo .bs_rr_1_s = bs_notimpl_bs_rr_1, 266 1.7 ryo .bs_rr_2_s = bs_notimpl_bs_rr_2, 267 1.7 ryo .bs_rr_4_s = bs_notimpl_bs_rr_4, 268 1.7 ryo .bs_rr_8_s = bs_notimpl_bs_rr_8, 269 1.1 jmcneill 270 1.1 jmcneill /* write (single) */ 271 1.7 ryo .bs_w_1_s = a4x_bs_w_1, 272 1.7 ryo .bs_w_2_s = NSWAP(a4x_bs_w_2), 273 1.7 ryo .bs_w_4_s = NSWAP(a4x_bs_w_4), 274 1.7 ryo .bs_w_8_s = bs_notimpl_bs_w_8, 275 1.1 jmcneill 276 1.1 jmcneill /* write multiple */ 277 1.7 ryo .bs_wm_1_s = a4x_bs_wm_1, 278 1.7 ryo .bs_wm_2_s = NSWAP(a4x_bs_wm_2), 279 1.7 ryo .bs_wm_4_s = NSWAP(a4x_bs_wm_4), 280 1.7 ryo .bs_wm_8_s = bs_notimpl_bs_wm_8, 281 1.1 jmcneill 282 1.1 jmcneill /* write region */ 283 1.7 ryo .bs_wr_1_s = bs_notimpl_bs_wr_1, 284 1.7 ryo .bs_wr_2_s = bs_notimpl_bs_wr_2, 285 1.7 ryo .bs_wr_4_s = bs_notimpl_bs_wr_4, 286 1.7 ryo .bs_wr_8_s = bs_notimpl_bs_wr_8, 287 1.1 jmcneill #endif 288 1.1 jmcneill }; 289 1.1 jmcneill 290 1.1 jmcneill int 291 1.1 jmcneill armv7_generic_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flag, 292 1.1 jmcneill bus_space_handle_t *bshp) 293 1.1 jmcneill { 294 1.1 jmcneill u_long startpa, endpa, pa; 295 1.1 jmcneill const struct pmap_devmap *pd; 296 1.6 skrll int pmapflags; 297 1.1 jmcneill vaddr_t va; 298 1.1 jmcneill 299 1.1 jmcneill if ((pd = pmap_devmap_find_pa(bpa, size)) != NULL) { 300 1.1 jmcneill /* Device was statically mapped. */ 301 1.1 jmcneill *bshp = pd->pd_va + (bpa - pd->pd_pa); 302 1.1 jmcneill return 0; 303 1.1 jmcneill } 304 1.1 jmcneill 305 1.1 jmcneill startpa = trunc_page(bpa); 306 1.1 jmcneill endpa = round_page(bpa + size); 307 1.1 jmcneill 308 1.1 jmcneill /* XXX use extent manager to check duplicate mapping */ 309 1.1 jmcneill 310 1.1 jmcneill va = uvm_km_alloc(kernel_map, endpa - startpa, 0, 311 1.1 jmcneill UVM_KMF_VAONLY | UVM_KMF_NOWAIT | UVM_KMF_COLORMATCH); 312 1.1 jmcneill if (!va) 313 1.1 jmcneill return ENOMEM; 314 1.1 jmcneill 315 1.1 jmcneill *bshp = (bus_space_handle_t)(va + (bpa - startpa)); 316 1.1 jmcneill 317 1.6 skrll if (flag & BUS_SPACE_MAP_PREFETCHABLE) 318 1.6 skrll pmapflags = PMAP_WRITE_COMBINE; 319 1.6 skrll else if (flag & BUS_SPACE_MAP_CACHEABLE) 320 1.6 skrll pmapflags = 0; 321 1.6 skrll else 322 1.11 skrll pmapflags = PMAP_DEV; 323 1.6 skrll 324 1.1 jmcneill for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) { 325 1.1 jmcneill pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE, pmapflags); 326 1.1 jmcneill } 327 1.1 jmcneill pmap_update(pmap_kernel()); 328 1.1 jmcneill 329 1.1 jmcneill return 0; 330 1.1 jmcneill } 331 1.1 jmcneill 332 1.1 jmcneill void 333 1.1 jmcneill armv7_generic_bs_unmap(void *t, bus_space_handle_t bsh, bus_size_t size) 334 1.1 jmcneill { 335 1.1 jmcneill vaddr_t va; 336 1.1 jmcneill vsize_t sz; 337 1.1 jmcneill 338 1.1 jmcneill if (pmap_devmap_find_va(bsh, size) != NULL) { 339 1.1 jmcneill /* Device was statically mapped; nothing to do. */ 340 1.1 jmcneill return; 341 1.1 jmcneill } 342 1.1 jmcneill 343 1.1 jmcneill va = trunc_page(bsh); 344 1.1 jmcneill sz = round_page(bsh + size) - va; 345 1.1 jmcneill 346 1.1 jmcneill pmap_kremove(va, sz); 347 1.1 jmcneill pmap_update(pmap_kernel()); 348 1.1 jmcneill uvm_km_free(kernel_map, va, sz, UVM_KMF_VAONLY); 349 1.1 jmcneill } 350 1.1 jmcneill 351 1.1 jmcneill 352 1.1 jmcneill int 353 1.1 jmcneill armv7_generic_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset, 354 1.1 jmcneill bus_size_t size, bus_space_handle_t *nbshp) 355 1.1 jmcneill { 356 1.1 jmcneill 357 1.1 jmcneill *nbshp = bsh + offset; 358 1.4 skrll return 0; 359 1.1 jmcneill } 360 1.1 jmcneill 361 1.1 jmcneill int 362 1.1 jmcneill armv7_generic_a4x_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset, 363 1.1 jmcneill bus_size_t size, bus_space_handle_t *nbshp) 364 1.1 jmcneill { 365 1.1 jmcneill 366 1.1 jmcneill *nbshp = bsh + 4 * offset; 367 1.4 skrll return 0; 368 1.1 jmcneill } 369 1.1 jmcneill 370 1.1 jmcneill void 371 1.1 jmcneill armv7_generic_bs_barrier(void *t, bus_space_handle_t bsh, bus_size_t offset, 372 1.1 jmcneill bus_size_t len, int flags) 373 1.1 jmcneill { 374 1.1 jmcneill flags &= BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE; 375 1.5 skrll 376 1.1 jmcneill if (flags) 377 1.13 skrll dsb(sy); 378 1.1 jmcneill } 379 1.1 jmcneill 380 1.1 jmcneill void * 381 1.1 jmcneill armv7_generic_bs_vaddr(void *t, bus_space_handle_t bsh) 382 1.1 jmcneill { 383 1.1 jmcneill 384 1.1 jmcneill return (void *)bsh; 385 1.1 jmcneill } 386 1.1 jmcneill 387 1.1 jmcneill paddr_t 388 1.1 jmcneill armv7_generic_bs_mmap(void *t, bus_addr_t bpa, off_t offset, int prot, int flags) 389 1.1 jmcneill { 390 1.1 jmcneill paddr_t bus_flags = 0; 391 1.1 jmcneill 392 1.1 jmcneill if (flags & BUS_SPACE_MAP_PREFETCHABLE) 393 1.1 jmcneill bus_flags |= ARM32_MMAP_WRITECOMBINE; 394 1.1 jmcneill 395 1.4 skrll return arm_btop(bpa + offset) | bus_flags; 396 1.1 jmcneill } 397 1.1 jmcneill 398 1.1 jmcneill paddr_t 399 1.1 jmcneill armv7_generic_a4x_bs_mmap(void *t, bus_addr_t bpa, off_t offset, int prot, int flags) 400 1.1 jmcneill { 401 1.1 jmcneill paddr_t bus_flags = 0; 402 1.1 jmcneill 403 1.1 jmcneill if (flags & BUS_SPACE_MAP_PREFETCHABLE) 404 1.1 jmcneill bus_flags |= ARM32_MMAP_WRITECOMBINE; 405 1.1 jmcneill 406 1.4 skrll return arm_btop(bpa + 4 * offset) | bus_flags; 407 1.1 jmcneill } 408 1.1 jmcneill 409 1.1 jmcneill int 410 1.1 jmcneill armv7_generic_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend, 411 1.1 jmcneill bus_size_t size, bus_size_t alignment, bus_size_t boundary, int flags, 412 1.1 jmcneill bus_addr_t *bpap, bus_space_handle_t *bshp) 413 1.1 jmcneill { 414 1.1 jmcneill 415 1.1 jmcneill panic("%s(): not implemented\n", __func__); 416 1.1 jmcneill } 417 1.1 jmcneill 418 1.1 jmcneill void 419 1.1 jmcneill armv7_generic_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size) 420 1.1 jmcneill { 421 1.1 jmcneill 422 1.1 jmcneill panic("%s(): not implemented\n", __func__); 423 1.1 jmcneill } 424