Rev 877 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
808 | serge | 1 | |
2 | |||
3 | { |
||
4 | rhdPtr->MMIOMapSize = 1 << rhdPtr->memsize[RHD_MMIO_BAR]; |
||
5 | rhdPtr->MMIOBase = MapIoMem((void*)rhdPtr->memBase[RHD_MMIO_BAR], |
||
6 | rhdPtr->MMIOMapSize,PG_SW+PG_NOCACHE); |
||
877 | serge | 7 | if( rhdPtr->MMIOBase==0) |
808 | serge | 8 | return 0; |
9 | |||
10 | DBG(dbgprintf("Mapped IO at %x (size %x)\n", rhdPtr->MMIOBase, rhdPtr->MMIOMapSize)); |
||
11 | |||
12 | } |
||
13 | |||
14 | #define RADEON_NB_TOM 0x15c |
||
15 | |||
16 | static size_t rhdGetVideoRamSize(RHDPtr rhdPtr) |
||
17 | |||
877 | serge | 18 | size_t RamSize, BARSize; |
808 | serge | 19 | |
877 | serge | 20 | if (rhdPtr->ChipSet == RHD_RS690) |
808 | serge | 21 | |
22 | else |
||
23 | if (rhdPtr->IsIGP) |
||
24 | { |
||
25 | u32_t tom = _RHDRegRead(rhdPtr, RADEON_NB_TOM); |
||
26 | RamSize = (((tom >> 16) - (tom & 0xffff) + 1) << 6); |
||
877 | serge | 27 | _RHDRegWrite(rhdPtr,R5XX_CONFIG_MEMSIZE, RamSize<<10); |
808 | serge | 28 | } |
29 | else |
||
30 | { |
||
31 | if (rhdPtr->ChipSet < RHD_R600) |
||
32 | { |
||
33 | RamSize = (_RHDRegRead(rhdPtr, R5XX_CONFIG_MEMSIZE)) >> 10; |
||
34 | if(RamSize==0) RamSize=8192; |
||
35 | } |
||
36 | else |
||
37 | RamSize = (_RHDRegRead(rhdPtr, R6XX_CONFIG_MEMSIZE)) >> 10; |
||
38 | }; |
||
39 | |||
40 | BARSize = 1 << (rhdPtr->memsize[RHD_FB_BAR] - 10); |
||
41 | |||
42 | BARSize = 0x20000; |
||
43 | |||
44 | if (RamSize > BARSize) { |
||
45 | |||
46 | " exceeds the PCI BAR aperture.\n")); |
||
47 | DBG(dbgprintf("Using only %dkB of the total " |
||
48 | "%dkB.\n", (int) BARSize, (int) RamSize)); |
||
49 | return BARSize; |
||
50 | } |
||
51 | else return RamSize; |
||
52 | } |
||
53 | |||
54 | static Bool |
||
55 | |||
56 | { |
||
57 | rhdPtr->FbMapSize = 1 << rhdPtr->memsize[RHD_FB_BAR]; |
||
58 | rhdPtr->PhisBase = rhdPtr->memBase[RHD_FB_BAR]; |
||
59 | |||
60 | // rhdPtr->FbBase = MapIoMem(rhdPtr->PhisBase, rhdPtr->FbMapSize,PG_SW+PG_NOCACHE); |
||
61 | |||
817 | serge | 62 | // if (!rhdPtr->FbBase) |
808 | serge | 63 | |
817 | serge | 64 | |
65 | /* These devices have an internal address reference, which some other |
||
808 | serge | 66 | |
67 | * address in the BAR */ |
||
68 | if (rhdPtr->ChipSet < RHD_R600) |
||
69 | rhdPtr->FbIntAddress = _RHDRegRead(rhdPtr, HDP_FB_LOCATION)<< 16; |
||
70 | else |
||
71 | rhdPtr->FbIntAddress = _RHDRegRead(rhdPtr, R6XX_CONFIG_FB_BASE); |
||
72 | |||
73 | // rhdPtr->FbIntAddress = _RHDRegRead(rhdPtr, 0x6110); |
||
74 | |||
75 | |||
76 | if (rhdPtr->FbIntAddress != rhdPtr->PhisBase) |
||
77 | |||
78 | "0x%08X while card Internal Address is 0x%08X\n", |
||
79 | (unsigned int) rhdPtr->PhisBase,rhdPtr->FbIntAddress); |
||
80 | // dbgprintf("Mapped FB at %p (size 0x%08X)\n",rhdPtr->FbBase, rhdPtr->FbMapSize); |
||
81 | return TRUE; |
||
817 | serge | 82 | } |
808 | serge | 83 | |
84 | Bool RHDPreInit() |
||
85 | |||
86 | /* We need access to IO space already */ |
||
87 | if (!rhdMapMMIO(&rhd)) { |
||
88 | dbgprintf("Failed to map MMIO.\n"); |
||
89 | return FALSE; |
||
90 | }; |
||
91 | |||
92 | rhd.videoRam = rhdGetVideoRamSize(&rhd); |
||
93 | |||
94 | { |
||
95 | dbgprintf("No Video RAM detected.\n"); |
||
96 | goto error1; |
||
97 | } |
||
98 | dbgprintf("VideoRAM: %d kByte\n",rhd.videoRam); |
||
99 | |||
100 | rhd.FbFreeStart = 0; |
||
101 | |||
102 | |||
103 | if( !rhdMapFB(&rhd)) |
||
104 | |||
105 | |||
106 | rhd.FbScanoutStart = 0; |
||
107 | |||
108 | rhd.FbFreeStart = 10*1024*1024; |
||
109 | rhd.FbFreeSize = rhd.FbMapSize - 10*1024*1024; |
||
817 | serge | 110 | |
111 | rhdInitHeap(&rhd); |
||
808 | serge | 112 | |
113 | |||
114 | error1: |
||
115 | |||
116 | };><>><>>><>><>>10); |
||
117 | ><10); |
||
118 | >><>><> |
||
119 |