xref: /reactos/drivers/storage/port/scsiport/power.c (revision b09b5584)
1 /*
2  * PROJECT:     ReactOS Storage Stack / SCSIPORT storage port library
3  * LICENSE:     GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE:     PnP power handlers
5  * COPYRIGHT:   Copyright 2016 Thomas Faber <thomas.faber@reactos.org>
6  */
7 
8 #include "scsiport.h"
9 
10 
11 NTSTATUS
12 NTAPI
13 ScsiPortDispatchPower(
14     _In_ PDEVICE_OBJECT DeviceObject,
15     _Inout_ PIRP Irp)
16 {
17     PSCSI_PORT_COMMON_EXTENSION comExt = DeviceObject->DeviceExtension;
18 
19     if (comExt->IsFDO)
20     {
21         PoStartNextPowerIrp(Irp);
22         IoSkipCurrentIrpStackLocation(Irp);
23         return PoCallDriver(comExt->LowerDevice, Irp);
24     }
25     else
26     {
27         PIO_STACK_LOCATION ioStack = IoGetCurrentIrpStackLocation(Irp);
28         switch (ioStack->MinorFunction)
29         {
30             case IRP_MN_SET_POWER:
31             case IRP_MN_QUERY_POWER:
32                 Irp->IoStatus.Status = STATUS_SUCCESS;
33                 break;
34         }
35 
36         NTSTATUS status = Irp->IoStatus.Status;
37         PoStartNextPowerIrp(Irp);
38         IoCompleteRequest(Irp, IO_NO_INCREMENT);
39         return status;
40     }
41 }
42