14368ae07SMichael Brandl /* 24368ae07SMichael Brandl * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. 34368ae07SMichael Brandl * 44368ae07SMichael Brandl * SPDX-License-Identifier: BSD-3-Clause 54368ae07SMichael Brandl */ 64368ae07SMichael Brandl 7*c3cf06f1SAntonio Nino Diaz #ifndef HIKEY_LAYOUT_H 8*c3cf06f1SAntonio Nino Diaz #define HIKEY_LAYOUT_H 94368ae07SMichael Brandl 104368ae07SMichael Brandl /* 114368ae07SMichael Brandl * Platform memory map related constants 124368ae07SMichael Brandl */ 134368ae07SMichael Brandl #define XG2RAM0_BASE 0xF9800000 144368ae07SMichael Brandl #define XG2RAM0_SIZE 0x00400000 154368ae07SMichael Brandl 164368ae07SMichael Brandl /* 174368ae07SMichael Brandl * BL1 is stored in XG2RAM0_HIRQ that is 784KB large (0xF980_0000~0xF98C_4000). 184368ae07SMichael Brandl */ 194368ae07SMichael Brandl #define ONCHIPROM_PARAM_BASE (XG2RAM0_BASE + 0x700) 204368ae07SMichael Brandl #define LOADER_RAM_BASE (XG2RAM0_BASE + 0x800) 214368ae07SMichael Brandl #define BL1_XG2RAM0_OFFSET 0x1000 224368ae07SMichael Brandl 234368ae07SMichael Brandl /* 244368ae07SMichael Brandl * BL1 specific defines. 254368ae07SMichael Brandl * 264368ae07SMichael Brandl * Both loader and BL1_RO region stay in SRAM since they are used to simulate 274368ae07SMichael Brandl * ROM. 284368ae07SMichael Brandl * Loader is used to switch Hi6220 SoC from 32-bit to 64-bit mode. 294368ae07SMichael Brandl * 304368ae07SMichael Brandl * ++++++++++ 0xF980_0000 314368ae07SMichael Brandl * + loader + 324368ae07SMichael Brandl * ++++++++++ 0xF980_1000 334368ae07SMichael Brandl * + BL1_RO + 3499eb5ae8SHaojian Zhuang * ++++++++++ 0xF981_8000 354368ae07SMichael Brandl * + BL1_RW + 364368ae07SMichael Brandl * ++++++++++ 0xF989_8000 374368ae07SMichael Brandl */ 384368ae07SMichael Brandl #define BL1_RO_BASE (XG2RAM0_BASE + BL1_XG2RAM0_OFFSET) 3999eb5ae8SHaojian Zhuang #define BL1_RO_LIMIT (XG2RAM0_BASE + 0x18000) 4099eb5ae8SHaojian Zhuang #define BL1_RW_BASE (BL1_RO_LIMIT) /* 0xf981_8000 */ 4199eb5ae8SHaojian Zhuang #define BL1_RW_SIZE (0x00080000) 424368ae07SMichael Brandl #define BL1_RW_LIMIT (0xF9898000) 434368ae07SMichael Brandl 444368ae07SMichael Brandl /* 454368ae07SMichael Brandl * Non-Secure BL1U specific defines. 464368ae07SMichael Brandl */ 4799eb5ae8SHaojian Zhuang #define NS_BL1U_BASE (0xf9828000) 484368ae07SMichael Brandl #define NS_BL1U_SIZE (0x00010000) 494368ae07SMichael Brandl #define NS_BL1U_LIMIT (NS_BL1U_BASE + NS_BL1U_SIZE) 504368ae07SMichael Brandl 514368ae07SMichael Brandl /* 524368ae07SMichael Brandl * BL2 specific defines. 534368ae07SMichael Brandl * 544368ae07SMichael Brandl * Both loader and BL2 region stay in SRAM. 554368ae07SMichael Brandl * Loader is used to switch Hi6220 SoC from 32-bit to 64-bit mode. 564368ae07SMichael Brandl * 574368ae07SMichael Brandl * ++++++++++ 0xF980_0000 584368ae07SMichael Brandl * + loader + 594368ae07SMichael Brandl * ++++++++++ 0xF980_1000 604368ae07SMichael Brandl * + BL2 + 61e59a3bffSTeddy Reed * ++++++++++ 0xF983_0000 624368ae07SMichael Brandl */ 634368ae07SMichael Brandl #define BL2_BASE (BL1_RO_BASE) /* 0xf980_1000 */ 64e59a3bffSTeddy Reed #define BL2_LIMIT (0xF9830000) /* 0xf983_0000 */ 654368ae07SMichael Brandl 664368ae07SMichael Brandl /* 674368ae07SMichael Brandl * SCP_BL2 specific defines. 684368ae07SMichael Brandl * In HiKey, SCP_BL2 means MCU firmware. It's loaded into the temporary buffer 694368ae07SMichael Brandl * at 0x0100_0000. Then BL2 will parse the sections and loaded them into 704368ae07SMichael Brandl * predefined separated buffers. 714368ae07SMichael Brandl */ 724368ae07SMichael Brandl #define SCP_BL2_BASE (DDR_BASE + 0x01000000) 734368ae07SMichael Brandl #define SCP_BL2_LIMIT (SCP_BL2_BASE + 0x00100000) 744368ae07SMichael Brandl #define SCP_BL2_SIZE (SCP_BL2_LIMIT - SCP_BL2_BASE) 754368ae07SMichael Brandl 764368ae07SMichael Brandl /* 774368ae07SMichael Brandl * BL31 specific defines. 784368ae07SMichael Brandl */ 794368ae07SMichael Brandl #define BL31_BASE (0xF9858000) /* 0xf985_8000 */ 804368ae07SMichael Brandl #define BL31_LIMIT (0xF9898000) 814368ae07SMichael Brandl 824368ae07SMichael Brandl /* 834368ae07SMichael Brandl * BL3-2 specific defines. 844368ae07SMichael Brandl */ 854368ae07SMichael Brandl 864368ae07SMichael Brandl /* 874368ae07SMichael Brandl * The TSP currently executes from TZC secured area of DRAM or SRAM. 884368ae07SMichael Brandl */ 894368ae07SMichael Brandl #define BL32_SRAM_BASE BL31_LIMIT 904368ae07SMichael Brandl #define BL32_SRAM_LIMIT (BL31_LIMIT+0x80000) /* 512K */ 914368ae07SMichael Brandl 924368ae07SMichael Brandl #define BL32_DRAM_BASE DDR_SEC_BASE 934368ae07SMichael Brandl #define BL32_DRAM_LIMIT (DDR_SEC_BASE+DDR_SEC_SIZE) 944368ae07SMichael Brandl 954368ae07SMichael Brandl #ifdef SPD_opteed 964368ae07SMichael Brandl /* Load pageable part of OP-TEE at end of allocated DRAM space for BL32 */ 974368ae07SMichael Brandl #define HIKEY_OPTEE_PAGEABLE_LOAD_BASE (BL32_DRAM_LIMIT - HIKEY_OPTEE_PAGEABLE_LOAD_SIZE) /* 0x3FC0_0000 */ 984368ae07SMichael Brandl #define HIKEY_OPTEE_PAGEABLE_LOAD_SIZE 0x400000 /* 4MB */ 994368ae07SMichael Brandl #endif 1004368ae07SMichael Brandl 1014368ae07SMichael Brandl #if (HIKEY_TSP_RAM_LOCATION_ID == HIKEY_DRAM_ID) 1024368ae07SMichael Brandl #define TSP_SEC_MEM_BASE BL32_DRAM_BASE 1034368ae07SMichael Brandl #define TSP_SEC_MEM_SIZE (BL32_DRAM_LIMIT - BL32_DRAM_BASE) 1044368ae07SMichael Brandl #define BL32_BASE BL32_DRAM_BASE 1054368ae07SMichael Brandl #define BL32_LIMIT BL32_DRAM_LIMIT 1064368ae07SMichael Brandl #elif (HIKEY_TSP_RAM_LOCATION_ID == HIKEY_SRAM_ID) 1074368ae07SMichael Brandl #define TSP_SEC_MEM_BASE BL32_SRAM_BASE 1084368ae07SMichael Brandl #define TSP_SEC_MEM_SIZE (BL32_SRAM_LIMIT - BL32_SRAM_BASE) 1094368ae07SMichael Brandl #define BL32_BASE BL32_SRAM_BASE 1104368ae07SMichael Brandl #define BL32_LIMIT BL32_SRAM_LIMIT 1114368ae07SMichael Brandl #else 1124368ae07SMichael Brandl #error "Currently unsupported HIKEY_TSP_LOCATION_ID value" 1134368ae07SMichael Brandl #endif 1144368ae07SMichael Brandl 1154368ae07SMichael Brandl /* BL32 is mandatory in AArch32 */ 1164368ae07SMichael Brandl #ifndef AARCH32 1174368ae07SMichael Brandl #ifdef SPD_none 1184368ae07SMichael Brandl #undef BL32_BASE 1194368ae07SMichael Brandl #endif /* SPD_none */ 1204368ae07SMichael Brandl #endif 1214368ae07SMichael Brandl 122*c3cf06f1SAntonio Nino Diaz #endif /* HIKEY_LAYOUT_H */ 123