Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 242224
b: refs/heads/master
c: b75bb23
h: refs/heads/master
v: v3
  • Loading branch information
David Howells committed Mar 18, 2011
1 parent 07d2170 commit b0692b7
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 84 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9ee21723ccc30070f47c411826d4ed013cd050c2
refs/heads/master: b75bb2365d50f73c09e42cf2de07f5805a3988ea
13 changes: 4 additions & 9 deletions trunk/arch/mn10300/mm/cache-inv-by-reg.S
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <asm/cache.h>
#include <asm/irqflags.h>
#include <asm/cacheflush.h>
#include "cache.inc"

#define mn10300_local_dcache_inv_range_intr_interval \
+((1 << MN10300_DCACHE_INV_RANGE_INTR_LOG2_INTERVAL) - 1)
Expand Down Expand Up @@ -62,10 +63,7 @@ mn10300_local_icache_inv:
btst CHCTR_ICEN,d0
beq mn10300_local_icache_inv_end

# invalidate
or CHCTR_ICINV,d0
movhu d0,(a0)
movhu (a0),d0
invalidate_icache 1

mn10300_local_icache_inv_end:
ret [],0
Expand All @@ -87,11 +85,8 @@ mn10300_local_dcache_inv:
btst CHCTR_DCEN,d0
beq mn10300_local_dcache_inv_end

# invalidate
or CHCTR_DCINV,d0
movhu d0,(a0)
movhu (a0),d0

invalidate_dcache 1
mn10300_local_dcache_inv_end:
ret [],0
.size mn10300_local_dcache_inv,.-mn10300_local_dcache_inv
Expand Down
77 changes: 3 additions & 74 deletions trunk/arch/mn10300/mm/cache-inv-by-tag.S
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <asm/cache.h>
#include <asm/irqflags.h>
#include <asm/cacheflush.h>
#include "cache.inc"

#define mn10300_local_dcache_inv_range_intr_interval \
+((1 << MN10300_DCACHE_INV_RANGE_INTR_LOG2_INTERVAL) - 1)
Expand Down Expand Up @@ -70,43 +71,7 @@ mn10300_local_icache_inv:
btst CHCTR_ICEN,d0
beq mn10300_local_icache_inv_end

#if defined(CONFIG_AM33_2) || defined(CONFIG_AM33_3)
LOCAL_CLI_SAVE(d1)

# disable the icache
and ~CHCTR_ICEN,d0
movhu d0,(a0)

# and wait for it to calm down
setlb
movhu (a0),d0
btst CHCTR_ICBUSY,d0
lne

# invalidate
or CHCTR_ICINV,d0
movhu d0,(a0)

# wait for the cache to finish
mov CHCTR,a0
setlb
movhu (a0),d0
btst CHCTR_ICBUSY,d0
lne

# and reenable it
and ~CHCTR_ICINV,d0
or CHCTR_ICEN,d0
movhu d0,(a0)
movhu (a0),d0

LOCAL_IRQ_RESTORE(d1)
#else /* CONFIG_AM33_2 || CONFIG_AM33_3 */
# invalidate
or CHCTR_ICINV,d0
movhu d0,(a0)
movhu (a0),d0
#endif /* CONFIG_AM33_2 || CONFIG_AM33_3 */
invalidate_icache 1

mn10300_local_icache_inv_end:
ret [],0
Expand All @@ -128,43 +93,7 @@ mn10300_local_dcache_inv:
btst CHCTR_DCEN,d0
beq mn10300_local_dcache_inv_end

#if defined(CONFIG_AM33_2) || defined(CONFIG_AM33_3)
LOCAL_CLI_SAVE(d1)

# disable the dcache
and ~CHCTR_DCEN,d0
movhu d0,(a0)

# and wait for it to calm down
setlb
movhu (a0),d0
btst CHCTR_DCBUSY,d0
lne

# invalidate
or CHCTR_DCINV,d0
movhu d0,(a0)

