forked from AsahiLinux/m1n1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
proxy.h
194 lines (167 loc) · 3.49 KB
/
proxy.h
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
/* SPDX-License-Identifier: MIT */
#ifndef __PROXY_H__
#define __PROXY_H__
#include "types.h"
typedef enum {
P_NOP = 0x000, // System functions
P_EXIT,
P_CALL,
P_GET_BOOTARGS,
P_GET_BASE,
P_SET_BAUD,
P_UDELAY,
P_SET_EXC_GUARD,
P_GET_EXC_COUNT,
P_EL0_CALL,
P_EL1_CALL,
P_VECTOR,
P_GL1_CALL,
P_GL2_CALL,
P_GET_SIMD_STATE,
P_PUT_SIMD_STATE,
P_REBOOT,
P_SLEEP,
P_EL3_CALL,
P_WRITE64 = 0x100, // Generic register functions
P_WRITE32,
P_WRITE16,
P_WRITE8,
P_READ64,
P_READ32,
P_READ16,
P_READ8,
P_SET64,
P_SET32,
P_SET16,
P_SET8,
P_CLEAR64,
P_CLEAR32,
P_CLEAR16,
P_CLEAR8,
P_MASK64,
P_MASK32,
P_MASK16,
P_MASK8,
P_WRITEREAD64,
P_WRITEREAD32,
P_WRITEREAD16,
P_WRITEREAD8,
P_MEMCPY64 = 0x200, // Memory block transfer functions
P_MEMCPY32,
P_MEMCPY16,
P_MEMCPY8,
P_MEMSET64,
P_MEMSET32,
P_MEMSET16,
P_MEMSET8,
P_IC_IALLUIS = 0x300, // Cache and memory ops
P_IC_IALLU,
P_IC_IVAU,
P_DC_IVAC,
P_DC_ISW,
P_DC_CSW,
P_DC_CISW,
P_DC_ZVA,
P_DC_CVAC,
P_DC_CVAU,
P_DC_CIVAC,
P_MMU_SHUTDOWN,
P_MMU_INIT,
P_MMU_DISABLE,
P_MMU_RESTORE,
P_MMU_INIT_SECONDARY,
P_XZDEC = 0x400, // Decompression and data processing ops
P_GZDEC,
P_SMP_START_SECONDARIES = 0x500, // SMP and system management ops
P_SMP_CALL,
P_SMP_CALL_SYNC,
P_SMP_WAIT,
P_SMP_SET_WFE_MODE,
P_SMP_IS_ALIVE,
P_SMP_STOP_SECONDARIES,
P_SMP_CALL_EL1,
P_SMP_CALL_EL1_SYNC,
P_SMP_CALL_EL0,
P_SMP_CALL_EL0_SYNC,
P_HEAPBLOCK_ALLOC = 0x600, // Heap and memory management ops
P_MALLOC,
P_MEMALIGN,
P_FREE,
P_KBOOT_BOOT = 0x700, // Kernel boot ops
P_KBOOT_SET_CHOSEN,
P_KBOOT_SET_INITRD,
P_KBOOT_PREPARE_DT,
P_PMGR_POWER_ENABLE = 0x800, // power/clock management ops
P_PMGR_POWER_DISABLE,
P_PMGR_ADT_POWER_ENABLE,
P_PMGR_ADT_POWER_DISABLE,
P_PMGR_RESET,
P_IODEV_SET_USAGE = 0x900,
P_IODEV_CAN_READ,
P_IODEV_CAN_WRITE,
P_IODEV_READ,
P_IODEV_WRITE,
P_IODEV_WHOAMI,
P_USB_IODEV_VUART_SETUP,
P_TUNABLES_APPLY_GLOBAL = 0xa00,
P_TUNABLES_APPLY_LOCAL,
P_TUNABLES_APPLY_LOCAL_ADDR,
P_DART_INIT = 0xb00,
P_DART_SHUTDOWN,
P_DART_MAP,
P_DART_UNMAP,
P_HV_INIT = 0xc00,
P_HV_MAP,
P_HV_START,
P_HV_TRANSLATE,
P_HV_PT_WALK,
P_HV_MAP_VUART,
P_HV_TRACE_IRQ,
P_HV_WDT_START,
P_HV_START_SECONDARY,
P_HV_SWITCH_CPU,
P_HV_SET_TIME_STEALING,
P_HV_PIN_CPU,
P_HV_WRITE_HCR,
P_HV_MAP_VIRTIO,
P_VIRTIO_PUT_BUFFER,
P_HV_EXIT_CPU,
P_HV_ADD_TIME,
P_FB_INIT = 0xd00,
P_FB_SHUTDOWN,
P_FB_BLIT,
P_FB_UNBLIT,
P_FB_FILL,
P_FB_CLEAR,
P_FB_DISPLAY_LOGO,
P_FB_RESTORE_LOGO,
P_FB_IMPROVE_LOGO,
P_PCIE_INIT = 0xe00,
P_PCIE_SHUTDOWN,
P_NVME_INIT = 0xf00,
P_NVME_SHUTDOWN,
P_NVME_READ,
P_NVME_FLUSH,
P_MCC_GET_CARVEOUTS = 0x1000,
P_DISPLAY_INIT = 0x1100,
P_DISPLAY_CONFIGURE,
P_DISPLAY_SHUTDOWN,
P_DISPLAY_START_DCP,
P_DISPLAY_IS_EXTERNAL,
P_DAPF_INIT_ALL = 0x1200,
P_DAPF_INIT,
P_CPUFREQ_INIT = 0x1300,
} ProxyOp;
#define S_OK 0
#define S_BADCMD -1
typedef struct {
u64 opcode;
u64 args[6];
} ProxyRequest;
typedef struct {
u64 opcode;
s64 status;
u64 retval;
} ProxyReply;
int proxy_process(ProxyRequest *request, ProxyReply *reply);
#endif