~ubuntu-branches/ubuntu/raring/xserver-xorg-video-nouveau/raring

« back to all changes in this revision

Viewing changes to src/nouveau_calc.c

  • Committer: Bazaar Package Importer
  • Author(s): Christopher James Halse Rogers
  • Date: 2009-07-08 08:31:59 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20090708083159-43u08h03oku0d1h1
Tags: 1:0.0.10~git+20090708+ef3a386-0ubuntu1
* New upstream snapshot
  + Too many git commits to usefully list in changelog.  Lots of fixes,
    especially for nv5x and nv6x chips.

Show diffs side-by-side

added added

removed removed

Lines of Context:
346
346
        sim_data.enable_mp = false;
347
347
        if ((pNv->Chipset & 0xffff) == CHIPSET_NFORCE ||
348
348
            (pNv->Chipset & 0xffff) == CHIPSET_NFORCE2) {
 
349
                struct pci_device *dev = pci_device_find_by_slot(0, 0, 0, 1);
 
350
                uint32_t data;
 
351
 
 
352
                pci_device_cfg_read_u32(dev, &data, 0x7c);
 
353
 
349
354
                sim_data.enable_video = false;
350
 
                sim_data.memory_type = (PCI_SLOT_READ_LONG(1, 0x7c) >> 12) & 1;
 
355
                sim_data.memory_type = (data >> 12) & 1;
351
356
                sim_data.memory_width = 64;
352
357
                sim_data.mem_latency = 3;
353
358
                sim_data.mem_page_miss = 10;
420
425
        int minM = pll_lim->vco1.min_m, maxM = pll_lim->vco1.max_m;
421
426
        int minN = pll_lim->vco1.min_n, maxN = pll_lim->vco1.max_n;
422
427
        int minU = pll_lim->vco1.min_inputfreq, maxU = pll_lim->vco1.max_inputfreq;
423
 
        int maxlog2P;
 
428
        int maxlog2P = pll_lim->max_usable_log2p;
424
429
        int crystal = pll_lim->refclk;
425
430
        int M, N, log2P, P;
426
431
        int clkP, calcclk;
434
439
                        maxM = 6;
435
440
                if (clk > 340000)
436
441
                        maxM = 2;
437
 
                maxlog2P = 4;
438
442
        } else if (cv < 0x40) {
439
443
                if (clk > 150000)
440
444
                        maxM = 6;
442
446
                        maxM = 4;
443
447
                if (clk > 340000)
444
448
                        maxM = 2;
445
 
                maxlog2P = 5;
446
 
        } else /* nv4x may be subject to the nv17+ limits, but assume not for now */
447
 
                maxlog2P = 6;
 
449
        }
448
450
 
449
451
        if ((clk << maxlog2P) < minvco) {
450
452
                minvco = clk << maxlog2P;
519
521
        int minN1 = pll_lim->vco1.min_n, maxN1 = pll_lim->vco1.max_n;
520
522
        int minM2 = pll_lim->vco2.min_m, maxM2 = pll_lim->vco2.max_m;
521
523
        int minN2 = pll_lim->vco2.min_n, maxN2 = pll_lim->vco2.max_n;
 
524
        int maxlog2P = pll_lim->max_usable_log2p;
522
525
        int crystal = pll_lim->refclk;
523
526
        bool fixedgain2 = (minM2 == maxM2 && minN2 == maxN2);
524
527
        int M1, N1, M2, N2, log2P;
527
530
        int bestclk = 0;
528
531
 
529
532
        int vco2 = (maxvco2 - maxvco2/200) / 2;
530
 
        for (log2P = 0; clk && log2P < 6 && clk <= (vco2 >> log2P); log2P++) /* log2P is maximum of 6 */
 
533
        for (log2P = 0; clk && log2P < maxlog2P && clk <= (vco2 >> log2P); log2P++)
531
534
                ;
532
535
        clkP = clk << log2P;
533
536
 
607
610
                outclk = getMNP_double(pScrn, pll_lim, clk, pv);
608
611
 
609
612
        if (!outclk)
610
 
                xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
611
 
                           "Could not find a compatible set of PLL values\n");
 
613
                NV_ERROR(pScrn,
 
614
                         "Could not find a compatible set of PLL values\n");
612
615
 
613
616
        return outclk;
614
617
}