Fixed generation of Device ID.

svn path=/trunk/; revision=6134
This commit is contained in:
Filip Navara 2003-09-25 15:21:11 +00:00
parent 1fc4bb294e
commit 85fd5b07a7

View file

@ -1,458 +1,459 @@
/* $Id: fdo.c,v 1.2 2002/05/05 14:57:45 chorns Exp $ /* $Id: fdo.c,v 1.3 2003/09/25 15:21:11 navaraf Exp $
* *
* PROJECT: ReactOS PCI bus driver * PROJECT: ReactOS PCI bus driver
* FILE: fdo.c * FILE: fdo.c
* PURPOSE: PCI device object dispatch routines * PURPOSE: PCI device object dispatch routines
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net) * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
* UPDATE HISTORY: * UPDATE HISTORY:
* 10-09-2001 CSH Created * 10-09-2001 CSH Created
*/ */
#include <pci.h> #include <pci.h>
#define NDEBUG //#define NDEBUG
#include <debug.h> #include <debug.h>
/*** PRIVATE *****************************************************************/ /*** PRIVATE *****************************************************************/
NTSTATUS NTSTATUS
FdoLocateChildDevice( FdoLocateChildDevice(
PPCI_DEVICE *Device, PPCI_DEVICE *Device,
PFDO_DEVICE_EXTENSION DeviceExtension, PFDO_DEVICE_EXTENSION DeviceExtension,
PPCI_COMMON_CONFIG PciConfig) PPCI_COMMON_CONFIG PciConfig)
{ {
PLIST_ENTRY CurrentEntry; PLIST_ENTRY CurrentEntry;
PPCI_DEVICE CurrentDevice; PPCI_DEVICE CurrentDevice;
CurrentEntry = DeviceExtension->DeviceListHead.Flink; CurrentEntry = DeviceExtension->DeviceListHead.Flink;
while (CurrentEntry != &DeviceExtension->DeviceListHead) { while (CurrentEntry != &DeviceExtension->DeviceListHead) {
CurrentDevice = CONTAINING_RECORD(CurrentEntry, PCI_DEVICE, ListEntry); CurrentDevice = CONTAINING_RECORD(CurrentEntry, PCI_DEVICE, ListEntry);
/* If both vendor ID and device ID match, it is the same device */ /* If both vendor ID and device ID match, it is the same device */
if ((PciConfig->VendorID == CurrentDevice->PciConfig.VendorID) && if ((PciConfig->VendorID == CurrentDevice->PciConfig.VendorID) &&
(PciConfig->DeviceID == CurrentDevice->PciConfig.DeviceID)) { (PciConfig->DeviceID == CurrentDevice->PciConfig.DeviceID)) {
*Device = CurrentDevice; *Device = CurrentDevice;
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
CurrentEntry = CurrentEntry->Flink; CurrentEntry = CurrentEntry->Flink;
} }
*Device = NULL; *Device = NULL;
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
NTSTATUS NTSTATUS
FdoEnumerateDevices( FdoEnumerateDevices(
PDEVICE_OBJECT DeviceObject) PDEVICE_OBJECT DeviceObject)
{ {
PFDO_DEVICE_EXTENSION DeviceExtension; PFDO_DEVICE_EXTENSION DeviceExtension;
PCI_COMMON_CONFIG PciConfig; PCI_COMMON_CONFIG PciConfig;
PLIST_ENTRY CurrentEntry; PLIST_ENTRY CurrentEntry;
PPCI_DEVICE Device; PPCI_DEVICE Device;
NTSTATUS Status; NTSTATUS Status;
ULONG Slot; ULONG Slot;
ULONG Size; ULONG Size;
DPRINT("Called\n"); DPRINT("Called\n");
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension; DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
/* Mark all devices to be removed. If we don't discover them again during /* Mark all devices to be removed. If we don't discover them again during
enumeration, assume that they have been surprise removed */ enumeration, assume that they have been surprise removed */
CurrentEntry = DeviceExtension->DeviceListHead.Flink; CurrentEntry = DeviceExtension->DeviceListHead.Flink;
while (CurrentEntry != &DeviceExtension->DeviceListHead) { while (CurrentEntry != &DeviceExtension->DeviceListHead) {
Device = CONTAINING_RECORD(CurrentEntry, PCI_DEVICE, ListEntry); Device = CONTAINING_RECORD(CurrentEntry, PCI_DEVICE, ListEntry);
Device->RemovePending = TRUE; Device->RemovePending = TRUE;
CurrentEntry = CurrentEntry->Flink; CurrentEntry = CurrentEntry->Flink;
} }
DeviceExtension->DeviceListCount = 0; DeviceExtension->DeviceListCount = 0;
/* Enumerate devices on the PCI bus */ /* Enumerate devices on the PCI bus */
for (Slot = 0; Slot < 256; Slot++) for (Slot = 0; Slot < 256; Slot++)
{ {
Size = PciGetBusData( Size = PciGetBusData(
DeviceExtension->BusNumber, DeviceExtension->BusNumber,
Slot, Slot,
&PciConfig, &PciConfig,
0, 0,
sizeof(PCI_COMMON_CONFIG)); sizeof(PCI_COMMON_CONFIG));
if (Size != 0) if (Size != 0)
{ {
DPRINT("Bus %1lu Device %2lu Func %1lu VenID 0x%04hx DevID 0x%04hx\n", DPRINT("Bus %1lu Device %2lu Func %1lu VenID 0x%04hx DevID 0x%04hx\n",
DeviceExtension->BusNumber, DeviceExtension->BusNumber,
Slot>>3, Slot>>3,
Slot & 0x07, Slot & 0x07,
PciConfig.VendorID, PciConfig.VendorID,
PciConfig.DeviceID); PciConfig.DeviceID);
Status = FdoLocateChildDevice(&Device, DeviceExtension, &PciConfig); Status = FdoLocateChildDevice(&Device, DeviceExtension, &PciConfig);
if (!NT_SUCCESS(Status)) { if (!NT_SUCCESS(Status)) {
Device = (PPCI_DEVICE)ExAllocatePool(PagedPool, sizeof(PCI_DEVICE)); Device = (PPCI_DEVICE)ExAllocatePool(PagedPool, sizeof(PCI_DEVICE));
if (!Device) if (!Device)
{ {
/* FIXME: Cleanup resources for already discovered devices */ /* FIXME: Cleanup resources for already discovered devices */
return STATUS_INSUFFICIENT_RESOURCES; return STATUS_INSUFFICIENT_RESOURCES;
} }
RtlZeroMemory(Device, sizeof(PCI_DEVICE)); RtlZeroMemory(Device, sizeof(PCI_DEVICE));
RtlMoveMemory(&Device->PciConfig, &PciConfig, sizeof(PCI_COMMON_CONFIG)); RtlMoveMemory(&Device->PciConfig, &PciConfig, sizeof(PCI_COMMON_CONFIG));
ExInterlockedInsertTailList( ExInterlockedInsertTailList(
&DeviceExtension->DeviceListHead, &DeviceExtension->DeviceListHead,
&Device->ListEntry, &Device->ListEntry,
&DeviceExtension->DeviceListLock); &DeviceExtension->DeviceListLock);
} }
/* Don't remove this device */ /* Don't remove this device */
Device->RemovePending = FALSE; Device->RemovePending = FALSE;
DeviceExtension->DeviceListCount++; DeviceExtension->DeviceListCount++;
} }
} }
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
NTSTATUS NTSTATUS
FdoQueryBusRelations( FdoQueryBusRelations(
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp, IN PIRP Irp,
PIO_STACK_LOCATION IrpSp) PIO_STACK_LOCATION IrpSp)
{ {
PPDO_DEVICE_EXTENSION PdoDeviceExtension; PPDO_DEVICE_EXTENSION PdoDeviceExtension;
PFDO_DEVICE_EXTENSION DeviceExtension; PFDO_DEVICE_EXTENSION DeviceExtension;
PDEVICE_RELATIONS Relations; PDEVICE_RELATIONS Relations;
PLIST_ENTRY CurrentEntry; PLIST_ENTRY CurrentEntry;
PPCI_DEVICE Device; PPCI_DEVICE Device;
NTSTATUS Status; NTSTATUS Status;
BOOLEAN ErrorOccurred; BOOLEAN ErrorOccurred;
NTSTATUS ErrorStatus; NTSTATUS ErrorStatus;
WCHAR Buffer[MAX_PATH]; WCHAR Buffer[MAX_PATH];
ULONG Size; ULONG Size;
ULONG i; ULONG i;
DPRINT("Called\n"); DPRINT("Called\n");
ErrorStatus = STATUS_INSUFFICIENT_RESOURCES; ErrorStatus = STATUS_INSUFFICIENT_RESOURCES;
Status = STATUS_SUCCESS; Status = STATUS_SUCCESS;
ErrorOccurred = FALSE; ErrorOccurred = FALSE;
FdoEnumerateDevices(DeviceObject); FdoEnumerateDevices(DeviceObject);
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension; DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
if (Irp->IoStatus.Information) { if (Irp->IoStatus.Information) {
/* FIXME: Another bus driver has already created a DEVICE_RELATIONS /* FIXME: Another bus driver has already created a DEVICE_RELATIONS
structure so we must merge this structure with our own */ structure so we must merge this structure with our own */
} }
Size = sizeof(DEVICE_RELATIONS) + sizeof(Relations->Objects) * Size = sizeof(DEVICE_RELATIONS) + sizeof(Relations->Objects) *
(DeviceExtension->DeviceListCount - 1); (DeviceExtension->DeviceListCount - 1);
Relations = (PDEVICE_RELATIONS)ExAllocatePool(PagedPool, Size); Relations = (PDEVICE_RELATIONS)ExAllocatePool(PagedPool, Size);
if (!Relations) if (!Relations)
return STATUS_INSUFFICIENT_RESOURCES; return STATUS_INSUFFICIENT_RESOURCES;
Relations->Count = DeviceExtension->DeviceListCount; Relations->Count = DeviceExtension->DeviceListCount;
i = 0; i = 0;
CurrentEntry = DeviceExtension->DeviceListHead.Flink; CurrentEntry = DeviceExtension->DeviceListHead.Flink;
while (CurrentEntry != &DeviceExtension->DeviceListHead) { while (CurrentEntry != &DeviceExtension->DeviceListHead) {
Device = CONTAINING_RECORD(CurrentEntry, PCI_DEVICE, ListEntry); Device = CONTAINING_RECORD(CurrentEntry, PCI_DEVICE, ListEntry);
PdoDeviceExtension = NULL; PdoDeviceExtension = NULL;
if (!Device->Pdo) { if (!Device->Pdo) {
/* Create a physical device object for the /* Create a physical device object for the
device as it does not already have one */ device as it does not already have one */
Status = IoCreateDevice( Status = IoCreateDevice(
DeviceObject->DriverObject, DeviceObject->DriverObject,
sizeof(PDO_DEVICE_EXTENSION), sizeof(PDO_DEVICE_EXTENSION),
NULL, NULL,
FILE_DEVICE_CONTROLLER, FILE_DEVICE_CONTROLLER,
0, 0,
FALSE, FALSE,
&Device->Pdo); &Device->Pdo);
if (!NT_SUCCESS(Status)) { if (!NT_SUCCESS(Status)) {
DPRINT("IoCreateDevice() failed with status 0x%X\n", Status); DPRINT("IoCreateDevice() failed with status 0x%X\n", Status);
ErrorStatus = Status; ErrorStatus = Status;
ErrorOccurred = TRUE; ErrorOccurred = TRUE;
break; break;
} }
Device->Pdo->Flags |= DO_BUS_ENUMERATED_DEVICE; Device->Pdo->Flags |= DO_BUS_ENUMERATED_DEVICE;
Device->Pdo->Flags &= ~DO_DEVICE_INITIALIZING; Device->Pdo->Flags &= ~DO_DEVICE_INITIALIZING;
//Device->Pdo->Flags |= DO_POWER_PAGABLE; //Device->Pdo->Flags |= DO_POWER_PAGABLE;
PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)Device->Pdo->DeviceExtension; PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)Device->Pdo->DeviceExtension;
RtlZeroMemory(PdoDeviceExtension, sizeof(PDO_DEVICE_EXTENSION)); RtlZeroMemory(PdoDeviceExtension, sizeof(PDO_DEVICE_EXTENSION));
PdoDeviceExtension->Common.IsFDO = FALSE; PdoDeviceExtension->Common.IsFDO = FALSE;
PdoDeviceExtension->Common.DeviceObject = Device->Pdo; PdoDeviceExtension->Common.DeviceObject = Device->Pdo;
PdoDeviceExtension->Common.DevicePowerState = PowerDeviceD0; PdoDeviceExtension->Common.DevicePowerState = PowerDeviceD0;
/* FIXME: Get device properties (Hardware IDs, etc.) */ /* FIXME: Get device properties (Hardware IDs, etc.) */
swprintf( swprintf(
Buffer, Buffer,
L"PCI\\VEN_%04X&DEV_%04X&SUBSYS_%08X&REV_%02X", L"PCI\\VEN_%04X&DEV_%04X&SUBSYS_%08X&REV_%02X",
Device->PciConfig.VendorID, Device->PciConfig.VendorID,
Device->PciConfig.DeviceID, Device->PciConfig.DeviceID,
Device->PciConfig.u.type0.SubSystemID, (Device->PciConfig.u.type0.SubSystemID << 16) +
Device->PciConfig.RevisionID); Device->PciConfig.u.type0.SubVendorID,
Device->PciConfig.RevisionID);
if (!PciCreateUnicodeString(
&PdoDeviceExtension->DeviceID, if (!PciCreateUnicodeString(
Buffer, &PdoDeviceExtension->DeviceID,
PagedPool)) { Buffer,
ErrorOccurred = TRUE; PagedPool)) {
break; ErrorOccurred = TRUE;
} break;
}
DPRINT("DeviceID: %S\n", PdoDeviceExtension->DeviceID.Buffer);
} DPRINT("DeviceID: %S\n", PdoDeviceExtension->DeviceID.Buffer);
}
if (!Device->RemovePending) {
/* Reference the physical device object. The PnP manager if (!Device->RemovePending) {
will dereference it again when it is no longer needed */ /* Reference the physical device object. The PnP manager
ObReferenceObject(Device->Pdo); will dereference it again when it is no longer needed */
ObReferenceObject(Device->Pdo);
Relations->Objects[i] = Device->Pdo;
Relations->Objects[i] = Device->Pdo;
i++;
} i++;
}
CurrentEntry = CurrentEntry->Flink;
} CurrentEntry = CurrentEntry->Flink;
}
if (ErrorOccurred) {
/* FIXME: Cleanup all new PDOs created in this call. Please give me SEH!!! ;-) */ if (ErrorOccurred) {
/* FIXME: Should IoAttachDeviceToDeviceStack() be undone? */ /* FIXME: Cleanup all new PDOs created in this call. Please give me SEH!!! ;-) */
if (PdoDeviceExtension) { /* FIXME: Should IoAttachDeviceToDeviceStack() be undone? */
RtlFreeUnicodeString(&PdoDeviceExtension->DeviceID); if (PdoDeviceExtension) {
ExFreePool(PdoDeviceExtension); RtlFreeUnicodeString(&PdoDeviceExtension->DeviceID);
} ExFreePool(PdoDeviceExtension);
}
ExFreePool(Relations);
return ErrorStatus; ExFreePool(Relations);
} return ErrorStatus;
}
Irp->IoStatus.Information = (ULONG_PTR)Relations;
Irp->IoStatus.Information = (ULONG_PTR)Relations;
return Status;
} return Status;
}
NTSTATUS
FdoStartDevice( NTSTATUS
IN PDEVICE_OBJECT DeviceObject, FdoStartDevice(
IN PIRP Irp) IN PDEVICE_OBJECT DeviceObject,
{ IN PIRP Irp)
PFDO_DEVICE_EXTENSION DeviceExtension; {
PFDO_DEVICE_EXTENSION DeviceExtension;
DPRINT("Called\n");
DPRINT("Called\n");
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
assert(DeviceExtension->State == dsStopped);
assert(DeviceExtension->State == dsStopped);
InitializeListHead(&DeviceExtension->DeviceListHead);
KeInitializeSpinLock(&DeviceExtension->DeviceListLock); InitializeListHead(&DeviceExtension->DeviceListHead);
DeviceExtension->DeviceListCount = 0; KeInitializeSpinLock(&DeviceExtension->DeviceListLock);
DeviceExtension->DeviceListCount = 0;
PciBusConfigType = PciGetBusConfigType();
PciBusConfigType = PciGetBusConfigType();
DPRINT("Bus configuration is %d\n", PciBusConfigType);
DPRINT("Bus configuration is %d\n", PciBusConfigType);
if (PciBusConfigType != pbtUnknown) {
/* At least one PCI bus is found */ if (PciBusConfigType != pbtUnknown) {
} /* At least one PCI bus is found */
}
/* FIXME: Find a way to get this information */
DeviceExtension->BusNumber = 0; /* FIXME: Find a way to get this information */
DeviceExtension->BusNumber = 0;
DeviceExtension->State = dsStarted;
DeviceExtension->State = dsStarted;
//Irp->IoStatus.Information = 0;
//Irp->IoStatus.Information = 0;
return STATUS_SUCCESS;
} return STATUS_SUCCESS;
}
NTSTATUS
FdoSetPower( NTSTATUS
IN PDEVICE_OBJECT DeviceObject, FdoSetPower(
IN PIRP Irp, IN PDEVICE_OBJECT DeviceObject,
PIO_STACK_LOCATION IrpSp) IN PIRP Irp,
{ PIO_STACK_LOCATION IrpSp)
PFDO_DEVICE_EXTENSION DeviceExtension; {
NTSTATUS Status; PFDO_DEVICE_EXTENSION DeviceExtension;
NTSTATUS Status;
DPRINT("Called\n");
DPRINT("Called\n");
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
if (IrpSp->Parameters.Power.Type == DevicePowerState) {
/* FIXME: Set device power state for the device */ if (IrpSp->Parameters.Power.Type == DevicePowerState) {
Status = STATUS_UNSUCCESSFUL; /* FIXME: Set device power state for the device */
} else { Status = STATUS_UNSUCCESSFUL;
Status = STATUS_UNSUCCESSFUL; } else {
} Status = STATUS_UNSUCCESSFUL;
}
return Status;
} return Status;
}
/*** PUBLIC ******************************************************************/
/*** PUBLIC ******************************************************************/
NTSTATUS
FdoPnpControl( NTSTATUS
PDEVICE_OBJECT DeviceObject, FdoPnpControl(
PIRP Irp) PDEVICE_OBJECT DeviceObject,
/* PIRP Irp)
* FUNCTION: Handle Plug and Play IRPs for the PCI device object /*
* ARGUMENTS: * FUNCTION: Handle Plug and Play IRPs for the PCI device object
* DeviceObject = Pointer to functional device object of the PCI driver * ARGUMENTS:
* Irp = Pointer to IRP that should be handled * DeviceObject = Pointer to functional device object of the PCI driver
* RETURNS: * Irp = Pointer to IRP that should be handled
* Status * RETURNS:
*/ * Status
{ */
PFDO_DEVICE_EXTENSION DeviceExtension; {
PIO_STACK_LOCATION IrpSp; PFDO_DEVICE_EXTENSION DeviceExtension;
NTSTATUS Status; PIO_STACK_LOCATION IrpSp;
NTSTATUS Status;
DPRINT("Called\n");
DPRINT("Called\n");
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
IrpSp = IoGetCurrentIrpStackLocation(Irp);
switch (IrpSp->MinorFunction) { IrpSp = IoGetCurrentIrpStackLocation(Irp);
#if 0 switch (IrpSp->MinorFunction) {
case IRP_MN_CANCEL_REMOVE_DEVICE: #if 0
Status = STATUS_NOT_IMPLEMENTED; case IRP_MN_CANCEL_REMOVE_DEVICE:
break; Status = STATUS_NOT_IMPLEMENTED;
break;
case IRP_MN_CANCEL_STOP_DEVICE:
Status = STATUS_NOT_IMPLEMENTED; case IRP_MN_CANCEL_STOP_DEVICE:
break; Status = STATUS_NOT_IMPLEMENTED;
break;
case IRP_MN_DEVICE_USAGE_NOTIFICATION:
Status = STATUS_NOT_IMPLEMENTED; case IRP_MN_DEVICE_USAGE_NOTIFICATION:
break; Status = STATUS_NOT_IMPLEMENTED;
break;
case IRP_MN_FILTER_RESOURCE_REQUIREMENTS:
Status = STATUS_NOT_IMPLEMENTED; case IRP_MN_FILTER_RESOURCE_REQUIREMENTS:
break; Status = STATUS_NOT_IMPLEMENTED;
#endif break;
case IRP_MN_QUERY_DEVICE_RELATIONS: #endif
Status = FdoQueryBusRelations(DeviceObject, Irp, IrpSp); case IRP_MN_QUERY_DEVICE_RELATIONS:
break; Status = FdoQueryBusRelations(DeviceObject, Irp, IrpSp);
#if 0 break;
case IRP_MN_QUERY_PNP_DEVICE_STATE: #if 0
Status = STATUS_NOT_IMPLEMENTED; case IRP_MN_QUERY_PNP_DEVICE_STATE:
break; Status = STATUS_NOT_IMPLEMENTED;
break;
case IRP_MN_QUERY_REMOVE_DEVICE:
Status = STATUS_NOT_IMPLEMENTED; case IRP_MN_QUERY_REMOVE_DEVICE:
break; Status = STATUS_NOT_IMPLEMENTED;
break;
case IRP_MN_QUERY_STOP_DEVICE:
Status = STATUS_NOT_IMPLEMENTED; case IRP_MN_QUERY_STOP_DEVICE:
break; Status = STATUS_NOT_IMPLEMENTED;
break;
case IRP_MN_REMOVE_DEVICE:
Status = STATUS_NOT_IMPLEMENTED; case IRP_MN_REMOVE_DEVICE:
break; Status = STATUS_NOT_IMPLEMENTED;
#endif break;
case IRP_MN_START_DEVICE: #endif
DPRINT("IRP_MN_START_DEVICE received\n"); case IRP_MN_START_DEVICE:
Status = FdoStartDevice(DeviceObject, Irp); DPRINT("IRP_MN_START_DEVICE received\n");
break; Status = FdoStartDevice(DeviceObject, Irp);
case IRP_MN_STOP_DEVICE: break;
/* Currently not supported */ case IRP_MN_STOP_DEVICE:
Status = STATUS_UNSUCCESSFUL; /* Currently not supported */
break; Status = STATUS_UNSUCCESSFUL;
#if 0 break;
case IRP_MN_SURPRISE_REMOVAL: #if 0
Status = STATUS_NOT_IMPLEMENTED; case IRP_MN_SURPRISE_REMOVAL:
break; Status = STATUS_NOT_IMPLEMENTED;
#endif break;
default: #endif
DPRINT("Unknown IOCTL 0x%X\n", IrpSp->MinorFunction); default:
DPRINT("Unknown IOCTL 0x%X\n", IrpSp->MinorFunction);
/*
* Do NOT complete the IRP as it will be processed by the lower /*
* device object, which will complete the IRP * Do NOT complete the IRP as it will be processed by the lower
*/ * device object, which will complete the IRP
IoSkipCurrentIrpStackLocation(Irp); */
Status = IoCallDriver(DeviceExtension->Ldo, Irp); IoSkipCurrentIrpStackLocation(Irp);
return Status; Status = IoCallDriver(DeviceExtension->Ldo, Irp);
break; return Status;
} break;
}
if (Status != STATUS_PENDING) {
if (Status != STATUS_NOT_IMPLEMENTED) if (Status != STATUS_PENDING) {
Irp->IoStatus.Status = Status; if (Status != STATUS_NOT_IMPLEMENTED)
IoCompleteRequest(Irp, IO_NO_INCREMENT); Irp->IoStatus.Status = Status;
} IoCompleteRequest(Irp, IO_NO_INCREMENT);
}
DPRINT("Leaving. Status 0x%X\n", Status);
DPRINT("Leaving. Status 0x%X\n", Status);
return Status;
} return Status;
}
NTSTATUS
FdoPowerControl( NTSTATUS
PDEVICE_OBJECT DeviceObject, FdoPowerControl(
PIRP Irp) PDEVICE_OBJECT DeviceObject,
/* PIRP Irp)
* FUNCTION: Handle power management IRPs for the PCI device object /*
* ARGUMENTS: * FUNCTION: Handle power management IRPs for the PCI device object
* DeviceObject = Pointer to functional device object of the PCI driver * ARGUMENTS:
* Irp = Pointer to IRP that should be handled * DeviceObject = Pointer to functional device object of the PCI driver
* RETURNS: * Irp = Pointer to IRP that should be handled
* Status * RETURNS:
*/ * Status
{ */
PIO_STACK_LOCATION IrpSp; {
NTSTATUS Status; PIO_STACK_LOCATION IrpSp;
NTSTATUS Status;
DPRINT("Called\n");
DPRINT("Called\n");
IrpSp = IoGetCurrentIrpStackLocation(Irp);
IrpSp = IoGetCurrentIrpStackLocation(Irp);
switch (IrpSp->MinorFunction) {
case IRP_MN_SET_POWER: switch (IrpSp->MinorFunction) {
Status = FdoSetPower(DeviceObject, Irp, IrpSp); case IRP_MN_SET_POWER:
break; Status = FdoSetPower(DeviceObject, Irp, IrpSp);
break;
default:
DPRINT("Unknown IOCTL 0x%X\n", IrpSp->MinorFunction); default:
Status = STATUS_NOT_IMPLEMENTED; DPRINT("Unknown IOCTL 0x%X\n", IrpSp->MinorFunction);
break; Status = STATUS_NOT_IMPLEMENTED;
} break;
}
if (Status != STATUS_PENDING) {
Irp->IoStatus.Status = Status; if (Status != STATUS_PENDING) {
IoCompleteRequest(Irp, IO_NO_INCREMENT); Irp->IoStatus.Status = Status;
} IoCompleteRequest(Irp, IO_NO_INCREMENT);
}
DPRINT("Leaving. Status 0x%X\n", Status);
DPRINT("Leaving. Status 0x%X\n", Status);
return Status;
} return Status;
}
/* EOF */
/* EOF */