1/* 2 * Copyright (c) 2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; 9 * redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution; 12 * neither the name of the copyright holders nor the names of its 13 * contributors may be used to endorse or promote products derived from 14 * this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * Authors: Gabe Black 29 * Ali Saidi 30 */ 31 32#include "arch/sparc/asi.hh" 33 34namespace SparcISA 35{ 36 37bool 38asiIsBlock(ASI asi) 39{ 40 return asi == ASI_BLK_AIUP || 41 asi == ASI_BLK_AIUS || 42 asi == ASI_BLK_AIUP_L || 43 asi == ASI_BLK_AIUS_L || 44 asi == ASI_BLK_P || 45 asi == ASI_BLK_S || 46 asi == ASI_BLK_PL || 47 asi == ASI_BLK_SL; 48} 49 50bool 51asiIsPrimary(ASI asi) 52{ 53 return asi == ASI_AIUP || 54 asi == ASI_BLK_AIUP || 55 asi == ASI_AIUP_L || 56 asi == ASI_BLK_AIUP_L || 57 asi == ASI_LDTX_AIUP || 58 asi == ASI_LDTX_AIUP_L || 59 asi == ASI_P || 60 asi == ASI_PNF || 61 asi == ASI_PL || 62 asi == ASI_PNFL || 63 asi == ASI_PST8_P || 64 asi == ASI_PST16_P || 65 asi == ASI_PST32_P || 66 asi == ASI_PST8_PL || 67 asi == ASI_PST16_PL || 68 asi == ASI_PST32_PL || 69 asi == ASI_FL8_P || 70 asi == ASI_FL16_P || 71 asi == ASI_FL8_PL || 72 asi == ASI_FL16_PL || 73 asi == ASI_LDTX_P || 74 asi == ASI_LDTX_PL || 75 asi == ASI_BLK_P || 76 asi == ASI_BLK_PL; 77} 78 79bool 80asiIsSecondary(ASI asi) 81{ 82 return asi == ASI_AIUS || 83 asi == ASI_BLK_AIUS || 84 asi == ASI_AIUS_L || 85 asi == ASI_BLK_AIUS_L || 86 asi == ASI_LDTX_AIUS || 87 asi == ASI_LDTX_AIUS_L || 88 asi == ASI_S || 89 asi == ASI_SNF || 90 asi == ASI_SL || 91 asi == ASI_SNFL || 92 asi == ASI_PST8_S || 93 asi == ASI_PST16_S || 94 asi == ASI_PST32_S || 95 asi == ASI_PST8_SL || 96 asi == ASI_PST16_SL || 97 asi == ASI_PST32_SL || 98 asi == ASI_FL8_S || 99 asi == ASI_FL16_S || 100 asi == ASI_FL8_SL || 101 asi == ASI_FL16_SL || 102 asi == ASI_LDTX_S || 103 asi == ASI_LDTX_SL || 104 asi == ASI_BLK_S || 105 asi == ASI_BLK_SL; 106} 107 108bool 109asiIsNucleus(ASI asi) 110{ 111 return asi == ASI_N || 112 asi == ASI_NL || 113 asi == ASI_LDTX_N || 114 asi == ASI_LDTX_NL; 115} 116 117bool 118asiIsAsIfUser(ASI asi) 119{ 120 return asi == ASI_AIUP || 121 asi == ASI_AIUS || 122 asi == ASI_BLK_AIUP || 123 asi == ASI_BLK_AIUS || 124 asi == ASI_AIUP_L || 125 asi == ASI_AIUS_L || 126 asi == ASI_BLK_AIUP_L || 127 asi == ASI_BLK_AIUS_L || 128 asi == ASI_LDTX_AIUP || 129 asi == ASI_LDTX_AIUS || 130 asi == ASI_LDTX_AIUP_L || 131 asi == ASI_LDTX_AIUS_L; 132} 133 134bool 135asiIsIO(ASI asi) 136{ 137 return asi == ASI_REAL_IO || 138 asi == ASI_REAL_IO_L; 139} 140 141bool 142asiIsReal(ASI asi) 143{ 144 return asi == ASI_REAL || 145 asi == ASI_REAL_IO || 146 asi == ASI_REAL_L || 147 asi == ASI_REAL_IO_L || 148 asi == ASI_LDTX_REAL || 149 asi == ASI_LDTX_REAL_L; 150} 151 152bool 153asiIsLittle(ASI asi) 154{ 155 return asi == ASI_NL || 156 asi == ASI_AIUP_L || 157 asi == ASI_AIUS_L || 158 asi == ASI_REAL_L || 159 asi == ASI_REAL_IO_L || 160 asi == ASI_BLK_AIUP_L || 161 asi == ASI_BLK_AIUS_L || 162 asi == ASI_LDTX_AIUP_L || 163 asi == ASI_LDTX_AIUS_L || 164 asi == ASI_LDTX_REAL_L || 165 asi == ASI_LDTX_NL || 166 asi == ASI_PL || 167 asi == ASI_SL || 168 asi == ASI_PNFL || 169 asi == ASI_SNFL || 170 asi == ASI_PST8_PL || 171 asi == ASI_PST8_SL || 172 asi == ASI_PST16_PL || 173 asi == ASI_PST16_SL || 174 asi == ASI_PST32_PL || 175 asi == ASI_PST32_SL || 176 asi == ASI_FL8_PL || 177 asi == ASI_FL8_SL || 178 asi == ASI_FL16_PL || 179 asi == ASI_FL16_SL || 180 asi == ASI_LDTX_PL || 181 asi == ASI_LDTX_SL || 182 asi == ASI_BLK_PL || 183 asi == ASI_BLK_SL || 184 asi == ASI_LTX_L; 185} 186 187bool 188asiIsTwin(ASI asi) 189{ 190 return (asi >= ASI_LDTX_AIUP && 191 asi <= ASI_LDTX_N && 192 asi != ASI_QUEUE) || 193 (asi >= ASI_LDTX_AIUP_L && 194 asi <= ASI_LDTX_NL && 195 asi != 0x2D) || 196 asi == ASI_LDTX_P || 197 asi == ASI_LDTX_S || 198 asi == ASI_LDTX_PL || 199 asi == ASI_LDTX_SL; 200} 201 202bool 203asiIsPartialStore(ASI asi) 204{ 205 return asi == ASI_PST8_P || 206 asi == ASI_PST8_S || 207 asi == ASI_PST16_P || 208 asi == ASI_PST16_S || 209 asi == ASI_PST32_P || 210 asi == ASI_PST32_S || 211 asi == ASI_PST8_PL || 212 asi == ASI_PST8_SL || 213 asi == ASI_PST16_PL || 214 asi == ASI_PST16_SL || 215 asi == ASI_PST32_PL || 216 asi == ASI_PST32_SL; 217} 218 219bool 220asiIsFloatingLoad(ASI asi) 221{ 222 return asi == ASI_FL8_P || 223 asi == ASI_FL8_S || 224 asi == ASI_FL16_P || 225 asi == ASI_FL16_S || 226 asi == ASI_FL8_PL || 227 asi == ASI_FL8_SL || 228 asi == ASI_FL16_PL || 229 asi == ASI_FL16_SL; 230} 231 232bool 233asiIsNoFault(ASI asi) 234{ 235 return asi == ASI_PNF || 236 asi == ASI_SNF || 237 asi == ASI_PNFL || 238 asi == ASI_SNFL; 239} 240 241bool 242asiIsScratchPad(ASI asi) 243{ 244 return asi == ASI_SCRATCHPAD || 245 asi == ASI_HYP_SCRATCHPAD; 246} 247 248bool 249asiIsCmt(ASI asi) 250{ 251 return asi == ASI_CMT_PER_STRAND || 252 asi == ASI_CMT_SHARED; 253} 254 255bool 256asiIsQueue(ASI asi) 257{ 258 return asi == ASI_QUEUE; 259} 260 261bool 262asiIsInterrupt(ASI asi) 263{ 264 return asi == ASI_SWVR_INTR_RECEIVE || 265 asi == ASI_SWVR_UDB_INTR_W || 266 asi == ASI_SWVR_UDB_INTR_R ; 267} 268 269bool 270asiIsMmu(ASI asi) 271{ 272 return asi == ASI_MMU || 273 asi == ASI_LSU_CONTROL_REG || 274 (asi >= ASI_DMMU_CTXT_ZERO_TSB_BASE_PS0 && 275 asi <= ASI_IMMU_CTXT_ZERO_CONFIG) || 276 (asi >= ASI_DMMU_CTXT_NONZERO_TSB_BASE_PS0 && 277 asi <= ASI_IMMU_CTXT_NONZERO_CONFIG) || 278 (asi >= ASI_IMMU && 279 asi <= ASI_IMMU_TSB_PS1_PTR_REG) || 280 (asi >= ASI_ITLB_DATA_IN_REG && 281 asi <= ASI_TLB_INVALIDATE_ALL); 282} 283 284bool 285asiIsUnPriv(ASI asi) 286{ 287 return asi >= 0x80; 288} 289 290bool 291asiIsPriv(ASI asi) 292{ 293 return asi <= 0x2f; 294} 295 296 297bool 298asiIsHPriv(ASI asi) 299{ 300 return asi >= 0x30 && asi <= 0x7f; 301} 302 303bool 304asiIsReg(ASI asi) 305{ 306 return asiIsMmu(asi) || asiIsScratchPad(asi) || 307 asiIsSparcError(asi) || asiIsInterrupt(asi) 308 || asiIsCmt(asi); 309} 310 311bool 312asiIsSparcError(ASI asi) 313{ 314 return asi == ASI_SPARC_ERROR_EN_REG || 315 asi == ASI_SPARC_ERROR_STATUS_REG; 316} 317 318} 319