From 74b889b3977594229a78d87066dfc22c1f9b46b8 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 23 Aug 2011 05:17:41 +0000 Subject: [PATCH] [HAL] - Fix device reporting to work with the IoReportDetectedDevice patch [HAL/ACPI] - Turn debugging off svn path=/trunk/; revision=53394 --- reactos/drivers/bus/acpi/acpienum.c | 2 +- reactos/drivers/bus/acpi/buspdo.c | 2 +- reactos/drivers/bus/acpi/main.c | 2 +- reactos/drivers/bus/acpi/pnp.c | 2 +- reactos/hal/halx86/generic/acpi/halacpi.c | 2 +- reactos/hal/halx86/generic/acpi/halpnpdd.c | 73 +++++++++++----------- 6 files changed, 40 insertions(+), 43 deletions(-) diff --git a/reactos/drivers/bus/acpi/acpienum.c b/reactos/drivers/bus/acpi/acpienum.c index 13e72ddb9f4..c011dbadd63 100644 --- a/reactos/drivers/bus/acpi/acpienum.c +++ b/reactos/drivers/bus/acpi/acpienum.c @@ -13,7 +13,7 @@ #include #include -//#define NDEBUG +#define NDEBUG #include #define HAS_CHILDREN(d) ((d)->children.next != &((d)->children)) diff --git a/reactos/drivers/bus/acpi/buspdo.c b/reactos/drivers/bus/acpi/buspdo.c index 1d4936aee96..aa5ba4254e2 100644 --- a/reactos/drivers/bus/acpi/buspdo.c +++ b/reactos/drivers/bus/acpi/buspdo.c @@ -11,7 +11,7 @@ #include #include -//#define NDEBUG +#define NDEBUG #include #ifdef ALLOC_PRAGMA diff --git a/reactos/drivers/bus/acpi/main.c b/reactos/drivers/bus/acpi/main.c index a4f6c1dde23..7f2ae262e1b 100644 --- a/reactos/drivers/bus/acpi/main.c +++ b/reactos/drivers/bus/acpi/main.c @@ -9,7 +9,7 @@ #include #include -//#define NDEBUG +#define NDEBUG #include NTSTATUS diff --git a/reactos/drivers/bus/acpi/pnp.c b/reactos/drivers/bus/acpi/pnp.c index 4c74e3768c0..95ed06b44ad 100644 --- a/reactos/drivers/bus/acpi/pnp.c +++ b/reactos/drivers/bus/acpi/pnp.c @@ -7,7 +7,7 @@ #include #include -//#define NDEBUG +#define NDEBUG #include NTSTATUS diff --git a/reactos/hal/halx86/generic/acpi/halacpi.c b/reactos/hal/halx86/generic/acpi/halacpi.c index 9cbdd70321a..f0771e201e3 100644 --- a/reactos/hal/halx86/generic/acpi/halacpi.c +++ b/reactos/hal/halx86/generic/acpi/halacpi.c @@ -9,7 +9,7 @@ /* INCLUDES *******************************************************************/ #include -//#define NDEBUG +#define NDEBUG #include /* GLOBALS ********************************************************************/ diff --git a/reactos/hal/halx86/generic/acpi/halpnpdd.c b/reactos/hal/halx86/generic/acpi/halpnpdd.c index 5daf2c77b44..1d6b86095e2 100644 --- a/reactos/hal/halx86/generic/acpi/halpnpdd.c +++ b/reactos/hal/halx86/generic/acpi/halpnpdd.c @@ -9,7 +9,7 @@ /* INCLUDES *******************************************************************/ #include -//#define NDEBUG +#define NDEBUG #include typedef enum _EXTENSION_TYPE @@ -563,6 +563,10 @@ HalpQueryIdFdo(IN PDEVICE_OBJECT DeviceObject, switch (IdType) { case BusQueryDeviceID: + /* HACK */ + Id = L"Root\\ACPI_HAL"; + break; + case BusQueryHardwareIDs: /* This is our hardware ID */ @@ -609,21 +613,6 @@ HalpQueryIdFdo(IN PDEVICE_OBJECT DeviceObject, return Status; } -NTSTATUS -NTAPI -HalpPassIrpFromFdoToPdo(IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp) -{ - PFDO_EXTENSION FdoExtension; - - /* Get the extension */ - FdoExtension = DeviceObject->DeviceExtension; - - /* Pass it to the attached device (our PDO) */ - IoSkipCurrentIrpStackLocation(Irp); - return IoCallDriver(FdoExtension->AttachedDeviceObject, Irp); -} - NTSTATUS NTAPI HalpDispatchPnp(IN PDEVICE_OBJECT DeviceObject, @@ -682,22 +671,11 @@ HalpDispatchPnp(IN PDEVICE_OBJECT DeviceObject, /* Pass it to the PDO */ DPRINT("Other IRP: %lx\n", Minor); - return HalpPassIrpFromFdoToPdo(DeviceObject, Irp); + Status = Irp->IoStatus.Status; + break; } - - /* What happpened? */ - if ((NT_SUCCESS(Status)) || (Status == STATUS_NOT_SUPPORTED)) - { - /* Set the IRP status, unless this isn't understood */ - if (Status != STATUS_NOT_SUPPORTED) Irp->IoStatus.Status = Status; - - /* Pass it on */ - DPRINT("Passing IRP to PDO\n"); - return HalpPassIrpFromFdoToPdo(DeviceObject, Irp); - } - - /* Otherwise, we failed, so set the status and complete the request */ - DPRINT1("IRP failed with status: %lx\n", Status); + + /* Nowhere for the IRP to go since we also own the PDO */ Irp->IoStatus.Status = Status; IoCompleteRequest(Irp, IO_NO_INCREMENT); return Status; @@ -834,20 +812,42 @@ HalpDriverEntry(IN PDRIVER_OBJECT DriverObject, { NTSTATUS Status; PDEVICE_OBJECT TargetDevice = NULL; + DPRINT("HAL: PnP Driver ENTRY!\n"); /* This is us */ HalpDriverObject = DriverObject; - + /* Set up add device */ DriverObject->DriverExtension->AddDevice = HalpAddDevice; - + /* Set up the callouts */ DriverObject->MajorFunction[IRP_MJ_PNP] = HalpDispatchPnp; DriverObject->MajorFunction[IRP_MJ_POWER] = HalpDispatchPower; DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = HalpDispatchWmi; - - /* Tell the PnP about us */ + + /* Create the PDO */ + Status = IoCreateDevice(DriverObject, + 0, + NULL, + FILE_DEVICE_CONTROLLER, + 0, + FALSE, + &TargetDevice); + if (!NT_SUCCESS(Status)) + return Status; + + TargetDevice->Flags &= ~DO_DEVICE_INITIALIZING; + + /* Set up the device stack */ + Status = HalpAddDevice(DriverObject, TargetDevice); + if (!NT_SUCCESS(Status)) + { + IoDeleteDevice(TargetDevice); + return Status; + } + + /* Tell the PnP manager about us */ Status = IoReportDetectedDevice(DriverObject, InterfaceTypeUndefined, -1, @@ -857,9 +857,6 @@ HalpDriverEntry(IN PDRIVER_OBJECT DriverObject, FALSE, &TargetDevice); - /* Now add us */ - if (NT_SUCCESS(Status)) Status = HalpAddDevice(DriverObject, TargetDevice); - /* Return to kernel */ return Status; }