https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b2c6c07d0fa0c230381aa2...
commit b2c6c07d0fa0c230381aa2a8d8c66e4aafc2fe24 Author: EricKohl eric.kohl@reactos.org AuthorDate: Thu Oct 12 22:37:43 2017 +0200
[STORPORT] Start the implementation of the storport driver and add it to the build. CORE-13866 --- drivers/storage/port/CMakeLists.txt | 2 +- drivers/storage/port/storport/CMakeLists.txt | 20 + drivers/storage/port/storport/fdo.c | 155 +++++ drivers/storage/port/storport/misc.c | 71 ++ drivers/storage/port/storport/pdo.c | 32 + drivers/storage/port/storport/precomp.h | 113 ++++ drivers/storage/port/storport/storport.c | 975 +++++++++++++++++++++++++++ drivers/storage/port/storport/storport.rc | 5 + drivers/storage/port/storport/storport.spec | 63 ++ drivers/storage/port/storport/stubs.c | 311 +++++++++ 10 files changed, 1746 insertions(+), 1 deletion(-)
diff --git a/drivers/storage/port/CMakeLists.txt b/drivers/storage/port/CMakeLists.txt index dd3cc48096..9a5d2f26aa 100644 --- a/drivers/storage/port/CMakeLists.txt +++ b/drivers/storage/port/CMakeLists.txt @@ -1,2 +1,2 @@ - add_subdirectory(buslogic) +add_subdirectory(storport) diff --git a/drivers/storage/port/storport/CMakeLists.txt b/drivers/storage/port/storport/CMakeLists.txt new file mode 100644 index 0000000000..c531ee6f00 --- /dev/null +++ b/drivers/storage/port/storport/CMakeLists.txt @@ -0,0 +1,20 @@ + +spec2def(storport.sys storport.spec ADD_IMPORTLIB) + +list(APPEND SOURCE + fdo.c + misc.c + pdo.c + storport.c + stubs.c + precomp.h) + +add_library(storport SHARED + ${SOURCE} + storport.rc + ${CMAKE_CURRENT_BINARY_DIR}/storport.def) + +add_pch(storport precomp.h SOURCE) +set_module_type(storport kernelmodedriver) +add_importlibs(storport ntoskrnl hal) +add_cd_file(TARGET storport DESTINATION reactos/system32/drivers NO_CAB FOR all) diff --git a/drivers/storage/port/storport/fdo.c b/drivers/storage/port/storport/fdo.c new file mode 100644 index 0000000000..c8508d0527 --- /dev/null +++ b/drivers/storage/port/storport/fdo.c @@ -0,0 +1,155 @@ +/* + * PROJECT: ReactOS Storport Driver + * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) + * PURPOSE: Storport FDO code + * COPYRIGHT: Copyright 2017 Eric Kohl (eric.kohl@reactos.org) + */ + +/* INCLUDES *******************************************************************/ + +#include "precomp.h" + +#define NDEBUG +#include <debug.h> + + +/* FUNCTIONS ******************************************************************/ + +static +NTSTATUS +NTAPI +PortFdoStartDevice( + _In_ PFDO_DEVICE_EXTENSION DeviceExtension, + _In_ PIRP Irp) +{ + DPRINT1("PortFdoStartDevice(%p %p)\n", + DeviceExtension, Irp); + + ASSERT(DeviceExtension->ExtensionType == FdoExtension); + + return STATUS_SUCCESS; +} + + +static +NTSTATUS +PortFdoQueryBusRelations( + _In_ PFDO_DEVICE_EXTENSION DeviceExtension, + _Out_ PULONG_PTR Information) +{ + NTSTATUS Status = STATUS_SUCCESS;; + + DPRINT1("PortFdoQueryBusRelations(%p %p)\n", + DeviceExtension, Information); + + *Information = 0; + + return Status; +} + + +NTSTATUS +NTAPI +PortFdoPnp( + _In_ PDEVICE_OBJECT DeviceObject, + _In_ PIRP Irp) +{ + PFDO_DEVICE_EXTENSION DeviceExtension; + PIO_STACK_LOCATION Stack; + ULONG_PTR Information = 0; + NTSTATUS Status = STATUS_NOT_SUPPORTED; + + DPRINT1("PortFdoPnp(%p %p)\n", + DeviceObject, Irp); + + DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + ASSERT(DeviceExtension); + ASSERT(DeviceExtension->ExtensionType == FdoExtension); + + Stack = IoGetCurrentIrpStackLocation(Irp); + + switch (Stack->MinorFunction) + { + case IRP_MN_START_DEVICE: /* 0x00 */ + DPRINT1("IRP_MJ_PNP / IRP_MN_START_DEVICE\n"); + /* Call lower driver */ + Status = ForwardIrpAndWait(DeviceExtension->LowerDevice, Irp); + if (NT_SUCCESS(Status)) + { + Status = PortFdoStartDevice(DeviceExtension, Irp); + } + break; + + case IRP_MN_QUERY_REMOVE_DEVICE: /* 0x01 */ + DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_REMOVE_DEVICE\n"); + break; + + case IRP_MN_REMOVE_DEVICE: /* 0x02 */ + DPRINT1("IRP_MJ_PNP / IRP_MN_REMOVE_DEVICE\n"); + break; + + case IRP_MN_CANCEL_REMOVE_DEVICE: /* 0x03 */ + DPRINT1("IRP_MJ_PNP / IRP_MN_CANCEL_REMOVE_DEVICE\n"); + break; + + case IRP_MN_STOP_DEVICE: /* 0x04 */ + DPRINT1("IRP_MJ_PNP / IRP_MN_STOP_DEVICE\n"); + break; + + case IRP_MN_QUERY_STOP_DEVICE: /* 0x05 */ + DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_STOP_DEVICE\n"); + break; + + case IRP_MN_CANCEL_STOP_DEVICE: /* 0x06 */ + DPRINT1("IRP_MJ_PNP / IRP_MN_CANCEL_STOP_DEVICE\n"); + break; + + case IRP_MN_QUERY_DEVICE_RELATIONS: /* 0x07 */ + DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS\n"); + switch (Stack->Parameters.QueryDeviceRelations.Type) + { + case BusRelations: + DPRINT1(" IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n"); + Status = PortFdoQueryBusRelations(DeviceExtension, &Information); + break; + + case RemovalRelations: + DPRINT1(" IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations\n"); + return ForwardIrpAndForget(DeviceExtension->LowerDevice, Irp); + + default: + DPRINT1(" IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n", + Stack->Parameters.QueryDeviceRelations.Type); + return ForwardIrpAndForget(DeviceExtension->LowerDevice, Irp); + } + break; + + case IRP_MN_FILTER_RESOURCE_REQUIREMENTS: /* 0x0d */ + DPRINT1("IRP_MJ_PNP / IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n"); + return ForwardIrpAndForget(DeviceExtension->LowerDevice, Irp); + + case IRP_MN_QUERY_PNP_DEVICE_STATE: /* 0x14 */ + DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_PNP_DEVICE_STATE\n"); + break; + + case IRP_MN_DEVICE_USAGE_NOTIFICATION: /* 0x16 */ + DPRINT1("IRP_MJ_PNP / IRP_MN_DEVICE_USAGE_NOTIFICATION\n"); + break; + + case IRP_MN_SURPRISE_REMOVAL: /* 0x17 */ + DPRINT1("IRP_MJ_PNP / IRP_MN_SURPRISE_REMOVAL\n"); + break; + + default: + DPRINT1("IRP_MJ_PNP / Unknown IOCTL 0x%lx\n", Stack->MinorFunction); + return ForwardIrpAndForget(DeviceExtension->LowerDevice, Irp); + } + + Irp->IoStatus.Information = Information; + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return Status; +} + +/* EOF */ diff --git a/drivers/storage/port/storport/misc.c b/drivers/storage/port/storport/misc.c new file mode 100644 index 0000000000..3f2e254aa1 --- /dev/null +++ b/drivers/storage/port/storport/misc.c @@ -0,0 +1,71 @@ +/* + * PROJECT: ReactOS Storport Driver + * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) + * PURPOSE: Storport helper functions + * COPYRIGHT: Copyright 2017 Eric Kohl (eric.kohl@reactos.org) + */ + +/* INCLUDES *******************************************************************/ + +#include "precomp.h" + +#define NDEBUG +#include <debug.h> + + +/* FUNCTIONS ******************************************************************/ + +static +NTSTATUS +NTAPI +ForwardIrpAndWaitCompletion( + _In_ PDEVICE_OBJECT DeviceObject, + _In_ PIRP Irp, + _In_ PVOID Context) +{ + if (Irp->PendingReturned) + KeSetEvent((PKEVENT)Context, IO_NO_INCREMENT, FALSE); + return STATUS_MORE_PROCESSING_REQUIRED; +} + + +NTSTATUS +ForwardIrpAndWait( + _In_ PDEVICE_OBJECT LowerDevice, + _In_ PIRP Irp) +{ + KEVENT Event; + NTSTATUS Status; + + ASSERT(LowerDevice); + + KeInitializeEvent(&Event, NotificationEvent, FALSE); + IoCopyCurrentIrpStackLocationToNext(Irp); + + IoSetCompletionRoutine(Irp, ForwardIrpAndWaitCompletion, &Event, TRUE, TRUE, TRUE); + + Status = IoCallDriver(LowerDevice, Irp); + if (Status == STATUS_PENDING) + { + Status = KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL); + if (NT_SUCCESS(Status)) + Status = Irp->IoStatus.Status; + } + + return Status; +} + + +NTSTATUS +NTAPI +ForwardIrpAndForget( + _In_ PDEVICE_OBJECT LowerDevice, + _In_ PIRP Irp) +{ + ASSERT(LowerDevice); + + IoSkipCurrentIrpStackLocation(Irp); + return IoCallDriver(LowerDevice, Irp); +} + +/* EOF */ diff --git a/drivers/storage/port/storport/pdo.c b/drivers/storage/port/storport/pdo.c new file mode 100644 index 0000000000..fb7280ccc0 --- /dev/null +++ b/drivers/storage/port/storport/pdo.c @@ -0,0 +1,32 @@ +/* + * PROJECT: ReactOS Storport Driver + * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) + * PURPOSE: Storport PDO code + * COPYRIGHT: Copyright 2017 Eric Kohl (eric.kohl@reactos.org) + */ + +/* INCLUDES *******************************************************************/ + +#include "precomp.h" + +#define NDEBUG +#include <debug.h> + + +/* FUNCTIONS ******************************************************************/ + +NTSTATUS +NTAPI +PortPdoPnp( + _In_ PDEVICE_OBJECT DeviceObject, + _In_ PIRP Irp) +{ + DPRINT1("PortPdoPnp()\n"); + + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_SUCCESS; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; +} + +/* EOF */ diff --git a/drivers/storage/port/storport/precomp.h b/drivers/storage/port/storport/precomp.h new file mode 100644 index 0000000000..c82d345893 --- /dev/null +++ b/drivers/storage/port/storport/precomp.h @@ -0,0 +1,113 @@ +/* + * PROJECT: ReactOS Storport Driver + * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) + * PURPOSE: Storport driver common header file + * COPYRIGHT: Copyright 2017 Eric Kohl (eric.kohl@reactos.org) + */ + +#ifndef _STORPORT_PCH_ +#define _STORPORT_PCH_ + +#include <wdm.h> +#include <ntddk.h> +#include <stdio.h> +#include <storport.h> +#include <ntddscsi.h> +#include <ntdddisk.h> +#include <mountdev.h> + +typedef enum +{ + dsStopped, + dsStarted, + dsPaused, + dsRemoved, + dsSurpriseRemoved +} DEVICE_STATE; + +typedef enum +{ + InvalidExtension = 0, + DriverExtension, + FdoExtension, + PdoExtension +} EXTENSION_TYPE; + +typedef struct _DRIVER_OBJECT_EXTENSION +{ + EXTENSION_TYPE ExtensionType; + + PDRIVER_OBJECT DriverObject; + + KSPIN_LOCK AdapterListLock; + LIST_ENTRY AdapterListHead; + ULONG AdapterCount; + +} DRIVER_OBJECT_EXTENSION, *PDRIVER_OBJECT_EXTENSION; + +typedef struct _FDO_DEVICE_EXTENSION +{ + EXTENSION_TYPE ExtensionType; + + PDEVICE_OBJECT Device; + PDEVICE_OBJECT LowerDevice; + PDEVICE_OBJECT PhysicalDevice; + + DEVICE_STATE PnpState; + + LIST_ENTRY AdapterListEntry; +} FDO_DEVICE_EXTENSION, *PFDO_DEVICE_EXTENSION; + + +typedef struct _PDO_DEVICE_EXTENSION +{ + EXTENSION_TYPE ExtensionType; + + PDEVICE_OBJECT AttachedFdo; + + DEVICE_STATE PnpState; + +} PDO_DEVICE_EXTENSION, *PPDO_DEVICE_EXTENSION; + + +/* fdo.c */ + +NTSTATUS +NTAPI +PortFdoPnp( + _In_ PDEVICE_OBJECT DeviceObject, + _In_ PIRP Irp); + + +/* misc.c */ + +NTSTATUS +ForwardIrpAndWait( + _In_ PDEVICE_OBJECT LowerDevice, + _In_ PIRP Irp); + +NTSTATUS +NTAPI +ForwardIrpAndForget( + _In_ PDEVICE_OBJECT LowerDevice, + _In_ PIRP Irp); + + +/* pdo.c */ + +NTSTATUS +NTAPI +PortPdoPnp( + _In_ PDEVICE_OBJECT DeviceObject, + _In_ PIRP Irp); + + +/* storport.c */ + +NTSTATUS +NTAPI +DriverEntry( + _In_ PDRIVER_OBJECT DriverObject, + _In_ PUNICODE_STRING RegistryPath); + +#endif /* _STORPORT_PCH_ */ diff --git a/drivers/storage/port/storport/storport.c b/drivers/storage/port/storport/storport.c new file mode 100644 index 0000000000..9b227dd834 --- /dev/null +++ b/drivers/storage/port/storport/storport.c @@ -0,0 +1,975 @@ +/* + * PROJECT: ReactOS Storport Driver + * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) + * PURPOSE: Storport driver main file + * COPYRIGHT: Copyright 2017 Eric Kohl (eric.kohl@reactos.org) + */ + +/* INCLUDES *******************************************************************/ + +#include "precomp.h" + +#define NDEBUG +#include <debug.h> + + +/* GLOBALS ********************************************************************/ + +ULONG PortNumber = 0; + + +/* FUNCTIONS ******************************************************************/ + +static +NTSTATUS +NTAPI +PortAddDevice( + _In_ PDRIVER_OBJECT DriverObject, + _In_ PDEVICE_OBJECT PhysicalDeviceObject) +{ + PDRIVER_OBJECT_EXTENSION DriverObjectExtension; + PFDO_DEVICE_EXTENSION DeviceExtension = NULL; + WCHAR NameBuffer[80]; + UNICODE_STRING DeviceName; + PDEVICE_OBJECT Fdo = NULL; + KLOCK_QUEUE_HANDLE LockHandle; + NTSTATUS Status; + + DPRINT1("PortAddDevice(%p %p)\n", + DriverObject, PhysicalDeviceObject); + + ASSERT(DriverObject); + ASSERT(PhysicalDeviceObject); + + swprintf(NameBuffer, + L"\Device\RaidPort%lu", + PortNumber); + RtlInitUnicodeString(&DeviceName, NameBuffer); + PortNumber++; + + DPRINT1("Creating device: %wZ\n", &DeviceName); + + /* Create the port device */ + Status = IoCreateDevice(DriverObject, + sizeof(FDO_DEVICE_EXTENSION), + &DeviceName, + FILE_DEVICE_CONTROLLER, + FILE_DEVICE_SECURE_OPEN, + FALSE, + &Fdo); + if (!NT_SUCCESS(Status)) + { + DPRINT1("IoCreateDevice() failed (Status 0x%08lx)\n", Status); + return Status; + } + + DPRINT1("Created device: %wZ (%p)\n", &DeviceName, Fdo); + + /* Initialize the device */ + Fdo->Flags |= DO_DIRECT_IO; + Fdo->Flags |= DO_POWER_PAGABLE; + + /* Initialize the device extension */ + DeviceExtension = (PFDO_DEVICE_EXTENSION)Fdo->DeviceExtension; + RtlZeroMemory(DeviceExtension, sizeof(FDO_DEVICE_EXTENSION)); + + DeviceExtension->ExtensionType = FdoExtension; + + DeviceExtension->Device = Fdo; + DeviceExtension->PhysicalDevice = PhysicalDeviceObject; + + DeviceExtension->PnpState = dsStopped; + + /* Attach the FDO to the device stack */ + Status = IoAttachDeviceToDeviceStackSafe(Fdo, + PhysicalDeviceObject, + &DeviceExtension->LowerDevice); + if (!NT_SUCCESS(Status)) + { + DPRINT1("IoAttachDeviceToDeviceStackSafe() failed (Status 0x%08lx)\n", Status); + IoDeleteDevice(Fdo); + return Status; + } + + /* Insert the FDO to the drivers FDO list */ + DriverObjectExtension = IoGetDriverObjectExtension(DriverObject, + (PVOID)DriverEntry); + ASSERT(DriverObjectExtension->ExtensionType == DriverExtension); + + KeAcquireInStackQueuedSpinLock(&DriverObjectExtension->AdapterListLock, + &LockHandle); + + InsertHeadList(&DriverObjectExtension->AdapterListHead, + &DeviceExtension->AdapterListEntry); + DriverObjectExtension->AdapterCount++; + + KeReleaseInStackQueuedSpinLock(&LockHandle); + + /* The device has been initialized */ + Fdo->Flags &= ~DO_DEVICE_INITIALIZING; + + DPRINT1("PortAddDevice() done (Status 0x%08lx)\n", Status); + + return Status; +} + + +static +VOID +NTAPI +PortUnload( + _In_ PDRIVER_OBJECT DriverObject) +{ + DPRINT1("PortUnload(%p)\n", + DriverObject); +} + + +static +NTSTATUS +NTAPI +PortDispatchCreate( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + DPRINT1("PortDispatchCreate(%p %p)\n", + DeviceObject, Irp); + + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = FILE_OPENED; + + IoCompleteRequest( Irp, IO_NO_INCREMENT ); + + return STATUS_SUCCESS; +} + + +static +NTSTATUS +NTAPI +PortDispatchClose( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + DPRINT1("PortDispatchClose(%p %p)\n", + DeviceObject, Irp); + + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return STATUS_SUCCESS; +} + + +static +NTSTATUS +NTAPI +PortDispatchDeviceControl( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + DPRINT1("PortDispatchDeviceControl(%p %p)\n", + DeviceObject, Irp); + + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return STATUS_SUCCESS; +} + + +static +NTSTATUS +NTAPI +PortDispatchScsi( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + DPRINT1("PortDispatchScsi(%p %p)\n", + DeviceObject, Irp); + + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return STATUS_SUCCESS; +} + + +static +NTSTATUS +NTAPI +PortDispatchSystemControl( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + DPRINT1("PortDispatchSystemControl(%p %p)\n", + DeviceObject, Irp); + + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return STATUS_SUCCESS; +} + + +static +NTSTATUS +NTAPI +PortDispatchPnp( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PFDO_DEVICE_EXTENSION DeviceExtension; + + DPRINT1("PortDispatchPnp(%p %p)\n", + DeviceObject, Irp); + + DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + DPRINT1("ExtensionType: %u\n", DeviceExtension->ExtensionType); + + switch (DeviceExtension->ExtensionType) + { + case FdoExtension: + return PortFdoPnp(DeviceObject, + Irp); + + case PdoExtension: + return PortPdoPnp(DeviceObject, + Irp); + + default: + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_UNSUCCESSFUL; + } +} + + +static +NTSTATUS +NTAPI +PortDispatchPower( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + DPRINT1("PortDispatchPower(%p %p)\n", + DeviceObject, Irp); + + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return STATUS_SUCCESS; +} + + +/* PUBLIC FUNCTIONS ***********************************************************/ + +/* + * @implemented + */ +NTSTATUS +NTAPI +DriverEntry( + _In_ PDRIVER_OBJECT DriverObject, + _In_ PUNICODE_STRING RegistryPath) +{ + DPRINT1("DriverEntry(%p %p)\n", DriverObject, RegistryPath); + return STATUS_SUCCESS; +} + + +/* + * @unimplemented + */ +STORPORT_API +PUCHAR +NTAPI +StorPortAllocateRegistryBuffer( + _In_ PVOID HwDeviceExtension, + _In_ PULONG Length) +{ + DPRINT1("StorPortAllocateRegistryBuffer()\n"); + UNIMPLEMENTED; + return NULL; +} + + +/* + * @unimplemented + */ +STORPORT_API +BOOLEAN +NTAPI +StorPortBusy( + _In_ PVOID HwDeviceExtension, + _In_ ULONG RequestsToComplete) +{ + DPRINT1("StorPortBuzy()\n"); + UNIMPLEMENTED; + return FALSE; +} + + +/* + * @unimplemented + */ +STORPORT_API +VOID +NTAPI +StorPortCompleteRequest( + _In_ PVOID HwDeviceExtension, + _In_ UCHAR PathId, + _In_ UCHAR TargetId, + _In_ UCHAR Lun, + _In_ UCHAR SrbStatus) +{ + DPRINT1("StorPortCompleteRequest()\n"); + UNIMPLEMENTED; +} + + +/* + * @implemented + */ +STORPORT_API +ULONG +NTAPI +StorPortConvertPhysicalAddressToUlong( + _In_ STOR_PHYSICAL_ADDRESS Address) +{ + DPRINT1("StorPortConvertPhysicalAddressToUlong()\n"); + + return Address.u.LowPart; +} + + +/* + * @implemented + */ +STORPORT_API +STOR_PHYSICAL_ADDRESS +NTAPI +StorPortConvertUlongToPhysicalAddress( + _In_ ULONG_PTR UlongAddress) +{ + STOR_PHYSICAL_ADDRESS Address; + + DPRINT1("StorPortConvertUlongToPhysicalAddress()\n"); + + Address.QuadPart = UlongAddress; + return Address; +} + + +/* + * @implemented + */ +STORPORT_API +VOID +StorPortDebugPrint( + _In_ ULONG DebugPrintLevel, + _In_ PCHAR DebugMessage, + ...) +{ + va_list ap; + + va_start(ap, DebugMessage); + vDbgPrintExWithPrefix("STORMINI: ", 0x58, DebugPrintLevel, DebugMessage, ap); + va_end(ap); +} + + +/* + * @unimplemented + */ +STORPORT_API +BOOLEAN +NTAPI +StorPortDeviceBusy( + _In_ PVOID HwDeviceExtension, + _In_ UCHAR PathId, + _In_ UCHAR TargetId, + _In_ UCHAR Lun, + _In_ ULONG RequestsToComplete) +{ + DPRINT1("StorPortDeviceBusy()\n"); + UNIMPLEMENTED; + return FALSE; +} + + +/* + * @unimplemented + */ +STORPORT_API +BOOLEAN +NTAPI +StorPortDeviceReady( + _In_ PVOID HwDeviceExtension, + _In_ UCHAR PathId, + _In_ UCHAR TargetId, + _In_ UCHAR Lun) +{ + DPRINT1("StorPortDeviceReady()\n"); + UNIMPLEMENTED; + return FALSE; +} + + +/* + * @implemented + */ +STORPORT_API +VOID +NTAPI +StorPortFreeDeviceBase( + _In_ PVOID HwDeviceExtension, + _In_ PVOID MappedAddress) +{ + DPRINT1("StorPortFreeDeviceBase()\n"); +} + + +/* + * @unimplemented + */ +STORPORT_API +VOID +NTAPI +StorPortFreeRegistryBuffer( + _In_ PVOID HwDeviceExtension, + _In_ PUCHAR Buffer) +{ + DPRINT1("StorPortFreeRegistryBuffer()\n"); + UNIMPLEMENTED; +} + + +/* + * @unimplemented + */ +STORPORT_API +ULONG +NTAPI +StorPortGetBusData( + _In_ PVOID DeviceExtension, + _In_ ULONG BusDataType, + _In_ ULONG SystemIoBusNumber, + _In_ ULONG SlotNumber, + _Out_ _When_(Length != 0, _Out_writes_bytes_(Length)) PVOID Buffer, + _In_ ULONG Length) +{ + DPRINT1("StorPortGetBusData()\n"); + UNIMPLEMENTED; + return 0; +} + + +/* + * @unimplemented + */ +STORPORT_API +PVOID +NTAPI +StorPortGetDeviceBase( + _In_ PVOID HwDeviceExtension, + _In_ INTERFACE_TYPE BusType, + _In_ ULONG SystemIoBusNumber, + _In_ STOR_PHYSICAL_ADDRESS IoAddress, + _In_ ULONG NumberOfBytes, + _In_ BOOLEAN InIoSpace) +{ + DPRINT1("StorPortGetDeviceBase()\n"); + UNIMPLEMENTED; + return NULL; +} + + +/* + * @unimplemented + */ +STORPORT_API +PVOID +NTAPI +StorPortGetLogicalUnit( + _In_ PVOID HwDeviceExtension, + _In_ UCHAR PathId, + _In_ UCHAR TargetId, + _In_ UCHAR Lun) +{ + DPRINT1("StorPortGetLogicalUnit()\n"); + UNIMPLEMENTED; + return NULL; +} + + +/* + * @unimplemented + */ +STORPORT_API +STOR_PHYSICAL_ADDRESS +NTAPI +StorPortGetPhysicalAddress( + _In_ PVOID HwDeviceExtension, + _In_opt_ PSCSI_REQUEST_BLOCK Srb, + _In_ PVOID VirtualAddress, + _Out_ ULONG *Length) +{ + STOR_PHYSICAL_ADDRESS PhysicalAddress; + + DPRINT1("StorPortGetPhysicalAddress(%p %p %p %p)\n", + HwDeviceExtension, Srb, VirtualAddress, Length); + UNIMPLEMENTED; + + *Length = 0; + PhysicalAddress.QuadPart = (LONGLONG)0; + + return PhysicalAddress; +} + + +/* + * @unimplemented + */ +STORPORT_API +PSTOR_SCATTER_GATHER_LIST +NTAPI +StorPortGetScatterGatherList( + _In_ PVOID DeviceExtension, + _In_ PSCSI_REQUEST_BLOCK Srb) +{ + DPRINT1("StorPortGetScatterGatherList()\n"); + UNIMPLEMENTED; + return NULL; +} + + +/* + * @implemented + */ +STORPORT_API +PSCSI_REQUEST_BLOCK +NTAPI +StorPortGetSrb( + _In_ PVOID DeviceExtension, + _In_ UCHAR PathId, + _In_ UCHAR TargetId, + _In_ UCHAR Lun, + _In_ LONG QueueTag) +{ + DPRINT("StorPortGetSrb()\n"); + return NULL; +} + + +/* + * @unimplemented + */ +STORPORT_API +PVOID +NTAPI +StorPortGetUncachedExtension( + _In_ PVOID HwDeviceExtension, + _In_ PPORT_CONFIGURATION_INFORMATION ConfigInfo, + _In_ ULONG NumberOfBytes) +{ + DPRINT1("StorPortGetUncachedExtension(%p %p %lu)\n", + HwDeviceExtension, ConfigInfo, NumberOfBytes); + UNIMPLEMENTED; + return NULL; +} + + +/* + * @unimplemented + */ +STORPORT_API +PVOID +NTAPI +StorPortGetVirtualAddress( + _In_ PVOID HwDeviceExtension, + _In_ STOR_PHYSICAL_ADDRESS PhysicalAddress) +{ + DPRINT1("StorPortGetVirtualAddress(%p %I64x)\n", + HwDeviceExtension, PhysicalAddress.QuadPart); + UNIMPLEMENTED; + return NULL; +} + + +/* + * @implemented + */ +STORPORT_API +ULONG +NTAPI +StorPortInitialize( + _In_ PVOID Argument1, + _In_ PVOID Argument2, + _In_ struct _HW_INITIALIZATION_DATA *HwInitializationData, + _In_opt_ PVOID HwContext) +{ + PDRIVER_OBJECT DriverObject = (PDRIVER_OBJECT)Argument1; + PUNICODE_STRING RegistryPath = (PUNICODE_STRING)Argument2; + PDRIVER_OBJECT_EXTENSION DriverObjectExtension; + NTSTATUS Status = STATUS_SUCCESS; + + DPRINT1("StorPortInitialize(%p %p %p %p)\n", + Argument1, Argument2, HwInitializationData, HwContext); + + DPRINT1("HwInitializationDataSize: %lu\n", HwInitializationData->HwInitializationDataSize); + DPRINT1("AdapterInterfaceType: %u\n", HwInitializationData->AdapterInterfaceType); + DPRINT1("HwInitialize: %p\n", HwInitializationData->HwInitialize); + DPRINT1("HwStartIo: %p\n", HwInitializationData->HwStartIo); + DPRINT1("HwInterrupt: %p\n", HwInitializationData->HwInterrupt); + DPRINT1("HwFindAdapter: %p\n", HwInitializationData->HwFindAdapter); + DPRINT1("HwResetBus: %p\n", HwInitializationData->HwResetBus); + DPRINT1("HwDmaStarted: %p\n", HwInitializationData->HwDmaStarted); + DPRINT1("HwAdapterState: %p\n", HwInitializationData->HwAdapterState); + DPRINT1("DeviceExtensionSize: %lu\n", HwInitializationData->DeviceExtensionSize); + DPRINT1("SpecificLuExtensionSize: %lu\n", HwInitializationData->SpecificLuExtensionSize); + DPRINT1("SrbExtensionSize: %lu\n", HwInitializationData->SrbExtensionSize); + DPRINT1("NumberOfAccessRanges: %lu\n", HwInitializationData->NumberOfAccessRanges); + + /* Check parameters */ + if ((DriverObject == NULL) || + (RegistryPath == NULL) || + (HwInitializationData == NULL)) + { + DPRINT1("Invalid parameter!\n"); + return STATUS_INVALID_PARAMETER; + } + + /* Check initialization data */ + if ((HwInitializationData->HwInitializationDataSize < sizeof(HW_INITIALIZATION_DATA)) || + (HwInitializationData->HwInitialize == NULL) || + (HwInitializationData->HwStartIo == NULL) || + (HwInitializationData->HwFindAdapter == NULL) || + (HwInitializationData->HwResetBus == NULL)) + { + DPRINT1("Revision mismatch!\n"); + return STATUS_REVISION_MISMATCH; + } + + DriverObjectExtension = IoGetDriverObjectExtension(DriverObject, + (PVOID)DriverEntry); + if (DriverObjectExtension == NULL) + { + DPRINT1("No driver object extension!\n"); + + Status = IoAllocateDriverObjectExtension(DriverObject, + (PVOID)DriverEntry, + sizeof(DRIVER_OBJECT_EXTENSION), + (PVOID *)&DriverObjectExtension); + if (!NT_SUCCESS(Status)) + { + DPRINT1("IoAllocateDriverObjectExtension() failed (Status 0x%08lx)\n", Status); + return Status; + } + + DPRINT1("Driver object extension created!\n"); + + /* Initialize the driver object extension */ + RtlZeroMemory(DriverObjectExtension, + sizeof(DRIVER_OBJECT_EXTENSION)); + + DriverObjectExtension->ExtensionType = DriverExtension; + DriverObjectExtension->DriverObject = DriverObject; + + InitializeListHead(&DriverObjectExtension->AdapterListHead); + KeInitializeSpinLock(&DriverObjectExtension->AdapterListLock); + + + /* Set handlers */ + DriverObject->DriverExtension->AddDevice = PortAddDevice; +// DriverObject->DriverStartIo = PortStartIo; + DriverObject->DriverUnload = PortUnload; + DriverObject->MajorFunction[IRP_MJ_CREATE] = PortDispatchCreate; + DriverObject->MajorFunction[IRP_MJ_CLOSE] = PortDispatchClose; + DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = PortDispatchDeviceControl; + DriverObject->MajorFunction[IRP_MJ_SCSI] = PortDispatchScsi; + DriverObject->MajorFunction[IRP_MJ_POWER] = PortDispatchPower; + DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = PortDispatchSystemControl; + DriverObject->MajorFunction[IRP_MJ_PNP] = PortDispatchPnp; + } + + DPRINT1("StorPortInitialize() done (Status 0x%08lx)\n", Status); + + return Status; +} + + +/* + * @unimplemented + */ +STORPORT_API +VOID +NTAPI +StorPortLogError( + _In_ PVOID HwDeviceExtension, + _In_opt_ PSCSI_REQUEST_BLOCK Srb, + _In_ UCHAR PathId, + _In_ UCHAR TargetId, + _In_ UCHAR Lun, + _In_ ULONG ErrorCode, + _In_ ULONG UniqueId) +{ + DPRINT1("ScsiPortLogError() called\n"); + DPRINT1("PathId: 0x%02x TargetId: 0x%02x Lun: 0x%02x ErrorCode: 0x%08lx UniqueId: 0x%08lx\n", + PathId, TargetId, Lun, ErrorCode, UniqueId); + + DPRINT1("ScsiPortLogError() done\n"); +} + + +/* + * @implemented + */ +STORPORT_API +VOID +NTAPI +StorPortMoveMemory( + _Out_writes_bytes_(Length) PVOID Destination, + _In_reads_bytes_(Length) PVOID Source, + _In_ ULONG Length) +{ + RtlMoveMemory(Destination, Source, Length); +} + + +/* + * @unimplemented + */ +STORPORT_API +VOID +StorPortNotification( + _In_ SCSI_NOTIFICATION_TYPE NotificationType, + _In_ PVOID HwDeviceExtension, + ...) +{ + DPRINT1("StorPortNotification()\n"); +} + + +/* + * @unimplemented + */ +STORPORT_API +BOOLEAN +NTAPI +StorPortPause( + _In_ PVOID HwDeviceExtension, + _In_ ULONG TimeOut) +{ + DPRINT1("StorPortPause()\n"); + UNIMPLEMENTED; + return FALSE; +} + + +/* + * @unimplemented + */ +STORPORT_API +BOOLEAN +NTAPI +StorPortPauseDevice( + _In_ PVOID HwDeviceExtension, + _In_ UCHAR PathId, + _In_ UCHAR TargetId, + _In_ UCHAR Lun, + _In_ ULONG TimeOut) +{ + DPRINT1("StorPortPauseDevice()\n"); + UNIMPLEMENTED; + return FALSE; +} + + +/* + * @unimplemented + */ +STORPORT_API +BOOLEAN +NTAPI +StorPortReady( + _In_ PVOID HwDeviceExtension) +{ + DPRINT1("StorPortReady()\n"); + UNIMPLEMENTED; + return FALSE; +} + + +/* + * @unimplemented + */ +STORPORT_API +BOOLEAN +NTAPI +StorPortRegistryRead( + _In_ PVOID HwDeviceExtension, + _In_ PUCHAR ValueName, + _In_ ULONG Global, + _In_ ULONG Type, + _In_ PUCHAR Buffer, + _In_ PULONG BufferLength) +{ + DPRINT1("StorPortRegistryRead()\n"); + UNIMPLEMENTED; + return FALSE; +} + + +/* + * @unimplemented + */ +STORPORT_API +BOOLEAN +NTAPI +StorPortRegistryWrite( + _In_ PVOID HwDeviceExtension, + _In_ PUCHAR ValueName, + _In_ ULONG Global, + _In_ ULONG Type, + _In_ PUCHAR Buffer, + _In_ ULONG BufferLength) +{ + DPRINT1("StorPortRegistryWrite()\n"); + UNIMPLEMENTED; + return FALSE; +} + + +/* + * @unimplemented + */ +STORPORT_API +BOOLEAN +NTAPI +StorPortResume( + _In_ PVOID HwDeviceExtension) +{ + DPRINT1("StorPortResume()\n"); + UNIMPLEMENTED; + return FALSE; +} + + +/* + * @unimplemented + */ +STORPORT_API +BOOLEAN +NTAPI +StorPortResumeDevice( + _In_ PVOID HwDeviceExtension, + _In_ UCHAR PathId, + _In_ UCHAR TargetId, + _In_ UCHAR Lun) +{ + DPRINT1("StorPortResumeDevice()\n"); + UNIMPLEMENTED; + return FALSE; +} + + +/* + * @unimplemented + */ +STORPORT_API +ULONG +NTAPI +StorPortSetBusDataByOffset( + _In_ PVOID DeviceExtension, + _In_ ULONG BusDataType, + _In_ ULONG SystemIoBusNumber, + _In_ ULONG SlotNumber, + _In_reads_bytes_(Length) PVOID Buffer, + _In_ ULONG Offset, + _In_ ULONG Length) +{ + DPRINT1("StorPortSetBusDataByOffset()\n"); + UNIMPLEMENTED; + return 0; +} + + +/* + * @unimplemented + */ +STORPORT_API +BOOLEAN +NTAPI +StorPortSetDeviceQueueDepth( + _In_ PVOID HwDeviceExtension, + _In_ UCHAR PathId, + _In_ UCHAR TargetId, + _In_ UCHAR Lun, + _In_ ULONG Depth) +{ + DPRINT1("StorPortSetDeviceQueueDepth()\n"); + UNIMPLEMENTED; + return FALSE; +} + + +/* + * @implemented + */ +STORPORT_API +VOID +NTAPI +StorPortStallExecution( + _In_ ULONG Delay) +{ + KeStallExecutionProcessor(Delay); +} + + +/* + * @unimplemented + */ +STORPORT_API +VOID +NTAPI +StorPortSynchronizeAccess( + _In_ PVOID HwDeviceExtension, + _In_ PSTOR_SYNCHRONIZED_ACCESS SynchronizedAccessRoutine, + _In_opt_ PVOID Context) +{ + DPRINT1("StorPortSynchronizeAccess()\n"); + UNIMPLEMENTED; +} + + +/* + * @implemented + */ +STORPORT_API +BOOLEAN +NTAPI +StorPortValidateRange( + _In_ PVOID HwDeviceExtension, + _In_ INTERFACE_TYPE BusType, + _In_ ULONG SystemIoBusNumber, + _In_ STOR_PHYSICAL_ADDRESS IoAddress, + _In_ ULONG NumberOfBytes, + _In_ BOOLEAN InIoSpace) +{ + DPRINT1("StorPortValidateRange()\n"); + return TRUE; +} + +/* EOF */ diff --git a/drivers/storage/port/storport/storport.rc b/drivers/storage/port/storport/storport.rc new file mode 100644 index 0000000000..ec00692e01 --- /dev/null +++ b/drivers/storage/port/storport/storport.rc @@ -0,0 +1,5 @@ +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "Storport Driver" +#define REACTOS_STR_INTERNAL_NAME "storport" +#define REACTOS_STR_ORIGINAL_FILENAME "storport.sys" +#include <reactos/version.rc> \ No newline at end of file diff --git a/drivers/storage/port/storport/storport.spec b/drivers/storage/port/storport/storport.spec new file mode 100644 index 0000000000..2596b97279 --- /dev/null +++ b/drivers/storage/port/storport/storport.spec @@ -0,0 +1,63 @@ +# DllInitialize +@ stdcall ScsiPortMoveMemory(ptr ptr long) StorPortMoveMemory +@ cdecl ScsiPortNotification() StorPortNotification +@ stdcall StorPortAllocateRegistryBuffer(ptr ptr) +@ stdcall StorPortBusy(ptr long) +@ stdcall StorPortCompleteRequest(ptr long long long long) +@ stdcall StorPortConvertPhysicalAddressToUlong(long long) +@ stdcall StorPortConvertUlongToPhysicalAddress(long) +@ cdecl StorPortDebugPrint() +@ stdcall StorPortDeviceBusy(ptr long long long long) +@ stdcall StorPortDeviceReady(ptr long long long) +# StorPortExtendedFunction +@ stdcall StorPortFreeDeviceBase(ptr ptr) +@ stdcall StorPortFreeRegistryBuffer(ptr ptr) +@ stdcall StorPortGetBusData(ptr long long long ptr long) +@ stdcall StorPortGetDeviceBase(ptr long long long long long long) +@ stdcall StorPortGetLogicalUnit(ptr long long long) +@ stdcall StorPortGetPhysicalAddress(ptr ptr ptr long) +@ stdcall StorPortGetScatterGatherList(ptr ptr) +@ stdcall StorPortGetSrb(ptr long long long long) +@ stdcall StorPortGetUncachedExtension(ptr ptr long) +@ stdcall StorPortGetVirtualAddress(ptr long long) +@ stdcall StorPortInitialize(ptr ptr ptr ptr) +@ stdcall StorPortLogError(ptr ptr long long long long long) +@ stdcall StorPortMoveMemory(ptr ptr long) +@ cdecl StorPortNotification() +@ stdcall StorPortQuerySystemTime(ptr) NTOSKRNL.KeQuerySystemTime +@ stdcall StorPortPause(ptr long) +@ stdcall StorPortPauseDevice(ptr long long long long) +@ stdcall StorPortReadPortBufferUchar(ptr ptr ptr long) +@ stdcall StorPortReadPortBufferUlong(ptr ptr ptr long) +@ stdcall StorPortReadPortBufferUshort(ptr ptr ptr long) +@ stdcall StorPortReadPortUchar(ptr ptr) +@ stdcall StorPortReadPortUlong(ptr ptr) +@ stdcall StorPortReadPortUshort(ptr ptr) +@ stdcall StorPortReadRegisterBufferUchar(ptr ptr ptr long) +@ stdcall StorPortReadRegisterBufferUlong(ptr ptr ptr long) +@ stdcall StorPortReadRegisterBufferUshort(ptr ptr ptr long) +@ stdcall StorPortReadRegisterUchar(ptr ptr) +@ stdcall StorPortReadRegisterUlong(ptr ptr) +@ stdcall StorPortReadRegisterUshort(ptr ptr) +@ stdcall StorPortReady(ptr) +@ stdcall StorPortRegistryRead(ptr ptr long long ptr ptr) +@ stdcall StorPortRegistryWrite(ptr ptr long long ptr long) +@ stdcall StorPortResume(ptr) +@ stdcall StorPortResumeDevice(ptr long long long) +@ stdcall StorPortSetBusDataByOffset(ptr long long long ptr long long) +@ stdcall StorPortSetDeviceQueueDepth(ptr long long long long) +@ stdcall StorPortStallExecution(long) +@ stdcall StorPortSynchronizeAccess(ptr ptr ptr) +@ stdcall StorPortValidateRange(ptr long long long long long long) +@ stdcall StorPortWritePortBufferUchar(ptr ptr ptr long) +@ stdcall StorPortWritePortBufferUlong(ptr ptr ptr long) +@ stdcall StorPortWritePortBufferUshort(ptr ptr ptr long) +@ stdcall StorPortWritePortUchar(ptr ptr long) +@ stdcall StorPortWritePortUlong(ptr ptr long) +@ stdcall StorPortWritePortUshort(ptr ptr long) +@ stdcall StorPortWriteRegisterBufferUchar(ptr ptr ptr long) +@ stdcall StorPortWriteRegisterBufferUlong(ptr ptr ptr long) +@ stdcall StorPortWriteRegisterBufferUshort(ptr ptr ptr long) +@ stdcall StorPortWriteRegisterUchar(ptr ptr long) +@ stdcall StorPortWriteRegisterUlong(ptr ptr long) +@ stdcall StorPortWriteRegisterUshort(ptr ptr long) diff --git a/drivers/storage/port/storport/stubs.c b/drivers/storage/port/storport/stubs.c new file mode 100644 index 0000000000..80210dfd75 --- /dev/null +++ b/drivers/storage/port/storport/stubs.c @@ -0,0 +1,311 @@ +/* + * PROJECT: ReactOS Storport Driver + * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) + * PURPOSE: Storport driver stub functions + * COPYRIGHT: Copyright 2017 Eric Kohl (eric.kohl@reactos.org) + */ + +/* INCLUDES *******************************************************************/ + +#include "precomp.h" + +#define NDEBUG +#include <debug.h> + + +/* FUNCTIONS ******************************************************************/ + +STORPORT_API +VOID +NTAPI +StorPortReadPortBufferUchar( + _In_ PVOID HwDeviceExtension, + _In_ PUCHAR Port, + _In_ PUCHAR Buffer, + _In_ ULONG Count) +{ + READ_PORT_BUFFER_UCHAR(Port, Buffer, Count); +} + + +STORPORT_API +VOID +NTAPI +StorPortReadPortBufferUlong( + _In_ PVOID HwDeviceExtension, + _In_ PULONG Port, + _In_ PULONG Buffer, + _In_ ULONG Count) +{ + READ_PORT_BUFFER_ULONG(Port, Buffer, Count); +} + + +STORPORT_API +VOID +NTAPI +StorPortReadPortBufferUshort( + _In_ PVOID HwDeviceExtension, + _In_ PUSHORT Port, + _In_ PUSHORT Buffer, + _In_ ULONG Count) +{ + READ_PORT_BUFFER_USHORT(Port, Buffer, Count); +} + + +STORPORT_API +UCHAR +NTAPI +StorPortReadPortUchar( + _In_ PVOID HwDeviceExtension, + _In_ PUCHAR Port) +{ + return READ_PORT_UCHAR(Port); +} + + +STORPORT_API +ULONG +NTAPI +StorPortReadPortUlong( + _In_ PVOID HwDeviceExtension, + _In_ PULONG Port) +{ + return READ_PORT_ULONG(Port); +} + + +STORPORT_API +USHORT +NTAPI +StorPortReadPortUshort( + _In_ PVOID HwDeviceExtension, + _In_ PUSHORT Port) +{ + return READ_PORT_USHORT(Port); +} + + +STORPORT_API +VOID +NTAPI +StorPortReadRegisterBufferUchar( + _In_ PVOID HwDeviceExtension, + _In_ PUCHAR Register, + _In_ PUCHAR Buffer, + _In_ ULONG Count) +{ + READ_REGISTER_BUFFER_UCHAR(Register, Buffer, Count); +} + + +STORPORT_API +VOID +NTAPI +StorPortReadRegisterBufferUlong( + _In_ PVOID HwDeviceExtension, + _In_ PULONG Register, + _In_ PULONG Buffer, + _In_ ULONG Count) +{ + READ_REGISTER_BUFFER_ULONG(Register, Buffer, Count); +} + + +STORPORT_API +VOID +NTAPI +StorPortReadRegisterBufferUshort( + _In_ PVOID HwDeviceExtension, + _In_ PUSHORT Register, + _In_ PUSHORT Buffer, + _In_ ULONG Count) +{ + READ_REGISTER_BUFFER_USHORT(Register, Buffer, Count); +} + + +STORPORT_API +UCHAR +NTAPI +StorPortReadRegisterUchar( + _In_ PVOID HwDeviceExtension, + _In_ PUCHAR Register) +{ + return READ_REGISTER_UCHAR(Register); +} + + +STORPORT_API +ULONG +NTAPI +StorPortReadRegisterUlong( + _In_ PVOID HwDeviceExtension, + _In_ PULONG Register) +{ + return READ_REGISTER_ULONG(Register); +} + + +STORPORT_API +USHORT +NTAPI +StorPortReadRegisterUshort( + _In_ PVOID HwDeviceExtension, + _In_ PUSHORT Register) +{ + return READ_REGISTER_USHORT(Register); +} + + +STORPORT_API +VOID +NTAPI +StorPortWritePortBufferUchar( + _In_ PVOID HwDeviceExtension, + _In_ PUCHAR Port, + _In_ PUCHAR Buffer, + _In_ ULONG Count) +{ + WRITE_PORT_BUFFER_UCHAR(Port, Buffer, Count); +} + + +STORPORT_API +VOID +NTAPI +StorPortWritePortBufferUlong( + _In_ PVOID HwDeviceExtension, + _In_ PULONG Port, + _In_ PULONG Buffer, + _In_ ULONG Count) +{ + WRITE_PORT_BUFFER_ULONG(Port, Buffer, Count); +} + + +STORPORT_API +VOID +NTAPI +StorPortWritePortBufferUshort( + _In_ PVOID HwDeviceExtension, + _In_ PUSHORT Port, + _In_ PUSHORT Buffer, + _In_ ULONG Count) +{ + WRITE_PORT_BUFFER_USHORT(Port, Buffer, Count); +} + + +STORPORT_API +VOID +NTAPI +StorPortWritePortUchar( + _In_ PVOID HwDeviceExtension, + _In_ PUCHAR Port, + _In_ UCHAR Value) +{ + WRITE_PORT_UCHAR(Port, Value); +} + + +STORPORT_API +VOID +NTAPI +StorPortWritePortUlong( + _In_ PVOID HwDeviceExtension, + _In_ PULONG Port, + _In_ ULONG Value) +{ + WRITE_PORT_ULONG(Port, Value); +} + + +STORPORT_API +VOID +NTAPI +StorPortWritePortUshort( + _In_ PVOID HwDeviceExtension, + _In_ PUSHORT Port, + _In_ USHORT Value) +{ + WRITE_PORT_USHORT(Port, Value); +} + + +STORPORT_API +VOID +NTAPI +StorPortWriteRegisterBufferUchar( + _In_ PVOID HwDeviceExtension, + _In_ PUCHAR Register, + _In_ PUCHAR Buffer, + _In_ ULONG Count) +{ + WRITE_REGISTER_BUFFER_UCHAR(Register, Buffer, Count); +} + + +STORPORT_API +VOID +NTAPI +StorPortWriteRegisterBufferUlong( + _In_ PVOID HwDeviceExtension, + _In_ PULONG Register, + _In_ PULONG Buffer, + _In_ ULONG Count) +{ + WRITE_REGISTER_BUFFER_ULONG(Register, Buffer, Count); +} + + +STORPORT_API +VOID +NTAPI +StorPortWriteRegisterBufferUshort( + _In_ PVOID HwDeviceExtension, + _In_ PUSHORT Register, + _In_ PUSHORT Buffer, + _In_ ULONG Count) +{ + WRITE_REGISTER_BUFFER_USHORT(Register, Buffer, Count); +} + + +STORPORT_API +VOID +NTAPI +StorPortWriteRegisterUchar( + _In_ PVOID HwDeviceExtension, + _In_ PUCHAR Register, + _In_ UCHAR Value) +{ + WRITE_REGISTER_UCHAR(Register, Value); +} + + +STORPORT_API +VOID +NTAPI +StorPortWriteRegisterUlong( + _In_ PVOID HwDeviceExtension, + _In_ PULONG Register, + _In_ ULONG Value) +{ + WRITE_REGISTER_ULONG(Register, Value); +} + + +STORPORT_API +VOID +NTAPI +StorPortWriteRegisterUshort( + _In_ PVOID HwDeviceExtension, + _In_ PUSHORT Register, + _In_ USHORT Value) +{ + WRITE_REGISTER_USHORT(Register, Value); +} + +/* EOF */