2021-02-06 05:53:38 +00:00
|
|
|
/* SPDX-License-Identifier: MIT */
|
|
|
|
|
2021-01-14 09:18:07 +00:00
|
|
|
#ifndef __PROXY_H__
|
|
|
|
#define __PROXY_H__
|
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
P_NOP = 0x000, // System functions
|
|
|
|
P_EXIT,
|
|
|
|
P_CALL,
|
|
|
|
P_GET_BOOTARGS,
|
2021-01-14 18:55:20 +00:00
|
|
|
P_GET_BASE,
|
|
|
|
P_SET_BAUD,
|
2021-01-23 13:31:15 +00:00
|
|
|
P_UDELAY,
|
2021-01-30 06:14:38 +00:00
|
|
|
P_SET_EXC_GUARD,
|
|
|
|
P_GET_EXC_COUNT,
|
2021-02-24 12:46:33 +00:00
|
|
|
P_EL0_CALL,
|
2021-03-04 12:28:07 +00:00
|
|
|
P_EL1_CALL,
|
2021-04-17 08:39:44 +00:00
|
|
|
P_VECTOR,
|
2021-05-08 12:54:07 +00:00
|
|
|
P_GL1_CALL,
|
|
|
|
P_GL2_CALL,
|
2021-05-27 13:57:25 +00:00
|
|
|
P_GET_SIMD_STATE,
|
|
|
|
P_PUT_SIMD_STATE,
|
2021-06-04 06:08:06 +00:00
|
|
|
P_REBOOT,
|
2021-01-14 09:18:07 +00:00
|
|
|
|
|
|
|
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,
|
2021-02-17 20:34:25 +00:00
|
|
|
P_WRITEREAD64,
|
|
|
|
P_WRITEREAD32,
|
|
|
|
P_WRITEREAD16,
|
|
|
|
P_WRITEREAD8,
|
2021-01-14 09:18:07 +00:00
|
|
|
|
|
|
|
P_MEMCPY64 = 0x200, // Memory block transfer functions
|
|
|
|
P_MEMCPY32,
|
|
|
|
P_MEMCPY16,
|
|
|
|
P_MEMCPY8,
|
|
|
|
P_MEMSET64,
|
|
|
|
P_MEMSET32,
|
|
|
|
P_MEMSET16,
|
|
|
|
P_MEMSET8,
|
|
|
|
|
2021-01-16 15:45:10 +00:00
|
|
|
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,
|
2021-01-28 15:35:40 +00:00
|
|
|
P_MMU_SHUTDOWN,
|
2021-05-08 12:54:07 +00:00
|
|
|
P_MMU_INIT,
|
|
|
|
P_MMU_DISABLE,
|
|
|
|
P_MMU_RESTORE,
|
2021-01-14 09:18:07 +00:00
|
|
|
|
2021-01-28 15:25:40 +00:00
|
|
|
P_XZDEC = 0x400, // Decompression and data processing ops
|
2021-01-23 13:25:34 +00:00
|
|
|
P_GZDEC,
|
|
|
|
|
2021-01-28 15:25:40 +00:00
|
|
|
P_SMP_START_SECONDARIES = 0x500, // SMP and system management ops
|
|
|
|
P_SMP_CALL,
|
|
|
|
P_SMP_CALL_SYNC,
|
2021-09-17 06:25:34 +00:00
|
|
|
P_SMP_WAIT,
|
2021-01-28 15:25:40 +00:00
|
|
|
|
2021-01-29 06:19:34 +00:00
|
|
|
P_HEAPBLOCK_ALLOC = 0x600, // Heap and memory management ops
|
|
|
|
P_MALLOC,
|
|
|
|
P_MEMALIGN,
|
|
|
|
P_FREE,
|
|
|
|
|
2021-01-29 16:36:45 +00:00
|
|
|
P_KBOOT_BOOT = 0x700, // Kernel boot ops
|
|
|
|
P_KBOOT_SET_BOOTARGS,
|
|
|
|
P_KBOOT_SET_INITRD,
|
|
|
|
P_KBOOT_PREPARE_DT,
|
|
|
|
|
2021-04-08 15:11:27 +00:00
|
|
|
P_PMGR_CLOCK_ENABLE = 0x800, // power/clock management ops
|
|
|
|
P_PMGR_CLOCK_DISABLE,
|
|
|
|
P_PMGR_ADT_CLOCKS_ENABLE,
|
|
|
|
P_PMGR_ADT_CLOCKS_DISABLE,
|
|
|
|
|
2021-04-15 14:17:15 +00:00
|
|
|
P_IODEV_SET_USAGE = 0x900,
|
|
|
|
P_IODEV_CAN_READ,
|
|
|
|
P_IODEV_CAN_WRITE,
|
|
|
|
P_IODEV_READ,
|
|
|
|
P_IODEV_WRITE,
|
2021-05-03 12:03:28 +00:00
|
|
|
P_IODEV_WHOAMI,
|
2021-04-15 14:17:15 +00:00
|
|
|
|
2021-04-06 10:37:37 +00:00
|
|
|
P_TUNABLES_APPLY_GLOBAL = 0xa00,
|
|
|
|
P_TUNABLES_APPLY_LOCAL,
|
2021-04-07 20:39:43 +00:00
|
|
|
P_TUNABLES_APPLY_LOCAL_ADDR,
|
2021-04-06 10:37:37 +00:00
|
|
|
|
2021-04-14 14:58:38 +00:00
|
|
|
P_DART_INIT = 0xb00,
|
|
|
|
P_DART_SHUTDOWN,
|
|
|
|
P_DART_MAP,
|
|
|
|
P_DART_UNMAP,
|
|
|
|
|
2021-05-01 10:05:21 +00:00
|
|
|
P_HV_INIT = 0xc00,
|
2021-05-04 10:36:23 +00:00
|
|
|
P_HV_MAP,
|
|
|
|
P_HV_START,
|
2021-05-04 15:27:21 +00:00
|
|
|
P_HV_TRANSLATE,
|
2021-05-04 18:29:11 +00:00
|
|
|
P_HV_PT_WALK,
|
2021-05-04 18:30:07 +00:00
|
|
|
P_HV_MAP_VUART,
|
2021-06-05 20:05:17 +00:00
|
|
|
P_HV_TRACE_IRQ,
|
2021-09-15 13:08:35 +00:00
|
|
|
P_HV_WDT_START,
|
2021-09-15 14:31:33 +00:00
|
|
|
P_HV_START_SECONDARY,
|
2021-09-21 04:18:06 +00:00
|
|
|
P_HV_SWITCH_CPU,
|
2021-05-01 10:05:21 +00:00
|
|
|
|
2021-05-07 18:42:21 +00:00
|
|
|
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,
|
2021-05-07 18:44:16 +00:00
|
|
|
P_FB_IMPROVE_LOGO,
|
2021-05-07 18:42:21 +00:00
|
|
|
|
2021-01-14 09:18:07 +00:00
|
|
|
} ProxyOp;
|
|
|
|
|
2021-01-28 06:27:35 +00:00
|
|
|
#define S_OK 0
|
2021-01-14 09:18:07 +00:00
|
|
|
#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
|