| 1 |
// SPDX-License-Identifier: GPL-2.0 |
| 2 |
/* |
| 3 |
* Copyright (c) 2021-2025, NVIDIA CORPORATION. All rights reserved |
| 4 |
* |
| 5 |
* The driver handles Error's from Control Backbone(CBB) version 2.0. |
| 6 |
* generated due to illegal accesses. The driver prints debug information |
| 7 |
* about failed transaction on receiving interrupt from Error Notifier. |
| 8 |
* Error types supported by CBB2.0 are: |
| 9 |
* UNSUPPORTED_ERR, PWRDOWN_ERR, TIMEOUT_ERR, FIREWALL_ERR, DECODE_ERR, |
| 10 |
* TARGET_ERR |
| 11 |
*/ |
| 12 |
|
| 13 |
#include <linux/acpi.h> |
| 14 |
#include <linux/clk.h> |
| 15 |
#include <linux/cpufeature.h> |
| 16 |
#include <linux/debugfs.h> |
| 17 |
#include <linux/module.h> |
| 18 |
#include <linux/of.h> |
| 19 |
#include <linux/platform_device.h> |
| 20 |
#include <linux/device.h> |
| 21 |
#include <linux/io.h> |
| 22 |
#include <linux/interrupt.h> |
| 23 |
#include <linux/ioport.h> |
| 24 |
#include <soc/tegra/fuse.h> |
| 25 |
#include <soc/tegra/tegra-cbb.h> |
| 26 |
|
| 27 |
#define FABRIC_EN_CFG_INTERRUPT_ENABLE_0_0 0x0 |
| 28 |
#define FABRIC_EN_CFG_STATUS_0_0 0x40 |
| 29 |
#define FABRIC_EN_CFG_ADDR_INDEX_0_0 0x60 |
| 30 |
#define FABRIC_EN_CFG_ADDR_LOW_0 0x80 |
| 31 |
#define FABRIC_EN_CFG_ADDR_HI_0 0x84 |
| 32 |
|
| 33 |
#define FABRIC_EN_CFG_TARGET_NODE_ADDR_INDEX_0_0 0x100 |
| 34 |
#define FABRIC_EN_CFG_TARGET_NODE_ADDR_LOW_0 0x140 |
| 35 |
#define FABRIC_EN_CFG_TARGET_NODE_ADDR_HI_0 0x144 |
| 36 |
|
| 37 |
#define FABRIC_MN_INITIATOR_ERR_EN_0 0x200 |
| 38 |
#define FABRIC_MN_INITIATOR_ERR_FORCE_0 0x204 |
| 39 |
#define FABRIC_MN_INITIATOR_ERR_STATUS_0 0x208 |
| 40 |
#define FABRIC_MN_INITIATOR_ERR_OVERFLOW_STATUS_0 0x20c |
| 41 |
|
| 42 |
#define FABRIC_MN_INITIATOR_LOG_ERR_STATUS_0 0x300 |
| 43 |
#define FABRIC_MN_INITIATOR_LOG_ADDR_LOW_0 0x304 |
| 44 |
#define FABRIC_MN_INITIATOR_LOG_ADDR_HIGH_0 0x308 |
| 45 |
#define FABRIC_MN_INITIATOR_LOG_ATTRIBUTES0_0 0x30c |
| 46 |
#define FABRIC_MN_INITIATOR_LOG_ATTRIBUTES1_0 0x310 |
| 47 |
#define FABRIC_MN_INITIATOR_LOG_ATTRIBUTES2_0 0x314 |
| 48 |
#define FABRIC_MN_INITIATOR_LOG_USER_BITS0_0 0x318 |
| 49 |
|
| 50 |
#define AXI_SLV_TIMEOUT_STATUS_0_0 0x8 |
| 51 |
#define APB_BLOCK_TMO_STATUS_0 0xc00 |
| 52 |
#define APB_BLOCK_NUM_TMO_OFFSET 0x20 |
| 53 |
|
| 54 |
#define FAB_EM_EL_MSTRID GENMASK(29, 24) |
| 55 |
#define FAB_EM_EL_VQC GENMASK(17, 16) |
| 56 |
#define FAB_EM_EL_GRPSEC GENMASK(14, 8) |
| 57 |
#define FAB_EM_EL_FALCONSEC GENMASK(1, 0) |
| 58 |
|
| 59 |
#define FAB_EM_EL_FABID GENMASK(20, 16) |
| 60 |
#define FAB_EM_EL_TARGETID GENMASK(7, 0) |
| 61 |
|
| 62 |
#define FAB_EM_EL_ACCESSID GENMASK(7, 0) |
| 63 |
|
| 64 |
#define FAB_EM_EL_AXCACHE GENMASK(27, 24) |
| 65 |
#define FAB_EM_EL_AXPROT GENMASK(22, 20) |
| 66 |
#define FAB_EM_EL_BURSTLENGTH GENMASK(19, 12) |
| 67 |
#define FAB_EM_EL_BURSTTYPE GENMASK(9, 8) |
| 68 |
#define FAB_EM_EL_BEATSIZE GENMASK(6, 4) |
| 69 |
#define FAB_EM_EL_ACCESSTYPE GENMASK(0, 0) |
| 70 |
|
| 71 |
#define USRBITS_MSTR_ID GENMASK(29, 24) |
| 72 |
|
| 73 |
#define REQ_SOCKET_ID GENMASK(27, 24) |
| 74 |
|
| 75 |
#define CCPLEX_MSTRID 0x1 |
| 76 |
#define FIREWALL_APERTURE_SZ 0x10000 |
| 77 |
/* Write firewall check enable */ |
| 78 |
#define WEN 0x20000 |
| 79 |
|
| 80 |
enum tegra234_cbb_fabric_ids { |
| 81 |
T234_CBB_FABRIC_ID, |
| 82 |
T234_SCE_FABRIC_ID, |
| 83 |
T234_RCE_FABRIC_ID, |
| 84 |
T234_DCE_FABRIC_ID, |
| 85 |
T234_AON_FABRIC_ID, |
| 86 |
T234_PSC_FABRIC_ID, |
| 87 |
T234_BPMP_FABRIC_ID, |
| 88 |
T234_FSI_FABRIC_ID, |
| 89 |
T234_MAX_FABRIC_ID, |
| 90 |
}; |
| 91 |
|
| 92 |
enum tegra264_cbb_fabric_ids { |
| 93 |
T264_SYSTEM_CBB_FABRIC_ID, |
| 94 |
T264_TOP_0_CBB_FABRIC_ID, |
| 95 |
T264_VISION_CBB_FABRIC_ID, |
| 96 |
T264_DISP_USB_CBB_FABRIC_ID, |
| 97 |
T264_UPHY0_CBB_FABRIC_ID, |
| 98 |
T264_RSVD0_FABRIC_ID, |
| 99 |
T264_RSVD1_FABRIC_ID, |
| 100 |
T264_RSVD2_FABRIC_ID, |
| 101 |
T264_RSVD3_FABRIC_ID, |
| 102 |
T264_RSVD4_FABRIC_ID, |
| 103 |
T264_RSVD5_FABRIC_ID, |
| 104 |
T264_AON_FABRIC_ID, |
| 105 |
T264_PSC_FABRIC_ID, |
| 106 |
T264_OESP_FABRIC_ID, |
| 107 |
T264_APE_FABRIC_ID, |
| 108 |
T264_BPMP_FABRIC_ID, |
| 109 |
T264_RCE_0_FABRIC_ID, |
| 110 |
T264_RCE_1_FABRIC_ID, |
| 111 |
T264_RSVD6_FABRIC_ID, |
| 112 |
T264_DCE_FABRIC_ID, |
| 113 |
T264_FSI_FABRIC_ID, |
| 114 |
T264_ISC_FABRIC_ID, |
| 115 |
T264_SB_FABRIC_ID, |
| 116 |
T264_ISC_CPU_FABRIC_ID, |
| 117 |
T264_RSVD7_FABRIC_ID, |
| 118 |
}; |
| 119 |
|
| 120 |
enum t254_cbb_fabric_ids { |
| 121 |
T254_DCE_FABRIC_ID = 19, |
| 122 |
T254_DISP_CLUSTER_FABRIC_ID = 25, |
| 123 |
T254_C2C_FABRIC_ID = 26, |
| 124 |
T254_GPU_FABRIC_ID = 27, |
| 125 |
T254_DISP_CLUSTER_1_FABRIC_ID = 28, |
| 126 |
T254_MAX_FABRIC_ID, |
| 127 |
}; |
| 128 |
|
| 129 |
struct tegra234_target_lookup { |
| 130 |
const char *name; |
| 131 |
unsigned int offset; |
| 132 |
}; |
| 133 |
|
| 134 |
struct tegra234_fabric_lookup { |
| 135 |
const char *name; |
| 136 |
bool is_lookup; |
| 137 |
const struct tegra234_target_lookup *target_map; |
| 138 |
const int max_targets; |
| 139 |
}; |
| 140 |
|
| 141 |
struct tegra234_cbb_fabric { |
| 142 |
int fab_id; |
| 143 |
phys_addr_t off_mask_erd; |
| 144 |
phys_addr_t firewall_base; |
| 145 |
unsigned int firewall_ctl; |
| 146 |
unsigned int firewall_wr_ctl; |
| 147 |
const char * const *initiator_id; |
| 148 |
unsigned int notifier_offset; |
| 149 |
const struct tegra_cbb_error *errors; |
| 150 |
const int max_errors; |
| 151 |
const struct tegra234_fabric_lookup *fab_list; |
| 152 |
const u32 err_intr_enbl; |
| 153 |
const u32 err_status_clr; |
| 154 |
}; |
| 155 |
|
| 156 |
struct tegra234_cbb { |
| 157 |
struct tegra_cbb base; |
| 158 |
|
| 159 |
const struct tegra234_cbb_fabric *fabric; |
| 160 |
struct resource *res; |
| 161 |
void __iomem *regs; |
| 162 |
|
| 163 |
int num_intr; |
| 164 |
int sec_irq; |
| 165 |
|
| 166 |
/* record */ |
| 167 |
void __iomem *mon; |
| 168 |
unsigned int type; |
| 169 |
u32 mask; |
| 170 |
u64 access; |
| 171 |
u32 mn_attr0; |
| 172 |
u32 mn_attr1; |
| 173 |
u32 mn_attr2; |
| 174 |
u32 mn_user_bits; |
| 175 |
}; |
| 176 |
|
| 177 |
static inline struct tegra234_cbb *to_tegra234_cbb(struct tegra_cbb *cbb) |
| 178 |
{ |
| 179 |
return container_of(cbb, struct tegra234_cbb, base); |
| 180 |
} |
| 181 |
|
| 182 |
static LIST_HEAD(cbb_list); |
| 183 |
static DEFINE_SPINLOCK(cbb_lock); |
| 184 |
|
| 185 |
static bool |
| 186 |
tegra234_cbb_write_access_allowed(struct platform_device *pdev, struct tegra234_cbb *cbb) |
| 187 |
{ |
| 188 |
u32 val; |
| 189 |
|
| 190 |
if (!cbb->fabric->firewall_base || |
| 191 |
!cbb->fabric->firewall_ctl || |
| 192 |
!cbb->fabric->firewall_wr_ctl) { |
| 193 |
dev_info(&pdev->dev, "SoC data missing for firewall\n"); |
| 194 |
return false; |
| 195 |
} |
| 196 |
|
| 197 |
if ((cbb->fabric->firewall_ctl > FIREWALL_APERTURE_SZ) || |
| 198 |
(cbb->fabric->firewall_wr_ctl > FIREWALL_APERTURE_SZ)) { |
| 199 |
dev_err(&pdev->dev, "wrong firewall offset value\n"); |
| 200 |
return false; |
| 201 |
} |
| 202 |
|
| 203 |
val = readl(cbb->regs + cbb->fabric->firewall_base + cbb->fabric->firewall_ctl); |
| 204 |
/* |
| 205 |
* If the firewall check feature for allowing or blocking the |
| 206 |
* write accesses through the firewall of a fabric is disabled |
| 207 |
* then CCPLEX can write to the registers of that fabric. |
| 208 |
*/ |
| 209 |
if (!(val & WEN)) |
| 210 |
return true; |
| 211 |
|
| 212 |
/* |
| 213 |
* If the firewall check is enabled then check whether CCPLEX |
| 214 |
* has write access to the fabric's error notifier registers |
| 215 |
*/ |
| 216 |
val = readl(cbb->regs + cbb->fabric->firewall_base + cbb->fabric->firewall_wr_ctl); |
| 217 |
if (val & (BIT(CCPLEX_MSTRID))) |
| 218 |
return true; |
| 219 |
|
| 220 |
return false; |
| 221 |
} |
| 222 |
|
| 223 |
static void tegra234_cbb_fault_enable(struct tegra_cbb *cbb) |
| 224 |
{ |
| 225 |
struct tegra234_cbb *priv = to_tegra234_cbb(cbb); |
| 226 |
void __iomem *addr; |
| 227 |
|
| 228 |
addr = priv->regs + priv->fabric->notifier_offset; |
| 229 |
writel(priv->fabric->err_intr_enbl, addr + FABRIC_EN_CFG_INTERRUPT_ENABLE_0_0); |
| 230 |
dsb(sy); |
| 231 |
} |
| 232 |
|
| 233 |
static void tegra234_cbb_error_clear(struct tegra_cbb *cbb) |
| 234 |
{ |
| 235 |
struct tegra234_cbb *priv = to_tegra234_cbb(cbb); |
| 236 |
|
| 237 |
writel(0, priv->mon + FABRIC_MN_INITIATOR_ERR_FORCE_0); |
| 238 |
|
| 239 |
writel(priv->fabric->err_status_clr, priv->mon + FABRIC_MN_INITIATOR_ERR_STATUS_0); |
| 240 |
dsb(sy); |
| 241 |
} |
| 242 |
|
| 243 |
static u32 tegra234_cbb_get_status(struct tegra_cbb *cbb) |
| 244 |
{ |
| 245 |
struct tegra234_cbb *priv = to_tegra234_cbb(cbb); |
| 246 |
void __iomem *addr; |
| 247 |
u32 value; |
| 248 |
|
| 249 |
addr = priv->regs + priv->fabric->notifier_offset; |
| 250 |
value = readl(addr + FABRIC_EN_CFG_STATUS_0_0); |
| 251 |
dsb(sy); |
| 252 |
|
| 253 |
return value; |
| 254 |
} |
| 255 |
|
| 256 |
static void tegra234_cbb_mask_serror(struct tegra234_cbb *cbb) |
| 257 |
{ |
| 258 |
writel(0x1, cbb->regs + cbb->fabric->off_mask_erd); |
| 259 |
dsb(sy); |
| 260 |
} |
| 261 |
|
| 262 |
static u32 tegra234_cbb_get_tmo_slv(void __iomem *addr) |
| 263 |
{ |
| 264 |
u32 timeout; |
| 265 |
|
| 266 |
timeout = readl(addr); |
| 267 |
return timeout; |
| 268 |
} |
| 269 |
|
| 270 |
static void tegra234_cbb_tmo_slv(struct seq_file *file, const char *target, void __iomem *addr, |
| 271 |
u32 status) |
| 272 |
{ |
| 273 |
tegra_cbb_print_err(file, "\t %s : %#x\n", target, status); |
| 274 |
} |
| 275 |
|
| 276 |
static void tegra234_cbb_lookup_apbslv(struct seq_file *file, const char *target, |
| 277 |
void __iomem *base) |
| 278 |
{ |
| 279 |
unsigned int block = 0; |
| 280 |
void __iomem *addr; |
| 281 |
char name[64]; |
| 282 |
u32 status; |
| 283 |
|
| 284 |
status = tegra234_cbb_get_tmo_slv(base); |
| 285 |
if (status) |
| 286 |
tegra_cbb_print_err(file, "\t %s_BLOCK_TMO_STATUS : %#x\n", target, status); |
| 287 |
|
| 288 |
while (status) { |
| 289 |
if (status & BIT(0)) { |
| 290 |
u32 timeout, clients, client = 0; |
| 291 |
|
| 292 |
addr = base + APB_BLOCK_NUM_TMO_OFFSET + (block * 4); |
| 293 |
timeout = tegra234_cbb_get_tmo_slv(addr); |
| 294 |
clients = timeout; |
| 295 |
|
| 296 |
while (timeout) { |
| 297 |
if (timeout & BIT(0)) { |
| 298 |
if (clients != 0xffffffff) |
| 299 |
clients &= BIT(client); |
| 300 |
|
| 301 |
sprintf(name, "%s_BLOCK%d_TMO", target, block); |
| 302 |
|
| 303 |
tegra234_cbb_tmo_slv(file, name, addr, clients); |
| 304 |
} |
| 305 |
|
| 306 |
timeout >>= 1; |
| 307 |
client++; |
| 308 |
} |
| 309 |
} |
| 310 |
|
| 311 |
status >>= 1; |
| 312 |
block++; |
| 313 |
} |
| 314 |
} |
| 315 |
|
| 316 |
static struct tegra234_cbb *tegra234_cbb_get_fabric(u8 fab_id) |
| 317 |
{ |
| 318 |
struct tegra_cbb *entry; |
| 319 |
|
| 320 |
list_for_each_entry(entry, &cbb_list, node) { |
| 321 |
struct tegra234_cbb *priv = to_tegra234_cbb(entry); |
| 322 |
|
| 323 |
if (priv->fabric->fab_id == fab_id) |
| 324 |
return priv; |
| 325 |
} |
| 326 |
|
| 327 |
return NULL; |
| 328 |
} |
| 329 |
|
| 330 |
static void tegra234_sw_lookup_target_timeout(struct seq_file *file, struct tegra234_cbb *cbb, |
| 331 |
u8 target_id, u8 fab_id) |
| 332 |
{ |
| 333 |
const struct tegra234_target_lookup *map = cbb->fabric->fab_list[fab_id].target_map; |
| 334 |
struct tegra234_cbb *target_cbb = NULL; |
| 335 |
void __iomem *addr; |
| 336 |
|
| 337 |
if (fab_id == cbb->fabric->fab_id) |
| 338 |
target_cbb = cbb; |
| 339 |
else |
| 340 |
target_cbb = tegra234_cbb_get_fabric(fab_id); |
| 341 |
|
| 342 |
if (!target_cbb) { |
| 343 |
dev_err(cbb->base.dev, "could not find fabric for fab_id:%d\n", fab_id); |
| 344 |
return; |
| 345 |
} |
| 346 |
|
| 347 |
if (target_id >= cbb->fabric->fab_list[fab_id].max_targets) { |
| 348 |
tegra_cbb_print_err(file, "\t Invalid target_id:%d\n", target_id); |
| 349 |
return; |
| 350 |
} |
| 351 |
|
| 352 |
/* |
| 353 |
* 1) Get target node name and address mapping using target_id. |
| 354 |
* 2) Check if the timed out target node is APB or AXI. |
| 355 |
* 3) If AXI, then print timeout register and reset axi target |
| 356 |
* using <FABRIC>_SN_<>_SLV_TIMEOUT_STATUS_0_0 register. |
| 357 |
* 4) If APB, then perform an additional lookup to find the client |
| 358 |
* which timed out. |
| 359 |
* a) Get block number from the index of set bit in |
| 360 |
* <FABRIC>_SN_AXI2APB_<>_BLOCK_TMO_STATUS_0 register. |
| 361 |
* b) Get address of register respective to block number i.e. |
| 362 |
* <FABRIC>_SN_AXI2APB_<>_BLOCK<index-set-bit>_TMO_0. |
| 363 |
* c) Read the register in above step to get client_id which |
| 364 |
* timed out as per the set bits. |
| 365 |
* d) Reset the timedout client and print details. |
| 366 |
* e) Goto step-a till all bits are set. |
| 367 |
*/ |
| 368 |
|
| 369 |
addr = target_cbb->regs + map[target_id].offset; |
| 370 |
|
| 371 |
if (strstr(map[target_id].name, "AXI2APB")) { |
| 372 |
addr += APB_BLOCK_TMO_STATUS_0; |
| 373 |
|
| 374 |
tegra234_cbb_lookup_apbslv(file, map[target_id].name, addr); |
| 375 |
} else { |
| 376 |
char name[64]; |
| 377 |
u32 status; |
| 378 |
|
| 379 |
addr += AXI_SLV_TIMEOUT_STATUS_0_0; |
| 380 |
|
| 381 |
status = tegra234_cbb_get_tmo_slv(addr); |
| 382 |
if (status) { |
| 383 |
sprintf(name, "%s_SLV_TIMEOUT_STATUS", map[target_id].name); |
| 384 |
tegra234_cbb_tmo_slv(file, name, addr, status); |
| 385 |
} |
| 386 |
} |
| 387 |
} |
| 388 |
|
| 389 |
static void tegra234_hw_lookup_target_timeout(struct seq_file *file, struct tegra234_cbb *cbb, |
| 390 |
u8 target_id, u8 fab_id) |
| 391 |
{ |
| 392 |
unsigned int notifier = cbb->fabric->notifier_offset; |
| 393 |
u32 hi, lo; |
| 394 |
u64 addr; |
| 395 |
|
| 396 |
writel(target_id, cbb->regs + notifier + FABRIC_EN_CFG_TARGET_NODE_ADDR_INDEX_0_0); |
| 397 |
|
| 398 |
hi = readl(cbb->regs + notifier + FABRIC_EN_CFG_TARGET_NODE_ADDR_HI_0); |
| 399 |
lo = readl(cbb->regs + notifier + FABRIC_EN_CFG_TARGET_NODE_ADDR_LOW_0); |
| 400 |
|
| 401 |
addr = (u64)hi << 32 | lo; |
| 402 |
|
| 403 |
tegra_cbb_print_err(file, "\t Target Node Addr : %#llx\n", addr); |
| 404 |
} |
| 405 |
|
| 406 |
static void tegra234_cbb_print_error(struct seq_file *file, struct tegra234_cbb *cbb, u32 status, |
| 407 |
u32 overflow) |
| 408 |
{ |
| 409 |
unsigned int type = 0; |
| 410 |
|
| 411 |
if (status & (status - 1)) |
| 412 |
tegra_cbb_print_err(file, "\t Multiple type of errors reported\n"); |
| 413 |
|
| 414 |
while (status) { |
| 415 |
if (type >= cbb->fabric->max_errors) { |
| 416 |
tegra_cbb_print_err(file, "\t Wrong type index:%u, status:%u\n", |
| 417 |
type, status); |
| 418 |
return; |
| 419 |
} |
| 420 |
|
| 421 |
if (status & 0x1) |
| 422 |
tegra_cbb_print_err(file, "\t Error Code\t\t: %s\n", |
| 423 |
cbb->fabric->errors[type].code); |
| 424 |
|
| 425 |
status >>= 1; |
| 426 |
type++; |
| 427 |
} |
| 428 |
|
| 429 |
type = 0; |
| 430 |
|
| 431 |
while (overflow) { |
| 432 |
if (type >= cbb->fabric->max_errors) { |
| 433 |
tegra_cbb_print_err(file, "\t Wrong type index:%u, overflow:%u\n", |
| 434 |
type, overflow); |
| 435 |
return; |
| 436 |
} |
| 437 |
|
| 438 |
if (overflow & 0x1) |
| 439 |
tegra_cbb_print_err(file, "\t Overflow\t\t: Multiple %s\n", |
| 440 |
cbb->fabric->errors[type].code); |
| 441 |
|
| 442 |
overflow >>= 1; |
| 443 |
type++; |
| 444 |
} |
| 445 |
} |
| 446 |
|
| 447 |
static void print_errlog_err(struct seq_file *file, struct tegra234_cbb *cbb) |
| 448 |
{ |
| 449 |
u8 cache_type, prot_type, burst_length, mstr_id, grpsec, vqc, falconsec, beat_size; |
| 450 |
u8 access_type, access_id, requester_socket_id, local_socket_id, target_id, fab_id; |
| 451 |
bool is_numa = false; |
| 452 |
u8 burst_type; |
| 453 |
|
| 454 |
if (num_possible_nodes() > 1) |
| 455 |
is_numa = true; |
| 456 |
|
| 457 |
mstr_id = FIELD_GET(FAB_EM_EL_MSTRID, cbb->mn_user_bits); |
| 458 |
vqc = FIELD_GET(FAB_EM_EL_VQC, cbb->mn_user_bits); |
| 459 |
grpsec = FIELD_GET(FAB_EM_EL_GRPSEC, cbb->mn_user_bits); |
| 460 |
falconsec = FIELD_GET(FAB_EM_EL_FALCONSEC, cbb->mn_user_bits); |
| 461 |
|
| 462 |
/* |
| 463 |
* For SOC with multiple NUMA nodes, print cross socket access |
| 464 |
* errors only if initiator_id is CCPLEX, CPMU or GPU. |
| 465 |
*/ |
| 466 |
if (is_numa) { |
| 467 |
local_socket_id = numa_node_id(); |
| 468 |
requester_socket_id = FIELD_GET(REQ_SOCKET_ID, cbb->mn_attr2); |
| 469 |
|
| 470 |
if (requester_socket_id != local_socket_id) { |
| 471 |
if ((mstr_id != 0x1) && (mstr_id != 0x2) && (mstr_id != 0xB)) |
| 472 |
return; |
| 473 |
} |
| 474 |
} |
| 475 |
|
| 476 |
fab_id = FIELD_GET(FAB_EM_EL_FABID, cbb->mn_attr2); |
| 477 |
target_id = FIELD_GET(FAB_EM_EL_TARGETID, cbb->mn_attr2); |
| 478 |
|
| 479 |
access_id = FIELD_GET(FAB_EM_EL_ACCESSID, cbb->mn_attr1); |
| 480 |
|
| 481 |
cache_type = FIELD_GET(FAB_EM_EL_AXCACHE, cbb->mn_attr0); |
| 482 |
prot_type = FIELD_GET(FAB_EM_EL_AXPROT, cbb->mn_attr0); |
| 483 |
burst_length = FIELD_GET(FAB_EM_EL_BURSTLENGTH, cbb->mn_attr0); |
| 484 |
burst_type = FIELD_GET(FAB_EM_EL_BURSTTYPE, cbb->mn_attr0); |
| 485 |
beat_size = FIELD_GET(FAB_EM_EL_BEATSIZE, cbb->mn_attr0); |
| 486 |
access_type = FIELD_GET(FAB_EM_EL_ACCESSTYPE, cbb->mn_attr0); |
| 487 |
|
| 488 |
tegra_cbb_print_err(file, "\n"); |
| 489 |
if (cbb->type < cbb->fabric->max_errors) |
| 490 |
tegra_cbb_print_err(file, "\t Error Code\t\t: %s\n", |
| 491 |
cbb->fabric->errors[cbb->type].code); |
| 492 |
else |
| 493 |
tegra_cbb_print_err(file, "\t Wrong type index:%u\n", cbb->type); |
| 494 |
|
| 495 |
tegra_cbb_print_err(file, "\t Initiator_Id\t\t: %#x\n", mstr_id); |
| 496 |
if (cbb->fabric->initiator_id) |
| 497 |
tegra_cbb_print_err(file, "\t Initiator\t\t: %s\n", |
| 498 |
cbb->fabric->initiator_id[mstr_id]); |
| 499 |
|
| 500 |
tegra_cbb_print_err(file, "\t Address\t\t: %#llx\n", cbb->access); |
| 501 |
|
| 502 |
tegra_cbb_print_cache(file, cache_type); |
| 503 |
tegra_cbb_print_prot(file, prot_type); |
| 504 |
|
| 505 |
tegra_cbb_print_err(file, "\t Access_Type\t\t: %s", (access_type) ? "Write\n" : "Read\n"); |
| 506 |
tegra_cbb_print_err(file, "\t Access_ID\t\t: %#x\n", access_id); |
| 507 |
|
| 508 |
if (is_numa) { |
| 509 |
tegra_cbb_print_err(file, "\t Requester_Socket_Id\t: %#x\n", |
| 510 |
requester_socket_id); |
| 511 |
tegra_cbb_print_err(file, "\t Local_Socket_Id\t: %#x\n", |
| 512 |
local_socket_id); |
| 513 |
tegra_cbb_print_err(file, "\t No. of NUMA_NODES\t: %#x\n", |
| 514 |
num_possible_nodes()); |
| 515 |
} |
| 516 |
|
| 517 |
tegra_cbb_print_err(file, "\t Fabric\t\t: %s (id:%#x)\n", |
| 518 |
cbb->fabric->fab_list[fab_id].name, fab_id); |
| 519 |
|
| 520 |
if (of_machine_is_compatible("nvidia,tegra264") && fab_id == T264_UPHY0_CBB_FABRIC_ID) { |
| 521 |
/* |
| 522 |
* In T264, AON Fabric ID value is incorrectly same as UPHY0 fabric ID. |
| 523 |
* For 'ID = 0x4', we must check for the address which caused the error |
| 524 |
* to find the correct fabric which returned error. |
| 525 |
*/ |
| 526 |
tegra_cbb_print_err(file, "\t or Fabric\t\t: %s\n", |
| 527 |
cbb->fabric->fab_list[T264_AON_FABRIC_ID].name); |
| 528 |
tegra_cbb_print_err(file, "\t Please use Address to determine correct fabric.\n"); |
| 529 |
} |
| 530 |
|
| 531 |
tegra_cbb_print_err(file, "\t Target_Id\t\t: %#x\n", target_id); |
| 532 |
tegra_cbb_print_err(file, "\t Burst_length\t\t: %#x\n", burst_length); |
| 533 |
tegra_cbb_print_err(file, "\t Burst_type\t\t: %#x\n", burst_type); |
| 534 |
tegra_cbb_print_err(file, "\t Beat_size\t\t: %#x\n", beat_size); |
| 535 |
tegra_cbb_print_err(file, "\t VQC\t\t\t: %#x\n", vqc); |
| 536 |
tegra_cbb_print_err(file, "\t GRPSEC\t\t: %#x\n", grpsec); |
| 537 |
tegra_cbb_print_err(file, "\t FALCONSEC\t\t: %#x\n", falconsec); |
| 538 |
|
| 539 |
if (!cbb->fabric->fab_list[fab_id].is_lookup) |
| 540 |
return; |
| 541 |
|
| 542 |
/* |
| 543 |
* If is_lookup field is set in fabric_lookup table of soc data, it |
| 544 |
* means that address lookup of target is supported for Timeout errors. |
| 545 |
* If is_lookup is set and the target_map is not populated making |
| 546 |
* max_targets as zero, then it means HW lookup is to be performed. |
| 547 |
*/ |
| 548 |
if (!strcmp(cbb->fabric->errors[cbb->type].code, "TIMEOUT_ERR")) { |
| 549 |
if (cbb->fabric->fab_list[fab_id].max_targets) |
| 550 |
tegra234_sw_lookup_target_timeout(file, cbb, target_id, fab_id); |
| 551 |
else |
| 552 |
tegra234_hw_lookup_target_timeout(file, cbb, target_id, fab_id); |
| 553 |
} |
| 554 |
|
| 555 |
return; |
| 556 |
} |
| 557 |
|
| 558 |
static int print_errmonX_info(struct seq_file *file, struct tegra234_cbb *cbb) |
| 559 |
{ |
| 560 |
u32 overflow, status, error; |
| 561 |
|
| 562 |
status = readl(cbb->mon + FABRIC_MN_INITIATOR_ERR_STATUS_0); |
| 563 |
if (!status) { |
| 564 |
pr_err("Error Notifier received a spurious notification\n"); |
| 565 |
return -ENODATA; |
| 566 |
} |
| 567 |
|
| 568 |
if (status == 0xffffffff) { |
| 569 |
pr_err("CBB registers returning all 1's which is invalid\n"); |
| 570 |
return -EINVAL; |
| 571 |
} |
| 572 |
|
| 573 |
overflow = readl(cbb->mon + FABRIC_MN_INITIATOR_ERR_OVERFLOW_STATUS_0); |
| 574 |
|
| 575 |
tegra234_cbb_print_error(file, cbb, status, overflow); |
| 576 |
|
| 577 |
error = readl(cbb->mon + FABRIC_MN_INITIATOR_LOG_ERR_STATUS_0); |
| 578 |
if (!error) { |
| 579 |
pr_info("Error Monitor doesn't have Error Logger\n"); |
| 580 |
return -EINVAL; |
| 581 |
} |
| 582 |
|
| 583 |
cbb->type = 0; |
| 584 |
|
| 585 |
while (error) { |
| 586 |
if (error & BIT(0)) { |
| 587 |
u32 hi, lo; |
| 588 |
|
| 589 |
hi = readl(cbb->mon + FABRIC_MN_INITIATOR_LOG_ADDR_HIGH_0); |
| 590 |
lo = readl(cbb->mon + FABRIC_MN_INITIATOR_LOG_ADDR_LOW_0); |
| 591 |
|
| 592 |
cbb->access = (u64)hi << 32 | lo; |
| 593 |
|
| 594 |
cbb->mn_attr0 = readl(cbb->mon + FABRIC_MN_INITIATOR_LOG_ATTRIBUTES0_0); |
| 595 |
cbb->mn_attr1 = readl(cbb->mon + FABRIC_MN_INITIATOR_LOG_ATTRIBUTES1_0); |
| 596 |
cbb->mn_attr2 = readl(cbb->mon + FABRIC_MN_INITIATOR_LOG_ATTRIBUTES2_0); |
| 597 |
cbb->mn_user_bits = readl(cbb->mon + FABRIC_MN_INITIATOR_LOG_USER_BITS0_0); |
| 598 |
|
| 599 |
print_errlog_err(file, cbb); |
| 600 |
} |
| 601 |
|
| 602 |
cbb->type++; |
| 603 |
error >>= 1; |
| 604 |
} |
| 605 |
|
| 606 |
return 0; |
| 607 |
} |
| 608 |
|
| 609 |
static int print_err_notifier(struct seq_file *file, struct tegra234_cbb *cbb, u32 status) |
| 610 |
{ |
| 611 |
unsigned int index = 0; |
| 612 |
int err; |
| 613 |
|
| 614 |
pr_crit("**************************************\n"); |
| 615 |
pr_crit("CPU:%d, Error:%s, Errmon:%d\n", smp_processor_id(), |
| 616 |
cbb->fabric->fab_list[cbb->fabric->fab_id].name, status); |
| 617 |
|
| 618 |
while (status) { |
| 619 |
if (status & BIT(0)) { |
| 620 |
unsigned int notifier = cbb->fabric->notifier_offset; |
| 621 |
u32 hi, lo, mask = BIT(index); |
| 622 |
phys_addr_t addr; |
| 623 |
u64 offset; |
| 624 |
|
| 625 |
writel(mask, cbb->regs + notifier + FABRIC_EN_CFG_ADDR_INDEX_0_0); |
| 626 |
hi = readl(cbb->regs + notifier + FABRIC_EN_CFG_ADDR_HI_0); |
| 627 |
lo = readl(cbb->regs + notifier + FABRIC_EN_CFG_ADDR_LOW_0); |
| 628 |
|
| 629 |
addr = (u64)hi << 32 | lo; |
| 630 |
|
| 631 |
offset = addr - cbb->res->start; |
| 632 |
cbb->mon = cbb->regs + offset; |
| 633 |
cbb->mask = BIT(index); |
| 634 |
|
| 635 |
err = print_errmonX_info(file, cbb); |
| 636 |
tegra234_cbb_error_clear(&cbb->base); |
| 637 |
if (err) |
| 638 |
return err; |
| 639 |
tegra_cbb_print_err(file, "\t**************************************\n"); |
| 640 |
} |
| 641 |
|
| 642 |
status >>= 1; |
| 643 |
index++; |
| 644 |
} |
| 645 |
|
| 646 |
return 0; |
| 647 |
} |
| 648 |
|
| 649 |
#ifdef CONFIG_DEBUG_FS |
| 650 |
static DEFINE_MUTEX(cbb_debugfs_mutex); |
| 651 |
|
| 652 |
static int tegra234_cbb_debugfs_show(struct tegra_cbb *cbb, struct seq_file *file, void *data) |
| 653 |
{ |
| 654 |
int err = 0; |
| 655 |
|
| 656 |
mutex_lock(&cbb_debugfs_mutex); |
| 657 |
|
| 658 |
list_for_each_entry(cbb, &cbb_list, node) { |
| 659 |
struct tegra234_cbb *priv = to_tegra234_cbb(cbb); |
| 660 |
u32 status; |
| 661 |
|
| 662 |
status = tegra_cbb_get_status(&priv->base); |
| 663 |
if (status) { |
| 664 |
err = print_err_notifier(file, priv, status); |
| 665 |
if (err) |
| 666 |
break; |
| 667 |
} |
| 668 |
} |
| 669 |
|
| 670 |
mutex_unlock(&cbb_debugfs_mutex); |
| 671 |
return err; |
| 672 |
} |
| 673 |
#endif |
| 674 |
|
| 675 |
/* |
| 676 |
* Handler for CBB errors |
| 677 |
*/ |
| 678 |
static irqreturn_t tegra234_cbb_isr(int irq, void *data) |
| 679 |
{ |
| 680 |
bool is_inband_err = false; |
| 681 |
struct tegra_cbb *cbb; |
| 682 |
unsigned long flags; |
| 683 |
u8 mstr_id; |
| 684 |
int err; |
| 685 |
|
| 686 |
spin_lock_irqsave(&cbb_lock, flags); |
| 687 |
|
| 688 |
list_for_each_entry(cbb, &cbb_list, node) { |
| 689 |
struct tegra234_cbb *priv = to_tegra234_cbb(cbb); |
| 690 |
u32 status = tegra_cbb_get_status(cbb); |
| 691 |
|
| 692 |
if (status && (irq == priv->sec_irq)) { |
| 693 |
tegra_cbb_print_err(NULL, "CPU:%d, Error: %s@0x%llx, irq=%d\n", |
| 694 |
smp_processor_id(), |
| 695 |
priv->fabric->fab_list[priv->fabric->fab_id].name, |
| 696 |
priv->res->start, irq); |
| 697 |
|
| 698 |
err = print_err_notifier(NULL, priv, status); |
| 699 |
if (err) |
| 700 |
goto unlock; |
| 701 |
|
| 702 |
/* |
| 703 |
* If illegal request is from CCPLEX(id:0x1) initiator then call WARN() |
| 704 |
*/ |
| 705 |
if (priv->fabric->off_mask_erd) { |
| 706 |
mstr_id = FIELD_GET(USRBITS_MSTR_ID, priv->mn_user_bits); |
| 707 |
if (mstr_id == CCPLEX_MSTRID) |
| 708 |
is_inband_err = 1; |
| 709 |
} |
| 710 |
} |
| 711 |
} |
| 712 |
|
| 713 |
unlock: |
| 714 |
spin_unlock_irqrestore(&cbb_lock, flags); |
| 715 |
WARN_ON(is_inband_err); |
| 716 |
return IRQ_HANDLED; |
| 717 |
} |
| 718 |
|
| 719 |
/* |
| 720 |
* Register handler for CBB_SECURE interrupt for reporting errors |
| 721 |
*/ |
| 722 |
static int tegra234_cbb_interrupt_enable(struct tegra_cbb *cbb) |
| 723 |
{ |
| 724 |
struct tegra234_cbb *priv = to_tegra234_cbb(cbb); |
| 725 |
|
| 726 |
if (priv->sec_irq) { |
| 727 |
int err = devm_request_irq(cbb->dev, priv->sec_irq, tegra234_cbb_isr, 0, |
| 728 |
dev_name(cbb->dev), priv); |
| 729 |
if (err) { |
| 730 |
dev_err(cbb->dev, "failed to register interrupt %u: %d\n", priv->sec_irq, |
| 731 |
err); |
| 732 |
return err; |
| 733 |
} |
| 734 |
} |
| 735 |
|
| 736 |
return 0; |
| 737 |
} |
| 738 |
|
| 739 |
static void tegra234_cbb_error_enable(struct tegra_cbb *cbb) |
| 740 |
{ |
| 741 |
tegra_cbb_fault_enable(cbb); |
| 742 |
} |
| 743 |
|
| 744 |
static const struct tegra_cbb_ops tegra234_cbb_ops = { |
| 745 |
.get_status = tegra234_cbb_get_status, |
| 746 |
.error_clear = tegra234_cbb_error_clear, |
| 747 |
.fault_enable = tegra234_cbb_fault_enable, |
| 748 |
.error_enable = tegra234_cbb_error_enable, |
| 749 |
.interrupt_enable = tegra234_cbb_interrupt_enable, |
| 750 |
#ifdef CONFIG_DEBUG_FS |
| 751 |
.debugfs_show = tegra234_cbb_debugfs_show, |
| 752 |
#endif |
| 753 |
}; |
| 754 |
|
| 755 |
static const char * const tegra234_initiator_id[] = { |
| 756 |
[0x00] = "TZ", |
| 757 |
[0x01] = "CCPLEX", |
| 758 |
[0x02] = "CCPMU", |
| 759 |
[0x03] = "BPMP_FW", |
| 760 |
[0x04] = "AON", |
| 761 |
[0x05] = "SCE", |
| 762 |
[0x06] = "GPCDMA_P", |
| 763 |
[0x07] = "TSECA_NONSECURE", |
| 764 |
[0x08] = "TSECA_LIGHTSECURE", |
| 765 |
[0x09] = "TSECA_HEAVYSECURE", |
| 766 |
[0x0a] = "CORESIGHT", |
| 767 |
[0x0b] = "APE", |
| 768 |
[0x0c] = "PEATRANS", |
| 769 |
[0x0d] = "JTAGM_DFT", |
| 770 |
[0x0e] = "RCE", |
| 771 |
[0x0f] = "DCE", |
| 772 |
[0x10] = "PSC_FW_USER", |
| 773 |
[0x11] = "PSC_FW_SUPERVISOR", |
| 774 |
[0x12] = "PSC_FW_MACHINE", |
| 775 |
[0x13] = "PSC_BOOT", |
| 776 |
[0x14] = "BPMP_BOOT", |
| 777 |
[0x15] = "NVDEC_NONSECURE", |
| 778 |
[0x16] = "NVDEC_LIGHTSECURE", |
| 779 |
[0x17] = "NVDEC_HEAVYSECURE", |
| 780 |
[0x18] = "CBB_INTERNAL", |
| 781 |
[0x19] = "RSVD" |
| 782 |
}; |
| 783 |
|
| 784 |
static const struct tegra_cbb_error tegra234_cbb_errors[] = { |
| 785 |
{ |
| 786 |
.code = "TARGET_ERR", |
| 787 |
.desc = "Target being accessed responded with an error" |
| 788 |
}, { |
| 789 |
.code = "DECODE_ERR", |
| 790 |
.desc = "Attempt to access an address hole" |
| 791 |
}, { |
| 792 |
.code = "FIREWALL_ERR", |
| 793 |
.desc = "Attempt to access a region which is firewall protected" |
| 794 |
}, { |
| 795 |
.code = "TIMEOUT_ERR", |
| 796 |
.desc = "No response returned by target" |
| 797 |
}, { |
| 798 |
.code = "PWRDOWN_ERR", |
| 799 |
.desc = "Attempt to access a portion of fabric that is powered down" |
| 800 |
}, { |
| 801 |
.code = "UNSUPPORTED_ERR", |
| 802 |
.desc = "Attempt to access a target through an unsupported access" |
| 803 |
} |
| 804 |
}; |
| 805 |
|
| 806 |
static const struct tegra234_target_lookup tegra234_aon_target_map[] = { |
| 807 |
{ "AXI2APB", 0x00000 }, |
| 808 |
{ "AST", 0x14000 }, |
| 809 |
{ "CBB", 0x15000 }, |
| 810 |
{ "CPU", 0x16000 }, |
| 811 |
}; |
| 812 |
|
| 813 |
static const struct tegra234_target_lookup tegra234_bpmp_target_map[] = { |
| 814 |
{ "AXI2APB", 0x00000 }, |
| 815 |
{ "AST0", 0x15000 }, |
| 816 |
{ "AST1", 0x16000 }, |
| 817 |
{ "CBB", 0x17000 }, |
| 818 |
{ "CPU", 0x18000 }, |
| 819 |
}; |
| 820 |
|
| 821 |
static const struct tegra234_target_lookup tegra234_common_target_map[] = { |
| 822 |
{ "AXI2APB", 0x00000 }, |
| 823 |
{ "AST0", 0x15000 }, |
| 824 |
{ "AST1", 0x16000 }, |
| 825 |
{ "CBB", 0x17000 }, |
| 826 |
{ "RSVD", 0x00000 }, |
| 827 |
{ "CPU", 0x18000 }, |
| 828 |
}; |
| 829 |
|
| 830 |
static const struct tegra234_target_lookup tegra234_cbb_target_map[] = { |
| 831 |
{ "AON", 0x40000 }, |
| 832 |
{ "BPMP", 0x41000 }, |
| 833 |
{ "CBB", 0x42000 }, |
| 834 |
{ "HOST1X", 0x43000 }, |
| 835 |
{ "STM", 0x44000 }, |
| 836 |
{ "FSI", 0x45000 }, |
| 837 |
{ "PSC", 0x46000 }, |
| 838 |
{ "PCIE_C1", 0x47000 }, |
| 839 |
{ "PCIE_C2", 0x48000 }, |
| 840 |
{ "PCIE_C3", 0x49000 }, |
| 841 |
{ "PCIE_C0", 0x4a000 }, |
| 842 |
{ "PCIE_C4", 0x4b000 }, |
| 843 |
{ "GPU", 0x4c000 }, |
| 844 |
{ "SMMU0", 0x4d000 }, |
| 845 |
{ "SMMU1", 0x4e000 }, |
| 846 |
{ "SMMU2", 0x4f000 }, |
| 847 |
{ "SMMU3", 0x50000 }, |
| 848 |
{ "SMMU4", 0x51000 }, |
| 849 |
{ "PCIE_C10", 0x52000 }, |
| 850 |
{ "PCIE_C7", 0x53000 }, |
| 851 |
{ "PCIE_C8", 0x54000 }, |
| 852 |
{ "PCIE_C9", 0x55000 }, |
| 853 |
{ "PCIE_C5", 0x56000 }, |
| 854 |
{ "PCIE_C6", 0x57000 }, |
| 855 |
{ "DCE", 0x58000 }, |
| 856 |
{ "RCE", 0x59000 }, |
| 857 |
{ "SCE", 0x5a000 }, |
| 858 |
{ "AXI2APB_1", 0x70000 }, |
| 859 |
{ "AXI2APB_10", 0x71000 }, |
| 860 |
{ "AXI2APB_11", 0x72000 }, |
| 861 |
{ "AXI2APB_12", 0x73000 }, |
| 862 |
{ "AXI2APB_13", 0x74000 }, |
| 863 |
{ "AXI2APB_14", 0x75000 }, |
| 864 |
{ "AXI2APB_15", 0x76000 }, |
| 865 |
{ "AXI2APB_16", 0x77000 }, |
| 866 |
{ "AXI2APB_17", 0x78000 }, |
| 867 |
{ "AXI2APB_18", 0x79000 }, |
| 868 |
{ "AXI2APB_19", 0x7a000 }, |
| 869 |
{ "AXI2APB_2", 0x7b000 }, |
| 870 |
{ "AXI2APB_20", 0x7c000 }, |
| 871 |
{ "AXI2APB_21", 0x7d000 }, |
| 872 |
{ "AXI2APB_22", 0x7e000 }, |
| 873 |
{ "AXI2APB_23", 0x7f000 }, |
| 874 |
{ "AXI2APB_25", 0x80000 }, |
| 875 |
{ "AXI2APB_26", 0x81000 }, |
| 876 |
{ "AXI2APB_27", 0x82000 }, |
| 877 |
{ "AXI2APB_28", 0x83000 }, |
| 878 |
{ "AXI2APB_29", 0x84000 }, |
| 879 |
{ "AXI2APB_30", 0x85000 }, |
| 880 |
{ "AXI2APB_31", 0x86000 }, |
| 881 |
{ "AXI2APB_32", 0x87000 }, |
| 882 |
{ "AXI2APB_33", 0x88000 }, |
| 883 |
{ "AXI2APB_34", 0x89000 }, |
| 884 |
{ "AXI2APB_35", 0x92000 }, |
| 885 |
{ "AXI2APB_4", 0x8b000 }, |
| 886 |
{ "AXI2APB_5", 0x8c000 }, |
| 887 |
{ "AXI2APB_6", 0x8d000 }, |
| 888 |
{ "AXI2APB_7", 0x8e000 }, |
| 889 |
{ "AXI2APB_8", 0x8f000 }, |
| 890 |
{ "AXI2APB_9", 0x90000 }, |
| 891 |
{ "AXI2APB_3", 0x91000 }, |
| 892 |
}; |
| 893 |
|
| 894 |
static const struct tegra234_fabric_lookup tegra234_cbb_fab_list[] = { |
| 895 |
[T234_CBB_FABRIC_ID] = { "cbb-fabric", true, |
| 896 |
tegra234_cbb_target_map, |
| 897 |
ARRAY_SIZE(tegra234_cbb_target_map) }, |
| 898 |
[T234_SCE_FABRIC_ID] = { "sce-fabric", true, |
| 899 |
tegra234_common_target_map, |
| 900 |
ARRAY_SIZE(tegra234_common_target_map) }, |
| 901 |
[T234_RCE_FABRIC_ID] = { "rce-fabric", true, |
| 902 |
tegra234_common_target_map, |
| 903 |
ARRAY_SIZE(tegra234_common_target_map) }, |
| 904 |
[T234_DCE_FABRIC_ID] = { "dce-fabric", true, |
| 905 |
tegra234_common_target_map, |
| 906 |
ARRAY_SIZE(tegra234_common_target_map) }, |
| 907 |
[T234_AON_FABRIC_ID] = { "aon-fabric", true, |
| 908 |
tegra234_aon_target_map, |
| 909 |
ARRAY_SIZE(tegra234_aon_target_map) }, |
| 910 |
[T234_PSC_FABRIC_ID] = { "psc-fabric" }, |
| 911 |
[T234_BPMP_FABRIC_ID] = { "bpmp-fabric", true, |
| 912 |
tegra234_bpmp_target_map, |
| 913 |
ARRAY_SIZE(tegra234_bpmp_target_map) }, |
| 914 |
[T234_FSI_FABRIC_ID] = { "fsi-fabric" }, |
| 915 |
}; |
| 916 |
|
| 917 |
static const struct tegra234_cbb_fabric tegra234_aon_fabric = { |
| 918 |
.fab_id = T234_AON_FABRIC_ID, |
| 919 |
.fab_list = tegra234_cbb_fab_list, |
| 920 |
.initiator_id = tegra234_initiator_id, |
| 921 |
.errors = tegra234_cbb_errors, |
| 922 |
.max_errors = ARRAY_SIZE(tegra234_cbb_errors), |
| 923 |
.err_intr_enbl = 0x7, |
| 924 |
.err_status_clr = 0x3f, |
| 925 |
.notifier_offset = 0x17000, |
| 926 |
.firewall_base = 0x30000, |
| 927 |
.firewall_ctl = 0x8d0, |
| 928 |
.firewall_wr_ctl = 0x8c8, |
| 929 |
}; |
| 930 |
|
| 931 |
static const struct tegra234_cbb_fabric tegra234_bpmp_fabric = { |
| 932 |
.fab_id = T234_BPMP_FABRIC_ID, |
| 933 |
.fab_list = tegra234_cbb_fab_list, |
| 934 |
.initiator_id = tegra234_initiator_id, |
| 935 |
.errors = tegra234_cbb_errors, |
| 936 |
.max_errors = ARRAY_SIZE(tegra234_cbb_errors), |
| 937 |
.err_intr_enbl = 0xf, |
| 938 |
.err_status_clr = 0x3f, |
| 939 |
.notifier_offset = 0x19000, |
| 940 |
.firewall_base = 0x30000, |
| 941 |
.firewall_ctl = 0x8f0, |
| 942 |
.firewall_wr_ctl = 0x8e8, |
| 943 |
}; |
| 944 |
|
| 945 |
static const struct tegra234_cbb_fabric tegra234_cbb_fabric = { |
| 946 |
.fab_id = T234_CBB_FABRIC_ID, |
| 947 |
.fab_list = tegra234_cbb_fab_list, |
| 948 |
.initiator_id = tegra234_initiator_id, |
| 949 |
.errors = tegra234_cbb_errors, |
| 950 |
.max_errors = ARRAY_SIZE(tegra234_cbb_errors), |
| 951 |
.err_intr_enbl = 0x7f, |
| 952 |
.err_status_clr = 0x3f, |
| 953 |
.notifier_offset = 0x60000, |
| 954 |
.off_mask_erd = 0x3a004, |
| 955 |
.firewall_base = 0x10000, |
| 956 |
.firewall_ctl = 0x23f0, |
| 957 |
.firewall_wr_ctl = 0x23e8, |
| 958 |
}; |
| 959 |
|
| 960 |
static const struct tegra234_cbb_fabric tegra234_dce_fabric = { |
| 961 |
.fab_id = T234_DCE_FABRIC_ID, |
| 962 |
.fab_list = tegra234_cbb_fab_list, |
| 963 |
.initiator_id = tegra234_initiator_id, |
| 964 |
.errors = tegra234_cbb_errors, |
| 965 |
.max_errors = ARRAY_SIZE(tegra234_cbb_errors), |
| 966 |
.err_intr_enbl = 0xf, |
| 967 |
.err_status_clr = 0x3f, |
| 968 |
.notifier_offset = 0x19000, |
| 969 |
.firewall_base = 0x30000, |
| 970 |
.firewall_ctl = 0x290, |
| 971 |
.firewall_wr_ctl = 0x288, |
| 972 |
}; |
| 973 |
|
| 974 |
static const struct tegra234_cbb_fabric tegra234_rce_fabric = { |
| 975 |
.fab_id = T234_RCE_FABRIC_ID, |
| 976 |
.fab_list = tegra234_cbb_fab_list, |
| 977 |
.initiator_id = tegra234_initiator_id, |
| 978 |
.errors = tegra234_cbb_errors, |
| 979 |
.max_errors = ARRAY_SIZE(tegra234_cbb_errors), |
| 980 |
.err_intr_enbl = 0xf, |
| 981 |
.err_status_clr = 0x3f, |
| 982 |
.notifier_offset = 0x19000, |
| 983 |
.firewall_base = 0x30000, |
| 984 |
.firewall_ctl = 0x290, |
| 985 |
.firewall_wr_ctl = 0x288, |
| 986 |
}; |
| 987 |
|
| 988 |
static const struct tegra234_cbb_fabric tegra234_sce_fabric = { |
| 989 |
.fab_id = T234_SCE_FABRIC_ID, |
| 990 |
.fab_list = tegra234_cbb_fab_list, |
| 991 |
.initiator_id = tegra234_initiator_id, |
| 992 |
.errors = tegra234_cbb_errors, |
| 993 |
.max_errors = ARRAY_SIZE(tegra234_cbb_errors), |
| 994 |
.err_intr_enbl = 0xf, |
| 995 |
.err_status_clr = 0x3f, |
| 996 |
.notifier_offset = 0x19000, |
| 997 |
.firewall_base = 0x30000, |
| 998 |
.firewall_ctl = 0x290, |
| 999 |
.firewall_wr_ctl = 0x288, |
| 1000 |
}; |
| 1001 |
|
| 1002 |
static const char * const tegra241_initiator_id[] = { |
| 1003 |
[0x0] = "TZ", |
| 1004 |
[0x1] = "CCPLEX", |
| 1005 |
[0x2] = "CCPMU", |
| 1006 |
[0x3] = "BPMP_FW", |
| 1007 |
[0x4] = "PSC_FW_USER", |
| 1008 |
[0x5] = "PSC_FW_SUPERVISOR", |
| 1009 |
[0x6] = "PSC_FW_MACHINE", |
| 1010 |
[0x7] = "PSC_BOOT", |
| 1011 |
[0x8] = "BPMP_BOOT", |
| 1012 |
[0x9] = "JTAGM_DFT", |
| 1013 |
[0xa] = "CORESIGHT", |
| 1014 |
[0xb] = "GPU", |
| 1015 |
[0xc] = "PEATRANS", |
| 1016 |
[0xd ... 0x3f] = "RSVD" |
| 1017 |
}; |
| 1018 |
|
| 1019 |
/* |
| 1020 |
* Possible causes for Target and Timeout errors. |
| 1021 |
* TARGET_ERR: |
| 1022 |
* Target being accessed responded with an error. Target could return |
| 1023 |
* an error for various cases : |
| 1024 |
* Unsupported access, clamp setting when power gated, register |
| 1025 |
* level firewall(SCR), address hole within the target, etc |
| 1026 |
* |
| 1027 |
* TIMEOUT_ERR: |
| 1028 |
* No response returned by target. Can be due to target being clock |
| 1029 |
* gated, under reset, powered down or target inability to respond |
| 1030 |
* for an internal target issue |
| 1031 |
*/ |
| 1032 |
static const struct tegra_cbb_error tegra241_cbb_errors[] = { |
| 1033 |
{ |
| 1034 |
.code = "TARGET_ERR", |
| 1035 |
.desc = "Target being accessed responded with an error." |
| 1036 |
}, { |
| 1037 |
.code = "DECODE_ERR", |
| 1038 |
.desc = "Attempt to access an address hole or Reserved region of memory." |
| 1039 |
}, { |
| 1040 |
.code = "FIREWALL_ERR", |
| 1041 |
.desc = "Attempt to access a region which is firewalled." |
| 1042 |
}, { |
| 1043 |
.code = "TIMEOUT_ERR", |
| 1044 |
.desc = "No response returned by target." |
| 1045 |
}, { |
| 1046 |
.code = "PWRDOWN_ERR", |
| 1047 |
.desc = "Attempt to access a portion of the fabric that is powered down." |
| 1048 |
}, { |
| 1049 |
.code = "UNSUPPORTED_ERR", |
| 1050 |
.desc = "Attempt to access a target through an unsupported access." |
| 1051 |
}, { |
| 1052 |
.code = "POISON_ERR", |
| 1053 |
.desc = "Target responds with poison error to indicate error in data." |
| 1054 |
}, { |
| 1055 |
.code = "RSVD" |
| 1056 |
}, { |
| 1057 |
.code = "RSVD" |
| 1058 |
}, { |
| 1059 |
.code = "RSVD" |
| 1060 |
}, { |
| 1061 |
.code = "RSVD" |
| 1062 |
}, { |
| 1063 |
.code = "RSVD" |
| 1064 |
}, { |
| 1065 |
.code = "RSVD" |
| 1066 |
}, { |
| 1067 |
.code = "RSVD" |
| 1068 |
}, { |
| 1069 |
.code = "RSVD" |
| 1070 |
}, { |
| 1071 |
.code = "RSVD" |
| 1072 |
}, { |
| 1073 |
.code = "NO_SUCH_ADDRESS_ERR", |
| 1074 |
.desc = "The address belongs to the pri_target range but there is no register " |
| 1075 |
"implemented at the address." |
| 1076 |
}, { |
| 1077 |
.code = "TASK_ERR", |
| 1078 |
.desc = "Attempt to update a PRI task when the current task has still not " |
| 1079 |
"completed." |
| 1080 |
}, { |
| 1081 |
.code = "EXTERNAL_ERR", |
| 1082 |
.desc = "Indicates that an external PRI register access met with an error due to " |
| 1083 |
"any issue in the unit." |
| 1084 |
}, { |
| 1085 |
.code = "INDEX_ERR", |
| 1086 |
.desc = "Applicable to PRI index aperture pair, when the programmed index is " |
| 1087 |
"outside the range defined in the manual." |
| 1088 |
}, { |
| 1089 |
.code = "RESET_ERR", |
| 1090 |
.desc = "Target in Reset Error: Attempt to access a SubPri or external PRI " |
| 1091 |
"register but they are in reset." |
| 1092 |
}, { |
| 1093 |
.code = "REGISTER_RST_ERR", |
| 1094 |
.desc = "Attempt to access a PRI register but the register is partial or " |
| 1095 |
"completely in reset." |
| 1096 |
}, { |
| 1097 |
.code = "POWER_GATED_ERR", |
| 1098 |
.desc = "Returned by external PRI client when the external access goes to a power " |
| 1099 |
"gated domain." |
| 1100 |
}, { |
| 1101 |
.code = "SUBPRI_FS_ERR", |
| 1102 |
.desc = "Subpri is floorswept: Attempt to access a subpri through the main pri " |
| 1103 |
"target but subPri logic is floorswept." |
| 1104 |
}, { |
| 1105 |
.code = "SUBPRI_CLK_OFF_ERR", |
| 1106 |
.desc = "Subpri clock is off: Attempt to access a subpri through the main pri " |
| 1107 |
"target but subPris clock is gated/off." |
| 1108 |
}, |
| 1109 |
}; |
| 1110 |
|
| 1111 |
static const struct tegra234_target_lookup tegra241_bpmp_target_map[] = { |
| 1112 |
{ "RSVD", 0x00000 }, |
| 1113 |
{ "RSVD", 0x00000 }, |
| 1114 |
{ "RSVD", 0x00000 }, |
| 1115 |
{ "CBB", 0x15000 }, |
| 1116 |
{ "CPU", 0x16000 }, |
| 1117 |
{ "AXI2APB", 0x00000 }, |
| 1118 |
{ "DBB0", 0x17000 }, |
| 1119 |
{ "DBB1", 0x18000 }, |
| 1120 |
}; |
| 1121 |
|
| 1122 |
static const struct tegra234_target_lookup tegra241_cbb_target_map[] = { |
| 1123 |
{ "RSVD", 0x00000 }, |
| 1124 |
{ "PCIE_C8", 0x51000 }, |
| 1125 |
{ "PCIE_C9", 0x52000 }, |
| 1126 |
{ "RSVD", 0x00000 }, |
| 1127 |
{ "RSVD", 0x00000 }, |
| 1128 |
{ "RSVD", 0x00000 }, |
| 1129 |
{ "RSVD", 0x00000 }, |
| 1130 |
{ "RSVD", 0x00000 }, |
| 1131 |
{ "RSVD", 0x00000 }, |
| 1132 |
{ "RSVD", 0x00000 }, |
| 1133 |
{ "RSVD", 0x00000 }, |
| 1134 |
{ "AON", 0x5b000 }, |
| 1135 |
{ "BPMP", 0x5c000 }, |
| 1136 |
{ "RSVD", 0x00000 }, |
| 1137 |
{ "RSVD", 0x00000 }, |
| 1138 |
{ "PSC", 0x5d000 }, |
| 1139 |
{ "STM", 0x5e000 }, |
| 1140 |
{ "AXI2APB_1", 0x70000 }, |
| 1141 |
{ "AXI2APB_10", 0x71000 }, |
| 1142 |
{ "AXI2APB_11", 0x72000 }, |
| 1143 |
{ "AXI2APB_12", 0x73000 }, |
| 1144 |
{ "AXI2APB_13", 0x74000 }, |
| 1145 |
{ "AXI2APB_14", 0x75000 }, |
| 1146 |
{ "AXI2APB_15", 0x76000 }, |
| 1147 |
{ "AXI2APB_16", 0x77000 }, |
| 1148 |
{ "AXI2APB_17", 0x78000 }, |
| 1149 |
{ "AXI2APB_18", 0x79000 }, |
| 1150 |
{ "AXI2APB_19", 0x7a000 }, |
| 1151 |
{ "AXI2APB_2", 0x7b000 }, |
| 1152 |
{ "AXI2APB_20", 0x7c000 }, |
| 1153 |
{ "AXI2APB_4", 0x87000 }, |
| 1154 |
{ "AXI2APB_5", 0x88000 }, |
| 1155 |
{ "AXI2APB_6", 0x89000 }, |
| 1156 |
{ "AXI2APB_7", 0x8a000 }, |
| 1157 |
{ "AXI2APB_8", 0x8b000 }, |
| 1158 |
{ "AXI2APB_9", 0x8c000 }, |
| 1159 |
{ "AXI2APB_3", 0x8d000 }, |
| 1160 |
{ "AXI2APB_21", 0x7d000 }, |
| 1161 |
{ "AXI2APB_22", 0x7e000 }, |
| 1162 |
{ "AXI2APB_23", 0x7f000 }, |
| 1163 |
{ "AXI2APB_24", 0x80000 }, |
| 1164 |
{ "AXI2APB_25", 0x81000 }, |
| 1165 |
{ "AXI2APB_26", 0x82000 }, |
| 1166 |
{ "AXI2APB_27", 0x83000 }, |
| 1167 |
{ "AXI2APB_28", 0x84000 }, |
| 1168 |
{ "PCIE_C4", 0x53000 }, |
| 1169 |
{ "PCIE_C5", 0x54000 }, |
| 1170 |
{ "PCIE_C6", 0x55000 }, |
| 1171 |
{ "PCIE_C7", 0x56000 }, |
| 1172 |
{ "PCIE_C2", 0x57000 }, |
| 1173 |
{ "PCIE_C3", 0x58000 }, |
| 1174 |
{ "PCIE_C0", 0x59000 }, |
| 1175 |
{ "PCIE_C1", 0x5a000 }, |
| 1176 |
{ "CCPLEX", 0x50000 }, |
| 1177 |
{ "AXI2APB_29", 0x85000 }, |
| 1178 |
{ "AXI2APB_30", 0x86000 }, |
| 1179 |
{ "CBB_CENTRAL", 0x00000 }, |
| 1180 |
{ "AXI2APB_31", 0x8E000 }, |
| 1181 |
{ "AXI2APB_32", 0x8F000 }, |
| 1182 |
}; |
| 1183 |
|
| 1184 |
static const struct tegra234_fabric_lookup tegra241_cbb_fab_list[] = { |
| 1185 |
[T234_CBB_FABRIC_ID] = { "cbb-fabric", true, |
| 1186 |
tegra241_cbb_target_map, ARRAY_SIZE(tegra241_cbb_target_map) }, |
| 1187 |
[T234_BPMP_FABRIC_ID] = { "bpmp-fabric", true, |
| 1188 |
tegra241_bpmp_target_map, ARRAY_SIZE(tegra241_bpmp_target_map) }, |
| 1189 |
}; |
| 1190 |
static const struct tegra234_cbb_fabric tegra241_cbb_fabric = { |
| 1191 |
.fab_id = T234_CBB_FABRIC_ID, |
| 1192 |
.fab_list = tegra241_cbb_fab_list, |
| 1193 |
.initiator_id = tegra241_initiator_id, |
| 1194 |
.errors = tegra241_cbb_errors, |
| 1195 |
.max_errors = ARRAY_SIZE(tegra241_cbb_errors), |
| 1196 |
.err_intr_enbl = 0x7, |
| 1197 |
.err_status_clr = 0x1ff007f, |
| 1198 |
.notifier_offset = 0x60000, |
| 1199 |
.off_mask_erd = 0x40004, |
| 1200 |
.firewall_base = 0x20000, |
| 1201 |
.firewall_ctl = 0x2370, |
| 1202 |
.firewall_wr_ctl = 0x2368, |
| 1203 |
}; |
| 1204 |
|
| 1205 |
static const struct tegra234_cbb_fabric tegra241_bpmp_fabric = { |
| 1206 |
.fab_id = T234_BPMP_FABRIC_ID, |
| 1207 |
.fab_list = tegra241_cbb_fab_list, |
| 1208 |
.initiator_id = tegra241_initiator_id, |
| 1209 |
.errors = tegra241_cbb_errors, |
| 1210 |
.max_errors = ARRAY_SIZE(tegra241_cbb_errors), |
| 1211 |
.err_intr_enbl = 0xf, |
| 1212 |
.err_status_clr = 0x1ff007f, |
| 1213 |
.notifier_offset = 0x19000, |
| 1214 |
.firewall_base = 0x30000, |
| 1215 |
.firewall_ctl = 0x8f0, |
| 1216 |
.firewall_wr_ctl = 0x8e8, |
| 1217 |
}; |
| 1218 |
|
| 1219 |
static const char * const tegra264_initiator_id[] = { |
| 1220 |
[0x0] = "TZ", |
| 1221 |
[0x1] = "CCPLEX", |
| 1222 |
[0x2] = "ISC", |
| 1223 |
[0x3] = "BPMP_FW", |
| 1224 |
[0x4] = "AON", |
| 1225 |
[0x5] = "MSS_SEQ", |
| 1226 |
[0x6] = "GPCDMA_P", |
| 1227 |
[0x7] = "TSECA_NONSECURE", |
| 1228 |
[0x8] = "TSECA_LIGHTSECURE", |
| 1229 |
[0x9] = "TSECA_HEAVYSECURE", |
| 1230 |
[0xa] = "CORESIGHT", |
| 1231 |
[0xb] = "APE_0", |
| 1232 |
[0xc] = "APE_1", |
| 1233 |
[0xd] = "PEATRANS", |
| 1234 |
[0xe] = "JTAGM_DFT", |
| 1235 |
[0xf] = "RCE", |
| 1236 |
[0x10] = "DCE", |
| 1237 |
[0x11] = "PSC_FW_USER", |
| 1238 |
[0x12] = "PSC_FW_SUPERVISOR", |
| 1239 |
[0x13] = "PSC_FW_MACHINE", |
| 1240 |
[0x14] = "PSC_BOOT", |
| 1241 |
[0x15] = "BPMP_BOOT", |
| 1242 |
[0x16] = "GPU_0", |
| 1243 |
[0x17] = "GPU_1", |
| 1244 |
[0x18] = "GPU_2", |
| 1245 |
[0x19] = "GPU_3", |
| 1246 |
[0x1a] = "GPU_4", |
| 1247 |
[0x1b] = "PSC_EXT_BOOT", |
| 1248 |
[0x1c] = "PSC_EXT_RUNTIME", |
| 1249 |
[0x1d] = "OESP_EXT", |
| 1250 |
[0x1e] = "SB_EXT", |
| 1251 |
[0x1f] = "FSI_SAFETY_0", |
| 1252 |
[0x20] = "FSI_SAFETY_1", |
| 1253 |
[0x21] = "FSI_SAFETY_2", |
| 1254 |
[0x22] = "FSI_SAFETY_3", |
| 1255 |
[0x23] = "FSI_CHSM", |
| 1256 |
[0x24] = "RCE_1", |
| 1257 |
[0x25] = "BPMP_OEM_FW", |
| 1258 |
[0x26 ... 0x3d] = "RSVD", |
| 1259 |
[0x3e] = "CBB_SMN", |
| 1260 |
[0x3f] = "CBB_RSVD" |
| 1261 |
}; |
| 1262 |
|
| 1263 |
static const struct tegra234_target_lookup tegra264_top0_cbb_target_map[] = { |
| 1264 |
{ "RSVD", 0x000000 }, |
| 1265 |
{ "CBB_CENTRAL", 0xC020000 }, |
| 1266 |
{ "AXI2APB_1", 0x80000 }, |
| 1267 |
{ "AXI2APB_10", 0x81000 }, |
| 1268 |
{ "AXI2APB_11", 0x82000 }, |
| 1269 |
{ "RSVD", 0x00000 }, |
| 1270 |
{ "RSVD", 0x00000 }, |
| 1271 |
{ "AXI2APB_14", 0x83000 }, |
| 1272 |
{ "AXI2APB_15", 0x84000 }, |
| 1273 |
{ "AXI2APB_16", 0x85000 }, |
| 1274 |
{ "AXI2APB_17", 0x86000 }, |
| 1275 |
{ "AXI2APB_2", 0x87000 }, |
| 1276 |
{ "AXI2APB_3", 0x88000 }, |
| 1277 |
{ "RSVD", 0x00000 }, |
| 1278 |
{ "AXI2APB_5", 0x8A000 }, |
| 1279 |
{ "AXI2APB_6", 0x8B000 }, |
| 1280 |
{ "AXI2APB_7", 0x8C000 }, |
| 1281 |
{ "AXI2APB_8", 0x8D000 }, |
| 1282 |
{ "AXI2APB_9", 0x8E000 }, |
| 1283 |
{ "FSI_SLAVE", 0x64000 }, |
| 1284 |
{ "DISP_USB_CBB_T", 0x65000 }, |
| 1285 |
{ "SYSTEM_CBB_T", 0x66000 }, |
| 1286 |
{ "UPHY0_CBB_T", 0x67000 }, |
| 1287 |
{ "VISION_CBB_T", 0x68000 }, |
| 1288 |
{ "CCPLEX_SLAVE", 0x69000 }, |
| 1289 |
{ "PCIE_C0", 0x6A000 }, |
| 1290 |
{ "SMN_UCF_RX_0", 0x6B000 }, |
| 1291 |
{ "SMN_UCF_RX_1", 0x6C000 }, |
| 1292 |
{ "AXI2APB_4", 0x89000 }, |
| 1293 |
}; |
| 1294 |
|
| 1295 |
static const struct tegra234_target_lookup tegra264_sys_cbb_target_map[] = { |
| 1296 |
{ "RSVD", 0x00000 }, |
| 1297 |
{ "AXI2APB_1", 0xE1000 }, |
| 1298 |
{ "RSVD", 0x00000 }, |
| 1299 |
{ "AON_SLAVE", 0x79000 }, |
| 1300 |
{ "APE_SLAVE", 0x73000 }, |
| 1301 |
{ "BPMP_SLAVE", 0x74000 }, |
| 1302 |
{ "OESP_SLAVE", 0x75000 }, |
| 1303 |
{ "PSC_SLAVE", 0x76000 }, |
| 1304 |
{ "SB_SLAVE", 0x7A000 }, |
| 1305 |
{ "SMN_SYSTEM_RX", 0x7B000 }, |
| 1306 |
{ "STM", 0x77000 }, |
| 1307 |
{ "RSVD", 0x00000 }, |
| 1308 |
{ "AXI2APB_3", 0xE3000 }, |
| 1309 |
{ "TOP_CBB_T", 0x7C000 }, |
| 1310 |
{ "AXI2APB_2", 0xE4000 }, |
| 1311 |
{ "AXI2APB_4", 0xE5000 }, |
| 1312 |
{ "AXI2APB_5", 0xE6000 }, |
| 1313 |
}; |
| 1314 |
|
| 1315 |
static const struct tegra234_target_lookup tegra264_uphy0_cbb_target_map[] = { |
| 1316 |
[0 ... 20] = { "RSVD", 0x00000 }, |
| 1317 |
{ "AXI2APB_1", 0x71000 }, |
| 1318 |
{ "RSVD", 0x00000 }, |
| 1319 |
{ "AXI2APB_3", 0x75000 }, |
| 1320 |
{ "SMN_UPHY0_RX", 0x53000 }, |
| 1321 |
{ "RSVD", 0x00000 }, |
| 1322 |
{ "RSVD", 0x00000 }, |
| 1323 |
{ "RSVD", 0x00000 }, |
| 1324 |
{ "RSVD", 0x00000 }, |
| 1325 |
{ "PCIE_C4", 0x4B000 }, |
| 1326 |
{ "AXI2APB_2", 0x74000 }, |
| 1327 |
{ "AXI2APB_4", 0x76000 }, |
| 1328 |
{ "AXI2APB_5", 0x77000 }, |
| 1329 |
{ "RSVD", 0x00000 }, |
| 1330 |
{ "AXI2APB_7", 0x79000 }, |
| 1331 |
{ "PCIE_C2", 0x56000 }, |
| 1332 |
{ "RSVD", 0x00000 }, |
| 1333 |
{ "RSVD", 0x00000 }, |
| 1334 |
{ "PCIE_C1", 0x55000 }, |
| 1335 |
{ "RSVD", 0x00000 }, |
| 1336 |
{ "AXI2APB_10", 0x72000 }, |
| 1337 |
{ "AXI2APB_11", 0x7C000 }, |
| 1338 |
{ "AXI2APB_8", 0x7A000 }, |
| 1339 |
{ "AXI2APB_9", 0x7B000 }, |
| 1340 |
{ "RSVD", 0x00000 }, |
| 1341 |
{ "RSVD", 0x00000 }, |
| 1342 |
{ "PCIE_C5", 0x4E000 }, |
| 1343 |
{ "PCIE_C3", 0x58000 }, |
| 1344 |
{ "RSVD", 0x00000 }, |
| 1345 |
{ "ISC_SLAVE", 0x54000 }, |
| 1346 |
{ "TOP_CBB_T", 0x57000 }, |
| 1347 |
{ "AXI2APB_12", 0x7D000 }, |
| 1348 |
{ "AXI2APB_13", 0x70000 }, |
| 1349 |
{ "AXI2APB_6", 0x7E000 }, |
| 1350 |
}; |
| 1351 |
|
| 1352 |
static const struct tegra234_target_lookup tegra264_vision_cbb_target_map[] = { |
| 1353 |
[0 ... 5] = { "RSVD", 0x0 }, |
| 1354 |
{ "HOST1X", 0x45000 }, |
| 1355 |
{ "RSVD", 0x00000 }, |
| 1356 |
{ "RSVD", 0x00000 }, |
| 1357 |
{ "AXI2APB_2", 0x71000 }, |
| 1358 |
{ "RSVD", 0x00000 }, |
| 1359 |
{ "RSVD", 0x00000 }, |
| 1360 |
{ "SMN_VISION_RX", 0x47000 }, |
| 1361 |
[13 ... 19] = { "RSVD", 0x0 }, |
| 1362 |
{ "RCE_0_SLAVE", 0x4B000 }, |
| 1363 |
{ "RCE_1_SLAVE", 0x4C000 }, |
| 1364 |
{ "AXI2APB_1", 0x72000 }, |
| 1365 |
{ "AXI2APB_3", 0x73000 }, |
| 1366 |
{ "TOP_CBB_T", 0x4D000 }, |
| 1367 |
|
| 1368 |
}; |
| 1369 |
|
| 1370 |
static const struct tegra234_fabric_lookup tegra264_cbb_fab_list[] = { |
| 1371 |
[T264_SYSTEM_CBB_FABRIC_ID] = { "system-cbb-fabric", true, |
| 1372 |
tegra264_sys_cbb_target_map, |
| 1373 |
ARRAY_SIZE(tegra264_sys_cbb_target_map) }, |
| 1374 |
[T264_TOP_0_CBB_FABRIC_ID] = { "top0-cbb-fabric", true, |
| 1375 |
tegra264_top0_cbb_target_map, |
| 1376 |
ARRAY_SIZE(tegra264_top0_cbb_target_map) }, |
| 1377 |
[T264_VISION_CBB_FABRIC_ID] = { "vision-cbb-fabric", true, |
| 1378 |
tegra264_vision_cbb_target_map, |
| 1379 |
ARRAY_SIZE(tegra264_vision_cbb_target_map) }, |
| 1380 |
[T264_DISP_USB_CBB_FABRIC_ID] = { "disp-usb-cbb-fabric" }, |
| 1381 |
[T264_UPHY0_CBB_FABRIC_ID] = { "uphy0-cbb-fabric", true, |
| 1382 |
tegra264_uphy0_cbb_target_map, |
| 1383 |
ARRAY_SIZE(tegra264_uphy0_cbb_target_map) }, |
| 1384 |
[T264_AON_FABRIC_ID] = { "aon-fabric" }, |
| 1385 |
[T264_PSC_FABRIC_ID] = { "psc-fabric" }, |
| 1386 |
[T264_OESP_FABRIC_ID] = { "oesp-fabric" }, |
| 1387 |
[T264_APE_FABRIC_ID] = { "ape-fabirc" }, |
| 1388 |
[T264_BPMP_FABRIC_ID] = { "bpmp-fabric" }, |
| 1389 |
[T264_RCE_0_FABRIC_ID] = { "rce0-fabric" }, |
| 1390 |
[T264_RCE_1_FABRIC_ID] = { "rce1-fabric" }, |
| 1391 |
[T264_DCE_FABRIC_ID] = { "dce-fabric" }, |
| 1392 |
[T264_FSI_FABRIC_ID] = { "fsi-fabric" }, |
| 1393 |
[T264_ISC_FABRIC_ID] = { "isc-fabric" }, |
| 1394 |
[T264_SB_FABRIC_ID] = { "sb-fabric" }, |
| 1395 |
[T264_ISC_CPU_FABRIC_ID] = { "isc-cpu-fabric" }, |
| 1396 |
}; |
| 1397 |
|
| 1398 |
static const struct tegra234_cbb_fabric tegra264_top0_cbb_fabric = { |
| 1399 |
.fab_id = T264_TOP_0_CBB_FABRIC_ID, |
| 1400 |
.fab_list = tegra264_cbb_fab_list, |
| 1401 |
.initiator_id = tegra264_initiator_id, |
| 1402 |
.errors = tegra241_cbb_errors, |
| 1403 |
.max_errors = ARRAY_SIZE(tegra241_cbb_errors), |
| 1404 |
.err_intr_enbl = 0x7, |
| 1405 |
.err_status_clr = 0x1ff007f, |
| 1406 |
.notifier_offset = 0x90000, |
| 1407 |
.off_mask_erd = 0x4a004, |
| 1408 |
.firewall_base = 0x3c0000, |
| 1409 |
.firewall_ctl = 0x5b0, |
| 1410 |
.firewall_wr_ctl = 0x5a8, |
| 1411 |
}; |
| 1412 |
|
| 1413 |
static const struct tegra234_cbb_fabric tegra264_sys_cbb_fabric = { |
| 1414 |
.fab_id = T264_SYSTEM_CBB_FABRIC_ID, |
| 1415 |
.fab_list = tegra264_cbb_fab_list, |
| 1416 |
.initiator_id = tegra264_initiator_id, |
| 1417 |
.errors = tegra241_cbb_errors, |
| 1418 |
.max_errors = ARRAY_SIZE(tegra241_cbb_errors), |
| 1419 |
.err_intr_enbl = 0xf, |
| 1420 |
.err_status_clr = 0x1ff007f, |
| 1421 |
.notifier_offset = 0x40000, |
| 1422 |
.firewall_base = 0x29c000, |
| 1423 |
.firewall_ctl = 0x170, |
| 1424 |
.firewall_wr_ctl = 0x168, |
| 1425 |
}; |
| 1426 |
|
| 1427 |
static const struct tegra234_cbb_fabric tegra264_uphy0_cbb_fabric = { |
| 1428 |
.fab_id = T264_UPHY0_CBB_FABRIC_ID, |
| 1429 |
.fab_list = tegra264_cbb_fab_list, |
| 1430 |
.initiator_id = tegra264_initiator_id, |
| 1431 |
.errors = tegra241_cbb_errors, |
| 1432 |
.max_errors = ARRAY_SIZE(tegra241_cbb_errors), |
| 1433 |
.err_intr_enbl = 0x1, |
| 1434 |
.err_status_clr = 0x1ff007f, |
| 1435 |
.notifier_offset = 0x80000, |
| 1436 |
.firewall_base = 0x360000, |
| 1437 |
.firewall_ctl = 0x590, |
| 1438 |
.firewall_wr_ctl = 0x588, |
| 1439 |
}; |
| 1440 |
|
| 1441 |
static const struct tegra234_cbb_fabric tegra264_vision_cbb_fabric = { |
| 1442 |
.fab_id = T264_VISION_CBB_FABRIC_ID, |
| 1443 |
.fab_list = tegra264_cbb_fab_list, |
| 1444 |
.initiator_id = tegra264_initiator_id, |
| 1445 |
.errors = tegra241_cbb_errors, |
| 1446 |
.max_errors = ARRAY_SIZE(tegra241_cbb_errors), |
| 1447 |
.err_intr_enbl = 0x1, |
| 1448 |
.err_status_clr = 0x1ff007f, |
| 1449 |
.notifier_offset = 0x80000, |
| 1450 |
.firewall_base = 0x290000, |
| 1451 |
.firewall_ctl = 0x5d0, |
| 1452 |
.firewall_wr_ctl = 0x5c8, |
| 1453 |
}; |
| 1454 |
|
| 1455 |
static const struct tegra234_fabric_lookup t254_cbb_fab_list[] = { |
| 1456 |
[T254_C2C_FABRIC_ID] = { "c2c-fabric", true }, |
| 1457 |
[T254_DISP_CLUSTER_FABRIC_ID] = { "display-cluster-fabric", true }, |
| 1458 |
[T254_GPU_FABRIC_ID] = { "gpu-fabric", true }, |
| 1459 |
}; |
| 1460 |
|
| 1461 |
static const struct tegra234_cbb_fabric t254_c2c_fabric = { |
| 1462 |
.fab_id = T254_C2C_FABRIC_ID, |
| 1463 |
.fab_list = t254_cbb_fab_list, |
| 1464 |
.errors = tegra241_cbb_errors, |
| 1465 |
.max_errors = ARRAY_SIZE(tegra241_cbb_errors), |
| 1466 |
.err_intr_enbl = 0xf, |
| 1467 |
.err_status_clr = 0x1ff007f, |
| 1468 |
.notifier_offset = 0x50000, |
| 1469 |
.off_mask_erd = 0x14004, |
| 1470 |
.firewall_base = 0x40000, |
| 1471 |
.firewall_ctl = 0x9b0, |
| 1472 |
.firewall_wr_ctl = 0x9a8, |
| 1473 |
}; |
| 1474 |
|
| 1475 |
static const struct tegra234_cbb_fabric t254_disp_fabric = { |
| 1476 |
.fab_id = T254_DISP_CLUSTER_FABRIC_ID, |
| 1477 |
.fab_list = t254_cbb_fab_list, |
| 1478 |
.errors = tegra241_cbb_errors, |
| 1479 |
.max_errors = ARRAY_SIZE(tegra241_cbb_errors), |
| 1480 |
.err_intr_enbl = 0x1, |
| 1481 |
.err_status_clr = 0x1ff007f, |
| 1482 |
.notifier_offset = 0x50000, |
| 1483 |
.firewall_base = 0x30000, |
| 1484 |
.firewall_ctl = 0x810, |
| 1485 |
.firewall_wr_ctl = 0x808, |
| 1486 |
}; |
| 1487 |
|
| 1488 |
static const struct tegra234_cbb_fabric t254_gpu_fabric = { |
| 1489 |
.fab_id = T254_GPU_FABRIC_ID, |
| 1490 |
.fab_list = t254_cbb_fab_list, |
| 1491 |
.errors = tegra241_cbb_errors, |
| 1492 |
.max_errors = ARRAY_SIZE(tegra241_cbb_errors), |
| 1493 |
.err_intr_enbl = 0x1f, |
| 1494 |
.err_status_clr = 0x1ff007f, |
| 1495 |
.notifier_offset = 0x50000, |
| 1496 |
.firewall_base = 0x30000, |
| 1497 |
.firewall_ctl = 0x930, |
| 1498 |
.firewall_wr_ctl = 0x928, |
| 1499 |
}; |
| 1500 |
|
| 1501 |
static const struct of_device_id tegra234_cbb_dt_ids[] = { |
| 1502 |
{ .compatible = "nvidia,tegra234-cbb-fabric", .data = &tegra234_cbb_fabric }, |
| 1503 |
{ .compatible = "nvidia,tegra234-aon-fabric", .data = &tegra234_aon_fabric }, |
| 1504 |
{ .compatible = "nvidia,tegra234-bpmp-fabric", .data = &tegra234_bpmp_fabric }, |
| 1505 |
{ .compatible = "nvidia,tegra234-dce-fabric", .data = &tegra234_dce_fabric }, |
| 1506 |
{ .compatible = "nvidia,tegra234-rce-fabric", .data = &tegra234_rce_fabric }, |
| 1507 |
{ .compatible = "nvidia,tegra234-sce-fabric", .data = &tegra234_sce_fabric }, |
| 1508 |
{ .compatible = "nvidia,tegra264-sys-cbb-fabric", .data = &tegra264_sys_cbb_fabric }, |
| 1509 |
{ .compatible = "nvidia,tegra264-top0-cbb-fabric", .data = &tegra264_top0_cbb_fabric }, |
| 1510 |
{ .compatible = "nvidia,tegra264-uphy0-cbb-fabric", .data = &tegra264_uphy0_cbb_fabric }, |
| 1511 |
{ .compatible = "nvidia,tegra264-vision-cbb-fabric", .data = &tegra264_vision_cbb_fabric }, |
| 1512 |
{ /* sentinel */ }, |
| 1513 |
}; |
| 1514 |
MODULE_DEVICE_TABLE(of, tegra234_cbb_dt_ids); |
| 1515 |
|
| 1516 |
struct tegra234_cbb_acpi_uid { |
| 1517 |
const char *hid; |
| 1518 |
const char *uid; |
| 1519 |
const struct tegra234_cbb_fabric *fabric; |
| 1520 |
}; |
| 1521 |
|
| 1522 |
static const struct tegra234_cbb_acpi_uid tegra234_cbb_acpi_uids[] = { |
| 1523 |
{ "NVDA1070", "1", &tegra241_cbb_fabric }, |
| 1524 |
{ "NVDA1070", "2", &tegra241_bpmp_fabric }, |
| 1525 |
{ "NVDA1070", "3", &t254_c2c_fabric }, |
| 1526 |
{ "NVDA1070", "4", &t254_disp_fabric }, |
| 1527 |
{ "NVDA1070", "5", &t254_gpu_fabric }, |
| 1528 |
{ }, |
| 1529 |
}; |
| 1530 |
|
| 1531 |
static const struct |
| 1532 |
tegra234_cbb_fabric *tegra234_cbb_acpi_get_fabric(struct acpi_device *adev) |
| 1533 |
{ |
| 1534 |
const struct tegra234_cbb_acpi_uid *entry; |
| 1535 |
|
| 1536 |
for (entry = tegra234_cbb_acpi_uids; entry->hid; entry++) { |
| 1537 |
if (acpi_dev_hid_uid_match(adev, entry->hid, entry->uid)) |
| 1538 |
return entry->fabric; |
| 1539 |
} |
| 1540 |
|
| 1541 |
return NULL; |
| 1542 |
} |
| 1543 |
|
| 1544 |
static const struct acpi_device_id tegra241_cbb_acpi_ids[] = { |
| 1545 |
{ "NVDA1070" }, |
| 1546 |
{ }, |
| 1547 |
}; |
| 1548 |
MODULE_DEVICE_TABLE(acpi, tegra241_cbb_acpi_ids); |
| 1549 |
|
| 1550 |
static int tegra234_cbb_probe(struct platform_device *pdev) |
| 1551 |
{ |
| 1552 |
const struct tegra234_cbb_fabric *fabric; |
| 1553 |
struct tegra234_cbb *cbb; |
| 1554 |
unsigned long flags = 0; |
| 1555 |
int err; |
| 1556 |
|
| 1557 |
if (pdev->dev.of_node) { |
| 1558 |
fabric = of_device_get_match_data(&pdev->dev); |
| 1559 |
} else { |
| 1560 |
struct acpi_device *device = ACPI_COMPANION(&pdev->dev); |
| 1561 |
if (!device) |
| 1562 |
return -ENODEV; |
| 1563 |
|
| 1564 |
fabric = tegra234_cbb_acpi_get_fabric(device); |
| 1565 |
if (!fabric) { |
| 1566 |
dev_err(&pdev->dev, "no device match found\n"); |
| 1567 |
return -ENODEV; |
| 1568 |
} |
| 1569 |
} |
| 1570 |
|
| 1571 |
cbb = devm_kzalloc(&pdev->dev, sizeof(*cbb), GFP_KERNEL); |
| 1572 |
if (!cbb) |
| 1573 |
return -ENOMEM; |
| 1574 |
|
| 1575 |
INIT_LIST_HEAD(&cbb->base.node); |
| 1576 |
cbb->base.ops = &tegra234_cbb_ops; |
| 1577 |
cbb->base.dev = &pdev->dev; |
| 1578 |
cbb->fabric = fabric; |
| 1579 |
|
| 1580 |
cbb->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &cbb->res); |
| 1581 |
if (IS_ERR(cbb->regs)) |
| 1582 |
return PTR_ERR(cbb->regs); |
| 1583 |
|
| 1584 |
err = tegra_cbb_get_irq(pdev, NULL, &cbb->sec_irq); |
| 1585 |
if (err) |
| 1586 |
return err; |
| 1587 |
|
| 1588 |
platform_set_drvdata(pdev, cbb); |
| 1589 |
|
| 1590 |
/* |
| 1591 |
* Don't enable error reporting for a Fabric if write to it's registers |
| 1592 |
* is blocked by CBB firewall. |
| 1593 |
*/ |
| 1594 |
if (!tegra234_cbb_write_access_allowed(pdev, cbb)) { |
| 1595 |
dev_info(&pdev->dev, "error reporting not enabled due to firewall\n"); |
| 1596 |
return 0; |
| 1597 |
} |
| 1598 |
|
| 1599 |
spin_lock_irqsave(&cbb_lock, flags); |
| 1600 |
list_add(&cbb->base.node, &cbb_list); |
| 1601 |
spin_unlock_irqrestore(&cbb_lock, flags); |
| 1602 |
|
| 1603 |
/* set ERD bit to mask SError and generate interrupt to report error */ |
| 1604 |
if (cbb->fabric->off_mask_erd) |
| 1605 |
tegra234_cbb_mask_serror(cbb); |
| 1606 |
|
| 1607 |
return tegra_cbb_register(&cbb->base); |
| 1608 |
} |
| 1609 |
|
| 1610 |
static int __maybe_unused tegra234_cbb_resume_noirq(struct device *dev) |
| 1611 |
{ |
| 1612 |
struct tegra234_cbb *cbb = dev_get_drvdata(dev); |
| 1613 |
|
| 1614 |
/* set ERD bit to mask SError and generate interrupt to report error */ |
| 1615 |
if (cbb->fabric->off_mask_erd) |
| 1616 |
tegra234_cbb_mask_serror(cbb); |
| 1617 |
|
| 1618 |
tegra234_cbb_error_enable(&cbb->base); |
| 1619 |
|
| 1620 |
dev_dbg(dev, "%s resumed\n", cbb->fabric->fab_list[cbb->fabric->fab_id].name); |
| 1621 |
|
| 1622 |
return 0; |
| 1623 |
} |
| 1624 |
|
| 1625 |
static const struct dev_pm_ops tegra234_cbb_pm = { |
| 1626 |
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(NULL, tegra234_cbb_resume_noirq) |
| 1627 |
}; |
| 1628 |
|
| 1629 |
static struct platform_driver tegra234_cbb_driver = { |
| 1630 |
.probe = tegra234_cbb_probe, |
| 1631 |
.driver = { |
| 1632 |
.name = "tegra234-cbb", |
| 1633 |
.of_match_table = tegra234_cbb_dt_ids, |
| 1634 |
.acpi_match_table = tegra241_cbb_acpi_ids, |
| 1635 |
.pm = &tegra234_cbb_pm, |
| 1636 |
}, |
| 1637 |
}; |
| 1638 |
|
| 1639 |
static int __init tegra234_cbb_init(void) |
| 1640 |
{ |
| 1641 |
return platform_driver_register(&tegra234_cbb_driver); |
| 1642 |
} |
| 1643 |
pure_initcall(tegra234_cbb_init); |
| 1644 |
|
| 1645 |
static void __exit tegra234_cbb_exit(void) |
| 1646 |
{ |
| 1647 |
platform_driver_unregister(&tegra234_cbb_driver); |
| 1648 |
} |
| 1649 |
module_exit(tegra234_cbb_exit); |
| 1650 |
|
| 1651 |
MODULE_DESCRIPTION("Control Backbone 2.0 error handling driver for Tegra234"); |