]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/gpu/drm/nouveau/include/nvif/device.h
drm/nouveau/kms/nv04: fix incorrect use of register accessors
[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
BS
4#include <nvif/object.h>
5#include <nvif/class.h>
a04d0423
BS
6
7struct nvif_device {
8 struct nvif_object base;
9 struct nvif_object *object; /*XXX: hack for nvif_object() */
10 struct nv_device_info_v0 info;
11};
12
13static inline struct nvif_device *
14nvif_device(struct nvif_object *object)
15{
16 while (object && object->oclass != 0x0080 /*XXX: NV_DEVICE_CLASS*/ )
17 object = object->parent;
18 return (void *)object;
19}
20
21int nvif_device_init(struct nvif_object *, void (*dtor)(struct nvif_device *),
22 u32 handle, u32 oclass, void *, u32,
23 struct nvif_device *);
24void nvif_device_fini(struct nvif_device *);
25int nvif_device_new(struct nvif_object *, u32 handle, u32 oclass,
26 void *, u32, struct nvif_device **);
27void nvif_device_ref(struct nvif_device *, struct nvif_device **);
28
29/*XXX*/
30#include <subdev/bios.h>
31#include <subdev/fb.h>
5ce3bf3c 32#include <subdev/mmu.h>
a04d0423
BS
33#include <subdev/bar.h>
34#include <subdev/gpio.h>
f3867f43 35#include <subdev/clk.h>
a04d0423
BS
36#include <subdev/i2c.h>
37#include <subdev/timer.h>
38#include <subdev/therm.h>
39
989aa5b7 40#define nvxx_device(a) nv_device(nvxx_object((a)))
be83cd4e
BS
41#define nvxx_bios(a) nvkm_bios(nvxx_device(a))
42#define nvxx_fb(a) nvkm_fb(nvxx_device(a))
43#define nvxx_mmu(a) nvkm_mmu(nvxx_device(a))
44#define nvxx_bar(a) nvkm_bar(nvxx_device(a))
45#define nvxx_gpio(a) nvkm_gpio(nvxx_device(a))
46#define nvxx_clk(a) nvkm_clk(nvxx_device(a))
47#define nvxx_i2c(a) nvkm_i2c(nvxx_device(a))
48#define nvxx_timer(a) nvkm_timer(nvxx_device(a))
989aa5b7
BS
49#define nvxx_wait(a,b,c,d) nv_wait(nvxx_timer(a), (b), (c), (d))
50#define nvxx_wait_cb(a,b,c) nv_wait_cb(nvxx_timer(a), (b), (c))
be83cd4e 51#define nvxx_therm(a) nvkm_therm(nvxx_device(a))
a04d0423 52
9719047b 53#include <core/device.h>
a04d0423 54#include <engine/fifo.h>
b8bf04e1 55#include <engine/gr.h>
8700287b 56#include <engine/sw.h>
a04d0423 57
be83cd4e
BS
58#define nvxx_fifo(a) nvkm_fifo(nvxx_device(a))
59#define nvxx_fifo_chan(a) ((struct nvkm_fifo_chan *)nvxx_object(a))
60#define nvxx_gr(a) ((struct nvkm_gr *)nvkm_engine(nvxx_object(a), NVDEV_ENGINE_GR))
a04d0423 61#endif