Hadi Asyrafi | ab1132f | 2019-10-22 10:31:45 +0800 | [diff] [blame] | 1 | /* |
Sieu Mun Tang | 9f22cbf | 2022-03-02 11:04:09 +0800 | [diff] [blame] | 2 | * Copyright (c) 2019-2022, 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 | |
Sieu Mun Tang | 9f22cbf | 2022-03-02 11:04:09 +0800 | [diff] [blame] | 18 | /* SiP mailbox error code */ |
| 19 | #define GENERIC_RESPONSE_ERROR 0x3FF |
Hadi Asyrafi | ab1132f | 2019-10-22 10:31:45 +0800 | [diff] [blame] | 20 | |
| 21 | /* SMC SiP service function identifier */ |
Abdul Halim, Muhammad Hadi Asyrafi | ec164b6 | 2020-05-14 14:53:29 +0800 | [diff] [blame] | 22 | |
| 23 | /* FPGA Reconfig */ |
Hadi Asyrafi | ab1132f | 2019-10-22 10:31:45 +0800 | [diff] [blame] | 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 |
Abdul Halim, Muhammad Hadi Asyrafi | ec164b6 | 2020-05-14 14:53:29 +0800 | [diff] [blame] | 29 | |
| 30 | /* Secure Register Access */ |
Hadi Asyrafi | ab1132f | 2019-10-22 10:31:45 +0800 | [diff] [blame] | 31 | #define INTEL_SIP_SMC_REG_READ 0xC2000007 |
| 32 | #define INTEL_SIP_SMC_REG_WRITE 0xC2000008 |
| 33 | #define INTEL_SIP_SMC_REG_UPDATE 0xC2000009 |
Abdul Halim, Muhammad Hadi Asyrafi | ec164b6 | 2020-05-14 14:53:29 +0800 | [diff] [blame] | 34 | |
| 35 | /* Remote System Update */ |
Hadi Asyrafi | ab1132f | 2019-10-22 10:31:45 +0800 | [diff] [blame] | 36 | #define INTEL_SIP_SMC_RSU_STATUS 0xC200000B |
| 37 | #define INTEL_SIP_SMC_RSU_UPDATE 0xC200000C |
Hadi Asyrafi | ab1132f | 2019-10-22 10:31:45 +0800 | [diff] [blame] | 38 | #define INTEL_SIP_SMC_RSU_NOTIFY 0xC200000E |
| 39 | #define INTEL_SIP_SMC_RSU_RETRY_COUNTER 0xC200000F |
Sieu Mun Tang | 9f22cbf | 2022-03-02 11:04:09 +0800 | [diff] [blame] | 40 | #define INTEL_SIP_SMC_RSU_DCMF_VERSION 0xC2000010 |
| 41 | #define INTEL_SIP_SMC_RSU_COPY_DCMF_VERSION 0xC2000011 |
Abdul Halim, Muhammad Hadi Asyrafi | ec164b6 | 2020-05-14 14:53:29 +0800 | [diff] [blame] | 42 | |
Sieu Mun Tang | dbcc2cf | 2022-03-07 12:13:04 +0800 | [diff] [blame] | 43 | |
| 44 | /* ECC */ |
| 45 | #define INTEL_SIP_SMC_ECC_DBE 0xC200000D |
| 46 | |
Abdul Halim, Muhammad Hadi Asyrafi | ec164b6 | 2020-05-14 14:53:29 +0800 | [diff] [blame] | 47 | /* Send Mailbox Command */ |
Hadi Asyrafi | a33e810 | 2019-12-17 19:30:41 +0800 | [diff] [blame] | 48 | #define INTEL_SIP_SMC_MBOX_SEND_CMD 0xC200001E |
Hadi Asyrafi | ab1132f | 2019-10-22 10:31:45 +0800 | [diff] [blame] | 49 | |
Abdul Halim, Muhammad Hadi Asyrafi | ec164b6 | 2020-05-14 14:53:29 +0800 | [diff] [blame] | 50 | |
| 51 | /* SiP Definitions */ |
| 52 | |
Sieu Mun Tang | dbcc2cf | 2022-03-07 12:13:04 +0800 | [diff] [blame] | 53 | /* ECC DBE */ |
| 54 | #define WARM_RESET_WFI_FLAG BIT(31) |
| 55 | #define SYSMGR_ECC_DBE_COLD_RST_MASK (SYSMGR_ECC_OCRAM_MASK |\ |
| 56 | SYSMGR_ECC_DDR0_MASK |\ |
| 57 | SYSMGR_ECC_DDR1_MASK) |
| 58 | |
Hadi Asyrafi | ab1132f | 2019-10-22 10:31:45 +0800 | [diff] [blame] | 59 | /* SMC function IDs for SiP Service queries */ |
| 60 | #define SIP_SVC_CALL_COUNT 0x8200ff00 |
| 61 | #define SIP_SVC_UID 0x8200ff01 |
| 62 | #define SIP_SVC_VERSION 0x8200ff03 |
| 63 | |
| 64 | /* SiP Service Calls version numbers */ |
| 65 | #define SIP_SVC_VERSION_MAJOR 0 |
| 66 | #define SIP_SVC_VERSION_MINOR 1 |
| 67 | |
Abdul Halim, Muhammad Hadi Asyrafi | 20a07f3 | 2020-05-18 11:16:48 +0800 | [diff] [blame] | 68 | |
| 69 | /* Structure Definitions */ |
| 70 | struct fpga_config_info { |
| 71 | uint32_t addr; |
| 72 | int size; |
| 73 | int size_written; |
| 74 | uint32_t write_requested; |
| 75 | int subblocks_sent; |
| 76 | int block_number; |
| 77 | }; |
| 78 | |
| 79 | /* Function Definitions */ |
| 80 | |
| 81 | bool is_address_in_ddr_range(uint64_t addr, uint64_t size); |
| 82 | |
Sieu Mun Tang | dbcc2cf | 2022-03-07 12:13:04 +0800 | [diff] [blame] | 83 | /* ECC DBE */ |
| 84 | bool cold_reset_for_ecc_dbe(void); |
| 85 | uint32_t intel_ecc_dbe_notification(uint64_t dbe_value); |
| 86 | |
Hadi Asyrafi | ab1132f | 2019-10-22 10:31:45 +0800 | [diff] [blame] | 87 | #endif /* SOCFPGA_SIP_SVC_H */ |