2014-08-10 02:10:21 +08:00
|
|
|
#ifndef __NVIF_DEVICE_H__
|
|
|
|
#define __NVIF_DEVICE_H__
|
|
|
|
|
2015-01-13 20:13:14 +08:00
|
|
|
#include <nvif/object.h>
|
2015-11-08 10:23:16 +08:00
|
|
|
#include <nvif/cl0080.h>
|
2014-08-10 02:10:21 +08:00
|
|
|
|
|
|
|
struct nvif_device {
|
2015-08-20 12:54:15 +08:00
|
|
|
struct nvif_object object;
|
2014-08-10 02:10:21 +08:00
|
|
|
struct nv_device_info_v0 info;
|
|
|
|
};
|
|
|
|
|
2015-08-20 12:54:16 +08:00
|
|
|
int nvif_device_init(struct nvif_object *, u32 handle, s32 oclass, void *, u32,
|
2014-08-10 02:10:21 +08:00
|
|
|
struct nvif_device *);
|
|
|
|
void nvif_device_fini(struct nvif_device *);
|
2015-08-20 12:54:10 +08:00
|
|
|
u64 nvif_device_time(struct nvif_device *);
|
|
|
|
|
|
|
|
/* Delay based on GPU time (ie. PTIMER).
|
|
|
|
*
|
|
|
|
* Will return -ETIMEDOUT unless the loop was terminated with 'break',
|
|
|
|
* where it will return the number of nanoseconds taken instead.
|
|
|
|
*/
|
|
|
|
#define nvif_nsec(d,n,cond...) ({ \
|
|
|
|
struct nvif_device *_device = (d); \
|
|
|
|
u64 _nsecs = (n), _time0 = nvif_device_time(_device); \
|
|
|
|
s64 _taken = 0; \
|
|
|
|
\
|
|
|
|
do { \
|
|
|
|
cond \
|
|
|
|
} while (_taken = nvif_device_time(_device) - _time0, _taken < _nsecs);\
|
|
|
|
\
|
|
|
|
if (_taken >= _nsecs) \
|
|
|
|
_taken = -ETIMEDOUT; \
|
|
|
|
_taken; \
|
|
|
|
})
|
|
|
|
#define nvif_usec(d,u,cond...) nvif_nsec((d), (u) * 1000, ##cond)
|
|
|
|
#define nvif_msec(d,m,cond...) nvif_usec((d), (m) * 1000, ##cond)
|
2014-08-10 02:10:21 +08:00
|
|
|
|
|
|
|
/*XXX*/
|
|
|
|
#include <subdev/bios.h>
|
|
|
|
#include <subdev/fb.h>
|
2015-01-14 07:57:36 +08:00
|
|
|
#include <subdev/mmu.h>
|
2014-08-10 02:10:21 +08:00
|
|
|
#include <subdev/bar.h>
|
|
|
|
#include <subdev/gpio.h>
|
2015-01-13 21:37:38 +08:00
|
|
|
#include <subdev/clk.h>
|
2014-08-10 02:10:21 +08:00
|
|
|
#include <subdev/i2c.h>
|
|
|
|
#include <subdev/timer.h>
|
|
|
|
#include <subdev/therm.h>
|
2015-08-20 12:54:23 +08:00
|
|
|
#include <subdev/pci.h>
|
2014-08-10 02:10:21 +08:00
|
|
|
|
2015-08-20 12:54:15 +08:00
|
|
|
#define nvxx_device(a) ({ \
|
|
|
|
struct nvif_device *_device = (a); \
|
2015-08-20 12:54:22 +08:00
|
|
|
struct { \
|
|
|
|
struct nvkm_object object; \
|
|
|
|
struct nvkm_device *device; \
|
|
|
|
} *_udevice = _device->object.priv; \
|
|
|
|
_udevice->device; \
|
2015-08-20 12:54:15 +08:00
|
|
|
})
|
2015-08-20 12:54:20 +08:00
|
|
|
#define nvxx_bios(a) nvxx_device(a)->bios
|
2015-08-20 12:54:20 +08:00
|
|
|
#define nvxx_fb(a) nvxx_device(a)->fb
|
2015-08-20 12:54:21 +08:00
|
|
|
#define nvxx_mmu(a) nvxx_device(a)->mmu
|
2015-08-20 12:54:20 +08:00
|
|
|
#define nvxx_bar(a) nvxx_device(a)->bar
|
2015-08-20 12:54:20 +08:00
|
|
|
#define nvxx_gpio(a) nvxx_device(a)->gpio
|
2015-08-20 12:54:20 +08:00
|
|
|
#define nvxx_clk(a) nvxx_device(a)->clk
|
2015-08-20 12:54:20 +08:00
|
|
|
#define nvxx_i2c(a) nvxx_device(a)->i2c
|
2016-02-19 03:10:19 +08:00
|
|
|
#define nvxx_iccsense(a) nvxx_device(a)->iccsense
|
2015-08-20 12:54:21 +08:00
|
|
|
#define nvxx_therm(a) nvxx_device(a)->therm
|
2015-09-20 20:40:27 +08:00
|
|
|
#define nvxx_volt(a) nvxx_device(a)->volt
|
2014-08-10 02:10:21 +08:00
|
|
|
|
2015-01-14 13:35:00 +08:00
|
|
|
#include <core/device.h>
|
2014-08-10 02:10:21 +08:00
|
|
|
#include <engine/fifo.h>
|
2015-01-14 10:02:28 +08:00
|
|
|
#include <engine/gr.h>
|
2015-01-14 10:34:00 +08:00
|
|
|
#include <engine/sw.h>
|
2014-08-10 02:10:21 +08:00
|
|
|
|
2015-08-20 12:54:19 +08:00
|
|
|
#define nvxx_fifo(a) nvxx_device(a)->fifo
|
2015-08-20 12:54:19 +08:00
|
|
|
#define nvxx_gr(a) nvxx_device(a)->gr
|
2014-08-10 02:10:21 +08:00
|
|
|
#endif
|