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