xref: /rk3399_ARM-atf/plat/intel/soc/common/include/socfpga_sip_svc.h (revision 286b96f4bbf0cfe2fe91262015ad63a497be25f9)
1 /*
2  * Copyright (c) 2019-2022, Intel Corporation. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef SOCFPGA_SIP_SVC_H
8 #define SOCFPGA_SIP_SVC_H
9 
10 
11 /* SiP status response */
12 #define INTEL_SIP_SMC_STATUS_OK				0
13 #define INTEL_SIP_SMC_STATUS_BUSY			0x1
14 #define INTEL_SIP_SMC_STATUS_REJECTED			0x2
15 #define INTEL_SIP_SMC_STATUS_ERROR			0x4
16 #define INTEL_SIP_SMC_RSU_ERROR				0x7
17 
18 /* SiP mailbox error code */
19 #define GENERIC_RESPONSE_ERROR				0x3FF
20 
21 /* SMC SiP service function identifier */
22 
23 /* FPGA Reconfig */
24 #define INTEL_SIP_SMC_FPGA_CONFIG_START			0xC2000001
25 #define INTEL_SIP_SMC_FPGA_CONFIG_WRITE			0x42000002
26 #define INTEL_SIP_SMC_FPGA_CONFIG_COMPLETED_WRITE	0xC2000003
27 #define INTEL_SIP_SMC_FPGA_CONFIG_ISDONE		0xC2000004
28 #define INTEL_SIP_SMC_FPGA_CONFIG_GET_MEM		0xC2000005
29 
30 /* Secure Register Access */
31 #define INTEL_SIP_SMC_REG_READ				0xC2000007
32 #define INTEL_SIP_SMC_REG_WRITE				0xC2000008
33 #define INTEL_SIP_SMC_REG_UPDATE			0xC2000009
34 
35 /* Remote System Update */
36 #define INTEL_SIP_SMC_RSU_STATUS			0xC200000B
37 #define INTEL_SIP_SMC_RSU_UPDATE			0xC200000C
38 #define INTEL_SIP_SMC_RSU_NOTIFY			0xC200000E
39 #define INTEL_SIP_SMC_RSU_RETRY_COUNTER			0xC200000F
40 #define INTEL_SIP_SMC_RSU_DCMF_VERSION			0xC2000010
41 #define INTEL_SIP_SMC_RSU_COPY_DCMF_VERSION		0xC2000011
42 
43 /* Send Mailbox Command */
44 #define INTEL_SIP_SMC_MBOX_SEND_CMD			0xC200001E
45 
46 
47 /* SiP Definitions */
48 
49 /* FPGA config helpers */
50 #define INTEL_SIP_SMC_FPGA_CONFIG_ADDR			0x400000
51 #define INTEL_SIP_SMC_FPGA_CONFIG_SIZE			0x2000000
52 
53 /* SMC function IDs for SiP Service queries */
54 #define SIP_SVC_CALL_COUNT	0x8200ff00
55 #define SIP_SVC_UID		0x8200ff01
56 #define SIP_SVC_VERSION		0x8200ff03
57 
58 /* SiP Service Calls version numbers */
59 #define SIP_SVC_VERSION_MAJOR	0
60 #define SIP_SVC_VERSION_MINOR	1
61 
62 
63 /* Structure Definitions */
64 struct fpga_config_info {
65 	uint32_t addr;
66 	int size;
67 	int size_written;
68 	uint32_t write_requested;
69 	int subblocks_sent;
70 	int block_number;
71 };
72 
73 /* Function Definitions */
74 
75 bool is_address_in_ddr_range(uint64_t addr, uint64_t size);
76 
77 #endif /* SOCFPGA_SIP_SVC_H */
78