device.h 2.0 KB
Newer Older
1 2 3
#ifndef __NVIF_DEVICE_H__
#define __NVIF_DEVICE_H__

4 5
#include <nvif/object.h>
#include <nvif/class.h>
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

struct nvif_device {
	struct nvif_object base;
	struct nvif_object *object; /*XXX: hack for nvif_object() */
	struct nv_device_info_v0 info;
};

static inline struct nvif_device *
nvif_device(struct nvif_object *object)
{
	while (object && object->oclass != 0x0080 /*XXX: NV_DEVICE_CLASS*/ )
		object = object->parent;
	return (void *)object;
}

int  nvif_device_init(struct nvif_object *, void (*dtor)(struct nvif_device *),
		      u32 handle, u32 oclass, void *, u32,
		      struct nvif_device *);
void nvif_device_fini(struct nvif_device *);
int  nvif_device_new(struct nvif_object *, u32 handle, u32 oclass,
		     void *, u32, struct nvif_device **);
void nvif_device_ref(struct nvif_device *, struct nvif_device **);

/*XXX*/
#include <subdev/bios.h>
#include <subdev/fb.h>
32
#include <subdev/mmu.h>
33 34
#include <subdev/bar.h>
#include <subdev/gpio.h>
35
#include <subdev/clk.h>
36 37 38 39
#include <subdev/i2c.h>
#include <subdev/timer.h>
#include <subdev/therm.h>

40 41 42 43 44 45 46 47 48 49 50 51
#define nvxx_device(a) nv_device(nvxx_object((a)))
#define nvxx_bios(a) nouveau_bios(nvxx_device(a))
#define nvxx_fb(a) nouveau_fb(nvxx_device(a))
#define nvxx_mmu(a) nouveau_mmu(nvxx_device(a))
#define nvxx_bar(a) nouveau_bar(nvxx_device(a))
#define nvxx_gpio(a) nouveau_gpio(nvxx_device(a))
#define nvxx_clk(a) nouveau_clk(nvxx_device(a))
#define nvxx_i2c(a) nouveau_i2c(nvxx_device(a))
#define nvxx_timer(a) nouveau_timer(nvxx_device(a))
#define nvxx_wait(a,b,c,d) nv_wait(nvxx_timer(a), (b), (c), (d))
#define nvxx_wait_cb(a,b,c) nv_wait_cb(nvxx_timer(a), (b), (c))
#define nvxx_therm(a) nouveau_therm(nvxx_device(a))
52

53
#include <core/device.h>
54
#include <engine/fifo.h>
55
#include <engine/gr.h>
56
#include <engine/sw.h>
57

58 59 60
#define nvxx_fifo(a) nouveau_fifo(nvxx_device(a))
#define nvxx_fifo_chan(a) ((struct nouveau_fifo_chan *)nvxx_object(a))
#define nvxx_gr(a) ((struct nouveau_gr *)nouveau_engine(nvxx_object(a), NVDEV_ENGINE_GR))
61
#endif