1 | /* $NetBSD: nouveau_engine_vp_nv98.c,v 1.1.1.1 2014/08/06 12:36:27 riastradh Exp $ */ |
2 | |
3 | /* |
4 | * Copyright 2012 Red Hat Inc. |
5 | * |
6 | * Permission is hereby granted, free of charge, to any person obtaining a |
7 | * copy of this software and associated documentation files (the "Software"), |
8 | * to deal in the Software without restriction, including without limitation |
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
10 | * and/or sell copies of the Software, and to permit persons to whom the |
11 | * Software is furnished to do so, subject to the following conditions: |
12 | * |
13 | * The above copyright notice and this permission notice shall be included in |
14 | * all copies or substantial portions of the Software. |
15 | * |
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR |
20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
22 | * OTHER DEALINGS IN THE SOFTWARE. |
23 | * |
24 | * Authors: Ben Skeggs, Maarten Lankhorst, Ilia Mirkin |
25 | */ |
26 | |
27 | #include <sys/cdefs.h> |
28 | __KERNEL_RCSID(0, "$NetBSD: nouveau_engine_vp_nv98.c,v 1.1.1.1 2014/08/06 12:36:27 riastradh Exp $" ); |
29 | |
30 | #include <engine/falcon.h> |
31 | #include <engine/vp.h> |
32 | |
33 | struct nv98_vp_priv { |
34 | struct nouveau_falcon base; |
35 | }; |
36 | |
37 | /******************************************************************************* |
38 | * VP object classes |
39 | ******************************************************************************/ |
40 | |
41 | static struct nouveau_oclass |
42 | nv98_vp_sclass[] = { |
43 | { 0x88b2, &nouveau_object_ofuncs }, |
44 | { 0x85b2, &nouveau_object_ofuncs }, |
45 | {}, |
46 | }; |
47 | |
48 | /******************************************************************************* |
49 | * PVP context |
50 | ******************************************************************************/ |
51 | |
52 | static struct nouveau_oclass |
53 | nv98_vp_cclass = { |
54 | .handle = NV_ENGCTX(VP, 0x98), |
55 | .ofuncs = &(struct nouveau_ofuncs) { |
56 | .ctor = _nouveau_falcon_context_ctor, |
57 | .dtor = _nouveau_falcon_context_dtor, |
58 | .init = _nouveau_falcon_context_init, |
59 | .fini = _nouveau_falcon_context_fini, |
60 | .rd32 = _nouveau_falcon_context_rd32, |
61 | .wr32 = _nouveau_falcon_context_wr32, |
62 | }, |
63 | }; |
64 | |
65 | /******************************************************************************* |
66 | * PVP engine/subdev functions |
67 | ******************************************************************************/ |
68 | |
69 | static int |
70 | nv98_vp_init(struct nouveau_object *object) |
71 | { |
72 | struct nv98_vp_priv *priv = (void *)object; |
73 | int ret; |
74 | |
75 | ret = nouveau_falcon_init(&priv->base); |
76 | if (ret) |
77 | return ret; |
78 | |
79 | nv_wr32(priv, 0x085010, 0x0000ffd2); |
80 | nv_wr32(priv, 0x08501c, 0x0000fff2); |
81 | return 0; |
82 | } |
83 | |
84 | static int |
85 | nv98_vp_ctor(struct nouveau_object *parent, struct nouveau_object *engine, |
86 | struct nouveau_oclass *oclass, void *data, u32 size, |
87 | struct nouveau_object **pobject) |
88 | { |
89 | struct nv98_vp_priv *priv; |
90 | int ret; |
91 | |
92 | ret = nouveau_falcon_create(parent, engine, oclass, 0x085000, true, |
93 | "PVP" , "vp" , &priv); |
94 | *pobject = nv_object(priv); |
95 | if (ret) |
96 | return ret; |
97 | |
98 | nv_subdev(priv)->unit = 0x01020000; |
99 | nv_engine(priv)->cclass = &nv98_vp_cclass; |
100 | nv_engine(priv)->sclass = nv98_vp_sclass; |
101 | return 0; |
102 | } |
103 | |
104 | struct nouveau_oclass |
105 | nv98_vp_oclass = { |
106 | .handle = NV_ENGINE(VP, 0x98), |
107 | .ofuncs = &(struct nouveau_ofuncs) { |
108 | .ctor = nv98_vp_ctor, |
109 | .dtor = _nouveau_falcon_dtor, |
110 | .init = nv98_vp_init, |
111 | .fini = _nouveau_falcon_fini, |
112 | .rd32 = _nouveau_falcon_rd32, |
113 | .wr32 = _nouveau_falcon_wr32, |
114 | }, |
115 | }; |
116 | |