1/* SPDX-License-Identifier: MIT */
2#ifndef __NVIF_DEVICE_H__
3#define __NVIF_DEVICE_H__
4
5#include <nvif/object.h>
6#include <nvif/cl0080.h>
7#include <nvif/user.h>
8
9struct nvif_device {
10	struct nvif_object object;
11	struct nv_device_info_v0 info;
12
13	struct nvif_fifo_runlist {
14		u64 engines;
15	} *runlist;
16	int runlists;
17
18	struct nvif_user user;
19};
20
21int  nvif_device_ctor(struct nvif_object *, const char *name, u32 handle,
22		      s32 oclass, void *, u32, struct nvif_device *);
23void nvif_device_dtor(struct nvif_device *);
24u64  nvif_device_time(struct nvif_device *);
25
26/*XXX*/
27#include <subdev/bios.h>
28#include <subdev/fb.h>
29#include <subdev/bar.h>
30#include <subdev/gpio.h>
31#include <subdev/clk.h>
32#include <subdev/i2c.h>
33#include <subdev/timer.h>
34#include <subdev/therm.h>
35#include <subdev/pci.h>
36
37#define nvxx_device(a) ({                                                      \
38	struct nvif_device *_device = (a);                                     \
39	struct {                                                               \
40		struct nvkm_object object;                                     \
41		struct nvkm_device *device;                                    \
42	} *_udevice = _device->object.priv;                                    \
43	_udevice->device;                                                      \
44})
45#define nvxx_bios(a) nvxx_device(a)->bios
46#define nvxx_fb(a) nvxx_device(a)->fb
47#define nvxx_gpio(a) nvxx_device(a)->gpio
48#define nvxx_clk(a) nvxx_device(a)->clk
49#define nvxx_i2c(a) nvxx_device(a)->i2c
50#define nvxx_iccsense(a) nvxx_device(a)->iccsense
51#define nvxx_therm(a) nvxx_device(a)->therm
52#define nvxx_volt(a) nvxx_device(a)->volt
53
54#include <engine/fifo.h>
55#include <engine/gr.h>
56
57#define nvxx_gr(a) nvxx_device(a)->gr
58#endif
59