Merge tag 'v3.3.7' into 3.3/master
[zen-stable.git] / drivers / gpu / drm / nouveau / nv84_bsp.c
blob74875739bcc0e8e50e58f9932e1471e12f09026f
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_bsp.c...
36 struct nv84_bsp_engine {
37 struct nouveau_exec_engine base;
40 static int
41 nv84_bsp_fini(struct drm_device *dev, int engine, bool suspend)
43 if (!(nv_rd32(dev, 0x000200) & 0x00008000))
44 return 0;
46 nv_mask(dev, 0x000200, 0x00008000, 0x00000000);
47 return 0;
50 static int
51 nv84_bsp_init(struct drm_device *dev, int engine)
53 nv_mask(dev, 0x000200, 0x00008000, 0x00000000);
54 nv_mask(dev, 0x000200, 0x00008000, 0x00008000);
55 return 0;
58 static void
59 nv84_bsp_destroy(struct drm_device *dev, int engine)
61 struct nv84_bsp_engine *pbsp = nv_engine(dev, engine);
63 NVOBJ_ENGINE_DEL(dev, BSP);
65 kfree(pbsp);
68 int
69 nv84_bsp_create(struct drm_device *dev)
71 struct nv84_bsp_engine *pbsp;
73 pbsp = kzalloc(sizeof(*pbsp), GFP_KERNEL);
74 if (!pbsp)
75 return -ENOMEM;
77 pbsp->base.destroy = nv84_bsp_destroy;
78 pbsp->base.init = nv84_bsp_init;
79 pbsp->base.fini = nv84_bsp_fini;
81 NVOBJ_ENGINE_ADD(dev, BSP, &pbsp->base);
82 return 0;