From f477aa0a0f5588ee1f7e32c4bf8bef67a6612448 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Tue, 5 Apr 2005 12:00:37 +0000 Subject: [PATCH] Remove useless code (ACPI now reports resources correctly) Change ULONG to ULONG_PTR for IoStatus.Information field svn path=/trunk/; revision=14500 --- reactos/drivers/dd/serial/devctrl.c | 2 +- reactos/drivers/dd/serial/info.c | 2 +- reactos/drivers/dd/serial/pnp.c | 91 +++++------------------------ reactos/drivers/dd/serial/rw.c | 4 +- reactos/ntoskrnl/io/pnpreport.c | 14 ++--- 5 files changed, 24 insertions(+), 89 deletions(-) diff --git a/reactos/drivers/dd/serial/devctrl.c b/reactos/drivers/dd/serial/devctrl.c index fb43321454d..72e8a5158f0 100644 --- a/reactos/drivers/dd/serial/devctrl.c +++ b/reactos/drivers/dd/serial/devctrl.c @@ -298,7 +298,7 @@ SerialDeviceControl( ULONG IoControlCode; PSERIAL_DEVICE_EXTENSION DeviceExtension; ULONG LengthIn, LengthOut; - ULONG Information = 0; + ULONG_PTR Information = 0; PVOID BufferIn, BufferOut; PUCHAR ComPortBase; NTSTATUS Status; diff --git a/reactos/drivers/dd/serial/info.c b/reactos/drivers/dd/serial/info.c index be5d7e97191..0b63deb794f 100644 --- a/reactos/drivers/dd/serial/info.c +++ b/reactos/drivers/dd/serial/info.c @@ -20,7 +20,7 @@ SerialQueryInformation( PIO_STACK_LOCATION Stack; PVOID SystemBuffer; ULONG BufferLength; - ULONG Information = 0; + ULONG_PTR Information = 0; NTSTATUS Status; DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension; diff --git a/reactos/drivers/dd/serial/pnp.c b/reactos/drivers/dd/serial/pnp.c index f07d20c6c17..256b337ef66 100644 --- a/reactos/drivers/dd/serial/pnp.c +++ b/reactos/drivers/dd/serial/pnp.c @@ -298,7 +298,7 @@ SerialPnp( { ULONG MinorFunction; PIO_STACK_LOCATION Stack; - ULONG Information = 0; + ULONG_PTR Information = 0; NTSTATUS Status; Stack = IoGetCurrentIrpStackLocation(Irp); @@ -308,6 +308,7 @@ SerialPnp( { case IRP_MN_START_DEVICE: { + BOOLEAN ConflictDetected; DPRINT("Serial: IRP_MJ_PNP / IRP_MN_START_DEVICE\n"); /* FIXME: first HACK: PnP manager can send multiple @@ -319,85 +320,19 @@ SerialPnp( Status = STATUS_SUCCESS; break; } - /* FIXME: AllocatedResources MUST never be NULL ; - * that's the second HACK because resource arbitration - * doesn't exist in ReactOS yet... + /* FIXME: second HACK: verify that we don't have resource conflict, + * because PnP manager doesn't do it automatically */ - if (Stack->Parameters.StartDevice.AllocatedResources == NULL) + Status = IoReportResourceForDetection( + DeviceObject->DriverObject, Stack->Parameters.StartDevice.AllocatedResources, 0, + NULL, NULL, 0, + &ConflictDetected); + if (!NT_SUCCESS(Status)) { - ULONG ResourceListSize; - PCM_RESOURCE_LIST ResourceList; - PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor; - KIRQL Dirql; - ULONG ComPortBase; - ULONG Irq; - BOOLEAN ConflictDetected; - - DPRINT1("Serial: no allocated resources for this device! Creating fake list\n"); - switch (((PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->ComPort) - { - case 1: - ComPortBase = 0x3f8; - Irq = 4; - break; - case 2: - ComPortBase = 0x2f8; - Irq = 3; - break; - default: - ComPortBase = Irq = 0; - } - - /* Create resource list */ - ResourceListSize = sizeof(CM_RESOURCE_LIST) + sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR); - ResourceList = (PCM_RESOURCE_LIST)ExAllocatePoolWithTag(PagedPool, ResourceListSize, SERIAL_TAG); - if (!ResourceList) - { - Irp->IoStatus.Information = 0; - Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_INSUFFICIENT_RESOURCES; - } - ResourceList->Count = 1; - ResourceList->List[0].InterfaceType = InterfaceTypeUndefined; - ResourceList->List[0].BusNumber = -1; /* unknown */ - ResourceList->List[0].PartialResourceList.Version = 1; - ResourceList->List[0].PartialResourceList.Revision = 1; - ResourceList->List[0].PartialResourceList.Count = 2; - ResourceDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[0]; - ResourceDescriptor->Type = CmResourceTypePort; - ResourceDescriptor->ShareDisposition = CmResourceShareDriverExclusive; - ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO; - ResourceDescriptor->u.Port.Start.u.HighPart = 0; - ResourceDescriptor->u.Port.Start.u.LowPart = ComPortBase; - ResourceDescriptor->u.Port.Length = 8; - - ResourceDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[1]; - ResourceDescriptor->Type = CmResourceTypeInterrupt; - ResourceDescriptor->ShareDisposition = CmResourceShareShared; - ResourceDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED; - ResourceDescriptor->u.Interrupt.Vector = HalGetInterruptVector( - Internal, 0, 0, Irq, - &Dirql, - &ResourceDescriptor->u.Interrupt.Affinity); - ResourceDescriptor->u.Interrupt.Level = (ULONG)Dirql; - - /* Verify that this COM port is not the serial debug port */ - Status = IoReportResourceForDetection( - DeviceObject->DriverObject, ResourceList, 0, - NULL, NULL, 0, - &ConflictDetected); - if (!NT_SUCCESS(Status)) - { - Irp->IoStatus.Information = 0; - Irp->IoStatus.Status = Status; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return Status; - } - - Stack->Parameters.StartDevice.AllocatedResources = - Stack->Parameters.StartDevice.AllocatedResourcesTranslated = - ResourceList; + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return Status; } /* Call lower driver */ diff --git a/reactos/drivers/dd/serial/rw.c b/reactos/drivers/dd/serial/rw.c index da82736cde7..8930840f2ed 100644 --- a/reactos/drivers/dd/serial/rw.c +++ b/reactos/drivers/dd/serial/rw.c @@ -34,7 +34,7 @@ ReadBytes( KIRQL Irql; ULONG ObjectCount; PVOID ObjectsArray[2]; - ULONG Information = 0; + ULONG_PTR Information = 0; NTSTATUS Status; DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension; @@ -247,7 +247,7 @@ SerialWrite( PIO_STACK_LOCATION Stack; PSERIAL_DEVICE_EXTENSION DeviceExtension; ULONG Length; - ULONG Information = 0; + ULONG_PTR Information = 0; PUCHAR Buffer; PUCHAR ComPortBase; KIRQL Irql; diff --git a/reactos/ntoskrnl/io/pnpreport.c b/reactos/ntoskrnl/io/pnpreport.c index 29f77377495..3c33f8f5651 100644 --- a/reactos/ntoskrnl/io/pnpreport.c +++ b/reactos/ntoskrnl/io/pnpreport.c @@ -83,13 +83,6 @@ IoReportResourceForDetection( *ConflictDetected = FALSE; DPRINT1("IoReportResourceForDetection unimplemented\n"); - if (PopSystemPowerDeviceNode != NULL && DriverListSize > 0) - { - /* We hope serial ports will be enumerated by ACPI */ - *ConflictDetected = TRUE; - return STATUS_CONFLICTING_ADDRESSES; - } - /* HACK: check if serial debug output is enabled. If yes, * prevent serial port driver to detect this serial port * by indicating a conflict @@ -123,6 +116,13 @@ IoReportResourceForDetection( } } } + + if (PopSystemPowerDeviceNode != NULL && DriverListSize > 0) + { + /* We hope legacy devices will be enumerated by ACPI */ + *ConflictDetected = TRUE; + return STATUS_CONFLICTING_ADDRESSES; + } return STATUS_SUCCESS; }