1 /* 2 * PROJECT: PCI IDE bus driver extension 3 * LICENSE: See COPYING in the top level directory 4 * PURPOSE: Power support functions 5 * COPYRIGHT: Copyright 2023 Dmitry Borisov <di.sean@protonmail.com> 6 */ 7 8 #include "pciidex.h" 9 10 #define NDEBUG 11 #include <debug.h> 12 13 static 14 NTSTATUS 15 PciIdeXPdoDispatchPower( 16 _In_ PPDO_DEVICE_EXTENSION PdoExtension, 17 _In_ PIRP Irp) 18 { 19 NTSTATUS Status; 20 PIO_STACK_LOCATION IoStack; 21 22 UNREFERENCED_PARAMETER(PdoExtension); 23 24 IoStack = IoGetCurrentIrpStackLocation(Irp); 25 switch (IoStack->MinorFunction) 26 { 27 case IRP_MN_SET_POWER: 28 case IRP_MN_QUERY_POWER: 29 Status = STATUS_SUCCESS; 30 Irp->IoStatus.Status = Status; 31 break; 32 33 default: 34 Status = Irp->IoStatus.Status; 35 break; 36 } 37 38 PoStartNextPowerIrp(Irp); 39 IoCompleteRequest(Irp, IO_NO_INCREMENT); 40 return Status; 41 } 42 43 static 44 NTSTATUS 45 PciIdeXFdoDispatchPower( 46 _In_ PFDO_DEVICE_EXTENSION FdoExtension, 47 _In_ PIRP Irp) 48 { 49 PoStartNextPowerIrp(Irp); 50 IoSkipCurrentIrpStackLocation(Irp); 51 return PoCallDriver(FdoExtension->Ldo, Irp); 52 } 53 54 NTSTATUS 55 NTAPI 56 PciIdeXDispatchPower( 57 _In_ PDEVICE_OBJECT DeviceObject, 58 _Inout_ PIRP Irp) 59 { 60 PVOID DeviceExtension = DeviceObject->DeviceExtension; 61 62 if (IS_FDO(DeviceExtension)) 63 return PciIdeXFdoDispatchPower(DeviceExtension, Irp); 64 else 65 return PciIdeXPdoDispatchPower(DeviceExtension, Irp); 66 } 67