xref: /linux/drivers/gpu/drm/nouveau/include/nvkm/subdev/bar.h (revision 26fbb4c8c7c3ee9a4c3b4de555a8587b5a19154e)
1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVKM_BAR_H__
3 #define __NVKM_BAR_H__
4 #include <core/subdev.h>
5 struct nvkm_vma;
6 
7 struct nvkm_bar {
8 	const struct nvkm_bar_func *func;
9 	struct nvkm_subdev subdev;
10 
11 	spinlock_t lock;
12 	bool bar2;
13 
14 	/* whether the BAR supports to be ioremapped WC or should be uncached */
15 	bool iomap_uncached;
16 };
17 
18 struct nvkm_vmm *nvkm_bar_bar1_vmm(struct nvkm_device *);
19 void nvkm_bar_bar1_reset(struct nvkm_device *);
20 void nvkm_bar_bar2_init(struct nvkm_device *);
21 void nvkm_bar_bar2_fini(struct nvkm_device *);
22 void nvkm_bar_bar2_reset(struct nvkm_device *);
23 struct nvkm_vmm *nvkm_bar_bar2_vmm(struct nvkm_device *);
24 void nvkm_bar_flush(struct nvkm_bar *);
25 
26 int nv50_bar_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_bar **);
27 int g84_bar_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_bar **);
28 int gf100_bar_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_bar **);
29 int gk20a_bar_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_bar **);
30 int gm107_bar_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_bar **);
31 int gm20b_bar_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_bar **);
32 int tu102_bar_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_bar **);
33 #endif
34