/* PRIVATE FUNCTIONS **********************************************************/
+VOID
+NTAPI
+HalpReportDetectedDevices(IN PDRIVER_OBJECT DriverObject,
+ IN PVOID Context,
+ IN ULONG Count)
+{
+ PFDO_EXTENSION FdoExtension = Context;
+ PPDO_EXTENSION PdoExtension;
+ PDEVICE_OBJECT PdoDeviceObject;
+ NTSTATUS Status;
+
+ /* Create the PDO */
+ Status = IoCreateDevice(DriverObject,
+ sizeof(PDO_EXTENSION),
+ NULL,
+ FILE_DEVICE_BUS_EXTENDER,
+ FILE_AUTOGENERATED_DEVICE_NAME,
+ FALSE,
+ &PdoDeviceObject);
+ if (!NT_SUCCESS(Status))
+ {
+ /* Fail */
+ DPRINT1("HAL: Could not create ACPI device object status=0x%08x\n", Status);
+ return;
+ }
+
+ /* Setup the PDO device extension */
+ PdoExtension = PdoDeviceObject->DeviceExtension;
+ PdoExtension->ExtensionType = PdoExtensionType;
+ PdoExtension->PhysicalDeviceObject = PdoDeviceObject;
+ PdoExtension->ParentFdoExtension = FdoExtension;
+ PdoExtension->PdoType = AcpiPdo;
+
+ /* Add the PDO to the head of the list */
+ PdoExtension->Next = FdoExtension->ChildPdoList;
+ FdoExtension->ChildPdoList = PdoExtension;
+
+ /* Initialization is finished */
+ PdoDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
+
+ /* Invalidate device relations since we added a new device */
+ IoSynchronousInvalidateDeviceRelations(FdoExtension->PhysicalDeviceObject, BusRelations);
+}
+
NTSTATUS
NTAPI
HalpAddDevice(IN PDRIVER_OBJECT DriverObject,
{
NTSTATUS Status;
PFDO_EXTENSION FdoExtension;
- PPDO_EXTENSION PdoExtension;
- PDEVICE_OBJECT DeviceObject, PdoDeviceObject, AttachedDevice;
+ PDEVICE_OBJECT DeviceObject, AttachedDevice;
// PDESCRIPTION_HEADER Wdrt;
+
DPRINT("HAL: PnP Driver ADD!\n");
/* Create the FDO */
/* Save the attachment */
FdoExtension->AttachedDeviceObject = AttachedDevice;
- /* Create the PDO */
- Status = IoCreateDevice(DriverObject,
- sizeof(PDO_EXTENSION),
- NULL,
- FILE_DEVICE_BUS_EXTENDER,
- FILE_AUTOGENERATED_DEVICE_NAME,
- FALSE,
- &PdoDeviceObject);
- if (!NT_SUCCESS(Status))
- {
- /* Fail */
- DPRINT1("HAL: Could not create ACPI device object status=0x%08x\n", Status);
- return Status;
- }
-
- /* Setup the PDO device extension */
- PdoExtension = PdoDeviceObject->DeviceExtension;
- PdoExtension->ExtensionType = PdoExtensionType;
- PdoExtension->PhysicalDeviceObject = PdoDeviceObject;
- PdoExtension->ParentFdoExtension = FdoExtension;
- PdoExtension->PdoType = AcpiPdo;
-
- /* Add the PDO to the head of the list */
- PdoExtension->Next = FdoExtension->ChildPdoList;
- FdoExtension->ChildPdoList = PdoExtension;
-
- /* Initialization is finished */
- PdoDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
-
-#if 0
- /* Find the ACPI watchdog table */
- Wdrt = HalAcpiGetTable(0, 'TRDW');
- if (Wdrt)
- {
- /* FIXME: TODO */
- DPRINT1("You have an ACPI Watchdog. That's great! You should be proud ;-)\n");
- }
-#endif
-
- /* Invalidate device relations since we added a new device */
- IoInvalidateDeviceRelations(TargetDevice, BusRelations);
+ /* Register for reinitialization to report devices later */
+ IoRegisterBootDriverReinitialization(DriverObject,
+ HalpReportDetectedDevices,
+ FdoExtension);
/* Return status */
DPRINT("Device added %lx\n", Status);
OUT PULONG Length)
{
UNIMPLEMENTED;
- while (TRUE);
- return STATUS_NO_SUCH_DEVICE;
+ return STATUS_NOT_SUPPORTED;
}
NTSTATUS
{
/* Save our own PDO and reference it */
*ObjectEntry++ = PdoExtension->PhysicalDeviceObject;
- ObfReferenceObject(PdoExtension->PhysicalDeviceObject);
+ ObReferenceObject(PdoExtension->PhysicalDeviceObject);
/* Go to our next PDO */
PdoExtension = PdoExtension->Next;
/* Fill it out and reference us */
PdoRelations->Count = 1;
PdoRelations->Objects[0] = DeviceObject;
- ObfReferenceObject(DeviceObject);
+ ObReferenceObject(DeviceObject);
/* Return it */
*DeviceRelations = PdoRelations;
ResourceList->Count = 1;
/* Setup the list fields */
- ResourceList->List[0].BusNumber = -1;
- ResourceList->List[0].InterfaceType = PNPBus;
+ ResourceList->List[0].BusNumber = 0;
+ ResourceList->List[0].InterfaceType = PCIBus;
ResourceList->List[0].PartialResourceList.Version = 1;
ResourceList->List[0].PartialResourceList.Revision = 1;
ResourceList->List[0].PartialResourceList.Count = 0;