| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: err_tcc_hstick_halt_diag.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_HV_ALSO |
| 39 | #define MAIN_PAGE_NUCLEUS_ALSO |
| 40 | #define CETER_DE 0x2000000000000000 |
| 41 | #define ASI_CETER 0x4C |
| 42 | #define CETER_VA 0x18 |
| 43 | #define ASI_CERER 0x4C |
| 44 | #define CERER_VA 0x10 |
| 45 | #define TCCU_ERR_EN 0x80400000 |
| 46 | |
| 47 | |
| 48 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 49 | |
| 50 | ! Interrupt trap handler |
| 51 | |
| 52 | #define H_HT0_Hstick_Match_0x5e |
| 53 | #define My_HT0_Hstick_Match_0x5e \ |
| 54 | rdpr %tick, %l0; \ |
| 55 | add %g0, 1, %i0; \ |
| 56 | retry; \ |
| 57 | nop |
| 58 | |
| 59 | #define H_HT0_Sw_Recoverable_Error_0x40 |
| 60 | #define SUN_H_HT0_Sw_Recoverable_Error_0x40 \ |
| 61 | rdpr %tick, %l0; \ |
| 62 | ldxa [%g0]0x4C, %l7; \ |
| 63 | add %g0, 1, %i1; \ |
| 64 | done; \ |
| 65 | nop |
| 66 | |
| 67 | #include "hboot.s" |
| 68 | |
| 69 | /************************************************************************ |
| 70 | Test case code start |
| 71 | ************************************************************************/ |
| 72 | |
| 73 | .text |
| 74 | .global main |
| 75 | |
| 76 | main: /* test begin */ |
| 77 | |
| 78 | ta T_CHANGE_HPRIV |
| 79 | mov %g0, %i0 |
| 80 | mov %g0, %i1 |
| 81 | ! Enable tccd errors. |
| 82 | add %g0, 0x80, %o2 |
| 83 | add %g0, CERER_VA, %g3 |
| 84 | stxa %o2, [%g3]ASI_CERER |
| 85 | |
| 86 | ! Turn off IE bit so the sw_recoverable err trap is not taken |
| 87 | !again and again |
| 88 | rdpr %pstate, %l1 |
| 89 | wrpr %l1, 0x2, %pstate |
| 90 | |
| 91 | |
| 92 | !! set CETER.DE |
| 93 | setx CETER_DE, %l0, %o2 |
| 94 | add %g0, CETER_VA, %g3 |
| 95 | stxa %o2, [%g3]ASI_CETER |
| 96 | |
| 97 | !! Enable error injection |
| 98 | setx TCCU_ERR_EN, %l0, %l5 |
| 99 | or %l5, 0x1, %l5 ! set mask bit 0 t |
| 100 | stxa %l5, [%g0]ASI_ERR_INJ |
| 101 | |
| 102 | set_stick: |
| 103 | setx 0x50000000, %g1, %g2 |
| 104 | wrpr %g2, %tick |
| 105 | |
| 106 | set_hstick_cmpr: |
| 107 | add %g2, 0x200, %g2 |
| 108 | wrhpr %g2, %hsys_tick_cmpr !! err will be injected |
| 109 | |
| 110 | wrhpr %g0, 0x0, %halt |
| 111 | |
| 112 | |
| 113 | ! Turn on IE bit |
| 114 | rdpr %pstate, %l1 |
| 115 | wrpr %l1, 0x2, %pstate |
| 116 | |
| 117 | add %i2, 10, %i3 |
| 118 | add %i2, 10, %i3 |
| 119 | add %i2, 10, %i3 |
| 120 | add %i2, 10, %i3 |
| 121 | |
| 122 | |
| 123 | brnz %i0, FAIL ! chk hstick_cmpr trap not taken |
| 124 | brz %i1, FAIL !chk sw_recoverable trap is taken |
| 125 | nop |
| 126 | |
| 127 | rdhpr %hintp, %l1 |
| 128 | brnz %l1, FAIL |
| 129 | nop |
| 130 | |
| 131 | EXIT_GOOD |
| 132 | nop |
| 133 | |
| 134 | FAIL: |
| 135 | EXIT_BAD |
| 136 | nop |
| 137 | |
| 138 | /************************************************************************ |
| 139 | Test case data start |
| 140 | ************************************************************************/ |
| 141 | .data |
| 142 | user_data_start: |
| 143 | .word 0xB52E8698 |
| 144 | .end |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |