aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/pci/pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ia64/pci/pci.c')
-rw-r--r--arch/ia64/pci/pci.c58
1 files changed, 27 insertions, 31 deletions
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 9b5de589b82f..017cfc3f4789 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -120,29 +120,6 @@ struct pci_ops pci_root_ops = {
120 .write = pci_write, 120 .write = pci_write,
121}; 121};
122 122
123#ifdef CONFIG_NUMA
124extern acpi_status acpi_map_iosapic(acpi_handle, u32, void *, void **);
125static void acpi_map_iosapics(void)
126{
127 acpi_get_devices(NULL, acpi_map_iosapic, NULL, NULL);
128}
129#else
130static void acpi_map_iosapics(void)
131{
132 return;
133}
134#endif /* CONFIG_NUMA */
135
136static int __init
137pci_acpi_init (void)
138{
139 acpi_map_iosapics();
140
141 return 0;
142}
143
144subsys_initcall(pci_acpi_init);
145
146/* Called by ACPI when it finds a new root bus. */ 123/* Called by ACPI when it finds a new root bus. */
147 124
148static struct pci_controller * __devinit 125static struct pci_controller * __devinit
@@ -191,6 +168,29 @@ add_io_space (struct acpi_resource_address64 *addr)
191 return IO_SPACE_BASE(i); 168 return IO_SPACE_BASE(i);
192} 169}
193 170
171static acpi_status __devinit resource_to_window(struct acpi_resource *resource,
172 struct acpi_resource_address64 *addr)
173{
174 acpi_status status;
175
176 /*
177 * We're only interested in _CRS descriptors that are
178 * - address space descriptors for memory or I/O space
179 * - non-zero size
180 * - producers, i.e., the address space is routed downstream,
181 * not consumed by the bridge itself
182 */
183 status = acpi_resource_to_address64(resource, addr);
184 if (ACPI_SUCCESS(status) &&
185 (addr->resource_type == ACPI_MEMORY_RANGE ||
186 addr->resource_type == ACPI_IO_RANGE) &&
187 addr->address_length &&
188 addr->producer_consumer == ACPI_PRODUCER)
189 return AE_OK;
190
191 return AE_ERROR;
192}
193
194static acpi_status __devinit 194static acpi_status __devinit
195count_window (struct acpi_resource *resource, void *data) 195count_window (struct acpi_resource *resource, void *data)
196{ 196{
@@ -198,11 +198,9 @@ count_window (struct acpi_resource *resource, void *data)
198 struct acpi_resource_address64 addr; 198 struct acpi_resource_address64 addr;
199 acpi_status status; 199 acpi_status status;
200 200
201 status = acpi_resource_to_address64(resource, &addr); 201 status = resource_to_window(resource, &addr);
202 if (ACPI_SUCCESS(status)) 202 if (ACPI_SUCCESS(status))
203 if (addr.resource_type == ACPI_MEMORY_RANGE || 203 (*windows)++;
204 addr.resource_type == ACPI_IO_RANGE)
205 (*windows)++;
206 204
207 return AE_OK; 205 return AE_OK;
208} 206}
@@ -221,13 +219,11 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
221 unsigned long flags, offset = 0; 219 unsigned long flags, offset = 0;
222 struct resource *root; 220 struct resource *root;
223 221
224 status = acpi_resource_to_address64(res, &addr); 222 /* Return AE_OK for non-window resources to keep scanning for more */
223 status = resource_to_window(res, &addr);
225 if (!ACPI_SUCCESS(status)) 224 if (!ACPI_SUCCESS(status))
226 return AE_OK; 225 return AE_OK;
227 226
228 if (!addr.address_length)
229 return AE_OK;
230
231 if (addr.resource_type == ACPI_MEMORY_RANGE) { 227 if (addr.resource_type == ACPI_MEMORY_RANGE) {
232 flags = IORESOURCE_MEM; 228 flags = IORESOURCE_MEM;
233 root = &iomem_resource; 229 root = &iomem_resource;