summaryrefslogtreecommitdiff
path: root/include/soc/tegra/bpmp.h
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2022-09-22 16:41:24 +0300
committerThierry Reding <treding@nvidia.com>2022-10-24 16:18:11 +0300
commit4c1e0a97351a5e88e7e503b40cdbe0f220039a5e (patch)
treebe5165a467aec518ffacc940069c4564d39c9df1 /include/soc/tegra/bpmp.h
parent236d3907aa7c03168dbc4d0e8faa77d10bbb969f (diff)
downloadlinux-4c1e0a97351a5e88e7e503b40cdbe0f220039a5e.tar.xz
firmware: tegra: bpmp: Use iosys-map helpers
The shared memory used for inter-processor communication between the CPU and the BPMP can reside either in system memory or in I/O memory. Use the iosys-map helpers to abstract these differences away. Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'include/soc/tegra/bpmp.h')
-rw-r--r--include/soc/tegra/bpmp.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/include/soc/tegra/bpmp.h b/include/soc/tegra/bpmp.h
index f2604e99af09..5842e38bb288 100644
--- a/include/soc/tegra/bpmp.h
+++ b/include/soc/tegra/bpmp.h
@@ -6,6 +6,7 @@
#ifndef __SOC_TEGRA_BPMP_H
#define __SOC_TEGRA_BPMP_H
+#include <linux/iosys-map.h>
#include <linux/mailbox_client.h>
#include <linux/pm_domain.h>
#include <linux/reset-controller.h>
@@ -36,10 +37,22 @@ struct tegra_bpmp_mb_data {
u8 data[MSG_DATA_MIN_SZ];
} __packed;
+#define tegra_bpmp_mb_read(dst, mb, size) \
+ iosys_map_memcpy_from(dst, mb, offsetof(struct tegra_bpmp_mb_data, data), size)
+
+#define tegra_bpmp_mb_write(mb, src, size) \
+ iosys_map_memcpy_to(mb, offsetof(struct tegra_bpmp_mb_data, data), src, size)
+
+#define tegra_bpmp_mb_read_field(mb, field) \
+ iosys_map_rd_field(mb, 0, struct tegra_bpmp_mb_data, field)
+
+#define tegra_bpmp_mb_write_field(mb, field, value) \
+ iosys_map_wr_field(mb, 0, struct tegra_bpmp_mb_data, field, value)
+
struct tegra_bpmp_channel {
struct tegra_bpmp *bpmp;
- struct tegra_bpmp_mb_data *ib;
- struct tegra_bpmp_mb_data *ob;
+ struct iosys_map ib;
+ struct iosys_map ob;
struct completion completion;
struct tegra_ivc *ivc;
unsigned int index;