158032586SSamuel Holland /* 2*bc135624SSamuel Holland * Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved. 358032586SSamuel Holland * 458032586SSamuel Holland * SPDX-License-Identifier: BSD-3-Clause 558032586SSamuel Holland */ 658032586SSamuel Holland 71083b2b3SAntonio Nino Diaz #ifndef PLATFORM_DEF_H 81083b2b3SAntonio Nino Diaz #define PLATFORM_DEF_H 958032586SSamuel Holland 1009d40e0eSAntonio Nino Diaz #include <common/tbbr/tbbr_img_def.h> 1109d40e0eSAntonio Nino Diaz #include <lib/utils_def.h> 1209d40e0eSAntonio Nino Diaz #include <plat/common/common_def.h> 1309d40e0eSAntonio Nino Diaz 1458032586SSamuel Holland #include <sunxi_mmap.h> 1558032586SSamuel Holland 1601cec8f4SAndre Przywara /* The SCP firmware is allocated the last 16KiB of SRAM A2. */ 1701cec8f4SAndre Przywara #define SUNXI_SCP_SIZE 0x4000 1801cec8f4SAndre Przywara 1901cec8f4SAndre Przywara #ifdef SUNXI_BL31_IN_DRAM 2026123ca3SAndre Przywara 2126123ca3SAndre Przywara #define BL31_BASE SUNXI_DRAM_BASE 2226123ca3SAndre Przywara #define BL31_LIMIT (SUNXI_DRAM_BASE + 0x40000) 2326123ca3SAndre Przywara 2426123ca3SAndre Przywara #define MAX_XLAT_TABLES 4 2526123ca3SAndre Przywara #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32) 2626123ca3SAndre Przywara 2726123ca3SAndre Przywara #define SUNXI_BL33_VIRT_BASE PRELOADED_BL33_BASE 2826123ca3SAndre Przywara 2901cec8f4SAndre Przywara #else /* !SUNXI_BL31_IN_DRAM */ 3001cec8f4SAndre Przywara 31ae3fe6e3SSamuel Holland #define BL31_BASE (SUNXI_SRAM_A2_BASE + 0x4000) 3257b36632SSamuel Holland #define BL31_LIMIT (SUNXI_SRAM_A2_BASE + \ 3357b36632SSamuel Holland SUNXI_SRAM_A2_SIZE - SUNXI_SCP_SIZE) 3457b36632SSamuel Holland #define SUNXI_SCP_BASE BL31_LIMIT 3558032586SSamuel Holland 36ed306a86SSamuel Holland /* Overwrite U-Boot SPL, but reserve the first page for the SPL header. */ 37ed306a86SSamuel Holland #define BL31_NOBITS_BASE (SUNXI_SRAM_A1_BASE + 0x1000) 38ed306a86SSamuel Holland #define BL31_NOBITS_LIMIT (SUNXI_SRAM_A1_BASE + SUNXI_SRAM_A1_SIZE) 39ed306a86SSamuel Holland 4001cec8f4SAndre Przywara #define MAX_XLAT_TABLES 1 4101cec8f4SAndre Przywara #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 28) 4201cec8f4SAndre Przywara #define SUNXI_BL33_VIRT_BASE (SUNXI_DRAM_VIRT_BASE + SUNXI_DRAM_SEC_SIZE) 4301cec8f4SAndre Przywara 4401cec8f4SAndre Przywara #endif /* SUNXI_BL31_IN_DRAM */ 4501cec8f4SAndre Przywara 46c3af6b00SAndre Przywara /* How much memory to reserve as secure for BL32, if configured */ 47c3af6b00SAndre Przywara #define SUNXI_DRAM_SEC_SIZE (32U << 20) 48c3af6b00SAndre Przywara 4941538930SAndre Przywara /* How much DRAM to map (to map BL33, for fetching the DTB from U-Boot) */ 50c3af6b00SAndre Przywara #define SUNXI_DRAM_MAP_SIZE (64U << 20) 51c3af6b00SAndre Przywara 5258032586SSamuel Holland #define CACHE_WRITEBACK_SHIFT 6 5358032586SSamuel Holland #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT) 5458032586SSamuel Holland 55*bc135624SSamuel Holland #define MAX_STATIC_MMAP_REGIONS 5 56*bc135624SSamuel Holland #define MAX_MMAP_REGIONS (3 + MAX_STATIC_MMAP_REGIONS) 5758032586SSamuel Holland 58e382c88eSSamuel Holland #define PLAT_CSS_SCP_COM_SHARED_MEM_BASE \ 59e382c88eSSamuel Holland (SUNXI_SRAM_A2_BASE + SUNXI_SRAM_A2_SIZE - 0x200) 60e382c88eSSamuel Holland 611083b2b3SAntonio Nino Diaz #define PLAT_MAX_PWR_LVL_STATES U(2) 621083b2b3SAntonio Nino Diaz #define PLAT_MAX_RET_STATE U(1) 631083b2b3SAntonio Nino Diaz #define PLAT_MAX_OFF_STATE U(2) 6458032586SSamuel Holland 651083b2b3SAntonio Nino Diaz #define PLAT_MAX_PWR_LVL U(2) 66e0b4cc75SDeepika Bhavnani #define PLAT_NUM_PWR_DOMAINS (U(1) + \ 6758032586SSamuel Holland PLATFORM_CLUSTER_COUNT + \ 6858032586SSamuel Holland PLATFORM_CORE_COUNT) 6958032586SSamuel Holland 7058032586SSamuel Holland #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32) 7158032586SSamuel Holland 72e0b4cc75SDeepika Bhavnani #define PLATFORM_CLUSTER_COUNT U(1) 7358032586SSamuel Holland #define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER_COUNT * \ 7458032586SSamuel Holland PLATFORM_MAX_CPUS_PER_CLUSTER) 75e0b4cc75SDeepika Bhavnani #define PLATFORM_MAX_CPUS_PER_CLUSTER U(4) 7658032586SSamuel Holland #define PLATFORM_STACK_SIZE (0x1000 / PLATFORM_CORE_COUNT) 7758032586SSamuel Holland 78dab901f8SAmit Singh Tomar #ifndef SPD_none 79dab901f8SAmit Singh Tomar #ifndef BL32_BASE 80dab901f8SAmit Singh Tomar #define BL32_BASE SUNXI_DRAM_BASE 81dab901f8SAmit Singh Tomar #endif 82dab901f8SAmit Singh Tomar #endif 83dab901f8SAmit Singh Tomar 841083b2b3SAntonio Nino Diaz #endif /* PLATFORM_DEF_H */ 85