lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 17 Aug 2022 18:44:56 +0000
From:   Petlozu Pravareshwar <petlozup@...dia.com>
To:     <jonathanh@...dia.com>, <thierry.reding@...il.com>,
        <p.zabel@...gutronix.de>, <dmitry.osipenko@...labora.com>,
        <ulf.hansson@...aro.org>, <kkartik@...dia.com>,
        <cai.huoqing@...ux.dev>, <spatra@...dia.com>,
        <linux-tegra@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC:     <petlozup@...dia.com>
Subject: [PATCH] soc/tegra: pmc: Print reset info during probe

During PMC probe, print previous reset related info
such as reset reason and reset level.

Signed-off-by: Petlozu Pravareshwar <petlozup@...dia.com>
---
 drivers/soc/tegra/pmc.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index 34d36a28f7d6..dd98ea034149 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -2177,6 +2177,31 @@ static int tegra_pmc_pinctrl_init(struct tegra_pmc *pmc)
 	return 0;
 }
 
+static void tegra_pmc_show_reset_status(void)
+{
+	u32 val, rst_src, rst_lvl;
+
+	val = tegra_pmc_readl(pmc, pmc->soc->regs->rst_status);
+	rst_src = (val & pmc->soc->regs->rst_source_mask) >>
+		pmc->soc->regs->rst_source_shift;
+	rst_lvl = (val & pmc->soc->regs->rst_level_mask) >>
+		pmc->soc->regs->rst_level_shift;
+
+	if (rst_src >= pmc->soc->num_reset_sources)
+		dev_warn(pmc->dev, "reset source: UNKNOWN\n");
+	else if (pmc->soc->reset_sources[rst_src] == NULL)
+		dev_warn(pmc->dev, "reset source: UNUSED\n");
+	else
+		dev_info(pmc->dev, "reset source: %s\n",
+			pmc->soc->reset_sources[rst_src]);
+
+	if (rst_lvl >= pmc->soc->num_reset_levels)
+		dev_warn(pmc->dev, "reset level: UNKNOWN\n");
+	else
+		dev_info(pmc->dev, "reset level: %s\n",
+			pmc->soc->reset_levels[rst_lvl]);
+}
+
 static ssize_t reset_reason_show(struct device *dev,
 				 struct device_attribute *attr, char *buf)
 {
@@ -2979,6 +3004,8 @@ static int tegra_pmc_probe(struct platform_device *pdev)
 
 	tegra_pmc_init_tsense_reset(pmc);
 
+	tegra_pmc_show_reset_status();
+
 	tegra_pmc_reset_sysfs_init(pmc);
 
 	if (IS_ENABLED(CONFIG_DEBUG_FS)) {
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