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/class.h>
27 #include <core/engctx.h>
29 #include <engine/ppp.h>
31 struct nv98_ppp_priv
{
32 struct nouveau_ppp base
;
35 struct nv98_ppp_chan
{
36 struct nouveau_ppp_chan base
;
39 /*******************************************************************************
41 ******************************************************************************/
43 static struct nouveau_oclass
48 /*******************************************************************************
50 ******************************************************************************/
53 nv98_ppp_context_ctor(struct nouveau_object
*parent
,
54 struct nouveau_object
*engine
,
55 struct nouveau_oclass
*oclass
, void *data
, u32 size
,
56 struct nouveau_object
**pobject
)
58 struct nv98_ppp_chan
*priv
;
61 ret
= nouveau_ppp_context_create(parent
, engine
, oclass
, NULL
,
63 *pobject
= nv_object(priv
);
71 nv98_ppp_context_dtor(struct nouveau_object
*object
)
73 struct nv98_ppp_chan
*priv
= (void *)object
;
74 nouveau_ppp_context_destroy(&priv
->base
);
78 nv98_ppp_context_init(struct nouveau_object
*object
)
80 struct nv98_ppp_chan
*priv
= (void *)object
;
83 ret
= nouveau_ppp_context_init(&priv
->base
);
91 nv98_ppp_context_fini(struct nouveau_object
*object
, bool suspend
)
93 struct nv98_ppp_chan
*priv
= (void *)object
;
94 return nouveau_ppp_context_fini(&priv
->base
, suspend
);
97 static struct nouveau_oclass
99 .handle
= NV_ENGCTX(PPP
, 0x98),
100 .ofuncs
= &(struct nouveau_ofuncs
) {
101 .ctor
= nv98_ppp_context_ctor
,
102 .dtor
= nv98_ppp_context_dtor
,
103 .init
= nv98_ppp_context_init
,
104 .fini
= nv98_ppp_context_fini
,
105 .rd32
= _nouveau_ppp_context_rd32
,
106 .wr32
= _nouveau_ppp_context_wr32
,
110 /*******************************************************************************
111 * PPPP engine/subdev functions
112 ******************************************************************************/
115 nv98_ppp_intr(struct nouveau_subdev
*subdev
)
120 nv98_ppp_ctor(struct nouveau_object
*parent
, struct nouveau_object
*engine
,
121 struct nouveau_oclass
*oclass
, void *data
, u32 size
,
122 struct nouveau_object
**pobject
)
124 struct nv98_ppp_priv
*priv
;
127 ret
= nouveau_ppp_create(parent
, engine
, oclass
, &priv
);
128 *pobject
= nv_object(priv
);
132 nv_subdev(priv
)->unit
= 0x00400002;
133 nv_subdev(priv
)->intr
= nv98_ppp_intr
;
134 nv_engine(priv
)->cclass
= &nv98_ppp_cclass
;
135 nv_engine(priv
)->sclass
= nv98_ppp_sclass
;
140 nv98_ppp_dtor(struct nouveau_object
*object
)
142 struct nv98_ppp_priv
*priv
= (void *)object
;
143 nouveau_ppp_destroy(&priv
->base
);
147 nv98_ppp_init(struct nouveau_object
*object
)
149 struct nv98_ppp_priv
*priv
= (void *)object
;
152 ret
= nouveau_ppp_init(&priv
->base
);
160 nv98_ppp_fini(struct nouveau_object
*object
, bool suspend
)
162 struct nv98_ppp_priv
*priv
= (void *)object
;
163 return nouveau_ppp_fini(&priv
->base
, suspend
);
166 struct nouveau_oclass
168 .handle
= NV_ENGINE(PPP
, 0x98),
169 .ofuncs
= &(struct nouveau_ofuncs
) {
170 .ctor
= nv98_ppp_ctor
,
171 .dtor
= nv98_ppp_dtor
,
172 .init
= nv98_ppp_init
,
173 .fini
= nv98_ppp_fini
,