packaging: release out (3.8.3)
[profile/ivi/kernel-adaptation-intel-automotive.git] / drivers / gpu / drm / nouveau / core / include / subdev / bar.h
1 #ifndef __NOUVEAU_BAR_H__
2 #define __NOUVEAU_BAR_H__
3
4 #include <core/subdev.h>
5 #include <core/device.h>
6
7 #include <subdev/fb.h>
8
9 struct nouveau_vma;
10
11 struct nouveau_bar {
12         struct nouveau_subdev base;
13
14         int (*alloc)(struct nouveau_bar *, struct nouveau_object *,
15                      struct nouveau_mem *, struct nouveau_object **);
16         void __iomem *iomem;
17
18         int (*kmap)(struct nouveau_bar *, struct nouveau_mem *,
19                     u32 flags, struct nouveau_vma *);
20         int (*umap)(struct nouveau_bar *, struct nouveau_mem *,
21                     u32 flags, struct nouveau_vma *);
22         void (*unmap)(struct nouveau_bar *, struct nouveau_vma *);
23         void (*flush)(struct nouveau_bar *);
24 };
25
26 static inline struct nouveau_bar *
27 nouveau_bar(void *obj)
28 {
29         return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_BAR];
30 }
31
32 #define nouveau_bar_create(p,e,o,d)                                            \
33         nouveau_bar_create_((p), (e), (o), sizeof(**d), (void **)d)
34 #define nouveau_bar_init(p)                                                    \
35         nouveau_subdev_init(&(p)->base)
36 #define nouveau_bar_fini(p,s)                                                  \
37         nouveau_subdev_fini(&(p)->base, (s))
38
39 int nouveau_bar_create_(struct nouveau_object *, struct nouveau_object *,
40                         struct nouveau_oclass *, int, void **);
41 void nouveau_bar_destroy(struct nouveau_bar *);
42
43 void _nouveau_bar_dtor(struct nouveau_object *);
44 #define _nouveau_bar_init _nouveau_subdev_init
45 #define _nouveau_bar_fini _nouveau_subdev_fini
46
47 extern struct nouveau_oclass nv50_bar_oclass;
48 extern struct nouveau_oclass nvc0_bar_oclass;
49
50 int nouveau_bar_alloc(struct nouveau_bar *, struct nouveau_object *,
51                       struct nouveau_mem *, struct nouveau_object **);
52
53 void nv84_bar_flush(struct nouveau_bar *);
54
55 #endif