Commit | Line | Data |
---|---|---|
9274f4a9 BS |
1 | #ifndef __NOUVEAU_ENGCTX_H__ |
2 | #define __NOUVEAU_ENGCTX_H__ | |
3 | ||
4 | #include <core/object.h> | |
5 | #include <core/gpuobj.h> | |
6 | ||
7 | #include <subdev/vm.h> | |
8 | ||
9 | #define NV_ENGCTX_(eng,var) (NV_ENGCTX_CLASS | ((var) << 8) | (eng)) | |
10 | #define NV_ENGCTX(name,var) NV_ENGCTX_(NVDEV_ENGINE_##name, (var)) | |
11 | ||
12 | struct nouveau_engctx { | |
13 | struct nouveau_gpuobj base; | |
14 | struct nouveau_vma vma; | |
15 | struct list_head head; | |
72a14827 | 16 | unsigned long save; |
4c2d4222 | 17 | u64 addr; |
9274f4a9 BS |
18 | }; |
19 | ||
3acec63a | 20 | static inline struct nouveau_engctx * |
9274f4a9 BS |
21 | nv_engctx(void *obj) |
22 | { | |
23 | #if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA | |
24 | if (unlikely(!nv_iclass(obj, NV_ENGCTX_CLASS))) | |
25 | nv_assert("BAD CAST -> NvEngCtx, %08x", nv_hclass(obj)); | |
26 | #endif | |
27 | return obj; | |
28 | } | |
29 | ||
30 | #define nouveau_engctx_create(p,e,c,g,s,a,f,d) \ | |
31 | nouveau_engctx_create_((p), (e), (c), (g), (s), (a), (f), \ | |
32 | sizeof(**d), (void **)d) | |
33 | ||
34 | int nouveau_engctx_create_(struct nouveau_object *, struct nouveau_object *, | |
35 | struct nouveau_oclass *, struct nouveau_object *, | |
36 | u32 size, u32 align, u32 flags, | |
37 | int length, void **data); | |
38 | void nouveau_engctx_destroy(struct nouveau_engctx *); | |
39 | int nouveau_engctx_init(struct nouveau_engctx *); | |
40 | int nouveau_engctx_fini(struct nouveau_engctx *, bool suspend); | |
41 | ||
43598875 BS |
42 | int _nouveau_engctx_ctor(struct nouveau_object *, struct nouveau_object *, |
43 | struct nouveau_oclass *, void *, u32, | |
44 | struct nouveau_object **); | |
9274f4a9 BS |
45 | void _nouveau_engctx_dtor(struct nouveau_object *); |
46 | int _nouveau_engctx_init(struct nouveau_object *); | |
47 | int _nouveau_engctx_fini(struct nouveau_object *, bool suspend); | |
48 | #define _nouveau_engctx_rd32 _nouveau_gpuobj_rd32 | |
49 | #define _nouveau_engctx_wr32 _nouveau_gpuobj_wr32 | |
50 | ||
72a14827 BS |
51 | struct nouveau_object *nouveau_engctx_get(struct nouveau_engine *, u64 addr); |
52 | void nouveau_engctx_put(struct nouveau_object *); | |
9274f4a9 BS |
53 | |
54 | #endif |