13d0407baSopenharmony_ci# SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note 23d0407baSopenharmony_ci# 33d0407baSopenharmony_ci# (C) COPYRIGHT 2010-2021 ARM Limited. All rights reserved. 43d0407baSopenharmony_ci# 53d0407baSopenharmony_ci# This program is free software and is provided to you under the terms of the 63d0407baSopenharmony_ci# GNU General Public License version 2 as published by the Free Software 73d0407baSopenharmony_ci# Foundation, and any use by you of this program is subject to the terms 83d0407baSopenharmony_ci# of such GNU license. 93d0407baSopenharmony_ci# 103d0407baSopenharmony_ci# This program is distributed in the hope that it will be useful, 113d0407baSopenharmony_ci# but WITHOUT ANY WARRANTY; without even the implied warranty of 123d0407baSopenharmony_ci# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 133d0407baSopenharmony_ci# GNU General Public License for more details. 143d0407baSopenharmony_ci# 153d0407baSopenharmony_ci# You should have received a copy of the GNU General Public License 163d0407baSopenharmony_ci# along with this program; if not, you can access it online at 173d0407baSopenharmony_ci# http://www.gnu.org/licenses/gpl-2.0.html. 183d0407baSopenharmony_ci# 193d0407baSopenharmony_ci# 203d0407baSopenharmony_ci 213d0407baSopenharmony_ciKERNEL_SRC ?= /lib/modules/$(shell uname -r)/build 223d0407baSopenharmony_ciKDIR ?= $(KERNEL_SRC) 233d0407baSopenharmony_ci 243d0407baSopenharmony_ciifeq ($(KDIR),) 253d0407baSopenharmony_ci $(error Must specify KDIR to point to the kernel to target)) 263d0407baSopenharmony_ciendif 273d0407baSopenharmony_ci 283d0407baSopenharmony_ci# 293d0407baSopenharmony_ci# Default configuration values 303d0407baSopenharmony_ci# 313d0407baSopenharmony_ci# Dependency resolution is done through statements as Kconfig 323d0407baSopenharmony_ci# is not supported for out-of-tree builds. 333d0407baSopenharmony_ci# 343d0407baSopenharmony_ci 353d0407baSopenharmony_ciCONFIG_MALI_BIFROST ?= m 363d0407baSopenharmony_ciifeq ($(CONFIG_MALI_BIFROST),m) 373d0407baSopenharmony_ci CONFIG_MALI_PLATFORM_NAME ?= "devicetree" 383d0407baSopenharmony_ci CONFIG_MALI_BIFROST_GATOR_SUPPORT ?= y 393d0407baSopenharmony_ci CONFIG_MALI_ARBITRATION ?= n 403d0407baSopenharmony_ci CONFIG_MALI_PARTITION_MANAGER ?= n 413d0407baSopenharmony_ci 423d0407baSopenharmony_ci ifeq ($(origin CONFIG_MALI_ABITER_MODULES), undefined) 433d0407baSopenharmony_ci CONFIG_MALI_ARBITER_MODULES := $(CONFIG_MALI_ARBITRATION) 443d0407baSopenharmony_ci endif 453d0407baSopenharmony_ci 463d0407baSopenharmony_ci ifeq ($(origin CONFIG_MALI_GPU_POWER_MODULES), undefined) 473d0407baSopenharmony_ci CONFIG_MALI_GPU_POWER_MODULES := $(CONFIG_MALI_ARBITRATION) 483d0407baSopenharmony_ci endif 493d0407baSopenharmony_ci 503d0407baSopenharmony_ci ifneq ($(CONFIG_MALI_BIFROST_NO_MALI),y) 513d0407baSopenharmony_ci # Prevent misuse when CONFIG_MALI_BIFROST_NO_MALI 523d0407baSopenharmony_ci CONFIG_MALI_REAL_HW ?= y 533d0407baSopenharmony_ci endif 543d0407baSopenharmony_ci 553d0407baSopenharmony_ci ifeq ($(CONFIG_MALI_BIFROST_DVFS),y) 563d0407baSopenharmony_ci # Prevent misuse when CONFIG_MALI_BIFROST_DVFS=y 573d0407baSopenharmony_ci CONFIG_MALI_BIFROST_DEVFREQ ?= n 583d0407baSopenharmony_ci else 593d0407baSopenharmony_ci CONFIG_MALI_BIFROST_DEVFREQ ?= y 603d0407baSopenharmony_ci endif 613d0407baSopenharmony_ci 623d0407baSopenharmony_ci ifeq ($(CONFIG_MALI_DMA_BUF_MAP_ON_DEMAND), y) 633d0407baSopenharmony_ci # Prevent misuse when CONFIG_MALI_DMA_BUF_MAP_ON_DEMAND=y 643d0407baSopenharmony_ci CONFIG_MALI_DMA_BUF_LEGACY_COMPAT = n 653d0407baSopenharmony_ci endif 663d0407baSopenharmony_ci 673d0407baSopenharmony_ci ifeq ($(CONFIG_XEN),y) 683d0407baSopenharmony_ci ifneq ($(CONFIG_MALI_ARBITRATION), n) 693d0407baSopenharmony_ci CONFIG_MALI_XEN ?= m 703d0407baSopenharmony_ci endif 713d0407baSopenharmony_ci endif 723d0407baSopenharmony_ci 733d0407baSopenharmony_ci # 743d0407baSopenharmony_ci # Expert/Debug/Test released configurations 753d0407baSopenharmony_ci # 763d0407baSopenharmony_ci ifeq ($(CONFIG_MALI_BIFROST_EXPERT), y) 773d0407baSopenharmony_ci ifeq ($(CONFIG_MALI_BIFROST_NO_MALI), y) 783d0407baSopenharmony_ci CONFIG_MALI_REAL_HW = n 793d0407baSopenharmony_ci else 803d0407baSopenharmony_ci # Prevent misuse when CONFIG_MALI_BIFROST_NO_MALI=n 813d0407baSopenharmony_ci CONFIG_MALI_REAL_HW = y 823d0407baSopenharmony_ci CONFIG_MALI_BIFROST_ERROR_INJECT = n 833d0407baSopenharmony_ci endif 843d0407baSopenharmony_ci 853d0407baSopenharmony_ci ifeq ($(CONFIG_MALI_HW_ERRATA_1485982_NOT_AFFECTED), y) 863d0407baSopenharmony_ci # Prevent misuse when CONFIG_MALI_HW_ERRATA_1485982_NOT_AFFECTED=y 873d0407baSopenharmony_ci CONFIG_MALI_HW_ERRATA_1485982_USE_CLOCK_ALTERNATIVE = n 883d0407baSopenharmony_ci endif 893d0407baSopenharmony_ci 903d0407baSopenharmony_ci ifeq ($(CONFIG_MALI_BIFROST_DEBUG), y) 913d0407baSopenharmony_ci CONFIG_MALI_BIFROST_ENABLE_TRACE ?= y 923d0407baSopenharmony_ci CONFIG_MALI_BIFROST_SYSTEM_TRACE ?= y 933d0407baSopenharmony_ci 943d0407baSopenharmony_ci ifeq ($(CONFIG_SYNC), y) 953d0407baSopenharmony_ci CONFIG_MALI_BIFROST_FENCE_DEBUG ?= y 963d0407baSopenharmony_ci else 973d0407baSopenharmony_ci ifeq ($(CONFIG_SYNC_FILE), y) 983d0407baSopenharmony_ci CONFIG_MALI_BIFROST_FENCE_DEBUG ?= y 993d0407baSopenharmony_ci else 1003d0407baSopenharmony_ci CONFIG_MALI_BIFROST_FENCE_DEBUG = n 1013d0407baSopenharmony_ci endif 1023d0407baSopenharmony_ci endif 1033d0407baSopenharmony_ci else 1043d0407baSopenharmony_ci # Prevent misuse when CONFIG_MALI_BIFROST_DEBUG=n 1053d0407baSopenharmony_ci CONFIG_MALI_BIFROST_ENABLE_TRACE = n 1063d0407baSopenharmony_ci CONFIG_MALI_BIFROST_SYSTEM_TRACE = n 1073d0407baSopenharmony_ci CONFIG_MALI_BIFROST_FENCE_DEBUG = n 1083d0407baSopenharmony_ci endif 1093d0407baSopenharmony_ci else 1103d0407baSopenharmony_ci # Prevent misuse when CONFIG_MALI_BIFROST_EXPERT=n 1113d0407baSopenharmony_ci CONFIG_MALI_CORESTACK = n 1123d0407baSopenharmony_ci CONFIG_MALI_2MB_ALLOC = n 1133d0407baSopenharmony_ci CONFIG_MALI_PWRSOFT_765 = n 1143d0407baSopenharmony_ci CONFIG_MALI_MEMORY_FULLY_BACKED = n 1153d0407baSopenharmony_ci CONFIG_MALI_JOB_DUMP = n 1163d0407baSopenharmony_ci CONFIG_MALI_BIFROST_NO_MALI = n 1173d0407baSopenharmony_ci CONFIG_MALI_REAL_HW = y 1183d0407baSopenharmony_ci CONFIG_MALI_BIFROST_ERROR_INJECT = n 1193d0407baSopenharmony_ci CONFIG_MALI_HW_ERRATA_1485982_NOT_AFFECTED = n 1203d0407baSopenharmony_ci CONFIG_MALI_HW_ERRATA_1485982_USE_CLOCK_ALTERNATIVE = n 1213d0407baSopenharmony_ci CONFIG_MALI_PRFCNT_SET_SELECT_VIA_DEBUG_FS = n 1223d0407baSopenharmony_ci CONFIG_MALI_BIFROST_DEBUG = n 1233d0407baSopenharmony_ci CONFIG_MALI_BIFROST_ENABLE_TRACE = n 1243d0407baSopenharmony_ci CONFIG_MALI_BIFROST_SYSTEM_TRACE = n 1253d0407baSopenharmony_ci CONFIG_MALI_BIFROST_FENCE_DEBUG = n 1263d0407baSopenharmony_ci endif 1273d0407baSopenharmony_ci 1283d0407baSopenharmony_ci ifeq ($(CONFIG_MALI_BIFROST_DEBUG), y) 1293d0407baSopenharmony_ci CONFIG_MALI_KUTF ?= y 1303d0407baSopenharmony_ci ifeq ($(CONFIG_MALI_KUTF), y) 1313d0407baSopenharmony_ci CONFIG_MALI_KUTF_IRQ_TEST ?= y 1323d0407baSopenharmony_ci CONFIG_MALI_KUTF_CLK_RATE_TRACE ?= y 1333d0407baSopenharmony_ci else 1343d0407baSopenharmony_ci # Prevent misuse when CONFIG_MALI_KUTF=n 1353d0407baSopenharmony_ci CONFIG_MALI_KUTF_IRQ_TEST = n 1363d0407baSopenharmony_ci CONFIG_MALI_KUTF_CLK_RATE_TRACE = n 1373d0407baSopenharmony_ci endif 1383d0407baSopenharmony_ci else 1393d0407baSopenharmony_ci # Prevent misuse when CONFIG_MALI_BIFROST_DEBUG=n 1403d0407baSopenharmony_ci CONFIG_MALI_KUTF = n 1413d0407baSopenharmony_ci CONFIG_MALI_KUTF_IRQ_TEST = n 1423d0407baSopenharmony_ci CONFIG_MALI_KUTF_CLK_RATE_TRACE = n 1433d0407baSopenharmony_ci endif 1443d0407baSopenharmony_cielse 1453d0407baSopenharmony_ci # Prevent misuse when CONFIG_MALI_BIFROST=n 1463d0407baSopenharmony_ci CONFIG_MALI_ARBITRATION = n 1473d0407baSopenharmony_ci CONFIG_MALI_ARBITER_MODULES = n 1483d0407baSopenharmony_ci CONFIG_MALI_GPU_POWER_MODULES = n 1493d0407baSopenharmony_ci CONFIG_MALI_KUTF = n 1503d0407baSopenharmony_ci CONFIG_MALI_KUTF_IRQ_TEST = n 1513d0407baSopenharmony_ci CONFIG_MALI_KUTF_CLK_RATE_TRACE = n 1523d0407baSopenharmony_ciendif 1533d0407baSopenharmony_ci 1543d0407baSopenharmony_ci# All Mali CONFIG should be listed here 1553d0407baSopenharmony_ciCONFIGS := \ 1563d0407baSopenharmony_ci CONFIG_MALI_BIFROST \ 1573d0407baSopenharmony_ci CONFIG_MALI_CSF_SUPPORT \ 1583d0407baSopenharmony_ci CONFIG_MALI_BIFROST_GATOR_SUPPORT \ 1593d0407baSopenharmony_ci CONFIG_MALI_BIFROST_DMA_FENCE \ 1603d0407baSopenharmony_ci CONFIG_MALI_ARBITER_SUPPORT \ 1613d0407baSopenharmony_ci CONFIG_MALI_ARBITRATION \ 1623d0407baSopenharmony_ci CONFIG_MALI_ARBITER_MODULES \ 1633d0407baSopenharmony_ci CONFIG_MALI_GPU_POWER_MODULES \ 1643d0407baSopenharmony_ci CONFIG_MALI_PARTITION_MANAGER \ 1653d0407baSopenharmony_ci CONFIG_MALI_REAL_HW \ 1663d0407baSopenharmony_ci CONFIG_MALI_GEM5_BUILD \ 1673d0407baSopenharmony_ci CONFIG_MALI_BIFROST_DEVFREQ \ 1683d0407baSopenharmony_ci CONFIG_MALI_BIFROST_DVFS \ 1693d0407baSopenharmony_ci CONFIG_MALI_DMA_BUF_MAP_ON_DEMAND \ 1703d0407baSopenharmony_ci CONFIG_MALI_DMA_BUF_LEGACY_COMPAT \ 1713d0407baSopenharmony_ci CONFIG_MALI_BIFROST_EXPERT \ 1723d0407baSopenharmony_ci CONFIG_MALI_CORESTACK \ 1733d0407baSopenharmony_ci CONFIG_MALI_2MB_ALLOC \ 1743d0407baSopenharmony_ci CONFIG_MALI_PWRSOFT_765 \ 1753d0407baSopenharmony_ci CONFIG_MALI_MEMORY_FULLY_BACKED \ 1763d0407baSopenharmony_ci CONFIG_MALI_JOB_DUMP \ 1773d0407baSopenharmony_ci CONFIG_MALI_BIFROST_NO_MALI \ 1783d0407baSopenharmony_ci CONFIG_MALI_BIFROST_ERROR_INJECT \ 1793d0407baSopenharmony_ci CONFIG_MALI_HW_ERRATA_1485982_NOT_AFFECTED \ 1803d0407baSopenharmony_ci CONFIG_MALI_HW_ERRATA_1485982_USE_CLOCK_ALTERNATIVE \ 1813d0407baSopenharmony_ci CONFIG_MALI_PRFCNT_SET_PRIMARY \ 1823d0407baSopenharmony_ci CONFIG_MALI_BIFROST_PRFCNT_SET_SECONDARY \ 1833d0407baSopenharmony_ci CONFIG_MALI_PRFCNT_SET_TERTIARY \ 1843d0407baSopenharmony_ci CONFIG_MALI_PRFCNT_SET_SELECT_VIA_DEBUG_FS \ 1853d0407baSopenharmony_ci CONFIG_MALI_BIFROST_DEBUG \ 1863d0407baSopenharmony_ci CONFIG_MALI_BIFROST_ENABLE_TRACE \ 1873d0407baSopenharmony_ci CONFIG_MALI_BIFROST_SYSTEM_TRACE \ 1883d0407baSopenharmony_ci CONFIG_MALI_BIFROST_FENCE_DEBUG \ 1893d0407baSopenharmony_ci CONFIG_MALI_KUTF \ 1903d0407baSopenharmony_ci CONFIG_MALI_KUTF_IRQ_TEST \ 1913d0407baSopenharmony_ci CONFIG_MALI_KUTF_CLK_RATE_TRACE \ 1923d0407baSopenharmony_ci CONFIG_MALI_XEN 1933d0407baSopenharmony_ci 1943d0407baSopenharmony_ci 1953d0407baSopenharmony_ci# 1963d0407baSopenharmony_ci# MAKE_ARGS to pass the custom CONFIGs on out-of-tree build 1973d0407baSopenharmony_ci# 1983d0407baSopenharmony_ci# Generate the list of CONFIGs and values. 1993d0407baSopenharmony_ci# $(value config) is the name of the CONFIG option. 2003d0407baSopenharmony_ci# $(value $(value config)) is its value (y, m). 2013d0407baSopenharmony_ci# When the CONFIG is not set to y or m, it defaults to n. 2023d0407baSopenharmony_ciMAKE_ARGS := $(foreach config,$(CONFIGS), \ 2033d0407baSopenharmony_ci $(if $(filter y m,$(value $(value config))), \ 2043d0407baSopenharmony_ci $(value config)=$(value $(value config)), \ 2053d0407baSopenharmony_ci $(value config)=n)) 2063d0407baSopenharmony_ci 2073d0407baSopenharmony_ciMAKE_ARGS += CONFIG_MALI_PLATFORM_NAME=$(CONFIG_MALI_PLATFORM_NAME) 2083d0407baSopenharmony_ci 2093d0407baSopenharmony_ci# 2103d0407baSopenharmony_ci# EXTRA_CFLAGS to define the custom CONFIGs on out-of-tree build 2113d0407baSopenharmony_ci# 2123d0407baSopenharmony_ci# Generate the list of CONFIGs defines with values from CONFIGS. 2133d0407baSopenharmony_ci# $(value config) is the name of the CONFIG option. 2143d0407baSopenharmony_ci# When set to y or m, the CONFIG gets defined to 1. 2153d0407baSopenharmony_ciEXTRA_CFLAGS := $(foreach config,$(CONFIGS), \ 2163d0407baSopenharmony_ci $(if $(filter y m,$(value $(value config))), \ 2173d0407baSopenharmony_ci -D$(value config)=1)) 2183d0407baSopenharmony_ci 2193d0407baSopenharmony_ciEXTRA_CFLAGS += -DCONFIG_MALI_PLATFORM_NAME=$(CONFIG_MALI_PLATFORM_NAME) 2203d0407baSopenharmony_ci 2213d0407baSopenharmony_ci# 2223d0407baSopenharmony_ci# KBUILD_EXTRA_SYMBOLS to prevent warnings about unknown functions 2233d0407baSopenharmony_ci# 2243d0407baSopenharmony_ci 2253d0407baSopenharmony_ciall: 2263d0407baSopenharmony_ci $(MAKE) -C $(KDIR) M=$(CURDIR) $(MAKE_ARGS) EXTRA_CFLAGS="$(EXTRA_CFLAGS)" KBUILD_EXTRA_SYMBOLS="$(EXTRA_SYMBOLS)" modules 2273d0407baSopenharmony_ci 2283d0407baSopenharmony_cimodules_install: 2293d0407baSopenharmony_ci $(MAKE) -C $(KDIR) M=$(CURDIR) $(MAKE_ARGS) modules_install 2303d0407baSopenharmony_ci 2313d0407baSopenharmony_ciclean: 2323d0407baSopenharmony_ci $(MAKE) -C $(KDIR) M=$(CURDIR) $(MAKE_ARGS) clean 233