diff options
| author | Jiang Liu <jiang.liu@linux.intel.com> | 2015-02-05 00:44:45 -0500 |
|---|---|---|
| committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-02-05 09:09:25 -0500 |
| commit | 812dbd9994f122629db73205a7f7f46b430a6360 (patch) | |
| tree | c224e43c42be39cce79090931a8a98a97be313bb | |
| parent | 14d76b68f2819a1d0b50236a7e9e9f2ea69869d9 (diff) | |
x86/PCI: Fix the range check for IO resources
The range check in setup_res() checks the IO range against
iomem_resource. That's just wrong.
Reworked based on Thomas original patch.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
| -rw-r--r-- | arch/x86/pci/acpi.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index bb98afd0591e..1d725d99963d 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c | |||
| @@ -283,7 +283,7 @@ static acpi_status setup_resource(struct acpi_resource *acpi_res, void *data) | |||
| 283 | struct acpi_resource_address64 addr; | 283 | struct acpi_resource_address64 addr; |
| 284 | acpi_status status; | 284 | acpi_status status; |
| 285 | unsigned long flags; | 285 | unsigned long flags; |
| 286 | u64 start, orig_end, end; | 286 | u64 start, orig_end, end, res_end; |
| 287 | 287 | ||
| 288 | status = resource_to_addr(acpi_res, &addr); | 288 | status = resource_to_addr(acpi_res, &addr); |
| 289 | if (!ACPI_SUCCESS(status)) | 289 | if (!ACPI_SUCCESS(status)) |
| @@ -293,8 +293,10 @@ static acpi_status setup_resource(struct acpi_resource *acpi_res, void *data) | |||
| 293 | flags = IORESOURCE_MEM; | 293 | flags = IORESOURCE_MEM; |
| 294 | if (addr.info.mem.caching == ACPI_PREFETCHABLE_MEMORY) | 294 | if (addr.info.mem.caching == ACPI_PREFETCHABLE_MEMORY) |
| 295 | flags |= IORESOURCE_PREFETCH; | 295 | flags |= IORESOURCE_PREFETCH; |
| 296 | res_end = (u64)iomem_resource.end; | ||
| 296 | } else if (addr.resource_type == ACPI_IO_RANGE) { | 297 | } else if (addr.resource_type == ACPI_IO_RANGE) { |
| 297 | flags = IORESOURCE_IO; | 298 | flags = IORESOURCE_IO; |
| 299 | res_end = (u64)ioport_resource.end; | ||
| 298 | } else | 300 | } else |
| 299 | return AE_OK; | 301 | return AE_OK; |
| 300 | 302 | ||
| @@ -302,7 +304,7 @@ static acpi_status setup_resource(struct acpi_resource *acpi_res, void *data) | |||
| 302 | orig_end = end = addr.address.maximum + addr.address.translation_offset; | 304 | orig_end = end = addr.address.maximum + addr.address.translation_offset; |
| 303 | 305 | ||
| 304 | /* Exclude non-addressable range or non-addressable portion of range */ | 306 | /* Exclude non-addressable range or non-addressable portion of range */ |
| 305 | end = min(end, (u64)iomem_resource.end); | 307 | end = min(end, res_end); |
| 306 | if (end <= start) { | 308 | if (end <= start) { |
| 307 | dev_info(&info->bridge->dev, | 309 | dev_info(&info->bridge->dev, |
| 308 | "host bridge window [%#llx-%#llx] " | 310 | "host bridge window [%#llx-%#llx] " |
