mirror of
https://github.com/reactos/reactos.git
synced 2024-07-06 20:55:16 +00:00
Move shareable part of USB miniport drivers to a new directory. UHCI uses it.
svn path=/trunk/; revision=17782
This commit is contained in:
parent
d672727c6a
commit
23d2ee98f5
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
<define name="__USE_W32API" />
|
||||
<define name="DEBUG_MODE" />
|
||||
<include>../linux</include>
|
||||
<include base="usbport"></include>
|
||||
<include base="usbport">.</include>
|
||||
<file>cleanup.c</file>
|
||||
<file>close.c</file>
|
||||
<file>create.c</file>
|
||||
<file>fdo.c</file>
|
||||
<file>main.c</file>
|
||||
<file>misc.c</file>
|
||||
<file>pdo.c</file>
|
||||
<file>uhci.c</file>
|
||||
</module>
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
|
||||
#define USB_MINIPORT_TAG TAG('u','s','b','m')
|
||||
|
||||
#include "../usbohci/ohci_main.h"
|
||||
|
||||
#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
|
56
reactos/drivers/usb/miniport/common/usbcommon_types.h
Normal file
56
reactos/drivers/usb/miniport/common/usbcommon_types.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
#ifndef _USBMP_COMMON_TYPES_H_
|
||||
#define _USBMP_COMMON_TYPES_H_
|
||||
|
||||
typedef struct _USBMP_DRIVER_EXTENSION
|
||||
{
|
||||
//OHCI_HW_INITIALIZATION_DATA InitializationData;
|
||||
//PVOID HwContext;
|
||||
//UNICODE_STRING RegistryPath;
|
||||
|
||||
} USBMP_DRIVER_EXTENSION, *PUSBMP_DRIVER_EXTENSION;
|
||||
|
||||
typedef struct _USBMP_DEVICE_EXTENSTION
|
||||
{
|
||||
ULONG DeviceNumber;
|
||||
PDEVICE_OBJECT PhysicalDeviceObject;
|
||||
PDEVICE_OBJECT FunctionalDeviceObject;
|
||||
PDEVICE_OBJECT NextDeviceObject;
|
||||
//UNICODE_STRING RegistryPath;
|
||||
UNICODE_STRING HcdInterfaceName;
|
||||
//PKINTERRUPT InterruptObject;
|
||||
//KSPIN_LOCK InterruptSpinLock;
|
||||
PCM_RESOURCE_LIST AllocatedResources;
|
||||
ULONG InterruptVector;
|
||||
ULONG InterruptLevel;
|
||||
PHYSICAL_ADDRESS BaseAddress;
|
||||
ULONG BaseAddrLength;
|
||||
ULONG Flags;
|
||||
//ULONG AdapterInterfaceType;
|
||||
//ULONG SystemIoBusNumber;
|
||||
ULONG SystemIoSlotNumber;
|
||||
//LIST_ENTRY AddressMappingListHead;
|
||||
|
||||
// DMA stuff, and buffers
|
||||
PDMA_ADAPTER pDmaAdapter;
|
||||
//PVOID MapRegisterBase;
|
||||
ULONG mapRegisterCount;
|
||||
#ifdef USB_DMA_SINGLE_SUPPORT
|
||||
//PHYSICAL_ADDRESS Buffer;
|
||||
//PVOID VirtualBuffer;
|
||||
//ULONG BufferSize;
|
||||
|
||||
// Mdl used for single DMA transfers
|
||||
//PMDL Mdl;
|
||||
#endif
|
||||
|
||||
//KDPC DpcObject;
|
||||
PUSBMP_DRIVER_EXTENSION DriverExtension;
|
||||
ULONG DeviceOpened;
|
||||
//KMUTEX DeviceLock;
|
||||
//CHAR MiniPortDeviceExtension[1];
|
||||
BOOLEAN IsFDO;
|
||||
struct pci_dev * pdev;
|
||||
PDEVICE_OBJECT RootHubPdo;
|
||||
} USBMP_DEVICE_EXTENSION, *PUSBMP_DEVICE_EXTENSION;
|
||||
|
||||
#endif
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
9
reactos/drivers/usb/miniport/usbuhci/uhci.h
Normal file
9
reactos/drivers/usb/miniport/usbuhci/uhci.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include "usbcommon.h"
|
||||
|
||||
#define USB_UHCI_TAG TAG('u','s','b','u')
|
||||
|
||||
/* 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);
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue