2 * Copyright 2013 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.
25 #include <subdev/bios.h>
26 #include <subdev/bios/bit.h>
27 #include <subdev/bios/pll.h>
28 #include <subdev/bios/rammap.h>
29 #include <subdev/bios/timing.h>
30 #include <subdev/ltcg.h>
32 #include <subdev/clock.h>
33 #include <subdev/clock/pll.h>
35 #include <core/option.h>
44 struct ramfuc_reg r_0x10fe20;
45 struct ramfuc_reg r_0x10fe24;
46 struct ramfuc_reg r_0x137320;
47 struct ramfuc_reg r_0x137330;
49 struct ramfuc_reg r_0x132000;
50 struct ramfuc_reg r_0x132004;
51 struct ramfuc_reg r_0x132100;
53 struct ramfuc_reg r_0x137390;
55 struct ramfuc_reg r_0x10f290;
56 struct ramfuc_reg r_0x10f294;
57 struct ramfuc_reg r_0x10f298;
58 struct ramfuc_reg r_0x10f29c;
59 struct ramfuc_reg r_0x10f2a0;
61 struct ramfuc_reg r_0x10f300;
62 struct ramfuc_reg r_0x10f338;
63 struct ramfuc_reg r_0x10f340;
64 struct ramfuc_reg r_0x10f344;
65 struct ramfuc_reg r_0x10f348;
67 struct ramfuc_reg r_0x10f910;
68 struct ramfuc_reg r_0x10f914;
70 struct ramfuc_reg r_0x100b0c;
71 struct ramfuc_reg r_0x10f050;
72 struct ramfuc_reg r_0x10f090;
73 struct ramfuc_reg r_0x10f200;
74 struct ramfuc_reg r_0x10f210;
75 struct ramfuc_reg r_0x10f310;
76 struct ramfuc_reg r_0x10f314;
77 struct ramfuc_reg r_0x10f610;
78 struct ramfuc_reg r_0x10f614;
79 struct ramfuc_reg r_0x10f800;
80 struct ramfuc_reg r_0x10f808;
81 struct ramfuc_reg r_0x10f824;
82 struct ramfuc_reg r_0x10f830;
83 struct ramfuc_reg r_0x10f988;
84 struct ramfuc_reg r_0x10f98c;
85 struct ramfuc_reg r_0x10f990;
86 struct ramfuc_reg r_0x10f998;
87 struct ramfuc_reg r_0x10f9b0;
88 struct ramfuc_reg r_0x10f9b4;
89 struct ramfuc_reg r_0x10fb04;
90 struct ramfuc_reg r_0x10fb08;
91 struct ramfuc_reg r_0x137300;
92 struct ramfuc_reg r_0x137310;
93 struct ramfuc_reg r_0x137360;
94 struct ramfuc_reg r_0x1373ec;
95 struct ramfuc_reg r_0x1373f0;
96 struct ramfuc_reg r_0x1373f8;
98 struct ramfuc_reg r_0x61c140;
99 struct ramfuc_reg r_0x611200;
101 struct ramfuc_reg r_0x13d8f4;
105 struct nouveau_ram base;
106 struct nvc0_ramfuc fuc;
107 struct nvbios_pll refpll;
108 struct nvbios_pll mempll;
112 nvc0_ram_train(struct nvc0_ramfuc *fuc, u32 magic)
114 struct nvc0_ram *ram = container_of(fuc, typeof(*ram), fuc);
115 struct nouveau_fb *pfb = nouveau_fb(ram);
116 u32 part = nv_rd32(pfb, 0x022438), i;
117 u32 mask = nv_rd32(pfb, 0x022554);
120 ram_wr32(fuc, 0x10f910, magic);
121 ram_wr32(fuc, 0x10f914, magic);
123 for (i = 0; (magic & 0x80000000) && i < part; addr += 0x1000, i++) {
126 ram_wait(fuc, addr, 0x0000000f, 0x00000000, 500000);
131 nvc0_ram_calc(struct nouveau_fb *pfb, u32 freq)
133 struct nouveau_clock *clk = nouveau_clock(pfb);
134 struct nouveau_bios *bios = nouveau_bios(pfb);
135 struct nvc0_ram *ram = (void *)pfb->ram;
136 struct nvc0_ramfuc *fuc = &ram->fuc;
143 } rammap, ramcfg, timing;
149 /* lookup memory config data relevant to the target frequency */
150 rammap.data = nvbios_rammap_match(bios, freq / 1000, &ver, &rammap.size,
152 if (!rammap.data || ver != 0x10 || rammap.size < 0x0e) {
153 nv_error(pfb, "invalid/missing rammap entry\n");
157 /* locate specific data set for the attached memory */
158 if (bit_entry(bios, 'M', &M) || M.version != 2 || M.length < 3) {
159 nv_error(pfb, "invalid/missing memory table\n");
163 strap = (nv_rd32(pfb, 0x101000) & 0x0000003c) >> 2;
164 data = nv_ro16(bios, M.offset + 1);
166 strap = nv_ro08(bios, data + strap);
169 nv_error(pfb, "invalid ramcfg strap\n");
173 ramcfg.data = rammap.data + rammap.size + (strap * ramcfg.size);
174 if (!ramcfg.data || ver != 0x10 || ramcfg.size < 0x0e) {
175 nv_error(pfb, "invalid/missing ramcfg entry\n");
179 /* lookup memory timings, if bios says they're present */
180 strap = nv_ro08(bios, ramcfg.data + 0x01);
182 timing.data = nvbios_timing_entry(bios, strap, &ver,
184 if (!timing.data || ver != 0x10 || timing.size < 0x19) {
185 nv_error(pfb, "invalid/missing timing entry\n");
192 ret = ram_init(fuc, pfb);
196 /* determine current mclk configuration */
197 from = !!(ram_rd32(fuc, 0x1373f0) & 0x00000002); /*XXX: ok? */
199 /* determine target mclk configuration */
200 if (!(ram_rd32(fuc, 0x137300) & 0x00000100))
201 ref = clk->read(clk, nv_clk_src_sppll0);
203 ref = clk->read(clk, nv_clk_src_sppll1);
204 div = max(min((ref * 2) / freq, (u32)65), (u32)2) - 2;
205 out = (ref * 2) / (div + 2);
208 ram_mask(fuc, 0x137360, 0x00000002, 0x00000000);
210 if ((ram_rd32(fuc, 0x132000) & 0x00000002) || 0 /*XXX*/) {
211 ram_nuke(fuc, 0x132000);
212 ram_mask(fuc, 0x132000, 0x00000002, 0x00000002);
213 ram_mask(fuc, 0x132000, 0x00000002, 0x00000000);
217 ram_nuke(fuc, 0x10fe20);
218 ram_mask(fuc, 0x10fe20, 0x00000002, 0x00000002);
219 ram_mask(fuc, 0x10fe20, 0x00000002, 0x00000000);
222 // 0x00020034 // 0x0000000a
223 ram_wr32(fuc, 0x132100, 0x00000001);
225 if (mode == 1 && from == 0) {
226 /* calculate refpll */
227 ret = nva3_pll_calc(nv_subdev(pfb), &ram->refpll,
228 ram->mempll.refclk, &N1, NULL, &M1, &P);
230 nv_error(pfb, "unable to calc refpll\n");
231 return ret ? ret : -ERANGE;
234 ram_wr32(fuc, 0x10fe20, 0x20010000);
235 ram_wr32(fuc, 0x137320, 0x00000003);
236 ram_wr32(fuc, 0x137330, 0x81200006);
237 ram_wr32(fuc, 0x10fe24, (P << 16) | (N1 << 8) | M1);
238 ram_wr32(fuc, 0x10fe20, 0x20010001);
239 ram_wait(fuc, 0x137390, 0x00020000, 0x00020000, 64000);
241 /* calculate mempll */
242 ret = nva3_pll_calc(nv_subdev(pfb), &ram->mempll, freq,
245 nv_error(pfb, "unable to calc refpll\n");
246 return ret ? ret : -ERANGE;
249 ram_wr32(fuc, 0x10fe20, 0x20010005);
250 ram_wr32(fuc, 0x132004, (P << 16) | (N1 << 8) | M1);
251 ram_wr32(fuc, 0x132000, 0x18010101);
252 ram_wait(fuc, 0x137390, 0x00000002, 0x00000002, 64000);
255 ram_wr32(fuc, 0x137300, 0x00000003);
259 ram_nuke(fuc, 0x10fb04);
260 ram_mask(fuc, 0x10fb04, 0x0000ffff, 0x00000000);
261 ram_nuke(fuc, 0x10fb08);
262 ram_mask(fuc, 0x10fb08, 0x0000ffff, 0x00000000);
263 ram_wr32(fuc, 0x10f988, 0x2004ff00);
264 ram_wr32(fuc, 0x10f98c, 0x003fc040);
265 ram_wr32(fuc, 0x10f990, 0x20012001);
266 ram_wr32(fuc, 0x10f998, 0x00011a00);
267 ram_wr32(fuc, 0x13d8f4, 0x00000000);
269 ram_wr32(fuc, 0x10f988, 0x20010000);
270 ram_wr32(fuc, 0x10f98c, 0x00000000);
271 ram_wr32(fuc, 0x10f990, 0x20012001);
272 ram_wr32(fuc, 0x10f998, 0x00010a00);
276 // 0x00020039 // 0x000000ba
279 // 0x0002003a // 0x00000002
280 ram_wr32(fuc, 0x100b0c, 0x00080012);
281 // 0x00030014 // 0x00000000 // 0x02b5f070
282 // 0x00030014 // 0x00010000 // 0x02b5f070
283 ram_wr32(fuc, 0x611200, 0x00003300);
284 // 0x00020034 // 0x0000000a
285 // 0x00030020 // 0x00000001 // 0x00000000
287 ram_mask(fuc, 0x10f200, 0x00000800, 0x00000000);
288 ram_wr32(fuc, 0x10f210, 0x00000000);
291 nvc0_ram_train(fuc, 0x000c1001);
292 ram_wr32(fuc, 0x10f310, 0x00000001);
294 ram_wr32(fuc, 0x10f090, 0x00000061);
295 ram_wr32(fuc, 0x10f090, 0xc000007f);
299 ram_wr32(fuc, 0x10f824, 0x00007fd4);
301 ram_wr32(fuc, 0x1373ec, 0x00020404);
305 ram_mask(fuc, 0x10f808, 0x00080000, 0x00000000);
306 ram_mask(fuc, 0x10f200, 0x00008000, 0x00008000);
307 ram_wr32(fuc, 0x10f830, 0x41500010);
308 ram_mask(fuc, 0x10f830, 0x01000000, 0x00000000);
309 ram_mask(fuc, 0x132100, 0x00000100, 0x00000100);
310 ram_wr32(fuc, 0x10f050, 0xff000090);
311 ram_wr32(fuc, 0x1373ec, 0x00020f0f);
312 ram_wr32(fuc, 0x1373f0, 0x00000003);
313 ram_wr32(fuc, 0x137310, 0x81201616);
314 ram_wr32(fuc, 0x132100, 0x00000001);
315 // 0x00020039 // 0x000000ba
316 ram_wr32(fuc, 0x10f830, 0x00300017);
317 ram_wr32(fuc, 0x1373f0, 0x00000001);
318 ram_wr32(fuc, 0x10f824, 0x00007e77);
319 ram_wr32(fuc, 0x132000, 0x18030001);
320 ram_wr32(fuc, 0x10f090, 0x4000007e);
322 ram_wr32(fuc, 0x10f314, 0x00000001);
323 ram_wr32(fuc, 0x10f210, 0x80000000);
324 ram_wr32(fuc, 0x10f338, 0x00300220);
325 ram_wr32(fuc, 0x10f300, 0x0000011d);
327 ram_wr32(fuc, 0x10f290, 0x02060505);
328 ram_wr32(fuc, 0x10f294, 0x34208288);
329 ram_wr32(fuc, 0x10f298, 0x44050411);
330 ram_wr32(fuc, 0x10f29c, 0x0000114c);
331 ram_wr32(fuc, 0x10f2a0, 0x42e10069);
332 ram_wr32(fuc, 0x10f614, 0x40044f77);
333 ram_wr32(fuc, 0x10f610, 0x40044f77);
334 ram_wr32(fuc, 0x10f344, 0x00600009);
336 ram_wr32(fuc, 0x10f348, 0x00700008);
337 ram_wr32(fuc, 0x61c140, 0x19240000);
338 ram_wr32(fuc, 0x10f830, 0x00300017);
339 nvc0_ram_train(fuc, 0x80021001);
340 nvc0_ram_train(fuc, 0x80081001);
341 ram_wr32(fuc, 0x10f340, 0x00500004);
343 ram_wr32(fuc, 0x10f830, 0x01300017);
344 ram_wr32(fuc, 0x10f830, 0x00300017);
345 // 0x00030020 // 0x00000000 // 0x00000000
346 // 0x00020034 // 0x0000000b
347 ram_wr32(fuc, 0x100b0c, 0x00080028);
348 ram_wr32(fuc, 0x611200, 0x00003330);
350 ram_wr32(fuc, 0x10f800, 0x00001800);
351 ram_wr32(fuc, 0x13d8f4, 0x00000000);
352 ram_wr32(fuc, 0x1373ec, 0x00020404);
353 ram_wr32(fuc, 0x1373f0, 0x00000003);
354 ram_wr32(fuc, 0x10f830, 0x40700010);
355 ram_wr32(fuc, 0x10f830, 0x40500010);
356 ram_wr32(fuc, 0x13d8f4, 0x00000000);
357 ram_wr32(fuc, 0x1373f8, 0x00000000);
358 ram_wr32(fuc, 0x132100, 0x00000101);
359 ram_wr32(fuc, 0x137310, 0x89201616);
360 ram_wr32(fuc, 0x10f050, 0xff000090);
361 ram_wr32(fuc, 0x1373ec, 0x00030404);
362 ram_wr32(fuc, 0x1373f0, 0x00000002);
363 // 0x00020039 // 0x00000011
364 ram_wr32(fuc, 0x132100, 0x00000001);
365 ram_wr32(fuc, 0x1373f8, 0x00002000);
367 ram_wr32(fuc, 0x10f808, 0x7aaa0050);
368 ram_wr32(fuc, 0x10f830, 0x00500010);
369 ram_wr32(fuc, 0x10f200, 0x00ce1000);
370 ram_wr32(fuc, 0x10f090, 0x4000007e);
372 ram_wr32(fuc, 0x10f314, 0x00000001);
373 ram_wr32(fuc, 0x10f210, 0x80000000);
374 ram_wr32(fuc, 0x10f338, 0x00300200);
375 ram_wr32(fuc, 0x10f300, 0x0000084d);
377 ram_wr32(fuc, 0x10f290, 0x0b343825);
378 ram_wr32(fuc, 0x10f294, 0x3483028e);
379 ram_wr32(fuc, 0x10f298, 0x440c0600);
380 ram_wr32(fuc, 0x10f29c, 0x0000214c);
381 ram_wr32(fuc, 0x10f2a0, 0x42e20069);
382 ram_wr32(fuc, 0x10f200, 0x00ce0000);
383 ram_wr32(fuc, 0x10f614, 0x60044e77);
384 ram_wr32(fuc, 0x10f610, 0x60044e77);
385 ram_wr32(fuc, 0x10f340, 0x00500000);
387 ram_wr32(fuc, 0x10f344, 0x00600228);
389 ram_wr32(fuc, 0x10f348, 0x00700000);
390 ram_wr32(fuc, 0x13d8f4, 0x00000000);
391 ram_wr32(fuc, 0x61c140, 0x09a40000);
393 nvc0_ram_train(fuc, 0x800e1008);
396 ram_wr32(fuc, 0x10f800, 0x00001804);
397 // 0x00030020 // 0x00000000 // 0x00000000
398 // 0x00020034 // 0x0000000b
399 ram_wr32(fuc, 0x13d8f4, 0x00000000);
400 ram_wr32(fuc, 0x100b0c, 0x00080028);
401 ram_wr32(fuc, 0x611200, 0x00003330);
402 ram_nsec(fuc, 100000);
403 ram_wr32(fuc, 0x10f9b0, 0x05313f41);
404 ram_wr32(fuc, 0x10f9b4, 0x00002f50);
406 nvc0_ram_train(fuc, 0x010c1001);
409 ram_mask(fuc, 0x10f200, 0x00000800, 0x00000800);
410 // 0x00020016 // 0x00000000
413 ram_mask(fuc, 0x132000, 0x00000001, 0x00000000);
418 nvc0_ram_prog(struct nouveau_fb *pfb)
420 struct nouveau_device *device = nv_device(pfb);
421 struct nvc0_ram *ram = (void *)pfb->ram;
422 struct nvc0_ramfuc *fuc = &ram->fuc;
423 ram_exec(fuc, nouveau_boolopt(device->cfgopt, "NvMemExec", false));
428 nvc0_ram_tidy(struct nouveau_fb *pfb)
430 struct nvc0_ram *ram = (void *)pfb->ram;
431 struct nvc0_ramfuc *fuc = &ram->fuc;
432 ram_exec(fuc, false);
435 extern const u8 nvc0_pte_storage_type_map[256];
438 nvc0_ram_put(struct nouveau_fb *pfb, struct nouveau_mem **pmem)
440 struct nouveau_ltcg *ltcg = nouveau_ltcg(pfb);
441 struct nouveau_mem *mem = *pmem;
444 if (unlikely(mem == NULL))
447 mutex_lock(&pfb->base.mutex);
449 ltcg->tags_free(ltcg, &mem->tag);
450 __nv50_ram_put(pfb, mem);
451 mutex_unlock(&pfb->base.mutex);
457 nvc0_ram_get(struct nouveau_fb *pfb, u64 size, u32 align, u32 ncmin,
458 u32 memtype, struct nouveau_mem **pmem)
460 struct nouveau_mm *mm = &pfb->vram;
461 struct nouveau_mm_node *r;
462 struct nouveau_mem *mem;
463 int type = (memtype & 0x0ff);
464 int back = (memtype & 0x800);
465 const bool comp = nvc0_pte_storage_type_map[type] != type;
474 mem = kzalloc(sizeof(*mem), GFP_KERNEL);
478 INIT_LIST_HEAD(&mem->regions);
481 mutex_lock(&pfb->base.mutex);
483 struct nouveau_ltcg *ltcg = nouveau_ltcg(pfb);
485 /* compression only works with lpages */
486 if (align == (1 << (17 - 12))) {
488 ltcg->tags_alloc(ltcg, n, &mem->tag);
491 if (unlikely(!mem->tag))
492 type = nvc0_pte_storage_type_map[type];
498 ret = nouveau_mm_tail(mm, 1, size, ncmin, align, &r);
500 ret = nouveau_mm_head(mm, 1, size, ncmin, align, &r);
502 mutex_unlock(&pfb->base.mutex);
503 pfb->ram->put(pfb, &mem);
507 list_add_tail(&r->rl_entry, &mem->regions);
510 mutex_unlock(&pfb->base.mutex);
512 r = list_first_entry(&mem->regions, struct nouveau_mm_node, rl_entry);
513 mem->offset = (u64)r->offset << 12;
519 nvc0_ram_create_(struct nouveau_object *parent, struct nouveau_object *engine,
520 struct nouveau_oclass *oclass, int size, void **pobject)
522 struct nouveau_fb *pfb = nouveau_fb(parent);
523 struct nouveau_bios *bios = nouveau_bios(pfb);
524 struct nouveau_ram *ram;
525 const u32 rsvd_head = ( 256 * 1024) >> 12; /* vga memory */
526 const u32 rsvd_tail = (1024 * 1024) >> 12; /* vbios etc */
527 u32 parts = nv_rd32(pfb, 0x022438);
528 u32 pmask = nv_rd32(pfb, 0x022554);
529 u32 bsize = nv_rd32(pfb, 0x10f20c);
534 ret = nouveau_ram_create_(parent, engine, oclass, size, pobject);
539 nv_debug(pfb, "0x100800: 0x%08x\n", nv_rd32(pfb, 0x100800));
540 nv_debug(pfb, "parts 0x%08x mask 0x%08x\n", parts, pmask);
542 ram->type = nouveau_fb_bios_memtype(bios);
543 ram->ranks = (nv_rd32(pfb, 0x10f200) & 0x00000004) ? 2 : 1;
545 /* read amount of vram attached to each memory controller */
546 for (part = 0; part < parts; part++) {
547 if (!(pmask & (1 << part))) {
548 u32 psize = nv_rd32(pfb, 0x11020c + (part * 0x1000));
549 if (psize != bsize) {
555 nv_debug(pfb, "%d: mem_amount 0x%08x\n", part, psize);
556 ram->size += (u64)psize << 20;
560 /* if all controllers have the same amount attached, there's no holes */
563 length = (ram->size >> 12) - rsvd_head - rsvd_tail;
564 ret = nouveau_mm_init(&pfb->vram, offset, length, 1);
566 /* otherwise, address lowest common amount from 0GiB */
567 ret = nouveau_mm_init(&pfb->vram, rsvd_head,
568 (bsize << 8) * parts, 1);
572 /* and the rest starting from (8GiB + common_size) */
573 offset = (0x0200000000ULL >> 12) + (bsize << 8);
574 length = (ram->size >> 12) - (bsize << 8) - rsvd_tail;
576 ret = nouveau_mm_init(&pfb->vram, offset, length, 0);
578 nouveau_mm_fini(&pfb->vram);
584 ram->get = nvc0_ram_get;
585 ram->put = nvc0_ram_put;
590 nvc0_ram_init(struct nouveau_object *object)
592 struct nouveau_fb *pfb = (void *)object->parent;
593 struct nvc0_ram *ram = (void *)object;
596 ret = nouveau_ram_init(&ram->base);
600 /* prepare for ddr link training, and load training patterns */
601 switch (ram->base.type) {
602 case NV_MEM_TYPE_GDDR5: {
603 static const u8 train0[] = {
604 0x00, 0xff, 0x55, 0xaa, 0x33, 0xcc,
605 0x00, 0xff, 0xff, 0x00, 0xff, 0x00,
607 static const u32 train1[] = {
608 0x00000000, 0xffffffff,
609 0x55555555, 0xaaaaaaaa,
610 0x33333333, 0xcccccccc,
611 0xf0f0f0f0, 0x0f0f0f0f,
612 0x00ff00ff, 0xff00ff00,
613 0x0000ffff, 0xffff0000,
616 for (i = 0; i < 0x30; i++) {
617 nv_wr32(pfb, 0x10f968, 0x00000000 | (i << 8));
618 nv_wr32(pfb, 0x10f96c, 0x00000000 | (i << 8));
619 nv_wr32(pfb, 0x10f920, 0x00000100 | train0[i % 12]);
620 nv_wr32(pfb, 0x10f924, 0x00000100 | train0[i % 12]);
621 nv_wr32(pfb, 0x10f918, train1[i % 12]);
622 nv_wr32(pfb, 0x10f91c, train1[i % 12]);
623 nv_wr32(pfb, 0x10f920, 0x00000000 | train0[i % 12]);
624 nv_wr32(pfb, 0x10f924, 0x00000000 | train0[i % 12]);
625 nv_wr32(pfb, 0x10f918, train1[i % 12]);
626 nv_wr32(pfb, 0x10f91c, train1[i % 12]);
637 nvc0_ram_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
638 struct nouveau_oclass *oclass, void *data, u32 size,
639 struct nouveau_object **pobject)
641 struct nouveau_bios *bios = nouveau_bios(parent);
642 struct nvc0_ram *ram;
645 ret = nvc0_ram_create(parent, engine, oclass, &ram);
646 *pobject = nv_object(ram);
650 ret = nvbios_pll_parse(bios, 0x0c, &ram->refpll);
652 nv_error(ram, "mclk refpll data not found\n");
656 ret = nvbios_pll_parse(bios, 0x04, &ram->mempll);
658 nv_error(ram, "mclk pll data not found\n");
662 switch (ram->base.type) {
663 case NV_MEM_TYPE_GDDR5:
664 ram->base.calc = nvc0_ram_calc;
665 ram->base.prog = nvc0_ram_prog;
666 ram->base.tidy = nvc0_ram_tidy;
669 nv_warn(ram, "reclocking of this ram type unsupported\n");
673 ram->fuc.r_0x10fe20 = ramfuc_reg(0x10fe20);
674 ram->fuc.r_0x10fe24 = ramfuc_reg(0x10fe24);
675 ram->fuc.r_0x137320 = ramfuc_reg(0x137320);
676 ram->fuc.r_0x137330 = ramfuc_reg(0x137330);
678 ram->fuc.r_0x132000 = ramfuc_reg(0x132000);
679 ram->fuc.r_0x132004 = ramfuc_reg(0x132004);
680 ram->fuc.r_0x132100 = ramfuc_reg(0x132100);
682 ram->fuc.r_0x137390 = ramfuc_reg(0x137390);
684 ram->fuc.r_0x10f290 = ramfuc_reg(0x10f290);
685 ram->fuc.r_0x10f294 = ramfuc_reg(0x10f294);
686 ram->fuc.r_0x10f298 = ramfuc_reg(0x10f298);
687 ram->fuc.r_0x10f29c = ramfuc_reg(0x10f29c);
688 ram->fuc.r_0x10f2a0 = ramfuc_reg(0x10f2a0);
690 ram->fuc.r_0x10f300 = ramfuc_reg(0x10f300);
691 ram->fuc.r_0x10f338 = ramfuc_reg(0x10f338);
692 ram->fuc.r_0x10f340 = ramfuc_reg(0x10f340);
693 ram->fuc.r_0x10f344 = ramfuc_reg(0x10f344);
694 ram->fuc.r_0x10f348 = ramfuc_reg(0x10f348);
696 ram->fuc.r_0x10f910 = ramfuc_reg(0x10f910);
697 ram->fuc.r_0x10f914 = ramfuc_reg(0x10f914);
699 ram->fuc.r_0x100b0c = ramfuc_reg(0x100b0c);
700 ram->fuc.r_0x10f050 = ramfuc_reg(0x10f050);
701 ram->fuc.r_0x10f090 = ramfuc_reg(0x10f090);
702 ram->fuc.r_0x10f200 = ramfuc_reg(0x10f200);
703 ram->fuc.r_0x10f210 = ramfuc_reg(0x10f210);
704 ram->fuc.r_0x10f310 = ramfuc_reg(0x10f310);
705 ram->fuc.r_0x10f314 = ramfuc_reg(0x10f314);
706 ram->fuc.r_0x10f610 = ramfuc_reg(0x10f610);
707 ram->fuc.r_0x10f614 = ramfuc_reg(0x10f614);
708 ram->fuc.r_0x10f800 = ramfuc_reg(0x10f800);
709 ram->fuc.r_0x10f808 = ramfuc_reg(0x10f808);
710 ram->fuc.r_0x10f824 = ramfuc_reg(0x10f824);
711 ram->fuc.r_0x10f830 = ramfuc_reg(0x10f830);
712 ram->fuc.r_0x10f988 = ramfuc_reg(0x10f988);
713 ram->fuc.r_0x10f98c = ramfuc_reg(0x10f98c);
714 ram->fuc.r_0x10f990 = ramfuc_reg(0x10f990);
715 ram->fuc.r_0x10f998 = ramfuc_reg(0x10f998);
716 ram->fuc.r_0x10f9b0 = ramfuc_reg(0x10f9b0);
717 ram->fuc.r_0x10f9b4 = ramfuc_reg(0x10f9b4);
718 ram->fuc.r_0x10fb04 = ramfuc_reg(0x10fb04);
719 ram->fuc.r_0x10fb08 = ramfuc_reg(0x10fb08);
720 ram->fuc.r_0x137310 = ramfuc_reg(0x137300);
721 ram->fuc.r_0x137310 = ramfuc_reg(0x137310);
722 ram->fuc.r_0x137360 = ramfuc_reg(0x137360);
723 ram->fuc.r_0x1373ec = ramfuc_reg(0x1373ec);
724 ram->fuc.r_0x1373f0 = ramfuc_reg(0x1373f0);
725 ram->fuc.r_0x1373f8 = ramfuc_reg(0x1373f8);
727 ram->fuc.r_0x61c140 = ramfuc_reg(0x61c140);
728 ram->fuc.r_0x611200 = ramfuc_reg(0x611200);
730 ram->fuc.r_0x13d8f4 = ramfuc_reg(0x13d8f4);
734 struct nouveau_oclass
737 .ofuncs = &(struct nouveau_ofuncs) {
738 .ctor = nvc0_ram_ctor,
739 .dtor = _nouveau_ram_dtor,
740 .init = nvc0_ram_init,
741 .fini = _nouveau_ram_fini,