1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVIF_IOCTL_H__
3 #define __NVIF_IOCTL_H__
4 
5 struct nvif_ioctl_v0 {
6 	/* New members MUST be added within the struct_group() macro below. */
7 	struct_group_tagged(nvif_ioctl_v0_hdr, __hdr,
8 		__u8  version;
9 #define NVIF_IOCTL_V0_SCLASS                                               0x01
10 #define NVIF_IOCTL_V0_NEW                                                  0x02
11 #define NVIF_IOCTL_V0_DEL                                                  0x03
12 #define NVIF_IOCTL_V0_MTHD                                                 0x04
13 #define NVIF_IOCTL_V0_MAP                                                  0x07
14 #define NVIF_IOCTL_V0_UNMAP                                                0x08
15 		__u8  type;
16 		__u8  pad02[4];
17 #define NVIF_IOCTL_V0_OWNER_NVIF                                           0x00
18 #define NVIF_IOCTL_V0_OWNER_ANY                                            0xff
19 		__u8  owner;
20 #define NVIF_IOCTL_V0_ROUTE_NVIF                                           0x00
21 #define NVIF_IOCTL_V0_ROUTE_HIDDEN                                         0xff
22 		__u8  route;
23 		__u64 token;
24 		__u64 object;
25 	);
26 	__u8  data[];		/* ioctl data (below) */
27 };
28 static_assert(offsetof(struct nvif_ioctl_v0, data) == sizeof(struct nvif_ioctl_v0_hdr),
29 	      "struct member likely outside of struct_group()");
30 
31 struct nvif_ioctl_sclass_v0 {
32 	/* nvif_ioctl ... */
33 	__u8  version;
34 	__u8  count;
35 	__u8  pad02[6];
36 	struct nvif_ioctl_sclass_oclass_v0 {
37 		__s32 oclass;
38 		__s16 minver;
39 		__s16 maxver;
40 	} oclass[];
41 };
42 
43 struct nvif_ioctl_new_v0 {
44 	/* nvif_ioctl ... */
45 	__u8  version;
46 	__u8  pad01[6];
47 	__u8  route;
48 	__u64 token;
49 	__u64 object;
50 	__u32 handle;
51 	__s32 oclass;
52 	__u8  data[];		/* class data (class.h) */
53 };
54 
55 struct nvif_ioctl_del {
56 };
57 
58 struct nvif_ioctl_mthd_v0 {
59 	/* New members MUST be added within the struct_group() macro below. */
60 	struct_group_tagged(nvif_ioctl_mthd_v0_hdr, __hdr,
61 		/* nvif_ioctl ... */
62 		__u8  version;
63 		__u8  method;
64 		__u8  pad02[6];
65 	);
66 	__u8  data[];		/* method data (class.h) */
67 };
68 static_assert(offsetof(struct nvif_ioctl_mthd_v0, data) == sizeof(struct nvif_ioctl_mthd_v0_hdr),
69 	      "struct member likely outside of struct_group()");
70 
71 struct nvif_ioctl_map_v0 {
72 	/* nvif_ioctl ... */
73 	__u8  version;
74 #define NVIF_IOCTL_MAP_V0_IO                                               0x00
75 #define NVIF_IOCTL_MAP_V0_VA                                               0x01
76 	__u8  type;
77 	__u8  pad02[6];
78 	__u64 handle;
79 	__u64 length;
80 	__u8  data[];
81 };
82 
83 struct nvif_ioctl_unmap {
84 };
85 #endif
86