Files
linux-nv-oot/drivers/misc/mods/mods_ras.c
Chris Dragan a85680cbc5 misc: mods: fix compilation with k5.4
Clean up configuration in mods_config.h and make mods_config.h identical
to the official copy in Perforce.

Bug 200587200

Change-Id: I035119eb44025f45d8272729ebc5a918dd8da6fe
Signed-off-by: Chris Dragan <kdragan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2302436
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 13:27:52 +00:00

75 lines
1.7 KiB
C

// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*/
#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();
}