Commit a7c535e3 authored by Juergen Borleis's avatar Juergen Borleis Committed by Alexandre Belloni

rtc: imxdi: monitor a security violation at runtime

Maybe the unit enters the hardware related state at runtime and not at
system boot time (after a power cycle).
Signed-off-by: default avatarJuergen Borleis <jbe@pengutronix.de>
Signed-off-by: default avatarRobert Schwebel <rsc@pengutronix.de>
[rsc: got NDA clearance from Freescale]
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
parent c7e9bbe0
...@@ -665,6 +665,25 @@ static irqreturn_t dryice_norm_irq(int irq, void *dev_id) ...@@ -665,6 +665,25 @@ static irqreturn_t dryice_norm_irq(int irq, void *dev_id)
irqreturn_t rc = IRQ_NONE; irqreturn_t rc = IRQ_NONE;
dier = readl(imxdi->ioaddr + DIER); dier = readl(imxdi->ioaddr + DIER);
dsr = readl(imxdi->ioaddr + DSR);
/* handle the security violation event */
if (dier & DIER_SVIE) {
if (dsr & DSR_SVF) {
/*
* Disable the interrupt when this kind of event has
* happened.
* There cannot be more than one event of this type,
* because it needs a complex state change
* including a main power cycle to get again out of
* this state.
*/
di_int_disable(imxdi, DIER_SVIE);
/* report the violation */
di_report_tamper_info(imxdi, dsr);
rc = IRQ_HANDLED;
}
}
/* handle write complete and write error cases */ /* handle write complete and write error cases */
if (dier & DIER_WCIE) { if (dier & DIER_WCIE) {
...@@ -675,7 +694,6 @@ static irqreturn_t dryice_norm_irq(int irq, void *dev_id) ...@@ -675,7 +694,6 @@ static irqreturn_t dryice_norm_irq(int irq, void *dev_id)
return rc; return rc;
/* DSR_WCF clears itself on DSR read */ /* DSR_WCF clears itself on DSR read */
dsr = readl(imxdi->ioaddr + DSR);
if (dsr & (DSR_WCF | DSR_WEF)) { if (dsr & (DSR_WCF | DSR_WEF)) {
/* mask the interrupt */ /* mask the interrupt */
di_int_disable(imxdi, DIER_WCIE); di_int_disable(imxdi, DIER_WCIE);
...@@ -691,7 +709,6 @@ static irqreturn_t dryice_norm_irq(int irq, void *dev_id) ...@@ -691,7 +709,6 @@ static irqreturn_t dryice_norm_irq(int irq, void *dev_id)
/* handle the alarm case */ /* handle the alarm case */
if (dier & DIER_CAIE) { if (dier & DIER_CAIE) {
/* DSR_WCF clears itself on DSR read */ /* DSR_WCF clears itself on DSR read */
dsr = readl(imxdi->ioaddr + DSR);
if (dsr & DSR_CAF) { if (dsr & DSR_CAF) {
/* mask the interrupt */ /* mask the interrupt */
di_int_disable(imxdi, DIER_CAIE); di_int_disable(imxdi, DIER_CAIE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment