2 * drivers/video/tegra/host/chip_support.h
4 * Tegra Graphics Host Chip Support
6 * Copyright (c) 2011-2012, NVIDIA Corporation.
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef _NVHOST_CHIP_SUPPORT_H_
21 #define _NVHOST_CHIP_SUPPORT_H_
23 #include <linux/types.h>
31 struct nvhost_userctx_timeout;
32 struct nvhost_channel;
40 struct nvhost_intr_syncpt;
44 struct nvhost_chip_support {
46 int (*init)(struct nvhost_channel *,
47 struct nvhost_master *,
49 int (*submit)(struct nvhost_job *job);
50 int (*read3dreg)(struct nvhost_channel *channel,
51 struct nvhost_hwctx *hwctx,
57 void (*start)(struct nvhost_cdma *);
58 void (*stop)(struct nvhost_cdma *);
59 void (*kick)(struct nvhost_cdma *);
60 int (*timeout_init)(struct nvhost_cdma *,
62 void (*timeout_destroy)(struct nvhost_cdma *);
63 void (*timeout_teardown_begin)(struct nvhost_cdma *);
64 void (*timeout_teardown_end)(struct nvhost_cdma *,
66 void (*timeout_cpu_incr)(struct nvhost_cdma *,
74 void (*reset)(struct push_buffer *);
75 int (*init)(struct push_buffer *);
76 void (*destroy)(struct push_buffer *);
77 void (*push_to)(struct push_buffer *,
78 struct mem_mgr *, struct mem_handle *,
80 void (*pop_from)(struct push_buffer *,
82 u32 (*space)(struct push_buffer *);
83 u32 (*putptr)(struct push_buffer *);
87 void (*debug_init)(struct dentry *de);
88 void (*show_channel_cdma)(struct nvhost_master *,
89 struct nvhost_channel *,
92 void (*show_channel_fifo)(struct nvhost_master *,
93 struct nvhost_channel *,
96 void (*show_mlocks)(struct nvhost_master *m,
102 void (*reset)(struct nvhost_syncpt *, u32 id);
103 void (*reset_wait_base)(struct nvhost_syncpt *, u32 id);
104 void (*read_wait_base)(struct nvhost_syncpt *, u32 id);
105 u32 (*update_min)(struct nvhost_syncpt *, u32 id);
106 void (*cpu_incr)(struct nvhost_syncpt *, u32 id);
107 int (*patch_wait)(struct nvhost_syncpt *sp,
109 void (*debug)(struct nvhost_syncpt *);
110 const char * (*name)(struct nvhost_syncpt *, u32 id);
111 int (*mutex_try_lock)(struct nvhost_syncpt *,
113 void (*mutex_unlock)(struct nvhost_syncpt *,
118 void (*init_host_sync)(struct nvhost_intr *);
119 void (*set_host_clocks_per_usec)(
120 struct nvhost_intr *, u32 clocks);
121 void (*set_syncpt_threshold)(
122 struct nvhost_intr *, u32 id, u32 thresh);
123 void (*enable_syncpt_intr)(struct nvhost_intr *, u32 id);
124 void (*disable_all_syncpt_intrs)(struct nvhost_intr *);
125 int (*request_host_general_irq)(struct nvhost_intr *);
126 void (*free_host_general_irq)(struct nvhost_intr *);
127 int (*request_syncpt_irq)(struct nvhost_intr_syncpt *syncpt);
131 struct nvhost_device *(*get_nvhost_device)(char *name);
132 struct nvhost_channel *(*alloc_nvhost_channel)(int chid);
133 void (*free_nvhost_channel)(struct nvhost_channel *ch);
137 struct mem_mgr *(*alloc_mgr)(void);
138 void (*put_mgr)(struct mem_mgr *);
139 struct mem_mgr *(*get_mgr)(struct mem_mgr *);
140 struct mem_mgr *(*get_mgr_file)(int fd);
141 struct mem_handle *(*alloc)(struct mem_mgr *,
142 size_t size, size_t align,
144 struct mem_handle *(*get)(struct mem_mgr *, u32 id);
145 void (*put)(struct mem_mgr *, struct mem_handle *);
146 phys_addr_t (*pin)(struct mem_mgr *, struct mem_handle *);
147 void (*unpin)(struct mem_mgr *, struct mem_handle *);
148 void *(*mmap)(struct mem_handle *);
149 void (*munmap)(struct mem_handle *, void *);
153 struct nvhost_chip_support *nvhost_get_chip_ops(void);
155 #define host_device_op() nvhost_get_chip_ops()->nvhost_dev
156 #define channel_cdma_op() nvhost_get_chip_ops()->cdma
157 #define channel_op() nvhost_get_chip_ops()->channel
158 #define syncpt_op() nvhost_get_chip_ops()->syncpt
159 #define intr_op() nvhost_get_chip_ops()->intr
160 #define cdma_op() nvhost_get_chip_ops()->cdma
161 #define cdma_pb_op() nvhost_get_chip_ops()->push_buffer
162 #define mem_op() (nvhost_get_chip_ops()->mem)
164 int nvhost_init_chip_support(struct nvhost_master *host);
166 #endif /* _NVHOST_CHIP_SUPPORT_H_ */