| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2013 Imagination Technologies |
|---|
| 3 | 4 | * Author: Paul Burton <paul.burton@mips.com> |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 6 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 7 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 8 | | - * option) any later version. |
|---|
| 9 | 5 | */ |
|---|
| 10 | 6 | |
|---|
| 11 | 7 | #include <linux/errno.h> |
|---|
| .. | .. |
|---|
| 118 | 114 | "Exclusive/OK", "Exclusive/Data" |
|---|
| 119 | 115 | }; |
|---|
| 120 | 116 | |
|---|
| 117 | +static char *cm2_l2_type[4] = { |
|---|
| 118 | + [0x0] = "None", |
|---|
| 119 | + [0x1] = "Tag RAM single/double ECC error", |
|---|
| 120 | + [0x2] = "Data RAM single/double ECC error", |
|---|
| 121 | + [0x3] = "WS RAM uncorrectable dirty parity" |
|---|
| 122 | +}; |
|---|
| 123 | + |
|---|
| 124 | +static char *cm2_l2_instr[32] = { |
|---|
| 125 | + [0x00] = "L2_NOP", |
|---|
| 126 | + [0x01] = "L2_ERR_CORR", |
|---|
| 127 | + [0x02] = "L2_TAG_INV", |
|---|
| 128 | + [0x03] = "L2_WS_CLEAN", |
|---|
| 129 | + [0x04] = "L2_RD_MDYFY_WR", |
|---|
| 130 | + [0x05] = "L2_WS_MRU", |
|---|
| 131 | + [0x06] = "L2_EVICT_LN2", |
|---|
| 132 | + [0x07] = "0x07", |
|---|
| 133 | + [0x08] = "L2_EVICT", |
|---|
| 134 | + [0x09] = "L2_REFL", |
|---|
| 135 | + [0x0a] = "L2_RD", |
|---|
| 136 | + [0x0b] = "L2_WR", |
|---|
| 137 | + [0x0c] = "L2_EVICT_MRU", |
|---|
| 138 | + [0x0d] = "L2_SYNC", |
|---|
| 139 | + [0x0e] = "L2_REFL_ERR", |
|---|
| 140 | + [0x0f] = "0x0f", |
|---|
| 141 | + [0x10] = "L2_INDX_WB_INV", |
|---|
| 142 | + [0x11] = "L2_INDX_LD_TAG", |
|---|
| 143 | + [0x12] = "L2_INDX_ST_TAG", |
|---|
| 144 | + [0x13] = "L2_INDX_ST_DATA", |
|---|
| 145 | + [0x14] = "L2_INDX_ST_ECC", |
|---|
| 146 | + [0x15] = "0x15", |
|---|
| 147 | + [0x16] = "0x16", |
|---|
| 148 | + [0x17] = "0x17", |
|---|
| 149 | + [0x18] = "L2_FTCH_AND_LCK", |
|---|
| 150 | + [0x19] = "L2_HIT_INV", |
|---|
| 151 | + [0x1a] = "L2_HIT_WB_INV", |
|---|
| 152 | + [0x1b] = "L2_HIT_WB", |
|---|
| 153 | + [0x1c] = "0x1c", |
|---|
| 154 | + [0x1d] = "0x1d", |
|---|
| 155 | + [0x1e] = "0x1e", |
|---|
| 156 | + [0x1f] = "0x1f" |
|---|
| 157 | +}; |
|---|
| 158 | + |
|---|
| 121 | 159 | static char *cm2_causes[32] = { |
|---|
| 122 | 160 | "None", "GC_WR_ERR", "GC_RD_ERR", "COH_WR_ERR", |
|---|
| 123 | 161 | "COH_RD_ERR", "MMIO_WR_ERR", "MMIO_RD_ERR", "0x07", |
|---|
| .. | .. |
|---|
| 125 | 163 | "0x0c", "0x0d", "0x0e", "0x0f", |
|---|
| 126 | 164 | "0x10", "INTVN_WR_ERR", "INTVN_RD_ERR", "0x13", |
|---|
| 127 | 165 | "0x14", "0x15", "0x16", "0x17", |
|---|
| 128 | | - "0x18", "0x19", "0x1a", "0x1b", |
|---|
| 166 | + "L2_RD_UNCORR", "L2_WR_UNCORR", "L2_CORR", "0x1b", |
|---|
| 129 | 167 | "0x1c", "0x1d", "0x1e", "0x1f" |
|---|
| 130 | 168 | }; |
|---|
| 131 | 169 | |
|---|
| .. | .. |
|---|
| 197 | 235 | write_gcr_l2_only_sync_base(addr | CM_GCR_L2_ONLY_SYNC_BASE_SYNCEN); |
|---|
| 198 | 236 | |
|---|
| 199 | 237 | /* Map the region */ |
|---|
| 200 | | - mips_cm_l2sync_base = ioremap_nocache(addr, MIPS_CM_L2SYNC_SIZE); |
|---|
| 238 | + mips_cm_l2sync_base = ioremap(addr, MIPS_CM_L2SYNC_SIZE); |
|---|
| 201 | 239 | } |
|---|
| 202 | 240 | |
|---|
| 203 | 241 | int mips_cm_probe(void) |
|---|
| .. | .. |
|---|
| 218 | 256 | if (!addr) |
|---|
| 219 | 257 | return -ENODEV; |
|---|
| 220 | 258 | |
|---|
| 221 | | - mips_gcr_base = ioremap_nocache(addr, MIPS_CM_GCR_SIZE); |
|---|
| 259 | + mips_gcr_base = ioremap(addr, MIPS_CM_GCR_SIZE); |
|---|
| 222 | 260 | if (!mips_gcr_base) |
|---|
| 223 | 261 | return -ENXIO; |
|---|
| 224 | 262 | |
|---|
| .. | .. |
|---|
| 363 | 401 | "CCA=%lu TR=%s MCmd=%s STag=%lu " |
|---|
| 364 | 402 | "SPort=%lu\n", cca_bits, cm2_tr[tr_bits], |
|---|
| 365 | 403 | cm2_cmd[cmd_bits], stag_bits, sport_bits); |
|---|
| 366 | | - } else { |
|---|
| 404 | + } else if (cause < 24) { |
|---|
| 367 | 405 | /* glob state & sresp together */ |
|---|
| 368 | 406 | unsigned long c3_bits = (cm_error >> 18) & 7; |
|---|
| 369 | 407 | unsigned long c2_bits = (cm_error >> 15) & 7; |
|---|
| .. | .. |
|---|
| 380 | 418 | cm2_core[c1_bits], cm2_core[c0_bits], |
|---|
| 381 | 419 | sc_bit ? "True" : "False", |
|---|
| 382 | 420 | cm2_cmd[cmd_bits], sport_bits); |
|---|
| 421 | + } else { |
|---|
| 422 | + unsigned long muc_bit = (cm_error >> 23) & 1; |
|---|
| 423 | + unsigned long ins_bits = (cm_error >> 18) & 0x1f; |
|---|
| 424 | + unsigned long arr_bits = (cm_error >> 16) & 3; |
|---|
| 425 | + unsigned long dw_bits = (cm_error >> 12) & 15; |
|---|
| 426 | + unsigned long way_bits = (cm_error >> 9) & 7; |
|---|
| 427 | + unsigned long mway_bit = (cm_error >> 8) & 1; |
|---|
| 428 | + unsigned long syn_bits = (cm_error >> 0) & 0xFF; |
|---|
| 429 | + |
|---|
| 430 | + snprintf(buf, sizeof(buf), |
|---|
| 431 | + "Type=%s%s Instr=%s DW=%lu Way=%lu " |
|---|
| 432 | + "MWay=%s Syndrome=0x%02lx", |
|---|
| 433 | + muc_bit ? "Multi-UC " : "", |
|---|
| 434 | + cm2_l2_type[arr_bits], |
|---|
| 435 | + cm2_l2_instr[ins_bits], dw_bits, way_bits, |
|---|
| 436 | + mway_bit ? "True" : "False", syn_bits); |
|---|
| 383 | 437 | } |
|---|
| 384 | | - pr_err("CM_ERROR=%08llx %s <%s>\n", cm_error, |
|---|
| 385 | | - cm2_causes[cause], buf); |
|---|
| 438 | + pr_err("CM_ERROR=%08llx %s <%s>\n", cm_error, |
|---|
| 439 | + cm2_causes[cause], buf); |
|---|
| 386 | 440 | pr_err("CM_ADDR =%08llx\n", cm_addr); |
|---|
| 387 | 441 | pr_err("CM_OTHER=%08llx %s\n", cm_other, cm2_causes[ocause]); |
|---|
| 388 | 442 | } else { /* CM3 */ |
|---|