drm/nouveau/devinit: switch to subdev printk macros
[deliverable/linux.git] / drivers / gpu / drm / nouveau / nvkm / subdev / devinit / nv20.c
CommitLineData
cb75d97e
BS
1/*
2 * Copyright (C) 2010 Francisco Jerez.
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial
15 * portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 */
cf336014 26#include "nv04.h"
cb75d97e
BS
27#include "fbmem.h"
28
a8c4362b
BS
29#include <subdev/bios.h>
30#include <subdev/bios/init.h>
31
cb75d97e 32static void
aa860e4b 33nv20_devinit_meminit(struct nvkm_devinit *init)
cb75d97e 34{
aa860e4b
BS
35 struct nvkm_subdev *subdev = &init->subdev;
36 struct nvkm_device *device = subdev->device;
cb75d97e
BS
37 uint32_t mask = (device->chipset >= 0x25 ? 0x300 : 0x900);
38 uint32_t amount, off;
39 struct io_mapping *fb;
40
41 /* Map the framebuffer aperture */
266f8b5e 42 fb = fbmem_init(nv_device(init));
cb75d97e 43 if (!fb) {
aa860e4b 44 nvkm_error(subdev, "failed to map fb\n");
cb75d97e
BS
45 return;
46 }
47
8ac3f64f 48 nvkm_wr32(device, NV10_PFB_REFCTRL, NV10_PFB_REFCTRL_VALID_1);
cb75d97e
BS
49
50 /* Allow full addressing */
8ac3f64f 51 nvkm_mask(device, NV04_PFB_CFG0, 0, mask);
cb75d97e 52
8ac3f64f 53 amount = nvkm_rd32(device, 0x10020c);
cb75d97e
BS
54 for (off = amount; off > 0x2000000; off -= 0x2000000)
55 fbmem_poke(fb, off - 4, off);
56
8ac3f64f 57 amount = nvkm_rd32(device, 0x10020c);
cb75d97e
BS
58 if (amount != fbmem_peek(fb, amount - 4))
59 /* IC missing - disable the upper half memory space. */
8ac3f64f 60 nvkm_mask(device, NV04_PFB_CFG0, mask, 0);
cb75d97e
BS
61
62 fbmem_fini(fb);
63}
64
a8c4362b
BS
65struct nvkm_oclass *
66nv20_devinit_oclass = &(struct nvkm_devinit_impl) {
cf336014 67 .base.handle = NV_SUBDEV(DEVINIT, 0x20),
a8c4362b 68 .base.ofuncs = &(struct nvkm_ofuncs) {
cf336014 69 .ctor = nv04_devinit_ctor,
cb75d97e
BS
70 .dtor = nv04_devinit_dtor,
71 .init = nv04_devinit_init,
72 .fini = nv04_devinit_fini,
73 },
cf336014
BS
74 .meminit = nv20_devinit_meminit,
75 .pll_set = nv04_devinit_pll_set,
e21fd7c4 76 .post = nvbios_init,
cf336014 77}.base;
This page took 0.189364 seconds and 5 git commands to generate.