~ubuntu-branches/ubuntu/intrepid/xserver-xgl/intrepid

« back to all changes in this revision

Viewing changes to hw/xfree86/os-support/linux/lnxResource.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthew Garrett
  • Date: 2006-02-13 14:21:43 UTC
  • Revision ID: james.westby@ubuntu.com-20060213142143-mad6z9xzem7hzxz9
Tags: upstream-7.0.0
ImportĀ upstreamĀ versionĀ 7.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c,v 3.18 2002/01/25 21:56:19 tsi Exp $ */
 
2
 
 
3
/* Resource information code */
 
4
 
 
5
#ifdef HAVE_XORG_CONFIG_H
 
6
#include <xorg-config.h>
 
7
#endif
 
8
 
 
9
#include <X11/X.h>
 
10
#include "xf86.h"
 
11
#include "xf86Priv.h"
 
12
#include "xf86Privstr.h"
 
13
#include "xf86Pci.h"
 
14
#include "xf86Resources.h"
 
15
#define NEED_OS_RAC_PROTOS
 
16
#include "xf86_OSlib.h"
 
17
#include "lnx.h"
 
18
 
 
19
/* Avoid Imakefile changes */
 
20
#include "bus/Pci.h"
 
21
 
 
22
resRange PciAvoid[] =
 
23
{
 
24
#if !defined(__sparc__) || !defined(INCLUDE_XF86_NO_DOMAIN)
 
25
    _PCI_AVOID_PC_STYLE,
 
26
#endif
 
27
    _END
 
28
};
 
29
 
 
30
#ifdef INCLUDE_XF86_NO_DOMAIN
 
31
 
 
32
#ifdef __alpha__
 
33
 
 
34
resPtr
 
35
xf86BusAccWindowsFromOS(void)
 
36
{
 
37
    resPtr ret = NULL;
 
38
    resRange range;
 
39
 
 
40
    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
 
41
    ret = xf86AddResToList(ret, &range, -1);
 
42
 
 
43
    RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock);
 
44
    ret = xf86AddResToList(ret, &range, -1);
 
45
    return ret;
 
46
}
 
47
 
 
48
resPtr
 
49
xf86PciBusAccWindowsFromOS(void)
 
