[PCI] Fix I/O range size of the resource descriptors

Fixes incorrect PCI IDE resources in VPC 2007
CORE-17256
This commit is contained in:
Dmitry Borisov 2023-01-04 22:58:39 +06:00 committed by Timo Kreuzer
parent d3a718eb01
commit 3dd3d10531

View file

@ -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)