| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: err_tick_cmpr_cycle_c1_n2.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 MY_HP_TEXT_PA 0x1050000000 |
| 39 | #define MY_HP_DATA_PA 0x1050001000 |
| 40 | |
| 41 | #define ASI_PRIMARY_CONTEXT_0 0x21 |
| 42 | #define ASI_ITLB_DATA_IN_REG 0x54 |
| 43 | #define ASI_DMMU_TAG_ACCESS 0x58 |
| 44 | #define ASI_DTLB_DATA_IN_REG 0x5c |
| 45 | #define ASI_DMMU_SFAR 0x58 |
| 46 | |
| 47 | |
| 48 | #define IMDU_ERR_EN 0xa0000000 |
| 49 | #define IMTU_ERR_EN 0x90000000 |
| 50 | #define DMDU_ERR_EN 0x88000000 |
| 51 | #define DMTU_ERR_EN 0x84000000 |
| 52 | #define IRCU_ERR_EN 0x82000000 |
| 53 | #define FRCU_ERR_EN 0x81000000 |
| 54 | #define SCAU_ERR_EN 0x80800000 |
| 55 | #define TCCU_ERR_EN 0x80400000 |
| 56 | #define TSAU_ERR_EN 0x80200000 |
| 57 | #define MRAU_ERR_EN 0x80100000 |
| 58 | #define STAU_ERR_EN 0x80080000 |
| 59 | #define STDU_ERR_EN 0x80020000 |
| 60 | |
| 61 | #define ASI_DESR 0x4c |
| 62 | #define ASI_DFESR 0x4c |
| 63 | #define DFESR_VA 0x8 |
| 64 | #define ASI_DSFSR 0x58 |
| 65 | #define ASI_ISFSR 0x50 |
| 66 | #define SFSR_VA 0x18 |
| 67 | #define ASI_SFAR 0x58 |
| 68 | #define SFAR_VA 0x20 |
| 69 | #define ASI_ERR_INJ 0x43 |
| 70 | #define ASI_CETER 0x4C |
| 71 | #define CETER_VA 0x18 |
| 72 | #define ASI_CERER 0x4C |
| 73 | #define CERER_VA 0x10 |
| 74 | |
| 75 | #define ASI_SEI 0x43 |
| 76 | #define ASI_SES 0x4C |
| 77 | |
| 78 | |
| 79 | ! #define CERER_SBDPC 0x400 |
| 80 | ! #define CETER_DHCCE 0x1000000000000000 |
| 81 | ! #define CETER_DE 0x2000_0000_0000_0000 |
| 82 | ! #define CETER_PSCCE 0x4000000000000000 |
| 83 | #define DCVP_ERR_TYPE 0x5 |
| 84 | |
| 85 | #define MAIN_PAGE_HV_ALSO |
| 86 | |
| 87 | #define H_HT0_Internal_Processor_Error_0x29 My_Internal_Processor_Error_Trap |
| 88 | #define H_HT0_Sw_Recoverable_Error_0x40 My_Sw_Recoverable_Error |
| 89 | |
| 90 | #include "hboot.s" |
| 91 | |
| 92 | /************************************************************************ |
| 93 | Test case: |
| 94 | ************************************************************************/ |
| 95 | |
| 96 | .text |
| 97 | .global main |
| 98 | .global My_Internal_Processor_Error_Trap |
| 99 | .global My_Sw_Recoverable_Error |
| 100 | |
| 101 | main: /* test begin */ |
| 102 | ta T_CHANGE_HPRIV |
| 103 | |
| 104 | |
| 105 | !! Start new Tick compare code |
| 106 | START_TICK_CMP_HERE: |
| 107 | !! set CERER.TCCP |
| 108 | setx 0x0000000000000080, %g1, %o2 !! enable tccp errs...bit 6&7 |
| 109 | add %g0, CERER_VA, %g3 !! g3 has cerer va |
| 110 | stxa %o2, [%g3]ASI_CERER |
| 111 | |
| 112 | setx 0x18, %g0, %g1 ! VA for pscce 12.8.2 |
| 113 | set_pscce_bit52: |
| 114 | setx 0x7000000000000000, %l0, %l2 |
| 115 | stxa %l2, [%g0+%g1] ASI_SES |
| 116 | ldxa [%g0+%g1] ASI_SES, %l6 |
| 117 | |
| 118 | |
| 119 | !! Enable error injection |
| 120 | setx TCCU_ERR_EN, %l0, %l1 |
| 121 | or %l1, 0x2, %l1 !! set mask bit 0 to 1 |
| 122 | stxa %l1, [%g0]ASI_ERR_INJ |
| 123 | |
| 124 | wr %o3, %o3, %tick_cmpr !! write bad ecc |
| 125 | |
| 126 | stxa %g0, [%g0]ASI_ERR_INJ !! turn off err inject |
| 127 | |
| 128 | TICK_CMP_INST_HERE: |
| 129 | ! rd %tick_cmpr, %l3 !! should trap here??? |
| 130 | |
| 131 | sdivx %o3, %o3, %o3 |
| 132 | sdivx %o3, %o3, %o3 |
| 133 | sdivx %o3, %o3, %o3 |
| 134 | sdivx %o3, %o3, %o3 |
| 135 | sdivx %o3, %o3, %o3 |
| 136 | sdivx %o3, %o3, %o3 |
| 137 | sdivx %o3, %o3, %o3 |
| 138 | sdivx %o3, %o3, %o3 |
| 139 | sdivx %o3, %o3, %o3 |
| 140 | sdivx %o3, %o3, %o3 |
| 141 | sdivx %o3, %o3, %o3 |
| 142 | sdivx %o3, %o3, %o3 |
| 143 | sdivx %o3, %o3, %o3 |
| 144 | sdivx %o3, %o3, %o3 |
| 145 | sdivx %o3, %o3, %o3 |
| 146 | sdivx %o3, %o3, %o3 |
| 147 | sdivx %o3, %o3, %o3 |
| 148 | |
| 149 | !! End new Tick compare code |
| 150 | |
| 151 | END_TICK_CMP_HERE: |
| 152 | |
| 153 | ba test_fail |
| 154 | nop |
| 155 | |
| 156 | |
| 157 | My_Internal_Processor_Error_Trap: |
| 158 | add %g0, SFSR_VA, %g3 !! g3 has va = 18 |
| 159 | ldxa [%g0+%g3] ASI_DSFSR, %l6 !! ASI 0x58 |
| 160 | |
| 161 | setx 0x000000000000000C, %o0, %o6 |
| 162 | cmp %o6, %l6 |
| 163 | bne test_fail |
| 164 | |
| 165 | add %g0, SFAR_VA, %g3 !! g3 has va = 20 |
| 166 | ldxa [%g0+%g3] ASI_DSFSR, %l7 !! ASI 0x58 |
| 167 | |
| 168 | setx 0x0000000000000208, %o0, %o7 |
| 169 | cmp %o7, %l7 |
| 170 | bne test_fail |
| 171 | |
| 172 | ba test_pass |
| 173 | nop |
| 174 | |
| 175 | My_Sw_Recoverable_Error: |
| 176 | |
| 177 | ldxa [%g0+%g0] ASI_DESR, %l7 !! ASI 0x58 |
| 178 | |
| 179 | setx 0xee00000000000208, %o0, %o7 |
| 180 | cmp %o7, %l7 |
| 181 | bne test_fail |
| 182 | |
| 183 | !! ADD CHECKING HERE |
| 184 | |
| 185 | ba test_pass |
| 186 | nop |
| 187 | |
| 188 | |
| 189 | |
| 190 | /******************************************************* |
| 191 | * Exit code |
| 192 | *******************************************************/ |
| 193 | |
| 194 | |
| 195 | test_pass: |
| 196 | ta T_GOOD_TRAP |
| 197 | |
| 198 | test_fail: |
| 199 | ta T_BAD_TRAP |