1*4882a593Smuzhiyun# 2*4882a593Smuzhiyun# Copyright (C) 2010-2011 ARM Limited. All rights reserved. 3*4882a593Smuzhiyun# 4*4882a593Smuzhiyun# This program is free software and is provided to you under the terms of the GNU General Public License version 2 5*4882a593Smuzhiyun# 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*4882a593Smuzhiyun# 7*4882a593Smuzhiyun# A copy of the licence is included with the program, and can also be obtained from Free Software 8*4882a593Smuzhiyun# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 9*4882a593Smuzhiyun# 10*4882a593Smuzhiyun 11*4882a593Smuzhiyun# This file is called by the Linux build system. 12*4882a593Smuzhiyun 13*4882a593Smuzhiyun# make $(src) as absolute path if it isn't already, by prefixing $(srctree) 14*4882a593Smuzhiyunsrc:=$(if $(patsubst /%,,$(src)),$(srctree)/$(src),$(src)) 15*4882a593Smuzhiyun 16*4882a593Smuzhiyun# set up defaults if not defined by the user 17*4882a593SmuzhiyunTIMESTAMP ?= default 18*4882a593SmuzhiyunOS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB ?= 16 19*4882a593SmuzhiyunUSING_GPU_UTILIZATION ?= 1 20*4882a593SmuzhiyunPROFILING_SKIP_PP_JOBS ?= 0 21*4882a593SmuzhiyunPROFILING_SKIP_PP_AND_GP_JOBS ?= 0 22*4882a593SmuzhiyunMALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP ?= 0 23*4882a593SmuzhiyunMALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED ?= 0 24*4882a593SmuzhiyunMALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS ?= 0 25*4882a593SmuzhiyunMALI_UPPER_HALF_SCHEDULING ?= 1 26*4882a593SmuzhiyunMALI_ENABLE_CPU_CYCLES ?= 0 27*4882a593SmuzhiyunMALI_PLATFORM ?= rk 28*4882a593Smuzhiyun 29*4882a593Smuzhiyun# For customer releases the Linux Device Drivers will be provided as ARM proprietary and GPL releases: 30*4882a593Smuzhiyun# The ARM proprietary product will only include the license/proprietary directory 31*4882a593Smuzhiyun# The GPL product will only include the license/gpl directory 32*4882a593Smuzhiyunccflags-y += -I$(src)/linux/license/gpl 33*4882a593Smuzhiyun 34*4882a593Smuzhiyun 35*4882a593Smuzhiyunifeq ($(USING_GPU_UTILIZATION), 1) 36*4882a593Smuzhiyun ifeq ($(USING_DVFS), 1) 37*4882a593Smuzhiyun $(error USING_GPU_UTILIZATION conflict with USING_DVFS you can read the Integration Guide to choose which one do you need) 38*4882a593Smuzhiyun endif 39*4882a593Smuzhiyunendif 40*4882a593Smuzhiyun 41*4882a593Smuzhiyunifneq ($(MALI_PLATFORM),) 42*4882a593Smuzhiyun EXTRA_DEFINES += -DMALI_FAKE_PLATFORM_DEVICE=1 43*4882a593Smuzhiyun #MALI_PLATFORM_FILES = $(wildcard platform/$(MALI_PLATFORM)/*.c) 44*4882a593Smuzhiyun mali-y += \ 45*4882a593Smuzhiyun platform/$(MALI_PLATFORM)/rk.o 46*4882a593Smuzhiyunendif 47*4882a593Smuzhiyun 48*4882a593Smuzhiyunifeq ($(MALI_PLATFORM_FILES),) 49*4882a593Smuzhiyunifeq ($(CONFIG_ARCH_EXYNOS4),y) 50*4882a593SmuzhiyunEXTRA_DEFINES += -DMALI_FAKE_PLATFORM_DEVICE=1 51*4882a593Smuzhiyunexport MALI_PLATFORM=exynos4 52*4882a593Smuzhiyunexport MALI_PLATFORM_FILES_BUILDIN = $(notdir $(wildcard $(src)/platform/$(MALI_PLATFORM)/*.c)) 53*4882a593Smuzhiyunexport MALI_PLATFORM_FILES_ADD_PREFIX = $(addprefix platform/$(MALI_PLATFORM)/,$(MALI_PLATFORM_FILES_BUILDIN)) 54*4882a593Smuzhiyunendif 55*4882a593Smuzhiyunendif 56*4882a593Smuzhiyun 57*4882a593Smuzhiyunmali-y += \ 58*4882a593Smuzhiyun linux/mali_osk_atomics.o \ 59*4882a593Smuzhiyun linux/mali_osk_irq.o \ 60*4882a593Smuzhiyun linux/mali_osk_wq.o \ 61*4882a593Smuzhiyun linux/mali_osk_locks.o \ 62*4882a593Smuzhiyun linux/mali_osk_wait_queue.o \ 63*4882a593Smuzhiyun linux/mali_osk_low_level_mem.o \ 64*4882a593Smuzhiyun linux/mali_osk_math.o \ 65*4882a593Smuzhiyun linux/mali_osk_memory.o \ 66*4882a593Smuzhiyun linux/mali_osk_misc.o \ 67*4882a593Smuzhiyun linux/mali_osk_mali.o \ 68*4882a593Smuzhiyun linux/mali_osk_notification.o \ 69*4882a593Smuzhiyun linux/mali_osk_time.o \ 70*4882a593Smuzhiyun linux/mali_osk_timers.o \ 71*4882a593Smuzhiyun linux/mali_osk_bitmap.o 72*4882a593Smuzhiyun 73*4882a593Smuzhiyunmali-y += linux/mali_memory.o linux/mali_memory_os_alloc.o 74*4882a593Smuzhiyunmali-y += linux/mali_memory_external.o 75*4882a593Smuzhiyunmali-y += linux/mali_memory_block_alloc.o 76*4882a593Smuzhiyunmali-y += linux/mali_memory_swap_alloc.o 77*4882a593Smuzhiyun 78*4882a593Smuzhiyunmali-y += \ 79*4882a593Smuzhiyun linux/mali_memory_manager.o \ 80*4882a593Smuzhiyun linux/mali_memory_virtual.o \ 81*4882a593Smuzhiyun linux/mali_memory_util.o \ 82*4882a593Smuzhiyun linux/mali_memory_cow.o \ 83*4882a593Smuzhiyun linux/mali_memory_defer_bind.o 84*4882a593Smuzhiyun 85*4882a593Smuzhiyunmali-y += \ 86*4882a593Smuzhiyun linux/mali_ukk_mem.o \ 87*4882a593Smuzhiyun linux/mali_ukk_gp.o \ 88*4882a593Smuzhiyun linux/mali_ukk_pp.o \ 89*4882a593Smuzhiyun linux/mali_ukk_core.o \ 90*4882a593Smuzhiyun linux/mali_ukk_soft_job.o \ 91*4882a593Smuzhiyun linux/mali_ukk_timeline.o 92*4882a593Smuzhiyun 93*4882a593Smuzhiyunmali-$(CONFIG_MALI_DEVFREQ) += \ 94*4882a593Smuzhiyun linux/mali_devfreq.o \ 95*4882a593Smuzhiyun common/mali_pm_metrics.o 96*4882a593Smuzhiyun 97*4882a593Smuzhiyun# Source files which always are included in a build 98*4882a593Smuzhiyunmali-y += \ 99*4882a593Smuzhiyun common/mali_kernel_core.o \ 100*4882a593Smuzhiyun linux/mali_kernel_linux.o \ 101*4882a593Smuzhiyun common/mali_session.o \ 102*4882a593Smuzhiyun linux/mali_device_pause_resume.o \ 103*4882a593Smuzhiyun common/mali_kernel_vsync.o \ 104*4882a593Smuzhiyun linux/mali_ukk_vsync.o \ 105*4882a593Smuzhiyun linux/mali_kernel_sysfs.o \ 106*4882a593Smuzhiyun common/mali_mmu.o \ 107*4882a593Smuzhiyun common/mali_mmu_page_directory.o \ 108*4882a593Smuzhiyun common/mali_mem_validation.o \ 109*4882a593Smuzhiyun common/mali_hw_core.o \ 110*4882a593Smuzhiyun common/mali_gp.o \ 111*4882a593Smuzhiyun common/mali_pp.o \ 112*4882a593Smuzhiyun common/mali_pp_job.o \ 113*4882a593Smuzhiyun common/mali_gp_job.o \ 114*4882a593Smuzhiyun common/mali_soft_job.o \ 115*4882a593Smuzhiyun common/mali_scheduler.o \ 116*4882a593Smuzhiyun common/mali_executor.o \ 117*4882a593Smuzhiyun common/mali_group.o \ 118*4882a593Smuzhiyun common/mali_dlbu.o \ 119*4882a593Smuzhiyun common/mali_broadcast.o \ 120*4882a593Smuzhiyun common/mali_pm.o \ 121*4882a593Smuzhiyun common/mali_pmu.o \ 122*4882a593Smuzhiyun common/mali_user_settings_db.o \ 123*4882a593Smuzhiyun common/mali_kernel_utilization.o \ 124*4882a593Smuzhiyun common/mali_control_timer.o \ 125*4882a593Smuzhiyun common/mali_l2_cache.o \ 126*4882a593Smuzhiyun common/mali_timeline.o \ 127*4882a593Smuzhiyun common/mali_timeline_fence_wait.o \ 128*4882a593Smuzhiyun common/mali_timeline_sync_fence.o \ 129*4882a593Smuzhiyun common/mali_spinlock_reentrant.o \ 130*4882a593Smuzhiyun common/mali_pm_domain.o \ 131*4882a593Smuzhiyun linux/mali_osk_pm.o \ 132*4882a593Smuzhiyun linux/mali_pmu_power_up_down.o \ 133*4882a593Smuzhiyun __malidrv_build_info.o 134*4882a593Smuzhiyun 135*4882a593Smuzhiyunifneq ($(wildcard $(src)/linux/mali_slp_global_lock.c),) 136*4882a593Smuzhiyun mali-y += linux/mali_slp_global_lock.o 137*4882a593Smuzhiyunendif 138*4882a593Smuzhiyun 139*4882a593Smuzhiyunifneq ($(MALI_PLATFORM_FILES),) 140*4882a593Smuzhiyun mali-y += $(MALI_PLATFORM_FILES:.c=.o) 141*4882a593Smuzhiyunendif 142*4882a593Smuzhiyun 143*4882a593Smuzhiyunifneq ($(MALI_PLATFORM_FILES_ADD_PREFIX),) 144*4882a593Smuzhiyun mali-y += $(MALI_PLATFORM_FILES_ADD_PREFIX:.c=.o) 145*4882a593Smuzhiyunendif 146*4882a593Smuzhiyun 147*4882a593Smuzhiyunmali-$(CONFIG_MALI400_PROFILING) += linux/mali_ukk_profiling.o 148*4882a593Smuzhiyunmali-$(CONFIG_MALI400_PROFILING) += linux/mali_osk_profiling.o 149*4882a593Smuzhiyun 150*4882a593Smuzhiyunmali-$(CONFIG_MALI400_INTERNAL_PROFILING) += linux/mali_profiling_internal.o timestamp-$(TIMESTAMP)/mali_timestamp.o 151*4882a593Smuzhiyunccflags-$(CONFIG_MALI400_INTERNAL_PROFILING) += -I$(src)/timestamp-$(TIMESTAMP) 152*4882a593Smuzhiyun 153*4882a593Smuzhiyunmali-$(CONFIG_DMA_SHARED_BUFFER) += linux/mali_memory_dma_buf.o 154*4882a593Smuzhiyunmali-$(CONFIG_DMA_SHARED_BUFFER) += linux/mali_memory_secure.o 155*4882a593Smuzhiyunmali-$(CONFIG_SYNC) += linux/mali_sync.o 156*4882a593Smuzhiyunmali-$(CONFIG_SYNC) += linux/mali_internal_sync.o 157*4882a593Smuzhiyunmali-$(CONFIG_SYNC_FILE) += linux/mali_sync.o 158*4882a593Smuzhiyunmali-$(CONFIG_SYNC_FILE) += linux/mali_internal_sync.o 159*4882a593Smuzhiyunmali-$(CONFIG_MALI_DMA_BUF_FENCE) += linux/mali_dma_fence.o 160*4882a593Smuzhiyunccflags-$(CONFIG_SYNC) += -Idrivers/staging/android 161*4882a593Smuzhiyunccflags-$(CONFIG_SYNC_FILE) += -Idrivers/staging/android 162*4882a593Smuzhiyun 163*4882a593Smuzhiyunmali-$(CONFIG_MALI400_UMP) += linux/mali_memory_ump.o 164*4882a593Smuzhiyun 165*4882a593Smuzhiyunmali-$(CONFIG_MALI_DVFS) += common/mali_dvfs_policy.o 166*4882a593Smuzhiyun 167*4882a593Smuzhiyun# Tell the Linux build system from which .o file to create the kernel module 168*4882a593Smuzhiyunobj-$(CONFIG_MALI400) := mali.o 169*4882a593Smuzhiyun 170*4882a593Smuzhiyunccflags-y += $(EXTRA_DEFINES) 171*4882a593Smuzhiyun 172*4882a593Smuzhiyun# Set up our defines, which will be passed to gcc 173*4882a593Smuzhiyunccflags-y += -DMALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP=$(MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP) 174*4882a593Smuzhiyunccflags-y += -DMALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED=$(MALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED) 175*4882a593Smuzhiyunccflags-y += -DMALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS=$(MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS) 176*4882a593Smuzhiyunccflags-y += -DMALI_STATE_TRACKING=1 177*4882a593Smuzhiyunccflags-y += -DMALI_OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=$(OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB) 178*4882a593Smuzhiyunccflags-y += -DUSING_GPU_UTILIZATION=$(USING_GPU_UTILIZATION) 179*4882a593Smuzhiyunccflags-y += -DMALI_ENABLE_CPU_CYCLES=$(MALI_ENABLE_CPU_CYCLES) 180*4882a593Smuzhiyun 181*4882a593Smuzhiyunifeq ($(MALI_UPPER_HALF_SCHEDULING),1) 182*4882a593Smuzhiyun ccflags-y += -DMALI_UPPER_HALF_SCHEDULING 183*4882a593Smuzhiyunendif 184*4882a593Smuzhiyun 185*4882a593Smuzhiyun#build-in include path is different 186*4882a593Smuzhiyunifeq ($(MALI_PLATFORM_FILES),) 187*4882a593Smuzhiyunccflags-$(CONFIG_MALI400_UMP) += -I$(src)/../ump/include/ 188*4882a593Smuzhiyunelse 189*4882a593Smuzhiyunccflags-$(CONFIG_MALI400_UMP) += -I$(src)/../../ump/include/ump 190*4882a593Smuzhiyunendif 191*4882a593Smuzhiyunccflags-$(CONFIG_MALI400_DEBUG) += -DDEBUG 192*4882a593Smuzhiyun 193*4882a593Smuzhiyun# Use our defines when compiling 194*4882a593Smuzhiyunccflags-y += -I$(src) -I$(src)/include -I$(src)/common -I$(src)/linux -I$(src)/platform -Wno-date-time 195*4882a593Smuzhiyun 196*4882a593Smuzhiyun# Get subversion revision number, fall back to only ${MALI_RELEASE_NAME} if no svn info is available 197*4882a593SmuzhiyunMALI_RELEASE_NAME=$(shell cat $(src)/.version 2> /dev/null) 198*4882a593Smuzhiyun 199*4882a593SmuzhiyunSVN_INFO = (cd $(src); svn info 2>/dev/null) 200*4882a593Smuzhiyun 201*4882a593Smuzhiyunifneq ($(shell $(SVN_INFO) 2>/dev/null),) 202*4882a593Smuzhiyun# SVN detected 203*4882a593SmuzhiyunSVN_REV := $(shell $(SVN_INFO) | grep '^Revision: '| sed -e 's/^Revision: //' 2>/dev/null) 204*4882a593SmuzhiyunDRIVER_REV := $(MALI_RELEASE_NAME)-r$(SVN_REV) 205*4882a593SmuzhiyunCHANGE_DATE := $(shell $(SVN_INFO) | grep '^Last Changed Date: ' | cut -d: -f2- | cut -b2-) 206*4882a593SmuzhiyunCHANGED_REVISION := $(shell $(SVN_INFO) | grep '^Last Changed Rev: ' | cut -d: -f2- | cut -b2-) 207*4882a593SmuzhiyunREPO_URL := $(shell $(SVN_INFO) | grep '^URL: ' | cut -d: -f2- | cut -b2-) 208*4882a593Smuzhiyun 209*4882a593Smuzhiyunelse # SVN 210*4882a593Smuzhiyun# GIT_REV := $(shell cd $(src); git describe --always 2>/dev/null) 211*4882a593Smuzhiyunifneq ($(GIT_REV),) 212*4882a593Smuzhiyun# Git detected 213*4882a593SmuzhiyunDRIVER_REV := $(MALI_RELEASE_NAME)-$(GIT_REV) 214*4882a593SmuzhiyunCHANGE_DATE := $(shell cd $(src); git log -1 --format="%ci") 215*4882a593SmuzhiyunCHANGED_REVISION := $(GIT_REV) 216*4882a593SmuzhiyunREPO_URL := $(shell cd $(src); git describe --all --always 2>/dev/null) 217*4882a593Smuzhiyun 218*4882a593Smuzhiyunelse # Git 219*4882a593Smuzhiyun# No Git or SVN detected 220*4882a593SmuzhiyunDRIVER_REV := $(MALI_RELEASE_NAME) 221*4882a593SmuzhiyunCHANGE_DATE := $(MALI_RELEASE_NAME) 222*4882a593SmuzhiyunCHANGED_REVISION := $(MALI_RELEASE_NAME) 223*4882a593Smuzhiyunendif 224*4882a593Smuzhiyunendif 225*4882a593Smuzhiyun 226*4882a593Smuzhiyunccflags-y += -DSVN_REV_STRING=\"$(DRIVER_REV)\" 227*4882a593Smuzhiyun 228*4882a593SmuzhiyunVERSION_STRINGS := 229*4882a593SmuzhiyunVERSION_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 ) 230*4882a593SmuzhiyunVERSION_STRINGS += REPO_URL=$(REPO_URL) 231*4882a593SmuzhiyunVERSION_STRINGS += REVISION=$(DRIVER_REV) 232*4882a593SmuzhiyunVERSION_STRINGS += CHANGED_REVISION=$(CHANGED_REVISION) 233*4882a593SmuzhiyunVERSION_STRINGS += CHANGE_DATE=$(CHANGE_DATE) 234*4882a593SmuzhiyunVERSION_STRINGS += BUILD_DATE=$(shell date) 235*4882a593Smuzhiyunifdef CONFIG_MALI400_DEBUG 236*4882a593SmuzhiyunVERSION_STRINGS += BUILD=debug 237*4882a593Smuzhiyunelse 238*4882a593SmuzhiyunVERSION_STRINGS += BUILD=release 239*4882a593Smuzhiyunendif 240*4882a593SmuzhiyunVERSION_STRINGS += TARGET_PLATFORM=$(TARGET_PLATFORM) 241*4882a593SmuzhiyunVERSION_STRINGS += MALI_PLATFORM=$(MALI_PLATFORM) 242*4882a593SmuzhiyunVERSION_STRINGS += KDIR=$(KDIR) 243*4882a593SmuzhiyunVERSION_STRINGS += OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=$(OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB) 244*4882a593SmuzhiyunVERSION_STRINGS += USING_UMP=$(CONFIG_MALI400_UMP) 245*4882a593SmuzhiyunVERSION_STRINGS += USING_PROFILING=$(CONFIG_MALI400_PROFILING) 246*4882a593SmuzhiyunVERSION_STRINGS += USING_INTERNAL_PROFILING=$(CONFIG_MALI400_INTERNAL_PROFILING) 247*4882a593SmuzhiyunVERSION_STRINGS += USING_GPU_UTILIZATION=$(USING_GPU_UTILIZATION) 248*4882a593SmuzhiyunVERSION_STRINGS += USING_DVFS=$(CONFIG_MALI_DVFS) 249*4882a593SmuzhiyunVERSION_STRINGS += USING_DMA_BUF_FENCE = $(CONFIG_MALI_DMA_BUF_FENCE) 250*4882a593SmuzhiyunVERSION_STRINGS += MALI_UPPER_HALF_SCHEDULING=$(MALI_UPPER_HALF_SCHEDULING) 251*4882a593Smuzhiyun 252*4882a593Smuzhiyun# Create file with Mali driver configuration 253*4882a593Smuzhiyun$(src)/__malidrv_build_info.c: 254*4882a593Smuzhiyun @echo 'const char *__malidrv_build_info(void) { return "malidrv: $(VERSION_STRINGS)";}' > $(src)/__malidrv_build_info.c 255