| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: niu_zcp_regs2.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 | |
| 45 | |
| 46 | |
| 47 | #define FZC_ZCP_BASE_ADDRESS 0x580000 |
| 48 | #define NIU_BASE_ADDRESS 0x8100000000 |
| 49 | #define ZCP_ADDRESS_RANGE mpeval(NIU_BASE_ADDRESS + FZC_ZCP_BASE_ADDRESS) |
| 50 | |
| 51 | #define ZCP_RDC_TBL 0x10000 |
| 52 | #define RDC_TBL mpeval(ZCP_ADDRESS_RANGE + ZCP_RDC_TBL) |
| 53 | |
| 54 | #define ZCP_CFIG 0x00000 |
| 55 | #define CFIG mpeval(ZCP_ADDRESS_RANGE + ZCP_CFIG) |
| 56 | |
| 57 | #define ZCP_INT_STAT_TEST 0x00108 |
| 58 | #define INT_STAT_TEST mpeval(ZCP_ADDRESS_RANGE + ZCP_INT_STAT_TEST) |
| 59 | |
| 60 | #define ZCP_INT_MASK 0x00010 |
| 61 | #define INT_MASK mpeval(ZCP_ADDRESS_RANGE + ZCP_INT_MASK) |
| 62 | |
| 63 | #define ZCP_BAM4BUF 0x00018 |
| 64 | #define ZCP_BAM8BUF 0x00020 |
| 65 | #define ZCP_BAM16BUF 0x00028 |
| 66 | #define ZCP_BAM32BUF 0x00030 |
| 67 | #define BAM4BUF mpeval(ZCP_ADDRESS_RANGE + ZCP_BAM4BUF) |
| 68 | |
| 69 | |
| 70 | #define ZCP_DST4BUF 0x00038 |
| 71 | #define ZCP_DST8BUF 0x00040 |
| 72 | #define ZCP_DST16BUF 0x00048 |
| 73 | #define ZCP_DST32BUF 0x00050 |
| 74 | #define DST4BUF mpeval(ZCP_ADDRESS_RANGE + ZCP_DST4BUF) |
| 75 | |
| 76 | #define ZCP_RAM_DATA0 0x00058 |
| 77 | #define ZCP_RAM_DATA1 0x00060 |
| 78 | #define ZCP_RAM_DATA2 0x00068 |
| 79 | #define ZCP_RAM_DATA3 0x00070 |
| 80 | #define ZCP_RAM_DATA4 0x00078 |
| 81 | #define RAM_DATA0 mpeval(ZCP_ADDRESS_RANGE + ZCP_RAM_DATA0) |
| 82 | |
| 83 | #define ZCP_RAM_BE0 0x00080 |
| 84 | #define RAM_BE0 mpeval(ZCP_ADDRESS_RANGE + ZCP_RAM_BE0) |
| 85 | |
| 86 | #define ZCP_RAM_ACC 0x00088 |
| 87 | #define RAM_ACC mpeval(ZCP_ADDRESS_RANGE + ZCP_RAM_ACC) |
| 88 | |
| 89 | #define ZCP_BIT_DATA 0x00090 |
| 90 | #define BIT_DATA mpeval(ZCP_ADDRESS_RANGE + ZCP_BIT_DATA) |
| 91 | |
| 92 | #define ZCP_RESET_CFIFO 0x00098 |
| 93 | #define RESET_CFIFO mpeval(ZCP_ADDRESS_RANGE + ZCP_RESET_CFIFO) |
| 94 | |
| 95 | #define ZCP_TRAINING_VECTOR 0x000c0 |
| 96 | #define TRAINING_VECTOR mpeval(ZCP_ADDRESS_RANGE + ZCP_TRAINING_VECTOR) |
| 97 | |
| 98 | /* |
| 99 | #define ZCP_CFIFO_ECC_PORT2 0x000b0 |
| 100 | #define CFIFO_ECC_PORT2 mpeval(ZCP_ADDRESS_RANGE + ZCP_CFIFO_ECC_PORT2) |
| 101 | */ |
| 102 | |
| 103 | #define DATA_EN_32BITS 0x00000000ffffffff |
| 104 | #define DATA_EN_31BITS 0x00000000ffffffff |
| 105 | #define DATA_EN_25BITS 0x0000000001ffffff |
| 106 | #define DATA_EN_20BITS 0x00000000000fffff |
| 107 | #define DATA_EN_17BITS 0x00000000000fffff |
| 108 | #define DATA_EN_16BITS 0x00000000000fffff |
| 109 | #define DATA_EN_14BITS 0x0000000000003fff |
| 110 | #define DATA_EN_10BITS 0x00000000000000ff |
| 111 | #define DATA_EN_8BITS 0x00000000000000ff |
| 112 | #define DATA_EN_7BITS 0x000000000000007f |
| 113 | #define DATA_EN_6BITS 0x000000000000003f |
| 114 | #define DATA_EN_4BITS 0x000000000000000f |
| 115 | |
| 116 | #define INT_STAT_TEST_DATA_MASK 0x000000000000cfff |
| 117 | |
| 118 | .text |
| 119 | .global main |
| 120 | |
| 121 | |
| 122 | main: |
| 123 | ta T_CHANGE_HPRIV |
| 124 | |
| 125 | get_th_id: |
| 126 | ta T_RD_THID |
| 127 | |
| 128 | cmp %o1,0x0 |
| 129 | bne test_pass |
| 130 | nop |
| 131 | |
| 132 | |
| 133 | |
| 134 | !Write then read data of ZCP_RDC_TBL count 64 step x8 |
| 135 | setx RDC_TBL,%g7,%g1 |
| 136 | setx wdata,%g7,%g2 |
| 137 | set 64,%g8 |
| 138 | |
| 139 | loop16: |
| 140 | set 0x05,%g3 |
| 141 | loop17: |
| 142 | ldx [%g2],%g4 |
| 143 | stxa %g4,[%g1]ASI_PRIMARY_LITTLE |
| 144 | |
| 145 | ldxa [%g1]ASI_PRIMARY_LITTLE, %g5 |
| 146 | setx DATA_EN_4BITS, %g7, %g6 |
| 147 | and %g4, %g6, %g4 |
| 148 | |
| 149 | cmp %g4, %g5 |
| 150 | |
| 151 | bne %xcc, test_fail |
| 152 | |
| 153 | |
| 154 | add %g2,8,%g2 |
| 155 | sub %g3,1,%g3 |
| 156 | cmp %g3,%g0 |
| 157 | bne loop17 |
| 158 | nop |
| 159 | add %g1,8,%g1 |
| 160 | sub %g8,1, %g8 |
| 161 | %g8,%g0 |
| 162 | bne loop16 |
| 163 | nop |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | /****************************************************** |
| 170 | * Exit code |
| 171 | *******************************************************/ |
| 172 | |
| 173 | test_pass: |
| 174 | EXIT_GOOD |
| 175 | |
| 176 | test_fail: |
| 177 | EXIT_BAD |
| 178 | |
| 179 | |
| 180 | .data |
| 181 | .align 0x100 |
| 182 | wdata: |
| 183 | .xword 0xffffffffffffffff |
| 184 | .xword 0xaaaaaaaaaaaaaaaa |
| 185 | .xword 0x0000000000000000 |
| 186 | .xword 0x5555555555555555 |
| 187 | .xword 0x0123456789abcdef |
| 188 | |
| 189 | .end |