MLK-9710-18 snvs - make SECVIO module device tree correct
Converted the prototype 3.0.x SNVS Security Violation Handler subsystem to be device tree correct/compliant under 3.10 for ARM platforms. Also, separated out SNVS property detection so as to make it independent of CAAM, and corrected function namespace accordingly. Later releases of this subsystem are likely to be separate from the kernel's CAAM driver space. [<vicki.milhoan@freescale.com>: Edited to apply to latest 3.10 kernel] Signed-off-by: Steve Cornelius <steve.cornelius@freescale.com> Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com> (cherry picked from commit c8c128086eae012ced0c96d66f21f36bcbd14f66) Signed-off-by: Dan Douglass <dan.douglass@freescale.com> (Vipul: Fixed merge conflicts) Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
This commit is contained in:
committed by
Leonard Crestez
parent
b8ede642bb
commit
8433c811e9
@ -485,7 +485,6 @@ static int caam_probe(struct platform_device *pdev)
|
||||
struct device *dev;
|
||||
struct device_node *nprop, *np;
|
||||
struct caam_ctrl __iomem *ctrl;
|
||||
struct snvs_full __iomem *snvsregs;
|
||||
struct caam_drv_private *ctrlpriv;
|
||||
struct clk *clk;
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
@ -614,17 +613,6 @@ static int caam_probe(struct platform_device *pdev)
|
||||
BLOCK_OFFSET * DECO_BLOCK_NUMBER
|
||||
);
|
||||
|
||||
/* Get the IRQ of the controller (for security violations only) */
|
||||
ctrlpriv->secvio_irq = irq_of_parse_and_map(nprop, 0);
|
||||
|
||||
/* Get SNVS register Page */
|
||||
np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-caam-snvs");
|
||||
|
||||
if (!np)
|
||||
return -ENODEV;
|
||||
|
||||
snvsregs = of_iomap(np, 0);
|
||||
ctrlpriv->snvs = snvsregs;
|
||||
/* Get CAAM-SM node and of_iomap() and save */
|
||||
np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-caam-sm");
|
||||
|
||||
|
||||
@ -70,7 +70,6 @@ struct caam_drv_private {
|
||||
#endif
|
||||
|
||||
struct device *smdev;
|
||||
struct device *secviodev;
|
||||
|
||||
/* Physical-presence section */
|
||||
struct caam_ctrl __iomem *ctrl; /* controller region */
|
||||
@ -78,7 +77,6 @@ struct caam_drv_private {
|
||||
struct caam_assurance __iomem *assure;
|
||||
struct caam_queue_if __iomem *qi; /* QI control region */
|
||||
struct caam_job_ring __iomem *jr[4]; /* JobR's register space */
|
||||
struct snvs_full __iomem *snvs; /* SNVS HP+LP register space */
|
||||
dma_addr_t __iomem *sm_base; /* Secure memory storage base */
|
||||
u32 sm_size;
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
|
||||
/*
|
||||
* CAAM/SEC 4.x Security Violation Handler
|
||||
* Copyright (C) 2015 Freescale Semiconductor, Inc., All Rights Reserved
|
||||
* SNVS Security Violation Handler
|
||||
* Copyright (C) 2012-2015 Freescale Semiconductor, Inc., All Rights Reserved
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
@ -10,39 +10,56 @@
|
||||
#include "intern.h"
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/of_address.h>
|
||||
/*
|
||||
* These names are associated with each violation handler.
|
||||
* The source names were taken from MX6, and are based on recommendations
|
||||
* for most common SoCs.
|
||||
*/
|
||||
static const u8 *violation_src_name[] = {
|
||||
"CAAM Security Violation",
|
||||
"CAAM Internal Security Violation",
|
||||
"JTAG Alarm",
|
||||
"Watchdog",
|
||||
"(reserved)",
|
||||
"External Boot",
|
||||
"Tamper Detect",
|
||||
"External Tamper Detect",
|
||||
};
|
||||
|
||||
/* These names help describe security monitor state for the console */
|
||||
static const u8 *snvs_ssm_state_name[] = {
|
||||
"init",
|
||||
"hard fail",
|
||||
"(undef:2)",
|
||||
"soft fail",
|
||||
"(undef:4)",
|
||||
"(undef:5)",
|
||||
"(undef:6)",
|
||||
"(undef:7)",
|
||||
"transition",
|
||||
"check",
|
||||
"(undef:10)",
|
||||
"non-secure",
|
||||
"(undef:12)",
|
||||
"trusted",
|
||||
"(undef:14)",
|
||||
"secure",
|
||||
};
|
||||
|
||||
/* Top-level security violation interrupt */
|
||||
static irqreturn_t caam_secvio_interrupt(int irq, void *snvsdev)
|
||||
static irqreturn_t snvs_secvio_interrupt(int irq, void *snvsdev)
|
||||
{
|
||||
struct device *dev = snvsdev;
|
||||
struct caam_drv_private_secvio *svpriv = dev_get_drvdata(dev);
|
||||
u32 irqstate;
|
||||
struct snvs_secvio_drv_private *svpriv = dev_get_drvdata(dev);
|
||||
|
||||
/* Check the HP secvio status register */
|
||||
irqstate = rd_reg32(&svpriv->svregs->hp.secvio_status) |
|
||||
HP_SECVIOST_SECVIOMASK;
|
||||
svpriv->irqcause = rd_reg32(&svpriv->svregs->hp.secvio_status) &
|
||||
HP_SECVIOST_SECVIOMASK;
|
||||
|
||||
if (!irqstate)
|
||||
if (!svpriv->irqcause)
|
||||
return IRQ_NONE;
|
||||
|
||||
/* Mask out one or more causes for deferred service */
|
||||
clrsetbits_32(&svpriv->svregs->hp.secvio_int_ctl, irqstate, 0);
|
||||
|
||||
/* Now ACK causes */
|
||||
clrsetbits_32(&svpriv->svregs->hp.secvio_status, 0, irqstate);
|
||||
/* Now ACK cause */
|
||||
clrsetbits_32(&svpriv->svregs->hp.secvio_status, 0, svpriv->irqcause);
|
||||
|
||||
/* And run deferred service */
|
||||
preempt_disable();
|
||||
@ -53,28 +70,17 @@ static irqreturn_t caam_secvio_interrupt(int irq, void *snvsdev)
|
||||
}
|
||||
|
||||
/* Deferred service handler. Tasklet arg is simply the SNVS dev */
|
||||
static void caam_secvio_dispatch(unsigned long indev)
|
||||
static void snvs_secvio_dispatch(unsigned long indev)
|
||||
{
|
||||
struct device *dev = (struct device *)indev;
|
||||
struct caam_drv_private_secvio *svpriv = dev_get_drvdata(dev);
|
||||
unsigned long flags, cause;
|
||||
struct snvs_secvio_drv_private *svpriv = dev_get_drvdata(dev);
|
||||
unsigned long flags;
|
||||
int i;
|
||||
|
||||
|
||||
/*
|
||||
* Capture the interrupt cause, using masked interrupts as
|
||||
* identification. This only works if all are enabled; if
|
||||
* this changes in the future, a "cause queue" will have to
|
||||
* be built
|
||||
*/
|
||||
cause = rd_reg32(&svpriv->svregs->hp.secvio_int_ctl) &
|
||||
(HP_SECVIO_INTEN_SRC5 | HP_SECVIO_INTEN_SRC4 |
|
||||
HP_SECVIO_INTEN_SRC3 | HP_SECVIO_INTEN_SRC2 |
|
||||
HP_SECVIO_INTEN_SRC1 | HP_SECVIO_INTEN_SRC0);
|
||||
|
||||
/* Look through causes, call each handler if exists */
|
||||
/* Look through stored causes, call each handler if exists */
|
||||
for (i = 0; i < MAX_SECVIO_SOURCES; i++)
|
||||
if (cause & (1 << i)) {
|
||||
if (svpriv->irqcause & (1 << i)) {
|
||||
spin_lock_irqsave(&svpriv->svlock, flags);
|
||||
svpriv->intsrc[i].handler(dev, i,
|
||||
svpriv->intsrc[i].ext);
|
||||
@ -82,16 +88,16 @@ static void caam_secvio_dispatch(unsigned long indev)
|
||||
};
|
||||
|
||||
/* Re-enable now-serviced interrupts */
|
||||
clrsetbits_32(&svpriv->svregs->hp.secvio_int_ctl, 0, cause);
|
||||
clrsetbits_32(&svpriv->svregs->hp.secvio_intcfg, 0, svpriv->irqcause);
|
||||
}
|
||||
|
||||
/*
|
||||
* Default cause handler, used in lieu of an application-defined handler.
|
||||
* All it does at this time is print a console message. It could force a halt.
|
||||
*/
|
||||
static void caam_secvio_default(struct device *dev, u32 cause, void *ext)
|
||||
static void snvs_secvio_default(struct device *dev, u32 cause, void *ext)
|
||||
{
|
||||
struct caam_drv_private_secvio *svpriv = dev_get_drvdata(dev);
|
||||
struct snvs_secvio_drv_private *svpriv = dev_get_drvdata(dev);
|
||||
|
||||
dev_err(dev, "Unhandled Security Violation Interrupt %d = %s\n",
|
||||
cause, svpriv->intsrc[cause].intname);
|
||||
@ -110,13 +116,13 @@ static void caam_secvio_default(struct device *dev, u32 cause, void *ext)
|
||||
* description string is used.
|
||||
* - ext pointer to any extra data needed by the handler.
|
||||
*/
|
||||
int caam_secvio_install_handler(struct device *dev, enum secvio_cause cause,
|
||||
int snvs_secvio_install_handler(struct device *dev, enum secvio_cause cause,
|
||||
void (*handler)(struct device *dev, u32 cause,
|
||||
void *ext),
|
||||
u8 *cause_description, void *ext)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct caam_drv_private_secvio *svpriv;
|
||||
struct snvs_secvio_drv_private *svpriv;
|
||||
|
||||
svpriv = dev_get_drvdata(dev);
|
||||
|
||||
@ -133,7 +139,7 @@ int caam_secvio_install_handler(struct device *dev, enum secvio_cause cause,
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(caam_secvio_install_handler);
|
||||
EXPORT_SYMBOL(snvs_secvio_install_handler);
|
||||
|
||||
/*
|
||||
* Remove an application-defined handler for a specified cause (and, by
|
||||
@ -142,10 +148,10 @@ EXPORT_SYMBOL(caam_secvio_install_handler);
|
||||
* - dev points to SNVS-owning device
|
||||
* - cause interrupt source cause
|
||||
*/
|
||||
int caam_secvio_remove_handler(struct device *dev, enum secvio_cause cause)
|
||||
int snvs_secvio_remove_handler(struct device *dev, enum secvio_cause cause)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct caam_drv_private_secvio *svpriv;
|
||||
struct snvs_secvio_drv_private *svpriv;
|
||||
|
||||
svpriv = dev_get_drvdata(dev);
|
||||
|
||||
@ -154,183 +160,128 @@ int caam_secvio_remove_handler(struct device *dev, enum secvio_cause cause)
|
||||
|
||||
spin_lock_irqsave(&svpriv->svlock, flags);
|
||||
svpriv->intsrc[cause].intname = violation_src_name[cause];
|
||||
svpriv->intsrc[cause].handler = caam_secvio_default;
|
||||
svpriv->intsrc[cause].handler = snvs_secvio_default;
|
||||
svpriv->intsrc[cause].ext = NULL;
|
||||
spin_unlock_irqrestore(&svpriv->svlock, flags);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(caam_secvio_remove_handler);
|
||||
EXPORT_SYMBOL(snvs_secvio_remove_handler);
|
||||
|
||||
int caam_secvio_startup(struct platform_device *pdev)
|
||||
static int snvs_secvio_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct device *ctrldev, *svdev;
|
||||
struct caam_drv_private *ctrlpriv;
|
||||
struct caam_drv_private_secvio *svpriv;
|
||||
struct platform_device *svpdev;
|
||||
struct device_node *np;
|
||||
const void *prop;
|
||||
int i, error, secvio_inten_src;
|
||||
|
||||
ctrldev = &pdev->dev;
|
||||
ctrlpriv = dev_get_drvdata(ctrldev);
|
||||
/*
|
||||
* Set up the private block for secure memory
|
||||
* Only one instance is possible
|
||||
*/
|
||||
svpriv = kzalloc(sizeof(struct caam_drv_private_secvio), GFP_KERNEL);
|
||||
if (svpriv == NULL) {
|
||||
dev_err(ctrldev, "can't alloc private mem for secvio\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
svpriv->parentdev = ctrldev;
|
||||
|
||||
/* Create the security violation dev */
|
||||
#ifdef CONFIG_OF
|
||||
|
||||
np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-caam-secvio");
|
||||
if (!np)
|
||||
return -ENODEV;
|
||||
|
||||
ctrlpriv->secvio_irq = of_irq_to_resource(np, 0, NULL);
|
||||
|
||||
prop = of_get_property(np, "secvio_src", NULL);
|
||||
if (prop)
|
||||
secvio_inten_src = of_read_ulong(prop, 1);
|
||||
else
|
||||
secvio_inten_src = HP_SECVIO_INTEN_ALL;
|
||||
|
||||
printk(KERN_ERR "secvio_inten_src = %x\n", secvio_inten_src);
|
||||
|
||||
svpdev = of_platform_device_create(np, NULL, ctrldev);
|
||||
if (!svpdev)
|
||||
return -ENODEV;
|
||||
|
||||
#else
|
||||
svpdev = platform_device_register_data(ctrldev, "caam_secvio", 0,
|
||||
svpriv,
|
||||
sizeof(struct caam_drv_private_secvio));
|
||||
|
||||
secvio_inten_src = HP_SECVIO_INTEN_ALL;
|
||||
#endif
|
||||
if (svpdev == NULL) {
|
||||
kfree(svpriv);
|
||||
return -EINVAL;
|
||||
}
|
||||
svdev = &svpdev->dev;
|
||||
dev_set_drvdata(svdev, svpriv);
|
||||
ctrlpriv->secviodev = svdev;
|
||||
svpriv->svregs = ctrlpriv->snvs;
|
||||
|
||||
/*
|
||||
* Now we have all the dev data set up. Init interrupt
|
||||
* source descriptions
|
||||
*/
|
||||
for (i = 0; i < MAX_SECVIO_SOURCES; i++) {
|
||||
svpriv->intsrc[i].intname = violation_src_name[i];
|
||||
svpriv->intsrc[i].handler = caam_secvio_default;
|
||||
}
|
||||
|
||||
/* Connect main handler */
|
||||
for_each_possible_cpu(i)
|
||||
tasklet_init(&svpriv->irqtask[i], caam_secvio_dispatch,
|
||||
(unsigned long)svdev);
|
||||
|
||||
error = request_irq(ctrlpriv->secvio_irq, caam_secvio_interrupt,
|
||||
IRQF_SHARED, "caam_secvio", svdev);
|
||||
if (error) {
|
||||
dev_err(svdev, "can't connect secvio interrupt\n");
|
||||
irq_dispose_mapping(ctrlpriv->secvio_irq);
|
||||
ctrlpriv->secvio_irq = 0;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Enable all sources */
|
||||
wr_reg32(&svpriv->svregs->hp.secvio_int_ctl, secvio_inten_src);
|
||||
|
||||
dev_info(svdev, "security violation service handlers armed\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void caam_secvio_shutdown(struct platform_device *pdev)
|
||||
{
|
||||
struct device *ctrldev, *svdev;
|
||||
struct caam_drv_private *priv;
|
||||
struct caam_drv_private_secvio *svpriv;
|
||||
struct device *svdev;
|
||||
struct snvs_secvio_drv_private *svpriv;
|
||||
int i;
|
||||
|
||||
ctrldev = &pdev->dev;
|
||||
priv = dev_get_drvdata(ctrldev);
|
||||
svdev = priv->secviodev;
|
||||
svdev = &pdev->dev;
|
||||
svpriv = dev_get_drvdata(svdev);
|
||||
|
||||
/* Shut off all sources */
|
||||
|
||||
wr_reg32(&svpriv->svregs->hp.secvio_int_ctl, 0);
|
||||
/* Set all sources to nonfatal */
|
||||
wr_reg32(&svpriv->svregs->hp.secvio_intcfg, 0);
|
||||
|
||||
/* Remove tasklets and release interrupt */
|
||||
for_each_possible_cpu(i)
|
||||
tasklet_kill(&svpriv->irqtask[i]);
|
||||
|
||||
free_irq(priv->secvio_irq, svdev);
|
||||
|
||||
free_irq(svpriv->irq, svdev);
|
||||
iounmap(svpriv->svregs);
|
||||
kfree(svpriv);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
static void __exit caam_secvio_exit(void)
|
||||
static int snvs_secvio_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device_node *dev_node;
|
||||
struct platform_device *pdev;
|
||||
struct device *svdev;
|
||||
struct snvs_secvio_drv_private *svpriv;
|
||||
struct device_node *np, *npirq;
|
||||
struct snvs_full __iomem *snvsregs;
|
||||
int i, error;
|
||||
u32 hpstate;
|
||||
|
||||
dev_node = of_find_compatible_node(NULL, NULL, "fsl,sec-v4.0");
|
||||
if (!dev_node) {
|
||||
dev_node = of_find_compatible_node(NULL, NULL, "fsl,sec4.0");
|
||||
if (!dev_node)
|
||||
return;
|
||||
svpriv = kzalloc(sizeof(struct snvs_secvio_drv_private), GFP_KERNEL);
|
||||
if (!svpriv)
|
||||
return -ENOMEM;
|
||||
|
||||
svdev = &pdev->dev;
|
||||
dev_set_drvdata(svdev, svpriv);
|
||||
svpriv->pdev = pdev;
|
||||
np = pdev->dev.of_node;
|
||||
|
||||
npirq = of_find_compatible_node(NULL, NULL, "fsl,imx6q-caam-secvio");
|
||||
if (!npirq) {
|
||||
dev_err(svdev, "can't identify secvio interrupt\n");
|
||||
kfree(svpriv);
|
||||
return -EINVAL;
|
||||
}
|
||||
svpriv->irq = of_irq_to_resource(npirq, 0, NULL);
|
||||
|
||||
pdev = of_find_device_by_node(dev_node);
|
||||
if (!pdev)
|
||||
return;
|
||||
snvsregs = of_iomap(np, 0);
|
||||
if (!snvsregs) {
|
||||
dev_err(svdev, "register mapping failed\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
svpriv->svregs = (struct snvs_full __force *)snvsregs;
|
||||
|
||||
of_node_get(dev_node);
|
||||
/* Device data set up. Now init interrupt source descriptions */
|
||||
for (i = 0; i < MAX_SECVIO_SOURCES; i++) {
|
||||
svpriv->intsrc[i].intname = violation_src_name[i];
|
||||
svpriv->intsrc[i].handler = snvs_secvio_default;
|
||||
}
|
||||
/* Connect main handler */
|
||||
for_each_possible_cpu(i)
|
||||
tasklet_init(&svpriv->irqtask[i], snvs_secvio_dispatch,
|
||||
(unsigned long)svdev);
|
||||
|
||||
caam_secvio_shutdown(pdev);
|
||||
|
||||
}
|
||||
|
||||
static int __init caam_secvio_init(void)
|
||||
{
|
||||
struct device_node *dev_node;
|
||||
struct platform_device *pdev;
|
||||
error = request_irq(svpriv->irq, snvs_secvio_interrupt,
|
||||
IRQF_SHARED, "snvs-secvio", svdev);
|
||||
if (error) {
|
||||
dev_err(svdev, "can't connect secvio interrupt\n");
|
||||
irq_dispose_mapping(svpriv->irq);
|
||||
svpriv->irq = 0;
|
||||
iounmap(svpriv->svregs);
|
||||
kfree(svpriv);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do of_find_compatible_node() then of_find_device_by_node()
|
||||
* once a functional device tree is available
|
||||
* Configure all sources as fatal violations except LP section,
|
||||
* source #5 (typically used as an external tamper detect), and
|
||||
* source #3 (typically unused). Whenever the transition to
|
||||
* secure mode has occurred, these will now be "fatal" violations
|
||||
*/
|
||||
dev_node = of_find_compatible_node(NULL, NULL, "fsl,sec-v4.0");
|
||||
if (!dev_node) {
|
||||
dev_node = of_find_compatible_node(NULL, NULL,
|
||||
"arm,imx6-caam-secvio");
|
||||
if (!dev_node)
|
||||
return -ENODEV;
|
||||
}
|
||||
wr_reg32(&svpriv->svregs->hp.secvio_intcfg,
|
||||
HP_SECVIO_INTEN_SRC4 | HP_SECVIO_INTEN_SRC2 |
|
||||
HP_SECVIO_INTEN_SRC1 | HP_SECVIO_INTEN_SRC0);
|
||||
|
||||
pdev = of_find_device_by_node(dev_node);
|
||||
if (!pdev)
|
||||
return -ENODEV;
|
||||
hpstate = (rd_reg32(&svpriv->svregs->hp.status) &
|
||||
HP_STATUS_SSM_ST_MASK) >> HP_STATUS_SSM_ST_SHIFT;
|
||||
dev_info(svdev, "violation handlers armed - %s state\n",
|
||||
snvs_ssm_state_name[hpstate]);
|
||||
|
||||
of_node_put(dev_node);
|
||||
|
||||
return caam_secvio_startup(pdev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
module_init(caam_secvio_init);
|
||||
module_exit(caam_secvio_exit);
|
||||
static struct of_device_id snvs_secvio_match[] = {
|
||||
{
|
||||
.compatible = "fsl,imx6q-caam-snvs",
|
||||
},
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, snvs_secvio_match);
|
||||
|
||||
static struct platform_driver snvs_secvio_driver = {
|
||||
.driver = {
|
||||
.name = "snvs-secvio",
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = snvs_secvio_match,
|
||||
},
|
||||
.probe = snvs_secvio_probe,
|
||||
.remove = snvs_secvio_remove,
|
||||
};
|
||||
|
||||
module_platform_driver(snvs_secvio_driver);
|
||||
|
||||
MODULE_LICENSE("Dual BSD/GPL");
|
||||
MODULE_DESCRIPTION("FSL CAAM/SNVS Security Violation Handler");
|
||||
MODULE_AUTHOR("Freescale Semiconductor - NMSG/MAD");
|
||||
#endif
|
||||
MODULE_DESCRIPTION("FSL SNVS Security Violation Handler");
|
||||
MODULE_AUTHOR("Freescale Semiconductor - MCU");
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
|
||||
/*
|
||||
* CAAM Security Violation Handler
|
||||
* Copyright (C) 2015 Freescale Semiconductor, Inc., All Rights Reserved
|
||||
* Copyright (C) 2012-2015 Freescale Semiconductor, Inc., All Rights Reserved
|
||||
*/
|
||||
|
||||
#ifndef SECVIO_H
|
||||
@ -28,17 +28,17 @@ enum secvio_cause {
|
||||
};
|
||||
|
||||
/* These are common "recommended" cause definitions for most devices */
|
||||
#define SECVIO_CAUSE_CAAM_VIOLATION SECVIO_CAUSE_SOURCE_0
|
||||
#define SECVIO_CAUSE JTAG_ALARM SECVIO_CAUSE_SOURCE_1
|
||||
#define SECVIO_CAUSE_WATCHDOG SECVIO_CAUSE_SOURCE_2
|
||||
#define SECVIO_CAUSE_EXTERNAL_BOOT SECVIO_CAUSE_SOURCE_4
|
||||
#define SECVIO_CAUSE_TAMPER_DETECT SECVIO_CAUSE_SOURCE_5
|
||||
#define SECVIO_CAUSE_CAAM_VIOLATION SECVIO_CAUSE_SOURCE_0
|
||||
#define SECVIO_CAUSE_JTAG_ALARM SECVIO_CAUSE_SOURCE_1
|
||||
#define SECVIO_CAUSE_WATCHDOG SECVIO_CAUSE_SOURCE_2
|
||||
#define SECVIO_CAUSE_EXTERNAL_BOOT SECVIO_CAUSE_SOURCE_4
|
||||
#define SECVIO_CAUSE_TAMPER_DETECT SECVIO_CAUSE_SOURCE_5
|
||||
|
||||
int caam_secvio_install_handler(struct device *dev, enum secvio_cause cause,
|
||||
int snvs_secvio_install_handler(struct device *dev, enum secvio_cause cause,
|
||||
void (*handler)(struct device *dev, u32 cause,
|
||||
void *ext),
|
||||
u8 *cause_description, void *ext);
|
||||
int caam_secvio_remove_handler(struct device *dev, enum secvio_cause cause);
|
||||
int snvs_secvio_remove_handler(struct device *dev, enum secvio_cause cause);
|
||||
|
||||
/*
|
||||
* Private data definitions for the secvio "driver"
|
||||
@ -50,11 +50,13 @@ struct secvio_int_src {
|
||||
void (*handler)(struct device *dev, u32 cause, void *ext);
|
||||
};
|
||||
|
||||
struct caam_drv_private_secvio {
|
||||
struct device *parentdev; /* points back to the controller */
|
||||
struct snvs_secvio_drv_private {
|
||||
struct platform_device *pdev;
|
||||
spinlock_t svlock ____cacheline_aligned;
|
||||
struct tasklet_struct irqtask[NR_CPUS];
|
||||
struct snvs_full __iomem *svregs; /* both HP and LP domains */
|
||||
int irq;
|
||||
u32 irqcause; /* stashed cause of violation interrupt */
|
||||
|
||||
/* Registered handlers for each violation */
|
||||
struct secvio_int_src intsrc[MAX_SECVIO_SOURCES];
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* SNVS hardware register-level view
|
||||
*
|
||||
* Copyright (C) 2015 Freescale Semiconductor, Inc., All Rights Reserved
|
||||
* Copyright (C) 2012-2015 Freescale Semiconductor, Inc., All Rights Reserved
|
||||
*/
|
||||
|
||||
#ifndef SNVSREGS_H
|
||||
@ -15,13 +15,13 @@
|
||||
* Includes security violations, HA counter, RTC, alarm
|
||||
*/
|
||||
struct snvs_hp {
|
||||
u32 lock;
|
||||
u32 cmd;
|
||||
u32 ctl;
|
||||
u32 secvio_int_en; /* Security Violation Interrupt Enable */
|
||||
u32 secvio_int_ctl; /* Security Violation Interrupt Control */
|
||||
u32 status;
|
||||
u32 secvio_status; /* Security Violation Status */
|
||||
u32 lock; /* HPLR - HP Lock */
|
||||
u32 cmd; /* HPCOMR - HP Command */
|
||||
u32 ctl; /* HPCR - HP Control */
|
||||
u32 secvio_intcfg; /* HPSICR - Security Violation Int Config */
|
||||
u32 secvio_ctl; /* HPSVCR - Security Violation Control */
|
||||
u32 status; /* HPSR - HP Status */
|
||||
u32 secvio_status; /* HPSVSR - Security Violation Status */
|
||||
u32 ha_counteriv; /* High Assurance Counter IV */
|
||||
u32 ha_counter; /* High Assurance Counter */
|
||||
u32 rtc_msb; /* Real Time Clock/Counter MSB */
|
||||
|
||||
Reference in New Issue
Block a user