xref: /rk3399_ARM-atf/plat/qemu/qemu_sbsa/platform.mk (revision 02ba6dd3619dd81eee96c19f6c9ee0f31ba6a3e9)
1#
2# Copyright (c) 2019-2023, Linaro Limited and Contributors. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7PLAT_QEMU_PATH		:=	plat/qemu/qemu_sbsa
8PLAT_QEMU_COMMON_PATH	:=	plat/qemu/common
9
10CRASH_REPORTING		:= 1
11
12# Disable the PSCI platform compatibility layer
13ENABLE_PLAT_COMPAT	:= 0
14
15SEPARATE_CODE_AND_RODATA := 1
16ENABLE_STACK_PROTECTOR	 := 0
17
18ifeq (${SPM_MM},1)
19NEED_BL32		:=	yes
20EL3_EXCEPTION_HANDLING	:=	1
21endif
22
23include plat/qemu/common/common.mk
24
25# Enable new version of image loading on QEMU platforms
26LOAD_IMAGE_V2		:=	1
27
28ifeq (${SPD},opteed)
29add-lib-optee 		:= 	yes
30endif
31ifeq ($(AARCH32_SP),optee)
32add-lib-optee 		:= 	yes
33endif
34ifeq ($(SPMC_OPTEE),1)
35$(eval $(call add_define,SPMC_OPTEE))
36add-lib-optee 		:= 	yes
37endif
38
39ifeq ($(add-lib-optee),yes)
40BL2_SOURCES		+=	lib/optee/optee_utils.c
41endif
42
43ifeq ($(NEED_BL32),yes)
44$(eval $(call add_define,QEMU_LOAD_BL32))
45endif
46
47# Include GICv3 driver files
48include drivers/arm/gic/v3/gicv3.mk
49
50QEMU_GIC_SOURCES	:=	${GICV3_SOURCES}				\
51				plat/common/plat_gicv3.c
52
53BL31_SOURCES		+=	${PLAT_QEMU_PATH}/sbsa_gic.c 			\
54				${PLAT_QEMU_PATH}/sbsa_platform.c		\
55				${PLAT_QEMU_PATH}/sbsa_pm.c			\
56				${PLAT_QEMU_PATH}/sbsa_sip_svc.c		\
57				${PLAT_QEMU_PATH}/sbsa_topology.c
58
59BL31_SOURCES		+=	${FDT_WRAPPERS_SOURCES}
60
61ifeq (${SPM_MM},1)
62	BL31_SOURCES		+=	${PLAT_QEMU_COMMON_PATH}/qemu_spm.c
63endif
64
65ifeq (${SPD},spmd)
66BL31_SOURCES		+=	plat/common/plat_spmd_manifest.c	\
67				common/uuid.c				\
68				${LIBFDT_SRCS}
69endif
70
71
72# Add the build options to pack Trusted OS Extra1 and Trusted OS Extra2 images
73# in the FIP if the platform requires.
74ifneq ($(BL32_EXTRA1),)
75ifneq (${DECRYPTION_SUPPORT},none)
76$(eval $(call TOOL_ADD_IMG,bl32_extra1,--tos-fw-extra1,,$(ENCRYPT_BL32)))
77else
78$(eval $(call TOOL_ADD_IMG,bl32_extra1,--tos-fw-extra1))
79endif
80endif
81ifneq ($(BL32_EXTRA2),)
82ifneq (${DECRYPTION_SUPPORT},none)
83$(eval $(call TOOL_ADD_IMG,bl32_extra2,--tos-fw-extra2,,$(ENCRYPT_BL32)))
84else
85$(eval $(call TOOL_ADD_IMG,bl32_extra2,--tos-fw-extra2))
86endif
87endif
88
89ifneq ($(QEMU_TB_FW_CONFIG_DTS),)
90FDT_SOURCES		+=	${QEMU_TB_FW_CONFIG_DTS}
91QEMU_TB_FW_CONFIG	:=	${BUILD_PLAT}/fdts/$(notdir $(basename ${QEMU_TB_FW_CONFIG_DTS})).dtb
92# Add the TB_FW_CONFIG to FIP
93$(eval $(call TOOL_ADD_PAYLOAD,${QEMU_TB_FW_CONFIG},--tb-fw-config,${QEMU_TB_FW_CONFIG}))
94endif
95
96ifneq ($(QEMU_TOS_FW_CONFIG_DTS),)
97FDT_SOURCES		+=	${QEMU_TOS_FW_CONFIG_DTS}
98QEMU_TOS_FW_CONFIG	:=	${BUILD_PLAT}/fdts/$(notdir $(basename ${QEMU_TOS_FW_CONFIG_DTS})).dtb
99# Add the TOS_FW_CONFIG to FIP
100$(eval $(call TOOL_ADD_PAYLOAD,${QEMU_TOS_FW_CONFIG},--tos-fw-config,${QEMU_TOS_FW_CONFIG}))
101endif
102
103# Use known base for UEFI if not given from command line
104# By default BL33 is at FLASH1 base
105PRELOADED_BL33_BASE	?= 0x10000000
106
107# Qemu SBSA plafrom only support SEC_SRAM
108BL32_RAM_LOCATION_ID	= SEC_SRAM_ID
109$(eval $(call add_define,BL32_RAM_LOCATION_ID))
110
111# Don't have the Linux kernel as a BL33 image by default
112ARM_LINUX_KERNEL_AS_BL33	:=	0
113$(eval $(call assert_boolean,ARM_LINUX_KERNEL_AS_BL33))
114$(eval $(call add_define,ARM_LINUX_KERNEL_AS_BL33))
115
116ARM_PRELOADED_DTB_BASE := PLAT_QEMU_DRAM0_BASE
117$(eval $(call add_define,ARM_PRELOADED_DTB_BASE))
118