# wait for the cache to finish
mov CHCTR,a0
setlb
movhu (a0),d0
btst CHCTR_DCBUSY,d0
lne

# and reenable it
and ~CHCTR_DCINV,d0
or CHCTR_DCEN,d0
movhu d0,(a0)
movhu (a0),d0

LOCAL_IRQ_RESTORE(d1)
#else /* CONFIG_AM33_2 || CONFIG_AM33_3 */
# invalidate
or CHCTR_DCINV,d0
movhu d0,(a0)
movhu (a0),d0
#endif /* CONFIG_AM33_2 || CONFIG_AM33_3 */
invalidate_dcache 1

mn10300_local_dcache_inv_end:
ret [],0
Expand Down
133 changes: 133 additions & 0 deletions trunk/arch/mn10300/mm/cache.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
/* MN10300 CPU core caching macros -*- asm -*-
*
* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public Licence
* as published by the Free Software Foundation; either version
* 2 of the Licence, or (at your option) any later version.
*/


###############################################################################
#
# Invalidate the instruction cache.
# A0: Should hold CHCTR
# D0: Should have been read from CHCTR
# D1: Will be clobbered
#
# On some cores it is necessary to disable the icache whilst we do this.
#
###############################################################################
.macro invalidate_icache,disable_irq

#if defined(CONFIG_AM33_2) || defined(CONFIG_AM33_3)
.if \disable_irq
# don't want an interrupt routine seeing a disabled cache
mov epsw,d1
and ~EPSW_IE,epsw
or EPSW_NMID,epsw
nop
nop
.endif

# disable the icache
and ~CHCTR_ICEN,d0
movhu d0,(a0)

# and wait for it to calm down
setlb
movhu (a0),d0
btst CHCTR_ICBUSY,d0
lne

# invalidate
or CHCTR_ICINV,d0
movhu d0,(a0)

# wait for the cache to finish
setlb
movhu (a0),d0
btst CHCTR_ICBUSY,d0
lne

# and reenable it
or CHCTR_ICEN,d0
movhu d0,(a0)
movhu (a0),d0

.if \disable_irq
LOCAL_IRQ_RESTORE(d1)
.endif

#else /* CONFIG_AM33_2 || CONFIG_AM33_3 */

# invalidate
or CHCTR_ICINV,d0
movhu d0,(a0)
movhu (a0),d0

#endif /* CONFIG_AM33_2 || CONFIG_AM33_3 */
.endm

###############################################################################
#
# Invalidate the data cache.
# A0: Should hold CHCTR
# D0: Should have been read from CHCTR
# D1: Will be clobbered
#
# On some cores it is necessary to disable the dcache whilst we do this.
#
###############################################################################
.macro invalidate_dcache,disable_irq

#if defined(CONFIG_AM33_2) || defined(CONFIG_AM33_3)
.if \disable_irq
# don't want an interrupt routine seeing a disabled cache
mov epsw,d1
and ~EPSW_IE,epsw
or EPSW_NMID,epsw
nop
nop
.endif
# disable the dcache
and ~CHCTR_DCEN,d0
movhu d0,(a0)

# and wait for it to calm down
setlb
movhu (a0),d0
btst CHCTR_DCBUSY,d0
lne

# invalidate
or CHCTR_DCINV,d0
movhu d0,(a0)

# wait for the cache to finish
setlb
movhu (a0),d0
btst CHCTR_DCBUSY,d0
lne

# and reenable it
or CHCTR_DCEN,d0
movhu d0,(a0)
movhu (a0),d0

.if \disable_irq
LOCAL_IRQ_RESTORE(d1)
.endif

#else /* CONFIG_AM33_2 || CONFIG_AM33_3 */

# invalidate
or CHCTR_DCINV,d0
movhu d0,(a0)
movhu (a0),d0

#endif /* CONFIG_AM33_2 || CONFIG_AM33_3 */
.endm

0 comments on commit b0692b7

Please sign in to comment.