Hadi Asyrafi | ab1132f | 2019-10-22 10:31:45 +0800 | [diff] [blame] | 1 | /* |
Abdul Halim, Muhammad Hadi Asyrafi | ec164b6 | 2020-05-14 14:53:29 +0800 | [diff] [blame] | 2 | * Copyright (c) 2019-2020, Intel Corporation. All rights reserved. |
Hadi Asyrafi | ab1132f | 2019-10-22 10:31:45 +0800 | [diff] [blame] | 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 |
Hadi Asyrafi | ab1132f | 2019-10-22 10:31:45 +0800 | [diff] [blame] | 13 | #define INTEL_SIP_SMC_STATUS_BUSY 0x1 |
| 14 | #define INTEL_SIP_SMC_STATUS_REJECTED 0x2 |
Abdul Halim, Muhammad Hadi Asyrafi | 25f623e | 2020-02-27 10:23:48 +0800 | [diff] [blame] | 15 | #define INTEL_SIP_SMC_STATUS_ERROR 0x4 |
| 16 | #define INTEL_SIP_SMC_RSU_ERROR 0x7 |
| 17 | |
Hadi Asyrafi | ab1132f | 2019-10-22 10:31:45 +0800 | [diff] [blame] | 18 | |
| 19 | /* SMC SiP service function identifier */ |
Abdul Halim, Muhammad Hadi Asyrafi | ec164b6 | 2020-05-14 14:53:29 +0800 | [diff] [blame] | 20 | |
| 21 | /* FPGA Reconfig */ |
Hadi Asyrafi | ab1132f | 2019-10-22 10:31:45 +0800 | [diff] [blame] | 22 | #define INTEL_SIP_SMC_FPGA_CONFIG_START 0xC2000001 |
| 23 | #define INTEL_SIP_SMC_FPGA_CONFIG_WRITE 0x42000002 |
| 24 | #define INTEL_SIP_SMC_FPGA_CONFIG_COMPLETED_WRITE 0xC2000003 |
| 25 | #define INTEL_SIP_SMC_FPGA_CONFIG_ISDONE 0xC2000004 |
| 26 | #define INTEL_SIP_SMC_FPGA_CONFIG_GET_MEM 0xC2000005 |
Abdul Halim, Muhammad Hadi Asyrafi | ec164b6 | 2020-05-14 14:53:29 +0800 | [diff] [blame] | 27 | |
| 28 | /* Secure Register Access */ |
Hadi Asyrafi | ab1132f | 2019-10-22 10:31:45 +0800 | [diff] [blame] | 29 | #define INTEL_SIP_SMC_REG_READ 0xC2000007 |
| 30 | #define INTEL_SIP_SMC_REG_WRITE 0xC2000008 |
| 31 | #define INTEL_SIP_SMC_REG_UPDATE 0xC2000009 |
Abdul Halim, Muhammad Hadi Asyrafi | ec164b6 | 2020-05-14 14:53:29 +0800 | [diff] [blame] | 32 | |
| 33 | /* Remote System Update */ |
Hadi Asyrafi | ab1132f | 2019-10-22 10:31:45 +0800 | [diff] [blame] | 34 | #define INTEL_SIP_SMC_RSU_STATUS 0xC200000B |
| 35 | #define INTEL_SIP_SMC_RSU_UPDATE 0xC200000C |
Hadi Asyrafi | ab1132f | 2019-10-22 10:31:45 +0800 | [diff] [blame] | 36 | #define INTEL_SIP_SMC_RSU_NOTIFY 0xC200000E |
| 37 | #define INTEL_SIP_SMC_RSU_RETRY_COUNTER 0xC200000F |
Abdul Halim, Muhammad Hadi Asyrafi | ec164b6 | 2020-05-14 14:53:29 +0800 | [diff] [blame] | 38 | |
| 39 | /* Send Mailbox Command */ |
Hadi Asyrafi | a33e810 | 2019-12-17 19:30:41 +0800 | [diff] [blame] | 40 | #define INTEL_SIP_SMC_MBOX_SEND_CMD 0xC200001E |
Hadi Asyrafi | ab1132f | 2019-10-22 10:31:45 +0800 | [diff] [blame] | 41 | |
Abdul Halim, Muhammad Hadi Asyrafi | ec164b6 | 2020-05-14 14:53:29 +0800 | [diff] [blame] | 42 | |
| 43 | /* SiP Definitions */ |
| 44 | |
Hadi Asyrafi | ab1132f | 2019-10-22 10:31:45 +0800 | [diff] [blame] | 45 | /* FPGA config helpers */ |
Tien Hock, Loh | 500b232 | 2019-10-30 14:49:40 +0800 | [diff] [blame] | 46 | #define INTEL_SIP_SMC_FPGA_CONFIG_ADDR 0x400000 |
Richard Gong | 99b5e16 | 2020-04-13 09:40:43 -0500 | [diff] [blame] | 47 | #define INTEL_SIP_SMC_FPGA_CONFIG_SIZE 0x2000000 |
Hadi Asyrafi | ab1132f | 2019-10-22 10:31:45 +0800 | [diff] [blame] | 48 | |
| 49 | /* SMC function IDs for SiP Service queries */ |
| 50 | #define SIP_SVC_CALL_COUNT 0x8200ff00 |
| 51 | #define SIP_SVC_UID 0x8200ff01 |
| 52 | #define SIP_SVC_VERSION 0x8200ff03 |
| 53 | |
| 54 | /* SiP Service Calls version numbers */ |
| 55 | #define SIP_SVC_VERSION_MAJOR 0 |
| 56 | #define SIP_SVC_VERSION_MINOR 1 |
| 57 | |
Abdul Halim, Muhammad Hadi Asyrafi | 20a07f3 | 2020-05-18 11:16:48 +0800 | [diff] [blame] | 58 | |
| 59 | /* Structure Definitions */ |
| 60 | struct fpga_config_info { |
| 61 | uint32_t addr; |
| 62 | int size; |
| 63 | int size_written; |
| 64 | uint32_t write_requested; |
| 65 | int subblocks_sent; |
| 66 | int block_number; |
| 67 | }; |
| 68 | |
| 69 | /* Function Definitions */ |
| 70 | |
| 71 | bool is_address_in_ddr_range(uint64_t addr, uint64_t size); |
| 72 | |
Hadi Asyrafi | ab1132f | 2019-10-22 10:31:45 +0800 | [diff] [blame] | 73 | #endif /* SOCFPGA_SIP_SVC_H */ |