]> git.pld-linux.org Git - packages/X11.git/blob - XFree86-sparc_pci_domains.patch
- cleanup
[packages/X11.git] / XFree86-sparc_pci_domains.patch
1 This patch by David S. Miller.
2
3 --- XFree86-4.1.0/xc/config/cf/linux.cf.~1~     Sun Jun  3 19:44:40 2001
4 +++ XFree86-4.1.0/xc/config/cf/linux.cf Sun Jun  3 19:44:48 2001
5 @@ -720,7 +720,7 @@
6  # endif
7  # define LinuxMachineDefines   -D__sparc__
8  # define ServerOSDefines       XFree86ServerOSDefines -DDDXTIME -DPART_NET
9 -# define ServerExtraDefines    -DGCCUSESGAS XFree86ServerDefines
10 +# define ServerExtraDefines    -DHAVE_DOMAINS -DGCCUSESGAS XFree86ServerDefines
11  # define AsVISOption           -Av9a
12  # ifdef Sparc64Architecture
13  #  define AsOutputArchSize     64
14 --- XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/common/xf86.h.~1~      Sun Jun  3 19:44:40 2001
15 +++ XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/common/xf86.h  Sun Jun  3 19:44:48 2001
16 @@ -121,10 +121,18 @@
17  resPtr xf86ReallocatePciResources(int entityIndex, resPtr pRes);
18  resPtr xf86SetOperatingState(resList list, int entityIndex, int mask);
19  void xf86EnterServerState(xf86State state);
20 -resRange xf86GetBlock(long type, memType size,
21 +resRange xf86GetBlock(long type,
22 +#ifdef HAVE_DOMAINS
23 +                     int domain,
24 +#endif
25 +                     memType size,
26                       memType window_start, memType window_end,
27                       memType align_mask, resPtr avoid);
28 -resRange xf86GetSparse(long type,  memType fixed_bits,
29 +resRange xf86GetSparse(long type,
30 +#ifdef HAVE_DOMAINS
31 +                      int domain,
32 +#endif
33 +                      memType fixed_bits,
34                        memType decode_mask, memType address_mask,
35                        resPtr avoid);
36  memType xf86ChkConflict(resRange *rgp, int entityIndex);
37 --- XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c.~1~   Sun Jun  3 19:44:40 2001
38 +++ XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c       Sun Jun  3 19:44:48 2001
39 @@ -393,6 +393,9 @@
40      resPtr res = Acc;
41  
42      while (res) {
43 +       /* NOTE: Assumes that entities live inside of a single
44 +        * domain.
45 +        */
46         if (res->entityIndex == entityIndex &&
47             (type & ResAccMask & res->res_type))
48         {
49 @@ -895,6 +898,14 @@
50      memType val,tmp,prev;
51      int i;
52      
53 +#ifdef HAVE_DOMAINS
54 +    /* A resource cannot conflict with a range in a different
55 +     * domain.
56 +     */
57 +    if (pRes->res_domain != range->domain)
58 +       return 0;
59 +#endif
60 +
61      switch (pRes->res_type & ResExtMask) {
62      case ResBlock:
63         if (range->rBegin < pRes->block_end &&
64 @@ -953,6 +964,14 @@
65      memType val, tmp, prev;
66      int i;
67      
68 +#ifdef HAVE_DOMAINS
69 +    /* A resource cannot conflict with a range in a different
70 +     * domain.
71 +     */
72 +    if (pRes->res_domain != range->domain)
73 +       return 0;
74 +#endif
75 +
76      switch (pRes->res_type & ResExtMask) {
77      case ResSparse:
78         tmp = pRes->sparse_mask & range->rMask;
79 @@ -1020,7 +1039,7 @@
80   * depending on the types of the resource ranges and their locations
81   */
82  static Bool
83 -needCheck(resPtr pRes, long type, int entityIndex, xf86State state)
84 +needCheck(resPtr pRes, long type, int domain, int entityIndex, xf86State state)
85  {
86      /* the same entity shouldn't conflict with itself */
87      ScrnInfoPtr pScrn;
88 @@ -1031,6 +1050,14 @@
89      if (!(pRes->res_type & type & ResPhysMask)) 
90          return FALSE;
91  
92 +#ifdef HAVE_DOMAINS
93 +    /* A resource cannot conflict with something in a different
94 +     * domain.
95 +     */
96 +    if (pRes->res_domain != domain)
97 +       return FALSE;
98 +#endif
99 +
100      /*
101       * Resources set by BIOS (ResBios) are allowed to conflict
102       * with resources marked (ResBios).
103 @@ -1111,7 +1138,11 @@
104      memType ret;
105      
106      while(pRes) {
107 -       if (!needCheck(pRes,rgp->type, entityIndex ,state)) { 
108 +       int domain = 0;
109 +#ifdef HAVE_DOMAINS
110 +       domain = rgp->domain;
111 +#endif
112 +       if (!needCheck(pRes,rgp->type,domain,entityIndex,state)) { 
113             pRes = pRes->next;                    
114             continue;                             
115         }
116 @@ -1274,16 +1305,20 @@
117      while (1) {
118         while (list) {
119             if ((list->res_type & ResPhysMask) == type) {
120 +               int domain = 0;
121 +#ifdef HAVE_DOMAINS
122 +               domain = list->res_domain;
123 +#endif
124                 switch (list->res_type & ResExtMask) {
125                 case ResBlock:
126 -                   xf86ErrorFVerb(verb, "\t[%d] %d\t0x%08x - 0x%08x (0x%x)",
127 -                                  i, list->entityIndex, list->block_begin,
128 +                   xf86ErrorFVerb(verb, "\t[%d] %d %x\t0x%08x - 0x%08x (0x%x)",
129 +                                  i, list->entityIndex, domain, list->block_begin,
130                                    list->block_end,
131                                    list->block_end - list->block_begin + 1);
132                     break;
133                 case ResSparse:
134 -                   xf86ErrorFVerb(verb, "\t[%d] %d\t0x%08x - 0x%08x ",
135 -                                  i, list->entityIndex,
136 +                   xf86ErrorFVerb(verb, "\t[%d] %d %x\t0x%08x - 0x%08x ",
137 +                                  i, list->entityIndex, domain,
138                                    list->sparse_base,list->sparse_mask);
139                     break;
140                 default:
141 @@ -1408,6 +1443,9 @@
142         if (pRes != target
143             && ((pRes->res_type & ResPhysMask) ==
144                 (target->res_type & ResPhysMask))
145 +#ifdef HAVE_DOMAINS
146 +           && pRes->res_domain == target->res_domain
147 +#endif
148             && pRes->block_begin <= target->block_end
149             && pRes->block_end >= target->block_begin) {
150             /* Possibly ignore estimated resources */
151 @@ -1460,12 +1498,16 @@
152  #define ALIGN(x,a) ((x) + a) &~(a)
153  
154  resRange 
155 -xf86GetBlock(long type, memType size,
156 +xf86GetBlock(long type,
157 +#ifdef HAVE_DOMAINS
158 +        int domain,
159 +#endif
160 +        memType size,
161          memType window_start, memType window_end,
162          memType align_mask, resPtr avoid)
163  {
164      memType min, max, tmp;
165 -    resRange r = {ResEnd,0,0};
166 +    resRange r = _END;
167      resPtr res_range = ResRange;
168      
169      if (!size) return r;
170 @@ -1478,7 +1520,11 @@
171      type = (type & ~(ResExtMask | ResBios | ResEstimated)) | ResBlock;
172      
173      while (res_range) {
174 -       if (type & res_range->res_type & ResPhysMask) {
175 +       if ((type & res_range->res_type & ResPhysMask)
176 +#ifdef HAVE_DOMAINS
177 +           && (domain == res_range->res_domain)
178 +#endif
179 +               ) {
180             if (res_range->block_begin > window_start)
181                 min = res_range->block_begin;
182             else
183 @@ -1490,7 +1536,7 @@
184             min = ALIGN(min,align_mask);
185             /* do not produce an overflow! */
186             while (min < max && (max - min) >= (size - 1)) {
187 -               RANGE(r,min,min + size - 1,type);
188 +               RANGE(r,min,min + size - 1,type,domain);
189                 tmp = ChkConflict(&r,Acc,SETUP);
190                 if (!tmp) {
191                     tmp = ChkConflict(&r,avoid,SETUP);
192 @@ -1503,7 +1549,7 @@
193         }
194         res_range = res_range->next;
195      }
196 -    RANGE(r,0,0,ResEnd);
197 +    RANGE(r,0,0,ResEnd,domain);
198      return r;
199  }
200  
201 @@ -1557,10 +1603,14 @@
202  }
203  
204  resRange
205 -xf86GetSparse(long type,  memType fixed_bits,
206 +xf86GetSparse(long type,
207 +#ifdef HAVE_DOMAINS
208 +         int domain,
209 +#endif
210 +         memType fixed_bits,
211           memType decode_mask, memType address_mask, resPtr avoid)
212  {
213 -    resRange r = {ResEnd,0,0};
214 +    resRange r = _END;
215      memType new_mask;
216      memType mask1;
217      memType base;
218 @@ -1602,7 +1652,7 @@
219       */
220      while (1) {
221         base = make_base(counter,new_mask) | fixed_bits;
222 -       RANGE(r,base,address_mask,type);
223 +       RANGE(r,base,address_mask,type,domain);
224         conflict = ChkConflict(&r,Acc,SETUP);
225         if (!conflict) {
226             conflict = ChkConflict(&r,avoid,SETUP);
227 @@ -1617,7 +1667,7 @@
228         if (counter > max_counter) break;
229      }
230      if (!new_mask && (new_mask == decode_mask)) {
231 -       RANGE(r,0,0,ResEnd);
232 +       RANGE(r,0,0,ResEnd,domain);
233         return r;
234      }
235      /*
236 @@ -1640,7 +1690,7 @@
237         counter1 = 0;
238         while (1) {
239             base = make_base(counter1,mask1);
240 -           RANGE(r,base,address_mask,type);
241 +           RANGE(r,base,address_mask,type,domain);
242             conflict = ChkConflict(&r,Acc,SETUP);
243             if (!conflict) {
244                 conflict = ChkConflict(&r,avoid,SETUP);
245 @@ -1655,7 +1705,7 @@
246         counter ++;
247         if (counter > max_counter) break;
248      }
249 -    RANGE(r,0,0,ResEnd);
250 +    RANGE(r,0,0,ResEnd,domain);
251      return r;
252  }
253  
254 @@ -2686,6 +2736,9 @@
255      int i = 0;
256      
257      new.type = (range.type & ~ResExtMask) | ResSparse;
258 +#ifdef HAVE_DOMAINS
259 +    new.domain = range.domain;
260 +#endif
261  
262      while (1) {
263         if (val & 0x01) {
264 @@ -2726,7 +2779,11 @@
265      
266      if (list1) {
267         list = list1;
268 -       if (range.type & list->res_type & ResPhysMask) {
269 +       if ((range.type & list->res_type & ResPhysMask)
270 +#ifdef HAVE_DOMAINS
271 +           && (range.domain == list->res_domain)
272 +#endif
273 +               ) {
274             switch (range.type & ResExtMask) {
275             case ResBlock:
276                 if ((list->res_type & ResExtMask) == ResBlock) {
277 @@ -2736,21 +2793,21 @@
278                     else if (range.rBegin < list->block_begin
279                              && range.rEnd > list->block_end) {
280                         RANGE(range1, range.rBegin, list->block_begin - 1,
281 -                             range.type);
282 +                             range.type, range.domain);
283                         RANGE(range2, list->block_end + 1, range.rEnd,
284 -                             range.type);
285 +                             range.type, range.domain);
286                         return (x_isSubsetOf(range1,list->next,list2) &&
287                                 x_isSubsetOf(range2,list->next,list2));
288                     }
289                     else if (range.rBegin >= list->block_begin
290                              && range.rBegin <= list->block_end) {
291                         RANGE(range1, list->block_end + 1, range.rEnd,
292 -                             range.type);
293 +                             range.type, range.domain);
294                         return (x_isSubsetOf(range1,list->next,list2));
295                     } else if (range.rEnd >= list->block_begin
296                                && range.rEnd <= list->block_end) {
297                         RANGE(range1,range.rBegin, list->block_begin - 1,
298 -                             range.type);
299 +                             range.type, range.domain);
300                         return (x_isSubsetOf(range1,list->next,list2));
301                     } 
302                 }
303 @@ -2791,7 +2848,7 @@
304                                   | ((~list->sparse_base & list->sparse_mask)
305                                      & ~range.rMask)) & range1.rMask,
306                                   ((range.rMask | list->sparse_mask) & ~test)
307 -                                 | (1 << i), range.type);
308 +                                 | (1 << i), range.type, range.domain);
309                             return (x_isSubsetOf(range1,list->next,list2));
310                         }
311                     }
312 @@ -2885,7 +2942,11 @@
313      resPtr new = NULL;
314      
315      while (list) {
316 -           if (Range.type & list->res_type & ResPhysMask) {
317 +           if ((Range.type & list->res_type & ResPhysMask)
318 +#ifdef HAVE_DOMAINS
319 +               && (Range.domain == list->res_domain)
320 +#endif
321 +                   ) {
322                 switch (Range.type & ResExtMask) {
323                 case ResBlock:
324                     switch (list->res_type & ResExtMask) {
325 @@ -2900,6 +2961,9 @@
326                             range.rEnd = list->block_end;
327                         if (range.rEnd > range.rBegin) {
328                             range.type = Range.type;
329 +#ifdef HAVE_DOMAINS
330 +                           range.domain = Range.domain;
331 +#endif
332                             new = xf86AddResToList(new,&range,-1);
333                         }
334                         break;
335 @@ -2917,7 +2981,7 @@
336                                   | (~range.rMask & list->sparse_base)
337                                   | (~list->sparse_mask & range.rBase),
338                                   range.rMask | list->sparse_mask,
339 -                                 Range.type);
340 +                                 Range.type, Range.domain);
341                             new = xf86AddResToList(new,&range,-1);
342                         }
343                         break;
344 @@ -2956,11 +3020,11 @@
345      switch (Range.type & ResExtMask) {
346      case ResBlock:
347         if (Range.rBegin > 0) {
348 -           RANGE(range, 0, Range.rBegin - 1, Range.type);
349 +           RANGE(range, 0, Range.rBegin - 1, Range.type,Range.domain);
350             new = xf86AddResToList(new,&range,-1);
351         }
352         if (Range.rEnd < (memType)~0) {
353 -           RANGE(range,Range.rEnd + 1, (memType)~0, Range.type);
354 +           RANGE(range,Range.rEnd + 1, (memType)~0, Range.type, Range.domain);
355             new = xf86AddResToList(new,&range,-1);
356         }
357         break;
358 @@ -2968,7 +3032,7 @@
359         tmp = Range.rMask;
360         for (i = 0; i < sizeof(memType); i++) {
361             if (tmp & 0x1) {
362 -               RANGE(range,(~Range.rMask & range.rMask),(1 << i), Range.type);
363 +               RANGE(range,(~Range.rMask & range.rMask),(1 << i), Range.type, Range.domain);
364                 new = xf86AddResToList(new,&range,-1);
365             }
366         }
367 @@ -2991,6 +3055,21 @@
368      }
369      return ret;
370  }
371 +
372 +#ifdef HAVE_DOMAINS
373 +resPtr
374 +xf86ExtractDomainFromList(resPtr list, unsigned int domain)
375 +{
376 +    resPtr ret = NULL;
377 +    
378 +    while (list) {
379 +       if (list->res_domain == domain)
380 +           ret = xf86AddResToList(ret,&(list->val),list->entityIndex);
381 +       list = list->next;
382 +    }
383 +    return ret;
384 +}
385 +#endif
386  
387  /*------------------------------------------------------------*/
388  static void CheckGenericGA(void);
389 --- XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/common/xf86Bus.h.~1~   Sun Jun  3 19:44:40 2001
390 +++ XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/common/xf86Bus.h       Sun Jun  3 19:44:48 2001
391 @@ -123,6 +123,9 @@
392  Bool xf86IsSubsetOf(resRange range, resPtr list);
393  Bool xf86IsListSubsetOf(resPtr list, resPtr BaseList);
394  resPtr xf86ExtractTypeFromList(resPtr list, unsigned long type);
395 +#ifdef HAVE_DOMAINS
396 +resPtr xf86ExtractDomainFromList(resPtr list, unsigned int domain);
397 +#endif
398  resPtr findIntersect(resRange Range, resPtr list);
399  resPtr xf86FindIntersect(resRange Range, resPtr list);
400  void RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment,
401 --- XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/common/xf86Resources.h~        Tue Jul 31 23:17:31 2001
402 +++ XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/common/xf86Resources.h Tue Jul 31 23:17:33 2001
403 @@ -6,78 +6,84 @@
404  
405  #include "xf86str.h"
406  
407 -#define _END {ResEnd,0,0}
408 +#ifdef HAVE_DOMAINS
409 +#define DEFAULT_DOMAIN 0,
410 +#else
411 +#define DEFAULT_DOMAIN /**/
412 +#endif
413 +
414 +#define _END {ResEnd, DEFAULT_DOMAIN 0,0}
415  
416  #define _VGA_EXCLUSIVE \
417 -               {ResExcMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\
418 -               {ResExcMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\
419 -               {ResExcMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\
420 -               {ResExcIoBlock  | ResBios | ResBus,     0x03B0,     0x03BB},\
421 -               {ResExcIoBlock  | ResBios | ResBus,     0x03C0,     0x03DF}
422 +               {ResExcMemBlock | ResBios | ResBus, DEFAULT_DOMAIN 0x000A0000, 0x000AFFFF},\
423 +               {ResExcMemBlock | ResBios | ResBus, DEFAULT_DOMAIN 0x000B0000, 0x000B7FFF},\
424 +               {ResExcMemBlock | ResBios | ResBus, DEFAULT_DOMAIN 0x000B8000, 0x000BFFFF},\
425 +               {ResExcIoBlock  | ResBios | ResBus, DEFAULT_DOMAIN     0x03B0,     0x03BB},\
426 +               {ResExcIoBlock  | ResBios | ResBus, DEFAULT_DOMAIN     0x03C0,     0x03DF}
427  
428  #define _VGA_SHARED \
429 -               {ResShrMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\
430 -               {ResShrMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\
431 -               {ResShrMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\
432 -               {ResShrIoBlock  | ResBios | ResBus,     0x03B0,     0x03BB},\
433 -               {ResShrIoBlock  | ResBios | ResBus,     0x03C0,     0x03DF}
434 +               {ResShrMemBlock | ResBios | ResBus, DEFAULT_DOMAIN 0x000A0000, 0x000AFFFF},\
435 +               {ResShrMemBlock | ResBios | ResBus, DEFAULT_DOMAIN 0x000B0000, 0x000B7FFF},\
436 +               {ResShrMemBlock | ResBios | ResBus, DEFAULT_DOMAIN 0x000B8000, 0x000BFFFF},\
437 +               {ResShrIoBlock  | ResBios | ResBus, DEFAULT_DOMAIN     0x03B0,     0x03BB},\
438 +               {ResShrIoBlock  | ResBios | ResBus, DEFAULT_DOMAIN     0x03C0,     0x03DF}
439  
440  #define _VGA_SHARED_MEM \
441 -               {ResShrMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\
442 -               {ResShrMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\
443 -               {ResShrMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF}
444 +               {ResShrMemBlock | ResBios | ResBus, DEFAULT_DOMAIN 0x000A0000, 0x000AFFFF},\
445 +               {ResShrMemBlock | ResBios | ResBus, DEFAULT_DOMAIN 0x000B0000, 0x000B7FFF},\
446 +               {ResShrMemBlock | ResBios | ResBus, DEFAULT_DOMAIN 0x000B8000, 0x000BFFFF}
447  
448  #define _VGA_SHARED_IO \
449 -               {ResShrIoBlock  | ResBios | ResBus,     0x03B0,     0x03BB},\
450 -               {ResShrIoBlock  | ResBios | ResBus,     0x03C0,     0x03DF}
451 +               {ResShrIoBlock  | ResBios | ResBus, DEFAULT_DOMAIN     0x03B0,     0x03BB},\
452 +               {ResShrIoBlock  | ResBios | ResBus, DEFAULT_DOMAIN     0x03C0,     0x03DF}
453  
454  /*
455   * Exclusive unused VGA:  resources unneeded but cannot be disabled.
456   * Like old Millennium.
457   */
458  #define _VGA_EXCLUSIVE_UNUSED \
459 -       {ResExcUusdMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\
460 -       {ResExcUusdMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\
461 -       {ResExcUusdMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\
462 -       {ResExcUusdIoBlock  | ResBios | ResBus,     0x03B0,     0x03BB},\
463 -       {ResExcUusdIoBlock  | ResBios | ResBus,     0x03C0,     0x03DF}
464 +       {ResExcUusdMemBlock | ResBios | ResBus, DEFAULT_DOMAIN 0x000A0000, 0x000AFFFF},\
465 +       {ResExcUusdMemBlock | ResBios | ResBus, DEFAULT_DOMAIN 0x000B0000, 0x000B7FFF},\
466 +       {ResExcUusdMemBlock | ResBios | ResBus, DEFAULT_DOMAIN 0x000B8000, 0x000BFFFF},\
467 +       {ResExcUusdIoBlock  | ResBios | ResBus, DEFAULT_DOMAIN     0x03B0,     0x03BB},\
468 +       {ResExcUusdIoBlock  | ResBios | ResBus, DEFAULT_DOMAIN     0x03C0,     0x03DF}
469  
470  /*
471   * Shared unused VGA:  resources unneeded but cannot be disabled
472   * independently.  This is used to determine if a device needs RAC.
473   */
474  #define _VGA_SHARED_UNUSED \
475 -       {ResShrUusdMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\
476 -       {ResShrUusdMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\
477 -       {ResShrUusdMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\
478 -       {ResShrUusdIoBlock  | ResBios | ResBus,     0x03B0,     0x03BB},\
479 -       {ResShrUusdIoBlock  | ResBios | ResBus,     0x03C0,     0x03DF}
480 +       {ResShrUusdMemBlock | ResBios | ResBus, DEFAULT_DOMAIN 0x000A0000, 0x000AFFFF},\
481 +       {ResShrUusdMemBlock | ResBios | ResBus, DEFAULT_DOMAIN 0x000B0000, 0x000B7FFF},\
482 +       {ResShrUusdMemBlock | ResBios | ResBus, DEFAULT_DOMAIN 0x000B8000, 0x000BFFFF},\
483 +       {ResShrUusdIoBlock  | ResBios | ResBus, DEFAULT_DOMAIN     0x03B0,     0x03BB},\
484 +       {ResShrUusdIoBlock  | ResBios | ResBus, DEFAULT_DOMAIN     0x03C0,     0x03DF}
485  
486  /*
487   * Sparse versions of the above for those adapters that respond to all ISA
488   * aliases of VGA ports.
489   */
490  #define _VGA_EXCLUSIVE_SPARSE \
491 -       {ResExcMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\
492 -       {ResExcMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\
493 -       {ResExcMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\
494 -       {ResExcIoSparse | ResBios | ResBus,     0x03B0,     0x03F8},\
495 -       {ResExcIoSparse | ResBios | ResBus,     0x03B8,     0x03FC},\
496 -       {ResExcIoSparse | ResBios | ResBus,     0x03C0,     0x03E0}
497 +       {ResExcMemBlock | ResBios | ResBus, DEFAULT_DOMAIN 0x000A0000, 0x000AFFFF},\
498 +       {ResExcMemBlock | ResBios | ResBus, DEFAULT_DOMAIN 0x000B0000, 0x000B7FFF},\
499 +       {ResExcMemBlock | ResBios | ResBus, DEFAULT_DOMAIN 0x000B8000, 0x000BFFFF},\
500 +       {ResExcIoSparse | ResBios | ResBus, DEFAULT_DOMAIN     0x03B0,     0x03F8},\
501 +       {ResExcIoSparse | ResBios | ResBus, DEFAULT_DOMAIN     0x03B8,     0x03FC},\
502 +       {ResExcIoSparse | ResBios | ResBus, DEFAULT_DOMAIN     0x03C0,     0x03E0}
503  
504  #define _VGA_SHARED_SPARSE \
505 -       {ResShrMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\
506 -       {ResShrMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\
507 -       {ResShrMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\
508 -       {ResShrIoSparse | ResBios | ResBus,     0x03B0,     0x03F8},\
509 -       {ResShrIoSparse | ResBios | ResBus,     0x03B8,     0x03FC},\
510 -       {ResShrIoSparse | ResBios | ResBus,     0x03C0,     0x03E0}
511 +       {ResShrMemBlock | ResBios | ResBus, DEFAULT_DOMAIN 0x000A0000, 0x000AFFFF},\
512 +       {ResShrMemBlock | ResBios | ResBus, DEFAULT_DOMAIN 0x000B0000, 0x000B7FFF},\
513 +       {ResShrMemBlock | ResBios | ResBus, DEFAULT_DOMAIN 0x000B8000, 0x000BFFFF},\
514 +       {ResShrIoSparse | ResBios | ResBus, DEFAULT_DOMAIN     0x03B0,     0x03F8},\
515 +       {ResShrIoSparse | ResBios | ResBus, DEFAULT_DOMAIN     0x03B8,     0x03FC},\
516 +       {ResShrIoSparse | ResBios | ResBus, DEFAULT_DOMAIN     0x03C0,     0x03E0}
517  
518  #define _8514_EXCLUSIVE \
519 -       {ResExcIoSparse | ResBios | ResBus, 0x02E8, 0x03F8}
520 +       {ResExcIoSparse | ResBios | ResBus, DEFAULT_DOMAIN 0x02E8, 0x03F8}
521  
522  #define _8514_SHARED \
523 -       {ResShrIoSparse | ResBios | ResBus, 0x02E8, 0x03F8}
524 +       {ResShrIoSparse | ResBios | ResBus, DEFAULT_DOMAIN 0x02E8, 0x03F8}
525  
526  /* predefined resources */
527  extern resRange resVgaExclusive[];
528 @@ -102,9 +108,9 @@
529  #define RES_SHARED_8514     res8514Shared
530  
531  #define _PCI_AVOID_PC_STYLE \
532 -       {ResExcIoSparse | ResBus, 0x0100, 0x0300},\
533 -       {ResExcIoSparse | ResBus, 0x0200, 0x0200},\
534 -        {ResExcMemBlock | ResBus, 0xA0000,0xFFFFF}
535 +       {ResExcIoSparse | ResBus, DEFAULT_DOMAIN 0x0100, 0x0300},\
536 +       {ResExcIoSparse | ResBus, DEFAULT_DOMAIN 0x0200, 0x0200},\
537 +        {ResExcMemBlock | ResBus, DEFAULT_DOMAIN 0xA0000,0xFFFFF}
538  
539  extern resRange PciAvoid[];
540  
541 --- XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c.~1~        Sun Jun  3 19:44:40 2001
542 +++ XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c    Sun Jun  3 19:44:48 2001
543 @@ -91,9 +91,9 @@
544                          ? pciBusAddrToHostAddr(tag,PCI_MEM_SIZE,size) \
545                          : pciBusAddrToHostAddr(tag,PCI_IO_SIZE,size))
546  #define PCI_M_RANGE(range,tag,begin,end,type) \
547 -                            { RANGE(range,B2M(tag,begin),B2M(tag,end),type); }
548 +        { RANGE(range,B2M(tag,begin),B2M(tag,end),type,xf86GetPciDomain(tag)); }
549  #define PCI_I_RANGE(range,tag,begin,end,type) \
550 -                            { RANGE(range,B2I(tag,begin),B2I(tag,end),type); }
551 +        { RANGE(range,B2I(tag,begin),B2I(tag,end),type,xf86GetPciDomain(tag)); }
552  #define PCI_X_RANGE(range,tag,begin,end,type) \
553  { if (type & ResMem)  PCI_M_RANGE(range,tag,begin,end,type); \
554                  else PCI_I_RANGE(range,tag,begin,end,type); } 
555 @@ -1039,9 +1039,15 @@
556      PciBusPtr pbp = xf86PciBus, pbp1 = xf86PciBus;
557      pciConfigPtr pcp;
558      resPtr tmp;
559 +#ifdef HAVE_DOMAINS
560 +    int domain;
561 +#endif
562      
563      if (!pvp) return FALSE;
564      tag = pciTag(pvp->bus,pvp->device,pvp->func);
565 +#ifdef HAVE_DOMAINS
566 +    domain = xf86GetPciDomain(tag);
567 +#endif
568      pcp = pvp->thisCard;
569  
570      type &= ResAccMask;
571 @@ -1232,12 +1238,20 @@
572  #endif
573      w_tmp = w;
574      while (w) {
575 -       if (type & w->res_type & ResPhysMask) {
576 +       if ((type & w->res_type & ResPhysMask)
577 +#ifdef HAVE_DOMAINS
578 +           && (domain == w->res_domain)
579 +#endif
580 +               ) {
581  #ifdef DEBUG
582             ErrorF("block_begin: 0x%lx block_end: 0x%lx\n",w->block_begin,
583                    w->block_end);
584  #endif
585 -           range = xf86GetBlock(type,PCI_SIZE(type,tag,alignment + 1),
586 +           range = xf86GetBlock(type,
587 +#ifdef HAVE_DOMAINS
588 +                                domain,
589 +#endif
590 +                                PCI_SIZE(type,tag,alignment + 1),
591                                  w->block_begin, w->block_end,
592                                  PCI_SIZE(type,tag,alignment),avoid);
593             if (range.type != ResEnd)
594 @@ -1250,12 +1264,20 @@
595      if (range.type == ResEnd && w_2nd) {
596         w_tmp = w_2nd;
597         while (w_2nd) {
598 -           if (type & w_2nd->res_type & ResPhysMask) {
599 +           if ((type & w_2nd->res_type & ResPhysMask)
600 +#ifdef HAVE_DOMAINS
601 +               && (domain == w_2nd->res_domain)
602 +#endif
603 +                   ) {
604  #ifdef DEBUG
605             ErrorF("block_begin: 0x%lx block_end: 0x%lx\n",w_2nd->block_begin,
606                    w_2nd->block_end);
607  #endif
608 -           range = xf86GetBlock(type,PCI_SIZE(type,tag,alignment + 1),
609 +           range = xf86GetBlock(type,
610 +#ifdef HAVE_DOMAINS
611 +                                domain,
612 +#endif
613 +                                PCI_SIZE(type,tag,alignment + 1),
614                                  w_2nd->block_begin, w_2nd->block_end,
615                                  PCI_SIZE(type,tag,alignment),avoid);
616                 if (range.type != ResEnd)
617 @@ -1323,7 +1345,7 @@
618  
619  Bool
620  xf86FixPciResource(int entityIndex, int prt, memType alignment,
621 -                   long type)
622 +                  long type)
623  {
624      pciVideoPtr pvp = xf86GetPciInfoForEntity(entityIndex);
625      return fixPciResource(prt, alignment, pvp, type);
626 @@ -1481,6 +1503,9 @@
627          */
628          while (m) {
629              range = xf86GetBlock(ResExcMemBlock,
630 +#ifdef HAVE_DOMAINS
631 +                                 xf86GetPciDomain(TAG(pvp)),
632 +#endif
633                                   PCI_SIZE(ResMem, TAG(pvp), 1 << biosSize),
634                                   m->block_begin, m->block_end,
635                                   PCI_SIZE(ResMem, TAG(pvp), alignment), 
636 @@ -1730,10 +1755,9 @@
637      PciBusPtr *pnPciBus = &PciBusBase;
638      int MaxBus = 0;
639      int i;
640 +    int domain = 0;
641      memType base, limit;
642  
643 -    resPtr pciBusAccWindows = xf86PciBusAccWindowsFromOS();
644 -
645      if (pciInfo == NULL) return NULL;
646      
647      /* Add each PCI-PCI bridge */
648 @@ -1856,13 +1880,25 @@
649                 PciBus->secondary = -1; /* to be set below */
650                 PciBus->subclass = sub_class;
651                 PciBus->brcontrol = PCI_PCI_BRIDGE_VGA_EN;
652 +#ifdef HAVE_DOMAINS
653 +               domain = xf86GetPciDomain(pcrp->tag);
654 +#endif
655 +               /* XXX A memory leak has returned here... -DaveM */
656                 PciBus->preferred_io = xf86ExtractTypeFromList(
657 -                   pciBusAccWindows,ResIo);
658 +                   xf86PciBusAccWindowsFromOS(domain),ResIo);
659                 PciBus->preferred_mem = xf86ExtractTypeFromList(
660 -                   pciBusAccWindows,ResMem);
661 +                   xf86PciBusAccWindowsFromOS(domain),ResMem);
662                 PciBus->preferred_pmem = xf86ExtractTypeFromList(
663 -                   pciBusAccWindows,ResMem);
664 +                   xf86PciBusAccWindowsFromOS(domain),ResMem);
665                 xf86MsgVerb(X_INFO,3,"Host-to-PCI bridge:\n");
666 +#ifdef DEBUG
667 +               xf86MsgVerb(X_INFO,3,"Preferred I/O:\n");
668 +               xf86PrintResList(3,PciBus->preferred_io);
669 +               xf86MsgVerb(X_INFO,3,"Preferred MEM:\n");
670 +               xf86PrintResList(3,PciBus->preferred_mem);
671 +               xf86MsgVerb(X_INFO,3,"Preferred Prefetchable MEM:\n");
672 +               xf86PrintResList(3,PciBus->preferred_pmem);
673 +#endif
674                 break;
675             default:
676                 break;
677 @@ -1892,12 +1928,23 @@
678                 PciBus->primary = -1;
679                 PciBus->secondary = i;
680                 PciBus->subclass = PCI_SUBCLASS_BRIDGE_HOST;
681 +
682 +#ifdef HAVE_DOMAINS
683 +               /* Find a device on this bus. */
684 +               for (pcrpp = pciInfo, pcrp = *pcrpp; pcrp; pcrp = *(++pcrpp)) {
685 +                       if (pcrp->busnum == i)
686 +                               break;
687 +               }
688 +
689 +               if (pcrp) domain = xf86GetPciDomain(pcrp->tag);
690 +#endif
691 +               /* XXX A memory leak has returned here... -DaveM */
692                 PciBus->preferred_io = xf86ExtractTypeFromList(
693 -                   pciBusAccWindows,ResIo);
694 +                   xf86PciBusAccWindowsFromOS(domain),ResIo);
695                 PciBus->preferred_mem = xf86ExtractTypeFromList(
696 -                   pciBusAccWindows,ResMem);
697 +                   xf86PciBusAccWindowsFromOS(domain),ResMem);
698                 PciBus->preferred_pmem = xf86ExtractTypeFromList(
699 -                   pciBusAccWindows,ResMem);
700 +                   xf86PciBusAccWindowsFromOS(domain),ResMem);
701                 xf86MsgVerb(X_INFO,3,"Host-to-PCI bridge:\n");
702             }
703         }
704 @@ -1928,7 +1975,6 @@
705         printBridgeInfo(PciBus);
706      }
707      
708 -    xf86FreeResList(pciBusAccWindows);
709      return PciBusBase;
710      
711  }
712 --- XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/common/xf86str.h.~1~   Sun Jun  3 19:44:40 2001
713 +++ XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/common/xf86str.h       Sun Jun  3 19:44:48 2001
714 @@ -593,15 +593,27 @@
715  
716  typedef struct {
717      long type;     /* shared, exclusive, unused etc. */
718 +#ifdef HAVE_DOMAINS
719 +    unsigned int domain;
720 +#endif
721      memType a;
722      memType b;
723  } resRange, *resList;
724  
725 -#define RANGE(r,u,v,t) {\
726 +#ifdef HAVE_DOMAINS
727 +#define RANGE(r,u,v,t,d) {\
728                         (r).a = (u);\
729                         (r).b = (v);\
730                         (r).type = t;\
731 +                       (r).domain = d;\
732                         }
733 +#else
734 +#define RANGE(r,u,v,t,d) {\
735 +                       (r).a = (u);\
736 +                       (r).b = (v);\
737 +                       (r).type = t;\
738 +                       }
739 +#endif
740  
741  #define rBase a
742  #define rMask b
743 @@ -621,6 +633,9 @@
744  #define block_begin    val.rBegin
745  #define block_end      val.rEnd
746  #define res_type       val.type
747 +#ifdef HAVE_DOMAINS
748 +#define res_domain     val.domain
749 +#endif
750  
751  typedef struct {
752      int numChipset;
753 --- XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile.~1~      Sun Jun  3 19:44:41 2001
754 +++ XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile  Sun Jun  3 19:44:48 2001
755 @@ -87,12 +87,12 @@
756  # ifndef ATIAvoidCPIO
757  #  define ATIAvoidCPIO NO
758  # endif
759 -#elif defined(SparcArchitecture) || 1
760 +#elif 1
761  # undef ATIAvoidCPIO    /* Clobber any previous setting */
762  # define ATIAvoidCPIO YES
763  #endif
764  
765 -#if defined(PpcArchitecture)
766 +#if defined(PpcArchitecture) || defined(SparcArchitecture)
767  # undef ATIAvoidNonPCI
768  # define ATIAvoidNonPCI YES
769  #elif !defined(ATIAvoidNonPCI)
770 --- XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c.~1~    Sun Jun  3 19:44:41 2001
771 +++ XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c        Sun Jun  3 19:44:48 2001
772 @@ -27,6 +27,7 @@
773  #include "aticursor.h"
774  #include "atioption.h"
775  #include "atistruct.h"
776 +#include "atichip.h"
777  
778  /*
779   * Non-publicised XF86Config options.
780 @@ -122,6 +123,11 @@
781      }
782  
783      ReferenceClock = ((double)157500000.0) / ((double)11.0);
784 +#ifdef __sparc__
785 +    if (pATI->Chip == ATI_CHIP_264XL)
786 +           ReferenceClock = ((double)315000000.0) / ((double)11.0);
787 +    CSync = TRUE;
788 +#endif
789  
790  #ifndef AVOID_CPIO
791  
792 --- XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c.~1~    Sun Jun  3 19:44:41 2001
793 +++ XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c        Sun Jun  3 19:44:48 2001
794 @@ -1602,6 +1602,24 @@
795           */
796          switch (iDWord)
797          {
798 +#if X_BYTE_ORDER == X_BIG_ENDIAN
799 +           case  0:  xf86WriteMmio32Be(pDst +  0, 0, *(pSrc +  0));
800 +           case  1:  xf86WriteMmio32Be(pDst +  1, 0, *(pSrc +  1));
801 +           case  2:  xf86WriteMmio32Be(pDst +  2, 0, *(pSrc +  2));
802 +           case  3:  xf86WriteMmio32Be(pDst +  3, 0, *(pSrc +  3));
803 +           case  4:  xf86WriteMmio32Be(pDst +  4, 0, *(pSrc +  4));
804 +           case  5:  xf86WriteMmio32Be(pDst +  5, 0, *(pSrc +  5));
805 +           case  6:  xf86WriteMmio32Be(pDst +  6, 0, *(pSrc +  6));
806 +           case  7:  xf86WriteMmio32Be(pDst +  7, 0, *(pSrc +  7));
807 +           case  8:  xf86WriteMmio32Be(pDst +  8, 0, *(pSrc +  8));
808 +           case  9:  xf86WriteMmio32Be(pDst +  9, 0, *(pSrc +  9));
809 +           case 10:  xf86WriteMmio32Be(pDst + 10, 0, *(pSrc + 10));
810 +           case 11:  xf86WriteMmio32Be(pDst + 11, 0, *(pSrc + 11));
811 +           case 12:  xf86WriteMmio32Be(pDst + 12, 0, *(pSrc + 12));
812 +           case 13:  xf86WriteMmio32Be(pDst + 13, 0, *(pSrc + 13));
813 +           case 14:  xf86WriteMmio32Be(pDst + 14, 0, *(pSrc + 14));
814 +           case 15:  xf86WriteMmio32Be(pDst + 15, 0, *(pSrc + 15));
815 +#else
816              case  0:  MMIO_OUT32(pDst +  0, 0, *(pSrc +  0));
817              case  1:  MMIO_OUT32(pDst +  1, 0, *(pSrc +  1));
818              case  2:  MMIO_OUT32(pDst +  2, 0, *(pSrc +  2));
819 @@ -1618,6 +1636,7 @@
820              case 13:  MMIO_OUT32(pDst + 13, 0, *(pSrc + 13));
821              case 14:  MMIO_OUT32(pDst + 14, 0, *(pSrc + 14));
822              case 15:  MMIO_OUT32(pDst + 15, 0, *(pSrc + 15));
823 +#endif
824  
825              default:    /* Muffle compiler */
826                  break;
827 --- XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c.~1~       Sun Jun  3 19:44:41 2001
828 +++ XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c   Sun Jun  3 19:44:48 2001
829 @@ -17,22 +17,34 @@
830  
831  resRange PciAvoid[] = {_PCI_AVOID_PC_STYLE, _END};
832  
833 +#define MIN_SYSTEM_DOMAIN      0
834 +#ifdef HAVE_DOMAINS
835 +#define MAX_SYSTEM_DOMAIN      255
836 +#else
837 +#define MAX_SYSTEM_DOMAIN      0
838 +#endif
839 +#define ISA_SYSTEM_DOMAIN      0
840 +
841  resPtr
842  xf86BusAccWindowsFromOS(void)
843  {
844      resPtr ret = NULL;
845      resRange range;
846 +    int domain;
847  
848 -    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
849 -    ret = xf86AddResToList(ret, &range, -1);
850 +    for (domain = MIN_SYSTEM_DOMAIN; domain <= MAX_SYSTEM_DOMAIN; domain++) {
851 +       RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock, domain);
852 +       ret = xf86AddResToList(ret, &range, -1);
853 +
854 +       RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock, domain);
855 +       ret = xf86AddResToList(ret, &range, -1);
856 +    }
857  
858 -    RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock);
859 -    ret = xf86AddResToList(ret, &range, -1);
860      return ret;
861  }
862  
863  resPtr
864 -xf86PciBusAccWindowsFromOS(void)
865 +xf86PciBusAccWindowsFromOS(int domain)
866  {
867      resPtr ret = NULL;
868      resRange range;
869 @@ -44,10 +56,10 @@
870       * region 0x40000000-0xbfffffff for DMA but this only matters if
871       * the bios screws up the pci region mappings.
872       */
873 -    RANGE(range, 0x80000000, 0xffffffff, ResExcMemBlock);
874 +    RANGE(range, 0x80000000, 0xffffffff, ResExcMemBlock, domain);
875      ret = xf86AddResToList(ret, &range, -1);
876  
877 -    RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock);
878 +    RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock, domain);
879      ret = xf86AddResToList(ret, &range, -1);
880      return ret;
881  }
882 @@ -58,10 +70,10 @@
883      resPtr ret = NULL;
884      resRange range;
885  
886 -    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
887 +    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock, ISA_SYSTEM_DOMAIN);
888      ret = xf86AddResToList(ret, &range, -1);
889  
890 -    RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock);
891 +    RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock, ISA_SYSTEM_DOMAIN);
892      ret = xf86AddResToList(ret, &range, -1);
893      return ret;
894  }
895 @@ -70,6 +82,14 @@
896  xf86AccResFromOS(resPtr ret)
897  {
898      resRange range;
899 +#ifdef HAVE_DOMAINS
900 +    int domain = MIN_SYSTEM_DOMAIN;
901 +#endif
902 +
903 +#ifdef HAVE_DOMAINS
904 +    if (ret != NULL)
905 +       domain = ret->res_domain;
906 +#endif
907  
908      /*
909       * Fallback is to claim the following areas:
910 @@ -77,7 +97,7 @@
911       * 0x000c0000 - 0x000effff  location of VGA and other extensions ROMS
912       */
913  
914 -    RANGE(range, 0x000c0000, 0x000effff, ResExcMemBlock);
915 +    RANGE(range, 0x000c0000, 0x000effff, ResExcMemBlock, domain);
916      ret = xf86AddResToList(ret, &range, -1);
917  
918      /*
919 @@ -85,20 +105,20 @@
920       * along with their sparse I/O aliases, but that's too imprecise.  Instead
921       * claim a bare minimum here.
922       */
923 -    RANGE(range, 0x00000000, 0x000000ff, ResExcIoBlock); /* For mainboard */
924 +    RANGE(range, 0x00000000, 0x000000ff, ResExcIoBlock, domain); /* For mainboard */
925      ret = xf86AddResToList(ret, &range, -1);
926  
927      /*
928       * At minimum, the top and bottom resources must be claimed, so that
929       * resources that are (or appear to be) unallocated can be relocated.
930       */
931 -    RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock);
932 +    RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock, domain);
933      ret = xf86AddResToList(ret, &range, -1);
934 -    RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock);
935 +    RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock, domain);
936      ret = xf86AddResToList(ret, &range, -1);
937 -/*  RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock);
938 +/*  RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock, domain);
939      ret = xf86AddResToList(ret, &range, -1); */
940 -    RANGE(range, 0xffffffff, 0xffffffff, ResExcIoBlock);
941 +    RANGE(range, 0xffffffff, 0xffffffff, ResExcIoBlock, domain);
942      ret = xf86AddResToList(ret, &range, -1);
943  
944      /* XXX add others */
945 @@ -109,30 +129,38 @@
946  
947  resRange PciAvoid[] = {_PCI_AVOID_PC_STYLE, _END};
948  
949 +#define MIN_SYSTEM_DOMAIN      0
950 +#define MAX_SYSTEM_DOMAIN      0
951 +#define ISA_SYSTEM_DOMAIN      0
952 +
953  resPtr
954  xf86BusAccWindowsFromOS(void)
955  {
956      resPtr ret = NULL;
957      resRange range;
958 +    int domain;
959  
960 -    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
961 -    ret = xf86AddResToList(ret, &range, -1);
962 +    for (domain = MIN_SYSTEM_DOMAIN; domain <= MAX_SYSTEM_DOMAIN; domain++) {
963 +       RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock, domain);
964 +       ret = xf86AddResToList(ret, &range, -1);
965 +
966 +       RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock, domain);
967 +       ret = xf86AddResToList(ret, &range, -1);
968 +    }
969  
970 -    RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock);
971 -    ret = xf86AddResToList(ret, &range, -1);
972      return ret;
973  }
974  
975  resPtr
976 -xf86PciBusAccWindowsFromOS(void)
977 +xf86PciBusAccWindowsFromOS(int domain)
978  {
979      resPtr ret = NULL;
980      resRange range;
981  
982 -    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
983 +    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock, domain);
984      ret = xf86AddResToList(ret, &range, -1);
985  
986 -    RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock);
987 +    RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock, domain);
988      ret = xf86AddResToList(ret, &range, -1);
989      return ret;
990  }
991 --- XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile.~1~   Sun Jun  3 19:44:41 2001
992 +++ XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile       Sun Jun  3 19:44:48 2001
993 @@ -14,8 +14,16 @@
994  PCIDRVRSRC = axpPci.c
995  PCIDRVROBJ = axpPci.o
996  
997 -#elif (defined(LinuxArchitecture) || defined(SunArchitecture)) && \
998 -      defined(SparcArchitecture)
999 +#elif defined(LinuxArchitecture) && defined(SparcArchitecture)
1000 +
1001 +XCOMM Sparc SBUS driver, generic linux PCI driver
1002 +
1003 +PCIDRVRSRC = linuxPci.c
1004 +PCIDRVROBJ = linuxPci.o
1005 +SBUSDRVSRC = Sbus.c
1006 +SBUSDRVOBJ = Sbus.o
1007 +
1008 +#elif defined(SunArchitecture) && defined(SparcArchitecture)
1009  
1010  XCOMM Sparc PCI driver
1011  
1012 --- XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c.~1~       Sun Jun  3 19:44:41 2001
1013 +++ XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c   Sun Jun  3 19:44:48 2001
1014 @@ -1015,6 +1015,13 @@
1015  
1016  #if defined(INCLUDE_XF86_MAP_PCI_MEM)
1017  
1018 +#ifdef HAVE_DOMAINS
1019 +int xf86GetPciDomain(PCITAG Tag)
1020 +{
1021 +       return 0;
1022 +}
1023 +#endif
1024 +
1025  pointer
1026  xf86MapPciMem(int ScreenNum, int Flags, PCITAG Tag, ADDRESS Base,
1027                 unsigned long Size)
1028 --- XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h.~1~       Sun Jun  3 19:44:41 2001
1029 +++ XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h   Sun Jun  3 19:44:48 2001
1030 @@ -152,9 +152,11 @@
1031  # if !defined(PowerMAX_OS)
1032  #  define INCLUDE_XF86_MAP_PCI_MEM
1033  # endif
1034 -#elif defined(__sparc__) && (defined(linux) || defined(sun))
1035 +#elif defined(__sparc__) && defined(sun)
1036  # define ARCH_PCI_INIT sparcPciInit
1037  # define INCLUDE_XF86_MAP_PCI_MEM
1038 +#elif defined(__sparc__) && defined(linux)
1039 +# define ARCH_PCI_INIT linuxPciInit
1040  #elif defined(__alpha__) && defined(linux)
1041  # define ARCH_PCI_INIT axpPciInit
1042  # define INCLUDE_XF86_MAP_PCI_MEM
1043 --- XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c.~1~  Sun Jun  3 19:44:41 2001
1044 +++ XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c      Sun Jun  3 19:44:48 2001
1045 @@ -88,6 +88,13 @@
1046  #define PCI_CPU(val)   (val)
1047  #endif
1048  
1049 +/* Ioctls for /proc/bus/pci/X/Y nodes. */
1050 +#define PCIIOC_BASE            ('P' << 24 | 'C' << 16 | 'I' << 8)
1051 +#define PCIIOC_CONTROLLER      (PCIIOC_BASE | 0x00)    /* Get controller for PCI device. */
1052 +#define PCIIOC_MMAP_IS_IO      (PCIIOC_BASE | 0x01)    /* Set mmap state to I/O space. */
1053 +#define PCIIOC_MMAP_IS_MEM     (PCIIOC_BASE | 0x02)    /* Set mmap state to MEM space. */
1054 +#define PCIIOC_WRITE_COMBINE   (PCIIOC_BASE | 0x03)    /* Enable/disable write-combining. */
1055 +
1056  void  
1057  linuxPciInit()
1058  {
1059 @@ -167,3 +174,129 @@
1060                 write(fd,&val,4);
1061         }
1062  }
1063 +
1064 +#ifndef INCLUDE_XF86_MAP_PCI_MEM
1065 +
1066 +#ifdef HAVE_DOMAINS
1067 +int xf86GetPciDomain(PCITAG Tag)
1068 +{
1069 +       int fd;
1070 +
1071 +       if (-1 != (fd = linuxPciOpenFile(Tag))) {
1072 +               int err = ioctl(fd, PCIIOC_CONTROLLER, 0);
1073 +
1074 +               if (err < 0)
1075 +                       return 0;
1076 +
1077 +               return err;
1078 +       }       
1079 +
1080 +       return 0;
1081 +}
1082 +#endif
1083 +
1084 +static pointer
1085 +xf86MapPciGeneric(int ScreenNum, int Flags, PCITAG Tag, ADDRESS Base,
1086 +                 unsigned long Size, int io_space)
1087 +{
1088 +       int fd;
1089 +
1090 +       xf86InitVidMem();
1091 +
1092 +       if (-1 != (fd = linuxPciOpenFile(Tag))) {
1093 +               ADDRESS realBase, alignOff;
1094 +               pointer p;
1095 +               CARD32 save = 0;
1096 +               int err, mapflags;
1097 +
1098 +               if (io_space)
1099 +                       err = ioctl(fd, PCIIOC_MMAP_IS_IO, 0);
1100 +               else
1101 +                       err = ioctl(fd, PCIIOC_MMAP_IS_MEM, 0);
1102 +
1103 +               if (err < 0)
1104 +                       goto fail;
1105 +
1106 +               if (Flags & VIDMEM_READSIDEEFFECT) {
1107 +                       save = pciReadLong(Tag, PCI_CMD_STAT_REG);
1108 +                       pciWriteLong(Tag, PCI_CMD_STAT_REG,
1109 +                                    save & ~PCI_CMD_MEM_ENABLE);
1110 +               }
1111 +
1112 +               mapflags = MAP_SHARED;
1113 +#if defined(__ia64__)
1114 +#ifndef MAP_WRITECOMBINED
1115 +#define MAP_WRITECOMBINED 0x00010000
1116 +#endif
1117 +#ifndef MAP_NONCACHED
1118 +#define MAP_NONCACHED 0x00020000
1119 +#endif
1120 +               if (Flags & VIDMEM_FRAMEBUFFER) 
1121 +                       mapflags |= MAP_WRITECOMBINED; 
1122 +               else
1123 +                       mapflags |= MAP_NONCACHED; 
1124 +#else /* !(__ia64__) */
1125 +               err = ioctl(fd, PCIIOC_WRITE_COMBINE,
1126 +                           (Flags & VIDMEM_FRAMEBUFFER) ? 1 : 0);
1127 +               if (err < 0)
1128 +                       goto fail_restore_cmd_stat;
1129 +#endif
1130 +
1131 +               realBase = Base & ~(getpagesize() - 1);
1132 +               alignOff = Base - realBase;
1133 +
1134 +               p = mmap(NULL, Size + alignOff, PROT_READ | PROT_WRITE,
1135 +                        mapflags, fd, realBase);
1136 +
1137 +               if (!p || p == (pointer) -1) {
1138 +                       FatalError("xf86MapPciMem: Could not mmap PCI memory "
1139 +                                  "[base=0x%x,size=%x] (%s)\n",
1140 +                                  Base, Size, strerror(errno));
1141 +                       goto fail_restore_cmd_stat;
1142 +               }
1143 +
1144 +               if (Flags & VIDMEM_READSIDEEFFECT) {
1145 +                       xf86MapReadSideEffects(ScreenNum, Flags, p, Size);
1146 +                       pciWriteLong(Tag, PCI_CMD_STAT_REG, save);
1147 +               }
1148 +
1149 +               xf86MakeNewMapping(ScreenNum, Flags, Base, Size, p);
1150 +
1151 +               return (pointer) ((char *)p + alignOff);
1152 +
1153 +       fail_restore_cmd_stat:
1154 +               if (Flags & VIDMEM_READSIDEEFFECT)
1155 +                       pciWriteLong(Tag, PCI_CMD_STAT_REG, save);
1156 +
1157 +               return NULL;
1158 +       }
1159 +
1160 +fail:
1161 +       return NULL;
1162 +}
1163 +
1164 +pointer
1165 +xf86MapPciMem(int ScreenNum, int Flags, PCITAG Tag, ADDRESS Base,
1166 +             unsigned long Size)
1167 +{
1168 +       return xf86MapPciGeneric(ScreenNum, Flags, Tag,
1169 +                                Base, Size, 0);
1170 +}
1171 +
1172 +pointer
1173 +xf86MapPciIo(int ScreenNum, int Flags, PCITAG Tag, ADDRESS Base,
1174 +            unsigned long Size)
1175 +{
1176 +       return xf86MapPciGeneric(ScreenNum, Flags, Tag,
1177 +                                Base, Size, 1);
1178 +}
1179 +
1180 +int
1181 +xf86ReadPciBIOS(unsigned long Offset, PCITAG Tag, int basereg,
1182 +               unsigned char *Buf, int Len)
1183 +{
1184 +       xf86Msg(X_WARNING, "xf86ReadPciBIOS: Unsupported on this platform.\n");
1185 +       return -1;
1186 +}
1187 +
1188 +#endif /* !(INCLUDE_XF86_MAP_PCI_MEM) */
1189 --- XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h.~1~   Sun Jun  3 19:44:41 2001
1190 +++ XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h       Sun Jun  3 19:44:48 2001
1191 @@ -647,6 +647,9 @@
1192                                 ADDRESS Base, unsigned long Size);
1193  int           xf86ReadPciBIOS(unsigned long Offset, PCITAG Tag, int basereg,
1194                                 unsigned char *Buf, int Len);
1195 +#ifdef HAVE_DOMAINS
1196 +int          xf86GetPciDomain(PCITAG Tag);
1197 +#endif
1198  pciConfigPtr *xf86scanpci(int flags);
1199  
1200  /* Old sytle PCI access functions (for compatibility) */
1201 --- XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c.~1~     Sun Jun  3 19:44:41 2001
1202 +++ XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c Sun Jun  3 19:44:48 2001
1203 @@ -15,22 +15,33 @@
1204  #ifdef __alpha__
1205  resRange PciAvoid[] = {_PCI_AVOID_PC_STYLE, _END};
1206  
1207 +#define MIN_SYSTEM_DOMAIN      0
1208 +#ifdef HAVE_DOMAINS
1209 +#define MAX_SYSTEM_DOMAIN      255
1210 +#else
1211 +#define MAX_SYSTEM_DOMAIN      0
1212 +#endif
1213 +#define ISA_SYSTEM_DOMAIN      0
1214 +
1215  resPtr
1216  xf86BusAccWindowsFromOS(void)
1217  {
1218      resPtr ret = NULL;
1219      resRange range;
1220 +    int domain;
1221  
1222 -    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
1223 -    ret = xf86AddResToList(ret, &range, -1);
1224 +    for (domain = MIN_SYSTEM_DOMAIN; domain <= MAX_SYSTEM_DOMAIN; domain++) {
1225 +       RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock, domain);
1226 +       ret = xf86AddResToList(ret, &range, -1);
1227  
1228 -    RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock);
1229 -    ret = xf86AddResToList(ret, &range, -1);
1230 +       RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock, domain);
1231 +       ret = xf86AddResToList(ret, &range, -1);
1232 +    }
1233      return ret;
1234  }
1235  
1236  resPtr
1237 -xf86PciBusAccWindowsFromOS(void)
1238 +xf86PciBusAccWindowsFromOS(int domain)
1239  {
1240      resPtr ret = NULL;
1241      resRange range;
1242 @@ -39,75 +50,75 @@
1243       * sparse address space are an image of the ISA bus range
1244       */
1245      if (_bus_base_sparse()) {
1246 -       RANGE(range, 0x00000000, 0x07ffffff, ResExcMemBlock);
1247 +       RANGE(range, 0x00000000, 0x07ffffff, ResExcMemBlock, domain);
1248         ret = xf86AddResToList(ret, &range, -1);
1249 -       RANGE(range, 0x09000000, 0x0fffffff, ResExcMemBlock);
1250 +       RANGE(range, 0x09000000, 0x0fffffff, ResExcMemBlock, domain);
1251         ret = xf86AddResToList(ret, &range, -1);
1252 -       RANGE(range, 0x11000000, 0x17ffffff, ResExcMemBlock);
1253 +       RANGE(range, 0x11000000, 0x17ffffff, ResExcMemBlock, domain);
1254         ret = xf86AddResToList(ret, &range, -1);
1255 -       RANGE(range, 0x19000000, 0x1fffffff, ResExcMemBlock);
1256 +       RANGE(range, 0x19000000, 0x1fffffff, ResExcMemBlock, domain);
1257         ret = xf86AddResToList(ret, &range, -1);
1258 -       RANGE(range, 0x21000000, 0x27ffffff, ResExcMemBlock);
1259 +       RANGE(range, 0x21000000, 0x27ffffff, ResExcMemBlock, domain);
1260         ret = xf86AddResToList(ret, &range, -1);
1261 -       RANGE(range, 0x29000000, 0x2fffffff, ResExcMemBlock);
1262 +       RANGE(range, 0x29000000, 0x2fffffff, ResExcMemBlock, domain);
1263         ret = xf86AddResToList(ret, &range, -1);
1264 -       RANGE(range, 0x31000000, 0x37ffffff, ResExcMemBlock);
1265 +       RANGE(range, 0x31000000, 0x37ffffff, ResExcMemBlock, domain);
1266         ret = xf86AddResToList(ret, &range, -1);
1267 -       RANGE(range, 0x39000000, 0x3fffffff, ResExcMemBlock);
1268 +       RANGE(range, 0x39000000, 0x3fffffff, ResExcMemBlock, domain);
1269         ret = xf86AddResToList(ret, &range, -1);
1270 -       RANGE(range, 0x41000000, 0x47ffffff, ResExcMemBlock);
1271 +       RANGE(range, 0x41000000, 0x47ffffff, ResExcMemBlock, domain);
1272         ret = xf86AddResToList(ret, &range, -1);
1273 -       RANGE(range, 0x49000000, 0x4fffffff, ResExcMemBlock);
1274 +       RANGE(range, 0x49000000, 0x4fffffff, ResExcMemBlock, domain);
1275         ret = xf86AddResToList(ret, &range, -1);
1276 -       RANGE(range, 0x51000000, 0x57ffffff, ResExcMemBlock);
1277 +       RANGE(range, 0x51000000, 0x57ffffff, ResExcMemBlock, domain);
1278         ret = xf86AddResToList(ret, &range, -1);
1279 -       RANGE(range, 0x59000000, 0x5fffffff, ResExcMemBlock);
1280 +       RANGE(range, 0x59000000, 0x5fffffff, ResExcMemBlock, domain);
1281         ret = xf86AddResToList(ret, &range, -1);
1282 -       RANGE(range, 0x61000000, 0x67ffffff, ResExcMemBlock);
1283 +       RANGE(range, 0x61000000, 0x67ffffff, ResExcMemBlock, domain);
1284         ret = xf86AddResToList(ret, &range, -1);
1285 -       RANGE(range, 0x69000000, 0x6fffffff, ResExcMemBlock);
1286 +       RANGE(range, 0x69000000, 0x6fffffff, ResExcMemBlock, domain);
1287         ret = xf86AddResToList(ret, &range, -1);
1288 -       RANGE(range, 0x71000000, 0x77ffffff, ResExcMemBlock);
1289 +       RANGE(range, 0x71000000, 0x77ffffff, ResExcMemBlock, domain);
1290         ret = xf86AddResToList(ret, &range, -1);
1291 -       RANGE(range, 0x79000000, 0x7fffffff, ResExcMemBlock);
1292 +       RANGE(range, 0x79000000, 0x7fffffff, ResExcMemBlock, domain);
1293         ret = xf86AddResToList(ret, &range, -1);
1294 -       RANGE(range, 0x81000000, 0x87ffffff, ResExcMemBlock);
1295 +       RANGE(range, 0x81000000, 0x87ffffff, ResExcMemBlock, domain);
1296         ret = xf86AddResToList(ret, &range, -1);
1297 -       RANGE(range, 0x89000000, 0x8fffffff, ResExcMemBlock);
1298 +       RANGE(range, 0x89000000, 0x8fffffff, ResExcMemBlock, domain);
1299         ret = xf86AddResToList(ret, &range, -1);
1300 -       RANGE(range, 0x91000000, 0x97ffffff, ResExcMemBlock);
1301 +       RANGE(range, 0x91000000, 0x97ffffff, ResExcMemBlock, domain);
1302         ret = xf86AddResToList(ret, &range, -1);
1303 -       RANGE(range, 0x99000000, 0x9fffffff, ResExcMemBlock);
1304 +       RANGE(range, 0x99000000, 0x9fffffff, ResExcMemBlock, domain);
1305         ret = xf86AddResToList(ret, &range, -1);
1306 -       RANGE(range, 0xa1000000, 0xa7ffffff, ResExcMemBlock);
1307 +       RANGE(range, 0xa1000000, 0xa7ffffff, ResExcMemBlock, domain);
1308         ret = xf86AddResToList(ret, &range, -1);
1309 -       RANGE(range, 0xa9000000, 0xafffffff, ResExcMemBlock);
1310 +       RANGE(range, 0xa9000000, 0xafffffff, ResExcMemBlock, domain);
1311         ret = xf86AddResToList(ret, &range, -1);
1312 -       RANGE(range, 0xb1000000, 0xb7ffffff, ResExcMemBlock);
1313 +       RANGE(range, 0xb1000000, 0xb7ffffff, ResExcMemBlock, domain);
1314         ret = xf86AddResToList(ret, &range, -1);
1315 -       RANGE(range, 0xb9000000, 0xbfffffff, ResExcMemBlock);
1316 +       RANGE(range, 0xb9000000, 0xbfffffff, ResExcMemBlock, domain);
1317         ret = xf86AddResToList(ret, &range, -1);
1318 -       RANGE(range, 0xc1000000, 0xc7ffffff, ResExcMemBlock);
1319 +       RANGE(range, 0xc1000000, 0xc7ffffff, ResExcMemBlock, domain);
1320         ret = xf86AddResToList(ret, &range, -1);
1321 -       RANGE(range, 0xc9000000, 0xcfffffff, ResExcMemBlock);
1322 +       RANGE(range, 0xc9000000, 0xcfffffff, ResExcMemBlock, domain);
1323         ret = xf86AddResToList(ret, &range, -1);
1324 -       RANGE(range, 0xd1000000, 0xd7ffffff, ResExcMemBlock);
1325 +       RANGE(range, 0xd1000000, 0xd7ffffff, ResExcMemBlock, domain);
1326         ret = xf86AddResToList(ret, &range, -1);
1327 -       RANGE(range, 0xd9000000, 0xdfffffff, ResExcMemBlock);
1328 +       RANGE(range, 0xd9000000, 0xdfffffff, ResExcMemBlock, domain);
1329         ret = xf86AddResToList(ret, &range, -1);
1330 -       RANGE(range, 0xe1000000, 0xe7ffffff, ResExcMemBlock);
1331 +       RANGE(range, 0xe1000000, 0xe7ffffff, ResExcMemBlock, domain);
1332         ret = xf86AddResToList(ret, &range, -1);
1333 -       RANGE(range, 0xe9000000, 0xefffffff, ResExcMemBlock);
1334 +       RANGE(range, 0xe9000000, 0xefffffff, ResExcMemBlock, domain);
1335         ret = xf86AddResToList(ret, &range, -1);
1336 -       RANGE(range, 0xf1000000, 0xf7ffffff, ResExcMemBlock);
1337 +       RANGE(range, 0xf1000000, 0xf7ffffff, ResExcMemBlock, domain);
1338         ret = xf86AddResToList(ret, &range, -1);
1339 -       RANGE(range, 0xf9000000, 0xffffffff, ResExcMemBlock);
1340 +       RANGE(range, 0xf9000000, 0xffffffff, ResExcMemBlock, domain);
1341         ret = xf86AddResToList(ret, &range, -1);
1342      } else {
1343 -       RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
1344 +       RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock, domain);
1345         ret = xf86AddResToList(ret, &range, -1);
1346      }
1347 -    RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock);
1348 +    RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock, domain);
1349      ret = xf86AddResToList(ret, &range, -1);
1350      return ret;
1351  }
1352 @@ -118,10 +129,10 @@
1353      resPtr ret = NULL;
1354      resRange range;
1355  
1356 -    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
1357 +    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock, ISA_SYSTEM_DOMAIN);
1358      ret = xf86AddResToList(ret, &range, -1);
1359  
1360 -    RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock);
1361 +    RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock, ISA_SYSTEM_DOMAIN);
1362      ret = xf86AddResToList(ret, &range, -1);
1363      return ret;
1364  }
1365 @@ -130,6 +141,14 @@
1366  xf86AccResFromOS(resPtr ret)
1367  {
1368      resRange range;
1369 +#ifdef HAVE_DOMAINS
1370 +    int domain = MIN_SYSTEM_DOMAIN;
1371 +#endif
1372 +
1373 +#ifdef HAVE_DOMAINS
1374 +    if (ret != NULL)
1375 +       domain = ret->res_domain;
1376 +#endif
1377  
1378      /*
1379       * Fallback is to claim the following areas:
1380 @@ -137,7 +156,7 @@
1381       * 0x000c0000 - 0x000effff  location of VGA and other extensions ROMS
1382       */
1383  
1384 -    RANGE(range, 0x000c0000, 0x000effff, ResExcMemBlock);
1385 +    RANGE(range, 0x000c0000, 0x000effff, ResExcMemBlock, domain);
1386      ret = xf86AddResToList(ret, &range, -1);
1387  
1388      /*
1389 @@ -145,20 +164,20 @@
1390       * along with their sparse I/O aliases, but that's too imprecise.  Instead
1391       * claim a bare minimum here.
1392       */
1393 -    RANGE(range, 0x00000000, 0x000000ff, ResExcIoBlock); /* For mainboard */
1394 +    RANGE(range, 0x00000000, 0x000000ff, ResExcIoBlock, domain); /* For mainboard */
1395      ret = xf86AddResToList(ret, &range, -1);
1396  
1397      /*
1398       * At minimum, the top and bottom resources must be claimed, so that
1399       * resources that are (or appear to be) unallocated can be relocated.
1400       */
1401 -    RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock);
1402 +    RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock, domain);
1403      ret = xf86AddResToList(ret, &range, -1);
1404 -    RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock);
1405 +    RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock, domain);
1406      ret = xf86AddResToList(ret, &range, -1);
1407 -/*  RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock);
1408 +/*  RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock, domain);
1409      ret = xf86AddResToList(ret, &range, -1); */
1410 -    RANGE(range, 0xffffffff, 0xffffffff, ResExcIoBlock);
1411 +    RANGE(range, 0xffffffff, 0xffffffff, ResExcIoBlock, domain);
1412      ret = xf86AddResToList(ret, &range, -1);
1413  
1414      /* XXX add others */
1415 @@ -172,9 +191,18 @@
1416    */
1417    
1418  #ifdef __sparc__
1419 +#ifndef HAVE_DOMAINS
1420 +#error This platform cannot operate correctly without HAVE_DOMAINS defined
1421 +#endif
1422  resRange PciAvoid[] = {_END};
1423 +#define MIN_SYSTEM_DOMAIN      0
1424 +#define MAX_SYSTEM_DOMAIN      255
1425 +#define ISA_SYSTEM_DOMAIN      0
1426  #else
1427  resRange PciAvoid[] = {_PCI_AVOID_PC_STYLE, _END};
1428 +#define MIN_SYSTEM_DOMAIN      0
1429 +#define MAX_SYSTEM_DOMAIN      0
1430 +#define ISA_SYSTEM_DOMAIN      0
1431  #endif
1432  
1433  resPtr
1434 @@ -182,32 +210,36 @@
1435  {
1436      resPtr ret = NULL;
1437      resRange range;
1438 +    int domain;
1439  
1440 -    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
1441 -    ret = xf86AddResToList(ret, &range, -1);
1442 +    for (domain = MIN_SYSTEM_DOMAIN; domain <= MAX_SYSTEM_DOMAIN; domain++) {
1443 +       RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock, domain);
1444 +       ret = xf86AddResToList(ret, &range, -1);
1445  
1446  #ifdef __sparc__
1447 -    RANGE(range, 0x00000000, 0x00ffffff, ResExcIoBlock);
1448 +       RANGE(range, 0x00000000, 0x00ffffff, ResExcIoBlock, domain);
1449  #else
1450 -    RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock);
1451 +       RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock, domain);
1452  #endif
1453 -    ret = xf86AddResToList(ret, &range, -1);
1454 +       ret = xf86AddResToList(ret, &range, -1);
1455 +    }
1456 +
1457      return ret;
1458  }
1459  
1460  resPtr
1461 -xf86PciBusAccWindowsFromOS(void)
1462 +xf86PciBusAccWindowsFromOS(int domain)
1463  {
1464      resPtr ret = NULL;
1465      resRange range;
1466  
1467 -    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
1468 +    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock, domain);
1469      ret = xf86AddResToList(ret, &range, -1);
1470  
1471  #ifdef __sparc__
1472 -    RANGE(range, 0x00000000, 0x00ffffff, ResExcIoBlock);
1473 +    RANGE(range, 0x00000000, 0x00ffffff, ResExcIoBlock, domain);
1474  #else
1475 -    RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock);
1476 +    RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock, domain);
1477  #endif
1478      ret = xf86AddResToList(ret, &range, -1);
1479      return ret;
1480 @@ -219,13 +251,13 @@
1481      resPtr ret = NULL;
1482      resRange range;
1483  
1484 -    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
1485 +    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock, ISA_SYSTEM_DOMAIN);
1486      ret = xf86AddResToList(ret, &range, -1);
1487  
1488  #ifdef __sparc__
1489 -    RANGE(range, 0x00000000, 0x00ffffff, ResExcIoBlock);
1490 +    RANGE(range, 0x00000000, 0x00ffffff, ResExcIoBlock, ISA_SYSTEM_DOMAIN);
1491  #else
1492 -    RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock);
1493 +    RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock, ISA_SYSTEM_DOMAIN);
1494  #endif
1495      ret = xf86AddResToList(ret, &range, -1);
1496      return ret;
1497 @@ -235,21 +267,29 @@
1498  xf86AccResFromOS(resPtr ret)
1499  {
1500      resRange range;
1501 +#ifdef HAVE_DOMAINS
1502 +    int domain = MIN_SYSTEM_DOMAIN;
1503 +#endif
1504 +
1505 +#ifdef HAVE_DOMAINS
1506 +    if (ret != NULL)
1507 +       domain = ret->res_domain;
1508 +#endif
1509  
1510      /*
1511       * At minimum, the top and bottom resources must be claimed, so that
1512       * resources that are (or appear to be) unallocated can be relocated.
1513       */
1514 -    RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock);
1515 +    RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock, domain);
1516      ret = xf86AddResToList(ret, &range, -1);
1517 -    RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock);
1518 +    RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock, domain);
1519      ret = xf86AddResToList(ret, &range, -1);
1520 -    RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock);
1521 +    RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock, domain);
1522      ret = xf86AddResToList(ret, &range, -1);
1523  #ifdef __sparc__
1524 -    RANGE(range, 0x00ffffff, 0x00ffffff, ResExcIoBlock);
1525 +    RANGE(range, 0x00ffffff, 0x00ffffff, ResExcIoBlock, domain);
1526  #else
1527 -    RANGE(range, 0x0000ffff, 0x0000ffff, ResExcIoBlock);
1528 +    RANGE(range, 0x0000ffff, 0x0000ffff, ResExcIoBlock, domain);
1529  #endif
1530      ret = xf86AddResToList(ret, &range, -1);
1531  
1532 --- XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c.~1~    Sun Jun  3 19:44:41 2001
1533 +++ XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c        Sun Jun  3 19:44:48 2001
1534 @@ -20,34 +20,42 @@
1535  resRange PciAvoid[] = {_PCI_AVOID_PC_STYLE, _END};
1536  #endif
1537  
1538 +#define MIN_SYSTEM_DOMAIN      0
1539 +#define MAX_SYSTEM_DOMAIN      0
1540 +#define ISA_SYSTEM_DOMAIN      0
1541 +
1542  resPtr
1543  xf86StdBusAccWindowsFromOS(void)
1544  {
1545      /* Fallback is to allow addressing of all memory space */
1546      resPtr ret = NULL;
1547      resRange range;
1548 +    int domain;
1549  
1550 -    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
1551 -    ret = xf86AddResToList(ret, &range, -1);
1552 +    for (domain = MIN_SYSTEM_DOMAIN; domain <= MAX_SYSTEM_DOMAIN; domain++) {
1553 +       RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock, domain);
1554 +       ret = xf86AddResToList(ret, &range, -1);
1555 +
1556 +       /* Fallback is to allow addressing of all I/O space */
1557 +       RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock, domain);
1558 +       ret = xf86AddResToList(ret, &range, -1);
1559 +    }
1560  
1561 -    /* Fallback is to allow addressing of all I/O space */
1562 -    RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock);
1563 -    ret = xf86AddResToList(ret, &range, -1);
1564      return ret;
1565  }
1566  
1567  resPtr
1568 -xf86StdPciBusAccWindowsFromOS(void)
1569 +xf86StdPciBusAccWindowsFromOS(int domain)
1570  {
1571      /* Fallback is to allow addressing of all memory space */
1572      resPtr ret = NULL;
1573      resRange range;
1574  
1575 -    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
1576 +    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock, domain);
1577      ret = xf86AddResToList(ret, &range, -1);
1578  
1579      /* Fallback is to allow addressing of all I/O space */
1580 -    RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock);
1581 +    RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock, domain);
1582      ret = xf86AddResToList(ret, &range, -1);
1583      return ret;
1584  }
1585 @@ -59,11 +67,11 @@
1586      resPtr ret = NULL;
1587      resRange range;
1588  
1589 -    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
1590 +    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock, ISA_SYSTEM_DOMAIN);
1591      ret = xf86AddResToList(ret, &range, -1);
1592  
1593      /* Fallback is to allow addressing of all I/O space */
1594 -    RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock);
1595 +    RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock, ISA_SYSTEM_DOMAIN);
1596      ret = xf86AddResToList(ret, &range, -1);
1597      return ret;
1598  }
1599 @@ -72,6 +80,14 @@
1600  xf86StdAccResFromOS(resPtr ret)
1601  {
1602      resRange range;
1603 +#ifdef HAVE_DOMAINS
1604 +    int domain = MIN_SYSTEM_DOMAIN;
1605 +#endif
1606 +
1607 +#ifdef HAVE_DOMAINS
1608 +    if (ret != NULL)
1609 +       domain = ret->res_domain;
1610 +#endif
1611  
1612      /*
1613       * Fallback is to claim the following areas:
1614 @@ -91,22 +107,22 @@
1615       */
1616  
1617      /* Fallback is to claim 0x0 - 0x9ffff and 0x100000 - 0x7fffffff */
1618 -    RANGE(range, 0x00000000, 0x0009ffff, ResExcMemBlock);
1619 +    RANGE(range, 0x00000000, 0x0009ffff, ResExcMemBlock, domain);
1620      ret = xf86AddResToList(ret, &range, -1);
1621 -    RANGE(range, 0x000c0000, 0x000effff, ResExcMemBlock);
1622 +    RANGE(range, 0x000c0000, 0x000effff, ResExcMemBlock, domain);
1623      ret = xf86AddResToList(ret, &range, -1);
1624 -    RANGE(range, 0x000f0000, 0x000fffff, ResExcMemBlock);
1625 +    RANGE(range, 0x000f0000, 0x000fffff, ResExcMemBlock, domain);
1626      ret = xf86AddResToList(ret, &range, -1);
1627      RANGE(range, 0x00100000, 0x3fffffff,
1628 -       ResExcMemBlock | ResBios | ResEstimated);
1629 +       ResExcMemBlock | ResBios | ResEstimated, domain);
1630      ret = xf86AddResToList(ret, &range, -1);
1631  #if 0
1632 -    RANGE(range, 0xfec00000, 0xfecfffff, ResExcMemBlock | ResBios);
1633 +    RANGE(range, 0xfec00000, 0xfecfffff, ResExcMemBlock | ResBios, domain);
1634      ret = xf86AddResToList(ret, &range, -1);
1635 -    RANGE(range, 0xfee00000, 0xfeefffff, ResExcMemBlock | ResBios);
1636 +    RANGE(range, 0xfee00000, 0xfeefffff, ResExcMemBlock | ResBios, domain);
1637      ret = xf86AddResToList(ret, &range, -1);
1638  #endif
1639 -    RANGE(range, 0xffe00000, 0xffffffff, ResExcMemBlock | ResBios);
1640 +    RANGE(range, 0xffe00000, 0xffffffff, ResExcMemBlock | ResBios, domain);
1641      ret = xf86AddResToList(ret, &range, -1);
1642  
1643      /*
1644 @@ -114,20 +130,20 @@
1645       * along with their sparse I/O aliases, but that's too imprecise.  Instead
1646       * claim a bare minimum here.
1647       */
1648 -    RANGE(range, 0x00000000, 0x000000ff, ResExcIoBlock); /* For mainboard */
1649 +    RANGE(range, 0x00000000, 0x000000ff, ResExcIoBlock, domain); /* For mainboard */
1650      ret = xf86AddResToList(ret, &range, -1);
1651  
1652      /*
1653       * At minimum, the top and bottom resources must be claimed, so that
1654       * resources that are (or appear to be) unallocated can be relocated.
1655       */
1656 -/*  RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock);
1657 +/*  RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock, domain);
1658      ret = xf86AddResToList(ret, &range, -1);
1659 -    RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock);
1660 +    RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock, domain);
1661      ret = xf86AddResToList(ret, &range, -1);
1662 -    RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock);
1663 +    RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock, domain);
1664      ret = xf86AddResToList(ret, &range, -1); */
1665 -    RANGE(range, 0x0000ffff, 0x0000ffff, ResExcIoBlock);
1666 +    RANGE(range, 0x0000ffff, 0x0000ffff, ResExcIoBlock, domain);
1667      ret = xf86AddResToList(ret, &range, -1);
1668  
1669      /* XXX add others */
1670 --- XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c.~1~ Sun Jun  3 19:44:41 2001
1671 +++ XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c     Sun Jun  3 19:44:48 2001
1672 @@ -135,6 +135,29 @@
1673         }
1674  }
1675  
1676 +void
1677 +xf86MakeNewMapping(int ScreenNum, int Flags, unsigned long Base, unsigned long Size, pointer Vbase)
1678 +{
1679 +       VidMapPtr vp;
1680 +       MappingPtr mp;
1681 +
1682 +       vp = getVidMapRec(ScreenNum);
1683 +       mp = newMapping(vp);
1684 +       mp->physBase = Base;
1685 +       mp->size = Size;
1686 +       mp->virtBase = Vbase;
1687 +       mp->flags = Flags;
1688 +}
1689 +
1690 +void
1691 +xf86InitVidMem(void)
1692 +{
1693 +       if (!vidMemInfo.initialised) {
1694 +               memset(&vidMemInfo, 0, sizeof(VidMemInfo));
1695 +               xf86OSInitVidMem(&vidMemInfo);
1696 +       }
1697 +}
1698 +
1699  pointer
1700  xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size)
1701  {
1702 --- XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h.~1~   Sun Jun  3 19:44:41 2001
1703 +++ XFree86-4.1.0/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h       Sun Jun  3 19:44:48 2001
1704 @@ -137,6 +137,8 @@
1705  /* public functions */
1706  extern Bool xf86LinearVidMem(void);
1707  extern Bool xf86CheckMTRR(int); 
1708 +extern void xf86MakeNewMapping(int, int, unsigned long, unsigned long, pointer);
1709 +extern void xf86InitVidMem(void);
1710  extern pointer xf86MapVidMem(int, int, unsigned long, unsigned long);
1711  extern void xf86UnMapVidMem(int, pointer, unsigned long);
1712  extern void xf86MapReadSideEffects(int, int, pointer, unsigned long);
1713 @@ -235,13 +237,13 @@
1714  /* RAC-related privs */
1715  /* internal to os-support layer */
1716  resPtr xf86StdBusAccWindowsFromOS(void);
1717 -resPtr xf86StdPciAccWindowsFromOS(void);
1718 +resPtr xf86StdPciAccWindowsFromOS(int domain);
1719  resPtr xf86StdIsaAccWindowsFromOS(void);
1720  resPtr xf86StdAccResFromOS(resPtr ret);
1721  
1722  /* available to the common layer */
1723  resPtr xf86BusAccWindowsFromOS(void);
1724 -resPtr xf86PciBusAccWindowsFromOS(void);
1725 +resPtr xf86PciBusAccWindowsFromOS(int domain);
1726  resPtr xf86IsaBusAccWindowsFromOS(void);
1727  resPtr xf86AccResFromOS(resPtr ret);
1728  #endif /* NEED_OS_RAC_PROTOS */
This page took 0.172014 seconds and 3 git commands to generate.