aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/arm/midgard/Kbuild
blob: 6bc3d9091751d76419f65e2264ee4a2243a014c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
#
# (C) COPYRIGHT 2012,2014 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
# Foundation, and any use by you of this program is subject to the terms
# of such GNU licence.
#
# A copy of the licence is included with the program, and can also be obtained
# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA  02110-1301, USA.
#
#



# Driver version string which is returned to userspace via an ioctl
MALI_RELEASE_NAME ?= "r5p0-06rel0"

# Paths required for build
KBASE_PATH = $(src)
KBASE_PLATFORM_PATH = $(KBASE_PATH)/platform_dummy
UMP_PATH = $(src)/../../../base

ifeq ($(CONFIG_MALI_ERROR_INJECTION),y)
MALI_ERROR_INJECT_ON = 1
endif

# Set up defaults if not defined by build system
MALI_CUSTOMER_RELEASE ?= 1
MALI_UNIT_TEST ?= 0
MALI_KERNEL_TEST_API ?= 0
MALI_ERROR_INJECT_ON ?= 0
MALI_MOCK_TEST ?= 0
MALI_COVERAGE ?= 0
MALI_INSTRUMENTATION_LEVEL ?= 0
# This workaround is for what seems to be a compiler bug we observed in
# GCC 4.7 on AOSP 4.3.  The bug caused an intermittent failure compiling
# the "_Pragma" syntax, where an error message is returned:
#
# "internal compiler error: unspellable token PRAGMA"
#
# This regression has thus far only been seen on the GCC 4.7 compiler bundled
# with AOSP 4.3.0.  So this makefile, intended for in-tree kernel builds
# which are not known to be used with AOSP, is hardcoded to disable the
# workaround, i.e. set the define to 0.
MALI_GCC_WORKAROUND_MIDCOM_4598 ?= 0

# Set up our defines, which will be passed to gcc
DEFINES = \
	-DMALI_CUSTOMER_RELEASE=$(MALI_CUSTOMER_RELEASE) \
	-DMALI_KERNEL_TEST_API=$(MALI_KERNEL_TEST_API) \
	-DMALI_UNIT_TEST=$(MALI_UNIT_TEST) \
	-DMALI_ERROR_INJECT_ON=$(MALI_ERROR_INJECT_ON) \
	-DMALI_MOCK_TEST=$(MALI_MOCK_TEST) \
	-DMALI_COVERAGE=$(MALI_COVERAGE) \
	-DMALI_INSTRUMENTATION_LEVEL=$(MALI_INSTRUMENTATION_LEVEL) \
	-DMALI_RELEASE_NAME=\"$(MALI_RELEASE_NAME)\" \
	-DMALI_GCC_WORKAROUND_MIDCOM_4598=$(MALI_GCC_WORKAROUND_MIDCOM_4598)

ifeq ($(KBUILD_EXTMOD),)
# in-tree
DEFINES +=-DMALI_KBASE_THIRDPARTY_PATH=../../$(src)/platform/$(CONFIG_MALI_PLATFORM_THIRDPARTY_NAME)
else
# out-of-tree
DEFINES +=-DMALI_KBASE_THIRDPARTY_PATH=$(src)/platform/$(CONFIG_MALI_PLATFORM_THIRDPARTY_NAME)
endif

DEFINES += -I$(srctree)/drivers/staging/android

# Use our defines when compiling
ccflags-y += $(DEFINES) -I$(KBASE_PATH)   -I$(KBASE_PLATFORM_PATH) -I$(UMP_PATH) -I$(srctree)/include/linux
subdir-ccflags-y += $(DEFINES) -I$(KBASE_PATH)   -I$(KBASE_PLATFORM_PATH) -I$(OSK_PATH) -I$(UMP_PATH) -I$(srctree)/include/linux

