1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26#include "nv04.h"
27#include "fbmem.h"
28
29#include <subdev/bios.h>
30#include <subdev/bios/init.h>
31
32static void
33nv20_devinit_meminit(struct nvkm_devinit *devinit)
34{
35 struct nv04_devinit_priv *priv = (void *)devinit;
36 struct nvkm_device *device = nv_device(priv);
37 uint32_t mask = (device->chipset >= 0x25 ? 0x300 : 0x900);
38 uint32_t amount, off;
39 struct io_mapping *fb;
40
41
42 fb = fbmem_init(nv_device(priv));
43 if (!fb) {
44 nv_error(priv, "failed to map fb\n");
45 return;
46 }
47
48 nv_wr32(priv, NV10_PFB_REFCTRL, NV10_PFB_REFCTRL_VALID_1);
49
50
51 nv_mask(priv, NV04_PFB_CFG0, 0, mask);
52
53 amount = nv_rd32(priv, 0x10020c);
54 for (off = amount; off > 0x2000000; off -= 0x2000000)
55 fbmem_poke(fb, off - 4, off);
56
57 amount = nv_rd32(priv, 0x10020c);
58 if (amount != fbmem_peek(fb, amount - 4))
59
60 nv_mask(priv, NV04_PFB_CFG0, mask, 0);
61
62 fbmem_fini(fb);
63}
64
65struct nvkm_oclass *
66nv20_devinit_oclass = &(struct nvkm_devinit_impl) {
67 .base.handle = NV_SUBDEV(DEVINIT, 0x20),
68 .base.ofuncs = &(struct nvkm_ofuncs) {
69 .ctor = nv04_devinit_ctor,
70 .dtor = nv04_devinit_dtor,
71 .init = nv04_devinit_init,
72 .fini = nv04_devinit_fini,
73 },
74 .meminit = nv20_devinit_meminit,
75 .pll_set = nv04_devinit_pll_set,
76 .post = nvbios_init,
77}.base;
78