1b4315306SDan Handley /* 2ecf70f7bSVikram Kanigiri * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved. 3b4315306SDan Handley * 4b4315306SDan Handley * Redistribution and use in source and binary forms, with or without 5b4315306SDan Handley * modification, are permitted provided that the following conditions are met: 6b4315306SDan Handley * 7b4315306SDan Handley * Redistributions of source code must retain the above copyright notice, this 8b4315306SDan Handley * list of conditions and the following disclaimer. 9b4315306SDan Handley * 10b4315306SDan Handley * Redistributions in binary form must reproduce the above copyright notice, 11b4315306SDan Handley * this list of conditions and the following disclaimer in the documentation 12b4315306SDan Handley * and/or other materials provided with the distribution. 13b4315306SDan Handley * 14b4315306SDan Handley * Neither the name of ARM nor the names of its contributors may be used 15b4315306SDan Handley * to endorse or promote products derived from this software without specific 16b4315306SDan Handley * prior written permission. 17b4315306SDan Handley * 18b4315306SDan Handley * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19b4315306SDan Handley * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20b4315306SDan Handley * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21b4315306SDan Handley * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22b4315306SDan Handley * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23b4315306SDan Handley * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24b4315306SDan Handley * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25b4315306SDan Handley * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26b4315306SDan Handley * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27b4315306SDan Handley * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28b4315306SDan Handley * POSSIBILITY OF SUCH DAMAGE. 29b4315306SDan Handley */ 30b4315306SDan Handley 31b4315306SDan Handley #ifndef __CSS_DEF_H__ 32b4315306SDan Handley #define __CSS_DEF_H__ 33b4315306SDan Handley 34b4315306SDan Handley #include <arm_def.h> 35b4315306SDan Handley #include <tzc400.h> 36b4315306SDan Handley 37b4315306SDan Handley /************************************************************************* 38b4315306SDan Handley * Definitions common to all ARM Compute SubSystems (CSS) 39b4315306SDan Handley *************************************************************************/ 40b4315306SDan Handley #define NSROM_BASE 0x1f000000 41b4315306SDan Handley #define NSROM_SIZE 0x00001000 42b4315306SDan Handley 43b4315306SDan Handley /* Following covers CSS Peripherals excluding NSROM and NSRAM */ 44b4315306SDan Handley #define CSS_DEVICE_BASE 0x20000000 45b4315306SDan Handley #define CSS_DEVICE_SIZE 0x0e000000 46b4315306SDan Handley 47b4315306SDan Handley #define NSRAM_BASE 0x2e000000 48b4315306SDan Handley #define NSRAM_SIZE 0x00008000 49b4315306SDan Handley 50436223deSYatharth Kochar /* System Security Control Registers */ 51436223deSYatharth Kochar #define SSC_REG_BASE 0x2a420000 52436223deSYatharth Kochar #define SSC_GPRETN (SSC_REG_BASE + 0x030) 53436223deSYatharth Kochar 54b4315306SDan Handley /* The slave_bootsecure controls access to GPU, DMC and CS. */ 55b4315306SDan Handley #define CSS_NIC400_SLAVE_BOOTSECURE 8 56b4315306SDan Handley 57b4315306SDan Handley /* Interrupt handling constants */ 58b4315306SDan Handley #define CSS_IRQ_MHU 69 59b4315306SDan Handley #define CSS_IRQ_GPU_SMMU_0 71 60b4315306SDan Handley #define CSS_IRQ_TZC 80 61b4315306SDan Handley #define CSS_IRQ_TZ_WDOG 86 62a7270d35SVikram Kanigiri #define CSS_IRQ_SEC_SYS_TIMER 91 63b4315306SDan Handley 649255da5fSSandrine Bailleux /* 6527573c59SAchin Gupta * Define a list of Group 1 Secure interrupts as per GICv3 terminology. On a 6627573c59SAchin Gupta * GICv2 system or mode, the interrupts will be treated as Group 0 interrupts. 6727573c59SAchin Gupta */ 6827573c59SAchin Gupta #define CSS_G1S_IRQS CSS_IRQ_MHU, \ 6927573c59SAchin Gupta CSS_IRQ_GPU_SMMU_0, \ 7027573c59SAchin Gupta CSS_IRQ_TZC, \ 7127573c59SAchin Gupta CSS_IRQ_TZ_WDOG, \ 7227573c59SAchin Gupta CSS_IRQ_SEC_SYS_TIMER 7327573c59SAchin Gupta 7427573c59SAchin Gupta /* 759255da5fSSandrine Bailleux * SCP <=> AP boot configuration 769255da5fSSandrine Bailleux * 779255da5fSSandrine Bailleux * The SCP/AP boot configuration is a 32-bit word located at a known offset from 788e083ecdSVikram Kanigiri * the start of the Trusted SRAM. 799255da5fSSandrine Bailleux * 809255da5fSSandrine Bailleux * Note that the value stored at this address is only valid at boot time, before 81f59821d5SJuan Castillo * the SCP_BL2 image is transferred to SCP. 829255da5fSSandrine Bailleux */ 838e083ecdSVikram Kanigiri #define SCP_BOOT_CFG_ADDR PLAT_CSS_SCP_COM_SHARED_MEM_BASE 84b4315306SDan Handley 85b4315306SDan Handley #define CSS_MAP_DEVICE MAP_REGION_FLAT( \ 86b4315306SDan Handley CSS_DEVICE_BASE, \ 87b4315306SDan Handley CSS_DEVICE_SIZE, \ 88b4315306SDan Handley MT_DEVICE | MT_RW | MT_SECURE) 89b4315306SDan Handley 90421295a0SVikram Kanigiri /* Platform ID address */ 91421295a0SVikram Kanigiri #define SSC_VERSION_OFFSET 0x040 92421295a0SVikram Kanigiri 93421295a0SVikram Kanigiri #define SSC_VERSION_CONFIG_SHIFT 28 94421295a0SVikram Kanigiri #define SSC_VERSION_MAJOR_REV_SHIFT 24 95421295a0SVikram Kanigiri #define SSC_VERSION_MINOR_REV_SHIFT 20 96421295a0SVikram Kanigiri #define SSC_VERSION_DESIGNER_ID_SHIFT 12 97421295a0SVikram Kanigiri #define SSC_VERSION_PART_NUM_SHIFT 0x0 98421295a0SVikram Kanigiri #define SSC_VERSION_CONFIG_MASK 0xf 99421295a0SVikram Kanigiri #define SSC_VERSION_MAJOR_REV_MASK 0xf 100421295a0SVikram Kanigiri #define SSC_VERSION_MINOR_REV_MASK 0xf 101421295a0SVikram Kanigiri #define SSC_VERSION_DESIGNER_ID_MASK 0xff 102421295a0SVikram Kanigiri #define SSC_VERSION_PART_NUM_MASK 0xfff 103421295a0SVikram Kanigiri 104421295a0SVikram Kanigiri #ifndef __ASSEMBLY__ 105421295a0SVikram Kanigiri 106421295a0SVikram Kanigiri /* SSC_VERSION related accessors */ 107421295a0SVikram Kanigiri 108421295a0SVikram Kanigiri /* Returns the part number of the platform */ 109421295a0SVikram Kanigiri #define GET_SSC_VERSION_PART_NUM(val) \ 110421295a0SVikram Kanigiri (((val) >> SSC_VERSION_PART_NUM_SHIFT) & \ 111421295a0SVikram Kanigiri SSC_VERSION_PART_NUM_MASK) 112421295a0SVikram Kanigiri 113421295a0SVikram Kanigiri /* Returns the configuration number of the platform */ 114421295a0SVikram Kanigiri #define GET_SSC_VERSION_CONFIG(val) \ 115421295a0SVikram Kanigiri (((val) >> SSC_VERSION_CONFIG_SHIFT) & \ 116421295a0SVikram Kanigiri SSC_VERSION_CONFIG_MASK) 117421295a0SVikram Kanigiri 118421295a0SVikram Kanigiri #endif /* __ASSEMBLY__ */ 119b4315306SDan Handley 120b4315306SDan Handley /************************************************************************* 121b4315306SDan Handley * Required platform porting definitions common to all 122b4315306SDan Handley * ARM Compute SubSystems (CSS) 123b4315306SDan Handley ************************************************************************/ 124b4315306SDan Handley 125b4315306SDan Handley /* 1267fb9a32dSVikram Kanigiri * The loading of SCP images(SCP_BL2 or SCP_BL2U) is done if there 1277fb9a32dSVikram Kanigiri * respective base addresses are defined (i.e SCP_BL2_BASE, SCP_BL2U_BASE). 1287fb9a32dSVikram Kanigiri * Hence, `CSS_LOAD_SCP_IMAGES` needs to be set to 1 if BL2 needs to load 1297fb9a32dSVikram Kanigiri * an SCP_BL2/SCP_BL2U image. 1307fb9a32dSVikram Kanigiri */ 1317fb9a32dSVikram Kanigiri #if CSS_LOAD_SCP_IMAGES 1327fb9a32dSVikram Kanigiri /* 133f59821d5SJuan Castillo * Load address of SCP_BL2 in CSS platform ports 134d178637dSJuan Castillo * SCP_BL2 is loaded to the same place as BL31. Once SCP_BL2 is transferred to the 135d178637dSJuan Castillo * SCP, it is discarded and BL31 is loaded over the top. 136b4315306SDan Handley */ 137f59821d5SJuan Castillo #define SCP_BL2_BASE BL31_BASE 138*53d703a5SYatharth Kochar #define SCP_BL2_LIMIT (SCP_BL2_BASE + PLAT_CSS_MAX_SCP_BL2_SIZE) 139b4315306SDan Handley 140436223deSYatharth Kochar #define SCP_BL2U_BASE BL31_BASE 141*53d703a5SYatharth Kochar #define SCP_BL2U_LIMIT (SCP_BL2U_BASE + PLAT_CSS_MAX_SCP_BL2U_SIZE) 1427fb9a32dSVikram Kanigiri #endif /* CSS_LOAD_SCP_IMAGES */ 143436223deSYatharth Kochar 144b4315306SDan Handley /* Load address of Non-Secure Image for CSS platform ports */ 145b4315306SDan Handley #define PLAT_ARM_NS_IMAGE_OFFSET 0xE0000000 146b4315306SDan Handley 147b4315306SDan Handley /* TZC related constants */ 14857f78201SSoby Mathew #define PLAT_ARM_TZC_FILTERS TZC_400_REGION_ATTR_FILTER_BIT_ALL 1494b1439c5SVikram Kanigiri 150785fb92bSSoby Mathew /* Trusted mailbox base address common to all CSS */ 151785fb92bSSoby Mathew #define PLAT_ARM_TRUSTED_MAILBOX_BASE ARM_TRUSTED_SRAM_BASE 152785fb92bSSoby Mathew 1533cc17aaeSJeenu Viswambharan /* 1543cc17aaeSJeenu Viswambharan * Parsing of CPU and Cluster states, as returned by 'Get CSS Power State' SCP 1553cc17aaeSJeenu Viswambharan * command 1563cc17aaeSJeenu Viswambharan */ 1573cc17aaeSJeenu Viswambharan #define CSS_CLUSTER_PWR_STATE_ON 0 1583cc17aaeSJeenu Viswambharan #define CSS_CLUSTER_PWR_STATE_OFF 3 1593cc17aaeSJeenu Viswambharan 1603cc17aaeSJeenu Viswambharan #define CSS_CPU_PWR_STATE_ON 1 1613cc17aaeSJeenu Viswambharan #define CSS_CPU_PWR_STATE_OFF 0 1623cc17aaeSJeenu Viswambharan #define CSS_CPU_PWR_STATE(state, n) (((state) >> (n)) & 1) 163785fb92bSSoby Mathew 164b4315306SDan Handley #endif /* __CSS_DEF_H__ */ 165