From 806dbdf6fb12b9e65d896d1e6d3888390cb67acb Mon Sep 17 00:00:00 2001 From: vasukis Date: Fri, 29 Sep 2023 15:12:21 +0000 Subject: [PATCH] tegra: hwpm: Macros to indicate presence of IP fd Add macros to indicate if IP debug fd is present or not. This is used in HWPM resource manager to communicate with IPs during register operations. Jira THWPM-105 Change-Id: I24a11e8e563b9d1ad8aaa560fb507468819f06dc Signed-off-by: vasukis (cherry picked from commit 0a1317656fb3a8e126d29cef2c01da58feafcb41) Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2991333 Tested-by: mobile promotions Reviewed-by: mobile promotions --- .../hwpm/hal/t234/ip/display/t234_display.c | 2 +- drivers/tegra/hwpm/hal/t234/ip/isp/t234_isp.c | 2 +- .../tegra/hwpm/hal/t234/ip/mgbe/t234_mgbe.c | 2 +- .../t234/ip/mss_channel/t234_mss_channel.c | 2 +- .../t234/ip/mss_gpu_hub/t234_mss_gpu_hub.c | 2 +- .../t234_mss_iso_niso_hubs.c | 2 +- .../hwpm/hal/t234/ip/mss_mcf/t234_mss_mcf.c | 2 +- .../tegra/hwpm/hal/t234/ip/nvdec/t234_nvdec.c | 2 +- .../tegra/hwpm/hal/t234/ip/nvdla/t234_nvdla.c | 4 ++-- .../tegra/hwpm/hal/t234/ip/nvenc/t234_nvenc.c | 2 +- drivers/tegra/hwpm/hal/t234/ip/ofa/t234_ofa.c | 2 +- .../tegra/hwpm/hal/t234/ip/pcie/t234_pcie.c | 22 +++++++++---------- drivers/tegra/hwpm/hal/t234/ip/pma/t234_pma.c | 2 +- drivers/tegra/hwpm/hal/t234/ip/pva/t234_pva.c | 2 +- drivers/tegra/hwpm/hal/t234/ip/rtr/t234_rtr.c | 4 ++-- drivers/tegra/hwpm/hal/t234/ip/scf/t234_scf.c | 2 +- drivers/tegra/hwpm/hal/t234/ip/vi/t234_vi.c | 4 ++-- drivers/tegra/hwpm/hal/t234/ip/vic/t234_vic.c | 2 +- drivers/tegra/hwpm/include/tegra_hwpm.h | 4 ++++ 19 files changed, 35 insertions(+), 31 deletions(-) diff --git a/drivers/tegra/hwpm/hal/t234/ip/display/t234_display.c b/drivers/tegra/hwpm/hal/t234/ip/display/t234_display.c index 742e05b..6c9556b 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/display/t234_display.c +++ b/drivers/tegra/hwpm/hal/t234/ip/display/t234_display.c @@ -129,7 +129,7 @@ static struct hwpm_ip_inst t234_display_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0U, diff --git a/drivers/tegra/hwpm/hal/t234/ip/isp/t234_isp.c b/drivers/tegra/hwpm/hal/t234/ip/isp/t234_isp.c index 615fde1..6241a65 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/isp/t234_isp.c +++ b/drivers/tegra/hwpm/hal/t234/ip/isp/t234_isp.c @@ -127,7 +127,7 @@ static struct hwpm_ip_inst t234_isp_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0U, diff --git a/drivers/tegra/hwpm/hal/t234/ip/mgbe/t234_mgbe.c b/drivers/tegra/hwpm/hal/t234/ip/mgbe/t234_mgbe.c index d2b0941..146870d 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/mgbe/t234_mgbe.c +++ b/drivers/tegra/hwpm/hal/t234/ip/mgbe/t234_mgbe.c @@ -244,7 +244,7 @@ static struct hwpm_ip_inst t234_mgbe_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0U, diff --git a/drivers/tegra/hwpm/hal/t234/ip/mss_channel/t234_mss_channel.c b/drivers/tegra/hwpm/hal/t234/ip/mss_channel/t234_mss_channel.c index b073125..f67e5e3 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/mss_channel/t234_mss_channel.c +++ b/drivers/tegra/hwpm/hal/t234/ip/mss_channel/t234_mss_channel.c @@ -614,7 +614,7 @@ static struct hwpm_ip_inst t234_mss_channel_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0U, diff --git a/drivers/tegra/hwpm/hal/t234/ip/mss_gpu_hub/t234_mss_gpu_hub.c b/drivers/tegra/hwpm/hal/t234/ip/mss_gpu_hub/t234_mss_gpu_hub.c index f5b6e21..b2a99bd 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/mss_gpu_hub/t234_mss_gpu_hub.c +++ b/drivers/tegra/hwpm/hal/t234/ip/mss_gpu_hub/t234_mss_gpu_hub.c @@ -232,7 +232,7 @@ static struct hwpm_ip_inst t234_mss_gpu_hub_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0U, diff --git a/drivers/tegra/hwpm/hal/t234/ip/mss_iso_niso_hubs/t234_mss_iso_niso_hubs.c b/drivers/tegra/hwpm/hal/t234/ip/mss_iso_niso_hubs/t234_mss_iso_niso_hubs.c index 77ba049..68598e5 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/mss_iso_niso_hubs/t234_mss_iso_niso_hubs.c +++ b/drivers/tegra/hwpm/hal/t234/ip/mss_iso_niso_hubs/t234_mss_iso_niso_hubs.c @@ -293,7 +293,7 @@ static struct hwpm_ip_inst t234_mss_iso_niso_hub_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0U, diff --git a/drivers/tegra/hwpm/hal/t234/ip/mss_mcf/t234_mss_mcf.c b/drivers/tegra/hwpm/hal/t234/ip/mss_mcf/t234_mss_mcf.c index df78df9..76657b3 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/mss_mcf/t234_mss_mcf.c +++ b/drivers/tegra/hwpm/hal/t234/ip/mss_mcf/t234_mss_mcf.c @@ -286,7 +286,7 @@ static struct hwpm_ip_inst t234_mss_mcf_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0U, diff --git a/drivers/tegra/hwpm/hal/t234/ip/nvdec/t234_nvdec.c b/drivers/tegra/hwpm/hal/t234/ip/nvdec/t234_nvdec.c index cb0a1fb..718d7d8 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/nvdec/t234_nvdec.c +++ b/drivers/tegra/hwpm/hal/t234/ip/nvdec/t234_nvdec.c @@ -127,7 +127,7 @@ static struct hwpm_ip_inst t234_nvdec_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0U, diff --git a/drivers/tegra/hwpm/hal/t234/ip/nvdla/t234_nvdla.c b/drivers/tegra/hwpm/hal/t234/ip/nvdla/t234_nvdla.c index e8bbe6d..21b7b24 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/nvdla/t234_nvdla.c +++ b/drivers/tegra/hwpm/hal/t234/ip/nvdla/t234_nvdla.c @@ -166,7 +166,7 @@ static struct hwpm_ip_inst t234_nvdla_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = 1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_VALID, }, .element_fs_mask = 0U, @@ -229,7 +229,7 @@ static struct hwpm_ip_inst t234_nvdla_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = 1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_VALID, }, .element_fs_mask = 0U, diff --git a/drivers/tegra/hwpm/hal/t234/ip/nvenc/t234_nvenc.c b/drivers/tegra/hwpm/hal/t234/ip/nvenc/t234_nvenc.c index 4106dc7..fdf27c3 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/nvenc/t234_nvenc.c +++ b/drivers/tegra/hwpm/hal/t234/ip/nvenc/t234_nvenc.c @@ -127,7 +127,7 @@ static struct hwpm_ip_inst t234_nvenc_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = 1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_VALID, }, .element_fs_mask = 0U, diff --git a/drivers/tegra/hwpm/hal/t234/ip/ofa/t234_ofa.c b/drivers/tegra/hwpm/hal/t234/ip/ofa/t234_ofa.c index 8bec0fa..eaf6dcb 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/ofa/t234_ofa.c +++ b/drivers/tegra/hwpm/hal/t234/ip/ofa/t234_ofa.c @@ -127,7 +127,7 @@ static struct hwpm_ip_inst t234_ofa_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = 1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_VALID, }, .element_fs_mask = 0U, diff --git a/drivers/tegra/hwpm/hal/t234/ip/pcie/t234_pcie.c b/drivers/tegra/hwpm/hal/t234/ip/pcie/t234_pcie.c index c895e03..df0788a 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/pcie/t234_pcie.c +++ b/drivers/tegra/hwpm/hal/t234/ip/pcie/t234_pcie.c @@ -517,7 +517,7 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0U, @@ -580,7 +580,7 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0U, @@ -643,7 +643,7 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0U, @@ -706,7 +706,7 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0U, @@ -769,7 +769,7 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0U, @@ -832,7 +832,7 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0U, @@ -895,7 +895,7 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0U, @@ -958,7 +958,7 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0U, @@ -1021,7 +1021,7 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0U, @@ -1084,7 +1084,7 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0U, @@ -1147,7 +1147,7 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0U, diff --git a/drivers/tegra/hwpm/hal/t234/ip/pma/t234_pma.c b/drivers/tegra/hwpm/hal/t234/ip/pma/t234_pma.c index ef71ef2..d2457e5 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/pma/t234_pma.c +++ b/drivers/tegra/hwpm/hal/t234/ip/pma/t234_pma.c @@ -128,7 +128,7 @@ static struct hwpm_ip_inst t234_pma_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0x1U, diff --git a/drivers/tegra/hwpm/hal/t234/ip/pva/t234_pva.c b/drivers/tegra/hwpm/hal/t234/ip/pva/t234_pva.c index b691494..373e60a 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/pva/t234_pva.c +++ b/drivers/tegra/hwpm/hal/t234/ip/pva/t234_pva.c @@ -159,7 +159,7 @@ static struct hwpm_ip_inst t234_pva_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = 1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_VALID, }, .element_fs_mask = 0U, diff --git a/drivers/tegra/hwpm/hal/t234/ip/rtr/t234_rtr.c b/drivers/tegra/hwpm/hal/t234/ip/rtr/t234_rtr.c index c5c175a..1c9a50f 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/rtr/t234_rtr.c +++ b/drivers/tegra/hwpm/hal/t234/ip/rtr/t234_rtr.c @@ -129,7 +129,7 @@ static struct hwpm_ip_inst t234_rtr_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0x1U, @@ -191,7 +191,7 @@ static struct hwpm_ip_inst t234_rtr_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0x1U, diff --git a/drivers/tegra/hwpm/hal/t234/ip/scf/t234_scf.c b/drivers/tegra/hwpm/hal/t234/ip/scf/t234_scf.c index d809d55..ce8fa32 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/scf/t234_scf.c +++ b/drivers/tegra/hwpm/hal/t234/ip/scf/t234_scf.c @@ -106,7 +106,7 @@ static struct hwpm_ip_inst t234_scf_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0x1U, diff --git a/drivers/tegra/hwpm/hal/t234/ip/vi/t234_vi.c b/drivers/tegra/hwpm/hal/t234/ip/vi/t234_vi.c index a36b36c..cdadf78 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/vi/t234_vi.c +++ b/drivers/tegra/hwpm/hal/t234/ip/vi/t234_vi.c @@ -167,7 +167,7 @@ static struct hwpm_ip_inst t234_vi_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0U, @@ -230,7 +230,7 @@ static struct hwpm_ip_inst t234_vi_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = -1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_INVALID, }, .element_fs_mask = 0U, diff --git a/drivers/tegra/hwpm/hal/t234/ip/vic/t234_vic.c b/drivers/tegra/hwpm/hal/t234/ip/vic/t234_vic.c index 1a27aa5..e6fc5d2 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/vic/t234_vic.c +++ b/drivers/tegra/hwpm/hal/t234/ip/vic/t234_vic.c @@ -127,7 +127,7 @@ static struct hwpm_ip_inst t234_vic_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, - .fd = 1, + .fd = TEGRA_HWPM_IP_DEBUG_FD_VALID, }, .element_fs_mask = 0U, diff --git a/drivers/tegra/hwpm/include/tegra_hwpm.h b/drivers/tegra/hwpm/include/tegra_hwpm.h index 7874a50..68f8474 100644 --- a/drivers/tegra/hwpm/include/tegra_hwpm.h +++ b/drivers/tegra/hwpm/include/tegra_hwpm.h @@ -40,6 +40,10 @@ #define TEGRA_HWPM_FUSE_SECURITY_MODE_MASK BIT(1) #define TEGRA_HWPM_FUSE_HWPM_GLOBAL_DISABLE_MASK BIT(2) +/* Indicate the prescence of HWPM-IP debug interface for devctl calls */ +#define TEGRA_HWPM_IP_DEBUG_FD_INVALID -1 +#define TEGRA_HWPM_IP_DEBUG_FD_VALID 1U + #ifdef __KERNEL__ struct tegra_hwpm_os_linux; #else