Author: tfaber Date: Sun Sep 6 08:54:20 2015 New Revision: 69050
URL: http://svn.reactos.org/svn/reactos?rev=69050&view=rev Log: [PCI] - Better stub IRP_MJ_POWER handlers. Failing IRP_MN_SET_POWER is illegal! CORE-10117
Modified: trunk/reactos/drivers/bus/pci/fdo.c trunk/reactos/drivers/bus/pci/pdo.c
Modified: trunk/reactos/drivers/bus/pci/fdo.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/pci/fdo.c?rev=6... ============================================================================== --- trunk/reactos/drivers/bus/pci/fdo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/bus/pci/fdo.c [iso-8859-1] Sun Sep 6 08:54:20 2015 @@ -453,33 +453,6 @@ Irp->IoStatus.Information = 0;
return STATUS_SUCCESS; -} - - -static NTSTATUS -FdoSetPower( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp, - PIO_STACK_LOCATION IrpSp) -{ - NTSTATUS Status; - - UNREFERENCED_PARAMETER(DeviceObject); - UNREFERENCED_PARAMETER(Irp); - - DPRINT("Called\n"); - - if (IrpSp->Parameters.Power.Type == DevicePowerState) - { - /* FIXME: Set device power state for the device */ - Status = STATUS_UNSUCCESSFUL; - } - else - { - Status = STATUS_UNSUCCESSFUL; - } - - return Status; }
@@ -616,30 +589,16 @@ * Status */ { - PIO_STACK_LOCATION IrpSp; + PFDO_DEVICE_EXTENSION DeviceExtension; NTSTATUS Status;
DPRINT("Called\n");
- IrpSp = IoGetCurrentIrpStackLocation(Irp); - - switch (IrpSp->MinorFunction) - { - case IRP_MN_SET_POWER: - Status = FdoSetPower(DeviceObject, Irp, IrpSp); - break; - - default: - DPRINT("Unknown IOCTL 0x%X\n", IrpSp->MinorFunction); - Status = STATUS_NOT_IMPLEMENTED; - break; - } - - if (Status != STATUS_PENDING) - { - Irp->IoStatus.Status = Status; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - } + DeviceExtension = DeviceObject->DeviceExtension; + + PoStartNextPowerIrp(Irp); + IoSkipCurrentIrpStackLocation(Irp); + Status = PoCallDriver(DeviceExtension->Ldo, Irp);
DPRINT("Leaving. Status 0x%X\n", Status);
Modified: trunk/reactos/drivers/bus/pci/pdo.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/pci/pdo.c?rev=6... ============================================================================== --- trunk/reactos/drivers/bus/pci/pdo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/bus/pci/pdo.c [iso-8859-1] Sun Sep 6 08:54:20 2015 @@ -202,7 +202,7 @@ { ULONG Size; ULONG AllOnes; - + /* Read the original value */ Size = HalGetBusDataByOffset(PCIConfiguration, DeviceExtension->PciDevice->BusNumber, @@ -215,7 +215,7 @@ DPRINT1("Wrong size %lu\n", Size); return FALSE; } - + /* Write all ones to determine which bits are held to zero */ AllOnes = MAXULONG; Size = HalSetBusDataByOffset(PCIConfiguration, @@ -229,7 +229,7 @@ DPRINT1("Wrong size %lu\n", Size); return FALSE; } - + /* Get the range length */ Size = HalGetBusDataByOffset(PCIConfiguration, DeviceExtension->PciDevice->BusNumber, @@ -255,7 +255,7 @@ DPRINT1("Wrong size %lu\n", Size); return FALSE; } - + return TRUE; }
@@ -283,13 +283,13 @@ ULONGLONG Bar; } NewValue; ULONG Offset; - + /* Compute the offset of this BAR in PCI config space */ Offset = 0x10 + Bar * 4; - + /* Assume this is a 32-bit BAR until we find wrong */ *NextBar = Bar + 1; - + /* Initialize BAR values to zero */ OriginalValue.Bar = 0ULL; NewValue.Bar = 0ULL; @@ -301,7 +301,7 @@ { return FALSE; } - + /* Check if this is a memory BAR */ if (!(OriginalValue.Bars.Bar0 & PCI_ADDRESS_IO_SPACE)) { @@ -321,13 +321,13 @@ *MaximumAddress = 0xFFFFFFFFFFFFFFFFULL; } } - + /* Check if this is a 64-bit BAR */ if ((OriginalValue.Bars.Bar0 & PCI_ADDRESS_MEMORY_TYPE_MASK) == PCI_TYPE_64BIT) { /* We've now consumed the next BAR too */ *NextBar = Bar + 2; - + /* Read the next BAR */ if (!PdoReadPciBar(DeviceExtension, Offset + 4, &OriginalValue.Bars.Bar1, @@ -354,7 +354,7 @@ *Flags = 0; return TRUE; } - + *Base = OriginalValue.Bar & PCI_ADDRESS_MEMORY_ADDRESS_MASK_64;
*Length = ~((NewValue.Bar & PCI_ADDRESS_IO_SPACE) @@ -1490,36 +1490,6 @@ return STATUS_SUCCESS; }
-static NTSTATUS -PdoSetPower( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp, - PIO_STACK_LOCATION IrpSp) -{ - NTSTATUS Status; - - UNREFERENCED_PARAMETER(DeviceObject); - UNREFERENCED_PARAMETER(Irp); - DPRINT("Called\n"); - - if (IrpSp->Parameters.Power.Type == DevicePowerState) - { - Status = STATUS_SUCCESS; - - switch (IrpSp->Parameters.Power.State.SystemState) - { - default: - Status = STATUS_UNSUCCESSFUL; - } - } - else - { - Status = STATUS_UNSUCCESSFUL; - } - - return Status; -} -
/*** PUBLIC ******************************************************************/
@@ -1683,7 +1653,7 @@ */ { PIO_STACK_LOCATION IrpSp; - NTSTATUS Status; + NTSTATUS Status = Irp->IoStatus.Status;
DPRINT("Called\n");
@@ -1691,21 +1661,15 @@
switch (IrpSp->MinorFunction) { + case IRP_MN_QUERY_POWER: case IRP_MN_SET_POWER: - Status = PdoSetPower(DeviceObject, Irp, IrpSp); - break; - - default: - DPRINT("Unknown IOCTL 0x%X\n", IrpSp->MinorFunction); - Status = STATUS_NOT_IMPLEMENTED; - break; - } - - if (Status != STATUS_PENDING) - { - Irp->IoStatus.Status = Status; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - } + Status = STATUS_SUCCESS; + break; + } + + PoStartNextPowerIrp(Irp); + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_NO_INCREMENT);
DPRINT("Leaving. Status 0x%X\n", Status);