]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/gpu/drm/nouveau/include/nvif/device.h
drm/nouveau/mmu: remove old vmm frontend
[mirror_ubuntu-bionic-kernel.git] / drivers / gpu / drm / nouveau / include / nvif / device.h
CommitLineData
a04d0423
BS
1#ifndef __NVIF_DEVICE_H__
2#define __NVIF_DEVICE_H__
3
c39f472e 4#include <nvif/object.h>
923bc416 5#include <nvif/cl0080.h>
a04d0423
BS
6
7struct nvif_device {
a01ca78c 8 struct nvif_object object;
a04d0423
BS
9 struct nv_device_info_v0 info;
10};
11
315a8b2e 12int nvif_device_init(struct nvif_object *, u32 handle, s32 oclass, void *, u32,
a04d0423
BS
13 struct nvif_device *);
14void nvif_device_fini(struct nvif_device *);
56f67dc1
BS
15u64 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>
a04d0423
BS
41#include <subdev/bar.h>
42#include <subdev/gpio.h>
f3867f43 43#include <subdev/clk.h>
a04d0423
BS
44#include <subdev/i2c.h>
45#include <subdev/timer.h>
46#include <subdev/therm.h>
340b0e7c 47#include <subdev/pci.h>
a04d0423 48
a01ca78c
BS
49#define nvxx_device(a) ({ \
50 struct nvif_device *_device = (a); \
68f3f702
BS
51 struct { \
52 struct nvkm_object object; \
53 struct nvkm_device *device; \
54 } *_udevice = _device->object.priv; \
55 _udevice->device; \
a01ca78c 56})
46484438 57#define nvxx_bios(a) nvxx_device(a)->bios
03c8952f 58#define nvxx_fb(a) nvxx_device(a)->fb
2ea7249f 59#define nvxx_gpio(a) nvxx_device(a)->gpio
6625f55c 60#define nvxx_clk(a) nvxx_device(a)->clk
49bd8da5 61#define nvxx_i2c(a) nvxx_device(a)->i2c
353b9834 62#define nvxx_iccsense(a) nvxx_device(a)->iccsense
57113c01 63#define nvxx_therm(a) nvxx_device(a)->therm
2e7db87d 64#define nvxx_volt(a) nvxx_device(a)->volt
a04d0423 65
a04d0423 66#include <engine/fifo.h>
b8bf04e1 67#include <engine/gr.h>
a04d0423 68
8f0649b5 69#define nvxx_fifo(a) nvxx_device(a)->fifo
27f3d6cf 70#define nvxx_gr(a) nvxx_device(a)->gr
a04d0423 71#endif