source:
rtems/cpukit/score/cpu/sparc/include/libcpu/grlib-tn-0018.h
@
b2da982
Last change on this file since b2da982 was b2da982, checked in by Daniel Hellstrom <daniel@…>, on 04/21/20 at 09:57:50 | |
---|---|
sparc_fix_ut700 | sparc_fix_ut699) \ + builtin_define ("FIX_LEON3FT_TN0018"); \
Workaround Implementation
In general there are two approaches that the workaround uses:
Where A) comes at a higher performance cost than B), so B) is used
A)
B)
RTEMS SPARC traps workaround implementation:
Any custom trap handlers may also have to be updated. To simplify that,
Close #4155. |
|
|
File size: 2.9 KB |
Line | |
---|---|
1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
2 | |
3 | /* |
4 | * Copyright (C) 2020 Cobham Gailer AB |
5 | * |
6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions |
8 | * are met: |
9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. |
11 | * 2. Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. |
14 | * |
15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
25 | * POSSIBILITY OF SUCH DAMAGE. |
26 | */ |
27 | |
28 | /* NOTE: the lda should be on offset 0x18 */ |
29 | #if defined(__FIX_LEON3FT_TN0018) |
30 | |
31 | /* LEON3 Cache controller register accessed via ASI 2 */ |
32 | #define ASI_CTRL 0x02 |
33 | #define CCTRL_IP_BIT 15 |
34 | #define CCTRL_ICS 0x3 |
35 | |
36 | /* |
37 | * l3: (out) original cctrl |
38 | * l4: (out) original cctrl with ics=0 |
39 | * NOTE: This macro modifies psr.icc. |
40 | */ |
41 | .macro TN0018_WAIT_IFLUSH out1 out2 |
42 | 1: |
43 | ! wait for pending iflush to complete |
44 | lda [%g0] ASI_CTRL, \out1 |
45 | srl \out1, CCTRL_IP_BIT, \out2 |
46 | andcc \out2, 1, %g0 |
47 | bne 1b |
48 | andn \out1, CCTRL_ICS, \out2 |
49 | .endm |
50 | |
51 | |
52 | .macro TN0018_WRITE_PSR src |
53 | wr \src, %psr |
54 | .endm |
55 | |
56 | /* Prevent following jmp;rett sequence from "re-executing" due to cached RETT or source |
57 | * registers (l1 and l2) containing bit faults triggering ECC. |
58 | * |
59 | * l3: (in) original cctrl |
60 | * l4: (in) original cctrl with ics=0 |
61 | * NOTE: This macro MUST be immediately followed by the "jmp;rett" pair. |
62 | */ |
63 | .macro TN0018_FIX in1 in2 |
64 | .align 0x20 ! align the sta for performance |
65 | sta \in2, [%g0] ASI_CTRL ! disable icache |
66 | nop ! delay for sta to have effect on rett |
67 | or %l1, %l1, %l1 ! delay + catch rf parity error on l1 |
68 | or %l2, %l2, %l2 ! delay + catch rf parity error on l2 |
69 | sta \in1, [%g0] ASI_CTRL ! re-enable icache after rett |
70 | nop ! delay ensures insn after gets cached |
71 | .endm |
72 | |
73 | #else |
74 | |
75 | .macro TN0018_WAIT_IFLUSH out1 out2 |
76 | .endm |
77 | |
78 | .macro TN0018_WRITE_PSR src |
79 | .endm |
80 | |
81 | .macro TN0018_FIX in1 in2 |
82 | .endm |
83 | |
84 | #endif |
85 |