Commit | Line | Data |
---|---|---|
a04d0423 BS |
1 | #ifndef __NVIF_DEVICE_H__ |
2 | #define __NVIF_DEVICE_H__ | |
3 | ||
c39f472e BS |
4 | #include <nvif/object.h> |
5 | #include <nvif/class.h> | |
a04d0423 BS |
6 | |
7 | struct nvif_device { | |
a01ca78c | 8 | struct nvif_object object; |
a04d0423 BS |
9 | struct nv_device_info_v0 info; |
10 | }; | |
11 | ||
a01ca78c | 12 | int nvif_device_init(struct nvif_object *, u32 handle, u32 oclass, void *, u32, |
a04d0423 BS |
13 | struct nvif_device *); |
14 | void nvif_device_fini(struct nvif_device *); | |
56f67dc1 BS |
15 | u64 nvif_device_time(struct nvif_device *); |
16 | ||
17 | /* Delay based on GPU time (ie. PTIMER). | |
18 | * | |
19 | * Will return -ETIMEDOUT unless the loop was terminated with 'break', | |
20 | * where it will return the number of nanoseconds taken instead. | |
21 | */ | |
22 | #define nvif_nsec(d,n,cond...) ({ \ | |
23 | struct nvif_device *_device = (d); \ | |
24 | u64 _nsecs = (n), _time0 = nvif_device_time(_device); \ | |
25 | s64 _taken = 0; \ | |
26 | \ | |
27 | do { \ | |
28 | cond \ | |
29 | } while (_taken = nvif_device_time(_device) - _time0, _taken < _nsecs);\ | |
30 | \ | |
31 | if (_taken >= _nsecs) \ | |
32 | _taken = -ETIMEDOUT; \ | |
33 | _taken; \ | |
34 | }) | |
35 | #define nvif_usec(d,u,cond...) nvif_nsec((d), (u) * 1000, ##cond) | |
36 | #define nvif_msec(d,m,cond...) nvif_usec((d), (m) * 1000, ##cond) | |
a04d0423 BS |
37 | |
38 | /*XXX*/ | |
39 | #include <subdev/bios.h> | |
40 | #include <subdev/fb.h> | |
5ce3bf3c | 41 | #include <subdev/mmu.h> |
a04d0423 BS |
42 | #include <subdev/bar.h> |
43 | #include <subdev/gpio.h> | |
f3867f43 | 44 | #include <subdev/clk.h> |
a04d0423 BS |
45 | #include <subdev/i2c.h> |
46 | #include <subdev/timer.h> | |
47 | #include <subdev/therm.h> | |
48 | ||
a01ca78c BS |
49 | #define nvxx_device(a) ({ \ |
50 | struct nvif_device *_device = (a); \ | |
51 | nv_device(_device->object.priv); \ | |
52 | }) | |
be83cd4e BS |
53 | #define nvxx_bios(a) nvkm_bios(nvxx_device(a)) |
54 | #define nvxx_fb(a) nvkm_fb(nvxx_device(a)) | |
55 | #define nvxx_mmu(a) nvkm_mmu(nvxx_device(a)) | |
56 | #define nvxx_bar(a) nvkm_bar(nvxx_device(a)) | |
57 | #define nvxx_gpio(a) nvkm_gpio(nvxx_device(a)) | |
58 | #define nvxx_clk(a) nvkm_clk(nvxx_device(a)) | |
59 | #define nvxx_i2c(a) nvkm_i2c(nvxx_device(a)) | |
60 | #define nvxx_timer(a) nvkm_timer(nvxx_device(a)) | |
be83cd4e | 61 | #define nvxx_therm(a) nvkm_therm(nvxx_device(a)) |
a04d0423 | 62 | |
9719047b | 63 | #include <core/device.h> |
a04d0423 | 64 | #include <engine/fifo.h> |
b8bf04e1 | 65 | #include <engine/gr.h> |
8700287b | 66 | #include <engine/sw.h> |
a04d0423 | 67 | |
be83cd4e BS |
68 | #define nvxx_fifo(a) nvkm_fifo(nvxx_device(a)) |
69 | #define nvxx_fifo_chan(a) ((struct nvkm_fifo_chan *)nvxx_object(a)) | |
a01ca78c | 70 | #define nvxx_gr(a) nvkm_gr(nvxx_device(a)) |
a04d0423 | 71 | #endif |