xref: /openbmc/linux/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.h (revision b24413180f5600bcb3bb70fbed5cf186b60864bd)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __NV40_GR_H__
3 #define __NV40_GR_H__
4 #define nv40_gr(p) container_of((p), struct nv40_gr, base)
5 #include "priv.h"
6 
7 struct nv40_gr {
8 	struct nvkm_gr base;
9 	u32 size;
10 	struct list_head chan;
11 };
12 
13 int nv40_gr_new_(const struct nvkm_gr_func *, struct nvkm_device *, int index,
14 		 struct nvkm_gr **);
15 int nv40_gr_init(struct nvkm_gr *);
16 void nv40_gr_intr(struct nvkm_gr *);
17 u64 nv40_gr_units(struct nvkm_gr *);
18 
19 #define nv40_gr_chan(p) container_of((p), struct nv40_gr_chan, object)
20 
21 struct nv40_gr_chan {
22 	struct nvkm_object object;
23 	struct nv40_gr *gr;
24 	struct nvkm_fifo_chan *fifo;
25 	u32 inst;
26 	struct list_head head;
27 };
28 
29 int nv40_gr_chan_new(struct nvkm_gr *, struct nvkm_fifo_chan *,
30 		     const struct nvkm_oclass *, struct nvkm_object **);
31 
32 extern const struct nvkm_object_func nv40_gr_object;
33 
34 /* returns 1 if device is one of the nv4x using the 0x4497 object class,
35  * helpful to determine a number of other hardware features
36  */
37 static inline int
38 nv44_gr_class(struct nvkm_device *device)
39 {
40 	if ((device->chipset & 0xf0) == 0x60)
41 		return 1;
42 
43 	return !(0x0aaf & (1 << (device->chipset & 0x0f)));
44 }
45 
46 int  nv40_grctx_init(struct nvkm_device *, u32 *size);
47 void nv40_grctx_fill(struct nvkm_device *, struct nvkm_gpuobj *);
48 #endif
49