Author: fireball
Date: Wed Jun 27 22:05:04 2007
New Revision: 27290
URL:
http://svn.reactos.org/svn/reactos?rev=27290&view=rev
Log:
- Fix incompatibility: In Windows IoGetDeviceProperty(DevicePropertyAddress) returns
information as 0xDDDDFFFF (D=Device, F=Function) and not as a PCI_SLOT_NUMBER structure.
This is confirmed by tests in Windows XP and 2003, and also found via Google.
- Fix incorrect usage of DevicePropertyAddress in videoprt and ndis (thus
ndis.sys+pcnet.sys load [again] in Windows XP).
Modified:
trunk/reactos/drivers/bus/pci/pdo.c
trunk/reactos/drivers/network/ndis/ndis/miniport.c
trunk/reactos/drivers/video/videoprt/videoprt.c
Modified: trunk/reactos/drivers/bus/pci/pdo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/pci/pdo.c?rev=…
==============================================================================
--- trunk/reactos/drivers/bus/pci/pdo.c (original)
+++ trunk/reactos/drivers/bus/pci/pdo.c Wed Jun 27 22:05:04 2007
@@ -157,6 +157,7 @@
{
PPDO_DEVICE_EXTENSION DeviceExtension;
PDEVICE_CAPABILITIES DeviceCapabilities;
+ ULONG DeviceNumber, FunctionNumber;
DPRINT("Called\n");
@@ -166,8 +167,11 @@
if (DeviceCapabilities->Version != 1)
return STATUS_UNSUCCESSFUL;
+ DeviceNumber = DeviceExtension->PciDevice->SlotNumber.u.bits.DeviceNumber;
+ FunctionNumber = DeviceExtension->PciDevice->SlotNumber.u.bits.FunctionNumber;
+
DeviceCapabilities->UniqueID = FALSE;
- DeviceCapabilities->Address =
DeviceExtension->PciDevice->SlotNumber.u.AsULONG;
+ DeviceCapabilities->Address = ((DeviceNumber << 16) & 0xFFFF0000) +
(FunctionNumber & 0xFFFF);
DeviceCapabilities->UINumber = (ULONG)-1; /* FIXME */
return STATUS_SUCCESS;
Modified: trunk/reactos/drivers/network/ndis/ndis/miniport.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/miniport.c (original)
+++ trunk/reactos/drivers/network/ndis/ndis/miniport.c Wed Jun 27 22:05:04 2007
@@ -1404,7 +1404,18 @@
else
Adapter->NdisMiniportBlock.SlotNumber = 0;
}
-
+ else
+ {
+ /* Convert slotnumber to PCI_SLOT_NUMBER */
+ ULONG PciSlotNumber = Adapter->NdisMiniportBlock.SlotNumber;
+ PCI_SLOT_NUMBER SlotNumber;
+
+ SlotNumber.u.AsULONG = 0;
+ SlotNumber.u.bits.DeviceNumber = (PciSlotNumber >> 16) & 0xFFFF;
+ SlotNumber.u.bits.FunctionNumber = PciSlotNumber & 0xFFFF;
+
+ Adapter->NdisMiniportBlock.SlotNumber = SlotNumber.u.AsULONG;
+ }
NdisCloseConfiguration(ConfigHandle);
/*
Modified: trunk/reactos/drivers/video/videoprt/videoprt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/video/videoprt/vid…
==============================================================================
--- trunk/reactos/drivers/video/videoprt/videoprt.c (original)
+++ trunk/reactos/drivers/video/videoprt/videoprt.c Wed Jun 27 22:05:04 2007
@@ -227,6 +227,8 @@
{
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
ULONG DeviceNumber;
+ ULONG PciSlotNumber;
+ PCI_SLOT_NUMBER SlotNumber;
ULONG Size;
NTSTATUS Status;
WCHAR DeviceBuffer[20];
@@ -345,8 +347,14 @@
PhysicalDeviceObject,
DevicePropertyAddress,
Size,
- &DeviceExtension->SystemIoSlotNumber,
+ &PciSlotNumber,
&Size);
+
+ /* Convert slotnumber to PCI_SLOT_NUMBER */
+ SlotNumber.u.AsULONG = 0;
+ SlotNumber.u.bits.DeviceNumber = (PciSlotNumber >> 16) & 0xFFFF;
+ SlotNumber.u.bits.FunctionNumber = PciSlotNumber & 0xFFFF;
+ DeviceExtension->SystemIoSlotNumber = SlotNumber.u.AsULONG;
}
InitializeListHead(&DeviceExtension->AddressMappingListHead);