blob: c3e7827191d08975c64588718f4b8d503b31669b (
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
/*
* Copyright (c) 2012, ARM Limited. All rights reserved.
*
* Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that the
* following conditions are met:
*
* Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
*
* Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and
* the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its
* contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
*/
#ifndef __SECURE_WORLD_H__
#define __SECURE_WORLD_H__
#include "hyp_types.h"
#include "virt_helpers.h"
#include "events.h"
#include "misc.h"
#include "gic_registers.h"
#include "hyp_vmmap.h"
/* Definitions for creating a 4K page table entry */
#define PAGE_SHIFT 12
#define PAGE_SIZE (1UL << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))
#define PAGE_ALIGN(x) (x & PAGE_MASK)
#define MB_SHIFT 20
#define MB_SIZE (1UL << MB_SHIFT)
#define MB_MASK (~(MB_SIZE-1))
#define MB_ALIGN(x) (x & MB_MASK)
#define SP_L1_BASE_SHIFT 10
#define SP_L1_BASE_MASK (~((1UL << SP_L1_BASE_SHIFT) - 1))
/* Definitions for first level small page descriptors */
#define SMALL_PAGE (1 << 0)
#define SMALL_PAGE_NS (1 << 3)
/* Definitions for second level small page descriptors */
#define SP_XN (1 << 0)
#define SP_SBO (1 << 1)
#define SP_BUFFERABLE (1 << 2)
#define SP_CACHEABLE (1 << 3)
#define SP_AP0 (1 << 4)
#define SP_AP1 (1 << 5)
#define SP_AP2 (1 << 9)
#define SP_TEX0 (1 << 6)
#define SP_TEX1 (1 << 7)
#define SP_TEX2 (1 << 8)
#define SP_SHARED (1 << 10)
#define SP_GLOBAL (1 << 11)
/*
* Constants to indicate whether context manipulation is done
* as per a hotplug or cluster switch request.
*/
#define OP_TYPE_SWITCH 0x1
#define OP_TYPE_HP 0x2
typedef struct sec_stack {
unsigned stack[STACK_SIZE];
} sec_stack;
typedef struct sec_context {
unsigned sctlr;
unsigned actlr;
unsigned cpacr;
unsigned nsacr;
unsigned scr;
unsigned vbar;
unsigned mvbar;
unsigned cntfrq;
unsigned cci_sar;
unsigned vgic_icdisr0;
unsigned vgic_iccpmr;
} sec_context;
extern void enable_caches(void);
extern void secure_context_restore(void);
extern void secure_context_save(unsigned, unsigned);
extern void powerup_ib_core(unsigned, unsigned);
extern void set_reset_handler(unsigned, unsigned, void (*)(void));
extern unsigned warm_reset;
#endif /* __SECURE_WORLD_H__ */
|