dafd6fedf1db9375e5ca7fb28f577a36f43585f6
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / arm / mali400 / mali / Kbuild
1 #
2 # Copyright (C) 2010-2011 ARM Limited. All rights reserved.
3
4 # This program is free software and is provided to you under the terms of the GNU General Public License version 2
5 # as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
6
7 # A copy of the licence is included with the program, and can also be obtained from Free Software
8 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
9 #
10
11 # This file is called by the Linux build system.
12
13 # set up defaults if not defined by the user
14 TIMESTAMP ?= default
15 OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB ?= 16
16 USING_GPU_UTILIZATION ?= 1
17 PROFILING_SKIP_PP_JOBS ?= 0
18 PROFILING_SKIP_PP_AND_GP_JOBS ?= 0
19 MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP ?= 0
20 MALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED ?= 0
21 MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS ?= 0
22 MALI_UPPER_HALF_SCHEDULING ?= 1
23 MALI_ENABLE_CPU_CYCLES ?= 0
24 MALI_PLATFORM ?= rk30
25
26 # For customer releases the Linux Device Drivers will be provided as ARM proprietary and GPL releases:
27 # The ARM proprietary product will only include the license/proprietary directory
28 # The GPL product will only include the license/gpl directory
29 ifeq ($(wildcard $(src)/linux/license/gpl/*),)
30     ccflags-y += -I$(src)/linux/license/proprietary
31     ifeq ($(CONFIG_MALI400_PROFILING),y)
32         $(error Profiling is incompatible with non-GPL license)
33     endif
34     ifeq ($(CONFIG_PM_RUNTIME),y)
35         $(error Runtime PM is incompatible with non-GPL license)
36     endif
37     ifeq ($(CONFIG_DMA_SHARED_BUFFER),y)
38         $(error DMA-BUF is incompatible with non-GPL license)
39     endif
40     $(error Linux Device integration is incompatible with non-GPL license)
41 else
42     ccflags-y += -I$(src)/linux/license/gpl
43 endif
44
45 ifeq ($(USING_GPU_UTILIZATION), 1)
46     ifeq ($(USING_DVFS), 1)
47         $(error USING_GPU_UTILIZATION conflict with USING_DVFS you can read the Integration Guide to choose which one do you need)
48     endif
49 endif
50
51 ifneq ($(MALI_PLATFORM),)
52         EXTRA_DEFINES += -DMALI_FAKE_PLATFORM_DEVICE=1
53         #MALI_PLATFORM_FILES = $(wildcard platform/$(MALI_PLATFORM)/*.c)
54         mali-y += \
55                 platform/$(MALI_PLATFORM)/mali_platform.o \
56                 platform/$(MALI_PLATFORM)/rk3066.o \
57                 platform/$(MALI_PLATFORM)/mali_dvfs.o \
58                 platform/$(MALI_PLATFORM)/arm_core_scaling.o
59 endif
60
61 mali-y += \
62         linux/mali_osk_atomics.o \
63         linux/mali_osk_irq.o \
64         linux/mali_osk_wq.o \
65         linux/mali_osk_locks.o \
66         linux/mali_osk_wait_queue.o \
67         linux/mali_osk_low_level_mem.o \
68         linux/mali_osk_math.o \
69         linux/mali_osk_memory.o \
70         linux/mali_osk_misc.o \
71         linux/mali_osk_mali.o \
72         linux/mali_osk_notification.o \
73         linux/mali_osk_time.o \
74         linux/mali_osk_timers.o
75
76 mali-y += linux/mali_memory.o linux/mali_memory_os_alloc.o
77 mali-y += linux/mali_memory_external.o
78 mali-y += linux/mali_memory_block_alloc.o
79
80 mali-y += \
81         linux/mali_ukk_mem.o \
82         linux/mali_ukk_gp.o \
83         linux/mali_ukk_pp.o \
84         linux/mali_ukk_core.o \
85         linux/mali_ukk_soft_job.o \
86         linux/mali_ukk_timeline.o
87
88 # Source files which always are included in a build
89 mali-y += \
90         common/mali_kernel_core.o \
91         linux/mali_kernel_linux.o \
92         common/mali_kernel_descriptor_mapping.o \
93         common/mali_session.o \
94         linux/mali_device_pause_resume.o \
95         common/mali_kernel_vsync.o \
96         linux/mali_ukk_vsync.o \
97         linux/mali_kernel_sysfs.o \
98         common/mali_mmu.o \
99         common/mali_mmu_page_directory.o \
100         common/mali_mem_validation.o \
101         common/mali_hw_core.o \
102         common/mali_gp.o \
103         common/mali_pp.o \
104         common/mali_pp_job.o \
105         common/mali_gp_job.o \
106         common/mali_soft_job.o \
107         common/mali_scheduler.o \
108         common/mali_executor.o \
109         common/mali_group.o \
110         common/mali_dlbu.o \
111         common/mali_broadcast.o \
112         common/mali_pm.o \
113         common/mali_pmu.o \
114         common/mali_user_settings_db.o \
115         common/mali_kernel_utilization.o \
116         common/mali_control_timer.o \
117         common/mali_l2_cache.o \
118         common/mali_timeline.o \
119         common/mali_timeline_fence_wait.o \
120         common/mali_timeline_sync_fence.o \
121         common/mali_spinlock_reentrant.o \
122         common/mali_pm_domain.o \
123         linux/mali_osk_pm.o \
124         linux/mali_pmu_power_up_down.o \
125         __malidrv_build_info.o
126
127 ifneq ($(MALI_PLATFORM_FILES),)
128         mali-y += $(MALI_PLATFORM_FILES:.c=.o)
129 endif
130
131 mali-$(CONFIG_MALI400_PROFILING) += linux/mali_ukk_profiling.o
132 mali-$(CONFIG_MALI400_PROFILING) += linux/mali_osk_profiling.o
133
134 mali-$(CONFIG_MALI400_INTERNAL_PROFILING) += linux/mali_profiling_internal.o timestamp-$(TIMESTAMP)/mali_timestamp.o
135 ccflags-$(CONFIG_MALI400_INTERNAL_PROFILING) += -I$(src)/timestamp-$(TIMESTAMP)
136
137 mali-$(CONFIG_DMA_SHARED_BUFFER) += linux/mali_memory_dma_buf.o
138 mali-$(CONFIG_SYNC) += linux/mali_sync.o
139 ccflags-$(CONFIG_SYNC) += -Idrivers/staging/android
140
141 mali-$(CONFIG_MALI400_UMP) += linux/mali_memory_ump.o
142
143 mali-$(CONFIG_MALI_DVFS) += common/mali_dvfs_policy.o
144
145 # Tell the Linux build system from which .o file to create the kernel module
146 obj-$(CONFIG_MALI400) := mali.o
147
148 ccflags-y += $(EXTRA_DEFINES)
149
150 # Set up our defines, which will be passed to gcc
151 ccflags-y += -DMALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP=$(MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP)
152 ccflags-y += -DMALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED=$(MALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED)
153 ccflags-y += -DMALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS=$(MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS)
154 ccflags-y += -DMALI_STATE_TRACKING=1
155 ccflags-y += -DMALI_OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=$(OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB)
156 ccflags-y += -DUSING_GPU_UTILIZATION=$(USING_GPU_UTILIZATION)
157 ccflags-y += -DMALI_ENABLE_CPU_CYCLES=$(MALI_ENABLE_CPU_CYCLES)
158
159 ifeq ($(MALI_UPPER_HALF_SCHEDULING),1)
160         ccflags-y += -DMALI_UPPER_HALF_SCHEDULING
161 endif
162
163 ccflags-$(CONFIG_MALI400_UMP) += -I$(src)/../../ump/include/ump
164 ccflags-$(CONFIG_MALI400_DEBUG) += -DDEBUG
165
166 # Use our defines when compiling
167 ccflags-y += -I$(src) -I$(src)/include -I$(src)/common -I$(src)/linux -I$(src)/platform
168
169 # Get subversion revision number, fall back to only ${MALI_RELEASE_NAME} if no svn info is available
170 MALI_RELEASE_NAME=$(shell cat $(src)/.version 2> /dev/null)
171
172 SVN_INFO = (cd $(src); svn info 2>/dev/null)
173
174 ifneq ($(shell $(SVN_INFO) 2>/dev/null),)
175 # SVN detected
176 SVN_REV := $(shell $(SVN_INFO) | grep '^Revision: '| sed -e 's/^Revision: //' 2>/dev/null)
177 DRIVER_REV := $(MALI_RELEASE_NAME)-r$(SVN_REV)
178 CHANGE_DATE := $(shell $(SVN_INFO) | grep '^Last Changed Date: ' | cut -d: -f2- | cut -b2-)
179 CHANGED_REVISION := $(shell $(SVN_INFO) | grep '^Last Changed Rev: ' | cut -d: -f2- | cut -b2-)
180 REPO_URL := $(shell $(SVN_INFO) | grep '^URL: ' | cut -d: -f2- | cut -b2-)
181
182 else # SVN
183 GIT_REV := $(shell cd $(src); git describe --always 2>/dev/null)
184 ifneq ($(GIT_REV),)
185 # Git detected
186 DRIVER_REV := $(MALI_RELEASE_NAME)-$(GIT_REV)
187 CHANGE_DATE := $(shell cd $(src); git log -1 --format="%ci")
188 CHANGED_REVISION := $(GIT_REV)
189 REPO_URL := $(shell cd $(src); git describe --all --always 2>/dev/null)
190
191 else # Git
192 # No Git or SVN detected
193 DRIVER_REV := $(MALI_RELEASE_NAME)
194 CHANGE_DATE := $(MALI_RELEASE_NAME)
195 CHANGED_REVISION := $(MALI_RELEASE_NAME)
196 endif
197 endif
198
199 ccflags-y += -DSVN_REV_STRING=\"$(DRIVER_REV)\"
200
201 VERSION_STRINGS :=
202 VERSION_STRINGS += API_VERSION=$(shell cd $(src); grep "\#define _MALI_API_VERSION" $(FILES_PREFIX)include/linux/mali/mali_utgard_uk_types.h | cut -d' ' -f 3 )
203 VERSION_STRINGS += REPO_URL=$(REPO_URL)
204 VERSION_STRINGS += REVISION=$(DRIVER_REV)
205 VERSION_STRINGS += CHANGED_REVISION=$(CHANGED_REVISION)
206 VERSION_STRINGS += CHANGE_DATE=$(CHANGE_DATE)
207 VERSION_STRINGS += BUILD_DATE=$(shell date)
208 ifdef CONFIG_MALI400_DEBUG
209 VERSION_STRINGS += BUILD=debug
210 else
211 VERSION_STRINGS += BUILD=release
212 endif
213 VERSION_STRINGS += TARGET_PLATFORM=$(TARGET_PLATFORM)
214 VERSION_STRINGS += MALI_PLATFORM=$(MALI_PLATFORM)
215 VERSION_STRINGS += KDIR=$(KDIR)
216 VERSION_STRINGS += OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=$(OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB)
217 VERSION_STRINGS += USING_UMP=$(CONFIG_MALI400_UMP)
218 VERSION_STRINGS += USING_PROFILING=$(CONFIG_MALI400_PROFILING)
219 VERSION_STRINGS += USING_INTERNAL_PROFILING=$(CONFIG_MALI400_INTERNAL_PROFILING)
220 VERSION_STRINGS += USING_GPU_UTILIZATION=$(USING_GPU_UTILIZATION)
221 VERSION_STRINGS += USING_DVFS=$(CONFIG_MALI_DVFS)
222 VERSION_STRINGS += MALI_UPPER_HALF_SCHEDULING=$(MALI_UPPER_HALF_SCHEDULING)
223
224 # Create file with Mali driver configuration
225 $(src)/__malidrv_build_info.c:
226         @echo 'const char *__malidrv_build_info(void) { return "malidrv: $(VERSION_STRINGS)";}' > $(src)/__malidrv_build_info.c