2 # (C) COPYRIGHT 2012,2014 ARM Limited. All rights reserved.
4 # This program is free software and is provided to you under the terms of the
5 # GNU General Public License version 2 as published by the Free Software
6 # Foundation, and any use by you of this program is subject to the terms
9 # A copy of the licence is included with the program, and can also be obtained
10 # from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
11 # Boston, MA 02110-1301, USA.
17 # Driver version string which is returned to userspace via an ioctl
18 MALI_RELEASE_NAME ?= "r5p0-06rel0"
20 # Paths required for build
22 KBASE_PLATFORM_PATH = $(KBASE_PATH)/platform_dummy
23 UMP_PATH = $(src)/../../../base
25 ifeq ($(CONFIG_MALI_ERROR_INJECTION),y)
26 MALI_ERROR_INJECT_ON = 1
29 # Set up defaults if not defined by build system
30 MALI_CUSTOMER_RELEASE ?= 1
32 MALI_KERNEL_TEST_API ?= 0
33 MALI_ERROR_INJECT_ON ?= 0
36 MALI_INSTRUMENTATION_LEVEL ?= 0
37 # This workaround is for what seems to be a compiler bug we observed in
38 # GCC 4.7 on AOSP 4.3. The bug caused an intermittent failure compiling
39 # the "_Pragma" syntax, where an error message is returned:
41 # "internal compiler error: unspellable token PRAGMA"
43 # This regression has thus far only been seen on the GCC 4.7 compiler bundled
44 # with AOSP 4.3.0. So this makefile, intended for in-tree kernel builds
45 # which are not known to be used with AOSP, is hardcoded to disable the
46 # workaround, i.e. set the define to 0.
47 MALI_GCC_WORKAROUND_MIDCOM_4598 ?= 0
49 # Set up our defines, which will be passed to gcc
51 -DMALI_CUSTOMER_RELEASE=$(MALI_CUSTOMER_RELEASE) \
52 -DMALI_KERNEL_TEST_API=$(MALI_KERNEL_TEST_API) \
53 -DMALI_UNIT_TEST=$(MALI_UNIT_TEST) \
54 -DMALI_ERROR_INJECT_ON=$(MALI_ERROR_INJECT_ON) \
55 -DMALI_MOCK_TEST=$(MALI_MOCK_TEST) \
56 -DMALI_COVERAGE=$(MALI_COVERAGE) \
57 -DMALI_INSTRUMENTATION_LEVEL=$(MALI_INSTRUMENTATION_LEVEL) \
58 -DMALI_RELEASE_NAME=\"$(MALI_RELEASE_NAME)\" \
59 -DMALI_GCC_WORKAROUND_MIDCOM_4598=$(MALI_GCC_WORKAROUND_MIDCOM_4598)
61 ifeq ($(KBUILD_EXTMOD),)
63 DEFINES +=-DMALI_KBASE_THIRDPARTY_PATH=../../$(src)/platform/$(CONFIG_MALI_PLATFORM_THIRDPARTY_NAME)
66 DEFINES +=-DMALI_KBASE_THIRDPARTY_PATH=$(src)/platform/$(CONFIG_MALI_PLATFORM_THIRDPARTY_NAME)
69 DEFINES += -I$(srctree)/drivers/staging/android
71 # Use our defines when compiling
72 ccflags-y += $(DEFINES) -I$(KBASE_PATH) -I$(KBASE_PLATFORM_PATH) -I$(UMP_PATH) -I$(srctree)/include/linux
73 subdir-ccflags-y += $(DEFINES) -I$(KBASE_PATH) -I$(KBASE_PLATFORM_PATH) -I$(OSK_PATH) -I$(UMP_PATH) -I$(srctree)/include/linux
77 mali_kbase_cache_policy.c \
81 mali_kbase_jd_debugfs.c \
83 mali_kbase_cpuprops.c \
84 mali_kbase_gpuprops.c \
86 mali_kbase_js_affinity.c \
87 mali_kbase_js_ctx_attr.c \
89 mali_kbase_context.c \
91 mali_kbase_pm_driver.c \
92 mali_kbase_pm_metrics.c \
94 mali_kbase_pm_ca_fixed.c \
95 mali_kbase_pm_always_on.c \
96 mali_kbase_pm_coarse_demand.c \
97 mali_kbase_pm_demand.c \
98 mali_kbase_pm_policy.c \
100 mali_kbase_security.c \
102 mali_kbase_softjobs.c \
103 mali_kbase_10969_workaround.c \
105 mali_kbase_utility.c \
107 mali_kbase_trace_timeline.c \
108 mali_kbase_gpu_memory_debugfs.c \
109 mali_kbase_mem_linux.c \
110 mali_kbase_core_linux.c \
112 mali_kbase_sync_user.c \
113 mali_kbase_replay.c \
114 mali_kbase_mem_profile_debugfs.c \
115 mali_kbase_mmu_hw_direct.c \
116 mali_kbase_disjoint_events.c \
117 mali_kbase_gator_api.c
119 ifeq ($(MALI_CUSTOMER_RELEASE),0)
121 mali_kbase_pm_ca_random.c \
122 mali_kbase_pm_demand_always_powered.c \
123 mali_kbase_pm_fast_start.c
126 # Job Scheduler Policy: Completely Fair Scheduler
127 SRC += mali_kbase_js_policy_cfs.c
129 ifeq ($(CONFIG_MACH_MANTA),y)
130 SRC += mali_kbase_mem_alloc_carveout.c
132 SRC += mali_kbase_mem_alloc.c
135 # ensure GPL version of malisw gets pulled in
136 ccflags-y += -I$(KBASE_PATH)
138 ifeq ($(CONFIG_MALI_NO_MALI),y)
140 SRC += mali_kbase_model_dummy.c
141 SRC += mali_kbase_model_linux.c
142 # HW error simulation
143 SRC += mali_kbase_model_error_generator.c
146 ifeq ($(MALI_MOCK_TEST),1)
148 SRC += tests/internal/src/mock/mali_kbase_pm_driver_mock.c
151 # in-tree/out-of-tree logic needs to be slightly different to determine if a file is present
152 ifeq ($(KBUILD_EXTMOD),)
154 MALI_METRICS_PATH = $(srctree)/drivers/gpu/arm/midgard
157 MALI_METRICS_PATH = $(KBUILD_EXTMOD)
160 # Use vsync metrics example using PL111 driver, if available
161 ifeq ($(wildcard $(MALI_METRICS_PATH)/mali_kbase_pm_metrics_linux.c),)
162 SRC += mali_kbase_pm_metrics_dummy.c
164 SRC += mali_kbase_pm_metrics_linux.c
167 ifeq ($(CONFIG_MALI_PLATFORM_FAKE),y)
168 SRC += mali_kbase_platform_fake.c
170 ifeq ($(CONFIG_MALI_PLATFORM_VEXPRESS),y)
171 SRC += platform/vexpress/mali_kbase_config_vexpress.c \
172 platform/vexpress/mali_kbase_cpu_vexpress.c
173 ccflags-y += -I$(src)/platform/vexpress
176 ifeq ($(CONFIG_MALI_PLATFORM_RTSM_VE),y)
177 SRC += platform/rtsm_ve/mali_kbase_config_vexpress.c
178 ccflags-y += -I$(src)/platform/rtsm_ve
181 ifeq ($(CONFIG_MALI_PLATFORM_JUNO),y)
182 SRC += platform/juno/mali_kbase_config_vexpress.c
183 ccflags-y += -I$(src)/platform/juno
186 ifeq ($(CONFIG_MALI_PLATFORM_JUNO_SOC),y)
187 SRC += platform/juno_soc/mali_kbase_config_juno_soc.c
188 ccflags-y += -I$(src)/platform/juno_soc
191 ifeq ($(CONFIG_MALI_PLATFORM_VEXPRESS_1XV7_A57),y)
192 SRC += platform/vexpress_1xv7_a57/mali_kbase_config_vexpress.c
193 ccflags-y += -I$(src)/platform/vexpress_1xv7_a57
196 ifeq ($(CONFIG_MALI_PLATFORM_VEXPRESS_VIRTEX7_40MHZ),y)
197 SRC += platform/vexpress_virtex7_40mhz/mali_kbase_config_vexpress.c \
198 platform/vexpress_virtex7_40mhz/mali_kbase_cpu_vexpress.c
199 ccflags-y += -I$(src)/platform/vexpress_virtex7_40mhz
202 ifeq ($(CONFIG_MALI_PLATFORM_VEXPRESS_6XVIRTEX7_10MHZ),y)
203 SRC += platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_vexpress.c \
204 platform/vexpress_6xvirtex7_10mhz/mali_kbase_cpu_vexpress.c
205 ccflags-y += -I$(src)/platform/vexpress_6xvirtex7_10mhz
208 ifeq ($(CONFIG_MALI_PLATFORM_GOLDFISH),y)
209 SRC += platform/goldfish/mali_kbase_config_goldfish.c
210 ccflags-y += -I$(src)/platform/goldfish
213 ifeq ($(CONFIG_MALI_PLATFORM_PBX),y)
214 SRC += platform/pbx/mali_kbase_config_pbx.c
215 ccflags-y += -I$(src)/platform/pbx
218 ifeq ($(CONFIG_MALI_PLATFORM_PANDA),y)
219 SRC += platform/panda/mali_kbase_config_panda.c
220 ccflags-y += -I$(src)/platform/panda
223 ifeq ($(CONFIG_MALI_PLATFORM_THIRDPARTY),y)
224 # remove begin and end quotes from the Kconfig string type
225 platform_name := $(shell echo $(CONFIG_MALI_PLATFORM_THIRDPARTY_NAME))
226 MALI_PLATFORM_THIRDPARTY_DIR := platform/$(platform_name)
227 ccflags-y += -I$(src)/$(MALI_PLATFORM_THIRDPARTY_DIR)
228 ifeq ($(CONFIG_MALI_MIDGARD),m)
229 include $(src)/platform/$(platform_name)/Kbuild
230 else ifeq ($(CONFIG_MALI_MIDGARD),y)
231 obj-$(CONFIG_MALI_MIDGARD) += platform/
234 endif # CONFIG_MALI_PLATFORM_FAKE=y
236 ifeq ($(CONFIG_MALI_PLATFORM_THIRDPARTY),y)
237 # remove begin and end quotes from the Kconfig string type
238 platform_name := $(shell echo $(CONFIG_MALI_PLATFORM_THIRDPARTY_NAME))
239 MALI_PLATFORM_THIRDPARTY_DIR := platform/$(platform_name)
240 ccflags-y += -I$(src)/$(MALI_PLATFORM_THIRDPARTY_DIR)
241 ifeq ($(CONFIG_MALI_MIDGARD),m)
242 include $(src)/platform/$(platform_name)/Kbuild
243 else ifeq ($(CONFIG_MALI_MIDGARD),y)
244 obj-$(CONFIG_MALI_MIDGARD) += platform/
248 # Tell the Linux build system from which .o file to create the kernel module
249 obj-$(CONFIG_MALI_MIDGARD) += mali_kbase.o
251 # Tell the Linux build system to enable building of our .c files
252 mali_kbase-y := $(SRC:.c=.o)
254 mali_kbase-$(CONFIG_MALI_DEVFREQ) += mali_kbase_devfreq.o
255 mali_kbase-$(CONFIG_MALI_POWER_ACTOR) += mali_kbase_power_actor.o
257 ifneq ($(wildcard $(src)/internal/Kbuild),)
258 ifeq ($(MALI_CUSTOMER_RELEASE),0)
259 include $(src)/internal/Kbuild
260 mali_kbase-y += $(INTERNAL:.c=.o)