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 ?= "r14p0-01rel0"
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 \
82 mali_kbase_jd_debugfs.c \
84 mali_kbase_gpuprops.c \
86 mali_kbase_js_ctx_attr.c \
88 mali_kbase_context.c \
92 mali_kbase_softjobs.c \
93 mali_kbase_10969_workaround.c \
95 mali_kbase_utility.c \
97 mali_kbase_trace_timeline.c \
98 mali_kbase_gpu_memory_debugfs.c \
99 mali_kbase_mem_linux.c \
100 mali_kbase_core_linux.c \
102 mali_kbase_sync_user.c \
103 mali_kbase_replay.c \
104 mali_kbase_mem_profile_debugfs.c \
105 mali_kbase_mmu_mode_lpae.c \
106 mali_kbase_mmu_mode_aarch64.c \
107 mali_kbase_disjoint_events.c \
108 mali_kbase_gator_api.c \
109 mali_kbase_debug_mem_view.c \
110 mali_kbase_debug_job_fault.c \
112 mali_kbase_mem_pool.c \
113 mali_kbase_mem_pool_debugfs.c \
114 mali_kbase_tlstream.c \
115 mali_kbase_strings.c \
116 mali_kbase_as_fault_debugfs.c \
117 mali_kbase_regs_history_debugfs.c
119 ifeq ($(MALI_UNIT_TEST),1)
120 SRC += mali_kbase_tlstream_test.c
123 ifeq ($(MALI_CUSTOMER_RELEASE),0)
124 SRC += mali_kbase_regs_dump_debugfs.c
128 # Job Scheduler Policy: Completely Fair Scheduler
129 SRC += mali_kbase_js_policy_cfs.c
131 ccflags-y += -I$(KBASE_PATH)
133 ifeq ($(CONFIG_MALI_PLATFORM_FAKE),y)
134 SRC += mali_kbase_platform_fake.c
136 ifeq ($(CONFIG_MALI_PLATFORM_VEXPRESS),y)
137 SRC += platform/vexpress/mali_kbase_config_vexpress.c \
138 platform/vexpress/mali_kbase_cpu_vexpress.c
139 ccflags-y += -I$(src)/platform/vexpress
142 ifeq ($(CONFIG_MALI_PLATFORM_RTSM_VE),y)
143 SRC += platform/rtsm_ve/mali_kbase_config_vexpress.c
144 ccflags-y += -I$(src)/platform/rtsm_ve
147 ifeq ($(CONFIG_MALI_PLATFORM_JUNO),y)
148 SRC += platform/juno/mali_kbase_config_vexpress.c
149 ccflags-y += -I$(src)/platform/juno
152 ifeq ($(CONFIG_MALI_PLATFORM_JUNO_SOC),y)
153 SRC += platform/juno_soc/mali_kbase_config_juno_soc.c
154 ccflags-y += -I$(src)/platform/juno_soc
157 ifeq ($(CONFIG_MALI_PLATFORM_VEXPRESS_1XV7_A57),y)
158 SRC += platform/vexpress_1xv7_a57/mali_kbase_config_vexpress.c
159 ccflags-y += -I$(src)/platform/vexpress_1xv7_a57
162 ifeq ($(CONFIG_MALI_PLATFORM_VEXPRESS_6XVIRTEX7_10MHZ),y)
163 SRC += platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_vexpress.c \
164 platform/vexpress_6xvirtex7_10mhz/mali_kbase_cpu_vexpress.c
165 ccflags-y += -I$(src)/platform/vexpress_6xvirtex7_10mhz
168 ifeq ($(CONFIG_MALI_PLATFORM_A7_KIPLING),y)
169 SRC += platform/a7_kipling/mali_kbase_config_a7_kipling.c \
170 platform/a7_kipling/mali_kbase_cpu_a7_kipling.c
171 ccflags-y += -I$(src)/platform/a7_kipling
174 ifeq ($(CONFIG_MALI_PLATFORM_THIRDPARTY),y)
175 # remove begin and end quotes from the Kconfig string type
176 platform_name := $(shell echo $(CONFIG_MALI_PLATFORM_THIRDPARTY_NAME))
177 MALI_PLATFORM_THIRDPARTY_DIR := platform/$(platform_name)
178 ccflags-y += -I$(src)/$(MALI_PLATFORM_THIRDPARTY_DIR)
179 ifeq ($(CONFIG_MALI_MIDGARD),m)
180 include $(src)/platform/$(platform_name)/Kbuild
181 else ifeq ($(CONFIG_MALI_MIDGARD),y)
182 obj-$(CONFIG_MALI_MIDGARD) += platform/
185 endif # CONFIG_MALI_PLATFORM_FAKE=y
187 ifeq ($(CONFIG_MALI_PLATFORM_THIRDPARTY),y)
188 # remove begin and end quotes from the Kconfig string type
189 platform_name := $(shell echo $(CONFIG_MALI_PLATFORM_THIRDPARTY_NAME))
190 MALI_PLATFORM_THIRDPARTY_DIR := platform/$(platform_name)
191 ccflags-y += -I$(src)/$(MALI_PLATFORM_THIRDPARTY_DIR)
192 ifeq ($(CONFIG_MALI_MIDGARD),m)
193 include $(src)/platform/$(platform_name)/Kbuild
194 else ifeq ($(CONFIG_MALI_MIDGARD),y)
195 obj-$(CONFIG_MALI_MIDGARD) += platform/
199 # Tell the Linux build system from which .o file to create the kernel module
200 obj-$(CONFIG_MALI_MIDGARD) += mali_kbase.o
202 # Tell the Linux build system to enable building of our .c files
203 mali_kbase-y := $(SRC:.c=.o)
205 mali_kbase-$(CONFIG_MALI_DMA_FENCE) += mali_kbase_dma_fence.o
207 MALI_BACKEND_PATH ?= backend
208 CONFIG_MALI_BACKEND ?= gpu
209 CONFIG_MALI_BACKEND_REAL ?= $(CONFIG_MALI_BACKEND)
211 ifeq ($(MALI_MOCK_TEST),1)
212 ifeq ($(CONFIG_MALI_BACKEND_REAL),gpu)
214 mali_kbase-y += tests/internal/src/mock/mali_kbase_pm_driver_mock.o
218 include $(src)/$(MALI_BACKEND_PATH)/$(CONFIG_MALI_BACKEND_REAL)/Kbuild
219 mali_kbase-y += $(BACKEND:.c=.o)
221 ccflags-y += -I$(src)/$(MALI_BACKEND_PATH)/$(CONFIG_MALI_BACKEND_REAL)
222 subdir-ccflags-y += -I$(src)/$(MALI_BACKEND_PATH)/$(CONFIG_MALI_BACKEND_REAL)
224 # Default to devicetree platform if neither a fake platform or a thirdparty
225 # platform is configured.
226 ifeq ($(CONFIG_MALI_PLATFORM_THIRDPARTY)$(CONFIG_MALI_PLATFORM_FAKE),)
227 CONFIG_MALI_PLATFORM_DEVICETREE := y
230 mali_kbase-$(CONFIG_MALI_PLATFORM_DEVICETREE) += \
231 platform/devicetree/mali_kbase_runtime_pm.o \
232 platform/devicetree/mali_kbase_config_devicetree.o
233 ccflags-$(CONFIG_MALI_PLATFORM_DEVICETREE) += -I$(src)/platform/devicetree