1 /* MN10300 CPU cache invalidation routines, using direct tag flushing
3 * Copyright (C) 2011 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
11 #include <linux/sys.h>
12 #include <linux/linkage.h>
15 #include <asm/cache.h>
16 #include <asm/irqflags.h>
17 #include <asm/cacheflush.h>
22 .globl debugger_local_cache_flushinv_one_icache
24 ###############################################################################
26 # void debugger_local_cache_flushinv_one(u8 *addr)
28 # Invalidate one particular cacheline if it's in the icache
30 ###############################################################################
32 .globl debugger_local_cache_flushinv_one_icache
33 .type debugger_local_cache_flushinv_one_icache,@function
34 debugger_local_cache_flushinv_one_icache:
40 beq debugger_local_cache_flushinv_one_icache_end
43 and L1_CACHE_TAG_MASK,a1
45 # read the tags from the tag RAM, and if they indicate a matching valid
46 # cache line then we invalidate that line
47 mov ICACHE_TAG(0,0),a0
49 and L1_CACHE_TAG_ENTRY,d0
50 add d0,a0 # starting icache tag RAM
53 and ~(L1_CACHE_DISPARITY-1),a1 # determine comparator base
54 or L1_CACHE_TAG_VALID,a1
55 mov L1_CACHE_TAG_ADDRESS|L1_CACHE_TAG_VALID,d1
64 # and wait for it to calm down
70 # check all the way tags for this cache entry
71 mov (a0),d0 # read the tag in the way 0 slot
74 beq debugger_local_icache_kill # jump if matched
76 add L1_CACHE_WAYDISP,a0
77 mov (a0),d0 # read the tag in the way 1 slot
80 beq debugger_local_icache_kill # jump if matched
82 add L1_CACHE_WAYDISP,a0
83 mov (a0),d0 # read the tag in the way 2 slot
86 beq debugger_local_icache_kill # jump if matched
88 add L1_CACHE_WAYDISP,a0
89 mov (a0),d0 # read the tag in the way 3 slot
92 bne debugger_local_icache_finish # jump if not matched
94 debugger_local_icache_kill:
95 mov d0,(a0) # kill the tag (D0 is 0 at this point)
97 debugger_local_icache_finish:
98 # wait for the cache to finish what it's doing
109 # re-enable interrupts
110 LOCAL_IRQ_RESTORE(d3)
112 debugger_local_cache_flushinv_one_icache_end:
114 .size debugger_local_cache_flushinv_one_icache,.-debugger_local_cache_flushinv_one_icache
116 #ifdef CONFIG_MN10300_DEBUGGER_CACHE_INV_BY_TAG
117 .globl debugger_local_cache_flushinv_one
118 .type debugger_local_cache_flushinv_one,@function
119 debugger_local_cache_flushinv_one = debugger_local_cache_flushinv_one_icache