xref: /openbmc/linux/drivers/gpu/drm/nouveau/include/nvif/event.h (revision f43e47c090dc7fe32d5410d8740c3a004eb2676f)
1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVIF_EVENT_H__
3 #define __NVIF_EVENT_H__
4 #include <nvif/object.h>
5 #include <nvif/if000e.h>
6 struct nvif_event;
7 
8 #define NVIF_EVENT_KEEP 0
9 #define NVIF_EVENT_DROP 1
10 typedef int (*nvif_event_func)(struct nvif_event *, void *repv, u32 repc);
11 
12 struct nvif_event {
13 	struct nvif_object object;
14 	nvif_event_func func;
15 };
16 
17 static inline bool
18 nvif_event_constructed(struct nvif_event *event)
19 {
20 	return nvif_object_constructed(&event->object);
21 }
22 
23 int nvif_event_ctor_(struct nvif_object *, const char *, u32, nvif_event_func, bool,
24 		     struct nvif_event_v0 *, u32, bool, struct nvif_event *);
25 
26 static inline int
27 nvif_event_ctor(struct nvif_object *parent, const char *name, u32 handle, nvif_event_func func,
28 		bool wait, struct nvif_event_v0 *args, u32 argc, struct nvif_event *event)
29 {
30 	return nvif_event_ctor_(parent, name, handle, func, wait, args, argc, true, event);
31 }
32 
33 void nvif_event_dtor(struct nvif_event *);
34 int nvif_event_allow(struct nvif_event *);
35 int nvif_event_block(struct nvif_event *);
36 
37 struct nvif_notify_req_v0 {
38 	__u8  version;
39 	__u8  reply;
40 	__u8  pad02[5];
41 #define NVIF_NOTIFY_V0_ROUTE_NVIF                                          0x00
42 	__u8  route;
43 	__u64 token;	/* must be unique */
44 	__u8  data[];	/* request data (below) */
45 };
46 
47 struct nvif_notify_rep_v0 {
48 	__u8  version;
49 	__u8  pad01[6];
50 	__u8  route;
51 	__u64 token;
52 	__u8  data[];	/* reply data (below) */
53 };
54 
55 struct nvif_notify_head_req_v0 {
56 	/* nvif_notify_req ... */
57 	__u8  version;
58 	__u8  head;
59 	__u8  pad02[6];
60 };
61 
62 struct nvif_notify_head_rep_v0 {
63 	/* nvif_notify_rep ... */
64 	__u8  version;
65 	__u8  pad01[7];
66 };
67 
68 struct nvif_notify_conn_req_v0 {
69 	/* nvif_notify_req ... */
70 	__u8  version;
71 #define NVIF_NOTIFY_CONN_V0_PLUG                                           0x01
72 #define NVIF_NOTIFY_CONN_V0_UNPLUG                                         0x02
73 #define NVIF_NOTIFY_CONN_V0_IRQ                                            0x04
74 #define NVIF_NOTIFY_CONN_V0_ANY                                            0x07
75 	__u8  mask;
76 	__u8  conn;
77 	__u8  pad03[5];
78 };
79 
80 struct nvif_notify_conn_rep_v0 {
81 	/* nvif_notify_rep ... */
82 	__u8  version;
83 	__u8  mask;
84 	__u8  pad02[6];
85 };
86 
87 struct nvif_notify_uevent_req {
88 	/* nvif_notify_req ... */
89 };
90 
91 struct nvif_notify_uevent_rep {
92 	/* nvif_notify_rep ... */
93 };
94 
95 #endif
96