Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nv84.c
Go to the documentation of this file.
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/os.h>
26 #include <core/class.h>
27 #include <core/engctx.h>
28 
29 #include <engine/bsp.h>
30 
31 struct nv84_bsp_priv {
32  struct nouveau_bsp base;
33 };
34 
35 struct nv84_bsp_chan {
37 };
38 
39 /*******************************************************************************
40  * BSP object classes
41  ******************************************************************************/
42 
43 static struct nouveau_oclass
44 nv84_bsp_sclass[] = {
45  {},
46 };
47 
48 /*******************************************************************************
49  * BSP context
50  ******************************************************************************/
51 
52 static int
53 nv84_bsp_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)
57 {
58  struct nv84_bsp_chan *priv;
59  int ret;
60 
61  ret = nouveau_bsp_context_create(parent, engine, oclass, NULL,
62  0, 0, 0, &priv);
63  *pobject = nv_object(priv);
64  if (ret)
65  return ret;
66 
67  return 0;
68 }
69 
70 static void
71 nv84_bsp_context_dtor(struct nouveau_object *object)
72 {
73  struct nv84_bsp_chan *priv = (void *)object;
75 }
76 
77 static int
78 nv84_bsp_context_init(struct nouveau_object *object)
79 {
80  struct nv84_bsp_chan *priv = (void *)object;
81  int ret;
82 
83  ret = nouveau_bsp_context_init(&priv->base);
84  if (ret)
85  return ret;
86 
87  return 0;
88 }
89 
90 static int
91 nv84_bsp_context_fini(struct nouveau_object *object, bool suspend)
92 {
93  struct nv84_bsp_chan *priv = (void *)object;
94  return nouveau_bsp_context_fini(&priv->base, suspend);
95 }
96 
97 static struct nouveau_oclass
98 nv84_bsp_cclass = {
99  .handle = NV_ENGCTX(BSP, 0x84),
100  .ofuncs = &(struct nouveau_ofuncs) {
101  .ctor = nv84_bsp_context_ctor,
102  .dtor = nv84_bsp_context_dtor,
103  .init = nv84_bsp_context_init,
104  .fini = nv84_bsp_context_fini,
107  },
108 };
109 
110 /*******************************************************************************
111  * BSP engine/subdev functions
112  ******************************************************************************/
113 
114 static void
115 nv84_bsp_intr(struct nouveau_subdev *subdev)
116 {
117 }
118 
119 static int
120 nv84_bsp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
121  struct nouveau_oclass *oclass, void *data, u32 size,
122  struct nouveau_object **pobject)
123 {
124  struct nv84_bsp_priv *priv;
125  int ret;
126 
127  ret = nouveau_bsp_create(parent, engine, oclass, &priv);
128  *pobject = nv_object(priv);
129  if (ret)
130  return ret;
131 
132  nv_subdev(priv)->unit = 0x04008000;
133  nv_subdev(priv)->intr = nv84_bsp_intr;
134  nv_engine(priv)->cclass = &nv84_bsp_cclass;
135  nv_engine(priv)->sclass = nv84_bsp_sclass;
136  return 0;
137 }
138 
139 static void
140 nv84_bsp_dtor(struct nouveau_object *object)
141 {
142  struct nv84_bsp_priv *priv = (void *)object;
143  nouveau_bsp_destroy(&priv->base);
144 }
145 
146 static int
147 nv84_bsp_init(struct nouveau_object *object)
148 {
149  struct nv84_bsp_priv *priv = (void *)object;
150  int ret;
151 
152  ret = nouveau_bsp_init(&priv->base);
153  if (ret)
154  return ret;
155 
156  return 0;
157 }
158 
159 static int
160 nv84_bsp_fini(struct nouveau_object *object, bool suspend)
161 {
162  struct nv84_bsp_priv *priv = (void *)object;
163  return nouveau_bsp_fini(&priv->base, suspend);
164 }
165 
166 struct nouveau_oclass
168  .handle = NV_ENGINE(BSP, 0x84),
169  .ofuncs = &(struct nouveau_ofuncs) {
170  .ctor = nv84_bsp_ctor,
171  .dtor = nv84_bsp_dtor,
172  .init = nv84_bsp_init,
173  .fini = nv84_bsp_fini,
174  },
175 };