mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 03:54:02 +00:00
[PCI]
- Set device command flags when starting the PCI device PDO svn path=/branches/usb-bringup-trunk/; revision=55540
This commit is contained in:
parent
66246c5c2d
commit
ec01d86009
3 changed files with 99 additions and 41 deletions
|
@ -341,7 +341,6 @@ FdoQueryBusRelations(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Device->RemovePending) {
|
|
||||||
/* Reference the physical device object. The PnP manager
|
/* Reference the physical device object. The PnP manager
|
||||||
will dereference it again when it is no longer needed */
|
will dereference it again when it is no longer needed */
|
||||||
ObReferenceObject(Device->Pdo);
|
ObReferenceObject(Device->Pdo);
|
||||||
|
@ -349,7 +348,6 @@ FdoQueryBusRelations(
|
||||||
Relations->Objects[i] = Device->Pdo;
|
Relations->Objects[i] = Device->Pdo;
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
|
||||||
|
|
||||||
CurrentEntry = CurrentEntry->Flink;
|
CurrentEntry = CurrentEntry->Flink;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,12 @@ typedef struct _PCI_DEVICE
|
||||||
PCI_SLOT_NUMBER SlotNumber;
|
PCI_SLOT_NUMBER SlotNumber;
|
||||||
// PCI configuration data
|
// PCI configuration data
|
||||||
PCI_COMMON_CONFIG PciConfig;
|
PCI_COMMON_CONFIG PciConfig;
|
||||||
// Flag used during enumeration to locate removed devices
|
// Enable memory space
|
||||||
BOOLEAN RemovePending;
|
BOOLEAN EnableMemorySpace;
|
||||||
|
// Enable I/O space
|
||||||
|
BOOLEAN EnableIoSpace;
|
||||||
|
// Enable bus master
|
||||||
|
BOOLEAN EnableBusMaster;
|
||||||
} PCI_DEVICE, *PPCI_DEVICE;
|
} PCI_DEVICE, *PPCI_DEVICE;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -766,6 +766,9 @@ PdoQueryResources(
|
||||||
Descriptor->u.Port.Start.QuadPart =
|
Descriptor->u.Port.Start.QuadPart =
|
||||||
(ULONGLONG)Base;
|
(ULONGLONG)Base;
|
||||||
Descriptor->u.Port.Length = Length;
|
Descriptor->u.Port.Length = Length;
|
||||||
|
|
||||||
|
/* Enable IO space access */
|
||||||
|
DeviceExtension->PciDevice->EnableIoSpace = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -775,6 +778,9 @@ PdoQueryResources(
|
||||||
Descriptor->u.Memory.Start.QuadPart =
|
Descriptor->u.Memory.Start.QuadPart =
|
||||||
(ULONGLONG)Base;
|
(ULONGLONG)Base;
|
||||||
Descriptor->u.Memory.Length = Length;
|
Descriptor->u.Memory.Length = Length;
|
||||||
|
|
||||||
|
/* Enable memory space access */
|
||||||
|
DeviceExtension->PciDevice->EnableMemorySpace = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Descriptor++;
|
Descriptor++;
|
||||||
|
@ -792,6 +798,9 @@ PdoQueryResources(
|
||||||
Descriptor->u.Interrupt.Vector = PciConfig.u.type0.InterruptLine;
|
Descriptor->u.Interrupt.Vector = PciConfig.u.type0.InterruptLine;
|
||||||
Descriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
|
Descriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Allow bus master mode */
|
||||||
|
DeviceExtension->PciDevice->EnableBusMaster = TRUE;
|
||||||
}
|
}
|
||||||
else if (PCI_CONFIGURATION_TYPE(&PciConfig) == PCI_BRIDGE_TYPE)
|
else if (PCI_CONFIGURATION_TYPE(&PciConfig) == PCI_BRIDGE_TYPE)
|
||||||
{
|
{
|
||||||
|
@ -821,6 +830,9 @@ PdoQueryResources(
|
||||||
Descriptor->u.Port.Start.QuadPart =
|
Descriptor->u.Port.Start.QuadPart =
|
||||||
(ULONGLONG)Base;
|
(ULONGLONG)Base;
|
||||||
Descriptor->u.Port.Length = Length;
|
Descriptor->u.Port.Length = Length;
|
||||||
|
|
||||||
|
/* Enable IO space access */
|
||||||
|
DeviceExtension->PciDevice->EnableIoSpace = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -830,6 +842,9 @@ PdoQueryResources(
|
||||||
Descriptor->u.Memory.Start.QuadPart =
|
Descriptor->u.Memory.Start.QuadPart =
|
||||||
(ULONGLONG)Base;
|
(ULONGLONG)Base;
|
||||||
Descriptor->u.Memory.Length = Length;
|
Descriptor->u.Memory.Length = Length;
|
||||||
|
|
||||||
|
/* Enable memory space access */
|
||||||
|
DeviceExtension->PciDevice->EnableMemorySpace = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Descriptor++;
|
Descriptor++;
|
||||||
|
@ -1212,6 +1227,7 @@ PdoStartDevice(
|
||||||
ULONG i, ii;
|
ULONG i, ii;
|
||||||
PPDO_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
|
PPDO_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
|
||||||
UCHAR Irq;
|
UCHAR Irq;
|
||||||
|
USHORT Command;
|
||||||
|
|
||||||
if (!RawResList)
|
if (!RawResList)
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -1228,7 +1244,7 @@ PdoStartDevice(
|
||||||
|
|
||||||
if (RawPartialDesc->Type == CmResourceTypeInterrupt)
|
if (RawPartialDesc->Type == CmResourceTypeInterrupt)
|
||||||
{
|
{
|
||||||
DPRINT1("Assigning IRQ %x to PCI device (%x, %x)\n",
|
DPRINT1("Assigning IRQ %d to PCI device 0x%x on bus 0x%x\n",
|
||||||
RawPartialDesc->u.Interrupt.Vector,
|
RawPartialDesc->u.Interrupt.Vector,
|
||||||
DeviceExtension->PciDevice->SlotNumber.u.AsULONG,
|
DeviceExtension->PciDevice->SlotNumber.u.AsULONG,
|
||||||
DeviceExtension->PciDevice->BusNumber);
|
DeviceExtension->PciDevice->BusNumber);
|
||||||
|
@ -1244,6 +1260,46 @@ PdoStartDevice(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DPRINT1("Enabling command flags for PCI device 0x%x on bus 0x%x: ",
|
||||||
|
DeviceExtension->PciDevice->SlotNumber.u.AsULONG,
|
||||||
|
DeviceExtension->PciDevice->BusNumber);
|
||||||
|
if (DeviceExtension->PciDevice->EnableBusMaster)
|
||||||
|
{
|
||||||
|
Command |= PCI_ENABLE_BUS_MASTER;
|
||||||
|
DbgPrint("[Bus master] ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DeviceExtension->PciDevice->EnableMemorySpace)
|
||||||
|
{
|
||||||
|
Command |= PCI_ENABLE_MEMORY_SPACE;
|
||||||
|
DbgPrint("[Memory space enable] ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DeviceExtension->PciDevice->EnableIoSpace)
|
||||||
|
{
|
||||||
|
Command |= PCI_ENABLE_IO_SPACE;
|
||||||
|
DbgPrint("[I/O space enable] ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Command != 0)
|
||||||
|
{
|
||||||
|
DbgPrint("\n");
|
||||||
|
|
||||||
|
/* OR with the previous value */
|
||||||
|
Command |= DeviceExtension->PciDevice->PciConfig.Command;
|
||||||
|
|
||||||
|
HalSetBusDataByOffset(PCIConfiguration,
|
||||||
|
DeviceExtension->PciDevice->BusNumber,
|
||||||
|
DeviceExtension->PciDevice->SlotNumber.u.AsULONG,
|
||||||
|
&Command,
|
||||||
|
FIELD_OFFSET(PCI_COMMON_CONFIG, Command),
|
||||||
|
sizeof(USHORT));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DbgPrint("None\n");
|
||||||
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue