9 #include <linux/slab.h>
10 #include <linux/export.h>
11 #include <asm/sn/types.h>
12 #include <asm/sn/addrs.h>
13 #include <asm/sn/io.h>
15 #include <asm/sn/intr.h>
27 static int max_segment_number;
28 static int max_pcibus_number = 255;
42 (
u64) handle, (
u64) address, 0, 0, 0, 0, 0);
57 (
u64) segment, (
u64) busnum, (
u64) address, 0, 0, 0, 0);
74 (
u64) segment, (
u64) bus_number, (
u64) devfn,
86 static void __init sn_fixup_ionodes(
void)
104 status = sal_get_hubdev_info(nasid, (
u64)
__pa(hubdev));
129 u64 legacy_io,
u64 legacy_mem)
134 controller->
window[0].offset = legacy_io;
135 controller->
window[0].resource.name =
"legacy_io";
137 controller->
window[0].resource.start = legacy_io;
138 controller->
window[0].resource.end =
139 controller->
window[0].resource.start + 0xffff;
141 controller->
window[1].offset = legacy_mem;
142 controller->
window[1].resource.name =
"legacy_mem";
144 controller->
window[1].resource.start = legacy_mem;
145 controller->
window[1].resource.end =
146 controller->
window[1].resource.start + (1024 * 1024) - 1;
158 sn_pci_window_fixup(
struct pci_dev *
dev,
unsigned int count,
164 unsigned int new_count;
181 if (pci_addrs[i] == -1)
189 controller->
windows = new_count;
190 controller->
window = new_window;
202 unsigned int count = 0;
207 struct sn_irq_info *sn_irq_info;
210 pcidev_info = kzalloc(
sizeof(
struct pcidev_info),
GFP_KERNEL);
212 panic(
"%s: Unable to alloc memory for pcidev_info", __func__);
214 sn_irq_info = kzalloc(
sizeof(
struct sn_irq_info),
GFP_KERNEL);
216 panic(
"%s: Unable to alloc memory for sn_irq_info", __func__);
283 sn_pci_window_fixup(dev, count, pci_addrs);
295 sn_pci_controller_fixup(
int segment,
int busnum,
struct pci_bus *
bus)
303 status = sal_get_pcibus_info((
u64) segment, (
u64) busnum,
307 prom_bussoft_ptr =
__va(prom_bussoft_ptr);
309 controller = kzalloc(
sizeof(*controller),
GFP_KERNEL);
319 sn_legacy_pci_window_fixup(controller,
322 for (i = 0; i < controller->
windows; i++)
324 &controller->
window[i].resource,
325 controller->
window[i].offset);
347 struct pci_dev *pci_dev =
NULL;
352 if (prom_bussoft_ptr ==
NULL) {
354 "sn_bus_fixup: 0x%04x:0x%02x Unable to "
355 "obtain prom_bussoft_ptr\n",
380 for (i = 0; i <= max_segment_number; i++)
381 for (j = 0; j <= max_pcibus_number; j++)
382 sn_pci_controller_fixup(i, j,
NULL);