38DeviceGetZPODDEnabledFromRegistry();
42DeviceQueryD3ColdInterface(
49DeviceSendEnableIdlePowerIoctl(
58#pragma alloc_text(PAGE, DeviceInitializeZPODD)
59#pragma alloc_text(PAGE, DeviceGetZPODDEnabledFromRegistry)
60#pragma alloc_text(PAGE, DeviceQueryD3ColdInterface)
61#pragma alloc_text(PAGE, DeviceSendEnableIdlePowerIoctl)
62#pragma alloc_text(PAGE, DeviceReleaseZPODDResources)
63#pragma alloc_text(PAGE, DeviceZPODDIsInHomePosition)
64#pragma alloc_text(PAGE, DeviceMarkActive)
69#pragma warning(disable:4152)
70#pragma warning(disable:26000)
96 ULONG ZPODDEnabledInRegistry = 0;
103 if (DeviceExtension->ZeroPowerODDInfo !=
NULL)
112 ZPODDEnabledInRegistry = DeviceGetZPODDEnabledFromRegistry();
114 if (ZPODDEnabledInRegistry == 0)
123 "DeviceInitializeZPODD: ZPODD not enabled due to registry settings.\n"
133 if (zpoddInfo ==
NULL)
158 if ((DeviceExtension->PowerDescriptor ==
NULL) ||
159 (DeviceExtension->PowerDescriptor->DeviceAttentionSupported ==
FALSE) ||
160 (DeviceExtension->PowerDescriptor->AsynchronousNotificationSupported ==
FALSE))
165 "DeviceInitializeZPODD: ZPODD not enabled due to SATA features not present.\n"
176 DeviceFindFeaturePage(DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBuffer,
177 DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBufferSize,
180 if ((removableMediumHeader ==
NULL) ||
182 (removableMediumHeader->
DBML !=
FALSE)) &&
184 (DeviceExtension->MediaChangeDetectionInfo->Gesn.Supported !=
FALSE))))
189 "DeviceInitializeZPODD: ZPODD not enabled due to ODD features not present.\n"
196 zpoddInfo->
Load = removableMediumHeader->
Load;
207 "DeviceInitializeZPODD: Query D3Cold support interface failed.\n"
224 &deepestWakeableDstate);
236 (DeviceExtension->PowerDescriptor->D3ColdSupported ==
FALSE))
241 "DeviceInitializeZPODD: ZPODD not enabled due to ACPI support not present.\n"
262 "DeviceInitializeZPODD: ZPODD not enabled due to runtime power framework.\n"
269 "DeviceInitializeZPODD: ZPODD is enabled.\n"
272 DeviceExtension->ZeroPowerODDInfo = zpoddInfo;
279 inHomePosition = DeviceZPODDIsInHomePosition(DeviceExtension);
281 if (inHomePosition ==
FALSE)
284 "DeviceInitializeZPODD: not ready to power off, device marked as active\n"));
286 DeviceMarkActive(DeviceExtension,
TRUE,
FALSE);
297 tempStatus = DeviceGetConfigurationWithAlloc(DeviceExtension->Device,
324 DeviceMarkActive(DeviceExtension,
TRUE,
FALSE);
339DeviceGetZPODDEnabledFromRegistry()
359 WDFKEY registryKey =
NULL;
360 ULONG ZPODDEnabled = 0;
377 status = WdfRegistryQueryULong(registryKey,
381 WdfRegistryClose(registryKey);
398DeviceQueryD3ColdInterface(
454 irp->IoStatus.Information = 0;
491DeviceSendEnableIdlePowerIoctl(
532 DeviceExtension->LowerPdo,
563 "DeviceSendEnableIdlePowerIoctl: Port driver returned status (%x) for FDO (%p)\n"
564 "\tD3ColdSupported: %u\n"
565 "\tD3IdleTimeout: %u (ms)",
567 DeviceExtension->DeviceObject,
576DeviceReleaseZPODDResources(
598 if (zpoddInfo !=
NULL)
645 DeviceExtension->LowerPdo,
679DeviceZPODDIsInHomePosition(
706 if (zpoddInfo !=
NULL)
727 status = DeviceSendSrbSynchronously(DeviceExtension->Device,
760 inHomePosition =
TRUE;
764 return inHomePosition;
803 (
VOID)DeviceGetConfigurationWithAlloc(DeviceExtension->Device,
813 status = DeviceSendEnableIdlePowerIoctl(DeviceExtension,
823 DeviceExtension->LowerPdo);
826 DeviceExtension->IsActive =
IsActive;
#define FREE_POOL(_PoolPtr)
_In_ BOOLEAN _In_ BOOLEAN SetIdleTimeout
#define CDROM_TAG_ZERO_POWER_ODD
#define CDROM_TEST_UNIT_READY_TIMEOUT
VOID DeviceSendIoctlAsynchronously(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ ULONG IoControlCode, _In_ PDEVICE_OBJECT TargetDeviceObject)
#define DELAY_TIME_TO_ENTER_ZERO_POWER_IN_MS
#define DELAY_TIME_TO_ENTER_AOAC_IDLE_POWER_IN_MS
#define SCSIOP_TEST_UNIT_READY
#define SCSI_ADSENSE_NO_MEDIA_IN_DEVICE
#define SCSI_SENSE_NOT_READY
#define STATUS_NOT_SUPPORTED
#define NT_SUCCESS(StatCode)
static const WCHAR Cleanup[]
#define _IRQL_requires_max_(irql)
#define ExAllocatePoolWithTag(hernya, size, tag)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
#define UNREFERENCED_PARAMETER(P)
#define SCSI_GET_CONFIGURATION_REQUEST_TYPE_ALL
struct _FEATURE_DATA_REMOVABLE_MEDIUM * PFEATURE_DATA_REMOVABLE_MEDIUM
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
#define IOCTL_STORAGE_ENABLE_IDLE_POWER
struct _STORAGE_IDLE_POWER STORAGE_IDLE_POWER
#define IOCTL_STORAGE_POWER_IDLE
#define IOCTL_STORAGE_POWER_ACTIVE
struct _STORAGE_IDLE_POWERUP_REASON STORAGE_IDLE_POWERUP_REASON
#define IOCTL_STORAGE_GET_IDLE_POWERUP_REASON
#define STORAGE_IDLE_POWERUP_REASON_VERSION_V1
PDEVICE_OBJECT NTAPI IoGetAttachedDeviceReference(PDEVICE_OBJECT DeviceObject)
PIRP NTAPI IoBuildSynchronousFsdRequest(IN ULONG MajorFunction, IN PDEVICE_OBJECT DeviceObject, IN PVOID Buffer, IN ULONG Length, IN PLARGE_INTEGER StartingOffset, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
PIRP NTAPI IoBuildDeviceIoControlRequest(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
struct _INTERFACE * PINTERFACE
#define LOADING_MECHANISM_CADDY
#define LOADING_MECHANISM_TRAY
#define TRACE_LEVEL_INFORMATION
PGET_IDLE_WAKE_INFO GetIdleWakeInfo
struct _IO_STACK_LOCATION::@4065::@4091 QueryInterface
union _IO_STACK_LOCATION::@1605 Parameters
ULONG GetConfigurationBufferSize
D3COLD_SUPPORT_INTERFACE D3ColdInterface
UCHAR AdditionalSenseCode
PGET_CONFIGURATION_HEADER GetConfigurationBuffer
UCHAR AdditionalSenseCodeQualifier
#define RtlZeroMemory(Destination, Length)
#define STATUS_INSUFFICIENT_RESOURCES
struct _CDB::_CDB6GENERIC CDB6GENERIC
#define DECLARE_CONST_UNICODE_STRING(_variablename, _string)
FORCEINLINE WDFDRIVER WdfGetDriver(VOID)
#define WDF_NO_OBJECT_ATTRIBUTES
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
enum _DEVICE_WAKE_DEPTH DEVICE_WAKE_DEPTH
#define IRP_MN_QUERY_INTERFACE
#define D3COLD_SUPPORT_INTERFACE_VERSION
struct _D3COLD_SUPPORT_INTERFACE D3COLD_SUPPORT_INTERFACE
@ DeviceWakeDepthNotWakeable
#define ObDereferenceObject
NTSTATUS DeviceZPODDGetPowerupReason(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _Out_ PSTORAGE_IDLE_POWERUP_REASON PowerupReason)