SRC := \
	mali_kbase_device.c \
	mali_kbase_cache_policy.c \
	mali_kbase_mem.c \
	mali_kbase_mmu.c \
	mali_kbase_jd.c \
	mali_kbase_jd_debugfs.c \
	mali_kbase_jm.c \
	mali_kbase_cpuprops.c \
	mali_kbase_gpuprops.c \
	mali_kbase_js.c \
	mali_kbase_js_affinity.c \
	mali_kbase_js_ctx_attr.c \
	mali_kbase_event.c \
	mali_kbase_context.c \
	mali_kbase_pm.c \
	mali_kbase_pm_driver.c \
	mali_kbase_pm_metrics.c \
	mali_kbase_pm_ca.c \
	mali_kbase_pm_ca_fixed.c \
	mali_kbase_pm_always_on.c \
	mali_kbase_pm_coarse_demand.c \
	mali_kbase_pm_demand.c \
	mali_kbase_pm_policy.c \
	mali_kbase_config.c \
	mali_kbase_security.c \
	mali_kbase_instr.c \
	mali_kbase_softjobs.c \
	mali_kbase_10969_workaround.c \
	mali_kbase_hw.c \
	mali_kbase_utility.c \
	mali_kbase_debug.c \
	mali_kbase_trace_timeline.c \
	mali_kbase_gpu_memory_debugfs.c \
	mali_kbase_mem_linux.c \
	mali_kbase_core_linux.c \
	mali_kbase_sync.c \
	mali_kbase_sync_user.c \
	mali_kbase_replay.c \
	mali_kbase_mem_profile_debugfs.c \
	mali_kbase_mmu_hw_direct.c \
	mali_kbase_disjoint_events.c \
	mali_kbase_gator_api.c

ifeq ($(MALI_CUSTOMER_RELEASE),0)
SRC += \
	mali_kbase_pm_ca_random.c \
	mali_kbase_pm_demand_always_powered.c \
	mali_kbase_pm_fast_start.c
endif

# Job Scheduler Policy: Completely Fair Scheduler
SRC += mali_kbase_js_policy_cfs.c

ifeq ($(CONFIG_MACH_MANTA),y)
	SRC += mali_kbase_mem_alloc_carveout.c
else
	SRC += mali_kbase_mem_alloc.c
endif

# ensure GPL version of malisw gets pulled in
ccflags-y += -I$(KBASE_PATH)

ifeq ($(CONFIG_MALI_NO_MALI),y)
	# Dummy model
	SRC += mali_kbase_model_dummy.c
	SRC += mali_kbase_model_linux.c
	# HW error simulation
	SRC += mali_kbase_model_error_generator.c
endif

ifeq ($(MALI_MOCK_TEST),1)
	# Test functionality
	SRC += tests/internal/src/mock/mali_kbase_pm_driver_mock.c
endif

# in-tree/out-of-tree logic needs to be slightly different to determine if a file is present
ifeq ($(KBUILD_EXTMOD),)
# in-tree
MALI_METRICS_PATH = $(srctree)/drivers/gpu/arm/midgard
else
# out-of-tree
MALI_METRICS_PATH = $(KBUILD_EXTMOD)
endif

# Use vsync metrics example using PL111 driver, if available
ifeq ($(wildcard $(MALI_METRICS_PATH)/mali_kbase_pm_metrics_linux.c),)
	SRC += mali_kbase_pm_metrics_dummy.c
else
	SRC += mali_kbase_pm_metrics_linux.c
endif

