diff --git a/common/tegra_hwpm_ip_utils.c b/common/tegra_hwpm_ip_utils.c index 1a69d4e..fce199e 100644 --- a/common/tegra_hwpm_ip_utils.c +++ b/common/tegra_hwpm_ip_utils.c @@ -201,7 +201,7 @@ static int tegra_hwpm_complete_ip_register(struct tegra_soc_hwpm *hwpm) while (node != NULL) { tegra_hwpm_dbg(hwpm, hwpm_info, "IP ext idx %d info", - node->ip_ops.ip_index); + node->ip_ops.resource_enum); ret = hwpm->active_chip->extract_ip_ops( hwpm, &node->ip_ops, true); if (ret != 0) { diff --git a/hal/t234/t234_hwpm_internal.h b/hal/t234/t234_hwpm_internal.h index 4b21715..bc98c10 100644 --- a/hal/t234/t234_hwpm_internal.h +++ b/hal/t234/t234_hwpm_internal.h @@ -80,7 +80,7 @@ int t234_hwpm_extract_ip_ops(struct tegra_soc_hwpm *hwpm, struct tegra_soc_hwpm_ip_ops *hwpm_ip_ops, bool available); int t234_hwpm_force_enable_ips(struct tegra_soc_hwpm *hwpm); int t234_hwpm_get_fs_info(struct tegra_soc_hwpm *hwpm, - u32 ip_index, u64 *fs_mask, u8 *ip_status); + u32 ip_enum, u64 *fs_mask, u8 *ip_status); int t234_hwpm_init_prod_values(struct tegra_soc_hwpm *hwpm); int t234_hwpm_disable_slcg(struct tegra_soc_hwpm *hwpm); diff --git a/hal/t234/t234_hwpm_ip_utils.c b/hal/t234/t234_hwpm_ip_utils.c index 90d9bb7..45c202b 100644 --- a/hal/t234/t234_hwpm_ip_utils.c +++ b/hal/t234/t234_hwpm_ip_utils.c @@ -29,12 +29,13 @@ int t234_hwpm_extract_ip_ops(struct tegra_soc_hwpm *hwpm, tegra_hwpm_fn(hwpm, " "); - /* Convert tegra_soc_hwpm_ip to internal enum */ - if (!(t234_hwpm_is_ip_active(hwpm, - hwpm_ip_ops->ip_index, &ip_idx))) { + /* Convert tegra_soc_hwpm_resource to internal enum */ + if (!(t234_hwpm_is_resource_active(hwpm, + hwpm_ip_ops->resource_enum, &ip_idx))) { tegra_hwpm_err(hwpm, - "SOC hwpm IP %d (base 0x%llx) is unconfigured", - hwpm_ip_ops->ip_index, hwpm_ip_ops->ip_base_address); + "SOC hwpm resource %d (base 0x%llx) is unconfigured", + hwpm_ip_ops->resource_enum, + hwpm_ip_ops->ip_base_address); goto fail; } @@ -306,7 +307,7 @@ fail: } int t234_hwpm_get_fs_info(struct tegra_soc_hwpm *hwpm, - u32 ip_index, u64 *fs_mask, u8 *ip_status) + u32 ip_enum, u64 *fs_mask, u8 *ip_status) { u32 ip_idx = 0U; struct tegra_soc_hwpm_chip *active_chip = NULL; @@ -316,17 +317,17 @@ int t234_hwpm_get_fs_info(struct tegra_soc_hwpm *hwpm, tegra_hwpm_fn(hwpm, " "); /* Convert tegra_soc_hwpm_ip to internal enum */ - if (!(t234_hwpm_is_ip_active(hwpm, ip_index, &ip_idx))) { + if (!(t234_hwpm_is_ip_active(hwpm, ip_enum, &ip_idx))) { tegra_hwpm_dbg(hwpm, hwpm_info, - "SOC hwpm IP %d is not configured", ip_index); + "SOC hwpm IP %d is not configured", ip_enum); *ip_status = TEGRA_SOC_HWPM_IP_STATUS_INVALID; *fs_mask = 0ULL; /* Remove after uapi update */ - if (ip_index == TEGRA_SOC_HWPM_IP_MSS_NVLINK) { + if (ip_enum == TEGRA_SOC_HWPM_IP_MSS_NVLINK) { tegra_hwpm_dbg(hwpm, hwpm_verbose, "For hwpm IP %d setting status as valid", - ip_index); + ip_enum); *ip_status = TEGRA_SOC_HWPM_IP_STATUS_VALID; } return 0; diff --git a/include/tegra_hwpm.h b/include/tegra_hwpm.h index 02e4a28..d7590a9 100644 --- a/include/tegra_hwpm.h +++ b/include/tegra_hwpm.h @@ -65,11 +65,13 @@ struct tegra_hwpm_ip_ops { * For read: * input : dev - IP device handle * input : reg_op - TEGRA_SOC_HWPM_IP_REG_OP_READ + * input : inst_element_index - element index within IP instance * input : reg_offset - register offset * output: reg_data - u32 read value * For write: * input : dev - IP device handle * input : reg_op - TEGRA_SOC_HWPM_IP_REG_OP_WRITE + * input : inst_element_index - element index within IP instance * input : reg_offset - register offset * output: reg_data - u32 write value * Return: @@ -77,7 +79,8 @@ struct tegra_hwpm_ip_ops { */ int (*hwpm_ip_reg_op)(void *dev, enum tegra_soc_hwpm_ip_reg_op reg_op, - __u64 reg_offset, __u32 *reg_data); + u32 inst_element_index, u64 reg_offset, + u32 *reg_data); }; /* There are 3 types of HWPM components/apertures */ @@ -303,7 +306,7 @@ struct tegra_soc_hwpm_chip { struct tegra_soc_hwpm_ip_ops *hwpm_ip_ops, bool available); int (*force_enable_ips)(struct tegra_soc_hwpm *hwpm); int (*get_fs_info)(struct tegra_soc_hwpm *hwpm, - u32 ip_index, u64 *fs_mask, u8 *ip_status); + u32 ip_enum, u64 *fs_mask, u8 *ip_status); int (*init_prod_values)(struct tegra_soc_hwpm *hwpm); int (*disable_slcg)(struct tegra_soc_hwpm *hwpm); diff --git a/os/linux/tegra_hwpm_io.c b/os/linux/tegra_hwpm_io.c index 9461c24..2cbe8b4 100644 --- a/os/linux/tegra_hwpm_io.c +++ b/os/linux/tegra_hwpm_io.c @@ -67,7 +67,7 @@ static int ip_readl(struct tegra_soc_hwpm *hwpm, struct hwpm_ip_inst *ip_inst, err = (*ip_ops_ptr->hwpm_ip_reg_op)(ip_ops_ptr->ip_dev, TEGRA_SOC_HWPM_IP_REG_OP_READ, - offset, val); + aperture->dt_index, offset, val); if (err < 0) { tegra_hwpm_err(hwpm, "Aperture (0x%llx-0x%llx) " "read offset(0x%llx) failed", @@ -121,7 +121,7 @@ static int ip_writel(struct tegra_soc_hwpm *hwpm, struct hwpm_ip_inst *ip_inst, err = (*ip_ops_ptr->hwpm_ip_reg_op)(ip_ops_ptr->ip_dev, TEGRA_SOC_HWPM_IP_REG_OP_WRITE, - offset, &val); + aperture->dt_index, offset, &val); if (err < 0) { tegra_hwpm_err(hwpm, "Aperture (0x%llx-0x%llx) " "write offset(0x%llx) val 0x%x failed", diff --git a/os/linux/tegra_hwpm_ip.c b/os/linux/tegra_hwpm_ip.c index 1395b62..8b0554c 100644 --- a/os/linux/tegra_hwpm_ip.c +++ b/os/linux/tegra_hwpm_ip.c @@ -110,7 +110,7 @@ void tegra_soc_hwpm_ip_register(struct tegra_soc_hwpm_ip_ops *hwpm_ip_ops) hwpm_ip_ops, REGISTER_IP); if (ret < 0) { tegra_hwpm_err(hwpm, "Failed to set IP ops for IP %d", - hwpm_ip_ops->ip_index); + hwpm_ip_ops->resource_enum); } } } @@ -141,7 +141,7 @@ void tegra_soc_hwpm_ip_unregister(struct tegra_soc_hwpm_ip_ops *hwpm_ip_ops) hwpm_ip_ops, UNREGISTER_IP); if (ret < 0) { tegra_hwpm_err(hwpm, "Failed to reset IP ops for IP %d", - hwpm_ip_ops->ip_index); + hwpm_ip_ops->resource_enum); } } }