50
{
 
51
    resPtr ret = NULL;
 
52
    resRange range;
 
53
    /*
 
54
     * On the Alpha the first 16MB of every 128 Mb segment in
 
55
     * sparse address space are an image of the ISA bus range
 
56
     */
 
57
    if (_bus_base_sparse()) {
 
58
        RANGE(range, 0x00000000, 0x07ffffff, ResExcMemBlock);
 
59
        ret = xf86AddResToList(ret, &range, -1);
 
60
        RANGE(range, 0x09000000, 0x0fffffff, ResExcMemBlock);
 
61
        ret = xf86AddResToList(ret, &range, -1);
 
62
        RANGE(range, 0x11000000, 0x17ffffff, ResExcMemBlock);
 
63
        ret = xf86AddResToList(ret, &range, -1);
 
64
        RANGE(range, 0x19000000, 0x1fffffff, ResExcMemBlock);
 
65
        ret = xf86AddResToList(ret, &range, -1);
 
66
        RANGE(range, 0x21000000, 0x27ffffff, ResExcMemBlock);
 
67
        ret = xf86AddResToList(ret, &range, -1);
 
68
        RANGE(range, 0x29000000, 0x2fffffff, ResExcMemBlock);
 
69
        ret = xf86AddResToList(ret, &range, -1);
 
70
        RANGE(range, 0x31000000, 0x37ffffff, ResExcMemBlock);
 
71
        ret = xf86AddResToList(ret, &range, -1);
 
72
        RANGE(range, 0x39000000, 0x3fffffff, ResExcMemBlock);
 
73
        ret = xf86AddResToList(ret, &range, -1);
 
74
        RANGE(range, 0x41000000, 0x47ffffff, ResExcMemBlock);
 
75
        ret = xf86AddResToList(ret, &range, -1);
 
76
        RANGE(range, 0x49000000, 0x4fffffff, ResExcMemBlock);
 
77
        ret = xf86AddResToList(ret, &range, -1);
 
78
        RANGE(range, 0x51000000, 0x57ffffff, ResExcMemBlock);
 
79
        ret = xf86AddResToList(ret, &range, -1);
 
80
        RANGE(range, 0x59000000, 0x5fffffff, ResExcMemBlock);
 
81
        ret = xf86AddResToList(ret, &range, -1);
 
82
        RANGE(range, 0x61000000, 0x67ffffff, ResExcMemBlock);
 
83
        ret = xf86AddResToList(ret, &range, -1);
 
84
        RANGE(range, 0x69000000, 0x6fffffff, ResExcMemBlock);
 
85
        ret = xf86AddResToList(ret, &range, -1);
 
86
        RANGE(range, 0x71000000, 0x77ffffff, ResExcMemBlock);
 
87
        ret = xf86AddResToList(ret, &range, -1);
 
88
        RANGE(range, 0x79000000, 0x7fffffff, ResExcMemBlock);
 
89
        ret = xf86AddResToList(ret, &range, -1);
 
90
        RANGE(range, 0x81000000, 0x87ffffff, ResExcMemBlock);
 
91
        ret = xf86AddResToList(ret, &range, -1);
 
92
        RANGE(range, 0x89000000, 0x8fffffff, ResExcMemBlock);
 
93
        ret = xf86AddResToList(ret, &range, -1);
 
94
        RANGE(range, 0x91000000, 0x97ffffff, ResExcMemBlock);
 
95
        ret = xf86AddResToList(ret, &range, -1);
 
96
        RANGE(range, 0x99000000, 0x9fffffff, ResExcMemBlock);
 
97
        ret = xf86AddResToList(ret, &range, -1);
 
98
        RANGE(range, 0xa1000000, 0xa7ffffff, ResExcMemBlock);
 
99
        ret = xf86AddResToList(ret, &range, -1);
 
100
        RANGE(range, 0xa9000000, 0xafffffff, ResExcMemBlock);
 
101
        ret = xf86AddResToList(ret, &range, -1);
 
102
        RANGE(range, 0xb1000000, 0xb7ffffff, ResExcMemBlock);
 
103
        ret = xf86AddResToList(ret, &range, -1);
 
104
        RANGE(range, 0xb9000000, 0xbfffffff, ResExcMemBlock);
 
105
        ret = xf86AddResToList(ret, &range, -1);
 
106
        RANGE(range, 0xc1000000, 0xc7ffffff, ResExcMemBlock);
 
107
        ret = xf86AddResToList(ret, &range, -1);
 
108
        RANGE(range, 0xc9000000, 0xcfffffff, ResExcMemBlock);
 
109
        ret = xf86AddResToList(ret, &range, -1);
 
110
        RANGE(range, 0xd1000000, 0xd7ffffff, ResExcMemBlock);
 
111
        ret = xf86AddResToList(ret, &range, -1);
 
112
        RANGE(range, 0xd9000000, 0xdfffffff, ResExcMemBlock);
 
113
        ret = xf86AddResToList(ret, &range, -1);
 
114
        RANGE(range, 0xe1000000, 0xe7ffffff, ResExcMemBlock);
 
115
        ret = xf86AddResToList(ret, &range, -1);
 
116
        RANGE(range, 0xe9000000, 0xefffffff, ResExcMemBlock);
 
117
        ret = xf86AddResToList(ret, &range, -1);
 
118
        RANGE(range, 0xf1000000, 0xf7ffffff, ResExcMemBlock);
 
119
        ret = xf86AddResToList(ret, &range, -1);
 
120
        RANGE(range, 0xf9000000, 0xffffffff, ResExcMemBlock);
 
121
        ret = xf86AddResToList(ret, &range, -1);
 
122
    } else {
 
123
        RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
 
124
        ret = xf86AddResToList(ret, &range, -1);
 
125
    }
 
126
    RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock);
 
127
    ret = xf86AddResToList(ret, &range, -1);
 
128
    return ret;
 
129
}
 
130
 
 
131
#ifdef INCLUDE_UNUSED
 
132
 
 
133
resPtr
 
134
xf86IsaBusAccWindowsFromOS(void)
 
135
{
 
136
    resPtr ret = NULL;
 
137
    resRange range;
 
138
 
 
139
    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
 
140
    ret = xf86AddResToList(ret, &range, -1);
 
141
 
 
142
    RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock);
 
143
    ret = xf86AddResToList(ret, &range, -1);
 
144
    return ret;
 
145
}
 
146
 
 
147
#endif /* INCLUDE_UNUSED */
 
148
 
 
149
resPtr
 
150
xf86AccResFromOS(resPtr ret)
 
151
{
 
152
    resRange range;
 
153
 
 
154
    /*
 
155
     * Fallback is to claim the following areas:
 
156
     *
 
157
     * 0x000c0000 - 0x000effff  location of VGA and other extensions ROMS
 
158
     */
 
159
 
 
160
    RANGE(range, 0x000c0000, 0x000effff, ResExcMemBlock);
 
161
    ret = xf86AddResToList(ret, &range, -1);
 
162
 
 
163
    /*
 
164
     * Fallback would be to claim well known ports in the 0x0 - 0x3ff range
 
165
     * along with their sparse I/O aliases, but that's too imprecise.  Instead
 
166
     * claim a bare minimum here.
 
167
     */
 
168
    RANGE(range, 0x00000000, 0x000000ff, ResExcIoBlock); /* For mainboard */
 
169
    ret = xf86AddResToList(ret, &range, -1);
 
170
 
 
171
    /*
 
172
     * At minimum, the top and bottom resources must be claimed, so that
 
173
     * resources that are (or appear to be) unallocated can be relocated.
 
174
     */
 
175
    RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock);
 
