1#ifndef __NVIF_DEVICE_H__
2#define __NVIF_DEVICE_H__
3
4#include <nvif/object.h>
5#include <nvif/cl0080.h>
6
7struct nvif_device {
8 struct nvif_object object;
9 struct nv_device_info_v0 info;
10};
11
12int nvif_device_init(struct nvif_object *, u32 handle, s32 oclass, void *, u32,
13 struct nvif_device *);
14void nvif_device_fini(struct nvif_device *);
15u64 nvif_device_time(struct nvif_device *);
16
17
18
19
20
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)
37
38
39#include <subdev/bios.h>
40#include <subdev/fb.h>
41#include <subdev/mmu.h>
42#include <subdev/bar.h>
43#include <subdev/gpio.h>
44#include <subdev/clk.h>
45#include <subdev/i2c.h>
46#include <subdev/timer.h>
47#include <subdev/therm.h>
48#include <subdev/pci.h>
49
50#define nvxx_device(a) ({ \
51 struct nvif_device *_device = (a); \
52 struct { \
53 struct nvkm_object object; \
54 struct nvkm_device *device; \
55 } *_udevice = _device->object.priv; \
56 _udevice->device; \
57})
58#define nvxx_bios(a) nvxx_device(a)->bios
59#define nvxx_fb(a) nvxx_device(a)->fb
60#define nvxx_mmu(a) nvxx_device(a)->mmu
61#define nvxx_bar(a) nvxx_device(a)->bar
62#define nvxx_gpio(a) nvxx_device(a)->gpio
63#define nvxx_clk(a) nvxx_device(a)->clk
64#define nvxx_i2c(a) nvxx_device(a)->i2c
65#define nvxx_iccsense(a) nvxx_device(a)->iccsense
66#define nvxx_therm(a) nvxx_device(a)->therm
67#define nvxx_volt(a) nvxx_device(a)->volt
68
69#include <core/device.h>
70#include <engine/fifo.h>
71#include <engine/gr.h>
72#include <engine/sw.h>
73
74#define nvxx_fifo(a) nvxx_device(a)->fifo
75#define nvxx_gr(a) nvxx_device(a)->gr
76#endif
77