2 * Copyright 2012 Red Hat Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
26 #include <core/enum.h>
27 #include <core/class.h>
28 #include <core/engctx.h>
30 #include <engine/copy.h>
32 struct nve0_copy_priv
{
33 struct nouveau_engine base
;
36 /*******************************************************************************
38 ******************************************************************************/
40 static struct nouveau_oclass
41 nve0_copy_sclass
[] = {
42 { 0xa0b5, &nouveau_object_ofuncs
},
46 /*******************************************************************************
48 ******************************************************************************/
50 static struct nouveau_ofuncs
51 nve0_copy_context_ofuncs
= {
52 .ctor
= _nouveau_engctx_ctor
,
53 .dtor
= _nouveau_engctx_dtor
,
54 .init
= _nouveau_engctx_init
,
55 .fini
= _nouveau_engctx_fini
,
56 .rd32
= _nouveau_engctx_rd32
,
57 .wr32
= _nouveau_engctx_wr32
,
60 static struct nouveau_oclass
62 .handle
= NV_ENGCTX(COPY0
, 0xc0),
63 .ofuncs
= &nve0_copy_context_ofuncs
,
66 /*******************************************************************************
67 * PCOPY engine/subdev functions
68 ******************************************************************************/
71 nve0_copy_intr(struct nouveau_subdev
*subdev
)
73 const int ce
= nv_subidx(nv_object(subdev
)) - NVDEV_ENGINE_COPY0
;
74 struct nve0_copy_priv
*priv
= (void *)subdev
;
75 u32 stat
= nv_rd32(priv
, 0x104908 + (ce
* 0x1000));
78 nv_warn(priv
, "unhandled intr 0x%08x\n", stat
);
79 nv_wr32(priv
, 0x104908 + (ce
* 0x1000), stat
);
84 nve0_copy0_ctor(struct nouveau_object
*parent
, struct nouveau_object
*engine
,
85 struct nouveau_oclass
*oclass
, void *data
, u32 size
,
86 struct nouveau_object
**pobject
)
88 struct nve0_copy_priv
*priv
;
91 if (nv_rd32(parent
, 0x022500) & 0x00000100)
94 ret
= nouveau_engine_create(parent
, engine
, oclass
, true,
95 "PCE0", "copy0", &priv
);
96 *pobject
= nv_object(priv
);
100 nv_subdev(priv
)->unit
= 0x00000040;
101 nv_subdev(priv
)->intr
= nve0_copy_intr
;
102 nv_engine(priv
)->cclass
= &nve0_copy_cclass
;
103 nv_engine(priv
)->sclass
= nve0_copy_sclass
;
108 nve0_copy1_ctor(struct nouveau_object
*parent
, struct nouveau_object
*engine
,
109 struct nouveau_oclass
*oclass
, void *data
, u32 size
,
110 struct nouveau_object
**pobject
)
112 struct nve0_copy_priv
*priv
;
115 if (nv_rd32(parent
, 0x022500) & 0x00000200)
118 ret
= nouveau_engine_create(parent
, engine
, oclass
, true,
119 "PCE1", "copy1", &priv
);
120 *pobject
= nv_object(priv
);
124 nv_subdev(priv
)->unit
= 0x00000080;
125 nv_subdev(priv
)->intr
= nve0_copy_intr
;
126 nv_engine(priv
)->cclass
= &nve0_copy_cclass
;
127 nv_engine(priv
)->sclass
= nve0_copy_sclass
;
132 nve0_copy2_ctor(struct nouveau_object
*parent
, struct nouveau_object
*engine
,
133 struct nouveau_oclass
*oclass
, void *data
, u32 size
,
134 struct nouveau_object
**pobject
)
136 struct nve0_copy_priv
*priv
;
139 ret
= nouveau_engine_create(parent
, engine
, oclass
, true,
140 "PCE2", "copy2", &priv
);
141 *pobject
= nv_object(priv
);
145 nv_subdev(priv
)->unit
= 0x00200000;
146 nv_subdev(priv
)->intr
= nve0_copy_intr
;
147 nv_engine(priv
)->cclass
= &nve0_copy_cclass
;
148 nv_engine(priv
)->sclass
= nve0_copy_sclass
;
152 struct nouveau_oclass
153 nve0_copy0_oclass
= {
154 .handle
= NV_ENGINE(COPY0
, 0xe0),
155 .ofuncs
= &(struct nouveau_ofuncs
) {
156 .ctor
= nve0_copy0_ctor
,
157 .dtor
= _nouveau_engine_dtor
,
158 .init
= _nouveau_engine_init
,
159 .fini
= _nouveau_engine_fini
,
163 struct nouveau_oclass
164 nve0_copy1_oclass
= {
165 .handle
= NV_ENGINE(COPY1
, 0xe0),
166 .ofuncs
= &(struct nouveau_ofuncs
) {
167 .ctor
= nve0_copy1_ctor
,
168 .dtor
= _nouveau_engine_dtor
,
169 .init
= _nouveau_engine_init
,
170 .fini
= _nouveau_engine_fini
,
174 struct nouveau_oclass
175 nve0_copy2_oclass
= {
176 .handle
= NV_ENGINE(COPY2
, 0xe0),
177 .ofuncs
= &(struct nouveau_ofuncs
) {
178 .ctor
= nve0_copy2_ctor
,
179 .dtor
= _nouveau_engine_dtor
,
180 .init
= _nouveau_engine_init
,
181 .fini
= _nouveau_engine_fini
,
This page took 0.05213 seconds and 5 git commands to generate.