1 diff -ru SVGATextMode-1.10.orig/XFREE/riva128_clock.c SVGATextMode-1.10/XFREE/riva128_clock.c
2 --- SVGATextMode-1.10.orig/XFREE/riva128_clock.c Tue Jul 18 04:47:15 2000
3 +++ SVGATextMode-1.10/XFREE/riva128_clock.c Tue Oct 30 03:39:11 2001
5 #define PCI_DEVICE_ID_NVIDIA_VTNT2 0x002C
6 #define PCI_DEVICE_ID_NVIDIA_UVTNT2 0x002D
7 #define PCI_DEVICE_ID_NVIDIA_ITNT2 0x00A0
8 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR 0x0100
9 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR 0x0101
10 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_MX400 0x0110
11 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_MX200 0x0111
12 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_GTS 0x0150
13 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_GTS2 0x0151
14 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_ULTRA 0x0152
16 vgaPCIInformation *vgaPCIInfo;
19 #define PRAMDAC_PLL_COEFF 0x00000508
20 #define PRAMDAC_PLL_COEFF_SELECT 0x0000050C
22 +#define PEXTDEV_BASE 0x00101000
24 #define NV3_MIN_CLOCK_IN_KHZ 25000 // Not sure about this, but it seems reasonable
25 #define NV3_MAX_CLOCK_IN_KHZ 230000
26 #define NV4_MAX_CLOCK_IN_KHZ 350000
28 static int max_clock, is_nv3, pll_coeff;
30 -/* NTSC cards have approx 14.3Mhz. Need to detect, but leave for now*/
31 -#define PLL_INPUT_FREQ 13500
32 +static int PLL_INPUT_FREQ;
37 // Set the clock to the given speed (in KHz)
38 Bool RIVA128ClockSelect( int clockspeed )
46 pcr->_device == PCI_DEVICE_ID_NVIDIA_UTNT2 ||
47 pcr->_device == PCI_DEVICE_ID_NVIDIA_VTNT2 ||
48 pcr->_device == PCI_DEVICE_ID_NVIDIA_UVTNT2 ||
49 - pcr->_device == PCI_DEVICE_ID_NVIDIA_ITNT2)
50 + pcr->_device == PCI_DEVICE_ID_NVIDIA_ITNT2 ||
51 + pcr->_device == PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR ||
52 + pcr->_device == PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR ||
53 + pcr->_device == PCI_DEVICE_ID_NVIDIA_GEFORCE2_MX400 ||
54 + pcr->_device == PCI_DEVICE_ID_NVIDIA_GEFORCE2_MX200 ||
55 + pcr->_device == PCI_DEVICE_ID_NVIDIA_GEFORCE2_GTS ||
56 + pcr->_device == PCI_DEVICE_ID_NVIDIA_GEFORCE2_GTS2 ||
57 + pcr->_device == PCI_DEVICE_ID_NVIDIA_GEFORCE2_ULTRA)
60 pll_coeff = 0x00010700;
62 PERROR(( "Error mmap'ing /dev/mem" ));
66 + ptr2 = (int*)mmap(0, 0x1000,PROT_READ|PROT_WRITE,MAP_SHARED, fd, (off_t)(pcr->_base0) + PEXTDEV_BASE);
68 + if( ptr2 == (int*)-1 )
70 + PERROR(( "Error mmap'ing /dev/mem" ));
76 + PLL_INPUT_FREQ = (ptr2[0x00000000/4]&0x20) ? 13500 : 14318;
80 + PLL_INPUT_FREQ = (ptr2[0x00000000/4]&0x40) ? 14318 : 13500;
82 + munmap(ptr2, 0x1000);