Commit in reactos/drivers/bus/acpi on MAIN
.cvsignore+3-21.5 -> 1.6
ospm/acpienum.c+128-1691.4 -> 1.5
    /acpisys.c+10-41.6 -> 1.7
    /fdo.c+194-861.3 -> 1.4
    /osl.c+1-11.9 -> 1.10
    /pdo.c+67-41.2 -> 1.3
ospm/include/acpisys.h+9-81.7 -> 1.8
+412-274
7 modified files
Enumerate all devices on the 'ACPI bus'.

reactos/drivers/bus/acpi
.cvsignore 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- .cvsignore	29 Jul 2003 00:27:40 -0000	1.5
+++ .cvsignore	27 Dec 2004 14:24:00 -0000	1.6
@@ -1,8 +1,9 @@
-acpi.coff
-objects
+*.a
 *.d
 *.o
 *.sym
 *.sys
 *.map
 *.tmp
+acpi.coff
+objects

reactos/drivers/bus/acpi/ospm
acpienum.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- acpienum.c	14 Nov 2003 17:13:23 -0000	1.4
+++ acpienum.c	27 Dec 2004 14:24:00 -0000	1.5
@@ -1,4 +1,4 @@
-/* $Id: acpienum.c,v 1.4 2003/11/14 17:13:23 weiden Exp $
+/* $Id: acpienum.c,v 1.5 2004/12/27 14:24:00 ekohl Exp $
  *
  * PROJECT:         ReactOS ACPI bus driver
  * FILE:            acpi/ospm/acpienum.c
@@ -14,216 +14,175 @@
 #include <debug.h>
 
 
-void
+#ifndef NDEBUG
+static void
 bm_print1 (
-	BM_NODE			*node,
-	u32                     flags)
+  BM_NODE *node,
+  u32     flags)
 {
-	ACPI_BUFFER             buffer;
-	BM_DEVICE		*device = NULL;
-	char                    *type_string = NULL;
-
-	if (!node) {
-		return;
-	}
-
-	device = &(node->device);
-
-	if (flags & BM_PRINT_PRESENT) {
-		if (!BM_DEVICE_PRESENT(device)) {
-			return;
-		}
-	}
-
-	buffer.length = 256;
-	buffer.pointer = acpi_os_callocate(buffer.length);
-	if (!buffer.pointer) {
-		return;
-	}
-
-	acpi_get_name(device->acpi_handle, ACPI_FULL_PATHNAME, &buffer);
-
-	switch(device->id.type) {
-	case BM_TYPE_SYSTEM:
-		type_string = "System";
-		break;
-	case BM_TYPE_SCOPE:
-		type_string = "Scope";
-		break;
-	case BM_TYPE_PROCESSOR:
-		type_string = "Processor";
-		break;
-	case BM_TYPE_THERMAL_ZONE:
-		type_string = "ThermalZone";
-		break;
-	case BM_TYPE_POWER_RESOURCE:
-		type_string = "PowerResource";
-		break;
-	case BM_TYPE_FIXED_BUTTON:
-		type_string = "Button";
-		break;
-	case BM_TYPE_DEVICE:
-		type_string = "Device";
-		break;
-	default:
-		type_string = "Unknown";
-		break;
-	}
-
-	if (!(flags & BM_PRINT_GROUP)) {
-		DbgPrint("+------------------------------------------------------------\n");
-	}
-
-		DbgPrint("%s[0x%02x] hid[%s] %s\n", type_string, device->handle, device->id.hid, buffer.pointer);
-		DbgPrint("  acpi_handle[0x%08x] flags[0x%02x] status[0x%02x]\n", device->acpi_handle, device->flags, device->status);
-
-	if (flags & BM_PRINT_IDENTIFICATION) {
-		DbgPrint("  identification: uid[%s] adr[0x%08x]\n", device->id.uid, device->id.adr);
-	}
-
-	if (flags & BM_PRINT_LINKAGE) {
-		DbgPrint("  linkage: this[%p] parent[%p] next[%p]\n", node, node->parent, node->next);
-		DbgPrint("    scope.head[%p] scope.tail[%p]\n", node->scope.head, node->scope.tail);
-	}
-
-	if (flags & BM_PRINT_POWER) {
-		DbgPrint("  power: state[D%d] flags[0x%08X]\n", device->power.state, device->power.flags);
-		DbgPrint("    S0[0x%02x] S1[0x%02x] S2[0x%02x]\n", device->power.dx_supported[0], device->power.dx_supported[1], device->power.dx_supported[2]);
-		DbgPrint("    S3[0x%02x] S4[0x%02x] S5[0x%02x]\n", device->power.dx_supported[3], device->power.dx_supported[4], device->power.dx_supported[5]);
-	}
-
-	if (!(flags & BM_PRINT_GROUP)) {
-		DbgPrint("+------------------------------------------------------------\n");
-	}
-
-	acpi_os_free(buffer.pointer);
-
-	return;
-}
+  ACPI_BUFFER buffer;
+  BM_DEVICE *device = NULL;
+  char *type_string = NULL;
+
+  if (!node)
+  {
+    return;
+  }
 
+  device = &(node->device);
 
-NTSTATUS
-ACPIEnumerateRootBusses(
-  PFDO_DEVICE_EXTENSION DeviceExtension)
-{
-  BM_HANDLE_LIST HandleList;
-  PACPI_DEVICE AcpiDevice;
-  ACPI_STATUS AcpiStatus;
-	BM_DEVICE_ID Criteria;
-  KIRQL OldIrql;
-  ULONG i;
-
-  BM_NODE *Node;
-  ULONG j;
+  if (flags & BM_PRINT_PRESENT)
+  {
+    if (!BM_DEVICE_PRESENT(device))
+    {
+      return;
+    }
+  }
 
-  DPRINT("Called\n");
+  buffer.length = 256;
+  buffer.pointer = acpi_os_callocate(buffer.length);
+  if (!buffer.pointer)
+  {
+    return;
+  }
 
-  RtlZeroMemory(&Criteria, sizeof(BM_DEVICE_ID));
-  RtlMoveMemory(&Criteria.hid, PCI_ROOT_HID_STRING, sizeof(PCI_ROOT_HID_STRING));
+  acpi_get_name(device->acpi_handle, ACPI_FULL_PATHNAME, &buffer);
 
-  AcpiStatus = bm_search(BM_HANDLE_ROOT, &Criteria, &HandleList);
+  switch(device->id.type)
+  {
+    case BM_TYPE_SYSTEM:
+      type_string = "System";
+      break;
+
+    case BM_TYPE_SCOPE:
+      type_string = "Scope";
+      break;
+
+    case BM_TYPE_PROCESSOR:
+      type_string = "Processor";
+      break;
+
+    case BM_TYPE_THERMAL_ZONE:
+      type_string = "ThermalZone";
+      break;
+
+    case BM_TYPE_POWER_RESOURCE:
+      type_string = "PowerResource";
+      break;
+
+    case BM_TYPE_FIXED_BUTTON:
+      type_string = "Button";
+      break;
+
+    case BM_TYPE_DEVICE:
+      type_string = "Device";
+      break;
+
+    default:
+      type_string = "Unknown";
+      break;
+  }
 
-  if (ACPI_SUCCESS(AcpiStatus)) {
-    DPRINT("Got %d devices\n", HandleList.count);
+  if (!(flags & BM_PRINT_GROUP))
+  {
+    DbgPrint("+------------------------------------------------------------\n");
+  }
 
-    for (i = 0; i < HandleList.count; i++) {
-      AcpiStatus = bm_get_node(HandleList.handles[i], 0, &Node);
-      if (ACPI_SUCCESS(AcpiStatus)) {
-        DPRINT("Got BM node information: (Node 0x%X)\n", Node);
-        bm_print1(Node, BM_PRINT_ALL - BM_PRINT_PRESENT);
-#if 1
-        for (j=0; j < 4*1000;j++)
-          KeStallExecutionProcessor(1000);
-#endif
-      } else {
-        DPRINT("Could not get BM node\n");
-      }
+  DbgPrint("%s[0x%02x] hid[%s] %s\n", type_string, device->handle, device->id.hid, buffer.pointer);
+  DbgPrint("  acpi_handle[0x%08x] flags[0x%02x] status[0x%02x]\n", device->acpi_handle, device->flags, device->status);
 
-      AcpiDevice = (PACPI_DEVICE)ExAllocatePool(
-          NonPagedPool, sizeof(ACPI_DEVICE));
-      if (!AcpiDevice) {
-        return STATUS_INSUFFICIENT_RESOURCES;
-      }
+  if (flags & BM_PRINT_IDENTIFICATION)
+  {
+    DbgPrint("  identification: uid[%s] adr[0x%08x]\n", device->id.uid, device->id.adr);
+  }
 
-      RtlZeroMemory(AcpiDevice, sizeof(ACPI_DEVICE));
+  if (flags & BM_PRINT_LINKAGE)
+  {
+    DbgPrint("  linkage: this[%p] parent[%p] next[%p]\n", node, node->parent, node->next);
+    DbgPrint("    scope.head[%p] scope.tail[%p]\n", node->scope.head, node->scope.tail);
+  }
 
-      AcpiDevice->Pdo = NULL;
-      AcpiDevice->BmHandle = HandleList.handles[i];
+  if (flags & BM_PRINT_POWER)
+  {
+    DbgPrint("  power: state[D%d] flags[0x%08X]\n", device->power.state, device->power.flags);
+    DbgPrint("    S0[0x%02x] S1[0x%02x] S2[0x%02x]\n", device->power.dx_supported[0], device->power.dx_supported[1], device->power.dx_supported[2]);
+    DbgPrint("    S3[0x%02x] S4[0x%02x] S5[0x%02x]\n", device->power.dx_supported[3], device->power.dx_supported[4], device->power.dx_supported[5]);
+  }
 
-      KeAcquireSpinLock(&DeviceExtension->DeviceListLock, &OldIrql);
-      InsertHeadList(&DeviceExtension->DeviceListHead,
-        &AcpiDevice->DeviceListEntry);
-      DeviceExtension->DeviceListCount++;
-      KeReleaseSpinLock(&DeviceExtension->DeviceListLock, OldIrql);
-    }
-  } else {
-    DPRINT("Got no devices (Status 0x%X)\n", AcpiStatus);
+  if (!(flags & BM_PRINT_GROUP))
+  {
+    DbgPrint("+------------------------------------------------------------\n");
   }
-        for (j=0; j < 4*10*1000;j++)
-          KeStallExecutionProcessor(1000);
 
-  return STATUS_SUCCESS;
+  acpi_os_free(buffer.pointer);
+
+  return;
 }
+#endif
 
 
 NTSTATUS
-ACPIEnumerateNamespace(
-  PFDO_DEVICE_EXTENSION DeviceExtension)
+ACPIEnumerateDevices(PFDO_DEVICE_EXTENSION DeviceExtension)
 {
   BM_HANDLE_LIST HandleList;
   PACPI_DEVICE AcpiDevice;
   ACPI_STATUS AcpiStatus;
-	BM_DEVICE_ID Criteria;
+  BM_DEVICE_ID Criteria;
   BM_NODE *Node;
   KIRQL OldIrql;
   ULONG i;
 
   DPRINT("Called\n");
 
-	RtlZeroMemory(&Criteria, sizeof(BM_DEVICE_ID));
-
-  DbgPrint("Listing ACPI namespace\n");
+  RtlZeroMemory(&Criteria, sizeof(BM_DEVICE_ID));
   Criteria.type = BM_TYPE_ALL;
 
   AcpiStatus = bm_search(BM_HANDLE_ROOT, &Criteria, &HandleList);
-  if (ACPI_SUCCESS(AcpiStatus)) {
+  if (ACPI_SUCCESS(AcpiStatus))
+  {
     DPRINT("Got %d devices\n", HandleList.count);
 
-    for (i = 0; i < HandleList.count; i++) {
+    for (i = 0; i < HandleList.count; i++)
+    {
       AcpiStatus = bm_get_node(HandleList.handles[i], 0, &Node);
-      if (ACPI_SUCCESS(AcpiStatus)) {
+      if (ACPI_SUCCESS(AcpiStatus))
+      {
         DPRINT("Got BM node information: (Node 0x%X)\n", Node);
-#if 0
-        {
-          ULONG j;
 
+        if ((Node->device.flags & BM_FLAGS_IDENTIFIABLE) &&
+            (Node->device.id.hid[0] != 0))
+        {
+#ifndef NDEBUG
           bm_print1(Node, BM_PRINT_ALL - BM_PRINT_PRESENT);
-          for (j=0; j < 4*1000;j++)
-            KeStallExecutionProcessor(1000);
-        }
 #endif
-      } else {
-        DPRINT("Could not get BM node\n");
-      }
 
-      AcpiDevice = (PACPI_DEVICE)ExAllocatePool(
-          NonPagedPool, sizeof(ACPI_DEVICE));
-      if (!AcpiDevice) {
-        return STATUS_INSUFFICIENT_RESOURCES;
+          AcpiDevice = (PACPI_DEVICE)ExAllocatePool(NonPagedPool,
+                                                    sizeof(ACPI_DEVICE));
+          if (AcpiDevice == NULL)
+          {
+            return STATUS_INSUFFICIENT_RESOURCES;
+          }
+
+          RtlZeroMemory(AcpiDevice, sizeof(ACPI_DEVICE));
+
+          AcpiDevice->Pdo = NULL;
+          AcpiDevice->BmHandle = HandleList.handles[i];
+
+          KeAcquireSpinLock(&DeviceExtension->DeviceListLock, &OldIrql);
+          InsertHeadList(&DeviceExtension->DeviceListHead,
+                         &AcpiDevice->DeviceListEntry);
+          DeviceExtension->DeviceListCount++;
+          KeReleaseSpinLock(&DeviceExtension->DeviceListLock, OldIrql);
+        }
+      }
+      else
+      {
+        DPRINT("Could not get BM node\n");
       }
-
-      RtlZeroMemory(AcpiDevice, sizeof(ACPI_DEVICE));
-
-      AcpiDevice->Pdo = NULL;
-      AcpiDevice->BmHandle = HandleList.handles[i];
-
-      KeAcquireSpinLock(&DeviceExtension->DeviceListLock, &OldIrql);
-      InsertHeadList(&DeviceExtension->DeviceListHead,
-        &AcpiDevice->DeviceListEntry);
-      DeviceExtension->DeviceListCount++;
-      KeReleaseSpinLock(&DeviceExtension->DeviceListLock, OldIrql);
     }
-  } else {
+  }
+  else
+  {
     DPRINT("Got no devices (Status 0x%X)\n", AcpiStatus);
   }
 

reactos/drivers/bus/acpi/ospm
acpisys.c 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- acpisys.c	25 Dec 2004 00:44:49 -0000	1.6
+++ acpisys.c	27 Dec 2004 14:24:00 -0000	1.7
@@ -1,4 +1,4 @@
-/* $Id: acpisys.c,v 1.6 2004/12/25 00:44:49 greatlrd Exp $
+/* $Id: acpisys.c,v 1.7 2004/12/27 14:24:00 ekohl Exp $
  *
  * PROJECT:         ReactOS ACPI bus driver
  * FILE:            acpi/ospm/acpisys.c
@@ -125,9 +125,15 @@
 
   DPRINT("Called\n");
 
-  Status = IoCreateDevice(DriverObject, sizeof(FDO_DEVICE_EXTENSION),
-    NULL, FILE_DEVICE_ACPI, FILE_DEVICE_SECURE_OPEN, TRUE, &Fdo);
-  if (!NT_SUCCESS(Status)) {
+  Status = IoCreateDevice(DriverObject,
+                          sizeof(FDO_DEVICE_EXTENSION),
+                          NULL,
+                          FILE_DEVICE_ACPI,
+                          FILE_DEVICE_SECURE_OPEN,
+                          TRUE,
+                          &Fdo);
+  if (!NT_SUCCESS(Status))
+  {
     DPRINT("IoCreateDevice() failed with status 0x%X\n", Status);
     return Status;
   }

reactos/drivers/bus/acpi/ospm
fdo.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- fdo.c	14 Nov 2003 17:13:23 -0000	1.3
+++ fdo.c	27 Dec 2004 14:24:00 -0000	1.4
@@ -1,4 +1,4 @@
-/* $Id: fdo.c,v 1.3 2003/11/14 17:13:23 weiden Exp $
+/* $Id: fdo.c,v 1.4 2004/12/27 14:24:00 ekohl Exp $
  *
  * PROJECT:         ReactOS ACPI bus driver
  * FILE:            acpi/ospm/fdo.c
@@ -14,11 +14,106 @@
 #define NDEBUG
 #include <debug.h>
 
+FADT_DESCRIPTOR_REV2 acpi_fadt;
+
 /*** PRIVATE *****************************************************************/
 
