1/* $NetBSD: nouveau_subdev_pwr_nvc0.c,v 1.1.1.1 2014/08/06 12:36:31 riastradh Exp $ */
2
3/*
4 * Copyright 2013 Red Hat Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 *
24 * Authors: Ben Skeggs
25 */
26
27#include <sys/cdefs.h>
28__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_pwr_nvc0.c,v 1.1.1.1 2014/08/06 12:36:31 riastradh Exp $");
29
30#include <subdev/pwr.h>
31
32#include "fuc/nvc0.fuc.h"
33
34struct nvc0_pwr_priv {
35 struct nouveau_pwr base;
36};
37
38static int
39nvc0_pwr_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
40 struct nouveau_oclass *oclass, void *data, u32 size,
41 struct nouveau_object **pobject)
42{
43 struct nvc0_pwr_priv *priv;
44 int ret;
45
46 ret = nouveau_pwr_create(parent, engine, oclass, &priv);
47 *pobject = nv_object(priv);
48 if (ret)
49 return ret;
50
51 priv->base.code.data = nvc0_pwr_code;
52 priv->base.code.size = sizeof(nvc0_pwr_code);
53 priv->base.data.data = nvc0_pwr_data;
54 priv->base.data.size = sizeof(nvc0_pwr_data);
55 return 0;
56}
57
58struct nouveau_oclass
59nvc0_pwr_oclass = {
60 .handle = NV_SUBDEV(PWR, 0xc0),
61 .ofuncs = &(struct nouveau_ofuncs) {
62 .ctor = nvc0_pwr_ctor,
63 .dtor = _nouveau_pwr_dtor,
64 .init = _nouveau_pwr_init,
65 .fini = _nouveau_pwr_fini,
66 },
67};
68