mirror of
git://nv-tegra.nvidia.com/linux-hwpm.git
synced 2025-12-22 17:30:40 +03:00
tegra: hwpm: Modify OS common code for QNX
Modify the OS common code to be used by HWPM QNX resource manager. JIRA THWPM-44 Change-Id: Ibade56d3d94ce4d7e014e199963e2ddf568e7d3a Signed-off-by: vasukis <vasukis@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2858465 Reviewed-by: Seema Khowala <seemaj@nvidia.com> Reviewed-by: Vivek Bangera <vbangera@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
8b861518c4
commit
b27a32e7f0
@@ -224,8 +224,11 @@ struct hwpm_ip_aperture {
|
|||||||
u32 device_index;
|
u32 device_index;
|
||||||
|
|
||||||
/* MMIO device tree aperture - only populated for perfmon */
|
/* MMIO device tree aperture - only populated for perfmon */
|
||||||
|
#ifdef __KERNEL__
|
||||||
void __iomem *dt_mmio;
|
void __iomem *dt_mmio;
|
||||||
|
#else
|
||||||
|
void *dt_mmio;
|
||||||
|
#endif
|
||||||
/* DT tree name */
|
/* DT tree name */
|
||||||
char name[64];
|
char name[64];
|
||||||
|
|
||||||
|
|||||||
@@ -27,20 +27,7 @@
|
|||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
#include <os/linux/kmem.h>
|
#include <os/linux/kmem.h>
|
||||||
#else
|
#else
|
||||||
void *tegra_hwpm_kzalloc_impl(struct tegra_soc_hwpm *hwpm, size_t size)
|
#include <os/qnx/kmem.h>
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *tegra_hwpm_kcalloc_impl(struct tegra_soc_hwpm *hwpm, u32 num, size_t size)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void tegra_hwpm_kfree_impl(struct tegra_soc_hwpm *hwpm, void *addr)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define tegra_hwpm_kzalloc(hwpm, size) \
|
#define tegra_hwpm_kzalloc(hwpm, size) \
|
||||||
|
|||||||
@@ -28,16 +28,7 @@
|
|||||||
#include <linux/bits.h>
|
#include <linux/bits.h>
|
||||||
#include <os/linux/log.h>
|
#include <os/linux/log.h>
|
||||||
#else
|
#else
|
||||||
void tegra_hwpm_err_impl(struct tegra_soc_hwpm *hwpm,
|
#include <os/qnx/log.h>
|
||||||
const char *func, int line, const char *fmt, ...)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
void tegra_hwpm_dbg_impl(struct tegra_soc_hwpm *hwpm,
|
|
||||||
u32 dbg_mask, const char *func, int line, const char *fmt, ...)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TEGRA_SOC_HWPM_MODULE_NAME "tegra-soc-hwpm"
|
#define TEGRA_SOC_HWPM_MODULE_NAME "tegra-soc-hwpm"
|
||||||
@@ -85,6 +76,7 @@ enum tegra_soc_hwpm_log_type {
|
|||||||
/* Kmem debug prints */
|
/* Kmem debug prints */
|
||||||
#define hwpm_dbg_kmem BIT(17)
|
#define hwpm_dbg_kmem BIT(17)
|
||||||
|
|
||||||
|
#ifdef __KERNEL__
|
||||||
|
|
||||||
#define tegra_hwpm_err(hwpm, fmt, arg...) \
|
#define tegra_hwpm_err(hwpm, fmt, arg...) \
|
||||||
tegra_hwpm_err_impl(hwpm, __func__, __LINE__, fmt, ##arg)
|
tegra_hwpm_err_impl(hwpm, __func__, __LINE__, fmt, ##arg)
|
||||||
@@ -92,5 +84,13 @@ enum tegra_soc_hwpm_log_type {
|
|||||||
tegra_hwpm_dbg_impl(hwpm, dbg_mask, __func__, __LINE__, fmt, ##arg)
|
tegra_hwpm_dbg_impl(hwpm, dbg_mask, __func__, __LINE__, fmt, ##arg)
|
||||||
#define tegra_hwpm_fn(hwpm, fmt, arg...) \
|
#define tegra_hwpm_fn(hwpm, fmt, arg...) \
|
||||||
tegra_hwpm_dbg_impl(hwpm, hwpm_fn, __func__, __LINE__, fmt, ##arg)
|
tegra_hwpm_dbg_impl(hwpm, hwpm_fn, __func__, __LINE__, fmt, ##arg)
|
||||||
|
#else
|
||||||
|
#define tegra_hwpm_err(hwpm, fmt, arg...) \
|
||||||
|
tegra_hwpm_err_impl(hwpm, fmt, ##arg)
|
||||||
|
#define tegra_hwpm_dbg(hwpm, dbg_mask, fmt, arg...) \
|
||||||
|
tegra_hwpm_dbg_impl(hwpm, dbg_mask, fmt, ##arg)
|
||||||
|
#define tegra_hwpm_fn(hwpm, fmt, arg...) \
|
||||||
|
tegra_hwpm_dbg_impl(hwpm, hwpm_fn, fmt, ##arg)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* TEGRA_HWPM_LOG_H */
|
#endif /* TEGRA_HWPM_LOG_H */
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
static inline u32 tegra_hwpm_safe_add_u32(u32 ui_a, u32 ui_b)
|
static inline u32 tegra_hwpm_safe_add_u32(u32 ui_a, u32 ui_b)
|
||||||
{
|
{
|
||||||
if ((UINT_MAX - ui_a) < ui_b) {
|
if ((UINT_MAX - ui_a) < ui_b) {
|
||||||
WARN_ON(true);
|
BUG();
|
||||||
return 0U;
|
return 0U;
|
||||||
} else {
|
} else {
|
||||||
return ui_a + ui_b;
|
return ui_a + ui_b;
|
||||||
@@ -65,7 +65,7 @@ static inline u32 tegra_hwpm_safe_add_u32(u32 ui_a, u32 ui_b)
|
|||||||
static inline u64 tegra_hwpm_safe_add_u64(u64 ul_a, u64 ul_b)
|
static inline u64 tegra_hwpm_safe_add_u64(u64 ul_a, u64 ul_b)
|
||||||
{
|
{
|
||||||
if ((ULONG_MAX - ul_a) < ul_b) {
|
if ((ULONG_MAX - ul_a) < ul_b) {
|
||||||
WARN_ON(true);
|
BUG();
|
||||||
return 0U;
|
return 0U;
|
||||||
} else {
|
} else {
|
||||||
return ul_a + ul_b;
|
return ul_a + ul_b;
|
||||||
@@ -87,7 +87,7 @@ static inline u64 tegra_hwpm_safe_add_u64(u64 ul_a, u64 ul_b)
|
|||||||
static inline u32 tegra_hwpm_safe_sub_u32(u32 ui_a, u32 ui_b)
|
static inline u32 tegra_hwpm_safe_sub_u32(u32 ui_a, u32 ui_b)
|
||||||
{
|
{
|
||||||
if (ui_a < ui_b) {
|
if (ui_a < ui_b) {
|
||||||
WARN_ON(true);
|
BUG();
|
||||||
return 0U;
|
return 0U;
|
||||||
} else {
|
} else {
|
||||||
return ui_a - ui_b;
|
return ui_a - ui_b;
|
||||||
@@ -109,7 +109,7 @@ static inline u32 tegra_hwpm_safe_sub_u32(u32 ui_a, u32 ui_b)
|
|||||||
static inline u64 tegra_hwpm_safe_sub_u64(u64 ul_a, u64 ul_b)
|
static inline u64 tegra_hwpm_safe_sub_u64(u64 ul_a, u64 ul_b)
|
||||||
{
|
{
|
||||||
if (ul_a < ul_b) {
|
if (ul_a < ul_b) {
|
||||||
WARN_ON(true);
|
BUG();
|
||||||
return 0U;
|
return 0U;
|
||||||
} else {
|
} else {
|
||||||
return ul_a - ul_b;
|
return ul_a - ul_b;
|
||||||
@@ -137,7 +137,7 @@ static inline u32 tegra_hwpm_safe_mult_u32(u32 ui_a, u32 ui_b)
|
|||||||
if ((ui_a == 0U) || (ui_b == 0U)) {
|
if ((ui_a == 0U) || (ui_b == 0U)) {
|
||||||
return 0U;
|
return 0U;
|
||||||
} else if (ui_a > (UINT_MAX / ui_b)) {
|
} else if (ui_a > (UINT_MAX / ui_b)) {
|
||||||
WARN_ON(true);
|
BUG();
|
||||||
return 0U;
|
return 0U;
|
||||||
} else {
|
} else {
|
||||||
return ui_a * ui_b;
|
return ui_a * ui_b;
|
||||||
@@ -165,7 +165,7 @@ static inline u64 tegra_hwpm_safe_mult_u64(u64 ul_a, u64 ul_b)
|
|||||||
if ((ul_a == 0UL) || (ul_b == 0UL)) {
|
if ((ul_a == 0UL) || (ul_b == 0UL)) {
|
||||||
return 0UL;
|
return 0UL;
|
||||||
} else if (ul_a > (ULONG_MAX / ul_b)) {
|
} else if (ul_a > (ULONG_MAX / ul_b)) {
|
||||||
WARN_ON(true);
|
BUG();
|
||||||
return 0U;
|
return 0U;
|
||||||
} else {
|
} else {
|
||||||
return ul_a * ul_b;
|
return ul_a * ul_b;
|
||||||
@@ -185,7 +185,7 @@ static inline u64 tegra_hwpm_safe_mult_u64(u64 ul_a, u64 ul_b)
|
|||||||
static inline u32 tegra_hwpm_safe_cast_u64_to_u32(u64 ul_a)
|
static inline u32 tegra_hwpm_safe_cast_u64_to_u32(u64 ul_a)
|
||||||
{
|
{
|
||||||
if (ul_a > UINT_MAX) {
|
if (ul_a > UINT_MAX) {
|
||||||
WARN_ON(true);
|
BUG();
|
||||||
return 0U;
|
return 0U;
|
||||||
} else {
|
} else {
|
||||||
return (u32)ul_a;
|
return (u32)ul_a;
|
||||||
@@ -205,7 +205,7 @@ static inline u32 tegra_hwpm_safe_cast_u64_to_u32(u64 ul_a)
|
|||||||
static inline u64 tegra_hwpm_safe_cast_s32_to_u64(s32 si_a)
|
static inline u64 tegra_hwpm_safe_cast_s32_to_u64(s32 si_a)
|
||||||
{
|
{
|
||||||
if (si_a < 0) {
|
if (si_a < 0) {
|
||||||
WARN_ON(true);
|
BUG();
|
||||||
return 0U;
|
return 0U;
|
||||||
} else {
|
} else {
|
||||||
return (u64)si_a;
|
return (u64)si_a;
|
||||||
@@ -226,7 +226,7 @@ static inline u64 tegra_hwpm_safe_cast_s32_to_u64(s32 si_a)
|
|||||||
static inline s32 tegra_hwpm_safe_cast_u64_to_s32(u64 ul_a)
|
static inline s32 tegra_hwpm_safe_cast_u64_to_s32(u64 ul_a)
|
||||||
{
|
{
|
||||||
if (ul_a > tegra_hwpm_safe_cast_s32_to_u64(INT_MAX)) {
|
if (ul_a > tegra_hwpm_safe_cast_s32_to_u64(INT_MAX)) {
|
||||||
WARN_ON(true);
|
BUG();
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return (s32)ul_a;
|
return (s32)ul_a;
|
||||||
@@ -247,7 +247,7 @@ static inline s32 tegra_hwpm_safe_cast_u64_to_s32(u64 ul_a)
|
|||||||
static inline u8 tegra_hwpm_safe_cast_u32_to_u8(u32 ui_a)
|
static inline u8 tegra_hwpm_safe_cast_u32_to_u8(u32 ui_a)
|
||||||
{
|
{
|
||||||
if (ui_a > U8_MAX) {
|
if (ui_a > U8_MAX) {
|
||||||
WARN_ON(true);
|
BUG();
|
||||||
return 0U;
|
return 0U;
|
||||||
} else {
|
} else {
|
||||||
return (u8)ui_a;
|
return (u8)ui_a;
|
||||||
|
|||||||
@@ -29,22 +29,7 @@
|
|||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
#include <os/linux/timers.h>
|
#include <os/linux/timers.h>
|
||||||
#else
|
#else
|
||||||
int tegra_hwpm_timeout_init_impl(struct tegra_hwpm *hwpm,
|
#include <os/qnx/timers.h>
|
||||||
struct tegra_hwpm_timeout *timeout, u32 retries)
|
|
||||||
{
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int tegra_hwpm_timeout_expired_impl(struct tegra_hwpm *hwpm,
|
|
||||||
struct tegra_hwpm_timeout *timeout)
|
|
||||||
{
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void tegra_hwpm_msleep_impl(unsigned int msecs)
|
|
||||||
{
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define tegra_hwpm_timeout_init(hwpm, timeout, retries) \
|
#define tegra_hwpm_timeout_init(hwpm, timeout, retries) \
|
||||||
|
|||||||
@@ -34,6 +34,8 @@
|
|||||||
#include <linux/limits.h>
|
#include <linux/limits.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
#include <tegra_hwpm_qnx_types.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* TEGRA_HWPM_TYPES_H */
|
#endif /* TEGRA_HWPM_TYPES_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user