Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: ncu_bank_en_wptect_basic.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_PAGE_NUCLEUS_ALSO | |
39 | #define MAIN_PAGE_HV_ALSO | |
40 | ||
41 | #include "hboot.s" | |
42 | #include "asi_s.h" | |
43 | ||
44 | #ifndef BANK_AVAIL | |
45 | #define BANK_AVAIL 0xff | |
46 | #endif | |
47 | ||
48 | .text | |
49 | .global main | |
50 | ||
51 | ||
52 | main: | |
53 | ta T_CHANGE_HPRIV | |
54 | ||
55 | get_th_id: | |
56 | ta T_RD_THID | |
57 | wr %g0,ASI_CMP_CORE,%asi | |
58 | ||
59 | ! Read bank enable comb | |
60 | setx BANK_AVAIL, %g7,%g6 | |
61 | setx 0x8000001020,%g7,%g2 | |
62 | ldx [%g2],%g3 | |
63 | cmp %g6,%g3 | |
64 | bne %xcc,test_fail | |
65 | nop | |
66 | ||
67 | ! Check that bank_enable_status is correct | |
68 | call calc_bank_en_st !return in %g5 | |
69 | nop | |
70 | setx 0x8000001028,%g7,%g2 | |
71 | ldx [%g2],%g3 | |
72 | cmp %g5,%g3 | |
73 | bne %xcc,test_fail | |
74 | nop | |
75 | ||
76 | ! Turn on next available core | |
77 | setx CORE_AVAIL,%g7,%l1 | |
78 | srlx %o1,0x3,%l0 | |
79 | set 0x1,%l2 | |
80 | sllx %l2,%l0,%l2 | |
81 | ||
82 | setx 0x00000000000000ff,%g7,%g1 | |
83 | sllx %g1,%o1,%g1 | |
84 | ||
85 | next_core_loop: | |
86 | add %l0,1,%l0 | |
87 | cmp %l0,0x9 | |
88 | be test_pass | |
89 | nop | |
90 | sllx %l2,1,%l2 | |
91 | sllx %g1,8,%g1 | |
92 | andcc %l1,%l2,%g0 | |
93 | bz next_core_loop | |
94 | nop | |
95 | ||
96 | ! Warm reset to turn on next bank combination | |
97 | stxa %g1,[ASI_CMP_CORE_ENABLE]%asi | |
98 | setx 0x8900000808,%g7,%g2 | |
99 | set 0x1,%g1 | |
100 | stx %g1,[%g2] | |
101 | ||
102 | halt: | |
103 | ba halt | |
104 | nop | |
105 | ||
106 | /****************************************************** | |
107 | * Subroutine code | |
108 | *******************************************************/ | |
109 | ||
110 | calc_bank_en_st: | |
111 | and %g6,0x1,%l0 | |
112 | srl %g6,1,%l6 | |
113 | and %l6,%l0,%l0 | |
114 | ||
115 | srl %l6,1,%l6 | |
116 | and %l6,0x1,%l1 | |
117 | srl %l6,1,%l6 | |
118 | and %l6,%l1,%l1 | |
119 | ||
120 | srl %l6,1,%l6 | |
121 | and %l6,0x1,%l2 | |
122 | srl %l6,1,%l6 | |
123 | and %l6,%l2,%l2 | |
124 | ||
125 | srl %l6,1,%l6 | |
126 | and %l6,0x1,%l3 | |
127 | srl %l6,1,%l6 | |
128 | and %l6,%l3,%l3 | |
129 | ||
130 | sll %l3,3,%l3 | |
131 | sll %l2,2,%l2 | |
132 | sll %l1,1,%l1 | |
133 | or %l0,%l1,%l0 | |
134 | or %l0,%l2,%l0 | |
135 | or %l0,%l3,%l0 | |
136 | and %l0,0xf,%l0 | |
137 | cmp %l0,0xf | |
138 | be not_pm_2 | |
139 | nop | |
140 | or %l0,0x10,%l0 | |
141 | ||
142 | not_pm_2: | |
143 | ! Remove illegal combinations | |
144 | cmp %l0,0x17 | |
145 | be val_13_2 | |
146 | nop | |
147 | cmp %l0,0x1b | |
148 | be val_13_2 | |
149 | nop | |
150 | cmp %l0,0x1d | |
151 | be val_1c_2 | |
152 | nop | |
153 | cmp %l0,0x1e | |
154 | be val_1c_2 | |
155 | nop | |
156 | ||
157 | final_shift_2: | |
158 | sll %l0,8,%l4 | |
159 | or %l0,%l4,%g5 | |
160 | retl | |
161 | nop | |
162 | ||
163 | val_13_2: | |
164 | set 0x13,%l0 | |
165 | ba final_shift_2 | |
166 | nop | |
167 | ||
168 | val_1c_2: | |
169 | set 0x1c,%l0 | |
170 | ba final_shift_2 | |
171 | nop | |
172 | ||
173 | ||
174 | /****************************************************** | |
175 | * Exit code | |
176 | *******************************************************/ | |
177 | ||
178 | test_pass: | |
179 | EXIT_GOOD | |
180 | ||
181 | test_fail: | |
182 | EXIT_BAD |