]>
Commit | Line | Data |
---|---|---|
74d9ed7f | 1 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c |
2 | =================================================================== | |
3 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c,v | |
4 | retrieving revision 1.56 | |
5 | retrieving revision 1.57 | |
6 | diff -u -r1.56 -r1.57 | |
7 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c 2000/12/06 15:35:07 1.56 | |
8 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c 2001/01/06 20:19:06 1.57 | |
9 | @@ -225,12 +225,13 @@ | |
10 | ||
11 | switch (pEnt->busType) { | |
12 | case BUS_PCI: | |
13 | - return (primaryBus.type == BUS_PCI && | |
14 | - pEnt->pciBusId.bus == primaryBus.id.pci.bus && | |
15 | + return (pEnt->pciBusId.bus == primaryBus.id.pci.bus && | |
16 | pEnt->pciBusId.device == primaryBus.id.pci.device && | |
17 | pEnt->pciBusId.func == primaryBus.id.pci.func); | |
18 | case BUS_ISA: | |
19 | - return ( primaryBus.type == BUS_ISA ); | |
20 | + return TRUE; | |
21 | + case BUS_SBUS: | |
22 | + return (pEnt->sbusBusId.fbNum == primaryBus.id.sbus.fbNum); | |
23 | default: | |
24 | return FALSE; | |
25 | } | |
26 | @@ -1395,7 +1396,7 @@ | |
27 | * only deals with exclusive resources. | |
28 | */ | |
29 | void | |
30 | -RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment) | |
31 | +RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, Bool useEstimated) | |
32 | { | |
33 | resPtr pRes; | |
34 | memType size, newsize, adjust; | |
35 | @@ -1406,6 +1407,8 @@ | |
36 | (target->res_type & ResPhysMask)) | |
37 | && pRes->block_begin <= target->block_end | |
38 | && pRes->block_end >= target->block_begin) { | |
39 | + /* Possibly ignore estimated resources */ | |
40 | + if (!useEstimated && (pRes->res_type & ResEstimated)) continue; | |
41 | /* | |
42 | * target should be a larger region than pRes. If pRes fully | |
43 | * contains target, don't do anything. | |
44 | @@ -2973,13 +2976,13 @@ | |
45 | CheckGenericGA(); | |
46 | if (primaryBus.type != BUS_NONE) { | |
47 | char *bus; | |
48 | - char *loc = xnfcalloc(1,8); | |
49 | + char *loc = xnfcalloc(1,9); | |
50 | if (loc == NULL) return; | |
51 | ||
52 | switch (primaryBus.type) { | |
53 | case BUS_PCI: | |
54 | bus = "PCI"; | |
55 | - sprintf(loc,"%2.2x:%2.2x:%1.1x",primaryBus.id.pci.bus, | |
56 | + sprintf(loc," %2.2x:%2.2x:%1.1x",primaryBus.id.pci.bus, | |
57 | primaryBus.id.pci.device,primaryBus.id.pci.func); | |
58 | break; | |
59 | case BUS_ISA: | |
60 | @@ -2988,14 +2991,14 @@ | |
61 | break; | |
62 | case BUS_SBUS: | |
63 | bus = "SBUS"; | |
64 | - sprintf(loc,"%2.2x",primaryBus.id.sbus.fbNum); | |
65 | + sprintf(loc," %2.2x",primaryBus.id.sbus.fbNum); | |
66 | break; | |
67 | default: | |
68 | bus = ""; | |
69 | loc[0] = '\0'; | |
70 | } | |
71 | ||
72 | - xf86MsgVerb(X_INFO, 2, "Primary Device is: %s %s\n",bus,loc); | |
73 | + xf86MsgVerb(X_INFO, 2, "Primary Device is: %s%s\n",bus,loc); | |
74 | xfree(loc); | |
75 | } | |
76 | ||
77 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Bus.h | |
78 | =================================================================== | |
79 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/common/xf86Bus.h,v | |
80 | retrieving revision 1.16 | |
81 | retrieving revision 1.17 | |
82 | diff -u -r1.16 -r1.17 | |
83 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Bus.h 2000/06/20 05:08:43 1.16 | |
84 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Bus.h 2001/01/06 20:19:07 1.17 | |
85 | @@ -1,4 +1,4 @@ | |
86 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.h,v 1.16 2000/06/20 05:08:43 dawes Exp $ */ | |
87 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.h,v 1.17 2001/01/06 20:19:07 tsi Exp $ */ | |
88 | /* | |
89 | * Copyright (c) 1997 by The XFree86 Project, Inc. | |
90 | */ | |
91 | @@ -124,7 +124,8 @@ | |
92 | resPtr xf86ExtractTypeFromList(resPtr list, unsigned long type); | |
93 | resPtr findIntersect(resRange Range, resPtr list); | |
94 | resPtr xf86FindIntersect(resRange Range, resPtr list); | |
95 | -void RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment); | |
96 | +void RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, | |
97 | + Bool useEstimated); | |
98 | void xf86ConvertListToHost(int entityIndex, resPtr list); | |
99 | ||
100 | #endif /* _XF86_BUS_H */ | |
101 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Config.c | |
102 | =================================================================== | |
103 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v | |
104 | retrieving revision 3.236 | |
105 | retrieving revision 3.237 | |
106 | diff -u -r3.236 -r3.237 | |
107 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Config.c 2000/12/06 15:35:07 3.236 | |
108 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Config.c 2001/01/06 20:19:07 3.237 | |
109 | @@ -1,4 +1,4 @@ | |
110 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.236 2000/12/06 15:35:07 eich Exp $ */ | |
111 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.237 2001/01/06 20:19:07 tsi Exp $ */ | |
112 | ||
113 | ||
114 | /* | |
115 | @@ -2060,6 +2060,7 @@ | |
116 | X_INFO_STRING " informational,\n" | |
117 | " " X_WARNING_STRING " warning, " | |
118 | X_ERROR_STRING " error, " | |
119 | + X_NOT_IMPLEMENTED_STRING " not implemented, " | |
120 | X_UNKNOWN_STRING " unknown.\n"); | |
121 | ||
122 | /* | |
123 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c | |
124 | =================================================================== | |
125 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v | |
126 | retrieving revision 3.49 | |
127 | retrieving revision 3.50 | |
128 | diff -u -r3.49 -r3.50 | |
129 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c 2000/12/12 18:23:50 3.49 | |
130 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c 2001/01/06 20:19:07 3.50 | |
131 | @@ -1,4 +1,4 @@ | |
132 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v 3.49 2000/12/12 18:23:50 tsi Exp $ */ | |
133 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v 3.50 2001/01/06 20:19:07 tsi Exp $ */ | |
134 | /* | |
135 | * Copyright 2000 by Alan Hourihane, Sychdyn, North Wales. | |
136 | * | |
137 | @@ -213,7 +213,7 @@ | |
138 | # undef CardName | |
139 | ||
140 | if (chipset < 0) | |
141 | - chipset = (pVideo->vendor << 16) || pVideo->chipType; | |
142 | + chipset = (pVideo->vendor << 16) | pVideo->chipType; | |
143 | } | |
144 | break; | |
145 | case BUS_ISA: | |
146 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c | |
147 | =================================================================== | |
148 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v | |
149 | retrieving revision 1.108 | |
150 | retrieving revision 1.109 | |
151 | diff -u -r1.108 -r1.109 | |
152 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c 2000/12/14 16:33:08 1.108 | |
153 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c 2001/01/06 20:19:07 1.109 | |
154 | @@ -1,4 +1,4 @@ | |
155 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.108 2000/12/14 16:33:08 eich Exp $ */ | |
156 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.109 2001/01/06 20:19:07 tsi Exp $ */ | |
157 | ||
158 | /* | |
159 | * Copyright (c) 1997-1998 by The XFree86 Project, Inc. | |
160 | @@ -1217,6 +1217,9 @@ | |
161 | break; | |
162 | case X_INFO: | |
163 | s = X_INFO_STRING; | |
164 | + break; | |
165 | + case X_NOT_IMPLEMENTED: | |
166 | + s = X_NOT_IMPLEMENTED_STRING; | |
167 | break; | |
168 | case X_NONE: | |
169 | s = NULL; | |
170 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Mode.c | |
171 | =================================================================== | |
172 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v | |
173 | retrieving revision 1.36 | |
174 | retrieving revision 1.37 | |
175 | diff -u -r1.36 -r1.37 | |
176 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Mode.c 2000/12/06 15:35:11 1.36 | |
177 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Mode.c 2001/01/06 20:19:08 1.37 | |
178 | @@ -1,4 +1,4 @@ | |
179 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.36 2000/12/06 15:35:11 eich Exp $ */ | |
180 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.37 2001/01/06 20:19:08 tsi Exp $ */ | |
181 | ||
182 | /* | |
183 | * Copyright (c) 1997,1998 by The XFree86 Project, Inc. | |
184 | @@ -1305,16 +1305,16 @@ | |
185 | q->status = MODE_OK; | |
186 | } else { | |
187 | if (p->type & M_T_BUILTIN) | |
188 | - xf86DrvMsg(scrp->scrnIndex, X_WARNING, | |
189 | - "Built-in mode \"%s\" deleted (%s)\n", p->name, | |
190 | - xf86ModeStatusToString(status)); | |
191 | + xf86DrvMsg(scrp->scrnIndex, X_INFO, | |
192 | + "Not using built-in mode \"%s\" (%s)\n", | |
193 | + p->name, xf86ModeStatusToString(status)); | |
194 | else if (p->type & M_T_DEFAULT) | |
195 | - xf86DrvMsg(scrp->scrnIndex, X_WARNING, | |
196 | - "Default mode \"%s\" deleted (%s)\n", p->name, | |
197 | + xf86DrvMsg(scrp->scrnIndex, X_INFO, | |
198 | + "Not using default mode \"%s\" (%s)\n", p->name, | |
199 | xf86ModeStatusToString(status)); | |
200 | else | |
201 | - xf86DrvMsg(scrp->scrnIndex, X_WARNING, | |
202 | - "Mode \"%s\" deleted (%s)\n", p->name, | |
203 | + xf86DrvMsg(scrp->scrnIndex, X_INFO, | |
204 | + "Not using mode \"%s\" (%s)\n", p->name, | |
205 | xf86ModeStatusToString(status)); | |
206 | } | |
207 | } | |
208 | @@ -1401,16 +1401,16 @@ | |
209 | status = xf86LookupMode(scrp, p, clockRanges, strategy); | |
210 | if (status != MODE_OK) { | |
211 | if (p->type & M_T_BUILTIN) | |
212 | - xf86DrvMsg(scrp->scrnIndex, X_WARNING, | |
213 | - "Built-in mode \"%s\" deleted (%s)\n", p->name, | |
214 | - xf86ModeStatusToString(status)); | |
215 | + xf86DrvMsg(scrp->scrnIndex, X_INFO, | |
216 | + "Not using built-in mode \"%s\" (%s)\n", | |
217 | + p->name, xf86ModeStatusToString(status)); | |
218 | else if (p->type & M_T_DEFAULT) | |
219 | - xf86DrvMsg(scrp->scrnIndex, X_WARNING, | |
220 | - "Default mode \"%s\" deleted (%s)\n", p->name, | |
221 | + xf86DrvMsg(scrp->scrnIndex, X_INFO, | |
222 | + "Not using default mode \"%s\" (%s)\n", p->name, | |
223 | xf86ModeStatusToString(status)); | |
224 | else | |
225 | - xf86DrvMsg(scrp->scrnIndex, X_WARNING, | |
226 | - "Mode \"%s\" deleted (%s)\n", p->name, | |
227 | + xf86DrvMsg(scrp->scrnIndex, X_INFO, | |
228 | + "Not using mode \"%s\" (%s)\n", p->name, | |
229 | xf86ModeStatusToString(status)); | |
230 | } | |
231 | if (status == MODE_ERROR) { | |
232 | @@ -1493,16 +1493,16 @@ | |
233 | ||
234 | if (p->status != MODE_OK) { | |
235 | if (p->type & M_T_BUILTIN) | |
236 | - xf86DrvMsg(scrp->scrnIndex, X_WARNING, | |
237 | - "Built-in mode \"%s\" deleted (%s)\n", p->name, | |
238 | - xf86ModeStatusToString(p->status)); | |
239 | + xf86DrvMsg(scrp->scrnIndex, X_INFO, | |
240 | + "Not using built-in mode \"%s\" (%s)\n", | |
241 | + p->name, xf86ModeStatusToString(p->status)); | |
242 | else if (p->type & M_T_DEFAULT) | |
243 | - xf86DrvMsg(scrp->scrnIndex, X_WARNING, | |
244 | - "Default mode \"%s\" deleted (%s)\n", p->name, | |
245 | + xf86DrvMsg(scrp->scrnIndex, X_INFO, | |
246 | + "Not using default mode \"%s\" (%s)\n", p->name, | |
247 | xf86ModeStatusToString(p->status)); | |
248 | else | |
249 | - xf86DrvMsg(scrp->scrnIndex, X_WARNING, | |
250 | - "Mode \"%s\" deleted (%s)\n", p->name, | |
251 | + xf86DrvMsg(scrp->scrnIndex, X_INFO, | |
252 | + "Not using mode \"%s\" (%s)\n", p->name, | |
253 | xf86ModeStatusToString(p->status)); | |
254 | ||
255 | goto lookupNext; | |
256 | @@ -1607,17 +1607,17 @@ | |
257 | if (p->status != MODE_OK) { | |
258 | #if 0 | |
259 | if (p->type & M_T_BUILTIN) | |
260 | - xf86DrvMsg(scrp->scrnIndex, X_WARNING, | |
261 | - "Built-in mode \"%s\" deleted (%s)\n", p->name, | |
262 | + xf86DrvMsg(scrp->scrnIndex, X_INFO, | |
263 | + "Not using built-in mode \"%s\" (%s)\n", p->name, | |
264 | xf86ModeStatusToString(p->status)); | |
265 | else if (p->type & M_T_DEFAULT) | |
266 | - xf86DrvMsg(scrp->scrnIndex, X_WARNING, | |
267 | - "Default mode \"%s\" deleted (%s)\n", p->name, | |
268 | - xf86ModeStatusToString(p->status)); | |
269 | + xf86DrvMsg(scrp->scrnIndex, X_INFO, | |
270 | + "Not using default mode \"%s\" (%s)\n", p->name, | |
271 | + xf86ModeStatusToString(p->status)); | |
272 | else | |
273 | - xf86DrvMsg(scrp->scrnIndex, X_WARNING, | |
274 | - "Mode \"%s\" deleted (%s)\n", p->name, | |
275 | - xf86ModeStatusToString(p->status)); | |
276 | + xf86DrvMsg(scrp->scrnIndex, X_INFO, | |
277 | + "Not using mode \"%s\" (%s)\n", p->name, | |
278 | + xf86ModeStatusToString(p->status)); | |
279 | #endif | |
280 | xf86DeleteMode(&(scrp->modes), p); | |
281 | } | |
282 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h | |
283 | =================================================================== | |
284 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v | |
285 | retrieving revision 1.21 | |
286 | retrieving revision 1.22 | |
287 | diff -u -r1.21 -r1.22 | |
288 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h 2000/11/06 19:24:07 1.21 | |
289 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h 2001/01/06 20:19:08 1.22 | |
290 | @@ -1,4 +1,4 @@ | |
291 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.21 2000/11/06 19:24:07 dawes Exp $ */ | |
292 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.22 2001/01/06 20:19:08 tsi Exp $ */ | |
293 | ||
294 | /* | |
295 | * Copyright (c) 1997,1998 by The XFree86 Project, Inc. | |
296 | @@ -200,6 +200,9 @@ | |
297 | #endif | |
298 | #ifndef X_INFO_STRING | |
299 | #define X_INFO_STRING "(II)" | |
300 | +#endif | |
301 | +#ifndef X_NOT_IMPLEMENTED_STRING | |
302 | +#define X_NOT_IMPLEMENTED_STRING "(NI)" | |
303 | #endif | |
304 | ||
305 | #endif /* _XF86PRIVSTR_H */ | |
306 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c | |
307 | =================================================================== | |
308 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v | |
309 | retrieving revision 3.28 | |
310 | retrieving revision 3.29 | |
311 | diff -u -r3.28 -r3.29 | |
312 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c 2000/12/08 20:13:35 3.28 | |
313 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c 2001/01/06 20:19:08 3.29 | |
314 | @@ -175,11 +175,16 @@ | |
315 | if ((PCISHAREDIOCLASSES(baseclass, subclass)) | |
316 | && (pcrp->pci_command & PCI_CMD_IO_ENABLE) && | |
317 | (pcrp->pci_prog_if == 0)) { | |
318 | - /* assumption: primary bus is always VGA */ | |
319 | + if (primaryBus.type == BUS_NONE) { | |
320 | + /* assumption: primary bus is always VGA */ | |
321 | primaryBus.type = BUS_PCI; | |
322 | primaryBus.id.pci.bus = pcrp->busnum; | |
323 | primaryBus.id.pci.device = pcrp->devnum; | |
324 | primaryBus.id.pci.func = pcrp->funcnum; | |
325 | + } else if (primaryBus.type < BUS_last) { | |
326 | + xf86Msg(X_NOTICE, "More than one primary device found\n"); | |
327 | + primaryBus.type ^= (BusType)(-1); | |
328 | + } | |
329 | } | |
330 | ||
331 | for (j = 0; j < 6; j++) { | |
332 | @@ -752,7 +757,7 @@ | |
333 | } | |
334 | } | |
335 | ||
336 | - RemoveOverlaps(target,bridgeRes,TRUE); | |
337 | + RemoveOverlaps(target, bridgeRes, TRUE, TRUE); | |
338 | if (range.rEnd > target->block_end) { | |
339 | correctPciSize(range.rBegin,range.rEnd - range.rBegin, | |
340 | target->block_end - target->block_begin, | |
341 | @@ -902,9 +907,9 @@ | |
342 | if (ResIsEstimated(&pRes->val)) { | |
343 | range = pRes->val; | |
344 | ||
345 | - RemoveOverlaps(pRes, *activeRes, TRUE); | |
346 | - if (xf86Info.estimateSizesAggressively > 0) | |
347 | - RemoveOverlaps(pRes, *inactiveRes, TRUE); | |
348 | + RemoveOverlaps(pRes, *activeRes, TRUE, TRUE); | |
349 | + RemoveOverlaps(pRes, *inactiveRes, TRUE, | |
350 | + (xf86Info.estimateSizesAggressively > 0)); | |
351 | ||
352 | if (range.rEnd > pRes->block_end) { | |
353 | correctPciSize(range.rBegin,range.rEnd - range.rBegin, | |
354 | @@ -923,14 +928,16 @@ | |
355 | xf86PrintResList(3, *activeRes); | |
356 | } | |
357 | ||
358 | - if (*inactiveRes && (xf86Info.estimateSizesAggressively > 1)) { | |
359 | + if (*inactiveRes) { | |
360 | /* Check for overlaps */ | |
361 | for (pRes = *inactiveRes; pRes; pRes = pRes->next) { | |
362 | if (ResIsEstimated(&pRes->val)) { | |
363 | range = pRes->val; | |
364 | ||
365 | - RemoveOverlaps(pRes, *activeRes, TRUE); | |
366 | - RemoveOverlaps(pRes, *inactiveRes, TRUE); | |
367 | + RemoveOverlaps(pRes, *activeRes, TRUE, | |
368 | + (xf86Info.estimateSizesAggressively > 1)); | |
369 | + RemoveOverlaps(pRes, *inactiveRes, TRUE, | |
370 | + (xf86Info.estimateSizesAggressively > 1)); | |
371 | ||
372 | if (range.rEnd > pRes->block_end) { | |
373 | correctPciSize(range.rBegin,range.rEnd - range.rBegin, | |
374 | @@ -946,7 +953,7 @@ | |
375 | } | |
376 | } | |
377 | xf86MsgVerb(X_INFO, 3, | |
378 | - "Ative PCI resource ranges after removing overlaps:\n"); | |
379 | + "Active PCI resource ranges after removing overlaps:\n"); | |
380 | xf86PrintResList(3, *inactiveRes); | |
381 | } | |
382 | } | |
383 | @@ -968,7 +975,7 @@ | |
384 | */ | |
385 | ||
386 | for (tmp = *osRes; tmp; tmp = tmp->next) | |
387 | - RemoveOverlaps(tmp, activeRes, FALSE); | |
388 | + RemoveOverlaps(tmp, activeRes, FALSE, TRUE); | |
389 | ||
390 | xf86MsgVerb(X_INFO, 3, "OS-reported resource ranges after removing" | |
391 | " overlaps with PCI:\n"); | |
392 | @@ -976,7 +983,7 @@ | |
393 | ||
394 | pciAvoidRes = xf86AddRangesToList(pciAvoidRes,PciAvoid,-1); | |
395 | for (tmp = pciAvoidRes; tmp; tmp = tmp->next) | |
396 | - RemoveOverlaps(tmp, activeRes, FALSE); | |
397 | + RemoveOverlaps(tmp, activeRes, FALSE, TRUE); | |
398 | tmp = xf86DupResList(*osRes); | |
399 | pciAvoidRes = xf86JoinResLists(pciAvoidRes,tmp); | |
400 | ||
401 | @@ -1424,40 +1431,54 @@ | |
402 | if ((*num < 0) || (*num > 5) || | |
403 | !pvp->memBase[*num] || (pvp->size[*num] < biosSize)) { | |
404 | *num = -1; | |
405 | + } else { | |
406 | + P_M_RANGE(range, TAG(pvp), pvp->memBase[*num], biosSize, | |
407 | + ResExcMemBlock); | |
408 | + if (!xf86IsSubsetOf(range, m) || ChkConflict(&range, avoid, SETUP)) | |
409 | + *num = -1; | |
410 | + } | |
411 | + | |
412 | + if (*num < 0) { | |
413 | for (n = 0; n <= 5; n++) { | |
414 | if (pvp->memBase[n] && (pvp->size[n] >= biosSize)) { | |
415 | - *num = n; | |
416 | - break; | |
417 | + /* keep bios size ! */ | |
418 | + P_M_RANGE(range, TAG(pvp), pvp->memBase[*num], | |
419 | + biosSize, ResExcMemBlock); | |
420 | + if (xf86IsSubsetOf(range, m) && | |
421 | + !ChkConflict(&range, avoid, SETUP)) { | |
422 | + *num = n; | |
423 | + break; | |
424 | + } | |
425 | } | |
426 | } | |
427 | } | |
428 | ||
429 | - if (*num >= 0) { | |
430 | - /* then try suggested memBase */ | |
431 | - /* keep bios size ! */ | |
432 | - P_M_RANGE(range,TAG(pvp),pvp->memBase[*num],biosSize,ResExcMemBlock); | |
433 | - if (xf86IsSubsetOf(range,m) && !ChkConflict(&range,avoid,SETUP)) { | |
434 | - xf86FreeResList(avoid); | |
435 | - xf86FreeResList(m); | |
436 | - return pvp->memBase[*num]; | |
437 | - } | |
438 | - } | |
439 | + /* | |
440 | + * Return a possible window. Note that this doesn't deal with host bridges | |
441 | + * yet. But the fix for that belongs elsewhere. | |
442 | + */ | |
443 | while (m) { | |
444 | range = xf86GetBlock(ResExcMemBlock, | |
445 | - PCI_SIZE(ResMem,TAG(pvp),(1 << biosSize)), | |
446 | + PCI_SIZE(ResMem, TAG(pvp), 1 << biosSize), | |
447 | m->block_begin, m->block_end, | |
448 | - PCI_SIZE(ResMem,TAG(pvp),alignment), avoid); | |
449 | - if (range.type != ResEnd) | |
450 | - break; | |
451 | + PCI_SIZE(ResMem, TAG(pvp), alignment), avoid); | |
452 | + if (range.type != ResEnd) { | |
453 | + xf86FreeResList(avoid); | |
454 | + xf86FreeResList(m); | |
455 | + return M2B(TAG(pvp), range.rBase); | |
456 | + } | |
457 | m = m->next; | |
458 | } | |
459 | - | |
460 | + | |
461 | xf86FreeResList(avoid); | |
462 | xf86FreeResList(m); | |
463 | - xf86MsgVerb(X_INFO,5,"GetVaildBIOSBase for %x:%x:%x: BIOSbase 0x%lx\n", | |
464 | - pvp->bus,pvp->device,pvp->func, | |
465 | - (memType)M2B(TAG(pvp),range.rBase)); | |
466 | - return M2B(TAG(pvp),range.rBase); | |
467 | + | |
468 | + if (*num >= 0) { | |
469 | + /* then try suggested memBase */ | |
470 | + return pvp->memBase[*num]; | |
471 | + } | |
472 | + | |
473 | + return 0; | |
474 | } | |
475 | ||
476 | /* | |
477 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86str.h | |
478 | =================================================================== | |
479 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/common/xf86str.h,v | |
480 | retrieving revision 1.74 | |
481 | retrieving revision 1.75 | |
482 | diff -u -r1.74 -r1.75 | |
483 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86str.h 2000/12/13 02:44:59 1.74 | |
484 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86str.h 2001/01/06 20:19:08 1.75 | |
485 | @@ -1,4 +1,4 @@ | |
486 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.74 2000/12/13 02:44:59 tsi Exp $ */ | |
487 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.75 2001/01/06 20:19:08 tsi Exp $ */ | |
488 | ||
489 | /* | |
490 | * Copyright (c) 1997-2000 by The XFree86 Project, Inc. | |
491 | @@ -233,7 +233,8 @@ | |
492 | BUS_NONE, | |
493 | BUS_ISA, | |
494 | BUS_PCI, | |
495 | - BUS_SBUS | |
496 | + BUS_SBUS, | |
497 | + BUS_last /* Keep last */ | |
498 | } BusType; | |
499 | ||
500 | typedef struct { | |
501 | @@ -438,7 +439,8 @@ | |
502 | X_ERROR, /* Error message */ | |
503 | X_WARNING, /* Warning message */ | |
504 | X_INFO, /* Informational message */ | |
505 | - X_NONE /* No prefix */ | |
506 | + X_NONE, /* No prefix */ | |
507 | + X_NOT_IMPLEMENTED /* Not implemented */ | |
508 | } MessageType; | |
509 | ||
510 | /* flags for depth 24 pixmap options */ | |
511 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c | |
512 | =================================================================== | |
513 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c,v | |
514 | retrieving revision 1.13 | |
515 | retrieving revision 1.15 | |
516 | diff -u -r1.13 -r1.15 | |
517 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c 2000/11/02 16:55:28 1.13 | |
518 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c 2001/01/06 20:58:06 1.15 | |
519 | @@ -1,6 +1,6 @@ | |
520 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c,v 1.13 2000/11/02 16:55:28 tsi Exp $ */ | |
521 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c,v 1.15 2001/01/06 20:58:06 tsi Exp $ */ | |
522 | /* | |
523 | - * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca | |
524 | + * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org | |
525 | * | |
526 | * Permission to use, copy, modify, distribute, and sell this software and its | |
527 | * documentation for any purpose is hereby granted without fee, provided that | |
528 | @@ -107,8 +107,8 @@ | |
529 | OptionInfoPtr | |
530 | ATIAvailableOptions | |
531 | ( | |
532 | - int ChipId, /* Ignored */ | |
533 | - int BusId /* Ignored */ | |
534 | + int ChipId, | |
535 | + int BusId | |
536 | ) | |
537 | { | |
538 | OptionInfoPtr pOptions; | |
539 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c | |
540 | =================================================================== | |
541 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c,v | |
542 | retrieving revision 1.36 | |
543 | retrieving revision 1.38 | |
544 | diff -u -r1.36 -r1.38 | |
545 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c 2000/12/13 02:44:59 1.36 | |
546 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c 2001/01/06 20:58:07 1.38 | |
547 | @@ -1,6 +1,6 @@ | |
548 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c,v 1.36 2000/12/13 02:44:59 tsi Exp $ */ | |
549 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c,v 1.38 2001/01/06 20:58:07 tsi Exp $ */ | |
550 | /* | |
551 | - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca | |
552 | + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org | |
553 | * | |
554 | * Permission to use, copy, modify, distribute, and sell this software and its | |
555 | * documentation for any purpose is hereby granted without fee, provided that | |
556 | @@ -2241,6 +2241,7 @@ | |
557 | ||
558 | xf86LoaderReqSymLists(ATISymbols, NULL); | |
559 | ||
560 | +#ifndef ELFDEBUG | |
561 | /* Workaround for possible loader bug */ | |
562 | # define ATIPreInit \ | |
563 | (xf86PreInitProc*) LoaderSymbol("ATIPreInit") | |
564 | @@ -2258,6 +2259,7 @@ | |
565 | (xf86FreeScreenProc*) LoaderSymbol("ATIFreeScreen") | |
566 | # define ATIValidMode \ | |
567 | (xf86ValidModeProc*) LoaderSymbol("ATIValidMode") | |
568 | +#endif | |
569 | ||
570 | #endif | |
571 | ||
572 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h | |
573 | =================================================================== | |
574 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h,v | |
575 | retrieving revision 1.12 | |
576 | retrieving revision 1.14 | |
577 | diff -u -r1.12 -r1.14 | |
578 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h 2000/08/22 21:54:31 1.12 | |
579 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h 2001/01/06 20:58:07 1.14 | |
580 | @@ -1,6 +1,6 @@ | |
581 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h,v 1.12 2000/08/22 21:54:31 tsi Exp $ */ | |
582 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h,v 1.14 2001/01/06 20:58:07 tsi Exp $ */ | |
583 | /* | |
584 | - * Copyright 1994 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca | |
585 | + * Copyright 1994 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org | |
586 | * | |
587 | * Permission to use, copy, modify, distribute, and sell this software and its | |
588 | * documentation for any purpose is hereby granted without fee, provided that | |
589 | @@ -62,7 +62,7 @@ | |
590 | #define SparseIOTag(_IOSelect) IOPortTag(_IOSelect, 0) | |
591 | #define BlockIOTag(_IOSelect) IOPortTag(0, _IOSelect) | |
592 | ||
593 | -/* MDA/CGA/EGA/VGA I/O ports */ | |
594 | +/* MDA/[M]CGA/EGA/VGA I/O ports */ | |
595 | #define GENVS 0x0102u /* Write (and Read on uC only) */ | |
596 | ||
597 | #define R_GENLPS 0x03b9u /* Read */ | |
598 | @@ -99,24 +99,24 @@ | |
599 | #define MonochromeIOBase 0x03b0u | |
600 | #define ColourIOBase 0x03d0u | |
601 | ||
602 | -/* Other EGA/CGA/VGA I/O ports */ | |
603 | -/* ?(_IOBase) (_IOBase + 0x00u) */ | |
604 | -/* ?(_IOBase) (_IOBase + 0x01u) */ | |
605 | -/* ?(_IOBase) (_IOBase + 0x02u) */ | |
606 | -/* ?(_IOBase) (_IOBase + 0x03u) */ | |
607 | -#define CRTX(_IOBase) (_IOBase + 0x04u) | |
608 | -#define CRTD(_IOBase) (_IOBase + 0x05u) | |
609 | -/* ?(_IOBase) (_IOBase + 0x06u) */ | |
610 | -/* ?(_IOBase) (_IOBase + 0x07u) */ | |
611 | -#define GENMC(_IOBase) (_IOBase + 0x08u) | |
612 | -/* ?(_IOBase) (_IOBase + 0x09u) */ /* R_GENLPS/GENB */ | |
613 | -#define GENS1(_IOBase) (_IOBase + 0x0au) /* Read */ | |
614 | -#define GENFC(_IOBase) (_IOBase + 0x0au) /* Write */ | |
615 | -#define GENLPC(_IOBase) (_IOBase + 0x0bu) | |
616 | -/* ?(_IOBase) (_IOBase + 0x0cu) */ /* /GENLPS */ | |
617 | -/* ?(_IOBase) (_IOBase + 0x0du) */ /* /KCX */ | |
618 | -/* ?(_IOBase) (_IOBase + 0x0eu) */ /* /KCD */ | |
619 | -/* ?(_IOBase) (_IOBase + 0x0fu) */ /* GENHP/ */ | |
620 | +/* Other MDA/[M]CGA/EGA/VGA I/O ports */ | |
621 | +/* ?(_IOBase) ((_IOBase) + 0x00u) */ /* CRTX synonym */ | |
622 | +/* ?(_IOBase) ((_IOBase) + 0x01u) */ /* CRTD synonym */ | |
623 | +/* ?(_IOBase) ((_IOBase) + 0x02u) */ /* CRTX synonym */ | |
624 | +/* ?(_IOBase) ((_IOBase) + 0x03u) */ /* CRTD synonym */ | |
625 | +#define CRTX(_IOBase) ((_IOBase) + 0x04u) | |
626 | +#define CRTD(_IOBase) ((_IOBase) + 0x05u) | |
627 | +/* ?(_IOBase) ((_IOBase) + 0x06u) */ | |
628 | +/* ?(_IOBase) ((_IOBase) + 0x07u) */ | |
629 | +#define GENMC(_IOBase) ((_IOBase) + 0x08u) | |
630 | +/* ?(_IOBase) ((_IOBase) + 0x09u) */ /* R_GENLPS/GENB */ | |
631 | +#define GENS1(_IOBase) ((_IOBase) + 0x0au) /* Read */ | |
632 | +#define GENFC(_IOBase) ((_IOBase) + 0x0au) /* Write */ | |
633 | +#define GENLPC(_IOBase) ((_IOBase) + 0x0bu) | |
634 | +/* ?(_IOBase) ((_IOBase) + 0x0cu) */ /* /GENLPS */ | |
635 | +/* ?(_IOBase) ((_IOBase) + 0x0du) */ /* /KCX */ | |
636 | +/* ?(_IOBase) ((_IOBase) + 0x0eu) */ /* /KCD */ | |
637 | +/* ?(_IOBase) ((_IOBase) + 0x0fu) */ /* GENHP/ */ | |
638 | ||
639 | /* 8514/A VESA approved register definitions */ | |
640 | #define DISP_STAT 0x02e8u /* Read */ | |
641 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h | |
642 | =================================================================== | |
643 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v | |
644 | retrieving revision 1.8 | |
645 | retrieving revision 1.9 | |
646 | diff -u -r1.8 -r1.9 | |
647 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h 2000/12/08 19:15:33 1.8 | |
648 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h 2001/01/06 20:19:10 1.9 | |
649 | @@ -1,4 +1,4 @@ | |
650 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v 1.8 2000/12/08 19:15:33 martin Exp $ */ | |
651 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v 1.9 2001/01/06 20:19:10 tsi Exp $ */ | |
652 | /* | |
653 | * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, | |
654 | * Precision Insight, Inc., Cedar Park, Texas, and | |
655 | @@ -193,7 +193,6 @@ | |
656 | unsigned long LinearAddr; /* Frame buffer physical address */ | |
657 | unsigned long MMIOAddr; /* MMIO region physical address */ | |
658 | unsigned long BIOSAddr; /* BIOS physical address */ | |
659 | - Bool BIOSFromPCI; /* BIOS is read from PCI space */ | |
660 | ||
661 | unsigned char *MMIO; /* Map of MMIO region */ | |
662 | unsigned char *FB; /* Map of frame buffer */ | |
663 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c | |
664 | =================================================================== | |
665 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c,v | |
666 | retrieving revision 1.15 | |
667 | retrieving revision 1.16 | |
668 | diff -u -r1.15 -r1.16 | |
669 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c 2000/12/22 12:13:15 1.15 | |
670 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c 2001/01/06 20:19:10 1.16 | |
671 | @@ -503,17 +503,12 @@ | |
672 | } | |
673 | ||
674 | /* Read the Video BIOS block and the FP registers (if applicable). */ | |
675 | -static Bool R128GetBIOSParameters(ScrnInfoPtr pScrn) | |
676 | +static Bool R128GetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) | |
677 | { | |
678 | R128InfoPtr info = R128PTR(pScrn); | |
679 | int i; | |
680 | int FPHeader = 0; | |
681 | ||
682 | -#define R128ReadBIOS(offset, buffer, length) \ | |
683 | - (info->BIOSFromPCI ? \ | |
684 | - xf86ReadPciBIOS(offset, info->PciTag, 0, buffer, length) : \ | |
685 | - xf86ReadBIOS(info->BIOSAddr, offset, buffer, length)) | |
686 | - | |
687 | #define R128_BIOS8(v) (info->VBIOS[v]) | |
688 | #define R128_BIOS16(v) (info->VBIOS[v] | \ | |
689 | (info->VBIOS[(v) + 1] << 8)) | |
690 | @@ -528,16 +523,20 @@ | |
691 | return FALSE; | |
692 | } | |
693 | ||
694 | - info->BIOSFromPCI = TRUE; | |
695 | - R128ReadBIOS(0x0000, info->VBIOS, R128_VBIOS_SIZE); | |
696 | - if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { | |
697 | - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, | |
698 | - "Video BIOS not detected in PCI space!\n"); | |
699 | - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, | |
700 | - "Attempting to read Video BIOS from legacy ISA space!\n"); | |
701 | - info->BIOSFromPCI = FALSE; | |
702 | - info->BIOSAddr = 0x000c0000; | |
703 | - R128ReadBIOS(0x0000, info->VBIOS, R128_VBIOS_SIZE); | |
704 | + if (pInt10) { | |
705 | + info->BIOSAddr = pInt10->BIOSseg << 4; | |
706 | + (void)memcpy(info->VBIOS, xf86int10Addr(pInt10, info->BIOSAddr), | |
707 | + R128_VBIOS_SIZE); | |
708 | + } else { | |
709 | + xf86ReadPciBIOS(0, info->PciTag, 0, info->VBIOS, R128_VBIOS_SIZE); | |
710 | + if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { | |
711 | + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, | |
712 | + "Video BIOS not detected in PCI space!\n"); | |
713 | + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, | |
714 | + "Attempting to read Video BIOS from legacy ISA space!\n"); | |
715 | + info->BIOSAddr = 0x000c0000; | |
716 | + xf86ReadBIOS(info->BIOSAddr, 0, info->VBIOS, R128_VBIOS_SIZE); | |
717 | + } | |
718 | } | |
719 | if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { | |
720 | info->BIOSAddr = 0x00000000; | |
721 | @@ -1010,7 +1009,7 @@ | |
722 | return TRUE; | |
723 | } | |
724 | ||
725 | -static Bool R128PreInitDDC(ScrnInfoPtr pScrn) | |
726 | +static Bool R128PreInitDDC(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) | |
727 | { | |
728 | R128InfoPtr info = R128PTR(pScrn); | |
729 | vbeInfoPtr pVbe; | |
730 | @@ -1026,7 +1025,7 @@ | |
731 | #ifdef XFree86LOADER | |
732 | xf86LoaderReqSymLists(vbeSymbols,NULL); | |
733 | #endif | |
734 | - pVbe = VBEInit(NULL,info->pEnt->index); | |
735 | + pVbe = VBEInit(pInt10, info->pEnt->index); | |
736 | if (!pVbe) return FALSE; | |
737 | ||
738 | xf86SetDDCproperties(pScrn,xf86PrintEDID(vbeDoEDID(pVbe,NULL))); | |
739 | @@ -1155,15 +1154,13 @@ | |
740 | return TRUE; | |
741 | } | |
742 | ||
743 | -static Bool R128PreInitInt10(ScrnInfoPtr pScrn) | |
744 | +static Bool R128PreInitInt10(ScrnInfoPtr pScrn, xf86Int10InfoPtr *ppInt10) | |
745 | { | |
746 | R128InfoPtr info = R128PTR(pScrn); | |
747 | #if 1 | |
748 | if (xf86LoadSubModule(pScrn, "int10")) { | |
749 | - xf86Int10InfoPtr pInt; | |
750 | xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n"); | |
751 | - pInt = xf86InitInt10(info->pEnt->index); | |
752 | - xf86FreeInt10(pInt); | |
753 | + *ppInt10 = xf86InitInt10(info->pEnt->index); | |
754 | } | |
755 | #endif | |
756 | return TRUE; | |
757 | @@ -1296,7 +1293,8 @@ | |
758 | /* R128PreInit is called once at server startup. */ | |
759 | Bool R128PreInit(ScrnInfoPtr pScrn, int flags) | |
760 | { | |
761 | - R128InfoPtr info; | |
762 | + R128InfoPtr info; | |
763 | + xf86Int10InfoPtr pInt10 = NULL; | |
764 | ||
765 | R128TRACE(("R128PreInit\n")); | |
766 | ||
767 | @@ -1403,26 +1401,26 @@ | |
768 | } | |
769 | ||
770 | if (!info->FBDev) | |
771 | - if (!R128PreInitInt10(pScrn)) goto fail; | |
772 | + if (!R128PreInitInt10(pScrn, &pInt10)) goto fail; | |
773 | ||
774 | - if (!R128PreInitConfig(pScrn)) goto fail; | |
775 | + if (!R128PreInitConfig(pScrn)) goto fail; | |
776 | ||
777 | - if (!R128GetBIOSParameters(pScrn)) goto fail; | |
778 | + if (!R128GetBIOSParameters(pScrn, pInt10)) goto fail; | |
779 | ||
780 | - if (!R128GetPLLParameters(pScrn)) goto fail; | |
781 | + if (!R128GetPLLParameters(pScrn)) goto fail; | |
782 | ||
783 | - if (!R128PreInitDDC(pScrn)) goto fail; | |
784 | + if (!R128PreInitDDC(pScrn, pInt10)) goto fail; | |
785 | ||
786 | - if (!R128PreInitGamma(pScrn)) goto fail; | |
787 | + if (!R128PreInitGamma(pScrn)) goto fail; | |
788 | ||
789 | - if (!R128PreInitModes(pScrn)) goto fail; | |
790 | + if (!R128PreInitModes(pScrn)) goto fail; | |
791 | ||
792 | - if (!R128PreInitCursor(pScrn)) goto fail; | |
793 | + if (!R128PreInitCursor(pScrn)) goto fail; | |
794 | ||
795 | - if (!R128PreInitAccel(pScrn)) goto fail; | |
796 | + if (!R128PreInitAccel(pScrn)) goto fail; | |
797 | ||
798 | #ifdef XF86DRI | |
799 | - if (!R128PreInitDRI(pScrn)) goto fail; | |
800 | + if (!R128PreInitDRI(pScrn)) goto fail; | |
801 | #endif | |
802 | ||
803 | /* Free the video bios (if applicable) */ | |
804 | @@ -1431,6 +1429,10 @@ | |
805 | info->VBIOS = NULL; | |
806 | } | |
807 | ||
808 | + /* Free int10 info */ | |
809 | + if (pInt10) | |
810 | + xf86FreeInt10(pInt10); | |
811 | + | |
812 | return TRUE; | |
813 | ||
814 | fail: | |
815 | @@ -1441,6 +1443,10 @@ | |
816 | xfree(info->VBIOS); | |
817 | info->VBIOS = NULL; | |
818 | } | |
819 | + | |
820 | + /* Free int10 info */ | |
821 | + if (pInt10) | |
822 | + xf86FreeInt10(pInt10); | |
823 | ||
824 | vgaHWFreeHWRec(pScrn); | |
825 | R128FreeRec(pScrn); | |
826 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c | |
827 | =================================================================== | |
828 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c,v | |
829 | retrieving revision 1.6 | |
830 | retrieving revision 1.7 | |
831 | diff -u -r1.6 -r1.7 | |
832 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c 2000/12/13 02:45:00 1.6 | |
833 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c 2001/01/06 20:19:10 1.7 | |
834 | @@ -1,4 +1,4 @@ | |
835 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c,v 1.6 2000/12/13 02:45:00 tsi Exp $ */ | |
836 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c,v 1.7 2001/01/06 20:19:10 tsi Exp $ */ | |
837 | /* | |
838 | * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, | |
839 | * Precision Insight, Inc., Cedar Park, Texas, and | |
840 | @@ -86,6 +86,8 @@ | |
841 | * Return options defined in the r128 submodule which will have been | |
842 | * loaded by this point. | |
843 | */ | |
844 | + if ((chipid >> 16) == PCI_VENDOR_ATI) | |
845 | + chipid -= PCI_VENDOR_ATI << 16; | |
846 | for (i = 0; R128PciChipsets[i].PCIid > 0; i++) { | |
847 | if (chipid == R128PciChipsets[i].PCIid) | |
848 | return R128Options; | |
849 | @@ -159,7 +161,7 @@ | |
850 | pEnt = xf86GetEntityInfo(usedChips[i]); | |
851 | ||
852 | if (pEnt->active) { | |
853 | - ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0); | |
854 | + ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0); | |
855 | ||
856 | #ifdef XFree86LOADER | |
857 | if (!xf86LoadSubModule(pScrn, "r128")) { | |
858 | @@ -171,6 +173,7 @@ | |
859 | ||
860 | xf86LoaderReqSymLists(R128Symbols, NULL); | |
861 | ||
862 | +#ifndef ELFDEBUG | |
863 | /* Workaround for possible loader bug */ | |
864 | # define R128PreInit \ | |
865 | (xf86PreInitProc*) LoaderSymbol("R128PreInit") | |
866 | @@ -188,6 +191,7 @@ | |
867 | (xf86FreeScreenProc*) LoaderSymbol("R128FreeScreen") | |
868 | # define R128ValidMode \ | |
869 | (xf86ValidModeProc*) LoaderSymbol("R128ValidMode") | |
870 | +#endif | |
871 | ||
872 | #endif | |
873 | ||
874 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h | |
875 | =================================================================== | |
876 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v | |
877 | retrieving revision 1.8 | |
878 | retrieving revision 1.9 | |
879 | diff -u -r1.8 -r1.9 | |
880 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h 2000/12/08 14:41:16 1.8 | |
881 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h 2001/01/06 20:19:10 1.9 | |
882 | @@ -1,4 +1,4 @@ | |
883 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v 1.8 2000/12/08 14:41:16 alanh Exp $ */ | |
884 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v 1.9 2001/01/06 20:19:10 tsi Exp $ */ | |
885 | /* | |
886 | * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and | |
887 | * VA Linux Systems Inc., Fremont, California. | |
888 | @@ -197,7 +197,6 @@ | |
889 | unsigned long LinearAddr; /* Frame buffer physical address */ | |
890 | unsigned long MMIOAddr; /* MMIO region physical address */ | |
891 | unsigned long BIOSAddr; /* BIOS physical address */ | |
892 | - Bool BIOSFromPCI; /* BIOS is read from PCI space */ | |
893 | ||
894 | unsigned char *MMIO; /* Map of MMIO region */ | |
895 | unsigned char *FB; /* Map of frame buffer */ | |
896 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c | |
897 | =================================================================== | |
898 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v | |
899 | retrieving revision 1.9 | |
900 | retrieving revision 1.10 | |
901 | diff -u -r1.9 -r1.10 | |
902 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c 2000/12/22 12:13:15 1.9 | |
903 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c 2001/01/06 20:19:10 1.10 | |
904 | @@ -496,7 +496,7 @@ | |
905 | } | |
906 | ||
907 | /* Read the Video BIOS block and the FP registers (if applicable). */ | |
908 | -static Bool RADEONGetBIOSParameters(ScrnInfoPtr pScrn) | |
909 | +static Bool RADEONGetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) | |
910 | { | |
911 | RADEONInfoPtr info = RADEONPTR(pScrn); | |
912 | #ifdef ENABLE_FLAT_PANEL | |
913 | @@ -523,16 +523,20 @@ | |
914 | return FALSE; | |
915 | } | |
916 | ||
917 | - info->BIOSFromPCI = TRUE; | |
918 | - RADEONReadBIOS(0x0000, info->VBIOS, RADEON_VBIOS_SIZE); | |
919 | - if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { | |
920 | - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, | |
921 | - "Video BIOS not detected in PCI space!\n"); | |
922 | - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, | |
923 | - "Attempting to read Video BIOS from legacy ISA space!\n"); | |
924 | - info->BIOSFromPCI = FALSE; | |
925 | - info->BIOSAddr = 0x000c0000; | |
926 | - RADEONReadBIOS(0x0000, info->VBIOS, RADEON_VBIOS_SIZE); | |
927 | + if (pInt10) { | |
928 | + info->BIOSAddr = pInt10->BIOSseg << 4; | |
929 | + (void)memcpy(info->VBIOS, xf86int10Addr(pInt10, info->BIOSAddr), | |
930 | + RADEON_VBIOS_SIZE); | |
931 | + } else { | |
932 | + xf86ReadPciBIOS(0, info->PciTag, 0, info->VBIOS, RADEON_VBIOS_SIZE); | |
933 | + if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { | |
934 | + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, | |
935 | + "Video BIOS not detected in PCI space!\n"); | |
936 | + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, | |
937 | + "Attempting to read Video BIOS from legacy ISA space!\n"); | |
938 | + info->BIOSAddr = 0x000c0000; | |
939 | + xf86ReadBIOS(info->BIOSAddr, 0, info->VBIOS, RADEON_VBIOS_SIZE); | |
940 | + } | |
941 | } | |
942 | if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { | |
943 | info->BIOSAddr = 0x00000000; | |
944 | @@ -953,7 +957,7 @@ | |
945 | return TRUE; | |
946 | } | |
947 | ||
948 | -static Bool RADEONPreInitDDC(ScrnInfoPtr pScrn) | |
949 | +static Bool RADEONPreInitDDC(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) | |
950 | { | |
951 | RADEONInfoPtr info = RADEONPTR(pScrn); | |
952 | vbeInfoPtr pVbe; | |
953 | @@ -961,7 +965,7 @@ | |
954 | if (!xf86LoadSubModule(pScrn, "ddc")) return FALSE; | |
955 | xf86LoaderReqSymLists(ddcSymbols, NULL); | |
956 | if (xf86LoadSubModule(pScrn, "vbe")) { | |
957 | - pVbe = VBEInit(NULL,info->pEnt->index); | |
958 | + pVbe = VBEInit(pInt10, info->pEnt->index); | |
959 | if (!pVbe) return FALSE; | |
960 | ||
961 | xf86SetDDCproperties(pScrn,xf86PrintEDID(vbeDoEDID(pVbe,NULL))); | |
962 | @@ -1088,15 +1092,13 @@ | |
963 | return TRUE; | |
964 | } | |
965 | ||
966 | -static Bool RADEONPreInitInt10(ScrnInfoPtr pScrn) | |
967 | +static Bool RADEONPreInitInt10(ScrnInfoPtr pScrn, xf86Int10InfoPtr *ppInt10) | |
968 | { | |
969 | RADEONInfoPtr info = RADEONPTR(pScrn); | |
970 | #if 1 | |
971 | if (xf86LoadSubModule(pScrn, "int10")) { | |
972 | - xf86Int10InfoPtr pInt; | |
973 | xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n"); | |
974 | - pInt = xf86InitInt10(info->pEnt->index); | |
975 | - xf86FreeInt10(pInt); | |
976 | + *ppInt10 = xf86InitInt10(info->pEnt->index); | |
977 | } | |
978 | #endif | |
979 | return TRUE; | |
980 | @@ -1237,7 +1239,8 @@ | |
981 | /* RADEONPreInit is called once at server startup. */ | |
982 | Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags) | |
983 | { | |
984 | - RADEONInfoPtr info; | |
985 | + RADEONInfoPtr info; | |
986 | + xf86Int10InfoPtr pInt10 = NULL; | |
987 | ||
988 | #ifdef XFree86LOADER | |
989 | /* | |
990 | @@ -1331,26 +1334,26 @@ | |
991 | } | |
992 | ||
993 | if (!info->FBDev) | |
994 | - if (!RADEONPreInitInt10(pScrn)) goto fail; | |
995 | + if (!RADEONPreInitInt10(pScrn, &pInt10)) goto fail; | |
996 | ||
997 | - if (!RADEONPreInitConfig(pScrn)) goto fail; | |
998 | + if (!RADEONPreInitConfig(pScrn)) goto fail; | |
999 | ||
1000 | - if (!RADEONGetBIOSParameters(pScrn)) goto fail; | |
1001 | + if (!RADEONGetBIOSParameters(pScrn, pInt10)) goto fail; | |
1002 | ||
1003 | - if (!RADEONGetPLLParameters(pScrn)) goto fail; | |
1004 | + if (!RADEONGetPLLParameters(pScrn)) goto fail; | |
1005 | ||
1006 | - if (!RADEONPreInitDDC(pScrn)) goto fail; | |
1007 | + if (!RADEONPreInitDDC(pScrn, pInt10)) goto fail; | |
1008 | ||
1009 | - if (!RADEONPreInitGamma(pScrn)) goto fail; | |
1010 | + if (!RADEONPreInitGamma(pScrn)) goto fail; | |
1011 | ||
1012 | - if (!RADEONPreInitModes(pScrn)) goto fail; | |
1013 | + if (!RADEONPreInitModes(pScrn)) goto fail; | |
1014 | ||
1015 | - if (!RADEONPreInitCursor(pScrn)) goto fail; | |
1016 | + if (!RADEONPreInitCursor(pScrn)) goto fail; | |
1017 | ||
1018 | - if (!RADEONPreInitAccel(pScrn)) goto fail; | |
1019 | + if (!RADEONPreInitAccel(pScrn)) goto fail; | |
1020 | ||
1021 | #ifdef XF86DRI | |
1022 | - if (!RADEONPreInitDRI(pScrn)) goto fail; | |
1023 | + if (!RADEONPreInitDRI(pScrn)) goto fail; | |
1024 | #endif | |
1025 | ||
1026 | /* Free the video bios (if applicable) */ | |
1027 | @@ -1359,6 +1362,10 @@ | |
1028 | info->VBIOS = NULL; | |
1029 | } | |
1030 | ||
1031 | + /* Free int10 info */ | |
1032 | + if (pInt10) | |
1033 | + xf86FreeInt10(pInt10); | |
1034 | + | |
1035 | return TRUE; | |
1036 | ||
1037 | fail: | |
1038 | @@ -1369,6 +1376,10 @@ | |
1039 | xfree(info->VBIOS); | |
1040 | info->VBIOS = NULL; | |
1041 | } | |
1042 | + | |
1043 | + /* Free int10 info */ | |
1044 | + if (pInt10) | |
1045 | + xf86FreeInt10(pInt10); | |
1046 | ||
1047 | vgaHWFreeHWRec(pScrn); | |
1048 | RADEONFreeRec(pScrn); | |
1049 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c | |
1050 | =================================================================== | |
1051 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c,v | |
1052 | retrieving revision 1.2 | |
1053 | retrieving revision 1.3 | |
1054 | diff -u -r1.2 -r1.3 | |
1055 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c 2000/11/18 19:37:12 1.2 | |
1056 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c 2001/01/06 20:58:08 1.3 | |
1057 | @@ -1,6 +1,6 @@ | |
1058 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c,v 1.2 2000/11/18 19:37:12 tsi Exp $ */ | |
1059 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c,v 1.3 2001/01/06 20:58:08 tsi Exp $ */ | |
1060 | /* | |
1061 | - * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca | |
1062 | + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org | |
1063 | * | |
1064 | * Permission to use, copy, modify, distribute, and sell this software and its | |
1065 | * documentation for any purpose is hereby granted without fee, provided that | |
1066 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c | |
1067 | =================================================================== | |
1068 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v | |
1069 | retrieving revision 1.5 | |
1070 | retrieving revision 1.6 | |
1071 | diff -u -r1.5 -r1.6 | |
1072 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c 2000/12/13 02:45:00 1.5 | |
1073 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c 2001/01/06 20:19:11 1.6 | |
1074 | @@ -1,4 +1,4 @@ | |
1075 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v 1.5 2000/12/13 02:45:00 tsi Exp $ */ | |
1076 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v 1.6 2001/01/06 20:19:11 tsi Exp $ */ | |
1077 | /* | |
1078 | * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and | |
1079 | * VA Linux Systems Inc., Fremont, California. | |
1080 | @@ -73,6 +73,8 @@ | |
1081 | * Return options defined in the radeon submodule which will have been | |
1082 | * loaded by this point. | |
1083 | */ | |
1084 | + if ((chipid >> 16) == PCI_VENDOR_ATI) | |
1085 | + chipid -= PCI_VENDOR_ATI << 16; | |
1086 | for (i = 0; RADEONPciChipsets[i].PCIid > 0; i++) { | |
1087 | if (chipid == RADEONPciChipsets[i].PCIid) | |
1088 | return RADEONOptions; | |
1089 | @@ -146,7 +148,7 @@ | |
1090 | pEnt = xf86GetEntityInfo(usedChips[i]); | |
1091 | ||
1092 | if (pEnt->active) { | |
1093 | - ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0); | |
1094 | + ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0); | |
1095 | ||
1096 | #ifdef XFree86LOADER | |
1097 | if (!xf86LoadSubModule(pScrn, "radeon")) { | |
1098 | @@ -158,6 +160,7 @@ | |
1099 | ||
1100 | xf86LoaderReqSymLists(RADEONSymbols, NULL); | |
1101 | ||
1102 | +#ifndef ELFDEBUG | |
1103 | /* Workaround for possible loader bug */ | |
1104 | # define RADEONPreInit \ | |
1105 | (xf86PreInitProc*) LoaderSymbol("RADEONPreInit") | |
1106 | @@ -175,6 +178,7 @@ | |
1107 | (xf86FreeScreenProc*) LoaderSymbol("RADEONFreeScreen") | |
1108 | # define RADEONValidMode \ | |
1109 | (xf86ValidModeProc*) LoaderSymbol("RADEONValidMode") | |
1110 | +#endif | |
1111 | ||
1112 | #endif | |
1113 | ||
1114 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/etc/pcitweak.c | |
1115 | =================================================================== | |
1116 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/etc/pcitweak.c,v | |
1117 | retrieving revision 1.14 | |
1118 | retrieving revision 1.15 | |
1119 | diff -u -r1.14 -r1.15 | |
1120 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/etc/pcitweak.c 2000/08/10 17:40:34 1.14 | |
1121 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/etc/pcitweak.c 2001/01/06 20:19:12 1.15 | |
1122 | @@ -5,7 +5,7 @@ | |
1123 | * | |
1124 | * Author: David Dawes <dawes@xfree86.org> | |
1125 | */ | |
1126 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/pcitweak.c,v 1.14 2000/08/10 17:40:34 dawes Exp $ */ | |
1127 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/pcitweak.c,v 1.15 2001/01/06 20:19:12 tsi Exp $ */ | |
1128 | ||
1129 | #include "X.h" | |
1130 | #include "os.h" | |
1131 | @@ -31,6 +31,8 @@ | |
1132 | extern char *optarg; | |
1133 | extern int optind, opterr; | |
1134 | #endif | |
1135 | + | |
1136 | +pciVideoPtr *xf86PciVideoInfo = NULL; | |
1137 | ||
1138 | static void usage(void); | |
1139 | static Bool parsePciBusString(const char *id, int *bus, int *device, int *func); | |
1140 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/etc/scanpci.c | |
1141 | =================================================================== | |
1142 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v | |
1143 | retrieving revision 3.80 | |
1144 | retrieving revision 3.81 | |
1145 | diff -u -r3.80 -r3.81 | |
1146 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/etc/scanpci.c 2000/06/20 19:38:04 3.80 | |
1147 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/etc/scanpci.c 2001/01/06 20:19:12 3.81 | |
1148 | @@ -21,7 +21,7 @@ | |
1149 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
1150 | * | |
1151 | */ | |
1152 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.80 2000/06/20 19:38:04 eich Exp $ */ | |
1153 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.81 2001/01/06 20:19:12 tsi Exp $ */ | |
1154 | ||
1155 | #include "X.h" | |
1156 | #include "os.h" | |
1157 | @@ -47,6 +47,8 @@ | |
1158 | extern char *optarg; | |
1159 | extern int optind, opterr; | |
1160 | #endif | |
1161 | + | |
1162 | +pciVideoPtr *xf86PciVideoInfo = NULL; | |
1163 | ||
1164 | void usage(void); | |
1165 | void identify_card(pciConfigPtr pcr, int verbose); | |
1166 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/generic.c | |
1167 | =================================================================== | |
1168 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/int10/generic.c,v | |
1169 | retrieving revision 1.13 | |
1170 | retrieving revision 1.14 | |
1171 | diff -u -r1.13 -r1.14 | |
1172 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/generic.c 2000/11/21 23:10:38 1.13 | |
1173 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/generic.c 2001/01/06 20:19:13 1.14 | |
1174 | @@ -1,11 +1,10 @@ | |
1175 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/generic.c,v 1.13 2000/11/21 23:10:38 tsi Exp $ */ | |
1176 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/generic.c,v 1.14 2001/01/06 20:19:13 tsi Exp $ */ | |
1177 | /* | |
1178 | * XFree86 int10 module | |
1179 | * execute BIOS int 10h calls in x86 real mode environment | |
1180 | * Copyright 1999 Egbert Eich | |
1181 | */ | |
1182 | #include "xf86.h" | |
1183 | -#include "xf86str.h" | |
1184 | #include "xf86_OSproc.h" | |
1185 | #include "xf86_ansic.h" | |
1186 | #include "xf86Pci.h" | |
1187 | @@ -61,20 +60,19 @@ | |
1188 | void* base = 0; | |
1189 | void* vbiosMem = 0; | |
1190 | legacyVGARec vga; | |
1191 | - | |
1192 | + | |
1193 | screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex; | |
1194 | - | |
1195 | + | |
1196 | if (int10skip(xf86Screens[screen],entityIndex)) | |
1197 | return NULL; | |
1198 | ||
1199 | - pInt = (xf86Int10InfoPtr)xnfcalloc(1,sizeof(xf86Int10InfoRec)); | |
1200 | + pInt = (xf86Int10InfoPtr)xnfcalloc(1, sizeof(xf86Int10InfoRec)); | |
1201 | pInt->entityIndex = entityIndex; | |
1202 | if (!xf86Int10ExecSetup(pInt)) | |
1203 | goto error0; | |
1204 | pInt->mem = &genericMem; | |
1205 | - pInt->private = (pointer)xnfcalloc(1,sizeof(genericInt10Priv)); | |
1206 | - INTPriv(pInt)->alloc = | |
1207 | - (pointer)xnfcalloc(1,ALLOC_ENTRIES(getpagesize())); | |
1208 | + pInt->private = (pointer)xnfcalloc(1, sizeof(genericInt10Priv)); | |
1209 | + INTPriv(pInt)->alloc = (pointer)xnfcalloc(1, ALLOC_ENTRIES(getpagesize())); | |
1210 | pInt->scrnIndex = screen; | |
1211 | base = INTPriv(pInt)->base = xnfalloc(SYS_BIOS); | |
1212 | ||
1213 | @@ -85,11 +83,11 @@ | |
1214 | MapVRam(pInt); | |
1215 | #ifdef _PC | |
1216 | if (!sysMem) | |
1217 | - sysMem = xf86MapVidMem(screen,VIDMEM_FRAMEBUFFER,SYS_BIOS,BIOS_SIZE); | |
1218 | + sysMem = xf86MapVidMem(screen, VIDMEM_FRAMEBUFFER, SYS_BIOS, BIOS_SIZE); | |
1219 | INTPriv(pInt)->sysMem = sysMem; | |
1220 | - | |
1221 | - if (xf86ReadBIOS(0,0,(unsigned char *)base,LOW_PAGE_SIZE) < 0) { | |
1222 | - xf86DrvMsg(screen,X_ERROR,"Cannot read int vect\n"); | |
1223 | + | |
1224 | + if (xf86ReadBIOS(0, 0, base, LOW_PAGE_SIZE) < 0) { | |
1225 | + xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n"); | |
1226 | goto error1; | |
1227 | } | |
1228 | ||
1229 | @@ -106,74 +104,79 @@ | |
1230 | "Unable to retrieve all of segment 0x%06X.\n", cs); | |
1231 | ||
1232 | if (xf86IsEntityPrimary(entityIndex)) { | |
1233 | - cs = MEM_RW(pInt,((0x10<<2)+2)); | |
1234 | + cs = MEM_RW(pInt, (0x10 << 2) + 2); | |
1235 | ||
1236 | vbiosMem = (unsigned char *)base + (cs << 4); | |
1237 | if (!int10_check_bios(screen, cs, vbiosMem)) { | |
1238 | - cs = MEM_RW(pInt,((0x42<<2)+2)); | |
1239 | + cs = MEM_RW(pInt, (0x42 << 2) + 2); | |
1240 | vbiosMem = (unsigned char *)base + (cs << 4); | |
1241 | if (!int10_check_bios(screen, cs, vbiosMem)) { | |
1242 | cs = V_BIOS >> 4; | |
1243 | vbiosMem = (unsigned char *)base + (cs << 4); | |
1244 | if (!int10_check_bios(screen, cs, vbiosMem)) { | |
1245 | - xf86DrvMsg(screen,X_ERROR,"No V_BIOS found\n"); | |
1246 | + xf86DrvMsg(screen, X_ERROR, "No V_BIOS found\n"); | |
1247 | goto error1; | |
1248 | } | |
1249 | } | |
1250 | } | |
1251 | - xf86DrvMsg(screen,X_INFO,"Primary V_BIOS segment is: 0x%x\n",cs); | |
1252 | - | |
1253 | + xf86DrvMsg(screen, X_INFO, "Primary V_BIOS segment is: 0x%x\n", cs); | |
1254 | + | |
1255 | set_return_trap(pInt); | |
1256 | pInt->BIOSseg = cs; | |
1257 | } else { | |
1258 | - reset_int_vect(pInt); | |
1259 | + reset_int_vect(pInt); | |
1260 | set_return_trap(pInt); | |
1261 | vbiosMem = (unsigned char *)base + V_BIOS; | |
1262 | - if (!mapPciRom(pInt,(unsigned char *)(vbiosMem))) { | |
1263 | - xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (3)\n"); | |
1264 | + if (!mapPciRom(pInt, vbiosMem)) { | |
1265 | + xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS (3)\n"); | |
1266 | goto error1; | |
1267 | } | |
1268 | pInt->BIOSseg = V_BIOS >> 4; | |
1269 | pInt->num = 0xe6; | |
1270 | - LockLegacyVGA(screen, &vga); | |
1271 | + LockLegacyVGA(screen, &vga); | |
1272 | xf86ExecX86int10(pInt); | |
1273 | UnlockLegacyVGA(screen, &vga); | |
1274 | } | |
1275 | #else | |
1276 | if (!sysMem) { | |
1277 | sysMem = xnfalloc(BIOS_SIZE); | |
1278 | - setup_system_bios((memType)sysMem); | |
1279 | + setup_system_bios(sysMem); | |
1280 | } | |
1281 | INTPriv(pInt)->sysMem = sysMem; | |
1282 | setup_int_vect(pInt); | |
1283 | set_return_trap(pInt); | |
1284 | - vbiosMem = (unsigned char *)base + V_BIOS; | |
1285 | - { | |
1286 | - EntityInfoPtr pEnt = xf86GetEntityInfo(pInt->entityIndex); | |
1287 | - switch (pEnt->location.type) { | |
1288 | - case BUS_PCI: | |
1289 | - if (!mapPciRom(pInt,(unsigned char *)(vbiosMem))) { | |
1290 | - xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (4)\n"); | |
1291 | - goto error1; | |
1292 | - } | |
1293 | - break; | |
1294 | - case BUS_ISA: | |
1295 | - (void)memset(vbiosMem, 0, V_BIOS_SIZE); | |
1296 | - if (xf86ReadBIOS(V_BIOS, 0, vbiosMem, V_BIOS_SIZE) < V_BIOS_SIZE) | |
1297 | - xf86DrvMsg(screen, X_WARNING, | |
1298 | - "Unable to retrieve all of segment 0x0C0000.\n"); | |
1299 | - if (!int10_check_bios(screen, V_BIOS >> 4, vbiosMem)) { | |
1300 | - xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (5)\n"); | |
1301 | - goto error1; | |
1302 | - } | |
1303 | - break; | |
1304 | - default: | |
1305 | + | |
1306 | + /* | |
1307 | + * Retrieve two segments: one at V_BIOS, the other 64kB beyond the first. | |
1308 | + * This'll catch any BIOS that might have been initialised before server | |
1309 | + * entry. | |
1310 | + */ | |
1311 | + vbiosMem = (char *)base + V_BIOS; | |
1312 | + (void)memset(vbiosMem, 0, 2 * V_BIOS_SIZE); | |
1313 | + if (xf86ReadBIOS(V_BIOS, 0, vbiosMem, V_BIOS_SIZE) < V_BIOS_SIZE) | |
1314 | + xf86DrvMsg(screen, X_WARNING, | |
1315 | + "Unable to retrieve all of segment 0x0C0000.\n"); | |
1316 | + else if (((unsigned char *)vbiosMem)[2] > 0x80) | |
1317 | + if (xf86ReadBIOS(V_BIOS + V_BIOS_SIZE, 0, | |
1318 | + (unsigned char *)vbiosMem + V_BIOS_SIZE, V_BIOS_SIZE) < V_BIOS_SIZE) | |
1319 | + xf86DrvMsg(screen, X_WARNING, | |
1320 | + "Unable to retrieve all of segment 0x0D0000.\n"); | |
1321 | + | |
1322 | + /* | |
1323 | + * If this adapter is the primary, use its post-init BIOS (if we can find | |
1324 | + * it). | |
1325 | + */ | |
1326 | + if (!xf86IsEntityPrimary(entityIndex) || | |
1327 | + !int10_check_bios(screen, V_BIOS >> 4, vbiosMem)) { | |
1328 | + if (!mapPciRom(pInt, vbiosMem)) { | |
1329 | + xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS (4)\n"); | |
1330 | goto error1; | |
1331 | } | |
1332 | } | |
1333 | + | |
1334 | pInt->BIOSseg = V_BIOS >> 4; | |
1335 | pInt->num = 0xe6; | |
1336 | - LockLegacyVGA(screen, &vga); | |
1337 | + LockLegacyVGA(screen, &vga); | |
1338 | xf86ExecX86int10(pInt); | |
1339 | UnlockLegacyVGA(screen, &vga); | |
1340 | #endif | |
1341 | @@ -197,17 +200,17 @@ | |
1342 | int pagesize = getpagesize(); | |
1343 | int size = ((VRAM_SIZE + pagesize - 1)/pagesize) * pagesize; | |
1344 | ||
1345 | - INTPriv(pInt)->vRam = xf86MapVidMem(screen,VIDMEM_MMIO,V_RAM,size); | |
1346 | + INTPriv(pInt)->vRam = xf86MapVidMem(screen, VIDMEM_MMIO, V_RAM, size); | |
1347 | } | |
1348 | ||
1349 | -static void | |
1350 | +static void | |
1351 | UnmapVRam(xf86Int10InfoPtr pInt) | |
1352 | { | |
1353 | int screen = pInt->scrnIndex; | |
1354 | int pagesize = getpagesize(); | |
1355 | int size = ((VRAM_SIZE + pagesize - 1)/pagesize) * pagesize; | |
1356 | ||
1357 | - xf86UnMapVidMem(screen,INTPriv(pInt)->vRam,size); | |
1358 | + xf86UnMapVidMem(screen, INTPriv(pInt)->vRam, size); | |
1359 | } | |
1360 | ||
1361 | void | |
1362 | @@ -221,7 +224,7 @@ | |
1363 | { | |
1364 | if (!pInt) | |
1365 | return; | |
1366 | - if (Int10Current == pInt) | |
1367 | + if (Int10Current == pInt) | |
1368 | Int10Current = NULL; | |
1369 | xfree(INTPriv(pInt)->base); | |
1370 | UnmapVRam(pInt); | |
1371 | @@ -231,83 +234,79 @@ | |
1372 | } | |
1373 | ||
1374 | void * | |
1375 | -xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off) | |
1376 | +xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off) | |
1377 | { | |
1378 | int pagesize = getpagesize(); | |
1379 | int num_pages = ALLOC_ENTRIES(pagesize); | |
1380 | int i,j; | |
1381 | ||
1382 | - for (i=0;i<num_pages - num;i++) { | |
1383 | + for (i = 0; i < (num_pages - num); i++) { | |
1384 | if (INTPriv(pInt)->alloc[i] == 0) { | |
1385 | - for (j=i;j < num + i;j++) | |
1386 | + for (j = i; j < (num + i); j++) | |
1387 | if (INTPriv(pInt)->alloc[j] != 0) | |
1388 | break; | |
1389 | - if (j == num + i) | |
1390 | + if (j == (num + i)) | |
1391 | break; | |
1392 | - else | |
1393 | - i = i + num; | |
1394 | + i += num; | |
1395 | } | |
1396 | } | |
1397 | - if (i == num_pages - num) | |
1398 | + if (i == (num_pages - num)) | |
1399 | return NULL; | |
1400 | - | |
1401 | - for (j = i; j < i + num; j++) | |
1402 | + | |
1403 | + for (j = i; j < (i + num); j++) | |
1404 | INTPriv(pInt)->alloc[j] = 1; | |
1405 | ||
1406 | *off = (i + 1) * pagesize; | |
1407 | - | |
1408 | - return (void *) | |
1409 | - ((char*)INTPriv(pInt)->base + (i + 1) * pagesize); | |
1410 | + | |
1411 | + return (char *)INTPriv(pInt)->base + *off; | |
1412 | } | |
1413 | ||
1414 | void | |
1415 | xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num) | |
1416 | { | |
1417 | int pagesize = getpagesize(); | |
1418 | - int first = ((unsigned long)pbase | |
1419 | - - (unsigned long)INTPriv(pInt)->base) | |
1420 | - / pagesize - 1; | |
1421 | + int first = (((char *)pbase - (char *)INTPriv(pInt)->base) / pagesize) - 1; | |
1422 | int i; | |
1423 | ||
1424 | - for (i = first; i < first + num; i++) | |
1425 | + for (i = first; i < (first + num); i++) | |
1426 | INTPriv(pInt)->alloc[i] = 0; | |
1427 | } | |
1428 | ||
1429 | #define OFF(addr) ((addr) & 0xffff) | |
1430 | #define SYS(addr) ((addr) >= SYS_BIOS) | |
1431 | #define V_ADDR(addr) \ | |
1432 | - (SYS(addr) ? ((char*)INTPriv(pInt)->sysMem) + (addr - SYS_BIOS) \ | |
1433 | - : ((char*)(INTPriv(pInt)->base) + addr)) | |
1434 | + (SYS(addr) ? ((char*)INTPriv(pInt)->sysMem) + (addr - SYS_BIOS) \ | |
1435 | + : ((char*)(INTPriv(pInt)->base) + addr)) | |
1436 | #define VRAM_ADDR(addr) (addr - V_RAM) | |
1437 | #define VRAM_BASE (INTPriv(pInt)->vRam) | |
1438 | ||
1439 | #define VRAM(addr) ((addr >= V_RAM) && (addr < (V_RAM + VRAM_SIZE))) | |
1440 | #define V_ADDR_RB(addr) \ | |
1441 | - (VRAM(addr)) ? MMIO_IN8((CARD8*)VRAM_BASE,VRAM_ADDR(addr)) \ | |
1442 | - : *(CARD8*) V_ADDR(addr) | |
1443 | + (VRAM(addr)) ? MMIO_IN8((CARD8*)VRAM_BASE,VRAM_ADDR(addr)) \ | |
1444 | + : *(CARD8*) V_ADDR(addr) | |
1445 | #define V_ADDR_RW(addr) \ | |
1446 | - (VRAM(addr)) ? MMIO_IN16((CARD16*)VRAM_BASE,VRAM_ADDR(addr)) \ | |
1447 | - : ldw_u((pointer)V_ADDR(addr)) | |
1448 | + (VRAM(addr)) ? MMIO_IN16((CARD16*)VRAM_BASE,VRAM_ADDR(addr)) \ | |
1449 | + : ldw_u((pointer)V_ADDR(addr)) | |
1450 | #define V_ADDR_RL(addr) \ | |
1451 | - (VRAM(addr)) ? MMIO_IN32((CARD32*)VRAM_BASE,VRAM_ADDR(addr)) \ | |
1452 | - : ldl_u((pointer)V_ADDR(addr)) | |
1453 | + (VRAM(addr)) ? MMIO_IN32((CARD32*)VRAM_BASE,VRAM_ADDR(addr)) \ | |
1454 | + : ldl_u((pointer)V_ADDR(addr)) | |
1455 | ||
1456 | #define V_ADDR_WB(addr,val) \ | |
1457 | - if(VRAM(addr)) \ | |
1458 | - MMIO_OUT8((CARD8*)VRAM_BASE,VRAM_ADDR(addr),val); \ | |
1459 | - else \ | |
1460 | - *(CARD8*) V_ADDR(addr) = val; | |
1461 | + if(VRAM(addr)) \ | |
1462 | + MMIO_OUT8((CARD8*)VRAM_BASE,VRAM_ADDR(addr),val); \ | |
1463 | + else \ | |
1464 | + *(CARD8*) V_ADDR(addr) = val; | |
1465 | #define V_ADDR_WW(addr,val) \ | |
1466 | - if(VRAM(addr)) \ | |
1467 | - MMIO_OUT16((CARD16*)VRAM_BASE,VRAM_ADDR(addr),val); \ | |
1468 | - else \ | |
1469 | - stw_u((val),(pointer)(V_ADDR(addr))); | |
1470 | + if(VRAM(addr)) \ | |
1471 | + MMIO_OUT16((CARD16*)VRAM_BASE,VRAM_ADDR(addr),val); \ | |
1472 | + else \ | |
1473 | + stw_u((val),(pointer)(V_ADDR(addr))); | |
1474 | ||
1475 | #define V_ADDR_WL(addr,val) \ | |
1476 | - if (VRAM(addr)) \ | |
1477 | - MMIO_OUT32((CARD32*)VRAM_BASE,VRAM_ADDR(addr),val); \ | |
1478 | - else \ | |
1479 | - stl_u(val,(pointer)(V_ADDR(addr))); | |
1480 | + if (VRAM(addr)) \ | |
1481 | + MMIO_OUT32((CARD32*)VRAM_BASE,VRAM_ADDR(addr),val); \ | |
1482 | + else \ | |
1483 | + stl_u(val,(pointer)(V_ADDR(addr))); | |
1484 | ||
1485 | static CARD8 | |
1486 | read_b(xf86Int10InfoPtr pInt, int addr) | |
1487 | @@ -318,37 +317,24 @@ | |
1488 | static CARD16 | |
1489 | read_w(xf86Int10InfoPtr pInt, int addr) | |
1490 | { | |
1491 | -#if X_BYTE_ORDER == X_BIG_ENDIAN | |
1492 | - return ((V_ADDR_RB(addr)) | |
1493 | - || ((V_ADDR_RB(addr + 1)) << 8)); | |
1494 | -#else | |
1495 | - if (OFF(addr + 1) > 0) { | |
1496 | +#if X_BYTE_ORDER == X_LITTLE_ENDIAN | |
1497 | + if (OFF(addr + 1) > 0) | |
1498 | return V_ADDR_RW(addr); | |
1499 | - } else | |
1500 | - return ((V_ADDR_RB(addr + 1)) | |
1501 | - || ((V_ADDR_RB(addr)) << 8)); | |
1502 | - | |
1503 | #endif | |
1504 | + return V_ADDR_RB(addr) | (V_ADDR_RB(addr + 1) << 8); | |
1505 | } | |
1506 | ||
1507 | static CARD32 | |
1508 | read_l(xf86Int10InfoPtr pInt, int addr) | |
1509 | { | |
1510 | -#if X_BYTE_ORDER == X_BIG_ENDIAN | |
1511 | - return ((V_ADDR_RB(addr)) | |
1512 | - || ((V_ADDR_RB(addr + 1)) << 8) | |
1513 | - || ((V_ADDR_RB(addr + 2)) << 16) | |
1514 | - || ((V_ADDR_RB(addr + 3)) << 24)); | |
1515 | -#else | |
1516 | - if (OFF(addr + 3) > 2) { | |
1517 | +#if X_BYTE_ORDER == X_LITTLE_ENDIAN | |
1518 | + if (OFF(addr + 3) > 2) | |
1519 | return V_ADDR_RL(addr); | |
1520 | - } else { | |
1521 | - return ((V_ADDR_RB(addr + 3)) | |
1522 | - || ((V_ADDR_RB(addr + 2)) << 8) | |
1523 | - || ((V_ADDR_RB(addr + 1)) << 16) | |
1524 | - || ((V_ADDR_RB(addr)) << 24)); | |
1525 | - } | |
1526 | #endif | |
1527 | + return V_ADDR_RB(addr) | | |
1528 | + (V_ADDR_RB(addr + 1) << 8) | | |
1529 | + (V_ADDR_RB(addr + 2) << 16) | | |
1530 | + (V_ADDR_RB(addr + 3) << 24); | |
1531 | } | |
1532 | ||
1533 | static void | |
1534 | @@ -360,49 +346,29 @@ | |
1535 | static void | |
1536 | write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val) | |
1537 | { | |
1538 | -#if X_BYTE_ORDER == X_BIG_ENDIAN | |
1539 | - V_ADDR_WB(addr,val); | |
1540 | - V_ADDR_WB(addr + 1,val >> 8); | |
1541 | -#else | |
1542 | - if (OFF(addr + 1) > 0) { | |
1543 | - V_ADDR_WW(addr,val); | |
1544 | - } else { | |
1545 | - V_ADDR_WB(addr + 1,val); | |
1546 | - V_ADDR_WB(addr,val >> 8); | |
1547 | - } | |
1548 | +#if X_BYTE_ORDER == X_LITTLE_ENDIAN | |
1549 | + if (OFF(addr + 1) > 0) | |
1550 | + V_ADDR_WW(addr, val); | |
1551 | #endif | |
1552 | + V_ADDR_WB(addr, val); | |
1553 | + V_ADDR_WB(addr + 1, val >> 8); | |
1554 | } | |
1555 | ||
1556 | static void | |
1557 | write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val) | |
1558 | { | |
1559 | -#if X_BYTE_ORDER == X_BIG_ENDIAN | |
1560 | - V_ADDR_WB(addr,val); | |
1561 | +#if X_BYTE_ORDER == X_LITTLE_ENDIAN | |
1562 | + if (OFF(addr + 3) > 2) | |
1563 | + V_ADDR_WL(addr, val); | |
1564 | +#endif | |
1565 | + V_ADDR_WB(addr, val); | |
1566 | V_ADDR_WB(addr + 1, val >> 8); | |
1567 | V_ADDR_WB(addr + 2, val >> 16); | |
1568 | V_ADDR_WB(addr + 3, val >> 24); | |
1569 | -#else | |
1570 | - if (OFF(addr + 3) > 2) { | |
1571 | - V_ADDR_WL(addr,val); | |
1572 | - } else { | |
1573 | - V_ADDR_WB(addr + 3, val); | |
1574 | - V_ADDR_WB(addr + 2, val >> 8); | |
1575 | - V_ADDR_WB(addr + 1, val >> 16); | |
1576 | - V_ADDR_WB(addr, val >> 24); | |
1577 | - } | |
1578 | -#endif | |
1579 | } | |
1580 | ||
1581 | pointer | |
1582 | xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr) | |
1583 | { | |
1584 | - return (pointer) V_ADDR(addr); | |
1585 | + return V_ADDR(addr); | |
1586 | } | |
1587 | - | |
1588 | - | |
1589 | - | |
1590 | - | |
1591 | - | |
1592 | - | |
1593 | - | |
1594 | - | |
1595 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/helper_exec.c | |
1596 | =================================================================== | |
1597 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/int10/helper_exec.c,v | |
1598 | retrieving revision 1.11 | |
1599 | retrieving revision 1.12 | |
1600 | diff -u -r1.11 -r1.12 | |
1601 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/helper_exec.c 2000/12/06 15:35:26 1.11 | |
1602 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/helper_exec.c 2001/01/06 20:19:13 1.12 | |
1603 | @@ -1,12 +1,12 @@ | |
1604 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_exec.c,v 1.11 2000/12/06 15:35:26 eich Exp $ */ | |
1605 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_exec.c,v 1.12 2001/01/06 20:19:13 tsi Exp $ */ | |
1606 | /* | |
1607 | * XFree86 int10 module | |
1608 | * execute BIOS int 10h calls in x86 real mode environment | |
1609 | * Copyright 1999 Egbert Eich | |
1610 | * | |
1611 | - * Part of this is based on code taken form DOSEMU | |
1612 | + * Part of this is based on code taken from DOSEMU | |
1613 | * (C) Copyright 1992, ..., 1999 the "DOSEMU-Development-Team" | |
1614 | - */ | |
1615 | + */ | |
1616 | ||
1617 | /* | |
1618 | * To debug port accesses define PRINT_PORT. | |
1619 | @@ -15,7 +15,6 @@ | |
1620 | * on PIO. | |
1621 | */ | |
1622 | #include "xf86.h" | |
1623 | -#include "xf86str.h" | |
1624 | #include "xf86_OSproc.h" | |
1625 | #include "xf86_ansic.h" | |
1626 | #include "compiler.h" | |
1627 | @@ -44,17 +43,15 @@ | |
1628 | X86_EDX = (CARD32) pInt->dx; | |
1629 | X86_ESI = (CARD32) pInt->si; | |
1630 | X86_EDI = (CARD32) pInt->di; | |
1631 | - X86_ES = (CARD32) pInt->es; | |
1632 | X86_EBP = (CARD32) pInt->bp; | |
1633 | - X86_EIP = 0; | |
1634 | - X86_CS = 0x60; /* address of 'hlt' */ | |
1635 | - X86_ESP = 0x100; | |
1636 | - X86_SS = 0x30; /* This is the standard pc bios stack */ | |
1637 | - X86_DS = 0x40; /* standard pc ds */ | |
1638 | + X86_ESP = 0x1000; X86_SS = pInt->stackseg >> 4; | |
1639 | + X86_EIP = 0x0600; X86_CS = 0x0; /* address of 'hlt' */ | |
1640 | + X86_DS = 0x40; /* standard pc ds */ | |
1641 | + X86_ES = pInt->es; | |
1642 | X86_FS = 0; | |
1643 | X86_GS = 0; | |
1644 | - X86_EFLAGS = (X86_IF_MASK | X86_IOPL_MASK); | |
1645 | - | |
1646 | + X86_EFLAGS = X86_IF_MASK | X86_IOPL_MASK; | |
1647 | + | |
1648 | return xf86BlockSIGIO(); | |
1649 | } | |
1650 | ||
1651 | @@ -68,188 +65,23 @@ | |
1652 | pInt->dx = (CARD16) X86_EDX; | |
1653 | pInt->si = (CARD16) X86_ESI; | |
1654 | pInt->di = (CARD16) X86_EDI; | |
1655 | + pInt->es = (CARD16) X86_ES; | |
1656 | pInt->bp = (CARD16) X86_EBP; | |
1657 | pInt->flags = (CARD16) X86_FLAGS; | |
1658 | } | |
1659 | ||
1660 | -#define SEG_ADR(type, seg, reg) type((seg << 4) \ | |
1661 | - + (X86_##reg)) | |
1662 | -#define SEG_EADR(type, seg, reg) type((seg << 4) \ | |
1663 | - + (X86_E##reg)) | |
1664 | -#ifndef _X86EMU | |
1665 | -/* get the linear address */ | |
1666 | -#define LIN_PREF_SI ((pref_seg << 4) + X86_SI) | |
1667 | -#define LWECX (prefix66 ^ prefix67 ? X86_ECX : X86_CX) | |
1668 | -#define LWECX_ZERO {if (prefix66 ^ prefix67) X86_ECX = 0; else X86_CX = 0;} | |
1669 | -#define DF (1 << 10) | |
1670 | - | |
1671 | - | |
1672 | -/* vm86 fault handling */ | |
1673 | -Bool | |
1674 | -vm86_GP_fault(xf86Int10InfoPtr pInt) | |
1675 | -{ | |
1676 | - unsigned char *csp, *lina; | |
1677 | - CARD32 org_eip; | |
1678 | - int pref_seg; | |
1679 | - int done,is_rep,prefix66,prefix67; | |
1680 | - | |
1681 | - | |
1682 | - csp = lina = SEG_ADR((unsigned char *), X86_CS, IP); | |
1683 | - | |
1684 | - is_rep = 0; | |
1685 | - prefix66 = prefix67 = 0; | |
1686 | - pref_seg = -1; | |
1687 | - | |
1688 | - /* eat up prefixes */ | |
1689 | - done = 0; | |
1690 | - do { | |
1691 | - switch (MEM_RB(pInt,(int)csp++)) { | |
1692 | - case 0x66: /* operand prefix */ prefix66=1; break; | |
1693 | - case 0x67: /* address prefix */ prefix67=1; break; | |
1694 | - case 0x2e: /* CS */ pref_seg=X86_CS; break; | |
1695 | - case 0x3e: /* DS */ pref_seg=X86_DS; break; | |
1696 | - case 0x26: /* ES */ pref_seg=X86_ES; break; | |
1697 | - case 0x36: /* SS */ pref_seg=X86_SS; break; | |
1698 | - case 0x65: /* GS */ pref_seg=X86_GS; break; | |
1699 | - case 0x64: /* FS */ pref_seg=X86_FS; break; | |
1700 | - case 0xf2: /* repnz */ | |
1701 | - case 0xf3: /* rep */ is_rep=1; break; | |
1702 | - default: done=1; | |
1703 | - } | |
1704 | - } while (!done); | |
1705 | - csp--; /* oops one too many */ | |
1706 | - org_eip = X86_EIP; | |
1707 | - X86_IP += (csp - lina); | |
1708 | - | |
1709 | - switch (MEM_RB(pInt,(int)csp)) { | |
1710 | - case 0x6c: /* insb */ | |
1711 | - /* NOTE: ES can't be overwritten; prefixes 66,67 should use esi,edi,ecx | |
1712 | - * but is anyone using extended regs in real mode? */ | |
1713 | - /* WARNING: no test for DI wrapping! */ | |
1714 | - X86_EDI += port_rep_inb(pInt,X86_DX,SEG_EADR((CARD32),X86_ES,DI), | |
1715 | - X86_FLAGS & DF, (is_rep? LWECX:1)); | |
1716 | - if (is_rep) LWECX_ZERO; | |
1717 | - X86_IP++; | |
1718 | - break; | |
1719 | - | |
1720 | - case 0x6d: /* (rep) insw / insd */ | |
1721 | - /* NOTE: ES can't be overwritten */ | |
1722 | - /* WARNING: no test for _DI wrapping! */ | |
1723 | - if (prefix66) { | |
1724 | - X86_DI += port_rep_inl(pInt,X86_DX,SEG_ADR((CARD32),X86_ES,DI), | |
1725 | - X86_EFLAGS & DF, (is_rep? LWECX:1)); | |
1726 | - } | |
1727 | - else { | |
1728 | - X86_DI += port_rep_inw(pInt,X86_DX,SEG_ADR((CARD32),X86_ES,DI), | |
1729 | - X86_FLAGS & DF, (is_rep? LWECX:1)); | |
1730 | - } | |
1731 | - if (is_rep) LWECX_ZERO; | |
1732 | - X86_IP++; | |
1733 | - break; | |
1734 | - | |
1735 | - case 0x6e: /* (rep) outsb */ | |
1736 | - if (pref_seg < 0) pref_seg = X86_DS; | |
1737 | - /* WARNING: no test for _SI wrapping! */ | |
1738 | - X86_SI += port_rep_outb(pInt,X86_DX,(CARD32)LIN_PREF_SI, X86_FLAGS&DF, | |
1739 | - (is_rep? LWECX:1)); | |
1740 | - if (is_rep) LWECX_ZERO; | |
1741 | - X86_IP++; | |
1742 | - break; | |
1743 | - | |
1744 | - case 0x6f: /* (rep) outsw / outsd */ | |
1745 | - if (pref_seg < 0) pref_seg = X86_DS; | |
1746 | - /* WARNING: no test for _SI wrapping! */ | |
1747 | - if (prefix66) { | |
1748 | - X86_SI += port_rep_outl(pInt,X86_DX,(CARD32)LIN_PREF_SI, | |
1749 | - X86_EFLAGS&DF, (is_rep? LWECX:1)); | |
1750 | - } | |
1751 | - else { | |
1752 | - X86_SI += port_rep_outw(pInt,X86_DX,(CARD32)LIN_PREF_SI, | |
1753 | - X86_FLAGS & DF, (is_rep? LWECX:1)); | |
1754 | - } | |
1755 | - if (is_rep) LWECX_ZERO; | |
1756 | - X86_IP++; | |
1757 | - break; | |
1758 | - | |
1759 | - case 0xe5: /* inw xx, inl xx */ | |
1760 | - if (prefix66) X86_EAX = p_inl((int) MEM_RB(pInt,(int)(csp+1))); | |
1761 | - else X86_AX = p_inw((int) (int)(csp[1])); | |
1762 | - X86_IP += 2; | |
1763 | - break; | |
1764 | - case 0xe4: /* inb xx */ | |
1765 | - X86_AX &= ~(CARD32)0xff; | |
1766 | - X86_AL |= p_inb((int) MEM_RB(pInt,(int)(csp+1))); | |
1767 | - X86_IP += 2; | |
1768 | - break; | |
1769 | - case 0xed: /* inw dx, inl dx */ | |
1770 | - if (prefix66) X86_EAX = p_inl(X86_EDX); | |
1771 | - else X86_AX = p_inw(X86_DX); | |
1772 | - X86_IP += 1; | |
1773 | - break; | |
1774 | - case 0xec: /* inb dx */ | |
1775 | - X86_AX &= ~(CARD32)0xff; | |
1776 | - X86_AL |= p_inb(X86_DX); | |
1777 | - X86_IP += 1; | |
1778 | - break; | |
1779 | - | |
1780 | - case 0xe7: /* outw xx */ | |
1781 | - if (prefix66) p_outl((int)MEM_RB(pInt,(int)(csp+1)), X86_EAX); | |
1782 | - else p_outw((int)MEM_RB(pInt,(int)(csp+1)), X86_AX); | |
1783 | - X86_IP += 2; | |
1784 | - break; | |
1785 | - case 0xe6: /* outb xx */ | |
1786 | - p_outb((int) MEM_RB(pInt,(int)(csp+1)), X86_AL); | |
1787 | - X86_IP += 2; | |
1788 | - break; | |
1789 | - case 0xef: /* outw dx */ | |
1790 | - if (prefix66) p_outl(X86_DX, X86_EAX); | |
1791 | - else p_outw(X86_DX, X86_AX); | |
1792 | - X86_IP += 1; | |
1793 | - break; | |
1794 | - case 0xee: /* outb dx */ | |
1795 | - p_outb(X86_DX, X86_AL); | |
1796 | - X86_IP += 1; | |
1797 | - break; | |
1798 | - | |
1799 | - case 0xf4: | |
1800 | -#ifdef DEBUG | |
1801 | - ErrorF("hlt at %p\n", lina); | |
1802 | -#endif | |
1803 | - return FALSE; | |
1804 | - | |
1805 | - case 0x0f: | |
1806 | - xf86DrvMsg(pInt->scrnIndex, | |
1807 | - X_ERROR,"CPU 0x0f Trap at eip=0x%lx\n",X86_EIP); | |
1808 | - goto op0ferr; | |
1809 | - break; | |
1810 | - | |
1811 | - case 0xf0: /* lock */ | |
1812 | - default: | |
1813 | - xf86DrvMsg(pInt->scrnIndex,X_ERROR,"unknown reason for exception\n"); | |
1814 | - dump_registers(pInt); | |
1815 | - stack_trace(pInt); | |
1816 | - | |
1817 | - op0ferr: | |
1818 | - dump_code(pInt); | |
1819 | - xf86DrvMsg(pInt->scrnIndex,X_ERROR,"cannot continue\n"); | |
1820 | - return FALSE; | |
1821 | - } /* end of switch() */ | |
1822 | - return TRUE; | |
1823 | -} | |
1824 | -#endif | |
1825 | - | |
1826 | /* general software interrupt handler */ | |
1827 | CARD32 | |
1828 | getIntVect(xf86Int10InfoPtr pInt,int num) | |
1829 | { | |
1830 | - return (MEM_RW(pInt,(num << 2)) + (MEM_RW(pInt,((num << 2) + 2)) << 4)); | |
1831 | + return MEM_RW(pInt, num << 2) + (MEM_RW(pInt, (num << 2) + 2) << 4); | |
1832 | } | |
1833 | ||
1834 | void | |
1835 | pushw(xf86Int10InfoPtr pInt, CARD16 val) | |
1836 | { | |
1837 | X86_ESP -= 2; | |
1838 | - MEM_WW(pInt,((CARD32) X86_SS << 4) + X86_SP,val); | |
1839 | + MEM_WW(pInt, ((CARD32) X86_SS << 4) + X86_SP, val); | |
1840 | } | |
1841 | ||
1842 | int | |
1843 | @@ -258,11 +90,11 @@ | |
1844 | CARD32 eflags; | |
1845 | #ifndef _PC | |
1846 | /* check if bios vector is initialized */ | |
1847 | - if (MEM_RW(pInt,(num<<2)+2) == (SYS_BIOS >> 4)) { /* SYS_BIOS_SEG ?*/ | |
1848 | + if (MEM_RW(pInt, (num << 2) + 2) == (SYS_BIOS >> 4)) { /* SYS_BIOS_SEG ?*/ | |
1849 | #ifdef PRINT_INT | |
1850 | - ErrorF("card BIOS not loaded\n"); | |
1851 | + ErrorF("card BIOS not loaded\n"); | |
1852 | #endif | |
1853 | - return 0; | |
1854 | + return 0; | |
1855 | } | |
1856 | #endif | |
1857 | #ifdef PRINT_INT | |
1858 | @@ -275,11 +107,11 @@ | |
1859 | #endif | |
1860 | pushw(pInt, eflags); | |
1861 | pushw(pInt, X86_CS); | |
1862 | - pushw(pInt, (CARD16)X86_EIP); | |
1863 | - X86_CS = MEM_RW(pInt,((num << 2) + 2)); | |
1864 | - X86_EIP = (X86_EIP & 0xFFFF0000) | MEM_RW(pInt,(num << 2)); | |
1865 | + pushw(pInt, X86_IP); | |
1866 | + X86_CS = MEM_RW(pInt, (num << 2) + 2); | |
1867 | + X86_IP = MEM_RW(pInt, num << 2); | |
1868 | #ifdef PRINT_INT | |
1869 | - ErrorF("0x%x:%lx\n",X86_CS,X86_EIP); | |
1870 | + ErrorF("0x%x:%lx\n", X86_CS, X86_EIP); | |
1871 | #endif | |
1872 | return 1; | |
1873 | } | |
1874 | @@ -291,52 +123,50 @@ | |
1875 | int i; | |
1876 | CARD32 lina = SEG_ADR((CARD32), X86_CS, IP); | |
1877 | ||
1878 | - ErrorF("code at 0x%8.8lx: ",lina); | |
1879 | - for (i=0; i<0x10; i++) | |
1880 | - ErrorF("%2.2x ",MEM_RB(pInt,lina + i)); | |
1881 | - ErrorF("\n "); | |
1882 | - for (; i<0x20; i++) | |
1883 | - ErrorF("%2.2x ",MEM_RB(pInt,lina + i)); | |
1884 | - ErrorF("\n"); | |
1885 | + xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, "code at 0x%8.8lx:\n", lina); | |
1886 | + for (i=0; i<0x10; i++) | |
1887 | + xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i)); | |
1888 | + xf86ErrorFVerb(3, "\n"); | |
1889 | + for (; i<0x20; i++) | |
1890 | + xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i)); | |
1891 | + xf86ErrorFVerb(3, "\n"); | |
1892 | } | |
1893 | ||
1894 | -#define PRINT(x) ErrorF(#x":%4.4x ",x) | |
1895 | -#define PRINT_FLAGS(x) ErrorF(#x":%8.8x ",x) | |
1896 | void | |
1897 | dump_registers(xf86Int10InfoPtr pInt) | |
1898 | { | |
1899 | - PRINT(X86_AX); | |
1900 | - PRINT(X86_BX); | |
1901 | - PRINT(X86_CX); | |
1902 | - PRINT(X86_DX); | |
1903 | - ErrorF("\n"); | |
1904 | - PRINT(X86_IP); | |
1905 | - PRINT(X86_SI); | |
1906 | - PRINT(X86_DI); | |
1907 | - PRINT(X86_BP); | |
1908 | - PRINT(X86_SP); | |
1909 | - ErrorF("\n"); | |
1910 | - PRINT(X86_CS); | |
1911 | - PRINT(X86_SS); | |
1912 | - PRINT(X86_ES); | |
1913 | - PRINT(X86_DS); | |
1914 | - PRINT(X86_FS); | |
1915 | - PRINT(X86_GS); | |
1916 | - ErrorF("\n"); | |
1917 | - PRINT_FLAGS(X86_EFLAGS); | |
1918 | - ErrorF("\n"); | |
1919 | + xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, | |
1920 | + "EAX=0x%8.8x, EBX=0x%8.8x, ECX=0x%8.8x, EDX=0x%8.8x\n", | |
1921 | + X86_EAX, X86_EBX, X86_ECX, X86_EDX); | |
1922 | + xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, | |
1923 | + "ESP=0x%8.8x, EBP=0x%8.8x, ESI=0x%8.8x, EDI=0x%8.8x\n", | |
1924 | + X86_ESP, X86_EBP, X86_ESI, X86_EDI); | |
1925 | + xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, | |
1926 | + "CS=0x%4.4x, SS=0x%4.4x," | |
1927 | + " DS=0x%4.4x, ES=0x%4.4x, FS=0x%4.4x, GS=0x%4.4x\n", | |
1928 | + X86_CS, X86_SS, X86_DS, X86_ES, X86_FS, X86_GS); | |
1929 | + xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, | |
1930 | + "EIP=0x%8.8x, EFLAGS=0x%8.8x\n", X86_EIP, X86_EFLAGS); | |
1931 | } | |
1932 | ||
1933 | void | |
1934 | stack_trace(xf86Int10InfoPtr pInt) | |
1935 | { | |
1936 | - int i; | |
1937 | - CARD32 stack = SEG_ADR((CARD32), X86_SS, SP); | |
1938 | - | |
1939 | - ErrorF("stack at 0x%8.8lx:\n",stack); | |
1940 | - for (i=0; i < 0x10; i++) | |
1941 | - ErrorF("%2.2x ",MEM_RB(pInt,stack + i)); | |
1942 | - ErrorF("\n"); | |
1943 | + int i = 0; | |
1944 | + CARD32 stack = SEG_ADR((CARD32), X86_SS, SP); | |
1945 | + CARD32 tail = (CARD32)((X86_SS << 4) + 0x1000); | |
1946 | + | |
1947 | + if (stack >= tail) return; | |
1948 | + | |
1949 | + xf86MsgVerb(X_INFO, 3, "stack at 0x%8.8lx:\n", stack); | |
1950 | + for (; stack < tail; stack++) { | |
1951 | + xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, stack)); | |
1952 | + i = (i + 1) % 0x10; | |
1953 | + if (!i) | |
1954 | + xf86ErrorFVerb(3, "\n"); | |
1955 | + } | |
1956 | + if (i) | |
1957 | + xf86ErrorFVerb(3, "\n"); | |
1958 | } | |
1959 | ||
1960 | int | |
1961 | @@ -347,13 +177,13 @@ | |
1962 | CARD32 dst = base; | |
1963 | #ifdef PRINT_PORT | |
1964 | ErrorF(" rep_insb(%#x) %d bytes at %p %s\n", | |
1965 | - port, count, base, d_f?"up":"down"); | |
1966 | + port, count, base, d_f ? "up" : "down"); | |
1967 | #endif | |
1968 | while (count--) { | |
1969 | - MEM_WB(pInt,dst,inb(port)); | |
1970 | + MEM_WB(pInt, dst, x_inb(port)); | |
1971 | dst += inc; | |
1972 | } | |
1973 | - return (dst-base); | |
1974 | + return dst - base; | |
1975 | } | |
1976 | ||
1977 | int | |
1978 | @@ -362,15 +192,15 @@ | |
1979 | { | |
1980 | register int inc = d_f ? -2 : 2; | |
1981 | CARD32 dst = base; | |
1982 | -#ifdef PRINT_PORT | |
1983 | +#ifdef PRINT_PORT | |
1984 | ErrorF(" rep_insw(%#x) %d bytes at %p %s\n", | |
1985 | - port, count, base, d_f?"up":"down"); | |
1986 | + port, count, base, d_f ? "up" : "down"); | |
1987 | #endif | |
1988 | while (count--) { | |
1989 | - MEM_WW(pInt,dst,inw(port)); | |
1990 | + MEM_WW(pInt, dst, x_inw(port)); | |
1991 | dst += inc; | |
1992 | } | |
1993 | - return (dst-base); | |
1994 | + return dst - base; | |
1995 | } | |
1996 | ||
1997 | int | |
1998 | @@ -379,15 +209,15 @@ | |
1999 | { | |
2000 | register int inc = d_f ? -4 : 4; | |
2001 | CARD32 dst = base; | |
2002 | -#ifdef PRINT_PORT | |
2003 | +#ifdef PRINT_PORT | |
2004 | ErrorF(" rep_insl(%#x) %d bytes at %p %s\n", | |
2005 | - port, count, base, d_f?"up":"down"); | |
2006 | + port, count, base, d_f ? "up" : "down"); | |
2007 | #endif | |
2008 | while (count--) { | |
2009 | - MEM_WL(pInt,dst,inl(port)); | |
2010 | + MEM_WL(pInt, dst, x_inl(port)); | |
2011 | dst += inc; | |
2012 | } | |
2013 | - return (dst-base); | |
2014 | + return dst - base; | |
2015 | } | |
2016 | ||
2017 | int | |
2018 | @@ -396,15 +226,15 @@ | |
2019 | { | |
2020 | register int inc = d_f ? -1 : 1; | |
2021 | CARD32 dst = base; | |
2022 | -#ifdef PRINT_PORT | |
2023 | +#ifdef PRINT_PORT | |
2024 | ErrorF(" rep_outb(%#x) %d bytes at %p %s\n", | |
2025 | - port, count, base, d_f?"up":"down"); | |
2026 | + port, count, base, d_f ? "up" : "down"); | |
2027 | #endif | |
2028 | while (count--) { | |
2029 | - outb(port,MEM_RB(pInt,dst)); | |
2030 | + x_outb(port, MEM_RB(pInt, dst)); | |
2031 | dst += inc; | |
2032 | } | |
2033 | - return (dst-base); | |
2034 | + return dst - base; | |
2035 | } | |
2036 | ||
2037 | int | |
2038 | @@ -413,15 +243,15 @@ | |
2039 | { | |
2040 | register int inc = d_f ? -2 : 2; | |
2041 | CARD32 dst = base; | |
2042 | -#ifdef PRINT_PORT | |
2043 | +#ifdef PRINT_PORT | |
2044 | ErrorF(" rep_outw(%#x) %d bytes at %p %s\n", | |
2045 | - port, count, base, d_f?"up":"down"); | |
2046 | + port, count, base, d_f ? "up" : "down"); | |
2047 | #endif | |
2048 | while (count--) { | |
2049 | - outw(port,MEM_RW(pInt,dst)); | |
2050 | + x_outw(port, MEM_RW(pInt, dst)); | |
2051 | dst += inc; | |
2052 | } | |
2053 | - return (dst-base); | |
2054 | + return dst - base; | |
2055 | } | |
2056 | ||
2057 | int | |
2058 | @@ -430,27 +260,36 @@ | |
2059 | { | |
2060 | register int inc = d_f ? -4 : 4; | |
2061 | CARD32 dst = base; | |
2062 | -#ifdef PRINT_PORT | |
2063 | +#ifdef PRINT_PORT | |
2064 | ErrorF(" rep_outl(%#x) %d bytes at %p %s\n", | |
2065 | - port, count, base, d_f?"up":"down"); | |
2066 | + port, count, base, d_f ? "up" : "down"); | |
2067 | #endif | |
2068 | while (count--) { | |
2069 | - outl(port,MEM_RL(pInt,dst)); | |
2070 | + x_outl(port, MEM_RL(pInt, dst)); | |
2071 | dst += inc; | |
2072 | } | |
2073 | - return (dst-base); | |
2074 | + return dst - base; | |
2075 | } | |
2076 | ||
2077 | -#if defined(PRINT_PORT) || (!defined(_PC) && !defined(_PC_IO)) | |
2078 | CARD8 | |
2079 | x_inb(CARD16 port) | |
2080 | { | |
2081 | CARD8 val; | |
2082 | ||
2083 | - val = inb(port); | |
2084 | -#ifdef PRINT_PORT | |
2085 | - ErrorF(" inb(%#x) = %2.2x\n",port,val); | |
2086 | + if (port >= 0x0100) { /* Don't interfere with mainboard */ | |
2087 | + val = inb(port); | |
2088 | +#ifdef PRINT_PORT | |
2089 | + ErrorF(" inb(%#x) = %2.2x\n", port, val); | |
2090 | #endif | |
2091 | + } else { | |
2092 | + val = 0; | |
2093 | + xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2, | |
2094 | + "inb 0x%4.4x\n", port); | |
2095 | + if (xf86GetVerbosity() > 3) { | |
2096 | + dump_registers(Int10Current); | |
2097 | + stack_trace(Int10Current); | |
2098 | + } | |
2099 | + } | |
2100 | return val; | |
2101 | } | |
2102 | ||
2103 | @@ -460,8 +299,8 @@ | |
2104 | CARD16 val; | |
2105 | ||
2106 | val = inw(port); | |
2107 | -#ifdef PRINT_PORT | |
2108 | - ErrorF(" inw(%#x) = %4.4x\n",port,val); | |
2109 | +#ifdef PRINT_PORT | |
2110 | + ErrorF(" inw(%#x) = %4.4x\n", port, val); | |
2111 | #endif | |
2112 | return val; | |
2113 | } | |
2114 | @@ -469,19 +308,29 @@ | |
2115 | void | |
2116 | x_outb(CARD16 port, CARD8 val) | |
2117 | { | |
2118 | -#ifdef PRINT_PORT | |
2119 | - ErrorF(" outb(%#x, %2.2x)\n",port,val); | |
2120 | + if (port >= 0x0100) { /* Don't interfere with mainboard */ | |
2121 | +#ifdef PRINT_PORT | |
2122 | + ErrorF(" outb(%#x, %2.2x)\n", port, val); | |
2123 | #endif | |
2124 | - outb(port,val); | |
2125 | + outb(port, val); | |
2126 | + } else { | |
2127 | + xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2, | |
2128 | + "outb 0x%4.4x,0x%2.2x\n", port, val); | |
2129 | + if (xf86GetVerbosity() > 3) { | |
2130 | + dump_registers(Int10Current); | |
2131 | + stack_trace(Int10Current); | |
2132 | + } | |
2133 | + } | |
2134 | } | |
2135 | ||
2136 | void | |
2137 | x_outw(CARD16 port, CARD16 val) | |
2138 | { | |
2139 | -#ifdef PRINT_PORT | |
2140 | - ErrorF(" outw(%#x, %4.4x)\n",port,val); | |
2141 | +#ifdef PRINT_PORT | |
2142 | + ErrorF(" outw(%#x, %4.4x)\n", port, val); | |
2143 | #endif | |
2144 | - outw(port,val); | |
2145 | + | |
2146 | + outw(port, val); | |
2147 | } | |
2148 | ||
2149 | CARD32 | |
2150 | @@ -489,13 +338,13 @@ | |
2151 | { | |
2152 | CARD32 val; | |
2153 | ||
2154 | -#if !defined (_PC) && !defined (_PC_PCI) | |
2155 | - if (!pciCfg1in(port,&val)) | |
2156 | +#if !defined(_PC) && !defined(_PC_PCI) | |
2157 | + if (!pciCfg1in(port, &val)) | |
2158 | #endif | |
2159 | val = inl(port); | |
2160 | ||
2161 | #ifdef PRINT_PORT | |
2162 | - ErrorF(" inl(%#x) = %8.8x\n",port,val); | |
2163 | + ErrorF(" inl(%#x) = %8.8x\n", port, val); | |
2164 | #endif | |
2165 | return val; | |
2166 | } | |
2167 | @@ -504,52 +353,52 @@ | |
2168 | x_outl(CARD16 port, CARD32 val) | |
2169 | { | |
2170 | #ifdef PRINT_PORT | |
2171 | - ErrorF(" outl(%#x, %8.8x)\n",port,val); | |
2172 | + ErrorF(" outl(%#x, %8.8x)\n", port, val); | |
2173 | #endif | |
2174 | -#if !defined (_PC) && !defined (_PC_PCI) | |
2175 | - if (!pciCfg1out(port,val)) | |
2176 | + | |
2177 | +#if !defined(_PC) && !defined(_PC_PCI) | |
2178 | + if (!pciCfg1out(port, val)) | |
2179 | #endif | |
2180 | - outl(port,val); | |
2181 | + outl(port, val); | |
2182 | } | |
2183 | -#endif | |
2184 | ||
2185 | CARD8 | |
2186 | Mem_rb(int addr) | |
2187 | { | |
2188 | - return Int10Current->mem->rb(Int10Current,addr); | |
2189 | + return (*Int10Current->mem->rb)(Int10Current, addr); | |
2190 | } | |
2191 | ||
2192 | CARD16 | |
2193 | Mem_rw(int addr) | |
2194 | { | |
2195 | - return Int10Current->mem->rw(Int10Current,addr); | |
2196 | + return (*Int10Current->mem->rw)(Int10Current, addr); | |
2197 | } | |
2198 | ||
2199 | CARD32 | |
2200 | Mem_rl(int addr) | |
2201 | { | |
2202 | - return Int10Current->mem->rl(Int10Current,addr); | |
2203 | + return (*Int10Current->mem->rl)(Int10Current, addr); | |
2204 | } | |
2205 | ||
2206 | void | |
2207 | -Mem_wb(int addr,CARD8 val) | |
2208 | +Mem_wb(int addr, CARD8 val) | |
2209 | { | |
2210 | - Int10Current->mem->wb(Int10Current,addr,val); | |
2211 | + (*Int10Current->mem->wb)(Int10Current, addr, val); | |
2212 | } | |
2213 | ||
2214 | void | |
2215 | -Mem_ww(int addr,CARD16 val) | |
2216 | +Mem_ww(int addr, CARD16 val) | |
2217 | { | |
2218 | - Int10Current->mem->ww(Int10Current,addr,val); | |
2219 | + (*Int10Current->mem->ww)(Int10Current, addr, val); | |
2220 | } | |
2221 | ||
2222 | void | |
2223 | -Mem_wl(int addr,CARD32 val) | |
2224 | +Mem_wl(int addr, CARD32 val) | |
2225 | { | |
2226 | - Int10Current->mem->wl(Int10Current,addr,val); | |
2227 | + (*Int10Current->mem->wl)(Int10Current, addr, val); | |
2228 | } | |
2229 | ||
2230 | -#if !defined (_PC) && !defined (_PC_PCI) | |
2231 | +#if !defined(_PC) && !defined(_PC_PCI) | |
2232 | static CARD32 PciCfg1Addr = 0; | |
2233 | ||
2234 | #define TAG(Cfg1Addr) (Cfg1Addr & 0xffff00) | |
2235 | @@ -562,7 +411,7 @@ | |
2236 | *val = PciCfg1Addr; | |
2237 | return 1; | |
2238 | } | |
2239 | - else if (addr == 0xCFC) { | |
2240 | + if (addr == 0xCFC) { | |
2241 | *val = pciReadLong(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr)); | |
2242 | return 1; | |
2243 | } | |
2244 | @@ -576,7 +425,7 @@ | |
2245 | PciCfg1Addr = val; | |
2246 | return 1; | |
2247 | } | |
2248 | - else if (addr == 0xCFC) { | |
2249 | + if (addr == 0xCFC) { | |
2250 | pciWriteLong(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr),val); | |
2251 | return 1; | |
2252 | } | |
2253 | @@ -603,7 +452,7 @@ | |
2254 | * disable registers before we call the BIOS initialization and | |
2255 | * restore the original values afterwards. In beween we hold our | |
2256 | * breath. To get to a (possibly exising) ISA card need to disable | |
2257 | - * our current PCI card. | |
2258 | + * our current PCI card. | |
2259 | */ | |
2260 | /* | |
2261 | * This is just for booting: we just want to catch pure | |
2262 | @@ -615,25 +464,25 @@ | |
2263 | void | |
2264 | LockLegacyVGA(int screenIndex,legacyVGAPtr vga) | |
2265 | { | |
2266 | - xf86SetCurrentAccess(FALSE,xf86Screens[screenIndex]); | |
2267 | + xf86SetCurrentAccess(FALSE, xf86Screens[screenIndex]); | |
2268 | vga->save_msr = inb(0x3CC); | |
2269 | vga->save_vse = inb(0x3C3); | |
2270 | vga->save_46e8 = inb(0x46e8); | |
2271 | vga->save_pos102 = inb(0x102); | |
2272 | - outb(0x3C2,~(CARD8)0x03 & vga->save_msr); | |
2273 | - outb(0x3C3,~(CARD8)0x01 & vga->save_vse); | |
2274 | + outb(0x3C2, ~(CARD8)0x03 & vga->save_msr); | |
2275 | + outb(0x3C3, ~(CARD8)0x01 & vga->save_vse); | |
2276 | outb(0x46e8, ~(CARD8)0x08 & vga->save_46e8); | |
2277 | outb(0x102, ~(CARD8)0x01 & vga->save_pos102); | |
2278 | - xf86SetCurrentAccess(TRUE,xf86Screens[screenIndex]); | |
2279 | + xf86SetCurrentAccess(TRUE, xf86Screens[screenIndex]); | |
2280 | } | |
2281 | ||
2282 | void | |
2283 | UnlockLegacyVGA(int screenIndex, legacyVGAPtr vga) | |
2284 | { | |
2285 | - xf86SetCurrentAccess(FALSE,xf86Screens[screenIndex]); | |
2286 | + xf86SetCurrentAccess(FALSE, xf86Screens[screenIndex]); | |
2287 | outb(0x102, vga->save_pos102); | |
2288 | outb(0x46e8, vga->save_46e8); | |
2289 | outb(0x3C3, vga->save_vse); | |
2290 | outb(0x3C2, vga->save_msr); | |
2291 | - xf86SetCurrentAccess(TRUE,xf86Screens[screenIndex]); | |
2292 | + xf86SetCurrentAccess(TRUE, xf86Screens[screenIndex]); | |
2293 | } | |
2294 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c | |
2295 | =================================================================== | |
2296 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c,v | |
2297 | retrieving revision 1.14 | |
2298 | retrieving revision 1.15 | |
2299 | diff -u -r1.14 -r1.15 | |
2300 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c 2000/12/02 15:31:01 1.14 | |
2301 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c 2001/01/06 20:19:13 1.15 | |
2302 | @@ -1,11 +1,10 @@ | |
2303 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_mem.c,v 1.14 2000/12/02 15:31:01 tsi Exp $ */ | |
2304 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_mem.c,v 1.15 2001/01/06 20:19:13 tsi Exp $ */ | |
2305 | /* | |
2306 | * XFree86 int10 module | |
2307 | * execute BIOS int 10h calls in x86 real mode environment | |
2308 | * Copyright 1999 Egbert Eich | |
2309 | */ | |
2310 | #include "xf86.h" | |
2311 | -#include "xf86str.h" | |
2312 | #include "xf86_OSproc.h" | |
2313 | #include "xf86_ansic.h" | |
2314 | #include "compiler.h" | |
2315 | @@ -21,14 +20,14 @@ | |
2316 | } INT10Opts; | |
2317 | ||
2318 | static OptionInfoRec INT10Options[] = { | |
2319 | - {OPT_NOINT10, "NoINT10", OPTV_BOOLEAN, {0}, FALSE }, | |
2320 | - { -1, NULL, OPTV_NONE, {0}, FALSE }, | |
2321 | + {OPT_NOINT10, "NoINT10", OPTV_BOOLEAN, {0}, FALSE}, | |
2322 | + { -1, NULL, OPTV_NONE, {0}, FALSE}, | |
2323 | }; | |
2324 | ||
2325 | #define nINT10Options (sizeof(INT10Options) / sizeof(INT10Options[0])) | |
2326 | ||
2327 | #ifdef DEBUG | |
2328 | -void | |
2329 | +void | |
2330 | dprint(unsigned long start, unsigned long size) | |
2331 | { | |
2332 | int i,j; | |
2333 | @@ -37,7 +36,7 @@ | |
2334 | for (j = 0; j < (size >> 4); j++) { | |
2335 | char *d = c; | |
2336 | ErrorF("\n0x%lx: ",(unsigned long)c); | |
2337 | - for (i = 0; i<16; i++) | |
2338 | + for (i = 0; i<16; i++) | |
2339 | ErrorF("%2.2x ",(unsigned char) (*(c++))); | |
2340 | c = d; | |
2341 | for (i = 0; i<16; i++) { | |
2342 | @@ -49,8 +48,8 @@ | |
2343 | ErrorF("\n"); | |
2344 | } | |
2345 | #endif | |
2346 | - | |
2347 | ||
2348 | +#ifndef _PC | |
2349 | /* | |
2350 | * here we are really paranoid about faking a "real" | |
2351 | * BIOS. Most of this information was pulled from | |
2352 | @@ -59,66 +58,64 @@ | |
2353 | void | |
2354 | setup_int_vect(xf86Int10InfoPtr pInt) | |
2355 | { | |
2356 | - const CARD16 cs = (SYS_BIOS >> 4); | |
2357 | - const CARD16 ip = 0x0; | |
2358 | int i; | |
2359 | - | |
2360 | + | |
2361 | /* let the int vects point to the SYS_BIOS seg */ | |
2362 | - for (i=0; i<0x80; i++) { | |
2363 | - MEM_WW(pInt,(i<<2),ip); | |
2364 | - MEM_WW(pInt,((i<<2)+2),cs); | |
2365 | + for (i = 0; i < 0x80; i++) { | |
2366 | + MEM_WW(pInt, i << 2, 0); | |
2367 | + MEM_WW(pInt, (i << 2) + 2, SYS_BIOS >> 4); | |
2368 | } | |
2369 | - /* video interrupts default location */ | |
2370 | - MEM_WW(pInt,(0x42<<2),0xf065); | |
2371 | - MEM_WW(pInt,(0x10<<2),0xf065); | |
2372 | - MEM_WW(pInt,(0x6D<<2),0xf065); | |
2373 | - /* video param table default location (int 1d) */ | |
2374 | - MEM_WW(pInt,(0x1d<<2),0xf0A4); | |
2375 | + | |
2376 | + reset_int_vect(pInt); | |
2377 | /* font tables default location (int 1F) */ | |
2378 | - MEM_WW(pInt,(0x1f<<2),0xfa6e); | |
2379 | + MEM_WW(pInt,0x1f<<2,0xfa6e); | |
2380 | ||
2381 | - /* int 11 default location */ | |
2382 | - MEM_WW(pInt,(0x11<<2),0xf84d); | |
2383 | - /* int 12 default location */ | |
2384 | - MEM_WW(pInt,(0x12<<2),0xf841); | |
2385 | - /* int 15 default location */ | |
2386 | - MEM_WW(pInt,(0x15<<2),0xf859); | |
2387 | - /* int 1A default location */ | |
2388 | - MEM_WW(pInt,(0x1a<<2),0xff6e); | |
2389 | - /* int 05 default location */ | |
2390 | - MEM_WW(pInt,(0x05<<2),0xff54); | |
2391 | - /* int 08 default location */ | |
2392 | - MEM_WW(pInt,(0x08<<2),0xfea5); | |
2393 | - /* int 13 default location (fdd) */ | |
2394 | - MEM_WW(pInt,(0x13<<2),0xec59); | |
2395 | - /* int 0E default location */ | |
2396 | - MEM_WW(pInt,(0x0e<<2),0xef57); | |
2397 | - /* int 17 default location */ | |
2398 | - MEM_WW(pInt,(0x17<<2),0xefd2); | |
2399 | + /* int 11 default location (Get Equipment Configuration) */ | |
2400 | + MEM_WW(pInt, 0x11 << 2, 0xf84d); | |
2401 | + /* int 12 default location (Get Conventional Memory Size) */ | |
2402 | + MEM_WW(pInt, 0x12 << 2, 0xf841); | |
2403 | + /* int 15 default location (I/O System Extensions) */ | |
2404 | + MEM_WW(pInt, 0x15 << 2, 0xf859); | |
2405 | + /* int 1A default location (RTC, PCI and others) */ | |
2406 | + MEM_WW(pInt, 0x1a << 2, 0xff6e); | |
2407 | + /* int 05 default location (Bound Exceeded) */ | |
2408 | + MEM_WW(pInt, 0x05 << 2, 0xff54); | |
2409 | + /* int 08 default location (Double Fault) */ | |
2410 | + MEM_WW(pInt, 0x08 << 2, 0xfea5); | |
2411 | + /* int 13 default location (Disk) */ | |
2412 | + MEM_WW(pInt, 0x13 << 2, 0xec59); | |
2413 | + /* int 0E default location (Page Fault) */ | |
2414 | + MEM_WW(pInt, 0x0e << 2, 0xef57); | |
2415 | + /* int 17 default location (Parallel Port) */ | |
2416 | + MEM_WW(pInt, 0x17 << 2, 0xefd2); | |
2417 | /* fdd table default location (int 1e) */ | |
2418 | - MEM_WW(pInt,(0x1e<<2),0xefc7); | |
2419 | + MEM_WW(pInt, 0x1e << 2, 0xefc7); | |
2420 | + | |
2421 | + /* Set Equipment flag to VGA */ | |
2422 | + i = MEM_RB(pInt, 0x0410) & 0xCF; | |
2423 | + MEM_WB(pInt, 0x0410, i); | |
2424 | + /* XXX Perhaps setup more of the BDA here. See also int42(0x00). */ | |
2425 | } | |
2426 | +#endif | |
2427 | ||
2428 | int | |
2429 | setup_system_bios(memType base_addr) | |
2430 | { | |
2431 | - char *date = "06/01/99"; | |
2432 | - char *eisa_ident = "PCI/ISA"; | |
2433 | - CARD16 *base = (CARD16*) base_addr; | |
2434 | - | |
2435 | + char *base = (char *) base_addr; | |
2436 | + | |
2437 | /* | |
2438 | * we trap the "industry standard entry points" to the BIOS | |
2439 | * and all other locations by filling them with "hlt" | |
2440 | * TODO: implement hlt-handler for these | |
2441 | */ | |
2442 | - memset((void *)(base),0xf4,0x10000); | |
2443 | + memset(base, 0xf4, 0x10000); | |
2444 | ||
2445 | /* set bios date */ | |
2446 | - strcpy((((char *)base) + 0xFFF5),date); | |
2447 | + strcpy(base + 0x0FFF5, "06/11/99"); | |
2448 | /* set up eisa ident string */ | |
2449 | - strcpy((((char *)base) + 0xFFD9),eisa_ident); | |
2450 | + strcpy(base + 0x0FFD9, "PCI_ISA"); | |
2451 | /* write system model id for IBM-AT */ | |
2452 | - *(((unsigned char *)base) + 0xFFFE) = 0xfc; | |
2453 | + *((unsigned char *)(base + 0x0FFFE)) = 0xfc; | |
2454 | ||
2455 | return 1; | |
2456 | } | |
2457 | @@ -126,23 +123,65 @@ | |
2458 | void | |
2459 | reset_int_vect(xf86Int10InfoPtr pInt) | |
2460 | { | |
2461 | - MEM_WW(pInt,(0x10<<2),0xf065); | |
2462 | - MEM_WW(pInt,((0x10<<2)+2),(SYS_BIOS >> 4)); | |
2463 | - MEM_WW(pInt,(0x42<<2),0xf065); | |
2464 | - MEM_WW(pInt,((0x42<<2)+2),(SYS_BIOS >> 4)); | |
2465 | - MEM_WW(pInt,(0x6D<<2),0xf065); | |
2466 | - MEM_WW(pInt,((0x6D<<2)+2),(SYS_BIOS >> 4)); | |
2467 | - } | |
2468 | + /* | |
2469 | + * This table is normally located at 0xF000:0xF0A4. However, int 0x42, | |
2470 | + * function 0 (Mode Set) expects it (or a copy) somewhere in the bottom | |
2471 | + * 64kB. Note that because this data doesn't survive POST, int 0x42 should | |
2472 | + * only be used during EGA/VGA BIOS initialisation. | |
2473 | + */ | |
2474 | + static const CARD8 VideoParms[] = { | |
2475 | + /* Timing for modes 0x00 & 0x01 */ | |
2476 | + 0x38, 0x28, 0x2d, 0x0a, 0x1f, 0x06, 0x19, 0x1c, | |
2477 | + 0x02, 0x07, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, | |
2478 | + /* Timing for modes 0x02 & 0x03 */ | |
2479 | + 0x71, 0x50, 0x5a, 0x0a, 0x1f, 0x06, 0x19, 0x1c, | |
2480 | + 0x02, 0x07, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, | |
2481 | + /* Timing for modes 0x04, 0x05 & 0x06 */ | |
2482 | + 0x38, 0x28, 0x2d, 0x0a, 0x7f, 0x06, 0x64, 0x70, | |
2483 | + 0x02, 0x01, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, | |
2484 | + /* Timing for mode 0x07 */ | |
2485 | + 0x61, 0x50, 0x52, 0x0f, 0x19, 0x06, 0x19, 0x19, | |
2486 | + 0x02, 0x0d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, | |
2487 | + /* Display page lengths in little endian order */ | |
2488 | + 0x00, 0x08, /* Modes 0x00 and 0x01 */ | |
2489 | + 0x00, 0x10, /* Modes 0x02 and 0x03 */ | |
2490 | + 0x00, 0x40, /* Modes 0x04 and 0x05 */ | |
2491 | + 0x00, 0x40, /* Modes 0x06 and 0x07 */ | |
2492 | + /* Number of columns for each mode */ | |
2493 | + 40, 40, 80, 80, 40, 40, 80, 80, | |
2494 | + /* CGA Mode register value for each mode */ | |
2495 | + 0x2c, 0x28, 0x2d, 0x29, 0x2a, 0x2e, 0x1e, 0x29, | |
2496 | + /* Padding */ | |
2497 | + 0x00, 0x00, 0x00, 0x00 | |
2498 | + }; | |
2499 | + int i; | |
2500 | + | |
2501 | + for (i = 0; i < sizeof(VideoParms); i++) | |
2502 | + MEM_WB(pInt, i + (0x1000 - sizeof(VideoParms)), VideoParms[i]); | |
2503 | + MEM_WW(pInt, 0x1d << 2, 0x1000 - sizeof(VideoParms)); | |
2504 | + MEM_WW(pInt, (0x1d << 2) + 2, 0); | |
2505 | + | |
2506 | + MEM_WW(pInt, 0x10 << 2, 0xf065); | |
2507 | + MEM_WW(pInt, (0x10 << 2) + 2, SYS_BIOS >> 4); | |
2508 | + MEM_WW(pInt, 0x42 << 2, 0xf065); | |
2509 | + MEM_WW(pInt, (0x42 << 2) + 2, SYS_BIOS >> 4); | |
2510 | + MEM_WW(pInt, 0x6D << 2, 0xf065); | |
2511 | + MEM_WW(pInt, (0x6D << 2) + 2, SYS_BIOS >> 4); | |
2512 | +} | |
2513 | ||
2514 | void | |
2515 | set_return_trap(xf86Int10InfoPtr pInt) | |
2516 | -{ | |
2517 | +{ | |
2518 | /* | |
2519 | - * here we also set the exit condition: | |
2520 | - * we return when we encounter 'hlt' (^=0xf4) this | |
2521 | - * will be located at address 0x600 in x86 memory. | |
2522 | + * Here we set the exit condition: We return when we encounter | |
2523 | + * 'hlt' (=0xf4), which we locate at address 0x600 in x86 memory. | |
2524 | */ | |
2525 | - MEM_WB(pInt,0x600,0xf4); | |
2526 | + MEM_WB(pInt, 0x0600, 0xf4); | |
2527 | + | |
2528 | + /* | |
2529 | + * Allocate a segment for the stack | |
2530 | + */ | |
2531 | + xf86Int10AllocPages(pInt, 1, &pInt->stackseg); | |
2532 | } | |
2533 | ||
2534 | Bool | |
2535 | @@ -150,7 +189,7 @@ | |
2536 | { | |
2537 | Bool noint10 = FALSE; | |
2538 | EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex); | |
2539 | - | |
2540 | + | |
2541 | if (pEnt->device && pEnt->device->options) { | |
2542 | OptionInfoRec options[nINT10Options]; | |
2543 | ||
2544 | @@ -170,12 +209,12 @@ | |
2545 | int size; | |
2546 | ||
2547 | if ((codeSeg & 0x1f) || /* Not 512-byte aligned otherwise */ | |
2548 | - ((codeSeg << 4) < V_BIOS) || | |
2549 | + ((codeSeg << 4) < V_BIOS) || | |
2550 | ((codeSeg << 4) >= SYS_SIZE)) | |
2551 | - return FALSE; | |
2552 | + return FALSE; | |
2553 | ||
2554 | if (xf86IsPc98()) | |
2555 | - return FALSE; | |
2556 | + return FALSE; | |
2557 | ||
2558 | if ((*vbiosMem != 0x55) || (*(vbiosMem+1) != 0xAA) || !*(vbiosMem+2)) | |
2559 | return FALSE; | |
2560 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/pci.c | |
2561 | =================================================================== | |
2562 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/int10/pci.c,v | |
2563 | retrieving revision 1.5 | |
2564 | retrieving revision 1.6 | |
2565 | diff -u -r1.5 -r1.6 | |
2566 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/pci.c 2000/12/02 15:31:01 1.5 | |
2567 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/pci.c 2001/01/06 20:19:13 1.6 | |
2568 | @@ -1,4 +1,4 @@ | |
2569 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/pci.c,v 1.5 2000/12/02 15:31:01 tsi Exp $ */ | |
2570 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/pci.c,v 1.6 2001/01/06 20:19:13 tsi Exp $ */ | |
2571 | ||
2572 | /* | |
2573 | * XFree86 int10 module | |
2574 | @@ -7,7 +7,6 @@ | |
2575 | */ | |
2576 | #include "xf86Pci.h" | |
2577 | #include "xf86.h" | |
2578 | -#include "xf86str.h" | |
2579 | #include "xf86_ansic.h" | |
2580 | #define _INT10_PRIVATE | |
2581 | #include "xf86int10.h" | |
2582 | @@ -18,7 +17,7 @@ | |
2583 | PCITAG tag; | |
2584 | unsigned long offset = 0; | |
2585 | unsigned char *mem, *ptr; | |
2586 | - int length, rlength, blength; | |
2587 | + int length; | |
2588 | ||
2589 | pciVideoPtr pvp = xf86GetPciInfoForEntity(pInt->entityIndex); | |
2590 | ||
2591 | @@ -30,25 +29,18 @@ | |
2592 | } | |
2593 | ||
2594 | tag = pciTag(pvp->bus,pvp->device,pvp->func); | |
2595 | - rlength = blength = 1 << pvp->biosSize; | |
2596 | + length = 1 << pvp->biosSize; | |
2597 | ||
2598 | - /* Read in entire PCI ROM in 64kB chunks */ | |
2599 | - mem = ptr = xnfcalloc(blength, 1); | |
2600 | - while ((length = rlength) > 0) { | |
2601 | - if (length > 0x10000) length = 0x10000; | |
2602 | - if (xf86ReadPciBIOS(offset, tag, -1, ptr, length) < length) { | |
2603 | - xfree(mem); | |
2604 | + /* Read in entire PCI ROM */ | |
2605 | + mem = ptr = xnfcalloc(length, 1); | |
2606 | + if (xf86ReadPciBIOS(offset, tag, -1, ptr, length) < length) { | |
2607 | + xfree(mem); | |
2608 | #ifdef DEBUG | |
2609 | - ErrorF("mapPciRom: cannot read BIOS\n"); | |
2610 | + ErrorF("mapPciRom: cannot read BIOS\n"); | |
2611 | #endif | |
2612 | - return 0; | |
2613 | - } | |
2614 | - offset += length; | |
2615 | - rlength -= length; | |
2616 | - ptr += length; | |
2617 | + return 0; | |
2618 | } | |
2619 | ||
2620 | - ptr = mem; | |
2621 | while ((ptr[0] == 0x55) && (ptr[1] == 0xAA)) { | |
2622 | unsigned short data_off = ptr[0x18] | (ptr[0x19] << 8); | |
2623 | unsigned char *data = ptr + data_off; | |
2624 | @@ -63,10 +55,10 @@ | |
2625 | #ifdef PRINT_PCI | |
2626 | ErrorF("data segment in BIOS: 0x%x, type: 0x%x\n", data_off, type); | |
2627 | #endif | |
2628 | - if (type) { /* not PC-AT image: find next one */ | |
2629 | + if (type) { /* not PC-AT image: find next one */ | |
2630 | unsigned int image_length; | |
2631 | unsigned char indicator = data[0x15]; | |
2632 | - if (indicator & 0x80) /* last image */ | |
2633 | + if (indicator & 0x80) /* last image */ | |
2634 | break; | |
2635 | image_length = (data[0x10] | (data[0x11] << 8)) << 9; | |
2636 | #ifdef PRINT_PCI | |
2637 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86int10.c | |
2638 | =================================================================== | |
2639 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/int10/xf86int10.c,v | |
2640 | retrieving revision 1.5 | |
2641 | retrieving revision 1.6 | |
2642 | diff -u -r1.5 -r1.6 | |
2643 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86int10.c 2000/04/04 19:25:18 1.5 | |
2644 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86int10.c 2001/01/06 20:19:13 1.6 | |
2645 | @@ -1,4 +1,4 @@ | |
2646 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.c,v 1.5 2000/04/04 19:25:18 dawes Exp $ */ | |
2647 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.c,v 1.6 2001/01/06 20:19:13 tsi Exp $ */ | |
2648 | /* | |
2649 | * XFree86 int10 module | |
2650 | * execute BIOS int 10h calls in x86 real mode environment | |
2651 | @@ -6,7 +6,6 @@ | |
2652 | */ | |
2653 | ||
2654 | #include "xf86.h" | |
2655 | -#include "xf86str.h" | |
2656 | #include "xf86_ansic.h" | |
2657 | #include "compiler.h" | |
2658 | #include "xf86Pci.h" | |
2659 | @@ -14,10 +13,14 @@ | |
2660 | #include "xf86int10.h" | |
2661 | #include "int10Defines.h" | |
2662 | ||
2663 | +#define REG pInt | |
2664 | + | |
2665 | xf86Int10InfoPtr Int10Current = NULL; | |
2666 | ||
2667 | static int int1A_handler(xf86Int10InfoPtr pInt); | |
2668 | +#ifndef _PC | |
2669 | static int int42_handler(xf86Int10InfoPtr pInt); | |
2670 | +#endif | |
2671 | static int intE6_handler(xf86Int10InfoPtr pInt); | |
2672 | static PCITAG findPci(unsigned short bx); | |
2673 | static CARD32 pciSlotBX(pciVideoPtr pvp); | |
2674 | @@ -26,88 +29,557 @@ | |
2675 | int_handler(xf86Int10InfoPtr pInt) | |
2676 | { | |
2677 | int num = pInt->num; | |
2678 | + int ret = 0; | |
2679 | ||
2680 | switch (num) { | |
2681 | +#ifndef _PC | |
2682 | case 0x10: | |
2683 | case 0x42: | |
2684 | - if (!(int42_handler(pInt))) | |
2685 | - goto bios_handler; | |
2686 | - else return 1; | |
2687 | + case 0x6D: | |
2688 | + if (getIntVect(pInt, num) == I_S_DEFAULT_INT_VECT) | |
2689 | + ret = int42_handler(pInt); | |
2690 | + break; | |
2691 | +#endif | |
2692 | case 0x1A: | |
2693 | - if(!(int1A_handler(pInt))) | |
2694 | - goto bios_handler; | |
2695 | - else return 1; | |
2696 | + ret = int1A_handler(pInt); | |
2697 | + break; | |
2698 | case 0xe6: | |
2699 | - if (!(intE6_handler(pInt))) | |
2700 | - goto bios_handler; | |
2701 | - else return 1; | |
2702 | + ret = intE6_handler(pInt); | |
2703 | + break; | |
2704 | default: | |
2705 | - goto bios_handler; | |
2706 | + break; | |
2707 | } | |
2708 | - bios_handler: | |
2709 | - return run_bios_int(num,pInt); | |
2710 | + | |
2711 | + if (!ret) | |
2712 | + ret = run_bios_int(num, pInt); | |
2713 | + | |
2714 | + if (!ret) { | |
2715 | + xf86DrvMsg(pInt->scrnIndex, X_ERROR, | |
2716 | + "Halting on int 0x%2.2x!\n", num); | |
2717 | + dump_registers(pInt); | |
2718 | + stack_trace(pInt); | |
2719 | + } | |
2720 | + | |
2721 | + return ret; | |
2722 | } | |
2723 | ||
2724 | +#ifndef _PC | |
2725 | /* | |
2726 | - * The system-BIOS provides int10 ax=1200 and ax=1201 functions | |
2727 | - * before the video bios is installed. The int10_handler below | |
2728 | - * provides these functions, too. However there have been cases | |
2729 | - * in which disabling generic video has caused problems. Therefore | |
2730 | - * it has been disabled by default. To reenable it do: | |
2731 | - * #define DO_GENERIC_INT10 | |
2732 | + * This is derived from a number of PC system BIOS'es. The intent here is to | |
2733 | + * provide very primitive video support, before an EGA/VGA BIOS installs its | |
2734 | + * own interrupt vector. Here, "Ignored" calls should remain so. "Not | |
2735 | + * Implemented" denotes functionality that can be implemented should the need | |
2736 | + * arise. What are "Not Implemented" throughout are video memory accesses. | |
2737 | + * Also, very little input validity checking is done here. | |
2738 | */ | |
2739 | static int | |
2740 | int42_handler(xf86Int10InfoPtr pInt) | |
2741 | { | |
2742 | -#define REG pInt | |
2743 | -#ifdef DO_GENERIC_INT10 | |
2744 | - unsigned char c; | |
2745 | -#endif | |
2746 | - int num = pInt->num; | |
2747 | -#ifdef PRINT_INT | |
2748 | - ErrorF("int 0x%x: ax:0x%x bx:0x%x cx:0x%x dx:0x%x\n",num, | |
2749 | - X86_EAX,X86_EBX,X86_ECX,X86_EDX); | |
2750 | -#endif | |
2751 | - /* | |
2752 | - * video bios has modified these - | |
2753 | - * leave it to the video bios to do this | |
2754 | - */ | |
2755 | + switch (X86_AH) { | |
2756 | + case 0x00: | |
2757 | + /* Set Video Mode */ | |
2758 | + /* Enter: AL = video mode number */ | |
2759 | + /* Leave: Nothing */ | |
2760 | + /* Implemented (except for clearing the screen) */ | |
2761 | + { /* Localise */ | |
2762 | + int i; | |
2763 | + CARD16 ioport, int1d, regvals, tmp; | |
2764 | + CARD8 mode, cgamode, cgacolour; | |
2765 | + | |
2766 | + /* | |
2767 | + * Ignore all mode numbers but 0x00-0x13. Some systems also ignore | |
2768 | + * 0x0B and 0x0C, but don't do that here. | |
2769 | + */ | |
2770 | + if (X86_AL > 0x13) | |
2771 | + break; | |
2772 | + | |
2773 | + /* | |
2774 | + * You didn't think that was really the mode set, did you? There | |
2775 | + * are only so many slots in the video parameter table... | |
2776 | + */ | |
2777 | + mode = X86_AL; | |
2778 | + ioport = 0x03D4; | |
2779 | + switch (MEM_RB(pInt, 0x0410) & 0x30) { | |
2780 | + case 0x30: /* MDA */ | |
2781 | + mode = 0x07; /* Force mode to 0x07 */ | |
2782 | + ioport = 0x03B4; | |
2783 | + break; | |
2784 | + case 0x10: /* CGA 40x25 */ | |
2785 | + if (mode >= 0x07) | |
2786 | + mode = 0x01; | |
2787 | + break; | |
2788 | + case 0x20: /* CGA 80x25 (MCGA?) */ | |
2789 | + if (mode >= 0x07) | |
2790 | + mode = 0x03; | |
2791 | + break; | |
2792 | + case 0x00: /* EGA/VGA */ | |
2793 | + if (mode >= 0x07) /* Don't try MDA timings */ | |
2794 | + mode = 0x01; /* !?!?! */ | |
2795 | + break; | |
2796 | + } | |
2797 | + | |
2798 | + /* Locate data in video parameter table */ | |
2799 | + int1d = MEM_RW(pInt, 0x1d << 2); | |
2800 | + regvals = ((mode >> 1) << 4) + int1d; | |
2801 | + cgacolour = 0x30; | |
2802 | + if (mode == 0x06) { | |
2803 | + regvals -= 0x10; | |
2804 | + cgacolour = 0x3F; | |
2805 | + } | |
2806 | + | |
2807 | + /** Update BIOS Data Area **/ | |
2808 | + | |
2809 | + /* Video mode */ | |
2810 | + MEM_WB(pInt, 0x0449, mode); | |
2811 | + | |
2812 | + /* Columns */ | |
2813 | + tmp = MEM_RB(pInt, mode + int1d + 0x48); | |
2814 | + MEM_WW(pInt, 0x044A, tmp); | |
2815 | + | |
2816 | + /* Page length */ | |
2817 | + tmp = MEM_RW(pInt, (mode & 0x06) + int1d + 0x40); | |
2818 | + MEM_WW(pInt, 0x044C, tmp); | |
2819 | + | |
2820 | + /* Start Address */ | |
2821 | + MEM_WW(pInt, 0x044E, 0); | |
2822 | + | |
2823 | + /* Cursor positions, one for each display page */ | |
2824 | + for (i = 0x0450; i < 0x0460; i += 2) | |
2825 | + MEM_WW(pInt, i, 0); | |
2826 | + | |
2827 | + /* Cursor start & end scanlines */ | |
2828 | + tmp = MEM_RB(pInt, regvals + 0x0B); | |
2829 | + MEM_WB(pInt, 0x0460, tmp); | |
2830 | + tmp = MEM_RB(pInt, regvals + 0x0A); | |
2831 | + MEM_WB(pInt, 0x0461, tmp); | |
2832 | + | |
2833 | + /* Current display page number */ | |
2834 | + MEM_WB(pInt, 0x0462, 0); | |
2835 | + | |
2836 | + /* CRTC I/O address */ | |
2837 | + MEM_WW(pInt, 0x0463, ioport); | |
2838 | + | |
2839 | + /* CGA Mode register value */ | |
2840 | + cgamode = MEM_RB(pInt, mode + int1d + 0x50); | |
2841 | + MEM_WB(pInt, 0x0465, cgamode); | |
2842 | + | |
2843 | + /* CGA Colour register value */ | |
2844 | + MEM_WB(pInt, 0x0466, cgacolour); | |
2845 | + | |
2846 | + /* Rows */ | |
2847 | + MEM_WB(pInt, 0x0484, (25 - 1)); | |
2848 | + | |
2849 | + /* Programme the mode */ | |
2850 | + outb(ioport + 4, cgamode & 0x37); /* Turn off screen */ | |
2851 | + for (i = 0; i < 0x10; i++) { | |
2852 | + tmp = MEM_RB(pInt, regvals + i); | |
2853 | + outb(ioport, i); | |
2854 | + outb(ioport + 1, tmp); | |
2855 | + } | |
2856 | + outb(ioport + 5, cgacolour); /* Select colour mode */ | |
2857 | + outb(ioport + 4, cgamode); /* Turn on screen */ | |
2858 | + } | |
2859 | + break; | |
2860 | + | |
2861 | + case 0x01: | |
2862 | + /* Set Cursor Type */ | |
2863 | + /* Enter: CH = starting line for cursor */ | |
2864 | + /* CL = ending line for cursor */ | |
2865 | + /* Leave: Nothing */ | |
2866 | + /* Implemented */ | |
2867 | + { /* Localise */ | |
2868 | + CARD16 ioport = MEM_RW(pInt, 0x0463); | |
2869 | + | |
2870 | + MEM_WB(pInt, 0x0460, X86_CL); | |
2871 | + MEM_WB(pInt, 0x0461, X86_CH); | |
2872 | + | |
2873 | + outb(ioport, 0x0A); | |
2874 | + outb(ioport + 1, X86_CH); | |
2875 | + outb(ioport, 0x0B); | |
2876 | + outb(ioport + 1, X86_CL); | |
2877 | + } | |
2878 | + break; | |
2879 | + | |
2880 | + case 0x02: | |
2881 | + /* Set Cursor Position */ | |
2882 | + /* Enter: BH = display page number */ | |
2883 | + /* DH = row */ | |
2884 | + /* DL = column */ | |
2885 | + /* Leave: Nothing */ | |
2886 | + /* Implemented */ | |
2887 | + { /* Localise */ | |
2888 | + CARD16 offset, ioport; | |
2889 | + | |
2890 | + MEM_WB(pInt, (X86_BH << 1) + 0x0450, X86_DL); | |
2891 | + MEM_WB(pInt, (X86_BH << 1) + 0x0451, X86_DH); | |
2892 | + | |
2893 | + if (X86_BH != MEM_RB(pInt, 0x0462)) | |
2894 | + break; | |
2895 | + | |
2896 | + offset = (X86_DH * MEM_RW(pInt, 0x044A)) + X86_DL; | |
2897 | + offset += MEM_RW(pInt, 0x044E) << 1; | |
2898 | + | |
2899 | + ioport = MEM_RW(pInt, 0x0463); | |
2900 | + outb(ioport, 0x0E); | |
2901 | + outb(ioport + 1, offset >> 8); | |
2902 | + outb(ioport, 0x0F); | |
2903 | + outb(ioport + 1, offset & 0xFF); | |
2904 | + } | |
2905 | + break; | |
2906 | + | |
2907 | + case 0x03: | |
2908 | + /* Get Cursor Position */ | |
2909 | + /* Enter: BH = display page number */ | |
2910 | + /* Leave: CH = starting line for cursor */ | |
2911 | + /* CL = ending line for cursor */ | |
2912 | + /* DH = row */ | |
2913 | + /* DL = column */ | |
2914 | + /* Implemented */ | |
2915 | + { /* Localise */ | |
2916 | + X86_CL = MEM_RB(pInt, 0x0460); | |
2917 | + X86_CH = MEM_RB(pInt, 0x0461); | |
2918 | + X86_DL = MEM_RB(pInt, (X86_BH << 1) + 0x0450); | |
2919 | + X86_DH = MEM_RB(pInt, (X86_BH << 1) + 0x0451); | |
2920 | + } | |
2921 | + break; | |
2922 | + | |
2923 | + case 0x04: | |
2924 | + /* Get Light Pen Position */ | |
2925 | + /* Enter: Nothing */ | |
2926 | + /* Leave: AH = 0x01 (down/triggered) or 0x00 (not) */ | |
2927 | + /* BX = pixel column */ | |
2928 | + /* CX = pixel row */ | |
2929 | + /* DH = character row */ | |
2930 | + /* DL = character column */ | |
2931 | + /* Not Implemented */ | |
2932 | + { /* Localise */ | |
2933 | + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, | |
2934 | + "int 0x%2.2x(AH=0x04) -- Get Light Pen Position\n", pInt->num); | |
2935 | + if (xf86GetVerbosity() > 3) { | |
2936 | + dump_registers(pInt); | |
2937 | + stack_trace(pInt); | |
2938 | + } | |
2939 | + X86_AH = X86_BX = X86_CX = X86_DX = 0; | |
2940 | + } | |
2941 | + break; | |
2942 | + | |
2943 | + case 0x05: | |
2944 | + /* Set Display Page */ | |
2945 | + /* Enter: AL = display page number */ | |
2946 | + /* Leave: Nothing */ | |
2947 | + /* Implemented */ | |
2948 | + { /* Localise */ | |
2949 | + CARD16 start, ioport = MEM_RW(pInt, 0x0463); | |
2950 | + CARD8 x, y; | |
2951 | + | |
2952 | + /* Calculate new start address */ | |
2953 | + MEM_WB(pInt, 0x0462, X86_AL); | |
2954 | + start = X86_AL * MEM_RW(pInt, 0x044C); | |
2955 | + MEM_WW(pInt, 0x044E, start); | |
2956 | + start <<= 1; | |
2957 | + | |
2958 | + /* Update start address */ | |
2959 | + outb(ioport, 0x0C); | |
2960 | + outb(ioport + 1, start >> 8); | |
2961 | + outb(ioport, 0x0D); | |
2962 | + outb(ioport + 1, start & 0xFF); | |
2963 | + | |
2964 | + /* Switch cursor position */ | |
2965 | + y = MEM_RB(pInt, (X86_AL << 1) + 0x0450); | |
2966 | + x = MEM_RB(pInt, (X86_AL << 1) + 0x0451); | |
2967 | + start += (y * MEM_RW(pInt, 0x044A)) + x; | |
2968 | + | |
2969 | + /* Update cursor position */ | |
2970 | + outb(ioport, 0x0E); | |
2971 | + outb(ioport + 1, start >> 8); | |
2972 | + outb(ioport, 0x0F); | |
2973 | + outb(ioport + 1, start & 0xFF); | |
2974 | + } | |
2975 | + break; | |
2976 | + | |
2977 | + case 0x06: | |
2978 | + /* Initialise or Scroll Window Up */ | |
2979 | + /* Enter: AL = lines to scroll up */ | |
2980 | + /* BH = attribute for blank */ | |
2981 | + /* CH = upper y of window */ | |
2982 | + /* CL = left x of window */ | |
2983 | + /* DH = lower y of window */ | |
2984 | + /* DL = right x of window */ | |
2985 | + /* Leave: Nothing */ | |
2986 | + /* Not Implemented */ | |
2987 | + { /* Localise */ | |
2988 | + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, | |
2989 | + "int 0x%2.2x(AH=0x06) -- Initialise or Scroll Window Up\n", | |
2990 | + pInt->num); | |
2991 | + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, | |
2992 | + " AL=0x%2.2x, BH=0x%2.2x," | |
2993 | + " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n", | |
2994 | + X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL); | |
2995 | + if (xf86GetVerbosity() > 3) { | |
2996 | + dump_registers(pInt); | |
2997 | + stack_trace(pInt); | |
2998 | + } | |
2999 | + } | |
3000 | + break; | |
3001 | + | |
3002 | + case 0x07: | |
3003 | + /* Initialise or Scroll Window Down */ | |
3004 | + /* Enter: AL = lines to scroll down */ | |
3005 | + /* BH = attribute for blank */ | |
3006 | + /* CH = upper y of window */ | |
3007 | + /* CL = left x of window */ | |
3008 | + /* DH = lower y of window */ | |
3009 | + /* DL = right x of window */ | |
3010 | + /* Leave: Nothing */ | |
3011 | + /* Not Implemented */ | |
3012 | + { /* Localise */ | |
3013 | + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, | |
3014 | + "int 0x%2.2x(AH=0x07) -- Initialise or Scroll Window Down\n", | |
3015 | + pInt->num); | |
3016 | + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, | |
3017 | + " AL=0x%2.2x, BH=0x%2.2x," | |
3018 | + " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n", | |
3019 | + X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL); | |
3020 | + if (xf86GetVerbosity() > 3) { | |
3021 | + dump_registers(pInt); | |
3022 | + stack_trace(pInt); | |
3023 | + } | |
3024 | + } | |
3025 | + break; | |
3026 | + | |
3027 | + case 0x08: | |
3028 | + /* Read Character and Attribute at Cursor */ | |
3029 | + /* Enter: BH = display page number */ | |
3030 | + /* Leave: AH = attribute */ | |
3031 | + /* AL = character */ | |
3032 | + /* Not Implemented */ | |
3033 | + { /* Localise */ | |
3034 | + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, | |
3035 | + "int 0x%2.2x(AH=0x08) -- Read Character and Attribute at" | |
3036 | + " Cursor\n", pInt->num); | |
3037 | + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, | |
3038 | + "BH=0x%2.2x\n", X86_BH); | |
3039 | + if (xf86GetVerbosity() > 3) { | |
3040 | + dump_registers(pInt); | |
3041 | + stack_trace(pInt); | |
3042 | + } | |
3043 | + X86_AX = 0; | |
3044 | + } | |
3045 | + break; | |
3046 | + | |
3047 | + case 0x09: | |
3048 | + /* Write Character and Attribute at Cursor */ | |
3049 | + /* Enter: AL = character */ | |
3050 | + /* BH = display page number */ | |
3051 | + /* BL = attribute (text) or colour (graphics) */ | |
3052 | + /* CX = replication count */ | |
3053 | + /* Leave: Nothing */ | |
3054 | + /* Not Implemented */ | |
3055 | + { /* Localise */ | |
3056 | + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, | |
3057 | + "int 0x%2.2x(AH=0x09) -- Write Character and Attribute at" | |
3058 | + " Cursor\n", pInt->num); | |
3059 | + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, | |
3060 | + "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n", | |
3061 | + X86_AL, X86_BH, X86_BL, X86_CX); | |
3062 | + if (xf86GetVerbosity() > 3) { | |
3063 | + dump_registers(pInt); | |
3064 | + stack_trace(pInt); | |
3065 | + } | |
3066 | + } | |
3067 | + break; | |
3068 | + | |
3069 | + case 0x0a: | |
3070 | + /* Write Character at Cursor */ | |
3071 | + /* Enter: AL = character */ | |
3072 | + /* BH = display page number */ | |
3073 | + /* BL = colour */ | |
3074 | + /* CX = replication count */ | |
3075 | + /* Leave: Nothing */ | |
3076 | + /* Not Implemented */ | |
3077 | + { /* Localise */ | |
3078 | + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, | |
3079 | + "int 0x%2.2x(AH=0x0A) -- Write Character at Cursor\n", | |
3080 | + pInt->num); | |
3081 | + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, | |
3082 | + "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n", | |
3083 | + X86_AL, X86_BH, X86_BL, X86_CX); | |
3084 | + if (xf86GetVerbosity() > 3) { | |
3085 | + dump_registers(pInt); | |
3086 | + stack_trace(pInt); | |
3087 | + } | |
3088 | + } | |
3089 | + break; | |
3090 | + | |
3091 | + case 0x0b: | |
3092 | + /* Set Palette, Background or Border */ | |
3093 | + /* Enter: BH = 0x00 or 0x01 */ | |
3094 | + /* BL = colour or palette (respectively) */ | |
3095 | + /* Leave: Nothing */ | |
3096 | + /* Implemented */ | |
3097 | + { /* Localise */ | |
3098 | + CARD16 ioport = MEM_RW(pInt, 0x0463) + 5; | |
3099 | + CARD8 cgacolour = MEM_RB(pInt, 0x0466); | |
3100 | + | |
3101 | + if (X86_BH) { | |
3102 | + cgacolour &= 0xDF; | |
3103 | + cgacolour |= (X86_BL & 0x01) << 5; | |
3104 | + } else { | |
3105 | + cgacolour &= 0xE0; | |
3106 | + cgacolour |= X86_BL & 0x1F; | |
3107 | + } | |
3108 | + | |
3109 | + MEM_WB(pInt, 0x0466, cgacolour); | |
3110 | + outb(ioport, cgacolour); | |
3111 | + } | |
3112 | + break; | |
3113 | + | |
3114 | + case 0x0c: | |
3115 | + /* Write Graphics Pixel */ | |
3116 | + /* Enter: AL = pixel value */ | |
3117 | + /* BH = display page number */ | |
3118 | + /* CX = column */ | |
3119 | + /* DX = row */ | |
3120 | + /* Leave: Nothing */ | |
3121 | + /* Not Implemented */ | |
3122 | + { /* Localise */ | |
3123 | + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, | |
3124 | + "int 0x%2.2x(AH=0x0C) -- Write Graphics Pixel\n", pInt->num); | |
3125 | + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, | |
3126 | + "AL=0x%2.2x, BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n", | |
3127 | + X86_AL, X86_BH, X86_CX, X86_DX); | |
3128 | + if (xf86GetVerbosity() > 3) { | |
3129 | + dump_registers(pInt); | |
3130 | + stack_trace(pInt); | |
3131 | + } | |
3132 | + } | |
3133 | + break; | |
3134 | + | |
3135 | + case 0x0d: | |
3136 | + /* Read Graphics Pixel */ | |
3137 | + /* Enter: BH = display page number */ | |
3138 | + /* CX = column */ | |
3139 | + /* DX = row */ | |
3140 | + /* Leave: AL = pixel value */ | |
3141 | + /* Not Implemented */ | |
3142 | + { /* Localise */ | |
3143 | + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, | |
3144 | + "int 0x%2.2x(AH=0x0D) -- Read Graphics Pixel\n", pInt->num); | |
3145 | + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, | |
3146 | + "BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n", | |
3147 | + X86_BH, X86_CX, X86_DX); | |
3148 | + if (xf86GetVerbosity() > 3) { | |
3149 | + dump_registers(pInt); | |
3150 | + stack_trace(pInt); | |
3151 | + } | |
3152 | + X86_AL = 0; | |
3153 | + } | |
3154 | + break; | |
3155 | + | |
3156 | + case 0x0e: | |
3157 | + /* Write Character in Teletype Mode */ | |
3158 | + /* Enter: AL = character */ | |
3159 | + /* BH = display page number */ | |
3160 | + /* BL = foreground colour */ | |
3161 | + /* Leave: Nothing */ | |
3162 | + /* Not Implemented */ | |
3163 | + /* WARNING: Emulation of BEL characters will require */ | |
3164 | + /* emulation of RTC and PC speaker I/O. */ | |
3165 | + /* Also, this recurses through int 0x10 */ | |
3166 | + /* which might or might not have been */ | |
3167 | + /* installed yet. */ | |
3168 | + { /* Localise */ | |
3169 | + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, | |
3170 | + "int 0x%2.2x(AH=0x0E) -- Write Character in Teletype Mode\n", | |
3171 | + pInt->num); | |
3172 | + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, | |
3173 | + "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x\n", | |
3174 | + X86_AL, X86_BH, X86_BL); | |
3175 | + if (xf86GetVerbosity() > 3) { | |
3176 | + dump_registers(pInt); | |
3177 | + stack_trace(pInt); | |
3178 | + } | |
3179 | + } | |
3180 | + break; | |
3181 | + | |
3182 | + case 0x0f: | |
3183 | + /* Get Video Mode */ | |
3184 | + /* Enter: Nothing */ | |
3185 | + /* Leave: AH = number of columns */ | |
3186 | + /* AL = video mode number */ | |
3187 | + /* BH = display page number */ | |
3188 | + /* Implemented */ | |
3189 | + { /* Localise */ | |
3190 | + X86_AH = MEM_RW(pInt, 0x044A); | |
3191 | + X86_AL = MEM_RB(pInt, 0x0449); | |
3192 | + X86_BH = MEM_RB(pInt, 0x0462); | |
3193 | + } | |
3194 | + break; | |
3195 | ||
3196 | - if (getIntVect(pInt,num) != I_S_DEFAULT_INT_VECT) { | |
3197 | - return 0; | |
3198 | - } | |
3199 | - | |
3200 | - if ((X86_EBX & 0xff) == 0x32) { | |
3201 | - switch (X86_EAX & 0xFFFF) { | |
3202 | - case 0x1200: | |
3203 | -#ifdef PRINT_INT | |
3204 | - ErrorF("enabling video\n"); | |
3205 | -#endif | |
3206 | -#ifdef DO_GENERIC_INT10 | |
3207 | - c = inb(0x3cc); | |
3208 | - c |= 0x02; | |
3209 | - outb(0x3c2,c); | |
3210 | -#endif | |
3211 | - return 1; | |
3212 | - case 0x1201: | |
3213 | -#ifdef PRINT_INT | |
3214 | - ErrorF("disabling video\n"); | |
3215 | -#endif | |
3216 | -#ifdef DO_GENERIC_INT10 | |
3217 | - c = inb(0x3cc); | |
3218 | - c &= ~0x02; | |
3219 | - outb(0x3c2,c); | |
3220 | -#endif | |
3221 | - return 1; | |
3222 | - default: | |
3223 | - break; | |
3224 | + case 0x10: | |
3225 | + /* Colour Control (subfunction in AL) */ | |
3226 | + /* Enter: Various */ | |
3227 | + /* Leave: Various */ | |
3228 | + /* Ignored */ | |
3229 | + break; | |
3230 | + | |
3231 | + case 0x11: | |
3232 | + /* Font Control (subfunction in AL) */ | |
3233 | + /* Enter: Various */ | |
3234 | + /* Leave: Various */ | |
3235 | + /* Ignored */ | |
3236 | + break; | |
3237 | + | |
3238 | + case 0x12: | |
3239 | + /* Miscellaneous (subfunction in BL) */ | |
3240 | + /* Enter: Various */ | |
3241 | + /* Leave: Various */ | |
3242 | + /* Ignored. Previous code here optionally allowed */ | |
3243 | + /* the enabling and disabling of VGA, but no system */ | |
3244 | + /* BIOS I've come across actually implements it. */ | |
3245 | + break; | |
3246 | + | |
3247 | + case 0x13: | |
3248 | + /* Write String in Teletype Mode */ | |
3249 | + /* Enter: AL = write mode */ | |
3250 | + /* BL = attribute (if (AL & 0x02) == 0) */ | |
3251 | + /* CX = string length */ | |
3252 | + /* DH = row */ | |
3253 | + /* DL = column */ | |
3254 | + /* ES:BP = string segment:offset */ | |
3255 | + /* Leave: Nothing */ | |
3256 | + /* Not Implemented */ | |
3257 | + /* WARNING: Emulation of BEL characters will require */ | |
3258 | + /* emulation of RTC and PC speaker I/O. */ | |
3259 | + /* Also, this recurses through int 0x10 */ | |
3260 | + /* which might or might not have been */ | |
3261 | + /* installed yet. */ | |
3262 | + { /* Localise */ | |
3263 | + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, | |
3264 | + "int 0x%2.2x(AH=0x13) -- Write String in Teletype Mode\n", | |
3265 | + pInt->num); | |
3266 | + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, | |
3267 | + "AL=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x," | |
3268 | + " DH=0x%2.2x, DL=0x%2.2x, ES:BP=0x%4.4x:0x%4.4x\n", | |
3269 | + X86_AL, X86_BL, X86_CX, X86_DH, X86_DL, X86_ES, X86_BP); | |
3270 | + if (xf86GetVerbosity() > 3) { | |
3271 | + dump_registers(pInt); | |
3272 | + stack_trace(pInt); | |
3273 | + } | |
3274 | } | |
3275 | + break; | |
3276 | + | |
3277 | + default: | |
3278 | + /* Various extensions */ | |
3279 | + /* Enter: Various */ | |
3280 | + /* Leave: Various */ | |
3281 | + /* Ignored */ | |
3282 | + break; | |
3283 | } | |
3284 | - if (num == 0x42) | |
3285 | - return 1; | |
3286 | - else | |
3287 | - return 0; | |
3288 | + | |
3289 | + return 1; | |
3290 | } | |
3291 | +#endif | |
3292 | ||
3293 | #define SUCCESSFUL 0x00 | |
3294 | #define DEVICE_NOT_FOUND 0x86 | |
3295 | @@ -118,164 +590,159 @@ | |
3296 | { | |
3297 | PCITAG tag; | |
3298 | pciVideoPtr pvp; | |
3299 | - | |
3300 | - if (! (pvp = xf86GetPciInfoForEntity(pInt->entityIndex))) | |
3301 | + | |
3302 | + if (!(pvp = xf86GetPciInfoForEntity(pInt->entityIndex))) | |
3303 | return 0; /* oops */ | |
3304 | ||
3305 | #ifdef PRINT_INT | |
3306 | ErrorF("int 0x1a: ax=0x%x bx=0x%x cx=0x%x dx=0x%x di=0x%x es=0x%x\n", | |
3307 | - X86_EAX,X86_EBX,X86_ECX,X86_EDX,X86_EDI,X86_ESI); | |
3308 | + X86_EAX, X86_EBX, X86_ECX, X86_EDX, X86_EDI, X86_ESI); | |
3309 | #endif | |
3310 | - switch (X86_EAX & 0xFFFF) { | |
3311 | + switch (X86_AX) { | |
3312 | case 0xb101: | |
3313 | - X86_EAX &= 0xFF00; /* no config space/special cycle support */ | |
3314 | + X86_EAX &= 0xFF00; /* no config space/special cycle support */ | |
3315 | X86_EDX = 0x20494350; /* " ICP" */ | |
3316 | - X86_EBX = 0x0210; /* Version 2.10 */ | |
3317 | - X86_ECX &= 0xFF00; | |
3318 | + X86_EBX = 0x0210; /* Version 2.10 */ | |
3319 | + X86_ECX &= 0xFF00; | |
3320 | X86_ECX |= (pciNumBuses & 0xFF); /* Max bus number in system */ | |
3321 | X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ | |
3322 | #ifdef PRINT_INT | |
3323 | ErrorF("ax=0x%x dx=0x%x bx=0x%x cx=0x%x flags=0x%x\n", | |
3324 | - X86_EAX,X86_EDX,X86_EBX,X86_ECX,X86_EFLAGS); | |
3325 | + X86_EAX, X86_EDX, X86_EBX, X86_ECX, X86_EFLAGS); | |
3326 | #endif | |
3327 | return 1; | |
3328 | case 0xb102: | |
3329 | - if ((X86_EDX & 0xFFFF) == pvp->vendor && | |
3330 | - (X86_ECX & 0xFFFF) ==pvp->chipType && | |
3331 | - X86_ESI == 0) { | |
3332 | - X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8); | |
3333 | + if (X86_DX == pvp->vendor && X86_CX == pvp->chipType && X86_ESI == 0) { | |
3334 | + X86_EAX = X86_AL | (SUCCESSFUL << 8); | |
3335 | X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ | |
3336 | - X86_EBX = pciSlotBX(pvp); | |
3337 | + X86_EBX = pciSlotBX(pvp); | |
3338 | } | |
3339 | #ifdef SHOW_ALL_DEVICES | |
3340 | - else if ((pvp = xf86FindPciDeviceVendor(X86_EDX,X86_ECX,X86_ESI,pvp)) | |
3341 | - != NULL) { | |
3342 | - X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8); | |
3343 | + else | |
3344 | + if ((pvp = xf86FindPciDeviceVendor(X86_EDX, X86_ECX, X86_ESI, pvp))) { | |
3345 | + X86_EAX = X86_AL | (SUCCESSFUL << 8); | |
3346 | X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ | |
3347 | X86_EBX = pciSlotBX(pvp); | |
3348 | } | |
3349 | #endif | |
3350 | else { | |
3351 | - X86_EAX = (X86_EAX & 0x00FF) | (DEVICE_NOT_FOUND << 8); | |
3352 | + X86_EAX = X86_AL | (DEVICE_NOT_FOUND << 8); | |
3353 | X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */ | |
3354 | } | |
3355 | #ifdef PRINT_INT | |
3356 | - ErrorF("ax=0x%x bx=0x%x flags=0x%x\n", | |
3357 | - X86_EAX,X86_EBX,X86_EFLAGS); | |
3358 | + ErrorF("ax=0x%x bx=0x%x flags=0x%x\n", X86_EAX, X86_EBX, X86_EFLAGS); | |
3359 | #endif | |
3360 | return 1; | |
3361 | case 0xb103: | |
3362 | - if ((X86_ECX & 0xFF) == pvp->interface && | |
3363 | - ((X86_ECX & 0xFF00) >> 8) == pvp->subclass && | |
3364 | + if (X86_CL == pvp->interface && | |
3365 | + X86_CH == pvp->subclass && | |
3366 | ((X86_ECX & 0xFFFF0000) >> 16) == pvp->class) { | |
3367 | - X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8); | |
3368 | + X86_EAX = X86_AL | (SUCCESSFUL << 8); | |
3369 | X86_EBX = pciSlotBX(pvp); | |
3370 | X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ | |
3371 | } | |
3372 | #ifdef SHOW_ALL_DEVICES | |
3373 | - else if ((pvp = xf86FindPciClass(X86_ECX & 0xFF, | |
3374 | - (X86_ECX & 0xff00) >> 8, | |
3375 | + else if ((pvp = xf86FindPciClass(X86_CL, X86_CH, | |
3376 | (X86_ECX & 0xffff0000) >> 16, | |
3377 | - X86_ESI,pvp))!= NULL) { | |
3378 | - X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8); | |
3379 | + X86_ESI, pvp))) { | |
3380 | + X86_EAX = X86_AL | (SUCCESSFUL << 8); | |
3381 | X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ | |
3382 | X86_EBX = pciSlotBX(pvp); | |
3383 | } | |
3384 | #endif | |
3385 | else { | |
3386 | - X86_EAX = (X86_EAX & 0x00FF) | (DEVICE_NOT_FOUND << 8); | |
3387 | + X86_EAX = X86_AL | (DEVICE_NOT_FOUND << 8); | |
3388 | X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */ | |
3389 | } | |
3390 | #ifdef PRINT_INT | |
3391 | - ErrorF("ax=0x%x flags=0x%x\n",X86_EAX,X86_EFLAGS); | |
3392 | + ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS); | |
3393 | #endif | |
3394 | return 1; | |
3395 | case 0xb108: | |
3396 | if ((tag = findPci(X86_EBX))) { | |
3397 | - X86_ECX &= 0xFFFFFF00; | |
3398 | - X86_ECX |= pciReadByte(tag,X86_EDI); | |
3399 | - X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8); | |
3400 | + X86_CL = pciReadByte(tag, X86_EDI); | |
3401 | + X86_EAX = X86_AL | (SUCCESSFUL << 8); | |
3402 | X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ | |
3403 | } else { | |
3404 | - X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8); | |
3405 | + X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8); | |
3406 | X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */ | |
3407 | } | |
3408 | #ifdef PRINT_INT | |
3409 | - ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", | |
3410 | - X86_EAX,X86_ECX,X86_EFLAGS); | |
3411 | + ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS); | |
3412 | #endif | |
3413 | return 1; | |
3414 | case 0xb109: | |
3415 | if ((tag = findPci(X86_EBX))) { | |
3416 | - X86_ECX &= 0xFFFF0000; | |
3417 | - X86_ECX |= pciReadWord(tag,X86_EDI); | |
3418 | - X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8); | |
3419 | + X86_CX = pciReadWord(tag, X86_EDI); | |
3420 | + X86_EAX = X86_AL | (SUCCESSFUL << 8); | |
3421 | X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ | |
3422 | } else { | |
3423 | - X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8); | |
3424 | + X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8); | |
3425 | X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */ | |
3426 | } | |
3427 | #ifdef PRINT_INT | |
3428 | - ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", | |
3429 | - X86_EAX,X86_ECX,X86_EFLAGS); | |
3430 | + ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS); | |
3431 | #endif | |
3432 | return 1; | |
3433 | case 0xb10a: | |
3434 | if ((tag = findPci(X86_EBX))) { | |
3435 | - X86_ECX &= 0; | |
3436 | - X86_ECX |= pciReadLong(tag, X86_EDI); | |
3437 | - X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8); | |
3438 | + X86_ECX = pciReadLong(tag, X86_EDI); | |
3439 | + X86_EAX = X86_AL | (SUCCESSFUL << 8); | |
3440 | X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ | |
3441 | } else { | |
3442 | - X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8); | |
3443 | + X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8); | |
3444 | X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */ | |
3445 | } | |
3446 | #ifdef PRINT_INT | |
3447 | - ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", | |
3448 | - X86_EAX,X86_ECX,X86_EFLAGS); | |
3449 | + ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS); | |
3450 | #endif | |
3451 | return 1; | |
3452 | case 0xb10b: | |
3453 | if ((tag = findPci(X86_EBX))) { | |
3454 | - pciWriteByte(tag,X86_EDI,(CARD8)X86_ECX); | |
3455 | - X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8); | |
3456 | + pciWriteByte(tag, X86_EDI, X86_CL); | |
3457 | + X86_EAX = X86_AL | (SUCCESSFUL << 8); | |
3458 | X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ | |
3459 | } else { | |
3460 | - X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8); | |
3461 | + X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8); | |
3462 | X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */ | |
3463 | } | |
3464 | #ifdef PRINT_INT | |
3465 | - ErrorF("ax=0x%x flags=0x%x\n", X86_EAX,X86_EFLAGS); | |
3466 | + ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS); | |
3467 | #endif | |
3468 | return 1; | |
3469 | case 0xb10c: | |
3470 | if ((tag = findPci(X86_EBX))) { | |
3471 | - pciWriteWord(tag,X86_EDI,(CARD16)X86_ECX); | |
3472 | - X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8); | |
3473 | + pciWriteWord(tag, X86_EDI, X86_CX); | |
3474 | + X86_EAX = X86_AL | (SUCCESSFUL << 8); | |
3475 | X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ | |
3476 | } else { | |
3477 | - X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8); | |
3478 | + X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8); | |
3479 | X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */ | |
3480 | } | |
3481 | #ifdef PRINT_INT | |
3482 | - ErrorF("ax=0x%x flags=0x%x\n", X86_EAX,X86_EFLAGS); | |
3483 | + ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS); | |
3484 | #endif | |
3485 | return 1; | |
3486 | case 0xb10d: | |
3487 | if ((tag = findPci(X86_EBX))) { | |
3488 | - pciWriteLong(tag,X86_EDI,(CARD32)X86_ECX); | |
3489 | - X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8); | |
3490 | + pciWriteLong(tag, X86_EDI, X86_ECX); | |
3491 | + X86_EAX = X86_AL | (SUCCESSFUL << 8); | |
3492 | X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ | |
3493 | } else { | |
3494 | - X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8); | |
3495 | + X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8); | |
3496 | X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */ | |
3497 | } | |
3498 | #ifdef PRINT_INT | |
3499 | - ErrorF("ax=0x%x flags=0x%x\n", X86_EAX,X86_EFLAGS); | |
3500 | + ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS); | |
3501 | #endif | |
3502 | return 1; | |
3503 | default: | |
3504 | - return 0; | |
3505 | + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, | |
3506 | + "int 0x1a subfunction\n"); | |
3507 | + dump_registers(pInt); | |
3508 | + if (xf86GetVerbosity() > 3) | |
3509 | + stack_trace(pInt); | |
3510 | + return 1; | |
3511 | } | |
3512 | } | |
3513 | ||
3514 | @@ -285,15 +752,15 @@ | |
3515 | int bus = (bx >> 8) & 0xFF; | |
3516 | int dev = (bx >> 3) & 0x1F; | |
3517 | int func = bx & 0x7; | |
3518 | - if (xf86IsPciDevPresent(bus,dev,func)) | |
3519 | - return pciTag(bus,dev,func); | |
3520 | + if (xf86IsPciDevPresent(bus, dev, func)) | |
3521 | + return pciTag(bus, dev, func); | |
3522 | return 0; | |
3523 | } | |
3524 | ||
3525 | static CARD32 | |
3526 | pciSlotBX(pciVideoPtr pvp) | |
3527 | { | |
3528 | - return ((pvp->bus << 8) | (pvp->device << 3) | (pvp->func)); | |
3529 | + return (pvp->bus << 8) | (pvp->device << 3) | (pvp->func); | |
3530 | } | |
3531 | ||
3532 | /* | |
3533 | @@ -304,12 +771,10 @@ | |
3534 | { | |
3535 | pciVideoPtr pvp; | |
3536 | ||
3537 | - if ((pvp = xf86GetPciInfoForEntity(pInt->entityIndex))) { | |
3538 | - X86_AX = (CARD16)(((pvp->bus) << 8) | |
3539 | - | (pvp->device << 3) | (pvp->func & 0x7)); | |
3540 | - } | |
3541 | - pushw(pInt,X86_CS); | |
3542 | - pushw(pInt,(CARD16)X86_EIP); | |
3543 | + if ((pvp = xf86GetPciInfoForEntity(pInt->entityIndex))) | |
3544 | + X86_AX = (pvp->bus << 8) | (pvp->device << 3) | (pvp->func & 0x7); | |
3545 | + pushw(pInt, X86_CS); | |
3546 | + pushw(pInt, X86_IP); | |
3547 | X86_CS = pInt->BIOSseg; | |
3548 | X86_EIP = 0x0003; | |
3549 | X86_ES = 0; /* standard pc es */ | |
3550 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86int10.h | |
3551 | =================================================================== | |
3552 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/int10/xf86int10.h,v | |
3553 | retrieving revision 1.15 | |
3554 | retrieving revision 1.16 | |
3555 | diff -u -r1.15 -r1.16 | |
3556 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86int10.h 2000/12/06 18:08:55 1.15 | |
3557 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86int10.h 2001/01/06 20:19:13 1.16 | |
3558 | @@ -1,4 +1,4 @@ | |
3559 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.h,v 1.15 2000/12/06 18:08:55 eich Exp $ */ | |
3560 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.h,v 1.16 2001/01/06 20:19:13 tsi Exp $ */ | |
3561 | ||
3562 | /* | |
3563 | * XFree86 int10 module | |
3564 | @@ -12,11 +12,11 @@ | |
3565 | #include "Xmd.h" | |
3566 | #include "Xdefs.h" | |
3567 | ||
3568 | -#define SEG_ADDR(x) ((x>>4) & 0xF000) | |
3569 | -#define SEG_OFF(x) (x & 0xFFFF) | |
3570 | +#define SEG_ADDR(x) (((x) >> 4) & 0x00F000) | |
3571 | +#define SEG_OFF(x) ((x) & 0x0FFFF) | |
3572 | ||
3573 | /* int10 info structure */ | |
3574 | -typedef struct { | |
3575 | +typedef struct { | |
3576 | int entityIndex; | |
3577 | int scrnIndex; | |
3578 | pointer cpuRegs; | |
3579 | @@ -33,15 +33,16 @@ | |
3580 | int es; | |
3581 | int bp; | |
3582 | int flags; | |
3583 | - } xf86Int10InfoRec, *xf86Int10InfoPtr; | |
3584 | + int stackseg; | |
3585 | +} xf86Int10InfoRec, *xf86Int10InfoPtr; | |
3586 | ||
3587 | typedef struct _int10Mem { | |
3588 | - CARD8(*rb)(xf86Int10InfoPtr,int); | |
3589 | - CARD16(*rw)(xf86Int10InfoPtr,int); | |
3590 | - CARD32(*rl)(xf86Int10InfoPtr,int); | |
3591 | - void(*wb)(xf86Int10InfoPtr,int,CARD8); | |
3592 | - void(*ww)(xf86Int10InfoPtr,int,CARD16); | |
3593 | - void(*wl)(xf86Int10InfoPtr,int,CARD32); | |
3594 | + CARD8(*rb)(xf86Int10InfoPtr, int); | |
3595 | + CARD16(*rw)(xf86Int10InfoPtr, int); | |
3596 | + CARD32(*rl)(xf86Int10InfoPtr, int); | |
3597 | + void(*wb)(xf86Int10InfoPtr, int, CARD8); | |
3598 | + void(*ww)(xf86Int10InfoPtr, int, CARD16); | |
3599 | + void(*wl)(xf86Int10InfoPtr, int, CARD32); | |
3600 | } int10MemRec, *int10MemPtr; | |
3601 | ||
3602 | typedef struct { | |
3603 | @@ -54,7 +55,7 @@ | |
3604 | /* OS dependent functions */ | |
3605 | xf86Int10InfoPtr xf86InitInt10(int entityIndex); | |
3606 | void xf86FreeInt10(xf86Int10InfoPtr pInt); | |
3607 | -void * xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off); | |
3608 | +void *xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off); | |
3609 | void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num); | |
3610 | pointer xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr); | |
3611 | ||
3612 | @@ -78,23 +79,25 @@ | |
3613 | #define V_BIOS 0xC0000 | |
3614 | #define HIGH_MEM V_BIOS | |
3615 | #define HIGH_MEM_SIZE (SYS_BIOS - HIGH_MEM) | |
3616 | +#define SEG_ADR(type, seg, reg) type((seg << 4) + (X86_##reg)) | |
3617 | +#define SEG_EADR(type, seg, reg) type((seg << 4) + (X86_E##reg)) | |
3618 | ||
3619 | #define X86_TF_MASK 0x00000100 | |
3620 | #define X86_IF_MASK 0x00000200 | |
3621 | -#define X86_IOPL_MASK 0x00003000 | |
3622 | +#define X86_IOPL_MASK 0x00003000 | |
3623 | #define X86_NT_MASK 0x00004000 | |
3624 | #define X86_VM_MASK 0x00020000 | |
3625 | #define X86_AC_MASK 0x00040000 | |
3626 | -#define X86_VIF_MASK 0x00080000 /* virtual interrupt flag */ | |
3627 | -#define X86_VIP_MASK 0x00100000 /* virtual interrupt pending */ | |
3628 | +#define X86_VIF_MASK 0x00080000 /* virtual interrupt flag */ | |
3629 | +#define X86_VIP_MASK 0x00100000 /* virtual interrupt pending */ | |
3630 | #define X86_ID_MASK 0x00200000 | |
3631 | ||
3632 | -#define MEM_RB(name,addr) name->mem->rb(name,addr) | |
3633 | -#define MEM_RW(name,addr) name->mem->rw(name,addr) | |
3634 | -#define MEM_RL(name,addr) name->mem->rl(name,addr) | |
3635 | -#define MEM_WB(name,addr,val) name->mem->wb(name,addr,val) | |
3636 | -#define MEM_WW(name,addr,val) name->mem->ww(name,addr,val) | |
3637 | -#define MEM_WL(name,addr,val) name->mem->wl(name,addr,val) | |
3638 | +#define MEM_RB(name, addr) (*name->mem->rb)(name, addr) | |
3639 | +#define MEM_RW(name, addr) (*name->mem->rw)(name, addr) | |
3640 | +#define MEM_RL(name, addr) (*name->mem->rl)(name, addr) | |
3641 | +#define MEM_WB(name, addr, val) (*name->mem->wb)(name, addr, val) | |
3642 | +#define MEM_WW(name, addr, val) (*name->mem->ww)(name, addr, val) | |
3643 | +#define MEM_WL(name, addr, val) (*name->mem->wl)(name, addr, val) | |
3644 | ||
3645 | /* OS dependent functions */ | |
3646 | void MapCurrentInt10(xf86Int10InfoPtr pInt); | |
3647 | @@ -108,8 +111,7 @@ | |
3648 | /* helper_exec.c */ | |
3649 | int setup_int(xf86Int10InfoPtr pInt); | |
3650 | void finish_int(xf86Int10InfoPtr, int sig); | |
3651 | -CARD32 getIntVect(xf86Int10InfoPtr pInt,int num); | |
3652 | -int vm86_GP_fault(xf86Int10InfoPtr pInt); | |
3653 | +CARD32 getIntVect(xf86Int10InfoPtr pInt, int num); | |
3654 | void pushw(xf86Int10InfoPtr pInt, CARD16 val); | |
3655 | int run_bios_int(int num, xf86Int10InfoPtr pInt); | |
3656 | void dump_code(xf86Int10InfoPtr pInt); | |
3657 | @@ -117,7 +119,7 @@ | |
3658 | void stack_trace(xf86Int10InfoPtr pInt); | |
3659 | xf86Int10InfoPtr getInt10Rec(int entityIndex); | |
3660 | CARD8 bios_checksum(CARD8 *start, int size); | |
3661 | -void LockLegacyVGA(int screenIndex,legacyVGAPtr vga); | |
3662 | +void LockLegacyVGA(int screenIndex, legacyVGAPtr vga); | |
3663 | void UnlockLegacyVGA(int screenIndex, legacyVGAPtr vga); | |
3664 | int port_rep_inb(xf86Int10InfoPtr pInt, | |
3665 | CARD16 port, CARD32 base, int d_f, CARD32 count); | |
3666 | @@ -139,30 +141,12 @@ | |
3667 | CARD32 x_inl(CARD16 port); | |
3668 | void x_outl(CARD16 port, CARD32 val); | |
3669 | ||
3670 | -#ifndef _INT10_NO_INOUT_MACROS | |
3671 | -#if defined(PRINT_PORT) || (!defined(_PC) && !defined(_PC_IO)) | |
3672 | -# define p_inb x_inb | |
3673 | -# define p_inw x_inw | |
3674 | -# define p_outb x_outb | |
3675 | -# define p_outw x_outw | |
3676 | -# define p_inl x_inl | |
3677 | -# define p_outl x_outl | |
3678 | -#else | |
3679 | -# define p_inb inb | |
3680 | -# define p_inw inw | |
3681 | -# define p_outb outb | |
3682 | -# define p_outw outw | |
3683 | -# define p_inl inl | |
3684 | -# define p_outl outl | |
3685 | -#endif | |
3686 | -#endif | |
3687 | - | |
3688 | CARD8 Mem_rb(int addr); | |
3689 | CARD16 Mem_rw(int addr); | |
3690 | CARD32 Mem_rl(int addr); | |
3691 | -void Mem_wb(int addr,CARD8 val); | |
3692 | -void Mem_ww(int addr,CARD16 val); | |
3693 | -void Mem_wl(int addr,CARD32 val); | |
3694 | +void Mem_wb(int addr, CARD8 val); | |
3695 | +void Mem_ww(int addr, CARD16 val); | |
3696 | +void Mem_wl(int addr, CARD32 val); | |
3697 | ||
3698 | /* helper_mem.c */ | |
3699 | void setup_int_vect(xf86Int10InfoPtr pInt); | |
3700 | @@ -177,9 +161,7 @@ | |
3701 | #endif | |
3702 | ||
3703 | /* pci.c */ | |
3704 | -int mapPciRom(xf86Int10InfoPtr pInt, unsigned char * address); | |
3705 | +int mapPciRom(xf86Int10InfoPtr pInt, unsigned char *address); | |
3706 | ||
3707 | #endif /* _INT10_PRIVATE */ | |
3708 | #endif /* _XF86INT10_H */ | |
3709 | - | |
3710 | - | |
3711 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c | |
3712 | =================================================================== | |
3713 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c,v | |
3714 | retrieving revision 1.9 | |
3715 | retrieving revision 1.10 | |
3716 | diff -u -r1.9 -r1.10 | |
3717 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c 2000/12/06 15:35:26 1.9 | |
3718 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c 2001/01/06 20:19:13 1.10 | |
3719 | @@ -1,4 +1,4 @@ | |
3720 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c,v 1.9 2000/12/06 15:35:26 eich Exp $ */ | |
3721 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c,v 1.10 2001/01/06 20:19:13 tsi Exp $ */ | |
3722 | /* | |
3723 | * XFree86 int10 module | |
3724 | * execute BIOS int 10h calls in x86 real mode environment | |
3725 | @@ -6,128 +6,65 @@ | |
3726 | */ | |
3727 | #include <x86emu.h> | |
3728 | #include "xf86.h" | |
3729 | -#include "xf86str.h" | |
3730 | #include "xf86_ansic.h" | |
3731 | #include "compiler.h" | |
3732 | #include "xf86_OSproc.h" | |
3733 | #include "xf86Pci.h" | |
3734 | #include "xf86_libc.h" | |
3735 | #define _INT10_PRIVATE | |
3736 | -#define _INT10_NO_INOUT_MACROS | |
3737 | #include "xf86int10.h" | |
3738 | #include "int10Defines.h" | |
3739 | ||
3740 | -#define M _X86EMU_env | |
3741 | +#define M _X86EMU_env | |
3742 | ||
3743 | -#if defined(PRINT_PORT) || (!defined(_PC) && !defined(_PC_IO)) | |
3744 | -# define p_inb x_inb | |
3745 | -# define p_inw x_inw | |
3746 | -# define p_outb x_outb | |
3747 | -# define p_outw x_outw | |
3748 | -# define p_inl x_inl | |
3749 | -# define p_outl x_outl | |
3750 | -#else | |
3751 | -# define p_inb f_inb | |
3752 | -# define p_inw f_inw | |
3753 | -# define p_outb f_outb | |
3754 | -# define p_outw f_outw | |
3755 | -# define p_inl f_inl | |
3756 | -# define p_outl f_outl | |
3757 | -#endif | |
3758 | - | |
3759 | -/* | |
3760 | - * inb/outb, etc are not available as functions (compler.h) on all | |
3761 | - * platforms (eg SVR4.0 with cc). This provides versions that are guaranteed | |
3762 | - * to be functions. | |
3763 | - */ | |
3764 | - | |
3765 | -static CARD8 | |
3766 | -f_inb(CARD16 port) | |
3767 | -{ | |
3768 | - return inb(port); | |
3769 | -} | |
3770 | - | |
3771 | -static CARD16 | |
3772 | -f_inw(CARD16 port) | |
3773 | -{ | |
3774 | - return inw(port); | |
3775 | -} | |
3776 | - | |
3777 | -static CARD32 | |
3778 | -f_inl(CARD16 port) | |
3779 | -{ | |
3780 | - return inl(port); | |
3781 | -} | |
3782 | - | |
3783 | -static void | |
3784 | -f_outb(CARD16 port, CARD8 val) | |
3785 | -{ | |
3786 | - outb(port, val); | |
3787 | -} | |
3788 | - | |
3789 | -static void | |
3790 | -f_outw(CARD16 port, CARD16 val) | |
3791 | -{ | |
3792 | - outw(port,val); | |
3793 | -} | |
3794 | - | |
3795 | -static void | |
3796 | -f_outl(CARD16 port, CARD32 val) | |
3797 | -{ | |
3798 | - outl(port,val); | |
3799 | -} | |
3800 | - | |
3801 | static void | |
3802 | x86emu_do_int(int num) | |
3803 | { | |
3804 | Int10Current->num = num; | |
3805 | ||
3806 | if (!int_handler(Int10Current)) { | |
3807 | - xf86DrvMsg(Int10Current->scrnIndex, | |
3808 | - X_ERROR,"\nUnknown vm86_int: %X\n\n",num); | |
3809 | X86EMU_halt_sys(); | |
3810 | } | |
3811 | - return; | |
3812 | } | |
3813 | - | |
3814 | + | |
3815 | void | |
3816 | xf86ExecX86int10(xf86Int10InfoPtr pInt) | |
3817 | { | |
3818 | int sig = setup_int(pInt); | |
3819 | ||
3820 | if (int_handler(pInt)) { | |
3821 | - X86EMU_exec(); | |
3822 | + X86EMU_exec(); | |
3823 | } | |
3824 | - | |
3825 | + | |
3826 | finish_int(pInt, sig); | |
3827 | } | |
3828 | - | |
3829 | + | |
3830 | Bool | |
3831 | xf86Int10ExecSetup(xf86Int10InfoPtr pInt) | |
3832 | { | |
3833 | int i; | |
3834 | X86EMU_intrFuncs intFuncs[256]; | |
3835 | X86EMU_pioFuncs pioFuncs = { | |
3836 | - (u8(*)(u16))p_inb, | |
3837 | - (u16(*)(u16))p_inw, | |
3838 | - (u32(*)(u16))p_inl, | |
3839 | - (void(*)(u16,u8))p_outb, | |
3840 | - (void(*)(u16,u16))p_outw, | |
3841 | - (void(*)(u16,u32))p_outl | |
3842 | + (u8(*)(u16))x_inb, | |
3843 | + (u16(*)(u16))x_inw, | |
3844 | + (u32(*)(u16))x_inl, | |
3845 | + (void(*)(u16, u8))x_outb, | |
3846 | + (void(*)(u16, u16))x_outw, | |
3847 | + (void(*)(u16, u32))x_outl | |
3848 | }; | |
3849 | - | |
3850 | + | |
3851 | X86EMU_memFuncs memFuncs = { | |
3852 | (u8(*)(u32))Mem_rb, | |
3853 | (u16(*)(u32))Mem_rw, | |
3854 | (u32(*)(u32))Mem_rl, | |
3855 | - (void(*)(u32,u8))Mem_wb, | |
3856 | - (void(*)(u32,u16))Mem_ww, | |
3857 | - (void(*)(u32,u32))Mem_wl | |
3858 | + (void(*)(u32, u8))Mem_wb, | |
3859 | + (void(*)(u32, u16))Mem_ww, | |
3860 | + (void(*)(u32, u32))Mem_wl | |
3861 | }; | |
3862 | ||
3863 | X86EMU_setupMemFuncs(&memFuncs); | |
3864 | - | |
3865 | - pInt->cpuRegs = &M; | |
3866 | + | |
3867 | + pInt->cpuRegs = &M; | |
3868 | M.mem_base = 0; | |
3869 | M.mem_size = 1024*1024 + 1024; | |
3870 | X86EMU_setupPioFuncs(&pioFuncs); | |
3871 | @@ -146,5 +83,3 @@ | |
3872 | VErrorF(fmt, argptr); | |
3873 | va_end(argptr); | |
3874 | } | |
3875 | - | |
3876 | - | |
3877 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.h | |
3878 | =================================================================== | |
3879 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.h,v | |
3880 | retrieving revision 1.1 | |
3881 | retrieving revision 1.2 | |
3882 | diff -u -r1.1 -r1.2 | |
3883 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.h 2000/01/23 04:44:35 1.1 | |
3884 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.h 2001/01/06 20:19:13 1.2 | |
3885 | @@ -1,4 +1,4 @@ | |
3886 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.h,v 1.1 2000/01/23 04:44:35 dawes Exp $ */ | |
3887 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.h,v 1.2 2001/01/06 20:19:13 tsi Exp $ */ | |
3888 | /* | |
3889 | * XFree86 int10 module | |
3890 | * execute BIOS int 10h calls in x86 real mode environment | |
3891 | @@ -8,7 +8,7 @@ | |
3892 | #define XF86X86EMU_H_ | |
3893 | #include <x86emu.h> | |
3894 | ||
3895 | -#define M _X86EMU_env | |
3896 | +#define M _X86EMU_env | |
3897 | ||
3898 | #define X86_EAX M.x86.R_EAX | |
3899 | #define X86_EBX M.x86.R_EBX | |
3900 | @@ -37,10 +37,15 @@ | |
3901 | #define X86_SS M.x86.R_SS | |
3902 | #define X86_FS M.x86.R_FS | |
3903 | #define X86_GS M.x86.R_GS | |
3904 | - | |
3905 | + | |
3906 | #define X86_AL M.x86.R_AL | |
3907 | #define X86_BL M.x86.R_BL | |
3908 | #define X86_CL M.x86.R_CL | |
3909 | #define X86_DL M.x86.R_DL | |
3910 | + | |
3911 | +#define X86_AH M.x86.R_AH | |
3912 | +#define X86_BH M.x86.R_BH | |
3913 | +#define X86_CH M.x86.R_CH | |
3914 | +#define X86_DH M.x86.R_DH | |
3915 | ||
3916 | #endif | |
3917 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/loader/elf.h | |
3918 | =================================================================== | |
3919 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/loader/elf.h,v | |
3920 | retrieving revision 1.9 | |
3921 | retrieving revision 1.10 | |
3922 | diff -u -r1.9 -r1.10 | |
3923 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/loader/elf.h 2000/09/07 19:06:52 1.9 | |
3924 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/loader/elf.h 2001/01/06 20:19:13 1.10 | |
3925 | @@ -1,11 +1,11 @@ | |
3926 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elf.h,v 1.9 2000/09/07 19:06:52 anderson Exp $ */ | |
3927 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elf.h,v 1.10 2001/01/06 20:19:13 tsi Exp $ */ | |
3928 | ||
3929 | ||
3930 | -typedef unsigned long Elf32_Addr; | |
3931 | +typedef unsigned int Elf32_Addr; | |
3932 | typedef unsigned short Elf32_Half; | |
3933 | -typedef unsigned long Elf32_Off; | |
3934 | +typedef unsigned int Elf32_Off; | |
3935 | typedef long Elf32_Sword; | |
3936 | -typedef unsigned long Elf32_Word; | |
3937 | +typedef unsigned int Elf32_Word; | |
3938 | ||
3939 | typedef unsigned long Elf64_Addr; | |
3940 | typedef unsigned short Elf64_Half; | |
3941 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/loader/elfloader.c | |
3942 | =================================================================== | |
3943 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/loader/elfloader.c,v | |
3944 | retrieving revision 1.31 | |
3945 | retrieving revision 1.32 | |
3946 | diff -u -r1.31 -r1.32 | |
3947 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/loader/elfloader.c 2000/12/13 16:52:01 1.31 | |
3948 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/loader/elfloader.c 2001/01/06 20:19:14 1.32 | |
3949 | @@ -1,4 +1,4 @@ | |
3950 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elfloader.c,v 1.31 2000/12/13 16:52:01 tsi Exp $ */ | |
3951 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elfloader.c,v 1.32 2001/01/06 20:19:14 tsi Exp $ */ | |
3952 | ||
3953 | /* | |
3954 | * | |
3955 | @@ -61,7 +61,11 @@ | |
3956 | #endif | |
3957 | #endif | |
3958 | ||
3959 | -#if defined (__alpha__) || defined (__ia64__) || (defined (__sparc__) && (defined (__arch64__) || defined (__sparcv9))) | |
3960 | +#if defined (__alpha__) || \ | |
3961 | + defined (__ia64__) || \ | |
3962 | + (defined (__sparc__) && \ | |
3963 | + (defined (__arch64__) || \ | |
3964 | + defined (__sparcv9))) | |
3965 | typedef Elf64_Ehdr Elf_Ehdr; | |
3966 | typedef Elf64_Shdr Elf_Shdr; | |
3967 | typedef Elf64_Sym Elf_Sym; | |
3968 | @@ -135,6 +139,16 @@ | |
3969 | #define ELF_R_TYPE ELF32_R_TYPE | |
3970 | #endif | |
3971 | ||
3972 | +#if defined(__powerpc__) || \ | |
3973 | + defined(__mc68000__) || \ | |
3974 | + defined(__alpha__) || \ | |
3975 | + defined(__sparc__) || \ | |
3976 | + defined(__ia64__) | |
3977 | +typedef Elf_Rela Elf_Rel_t; | |
3978 | +#else | |
3979 | +typedef Elf_Rel Elf_Rel_t; | |
3980 | +#endif | |
3981 | + | |
3982 | /* | |
3983 | * This structure contains all of the information about a module | |
3984 | * that has been loaded. | |
3985 | @@ -222,12 +236,7 @@ | |
3986 | * to try later after more modules have been loaded. | |
3987 | */ | |
3988 | typedef struct _elf_reloc { | |
3989 | -#if defined(i386) | |
3990 | - Elf_Rel *rel; | |
3991 | -#endif | |
3992 | -#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__ia64__) | |
3993 | - Elf_Rela *rel; | |
3994 | -#endif | |
3995 | + Elf_Rel_t *rel; | |
3996 | ELFModulePtr file; | |
3997 | unsigned char *secp; | |
3998 | struct _elf_reloc *next; | |
3999 | @@ -251,33 +260,25 @@ | |
4000 | static char *ElfGetStringIndex(ELFModulePtr, int, int); | |
4001 | static char *ElfGetString(ELFModulePtr, int); | |
4002 | static char *ElfGetSectionName(ELFModulePtr, int); | |
4003 | -#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__ia64__) | |
4004 | -static ELFRelocPtr ElfDelayRelocation(ELFModulePtr, unsigned char *, Elf_Rela *); | |
4005 | -#else | |
4006 | -static ELFRelocPtr ElfDelayRelocation(ELFModulePtr, unsigned char *, Elf_Rel *); | |
4007 | -#endif | |
4008 | +static ELFRelocPtr ElfDelayRelocation(ELFModulePtr, unsigned char *, Elf_Rel_t *); | |
4009 | static ELFCommonPtr ElfAddCOMMON(Elf_Sym *); | |
4010 | static int ElfCOMMONSize(void); | |
4011 | static int ElfCreateCOMMON(ELFModulePtr,LOOKUP *); | |
4012 | static char *ElfGetSymbolNameIndex(ELFModulePtr, int, int); | |
4013 | static char *ElfGetSymbolName(ELFModulePtr, int); | |
4014 | static Elf_Addr ElfGetSymbolValue(ELFModulePtr, int); | |
4015 | -#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__ia64__) | |
4016 | -static ELFRelocPtr Elf_RelocateEntry(ELFModulePtr, unsigned char *, Elf_Rela *, int); | |
4017 | -#else | |
4018 | -static ELFRelocPtr Elf_RelocateEntry(ELFModulePtr, unsigned char *, Elf_Rel *, int); | |
4019 | -#endif | |
4020 | +static ELFRelocPtr Elf_RelocateEntry(ELFModulePtr, unsigned char *, Elf_Rel_t *, int); | |
4021 | static ELFRelocPtr ELFCollectRelocations(ELFModulePtr, int); | |
4022 | static LOOKUP *ELF_GetSymbols(ELFModulePtr, unsigned short **); | |
4023 | static void ELFCollectSections(ELFModulePtr, int, int *, int *); | |
4024 | #if defined(__alpha__) || defined(__ia64__) | |
4025 | -static void ElfAddGOT(ELFModulePtr, Elf_Rela *); | |
4026 | +static void ElfAddGOT(ELFModulePtr, Elf_Rel_t *); | |
4027 | static int ELFCreateGOT(ELFModulePtr, int); | |
4028 | #endif | |
4029 | #if defined(__ia64__) | |
4030 | static void ElfAddOPD(ELFModulePtr, int, LOOKUP *); | |
4031 | static void ELFCreateOPD(ELFModulePtr); | |
4032 | -static void ElfAddPLT(ELFModulePtr, Elf_Rela *); | |
4033 | +static void ElfAddPLT(ELFModulePtr, Elf_Rel_t *); | |
4034 | static void ELFCreatePLT(ELFModulePtr); | |
4035 | enum ia64_operand { | |
4036 | IA64_OPND_IMM22, | |
4037 | @@ -343,12 +344,7 @@ | |
4038 | ElfDelayRelocation(elffile,secp,rel) | |
4039 | ELFModulePtr elffile; | |
4040 | unsigned char *secp; | |
4041 | -#if defined(i386) | |
4042 | -Elf_Rel *rel; | |
4043 | -#endif | |
4044 | -#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__ia64__) | |
4045 | -Elf_Rela *rel; | |
4046 | -#endif | |
4047 | +Elf_Rel_t *rel; | |
4048 | { | |
4049 | ELFRelocPtr reloc; | |
4050 | ||
4051 | @@ -361,11 +357,17 @@ | |
4052 | reloc->rel=rel; | |
4053 | reloc->next=0; | |
4054 | #ifdef ELFDEBUG | |
4055 | - ELFDEBUG("ElfDelayRelocation %lx: file %lx, sec %lx, r_offset 0x%x, r_info 0x%x", reloc, elffile, secp, rel->r_offset, rel->r_info); | |
4056 | -#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__ia64__) | |
4057 | - ELFDEBUG(", r_addend 0x%x", rel->r_addend); | |
4058 | + ELFDEBUG("ElfDelayRelocation %lx: file %lx, sec %lx," | |
4059 | + " r_offset 0x%lx, r_info 0x%x", | |
4060 | + reloc, elffile, secp, rel->r_offset, rel->r_info); | |
4061 | +#if defined(__powerpc__) || \ | |
4062 | + defined(__mc68000__) || \ | |
4063 | + defined(__alpha__) || \ | |
4064 | + defined(__sparc__) || \ | |
4065 | + defined(__ia64__) | |
4066 | + ELFDEBUG(", r_addend 0x%lx", rel->r_addend); | |
4067 | #endif | |
4068 | - ELFDEBUG("\n" ); | |
4069 | + ELFDEBUG("\n"); | |
4070 | #endif | |
4071 | return reloc; | |
4072 | } | |
4073 | @@ -396,7 +398,11 @@ | |
4074 | ||
4075 | for (common = listCOMMON; common; common = common->next) { | |
4076 | size+=common->sym->st_size; | |
4077 | -#if defined(__alpha__) || defined(__ia64__) || (defined(__sparc__) && (defined(__arch64__) || defined(__sparcv9))) | |
4078 | +#if defined(__alpha__) || \ | |
4079 | + defined(__ia64__) || \ | |
4080 | + (defined(__sparc__) && \ | |
4081 | + (defined(__arch64__) || \ | |
4082 | + defined(__sparcv9))) | |
4083 | size = (size+7)&~0x7; | |
4084 | #endif | |
4085 | } | |
4086 | @@ -417,7 +423,11 @@ | |
4087 | ||
4088 | for (common = listCOMMON; common; common = common->next) { | |
4089 | size+=common->sym->st_size; | |
4090 | -#if defined(__alpha__) || defined(__ia64__) || (defined(__sparc__) && (defined(__arch64__) || defined(__sparcv9))) | |
4091 | +#if defined(__alpha__) || \ | |
4092 | + defined(__ia64__) || \ | |
4093 | + (defined(__sparc__) && \ | |
4094 | + (defined(__arch64__) || \ | |
4095 | + defined(__sparcv9))) | |
4096 | size = (size+7)&~0x7; | |
4097 | #endif | |
4098 | numsyms++; | |
4099 | @@ -453,10 +463,12 @@ | |
4100 | /* this is xstrdup because is should be more efficient. it is freed | |
4101 | * with xf86loaderfree | |
4102 | */ | |
4103 | - pLookup[l].symName = xf86loaderstrdup(ElfGetString(elffile,common->sym->st_name)); | |
4104 | + pLookup[l].symName = | |
4105 | + xf86loaderstrdup(ElfGetString(elffile,common->sym->st_name)); | |
4106 | pLookup[l].offset = (funcptr)(elffile->common + offset); | |
4107 | #ifdef ELFDEBUG | |
4108 | - ELFDEBUG("Adding common %lx %s\n", pLookup[l].offset, pLookup[l].symName ); | |
4109 | + ELFDEBUG("Adding common %lx %s\n", | |
4110 | + pLookup[l].offset, pLookup[l].symName); | |
4111 | #endif | |
4112 | ||
4113 | /* Record the symbol address for gdb */ | |
4114 | @@ -468,7 +480,11 @@ | |
4115 | } | |
4116 | listCOMMON=common->next; | |
4117 | offset+=common->sym->st_size; | |
4118 | -#if defined(__alpha__) || defined(__ia64__) || (defined(__sparc__) && (defined(__arch64__) || defined(__sparcv9))) | |
4119 | +#if defined(__alpha__) || \ | |
4120 | + defined(__ia64__) || \ | |
4121 | + (defined(__sparc__) && \ | |
4122 | + (defined(__arch64__) || \ | |
4123 | + defined(__sparcv9))) | |
4124 | offset = (offset+7)&~0x7; | |
4125 | #endif | |
4126 | xf86loaderfree(common); | |
4127 | @@ -549,18 +565,7 @@ | |
4128 | ELFModulePtr elffile; | |
4129 | int index; | |
4130 | { | |
4131 | - char *name,*symname; | |
4132 | - symname=ElfGetSymbolNameIndex( elffile, index, elffile->symndx ); | |
4133 | - if( symname == NULL ) | |
4134 | - return NULL; | |
4135 | - | |
4136 | - name=xf86loadermalloc(strlen(symname)+1); | |
4137 | - if (!name) | |
4138 | - FatalError("ELFGetSymbolName: Out of memory\n"); | |
4139 | - | |
4140 | - strcpy(name,symname); | |
4141 | - | |
4142 | - return name; | |
4143 | + return ElfGetSymbolNameIndex(elffile, index, elffile->symndx); | |
4144 | } | |
4145 | ||
4146 | static Elf_Addr | |
4147 | @@ -619,7 +624,7 @@ | |
4148 | break; | |
4149 | } | |
4150 | #ifdef ELFDEBUG | |
4151 | - ELFDEBUG( "%x\t", symbol ); | |
4152 | + ELFDEBUG( "%lx\t", symbol ); | |
4153 | ELFDEBUG( "%lx\t", symval ); | |
4154 | ELFDEBUG( "%s\n", symname ? symname : "NULL"); | |
4155 | #endif | |
4156 | @@ -711,8 +716,8 @@ | |
4157 | break; | |
4158 | } | |
4159 | #ifdef ELFDEBUG | |
4160 | - ELFDEBUG( "ElfGetPlt: symbol=%x\t", symbol ); | |
4161 | - ELFDEBUG( "newval=%x\t", symval ); | |
4162 | + ELFDEBUG( "ElfGetPlt: symbol=%lx\t", symbol ); | |
4163 | + ELFDEBUG( "newval=%lx\t", symval ); | |
4164 | ELFDEBUG( "name=\"%s\"\n", symname ? symname : "NULL"); | |
4165 | #endif | |
4166 | break; | |
4167 | @@ -738,20 +743,18 @@ | |
4168 | static void | |
4169 | ElfAddGOT(elffile,rel) | |
4170 | ELFModulePtr elffile; | |
4171 | -Elf_Rela *rel; | |
4172 | +Elf_Rel_t *rel; | |
4173 | { | |
4174 | ELFGotEntryPtr gotent; | |
4175 | ||
4176 | #ifdef ELFDEBUG | |
4177 | { | |
4178 | Elf_Sym *sym; | |
4179 | - char *namestr; | |
4180 | ||
4181 | sym=(Elf_Sym *)&(elffile->symtab[ELF_R_SYM(rel->r_info)]); | |
4182 | if( sym->st_name) { | |
4183 | ELFDEBUG("ElfAddGOT: Adding GOT entry for %s\n", | |
4184 | - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4185 | - xf86loaderfree(namestr); | |
4186 | + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4187 | } | |
4188 | else | |
4189 | ELFDEBUG("ElfAddGOT: Adding GOT entry for %s\n", | |
4190 | @@ -799,9 +802,7 @@ | |
4191 | int gotsize; | |
4192 | #ifdef ELFDEBUG | |
4193 | ELFDEBUG( "ELFCreateGOT: %x entries in the GOT\n", elffile->gotsize/8 ); | |
4194 | -#endif | |
4195 | ||
4196 | -#ifdef ELFDEBUG | |
4197 | /* | |
4198 | * Hmmm. Someone is getting here without any got entries, but they | |
4199 | * may still have R_ALPHA_GPDISP relocations against the got. | |
4200 | @@ -836,7 +837,8 @@ | |
4201 | gots->freeptr = gots->freeptr + elffile->gotsize; | |
4202 | gots->nuses++; | |
4203 | #ifdef ELFDEBUG | |
4204 | - ELFDEBUG( "ELFCreateGOT: GOT address %lx in shared GOT, nuses %d\n", elffile->got, gots->nuses ); | |
4205 | + ELFDEBUG( "ELFCreateGOT: GOT address %lx in shared GOT, nuses %d\n", | |
4206 | + elffile->got, gots->nuses ); | |
4207 | #endif | |
4208 | return TRUE; | |
4209 | } | |
4210 | @@ -930,22 +932,18 @@ | |
4211 | ELFCreateOPD(elffile) | |
4212 | ELFModulePtr elffile; | |
4213 | { | |
4214 | - ELFOpdPtr opdent, last = NULL; | |
4215 | + ELFOpdPtr opdent; | |
4216 | ||
4217 | if (elffile->got == NULL) | |
4218 | ErrorF( "ELFCreateOPD() Unallocated GOT!!!!\n" ); | |
4219 | ||
4220 | - for (opdent = elffile->opd_entries; opdent; last = opdent, opdent = opdent->next) { | |
4221 | - if (last && last->index == -1) | |
4222 | - xf86loaderfree(last); | |
4223 | + for (opdent = elffile->opd_entries; opdent; opdent = opdent->next) { | |
4224 | if (opdent->index != -1) | |
4225 | continue; | |
4226 | ((unsigned long *)(elffile->got+opdent->offset))[0] = (long)opdent->l->offset; | |
4227 | ((unsigned long *)(elffile->got+opdent->offset))[1] = (long)elffile->got; | |
4228 | opdent->l->offset = (funcptr)(elffile->got+opdent->offset); | |
4229 | } | |
4230 | - if (last && last->index == -1) | |
4231 | - xf86loaderfree(last); | |
4232 | } | |
4233 | ||
4234 | /* | |
4235 | @@ -954,20 +952,18 @@ | |
4236 | static void | |
4237 | ElfAddPLT(elffile,rel) | |
4238 | ELFModulePtr elffile; | |
4239 | -Elf_Rela *rel; | |
4240 | +Elf_Rel_t *rel; | |
4241 | { | |
4242 | ELFPltEntryPtr pltent; | |
4243 | ||
4244 | #ifdef ELFDEBUG | |
4245 | { | |
4246 | Elf_Sym *sym; | |
4247 | - char *namestr; | |
4248 | ||
4249 | sym=(Elf_Sym *)&(elffile->symtab[ELF_R_SYM(rel->r_info)]); | |
4250 | if( sym->st_name) { | |
4251 | ELFDEBUG("ElfAddPLT: Adding PLT entry for %s\n", | |
4252 | - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4253 | - xf86loaderfree(namestr); | |
4254 | + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4255 | } | |
4256 | else | |
4257 | ErrorF("ElfAddPLT: Add PLT entry for section??\n"); | |
4258 | @@ -1046,7 +1042,7 @@ | |
4259 | case 0: data = *data128; break; | |
4260 | case 1: memcpy(&data, (char *)data128 + 5, 8); break; | |
4261 | case 2: memcpy(&data, (char *)data128 + 10, 6); break; | |
4262 | - default: FatalError("Unexpected slot in nIA64InstallReloc()\n"); | |
4263 | + default: FatalError("Unexpected slot in IA64InstallReloc()\n"); | |
4264 | } | |
4265 | switch (opnd) { | |
4266 | case IA64_OPND_IMM22: | |
4267 | @@ -1072,7 +1068,7 @@ | |
4268 | case 0: *data128 = data; break; | |
4269 | case 1: memcpy((char *)data128 + 5, &data, 8); break; | |
4270 | case 2: memcpy((char *)data128 + 10, &data, 6); break; | |
4271 | - default: FatalError("Unexpected slot in nIA64InstallReloc()\n"); | |
4272 | + default: FatalError("Unexpected slot in IA64InstallReloc()\n"); | |
4273 | } | |
4274 | #ifdef ELFDEBUG | |
4275 | ELFDEBUG( "After [%016lx%016lx]\n", data128[1], data128[0]); | |
4276 | @@ -1091,12 +1087,7 @@ | |
4277 | Elf_RelocateEntry(elffile, secp, rel, force) | |
4278 | ELFModulePtr elffile; | |
4279 | unsigned char *secp; /* Begining of the target section */ | |
4280 | -#if defined(i386) | |
4281 | -Elf_Rel *rel; | |
4282 | -#endif | |
4283 | -#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__ia64__) | |
4284 | -Elf_Rela *rel; | |
4285 | -#endif | |
4286 | +Elf_Rel_t *rel; | |
4287 | int force; | |
4288 | { | |
4289 | unsigned int *dest32; /* address of the 32 bit place being modified */ | |
4290 | @@ -1109,11 +1100,7 @@ | |
4291 | #if defined(__alpha__) | |
4292 | unsigned int *dest32h; /* address of the high 32 bit place being modified */ | |
4293 | unsigned long *dest64; | |
4294 | -#if 0 /* XXX unused */ | |
4295 | - unsigned long *gp=(unsigned long *)elffile->got+0x8000; /* | |
4296 | - * location of the got table */ | |
4297 | #endif | |
4298 | -#endif | |
4299 | #if defined(__ia64__) | |
4300 | unsigned long *dest64; | |
4301 | unsigned long *dest128; | |
4302 | @@ -1121,16 +1108,17 @@ | |
4303 | Elf_Addr symval = 0; /* value of the indicated symbol */ | |
4304 | ||
4305 | #ifdef ELFDEBUG | |
4306 | -#if defined(i386) | |
4307 | ELFDEBUG( "%lx %d %d\n", rel->r_offset, | |
4308 | - ELF_R_SYM(rel->r_info),ELF_R_TYPE(rel->r_info) ); | |
4309 | + ELF_R_SYM(rel->r_info), ELF_R_TYPE(rel->r_info) ); | |
4310 | +#if defined(__powerpc__) || \ | |
4311 | + defined(__mc68000__) || \ | |
4312 | + defined(__alpha__) || \ | |
4313 | + defined(__sparc__) || \ | |
4314 | + defined(__ia64__) | |
4315 | + ELFDEBUG( "%lx", rel->r_addend ); | |
4316 | #endif | |
4317 | -#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__ia64__) | |
4318 | - ELFDEBUG( "%x %d %d %x\n", rel->r_offset, | |
4319 | - ELF_R_SYM(rel->r_info),ELF_R_TYPE(rel->r_info), | |
4320 | - rel->r_addend ); | |
4321 | + ELFDEBUG("\n"); | |
4322 | #endif | |
4323 | -#endif | |
4324 | #if defined(__alpha__) | |
4325 | if (ELF_R_SYM(rel->r_info) && ELF_R_TYPE(rel->r_info) != R_ALPHA_GPDISP) { | |
4326 | #else | |
4327 | @@ -1142,10 +1130,8 @@ | |
4328 | symval = (Elf_Addr) &LoaderDefaultFunc; | |
4329 | } else { | |
4330 | #ifdef ELFDEBUG | |
4331 | - char *namestr; | |
4332 | - namestr = ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)); | |
4333 | - ELFDEBUG("***Unable to resolve symbol %s\n", namestr); | |
4334 | - xf86loaderfree(namestr); | |
4335 | + ELFDEBUG("***Unable to resolve symbol %s\n", | |
4336 | + ElfGetSymbolName(elffile, ELF_R_SYM(rel->r_info))); | |
4337 | #endif | |
4338 | return ElfDelayRelocation(elffile,secp,rel); | |
4339 | } | |
4340 | @@ -1170,16 +1156,12 @@ | |
4341 | case R_386_PC32: | |
4342 | dest32=(unsigned int *)(secp+rel->r_offset); | |
4343 | #ifdef ELFDEBUG | |
4344 | - { | |
4345 | - char *namestr; | |
4346 | ELFDEBUG( "R_386_PC32 %s\t", | |
4347 | - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4348 | - xf86loaderfree(namestr); | |
4349 | + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4350 | ELFDEBUG( "secp=%x\t", secp ); | |
4351 | ELFDEBUG( "symval=%lx\t", symval ); | |
4352 | ELFDEBUG( "dest32=%x\t", dest32 ); | |
4353 | ELFDEBUG( "*dest32=%8.8lx\t", *dest32 ); | |
4354 | - } | |
4355 | #endif | |
4356 | ||
4357 | *dest32=symval+(*dest32)-(Elf_Addr)dest32; /* S + A - P */ | |
4358 | @@ -1188,7 +1170,7 @@ | |
4359 | ELFDEBUG( "*dest32=%8.8lx\n", *dest32 ); | |
4360 | #endif | |
4361 | ||
4362 | - break; | |
4363 | + break; | |
4364 | #endif /* i386 */ | |
4365 | #if defined(__alpha__) | |
4366 | case R_ALPHA_NONE: | |
4367 | @@ -1216,16 +1198,12 @@ | |
4368 | dest32=(unsigned int *)dest64; | |
4369 | ||
4370 | #ifdef ELFDEBUG | |
4371 | - { | |
4372 | - char *namestr; | |
4373 | ELFDEBUG( "R_ALPHA_GPREL32 %s\t", | |
4374 | - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4375 | - xf86loaderfree(namestr); | |
4376 | + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4377 | ELFDEBUG( "secp=%lx\t", secp ); | |
4378 | ELFDEBUG( "symval=%lx\t", symval ); | |
4379 | ELFDEBUG( "dest32=%lx\t", dest32 ); | |
4380 | ELFDEBUG( "*dest32=%8.8x\t", *dest32 ); | |
4381 | - } | |
4382 | #endif | |
4383 | symval += rel->r_addend; | |
4384 | symval = ((unsigned char *)symval)-((unsigned char *)elffile->got); | |
4385 | @@ -1249,16 +1227,12 @@ | |
4386 | ELFGotEntryPtr gotent; | |
4387 | dest32=(unsigned int *)(secp+rel->r_offset); | |
4388 | #ifdef ELFDEBUG | |
4389 | - { | |
4390 | - char *namestr; | |
4391 | ELFDEBUG( "R_ALPHA_LITERAL %s\t", | |
4392 | - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4393 | - xf86loaderfree(namestr); | |
4394 | + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4395 | ELFDEBUG( "secp=%lx\t", secp ); | |
4396 | ELFDEBUG( "symval=%lx\t", symval ); | |
4397 | ELFDEBUG( "dest32=%lx\t", dest32 ); | |
4398 | ELFDEBUG( "*dest32=%8.8x\t", *dest32 ); | |
4399 | - } | |
4400 | #endif | |
4401 | ||
4402 | for (gotent=elffile->got_entries;gotent;gotent=gotent->next) { | |
4403 | @@ -1311,11 +1285,8 @@ | |
4404 | dest32=(unsigned int *)((secp+rel->r_offset)+rel->r_addend); | |
4405 | ||
4406 | #ifdef ELFDEBUG | |
4407 | - { | |
4408 | - char *namestr; | |
4409 | ELFDEBUG( "R_ALPHA_GPDISP %s\t", | |
4410 | - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4411 | - xf86loaderfree(namestr); | |
4412 | + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4413 | ELFDEBUG( "secp=%lx\t", secp ); | |
4414 | ELFDEBUG( "got=%lx\t", elffile->got ); | |
4415 | ELFDEBUG( "gp=%lx\t", gp ); | |
4416 | @@ -1323,13 +1294,10 @@ | |
4417 | ELFDEBUG( "*dest32=%8.8x\t", *dest32 ); | |
4418 | ELFDEBUG( "dest32h=%lx\t", dest32h ); | |
4419 | ELFDEBUG( "*dest32h=%8.8x\t", *dest32h ); | |
4420 | - } | |
4421 | #endif | |
4422 | if ((*dest32h >> 26) != 9 || (*dest32 >> 26) != 8) { | |
4423 | - char *namestr; | |
4424 | ErrorF( "***Bad instructions in relocating %s\n", | |
4425 | - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4426 | - xf86loaderfree(namestr); | |
4427 | + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4428 | } | |
4429 | ||
4430 | symval = (*dest32h & 0xffff) << 16 | (*dest32 & 0xffff); | |
4431 | @@ -1362,16 +1330,12 @@ | |
4432 | case R_ALPHA_HINT: | |
4433 | dest32=(unsigned int *)((secp+rel->r_offset)+rel->r_addend); | |
4434 | #ifdef ELFDEBUG | |
4435 | - { | |
4436 | - char *namestr; | |
4437 | ELFDEBUG( "R_ALPHA_HINT %s\t", | |
4438 | - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4439 | - xf86loaderfree(namestr); | |
4440 | + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4441 | ELFDEBUG( "secp=%lx\t", secp ); | |
4442 | ELFDEBUG( "symval=%lx\t", symval ); | |
4443 | ELFDEBUG( "dest32=%lx\t", dest32 ); | |
4444 | ELFDEBUG( "*dest32=%8.8x\t", *dest32 ); | |
4445 | - } | |
4446 | #endif | |
4447 | ||
4448 | #ifdef ELFDEBUG | |
4449 | @@ -1405,32 +1369,30 @@ | |
4450 | case R_68K_32: | |
4451 | dest32=(unsigned long *)(secp+rel->r_offset); | |
4452 | #ifdef ELFDEBUG | |
4453 | -ELFDEBUG( "R_68K_32\t", dest32 ); | |
4454 | -ELFDEBUG( "dest32=%x\t", dest32 ); | |
4455 | -ELFDEBUG( "*dest32=%8.8x\t", *dest32 ); | |
4456 | + ELFDEBUG( "R_68K_32\t", dest32 ); | |
4457 | + ELFDEBUG( "dest32=%x\t", dest32 ); | |
4458 | + ELFDEBUG( "*dest32=%8.8x\t", *dest32 ); | |
4459 | #endif | |
4460 | *dest32=symval+(*dest32); /* S + A */ | |
4461 | #ifdef ELFDEBUG | |
4462 | -ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); | |
4463 | + ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); | |
4464 | #endif | |
4465 | break; | |
4466 | case R_68K_PC32: | |
4467 | dest32=(unsigned long *)(secp+rel->r_offset); | |
4468 | #ifdef ELFDEBUG | |
4469 | -char *namestr; | |
4470 | -ELFDEBUG( "R_68K_PC32 %s\t", | |
4471 | - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4472 | -xf86loaderfree(namestr); | |
4473 | -ELFDEBUG( "secp=%x\t", secp ); | |
4474 | -ELFDEBUG( "symval=%x\t", symval ); | |
4475 | -ELFDEBUG( "dest32=%x\t", dest32 ); | |
4476 | -ELFDEBUG( "*dest32=%8.8x\t", *dest32 ); | |
4477 | + ELFDEBUG( "R_68K_PC32 %s\t", | |
4478 | + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4479 | + ELFDEBUG( "secp=%x\t", secp ); | |
4480 | + ELFDEBUG( "symval=%x\t", symval ); | |
4481 | + ELFDEBUG( "dest32=%x\t", dest32 ); | |
4482 | + ELFDEBUG( "*dest32=%8.8x\t", *dest32 ); | |
4483 | #endif | |
4484 | ||
4485 | *dest32=symval+(*dest32)-(Elf_Addr)dest32; /* S + A - P */ | |
4486 | ||
4487 | #ifdef ELFDEBUG | |
4488 | -ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); | |
4489 | + ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); | |
4490 | #endif | |
4491 | ||
4492 | break; | |
4493 | @@ -1900,7 +1862,8 @@ | |
4494 | if (rel->r_addend) | |
4495 | FatalError("\nAddend for R_IA64_LTOFF_FPTR22 not supported\n"); | |
4496 | #ifdef ELFDEBUG | |
4497 | - ELFDEBUG( "opd=%016lx.%016lx\n", ((long *)symval)[0], ((long *)symval)[1] ); | |
4498 | + ELFDEBUG( "opd=%016lx.%016lx\n", | |
4499 | + ((long *)symval)[0], ((long *)symval)[1] ); | |
4500 | #endif | |
4501 | /* FALLTHROUGH */ | |
4502 | case R_IA64_LTOFF22: | |
4503 | @@ -1908,18 +1871,14 @@ | |
4504 | ELFGotEntryPtr gotent; | |
4505 | dest128=(unsigned long *)(secp+(rel->r_offset&~3)); | |
4506 | #ifdef ELFDEBUG | |
4507 | - { | |
4508 | - char *namestr; | |
4509 | ELFDEBUG( "%s %s\t", ELF_R_TYPE(rel->r_info) == R_IA64_LTOFF22 ? | |
4510 | "R_IA64_LTOFF22" : "R_IA64_LTOFF_FPTR22", | |
4511 | - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4512 | - xf86loaderfree(namestr); | |
4513 | + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4514 | ELFDEBUG( "secp=%lx\t", secp ); | |
4515 | ELFDEBUG( "symval=%lx\t", symval ); | |
4516 | ELFDEBUG( "dest128=%lx\t", dest128 ); | |
4517 | - ELFDEBUG( "slot=%ld\t", rel->r_offset & 3); | |
4518 | - ELFDEBUG( "*dest128=[%016lx%016lx]\t", dest128[1], dest128[0]); | |
4519 | - } | |
4520 | + ELFDEBUG( "slot=%d\n", rel->r_offset & 3); | |
4521 | + ELFDEBUG( "*dest128=[%016lx%016lx]\n", dest128[1], dest128[0]); | |
4522 | #endif | |
4523 | ||
4524 | for (gotent=elffile->got_entries;gotent;gotent=gotent->next) { | |
4525 | @@ -1933,7 +1892,7 @@ | |
4526 | *(unsigned long *)(elffile->got+gotent->offset) = | |
4527 | symval+rel->r_addend; | |
4528 | #ifdef ELFDEBUG | |
4529 | - ELFDEBUG("Setting gotent[%x]=%lx\t", | |
4530 | + ELFDEBUG("Setting gotent[%x]=%lx\n", | |
4531 | gotent->offset, symval+rel->r_addend); | |
4532 | #endif | |
4533 | if ((gotent->offset & 0xffe00000) != 0) | |
4534 | @@ -1951,18 +1910,14 @@ | |
4535 | ELFPltEntryPtr pltent; | |
4536 | dest128=(unsigned long *)(secp+(rel->r_offset&~3)); | |
4537 | #ifdef ELFDEBUG | |
4538 | - { | |
4539 | - char *namestr; | |
4540 | ELFDEBUG( "R_IA64_PCREL21B %s\t", | |
4541 | - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4542 | - xf86loaderfree(namestr); | |
4543 | + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4544 | ELFDEBUG( "secp=%lx\t", secp ); | |
4545 | ELFDEBUG( "symval=%lx\t", symval ); | |
4546 | ELFDEBUG( "opd=%lx.%lx\t", ((long *)symval)[0], ((long *)symval)[1]); | |
4547 | ELFDEBUG( "dest128=%lx\t", dest128 ); | |
4548 | - ELFDEBUG( "slot=%ld\t", rel->r_offset & 3); | |
4549 | - ELFDEBUG( "*dest128=[%016lx%016lx]\t", dest128[1], dest128[0]); | |
4550 | - } | |
4551 | + ELFDEBUG( "slot=%d\n", rel->r_offset & 3); | |
4552 | + ELFDEBUG( "*dest128=[%016lx%016lx]\n", dest128[1], dest128[0]); | |
4553 | #endif | |
4554 | if (rel->r_addend) | |
4555 | FatalError("\nAddend for PCREL21B not supported\n"); | |
4556 | @@ -2010,16 +1965,12 @@ | |
4557 | case R_IA64_FPTR64LSB: | |
4558 | dest64=(unsigned long *)(secp+rel->r_offset); | |
4559 | #ifdef ELFDEBUG | |
4560 | - { | |
4561 | - char *namestr; | |
4562 | ELFDEBUG( "R_IA64_FPTR64LSB %s\t", | |
4563 | - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4564 | - xf86loaderfree(namestr); | |
4565 | + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4566 | ELFDEBUG( "secp=%lx\t", secp ); | |
4567 | ELFDEBUG( "symval=%lx\t", symval ); | |
4568 | ELFDEBUG( "dest64=%lx\t", dest64 ); | |
4569 | ELFDEBUG( "opd=%016lx.%016lx\n", ((long *)symval)[0], ((long *)symval)[1] ); | |
4570 | - } | |
4571 | #endif | |
4572 | ||
4573 | if (rel->r_addend) | |
4574 | @@ -2030,15 +1981,11 @@ | |
4575 | case R_IA64_DIR64LSB: | |
4576 | dest64=(unsigned long *)(secp+rel->r_offset); | |
4577 | #ifdef ELFDEBUG | |
4578 | - { | |
4579 | - char *namestr; | |
4580 | ELFDEBUG( "R_IA64_DIR64LSB %s\t", | |
4581 | - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4582 | - xf86loaderfree(namestr); | |
4583 | + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4584 | ELFDEBUG( "secp=%lx\t", secp ); | |
4585 | ELFDEBUG( "symval=%lx\t", symval ); | |
4586 | - ELFDEBUG( "dest64=%lx\t", dest64 ); | |
4587 | - } | |
4588 | + ELFDEBUG( "dest64=%lx\n", dest64 ); | |
4589 | #endif | |
4590 | *dest64 = symval + rel->r_addend; | |
4591 | break; | |
4592 | @@ -2046,26 +1993,22 @@ | |
4593 | case R_IA64_GPREL22: | |
4594 | dest128=(unsigned long *)(secp+(rel->r_offset&~3)); | |
4595 | #ifdef ELFDEBUG | |
4596 | - { | |
4597 | - char *namestr; | |
4598 | ELFDEBUG( "R_IA64_GPREL22 %s\t", | |
4599 | - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4600 | - xf86loaderfree(namestr); | |
4601 | + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); | |
4602 | ELFDEBUG( "secp=%lx\t", secp ); | |
4603 | ELFDEBUG( "symval=%lx\t", symval ); | |
4604 | ELFDEBUG( "dest128=%lx\t", dest128 ); | |
4605 | - ELFDEBUG( "slot=%ld\t", rel->r_offset & 3); | |
4606 | - ELFDEBUG( "*dest128=[%016lx%016lx]\t", dest128[1], dest128[0]); | |
4607 | - } | |
4608 | + ELFDEBUG( "slot=%d\n", rel->r_offset & 3); | |
4609 | + ELFDEBUG( "*dest128=[%016lx%016lx]\n", dest128[1], dest128[0]); | |
4610 | #endif | |
4611 | - IA64InstallReloc(dest128, rel->r_offset & 3, IA64_OPND_IMM22, symval + rel->r_addend - (long)elffile->got); | |
4612 | + IA64InstallReloc(dest128, rel->r_offset & 3, IA64_OPND_IMM22, | |
4613 | + symval + rel->r_addend - (long)elffile->got); | |
4614 | break; | |
4615 | ||
4616 | #endif | |
4617 | default: | |
4618 | - ErrorF( | |
4619 | - "Elf_RelocateEntry() Unsupported relocation type %d\n", | |
4620 | - ELF_R_TYPE(rel->r_info) ); | |
4621 | + ErrorF("Elf_RelocateEntry() Unsupported relocation type %d\n", | |
4622 | + ELF_R_TYPE(rel->r_info)); | |
4623 | break; | |
4624 | } | |
4625 | return 0; | |
4626 | @@ -2078,12 +2021,7 @@ | |
4627 | { | |
4628 | int i, numrel; | |
4629 | Elf_Shdr *sect=&(elffile->sections[index]); | |
4630 | -#if defined(i386) | |
4631 | - Elf_Rel *rel=(Elf_Rel *)elffile->saddr[index]; | |
4632 | -#endif | |
4633 | -#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__sparc__) || defined(__ia64__) | |
4634 | - Elf_Rela *rel=(Elf_Rela *)elffile->saddr[index]; | |
4635 | -#endif | |
4636 | + Elf_Rel_t *rel=(Elf_Rel_t *)elffile->saddr[index]; | |
4637 | Elf_Sym *syms; | |
4638 | unsigned char *secp; /* Begining of the target section */ | |
4639 | ELFRelocPtr reloc_head = NULL; | |
4640 | @@ -2101,7 +2039,7 @@ | |
4641 | #if defined(__alpha__) | |
4642 | if( ELF_R_TYPE(rel[i].r_info) == R_ALPHA_LITERAL) { | |
4643 | ElfAddGOT(elffile,&rel[i]); | |
4644 | - } | |
4645 | + } | |
4646 | #endif | |
4647 | #if defined(__ia64__) | |
4648 | if (ELF_R_TYPE(rel[i].r_info) == R_IA64_LTOFF22 | |
4649 | @@ -2500,7 +2438,7 @@ | |
4650 | elffile->reltxtndx=i; | |
4651 | elffile->reltxtsize=SecSize(i); | |
4652 | #ifdef ELFDEBUG | |
4653 | - ELFDEBUG(".rela.text starts at %x\n", elffile->reltext ); | |
4654 | + ELFDEBUG(".rela.text starts at %lx\n", elffile->reltext ); | |
4655 | #endif | |
4656 | continue; | |
4657 | } | |
4658 | @@ -2514,7 +2452,7 @@ | |
4659 | elffile->reldatndx=i; | |
4660 | elffile->reldatsize=SecSize(i); | |
4661 | #ifdef ELFDEBUG | |
4662 | - ELFDEBUG(".rela.data starts at %x\n", elffile->reldata ); | |
4663 | + ELFDEBUG(".rela.data starts at %lx\n", elffile->reldata ); | |
4664 | #endif | |
4665 | continue; | |
4666 | } | |
4667 | @@ -2528,7 +2466,7 @@ | |
4668 | elffile->relsdatndx=i; | |
4669 | elffile->relsdatsize=SecSize(i); | |
4670 | #ifdef ELFDEBUG | |
4671 | - ELFDEBUG(".rela.sdata starts at %x\n", elffile->relsdata ); | |
4672 | + ELFDEBUG(".rela.sdata starts at %lx\n", elffile->relsdata ); | |
4673 | #endif | |
4674 | continue; | |
4675 | } | |
4676 | @@ -2542,7 +2480,7 @@ | |
4677 | elffile->relrodatndx=i; | |
4678 | elffile->relrodatsize=SecSize(i); | |
4679 | #ifdef ELFDEBUG | |
4680 | - ELFDEBUG(".rela.rodata starts at %x\n", elffile->relrodata ); | |
4681 | + ELFDEBUG(".rela.rodata starts at %lx\n", elffile->relrodata ); | |
4682 | #endif | |
4683 | continue; | |
4684 | } | |
4685 | @@ -2724,7 +2662,8 @@ | |
4686 | /* | |
4687 | * Get the ELF header | |
4688 | */ | |
4689 | - elffile->header=(Elf_Ehdr*)_LoaderFileToMem(elffd,0,sizeof(Elf_Ehdr),"header"); | |
4690 | + elffile->header= | |
4691 | + (Elf_Ehdr*)_LoaderFileToMem(elffd, 0, sizeof(Elf_Ehdr), "header"); | |
4692 | header=(Elf_Ehdr *)elffile->header; | |
4693 | ||
4694 | /* | |
4695 | @@ -2732,8 +2671,9 @@ | |
4696 | */ | |
4697 | elffile->numsh=header->e_shnum; | |
4698 | elffile->secsize=(header->e_shentsize*header->e_shnum); | |
4699 | - elffile->sections=(Elf_Shdr *)_LoaderFileToMem(elffd,header->e_shoff, | |
4700 | - elffile->secsize, "sections"); | |
4701 | + elffile->sections= | |
4702 | + (Elf_Shdr *)_LoaderFileToMem(elffd, header->e_shoff, elffile->secsize, | |
4703 | + "sections"); | |
4704 | #if defined(__alpha__) || defined(__ia64__) | |
4705 | /* | |
4706 | * Need to allocate space for the .got section which will be | |
4707 | @@ -2782,8 +2722,9 @@ | |
4708 | * Get the section header string table | |
4709 | */ | |
4710 | elffile->shstrsize = SecSize(header->e_shstrndx); | |
4711 | - elffile->shstraddr = _LoaderFileToMem(elffd,SecOffset(header->e_shstrndx), | |
4712 | - SecSize(header->e_shstrndx),".shstrtab"); | |
4713 | + elffile->shstraddr = | |
4714 | + _LoaderFileToMem(elffd, SecOffset(header->e_shstrndx), | |
4715 | + SecSize(header->e_shstrndx), ".shstrtab"); | |
4716 | elffile->shstrndx = header->e_shstrndx; | |
4717 | #if defined(__alpha__) || defined(__ia64__) | |
4718 | /* | |
4719 | @@ -2991,6 +2932,10 @@ | |
4720 | { | |
4721 | ELFModulePtr elffile = (ELFModulePtr)modptr; | |
4722 | ELFRelocPtr relptr, reltptr, *brelptr; | |
4723 | +#ifdef __ia64__ | |
4724 | + ELFOpdPtr opdent; | |
4725 | + ELFPltEntryPtr pltent; | |
4726 | +#endif | |
4727 | ||
4728 | /* | |
4729 | * Delete any unresolved relocations | |
4730 | @@ -3031,8 +2976,14 @@ | |
4731 | #if defined(__alpha__) || defined(__ia64__) | |
4732 | if (elffile->shared_got) { | |
4733 | elffile->shared_got->nuses--; | |
4734 | - if (!elffile->shared_got->nuses) | |
4735 | + if (!elffile->shared_got->nuses) { | |
4736 | + ELFGotPtr *pgot = &ELFSharedGOTs; | |
4737 | + while (*pgot && *pgot != elffile->shared_got) | |
4738 | + pgot = &(*pgot)->next; | |
4739 | + if (*pgot) | |
4740 | + *pgot = elffile->shared_got->next; | |
4741 | xf86loaderfree(elffile->shared_got); | |
4742 | + } | |
4743 | } | |
4744 | #endif | |
4745 | #else | |
4746 | @@ -3045,13 +2996,21 @@ | |
4747 | CheckandFreeFile(elffile->rodata,elffile->rodatsize); | |
4748 | CheckandFreeFile(elffile->rodata1,elffile->rodat1size); | |
4749 | CheckandFree(elffile->common,elffile->comsize); | |
4750 | -#if defined(__ia64__) | |
4751 | - CheckandFree(elffile->plt,elffile->pltsize); | |
4752 | -#endif | |
4753 | #if defined(__alpha__) || defined(__ia64__) | |
4754 | CheckandFree(elffile->got,elffile->gotsize); | |
4755 | #endif | |
4756 | #endif | |
4757 | +#if defined(__ia64__) | |
4758 | + CheckandFree(elffile->plt,elffile->pltsize); | |
4759 | + while ((pltent = elffile->plt_entries)) { | |
4760 | + elffile->plt_entries = pltent->next; | |
4761 | + xf86loaderfree(pltent); | |
4762 | + } | |
4763 | + while ((opdent = elffile->opd_entries)) { | |
4764 | + elffile->opd_entries = opdent->next; | |
4765 | + xf86loaderfree(opdent); | |
4766 | + } | |
4767 | +#endif | |
4768 | CheckandFreeFile(elffile->reltext,elffile->reltxtsize); | |
4769 | CheckandFreeFile(elffile->reldata,elffile->reldatsize); | |
4770 | CheckandFreeFile(elffile->relrodata,elffile->relrodatsize); | |
4771 | @@ -3086,4 +3045,3 @@ | |
4772 | } | |
4773 | return NULL; | |
4774 | } | |
4775 | - | |
4776 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h | |
4777 | =================================================================== | |
4778 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h,v | |
4779 | retrieving revision 1.1 | |
4780 | retrieving revision 1.2 | |
4781 | diff -u -r1.1 -r1.2 | |
4782 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h 2000/01/23 04:44:35 1.1 | |
4783 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h 2001/01/06 20:19:14 1.2 | |
4784 | @@ -1,46 +1,55 @@ | |
4785 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h,v 1.1 2000/01/23 04:44:35 dawes Exp $ */ | |
4786 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h,v 1.2 2001/01/06 20:19:14 tsi Exp $ */ | |
4787 | + | |
4788 | +#ifndef _INT10DEFINES_H_ | |
4789 | +#define _INT10DEFINES_H_ 1 | |
4790 | + | |
4791 | #ifdef _VM86_LINUX | |
4792 | ||
4793 | #include <asm/vm86.h> | |
4794 | ||
4795 | -#define CPU_R(type,name) \ | |
4796 | - (*((type *)&(((struct vm86_struct *)REG->cpuRegs)->regs.##name))) | |
4797 | -#define CPU_RD(name) CPU_R(CARD32,name) | |
4798 | -#define CPU_RW(name) CPU_R(CARD16,name) | |
4799 | -#define CPU_RB(name) CPU_R(CARD8,name) | |
4800 | - | |
4801 | -#define X86_EAX CPU_RD(eax) | |
4802 | -#define X86_EBX CPU_RD(ebx) | |
4803 | -#define X86_ECX CPU_RD(ecx) | |
4804 | -#define X86_EDX CPU_RD(edx) | |
4805 | -#define X86_ESI CPU_RD(esi) | |
4806 | -#define X86_EDI CPU_RD(edi) | |
4807 | -#define X86_EBP CPU_RD(ebp) | |
4808 | -#define X86_EIP CPU_RD(eip) | |
4809 | -#define X86_ESP CPU_RD(esp) | |
4810 | -#define X86_EFLAGS CPU_RD(eflags) | |
4811 | - | |
4812 | -#define X86_FLAGS CPU_RW(eflags) | |
4813 | -#define X86_AX CPU_RW(eax) | |
4814 | -#define X86_BX CPU_RW(ebx) | |
4815 | -#define X86_CX CPU_RW(ecx) | |
4816 | -#define X86_DX CPU_RW(edx) | |
4817 | -#define X86_SI CPU_RW(esi) | |
4818 | -#define X86_DI CPU_RW(edi) | |
4819 | -#define X86_BP CPU_RW(ebp) | |
4820 | -#define X86_IP CPU_RW(eip) | |
4821 | -#define X86_SP CPU_RW(esp) | |
4822 | -#define X86_CS CPU_RW(cs) | |
4823 | -#define X86_DS CPU_RW(ds) | |
4824 | -#define X86_ES CPU_RW(es) | |
4825 | -#define X86_SS CPU_RW(ss) | |
4826 | -#define X86_FS CPU_RW(fs) | |
4827 | -#define X86_GS CPU_RW(gs) | |
4828 | - | |
4829 | -#define X86_AL CPU_RB(eax) | |
4830 | -#define X86_BL CPU_RB(ebx) | |
4831 | -#define X86_CL CPU_RB(ecx) | |
4832 | -#define X86_DL CPU_RB(edx) | |
4833 | +#define CPU_R(type,name,num) \ | |
4834 | + (((type *)&(((struct vm86_struct *)REG->cpuRegs)->regs.##name))[num]) | |
4835 | +#define CPU_RD(name,num) CPU_R(CARD32,name,num) | |
4836 | +#define CPU_RW(name,num) CPU_R(CARD16,name,num) | |
4837 | +#define CPU_RB(name,num) CPU_R(CARD8,name,num) | |
4838 | + | |
4839 | +#define X86_EAX CPU_RD(eax,0) | |
4840 | +#define X86_EBX CPU_RD(ebx,0) | |
4841 | +#define X86_ECX CPU_RD(ecx,0) | |
4842 | +#define X86_EDX CPU_RD(edx,0) | |
4843 | +#define X86_ESI CPU_RD(esi,0) | |
4844 | +#define X86_EDI CPU_RD(edi,0) | |
4845 | +#define X86_EBP CPU_RD(ebp,0) | |
4846 | +#define X86_EIP CPU_RD(eip,0) | |
4847 | +#define X86_ESP CPU_RD(esp,0) | |
4848 | +#define X86_EFLAGS CPU_RD(eflags,0) | |
4849 | + | |
4850 | +#define X86_FLAGS CPU_RW(eflags,0) | |
4851 | +#define X86_AX CPU_RW(eax,0) | |
4852 | +#define X86_BX CPU_RW(ebx,0) | |
4853 | +#define X86_CX CPU_RW(ecx,0) | |
4854 | +#define X86_DX CPU_RW(edx,0) | |
4855 | +#define X86_SI CPU_RW(esi,0) | |
4856 | +#define X86_DI CPU_RW(edi,0) | |
4857 | +#define X86_BP CPU_RW(ebp,0) | |
4858 | +#define X86_IP CPU_RW(eip,0) | |
4859 | +#define X86_SP CPU_RW(esp,0) | |
4860 | +#define X86_CS CPU_RW(cs,0) | |
4861 | +#define X86_DS CPU_RW(ds,0) | |
4862 | +#define X86_ES CPU_RW(es,0) | |
4863 | +#define X86_SS CPU_RW(ss,0) | |
4864 | +#define X86_FS CPU_RW(fs,0) | |
4865 | +#define X86_GS CPU_RW(gs,0) | |
4866 | + | |
4867 | +#define X86_AL CPU_RB(eax,0) | |
4868 | +#define X86_BL CPU_RB(ebx,0) | |
4869 | +#define X86_CL CPU_RB(ecx,0) | |
4870 | +#define X86_DL CPU_RB(edx,0) | |
4871 | + | |
4872 | +#define X86_AH CPU_RB(eax,1) | |
4873 | +#define X86_BH CPU_RB(ebx,1) | |
4874 | +#define X86_CH CPU_RB(ecx,1) | |
4875 | +#define X86_DH CPU_RB(edx,1) | |
4876 | ||
4877 | #elif defined(_X86EMU) | |
4878 | ||
4879 | @@ -48,3 +57,4 @@ | |
4880 | ||
4881 | #endif | |
4882 | ||
4883 | +#endif | |
4884 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c | |
4885 | =================================================================== | |
4886 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c,v | |
4887 | retrieving revision 1.2 | |
4888 | retrieving revision 1.3 | |
4889 | diff -u -r1.2 -r1.3 | |
4890 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c 2000/11/06 19:24:08 1.2 | |
4891 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c 2001/01/06 20:19:14 1.3 | |
4892 | @@ -1,4 +1,4 @@ | |
4893 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c,v 1.2 2000/11/06 19:24:08 dawes Exp $ */ | |
4894 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c,v 1.3 2001/01/06 20:19:14 tsi Exp $ */ | |
4895 | ||
4896 | /* Resource information code */ | |
4897 | ||
4898 | @@ -80,10 +80,12 @@ | |
4899 | RANGE(range,0xc0000,0xeffff,ResExcMemBlock); | |
4900 | ret = xf86AddResToList(ret, &range, -1); | |
4901 | ||
4902 | - /* Fallback is to claim well known ports in the 0x0 - 0x3ff range */ | |
4903 | - /* Possibly should claim some of them as sparse ranges */ | |
4904 | - | |
4905 | - RANGE(range,0,0x1ff,ResExcIoBlock | ResEstimated); | |
4906 | + /* | |
4907 | + * Fallback would be to claim well known ports in the 0x0 - 0x3ff range | |
4908 | + * along with their sparse I/O aliases, but that's too imprecise. Instead | |
4909 | + * claim a bare minimum here. | |
4910 | + */ | |
4911 | + RANGE(range, 0, 0x00ff, ResExcIoBlock); /* For mainboard */ | |
4912 | ret = xf86AddResToList(ret, &range, -1); | |
4913 | /* XXX add others */ | |
4914 | return ret; | |
4915 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c | |
4916 | =================================================================== | |
4917 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v | |
4918 | retrieving revision 1.42 | |
4919 | retrieving revision 1.43 | |
4920 | diff -u -r1.42 -r1.43 | |
4921 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c 2000/12/07 15:43:45 1.42 | |
4922 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c 2001/01/06 20:19:15 1.43 | |
4923 | @@ -1,4 +1,4 @@ | |
4924 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.42 2000/12/07 15:43:45 tsi Exp $ */ | |
4925 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.43 2001/01/06 20:19:15 tsi Exp $ */ | |
4926 | /* | |
4927 | * Pci.c - New server PCI access functions | |
4928 | * | |
4929 | @@ -1054,8 +1054,10 @@ | |
4930 | unsigned char *Buf, int Len) | |
4931 | { | |
4932 | ADDRESS hostbase; | |
4933 | + CARD8 *image = Buf; | |
4934 | + unsigned long offset; | |
4935 | CARD32 romaddr, savebase = 0, romsave = 0, newbase = 0; | |
4936 | - int ret; | |
4937 | + int ret, length, rlength, n; | |
4938 | ||
4939 | /* XXX This assumes that memory access is enabled */ | |
4940 | ||
4941 | @@ -1067,24 +1069,23 @@ | |
4942 | romsave = pciReadLong(Tag, PCI_MAP_ROM_REG); | |
4943 | romaddr = PCIGETROM(romsave); | |
4944 | if ((newbase = getValidBIOSBase(Tag, &basereg)) != romaddr) { | |
4945 | +RetryWithBase: | |
4946 | romaddr = PCIGETROM(newbase); | |
4947 | - if (romaddr != 0 && romaddr == newbase) { | |
4948 | -#if 1 | |
4949 | - /* move mem base out of the way if in conflict with ROM */ | |
4950 | + if (romaddr) { | |
4951 | + /* move mem base out of the way if in conflicts with ROM */ | |
4952 | if ((basereg >= 0) && (basereg <= 5)) { | |
4953 | - savebase = pciReadLong(Tag, PCI_MAP_REG_START + (basereg << 2)); | |
4954 | + if (!savebase) | |
4955 | + savebase = pciReadLong(Tag, PCI_MAP_REG_START+(basereg<<2)); | |
4956 | if (PCIGETROM(savebase) == romaddr) { | |
4957 | xf86MsgVerb(X_INFO,5,"xf86ReadPciBios: modifying membase[%i]" | |
4958 | " for device %i:%i:%i\n", basereg, | |
4959 | PCI_BUS_FROM_TAG(Tag), PCI_DEV_FROM_TAG(Tag), | |
4960 | PCI_FUNC_FROM_TAG(Tag)); | |
4961 | - pciWriteLong(Tag, PCI_MAP_REG_START + (basereg << 2), 0); | |
4962 | + pciWriteLong(Tag, PCI_MAP_REG_START + (basereg << 2), | |
4963 | + (CARD32)~0); | |
4964 | } | |
4965 | } | |
4966 | -#endif | |
4967 | - pciWriteLong(Tag, PCI_MAP_ROM_REG, romaddr); | |
4968 | - } else | |
4969 | - romaddr = 0; | |
4970 | + } | |
4971 | } | |
4972 | ||
4973 | ||
4974 | @@ -1092,10 +1093,10 @@ | |
4975 | xf86Msg(X_WARNING, "xf86ReadPciBIOS: cannot locate a BIOS address\n"); | |
4976 | return -1; | |
4977 | } | |
4978 | - else | |
4979 | - xf86MsgVerb(X_INFO,5,"xf86ReadPciBIOS: found ValidBIOSBase for %i:%i:%i:" | |
4980 | - " %x\n", PCI_BUS_FROM_TAG(Tag), PCI_DEV_FROM_TAG(Tag), | |
4981 | - PCI_FUNC_FROM_TAG(Tag),newbase); | |
4982 | + xf86MsgVerb(X_INFO, 5, | |
4983 | + "xf86ReadPciBIOS: found ValidBIOSBase for %i:%i:%i: %x\n", | |
4984 | + PCI_BUS_FROM_TAG(Tag), PCI_DEV_FROM_TAG(Tag), PCI_FUNC_FROM_TAG(Tag), | |
4985 | + newbase); | |
4986 | ||
4987 | hostbase = pciBusAddrToHostAddr(Tag, PCI_MEM, PCIGETROM(romaddr)); | |
4988 | #ifdef DEBUG | |
4989 | @@ -1103,8 +1104,38 @@ | |
4990 | #endif | |
4991 | /* Enable ROM address decoding */ | |
4992 | pciWriteLong(Tag, PCI_MAP_ROM_REG, romaddr | PCI_MAP_ROM_DECODE_ENABLE); | |
4993 | + | |
4994 | + /* Read BIOS in 64kB chunks */ | |
4995 | + ret = 0; | |
4996 | + offset = Offset; | |
4997 | + while ((length = Len) > 0) { | |
4998 | + if (length > 0x10000) length = 0x10000; | |
4999 | + rlength = xf86ReadBIOS(hostbase, offset, image, length); | |
5000 | + if (rlength < 0) { | |
5001 | + ret = rlength; | |
5002 | + break; | |
5003 | + } | |
5004 | + ret += rlength; | |
5005 | + if (rlength < length) break; | |
5006 | + offset += length; | |
5007 | + image += length; | |
5008 | + Len -= length; | |
5009 | + } | |
5010 | ||
5011 | - ret = xf86ReadBIOS(hostbase, Offset, Buf, Len); | |
5012 | + if ((ret != Len) || (Buf[0] != 0x55) || (Buf[1] != 0xaa) || !Buf[2] || | |
5013 | + (Len < (Buf[2] << 9))) { | |
5014 | + n = 0; | |
5015 | + if ((basereg >= 0) && (basereg <= 5) && xf86PciVideoInfo) do { | |
5016 | + pciVideoPtr pvp; | |
5017 | + | |
5018 | + if (!(pvp = xf86PciVideoInfo[n++])) break; | |
5019 | + if (pciTag(pvp->bus, pvp->device, pvp->func) == Tag) { | |
5020 | + if (newbase == pvp->memBase[basereg]) break; | |
5021 | + newbase = pvp->memBase[basereg]; | |
5022 | + goto RetryWithBase; | |
5023 | + } | |
5024 | + } while (1); | |
5025 | + } | |
5026 | ||
5027 | /* Restore ROM address decoding */ | |
5028 | pciWriteLong(Tag, PCI_MAP_ROM_REG, romsave); | |
5029 | @@ -1129,7 +1160,8 @@ | |
5030 | ||
5031 | size = readPciBIOS(Offset,Tag,basereg,Buf,Len); | |
5032 | ||
5033 | - if (size != -1 && Buf[0] == 0x55 && Buf[1] == 0xaa) | |
5034 | + if ((size == Len) && (Buf[0] == 0x55) && (Buf[1] == 0xaa) && Buf[2] && | |
5035 | + (Len >= (Buf[2] << 9))) | |
5036 | return size; | |
5037 | ||
5038 | num = pciTestMultiDeviceCard(PCI_BUS_FROM_TAG(Tag), | |
5039 | @@ -1149,7 +1181,8 @@ | |
5040 | PCI_CMD_STAT_REG,(Acc2 | PCI_ENA)); | |
5041 | size = readPciBIOS(Offset,pTag[i],0,Buf,Len); | |
5042 | ((WriteProcPtr)(pciLongFunc(pTag[i],WRITE)))(pTag[i],PCI_CMD_STAT_REG,Acc2); | |
5043 | - if (size != -1 && ((CARD8*)Buf)[0] == 0x55 && ((CARD8*)Buf)[1] == 0xaa) | |
5044 | + if ((size == Len) && (Buf[0] == 0x55) && (Buf[1] == 0xaa) && Buf[2] && | |
5045 | + (Len >= (Buf[2] << 9))) | |
5046 | break; | |
5047 | } | |
5048 | ((WriteProcPtr)(pciLongFunc(Tag,WRITE)))(Tag,PCI_CMD_STAT_REG,Acc1); | |
5049 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c | |
5050 | =================================================================== | |
5051 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c,v | |
5052 | retrieving revision 3.11 | |
5053 | retrieving revision 3.12 | |
5054 | diff -u -r3.11 -r3.12 | |
5055 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c 2000/10/17 16:53:20 3.11 | |
5056 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c 2001/01/06 20:19:15 3.12 | |
5057 | @@ -1,4 +1,4 @@ | |
5058 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c,v 3.11 2000/10/17 16:53:20 tsi Exp $ */ | |
5059 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c,v 3.12 2001/01/06 20:19:15 tsi Exp $ */ | |
5060 | ||
5061 | /* Resource information code */ | |
5062 | ||
5063 | @@ -141,10 +141,12 @@ | |
5064 | RANGE(range,0xc0000,0xeffff,ResExcMemBlock); | |
5065 | ret = xf86AddResToList(ret, &range, -1); | |
5066 | ||
5067 | - /* Fallback is to claim well known ports in the 0x0 - 0x3ff range */ | |
5068 | - /* Possibly should claim some of them as sparse ranges */ | |
5069 | - | |
5070 | - RANGE(range,0,0x1ff,ResExcIoBlock | ResEstimated); | |
5071 | + /* | |
5072 | + * Fallback would be to claim well known ports in the 0x0 - 0x3ff range | |
5073 | + * along with their sparse I/O aliases, but that's too imprecise. Instead | |
5074 | + * claim a bare minimum here. | |
5075 | + */ | |
5076 | + RANGE(range, 0, 0x00ff, ResExcIoBlock); /* For mainboard */ | |
5077 | ret = xf86AddResToList(ret, &range, -1); | |
5078 | /* XXX add others */ | |
5079 | return ret; | |
5080 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c | |
5081 | =================================================================== | |
5082 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v | |
5083 | retrieving revision 1.19 | |
5084 | retrieving revision 1.20 | |
5085 | diff -u -r1.19 -r1.20 | |
5086 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c 2000/12/06 15:35:31 1.19 | |
5087 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c 2001/01/06 20:19:15 1.20 | |
5088 | @@ -1,10 +1,9 @@ | |
5089 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.19 2000/12/06 15:35:31 eich Exp $ */ | |
5090 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.20 2001/01/06 20:19:15 tsi Exp $ */ | |
5091 | /* | |
5092 | * linux specific part of the int10 module | |
5093 | * Copyright 1999 Egbert Eich | |
5094 | */ | |
5095 | #include "xf86.h" | |
5096 | -#include "xf86str.h" | |
5097 | #include "xf86_OSproc.h" | |
5098 | #include "xf86_ansic.h" | |
5099 | #include "xf86Pci.h" | |
5100 | @@ -28,12 +27,12 @@ | |
5101 | ||
5102 | static int counter = 0; | |
5103 | ||
5104 | -static CARD8 read_b(xf86Int10InfoPtr pInt,int addr); | |
5105 | -static CARD16 read_w(xf86Int10InfoPtr pInt,int addr); | |
5106 | -static CARD32 read_l(xf86Int10InfoPtr pInt,int addr); | |
5107 | -static void write_b(xf86Int10InfoPtr pInt,int addr, CARD8 val); | |
5108 | -static void write_w(xf86Int10InfoPtr pInt,int addr, CARD16 val); | |
5109 | -static void write_l(xf86Int10InfoPtr pInt,int addr, CARD32 val); | |
5110 | +static CARD8 read_b(xf86Int10InfoPtr pInt, int addr); | |
5111 | +static CARD16 read_w(xf86Int10InfoPtr pInt, int addr); | |
5112 | +static CARD32 read_l(xf86Int10InfoPtr pInt, int addr); | |
5113 | +static void write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val); | |
5114 | +static void write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val); | |
5115 | +static void write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val); | |
5116 | ||
5117 | int10MemRec linuxMem = { | |
5118 | read_b, | |
5119 | @@ -70,20 +69,20 @@ | |
5120 | legacyVGARec vga; | |
5121 | ||
5122 | screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex; | |
5123 | - if (int10skip(xf86Screens[screen],entityIndex)) | |
5124 | + if (int10skip(xf86Screens[screen], entityIndex)) | |
5125 | return NULL; | |
5126 | ||
5127 | if ((!vidMem) || (!sysMem)) { | |
5128 | - if ((fd = open(DEV_MEM,O_RDWR,0)) >= 0) { | |
5129 | + if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) { | |
5130 | if (!sysMem) { | |
5131 | #ifdef DEBUG | |
5132 | ErrorF("Mapping sys bios area\n"); | |
5133 | #endif | |
5134 | - if ((sysMem = mmap((void *)(SYS_BIOS),BIOS_SIZE,PROT_READ | |
5135 | - | PROT_WRITE | PROT_EXEC, | |
5136 | - MAP_SHARED | MAP_FIXED,fd, SYS_BIOS)) | |
5137 | + if ((sysMem = mmap((void *)(SYS_BIOS), BIOS_SIZE, | |
5138 | + PROT_READ | PROT_WRITE | PROT_EXEC, | |
5139 | + MAP_SHARED | MAP_FIXED, fd, SYS_BIOS)) | |
5140 | == MAP_FAILED) { | |
5141 | - xf86DrvMsg(screen,X_ERROR,"Cannot map SYS BIOS\n"); | |
5142 | + xf86DrvMsg(screen, X_ERROR, "Cannot map SYS BIOS\n"); | |
5143 | close(fd); | |
5144 | goto error0; | |
5145 | } | |
5146 | @@ -92,33 +91,33 @@ | |
5147 | #ifdef DEBUG | |
5148 | ErrorF("Mapping VRAM area\n"); | |
5149 | #endif | |
5150 | - if ((vidMem = mmap((void *)(V_RAM),VRAM_SIZE,PROT_READ | |
5151 | - | PROT_WRITE | PROT_EXEC, | |
5152 | - MAP_SHARED | MAP_FIXED,fd, V_RAM)) | |
5153 | + if ((vidMem = mmap((void *)(V_RAM), VRAM_SIZE, | |
5154 | + PROT_READ | PROT_WRITE | PROT_EXEC, | |
5155 | + MAP_SHARED | MAP_FIXED, fd, V_RAM)) | |
5156 | == MAP_FAILED) { | |
5157 | - xf86DrvMsg(screen,X_ERROR,"Cannot map V_RAM\n"); | |
5158 | + xf86DrvMsg(screen, X_ERROR, "Cannot map V_RAM\n"); | |
5159 | close(fd); | |
5160 | goto error0; | |
5161 | } | |
5162 | } | |
5163 | close(fd); | |
5164 | } else { | |
5165 | - xf86DrvMsg(screen,X_ERROR,"Cannot open %s\n",DEV_MEM); | |
5166 | + xf86DrvMsg(screen, X_ERROR, "Cannot open %s\n", DEV_MEM); | |
5167 | goto error0; | |
5168 | } | |
5169 | } | |
5170 | - | |
5171 | - pInt = (xf86Int10InfoPtr)xnfcalloc(1,sizeof(xf86Int10InfoRec)); | |
5172 | + | |
5173 | + pInt = (xf86Int10InfoPtr)xnfcalloc(1, sizeof(xf86Int10InfoRec)); | |
5174 | pInt->scrnIndex = screen; | |
5175 | pInt->entityIndex = entityIndex; | |
5176 | if (!xf86Int10ExecSetup(pInt)) | |
5177 | goto error0; | |
5178 | pInt->mem = &linuxMem; | |
5179 | pagesize = getpagesize(); | |
5180 | - pInt->private = (pointer)xnfcalloc(1,sizeof(linuxInt10Priv)); | |
5181 | + pInt->private = (pointer)xnfcalloc(1, sizeof(linuxInt10Priv)); | |
5182 | ((linuxInt10Priv*)pInt->private)->screen = screen; | |
5183 | - ((linuxInt10Priv*)pInt->private)->alloc = | |
5184 | - (pointer)xnfcalloc(1,ALLOC_ENTRIES(pagesize)); | |
5185 | + ((linuxInt10Priv*)pInt->private)->alloc = | |
5186 | + (pointer)xnfcalloc(1, ALLOC_ENTRIES(pagesize)); | |
5187 | ||
5188 | #ifdef DEBUG | |
5189 | ErrorF("Mapping high memory area\n"); | |
5190 | @@ -135,23 +134,23 @@ | |
5191 | ErrorF("Mapping 640kB area\n"); | |
5192 | #endif | |
5193 | if ((low_mem = shmget(counter++, V_RAM, | |
5194 | - IPC_CREAT|SHM_R|SHM_W)) == -1) | |
5195 | + IPC_CREAT | SHM_R | SHM_W)) == -1) | |
5196 | goto error2; | |
5197 | - | |
5198 | + | |
5199 | ((linuxInt10Priv*)pInt->private)->lowMem = low_mem; | |
5200 | - base = shmat(low_mem,0,0); | |
5201 | + base = shmat(low_mem, 0, 0); | |
5202 | ((linuxInt10Priv *)pInt->private)->base = base; | |
5203 | - base_high = shmat(high_mem,0,0); | |
5204 | - ((linuxInt10Priv *)pInt->private)->base_high = base_high; | |
5205 | - | |
5206 | - MapCurrentInt10(pInt); | |
5207 | + base_high = shmat(high_mem, 0, 0); | |
5208 | + ((linuxInt10Priv*)pInt->private)->base_high = base_high; | |
5209 | + | |
5210 | + MapCurrentInt10(pInt); | |
5211 | Int10Current = pInt; | |
5212 | - | |
5213 | + | |
5214 | #ifdef DEBUG | |
5215 | ErrorF("Mapping int area\n"); | |
5216 | #endif | |
5217 | - if (xf86ReadBIOS(0,0,(unsigned char *)0,LOW_PAGE_SIZE) < 0) { | |
5218 | - xf86DrvMsg(screen,X_ERROR,"Cannot read int vect\n"); | |
5219 | + if (xf86ReadBIOS(0, 0, (unsigned char *)0, LOW_PAGE_SIZE) < 0) { | |
5220 | + xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n"); | |
5221 | goto error3; | |
5222 | } | |
5223 | ||
5224 | @@ -165,33 +164,33 @@ | |
5225 | if (xf86ReadBIOS(cs, 0, (pointer)cs, V_BIOS_SIZE) < V_BIOS_SIZE) | |
5226 | xf86DrvMsg(screen, X_WARNING, | |
5227 | "Unable to retrieve all of segment 0x%06X.\n", cs); | |
5228 | - | |
5229 | + | |
5230 | if (xf86IsEntityPrimary(entityIndex)) { | |
5231 | - cs = ((CARD16*)0)[(0x10<<1)+1]; | |
5232 | + cs = ((CARD16*)0)[(0x10 <<1) + 1]; | |
5233 | bios_base = (unsigned char *)(cs << 4); | |
5234 | - | |
5235 | + | |
5236 | if (!int10_check_bios(screen, cs, bios_base)) { | |
5237 | - cs = ((CARD16*)0)[(0x42<<1)+1]; | |
5238 | + cs = ((CARD16*)0)[(0x42 << 1) + 1]; | |
5239 | bios_base = (unsigned char *)(cs << 4); | |
5240 | if (!int10_check_bios(screen, cs, bios_base)) { | |
5241 | cs = V_BIOS >> 4; | |
5242 | bios_base = (unsigned char *)(cs << 4); | |
5243 | if (!int10_check_bios(screen, cs, bios_base)) { | |
5244 | - xf86DrvMsg(screen,X_ERROR,"No V_BIOS found\n"); | |
5245 | + xf86DrvMsg(screen, X_ERROR, "No V_BIOS found\n"); | |
5246 | goto error3; | |
5247 | } | |
5248 | } | |
5249 | } | |
5250 | - xf86DrvMsg(screen,X_INFO,"Primary V_BIOS segment is: 0x%x\n",cs); | |
5251 | + xf86DrvMsg(screen, X_INFO, "Primary V_BIOS segment is: 0x%x\n", cs); | |
5252 | ||
5253 | pInt->BIOSseg = cs; | |
5254 | set_return_trap(pInt); | |
5255 | } else { | |
5256 | - if (!mapPciRom(pInt,(unsigned char *)(V_BIOS))) { | |
5257 | - xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS\n"); | |
5258 | + if (!mapPciRom(pInt, (unsigned char *)(V_BIOS))) { | |
5259 | + xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS\n"); | |
5260 | goto error3; | |
5261 | } | |
5262 | - | |
5263 | + | |
5264 | pInt->BIOSseg = V_BIOS >> 4; | |
5265 | pInt->num = 0xe6; | |
5266 | reset_int_vect(pInt); | |
5267 | @@ -201,20 +200,20 @@ | |
5268 | UnlockLegacyVGA(screen, &vga); | |
5269 | } | |
5270 | #ifdef DEBUG | |
5271 | - dprint(0xc0000,0x20); | |
5272 | + dprint(0xc0000, 0x20); | |
5273 | #endif | |
5274 | - | |
5275 | + | |
5276 | return pInt; | |
5277 | - | |
5278 | + | |
5279 | error3: | |
5280 | shmdt(base_high); | |
5281 | shmdt(base); | |
5282 | shmdt(0); | |
5283 | shmdt((char*)HIGH_MEM); | |
5284 | - shmctl(low_mem,IPC_RMID,NULL); | |
5285 | + shmctl(low_mem, IPC_RMID, NULL); | |
5286 | Int10Current = NULL; | |
5287 | error2: | |
5288 | - shmctl(high_mem,IPC_RMID,NULL); | |
5289 | + shmctl(high_mem, IPC_RMID,NULL); | |
5290 | error1: | |
5291 | xfree(((linuxInt10Priv*)pInt->private)->alloc); | |
5292 | xfree(pInt->private); | |
5293 | @@ -230,120 +229,119 @@ | |
5294 | shmdt(0); | |
5295 | shmdt((char*)HIGH_MEM); | |
5296 | } | |
5297 | - shmat(((linuxInt10Priv *)pInt->private)->lowMem,(char*)1,SHM_RND); | |
5298 | - shmat(((linuxInt10Priv *)pInt->private)->highMem,(char*)HIGH_MEM,0); | |
5299 | + shmat(((linuxInt10Priv*)pInt->private)->lowMem, (char*)1, SHM_RND); | |
5300 | + shmat(((linuxInt10Priv*)pInt->private)->highMem, (char*)HIGH_MEM, 0); | |
5301 | } | |
5302 | ||
5303 | void | |
5304 | xf86FreeInt10(xf86Int10InfoPtr pInt) | |
5305 | { | |
5306 | if (!pInt) | |
5307 | - return; | |
5308 | + return; | |
5309 | if (Int10Current == pInt) { | |
5310 | shmdt(0); | |
5311 | shmdt((char*)HIGH_MEM); | |
5312 | Int10Current = NULL; | |
5313 | } | |
5314 | - shmdt(((linuxInt10Priv *)pInt->private)->base_high); | |
5315 | - shmdt(((linuxInt10Priv *)pInt->private)->base); | |
5316 | - shmctl(((linuxInt10Priv *)pInt->private)->lowMem,IPC_RMID,NULL); | |
5317 | - shmctl(((linuxInt10Priv *)pInt->private)->highMem,IPC_RMID,NULL); | |
5318 | + shmdt(((linuxInt10Priv*)pInt->private)->base_high); | |
5319 | + shmdt(((linuxInt10Priv*)pInt->private)->base); | |
5320 | + shmctl(((linuxInt10Priv*)pInt->private)->lowMem, IPC_RMID, NULL); | |
5321 | + shmctl(((linuxInt10Priv*)pInt->private)->highMem, IPC_RMID, NULL); | |
5322 | xfree(((linuxInt10Priv*)pInt->private)->alloc); | |
5323 | xfree(pInt->private); | |
5324 | xfree(pInt); | |
5325 | } | |
5326 | ||
5327 | void * | |
5328 | -xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off) | |
5329 | +xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off) | |
5330 | { | |
5331 | int pagesize = getpagesize(); | |
5332 | int num_pages = ALLOC_ENTRIES(pagesize); | |
5333 | - int i,j; | |
5334 | + int i, j; | |
5335 | ||
5336 | - for (i=0;i<num_pages - num;i++) { | |
5337 | + for (i = 0; i < (num_pages - num); i++) { | |
5338 | if (((linuxInt10Priv*)pInt->private)->alloc[i] == 0) { | |
5339 | - for (j=i;j < num + i;j++) | |
5340 | + for (j = i; j < (num + i); j++) | |
5341 | if ((((linuxInt10Priv*)pInt->private)->alloc[j] != 0)) | |
5342 | break; | |
5343 | - if (j == num + i) | |
5344 | + if (j == (num + i)) | |
5345 | break; | |
5346 | else | |
5347 | i = i + num; | |
5348 | } | |
5349 | } | |
5350 | - if (i == num_pages - num) | |
5351 | + if (i == (num_pages - num)) | |
5352 | return NULL; | |
5353 | - | |
5354 | - for (j = i; j < i + num; j++) | |
5355 | + | |
5356 | + for (j = i; j < (i + num); j++) | |
5357 | ((linuxInt10Priv*)pInt->private)->alloc[j] = 1; | |
5358 | ||
5359 | *off = (i + 1) * pagesize; | |
5360 | - | |
5361 | - return (void *) | |
5362 | - (((linuxInt10Priv*)pInt->private)->base + (i + 1) * pagesize); | |
5363 | + | |
5364 | + return ((linuxInt10Priv*)pInt->private)->base + ((i + 1) * pagesize); | |
5365 | } | |
5366 | ||
5367 | void | |
5368 | xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num) | |
5369 | { | |
5370 | int pagesize = getpagesize(); | |
5371 | - int first = ((unsigned long)pbase | |
5372 | + int first = (((unsigned long)pbase | |
5373 | - (unsigned long)((linuxInt10Priv*)pInt->private)->base) | |
5374 | - / pagesize - 1; | |
5375 | + / pagesize) - 1; | |
5376 | int i; | |
5377 | ||
5378 | - for (i = first; i < first + num; i++) | |
5379 | + for (i = first; i < (first + num); i++) | |
5380 | ((linuxInt10Priv*)pInt->private)->alloc[i] = 0; | |
5381 | } | |
5382 | ||
5383 | static CARD8 | |
5384 | -read_b(xf86Int10InfoPtr pInt,int addr) | |
5385 | +read_b(xf86Int10InfoPtr pInt, int addr) | |
5386 | { | |
5387 | - return *((CARD8 *)(addr)); | |
5388 | + return *((CARD8 *)addr); | |
5389 | } | |
5390 | ||
5391 | static CARD16 | |
5392 | -read_w(xf86Int10InfoPtr pInt,int addr) | |
5393 | +read_w(xf86Int10InfoPtr pInt, int addr) | |
5394 | { | |
5395 | - return *((CARD16 *)(addr)); | |
5396 | + return *((CARD16 *)addr); | |
5397 | } | |
5398 | ||
5399 | static CARD32 | |
5400 | -read_l(xf86Int10InfoPtr pInt,int addr) | |
5401 | +read_l(xf86Int10InfoPtr pInt, int addr) | |
5402 | { | |
5403 | - return *((CARD32 *)(addr)); | |
5404 | + return *((CARD32 *)addr); | |
5405 | } | |
5406 | ||
5407 | static void | |
5408 | -write_b(xf86Int10InfoPtr pInt,int addr, CARD8 val) | |
5409 | +write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val) | |
5410 | { | |
5411 | - *((CARD8 *)(addr)) = (CARD8)val; | |
5412 | + *((CARD8 *)addr) = val; | |
5413 | } | |
5414 | ||
5415 | static void | |
5416 | -write_w(xf86Int10InfoPtr pInt,int addr, CARD16 val) | |
5417 | +write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val) | |
5418 | { | |
5419 | - *((CARD16 *)(addr)) = (CARD16)val; | |
5420 | + *((CARD16 *)addr) = val; | |
5421 | } | |
5422 | ||
5423 | static | |
5424 | -void write_l(xf86Int10InfoPtr pInt,int addr, CARD32 val) | |
5425 | +void write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val) | |
5426 | { | |
5427 | - *((CARD32 *)(addr)) = (CARD32)val; | |
5428 | + *((CARD32 *)addr) = val; | |
5429 | } | |
5430 | ||
5431 | pointer | |
5432 | xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr) | |
5433 | { | |
5434 | if (addr < V_RAM) | |
5435 | - return (pointer)(((linuxInt10Priv*)pInt->private)->base + addr); | |
5436 | + return ((linuxInt10Priv*)pInt->private)->base + addr; | |
5437 | else if (addr < V_BIOS) | |
5438 | - return (pointer) addr; | |
5439 | + return (pointer)addr; | |
5440 | else if (addr < SYS_BIOS) | |
5441 | - return (pointer)(((linuxInt10Priv*)pInt->private)->base_high | |
5442 | + return (pointer)(((linuxInt10Priv*)pInt->private)->base_high | |
5443 | - V_BIOS + addr); | |
5444 | else | |
5445 | - return (pointer) addr; | |
5446 | + return (pointer)addr; | |
5447 | } | |
5448 | ||
5449 | #ifdef _VM86_LINUX | |
5450 | @@ -355,38 +353,200 @@ | |
5451 | { | |
5452 | #define VM86S ((struct vm86_struct *)pInt->cpuRegs) | |
5453 | ||
5454 | - pInt->cpuRegs = (pointer) xnfcalloc(1,sizeof(struct vm86_struct)); | |
5455 | + pInt->cpuRegs = (pointer)xnfcalloc(1, sizeof(struct vm86_struct)); | |
5456 | VM86S->flags = 0; | |
5457 | VM86S->screen_bitmap = 0; | |
5458 | VM86S->cpu_type = CPU_586; | |
5459 | - memset(&VM86S->int_revectored, 0xff,sizeof(VM86S->int_revectored)) ; | |
5460 | - memset(&VM86S->int21_revectored, 0xff,sizeof(VM86S->int21_revectored)) ; | |
5461 | + memset(&VM86S->int_revectored, 0xff, sizeof(VM86S->int_revectored)); | |
5462 | + memset(&VM86S->int21_revectored, 0xff, sizeof(VM86S->int21_revectored)); | |
5463 | + return TRUE; | |
5464 | +} | |
5465 | + | |
5466 | +/* get the linear address */ | |
5467 | +#define LIN_PREF_SI ((pref_seg << 4) + X86_SI) | |
5468 | +#define LWECX ((prefix66 ^ prefix67) ? X86_ECX : X86_CX) | |
5469 | +#define LWECX_ZERO {if (prefix66 ^ prefix67) X86_ECX = 0; else X86_CX = 0;} | |
5470 | +#define DF (1 << 10) | |
5471 | + | |
5472 | +/* vm86 fault handling */ | |
5473 | +static Bool | |
5474 | +vm86_GP_fault(xf86Int10InfoPtr pInt) | |
5475 | +{ | |
5476 | + unsigned char *csp, *lina; | |
5477 | + CARD32 org_eip; | |
5478 | + int pref_seg; | |
5479 | + int done, is_rep, prefix66, prefix67; | |
5480 | + | |
5481 | + csp = lina = SEG_ADR((unsigned char *), X86_CS, IP); | |
5482 | + | |
5483 | + is_rep = 0; | |
5484 | + prefix66 = prefix67 = 0; | |
5485 | + pref_seg = -1; | |
5486 | + | |
5487 | + /* eat up prefixes */ | |
5488 | + done = 0; | |
5489 | + do { | |
5490 | + switch (MEM_RB(pInt, (int)csp++)) { | |
5491 | + case 0x66: /* operand prefix */ prefix66=1; break; | |
5492 | + case 0x67: /* address prefix */ prefix67=1; break; | |
5493 | + case 0x2e: /* CS */ pref_seg=X86_CS; break; | |
5494 | + case 0x3e: /* DS */ pref_seg=X86_DS; break; | |
5495 | + case 0x26: /* ES */ pref_seg=X86_ES; break; | |
5496 | + case 0x36: /* SS */ pref_seg=X86_SS; break; | |
5497 | + case 0x65: /* GS */ pref_seg=X86_GS; break; | |
5498 | + case 0x64: /* FS */ pref_seg=X86_FS; break; | |
5499 | + case 0xf2: /* repnz */ | |
5500 | + case 0xf3: /* rep */ is_rep=1; break; | |
5501 | + default: done=1; | |
5502 | + } | |
5503 | + } while (!done); | |
5504 | + csp--; /* oops one too many */ | |
5505 | + org_eip = X86_EIP; | |
5506 | + X86_IP += (csp - lina); | |
5507 | + | |
5508 | + switch (MEM_RB(pInt, (int)csp)) { | |
5509 | + case 0x6c: /* insb */ | |
5510 | + /* NOTE: ES can't be overwritten; prefixes 66,67 should use esi,edi,ecx | |
5511 | + * but is anyone using extended regs in real mode? */ | |
5512 | + /* WARNING: no test for DI wrapping! */ | |
5513 | + X86_EDI += port_rep_inb(pInt, X86_DX, SEG_EADR((CARD32), X86_ES, DI), | |
5514 | + X86_FLAGS & DF, is_rep ? LWECX : 1); | |
5515 | + if (is_rep) LWECX_ZERO; | |
5516 | + X86_IP++; | |
5517 | + break; | |
5518 | + | |
5519 | + case 0x6d: /* (rep) insw / insd */ | |
5520 | + /* NOTE: ES can't be overwritten */ | |
5521 | + /* WARNING: no test for _DI wrapping! */ | |
5522 | + if (prefix66) { | |
5523 | + X86_DI += port_rep_inl(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI), | |
5524 | + X86_EFLAGS & DF, is_rep ? LWECX : 1); | |
5525 | + } | |
5526 | + else { | |
5527 | + X86_DI += port_rep_inw(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI), | |
5528 | + X86_FLAGS & DF, is_rep ? LWECX : 1); | |
5529 | + } | |
5530 | + if (is_rep) LWECX_ZERO; | |
5531 | + X86_IP++; | |
5532 | + break; | |
5533 | + | |
5534 | + case 0x6e: /* (rep) outsb */ | |
5535 | + if (pref_seg < 0) pref_seg = X86_DS; | |
5536 | + /* WARNING: no test for _SI wrapping! */ | |
5537 | + X86_SI += port_rep_outb(pInt, X86_DX, (CARD32)LIN_PREF_SI, | |
5538 | + X86_FLAGS & DF, is_rep ? LWECX : 1); | |
5539 | + if (is_rep) LWECX_ZERO; | |
5540 | + X86_IP++; | |
5541 | + break; | |
5542 | + | |
5543 | + case 0x6f: /* (rep) outsw / outsd */ | |
5544 | + if (pref_seg < 0) pref_seg = X86_DS; | |
5545 | + /* WARNING: no test for _SI wrapping! */ | |
5546 | + if (prefix66) { | |
5547 | + X86_SI += port_rep_outl(pInt, X86_DX, (CARD32)LIN_PREF_SI, | |
5548 | + X86_EFLAGS & DF, is_rep ? LWECX : 1); | |
5549 | + } | |
5550 | + else { | |
5551 | + X86_SI += port_rep_outw(pInt, X86_DX, (CARD32)LIN_PREF_SI, | |
5552 | + X86_FLAGS & DF, is_rep ? LWECX : 1); | |
5553 | + } | |
5554 | + if (is_rep) LWECX_ZERO; | |
5555 | + X86_IP++; | |
5556 | + break; | |
5557 | + | |
5558 | + case 0xe5: /* inw xx, inl xx */ | |
5559 | + if (prefix66) X86_EAX = x_inl(csp[1]); | |
5560 | + else X86_AX = x_inw(csp[1]); | |
5561 | + X86_IP += 2; | |
5562 | + break; | |
5563 | + | |
5564 | + case 0xe4: /* inb xx */ | |
5565 | + X86_AL = x_inb(csp[1]); | |
5566 | + X86_IP += 2; | |
5567 | + break; | |
5568 | + | |
5569 | + case 0xed: /* inw dx, inl dx */ | |
5570 | + if (prefix66) X86_EAX = x_inl(X86_DX); | |
5571 | + else X86_AX = x_inw(X86_DX); | |
5572 | + X86_IP += 1; | |
5573 | + break; | |
5574 | + | |
5575 | + case 0xec: /* inb dx */ | |
5576 | + X86_AL = x_inb(X86_DX); | |
5577 | + X86_IP += 1; | |
5578 | + break; | |
5579 | + | |
5580 | + case 0xe7: /* outw xx */ | |
5581 | + if (prefix66) x_outl(csp[1], X86_EAX); | |
5582 | + else x_outw(csp[1], X86_AX); | |
5583 | + X86_IP += 2; | |
5584 | + break; | |
5585 | + | |
5586 | + case 0xe6: /* outb xx */ | |
5587 | + x_outb(csp[1], X86_AL); | |
5588 | + X86_IP += 2; | |
5589 | + break; | |
5590 | + | |
5591 | + case 0xef: /* outw dx */ | |
5592 | + if (prefix66) x_outl(X86_DX, X86_EAX); | |
5593 | + else x_outw(X86_DX, X86_AX); | |
5594 | + X86_IP += 1; | |
5595 | + break; | |
5596 | + | |
5597 | + case 0xee: /* outb dx */ | |
5598 | + x_outb(X86_DX, X86_AL); | |
5599 | + X86_IP += 1; | |
5600 | + break; | |
5601 | + | |
5602 | + case 0xf4: | |
5603 | +#ifdef DEBUG | |
5604 | + ErrorF("hlt at %p\n", lina); | |
5605 | +#endif | |
5606 | + return FALSE; | |
5607 | + | |
5608 | + case 0x0f: | |
5609 | + xf86DrvMsg(pInt->scrnIndex, X_ERROR, | |
5610 | + "CPU 0x0f Trap at CS:EIP=0x%4.4x:0x%8.8x\n", X86_CS, X86_EIP); | |
5611 | + goto op0ferr; | |
5612 | + | |
5613 | + case 0xf0: /* lock */ | |
5614 | + default: | |
5615 | + xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown reason for exception\n"); | |
5616 | + | |
5617 | + op0ferr: | |
5618 | + dump_registers(pInt); | |
5619 | + stack_trace(pInt); | |
5620 | + dump_code(pInt); | |
5621 | + xf86DrvMsg(pInt->scrnIndex, X_ERROR, "cannot continue\n"); | |
5622 | + return FALSE; | |
5623 | + } /* end of switch() */ | |
5624 | return TRUE; | |
5625 | } | |
5626 | - | |
5627 | + | |
5628 | static int | |
5629 | do_vm86(xf86Int10InfoPtr pInt) | |
5630 | { | |
5631 | int retval, signo; | |
5632 | - | |
5633 | + | |
5634 | xf86InterceptSignals(&signo); | |
5635 | retval = vm86_rep(VM86S); | |
5636 | xf86InterceptSignals(NULL); | |
5637 | ||
5638 | if (signo >= 0) { | |
5639 | - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "vm86() syscall generated signal %d.\n", signo); | |
5640 | + xf86DrvMsg(pInt->scrnIndex, X_ERROR, | |
5641 | + "vm86() syscall generated signal %d.\n", signo); | |
5642 | dump_registers(pInt); | |
5643 | dump_code(pInt); | |
5644 | stack_trace(pInt); | |
5645 | return 0; | |
5646 | } | |
5647 | - | |
5648 | + | |
5649 | switch (VM86_TYPE(retval)) { | |
5650 | case VM86_UNKNOWN: | |
5651 | if (!vm86_GP_fault(pInt)) return 0; | |
5652 | break; | |
5653 | case VM86_STI: | |
5654 | - xf86DrvMsg(pInt->scrnIndex,X_ERROR,"vm86_sti :-((\n"); | |
5655 | + xf86DrvMsg(pInt->scrnIndex, X_ERROR, "vm86_sti :-((\n"); | |
5656 | dump_registers(pInt); | |
5657 | dump_code(pInt); | |
5658 | stack_trace(pInt); | |
5659 | @@ -394,8 +554,8 @@ | |
5660 | case VM86_INTx: | |
5661 | pInt->num = VM86_ARG(retval); | |
5662 | if (!int_handler(pInt)) { | |
5663 | - xf86DrvMsg(pInt->scrnIndex, | |
5664 | - X_ERROR,"Unknown vm86_int: 0x%X\n\n",VM86_ARG(retval)); | |
5665 | + xf86DrvMsg(pInt->scrnIndex, X_ERROR, | |
5666 | + "Unknown vm86_int: 0x%X\n\n", VM86_ARG(retval)); | |
5667 | dump_registers(pInt); | |
5668 | dump_code(pInt); | |
5669 | stack_trace(pInt); | |
5670 | @@ -409,17 +569,17 @@ | |
5671 | * we used to warn here and bail out - but now the sigio stuff | |
5672 | * always fires signals at us. So we just ignore them for now. | |
5673 | */ | |
5674 | - xf86DrvMsg(pInt->scrnIndex,X_WARNING,"received signal\n"); | |
5675 | + xf86DrvMsg(pInt->scrnIndex, X_WARNING, "received signal\n"); | |
5676 | return 0; | |
5677 | default: | |
5678 | - xf86DrvMsg(pInt->scrnIndex,X_ERROR,"unknown type(0x%x)=0x%x\n", | |
5679 | - VM86_ARG(retval),VM86_TYPE(retval)); | |
5680 | + xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown type(0x%x)=0x%x\n", | |
5681 | + VM86_ARG(retval), VM86_TYPE(retval)); | |
5682 | dump_registers(pInt); | |
5683 | dump_code(pInt); | |
5684 | stack_trace(pInt); | |
5685 | return 0; | |
5686 | } | |
5687 | - | |
5688 | + | |
5689 | return 1; | |
5690 | } | |
5691 | ||
5692 | @@ -431,11 +591,11 @@ | |
5693 | if (int_handler(pInt)) | |
5694 | while(do_vm86(pInt)) {}; | |
5695 | ||
5696 | - finish_int(pInt,sig); | |
5697 | + finish_int(pInt, sig); | |
5698 | } | |
5699 | ||
5700 | static int | |
5701 | -vm86_rep(struct vm86_struct *ptr) | |
5702 | +vm86_rep(struct vm86_struct *ptr) | |
5703 | { | |
5704 | int __res; | |
5705 | ||
5706 | @@ -455,9 +615,9 @@ | |
5707 | "b" ((struct vm86_struct *)ptr)); | |
5708 | #endif | |
5709 | ||
5710 | - if ((__res) < 0) { | |
5711 | + if (__res < 0) { | |
5712 | errno = -__res; | |
5713 | - __res=-1; | |
5714 | + __res = -1; | |
5715 | } | |
5716 | else errno = 0; | |
5717 | return __res; | |
5718 | Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c | |
5719 | =================================================================== | |
5720 | RCS file: /cvs/xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c,v | |
5721 | retrieving revision 1.15 | |
5722 | retrieving revision 1.16 | |
5723 | diff -u -r1.15 -r1.16 | |
5724 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c 2000/04/23 19:27:03 1.15 | |
5725 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c 2001/01/06 20:19:15 1.16 | |
5726 | @@ -1,4 +1,4 @@ | |
5727 | -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c,v 1.15 2000/04/23 19:27:03 tsi Exp $ */ | |
5728 | +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c,v 1.16 2001/01/06 20:19:15 tsi Exp $ */ | |
5729 | ||
5730 | /* Standard resource information code */ | |
5731 | ||
5732 | @@ -108,10 +108,12 @@ | |
5733 | RANGE(range,0xffe00000,0xffffffff,ResExcMemBlock | ResBios); | |
5734 | ret = xf86AddResToList(ret, &range, -1); | |
5735 | ||
5736 | - /* Fallback is to claim well known ports in the 0x0 - 0x3ff range */ | |
5737 | - /* Possibly should claim some of them as sparse ranges */ | |
5738 | - | |
5739 | - RANGE(range,0,0x1ff,ResExcIoBlock | ResEstimated); | |
5740 | + /* | |
5741 | + * Fallback would be to claim well known ports in the 0x0 - 0x3ff range | |
5742 | + * along with their sparse I/O aliases, but that's too imprecise. Instead | |
5743 | + * claim a bare minimum here. | |
5744 | + */ | |
5745 | + RANGE(range, 0, 0x00ff, ResExcIoBlock); /* For mainboard */ | |
5746 | ret = xf86AddResToList(ret, &range, -1); | |
5747 | /* XXX add others */ | |
5748 | return ret; | |
5749 | --- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c.ia64-2 Sat Dec 2 10:31:00 2000 | |
5750 | +++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c Mon Jan 29 11:48:02 2001 | |
5751 | @@ -26,7 +26,7 @@ | |
5752 | * | |
5753 |