Remove useless code (ACPI now reports resources correctly)
Change ULONG to ULONG_PTR for IoStatus.Information field
Modified: trunk/reactos/drivers/dd/serial/devctrl.c
Modified: trunk/reactos/drivers/dd/serial/info.c
Modified: trunk/reactos/drivers/dd/serial/pnp.c
Modified: trunk/reactos/drivers/dd/serial/rw.c
Modified: trunk/reactos/ntoskrnl/io/pnpreport.c

Modified: trunk/reactos/drivers/dd/serial/devctrl.c
--- trunk/reactos/drivers/dd/serial/devctrl.c	2005-04-05 12:00:13 UTC (rev 14499)
+++ trunk/reactos/drivers/dd/serial/devctrl.c	2005-04-05 12:00:37 UTC (rev 14500)
@@ -298,7 +298,7 @@
 	ULONG IoControlCode;
 	PSERIAL_DEVICE_EXTENSION DeviceExtension;
 	ULONG LengthIn, LengthOut;
-	ULONG Information = 0;
+	ULONG_PTR Information = 0;
 	PVOID BufferIn, BufferOut;
 	PUCHAR ComPortBase;
 	NTSTATUS Status;

Modified: trunk/reactos/drivers/dd/serial/info.c
--- trunk/reactos/drivers/dd/serial/info.c	2005-04-05 12:00:13 UTC (rev 14499)
+++ trunk/reactos/drivers/dd/serial/info.c	2005-04-05 12:00:37 UTC (rev 14500)
@@ -20,7 +20,7 @@
 	PIO_STACK_LOCATION Stack;
 	PVOID SystemBuffer;
 	ULONG BufferLength;
-	ULONG Information = 0;
+	ULONG_PTR Information = 0;
 	NTSTATUS Status;
 	
 	DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;

Modified: trunk/reactos/drivers/dd/serial/pnp.c
--- trunk/reactos/drivers/dd/serial/pnp.c	2005-04-05 12:00:13 UTC (rev 14499)
+++ trunk/reactos/drivers/dd/serial/pnp.c	2005-04-05 12:00:37 UTC (rev 14500)
@@ -298,7 +298,7 @@
 {
 	ULONG MinorFunction;
 	PIO_STACK_LOCATION Stack;
-	ULONG Information = 0;
+	ULONG_PTR Information = 0;
 	NTSTATUS Status;
 	
 	Stack = IoGetCurrentIrpStackLocation(Irp);
@@ -308,6 +308,7 @@
 	{
 		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 @@
 				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 */

Modified: trunk/reactos/drivers/dd/serial/rw.c
--- trunk/reactos/drivers/dd/serial/rw.c	2005-04-05 12:00:13 UTC (rev 14499)
+++ trunk/reactos/drivers/dd/serial/rw.c	2005-04-05 12:00:37 UTC (rev 14500)
@@ -34,7 +34,7 @@
 	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 @@
 	PIO_STACK_LOCATION Stack;
 	PSERIAL_DEVICE_EXTENSION DeviceExtension;
 	ULONG Length;
-	ULONG Information = 0;
+	ULONG_PTR Information = 0;
 	PUCHAR Buffer;
 	PUCHAR ComPortBase;
 	KIRQL Irql;

Modified: trunk/reactos/ntoskrnl/io/pnpreport.c
--- trunk/reactos/ntoskrnl/io/pnpreport.c	2005-04-05 12:00:13 UTC (rev 14499)
+++ trunk/reactos/ntoskrnl/io/pnpreport.c	2005-04-05 12:00:37 UTC (rev 14500)
@@ -83,13 +83,6 @@
   *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 @@
       }
     }
   }
+  
+  if (PopSystemPowerDeviceNode != NULL && DriverListSize > 0)
+  {
+    /* We hope legacy devices will be enumerated by ACPI */
+    *ConflictDetected = TRUE;
+    return STATUS_CONFLICTING_ADDRESSES;
+  }
   return STATUS_SUCCESS;
 }