1 | /* $NetBSD: nouveau_engine_vp_nvc0.c,v 1.1.1.1 2014/08/06 12:36:27 riastradh Exp $ */ |
2 | |
3 | /* |
4 | * Copyright 2012 Maarten Lankhorst |
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: Maarten Lankhorst |
25 | */ |
26 | |
27 | #include <sys/cdefs.h> |
28 | __KERNEL_RCSID(0, "$NetBSD: nouveau_engine_vp_nvc0.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 nvc0_vp_priv { |
34 | struct nouveau_falcon base; |
35 | }; |
36 | |
37 | /******************************************************************************* |
38 | * VP object classes |
39 | ******************************************************************************/ |
40 | |
41 | static struct nouveau_oclass |
42 | nvc0_vp_sclass[] = { |
43 | { 0x90b2, &nouveau_object_ofuncs }, |
44 | {}, |
45 | }; |
46 | |
47 | /******************************************************************************* |
48 | * PVP context |
49 | ******************************************************************************/ |
50 | |
51 | static struct nouveau_oclass |
52 | nvc0_vp_cclass = { |
53 | .handle = NV_ENGCTX(VP, 0xc0), |
54 | .ofuncs = &(struct nouveau_ofuncs) { |
55 | .ctor = _nouveau_falcon_context_ctor, |
56 | .dtor = _nouveau_falcon_context_dtor, |
57 | .init = _nouveau_falcon_context_init, |
58 | .fini = _nouveau_falcon_context_fini, |
59 | .rd32 = _nouveau_falcon_context_rd32, |
60 | .wr32 = _nouveau_falcon_context_wr32, |
61 | }, |
62 | }; |
63 | |
64 | /******************************************************************************* |
65 | * PVP engine/subdev functions |
66 | ******************************************************************************/ |
67 | |
68 | static int |
69 | nvc0_vp_init(struct nouveau_object *object) |
70 | { |
71 | struct nvc0_vp_priv *priv = (void *)object; |
72 | int ret; |
73 | |
74 | ret = nouveau_falcon_init(&priv->base); |
75 | if (ret) |
76 | return ret; |
77 | |
78 | nv_wr32(priv, 0x085010, 0x0000fff2); |
79 | nv_wr32(priv, 0x08501c, 0x0000fff2); |
80 | return 0; |
81 | } |
82 | |
83 | static int |
84 | nvc0_vp_ctor(struct nouveau_object *parent, struct nouveau_object *engine, |
85 | struct nouveau_oclass *oclass, void *data, u32 size, |
86 | struct nouveau_object **pobject) |
87 | { |
88 | struct nvc0_vp_priv *priv; |
89 | int ret; |
90 | |
91 | ret = nouveau_falcon_create(parent, engine, oclass, 0x085000, true, |
92 | "PVP" , "vp" , &priv); |
93 | *pobject = nv_object(priv); |
94 | if (ret) |
95 | return ret; |
96 | |
97 | nv_subdev(priv)->unit = 0x00020000; |
98 | nv_subdev(priv)->intr = nouveau_falcon_intr; |
99 | nv_engine(priv)->cclass = &nvc0_vp_cclass; |
100 | nv_engine(priv)->sclass = nvc0_vp_sclass; |
101 | return 0; |
102 | } |
103 | |
104 | struct nouveau_oclass |
105 | nvc0_vp_oclass = { |
106 | .handle = NV_ENGINE(VP, 0xc0), |
107 | .ofuncs = &(struct nouveau_ofuncs) { |
108 | .ctor = nvc0_vp_ctor, |
109 | .dtor = _nouveau_falcon_dtor, |
110 | .init = nvc0_vp_init, |
111 | .fini = _nouveau_falcon_fini, |
112 | .rd32 = _nouveau_falcon_rd32, |
113 | .wr32 = _nouveau_falcon_wr32, |
114 | }, |
115 | }; |
116 | |