nouveau: properly check for _DSM function support
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / gpu / drm / nouveau / nv84_vp.c
blob6570d300ab854c2ce845384814ffb5c93f8b6296
1 /*
2 * Copyright 2011 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.
22 * Authors: Ben Skeggs
25 #include "drmP.h"
26 #include "nouveau_drv.h"
27 #include "nouveau_util.h"
28 #include "nouveau_vm.h"
29 #include "nouveau_ramht.h"
31 /*XXX: This stub is currently used on NV98+ also, as soon as this becomes
32 * more than just an enable/disable stub this needs to be split out to
33 * nv98_vp.c...
36 struct nv84_vp_engine {
37 struct nouveau_exec_engine base;
40 static int
41 nv84_vp_fini(struct drm_device *dev, int engine, bool suspend)
43 if (!(nv_rd32(dev, 0x000200) & 0x00020000))
44 return 0;
46 nv_mask(dev, 0x000200, 0x00020000, 0x00000000);
47 return 0;
50 static int
51 nv84_vp_init(struct drm_device *dev, int engine)
53 nv_mask(dev, 0x000200, 0x00020000, 0x00000000);
54 nv_mask(dev, 0x000200, 0x00020000, 0x00020000);
55 return 0;
58 static void
59 nv84_vp_destroy(struct drm_device *dev, int engine)
61 struct nv84_vp_engine *pvp = nv_engine(dev, engine);
63 NVOBJ_ENGINE_DEL(dev, VP);
65 kfree(pvp);
68 int
69 nv84_vp_create(struct drm_device *dev)
71 struct nv84_vp_engine *pvp;
73 pvp = kzalloc(sizeof(*pvp), GFP_KERNEL);
74 if (!pvp)
75 return -ENOMEM;
77 pvp->base.destroy = nv84_vp_destroy;
78 pvp->base.init = nv84_vp_init;
79 pvp->base.fini = nv84_vp_fini;
81 NVOBJ_ENGINE_ADD(dev, VP, &pvp->base);
82 return 0;