37#if defined(EVENT_TRACING)
38#include "FxPkgPnp.tmh"
45 0xdc7a8e51, 0x49b3, 0x4a3a, { 0x9e, 0x81, 0x62, 0x52, 0x05, 0xe7, 0xd7, 0x29 }
179#if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
336#if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
386 "Could not initialize QueryInterfaceLock for "
387 "WDFDEVICE %p, %!STATUS!",
396 "Could not initialize DeviceInterfaceLock for "
397 "WDFDEVICE %p, %!STATUS!",
407#if (FX_CORE_MODE==FX_CORE_USER_MODE)
413 "Could not initialize cleanup event for "
414 "WDFDEVICE %p, %!STATUS!",
423 "Could not initialize remove event for "
424 "WDFDEVICE %p, %!STATUS!",
443#if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
549#if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
568 "WDFDEVICE 0x%p !devobj 0x%p, IRP_MJ_PNP, %!pnpmn! IRP 0x%p",
577 "WDFDEVICE 0x%p !devobj 0x%p, IRP_MJ_PNP, %!pnpmn! "
578 "type %!DEVICE_RELATION_TYPE! IRP 0x%p",
588 "WDFDEVICE 0x%p !devobj 0x%p, IRP_MJ_PNP, %!pnpmn! IRP 0x%p",
615 "WDFDEVICE 0x%p !devobj 0x%p IRP_MJ_POWER, %!pwrmn! "
616 "IRP 0x%p for %!SYSTEM_POWER_STATE! (S%d)",
626 "WDFDEVICE 0x%p !devobj 0x%p IRP_MJ_POWER, %!pwrmn! "
627 "IRP 0x%p for %!DEVICE_POWER_STATE!",
638 "WDFDEVICE 0x%p !devobj 0x%p IRP_MJ_POWER, %!pwrmn! IRP 0x%p",
735 PnpDeviceState &= ~PNP_DEVICE_DONT_DISPLAY_IN_UI;
753 return PnpDeviceState;
832 "WDFDEVICE %p, WDFCHILDLIST %p returned %!STATUS! from "
833 "processing bus relations",
887 "WDFDEVICE %p, returning %!STATUS! from processing bus relations",
896 "WDFDEVICE %p returning %d devices in relations %p",
905 if (
i + 3 < pRelations->
Count) {
908 "PDO %p PDO %p PDO %p PDO %p",
915 else if (
i + 2 < pRelations->
Count) {
918 "PDO %p PDO %p PDO %p",
924 else if (
i + 1 < pRelations->
Count) {
965 if (pBusInformation !=
NULL) {
983 "WDFDEVICE %p could not allocate PNP_BUS_INFORMATION string, "
1036 type =
Irp->GetParameterQDRType();
1068 (
List->m_NeedReportMissing == 0 || pPriorRelations !=
NULL)) {
1073 if (pPriorRelations !=
NULL) {
1094 if (pNewRelations ==
NULL) {
1102 if (pPriorRelations !=
NULL) {
1105 for (
i = 0;
i < pPriorRelations->
Count;
i++) {
1110 if (
List->IncrementRetries() < 3) {
1118 "WDFDEVICE %p could not allocate device relations for type %d string, "
1130 if (pPriorRelations !=
NULL && pPriorRelations->
Count > 0) {
1143 pNewRelations->
Count++) {
1146 pdo =
entry->GetDevice();
1162 List->ZeroRetries();
1167 if (pPriorRelations !=
NULL) {
1215 "PnP State Machine init failed, %!STATUS!",
1223 "Power State Machine init failed, %!STATUS!",
1231 "Power Policy State Machine init failed, %!STATUS!",
1299 "WDFDEVICE %p, !devobj %p processing delayed deletion from pnp state "
1345 "Invalid special file type %x",
FileType);
1383 prevStatus =
Irp->GetStatus();
1400 if (pFwdIrp !=
NULL) {
1425 "WDFDEVICE %p could not allocate IRP to send QI to parent !devobj "
1467 if (
Irp->GetParameterQueryInterfaceVersion() == 1 &&
1468 Irp->GetParameterQueryInterfaceSize() >=
1520 const GUID* pInterfaceType;
1525 PVOID pExposedInterfaceSpecificData;
1534 pExposedInterface =
NULL;
1535 pExposedInterfaceSpecificData =
NULL;
1536 sendToParent =
FALSE;
1538 pInterfaceType =
Irp->GetParameterQueryInterfaceType();
1547 else if (
FxIsEqualGuid(pInterfaceType, &GUID_REENUMERATE_SELF_INTERFACE_STANDARD)) {
1549 return ((
FxPkgPdo*)
this)->HandleQueryInterfaceForReenumerate(
1567 pExposedInterface =
Irp->GetParameterQueryInterfaceInterface();
1568 pExposedInterfaceSpecificData =
1569 Irp->GetParameterQueryInterfaceInterfaceSpecificData();
1624 (
LPGUID)
Irp->GetParameterQueryInterfaceType(),
1626 pExposedInterfaceSpecificData);
1661 Irp->CopyCurrentIrpStackLocationToNext();
1666 if (pFound !=
NULL) {
2070#if (FX_CORE_MODE==FX_CORE_USER_MODE)
2099 "WDFDEVICE %p, !devobj %p waiting for pnp state machine to finish",
2107 event->EnterCRAndWaitAndLeave();
2120 "WDFDEVICE %p, !devobj %p waiting for pwr pol state machine to finish",
2123 event->EnterCRAndWaitAndLeave();
2134 "WDFDEVICE %p, !devobj %p waiting for pwr state machine to finish",
2137 event->EnterCRAndWaitAndLeave();
2147 m_DevicePowerRequirementMachine) {
2150 m_DevicePowerRequirementMachine->SetFinished(
event)) {
2154 "WDFDEVICE %p, !devobj %p waiting for device power "
2155 "requirement state machine to finish",
2159 event->EnterCRAndWaitAndLeave();
2299#if (FX_CORE_MODE==FX_CORE_USER_MODE)
2300 MxEvent *
event =
This->m_RemoveEventUm.GetSelfPointer();
2310 This->m_Device->GetRemoveLock(),
2341 "WDFDEVICE %p, !devobj %p waiting for remove event to finish processing",
2342 This->m_Device->GetHandle(),
This->m_Device->GetDeviceObject());
2350 This->m_DeviceRemoveProcessed =
NULL;
2426 return This->DispatchWaitWake(
Irp);
2459 "Received wait wake power irp %p on device %p, but the irp was "
2460 "not requested by the device (the power policy owner)",
2499 "Failing wait wake irp %p with %!STATUS! because wait wake irp "
2500 "%p already pended",
2525 if (
Irp->IsCanceled()) {
2528 "wait wake irp %p already canceled",
Irp->GetIrp());
2534 pRoutine =
Irp->SetCancelRoutine(
NULL);
2536 if (pRoutine !=
NULL) {
2557 Irp->MarkIrpPending();
2598 if (oldIrp ==
NULL) {
2610 Irp->CopyCurrentIrpStackLocationToNext();
2646 "already have a ww irp %p, failing new ww irp %p with %!STATUS!",
2724 Callbacks->EvtDeviceArmWakeFromSxWithReason;
2732 Callbacks->EvtDeviceWakeFromS0Triggered;
2734 Callbacks->EvtDeviceWakeFromSxTriggered;
2804 const LONGLONG negliblySmallIdleTimeout = -1;
2808 overridable =
FALSE;
2829 "If registry value WdfDefaultIdleInWorkingState was present, "
2830 "it was not read because DDI WdfDeviceAssignS0IdleSettings "
2831 "was not called at PASSIVE_LEVEL");
2878 "DeviceWake power state reported in device capabilities "
2879 "%!DEVICE_POWER_STATE! indicates that device can not signal"
2880 " a wake event, %!STATUS!",
2891 if (dxState > dxDeepest) {
2896 "DxState specified by driver %!DEVICE_POWER_STATE! cannot "
2897 "be lighter than lightest available device wake state"
2898 " %!DEVICE_POWER_STATE!, %!STATUS!", dxState,
2912 "DxState specified by driver %!DEVICE_POWER_STATE! cannot "
2913 "be lighter than PowerDeviceD2 for USB selective suspend "
2926 "Failed to initialize USB selective suspend %!STATUS!",
2955 idleTimeout =
Settings->IdleTimeout;
2992 overridable =
FALSE;
3034 m_TimeoutMgmt.UseSystemManagedIdleTimeout(
3047 BOOLEAN currentlyUsingSystemManagedIdleTimeout;
3048 BOOLEAN callerWantsSystemManagedIdleTimeout;
3050 currentlyUsingSystemManagedIdleTimeout =
3052 UsingSystemManagedIdleTimeout();
3053 callerWantsSystemManagedIdleTimeout =
3065 if ((callerWantsSystemManagedIdleTimeout !=
3066 currentlyUsingSystemManagedIdleTimeout)
3074 "A previous call to assign S0-idle policy specified that "
3075 "the idle timeout %s be determined by the power manager. "
3076 "This decision cannot be changed. %!STATUS!",
3077 currentlyUsingSystemManagedIdleTimeout ?
3098 powerUpOnSystemWake =
3100 Settings->PowerUpIdleDeviceOnSystemWake :
3103 switch(powerUpOnSystemWake) {
3108 "Driver turned off S0Idle optimization. Device will be "
3109 "powered up on resume from Sx even when it is idle");
3115 "Driver turned on S0Idle optimization. Device will remain "
3116 "powered off if idle when resuming from Sx");
3132 m_IdleSettings.UsbSSCapabilityKnown =
TRUE;
3137 m_IdleSettings.UsbSSCapabilityKnown =
TRUE;
3166 m_IdleSettings.m_TimeoutMgmt.UsingSystemManagedIdleTimeout()) {
3178 m_PowerIdleMachine.m_PowerTimeout.QuadPart =
3179 negliblySmallIdleTimeout;
3220 enableD3Cold =
TRUE;
3225 "Invalid tri-state value for ExcludeD3Cold %d",
3229 enableD3Cold =
FALSE;
3282 overridable =
FALSE;
3304 "If registry value WdfDefaultWakeFromSleepState was present, "
3305 "it was not read because DDI WdfDeviceAssignSxWakeSettings "
3306 "was not called at PASSIVE_LEVEL");
3345 "DeviceWake power state reported in device capabilities "
3346 "%!DEVICE_POWER_STATE! indicates that device can not signal a "
3347 "wake event, %!STATUS!",
3358 if (dxState > dxDeepest) {
3362 "DxState specified by driver %!DEVICE_POWER_STATE! cannot be"
3363 " lighter than lightest available device wake state "
3364 "%!DEVICE_POWER_STATE!, %!STATUS!", dxState,
3405 overridable =
FALSE;
3420 ArmForWakeIfChildrenAreArmedForWake;
3428 IndicateChildWakeOnParentWake;
3699 "failing system query power because the device cannot wake the "
3764 if (FxWaitLockInternal::IsLockAcquired(
status)) {
3800#if (FX_CORE_MODE == FX_CORE_USER_MODE)
3807 "WdfDeviceFailedAttemptRestart is only available for UMDF 2.15 "
3808 "and later drivers. Reverting to WdfDeviceFailedNoRestart.");
3831#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
3862 return This->PnpDeviceUsageNotification(
Irp);
3885 "Entering DeviceUsageNotification handler");
3889 type =
Irp->GetParameterUsageNotificationType();
3890 inPath =
Irp->GetParameterUsageNotificationInPath();
3895 "type %x, in path %x, can support paging %x, dump file %x, "
3896 "hiber file %x, boot file %x",
3925 if (supported ==
FALSE) {
3930 "Usage type %x not supported, %!STATUS!",
type,
status);
3949 "WDFDEVICE %p !devobj %p could not allocate workitem "
3950 "to send usage notification type %d, inpath %d, %!STATUS!",
3983 if (pNewIrp !=
NULL) {
3984 parentIrp.
SetIrp(pNewIrp);
4002 "WDFDEVICE %p could not allocate PIRP for parent !devobj %p to "
4003 "send usage notification type %d, inpath %d, %!STATUS!",
4012 "Exit %!STATUS!",
status);
4096 if (pNewIrp ==
NULL) {
4101 "WDFDEVICE %p could not allocate IRP to send usage notifications"
4102 " to related stacks, type %d, inpath %d, status %!STATUS!",
4111 relatedIrp.SetIrp(pNewIrp);
4138 pDependent2 != pDependent) {
4167 BOOLEAN referenceSucceeded, sendDown;
4169 referenceSucceeded =
FALSE;
4181 referenceSucceeded =
TRUE;
4261 Irp->CopyCurrentIrpStackLocationToNext();
4262 Irp->SetParameterUsageNotificationInPath(
FALSE);
4385 Irp->CopyCurrentIrpStackLocationToNext();
4386 Irp->SetParameterUsageNotificationInPath(
FALSE);
4476 if (referenceSucceeded) {
4491 "Exit %!STATUS!",
status);
4522 ULONG oldFlags, newFlags;
4531 "Before: type %d, in path %d, special count %d, flags 0x%x, "
4532 "device %p (WDFDEVICE %p), is pageable capable %d",
4678 "After: special count %d, flags 0x%x, device %p (WDFDEVICE %p)",
4707 "Could not allocate usage device list for WDFDEVICE %p, "
4728 if (pRelated ==
NULL) {
4775 "Could not allocate removal device list for WDFDEVICE %p, "
4794 if (pRelated ==
NULL) {
4898 "A new state changing pnp irp %!pnpmn! IRP %p arrived while another "
4899 "pnp irp %!pnpmn! IRP %p is still pending WDFDEVICE %p\n",
4900 Irp->GetMinorFunction(),
Irp->GetIrp(),
4912 if (MarkIrpPending) {
4913 Irp->MarkIrpPending();
4944 "Could not initialize enum info for "
4945 "WDFDEVICE %p, %!STATUS!",
4954 "Could not allocate enum info for WDFDEVICE %p, "
4975 "Adding FxChildList %p, WDFCHILDLIST %p",
List,
4979 &
List->m_TransactionLink);
4988 "Removing FxChildList %p, WDFCHILDLIST %p",
List,