1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2018-2022, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  *
7  * Description:
8  *     N1SDP System Support
9  */
10 
11 #ifndef MOD_N1SDP_SYSTEM_H
12 #define MOD_N1SDP_SYSTEM_H
13 
14 #include <stdint.h>
15 
16 /*!
17  * \addtogroup GroupN1SDPModule N1SDP Product Modules
18  * \{
19  */
20 
21 /*!
22  * \defgroup GroupN1SDPSystem N1SDP System Support
23  * \{
24  */
25 
26 /*!
27  * \brief N1SDP system macro definitions.
28  */
29 
30 /*!
31  * N1SDP AP cores do not have internal ROM memory to boot code once they are
32  * released from reset. It is the responsibility of SCP to copy the AP
33  * firmware to internal/external memory and set the RVBAR register of the
34  * AP cores to corresponding memory's base address and then switch ON
35  * the PPU of primary core to release from reset. This macro specifies the
36  * base address of the Trusted AP SRAM to which AP firmware will be copied
37  * to and therefore the value to set in the RVBAR of all AP cores.
38  */
39 
40 /*! Offset of the Trusted SRAM between AP and SCP Address Space*/
41 #define AP_SCP_SRAM_OFFSET            UINT32_C(0xA0000000)
42 
43 /*! AP Cores Reset Address in SCP Address Space */
44 #define AP_CORE_RESET_ADDR UINT32_C(0xA4060000)
45 
46 /*! Address translation enable bit */
47 #define ADDR_TRANS_EN                 UINT32_C(0x1)
48 
49 /* QSPI Controller constants */
50 #define N1SDP_IOFPGA_SCC_BASE                0xBC130000
51 #define N1SDP_IOFPGA_SCC_QSPI_MUX_REG_OFFSET (N1SDP_IOFPGA_SCC_BASE + 0x1C)
52 #define N1SDP_SOC_QSPI_MUX_EN                0x1
53 
54 /*!
55  * Offset of NIC-400 security 0 register for
56  * non-secure CoreSight debug access
57  */
58 #define NIC_400_SEC_0_CSAPBM_OFFSET   UINT32_C(0x2A10001C)
59 
60 /*!
61  * \brief API indices.
62  */
63 enum mod_n1sdp_system_api_idx {
64     /*! API index for the driver interface of the system_power module */
65     MOD_N1SDP_SYSTEM_API_IDX_SYSTEM_POWER_DRIVER,
66 
67     /*! API index for AP memory access */
68     MOD_N1SDP_SYSTEM_API_IDX_AP_MEMORY_ACCESS,
69 
70     /*! Number of exposed interfaces */
71     MOD_N1SDP_SYSTEM_API_COUNT,
72 };
73 
74 /*!
75  * \brief APIs to enable/disable access AP memory in 1MB window.
76  */
77 struct mod_n1sdp_system_ap_memory_access_api {
78     /*!
79      * \brief Pointer to function that enables windowed access to AP memory.
80      *
81      * \param addr Base address of the 1MB AP memory window.
82      *
83      * \retval void.
84      */
85     void (*enable_ap_memory_access)(uint32_t addr);
86 
87     /*!
88      * \brief Pointer to function that disables windowed access to AP memory.
89      *
90      * \retval void.
91      */
92     void (*disable_ap_memory_access)(void);
93 };
94 
95 /*!
96  * \}
97  */
98 
99 /*!
100  * \}
101  */
102 
103 #endif /* MOD_N1SDP_SYSTEM_H */
104