mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
It is unnecessary to spell out license text when we are using SPDX license identifiers. Change-Id: I902e18a413126f4dddb0cbb1fb5c0e0de385d2a1 Signed-off-by: Chris Dragan <kdragan@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2892356 Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
64 lines
1.3 KiB
C
64 lines
1.3 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/* Copyright (c) 2017-2023, NVIDIA CORPORATION. All rights reserved. */
|
|
|
|
#include "mods_ras.h"
|
|
|
|
#include <linux/err.h>
|
|
#include <linux/platform/tegra/carmel_ras.h>
|
|
#include <linux/platform/tegra/tegra18_cpu_map.h>
|
|
|
|
/* Encodes requested core/cluster to report
|
|
* ras for. If 0, refers to ccplex
|
|
*/
|
|
static u64 ras_ccplex_config;
|
|
|
|
void enable_cpu_core_reporting(u64 config)
|
|
{
|
|
ras_ccplex_config = config;
|
|
}
|
|
|
|
void set_err_sel(u64 sel_val)
|
|
{
|
|
u8 core, cluster, ccplex;
|
|
u64 errx;
|
|
|
|
ccplex = 0;
|
|
core = ras_ccplex_config >> 1;
|
|
cluster = ras_ccplex_config & 1;
|
|
if (!ras_ccplex_config)
|
|
ccplex = 1;
|
|
|
|
if (ccplex) {
|
|
errx = sel_val;
|
|
} else {
|
|
if (!cluster) {
|
|
errx = (tegra18_logical_to_cluster(core) << 5) +
|
|
(tegra18_logical_to_cpu(core) << 4) +
|
|
sel_val;
|
|
} else {
|
|
errx = 512 + (tegra18_logical_to_cluster(core) << 4)
|
|
+ sel_val;
|
|
}
|
|
}
|
|
|
|
mods_debug_printk(DEBUG_FUNC, "ERR_SEL is %llu, Core is %u\n",
|
|
errx, core);
|
|
|
|
ras_write_errselr(errx);
|
|
}
|
|
|
|
void set_err_ctrl(u64 ctrl_val)
|
|
{
|
|
u64 updated_val;
|
|
|
|
ras_write_error_control(ctrl_val);
|
|
updated_val = ras_read_error_control();
|
|
mods_debug_printk(DEBUG_ALL, "ERR_CTRL updated value is %llu",
|
|
updated_val);
|
|
}
|
|
|
|
u64 get_err_ctrl(void)
|
|
{
|
|
return ras_read_error_control();
|
|
}
|