176
    ret = xf86AddResToList(ret, &range, -1);
 
177
    RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock);
 
178
    ret = xf86AddResToList(ret, &range, -1);
 
179
/*  RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock);
 
180
    ret = xf86AddResToList(ret, &range, -1); */
 
181
    RANGE(range, 0xffffffff, 0xffffffff, ResExcIoBlock);
 
182
    ret = xf86AddResToList(ret, &range, -1);
 
183
 
 
184
    /* XXX add others */
 
185
    return ret;
 
186
}
 
187
 
 
188
#elif defined(__powerpc__) || \
 
189
      defined(__sparc__) || \
 
190
      defined(__mips__) || \
 
191
      defined(__sh__) || \
 
192
      defined(__mc68000__) || \
 
193
      defined(__arm__) || \
 
194
      defined(__s390__) || \
 
195
      defined(__hppa__)
 
196
 
 
197
 /*
 
198
  * XXX this isn't exactly correct but it will get the server working 
 
199
  * for now until we get something better.
 
200
  */
 
201
  
 
202
resPtr
 
203
xf86BusAccWindowsFromOS(void)
 
204
{
 
205
    resPtr ret = NULL;
 
206
    resRange range;
 
207
 
 
208
    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
 
209
    ret = xf86AddResToList(ret, &range, -1);
 
210
 
 
211
#if defined(__sparc__) || defined(__powerpc__)
 
212
    RANGE(range, 0x00000000, 0x00ffffff, ResExcIoBlock);
 
213
#else
 
214
    RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock);
 
215
#endif
 
216
    ret = xf86AddResToList(ret, &range, -1);
 
217
    return ret;
 
218
}
 
219
 
 
220
resPtr
 
221
xf86PciBusAccWindowsFromOS(void)
 
222
{
 
223
    resPtr ret = NULL;
 
224
    resRange range;
 
225
 
 
226
    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
 
227
    ret = xf86AddResToList(ret, &range, -1);
 
228
 
 
229
#if defined(__sparc__) || defined(__powerpc__)
 
230
    RANGE(range, 0x00000000, 0x00ffffff, ResExcIoBlock);
 
231
#else
 
232
    RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock);
 
233
#endif
 
234
    ret = xf86AddResToList(ret, &range, -1);
 
235
    return ret;
 
236
}
 
237
 
 
238
#ifdef INCLUDE_UNUSED
 
239
 
 
240
resPtr
 
241
xf86IsaBusAccWindowsFromOS(void)
 
242
{
 
243
    resPtr ret = NULL;
 
244
    resRange range;
 
245
 
 
246
    RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
 
247
    ret = xf86AddResToList(ret, &range, -1);
 
248
 
 
249
#if defined(__sparc__) || defined(__powerpc__)
 
250
    RANGE(range, 0x00000000, 0x00ffffff, ResExcIoBlock);
 
251
#else
 
252
    RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock);
 
253
#endif
 
254
    ret = xf86AddResToList(ret, &range, -1);
 
255
    return ret;
 
256
}
 
257
 
 
258
#endif /* INCLUDE_UNUSED */
 
259
 
 
260
resPtr
 
261
xf86AccResFromOS(resPtr ret)
 
262
{
 
263
    resRange range;
 
264
 
 
265
    /*
 
266
     * At minimum, the top and bottom resources must be claimed, so that
 
267
     * resources that are (or appear to be) unallocated can be relocated.
 
268
     */
 
269
    RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock);
 
270
    ret = xf86AddResToList(ret, &range, -1);
 
271
    RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock);
 
272
    ret = xf86AddResToList(ret, &range, -1);
 
273
    RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock);
 
274
    ret = xf86AddResToList(ret, &range, -1);
 
275
#if defined(__sparc__) || defined(__powerpc__)
 
276
    RANGE(range, 0x00ffffff, 0x00ffffff, ResExcIoBlock);
 
277
#else
 
278
    RANGE(range, 0x0000ffff, 0x0000ffff, ResExcIoBlock);
 
279
#endif
 
280
    ret = xf86AddResToList(ret, &range, -1);
 
281
 
 
282
    return ret;
 
283
}
 
284
 
 
285
#else
 
286
 
 
287
#error : Put your platform dependent code here!!
 
288
 
 
289
#endif
 
290
 
 
291
#endif /* INCLUDE_XF86_NO_DOMAIN */