blob: 3e2cfa2c6d39436d29f0c05e8f8cb1611fe76560 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Cache flushing routines.
3 *
David Mosberger-Tang20746152005-02-18 19:09:00 -07004 * Copyright (C) 1999-2001, 2005 Hewlett-Packard Co
5 * David Mosberger-Tang <davidm@hpl.hp.com>
Zoltan Menyhart08357f82005-06-03 05:36:00 -07006 *
7 * 05/28/05 Zoltan Menyhart Dynamic stride size
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 */
Zoltan Menyhart08357f82005-06-03 05:36:00 -07009
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <asm/asmmacro.h>
Zoltan Menyhart08357f82005-06-03 05:36:00 -070011
Linus Torvalds1da177e2005-04-16 15:20:36 -070012
13 /*
14 * flush_icache_range(start,end)
Zoltan Menyhart08357f82005-06-03 05:36:00 -070015 *
16 * Make i-cache(s) coherent with d-caches.
17 *
18 * Must deal with range from start to end-1 but nothing else (need to
Linus Torvalds1da177e2005-04-16 15:20:36 -070019 * be careful not to touch addresses that may be unmapped).
Zoltan Menyhart08357f82005-06-03 05:36:00 -070020 *
21 * Note: "in0" and "in1" are preserved for debugging purposes.
Linus Torvalds1da177e2005-04-16 15:20:36 -070022 */
23GLOBAL_ENTRY(flush_icache_range)
Zoltan Menyhart08357f82005-06-03 05:36:00 -070024
Linus Torvalds1da177e2005-04-16 15:20:36 -070025 .prologue
Zoltan Menyhart08357f82005-06-03 05:36:00 -070026 alloc r2=ar.pfs,2,0,0,0
27 movl r3=ia64_i_cache_stride_shift
28 mov r21=1
Linus Torvalds1da177e2005-04-16 15:20:36 -070029 ;;
Zoltan Menyhart08357f82005-06-03 05:36:00 -070030 ld8 r20=[r3] // r20: stride shift
31 sub r22=in1,r0,1 // last byte address
32 ;;
33 shr.u r23=in0,r20 // start / (stride size)
34 shr.u r22=r22,r20 // (last byte address) / (stride size)
35 shl r21=r21,r20 // r21: stride size of the i-cache(s)
36 ;;
37 sub r8=r22,r23 // number of strides - 1
38 shl r24=r23,r20 // r24: addresses for "fc.i" =
39 // "start" rounded down to stride boundary
40 .save ar.lc,r3
41 mov r3=ar.lc // save ar.lc
Linus Torvalds1da177e2005-04-16 15:20:36 -070042 ;;
43
44 .body
Zoltan Menyhart08357f82005-06-03 05:36:00 -070045 mov ar.lc=r8
Linus Torvalds1da177e2005-04-16 15:20:36 -070046 ;;
Zoltan Menyhart08357f82005-06-03 05:36:00 -070047 /*
48 * 32 byte aligned loop, even number of (actually 2) bundles
49 */
50.Loop: fc.i r24 // issuable on M0 only
51 add r24=r21,r24 // we flush "stride size" bytes per iteration
52 nop.i 0
Linus Torvalds1da177e2005-04-16 15:20:36 -070053 br.cloop.sptk.few .Loop
54 ;;
55 sync.i
56 ;;
57 srlz.i
58 ;;
Zoltan Menyhart08357f82005-06-03 05:36:00 -070059 mov ar.lc=r3 // restore ar.lc
Linus Torvalds1da177e2005-04-16 15:20:36 -070060 br.ret.sptk.many rp
61END(flush_icache_range)