ifeq ($(CONFIG_MALI_PLATFORM_FAKE),y)
	SRC += mali_kbase_platform_fake.c

	ifeq ($(CONFIG_MALI_PLATFORM_VEXPRESS),y)
		SRC += platform/vexpress/mali_kbase_config_vexpress.c \
		platform/vexpress/mali_kbase_cpu_vexpress.c
		ccflags-y += -I$(src)/platform/vexpress
	endif

	ifeq ($(CONFIG_MALI_PLATFORM_RTSM_VE),y)
		SRC += platform/rtsm_ve/mali_kbase_config_vexpress.c
		ccflags-y += -I$(src)/platform/rtsm_ve
	endif

	ifeq ($(CONFIG_MALI_PLATFORM_JUNO),y)
		SRC += platform/juno/mali_kbase_config_vexpress.c
		ccflags-y += -I$(src)/platform/juno
	endif

	ifeq ($(CONFIG_MALI_PLATFORM_JUNO_SOC),y)
		SRC += platform/juno_soc/mali_kbase_config_juno_soc.c
		ccflags-y += -I$(src)/platform/juno_soc
	endif

	ifeq ($(CONFIG_MALI_PLATFORM_VEXPRESS_1XV7_A57),y)
		SRC += platform/vexpress_1xv7_a57/mali_kbase_config_vexpress.c
		ccflags-y += -I$(src)/platform/vexpress_1xv7_a57
	endif

	ifeq ($(CONFIG_MALI_PLATFORM_VEXPRESS_VIRTEX7_40MHZ),y)
		SRC += platform/vexpress_virtex7_40mhz/mali_kbase_config_vexpress.c \
		platform/vexpress_virtex7_40mhz/mali_kbase_cpu_vexpress.c
		ccflags-y += -I$(src)/platform/vexpress_virtex7_40mhz
	endif

	ifeq ($(CONFIG_MALI_PLATFORM_VEXPRESS_6XVIRTEX7_10MHZ),y)
		SRC += platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_vexpress.c \
		platform/vexpress_6xvirtex7_10mhz/mali_kbase_cpu_vexpress.c
		ccflags-y += -I$(src)/platform/vexpress_6xvirtex7_10mhz
	endif

	ifeq ($(CONFIG_MALI_PLATFORM_GOLDFISH),y)
		SRC += platform/goldfish/mali_kbase_config_goldfish.c
		ccflags-y += -I$(src)/platform/goldfish
	endif

	ifeq ($(CONFIG_MALI_PLATFORM_PBX),y)
		SRC += platform/pbx/mali_kbase_config_pbx.c
		ccflags-y += -I$(src)/platform/pbx
	endif

	ifeq ($(CONFIG_MALI_PLATFORM_PANDA),y)
		SRC += platform/panda/mali_kbase_config_panda.c
		ccflags-y += -I$(src)/platform/panda
	endif

	ifeq ($(CONFIG_MALI_PLATFORM_THIRDPARTY),y)
	# remove begin and end quotes from the Kconfig string type
	platform_name := $(shell echo $(CONFIG_MALI_PLATFORM_THIRDPARTY_NAME))
	MALI_PLATFORM_THIRDPARTY_DIR := platform/$(platform_name)
	ccflags-y += -I$(src)/$(MALI_PLATFORM_THIRDPARTY_DIR)
	ifeq ($(CONFIG_MALI_MIDGARD),m)
	include  $(src)/platform/$(platform_name)/Kbuild
	else ifeq ($(CONFIG_MALI_MIDGARD),y)
	obj-$(CONFIG_MALI_MIDGARD) += platform/
	endif
	endif
endif # CONFIG_MALI_PLATFORM_FAKE=y

ifeq ($(CONFIG_MALI_PLATFORM_THIRDPARTY),y)
# remove begin and end quotes from the Kconfig string type
platform_name := $(shell echo $(CONFIG_MALI_PLATFORM_THIRDPARTY_NAME))
MALI_PLATFORM_THIRDPARTY_DIR := platform/$(platform_name)
ccflags-y += -I$(src)/$(MALI_PLATFORM_THIRDPARTY_DIR)
ifeq ($(CONFIG_MALI_MIDGARD),m)
include  $(src)/platform/$(platform_name)/Kbuild
else ifeq ($(CONFIG_MALI_MIDGARD),y)
obj-$(CONFIG_MALI_MIDGARD) += platform/
endif
endif

# Tell the Linux build system from which .o file to create the kernel module
obj-$(CONFIG_MALI_MIDGARD) += mali_kbase.o

# Tell the Linux build system to enable building of our .c files
mali_kbase-y := $(SRC:.c=.o)

mali_kbase-$(CONFIG_MALI_DEVFREQ) += mali_kbase_devfreq.o

ifneq ($(wildcard $(src)/internal/Kbuild),)
ifeq ($(MALI_CUSTOMER_RELEASE),0)
include  $(src)/internal/Kbuild
mali_kbase-y += $(INTERNAL:.c=.o)
endif
endif