First import
[xorg_rtime.git] / xorg-server-1.4 / hw / xfree86 / os-support / bsd / bsdResource.c
blob37749c913b96265246c8e2f41131b5e60b389c19
2 /* Resource information code */
4 #ifdef HAVE_XORG_CONFIG_H
5 #include <xorg-config.h>
6 #endif
8 #include <X11/X.h>
9 #include "xf86.h"
10 #include "xf86Priv.h"
11 #include "xf86Privstr.h"
12 #include "xf86Pci.h"
13 #include "xf86Resources.h"
14 #define NEED_OS_RAC_PROTOS
15 #include "xf86_OSlib.h"
17 /* Avoid Imakefile changes */
18 #include "bus/Pci.h"
20 _X_EXPORT resRange PciAvoid[] = {_PCI_AVOID_PC_STYLE, _END};
22 #ifdef INCLUDE_XF86_NO_DOMAIN
24 #if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__)
26 resPtr
27 xf86BusAccWindowsFromOS(void)
29 resPtr ret = NULL;
30 resRange range;
32 RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
33 ret = xf86AddResToList(ret, &range, -1);
35 RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock);
36 ret = xf86AddResToList(ret, &range, -1);
37 return ret;
40 resPtr
41 xf86PciBusAccWindowsFromOS(void)
43 resPtr ret = NULL;
44 resRange range;
47 * Only allow the upper half of the pci memory range to be used
48 * for allocation. The lower half includes magic regions for DMA.
49 * XXX this is not right for XP1000's and similar where we use the
50 * region 0x40000000-0xbfffffff for DMA but this only matters if
51 * the bios screws up the pci region mappings.
53 RANGE(range, 0x80000000, 0xffffffff, ResExcMemBlock);
54 ret = xf86AddResToList(ret, &range, -1);
56 RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock);
57 ret = xf86AddResToList(ret, &range, -1);
58 return ret;
61 #ifdef INCLUDE_UNUSED
63 resPtr
64 xf86IsaBusAccWindowsFromOS(void)
66 resPtr ret = NULL;
67 resRange range;
69 RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
70 ret = xf86AddResToList(ret, &range, -1);
72 RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock);
73 ret = xf86AddResToList(ret, &range, -1);
74 return ret;
77 #endif /* INCLUDE_UNUSED */
79 resPtr
80 xf86AccResFromOS(resPtr ret)
82 resRange range;
85 * Fallback is to claim the following areas:
87 * 0x000c0000 - 0x000effff location of VGA and other extensions ROMS
90 RANGE(range, 0x000c0000, 0x000effff, ResExcMemBlock);
91 ret = xf86AddResToList(ret, &range, -1);
94 * Fallback would be to claim well known ports in the 0x0 - 0x3ff range
95 * along with their sparse I/O aliases, but that's too imprecise. Instead
96 * claim a bare minimum here.
98 RANGE(range, 0x00000000, 0x000000ff, ResExcIoBlock); /* For mainboard */
99 ret = xf86AddResToList(ret, &range, -1);
102 * At minimum, the top and bottom resources must be claimed, so that
103 * resources that are (or appear to be) unallocated can be relocated.
105 RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock);
106 ret = xf86AddResToList(ret, &range, -1);
107 RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock);
108 ret = xf86AddResToList(ret, &range, -1);
109 /* RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock);
110 ret = xf86AddResToList(ret, &range, -1); */
111 RANGE(range, 0xffffffff, 0xffffffff, ResExcIoBlock);
112 ret = xf86AddResToList(ret, &range, -1);
114 /* XXX add others */
115 return ret;
118 #elif defined(__powerpc__)
120 resPtr
121 xf86BusAccWindowsFromOS(void)
123 resPtr ret = NULL;
124 resRange range;
126 RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
127 ret = xf86AddResToList(ret, &range, -1);
129 RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock);
130 ret = xf86AddResToList(ret, &range, -1);
131 return ret;
134 resPtr
135 xf86PciBusAccWindowsFromOS(void)
137 resPtr ret = NULL;
138 resRange range;
140 RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
141 ret = xf86AddResToList(ret, &range, -1);
143 RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock);
144 ret = xf86AddResToList(ret, &range, -1);
145 return ret;
148 #ifdef INCLUDE_UNUSED
150 resPtr
151 xf86IsaBusAccWindowsFromOS(void)
153 resPtr ret = NULL;
154 resRange range;
156 RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
157 ret = xf86AddResToList(ret, &range, -1);
159 RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock);
160 ret = xf86AddResToList(ret, &range, -1);
161 return ret;
164 #endif /* INCLUDE_UNUSED */
166 resPtr
167 xf86AccResFromOS(resPtr ret)
169 resRange range;
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.
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, 0x0000ffff, 0x0000ffff, ResExcIoBlock);
182 ret = xf86AddResToList(ret, &range, -1);
184 return ret;
187 #else
189 #error : Put your platform dependent code here!!
191 #endif
193 #endif /* INCLUDE_XF86_NO_DOMAIN */