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.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 6bf48d7842c6..017cfc3f4789 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -168,6 +168,29 @@ add_io_space (struct acpi_resource_address64 *addr)
168 return IO_SPACE_BASE(i); 168 return IO_SPACE_BASE(i);
169} 169}
170 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
171static acpi_status __devinit 194static acpi_status __devinit
172count_window (struct acpi_resource *resource, void *data) 195count_window (struct acpi_resource *resource, void *data)
173{ 196{
@@ -175,11 +198,9 @@ count_window (struct acpi_resource *resource, void *data)
175 struct acpi_resource_address64 addr; 198 struct acpi_resource_address64 addr;
176 acpi_status status; 199 acpi_status status;
177 200
178 status = acpi_resource_to_address64(resource, &addr); 201 status = resource_to_window(resource, &addr);
179 if (ACPI_SUCCESS(status)) 202 if (ACPI_SUCCESS(status))
180 if (addr.resource_type == ACPI_MEMORY_RANGE || 203 (*windows)++;
181 addr.resource_type == ACPI_IO_RANGE)
182 (*windows)++;
183 204
184 return AE_OK; 205 return AE_OK;
185} 206}
@@ -198,13 +219,11 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
198 unsigned long flags, offset = 0; 219 unsigned long flags, offset = 0;
199 struct resource *root; 220 struct resource *root;
200 221
201 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);
202 if (!ACPI_SUCCESS(status)) 224 if (!ACPI_SUCCESS(status))
203 return AE_OK; 225 return AE_OK;
204 226
205 if (!addr.address_length)
206 return AE_OK;
207
208 if (addr.resource_type == ACPI_MEMORY_RANGE) { 227 if (addr.resource_type == ACPI_MEMORY_RANGE) {
209 flags = IORESOURCE_MEM; 228 flags = IORESOURCE_MEM;
210 root = &iomem_resource; 229 root = &iomem_resource;