Rev 811 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
808 | serge | 1 | #include "pci.h" |
2 | #include "rhd_regs.h" |
||
3 | |||
4 | enum RHD_CHIPSETS { |
||
5 | RHD_UNKNOWN = 0, |
||
812 | serge | 6 | RHD_R300, |
7 | RHD_R350, |
||
8 | RHD_RV350, |
||
9 | RHD_RV370, |
||
10 | RHD_RV380, |
||
808 | serge | 11 | /* R500 */ |
12 | RHD_RV505, |
||
13 | RHD_RV515, |
||
14 | RHD_RV516, |
||
15 | RHD_R520, |
||
16 | RHD_RV530, |
||
17 | RHD_RV535, |
||
18 | RHD_RV550, |
||
19 | RHD_RV560, |
||
20 | RHD_RV570, |
||
21 | RHD_R580, |
||
22 | /* R500 Mobility */ |
||
23 | RHD_M52, |
||
24 | RHD_M54, |
||
25 | RHD_M56, |
||
26 | RHD_M58, |
||
27 | RHD_M62, |
||
28 | RHD_M64, |
||
29 | RHD_M66, |
||
30 | RHD_M68, |
||
31 | RHD_M71, |
||
32 | /* R500 integrated */ |
||
33 | RHD_RS600, |
||
34 | RHD_RS690, |
||
35 | RHD_RS740, |
||
36 | /* R600 */ |
||
37 | RHD_R600, |
||
38 | RHD_RV610, |
||
39 | RHD_RV630, |
||
40 | /* R600 Mobility */ |
||
41 | RHD_M72, |
||
42 | RHD_M74, |
||
43 | RHD_M76, |
||
44 | /* RV670 came into existence after RV6x0 and M7x */ |
||
45 | RHD_RV670, |
||
46 | RHD_R680, |
||
47 | RHD_RV620, |
||
48 | RHD_M82, |
||
49 | RHD_RV635, |
||
50 | RHD_M86, |
||
812 | serge | 51 | RHD_RS780, |
808 | serge | 52 | RHD_CHIP_END |
53 | }; |
||
54 | |||
55 | enum RHD_FAMILIES { |
||
56 | RHD_FAMILY_UNKNOWN = 0, |
||
812 | serge | 57 | |
58 | RHD_FAMILY_RADEON, |
||
59 | |||
60 | RHD_FAMILY_RV100, |
||
61 | RHD_FAMILY_RS100, /* U1 (IGP320M) or A3 (IGP320)*/ |
||
62 | RHD_FAMILY_RV200, |
||
63 | RHD_FAMILY_RS200, /* U2 (IGP330M/340M/350M) or A4 (IGP330/340/345/350), RS250 (IGP 7000) */ |
||
64 | RHD_FAMILY_R200, |
||
65 | RHD_FAMILY_RV250, |
||
66 | RHD_FAMILY_RS300, /* RS300/RS350 */ |
||
67 | RHD_FAMILY_RV280, |
||
68 | |||
69 | RHD_FAMILY_R300, |
||
70 | RHD_FAMILY_R350, |
||
71 | RHD_FAMILY_RV350, |
||
72 | RHD_FAMILY_RV380, /* RV370/RV380/M22/M24 */ |
||
73 | RHD_FAMILY_R420, /* R420/R423/M18 */ |
||
74 | RHD_FAMILY_RV410, /* RV410, M26 */ |
||
75 | RHD_FAMILY_RS400, /* xpress 200, 200m (RS400) Intel */ |
||
76 | RHD_FAMILY_RS480, /* xpress 200, 200m (RS410/480/482/485) AMD */ |
||
77 | |||
808 | serge | 78 | RHD_FAMILY_RV515, |
79 | RHD_FAMILY_R520, |
||
80 | RHD_FAMILY_RV530, |
||
81 | RHD_FAMILY_RV560, |
||
82 | RHD_FAMILY_RV570, |
||
83 | RHD_FAMILY_R580, |
||
84 | RHD_FAMILY_RS690, |
||
85 | RHD_FAMILY_R600, |
||
86 | RHD_FAMILY_RV610, |
||
87 | RHD_FAMILY_RV630, |
||
88 | RHD_FAMILY_RV670, |
||
89 | RHD_FAMILY_RV620, |
||
812 | serge | 90 | RHD_FAMILY_RV635, |
91 | RHD_FAMILY_RS780 |
||
808 | serge | 92 | }; |
93 | |||
94 | #define RHD_FB_BAR 0 |
||
95 | #define RHD_MMIO_BAR 2 |
||
96 | |||
97 | #define RHD_MEM_GART 1 |
||
98 | #define RHD_MEM_FB 2 |
||
99 | |||
100 | typedef struct RHDRec |
||
101 | { |
||
102 | CARD32 MMIOBase; |
||
103 | CARD32 MMIOMapSize; |
||
104 | CARD32 videoRam; |
||
105 | |||
106 | CARD32 FbBase; /* map base of fb */ |
||
107 | CARD32 PhisBase; |
||
108 | CARD32 FbIntAddress; /* card internal address of FB */ |
||
109 | CARD32 FbMapSize; |
||
110 | |||
111 | CARD32 FbFreeStart; |
||
112 | CARD32 FbFreeSize; |
||
113 | |||
114 | /* visible part of the framebuffer */ |
||
115 | unsigned int FbScanoutStart; |
||
116 | unsigned int FbScanoutSize; |
||
117 | |||
118 | enum RHD_CHIPSETS ChipSet; |
||
812 | serge | 119 | enum RHD_FAMILIES ChipFamily; |
120 | |||
808 | serge | 121 | char *ChipName; |
122 | |||
123 | Bool IsIGP; |
||
124 | |||
125 | CARD32 bus; |
||
126 | CARD32 devfn; |
||
127 | |||
128 | PCITAG PciTag; |
||
129 | CARD16 PciDeviceID; |
||
130 | |||
131 | CARD16 subvendor_id; |
||
132 | CARD16 subdevice_id; |
||
133 | |||
134 | CARD32 memBase[6]; |
||
135 | CARD32 ioBase[6]; |
||
136 | CARD32 memtype[6]; |
||
137 | CARD32 memsize[6]; |
||
138 | |||
139 | struct mem_block *fb_heap; |
||
140 | struct mem_block *gart_heap; |
||
141 | |||
142 | CARD32 displayWidth; |
||
143 | CARD32 displayHeight; |
||
144 | |||
145 | CARD32 __xmin; |
||
146 | CARD32 __ymin; |
||
147 | CARD32 __xmax; |
||
148 | CARD32 __ymax; |
||
149 | |||
150 | CARD32 gui_control; |
||
151 | CARD32 dst_pitch_offset; |
||
152 | CARD32 surface_cntl; |
||
153 | |||
154 | u32 *ring_base; |
||
155 | u32 ring_rp; |
||
156 | u32 ring_wp; |
||
157 | |||
811 | serge | 158 | int num_gb_pipes; |
159 | Bool has_tcl; |
||
808 | serge | 160 | }RHD_t, *RHDPtr; |
161 | |||
162 | extern RHD_t rhd; |
||
163 | |||
164 | typedef struct |
||
165 | { |
||
166 | int xmin; |
||
167 | int ymin; |
||
168 | int xmax; |
||
169 | int ymax; |
||
170 | }clip_t, *PTRclip; |
||
171 | |||
172 | typedef struct { |
||
173 | int token; /* id of the token */ |
||
174 | const char * name; /* token name */ |
||
175 | } SymTabRec, *SymTabPtr; |
||
176 | |||
177 | extern inline CARD32 INREG(CARD16 offset) |
||
178 | { |
||
179 | return *(volatile CARD32 *)((CARD8*)(rhd.MMIOBase + offset)); |
||
180 | } |
||
181 | |||
182 | //#define INREG(offset) *(volatile CARD32 *)((CARD8*)(rhd.MMIOBase + (offset))) |
||
183 | |||
184 | extern inline void |
||
185 | OUTREG(CARD16 offset, CARD32 value) |
||
186 | { |
||
187 | *(volatile CARD32 *)((CARD8 *)(rhd.MMIOBase + offset)) = value; |
||
188 | } |
||
189 | |||
190 | extern inline CARD32 _RHDRegRead(RHDPtr rhdPtr, CARD16 offset) |
||
191 | { |
||
192 | return *(volatile CARD32 *)((CARD8*)(rhdPtr->MMIOBase + offset)); |
||
193 | } |
||
194 | |||
195 | extern inline void |
||
196 | MASKREG(CARD16 offset, CARD32 value, CARD32 mask) |
||
197 | { |
||
198 | CARD32 tmp; |
||
199 | |||
200 | tmp = INREG(offset); |
||
201 | tmp &= ~mask; |
||
202 | tmp |= (value & mask); |
||
203 | OUTREG(offset, tmp); |
||
204 | }; |
||
205 | |||
206 | extern inline void |
||
207 | _RHDRegWrite(RHDPtr rhdPtr, CARD16 offset, CARD32 value) |
||
208 | { |
||
209 | *(volatile CARD32 *)((CARD8 *)(rhdPtr->MMIOBase + offset)) = value; |
||
210 | } |
||
211 | |||
212 | extern inline void |
||
213 | _RHDRegMask(RHDPtr rhdPtr, CARD16 offset, CARD32 value, CARD32 mask) |
||
214 | { |
||
215 | CARD32 tmp; |
||
216 | |||
217 | tmp = _RHDRegRead(rhdPtr, offset); |
||
218 | tmp &= ~mask; |
||
219 | tmp |= (value & mask); |
||
220 | _RHDRegWrite(rhdPtr, offset, tmp); |
||
221 | }; |
||
222 | |||
223 | enum RHD_FAMILIES RHDFamily(enum RHD_CHIPSETS chipset); |
||
224 | |||
225 | #define RHDRegRead(ptr, offset) _RHDRegRead((ptr)->rhdPtr, (offset)) |
||
226 | #define RHDRegWrite(ptr, offset, value) _RHDRegWrite((ptr)->rhdPtr, (offset), (value)) |
||
227 | #define RHDRegMask(ptr, offset, value, mask) _RHDRegMask((ptr)->rhdPtr, (offset), (value), (mask)) |
||
228 | |||
229 | |||
230 | RHDPtr FindPciDevice(); |
||
231 | |||
232 | Bool RHDPreInit(); |
||
233 | int rhdInitHeap(RHDPtr rhdPtr); |
||
234 | |||
235 | #define RHDFUNC(ptr) |
||
236 | |||
237 | #define DBG(x) x |
||
238 | // #define DBG(x) |
||
239 | |||
240 | #pragma pack (push,1) |
||
241 | typedef struct s_cursor |
||
242 | { |
||
243 | u32 magic; // 'CURS' |
||
244 | void (*destroy)(struct s_cursor*); // destructor |
||
245 | u32 fd; // next object in list |
||
246 | u32 bk; // prev object in list |
||
247 | u32 pid; // owner id |
||
248 | |||
249 | void *base; // allocated memory |
||
250 | u32 hot_x; // hotspot coords |
||
251 | u32 hot_y; |
||
252 | }cursor_t; |
||
253 | #pragma pack (pop) |
||
254 | |||
255 | #define LOAD_FROM_FILE 0 |
||
256 | #define LOAD_FROM_MEM 1 |
||
257 | #define LOAD_INDIRECT 2 |
||
258 | |||
259 | cursor_t *create_cursor(u32 pid, void *src, u32 flags); |
||
260 | void __stdcall copy_cursor(void *img, void *src); |
||
261 | void destroy_cursor(cursor_t *cursor); |
||
262 | void __destroy_cursor(cursor_t *cursor); // wrap |
||
263 | |||
264 | void __stdcall r500_SelectCursor(cursor_t *cursor); |
||
265 | void __stdcall r500_SetCursor(cursor_t *cursor, int x, int y); |
||
266 | void __stdcall r500_CursorRestore(int x, int y); |
||
267 | |||
268 | void R5xx2DInit(); |