mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-22 20:23:57 +08:00
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>
This commit is contained in:
parent
14d76b68f2
commit
812dbd9994
@ -283,7 +283,7 @@ static acpi_status setup_resource(struct acpi_resource *acpi_res, void *data)
|
|||||||
struct acpi_resource_address64 addr;
|
struct acpi_resource_address64 addr;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
u64 start, orig_end, end;
|
u64 start, orig_end, end, res_end;
|
||||||
|
|
||||||
status = resource_to_addr(acpi_res, &addr);
|
status = resource_to_addr(acpi_res, &addr);
|
||||||
if (!ACPI_SUCCESS(status))
|
if (!ACPI_SUCCESS(status))
|
||||||
@ -293,8 +293,10 @@ static acpi_status setup_resource(struct acpi_resource *acpi_res, void *data)
|
|||||||
flags = IORESOURCE_MEM;
|
flags = IORESOURCE_MEM;
|
||||||
if (addr.info.mem.caching == ACPI_PREFETCHABLE_MEMORY)
|
if (addr.info.mem.caching == ACPI_PREFETCHABLE_MEMORY)
|
||||||
flags |= IORESOURCE_PREFETCH;
|
flags |= IORESOURCE_PREFETCH;
|
||||||
|
res_end = (u64)iomem_resource.end;
|
||||||
} else if (addr.resource_type == ACPI_IO_RANGE) {
|
} else if (addr.resource_type == ACPI_IO_RANGE) {
|
||||||
flags = IORESOURCE_IO;
|
flags = IORESOURCE_IO;
|
||||||
|
res_end = (u64)ioport_resource.end;
|
||||||
} else
|
} else
|
||||||
return AE_OK;
|
return AE_OK;
|
||||||
|
|
||||||
@ -302,7 +304,7 @@ static acpi_status setup_resource(struct acpi_resource *acpi_res, void *data)
|
|||||||
orig_end = end = addr.address.maximum + addr.address.translation_offset;
|
orig_end = end = addr.address.maximum + addr.address.translation_offset;
|
||||||
|
|
||||||
/* Exclude non-addressable range or non-addressable portion of range */
|
/* Exclude non-addressable range or non-addressable portion of range */
|
||||||
end = min(end, (u64)iomem_resource.end);
|
end = min(end, res_end);
|
||||||
if (end <= start) {
|
if (end <= start) {
|
||||||
dev_info(&info->bridge->dev,
|
dev_info(&info->bridge->dev,
|
||||||
"host bridge window [%#llx-%#llx] "
|
"host bridge window [%#llx-%#llx] "
|
||||||
|
Loading…
Reference in New Issue
Block a user