38 DeviceGetZPODDEnabledFromRegistry();
42 DeviceQueryD3ColdInterface(
49 DeviceSendEnableIdlePowerIoctl(
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) // nonstandard extension, function/data pointer conversion in expression 70 #pragma warning(disable:26000) // read overflow reported because of pointer type conversion 74 DeviceInitializeZPODD(
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);
339 DeviceGetZPODDEnabledFromRegistry()
359 WDFKEY registryKey =
NULL;
360 ULONG ZPODDEnabled = 0;
377 status = WdfRegistryQueryULong(registryKey,
381 WdfRegistryClose(registryKey);
398 DeviceQueryD3ColdInterface(
454 irp->IoStatus.Information = 0;
491 DeviceSendEnableIdlePowerIoctl(
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,
576 DeviceReleaseZPODDResources(
598 if (zpoddInfo !=
NULL)
645 DeviceExtension->LowerPdo,
679 DeviceZPODDIsInHomePosition(
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;
830 #pragma warning(pop) // un-sets any local warning changes UCHAR AdditionalSenseCode
return STATUS_NOT_SUPPORTED
#define LOADING_MECHANISM_CADDY
#define STATUS_INSUFFICIENT_RESOURCES
#define CDROM_TAG_ZERO_POWER_ODD
UCHAR AdditionalSenseCodeQualifier
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
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)
#define UNREFERENCED_PARAMETER(P)
_IRQL_requires_max_(PASSIVE_LEVEL)
struct _STORAGE_IDLE_POWER STORAGE_IDLE_POWER
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
#define SCSIOP_TEST_UNIT_READY
#define TRACE_LEVEL_INFORMATION
#define SCSI_SENSE_NOT_READY
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
ULONG GetConfigurationBufferSize
D3COLD_SUPPORT_INTERFACE D3ColdInterface
enum _DEVICE_WAKE_DEPTH DEVICE_WAKE_DEPTH
FORCEINLINE WDFDRIVER WdfGetDriver(VOID)
#define LOADING_MECHANISM_TRAY
#define FREE_POOL(_PoolPtr)
#define DELAY_TIME_TO_ENTER_AOAC_IDLE_POWER_IN_MS
#define SCSI_ADSENSE_NO_MEDIA_IN_DEVICE
struct _STORAGE_IDLE_POWERUP_REASON STORAGE_IDLE_POWERUP_REASON
struct _INTERFACE * PINTERFACE
PDEVICE_OBJECT NTAPI IoGetAttachedDeviceReference(PDEVICE_OBJECT DeviceObject)
#define IOCTL_STORAGE_ENABLE_IDLE_POWER
PGET_CONFIGURATION_HEADER GetConfigurationBuffer
#define NT_SUCCESS(StatCode)
#define DECLARE_CONST_UNICODE_STRING(_variablename, _string)
#define ObDereferenceObject
#define STORAGE_IDLE_POWERUP_REASON_VERSION_V1
#define DELAY_TIME_TO_ENTER_ZERO_POWER_IN_MS
#define IRP_MN_QUERY_INTERFACE
#define ExAllocatePoolWithTag(hernya, size, tag)
struct _FEATURE_DATA_REMOVABLE_MEDIUM * PFEATURE_DATA_REMOVABLE_MEDIUM
NTSTATUS DeviceZPODDGetPowerupReason(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _Out_ PSTORAGE_IDLE_POWERUP_REASON PowerupReason)
PGET_IDLE_WAKE_INFO GetIdleWakeInfo
#define SCSI_GET_CONFIGURATION_REQUEST_TYPE_ALL
static const WCHAR Cleanup[]
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
struct _D3COLD_SUPPORT_INTERFACE D3COLD_SUPPORT_INTERFACE
#define KeInitializeEvent(pEvt, foo, foo2)
struct _CDB::_CDB6GENERIC CDB6GENERIC
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
#define IOCTL_STORAGE_GET_IDLE_POWERUP_REASON
#define WDF_NO_OBJECT_ATTRIBUTES
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)
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define IOCTL_STORAGE_POWER_IDLE
#define RtlZeroMemory(Destination, Length)
#define D3COLD_SUPPORT_INTERFACE_VERSION
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
#define IOCTL_STORAGE_POWER_ACTIVE
static SERVICE_STATUS status
VOID DeviceSendIoctlAsynchronously(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ ULONG IoControlCode, _In_ PDEVICE_OBJECT TargetDeviceObject)
#define CDROM_TEST_UNIT_READY_TIMEOUT
_In_ BOOLEAN _In_ BOOLEAN SetIdleTimeout