|
| 1 | +# |
| 2 | +# (C) COPYRIGHT 2012,2014 ARM Limited. All rights reserved. |
| 3 | +# |
| 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 |
| 7 | +# of such GNU licence. |
| 8 | +# |
| 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. |
| 12 | +# |
| 13 | +# |
| 14 | + |
| 15 | + |
| 16 | +# Driver version string which is returned to userspace via an ioctl |
| 17 | +MALI_RELEASE_NAME ?= "r14p0-01rel0" |
| 18 | + |
| 19 | +# Paths required for build |
| 20 | +KBASE_PATH = $(src) |
| 21 | +KBASE_PLATFORM_PATH = $(KBASE_PATH)/platform_dummy |
| 22 | +UMP_PATH = $(src)/../../../base |
| 23 | + |
| 24 | +ifeq ($(CONFIG_MALI_ERROR_INJECTION),y) |
| 25 | +MALI_ERROR_INJECT_ON = 1 |
| 26 | +endif |
| 27 | + |
| 28 | +# Set up defaults if not defined by build system |
| 29 | +MALI_CUSTOMER_RELEASE ?= 1 |
| 30 | +MALI_UNIT_TEST ?= 0 |
| 31 | +MALI_KERNEL_TEST_API ?= 0 |
| 32 | +MALI_ERROR_INJECT_ON ?= 0 |
| 33 | +MALI_MOCK_TEST ?= 0 |
| 34 | +MALI_COVERAGE ?= 0 |
| 35 | +MALI_INSTRUMENTATION_LEVEL ?= 0 |
| 36 | +# This workaround is for what seems to be a compiler bug we observed in |
| 37 | +# GCC 4.7 on AOSP 4.3. The bug caused an intermittent failure compiling |
| 38 | +# the "_Pragma" syntax, where an error message is returned: |
| 39 | +# |
| 40 | +# "internal compiler error: unspellable token PRAGMA" |
| 41 | +# |
| 42 | +# This regression has thus far only been seen on the GCC 4.7 compiler bundled |
| 43 | +# with AOSP 4.3.0. So this makefile, intended for in-tree kernel builds |
| 44 | +# which are not known to be used with AOSP, is hardcoded to disable the |
| 45 | +# workaround, i.e. set the define to 0. |
| 46 | +MALI_GCC_WORKAROUND_MIDCOM_4598 ?= 0 |
| 47 | + |
| 48 | +# Set up our defines, which will be passed to gcc |
| 49 | +DEFINES = \ |
| 50 | + -DMALI_CUSTOMER_RELEASE=$(MALI_CUSTOMER_RELEASE) \ |
| 51 | + -DMALI_KERNEL_TEST_API=$(MALI_KERNEL_TEST_API) \ |
| 52 | + -DMALI_UNIT_TEST=$(MALI_UNIT_TEST) \ |
| 53 | + -DMALI_ERROR_INJECT_ON=$(MALI_ERROR_INJECT_ON) \ |
| 54 | + -DMALI_MOCK_TEST=$(MALI_MOCK_TEST) \ |
| 55 | + -DMALI_COVERAGE=$(MALI_COVERAGE) \ |
| 56 | + -DMALI_INSTRUMENTATION_LEVEL=$(MALI_INSTRUMENTATION_LEVEL) \ |
| 57 | + -DMALI_RELEASE_NAME=\"$(MALI_RELEASE_NAME)\" \ |
| 58 | + -DMALI_GCC_WORKAROUND_MIDCOM_4598=$(MALI_GCC_WORKAROUND_MIDCOM_4598) |
| 59 | + |
| 60 | +ifeq ($(KBUILD_EXTMOD),) |
| 61 | +# in-tree |
| 62 | +DEFINES +=-DMALI_KBASE_THIRDPARTY_PATH=../../$(src)/platform/$(CONFIG_MALI_PLATFORM_THIRDPARTY_NAME) |
| 63 | +else |
| 64 | +# out-of-tree |
| 65 | +DEFINES +=-DMALI_KBASE_THIRDPARTY_PATH=$(src)/platform/$(CONFIG_MALI_PLATFORM_THIRDPARTY_NAME) |
| 66 | +endif |
| 67 | + |
| 68 | +DEFINES += -I$(srctree)/drivers/staging/android |
| 69 | + |
| 70 | +# Use our defines when compiling |
| 71 | +ccflags-y += $(DEFINES) -I$(KBASE_PATH) -I$(KBASE_PLATFORM_PATH) -I$(UMP_PATH) -I$(srctree)/include/linux |
| 72 | +subdir-ccflags-y += $(DEFINES) -I$(KBASE_PATH) -I$(KBASE_PLATFORM_PATH) -I$(OSK_PATH) -I$(UMP_PATH) -I$(srctree)/include/linux |
| 73 | + |
| 74 | +SRC := \ |
| 75 | + mali_kbase_device.c \ |
| 76 | + mali_kbase_cache_policy.c \ |
| 77 | + mali_kbase_mem.c \ |
| 78 | + mali_kbase_mmu.c \ |
| 79 | + mali_kbase_ipa.c \ |
| 80 | + mali_kbase_jd.c \ |
| 81 | + mali_kbase_jd_debugfs.c \ |
| 82 | + mali_kbase_jm.c \ |
| 83 | + mali_kbase_gpuprops.c \ |
| 84 | + mali_kbase_js.c \ |
| 85 | + mali_kbase_js_ctx_attr.c \ |
| 86 | + mali_kbase_event.c \ |
| 87 | + mali_kbase_context.c \ |
| 88 | + mali_kbase_pm.c \ |
| 89 | + mali_kbase_config.c \ |
| 90 | + mali_kbase_vinstr.c \ |
| 91 | + mali_kbase_softjobs.c \ |
| 92 | + mali_kbase_10969_workaround.c \ |
| 93 | + mali_kbase_hw.c \ |
| 94 | + mali_kbase_utility.c \ |
| 95 | + mali_kbase_debug.c \ |
| 96 | + mali_kbase_trace_timeline.c \ |
| 97 | + mali_kbase_gpu_memory_debugfs.c \ |
| 98 | + mali_kbase_mem_linux.c \ |
| 99 | + mali_kbase_core_linux.c \ |
| 100 | + mali_kbase_sync.c \ |
| 101 | + mali_kbase_sync_user.c \ |
| 102 | + mali_kbase_replay.c \ |
| 103 | + mali_kbase_mem_profile_debugfs.c \ |
| 104 | + mali_kbase_mmu_mode_lpae.c \ |
| 105 | + mali_kbase_mmu_mode_aarch64.c \ |
| 106 | + mali_kbase_disjoint_events.c \ |
| 107 | + mali_kbase_gator_api.c \ |
| 108 | + mali_kbase_debug_mem_view.c \ |
| 109 | + mali_kbase_debug_job_fault.c \ |
| 110 | + mali_kbase_smc.c \ |
| 111 | + mali_kbase_mem_pool.c \ |
| 112 | + mali_kbase_mem_pool_debugfs.c \ |
| 113 | + mali_kbase_tlstream.c \ |
| 114 | + mali_kbase_strings.c \ |
| 115 | + mali_kbase_as_fault_debugfs.c \ |
| 116 | + mali_kbase_regs_history_debugfs.c |
| 117 | + |
| 118 | +ifeq ($(MALI_UNIT_TEST),1) |
| 119 | + SRC += mali_kbase_tlstream_test.c |
| 120 | +endif |
| 121 | + |
| 122 | +ifeq ($(MALI_CUSTOMER_RELEASE),0) |
| 123 | + SRC += mali_kbase_regs_dump_debugfs.c |
| 124 | +endif |
| 125 | + |
| 126 | + |
| 127 | +# Job Scheduler Policy: Completely Fair Scheduler |
| 128 | +SRC += mali_kbase_js_policy_cfs.c |
| 129 | + |
| 130 | +ccflags-y += -I$(KBASE_PATH) |
| 131 | + |
| 132 | +ifeq ($(CONFIG_MALI_PLATFORM_FAKE),y) |
| 133 | + SRC += mali_kbase_platform_fake.c |
| 134 | + |
| 135 | + ifeq ($(CONFIG_MALI_PLATFORM_VEXPRESS),y) |
| 136 | + SRC += platform/vexpress/mali_kbase_config_vexpress.c \ |
| 137 | + platform/vexpress/mali_kbase_cpu_vexpress.c |
| 138 | + ccflags-y += -I$(src)/platform/vexpress |
| 139 | + endif |
| 140 | + |
| 141 | + ifeq ($(CONFIG_MALI_PLATFORM_RTSM_VE),y) |
| 142 | + SRC += platform/rtsm_ve/mali_kbase_config_vexpress.c |
| 143 | + ccflags-y += -I$(src)/platform/rtsm_ve |
| 144 | + endif |
| 145 | + |
| 146 | + ifeq ($(CONFIG_MALI_PLATFORM_JUNO),y) |
| 147 | + SRC += platform/juno/mali_kbase_config_vexpress.c |
| 148 | + ccflags-y += -I$(src)/platform/juno |
| 149 | + endif |
| 150 | + |
| 151 | + ifeq ($(CONFIG_MALI_PLATFORM_JUNO_SOC),y) |
| 152 | + SRC += platform/juno_soc/mali_kbase_config_juno_soc.c |
| 153 | + ccflags-y += -I$(src)/platform/juno_soc |
| 154 | + endif |
| 155 | + |
| 156 | + ifeq ($(CONFIG_MALI_PLATFORM_VEXPRESS_1XV7_A57),y) |
| 157 | + SRC += platform/vexpress_1xv7_a57/mali_kbase_config_vexpress.c |
| 158 | + ccflags-y += -I$(src)/platform/vexpress_1xv7_a57 |
| 159 | + endif |
| 160 | + |
| 161 | + ifeq ($(CONFIG_MALI_PLATFORM_VEXPRESS_6XVIRTEX7_10MHZ),y) |
| 162 | + SRC += platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_vexpress.c \ |
| 163 | + platform/vexpress_6xvirtex7_10mhz/mali_kbase_cpu_vexpress.c |
| 164 | + ccflags-y += -I$(src)/platform/vexpress_6xvirtex7_10mhz |
| 165 | + endif |
| 166 | + |
| 167 | + ifeq ($(CONFIG_MALI_PLATFORM_A7_KIPLING),y) |
| 168 | + SRC += platform/a7_kipling/mali_kbase_config_a7_kipling.c \ |
| 169 | + platform/a7_kipling/mali_kbase_cpu_a7_kipling.c |
| 170 | + ccflags-y += -I$(src)/platform/a7_kipling |
| 171 | + endif |
| 172 | + |
| 173 | + ifeq ($(CONFIG_MALI_PLATFORM_THIRDPARTY),y) |
| 174 | + # remove begin and end quotes from the Kconfig string type |
| 175 | + platform_name := $(shell echo $(CONFIG_MALI_PLATFORM_THIRDPARTY_NAME)) |
| 176 | + MALI_PLATFORM_THIRDPARTY_DIR := platform/$(platform_name) |
| 177 | + ccflags-y += -I$(src)/$(MALI_PLATFORM_THIRDPARTY_DIR) |
| 178 | + ifeq ($(CONFIG_MALI_MIDGARD),m) |
| 179 | + include $(src)/platform/$(platform_name)/Kbuild |
| 180 | + else ifeq ($(CONFIG_MALI_MIDGARD),y) |
| 181 | + obj-$(CONFIG_MALI_MIDGARD) += platform/ |
| 182 | + endif |
| 183 | + endif |
| 184 | +endif # CONFIG_MALI_PLATFORM_FAKE=y |
| 185 | + |
| 186 | +ifeq ($(CONFIG_MALI_PLATFORM_THIRDPARTY),y) |
| 187 | +# remove begin and end quotes from the Kconfig string type |
| 188 | +platform_name := $(shell echo $(CONFIG_MALI_PLATFORM_THIRDPARTY_NAME)) |
| 189 | +MALI_PLATFORM_THIRDPARTY_DIR := platform/$(platform_name) |
| 190 | +ccflags-y += -I$(src)/$(MALI_PLATFORM_THIRDPARTY_DIR) |
| 191 | +MALI_PLATFORM_DIR := platform/$(platform_name) |
| 192 | +include $(src)/platform/$(platform_name)/Kbuild |
| 193 | +endif |
| 194 | + |
| 195 | +# Tell the Linux build system from which .o file to create the kernel module |
| 196 | +obj-$(CONFIG_MALI_MIDGARD) += midgard_kbase.o |
| 197 | + |
| 198 | +# Tell the Linux build system to enable building of our .c files |
| 199 | +midgard_kbase-y := $(SRC:.c=.o) |
| 200 | + |
| 201 | +midgard_kbase-$(CONFIG_MALI_DMA_FENCE) += mali_kbase_dma_fence.o |
| 202 | + |
| 203 | +MALI_BACKEND_PATH ?= backend |
| 204 | +CONFIG_MALI_BACKEND ?= gpu |
| 205 | +CONFIG_MALI_BACKEND_REAL ?= $(CONFIG_MALI_BACKEND) |
| 206 | + |
| 207 | +ifeq ($(MALI_MOCK_TEST),1) |
| 208 | +ifeq ($(CONFIG_MALI_BACKEND_REAL),gpu) |
| 209 | +# Test functionality |
| 210 | +midgard_kbase-y += tests/internal/src/mock/mali_kbase_pm_driver_mock.o |
| 211 | +endif |
| 212 | +endif |
| 213 | + |
| 214 | +include $(src)/$(MALI_BACKEND_PATH)/$(CONFIG_MALI_BACKEND_REAL)/Kbuild |
| 215 | +midgard_kbase-y += $(BACKEND:.c=.o) |
| 216 | + |
| 217 | +ccflags-y += -I$(src)/$(MALI_BACKEND_PATH)/$(CONFIG_MALI_BACKEND_REAL) |
| 218 | +subdir-ccflags-y += -I$(src)/$(MALI_BACKEND_PATH)/$(CONFIG_MALI_BACKEND_REAL) |
| 219 | + |
| 220 | +# Default to devicetree platform if neither a fake platform or a thirdparty |
| 221 | +# platform is configured. |
| 222 | +ifeq ($(CONFIG_MALI_PLATFORM_THIRDPARTY)$(CONFIG_MALI_PLATFORM_FAKE),) |
| 223 | +CONFIG_MALI_PLATFORM_DEVICETREE := y |
| 224 | +endif |
| 225 | + |
| 226 | +midgard_kbase-$(CONFIG_MALI_PLATFORM_DEVICETREE) += \ |
| 227 | + platform/devicetree/mali_kbase_runtime_pm.o \ |
| 228 | + platform/devicetree/mali_kbase_config_devicetree.o |
| 229 | +ccflags-$(CONFIG_MALI_PLATFORM_DEVICETREE) += -I$(src)/platform/devicetree |
0 commit comments