tizen 2.4 release
[kernel/linux-3.0.git] / drivers / gpu / arm / mali400 / mali / Kbuild
1 #
2 # Copyright (C) 2011-2012 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_SEC 
24 # Include the mapping between TARGET_PLATFORM and KDIR + MALI_PLATFORM
25 TARGET_PLATFORM=exynos4
26 include $(srctree)/$(src)/MALI_CONFIGURATION
27 MALI_PLATFORM = $(MALI_PLATFORM-$(TARGET_PLATFORM))
28 MALI_PLATFORM_FILES = $(subst $(srctree)/$(src)/,,$(wildcard $(srctree)/$(src)/platform/$(MALI_PLATFORM)/*.c))
29
30 # For customer releases the Linux Device Drivers will be provided as ARM proprietary and GPL releases:
31 # The ARM proprietary product will only include the license/proprietary directory
32 # The GPL product will only include the license/gpl directory
33 ifeq ($(wildcard $(srctree)/$(src)/linux/license/gpl/*),)
34     ccflags-y += -I$(srctree)/$(src)/linux/license/proprietary
35     ifeq ($(CONFIG_MALI400_PROFILING),y)
36         $(error Profiling is incompatible with non-GPL license)
37     endif
38     ifeq ($(CONFIG_PM_RUNTIME),y)
39         $(error Runtime PM is incompatible with non-GPL license)
40     endif
41     ifeq ($(CONFIG_DMA_SHARED_BUFFER),y)
42         $(error DMA-BUF is incompatible with non-GPL license)
43     endif
44     $(error Linux Device integration is incompatible with non-GPL license)
45 else
46     ccflags-y += -I$(srctree)/$(src)/linux/license/gpl
47 endif
48
49 mali-y += \
50         linux/mali_osk_atomics.o \
51         linux/mali_osk_irq.o \
52         linux/mali_osk_wq.o \
53         linux/mali_osk_locks.o \
54         linux/mali_osk_wait_queue.o \
55         linux/mali_osk_low_level_mem.o \
56         linux/mali_osk_math.o \
57         linux/mali_osk_memory.o \
58         linux/mali_osk_misc.o \
59         linux/mali_osk_mali.o \
60         linux/mali_osk_notification.o \
61         linux/mali_osk_time.o \
62         linux/mali_osk_timers.o
63
64 mali-y += \
65         linux/mali_ukk_mem.o \
66         linux/mali_ukk_gp.o \
67         linux/mali_ukk_pp.o \
68         linux/mali_ukk_core.o
69
70 # Source files which always are included in a build
71 mali-y += \
72         common/mali_kernel_core.o \
73         linux/mali_kernel_linux.o \
74         common/mali_kernel_descriptor_mapping.o \
75         common/mali_session.o \
76         common/mali_device_pause_resume.o \
77         common/mali_kernel_vsync.o \
78         linux/mali_ukk_vsync.o \
79         linux/mali_kernel_sysfs.o \
80         common/mali_mmu.o \
81         common/mali_mmu_page_directory.o \
82         common/mali_memory.o \
83         common/mali_kernel_memory_engine.o \
84         common/mali_block_allocator.o \
85         common/mali_kernel_mem_os.o \
86         common/mali_mem_validation.o \
87         common/mali_hw_core.o \
88         common/mali_gp.o \
89         common/mali_pp.o \
90         common/mali_pp_job.o \
91         common/mali_gp_job.o \
92         common/mali_scheduler.o \
93         common/mali_gp_scheduler.o \
94         common/mali_pp_scheduler.o \
95         common/mali_group.o \
96         common/mali_dlbu.o \
97         common/mali_broadcast.o \
98         common/mali_pm.o \
99         common/mali_pmu.o \
100         common/mali_user_settings_db.o \
101         common/mali_kernel_utilization.o \
102         common/mali_l2_cache.o \
103         linux/mali_osk_pm.o \
104         linux/mali_pmu_power_up_down.o \
105         __malidrv_build_info.o
106
107 ifneq ($(MALI_PLATFORM_FILES),)
108         mali-y += $(MALI_PLATFORM_FILES:.c=.o)
109 endif
110
111 mali-$(CONFIG_MALI400_PROFILING) += linux/mali_ukk_profiling.o
112 mali-$(CONFIG_MALI400_PROFILING) += linux/mali_osk_profiling.o
113
114 mali-$(CONFIG_MALI400_INTERNAL_PROFILING) += linux/mali_profiling_internal.o timestamp-$(TIMESTAMP)/mali_timestamp.o
115 ccflags-$(CONFIG_MALI400_INTERNAL_PROFILING) += -I$(srctree)/$(src)/timestamp-$(TIMESTAMP)
116
117 mali-$(CONFIG_DMA_SHARED_BUFFER) += linux/mali_dma_buf.o
118 mali-$(CONFIG_SYNC) += linux/mali_sync.o linux/mali_sync_user.o
119
120 # Tell the Linux build system from which .o file to create the kernel module
121 obj-$(CONFIG_MALI400) := mali.o
122
123 ccflags-y += $(EXTRA_DEFINES)
124
125 # Set up our defines, which will be passed to gcc
126 ccflags-y += -DPROFILING_SKIP_PP_JOBS=$(PROFILING_SKIP_PP_JOBS)
127 ccflags-y += -DPROFILING_SKIP_PP_AND_GP_JOBS=$(PROFILING_SKIP_PP_AND_GP_JOBS)
128
129 ccflags-y += -DMALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP=$(MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP)
130 ccflags-y += -DMALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED=$(MALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED)
131 ccflags-y += -DMALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS=$(MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS)
132 ccflags-y += -DMALI_STATE_TRACKING=1
133 ccflags-y += -DMALI_OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=$(OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB)
134 ccflags-y += -DUSING_GPU_UTILIZATION=$(USING_GPU_UTILIZATION)
135
136 ifeq ($(MALI_UPPER_HALF_SCHEDULING),1)
137         ccflags-y += -DMALI_UPPER_HALF_SCHEDULING
138 endif
139
140 ccflags-$(CONFIG_MALI400_UMP) += -I$(srctree)/$(src)/../../ump/include/ump
141 ccflags-$(CONFIG_MALI400_DEBUG) += -DDEBUG
142
143 # Use our defines when compiling
144 ccflags-y += -I$(srctree)/$(src) -I$(srctree)/$(src)/include -I$(srctree)/$(src)/common -I$(srctree)/$(src)/linux -I$(srctree)/$(src)/platform
145 # MALI_SEC 
146 ccflags-y += -I$(srctree)/$(src)/../ump/include
147
148 # Get subversion revision number, fall back to only ${MALI_RELEASE_NAME} if no svn info is available
149 MALI_RELEASE_NAME=$(shell cat $(srctree)/$(src)/.version 2> /dev/null)
150
151 SVN_INFO = (cd $(src); (svn info || git svn info || \
152         echo -e "\nURL: $(MALI_RELEASE_NAME)\n" \
153         "Last Changed Rev: $(MALI_RELEASE_NAME)\n" \
154         "Last Changed Date: $(MALI_RELEASE_NAME)") 2>/dev/null)
155
156 SVN_REV := $(shell (cd $(src); echo "$(SVN_INFO)" | grep '^Revision: '| sed -e 's/^Revision: //' ) 2>/dev/null )
157 ifeq ($(SVN_REV),)
158 SVN_REV := $(MALI_RELEASE_NAME)
159 else
160 SVN_REV := $(MALI_RELEASE_NAME)-r$(SVN_REV)
161 endif
162
163 ccflags-y += -DSVN_REV_STRING=\"$(SVN_REV)\"
164
165 VERSION_STRINGS :=
166 VERSION_STRINGS += API_VERSION=$(shell cd $(srctree)/$(src); grep "\#define _MALI_API_VERSION" $(FILES_PREFIX)include/linux/mali/mali_utgard_uk_types.h | cut -d' ' -f 3 )
167 VERSION_STRINGS += REPO_URL=$(shell $(SVN_INFO) | grep '^URL: ' | cut -d: -f2- | cut -b2-)
168 VERSION_STRINGS += REVISION=$(SVN_REV)
169 VERSION_STRINGS += CHANGED_REVISION=$(shell $(SVN_INFO) | grep '^Last Changed Rev: ' | cut -d: -f2- | cut -b2-)
170 VERSION_STRINGS += CHANGE_DATE=$(shell $(SVN_INFO) | grep '^Last Changed Date: ' | cut -d: -f2- | cut -b2-)
171 VERSION_STRINGS += BUILD_DATE=$(shell date)
172 ifdef CONFIG_MALI400_DEBUG
173 VERSION_STRINGS += BUILD=debug
174 else
175 VERSION_STRINGS += BUILD=release
176 endif
177 VERSION_STRINGS += TARGET_PLATFORM=$(TARGET_PLATFORM)
178 VERSION_STRINGS += MALI_PLATFORM=$(MALI_PLATFORM)
179 VERSION_STRINGS += KDIR=$(KDIR)
180 VERSION_STRINGS += OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=$(OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB)
181 VERSION_STRINGS += USING_UMP=$(CONFIG_MALI400_UMP)
182 VERSION_STRINGS += USING_PROFILING=$(CONFIG_MALI400_PROFILING)
183 VERSION_STRINGS += USING_INTERNAL_PROFILING=$(CONFIG_MALI400_INTERNAL_PROFILING)
184 VERSION_STRINGS += USING_GPU_UTILIZATION=$(USING_GPU_UTILIZATION)
185 VERSION_STRINGS += MALI_UPPER_HALF_SCHEDULING=$(MALI_UPPER_HALF_SCHEDULING)
186
187 # Create file with Mali driver configuration
188 $(src)/__malidrv_build_info.c:
189         @echo 'const char *__malidrv_build_info(void) { return "malidrv: $(VERSION_STRINGS)";}' > $(src)/__malidrv_build_info.c