Move shareable part of USB miniport drivers to a new directory. UHCI uses it.
authorHervé Poussineau <hpoussin@reactos.org>
Sat, 10 Sep 2005 18:04:42 +0000 (18:04 +0000)
committerHervé Poussineau <hpoussin@reactos.org>
Sat, 10 Sep 2005 18:04:42 +0000 (18:04 +0000)
svn path=/trunk/; revision=17782

16 files changed:
reactos/drivers/usb/miniport/common/cleanup.c
reactos/drivers/usb/miniport/common/close.c
reactos/drivers/usb/miniport/common/common.xml
reactos/drivers/usb/miniport/common/create.c
reactos/drivers/usb/miniport/common/fdo.c
reactos/drivers/usb/miniport/common/main.c [moved from reactos/drivers/usb/miniport/common/uhci.c with 67% similarity]
reactos/drivers/usb/miniport/common/misc.c
reactos/drivers/usb/miniport/common/pdo.c
reactos/drivers/usb/miniport/common/usbcommon.h [moved from reactos/drivers/usb/miniport/common/uhci.h with 73% similarity]
reactos/drivers/usb/miniport/common/usbcommon_types.h [new file with mode: 0644]
reactos/drivers/usb/miniport/linux/pci_hal.c
reactos/drivers/usb/miniport/sys/linuxwrapper.c
reactos/drivers/usb/miniport/usbuhci/uhci-hcd.c
reactos/drivers/usb/miniport/usbuhci/uhci.c
reactos/drivers/usb/miniport/usbuhci/uhci.h [new file with mode: 0644]
reactos/drivers/usb/miniport/usbuhci/usbuhci.xml

index 634296e..57b5534 100644 (file)
@@ -1,21 +1,23 @@
 /*
  * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS UHCI controller driver (Cromwell type)
- * FILE:            drivers/usb/cromwell/uhci/cleanup.c
+ * PROJECT:         ReactOS USB miniport driver (Cromwell type)
+ * FILE:            drivers/usb/miniport/common/cleanup.c
  * PURPOSE:         IRP_MJ_CLEANUP operations
  *
- * PROGRAMMERS:     Hervé Poussineau (hpoussin@reactos.com)
+ * PROGRAMMERS:     Hervé Poussineau (hpoussin@reactos.org)
  */
 
 #define NDEBUG
-#include "uhci.h"
+#include <debug.h>
+
+#include "usbcommon.h"
 
 NTSTATUS STDCALL
