summaryrefslogtreecommitdiff
path: root/drivers/crypto/caam/secvio.h
blob: 2f7d5f6270d8559120adf5e4f2e979ef02aa3ed3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

/*
 * CAAM Security Violation Handler
 * Copyright (c) 2012 Freescale Semiconductor, Inc., All Rights Reserved
 */

#ifndef SECVIO_H
#define SECVIO_H

#include "snvsregs.h"


/*
 * Defines the published interfaces to install/remove application-specified
 * handlers for catching violations
 */

#define MAX_SECVIO_SOURCES 6

/* these are the untranslated causes */
enum secvio_cause {
	SECVIO_CAUSE_SOURCE_0,
	SECVIO_CAUSE_SOURCE_1,
	SECVIO_CAUSE_SOURCE_2,
	SECVIO_CAUSE_SOURCE_3,
	SECVIO_CAUSE_SOURCE_4,
	SECVIO_CAUSE_SOURCE_5
};

/* 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

int caam_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);

/*
 * Private data definitions for the secvio "driver"
 */

struct secvio_int_src {
	const u8 *intname;	/* Points to a descriptive name for source */
	void *ext;		/* Extended data to pass to the handler */
	void (*handler)(struct device *dev, u32 cause, void *ext);
};

struct caam_drv_private_secvio {
	struct device *parentdev;	/* points back to the controller */
	spinlock_t svlock ____cacheline_aligned;
	struct tasklet_struct irqtask[NR_CPUS];
	struct snvs_full __iomem *svregs;	/* both HP and LP domains */

	/* Registered handlers for each violation */
	struct secvio_int_src intsrc[MAX_SECVIO_SOURCES];

};

#endif /* SECVIO_H */