RTEMS
6.3
Toggle main menu visibility
Loading...
Searching...
No Matches
cpukit
score
cpu
sparc
include
libcpu
grlib-tn-0018.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: BSD-2-Clause */
2
11
12
/*
13
* Copyright (C) 2020 Cobham Gaisler AB
14
*
15
* Redistribution and use in source and binary forms, with or without
16
* modification, are permitted provided that the following conditions
17
* are met:
18
* 1. Redistributions of source code must retain the above copyright
19
* notice, this list of conditions and the following disclaimer.
20
* 2. Redistributions in binary form must reproduce the above copyright
21
* notice, this list of conditions and the following disclaimer in the
22
* documentation and/or other materials provided with the distribution.
23
*
24
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
* POSSIBILITY OF SUCH DAMAGE.
35
*/
36
37
/* NOTE: the lda should be on offset 0x18 */
38
#if defined(__FIX_LEON3FT_TN0018)
39
40
/* LEON3 Cache controller register accessed via ASI 2 */
41
#define ASI_CTRL 0x02
42
#define CCTRL_IP_BIT 15
43
#define CCTRL_ICS 0x3
44
45
/*
46
* l3: (out) original cctrl
47
* l4: (out) original cctrl with ics=0
48
* NOTE: This macro modifies psr.icc.
49
*/
50
.macro TN0018_WAIT_IFLUSH out1 out2
51
1:
52
! wait
for
pending iflush to complete
53
lda [%g0] ASI_CTRL, \out1
54
srl \out1, CCTRL_IP_BIT, \out2
55
andcc \out2, 1, %g0
56
bne 1b
57
andn \out1, CCTRL_ICS, \out2
58
.endm
59
60
61
.macro TN0018_WRITE_PSR src
62
wr \src, %psr
63
.endm
64
65
/* Prevent following jmp;rett sequence from "re-executing" due to cached RETT or source
66
* registers (l1 and l2) containing bit faults triggering ECC.
67
*
68
* l3: (in) original cctrl
69
* l4: (in) original cctrl with ics=0
70
* NOTE: This macro MUST be immediately followed by the "jmp;rett" pair.
71
*/
72
.macro TN0018_FIX in1 in2
73
.align 0x20 ! align the sta
for
performance
74
sta \in2, [%g0] ASI_CTRL ! disable icache
75
nop
! delay
for
sta to have effect on rett
76
or %l1, %l1, %l1 ! delay +
catch
rf parity error on l1
77
or %l2, %l2, %l2 ! delay +
catch
rf parity error on l2
78
sta \in1, [%g0] ASI_CTRL ! re-enable icache after rett
79
nop
! delay ensures insn after gets cached
80
.endm
81
82
#else
83
84
.macro TN0018_WAIT_IFLUSH out1 out2
85
.endm
86
87
.macro TN0018_WRITE_PSR src
88
.endm
89
90
.macro TN0018_FIX in1 in2
91
.endm
92
93
#endif
94
nop
#define nop()
Definition
sparc.h:281
Generated by
1.18.0