1 #ifndef __NOUVEAU_ENGCTX_H__
2 #define __NOUVEAU_ENGCTX_H__
4 #include <core/object.h>
5 #include <core/gpuobj.h>
9 #define NV_ENGCTX_(eng,var) (NV_ENGCTX_CLASS | ((var) << 8) | (eng))
10 #define NV_ENGCTX(name,var) NV_ENGCTX_(NVDEV_ENGINE_##name, (var))
12 struct nouveau_engctx {
13 struct nouveau_gpuobj base;
14 struct nouveau_vma vma;
15 struct list_head head;
19 static inline struct nouveau_engctx *
22 #if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
23 if (unlikely(!nv_iclass(obj, NV_ENGCTX_CLASS)))
24 nv_assert("BAD CAST -> NvEngCtx, %08x", nv_hclass(obj));
29 #define nouveau_engctx_create(p,e,c,g,s,a,f,d) \
30 nouveau_engctx_create_((p), (e), (c), (g), (s), (a), (f), \
31 sizeof(**d), (void **)d)
33 int nouveau_engctx_create_(struct nouveau_object *, struct nouveau_object *,
34 struct nouveau_oclass *, struct nouveau_object *,
35 u32 size, u32 align, u32 flags,
36 int length, void **data);
37 void nouveau_engctx_destroy(struct nouveau_engctx *);
38 int nouveau_engctx_init(struct nouveau_engctx *);
39 int nouveau_engctx_fini(struct nouveau_engctx *, bool suspend);
41 void _nouveau_engctx_dtor(struct nouveau_object *);
42 int _nouveau_engctx_init(struct nouveau_object *);
43 int _nouveau_engctx_fini(struct nouveau_object *, bool suspend);
44 #define _nouveau_engctx_rd32 _nouveau_gpuobj_rd32
45 #define _nouveau_engctx_wr32 _nouveau_gpuobj_wr32
47 struct nouveau_object *
48 nouveau_engctx_lookup(struct nouveau_engine *, u64 addr);
50 struct nouveau_handle *
51 nouveau_engctx_lookup_class(struct nouveau_engine *, u64, u16);
53 struct nouveau_handle *
54 nouveau_engctx_lookup_vinst(struct nouveau_engine *, u64, u64);
56 struct nouveau_handle *
57 nouveau_engctx_lookup_cinst(struct nouveau_engine *, u64, u32);
60 nouveau_engctx_handle_put(struct nouveau_handle *);