diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/ia64/sn/kernel/io_init.c | 56 |
1 files changed, 26 insertions, 30 deletions
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c index 06a172cb37f4..2b00adedc45e 100644 --- a/arch/ia64/sn/kernel/io_init.c +++ b/arch/ia64/sn/kernel/io_init.c | |||
@@ -118,34 +118,26 @@ static void __init sn_fixup_ionodes(void) | |||
118 | } | 118 | } |
119 | 119 | ||
120 | /* | 120 | /* |
121 | * sn_pci_legacy_window_fixup - Create PCI controller windows for | 121 | * sn_pci_legacy_window_fixup - Setup PCI resources for |
122 | * legacy IO and MEM space. This needs to | 122 | * legacy IO and MEM space. This needs to |
123 | * be done here, as the PROM does not have | 123 | * be done here, as the PROM does not have |
124 | * ACPI support defining the root buses | 124 | * ACPI support defining the root buses |
125 | * and their resources (_CRS), | 125 | * and their resources (_CRS), |
126 | */ | 126 | */ |
127 | static void | 127 | static void |
128 | sn_legacy_pci_window_fixup(struct pci_controller *controller, | 128 | sn_legacy_pci_window_fixup(struct resource *res, |
129 | u64 legacy_io, u64 legacy_mem) | 129 | u64 legacy_io, u64 legacy_mem) |
130 | { | 130 | { |
131 | controller->window = kcalloc(2, sizeof(struct pci_window), | 131 | res[0].name = "legacy_io"; |
132 | GFP_KERNEL); | 132 | res[0].flags = IORESOURCE_IO; |
133 | BUG_ON(controller->window == NULL); | 133 | res[0].start = legacy_io; |
134 | controller->window[0].offset = legacy_io; | 134 | res[0].end = res[0].start + 0xffff; |
135 | controller->window[0].resource.name = "legacy_io"; | 135 | res[0].parent = &ioport_resource; |
136 | controller->window[0].resource.flags = IORESOURCE_IO; | 136 | res[1].name = "legacy_mem"; |
137 | controller->window[0].resource.start = legacy_io; | 137 | res[1].flags = IORESOURCE_MEM; |
138 | controller->window[0].resource.end = | 138 | res[1].start = legacy_mem; |
139 | controller->window[0].resource.start + 0xffff; | 139 | res[1].end = res[1].start + (1024 * 1024) - 1; |
140 | controller->window[0].resource.parent = &ioport_resource; | 140 | res[1].parent = &iomem_resource; |
141 | controller->window[1].offset = legacy_mem; | ||
142 | controller->window[1].resource.name = "legacy_mem"; | ||
143 | controller->window[1].resource.flags = IORESOURCE_MEM; | ||
144 | controller->window[1].resource.start = legacy_mem; | ||
145 | controller->window[1].resource.end = | ||
146 | controller->window[1].resource.start + (1024 * 1024) - 1; | ||
147 | controller->window[1].resource.parent = &iomem_resource; | ||
148 | controller->windows = 2; | ||
149 | } | 141 | } |
150 | 142 | ||
151 | /* | 143 | /* |
@@ -244,8 +236,8 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus) | |||
244 | s64 status = 0; | 236 | s64 status = 0; |
245 | struct pci_controller *controller; | 237 | struct pci_controller *controller; |
246 | struct pcibus_bussoft *prom_bussoft_ptr; | 238 | struct pcibus_bussoft *prom_bussoft_ptr; |
239 | struct resource *res; | ||
247 | LIST_HEAD(resources); | 240 | LIST_HEAD(resources); |
248 | int i; | ||
249 | 241 | ||
250 | status = sal_get_pcibus_info((u64) segment, (u64) busnum, | 242 | status = sal_get_pcibus_info((u64) segment, (u64) busnum, |
251 | (u64) ia64_tpa(&prom_bussoft_ptr)); | 243 | (u64) ia64_tpa(&prom_bussoft_ptr)); |
@@ -257,19 +249,23 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus) | |||
257 | BUG_ON(!controller); | 249 | BUG_ON(!controller); |
258 | controller->segment = segment; | 250 | controller->segment = segment; |
259 | 251 | ||
252 | res = kcalloc(2, sizeof(struct resource), GFP_KERNEL); | ||
253 | BUG_ON(!res); | ||
254 | |||
260 | /* | 255 | /* |
261 | * Temporarily save the prom_bussoft_ptr for use by sn_bus_fixup(). | 256 | * Temporarily save the prom_bussoft_ptr for use by sn_bus_fixup(). |
262 | * (platform_data will be overwritten later in sn_common_bus_fixup()) | 257 | * (platform_data will be overwritten later in sn_common_bus_fixup()) |
263 | */ | 258 | */ |
264 | controller->platform_data = prom_bussoft_ptr; | 259 | controller->platform_data = prom_bussoft_ptr; |
265 | 260 | ||
266 | sn_legacy_pci_window_fixup(controller, | 261 | sn_legacy_pci_window_fixup(res, |
267 | prom_bussoft_ptr->bs_legacy_io, | 262 | prom_bussoft_ptr->bs_legacy_io, |
268 | prom_bussoft_ptr->bs_legacy_mem); | 263 | prom_bussoft_ptr->bs_legacy_mem); |
269 | for (i = 0; i < controller->windows; i++) | 264 | pci_add_resource_offset(&resources, &res[0], |
270 | pci_add_resource_offset(&resources, | 265 | prom_bussoft_ptr->bs_legacy_io); |
271 | &controller->window[i].resource, | 266 | pci_add_resource_offset(&resources, &res[1], |
272 | controller->window[i].offset); | 267 | prom_bussoft_ptr->bs_legacy_mem); |
268 | |||
273 | bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, controller, | 269 | bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, controller, |
274 | &resources); | 270 | &resources); |
275 | if (bus == NULL) | 271 | if (bus == NULL) |
@@ -280,7 +276,7 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus) | |||
280 | return; | 276 | return; |
281 | 277 | ||
282 | error_return: | 278 | error_return: |
283 | 279 | kfree(res); | |
284 | kfree(controller); | 280 | kfree(controller); |
285 | return; | 281 | return; |
286 | } | 282 | } |