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, Ilia Mirkin
23 */
24
25 #include <engine/xtensa.h>
26 #include <engine/vp.h>
27
28 /*******************************************************************************
29 * VP object classes
30 ******************************************************************************/
31
32 static struct nouveau_oclass
33 nv84_vp_sclass[] = {
34 { 0x7476, &nouveau_object_ofuncs },
35 {},
36 };
37
38 /*******************************************************************************
39 * PVP context
40 ******************************************************************************/
41
42 static struct nouveau_oclass
43 nv84_vp_cclass = {
44 .handle = NV_ENGCTX(VP, 0x84),
45 .ofuncs = &(struct nouveau_ofuncs) {
46 .ctor = _nouveau_xtensa_engctx_ctor,
47 .dtor = _nouveau_engctx_dtor,
48 .init = _nouveau_engctx_init,
49 .fini = _nouveau_engctx_fini,
50 .rd32 = _nouveau_engctx_rd32,
51 .wr32 = _nouveau_engctx_wr32,
52 },
53 };
54
55 /*******************************************************************************
56 * PVP engine/subdev functions
57 ******************************************************************************/
58
59 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)60 nv84_vp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
61 struct nouveau_oclass *oclass, void *data, u32 size,
62 struct nouveau_object **pobject)
63 {
64 struct nouveau_xtensa *priv;
65 int ret;
66
67 ret = nouveau_xtensa_create(parent, engine, oclass, 0xf000, true,
68 "PVP", "vp", &priv);
69 *pobject = nv_object(priv);
70 if (ret)
71 return ret;
72
73 nv_subdev(priv)->unit = 0x01020000;
74 nv_engine(priv)->cclass = &nv84_vp_cclass;
75 nv_engine(priv)->sclass = nv84_vp_sclass;
76 priv->fifo_val = 0x111;
77 priv->unkd28 = 0x9c544;
78 return 0;
79 }
80
81 struct nouveau_oclass
82 nv84_vp_oclass = {
83 .handle = NV_ENGINE(VP, 0x84),
84 .ofuncs = &(struct nouveau_ofuncs) {
85 .ctor = nv84_vp_ctor,
86 .dtor = _nouveau_xtensa_dtor,
87 .init = _nouveau_xtensa_init,
88 .fini = _nouveau_xtensa_fini,
89 .rd32 = _nouveau_xtensa_rd32,
90 .wr32 = _nouveau_xtensa_wr32,
91 },
92 };
93