1#ifndef __NOUVEAU_BAR_H__
2#define __NOUVEAU_BAR_H__
3
4#include <core/subdev.h>
5#include <core/device.h>
6
7struct nouveau_mem;
8struct nouveau_vma;
9
10struct nouveau_bar {
11	struct nouveau_subdev base;
12
13	int (*alloc)(struct nouveau_bar *, struct nouveau_object *,
14		     struct nouveau_mem *, struct nouveau_object **);
15
16	int (*kmap)(struct nouveau_bar *, struct nouveau_mem *,
17		    u32 flags, struct nouveau_vma *);
18	int (*umap)(struct nouveau_bar *, struct nouveau_mem *,
19		    u32 flags, struct nouveau_vma *);
20	void (*unmap)(struct nouveau_bar *, struct nouveau_vma *);
21	void (*flush)(struct nouveau_bar *);
22
23	/* whether the BAR supports to be ioremapped WC or should be uncached */
24	bool iomap_uncached;
25};
26
27static inline struct nouveau_bar *
28nouveau_bar(void *obj)
29{
30	return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_BAR];
31}
32
33extern struct nouveau_oclass nv50_bar_oclass;
34extern struct nouveau_oclass nvc0_bar_oclass;
35extern struct nouveau_oclass gk20a_bar_oclass;
36
37#endif
38