Mon Oct 10 07:37:17 2016 UTC ()
vaddr_t -> register_t in range cache ops


(skrll)
diff -r1.17 -r1.18 src/sys/arch/mips/mips/cache_r5k.c

cvs diff -r1.17 -r1.18 src/sys/arch/mips/mips/cache_r5k.c (expand / switch to unified diff)

--- src/sys/arch/mips/mips/cache_r5k.c 2016/10/08 00:39:53 1.17
+++ src/sys/arch/mips/mips/cache_r5k.c 2016/10/10 07:37:17 1.18
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: cache_r5k.c,v 1.17 2016/10/08 00:39:53 macallan Exp $ */ 1/* $NetBSD: cache_r5k.c,v 1.18 2016/10/10 07:37:17 skrll Exp $ */
2 2
3/* 3/*
4 * Copyright 2001 Wasabi Systems, Inc. 4 * Copyright 2001 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
@@ -26,27 +26,27 @@ @@ -26,27 +26,27 @@
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
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#include <sys/cdefs.h> 38#include <sys/cdefs.h>
39__KERNEL_RCSID(0, "$NetBSD: cache_r5k.c,v 1.17 2016/10/08 00:39:53 macallan Exp $"); 39__KERNEL_RCSID(0, "$NetBSD: cache_r5k.c,v 1.18 2016/10/10 07:37:17 skrll Exp $");
40 40
41#include <sys/param.h> 41#include <sys/param.h>
42 42
43#include <mips/cache.h> 43#include <mips/cache.h>
44#include <mips/cache_r4k.h> 44#include <mips/cache_r4k.h>
45#include <mips/cache_r5k.h> 45#include <mips/cache_r5k.h>
46#include <mips/locore.h> 46#include <mips/locore.h>
47 47
48/* 48/*
49 * Cache operations for R5000-style caches: 49 * Cache operations for R5000-style caches:
50 * 50 *
51 * - 2-way set-associative 51 * - 2-way set-associative
52 * - Write-back 52 * - Write-back
@@ -277,53 +277,53 @@ vr4131v1_pdcache_wbinv_range_16(register @@ -277,53 +277,53 @@ vr4131v1_pdcache_wbinv_range_16(register
277 cache_r4k_op_32lines_16(va, CACHE_R4K_D|CACHEOP_R4K_HIT_INV); 277 cache_r4k_op_32lines_16(va, CACHE_R4K_D|CACHEOP_R4K_HIT_INV);
278  278
279 } 279 }
280 280
281 for (; va < eva; va += 16) { 281 for (; va < eva; va += 16) {
282 cache_op_r4k_line(va, CACHE_R4K_D|CACHEOP_R4K_HIT_WB); 282 cache_op_r4k_line(va, CACHE_R4K_D|CACHEOP_R4K_HIT_WB);
283 cache_op_r4k_line(va, CACHE_R4K_D|CACHEOP_R4K_HIT_INV); 283 cache_op_r4k_line(va, CACHE_R4K_D|CACHEOP_R4K_HIT_INV);
284 } 284 }
285} 285}
286 286
287void 287void
288r4600v1_pdcache_inv_range_32(register_t va, vsize_t size) 288r4600v1_pdcache_inv_range_32(register_t va, vsize_t size)
289{ 289{
290 const vaddr_t eva = round_line32(va + size); 290 const register_t eva = round_line32(va + size);
291 291
292 /* 292 /*
293 * This is pathetically slow, but the chip bug is pretty 293 * This is pathetically slow, but the chip bug is pretty
294 * nasty, and we hope that not too many v1.x R4600s are 294 * nasty, and we hope that not too many v1.x R4600s are
295 * around. 295 * around.
296 */ 296 */
297 297
298 va = trunc_line32(va); 298 va = trunc_line32(va);
299 299
300 const uint32_t ostatus = mips_cp0_status_read(); 300 const uint32_t ostatus = mips_cp0_status_read();
301 301
302 mips_cp0_status_write(ostatus & ~MIPS_SR_INT_IE); 302 mips_cp0_status_write(ostatus & ~MIPS_SR_INT_IE);
303 303
304 for (; va < eva; va += 32) { 304 for (; va < eva; va += 32) {
305 __asm volatile("nop; nop; nop; nop;"); 305 __asm volatile("nop; nop; nop; nop;");
306 cache_op_r4k_line(va, CACHE_R4K_D|CACHEOP_R4K_HIT_INV); 306 cache_op_r4k_line(va, CACHE_R4K_D|CACHEOP_R4K_HIT_INV);
307  307
308 } 308 }
309 309
310 mips_cp0_status_write(ostatus); 310 mips_cp0_status_write(ostatus);
311} 311}
312 312
313void 313void
314r4600v2_pdcache_inv_range_32(register_t va, vsize_t size) 314r4600v2_pdcache_inv_range_32(register_t va, vsize_t size)
315{ 315{
316 const vaddr_t eva = round_line32(va + size); 316 const register_t eva = round_line32(va + size);
317 317
318 va = trunc_line32(va); 318 va = trunc_line32(va);
319 319
320 const uint32_t ostatus = mips_cp0_status_read(); 320 const uint32_t ostatus = mips_cp0_status_read();
321 321
322 mips_cp0_status_write(ostatus & ~MIPS_SR_INT_IE); 322 mips_cp0_status_write(ostatus & ~MIPS_SR_INT_IE);
323 323
324 /* 324 /*
325 * Between blasts of big cache chunks, give interrupts 325 * Between blasts of big cache chunks, give interrupts
326 * a chance to get though. 326 * a chance to get though.
327 */ 327 */
328 for (; (eva - va) >= (32 * 32); va += (32 * 32)) { 328 for (; (eva - va) >= (32 * 32); va += (32 * 32)) {
329 (void) *(volatile int *)MIPS_PHYS_TO_KSEG1(0); 329 (void) *(volatile int *)MIPS_PHYS_TO_KSEG1(0);