1 /*
2 * Copyright 2012 Red Hat Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Ben Skeggs
23 */
24
25 #include <core/engctx.h>
26 #include <core/class.h>
27
28 #include <engine/vp.h>
29
30 struct nv84_vp_priv {
31 struct nouveau_engine base;
32 };
33
34 /*******************************************************************************
35 * VP object classes
36 ******************************************************************************/
37
38 static struct nouveau_oclass
39 nv84_vp_sclass[] = {
40 {},
41 };
42
43 /*******************************************************************************
44 * PVP context
45 ******************************************************************************/
46
47 static struct nouveau_oclass
48 nv84_vp_cclass = {
49 .handle = NV_ENGCTX(VP, 0x84),
50 .ofuncs = &(struct nouveau_ofuncs) {
51 .ctor = _nouveau_engctx_ctor,
52 .dtor = _nouveau_engctx_dtor,
53 .init = _nouveau_engctx_init,
54 .fini = _nouveau_engctx_fini,
55 .rd32 = _nouveau_engctx_rd32,
56 .wr32 = _nouveau_engctx_wr32,
57 },
58 };
59
60 /*******************************************************************************
61 * PVP engine/subdev functions
62 ******************************************************************************/
63
64 static int
nv84_vp_ctor(struct nouveau_object * parent,struct nouveau_object * engine,struct nouveau_oclass * oclass,void * data,u32 size,struct nouveau_object ** pobject)65 nv84_vp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
66 struct nouveau_oclass *oclass, void *data, u32 size,
67 struct nouveau_object **pobject)
68 {
69 struct nv84_vp_priv *priv;
70 int ret;
71
72 ret = nouveau_engine_create(parent, engine, oclass, true,
73 "PVP", "vp", &priv);
74 *pobject = nv_object(priv);
75 if (ret)
76 return ret;
77
78 nv_subdev(priv)->unit = 0x01020000;
79 nv_engine(priv)->cclass = &nv84_vp_cclass;
80 nv_engine(priv)->sclass = nv84_vp_sclass;
81 return 0;
82 }
83
84 struct nouveau_oclass
85 nv84_vp_oclass = {
86 .handle = NV_ENGINE(VP, 0x84),
87 .ofuncs = &(struct nouveau_ofuncs) {
88 .ctor = nv84_vp_ctor,
89 .dtor = _nouveau_engine_dtor,
90 .init = _nouveau_engine_init,
91 .fini = _nouveau_engine_fini,
92 },
93 };
94