mirror of
git://nv-tegra.nvidia.com/linux-hwpm.git
synced 2025-12-22 17:30:40 +03:00
tegra: hwpm: add wrappers for io functions
In an effort to make HWPM driver OS agnostic, add wrappers for io functions. Jira THWPM-59 Change-Id: I9309ee15a965aa3d2f122ef959eec211c9a84623 Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2738156 Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com> Reviewed-by: Vasuki Shankar <vasukis@nvidia.com> Reviewed-by: Seema Khowala <seemaj@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
mobile promotions
parent
c893ae2cd9
commit
42a33fd9d0
2
Makefile
2
Makefile
@@ -10,7 +10,7 @@ ccflags-y += -I$(srctree.nvidia)/include
|
|||||||
|
|
||||||
obj-$(CONFIG_DEBUG_FS) += os/linux/debugfs.o
|
obj-$(CONFIG_DEBUG_FS) += os/linux/debugfs.o
|
||||||
obj-y += os/linux/driver.o
|
obj-y += os/linux/driver.o
|
||||||
obj-y += os/linux/io.o
|
obj-y += os/linux/io_utils.o
|
||||||
obj-y += os/linux/ip_utils.o
|
obj-y += os/linux/ip_utils.o
|
||||||
obj-y += os/linux/ioctl.o
|
obj-y += os/linux/ioctl.o
|
||||||
obj-y += os/linux/kmem.o
|
obj-y += os/linux/kmem.o
|
||||||
|
|||||||
@@ -49,22 +49,55 @@ static inline u32 get_field(u32 input_data, u32 mask)
|
|||||||
return (input_data & mask);
|
return (input_data & mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __KERNEL__
|
||||||
|
#include <os/linux/io_utils.h>
|
||||||
|
#else
|
||||||
|
int tegra_hwpm_read_sticky_bits_impl(struct tegra_soc_hwpm *hwpm,
|
||||||
|
u64 reg_base, u64 reg_offset, u32 *val)
|
||||||
|
{
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
struct tegra_soc_hwpm;
|
int tegra_hwpm_readl_impl(struct tegra_soc_hwpm *hwpm,
|
||||||
struct hwpm_ip_inst;
|
struct hwpm_ip_aperture *aperture, u64 addr, u32 *val)
|
||||||
struct hwpm_ip_aperture;
|
{
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
int tegra_hwpm_read_sticky_bits(struct tegra_soc_hwpm *hwpm,
|
int tegra_hwpm_writel_impl(struct tegra_soc_hwpm *hwpm,
|
||||||
u64 reg_base, u64 reg_offset, u32 *val);
|
struct hwpm_ip_aperture *aperture, u64 addr, u32 val)
|
||||||
int tegra_hwpm_readl(struct tegra_soc_hwpm *hwpm,
|
{
|
||||||
struct hwpm_ip_aperture *aperture, u64 addr, u32 *val);
|
return -EINVAL;
|
||||||
int tegra_hwpm_writel(struct tegra_soc_hwpm *hwpm,
|
}
|
||||||
struct hwpm_ip_aperture *aperture, u64 addr, u32 val);
|
|
||||||
int tegra_hwpm_regops_readl(struct tegra_soc_hwpm *hwpm,
|
int tegra_hwpm_regops_readl_impl(struct tegra_soc_hwpm *hwpm,
|
||||||
struct hwpm_ip_inst *ip_inst, struct hwpm_ip_aperture *aperture,
|
struct hwpm_ip_inst *ip_inst, struct hwpm_ip_aperture *aperture,
|
||||||
u64 addr, u32 *val);
|
u64 addr, u32 *val)
|
||||||
int tegra_hwpm_regops_writel(struct tegra_soc_hwpm *hwpm,
|
{
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int tegra_hwpm_regops_writel_impl(struct tegra_soc_hwpm *hwpm,
|
||||||
struct hwpm_ip_inst *ip_inst, struct hwpm_ip_aperture *aperture,
|
struct hwpm_ip_inst *ip_inst, struct hwpm_ip_aperture *aperture,
|
||||||
u64 addr, u32 val);
|
u64 addr, u32 val)
|
||||||
|
{
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define tegra_hwpm_read_sticky_bits(hwpm, reg_base, reg_offset, val) \
|
||||||
|
tegra_hwpm_read_sticky_bits_impl(hwpm, reg_base, reg_offset, val)
|
||||||
|
|
||||||
|
#define tegra_hwpm_readl(hwpm, aperture, addr, val) \
|
||||||
|
tegra_hwpm_readl_impl(hwpm, aperture, addr, val)
|
||||||
|
|
||||||
|
#define tegra_hwpm_writel(hwpm, aperture, addr, val) \
|
||||||
|
tegra_hwpm_writel_impl(hwpm, aperture, addr, val)
|
||||||
|
|
||||||
|
#define tegra_hwpm_regops_readl(hwpm, ip_inst, aperture, addr, val) \
|
||||||
|
tegra_hwpm_regops_readl_impl(hwpm, ip_inst, aperture, addr, val)
|
||||||
|
|
||||||
|
#define tegra_hwpm_regops_writel(hwpm, ip_inst, aperture, addr, val) \
|
||||||
|
tegra_hwpm_regops_writel_impl(hwpm, ip_inst, aperture, addr, val)
|
||||||
|
|
||||||
#endif /* TEGRA_HWPM_IO_H */
|
#endif /* TEGRA_HWPM_IO_H */
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include <tegra_hwpm_log.h>
|
#include <tegra_hwpm_log.h>
|
||||||
#include <tegra_hwpm_static_analysis.h>
|
#include <tegra_hwpm_static_analysis.h>
|
||||||
|
|
||||||
int tegra_hwpm_read_sticky_bits(struct tegra_soc_hwpm *hwpm,
|
int tegra_hwpm_read_sticky_bits_impl(struct tegra_soc_hwpm *hwpm,
|
||||||
u64 reg_base, u64 reg_offset, u32 *val)
|
u64 reg_base, u64 reg_offset, u32 *val)
|
||||||
{
|
{
|
||||||
void __iomem *ptr = NULL;
|
void __iomem *ptr = NULL;
|
||||||
@@ -217,7 +217,7 @@ static int hwpm_writel(struct tegra_soc_hwpm *hwpm,
|
|||||||
* Read a HWPM domain register. It is assumed that valid aperture
|
* Read a HWPM domain register. It is assumed that valid aperture
|
||||||
* is passed to the function.
|
* is passed to the function.
|
||||||
*/
|
*/
|
||||||
int tegra_hwpm_readl(struct tegra_soc_hwpm *hwpm,
|
int tegra_hwpm_readl_impl(struct tegra_soc_hwpm *hwpm,
|
||||||
struct hwpm_ip_aperture *aperture, u64 addr, u32 *val)
|
struct hwpm_ip_aperture *aperture, u64 addr, u32 *val)
|
||||||
{
|
{
|
||||||
tegra_hwpm_fn(hwpm, " ");
|
tegra_hwpm_fn(hwpm, " ");
|
||||||
@@ -244,7 +244,7 @@ int tegra_hwpm_readl(struct tegra_soc_hwpm *hwpm,
|
|||||||
* Write to a HWPM domain register. It is assumed that valid aperture
|
* Write to a HWPM domain register. It is assumed that valid aperture
|
||||||
* is passed to the function.
|
* is passed to the function.
|
||||||
*/
|
*/
|
||||||
int tegra_hwpm_writel(struct tegra_soc_hwpm *hwpm,
|
int tegra_hwpm_writel_impl(struct tegra_soc_hwpm *hwpm,
|
||||||
struct hwpm_ip_aperture *aperture, u64 addr, u32 val)
|
struct hwpm_ip_aperture *aperture, u64 addr, u32 val)
|
||||||
{
|
{
|
||||||
tegra_hwpm_fn(hwpm, " ");
|
tegra_hwpm_fn(hwpm, " ");
|
||||||
@@ -271,7 +271,7 @@ int tegra_hwpm_writel(struct tegra_soc_hwpm *hwpm,
|
|||||||
* Read a register from the EXEC_REG_OPS IOCTL. It is assumed that the allowlist
|
* Read a register from the EXEC_REG_OPS IOCTL. It is assumed that the allowlist
|
||||||
* check has been done before calling this function.
|
* check has been done before calling this function.
|
||||||
*/
|
*/
|
||||||
int tegra_hwpm_regops_readl(struct tegra_soc_hwpm *hwpm,
|
int tegra_hwpm_regops_readl_impl(struct tegra_soc_hwpm *hwpm,
|
||||||
struct hwpm_ip_inst *ip_inst, struct hwpm_ip_aperture *aperture,
|
struct hwpm_ip_inst *ip_inst, struct hwpm_ip_aperture *aperture,
|
||||||
u64 addr, u32 *val)
|
u64 addr, u32 *val)
|
||||||
{
|
{
|
||||||
@@ -300,7 +300,7 @@ int tegra_hwpm_regops_readl(struct tegra_soc_hwpm *hwpm,
|
|||||||
* Write a register from the EXEC_REG_OPS IOCTL. It is assumed that the
|
* Write a register from the EXEC_REG_OPS IOCTL. It is assumed that the
|
||||||
* allowlist check has been done before calling this function.
|
* allowlist check has been done before calling this function.
|
||||||
*/
|
*/
|
||||||
int tegra_hwpm_regops_writel(struct tegra_soc_hwpm *hwpm,
|
int tegra_hwpm_regops_writel_impl(struct tegra_soc_hwpm *hwpm,
|
||||||
struct hwpm_ip_inst *ip_inst, struct hwpm_ip_aperture *aperture,
|
struct hwpm_ip_inst *ip_inst, struct hwpm_ip_aperture *aperture,
|
||||||
u64 addr, u32 val)
|
u64 addr, u32 val)
|
||||||
{
|
{
|
||||||
34
os/linux/io_utils.h
Normal file
34
os/linux/io_utils.h
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TEGRA_HWPM_OS_LINUX_IO_UTILS_H
|
||||||
|
#define TEGRA_HWPM_OS_LINUX_IO_UTILS_H
|
||||||
|
|
||||||
|
struct tegra_soc_hwpm;
|
||||||
|
struct hwpm_ip_inst;
|
||||||
|
struct hwpm_ip_aperture;
|
||||||
|
|
||||||
|
int tegra_hwpm_read_sticky_bits_impl(struct tegra_soc_hwpm *hwpm,
|
||||||
|
u64 reg_base, u64 reg_offset, u32 *val);
|
||||||
|
int tegra_hwpm_readl_impl(struct tegra_soc_hwpm *hwpm,
|
||||||
|
struct hwpm_ip_aperture *aperture, u64 addr, u32 *val);
|
||||||
|
int tegra_hwpm_writel_impl(struct tegra_soc_hwpm *hwpm,
|
||||||
|
struct hwpm_ip_aperture *aperture, u64 addr, u32 val);
|
||||||
|
int tegra_hwpm_regops_readl_impl(struct tegra_soc_hwpm *hwpm,
|
||||||
|
struct hwpm_ip_inst *ip_inst, struct hwpm_ip_aperture *aperture,
|
||||||
|
u64 addr, u32 *val);
|
||||||
|
int tegra_hwpm_regops_writel_impl(struct tegra_soc_hwpm *hwpm,
|
||||||
|
struct hwpm_ip_inst *ip_inst, struct hwpm_ip_aperture *aperture,
|
||||||
|
u64 addr, u32 val);
|
||||||
|
|
||||||
|
#endif /* TEGRA_HWPM_OS_LINUX_IO_UTILS_H */
|
||||||
Reference in New Issue
Block a user