summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2011-07-26 14:09:02 +0300
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:48:17 -0800
commit7269592fe51dfca0a7d251f00a35dc5eb65c261b (patch)
tree25ea3d8c6125eb8c5cdfe45579b8af0ab6a00b3e /include
parente0a4cc70f6dbb23b5a3656f41e90ebe561fd0585 (diff)
nvhost: Move include files to kernel/include
To prepare for kernel modularization, nvhost include files need to be moved from mach-tegra/include to kernel/include. At the same time user space specific part is split into nvhost_ioctl.h. Bug 854182 Original-Change-Id: I3694a40d786028733310ecf5b59341282af571be Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/43211 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com> Rebase-Id: Rc4fadf65d59ddfb5bb924e7adfccd39e86a0b2c7
Diffstat (limited to 'include')
-rw-r--r--include/linux/nvhost.h73
-rw-r--r--include/linux/nvhost_ioctl.h179
-rw-r--r--include/trace/events/nvhost.h350
3 files changed, 602 insertions, 0 deletions
diff --git a/include/linux/nvhost.h b/include/linux/nvhost.h
new file mode 100644
index 000000000000..a1d211de1ef1
--- /dev/null
+++ b/include/linux/nvhost.h
@@ -0,0 +1,73 @@
+/*
+ * include/linux/nvhost.h
+ *
+ * Tegra graphics host driver
+ *
+ * Copyright (c) 2009-2011, NVIDIA Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that 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.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __LINUX_NVHOST_H
+#define __LINUX_NVHOST_H
+
+#include <linux/device.h>
+#include <linux/types.h>
+
+struct nvhost_master;
+
+struct nvhost_device {
+ const char *name;
+ struct device dev;
+ int id;
+ u32 num_resources;
+ struct resource *resource;
+
+ struct nvhost_master *host;
+};
+
+extern int nvhost_device_register(struct nvhost_device *);
+extern void nvhost_device_unregister(struct nvhost_device *);
+
+extern struct bus_type nvhost_bus_type;
+
+struct nvhost_driver {
+ int (*probe)(struct nvhost_device *);
+ int (*remove)(struct nvhost_device *);
+ void (*shutdown)(struct nvhost_device *);
+ int (*suspend)(struct nvhost_device *, pm_message_t state);
+ int (*resume)(struct nvhost_device *);
+ struct device_driver driver;
+};
+
+extern int nvhost_driver_register(struct nvhost_driver *);
+extern void nvhost_driver_unregister(struct nvhost_driver *);
+extern struct resource *nvhost_get_resource(struct nvhost_device *,
+ unsigned int, unsigned int);
+extern int nvhost_get_irq(struct nvhost_device *, unsigned int);
+extern struct resource *nvhost_get_resource_byname(struct nvhost_device *,
+ unsigned int, const char *);
+extern int nvhost_get_irq_byname(struct nvhost_device *, const char *);
+
+#define to_nvhost_device(x) container_of((x), struct nvhost_device, dev)
+#define to_nvhost_driver(drv) (container_of((drv), struct nvhost_driver, \
+ driver))
+
+#define nvhost_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev)
+#define nvhost_set_drvdata(_dev, data) dev_set_drvdata(&(_dev)->dev, (data))
+
+int nvhost_bus_register(struct nvhost_master *host);
+
+#endif
diff --git a/include/linux/nvhost_ioctl.h b/include/linux/nvhost_ioctl.h
new file mode 100644
index 000000000000..6e49827b873c
--- /dev/null
+++ b/include/linux/nvhost_ioctl.h
@@ -0,0 +1,179 @@
+/*
+ * include/linux/nvhost_ioctl.h
+ *
+ * Tegra graphics host driver
+ *
+ * Copyright (c) 2009-2011, NVIDIA Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that 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.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __LINUX_NVHOST_IOCTL_H
+#define __LINUX_NVHOST_IOCTL_H
+
+#include <linux/ioctl.h>
+#include <linux/types.h>
+
+#if !defined(__KERNEL__)
+#define __user
+#endif
+
+#define NVHOST_INVALID_SYNCPOINT 0xFFFFFFFF
+#define NVHOST_NO_TIMEOUT (-1)
+#define NVHOST_NO_CONTEXT 0x0
+#define NVHOST_IOCTL_MAGIC 'H'
+
+/* version 0 header (used with write() submit interface) */
+struct nvhost_submit_hdr {
+ __u32 syncpt_id;
+ __u32 syncpt_incrs;
+ __u32 num_cmdbufs;
+ __u32 num_relocs;
+};
+
+#define NVHOST_SUBMIT_VERSION_V0 0x0
+#define NVHOST_SUBMIT_VERSION_V1 0x1
+#define NVHOST_SUBMIT_VERSION_MAX_SUPPORTED NVHOST_SUBMIT_VERSION_V1
+
+/* version 1 header (used with ioctl() submit interface) */
+struct nvhost_submit_hdr_ext {
+ __u32 syncpt_id; /* version 0 fields */
+ __u32 syncpt_incrs;
+ __u32 num_cmdbufs;
+ __u32 num_relocs;
+ __u32 submit_version; /* version 1 fields */
+ __u32 num_waitchks;
+ __u32 waitchk_mask;
+ __u32 pad[5]; /* future expansion */
+};
+
+struct nvhost_cmdbuf {
+ __u32 mem;
+ __u32 offset;
+ __u32 words;
+};
+
+struct nvhost_reloc {
+ __u32 cmdbuf_mem;
+ __u32 cmdbuf_offset;
+ __u32 target;
+ __u32 target_offset;
+};
+
+struct nvhost_waitchk {
+ __u32 mem;
+ __u32 offset;
+ __u32 syncpt_id;
+ __u32 thresh;
+};
+
+struct nvhost_get_param_args {
+ __u32 value;
+};
+
+struct nvhost_set_nvmap_fd_args {
+ __u32 fd;
+};
+
+struct nvhost_read_3d_reg_args {
+ __u32 offset;
+ __u32 value;
+};
+
+struct nvhost_clk_rate_args {
+ __u64 rate;
+};
+
+#define NVHOST_IOCTL_CHANNEL_FLUSH \
+ _IOR(NVHOST_IOCTL_MAGIC, 1, struct nvhost_get_param_args)
+#define NVHOST_IOCTL_CHANNEL_GET_SYNCPOINTS \
+ _IOR(NVHOST_IOCTL_MAGIC, 2, struct nvhost_get_param_args)
+#define NVHOST_IOCTL_CHANNEL_GET_WAITBASES \
+ _IOR(NVHOST_IOCTL_MAGIC, 3, struct nvhost_get_param_args)
+#define NVHOST_IOCTL_CHANNEL_GET_MODMUTEXES \
+ _IOR(NVHOST_IOCTL_MAGIC, 4, struct nvhost_get_param_args)
+#define NVHOST_IOCTL_CHANNEL_SET_NVMAP_FD \
+ _IOW(NVHOST_IOCTL_MAGIC, 5, struct nvhost_set_nvmap_fd_args)
+#define NVHOST_IOCTL_CHANNEL_NULL_KICKOFF \
+ _IOR(NVHOST_IOCTL_MAGIC, 6, struct nvhost_get_param_args)
+#define NVHOST_IOCTL_CHANNEL_SUBMIT_EXT \
+ _IOW(NVHOST_IOCTL_MAGIC, 7, struct nvhost_submit_hdr_ext)
+#define NVHOST_IOCTL_CHANNEL_READ_3D_REG \
+ _IOWR(NVHOST_IOCTL_MAGIC, 8, struct nvhost_read_3d_reg_args)
+#define NVHOST_IOCTL_CHANNEL_GET_CLK_RATE \
+ _IOR(NVHOST_IOCTL_MAGIC, 9, struct nvhost_clk_rate_args)
+#define NVHOST_IOCTL_CHANNEL_SET_CLK_RATE \
+ _IOW(NVHOST_IOCTL_MAGIC, 10, struct nvhost_clk_rate_args)
+#define NVHOST_IOCTL_CHANNEL_LAST \
+ _IOC_NR(NVHOST_IOCTL_CHANNEL_SET_CLK_RATE)
+#define NVHOST_IOCTL_CHANNEL_MAX_ARG_SIZE sizeof(struct nvhost_submit_hdr_ext)
+
+struct nvhost_ctrl_syncpt_read_args {
+ __u32 id;
+ __u32 value;
+};
+
+struct nvhost_ctrl_syncpt_incr_args {
+ __u32 id;
+};
+
+struct nvhost_ctrl_syncpt_wait_args {
+ __u32 id;
+ __u32 thresh;
+ __s32 timeout;
+};
+
+struct nvhost_ctrl_syncpt_waitex_args {
+ __u32 id;
+ __u32 thresh;
+ __s32 timeout;
+ __u32 value;
+};
+
+struct nvhost_ctrl_module_mutex_args {
+ __u32 id;
+ __u32 lock;
+};
+
+struct nvhost_ctrl_module_regrdwr_args {
+ __u32 id;
+ __u32 num_offsets;
+ __u32 block_size;
+ __u32 *offsets;
+ __u32 *values;
+ __u32 write;
+};
+
+#define NVHOST_IOCTL_CTRL_SYNCPT_READ \
+ _IOWR(NVHOST_IOCTL_MAGIC, 1, struct nvhost_ctrl_syncpt_read_args)
+#define NVHOST_IOCTL_CTRL_SYNCPT_INCR \
+ _IOW(NVHOST_IOCTL_MAGIC, 2, struct nvhost_ctrl_syncpt_incr_args)
+#define NVHOST_IOCTL_CTRL_SYNCPT_WAIT \
+ _IOW(NVHOST_IOCTL_MAGIC, 3, struct nvhost_ctrl_syncpt_wait_args)
+
+#define NVHOST_IOCTL_CTRL_MODULE_MUTEX \
+ _IOWR(NVHOST_IOCTL_MAGIC, 4, struct nvhost_ctrl_module_mutex_args)
+#define NVHOST_IOCTL_CTRL_MODULE_REGRDWR \
+ _IOWR(NVHOST_IOCTL_MAGIC, 5, struct nvhost_ctrl_module_regrdwr_args)
+
+#define NVHOST_IOCTL_CTRL_SYNCPT_WAITEX \
+ _IOWR(NVHOST_IOCTL_MAGIC, 6, struct nvhost_ctrl_syncpt_waitex_args)
+
+#define NVHOST_IOCTL_CTRL_LAST \
+ _IOC_NR(NVHOST_IOCTL_CTRL_SYNCPT_WAITEX)
+#define NVHOST_IOCTL_CTRL_MAX_ARG_SIZE \
+ sizeof(struct nvhost_ctrl_module_regrdwr_args)
+
+#endif
diff --git a/include/trace/events/nvhost.h b/include/trace/events/nvhost.h
new file mode 100644
index 000000000000..2a1845950ed5
--- /dev/null
+++ b/include/trace/events/nvhost.h
@@ -0,0 +1,350 @@
+/*
+ * include/trace/events/nvhost.h
+ *
+ * Nvhost event logging to ftrace.
+ *
+ * Copyright (c) 2010-2011, NVIDIA Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that 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.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM nvhost
+
+#if !defined(_TRACE_NVHOST_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_NVHOST_H
+
+#include <linux/ktime.h>
+#include <linux/tracepoint.h>
+
+DECLARE_EVENT_CLASS(nvhost,
+ TP_PROTO(const char *name),
+ TP_ARGS(name),
+ TP_STRUCT__entry(__field(const char *, name)),
+ TP_fast_assign(__entry->name = name;),
+ TP_printk("name=%s", __entry->name)
+);
+
+DEFINE_EVENT(nvhost, nvhost_channel_open,
+ TP_PROTO(const char *name),
+ TP_ARGS(name)
+);
+
+DEFINE_EVENT(nvhost, nvhost_channel_release,
+ TP_PROTO(const char *name),
+ TP_ARGS(name)
+);
+
+DEFINE_EVENT(nvhost, nvhost_ioctl_channel_flush,
+ TP_PROTO(const char *name),
+ TP_ARGS(name)
+);
+
+TRACE_EVENT(nvhost_channel_write_submit,
+ TP_PROTO(const char *name, ssize_t count, u32 cmdbufs, u32 relocs),
+
+ TP_ARGS(name, count, cmdbufs, relocs),
+
+ TP_STRUCT__entry(
+ __field(const char *, name)
+ __field(ssize_t, count)
+ __field(u32, cmdbufs)
+ __field(u32, relocs)
+ ),
+
+ TP_fast_assign(
+ __entry->name = name;
+ __entry->count = count;
+ __entry->cmdbufs = cmdbufs;
+ __entry->relocs = relocs;
+ ),
+
+ TP_printk("name=%s, count=%lu, cmdbufs=%lu, relocs=%ld",
+ __entry->name, (unsigned long)__entry->count,
+ (unsigned long)__entry->cmdbufs, (unsigned long)__entry->relocs)
+);
+
+TRACE_EVENT(nvhost_ioctl_channel_submit,
+ TP_PROTO(const char *name, u32 version, u32 cmdbufs, u32 relocs,
+ u32 waitchks),
+
+ TP_ARGS(name, version, cmdbufs, relocs, waitchks),
+
+ TP_STRUCT__entry(
+ __field(const char *, name)
+ __field(u32, version)
+ __field(u32, cmdbufs)
+ __field(u32, relocs)
+ __field(u32, waitchks)
+ ),
+
+ TP_fast_assign(
+ __entry->name = name;
+ __entry->version = version;
+ __entry->cmdbufs = cmdbufs;
+ __entry->relocs = relocs;
+ __entry->waitchks = waitchks;
+ ),
+
+ TP_printk("name=%s, version=%lu, cmdbufs=%lu, relocs=%ld, waitchks=%ld",
+ __entry->name, (unsigned long)__entry->version,
+ (unsigned long)__entry->cmdbufs, (unsigned long)__entry->relocs,
+ (unsigned long)__entry->waitchks)
+);
+
+TRACE_EVENT(nvhost_channel_write_cmdbuf,
+ TP_PROTO(const char *name, u32 mem_id, u32 words, u32 offset),
+
+ TP_ARGS(name, mem_id, words, offset),
+
+ TP_STRUCT__entry(
+ __field(const char *, name)
+ __field(u32, mem_id)
+ __field(u32, words)
+ __field(u32, offset)
+ ),
+
+ TP_fast_assign(
+ __entry->name = name;
+ __entry->mem_id = mem_id;
+ __entry->words = words;
+ __entry->offset = offset;
+ ),
+
+ TP_printk("name=%s, mem_id=%08lx, words=%lu, offset=%ld",
+ __entry->name, (unsigned long)__entry->mem_id,
+ (unsigned long)__entry->words, (unsigned long)__entry->offset)
+);
+
+TRACE_EVENT(nvhost_channel_write_relocs,
+ TP_PROTO(const char *name, u32 relocs),
+
+ TP_ARGS(name, relocs),
+
+ TP_STRUCT__entry(
+ __field(const char *, name)
+ __field(u32, relocs)
+ ),
+
+ TP_fast_assign(
+ __entry->name = name;
+ __entry->relocs = relocs;
+ ),
+
+ TP_printk("name=%s, relocs=%lu",
+ __entry->name, (unsigned long)__entry->relocs)
+);
+
+TRACE_EVENT(nvhost_channel_write_waitchks,
+ TP_PROTO(const char *name, u32 waitchks, u32 waitmask),
+
+ TP_ARGS(name, waitchks, waitmask),
+
+ TP_STRUCT__entry(
+ __field(const char *, name)
+ __field(u32, waitchks)
+ __field(u32, waitmask)
+ ),
+
+ TP_fast_assign(
+ __entry->name = name;
+ __entry->waitchks = waitchks;
+ __entry->waitmask = waitmask;
+ ),
+
+ TP_printk("name=%s, waitchks=%lu, waitmask=%08lx",
+ __entry->name, (unsigned long)__entry->waitchks,
+ (unsigned long)__entry->waitmask)
+);
+
+TRACE_EVENT(nvhost_channel_context_switch,
+ TP_PROTO(const char *name, void *old_ctx, void *new_ctx),
+
+ TP_ARGS(name, old_ctx, new_ctx),
+
+ TP_STRUCT__entry(
+ __field(const char *, name)
+ __field(void*, old_ctx)
+ __field(void*, new_ctx)
+ ),
+
+ TP_fast_assign(
+ __entry->name = name;
+ __entry->old_ctx = old_ctx;
+ __entry->new_ctx = new_ctx;
+ ),
+
+ TP_printk("name=%s, old=%08lx, new=%08lx",
+ __entry->name, (long unsigned int)__entry->old_ctx,
+ (long unsigned int)__entry->new_ctx)
+);
+
+TRACE_EVENT(nvhost_ctrlopen,
+ TP_PROTO(const char *name),
+ TP_ARGS(name),
+ TP_STRUCT__entry(
+ __field(const char *, name)
+ ),
+ TP_fast_assign(
+ __entry->name = name
+ ),
+ TP_printk("name=%s", __entry->name)
+);
+
+TRACE_EVENT(nvhost_ctrlrelease,
+ TP_PROTO(const char *name),
+ TP_ARGS(name),
+ TP_STRUCT__entry(
+ __field(const char *, name)
+ ),
+ TP_fast_assign(
+ __entry->name = name
+ ),
+ TP_printk("name=%s", __entry->name)
+);
+
+TRACE_EVENT(nvhost_ioctl_ctrl_module_mutex,
+ TP_PROTO(u32 lock, u32 id),
+
+ TP_ARGS(lock, id),
+
+ TP_STRUCT__entry(
+ __field(u32, lock);
+ __field(u32, id);
+ ),
+
+ TP_fast_assign(
+ __entry->lock = lock;
+ __entry->id = id;
+ ),
+
+ TP_printk("lock=%u, id=%d",
+ __entry->lock, __entry->id)
+ );
+
+TRACE_EVENT(nvhost_ioctl_ctrl_syncpt_incr,
+ TP_PROTO(u32 id),
+
+ TP_ARGS(id),
+
+ TP_STRUCT__entry(
+ __field(u32, id);
+ ),
+
+ TP_fast_assign(
+ __entry->id = id;
+ ),
+
+ TP_printk("id=%d", __entry->id)
+);
+
+TRACE_EVENT(nvhost_ioctl_ctrl_syncpt_read,
+ TP_PROTO(u32 id),
+
+ TP_ARGS(id),
+
+ TP_STRUCT__entry(
+ __field(u32, id);
+ ),
+
+ TP_fast_assign(
+ __entry->id = id;
+ ),
+
+ TP_printk("id=%d", __entry->id)
+);
+
+TRACE_EVENT(nvhost_ioctl_ctrl_syncpt_wait,
+ TP_PROTO(u32 id, u32 threshold, s32 timeout),
+
+ TP_ARGS(id, threshold, timeout),
+
+ TP_STRUCT__entry(
+ __field(u32, id)
+ __field(u32, threshold)
+ __field(s32, timeout)
+ ),
+
+ TP_fast_assign(
+ __entry->id = id;
+ __entry->threshold = threshold;
+ __entry->timeout = timeout;
+ ),
+
+ TP_printk("id=%u, threshold=%u, timeout=%d",
+ __entry->id, __entry->threshold, __entry->timeout)
+);
+
+TRACE_EVENT(nvhost_channel_submitted,
+ TP_PROTO(const char *name, u32 syncpt_base, u32 syncpt_max),
+
+ TP_ARGS(name, syncpt_base, syncpt_max),
+
+ TP_STRUCT__entry(
+ __field(const char *, name)
+ __field(u32, syncpt_base)
+ __field(u32, syncpt_max)
+ ),
+
+ TP_fast_assign(
+ __entry->name = name;
+ __entry->syncpt_base = syncpt_base;
+ __entry->syncpt_max = syncpt_max;
+ ),
+
+ TP_printk("name=%s, syncpt_base=%d, syncpt_max=%d",
+ __entry->name, __entry->syncpt_base, __entry->syncpt_max)
+);
+
+TRACE_EVENT(nvhost_channel_submit_complete,
+ TP_PROTO(const char *name, int count),
+
+ TP_ARGS(name, count),
+
+ TP_STRUCT__entry(
+ __field(const char *, name)
+ __field(int, count)
+ ),
+
+ TP_fast_assign(
+ __entry->name = name;
+ __entry->count = count;
+ ),
+
+ TP_printk("name=%s, count=%d", __entry->name, __entry->count)
+);
+
+TRACE_EVENT(nvhost_wait_cdma,
+ TP_PROTO(const char *name, u32 eventid),
+
+ TP_ARGS(name, eventid),
+
+ TP_STRUCT__entry(
+ __field(const char *, name)
+ __field(u32, eventid)
+ ),
+
+ TP_fast_assign(
+ __entry->name = name;
+ __entry->eventid = eventid;
+ ),
+
+ TP_printk("name=%s, event=%d", __entry->name, __entry->eventid)
+);
+
+#endif /* _TRACE_NVHOST_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>