xref: /netbsd-src/sys/external/bsd/drm2/dist/drm/nouveau/include/nvif/notify.h (revision 8ecbf5f02b752fcb7debe1a8fab1dc82602bc760)
1 /*	$NetBSD: notify.h,v 1.2 2018/08/27 04:58:30 riastradh Exp $	*/
2 
3 #ifndef __NVIF_NOTIFY_H__
4 #define __NVIF_NOTIFY_H__
5 
6 struct nvif_notify {
7 	struct nvif_object *object;
8 	int index;
9 
10 #define NVIF_NOTIFY_USER 0
11 #define NVIF_NOTIFY_WORK 1
12 	unsigned long flags;
13 	atomic_t putcnt;
14 	void (*dtor)(struct nvif_notify *);
15 #define NVIF_NOTIFY_DROP 0
16 #define NVIF_NOTIFY_KEEP 1
17 	int  (*func)(struct nvif_notify *);
18 
19 	/* this is const for a *very* good reason - the data might be on the
20 	 * stack from an irq handler.  if you're not nvif/notify.c then you
21 	 * should probably think twice before casting it away...
22 	 */
23 	const void *data;
24 	u32 size;
25 	struct work_struct work;
26 };
27 
28 int  nvif_notify_init(struct nvif_object *, int (*func)(struct nvif_notify *),
29 		      bool work, u8 type, void *data, u32 size, u32 reply,
30 		      struct nvif_notify *);
31 int  nvif_notify_fini(struct nvif_notify *);
32 int  nvif_notify_get(struct nvif_notify *);
33 int  nvif_notify_put(struct nvif_notify *);
34 int  nvif_notify(const void *, u32, const void *, u32);
35 #endif
36