tizen 2.4 release
[kernel/linux-3.0.git] / drivers / gpu / arm / mali400 / r4p0_rel0 / 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
25 # MALI_SEC
26 # Include the mapping between TARGET_PLATFORM and KDIR + MALI_PLATFORM
27 ifeq ($(CONFIG_CPU_EXYNOS4212),y)
28     TARGET_PLATFORM=pegasus-m400
29 endif
30 ifeq ($(CONFIG_CPU_EXYNOS4412),y)
31     TARGET_PLATFORM=pegasus-m400
32 endif
33 ifeq ($(CONFIG_SOC_EXYNOS4415),y)
34        TARGET_PLATFORM=exynos4415
35 endif
36 ifeq ($(CONFIG_SOC_EXYNOS3470),y)
37        TARGET_PLATFORM=exynos3470
38 endif
39
40 ifeq ($(CONFIG_SOC_EXYNOS3250),y)
41         TARGET_PLATFORM=exynos3250
42 endif
43
44 include $(src)/MALI_CONFIGURATION
45 MALI_PLATFORM = $(MALI_PLATFORM-$(TARGET_PLATFORM))
46 EXTRA_DEFINES += -DMALI_FAKE_PLATFORM_DEVICE=1
47 MALI_PLATFORM_FILES = $(subst $(src)/,,$(wildcard $(src)/platform/$(MALI_PLATFORM)/*.c))
48 # End of MALI_SEC
49
50 # For customer releases the Linux Device Drivers will be provided as ARM proprietary and GPL releases:
51 # The ARM proprietary product will only include the license/proprietary directory
52 # The GPL product will only include the license/gpl directory
53 ifeq ($(wildcard $(src)/linux/license/gpl/*),)
54     ccflags-y += -I$(src)/linux/license/proprietary
55     ifeq ($(CONFIG_MALI400_PROFILING),y)
56         $(error Profiling is incompatible with non-GPL license)
57     endif
58     ifeq ($(CONFIG_PM_RUNTIME),y)
59         $(error Runtime PM is incompatible with non-GPL license)
60     endif
61     ifeq ($(CONFIG_DMA_SHARED_BUFFER),y)
62         $(error DMA-BUF is incompatible with non-GPL license)
63     endif
64     $(error Linux Device integration is incompatible with non-GPL license)
65 else
66     ccflags-y += -I$(src)/linux/license/gpl
67 endif
68
69 mali-y += \
70         linux/mali_osk_atomics.o \
71         linux/mali_osk_irq.o \
72         linux/mali_osk_wq.o \
73         linux/mali_osk_locks.o \
74         linux/mali_osk_wait_queue.o \
75         linux/mali_osk_low_level_mem.o \
76         linux/mali_osk_math.o \
77         linux/mali_osk_memory.o \
78         linux/mali_osk_misc.o \
79         linux/mali_osk_mali.o \
80         linux/mali_osk_notification.o \
81         linux/mali_osk_time.o \
82         linux/mali_osk_timers.o
83
84 mali-y += linux/mali_memory.o linux/mali_memory_os_alloc.o
85 mali-y += linux/mali_memory_external.o
86 mali-y += linux/mali_memory_block_alloc.o
87
88 mali-y += \
89         linux/mali_ukk_mem.o \
90         linux/mali_ukk_gp.o \
91         linux/mali_ukk_pp.o \
92         linux/mali_ukk_core.o \
93         linux/mali_ukk_soft_job.o \
94         linux/mali_ukk_timeline.o
95
96 # Source files which always are included in a build
97 mali-y += \
98         common/mali_kernel_core.o \
99         linux/mali_kernel_linux.o \
100         common/mali_kernel_descriptor_mapping.o \
101         common/mali_session.o \
102         linux/mali_device_pause_resume.o \
103         common/mali_kernel_vsync.o \
104         linux/mali_ukk_vsync.o \
105         linux/mali_kernel_sysfs.o \
106         common/mali_mmu.o \
107         common/mali_mmu_page_directory.o \
108         common/mali_mem_validation.o \
109         common/mali_hw_core.o \
110         common/mali_gp.o \
111         common/mali_pp.o \
112         common/mali_pp_job.o \
113         common/mali_gp_job.o \
114         common/mali_soft_job.o \
115         common/mali_scheduler.o \
116         common/mali_gp_scheduler.o \
117         common/mali_pp_scheduler.o \
118         common/mali_group.o \
119         common/mali_dlbu.o \
120         common/mali_broadcast.o \
121         common/mali_pm.o \
122         common/mali_pmu.o \
123         common/mali_user_settings_db.o \
124         common/mali_kernel_utilization.o \
125         common/mali_l2_cache.o \
126         common/mali_dma.o \
127         common/mali_timeline.o \
128         common/mali_timeline_fence_wait.o \
129         common/mali_timeline_sync_fence.o \
130         common/mali_spinlock_reentrant.o \
131         common/mali_pm_domain.o \
132         linux/mali_osk_pm.o \
133         linux/mali_pmu_power_up_down.o \
134         __malidrv_build_info.o
135
136 ifneq ($(MALI_PLATFORM_FILES),)
137         mali-y += $(MALI_PLATFORM_FILES:.c=.o)
138 endif
139
140 mali-$(CONFIG_MALI400_PROFILING) += linux/mali_ukk_profiling.o
141 mali-$(CONFIG_MALI400_PROFILING) += linux/mali_osk_profiling.o
142
143 mali-$(CONFIG_MALI400_INTERNAL_PROFILING) += linux/mali_profiling_internal.o timestamp-$(TIMESTAMP)/mali_timestamp.o
144 ccflags-$(CONFIG_MALI400_INTERNAL_PROFILING) += -I$(src)/timestamp-$(TIMESTAMP)
145
146 mali-$(CONFIG_DMA_SHARED_BUFFER) += linux/mali_memory_dma_buf.o
147 mali-$(CONFIG_SYNC) += linux/mali_sync.o
148
149 mali-$(CONFIG_MALI400_UMP) += linux/mali_memory_ump.o
150
151 mali-$(CONFIG_MALI400_POWER_PERFORMANCE_POLICY) += common/mali_power_performance_policy.o
152
153 # Tell the Linux build system from which .o file to create the kernel module
154 obj-$(CONFIG_MALI400) := mali.o
155
156 ccflags-y += $(EXTRA_DEFINES)
157
158 # Set up our defines, which will be passed to gcc
159 ccflags-y += -DPROFILING_SKIP_PP_JOBS=$(PROFILING_SKIP_PP_JOBS)
160 ccflags-y += -DPROFILING_SKIP_PP_AND_GP_JOBS=$(PROFILING_SKIP_PP_AND_GP_JOBS)
161
162 ccflags-y += -DMALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP=$(MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP)
163 ccflags-y += -DMALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED=$(MALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED)
164 ccflags-y += -DMALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS=$(MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS)
165 ccflags-y += -DMALI_STATE_TRACKING=1
166 ccflags-y += -DMALI_OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=$(OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB)
167 ccflags-y += -DUSING_GPU_UTILIZATION=$(USING_GPU_UTILIZATION)
168 ccflags-y += -DMALI_ENABLE_CPU_CYCLES=$(MALI_ENABLE_CPU_CYCLES)
169
170 ifeq ($(MALI_UPPER_HALF_SCHEDULING),1)
171         ccflags-y += -DMALI_UPPER_HALF_SCHEDULING
172 endif
173
174 ccflags-$(CONFIG_MALI400_UMP) += -I$(src)/../../ump/include/ump
175 ccflags-$(CONFIG_MALI400_DEBUG) += -DDEBUG
176
177 # Use our defines when compiling
178 ccflags-y += -I$(src) -I$(src)/include -I$(src)/common -I$(src)/linux -I$(src)/platform
179 # MALI_SEC 
180 ccflags-y += -I$(src)/../ump/include -I$(src)/include/linux/mali -I$(src)/platform/$(MALI_PLATFORM)
181
182 # Get subversion revision number, fall back to only ${MALI_RELEASE_NAME} if no svn info is available
183 MALI_RELEASE_NAME=$(shell cat $(src)/.version 2> /dev/null)
184
185 SVN_INFO = (cd $(src); svn info 2>/dev/null)
186
187 ifneq ($(shell $(SVN_INFO) 2>/dev/null),)
188 # SVN detected
189 SVN_REV := $(shell $(SVN_INFO) | grep '^Revision: '| sed -e 's/^Revision: //' 2>/dev/null)
190 DRIVER_REV := $(MALI_RELEASE_NAME)-r$(SVN_REV)
191 CHANGE_DATE := $(shell $(SVN_INFO) | grep '^Last Changed Date: ' | cut -d: -f2- | cut -b2-)
192 CHANGED_REVISION := $(shell $(SVN_INFO) | grep '^Last Changed Rev: ' | cut -d: -f2- | cut -b2-)
193 REPO_URL := $(shell $(SVN_INFO) | grep '^URL: ' | cut -d: -f2- | cut -b2-)
194
195 else # SVN
196 GIT_REV := $(shell cd $(src); git describe --always 2>/dev/null)
197 ifneq ($(GIT_REV),)
198 # Git detected
199 DRIVER_REV := $(MALI_RELEASE_NAME)-$(GIT_REV)
200 CHANGE_DATE := $(shell cd $(src); git log -1 --format="%ci")
201 CHANGED_REVISION := $(GIT_REV)
202 REPO_URL := $(shell cd $(src); git describe --all --always 2>/dev/null)
203
204 else # Git
205 # No Git or SVN detected
206 DRIVER_REV := $(MALI_RELEASE_NAME)
207 CHANGE_DATE := $(MALI_RELEASE_NAME)
208 CHANGED_REVISION := $(MALI_RELEASE_NAME)
209 endif
210 endif
211
212 ccflags-y += -DSVN_REV_STRING=\"$(DRIVER_REV)\"
213
214 VERSION_STRINGS :=
215 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 )
216 VERSION_STRINGS += REPO_URL=$(REPO_URL)
217 VERSION_STRINGS += REVISION=$(DRIVER_REV)
218 VERSION_STRINGS += CHANGED_REVISION=$(CHANGED_REVISION)
219 VERSION_STRINGS += CHANGE_DATE=$(CHANGE_DATE)
220 VERSION_STRINGS += BUILD_DATE=$(shell date)
221 ifdef CONFIG_MALI400_DEBUG
222 VERSION_STRINGS += BUILD=debug
223 else
224 VERSION_STRINGS += BUILD=release
225 endif
226 VERSION_STRINGS += TARGET_PLATFORM=$(TARGET_PLATFORM)
227 VERSION_STRINGS += MALI_PLATFORM=$(MALI_PLATFORM)
228 VERSION_STRINGS += KDIR=$(KDIR)
229 VERSION_STRINGS += OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=$(OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB)
230 VERSION_STRINGS += USING_UMP=$(CONFIG_MALI400_UMP)
231 VERSION_STRINGS += USING_PROFILING=$(CONFIG_MALI400_PROFILING)
232 VERSION_STRINGS += USING_INTERNAL_PROFILING=$(CONFIG_MALI400_INTERNAL_PROFILING)
233 VERSION_STRINGS += USING_GPU_UTILIZATION=$(USING_GPU_UTILIZATION)
234 VERSION_STRINGS += USING_POWER_PERFORMANCE_POLICY=$(CONFIG_POWER_PERFORMANCE_POLICY)
235 VERSION_STRINGS += MALI_UPPER_HALF_SCHEDULING=$(MALI_UPPER_HALF_SCHEDULING)
236
237 # Create file with Mali driver configuration
238 $(src)/__malidrv_build_info.c:
239         @echo 'const char *__malidrv_build_info(void) { return "malidrv: $(VERSION_STRINGS)";}' > $(src)/__malidrv_build_info.c