24 #include <linux/types.h>
25 #include <linux/pci.h>
26 #include <linux/kernel.h>
35 static struct resource bonito64_mem_resource = {
36 .name =
"Bonito PCI MEM",
40 static struct resource bonito64_io_resource = {
41 .name =
"Bonito PCI I/O",
42 .start = 0x00000000
UL,
47 static struct resource gt64120_mem_resource = {
48 .name =
"GT-64120 PCI MEM",
52 static struct resource gt64120_io_resource = {
53 .name =
"GT-64120 PCI I/O",
57 static struct resource msc_mem_resource = {
58 .name =
"MSC PCI MEM",
62 static struct resource msc_io_resource = {
63 .name =
"MSC PCI I/O",
73 .io_resource = &bonito64_io_resource,
74 .mem_resource = &bonito64_mem_resource,
75 .io_offset = 0x00000000
UL,
80 .io_resource = >64120_io_resource,
81 .mem_resource = >64120_mem_resource,
86 .io_resource = &msc_io_resource,
87 .mem_resource = &msc_mem_resource,
124 if (end1 - start1 > end - start) {
129 mask = ~(start ^
end);
132 mask != ~((mask & -mask) - 1));
134 gt64120_mem_resource.
end =
end;
135 gt64120_controller.mem_offset = (start &
mask) - (map & mask);
146 mask = ~(start ^
end);
148 BUG_ON((start & GT_PCI_HD_MSK) != (map & GT_PCI_HD_MSK) &&
149 mask != ~((mask & -mask) - 1));
151 gt64120_io_resource.
end = (map &
mask) | ~mask;
152 gt64120_controller.io_offset = 0;
158 controller = >64120_controller;
174 if (map3 == map2 + 1) {
179 if (map2 == map1 + 1) {
185 bonito64_mem_resource.
end = start +
187 bonito64_controller.mem_offset = start -
190 controller = &bonito64_controller;
202 msc_mem_resource.
end = (start &
mask) | ~mask;
203 msc_controller.mem_offset = (start &
mask) - (map & mask);
204 #ifdef CONFIG_MIPS_CMP
213 msc_io_resource.
end = (map &
mask) | ~mask;
214 msc_controller.io_offset = 0;
216 #ifdef CONFIG_MIPS_CMP
222 start = start &
mask;
224 if ((start >= msc_mem_resource.
start &&
225 start <= msc_mem_resource.
end) ||
226 (end >= msc_mem_resource.
start &&
227 end <= msc_mem_resource.
end)) {
229 start =
max(start, msc_mem_resource.
start);
230 end =
min(end, msc_mem_resource.
end);
231 if (start - msc_mem_resource.
start >=
232 msc_mem_resource.
end - end)
233 msc_mem_resource.
end = start - 1;
235 msc_mem_resource.
start = end + 1;
238 controller = &msc_controller;
245 if (controller->io_resource->start < 0x00002000UL)
246 controller->io_resource->start = 0x00002000
UL;