Linux-libre 3.17-rc7-gnu
[librecmc/linux-libre.git] / drivers / gpu / drm / nouveau / core / include / subdev / bus.h
1 #ifndef __NOUVEAU_BUS_H__
2 #define __NOUVEAU_BUS_H__
3
4 #include <core/subdev.h>
5 #include <core/device.h>
6
7 struct nouveau_bus_intr {
8         u32 stat;
9         u32 unit;
10 };
11
12 struct nouveau_bus {
13         struct nouveau_subdev base;
14         int (*hwsq_exec)(struct nouveau_bus *, u32 *, u32);
15         u32 hwsq_size;
16 };
17
18 static inline struct nouveau_bus *
19 nouveau_bus(void *obj)
20 {
21         return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_BUS];
22 }
23
24 #define nouveau_bus_create(p, e, o, d)                                         \
25         nouveau_subdev_create_((p), (e), (o), 0, "PBUS", "master",             \
26                                sizeof(**d), (void **)d)
27 #define nouveau_bus_destroy(p)                                                 \
28         nouveau_subdev_destroy(&(p)->base)
29 #define nouveau_bus_init(p)                                                    \
30         nouveau_subdev_init(&(p)->base)
31 #define nouveau_bus_fini(p, s)                                                 \
32         nouveau_subdev_fini(&(p)->base, (s))
33
34 #define _nouveau_bus_dtor _nouveau_subdev_dtor
35 #define _nouveau_bus_init _nouveau_subdev_init
36 #define _nouveau_bus_fini _nouveau_subdev_fini
37
38 extern struct nouveau_oclass *nv04_bus_oclass;
39 extern struct nouveau_oclass *nv31_bus_oclass;
40 extern struct nouveau_oclass *nv50_bus_oclass;
41 extern struct nouveau_oclass *nv94_bus_oclass;
42 extern struct nouveau_oclass *nvc0_bus_oclass;
43
44 /* interface to sequencer */
45 struct nouveau_hwsq;
46 int  nouveau_hwsq_init(struct nouveau_bus *, struct nouveau_hwsq **);
47 int  nouveau_hwsq_fini(struct nouveau_hwsq **, bool exec);
48 void nouveau_hwsq_wr32(struct nouveau_hwsq *, u32 addr, u32 data);
49 void nouveau_hwsq_setf(struct nouveau_hwsq *, u8 flag, int data);
50 void nouveau_hwsq_wait(struct nouveau_hwsq *, u8 flag, u8 data);
51 void nouveau_hwsq_nsec(struct nouveau_hwsq *, u32 nsec);
52
53 #endif