mirror of
https://github.com/reactos/reactos.git
synced 2024-07-02 02:34:53 +00:00
[FORMATTING]
Fix indentation. No code changes! svn path=/trunk/; revision=61085
This commit is contained in:
parent
e5769b0d38
commit
f09cfef7f5
|
@ -69,13 +69,15 @@ FdoLocateChildDevice(
|
|||
DPRINT("Called\n");
|
||||
|
||||
CurrentEntry = DeviceExtension->DeviceListHead.Flink;
|
||||
while (CurrentEntry != &DeviceExtension->DeviceListHead) {
|
||||
while (CurrentEntry != &DeviceExtension->DeviceListHead)
|
||||
{
|
||||
CurrentDevice = CONTAINING_RECORD(CurrentEntry, PCI_DEVICE, ListEntry);
|
||||
|
||||
/* If both vendor ID and device ID match, it is the same device */
|
||||
if ((PciConfig->VendorID == CurrentDevice->PciConfig.VendorID) &&
|
||||
(PciConfig->DeviceID == CurrentDevice->PciConfig.DeviceID) &&
|
||||
(SlotNumber.u.AsULONG == CurrentDevice->SlotNumber.u.AsULONG)) {
|
||||
(SlotNumber.u.AsULONG == CurrentDevice->SlotNumber.u.AsULONG))
|
||||
{
|
||||
*Device = CurrentDevice;
|
||||
DPRINT("Done\n");
|
||||
return STATUS_SUCCESS;
|
||||
|
@ -228,13 +230,14 @@ FdoQueryBusRelations(
|
|||
|
||||
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
if (Irp->IoStatus.Information) {
|
||||
if (Irp->IoStatus.Information)
|
||||
{
|
||||
/* FIXME: Another bus driver has already created a DEVICE_RELATIONS
|
||||
structure so we must merge this structure with our own */
|
||||
}
|
||||
|
||||
Size = sizeof(DEVICE_RELATIONS) + sizeof(Relations->Objects) *
|
||||
(DeviceExtension->DeviceListCount - 1);
|
||||
Size = sizeof(DEVICE_RELATIONS) +
|
||||
sizeof(Relations->Objects) * (DeviceExtension->DeviceListCount - 1);
|
||||
Relations = (PDEVICE_RELATIONS)ExAllocatePool(PagedPool, Size);
|
||||
if (!Relations)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
@ -243,23 +246,25 @@ FdoQueryBusRelations(
|
|||
|
||||
i = 0;
|
||||
CurrentEntry = DeviceExtension->DeviceListHead.Flink;
|
||||
while (CurrentEntry != &DeviceExtension->DeviceListHead) {
|
||||
while (CurrentEntry != &DeviceExtension->DeviceListHead)
|
||||
{
|
||||
Device = CONTAINING_RECORD(CurrentEntry, PCI_DEVICE, ListEntry);
|
||||
|
||||
PdoDeviceExtension = NULL;
|
||||
|
||||
if (!Device->Pdo) {
|
||||
if (!Device->Pdo)
|
||||
{
|
||||
/* Create a physical device object for the
|
||||
device as it does not already have one */
|
||||
Status = IoCreateDevice(
|
||||
DeviceObject->DriverObject,
|
||||
Status = IoCreateDevice(DeviceObject->DriverObject,
|
||||
sizeof(PDO_DEVICE_EXTENSION),
|
||||
NULL,
|
||||
FILE_DEVICE_CONTROLLER,
|
||||
FILE_AUTOGENERATED_DEVICE_NAME,
|
||||
FALSE,
|
||||
&Device->Pdo);
|
||||
if (!NT_SUCCESS(Status)) {
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("IoCreateDevice() failed with status 0x%X\n", Status);
|
||||
ErrorStatus = Status;
|
||||
ErrorOccurred = TRUE;
|
||||
|
@ -352,10 +357,12 @@ FdoQueryBusRelations(
|
|||
CurrentEntry = CurrentEntry->Flink;
|
||||
}
|
||||
|
||||
if (ErrorOccurred) {
|
||||
if (ErrorOccurred)
|
||||
{
|
||||
/* FIXME: Cleanup all new PDOs created in this call. Please give me SEH!!! ;-) */
|
||||
/* FIXME: Should IoAttachDeviceToDeviceStack() be undone? */
|
||||
if (PdoDeviceExtension) {
|
||||
if (PdoDeviceExtension)
|
||||
{
|
||||
RtlFreeUnicodeString(&PdoDeviceExtension->DeviceID);
|
||||
RtlFreeUnicodeString(&PdoDeviceExtension->InstanceID);
|
||||
RtlFreeUnicodeString(&PdoDeviceExtension->HardwareIDs);
|
||||
|
@ -397,13 +404,15 @@ FdoStartDevice(
|
|||
DPRINT("No allocated resources sent to driver\n");
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
if (AllocatedResources->Count < 1)
|
||||
{
|
||||
DPRINT("Not enough allocated resources sent to driver\n");
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
if (AllocatedResources->List[0].PartialResourceList.Version != 1
|
||||
|| AllocatedResources->List[0].PartialResourceList.Revision != 1)
|
||||
|
||||
if (AllocatedResources->List[0].PartialResourceList.Version != 1 ||
|
||||
AllocatedResources->List[0].PartialResourceList.Revision != 1)
|
||||
return STATUS_REVISION_MISMATCH;
|
||||
|
||||
ASSERT(DeviceExtension->State == dsStopped);
|
||||
|
@ -417,16 +426,16 @@ FdoStartDevice(
|
|||
switch (ResourceDescriptor->Type)
|
||||
{
|
||||
case CmResourceTypeBusNumber:
|
||||
{
|
||||
if (FoundBusNumber || ResourceDescriptor->u.BusNumber.Length != 1)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
/* Use this one instead */
|
||||
ASSERT(AllocatedResources->List[0].BusNumber == ResourceDescriptor->u.BusNumber.Start);
|
||||
DeviceExtension->BusNumber = ResourceDescriptor->u.BusNumber.Start;
|
||||
DPRINT("Found bus number resource: %lu\n", DeviceExtension->BusNumber);
|
||||
FoundBusNumber = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
DPRINT("Unknown resource descriptor type 0x%x\n", ResourceDescriptor->Type);
|
||||
}
|
||||
|
@ -461,10 +470,13 @@ FdoSetPower(
|
|||
|
||||
DPRINT("Called\n");
|
||||
|
||||
if (IrpSp->Parameters.Power.Type == DevicePowerState) {
|
||||
if (IrpSp->Parameters.Power.Type == DevicePowerState)
|
||||
{
|
||||
/* FIXME: Set device power state for the device */
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
|
@ -496,7 +508,8 @@ FdoPnpControl(
|
|||
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
IrpSp = IoGetCurrentIrpStackLocation(Irp);
|
||||
switch (IrpSp->MinorFunction) {
|
||||
switch (IrpSp->MinorFunction)
|
||||
{
|
||||
#if 0
|
||||
case IRP_MN_CANCEL_REMOVE_DEVICE:
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
|
@ -556,8 +569,10 @@ FdoPnpControl(
|
|||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case IRP_MN_FILTER_RESOURCE_REQUIREMENTS:
|
||||
break;
|
||||
|
||||
case IRP_MN_REMOVE_DEVICE:
|
||||
/* Detach the device object from the device stack */
|
||||
IoDetachDevice(DeviceExtension->Ldo);
|
||||
|
@ -568,6 +583,7 @@ FdoPnpControl(
|
|||
/* Return success */
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
||||
default:
|
||||
DPRINT1("Unknown IOCTL 0x%lx\n", IrpSp->MinorFunction);
|
||||
break;
|
||||
|
@ -603,7 +619,8 @@ FdoPowerControl(
|
|||
|
||||
IrpSp = IoGetCurrentIrpStackLocation(Irp);
|
||||
|
||||
switch (IrpSp->MinorFunction) {
|
||||
switch (IrpSp->MinorFunction)
|
||||
{
|
||||
case IRP_MN_SET_POWER:
|
||||
Status = FdoSetPower(DeviceObject, Irp, IrpSp);
|
||||
break;
|
||||
|
@ -614,7 +631,8 @@ FdoPowerControl(
|
|||
break;
|
||||
}
|
||||
|
||||
if (Status != STATUS_PENDING) {
|
||||
if (Status != STATUS_PENDING)
|
||||
{
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
}
|
||||
|
|
|
@ -58,14 +58,16 @@ PciDispatchDeviceControl(
|
|||
Irp->IoStatus.Information = 0;
|
||||
|
||||
IrpSp = IoGetCurrentIrpStackLocation(Irp);
|
||||
switch (IrpSp->Parameters.DeviceIoControl.IoControlCode) {
|
||||
switch (IrpSp->Parameters.DeviceIoControl.IoControlCode)
|
||||
{
|
||||
default:
|
||||
DPRINT("Unknown IOCTL 0x%X\n", IrpSp->Parameters.DeviceIoControl.IoControlCode);
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
|
||||
if (Status != STATUS_PENDING) {
|
||||
if (Status != STATUS_PENDING)
|
||||
{
|
||||
Irp->IoStatus.Status = Status;
|
||||
|
||||
DPRINT("Completing IRP at 0x%p\n", Irp);
|
||||
|
@ -100,9 +102,12 @@ PciPnpControl(
|
|||
|
||||
DPRINT("IsFDO %u\n", DeviceExtension->IsFDO);
|
||||
|
||||
if (DeviceExtension->IsFDO) {
|
||||
if (DeviceExtension->IsFDO)
|
||||
{
|
||||
Status = FdoPnpControl(DeviceObject, Irp);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = PdoPnpControl(DeviceObject, Irp);
|
||||
}
|
||||
|
||||
|
@ -129,9 +134,12 @@ PciPowerControl(
|
|||
|
||||
DeviceExtension = (PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
if (DeviceExtension->IsFDO) {
|
||||
if (DeviceExtension->IsFDO)
|
||||
{
|
||||
Status = FdoPowerControl(DeviceObject, Irp);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = PdoPowerControl(DeviceObject, Irp);
|
||||
}
|
||||
|
||||
|
@ -153,9 +161,15 @@ PciAddDevice(
|
|||
if (PhysicalDeviceObject == NULL)
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
Status = IoCreateDevice(DriverObject, sizeof(FDO_DEVICE_EXTENSION),
|
||||
NULL, FILE_DEVICE_BUS_EXTENDER, FILE_DEVICE_SECURE_OPEN, TRUE, &Fdo);
|
||||
if (!NT_SUCCESS(Status)) {
|
||||
Status = IoCreateDevice(DriverObject,
|
||||
sizeof(FDO_DEVICE_EXTENSION),
|
||||
NULL,
|
||||
FILE_DEVICE_BUS_EXTENDER,
|
||||
FILE_DEVICE_SECURE_OPEN,
|
||||
TRUE,
|
||||
&Fdo);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("IoCreateDevice() failed with status 0x%X\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
@ -166,8 +180,8 @@ PciAddDevice(
|
|||
|
||||
DeviceExtension->Common.IsFDO = TRUE;
|
||||
|
||||
DeviceExtension->Ldo =
|
||||
IoAttachDeviceToDeviceStack(Fdo, PhysicalDeviceObject);
|
||||
DeviceExtension->Ldo = IoAttachDeviceToDeviceStack(Fdo,
|
||||
PhysicalDeviceObject);
|
||||
|
||||
DeviceExtension->State = dsStopped;
|
||||
|
||||
|
@ -208,13 +222,13 @@ DriverEntry(
|
|||
DriverObject->DriverExtension->AddDevice = PciAddDevice;
|
||||
DriverObject->DriverUnload = PciUnload;
|
||||
|
||||
Status = IoAllocateDriverObjectExtension(
|
||||
DriverObject,
|
||||
Status = IoAllocateDriverObjectExtension(DriverObject,
|
||||
DriverObject,
|
||||
sizeof(PCI_DRIVER_EXTENSION),
|
||||
(PVOID*)&DriverExtension);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
|
||||
RtlZeroMemory(DriverExtension, sizeof(PCI_DRIVER_EXTENSION));
|
||||
|
||||
InitializeListHead(&DriverExtension->BusListHead);
|
||||
|
@ -659,17 +673,18 @@ PciDuplicateUnicodeString(
|
|||
IN PCUNICODE_STRING SourceString,
|
||||
OUT PUNICODE_STRING DestinationString)
|
||||
{
|
||||
if (SourceString == NULL || DestinationString == NULL
|
||||
|| SourceString->Length > SourceString->MaximumLength
|
||||
|| (SourceString->Length == 0 && SourceString->MaximumLength > 0 && SourceString->Buffer == NULL)
|
||||
|| Flags == RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING || Flags >= 4)
|
||||
if (SourceString == NULL ||
|
||||
DestinationString == NULL ||
|
||||
SourceString->Length > SourceString->MaximumLength ||
|
||||
(SourceString->Length == 0 && SourceString->MaximumLength > 0 && SourceString->Buffer == NULL) ||
|
||||
Flags == RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING ||
|
||||
Flags >= 4)
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
if ((SourceString->Length == 0)
|
||||
&& (Flags != (RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE |
|
||||
if ((SourceString->Length == 0) &&
|
||||
(Flags != (RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE |
|
||||
RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING)))
|
||||
{
|
||||
DestinationString->Length = 0;
|
||||
|
|
|
@ -26,7 +26,8 @@ typedef struct _PCI_DEVICE
|
|||
} PCI_DEVICE, *PPCI_DEVICE;
|
||||
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
dsStopped,
|
||||
dsStarted,
|
||||
dsPaused,
|
||||
|
|
|
@ -80,10 +80,10 @@ PdoQueryId(
|
|||
|
||||
RtlInitUnicodeString(&String, NULL);
|
||||
|
||||
switch (IrpSp->Parameters.QueryId.IdType) {
|
||||
switch (IrpSp->Parameters.QueryId.IdType)
|
||||
{
|
||||
case BusQueryDeviceID:
|
||||
Status = PciDuplicateUnicodeString(
|
||||
RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
|
||||
Status = PciDuplicateUnicodeString(RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
|
||||
&DeviceExtension->DeviceID,
|
||||
&String);
|
||||
|
||||
|
@ -93,8 +93,7 @@ PdoQueryId(
|
|||
break;
|
||||
|
||||
case BusQueryHardwareIDs:
|
||||
Status = PciDuplicateUnicodeString(
|
||||
RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
|
||||
Status = PciDuplicateUnicodeString(RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
|
||||
&DeviceExtension->HardwareIDs,
|
||||
&String);
|
||||
|
||||
|
@ -102,8 +101,7 @@ PdoQueryId(
|
|||
break;
|
||||
|
||||
case BusQueryCompatibleIDs:
|
||||
Status = PciDuplicateUnicodeString(
|
||||
RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
|
||||
Status = PciDuplicateUnicodeString(RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
|
||||
&DeviceExtension->CompatibleIDs,
|
||||
&String);
|
||||
|
||||
|
@ -111,8 +109,7 @@ PdoQueryId(
|
|||
break;
|
||||
|
||||
case BusQueryInstanceID:
|
||||
Status = PciDuplicateUnicodeString(
|
||||
RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
|
||||
Status = PciDuplicateUnicodeString(RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
|
||||
&DeviceExtension->InstanceID,
|
||||
&String);
|
||||
|
||||
|
@ -389,6 +386,7 @@ PdoQueryResourceRequirements(
|
|||
if (Length != 0)
|
||||
ResCount += 2;
|
||||
}
|
||||
|
||||
if (DeviceExtension->PciDevice->PciConfig.BaseClass == PCI_CLASS_BRIDGE_DEV)
|
||||
ResCount++;
|
||||
}
|
||||
|
@ -408,14 +406,15 @@ PdoQueryResourceRequirements(
|
|||
}
|
||||
|
||||
/* Calculate the resource list size */
|
||||
ListSize = FIELD_OFFSET(IO_RESOURCE_REQUIREMENTS_LIST, List[0].Descriptors)
|
||||
+ ResCount * sizeof(IO_RESOURCE_DESCRIPTOR);
|
||||
ListSize = FIELD_OFFSET(IO_RESOURCE_REQUIREMENTS_LIST, List[0].Descriptors) +
|
||||
ResCount * sizeof(IO_RESOURCE_DESCRIPTOR);
|
||||
|
||||
DPRINT("ListSize %lu (0x%lx)\n", ListSize, ListSize);
|
||||
|
||||
/* Allocate the resource requirements list */
|
||||
ResourceList = ExAllocatePoolWithTag(PagedPool,
|
||||
ListSize, TAG_PCI);
|
||||
ListSize,
|
||||
TAG_PCI);
|
||||
if (ResourceList == NULL)
|
||||
{
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
@ -600,6 +599,7 @@ PdoQueryResourceRequirements(
|
|||
}
|
||||
Descriptor++;
|
||||
}
|
||||
|
||||
if (DeviceExtension->PciDevice->PciConfig.BaseClass == PCI_CLASS_BRIDGE_DEV)
|
||||
{
|
||||
Descriptor->Option = 0; /* Required */
|
||||
|
@ -699,6 +699,7 @@ PdoQueryResources(
|
|||
if (Length != 0)
|
||||
ResCount++;
|
||||
}
|
||||
|
||||
if (DeviceExtension->PciDevice->PciConfig.BaseClass == PCI_CLASS_BRIDGE_DEV)
|
||||
ResCount++;
|
||||
}
|
||||
|
@ -718,12 +719,13 @@ PdoQueryResources(
|
|||
}
|
||||
|
||||
/* Calculate the resource list size */
|
||||
ListSize = FIELD_OFFSET(CM_RESOURCE_LIST, List[0].PartialResourceList.PartialDescriptors)
|
||||
+ ResCount * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||
ListSize = FIELD_OFFSET(CM_RESOURCE_LIST, List[0].PartialResourceList.PartialDescriptors) +
|
||||
ResCount * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||
|
||||
/* Allocate the resource list */
|
||||
ResourceList = ExAllocatePoolWithTag(PagedPool,
|
||||
ListSize, TAG_PCI);
|
||||
ListSize,
|
||||
TAG_PCI);
|
||||
if (ResourceList == NULL)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
|
@ -763,8 +765,7 @@ PdoQueryResources(
|
|||
Descriptor->Type = CmResourceTypePort;
|
||||
Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
|
||||
Descriptor->Flags = CM_RESOURCE_PORT_IO;
|
||||
Descriptor->u.Port.Start.QuadPart =
|
||||
(ULONGLONG)Base;
|
||||
Descriptor->u.Port.Start.QuadPart = (ULONGLONG)Base;
|
||||
Descriptor->u.Port.Length = Length;
|
||||
|
||||
/* Enable IO space access */
|
||||
|
@ -775,8 +776,7 @@ PdoQueryResources(
|
|||
Descriptor->Type = CmResourceTypeMemory;
|
||||
Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
|
||||
Descriptor->Flags = CM_RESOURCE_MEMORY_READ_WRITE;
|
||||
Descriptor->u.Memory.Start.QuadPart =
|
||||
(ULONGLONG)Base;
|
||||
Descriptor->u.Memory.Start.QuadPart = (ULONGLONG)Base;
|
||||
Descriptor->u.Memory.Length = Length;
|
||||
|
||||
/* Enable memory space access */
|
||||
|
@ -827,8 +827,7 @@ PdoQueryResources(
|
|||
Descriptor->Type = CmResourceTypePort;
|
||||
Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
|
||||
Descriptor->Flags = CM_RESOURCE_PORT_IO;
|
||||
Descriptor->u.Port.Start.QuadPart =
|
||||
(ULONGLONG)Base;
|
||||
Descriptor->u.Port.Start.QuadPart = (ULONGLONG)Base;
|
||||
Descriptor->u.Port.Length = Length;
|
||||
|
||||
/* Enable IO space access */
|
||||
|
@ -839,8 +838,7 @@ PdoQueryResources(
|
|||
Descriptor->Type = CmResourceTypeMemory;
|
||||
Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
|
||||
Descriptor->Flags = CM_RESOURCE_MEMORY_READ_WRITE;
|
||||
Descriptor->u.Memory.Start.QuadPart =
|
||||
(ULONGLONG)Base;
|
||||
Descriptor->u.Memory.Start.QuadPart = (ULONGLONG)Base;
|
||||
Descriptor->u.Memory.Length = Length;
|
||||
|
||||
/* Enable memory space access */
|
||||
|
@ -849,6 +847,7 @@ PdoQueryResources(
|
|||
|
||||
Descriptor++;
|
||||
}
|
||||
|
||||
if (DeviceExtension->PciDevice->PciConfig.BaseClass == PCI_CLASS_BRIDGE_DEV)
|
||||
{
|
||||
Descriptor->Type = CmResourceTypeBusNumber;
|
||||
|
@ -915,9 +914,11 @@ InterfaceBusTranslateBusAddress(
|
|||
|
||||
DeviceExtension = (PPDO_DEVICE_EXTENSION)((PDEVICE_OBJECT)Context)->DeviceExtension;
|
||||
|
||||
return HalTranslateBusAddress(
|
||||
PCIBus, DeviceExtension->PciDevice->BusNumber,
|
||||
BusAddress, AddressSpace, TranslatedAddress);
|
||||
return HalTranslateBusAddress(PCIBus,
|
||||
DeviceExtension->PciDevice->BusNumber,
|
||||
BusAddress,
|
||||
AddressSpace,
|
||||
TranslatedAddress);
|
||||
}
|
||||
|
||||
static GET_DMA_ADAPTER InterfaceBusGetDmaAdapter;
|
||||
|
@ -1037,8 +1038,8 @@ InterfacePciDevicePresent(
|
|||
if (PciDevice->PciConfig.VendorID == VendorID &&
|
||||
PciDevice->PciConfig.DeviceID == DeviceID)
|
||||
{
|
||||
if (!(Flags & PCI_USE_SUBSYSTEM_IDS) || (
|
||||
PciDevice->PciConfig.u.type0.SubVendorID == SubVendorID &&
|
||||
if (!(Flags & PCI_USE_SUBSYSTEM_IDS) ||
|
||||
(PciDevice->PciConfig.u.type0.SubVendorID == SubVendorID &&
|
||||
PciDevice->PciConfig.u.type0.SubSystemID == SubSystemID))
|
||||
{
|
||||
if (!(Flags & PCI_USE_REVISION) ||
|
||||
|
@ -1067,34 +1068,39 @@ CheckPciDevice(
|
|||
IN PPCI_COMMON_CONFIG PciConfig,
|
||||
IN PPCI_DEVICE_PRESENCE_PARAMETERS Parameters)
|
||||
{
|
||||
if ((Parameters->Flags & PCI_USE_VENDEV_IDS) && (
|
||||
PciConfig->VendorID != Parameters->VendorID ||
|
||||
if ((Parameters->Flags & PCI_USE_VENDEV_IDS) &&
|
||||
(PciConfig->VendorID != Parameters->VendorID ||
|
||||
PciConfig->DeviceID != Parameters->DeviceID))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if ((Parameters->Flags & PCI_USE_CLASS_SUBCLASS) && (
|
||||
PciConfig->BaseClass != Parameters->BaseClass ||
|
||||
|
||||
if ((Parameters->Flags & PCI_USE_CLASS_SUBCLASS) &&
|
||||
(PciConfig->BaseClass != Parameters->BaseClass ||
|
||||
PciConfig->SubClass != Parameters->SubClass))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((Parameters->Flags & PCI_USE_PROGIF) &&
|
||||
PciConfig->ProgIf != Parameters->ProgIf)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if ((Parameters->Flags & PCI_USE_SUBSYSTEM_IDS) && (
|
||||
PciConfig->u.type0.SubVendorID != Parameters->SubVendorID ||
|
||||
|
||||
if ((Parameters->Flags & PCI_USE_SUBSYSTEM_IDS) &&
|
||||
(PciConfig->u.type0.SubVendorID != Parameters->SubVendorID ||
|
||||
PciConfig->u.type0.SubSystemID != Parameters->SubSystemID))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((Parameters->Flags & PCI_USE_REVISION) &&
|
||||
PciConfig->RevisionID != Parameters->RevisionID)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1167,6 +1173,7 @@ PdoQueryInterface(
|
|||
NTSTATUS Status;
|
||||
|
||||
UNREFERENCED_PARAMETER(Irp);
|
||||
|
||||
if (RtlCompareMemory(IrpSp->Parameters.QueryInterface.InterfaceType,
|
||||
&GUID_BUS_INTERFACE_STANDARD, sizeof(GUID)) == sizeof(GUID))
|
||||
{
|
||||
|
@ -1329,8 +1336,7 @@ PdoReadConfig(
|
|||
|
||||
DPRINT("PdoReadConfig() called\n");
|
||||
|
||||
Size = InterfaceBusGetBusData(
|
||||
DeviceObject,
|
||||
Size = InterfaceBusGetBusData(DeviceObject,
|
||||
IrpSp->Parameters.ReadWriteConfig.WhichSpace,
|
||||
IrpSp->Parameters.ReadWriteConfig.Buffer,
|
||||
IrpSp->Parameters.ReadWriteConfig.Offset,
|
||||
|
@ -1360,8 +1366,7 @@ PdoWriteConfig(
|
|||
DPRINT1("PdoWriteConfig() called\n");
|
||||
|
||||
/* Get PCI configuration space */
|
||||
Size = InterfaceBusSetBusData(
|
||||
DeviceObject,
|
||||
Size = InterfaceBusSetBusData(DeviceObject,
|
||||
IrpSp->Parameters.ReadWriteConfig.WhichSpace,
|
||||
IrpSp->Parameters.ReadWriteConfig.Buffer,
|
||||
IrpSp->Parameters.ReadWriteConfig.Offset,
|
||||
|
@ -1419,13 +1424,18 @@ PdoSetPower(
|
|||
UNREFERENCED_PARAMETER(Irp);
|
||||
DPRINT("Called\n");
|
||||
|
||||
if (IrpSp->Parameters.Power.Type == DevicePowerState) {
|
||||
if (IrpSp->Parameters.Power.Type == DevicePowerState)
|
||||
{
|
||||
Status = STATUS_SUCCESS;
|
||||
switch (IrpSp->Parameters.Power.State.SystemState) {
|
||||
|
||||
switch (IrpSp->Parameters.Power.State.SystemState)
|
||||
{
|
||||
default:
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
|
@ -1457,8 +1467,8 @@ PdoPnpControl(
|
|||
|
||||
IrpSp = IoGetCurrentIrpStackLocation(Irp);
|
||||
|
||||
switch (IrpSp->MinorFunction) {
|
||||
|
||||
switch (IrpSp->MinorFunction)
|
||||
{
|
||||
case IRP_MN_DEVICE_USAGE_NOTIFICATION:
|
||||
DPRINT("Unimplemented IRP_MN_DEVICE_USAGE_NOTIFICATION received\n");
|
||||
break;
|
||||
|
@ -1570,7 +1580,8 @@ PdoPnpControl(
|
|||
break;
|
||||
}
|
||||
|
||||
if (Status != STATUS_PENDING) {
|
||||
if (Status != STATUS_PENDING)
|
||||
{
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
}
|
||||
|
@ -1600,7 +1611,8 @@ PdoPowerControl(
|
|||
|
||||
IrpSp = IoGetCurrentIrpStackLocation(Irp);
|
||||
|
||||
switch (IrpSp->MinorFunction) {
|
||||
switch (IrpSp->MinorFunction)
|
||||
{
|
||||
case IRP_MN_SET_POWER:
|
||||
Status = PdoSetPower(DeviceObject, Irp, IrpSp);
|
||||
break;
|
||||
|
@ -1611,7 +1623,8 @@ PdoPowerControl(
|
|||
break;
|
||||
}
|
||||
|
||||
if (Status != STATUS_PENDING) {
|
||||
if (Status != STATUS_PENDING)
|
||||
{
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue