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