mirror of
https://github.com/reactos/reactos.git
synced 2025-07-27 07:41:51 +00:00
[PCIX]
- Ignore invalid extended capabilities pointer - Don't hang on unimplemented IRPs that we actually use svn path=/branches/usb-bringup-trunk/; revision=55539
This commit is contained in:
parent
a8c87a2245
commit
66246c5c2d
3 changed files with 67 additions and 63 deletions
|
@ -1196,71 +1196,79 @@ PciGetEnhancedCapabilities(IN PPCI_PDO_EXTENSION PdoExtension,
|
||||||
CapPtr = PciData->u.type0.CapabilitiesPtr;
|
CapPtr = PciData->u.type0.CapabilitiesPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure the pointer is spec-aligned and located, and save it */
|
/* Skip garbage capabilities pointer */
|
||||||
DPRINT1("Device has capabilities at: %lx\n", CapPtr);
|
if (((CapPtr & 0x3) != 0) || (CapPtr < PCI_COMMON_HDR_LENGTH))
|
||||||
ASSERT(((CapPtr & 0x3) == 0) && (CapPtr >= PCI_COMMON_HDR_LENGTH));
|
|
||||||
PdoExtension->CapabilitiesPtr = CapPtr;
|
|
||||||
|
|
||||||
/* Check for PCI-to-PCI Bridges and AGP bridges */
|
|
||||||
if ((PdoExtension->BaseClass == PCI_CLASS_BRIDGE_DEV) &&
|
|
||||||
((PdoExtension->SubClass == PCI_SUBCLASS_BR_HOST) ||
|
|
||||||
(PdoExtension->SubClass == PCI_SUBCLASS_BR_PCI_TO_PCI)))
|
|
||||||
{
|
{
|
||||||
/* Query either the raw AGP capabilitity, or the Target AGP one */
|
/* Report no extended capabilities */
|
||||||
TargetAgpCapabilityId = (PdoExtension->SubClass ==
|
PdoExtension->CapabilitiesPtr = 0;
|
||||||
PCI_SUBCLASS_BR_PCI_TO_PCI) ?
|
PdoExtension->HackFlags |= PCI_HACK_NO_PM_CAPS;
|
||||||
PCI_CAPABILITY_ID_AGP_TARGET :
|
|
||||||
PCI_CAPABILITY_ID_AGP;
|
|
||||||
if (PciReadDeviceCapability(PdoExtension,
|
|
||||||
PdoExtension->CapabilitiesPtr,
|
|
||||||
TargetAgpCapabilityId,
|
|
||||||
&AgpCapability,
|
|
||||||
sizeof(PCI_CAPABILITIES_HEADER)))
|
|
||||||
{
|
|
||||||
/* AGP target ID was found, store it */
|
|
||||||
DPRINT1("AGP ID: %lx\n", TargetAgpCapabilityId);
|
|
||||||
PdoExtension->TargetAgpCapabilityId = TargetAgpCapabilityId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
/* Check for devices that are known not to have proper power management */
|
|
||||||
if (!(PdoExtension->HackFlags & PCI_HACK_NO_PM_CAPS))
|
|
||||||
{
|
{
|
||||||
/* Query if this device supports power management */
|
DPRINT1("Device has capabilities at: %lx\n", CapPtr);
|
||||||
if (!PciReadDeviceCapability(PdoExtension,
|
PdoExtension->CapabilitiesPtr = CapPtr;
|
||||||
PdoExtension->CapabilitiesPtr,
|
|
||||||
PCI_CAPABILITY_ID_POWER_MANAGEMENT,
|
|
||||||
&PowerCapabilities.Header,
|
|
||||||
sizeof(PCI_PM_CAPABILITY)))
|
|
||||||
{
|
|
||||||
/* No power management, so act as if it had the hackflag set */
|
|
||||||
DPRINT1("No PM caps, disabling PM\n");
|
|
||||||
PdoExtension->HackFlags |= PCI_HACK_NO_PM_CAPS;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Otherwise, pick the highest wake level that is supported */
|
|
||||||
WakeLevel = PowerDeviceUnspecified;
|
|
||||||
if (PowerCapabilities.PMC.Capabilities.Support.PMED0)
|
|
||||||
WakeLevel = PowerDeviceD0;
|
|
||||||
if (PowerCapabilities.PMC.Capabilities.Support.PMED1)
|
|
||||||
WakeLevel = PowerDeviceD1;
|
|
||||||
if (PowerCapabilities.PMC.Capabilities.Support.PMED2)
|
|
||||||
WakeLevel = PowerDeviceD2;
|
|
||||||
if (PowerCapabilities.PMC.Capabilities.Support.PMED3Hot)
|
|
||||||
WakeLevel = PowerDeviceD3;
|
|
||||||
if (PowerCapabilities.PMC.Capabilities.Support.PMED3Cold)
|
|
||||||
WakeLevel = PowerDeviceD3;
|
|
||||||
PdoExtension->PowerState.DeviceWakeLevel = WakeLevel;
|
|
||||||
|
|
||||||
/* Convert the PCI power state to the NT power state */
|
/* Check for PCI-to-PCI Bridges and AGP bridges */
|
||||||
PdoExtension->PowerState.CurrentDeviceState =
|
if ((PdoExtension->BaseClass == PCI_CLASS_BRIDGE_DEV) &&
|
||||||
|
((PdoExtension->SubClass == PCI_SUBCLASS_BR_HOST) ||
|
||||||
|
(PdoExtension->SubClass == PCI_SUBCLASS_BR_PCI_TO_PCI)))
|
||||||
|
{
|
||||||
|
/* Query either the raw AGP capabilitity, or the Target AGP one */
|
||||||
|
TargetAgpCapabilityId = (PdoExtension->SubClass ==
|
||||||
|
PCI_SUBCLASS_BR_PCI_TO_PCI) ?
|
||||||
|
PCI_CAPABILITY_ID_AGP_TARGET :
|
||||||
|
PCI_CAPABILITY_ID_AGP;
|
||||||
|
if (PciReadDeviceCapability(PdoExtension,
|
||||||
|
PdoExtension->CapabilitiesPtr,
|
||||||
|
TargetAgpCapabilityId,
|
||||||
|
&AgpCapability,
|
||||||
|
sizeof(PCI_CAPABILITIES_HEADER)))
|
||||||
|
{
|
||||||
|
/* AGP target ID was found, store it */
|
||||||
|
DPRINT1("AGP ID: %lx\n", TargetAgpCapabilityId);
|
||||||
|
PdoExtension->TargetAgpCapabilityId = TargetAgpCapabilityId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for devices that are known not to have proper power management */
|
||||||
|
if (!(PdoExtension->HackFlags & PCI_HACK_NO_PM_CAPS))
|
||||||
|
{
|
||||||
|
/* Query if this device supports power management */
|
||||||
|
if (!PciReadDeviceCapability(PdoExtension,
|
||||||
|
PdoExtension->CapabilitiesPtr,
|
||||||
|
PCI_CAPABILITY_ID_POWER_MANAGEMENT,
|
||||||
|
&PowerCapabilities.Header,
|
||||||
|
sizeof(PCI_PM_CAPABILITY)))
|
||||||
|
{
|
||||||
|
/* No power management, so act as if it had the hackflag set */
|
||||||
|
DPRINT1("No PM caps, disabling PM\n");
|
||||||
|
PdoExtension->HackFlags |= PCI_HACK_NO_PM_CAPS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Otherwise, pick the highest wake level that is supported */
|
||||||
|
WakeLevel = PowerDeviceUnspecified;
|
||||||
|
if (PowerCapabilities.PMC.Capabilities.Support.PMED0)
|
||||||
|
WakeLevel = PowerDeviceD0;
|
||||||
|
if (PowerCapabilities.PMC.Capabilities.Support.PMED1)
|
||||||
|
WakeLevel = PowerDeviceD1;
|
||||||
|
if (PowerCapabilities.PMC.Capabilities.Support.PMED2)
|
||||||
|
WakeLevel = PowerDeviceD2;
|
||||||
|
if (PowerCapabilities.PMC.Capabilities.Support.PMED3Hot)
|
||||||
|
WakeLevel = PowerDeviceD3;
|
||||||
|
if (PowerCapabilities.PMC.Capabilities.Support.PMED3Cold)
|
||||||
|
WakeLevel = PowerDeviceD3;
|
||||||
|
PdoExtension->PowerState.DeviceWakeLevel = WakeLevel;
|
||||||
|
|
||||||
|
/* Convert the PCI power state to the NT power state */
|
||||||
|
PdoExtension->PowerState.CurrentDeviceState =
|
||||||
PowerCapabilities.PMCSR.ControlStatus.PowerState + 1;
|
PowerCapabilities.PMCSR.ControlStatus.PowerState + 1;
|
||||||
|
|
||||||
/* Save all the power capabilities */
|
/* Save all the power capabilities */
|
||||||
PdoExtension->PowerCapabilities = PowerCapabilities.PMC.Capabilities;
|
PdoExtension->PowerCapabilities = PowerCapabilities.PMC.Capabilities;
|
||||||
DPRINT1("PM Caps Found! Wake Level: %d Power State: %d\n",
|
DPRINT1("PM Caps Found! Wake Level: %d Power State: %d\n",
|
||||||
WakeLevel, PdoExtension->PowerState.CurrentDeviceState);
|
WakeLevel, PdoExtension->PowerState.CurrentDeviceState);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,6 @@ PciFdoIrpQueryRemoveDevice(IN PIRP Irp,
|
||||||
IN PPCI_FDO_EXTENSION DeviceExtension)
|
IN PPCI_FDO_EXTENSION DeviceExtension)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
while (TRUE);
|
|
||||||
return STATUS_NOT_SUPPORTED;
|
return STATUS_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,6 @@ PciPdoSetPowerState(IN PIRP Irp,
|
||||||
IN PPCI_PDO_EXTENSION DeviceExtension)
|
IN PPCI_PDO_EXTENSION DeviceExtension)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
while (TRUE);
|
|
||||||
return STATUS_NOT_SUPPORTED;
|
return STATUS_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +209,6 @@ PciPdoIrpQueryRemoveDevice(IN PIRP Irp,
|
||||||
IN PPCI_PDO_EXTENSION DeviceExtension)
|
IN PPCI_PDO_EXTENSION DeviceExtension)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
while (TRUE);
|
|
||||||
return STATUS_NOT_SUPPORTED;
|
return STATUS_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,7 +427,6 @@ PciPdoIrpQueryDeviceState(IN PIRP Irp,
|
||||||
IN PPCI_PDO_EXTENSION DeviceExtension)
|
IN PPCI_PDO_EXTENSION DeviceExtension)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
while (TRUE);
|
|
||||||
return STATUS_NOT_SUPPORTED;
|
return STATUS_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue