summaryrefslogtreecommitdiffstats
path: root/include/fsl_sec_mon.h
blob: b6794cefcc53b78df3a3df65542aa284ae0971c1 (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
/*
 * Common internal memory map for some Freescale SoCs
 *
 * Copyright 2015 Freescale Semiconductor, Inc.
 * SPDX-License-Identifier:	GPL-2.0+
 */

#ifndef __FSL_SEC_MON_H
#define __FSL_SEC_MON_H

#include <common.h>
#include <asm/io.h>

#ifdef CONFIG_SYS_FSL_SEC_MON_LE
#define sec_mon_in32(a)       in_le32(a)
#define sec_mon_out32(a, v)   out_le32(a, v)
#define sec_mon_in16(a)       in_le16(a)
#define sec_mon_clrbits32     clrbits_le32
#define sec_mon_setbits32     setbits_le32
#elif defined(CONFIG_SYS_FSL_SEC_MON_BE)
#define sec_mon_in32(a)       in_be32(a)
#define sec_mon_out32(a, v)   out_be32(a, v)
#define sec_mon_in16(a)       in_be16(a)
#define sec_mon_clrbits32     clrbits_be32
#define sec_mon_setbits32     setbits_be32
#else
#error Neither CONFIG_SYS_FSL_SEC_MON_LE nor CONFIG_SYS_FSL_SEC_MON_BE defined
#endif

struct ccsr_sec_mon_regs {
	u8 reserved0[0x04];
	u32 hp_com;	/* 0x04 SEC_MON_HP Command Register */
	u8 reserved2[0x0c];
	u32 hp_stat;	/* 0x08 SEC_MON_HP Status Register */
};

#define HPCOMR_SW_SV 0x100		/* Security Violation bit */
#define HPCOMR_SW_FSV 0x200		/* Fatal Security Violation bit */
#define HPCOMR_SSM_ST 0x1		/* SSM_ST field in SEC_MON command */
#define HPSR_SSM_ST_CHECK	0x900	/* SEC_MON is in check state */
#define HPSR_SSM_ST_NON_SECURE	0xb00	/* SEC_MON is in non secure state */
#define HPSR_SSM_ST_TRUST	0xd00	/* SEC_MON is in trusted state */
#define HPSR_SSM_ST_SOFT_FAIL	0x300	/* SEC_MON is in soft fail state */
#define HPSR_SSM_ST_MASK	0xf00	/* Mask for SSM_ST field */

/*
 * SEC_MON read. This specifies the possible reads
 * from the SEC_MON
 */
enum {
	SEC_MON_SSM_ST,
	SEC_MON_SW_FSV,
	SEC_MON_SW_SV,
};

int change_sec_mon_state(uint32_t initial_state, uint32_t final_state);

#endif /* __FSL_SEC_MON_H */
OpenPOWER on IntegriCloud