1 /* 2 * Renesas SCP/MCP Software 3 * Copyright (c) 2020-2021, Renesas Electronics Corporation. All rights 4 * reserved. 5 * 6 * SPDX-License-Identifier: BSD-3-Clause 7 */ 8 9 #ifndef SOFTWARE_MMAP_H 10 #define SOFTWARE_MMAP_H 11 12 #include <system_mmap.h> 13 14 #include <fwk_macros.h> 15 16 /* 17 * The 4KiB AP/SCP Shared memory at the base of Trusted SRAM is used for several 18 * purposes. These are: the Shared Data Storage (SDS) Memory Region, the SCMI 19 * secure payload areas, and the context area for Application Processor 20 * firmware. 21 * 22 * Shared Data Storage (SDS) Memory Region: Used for structured storage of data 23 * that is shared between SCP Firmware and Application Processor firmware. The 24 * SDS Memory Region occupies the area between the context region base and 25 * the SCMI Secure Payload base. 26 * 27 * SCMI Secure Payload Areas: Storage for SCMI message contents in both the 28 * Agent->Platform and Platform->Agent directions. 29 * 30 * Application Processor Context Area: The usage of this area is defined by the 31 * firmware running on the Application Processors. The SCP Firmware must zero 32 * this memory before releasing any Application Processors. This area must 33 * always be located in the top 64 bytes of the 4KiB reserved region. 34 * 35 * +-----------------------+ 4096 36 * | | 37 * 64B | AP Context Area | 38 * | | 39 * +-----------------------+ 40 * | | 41 * 256B | Unused | 42 * | | 43 * +-----------------------+ 44 * | | 45 * | SCMI Sec. Payload | 46 * 128B | Platform to Agent | 47 * | | 48 * +-----------------------+ 49 * | | 50 * 128B | SCMI Sec. Payload | 51 * | Agent to Platform | 52 * | | 53 * +-----------------------+ 54 * | | 55 * 3520B | SDS Memory Region | 56 * | | 57 * +-----------------------+ 0 58 */ 59 60 /* Secure shared memory at the base of Trusted SRAM */ 61 #define SHARED_SECURE_BASE (TRUSTED_RAM_BASE) 62 #define SHARED_SECURE_SIZE (4 * FWK_KIB) 63 64 /* SDS Memory Region */ 65 #define SDS_MEM_BASE (SHARED_SECURE_BASE) 66 #if 0 /* Tentative */ 67 # define SDS_MEM_SIZE (3520) 68 #else 69 # define SDS_MEM_SIZE (0) 70 #endif 71 72 /* AP Context Area */ 73 #define AP_CONTEXT_BASE \ 74 (SHARED_SECURE_BASE + SHARED_SECURE_SIZE - AP_CONTEXT_SIZE) 75 #define AP_CONTEXT_SIZE (64) 76 77 /* SCMI Secure Payload Areas */ 78 #define SCMI_PAYLOAD_SIZE (128) 79 #define SCMI_PAYLOAD_S_A2P_BASE (SDS_MEM_BASE + SDS_MEM_SIZE) 80 #define SCMI_PAYLOAD_S_P2A_BASE (SCMI_PAYLOAD_S_A2P_BASE + SCMI_PAYLOAD_SIZE) 81 82 /* 83 * The 4KiB AP/SCP Shared memory at the base of Non-trusted SRAM is used for the 84 * SCMI non-secure payload areas. 85 * 86 * Two SCMI non-Secure Payload Areas: Storage for SCMI message contents in both 87 * the Agent->Platform and Platform->Agent directions. 88 * 89 * +-----------------------+ 4096 90 * 3584B | Unused | 91 * +-----------------------+ 92 * | | 93 * | Non-Sec. Channel 1 | 94 * | SCMI non-Sec. Payload | 95 * 128B | Platform to Agent | 96 * | | 97 * +-----------------------+ 98 * | | 99 * | Non-Sec. Channel 1 | 100 * 128B | SCMI non-Sec. Payload | 101 * | Agent to Platform | 102 * | | 103 * +-----------------------+ 104 * | | 105 * | Non-Sec. Channel 0 | 106 * | SCMI non-Sec. Payload | 107 * 128B | Platform to Agent | 108 * | | 109 * +-----------------------+ 110 * | | 111 * | Non-Sec. Channel 0 | 112 * 128B | SCMI non-Sec. Payload | 113 * | Agent to Platform | 114 * | | 115 * +-----------------------+ 0 116 */ 117 118 /* Non-secure shared memory at the base of Non-trusted SRAM */ 119 #define SHARED_NONSECURE_BASE (NONTRUSTED_RAM_BASE) 120 #define SHARED_NONSECURE_SIZE (8 * FWK_KIB) 121 122 /* SCMI Non-Secure Payload Areas */ 123 #define SCMI_PAYLOAD0_NS_A2P_BASE (SHARED_NONSECURE_BASE) 124 #define SCMI_PAYLOAD0_NS_A2P_VMM (SCMI_PAYLOAD0_NS_A2P_BASE + SHARED_NONSECURE_SIZE * 1) 125 #define SCMI_PAYLOAD0_NS_A2P_VM1 (SCMI_PAYLOAD0_NS_A2P_BASE + SHARED_NONSECURE_SIZE * 2) 126 #define SCMI_PAYLOAD0_NS_A2P_VM2 (SCMI_PAYLOAD0_NS_A2P_BASE + SHARED_NONSECURE_SIZE * 3) 127 #define SCMI_PAYLOAD0_NS_P2A_BASE \ 128 (SCMI_PAYLOAD0_NS_A2P_BASE + SCMI_PAYLOAD_SIZE) 129 #define SCMI_PAYLOAD1_NS_A2P_BASE \ 130 (SCMI_PAYLOAD0_NS_P2A_BASE + SCMI_PAYLOAD_SIZE) 131 #define SCMI_PAYLOAD1_NS_P2A_BASE \ 132 (SCMI_PAYLOAD1_NS_A2P_BASE + SCMI_PAYLOAD_SIZE) 133 134 #endif /* SOFTWARE_MMAP_H */ 135