e2abc54b4a513cca94e0c5df5bf89a8a2215f680
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / rogue / build / linux / config / core.mk
1 ########################################################################### ###
2 #@File
3 #@Title         Root build configuration.
4 #@Copyright     Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 #@License       Dual MIT/GPLv2
6
7 # The contents of this file are subject to the MIT license as set out below.
8
9 # Permission is hereby granted, free of charge, to any person obtaining a copy
10 # of this software and associated documentation files (the "Software"), to deal
11 # in the Software without restriction, including without limitation the rights
12 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 # copies of the Software, and to permit persons to whom the Software is
14 # furnished to do so, subject to the following conditions:
15
16 # The above copyright notice and this permission notice shall be included in
17 # all copies or substantial portions of the Software.
18
19 # Alternatively, the contents of this file may be used under the terms of
20 # the GNU General Public License Version 2 ("GPL") in which case the provisions
21 # of GPL are applicable instead of those above.
22
23 # If you wish to allow use of your version of this file only under the terms of
24 # GPL, and not to allow others to use your version of this file under the terms
25 # of the MIT license, indicate your decision by deleting the provisions above
26 # and replace them with the notice and other provisions required by GPL as set
27 # out in the file called "GPL-COPYING" included in this distribution. If you do
28 # not delete the provisions above, a recipient may use your version of this file
29 # under the terms of either the MIT license or GPL.
30
31 # This License is also included in this distribution in the file called
32 # "MIT-COPYING".
33
34 # EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
35 # PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
36 # BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
37 # PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
38 # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
39 # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
40 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41 ### ###########################################################################
42
43 # Configuration wrapper for new build system. This file deals with
44 # configuration of the build. Add to this file anything that deals
45 # with switching driver options on/off and altering the defines or
46 # objects the build uses.
47 #
48 # At the end of this file is an exhaustive list of all variables
49 # that are passed between the platform/config stage and the generic
50 # build. PLEASE refrain from adding more variables than necessary
51 # to this stage -- almost all options can go through config.h.
52 #
53
54 # Sanity check: Make sure preconfig has been included
55 ifeq ($(TOP),)
56 $(error TOP not defined: Was preconfig.mk included in root makefile?)
57 endif
58
59 ################################# MACROS ####################################
60
61 ALL_TUNABLE_OPTIONS :=
62
63 # This records the config option's help text and default value. Note that
64 # the help text can't contain a literal comma. Use $(comma) instead.
65 define RegisterOptionHelp
66 ALL_TUNABLE_OPTIONS += $(1)
67 ifeq ($(INTERNAL_DESCRIPTION_FOR_$(1)),)
68 INTERNAL_DESCRIPTION_FOR_$(1) := $(3)
69 endif
70 INTERNAL_CONFIG_DEFAULT_FOR_$(1) := $(2)
71 $(if $(4),\
72         $(error Too many arguments in config option '$(1)' (stray comma in help text?)))
73 endef
74
75 # Write out a kernel GNU make option.
76 #
77 define KernelConfigMake
78 $$(shell echo "override $(1) := $(2)" >>$(CONFIG_KERNEL_MK).new)
79 $(if $(filter config,$(D)),$(info KernelConfigMake $(1) := $(2)         # $(if $($(1)),$(origin $(1)),default)))
80 endef
81
82 # Write out a GNU make option for both user & kernel
83 #
84 define BothConfigMake
85 $$(eval $$(call KernelConfigMake,$(1),$(2)))
86 $$(eval $$(call UserConfigMake,$(1),$(2)))
87 endef
88
89 # Conditionally write out a kernel GNU make option
90 #
91 define _TunableKernelConfigMake
92 ifneq ($$($(1)),)
93 ifneq ($$($(1)),0)
94 $$(eval $$(call KernelConfigMake,$(1),$$($(1))))
95 endif
96 else
97 ifneq ($(2),)
98 $$(eval $$(call KernelConfigMake,$(1),$(2)))
99 endif
100 endif
101 endef
102
103 define TunableKernelConfigMake
104 $$(eval $$(call _TunableKernelConfigMake,$(1),$(2)))
105 $(call RegisterOptionHelp,$(1),$(2),$(3),$(4))
106 endef
107
108 # Conditionally write out a GNU make option for both user & kernel
109 #
110 define TunableBothConfigMake
111 $$(eval $$(call _TunableKernelConfigMake,$(1),$(2)))
112 $$(eval $$(call _TunableUserConfigMake,$(1),$(2)))
113 $(call RegisterOptionHelp,$(1),$(2),$(3),$(4))
114 endef
115
116 # Write out a kernel-only option
117 #
118 define KernelConfigC
119 $$(shell echo "#define $(1) $(2)" >>$(CONFIG_KERNEL_H).new)
120 $(if $(filter config,$(D)),$(info KernelConfigC    #define $(1) $(2)    /* $(if $($(1)),$(origin $(1)),default) */),)
121 endef
122
123 # Write out an option for both user & kernel
124 #
125 define BothConfigC
126 $$(eval $$(call KernelConfigC,$(1),$(2)))
127 $$(eval $$(call UserConfigC,$(1),$(2)))
128 endef
129
130 # Conditionally write out a kernel-only option
131 #
132 define _TunableKernelConfigC
133 ifneq ($$($(1)),)
134 ifneq ($$($(1)),0)
135 ifeq ($$($(1)),1)
136 $$(eval $$(call KernelConfigC,$(1),))
137 else
138 $$(eval $$(call KernelConfigC,$(1),$$($(1))))
139 endif
140 endif
141 else
142 ifneq ($(2),)
143 ifeq ($(2),1)
144 $$(eval $$(call KernelConfigC,$(1),))
145 else
146 $$(eval $$(call KernelConfigC,$(1),$(2)))
147 endif
148 endif
149 endif
150 endef
151
152 define TunableKernelConfigC
153 $$(eval $$(call _TunableKernelConfigC,$(1),$(2)))
154 ALL_TUNABLE_OPTIONS += $(1)
155 ifeq ($(INTERNAL_DESCRIPTION_FOR_$(1)),)
156 INTERNAL_DESCRIPTION_FOR_$(1) := $(3)
157 endif
158 INTERNAL_CONFIG_DEFAULT_FOR_$(1) := $(2)
159 endef
160
161 # Conditionally write out an option for both user & kernel
162 #
163 define TunableBothConfigC
164 $$(eval $$(call _TunableKernelConfigC,$(1),$(2)))
165 $$(eval $$(call _TunableUserConfigC,$(1),$(2)))
166 $(call RegisterOptionHelp,$(1),$(2),$(3),$(4))
167 endef
168
169 # Use this to mark config options which have to exist, but aren't
170 # user-tunable. Warn if an attempt is made to change it.
171 #
172 define NonTunableOption
173 $(if $(filter command line environment,$(origin $(1))),\
174         $(error Changing '$(1)' is not supported))
175 endef
176
177 ############################### END MACROS ##################################
178
179 # Check we have a new enough version of GNU make.
180 #
181 need := 3.81
182 ifeq ($(filter $(need),$(firstword $(sort $(MAKE_VERSION) $(need)))),)
183 $(error A version of GNU make >= $(need) is required - this is version $(MAKE_VERSION))
184 endif
185
186 # Decide whether we need a BVNC
187 ifneq ($(COMPILER_BVNC_LIST),)
188  DONT_NEED_RGX_BVNC := 1
189 endif
190
191 include ../defs.mk
192
193 # Infer PVR_BUILD_DIR from the directory configuration is launched from.
194 # Check anyway that such a directory exists.
195 #
196 PVR_BUILD_DIR := $(notdir $(abspath .))
197 $(call directory-must-exist,$(TOP)/build/linux/$(PVR_BUILD_DIR))
198
199 # Output directory for configuration, object code,
200 # final programs/libraries, and install/rc scripts.
201 #
202 BUILD        ?= release
203 ifneq ($(filter $(WINDOW_SYSTEM),xorg wayland nullws nulldrmws ews_drm nulladfws ews_adf),)
204 OUT          ?= $(TOP)/binary_$(PVR_BUILD_DIR)_$(WINDOW_SYSTEM)_$(BUILD)
205 else
206 OUT          ?= $(TOP)/binary_$(PVR_BUILD_DIR)_$(BUILD)
207 endif
208 override OUT := $(if $(filter /%,$(OUT)),$(OUT),$(TOP)/$(OUT))
209
210 CONFIG_MK                       := $(OUT)/config.mk
211 CONFIG_H                        := $(OUT)/config.h
212 CONFIG_KERNEL_MK        := $(OUT)/config_kernel.mk
213 CONFIG_KERNEL_H         := $(OUT)/config_kernel.h
214
215 # Convert commas to spaces in $(D). This is so you can say "make
216 # D=config-changes,freeze-config" and have $(filter config-changes,$(D))
217 # still work.
218 override D := $(subst $(comma),$(space),$(D))
219
220 # Create the OUT directory 
221 #
222 $(shell mkdir -p $(OUT))
223
224 # Some targets don't need information about any modules. If we only specify
225 # these targets on the make command line, set INTERNAL_CLOBBER_ONLY to
226 # indicate that toplevel.mk shouldn't read any makefiles
227 CLOBBER_ONLY_TARGETS := clean clobber help install
228 INTERNAL_CLOBBER_ONLY :=
229 ifneq ($(strip $(MAKECMDGOALS)),)
230 INTERNAL_CLOBBER_ONLY := \
231 $(if \
232  $(strip $(foreach _cmdgoal,$(MAKECMDGOALS),\
233           $(if $(filter $(_cmdgoal),$(CLOBBER_ONLY_TARGETS)),,x))),,true)
234 endif
235
236 # For a clobber-only build, we shouldn't regenerate any config files
237 ifneq ($(INTERNAL_CLOBBER_ONLY),true)
238
239 -include ../config/user-defs.mk
240
241 #
242 # Core handling 
243
244
245 # delete any previous intermediary files
246 $(shell \
247         for file in $(CONFIG_KERNEL_H).new $(CONFIG_KERNEL_MK).new ; do \
248                 rm -f $$file; \
249         done)
250
251 ifeq ($(DONT_NEED_RGX_BVNC),)
252  # Extract the BNC config name
253  RGX_BNC_SPLIT := $(subst .,$(space) ,$(RGX_BVNC))
254  RGX_BNC := $(word 1,$(RGX_BNC_SPLIT)).V.$(word 3,$(RGX_BNC_SPLIT)).$(word 4,$(RGX_BNC_SPLIT))
255  
256  # Check BVNC core version
257  ALL_KM_BVNCS := \
258   $(patsubst rgxcore_km_%.h,%,\
259         $(notdir $(shell ls $(TOP)/hwdefs/km/cores/rgxcore_km_*.h)))
260  ifeq ($(filter $(RGX_BVNC),$(ALL_KM_BVNCS)),)
261  $(error Error: Invalid Kernel core RGX_BVNC=$(RGX_BVNC). \
262         Valid Kernel core BVNCs: $(subst $(space),$(comma)$(space),$(ALL_KM_BVNCS)))
263  endif
264  
265  # Check if BVNC core file exist
266  RGX_BVNC_CORE_KM := $(TOP)/hwdefs/km/cores/rgxcore_km_$(RGX_BVNC).h
267  RGX_BVNC_CORE_KM_HEADER := \"cores/rgxcore_km_$(RGX_BVNC).h\" 
268  # "rgxcore_km_$(RGX_BVNC).h"
269  ifeq ($(wildcard $(RGX_BVNC_CORE_KM)),)
270  $(error The file $(RGX_BVNC_CORE_KM) does not exist. \
271         Valid BVNCs: $(ALL_KM_BVNCS))
272  endif
273  
274  # Check BNC config version
275  ALL_KM_BNCS := \
276   $(patsubst rgxconfig_km_%.h,%,\
277         $(notdir $(shell ls $(TOP)/hwdefs/km/configs/rgxconfig_km_*.h)))
278  ifeq ($(filter $(RGX_BNC),$(ALL_KM_BNCS)),)
279  $(error Error: Invalid Kernel config RGX_BNC=$(RGX_BNC). \
280         Valid Kernel config BNCs: $(subst $(space),$(comma)$(space),$(ALL_KM_BNCS)))
281  endif
282  
283  # Check if BNC config file exist
284  RGX_BNC_CONFIG_KM := $(TOP)/hwdefs/km/configs/rgxconfig_km_$(RGX_BNC).h
285  RGX_BNC_CONFIG_KM_HEADER := \"configs/rgxconfig_km_$(RGX_BNC).h\" 
286  #"rgxcore_km_$(RGX_BNC).h"
287  ifeq ($(wildcard $(RGX_BNC_CONFIG_KM)),)
288  $(error The file $(RGX_BNC_CONFIG_KM) does not exist. \
289         Valid BNCs: $(ALL_KM_BNCS))
290  endif
291 endif
292
293 # Enforced dependencies. Move this to an include.
294 #
295 SUPPORT_LINUX_USING_WORKQUEUES ?= 1
296 ifeq ($(SUPPORT_LINUX_USING_WORKQUEUES),1)
297 override PVR_LINUX_USING_WORKQUEUES := 1
298 override PVR_LINUX_MISR_USING_PRIVATE_WORKQUEUE := 1
299 override PVR_LINUX_TIMERS_USING_WORKQUEUES := 1
300 else ifeq ($(SUPPORT_LINUX_USING_SHARED_WORKQUEUES),1)
301 override PVR_LINUX_USING_WORKQUEUES := 1
302 override PVR_LINUX_MISR_USING_WORKQUEUE := 1
303 override PVR_LINUX_TIMERS_USING_SHARED_WORKQUEUE := 1
304 endif
305
306 ifeq ($(NO_HARDWARE),1)
307 override SYS_USING_INTERRUPTS := 0
308 endif
309
310 # Rather than requiring the user to have to define two variables (one quoted,
311 # one not), make PVRSRV_MODNAME a non-tunable and give it an overridable
312 # default here.
313 #
314 PVRSRV_MODNAME ?= pvrsrvkm
315
316 MAX_POOL_PAGES ?= 10240
317
318 # Normally builds don't touch these, but we use them to influence the
319 # components list. Make sure these are defined early enough to make this
320 # possible.
321 #
322 ifeq ($(SUPPORT_DRM),1)
323 SUPPORT_DISPLAY_CLASS := 0
324 else
325 ifeq ($(SUPPORT_ADF),1)
326 SUPPORT_DISPLAY_CLASS := 0
327 else
328 ifeq ($(SUPPORT_DC),1)
329 SUPPORT_DISPLAY_CLASS ?= 1
330 else
331 endif
332 endif
333 endif
334
335 ifeq ($(DONT_NEED_RGX_BVNC),)
336 # we can only do this stuff if we have a BVNC
337
338  SUPPORT_RAY_TRACING := \
339   $(shell grep -qw RGX_FEATURE_RAY_TRACING $(RGX_BNC_CONFIG_KM) && echo 1)
340
341  SUPPORT_DMA :=\
342   $(shell grep -qw RGX_FEATURE_META_DMA_CHANNEL_COUNT $(RGX_BNC_CONFIG_KM) && echo 1)
343 endif
344
345 # Default place for shared libraries
346 SHLIB_DESTDIR ?= /usr/lib
347
348 # Build's selected list of components.
349 # - components.mk is a per-build file that specifies the components that are
350 #   to be built
351 -include components.mk
352
353 # Set up the host and target compiler.
354 include ../config/compiler.mk
355
356 # PDUMP needs extra components
357 #
358 ifeq ($(PDUMP),1)
359 ifneq ($(COMPONENTS),)
360 COMPONENTS += pdump
361 endif
362 ifeq ($(SUPPORT_DRM),1)
363 EXTRA_PVRSRVKM_COMPONENTS += dbgdrv
364 else
365 KERNEL_COMPONENTS += dbgdrv
366 endif
367 endif
368
369 # HWPerf KM Interface example
370 #
371 ifeq ($(SUPPORT_KERNEL_HWPERF_TEST),1)
372 KERNEL_COMPONENTS += rgxhwpdrv
373 endif
374
375 # PVRGDB needs extra components
376 #
377 ifeq ($(PVRGDB),1)
378 ifneq ($(COMPONENTS),)
379 COMPONENTS += pvrdebugger pvrgdb pvrdebugipc
380 endif
381 override SUPPORT_EXPORTING_MEMORY_CONTEXT := 1
382 endif
383
384 $(if $(filter config,$(D)),$(info Build configuration:))
385
386 ################################# CONFIG ####################################
387
388 ifneq ($(SUPPORT_NEUTRINO_PLATFORM), 1)
389
390 # If KERNELDIR is set, write it out to the config.mk, with
391 # KERNEL_COMPONENTS and KERNEL_ID
392 #
393 ifneq ($(strip $(KERNELDIR)),)
394 PVRSRV_MODULE_BASEDIR ?= /lib/modules/$(KERNEL_ID)/extra/
395 $(eval $(call BothConfigMake,KERNELDIR,$(KERNELDIR)))
396 $(eval $(call BothConfigMake,KERNEL_ID,$(KERNEL_ID)))
397 $(eval $(call KernelConfigMake,KERNEL_COMPONENTS,$(KERNEL_COMPONENTS)))
398 $(eval $(call TunableKernelConfigMake,EXTRA_PVRSRVKM_COMPONENTS,,\
399 List of components that should be built in to pvrsrvkm.ko$(comma) rather than_\
400 forming separate kernel modules._\
401 ))
402
403 # If KERNEL_CROSS_COMPILE is set to "undef", this is magically
404 # equivalent to being unset. If it is unset, we use CROSS_COMPILE
405 # (which might also be unset). If it is set, use it directly.
406 ifneq ($(KERNEL_CROSS_COMPILE),undef)
407 KERNEL_CROSS_COMPILE ?= $(CROSS_COMPILE)
408 $(eval $(call TunableBothConfigMake,KERNEL_CROSS_COMPILE,))
409 endif
410
411 # Check the KERNELDIR has a kernel built and also check that it is
412 # not 64-bit, which we do not support.
413 KERNEL_AUTOCONF := \
414  $(strip $(wildcard $(KERNELDIR)/include/linux/autoconf.h) \
415          $(wildcard $(KERNELDIR)/include/generated/autoconf.h))
416 ifeq ($(KERNEL_AUTOCONF),)
417 $(warning autoconf.h not found in $$(KERNELDIR)/include/linux \
418 or $$(KERNELDIR)/include/generated. Check your $$(KERNELDIR) variable \
419 and kernel configuration.)
420 endif
421 else
422 $(if $(KERNEL_COMPONENTS),$(warning KERNELDIR is not set. Kernel components cannot be built))
423 endif
424
425 endif # !Neutrino
426
427 # Normally this is off for Linux, and only used by Android, but if customers
428 # are testing their display engines using NULLADFWS, they need to enable it
429 # for dmabuf support under Linux. The sync header is needed by adf_pdp.
430 #
431 SUPPORT_ION ?= 0
432 ifneq ($(SUPPORT_ION),0)
433 # Support kernels built out-of-tree with O=/other/path
434 # In those cases, KERNELDIR will be O, not the source tree.
435 ifneq ($(wildcard $(KERNELDIR)/source),)
436 KSRCDIR := $(KERNELDIR)/source
437 else
438 KSRCDIR := $(KERNELDIR)
439 endif
440 ifneq ($(wildcard $(KSRCDIR)/drivers/staging/android/ion/ion.h),)
441 # The kernel has a more recent version of ion, located in drivers/staging.
442 # Change the default header paths and the behaviour wrt sg_dma_len.
443 PVR_ANDROID_ION_HEADER := \"../drivers/staging/android/ion/ion.h\"
444 PVR_ANDROID_ION_PRIV_HEADER := \"../drivers/staging/android/ion/ion_priv.h\"
445 PVR_ANDROID_ION_USE_SG_LENGTH := 1
446 endif
447 ifneq ($(wildcard $(KSRCDIR)/drivers/staging/android/sync.h),)
448 # The kernel has a more recent version of the sync driver, located in
449 # drivers/staging. Change the default header path.
450 PVR_ANDROID_SYNC_HEADER := \"../drivers/staging/android/sync.h\"
451 endif
452 $(eval $(call BothConfigMake,SUPPORT_ION,1))
453 $(eval $(call BothConfigC,SUPPORT_ION,))
454 $(eval $(call TunableKernelConfigC,PVR_ANDROID_ION_HEADER,\"linux/ion.h\"))
455 $(eval $(call TunableKernelConfigC,PVR_ANDROID_ION_PRIV_HEADER,\"../drivers/gpu/ion/ion_priv.h\"))
456 $(eval $(call TunableKernelConfigC,PVR_ANDROID_ION_USE_SG_LENGTH,))
457 $(eval $(call TunableKernelConfigC,PVR_ANDROID_SYNC_HEADER,\"linux/sync.h\"))
458 endif
459
460 $(eval $(call UserConfigC,PVRSRV_MODULE_BASEDIR,\"$(PVRSRV_MODULE_BASEDIR)\"))
461
462 # Ideally configured by platform Makefiles, as necessary
463 #
464
465 $(if $(USE_CCACHE),$(if $(USE_DISTCC),$(error\
466 Enabling both USE_CCACHE and USE_DISTCC at the same time is not supported)))
467
468 # Invariant options for Linux
469 #
470 $(eval $(call BothConfigC,LINUX,))
471
472 $(eval $(call BothConfigC,PVR_BUILD_DIR,"\"$(PVR_BUILD_DIR)\""))
473 $(eval $(call BothConfigC,PVR_BUILD_TYPE,"\"$(BUILD)\""))
474 $(eval $(call BothConfigC,PVRSRV_MODNAME,"\"$(PVRSRV_MODNAME)\""))
475 $(eval $(call BothConfigMake,PVRSRV_MODNAME,$(PVRSRV_MODNAME)))
476 $(eval $(call BothConfigMake,PVR_BUILD_DIR,$(PVR_BUILD_DIR)))
477 $(eval $(call BothConfigMake,PVR_BUILD_TYPE,$(BUILD)))
478
479 $(eval $(call BothConfigC,SUPPORT_RGX,1))
480 $(eval $(call UserConfigMake,SUPPORT_RGX,1))
481
482 $(eval $(call BothConfigC,PVR_SECURE_HANDLES,))
483 $(eval $(call UserConfigC,PVR_TLS_USE_GCC__thread_KEYWORD,))
484
485 ifneq ($(DISPLAY_CONTROLLER),)
486 $(eval $(call BothConfigC,DISPLAY_CONTROLLER,$(DISPLAY_CONTROLLER)))
487 $(eval $(call BothConfigMake,DISPLAY_CONTROLLER,$(DISPLAY_CONTROLLER)))
488 endif
489
490 $(eval $(call UserConfigC,OPK_DEFAULT,"\"$(OPK_DEFAULT)\""))
491 $(eval $(call UserConfigC,OPK_FALLBACK,"\"$(OPK_FALLBACK)\""))
492
493 $(eval $(call BothConfigMake,PVR_SYSTEM,$(PVR_SYSTEM)))
494
495 ifeq ($(MESA_EGL),1)
496 $(eval $(call UserConfigMake,LIB_IMG_EGL,pvr_dri_if))
497 else
498 $(eval $(call UserConfigMake,LIB_IMG_EGL,IMGegl))
499 endif
500
501 # Build-type dependent options
502 #
503 $(eval $(call BothConfigMake,BUILD,$(BUILD)))
504
505 ifeq ($(BUILD),debug)
506 PVR_RI_DEBUG ?= 1
507 $(eval $(call BothConfigC,DEBUG,))
508 $(eval $(call KernelConfigC,DEBUG_LINUX_MEMORY_ALLOCATIONS,))
509 $(eval $(call KernelConfigC,DEBUG_LINUX_MEM_AREAS,))
510 $(eval $(call KernelConfigC,DEBUG_LINUX_MMAP_AREAS,))
511 $(eval $(call KernelConfigC,DEBUG_BRIDGE_KM,))
512 $(eval $(call KernelConfigC,DEBUG_HANDLEALLOC_KM,))
513 $(eval $(call UserConfigC,DLL_METRIC,1))
514 $(eval $(call TunableBothConfigC,RGXFW_ALIGNCHECKS,1))
515 $(eval $(call TunableBothConfigC,PVRSRV_DEBUG_CCB_MAX,))
516 else ifeq ($(BUILD),release)
517 $(eval $(call BothConfigC,RELEASE,))
518 $(eval $(call TunableBothConfigMake,DEBUGLINK,1))
519 $(eval $(call TunableBothConfigC,RGXFW_ALIGNCHECKS,))
520 else ifeq ($(BUILD),timing)
521 $(eval $(call BothConfigC,TIMING,))
522 $(eval $(call UserConfigC,DLL_METRIC,1))
523 $(eval $(call TunableBothConfigMake,DEBUGLINK,1))
524 else
525 $(error BUILD= must be either debug, release or timing)
526 endif
527
528
529
530 # User-configurable options
531 #
532 ifeq ($(DONT_NEED_RGX_BVNC),)
533  $(eval $(call TunableBothConfigC,RGX_BVNC_CORE_KM_HEADER,))
534     $(eval $(call TunableBothConfigC,RGX_BNC_CONFIG_KM_HEADER,))
535    endif
536
537 $(eval $(call TunableBothConfigC,SUPPORT_DBGDRV_EVENT_OBJECTS,1))
538 $(eval $(call TunableBothConfigC,PVR_DBG_BREAK_ASSERT_FAIL,,\
539 Enable this to treat PVR_DBG_BREAK as PVR_ASSERT(0)._\
540 Otherwise it is ignored._\
541 ))
542 $(eval $(call TunableBothConfigC,PDUMP,,\
543 Enable parameter dumping in the driver._\
544 This adds code to record the parameters being sent to the hardware for_\
545 later analysis._\
546 ))
547 $(eval $(call TunableBothConfigC,NO_HARDWARE,,\
548 Disable hardware interactions (e.g. register writes) that the driver would_\
549 normally perform. A driver built with this option can$(apos)t drive hardware$(comma)_\
550 but with PDUMP enabled$(comma) it can capture parameters to be played back later._\
551 ))
552 $(eval $(call TunableBothConfigC,PDUMP_DEBUG_OUTFILES,))
553 $(eval $(call TunableBothConfigC,SYS_USING_INTERRUPTS,1))
554 $(eval $(call TunableBothConfigC,PVRSRV_NEED_PVR_DPF,,\
555 Enable this to turn on PVR_DPF in release builds._\
556 ))
557 $(eval $(call TunableBothConfigC,PVRSRV_NEED_PVR_ASSERT,,\
558 Enable this to turn on PVR_ASSERT in release builds._\
559 ))
560 $(eval $(call TunableBothConfigC,PVRSRV_NEED_PVR_TRACE,,\
561 Enable this to turn on PVR_TRACE in release builds._\
562 ))
563 $(eval $(call TunableBothConfigC,REFCOUNT_DEBUG,))
564 $(eval $(call TunableBothConfigC,DC_DEBUG,))
565 $(eval $(call TunableBothConfigC,SCP_DEBUG,))
566 $(eval $(call TunableBothConfigC,CACHEFLUSH_TYPE,CACHEFLUSH_GENERIC))
567 $(eval $(call TunableBothConfigC,SUPPORT_INSECURE_EXPORT,1))
568 $(eval $(call TunableBothConfigC,SUPPORT_SECURE_EXPORT,1,\
569 Enable support for secure device memory and sync export._\
570 This replaces export handles with file descriptors$(comma) which can be passed_\
571 between processes to share memory._\
572 ))
573 $(eval $(call TunableBothConfigC,SUPPORT_PMMIF,))
574 $(eval $(call TunableBothConfigC,SUPPORT_GPUTRACE_EVENTS,))
575 $(eval $(call TunableBothConfigC,SUPPORT_KERNEL_HWPERF,))
576 $(eval $(call TunableBothConfigC,SUPPORT_DISPLAY_CLASS,))
577 $(eval $(call TunableBothConfigC,PVRSRV_DEBUG_CCB_MAX,))
578 $(eval $(call TunableBothConfigC,SUPPORT_TRUSTED_DEVICE,))
579 $(eval $(call TunableBothConfigC,TRUSTED_DEVICE_DEFAULT_ENABLED,))
580 $(eval $(call TunableBothConfigC,SUPPORT_EXPORTING_MEMORY_CONTEXT,))
581 $(eval $(call TunableBothConfigC,SUPPORT_USER_REGISTER_CONFIGURATION,))
582 $(eval $(call TunableBothConfigC,FIX_DUSTS_POW_ON_INIT,))
583
584 $(eval $(call TunableKernelConfigC,DEBUG_HANDLEALLOC_INFO_KM,))
585 $(eval $(call TunableKernelConfigC,SUPPORT_LINUX_X86_WRITECOMBINE,1))
586 $(eval $(call TunableKernelConfigC,SUPPORT_LINUX_X86_PAT,1))
587 $(eval $(call TunableKernelConfigC,PVRSRV_RESET_ON_HWTIMEOUT,))
588 $(eval $(call TunableKernelConfigC,PVR_LINUX_USING_WORKQUEUES,))
589 $(eval $(call TunableKernelConfigC,PVR_LINUX_MISR_USING_WORKQUEUE,))
590 $(eval $(call TunableKernelConfigC,PVR_LINUX_MISR_USING_PRIVATE_WORKQUEUE,))
591 $(eval $(call TunableKernelConfigC,PVR_LINUX_TIMERS_USING_WORKQUEUES,))
592 $(eval $(call TunableKernelConfigC,PVR_LINUX_TIMERS_USING_SHARED_WORKQUEUE,))
593 $(eval $(call TunableKernelConfigC,PVR_LDM_PLATFORM_PRE_REGISTERED,))
594 $(eval $(call TunableKernelConfigC,PVR_LDM_DRIVER_REGISTRATION_NAME,"\"$(PVRSRV_MODNAME)\""))
595 $(eval $(call TunableBothConfigC,LDM_PLATFORM,))
596 $(eval $(call TunableBothConfigC,LDM_PCI,))
597 $(eval $(call TunableBothConfigC,PVRSRV_ENABLE_FULL_SYNC_TRACKING,))
598 $(eval $(call TunableKernelConfigC,SYNC_DEBUG,))
599 $(eval $(call TunableKernelConfigC,SUPPORT_DUMP_CLIENT_CCB_COMMANDS,))
600 $(eval $(call TunableKernelConfigC,PVR_LINUX_DONT_USE_RANGE_BASED_INVALIDATE,))
601 $(eval $(call TunableKernelConfigC,PVR_MMAP_USE_VM_INSERT,))
602 $(eval $(call TunableKernelConfigC,SUPPORT_MMU_PxE_MAP_ON_DEMAND,))
603 $(eval $(call TunableKernelConfigC,SUPPORT_MMU_MODIFICATION_LOGGING,,\
604 Enable support for logging of page table modifications. This is as debug_\
605 feature for use when debugging page-faults which are showing what look to_\
606 be unexpected values. It keeps a history of the last few modifications types_\
607 (map/unmap) and the value written during as a result of that operation._\
608 ))
609 $(eval $(call TunableKernelConfigC,SUPPORT_DC_COMPLETE_TIMEOUT_DEBUG,))
610 $(eval $(call TunableKernelConfigC,SUPPORT_SYSTEM_INTERRUPT_HANDLING,,\
611 Enable support for system level interrupt handling. This is intended_\
612 for use on systems that have two or more levels of interrupt registers_\
613 which require the top level register to be cleared by the system layer_\
614 because it is not specific to one single device._\
615 ))
616
617 $(eval $(call TunableBothConfigC,SUPPORT_PVR_VALGRIND,))
618
619
620
621
622
623 ifneq ($(SUPPORT_ANDROID_PLATFORM),1)
624   endif
625
626   
627 $(eval $(call TunableBothConfigMake,CACHEFLUSH_TYPE,CACHEFLUSH_GENERIC))
628 $(eval $(call TunableBothConfigMake,PDUMP,))
629 $(eval $(call TunableBothConfigMake,SUPPORT_INSECURE_EXPORT,1))
630 $(eval $(call TunableBothConfigMake,SUPPORT_SECURE_EXPORT,1))
631 $(eval $(call TunableBothConfigMake,SUPPORT_PMMIF,))
632 $(eval $(call TunableBothConfigMake,SUPPORT_DISPLAY_CLASS,))
633 $(eval $(call TunableBothConfigMake,SUPPORT_RAY_TRACING,))
634
635 $(eval $(call TunableBothConfigMake,SUPPORT_GPUTRACE_EVENTS,))
636 $(eval $(call TunableBothConfigMake,SUPPORT_KERNEL_HWPERF,))
637
638 $(eval $(call TunableBothConfigMake,OPTIM,,\
639 Specify the optimisation flags passed to the compiler. Normally this_\
640 is autoconfigured based on the build type._\
641 ))
642 $(eval $(call TunableBothConfigC,SUPPORT_MMU_FREELIST,))
643 $(eval $(call TunableBothConfigC,SUPPORT_VFP,))
644
645 $(eval $(call TunableBothConfigC,SUPPORT_META_SLAVE_BOOT,))
646
647 $(eval $(call UserConfigC,EGL_BASENAME_SUFFIX,\"$(EGL_BASENAME_SUFFIX)\"))
648
649
650
651
652
653 $(eval $(call TunableBothConfigC,PVR_TESTING_UTILS,,\
654 Enable this to build in support for testing the PVR Transport Layer API._\
655 ))
656
657
658 TQ_CAPTURE_PARAMS ?= 1
659
660 $(eval $(call TunableBothConfigC,TDMETACODE,))
661 $(eval $(call TunableBothConfigC,PVR_DPF_ADHOC_DEBUG_ON,))
662 $(eval $(call TunableBothConfigC,RGXFW_DEBUG_LOG_GROUP,))
663 $(eval $(call TunableBothConfigC,SUPPORT_POWMON_WO_GPIO_PIN,))
664
665
666 $(eval $(call TunableKernelConfigMake,PVR_HANDLE_BACKEND,generic,\
667 Specifies the back-end that should be used$(comma) by the Services kernel handle_\
668 interface$(comma) to allocate handles. The available backends are:_\
669 * generic (OS agnostic)_\
670 * idr (Uses the Linux IDR interface)_\
671 ))
672
673
674 $(eval $(call TunableBothConfigC,PVRSRV_ENABLE_PROCESS_STATS,1,\
675 Enable Process Statistics via DebugFS._\
676 ))
677
678 $(eval $(call TunableKernelConfigC,SUPPORT_SHARED_SLC,,))
679
680 # PVR_RI_DEBUG is set to enable RI annotation of devmem allocations
681 # This is enabled by default for debug builds.
682 #
683 $(eval $(call TunableBothConfigMake,PVR_RI_DEBUG,))
684 $(eval $(call TunableBothConfigC,PVR_RI_DEBUG,,\
685 Enable Resource Information (RI) debug. This logs details of_\
686 resource allocations with annotation to help indicate their use._\
687 ))
688
689 $(eval $(call TunableKernelConfigC,PVRSRV_ENABLE_MEMORY_STATS,,\
690 Enable Memory allocations to be recorded and published via Process Statistics._\
691 ))
692
693 $(eval $(call TunableKernelConfigC,PVRSRV_ENABLE_FW_TRACE_DEBUGFS,,\
694 Enable automatic decoding of Firmware Trace via DebugFS._\
695 ))
696
697 $(eval $(call TunableKernelConfigC,PVR_LINUX_PYSMEM_MAX_POOL_PAGES,"$(MAX_POOL_PAGES)"))
698
699 # ARM-Linux specific: 
700 # When allocating uncached or write-combine memory we need to invalidate the
701 # CPU cache before we can use the acquired pages. 
702 # The threshhold defines at which number of pages we want to do a full 
703 # cache flush instead of invalidating pages one by one.
704 $(eval $(call TunableKernelConfigC,PVR_LINUX_ARM_PAGEALLOC_FLUSH_THRESHOLD, 256))
705
706 $(eval $(call TunableKernelConfigC,PVR_LINUX_VMALLOC_ALLOCATION_THRESHOLD, 16384 ))
707
708 # Tunable RGX_MAX_TA_SYNCS / RGX_MAX_3D_SYNCS to increase the size of sync array in the DDK
709 # If defined, these macros take up the values as defined in the environment,
710 # Else, the default value is taken up as defined in include/rgxapi.h
711 #
712
713 endif # INTERNAL_CLOBBER_ONLY
714
715 export INTERNAL_CLOBBER_ONLY
716 export TOP
717 export OUT
718
719 MAKE_ETC := -Rr --no-print-directory -C $(TOP) TOP=$(TOP) OUT=$(OUT) \
720                 -f build/linux/toplevel.mk
721
722 # This must match the default value of MAKECMDGOALS below, and the default
723 # goal in toplevel.mk
724 .DEFAULT_GOAL := build
725
726 ifeq ($(MAKECMDGOALS),)
727 MAKECMDGOALS := build
728 else
729 # We can't pass autogen to toplevel.mk
730 MAKECMDGOALS := $(filter-out autogen,$(MAKECMDGOALS))
731 endif
732
733 .PHONY: autogen
734 autogen:
735 ifeq ($(INTERNAL_CLOBBER_ONLY),)
736         @$(MAKE) -s --no-print-directory -C $(TOP) \
737                 -f build/linux/prepare_tree.mk \
738                 LDM_PCI=$(LDM_PCI) \
739                 LDM_PLATFORM=$(LDM_PLATFORM)
740 else
741         @:
742 endif
743
744 include ../config/help.mk
745
746 # This deletes built-in suffix rules. Otherwise the submake isn't run when
747 # saying e.g. "make thingy.a"
748 .SUFFIXES:
749
750 # Because we have a match-anything rule below, we'll run the main build when
751 # we're actually trying to remake various makefiles after they're read in.
752 # These rules try to prevent that
753 %.mk: ;
754 Makefile%: ;
755 Makefile: ;
756
757 .PHONY: build kbuild install
758 build kbuild install: autogen
759         @$(if $(MAKECMDGOALS),$(MAKE) $(MAKE_ETC) $(MAKECMDGOALS) $(eval MAKECMDGOALS :=),:)
760
761 %: autogen
762         @$(if $(MAKECMDGOALS),$(MAKE) $(MAKE_ETC) $(MAKECMDGOALS) $(eval MAKECMDGOALS :=),:)