Ben Skeggs | a04d042 | 2014-08-10 04:10:21 +1000 | [diff] [blame] | 1 | #ifndef __NVIF_DEVICE_H__ |
| 2 | #define __NVIF_DEVICE_H__ |
| 3 | |
| 4 | #include "object.h" |
| 5 | #include "class.h" |
| 6 | |
| 7 | struct 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 | |
| 13 | static inline struct nvif_device * |
| 14 | nvif_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 | |
| 21 | int nvif_device_init(struct nvif_object *, void (*dtor)(struct nvif_device *), |
| 22 | u32 handle, u32 oclass, void *, u32, |
| 23 | struct nvif_device *); |
| 24 | void nvif_device_fini(struct nvif_device *); |
| 25 | int nvif_device_new(struct nvif_object *, u32 handle, u32 oclass, |
| 26 | void *, u32, struct nvif_device **); |
| 27 | void nvif_device_ref(struct nvif_device *, struct nvif_device **); |
| 28 | |
| 29 | /*XXX*/ |
| 30 | #include <subdev/bios.h> |
| 31 | #include <subdev/fb.h> |
| 32 | #include <subdev/instmem.h> |
| 33 | #include <subdev/vm.h> |
| 34 | #include <subdev/bar.h> |
| 35 | #include <subdev/gpio.h> |
| 36 | #include <subdev/clock.h> |
| 37 | #include <subdev/i2c.h> |
| 38 | #include <subdev/timer.h> |
| 39 | #include <subdev/therm.h> |
| 40 | |
| 41 | #define nvkm_device(a) nv_device(nvkm_object((a))) |
| 42 | #define nvkm_bios(a) nouveau_bios(nvkm_device(a)) |
| 43 | #define nvkm_fb(a) nouveau_fb(nvkm_device(a)) |
| 44 | #define nvkm_instmem(a) nouveau_instmem(nvkm_device(a)) |
| 45 | #define nvkm_vmmgr(a) nouveau_vmmgr(nvkm_device(a)) |
| 46 | #define nvkm_bar(a) nouveau_bar(nvkm_device(a)) |
| 47 | #define nvkm_gpio(a) nouveau_gpio(nvkm_device(a)) |
| 48 | #define nvkm_clock(a) nouveau_clock(nvkm_device(a)) |
| 49 | #define nvkm_i2c(a) nouveau_i2c(nvkm_device(a)) |
| 50 | #define nvkm_timer(a) nouveau_timer(nvkm_device(a)) |
| 51 | #define nvkm_wait(a,b,c,d) nv_wait(nvkm_timer(a), (b), (c), (d)) |
| 52 | #define nvkm_wait_cb(a,b,c) nv_wait_cb(nvkm_timer(a), (b), (c)) |
| 53 | #define nvkm_therm(a) nouveau_therm(nvkm_device(a)) |
| 54 | |
| 55 | #include <engine/device.h> |
| 56 | #include <engine/fifo.h> |
Ben Skeggs | a04d042 | 2014-08-10 04:10:21 +1000 | [diff] [blame] | 57 | #include <engine/graph.h> |
| 58 | #include <engine/software.h> |
| 59 | |
| 60 | #define nvkm_fifo(a) nouveau_fifo(nvkm_device(a)) |
| 61 | #define nvkm_fifo_chan(a) ((struct nouveau_fifo_chan *)nvkm_object(a)) |
Ben Skeggs | a04d042 | 2014-08-10 04:10:21 +1000 | [diff] [blame] | 62 | #define nvkm_gr(a) ((struct nouveau_graph *)nouveau_engine(nvkm_object(a), NVDEV_ENGINE_GR)) |
| 63 | |
| 64 | #endif |