summaryrefslogtreecommitdiff
path: root/drivers/soc/imx/secvio/imx-secvio-sc-int.h
blob: 3152ec246bbdf4aee66018582ad388693ab35da2 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* SPDX-License-Identifier: GPL-2.0+ */
/*
 * Copyright 2019 NXP
 */

#ifndef SECVIO_SC_H
#define SECVIO_SC_H

/* Includes */
#include <linux/kernel.h>
#include <linux/notifier.h>
#include <linux/semaphore.h>
#include <linux/nvmem-consumer.h>
#include <linux/miscdevice.h>

/* Access for sc_seco_secvio_config API */
#define SECVIO_CONFIG_READ  0
#define SECVIO_CONFIG_WRITE 1

/* Internal Structure */
struct imx_secvio_sc_data {
	struct device *dev;

	struct imx_sc_ipc *ipc_handle;

	struct notifier_block irq_nb;
	struct notifier_block report_nb;
	struct notifier_block audit_nb;

	struct nvmem_device *nvmem;

	struct miscdevice miscdev;

#ifdef CONFIG_DEBUG_FS
	struct dentry *dfs;
#endif

	u32 version;
};

/* Function declarations */
extern
int call_secvio_config(struct device *dev, u8 id, u8 access, u32 *data0,
		       u32 *data1, u32 *data2, u32 *data3, u32 *data4, u8 size);

extern
int int_imx_secvio_sc_get_state(struct device *dev,
				struct secvio_sc_notifier_info *info);

extern
int int_imx_secvio_sc_clear_state(struct device *dev, u32 hpsvs, u32 lps,
				  u32 lptds);

extern
int int_imx_secvio_sc_enable_irq(struct device *dev);

extern
int int_imx_secvio_sc_disable_irq(struct device *dev);

#ifdef CONFIG_DEBUG_FS
extern
int imx_secvio_sc_debugfs(struct device *dev);
#else
static inline
int imx_secvio_sc_debugfs(struct device *dev)
{
	return 0;
}
#endif /* CONFIG_DEBUG_FS */

#ifdef CONFIG_AUDIT
int report_to_audit_notify(struct notifier_block *nb, unsigned long status,
			   void *notif_info);
#else /* CONFIG_AUDIT */
static inline
int report_to_audit_notify(struct notifier_block *nb, unsigned long status,
			   void *notif_info)
{
	return 0;
}
#endif /* CONFIG_AUDIT */

#endif /* SECVIO_SC_H */