• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2012 Red Hat Inc.
3  *
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:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
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.
21  *
22  * Authors: Ben Skeggs
23  */
24 
25 #include <core/engine.h>
26 #include <core/engctx.h>
27 #include <core/class.h>
28 
29 #include <engine/ppp.h>
30 
31 struct nv98_ppp_priv {
32 	struct nouveau_engine base;
33 };
34 
35 struct nv98_ppp_chan {
36 	struct nouveau_engctx base;
37 };
38 
39 /*******************************************************************************
40  * PPP object classes
41  ******************************************************************************/
42 
43 static struct nouveau_oclass
44 nv98_ppp_sclass[] = {
45 	{},
46 };
47 
48 /*******************************************************************************
49  * PPPP context
50  ******************************************************************************/
51 
52 static struct nouveau_oclass
53 nv98_ppp_cclass = {
54 	.handle = NV_ENGCTX(PPP, 0x98),
55 	.ofuncs = &(struct nouveau_ofuncs) {
56 		.ctor = _nouveau_engctx_ctor,
57 		.dtor = _nouveau_engctx_dtor,
58 		.init = _nouveau_engctx_init,
59 		.fini = _nouveau_engctx_fini,
60 		.rd32 = _nouveau_engctx_rd32,
61 		.wr32 = _nouveau_engctx_wr32,
62 	},
63 };
64 
65 /*******************************************************************************
66  * PPPP engine/subdev functions
67  ******************************************************************************/
68 
69 static int
nv98_ppp_ctor(struct nouveau_object * parent,struct nouveau_object * engine,struct nouveau_oclass * oclass,void * data,u32 size,struct nouveau_object ** pobject)70 nv98_ppp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
71 	      struct nouveau_oclass *oclass, void *data, u32 size,
72 	      struct nouveau_object **pobject)
73 {
74 	struct nv98_ppp_priv *priv;
75 	int ret;
76 
77 	ret = nouveau_engine_create(parent, engine, oclass, true,
78 				    "PPPP", "ppp", &priv);
79 	*pobject = nv_object(priv);
80 	if (ret)
81 		return ret;
82 
83 	nv_subdev(priv)->unit = 0x00400002;
84 	nv_engine(priv)->cclass = &nv98_ppp_cclass;
85 	nv_engine(priv)->sclass = nv98_ppp_sclass;
86 	return 0;
87 }
88 
89 struct nouveau_oclass
90 nv98_ppp_oclass = {
91 	.handle = NV_ENGINE(PPP, 0x98),
92 	.ofuncs = &(struct nouveau_ofuncs) {
93 		.ctor = nv98_ppp_ctor,
94 		.dtor = _nouveau_engine_dtor,
95 		.init = _nouveau_engine_init,
96 		.fini = _nouveau_engine_fini,
97 	},
98 };
99