xref: /linux/drivers/gpu/drm/nouveau/include/nvkm/subdev/bar.h (revision 1e73427f66353b7fe21c138787ff2b711ca1c0dd)
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 	void __iomem *flushBAR2PhysMode;
15 	struct nvkm_memory *flushFBZero;
16 	void __iomem *flushBAR2;
17 
18 	/* whether the BAR supports to be ioremapped WC or should be uncached */
19 	bool iomap_uncached;
20 };
21 
22 struct nvkm_vmm *nvkm_bar_bar1_vmm(struct nvkm_device *);
23 void nvkm_bar_bar1_reset(struct nvkm_device *);
24 void nvkm_bar_bar2_init(struct nvkm_device *);
25 void nvkm_bar_bar2_fini(struct nvkm_device *);
26 void nvkm_bar_bar2_reset(struct nvkm_device *);
27 struct nvkm_vmm *nvkm_bar_bar2_vmm(struct nvkm_device *);
28 void nvkm_bar_flush(struct nvkm_bar *);
29 
30 int nv50_bar_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_bar **);
31 int g84_bar_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_bar **);
32 int gf100_bar_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_bar **);
33 int gk20a_bar_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_bar **);
34 int gm107_bar_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_bar **);
35 int gm20b_bar_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_bar **);
36 int tu102_bar_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_bar **);
37 #endif
38