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.
25 #include <engine/falcon.h>
26 #include <engine/fifo.h>
27 #include <engine/copy.h>
29 #include <core/class.h>
30 #include <core/enum.h>
31 #include <core/class.h>
32 #include <core/enum.h>
34 #include "fuc/nvc0.fuc.h"
36 struct nvc0_copy_priv
{
37 struct nouveau_falcon base
;
40 /*******************************************************************************
42 ******************************************************************************/
44 static struct nouveau_oclass
45 nvc0_copy0_sclass
[] = {
46 { 0x90b5, &nouveau_object_ofuncs
},
50 static struct nouveau_oclass
51 nvc0_copy1_sclass
[] = {
52 { 0x90b8, &nouveau_object_ofuncs
},
56 /*******************************************************************************
58 ******************************************************************************/
60 static struct nouveau_ofuncs
61 nvc0_copy_context_ofuncs
= {
62 .ctor
= _nouveau_falcon_context_ctor
,
63 .dtor
= _nouveau_falcon_context_dtor
,
64 .init
= _nouveau_falcon_context_init
,
65 .fini
= _nouveau_falcon_context_fini
,
66 .rd32
= _nouveau_falcon_context_rd32
,
67 .wr32
= _nouveau_falcon_context_wr32
,
70 static struct nouveau_oclass
72 .handle
= NV_ENGCTX(COPY0
, 0xc0),
73 .ofuncs
= &nvc0_copy_context_ofuncs
,
76 static struct nouveau_oclass
78 .handle
= NV_ENGCTX(COPY1
, 0xc0),
79 .ofuncs
= &nvc0_copy_context_ofuncs
,
82 /*******************************************************************************
83 * PCOPY engine/subdev functions
84 ******************************************************************************/
87 nvc0_copy_init(struct nouveau_object
*object
)
89 struct nvc0_copy_priv
*priv
= (void *)object
;
92 ret
= nouveau_falcon_init(&priv
->base
);
96 nv_wo32(priv
, 0x084, nv_engidx(object
) - NVDEV_ENGINE_COPY0
);
101 nvc0_copy0_ctor(struct nouveau_object
*parent
, struct nouveau_object
*engine
,
102 struct nouveau_oclass
*oclass
, void *data
, u32 size
,
103 struct nouveau_object
**pobject
)
105 struct nvc0_copy_priv
*priv
;
108 ret
= nouveau_falcon_create(parent
, engine
, oclass
, 0x104000, true,
109 "PCE0", "copy0", &priv
);
110 *pobject
= nv_object(priv
);
114 nv_subdev(priv
)->unit
= 0x00000040;
115 nv_subdev(priv
)->intr
= nva3_copy_intr
;
116 nv_engine(priv
)->cclass
= &nvc0_copy0_cclass
;
117 nv_engine(priv
)->sclass
= nvc0_copy0_sclass
;
118 nv_falcon(priv
)->code
.data
= nvc0_pcopy_code
;
119 nv_falcon(priv
)->code
.size
= sizeof(nvc0_pcopy_code
);
120 nv_falcon(priv
)->data
.data
= nvc0_pcopy_data
;
121 nv_falcon(priv
)->data
.size
= sizeof(nvc0_pcopy_data
);
126 nvc0_copy1_ctor(struct nouveau_object
*parent
, struct nouveau_object
*engine
,
127 struct nouveau_oclass
*oclass
, void *data
, u32 size
,
128 struct nouveau_object
**pobject
)
130 struct nvc0_copy_priv
*priv
;
133 ret
= nouveau_falcon_create(parent
, engine
, oclass
, 0x105000, true,
134 "PCE1", "copy1", &priv
);
135 *pobject
= nv_object(priv
);
139 nv_subdev(priv
)->unit
= 0x00000080;
140 nv_subdev(priv
)->intr
= nva3_copy_intr
;
141 nv_engine(priv
)->cclass
= &nvc0_copy1_cclass
;
142 nv_engine(priv
)->sclass
= nvc0_copy1_sclass
;
143 nv_falcon(priv
)->code
.data
= nvc0_pcopy_code
;
144 nv_falcon(priv
)->code
.size
= sizeof(nvc0_pcopy_code
);
145 nv_falcon(priv
)->data
.data
= nvc0_pcopy_data
;
146 nv_falcon(priv
)->data
.size
= sizeof(nvc0_pcopy_data
);
150 struct nouveau_oclass
151 nvc0_copy0_oclass
= {
152 .handle
= NV_ENGINE(COPY0
, 0xc0),
153 .ofuncs
= &(struct nouveau_ofuncs
) {
154 .ctor
= nvc0_copy0_ctor
,
155 .dtor
= _nouveau_falcon_dtor
,
156 .init
= nvc0_copy_init
,
157 .fini
= _nouveau_falcon_fini
,
158 .rd32
= _nouveau_falcon_rd32
,
159 .wr32
= _nouveau_falcon_wr32
,
163 struct nouveau_oclass
164 nvc0_copy1_oclass
= {
165 .handle
= NV_ENGINE(COPY1
, 0xc0),
166 .ofuncs
= &(struct nouveau_ofuncs
) {
167 .ctor
= nvc0_copy1_ctor
,
168 .dtor
= _nouveau_falcon_dtor
,
169 .init
= nvc0_copy_init
,
170 .fini
= _nouveau_falcon_fini
,
171 .rd32
= _nouveau_falcon_rd32
,
172 .wr32
= _nouveau_falcon_wr32
,