xref: /optee_os/core/arch/arm/plat-sprd/main.c (revision df913c6d8a6d9fc4b0cb5146603b50d26c8f08ed)
11bb92983SJerome Forissier // SPDX-License-Identifier: BSD-2-Clause
21537d62eSAijun Sun /*
31537d62eSAijun Sun  * Copyright (c) 2016, Spreadtrum Communications Inc.
41537d62eSAijun Sun  * All rights reserved.
51537d62eSAijun Sun  *
61537d62eSAijun Sun  * Redistribution and use in source and binary forms, with or without
71537d62eSAijun Sun  * modification, are permitted provided that the following conditions are met:
81537d62eSAijun Sun  *
91537d62eSAijun Sun  * 1. Redistributions of source code must retain the above copyright notice,
101537d62eSAijun Sun  * this list of conditions and the following disclaimer.
111537d62eSAijun Sun  *
121537d62eSAijun Sun  * 2. Redistributions in binary form must reproduce the above copyright notice,
131537d62eSAijun Sun  * this list of conditions and the following disclaimer in the documentation
141537d62eSAijun Sun  * and/or other materials provided with the distribution.
151537d62eSAijun Sun  *
161537d62eSAijun Sun  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
171537d62eSAijun Sun  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
181537d62eSAijun Sun  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
191537d62eSAijun Sun  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
201537d62eSAijun Sun  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
211537d62eSAijun Sun  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
221537d62eSAijun Sun  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
231537d62eSAijun Sun  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
241537d62eSAijun Sun  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
251537d62eSAijun Sun  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
261537d62eSAijun Sun  * POSSIBILITY OF SUCH DAMAGE.
271537d62eSAijun Sun  */
281537d62eSAijun Sun 
291537d62eSAijun Sun #include <drivers/gic.h>
3065401337SJens Wiklander #include <kernel/boot.h>
31d13278b8SEtienne Carriere #include <kernel/panic.h>
321537d62eSAijun Sun #include <mm/core_memprot.h>
331537d62eSAijun Sun #include <platform_config.h>
34e9f46c74SJens Wiklander #include <trace.h>
351537d62eSAijun Sun 
36a5e82dc7SJerome Forissier register_phys_mem_pgdir(MEM_AREA_IO_NSEC,
37a5e82dc7SJerome Forissier 			ROUNDDOWN(CONSOLE_UART_BASE, CORE_MMU_PGDIR_SIZE),
38a5e82dc7SJerome Forissier 			CORE_MMU_PGDIR_SIZE);
3959fffc71SEtienne Carriere 
40a5e82dc7SJerome Forissier register_phys_mem_pgdir(MEM_AREA_IO_SEC,
41a5e82dc7SJerome Forissier 			ROUNDDOWN(GIC_BASE, CORE_MMU_PGDIR_SIZE),
42a5e82dc7SJerome Forissier 			CORE_MMU_PGDIR_SIZE);
4359fffc71SEtienne Carriere 
44a5e82dc7SJerome Forissier register_phys_mem_pgdir(MEM_AREA_IO_SEC,
45a5e82dc7SJerome Forissier 			ROUNDDOWN(GIC_BASE + GICD_OFFSET, CORE_MMU_PGDIR_SIZE),
46a5e82dc7SJerome Forissier 			CORE_MMU_PGDIR_SIZE);
4759fffc71SEtienne Carriere 
boot_primary_init_intc(void)48*df913c6dSAlvin Chang void boot_primary_init_intc(void)
491537d62eSAijun Sun {
500ee3f52eSEtienne Carriere 	gic_init(GIC_BASE + GICC_OFFSET, GIC_BASE + GICD_OFFSET);
511537d62eSAijun Sun }
521537d62eSAijun Sun 
53