// ntddstor.h
// CTL_CODE(0x002d, 0x725, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_STORAGE_DEVICE_POWER_CAP 0x002D1C94
View the official Windows Driver Kit DDI reference// winioctl.h
// CTL_CODE(0x002d, 0x725, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_STORAGE_DEVICE_POWER_CAP 0x002D1C94
View the official Win32 API referenceNo description available.
A driver can use IOCTL_STORAGE_DEVICE_POWER_CAP to specify a maximum operational power consumption level for a storage device. The OS will do its best to transition the device to a power state that will not exceed the given maximum; however, this depends on what the device supports. The actual maximum may be less than or greater than the desired maximum.
Irp->AssociatedIrp.SystemBuffer contains a STORAGE_DEVICE_POWER_CAP structure that specifies the maximum power.
sizeof(STORAGE_DEVICE_POWER_CAP).If the operation is successful, the output buffer at Irp->AssociatedIrp.SystemBuffer will contain a STORAGE_DEVICE_POWER_CAP structure.
Parameters.DeviceIoControl.OutputBufferLength indicates the size, in bytes, of the output parameter buffer at Irp->AssociatedIrp.SystemBuffer. OutputBufferLength must be greater than or equal to sizeof(STORAGE_DEVICE_POWER_CAP).
The Information field is set to the number of bytes returned. The Status field is set to STATUS_SUCCESS, or possibly to STATUS_INVALID_DEVICE_REQUEST, STATUS_INVALID_PARAMETER, or STATUS_NOT_SUPPORTED.
For a reboot, the IOCTL_STORAGE_DEVICE_POWER_CAP effect is not persistent. For an NVMe device reset/power cycle, the IOCTL’s effect is persistent.
STORAGE_DEVICE_POWER_CAP_UNITS
Windows applications can use this control code to specify a maximum operational power consumption level for a storage device. The OS will do it's best to transition the device to a power state that will not exceed the given maximum. However, this depends on what the device supports. The actual maximum may be less than or greater than the desired maximum.
To perform this operation, call the DeviceIoControl function with the following parameters.
BOOL DeviceIoControl(
(HANDLE) hDevice, // handle to device
IOCTL_STORAGE_DEVICE_POWER_CAP, // dwIoControlCode
(LPDWORD) lpInBuffer, // input buffer
(DWORD) nInBufferSize, // size of input buffer
(LPDWORD) lpOutBuffer, // output buffer
(DWORD) nOutBufferSize, // size of output buffer
(LPDWORD) lpBytesReturned, // number of bytes returned
(LPOVERLAPPED) lpOverlapped // OVERLAPPED structure
);
Irp->IoStatus.Status is set to STATUS_SUCCESS if the request is successful.
Otherwise, Status to the appropriate error condition as a NTSTATUS code.
For more information, see NTSTATUS Values.
This IOCTL is sent to the device driver with a maximum power value that the driver is expected to honor. This IOCTL then returns with a value that represents what the device driver is actually capable of achieving. This value could be equal to, less than, or greater than the desired value that was sent originally.
For example, consider a storage device driver that implements three operational power states that have a maximum power consumption level of 10 watts, 8 watts, and 6 watts. If the caller of this IOCTL specifies that the device should not consume more than 9 watts, it must choose its 8 watt state because that is the highest state it has that is still less than 9 watts. If the caller of this IOCTL specifies that the device should not consume more than 5 watts, the device driver will pick the 6 watt state because 6 watts is the minimum value the device can function at.