Remove useless code (ACPI now reports resources correctly)

Change ULONG to ULONG_PTR for IoStatus.Information field

svn path=/trunk/; revision=14500
This commit is contained in:
Hervé Poussineau 2005-04-05 12:00:37 +00:00
parent 849f32b6b5
commit f477aa0a0f
5 changed files with 24 additions and 89 deletions

View file

@ -298,7 +298,7 @@ SerialDeviceControl(
ULONG IoControlCode; ULONG IoControlCode;
PSERIAL_DEVICE_EXTENSION DeviceExtension; PSERIAL_DEVICE_EXTENSION DeviceExtension;
ULONG LengthIn, LengthOut; ULONG LengthIn, LengthOut;
ULONG Information = 0; ULONG_PTR Information = 0;
PVOID BufferIn, BufferOut; PVOID BufferIn, BufferOut;
PUCHAR ComPortBase; PUCHAR ComPortBase;
NTSTATUS Status; NTSTATUS Status;

View file

@ -20,7 +20,7 @@ SerialQueryInformation(
PIO_STACK_LOCATION Stack; PIO_STACK_LOCATION Stack;
PVOID SystemBuffer; PVOID SystemBuffer;
ULONG BufferLength; ULONG BufferLength;
ULONG Information = 0; ULONG_PTR Information = 0;
NTSTATUS Status; NTSTATUS Status;
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension; DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;

View file

@ -298,7 +298,7 @@ SerialPnp(
{ {
ULONG MinorFunction; ULONG MinorFunction;
PIO_STACK_LOCATION Stack; PIO_STACK_LOCATION Stack;
ULONG Information = 0; ULONG_PTR Information = 0;
NTSTATUS Status; NTSTATUS Status;
Stack = IoGetCurrentIrpStackLocation(Irp); Stack = IoGetCurrentIrpStackLocation(Irp);
@ -308,6 +308,7 @@ SerialPnp(
{ {
case IRP_MN_START_DEVICE: case IRP_MN_START_DEVICE:
{ {
BOOLEAN ConflictDetected;
DPRINT("Serial: IRP_MJ_PNP / IRP_MN_START_DEVICE\n"); DPRINT("Serial: IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
/* FIXME: first HACK: PnP manager can send multiple /* FIXME: first HACK: PnP manager can send multiple
@ -319,72 +320,11 @@ SerialPnp(
Status = STATUS_SUCCESS; Status = STATUS_SUCCESS;
break; break;
} }
/* FIXME: AllocatedResources MUST never be NULL ; /* FIXME: second HACK: verify that we don't have resource conflict,
* that's the second HACK because resource arbitration * because PnP manager doesn't do it automatically
* doesn't exist in ReactOS yet...
*/ */
if (Stack->Parameters.StartDevice.AllocatedResources == NULL)
{
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( Status = IoReportResourceForDetection(
DeviceObject->DriverObject, ResourceList, 0, DeviceObject->DriverObject, Stack->Parameters.StartDevice.AllocatedResources, 0,
NULL, NULL, 0, NULL, NULL, 0,
&ConflictDetected); &ConflictDetected);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -395,11 +335,6 @@ SerialPnp(
return Status; return Status;
} }
Stack->Parameters.StartDevice.AllocatedResources =
Stack->Parameters.StartDevice.AllocatedResourcesTranslated =
ResourceList;
}
/* Call lower driver */ /* Call lower driver */
Status = ForwardIrpAndWait(DeviceObject, Irp); Status = ForwardIrpAndWait(DeviceObject, Irp);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))

View file

@ -34,7 +34,7 @@ ReadBytes(
KIRQL Irql; KIRQL Irql;
ULONG ObjectCount; ULONG ObjectCount;
PVOID ObjectsArray[2]; PVOID ObjectsArray[2];
ULONG Information = 0; ULONG_PTR Information = 0;
NTSTATUS Status; NTSTATUS Status;
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension; DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
@ -247,7 +247,7 @@ SerialWrite(
PIO_STACK_LOCATION Stack; PIO_STACK_LOCATION Stack;
PSERIAL_DEVICE_EXTENSION DeviceExtension; PSERIAL_DEVICE_EXTENSION DeviceExtension;
ULONG Length; ULONG Length;
ULONG Information = 0; ULONG_PTR Information = 0;
PUCHAR Buffer; PUCHAR Buffer;
PUCHAR ComPortBase; PUCHAR ComPortBase;
KIRQL Irql; KIRQL Irql;

View file

@ -83,13 +83,6 @@ IoReportResourceForDetection(
*ConflictDetected = FALSE; *ConflictDetected = FALSE;
DPRINT1("IoReportResourceForDetection unimplemented\n"); 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, /* HACK: check if serial debug output is enabled. If yes,
* prevent serial port driver to detect this serial port * prevent serial port driver to detect this serial port
* by indicating a conflict * 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; return STATUS_SUCCESS;
} }