This source file includes following definitions.
- gp100_ram_init
- gp100_ram_probe_fbpa
- gp100_ram_new
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #include "ram.h"
25
26 #include <subdev/bios.h>
27 #include <subdev/bios/init.h>
28 #include <subdev/bios/rammap.h>
29
30 static int
31 gp100_ram_init(struct nvkm_ram *ram)
32 {
33 struct nvkm_subdev *subdev = &ram->fb->subdev;
34 struct nvkm_device *device = subdev->device;
35 struct nvkm_bios *bios = device->bios;
36 u8 ver, hdr, cnt, len, snr, ssz;
37 u32 data;
38 int i;
39
40
41
42
43
44
45
46
47
48
49
50
51 data = nvbios_rammapTe(bios, &ver, &hdr, &cnt, &len, &snr, &ssz);
52 if (!data || hdr < 0x15)
53 return -EINVAL;
54
55 cnt = nvbios_rd08(bios, data + 0x14);
56 data = nvbios_rd32(bios, data + 0x10);
57 if (cnt) {
58 u32 save = nvkm_rd32(device, 0x9a065c) & 0x000000f0;
59 for (i = 0; i < cnt; i++, data += 4) {
60 if (i != save >> 4) {
61 nvkm_mask(device, 0x9a065c, 0x000000f0, i << 4);
62 nvbios_init(subdev, nvbios_rd32(bios, data));
63 }
64 }
65 nvkm_mask(device, 0x9a065c, 0x000000f0, save);
66 }
67
68 nvkm_mask(device, 0x9a0584, 0x11000000, 0x00000000);
69 nvkm_wr32(device, 0x10ecc0, 0xffffffff);
70 nvkm_mask(device, 0x9a0160, 0x00000010, 0x00000010);
71 return 0;
72 }
73
74 static u32
75 gp100_ram_probe_fbpa(struct nvkm_device *device, int fbpa)
76 {
77 return nvkm_rd32(device, 0x90020c + (fbpa * 0x4000));
78 }
79
80 static const struct nvkm_ram_func
81 gp100_ram = {
82 .upper = 0x1000000000,
83 .probe_fbp = gm107_ram_probe_fbp,
84 .probe_fbp_amount = gm200_ram_probe_fbp_amount,
85 .probe_fbpa_amount = gp100_ram_probe_fbpa,
86 .init = gp100_ram_init,
87 };
88
89 int
90 gp100_ram_new(struct nvkm_fb *fb, struct nvkm_ram **pram)
91 {
92 struct nvkm_ram *ram;
93
94 if (!(ram = *pram = kzalloc(sizeof(*ram), GFP_KERNEL)))
95 return -ENOMEM;
96
97 return gf100_ram_ctor(&gp100_ram, fb, ram);
98
99 }