This source file includes following definitions.
- nvkm_client_unmap
- nvkm_client_map
- nvkm_client_ioctl
- nvkm_client_resume
- nvkm_client_suspend
- nvkm_client_ntfy
- nvkm_client_driver_init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 #include <core/client.h>
30 #include <core/notify.h>
31 #include <core/ioctl.h>
32
33 #include <nvif/client.h>
34 #include <nvif/driver.h>
35 #include <nvif/notify.h>
36 #include <nvif/event.h>
37 #include <nvif/ioctl.h>
38
39 #include "nouveau_drv.h"
40 #include "nouveau_usif.h"
41
42 static void
43 nvkm_client_unmap(void *priv, void __iomem *ptr, u32 size)
44 {
45 iounmap(ptr);
46 }
47
48 static void __iomem *
49 nvkm_client_map(void *priv, u64 handle, u32 size)
50 {
51 return ioremap(handle, size);
52 }
53
54 static int
55 nvkm_client_ioctl(void *priv, bool super, void *data, u32 size, void **hack)
56 {
57 return nvkm_ioctl(priv, super, data, size, hack);
58 }
59
60 static int
61 nvkm_client_resume(void *priv)
62 {
63 struct nvkm_client *client = priv;
64 return nvkm_object_init(&client->object);
65 }
66
67 static int
68 nvkm_client_suspend(void *priv)
69 {
70 struct nvkm_client *client = priv;
71 return nvkm_object_fini(&client->object, true);
72 }
73
74 static int
75 nvkm_client_ntfy(const void *header, u32 length, const void *data, u32 size)
76 {
77 const union {
78 struct nvif_notify_req_v0 v0;
79 } *args = header;
80 u8 route;
81
82 if (length == sizeof(args->v0) && args->v0.version == 0) {
83 route = args->v0.route;
84 } else {
85 WARN_ON(1);
86 return NVKM_NOTIFY_DROP;
87 }
88
89 switch (route) {
90 case NVDRM_NOTIFY_NVIF:
91 return nvif_notify(header, length, data, size);
92 case NVDRM_NOTIFY_USIF:
93 return usif_notify(header, length, data, size);
94 default:
95 WARN_ON(1);
96 break;
97 }
98
99 return NVKM_NOTIFY_DROP;
100 }
101
102 static int
103 nvkm_client_driver_init(const char *name, u64 device, const char *cfg,
104 const char *dbg, void **ppriv)
105 {
106 return nvkm_client_new(name, device, cfg, dbg, nvkm_client_ntfy,
107 (struct nvkm_client **)ppriv);
108 }
109
110 const struct nvif_driver
111 nvif_driver_nvkm = {
112 .name = "nvkm",
113 .init = nvkm_client_driver_init,
114 .suspend = nvkm_client_suspend,
115 .resume = nvkm_client_resume,
116 .ioctl = nvkm_client_ioctl,
117 .map = nvkm_client_map,
118 .unmap = nvkm_client_unmap,
119 .keep = false,
120 };