https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3dd3d1053123cb750dbc6…
commit 3dd3d1053123cb750dbc6b9fb8728f58b6327705
Author: Dmitry Borisov <di.sean(a)protonmail.com>
AuthorDate: Wed Jan 4 22:58:39 2023 +0600
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Sat Jan 21 07:33:03 2023 +0100
[PCI] Fix I/O range size of the resource descriptors
Fixes incorrect PCI IDE resources in VPC 2007
CORE-17256
---
drivers/bus/pci/pdo.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/bus/pci/pdo.c b/drivers/bus/pci/pdo.c
index 139aed69439..88576bbaa26 100644
--- a/drivers/bus/pci/pdo.c
+++ b/drivers/bus/pci/pdo.c
@@ -283,6 +283,7 @@ PdoGetRangeLength(PPDO_DEVICE_EXTENSION DeviceExtension,
ULONGLONG Bar;
} NewValue;
ULONG Offset;
+ ULONGLONG Size;
/* Compute the offset of this BAR in PCI config space */
Offset = 0x10 + Bar * 4;
@@ -359,9 +360,10 @@ PdoGetRangeLength(PPDO_DEVICE_EXTENSION DeviceExtension,
? (OriginalValue.Bar & PCI_ADDRESS_IO_ADDRESS_MASK_64)
: (OriginalValue.Bar & PCI_ADDRESS_MEMORY_ADDRESS_MASK_64));
- *Length = ~((NewValue.Bar & PCI_ADDRESS_IO_SPACE)
- ? (NewValue.Bar & PCI_ADDRESS_IO_ADDRESS_MASK_64)
- : (NewValue.Bar & PCI_ADDRESS_MEMORY_ADDRESS_MASK_64)) + 1;
+ Size = (NewValue.Bar & PCI_ADDRESS_IO_SPACE)
+ ? (NewValue.Bar & PCI_ADDRESS_IO_ADDRESS_MASK_64)
+ : (NewValue.Bar & PCI_ADDRESS_MEMORY_ADDRESS_MASK_64);
+ *Length = Size & ~(Size - 1);
*Flags = (NewValue.Bar & PCI_ADDRESS_IO_SPACE)
? (NewValue.Bar & ~PCI_ADDRESS_IO_ADDRESS_MASK_64)