-FADT_DESCRIPTOR_REV2	acpi_fadt;
 
-NTSTATUS
+BOOLEAN
+AcpiCreateUnicodeString(
+  PUNICODE_STRING Destination,
+  PWSTR Source,
+  POOL_TYPE PoolType)
+{
+  ULONG Length;
+
+  if (!Source)
+  {
+    RtlInitUnicodeString(Destination, NULL);
+    return TRUE;
+  }
+
+  Length = (wcslen(Source) + 1) * sizeof(WCHAR);
+
+  Destination->Buffer = ExAllocatePool(PoolType, Length);
+  if (Destination->Buffer == NULL)
+  {
+    return FALSE;
+  }
+
+  RtlCopyMemory(Destination->Buffer, Source, Length);
+
+  Destination->MaximumLength = Length;
+
+  Destination->Length = Length - sizeof(WCHAR);
+
+  return TRUE;
+}
+
+BOOLEAN
+AcpiCreateDeviceIDString(PUNICODE_STRING DeviceID,
+                         BM_NODE *Node)
+{
+  WCHAR Buffer[256];
+
+  swprintf(Buffer,
+           L"ACPI\\%S",
+           Node->device.id.hid);
+
+  if (!AcpiCreateUnicodeString(DeviceID, Buffer, PagedPool))
+  {
+    return FALSE;
+  }
+
+  return TRUE;
+}
+
+
+BOOLEAN
+AcpiCreateHardwareIDsString(PUNICODE_STRING HardwareIDs,
+                            BM_NODE *Node)
+{
+  WCHAR Buffer[256];
+  ULONG Length;
+  ULONG Index;
+
+  Index = 0;
+  Index += swprintf(&Buffer[Index],
+                    L"ACPI\\%S",
+                    Node->device.id.hid);
+  Index++;
+
+  Index += swprintf(&Buffer[Index],
+                    L"*%S",
+                    Node->device.id.hid);
+  Index++;
+  Buffer[Index] = UNICODE_NULL;
+
+  Length = (Index + 1) * sizeof(WCHAR);
+  HardwareIDs->Buffer = ExAllocatePool(PagedPool, Length);
+  if (HardwareIDs->Buffer == NULL)
+  {
+    return FALSE;
+  }
+
+  HardwareIDs->Length = Length - sizeof(WCHAR);
+  HardwareIDs->MaximumLength = Length;
+  RtlCopyMemory(HardwareIDs->Buffer, Buffer, Length);
+
+  return TRUE;
+}
+
+
+BOOLEAN
+AcpiCreateInstanceIDString(PUNICODE_STRING InstanceID,
+                           BM_NODE *Node)
+{
+  /* FIXME: Create unique instnce id. */
+  return AcpiCreateUnicodeString(InstanceID, L"0000", PagedPool);
+}
+
+
+static NTSTATUS
 FdoQueryBusRelations(
   IN PDEVICE_OBJECT DeviceObject,
   IN PIRP Irp,
@@ -50,7 +145,8 @@
 
   i = 0;
   CurrentEntry = DeviceExtension->DeviceListHead.Flink;
-  while (CurrentEntry != &DeviceExtension->DeviceListHead) {
+  while (CurrentEntry != &DeviceExtension->DeviceListHead)
+  {
     Device = CONTAINING_RECORD(CurrentEntry, ACPI_DEVICE, DeviceListEntry);
 
     /* FIXME: For ACPI namespace devices on the motherboard create filter DOs
@@ -59,63 +155,75 @@
     /* FIXME: For other devices in ACPI namespace, but not on motherboard,
        create PDOs */
 
-    if (!Device->Pdo) {
+    if (!Device->Pdo)
+    {
       /* Create a physical device object for the
          device as it does not already have one */
-      Status = IoCreateDevice(DeviceObject->DriverObject, 0,
-        NULL, FILE_DEVICE_CONTROLLER, 0, FALSE, &Device->Pdo);
-      if (!NT_SUCCESS(Status)) {
+      Status = IoCreateDevice(DeviceObject->DriverObject,
+                              sizeof(PDO_DEVICE_EXTENSION),
+                              NULL,
+                              FILE_DEVICE_CONTROLLER,
+                              FILE_AUTOGENERATED_DEVICE_NAME,
+                              FALSE,
+                              &Device->Pdo);
+      if (!NT_SUCCESS(Status))
+      {
         DPRINT("IoCreateDevice() failed with status 0x%X\n", Status);
         /* FIXME: Cleanup all new PDOs created in this call */
         ExFreePool(Relations);
         return Status;
       }
 
-      PdoDeviceExtension = ExAllocatePool(
-        NonPagedPool,
-        sizeof(PDO_DEVICE_EXTENSION));
-      if (!PdoDeviceExtension) {
-        /* FIXME: Cleanup all new PDOs created in this call */
-        ExFreePool(Relations);
-      }
-
-      RtlZeroMemory(
-        PdoDeviceExtension,
-        sizeof(PDO_DEVICE_EXTENSION));
+      PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)Device->Pdo->DeviceExtension;
 
-      Device->Pdo->DeviceExtension = PdoDeviceExtension;
+      RtlZeroMemory(PdoDeviceExtension, sizeof(PDO_DEVICE_EXTENSION));
 
       Device->Pdo->Flags |= DO_BUS_ENUMERATED_DEVICE;
 
+      Device->Pdo->Flags &= ~DO_DEVICE_INITIALIZING;
+
+      //Device->Pdo->Flags |= DO_POWER_PAGABLE;
+
       PdoDeviceExtension->Common.DeviceObject = Device->Pdo;
 
       PdoDeviceExtension->Common.DevicePowerState = PowerDeviceD0;
 
-      PdoDeviceExtension->Common.Ldo = IoAttachDeviceToDeviceStack(
-        DeviceObject,
-        Device->Pdo);
+//      PdoDeviceExtension->Common.Ldo = IoAttachDeviceToDeviceStack(DeviceObject,
+//                                                                   Device->Pdo);
 
+      RtlInitUnicodeString(&PdoDeviceExtension->DeviceID, NULL);
+      RtlInitUnicodeString(&PdoDeviceExtension->InstanceID, NULL);
       RtlInitUnicodeString(&PdoDeviceExtension->HardwareIDs, NULL);
-      RtlInitUnicodeString(&PdoDeviceExtension->CompatibleIDs, NULL);
 
       AcpiStatus = bm_get_node(Device->BmHandle, 0, &Node);
-      if (ACPI_SUCCESS(AcpiStatus)) {
-        if (Node->device.flags & BM_FLAGS_HAS_A_HID) {
-          RtlInitAnsiString(&AnsiString, Node->device.id.hid);
-          Status = RtlAnsiStringToUnicodeString(
-            &PdoDeviceExtension->HardwareIDs,
-            &AnsiString,
-            TRUE);
-          assert(NT_SUCCESS(Status));
+      if (ACPI_SUCCESS(AcpiStatus))
+      {
+        /* Add Device ID string */
+        if (!AcpiCreateDeviceIDString(&PdoDeviceExtension->DeviceID,
+                                      Node))
+        {
+          ASSERT(FALSE);
+//          ErrorStatus = STATUS_INSUFFICIENT_RESOURCES;
+//          ErrorOccurred = TRUE;
+//          break;
         }
 
-        if (Node->device.flags & BM_FLAGS_HAS_A_CID) {
-          RtlInitAnsiString(&AnsiString, Node->device.id.cid);
-          Status = RtlAnsiStringToUnicodeString(
-            &PdoDeviceExtension->CompatibleIDs,
-            &AnsiString,
-            TRUE);
-          assert(NT_SUCCESS(Status));
+        if (!AcpiCreateInstanceIDString(&PdoDeviceExtension->InstanceID,
+                                        Node))
+        {
+          ASSERT(FALSE);
+//          ErrorStatus = STATUS_INSUFFICIENT_RESOURCES;
+//          ErrorOccurred = TRUE;
+//          break;
+        }
+
+        if (!AcpiCreateHardwareIDsString(&PdoDeviceExtension->HardwareIDs,
+                                         Node))
+        {
+          ASSERT(FALSE);
+//          ErrorStatus = STATUS_INSUFFICIENT_RESOURCES;
+//          ErrorOccurred = TRUE;
+//          break;
         }
       }
     }
@@ -137,26 +245,28 @@
 }
 
 
-VOID ACPIPrintInfo(
-	PFDO_DEVICE_EXTENSION DeviceExtension)
+static VOID
+ACPIPrintInfo(
+  PFDO_DEVICE_EXTENSION DeviceExtension)
 {
   DbgPrint("ACPI: System firmware supports:\n");
 
-	/*
-	 * Print out basic system information
-	 */
-	DbgPrint("+------------------------------------------------------------\n");
-	DbgPrint("| Sx states: %cS0 %cS1 %cS2 %cS3 %cS4 %cS5\n",
-    (DeviceExtension->SystemStates[0]?'+':'-'),
-    (DeviceExtension->SystemStates[1]?'+':'-'),
-    (DeviceExtension->SystemStates[2]?'+':'-'),
-    (DeviceExtension->SystemStates[3]?'+':'-'),
-    (DeviceExtension->SystemStates[4]?'+':'-'),
-    (DeviceExtension->SystemStates[5]?'+':'-'));
-	DbgPrint("+------------------------------------------------------------\n");
+  /*
+   * Print out basic system information
+   */
+  DbgPrint("+------------------------------------------------------------\n");
+  DbgPrint("| Sx states: %cS0 %cS1 %cS2 %cS3 %cS4 %cS5\n",
+           (DeviceExtension->SystemStates[0]?'+':'-'),
+           (DeviceExtension->SystemStates[1]?'+':'-'),
+           (DeviceExtension->SystemStates[2]?'+':'-'),
+           (DeviceExtension->SystemStates[3]?'+':'-'),
+           (DeviceExtension->SystemStates[4]?'+':'-'),
+           (DeviceExtension->SystemStates[5]?'+':'-'));
+  DbgPrint("+------------------------------------------------------------\n");
 }
 
-NTSTATUS
+
+static NTSTATUS
 ACPIInitializeInternalDriver(
   PFDO_DEVICE_EXTENSION DeviceExtension,
   ACPI_DRIVER_FUNCTION Initialize,
@@ -191,7 +301,7 @@
 }
 
 
-NTSTATUS
+static NTSTATUS
 ACPIInitializeInternalDrivers(
   PFDO_DEVICE_EXTENSION DeviceExtension)
 {
@@ -204,7 +314,7 @@
 }
 
 
-NTSTATUS
+static NTSTATUS
 FdoStartDevice(
   IN PDEVICE_OBJECT DeviceObject,
   IN PIRP Irp)
@@ -221,7 +331,7 @@
 
   DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
 
-  assert(DeviceExtension->State == dsStopped);
+  ASSERT(DeviceExtension->State == dsStopped);
 
   AcpiStatus = acpi_initialize_subsystem();
   if (!ACPI_SUCCESS(AcpiStatus)) {
@@ -233,30 +343,30 @@
   if (!ACPI_SUCCESS(AcpiStatus)) {
     DPRINT("acpi_find_root_pointer() failed with status 0x%X\n", AcpiStatus);
     return STATUS_UNSUCCESSFUL;
-	}
+  }
 
   /* From this point on, on error we must call acpi_terminate() */
 
   AcpiStatus = acpi_load_tables(rsdp);
-	if (!ACPI_SUCCESS(AcpiStatus)) {
-		DPRINT("acpi_load_tables() failed with status 0x%X\n", AcpiStatus);
-		acpi_terminate();
-		return STATUS_UNSUCCESSFUL;
-	}
+  if (!ACPI_SUCCESS(AcpiStatus)) {
+    DPRINT("acpi_load_tables() failed with status 0x%X\n", AcpiStatus);
+    acpi_terminate();
+    return STATUS_UNSUCCESSFUL;
+  }
 
-	Buffer.length  = sizeof(SysInfo);
-	Buffer.pointer = &SysInfo;
+  Buffer.length  = sizeof(SysInfo);
+  Buffer.pointer = &SysInfo;
 
   AcpiStatus = acpi_get_system_info(&Buffer);
-	if (!ACPI_SUCCESS(AcpiStatus)) {
-		DPRINT("acpi_get_system_info() failed with status 0x%X\n", AcpiStatus);
-		acpi_terminate();
-		return STATUS_UNSUCCESSFUL;
-	}
+  if (!ACPI_SUCCESS(AcpiStatus)) {
+    DPRINT("acpi_get_system_info() failed with status 0x%X\n", AcpiStatus);
+    acpi_terminate();
+    return STATUS_UNSUCCESSFUL;
+  }
 
-	DPRINT("ACPI CA Core Subsystem version 0x%X\n", SysInfo.acpi_ca_version);
+  DPRINT("ACPI CA Core Subsystem version 0x%X\n", SysInfo.acpi_ca_version);
 
-  assert(SysInfo.num_table_types > ACPI_TABLE_FADT);
+  ASSERT(SysInfo.num_table_types > ACPI_TABLE_FADT);
 
   RtlMoveMemory(&acpi_fadt,
     &SysInfo.table_info[ACPI_TABLE_FADT],
@@ -272,21 +382,21 @@
   DPRINT("ACPI CA Core Subsystem enabled\n");
 
   /*
-	 * Sx States:
-	 * ----------
-	 * Figure out which Sx states are supported
-	 */
-	for (i=0; i<=ACPI_S_STATES_MAX; i++) {
-		AcpiStatus = acpi_hw_obtain_sleep_type_register_data(
+   * Sx States:
+   * ----------
+   * Figure out which Sx states are supported
+   */
+  for (i=0; i<=ACPI_S_STATES_MAX; i++) {
+    AcpiStatus = acpi_hw_obtain_sleep_type_register_data(
 			i,
 			&TypeA,
 			&TypeB);
     DPRINT("acpi_hw_obtain_sleep_type_register_data (%d) status 0x%X\n",
       i, AcpiStatus);
     if (ACPI_SUCCESS(AcpiStatus)) {
-			DeviceExtension->SystemStates[i] = TRUE;
-		}
-	}
+      DeviceExtension->SystemStates[i] = TRUE;
+    }
+  }
 
   ACPIPrintInfo(DeviceExtension);
 
@@ -302,19 +412,17 @@
   KeInitializeSpinLock(&DeviceExtension->DeviceListLock);
   DeviceExtension->DeviceListCount = 0;
 
-  ACPIEnumerateNamespace(DeviceExtension);
-
-  //ACPIEnumerateRootBusses(DeviceExtension);
+  ACPIEnumerateDevices(DeviceExtension);
 
   ACPIInitializeInternalDrivers(DeviceExtension);
 
   DeviceExtension->State = dsStarted;
 
-	return STATUS_SUCCESS;
+  return STATUS_SUCCESS;
 }
 
 
-NTSTATUS
+static NTSTATUS
 FdoSetPower(
   IN PDEVICE_OBJECT DeviceObject,
   IN PIRP Irp,

reactos/drivers/bus/acpi/ospm
osl.c 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- osl.c	25 Dec 2004 00:44:49 -0000	1.9
+++ osl.c	27 Dec 2004 14:24:00 -0000	1.10
@@ -232,7 +232,7 @@
     Affinity,
     FALSE);
   if (!NT_SUCCESS(Status)) {
-	  DPRINT("Could not connect to interrupt %d\n", Vector);
+    DPRINT("Could not connect to interrupt %d\n", Vector);
     return AE_ERROR;
   }
 

reactos/drivers/bus/acpi/ospm
pdo.c 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- pdo.c	14 Nov 2003 17:13:23 -0000	1.2
+++ pdo.c	27 Dec 2004 14:24:00 -0000	1.3
@@ -1,4 +1,4 @@
-/* $Id: pdo.c,v 1.2 2003/11/14 17:13:23 weiden Exp $
+/* $Id: pdo.c,v 1.3 2004/12/27 14:24:00 ekohl Exp $
  *
  * PROJECT:         ReactOS ACPI bus driver
  * FILE:            acpi/ospm/pdo.c
@@ -16,30 +16,90 @@
 
 /*** PRIVATE *****************************************************************/
 
-NTSTATUS
+static NTSTATUS
+AcpiDuplicateUnicodeString(
+  PUNICODE_STRING Destination,
+  PUNICODE_STRING Source,
+  POOL_TYPE PoolType)
+{
+  if (Source == NULL)
+  {
+    RtlInitUnicodeString(Destination, NULL);
+    return STATUS_SUCCESS;
+  }
+
+  Destination->Buffer = ExAllocatePool(PoolType, Source->MaximumLength);
+  if (Destination->Buffer == NULL)
+  {
+    return STATUS_INSUFFICIENT_RESOURCES;
+  }
+
+  Destination->MaximumLength = Source->MaximumLength;
+  Destination->Length = Source->Length;
+  RtlCopyMemory(Destination->Buffer, Source->Buffer, Source->MaximumLength);
+
+  return STATUS_SUCCESS;
+}
+
+
+static NTSTATUS
 PdoQueryId(
   IN PDEVICE_OBJECT DeviceObject,
   IN PIRP Irp,
   PIO_STACK_LOCATION IrpSp)
 {
   PPDO_DEVICE_EXTENSION DeviceExtension;
+  UNICODE_STRING String;
   NTSTATUS Status;
 
   DPRINT("Called\n");
 
   DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
 
+  RtlInitUnicodeString(&String, NULL);
+
 //  Irp->IoStatus.Information = 0;
 
-  switch (IrpSp->Parameters.QueryId.IdType) {
+  switch (IrpSp->Parameters.QueryId.IdType)
+  {
     case BusQueryDeviceID:
+      DPRINT("BusQueryDeviceID\n");
+      Status = AcpiDuplicateUnicodeString(&String,
+                                          &DeviceExtension->DeviceID,
+                                          PagedPool);
+      DPRINT("DeviceID: %S\n", String.Buffer);
+      Irp->IoStatus.Information = (ULONG_PTR)String.Buffer;
       break;
 
     case BusQueryHardwareIDs:
+      DPRINT("BusQueryHardwareIDs\n");
+      Status = AcpiDuplicateUnicodeString(&String,
+                                          &DeviceExtension->HardwareIDs,
+                                          PagedPool);
+      Irp->IoStatus.Information = (ULONG_PTR)String.Buffer;
+      break;
+
     case BusQueryCompatibleIDs:
+      DPRINT("BusQueryCompatibleIDs\n");
+      Status = STATUS_NOT_IMPLEMENTED;
+      break;
+
     case BusQueryInstanceID:
+      DPRINT("BusQueryInstanceID\n");
+      Status = AcpiDuplicateUnicodeString(&String,
+                                          &DeviceExtension->InstanceID,
+                                          PagedPool);
+      DPRINT("InstanceID: %S\n", String.Buffer);
+      Irp->IoStatus.Information = (ULONG_PTR)String.Buffer;
+      break;
+
     case BusQueryDeviceSerialNumber:
+      DPRINT("BusQueryDeviceSerialNumber\n");
+      Status = STATUS_NOT_IMPLEMENTED;
+      break;
+
     default:
+      DPRINT("Unknown id type: %lx\n", IrpSp->Parameters.QueryId.IdType);
       Status = STATUS_NOT_IMPLEMENTED;
   }
 
@@ -47,7 +107,7 @@
 }
 
 
-NTSTATUS
+static NTSTATUS
 PdoSetPower(
   IN PDEVICE_OBJECT DeviceObject,
   IN PIRP Irp,
@@ -126,6 +186,9 @@
     break;
 
   case IRP_MN_QUERY_ID:
+    Status = PdoQueryId(DeviceObject,
+                        Irp,
+                        IrpSp);
     break;
 
   case IRP_MN_QUERY_PNP_DEVICE_STATE:

reactos/drivers/bus/acpi/ospm/include
acpisys.h 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- acpisys.h	10 Nov 2002 19:24:01 -0000	1.7
+++ acpisys.h	27 Dec 2004 14:24:00 -0000	1.8
@@ -11,7 +11,8 @@
 typedef ACPI_STATUS (*ACPI_DRIVER_FUNCTION)(VOID);
 
 
-typedef enum {
+typedef enum
+{
   dsStopped,
   dsStarted,
   dsPaused,
@@ -34,17 +35,21 @@
   PDEVICE_OBJECT Ldo;
 } COMMON_DEVICE_EXTENSION, *PCOMMON_DEVICE_EXTENSION;
 
+
 /* Physical Device Object device extension for a child device */
 typedef struct _PDO_DEVICE_EXTENSION
 {
   // Common device data
   COMMON_DEVICE_EXTENSION Common;
+  // Device ID
+  UNICODE_STRING DeviceID;
+  // Instance ID
+  UNICODE_STRING InstanceID;
   // Hardware IDs
   UNICODE_STRING HardwareIDs;
-  // Compatible IDs
-  UNICODE_STRING CompatibleIDs;
 } PDO_DEVICE_EXTENSION, *PPDO_DEVICE_EXTENSION;
 
+
 typedef struct _FDO_DEVICE_EXTENSION
 {
   // Common device data
@@ -82,11 +87,7 @@
 /* acpienum.c */
 
 NTSTATUS
-ACPIEnumerateRootBusses(
-  PFDO_DEVICE_EXTENSION DeviceExtension);
-
-NTSTATUS
-ACPIEnumerateNamespace(
+ACPIEnumerateDevices(
   PFDO_DEVICE_EXTENSION DeviceExtension);
 
 
CVSspam 0.2.8