PCI: tegra264: Fix RP off support

We cannot use enum definitions in '#if defined()' statements because the
'#if defined()' is a preprocessor macro that is evaluated prior to
compilation. Fix this by adding a test to conftest to detect if
CMD_PCIE_RP_CONTROLLER_OFF is defined.

Bug 5551652

Change-Id: I71826a58e428f1a335e8e0d895f25f3cea46a65e
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3467641
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Prakhar Srivastava (SW-TEGRA) <prasrivastav@nvidia.com>
This commit is contained in:
Jon Hunter
2025-10-10 14:13:51 +01:00
committed by mobile promotions
parent 9ee2b01686
commit 0242b95056
3 changed files with 19 additions and 1 deletions

View File

@@ -112,6 +112,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += class_attribute_struct_has_const_struct_cl
NV_CONFTEST_FUNCTION_COMPILE_TESTS += class_create_has_no_owner_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += class_struct_devnode_has_const_dev_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += clk_hw_determine_rate_no_reparent
NV_CONFTEST_FUNCTION_COMPILE_TESTS += cmd_pcie_rp_controller_off_enum_present
NV_CONFTEST_FUNCTION_COMPILE_TESTS += cyclecounter_struct_read_has_const_cyclecounter_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += define_semaphore_has_number_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += devfreq_dev_profile_has_is_cooling_device

View File

@@ -6945,6 +6945,23 @@ compile_test() {
compile_check_conftest "$CODE" "NV_CLK_HW_DETERMINE_RATE_NO_REPARENT_PRESENT" "" "functions"
;;
cmd_pcie_rp_controller_off_enum_present)
#
# Determine if the enum mrq_pcie_cmd defines the values
# CMD_PCIE_RP_CONTROLLER_OFF.
#
# This is only defined in NVIDIA kernels at the moment.
#
CODE="
#include <linux/types.h>
#include <soc/tegra/bpmp-abi.h>
int conftest_cmd_pcie_rp_controller_off_enum_present(void) {
return CMD_PCIE_RP_CONTROLLER_OFF;
}"
compile_check_conftest "$CODE" "NV_CMD_PCIE_RP_CONTROLLER_OFF_ENUM_PRESENT" "" "types"
;;
cyclecounter_struct_read_has_const_cyclecounter_arg)
#
# Determine if the 'cyclecounter' structure 'read' function pointer