18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: MIT */
28c2ecf20Sopenharmony_ci#ifndef __NVIF_DEVICE_H__
38c2ecf20Sopenharmony_ci#define __NVIF_DEVICE_H__
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <nvif/object.h>
68c2ecf20Sopenharmony_ci#include <nvif/cl0080.h>
78c2ecf20Sopenharmony_ci#include <nvif/user.h>
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_cistruct nvif_device {
108c2ecf20Sopenharmony_ci	struct nvif_object object;
118c2ecf20Sopenharmony_ci	struct nv_device_info_v0 info;
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci	struct nvif_fifo_runlist {
148c2ecf20Sopenharmony_ci		u64 engines;
158c2ecf20Sopenharmony_ci	} *runlist;
168c2ecf20Sopenharmony_ci	int runlists;
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci	struct nvif_user user;
198c2ecf20Sopenharmony_ci};
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ciint  nvif_device_ctor(struct nvif_object *, const char *name, u32 handle,
228c2ecf20Sopenharmony_ci		      s32 oclass, void *, u32, struct nvif_device *);
238c2ecf20Sopenharmony_civoid nvif_device_dtor(struct nvif_device *);
248c2ecf20Sopenharmony_ciu64  nvif_device_time(struct nvif_device *);
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/*XXX*/
278c2ecf20Sopenharmony_ci#include <subdev/bios.h>
288c2ecf20Sopenharmony_ci#include <subdev/fb.h>
298c2ecf20Sopenharmony_ci#include <subdev/bar.h>
308c2ecf20Sopenharmony_ci#include <subdev/gpio.h>
318c2ecf20Sopenharmony_ci#include <subdev/clk.h>
328c2ecf20Sopenharmony_ci#include <subdev/i2c.h>
338c2ecf20Sopenharmony_ci#include <subdev/timer.h>
348c2ecf20Sopenharmony_ci#include <subdev/therm.h>
358c2ecf20Sopenharmony_ci#include <subdev/pci.h>
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#define nvxx_device(a) ({                                                      \
388c2ecf20Sopenharmony_ci	struct nvif_device *_device = (a);                                     \
398c2ecf20Sopenharmony_ci	struct {                                                               \
408c2ecf20Sopenharmony_ci		struct nvkm_object object;                                     \
418c2ecf20Sopenharmony_ci		struct nvkm_device *device;                                    \
428c2ecf20Sopenharmony_ci	} *_udevice = _device->object.priv;                                    \
438c2ecf20Sopenharmony_ci	_udevice->device;                                                      \
448c2ecf20Sopenharmony_ci})
458c2ecf20Sopenharmony_ci#define nvxx_bios(a) nvxx_device(a)->bios
468c2ecf20Sopenharmony_ci#define nvxx_fb(a) nvxx_device(a)->fb
478c2ecf20Sopenharmony_ci#define nvxx_gpio(a) nvxx_device(a)->gpio
488c2ecf20Sopenharmony_ci#define nvxx_clk(a) nvxx_device(a)->clk
498c2ecf20Sopenharmony_ci#define nvxx_i2c(a) nvxx_device(a)->i2c
508c2ecf20Sopenharmony_ci#define nvxx_iccsense(a) nvxx_device(a)->iccsense
518c2ecf20Sopenharmony_ci#define nvxx_therm(a) nvxx_device(a)->therm
528c2ecf20Sopenharmony_ci#define nvxx_volt(a) nvxx_device(a)->volt
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#include <engine/fifo.h>
558c2ecf20Sopenharmony_ci#include <engine/gr.h>
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci#define nvxx_gr(a) nvxx_device(a)->gr
588c2ecf20Sopenharmony_ci#endif
59