An AM34 erratum requires MMUCTR read and write on entry to certain exceptions,
prior to EPSW.NMID being cleared to allow NMIs to happen.
Signed-off-by: Akira Takeuchi <takeuchi.akr@jp.panasonic.com>
Signed-off-by: Kiyoshi Owada <owada.kiyoshi@jp.panasonic.com>
Signed-off-by: David Howells <dhowells@redhat.com>
select MN10300_HAS_ATOMIC_OPS_UNIT
select MN10300_HAS_CACHE_SNOOP
select MN10300_HAS_ATOMIC_OPS_UNIT
select MN10300_HAS_CACHE_SNOOP
+config ERRATUM_NEED_TO_RELOAD_MMUCTR
+ def_bool y if AM33_3 || AM34_2
+
ENTRY(raw_bus_error)
add -4,sp
mov d0,(sp)
ENTRY(raw_bus_error)
add -4,sp
mov d0,(sp)
+#if defined(CONFIG_ERRATUM_NEED_TO_RELOAD_MMUCTR)
+ mov (MMUCTR),d0
+ mov d0,(MMUCTR)
+#endif
mov (BCBERR),d0 # what
btst BCBERR_BEMR_DMA,d0 # see if it was an external bus error
beq __common_exception_aux # it wasn't
mov (BCBERR),d0 # what
btst BCBERR_BEMR_DMA,d0 # see if it was an external bus error
beq __common_exception_aux # it wasn't
ENTRY(__common_exception)
add -4,sp
mov d0,(sp)
ENTRY(__common_exception)
add -4,sp
mov d0,(sp)
+#if defined(CONFIG_ERRATUM_NEED_TO_RELOAD_MMUCTR)
+ mov (MMUCTR),d0
+ mov d0,(MMUCTR)
+#endif
__common_exception_aux:
mov (TBR),d0
__common_exception_aux:
mov (TBR),d0
###############################################################################
.type itlb_miss,@function
ENTRY(itlb_miss)
###############################################################################
.type itlb_miss,@function
ENTRY(itlb_miss)
#ifdef CONFIG_GDBSTUB
movm [d2,d3,a2],(sp)
#else
#ifdef CONFIG_GDBSTUB
movm [d2,d3,a2],(sp)
#else
+#if defined(CONFIG_ERRATUM_NEED_TO_RELOAD_MMUCTR)
+ mov (MMUCTR),d2
+ mov d2,(MMUCTR)
+#endif
+
+ and ~EPSW_NMID,epsw
mov (IPTEU),d3
mov (PTBR),a2
mov d3,d2
mov (IPTEU),d3
mov (PTBR),a2
mov d3,d2
###############################################################################
.type dtlb_miss,@function
ENTRY(dtlb_miss)
###############################################################################
.type dtlb_miss,@function
ENTRY(dtlb_miss)
#ifdef CONFIG_GDBSTUB
movm [d2,d3,a2],(sp)
#else
#ifdef CONFIG_GDBSTUB
movm [d2,d3,a2],(sp)
#else
+#if defined(CONFIG_ERRATUM_NEED_TO_RELOAD_MMUCTR)
+ mov (MMUCTR),d2
+ mov d2,(MMUCTR)
+#endif
+
+ and ~EPSW_NMID,epsw
mov (DPTEU),d3
mov (PTBR),a2
mov d3,d2
mov (DPTEU),d3
mov (PTBR),a2
mov d3,d2
###############################################################################
.type itlb_aerror,@function
ENTRY(itlb_aerror)
###############################################################################
.type itlb_aerror,@function
ENTRY(itlb_aerror)
+
+#if defined(CONFIG_ERRATUM_NEED_TO_RELOAD_MMUCTR)
+ mov (MMUCTR),d1
+ mov d1,(MMUCTR)
+#endif
+
+ and ~EPSW_NMID,epsw
add -4,sp # need to pass three params
# calculate the fault code
add -4,sp # need to pass three params
# calculate the fault code
or EPSW_IE,epsw
mov fp,d0
call do_page_fault[],0 # do_page_fault(regs,code,addr
or EPSW_IE,epsw
mov fp,d0
call do_page_fault[],0 # do_page_fault(regs,code,addr
###############################################################################
.type dtlb_aerror,@function
ENTRY(dtlb_aerror)
###############################################################################
.type dtlb_aerror,@function
ENTRY(dtlb_aerror)
+
+#if defined(CONFIG_ERRATUM_NEED_TO_RELOAD_MMUCTR)
+ mov (MMUCTR),d1
+ mov d1,(MMUCTR)
+#endif
+
add -4,sp # need to pass three params
add -4,sp # need to pass three params
# calculate the fault code
movhu (MMUFCR_DFC),d1
# calculate the fault code
movhu (MMUFCR_DFC),d1
or EPSW_IE,epsw
mov fp,d0
call do_page_fault[],0 # do_page_fault(regs,code,addr
or EPSW_IE,epsw
mov fp,d0
call do_page_fault[],0 # do_page_fault(regs,code,addr