-UhciCleanup(
+UsbMpCleanup(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp)
 {
-       DPRINT("UHCI: IRP_MJ_CLEANUP\n");
+       DPRINT("USBMP: IRP_MJ_CLEANUP\n");
 
        Irp->IoStatus.Information = 0;
        Irp->IoStatus.Status = STATUS_SUCCESS;
index 0c5c08a..a9af428 100644 (file)
@@ -1,24 +1,26 @@
 /*
  * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS UHCI controller driver (Cromwell type)
- * FILE:            drivers/usb/cromwell/uhci/close.c
+ * PROJECT:         ReactOS USB miniport driver (Cromwell type)
+ * FILE:            drivers/usb/miniport/common/close.c
  * PURPOSE:         IRP_MJ_CLOSE operations
  *
- * PROGRAMMERS:     Hervé Poussineau (hpoussin@reactos.com)
+ * PROGRAMMERS:     Hervé Poussineau (hpoussin@reactos.org)
  */
 
 #define NDEBUG
-#include "uhci.h"
+#include <debug.h>
+
+#include "usbcommon.h"
 
 NTSTATUS STDCALL
-UhciClose(
+UsbMpClose(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp)
 {
-       POHCI_DEVICE_EXTENSION pDeviceExtension;
+       PUSBMP_DEVICE_EXTENSION pDeviceExtension;
 
-       DPRINT("UHCI: IRP_MJ_CLOSE\n");
-       pDeviceExtension = (POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+       DPRINT("USBMP: IRP_MJ_CLOSE\n");
+       pDeviceExtension = (PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
        InterlockedDecrement((PLONG)&pDeviceExtension->DeviceOpened);
 
        Irp->IoStatus.Information = 0;
index e4cdf11..5726dc0 100644 (file)
@@ -2,12 +2,12 @@
        <define name="__USE_W32API" />\r
        <define name="DEBUG_MODE" />\r
        <include>../linux</include>\r
-       <include base="usbport"></include>\r
+       <include base="usbport">.</include>\r
        <file>cleanup.c</file>\r
        <file>close.c</file>\r
        <file>create.c</file>\r
        <file>fdo.c</file>\r
+       <file>main.c</file>\r
        <file>misc.c</file>\r
        <file>pdo.c</file>\r
-       <file>uhci.c</file>\r
 </module>\r
index c832a95..908fb9d 100644 (file)
@@ -1,27 +1,29 @@
 /*
  * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS UHCI controller driver (Cromwell type)
- * FILE:            drivers/usb/cromwell/uhci/create.c
+ * PROJECT:         ReactOS USB miniport driver (Cromwell type)
+ * FILE:            drivers/usb/miniport/common/create.c
  * PURPOSE:         IRP_MJ_CREATE operations
  *
- * PROGRAMMERS:     Hervé Poussineau (hpoussin@reactos.com)
+ * PROGRAMMERS:     Hervé Poussineau (hpoussin@reactos.org)
  */
 
 #define NDEBUG
-#include "uhci.h"
+#include <debug.h>
+
+#include "usbcommon.h"
 
 NTSTATUS STDCALL
-UhciCreate(
+UsbMpCreate(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp)
 {
        PIO_STACK_LOCATION Stack;
-       POHCI_DEVICE_EXTENSION DeviceExtension;
+       PUSBMP_DEVICE_EXTENSION DeviceExtension;
        NTSTATUS Status;
 
-       DPRINT("UHCI: IRP_MJ_CREATE\n");
+       DPRINT("USBMP: IRP_MJ_CREATE\n");
        Stack = IoGetCurrentIrpStackLocation(Irp);
-       DeviceExtension = (POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+       DeviceExtension = (PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
 
        if (Stack->Parameters.Create.Options & FILE_DIRECTORY_FILE)
        {
index e2d69b6..b82d04c 100644 (file)
@@ -1,20 +1,22 @@
 /*
  * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS UHCI controller driver (Cromwell type)
- * FILE:            drivers/usb/cromwell/uhci/fdo.c
+ * PROJECT:         ReactOS USB miniport driver (Cromwell type)
+ * FILE:            drivers/usb/miniport/common/fdo.c
  * PURPOSE:         IRP_MJ_PNP/IRP_MJ_DEVICE_CONTROL operations for FDOs
  *
- * PROGRAMMERS:     Hervé Poussineau (hpoussin@reactos.com),
+ * PROGRAMMERS:     Hervé Poussineau (hpoussin@reactos.org),
  *                  James Tabor (jimtabor@adsl-64-217-116-74.dsl.hstntx.swbell.net)
  */
 
 #define NDEBUG
-#include "uhci.h"
+#include <debug.h>
+
+#include "usbcommon.h"
 
 #define IO_METHOD_FROM_CTL_CODE(ctlCode) (ctlCode&0x00000003)
 
 static VOID
-UhciGetUserBuffers(
+UsbMpGetUserBuffers(
        IN PIRP Irp,
        IN ULONG IoControlCode,
        OUT PVOID* BufferIn,
@@ -47,14 +49,14 @@ UhciGetUserBuffers(
 }
 
 NTSTATUS STDCALL
-UhciFdoStartDevice(
+UsbMpFdoStartDevice(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp)
 {
        PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
        PDRIVER_OBJECT DriverObject;
-       POHCI_DRIVER_EXTENSION DriverExtension;
-       POHCI_DEVICE_EXTENSION DeviceExtension;
+       PUSBMP_DRIVER_EXTENSION DriverExtension;
+       PUSBMP_DEVICE_EXTENSION DeviceExtension;
        PCM_RESOURCE_LIST AllocatedResources;
 
        /*
@@ -62,7 +64,7 @@ UhciFdoStartDevice(
        */
        DriverObject = DeviceObject->DriverObject;
        DriverExtension = IoGetDriverObjectExtension(DriverObject, DriverObject);
-       DeviceExtension = (POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+       DeviceExtension = (PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
 
        /*
        * Store some resources in the DeviceExtension.
@@ -131,7 +133,7 @@ UhciFdoStartDevice(
        }
        
        /* Print assigned resources */
-       DPRINT("UHCI: Interrupt Vector 0x%lx, %S base 0x%lx, Length 0x%lx\n",
+       DPRINT("USBMP: Interrupt Vector 0x%lx, %S base 0x%lx, Length 0x%lx\n",
                DeviceExtension->InterruptVector,
                ((struct hc_driver *)(*pci_ids)->driver_data)->flags & HCD_MEMORY ? L"Memory" : L"I/O",
                DeviceExtension->BaseAddress,
@@ -142,15 +144,15 @@ UhciFdoStartDevice(
 }
 
 static NTSTATUS
-UhciFdoQueryBusRelations(
+UsbMpFdoQueryBusRelations(
        IN PDEVICE_OBJECT DeviceObject,
        OUT PDEVICE_RELATIONS* pDeviceRelations)
 {
-       POHCI_DEVICE_EXTENSION DeviceExtension;
+       PUSBMP_DEVICE_EXTENSION DeviceExtension;
        PDEVICE_RELATIONS DeviceRelations;
        NTSTATUS Status = STATUS_SUCCESS;
        
-       DeviceExtension = (POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+       DeviceExtension = (PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
        
        /* Handling this IRP is easy, as we only
         * have one child: the root hub
@@ -171,7 +173,7 @@ UhciFdoQueryBusRelations(
 }
 
 NTSTATUS STDCALL
-UhciPnpFdo(
+UsbMpPnpFdo(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp)
 {
@@ -189,7 +191,7 @@ UhciPnpFdo(
                {
                        Status = ForwardIrpAndWait(DeviceObject, Irp);
                        if (NT_SUCCESS(Status) && NT_SUCCESS(Irp->IoStatus.Status))
-                               Status = UhciFdoStartDevice(DeviceObject, Irp);
+                               Status = UsbMpFdoStartDevice(DeviceObject, Irp);
                        break;
                }
 
@@ -219,18 +221,18 @@ UhciPnpFdo(
                                case BusRelations:
                                {
                                        PDEVICE_RELATIONS DeviceRelations;
-                                       DPRINT("UHCI: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n");
-                                       Status = UhciFdoQueryBusRelations(DeviceObject, &DeviceRelations);
+                                       DPRINT("USBMP: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n");
+                                       Status = UsbMpFdoQueryBusRelations(DeviceObject, &DeviceRelations);
                                        Information = (ULONG_PTR)DeviceRelations;
                                        break;
                                }
                                case RemovalRelations:
                                {
-                                       DPRINT1("UHCI: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations\n");
+                                       DPRINT1("USBMP: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations\n");
                                        return ForwardIrpAndForget(DeviceObject, Irp);
                                }
                                default:
-                                       DPRINT1("UHCI: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
+                                       DPRINT1("USBMP: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
                                                IrpSp->Parameters.QueryDeviceRelations.Type);
                                        return ForwardIrpAndForget(DeviceObject, Irp);
                        }
@@ -239,7 +241,7 @@ UhciPnpFdo(
 
                default:
                {
-                       DPRINT1("UHCI: unknown minor function 0x%lx\n", MinorFunction);
+                       DPRINT1("USBMP: unknown minor function 0x%lx\n", MinorFunction);
                        return ForwardIrpAndForget(DeviceObject, Irp);
                }
        }
@@ -250,32 +252,32 @@ UhciPnpFdo(
 }
 
 NTSTATUS
-UhciDeviceControlFdo(
+UsbMpDeviceControlFdo(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp)
 {
        PIO_STACK_LOCATION Stack;
        ULONG IoControlCode;
-       POHCI_DEVICE_EXTENSION DeviceExtension;
+       PUSBMP_DEVICE_EXTENSION DeviceExtension;
        ULONG LengthIn, LengthOut;
        ULONG_PTR Information = 0;
        PVOID BufferIn, BufferOut;
        NTSTATUS Status;
 
-       DPRINT("UHCI: UsbDeviceControlFdo() called\n");
+       DPRINT("USBMP: UsbDeviceControlFdo() called\n");
 
        Stack = IoGetCurrentIrpStackLocation(Irp);
        LengthIn = Stack->Parameters.DeviceIoControl.InputBufferLength;
        LengthOut = Stack->Parameters.DeviceIoControl.OutputBufferLength;
-       DeviceExtension = (POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+       DeviceExtension = (PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
        IoControlCode = Stack->Parameters.DeviceIoControl.IoControlCode;
-       UhciGetUserBuffers(Irp, IoControlCode, &BufferIn, &BufferOut);
+       UsbMpGetUserBuffers(Irp, IoControlCode, &BufferIn, &BufferOut);
 
        switch (IoControlCode)
        {
                case IOCTL_GET_HCD_DRIVERKEY_NAME:
                {
-                       DPRINT("UHCI: IOCTL_GET_HCD_DRIVERKEY_NAME\n");
+                       DPRINT("USBMP: IOCTL_GET_HCD_DRIVERKEY_NAME\n");
                        if (LengthOut < sizeof(USB_HCD_DRIVERKEY_NAME))
                                Status = STATUS_BUFFER_TOO_SMALL;
                        else if (BufferOut == NULL)
@@ -286,7 +288,7 @@ UhciDeviceControlFdo(
                                ULONG StringSize;
                                StringDescriptor = (PUSB_HCD_DRIVERKEY_NAME)BufferOut;
                                Status = IoGetDeviceProperty(
-                                       ((POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->PhysicalDeviceObject,
+                                       ((PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->PhysicalDeviceObject,
                                        DevicePropertyDriverKeyName,
                                        LengthOut - FIELD_OFFSET(USB_HCD_DRIVERKEY_NAME, DriverKeyName),
                                        StringDescriptor->DriverKeyName,
@@ -302,7 +304,7 @@ UhciDeviceControlFdo(
                }
                case IOCTL_USB_GET_ROOT_HUB_NAME:
                {
-                       DPRINT("UHCI: IOCTL_USB_GET_ROOT_HUB_NAME\n");
+                       DPRINT("USBMP: IOCTL_USB_GET_ROOT_HUB_NAME\n");
                        if (LengthOut < sizeof(USB_ROOT_HUB_NAME))
                                Status = STATUS_BUFFER_TOO_SMALL;
                        else if (BufferOut == NULL)
@@ -312,8 +314,8 @@ UhciDeviceControlFdo(
                                PUSB_ROOT_HUB_NAME StringDescriptor;
                                PUNICODE_STRING RootHubInterfaceName;
                                StringDescriptor = (PUSB_ROOT_HUB_NAME)BufferOut;
-                               DeviceObject = ((POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->RootHubPdo;
-                               RootHubInterfaceName = &((POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->HcdInterfaceName;
+                               DeviceObject = ((PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->RootHubPdo;
+                               RootHubInterfaceName = &((PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->HcdInterfaceName;
 
                                StringDescriptor->ActualLength = RootHubInterfaceName->Length + sizeof(WCHAR) + FIELD_OFFSET(USB_ROOT_HUB_NAME, RootHubName);
                                if (StringDescriptor->ActualLength <= LengthOut)
@@ -324,7 +326,7 @@ UhciDeviceControlFdo(
                                                RootHubInterfaceName->Buffer,
                                                RootHubInterfaceName->Length);
                                        StringDescriptor->RootHubName[RootHubInterfaceName->Length / sizeof(WCHAR)] = UNICODE_NULL;
-                                       DPRINT("UHCI: IOCTL_USB_GET_ROOT_HUB_NAME returns '%S'\n", StringDescriptor->RootHubName);
+                                       DPRINT("USBMP: IOCTL_USB_GET_ROOT_HUB_NAME returns '%S'\n", StringDescriptor->RootHubName);
                                        Information = StringDescriptor->ActualLength;
                                }
                                else
@@ -337,7 +339,7 @@ UhciDeviceControlFdo(
                default:
                {
                        /* Pass Irp to lower driver */
-                       DPRINT1("UHCI: Unknown IOCTL code 0x%lx\n", Stack->Parameters.DeviceIoControl.IoControlCode);
+                       DPRINT1("USBMP: Unknown IOCTL code 0x%lx\n", Stack->Parameters.DeviceIoControl.IoControlCode);
                        IoSkipCurrentIrpStackLocation(Irp);
                        return IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
                }
similarity index 67%
rename from reactos/drivers/usb/miniport/common/uhci.c
rename to reactos/drivers/usb/miniport/common/main.c
index 7731935..8d359cd 100644 (file)
@@ -1,12 +1,21 @@
 /*
-   ReactOS specific functions for UHCI module
-   by Aleksey Bragin (aleksey@reactos.com)
-   and Hervé Poussineau (hpoussin@reactos.com)
-   Some parts of code are inspired (or even just copied) from ReactOS Videoport driver
-*/
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS USB miniport driver (Cromwell type)
+ * FILE:            drivers/usb/miniport/common/main.c
+ * PURPOSE:         Driver entry
+ *
+ * PROGRAMMERS:     Aleksey Bragin (aleksey@reactos.com)
+ *                  Hervé Poussineau (hpoussin@reactos.org),
+ *
+ * Some parts of code are inspired (or even just copied) from
+ * ReactOS Videoport driver (drivers/video/videoprt)
+ */
+
 #define NDEBUG
+#include <debug.h>
+
 #define INITGUID
-#include "uhci.h"
+#include "usbcommon.h"
 
 static ULONG DeviceNumber = 0; /* FIXME: what is that? */
 
@@ -17,14 +26,14 @@ CreateRootHubPdo(
        OUT PDEVICE_OBJECT* pPdo)
 {
        PDEVICE_OBJECT Pdo;
-       POHCI_DEVICE_EXTENSION DeviceExtension;
+       PUSBMP_DEVICE_EXTENSION DeviceExtension;
        NTSTATUS Status;
        
-       DPRINT("UHCI: CreateRootHubPdo()\n");
+       DPRINT("USBMP: CreateRootHubPdo()\n");
        
        Status = IoCreateDevice(
                DriverObject,
-               sizeof(OHCI_DEVICE_EXTENSION),
+               sizeof(USBMP_DEVICE_EXTENSION),
                NULL, /* DeviceName */
                FILE_DEVICE_BUS_EXTENDER,
                FILE_DEVICE_SECURE_OPEN | FILE_AUTOGENERATED_DEVICE_NAME,
@@ -32,7 +41,7 @@ CreateRootHubPdo(
                &Pdo);
        if (!NT_SUCCESS(Status))
        {
-               DPRINT("UHCI: IoCreateDevice() call failed with status 0x%08x\n", Status);
+               DPRINT("USBMP: IoCreateDevice() call failed with status 0x%08x\n", Status);
                return Status;
        }
        
@@ -40,8 +49,8 @@ CreateRootHubPdo(
        Pdo->Flags |= DO_POWER_PAGABLE;
        
        // zerofill device extension
-       DeviceExtension = (POHCI_DEVICE_EXTENSION)Pdo->DeviceExtension;
-       RtlZeroMemory(DeviceExtension, sizeof(OHCI_DEVICE_EXTENSION));
+       DeviceExtension = (PUSBMP_DEVICE_EXTENSION)Pdo->DeviceExtension;
+       RtlZeroMemory(DeviceExtension, sizeof(USBMP_DEVICE_EXTENSION));
        
        DeviceExtension->IsFDO = FALSE;
        DeviceExtension->FunctionalDeviceObject = Fdo;
@@ -63,10 +72,10 @@ AddDevice(
        WCHAR LinkDeviceBuffer[20];
        UNICODE_STRING DeviceName;
        UNICODE_STRING LinkDeviceName;
-       POHCI_DRIVER_EXTENSION DriverExtension;
-       POHCI_DEVICE_EXTENSION DeviceExtension;
+       PUSBMP_DRIVER_EXTENSION DriverExtension;
+       PUSBMP_DEVICE_EXTENSION DeviceExtension;
 
-       DPRINT("UHCI: AddDevice called\n");
+       DPRINT("USBMP: AddDevice called\n");
 
        // Allocate driver extension now
        DriverExtension = IoGetDriverObjectExtension(DriverObject, DriverObject);
@@ -75,12 +84,12 @@ AddDevice(
                Status = IoAllocateDriverObjectExtension(
                                        DriverObject,
                                        DriverObject,
-                                       sizeof(OHCI_DRIVER_EXTENSION),
+                                       sizeof(USBMP_DRIVER_EXTENSION),
                                        (PVOID *)&DriverExtension);
 
                if (!NT_SUCCESS(Status))
                {
-                       DPRINT("UHCI: Allocating DriverObjectExtension failed.\n");
+                       DPRINT("USBMP: Allocating DriverObjectExtension failed.\n");
                        return Status;
                }
        }
@@ -91,7 +100,7 @@ AddDevice(
        RtlInitUnicodeString(&DeviceName, DeviceBuffer);
 
        Status = IoCreateDevice(DriverObject,
-                               sizeof(OHCI_DEVICE_EXTENSION),
+                               sizeof(USBMP_DEVICE_EXTENSION),
                                &DeviceName,
                                FILE_DEVICE_BUS_EXTENDER,
                                0,
@@ -100,19 +109,19 @@ AddDevice(
 
        if (!NT_SUCCESS(Status))
        {
-               DPRINT("UHCI: IoCreateDevice call failed with status 0x%08lx\n", Status);
+               DPRINT("USBMP: IoCreateDevice call failed with status 0x%08lx\n", Status);
                return Status;
        }
 
        // zerofill device extension
-       DeviceExtension = (POHCI_DEVICE_EXTENSION)fdo->DeviceExtension;
-       RtlZeroMemory(DeviceExtension, sizeof(OHCI_DEVICE_EXTENSION));
+       DeviceExtension = (PUSBMP_DEVICE_EXTENSION)fdo->DeviceExtension;
+       RtlZeroMemory(DeviceExtension, sizeof(USBMP_DEVICE_EXTENSION));
        
        /* Create root hub Pdo */
        Status = CreateRootHubPdo(DriverObject, fdo, &DeviceExtension->RootHubPdo);
        if (!NT_SUCCESS(Status))
        {
-               DPRINT("UHCI: CreateRootHubPdo() failed with status 0x%08lx\n", Status);
+               DPRINT("USBMP: CreateRootHubPdo() failed with status 0x%08lx\n", Status);
                IoDeleteDevice(fdo);
                return Status;
        }
@@ -125,7 +134,7 @@ AddDevice(
                &DeviceExtension->HcdInterfaceName);
        if (!NT_SUCCESS(Status))
        {
-               DPRINT("UHCI: IoRegisterDeviceInterface() failed with status 0x%08lx\n", Status);
+               DPRINT("USBMP: IoRegisterDeviceInterface() failed with status 0x%08lx\n", Status);
                IoDeleteDevice(DeviceExtension->RootHubPdo);
                IoDeleteDevice(fdo);
                return Status;
@@ -151,7 +160,7 @@ AddDevice(
 
        if (!NT_SUCCESS(Status))
        {
-               DPRINT("UHCI: IoCreateSymbolicLink call failed with status 0x%08x\n", Status);
+               DPRINT("USBMP: IoCreateSymbolicLink call failed with status 0x%08x\n", Status);
                IoDeleteDevice(DeviceExtension->RootHubPdo);
                IoDeleteDevice(fdo);
                return Status;
@@ -167,9 +176,9 @@ IrpStub(
 {
        NTSTATUS Status = STATUS_NOT_SUPPORTED;
 
-       if (((POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
+       if (((PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
        {
-               DPRINT1("UHCI: FDO stub for major function 0x%lx\n",
+               DPRINT1("USBMP: FDO stub for major function 0x%lx\n",
                        IoGetCurrentIrpStackLocation(Irp)->MajorFunction);
 #ifndef NDEBUG
                DbgBreakPoint();
@@ -181,7 +190,7 @@ IrpStub(
                /* We can't forward request to the lower driver, because
                 * we are a Pdo, so we don't have lower driver...
                 */
-               DPRINT1("UHCI: PDO stub for major function 0x%lx\n",
+               DPRINT1("USBMP: PDO stub for major function 0x%lx\n",
                        IoGetCurrentIrpStackLocation(Irp)->MajorFunction);
 #ifndef NDEBUG
                DbgBreakPoint();
@@ -196,8 +205,8 @@ IrpStub(
 static NTSTATUS STDCALL
 DispatchCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp)
 {
-       if (((POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
-               return UhciCreate(DeviceObject, Irp);
+       if (((PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
+               return UsbMpCreate(DeviceObject, Irp);
        else
                return IrpStub(DeviceObject, Irp);
 }
@@ -205,8 +214,8 @@ DispatchCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp)
 static NTSTATUS STDCALL
 DispatchClose(PDEVICE_OBJECT DeviceObject, PIRP Irp)
 {
-       if (((POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
-               return UhciClose(DeviceObject, Irp);
+       if (((PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
+               return UsbMpClose(DeviceObject, Irp);
        else
                return IrpStub(DeviceObject, Irp);
 }
@@ -214,8 +223,8 @@ DispatchClose(PDEVICE_OBJECT DeviceObject, PIRP Irp)
 static NTSTATUS STDCALL
 DispatchCleanup(PDEVICE_OBJECT DeviceObject, PIRP Irp)
 {
-       if (((POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
-               return UhciCleanup(DeviceObject, Irp);
+       if (((PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
+               return UsbMpCleanup(DeviceObject, Irp);
        else
                return IrpStub(DeviceObject, Irp);
 }
@@ -223,25 +232,25 @@ DispatchCleanup(PDEVICE_OBJECT DeviceObject, PIRP Irp)
 static NTSTATUS STDCALL
 DispatchDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
 {
-       if (((POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
-               return UhciDeviceControlFdo(DeviceObject, Irp);
+       if (((PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
+               return UsbMpDeviceControlFdo(DeviceObject, Irp);
        else
-               return UhciDeviceControlPdo(DeviceObject, Irp);
+               return UsbMpDeviceControlPdo(DeviceObject, Irp);
 }
 
 static NTSTATUS STDCALL
 DispatchPnp(PDEVICE_OBJECT DeviceObject, PIRP Irp)
 {
-       if (((POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
-               return UhciPnpFdo(DeviceObject, Irp);
+       if (((PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
+               return UsbMpPnpFdo(DeviceObject, Irp);
        else
-               return UhciPnpPdo(DeviceObject, Irp);
+               return UsbMpPnpPdo(DeviceObject, Irp);
 }
 
 static NTSTATUS STDCALL 
 DispatchPower(PDEVICE_OBJECT fido, PIRP Irp)
 {
-       DPRINT1("UHCI: IRP_MJ_POWER unimplemented\n");
+       DPRINT1("USBMP: IRP_MJ_POWER unimplemented\n");
        Irp->IoStatus.Information = 0;
        Irp->IoStatus.Status = STATUS_SUCCESS;
        IoCompleteRequest(Irp, IO_NO_INCREMENT);
@@ -255,7 +264,6 @@ NTSTATUS STDCALL
 DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegPath)
 {
        ULONG i;
-       DPRINT("********* Cromwell UHCI *********\n");
 
        DriverObject->DriverUnload = DriverUnload;
        DriverObject->DriverExtension->AddDevice = AddDevice;
index aa620b8..cfe8456 100644 (file)
@@ -1,14 +1,16 @@
 /*
  * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS UHCI controller driver (Cromwell type)
- * FILE:            drivers/usb/cromwell/uhci/misc.c
+ * PROJECT:         ReactOS USB miniport driver (Cromwell type)
+ * FILE:            drivers/usb/miniport/common/misc.c
  * PURPOSE:         Misceallenous operations
  *
- * PROGRAMMERS:     Hervé Poussineau (hpoussin@reactos.com),
+ * PROGRAMMERS:     Hervé Poussineau (hpoussin@reactos.org),
  */
 
 #define NDEBUG
-#include "uhci.h"
+#include <debug.h>
+
+#include "usbcommon.h"
 #include <stdarg.h>
 
 NTSTATUS STDCALL
@@ -27,7 +29,7 @@ ForwardIrpAndWait(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp)
 {
-       PDEVICE_OBJECT LowerDevice = ((POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->NextDeviceObject;
+       PDEVICE_OBJECT LowerDevice = ((PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->NextDeviceObject;
        KEVENT Event;
        NTSTATUS Status;
 
@@ -36,7 +38,7 @@ ForwardIrpAndWait(
        KeInitializeEvent(&Event, NotificationEvent, FALSE);
        IoCopyCurrentIrpStackLocationToNext(Irp);
 
-       DPRINT("UHCI: Calling lower device %p [%wZ]\n", LowerDevice, &LowerDevice->DriverObject->DriverName);
+       DPRINT("USBMP: Calling lower device %p [%wZ]\n", LowerDevice, &LowerDevice->DriverObject->DriverName);
        IoSetCompletionRoutine(Irp, ForwardIrpAndWaitCompletion, &Event, TRUE, TRUE, TRUE);
 
        Status = IoCallDriver(LowerDevice, Irp);
@@ -55,7 +57,7 @@ ForwardIrpAndForget(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp)
 {
-       PDEVICE_OBJECT LowerDevice = ((POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->NextDeviceObject;
+       PDEVICE_OBJECT LowerDevice = ((PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->NextDeviceObject;
 
        ASSERT(LowerDevice);
 
@@ -67,7 +69,7 @@ ForwardIrpAndForget(
  * PnP ids are ANSI-encoded in PnP device string
  * identification */
 NTSTATUS
-UhciInitMultiSzString(
+UsbMpInitMultiSzString(
        OUT PUNICODE_STRING Destination,
        ... /* list of PCSZ */)
 {
@@ -103,7 +105,7 @@ UhciInitMultiSzString(
 
        /* Initialize destination string */
        DestinationSize += sizeof(WCHAR); // final NULL
-       Destination->Buffer = (PWSTR)ExAllocatePoolWithTag(PagedPool, DestinationSize, USB_UHCI_TAG);
+       Destination->Buffer = (PWSTR)ExAllocatePoolWithTag(PagedPool, DestinationSize, USB_MINIPORT_TAG);
        if (!Destination->Buffer)
                return STATUS_INSUFFICIENT_RESOURCES;
        Destination->Length = 0;
@@ -123,7 +125,7 @@ UhciInitMultiSzString(
                Status = RtlAnsiStringToUnicodeString(&UnicodeString, &AnsiString, FALSE);
                if (!NT_SUCCESS(Status))
                {
-                       ExFreePoolWithTag(Destination->Buffer, USB_UHCI_TAG);
+                       ExFreePoolWithTag(Destination->Buffer, USB_MINIPORT_TAG);
                        break;
                }
                Destination->Length += UnicodeString.Length + sizeof(WCHAR);
@@ -143,7 +145,7 @@ UhciInitMultiSzString(
 }
 
 NTSTATUS
-UhciDuplicateUnicodeString(
+UsbMpDuplicateUnicodeString(
        OUT PUNICODE_STRING Destination,
        IN PUNICODE_STRING Source,
        IN POOL_TYPE PoolType)
index 45a014f..4d7259d 100644 (file)
@@ -1,22 +1,24 @@
 /*
  * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS UHCI controller driver (Cromwell type)
- * FILE:            drivers/usb/cromwell/uhci/pdo.c
+ * PROJECT:         ReactOS USB miniport driver (Cromwell type)
+ * FILE:            drivers/usb/miniport/common/pdo.c
  * PURPOSE:         IRP_MJ_PNP/IRP_MJ_DEVICE_CONTROL operations for PDOs
  *
- * PROGRAMMERS:     Hervé Poussineau (hpoussin@reactos.com),
+ * PROGRAMMERS:     Hervé Poussineau (hpoussin@reactos.org),
  *                  James Tabor (jimtabor@adsl-64-217-116-74.dsl.hstntx.swbell.net)
  */
 
 #define NDEBUG
-#include "uhci.h"
+#include <debug.h>
+
+#include "usbcommon.h"
 
 extern struct usb_driver hub_driver;
 
 #define IO_METHOD_FROM_CTL_CODE(ctlCode) (ctlCode&0x00000003)
 
 NTSTATUS
-UhciDeviceControlPdo(
+UsbMpDeviceControlPdo(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp)
 {
@@ -24,7 +26,7 @@ UhciDeviceControlPdo(
        ULONG_PTR Information = 0;
        NTSTATUS Status;
        
-       DPRINT("UHCI: UhciDeviceControlPdo() called\n");
+       DPRINT("USBMP: UsbMpDeviceControlPdo() called\n");
        
        Stack = IoGetCurrentIrpStackLocation(Irp);
        Status = Irp->IoStatus.Status;
@@ -33,9 +35,9 @@ UhciDeviceControlPdo(
        {
                case IOCTL_INTERNAL_USB_GET_ROOT_USB_DEVICE:
                {
-                       POHCI_DEVICE_EXTENSION DeviceExtension;
+                       PUSBMP_DEVICE_EXTENSION DeviceExtension;
                        
-                       DPRINT("UHCI: IOCTL_INTERNAL_USB_GET_ROOT_USB_DEVICE\n");
+                       DPRINT("USBMP: IOCTL_INTERNAL_USB_GET_ROOT_USB_DEVICE\n");
                        if (Irp->AssociatedIrp.SystemBuffer == NULL
                                || Stack->Parameters.DeviceIoControl.OutputBufferLength != sizeof(PVOID))
                        {
@@ -44,8 +46,8 @@ UhciDeviceControlPdo(
                        else
                        {
                                PVOID* pRootHubPointer;
-                               DeviceExtension = (POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
-                               DeviceExtension = (POHCI_DEVICE_EXTENSION)DeviceExtension->FunctionalDeviceObject->DeviceExtension;
+                               DeviceExtension = (PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+                               DeviceExtension = (PUSBMP_DEVICE_EXTENSION)DeviceExtension->FunctionalDeviceObject->DeviceExtension;
                                
                                pRootHubPointer = (PVOID*)Irp->AssociatedIrp.SystemBuffer;
                                *pRootHubPointer = (PVOID)DeviceExtension->pdev->bus; /* struct usb_device* */
@@ -56,7 +58,7 @@ UhciDeviceControlPdo(
                }
                default:
                {
-                       DPRINT1("UHCI: Unknown IOCTL code 0x%lx\n", Stack->Parameters.DeviceIoControl.IoControlCode);
+                       DPRINT1("USBMP: Unknown IOCTL code 0x%lx\n", Stack->Parameters.DeviceIoControl.IoControlCode);
                        Information = Irp->IoStatus.Information;
                        Status = Irp->IoStatus.Status;
                }
@@ -69,57 +71,57 @@ UhciDeviceControlPdo(
 }
 
 static NTSTATUS
-UhciPdoQueryId(
+UsbMpPdoQueryId(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp,
        OUT ULONG_PTR* Information)
 {
-       POHCI_DEVICE_EXTENSION DeviceExtension;
+       PUSBMP_DEVICE_EXTENSION DeviceExtension;
        ULONG IdType;
        UNICODE_STRING SourceString;
        UNICODE_STRING String;
        NTSTATUS Status;
 
        IdType = IoGetCurrentIrpStackLocation(Irp)->Parameters.QueryId.IdType;
-       DeviceExtension = (POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+       DeviceExtension = (PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
        RtlInitUnicodeString(&String, NULL);
 
        switch (IdType)
        {
                case BusQueryDeviceID:
                {
-                       DPRINT("UHCI: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryDeviceID\n");
+                       DPRINT("USBMP: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryDeviceID\n");
                        RtlInitUnicodeString(&SourceString, L"USB\\ROOT_HUB");
                        break;
                }
                case BusQueryHardwareIDs:
                {
-                       DPRINT("UHCI: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryHardwareIDs\n");
+                       DPRINT("USBMP: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryHardwareIDs\n");
                        /* FIXME: Should return
                                USB\ROOT_HUB&VID????&PID????&REV????
                                USB\ROOT_HUB&VID????&PID????
                                USB\ROOT_HUB
                        */
-                       UhciInitMultiSzString(&SourceString, "USB\\ROOT_HUB", NULL);
+                       UsbMpInitMultiSzString(&SourceString, "USB\\ROOT_HUB", NULL);
                        break;
                }
                case BusQueryCompatibleIDs:
-                       DPRINT("UHCI: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryCompatibleIDs\n");
+                       DPRINT("USBMP: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryCompatibleIDs\n");
                        /* No compatible ID */
                        *Information = 0;
                        return STATUS_NOT_SUPPORTED;
                case BusQueryInstanceID:
                {
-                       DPRINT("UHCI: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryInstanceID\n");
+                       DPRINT("USBMP: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryInstanceID\n");
                        RtlInitUnicodeString(&SourceString, L"0000"); /* FIXME */
                        break;
                }
                default:
-                       DPRINT1("UHCI: IRP_MJ_PNP / IRP_MN_QUERY_ID / unknown query id type 0x%lx\n", IdType);
+                       DPRINT1("USBMP: IRP_MJ_PNP / IRP_MN_QUERY_ID / unknown query id type 0x%lx\n", IdType);
                        return STATUS_NOT_SUPPORTED;
        }
 
-       Status = UhciDuplicateUnicodeString(
+       Status = UsbMpDuplicateUnicodeString(
                &String,
                &SourceString,
                PagedPool);
@@ -128,13 +130,13 @@ UhciPdoQueryId(
 }
 
 static NTSTATUS
-UhciPnpStartDevice(
+UsbMpPnpStartDevice(
        IN PDEVICE_OBJECT DeviceObject)
 {
-       POHCI_DEVICE_EXTENSION DeviceExtension;
+       PUSBMP_DEVICE_EXTENSION DeviceExtension;
        NTSTATUS Status;
        
-       DeviceExtension = (POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+       DeviceExtension = (PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
        
        /* Register device interface for root hub */
        Status = IoRegisterDeviceInterface(
@@ -144,7 +146,7 @@ UhciPnpStartDevice(
                &DeviceExtension->HcdInterfaceName);
        if (!NT_SUCCESS(Status))
        {
-               DPRINT("UHCI: IoRegisterDeviceInterface() failed with status 0x%08lx\n", Status);
+               DPRINT("USBMP: IoRegisterDeviceInterface() failed with status 0x%08lx\n", Status);
                return Status;
        }
        
@@ -152,7 +154,7 @@ UhciPnpStartDevice(
 }
 
 NTSTATUS STDCALL
-UhciPnpPdo(
+UsbMpPnpPdo(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp)
 {
@@ -168,15 +170,15 @@ UhciPnpPdo(
        {
                case IRP_MN_START_DEVICE: /* 0x00 */
                {
-                       DPRINT("UHCI: IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
-                       Status = UhciPnpStartDevice(DeviceObject);
+                       DPRINT("USBMP: IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
+                       Status = UsbMpPnpStartDevice(DeviceObject);
                        break;
                }
                case IRP_MN_QUERY_CAPABILITIES: /* 0x09 */
                {
                        PDEVICE_CAPABILITIES DeviceCapabilities;
                        ULONG i;
-                       DPRINT("UHCI: IRP_MJ_PNP / IRP_MN_QUERY_CAPABILITIES\n");
+                       DPRINT("USBMP: IRP_MJ_PNP / IRP_MN_QUERY_CAPABILITIES\n");
 
                        DeviceCapabilities = (PDEVICE_CAPABILITIES)Stack->Parameters.DeviceCapabilities.Capabilities;
                        /* FIXME: capabilities can change with connected device */
@@ -202,7 +204,7 @@ UhciPnpPdo(
                }
                case IRP_MN_QUERY_RESOURCES: /* 0x0a */
                {
-                       DPRINT("UHCI: IRP_MJ_PNP / IRP_MN_QUERY_RESOURCES\n");
+                       DPRINT("USBMP: IRP_MJ_PNP / IRP_MN_QUERY_RESOURCES\n");
                        /* Root buses don't need resources, except the ones of
                         * the usb controller. This PDO is the root bus PDO, so
                         * report no resource by not changing Information and
@@ -214,7 +216,7 @@ UhciPnpPdo(
                }
                case IRP_MN_QUERY_RESOURCE_REQUIREMENTS: /* 0x0b */
                {
-                       DPRINT("UHCI: IRP_MJ_PNP / IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n");
+                       DPRINT("USBMP: IRP_MJ_PNP / IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n");
                        /* Root buses don't need resources, except the ones of
                         * the usb controller. This PDO is the root bus PDO, so
                         * report no resource by not changing Information and
@@ -233,7 +235,7 @@ UhciPnpPdo(
                                {
                                        ULONG DescriptionSize;
                                        PWSTR Description;
-                                       DPRINT("UHCI: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / DeviceTextDescription\n");
+                                       DPRINT("USBMP: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / DeviceTextDescription\n");
                                        
                                        Status = IoGetDeviceProperty(
                                                DeviceObject,
@@ -268,7 +270,7 @@ UhciPnpPdo(
                                }
                                default:
                                {
-                                       DPRINT1("UHCI: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / unknown type 0x%lx\n",
+                                       DPRINT1("USBMP: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / unknown type 0x%lx\n",
                                                Stack->Parameters.QueryDeviceText.DeviceTextType);
                                        Status = STATUS_NOT_SUPPORTED;
                                }
@@ -278,7 +280,7 @@ UhciPnpPdo(
 #endif
                case IRP_MN_QUERY_ID: /* 0x13 */
                {
-                       Status = UhciPdoQueryId(DeviceObject, Irp, &Information);
+                       Status = UsbMpPdoQueryId(DeviceObject, Irp, &Information);
                        break;
                }
                default:
@@ -286,7 +288,7 @@ UhciPnpPdo(
                        /* We can't forward request to the lower driver, because
                         * we are a Pdo, so we don't have lower driver...
                         */
-                       DPRINT1("UHCI: IRP_MJ_PNP / unknown minor function 0x%lx\n", MinorFunction);
+                       DPRINT1("USBMP: IRP_MJ_PNP / unknown minor function 0x%lx\n", MinorFunction);
                        Information = Irp->IoStatus.Information;
                        Status = Irp->IoStatus.Status;
                }
similarity index 73%
rename from reactos/drivers/usb/miniport/common/uhci.h
rename to reactos/drivers/usb/miniport/common/usbcommon.h
index 949eaac..d60a174 100644 (file)
@@ -1,43 +1,45 @@
-//#include <ddk/ntddk.h>
+#ifndef _USBMP_COMMON_H_
+#define _USBMP_COMMON_H_
+
 // config and include core/hcd.h, for hc_device struct struct usb_interface *usb_ifnum_to_if(struct usb_device *dev, unsigned ifnum)
 
 #include "../usb_wrapper.h"
-#include <ddk/usbdi.h>
-#include <ddk/usbiodef.h>
+#include <usbdi.h>
+#include <usbiodef.h>
 #include <initguid.h>
 
-#include "hcd.h"
-
-#include "../usbohci/ohci_main.h"
+#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
+#define USB_MINIPORT_TAG TAG('u','s','b','m')
 
-#define USB_UHCI_TAG TAG('u','s','b','u')
+#include "../../usbport/hcd.h"
+#include "usbcommon_types.h"
 
 /* cleanup.c */
 NTSTATUS STDCALL
-UhciCleanup(
+UsbMpCleanup(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp);
 
 /* close.c */
 NTSTATUS STDCALL
-UhciClose(
+UsbMpClose(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp);
 
 /* create.c */
 NTSTATUS STDCALL
-UhciCreate(
+UsbMpCreate(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp);
 
 /* fdo.c */
 NTSTATUS STDCALL
-UhciPnpFdo(
+UsbMpPnpFdo(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp);
 
 NTSTATUS
-UhciDeviceControlFdo(
+UsbMpDeviceControlFdo(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp);
 
@@ -53,24 +55,24 @@ ForwardIrpAndForget(
        IN PIRP Irp);
 
 NTSTATUS
-UhciDuplicateUnicodeString(
+UsbMpDuplicateUnicodeString(
        OUT PUNICODE_STRING Destination,
        IN PUNICODE_STRING Source,
        IN POOL_TYPE PoolType);
 
 NTSTATUS
-UhciInitMultiSzString(
+UsbMpInitMultiSzString(
        OUT PUNICODE_STRING Destination,
        ... /* list of PCSZ */);
 
 /* pdo.c */
 NTSTATUS STDCALL
-UhciPnpPdo(
+UsbMpPnpPdo(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp);
 
 NTSTATUS
-UhciDeviceControlPdo(
+UsbMpDeviceControlPdo(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp);
 
@@ -82,3 +84,5 @@ NTSTATUS
 InitLinuxWrapper(PDEVICE_OBJECT DeviceObject);
 
 extern struct pci_device_id** pci_ids;
+
+#endif
diff --git a/reactos/drivers/usb/miniport/common/usbcommon_types.h b/reactos/drivers/usb/miniport/common/usbcommon_types.h
new file mode 100644 (file)
index 0000000..f5e4992
--- /dev/null
@@ -0,0 +1,56 @@
+#ifndef _USBMP_COMMON_TYPES_H_\r
+#define _USBMP_COMMON_TYPES_H_\r
+\r
+typedef struct _USBMP_DRIVER_EXTENSION\r
+{\r
+   //OHCI_HW_INITIALIZATION_DATA InitializationData;\r
+   //PVOID HwContext;\r
+   //UNICODE_STRING RegistryPath;\r
+\r
+} USBMP_DRIVER_EXTENSION, *PUSBMP_DRIVER_EXTENSION;\r
+\r
+typedef struct _USBMP_DEVICE_EXTENSTION\r
+{\r
+   ULONG DeviceNumber;\r
+   PDEVICE_OBJECT PhysicalDeviceObject;\r
+   PDEVICE_OBJECT FunctionalDeviceObject;\r
+   PDEVICE_OBJECT NextDeviceObject;\r
+   //UNICODE_STRING RegistryPath;\r
+   UNICODE_STRING HcdInterfaceName;\r
+   //PKINTERRUPT InterruptObject;\r
+   //KSPIN_LOCK InterruptSpinLock;\r
+   PCM_RESOURCE_LIST AllocatedResources;\r
+   ULONG InterruptVector;\r
+   ULONG InterruptLevel;\r
+   PHYSICAL_ADDRESS BaseAddress;\r
+   ULONG BaseAddrLength;\r
+   ULONG Flags;\r
+   //ULONG AdapterInterfaceType;\r
+   //ULONG SystemIoBusNumber;\r
+   ULONG SystemIoSlotNumber;\r
+   //LIST_ENTRY AddressMappingListHead;\r
+\r
+   // DMA stuff, and buffers\r
+   PDMA_ADAPTER pDmaAdapter;\r
+   //PVOID MapRegisterBase;\r
+   ULONG mapRegisterCount;\r
+#ifdef USB_DMA_SINGLE_SUPPORT\r
+   //PHYSICAL_ADDRESS Buffer;\r
+   //PVOID VirtualBuffer;\r
+   //ULONG BufferSize;\r
+\r
+   // Mdl used for single DMA transfers\r
+   //PMDL Mdl;\r
+#endif\r
+\r
+   //KDPC DpcObject;\r
+   PUSBMP_DRIVER_EXTENSION DriverExtension;\r
+   ULONG DeviceOpened;\r
+   //KMUTEX DeviceLock;\r
+   //CHAR MiniPortDeviceExtension[1];\r
+   BOOLEAN IsFDO;\r
+   struct pci_dev * pdev;\r
+   PDEVICE_OBJECT RootHubPdo;\r
+} USBMP_DEVICE_EXTENSION, *PUSBMP_DEVICE_EXTENSION;\r
+\r
+#endif\r
index 70ff1ac..57e7408 100644 (file)
@@ -2,7 +2,7 @@
 // this file is part of linux_wrapper.h
 
 //FIXME: Move this file, make its definitions more general
-#include "../usbohci/ohci_main.h"
+#include "../common/usbcommon_types.h"
 
 /*
   Initialize device before it's used by a driver. Ask low-level code to enable I/O and memory.
@@ -17,7 +17,7 @@ static int __inline__ pci_enable_device(struct pci_dev *dev)
 // Get physical address where resource x resides
 static PHYSICAL_ADDRESS __inline__ pci_resource_start (struct pci_dev *dev, int x)
 {
-       POHCI_DEVICE_EXTENSION dev_ext = (POHCI_DEVICE_EXTENSION)dev->dev_ext;
+       PUSBMP_DEVICE_EXTENSION dev_ext = (PUSBMP_DEVICE_EXTENSION)dev->dev_ext;
        DPRINT1("pci_resource_start() called, x=0x%x\n", x);
        
        //FIXME: Take x into account
@@ -28,7 +28,7 @@ static PHYSICAL_ADDRESS __inline__ pci_resource_start (struct pci_dev *dev, int
 // ???
 static unsigned long __inline__ pci_resource_len (struct pci_dev *dev, int x)
 {
-       POHCI_DEVICE_EXTENSION ext = (POHCI_DEVICE_EXTENSION)dev->dev_ext;
+       PUSBMP_DEVICE_EXTENSION ext = (PUSBMP_DEVICE_EXTENSION)dev->dev_ext;
 
        DPRINT1("pci_resource_len() called, x=0x%x\n", x);
 
@@ -39,7 +39,7 @@ static unsigned long __inline__ pci_resource_len (struct pci_dev *dev, int x)
 // ???
 static int __inline__ pci_resource_flags(struct pci_dev *dev, int x)
 {
-       POHCI_DEVICE_EXTENSION ext = (POHCI_DEVICE_EXTENSION)dev->dev_ext;
+       PUSBMP_DEVICE_EXTENSION ext = (PUSBMP_DEVICE_EXTENSION)dev->dev_ext;
        
        DPRINT1("pci_resource_flags() called, x=0x%x\n", x);
        
index 77c916b..fd47f1f 100644 (file)
@@ -8,7 +8,7 @@
  * 1) Forget all device interrupts, scheduling, semaphores, threads etc.
  * 1a) Forget all DMA and PCI helper functions
  * 2) Forget usbdevfs, procfs and ioctls
- * 3) Emulate OHCI interrupts and root hub timer by polling
+ * 3) Emulate xHCI interrupts and root hub timer by polling
  * 4) Emulate hub kernel thread by polling
  * 5) Emulate synchronous USB-messages (usb_*_msg) with busy waiting
  *
@@ -43,7 +43,7 @@ static struct device_driver *m_drivers[MAX_DRVS];
 static int drvs_num=0;
 unsigned int LAST_USB_EVENT_TICK;
 
-NTSTATUS init_dma(POHCI_DEVICE_EXTENSION pDevExt);
+NTSTATUS init_dma(PUSBMP_DEVICE_EXTENSION pDevExt);
 
 /*------------------------------------------------------------------------*/ 
 /* 
@@ -357,7 +357,7 @@ struct pci_dev *my_pci_find_slot(int a,int b)
 int my_pci_write_config_word(struct pci_dev *dev, int where, u16 val)
 {
        //dev->bus, dev->devfn, where, val
-       OHCI_DEVICE_EXTENSION *dev_ext = (OHCI_DEVICE_EXTENSION *)dev->dev_ext;
+       PUSBMP_DEVICE_EXTENSION dev_ext = (PUSBMP_DEVICE_EXTENSION)dev->dev_ext;
 
        //FIXME: Is returning this value correct?
        //FIXME: Mixing pci_dev and win structs isn't a good thing at all
@@ -440,7 +440,7 @@ static IO_ALLOCATION_ACTION NTAPI MapRegisterCallback(PDEVICE_OBJECT DeviceObjec
 #endif
 
 NTSTATUS
-init_dma(POHCI_DEVICE_EXTENSION pDevExt)
+init_dma(PUSBMP_DEVICE_EXTENSION pDevExt)
 {
        // Prepare device descriptor structure
        DEVICE_DESCRIPTION dd;
@@ -552,7 +552,7 @@ static IO_ALLOCATION_ACTION NTAPI MapRegisterCallback(PDEVICE_OBJECT DeviceObjec
                                                       PVOID MapRegisterBase,
                                                       PVOID Context)
 {
-       POHCI_DEVICE_EXTENSION pDevExt = (POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+       PUSBMP_DEVICE_EXTENSION pDevExt = (PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
        UNREFERENCED_PARAMETER(Irp);
 
        DPRINT("usb_linuxwrapper: MapRegisterCallback Called, base=0x%08x\n", MapRegisterBase);
@@ -664,7 +664,7 @@ address through the handle. If such a memory block can't be allocated, null is r
 void * my_pci_pool_alloc(struct pci_pool * pool, int mem_flags, dma_addr_t *dma_handle)
 {
        PVOID result;
-       POHCI_DEVICE_EXTENSION devExt = (POHCI_DEVICE_EXTENSION)pool->pdev->dev_ext;
+       PUSBMP_DEVICE_EXTENSION devExt = (PUSBMP_DEVICE_EXTENSION)pool->pdev->dev_ext;
        int page=0, offset;
        int map, i, block;
 
@@ -789,7 +789,7 @@ void __inline__ my_pci_pool_destroy (struct pci_pool * pool)
 
 void  *my_pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *dma_handle)
 {
-    POHCI_DEVICE_EXTENSION devExt = (POHCI_DEVICE_EXTENSION)hwdev->dev_ext;
+    PUSBMP_DEVICE_EXTENSION devExt = (PUSBMP_DEVICE_EXTENSION)hwdev->dev_ext;
        DPRINT1("pci_alloc_consistent() size=%d\n", size);
 
     return devExt->pDmaAdapter->DmaOperations->AllocateCommonBuffer(devExt->pDmaAdapter, size, (PPHYSICAL_ADDRESS)dma_handle, FALSE); //FIXME: Cache-enabled?
@@ -798,7 +798,7 @@ void  *my_pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *d
 dma_addr_t my_dma_map_single(struct device *hwdev, void *ptr, size_t size, enum dma_data_direction direction)
 {
     //PHYSICAL_ADDRESS BaseAddress;
-    //POHCI_DEVICE_EXTENSION pDevExt = (POHCI_DEVICE_EXTENSION)hwdev->dev_ext;
+    //PUSBMP_DEVICE_EXTENSION pDevExt = (PUSBMP_DEVICE_EXTENSION)hwdev->dev_ext;
     //PUCHAR VirtualAddress = (PUCHAR) MmGetMdlVirtualAddress(pDevExt->Mdl);
        //ULONG transferSize = size;
        //BOOLEAN WriteToDevice;
index 7832745..5adfa5a 100644 (file)
@@ -61,7 +61,7 @@
 
 #include "uhci_config.h"
 #include "../usb_wrapper.h"
-#include "hcd.h"
+#include "../../usbport/hcd.h"
 #include "uhci-hcd.h"
 
 #if 0
index 5f3e443..080e895 100644 (file)
@@ -7,12 +7,6 @@
 #define NDEBUG
 #include "uhci.h"
 
-/* declare basic init functions and structures */
-int uhci_hcd_init(void);
-void uhci_hcd_cleanup(void);
-int STDCALL usb_init(void);
-void STDCALL usb_exit(void);
-
 extern struct pci_driver uhci_pci_driver;
 extern struct pci_device_id* uhci_pci_ids;
 struct pci_device_id** pci_ids = &uhci_pci_ids;
@@ -22,7 +16,7 @@ InitLinuxWrapper(PDEVICE_OBJECT DeviceObject)
 {
        NTSTATUS Status = STATUS_SUCCESS;
 
-       POHCI_DEVICE_EXTENSION DeviceExtension = (POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+       PUSBMP_DEVICE_EXTENSION DeviceExtension = (PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
        
        /* Create generic linux structure */
        struct pci_dev *dev;
@@ -38,7 +32,7 @@ InitLinuxWrapper(PDEVICE_OBJECT DeviceObject)
        strcpy(dev->dev.name, "UnivHCI PCI-USB Controller");
        strcpy(dev->slot_name, "UHCD PCI Slot");
        
-       /* Init the OHCI HCD. Probe will be called automatically, but will fail because id=NULL */
+       /* Init the HCD. Probe will be called automatically, but will fail because id=NULL */
        Status = uhci_hcd_init();
        if (!NT_SUCCESS(Status))
        {
@@ -64,12 +58,12 @@ InitLinuxWrapper(PDEVICE_OBJECT DeviceObject)
 VOID STDCALL 
 DriverUnload(PDRIVER_OBJECT DriverObject)
 {
-       POHCI_DEVICE_EXTENSION DeviceExtension;
+       PUSBMP_DEVICE_EXTENSION DeviceExtension;
        PDEVICE_OBJECT DeviceObject;
        struct pci_dev *dev;
 
        DeviceObject = DriverObject->DeviceObject;
-       DeviceExtension = (POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+       DeviceExtension = (PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
 
        dev = DeviceExtension->pdev;
 
@@ -78,7 +72,7 @@ DriverUnload(PDRIVER_OBJECT DriverObject)
        // Exit usb device
        usb_exit();
 
-       // Remove device (ohci_pci_driver.remove)
+       // Remove device (uhci_pci_driver.remove)
        uhci_pci_driver.remove(dev);
 
        ExFreePool(dev->slot_name);
diff --git a/reactos/drivers/usb/miniport/usbuhci/uhci.h b/reactos/drivers/usb/miniport/usbuhci/uhci.h
new file mode 100644 (file)
index 0000000..eec2042
--- /dev/null
@@ -0,0 +1,9 @@
+#include "usbcommon.h"\r
+\r
+#define USB_UHCI_TAG TAG('u','s','b','u')\r
+\r
+/* declare basic init functions and structures */\r
+int uhci_hcd_init(void);\r
+void uhci_hcd_cleanup(void);\r
+int STDCALL usb_init(void);\r
+void STDCALL usb_exit(void);\r
index 8268ddc..e052ae4 100644 (file)
@@ -2,7 +2,6 @@
        <define name="__USE_W32API" />
        <define name="DEBUG_MODE" />
        <include>../linux</include>
-       <include base="usbport"></include>
        <include base="usbminiportcommon"></include>
        <library>sys_base</library>
        <library>usbminiportcommon</library>