Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: tso_n1_cross_mod2.s | |
5 | * Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved | |
6 | * 4150 Network Circle, Santa Clara, California 95054, U.S.A. | |
7 | * | |
8 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
9 | * | |
10 | * This program is free software; you can redistribute it and/or modify | |
11 | * it under the terms of the GNU General Public License as published by | |
12 | * the Free Software Foundation; version 2 of the License. | |
13 | * | |
14 | * This program is distributed in the hope that it will be useful, | |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | * GNU General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU General Public License | |
20 | * along with this program; if not, write to the Free Software | |
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 | * | |
23 | * For the avoidance of doubt, and except that if any non-GPL license | |
24 | * choice is available it will apply instead, Sun elects to use only | |
25 | * the General Public License version 2 (GPLv2) at this time for any | |
26 | * software where a choice of GPL license versions is made | |
27 | * available with the language indicating that GPLv2 or any later version | |
28 | * may be used, or where a choice of which version of the GPL is applied is | |
29 | * otherwise unspecified. | |
30 | * | |
31 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
32 | * CA 95054 USA or visit www.sun.com if you need additional information or | |
33 | * have any questions. | |
34 | * | |
35 | * | |
36 | * ========== Copyright Header End ============================================ | |
37 | */ | |
38 | #define MAIN_BASE_DATA_ADDR 0x160000 | |
39 | #define MAIN_BASE_TEXT_ADDR 0x150000 | |
40 | #define MAIN_BASE_DATA_ADDR_RA 0x100160000 | |
41 | #define MAIN_BASE_TEXT_ADDR_RA 0x100150000 | |
42 | ||
43 | #define ASI_BLK_P 0xf0 | |
44 | ||
45 | #define USER_PAGE_CUSTOM_MAP | |
46 | #include "hboot.s" | |
47 | ||
48 | SECTION .MAIN TEXT_VA=0x150000, DATA_VA=0x160000 | |
49 | ||
50 | attr_text { | |
51 | Name = .MAIN, | |
52 | VA=MAIN_BASE_TEXT_ADDR, | |
53 | RA=MAIN_BASE_TEXT_ADDR_RA, | |
54 | PA=ra2pa(MAIN_BASE_TEXT_ADDR_RA,0), | |
55 | part_0_ctx_nonzero_tsb_config_0, | |
56 | TTE_G=0, TTE_Context=PCONTEXT, TTE_V=1, TTE_Size=0, TTE_NFO=0, | |
57 | TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0, | |
58 | TTE_L=0, TTE_CP=1, TTE_CV=1, TTE_EP=1, TTE_E=0, TTE_P=0, TTE_W=1 | |
59 | } | |
60 | attr_data { | |
61 | Name = .MAIN, | |
62 | VA=MAIN_BASE_DATA_ADDR, | |
63 | RA=MAIN_BASE_DATA_ADDR_RA, | |
64 | PA=ra2pa(MAIN_BASE_DATA_ADDR_RA,0), | |
65 | part_0_ctx_nonzero_tsb_config_0, | |
66 | TTE_G=0, TTE_Context=PCONTEXT, TTE_V=1, TTE_Size=0, TTE_NFO=0, | |
67 | TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0, | |
68 | TTE_L=0, TTE_CP=1, TTE_CV=1, TTE_E=0, TTE_P=0, TTE_W=1 | |
69 | } | |
70 | ||
71 | .text | |
72 | .global main | |
73 | main: | |
74 | clr %l0 | |
75 | wr %g0, 0x4, %fprs /* make sure fef is 1 */ | |
76 | ||
77 | th_fork(th_main,%l0) | |
78 | ||
79 | ||
80 | ! this thread modfifies the code | |
81 | !=============================== | |
82 | th_main_0: | |
83 | ||
84 | set 0x40, %i7 ! loop counting | |
85 | ||
86 | setx ready, %l0, %l1 ! pointers... | |
87 | setx noop, %l0, %l2 | |
88 | ldda [%l2]ASI_BLK_P, %d0 ! nop-s in d0 to d15 | |
89 | setx modified, %l0, %l3 ! | |
90 | ||
91 | deliver_loop: | |
92 | ld [%l1], %o0 ! read ready. | |
93 | tst %o0 ! should be 0. | |
94 | bne deliver_loop | |
95 | nop | |
96 | ||
97 | stda %d0, [%l3]ASI_BLK_P ! store good data to label0 | |
98 | flush %l3 ! the reg here does not matter. | |
99 | ||
100 | deccc %i7 ! count | |
101 | bne goon | |
102 | nop | |
103 | ba final_stuff ! go to end if finished | |
104 | nop | |
105 | ||
106 | goon: | |
107 | set 1, %i0 ! set ready | |
108 | st %i0, [%l1] ! | |
109 | ba deliver_loop ! repeat | |
110 | nop | |
111 | ||
112 | final_stuff: | |
113 | set 0x55, %i0 ! 55 means we are done. | |
114 | st %i0, [%l1] | |
115 | ba good_end | |
116 | nop | |
117 | ||
118 | ! these are the receivers | |
119 | !------------------------ | |
120 | th_main_1: | |
121 | th_main_4: | |
122 | ||
123 | setx ready, %l0, %l1 ! pointers... | |
124 | setx bad_end, %l0, %l2 | |
125 | ldda [%l2]ASI_BLK_P, %d0 ! ta BAD_TRAP is d0-d15 | |
126 | setx modified, %l0, %l3 | |
127 | ||
128 | wait_loop: ! wait for ready flag | |
129 | ld [%l1], %o0 | |
130 | sub %o0, 0x55, %i1 ! check for end of test flag. | |
131 | tst %i1 | |
132 | be good_end ! end the test | |
133 | nop | |
134 | sub %o0, 0x1, %i1 ! code for available data | |
135 | tst %i1 | |
136 | be modified | |
137 | nop | |
138 | ba wait_loop | |
139 | nop | |
140 | ||
141 | .align 0x40 | |
142 | modified: | |
143 | ta T_BAD_TRAP ! this data is overwritten... | |
144 | ta T_BAD_TRAP | |
145 | ta T_BAD_TRAP | |
146 | ta T_BAD_TRAP | |
147 | ||
148 | ta T_BAD_TRAP | |
149 | ta T_BAD_TRAP | |
150 | ta T_BAD_TRAP | |
151 | ta T_BAD_TRAP | |
152 | ||
153 | ta T_BAD_TRAP | |
154 | ta T_BAD_TRAP | |
155 | ta T_BAD_TRAP | |
156 | ta T_BAD_TRAP | |
157 | ||
158 | ta T_BAD_TRAP | |
159 | ta T_BAD_TRAP | |
160 | ta T_BAD_TRAP | |
161 | ta T_BAD_TRAP ! so the test goes on... | |
162 | ||
163 | stda %d0, [%l3]ASI_BLK_P ! store bad data to label0 again | |
164 | membar 0x40 | |
165 | ||
166 | set 0, %o0 ! reset the ready flag | |
167 | st %o0, [%l1] | |
168 | ||
169 | ba wait_loop ! do it again | |
170 | nop | |
171 | ||
172 | good_end: | |
173 | ta T_GOOD_TRAP | |
174 | ||
175 | .align 0x40 | |
176 | bad_end: | |
177 | ta T_BAD_TRAP | |
178 | ta T_BAD_TRAP | |
179 | ta T_BAD_TRAP | |
180 | ta T_BAD_TRAP | |
181 | ||
182 | ta T_BAD_TRAP | |
183 | ta T_BAD_TRAP | |
184 | ta T_BAD_TRAP | |
185 | ta T_BAD_TRAP | |
186 | ||
187 | ta T_BAD_TRAP | |
188 | ta T_BAD_TRAP | |
189 | ta T_BAD_TRAP | |
190 | ta T_BAD_TRAP | |
191 | ||
192 | ta T_BAD_TRAP | |
193 | ta T_BAD_TRAP | |
194 | ta T_BAD_TRAP | |
195 | ta T_BAD_TRAP | |
196 | ||
197 | ||
198 | .align 0x40 | |
199 | noop: | |
200 | nop;nop; nop;nop; | |
201 | nop;nop; nop;nop; | |
202 | nop;nop; nop;nop; | |
203 | nop;nop; nop;nop; | |
204 | ||
205 | .data | |
206 | .global ready | |
207 | ready: | |
208 | .word 0x0 | |
209 | ||
210 | .end | |
211 |